@alfadocs/ui-kit-debug 1.12.5 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{actions-cell-renderer-DnSLrgQD.js → actions-cell-renderer-ReurEy5i.js} +2 -2
- package/dist/_chunks/{actions-cell-renderer-DnSLrgQD.js.map → actions-cell-renderer-ReurEy5i.js.map} +1 -1
- package/dist/_chunks/{address-fields-CZP4Wncx.js → address-fields-CZ0pEdEI.js} +4 -4
- package/dist/_chunks/{address-fields-CZP4Wncx.js.map → address-fields-CZ0pEdEI.js.map} +1 -1
- package/dist/_chunks/{ai-prompt-input-DnbfEJnr.js → ai-prompt-input-CrHr-5H8.js} +2 -2
- package/dist/_chunks/{ai-prompt-input-DnbfEJnr.js.map → ai-prompt-input-CrHr-5H8.js.map} +1 -1
- package/dist/_chunks/{anamnesis-summary-rows-BfhxWPO3.js → anamnesis-summary-rows-CRWO8x8g.js} +4 -4
- package/dist/_chunks/{anamnesis-summary-rows-BfhxWPO3.js.map → anamnesis-summary-rows-CRWO8x8g.js.map} +1 -1
- package/dist/_chunks/{audio-recorder-EWBCNIsd.js → audio-recorder-DXG6LTtO.js} +2 -2
- package/dist/_chunks/{audio-recorder-EWBCNIsd.js.map → audio-recorder-DXG6LTtO.js.map} +1 -1
- package/dist/_chunks/{autocomplete-BrONKN8l.js → autocomplete-MpBhz-fG.js} +86 -74
- package/dist/_chunks/{autocomplete-BrONKN8l.js.map → autocomplete-MpBhz-fG.js.map} +1 -1
- package/dist/_chunks/{balance-badge-cell-7L6nzB29.js → balance-badge-cell--iQ_gtmi.js} +4 -4
- package/dist/_chunks/{balance-badge-cell-7L6nzB29.js.map → balance-badge-cell--iQ_gtmi.js.map} +1 -1
- package/dist/_chunks/{bishop-score-Cnu0xs-z.js → bishop-score-CJUVBfAu.js} +2 -2
- package/dist/_chunks/{bishop-score-Cnu0xs-z.js.map → bishop-score-CJUVBfAu.js.map} +1 -1
- package/dist/_chunks/{booking-CBHKdsZl.js → booking-DQbo6mQF.js} +609 -591
- package/dist/_chunks/booking-DQbo6mQF.js.map +1 -0
- package/dist/_chunks/{care-plan-card-aDN4oem9.js → care-plan-card-D-FMfDKH.js} +2 -2
- package/dist/_chunks/{care-plan-card-aDN4oem9.js.map → care-plan-card-D-FMfDKH.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-BEhANdBE.js → care-plan-entry-card-Bvw_9T-d.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-BEhANdBE.js.map → care-plan-entry-card-Bvw_9T-d.js.map} +1 -1
- package/dist/_chunks/{care-plan-header-CkpPyQqG.js → care-plan-header-B5CBE0zu.js} +2 -2
- package/dist/_chunks/{care-plan-header-CkpPyQqG.js.map → care-plan-header-B5CBE0zu.js.map} +1 -1
- package/dist/_chunks/{city-input-towzBenY.js → city-input-DaQc-Hbj.js} +2 -2
- package/dist/_chunks/{city-input-towzBenY.js.map → city-input-DaQc-Hbj.js.map} +1 -1
- package/dist/_chunks/{combobox-DiMLItyu.js → combobox-D7_NLE2Z.js} +89 -81
- package/dist/_chunks/{combobox-DiMLItyu.js.map → combobox-D7_NLE2Z.js.map} +1 -1
- package/dist/_chunks/{contact-profile-card-BMIBr5s9.js → contact-profile-card-BZqi8Hck.js} +38 -36
- package/dist/_chunks/{contact-profile-card-BMIBr5s9.js.map → contact-profile-card-BZqi8Hck.js.map} +1 -1
- package/dist/_chunks/{country-select-UEF9BEeQ.js → country-select-DzbPFktV.js} +2 -2
- package/dist/_chunks/{country-select-UEF9BEeQ.js.map → country-select-DzbPFktV.js.map} +1 -1
- package/dist/_chunks/{document-preview-oyx9RhCo.js → document-preview-CDb-n_W7.js} +2 -2
- package/dist/_chunks/{document-preview-oyx9RhCo.js.map → document-preview-CDb-n_W7.js.map} +1 -1
- package/dist/_chunks/{face-scheme-CZaKm6fG.js → face-scheme-DA2vjqaM.js} +2 -2
- package/dist/_chunks/{face-scheme-CZaKm6fG.js.map → face-scheme-DA2vjqaM.js.map} +1 -1
- package/dist/_chunks/{file-manager-C0y7HBAN.js → file-manager-UsD8e_AB.js} +2 -2
- package/dist/_chunks/{file-manager-C0y7HBAN.js.map → file-manager-UsD8e_AB.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-CxZelpu2.js → gestational-age-calculator-CiOQjzgx.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-CxZelpu2.js.map → gestational-age-calculator-CiOQjzgx.js.map} +1 -1
- package/dist/_chunks/key-value-pair-BIBdZBLg.js +188 -0
- package/dist/_chunks/key-value-pair-BIBdZBLg.js.map +1 -0
- package/dist/_chunks/{link-cell-renderer-CenJx-_7.js → link-cell-renderer-CIASXsVM.js} +4 -4
- package/dist/_chunks/{link-cell-renderer-CenJx-_7.js.map → link-cell-renderer-CIASXsVM.js.map} +1 -1
- package/dist/_chunks/{multi-select-DqL4o0qV.js → multi-select-DYOvx2SJ.js} +56 -48
- package/dist/_chunks/{multi-select-DqL4o0qV.js.map → multi-select-DYOvx2SJ.js.map} +1 -1
- package/dist/_chunks/{muscle-scheme-yfzP_xoJ.js → muscle-scheme-BSJsI4-I.js} +2 -2
- package/dist/_chunks/{muscle-scheme-yfzP_xoJ.js.map → muscle-scheme-BSJsI4-I.js.map} +1 -1
- package/dist/_chunks/{optical-prescription-Dj3Eh5Ok.js → optical-prescription-BvwuqTpl.js} +2 -2
- package/dist/_chunks/{optical-prescription-Dj3Eh5Ok.js.map → optical-prescription-BvwuqTpl.js.map} +1 -1
- package/dist/_chunks/{patient-details-xrqe13az.js → patient-details-BQaUzPqp.js} +5 -5
- package/dist/_chunks/{patient-details-xrqe13az.js.map → patient-details-BQaUzPqp.js.map} +1 -1
- package/dist/_chunks/{patient-search-D5ufYoRc.js → patient-search-HeEUB-_X.js} +2 -2
- package/dist/_chunks/{patient-search-D5ufYoRc.js.map → patient-search-HeEUB-_X.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-CBfuDvJ5.js → patient-summary-card-CvDxhbBR.js} +2 -2
- package/dist/_chunks/{patient-summary-card-CBfuDvJ5.js.map → patient-summary-card-CvDxhbBR.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-YVCcCZ25.js → payment-request-card-lmKLwsDs.js} +2 -2
- package/dist/_chunks/{payment-request-card-YVCcCZ25.js.map → payment-request-card-lmKLwsDs.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-BatZEFar.js → periodontal-chart-B9fphroR.js} +2 -2
- package/dist/_chunks/{periodontal-chart-BatZEFar.js.map → periodontal-chart-B9fphroR.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-card-BBpY_rBc.js → periodontal-chart-card-qEZPXj83.js} +2 -2
- package/dist/_chunks/{periodontal-chart-card-BBpY_rBc.js.map → periodontal-chart-card-qEZPXj83.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-DtToyMyc.js → pregnancy-dating-D2wchD11.js} +2 -2
- package/dist/_chunks/{pregnancy-dating-DtToyMyc.js.map → pregnancy-dating-D2wchD11.js.map} +1 -1
- package/dist/_chunks/{province-select-BDywtmL-.js → province-select-BBc7s7vR.js} +2 -2
- package/dist/_chunks/{province-select-BDywtmL-.js.map → province-select-BBc7s7vR.js.map} +1 -1
- package/dist/_chunks/{select-BW5ecXlX.js → select-Bi8zril7.js} +165 -136
- package/dist/_chunks/select-Bi8zril7.js.map +1 -0
- package/dist/_chunks/{signature-request-DVDTKLjM.js → signature-request-CUe903hj.js} +2 -2
- package/dist/_chunks/{signature-request-DVDTKLjM.js.map → signature-request-CUe903hj.js.map} +1 -1
- package/dist/_chunks/{tabs-CBb2AidH.js → tabs-DqKtTIjZ.js} +2 -2
- package/dist/_chunks/{tabs-CBb2AidH.js.map → tabs-DqKtTIjZ.js.map} +1 -1
- package/dist/_chunks/{tasks-panel-Do5SFp-j.js → tasks-panel-DPCNaRko.js} +2 -2
- package/dist/_chunks/{tasks-panel-Do5SFp-j.js.map → tasks-panel-DPCNaRko.js.map} +1 -1
- package/dist/_chunks/{tooth-scheme-WdyVymQ1.js → tooth-scheme-2IsmbE6w.js} +2 -2
- package/dist/_chunks/{tooth-scheme-WdyVymQ1.js.map → tooth-scheme-2IsmbE6w.js.map} +1 -1
- package/dist/_chunks/{unit-converter-BPumXMA6.js → unit-converter-C6jMjqL9.js} +2 -2
- package/dist/_chunks/{unit-converter-BPumXMA6.js.map → unit-converter-C6jMjqL9.js.map} +1 -1
- package/dist/_chunks/{workflow-map-DE_ribRM.js → workflow-map-wcw3t6g4.js} +2 -2
- package/dist/_chunks/{workflow-map-DE_ribRM.js.map → workflow-map-wcw3t6g4.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/option.d.ts +1 -0
- package/dist/components/_shared/option.d.ts.map +1 -1
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/ai-prompt-input/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/bishop-score/index.js +1 -1
- package/dist/components/booking/booking.d.ts.map +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/care-plan-header/index.js +1 -1
- package/dist/components/city-input/index.js +1 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/country-select/index.js +1 -1
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/key-value-pair/index.js +1 -1
- package/dist/components/key-value-pair/key-value-pair.d.ts +16 -0
- package/dist/components/key-value-pair/key-value-pair.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/muscle-scheme/index.js +1 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-search/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/payment-card/index.js +1 -1
- package/dist/components/periodontal-chart/index.js +1 -1
- package/dist/components/periodontal-chart-card/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/province-select/index.js +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/select.d.ts +24 -0
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/skeleton-scheme/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/components/tooth-scheme/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/index.js +40 -40
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/signature-request/index.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/booking-CBHKdsZl.js.map +0 -1
- package/dist/_chunks/key-value-pair-BubG4fUa.js +0 -144
- package/dist/_chunks/key-value-pair-BubG4fUa.js.map +0 -1
- package/dist/_chunks/select-BW5ecXlX.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as t, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ke, useContext as Ke, useMemo as B, useState as oe, useRef as g, useEffect as I, useCallback as Oe } from "react";
|
|
3
3
|
import * as _ from "@radix-ui/react-popover";
|
|
4
|
-
import { R as
|
|
4
|
+
import { R as Te, _ as c, P as $e } from "./index-4xgbg-sn.js";
|
|
5
5
|
import { c as F } from "./index-D2ZczOXr.js";
|
|
6
6
|
import { useTranslation as Be } from "react-i18next";
|
|
7
7
|
import { u as Ue, F as He } from "./form-field-context-B3APVHKx.js";
|
|
@@ -24,19 +24,19 @@ const et = {
|
|
|
24
24
|
type: "string | null",
|
|
25
25
|
descriptionKey: "ui.agent.combobox.state.value",
|
|
26
26
|
description: "Currently-selected option value, or null when nothing is selected.",
|
|
27
|
-
read: (
|
|
27
|
+
read: (s) => s.getValue()
|
|
28
28
|
},
|
|
29
29
|
query: {
|
|
30
30
|
type: "string",
|
|
31
31
|
descriptionKey: "ui.agent.combobox.state.query",
|
|
32
32
|
description: "Current filter query in the combobox input.",
|
|
33
|
-
read: (
|
|
33
|
+
read: (s) => s.getQuery()
|
|
34
34
|
},
|
|
35
35
|
isOpen: {
|
|
36
36
|
type: "boolean",
|
|
37
37
|
descriptionKey: "ui.agent.combobox.state.isOpen",
|
|
38
38
|
description: "True when the option list is visible.",
|
|
39
|
-
read: (
|
|
39
|
+
read: (s) => s.getIsOpen()
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
actions: {
|
|
@@ -58,8 +58,8 @@ const et = {
|
|
|
58
58
|
descriptionKey: "ui.agent.combobox.actions.setValue",
|
|
59
59
|
description: "Set the selected value programmatically.",
|
|
60
60
|
examples: [{ args: { value: "it" }, note: 'Select the "it" option.' }],
|
|
61
|
-
invoke: (
|
|
62
|
-
|
|
61
|
+
invoke: (s, a) => {
|
|
62
|
+
s.setValue(a.value);
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
apply_filter: {
|
|
@@ -76,8 +76,8 @@ const et = {
|
|
|
76
76
|
idempotent: !0,
|
|
77
77
|
descriptionKey: "ui.agent.combobox.actions.applyFilter",
|
|
78
78
|
description: "Set the filter query for the option list.",
|
|
79
|
-
invoke: (
|
|
80
|
-
|
|
79
|
+
invoke: (s, a) => {
|
|
80
|
+
s.setQuery(a.query);
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
clear_selection: {
|
|
@@ -86,8 +86,8 @@ const et = {
|
|
|
86
86
|
idempotent: !0,
|
|
87
87
|
descriptionKey: "ui.agent.combobox.actions.clearSelection",
|
|
88
88
|
description: "Clear the current selection.",
|
|
89
|
-
invoke: (
|
|
90
|
-
|
|
89
|
+
invoke: (s) => {
|
|
90
|
+
s.clear();
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
open: {
|
|
@@ -95,8 +95,8 @@ const et = {
|
|
|
95
95
|
idempotent: !0,
|
|
96
96
|
descriptionKey: "ui.agent.combobox.actions.open",
|
|
97
97
|
description: "Open the option list.",
|
|
98
|
-
invoke: (
|
|
99
|
-
|
|
98
|
+
invoke: (s) => {
|
|
99
|
+
s.open();
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
close: {
|
|
@@ -104,8 +104,8 @@ const et = {
|
|
|
104
104
|
idempotent: !0,
|
|
105
105
|
descriptionKey: "ui.agent.combobox.actions.close",
|
|
106
106
|
description: "Close the option list.",
|
|
107
|
-
invoke: (
|
|
108
|
-
|
|
107
|
+
invoke: (s) => {
|
|
108
|
+
s.close();
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
},
|
|
@@ -201,34 +201,34 @@ const et = {
|
|
|
201
201
|
lg: "ds:size-5"
|
|
202
202
|
};
|
|
203
203
|
function dt({
|
|
204
|
-
search:
|
|
204
|
+
search: s,
|
|
205
205
|
label: a,
|
|
206
206
|
iconClass: E,
|
|
207
207
|
size: V,
|
|
208
208
|
onSelect: j
|
|
209
209
|
}) {
|
|
210
|
-
return
|
|
210
|
+
return $e((q) => q.filtered.count) > 0 ? null : /* @__PURE__ */ S(
|
|
211
211
|
c.Item,
|
|
212
212
|
{
|
|
213
|
-
value: `__combobox-create__${
|
|
213
|
+
value: `__combobox-create__${s}`,
|
|
214
214
|
keywords: [],
|
|
215
215
|
forceMount: !0,
|
|
216
|
-
onSelect: () => j(
|
|
216
|
+
onSelect: () => j(s),
|
|
217
217
|
className: ne({ size: V }),
|
|
218
218
|
children: [
|
|
219
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ t(
|
|
220
220
|
"span",
|
|
221
221
|
{
|
|
222
222
|
"aria-hidden": "true",
|
|
223
223
|
className: `ds:inline-flex ds:items-center ds:justify-center ${E}`
|
|
224
224
|
}
|
|
225
225
|
),
|
|
226
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ t("span", { className: "ds:flex-1 ds:truncate", children: a })
|
|
227
227
|
]
|
|
228
228
|
}
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
|
-
const re =
|
|
231
|
+
const re = ke(
|
|
232
232
|
function({
|
|
233
233
|
options: a,
|
|
234
234
|
value: E,
|
|
@@ -255,28 +255,28 @@ const re = Ke(
|
|
|
255
255
|
"aria-describedby": be,
|
|
256
256
|
autoComplete: he
|
|
257
257
|
}, ge) {
|
|
258
|
-
const { t: y } = Be(), b = Ue(), x =
|
|
258
|
+
const { t: y } = Be(), b = Ue(), x = Ke(He) !== null, [ve, N] = Le({
|
|
259
259
|
value: E,
|
|
260
260
|
defaultValue: V ?? "",
|
|
261
261
|
onChange: j
|
|
262
|
-
}), m = ve ?? "",
|
|
262
|
+
}), m = ve ?? "", k = B(
|
|
263
263
|
() => a.find((e) => e.value === m),
|
|
264
264
|
[a, m]
|
|
265
|
-
), C = (
|
|
265
|
+
), C = (k == null ? void 0 : k.label) ?? "", [p, i] = oe(C), [ye, X] = oe(!1), z = L !== void 0, d = z ? L : ye, R = g(!1), w = g(null), W = g(null);
|
|
266
266
|
Qe(() => {
|
|
267
267
|
var e;
|
|
268
268
|
(e = w.current) == null || e.setAttribute("aria-expanded", String(d));
|
|
269
269
|
}), I(() => {
|
|
270
270
|
d || i(C);
|
|
271
271
|
}, [C, d]);
|
|
272
|
-
const xe = A ?? (x ? b.id : void 0),
|
|
273
|
-
() => (e,
|
|
272
|
+
const xe = A ?? (x ? b.id : void 0), K = (x ? b.disabled : !1) || !!ae, h = !!ie, Ce = (x ? b.required : !1) || !!de, J = x ? b.invalid : !!fe, Se = J ? "error" : ce, Ne = x && b.describedBy ? b.describedBy : be, Y = M ?? y("inputs.combobox.placeholder", "Search…"), ze = B(
|
|
273
|
+
() => (e, o, r) => {
|
|
274
274
|
if (R.current) return 1;
|
|
275
|
-
const f = U(e),
|
|
276
|
-
return D ? D(f,
|
|
275
|
+
const f = U(e), n = U(o), $ = r == null ? void 0 : r.map(U);
|
|
276
|
+
return D ? D(f, n) : Te(
|
|
277
277
|
f,
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
n,
|
|
279
|
+
$
|
|
280
280
|
);
|
|
281
281
|
},
|
|
282
282
|
[D]
|
|
@@ -285,26 +285,26 @@ const re = Ke(
|
|
|
285
285
|
}, l = (e) => {
|
|
286
286
|
z || X(e), u == null || u(e);
|
|
287
287
|
}, Re = (e) => {
|
|
288
|
-
const
|
|
289
|
-
Z(e), i((
|
|
288
|
+
const o = a.find((r) => r.value === e);
|
|
289
|
+
Z(e), i((o == null ? void 0 : o.label) ?? ""), l(!1);
|
|
290
290
|
}, we = (e) => {
|
|
291
291
|
P == null || P(e), l(!1);
|
|
292
292
|
}, Ie = (e) => {
|
|
293
293
|
h || (i(e), !d && e.length > 0 && !R.current && l(!0));
|
|
294
294
|
}, _e = () => {
|
|
295
|
-
!
|
|
295
|
+
!K && !h && l(!0);
|
|
296
296
|
}, Fe = () => {
|
|
297
297
|
R.current = !0;
|
|
298
298
|
}, Ee = () => {
|
|
299
|
-
var
|
|
299
|
+
var o;
|
|
300
300
|
if (R.current = !1, h) return;
|
|
301
|
-
const e = ((
|
|
301
|
+
const e = ((o = w.current) == null ? void 0 : o.value) ?? "";
|
|
302
302
|
i(e), e.length > 0 && l(!0);
|
|
303
303
|
}, Ve = (e) => {
|
|
304
304
|
e.nativeEvent.isComposing || e.key === "Escape" && d && (e.preventDefault(), l(!1), i(C));
|
|
305
305
|
}, je = (e) => {
|
|
306
|
-
var
|
|
307
|
-
e.preventDefault(), e.stopPropagation(), Z(""), i(""), l(!0), (
|
|
306
|
+
var o;
|
|
307
|
+
e.preventDefault(), e.stopPropagation(), Z(""), i(""), l(!0), (o = w.current) == null || o.focus();
|
|
308
308
|
}, qe = (e) => {
|
|
309
309
|
h && e || (l(e), e || i(C));
|
|
310
310
|
}, ee = g(m);
|
|
@@ -319,7 +319,7 @@ const re = Ke(
|
|
|
319
319
|
I(() => {
|
|
320
320
|
se.current = d;
|
|
321
321
|
}, [d]);
|
|
322
|
-
const
|
|
322
|
+
const O = Oe(
|
|
323
323
|
(e) => {
|
|
324
324
|
z || X(e), u == null || u(e);
|
|
325
325
|
},
|
|
@@ -330,10 +330,10 @@ const re = Ke(
|
|
|
330
330
|
getQuery: () => te.current,
|
|
331
331
|
getIsOpen: () => se.current,
|
|
332
332
|
setValue: (e) => {
|
|
333
|
-
const
|
|
334
|
-
N(
|
|
335
|
-
const
|
|
336
|
-
i((
|
|
333
|
+
const o = e ?? "";
|
|
334
|
+
N(o);
|
|
335
|
+
const r = a.find((f) => f.value === o);
|
|
336
|
+
i((r == null ? void 0 : r.label) ?? "");
|
|
337
337
|
},
|
|
338
338
|
setQuery: (e) => {
|
|
339
339
|
i(e);
|
|
@@ -341,14 +341,14 @@ const re = Ke(
|
|
|
341
341
|
clear: () => {
|
|
342
342
|
N(""), i("");
|
|
343
343
|
},
|
|
344
|
-
open: () =>
|
|
345
|
-
close: () =>
|
|
344
|
+
open: () => O(!0),
|
|
345
|
+
close: () => O(!1)
|
|
346
346
|
}),
|
|
347
|
-
[N, a,
|
|
347
|
+
[N, a, O]
|
|
348
348
|
);
|
|
349
349
|
Je(et, Ae, A);
|
|
350
|
-
const De = q && !!m && !
|
|
351
|
-
return /* @__PURE__ */
|
|
350
|
+
const De = q && !!m && !K && !h, Pe = Me(a), T = it[v];
|
|
351
|
+
return /* @__PURE__ */ t(_.Root, { open: d, onOpenChange: qe, children: /* @__PURE__ */ S(
|
|
352
352
|
c,
|
|
353
353
|
{
|
|
354
354
|
filter: ze,
|
|
@@ -357,7 +357,7 @@ const re = Ke(
|
|
|
357
357
|
label: Q ?? Y,
|
|
358
358
|
className: "ds:w-full",
|
|
359
359
|
children: [
|
|
360
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ t(_.Anchor, { asChild: !0, children: /* @__PURE__ */ S(
|
|
361
361
|
"div",
|
|
362
362
|
{
|
|
363
363
|
ref: W,
|
|
@@ -369,7 +369,7 @@ const re = Ke(
|
|
|
369
369
|
"data-component": "combobox",
|
|
370
370
|
"data-component-id": A,
|
|
371
371
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ t(
|
|
373
373
|
c.Input,
|
|
374
374
|
{
|
|
375
375
|
ref: Ge(ge, w),
|
|
@@ -378,7 +378,7 @@ const re = Ke(
|
|
|
378
378
|
id: xe,
|
|
379
379
|
name: le,
|
|
380
380
|
placeholder: Y,
|
|
381
|
-
disabled:
|
|
381
|
+
disabled: K,
|
|
382
382
|
readOnly: h,
|
|
383
383
|
required: Ce,
|
|
384
384
|
autoComplete: he,
|
|
@@ -391,7 +391,7 @@ const re = Ke(
|
|
|
391
391
|
className: tt({ size: v })
|
|
392
392
|
}
|
|
393
393
|
),
|
|
394
|
-
De ? /* @__PURE__ */
|
|
394
|
+
De ? /* @__PURE__ */ t(
|
|
395
395
|
"button",
|
|
396
396
|
{
|
|
397
397
|
type: "button",
|
|
@@ -406,13 +406,13 @@ const re = Ke(
|
|
|
406
406
|
"ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
407
407
|
"ds:size-4"
|
|
408
408
|
].join(" "),
|
|
409
|
-
children: /* @__PURE__ */
|
|
409
|
+
children: /* @__PURE__ */ t(Ye, { "aria-hidden": "true", className: "ds:size-3.5" })
|
|
410
410
|
}
|
|
411
411
|
) : null
|
|
412
412
|
]
|
|
413
413
|
}
|
|
414
414
|
) }),
|
|
415
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ t(_.Portal, { forceMount: !0, children: /* @__PURE__ */ t(
|
|
416
416
|
_.Content,
|
|
417
417
|
{
|
|
418
418
|
forceMount: !0,
|
|
@@ -421,73 +421,81 @@ const re = Ke(
|
|
|
421
421
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
422
422
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
423
423
|
onInteractOutside: (e) => {
|
|
424
|
-
var
|
|
425
|
-
const
|
|
426
|
-
|
|
424
|
+
var r;
|
|
425
|
+
const o = e.target;
|
|
426
|
+
o && ((r = W.current) != null && r.contains(o)) && e.preventDefault();
|
|
427
427
|
},
|
|
428
428
|
sideOffset: 4,
|
|
429
429
|
align: "start",
|
|
430
430
|
className: ot(),
|
|
431
431
|
children: /* @__PURE__ */ S(c.List, { className: rt, children: [
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
Pe.map(({ group: e, items:
|
|
434
|
-
const f =
|
|
435
|
-
const
|
|
432
|
+
/* @__PURE__ */ t(c.Empty, { className: at, children: me ?? y("inputs.combobox.empty", "No results found") }),
|
|
433
|
+
Pe.map(({ group: e, items: o }, r) => {
|
|
434
|
+
const f = o.map((n) => {
|
|
435
|
+
const $ = n.value === m;
|
|
436
436
|
return /* @__PURE__ */ S(
|
|
437
437
|
c.Item,
|
|
438
438
|
{
|
|
439
|
-
value:
|
|
440
|
-
"data-option-id":
|
|
441
|
-
keywords: [
|
|
442
|
-
disabled:
|
|
439
|
+
value: n.value,
|
|
440
|
+
"data-option-id": n.value,
|
|
441
|
+
keywords: [n.label],
|
|
442
|
+
disabled: n.disabled,
|
|
443
443
|
onSelect: Re,
|
|
444
444
|
className: ne({ size: v }),
|
|
445
445
|
children: [
|
|
446
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ t(
|
|
447
447
|
"span",
|
|
448
448
|
{
|
|
449
449
|
"aria-hidden": "true",
|
|
450
|
-
className: `ds:inline-flex ds:items-center ds:justify-center ${
|
|
451
|
-
children:
|
|
450
|
+
className: `ds:inline-flex ds:items-center ds:justify-center ${T}`,
|
|
451
|
+
children: $ ? /* @__PURE__ */ t(Ze, { className: T }) : null
|
|
452
452
|
}
|
|
453
453
|
),
|
|
454
|
-
|
|
454
|
+
n.startAdornment ? (
|
|
455
455
|
// Decorative by contract — the option's accessible
|
|
456
456
|
// name comes from its label. Hide so a text-bearing
|
|
457
457
|
// adornment can't leak into the computed name.
|
|
458
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ t(
|
|
459
459
|
"span",
|
|
460
460
|
{
|
|
461
461
|
"aria-hidden": "true",
|
|
462
462
|
className: "ds:inline-flex ds:items-center ds:shrink-0",
|
|
463
|
-
children:
|
|
463
|
+
children: n.startAdornment
|
|
464
464
|
}
|
|
465
465
|
)
|
|
466
466
|
) : null,
|
|
467
|
-
/* @__PURE__ */
|
|
468
|
-
|
|
467
|
+
/* @__PURE__ */ t("span", { className: "ds:flex-1 ds:truncate", children: n.label }),
|
|
468
|
+
n.description ? /* @__PURE__ */ t("span", { className: "type-meta ds:text-muted-foreground", children: n.description }) : null,
|
|
469
|
+
n.endContent ? (
|
|
470
|
+
// Deliberately NOT aria-hidden — unlike
|
|
471
|
+
// `startAdornment`, this slot carries meaning
|
|
472
|
+
// (a price, a count) and must reach the
|
|
473
|
+
// option's accessible name. `ms-auto` pins it
|
|
474
|
+
// to the inline-end and flips under RTL.
|
|
475
|
+
/* @__PURE__ */ t("span", { className: "ds:inline-flex ds:items-center ds:ms-auto ds:shrink-0", children: n.endContent })
|
|
476
|
+
) : null
|
|
469
477
|
]
|
|
470
478
|
},
|
|
471
|
-
|
|
479
|
+
n.value
|
|
472
480
|
);
|
|
473
481
|
});
|
|
474
|
-
return e ? /* @__PURE__ */
|
|
482
|
+
return e ? /* @__PURE__ */ t(
|
|
475
483
|
c.Group,
|
|
476
484
|
{
|
|
477
|
-
heading: /* @__PURE__ */
|
|
485
|
+
heading: /* @__PURE__ */ t("span", { className: nt, children: e }),
|
|
478
486
|
children: f
|
|
479
487
|
},
|
|
480
488
|
`group-${e}`
|
|
481
|
-
) : /* @__PURE__ */
|
|
489
|
+
) : /* @__PURE__ */ t(c.Group, { children: f }, `group-${r}`);
|
|
482
490
|
}),
|
|
483
|
-
ue && p.length > 0 ? /* @__PURE__ */
|
|
491
|
+
ue && p.length > 0 ? /* @__PURE__ */ t(
|
|
484
492
|
dt,
|
|
485
493
|
{
|
|
486
494
|
search: p,
|
|
487
495
|
label: y("inputs.combobox.create", 'Create "{{value}}"', {
|
|
488
496
|
value: p
|
|
489
497
|
}),
|
|
490
|
-
iconClass:
|
|
498
|
+
iconClass: T,
|
|
491
499
|
size: v,
|
|
492
500
|
onSelect: we
|
|
493
501
|
}
|
|
@@ -510,4 +518,4 @@ export {
|
|
|
510
518
|
ne as d,
|
|
511
519
|
st as e
|
|
512
520
|
};
|
|
513
|
-
//# sourceMappingURL=combobox-
|
|
521
|
+
//# sourceMappingURL=combobox-D7_NLE2Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-DiMLItyu.js","sources":["../../src/components/combobox/combobox.agent.ts","../../src/components/combobox/combobox.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { ComboboxHandle } from './combobox';\n\nexport const comboboxAgent: AgentAdapter<ComboboxHandle> = {\n id: 'combobox',\n // Persisted single choice (value state + set_value) → select_single + set_value,\n // plus type-to-filter and open/close of the option list.\n capabilities: ['select_single', 'set_value', 'filter', 'open', 'close'],\n state: {\n value: {\n type: 'string | null',\n descriptionKey: 'ui.agent.combobox.state.value',\n description:\n 'Currently-selected option value, or null when nothing is selected.',\n read: (handle) => handle.getValue(),\n },\n query: {\n type: 'string',\n descriptionKey: 'ui.agent.combobox.state.query',\n description: 'Current filter query in the combobox input.',\n read: (handle) => handle.getQuery(),\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.combobox.state.isOpen',\n description: 'True when the option list is visible.',\n read: (handle) => handle.getIsOpen(),\n },\n },\n actions: {\n set_value: {\n // Persists the user's chosen option — reversible via the same UI.\n safety: 'write',\n argsType: '{ value: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: ['string', 'null'],\n description: 'Option value to select, or null to clear.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.setValue',\n description: 'Set the selected value programmatically.',\n examples: [{ args: { value: 'it' }, note: 'Select the \"it\" option.' }],\n invoke: (handle, args: { value: string | null }) => {\n handle.setValue(args.value);\n },\n },\n apply_filter: {\n // Pure ephemeral filter of the visible options — no persisted change.\n safety: 'read',\n argsType: '{ query: string }',\n argsSchema: {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'Filter text for the list.' },\n },\n required: ['query'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.applyFilter',\n description: 'Set the filter query for the option list.',\n invoke: (handle, args: { query: string }) => {\n handle.setQuery(args.query);\n },\n },\n clear_selection: {\n // Discards the persisted choice — destructive (loses the selection).\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.clearSelection',\n description: 'Clear the current selection.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.open',\n description: 'Open the option list.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.close',\n description: 'Close the option list.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'combobox' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-option-id',\n description: 'Each option emits its value as data-option-id.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport * as Popover from '@radix-ui/react-popover';\nimport { Command, defaultFilter, useCommandState } from 'cmdk';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Check, X } from 'lucide-react';\nimport {\n FormFieldContext,\n useFormField,\n} from '../form-field/form-field-context';\nimport type { OptionShape } from '../_shared/option';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { normalizeDiacritics } from '../_shared/normalize-diacritics';\nimport { groupOptions } from '../_shared/group-options';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport {\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_HEIGHT,\n INPUT_SURFACE_PADDING_X,\n INPUT_SURFACE_TONE,\n} from '../_shared/input-surface';\nimport { useAgentRegistration } from '../../agent';\nimport { comboboxAgent } from './combobox.agent';\n\nexport type ComboboxOption<T extends string = string> = OptionShape<T>;\n\n// Curated agent-readiness handle — see combobox.agent.ts.\nexport interface ComboboxHandle {\n getValue: () => string | null;\n getQuery: () => string;\n getIsOpen: () => boolean;\n setValue: (value: string | null) => void;\n setQuery: (query: string) => void;\n clear: () => void;\n open: () => void;\n close: () => void;\n}\n\nexport interface ComboboxProps<T extends string = string> {\n options: ComboboxOption<T>[];\n value?: T | '';\n defaultValue?: T;\n onValueChange?: (value: T | '') => void;\n placeholder?: string;\n clearable?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n name?: string;\n id?: string;\n size?: 'sm' | 'md' | 'lg';\n tone?: 'default' | 'error';\n filter?: (value: string, search: string) => number;\n allowCreate?: boolean;\n onCreate?: (value: string) => void;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n emptyMessage?: ReactNode;\n 'aria-label'?: string;\n /**\n * Invalid-state fallback for use OUTSIDE a `<FormField>` (e.g. an inline\n * editor). Inside a FormField the context wins. Drives the error border and\n * the input's `aria-invalid`.\n */\n 'aria-invalid'?: boolean;\n /**\n * Error-message id fallback for use OUTSIDE a `<FormField>`. Inside a\n * FormField the context's `describedBy` wins.\n */\n 'aria-describedby'?: string;\n /**\n * Forwarded to the underlying input as the HTML `autocomplete` token\n * (e.g. `country`, `address-level1`) — WCAG 2.1 §1.3.5. cmdk passes it\n * through to its `Command.Input`.\n */\n autoComplete?: string;\n className?: string;\n}\n\nconst comboboxInputVariants = cva(\n [\n 'ds:peer ds:w-full ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground',\n 'ds:outline-none ds:border-0',\n 'ds:disabled:cursor-not-allowed',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:text-[length:var(--font-size-sm)]',\n md: 'ds:text-[length:var(--font-size-base)]',\n lg: 'ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\nconst comboboxWrapperVariants = cva(\n [\n 'ds:group ds:relative ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)] ds:w-full',\n INPUT_SURFACE_CHROME,\n ].join(' '),\n {\n variants: {\n size: {\n sm: `${INPUT_SURFACE_HEIGHT.sm} ${INPUT_SURFACE_PADDING_X.sm}`,\n md: `${INPUT_SURFACE_HEIGHT.md} ${INPUT_SURFACE_PADDING_X.md}`,\n lg: `${INPUT_SURFACE_HEIGHT.lg} ${INPUT_SURFACE_PADDING_X.lg}`,\n },\n tone: INPUT_SURFACE_TONE,\n },\n defaultVariants: {\n size: 'md',\n tone: 'default',\n },\n },\n);\n\nconst comboboxContentVariants = cva(\n [\n 'ds:z-[var(--z-popover)] ds:overflow-hidden ds:w-[var(--radix-popover-trigger-width)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:text-foreground',\n 'ds:shadow-[var(--shadow-lg)]',\n 'ds:animate-in ds:fade-in ds:zoom-in-95',\n 'ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out',\n 'ds:data-[state=closed]:zoom-out-95',\n 'ds:data-[side=bottom]:slide-in-from-top-2',\n 'ds:data-[side=top]:slide-in-from-bottom-2',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n);\n\nconst comboboxItemVariants = cva(\n [\n 'ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:text-foreground ds:outline-none ds:select-none',\n 'ds:data-[highlighted]:bg-muted ds:data-[highlighted]:text-foreground',\n 'ds:data-[highlighted]:border-s-2 ds:data-[highlighted]:border-s-primary',\n 'ds:aria-selected:bg-muted',\n 'ds:aria-disabled:pointer-events-none ds:aria-disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:min-h-8 ds:ps-3 ds:pe-3 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:text-[length:var(--font-size-base)]',\n lg: 'ds:min-h-12 ds:ps-4 ds:pe-4 ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\nconst comboboxGroupHeadingClasses = [\n 'ds:ps-3 ds:pe-3 ds:py-1.5',\n 'type-eyebrow ds:text-muted-foreground',\n].join(' ');\n\nconst comboboxListClasses =\n 'ds:max-h-[18rem] ds:overflow-y-auto ds:p-[var(--spacing-xs)]';\n\nconst comboboxEmptyClasses =\n 'ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground';\n\nconst iconSizeBySize = {\n sm: 'ds:size-3.5',\n md: 'ds:size-4',\n lg: 'ds:size-5',\n} as const;\n\ninterface CreateRowProps {\n search: string;\n label: string;\n iconClass: string;\n size: 'sm' | 'md' | 'lg';\n onSelect: (value: string) => void;\n}\n\nfunction ComboboxCreateRow({\n search,\n label,\n iconClass,\n size,\n onSelect,\n}: CreateRowProps): ReactElement | null {\n // Only surface the create row when no existing item matches the query.\n const filteredCount = useCommandState((state) => state.filtered.count);\n if (filteredCount > 0) return null;\n return (\n <Command.Item\n value={`__combobox-create__${search}`}\n keywords={[]}\n forceMount\n onSelect={() => onSelect(search)}\n className={comboboxItemVariants({ size })}\n >\n <span\n aria-hidden=\"true\"\n className={`ds:inline-flex ds:items-center ds:justify-center ${iconClass}`}\n />\n <span className=\"ds:flex-1 ds:truncate\">{label}</span>\n </Command.Item>\n );\n}\n\nconst ComboboxImpl = forwardRef<HTMLInputElement, ComboboxProps>(\n function Combobox(\n {\n options,\n value,\n defaultValue,\n onValueChange,\n placeholder,\n clearable = false,\n disabled,\n readOnly,\n required,\n name,\n id,\n size = 'md',\n tone = 'default',\n filter: externalFilter,\n allowCreate = false,\n onCreate,\n open: openProp,\n onOpenChange,\n emptyMessage,\n className,\n 'aria-label': ariaLabel,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n autoComplete,\n },\n ref,\n ) {\n const { t } = useTranslation();\n const ctx = useFormField();\n const inFormField = useContext(FormFieldContext) !== null;\n\n const [currentValueRaw, setComboboxValue] = useControllableState<string>({\n value,\n defaultValue: defaultValue ?? '',\n onChange: onValueChange as ((next: string) => void) | undefined,\n });\n const currentValue = currentValueRaw ?? '';\n\n const selectedOption = useMemo(\n () => options.find((o) => o.value === currentValue),\n [options, currentValue],\n );\n const selectedLabel = selectedOption?.label ?? '';\n\n const [search, setSearch] = useState<string>(selectedLabel);\n const [internalOpen, setInternalOpen] = useState(false);\n const isOpenControlled = openProp !== undefined;\n const open = isOpenControlled ? openProp : internalOpen;\n const composingRef = useRef(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const anchorRef = useRef<HTMLDivElement>(null);\n\n useIsomorphicLayoutEffect(() => {\n inputRef.current?.setAttribute('aria-expanded', String(open));\n });\n\n useEffect(() => {\n if (!open) {\n setSearch(selectedLabel);\n }\n }, [selectedLabel, open]);\n\n const inputId = id ?? (inFormField ? ctx.id : undefined);\n const effectiveDisabled =\n (inFormField ? ctx.disabled : false) || Boolean(disabled);\n const effectiveReadOnly = Boolean(readOnly);\n const effectiveRequired =\n (inFormField ? ctx.required : false) || Boolean(required);\n const effectiveInvalid = inFormField ? ctx.invalid : Boolean(ariaInvalid);\n const effectiveTone = effectiveInvalid ? 'error' : tone;\n const describedBy =\n inFormField && ctx.describedBy ? ctx.describedBy : ariaDescribedBy;\n\n const resolvedPlaceholder =\n placeholder ?? t('inputs.combobox.placeholder', 'Search…');\n\n const filterFn = useMemo(\n () => (candidate: string, searchStr: string, keywords?: string[]) => {\n if (composingRef.current) return 1;\n const normalizedCandidate = normalizeDiacritics(candidate);\n const normalizedSearch = normalizeDiacritics(searchStr);\n const normalizedKeywords = keywords?.map(normalizeDiacritics);\n if (externalFilter) {\n return externalFilter(normalizedCandidate, normalizedSearch);\n }\n return defaultFilter(\n normalizedCandidate,\n normalizedSearch,\n normalizedKeywords,\n );\n },\n [externalFilter],\n );\n\n const commit = (next: string) => {\n setComboboxValue(next);\n };\n\n const setOpen = (next: boolean) => {\n if (!isOpenControlled) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const handleSelect = (optValue: string) => {\n const option = options.find((o) => o.value === optValue);\n commit(optValue);\n setSearch(option?.label ?? '');\n setOpen(false);\n };\n\n const handleCreate = (nextValue: string) => {\n onCreate?.(nextValue);\n setOpen(false);\n };\n\n const handleSearchChange = (next: string) => {\n if (effectiveReadOnly) return;\n setSearch(next);\n if (!open && next.length > 0 && !composingRef.current) {\n setOpen(true);\n }\n };\n\n const handleFocus = () => {\n if (!effectiveDisabled && !effectiveReadOnly) setOpen(true);\n };\n\n const handleCompositionStart = () => {\n composingRef.current = true;\n };\n\n const handleCompositionEnd = () => {\n composingRef.current = false;\n if (effectiveReadOnly) return;\n const next = inputRef.current?.value ?? '';\n setSearch(next);\n if (next.length > 0) setOpen(true);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.nativeEvent.isComposing) return;\n if (event.key === 'Escape' && open) {\n event.preventDefault();\n setOpen(false);\n setSearch(selectedLabel);\n }\n };\n\n const handleClear = (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n commit('');\n setSearch('');\n setOpen(true);\n inputRef.current?.focus();\n };\n\n const handleOpenChange = (next: boolean) => {\n if (effectiveReadOnly && next) return;\n setOpen(next);\n if (!next) setSearch(selectedLabel);\n };\n\n // Agent handle — refs mirror state for fresh reads.\n const valueRef = useRef<string>(currentValue);\n useEffect(() => {\n valueRef.current = currentValue;\n }, [currentValue]);\n const searchRef = useRef<string>(search);\n useEffect(() => {\n searchRef.current = search;\n }, [search]);\n const openRef = useRef<boolean>(open);\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n const setOpenStable = useCallback(\n (next: boolean) => {\n if (!isOpenControlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [isOpenControlled, onOpenChange],\n );\n\n const agentHandle = useMemo<ComboboxHandle>(\n () => ({\n getValue: () => valueRef.current || null,\n getQuery: () => searchRef.current,\n getIsOpen: () => openRef.current,\n setValue: (next) => {\n const v = next ?? '';\n setComboboxValue(v);\n const opt = options.find((o) => o.value === v);\n setSearch(opt?.label ?? '');\n },\n setQuery: (query) => {\n setSearch(query);\n },\n clear: () => {\n setComboboxValue('');\n setSearch('');\n },\n open: () => setOpenStable(true),\n close: () => setOpenStable(false),\n }),\n [setComboboxValue, options, setOpenStable],\n );\n useAgentRegistration(comboboxAgent, agentHandle, id);\n\n const showClear =\n clearable &&\n Boolean(currentValue) &&\n !effectiveDisabled &&\n !effectiveReadOnly;\n\n const groups = groupOptions(options);\n const iconClass = iconSizeBySize[size];\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange}>\n <Command\n filter={filterFn}\n shouldFilter\n loop\n // cmdk hardcodes `aria-labelledby` on its input to its own hidden\n // `<label cmdk-label>` element. The label's contents come from the\n // Command Root's `label` (or `aria-label`) prop. If we leave it\n // empty, the input has an aria-labelledby pointer to a blank\n // element and axe's `label-title-only` rule fires. Fall back to\n // the placeholder so the input always has an accessible name —\n // when wrapped in a FormField the visible label still associates\n // via the FormField `<label htmlFor>`.\n label={ariaLabel ?? resolvedPlaceholder}\n className=\"ds:w-full\"\n >\n <Popover.Anchor asChild>\n <div\n ref={anchorRef}\n className={comboboxWrapperVariants({\n size,\n tone: effectiveTone,\n className,\n })}\n data-component=\"combobox\"\n data-component-id={id}\n >\n <Command.Input\n ref={composeRefs(ref, inputRef)}\n value={search}\n onValueChange={handleSearchChange}\n id={inputId}\n name={name}\n placeholder={resolvedPlaceholder}\n disabled={effectiveDisabled}\n readOnly={effectiveReadOnly}\n required={effectiveRequired}\n autoComplete={autoComplete}\n // Note: cmdk's CommandInput hardcodes `aria-labelledby` to\n // its own hidden cmdk-label after spreading user props, so\n // we can't override it from here. We funnel the accessible\n // name through the Command Root's `label` prop above.\n aria-describedby={describedBy}\n aria-invalid={effectiveInvalid || undefined}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n className={comboboxInputVariants({ size })}\n />\n {showClear ? (\n <button\n type=\"button\"\n aria-label={t('inputs.combobox.clear', 'Clear selection')}\n onClick={handleClear}\n onPointerDown={(event) => event.stopPropagation()}\n className={[\n 'ds:inline-flex ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)]',\n 'ds:text-muted-foreground ds:hover:text-foreground',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:size-4',\n ].join(' ')}\n >\n <X aria-hidden=\"true\" className=\"ds:size-3.5\" />\n </button>\n ) : null}\n </div>\n </Popover.Anchor>\n <Popover.Portal forceMount>\n <Popover.Content\n // `forceMount` keeps the listbox in the DOM while the popover\n // is closed so the input's cmdk-set `aria-controls` always\n // points at a real id (axe's aria-valid-attr-value rule).\n // The CSS visibility / pointer-events is gated by data-state.\n forceMount\n hidden={!open}\n // Radix Popover.Content carries `role=\"dialog\"`; axe's\n // `aria-dialog-name` rule requires a name. Surface the\n // surrounding combobox label so the popover is named after\n // the field it serves (or fall back to the i18n default).\n aria-label={\n ariaLabel ?? t('inputs.combobox.popupLabel', 'Options')\n }\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onInteractOutside={(event) => {\n const target = event.target as Node | null;\n if (target && anchorRef.current?.contains(target)) {\n event.preventDefault();\n }\n }}\n sideOffset={4}\n align=\"start\"\n className={comboboxContentVariants()}\n >\n <Command.List className={comboboxListClasses}>\n <Command.Empty className={comboboxEmptyClasses}>\n {emptyMessage ??\n t('inputs.combobox.empty', 'No results found')}\n </Command.Empty>\n {groups.map(({ group, items }, groupIndex) => {\n const body = items.map((option) => {\n const isSelected = option.value === currentValue;\n return (\n <Command.Item\n key={option.value}\n value={option.value}\n data-option-id={option.value}\n keywords={[option.label]}\n disabled={option.disabled}\n onSelect={handleSelect}\n className={comboboxItemVariants({ size })}\n >\n <span\n aria-hidden=\"true\"\n className={`ds:inline-flex ds:items-center ds:justify-center ${iconClass}`}\n >\n {isSelected ? <Check className={iconClass} /> : null}\n </span>\n {option.startAdornment ? (\n // Decorative by contract — the option's accessible\n // name comes from its label. Hide so a text-bearing\n // adornment can't leak into the computed name.\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:items-center ds:shrink-0\"\n >\n {option.startAdornment}\n </span>\n ) : null}\n <span className=\"ds:flex-1 ds:truncate\">\n {option.label}\n </span>\n {option.description ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {option.description}\n </span>\n ) : null}\n </Command.Item>\n );\n });\n if (!group) {\n return (\n <Command.Group key={`group-${groupIndex}`}>\n {body}\n </Command.Group>\n );\n }\n return (\n <Command.Group\n key={`group-${group}`}\n heading={\n <span className={comboboxGroupHeadingClasses}>\n {group}\n </span>\n }\n >\n {body}\n </Command.Group>\n );\n })}\n {allowCreate && search.length > 0 ? (\n <ComboboxCreateRow\n search={search}\n label={t('inputs.combobox.create', 'Create \"{{value}}\"', {\n value: search,\n })}\n iconClass={iconClass}\n size={size}\n onSelect={handleCreate}\n />\n ) : null}\n </Command.List>\n </Popover.Content>\n </Popover.Portal>\n </Command>\n </Popover.Root>\n );\n },\n);\nComboboxImpl.displayName = 'Combobox';\n\ninterface ComboboxComponent {\n <T extends string = string>(\n props: ComboboxProps<T> & { ref?: Ref<HTMLInputElement> },\n ): ReactElement | null;\n displayName?: string;\n}\n\n// forwardRef erases component-level generics, so we re-widen via a callable\n// interface to preserve the `<T extends string>` signature at the call site.\nexport const Combobox = ComboboxImpl as unknown as ComboboxComponent;\n\nexport {\n comboboxInputVariants,\n comboboxWrapperVariants,\n comboboxContentVariants,\n comboboxItemVariants,\n};\n"],"names":["comboboxAgent","handle","args","comboboxInputVariants","cva","comboboxWrapperVariants","INPUT_SURFACE_CHROME","INPUT_SURFACE_HEIGHT","INPUT_SURFACE_PADDING_X","INPUT_SURFACE_TONE","comboboxContentVariants","comboboxItemVariants","comboboxGroupHeadingClasses","comboboxListClasses","comboboxEmptyClasses","iconSizeBySize","ComboboxCreateRow","search","label","iconClass","size","onSelect","useCommandState","state","jsxs","Command","jsx","ComboboxImpl","forwardRef","options","value","defaultValue","onValueChange","placeholder","clearable","disabled","readOnly","required","name","id","tone","externalFilter","allowCreate","onCreate","openProp","onOpenChange","emptyMessage","className","ariaLabel","ariaInvalid","ariaDescribedBy","autoComplete","ref","t","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","currentValueRaw","setComboboxValue","useControllableState","currentValue","selectedOption","useMemo","o","selectedLabel","setSearch","useState","internalOpen","setInternalOpen","isOpenControlled","open","composingRef","useRef","inputRef","anchorRef","useIsomorphicLayoutEffect","_a","useEffect","inputId","effectiveDisabled","effectiveReadOnly","effectiveRequired","effectiveInvalid","effectiveTone","describedBy","resolvedPlaceholder","filterFn","candidate","searchStr","keywords","normalizedCandidate","normalizeDiacritics","normalizedSearch","normalizedKeywords","defaultFilter","commit","next","setOpen","handleSelect","optValue","option","handleCreate","nextValue","handleSearchChange","handleFocus","handleCompositionStart","handleCompositionEnd","handleKeyDown","event","handleClear","handleOpenChange","valueRef","searchRef","openRef","setOpenStable","useCallback","agentHandle","v","opt","query","useAgentRegistration","showClear","groups","groupOptions","Popover","composeRefs","X","target","group","items","groupIndex","body","isSelected","Check","Combobox"],"mappings":";;;;;;;;;;;;;;;;AAGO,MAAMA,KAA8C;AAAA,EACzD,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,iBAAiB,aAAa,UAAU,QAAQ,OAAO;AAAA,EACtE,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA;AAAA,MAET,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAO;AAAA,YACL,MAAM,CAAC,UAAU,MAAM;AAAA,YACvB,aAAa;AAAA,UAAA;AAAA,QACf;AAAA,QAEF,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,QAAQ,MAAM,2BAA2B;AAAA,MACrE,QAAQ,CAACA,GAAQC,MAAmC;AAClD,QAAAD,EAAO,SAASC,EAAK,KAAK;AAAA,MAC5B;AA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EAAK,WAAU,yBACb,YAAO,OACV;AAAA,0BACC6E,EAAO,cACN,gBAAA7E,EAAC,QAAA,EAAK,WAAU,sCACb,UAAA6E,EAAO,aACV,IACE;AAAA,wBAAA;AAAA,sBAAA;AAAA,sBAhCCA,EAAO;AAAA,oBAAA;AAAA,kBAmClB,CAAC;AACD,yBAAK4B,IAQH,gBAAAzG;AAAA,oBAACD,EAAQ;AAAA,oBAAR;AAAA,sBAEC,SACE,gBAAAC,EAAC,QAAA,EAAK,WAAWd,IACd,UAAAuH,GACH;AAAA,sBAGD,UAAAG;AAAA,oBAAA;AAAA,oBAPI,SAASH,CAAK;AAAA,kBAAA,sBAPlB1G,EAAQ,OAAR,EACE,UAAA6G,EAAA,GADiB,SAASD,CAAU,EAEvC;AAAA,gBAeN,CAAC;AAAA,gBACA3F,MAAezB,EAAO,SAAS,IAC9B,gBAAAS;AAAA,kBAACV;AAAA,kBAAA;AAAA,oBACC,QAAAC;AAAA,oBACA,OAAOoC,EAAE,0BAA0B,sBAAsB;AAAA,sBACvD,OAAOpC;AAAA,oBAAA,CACR;AAAA,oBACD,WAAAE;AAAA,oBACA,MAAAC;AAAA,oBACA,UAAUoF;AAAA,kBAAA;AAAA,gBAAA,IAEV;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;AACA7E,GAAa,cAAc;AAWpB,MAAM8G,KAAW9G;"}
|
|
1
|
+
{"version":3,"file":"combobox-D7_NLE2Z.js","sources":["../../src/components/combobox/combobox.agent.ts","../../src/components/combobox/combobox.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { ComboboxHandle } from './combobox';\n\nexport const comboboxAgent: AgentAdapter<ComboboxHandle> = {\n id: 'combobox',\n // Persisted single choice (value state + set_value) → select_single + set_value,\n // plus type-to-filter and open/close of the option list.\n capabilities: ['select_single', 'set_value', 'filter', 'open', 'close'],\n state: {\n value: {\n type: 'string | null',\n descriptionKey: 'ui.agent.combobox.state.value',\n description:\n 'Currently-selected option value, or null when nothing is selected.',\n read: (handle) => handle.getValue(),\n },\n query: {\n type: 'string',\n descriptionKey: 'ui.agent.combobox.state.query',\n description: 'Current filter query in the combobox input.',\n read: (handle) => handle.getQuery(),\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.combobox.state.isOpen',\n description: 'True when the option list is visible.',\n read: (handle) => handle.getIsOpen(),\n },\n },\n actions: {\n set_value: {\n // Persists the user's chosen option — reversible via the same UI.\n safety: 'write',\n argsType: '{ value: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: ['string', 'null'],\n description: 'Option value to select, or null to clear.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.setValue',\n description: 'Set the selected value programmatically.',\n examples: [{ args: { value: 'it' }, note: 'Select the \"it\" option.' }],\n invoke: (handle, args: { value: string | null }) => {\n handle.setValue(args.value);\n },\n },\n apply_filter: {\n // Pure ephemeral filter of the visible options — no persisted change.\n safety: 'read',\n argsType: '{ query: string }',\n argsSchema: {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'Filter text for the list.' },\n },\n required: ['query'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.applyFilter',\n description: 'Set the filter query for the option list.',\n invoke: (handle, args: { query: string }) => {\n handle.setQuery(args.query);\n },\n },\n clear_selection: {\n // Discards the persisted choice — destructive (loses the selection).\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.clearSelection',\n description: 'Clear the current selection.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.open',\n description: 'Open the option list.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.combobox.actions.close',\n description: 'Close the option list.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'combobox' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-option-id',\n description: 'Each option emits its value as data-option-id.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react';\nimport * as Popover from '@radix-ui/react-popover';\nimport { Command, defaultFilter, useCommandState } from 'cmdk';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Check, X } from 'lucide-react';\nimport {\n FormFieldContext,\n useFormField,\n} from '../form-field/form-field-context';\nimport type { OptionShape } from '../_shared/option';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { normalizeDiacritics } from '../_shared/normalize-diacritics';\nimport { groupOptions } from '../_shared/group-options';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport {\n INPUT_SURFACE_CHROME,\n INPUT_SURFACE_HEIGHT,\n INPUT_SURFACE_PADDING_X,\n INPUT_SURFACE_TONE,\n} from '../_shared/input-surface';\nimport { useAgentRegistration } from '../../agent';\nimport { comboboxAgent } from './combobox.agent';\n\nexport type ComboboxOption<T extends string = string> = OptionShape<T>;\n\n// Curated agent-readiness handle — see combobox.agent.ts.\nexport interface ComboboxHandle {\n getValue: () => string | null;\n getQuery: () => string;\n getIsOpen: () => boolean;\n setValue: (value: string | null) => void;\n setQuery: (query: string) => void;\n clear: () => void;\n open: () => void;\n close: () => void;\n}\n\nexport interface ComboboxProps<T extends string = string> {\n options: ComboboxOption<T>[];\n value?: T | '';\n defaultValue?: T;\n onValueChange?: (value: T | '') => void;\n placeholder?: string;\n clearable?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n name?: string;\n id?: string;\n size?: 'sm' | 'md' | 'lg';\n tone?: 'default' | 'error';\n filter?: (value: string, search: string) => number;\n allowCreate?: boolean;\n onCreate?: (value: string) => void;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n emptyMessage?: ReactNode;\n 'aria-label'?: string;\n /**\n * Invalid-state fallback for use OUTSIDE a `<FormField>` (e.g. an inline\n * editor). Inside a FormField the context wins. Drives the error border and\n * the input's `aria-invalid`.\n */\n 'aria-invalid'?: boolean;\n /**\n * Error-message id fallback for use OUTSIDE a `<FormField>`. Inside a\n * FormField the context's `describedBy` wins.\n */\n 'aria-describedby'?: string;\n /**\n * Forwarded to the underlying input as the HTML `autocomplete` token\n * (e.g. `country`, `address-level1`) — WCAG 2.1 §1.3.5. cmdk passes it\n * through to its `Command.Input`.\n */\n autoComplete?: string;\n className?: string;\n}\n\nconst comboboxInputVariants = cva(\n [\n 'ds:peer ds:w-full ds:bg-transparent ds:text-foreground ds:placeholder:text-muted-foreground',\n 'ds:outline-none ds:border-0',\n 'ds:disabled:cursor-not-allowed',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:text-[length:var(--font-size-sm)]',\n md: 'ds:text-[length:var(--font-size-base)]',\n lg: 'ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\nconst comboboxWrapperVariants = cva(\n [\n 'ds:group ds:relative ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)] ds:w-full',\n INPUT_SURFACE_CHROME,\n ].join(' '),\n {\n variants: {\n size: {\n sm: `${INPUT_SURFACE_HEIGHT.sm} ${INPUT_SURFACE_PADDING_X.sm}`,\n md: `${INPUT_SURFACE_HEIGHT.md} ${INPUT_SURFACE_PADDING_X.md}`,\n lg: `${INPUT_SURFACE_HEIGHT.lg} ${INPUT_SURFACE_PADDING_X.lg}`,\n },\n tone: INPUT_SURFACE_TONE,\n },\n defaultVariants: {\n size: 'md',\n tone: 'default',\n },\n },\n);\n\nconst comboboxContentVariants = cva(\n [\n 'ds:z-[var(--z-popover)] ds:overflow-hidden ds:w-[var(--radix-popover-trigger-width)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:text-foreground',\n 'ds:shadow-[var(--shadow-lg)]',\n 'ds:animate-in ds:fade-in ds:zoom-in-95',\n 'ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out',\n 'ds:data-[state=closed]:zoom-out-95',\n 'ds:data-[side=bottom]:slide-in-from-top-2',\n 'ds:data-[side=top]:slide-in-from-bottom-2',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n);\n\nconst comboboxItemVariants = cva(\n [\n 'ds:relative ds:flex ds:cursor-pointer ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:text-foreground ds:outline-none ds:select-none',\n 'ds:data-[highlighted]:bg-muted ds:data-[highlighted]:text-foreground',\n 'ds:data-[highlighted]:border-s-2 ds:data-[highlighted]:border-s-primary',\n 'ds:aria-selected:bg-muted',\n 'ds:aria-disabled:pointer-events-none ds:aria-disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:min-h-8 ds:ps-3 ds:pe-3 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:min-h-[var(--min-target-size)] ds:ps-3 ds:pe-3 ds:text-[length:var(--font-size-base)]',\n lg: 'ds:min-h-12 ds:ps-4 ds:pe-4 ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n },\n);\n\nconst comboboxGroupHeadingClasses = [\n 'ds:ps-3 ds:pe-3 ds:py-1.5',\n 'type-eyebrow ds:text-muted-foreground',\n].join(' ');\n\nconst comboboxListClasses =\n 'ds:max-h-[18rem] ds:overflow-y-auto ds:p-[var(--spacing-xs)]';\n\nconst comboboxEmptyClasses =\n 'ds:ps-3 ds:pe-3 ds:py-2 type-body-sm ds:text-muted-foreground';\n\nconst iconSizeBySize = {\n sm: 'ds:size-3.5',\n md: 'ds:size-4',\n lg: 'ds:size-5',\n} as const;\n\ninterface CreateRowProps {\n search: string;\n label: string;\n iconClass: string;\n size: 'sm' | 'md' | 'lg';\n onSelect: (value: string) => void;\n}\n\nfunction ComboboxCreateRow({\n search,\n label,\n iconClass,\n size,\n onSelect,\n}: CreateRowProps): ReactElement | null {\n // Only surface the create row when no existing item matches the query.\n const filteredCount = useCommandState((state) => state.filtered.count);\n if (filteredCount > 0) return null;\n return (\n <Command.Item\n value={`__combobox-create__${search}`}\n keywords={[]}\n forceMount\n onSelect={() => onSelect(search)}\n className={comboboxItemVariants({ size })}\n >\n <span\n aria-hidden=\"true\"\n className={`ds:inline-flex ds:items-center ds:justify-center ${iconClass}`}\n />\n <span className=\"ds:flex-1 ds:truncate\">{label}</span>\n </Command.Item>\n );\n}\n\nconst ComboboxImpl = forwardRef<HTMLInputElement, ComboboxProps>(\n function Combobox(\n {\n options,\n value,\n defaultValue,\n onValueChange,\n placeholder,\n clearable = false,\n disabled,\n readOnly,\n required,\n name,\n id,\n size = 'md',\n tone = 'default',\n filter: externalFilter,\n allowCreate = false,\n onCreate,\n open: openProp,\n onOpenChange,\n emptyMessage,\n className,\n 'aria-label': ariaLabel,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n autoComplete,\n },\n ref,\n ) {\n const { t } = useTranslation();\n const ctx = useFormField();\n const inFormField = useContext(FormFieldContext) !== null;\n\n const [currentValueRaw, setComboboxValue] = useControllableState<string>({\n value,\n defaultValue: defaultValue ?? '',\n onChange: onValueChange as ((next: string) => void) | undefined,\n });\n const currentValue = currentValueRaw ?? '';\n\n const selectedOption = useMemo(\n () => options.find((o) => o.value === currentValue),\n [options, currentValue],\n );\n const selectedLabel = selectedOption?.label ?? '';\n\n const [search, setSearch] = useState<string>(selectedLabel);\n const [internalOpen, setInternalOpen] = useState(false);\n const isOpenControlled = openProp !== undefined;\n const open = isOpenControlled ? openProp : internalOpen;\n const composingRef = useRef(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const anchorRef = useRef<HTMLDivElement>(null);\n\n useIsomorphicLayoutEffect(() => {\n inputRef.current?.setAttribute('aria-expanded', String(open));\n });\n\n useEffect(() => {\n if (!open) {\n setSearch(selectedLabel);\n }\n }, [selectedLabel, open]);\n\n const inputId = id ?? (inFormField ? ctx.id : undefined);\n const effectiveDisabled =\n (inFormField ? ctx.disabled : false) || Boolean(disabled);\n const effectiveReadOnly = Boolean(readOnly);\n const effectiveRequired =\n (inFormField ? ctx.required : false) || Boolean(required);\n const effectiveInvalid = inFormField ? ctx.invalid : Boolean(ariaInvalid);\n const effectiveTone = effectiveInvalid ? 'error' : tone;\n const describedBy =\n inFormField && ctx.describedBy ? ctx.describedBy : ariaDescribedBy;\n\n const resolvedPlaceholder =\n placeholder ?? t('inputs.combobox.placeholder', 'Search…');\n\n const filterFn = useMemo(\n () => (candidate: string, searchStr: string, keywords?: string[]) => {\n if (composingRef.current) return 1;\n const normalizedCandidate = normalizeDiacritics(candidate);\n const normalizedSearch = normalizeDiacritics(searchStr);\n const normalizedKeywords = keywords?.map(normalizeDiacritics);\n if (externalFilter) {\n return externalFilter(normalizedCandidate, normalizedSearch);\n }\n return defaultFilter(\n normalizedCandidate,\n normalizedSearch,\n normalizedKeywords,\n );\n },\n [externalFilter],\n );\n\n const commit = (next: string) => {\n setComboboxValue(next);\n };\n\n const setOpen = (next: boolean) => {\n if (!isOpenControlled) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const handleSelect = (optValue: string) => {\n const option = options.find((o) => o.value === optValue);\n commit(optValue);\n setSearch(option?.label ?? '');\n setOpen(false);\n };\n\n const handleCreate = (nextValue: string) => {\n onCreate?.(nextValue);\n setOpen(false);\n };\n\n const handleSearchChange = (next: string) => {\n if (effectiveReadOnly) return;\n setSearch(next);\n if (!open && next.length > 0 && !composingRef.current) {\n setOpen(true);\n }\n };\n\n const handleFocus = () => {\n if (!effectiveDisabled && !effectiveReadOnly) setOpen(true);\n };\n\n const handleCompositionStart = () => {\n composingRef.current = true;\n };\n\n const handleCompositionEnd = () => {\n composingRef.current = false;\n if (effectiveReadOnly) return;\n const next = inputRef.current?.value ?? '';\n setSearch(next);\n if (next.length > 0) setOpen(true);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.nativeEvent.isComposing) return;\n if (event.key === 'Escape' && open) {\n event.preventDefault();\n setOpen(false);\n setSearch(selectedLabel);\n }\n };\n\n const handleClear = (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n commit('');\n setSearch('');\n setOpen(true);\n inputRef.current?.focus();\n };\n\n const handleOpenChange = (next: boolean) => {\n if (effectiveReadOnly && next) return;\n setOpen(next);\n if (!next) setSearch(selectedLabel);\n };\n\n // Agent handle — refs mirror state for fresh reads.\n const valueRef = useRef<string>(currentValue);\n useEffect(() => {\n valueRef.current = currentValue;\n }, [currentValue]);\n const searchRef = useRef<string>(search);\n useEffect(() => {\n searchRef.current = search;\n }, [search]);\n const openRef = useRef<boolean>(open);\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n const setOpenStable = useCallback(\n (next: boolean) => {\n if (!isOpenControlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [isOpenControlled, onOpenChange],\n );\n\n const agentHandle = useMemo<ComboboxHandle>(\n () => ({\n getValue: () => valueRef.current || null,\n getQuery: () => searchRef.current,\n getIsOpen: () => openRef.current,\n setValue: (next) => {\n const v = next ?? '';\n setComboboxValue(v);\n const opt = options.find((o) => o.value === v);\n setSearch(opt?.label ?? '');\n },\n setQuery: (query) => {\n setSearch(query);\n },\n clear: () => {\n setComboboxValue('');\n setSearch('');\n },\n open: () => setOpenStable(true),\n close: () => setOpenStable(false),\n }),\n [setComboboxValue, options, setOpenStable],\n );\n useAgentRegistration(comboboxAgent, agentHandle, id);\n\n const showClear =\n clearable &&\n Boolean(currentValue) &&\n !effectiveDisabled &&\n !effectiveReadOnly;\n\n const groups = groupOptions(options);\n const iconClass = iconSizeBySize[size];\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange}>\n <Command\n filter={filterFn}\n shouldFilter\n loop\n // cmdk hardcodes `aria-labelledby` on its input to its own hidden\n // `<label cmdk-label>` element. The label's contents come from the\n // Command Root's `label` (or `aria-label`) prop. If we leave it\n // empty, the input has an aria-labelledby pointer to a blank\n // element and axe's `label-title-only` rule fires. Fall back to\n // the placeholder so the input always has an accessible name —\n // when wrapped in a FormField the visible label still associates\n // via the FormField `<label htmlFor>`.\n label={ariaLabel ?? resolvedPlaceholder}\n className=\"ds:w-full\"\n >\n <Popover.Anchor asChild>\n <div\n ref={anchorRef}\n className={comboboxWrapperVariants({\n size,\n tone: effectiveTone,\n className,\n })}\n data-component=\"combobox\"\n data-component-id={id}\n >\n <Command.Input\n ref={composeRefs(ref, inputRef)}\n value={search}\n onValueChange={handleSearchChange}\n id={inputId}\n name={name}\n placeholder={resolvedPlaceholder}\n disabled={effectiveDisabled}\n readOnly={effectiveReadOnly}\n required={effectiveRequired}\n autoComplete={autoComplete}\n // Note: cmdk's CommandInput hardcodes `aria-labelledby` to\n // its own hidden cmdk-label after spreading user props, so\n // we can't override it from here. We funnel the accessible\n // name through the Command Root's `label` prop above.\n aria-describedby={describedBy}\n aria-invalid={effectiveInvalid || undefined}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n className={comboboxInputVariants({ size })}\n />\n {showClear ? (\n <button\n type=\"button\"\n aria-label={t('inputs.combobox.clear', 'Clear selection')}\n onClick={handleClear}\n onPointerDown={(event) => event.stopPropagation()}\n className={[\n 'ds:inline-flex ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)]',\n 'ds:text-muted-foreground ds:hover:text-foreground',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:size-4',\n ].join(' ')}\n >\n <X aria-hidden=\"true\" className=\"ds:size-3.5\" />\n </button>\n ) : null}\n </div>\n </Popover.Anchor>\n <Popover.Portal forceMount>\n <Popover.Content\n // `forceMount` keeps the listbox in the DOM while the popover\n // is closed so the input's cmdk-set `aria-controls` always\n // points at a real id (axe's aria-valid-attr-value rule).\n // The CSS visibility / pointer-events is gated by data-state.\n forceMount\n hidden={!open}\n // Radix Popover.Content carries `role=\"dialog\"`; axe's\n // `aria-dialog-name` rule requires a name. Surface the\n // surrounding combobox label so the popover is named after\n // the field it serves (or fall back to the i18n default).\n aria-label={\n ariaLabel ?? t('inputs.combobox.popupLabel', 'Options')\n }\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onInteractOutside={(event) => {\n const target = event.target as Node | null;\n if (target && anchorRef.current?.contains(target)) {\n event.preventDefault();\n }\n }}\n sideOffset={4}\n align=\"start\"\n className={comboboxContentVariants()}\n >\n <Command.List className={comboboxListClasses}>\n <Command.Empty className={comboboxEmptyClasses}>\n {emptyMessage ??\n t('inputs.combobox.empty', 'No results found')}\n </Command.Empty>\n {groups.map(({ group, items }, groupIndex) => {\n const body = items.map((option) => {\n const isSelected = option.value === currentValue;\n return (\n <Command.Item\n key={option.value}\n value={option.value}\n data-option-id={option.value}\n keywords={[option.label]}\n disabled={option.disabled}\n onSelect={handleSelect}\n className={comboboxItemVariants({ size })}\n >\n <span\n aria-hidden=\"true\"\n className={`ds:inline-flex ds:items-center ds:justify-center ${iconClass}`}\n >\n {isSelected ? <Check className={iconClass} /> : null}\n </span>\n {option.startAdornment ? (\n // Decorative by contract — the option's accessible\n // name comes from its label. Hide so a text-bearing\n // adornment can't leak into the computed name.\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:items-center ds:shrink-0\"\n >\n {option.startAdornment}\n </span>\n ) : null}\n <span className=\"ds:flex-1 ds:truncate\">\n {option.label}\n </span>\n {option.description ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {option.description}\n </span>\n ) : null}\n {option.endContent ? (\n // Deliberately NOT aria-hidden — unlike\n // `startAdornment`, this slot carries meaning\n // (a price, a count) and must reach the\n // option's accessible name. `ms-auto` pins it\n // to the inline-end and flips under RTL.\n <span className=\"ds:inline-flex ds:items-center ds:ms-auto ds:shrink-0\">\n {option.endContent}\n </span>\n ) : null}\n </Command.Item>\n );\n });\n if (!group) {\n return (\n <Command.Group key={`group-${groupIndex}`}>\n {body}\n </Command.Group>\n );\n }\n return (\n <Command.Group\n key={`group-${group}`}\n heading={\n <span className={comboboxGroupHeadingClasses}>\n {group}\n </span>\n }\n >\n {body}\n </Command.Group>\n );\n })}\n {allowCreate && search.length > 0 ? (\n <ComboboxCreateRow\n search={search}\n label={t('inputs.combobox.create', 'Create \"{{value}}\"', {\n value: search,\n })}\n iconClass={iconClass}\n size={size}\n onSelect={handleCreate}\n />\n ) : null}\n </Command.List>\n </Popover.Content>\n </Popover.Portal>\n </Command>\n </Popover.Root>\n );\n },\n);\nComboboxImpl.displayName = 'Combobox';\n\ninterface ComboboxComponent {\n <T extends string = string>(\n props: ComboboxProps<T> & { ref?: Ref<HTMLInputElement> },\n ): ReactElement | null;\n displayName?: string;\n}\n\n// forwardRef erases component-level generics, so we re-widen via a callable\n// interface to preserve the `<T extends string>` signature at the call site.\nexport const Combobox = ComboboxImpl as unknown as ComboboxComponent;\n\nexport {\n comboboxInputVariants,\n comboboxWrapperVariants,\n comboboxContentVariants,\n comboboxItemVariants,\n};\n"],"names":["comboboxAgent","handle","args","comboboxInputVariants","cva","comboboxWrapperVariants","INPUT_SURFACE_CHROME","INPUT_SURFACE_HEIGHT","INPUT_SURFACE_PADDING_X","INPUT_SURFACE_TONE","comboboxContentVariants","comboboxItemVariants","comboboxGroupHeadingClasses","comboboxListClasses","comboboxEmptyClasses","iconSizeBySize","ComboboxCreateRow","search","label","iconClass","size","onSelect","useCommandState","state","jsxs","Command","jsx","ComboboxImpl","forwardRef","options","value","defaultValue","onValueChange","placeholder","clearable","disabled","readOnly","required","name","id","tone","externalFilter","allowCreate","onCreate","openProp","onOpenChange","emptyMessage","className","ariaLabel","ariaInvalid","ariaDescribedBy","autoComplete","ref","t","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","currentValueRaw","setComboboxValue","useControllableState","currentValue","selectedOption","useMemo","o","selectedLabel","setSearch","useState","internalOpen","setInternalOpen","isOpenControlled","open","composingRef","useRef","inputRef","anchorRef","useIsomorphicLayoutEffect","_a","useEffect","inputId","effectiveDisabled","effectiveReadOnly","effectiveRequired","effectiveInvalid","effectiveTone","describedBy","resolvedPlaceholder","filterFn","candidate","searchStr","keywords","normalizedCandidate","normalizeDiacritics","normalizedSearch","normalizedKeywords","defaultFilter","commit","next","setOpen","handleSelect","optValue","option","handleCreate","nextValue","handleSearchChange","handleFocus","handleCompositionStart","handleCompositionEnd","handleKeyDown","event","handleClear","handleOpenChange","valueRef","searchRef","openRef","setOpenStable","useCallback","agentHandle","v","opt","query","useAgentRegistration","showClear","groups","groupOptions","Popover","composeRefs","X","target","group","items","groupIndex","body","isSelected","Check","Combobox"],"mappings":";;;;;;;;;;;;;;;;AAGO,MAAMA,KAA8C;AAAA,EACzD,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,iBAAiB,aAAa,UAAU,QAAQ,OAAO;AAAA,EACtE,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AA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