@alfadocs/ui-kit 0.17.1 → 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/{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/{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/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/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,35 +1,36 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import * as
|
|
4
|
-
import { R as
|
|
5
|
-
import { c as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { u as
|
|
8
|
-
import { c as
|
|
9
|
-
import { n as
|
|
10
|
-
import { g as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
1
|
+
import { jsx as o, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as je, useContext as Ae, useMemo as U, useState as oe, useRef as g, useLayoutEffect as Te, useEffect as I, useCallback as $e } from "react";
|
|
3
|
+
import * as _ from "@radix-ui/react-popover";
|
|
4
|
+
import { R as ke, _ as c, P as Oe } from "./index-4xgbg-sn.js";
|
|
5
|
+
import { c as E } from "./index-D2ZczOXr.js";
|
|
6
|
+
import { useTranslation as qe } from "react-i18next";
|
|
7
|
+
import { u as Be, F as Ue } from "./form-field-context-B3APVHKx.js";
|
|
8
|
+
import { c as He } from "./compose-refs-C0k0tdqF.js";
|
|
9
|
+
import { n as H } from "./normalize-diacritics-BNGbFNlJ.js";
|
|
10
|
+
import { g as Ge } from "./group-options-BvKhQ3xb.js";
|
|
11
|
+
import { u as Me } from "./use-controllable-state-BiY4xTzM.js";
|
|
12
|
+
import { I as Le, a as G, d as M, c as Qe } from "./input-surface-xyERuLU_.js";
|
|
13
|
+
import { u as Ke } from "./registry-C9nwlNyL.js";
|
|
14
|
+
import { X as Xe } from "./x-CCcI3eJp.js";
|
|
15
|
+
import { C as We } from "./check-DPdL_Sm7.js";
|
|
16
|
+
const Je = {
|
|
16
17
|
id: "combobox",
|
|
17
18
|
capabilities: ["select_single", "pick", "filter", "open", "close"],
|
|
18
19
|
state: {
|
|
19
20
|
value: {
|
|
20
21
|
type: "string | null",
|
|
21
22
|
description: "Currently-selected option value, or null when nothing is selected.",
|
|
22
|
-
read: (
|
|
23
|
+
read: (t) => t.getValue()
|
|
23
24
|
},
|
|
24
25
|
query: {
|
|
25
26
|
type: "string",
|
|
26
27
|
description: "Current filter query in the combobox input.",
|
|
27
|
-
read: (
|
|
28
|
+
read: (t) => t.getQuery()
|
|
28
29
|
},
|
|
29
30
|
isOpen: {
|
|
30
31
|
type: "boolean",
|
|
31
32
|
description: "True when the option list is visible.",
|
|
32
|
-
read: (
|
|
33
|
+
read: (t) => t.getIsOpen()
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
36
|
actions: {
|
|
@@ -37,37 +38,37 @@ const Ye = {
|
|
|
37
38
|
safety: "read",
|
|
38
39
|
argsType: "{ value: string | null }",
|
|
39
40
|
description: "Set the selected value programmatically.",
|
|
40
|
-
invoke: (
|
|
41
|
-
|
|
41
|
+
invoke: (t, r) => {
|
|
42
|
+
t.setValue(r.value);
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
apply_filter: {
|
|
45
46
|
safety: "read",
|
|
46
47
|
argsType: "{ query: string }",
|
|
47
48
|
description: "Set the filter query for the option list.",
|
|
48
|
-
invoke: (
|
|
49
|
-
|
|
49
|
+
invoke: (t, r) => {
|
|
50
|
+
t.setQuery(r.query);
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
53
|
clear_selection: {
|
|
53
54
|
safety: "read",
|
|
54
55
|
description: "Clear the current selection.",
|
|
55
|
-
invoke: (
|
|
56
|
-
|
|
56
|
+
invoke: (t) => {
|
|
57
|
+
t.clear();
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
60
|
open: {
|
|
60
61
|
safety: "read",
|
|
61
62
|
description: "Open the option list.",
|
|
62
|
-
invoke: (
|
|
63
|
-
|
|
63
|
+
invoke: (t) => {
|
|
64
|
+
t.open();
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
close: {
|
|
67
68
|
safety: "read",
|
|
68
69
|
description: "Close the option list.",
|
|
69
|
-
invoke: (
|
|
70
|
-
|
|
70
|
+
invoke: (t) => {
|
|
71
|
+
t.close();
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
},
|
|
@@ -83,7 +84,7 @@ const Ye = {
|
|
|
83
84
|
description: "Each option emits its value as data-option-id."
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
},
|
|
87
|
+
}, Ye = E(
|
|
87
88
|
[
|
|
88
89
|
"ds:peer ds:w-full ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground",
|
|
89
90
|
"ds:outline-none ds:border-0",
|
|
@@ -101,26 +102,26 @@ const Ye = {
|
|
|
101
102
|
size: "md"
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
),
|
|
105
|
+
), Ze = E(
|
|
105
106
|
[
|
|
106
107
|
"ds:group ds:relative ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)] ds:w-full",
|
|
107
|
-
|
|
108
|
+
Qe
|
|
108
109
|
].join(" "),
|
|
109
110
|
{
|
|
110
111
|
variants: {
|
|
111
112
|
size: {
|
|
112
|
-
sm: `${
|
|
113
|
-
md: `${
|
|
114
|
-
lg: `${
|
|
113
|
+
sm: `${G.sm} ${M.sm}`,
|
|
114
|
+
md: `${G.md} ${M.md}`,
|
|
115
|
+
lg: `${G.lg} ${M.lg}`
|
|
115
116
|
},
|
|
116
|
-
tone:
|
|
117
|
+
tone: Le
|
|
117
118
|
},
|
|
118
119
|
defaultVariants: {
|
|
119
120
|
size: "md",
|
|
120
121
|
tone: "default"
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
),
|
|
124
|
+
), et = E(
|
|
124
125
|
[
|
|
125
126
|
"ds:z-[var(--z-popover)] ds:overflow-hidden ds:w-[var(--radix-popover-trigger-width)]",
|
|
126
127
|
"ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:text-foreground",
|
|
@@ -132,7 +133,7 @@ const Ye = {
|
|
|
132
133
|
"ds:data-[side=top]:slide-in-from-bottom-2",
|
|
133
134
|
"ds:motion-reduce:animate-none"
|
|
134
135
|
].join(" ")
|
|
135
|
-
),
|
|
136
|
+
), ne = E(
|
|
136
137
|
[
|
|
137
138
|
"ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
138
139
|
"ds:rounded-[var(--radius-sm)]",
|
|
@@ -154,35 +155,35 @@ const Ye = {
|
|
|
154
155
|
size: "md"
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
),
|
|
158
|
+
), tt = [
|
|
158
159
|
"ds:ps-3 ds:pe-3 ds:py-1.5",
|
|
159
160
|
"type-eyebrow ds:text-muted-foreground"
|
|
160
|
-
].join(" "),
|
|
161
|
+
].join(" "), st = "ds:max-h-[18rem] ds:overflow-y-auto ds:p-[var(--spacing-xs)]", ot = "ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground", nt = {
|
|
161
162
|
sm: "ds:size-3.5",
|
|
162
163
|
md: "ds:size-4",
|
|
163
164
|
lg: "ds:size-5"
|
|
164
165
|
};
|
|
165
|
-
function
|
|
166
|
-
search:
|
|
166
|
+
function rt({
|
|
167
|
+
search: t,
|
|
167
168
|
label: r,
|
|
168
|
-
iconClass:
|
|
169
|
-
size:
|
|
170
|
-
onSelect:
|
|
169
|
+
iconClass: F,
|
|
170
|
+
size: V,
|
|
171
|
+
onSelect: D
|
|
171
172
|
}) {
|
|
172
|
-
return
|
|
173
|
-
|
|
173
|
+
return Oe((P) => P.filtered.count) > 0 ? null : /* @__PURE__ */ N(
|
|
174
|
+
c.Item,
|
|
174
175
|
{
|
|
175
|
-
value: `__combobox-create__${
|
|
176
|
+
value: `__combobox-create__${t}`,
|
|
176
177
|
keywords: [],
|
|
177
178
|
forceMount: !0,
|
|
178
|
-
onSelect: () =>
|
|
179
|
-
className:
|
|
179
|
+
onSelect: () => D(t),
|
|
180
|
+
className: ne({ size: V }),
|
|
180
181
|
children: [
|
|
181
182
|
/* @__PURE__ */ o(
|
|
182
183
|
"span",
|
|
183
184
|
{
|
|
184
185
|
"aria-hidden": "true",
|
|
185
|
-
className: `ds:inline-flex ds:items-center ds:justify-center ${
|
|
186
|
+
className: `ds:inline-flex ds:items-center ds:justify-center ${F}`
|
|
186
187
|
}
|
|
187
188
|
),
|
|
188
189
|
/* @__PURE__ */ o("span", { className: "ds:flex-1 ds:truncate", children: r })
|
|
@@ -190,169 +191,171 @@ function at({
|
|
|
190
191
|
}
|
|
191
192
|
);
|
|
192
193
|
}
|
|
193
|
-
const
|
|
194
|
+
const re = je(
|
|
194
195
|
function({
|
|
195
196
|
options: r,
|
|
196
|
-
value:
|
|
197
|
-
defaultValue:
|
|
198
|
-
onValueChange:
|
|
199
|
-
placeholder:
|
|
200
|
-
clearable:
|
|
201
|
-
disabled:
|
|
202
|
-
readOnly:
|
|
203
|
-
required:
|
|
204
|
-
name:
|
|
205
|
-
id:
|
|
206
|
-
size:
|
|
207
|
-
tone:
|
|
208
|
-
filter:
|
|
209
|
-
allowCreate:
|
|
210
|
-
onCreate:
|
|
211
|
-
open:
|
|
212
|
-
onOpenChange:
|
|
213
|
-
emptyMessage:
|
|
214
|
-
className:
|
|
215
|
-
"aria-label":
|
|
216
|
-
},
|
|
217
|
-
const { t:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
197
|
+
value: F,
|
|
198
|
+
defaultValue: V,
|
|
199
|
+
onValueChange: D,
|
|
200
|
+
placeholder: L,
|
|
201
|
+
clearable: P = !1,
|
|
202
|
+
disabled: ae,
|
|
203
|
+
readOnly: ie,
|
|
204
|
+
required: de,
|
|
205
|
+
name: le,
|
|
206
|
+
id: j,
|
|
207
|
+
size: v = "md",
|
|
208
|
+
tone: ce = "default",
|
|
209
|
+
filter: A,
|
|
210
|
+
allowCreate: ue = !1,
|
|
211
|
+
onCreate: T,
|
|
212
|
+
open: Q,
|
|
213
|
+
onOpenChange: u,
|
|
214
|
+
emptyMessage: me,
|
|
215
|
+
className: fe,
|
|
216
|
+
"aria-label": K
|
|
217
|
+
}, pe) {
|
|
218
|
+
const { t: x } = qe(), b = Be(), y = Ae(Ue) !== null, [be, z] = Me({
|
|
219
|
+
value: F,
|
|
220
|
+
defaultValue: V ?? "",
|
|
221
|
+
onChange: D
|
|
222
|
+
}), m = be ?? "", $ = U(
|
|
223
|
+
() => r.find((e) => e.value === m),
|
|
224
|
+
[r, m]
|
|
225
|
+
), C = ($ == null ? void 0 : $.label) ?? "", [f, i] = oe(C), [he, X] = oe(!1), S = Q !== void 0, d = S ? Q : he, R = g(!1), w = g(null), W = g(null);
|
|
226
|
+
Te(() => {
|
|
224
227
|
var e;
|
|
225
|
-
(e =
|
|
226
|
-
}),
|
|
227
|
-
d || i(
|
|
228
|
-
}, [
|
|
229
|
-
const
|
|
230
|
-
() => (e,
|
|
231
|
-
if (
|
|
232
|
-
const
|
|
233
|
-
return
|
|
234
|
-
|
|
228
|
+
(e = w.current) == null || e.setAttribute("aria-expanded", String(d));
|
|
229
|
+
}), I(() => {
|
|
230
|
+
d || i(C);
|
|
231
|
+
}, [C, d]);
|
|
232
|
+
const ge = j ?? (y ? b.id : void 0), k = (y ? b.disabled : !1) || !!ae, h = !!ie, ve = (y ? b.required : !1) || !!de, J = y ? b.invalid : !1, xe = J ? "error" : ce, ye = y && b.describedBy ? b.describedBy : void 0, Y = L ?? x("inputs.combobox.placeholder", "Search…"), Ce = U(
|
|
233
|
+
() => (e, s, n) => {
|
|
234
|
+
if (R.current) return 1;
|
|
235
|
+
const p = H(e), a = H(s), B = n == null ? void 0 : n.map(H);
|
|
236
|
+
return A ? A(p, a) : ke(
|
|
237
|
+
p,
|
|
235
238
|
a,
|
|
236
|
-
|
|
239
|
+
B
|
|
237
240
|
);
|
|
238
241
|
},
|
|
239
|
-
[
|
|
240
|
-
),
|
|
241
|
-
z
|
|
242
|
-
},
|
|
243
|
-
|
|
242
|
+
[A]
|
|
243
|
+
), Z = (e) => {
|
|
244
|
+
z(e);
|
|
245
|
+
}, l = (e) => {
|
|
246
|
+
S || X(e), u == null || u(e);
|
|
247
|
+
}, Ne = (e) => {
|
|
248
|
+
const s = r.find((n) => n.value === e);
|
|
249
|
+
Z(e), i((s == null ? void 0 : s.label) ?? ""), l(!1);
|
|
250
|
+
}, ze = (e) => {
|
|
251
|
+
T == null || T(e), l(!1);
|
|
244
252
|
}, Se = (e) => {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
k == null || k(e), c(!1);
|
|
249
|
-
}, Re = (e) => {
|
|
250
|
-
g || (i(e), !d && e.length > 0 && !w.current && c(!0));
|
|
253
|
+
h || (i(e), !d && e.length > 0 && !R.current && l(!0));
|
|
254
|
+
}, Re = () => {
|
|
255
|
+
!k && !h && l(!0);
|
|
251
256
|
}, we = () => {
|
|
252
|
-
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
R.current = !0;
|
|
258
|
+
}, Ie = () => {
|
|
259
|
+
var s;
|
|
260
|
+
if (R.current = !1, h) return;
|
|
261
|
+
const e = ((s = w.current) == null ? void 0 : s.value) ?? "";
|
|
262
|
+
i(e), e.length > 0 && l(!0);
|
|
263
|
+
}, _e = (e) => {
|
|
264
|
+
e.nativeEvent.isComposing || e.key === "Escape" && d && (e.preventDefault(), l(!1), i(C));
|
|
265
|
+
}, Ee = (e) => {
|
|
266
|
+
var s;
|
|
267
|
+
e.preventDefault(), e.stopPropagation(), Z(""), i(""), l(!0), (s = w.current) == null || s.focus();
|
|
260
268
|
}, Fe = (e) => {
|
|
261
|
-
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
oe.current = f;
|
|
269
|
+
h && e || (l(e), e || i(C));
|
|
270
|
+
}, ee = g(m);
|
|
271
|
+
I(() => {
|
|
272
|
+
ee.current = m;
|
|
273
|
+
}, [m]);
|
|
274
|
+
const te = g(f);
|
|
275
|
+
I(() => {
|
|
276
|
+
te.current = f;
|
|
270
277
|
}, [f]);
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}, [p]);
|
|
275
|
-
const re = v(d);
|
|
276
|
-
E(() => {
|
|
277
|
-
re.current = d;
|
|
278
|
+
const se = g(d);
|
|
279
|
+
I(() => {
|
|
280
|
+
se.current = d;
|
|
278
281
|
}, [d]);
|
|
279
|
-
const
|
|
282
|
+
const O = $e(
|
|
280
283
|
(e) => {
|
|
281
|
-
|
|
284
|
+
S || X(e), u == null || u(e);
|
|
282
285
|
},
|
|
283
|
-
[
|
|
284
|
-
),
|
|
286
|
+
[S, u]
|
|
287
|
+
), Ve = U(
|
|
285
288
|
() => ({
|
|
286
|
-
getValue: () =>
|
|
287
|
-
getQuery: () =>
|
|
288
|
-
getIsOpen: () =>
|
|
289
|
+
getValue: () => ee.current || null,
|
|
290
|
+
getQuery: () => te.current,
|
|
291
|
+
getIsOpen: () => se.current,
|
|
289
292
|
setValue: (e) => {
|
|
290
|
-
const
|
|
291
|
-
z
|
|
292
|
-
const n = r.find((
|
|
293
|
+
const s = e ?? "";
|
|
294
|
+
z(s);
|
|
295
|
+
const n = r.find((p) => p.value === s);
|
|
293
296
|
i((n == null ? void 0 : n.label) ?? "");
|
|
294
297
|
},
|
|
295
298
|
setQuery: (e) => {
|
|
296
299
|
i(e);
|
|
297
300
|
},
|
|
298
301
|
clear: () => {
|
|
299
|
-
z
|
|
302
|
+
z(""), i("");
|
|
300
303
|
},
|
|
301
|
-
open: () =>
|
|
302
|
-
close: () =>
|
|
304
|
+
open: () => O(!0),
|
|
305
|
+
close: () => O(!1)
|
|
303
306
|
}),
|
|
304
|
-
[
|
|
307
|
+
[z, r, O]
|
|
305
308
|
);
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
return /* @__PURE__ */ o(
|
|
309
|
-
|
|
309
|
+
Ke(Je, Ve, j);
|
|
310
|
+
const De = P && !!m && !k && !h, Pe = Ge(r), q = nt[v];
|
|
311
|
+
return /* @__PURE__ */ o(_.Root, { open: d, onOpenChange: Fe, children: /* @__PURE__ */ N(
|
|
312
|
+
c,
|
|
310
313
|
{
|
|
311
|
-
filter:
|
|
314
|
+
filter: Ce,
|
|
312
315
|
shouldFilter: !0,
|
|
313
316
|
loop: !0,
|
|
314
|
-
label:
|
|
317
|
+
label: K ?? Y,
|
|
315
318
|
className: "ds:w-full",
|
|
316
319
|
children: [
|
|
317
|
-
/* @__PURE__ */ o(
|
|
320
|
+
/* @__PURE__ */ o(_.Anchor, { asChild: !0, children: /* @__PURE__ */ N(
|
|
318
321
|
"div",
|
|
319
322
|
{
|
|
320
|
-
ref:
|
|
321
|
-
className:
|
|
322
|
-
size:
|
|
323
|
-
tone:
|
|
324
|
-
className:
|
|
323
|
+
ref: W,
|
|
324
|
+
className: Ze({
|
|
325
|
+
size: v,
|
|
326
|
+
tone: xe,
|
|
327
|
+
className: fe
|
|
325
328
|
}),
|
|
326
329
|
"data-component": "combobox",
|
|
327
|
-
"data-component-id":
|
|
330
|
+
"data-component-id": j,
|
|
328
331
|
children: [
|
|
329
332
|
/* @__PURE__ */ o(
|
|
330
|
-
|
|
333
|
+
c.Input,
|
|
331
334
|
{
|
|
332
|
-
ref:
|
|
333
|
-
value:
|
|
334
|
-
onValueChange:
|
|
335
|
-
id:
|
|
336
|
-
name:
|
|
337
|
-
placeholder:
|
|
338
|
-
disabled:
|
|
339
|
-
readOnly:
|
|
340
|
-
required:
|
|
341
|
-
"aria-describedby":
|
|
342
|
-
"aria-invalid":
|
|
343
|
-
onFocus:
|
|
344
|
-
onKeyDown:
|
|
345
|
-
onCompositionStart:
|
|
346
|
-
onCompositionEnd:
|
|
347
|
-
className:
|
|
335
|
+
ref: He(pe, w),
|
|
336
|
+
value: f,
|
|
337
|
+
onValueChange: Se,
|
|
338
|
+
id: ge,
|
|
339
|
+
name: le,
|
|
340
|
+
placeholder: Y,
|
|
341
|
+
disabled: k,
|
|
342
|
+
readOnly: h,
|
|
343
|
+
required: ve,
|
|
344
|
+
"aria-describedby": ye,
|
|
345
|
+
"aria-invalid": J || void 0,
|
|
346
|
+
onFocus: Re,
|
|
347
|
+
onKeyDown: _e,
|
|
348
|
+
onCompositionStart: we,
|
|
349
|
+
onCompositionEnd: Ie,
|
|
350
|
+
className: Ye({ size: v })
|
|
348
351
|
}
|
|
349
352
|
),
|
|
350
|
-
|
|
353
|
+
De ? /* @__PURE__ */ o(
|
|
351
354
|
"button",
|
|
352
355
|
{
|
|
353
356
|
type: "button",
|
|
354
|
-
"aria-label":
|
|
355
|
-
onClick:
|
|
357
|
+
"aria-label": x("inputs.combobox.clear", "Clear selection"),
|
|
358
|
+
onClick: Ee,
|
|
356
359
|
onPointerDown: (e) => e.stopPropagation(),
|
|
357
360
|
className: [
|
|
358
361
|
"ds:inline-flex ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)]",
|
|
@@ -362,48 +365,48 @@ const ie = $e(
|
|
|
362
365
|
"ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
363
366
|
"ds:size-4"
|
|
364
367
|
].join(" "),
|
|
365
|
-
children: /* @__PURE__ */ o(
|
|
368
|
+
children: /* @__PURE__ */ o(Xe, { "aria-hidden": "true", className: "ds:size-3.5" })
|
|
366
369
|
}
|
|
367
370
|
) : null
|
|
368
371
|
]
|
|
369
372
|
}
|
|
370
373
|
) }),
|
|
371
|
-
/* @__PURE__ */ o(
|
|
372
|
-
|
|
374
|
+
/* @__PURE__ */ o(_.Portal, { forceMount: !0, children: /* @__PURE__ */ o(
|
|
375
|
+
_.Content,
|
|
373
376
|
{
|
|
374
377
|
forceMount: !0,
|
|
375
378
|
hidden: !d,
|
|
376
|
-
"aria-label":
|
|
379
|
+
"aria-label": K ?? x("inputs.combobox.popupLabel", "Options"),
|
|
377
380
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
378
381
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
379
382
|
onInteractOutside: (e) => {
|
|
380
383
|
var n;
|
|
381
|
-
const
|
|
382
|
-
|
|
384
|
+
const s = e.target;
|
|
385
|
+
s && ((n = W.current) != null && n.contains(s)) && e.preventDefault();
|
|
383
386
|
},
|
|
384
387
|
sideOffset: 4,
|
|
385
388
|
align: "start",
|
|
386
|
-
className:
|
|
387
|
-
children: /* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */ o(
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
const
|
|
392
|
-
return /* @__PURE__ */
|
|
393
|
-
|
|
389
|
+
className: et(),
|
|
390
|
+
children: /* @__PURE__ */ N(c.List, { className: st, children: [
|
|
391
|
+
/* @__PURE__ */ o(c.Empty, { className: ot, children: me ?? x("inputs.combobox.empty", "No results found") }),
|
|
392
|
+
Pe.map(({ group: e, items: s }, n) => {
|
|
393
|
+
const p = s.map((a) => {
|
|
394
|
+
const B = a.value === m;
|
|
395
|
+
return /* @__PURE__ */ N(
|
|
396
|
+
c.Item,
|
|
394
397
|
{
|
|
395
398
|
value: a.value,
|
|
396
399
|
keywords: [a.label],
|
|
397
400
|
disabled: a.disabled,
|
|
398
|
-
onSelect:
|
|
399
|
-
className:
|
|
401
|
+
onSelect: Ne,
|
|
402
|
+
className: ne({ size: v }),
|
|
400
403
|
children: [
|
|
401
404
|
/* @__PURE__ */ o(
|
|
402
405
|
"span",
|
|
403
406
|
{
|
|
404
407
|
"aria-hidden": "true",
|
|
405
|
-
className: `ds:inline-flex ds:items-center ds:justify-center ${
|
|
406
|
-
children:
|
|
408
|
+
className: `ds:inline-flex ds:items-center ds:justify-center ${q}`,
|
|
409
|
+
children: B ? /* @__PURE__ */ o(We, { className: q }) : null
|
|
407
410
|
}
|
|
408
411
|
),
|
|
409
412
|
/* @__PURE__ */ o("span", { className: "ds:flex-1 ds:truncate", children: a.label }),
|
|
@@ -414,24 +417,24 @@ const ie = $e(
|
|
|
414
417
|
);
|
|
415
418
|
});
|
|
416
419
|
return e ? /* @__PURE__ */ o(
|
|
417
|
-
|
|
420
|
+
c.Group,
|
|
418
421
|
{
|
|
419
|
-
heading: /* @__PURE__ */ o("span", { className:
|
|
420
|
-
children:
|
|
422
|
+
heading: /* @__PURE__ */ o("span", { className: tt, children: e }),
|
|
423
|
+
children: p
|
|
421
424
|
},
|
|
422
425
|
`group-${e}`
|
|
423
|
-
) : /* @__PURE__ */ o(
|
|
426
|
+
) : /* @__PURE__ */ o(c.Group, { children: p }, `group-${n}`);
|
|
424
427
|
}),
|
|
425
|
-
|
|
426
|
-
|
|
428
|
+
ue && f.length > 0 ? /* @__PURE__ */ o(
|
|
429
|
+
rt,
|
|
427
430
|
{
|
|
428
|
-
search:
|
|
429
|
-
label:
|
|
430
|
-
value:
|
|
431
|
+
search: f,
|
|
432
|
+
label: x("inputs.combobox.create", 'Create "{{value}}"', {
|
|
433
|
+
value: f
|
|
431
434
|
}),
|
|
432
|
-
iconClass:
|
|
433
|
-
size:
|
|
434
|
-
onSelect:
|
|
435
|
+
iconClass: q,
|
|
436
|
+
size: v,
|
|
437
|
+
onSelect: ze
|
|
435
438
|
}
|
|
436
439
|
) : null
|
|
437
440
|
] })
|
|
@@ -442,14 +445,14 @@ const ie = $e(
|
|
|
442
445
|
) });
|
|
443
446
|
}
|
|
444
447
|
);
|
|
445
|
-
|
|
446
|
-
const
|
|
448
|
+
re.displayName = "Combobox";
|
|
449
|
+
const yt = re;
|
|
447
450
|
export {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
451
|
+
yt as C,
|
|
452
|
+
et as a,
|
|
453
|
+
Ye as b,
|
|
454
|
+
Je as c,
|
|
455
|
+
ne as d,
|
|
456
|
+
Ze as e
|
|
454
457
|
};
|
|
455
|
-
//# sourceMappingURL=combobox-
|
|
458
|
+
//# sourceMappingURL=combobox-Da9eq00i.js.map
|