@craftzbay/ui 0.11.3 → 1.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.
Files changed (166) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/_virtual/_rolldown/runtime.js +11 -0
  3. package/dist-lib/components/ui/Accordion.js +42 -67
  4. package/dist-lib/components/ui/Accordion.js.map +1 -1
  5. package/dist-lib/components/ui/Alert.js +71 -77
  6. package/dist-lib/components/ui/Alert.js.map +1 -1
  7. package/dist-lib/components/ui/Avatar.js +67 -92
  8. package/dist-lib/components/ui/Avatar.js.map +1 -1
  9. package/dist-lib/components/ui/Badge.js +119 -74
  10. package/dist-lib/components/ui/Badge.js.map +1 -1
  11. package/dist-lib/components/ui/Breadcrumbs.js +62 -50
  12. package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
  13. package/dist-lib/components/ui/Button.js +129 -131
  14. package/dist-lib/components/ui/Button.js.map +1 -1
  15. package/dist-lib/components/ui/Calendar.d.ts +1 -1
  16. package/dist-lib/components/ui/Calendar.js +99 -136
  17. package/dist-lib/components/ui/Calendar.js.map +1 -1
  18. package/dist-lib/components/ui/Card.js +88 -94
  19. package/dist-lib/components/ui/Card.js.map +1 -1
  20. package/dist-lib/components/ui/Carousel.js +125 -170
  21. package/dist-lib/components/ui/Carousel.js.map +1 -1
  22. package/dist-lib/components/ui/Chart.d.ts +3 -3
  23. package/dist-lib/components/ui/Chart.js +435 -464
  24. package/dist-lib/components/ui/Chart.js.map +1 -1
  25. package/dist-lib/components/ui/Checkbox.js +60 -69
  26. package/dist-lib/components/ui/Checkbox.js.map +1 -1
  27. package/dist-lib/components/ui/Combobox.js +179 -192
  28. package/dist-lib/components/ui/Combobox.js.map +1 -1
  29. package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
  30. package/dist-lib/components/ui/CommandPalette.js +106 -167
  31. package/dist-lib/components/ui/CommandPalette.js.map +1 -1
  32. package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
  33. package/dist-lib/components/ui/ContextMenu.js +89 -154
  34. package/dist-lib/components/ui/ContextMenu.js.map +1 -1
  35. package/dist-lib/components/ui/DataGrid.d.ts +1 -1
  36. package/dist-lib/components/ui/DataGrid.js +99 -96
  37. package/dist-lib/components/ui/DataGrid.js.map +1 -1
  38. package/dist-lib/components/ui/DatePicker.js +151 -188
  39. package/dist-lib/components/ui/DatePicker.js.map +1 -1
  40. package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
  41. package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
  42. package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
  43. package/dist-lib/components/ui/Dialog.d.ts +3 -3
  44. package/dist-lib/components/ui/Dialog.js +108 -156
  45. package/dist-lib/components/ui/Dialog.js.map +1 -1
  46. package/dist-lib/components/ui/Drawer.d.ts +3 -3
  47. package/dist-lib/components/ui/Drawer.js +90 -124
  48. package/dist-lib/components/ui/Drawer.js.map +1 -1
  49. package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
  50. package/dist-lib/components/ui/DropdownMenu.js +92 -158
  51. package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
  52. package/dist-lib/components/ui/EmptyState.js +31 -44
  53. package/dist-lib/components/ui/EmptyState.js.map +1 -1
  54. package/dist-lib/components/ui/ErrorState.js +57 -67
  55. package/dist-lib/components/ui/ErrorState.js.map +1 -1
  56. package/dist-lib/components/ui/FileUpload.js +113 -107
  57. package/dist-lib/components/ui/FileUpload.js.map +1 -1
  58. package/dist-lib/components/ui/Form.d.ts +6 -4
  59. package/dist-lib/components/ui/Form.js +117 -122
  60. package/dist-lib/components/ui/Form.js.map +1 -1
  61. package/dist-lib/components/ui/Icon.d.ts +1 -1
  62. package/dist-lib/components/ui/Icon.js +30 -29
  63. package/dist-lib/components/ui/Icon.js.map +1 -1
  64. package/dist-lib/components/ui/IconButton.js +61 -63
  65. package/dist-lib/components/ui/IconButton.js.map +1 -1
  66. package/dist-lib/components/ui/Input.js +133 -156
  67. package/dist-lib/components/ui/Input.js.map +1 -1
  68. package/dist-lib/components/ui/Kbd.js +14 -21
  69. package/dist-lib/components/ui/Kbd.js.map +1 -1
  70. package/dist-lib/components/ui/MultiSelect.js +176 -208
  71. package/dist-lib/components/ui/MultiSelect.js.map +1 -1
  72. package/dist-lib/components/ui/Pagination.js +152 -149
  73. package/dist-lib/components/ui/Pagination.js.map +1 -1
  74. package/dist-lib/components/ui/Popover.js +18 -33
  75. package/dist-lib/components/ui/Popover.js.map +1 -1
  76. package/dist-lib/components/ui/Progress.js +77 -99
  77. package/dist-lib/components/ui/Progress.js.map +1 -1
  78. package/dist-lib/components/ui/RadioGroup.js +51 -80
  79. package/dist-lib/components/ui/RadioGroup.js.map +1 -1
  80. package/dist-lib/components/ui/RelativeTime.js +22 -29
  81. package/dist-lib/components/ui/RelativeTime.js.map +1 -1
  82. package/dist-lib/components/ui/ScrollArea.js +39 -58
  83. package/dist-lib/components/ui/ScrollArea.js.map +1 -1
  84. package/dist-lib/components/ui/Select.js +108 -131
  85. package/dist-lib/components/ui/Select.js.map +1 -1
  86. package/dist-lib/components/ui/Separator.js +18 -24
  87. package/dist-lib/components/ui/Separator.js.map +1 -1
  88. package/dist-lib/components/ui/Sheet.d.ts +2 -2
  89. package/dist-lib/components/ui/Sheet.js +77 -129
  90. package/dist-lib/components/ui/Sheet.js.map +1 -1
  91. package/dist-lib/components/ui/Sidebar.d.ts +1 -1
  92. package/dist-lib/components/ui/Sidebar.js +168 -207
  93. package/dist-lib/components/ui/Sidebar.js.map +1 -1
  94. package/dist-lib/components/ui/Skeleton.js +17 -27
  95. package/dist-lib/components/ui/Skeleton.js.map +1 -1
  96. package/dist-lib/components/ui/Slider.js +45 -62
  97. package/dist-lib/components/ui/Slider.js.map +1 -1
  98. package/dist-lib/components/ui/Snackbar.js +75 -55
  99. package/dist-lib/components/ui/Snackbar.js.map +1 -1
  100. package/dist-lib/components/ui/Spinner.js +45 -52
  101. package/dist-lib/components/ui/Spinner.js.map +1 -1
  102. package/dist-lib/components/ui/Stepper.js +56 -108
  103. package/dist-lib/components/ui/Stepper.js.map +1 -1
  104. package/dist-lib/components/ui/Switch.js +46 -79
  105. package/dist-lib/components/ui/Switch.js.map +1 -1
  106. package/dist-lib/components/ui/Table.js +108 -169
  107. package/dist-lib/components/ui/Table.js.map +1 -1
  108. package/dist-lib/components/ui/Tabs.js +57 -88
  109. package/dist-lib/components/ui/Tabs.js.map +1 -1
  110. package/dist-lib/components/ui/TagInput.js +76 -109
  111. package/dist-lib/components/ui/TagInput.js.map +1 -1
  112. package/dist-lib/components/ui/Textarea.js +74 -86
  113. package/dist-lib/components/ui/Textarea.js.map +1 -1
  114. package/dist-lib/components/ui/Timeline.d.ts +3 -3
  115. package/dist-lib/components/ui/Timeline.js +61 -49
  116. package/dist-lib/components/ui/Timeline.js.map +1 -1
  117. package/dist-lib/components/ui/Toast.d.ts +1 -1
  118. package/dist-lib/components/ui/Toast.js +136 -150
  119. package/dist-lib/components/ui/Toast.js.map +1 -1
  120. package/dist-lib/components/ui/Tooltip.d.ts +2 -2
  121. package/dist-lib/components/ui/Tooltip.js +35 -56
  122. package/dist-lib/components/ui/Tooltip.js.map +1 -1
  123. package/dist-lib/components/ui/TopNav.js +46 -66
  124. package/dist-lib/components/ui/TopNav.js.map +1 -1
  125. package/dist-lib/components/ui/Tree.js +134 -168
  126. package/dist-lib/components/ui/Tree.js.map +1 -1
  127. package/dist-lib/hooks/use-debounce.js +24 -33
  128. package/dist-lib/hooks/use-debounce.js.map +1 -1
  129. package/dist-lib/hooks/use-delayed-loading.js +20 -18
  130. package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
  131. package/dist-lib/hooks/use-field-ids.js +14 -16
  132. package/dist-lib/hooks/use-field-ids.js.map +1 -1
  133. package/dist-lib/hooks/use-media-query.js +15 -19
  134. package/dist-lib/hooks/use-media-query.js.map +1 -1
  135. package/dist-lib/hooks/use-modifier-key.d.ts +0 -4
  136. package/dist-lib/hooks/use-modifier-key.js +19 -16
  137. package/dist-lib/hooks/use-modifier-key.js.map +1 -1
  138. package/dist-lib/hooks/use-strings.js +10 -10
  139. package/dist-lib/hooks/use-strings.js.map +1 -1
  140. package/dist-lib/hooks/use-toast.js +73 -62
  141. package/dist-lib/hooks/use-toast.js.map +1 -1
  142. package/dist-lib/icon.js +2 -6
  143. package/dist-lib/icons/index.d.ts +1 -1
  144. package/dist-lib/icons/index.js +166 -163
  145. package/dist-lib/icons/index.js.map +1 -1
  146. package/dist-lib/illustrations/index.d.ts +7 -7
  147. package/dist-lib/illustrations/index.js +255 -106
  148. package/dist-lib/illustrations/index.js.map +1 -1
  149. package/dist-lib/index.js +69 -291
  150. package/dist-lib/lib/cva.js +2 -0
  151. package/dist-lib/lib/format.js +71 -87
  152. package/dist-lib/lib/format.js.map +1 -1
  153. package/dist-lib/lib/return-focus.js +11 -11
  154. package/dist-lib/lib/return-focus.js.map +1 -1
  155. package/dist-lib/lib/strings.js +167 -135
  156. package/dist-lib/lib/strings.js.map +1 -1
  157. package/dist-lib/lib/strings.mn.js +150 -113
  158. package/dist-lib/lib/strings.mn.js.map +1 -1
  159. package/dist-lib/lib/utils.js +9 -9
  160. package/dist-lib/lib/utils.js.map +1 -1
  161. package/dist-lib/styles.css +3 -1
  162. package/package.json +53 -53
  163. package/dist-lib/__tests__/helpers/color.d.ts +0 -9
  164. package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
  165. package/dist-lib/icon.js.map +0 -1
  166. package/dist-lib/index.js.map +0 -1
@@ -1,210 +1,178 @@
1
1
  "use client";
2
- import { jsxs as n, jsx as t } from "react/jsx-runtime";
3
- import { forwardRef as Y, useState as N, useRef as O, useCallback as k, useMemo as P } from "react";
4
- import * as g from "@radix-ui/react-popover";
5
- import { Command as b } from "cmdk";
6
- import { X as j, ChevronsUpDown as Z, Check as _ } from "../../icons/index.js";
7
- import { cn as a } from "../../lib/utils.js";
8
- import { useStrings as ee } from "../../hooks/use-strings.js";
9
- import { formatString as te } from "../../lib/strings.js";
10
- import { useFieldIds as re } from "../../hooks/use-field-ids.js";
11
- const oe = Y(function({
12
- options: l,
13
- value: r,
14
- onChange: s,
15
- label: d,
16
- helperText: h,
17
- error: x,
18
- placeholder: B,
19
- emptyText: L,
20
- maxVisibleChips: M = 3,
21
- clearable: E = !0,
22
- disabled: c,
23
- id: S,
24
- className: K
25
- }, U) {
26
- const i = ee(), z = B ?? i.multiSelect.placeholder, $ = L ?? i.multiSelect.empty, v = !!x, { fieldId: u, helperId: q, errorId: H, describedBy: Q } = re(S, {
27
- hasHelper: !!h,
28
- hasError: v
29
- }), [f, m] = N(!1), [p, X] = N(""), C = O(null), I = O(null), [G, J] = N(void 0), T = k((e) => J(e == null ? void 0 : e.id), []), w = P(() => l.filter((e) => r.includes(e.value)), [l, r]), D = k(
30
- (e) => {
31
- r.includes(e) ? s(r.filter((o) => o !== e)) : s([...r, e]);
32
- },
33
- [r, s]
34
- ), V = k(() => s([]), [s]), W = (e) => {
35
- e.key === "Backspace" && p === "" && r.length > 0 ? s(r.slice(0, -1)) : (e.key === "ArrowDown" || e.key === "ArrowUp") && !f && m(!0);
36
- }, R = P(
37
- () => l.filter((e) => e.label.toLowerCase().includes(p.toLowerCase())),
38
- [l, p]
39
- ), y = w.slice(0, M), A = w.length - y.length;
40
- return /* @__PURE__ */ n("div", { ref: U, className: a("flex flex-col gap-1.5", K), children: [
41
- d && /* @__PURE__ */ t(
42
- "label",
43
- {
44
- id: `${u}-label`,
45
- htmlFor: u,
46
- className: "text-foreground text-sm font-medium",
47
- children: d
48
- }
49
- ),
50
- /* @__PURE__ */ t(b, { shouldFilter: !1, className: "flex w-full flex-col", children: /* @__PURE__ */ n(g.Root, { open: f, onOpenChange: m, children: [
51
- /* @__PURE__ */ t(g.Anchor, { asChild: !0, children: /* @__PURE__ */ n(
52
- "div",
53
- {
54
- ref: I,
55
- "aria-disabled": c || void 0,
56
- className: a(
57
- "bg-card flex h-9 w-full cursor-text items-center gap-1.5 overflow-hidden rounded-md border px-2 py-1 text-sm",
58
- "transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]",
59
- "focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2",
60
- v ? "border-danger focus-within:border-danger focus-within:ring-danger" : "border-border-input focus-within:border-accent focus-within:ring-ring",
61
- c && "pointer-events-none opacity-50"
62
- ),
63
- onClick: () => {
64
- var e;
65
- (e = C.current) == null || e.focus(), c || m(!0);
66
- },
67
- children: [
68
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden", children: [
69
- y.map((e) => /* @__PURE__ */ n(
70
- "span",
71
- {
72
- className: "bg-accent-soft text-on-accent-soft inline-flex max-w-[10rem] shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-xs font-medium",
73
- children: [
74
- /* @__PURE__ */ t("span", { className: "truncate", title: e.label, children: e.label }),
75
- /* @__PURE__ */ t(
76
- "button",
77
- {
78
- type: "button",
79
- "aria-label": te(i.multiSelect.remove, { label: e.label }),
80
- className: "text-on-accent-soft hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative inline-flex items-center rounded-sm outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1",
81
- onClick: (o) => {
82
- o.stopPropagation(), D(e.value);
83
- },
84
- children: /* @__PURE__ */ t(j, { className: "size-3", "aria-hidden": !0 })
85
- }
86
- )
87
- ]
88
- },
89
- e.value
90
- )),
91
- A > 0 && /* @__PURE__ */ n("span", { className: "bg-background-muted text-foreground-muted shrink-0 rounded-md px-1.5 py-0.5 text-xs font-medium", children: [
92
- "+",
93
- A
94
- ] }),
95
- /* @__PURE__ */ t(
96
- "input",
97
- {
98
- ref: C,
99
- id: u,
100
- type: "text",
101
- autoComplete: "off",
102
- value: p,
103
- onChange: (e) => X(e.target.value),
104
- onFocus: () => m(!0),
105
- onKeyDown: W,
106
- placeholder: y.length === 0 ? z : void 0,
107
- role: "combobox",
108
- "aria-expanded": f,
109
- "aria-controls": f ? G : void 0,
110
- "aria-haspopup": "listbox",
111
- "aria-autocomplete": "list",
112
- "aria-labelledby": d ? `${u}-label` : void 0,
113
- "aria-label": d || S ? void 0 : z,
114
- "aria-invalid": v || void 0,
115
- "aria-describedby": Q,
116
- className: "placeholder:text-foreground-subtle min-w-[6ch] flex-1 bg-transparent text-lg outline-none md:text-sm",
117
- disabled: c
118
- }
119
- )
120
- ] }),
121
- /* @__PURE__ */ n("span", { className: "flex shrink-0 items-center gap-1 pl-1", children: [
122
- E && w.length > 0 && /* @__PURE__ */ t(
123
- "button",
124
- {
125
- type: "button",
126
- "aria-label": i.multiSelect.clearAll,
127
- onClick: (e) => {
128
- e.stopPropagation(), V();
129
- },
130
- className: "text-foreground-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background inline-flex size-6 shrink-0 items-center justify-center rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
131
- children: /* @__PURE__ */ t(j, { className: "size-4", "aria-hidden": !0 })
132
- }
133
- ),
134
- /* @__PURE__ */ t(Z, { className: "text-foreground-subtle size-4", "aria-hidden": !0 })
135
- ] })
136
- ]
137
- }
138
- ) }),
139
- /* @__PURE__ */ t(g.Portal, { children: /* @__PURE__ */ t(
140
- g.Content,
141
- {
142
- align: "start",
143
- sideOffset: 4,
144
- "aria-label": i.command.suggestions,
145
- className: a(
146
- "border-border bg-popover text-popover-foreground z-[var(--z-popover)] w-[var(--radix-popover-trigger-width)] overflow-hidden rounded-lg border shadow-md",
147
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
148
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
149
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"
150
- ),
151
- onOpenAutoFocus: (e) => e.preventDefault(),
152
- onInteractOutside: (e) => {
153
- var F;
154
- const o = e.target;
155
- o && ((F = I.current) != null && F.contains(o)) && e.preventDefault();
156
- },
157
- children: /* @__PURE__ */ n(
158
- b.List,
159
- {
160
- ref: T,
161
- label: i.command.suggestions,
162
- className: "max-h-64 overflow-y-auto p-1",
163
- children: [
164
- R.map((e) => {
165
- const o = r.includes(e.value);
166
- return /* @__PURE__ */ n(
167
- b.Item,
168
- {
169
- value: e.value,
170
- disabled: e.disabled,
171
- onSelect: () => D(e.value),
172
- className: a(
173
- "text-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm",
174
- "data-[selected=true]:bg-background-muted",
175
- "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50"
176
- ),
177
- children: [
178
- /* @__PURE__ */ t(
179
- "span",
180
- {
181
- "aria-hidden": !0,
182
- className: a(
183
- "flex size-4 items-center justify-center rounded-sm border",
184
- o ? "border-accent bg-accent text-on-accent" : "border-border-input"
185
- ),
186
- children: o && /* @__PURE__ */ t(_, { className: "size-3", "aria-hidden": !0 })
187
- }
188
- ),
189
- /* @__PURE__ */ t("span", { className: "flex-1", children: e.label }),
190
- e.description && /* @__PURE__ */ t("span", { className: "text-foreground-subtle text-xs", children: e.description })
191
- ]
192
- },
193
- e.value
194
- );
195
- }),
196
- R.length === 0 && /* @__PURE__ */ t(b.Empty, { className: "text-foreground-subtle px-2 py-6 text-center text-sm", children: $ })
197
- ]
198
- }
199
- )
200
- }
201
- ) })
202
- ] }) }),
203
- x ? /* @__PURE__ */ t("p", { id: H, className: "text-danger-text text-xs", children: x }) : h ? /* @__PURE__ */ t("p", { id: q, className: "text-foreground-subtle text-xs", children: h }) : null
204
- ] });
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { formatString as t } from "../../lib/strings.js";
4
+ import { useFieldIds as n } from "../../hooks/use-field-ids.js";
5
+ import { useStrings as r } from "../../hooks/use-strings.js";
6
+ import { Check as i, ChevronsUpDown as a, X as o } from "../../icons/index.js";
7
+ import { forwardRef as s, useCallback as c, useMemo as l, useRef as u, useState as d } from "react";
8
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
+ import * as m from "@radix-ui/react-popover";
10
+ import { Command as h } from "cmdk";
11
+ //#region src/components/ui/MultiSelect.tsx
12
+ var g = s(function({ options: s, value: g, onChange: _, label: v, helperText: y, error: b, placeholder: x, emptyText: S, maxVisibleChips: C = 3, clearable: w = !0, disabled: T, id: E, className: D }, O) {
13
+ let k = r(), A = x ?? k.multiSelect.placeholder, j = S ?? k.multiSelect.empty, M = !!b, { fieldId: N, helperId: P, errorId: F, describedBy: I } = n(E, {
14
+ hasHelper: !!y,
15
+ hasError: M
16
+ }), [L, R] = d(!1), [z, B] = d(""), V = u(null), H = u(null), [U, W] = d(void 0), G = c((e) => W(e?.id), []), K = l(() => s.filter((e) => g.includes(e.value)), [s, g]), q = c((e) => {
17
+ g.includes(e) ? _(g.filter((t) => t !== e)) : _([...g, e]);
18
+ }, [g, _]), J = c(() => _([]), [_]), Y = (e) => {
19
+ e.key === "Backspace" && z === "" && g.length > 0 ? _(g.slice(0, -1)) : (e.key === "ArrowDown" || e.key === "ArrowUp") && !L && R(!0);
20
+ }, X = l(() => s.filter((e) => e.label.toLowerCase().includes(z.toLowerCase())), [s, z]), Z = K.slice(0, C), Q = K.length - Z.length;
21
+ return /* @__PURE__ */ p("div", {
22
+ ref: O,
23
+ className: e("flex flex-col gap-1.5", D),
24
+ children: [
25
+ v && /* @__PURE__ */ f("label", {
26
+ id: `${N}-label`,
27
+ htmlFor: N,
28
+ className: "text-foreground text-sm font-medium",
29
+ children: v
30
+ }),
31
+ /* @__PURE__ */ f(h, {
32
+ shouldFilter: !1,
33
+ className: "flex w-full flex-col",
34
+ children: /* @__PURE__ */ p(m.Root, {
35
+ open: L,
36
+ onOpenChange: R,
37
+ children: [/* @__PURE__ */ f(m.Anchor, {
38
+ asChild: !0,
39
+ children: /* @__PURE__ */ p("div", {
40
+ ref: H,
41
+ "aria-disabled": T || void 0,
42
+ className: e("bg-card flex h-9 w-full cursor-text items-center gap-1.5 overflow-hidden rounded-md border px-2 py-1 text-sm", "transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]", "focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2", M ? "border-danger focus-within:border-danger focus-within:ring-danger" : "border-border-input focus-within:border-accent focus-within:ring-ring", T && "pointer-events-none opacity-50"),
43
+ onClick: () => {
44
+ V.current?.focus(), T || R(!0);
45
+ },
46
+ children: [/* @__PURE__ */ p("div", {
47
+ className: "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",
48
+ children: [
49
+ Z.map((e) => /* @__PURE__ */ p("span", {
50
+ className: "bg-accent-soft text-on-accent-soft inline-flex max-w-[10rem] shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-xs font-medium",
51
+ children: [/* @__PURE__ */ f("span", {
52
+ className: "truncate",
53
+ title: e.label,
54
+ children: e.label
55
+ }), /* @__PURE__ */ f("button", {
56
+ type: "button",
57
+ "aria-label": t(k.multiSelect.remove, { label: e.label }),
58
+ className: "text-on-accent-soft hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative inline-flex items-center rounded-sm outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1",
59
+ onClick: (t) => {
60
+ t.stopPropagation(), q(e.value);
61
+ },
62
+ children: /* @__PURE__ */ f(o, {
63
+ className: "size-3",
64
+ "aria-hidden": !0
65
+ })
66
+ })]
67
+ }, e.value)),
68
+ Q > 0 && /* @__PURE__ */ p("span", {
69
+ className: "bg-background-muted text-foreground-muted shrink-0 rounded-md px-1.5 py-0.5 text-xs font-medium",
70
+ children: ["+", Q]
71
+ }),
72
+ /* @__PURE__ */ f("input", {
73
+ ref: V,
74
+ id: N,
75
+ type: "text",
76
+ autoComplete: "off",
77
+ value: z,
78
+ onChange: (e) => B(e.target.value),
79
+ onFocus: () => R(!0),
80
+ onKeyDown: Y,
81
+ placeholder: Z.length === 0 ? A : void 0,
82
+ role: "combobox",
83
+ "aria-expanded": L,
84
+ "aria-controls": L ? U : void 0,
85
+ "aria-haspopup": "listbox",
86
+ "aria-autocomplete": "list",
87
+ "aria-labelledby": v ? `${N}-label` : void 0,
88
+ "aria-label": v || E ? void 0 : A,
89
+ "aria-invalid": M || void 0,
90
+ "aria-describedby": I,
91
+ className: "placeholder:text-foreground-subtle min-w-[6ch] flex-1 bg-transparent text-lg outline-none md:text-sm",
92
+ disabled: T
93
+ })
94
+ ]
95
+ }), /* @__PURE__ */ p("span", {
96
+ className: "flex shrink-0 items-center gap-1 pl-1",
97
+ children: [w && K.length > 0 && /* @__PURE__ */ f("button", {
98
+ type: "button",
99
+ "aria-label": k.multiSelect.clearAll,
100
+ onClick: (e) => {
101
+ e.stopPropagation(), J();
102
+ },
103
+ className: "text-foreground-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background inline-flex size-6 shrink-0 items-center justify-center rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
104
+ children: /* @__PURE__ */ f(o, {
105
+ className: "size-4",
106
+ "aria-hidden": !0
107
+ })
108
+ }), /* @__PURE__ */ f(a, {
109
+ className: "text-foreground-subtle size-4",
110
+ "aria-hidden": !0
111
+ })]
112
+ })]
113
+ })
114
+ }), /* @__PURE__ */ f(m.Portal, { children: /* @__PURE__ */ f(m.Content, {
115
+ align: "start",
116
+ sideOffset: 4,
117
+ "aria-label": k.command.suggestions,
118
+ className: e("border-border bg-popover text-popover-foreground z-[var(--z-popover)] w-[var(--radix-popover-trigger-width)] overflow-hidden rounded-lg border shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),
119
+ onOpenAutoFocus: (e) => e.preventDefault(),
120
+ onInteractOutside: (e) => {
121
+ let t = e.target;
122
+ t && H.current?.contains(t) && e.preventDefault();
123
+ },
124
+ children: /* @__PURE__ */ p(h.List, {
125
+ ref: G,
126
+ label: k.command.suggestions,
127
+ className: "max-h-64 overflow-y-auto p-1",
128
+ children: [X.map((t) => {
129
+ let n = g.includes(t.value);
130
+ return /* @__PURE__ */ p(h.Item, {
131
+ value: t.value,
132
+ disabled: t.disabled,
133
+ onSelect: () => q(t.value),
134
+ className: e("text-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm", "data-[selected=true]:bg-background-muted", "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50"),
135
+ children: [
136
+ /* @__PURE__ */ f("span", {
137
+ "aria-hidden": !0,
138
+ className: e("flex size-4 items-center justify-center rounded-sm border", n ? "border-accent bg-accent text-on-accent" : "border-border-input"),
139
+ children: n && /* @__PURE__ */ f(i, {
140
+ className: "size-3",
141
+ "aria-hidden": !0
142
+ })
143
+ }),
144
+ /* @__PURE__ */ f("span", {
145
+ className: "flex-1",
146
+ children: t.label
147
+ }),
148
+ t.description && /* @__PURE__ */ f("span", {
149
+ className: "text-foreground-subtle text-xs",
150
+ children: t.description
151
+ })
152
+ ]
153
+ }, t.value);
154
+ }), X.length === 0 && /* @__PURE__ */ f(h.Empty, {
155
+ className: "text-foreground-subtle px-2 py-6 text-center text-sm",
156
+ children: j
157
+ })]
158
+ })
159
+ }) })]
160
+ })
161
+ }),
162
+ b ? /* @__PURE__ */ f("p", {
163
+ id: F,
164
+ className: "text-danger-text text-xs",
165
+ children: b
166
+ }) : y ? /* @__PURE__ */ f("p", {
167
+ id: P,
168
+ className: "text-foreground-subtle text-xs",
169
+ children: y
170
+ }) : null
171
+ ]
172
+ });
205
173
  });
206
- oe.displayName = "MultiSelect";
207
- export {
208
- oe as MultiSelect
209
- };
210
- //# sourceMappingURL=MultiSelect.js.map
174
+ g.displayName = "MultiSelect";
175
+ //#endregion
176
+ export { g as MultiSelect };
177
+
178
+ //# sourceMappingURL=MultiSelect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.js","sources":["../../../src/components/ui/MultiSelect.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { Check, ChevronsUpDown, X } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { formatString } from '@/lib/strings';\nimport { useFieldIds } from '@/hooks/use-field-ids';\n\nexport interface MultiSelectOption {\n /** Stable, unique value submitted in `onChange`. */\n value: string;\n /** Visible label shown both in the menu and in the selected chip. */\n label: string;\n /** Optional secondary text shown after the label in the menu. */\n description?: string;\n /** Disable selecting this option. */\n disabled?: boolean;\n}\n\nexport interface MultiSelectProps {\n /** All possible options. */\n options: MultiSelectOption[];\n /** Currently selected values. Controlled. */\n value: string[];\n /** Called whenever the selection changes. */\n onChange: (next: string[]) => void;\n /** Visible label above the field. */\n label?: ReactNode;\n /** Hint below the field. Hidden when `error` is set. */\n helperText?: ReactNode;\n /** Validation message. */\n error?: ReactNode;\n /** Empty-state placeholder shown when nothing is selected. */\n placeholder?: string;\n /** Text shown when no options match the search. */\n emptyText?: string;\n /** Max number of chips rendered inline; remainder shown as \"+N more\". */\n maxVisibleChips?: number;\n /** Whether the user can clear all selections with a single click. */\n clearable?: boolean;\n /** Disable the entire field. */\n disabled?: boolean;\n /** Consumer-supplied id for the search input (label association). */\n id?: string;\n className?: string;\n}\n\n/**\n * Chip-based multi-select with a searchable menu (cmdk under the hood).\n *\n * Keyboard:\n * - Backspace on the input with empty query removes the last chip\n * - ArrowUp / ArrowDown move the highlight, Enter toggles the highlighted option\n * - Escape closes the menu\n *\n * @example Tag picker\n * <MultiSelect label=\"Tags\"\n * options={tags}\n * value={selected}\n * onChange={setSelected}\n * placeholder=\"Pick tags\" />\n *\n * @example Bounded with overflow chip\n * <MultiSelect options={users}\n * value={value}\n * onChange={setValue}\n * maxVisibleChips={3} />\n *\n * @do Cap `maxVisibleChips` (3–5) on narrow surfaces so the field doesn't\n * reflow as the user adds selections.\n * @dont Use MultiSelect for fewer than ~6 options. CheckboxGroup is clearer.\n */\nexport const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function MultiSelect(\n {\n options,\n value,\n onChange,\n label,\n helperText,\n error,\n placeholder: placeholderProp,\n emptyText: emptyTextProp,\n maxVisibleChips = 3,\n clearable = true,\n disabled,\n id,\n className,\n },\n ref,\n) {\n const strings = useStrings();\n const placeholder = placeholderProp ?? strings.multiSelect.placeholder;\n const emptyText = emptyTextProp ?? strings.multiSelect.empty;\n const isError = Boolean(error);\n const { fieldId, helperId, errorId, describedBy } = useFieldIds(id, {\n hasHelper: Boolean(helperText),\n hasError: isError,\n });\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const inputRef = useRef<HTMLInputElement>(null);\n const fieldRef = useRef<HTMLDivElement>(null);\n // cmdk assigns its own id to the list (ours is ignored), so read it back\n // from the node once the portal mounts to keep aria-controls truthful.\n const [listId, setListId] = useState<string | undefined>(undefined);\n const listRef = useCallback((el: HTMLDivElement | null) => setListId(el?.id), []);\n\n const selected = useMemo(() => options.filter((o) => value.includes(o.value)), [options, value]);\n\n const toggle = useCallback(\n (v: string) => {\n if (value.includes(v)) onChange(value.filter((x) => x !== v));\n else onChange([...value, v]);\n },\n [value, onChange],\n );\n\n const clear = useCallback(() => onChange([]), [onChange]);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Backspace' && query === '' && value.length > 0) {\n onChange(value.slice(0, -1));\n } else if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && !open) {\n setOpen(true);\n }\n };\n\n const filtered = useMemo(\n () => options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase())),\n [options, query],\n );\n\n const visibleChips = selected.slice(0, maxVisibleChips);\n const overflow = selected.length - visibleChips.length;\n\n return (\n <div ref={ref} className={cn('flex flex-col gap-1.5', className)}>\n {label && (\n <label\n id={`${fieldId}-label`}\n htmlFor={fieldId}\n className=\"text-foreground text-sm font-medium\"\n >\n {label}\n </label>\n )}\n\n {/* The Command root wraps the whole field so cmdk's root keydown handler\n (ArrowUp/Down/Enter) sees the input even though the list is portaled.\n A plain <input> is used instead of Command.Input because cmdk forces\n its own id / aria-* on that element, breaking the label association. */}\n <CommandPrimitive shouldFilter={false} className=\"flex w-full flex-col\">\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Anchor asChild>\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -- click-to-focus wrapper; the <input role=\"combobox\"> inside owns keyboard handling */}\n <div\n ref={fieldRef}\n aria-disabled={disabled || undefined}\n className={cn(\n 'bg-card flex h-9 w-full cursor-text items-center gap-1.5 overflow-hidden rounded-md border px-2 py-1 text-sm',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2',\n isError\n ? 'border-danger focus-within:border-danger focus-within:ring-danger'\n : 'border-border-input focus-within:border-accent focus-within:ring-ring',\n disabled && 'pointer-events-none opacity-50',\n )}\n onClick={() => {\n inputRef.current?.focus();\n if (!disabled) setOpen(true);\n }}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden\">\n {visibleChips.map((opt) => (\n <span\n key={opt.value}\n className=\"bg-accent-soft text-on-accent-soft inline-flex max-w-[10rem] shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-xs font-medium\"\n >\n <span className=\"truncate\" title={opt.label}>\n {opt.label}\n </span>\n <button\n type=\"button\"\n aria-label={formatString(strings.multiSelect.remove, { label: opt.label })}\n className=\"text-on-accent-soft hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative inline-flex items-center rounded-sm outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1\"\n onClick={(e) => {\n e.stopPropagation();\n toggle(opt.value);\n }}\n >\n <X className=\"size-3\" aria-hidden />\n </button>\n </span>\n ))}\n {overflow > 0 && (\n <span className=\"bg-background-muted text-foreground-muted shrink-0 rounded-md px-1.5 py-0.5 text-xs font-medium\">\n +{overflow}\n </span>\n )}\n <input\n ref={inputRef}\n id={fieldId}\n type=\"text\"\n autoComplete=\"off\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n onFocus={() => setOpen(true)}\n onKeyDown={handleKeyDown}\n placeholder={visibleChips.length === 0 ? placeholder : undefined}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n // Unlabelled field: name the input after the placeholder. A\n // consumer `id` implies an external <label htmlFor>.\n aria-labelledby={label ? `${fieldId}-label` : undefined}\n aria-label={label || id ? undefined : placeholder}\n aria-invalid={isError || undefined}\n aria-describedby={describedBy}\n className=\"placeholder:text-foreground-subtle min-w-[6ch] flex-1 bg-transparent text-lg outline-none md:text-sm\"\n disabled={disabled}\n />\n </div>\n <span className=\"flex shrink-0 items-center gap-1 pl-1\">\n {clearable && selected.length > 0 && (\n <button\n type=\"button\"\n aria-label={strings.multiSelect.clearAll}\n onClick={(e) => {\n e.stopPropagation();\n clear();\n }}\n className=\"text-foreground-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background inline-flex size-6 shrink-0 items-center justify-center rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-2\"\n >\n <X className=\"size-4\" aria-hidden />\n </button>\n )}\n <ChevronsUpDown className=\"text-foreground-subtle size-4\" aria-hidden />\n </span>\n </div>\n </PopoverPrimitive.Anchor>\n\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={4}\n // Radix gives the content role=\"dialog\"; a dialog needs a name.\n aria-label={strings.command.suggestions}\n className={cn(\n 'border-border bg-popover text-popover-foreground z-[var(--z-popover)] w-[var(--radix-popover-trigger-width)] overflow-hidden rounded-lg border shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n )}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onInteractOutside={(e) => {\n // Clicks inside the anchor (chips, clear) must not close the menu.\n const target = e.target as Node | null;\n if (target && fieldRef.current?.contains(target)) e.preventDefault();\n }}\n >\n <CommandPrimitive.List\n ref={listRef}\n label={strings.command.suggestions}\n className=\"max-h-64 overflow-y-auto p-1\"\n >\n {filtered.map((opt) => {\n const isSelected = value.includes(opt.value);\n return (\n <CommandPrimitive.Item\n key={opt.value}\n value={opt.value}\n disabled={opt.disabled}\n onSelect={() => toggle(opt.value)}\n className={cn(\n 'text-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm',\n 'data-[selected=true]:bg-background-muted',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n )}\n >\n <span\n aria-hidden\n className={cn(\n 'flex size-4 items-center justify-center rounded-sm border',\n isSelected\n ? 'border-accent bg-accent text-on-accent'\n : 'border-border-input',\n )}\n >\n {isSelected && <Check className=\"size-3\" aria-hidden />}\n </span>\n <span className=\"flex-1\">{opt.label}</span>\n {opt.description && (\n <span className=\"text-foreground-subtle text-xs\">{opt.description}</span>\n )}\n </CommandPrimitive.Item>\n );\n })}\n {filtered.length === 0 && (\n <CommandPrimitive.Empty className=\"text-foreground-subtle px-2 py-6 text-center text-sm\">\n {emptyText}\n </CommandPrimitive.Empty>\n )}\n </CommandPrimitive.List>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </CommandPrimitive>\n\n {error ? (\n <p id={errorId} className=\"text-danger-text text-xs\">\n {error}\n </p>\n ) : helperText ? (\n <p id={helperId} className=\"text-foreground-subtle text-xs\">\n {helperText}\n </p>\n ) : null}\n </div>\n );\n});\n\nMultiSelect.displayName = 'MultiSelect';\n"],"names":["MultiSelect","forwardRef","options","value","onChange","label","helperText","error","placeholderProp","emptyTextProp","maxVisibleChips","clearable","disabled","id","className","ref","strings","useStrings","placeholder","emptyText","isError","fieldId","helperId","errorId","describedBy","useFieldIds","open","setOpen","useState","query","setQuery","inputRef","useRef","fieldRef","listId","setListId","listRef","useCallback","el","selected","useMemo","o","toggle","v","x","clear","handleKeyDown","filtered","visibleChips","overflow","cn","jsx","CommandPrimitive","jsxs","PopoverPrimitive","_a","opt","formatString","e","X","ChevronsUpDown","target","isSelected","Check"],"mappings":";;;;;;;;;;AAmFO,MAAMA,KAAcC,EAA6C,SACtE;AAAA,EACE,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAaC;AAAA,EACb,WAAWC;AAAA,EACX,iBAAAC,IAAkB;AAAA,EAClB,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AACF,GACAC,GACA;AACA,QAAMC,IAAUC,GAAA,GACVC,IAAcV,KAAmBQ,EAAQ,YAAY,aACrDG,IAAYV,KAAiBO,EAAQ,YAAY,OACjDI,IAAU,EAAQb,GAClB,EAAE,SAAAc,GAAS,UAAAC,GAAU,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,GAAYZ,GAAI;AAAA,IAClE,WAAW,EAAQP;AAAA,IACnB,UAAUc;AAAA,EAAA,CACX,GAEK,CAACM,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAChC,CAACC,GAAOC,CAAQ,IAAIF,EAAS,EAAE,GAC/BG,IAAWC,EAAyB,IAAI,GACxCC,IAAWD,EAAuB,IAAI,GAGtC,CAACE,GAAQC,CAAS,IAAIP,EAA6B,MAAS,GAC5DQ,IAAUC,EAAY,CAACC,MAA8BH,EAAUG,KAAA,gBAAAA,EAAI,EAAE,GAAG,EAAE,GAE1EC,IAAWC,EAAQ,MAAMtC,EAAQ,OAAO,CAACuC,MAAMtC,EAAM,SAASsC,EAAE,KAAK,CAAC,GAAG,CAACvC,GAAS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WAAW,KACnB,gBAAAI,EAACC,EAAiB,OAAjB,EAAuB,WAAU,wDAC/B,UAAAjC,EAAA,CACH;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA,EACF,CACF;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,IAECZ,IACC,gBAAA4C,EAAC,KAAA,EAAE,IAAI5B,GAAS,WAAU,4BACvB,UAAAhB,EAAA,CACH,IACED,sBACD,KAAA,EAAE,IAAIgB,GAAU,WAAU,kCACxB,aACH,IACE;AAAA,EAAA,GACN;AAEJ,CAAC;AAEDtB,GAAY,cAAc;"}
1
+ {"version":3,"file":"MultiSelect.js","names":[],"sources":["../../../src/components/ui/MultiSelect.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport { Check, ChevronsUpDown, X } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { formatString } from '@/lib/strings';\nimport { useFieldIds } from '@/hooks/use-field-ids';\n\nexport interface MultiSelectOption {\n /** Stable, unique value submitted in `onChange`. */\n value: string;\n /** Visible label shown both in the menu and in the selected chip. */\n label: string;\n /** Optional secondary text shown after the label in the menu. */\n description?: string;\n /** Disable selecting this option. */\n disabled?: boolean;\n}\n\nexport interface MultiSelectProps {\n /** All possible options. */\n options: MultiSelectOption[];\n /** Currently selected values. Controlled. */\n value: string[];\n /** Called whenever the selection changes. */\n onChange: (next: string[]) => void;\n /** Visible label above the field. */\n label?: ReactNode;\n /** Hint below the field. Hidden when `error` is set. */\n helperText?: ReactNode;\n /** Validation message. */\n error?: ReactNode;\n /** Empty-state placeholder shown when nothing is selected. */\n placeholder?: string;\n /** Text shown when no options match the search. */\n emptyText?: string;\n /** Max number of chips rendered inline; remainder shown as \"+N more\". */\n maxVisibleChips?: number;\n /** Whether the user can clear all selections with a single click. */\n clearable?: boolean;\n /** Disable the entire field. */\n disabled?: boolean;\n /** Consumer-supplied id for the search input (label association). */\n id?: string;\n className?: string;\n}\n\n/**\n * Chip-based multi-select with a searchable menu (cmdk under the hood).\n *\n * Keyboard:\n * - Backspace on the input with empty query removes the last chip\n * - ArrowUp / ArrowDown move the highlight, Enter toggles the highlighted option\n * - Escape closes the menu\n *\n * @example Tag picker\n * <MultiSelect label=\"Tags\"\n * options={tags}\n * value={selected}\n * onChange={setSelected}\n * placeholder=\"Pick tags\" />\n *\n * @example Bounded with overflow chip\n * <MultiSelect options={users}\n * value={value}\n * onChange={setValue}\n * maxVisibleChips={3} />\n *\n * @do Cap `maxVisibleChips` (3–5) on narrow surfaces so the field doesn't\n * reflow as the user adds selections.\n * @dont Use MultiSelect for fewer than ~6 options. CheckboxGroup is clearer.\n */\nexport const MultiSelect = forwardRef<HTMLDivElement, MultiSelectProps>(function MultiSelect(\n {\n options,\n value,\n onChange,\n label,\n helperText,\n error,\n placeholder: placeholderProp,\n emptyText: emptyTextProp,\n maxVisibleChips = 3,\n clearable = true,\n disabled,\n id,\n className,\n },\n ref,\n) {\n const strings = useStrings();\n const placeholder = placeholderProp ?? strings.multiSelect.placeholder;\n const emptyText = emptyTextProp ?? strings.multiSelect.empty;\n const isError = Boolean(error);\n const { fieldId, helperId, errorId, describedBy } = useFieldIds(id, {\n hasHelper: Boolean(helperText),\n hasError: isError,\n });\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const inputRef = useRef<HTMLInputElement>(null);\n const fieldRef = useRef<HTMLDivElement>(null);\n // cmdk assigns its own id to the list (ours is ignored), so read it back\n // from the node once the portal mounts to keep aria-controls truthful.\n const [listId, setListId] = useState<string | undefined>(undefined);\n const listRef = useCallback((el: HTMLDivElement | null) => setListId(el?.id), []);\n\n const selected = useMemo(() => options.filter((o) => value.includes(o.value)), [options, value]);\n\n const toggle = useCallback(\n (v: string) => {\n if (value.includes(v)) onChange(value.filter((x) => x !== v));\n else onChange([...value, v]);\n },\n [value, onChange],\n );\n\n const clear = useCallback(() => onChange([]), [onChange]);\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Backspace' && query === '' && value.length > 0) {\n onChange(value.slice(0, -1));\n } else if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && !open) {\n setOpen(true);\n }\n };\n\n const filtered = useMemo(\n () => options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase())),\n [options, query],\n );\n\n const visibleChips = selected.slice(0, maxVisibleChips);\n const overflow = selected.length - visibleChips.length;\n\n return (\n <div ref={ref} className={cn('flex flex-col gap-1.5', className)}>\n {label && (\n <label\n id={`${fieldId}-label`}\n htmlFor={fieldId}\n className=\"text-foreground text-sm font-medium\"\n >\n {label}\n </label>\n )}\n\n {/* The Command root wraps the whole field so cmdk's root keydown handler\n (ArrowUp/Down/Enter) sees the input even though the list is portaled.\n A plain <input> is used instead of Command.Input because cmdk forces\n its own id / aria-* on that element, breaking the label association. */}\n <CommandPrimitive shouldFilter={false} className=\"flex w-full flex-col\">\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Anchor asChild>\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -- click-to-focus wrapper; the <input role=\"combobox\"> inside owns keyboard handling */}\n <div\n ref={fieldRef}\n aria-disabled={disabled || undefined}\n className={cn(\n 'bg-card flex h-9 w-full cursor-text items-center gap-1.5 overflow-hidden rounded-md border px-2 py-1 text-sm',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2',\n isError\n ? 'border-danger focus-within:border-danger focus-within:ring-danger'\n : 'border-border-input focus-within:border-accent focus-within:ring-ring',\n disabled && 'pointer-events-none opacity-50',\n )}\n onClick={() => {\n inputRef.current?.focus();\n if (!disabled) setOpen(true);\n }}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden\">\n {visibleChips.map((opt) => (\n <span\n key={opt.value}\n className=\"bg-accent-soft text-on-accent-soft inline-flex max-w-[10rem] shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-xs font-medium\"\n >\n <span className=\"truncate\" title={opt.label}>\n {opt.label}\n </span>\n <button\n type=\"button\"\n aria-label={formatString(strings.multiSelect.remove, { label: opt.label })}\n className=\"text-on-accent-soft hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative inline-flex items-center rounded-sm outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1\"\n onClick={(e) => {\n e.stopPropagation();\n toggle(opt.value);\n }}\n >\n <X className=\"size-3\" aria-hidden />\n </button>\n </span>\n ))}\n {overflow > 0 && (\n <span className=\"bg-background-muted text-foreground-muted shrink-0 rounded-md px-1.5 py-0.5 text-xs font-medium\">\n +{overflow}\n </span>\n )}\n <input\n ref={inputRef}\n id={fieldId}\n type=\"text\"\n autoComplete=\"off\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n onFocus={() => setOpen(true)}\n onKeyDown={handleKeyDown}\n placeholder={visibleChips.length === 0 ? placeholder : undefined}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n // Unlabelled field: name the input after the placeholder. A\n // consumer `id` implies an external <label htmlFor>.\n aria-labelledby={label ? `${fieldId}-label` : undefined}\n aria-label={label || id ? undefined : placeholder}\n aria-invalid={isError || undefined}\n aria-describedby={describedBy}\n className=\"placeholder:text-foreground-subtle min-w-[6ch] flex-1 bg-transparent text-lg outline-none md:text-sm\"\n disabled={disabled}\n />\n </div>\n <span className=\"flex shrink-0 items-center gap-1 pl-1\">\n {clearable && selected.length > 0 && (\n <button\n type=\"button\"\n aria-label={strings.multiSelect.clearAll}\n onClick={(e) => {\n e.stopPropagation();\n clear();\n }}\n className=\"text-foreground-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background inline-flex size-6 shrink-0 items-center justify-center rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-2\"\n >\n <X className=\"size-4\" aria-hidden />\n </button>\n )}\n <ChevronsUpDown className=\"text-foreground-subtle size-4\" aria-hidden />\n </span>\n </div>\n </PopoverPrimitive.Anchor>\n\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={4}\n // Radix gives the content role=\"dialog\"; a dialog needs a name.\n aria-label={strings.command.suggestions}\n className={cn(\n 'border-border bg-popover text-popover-foreground z-[var(--z-popover)] w-[var(--radix-popover-trigger-width)] overflow-hidden rounded-lg border shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n )}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onInteractOutside={(e) => {\n // Clicks inside the anchor (chips, clear) must not close the menu.\n const target = e.target as Node | null;\n if (target && fieldRef.current?.contains(target)) e.preventDefault();\n }}\n >\n <CommandPrimitive.List\n ref={listRef}\n label={strings.command.suggestions}\n className=\"max-h-64 overflow-y-auto p-1\"\n >\n {filtered.map((opt) => {\n const isSelected = value.includes(opt.value);\n return (\n <CommandPrimitive.Item\n key={opt.value}\n value={opt.value}\n disabled={opt.disabled}\n onSelect={() => toggle(opt.value)}\n className={cn(\n 'text-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm',\n 'data-[selected=true]:bg-background-muted',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n )}\n >\n <span\n aria-hidden\n className={cn(\n 'flex size-4 items-center justify-center rounded-sm border',\n isSelected\n ? 'border-accent bg-accent text-on-accent'\n : 'border-border-input',\n )}\n >\n {isSelected && <Check className=\"size-3\" aria-hidden />}\n </span>\n <span className=\"flex-1\">{opt.label}</span>\n {opt.description && (\n <span className=\"text-foreground-subtle text-xs\">{opt.description}</span>\n )}\n </CommandPrimitive.Item>\n );\n })}\n {filtered.length === 0 && (\n <CommandPrimitive.Empty className=\"text-foreground-subtle px-2 py-6 text-center text-sm\">\n {emptyText}\n </CommandPrimitive.Empty>\n )}\n </CommandPrimitive.List>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </CommandPrimitive>\n\n {error ? (\n <p id={errorId} className=\"text-danger-text text-xs\">\n {error}\n </p>\n ) : helperText ? (\n <p id={helperId} className=\"text-foreground-subtle text-xs\">\n {helperText}\n </p>\n ) : null}\n </div>\n );\n});\n\nMultiSelect.displayName = 'MultiSelect';\n"],"mappings":";;;;;;;;;;;AAmFA,IAAa,IAAc,EAA6C,SACtE,EACE,YACA,UACA,aACA,UACA,eACA,UACA,aAAa,GACb,WAAW,GACX,qBAAkB,GAClB,eAAY,IACZ,aACA,OACA,gBAEF,GACA;CACA,IAAM,IAAU,EAAW,GACrB,IAAc,KAAmB,EAAQ,YAAY,aACrD,IAAY,KAAiB,EAAQ,YAAY,OACjD,IAAU,EAAQ,GAClB,EAAE,YAAS,aAAU,YAAS,mBAAgB,EAAY,GAAI;EAClE,WAAW,EAAQ;EACnB,UAAU;CACZ,CAAC,GAEK,CAAC,GAAM,KAAW,EAAS,EAAK,GAChC,CAAC,GAAO,KAAY,EAAS,EAAE,GAC/B,IAAW,EAAyB,IAAI,GACxC,IAAW,EAAuB,IAAI,GAGtC,CAAC,GAAQ,KAAa,EAA6B,KAAA,CAAS,GAC5D,IAAU,GAAa,MAA8B,EAAU,GAAI,EAAE,GAAG,CAAC,CAAC,GAE1E,IAAW,QAAc,EAAQ,QAAQ,MAAM,EAAM,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,GAAS,CAAK,CAAC,GAEzF,IAAS,GACZ,MAAc;EACb,AAAI,EAAM,SAAS,CAAC,IAAG,EAAS,EAAM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