@voilajsx/uikit
Version:
Cross-platform React components with beautiful themes and OKLCH color science
107 lines (106 loc) • 3.1 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import { forwardRef } from "react";
import { Search } from "lucide-react";
import { cn } from "./utils.js";
const Command = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
"div",
{
ref,
className: cn(
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
className
),
...props
}
));
Command.displayName = "Command";
const CommandInput = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
/* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
/* @__PURE__ */ jsx(
"input",
{
ref,
className: cn(
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
className
),
...props
}
)
] }));
CommandInput.displayName = "CommandInput";
const CommandList = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
"div",
{
ref,
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
...props
}
));
CommandList.displayName = "CommandList";
const CommandEmpty = forwardRef((props, ref) => /* @__PURE__ */ jsx(
"div",
{
ref,
className: "py-6 text-center text-sm",
...props
}
));
CommandEmpty.displayName = "CommandEmpty";
const CommandGroup = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
"div",
{
ref,
className: cn(
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
className
),
...props
}
));
CommandGroup.displayName = "CommandGroup";
const CommandSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
"div",
{
ref,
className: cn("-mx-1 h-px bg-border", className),
...props
}
));
CommandSeparator.displayName = "CommandSeparator";
const CommandItem = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
"div",
{
ref,
className: cn(
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
className
),
...props
}
));
CommandItem.displayName = "CommandItem";
const CommandShortcut = ({ className, ...props }) => {
return /* @__PURE__ */ jsx(
"span",
{
className: cn(
"ml-auto text-xs tracking-widest text-muted-foreground",
className
),
...props
}
);
};
CommandShortcut.displayName = "CommandShortcut";
export {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut
};
//# sourceMappingURL=command.js.map