@inui/design-system 0.0.0-stage → 1.22.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/README.md +360 -2
- package/dist/components/ui/accordion.d.ts +44 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +86 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/ai-avatar.d.ts +46 -0
- package/dist/components/ui/ai-avatar.d.ts.map +1 -0
- package/dist/components/ui/ai-avatar.js +43 -0
- package/dist/components/ui/ai-avatar.js.map +1 -0
- package/dist/components/ui/ai-label.d.ts +118 -0
- package/dist/components/ui/ai-label.d.ts.map +1 -0
- package/dist/components/ui/ai-label.js +184 -0
- package/dist/components/ui/ai-label.js.map +1 -0
- package/dist/components/ui/ai-sparkle.d.ts +91 -0
- package/dist/components/ui/ai-sparkle.d.ts.map +1 -0
- package/dist/components/ui/ai-sparkle.js +200 -0
- package/dist/components/ui/ai-sparkle.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +79 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +147 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +71 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +108 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +30 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +40 -0
- package/dist/components/ui/aspect-ratio.js.map +1 -0
- package/dist/components/ui/attachment.d.ts +74 -0
- package/dist/components/ui/attachment.d.ts.map +1 -0
- package/dist/components/ui/attachment.js +142 -0
- package/dist/components/ui/attachment.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +82 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +123 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +130 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +226 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +43 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +98 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/browser-tabs.d.ts +218 -0
- package/dist/components/ui/browser-tabs.d.ts.map +1 -0
- package/dist/components/ui/browser-tabs.js +528 -0
- package/dist/components/ui/browser-tabs.js.map +1 -0
- package/dist/components/ui/bubble.d.ts +80 -0
- package/dist/components/ui/bubble.d.ts.map +1 -0
- package/dist/components/ui/bubble.js +235 -0
- package/dist/components/ui/bubble.js.map +1 -0
- package/dist/components/ui/button-group.d.ts +60 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +89 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +157 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +144 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +57 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +163 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +96 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +131 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/carousel.d.ts +86 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +207 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +54 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +78 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +45 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +65 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +111 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +264 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command.d.ts +71 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +133 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +70 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +163 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/count-badge.d.ts +40 -0
- package/dist/components/ui/count-badge.d.ts.map +1 -0
- package/dist/components/ui/count-badge.js +43 -0
- package/dist/components/ui/count-badge.js.map +1 -0
- package/dist/components/ui/data-table.d.ts +1026 -0
- package/dist/components/ui/data-table.d.ts.map +1 -0
- package/dist/components/ui/data-table.js +3423 -0
- package/dist/components/ui/data-table.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +73 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +145 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/direction.d.ts +35 -0
- package/dist/components/ui/direction.d.ts.map +1 -0
- package/dist/components/ui/direction.js +35 -0
- package/dist/components/ui/direction.js.map +1 -0
- package/dist/components/ui/drawer.d.ts +53 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +115 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +75 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +173 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/dropzone.d.ts +141 -0
- package/dist/components/ui/dropzone.d.ts.map +1 -0
- package/dist/components/ui/dropzone.js +257 -0
- package/dist/components/ui/dropzone.js.map +1 -0
- package/dist/components/ui/empty.d.ts +94 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +149 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/field.d.ts +122 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +254 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +51 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +101 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +62 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +115 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +52 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +89 -0
- package/dist/components/ui/input-otp.js.map +1 -0
- package/dist/components/ui/input.d.ts +47 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +47 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/item.d.ts +74 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +176 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +41 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +58 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/key-value-pair.d.ts +56 -0
- package/dist/components/ui/key-value-pair.d.ts.map +1 -0
- package/dist/components/ui/key-value-pair.js +110 -0
- package/dist/components/ui/key-value-pair.js.map +1 -0
- package/dist/components/ui/label.d.ts +83 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +85 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/marker.d.ts +54 -0
- package/dist/components/ui/marker.d.ts.map +1 -0
- package/dist/components/ui/marker.js +79 -0
- package/dist/components/ui/marker.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +72 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +174 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/message-scroller.d.ts +53 -0
- package/dist/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller.js +95 -0
- package/dist/components/ui/message-scroller.js.map +1 -0
- package/dist/components/ui/message.d.ts +63 -0
- package/dist/components/ui/message.d.ts.map +1 -0
- package/dist/components/ui/message.js +92 -0
- package/dist/components/ui/message.js.map +1 -0
- package/dist/components/ui/meta-list.d.ts +55 -0
- package/dist/components/ui/meta-list.d.ts.map +1 -0
- package/dist/components/ui/meta-list.js +75 -0
- package/dist/components/ui/meta-list.js.map +1 -0
- package/dist/components/ui/native-select.d.ts +51 -0
- package/dist/components/ui/native-select.d.ts.map +1 -0
- package/dist/components/ui/native-select.js +75 -0
- package/dist/components/ui/native-select.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +56 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +116 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/page-header.d.ts +223 -0
- package/dist/components/ui/page-header.d.ts.map +1 -0
- package/dist/components/ui/page-header.js +233 -0
- package/dist/components/ui/page-header.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +68 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +145 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +61 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +144 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +46 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/questionnaire.d.ts +92 -0
- package/dist/components/ui/questionnaire.d.ts.map +1 -0
- package/dist/components/ui/questionnaire.js +277 -0
- package/dist/components/ui/questionnaire.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +50 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +65 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +44 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +73 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +55 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +72 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +274 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +609 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +31 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +38 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +59 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +128 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +166 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +512 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +35 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +46 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +39 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +75 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +56 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +96 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +37 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +51 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/stepper.d.ts +84 -0
- package/dist/components/ui/stepper.d.ts.map +1 -0
- package/dist/components/ui/stepper.js +145 -0
- package/dist/components/ui/stepper.js.map +1 -0
- package/dist/components/ui/switch.d.ts +36 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +44 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +80 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +130 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +87 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +128 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +35 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +38 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/time-picker.d.ts +58 -0
- package/dist/components/ui/time-picker.d.ts.map +1 -0
- package/dist/components/ui/time-picker.js +188 -0
- package/dist/components/ui/time-picker.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +52 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +94 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +50 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +70 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +51 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +78 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/hooks/use-dark-mode.d.ts +2 -0
- package/dist/hooks/use-dark-mode.d.ts.map +1 -0
- package/dist/hooks/use-dark-mode.js +36 -0
- package/dist/hooks/use-dark-mode.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +20 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/lib/scope.d.ts +64 -0
- package/dist/lib/scope.d.ts.map +1 -0
- package/dist/lib/scope.js +74 -0
- package/dist/lib/scope.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +11 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/theme-tokens.css +537 -0
- package/dist/theme.css +417 -0
- package/package.json +103 -3
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/utils.js";
|
|
3
|
+
import { getPortalContainer } from "../../lib/scope.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
10
|
+
//#region src/components/ui/combobox.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Combobox — searchable select that filters options as you type.
|
|
13
|
+
*
|
|
14
|
+
* Built on the Base UI Combobox primitive (Radix has no combobox primitive
|
|
15
|
+
* of its own). Composed of Combobox, ComboboxInput, ComboboxChips, etc.; the
|
|
16
|
+
* input/trigger/clear row renders through MMDS's own InputGroup component,
|
|
17
|
+
* and a useComboboxAnchor helper wires the popup to the chips container.
|
|
18
|
+
*/
|
|
19
|
+
var Combobox = Combobox$1.Root;
|
|
20
|
+
function ComboboxValue({ ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(Combobox$1.Value, {
|
|
22
|
+
"data-slot": "combobox-value",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function ComboboxTrigger({ className, children, "aria-label": ariaLabel = "Toggle list", ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
|
|
28
|
+
"data-slot": "combobox-trigger",
|
|
29
|
+
"aria-label": ariaLabel,
|
|
30
|
+
className: cn("[&_svg:not([class*='size-'])]:size-4", className),
|
|
31
|
+
...props,
|
|
32
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function ComboboxClear({ className, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(Combobox$1.Clear, {
|
|
37
|
+
"data-slot": "combobox-clear",
|
|
38
|
+
render: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
39
|
+
variant: "ghost",
|
|
40
|
+
size: "xs",
|
|
41
|
+
iconOnly: true
|
|
42
|
+
}),
|
|
43
|
+
className: cn(className),
|
|
44
|
+
"aria-label": "Clear selection",
|
|
45
|
+
...props,
|
|
46
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, size = "default", ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
51
|
+
"data-size": size,
|
|
52
|
+
className: cn("w-auto", size === "sm" && "h-7", size === "xs" && "h-6", className),
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
55
|
+
render: /* @__PURE__ */ jsx(InputGroupInput, {
|
|
56
|
+
disabled,
|
|
57
|
+
className: cn(size !== "default" && "text-xs")
|
|
58
|
+
}),
|
|
59
|
+
...props
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
62
|
+
align: "inline-end",
|
|
63
|
+
children: [showTrigger && /* @__PURE__ */ jsx(InputGroupButton, {
|
|
64
|
+
size: "xs",
|
|
65
|
+
iconOnly: true,
|
|
66
|
+
variant: "ghost",
|
|
67
|
+
asChild: true,
|
|
68
|
+
"data-slot": "input-group-button",
|
|
69
|
+
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
|
|
70
|
+
disabled,
|
|
71
|
+
children: /* @__PURE__ */ jsx(ComboboxTrigger, {})
|
|
72
|
+
}), showClear && /* @__PURE__ */ jsx(ComboboxClear, { disabled })]
|
|
73
|
+
}),
|
|
74
|
+
children
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "start", alignOffset = 0, anchor, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx(Combobox$1.Portal, {
|
|
80
|
+
container: getPortalContainer(),
|
|
81
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
|
|
82
|
+
side,
|
|
83
|
+
sideOffset,
|
|
84
|
+
align,
|
|
85
|
+
alignOffset,
|
|
86
|
+
anchor,
|
|
87
|
+
className: "isolate z-50",
|
|
88
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
89
|
+
"data-slot": "combobox-content",
|
|
90
|
+
"data-chips": !!anchor,
|
|
91
|
+
className: cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-popover ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
92
|
+
...props
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function ComboboxList({ className, ...props }) {
|
|
98
|
+
return /* @__PURE__ */ jsx(Combobox$1.List, {
|
|
99
|
+
"data-slot": "combobox-list",
|
|
100
|
+
className: cn("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0", className),
|
|
101
|
+
...props
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Item, {
|
|
106
|
+
"data-slot": "combobox-item",
|
|
107
|
+
className: cn("relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
108
|
+
...props,
|
|
109
|
+
children: [children, /* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
|
|
110
|
+
render: /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
|
|
111
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "pointer-events-none" })
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function ComboboxGroup({ className, ...props }) {
|
|
116
|
+
return /* @__PURE__ */ jsx(Combobox$1.Group, {
|
|
117
|
+
"data-slot": "combobox-group",
|
|
118
|
+
className: cn(className),
|
|
119
|
+
...props
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function ComboboxLabel({ className, ...props }) {
|
|
123
|
+
return /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
|
|
124
|
+
"data-slot": "combobox-label",
|
|
125
|
+
className: cn("px-2 py-1.5 text-xs text-muted-foreground", className),
|
|
126
|
+
...props
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function ComboboxCollection({ ...props }) {
|
|
130
|
+
return /* @__PURE__ */ jsx(Combobox$1.Collection, {
|
|
131
|
+
"data-slot": "combobox-collection",
|
|
132
|
+
...props
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
136
|
+
return /* @__PURE__ */ jsx(Combobox$1.Empty, {
|
|
137
|
+
"data-slot": "combobox-empty",
|
|
138
|
+
className: cn("flex w-full justify-center text-center text-sm text-muted-foreground [&:not(:empty)]:py-2", className),
|
|
139
|
+
...props
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
143
|
+
return /* @__PURE__ */ jsx(Combobox$1.Separator, {
|
|
144
|
+
"data-slot": "combobox-separator",
|
|
145
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
146
|
+
...props
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function ComboboxChips({ className, ...props }) {
|
|
150
|
+
return /* @__PURE__ */ jsx(Combobox$1.Chips, {
|
|
151
|
+
"data-slot": "combobox-chips",
|
|
152
|
+
className: cn("flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40", className),
|
|
153
|
+
...props
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function ComboboxChip({ className, children, showRemove = true, ...props }) {
|
|
157
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chip, {
|
|
158
|
+
"data-slot": "combobox-chip",
|
|
159
|
+
className: cn("flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0", className),
|
|
160
|
+
...props,
|
|
161
|
+
children: [children, showRemove && /* @__PURE__ */ jsx(Combobox$1.ChipRemove, {
|
|
162
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
163
|
+
variant: "ghost",
|
|
164
|
+
size: "xs",
|
|
165
|
+
iconOnly: true,
|
|
166
|
+
"aria-label": "Remove"
|
|
167
|
+
}),
|
|
168
|
+
className: "-ml-1 opacity-50 hover:opacity-100",
|
|
169
|
+
"data-slot": "combobox-chip-remove",
|
|
170
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "pointer-events-none" })
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function ComboboxChipsInput({ className, ...props }) {
|
|
175
|
+
return /* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
176
|
+
"data-slot": "combobox-chip-input",
|
|
177
|
+
className: cn("min-w-16 flex-1 outline-none", className),
|
|
178
|
+
...props
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function useComboboxAnchor() {
|
|
182
|
+
return React.useRef(null);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* WHEN TO USE
|
|
186
|
+
* - Large or dynamic option lists where typing to filter matters.
|
|
187
|
+
* - Grouped options with headings (ComboboxGroup + ComboboxLabel).
|
|
188
|
+
* - Multi-value entry with removable chips — pass `multiple` to the root Combobox, and render ComboboxChips / ComboboxChip / ComboboxChipsInput instead of ComboboxInput; wire the popover's `anchor` to the chips container via useComboboxAnchor. See the "MultiSelect" story.
|
|
189
|
+
*
|
|
190
|
+
* NOT WHEN
|
|
191
|
+
* - The list is short and fixed — use Select, it's simpler with no search overhead.
|
|
192
|
+
* - It's free text with no option list at all — use Input.
|
|
193
|
+
* - It's a global command palette / action launcher rather than a form value — use Command.
|
|
194
|
+
* - It's a free-text search with no value to commit — results to act on, not a field to fill in
|
|
195
|
+
* (a page-level "Search patients" box, an embedded search panel) — use Command directly (not
|
|
196
|
+
* CommandDialog, which is the ⌘K-palette wrapper) instead of reaching for Combobox just
|
|
197
|
+
* because it also filters as you type; Combobox always resolves to one selected item sitting
|
|
198
|
+
* in the trigger, which a search box doesn't have.
|
|
199
|
+
*
|
|
200
|
+
* KEY RULES
|
|
201
|
+
* - Pass options through the `items` prop on the root Combobox; ComboboxList takes a render-function child, called once per item.
|
|
202
|
+
* - ComboboxContent is portaled and width-locked to the anchor via --anchor-width — don't give it a fixed width.
|
|
203
|
+
* - ComboboxInput has `showTrigger` (default true, shows the dropdown chevron button) and `showClear` (default false, shows a clear button — only useful once a value is set).
|
|
204
|
+
* - ComboboxInput's `size` is "default" | "sm" | "xs" (default "default") —
|
|
205
|
+
* same default/sm/xs vocabulary as Select/Button/Tabs, not Combobox-specific
|
|
206
|
+
* naming. Only affects the input row itself; ComboboxContent/ComboboxItem
|
|
207
|
+
* stay fixed size, matching how Select's own `size` only sizes its trigger.
|
|
208
|
+
* Omits the native `size` (character-width) attribute `<input>` normally
|
|
209
|
+
* has — there's no way to set that one through ComboboxInput.
|
|
210
|
+
* - ComboboxItem renders its own CheckIcon selected-state indicator — don't add a second one.
|
|
211
|
+
*
|
|
212
|
+
* USAGE
|
|
213
|
+
* <Combobox items={spices}>
|
|
214
|
+
* <ComboboxInput placeholder="Select a spice" />
|
|
215
|
+
* <ComboboxContent>
|
|
216
|
+
* <ComboboxEmpty>No spice found.</ComboboxEmpty>
|
|
217
|
+
* <ComboboxList>
|
|
218
|
+
* {(item: string) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}
|
|
219
|
+
* </ComboboxList>
|
|
220
|
+
* </ComboboxContent>
|
|
221
|
+
* </Combobox>
|
|
222
|
+
*
|
|
223
|
+
* // Grouped options
|
|
224
|
+
* <Combobox items={spices}>
|
|
225
|
+
* <ComboboxInput placeholder="Select a spice" />
|
|
226
|
+
* <ComboboxContent>
|
|
227
|
+
* <ComboboxList>
|
|
228
|
+
* <ComboboxGroup>
|
|
229
|
+
* <ComboboxLabel>Warm</ComboboxLabel>
|
|
230
|
+
* <ComboboxItem value="Cinnamon">Cinnamon</ComboboxItem>
|
|
231
|
+
* </ComboboxGroup>
|
|
232
|
+
* </ComboboxList>
|
|
233
|
+
* </ComboboxContent>
|
|
234
|
+
* </Combobox>
|
|
235
|
+
*
|
|
236
|
+
* // Default value with a clear button
|
|
237
|
+
* <Combobox items={spices} defaultValue="Cardamom">
|
|
238
|
+
* <ComboboxInput placeholder="Select a spice" showClear />
|
|
239
|
+
* <ComboboxContent>
|
|
240
|
+
* <ComboboxList>
|
|
241
|
+
* {(item: string) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}
|
|
242
|
+
* </ComboboxList>
|
|
243
|
+
* </ComboboxContent>
|
|
244
|
+
* </Combobox>
|
|
245
|
+
*
|
|
246
|
+
* // Multi-select with removable chips
|
|
247
|
+
* const [value, setValue] = React.useState<string[]>([])
|
|
248
|
+
* const anchorRef = useComboboxAnchor()
|
|
249
|
+
* <Combobox items={spices} multiple value={value} onValueChange={setValue}>
|
|
250
|
+
* <ComboboxChips ref={anchorRef}>
|
|
251
|
+
* {value.map((item) => <ComboboxChip key={item}>{item}</ComboboxChip>)}
|
|
252
|
+
* <ComboboxChipsInput placeholder="Select spices" />
|
|
253
|
+
* </ComboboxChips>
|
|
254
|
+
* <ComboboxContent anchor={anchorRef}>
|
|
255
|
+
* <ComboboxList>
|
|
256
|
+
* {(item: string) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}
|
|
257
|
+
* </ComboboxList>
|
|
258
|
+
* </ComboboxContent>
|
|
259
|
+
* </Combobox>
|
|
260
|
+
*/
|
|
261
|
+
//#endregion
|
|
262
|
+
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor };
|
|
263
|
+
|
|
264
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","names":[],"sources":["../../../src/components/ui/combobox.tsx"],"sourcesContent":["\"use client\"\n\n/**\n * Combobox — searchable select that filters options as you type.\n *\n * Built on the Base UI Combobox primitive (Radix has no combobox primitive\n * of its own). Composed of Combobox, ComboboxInput, ComboboxChips, etc.; the\n * input/trigger/clear row renders through MMDS's own InputGroup component,\n * and a useComboboxAnchor helper wires the popup to the chips container.\n */\n\nimport * as React from \"react\"\n// Subpath import, not the root barrel. `@base-ui/react` re-exports all 83 of its\n// components, which pulled ~600 modules into the Storybook graph to use one. The\n// `Combobox` object is identical either way (verified by reference equality).\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\n\nimport { cn } from \"@/lib/utils\"\nimport { getPortalContainer } from \"@/lib/scope\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"@/components/ui/input-group\"\nimport { ChevronDownIcon, XIcon, CheckIcon } from \"lucide-react\"\n\nconst Combobox = ComboboxPrimitive.Root\n\nfunction ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n \"aria-label\": ariaLabel = \"Toggle list\",\n ...props\n}: ComboboxPrimitive.Trigger.Props) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n aria-label={ariaLabel}\n className={cn(\"[&_svg:not([class*='size-'])]:size-4\", className)}\n {...props}\n >\n {children}\n <ChevronDownIcon className=\"pointer-events-none size-4 text-muted-foreground\" />\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"xs\" iconOnly />}\n className={cn(className)}\n aria-label=\"Clear selection\"\n {...props}\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n size = \"default\",\n ...props\n}: Omit<ComboboxPrimitive.Input.Props, \"size\"> & {\n showTrigger?: boolean\n showClear?: boolean\n size?: \"default\" | \"sm\" | \"xs\"\n}) {\n return (\n <InputGroup\n data-size={size}\n className={cn(\n \"w-auto\",\n size === \"sm\" && \"h-7\",\n size === \"xs\" && \"h-6\",\n className\n )}\n >\n <ComboboxPrimitive.Input\n render={\n <InputGroupInput\n disabled={disabled}\n className={cn(size !== \"default\" && \"text-xs\")}\n />\n }\n {...props}\n />\n <InputGroupAddon align=\"inline-end\">\n {showTrigger && (\n <InputGroupButton\n size=\"xs\"\n iconOnly\n variant=\"ghost\"\n asChild\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n >\n <ComboboxTrigger />\n </InputGroupButton>\n )}\n {showClear && <ComboboxClear disabled={disabled} />}\n </InputGroupAddon>\n {children}\n </InputGroup>\n )\n}\n\nfunction ComboboxContent({\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"start\",\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxPrimitive.Popup.Props &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"anchor\"\n >) {\n return (\n <ComboboxPrimitive.Portal container={getPortalContainer()}>\n <ComboboxPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n data-chips={!!anchor}\n className={cn(\n \"group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-popover ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n className\n )}\n {...props}\n />\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n \"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({\n className,\n children,\n ...props\n}: ComboboxPrimitive.Item.Props) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />\n }\n >\n <CheckIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxLabel({\n className,\n ...props\n}: ComboboxPrimitive.GroupLabel.Props) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\"px-2 py-1.5 text-xs text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {\n return (\n <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n )\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {\n // The primitive already renders `children` as `null` unless the filtered\n // list is empty (see its own source) — its root element must stay\n // mounted and visible for its `role=\"status\" aria-live=\"polite\"` to\n // announce reliably, so this must never drive the root itself with\n // `hidden`/`display:none` in lockstep with the empty state (that's what\n // the primitive's own doc comment warns against). Padding is applied\n // only `:not(:empty)` so it still collapses to zero height when there's\n // nothing to show, without ever toggling `display` on the root itself.\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n \"flex w-full justify-center text-center text-sm text-muted-foreground [&:not(:empty)]:py-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: ComboboxPrimitive.Separator.Props) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({\n className,\n ...props\n}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &\n ComboboxPrimitive.Chips.Props) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n \"flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxPrimitive.Chip.Props & {\n showRemove?: boolean\n}) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n \"flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0\",\n className\n )}\n {...props}\n >\n {children}\n {showRemove && (\n <ComboboxPrimitive.ChipRemove\n render={\n <Button variant=\"ghost\" size=\"xs\" iconOnly aria-label=\"Remove\" />\n }\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <XIcon className=\"pointer-events-none\" />\n </ComboboxPrimitive.ChipRemove>\n )}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({\n className,\n ...props\n}: ComboboxPrimitive.Input.Props) {\n return (\n <ComboboxPrimitive.Input\n data-slot=\"combobox-chip-input\"\n className={cn(\"min-w-16 flex-1 outline-none\", className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n useComboboxAnchor,\n}\n\n/**\n * WHEN TO USE\n * - Large or dynamic option lists where typing to filter matters.\n * - Grouped options with headings (ComboboxGroup + ComboboxLabel).\n * - Multi-value entry with removable chips — pass `multiple` to the root Combobox, and render ComboboxChips / ComboboxChip / ComboboxChipsInput instead of ComboboxInput; wire the popover's `anchor` to the chips container via useComboboxAnchor. See the \"MultiSelect\" story.\n *\n * NOT WHEN\n * - The list is short and fixed — use Select, it's simpler with no search overhead.\n * - It's free text with no option list at all — use Input.\n * - It's a global command palette / action launcher rather than a form value — use Command.\n * - It's a free-text search with no value to commit — results to act on, not a field to fill in\n * (a page-level \"Search patients\" box, an embedded search panel) — use Command directly (not\n * CommandDialog, which is the ⌘K-palette wrapper) instead of reaching for Combobox just\n * because it also filters as you type; Combobox always resolves to one selected item sitting\n * in the trigger, which a search box doesn't have.\n *\n * KEY RULES\n * - Pass options through the `items` prop on the root Combobox; ComboboxList takes a render-function child, called once per item.\n * - ComboboxContent is portaled and width-locked to the anchor via --anchor-width — don't give it a fixed width.\n * - ComboboxInput has `showTrigger` (default true, shows the dropdown chevron button) and `showClear` (default false, shows a clear button — only useful once a value is set).\n * - ComboboxInput's `size` is \"default\" | \"sm\" | \"xs\" (default \"default\") —\n * same default/sm/xs vocabulary as Select/Button/Tabs, not Combobox-specific\n * naming. Only affects the input row itself; ComboboxContent/ComboboxItem\n * stay fixed size, matching how Select's own `size` only sizes its trigger.\n * Omits the native `size` (character-width) attribute `<input>` normally\n * has — there's no way to set that one through ComboboxInput.\n * - ComboboxItem renders its own CheckIcon selected-state indicator — don't add a second one.\n *\n * USAGE\n * <Combobox items={spices}>\n * <ComboboxInput placeholder=\"Select a spice\" />\n * <ComboboxContent>\n * <ComboboxEmpty>No spice found.</ComboboxEmpty>\n * <ComboboxList>\n * {(item: string) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}\n * </ComboboxList>\n * </ComboboxContent>\n * </Combobox>\n *\n * // Grouped options\n * <Combobox items={spices}>\n * <ComboboxInput placeholder=\"Select a spice\" />\n * <ComboboxContent>\n * <ComboboxList>\n * <ComboboxGroup>\n * <ComboboxLabel>Warm</ComboboxLabel>\n * <ComboboxItem value=\"Cinnamon\">Cinnamon</ComboboxItem>\n * </ComboboxGroup>\n * </ComboboxList>\n * </ComboboxContent>\n * </Combobox>\n *\n * // Default value with a clear button\n * <Combobox items={spices} defaultValue=\"Cardamom\">\n * <ComboboxInput placeholder=\"Select a spice\" showClear />\n * <ComboboxContent>\n * <ComboboxList>\n * {(item: string) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}\n * </ComboboxList>\n * </ComboboxContent>\n * </Combobox>\n *\n * // Multi-select with removable chips\n * const [value, setValue] = React.useState<string[]>([])\n * const anchorRef = useComboboxAnchor()\n * <Combobox items={spices} multiple value={value} onValueChange={setValue}>\n * <ComboboxChips ref={anchorRef}>\n * {value.map((item) => <ComboboxChip key={item}>{item}</ComboboxChip>)}\n * <ComboboxChipsInput placeholder=\"Select spices\" />\n * </ComboboxChips>\n * <ComboboxContent anchor={anchorRef}>\n * <ComboboxList>\n * {(item: string) => <ComboboxItem key={item} value={item}>{item}</ComboboxItem>}\n * </ComboboxList>\n * </ComboboxContent>\n * </Combobox>\n */\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,IAAM,WAAW,WAAkB;AAEnC,SAAS,cAAc,EAAE,GAAG,SAAwC;CAClE,OAAO,oBAAC,WAAkB,OAAnB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,gBAAgB,EACvB,WACA,UACA,cAAc,YAAY,eAC1B,GAAG,SAC+B;CAClC,OACE,qBAAC,WAAkB,SAAnB;EACE,aAAU;EACV,cAAY;EACZ,WAAW,GAAG,wCAAwC,SAAS;EAC/D,GAAI;EAJN,UAAA,CAMG,UACD,oBAAC,iBAAD,EAAiB,WAAU,mDAAoD,CAAA,CACtD;;AAE/B;AAEA,SAAS,cAAc,EAAE,WAAW,GAAG,SAAwC;CAC7E,OACE,oBAAC,WAAkB,OAAnB;EACE,aAAU;EACV,QAAQ,oBAAC,kBAAD;GAAkB,SAAQ;GAAQ,MAAK;GAAK,UAAA;EAAU,CAAA;EAC9D,WAAW,GAAG,SAAS;EACvB,cAAW;EACX,GAAI;EAEJ,UAAA,oBAAC,OAAD,EAAO,WAAU,sBAAuB,CAAA;CACjB,CAAA;AAE7B;AAEA,SAAS,cAAc,EACrB,WACA,UACA,WAAW,OACX,cAAc,MACd,YAAY,OACZ,OAAO,WACP,GAAG,SAKF;CACD,OACE,qBAAC,YAAD;EACE,aAAW;EACX,WAAW,GACT,UACA,SAAS,QAAQ,OACjB,SAAS,QAAQ,OACjB,SACF;EAPF,UAAA;GASE,oBAAC,WAAkB,OAAnB;IACE,QACE,oBAAC,iBAAD;KACY;KACV,WAAW,GAAG,SAAS,aAAa,SAAS;IAC9C,CAAA;IAEH,GAAI;GACL,C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M,OAA8B,IAAI;AACjD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command — filterable command list.
|
|
3
|
+
*
|
|
4
|
+
* CommandDialog wraps it in a Dialog for a ⌘K-style modal palette. The standard
|
|
5
|
+
* base for command palettes: cmdk is the filtering/keyboard-nav engine, with
|
|
6
|
+
* MMDS item, group, and shortcut styling layered on top.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
10
|
+
import { Dialog } from "../../components/ui/dialog";
|
|
11
|
+
declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element;
|
|
12
|
+
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
showCloseButton?: boolean;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
|
|
19
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
|
|
20
|
+
declare function CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
|
|
21
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
|
|
22
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element;
|
|
23
|
+
declare function CommandItem({ className, children, checked, ...props }: React.ComponentProps<typeof CommandPrimitive.Item> & {
|
|
24
|
+
/** Marks this item as the persisted "current value" (the checkmark this component's own CSS already shows) — cmdk owns `aria-selected` itself (reflecting only the transient keyboard-highlighted item, reasserted after any consumer props), so this mirrors into `aria-checked`/`data-checked` instead, the one pair cmdk never touches. */
|
|
25
|
+
checked?: boolean;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
28
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
29
|
+
/**
|
|
30
|
+
* WHEN TO USE
|
|
31
|
+
* - A global command palette (⌘K / Ctrl+K) for quick navigation or running actions — use CommandDialog.
|
|
32
|
+
* - An inline searchable action list embedded in a page or panel — use Command directly.
|
|
33
|
+
*
|
|
34
|
+
* NOT WHEN
|
|
35
|
+
* - Picking a form value from a list — use Select or Combobox instead.
|
|
36
|
+
* - A simple menu anchored to a trigger button with no search — use DropdownMenu instead.
|
|
37
|
+
*
|
|
38
|
+
* KEY RULES
|
|
39
|
+
* - CommandInput filters CommandItem children automatically via cmdk — no manual filtering needed.
|
|
40
|
+
* - CommandGroup takes a `heading` prop for section labels; CommandSeparator divides groups.
|
|
41
|
+
* - CommandShortcut renders right-aligned key-hint text (e.g. "⌘P") inside a CommandItem.
|
|
42
|
+
* - CommandEmpty renders only when the filtered list has zero results.
|
|
43
|
+
* - CommandItem's `checked` prop shows the persisted checkmark (e.g. "this is the current value" in
|
|
44
|
+
* a combobox-style single-select usage) and mirrors it into `aria-checked`/`data-checked` — don't
|
|
45
|
+
* pass a bare `data-checked` attribute yourself, cmdk reasserts its own `aria-selected` (the
|
|
46
|
+
* transient keyboard-highlight state) over any consumer prop, so `checked` is the only path that
|
|
47
|
+
* actually reaches assistive tech.
|
|
48
|
+
* - CommandDialog defaults `showCloseButton` to false and is controlled via `open`/`onOpenChange`, same as Dialog.
|
|
49
|
+
*
|
|
50
|
+
* USAGE
|
|
51
|
+
* <Command className="w-80 rounded-xl border shadow-popover">
|
|
52
|
+
* <CommandInput placeholder="Type a command or search…" />
|
|
53
|
+
* <CommandList>
|
|
54
|
+
* <CommandEmpty>No results found.</CommandEmpty>
|
|
55
|
+
* <CommandGroup heading="Suggestions">
|
|
56
|
+
* <CommandItem><CalendarIcon />Calendar</CommandItem>
|
|
57
|
+
* </CommandGroup>
|
|
58
|
+
* <CommandSeparator />
|
|
59
|
+
* <CommandGroup heading="Settings">
|
|
60
|
+
* <CommandItem><UserIcon />Profile<CommandShortcut>⌘P</CommandShortcut></CommandItem>
|
|
61
|
+
* </CommandGroup>
|
|
62
|
+
* </CommandList>
|
|
63
|
+
* </Command>
|
|
64
|
+
*
|
|
65
|
+
* // ⌘K palette bound to a keyboard shortcut
|
|
66
|
+
* <CommandDialog open={open} onOpenChange={setOpen}>
|
|
67
|
+
* <CommandInput placeholder="Type a command or search…" />
|
|
68
|
+
* <CommandList>{items}</CommandList>
|
|
69
|
+
* </CommandDialog>
|
|
70
|
+
*/
|
|
71
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/components/ui/command.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAGlD,OAAO,EACL,MAAM,EAKP,MAAM,wBAAwB,CAAA;AAI/B,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,qBAW/C;AAED,iBAAS,aAAa,CAAC,EACrB,KAAyB,EACzB,WAA8C,EAC9C,QAAQ,EACR,SAAS,EACT,eAAuB,EACvB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,qBAkBA;AA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InputGroup, InputGroupAddon } from "./input-group.js";
|
|
3
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./dialog.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { CheckIcon, SearchIcon } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Command as Command$1 } from "cmdk";
|
|
8
|
+
//#region src/components/ui/command.tsx
|
|
9
|
+
function Command({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Command$1, {
|
|
11
|
+
"data-slot": "command",
|
|
12
|
+
className: cn("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = false, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
18
|
+
...props,
|
|
19
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
20
|
+
className: "sr-only",
|
|
21
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
22
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
23
|
+
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className),
|
|
24
|
+
showCloseButton,
|
|
25
|
+
children
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function CommandInput({ className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("div", {
|
|
31
|
+
"data-slot": "command-input-wrapper",
|
|
32
|
+
className: "p-1 pb-0",
|
|
33
|
+
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
34
|
+
className: "h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",
|
|
35
|
+
children: [/* @__PURE__ */ jsx(Command$1.Input, {
|
|
36
|
+
"data-slot": "command-input",
|
|
37
|
+
className: cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
38
|
+
...props
|
|
39
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }) })]
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function CommandList({ className, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx(Command$1.List, {
|
|
45
|
+
"data-slot": "command-list",
|
|
46
|
+
className: cn("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function CommandEmpty({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
52
|
+
"data-slot": "command-empty",
|
|
53
|
+
className: cn("py-6 text-center text-sm", className),
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function CommandGroup({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Command$1.Group, {
|
|
59
|
+
"data-slot": "command-group",
|
|
60
|
+
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),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function CommandSeparator({ className, ...props }) {
|
|
65
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
66
|
+
"data-slot": "command-separator",
|
|
67
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function CommandItem({ className, children, checked, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsxs(Command$1.Item, {
|
|
73
|
+
"data-slot": "command-item",
|
|
74
|
+
"data-checked": checked ? "true" : void 0,
|
|
75
|
+
"aria-checked": checked,
|
|
76
|
+
className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground", className),
|
|
77
|
+
...props,
|
|
78
|
+
children: [children, /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function CommandShortcut({ className, ...props }) {
|
|
82
|
+
return /* @__PURE__ */ jsx("span", {
|
|
83
|
+
"data-slot": "command-shortcut",
|
|
84
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className),
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* WHEN TO USE
|
|
90
|
+
* - A global command palette (⌘K / Ctrl+K) for quick navigation or running actions — use CommandDialog.
|
|
91
|
+
* - An inline searchable action list embedded in a page or panel — use Command directly.
|
|
92
|
+
*
|
|
93
|
+
* NOT WHEN
|
|
94
|
+
* - Picking a form value from a list — use Select or Combobox instead.
|
|
95
|
+
* - A simple menu anchored to a trigger button with no search — use DropdownMenu instead.
|
|
96
|
+
*
|
|
97
|
+
* KEY RULES
|
|
98
|
+
* - CommandInput filters CommandItem children automatically via cmdk — no manual filtering needed.
|
|
99
|
+
* - CommandGroup takes a `heading` prop for section labels; CommandSeparator divides groups.
|
|
100
|
+
* - CommandShortcut renders right-aligned key-hint text (e.g. "⌘P") inside a CommandItem.
|
|
101
|
+
* - CommandEmpty renders only when the filtered list has zero results.
|
|
102
|
+
* - CommandItem's `checked` prop shows the persisted checkmark (e.g. "this is the current value" in
|
|
103
|
+
* a combobox-style single-select usage) and mirrors it into `aria-checked`/`data-checked` — don't
|
|
104
|
+
* pass a bare `data-checked` attribute yourself, cmdk reasserts its own `aria-selected` (the
|
|
105
|
+
* transient keyboard-highlight state) over any consumer prop, so `checked` is the only path that
|
|
106
|
+
* actually reaches assistive tech.
|
|
107
|
+
* - CommandDialog defaults `showCloseButton` to false and is controlled via `open`/`onOpenChange`, same as Dialog.
|
|
108
|
+
*
|
|
109
|
+
* USAGE
|
|
110
|
+
* <Command className="w-80 rounded-xl border shadow-popover">
|
|
111
|
+
* <CommandInput placeholder="Type a command or search…" />
|
|
112
|
+
* <CommandList>
|
|
113
|
+
* <CommandEmpty>No results found.</CommandEmpty>
|
|
114
|
+
* <CommandGroup heading="Suggestions">
|
|
115
|
+
* <CommandItem><CalendarIcon />Calendar</CommandItem>
|
|
116
|
+
* </CommandGroup>
|
|
117
|
+
* <CommandSeparator />
|
|
118
|
+
* <CommandGroup heading="Settings">
|
|
119
|
+
* <CommandItem><UserIcon />Profile<CommandShortcut>⌘P</CommandShortcut></CommandItem>
|
|
120
|
+
* </CommandGroup>
|
|
121
|
+
* </CommandList>
|
|
122
|
+
* </Command>
|
|
123
|
+
*
|
|
124
|
+
* // ⌘K palette bound to a keyboard shortcut
|
|
125
|
+
* <CommandDialog open={open} onOpenChange={setOpen}>
|
|
126
|
+
* <CommandInput placeholder="Type a command or search…" />
|
|
127
|
+
* <CommandList>{items}</CommandList>
|
|
128
|
+
* </CommandDialog>
|
|
129
|
+
*/
|
|
130
|
+
//#endregion
|
|
131
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","names":[],"sources":["../../../src/components/ui/command.tsx"],"sourcesContent":["/**\n * Command — filterable command list.\n *\n * CommandDialog wraps it in a Dialog for a ⌘K-style modal palette. The standard\n * base for command palettes: cmdk is the filtering/keyboard-nav engine, with\n * MMDS item, group, and shortcut styling layered on top.\n */\n\nimport * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\"\nimport { InputGroup, InputGroupAddon } from \"@/components/ui/input-group\"\nimport { SearchIcon, CheckIcon } from \"lucide-react\"\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\n \"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0\",\n className\n )}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup className=\"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!\">\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n <InputGroupAddon>\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn(\"py-6 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item> & {\n /** Marks this item as the persisted \"current value\" (the checkmark this component's own CSS already shows) — cmdk owns `aria-selected` itself (reflecting only the transient keyboard-highlighted item, reasserted after any consumer props), so this mirrors into `aria-checked`/`data-checked` instead, the one pair cmdk never touches. */\n checked?: boolean\n}) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n data-checked={checked ? \"true\" : undefined}\n aria-checked={checked}\n className={cn(\n \"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n <CheckIcon className=\"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100\" />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n\n/**\n * WHEN TO USE\n * - A global command palette (⌘K / Ctrl+K) for quick navigation or running actions — use CommandDialog.\n * - An inline searchable action list embedded in a page or panel — use Command directly.\n *\n * NOT WHEN\n * - Picking a form value from a list — use Select or Combobox instead.\n * - A simple menu anchored to a trigger button with no search — use DropdownMenu instead.\n *\n * KEY RULES\n * - CommandInput filters CommandItem children automatically via cmdk — no manual filtering needed.\n * - CommandGroup takes a `heading` prop for section labels; CommandSeparator divides groups.\n * - CommandShortcut renders right-aligned key-hint text (e.g. \"⌘P\") inside a CommandItem.\n * - CommandEmpty renders only when the filtered list has zero results.\n * - CommandItem's `checked` prop shows the persisted checkmark (e.g. \"this is the current value\" in\n * a combobox-style single-select usage) and mirrors it into `aria-checked`/`data-checked` — don't\n * pass a bare `data-checked` attribute yourself, cmdk reasserts its own `aria-selected` (the\n * transient keyboard-highlight state) over any consumer prop, so `checked` is the only path that\n * actually reaches assistive tech.\n * - CommandDialog defaults `showCloseButton` to false and is controlled via `open`/`onOpenChange`, same as Dialog.\n *\n * USAGE\n * <Command className=\"w-80 rounded-xl border shadow-popover\">\n * <CommandInput placeholder=\"Type a command or search…\" />\n * <CommandList>\n * <CommandEmpty>No results found.</CommandEmpty>\n * <CommandGroup heading=\"Suggestions\">\n * <CommandItem><CalendarIcon />Calendar</CommandItem>\n * </CommandGroup>\n * <CommandSeparator />\n * <CommandGroup heading=\"Settings\">\n * <CommandItem><UserIcon />Profile<CommandShortcut>⌘P</CommandShortcut></CommandItem>\n * </CommandGroup>\n * </CommandList>\n * </Command>\n *\n * // ⌘K palette bound to a keyboard shortcut\n * <CommandDialog open={open} onOpenChange={setOpen}>\n * <CommandInput placeholder=\"Type a command or search…\" />\n * <CommandList>{items}</CommandList>\n * </CommandDialog>\n */\n"],"mappings":";;;;;;;;AAsBA,SAAS,QAAQ,EACf,WACA,GAAG,SAC6C;CAChD,OACE,oBAAC,WAAD;EACE,aAAU;EACV,WAAW,GACT,8FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,QAAQ,mBACR,cAAc,kCACd,UACA,WACA,kBAAkB,OAClB,GAAG,SAMF;CACD,OACE,qBAAC,QAAD;EAAQ,GAAI;EAAZ,UAAA,CACE,qBAAC,cAAD;GAAc,WAAU;GAAxB,UAAA,CACE,oBAAC,aAAD,EAAA,UAAc,MAAmB,CAAA,GACjC,oBAAC,mBAAD,EAAA,UAAoB,YAA+B,CAAA,CACvC;EACd,CAAA,GAAA,oBAAC,eAAD;GACE,WAAW,GACT,yDACA,SACF;GACiB;GAEhB;EACY,CAAA,CACT;;AAEZ;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAAC,OAAD;EAAK,aAAU;EAAwB,WAAU;EAC/C,UAAA,qBAAC,YAAD;GAAY,WAAU;GAAtB,UAAA,CACE,oBAAC,UAAiB,OAAlB;IACE,aAAU;IACV,WAAW,GACT,iFACA,SACF;IACA,GAAI;GACL,CAAA,GACD,oBAAC,iBAAD,EAAA,UACE,oBAAC,YAAD,EAAY,WAAU,6BAA8B,CAAA,EACrC,CAAA,CACP;;CACT,CAAA;AAET;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAAC,UAAiB,MAAlB;EACE,aAAU;EACV,WAAW,GACT,oFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAAC,UAAiB,OAAlB;EACE,aAAU;EACV,WAAW,GAAG,4BAA4B,SAAS;EACnD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAAC,UAAiB,OAAlB;EACE,aAAU;EACV,WAAW,GACT,+NACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAAC,UAAiB,WAAlB;EACE,aAAU;EACV,WAAW,GAAG,wBAAwB,SAAS;EAC/C,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,UACA,SACA,GAAG,SAIF;CACD,OACE,qBAAC,UAAiB,MAAlB;EACE,aAAU;EACV,gBAAc,UAAU,SAAS,KAAA;EACjC,gBAAc;EACd,WAAW,GACT,gaACA,SACF;EACA,GAAI;EARN,UAAA,CAUG,UACD,oBAAC,WAAD,EAAW,WAAU,kIAAmI,CAAA,CACnI;;AAE3B;AAEA,SAAS,gBAAgB,EACvB,WACA,GAAG,SAC4B;CAC/B,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,0GACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContextMenu — menu of actions opened by right-clicking (or long-pressing) a target region
|
|
3
|
+
*
|
|
4
|
+
* Shares the same item vocabulary as DropdownMenu (groups, labels,
|
|
5
|
+
* separators, submenus, checkbox/radio items) — the only difference from
|
|
6
|
+
* DropdownMenu is the trigger: a wrapped region instead of a click target.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { ContextMenu as ContextMenuPrimitive } from "radix-ui";
|
|
10
|
+
declare function ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Root>): React.JSX.Element;
|
|
11
|
+
declare function ContextMenuTrigger({ className, tabIndex, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>): React.JSX.Element;
|
|
12
|
+
declare function ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Group>): React.JSX.Element;
|
|
13
|
+
declare function ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>): React.JSX.Element;
|
|
14
|
+
declare function ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>): React.JSX.Element;
|
|
15
|
+
declare function ContextMenuRadioGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>): React.JSX.Element;
|
|
16
|
+
declare function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Content> & {
|
|
17
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
declare function ContextMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
|
20
|
+
inset?: boolean;
|
|
21
|
+
variant?: "default" | "destructive";
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
declare function ContextMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
24
|
+
inset?: boolean;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
declare function ContextMenuSubContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>): React.JSX.Element;
|
|
27
|
+
declare function ContextMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem> & {
|
|
28
|
+
inset?: boolean;
|
|
29
|
+
}): React.JSX.Element;
|
|
30
|
+
declare function ContextMenuRadioItem({ className, children, inset, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem> & {
|
|
31
|
+
inset?: boolean;
|
|
32
|
+
}): React.JSX.Element;
|
|
33
|
+
declare function ContextMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
|
|
34
|
+
inset?: boolean;
|
|
35
|
+
}): React.JSX.Element;
|
|
36
|
+
declare function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>): React.JSX.Element;
|
|
37
|
+
declare function ContextMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
38
|
+
export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup, };
|
|
39
|
+
/**
|
|
40
|
+
* WHEN TO USE
|
|
41
|
+
* - Right-click affordances on a canvas, tree, table row, or file item
|
|
42
|
+
*
|
|
43
|
+
* NOT WHEN
|
|
44
|
+
* - As the only way to reach an action — always provide a visible alternative (a button or DropdownMenu) alongside it
|
|
45
|
+
* - Touch-primary interfaces — there's no reliable right-click equivalent on touch; don't make it the sole path to an action there
|
|
46
|
+
*
|
|
47
|
+
* KEY RULES
|
|
48
|
+
* - ContextMenuTrigger wraps the exact region that should respond to right-click — size it to the target, not the whole page
|
|
49
|
+
* - ContextMenuItem accepts variant="default" | "destructive"; use "destructive" only for irreversible entries
|
|
50
|
+
* - Checkbox/radio items are controlled, same pattern as DropdownMenu — the caller owns checked/value state
|
|
51
|
+
* - Submenus use ContextMenuSub + ContextMenuSubTrigger + ContextMenuSubContent, same composition as DropdownMenu
|
|
52
|
+
*
|
|
53
|
+
* USAGE
|
|
54
|
+
* <ContextMenu>
|
|
55
|
+
* <ContextMenuTrigger className="flex h-36 w-72 items-center justify-center rounded-md border border-dashed text-sm">
|
|
56
|
+
* Right click here
|
|
57
|
+
* </ContextMenuTrigger>
|
|
58
|
+
* <ContextMenuContent className="w-52">
|
|
59
|
+
* <ContextMenuItem>Back<ContextMenuShortcut>⌘[</ContextMenuShortcut></ContextMenuItem>
|
|
60
|
+
* <ContextMenuSeparator />
|
|
61
|
+
* <ContextMenuItem variant="destructive">Delete</ContextMenuItem>
|
|
62
|
+
* </ContextMenuContent>
|
|
63
|
+
* </ContextMenu>
|
|
64
|
+
*
|
|
65
|
+
* <ContextMenuRadioGroup value={pane} onValueChange={setPane}>
|
|
66
|
+
* <ContextMenuRadioItem value="left">Left pane</ContextMenuRadioItem>
|
|
67
|
+
* <ContextMenuRadioItem value="right">Right pane</ContextMenuRadioItem>
|
|
68
|
+
* </ContextMenuRadioGroup>
|
|
69
|
+
*/
|
|
70
|
+
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/context-menu.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAM9D,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,qBAExD;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,qBAoB3D;AAED,iBAAS,gBAAgB,CAAC,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