haze-ui 1.27.0 → 1.28.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 (163) hide show
  1. package/dist/components/Calendar/Calendar.js +222 -151
  2. package/dist/components/Cascader/Cascader.js +180 -146
  3. package/dist/components/Chart/Chart.js +12 -9
  4. package/dist/components/Chart/chart-elements.js +118 -42
  5. package/dist/components/CodeBlock/CodeBlock.js +39 -9
  6. package/dist/components/Combobox/Combobox.js +107 -99
  7. package/dist/components/DataTable/DataTable.js +224 -221
  8. package/dist/components/DataTable/csv.js +29 -0
  9. package/dist/components/DataTable/index.js +3 -2
  10. package/dist/components/DateRangePicker/DateRangePicker.js +31 -16
  11. package/dist/components/DateRangePicker/presets.js +43 -0
  12. package/dist/components/Datepicker/Datepicker.js +12 -11
  13. package/dist/components/Datepicker/DatepickerCore.js +72 -51
  14. package/dist/components/Datepicker/datetime.js +23 -0
  15. package/dist/components/Descriptions/Descriptions.js +46 -0
  16. package/dist/components/Descriptions/index.js +3 -0
  17. package/dist/components/DiffViewer/DiffViewer.js +31 -30
  18. package/dist/components/FilePreview/FilePreview.js +135 -0
  19. package/dist/components/FilePreview/file-preview-format.js +23 -0
  20. package/dist/components/FilePreview/index.js +3 -0
  21. package/dist/components/FloatButton/FloatButton.js +42 -0
  22. package/dist/components/FloatButton/FloatButtonGroup.js +58 -0
  23. package/dist/components/FloatButton/float-button-context.js +9 -0
  24. package/dist/components/FloatButton/float-button-glyphs.js +26 -0
  25. package/dist/components/FloatButton/float-button-styles.js +14 -0
  26. package/dist/components/FloatButton/index.js +4 -0
  27. package/dist/components/InlineCompletion/InlineCompletion.js +81 -0
  28. package/dist/components/InlineCompletion/index.js +3 -0
  29. package/dist/components/JsonView/JsonView.js +209 -0
  30. package/dist/components/JsonView/index.js +3 -0
  31. package/dist/components/JsonView/json-view-utils.js +24 -0
  32. package/dist/components/LocaleProvider/index.js +5 -4
  33. package/dist/components/LocaleProvider/ja-jp.js +222 -0
  34. package/dist/components/LocaleProvider/locale.js +42 -4
  35. package/dist/components/LocaleProvider/useStrings.js +13 -11
  36. package/dist/components/LocaleProvider/zh-cn.js +42 -4
  37. package/dist/components/Masonry/Masonry.js +29 -0
  38. package/dist/components/Masonry/index.js +3 -0
  39. package/dist/components/Masonry/masonry-distribute.js +15 -0
  40. package/dist/components/Select/Select.js +14 -13
  41. package/dist/components/Select/SelectCore.js +27 -26
  42. package/dist/components/Select/SelectFloating.js +76 -68
  43. package/dist/components/Signature/Signature.js +165 -0
  44. package/dist/components/Signature/index.js +3 -0
  45. package/dist/components/Signature/signature-points.js +28 -0
  46. package/dist/components/Sources/Sources.js +109 -0
  47. package/dist/components/Sources/index.js +3 -0
  48. package/dist/components/TagGroup/SortableTagGroup.js +26 -0
  49. package/dist/components/TagGroup/TagGroup.js +7 -21
  50. package/dist/components/TagGroup/TagGroupItem.js +1 -1
  51. package/dist/components/TagGroup/index.js +2 -1
  52. package/dist/components/TagGroup/tag-group-styles.js +7 -0
  53. package/dist/components/TagInput/SortableTagInput.js +24 -0
  54. package/dist/components/TagInput/SortableTagInputCore.js +52 -0
  55. package/dist/components/TagInput/TagInput.js +9 -10
  56. package/dist/components/TagInput/TagInputCore.js +61 -84
  57. package/dist/components/TagInput/index.js +3 -1
  58. package/dist/components/TagInput/tag-input-styles.js +7 -0
  59. package/dist/components/Toast/Toast.js +44 -43
  60. package/dist/components/Tree/Tree.js +184 -121
  61. package/dist/components/Tree/TreeItem.js +91 -57
  62. package/dist/components/Tree/utils.js +57 -1
  63. package/dist/components/Upload/Upload.js +12 -9
  64. package/dist/components/Upload/UploadCore.js +130 -124
  65. package/dist/components/Upload/UploadList.js +164 -36
  66. package/dist/css/bottom-sheet.css +1 -1
  67. package/dist/css/cascader.css +1 -1
  68. package/dist/css/datepicker.css +1 -1
  69. package/dist/css/descriptions.css +2 -0
  70. package/dist/css/dialog.css +1 -1
  71. package/dist/css/drawer.css +1 -1
  72. package/dist/css/file-preview.css +2 -0
  73. package/dist/css/float-button.css +2 -0
  74. package/dist/css/inline-completion.css +2 -0
  75. package/dist/css/json-view.css +2 -0
  76. package/dist/css/masonry.css +2 -0
  77. package/dist/css/signature.css +2 -0
  78. package/dist/css/sources.css +2 -0
  79. package/dist/css/tag-group.css +2 -2
  80. package/dist/css/tag-input.css +2 -3
  81. package/dist/css/tree.css +2 -2
  82. package/dist/css/upload.css +1 -1
  83. package/dist/css-manifest.json +15 -0
  84. package/dist/haze-ui.css +20 -13
  85. package/dist/headless/index.js +18 -6
  86. package/dist/hooks/useDarkMode.js +27 -0
  87. package/dist/index.js +207 -192
  88. package/dist/registry.json +210 -34
  89. package/dist/types/components/Cascader/Cascader.d.ts +20 -1
  90. package/dist/types/components/Chart/Chart.d.ts +27 -13
  91. package/dist/types/components/Chart/chart-elements.d.ts +62 -10
  92. package/dist/types/components/Chart/index.d.ts +1 -1
  93. package/dist/types/components/CodeBlock/CodeBlock.d.ts +19 -2
  94. package/dist/types/components/CodeBlock/index.d.ts +1 -1
  95. package/dist/types/components/Combobox/Combobox.d.ts +11 -1
  96. package/dist/types/components/DataTable/DataTable.d.ts +36 -1
  97. package/dist/types/components/DataTable/csv.d.ts +36 -0
  98. package/dist/types/components/DataTable/features.d.ts +6 -0
  99. package/dist/types/components/DataTable/index.d.ts +2 -0
  100. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +15 -3
  101. package/dist/types/components/DateRangePicker/index.d.ts +1 -1
  102. package/dist/types/components/DateRangePicker/presets.d.ts +23 -0
  103. package/dist/types/components/Datepicker/Datepicker.d.ts +5 -1
  104. package/dist/types/components/Datepicker/DatepickerCore.d.ts +6 -1
  105. package/dist/types/components/Datepicker/datetime.d.ts +27 -0
  106. package/dist/types/components/Descriptions/Descriptions.d.ts +30 -0
  107. package/dist/types/components/Descriptions/index.d.ts +2 -0
  108. package/dist/types/components/FilePreview/FilePreview.d.ts +35 -0
  109. package/dist/types/components/FilePreview/file-preview-format.d.ts +20 -0
  110. package/dist/types/components/FilePreview/index.d.ts +2 -0
  111. package/dist/types/components/FloatButton/FloatButton.d.ts +43 -0
  112. package/dist/types/components/FloatButton/FloatButtonGroup.d.ts +33 -0
  113. package/dist/types/components/FloatButton/float-button-context.d.ts +11 -0
  114. package/dist/types/components/FloatButton/float-button-glyphs.d.ts +3 -0
  115. package/dist/types/components/FloatButton/float-button-styles.d.ts +58 -0
  116. package/dist/types/components/FloatButton/index.d.ts +4 -0
  117. package/dist/types/components/InlineCompletion/InlineCompletion.d.ts +29 -0
  118. package/dist/types/components/InlineCompletion/index.d.ts +2 -0
  119. package/dist/types/components/JsonView/JsonView.d.ts +26 -0
  120. package/dist/types/components/JsonView/index.d.ts +2 -0
  121. package/dist/types/components/JsonView/json-view-utils.d.ts +22 -0
  122. package/dist/types/components/LocaleProvider/index.d.ts +1 -0
  123. package/dist/types/components/LocaleProvider/ja-jp.d.ts +13 -0
  124. package/dist/types/components/LocaleProvider/locale.d.ts +44 -0
  125. package/dist/types/components/Masonry/Masonry.d.ts +34 -0
  126. package/dist/types/components/Masonry/index.d.ts +2 -0
  127. package/dist/types/components/Masonry/masonry-distribute.d.ts +16 -0
  128. package/dist/types/components/Select/Select.d.ts +13 -1
  129. package/dist/types/components/Select/SelectCore.d.ts +10 -1
  130. package/dist/types/components/Select/SelectFloating.d.ts +12 -1
  131. package/dist/types/components/Signature/Signature.d.ts +51 -0
  132. package/dist/types/components/Signature/index.d.ts +2 -0
  133. package/dist/types/components/Signature/signature-points.d.ts +31 -0
  134. package/dist/types/components/Sources/Sources.d.ts +37 -0
  135. package/dist/types/components/Sources/index.d.ts +2 -0
  136. package/dist/types/components/TagGroup/SortableTagGroup.d.ts +20 -0
  137. package/dist/types/components/TagGroup/TagGroup.d.ts +4 -13
  138. package/dist/types/components/TagGroup/index.d.ts +2 -0
  139. package/dist/types/components/TagGroup/tag-group-styles.d.ts +7 -0
  140. package/dist/types/components/TagInput/SortableTagInput.d.ts +34 -0
  141. package/dist/types/components/TagInput/SortableTagInputCore.d.ts +18 -0
  142. package/dist/types/components/TagInput/TagInput.d.ts +1 -8
  143. package/dist/types/components/TagInput/TagInputCore.d.ts +4 -10
  144. package/dist/types/components/TagInput/index.d.ts +4 -0
  145. package/dist/types/components/TagInput/tag-input-styles.d.ts +12 -0
  146. package/dist/types/components/Tree/Tree.d.ts +1 -1
  147. package/dist/types/components/Tree/TreeItem.d.ts +11 -1
  148. package/dist/types/components/Tree/types.d.ts +25 -0
  149. package/dist/types/components/Tree/utils.d.ts +41 -0
  150. package/dist/types/components/Upload/Upload.d.ts +10 -1
  151. package/dist/types/components/Upload/UploadCore.d.ts +21 -1
  152. package/dist/types/components/Upload/UploadList.d.ts +8 -2
  153. package/dist/types/headless/index.d.ts +221 -4
  154. package/dist/types/hooks/index.d.ts +2 -0
  155. package/dist/types/hooks/useDarkMode.d.ts +40 -0
  156. package/dist/types/index.d.ts +28 -11
  157. package/dist/types/utils/sortable-handle.d.ts +25 -0
  158. package/dist/types/utils/sortable-shared.d.ts +12 -24
  159. package/dist/utils/sortable-handle.js +12 -0
  160. package/dist/utils/sortable-shared.js +8 -16
  161. package/dist/utils/sortable.js +2 -1
  162. package/dist/utils/submenu.js +7 -5
  163. package/package.json +65 -5
@@ -5,11 +5,11 @@ import { getDirection as t } from "../../utils/direction.js";
5
5
  import { useStrings as n } from "../LocaleProvider/useStrings.js";
6
6
  import { addMonths as r, buildMonthCells as i, formatDate as a, formatMonthValue as o, formatQuarterValue as s, formatYearValue as c, getDaysInMonth as l, getISOWeekNumber as u, parseCivilDate as d, parseMonthValue as f, parseQuarterValue as ee, parseYearValue as p } from "./date.js";
7
7
  /* empty css */
8
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
9
- import { useEffect as g, useRef as _, useState as v } from "react";
10
- import { useControl as te } from "react-use-control";
8
+ import { Fragment as te, jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { useEffect as ne, useRef as g, useState as _ } from "react";
10
+ import { useControl as re } from "react-use-control";
11
11
  //#region src/lib/components/Calendar/Calendar.tsx
12
- var ne = "haze-Calendar__calendarWrapper", re = "haze-Calendar__header", y = "haze-Calendar__headerBtn", b = "haze-Calendar__headerTitle", ie = "haze-Calendar__titleBtn", ae = "haze-Calendar__headerTrailing", oe = "haze-Calendar__grid", x = "haze-Calendar__rowContents", S = "haze-Calendar__cellContents", se = "haze-Calendar__weekday", ce = "haze-Calendar__weekNumber", C = "haze-Calendar__dayBtn", w = "haze-Calendar__daySelected", le = "haze-Calendar__dayInRange", ue = "haze-Calendar__dayOutside", de = "haze-Calendar__monthPanels", fe = "haze-Calendar__monthPanel", pe = "haze-Calendar__paneHeader", me = "haze-Calendar__quickSelect", he = "haze-Calendar__quickToolbar", T = "haze-Calendar__quickGrid", ge = "haze-Calendar__quarterGrid", _e = [
12
+ var ie = "haze-Calendar__calendarWrapper", ae = "haze-Calendar__header", v = "haze-Calendar__headerBtn", y = "haze-Calendar__headerTitle", oe = "haze-Calendar__titleBtn", se = "haze-Calendar__headerTrailing", ce = "haze-Calendar__grid", b = "haze-Calendar__rowContents", x = "haze-Calendar__cellContents", le = "haze-Calendar__weekday", ue = "haze-Calendar__weekNumber", S = "haze-Calendar__dayBtn", C = "haze-Calendar__daySelected", de = "haze-Calendar__dayInRange", fe = "haze-Calendar__dayOutside", pe = "haze-Calendar__monthPanels", me = "haze-Calendar__monthPanel", he = "haze-Calendar__paneHeader", ge = "haze-Calendar__quickSelect", _e = "haze-Calendar__quickToolbar", w = "haze-Calendar__quickGrid", ve = "haze-Calendar__quarterGrid", ye = [
13
13
  "Su",
14
14
  "Mo",
15
15
  "Tu",
@@ -18,7 +18,7 @@ var ne = "haze-Calendar__calendarWrapper", re = "haze-Calendar__header", y = "ha
18
18
  "Fr",
19
19
  "Sa"
20
20
  ];
21
- function ve(e, t) {
21
+ function be(e, t) {
22
22
  if (t !== void 0) return t;
23
23
  if (e === void 0) return 0;
24
24
  try {
@@ -28,27 +28,27 @@ function ve(e, t) {
28
28
  return 0;
29
29
  }
30
30
  }
31
- function ye(e, t) {
32
- if (e === void 0) return Array.from({ length: 7 }, (e, n) => _e[(t + n) % 7]);
31
+ function xe(e, t) {
32
+ if (e === void 0) return Array.from({ length: 7 }, (e, n) => ye[(t + n) % 7]);
33
33
  let n = new Intl.DateTimeFormat(e, { weekday: "short" }), r = Array.from({ length: 7 }, (e, t) => n.format(new Date(2024, 0, 7 + t)));
34
34
  return Array.from({ length: 7 }, (e, n) => r[(t + n) % 7]);
35
35
  }
36
- function E(e) {
36
+ function T(e) {
37
37
  return Array.from(e?.querySelectorAll("button") ?? []);
38
38
  }
39
- function D(e, t, n) {
39
+ function E(e, t, n) {
40
40
  let r = t + n;
41
41
  for (; r >= 0 && r < e.length && e[r].disabled;) r += n;
42
42
  return r < 0 || r >= e.length ? null : r;
43
43
  }
44
- function be(e, n, i, o) {
44
+ function Se(e, n, i, o) {
45
45
  return (s) => {
46
46
  let c = e.current;
47
47
  if (!c) return;
48
- let u = E(c);
48
+ let u = T(c);
49
49
  if (u.length === 0) return;
50
50
  let d = u.indexOf(s.target.closest("button")), f = t(c) === "rtl" ? "ArrowLeft" : "ArrowRight", ee = f === "ArrowLeft" ? "ArrowRight" : "ArrowLeft", p = (e) => {
51
- let t = D(u, d < 0 ? 0 : d, e);
51
+ let t = E(u, d < 0 ? 0 : d, e);
52
52
  t !== null && (s.preventDefault(), u[t].focus());
53
53
  };
54
54
  switch (s.key) {
@@ -65,12 +65,12 @@ function be(e, n, i, o) {
65
65
  p(-7);
66
66
  return;
67
67
  case "Home": {
68
- let e = D(u, (d < 0 ? 0 : d - d % 7) - 1, 1);
68
+ let e = E(u, (d < 0 ? 0 : d - d % 7) - 1, 1);
69
69
  e !== null && (s.preventDefault(), u[e].focus());
70
70
  return;
71
71
  }
72
72
  case "End": {
73
- let e = D(u, (d < 0 ? 6 : d - d % 7 + 6) + 1, -1);
73
+ let e = E(u, (d < 0 ? 6 : d - d % 7 + 6) + 1, -1);
74
74
  e !== null && (s.preventDefault(), u[e].focus());
75
75
  return;
76
76
  }
@@ -84,14 +84,14 @@ function be(e, n, i, o) {
84
84
  }
85
85
  };
86
86
  }
87
- function xe(e, n, r, i) {
87
+ function D(e, n, r, i) {
88
88
  return (a) => {
89
89
  let o = e.current;
90
90
  if (!o) return;
91
- let s = E(o);
91
+ let s = T(o);
92
92
  if (s.length === 0) return;
93
93
  let c = s.indexOf(a.target.closest("button")), l = t(o) === "rtl" ? "ArrowLeft" : "ArrowRight", u = l === "ArrowLeft" ? "ArrowRight" : "ArrowLeft", d = (e) => {
94
- let t = D(s, c < 0 ? 0 : c, e);
94
+ let t = E(s, c < 0 ? 0 : c, e);
95
95
  t !== null && (a.preventDefault(), s[t].focus());
96
96
  };
97
97
  switch (a.key) {
@@ -108,12 +108,12 @@ function xe(e, n, r, i) {
108
108
  d(-n);
109
109
  return;
110
110
  case "Home": {
111
- let e = D(s, (c < 0 ? 0 : c - c % n) - 1, 1);
111
+ let e = E(s, (c < 0 ? 0 : c - c % n) - 1, 1);
112
112
  e !== null && (a.preventDefault(), s[e].focus());
113
113
  return;
114
114
  }
115
115
  case "End": {
116
- let e = D(s, (c < 0 ? n - 1 : Math.min(c - c % n + n - 1, s.length - 1)) + 1, -1);
116
+ let e = E(s, (c < 0 ? n - 1 : Math.min(c - c % n + n - 1, s.length - 1)) + 1, -1);
117
117
  e !== null && (a.preventDefault(), s[e].focus());
118
118
  return;
119
119
  }
@@ -124,105 +124,115 @@ function xe(e, n, r, i) {
124
124
  }
125
125
  };
126
126
  }
127
- function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, locale: A, weekStartsOn: Se, showWeekNumbers: j = !1, months: Ce = 1, rangeStart: M, rangeEnd: N, onSelect: we, className: Te, ...Ee }) {
128
- let [P, De] = te(_e, ""), F = n("calendar"), I = _(null), Oe = _(null), L = _(null), R = _(null), z = _(null), B = _(null), V = _(null), ke = _(null), H = _(null), [U, W] = v(!1), [G, K] = v(0), Ae = t === "month" ? f(P) : t === "quarter" ? ee(P) : t === "year" ? p(P) : null, je = t === "date" ? P && d(P) || M && d(M) || /* @__PURE__ */ new Date() : Ae ? new Date(Ae.year, 0, 1) : /* @__PURE__ */ new Date(), [q, J] = v(je.getFullYear()), [Y, Me] = v(je.getMonth()), Ne = ve(A, Se), Pe = ye(A, Ne), X = new Intl.DateTimeFormat(A ?? "default", {
127
+ function O({ picker: t = "date", value: ye, min: E, max: O, disabledDate: k, locale: A, weekStartsOn: Ce, showWeekNumbers: j = !1, months: we = 1, rangeStart: M, rangeEnd: N, onSelect: Te, className: Ee, ...De }) {
128
+ let [P, Oe] = re(ye, ""), F = n("calendar"), I = g(null), ke = g(null), L = g(null), R = g(null), z = g(null), B = g(null), V = g(null), Ae = g(null), H = g(null), [U, W] = _(!1), [G, K] = _(0), [q, je] = _(!1), Me = t === "month" ? f(P) : t === "quarter" ? ee(P) : t === "year" ? p(P) : null, Ne = t === "date" ? P && d(P) || M && d(M) || /* @__PURE__ */ new Date() : Me ? new Date(Me.year, 0, 1) : /* @__PURE__ */ new Date(), [J, Pe] = _(Ne.getFullYear()), [Y, Fe] = _(Ne.getMonth()), Ie = be(A, Ce), Le = xe(A, Ie), Re = new Intl.DateTimeFormat(A ?? "default", {
129
129
  month: "long",
130
130
  year: "numeric"
131
- }), Fe = new Intl.DateTimeFormat(A ?? "default", { month: "short" }), Ie = Array.from({ length: 12 }, (e, t) => Fe.format(new Date(2026, t, 15))), Z = (e) => {
132
- J(e.year), Me(e.month);
131
+ }), ze = new Intl.DateTimeFormat(A ?? "default", { month: "short" }), Be = Array.from({ length: 12 }, (e, t) => ze.format(new Date(2026, t, 15))), X = (e) => {
132
+ Pe(e.year), Fe(e.month);
133
133
  };
134
- g(() => {
134
+ ne(() => {
135
135
  if (U) return;
136
136
  let e = R.current;
137
137
  e && (R.current = null, L.current?.querySelector(`[data-haze-day="${e}"]`)?.focus());
138
138
  }, [
139
- q,
139
+ J,
140
140
  Y,
141
141
  U
142
- ]), g(() => {
142
+ ]), ne(() => {
143
143
  if (!U) return;
144
144
  let e = z.current;
145
145
  z.current = null;
146
- let t = E(H.current);
146
+ let t = T(H.current);
147
147
  t.length !== 0 && (t[e ?? 0] ?? t[0]).focus();
148
- }, [U, G]), g(() => {
148
+ }, [
149
+ U,
150
+ G,
151
+ q
152
+ ]), ne(() => {
149
153
  if (t === "date") return;
150
154
  let e = B.current;
151
155
  if (B.current = null, e === null) return;
152
- let n = E(V.current);
156
+ let n = T(V.current);
153
157
  (n[e] ?? n[0])?.focus();
154
- }, [t, q]);
155
- let Le = () => {
156
- z.current = Y, K(q), W(!0);
157
- }, Re = () => {
158
- W(!1), ke.current?.focus();
159
- }, ze = (e) => {
160
- W(!1), Z({
158
+ }, [t, J]);
159
+ let Ve = () => {
160
+ z.current = Y, K(J), je(!1), W(!0);
161
+ }, He = () => {
162
+ W(!1), Ae.current?.focus();
163
+ }, Ue = (e) => {
164
+ W(!1), X({
161
165
  year: G,
162
166
  month: e
163
167
  }), R.current = a(G, e, 1);
164
- }, Q = r(q, Y, Ce - 1), Be = be(I, {
165
- year: q,
168
+ }, Z = Math.floor(G / 10) * 10, We = () => {
169
+ z.current = G - Z, je(!0);
170
+ }, Ge = () => {
171
+ je(!1), z.current = Y;
172
+ }, Ke = (e) => {
173
+ K(e), Ge();
174
+ }, Q = r(J, Y, we - 1), qe = Se(I, {
175
+ year: J,
166
176
  month: Y
167
- }, Z, R), Ve = be(Oe, Q, Z, R), He = xe(H, 3, (e) => K((t) => t + e), z), Ue = t === "quarter" ? 4 : 3, $ = (e) => J((n) => n + e * (t === "year" ? 10 : 1)), We = xe(V, Ue, $, B), Ge = () => Z(r(q, Y, -1)), Ke = () => Z(r(q, Y, 1)), qe = () => {
177
+ }, X, R), Je = Se(ke, Q, X, R), Ye = D(H, 3, (e) => K((t) => t + e), z), Xe = D(H, 3, (e) => K((t) => t + e * 10), z), Ze = t === "quarter" ? 4 : 3, Qe = (e) => Pe((n) => n + e * (t === "year" ? 10 : 1)), $e = D(V, Ze, Qe, B), et = () => X(r(J, Y, -1)), tt = () => X(r(J, Y, 1)), nt = () => {
168
178
  let e = /* @__PURE__ */ new Date();
169
- J(e.getFullYear()), Me(e.getMonth());
170
- }, Je = (e, t, n) => {
179
+ Pe(e.getFullYear()), Fe(e.getMonth());
180
+ }, rt = (e, t, n) => {
171
181
  let r = a(e, t, n);
172
- return D && r < D || O && r > O ? !0 : k?.(new Date(e, t, n)) ?? !1;
173
- }, Ye = (e, t) => D && a(e, t, l(e, t)) < D || O && a(e, t, 1) > O ? !0 : k?.(new Date(e, t, 1)) ?? !1, Xe = (e, t) => {
182
+ return E && r < E || O && r > O ? !0 : k?.(new Date(e, t, n)) ?? !1;
183
+ }, it = (e, t) => E && a(e, t, l(e, t)) < E || O && a(e, t, 1) > O ? !0 : k?.(new Date(e, t, 1)) ?? !1, at = (e, t) => {
174
184
  let n = t * 3 - 3, r = t * 3 - 1;
175
- return D && a(e, r, l(e, r)) < D || O && a(e, n, 1) > O ? !0 : k?.(new Date(e, n, 1)) ?? !1;
176
- }, Ze = (e) => D && a(e, 11, 31) < D || O && a(e, 0, 1) > O ? !0 : k?.(new Date(e, 0, 1)) ?? !1, Qe = (e) => {
177
- De(e), we?.(e);
178
- }, $e = M !== void 0 && M !== "", et = N !== void 0 && N !== "", tt = (e) => $e && e === M || et && e === N, nt = (e) => $e && et && e > M && e < N, rt = X.format(new Date(q, Y)), it = (t, n, r) => {
179
- let o = i(t.year, t.month, Ne), s = [];
185
+ return E && a(e, r, l(e, r)) < E || O && a(e, n, 1) > O ? !0 : k?.(new Date(e, n, 1)) ?? !1;
186
+ }, ot = (e) => E && a(e, 11, 31) < E || O && a(e, 0, 1) > O ? !0 : k?.(new Date(e, 0, 1)) ?? !1, st = (e) => {
187
+ Oe(e), Te?.(e);
188
+ }, ct = M !== void 0 && M !== "", lt = N !== void 0 && N !== "", ut = (e) => ct && e === M || lt && e === N, dt = (e) => ct && lt && e > M && e < N, ft = Re.format(new Date(J, Y)), $ = (t, n, r) => {
189
+ let o = i(t.year, t.month, Ie), s = [];
180
190
  for (let e = 0; e < o.length; e += 7) s.push(o.slice(e, e + 7));
181
- let c = X.format(new Date(t.year, t.month));
191
+ let c = Re.format(new Date(t.year, t.month));
182
192
  return /* @__PURE__ */ h("div", {
183
193
  ref: n,
184
194
  style: j ? { gridTemplateColumns: "repeat(8, 1fr)" } : void 0,
185
195
  role: "grid",
186
196
  "aria-label": c,
187
197
  onKeyDown: r,
188
- className: e([oe]),
198
+ className: e([ce]),
189
199
  children: [/* @__PURE__ */ h("div", {
190
200
  role: "row",
191
- className: e([x]),
201
+ className: e([b]),
192
202
  children: [j && /* @__PURE__ */ m("span", {
193
203
  role: "columnheader",
194
- className: e([se]),
204
+ className: e([le]),
195
205
  children: F.weekNumber
196
- }), Pe.map((t, n) => /* @__PURE__ */ m("span", {
206
+ }), Le.map((t, n) => /* @__PURE__ */ m("span", {
197
207
  role: "columnheader",
198
- className: e([se]),
208
+ className: e([le]),
199
209
  children: t
200
210
  }, n))]
201
211
  }), s.map((t, n) => /* @__PURE__ */ h("div", {
202
212
  role: "row",
203
- className: e([x]),
213
+ className: e([b]),
204
214
  children: [j && /* @__PURE__ */ m("span", {
205
215
  role: "gridcell",
206
- className: e([ce]),
216
+ className: e([ue]),
207
217
  children: u(t[0].year, t[0].month, t[0].day)
208
218
  }), t.map((t) => {
209
- let n = a(t.year, t.month, t.day), r = tt(n), i = n === P || r;
219
+ let n = a(t.year, t.month, t.day), r = ut(n), i = n === P || r;
210
220
  return /* @__PURE__ */ m("span", {
211
221
  role: "gridcell",
212
- "aria-selected": i || nt(n),
213
- className: e([S]),
222
+ "aria-selected": i || dt(n),
223
+ className: e([x]),
214
224
  children: /* @__PURE__ */ m("button", {
215
225
  type: "button",
216
226
  "data-haze-day": n,
217
- disabled: Je(t.year, t.month, t.day),
227
+ disabled: rt(t.year, t.month, t.day),
218
228
  onClick: () => {
219
- De(n), we?.(n);
229
+ Oe(n), Te?.(n);
220
230
  },
221
231
  className: e([
222
- C,
223
- i && w,
224
- !i && nt(n) && le,
225
- t.outside && ue
232
+ S,
233
+ i && C,
234
+ !i && dt(n) && de,
235
+ t.outside && fe
226
236
  ]),
227
237
  children: t.day
228
238
  })
@@ -230,37 +240,98 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
230
240
  })]
231
241
  }, n))]
232
242
  });
233
- }, at = /* @__PURE__ */ h("div", {
234
- onKeyDown: ot,
235
- className: e([me]),
236
- children: [/* @__PURE__ */ h("div", {
237
- className: e([he]),
238
- children: [
243
+ }, pt = /* @__PURE__ */ h("div", {
244
+ onKeyDown: mt,
245
+ className: e([ge]),
246
+ children: [/* @__PURE__ */ m("div", {
247
+ className: e([_e]),
248
+ children: q ? /* @__PURE__ */ h(te, { children: [
249
+ /* @__PURE__ */ m("button", {
250
+ type: "button",
251
+ onClick: () => K((e) => e - 10),
252
+ "aria-label": F.previousDecade,
253
+ className: e([v]),
254
+ children: "‹"
255
+ }),
256
+ /* @__PURE__ */ h("span", {
257
+ className: e([y]),
258
+ children: [
259
+ Z,
260
+ " – ",
261
+ Z + 11
262
+ ]
263
+ }),
264
+ /* @__PURE__ */ m("button", {
265
+ type: "button",
266
+ onClick: () => K((e) => e + 10),
267
+ "aria-label": F.nextDecade,
268
+ className: e([v]),
269
+ children: "›"
270
+ })
271
+ ] }) : /* @__PURE__ */ h(te, { children: [
239
272
  /* @__PURE__ */ m("button", {
240
273
  type: "button",
241
274
  onClick: () => K((e) => e - 1),
242
275
  "aria-label": F.previousYear,
243
- className: e([y]),
276
+ className: e([v]),
244
277
  children: "‹"
245
278
  }),
246
- /* @__PURE__ */ m("span", {
247
- className: e([b]),
279
+ /* @__PURE__ */ m("button", {
280
+ type: "button",
281
+ "aria-haspopup": "grid",
282
+ onClick: We,
283
+ className: e([oe, y]),
248
284
  children: G
249
285
  }),
250
286
  /* @__PURE__ */ m("button", {
251
287
  type: "button",
252
288
  onClick: () => K((e) => e + 1),
253
289
  "aria-label": F.nextYear,
254
- className: e([y]),
290
+ className: e([v]),
255
291
  children: "›"
256
292
  })
257
- ]
258
- }), /* @__PURE__ */ m("div", {
293
+ ] })
294
+ }), q ? /* @__PURE__ */ m("div", {
295
+ ref: H,
296
+ role: "grid",
297
+ "aria-label": F.selectYear,
298
+ onKeyDown: Xe,
299
+ className: e([w]),
300
+ children: [
301
+ 0,
302
+ 1,
303
+ 2,
304
+ 3
305
+ ].map((t) => /* @__PURE__ */ m("div", {
306
+ role: "row",
307
+ className: e([b]),
308
+ children: [
309
+ 0,
310
+ 1,
311
+ 2
312
+ ].map((n) => {
313
+ let r = Z + t * 3 + n, i = r === J;
314
+ return /* @__PURE__ */ m("span", {
315
+ role: "gridcell",
316
+ "aria-selected": i,
317
+ className: e([x]),
318
+ children: /* @__PURE__ */ m("button", {
319
+ type: "button",
320
+ "data-haze-year": r,
321
+ disabled: ot(r),
322
+ onClick: () => Ke(r),
323
+ className: e([S, i && C]),
324
+ children: r
325
+ })
326
+ }, r);
327
+ })
328
+ }, t))
329
+ }) : /* @__PURE__ */ m("div", {
259
330
  ref: H,
260
331
  role: "grid",
261
332
  "aria-label": F.selectMonth,
262
- onKeyDown: He,
263
- className: e([T]),
333
+ onKeyDown: Ye,
334
+ className: e([w]),
264
335
  children: [
265
336
  0,
266
337
  1,
@@ -268,39 +339,39 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
268
339
  3
269
340
  ].map((t) => /* @__PURE__ */ m("div", {
270
341
  role: "row",
271
- className: e([x]),
342
+ className: e([b]),
272
343
  children: [
273
344
  0,
274
345
  1,
275
346
  2
276
347
  ].map((n) => {
277
- let r = t * 3 + n, i = G === q && r === Y;
348
+ let r = t * 3 + n, i = G === J && r === Y;
278
349
  return /* @__PURE__ */ m("span", {
279
350
  role: "gridcell",
280
351
  "aria-selected": i,
281
- className: e([S]),
352
+ className: e([x]),
282
353
  children: /* @__PURE__ */ m("button", {
283
354
  type: "button",
284
355
  "data-haze-month": r,
285
- onClick: () => ze(r),
286
- className: e([C, i && w]),
287
- children: Ie[r]
356
+ onClick: () => Ue(r),
357
+ className: e([S, i && C]),
358
+ children: Be[r]
288
359
  })
289
360
  }, r);
290
361
  })
291
362
  }, t))
292
363
  })]
293
364
  });
294
- function ot(e) {
295
- e.key === "Escape" && (e.preventDefault(), Re());
365
+ function mt(e) {
366
+ e.key === "Escape" && (e.preventDefault(), q ? Ge() : He());
296
367
  }
297
368
  if (t !== "date") {
298
- let n = Math.floor(q / 10) * 10, r = t === "year" ? F.previousDecade : F.previousYear, i = t === "year" ? F.nextDecade : F.nextYear, a = t === "year" ? `${n} – ${n + 11}` : String(q), l = t === "month" ? /* @__PURE__ */ m("div", {
369
+ let n = Math.floor(J / 10) * 10, r = t === "year" ? F.previousDecade : F.previousYear, i = t === "year" ? F.nextDecade : F.nextYear, a = t === "year" ? `${n} – ${n + 11}` : String(J), l = t === "month" ? /* @__PURE__ */ m("div", {
299
370
  ref: V,
300
371
  role: "grid",
301
372
  "aria-label": F.selectMonth,
302
- onKeyDown: We,
303
- className: e([T]),
373
+ onKeyDown: $e,
374
+ className: e([w]),
304
375
  children: [
305
376
  0,
306
377
  1,
@@ -308,24 +379,24 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
308
379
  3
309
380
  ].map((t) => /* @__PURE__ */ m("div", {
310
381
  role: "row",
311
- className: e([x]),
382
+ className: e([b]),
312
383
  children: [
313
384
  0,
314
385
  1,
315
386
  2
316
387
  ].map((n) => {
317
- let r = t * 3 + n, i = P === o(q, r);
388
+ let r = t * 3 + n, i = P === o(J, r);
318
389
  return /* @__PURE__ */ m("span", {
319
390
  role: "gridcell",
320
391
  "aria-selected": i,
321
- className: e([S]),
392
+ className: e([x]),
322
393
  children: /* @__PURE__ */ m("button", {
323
394
  type: "button",
324
395
  "data-haze-month": r,
325
- disabled: Ye(q, r),
326
- onClick: () => Qe(o(q, r)),
327
- className: e([C, i && w]),
328
- children: Ie[r]
396
+ disabled: it(J, r),
397
+ onClick: () => st(o(J, r)),
398
+ className: e([S, i && C]),
399
+ children: Be[r]
329
400
  })
330
401
  }, r);
331
402
  })
@@ -334,28 +405,28 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
334
405
  ref: V,
335
406
  role: "grid",
336
407
  "aria-label": F.selectQuarter,
337
- onKeyDown: We,
338
- className: e([ge]),
408
+ onKeyDown: $e,
409
+ className: e([ve]),
339
410
  children: m("div", {
340
411
  role: "row",
341
- className: e([x]),
412
+ className: e([b]),
342
413
  children: [
343
414
  1,
344
415
  2,
345
416
  3,
346
417
  4
347
418
  ].map((t) => {
348
- let n = P === s(q, t);
419
+ let n = P === s(J, t);
349
420
  return /* @__PURE__ */ m("span", {
350
421
  role: "gridcell",
351
422
  "aria-selected": n,
352
- className: e([S]),
423
+ className: e([x]),
353
424
  children: /* @__PURE__ */ h("button", {
354
425
  type: "button",
355
426
  "data-haze-quarter": t,
356
- disabled: Xe(q, t),
357
- onClick: () => Qe(s(q, t)),
358
- className: e([C, n && w]),
427
+ disabled: at(J, t),
428
+ onClick: () => st(s(J, t)),
429
+ className: e([S, n && C]),
359
430
  children: ["Q", t]
360
431
  })
361
432
  }, t);
@@ -365,8 +436,8 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
365
436
  ref: V,
366
437
  role: "grid",
367
438
  "aria-label": F.selectYear,
368
- onKeyDown: We,
369
- className: e([T]),
439
+ onKeyDown: $e,
440
+ className: e([w]),
370
441
  children: [
371
442
  0,
372
443
  1,
@@ -374,7 +445,7 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
374
445
  3
375
446
  ].map((t) => /* @__PURE__ */ m("div", {
376
447
  role: "row",
377
- className: e([x]),
448
+ className: e([b]),
378
449
  children: [
379
450
  0,
380
451
  1,
@@ -384,13 +455,13 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
384
455
  return /* @__PURE__ */ m("span", {
385
456
  role: "gridcell",
386
457
  "aria-selected": a,
387
- className: e([S]),
458
+ className: e([x]),
388
459
  children: /* @__PURE__ */ m("button", {
389
460
  type: "button",
390
461
  "data-haze-year": i,
391
- disabled: Ze(i),
392
- onClick: () => Qe(c(i)),
393
- className: e([C, a && w]),
462
+ disabled: ot(i),
463
+ onClick: () => st(c(i)),
464
+ className: e([S, a && C]),
394
465
  children: i
395
466
  })
396
467
  }, i);
@@ -399,34 +470,34 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
399
470
  });
400
471
  return /* @__PURE__ */ h("div", {
401
472
  ref: L,
402
- ...Ee,
403
- className: e([ne, Te]),
473
+ ...De,
474
+ className: e([ie, Ee]),
404
475
  children: [/* @__PURE__ */ h("div", {
405
- className: e([re]),
476
+ className: e([ae]),
406
477
  children: [
407
478
  /* @__PURE__ */ m("button", {
408
479
  type: "button",
409
- onClick: () => $(-1),
480
+ onClick: () => Qe(-1),
410
481
  "aria-label": r,
411
- className: e([y]),
482
+ className: e([v]),
412
483
  children: "‹"
413
484
  }),
414
485
  /* @__PURE__ */ m("span", {
415
- className: e([b]),
486
+ className: e([y]),
416
487
  children: a
417
488
  }),
418
489
  /* @__PURE__ */ h("span", {
419
- className: e([ae]),
490
+ className: e([se]),
420
491
  children: [/* @__PURE__ */ m("button", {
421
492
  type: "button",
422
- onClick: qe,
423
- className: e([y]),
493
+ onClick: nt,
494
+ className: e([v]),
424
495
  children: F.today
425
496
  }), /* @__PURE__ */ m("button", {
426
497
  type: "button",
427
- onClick: () => $(1),
498
+ onClick: () => Qe(1),
428
499
  "aria-label": i,
429
- className: e([y]),
500
+ className: e([v]),
430
501
  children: "›"
431
502
  })]
432
503
  })
@@ -436,64 +507,64 @@ function O({ picker: t = "date", value: _e, min: D, max: O, disabledDate: k, loc
436
507
  }
437
508
  return /* @__PURE__ */ h("div", {
438
509
  ref: L,
439
- ...Ee,
440
- className: e([ne, Te]),
510
+ ...De,
511
+ className: e([ie, Ee]),
441
512
  children: [/* @__PURE__ */ h("div", {
442
- className: e([re]),
513
+ className: e([ae]),
443
514
  children: [
444
515
  /* @__PURE__ */ m("button", {
445
516
  type: "button",
446
- onClick: Ge,
517
+ onClick: et,
447
518
  "aria-label": F.previousMonth,
448
- className: e([y]),
519
+ className: e([v]),
449
520
  children: "‹"
450
521
  }),
451
522
  /* @__PURE__ */ m("button", {
452
- ref: ke,
523
+ ref: Ae,
453
524
  type: "button",
454
525
  "aria-expanded": U,
455
- onClick: U ? Re : Le,
456
- className: e([ie, b]),
457
- children: rt
526
+ onClick: U ? He : Ve,
527
+ className: e([oe, y]),
528
+ children: ft
458
529
  }),
459
530
  /* @__PURE__ */ h("span", {
460
- className: e([ae]),
531
+ className: e([se]),
461
532
  children: [/* @__PURE__ */ m("button", {
462
533
  type: "button",
463
- onClick: qe,
464
- className: e([y]),
534
+ onClick: nt,
535
+ className: e([v]),
465
536
  children: F.today
466
537
  }), /* @__PURE__ */ m("button", {
467
538
  type: "button",
468
- onClick: Ke,
539
+ onClick: tt,
469
540
  "aria-label": F.nextMonth,
470
- className: e([y]),
541
+ className: e([v]),
471
542
  children: "›"
472
543
  })]
473
544
  })
474
545
  ]
475
- }), U ? at : Ce === 2 ? /* @__PURE__ */ h("div", {
476
- className: e([de]),
546
+ }), U ? pt : we === 2 ? /* @__PURE__ */ h("div", {
547
+ className: e([pe]),
477
548
  children: [/* @__PURE__ */ m("div", {
478
- className: e([fe]),
479
- children: it({
480
- year: q,
549
+ className: e([me]),
550
+ children: $({
551
+ year: J,
481
552
  month: Y
482
- }, I, Be)
553
+ }, I, qe)
483
554
  }), /* @__PURE__ */ h("div", {
484
- className: e([fe]),
555
+ className: e([me]),
485
556
  children: [/* @__PURE__ */ m("div", {
486
- className: e([pe]),
557
+ className: e([he]),
487
558
  children: /* @__PURE__ */ m("span", {
488
- className: e([b]),
489
- children: X.format(new Date(Q.year, Q.month))
559
+ className: e([y]),
560
+ children: Re.format(new Date(Q.year, Q.month))
490
561
  })
491
- }), it(Q, Oe, Ve)]
562
+ }), $(Q, ke, Je)]
492
563
  })]
493
- }) : it({
494
- year: q,
564
+ }) : $({
565
+ year: J,
495
566
  month: Y
496
- }, I, Be)]
567
+ }, I, qe)]
497
568
  });
498
569
  }
499
570
  //#endregion