@alfadocs/ui-kit 0.17.0 → 0.17.2
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/{accordion-DOmxGEWU.js → accordion-CNcodXuO.js} +6 -6
- package/dist/_chunks/{ai-prompt-input-DEiQwIMn.js → ai-prompt-input-B-w5Rx3V.js} +184 -181
- package/dist/_chunks/{alert-pgdXrEO5.js → alert-DBnawbmf.js} +64 -59
- package/dist/_chunks/{audio-recorder-CRh4uyFL.js → audio-recorder-DNkQLW1G.js} +3 -3
- package/dist/_chunks/{autocomplete-mOg7WLOh.js → autocomplete-BxfabhZ8.js} +167 -164
- package/dist/_chunks/{balance-cell-renderer-DWWtX-VM.js → balance-cell-renderer-DJB6WDPe.js} +2 -2
- package/dist/_chunks/{carousel.agent-OTn-kMQg.js → carousel.agent-Xuw9LPZN.js} +14 -7
- package/dist/_chunks/{chat-input-UK-bXU7u.js → chat-input-B3XmFGDw.js} +123 -122
- package/dist/_chunks/checkbox-group-Bwmt1ovQ.js +213 -0
- package/dist/_chunks/{checkbox-D5EHnB14.js → checkbox-mwbrPZDY.js} +75 -70
- package/dist/_chunks/{collapsible-CuxUBoHJ.js → collapsible-hHiyZp0b.js} +61 -63
- package/dist/_chunks/{color-picker-BPfcByHH.js → color-picker-Bm-gzpsh.js} +2 -2
- package/dist/_chunks/{combobox-D5tWe0t_.js → combobox-Da9eq00i.js} +214 -211
- package/dist/_chunks/{copy-field-BCHAZ8QV.js → copy-field-BAF4mt9h.js} +95 -132
- package/dist/_chunks/{date-picker-BlhtBhPo.js → date-picker-BIoSLRly.js} +222 -219
- package/dist/_chunks/{date-range-picker-C2hRu_Ke.js → date-range-picker-9gANFNG9.js} +81 -78
- package/dist/_chunks/{date-time-picker-B67mPZmP.js → date-time-picker-DG7BiGdb.js} +98 -95
- package/dist/_chunks/{dialog-DRp6Dejy.js → dialog-DUomPCRS.js} +69 -71
- package/dist/_chunks/{dropdown-menu-dyV7gHh_.js → dropdown-menu-DZxwF23X.js} +108 -110
- package/dist/_chunks/{freemium-paywall-BTEiVkes.js → freemium-paywall-DXc7XlGE.js} +98 -97
- package/dist/_chunks/{leo-sidebar-D3TuyH5_.js → leo-sidebar-DIsiTju3.js} +2 -2
- package/dist/_chunks/{list-DcjV0m5B.js → list-BdvDctBz.js} +184 -180
- package/dist/_chunks/{message-tray-Fsend-du.js → message-tray-BNAS8al4.js} +111 -111
- package/dist/_chunks/{multi-select-DooDzQIp.js → multi-select-CyspR5ZF.js} +157 -154
- package/dist/_chunks/{navigation-menu-DdufF-_4.js → navigation-menu-CyS1fBJ7.js} +85 -87
- package/dist/_chunks/{notification-tray-C3dYdLAF.js → notification-tray-D_69dXFY.js} +114 -114
- package/dist/_chunks/{number-input-DH00o0DN.js → number-input-BZXu6bPY.js} +92 -89
- package/dist/_chunks/{otp-input-BBXYvLx5.js → otp-input-BDF_iNpa.js} +92 -93
- package/dist/_chunks/{pagination-F1ei4khE.js → pagination-BWaXF7W0.js} +194 -211
- package/dist/_chunks/{patient-shell-BE0CdPOJ.js → patient-shell-BOOaWZA9.js} +3 -3
- package/dist/_chunks/{payment-form-CI77oIx1.js → payment-form-BjkuQeqR.js} +2 -2
- package/dist/_chunks/{pdf-viewer-CnEJvmXC.js → pdf-viewer-BG_nsFT5.js} +2 -2
- package/dist/_chunks/{public-header.agent-sDi9N9su.js → public-header.agent-BIBQzkeV.js} +7 -12
- package/dist/_chunks/{radio-group-Cz1a4QCA.js → radio-group-BHZOxrIK.js} +4 -4
- package/dist/_chunks/{select-Ca6ibiDL.js → select-C92AT_OZ.js} +7 -7
- package/dist/_chunks/{sidebar-D8Lq065m.js → sidebar-BqzlRBvC.js} +271 -291
- package/dist/_chunks/{slider-CkR6CLun.js → slider-CfEzeseL.js} +4 -4
- package/dist/_chunks/{tabs-CRCyPpJo.js → tabs-aEQfQV3x.js} +8 -8
- package/dist/_chunks/{theme-toggle-B3meAb3y.js → theme-toggle-BswYl0Yp.js} +2 -2
- package/dist/_chunks/use-controllable-state-BiY4xTzM.js +23 -0
- package/dist/_chunks/use-copy-to-clipboard-Cyfc_dlv.js +43 -0
- package/dist/_chunks/use-persistent-state-i23OWy6G.js +24 -0
- package/dist/_chunks/{warning-stack-CeRihME9.js → warning-stack-CDH9TudY.js} +2 -2
- package/dist/_chunks/{workflow-map-D3MvrsZV.js → workflow-map-BeKe23uw.js} +3 -3
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/use-debounced-callback.d.ts +1 -5
- package/dist/components/_shared/use-direction.d.ts +1 -18
- package/dist/components/_shared/use-focus-trap.d.ts +1 -31
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/ai-prompt-input/index.js +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/carousel/index.js +1 -1
- package/dist/components/chat-input/index.js +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/command-palette/command-palette.d.ts +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/icon-button-group/icon-button-group.d.ts +14 -14
- package/dist/components/list/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/navigation-menu/index.js +1 -1
- package/dist/components/notification-tray/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/public-header/index.js +1 -1
- package/dist/components/public-header/public-header.d.ts +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/sidebar/index.js +8 -7
- package/dist/components/sidebar/sidebar.d.ts +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.js +98 -15
- package/dist/hooks/use-debounced-callback.d.ts +19 -0
- package/dist/hooks/use-debounced-value.d.ts +16 -0
- package/dist/hooks/use-direction.d.ts +19 -0
- package/dist/hooks/use-focus-trap.d.ts +32 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +13 -0
- package/dist/hooks/use-persistent-state.d.ts +16 -0
- package/dist/index.js +493 -492
- package/dist/patterns/leo-assistant/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +4 -2
- package/dist/_chunks/checkbox-group-Qkm3Rg1S.js +0 -208
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx as n, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import * as
|
|
2
|
+
import { forwardRef as qe, useContext as Me, useState as K, useRef as I, useMemo as F, useEffect as U, useCallback as Pe, useLayoutEffect as je } from "react";
|
|
3
|
+
import * as D from "@radix-ui/react-popover";
|
|
4
4
|
import { _ as u } from "./index-4xgbg-sn.js";
|
|
5
|
-
import { c as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { u as
|
|
8
|
-
import { T as
|
|
9
|
-
import { c as
|
|
5
|
+
import { c as de } from "./index-D2ZczOXr.js";
|
|
6
|
+
import { useTranslation as $e } from "react-i18next";
|
|
7
|
+
import { u as Be, F as Ke } from "./form-field-context-B3APVHKx.js";
|
|
8
|
+
import { T as oe } from "./tooltip-DHik5yRI.js";
|
|
9
|
+
import { c as Ue } from "./compose-refs-C0k0tdqF.js";
|
|
10
|
+
import { u as Qe } from "./use-controllable-state-BiY4xTzM.js";
|
|
10
11
|
import { g as Ye } from "./group-options-BvKhQ3xb.js";
|
|
11
|
-
import { b as
|
|
12
|
+
import { b as Q, c as Ge } from "./input-surface-xyERuLU_.js";
|
|
12
13
|
import { u as He } from "./registry-C9nwlNyL.js";
|
|
13
14
|
import { X as Xe } from "./x-CCcI3eJp.js";
|
|
14
15
|
import { C as Je } from "./check-DPdL_Sm7.js";
|
|
@@ -83,7 +84,7 @@ const We = {
|
|
|
83
84
|
description: "Each option emits its value as data-option-id."
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
}, Ze =
|
|
87
|
+
}, Ze = de(
|
|
87
88
|
[
|
|
88
89
|
"ds:inline-flex ds:flex-wrap ds:items-center ds:gap-1 ds:w-full",
|
|
89
90
|
Ge,
|
|
@@ -93,14 +94,14 @@ const We = {
|
|
|
93
94
|
{
|
|
94
95
|
variants: {
|
|
95
96
|
size: {
|
|
96
|
-
sm: `ds:min-h-8 ds:ps-2 ds:pe-2 ds:py-1 ${
|
|
97
|
-
md: `ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:py-1.5 ${
|
|
98
|
-
lg: `ds:min-h-12 ds:ps-4 ds:pe-4 ds:py-2 ${
|
|
97
|
+
sm: `ds:min-h-8 ds:ps-2 ds:pe-2 ds:py-1 ${Q.sm}`,
|
|
98
|
+
md: `ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:py-1.5 ${Q.md}`,
|
|
99
|
+
lg: `ds:min-h-12 ds:ps-4 ds:pe-4 ds:py-2 ${Q.lg}`
|
|
99
100
|
}
|
|
100
101
|
},
|
|
101
102
|
defaultVariants: { size: "md" }
|
|
102
103
|
}
|
|
103
|
-
),
|
|
104
|
+
), ie = de(
|
|
104
105
|
[
|
|
105
106
|
"ds:inline-flex ds:items-center ds:gap-1",
|
|
106
107
|
"ds:rounded-[var(--radius-sm)] ds:border ds:border-border ds:bg-muted",
|
|
@@ -147,98 +148,100 @@ const We = {
|
|
|
147
148
|
"ds:data-[selected=true]:bg-muted ds:data-[selected=true]:text-foreground",
|
|
148
149
|
"ds:aria-[disabled=true]:pointer-events-none ds:aria-[disabled=true]:opacity-50",
|
|
149
150
|
"ds:data-[disabled=true]:pointer-events-none ds:data-[disabled=true]:opacity-50"
|
|
150
|
-
].join(" "),
|
|
151
|
+
].join(" "), ae = [
|
|
151
152
|
"ds:relative ds:flex ds:cursor-pointer ds:items-center",
|
|
152
153
|
"ds:rounded-[var(--radius-sm)] ds:ps-2 ds:pe-2 ds:py-1.5",
|
|
153
154
|
"ds:text-[var(--font-size-sm)] ds:font-medium ds:text-primary ds:outline-none ds:select-none",
|
|
154
155
|
"ds:data-[selected=true]:bg-muted"
|
|
155
|
-
].join(" "), rt = "__ui-multiselect-select-all__", nt = "__ui-multiselect-clear-all__",
|
|
156
|
+
].join(" "), rt = "__ui-multiselect-select-all__", nt = "__ui-multiselect-clear-all__", le = qe(
|
|
156
157
|
function({
|
|
157
158
|
options: c,
|
|
158
|
-
value:
|
|
159
|
-
defaultValue:
|
|
160
|
-
onChange:
|
|
161
|
-
onComplete:
|
|
162
|
-
placeholder:
|
|
163
|
-
maxSelections:
|
|
164
|
-
allowSelectAll:
|
|
165
|
-
allowClear:
|
|
166
|
-
filter:
|
|
167
|
-
size:
|
|
168
|
-
disabled:
|
|
169
|
-
className:
|
|
170
|
-
id:
|
|
159
|
+
value: ce,
|
|
160
|
+
defaultValue: ue,
|
|
161
|
+
onChange: fe,
|
|
162
|
+
onComplete: L,
|
|
163
|
+
placeholder: me,
|
|
164
|
+
maxSelections: v,
|
|
165
|
+
allowSelectAll: Y = !1,
|
|
166
|
+
allowClear: G = !1,
|
|
167
|
+
filter: O,
|
|
168
|
+
size: R = "md",
|
|
169
|
+
disabled: pe,
|
|
170
|
+
className: he,
|
|
171
|
+
id: z,
|
|
171
172
|
...ge
|
|
172
|
-
},
|
|
173
|
-
const { t: f } =
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
}, ve) {
|
|
174
|
+
const { t: f } = $e(), b = Be(), k = Me(Ke) !== null, [be, q] = Qe({
|
|
175
|
+
value: ce,
|
|
176
|
+
defaultValue: ue ?? [],
|
|
177
|
+
onChange: fe
|
|
178
|
+
}), r = be ?? [], [C, m] = K(!1), [p, M] = K(""), y = I(null), w = I([]), H = I(null), ye = Ue(ve, H), g = k && b.disabled || !!pe, we = k && b.required, X = k && b.invalid, xe = k && b.describedBy ? b.describedBy : void 0, Ie = z ?? (k ? b.id : void 0), ke = F(() => {
|
|
176
179
|
const e = /* @__PURE__ */ new Map();
|
|
177
180
|
for (const t of c) e.set(t.value, t.label);
|
|
178
181
|
return e;
|
|
179
|
-
}, [c]),
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
+
}, [c]), J = typeof v == "number" && r.length >= v, S = (e) => {
|
|
183
|
+
q(e);
|
|
184
|
+
}, Ce = (e) => {
|
|
182
185
|
if (r.includes(e)) {
|
|
183
|
-
|
|
186
|
+
S(r.filter((t) => t !== e));
|
|
184
187
|
return;
|
|
185
188
|
}
|
|
186
|
-
|
|
187
|
-
},
|
|
189
|
+
J || S([...r, e]);
|
|
190
|
+
}, P = (e) => {
|
|
188
191
|
const t = r.filter((s, o) => o !== e);
|
|
189
|
-
return
|
|
190
|
-
},
|
|
191
|
-
const e = c.filter((s) => !s.disabled).map((s) => s.value), t = typeof
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
return S(t), t;
|
|
193
|
+
}, Se = () => {
|
|
194
|
+
const e = c.filter((s) => !s.disabled).map((s) => s.value), t = typeof v == "number" ? v : e.length;
|
|
195
|
+
S(e.slice(0, t));
|
|
196
|
+
}, Ae = () => {
|
|
197
|
+
S([]);
|
|
198
|
+
}, W = I(r);
|
|
199
|
+
U(() => {
|
|
200
|
+
W.current = r;
|
|
198
201
|
}, [r]);
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
+
const Z = I(p);
|
|
203
|
+
U(() => {
|
|
204
|
+
Z.current = p;
|
|
202
205
|
}, [p]);
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}, [
|
|
207
|
-
const
|
|
206
|
+
const ee = I(C);
|
|
207
|
+
U(() => {
|
|
208
|
+
ee.current = C;
|
|
209
|
+
}, [C]);
|
|
210
|
+
const j = Pe(
|
|
208
211
|
(e) => {
|
|
209
|
-
|
|
212
|
+
q(e);
|
|
210
213
|
},
|
|
211
|
-
[
|
|
212
|
-
),
|
|
214
|
+
[q]
|
|
215
|
+
), Ne = F(
|
|
213
216
|
() => ({
|
|
214
|
-
getSelection: () => [...
|
|
215
|
-
getQuery: () =>
|
|
216
|
-
getIsOpen: () =>
|
|
217
|
-
setSelection: (e) =>
|
|
218
|
-
clearSelection: () =>
|
|
219
|
-
setQuery: (e) =>
|
|
217
|
+
getSelection: () => [...W.current],
|
|
218
|
+
getQuery: () => Z.current,
|
|
219
|
+
getIsOpen: () => ee.current,
|
|
220
|
+
setSelection: (e) => j(e),
|
|
221
|
+
clearSelection: () => j([]),
|
|
222
|
+
setQuery: (e) => M(e),
|
|
220
223
|
open: () => m(!0),
|
|
221
224
|
close: () => m(!1)
|
|
222
225
|
}),
|
|
223
|
-
[
|
|
226
|
+
[j]
|
|
224
227
|
);
|
|
225
|
-
He(We,
|
|
226
|
-
const
|
|
228
|
+
He(We, Ne, z);
|
|
229
|
+
const te = me ?? f("inputs.multiSelect.placeholder", "Select…"), se = F(() => {
|
|
227
230
|
if (!p) return c;
|
|
228
231
|
const e = p.toLowerCase();
|
|
229
|
-
return c.filter((t) =>
|
|
230
|
-
}, [c, p,
|
|
231
|
-
() => Ye(
|
|
232
|
-
[
|
|
233
|
-
),
|
|
232
|
+
return c.filter((t) => O ? O(p, t) : t.label.toLowerCase().includes(e));
|
|
233
|
+
}, [c, p, O]), _e = F(
|
|
234
|
+
() => Ye(se),
|
|
235
|
+
[se]
|
|
236
|
+
), Re = (e) => {
|
|
234
237
|
var o;
|
|
235
238
|
const t = e.currentTarget;
|
|
236
239
|
if (e.key === "Backspace" && p === "" && r.length > 0) {
|
|
237
240
|
e.preventDefault();
|
|
238
|
-
const a = r.length - 1, l =
|
|
241
|
+
const a = r.length - 1, l = P(a).length - 1;
|
|
239
242
|
l >= 0 && requestAnimationFrame(() => {
|
|
240
243
|
var h;
|
|
241
|
-
(h =
|
|
244
|
+
(h = w.current[l]) == null || h.focus();
|
|
242
245
|
});
|
|
243
246
|
return;
|
|
244
247
|
}
|
|
@@ -248,7 +251,7 @@ const We = {
|
|
|
248
251
|
if (a && e.key === "ArrowRight" || !a && e.key === "ArrowLeft") {
|
|
249
252
|
e.preventDefault();
|
|
250
253
|
const l = r.length - 1;
|
|
251
|
-
(o =
|
|
254
|
+
(o = w.current[l]) == null || o.focus();
|
|
252
255
|
}
|
|
253
256
|
return;
|
|
254
257
|
}
|
|
@@ -256,50 +259,50 @@ const We = {
|
|
|
256
259
|
m(!1);
|
|
257
260
|
return;
|
|
258
261
|
}
|
|
259
|
-
!
|
|
260
|
-
},
|
|
261
|
-
var d, l, h,
|
|
262
|
+
!C && (e.key === "ArrowDown" || e.key === "Enter") && m(!0);
|
|
263
|
+
}, Te = (e) => (t) => {
|
|
264
|
+
var d, l, h, N;
|
|
262
265
|
if (t.key === "Backspace" || t.key === "Delete" || t.key === "Enter" || t.key === " ") {
|
|
263
266
|
t.preventDefault(), t.stopPropagation();
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
267
|
+
const V = P(e);
|
|
268
|
+
if (V.length === 0) {
|
|
266
269
|
requestAnimationFrame(() => {
|
|
267
|
-
var
|
|
268
|
-
return (
|
|
270
|
+
var _;
|
|
271
|
+
return (_ = y.current) == null ? void 0 : _.focus();
|
|
269
272
|
});
|
|
270
273
|
return;
|
|
271
274
|
}
|
|
272
|
-
const
|
|
275
|
+
const ze = Math.min(e, V.length - 1);
|
|
273
276
|
requestAnimationFrame(() => {
|
|
274
|
-
var
|
|
275
|
-
(
|
|
277
|
+
var _;
|
|
278
|
+
(_ = w.current[ze]) == null || _.focus();
|
|
276
279
|
});
|
|
277
280
|
return;
|
|
278
281
|
}
|
|
279
282
|
const s = document.dir === "rtl", o = s ? "ArrowRight" : "ArrowLeft", a = s ? "ArrowLeft" : "ArrowRight";
|
|
280
283
|
if (t.key === o) {
|
|
281
284
|
t.preventDefault();
|
|
282
|
-
const
|
|
283
|
-
(d =
|
|
285
|
+
const V = Math.max(0, e - 1);
|
|
286
|
+
(d = w.current[V]) == null || d.focus();
|
|
284
287
|
return;
|
|
285
288
|
}
|
|
286
289
|
if (t.key === a) {
|
|
287
|
-
t.preventDefault(), e < r.length - 1 ? (l =
|
|
290
|
+
t.preventDefault(), e < r.length - 1 ? (l = w.current[e + 1]) == null || l.focus() : (h = y.current) == null || h.focus();
|
|
288
291
|
return;
|
|
289
292
|
}
|
|
290
|
-
t.key === "Escape" && (m(!1), (
|
|
291
|
-
}, [
|
|
293
|
+
t.key === "Escape" && (m(!1), (N = y.current) == null || N.focus());
|
|
294
|
+
}, [T, $] = K(
|
|
292
295
|
Number.POSITIVE_INFINITY
|
|
293
296
|
);
|
|
294
|
-
|
|
295
|
-
const e =
|
|
297
|
+
je(() => {
|
|
298
|
+
const e = H.current;
|
|
296
299
|
if (!e) return;
|
|
297
300
|
const t = () => {
|
|
298
301
|
const o = Array.from(
|
|
299
302
|
e.querySelectorAll('[data-ui-chip="true"]')
|
|
300
303
|
);
|
|
301
304
|
if (o.length === 0) {
|
|
302
|
-
|
|
305
|
+
$(Number.POSITIVE_INFINITY);
|
|
303
306
|
return;
|
|
304
307
|
}
|
|
305
308
|
const a = o[0].offsetTop;
|
|
@@ -307,57 +310,57 @@ const We = {
|
|
|
307
310
|
for (const l of o)
|
|
308
311
|
if (l.offsetTop === a) d++;
|
|
309
312
|
else break;
|
|
310
|
-
d === o.length ?
|
|
313
|
+
d === o.length ? $(Number.POSITIVE_INFINITY) : $(Math.max(1, d - 1));
|
|
311
314
|
};
|
|
312
315
|
t();
|
|
313
316
|
const s = new ResizeObserver(t);
|
|
314
317
|
return s.observe(e), () => s.disconnect();
|
|
315
|
-
}, [r.length,
|
|
316
|
-
const
|
|
318
|
+
}, [r.length, R]);
|
|
319
|
+
const E = r.map((e) => ({
|
|
317
320
|
value: e,
|
|
318
|
-
label:
|
|
319
|
-
})),
|
|
321
|
+
label: ke.get(e) ?? e
|
|
322
|
+
})), re = T === Number.POSITIVE_INFINITY || T >= E.length, Ee = re ? E : E.slice(0, T), ne = re ? [] : E.slice(T), A = ne.length, Ve = (e) => {
|
|
320
323
|
var s;
|
|
321
324
|
if (g) return;
|
|
322
325
|
const t = e.target;
|
|
323
|
-
t.closest('[data-ui-chip="true"]') || t.closest('[data-ui-chip-dismiss="true"]') || (m(!0), (s =
|
|
324
|
-
},
|
|
326
|
+
t.closest('[data-ui-chip="true"]') || t.closest('[data-ui-chip-dismiss="true"]') || (m(!0), (s = y.current) == null || s.focus());
|
|
327
|
+
}, Fe = (e) => {
|
|
325
328
|
if (g) {
|
|
326
329
|
m(!1);
|
|
327
330
|
return;
|
|
328
331
|
}
|
|
329
|
-
m(e), e || (
|
|
330
|
-
},
|
|
332
|
+
m(e), e || (M(""), L == null || L(r));
|
|
333
|
+
}, De = Y || G, Le = f("inputs.multiSelect.selected", {
|
|
331
334
|
count: r.length,
|
|
332
335
|
defaultValue: `${r.length} selected`
|
|
333
|
-
}), { onClick:
|
|
334
|
-
return /* @__PURE__ */ n(u, { shouldFilter: !1, label:
|
|
335
|
-
/* @__PURE__ */ n(
|
|
336
|
+
}), { onClick: B, ...Oe } = ge;
|
|
337
|
+
return /* @__PURE__ */ n(u, { shouldFilter: !1, label: Le, children: /* @__PURE__ */ x(D.Root, { open: C, onOpenChange: Fe, children: [
|
|
338
|
+
/* @__PURE__ */ n(D.Anchor, { asChild: !0, children: /* @__PURE__ */ x(
|
|
336
339
|
"div",
|
|
337
340
|
{
|
|
338
|
-
ref:
|
|
339
|
-
className: Ze({ size:
|
|
341
|
+
ref: ye,
|
|
342
|
+
className: Ze({ size: R, className: he }),
|
|
340
343
|
"aria-disabled": g || void 0,
|
|
341
|
-
"aria-invalid":
|
|
344
|
+
"aria-invalid": X || void 0,
|
|
342
345
|
"data-component": "multi-select",
|
|
343
|
-
"data-component-id":
|
|
346
|
+
"data-component-id": z,
|
|
344
347
|
onClick: (e) => {
|
|
345
|
-
|
|
348
|
+
B == null || B(e), Ve(e);
|
|
346
349
|
},
|
|
347
|
-
...
|
|
350
|
+
...Oe,
|
|
348
351
|
children: [
|
|
349
|
-
|
|
352
|
+
Ee.map((e, t) => (
|
|
350
353
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- chip pill receives focus via roving tabindex; chip removal uses an inner button
|
|
351
354
|
/* @__PURE__ */ x(
|
|
352
355
|
"span",
|
|
353
356
|
{
|
|
354
357
|
ref: (s) => {
|
|
355
|
-
|
|
358
|
+
w.current[t] = s;
|
|
356
359
|
},
|
|
357
360
|
tabIndex: g ? -1 : 0,
|
|
358
361
|
"data-ui-chip": "true",
|
|
359
|
-
className:
|
|
360
|
-
onKeyDown:
|
|
362
|
+
className: ie({ size: R }),
|
|
363
|
+
onKeyDown: Te(t),
|
|
361
364
|
"aria-label": e.label,
|
|
362
365
|
children: [
|
|
363
366
|
/* @__PURE__ */ n("span", { children: e.label }),
|
|
@@ -373,9 +376,9 @@ const We = {
|
|
|
373
376
|
}),
|
|
374
377
|
disabled: g,
|
|
375
378
|
onClick: (s) => {
|
|
376
|
-
s.stopPropagation(),
|
|
379
|
+
s.stopPropagation(), P(t), requestAnimationFrame(() => {
|
|
377
380
|
var o;
|
|
378
|
-
return (o =
|
|
381
|
+
return (o = y.current) == null ? void 0 : o.focus();
|
|
379
382
|
});
|
|
380
383
|
},
|
|
381
384
|
className: et,
|
|
@@ -387,24 +390,24 @@ const We = {
|
|
|
387
390
|
e.value
|
|
388
391
|
)
|
|
389
392
|
)),
|
|
390
|
-
|
|
391
|
-
|
|
393
|
+
A > 0 ? /* @__PURE__ */ n(
|
|
394
|
+
oe,
|
|
392
395
|
{
|
|
393
|
-
label:
|
|
396
|
+
label: ne.map((e) => e.label).join(", "),
|
|
394
397
|
delayDuration: 200,
|
|
395
398
|
children: /* @__PURE__ */ n(
|
|
396
399
|
"span",
|
|
397
400
|
{
|
|
398
|
-
className:
|
|
401
|
+
className: ie({ size: R }),
|
|
399
402
|
tabIndex: 0,
|
|
400
403
|
role: "button",
|
|
401
404
|
"aria-label": f("inputs.multiSelect.overflow", {
|
|
402
|
-
count:
|
|
403
|
-
defaultValue: `+${
|
|
405
|
+
count: A,
|
|
406
|
+
defaultValue: `+${A} more`
|
|
404
407
|
}),
|
|
405
408
|
children: /* @__PURE__ */ n("span", { children: f("inputs.multiSelect.overflow", {
|
|
406
|
-
count:
|
|
407
|
-
defaultValue: `+${
|
|
409
|
+
count: A,
|
|
410
|
+
defaultValue: `+${A} more`
|
|
408
411
|
}) })
|
|
409
412
|
}
|
|
410
413
|
)
|
|
@@ -413,18 +416,18 @@ const We = {
|
|
|
413
416
|
/* @__PURE__ */ n(
|
|
414
417
|
u.Input,
|
|
415
418
|
{
|
|
416
|
-
ref:
|
|
419
|
+
ref: y,
|
|
417
420
|
value: p,
|
|
418
|
-
onValueChange:
|
|
419
|
-
onKeyDown:
|
|
421
|
+
onValueChange: M,
|
|
422
|
+
onKeyDown: Re,
|
|
420
423
|
onFocus: () => {
|
|
421
424
|
g || m(!0);
|
|
422
425
|
},
|
|
423
|
-
placeholder: r.length === 0 ?
|
|
424
|
-
id:
|
|
426
|
+
placeholder: r.length === 0 ? te : "",
|
|
427
|
+
id: Ie,
|
|
425
428
|
"aria-describedby": xe,
|
|
426
|
-
"aria-invalid":
|
|
427
|
-
"aria-required":
|
|
429
|
+
"aria-invalid": X || void 0,
|
|
430
|
+
"aria-required": we || void 0,
|
|
428
431
|
disabled: g,
|
|
429
432
|
className: [
|
|
430
433
|
"ds:flex-1 ds:min-w-[6rem] ds:bg-transparent ds:outline-none",
|
|
@@ -436,8 +439,8 @@ const We = {
|
|
|
436
439
|
]
|
|
437
440
|
}
|
|
438
441
|
) }),
|
|
439
|
-
/* @__PURE__ */ n(
|
|
440
|
-
|
|
442
|
+
/* @__PURE__ */ n(D.Portal, { children: /* @__PURE__ */ n(
|
|
443
|
+
D.Content,
|
|
441
444
|
{
|
|
442
445
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
443
446
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
@@ -449,39 +452,39 @@ const We = {
|
|
|
449
452
|
{
|
|
450
453
|
role: "listbox",
|
|
451
454
|
"aria-multiselectable": "true",
|
|
452
|
-
"aria-label":
|
|
455
|
+
"aria-label": te,
|
|
453
456
|
className: "ds:max-h-[20rem] ds:overflow-y-auto ds:p-1",
|
|
454
457
|
children: [
|
|
455
|
-
|
|
456
|
-
|
|
458
|
+
De ? /* @__PURE__ */ x(u.Group, { children: [
|
|
459
|
+
Y ? /* @__PURE__ */ n(
|
|
457
460
|
u.Item,
|
|
458
461
|
{
|
|
459
462
|
value: rt,
|
|
460
|
-
onSelect:
|
|
461
|
-
className:
|
|
463
|
+
onSelect: Se,
|
|
464
|
+
className: ae,
|
|
462
465
|
children: f("inputs.multiSelect.selectAll", "Select all")
|
|
463
466
|
}
|
|
464
467
|
) : null,
|
|
465
|
-
|
|
468
|
+
G ? /* @__PURE__ */ n(
|
|
466
469
|
u.Item,
|
|
467
470
|
{
|
|
468
471
|
value: nt,
|
|
469
|
-
onSelect:
|
|
470
|
-
className:
|
|
472
|
+
onSelect: Ae,
|
|
473
|
+
className: ae,
|
|
471
474
|
children: f("inputs.multiSelect.clearAll", "Clear all")
|
|
472
475
|
}
|
|
473
476
|
) : null
|
|
474
477
|
] }) : null,
|
|
475
478
|
/* @__PURE__ */ n(u.Empty, { className: "ds:ps-2 ds:pe-2 ds:py-2 type-body-sm ds:text-muted-foreground", children: f("inputs.multiSelect.noOptions", "No options found") }),
|
|
476
|
-
|
|
479
|
+
_e.map(({ group: e, items: t }, s) => {
|
|
477
480
|
const o = t.map((a) => {
|
|
478
|
-
const d = r.includes(a.value), l = !d &&
|
|
481
|
+
const d = r.includes(a.value), l = !d && J, h = !!a.disabled || l, N = /* @__PURE__ */ x(
|
|
479
482
|
u.Item,
|
|
480
483
|
{
|
|
481
484
|
value: a.value,
|
|
482
485
|
disabled: h,
|
|
483
486
|
onSelect: () => {
|
|
484
|
-
h ||
|
|
487
|
+
h || Ce(a.value);
|
|
485
488
|
},
|
|
486
489
|
"aria-selected": d,
|
|
487
490
|
"aria-disabled": h || void 0,
|
|
@@ -505,17 +508,17 @@ const We = {
|
|
|
505
508
|
a.value
|
|
506
509
|
);
|
|
507
510
|
return l ? /* @__PURE__ */ n(
|
|
508
|
-
|
|
511
|
+
oe,
|
|
509
512
|
{
|
|
510
513
|
label: f("inputs.multiSelect.maxReached", {
|
|
511
|
-
count:
|
|
512
|
-
defaultValue: `Maximum ${
|
|
514
|
+
count: v,
|
|
515
|
+
defaultValue: `Maximum ${v} selections`
|
|
513
516
|
}),
|
|
514
517
|
delayDuration: 200,
|
|
515
|
-
children:
|
|
518
|
+
children: N
|
|
516
519
|
},
|
|
517
520
|
a.value
|
|
518
|
-
) :
|
|
521
|
+
) : N;
|
|
519
522
|
});
|
|
520
523
|
return e ? /* @__PURE__ */ n(
|
|
521
524
|
u.Group,
|
|
@@ -535,11 +538,11 @@ const We = {
|
|
|
535
538
|
] }) });
|
|
536
539
|
}
|
|
537
540
|
);
|
|
538
|
-
|
|
539
|
-
const
|
|
541
|
+
le.displayName = "MultiSelect";
|
|
542
|
+
const yt = le;
|
|
540
543
|
export {
|
|
541
|
-
|
|
544
|
+
yt as M,
|
|
542
545
|
Ze as a,
|
|
543
546
|
We as m
|
|
544
547
|
};
|
|
545
|
-
//# sourceMappingURL=multi-select-
|
|
548
|
+
//# sourceMappingURL=multi-select-CyspR5ZF.js.map
|