@spear-ai/spectral 1.6.17 → 1.8.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 (149) hide show
  1. package/dist/.js +201 -200
  2. package/dist/Accordion.d.ts +13 -15
  3. package/dist/Accordion.js +184 -179
  4. package/dist/Alert/AlertBase.d.ts +7 -7
  5. package/dist/Alert/AlertBase.js +21 -21
  6. package/dist/Alert.d.ts +2 -2
  7. package/dist/Alert.js +31 -31
  8. package/dist/Avatar.d.ts +2 -2
  9. package/dist/Avatar.js +30 -22
  10. package/dist/Badge.d.ts +1 -1
  11. package/dist/Badge.js +3 -2
  12. package/dist/Button.d.ts +3 -3
  13. package/dist/Button.js +108 -46
  14. package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
  15. package/dist/ButtonGroup/ButtonGroupButton.js +5 -5
  16. package/dist/ButtonGroup.d.ts +5 -5
  17. package/dist/ButtonGroup.js +21 -21
  18. package/dist/ButtonIcon.d.ts +2 -2
  19. package/dist/ButtonIcon.js +30 -31
  20. package/dist/Checkbox/CheckboxBase.d.ts +2 -2
  21. package/dist/Checkbox/CheckboxBase.js +50 -57
  22. package/dist/Checkbox.js +15 -19
  23. package/dist/DataCard/Card.d.ts +1 -1
  24. package/dist/DataCard/Card.js +1 -1
  25. package/dist/DataCard.js +1 -1
  26. package/dist/DateTimePicker/Calendar.d.ts +4 -4
  27. package/dist/DateTimePicker/Calendar.js +3 -3
  28. package/dist/DateTimePicker/DateTimeDisplayInput.js +126 -136
  29. package/dist/DateTimePicker/DateTimeInput.js +4 -4
  30. package/dist/DateTimePicker/DateTimeUtils.d.ts +31 -31
  31. package/dist/DateTimePicker/DateTimeUtils.js +139 -197
  32. package/dist/DateTimePicker/TimePicker.d.ts +4 -4
  33. package/dist/DateTimePicker/TimePicker.js +3 -3
  34. package/dist/DateTimePicker.d.ts +5 -5
  35. package/dist/DateTimePicker.js +90 -70
  36. package/dist/Dialog.d.ts +13 -13
  37. package/dist/Dialog.js +57 -84
  38. package/dist/Drawer.d.ts +2 -2
  39. package/dist/Drawer.js +8 -8
  40. package/dist/HoverCard.d.ts +6 -5
  41. package/dist/HoverCard.js +64 -64
  42. package/dist/Icons/PolygonIcon.d.ts +5 -0
  43. package/dist/Icons/PolygonIcon.js +40 -0
  44. package/dist/Icons/index.d.ts +1 -1
  45. package/dist/Icons.js +34 -34
  46. package/dist/IconsAnimated/PanelLeftCloseIcon.js +2 -2
  47. package/dist/IconsAnimated/PanelLeftOpenIcon.js +2 -2
  48. package/dist/Input/InputUtils.d.ts +2 -2
  49. package/dist/Input/InputUtils.js +4 -4
  50. package/dist/Input.d.ts +1 -1
  51. package/dist/Input.js +19 -19
  52. package/dist/InputOTP.d.ts +10 -10
  53. package/dist/InputOTP.js +114 -114
  54. package/dist/Kbd.d.ts +8 -5
  55. package/dist/Kbd.js +85 -20
  56. package/dist/Label.d.ts +4 -2
  57. package/dist/Label.js +3 -3
  58. package/dist/MultiSelect/MultiSelectBase.d.ts +1 -1
  59. package/dist/MultiSelect/MultiSelectBase.js +278 -202
  60. package/dist/MultiSelect.d.ts +6 -6
  61. package/dist/MultiSelect.js +9 -9
  62. package/dist/Popover.js +22 -237
  63. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +11 -11
  64. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +28 -28
  65. package/dist/RadioButtonGroup.d.ts +1 -1
  66. package/dist/RadioGroup.d.ts +15 -15
  67. package/dist/RadioGroup.js +253 -236
  68. package/dist/Select.d.ts +3 -1
  69. package/dist/Select.js +91 -88
  70. package/dist/Separator.js +4 -4
  71. package/dist/Skeleton.d.ts +1 -2
  72. package/dist/Skeleton.js +2 -4
  73. package/dist/Slider.d.ts +6 -6
  74. package/dist/Slider.js +78 -78
  75. package/dist/Switch/SwitchBase.d.ts +4 -4
  76. package/dist/Switch/SwitchBase.js +75 -111
  77. package/dist/Switch.d.ts +4 -4
  78. package/dist/Switch.js +122 -33
  79. package/dist/Tabs/TabsBase.js +39 -38
  80. package/dist/Tabs/tabsUtils.js +7 -7
  81. package/dist/Tabs.d.ts +0 -4
  82. package/dist/Tabs.js +62 -66
  83. package/dist/Textarea/TextareaUtils.d.ts +7 -7
  84. package/dist/Textarea/TextareaUtils.js +13 -13
  85. package/dist/Textarea.js +28 -18
  86. package/dist/Toast.d.ts +43 -0
  87. package/dist/Toast.js +883 -0
  88. package/dist/Toggle/ToggleBase.d.ts +4 -4
  89. package/dist/Toggle/ToggleBase.js +32 -33
  90. package/dist/Toggle.d.ts +1 -1
  91. package/dist/Toggle.js +7 -12
  92. package/dist/ToggleGroup/ToggleGroupBase.d.ts +5 -5
  93. package/dist/ToggleGroup/ToggleGroupBase.js +30 -30
  94. package/dist/ToggleGroup.d.ts +1 -1
  95. package/dist/ToggleGroup.js +27 -30
  96. package/dist/Tooltip.d.ts +1 -1
  97. package/dist/Tooltip.js +97 -97
  98. package/dist/Tray.d.ts +9 -9
  99. package/dist/Tray.js +71 -70
  100. package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
  101. package/dist/hooks/useAccordionAutoScroll.js +42 -39
  102. package/dist/hooks/useControllableState.d.ts +2 -2
  103. package/dist/hooks/useControllableState.d.ts.map +1 -1
  104. package/dist/hooks/useControllableState.js +2 -2
  105. package/dist/index-C12FUuIW.js +13 -0
  106. package/dist/{index-yU8jOTzS.js → index-CpovUAO-.js} +1 -1
  107. package/dist/{index-BdS7Ix8W.js → index-CqbPiOid.js} +1 -1
  108. package/dist/{index-B3UpsZ2x.js → index-CrjD9cAD.js} +1 -1
  109. package/dist/index-DEYs15GP.js +66 -0
  110. package/dist/index-DdFoGvON.js +146 -0
  111. package/dist/index-Q3N6lgwg.js +225 -0
  112. package/dist/index.d.ts +3 -3
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/primitives/button.d.ts +1 -1
  115. package/dist/primitives/button.js +4 -4
  116. package/dist/primitives/input.d.ts.map +1 -1
  117. package/dist/primitives/input.js +8 -5
  118. package/dist/primitives/select.d.ts +12 -13
  119. package/dist/primitives/select.d.ts.map +1 -1
  120. package/dist/primitives/select.js +59 -88
  121. package/dist/primitives/slot.d.ts +5 -5
  122. package/dist/primitives/slot.d.ts.map +1 -1
  123. package/dist/primitives/slot.js +24 -33
  124. package/dist/primitives/textarea.d.ts.map +1 -1
  125. package/dist/primitives/textarea.js +4 -3
  126. package/dist/{proxy-Cukf-VVj.js → proxy-CgaCj1WQ.js} +7 -3
  127. package/dist/styles/base-colors.css +30 -30
  128. package/dist/styles/horizon/base-colors.css +30 -30
  129. package/dist/styles/horizon/colors.css +43 -13
  130. package/dist/styles/horizon/utilities.css +26 -3
  131. package/dist/styles/main.css +1 -1
  132. package/dist/styles/spectral.css +2 -2
  133. package/dist/styles/theme.css +99 -46
  134. package/dist/{use-animation-zNd5Nq85.js → use-animation-CR-SdV2l.js} +1 -1
  135. package/dist/utils/formFieldUtils.d.ts +2 -2
  136. package/dist/utils/formFieldUtils.d.ts.map +1 -1
  137. package/dist/utils/formFieldUtils.js +14 -11
  138. package/dist/utils/sharedUtils.d.ts +3 -3
  139. package/dist/utils/sharedUtils.d.ts.map +1 -1
  140. package/dist/utils/sharedUtils.js +1 -4
  141. package/dist/utils/twUtils.d.ts +1 -1
  142. package/dist/utils/twUtils.d.ts.map +1 -1
  143. package/dist/utils/twUtils.js +1 -4
  144. package/package.json +6 -1
  145. package/dist/Icons/LineToolIcon2.d.ts +0 -5
  146. package/dist/Icons/LineToolIcon2.js +0 -49
  147. package/dist/createLucideIcon-D4r5Phnh.js +0 -70
  148. package/dist/index-CeP1E2kK.js +0 -209
  149. package/dist/index-Dy-Hzr7y.js +0 -13
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsxs as K, jsx as k } from "react/jsx-runtime";
3
+ import { jsxs as O, jsx as b } from "react/jsx-runtime";
4
4
  import { getResolvedLocale as ee, getLocalizedPeriodLabels as te, formatSelectPeriodLabel as re } from "./DateTimeUtils.js";
5
5
  import { Label as ne } from "../Label.js";
6
6
  import { useControllableState as ae } from "../hooks/useControllableState.js";
7
7
  import { getInputClasses as ie } from "../utils/formFieldUtils.js";
8
- import { cn as O } from "../utils/twUtils.js";
9
- import { forwardRef as se, useRef as B, useMemo as g, useCallback as L, useEffect as oe } from "react";
10
- const h = {
8
+ import { cn as U } from "../utils/twUtils.js";
9
+ import { forwardRef as se, useRef as E, useMemo as D, useCallback as w, useEffect as oe } from "react";
10
+ const v = {
11
11
  month: { type: "month", min: 1, max: 12, length: 2 },
12
12
  day: { type: "day", min: 1, max: 31, length: 2 },
13
13
  year: { type: "year", min: 1900, max: 2100, length: 4 },
@@ -15,12 +15,8 @@ const h = {
15
15
  hour24: { type: "hour", min: 0, max: 23, length: 2 },
16
16
  minute: { type: "minute", min: 0, max: 59, length: 2 },
17
17
  period: { type: "period", min: 0, max: 1, length: 2 }
18
- };
19
- function ue(x, e) {
20
- return x === 2 ? e % 4 === 0 && e % 100 !== 0 || e % 400 === 0 ? 29 : 28 : [4, 6, 9, 11].includes(x) ? 30 : 31;
21
- }
22
- function ce({ ariaLabel: x, config: e, disabled: f, onLeftFocus: I, onRightFocus: v, onValueChange: c, periodLabels: w, value: s }) {
23
- const o = B(null), a = B(""), u = B(!1), b = g(() => {
18
+ }, ue = (k, e) => k === 2 ? e % 4 === 0 && e % 100 !== 0 || e % 400 === 0 ? 29 : 28 : [4, 6, 9, 11].includes(k) ? 30 : 31, ce = ({ ariaLabel: k, config: e, disabled: y, onLeftFocus: N, onRightFocus: m, onValueChange: o, periodLabels: h, value: s }) => {
19
+ const u = E(null), a = E(""), c = E(!1), I = D(() => {
24
20
  switch (e.type) {
25
21
  case "month":
26
22
  return "MM";
@@ -33,58 +29,58 @@ function ce({ ariaLabel: x, config: e, disabled: f, onLeftFocus: I, onRightFocus
33
29
  case "minute":
34
30
  return "mm";
35
31
  case "period":
36
- return (w?.am ?? "am").toLowerCase();
32
+ return (h?.am ?? "am").toLowerCase();
37
33
  default:
38
34
  return "––";
39
35
  }
40
- }, [e.type, e.max, w]), m = g(() => s === void 0 ? b : e.type === "period" ? (s === 0 ? w?.am ?? "am" : w?.pm ?? "pm").toLowerCase() : s.toString().padStart(e.length, "0"), [s, e, w, b]);
36
+ }, [e.type, e.max, h]), d = D(() => s === void 0 ? I : e.type === "period" ? (s === 0 ? h?.am ?? "am" : h?.pm ?? "pm").toLowerCase() : s.toString().padStart(e.length, "0"), [s, e, h, I]);
41
37
  oe(() => {
42
- o.current && !u.current && (o.current.value = m);
43
- }, [m]);
44
- const d = L(() => {
38
+ u.current && !c.current && (u.current.value = d);
39
+ }, [d]);
40
+ const x = w(() => {
45
41
  const t = a.current;
46
42
  if (t) {
47
43
  let r = parseInt(t, 10);
48
- isNaN(r) || (r = Math.max(e.min, Math.min(e.max, r)), c(r));
44
+ isNaN(r) || (r = Math.max(e.min, Math.min(e.max, r)), o(r));
49
45
  }
50
- a.current = "", u.current = !1, o.current && (o.current.value = m);
51
- }, [e.min, e.max, m, c]), E = L(
46
+ a.current = "", c.current = !1, u.current && (u.current.value = d);
47
+ }, [e.min, e.max, d, o]), R = w(
52
48
  (t) => {
53
- if (!f) {
49
+ if (!y) {
54
50
  if (t.key === "Tab") {
55
- d();
51
+ x();
56
52
  return;
57
53
  }
58
54
  if (t.key === "ArrowRight") {
59
- t.preventDefault(), d(), v?.();
55
+ t.preventDefault(), x(), m?.();
60
56
  return;
61
57
  }
62
58
  if (t.key === "ArrowLeft") {
63
- t.preventDefault(), d(), I?.();
59
+ t.preventDefault(), x(), N?.();
64
60
  return;
65
61
  }
66
62
  if (e.type === "period") {
67
- t.preventDefault(), t.key === "ArrowUp" || t.key === "ArrowDown" ? c(s === 0 ? 1 : 0) : t.key.toLowerCase() === "a" ? c(0) : t.key.toLowerCase() === "p" && c(1);
63
+ t.preventDefault(), t.key === "ArrowUp" || t.key === "ArrowDown" ? o(s === 0 ? 1 : 0) : t.key.toLowerCase() === "a" ? o(0) : t.key.toLowerCase() === "p" && o(1);
68
64
  return;
69
65
  }
70
66
  if (t.key === "ArrowUp") {
71
- t.preventDefault(), a.current = "", u.current = !1;
67
+ t.preventDefault(), a.current = "", c.current = !1;
72
68
  const r = s === void 0 || s >= e.max ? e.min : s + 1;
73
- c(r);
69
+ o(r);
74
70
  return;
75
71
  }
76
72
  if (t.key === "ArrowDown") {
77
- t.preventDefault(), a.current = "", u.current = !1;
73
+ t.preventDefault(), a.current = "", c.current = !1;
78
74
  const r = s === void 0 || s <= e.min ? e.max : s - 1;
79
- c(r);
75
+ o(r);
80
76
  return;
81
77
  }
82
78
  if (t.key === "Home") {
83
- t.preventDefault(), a.current = "", u.current = !1, c(e.min);
79
+ t.preventDefault(), a.current = "", c.current = !1, o(e.min);
84
80
  return;
85
81
  }
86
82
  if (t.key === "End") {
87
- t.preventDefault(), a.current = "", u.current = !1, c(e.max);
83
+ t.preventDefault(), a.current = "", c.current = !1, o(e.max);
88
84
  return;
89
85
  }
90
86
  if (t.key >= "0" && t.key <= "9") {
@@ -92,43 +88,40 @@ function ce({ ariaLabel: x, config: e, disabled: f, onLeftFocus: I, onRightFocus
92
88
  const r = a.current + t.key, l = parseInt(r, 10);
93
89
  if (e.length === 2)
94
90
  if (r.length >= 2) {
95
- const D = Math.max(e.min, Math.min(e.max, l));
96
- a.current = "", u.current = !1, c(D), v?.();
91
+ const L = Math.max(e.min, Math.min(e.max, l));
92
+ a.current = "", c.current = !1, o(L), m?.();
97
93
  } else if (l * 10 > e.max) {
98
- const D = Math.max(e.min, Math.min(e.max, l));
99
- a.current = "", u.current = !1, c(D), v?.();
94
+ const L = Math.max(e.min, Math.min(e.max, l));
95
+ a.current = "", c.current = !1, o(L), m?.();
100
96
  } else
101
- a.current = r, u.current = !0, o.current && (o.current.value = r);
97
+ a.current = r, c.current = !0, u.current && (u.current.value = r);
102
98
  else if (e.length === 4)
103
99
  if (r.length >= 4) {
104
- const D = Math.max(e.min, Math.min(e.max, l));
105
- a.current = "", u.current = !1, c(D), v?.();
100
+ const L = Math.max(e.min, Math.min(e.max, l));
101
+ a.current = "", c.current = !1, o(L), m?.();
106
102
  } else
107
- a.current = r, u.current = !0, o.current && (o.current.value = r);
103
+ a.current = r, c.current = !0, u.current && (u.current.value = r);
108
104
  return;
109
105
  }
110
- if (t.key === "Backspace") {
111
- if (t.preventDefault(), a.current) {
112
- const r = a.current.slice(0, -1);
113
- a.current = r, u.current = r.length > 0, o.current && (o.current.value = r || m);
114
- }
115
- return;
106
+ if (t.key === "Backspace" && (t.preventDefault(), a.current)) {
107
+ const r = a.current.slice(0, -1);
108
+ a.current = r, c.current = r.length > 0, u.current && (u.current.value = r || d);
116
109
  }
117
110
  }
118
111
  },
119
- [f, e, s, m, c, I, v, d]
120
- ), R = L(() => {
121
- a.current && d();
122
- }, [d]), S = L(() => {
123
- u.current || (a.current = "");
124
- const t = o.current;
112
+ [y, e, s, d, o, N, m, x]
113
+ ), T = w(() => {
114
+ a.current && x();
115
+ }, [x]), g = w(() => {
116
+ c.current || (a.current = "");
117
+ const t = u.current;
125
118
  if (t) {
126
119
  const r = t.value.length;
127
120
  t.setSelectionRange(r, r);
128
121
  }
129
- }, []), T = L(() => {
130
- o.current && (o.current.value = a.current || m);
131
- }, [m]), y = (() => {
122
+ }, []), Y = w(() => {
123
+ u.current && (u.current.value = a.current || d);
124
+ }, [d]), H = w(() => {
132
125
  switch (e.type) {
133
126
  case "year":
134
127
  return { width: 46, paddingLeft: 0 };
@@ -145,137 +138,134 @@ function ce({ ariaLabel: x, config: e, disabled: f, onLeftFocus: I, onRightFocus
145
138
  default:
146
139
  return { width: 24, paddingLeft: 0 };
147
140
  }
148
- })(), M = s === void 0;
149
- return /* @__PURE__ */ k(
141
+ }, [e.type]), p = D(() => H(), [H]), M = D(() => s === void 0, [s]);
142
+ return /* @__PURE__ */ b(
150
143
  "input",
151
144
  {
152
- "aria-label": x,
145
+ "aria-label": k,
153
146
  "aria-valuemax": e.max,
154
147
  "aria-valuemin": e.min,
155
148
  "aria-valuenow": s,
156
- className: O(
149
+ className: U(
157
150
  "inline-flex items-center justify-center rounded text-center tabular-nums",
158
151
  "border-none bg-transparent outline-none",
159
152
  "focus:bg-bg-tertiary focus:text-text-primary focus:ring-accent focus:ring-1",
160
153
  "hover:bg-bg-secondary",
161
- f && "cursor-not-allowed opacity-50",
154
+ y && "cursor-not-allowed opacity-50",
162
155
  M && "text-text-placeholder text-sm"
163
156
  ),
164
157
  "data-segment": e.type,
165
- defaultValue: m,
166
- disabled: f,
158
+ defaultValue: d,
159
+ disabled: y,
167
160
  inputMode: "numeric",
168
- onBlur: R,
169
- onChange: T,
170
- onFocus: S,
171
- onKeyDown: E,
172
- ref: o,
161
+ onBlur: T,
162
+ onChange: Y,
163
+ onFocus: g,
164
+ onKeyDown: R,
165
+ ref: u,
173
166
  role: "spinbutton",
174
- style: y,
175
- tabIndex: f ? -1 : 0
167
+ style: p,
168
+ tabIndex: y ? -1 : 0
176
169
  }
177
170
  );
178
- }
179
- const le = se(
171
+ }, le = se(
180
172
  ({
181
- className: x,
182
- id: e,
183
- // New props
184
- defaultValue: f,
185
- onChange: I,
186
- value: v,
173
+ className: k,
174
+ defaultValue: e,
175
+ disabled: y,
176
+ endIcon: N,
177
+ hourFormat: m = "12",
178
+ id: o,
179
+ label: h,
180
+ locale: s,
181
+ onChange: u,
182
+ showTime: a = !0,
183
+ state: c = "default",
184
+ value: I,
187
185
  // Legacy props (deprecated)
188
- date: c,
189
- onDateChange: w,
190
- // Other props
191
- disabled: s,
192
- endIcon: o,
193
- hourFormat: a = "12",
194
- label: u,
195
- locale: b,
196
- showTime: m = !0,
197
- state: d = "default",
198
- ...E
199
- }, R) => {
200
- const S = B(null), T = v ?? c, U = I ?? w, [y, M] = ae({
201
- value: T,
202
- defaultValue: f,
203
- onChange: U
204
- }), t = g(() => ee(b), [b]), r = g(() => te(t), [t]), l = g(() => {
205
- if (!y) return { month: void 0, day: void 0, year: void 0, hour: void 0, minute: void 0, period: void 0 };
206
- const i = y.getHours();
207
- let n, p;
208
- return a === "24" ? (n = i, p = 0) : (p = i >= 12 ? 1 : 0, n = i % 12, n === 0 && (n = 12)), {
209
- month: y.getMonth() + 1,
210
- day: y.getDate(),
211
- year: y.getFullYear(),
186
+ date: d,
187
+ onDateChange: x,
188
+ ...R
189
+ }, T) => {
190
+ const g = E(null), Y = I ?? d, H = u ?? x, [p, M] = ae({
191
+ defaultValue: e,
192
+ onChange: H,
193
+ value: Y
194
+ }), t = D(() => ee(s), [s]), r = D(() => te(t), [t]), l = D(() => {
195
+ if (!p) return { month: void 0, day: void 0, year: void 0, hour: void 0, minute: void 0, period: void 0 };
196
+ const i = p.getHours();
197
+ let n, f;
198
+ return m === "24" ? (n = i, f = 0) : (f = i >= 12 ? 1 : 0, n = i % 12, n === 0 && (n = 12)), {
199
+ month: p.getMonth() + 1,
200
+ day: p.getDate(),
201
+ year: p.getFullYear(),
212
202
  hour: n,
213
- minute: y.getMinutes(),
214
- period: p
203
+ minute: p.getMinutes(),
204
+ period: f
215
205
  };
216
- }, [y, a]), D = l.month !== void 0 && l.day !== void 0 && l.year !== void 0, _ = L(
206
+ }, [p, m]), L = l.month !== void 0 && l.day !== void 0 && l.year !== void 0, _ = w(
217
207
  (i) => {
218
208
  const n = { ...l, ...i };
219
209
  if (n.month === void 0 && n.day === void 0 && n.year === void 0) {
220
210
  M(void 0);
221
211
  return;
222
212
  }
223
- const p = /* @__PURE__ */ new Date(), H = (n.month ?? p.getMonth() + 1) - 1, Y = n.day ?? p.getDate(), N = n.year ?? p.getFullYear(), P = ue(H + 1, N), j = Math.min(Y, P), W = l.month !== void 0 && l.day !== void 0 && l.year !== void 0, X = n.month !== void 0 && n.day !== void 0 && n.year !== void 0, A = !W && X;
224
- let C;
225
- if (a === "24")
226
- C = A ? 0 : n.hour ?? 0;
213
+ const f = /* @__PURE__ */ new Date(), A = (n.month ?? f.getMonth() + 1) - 1, P = n.day ?? f.getDate(), S = n.year ?? f.getFullYear(), j = ue(A + 1, S), G = Math.min(P, j), W = l.month !== void 0 && l.day !== void 0 && l.year !== void 0, X = n.month !== void 0 && n.day !== void 0 && n.year !== void 0, C = !W && X;
214
+ let B;
215
+ if (m === "24")
216
+ B = C ? 0 : n.hour ?? 0;
227
217
  else {
228
- const F = A ? 12 : n.hour ?? 12, V = A ? 1 : n.period ?? 0, G = F, J = V;
229
- G === 12 ? C = J === 0 ? 0 : 12 : C = J === 0 ? G : G + 12;
218
+ const F = C ? 12 : n.hour ?? 12, V = C ? 1 : n.period ?? 0, K = F, J = V;
219
+ K === 12 ? B = J === 0 ? 0 : 12 : B = J === 0 ? K : K + 12;
230
220
  }
231
- const Z = A ? 0 : n.minute ?? 0, $ = new Date(N, H, j, C, Z, 0, 0);
221
+ const Z = C ? 0 : n.minute ?? 0, $ = new Date(S, A, G, B, Z, 0, 0);
232
222
  M($);
233
223
  },
234
- [l, a, M]
235
- ), q = g(() => {
224
+ [l, m, M]
225
+ ), q = D(() => {
236
226
  const i = [
237
- { key: "month", config: h.month, ariaLabel: "Month" },
238
- { key: "day", config: h.day, ariaLabel: "Day" },
239
- { key: "year", config: h.year, ariaLabel: "Year" }
227
+ { key: "month", config: v.month, ariaLabel: "Month" },
228
+ { key: "day", config: v.day, ariaLabel: "Day" },
229
+ { key: "year", config: v.year, ariaLabel: "Year" }
240
230
  ];
241
- if (!m) return i;
242
- const n = a === "24" ? [
243
- { key: "hour", config: h.hour24, ariaLabel: "Hours" },
244
- { key: "minute", config: h.minute, ariaLabel: "Minutes" }
231
+ if (!a) return i;
232
+ const n = m === "24" ? [
233
+ { key: "hour", config: v.hour24, ariaLabel: "Hours" },
234
+ { key: "minute", config: v.minute, ariaLabel: "Minutes" }
245
235
  ] : [
246
- { key: "hour", config: h.hour12, ariaLabel: "Hours" },
247
- { key: "minute", config: h.minute, ariaLabel: "Minutes" },
248
- { key: "period", config: h.period, ariaLabel: re("Select {am} or {pm}", r) }
236
+ { key: "hour", config: v.hour12, ariaLabel: "Hours" },
237
+ { key: "minute", config: v.minute, ariaLabel: "Minutes" },
238
+ { key: "period", config: v.period, ariaLabel: re(r, "Select {am} or {pm}") }
249
239
  ];
250
240
  return [...i, ...n];
251
- }, [m, a, r]), z = L((i) => {
252
- S.current?.querySelectorAll('[role="spinbutton"]')[i]?.focus();
253
- }, []), Q = O(ie(d, x));
254
- return /* @__PURE__ */ K("div", { className: "flex flex-col gap-1.5", children: [
255
- u && /* @__PURE__ */ k(ne, { className: "text-text-primary text-sm font-medium", htmlFor: e, children: u }),
256
- /* @__PURE__ */ K("div", { className: O(Q, "relative", (s || d === "disabled") && "cursor-not-allowed", x), "data-slot": "datetime-display-input", id: e ?? "datetime-display-input", ref: R ?? S, ...E, children: [
257
- /* @__PURE__ */ k("div", { className: "flex items-center", ref: S, children: q.map((i, n) => {
258
- const p = ["month", "day", "year"].includes(i.key), H = ["hour", "minute", "period"].includes(i.key), Y = i.key === "year", N = i.key === "hour", P = s || H && !D;
259
- return /* @__PURE__ */ K("span", { className: "flex items-center", children: [
260
- N && /* @__PURE__ */ k("span", { "aria-hidden": "true", className: "text-text-secondary select-none", children: ", " }),
261
- /* @__PURE__ */ k(
241
+ }, [a, m, r]), z = w((i) => {
242
+ g.current?.querySelectorAll("[role='spinbutton']")[i]?.focus();
243
+ }, []), Q = U(ie(c, k));
244
+ return /* @__PURE__ */ O("div", { className: "flex flex-col gap-1.5", children: [
245
+ h && /* @__PURE__ */ b(ne, { className: "text-text-primary text-sm font-medium", htmlFor: o, children: h }),
246
+ /* @__PURE__ */ O("div", { className: U(Q, "relative", (y ?? c === "disabled") && "cursor-not-allowed", k), "data-slot": "datetime-display-input", id: o ?? "datetime-display-input", ref: T ?? g, ...R, children: [
247
+ /* @__PURE__ */ b("div", { className: "flex items-center", ref: g, children: q.map((i, n) => {
248
+ const f = ["month", "day", "year"].includes(i.key), A = ["hour", "minute", "period"].includes(i.key), P = i.key === "year", S = i.key === "hour", j = y ?? (A && !L);
249
+ return /* @__PURE__ */ O("span", { className: "flex items-center", children: [
250
+ S && /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "text-text-secondary select-none", children: ", " }),
251
+ /* @__PURE__ */ b(
262
252
  ce,
263
253
  {
264
254
  ariaLabel: i.ariaLabel,
265
255
  config: i.config,
266
- disabled: P,
256
+ disabled: j,
267
257
  onLeftFocus: () => n > 0 && z(n - 1),
268
258
  onRightFocus: () => n < q.length - 1 && z(n + 1),
269
- onValueChange: (j) => _({ [i.key]: j }),
259
+ onValueChange: (G) => _({ [i.key]: G }),
270
260
  periodLabels: r,
271
261
  value: l[i.key]
272
262
  }
273
263
  ),
274
- p && !Y && /* @__PURE__ */ k("span", { "aria-hidden": "true", className: "text-text-secondary select-none", children: "/" }),
275
- N && /* @__PURE__ */ k("span", { "aria-hidden": "true", className: "text-inherit select-none", children: ":" })
264
+ f && !P && /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "text-text-secondary select-none", children: "/" }),
265
+ S && /* @__PURE__ */ b("span", { "aria-hidden": "true", className: "text-inherit select-none", children: ":" })
276
266
  ] }, i.key);
277
267
  }) }),
278
- o
268
+ N
279
269
  ] })
280
270
  ] });
281
271
  }
@@ -42,15 +42,15 @@ const q = 2e3, z = ({ className: V, date: f, disabled: b, id: S, locale: A, name
42
42
  return;
43
43
  }
44
44
  if (t.key === "ArrowUp" || t.key === "ArrowDown") {
45
- const o = t.key === "ArrowUp" ? 1 : -1, s = C(r, o, e);
45
+ const o = t.key === "ArrowUp" ? 1 : -1, s = C(o, e, r);
46
46
  n && y(!1);
47
47
  const u = new Date(a);
48
- m(c(u, s, e, l));
48
+ m(c(u, e, s, l));
49
49
  return;
50
50
  }
51
51
  if (t.key === "Home" || t.key === "End") {
52
52
  const { min: o, max: s } = p(e), u = (t.key === "Home" ? o : s).toString().padStart(2, "0"), H = new Date(a);
53
- m(c(H, u, e, l));
53
+ m(c(H, e, u, l));
54
54
  return;
55
55
  }
56
56
  if (t.key >= "0" && t.key <= "9") {
@@ -58,7 +58,7 @@ const q = 2e3, z = ({ className: V, date: f, disabled: b, id: S, locale: A, name
58
58
  const o = I(t.key);
59
59
  n && w?.(), y((u) => !u);
60
60
  const s = new Date(a);
61
- m(c(s, o, e, l));
61
+ m(c(s, e, o, l));
62
62
  }
63
63
  }
64
64
  },
@@ -67,7 +67,7 @@ export declare const DEFAULT_TRANSLATIONS: TimePickerTranslations;
67
67
  * Interpolates localized period labels into a template string.
68
68
  * Replaces {am} and {pm} placeholders with actual localized values.
69
69
  */
70
- export declare function formatSelectPeriodLabel(template: string, labels: PeriodLabels): string;
70
+ export declare const formatSelectPeriodLabel: (labels: PeriodLabels, template: string) => string;
71
71
  export declare const PICKER_TYPES: {
72
72
  readonly HOURS: "hours";
73
73
  readonly HOURS_12: "12hours";
@@ -94,82 +94,82 @@ export declare const TIME_BOUNDS: {
94
94
  * 3. navigator.language (browser only)
95
95
  * 4. 'en-US' as final fallback
96
96
  */
97
- export declare function getResolvedLocale(locale?: string): string;
97
+ export declare const getResolvedLocale: (locale?: string) => string;
98
98
  /**
99
99
  * Detects whether a locale uses 12-hour or 24-hour time format.
100
100
  * Uses Intl.DateTimeFormat to check if the locale produces AM/PM markers.
101
101
  */
102
- export declare function detectHourFormat(locale: string): HourFormat;
102
+ export declare const detectHourFormat: (locale: string) => HourFormat;
103
103
  /**
104
104
  * Gets localized AM/PM labels using Intl.DateTimeFormat.
105
105
  * Returns the locale-specific strings for morning and afternoon periods.
106
106
  */
107
- export declare function getLocalizedPeriodLabels(locale: string): PeriodLabels;
107
+ export declare const getLocalizedPeriodLabels: (locale: string) => PeriodLabels;
108
108
  /**
109
109
  * Gets the localized label for a period value ('AM' or 'PM').
110
110
  */
111
- export declare function getLocalizedPeriodLabel(period: Period, labels: PeriodLabels): string;
111
+ export declare const getLocalizedPeriodLabel: (period: Period, labels: PeriodLabels) => string;
112
112
  /**
113
113
  * Formats a number using Intl.NumberFormat for the given locale.
114
114
  * Pads to 2 digits for time display.
115
115
  */
116
- export declare function formatTimeNumber(value: number, locale: string): string;
116
+ export declare const formatTimeNumber: (value: number, locale: string) => string;
117
117
  /**
118
118
  * Validates 24-hour format (00-23)
119
119
  */
120
- export declare function isValidHour(value: string): boolean;
120
+ export declare const isValidHour: (value: string) => boolean;
121
121
  /**
122
122
  * Validates 12-hour format (01-12)
123
123
  */
124
- export declare function isValid12Hour(value: string): boolean;
124
+ export declare const isValid12Hour: (value: string) => boolean;
125
125
  /**
126
126
  * Validates minute format (00-59)
127
127
  */
128
- export declare function isValidMinute(value: string): boolean;
128
+ export declare const isValidMinute: (value: string) => boolean;
129
129
  interface GetValidNumberConfig {
130
+ loop?: boolean;
130
131
  max: number;
131
132
  min?: number;
132
- loop?: boolean;
133
133
  }
134
- export declare function getValidNumber(value: string, { max, min, loop }: GetValidNumberConfig): string;
135
- export declare function getValidHour(value: string): string;
136
- export declare function getValid12Hour(value: string): string;
137
- export declare function getValidMinute(value: string): string;
134
+ export declare const getValidNumber: (value: string, { max, min, loop }: GetValidNumberConfig) => string;
135
+ export declare const getValidHour: (value: string) => string;
136
+ export declare const getValid12Hour: (value: string) => string;
137
+ export declare const getValidMinute: (value: string) => string;
138
138
  interface GetValidArrowNumberConfig {
139
- min: number;
140
139
  max: number;
140
+ min: number;
141
141
  step: number;
142
142
  }
143
- export declare function getValidArrowNumber(value: string, { min, max, step }: GetValidArrowNumberConfig): string;
144
- export declare function getValidArrowHour(value: string, step: number): string;
145
- export declare function getValidArrow12Hour(value: string, step: number): string;
146
- export declare function getValidArrowMinute(value: string, step: number): string;
147
- export declare function setMinutes(date: Date, value: string): Date;
148
- export declare function setHours(date: Date, value: string): Date;
149
- export declare function set12Hours(date: Date, value: string, period: Period): Date;
150
- export declare function setDateByType(date: Date, value: string, type: TimePickerType, period?: Period): Date;
151
- export declare function getDateByType(date: Date, type: TimePickerType): string;
152
- export declare function getArrowByType(value: string, step: number, type: TimePickerType): string;
143
+ export declare const getValidArrowNumber: (value: string, { min, max, step }: GetValidArrowNumberConfig) => string;
144
+ export declare const getValidArrowHour: (value: string, step: number) => string;
145
+ export declare const getValidArrow12Hour: (value: string, step: number) => string;
146
+ export declare const getValidArrowMinute: (value: string, step: number) => string;
147
+ export declare const setMinutes: (date: Date, value: string) => Date;
148
+ export declare const setHours: (date: Date, value: string) => Date;
149
+ export declare const set12Hours: (date: Date, value: string, period: Period) => Date;
150
+ export declare const setDateByType: (date: Date, type: TimePickerType, value: string, period?: Period) => Date;
151
+ export declare const getDateByType: (date: Date, type: TimePickerType) => string;
152
+ export declare const getArrowByType: (step: number, type: TimePickerType, value: string) => string;
153
153
  /**
154
154
  * Converts 12-hour format to 24-hour format
155
155
  * 12:00 PM → 12:00 (noon)
156
156
  * 12:00 AM → 00:00 (midnight)
157
157
  */
158
- export declare function convert12HourTo24Hour(hour: number, period: Period): number;
158
+ export declare const convert12HourTo24Hour: (hour: number, period: Period) => number;
159
159
  /**
160
160
  * Converts 24-hour format to 12-hour display value
161
161
  * Returns a zero-padded string (e.g., "01", "12")
162
162
  */
163
- export declare function display12HourValue(hours: number): string;
163
+ export declare const display12HourValue: (hours: number) => string;
164
164
  /**
165
165
  * Gets the period (AM/PM) from a 24-hour value
166
166
  */
167
- export declare function getPeriodFromHours(hours: number): Period;
168
- export declare function getAriaValueNow(date: Date, type: TimePickerType): number;
169
- export declare function getAriaValueMinMax(type: TimePickerType): {
167
+ export declare const getPeriodFromHours: (hours: number) => Period;
168
+ export declare const getAriaValueNow: (date: Date, type: TimePickerType) => number;
169
+ export declare const getAriaValueMinMax: (type: TimePickerType) => {
170
170
  min: number;
171
171
  max: number;
172
172
  };
173
- export declare function getAriaLabel(type: TimePickerType, translations?: TimePickerTranslations): string;
173
+ export declare const getAriaLabel: (type: TimePickerType, translations?: TimePickerTranslations) => string;
174
174
  export {};
175
175
  //# sourceMappingURL=DateTimeUtils.d.ts.map