@mortenbrudvik/waveui 0.8.0 → 0.9.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 (132) hide show
  1. package/README.md +231 -85
  2. package/dist/components/data-display/InfoButton.cjs +2 -0
  3. package/dist/components/data-display/InfoButton.cjs.map +1 -0
  4. package/dist/components/data-display/InfoButton.mjs +173 -0
  5. package/dist/components/data-display/InfoButton.mjs.map +1 -0
  6. package/dist/components/data-display/InfoLabel.cjs +1 -1
  7. package/dist/components/data-display/InfoLabel.cjs.map +1 -1
  8. package/dist/components/data-display/InfoLabel.mjs +39 -96
  9. package/dist/components/data-display/InfoLabel.mjs.map +1 -1
  10. package/dist/components/input/Checkbox.cjs +1 -1
  11. package/dist/components/input/Checkbox.cjs.map +1 -1
  12. package/dist/components/input/Checkbox.mjs +91 -75
  13. package/dist/components/input/Checkbox.mjs.map +1 -1
  14. package/dist/components/input/ColorPicker.parts.cjs +1 -1
  15. package/dist/components/input/ColorPicker.parts.cjs.map +1 -1
  16. package/dist/components/input/ColorPicker.parts.mjs +1 -1
  17. package/dist/components/input/ColorPicker.parts.mjs.map +1 -1
  18. package/dist/components/input/Combobox.cjs +1 -1
  19. package/dist/components/input/Combobox.cjs.map +1 -1
  20. package/dist/components/input/Combobox.expand.cjs +1 -1
  21. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  22. package/dist/components/input/Combobox.expand.mjs +20 -20
  23. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  24. package/dist/components/input/Combobox.mjs +143 -138
  25. package/dist/components/input/Combobox.mjs.map +1 -1
  26. package/dist/components/input/DatePicker.cjs +1 -1
  27. package/dist/components/input/DatePicker.cjs.map +1 -1
  28. package/dist/components/input/DatePicker.mjs +213 -209
  29. package/dist/components/input/DatePicker.mjs.map +1 -1
  30. package/dist/components/input/Dropdown.cjs +1 -1
  31. package/dist/components/input/Dropdown.cjs.map +1 -1
  32. package/dist/components/input/Dropdown.mjs +80 -74
  33. package/dist/components/input/Dropdown.mjs.map +1 -1
  34. package/dist/components/input/Field.cjs +1 -1
  35. package/dist/components/input/Field.cjs.map +1 -1
  36. package/dist/components/input/Field.mjs +99 -66
  37. package/dist/components/input/Field.mjs.map +1 -1
  38. package/dist/components/input/Input.cjs +1 -1
  39. package/dist/components/input/Input.cjs.map +1 -1
  40. package/dist/components/input/Input.mjs +79 -55
  41. package/dist/components/input/Input.mjs.map +1 -1
  42. package/dist/components/input/Label.cjs +1 -1
  43. package/dist/components/input/Label.cjs.map +1 -1
  44. package/dist/components/input/Label.mjs +19 -13
  45. package/dist/components/input/Label.mjs.map +1 -1
  46. package/dist/components/input/Rating.cjs +1 -1
  47. package/dist/components/input/Rating.cjs.map +1 -1
  48. package/dist/components/input/Rating.item.cjs +2 -0
  49. package/dist/components/input/Rating.item.cjs.map +1 -0
  50. package/dist/components/input/Rating.item.mjs +255 -0
  51. package/dist/components/input/Rating.item.mjs.map +1 -0
  52. package/dist/components/input/Rating.mjs +150 -151
  53. package/dist/components/input/Rating.mjs.map +1 -1
  54. package/dist/components/input/SearchBox.cjs +1 -1
  55. package/dist/components/input/SearchBox.cjs.map +1 -1
  56. package/dist/components/input/SearchBox.mjs +146 -115
  57. package/dist/components/input/SearchBox.mjs.map +1 -1
  58. package/dist/components/input/Select.cjs +1 -1
  59. package/dist/components/input/Select.cjs.map +1 -1
  60. package/dist/components/input/Select.mjs +34 -25
  61. package/dist/components/input/Select.mjs.map +1 -1
  62. package/dist/components/input/Slider.cjs +1 -1
  63. package/dist/components/input/Slider.cjs.map +1 -1
  64. package/dist/components/input/Slider.mjs +77 -54
  65. package/dist/components/input/Slider.mjs.map +1 -1
  66. package/dist/components/input/SpinButton.cjs +1 -1
  67. package/dist/components/input/SpinButton.cjs.map +1 -1
  68. package/dist/components/input/SpinButton.mjs +198 -96
  69. package/dist/components/input/SpinButton.mjs.map +1 -1
  70. package/dist/components/input/Switch.cjs +1 -1
  71. package/dist/components/input/Switch.cjs.map +1 -1
  72. package/dist/components/input/Switch.mjs +71 -55
  73. package/dist/components/input/Switch.mjs.map +1 -1
  74. package/dist/components/input/TagPicker.cjs +1 -1
  75. package/dist/components/input/TagPicker.cjs.map +1 -1
  76. package/dist/components/input/TagPicker.mjs +142 -116
  77. package/dist/components/input/TagPicker.mjs.map +1 -1
  78. package/dist/components/input/Textarea.cjs +1 -1
  79. package/dist/components/input/Textarea.cjs.map +1 -1
  80. package/dist/components/input/Textarea.mjs +28 -21
  81. package/dist/components/input/Textarea.mjs.map +1 -1
  82. package/dist/components/input/TimePicker.cjs +1 -1
  83. package/dist/components/input/TimePicker.cjs.map +1 -1
  84. package/dist/components/input/TimePicker.mjs +189 -184
  85. package/dist/components/input/TimePicker.mjs.map +1 -1
  86. package/dist/components/input/fieldLabel.cjs +2 -0
  87. package/dist/components/input/fieldLabel.cjs.map +1 -0
  88. package/dist/components/input/fieldLabel.mjs +17 -0
  89. package/dist/components/input/fieldLabel.mjs.map +1 -0
  90. package/dist/components/input/inputLook.cjs +2 -0
  91. package/dist/components/input/inputLook.cjs.map +1 -0
  92. package/dist/components/input/inputLook.mjs +28 -0
  93. package/dist/components/input/inputLook.mjs.map +1 -0
  94. package/dist/components/input/pickerStyles.cjs +1 -1
  95. package/dist/components/input/pickerStyles.cjs.map +1 -1
  96. package/dist/components/input/pickerStyles.mjs +42 -4
  97. package/dist/components/input/pickerStyles.mjs.map +1 -1
  98. package/dist/components/navigation/Menu.popover.cjs +1 -1
  99. package/dist/components/navigation/Menu.popover.cjs.map +1 -1
  100. package/dist/components/navigation/Menu.popover.mjs +10 -10
  101. package/dist/components/navigation/Menu.root.cjs +1 -1
  102. package/dist/components/navigation/Menu.root.cjs.map +1 -1
  103. package/dist/components/navigation/Menu.root.mjs +10 -10
  104. package/dist/components/overlays/Popover.cjs +1 -1
  105. package/dist/components/overlays/Popover.cjs.map +1 -1
  106. package/dist/components/overlays/Popover.mjs +203 -208
  107. package/dist/components/overlays/Popover.mjs.map +1 -1
  108. package/dist/components/overlays/Popover.shared.cjs +1 -1
  109. package/dist/components/overlays/Popover.shared.cjs.map +1 -1
  110. package/dist/components/overlays/Popover.shared.mjs +82 -77
  111. package/dist/components/overlays/Popover.shared.mjs.map +1 -1
  112. package/dist/components/provider/WaveProvider.cjs +1 -1
  113. package/dist/components/provider/WaveProvider.cjs.map +1 -1
  114. package/dist/components/provider/WaveProvider.mjs +25 -19
  115. package/dist/components/provider/WaveProvider.mjs.map +1 -1
  116. package/dist/hooks/useFieldControl.cjs.map +1 -1
  117. package/dist/hooks/useFieldControl.mjs.map +1 -1
  118. package/dist/index.cjs +1 -1
  119. package/dist/index.d.cts +805 -99
  120. package/dist/index.d.ts +805 -99
  121. package/dist/index.mjs +101 -99
  122. package/dist/lib/classNames.cjs +1 -1
  123. package/dist/lib/classNames.cjs.map +1 -1
  124. package/dist/lib/classNames.mjs +74 -66
  125. package/dist/lib/classNames.mjs.map +1 -1
  126. package/dist/lib/styles.cjs +1 -1
  127. package/dist/lib/styles.cjs.map +1 -1
  128. package/dist/lib/styles.mjs +21 -4
  129. package/dist/lib/styles.mjs.map +1 -1
  130. package/dist/styles.css +1 -1
  131. package/package.json +1 -1
  132. package/src/styles/tokens.css +13 -0
@@ -11,276 +11,281 @@ import { joinIds as ne } from "../../lib/aria.mjs";
11
11
  import { useFieldContext as re, useFieldControl as ie } from "../../hooks/useFieldControl.mjs";
12
12
  import { useDismiss as ae } from "../../hooks/useDismiss.mjs";
13
13
  import { Portal as oe } from "../portal/Portal.mjs";
14
- import { disabledStyles as se, forcedColors as s, inputBase as ce, inputFocus as le } from "../../lib/styles.mjs";
15
- import { CheckIcon as c, DismissIcon as ue } from "../../lib/icons.mjs";
16
- import { isInvalidLook as de } from "./Input.mjs";
17
- import { useFormReset as fe } from "../../hooks/useFormReset.mjs";
18
- import { HiddenInput as pe } from "../internal/HiddenInput.mjs";
19
- import { ListboxContext as me, useListbox as he, useListboxOption as l } from "../../hooks/useListbox.mjs";
20
- import { pickerEndPadding as ge } from "./pickerStyles.mjs";
21
- import { PickerExpandButton as _e, showsExpandButton as ve } from "./Combobox.expand.mjs";
22
- import { usePopupPosition as ye } from "../../hooks/usePopupPosition.mjs";
23
- import { generateTimeOptions as be, minutesToTime as xe, minutesToValue as u, normalizeTimeStep as Se, timeToMinutes as d } from "./dateUtils.mjs";
24
- import * as f from "react";
25
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
26
- import { flushSync as Ce } from "react-dom";
14
+ import { disabledStyles as se, forcedColors as s, inputAppearanceClasses as ce, inputFocus as le, inputHeightClasses as ue, inputPaddingClasses as de, inputTextClasses as fe } from "../../lib/styles.mjs";
15
+ import { CheckIcon as pe, DismissIcon as me } from "../../lib/icons.mjs";
16
+ import { useInputLook as he } from "./inputLook.mjs";
17
+ import { isInvalidLook as ge } from "./Input.mjs";
18
+ import { useFormReset as _e } from "../../hooks/useFormReset.mjs";
19
+ import { HiddenInput as ve } from "../internal/HiddenInput.mjs";
20
+ import { ListboxContext as ye, useListbox as be, useListboxOption as c } from "../../hooks/useListbox.mjs";
21
+ import { pickerButtonOffset as xe, pickerEndPadding as Se, pickerGlyphSize as Ce, pickerIconButtonClasses as we } from "./pickerStyles.mjs";
22
+ import { PickerExpandButton as Te, showsExpandButton as Ee } from "./Combobox.expand.mjs";
23
+ import { usePopupPosition as De } from "../../hooks/usePopupPosition.mjs";
24
+ import { generateTimeOptions as Oe, minutesToTime as ke, minutesToValue as l, normalizeTimeStep as Ae, timeToMinutes as u } from "./dateUtils.mjs";
25
+ import * as d from "react";
26
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
27
+ import { flushSync as je } from "react-dom";
27
28
  //#region src/components/input/TimePicker.tsx
28
- var h = "flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold", we = f.memo(function({ value: t, label: n }) {
29
- let { selected: r, optionProps: a } = l({
29
+ var m = "flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold", Me = d.memo(function({ value: t, label: n }) {
30
+ let { selected: r, optionProps: a } = c({
30
31
  value: t,
31
32
  label: n
32
33
  });
33
- return /* @__PURE__ */ m("li", {
34
+ return /* @__PURE__ */ p("li", {
34
35
  ...a,
35
- className: e(i.option, h, r && s.selectedContainer),
36
- children: [/* @__PURE__ */ p("span", {
36
+ className: e(i.option, m, r && s.selectedContainer),
37
+ children: [/* @__PURE__ */ f("span", {
37
38
  className: e(i.checkIcon, "flex h-4 w-4 shrink-0 items-center justify-center"),
38
- children: r ? /* @__PURE__ */ p(c, { size: 12 }) : null
39
+ children: r ? /* @__PURE__ */ f(pe, { size: 12 }) : null
39
40
  }), n]
40
41
  });
41
42
  });
42
- we.displayName = "TimePickerOption";
43
- var Te = (e) => `Enter a time in the format ${e}.`, Ee = (e, t) => e !== void 0 && t !== void 0 ? `Enter a time between ${e} and ${t}.` : e === void 0 ? `Enter a time on or before ${t}.` : `Enter a time on or after ${e}.`;
44
- function g(e, t) {
45
- let n = d(e);
46
- return Number.isNaN(n) ? e : xe(n, t);
43
+ Me.displayName = "TimePickerOption";
44
+ var Ne = (e) => `Enter a time in the format ${e}.`, Pe = (e, t) => e !== void 0 && t !== void 0 ? `Enter a time between ${e} and ${t}.` : e === void 0 ? `Enter a time on or before ${t}.` : `Enter a time on or after ${e}.`;
45
+ function h(e, t) {
46
+ let n = u(e);
47
+ return Number.isNaN(n) ? e : ke(n, t);
47
48
  }
48
- function De(e, t) {
49
+ function Fe(e, t) {
49
50
  return e.label.toLowerCase().includes(t) || e.value.includes(t);
50
51
  }
51
- function Oe(e, t) {
52
+ function Ie(e, t) {
52
53
  return e.label.toLowerCase().startsWith(t) || e.value.startsWith(t);
53
54
  }
54
- var _ = (s) => {
55
- let { value: c, defaultValue: l, onValueChange: xe, onChange: h, format: _ = "12h", step: v = 30, minTime: y = "00:00", maxTime: b = "23:59", placeholder: ke = "Select a time", disabled: x = !1, readOnly: S, clearable: Ae = !1, expandIcon: je, open: Me, defaultOpen: Ne, onOpenChange: Pe, onInvalidInput: Fe, labels: C, name: Ie, form: Le, required: Re, autoComplete: ze = "off", autoCapitalize: Be, autoCorrect: Ve, maxLength: He, enterKeyHint: Ue, inputMode: We, spellCheck: Ge, autoFocus: Ke, tabIndex: qe, id: Je, "aria-label": Ye, "aria-labelledby": Xe, "aria-describedby": Ze, "aria-invalid": Qe, "aria-required": $e, "aria-errormessage": et, "aria-details": tt, onFocus: nt, onBlur: rt, onKeyDown: it, onKeyUp: at, controlRef: ot, className: st, ref: ct, ...lt } = s;
56
- h !== void 0 && t("TimePicker", "onChange", "onValueChange");
57
- let [w, T] = a(c, l ?? "", (e) => {
58
- xe?.(e), h?.(e);
59
- }), ut = Se(v).valid, E = d(y), D = d(b), O = !Number.isNaN(E) && !Number.isNaN(D) && E <= D, k = f.useMemo(() => be(v, y, b, _), [
55
+ var g = (s) => {
56
+ let { value: pe, defaultValue: c, onValueChange: ke, onChange: m, format: g = "12h", step: _ = 30, minTime: v = "00:00", maxTime: y = "23:59", placeholder: Le = "Select a time", disabled: b = !1, size: Re, appearance: ze, readOnly: x, clearable: Be = !1, expandIcon: Ve, open: He, defaultOpen: Ue, onOpenChange: We, onInvalidInput: Ge, labels: S, name: Ke, form: qe, required: Je, autoComplete: Ye = "off", autoCapitalize: Xe, autoCorrect: Ze, maxLength: Qe, enterKeyHint: $e, inputMode: et, spellCheck: tt, autoFocus: nt, tabIndex: rt, id: it, "aria-label": at, "aria-labelledby": ot, "aria-describedby": st, "aria-invalid": ct, "aria-required": lt, "aria-errormessage": ut, "aria-details": dt, onFocus: ft, onBlur: pt, onKeyDown: mt, onKeyUp: ht, controlRef: gt, className: _t, ref: vt, ...yt } = s;
57
+ m !== void 0 && t("TimePicker", "onChange", "onValueChange");
58
+ let { size: C, appearance: w } = he(Re, ze), [T, E] = a(pe, c ?? "", (e) => {
59
+ ke?.(e), m?.(e);
60
+ }), bt = Ae(_).valid, D = u(v), O = u(y), k = !Number.isNaN(D) && !Number.isNaN(O) && D <= O, A = d.useMemo(() => Oe(_, v, y, g), [
61
+ _,
60
62
  v,
61
63
  y,
62
- b,
63
- _
64
+ g
64
65
  ]);
65
- f.useEffect(() => {
66
- ut || n(`TimePicker:step:${String(v)}`, `TimePicker: \`step\` must be a positive number of minutes (received ${String(v)}); using 30.`);
67
- }, [v, ut]), f.useEffect(() => {
68
- O || n(`TimePicker:bounds:${y}|${b}`, `TimePicker: \`minTime\`/\`maxTime\` must be times such as "09:00", "09:00:00" or "9:00 AM" with minTime <= maxTime (received "${y}" / "${b}"); no times are available.`);
66
+ d.useEffect(() => {
67
+ bt || n(`TimePicker:step:${String(_)}`, `TimePicker: \`step\` must be a positive number of minutes (received ${String(_)}); using 30.`);
68
+ }, [_, bt]), d.useEffect(() => {
69
+ k || n(`TimePicker:bounds:${v}|${y}`, `TimePicker: \`minTime\`/\`maxTime\` must be times such as "09:00", "09:00:00" or "9:00 AM" with minTime <= maxTime (received "${v}" / "${y}"); no times are available.`);
69
70
  }, [
71
+ v,
70
72
  y,
71
- b,
72
- O
73
+ k
73
74
  ]);
74
- let A = !x && !S, [j, M, dt] = a(Me, (Ne ?? !1) && A, Pe), ft = te(), N = j && A && ft;
75
- f.useEffect(() => {
76
- !A && j && !dt && M(!1);
75
+ let j = !b && !x, [M, N, xt] = a(He, (Ue ?? !1) && j, We), St = te(), P = M && j && St;
76
+ d.useEffect(() => {
77
+ !j && M && !xt && N(!1);
77
78
  }, [
78
- A,
79
79
  j,
80
- dt,
81
- M
80
+ M,
81
+ xt,
82
+ N
82
83
  ]);
83
- let [P, F] = f.useState(null), [I, L] = f.useState(null), [pt, mt] = f.useState(A);
84
- pt !== A && (mt(A), A || (F(null), L(null)));
85
- let [ht, gt] = f.useState(w);
86
- ht !== w && (gt(w), I !== null && (F(null), L(null)));
87
- let _t = P ?? "", vt = () => {
88
- A && !N && M(!0);
89
- }, R = () => M(!1), z = f.useMemo(() => {
90
- let e = _t.trim().toLowerCase();
84
+ let [F, I] = d.useState(null), [L, R] = d.useState(null), [Ct, wt] = d.useState(j);
85
+ Ct !== j && (wt(j), j || (I(null), R(null)));
86
+ let [Tt, Et] = d.useState(T);
87
+ Tt !== T && (Et(T), L !== null && (I(null), R(null)));
88
+ let Dt = F ?? "", Ot = () => {
89
+ j && !P && N(!0);
90
+ }, z = () => N(!1), B = d.useMemo(() => {
91
+ let e = Dt.trim().toLowerCase();
91
92
  if (!e) return;
92
- let t = d(e), n = Number.isNaN(t) ? null : u(t);
93
- return (t) => t.value === n || De(t, e);
94
- }, [_t]), B = (e) => {
93
+ let t = u(e), n = Number.isNaN(t) ? null : l(t);
94
+ return (t) => t.value === n || Fe(t, e);
95
+ }, [Dt]), kt = (e) => {
95
96
  let t = e.trim().toLowerCase();
96
97
  if (!t) return null;
97
- let n = d(e);
98
+ let n = u(e);
98
99
  if (!Number.isNaN(n)) {
99
- let e = u(n);
100
- return k.some((t) => t.value === e) ? e : null;
100
+ let e = l(n);
101
+ return A.some((t) => t.value === e) ? e : null;
101
102
  }
102
- return (k.find((e) => Oe(e, t)) ?? k.find((e) => De(e, t)))?.value ?? null;
103
- }, yt = w !== "" && k.some((e) => e.value === w), bt = f.useMemo(() => w ? [w] : [], [w]), V = (e) => {
104
- T(e), F(null), L(null);
103
+ return (A.find((e) => Ie(e, t)) ?? A.find((e) => Fe(e, t)))?.value ?? null;
104
+ }, At = T !== "" && A.some((e) => e.value === T), jt = d.useMemo(() => T ? [T] : [], [T]), V = (e) => {
105
+ E(e), I(null), R(null);
105
106
  }, H = (e) => {
106
107
  if (!e.trim()) return V(""), null;
107
- let t = d(e);
108
- return Number.isNaN(t) ? "unparseable" : !O || t < E || t > D ? "out-of-range" : (V(u(t)), null);
109
- }, xt = (e, t) => {
110
- L(t), Fe?.(e, t);
108
+ let t = u(e);
109
+ return Number.isNaN(t) ? "unparseable" : !k || t < D || t > O ? "out-of-range" : (V(l(t)), null);
110
+ }, Mt = (e, t) => {
111
+ R(t), Ge?.(e, t);
111
112
  }, U = () => {
112
- F(null), L(null);
113
- }, W = f.useMemo(() => z ? k.some(z) : k.length > 0, [k, z]), G = N && W, K = he({
113
+ I(null), R(null);
114
+ }, W = d.useMemo(() => B ? A.some(B) : A.length > 0, [A, B]), G = P && W, K = be({
114
115
  open: G,
115
- onOpenChange: (e) => e ? vt() : R(),
116
+ onOpenChange: (e) => e ? Ot() : z(),
116
117
  mode: "editable",
117
- selectedValues: bt,
118
+ selectedValues: jt,
118
119
  onSelect: (e) => V(e),
119
- items: k,
120
- filter: z,
121
- autoHighlight: P === null && yt ? "selected" : !1,
120
+ items: A,
121
+ filter: B,
122
+ autoHighlight: F === null && At ? "selected" : !1,
122
123
  idPrefix: "timepicker-listbox",
123
- onClearDraft: P === null ? void 0 : () => {
124
- U(), R();
124
+ onClearDraft: F === null ? void 0 : () => {
125
+ U(), z();
125
126
  }
126
- }), St = w ? K.getItem(w)?.label ?? g(w, _) : "", q = Ae && !S && w !== "", Ct = N && !W ? k.length === 0 ? C?.noTimes ?? "No times available" : C?.noMatches ?? "No matching times" : "", wt = f.useRef(null), J = f.useRef(null), Tt = f.useRef(null), Et = o(ct, wt), Dt = o(ot, J), { layerId: Ot } = ae({
127
- open: N,
128
- onDismiss: R,
129
- refs: [Tt, wt],
127
+ }), Nt = T ? K.getItem(T)?.label ?? h(T, g) : "", q = Be && !x && T !== "", Pt = P && !W ? A.length === 0 ? S?.noTimes ?? "No times available" : S?.noMatches ?? "No matching times" : "", Ft = d.useRef(null), J = d.useRef(null), It = d.useRef(null), Lt = o(vt, Ft), Rt = o(gt, J), { layerId: zt } = ae({
128
+ open: P,
129
+ onDismiss: z,
130
+ refs: [It, Ft],
130
131
  anchorRef: J,
131
132
  kind: "listbox",
132
133
  focusOutside: !0
133
- }), { setReference: kt, setFloating: At, floatingProps: jt } = ye({
134
- open: N,
134
+ }), { setReference: Bt, setFloating: Vt, floatingProps: Ht } = De({
135
+ open: P,
135
136
  side: "bottom",
136
137
  align: "start",
137
138
  matchReferenceWidth: !0,
138
139
  fitViewport: !0
139
- }), Mt = o(Tt, At), Y = re(), Nt = (Re ?? Y?.required ?? !1) && !S, X = ee("timepicker-error"), Z = I !== null && !Y?.hasErrorMessage, Pt = ie({
140
- id: Je,
141
- "aria-label": Ye,
142
- "aria-labelledby": Xe,
143
- "aria-describedby": ne(Ze, Z ? X : void 0),
144
- "aria-invalid": I !== null || Qe,
145
- "aria-required": $e ?? Re
146
- }), Ft = de(!1, Pt["aria-invalid"]);
147
- fe(J, () => {
148
- T(l ?? ""), U(), R();
149
- }, Le);
150
- let It = (e) => {
151
- if (!A) return;
140
+ }), Ut = o(It, Vt), Y = re(), Wt = (Je ?? Y?.required ?? !1) && !x, X = ee("timepicker-error"), Z = L !== null && !Y?.hasErrorMessage, Gt = ie({
141
+ id: it,
142
+ "aria-label": at,
143
+ "aria-labelledby": ot,
144
+ "aria-describedby": ne(st, Z ? X : void 0),
145
+ "aria-invalid": L !== null || ct,
146
+ "aria-required": lt ?? Je
147
+ }), Kt = ge(!1, Gt["aria-invalid"]);
148
+ _e(J, () => {
149
+ E(c ?? ""), U(), z();
150
+ }, qe);
151
+ let qt = (e) => {
152
+ if (!j) return;
152
153
  let t = e.target.value;
153
- F(t), L(null), N || M(!0), K.setActiveValue(B(t));
154
- }, Lt = r(it, (e) => {
155
- if (A && (K.onKeyDown(e), !(e.defaultPrevented || e.nativeEvent.isComposing))) {
156
- if (e.key === "Escape" && P === "" && St !== "") {
157
- e.preventDefault(), U(), R();
154
+ I(t), R(null), P || N(!0), K.setActiveValue(kt(t));
155
+ }, Jt = r(mt, (e) => {
156
+ if (j && (K.onKeyDown(e), !(e.defaultPrevented || e.nativeEvent.isComposing))) {
157
+ if (e.key === "Escape" && F === "" && Nt !== "") {
158
+ e.preventDefault(), U(), z();
158
159
  return;
159
160
  }
160
- if (e.key === "Enter" && P !== null) {
161
+ if (e.key === "Enter" && F !== null) {
161
162
  e.preventDefault();
162
- let t = H(P);
163
- R(), t !== null && xt(P, t);
163
+ let t = H(F);
164
+ z(), t !== null && Mt(F, t);
164
165
  }
165
- e.key === "Tab" && !e.shiftKey && q && P !== null && !P.trim() && Ce(() => H(P)), e.key === "Tab" && N && !G && R();
166
+ e.key === "Tab" && !e.shiftKey && q && F !== null && !F.trim() && je(() => H(F)), e.key === "Tab" && P && !G && z();
166
167
  }
167
- }), Rt = r(at, K.onKeyUp), zt = () => {
168
- A && !N && (vt(), P !== null && K.setActiveValue(B(P)));
169
- }, Bt = r(rt, () => {
170
- if (!A || P === null) return;
171
- let e = I === null ? H(P) : null;
172
- R(), e !== null && xt(P, e);
173
- }), Vt = () => {
174
- A && (N ? R() : zt(), J.current?.focus());
175
- }, Ht = () => {
176
- A && (V(""), J.current?.focus());
177
- }, Ut = ne(Xe, Y?.labelId), Wt = (t) => /* @__PURE__ */ p("ul", {
168
+ }), Yt = r(ht, K.onKeyUp), Xt = () => {
169
+ j && !P && (Ot(), F !== null && K.setActiveValue(kt(F)));
170
+ }, Zt = r(pt, () => {
171
+ if (!j || F === null) return;
172
+ let e = L === null ? H(F) : null;
173
+ z(), e !== null && Mt(F, e);
174
+ }), Qt = () => {
175
+ j && (P ? z() : Xt(), J.current?.focus());
176
+ }, $t = () => {
177
+ j && (V(""), J.current?.focus());
178
+ }, en = ne(ot, Y?.labelId), tn = (t) => /* @__PURE__ */ f("ul", {
178
179
  ...K.getListboxProps(),
179
- "aria-labelledby": Ut,
180
- "aria-label": Ut ? void 0 : Ye ?? C?.list ?? "Times",
180
+ "aria-labelledby": en,
181
+ "aria-label": en ? void 0 : at ?? S?.list ?? "Times",
181
182
  hidden: t || void 0,
182
183
  className: e(i.listbox, "max-h-60 min-h-0 overflow-auto py-1 focus:outline-hidden"),
183
- children: K.items.map((e) => /* @__PURE__ */ p(we, {
184
+ children: K.items.map((e) => /* @__PURE__ */ f(Me, {
184
185
  value: e.value,
185
186
  label: e.label
186
187
  }, e.value))
187
- }), Q = ve(je), $ = "";
188
- Z && I === "unparseable" ? $ = (C?.invalidTime ?? Te)(_ === "24h" ? "HH:mm" : "h:mm AM") : Z && ($ = (C?.outOfRange ?? Ee)(s.minTime === void 0 ? void 0 : g(y, _), s.maxTime === void 0 ? void 0 : g(b, _)));
189
- let Gt = N ? W : k.length > 0;
190
- return /* @__PURE__ */ p(me.Provider, {
188
+ }), Q = Ee(Ve), $ = "";
189
+ Z && L === "unparseable" ? $ = (S?.invalidTime ?? Ne)(g === "24h" ? "HH:mm" : "h:mm AM") : Z && ($ = (S?.outOfRange ?? Pe)(s.minTime === void 0 ? void 0 : h(v, g), s.maxTime === void 0 ? void 0 : h(y, g)));
190
+ let nn = P ? W : A.length > 0;
191
+ return /* @__PURE__ */ f(ye.Provider, {
191
192
  value: K.context,
192
- children: /* @__PURE__ */ m("div", {
193
- ...lt,
194
- ref: Et,
195
- className: e(i.root, "relative inline-flex flex-col", st),
193
+ children: /* @__PURE__ */ p("div", {
194
+ "data-size": C,
195
+ "data-appearance": w,
196
+ ...yt,
197
+ ref: Lt,
198
+ className: e(i.root, "relative inline-flex flex-col", _t),
196
199
  children: [
197
- /* @__PURE__ */ m("div", {
198
- ref: kt,
200
+ /* @__PURE__ */ p("div", {
201
+ ref: Bt,
199
202
  className: "relative flex items-center",
200
203
  children: [
201
- /* @__PURE__ */ p("input", {
202
- ref: Dt,
204
+ /* @__PURE__ */ f("input", {
205
+ ref: Rt,
203
206
  type: "text",
204
207
  ...K.getComboboxProps(),
205
- "aria-controls": Gt ? K.listboxId : void 0,
206
- ...Pt,
207
- "aria-errormessage": et,
208
- "aria-details": tt,
209
- value: P ?? St,
210
- onChange: It,
211
- onClick: zt,
212
- onFocus: nt,
213
- onBlur: Bt,
214
- onKeyDown: Lt,
215
- onKeyUp: Rt,
216
- placeholder: ke,
217
- disabled: x,
218
- readOnly: S,
219
- autoComplete: ze,
220
- autoCapitalize: Be,
221
- autoCorrect: Ve,
222
- maxLength: He,
223
- enterKeyHint: Ue,
224
- inputMode: We,
225
- spellCheck: Ge,
226
- autoFocus: Ke,
227
- tabIndex: qe,
228
- className: e(i.input, ce, "border-b-stroke-accessible", le, se, Ft && "border-destructive focus:border-b-destructive", ge(Number(q) + Number(Q)))
208
+ "aria-controls": nn ? K.listboxId : void 0,
209
+ ...Gt,
210
+ "aria-errormessage": ut,
211
+ "aria-details": dt,
212
+ value: F ?? Nt,
213
+ onChange: qt,
214
+ onClick: Xt,
215
+ onFocus: ft,
216
+ onBlur: Zt,
217
+ onKeyDown: Jt,
218
+ onKeyUp: Yt,
219
+ placeholder: Le,
220
+ disabled: b,
221
+ readOnly: x,
222
+ autoComplete: Ye,
223
+ autoCapitalize: Xe,
224
+ autoCorrect: Ze,
225
+ maxLength: Qe,
226
+ enterKeyHint: $e,
227
+ inputMode: et,
228
+ spellCheck: tt,
229
+ autoFocus: nt,
230
+ tabIndex: rt,
231
+ className: e(i.input, ue[C], "w-full", de[C], fe[C], ce[w], "text-foreground placeholder:text-muted-foreground", le, se, Kt && "border-destructive", Se(Number(q) + Number(Q), C))
229
232
  }),
230
- q && /* @__PURE__ */ p("button", {
233
+ q && /* @__PURE__ */ f("button", {
231
234
  type: "button",
232
- "aria-label": C?.clear ?? "Clear time",
233
- disabled: x,
235
+ "aria-label": S?.clear ?? "Clear time",
236
+ disabled: b,
234
237
  onMouseDown: (e) => e.preventDefault(),
235
- onClick: Ht,
236
- className: e(i.clearButton, "absolute flex h-6 w-6 items-center justify-center rounded bg-transparent p-0 text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground", Q ? "end-7" : "end-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"),
237
- children: /* @__PURE__ */ p(ue, {})
238
+ onClick: $t,
239
+ className: e(i.clearButton, we(C, w), xe(C, 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"),
240
+ children: /* @__PURE__ */ f(me, { size: Ce(C, "icon") })
238
241
  }),
239
- Q && /* @__PURE__ */ p(_e, {
242
+ Q && /* @__PURE__ */ f(Te, {
240
243
  component: "TimePicker",
241
- expandIcon: je,
242
- label: C?.expand ?? "Show times",
244
+ expandIcon: Ve,
245
+ label: S?.expand ?? "Show times",
243
246
  expanded: G,
244
247
  listboxId: K.listboxId,
245
- disabled: x || !!S,
246
- onToggle: Vt,
248
+ disabled: b || !!x,
249
+ onToggle: Qt,
250
+ size: C,
251
+ appearance: w,
247
252
  className: i.expandButton,
248
253
  iconClassName: i.expandIcon
249
254
  })
250
255
  ]
251
256
  }),
252
- Z && /* @__PURE__ */ p("p", {
257
+ Z && /* @__PURE__ */ f("p", {
253
258
  id: X,
254
259
  role: "alert",
255
260
  className: e(i.errorMessage, "mt-1 text-caption-1 text-error"),
256
261
  children: $
257
262
  }),
258
- !N && k.length > 0 && Wt(!0),
259
- /* @__PURE__ */ p("span", {
263
+ !P && A.length > 0 && tn(!0),
264
+ /* @__PURE__ */ f("span", {
260
265
  role: "status",
261
266
  className: "sr-only",
262
- children: Ct
267
+ children: Pt
263
268
  }),
264
- /* @__PURE__ */ p(pe, {
265
- name: Ie,
266
- form: Le,
267
- disabled: x,
268
- value: w,
269
+ /* @__PURE__ */ f(ve, {
270
+ name: Ke,
271
+ form: qe,
272
+ disabled: b,
273
+ value: T,
269
274
  type: "text",
270
- required: Nt,
275
+ required: Wt,
271
276
  onInvalid: () => J.current?.focus()
272
277
  }),
273
- N && /* @__PURE__ */ p(oe, {
274
- layerId: Ot,
275
- children: /* @__PURE__ */ p("div", {
276
- ref: Mt,
277
- ...jt,
278
+ P && /* @__PURE__ */ f(oe, {
279
+ layerId: zt,
280
+ children: /* @__PURE__ */ f("div", {
281
+ ref: Ut,
282
+ ...Ht,
278
283
  "data-state": "open",
279
284
  className: e(i.surface, "flex flex-col overflow-hidden rounded border border-border bg-background shadow-8"),
280
- children: W ? Wt(!1) : /* @__PURE__ */ p("div", {
285
+ children: W ? tn(!1) : /* @__PURE__ */ f("div", {
281
286
  "aria-hidden": "true",
282
287
  className: e(i.emptyMessage, "px-3 py-1.5 text-body-1 text-muted-foreground"),
283
- children: Ct
288
+ children: Pt
284
289
  })
285
290
  })
286
291
  })
@@ -288,8 +293,8 @@ var _ = (s) => {
288
293
  })
289
294
  });
290
295
  };
291
- _.displayName = "TimePicker";
296
+ g.displayName = "TimePicker";
292
297
  //#endregion
293
- export { _ as TimePicker };
298
+ export { g as TimePicker };
294
299
 
295
300
  //# sourceMappingURL=TimePicker.mjs.map