@alfadocs/ui-kit 0.97.2 → 0.98.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{booking-BSpSMmJ2.js → booking-Bhbvef95.js} +2 -2
- package/dist/_chunks/{document-preview-DXl9migE.js → document-preview-DXsCEj4U.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-flfZh2qY.js → link-cell-renderer-Bt-mXeQY.js} +2 -2
- package/dist/_chunks/{multi-select-D5QLBJM1.js → multi-select-CC52Qws6.js} +275 -263
- package/dist/_chunks/{muscle-scheme-CFBE2dme.js → muscle-scheme-kgCX5qfO.js} +2 -2
- package/dist/_chunks/{notes-panel-BLjlYBt-.js → notes-panel-BKwd-bOV.js} +2 -2
- package/dist/_chunks/{patient-summary-card-vn1H4xWj.js → patient-summary-card-C-iVDo53.js} +4 -2
- package/dist/_chunks/{patient-table-CvZTIM2R.js → patient-table-QEVsFvwq.js} +2 -2
- package/dist/_chunks/{public-header.agent-rX_VA6hd.js → public-header.agent-_8W9biCO.js} +4 -2
- package/dist/_chunks/{rich-text-editor-RRkBN_WB.js → rich-text-editor-DHpV2q6d.js} +4 -4
- package/dist/_chunks/{sign-document-DI561d1C.js → sign-document-cH9CboWB.js} +2 -2
- package/dist/_chunks/{signature-capture-DN52VNKL.js → signature-capture-D6ut9_IR.js} +2 -2
- package/dist/_chunks/{tabs-CVTukWRD.js → tabs-CBb2AidH.js} +17 -17
- package/dist/_chunks/{warning-stack-CAHQ0xxS.js → warning-stack-DKeAfj5M.js} +3 -3
- package/dist/agent-catalog.json +291 -1
- package/dist/agent-i18n/en.json +23 -0
- package/dist/components/booking/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/muscle-scheme/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/public-header/index.js +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-capture/index.js +1 -1
- package/dist/components/skeleton-scheme/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/host-compat.css +578 -0
- package/dist/index.js +14 -14
- package/dist/tokens.css +1 -1
- package/package.json +10 -3
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import * as
|
|
4
|
-
import { _ as
|
|
5
|
-
import { c as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { u as
|
|
8
|
-
import { T as
|
|
9
|
-
import { c as
|
|
10
|
-
import { u as
|
|
11
|
-
import { u as
|
|
12
|
-
import { g as
|
|
13
|
-
import { b as
|
|
14
|
-
import { u as
|
|
15
|
-
import { X as
|
|
16
|
-
import { C as
|
|
17
|
-
const
|
|
1
|
+
import { jsx as n, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ue, useContext as Qe, useState as q, useRef as v, useMemo as O, useEffect as Y, useCallback as le } from "react";
|
|
3
|
+
import * as D from "@radix-ui/react-popover";
|
|
4
|
+
import { _ as c } from "./index-4xgbg-sn.js";
|
|
5
|
+
import { c as pe } from "./index-D2ZczOXr.js";
|
|
6
|
+
import { useTranslation as Ye } from "react-i18next";
|
|
7
|
+
import { u as Ge, F as He } from "./form-field-context-B3APVHKx.js";
|
|
8
|
+
import { T as de } from "./tooltip-DvmfrNvB.js";
|
|
9
|
+
import { c as We } from "./compose-refs-C0k0tdqF.js";
|
|
10
|
+
import { u as Xe } from "./use-controllable-state-BiY4xTzM.js";
|
|
11
|
+
import { u as G } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
12
|
+
import { g as Je } from "./group-options-BvKhQ3xb.js";
|
|
13
|
+
import { b as H, c as Ze } from "./input-surface-xyERuLU_.js";
|
|
14
|
+
import { u as et } from "./registry-DvAUVLHh.js";
|
|
15
|
+
import { X as tt } from "./x-B5YnXwCz.js";
|
|
16
|
+
import { C as st } from "./check-DrFSN__t.js";
|
|
17
|
+
const rt = {
|
|
18
18
|
id: "multi-select",
|
|
19
19
|
// Persisted multi-choice (selection state + set_selection) → select_multiple,
|
|
20
20
|
// plus type-to-filter and open/close of the option list.
|
|
@@ -64,8 +64,8 @@ const Ze = {
|
|
|
64
64
|
note: 'Select exactly options "a" and "b".'
|
|
65
65
|
}
|
|
66
66
|
],
|
|
67
|
-
invoke: (a,
|
|
68
|
-
a.setSelection(
|
|
67
|
+
invoke: (a, l) => {
|
|
68
|
+
a.setSelection(l.values);
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
clear_selection: {
|
|
@@ -92,8 +92,8 @@ const Ze = {
|
|
|
92
92
|
idempotent: !0,
|
|
93
93
|
descriptionKey: "ui.agent.multiSelect.actions.applyFilter",
|
|
94
94
|
description: "Set the filter query for the option list.",
|
|
95
|
-
invoke: (a,
|
|
96
|
-
a.setQuery(
|
|
95
|
+
invoke: (a, l) => {
|
|
96
|
+
a.setQuery(l.query);
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
open: {
|
|
@@ -127,24 +127,24 @@ const Ze = {
|
|
|
127
127
|
description: "Each option emits its value as data-option-id."
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
},
|
|
130
|
+
}, nt = pe(
|
|
131
131
|
[
|
|
132
132
|
"ds:inline-flex ds:flex-wrap ds:items-center ds:gap-1 ds:w-full",
|
|
133
|
-
|
|
133
|
+
Ze,
|
|
134
134
|
"ds:aria-[invalid=true]:border-destructive",
|
|
135
135
|
"ds:aria-disabled:cursor-not-allowed ds:aria-disabled:opacity-50"
|
|
136
136
|
],
|
|
137
137
|
{
|
|
138
138
|
variants: {
|
|
139
139
|
size: {
|
|
140
|
-
sm: `ds:min-h-8 ds:ps-2 ds:pe-2 ds:py-1 ${
|
|
141
|
-
md: `ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:py-1.5 ${
|
|
142
|
-
lg: `ds:min-h-12 ds:ps-4 ds:pe-4 ds:py-2 ${
|
|
140
|
+
sm: `ds:min-h-8 ds:ps-2 ds:pe-2 ds:py-1 ${H.sm}`,
|
|
141
|
+
md: `ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:py-1.5 ${H.md}`,
|
|
142
|
+
lg: `ds:min-h-12 ds:ps-4 ds:pe-4 ds:py-2 ${H.lg}`
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
defaultVariants: { size: "md" }
|
|
146
146
|
}
|
|
147
|
-
),
|
|
147
|
+
), ce = pe(
|
|
148
148
|
[
|
|
149
149
|
"ds:inline-flex ds:items-center ds:gap-1",
|
|
150
150
|
"ds:rounded-[var(--radius-sm)] ds:border ds:border-border ds:bg-muted",
|
|
@@ -164,7 +164,7 @@ const Ze = {
|
|
|
164
164
|
},
|
|
165
165
|
defaultVariants: { size: "md" }
|
|
166
166
|
}
|
|
167
|
-
),
|
|
167
|
+
), it = [
|
|
168
168
|
"ds:inline-flex ds:items-center ds:justify-center ds:shrink-0",
|
|
169
169
|
"ds:rounded-[var(--radius-sm)]",
|
|
170
170
|
"ds:text-muted-foreground ds:hover:text-foreground",
|
|
@@ -173,7 +173,7 @@ const Ze = {
|
|
|
173
173
|
"ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
174
174
|
"ds:size-4",
|
|
175
175
|
'ds:relative ds:before:absolute ds:before:inset-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[""]'
|
|
176
|
-
].join(" "),
|
|
176
|
+
].join(" "), ot = [
|
|
177
177
|
"ds:z-[var(--z-dropdown)] ds:overflow-hidden",
|
|
178
178
|
"ds:min-w-[var(--radix-popover-trigger-width)]",
|
|
179
179
|
"ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:text-foreground",
|
|
@@ -184,34 +184,34 @@ const Ze = {
|
|
|
184
184
|
"ds:data-[side=bottom]:slide-in-from-top-2",
|
|
185
185
|
"ds:data-[side=top]:slide-in-from-bottom-2",
|
|
186
186
|
"ds:motion-reduce:animate-none"
|
|
187
|
-
].join(" "),
|
|
187
|
+
].join(" "), at = [
|
|
188
188
|
"ds:relative ds:flex ds:cursor-pointer ds:items-center",
|
|
189
189
|
"ds:rounded-[var(--radius-sm)] ds:ps-2 ds:pe-2 ds:py-1.5",
|
|
190
190
|
"ds:text-[var(--font-size-sm)] ds:text-foreground ds:outline-none ds:select-none",
|
|
191
191
|
"ds:data-[selected=true]:bg-muted ds:data-[selected=true]:text-foreground",
|
|
192
192
|
"ds:aria-[disabled=true]:pointer-events-none ds:aria-[disabled=true]:opacity-50",
|
|
193
193
|
"ds:data-[disabled=true]:pointer-events-none ds:data-[disabled=true]:opacity-50"
|
|
194
|
-
].join(" "),
|
|
194
|
+
].join(" "), ue = [
|
|
195
195
|
"ds:relative ds:flex ds:cursor-pointer ds:items-center",
|
|
196
196
|
"ds:rounded-[var(--radius-sm)] ds:ps-2 ds:pe-2 ds:py-1.5",
|
|
197
197
|
"ds:text-[var(--font-size-sm)] ds:font-medium ds:text-primary ds:outline-none ds:select-none",
|
|
198
198
|
"ds:data-[selected=true]:bg-muted"
|
|
199
|
-
].join(" "),
|
|
199
|
+
].join(" "), lt = "__ui-multiselect-select-all__", dt = "__ui-multiselect-clear-all__", me = Ue(
|
|
200
200
|
function({
|
|
201
|
-
options:
|
|
202
|
-
value:
|
|
203
|
-
defaultValue:
|
|
204
|
-
onChange:
|
|
205
|
-
onComplete:
|
|
206
|
-
placeholder:
|
|
207
|
-
maxSelections:
|
|
208
|
-
allowSelectAll:
|
|
209
|
-
allowClear:
|
|
210
|
-
filter:
|
|
201
|
+
options: l,
|
|
202
|
+
value: fe,
|
|
203
|
+
defaultValue: he,
|
|
204
|
+
onChange: ge,
|
|
205
|
+
onComplete: L,
|
|
206
|
+
placeholder: ve,
|
|
207
|
+
maxSelections: b,
|
|
208
|
+
allowSelectAll: W = !1,
|
|
209
|
+
allowClear: X = !1,
|
|
210
|
+
filter: z,
|
|
211
211
|
size: R = "md",
|
|
212
|
-
disabled:
|
|
213
|
-
className:
|
|
214
|
-
id:
|
|
212
|
+
disabled: be,
|
|
213
|
+
className: ye,
|
|
214
|
+
id: M,
|
|
215
215
|
// Pull `aria-label` out of the div spread so it names the combobox
|
|
216
216
|
// INPUT (the interactive control) rather than the wrapper div. Lets a
|
|
217
217
|
// consumer give the trigger a meaningful name when there's no visible
|
|
@@ -220,221 +220,233 @@ const Ze = {
|
|
|
220
220
|
// ONLY set this when the control has no visible / FormField label —
|
|
221
221
|
// `aria-label` wins over an associated `<label>`, so passing both would
|
|
222
222
|
// silently override the visible text (WCAG 2.5.3 Label in Name).
|
|
223
|
-
"aria-label":
|
|
224
|
-
...
|
|
225
|
-
},
|
|
226
|
-
const { t:
|
|
227
|
-
value:
|
|
228
|
-
defaultValue:
|
|
229
|
-
onChange:
|
|
230
|
-
}),
|
|
223
|
+
"aria-label": Se,
|
|
224
|
+
...xe
|
|
225
|
+
}, Ie) {
|
|
226
|
+
const { t: u } = Ye(), y = Ge(), S = Qe(He) !== null, [we, K] = Xe({
|
|
227
|
+
value: fe,
|
|
228
|
+
defaultValue: he ?? [],
|
|
229
|
+
onChange: ge
|
|
230
|
+
}), i = we ?? [], [N, p] = q(!1), [m, j] = q(""), x = v(null), I = v([]), P = v(null), Ne = We(Ie, P), g = S && y.disabled || !!be, ke = S && y.required, J = S && y.invalid, Ce = S && y.describedBy ? y.describedBy : void 0, Ae = M ?? (S ? y.id : void 0), _e = O(() => {
|
|
231
231
|
const e = /* @__PURE__ */ new Map();
|
|
232
|
-
for (const t of
|
|
232
|
+
for (const t of l) e.set(t.value, t.label);
|
|
233
233
|
return e;
|
|
234
|
-
}, [
|
|
235
|
-
|
|
236
|
-
},
|
|
237
|
-
if (
|
|
238
|
-
|
|
234
|
+
}, [l]), Z = typeof b == "number" && i.length >= b, k = (e) => {
|
|
235
|
+
K(e);
|
|
236
|
+
}, Re = (e) => {
|
|
237
|
+
if (i.includes(e)) {
|
|
238
|
+
k(i.filter((t) => t !== e));
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
const t =
|
|
244
|
-
return
|
|
245
|
-
},
|
|
246
|
-
const e =
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}, [
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}, [
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}, [
|
|
262
|
-
const
|
|
241
|
+
Z || k([...i, e]);
|
|
242
|
+
}, $ = (e) => {
|
|
243
|
+
const t = i.filter((s, o) => o !== e);
|
|
244
|
+
return k(t), t;
|
|
245
|
+
}, Te = () => {
|
|
246
|
+
const e = l.filter((s) => !s.disabled).map((s) => s.value), t = typeof b == "number" ? b : e.length;
|
|
247
|
+
k(e.slice(0, t));
|
|
248
|
+
}, Ee = () => {
|
|
249
|
+
k([]);
|
|
250
|
+
}, ee = v(i);
|
|
251
|
+
Y(() => {
|
|
252
|
+
ee.current = i;
|
|
253
|
+
}, [i]);
|
|
254
|
+
const te = v(m);
|
|
255
|
+
Y(() => {
|
|
256
|
+
te.current = m;
|
|
257
|
+
}, [m]);
|
|
258
|
+
const se = v(N);
|
|
259
|
+
Y(() => {
|
|
260
|
+
se.current = N;
|
|
261
|
+
}, [N]);
|
|
262
|
+
const B = le(
|
|
263
263
|
(e) => {
|
|
264
|
-
|
|
264
|
+
K(e);
|
|
265
265
|
},
|
|
266
|
-
[
|
|
267
|
-
),
|
|
266
|
+
[K]
|
|
267
|
+
), Fe = O(
|
|
268
268
|
() => ({
|
|
269
|
-
getSelection: () => [...
|
|
270
|
-
getQuery: () =>
|
|
271
|
-
getIsOpen: () =>
|
|
272
|
-
setSelection: (e) =>
|
|
273
|
-
clearSelection: () =>
|
|
274
|
-
setQuery: (e) =>
|
|
275
|
-
open: () =>
|
|
276
|
-
close: () =>
|
|
269
|
+
getSelection: () => [...ee.current],
|
|
270
|
+
getQuery: () => te.current,
|
|
271
|
+
getIsOpen: () => se.current,
|
|
272
|
+
setSelection: (e) => B(e),
|
|
273
|
+
clearSelection: () => B([]),
|
|
274
|
+
setQuery: (e) => j(e),
|
|
275
|
+
open: () => p(!0),
|
|
276
|
+
close: () => p(!1)
|
|
277
277
|
}),
|
|
278
|
-
[
|
|
278
|
+
[B]
|
|
279
279
|
);
|
|
280
|
-
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
283
|
-
const e =
|
|
284
|
-
return
|
|
285
|
-
}, [
|
|
286
|
-
() =>
|
|
287
|
-
[
|
|
288
|
-
),
|
|
280
|
+
et(rt, Fe, M);
|
|
281
|
+
const re = ve ?? u("inputs.multiSelect.placeholder", "Select…"), ne = O(() => {
|
|
282
|
+
if (!m) return l;
|
|
283
|
+
const e = m.toLowerCase();
|
|
284
|
+
return l.filter((t) => z ? z(m, t) : t.label.toLowerCase().includes(e));
|
|
285
|
+
}, [l, m, z]), Ve = O(
|
|
286
|
+
() => Je(ne),
|
|
287
|
+
[ne]
|
|
288
|
+
), qe = (e) => {
|
|
289
289
|
var o;
|
|
290
290
|
const t = e.currentTarget;
|
|
291
|
-
if (e.key === "Backspace" &&
|
|
291
|
+
if (e.key === "Backspace" && m === "" && i.length > 0) {
|
|
292
292
|
e.preventDefault();
|
|
293
|
-
const
|
|
293
|
+
const r = i.length - 1, d = $(r).length - 1;
|
|
294
294
|
d >= 0 && requestAnimationFrame(() => {
|
|
295
|
-
var
|
|
296
|
-
(
|
|
295
|
+
var h;
|
|
296
|
+
(h = I.current[d]) == null || h.focus();
|
|
297
297
|
});
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
const s = t.selectionStart === 0 && t.selectionEnd === 0;
|
|
301
|
-
if ((e.key === "ArrowLeft" || e.key === "ArrowRight") && s &&
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
301
|
+
if ((e.key === "ArrowLeft" || e.key === "ArrowRight") && s && i.length > 0) {
|
|
302
|
+
const r = document.dir === "rtl" || t.dir === "rtl";
|
|
303
|
+
if (r && e.key === "ArrowRight" || !r && e.key === "ArrowLeft") {
|
|
304
304
|
e.preventDefault();
|
|
305
|
-
const d =
|
|
306
|
-
(o =
|
|
305
|
+
const d = i.length - 1;
|
|
306
|
+
(o = I.current[d]) == null || o.focus();
|
|
307
307
|
}
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
310
|
if (e.key === "Escape") {
|
|
311
|
-
|
|
311
|
+
p(!1);
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
-
!
|
|
315
|
-
},
|
|
316
|
-
var
|
|
314
|
+
!N && (e.key === "ArrowDown" || e.key === "Enter") && p(!0);
|
|
315
|
+
}, Oe = (e) => (t) => {
|
|
316
|
+
var f, d, h, A;
|
|
317
317
|
if (t.key === "Backspace" || t.key === "Delete" || t.key === "Enter" || t.key === " ") {
|
|
318
318
|
t.preventDefault(), t.stopPropagation();
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
319
|
+
const V = $(e);
|
|
320
|
+
if (V.length === 0) {
|
|
321
321
|
requestAnimationFrame(() => {
|
|
322
322
|
var _;
|
|
323
|
-
return (_ =
|
|
323
|
+
return (_ = x.current) == null ? void 0 : _.focus();
|
|
324
324
|
});
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
|
-
const
|
|
327
|
+
const Be = Math.min(e, V.length - 1);
|
|
328
328
|
requestAnimationFrame(() => {
|
|
329
329
|
var _;
|
|
330
|
-
(_ =
|
|
330
|
+
(_ = I.current[Be]) == null || _.focus();
|
|
331
331
|
});
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
|
-
const s = document.dir === "rtl", o = s ? "ArrowRight" : "ArrowLeft",
|
|
334
|
+
const s = document.dir === "rtl", o = s ? "ArrowRight" : "ArrowLeft", r = s ? "ArrowLeft" : "ArrowRight";
|
|
335
335
|
if (t.key === o) {
|
|
336
336
|
t.preventDefault();
|
|
337
|
-
const
|
|
338
|
-
(
|
|
337
|
+
const V = Math.max(0, e - 1);
|
|
338
|
+
(f = I.current[V]) == null || f.focus();
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
|
-
if (t.key ===
|
|
342
|
-
t.preventDefault(), e <
|
|
341
|
+
if (t.key === r) {
|
|
342
|
+
t.preventDefault(), e < i.length - 1 ? (d = I.current[e + 1]) == null || d.focus() : (h = x.current) == null || h.focus();
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
|
-
t.key === "Escape" && (
|
|
346
|
-
}, [T,
|
|
345
|
+
t.key === "Escape" && (p(!1), (A = x.current) == null || A.focus());
|
|
346
|
+
}, [T, U] = q(
|
|
347
347
|
Number.POSITIVE_INFINITY
|
|
348
|
-
)
|
|
349
|
-
|
|
350
|
-
|
|
348
|
+
), [De, Le] = q(0), ie = v(-1), E = le(() => {
|
|
349
|
+
U(Number.POSITIVE_INFINITY), Le((e) => e + 1);
|
|
350
|
+
}, []);
|
|
351
|
+
G(() => {
|
|
352
|
+
const e = P.current;
|
|
351
353
|
if (!e) return;
|
|
352
|
-
const t = (
|
|
353
|
-
|
|
354
|
-
|
|
354
|
+
const t = Array.from(
|
|
355
|
+
e.querySelectorAll('[data-ui-chip="true"]')
|
|
356
|
+
);
|
|
357
|
+
if (t.length === 0) {
|
|
358
|
+
U(Number.POSITIVE_INFINITY);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const s = t[0].offsetTop;
|
|
362
|
+
let o = 0;
|
|
363
|
+
for (const r of t)
|
|
364
|
+
if (r.offsetTop === s) o++;
|
|
365
|
+
else break;
|
|
366
|
+
U(
|
|
367
|
+
o === t.length ? Number.POSITIVE_INFINITY : Math.max(1, o - 1)
|
|
368
|
+
);
|
|
369
|
+
}, [De]), G(() => {
|
|
370
|
+
E();
|
|
371
|
+
}, [i.length, R, E]), G(() => {
|
|
372
|
+
const e = P.current;
|
|
373
|
+
if (!e) return;
|
|
374
|
+
const t = new ResizeObserver((s) => {
|
|
375
|
+
var r;
|
|
376
|
+
const o = Math.round(
|
|
377
|
+
((r = s[0]) == null ? void 0 : r.contentRect.width) ?? e.clientWidth
|
|
355
378
|
);
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
let l = 0;
|
|
362
|
-
for (const d of o)
|
|
363
|
-
if (d.offsetTop === i) l++;
|
|
364
|
-
else break;
|
|
365
|
-
l === o.length ? P(Number.POSITIVE_INFINITY) : P(Math.max(1, l - 1));
|
|
366
|
-
};
|
|
367
|
-
t();
|
|
368
|
-
const s = new ResizeObserver(t);
|
|
369
|
-
return s.observe(e), () => s.disconnect();
|
|
370
|
-
}, [n.length, R]);
|
|
371
|
-
const E = n.map((e) => ({
|
|
379
|
+
o !== ie.current && (ie.current = o, E());
|
|
380
|
+
});
|
|
381
|
+
return t.observe(e), () => t.disconnect();
|
|
382
|
+
}, [E]);
|
|
383
|
+
const F = i.map((e) => ({
|
|
372
384
|
value: e,
|
|
373
|
-
label:
|
|
374
|
-
})),
|
|
385
|
+
label: _e.get(e) ?? e
|
|
386
|
+
})), oe = T === Number.POSITIVE_INFINITY || T >= F.length, ze = oe ? F : F.slice(0, T), ae = oe ? [] : F.slice(T), C = ae.length, Me = (e) => {
|
|
375
387
|
var s;
|
|
376
|
-
if (
|
|
388
|
+
if (g) return;
|
|
377
389
|
const t = e.target;
|
|
378
|
-
t.closest('[data-ui-chip="true"]') || t.closest('[data-ui-chip-dismiss="true"]') || (
|
|
379
|
-
},
|
|
380
|
-
if (
|
|
381
|
-
|
|
390
|
+
t.closest('[data-ui-chip="true"]') || t.closest('[data-ui-chip-dismiss="true"]') || (p(!0), (s = x.current) == null || s.focus());
|
|
391
|
+
}, Ke = (e) => {
|
|
392
|
+
if (g) {
|
|
393
|
+
p(!1);
|
|
382
394
|
return;
|
|
383
395
|
}
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
count:
|
|
387
|
-
defaultValue: `${
|
|
388
|
-
}), { onClick:
|
|
389
|
-
return /* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
396
|
+
p(e), e || (j(""), L == null || L(i));
|
|
397
|
+
}, je = W || X, Pe = u("inputs.multiSelect.selected", {
|
|
398
|
+
count: i.length,
|
|
399
|
+
defaultValue: `${i.length} selected`
|
|
400
|
+
}), { onClick: Q, ...$e } = xe;
|
|
401
|
+
return /* @__PURE__ */ n(c, { shouldFilter: !1, label: Pe, children: /* @__PURE__ */ w(D.Root, { open: N, onOpenChange: Ke, children: [
|
|
402
|
+
/* @__PURE__ */ n(D.Anchor, { asChild: !0, children: /* @__PURE__ */ w(
|
|
391
403
|
"div",
|
|
392
404
|
{
|
|
393
|
-
ref:
|
|
394
|
-
className:
|
|
395
|
-
"aria-disabled":
|
|
396
|
-
"aria-invalid":
|
|
405
|
+
ref: Ne,
|
|
406
|
+
className: nt({ size: R, className: ye }),
|
|
407
|
+
"aria-disabled": g || void 0,
|
|
408
|
+
"aria-invalid": J || void 0,
|
|
397
409
|
"data-component": "multi-select",
|
|
398
|
-
"data-component-id":
|
|
410
|
+
"data-component-id": M,
|
|
399
411
|
onClick: (e) => {
|
|
400
|
-
|
|
412
|
+
Q == null || Q(e), Me(e);
|
|
401
413
|
},
|
|
402
|
-
|
|
414
|
+
...$e,
|
|
403
415
|
children: [
|
|
404
|
-
|
|
416
|
+
ze.map((e, t) => (
|
|
405
417
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- chip pill receives focus via roving tabindex; chip removal uses an inner button
|
|
406
418
|
/* @__PURE__ */ w(
|
|
407
419
|
"span",
|
|
408
420
|
{
|
|
409
421
|
ref: (s) => {
|
|
410
|
-
|
|
422
|
+
I.current[t] = s;
|
|
411
423
|
},
|
|
412
|
-
tabIndex:
|
|
424
|
+
tabIndex: g ? -1 : 0,
|
|
413
425
|
"data-ui-chip": "true",
|
|
414
|
-
className:
|
|
415
|
-
onKeyDown:
|
|
426
|
+
className: ce({ size: R }),
|
|
427
|
+
onKeyDown: Oe(t),
|
|
416
428
|
"aria-label": e.label,
|
|
417
429
|
children: [
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
430
|
+
/* @__PURE__ */ n("span", { children: e.label }),
|
|
431
|
+
/* @__PURE__ */ n(
|
|
420
432
|
"button",
|
|
421
433
|
{
|
|
422
434
|
type: "button",
|
|
423
435
|
tabIndex: -1,
|
|
424
436
|
"data-ui-chip-dismiss": "true",
|
|
425
|
-
"aria-label":
|
|
437
|
+
"aria-label": u("inputs.multiSelect.remove", {
|
|
426
438
|
label: e.label,
|
|
427
439
|
defaultValue: `Remove ${e.label}`
|
|
428
440
|
}),
|
|
429
|
-
disabled:
|
|
441
|
+
disabled: g,
|
|
430
442
|
onClick: (s) => {
|
|
431
|
-
s.stopPropagation(),
|
|
443
|
+
s.stopPropagation(), $(t), requestAnimationFrame(() => {
|
|
432
444
|
var o;
|
|
433
|
-
return (o =
|
|
445
|
+
return (o = x.current) == null ? void 0 : o.focus();
|
|
434
446
|
});
|
|
435
447
|
},
|
|
436
|
-
className:
|
|
437
|
-
children: /* @__PURE__ */
|
|
448
|
+
className: it,
|
|
449
|
+
children: /* @__PURE__ */ n(tt, { "aria-hidden": "true", className: "ds:size-3.5" })
|
|
438
450
|
}
|
|
439
451
|
)
|
|
440
452
|
]
|
|
@@ -442,46 +454,46 @@ const Ze = {
|
|
|
442
454
|
e.value
|
|
443
455
|
)
|
|
444
456
|
)),
|
|
445
|
-
|
|
446
|
-
|
|
457
|
+
C > 0 ? /* @__PURE__ */ n(
|
|
458
|
+
de,
|
|
447
459
|
{
|
|
448
|
-
label:
|
|
460
|
+
label: ae.map((e) => e.label).join(", "),
|
|
449
461
|
delayDuration: 200,
|
|
450
|
-
children: /* @__PURE__ */
|
|
462
|
+
children: /* @__PURE__ */ n(
|
|
451
463
|
"span",
|
|
452
464
|
{
|
|
453
|
-
className:
|
|
465
|
+
className: ce({ size: R }),
|
|
454
466
|
tabIndex: 0,
|
|
455
467
|
role: "button",
|
|
456
|
-
"aria-label":
|
|
457
|
-
count:
|
|
458
|
-
defaultValue: `+${
|
|
468
|
+
"aria-label": u("inputs.multiSelect.overflow", {
|
|
469
|
+
count: C,
|
|
470
|
+
defaultValue: `+${C} more`
|
|
459
471
|
}),
|
|
460
|
-
children: /* @__PURE__ */
|
|
461
|
-
count:
|
|
462
|
-
defaultValue: `+${
|
|
472
|
+
children: /* @__PURE__ */ n("span", { children: u("inputs.multiSelect.overflow", {
|
|
473
|
+
count: C,
|
|
474
|
+
defaultValue: `+${C} more`
|
|
463
475
|
}) })
|
|
464
476
|
}
|
|
465
477
|
)
|
|
466
478
|
}
|
|
467
479
|
) : null,
|
|
468
|
-
/* @__PURE__ */
|
|
469
|
-
|
|
480
|
+
/* @__PURE__ */ n(
|
|
481
|
+
c.Input,
|
|
470
482
|
{
|
|
471
|
-
ref:
|
|
472
|
-
value:
|
|
473
|
-
onValueChange:
|
|
474
|
-
onKeyDown:
|
|
483
|
+
ref: x,
|
|
484
|
+
value: m,
|
|
485
|
+
onValueChange: j,
|
|
486
|
+
onKeyDown: qe,
|
|
475
487
|
onFocus: () => {
|
|
476
|
-
|
|
488
|
+
g || p(!0);
|
|
477
489
|
},
|
|
478
|
-
placeholder:
|
|
479
|
-
id:
|
|
480
|
-
"aria-label":
|
|
481
|
-
"aria-describedby":
|
|
482
|
-
"aria-invalid":
|
|
483
|
-
"aria-required":
|
|
484
|
-
disabled:
|
|
490
|
+
placeholder: i.length === 0 ? re : "",
|
|
491
|
+
id: Ae,
|
|
492
|
+
"aria-label": S ? void 0 : Se,
|
|
493
|
+
"aria-describedby": Ce,
|
|
494
|
+
"aria-invalid": J || void 0,
|
|
495
|
+
"aria-required": ke || void 0,
|
|
496
|
+
disabled: g,
|
|
485
497
|
className: [
|
|
486
498
|
"ds:flex-1 ds:min-w-[6rem] ds:bg-transparent ds:outline-none",
|
|
487
499
|
"ds:placeholder:text-muted-foreground ds:text-start",
|
|
@@ -492,109 +504,109 @@ const Ze = {
|
|
|
492
504
|
]
|
|
493
505
|
}
|
|
494
506
|
) }),
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
|
|
507
|
+
/* @__PURE__ */ n(D.Portal, { children: /* @__PURE__ */ n(
|
|
508
|
+
D.Content,
|
|
497
509
|
{
|
|
498
510
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
499
511
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
500
512
|
align: "start",
|
|
501
513
|
sideOffset: 4,
|
|
502
|
-
className:
|
|
514
|
+
className: ot,
|
|
503
515
|
children: /* @__PURE__ */ w(
|
|
504
|
-
|
|
516
|
+
c.List,
|
|
505
517
|
{
|
|
506
518
|
role: "listbox",
|
|
507
519
|
"aria-multiselectable": "true",
|
|
508
|
-
"aria-label":
|
|
520
|
+
"aria-label": re,
|
|
509
521
|
className: "ds:max-h-[20rem] ds:overflow-y-auto ds:p-1",
|
|
510
522
|
children: [
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
523
|
+
je ? /* @__PURE__ */ w(c.Group, { children: [
|
|
524
|
+
W ? /* @__PURE__ */ n(
|
|
525
|
+
c.Item,
|
|
514
526
|
{
|
|
515
|
-
value:
|
|
516
|
-
onSelect:
|
|
517
|
-
className:
|
|
518
|
-
children:
|
|
527
|
+
value: lt,
|
|
528
|
+
onSelect: Te,
|
|
529
|
+
className: ue,
|
|
530
|
+
children: u("inputs.multiSelect.selectAll", "Select all")
|
|
519
531
|
}
|
|
520
532
|
) : null,
|
|
521
|
-
|
|
522
|
-
|
|
533
|
+
X ? /* @__PURE__ */ n(
|
|
534
|
+
c.Item,
|
|
523
535
|
{
|
|
524
|
-
value:
|
|
525
|
-
onSelect:
|
|
526
|
-
className:
|
|
527
|
-
children:
|
|
536
|
+
value: dt,
|
|
537
|
+
onSelect: Ee,
|
|
538
|
+
className: ue,
|
|
539
|
+
children: u("inputs.multiSelect.clearAll", "Clear all")
|
|
528
540
|
}
|
|
529
541
|
) : null
|
|
530
542
|
] }) : null,
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
|
|
533
|
-
const o = t.map((
|
|
534
|
-
const
|
|
535
|
-
|
|
543
|
+
/* @__PURE__ */ n(c.Empty, { className: "ds:ps-2 ds:pe-2 ds:py-2 type-body-sm ds:text-muted-foreground", children: u("inputs.multiSelect.noOptions", "No options found") }),
|
|
544
|
+
Ve.map(({ group: e, items: t }, s) => {
|
|
545
|
+
const o = t.map((r) => {
|
|
546
|
+
const f = i.includes(r.value), d = !f && Z, h = !!r.disabled || d, A = /* @__PURE__ */ w(
|
|
547
|
+
c.Item,
|
|
536
548
|
{
|
|
537
|
-
value:
|
|
538
|
-
"data-option-id":
|
|
539
|
-
disabled:
|
|
549
|
+
value: r.value,
|
|
550
|
+
"data-option-id": r.value,
|
|
551
|
+
disabled: h,
|
|
540
552
|
onSelect: () => {
|
|
541
|
-
|
|
553
|
+
h || Re(r.value);
|
|
542
554
|
},
|
|
543
|
-
"aria-selected":
|
|
544
|
-
"aria-disabled":
|
|
545
|
-
className:
|
|
555
|
+
"aria-selected": f,
|
|
556
|
+
"aria-disabled": h || void 0,
|
|
557
|
+
className: at,
|
|
546
558
|
children: [
|
|
547
|
-
/* @__PURE__ */
|
|
559
|
+
/* @__PURE__ */ n(
|
|
548
560
|
"span",
|
|
549
561
|
{
|
|
550
562
|
className: [
|
|
551
563
|
"ds:inline-flex ds:items-center ds:justify-center ds:me-[var(--spacing-xs)] ds:shrink-0",
|
|
552
564
|
"ds:size-4 ds:rounded-[var(--radius-sm)] ds:border ds:border-border",
|
|
553
|
-
|
|
565
|
+
f ? "ds:bg-primary ds:border-primary ds:text-primary-foreground" : "ds:bg-background"
|
|
554
566
|
].join(" "),
|
|
555
567
|
"aria-hidden": "true",
|
|
556
|
-
children:
|
|
568
|
+
children: f ? /* @__PURE__ */ n(st, { className: "ds:size-3.5" }) : null
|
|
557
569
|
}
|
|
558
570
|
),
|
|
559
|
-
|
|
571
|
+
r.startAdornment ? (
|
|
560
572
|
// Decorative by contract — the accessible name comes
|
|
561
573
|
// from the option label.
|
|
562
|
-
/* @__PURE__ */
|
|
574
|
+
/* @__PURE__ */ n(
|
|
563
575
|
"span",
|
|
564
576
|
{
|
|
565
577
|
"aria-hidden": "true",
|
|
566
578
|
className: "ds:inline-flex ds:items-center ds:shrink-0 ds:me-[var(--spacing-xs)]",
|
|
567
|
-
children:
|
|
579
|
+
children: r.startAdornment
|
|
568
580
|
}
|
|
569
581
|
)
|
|
570
582
|
) : null,
|
|
571
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ n("span", { className: "ds:flex-1 ds:text-start", children: r.label })
|
|
572
584
|
]
|
|
573
585
|
},
|
|
574
|
-
|
|
586
|
+
r.value
|
|
575
587
|
);
|
|
576
|
-
return d ? /* @__PURE__ */
|
|
577
|
-
|
|
588
|
+
return d ? /* @__PURE__ */ n(
|
|
589
|
+
de,
|
|
578
590
|
{
|
|
579
|
-
label:
|
|
580
|
-
count:
|
|
581
|
-
defaultValue: `Maximum ${
|
|
591
|
+
label: u("inputs.multiSelect.maxReached", {
|
|
592
|
+
count: b,
|
|
593
|
+
defaultValue: `Maximum ${b} selections`
|
|
582
594
|
}),
|
|
583
595
|
delayDuration: 200,
|
|
584
|
-
children:
|
|
596
|
+
children: A
|
|
585
597
|
},
|
|
586
|
-
|
|
587
|
-
) :
|
|
598
|
+
r.value
|
|
599
|
+
) : A;
|
|
588
600
|
});
|
|
589
|
-
return e ? /* @__PURE__ */
|
|
590
|
-
|
|
601
|
+
return e ? /* @__PURE__ */ n(
|
|
602
|
+
c.Group,
|
|
591
603
|
{
|
|
592
604
|
heading: e,
|
|
593
605
|
className: "ds:[&_[cmdk-group-heading]]:ps-2 ds:[&_[cmdk-group-heading]]:pe-2 ds:[&_[cmdk-group-heading]]:py-1 ds:[&_[cmdk-group-heading]]:type-eyebrow ds:[&_[cmdk-group-heading]]:text-muted-foreground",
|
|
594
606
|
children: o
|
|
595
607
|
},
|
|
596
608
|
`group-${e}`
|
|
597
|
-
) : /* @__PURE__ */
|
|
609
|
+
) : /* @__PURE__ */ n(c.Group, { children: o }, `group-${s}`);
|
|
598
610
|
})
|
|
599
611
|
]
|
|
600
612
|
}
|
|
@@ -604,11 +616,11 @@ const Ze = {
|
|
|
604
616
|
] }) });
|
|
605
617
|
}
|
|
606
618
|
);
|
|
607
|
-
|
|
608
|
-
const
|
|
619
|
+
me.displayName = "MultiSelect";
|
|
620
|
+
const kt = me;
|
|
609
621
|
export {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
622
|
+
kt as M,
|
|
623
|
+
nt as a,
|
|
624
|
+
rt as m
|
|
613
625
|
};
|
|
614
|
-
//# sourceMappingURL=multi-select-
|
|
626
|
+
//# sourceMappingURL=multi-select-CC52Qws6.js.map
|