@kopexa/command
Version:
Fast, composable command menu
192 lines (189 loc) • 5.5 kB
JavaScript
"use client";
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/namespace.ts
var namespace_exports = {};
__export(namespace_exports, {
Description: () => CommandDescription,
Empty: () => CommandEmpty,
Group: () => CommandGroup,
Header: () => CommandHeader,
Input: () => CommandInput,
Item: () => CommandItem,
List: () => CommandList,
Root: () => CommandRoot,
Separator: () => CommandSeparator,
Shortcut: () => CommandShortcut,
Title: () => CommandTitle
});
module.exports = __toCommonJS(namespace_exports);
// src/command.tsx
var import_icons = require("@kopexa/icons");
var import_theme = require("@kopexa/theme");
var import_cmdk = require("cmdk");
var import_jsx_runtime = require("react/jsx-runtime");
function CommandRoot(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_cmdk.Command,
{
"data-slot": "command",
className: styles.root({ className }),
...restProps
}
);
}
function CommandInput(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "data-slot": "command-input-wrapper", className: styles.inputWrapper(), children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SearchIcon, { className: styles.inputIcon() }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_cmdk.Command.Input,
{
"data-slot": "command-input",
className: styles.input({ className }),
...restProps
}
)
] });
}
function CommandList(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_cmdk.Command.List,
{
"data-slot": "command-list",
className: styles.list({ className }),
...restProps
}
);
}
function CommandEmpty(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_cmdk.Command.Empty,
{
"data-slot": "command-empty",
className: styles.empty({ className }),
...restProps
}
);
}
function CommandGroup(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_cmdk.Command.Group,
{
"data-slot": "command-group",
className: styles.group({ className }),
...restProps
}
);
}
function CommandSeparator(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_cmdk.Command.Separator,
{
"data-slot": "command-separator",
className: styles.separator({ className }),
...restProps
}
);
}
function CommandItem(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_cmdk.Command.Item,
{
"data-slot": "command-item",
className: styles.item({ className }),
...restProps
}
);
}
function CommandShortcut(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"span",
{
"data-slot": "command-shortcut",
className: styles.shortcut({ className }),
...restProps
}
);
}
function CommandHeader(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"div",
{
"data-slot": "command-header",
className: styles.header({ className }),
...restProps
}
);
}
function CommandTitle(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"div",
{
"data-slot": "command-title",
className: styles.title({ className }),
...restProps
}
);
}
function CommandDescription(props) {
const { className, ...restProps } = props;
const styles = (0, import_theme.command)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"p",
{
"data-slot": "command-description",
className: styles.description({ className }),
...restProps
}
);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Description,
Empty,
Group,
Header,
Input,
Item,
List,
Root,
Separator,
Shortcut,
Title
});