UNPKG

@loke/design-system

Version:

A design system with individually importable components

3 lines (2 loc) 5.65 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_dialog={};__export(exports_dialog,{DialogTrigger:()=>DialogTrigger,DialogTitle:()=>DialogTitle,DialogPortal:()=>DialogPortal,DialogOverlay:()=>DialogOverlay,DialogHeader:()=>DialogHeader,DialogFooter:()=>DialogFooter,DialogDescription:()=>DialogDescription,DialogContent:()=>DialogContent,DialogClose:()=>DialogClose,Dialog:()=>Dialog});module.exports=__toCommonJS(exports_dialog);var import_button=require("@loke/design-system/button"),import_cn=require("@loke/design-system/cn"),import_icons=require("@loke/icons"),DialogPrimitive=__toESM(require("@loke/ui/dialog")),import_react=require("react"),jsx_runtime=require("react/jsx-runtime");function Dialog({...props}){return jsx_runtime.jsx(DialogPrimitive.Root,{"data-slot":"dialog",...props})}var DialogTrigger=import_react.forwardRef((props,ref)=>jsx_runtime.jsx(DialogPrimitive.Trigger,{"data-slot":"dialog-trigger",ref,...props}));DialogTrigger.displayName=DialogPrimitive.Trigger.displayName;function DialogPortal({...props}){return jsx_runtime.jsx(DialogPrimitive.Portal,{"data-slot":"dialog-portal",...props})}var DialogOverlay=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(DialogPrimitive.Overlay,{className:import_cn.cn("data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 data-closed:animate-out data-open:animate-in supports-backdrop-filter:backdrop-blur-xs",className),"data-slot":"dialog-overlay",ref,...props}));DialogOverlay.displayName=DialogPrimitive.Overlay.displayName;var DialogContent=import_react.forwardRef(({className,children,showCloseButton=!0,forceMount,...props},ref)=>jsx_runtime.jsxs(DialogPortal,{forceMount,children:[jsx_runtime.jsx(DialogOverlay,{forceMount}),jsx_runtime.jsxs(DialogPrimitive.Content,{className:import_cn.cn("data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 text-sm outline-none ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in sm:max-w-sm",className),"data-slot":"dialog-content",forceMount,ref,...props,children:[children,showCloseButton&&jsx_runtime.jsx(DialogPrimitive.Close,{asChild:!0,"data-slot":"dialog-close",children:jsx_runtime.jsxs(import_button.Button,{className:"absolute top-2 right-2",size:"icon-sm",variant:"ghost",children:[jsx_runtime.jsx(import_icons.XIcon,{}),jsx_runtime.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));DialogContent.displayName=DialogPrimitive.Content.displayName;var DialogClose=import_react.forwardRef((props,ref)=>jsx_runtime.jsx(DialogPrimitive.Close,{"data-slot":"dialog-close",ref,...props}));DialogClose.displayName=DialogPrimitive.Close.displayName;function DialogHeader({className,...props}){return jsx_runtime.jsx("div",{className:import_cn.cn("flex flex-col gap-2",className),"data-slot":"dialog-header",...props})}function DialogFooter({className,showCloseButton=!1,children,...props}){return jsx_runtime.jsxs("div",{className:import_cn.cn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",className),"data-slot":"dialog-footer",...props,children:[children,showCloseButton&&jsx_runtime.jsx(DialogPrimitive.Close,{asChild:!0,children:jsx_runtime.jsx(import_button.Button,{variant:"outline",children:"Close"})})]})}var DialogTitle=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(DialogPrimitive.Title,{className:import_cn.cn("font-medium text-base leading-none",className),"data-slot":"dialog-title",ref,...props}));DialogTitle.displayName=DialogPrimitive.Title.displayName;var DialogDescription=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(DialogPrimitive.Description,{className:import_cn.cn("text-muted-foreground text-sm *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",className),"data-slot":"dialog-description",ref,...props}));DialogDescription.displayName=DialogPrimitive.Description.displayName;