@mortenbrudvik/waveui 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +425 -104
  2. package/dist/components/input/Calendar.cjs +2 -0
  3. package/dist/components/input/Calendar.cjs.map +1 -0
  4. package/dist/components/input/Calendar.mjs +352 -0
  5. package/dist/components/input/Calendar.mjs.map +1 -0
  6. package/dist/components/input/Calendar.views.cjs +2 -0
  7. package/dist/components/input/Calendar.views.cjs.map +1 -0
  8. package/dist/components/input/Calendar.views.mjs +194 -0
  9. package/dist/components/input/Calendar.views.mjs.map +1 -0
  10. package/dist/components/input/ColorArea.cjs +1 -1
  11. package/dist/components/input/ColorArea.cjs.map +1 -1
  12. package/dist/components/input/ColorArea.mjs +18 -18
  13. package/dist/components/input/ColorArea.mjs.map +1 -1
  14. package/dist/components/input/Combobox.cjs +1 -1
  15. package/dist/components/input/Combobox.cjs.map +1 -1
  16. package/dist/components/input/Combobox.mjs +232 -156
  17. package/dist/components/input/Combobox.mjs.map +1 -1
  18. package/dist/components/input/Combobox.text.cjs +2 -0
  19. package/dist/components/input/Combobox.text.cjs.map +1 -0
  20. package/dist/components/input/Combobox.text.mjs +24 -0
  21. package/dist/components/input/Combobox.text.mjs.map +1 -0
  22. package/dist/components/input/DatePicker.cjs +1 -1
  23. package/dist/components/input/DatePicker.cjs.map +1 -1
  24. package/dist/components/input/DatePicker.mjs +203 -288
  25. package/dist/components/input/DatePicker.mjs.map +1 -1
  26. package/dist/components/input/Dropdown.cjs +1 -1
  27. package/dist/components/input/Dropdown.cjs.map +1 -1
  28. package/dist/components/input/Dropdown.mjs +135 -109
  29. package/dist/components/input/Dropdown.mjs.map +1 -1
  30. package/dist/components/input/Listbox.cjs +2 -0
  31. package/dist/components/input/Listbox.cjs.map +1 -0
  32. package/dist/components/input/Listbox.mjs +134 -0
  33. package/dist/components/input/Listbox.mjs.map +1 -0
  34. package/dist/components/input/Option.cjs +1 -1
  35. package/dist/components/input/Option.cjs.map +1 -1
  36. package/dist/components/input/Option.mjs +158 -97
  37. package/dist/components/input/Option.mjs.map +1 -1
  38. package/dist/components/input/SwatchPicker.cjs +1 -1
  39. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  40. package/dist/components/input/SwatchPicker.context.cjs +2 -0
  41. package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
  42. package/dist/components/input/SwatchPicker.context.mjs +35 -0
  43. package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
  44. package/dist/components/input/SwatchPicker.mjs +131 -103
  45. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  46. package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
  47. package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
  48. package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
  49. package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
  50. package/dist/components/input/TagPicker.cjs +1 -1
  51. package/dist/components/input/TagPicker.cjs.map +1 -1
  52. package/dist/components/input/TagPicker.mjs +144 -139
  53. package/dist/components/input/TagPicker.mjs.map +1 -1
  54. package/dist/components/input/TimePicker.cjs +1 -1
  55. package/dist/components/input/TimePicker.cjs.map +1 -1
  56. package/dist/components/input/TimePicker.mjs +77 -77
  57. package/dist/components/input/TimePicker.mjs.map +1 -1
  58. package/dist/components/input/dateUtils.cjs +1 -1
  59. package/dist/components/input/dateUtils.cjs.map +1 -1
  60. package/dist/components/input/dateUtils.mjs +114 -96
  61. package/dist/components/input/dateUtils.mjs.map +1 -1
  62. package/dist/components/input/pickerLabels.cjs +2 -0
  63. package/dist/components/input/pickerLabels.cjs.map +1 -0
  64. package/dist/components/input/pickerLabels.mjs +16 -0
  65. package/dist/components/input/pickerLabels.mjs.map +1 -0
  66. package/dist/components/input/pickerValues.cjs +2 -0
  67. package/dist/components/input/pickerValues.cjs.map +1 -0
  68. package/dist/components/input/pickerValues.mjs +24 -0
  69. package/dist/components/input/pickerValues.mjs.map +1 -0
  70. package/dist/components/table/useGridNavigation.cjs +1 -1
  71. package/dist/components/table/useGridNavigation.cjs.map +1 -1
  72. package/dist/components/table/useGridNavigation.mjs +67 -70
  73. package/dist/components/table/useGridNavigation.mjs.map +1 -1
  74. package/dist/hooks/useActiveDescendant.cjs +2 -0
  75. package/dist/hooks/useActiveDescendant.cjs.map +1 -0
  76. package/dist/hooks/useActiveDescendant.mjs +56 -0
  77. package/dist/hooks/useActiveDescendant.mjs.map +1 -0
  78. package/dist/hooks/useListbox.cjs +1 -1
  79. package/dist/hooks/useListbox.cjs.map +1 -1
  80. package/dist/hooks/useListbox.mjs +250 -210
  81. package/dist/hooks/useListbox.mjs.map +1 -1
  82. package/dist/hooks/useRovingGrid.cjs +2 -0
  83. package/dist/hooks/useRovingGrid.cjs.map +1 -0
  84. package/dist/hooks/useRovingGrid.mjs +69 -0
  85. package/dist/hooks/useRovingGrid.mjs.map +1 -0
  86. package/dist/index.cjs +1 -1
  87. package/dist/index.d.cts +2147 -155
  88. package/dist/index.d.ts +2147 -155
  89. package/dist/index.mjs +107 -101
  90. package/dist/lib/classNames.cjs +1 -1
  91. package/dist/lib/classNames.cjs.map +1 -1
  92. package/dist/lib/classNames.mjs +84 -48
  93. package/dist/lib/classNames.mjs.map +1 -1
  94. package/dist/lib/date.cjs +2 -0
  95. package/dist/lib/date.cjs.map +1 -0
  96. package/dist/lib/date.mjs +44 -0
  97. package/dist/lib/date.mjs.map +1 -0
  98. package/dist/lib/focus.cjs +1 -1
  99. package/dist/lib/focus.cjs.map +1 -1
  100. package/dist/lib/focus.mjs +5 -2
  101. package/dist/lib/focus.mjs.map +1 -1
  102. package/dist/lib/layers.cjs.map +1 -1
  103. package/dist/lib/layers.mjs.map +1 -1
  104. package/dist/styles.css +1 -1
  105. package/package.json +1 -1
@@ -1,197 +1,273 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../lib/cn.mjs";
3
- import { warnDeprecated as t } from "../../lib/dev.mjs";
4
- import { composeEventHandlers as n } from "../../lib/composeEventHandlers.mjs";
5
- import { comboboxClassNames as r } from "../../lib/classNames.mjs";
6
- import { useControllable as i } from "../../hooks/useControllable.mjs";
7
- import { useMergedRefs as a } from "../../hooks/useMergedRefs.mjs";
8
- import { useFieldContext as ee, useFieldControl as te } from "../../hooks/useFieldControl.mjs";
9
- import { disabledStyles as ne, inputAppearanceClasses as re, inputFocus as ie, inputHeightClasses as ae, inputPaddingClasses as oe, inputTextClasses as o } from "../../lib/styles.mjs";
10
- import { DismissIcon as se } from "../../lib/icons.mjs";
11
- import { useInputLook as ce } from "./inputLook.mjs";
12
- import { isInvalidLook as le } from "./Input.mjs";
13
- import { useFormReset as ue } from "../../hooks/useFormReset.mjs";
14
- import { HiddenInput as de } from "../internal/HiddenInput.mjs";
15
- import { collectOptionLabels as fe, useListbox as s } from "../../hooks/useListbox.mjs";
16
- import { pickerButtonOffset as pe, pickerEndPadding as me, pickerGlyphSize as he, pickerIconButtonClasses as ge } from "./pickerStyles.mjs";
17
- import { PickerExpandButton as _e, showsExpandButton as ve } from "./Combobox.expand.mjs";
18
- import { ListboxSurface as ye, Option as c, OptionGroup as l, useListboxPopup as be } from "./Option.mjs";
19
- import * as u from "react";
20
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
3
+ import { warnDeprecated as t, warnOnce as n } from "../../lib/dev.mjs";
4
+ import { composeEventHandlers as r } from "../../lib/composeEventHandlers.mjs";
5
+ import { comboboxClassNames as i } from "../../lib/classNames.mjs";
6
+ import { useEventCallback as ee } from "../../hooks/useEventCallback.mjs";
7
+ import { useControllable as a } from "../../hooks/useControllable.mjs";
8
+ import { isFocused as te } from "../../lib/focus.mjs";
9
+ import { useMergedRefs as ne } from "../../hooks/useMergedRefs.mjs";
10
+ import { useFieldContext as re, useFieldControl as ie } from "../../hooks/useFieldControl.mjs";
11
+ import { collectOptionLabels as ae, useListbox as oe } from "../../hooks/useListbox.mjs";
12
+ import { disabledStyles as se, inputAppearanceClasses as ce, inputFocus as le, inputHeightClasses as ue, inputPaddingClasses as de, inputTextClasses as fe } from "../../lib/styles.mjs";
13
+ import { DismissIcon as pe } from "../../lib/icons.mjs";
14
+ import { useInputLook as me } from "./inputLook.mjs";
15
+ import { isInvalidLook as he } from "./Input.mjs";
16
+ import { useFormReset as ge } from "../../hooks/useFormReset.mjs";
17
+ import { HiddenInput as _e } from "../internal/HiddenInput.mjs";
18
+ import { pickerButtonOffset as ve, pickerEndPadding as ye, pickerGlyphSize as be, pickerIconButtonClasses as xe } from "./pickerStyles.mjs";
19
+ import { PickerExpandButton as Se, showsExpandButton as Ce } from "./Combobox.expand.mjs";
20
+ import { insertedText as we, replacedText as Te } from "./Combobox.text.mjs";
21
+ import { ListboxSurface as Ee, Option as o, OptionGroup as s, useListboxPopup as De } from "./Option.mjs";
22
+ import { PickerAnnouncer as Oe, announceToggle as ke, defaultSelectionLabel as Ae } from "./pickerLabels.mjs";
23
+ import { EMPTY_VALUES as je, resetValues as Me, toValues as Ne, toggleValue as Pe } from "./pickerValues.mjs";
24
+ import * as c from "react";
25
+ import { jsx as l, jsxs as Fe } from "react/jsx-runtime";
21
26
  //#region src/components/input/Combobox.tsx
22
- function xe(e, t) {
27
+ var u = /* @__PURE__ */ new Set(["historyUndo", "historyRedo"]);
28
+ function Ie(e, t) {
23
29
  return (e.textValue ?? e.label).toLowerCase().includes(t.toLowerCase());
24
30
  }
25
- var p = (c) => {
26
- let { value: l, defaultValue: p, onValueChange: m, onOptionSelect: h, open: g, defaultOpen: Se, onOpenChange: Ce, placeholder: we, disabled: _ = !1, size: Te, appearance: Ee, freeform: v = !1, name: De, form: y, required: b, autoComplete: Oe = "off", autoCapitalize: ke, autoCorrect: Ae, maxLength: x, readOnly: S, clearable: C = !1, expandIcon: w, labels: T, inputMode: je, spellCheck: Me, enterKeyHint: Ne, autoFocus: Pe, tabIndex: Fe, id: Ie, "aria-label": Le, "aria-labelledby": Re, "aria-describedby": ze, "aria-invalid": Be, "aria-required": Ve, "aria-errormessage": He, "aria-details": Ue, onFocus: We, onBlur: Ge, onKeyDown: Ke, onKeyUp: qe, controlRef: Je, className: Ye, children: E, ref: Xe, ...Ze } = c;
27
- h !== void 0 && t("Combobox", "onOptionSelect", "onValueChange");
28
- let D = ee(), Qe = (b ?? D?.required ?? !1) && !S, O = te({
29
- id: Ie,
30
- "aria-label": Le,
31
- "aria-labelledby": Re,
32
- "aria-describedby": ze,
33
- "aria-invalid": Be,
34
- "aria-required": Ve ?? b
35
- }), $e = le(!1, O["aria-invalid"]), { size: k, appearance: A } = ce(Te, Ee), [j, M] = i(l, p ?? "", m), N = !_ && !S, [P, F] = i(g, (Se ?? !1) && N, Ce), I = P && N, [L, R] = u.useState(null), [et, tt] = u.useState(N);
36
- et !== N && (tt(N), N || R(null));
37
- let z = !N && P;
38
- u.useEffect(() => {
39
- z && F(!1);
40
- }, [z, F]);
41
- let [nt, B] = u.useState(null), V = u.useRef(null), H = u.useRef(null), rt = u.useMemo(() => fe(E), [E]), it = u.useMemo(() => L ? (e) => xe(e, L) : void 0, [L]), U = (e) => {
42
- B(e), M(e), h?.(e);
43
- }, W = () => {
44
- F(!1), R(null);
45
- }, G;
46
- v ? G = () => {
47
- R(null), U("");
48
- } : L && (G = () => R(null));
49
- let K = s({
50
- open: I,
31
+ var d = (o) => {
32
+ let { multiselect: s = !1, value: d, defaultValue: f, onValueChange: Le, onOptionSelect: p, open: Re, defaultOpen: ze, onOpenChange: Be, placeholder: Ve, disabled: m = !1, size: He, appearance: Ue, freeform: We = !1, filter: Ge, query: Ke, defaultQuery: qe, onQueryChange: Je, onActiveOptionChange: Ye, disabledOptionsFocusable: Xe = !1, name: Ze, form: h, required: Qe, autoComplete: $e = "off", autoCapitalize: et, autoCorrect: tt, maxLength: nt, readOnly: g, clearable: rt = !1, expandIcon: it, labels: _, inputMode: at, spellCheck: ot, enterKeyHint: st, autoFocus: ct, tabIndex: lt, id: ut, "aria-label": dt, "aria-labelledby": ft, "aria-describedby": pt, "aria-invalid": mt, "aria-required": ht, "aria-errormessage": gt, "aria-details": _t, onFocus: vt, onBlur: yt, onKeyDown: bt, onKeyUp: xt, controlRef: St, className: Ct, children: v, ref: wt, ...Tt } = o;
33
+ p !== void 0 && t("Combobox", "onOptionSelect", "onValueChange");
34
+ let y = We && !s, Et = We && s;
35
+ c.useEffect(() => {
36
+ Et && n("Combobox:freeform-multiselect", "Combobox: `freeform` is not available with `multiselect`: a multi-select Combobox selects options only.");
37
+ }, [Et]);
38
+ let Dt = y && (Ke !== void 0 || qe !== void 0);
39
+ c.useEffect(() => {
40
+ Dt && n("Combobox:query-freeform", "Combobox: `query` and `defaultQuery` are not used with `freeform`: the typed text is the value (`value`, `onValueChange`).");
41
+ }, [Dt]);
42
+ let b = re(), Ot = (Qe ?? b?.required ?? !1) && !g, x = ie({
43
+ id: ut,
44
+ "aria-label": dt,
45
+ "aria-labelledby": ft,
46
+ "aria-describedby": pt,
47
+ "aria-invalid": mt,
48
+ "aria-required": ht ?? Qe
49
+ }), kt = he(!1, x["aria-invalid"]), { size: S, appearance: C } = me(He, Ue), [At, w] = a(d, f ?? (s ? je : ""), (e) => {
50
+ Le?.(typeof e == "string" ? e : [...e]);
51
+ }), T = Ne(At), E = s ? "" : At, D = !m && !g, [O, k] = a(Re, (ze ?? !1) && D, Be), A = O && D, [jt, j] = a(y ? void 0 : Ke, D ? qe ?? "" : "", y ? void 0 : Je), [Mt, M] = c.useState(!1), [N, P] = c.useState(null), F = y ? N : D && (Mt || jt !== "") ? jt : null, [I, Nt] = c.useState(D ? "unlocked" : "mounted-locked");
52
+ D && I !== "unlocked" ? Nt("unlocked") : !D && I === "unlocked" && (Nt("locked"), M(!1), P(null)), c.useEffect(() => {
53
+ I === "locked" && j("");
54
+ }, [I, j]);
55
+ let Pt = !D && O;
56
+ c.useEffect(() => {
57
+ Pt && k(!1);
58
+ }, [Pt, k]);
59
+ let [Ft, L] = c.useState(null), It = c.useRef(null), R = c.useRef(null), Lt = c.useMemo(() => ae(v), [v]), z = F ?? "", Rt = c.useMemo(() => z ? (e) => (Ge ?? Ie)(e, z) : void 0, [z, Ge]), B = (e) => {
60
+ y ? P(e) : (M(!0), j(e));
61
+ }, V = () => {
62
+ y ? P(null) : (M(!1), j(""));
63
+ }, zt = (e) => {
64
+ L(e), w(e), p?.(e);
65
+ }, H = () => {
66
+ k(!1), V();
67
+ }, U;
68
+ y ? U = () => {
69
+ P(null), zt("");
70
+ } : F && (U = V);
71
+ let W = oe({
72
+ open: A,
51
73
  onOpenChange: (e) => {
52
- e ? F(!0) : W();
74
+ e ? k(!0) : H();
53
75
  },
54
76
  mode: "editable",
55
- selectedValues: j ? [j] : [],
56
- onSelect: (e) => {
57
- M(e), h?.(e), R(null), B(null);
77
+ multiselect: s,
78
+ disabledOptionsFocusable: Xe,
79
+ selectedValues: T,
80
+ onSelect: (e, t) => {
81
+ if (!s) {
82
+ w(e), p?.(e), V(), L(null);
83
+ return;
84
+ }
85
+ let { values: n, added: r } = Pe(T, e);
86
+ w(n), p?.(e), ke(_, t?.item.label ?? Lt.get(e) ?? e, r, n.length), V();
58
87
  },
59
- filter: it,
60
- autoHighlight: !v && L ? "first" : !1,
88
+ filter: Rt,
89
+ autoHighlight: !y && F ? "first" : !1,
90
+ onActiveValueChange: Ye,
61
91
  idPrefix: "combobox-listbox",
62
- onClearDraft: G
63
- }), q = j ? K.getItem(j)?.label ?? rt.get(j) : void 0, J;
64
- J = v ? j === nt ? j : q ?? j : L ?? q ?? "", v && L !== null && L !== J && R(J);
65
- let Y = I && K.items.length > 0, X = T?.noMatches ?? "No matches", Z = I && (Y || !!L), at = Z && !Y, { layerId: ot, setReference: st, surfaceRef: ct, floatingProps: lt } = be({
66
- open: I,
67
- surfaceOpen: Z,
68
- onDismiss: W,
69
- rootRef: V,
70
- anchorRef: H
71
- }), ut = a(V, Xe), dt = a(H, Je, st);
72
- ue(H, () => {
73
- M(p ?? ""), R(null), B(null);
74
- }, y);
75
- let ft = (e) => {
76
- if (e.key === "Escape" && I && !Z && !e.nativeEvent.isComposing) {
77
- W(), G && e.currentTarget.value !== "" && (e.preventDefault(), G());
92
+ onClearDraft: U
93
+ }), Bt = (e) => W.getItem(e)?.label ?? Lt.get(e), G = "";
94
+ if (s) {
95
+ let e = T.map(Bt).filter((e) => e !== void 0);
96
+ e.length > 0 && (G = (_?.selection ?? Ae)(e));
97
+ }
98
+ let K = s && F === null && G !== "", Vt = E ? Bt(E) : void 0, q;
99
+ q = s ? F ?? G : y ? E === Ft ? E : Vt ?? E : F ?? Vt ?? "", y && N !== null && N !== q && P(q);
100
+ let J = A && W.items.length > 0, Ht = _?.noMatches ?? "No matches", Y = A && (J || !!F), Ut = Y && !J, { layerId: Wt, setReference: Gt, surfaceRef: Kt, floatingProps: qt } = De({
101
+ open: A,
102
+ surfaceOpen: Y,
103
+ onDismiss: H,
104
+ rootRef: It,
105
+ anchorRef: R
106
+ }), Jt = ne(It, wt), Yt = ne(R, St, Gt);
107
+ ge(R, () => {
108
+ w(s ? (e) => Me(e, f) : f ?? ""), V(), L(null);
109
+ }, h);
110
+ let X = c.useRef(!1), Xt = (e) => {
111
+ X.current = K && !te(e.currentTarget);
112
+ }, Zt = (e) => {
113
+ K && e.currentTarget.select();
114
+ }, Qt = (e) => {
115
+ X.current && (X.current = !1, e.preventDefault());
116
+ };
117
+ c.useLayoutEffect(() => {
118
+ let e = R.current;
119
+ K && e && te(e) && e.select();
120
+ }, [K, G]);
121
+ let Z = c.useRef(null), $t = c.useRef(null), Q = ee((e) => {
122
+ let t = e.currentTarget;
123
+ K && t.value === G && (Z.current = null, !u.has(e.inputType ?? "") && ($t.current = e, B(G), A || k(!0)));
124
+ });
125
+ c.useEffect(() => {
126
+ let e = R.current;
127
+ if (!s || !e) return;
128
+ let t = (t) => {
129
+ let { inputType: n } = t, { selectionStart: r, selectionEnd: i } = e;
130
+ Z.current = {
131
+ inputType: n,
132
+ range: n === "insertFromDrop" || u.has(n) || r === null || i === null ? null : [r, i]
133
+ };
134
+ };
135
+ return e.addEventListener("beforeinput", t), e.addEventListener("input", Q), () => {
136
+ e.removeEventListener("beforeinput", t), e.removeEventListener("input", Q);
137
+ };
138
+ }, [s, Q]);
139
+ let en = (e) => {
140
+ if (e.key === "Escape" && A && !Y && !e.nativeEvent.isComposing) {
141
+ H(), U && e.currentTarget.value !== "" && (e.preventDefault(), U());
78
142
  return;
79
143
  }
80
- K.onKeyDown(e);
81
- }, pt = (e) => {
82
- let t = e.target.value;
83
- R(t), I || F(!0), v && U(t);
84
- }, mt = () => {
85
- N && (I ? W() : F(!0), H.current?.focus());
86
- }, ht = () => {
87
- M(""), B(null), R(null), F(!1), H.current?.focus();
88
- }, Q = ve(w), $ = C && j !== "" && !S, gt = O["aria-label"] === void 0 ? O["aria-labelledby"] ?? D?.labelId : O["aria-labelledby"];
89
- return /* @__PURE__ */ f("div", {
90
- "data-size": k,
91
- "data-appearance": A,
92
- ...Ze,
93
- ref: ut,
94
- className: e(r.root, "relative inline-flex flex-col", Ye),
144
+ W.onKeyDown(e);
145
+ }, tn = (e) => {
146
+ if (e.nativeEvent === $t.current) return;
147
+ let t = e.target.value, n = Z.current;
148
+ Z.current = null;
149
+ let r = n && n.inputType === e.nativeEvent.inputType ? n : null;
150
+ if (!s) B(t);
151
+ else if (t === G && (r === null || u.has(r.inputType))) V();
152
+ else if (K) {
153
+ let e = r?.range;
154
+ B((e && Te(G, t, e[0], e[1])) ?? we(G, t));
155
+ } else B(t);
156
+ A || k(!0), y && zt(t);
157
+ }, nn = () => {
158
+ D && (A ? H() : k(!0), R.current?.focus());
159
+ }, rn = () => {
160
+ w(s ? je : ""), L(null), V(), k(!1), R.current?.focus();
161
+ }, $ = Ce(it), an = rt && (s ? T.length > 0 : E !== "") && !g, on = x["aria-label"] === void 0 ? x["aria-labelledby"] ?? b?.labelId : x["aria-labelledby"];
162
+ return /* @__PURE__ */ Fe("div", {
163
+ "data-size": S,
164
+ "data-appearance": C,
165
+ ...Tt,
166
+ ref: Jt,
167
+ className: e(i.root, "relative inline-flex flex-col", Ct),
95
168
  children: [
96
- /* @__PURE__ */ f("div", {
169
+ s && /* @__PURE__ */ l(Oe, {}),
170
+ /* @__PURE__ */ Fe("div", {
97
171
  className: "relative flex items-center",
98
172
  children: [
99
- /* @__PURE__ */ d("input", {
173
+ /* @__PURE__ */ l("input", {
100
174
  type: "text",
101
- autoComplete: Oe,
102
- ...O,
103
- ...K.getComboboxProps(),
104
- "aria-expanded": Y,
105
- "aria-errormessage": He,
106
- "aria-details": Ue,
107
- ref: dt,
108
- disabled: _,
109
- readOnly: S,
110
- placeholder: we,
111
- autoCapitalize: ke,
112
- autoCorrect: Ae,
113
- maxLength: x,
114
- inputMode: je,
115
- spellCheck: Me,
116
- enterKeyHint: Ne,
117
- autoFocus: Pe,
118
- tabIndex: Fe,
119
- value: J,
120
- onChange: pt,
175
+ autoComplete: $e,
176
+ ...x,
177
+ ...W.getComboboxProps(),
178
+ "aria-expanded": J,
179
+ "aria-errormessage": gt,
180
+ "aria-details": _t,
181
+ ref: Yt,
182
+ disabled: m,
183
+ readOnly: g,
184
+ placeholder: s && G !== "" ? void 0 : Ve,
185
+ autoCapitalize: et,
186
+ autoCorrect: tt,
187
+ maxLength: K ? void 0 : nt,
188
+ inputMode: at,
189
+ spellCheck: ot,
190
+ enterKeyHint: st,
191
+ autoFocus: ct,
192
+ tabIndex: lt,
193
+ value: q,
194
+ onChange: tn,
121
195
  onClick: () => {
122
- !I && N && F(!0);
196
+ !A && D && k(!0);
123
197
  },
124
- onKeyDown: n(Ke, S ? void 0 : ft),
125
- onKeyUp: n(qe, K.onKeyUp),
126
- onFocus: We,
127
- onBlur: n(Ge, () => R(null), { checkDefaultPrevented: !1 }),
128
- className: e(r.input, ae[k], "w-full", oe[k], o[k], re[A], "text-foreground placeholder:text-muted-foreground", ie, ne, $e && "border-destructive", me(Number($) + Number(Q), k))
198
+ onMouseDown: Xt,
199
+ onMouseUp: Qt,
200
+ onKeyDown: r(bt, g ? void 0 : en),
201
+ onKeyUp: r(xt, W.onKeyUp),
202
+ onFocus: r(vt, Zt),
203
+ onBlur: r(yt, V, { checkDefaultPrevented: !1 }),
204
+ className: e(i.input, ue[S], "w-full", de[S], fe[S], ce[C], "text-foreground placeholder:text-muted-foreground", le, se, kt && "border-destructive", ye(Number(an) + Number($), S))
129
205
  }),
130
- $ && /* @__PURE__ */ d("button", {
206
+ an && /* @__PURE__ */ l("button", {
131
207
  type: "button",
132
- "aria-label": T?.clear ?? "Clear selection",
133
- disabled: _,
208
+ "aria-label": _?.clear ?? "Clear selection",
209
+ disabled: m,
134
210
  onMouseDown: (e) => e.preventDefault(),
135
- onClick: ht,
136
- className: e(r.clearButton, ge(k, A), pe(k, Q ? 2 : 1), "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
137
- children: /* @__PURE__ */ d(se, { size: he(k, "icon") })
211
+ onClick: rn,
212
+ className: e(i.clearButton, xe(S, C), ve(S, $ ? 2 : 1), "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
213
+ children: /* @__PURE__ */ l(pe, { size: be(S, "icon") })
138
214
  }),
139
- Q && /* @__PURE__ */ d(_e, {
215
+ $ && /* @__PURE__ */ l(Se, {
140
216
  component: "Combobox",
141
- expandIcon: w,
142
- label: T?.expand ?? "Show options",
143
- expanded: Y,
144
- listboxId: K.listboxId,
145
- disabled: _ || !!S,
146
- onToggle: mt,
147
- size: k,
148
- appearance: A,
149
- className: r.expandButton,
150
- iconClassName: r.expandIcon
217
+ expandIcon: it,
218
+ label: _?.expand ?? "Show options",
219
+ expanded: J,
220
+ listboxId: W.listboxId,
221
+ disabled: m || !!g,
222
+ onToggle: nn,
223
+ size: S,
224
+ appearance: C,
225
+ className: i.expandButton,
226
+ iconClassName: i.expandIcon
151
227
  })
152
228
  ]
153
229
  }),
154
- /* @__PURE__ */ d("span", {
230
+ /* @__PURE__ */ l("span", {
155
231
  role: "status",
156
232
  className: "sr-only",
157
- children: at && X
233
+ children: Ut && Ht
158
234
  }),
159
- /* @__PURE__ */ d(ye, {
160
- listbox: K,
161
- layerId: ot,
162
- surfaceRef: ct,
163
- floatingProps: lt,
164
- open: I,
165
- expanded: Y,
166
- listboxClassName: r.listbox,
167
- surfaceClassName: r.surface,
168
- emptyContent: L ? /* @__PURE__ */ d("div", {
235
+ /* @__PURE__ */ l(Ee, {
236
+ listbox: W,
237
+ layerId: Wt,
238
+ surfaceRef: Kt,
239
+ floatingProps: qt,
240
+ open: A,
241
+ expanded: J,
242
+ listClassName: i.listbox,
243
+ surfaceClassName: i.surface,
244
+ emptyContent: F ? /* @__PURE__ */ l("div", {
169
245
  "aria-hidden": "true",
170
- className: e(r.emptyMessage, "px-3 py-1.5 text-body-1 text-muted-foreground"),
171
- children: X
246
+ className: e(i.emptyMessage, "px-3 py-1.5 text-body-1 text-muted-foreground"),
247
+ children: Ht
172
248
  }) : void 0,
173
- "aria-label": O["aria-label"],
174
- "aria-labelledby": gt,
175
- children: E
249
+ "aria-label": x["aria-label"],
250
+ "aria-labelledby": on,
251
+ children: v
176
252
  }),
177
- /* @__PURE__ */ d(de, {
178
- name: De,
179
- form: y,
180
- disabled: _,
181
- value: j,
253
+ /* @__PURE__ */ l(_e, {
254
+ name: Ze,
255
+ form: h,
256
+ disabled: m,
257
+ value: s ? T : E,
182
258
  type: "text",
183
- required: Qe,
184
- onInvalid: () => H.current?.focus()
259
+ required: Ot,
260
+ onInvalid: () => R.current?.focus()
185
261
  })
186
262
  ]
187
263
  });
188
264
  };
189
- p.displayName = "Combobox";
190
- var m = c, h = l, g = /* @__PURE__ */ Object.assign(p, {
191
- Option: c,
192
- OptionGroup: l
265
+ d.displayName = "Combobox";
266
+ var f = o, Le = s, p = /* @__PURE__ */ Object.assign(d, {
267
+ Option: o,
268
+ OptionGroup: s
193
269
  });
194
270
  //#endregion
195
- export { g as Combobox, m as ComboboxOption, h as ComboboxOptionGroup, c as Option, l as OptionGroup };
271
+ export { p as Combobox, f as ComboboxOption, Le as ComboboxOptionGroup, o as Option, s as OptionGroup };
196
272
 
197
273
  //# sourceMappingURL=Combobox.mjs.map