@stackone/malachite 2.136.0 → 2.138.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.
@@ -1,203 +1,205 @@
1
- import { jsxs as b, jsx as n, Fragment as H } from "react/jsx-runtime";
2
- import { useId as J, useRef as M, useEffect as Q, useLayoutEffect as ee } from "react";
1
+ import { jsxs as b, jsx as r, Fragment as S } from "react/jsx-runtime";
2
+ import { useId as G, useRef as R, useEffect as Q, useLayoutEffect as ee } from "react";
3
3
  import { Button as te } from "./Button.js";
4
4
  import ne from "./CustomIcons/CaretDoubleLeftIcon.js";
5
- import ae from "./CustomIcons/CaretDoubleRightIcon.js";
6
- import re from "./CustomIcons/CaretLeftIcon.js";
5
+ import re from "./CustomIcons/CaretDoubleRightIcon.js";
6
+ import ae from "./CustomIcons/CaretLeftIcon.js";
7
7
  import le from "./CustomIcons/CaretRightIcon.js";
8
8
  import { SegmentedControl as se } from "./SegmentedControl.js";
9
- import { monthLabel as oe, monthWeeks as ie, dayKeyOf as K, sameDay as x, dayKeyString as A, weekdayLabels as ce, spokenDay as de, partsOf as ue, formatTimeReadout as me, addMonths as fe, compareDays as _, daysInMonth as he, addMonthsToDay as U, addDays as D, startOfWeek as j } from "./dateMath.js";
10
- import { DIVIDER_V as B, DIVIDER_H as P, LINK_BUTTON as pe, LINK_HOVER as be, PRESET_BUTTON as ye, PRESET_HOVER as Ne, NAV_BUTTON as I, HEADING_TEXT as S, RANGE_BAND as ge, RANGE_BAND_SPAN as xe, CELL_CLASS as G, dayToneClass as z } from "./datePickerStyles.js";
9
+ import oe from "./Tooltip.js";
10
+ import { monthLabel as ie, monthWeeks as ce, dayKeyOf as K, sameDay as x, dayKeyString as _, weekdayLabels as de, spokenDay as ue, partsOf as me, formatTimeReadout as fe, addMonths as he, compareDays as A, daysInMonth as pe, addMonthsToDay as U, addDays as D, startOfWeek as j } from "./dateMath.js";
11
+ import { DIVIDER_V as B, DIVIDER_H as L, LINK_BUTTON as be, LINK_HOVER as ye, NAV_BUTTON as T, HEADING_TEXT as M, RANGE_BAND as Ne, RANGE_BAND_SPAN as ge, CELL_CLASS as z, dayToneClass as F, PRESET_BUTTON as xe, PRESET_HOVER as ve } from "./datePickerStyles.js";
11
12
  import { FOCUS_RING as v } from "./focusRing.js";
12
- const ve = 40, we = 240, R = (e, a = 1) => Array.from({ length: Math.ceil(e / a) }, (t, r) => r * a), De = (e, a, t, r) => {
13
+ import { VISUALLY_HIDDEN_STYLE as we } from "./visuallyHiddenStyle.js";
14
+ const De = 40, Ie = 240, P = (e, t = 1) => Array.from({ length: Math.ceil(e / t) }, (n, a) => a * t), $e = (e, t, n, a) => {
13
15
  switch (e) {
14
16
  case "ArrowLeft":
15
- return D(t, -1);
17
+ return D(n, -1);
16
18
  case "ArrowRight":
17
- return D(t, 1);
19
+ return D(n, 1);
18
20
  case "ArrowUp":
19
- return D(t, -7);
21
+ return D(n, -7);
20
22
  case "ArrowDown":
21
- return D(t, 7);
23
+ return D(n, 7);
22
24
  case "Home":
23
- return j(t, r);
25
+ return j(n, a);
24
26
  case "End":
25
- return D(j(t, r), 6);
27
+ return D(j(n, a), 6);
26
28
  case "PageUp":
27
- return U(t, a ? -12 : -1);
29
+ return U(n, t ? -12 : -1);
28
30
  case "PageDown":
29
- return U(t, a ? 12 : 1);
31
+ return U(n, t ? 12 : 1);
30
32
  default:
31
33
  return null;
32
34
  }
33
- }, $e = (e, a, t) => {
34
- const r = he(e), h = Math.min(a, r);
35
- for (let c = 0; c < r; c++)
36
- for (const d of [h - c, h + c])
37
- if (d >= 1 && d <= r && !t({ ...e, day: d }))
38
- return { ...e, day: d };
39
- return { ...e, day: h };
35
+ }, Te = (e, t, n) => {
36
+ const a = pe(e), f = Math.min(t, a);
37
+ for (let o = 0; o < a; o++)
38
+ for (const c of [f - o, f + o])
39
+ if (c >= 1 && c <= a && !n({ ...e, day: c }))
40
+ return { ...e, day: c };
41
+ return { ...e, day: f };
40
42
  }, Ce = ({
41
43
  view: e,
42
- labelId: a,
43
- onViewChange: t,
44
- focusDay: r,
45
- onFocusDayChange: h,
46
- isDayDisabled: c,
47
- isMonthReachable: d
44
+ labelId: t,
45
+ onViewChange: n,
46
+ focusDay: a,
47
+ onFocusDayChange: f,
48
+ isDayDisabled: o,
49
+ isMonthReachable: c
48
50
  }) => {
49
- const f = (i) => {
50
- const o = fe(e, i);
51
- return { target: o, disabled: !d(o) };
52
- }, y = f(-1), p = f(-12), N = f(1), l = f(12), u = ({ target: i, disabled: o }) => {
53
- o || (t(i), h($e(i, r.day, c)));
51
+ const h = (d) => {
52
+ const i = he(e, d);
53
+ return { target: i, disabled: !c(i) };
54
+ }, y = h(-1), p = h(-12), N = h(1), l = h(12), u = ({ target: d, disabled: i }) => {
55
+ i || (n(d), f(Te(d, a.day, o)));
54
56
  };
55
57
  return /* @__PURE__ */ b("div", { className: "flex items-center justify-between p-2", children: [
56
58
  /* @__PURE__ */ b("div", { className: "flex items-center gap-0.5", children: [
57
- /* @__PURE__ */ n(
59
+ /* @__PURE__ */ r(
58
60
  "button",
59
61
  {
60
62
  type: "button",
61
63
  "aria-label": "Previous year",
62
- className: `${I} ${v}`,
64
+ className: `${T} ${v}`,
63
65
  "aria-disabled": p.disabled || void 0,
64
66
  onClick: () => u(p),
65
- children: /* @__PURE__ */ n(ne, { size: 14 })
67
+ children: /* @__PURE__ */ r(ne, { size: 14 })
66
68
  }
67
69
  ),
68
- /* @__PURE__ */ n(
70
+ /* @__PURE__ */ r(
69
71
  "button",
70
72
  {
71
73
  type: "button",
72
74
  "aria-label": "Previous month",
73
- className: `${I} ${v}`,
75
+ className: `${T} ${v}`,
74
76
  "aria-disabled": y.disabled || void 0,
75
77
  onClick: () => u(y),
76
- children: /* @__PURE__ */ n(re, { size: 14 })
78
+ children: /* @__PURE__ */ r(ae, { size: 14 })
77
79
  }
78
80
  )
79
81
  ] }),
80
- /* @__PURE__ */ n("span", { id: a, "aria-live": "polite", className: S, children: oe(e) }),
82
+ /* @__PURE__ */ r("span", { id: t, "aria-live": "polite", className: M, children: ie(e) }),
81
83
  /* @__PURE__ */ b("div", { className: "flex items-center gap-0.5", children: [
82
- /* @__PURE__ */ n(
84
+ /* @__PURE__ */ r(
83
85
  "button",
84
86
  {
85
87
  type: "button",
86
88
  "aria-label": "Next month",
87
- className: `${I} ${v}`,
89
+ className: `${T} ${v}`,
88
90
  "aria-disabled": N.disabled || void 0,
89
91
  onClick: () => u(N),
90
- children: /* @__PURE__ */ n(le, { size: 14 })
92
+ children: /* @__PURE__ */ r(le, { size: 14 })
91
93
  }
92
94
  ),
93
- /* @__PURE__ */ n(
95
+ /* @__PURE__ */ r(
94
96
  "button",
95
97
  {
96
98
  type: "button",
97
99
  "aria-label": "Next year",
98
- className: `${I} ${v}`,
100
+ className: `${T} ${v}`,
99
101
  "aria-disabled": l.disabled || void 0,
100
102
  onClick: () => u(l),
101
- children: /* @__PURE__ */ n(ae, { size: 14 })
103
+ children: /* @__PURE__ */ r(re, { size: 14 })
102
104
  }
103
105
  )
104
106
  ] })
105
107
  ] });
106
- }, Ie = (e, a, t) => !a || !t || _(a, t) === 0 ? null : x(e, a) ? "start" : x(e, t) ? "end" : _(e, a) > 0 && _(e, t) < 0 ? "middle" : null, ke = ({
108
+ }, ke = (e, t, n) => !t || !n || A(t, n) === 0 ? null : x(e, t) ? "start" : x(e, n) ? "end" : A(e, t) > 0 && A(e, n) < 0 ? "middle" : null, Ee = ({
107
109
  mode: e,
108
- zone: a,
109
- weekStart: t,
110
- view: r,
111
- onViewChange: h,
112
- focusDay: c,
113
- onFocusDayChange: d,
114
- draft: f,
110
+ zone: t,
111
+ weekStart: n,
112
+ view: a,
113
+ onViewChange: f,
114
+ focusDay: o,
115
+ onFocusDayChange: c,
116
+ draft: h,
115
117
  today: y,
116
118
  isDayDisabled: p,
117
119
  isMonthReachable: N,
118
120
  onPickDay: l,
119
121
  initialFocusRef: u,
120
- labelId: i
122
+ labelId: d
121
123
  }) => {
122
- const o = M(null), g = M(!1), L = ie(r, t), k = f.start ? K(f.start, a) : null, T = e === "range" && f.end ? K(f.end, a) : null, $ = L.some((m) => m.some((s) => x(s, c))) ? c : { ...r, day: 1 };
124
+ const i = R(null), g = R(!1), O = ce(a, n), C = h.start ? K(h.start, t) : null, k = e === "range" && h.end ? K(h.end, t) : null, I = O.some((m) => m.some((s) => x(s, o))) ? o : { ...a, day: 1 };
123
125
  Q(() => {
124
126
  var m, s;
125
- g.current && (g.current = !1, (s = (m = o.current) == null ? void 0 : m.querySelector(`[data-day="${A(c)}"]`)) == null || s.focus({ preventScroll: !0 }));
126
- }, [c]);
127
- const F = (m) => {
127
+ g.current && (g.current = !1, (s = (m = i.current) == null ? void 0 : m.querySelector(`[data-day="${_(o)}"]`)) == null || s.focus({ preventScroll: !0 }));
128
+ }, [o]);
129
+ const Y = (m) => {
128
130
  if (m.key === "Enter" || m.key === " ") {
129
- m.preventDefault(), p($) || l($);
131
+ m.preventDefault(), p(I) || l(I);
130
132
  return;
131
133
  }
132
- const s = De(m.key, m.shiftKey, $, t);
134
+ const s = $e(m.key, m.shiftKey, I, n);
133
135
  if (!s)
134
136
  return;
135
137
  m.preventDefault();
136
- const w = s.month !== r.month || s.year !== r.year;
137
- w && !N(s) || (w && h({ year: s.year, month: s.month }), g.current = !0, d(s));
138
- }, W = ce(t);
138
+ const w = s.month !== a.month || s.year !== a.year;
139
+ w && !N(s) || (w && f({ year: s.year, month: s.month }), g.current = !0, c(s));
140
+ }, W = de(n);
139
141
  return /* @__PURE__ */ b(
140
142
  "div",
141
143
  {
142
- ref: o,
144
+ ref: i,
143
145
  role: "grid",
144
- "aria-labelledby": i,
146
+ "aria-labelledby": d,
145
147
  "aria-multiselectable": e === "range" || void 0,
146
148
  className: "flex w-[276px] flex-col",
147
- onKeyDown: F,
149
+ onKeyDown: Y,
148
150
  children: [
149
- /* @__PURE__ */ n("div", { role: "row", className: "grid grid-cols-7 px-[14px] py-2", children: W.map((m) => /* @__PURE__ */ n(
151
+ /* @__PURE__ */ r("div", { role: "row", className: "grid grid-cols-7 px-[14px] py-2", children: W.map((m) => /* @__PURE__ */ r(
150
152
  "span",
151
153
  {
152
154
  role: "columnheader",
153
155
  "aria-label": m.long,
154
- className: `flex h-6 items-center justify-center ${S}`,
156
+ className: `flex h-6 items-center justify-center ${M}`,
155
157
  children: m.short
156
158
  },
157
159
  m.short
158
160
  )) }),
159
- L.map((m) => /* @__PURE__ */ n(
161
+ O.map((m) => /* @__PURE__ */ r(
160
162
  "div",
161
163
  {
162
164
  role: "row",
163
165
  className: "grid grid-cols-7 px-[14px] py-2",
164
166
  children: m.map((s) => {
165
- const w = A(s), C = p(s), E = e === "range" ? Ie(s, k, T) : null, X = x(s, k) || x(s, T) || E === "middle", q = x(s, k) || x(s, T), O = x(s, y), Y = s.month !== r.month, V = x(s, $);
167
+ const w = _(s), $ = p(s), E = e === "range" ? ke(s, C, k) : null, X = x(s, C) || x(s, k) || E === "middle", q = x(s, C) || x(s, k), V = x(s, y), Z = s.month !== a.month, H = x(s, I);
166
168
  return /* @__PURE__ */ b(
167
169
  "div",
168
170
  {
169
171
  role: "presentation",
170
172
  className: "relative flex h-6 items-center justify-center",
171
173
  children: [
172
- E && /* @__PURE__ */ n(
174
+ E && /* @__PURE__ */ r(
173
175
  "span",
174
176
  {
175
177
  "aria-hidden": "true",
176
- className: `${ge} ${xe[E]}`
178
+ className: `${Ne} ${ge[E]}`
177
179
  }
178
180
  ),
179
- /* @__PURE__ */ n(
181
+ /* @__PURE__ */ r(
180
182
  "button",
181
183
  {
182
- ref: V ? (Z) => {
183
- u.current = Z;
184
+ ref: H ? (J) => {
185
+ u.current = J;
184
186
  } : void 0,
185
187
  type: "button",
186
188
  role: "gridcell",
187
189
  "aria-selected": X,
188
190
  "data-day": w,
189
- tabIndex: V ? 0 : -1,
190
- "aria-label": de(s),
191
- "aria-current": O ? "date" : void 0,
192
- "aria-disabled": C || void 0,
193
- className: `${G(C)} ${z({
191
+ tabIndex: H ? 0 : -1,
192
+ "aria-label": ue(s),
193
+ "aria-current": V ? "date" : void 0,
194
+ "aria-disabled": $ || void 0,
195
+ className: `${z($)} ${F({
194
196
  selected: q,
195
- today: O,
196
- outside: Y,
197
- disabled: C
197
+ today: V,
198
+ outside: Z,
199
+ disabled: $
198
200
  })}`,
199
201
  onClick: () => {
200
- d(s), C || l(s);
202
+ c(s), $ || l(s);
201
203
  },
202
204
  children: s.day
203
205
  }
@@ -208,68 +210,68 @@ const ve = 40, we = 240, R = (e, a = 1) => Array.from({ length: Math.ceil(e / a)
208
210
  );
209
211
  })
210
212
  },
211
- A(m[0])
213
+ _(m[0])
212
214
  ))
213
215
  ]
214
216
  }
215
217
  );
216
- }, Te = ({ label: e, values: a, selected: t, isDisabled: r, onPick: h }) => {
217
- const c = M(null), d = t === null ? -1 : a.filter((l) => l <= t).length - 1;
218
+ }, _e = ({ label: e, values: t, selected: n, isDisabled: a, onPick: f }) => {
219
+ const o = R(null), c = n === null ? -1 : t.filter((l) => l <= n).length - 1;
218
220
  ee(() => {
219
- c.current && d >= 0 && (c.current.scrollTop = d * ve);
220
- }, [d]);
221
- const f = Math.max(
221
+ o.current && c >= 0 && (o.current.scrollTop = c * De);
222
+ }, [c]);
223
+ const h = Math.max(
222
224
  0,
223
- a.findIndex((l) => !r(l))
224
- ), y = (l) => l === (d >= 0 ? d : f) ? 0 : -1, p = (l, u) => {
225
- var o, g;
226
- const i = a[l];
227
- i === void 0 || r(i) || (h(i), u && ((g = (o = c.current) == null ? void 0 : o.querySelector(`[data-value="${i}"]`)) == null || g.focus({ preventScroll: !0 })));
225
+ t.findIndex((l) => !a(l))
226
+ ), y = (l) => l === (c >= 0 ? c : h) ? 0 : -1, p = (l, u) => {
227
+ var i, g;
228
+ const d = t[l];
229
+ d === void 0 || a(d) || (f(d), u && ((g = (i = o.current) == null ? void 0 : i.querySelector(`[data-value="${d}"]`)) == null || g.focus({ preventScroll: !0 })));
228
230
  };
229
- return /* @__PURE__ */ n(
231
+ return /* @__PURE__ */ r(
230
232
  "div",
231
233
  {
232
- ref: c,
234
+ ref: o,
233
235
  role: "listbox",
234
236
  "aria-label": e,
235
237
  className: "flex flex-col items-center overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
236
- style: { height: we },
238
+ style: { height: Ie },
237
239
  onKeyDown: (l) => {
238
- const u = d >= 0 ? d : -1, i = {
240
+ const u = c >= 0 ? c : -1, d = {
239
241
  ArrowDown: 1,
240
242
  ArrowUp: -1,
241
243
  PageDown: 5,
242
244
  PageUp: -5
243
245
  };
244
- let o = null;
245
- if (l.key in i) {
246
- o = u < 0 ? f : u + i[l.key];
247
- const g = Math.sign(i[l.key]);
248
- for (; o >= 0 && o < a.length && r(a[o]); )
249
- o += g;
246
+ let i = null;
247
+ if (l.key in d) {
248
+ i = u < 0 ? h : u + d[l.key];
249
+ const g = Math.sign(d[l.key]);
250
+ for (; i >= 0 && i < t.length && a(t[i]); )
251
+ i += g;
250
252
  } else if (l.key === "Home")
251
- o = a.findIndex((g) => !r(g));
253
+ i = t.findIndex((g) => !a(g));
252
254
  else if (l.key === "End")
253
- for (o = a.length - 1; o >= 0 && r(a[o]); )
254
- o -= 1;
255
- o !== null && (l.preventDefault(), p(o, !0));
255
+ for (i = t.length - 1; i >= 0 && a(t[i]); )
256
+ i -= 1;
257
+ i !== null && (l.preventDefault(), p(i, !0));
256
258
  },
257
- children: a.map((l, u) => {
258
- const i = r(l), o = l === t;
259
- return /* @__PURE__ */ n("div", { className: "flex shrink-0 items-center py-2", children: /* @__PURE__ */ n(
259
+ children: t.map((l, u) => {
260
+ const d = a(l), i = l === n;
261
+ return /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center py-2", children: /* @__PURE__ */ r(
260
262
  "button",
261
263
  {
262
264
  type: "button",
263
265
  role: "option",
264
266
  "data-value": l,
265
- "aria-selected": o,
266
- "aria-disabled": i || void 0,
267
+ "aria-selected": i,
268
+ "aria-disabled": d || void 0,
267
269
  tabIndex: y(u),
268
- className: `${G(i)} ${z({
269
- selected: o,
270
+ className: `${z(d)} ${F({
271
+ selected: i,
270
272
  today: !1,
271
273
  outside: !1,
272
- disabled: i
274
+ disabled: d
273
275
  })}`,
274
276
  onClick: () => p(u, !1),
275
277
  children: String(l).padStart(2, "0")
@@ -278,93 +280,102 @@ const ve = 40, we = 240, R = (e, a = 1) => Array.from({ length: Math.ceil(e / a)
278
280
  })
279
281
  }
280
282
  );
281
- }, Ee = ({
283
+ }, Ae = ({
282
284
  mode: e,
283
- zone: a,
284
- precision: t,
285
- minuteStep: r,
286
- draft: h,
287
- active: c,
288
- onActiveChange: d,
289
- isTimeDisabled: f,
285
+ zone: t,
286
+ precision: n,
287
+ minuteStep: a,
288
+ draft: f,
289
+ active: o,
290
+ onActiveChange: c,
291
+ isTimeDisabled: h,
290
292
  onPickTime: y
291
293
  }) => {
292
- const p = e === "range" ? h[c] : h.start, N = p ? ue(p, a) : null, l = [
293
- { unit: "hours", label: "Hours", values: R(24) },
294
- { unit: "minutes", label: "Minutes", values: R(60, r) },
295
- ...t === "second" ? [{ unit: "seconds", label: "Seconds", values: R(60) }] : []
294
+ const p = e === "range" ? f[o] : f.start, N = p ? me(p, t) : null, l = [
295
+ { unit: "hours", label: "Hours", values: P(24) },
296
+ { unit: "minutes", label: "Minutes", values: P(60, a) },
297
+ ...n === "second" ? [{ unit: "seconds", label: "Seconds", values: P(60) }] : []
296
298
  ];
297
299
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-1", children: [
298
- /* @__PURE__ */ n("div", { className: "flex min-h-8 items-center justify-center p-2", children: e === "range" ? /* @__PURE__ */ n(
300
+ /* @__PURE__ */ r("div", { className: "flex min-h-8 items-center justify-center p-2", children: e === "range" ? /* @__PURE__ */ r(
299
301
  se,
300
302
  {
301
303
  size: "small",
302
304
  "aria-label": "Time for",
303
- value: c,
304
- onChange: d,
305
+ value: o,
306
+ onChange: c,
305
307
  options: [
306
308
  { value: "start", label: "Start" },
307
309
  { value: "end", label: "End" }
308
310
  ]
309
311
  }
310
- ) : /* @__PURE__ */ n("span", { className: `${S} whitespace-nowrap`, children: me(p, a, t) }) }),
311
- /* @__PURE__ */ n("div", { className: P }),
312
- /* @__PURE__ */ n(
312
+ ) : /* @__PURE__ */ r("span", { className: `${M} whitespace-nowrap`, children: fe(p, t, n) }) }),
313
+ /* @__PURE__ */ r("div", { className: L }),
314
+ /* @__PURE__ */ r(
313
315
  "div",
314
316
  {
315
317
  className: "grid px-[14px]",
316
318
  style: { gridTemplateColumns: `repeat(${l.length}, 35.67px)` },
317
- children: l.map((u) => /* @__PURE__ */ n(
318
- Te,
319
+ children: l.map((u) => /* @__PURE__ */ r(
320
+ _e,
319
321
  {
320
322
  label: u.label,
321
323
  values: u.values,
322
324
  selected: N ? N[u.unit] : null,
323
- isDisabled: (i) => f(u.unit, i),
324
- onPick: (i) => y(u.unit, i)
325
+ isDisabled: (d) => h(u.unit, d),
326
+ onPick: (d) => y(u.unit, d)
325
327
  },
326
328
  u.unit
327
329
  ))
328
330
  }
329
331
  )
330
332
  ] });
331
- }, Ae = ({
332
- presets: e,
333
- onPreset: a
334
- }) => /* @__PURE__ */ n("div", { className: "flex w-36 flex-col gap-0.5 p-1", role: "group", "aria-label": "Presets", children: e.map((t, r) => /* @__PURE__ */ n(
335
- "button",
336
- {
337
- type: "button",
338
- className: `${ye} ${Ne} ${v}`,
339
- onClick: () => a(r),
340
- children: t
341
- },
342
- t
343
- )) }), Be = (e) => {
344
- const a = `${J().replace(/[^a-zA-Z0-9_-]/g, "")}-month`, {
345
- presets: t,
346
- onPreset: r,
347
- precision: h,
348
- todayLabel: c,
349
- todayDisabled: d,
350
- onToday: f,
333
+ }, Pe = ({
334
+ label: e,
335
+ disabled: t,
336
+ disabledReason: n,
337
+ onPick: a
338
+ }) => {
339
+ const f = G(), o = t && n ? n : void 0, c = /* @__PURE__ */ r(
340
+ "button",
341
+ {
342
+ type: "button",
343
+ "aria-disabled": t || void 0,
344
+ "aria-describedby": o ? f : void 0,
345
+ className: `${xe} ${t ? "cursor-not-allowed opacity-40" : ve} ${v}`,
346
+ onClick: a,
347
+ children: e
348
+ }
349
+ );
350
+ return o ? /* @__PURE__ */ b(S, { children: [
351
+ /* @__PURE__ */ r(oe, { text: o, placement: "left", describesTrigger: !1, children: c }),
352
+ /* @__PURE__ */ r("span", { id: f, "aria-hidden": !0, style: we, children: o })
353
+ ] }) : c;
354
+ }, Se = ({ presets: e, onPreset: t }) => /* @__PURE__ */ r("div", { className: "flex w-36 flex-col gap-0.5 p-1", role: "group", "aria-label": "Presets", children: e.map((n, a) => /* @__PURE__ */ r(Pe, { ...n, onPick: () => t(a) }, n.label)) }), We = (e) => {
355
+ const t = `${G().replace(/[^a-zA-Z0-9_-]/g, "")}-month`, {
356
+ presets: n,
357
+ onPreset: a,
358
+ precision: f,
359
+ todayLabel: o,
360
+ todayDisabled: c,
361
+ onToday: h,
351
362
  showApply: y,
352
363
  applyDisabled: p,
353
364
  onApply: N
354
365
  } = e;
355
366
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-1 p-1.5", children: [
356
- e.mode === "range" && /* @__PURE__ */ n("span", { className: "sr-only", "aria-live": "polite", children: e.active === "end" && e.draft.start && !e.draft.end ? "Choose the end date" : "" }),
367
+ e.mode === "range" && /* @__PURE__ */ r("span", { className: "sr-only", "aria-live": "polite", children: e.active === "end" && e.draft.start && !e.draft.end ? "Choose the end date" : "" }),
357
368
  /* @__PURE__ */ b("div", { className: "flex", children: [
358
- t && t.length > 0 && /* @__PURE__ */ b(H, { children: [
359
- /* @__PURE__ */ n(Ae, { presets: t, onPreset: r }),
360
- /* @__PURE__ */ n("div", { className: `${B} mx-1` })
369
+ n && n.length > 0 && /* @__PURE__ */ b(S, { children: [
370
+ /* @__PURE__ */ r(Se, { presets: n, onPreset: a }),
371
+ /* @__PURE__ */ r("div", { className: `${B} mx-1` })
361
372
  ] }),
362
373
  /* @__PURE__ */ b("div", { className: "flex flex-col gap-1", children: [
363
- /* @__PURE__ */ n(
374
+ /* @__PURE__ */ r(
364
375
  Ce,
365
376
  {
366
377
  view: e.view,
367
- labelId: a,
378
+ labelId: t,
368
379
  onViewChange: e.onViewChange,
369
380
  focusDay: e.focusDay,
370
381
  onFocusDayChange: e.onFocusDayChange,
@@ -372,31 +383,31 @@ const ve = 40, we = 240, R = (e, a = 1) => Array.from({ length: Math.ceil(e / a)
372
383
  isMonthReachable: e.isMonthReachable
373
384
  }
374
385
  ),
375
- /* @__PURE__ */ n("div", { className: P }),
376
- /* @__PURE__ */ n(ke, { ...e, labelId: a })
386
+ /* @__PURE__ */ r("div", { className: L }),
387
+ /* @__PURE__ */ r(Ee, { ...e, labelId: t })
377
388
  ] }),
378
- h !== "day" && /* @__PURE__ */ b(H, { children: [
379
- /* @__PURE__ */ n("div", { className: B }),
380
- /* @__PURE__ */ n(Ee, { ...e })
389
+ f !== "day" && /* @__PURE__ */ b(S, { children: [
390
+ /* @__PURE__ */ r("div", { className: B }),
391
+ /* @__PURE__ */ r(Ae, { ...e })
381
392
  ] })
382
393
  ] }),
383
- /* @__PURE__ */ n("div", { className: P }),
394
+ /* @__PURE__ */ r("div", { className: L }),
384
395
  /* @__PURE__ */ b(
385
396
  "div",
386
397
  {
387
398
  className: `flex items-center p-2 ${y ? "justify-between" : "justify-center"}`,
388
399
  children: [
389
- /* @__PURE__ */ n(
400
+ /* @__PURE__ */ r(
390
401
  "button",
391
402
  {
392
403
  type: "button",
393
- className: `${pe} ${be} ${v}`,
394
- disabled: d,
395
- onClick: f,
396
- children: c
404
+ className: `${be} ${ye} ${v}`,
405
+ disabled: c,
406
+ onClick: h,
407
+ children: o
397
408
  }
398
409
  ),
399
- y && /* @__PURE__ */ n(
410
+ y && /* @__PURE__ */ r(
400
411
  te,
401
412
  {
402
413
  size: "small",
@@ -412,6 +423,6 @@ const ve = 40, we = 240, R = (e, a = 1) => Array.from({ length: Math.ceil(e / a)
412
423
  ] });
413
424
  };
414
425
  export {
415
- Be as default
426
+ We as default
416
427
  };
417
428
  //# sourceMappingURL=DatePickerPanel.js.map