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