@alpic-ai/ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion-card.d.mts +41 -0
- package/dist/components/accordion-card.mjs +61 -0
- package/dist/components/accordion.d.mts +29 -0
- package/dist/components/accordion.mjs +48 -0
- package/dist/components/alert.d.mts +40 -0
- package/dist/components/alert.mjs +63 -0
- package/dist/components/attachment-tile.d.mts +26 -0
- package/dist/components/attachment-tile.mjs +35 -0
- package/dist/components/avatar.d.mts +52 -0
- package/dist/components/avatar.mjs +81 -0
- package/dist/components/badge.d.mts +20 -0
- package/dist/components/badge.mjs +36 -0
- package/dist/components/breadcrumb.d.mts +42 -0
- package/dist/components/breadcrumb.mjs +79 -0
- package/dist/components/button.d.mts +29 -0
- package/dist/components/button.mjs +67 -0
- package/dist/components/card.d.mts +37 -0
- package/dist/components/card.mjs +54 -0
- package/dist/components/checkbox.d.mts +11 -0
- package/dist/components/checkbox.mjs +26 -0
- package/dist/components/collapsible.d.mts +16 -0
- package/dist/components/collapsible.mjs +24 -0
- package/dist/components/combobox.d.mts +86 -0
- package/dist/components/combobox.mjs +207 -0
- package/dist/components/command.d.mts +38 -0
- package/dist/components/command.mjs +68 -0
- package/dist/components/copyable.d.mts +22 -0
- package/dist/components/copyable.mjs +33 -0
- package/dist/components/description-list.d.mts +22 -0
- package/dist/components/description-list.mjs +34 -0
- package/dist/components/dialog.d.mts +61 -0
- package/dist/components/dialog.mjs +110 -0
- package/dist/components/dropdown-menu.d.mts +72 -0
- package/dist/components/dropdown-menu.mjs +122 -0
- package/dist/components/input-group.d.mts +25 -0
- package/dist/components/input-group.mjs +43 -0
- package/dist/components/input.d.mts +27 -0
- package/dist/components/input.mjs +90 -0
- package/dist/components/label.d.mts +11 -0
- package/dist/components/label.mjs +14 -0
- package/dist/components/pagination.d.mts +18 -0
- package/dist/components/pagination.mjs +42 -0
- package/dist/components/popover.d.mts +22 -0
- package/dist/components/popover.mjs +34 -0
- package/dist/components/radio-group.d.mts +15 -0
- package/dist/components/radio-group.mjs +26 -0
- package/dist/components/scroll-area.d.mts +17 -0
- package/dist/components/scroll-area.mjs +35 -0
- package/dist/components/select-trigger-variants.d.mts +13 -0
- package/dist/components/select-trigger-variants.mjs +23 -0
- package/dist/components/select.d.mts +51 -0
- package/dist/components/select.mjs +95 -0
- package/dist/components/separator.d.mts +13 -0
- package/dist/components/separator.mjs +16 -0
- package/dist/components/sheet.d.mts +43 -0
- package/dist/components/sheet.mjs +74 -0
- package/dist/components/sidebar.d.mts +163 -0
- package/dist/components/sidebar.mjs +378 -0
- package/dist/components/skeleton.d.mts +16 -0
- package/dist/components/skeleton.mjs +21 -0
- package/dist/components/sonner.d.mts +29 -0
- package/dist/components/sonner.mjs +76 -0
- package/dist/components/spinner.d.mts +30 -0
- package/dist/components/spinner.mjs +46 -0
- package/dist/components/status-dot.d.mts +19 -0
- package/dist/components/status-dot.mjs +34 -0
- package/dist/components/switch.d.mts +11 -0
- package/dist/components/switch.mjs +18 -0
- package/dist/components/table.d.mts +38 -0
- package/dist/components/table.mjs +65 -0
- package/dist/components/tabs.d.mts +58 -0
- package/dist/components/tabs.mjs +119 -0
- package/dist/components/tag.d.mts +35 -0
- package/dist/components/tag.mjs +65 -0
- package/dist/components/textarea.d.mts +21 -0
- package/dist/components/textarea.mjs +44 -0
- package/dist/components/toggle-group.d.mts +28 -0
- package/dist/components/toggle-group.mjs +72 -0
- package/dist/components/tooltip-icon-button.d.mts +12 -0
- package/dist/components/tooltip-icon-button.mjs +27 -0
- package/dist/components/tooltip.d.mts +23 -0
- package/dist/components/tooltip.mjs +35 -0
- package/dist/hooks/use-copy-to-clipboard.d.mts +11 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +24 -0
- package/dist/hooks/use-mobile.d.mts +4 -0
- package/dist/hooks/use-mobile.mjs +16 -0
- package/dist/lib/cn.d.mts +6 -0
- package/dist/lib/cn.mjs +8 -0
- package/package.json +88 -0
- package/src/components/accordion-card.tsx +103 -0
- package/src/components/accordion.tsx +63 -0
- package/src/components/alert.tsx +74 -0
- package/src/components/attachment-tile.tsx +68 -0
- package/src/components/avatar.tsx +127 -0
- package/src/components/badge.tsx +41 -0
- package/src/components/breadcrumb.tsx +98 -0
- package/src/components/button.tsx +106 -0
- package/src/components/card.tsx +62 -0
- package/src/components/checkbox.tsx +35 -0
- package/src/components/collapsible.tsx +18 -0
- package/src/components/combobox.tsx +393 -0
- package/src/components/command.tsx +112 -0
- package/src/components/copyable.tsx +47 -0
- package/src/components/description-list.tsx +36 -0
- package/src/components/dialog.tsx +161 -0
- package/src/components/dropdown-menu.tsx +234 -0
- package/src/components/input-group.tsx +97 -0
- package/src/components/input.tsx +145 -0
- package/src/components/label.tsx +20 -0
- package/src/components/pagination.tsx +53 -0
- package/src/components/popover.tsx +49 -0
- package/src/components/radio-group.tsx +33 -0
- package/src/components/scroll-area.tsx +48 -0
- package/src/components/select-trigger-variants.ts +28 -0
- package/src/components/select.tsx +186 -0
- package/src/components/separator.tsx +30 -0
- package/src/components/sheet.tsx +112 -0
- package/src/components/sidebar.tsx +682 -0
- package/src/components/skeleton.tsx +24 -0
- package/src/components/sonner.tsx +91 -0
- package/src/components/spinner.tsx +62 -0
- package/src/components/status-dot.tsx +33 -0
- package/src/components/switch.tsx +33 -0
- package/src/components/table.tsx +89 -0
- package/src/components/tabs.tsx +226 -0
- package/src/components/tag.tsx +82 -0
- package/src/components/textarea.tsx +70 -0
- package/src/components/toggle-group.tsx +96 -0
- package/src/components/tooltip-icon-button.tsx +33 -0
- package/src/components/tooltip.tsx +54 -0
- package/src/hooks/use-copy-to-clipboard.ts +27 -0
- package/src/hooks/use-mobile.ts +17 -0
- package/src/lib/cn.ts +6 -0
- package/src/styles/tokens.css +352 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
5
|
+
|
|
6
|
+
//#region src/components/button.d.ts
|
|
7
|
+
declare const buttonVariants: (props?: ({
|
|
8
|
+
variant?: "secondary" | "primary" | "destructive" | "tertiary" | "link" | "link-muted" | null | undefined;
|
|
9
|
+
size?: "default" | "pill" | "icon" | "icon-rounded" | null | undefined;
|
|
10
|
+
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
|
+
interface ButtonProps extends React.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare function Button({
|
|
17
|
+
className,
|
|
18
|
+
variant,
|
|
19
|
+
size,
|
|
20
|
+
type,
|
|
21
|
+
asChild,
|
|
22
|
+
loading,
|
|
23
|
+
icon,
|
|
24
|
+
disabled,
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}: ButtonProps): _$react_jsx_runtime0.JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Button, type ButtonProps, buttonVariants };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { Loader2 } from "lucide-react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
+
//#region src/components/button.tsx
|
|
8
|
+
const buttonVariants = cva([
|
|
9
|
+
"inline-flex items-center justify-center gap-1 whitespace-nowrap",
|
|
10
|
+
"h-8 px-2 rounded-md",
|
|
11
|
+
"font-medium",
|
|
12
|
+
"transition-colors",
|
|
13
|
+
"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
14
|
+
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0",
|
|
15
|
+
"disabled:pointer-events-none disabled:opacity-50"
|
|
16
|
+
].join(" "), {
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
primary: ["bg-primary text-primary-foreground", "[@media(hover:hover)]:hover:bg-primary-hover"].join(" "),
|
|
20
|
+
secondary: ["border border-border bg-background text-muted-foreground", "[@media(hover:hover)]:hover:bg-background-hover [@media(hover:hover)]:hover:text-muted-foreground-hover"].join(" "),
|
|
21
|
+
tertiary: [
|
|
22
|
+
"text-muted-foreground",
|
|
23
|
+
"[@media(hover:hover)]:hover:bg-background-hover [@media(hover:hover)]:hover:text-muted-foreground-hover",
|
|
24
|
+
"focus-visible:bg-background"
|
|
25
|
+
].join(" "),
|
|
26
|
+
link: [
|
|
27
|
+
"h-auto px-0 rounded-xs underline-offset-4",
|
|
28
|
+
"text-link",
|
|
29
|
+
"[@media(hover:hover)]:hover:underline",
|
|
30
|
+
"focus-visible:bg-background"
|
|
31
|
+
].join(" "),
|
|
32
|
+
"link-muted": [
|
|
33
|
+
"h-auto px-0 rounded-xs underline-offset-4",
|
|
34
|
+
"text-link-muted",
|
|
35
|
+
"[@media(hover:hover)]:hover:underline",
|
|
36
|
+
"focus-visible:bg-background"
|
|
37
|
+
].join(" "),
|
|
38
|
+
destructive: ["bg-destructive text-destructive-foreground", "[@media(hover:hover)]:hover:bg-destructive-hover"].join(" ")
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
default: "type-text-sm",
|
|
42
|
+
icon: "size-8 p-0 type-text-sm",
|
|
43
|
+
"icon-rounded": "size-8 p-0 rounded-full type-text-sm",
|
|
44
|
+
pill: "h-7 px-3 rounded-full type-text-xs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
variant: "primary",
|
|
49
|
+
size: "default"
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function Button({ className, variant, size, type = "button", asChild = false, loading = false, icon, disabled, children, ...props }) {
|
|
53
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
54
|
+
"data-slot": "button",
|
|
55
|
+
className: cn(buttonVariants({
|
|
56
|
+
variant,
|
|
57
|
+
size
|
|
58
|
+
}), className),
|
|
59
|
+
type,
|
|
60
|
+
disabled: disabled || loading,
|
|
61
|
+
"aria-busy": loading || void 0,
|
|
62
|
+
...props,
|
|
63
|
+
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [loading ? /* @__PURE__ */ jsx(Loader2, { className: "motion-safe:animate-spin" }) : icon, children] })
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/card.d.ts
|
|
5
|
+
declare function Card({
|
|
6
|
+
className,
|
|
7
|
+
hoverable,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<"div"> & {
|
|
10
|
+
hoverable?: boolean;
|
|
11
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
12
|
+
declare function CardHeader({
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
16
|
+
declare function CardTitle({
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
20
|
+
declare function CardDescription({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
24
|
+
declare function CardAction({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
28
|
+
declare function CardContent({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
32
|
+
declare function CardFooter({
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/card.tsx
|
|
4
|
+
function Card({ className, hoverable, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
"data-slot": "card",
|
|
7
|
+
className: cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6", hoverable && "transition-shadow [@media(hover:hover)]:hover:shadow-lg", className),
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function CardHeader({ className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx("div", {
|
|
13
|
+
"data-slot": "card-header",
|
|
14
|
+
className: cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function CardTitle({ className, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
"data-slot": "card-title",
|
|
21
|
+
className: cn("type-text-md font-semibold leading-none", className),
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function CardDescription({ className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx("div", {
|
|
27
|
+
"data-slot": "card-description",
|
|
28
|
+
className: cn("type-text-sm text-muted-foreground", className),
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function CardAction({ className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx("div", {
|
|
34
|
+
"data-slot": "card-action",
|
|
35
|
+
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function CardContent({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx("div", {
|
|
41
|
+
"data-slot": "card-content",
|
|
42
|
+
className: cn("px-6", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function CardFooter({ className, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
"data-slot": "card-footer",
|
|
49
|
+
className: cn("flex items-center px-6 [.border-t]:pt-6", className),
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
4
|
+
|
|
5
|
+
//#region src/components/checkbox.d.ts
|
|
6
|
+
declare function Checkbox({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>): _$react_jsx_runtime0.JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Checkbox };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
6
|
+
//#region src/components/checkbox.tsx
|
|
7
|
+
function Checkbox({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(CheckboxPrimitive.Root, {
|
|
9
|
+
"data-slot": "checkbox",
|
|
10
|
+
className: cn("peer size-4 shrink-0 rounded-xs border border-border bg-background", "not-disabled:data-[state=checked]:border-primary not-disabled:data-[state=checked]:bg-primary not-disabled:data-[state=checked]:text-primary-foreground", "not-disabled:data-[state=indeterminate]:border-primary not-disabled:data-[state=indeterminate]:bg-primary not-disabled:data-[state=indeterminate]:text-primary-foreground", "transition-colors", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:pointer-events-none disabled:bg-muted disabled:border-border disabled:text-border", className),
|
|
11
|
+
...props,
|
|
12
|
+
children: /* @__PURE__ */ jsxs(CheckboxPrimitive.Indicator, {
|
|
13
|
+
"data-slot": "checkbox-indicator",
|
|
14
|
+
className: "flex items-center justify-center text-current [&[data-state=indeterminate]>svg:first-child]:hidden [&[data-state=checked]>svg:last-child]:hidden",
|
|
15
|
+
children: [/* @__PURE__ */ jsx(CheckIcon, {
|
|
16
|
+
className: "size-3",
|
|
17
|
+
strokeWidth: 4
|
|
18
|
+
}), /* @__PURE__ */ jsx(MinusIcon, {
|
|
19
|
+
className: "size-3",
|
|
20
|
+
strokeWidth: 4
|
|
21
|
+
})]
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Checkbox };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
+
|
|
5
|
+
//#region src/components/collapsible.d.ts
|
|
6
|
+
declare function Collapsible({
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>): _$react_jsx_runtime0.JSX.Element;
|
|
9
|
+
declare function CollapsibleTrigger({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): _$react_jsx_runtime0.JSX.Element;
|
|
12
|
+
declare function CollapsibleContent({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): _$react_jsx_runtime0.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
+
//#region src/components/collapsible.tsx
|
|
5
|
+
function Collapsible({ ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, {
|
|
7
|
+
"data-slot": "collapsible",
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function CollapsibleTrigger({ ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleTrigger, {
|
|
13
|
+
"data-slot": "collapsible-trigger",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function CollapsibleContent({ ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleContent, {
|
|
19
|
+
"data-slot": "collapsible-content",
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { PopoverContent } from "./popover.mjs";
|
|
2
|
+
import { selectTriggerVariants } from "./select-trigger-variants.mjs";
|
|
3
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import { VariantProps } from "class-variance-authority";
|
|
5
|
+
import { ReactNode } from "react";
|
|
6
|
+
import { Command } from "cmdk";
|
|
7
|
+
|
|
8
|
+
//#region src/components/combobox.d.ts
|
|
9
|
+
interface ComboboxBaseProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
interface ComboboxSingleProps extends ComboboxBaseProps {
|
|
16
|
+
multiple?: false;
|
|
17
|
+
value?: string | null;
|
|
18
|
+
defaultValue?: string | null;
|
|
19
|
+
onValueChange?: (value: string | null) => void;
|
|
20
|
+
}
|
|
21
|
+
interface ComboboxMultipleProps extends ComboboxBaseProps {
|
|
22
|
+
multiple: true;
|
|
23
|
+
value?: string[];
|
|
24
|
+
defaultValue?: string[];
|
|
25
|
+
onValueChange?: (value: string[]) => void;
|
|
26
|
+
}
|
|
27
|
+
type ComboboxProps = ComboboxSingleProps | ComboboxMultipleProps;
|
|
28
|
+
declare function Combobox(props: ComboboxProps): _$react_jsx_runtime0.JSX.Element;
|
|
29
|
+
interface ComboboxTriggerProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "size">, VariantProps<typeof selectTriggerVariants> {
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
}
|
|
32
|
+
declare function ComboboxTrigger({
|
|
33
|
+
className,
|
|
34
|
+
size,
|
|
35
|
+
placeholder,
|
|
36
|
+
children,
|
|
37
|
+
...props
|
|
38
|
+
}: ComboboxTriggerProps): _$react_jsx_runtime0.JSX.Element;
|
|
39
|
+
interface ComboboxContentProps extends React.ComponentProps<typeof PopoverContent> {
|
|
40
|
+
className?: string;
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
filter?: React.ComponentProps<typeof Command>["filter"];
|
|
43
|
+
}
|
|
44
|
+
declare function ComboboxContent({
|
|
45
|
+
className,
|
|
46
|
+
children,
|
|
47
|
+
filter,
|
|
48
|
+
...props
|
|
49
|
+
}: ComboboxContentProps): _$react_jsx_runtime0.JSX.Element;
|
|
50
|
+
declare function ComboboxSearch({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof Command.Input>): _$react_jsx_runtime0.JSX.Element;
|
|
54
|
+
declare function ComboboxList({
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
}: React.ComponentProps<typeof Command.List>): _$react_jsx_runtime0.JSX.Element;
|
|
58
|
+
declare function ComboboxEmpty({
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<typeof Command.Empty>): _$react_jsx_runtime0.JSX.Element;
|
|
62
|
+
declare function ComboboxGroup({
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}: React.ComponentProps<typeof Command.Group>): _$react_jsx_runtime0.JSX.Element;
|
|
66
|
+
declare function ComboboxSeparator({
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<typeof Command.Separator>): _$react_jsx_runtime0.JSX.Element;
|
|
70
|
+
interface ComboboxItemProps extends Omit<React.ComponentProps<typeof Command.Item>, "onSelect"> {
|
|
71
|
+
/** The value stored when this item is selected */
|
|
72
|
+
itemValue: string;
|
|
73
|
+
}
|
|
74
|
+
declare function ComboboxItem({
|
|
75
|
+
className,
|
|
76
|
+
children,
|
|
77
|
+
itemValue,
|
|
78
|
+
...props
|
|
79
|
+
}: ComboboxItemProps): _$react_jsx_runtime0.JSX.Element;
|
|
80
|
+
declare function ComboboxItemText({
|
|
81
|
+
className,
|
|
82
|
+
children,
|
|
83
|
+
...props
|
|
84
|
+
}: React.HTMLAttributes<HTMLSpanElement>): _$react_jsx_runtime0.JSX.Element;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxItem, ComboboxItemText, ComboboxList, ComboboxSearch, ComboboxSeparator, ComboboxTrigger };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover.mjs";
|
|
4
|
+
import { selectTriggerVariants } from "./select-trigger-variants.mjs";
|
|
5
|
+
import { TagDismissible } from "./tag.mjs";
|
|
6
|
+
import { CheckIcon, ChevronDownIcon, SearchIcon } from "lucide-react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
9
|
+
import { Command } from "cmdk";
|
|
10
|
+
//#region src/components/combobox.tsx
|
|
11
|
+
const ComboboxContext = createContext(null);
|
|
12
|
+
function useComboboxContext() {
|
|
13
|
+
const context = useContext(ComboboxContext);
|
|
14
|
+
if (!context) throw new Error("Combobox compound components must be used within <Combobox>");
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
function Combobox(props) {
|
|
18
|
+
const { children, multiple = false, open: controlledOpen, defaultOpen = false, onOpenChange: controlledOnOpenChange } = props;
|
|
19
|
+
const [uncontrolledSingleValue, setUncontrolledSingleValue] = useState(!multiple ? props.defaultValue ?? null : null);
|
|
20
|
+
const [uncontrolledMultiValue, setUncontrolledMultiValue] = useState(multiple ? props.defaultValue ?? [] : []);
|
|
21
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
22
|
+
const isOpenControlled = controlledOpen !== void 0;
|
|
23
|
+
const open = isOpenControlled ? controlledOpen : uncontrolledOpen;
|
|
24
|
+
const onOpenChange = useCallback((newOpen) => {
|
|
25
|
+
if (!isOpenControlled) setUncontrolledOpen(newOpen);
|
|
26
|
+
controlledOnOpenChange?.(newOpen);
|
|
27
|
+
}, [isOpenControlled, controlledOnOpenChange]);
|
|
28
|
+
const singleValue = multiple ? null : (props.value !== void 0 ? props.value : uncontrolledSingleValue) ?? null;
|
|
29
|
+
const multiValues = multiple ? props.value !== void 0 ? props.value : uncontrolledMultiValue : [];
|
|
30
|
+
const isSelected = useCallback((itemValue) => {
|
|
31
|
+
if (multiple) return multiValues.includes(itemValue);
|
|
32
|
+
return singleValue === itemValue;
|
|
33
|
+
}, [
|
|
34
|
+
multiple,
|
|
35
|
+
singleValue,
|
|
36
|
+
multiValues
|
|
37
|
+
]);
|
|
38
|
+
const onValueChangeSingle = !multiple ? props.onValueChange : void 0;
|
|
39
|
+
const onValueChangeMulti = multiple ? props.onValueChange : void 0;
|
|
40
|
+
const isControlledSingle = !multiple && props.value !== void 0;
|
|
41
|
+
const isControlledMulti = multiple && props.value !== void 0;
|
|
42
|
+
const onSelect = useCallback((itemValue) => {
|
|
43
|
+
if (multiple) {
|
|
44
|
+
const next = multiValues.includes(itemValue) ? multiValues.filter((val) => val !== itemValue) : [...multiValues, itemValue];
|
|
45
|
+
if (!isControlledMulti) setUncontrolledMultiValue(next);
|
|
46
|
+
onValueChangeMulti?.(next);
|
|
47
|
+
} else {
|
|
48
|
+
if (!isControlledSingle) setUncontrolledSingleValue(itemValue);
|
|
49
|
+
onValueChangeSingle?.(itemValue);
|
|
50
|
+
onOpenChange(false);
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
multiple,
|
|
54
|
+
isControlledMulti,
|
|
55
|
+
isControlledSingle,
|
|
56
|
+
onValueChangeMulti,
|
|
57
|
+
onValueChangeSingle,
|
|
58
|
+
multiValues,
|
|
59
|
+
onOpenChange
|
|
60
|
+
]);
|
|
61
|
+
const onDeselect = useCallback((itemValue) => {
|
|
62
|
+
if (!multiple) return;
|
|
63
|
+
const next = multiValues.filter((val) => val !== itemValue);
|
|
64
|
+
if (!isControlledMulti) setUncontrolledMultiValue(next);
|
|
65
|
+
onValueChangeMulti?.(next);
|
|
66
|
+
}, [
|
|
67
|
+
multiple,
|
|
68
|
+
isControlledMulti,
|
|
69
|
+
onValueChangeMulti,
|
|
70
|
+
multiValues
|
|
71
|
+
]);
|
|
72
|
+
const contextValue = useMemo(() => ({
|
|
73
|
+
multiple,
|
|
74
|
+
value: singleValue,
|
|
75
|
+
values: multiValues,
|
|
76
|
+
onSelect,
|
|
77
|
+
onDeselect,
|
|
78
|
+
isSelected,
|
|
79
|
+
open,
|
|
80
|
+
onOpenChange
|
|
81
|
+
}), [
|
|
82
|
+
multiple,
|
|
83
|
+
singleValue,
|
|
84
|
+
multiValues,
|
|
85
|
+
onSelect,
|
|
86
|
+
onDeselect,
|
|
87
|
+
isSelected,
|
|
88
|
+
open,
|
|
89
|
+
onOpenChange
|
|
90
|
+
]);
|
|
91
|
+
return /* @__PURE__ */ jsx(ComboboxContext.Provider, {
|
|
92
|
+
value: contextValue,
|
|
93
|
+
children: /* @__PURE__ */ jsx(Popover, {
|
|
94
|
+
open,
|
|
95
|
+
onOpenChange,
|
|
96
|
+
children
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function ComboboxTrigger({ className, size, placeholder, children, ...props }) {
|
|
101
|
+
const { multiple, value, values, open, onDeselect } = useComboboxContext();
|
|
102
|
+
const isEmpty = multiple ? values.length === 0 : value === null || value === void 0;
|
|
103
|
+
return /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
104
|
+
asChild: true,
|
|
105
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
"data-slot": "combobox-trigger",
|
|
108
|
+
role: "combobox",
|
|
109
|
+
"aria-expanded": open,
|
|
110
|
+
className: cn(selectTriggerVariants({ size }), className),
|
|
111
|
+
...props,
|
|
112
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: cn("flex flex-1 items-center gap-1.5 text-left", multiple && "flex-wrap", isEmpty && "text-placeholder"),
|
|
114
|
+
children: isEmpty ? placeholder : multiple ? /* @__PURE__ */ jsx(ComboboxTags, {
|
|
115
|
+
values,
|
|
116
|
+
onDeselect
|
|
117
|
+
}) : children
|
|
118
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-5 shrink-0 text-muted-foreground" })]
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function ComboboxTags({ values, onDeselect }) {
|
|
123
|
+
return /* @__PURE__ */ jsx(Fragment, { children: values.map((tagValue) => /* @__PURE__ */ jsx(TagDismissible, {
|
|
124
|
+
onClick: (event) => event.stopPropagation(),
|
|
125
|
+
onDismiss: () => onDeselect(tagValue),
|
|
126
|
+
children: tagValue
|
|
127
|
+
}, tagValue)) });
|
|
128
|
+
}
|
|
129
|
+
function ComboboxContent({ className, children, filter, ...props }) {
|
|
130
|
+
const { multiple } = useComboboxContext();
|
|
131
|
+
return /* @__PURE__ */ jsx(PopoverContent, {
|
|
132
|
+
className: cn("w-[var(--radix-popover-trigger-width)] p-0", className),
|
|
133
|
+
align: "start",
|
|
134
|
+
onOpenAutoFocus: multiple ? (event) => event.preventDefault() : void 0,
|
|
135
|
+
...props,
|
|
136
|
+
children: /* @__PURE__ */ jsx(Command, {
|
|
137
|
+
"data-slot": "combobox-command",
|
|
138
|
+
filter,
|
|
139
|
+
className: "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover",
|
|
140
|
+
children
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function ComboboxSearch({ className, ...props }) {
|
|
145
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
146
|
+
"data-slot": "combobox-search",
|
|
147
|
+
className: "flex items-center gap-2 border-b border-border-secondary px-3 py-2.5",
|
|
148
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, { className: "size-5 shrink-0 text-muted-foreground" }), /* @__PURE__ */ jsx(Command.Input, {
|
|
149
|
+
"data-slot": "combobox-search-input",
|
|
150
|
+
className: cn("flex h-full w-full bg-transparent type-text-md font-medium text-foreground outline-hidden", "placeholder:text-placeholder", "disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
151
|
+
...props
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function ComboboxList({ className, ...props }) {
|
|
156
|
+
return /* @__PURE__ */ jsx(Command.List, {
|
|
157
|
+
"data-slot": "combobox-list",
|
|
158
|
+
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto py-1", className),
|
|
159
|
+
...props
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
163
|
+
return /* @__PURE__ */ jsx(Command.Empty, {
|
|
164
|
+
"data-slot": "combobox-empty",
|
|
165
|
+
className: cn("py-6 text-center type-text-sm text-muted-foreground", className),
|
|
166
|
+
...props
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function ComboboxGroup({ className, ...props }) {
|
|
170
|
+
return /* @__PURE__ */ jsx(Command.Group, {
|
|
171
|
+
"data-slot": "combobox-group",
|
|
172
|
+
className: cn("overflow-hidden [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:type-text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-subtle-foreground", className),
|
|
173
|
+
...props
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
177
|
+
return /* @__PURE__ */ jsx(Command.Separator, {
|
|
178
|
+
"data-slot": "combobox-separator",
|
|
179
|
+
className: cn("bg-border-secondary -mx-1 my-1 h-px", className),
|
|
180
|
+
...props
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function ComboboxItem({ className, children, itemValue, ...props }) {
|
|
184
|
+
const { onSelect, isSelected } = useComboboxContext();
|
|
185
|
+
const selected = isSelected(itemValue);
|
|
186
|
+
return /* @__PURE__ */ jsxs(Command.Item, {
|
|
187
|
+
"data-slot": "combobox-item",
|
|
188
|
+
"data-selected-item": selected || void 0,
|
|
189
|
+
onSelect: () => onSelect(itemValue),
|
|
190
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-2.5 outline-hidden select-none", "type-text-md font-medium text-foreground mx-1.5 my-px", "data-[selected=true]:bg-background-hover", "data-[selected-item]:bg-accent", "data-[disabled=true]:pointer-events-none data-[disabled=true]:text-disabled-foreground", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5", className),
|
|
191
|
+
...props,
|
|
192
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
193
|
+
className: "flex flex-1 items-center gap-2 truncate",
|
|
194
|
+
children
|
|
195
|
+
}), selected && /* @__PURE__ */ jsx(CheckIcon, { className: "size-5 shrink-0 text-primary" })]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function ComboboxItemText({ className, children, ...props }) {
|
|
199
|
+
return /* @__PURE__ */ jsx("span", {
|
|
200
|
+
"data-slot": "combobox-item-text",
|
|
201
|
+
className: cn("type-text-md font-normal text-subtle-foreground", className),
|
|
202
|
+
...props,
|
|
203
|
+
children
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
export { Combobox, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxItem, ComboboxItemText, ComboboxList, ComboboxSearch, ComboboxSeparator, ComboboxTrigger };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Command as Command$1 } from "cmdk";
|
|
4
|
+
|
|
5
|
+
//#region src/components/command.d.ts
|
|
6
|
+
declare function Command({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof Command$1>): _$react_jsx_runtime0.JSX.Element;
|
|
10
|
+
declare function CommandInput({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof Command$1.Input>): _$react_jsx_runtime0.JSX.Element;
|
|
14
|
+
declare function CommandList({
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof Command$1.List>): _$react_jsx_runtime0.JSX.Element;
|
|
18
|
+
declare function CommandEmpty({
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof Command$1.Empty>): _$react_jsx_runtime0.JSX.Element;
|
|
21
|
+
declare function CommandGroup({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof Command$1.Group>): _$react_jsx_runtime0.JSX.Element;
|
|
25
|
+
declare function CommandSeparator({
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof Command$1.Separator>): _$react_jsx_runtime0.JSX.Element;
|
|
29
|
+
declare function CommandItem({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: React.ComponentProps<typeof Command$1.Item>): _$react_jsx_runtime0.JSX.Element;
|
|
33
|
+
declare function CommandShortcut({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<"span">): _$react_jsx_runtime0.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { SearchIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Command as Command$1 } from "cmdk";
|
|
6
|
+
//#region src/components/command.tsx
|
|
7
|
+
function Command({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
9
|
+
"data-slot": "command",
|
|
10
|
+
className: cn("bg-popover text-foreground flex h-full w-full flex-col overflow-hidden rounded-md", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function CommandInput({ className, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
"data-slot": "command-input-wrapper",
|
|
17
|
+
className: "flex h-14 items-center gap-2 border-b p-3",
|
|
18
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, { className: "size-5 shrink-0 text-muted-foreground" }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
19
|
+
"data-slot": "command-input",
|
|
20
|
+
className: cn("placeholder:text-placeholder flex h-full w-full bg-transparent type-text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
21
|
+
...props
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function CommandList({ className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
27
|
+
"data-slot": "command-list",
|
|
28
|
+
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className),
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function CommandEmpty({ ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
34
|
+
"data-slot": "command-empty",
|
|
35
|
+
className: "py-6 text-center type-text-sm text-muted-foreground",
|
|
36
|
+
...props
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function CommandGroup({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
41
|
+
"data-slot": "command-group",
|
|
42
|
+
className: cn("text-foreground [&_[cmdk-group-heading]]:text-subtle-foreground overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:p-2 [&_[cmdk-group-heading]]:type-text-xs [&_[cmdk-group-heading]]:font-medium", className),
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function CommandSeparator({ className, ...props }) {
|
|
47
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
48
|
+
"data-slot": "command-separator",
|
|
49
|
+
className: cn("bg-border -mx-1 h-px", className),
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function CommandItem({ className, ...props }) {
|
|
54
|
+
return /* @__PURE__ */ jsx(Command$1.Item, {
|
|
55
|
+
"data-slot": "command-item",
|
|
56
|
+
className: cn("data-[selected=true]:bg-background-hover [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-xs px-2 py-3 type-text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:text-disabled-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5", className),
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function CommandShortcut({ className, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx("span", {
|
|
62
|
+
"data-slot": "command-shortcut",
|
|
63
|
+
className: cn("ml-auto shrink-0 rounded-xs border border-border-secondary px-1 py-px type-text-xs font-medium text-placeholder", className),
|
|
64
|
+
...props
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|