UNPKG

@loke/design-system

Version:

A design system with individually importable components

3 lines (2 loc) 6.24 kB
"use client"; var __create=Object.create;var{getPrototypeOf:__getProtoOf,defineProperty:__defProp,getOwnPropertyNames:__getOwnPropNames,getOwnPropertyDescriptor:__getOwnPropDesc}=Object,__hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toESMCache_node,__toESMCache_esm,__toESM=(mod,isNodeMode,target)=>{var canCache=mod!=null&&typeof mod==="object";if(canCache){var cache=isNodeMode?__toESMCache_node??=new WeakMap:__toESMCache_esm??=new WeakMap,cached=cache.get(mod);if(cached)return cached}target=mod!=null?__create(__getProtoOf(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames(mod))if(!__hasOwnProp.call(to,key))__defProp(to,key,{get:__accessProp.bind(mod,key),enumerable:!0});if(canCache)cache.set(mod,to);return to},__toCommonJS=(from)=>{var entry=(__moduleCache??=new WeakMap).get(from),desc;if(entry)return entry;if(entry=__defProp({},"__esModule",{value:!0}),from&&typeof from==="object"||typeof from==="function"){for(var key of __getOwnPropNames(from))if(!__hasOwnProp.call(entry,key))__defProp(entry,key,{get:__accessProp.bind(from,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return __moduleCache.set(from,entry),entry},__moduleCache;var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:__exportSetter.bind(all,name)})};var exports_sheet={};__export(exports_sheet,{SheetTrigger:()=>SheetTrigger,SheetTitle:()=>SheetTitle,SheetPortal:()=>SheetPortal,SheetOverlay:()=>SheetOverlay,SheetHeader:()=>SheetHeader,SheetFooter:()=>SheetFooter,SheetDescription:()=>SheetDescription,SheetContent:()=>SheetContent,SheetClose:()=>SheetClose,Sheet:()=>Sheet});module.exports=__toCommonJS(exports_sheet);var import_cn=require("@loke/design-system/cn"),import_icons=require("@loke/icons"),DialogPrimitive=__toESM(require("@loke/ui/dialog")),import_class_variance_authority=require("class-variance-authority"),import_react=require("react"),jsx_runtime=require("react/jsx-runtime");function Sheet({...props}){return jsx_runtime.jsx(DialogPrimitive.Root,{"data-slot":"sheet",...props})}function SheetTrigger({...props}){return jsx_runtime.jsx(DialogPrimitive.Trigger,{"data-slot":"sheet-trigger",...props})}function SheetClose({...props}){return jsx_runtime.jsx(DialogPrimitive.Close,{"data-slot":"sheet-close",...props})}function SheetPortal({...props}){return jsx_runtime.jsx(DialogPrimitive.Portal,{"data-slot":"sheet-portal",...props})}var SheetOverlay=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(DialogPrimitive.Overlay,{className:import_cn.cn("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80 data-[state=closed]:animate-out data-[state=open]:animate-in",className),"data-slot":"sheet-overlay",...props,ref}));SheetOverlay.displayName=DialogPrimitive.Overlay.displayName;var sheetVariants=import_class_variance_authority.cva("fixed z-50 bg-card shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500 flex flex-col",{defaultVariants:{side:"right"},variants:{side:{bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right max-w-sm",top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top"}}}),SheetContent=import_react.forwardRef(({side="right",className,children,...props},ref)=>jsx_runtime.jsxs(SheetPortal,{children:[jsx_runtime.jsx(SheetOverlay,{}),jsx_runtime.jsxs(DialogPrimitive.Content,{className:import_cn.cn(sheetVariants({side}),className),"data-slot":"sheet-content",ref,...props,children:[jsx_runtime.jsx("div",{className:"flex h-full grow flex-col overflow-y-auto px-6","data-slot":"sheet-body",children}),jsx_runtime.jsxs(DialogPrimitive.Close,{className:"absolute top-4 right-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary","data-slot":"sheet-close",children:[jsx_runtime.jsx(import_icons.X,{className:"size-4"}),jsx_runtime.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));SheetContent.displayName=DialogPrimitive.Content.displayName;var SheetHeader=({className,...props})=>jsx_runtime.jsx("div",{className:import_cn.cn("sticky top-0 z-10 -mx-6 flex flex-col space-y-2 border-b bg-card px-6 py-4 text-center sm:text-left",className),"data-slot":"sheet-header",...props});SheetHeader.displayName="SheetHeader";var SheetFooter=({className,...props})=>jsx_runtime.jsx("div",{className:import_cn.cn("sticky bottom-0 z-10 -mx-6 mt-auto flex flex-col-reverse border-t bg-card px-6 py-4 sm:flex-row sm:justify-end sm:space-x-2",className),"data-slot":"sheet-footer",...props});SheetFooter.displayName="SheetFooter";var SheetTitle=import_react.forwardRef(({className,icon,...props},ref)=>jsx_runtime.jsxs(DialogPrimitive.Title,{className:import_cn.cn("flex items-center gap-2 font-semibold text-foreground text-lg",className),"data-slot":"sheet-title",ref,...props,children:[icon&&jsx_runtime.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-secondary","data-slot":"sheet-title-icon",children:import_react.createElement(icon,{className:"text-secondary-foreground"})}),props.children]}));SheetTitle.displayName=DialogPrimitive.Title.displayName;var SheetDescription=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(DialogPrimitive.Description,{className:import_cn.cn("text-muted-foreground text-sm",className),"data-slot":"sheet-description",ref,...props}));SheetDescription.displayName=DialogPrimitive.Description.displayName;