UNPKG

ivt

Version:

Ivt Components Library

1 lines 5.97 kB
{"version":3,"file":"index.mjs","sources":["../../src/components/ui/sheet/sheet.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { XIcon } from \"lucide-react\";\nimport React from \"react\";\n\nfunction Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {\n\treturn <SheetPrimitive.Root data-slot=\"sheet\" {...props} />;\n}\n\nfunction SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n\treturn <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />;\n}\n\nfunction SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {\n\treturn <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />;\n}\n\nfunction SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {\n\treturn <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />;\n}\n\nfunction SheetOverlay({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {\n\treturn (\n\t\t<SheetPrimitive.Overlay\n\t\t\tdata-slot=\"sheet-overlay\"\n\t\t\tclassName={cn(\n\t\t\t\t\"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetContent({\n\tclassName,\n\tchildren,\n\tside = \"right\",\n\t...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & {\n\tside?: \"top\" | \"right\" | \"bottom\" | \"left\";\n}) {\n\treturn (\n\t\t<SheetPortal>\n\t\t\t<SheetOverlay />\n\t\t\t<SheetPrimitive.Content\n\t\t\t\tdata-slot=\"sheet-content\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 gap-4 p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500\",\n\t\t\t\t\tside === \"right\" &&\n\t\t\t\t\t\t\"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\",\n\t\t\t\t\tside === \"left\" &&\n\t\t\t\t\t\t\"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\",\n\t\t\t\t\tside === \"top\" &&\n\t\t\t\t\t\t\"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 border-b\",\n\t\t\t\t\tside === \"bottom\" &&\n\t\t\t\t\t\t\"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 border-t\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<SheetPrimitive.Close className=\"border-border-grid-container bg-card ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 cursor-pointer rounded-sm border p-1.5 opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none\">\n\t\t\t\t\t<XIcon className=\"size-4\" />\n\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t</SheetPrimitive.Close>\n\t\t\t</SheetPrimitive.Content>\n\t\t</SheetPortal>\n\t);\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sheet-header\"\n\t\t\tclassName={cn(\"flex flex-col space-y-2 text-center sm:text-left\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"sheet-footer\"\n\t\t\tclassName={cn(\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {\n\treturn (\n\t\t<SheetPrimitive.Title\n\t\t\tdata-slot=\"sheet-title\"\n\t\t\tclassName={cn(\"text-foreground text-lg font-semibold\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SheetDescription({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n\treturn (\n\t\t<SheetPrimitive.Description\n\t\t\tdata-slot=\"sheet-description\"\n\t\t\tclassName={cn(\"text-muted-foreground text-sm\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tSheet,\n\tSheetTrigger,\n\tSheetClose,\n\tSheetContent,\n\tSheetHeader,\n\tSheetFooter,\n\tSheetTitle,\n\tSheetDescription,\n};\n"],"names":["Sheet","props","React","createElement","SheetPrimitive","data-slot","SheetTrigger","SheetClose","SheetPortal","SheetOverlay","className","cn","SheetContent","children","side","XIcon","span","SheetHeader","div","SheetFooter","SheetTitle","SheetDescription"],"mappings":"wzBAKA,SAASA,MAAWC,IACnB,OAAOC,EAAAC,cAACC,EAAmB,CAACC,YAAU,WAAYJ,GACnD,CAEA,SAASK,MAAkBL,IAC1B,OAAOC,EAAAC,cAACC,EAAsB,CAACC,YAAU,mBAAoBJ,GAC9D,CAEA,SAASM,MAAgBN,IACxB,OAAOC,EAAAC,cAACC,EAAoB,CAACC,YAAU,iBAAkBJ,GAC1D,CAEA,SAASO,MAAiBP,IACzB,OAAOC,EAAAC,cAACC,EAAqB,CAACC,YAAU,kBAAmBJ,GAC5D,CAEA,SAASQ,GAAaC,UACrBA,KACGT,IAEH,OACCC,EAAAC,cAACC,EAAsB,CACtBC,YAAU,gBACVK,UAAWC,EACV,yJACAD,MAEGT,GAGP,CAEA,SAASW,G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