@stackone/malachite 2.136.0 → 2.137.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.
- package/COMPONENTS.md +2 -2
- package/dist/components/DatePicker.js +24 -22
- package/dist/components/DatePicker.js.map +1 -1
- package/dist/components/DatePickerField.js +151 -146
- package/dist/components/DatePickerField.js.map +1 -1
- package/dist/components/DatePickerPanel.js +190 -179
- package/dist/components/DatePickerPanel.js.map +1 -1
- package/dist/components/DateRangePicker.js +31 -29
- package/dist/components/DateRangePicker.js.map +1 -1
- package/dist/components/TimeBarChart/TimeBarChart.js +120 -118
- package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -1
- package/dist/components/TimeBarChart/TimeBarChartTable.js +14 -13
- package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -1
- package/dist/components/TimeBarChart/timeBuckets.js +91 -87
- package/dist/components/TimeBarChart/timeBuckets.js.map +1 -1
- package/dist/components/Tooltip.js +80 -80
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,203 +1,205 @@
|
|
|
1
|
-
import { jsxs as b, jsx as
|
|
2
|
-
import { useId as
|
|
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
|
|
6
|
-
import
|
|
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
|
|
10
|
-
import {
|
|
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
|
-
|
|
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(
|
|
17
|
+
return D(n, -1);
|
|
16
18
|
case "ArrowRight":
|
|
17
|
-
return D(
|
|
19
|
+
return D(n, 1);
|
|
18
20
|
case "ArrowUp":
|
|
19
|
-
return D(
|
|
21
|
+
return D(n, -7);
|
|
20
22
|
case "ArrowDown":
|
|
21
|
-
return D(
|
|
23
|
+
return D(n, 7);
|
|
22
24
|
case "Home":
|
|
23
|
-
return j(
|
|
25
|
+
return j(n, a);
|
|
24
26
|
case "End":
|
|
25
|
-
return D(j(
|
|
27
|
+
return D(j(n, a), 6);
|
|
26
28
|
case "PageUp":
|
|
27
|
-
return U(
|
|
29
|
+
return U(n, t ? -12 : -1);
|
|
28
30
|
case "PageDown":
|
|
29
|
-
return U(
|
|
31
|
+
return U(n, t ? 12 : 1);
|
|
30
32
|
default:
|
|
31
33
|
return null;
|
|
32
34
|
}
|
|
33
|
-
},
|
|
34
|
-
const
|
|
35
|
-
for (let
|
|
36
|
-
for (const
|
|
37
|
-
if (
|
|
38
|
-
return { ...e, day:
|
|
39
|
-
return { ...e, day:
|
|
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:
|
|
43
|
-
onViewChange:
|
|
44
|
-
focusDay:
|
|
45
|
-
onFocusDayChange:
|
|
46
|
-
isDayDisabled:
|
|
47
|
-
isMonthReachable:
|
|
44
|
+
labelId: t,
|
|
45
|
+
onViewChange: n,
|
|
46
|
+
focusDay: a,
|
|
47
|
+
onFocusDayChange: f,
|
|
48
|
+
isDayDisabled: o,
|
|
49
|
+
isMonthReachable: c
|
|
48
50
|
}) => {
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
return { target:
|
|
52
|
-
}, y =
|
|
53
|
-
|
|
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__ */
|
|
59
|
+
/* @__PURE__ */ r(
|
|
58
60
|
"button",
|
|
59
61
|
{
|
|
60
62
|
type: "button",
|
|
61
63
|
"aria-label": "Previous year",
|
|
62
|
-
className: `${
|
|
64
|
+
className: `${T} ${v}`,
|
|
63
65
|
"aria-disabled": p.disabled || void 0,
|
|
64
66
|
onClick: () => u(p),
|
|
65
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ r(ne, { size: 14 })
|
|
66
68
|
}
|
|
67
69
|
),
|
|
68
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ r(
|
|
69
71
|
"button",
|
|
70
72
|
{
|
|
71
73
|
type: "button",
|
|
72
74
|
"aria-label": "Previous month",
|
|
73
|
-
className: `${
|
|
75
|
+
className: `${T} ${v}`,
|
|
74
76
|
"aria-disabled": y.disabled || void 0,
|
|
75
77
|
onClick: () => u(y),
|
|
76
|
-
children: /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ r(ae, { size: 14 })
|
|
77
79
|
}
|
|
78
80
|
)
|
|
79
81
|
] }),
|
|
80
|
-
/* @__PURE__ */
|
|
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__ */
|
|
84
|
+
/* @__PURE__ */ r(
|
|
83
85
|
"button",
|
|
84
86
|
{
|
|
85
87
|
type: "button",
|
|
86
88
|
"aria-label": "Next month",
|
|
87
|
-
className: `${
|
|
89
|
+
className: `${T} ${v}`,
|
|
88
90
|
"aria-disabled": N.disabled || void 0,
|
|
89
91
|
onClick: () => u(N),
|
|
90
|
-
children: /* @__PURE__ */
|
|
92
|
+
children: /* @__PURE__ */ r(le, { size: 14 })
|
|
91
93
|
}
|
|
92
94
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ r(
|
|
94
96
|
"button",
|
|
95
97
|
{
|
|
96
98
|
type: "button",
|
|
97
99
|
"aria-label": "Next year",
|
|
98
|
-
className: `${
|
|
100
|
+
className: `${T} ${v}`,
|
|
99
101
|
"aria-disabled": l.disabled || void 0,
|
|
100
102
|
onClick: () => u(l),
|
|
101
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ r(re, { size: 14 })
|
|
102
104
|
}
|
|
103
105
|
)
|
|
104
106
|
] })
|
|
105
107
|
] });
|
|
106
|
-
},
|
|
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:
|
|
109
|
-
weekStart:
|
|
110
|
-
view:
|
|
111
|
-
onViewChange:
|
|
112
|
-
focusDay:
|
|
113
|
-
onFocusDayChange:
|
|
114
|
-
draft:
|
|
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:
|
|
122
|
+
labelId: d
|
|
121
123
|
}) => {
|
|
122
|
-
const
|
|
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 =
|
|
126
|
-
}, [
|
|
127
|
-
const
|
|
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(
|
|
131
|
+
m.preventDefault(), p(I) || l(I);
|
|
130
132
|
return;
|
|
131
133
|
}
|
|
132
|
-
const s =
|
|
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 !==
|
|
137
|
-
w && !N(s) || (w &&
|
|
138
|
-
}, W =
|
|
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:
|
|
144
|
+
ref: i,
|
|
143
145
|
role: "grid",
|
|
144
|
-
"aria-labelledby":
|
|
146
|
+
"aria-labelledby": d,
|
|
145
147
|
"aria-multiselectable": e === "range" || void 0,
|
|
146
148
|
className: "flex w-[276px] flex-col",
|
|
147
|
-
onKeyDown:
|
|
149
|
+
onKeyDown: Y,
|
|
148
150
|
children: [
|
|
149
|
-
/* @__PURE__ */
|
|
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 ${
|
|
156
|
+
className: `flex h-6 items-center justify-center ${M}`,
|
|
155
157
|
children: m.short
|
|
156
158
|
},
|
|
157
159
|
m.short
|
|
158
160
|
)) }),
|
|
159
|
-
|
|
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 =
|
|
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__ */
|
|
174
|
+
E && /* @__PURE__ */ r(
|
|
173
175
|
"span",
|
|
174
176
|
{
|
|
175
177
|
"aria-hidden": "true",
|
|
176
|
-
className: `${
|
|
178
|
+
className: `${Ne} ${ge[E]}`
|
|
177
179
|
}
|
|
178
180
|
),
|
|
179
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ r(
|
|
180
182
|
"button",
|
|
181
183
|
{
|
|
182
|
-
ref:
|
|
183
|
-
u.current =
|
|
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:
|
|
190
|
-
"aria-label":
|
|
191
|
-
"aria-current":
|
|
192
|
-
"aria-disabled":
|
|
193
|
-
className: `${
|
|
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:
|
|
196
|
-
outside:
|
|
197
|
-
disabled:
|
|
197
|
+
today: V,
|
|
198
|
+
outside: Z,
|
|
199
|
+
disabled: $
|
|
198
200
|
})}`,
|
|
199
201
|
onClick: () => {
|
|
200
|
-
|
|
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
|
-
|
|
213
|
+
_(m[0])
|
|
212
214
|
))
|
|
213
215
|
]
|
|
214
216
|
}
|
|
215
217
|
);
|
|
216
|
-
},
|
|
217
|
-
const
|
|
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
|
-
|
|
220
|
-
}, [
|
|
221
|
-
const
|
|
221
|
+
o.current && c >= 0 && (o.current.scrollTop = c * De);
|
|
222
|
+
}, [c]);
|
|
223
|
+
const h = Math.max(
|
|
222
224
|
0,
|
|
223
|
-
|
|
224
|
-
), y = (l) => l === (
|
|
225
|
-
var
|
|
226
|
-
const
|
|
227
|
-
|
|
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__ */
|
|
231
|
+
return /* @__PURE__ */ r(
|
|
230
232
|
"div",
|
|
231
233
|
{
|
|
232
|
-
ref:
|
|
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:
|
|
238
|
+
style: { height: Ie },
|
|
237
239
|
onKeyDown: (l) => {
|
|
238
|
-
const u =
|
|
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
|
|
245
|
-
if (l.key in
|
|
246
|
-
|
|
247
|
-
const g = Math.sign(
|
|
248
|
-
for (;
|
|
249
|
-
|
|
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
|
-
|
|
253
|
+
i = t.findIndex((g) => !a(g));
|
|
252
254
|
else if (l.key === "End")
|
|
253
|
-
for (
|
|
254
|
-
|
|
255
|
-
|
|
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:
|
|
258
|
-
const
|
|
259
|
-
return /* @__PURE__ */
|
|
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":
|
|
266
|
-
"aria-disabled":
|
|
267
|
+
"aria-selected": i,
|
|
268
|
+
"aria-disabled": d || void 0,
|
|
267
269
|
tabIndex: y(u),
|
|
268
|
-
className: `${
|
|
269
|
-
selected:
|
|
270
|
+
className: `${z(d)} ${F({
|
|
271
|
+
selected: i,
|
|
270
272
|
today: !1,
|
|
271
273
|
outside: !1,
|
|
272
|
-
disabled:
|
|
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
|
-
},
|
|
283
|
+
}, Ae = ({
|
|
282
284
|
mode: e,
|
|
283
|
-
zone:
|
|
284
|
-
precision:
|
|
285
|
-
minuteStep:
|
|
286
|
-
draft:
|
|
287
|
-
active:
|
|
288
|
-
onActiveChange:
|
|
289
|
-
isTimeDisabled:
|
|
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" ?
|
|
293
|
-
{ unit: "hours", label: "Hours", values:
|
|
294
|
-
{ unit: "minutes", label: "Minutes", values:
|
|
295
|
-
...
|
|
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__ */
|
|
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:
|
|
304
|
-
onChange:
|
|
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__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
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__ */
|
|
318
|
-
|
|
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: (
|
|
324
|
-
onPick: (
|
|
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
|
-
},
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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__ */
|
|
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
|
-
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
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__ */
|
|
374
|
+
/* @__PURE__ */ r(
|
|
364
375
|
Ce,
|
|
365
376
|
{
|
|
366
377
|
view: e.view,
|
|
367
|
-
labelId:
|
|
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__ */
|
|
376
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ r("div", { className: L }),
|
|
387
|
+
/* @__PURE__ */ r(Ee, { ...e, labelId: t })
|
|
377
388
|
] }),
|
|
378
|
-
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
389
|
+
f !== "day" && /* @__PURE__ */ b(S, { children: [
|
|
390
|
+
/* @__PURE__ */ r("div", { className: B }),
|
|
391
|
+
/* @__PURE__ */ r(Ae, { ...e })
|
|
381
392
|
] })
|
|
382
393
|
] }),
|
|
383
|
-
/* @__PURE__ */
|
|
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__ */
|
|
400
|
+
/* @__PURE__ */ r(
|
|
390
401
|
"button",
|
|
391
402
|
{
|
|
392
403
|
type: "button",
|
|
393
|
-
className: `${
|
|
394
|
-
disabled:
|
|
395
|
-
onClick:
|
|
396
|
-
children:
|
|
404
|
+
className: `${be} ${ye} ${v}`,
|
|
405
|
+
disabled: c,
|
|
406
|
+
onClick: h,
|
|
407
|
+
children: o
|
|
397
408
|
}
|
|
398
409
|
),
|
|
399
|
-
y && /* @__PURE__ */
|
|
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
|
-
|
|
426
|
+
We as default
|
|
416
427
|
};
|
|
417
428
|
//# sourceMappingURL=DatePickerPanel.js.map
|