@arolariu/components
Version:
A collection of reusable components for React applications, built as ESM & CJS modules with tree shake, minify and bundler optimizations enabled, for the lowest bundle size (import cost)!
1 lines • 7.87 kB
Source Map (JSON)
{"version":3,"file":"components\\ui\\command.cjs","sources":["webpack://@arolariu/components/./src/components/ui/command.tsx"],"sourcesContent":["\r\n\r\nimport * as React from \"react\";\r\nimport { Command as CommandPrimitive } from \"cmdk\";\r\nimport { SearchIcon } from \"lucide-react\";\r\nimport { cn } from \"./../../lib/utils\";\r\nimport {\r\n Dialog,\r\n DialogContent,\r\n DialogDescription,\r\n DialogHeader,\r\n DialogTitle,\r\n} from \"./dialog\";\r\n\r\nfunction Command({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof CommandPrimitive>) {\r\n return (\r\n <CommandPrimitive\r\n data-slot=\"command\"\r\n className={cn(\r\n \"bg-white text-neutral-950 flex h-full w-full flex-col overflow-hidden rounded-md dark:bg-neutral-950 dark:text-neutral-50\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CommandDialog({\r\n title = \"Command Palette\",\r\n description = \"Search for a command to run...\",\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof Dialog> & {\r\n title?: string;\r\n description?: string;\r\n}) {\r\n return (\r\n <Dialog {...props}>\r\n <DialogHeader className=\"sr-only\">\r\n <DialogTitle>{title}</DialogTitle>\r\n <DialogDescription>{description}</DialogDescription>\r\n </DialogHeader>\r\n <DialogContent className=\"overflow-hidden p-0\">\r\n <Command className=\"[&_[cmdk-group-heading]]:text-neutral-500 data-[slot=command-input-wrapper]:**:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5 dark:[&_[cmdk-group-heading]]:text-neutral-400\">\r\n {children}\r\n </Command>\r\n </DialogContent>\r\n </Dialog>\r\n );\r\n}\r\n\r\nfunction CommandInput({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\r\n return (\r\n <div\r\n data-slot=\"command-input-wrapper\"\r\n className=\"flex h-9 items-center gap-2 border-b px-3\"\r\n >\r\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\r\n <CommandPrimitive.Input\r\n data-slot=\"command-input\"\r\n className={cn(\r\n \"placeholder:text-neutral-500 flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-neutral-400\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n </div>\r\n );\r\n}\r\n\r\nfunction CommandList({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\r\n return (\r\n <CommandPrimitive.List\r\n data-slot=\"command-list\"\r\n className={cn(\r\n \"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CommandEmpty({\r\n ...props\r\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\r\n return (\r\n <CommandPrimitive.Empty\r\n data-slot=\"command-empty\"\r\n className=\"py-6 text-center text-sm\"\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CommandGroup({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\r\n return (\r\n <CommandPrimitive.Group\r\n data-slot=\"command-group\"\r\n className={cn(\r\n \"text-neutral-950 [&_[cmdk-group-heading]]:text-neutral-500 overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium dark:text-neutral-50 dark:[&_[cmdk-group-heading]]:text-neutral-400\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CommandSeparator({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\r\n return (\r\n <CommandPrimitive.Separator\r\n data-slot=\"command-separator\"\r\n className={cn(\"bg-neutral-200 -mx-1 h-px dark:bg-neutral-800\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CommandItem({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\r\n return (\r\n <CommandPrimitive.Item\r\n data-slot=\"command-item\"\r\n className={cn(\r\n \"data-[selected=true]:bg-neutral-100 data-[selected=true]:text-neutral-900 [&_svg:not([class*='text-'])]:text-neutral-500 relative flex cursor-default items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:data-[selected=true]:bg-neutral-800 dark:data-[selected=true]:text-neutral-50 dark:[&_svg:not([class*='text-'])]:text-neutral-400\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CommandShortcut({\r\n className,\r\n ...props\r\n}: React.ComponentProps<\"span\">) {\r\n return (\r\n <span\r\n data-slot=\"command-shortcut\"\r\n className={cn(\r\n \"text-neutral-500 ml-auto text-xs tracking-widest dark:text-neutral-400\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {\r\n Command,\r\n CommandDialog,\r\n CommandInput,\r\n CommandList,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandItem,\r\n CommandShortcut,\r\n CommandSeparator,\r\n};\r\n"],"names":["Command","className","props","CommandPrimitive","cn","CommandDialog","title","description","children","Dialog","DialogHeader","DialogTitle","DialogDescription","DialogContent","CommandInput","SearchIcon","CommandList","CommandEmpty","CommandGroup","CommandSe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