UNPKG

@kopexa/command

Version:

Fast, composable command menu

163 lines (160 loc) 3.86 kB
"use client"; var __defProp = Object.defineProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; // src/command.tsx import { SearchIcon } from "@kopexa/icons"; import { command } from "@kopexa/theme"; import { Command as CommandPrimitive } from "cmdk"; import { jsx, jsxs } from "react/jsx-runtime"; function CommandRoot(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( CommandPrimitive, { "data-slot": "command", className: styles.root({ className }), ...restProps } ); } function CommandInput(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsxs("div", { "data-slot": "command-input-wrapper", className: styles.inputWrapper(), children: [ /* @__PURE__ */ jsx(SearchIcon, { className: styles.inputIcon() }), /* @__PURE__ */ jsx( CommandPrimitive.Input, { "data-slot": "command-input", className: styles.input({ className }), ...restProps } ) ] }); } function CommandList(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( CommandPrimitive.List, { "data-slot": "command-list", className: styles.list({ className }), ...restProps } ); } function CommandEmpty(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( CommandPrimitive.Empty, { "data-slot": "command-empty", className: styles.empty({ className }), ...restProps } ); } function CommandGroup(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( CommandPrimitive.Group, { "data-slot": "command-group", className: styles.group({ className }), ...restProps } ); } function CommandSeparator(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( CommandPrimitive.Separator, { "data-slot": "command-separator", className: styles.separator({ className }), ...restProps } ); } function CommandItem(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( CommandPrimitive.Item, { "data-slot": "command-item", className: styles.item({ className }), ...restProps } ); } function CommandShortcut(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( "span", { "data-slot": "command-shortcut", className: styles.shortcut({ className }), ...restProps } ); } function CommandHeader(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( "div", { "data-slot": "command-header", className: styles.header({ className }), ...restProps } ); } function CommandTitle(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( "div", { "data-slot": "command-title", className: styles.title({ className }), ...restProps } ); } function CommandDescription(props) { const { className, ...restProps } = props; const styles = command(); return /* @__PURE__ */ jsx( "p", { "data-slot": "command-description", className: styles.description({ className }), ...restProps } ); } export { __export, CommandRoot, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandSeparator, CommandItem, CommandShortcut, CommandHeader, CommandTitle, CommandDescription };