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