diff --git a/README.md b/README.md index 8223fde..c71dab0 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ https://www.npmjs.com/package/@risc0/ui | Statements | Branches | Functions | Lines | | --------------------------- | ----------------------- | ------------------------- | ----------------- | -| ![Statements](https://img.shields.io/badge/statements-38.99%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-74.68%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-61.9%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-38.99%25-red.svg?style=flat) | +| ![Statements](https://img.shields.io/badge/statements-37.29%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-73.75%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-60.46%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-37.29%25-red.svg?style=flat) | diff --git a/package.json b/package.json index f15f8ec..21755db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@risc0/ui", - "version": "0.0.156", + "version": "0.0.157", "private": false, "sideEffects": false, "type": "module", @@ -15,20 +15,19 @@ "story": "ladle serve" }, "dependencies": { - "@radix-ui/react-alert-dialog": "^1.1.1", "@radix-ui/react-avatar": "1.1.0", "@radix-ui/react-checkbox": "1.1.1", "@radix-ui/react-dialog": "1.0.5", "@radix-ui/react-dropdown-menu": "2.1.1", "@radix-ui/react-label": "2.1.0", - "@radix-ui/react-navigation-menu": "^1.2.0", + "@radix-ui/react-navigation-menu": "1.2.0", "@radix-ui/react-popover": "1.1.1", "@radix-ui/react-progress": "1.1.0", "@radix-ui/react-radio-group": "1.2.0", "@radix-ui/react-select": "2.1.1", "@radix-ui/react-separator": "1.1.0", "@radix-ui/react-slider": "1.2.0", - "@radix-ui/react-slot": "^1.1.0", + "@radix-ui/react-slot": "1.1.0", "@radix-ui/react-switch": "1.1.0", "@radix-ui/react-tabs": "1.1.0", "@radix-ui/react-tooltip": "1.1.2", @@ -36,7 +35,7 @@ "class-variance-authority": "0.7.1-canary.2", "clsx": "2.1.1", "cmdk": "1.0.0", - "lucide-react": "0.428.0", + "lucide-react": "0.429.0", "next": "15.0.0-canary.120", "next-themes": "0.3.0", "radash": "12.1.0", @@ -48,7 +47,7 @@ "tailwind-merge": "2.5.2", "tailwindcss": "3.4.10", "tailwindcss-animate": "1.0.7", - "typescript": "5.6.0-dev.20240819", + "typescript": "5.7.0-dev.20240822", "vaul": "0.9.1" }, "devDependencies": { @@ -61,7 +60,7 @@ "@vitejs/plugin-react-swc": "3.7.0", "@vitest/coverage-v8": "2.0.5", "deepmerge": "4.3.1", - "happy-dom": "14.12.3", + "happy-dom": "15.0.0", "istanbul-badges-readme": "1.9.0", "npm-run-all": "4.1.5" }, diff --git a/sheet.tsx b/sheet.tsx new file mode 100644 index 0000000..73e3244 --- /dev/null +++ b/sheet.tsx @@ -0,0 +1,112 @@ +"use client"; + +import * as SheetPrimitive from "@radix-ui/react-dialog"; +import { type VariantProps, cva } from "class-variance-authority"; +import { cn } from "cn"; +import { XIcon } from "lucide-react"; +import { type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes, forwardRef } from "react"; + +const Sheet = SheetPrimitive.Root; +const SheetTrigger = SheetPrimitive.Trigger; +const SheetClose = SheetPrimitive.Close; +const SheetPortal = SheetPrimitive.Portal; + +const sheetVariants = cva( + "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:duration-300 data-[state=open]:duration-500", + { + variants: { + side: { + top: "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 border-b", + bottom: + "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 border-t", + left: "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", + right: + "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, + }, +); + +const SheetOverlay = forwardRef< + ElementRef, + ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +interface SheetContentProps + extends ComponentPropsWithoutRef, + VariantProps {} + +const SheetContent = forwardRef, SheetContentProps>( + ({ side = "right", className, children, ...props }, ref) => { + return ( + + + + + + Close + + {children} + + + ); + }, +); + +const SheetHeader = ({ className, ...props }: HTMLAttributes) => { + return
; +}; + +const SheetFooter = ({ className, ...props }: HTMLAttributes) => { + return
; +}; + +const SheetTitle = forwardRef< + ElementRef, + ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ); +}); + +const SheetDescription = forwardRef< + ElementRef, + ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ; +}); + +SheetOverlay.displayName = SheetPrimitive.Overlay.displayName; +SheetDescription.displayName = SheetPrimitive.Description.displayName; +SheetTitle.displayName = SheetPrimitive.Title.displayName; +SheetFooter.displayName = "SheetFooter"; +SheetHeader.displayName = "SheetHeader"; +SheetContent.displayName = SheetPrimitive.Content.displayName; + +export { + Sheet, + SheetPortal, + SheetOverlay, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +};