UNPKG

@loke/design-system

Version:

A design system with individually importable components

3 lines (2 loc) 6.49 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_command={};__export(exports_command,{createCommandScope:()=>createCommandScope2,CommandShortcut:()=>CommandShortcut,CommandSeparator:()=>CommandSeparator2,CommandLoading:()=>CommandLoading2,CommandList:()=>CommandList2,CommandItem:()=>CommandItem2,CommandInput:()=>CommandInput2,CommandGroup:()=>CommandGroup2,CommandEmpty:()=>CommandEmpty2,CommandDialog:()=>CommandDialog,Command:()=>Command2});module.exports=__toCommonJS(exports_command);var import_cn=require("@loke/design-system/cn"),import_dialog=require("@loke/design-system/dialog"),import_icons=require("@loke/icons"),CommandPrimitive=__toESM(require("@loke/ui/command")),import_react=require("react"),jsx_runtime=require("react/jsx-runtime"),Command2=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(CommandPrimitive.Command,{className:import_cn.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",className),ref,...props}));Command2.displayName=CommandPrimitive.Command.displayName;var CommandInput2=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsxs("div",{className:"flex h-9 items-center gap-2 border-b px-3","data-slot":"command-input-wrapper",children:[jsx_runtime.jsx(import_icons.Search,{className:"size-4 shrink-0 opacity-50"}),jsx_runtime.jsx(CommandPrimitive.CommandInput,{className:import_cn.cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",className),"data-slot":"command-input",ref,...props})]}));CommandInput2.displayName=CommandPrimitive.CommandInput.displayName;var CommandList2=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(CommandPrimitive.CommandList,{className:import_cn.cn("max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden",className),ref,...props}));CommandList2.displayName=CommandPrimitive.CommandList.displayName;var CommandItem2=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(CommandPrimitive.CommandItem,{className:import_cn.cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",className),ref,...props}));CommandItem2.displayName=CommandPrimitive.CommandItem.displayName;var CommandGroup2=import_react.forwardRef(({className,heading,...props},ref)=>jsx_runtime.jsx(CommandPrimitive.CommandGroup,{className:import_cn.cn("overflow-hidden p-1 text-foreground",className),heading:heading?jsx_runtime.jsx("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:heading}):void 0,ref,...props}));CommandGroup2.displayName=CommandPrimitive.CommandGroup.displayName;var CommandSeparator2=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(CommandPrimitive.CommandSeparator,{className:import_cn.cn("-mx-1 h-px bg-border",className),ref,...props}));CommandSeparator2.displayName=CommandPrimitive.CommandSeparator.displayName;var CommandEmpty2=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(CommandPrimitive.CommandEmpty,{className:import_cn.cn("py-6 text-center text-sm",className),ref,...props}));CommandEmpty2.displayName=CommandPrimitive.CommandEmpty.displayName;var CommandLoading2=import_react.forwardRef(({className,...props},ref)=>jsx_runtime.jsx(CommandPrimitive.CommandLoading,{className,ref,...props}));CommandLoading2.displayName=CommandPrimitive.CommandLoading.displayName;var CommandShortcut=({className,...props})=>{return jsx_runtime.jsx("span",{className:import_cn.cn("ml-auto text-muted-foreground text-xs tracking-widest",className),"data-slot":"command-shortcut",...props})};function CommandDialog({title="Command Palette",description="Search for a command to run...",children,className,showCloseButton=!1,...props}){return jsx_runtime.jsxs(import_dialog.Dialog,{...props,children:[jsx_runtime.jsxs(import_dialog.DialogHeader,{className:"sr-only",children:[jsx_runtime.jsx(import_dialog.DialogTitle,{children:title}),jsx_runtime.jsx(import_dialog.DialogDescription,{children:description})]}),jsx_runtime.jsx(import_dialog.DialogContent,{className:import_cn.cn("overflow-hidden p-0",className),showCloseButton,children:jsx_runtime.jsx(Command2,{className:"**:data-[slot=command-input-wrapper]:h-12 [&_[loke-cmd-group]:not([hidden])_~[loke-cmd-group]]:pt-0 [&_[loke-cmd-input-wrapper]_svg]:h-5 [&_[loke-cmd-input-wrapper]_svg]:w-5 [&_[loke-cmd-input]]:h-12 [&_[loke-cmd-item]]:px-2 [&_[loke-cmd-item]]:py-3 [&_[loke-cmd-item]_svg]:h-5 [&_[loke-cmd-item]_svg]:w-5 **:[[loke-cmd-group]]:px-2",children})})]})}var createCommandScope2=CommandPrimitive.createCommandScope;