@mechane-ai/elements 0.45.0 → 0.46.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/README.md +48 -18
- package/bin/mechane-elements-catalog.mjs +42 -4
- package/dist/ai.js +268 -202
- package/dist/catalog.json +91 -31
- package/dist/categorical-values-BXi-rJuv.js +74 -0
- package/dist/chart-cursor-1mFd48Jc.js +23 -0
- package/dist/chart-data-CIJVWCYt.js +21 -0
- package/dist/{chart-frame-Ztktqs1b.js → chart-frame-BaxKn_MB.js} +22 -41
- package/dist/{chart-input-BO3BqlFO.js → chart-input-Bm82_9Rd.js} +2 -2
- package/dist/chart-theme-4zprJ3rW.js +404 -0
- package/dist/charts/cartesian.js +1598 -1432
- package/dist/charts/distribution.js +476 -404
- package/dist/charts/graph.js +363 -349
- package/dist/charts/hierarchy.js +103 -94
- package/dist/charts/matrix.js +340 -333
- package/dist/charts/timeline.js +167 -134
- package/dist/charts.js +3 -3
- package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
- package/dist/collections.js +1648 -1188
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +67 -66
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/csp.js +6 -11
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +274 -214
- package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
- package/dist/forms.js +3 -3
- package/dist/index.js +1 -1
- package/dist/layout.js +207 -207
- package/dist/navigation.js +4 -3
- package/dist/packages/ai/src/conversation.d.ts +2 -0
- package/dist/packages/ai/src/prompt-input.d.ts +7 -2
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/index.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +8 -2
- package/dist/packages/charts/src/cartesian/time-series.d.ts +11 -1
- package/dist/packages/charts/src/categorical-values.d.ts +14 -9
- package/dist/packages/charts/src/chart-frame.d.ts +7 -9
- package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
- package/dist/packages/charts/src/chart-range.d.ts +33 -0
- package/dist/packages/charts/src/chart-rows.d.ts +20 -0
- package/dist/packages/charts/src/chart-theme.d.ts +17 -0
- package/dist/packages/charts/src/chart.d.ts +81 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -4
- package/dist/packages/charts/src/index.d.ts +1 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +3 -3
- package/dist/packages/charts/src/plot-width.d.ts +0 -1
- package/dist/packages/charts/src/timeline/index.d.ts +1 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +6 -2
- package/dist/packages/collections/src/collection-controls.d.ts +5 -1
- package/dist/packages/collections/src/collection-filters.d.ts +4 -1
- package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
- package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
- package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
- package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
- package/dist/packages/collections/src/data-table-text.d.ts +13 -0
- package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
- package/dist/packages/collections/src/data-table.d.ts +3 -85
- package/dist/packages/collections/src/index.d.ts +11 -6
- package/dist/packages/collections/src/query-controls.d.ts +6 -2
- package/dist/packages/collections/src/table-results.d.ts +47 -13
- package/dist/packages/collections/src/timeline.d.ts +1 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
- package/dist/packages/collections/src/use-table-window.d.ts +25 -0
- package/dist/packages/content/src/viewer.d.ts +8 -0
- package/dist/packages/core/src/disclosure.d.ts +9 -1
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/route-link.d.ts +11 -0
- package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
- package/dist/packages/forms/src/file-picker.d.ts +15 -0
- package/dist/packages/forms/src/form-controls.d.ts +1 -6
- package/dist/packages/forms/src/forms.d.ts +4 -1
- package/dist/packages/forms/src/index.d.ts +4 -2
- package/dist/packages/forms/src/selection.d.ts +14 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
- package/dist/packages/navigation/src/index.d.ts +1 -1
- package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
- package/dist/plot-width-v2c_rA20.js +63 -0
- package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
- package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
- package/dist/src-CGc_hjxJ.js +409 -0
- package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
- package/dist/{src-Dcs3SZ9V.js → src-DVHlknB6.js} +1 -1
- package/dist/styles2.css +136 -114
- package/package.json +1 -4
- package/skills/extend-elements/SKILL.md +74 -0
- package/skills/review-elements/SKILL.md +76 -0
- package/skills/upgrade-elements/SKILL.md +34 -0
- package/skills/upgrade-elements/references/releases.md +58 -0
- package/skills/use-elements/SKILL.md +64 -13
- package/skills/use-elements/references/agent.md +57 -0
- package/skills/use-elements/references/charts.md +63 -0
- package/skills/use-elements/references/collections.md +89 -0
- package/skills/use-elements/references/conversations.md +47 -0
- package/skills/use-elements/references/forms.md +81 -0
- package/skills/use-elements/references/styling.md +70 -0
- package/skills/use-elements/references/workspace.md +3 -3
- package/dist/categorical-values-DZLGQVW1.js +0 -63
- package/dist/chart-navigation-BAbb5PV9.js +0 -154
- package/dist/header-styles-COxCYFZx.js +0 -90
- package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
- package/dist/packages/charts/src/chart-surface.d.ts +0 -27
- package/dist/packages/navigation/src/route-link.d.ts +0 -2
- package/dist/plot-width-CIqBiHcd.js +0 -105
- package/dist/src-Bk7M67zy.js +0 -396
package/dist/forms/dates.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as a } from "../src-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
1
|
+
import { r as e } from "../control-styles-D3q_Qyxi.js";
|
|
2
|
+
import { n as t, t as n } from "../forms-CEbwzlRR.js";
|
|
3
|
+
import { D as r, T as i, k as a } from "../src-CpdJlDhO.js";
|
|
4
|
+
import { r as o } from "../src-na2DdkKI.js";
|
|
5
|
+
import * as s from "@stylexjs/stylex";
|
|
6
|
+
import { useEffect as c, useId as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
|
|
7
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
|
+
import { CalendarDays as g, ChevronLeft as _, ChevronRight as v } from "lucide-react";
|
|
9
|
+
import * as y from "@ui-sdk/react/calendar";
|
|
10
|
+
import { DateInput as b, DateInputSegment as x } from "@ui-sdk/react/date-input";
|
|
9
11
|
// packages/forms/src/dates/civil.ts
|
|
10
|
-
var
|
|
12
|
+
var S = {
|
|
11
13
|
maximumYear: 9999,
|
|
12
14
|
monthsPerYear: 12,
|
|
13
15
|
leapCycle: 4,
|
|
@@ -20,12 +22,12 @@ var y = {
|
|
|
20
22
|
yearDigits: 4,
|
|
21
23
|
componentDigits: 2
|
|
22
24
|
};
|
|
23
|
-
function
|
|
24
|
-
return Number.isInteger(e.year) && e.year >= 1 && e.year <=
|
|
25
|
+
function C(e) {
|
|
26
|
+
return Number.isInteger(e.year) && e.year >= 1 && e.year <= S.maximumYear ? Number.isInteger(e.month) && e.month >= 1 && e.month <= S.monthsPerYear : !1;
|
|
25
27
|
}
|
|
26
|
-
function
|
|
27
|
-
if (!
|
|
28
|
-
let t = e.year %
|
|
28
|
+
function w(e) {
|
|
29
|
+
if (!C(e) || !Number.isInteger(e.day) || e.day < 1) return !1;
|
|
30
|
+
let t = e.year % S.leapCycle === 0 && (e.year % S.century !== 0 || e.year % S.leapCentury === 0) ? S.leapFebruaryDays : S.februaryDays, { longMonthDays: n, shortMonthDays: r } = S, i = [
|
|
29
31
|
n,
|
|
30
32
|
t,
|
|
31
33
|
n,
|
|
@@ -41,80 +43,80 @@ function x(e) {
|
|
|
41
43
|
];
|
|
42
44
|
return e.day <= (i[e.month - 1] ?? 0);
|
|
43
45
|
}
|
|
44
|
-
function
|
|
45
|
-
return e.year *
|
|
46
|
+
function T(e) {
|
|
47
|
+
return e.year * S.monthsPerYear + e.month;
|
|
46
48
|
}
|
|
47
|
-
function
|
|
48
|
-
if (!
|
|
49
|
-
return `${
|
|
49
|
+
function E(e) {
|
|
50
|
+
if (!w(e)) throw RangeError("Cannot serialize an invalid calendar date.");
|
|
51
|
+
return `${D(e)}-${String(e.day).padStart(S.componentDigits, "0")}`;
|
|
50
52
|
}
|
|
51
|
-
function
|
|
52
|
-
if (!
|
|
53
|
-
return `${String(e.year).padStart(
|
|
53
|
+
function D(e) {
|
|
54
|
+
if (!C(e)) throw RangeError("Cannot serialize an invalid calendar month.");
|
|
55
|
+
return `${String(e.year).padStart(S.yearDigits, "0")}-${String(e.month).padStart(S.componentDigits, "0")}`;
|
|
54
56
|
}
|
|
55
|
-
function
|
|
57
|
+
function O(e) {
|
|
56
58
|
let [t = 0, n = 0, r = 0] = e.split("-").map(Number), i = {
|
|
57
59
|
year: t,
|
|
58
60
|
month: n,
|
|
59
61
|
day: r
|
|
60
62
|
};
|
|
61
|
-
return
|
|
63
|
+
return w(i) && E(i) === e ? i : void 0;
|
|
62
64
|
}
|
|
63
|
-
function
|
|
65
|
+
function k(e) {
|
|
64
66
|
let [t = 0, n = 0] = e.split("-").map(Number), r = {
|
|
65
67
|
year: t,
|
|
66
68
|
month: n
|
|
67
69
|
};
|
|
68
|
-
return
|
|
70
|
+
return C(r) && D(r) === e ? r : void 0;
|
|
69
71
|
}
|
|
70
|
-
function
|
|
71
|
-
if (!
|
|
72
|
-
let n = /* @__PURE__ */ new Date(`${
|
|
72
|
+
function A(e, t) {
|
|
73
|
+
if (!w(e) || !Number.isInteger(t)) throw RangeError("Calendar-day arithmetic requires a valid date and integer offset.");
|
|
74
|
+
let n = /* @__PURE__ */ new Date(`${E(e)}T00:00:00Z`);
|
|
73
75
|
n.setUTCDate(n.getUTCDate() + t);
|
|
74
76
|
let r = {
|
|
75
77
|
year: n.getUTCFullYear(),
|
|
76
78
|
month: n.getUTCMonth() + 1,
|
|
77
79
|
day: n.getUTCDate()
|
|
78
80
|
};
|
|
79
|
-
if (!
|
|
81
|
+
if (!w(r)) throw RangeError("Calendar-day arithmetic exceeds the supported years 1–9999.");
|
|
80
82
|
return r;
|
|
81
83
|
}
|
|
82
|
-
function
|
|
83
|
-
if (!
|
|
84
|
-
let n = (e.year - 1) *
|
|
85
|
-
year: Math.floor(n /
|
|
86
|
-
month: n %
|
|
84
|
+
function j(e, t) {
|
|
85
|
+
if (!C(e) || !Number.isInteger(t)) throw RangeError("Calendar-month arithmetic requires a valid month and integer offset.");
|
|
86
|
+
let n = (e.year - 1) * S.monthsPerYear + e.month - 1 + t, r = {
|
|
87
|
+
year: Math.floor(n / S.monthsPerYear) + 1,
|
|
88
|
+
month: n % S.monthsPerYear + 1
|
|
87
89
|
};
|
|
88
|
-
if (!
|
|
90
|
+
if (!C(r)) throw RangeError("Calendar-month arithmetic exceeds the supported years 1–9999.");
|
|
89
91
|
return r;
|
|
90
92
|
}
|
|
91
|
-
function
|
|
92
|
-
return
|
|
93
|
+
function M(e, t) {
|
|
94
|
+
return w(e) ? new Intl.DateTimeFormat(t, {
|
|
93
95
|
dateStyle: "medium",
|
|
94
96
|
timeZone: "UTC",
|
|
95
97
|
calendar: "gregory"
|
|
96
|
-
}).format(Date.parse(`${
|
|
98
|
+
}).format(Date.parse(`${E(e)}T12:00:00Z`)) : "Invalid date";
|
|
97
99
|
}
|
|
98
|
-
function
|
|
99
|
-
return
|
|
100
|
+
function N(e, t) {
|
|
101
|
+
return C(e) ? new Intl.DateTimeFormat(t, {
|
|
100
102
|
month: "short",
|
|
101
103
|
year: "numeric",
|
|
102
104
|
timeZone: "UTC",
|
|
103
105
|
calendar: "gregory"
|
|
104
|
-
}).format(Date.parse(`${
|
|
106
|
+
}).format(Date.parse(`${D(e)}-01T12:00:00Z`)) : "Invalid month";
|
|
105
107
|
}
|
|
106
|
-
function
|
|
107
|
-
if (!
|
|
108
|
-
if (t !== void 0 &&
|
|
109
|
-
if (n !== void 0 &&
|
|
108
|
+
function P(e, t, n) {
|
|
109
|
+
if (!w(e)) return "Select a valid date.";
|
|
110
|
+
if (t !== void 0 && E(e) < E(t)) return `Select a date on or after ${E(t)}.`;
|
|
111
|
+
if (n !== void 0 && E(e) > E(n)) return `Select a date on or before ${E(n)}.`;
|
|
110
112
|
}
|
|
111
|
-
function
|
|
112
|
-
if (!
|
|
113
|
-
if (t !== void 0 &&
|
|
114
|
-
if (n !== void 0 &&
|
|
113
|
+
function F(e, t, n) {
|
|
114
|
+
if (!C(e)) return "Select a valid month.";
|
|
115
|
+
if (t !== void 0 && T(e) < T(t)) return `Select a month on or after ${D(t)}.`;
|
|
116
|
+
if (n !== void 0 && T(e) > T(n)) return `Select a month on or before ${D(n)}.`;
|
|
115
117
|
}
|
|
116
118
|
// packages/forms/src/dates/calendar.tsx
|
|
117
|
-
var
|
|
119
|
+
var I = {
|
|
118
120
|
dayButton: {
|
|
119
121
|
kB7OPa: "x9f619",
|
|
120
122
|
kzqmXN: "x9c6wpo x1ff4b4a",
|
|
@@ -170,16 +172,16 @@ var N = {
|
|
|
170
172
|
$$css: !0
|
|
171
173
|
}
|
|
172
174
|
};
|
|
173
|
-
function
|
|
174
|
-
return e !== void 0 &&
|
|
175
|
+
function L(e) {
|
|
176
|
+
return e !== void 0 && w(e) ? E(e) : void 0;
|
|
175
177
|
}
|
|
176
|
-
function
|
|
177
|
-
let t =
|
|
178
|
-
|
|
178
|
+
function R(e) {
|
|
179
|
+
let t = d(null);
|
|
180
|
+
u(() => {
|
|
179
181
|
e.autoFocus === !0 && t.current?.querySelector("[tabindex=\"0\"]")?.focus();
|
|
180
182
|
}, [e.autoFocus, e.timeZone]);
|
|
181
|
-
let n =
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
+
let n = L(e.today) ?? "2000-01-01", r = w(e.initialMonth) ? D(e.initialMonth) : n.slice(0, 7), i = L(e.minimum), a = L(e.maximum), o = e.mode === "range" ? L(e.value?.from) : void 0, c = e.mode === "range" ? L(e.value?.to) : void 0, l = o !== void 0 && c !== void 0 ? [o, c] : null;
|
|
184
|
+
return /* @__PURE__ */ m(y.Calendar, {
|
|
183
185
|
className: "xbixft xpvm0e4 x1hz01jw xj57cvi xtqrqnz x1778rvt x1717udv xezivpi x193iq5w xw2csxc",
|
|
184
186
|
"aria-label": e.label,
|
|
185
187
|
mode: e.mode,
|
|
@@ -192,15 +194,15 @@ function F(e) {
|
|
|
192
194
|
...a !== void 0 && { max: a },
|
|
193
195
|
showOutsideDays: !0,
|
|
194
196
|
deselectable: !0,
|
|
195
|
-
value: e.mode === "single" ?
|
|
197
|
+
value: e.mode === "single" ? L(e.value) ?? null : l,
|
|
196
198
|
onAnchorChange: (t, n) => {
|
|
197
199
|
if (e.mode !== "range") return;
|
|
198
200
|
if (t === null) {
|
|
199
201
|
n.reason === "escape-key" && e.onValueChange(void 0);
|
|
200
202
|
return;
|
|
201
203
|
}
|
|
202
|
-
let r =
|
|
203
|
-
r !== void 0 && (e.value !== void 0 &&
|
|
204
|
+
let r = O(t);
|
|
205
|
+
r !== void 0 && (e.value !== void 0 && o !== void 0 && c === void 0 ? (n.cancel(), e.onValueChange(t < o ? {
|
|
204
206
|
from: r,
|
|
205
207
|
to: e.value.from
|
|
206
208
|
} : {
|
|
@@ -209,49 +211,49 @@ function F(e) {
|
|
|
209
211
|
})) : e.onValueChange({ from: r }));
|
|
210
212
|
},
|
|
211
213
|
onValueChange: (t) => {
|
|
212
|
-
if (e.mode === "single") e.onValueChange(typeof t == "string" ?
|
|
214
|
+
if (e.mode === "single") e.onValueChange(typeof t == "string" ? O(t) : void 0);
|
|
213
215
|
else if (Array.isArray(t)) {
|
|
214
|
-
let n =
|
|
216
|
+
let n = O(t[0]), r = O(t[1]);
|
|
215
217
|
n !== void 0 && r !== void 0 && e.onValueChange({
|
|
216
218
|
from: n,
|
|
217
219
|
to: r
|
|
218
220
|
});
|
|
219
221
|
}
|
|
220
222
|
},
|
|
221
|
-
children: /* @__PURE__ */
|
|
223
|
+
children: /* @__PURE__ */ h("div", {
|
|
222
224
|
className: "x1n2onr6",
|
|
223
225
|
children: [
|
|
224
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ m("div", {
|
|
225
227
|
className: "x78zum5 x6s0dn4 xl56j7k x1f9pz31 x992rv9 x1jfksii",
|
|
226
|
-
children: /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ m(y.CalendarHeading, { className: "x1ghz6dp xtqrqnz xk4h15q" })
|
|
227
229
|
}),
|
|
228
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ h("div", {
|
|
229
231
|
className: "x10l6tqk x17y0mx6 x13vifvy x78zum5 x1qughib x47corl",
|
|
230
|
-
children: [/* @__PURE__ */
|
|
232
|
+
children: [/* @__PURE__ */ m(y.CalendarPrevious, {
|
|
231
233
|
className: "x3nfvp2 x9f619 x6s0dn4 xl56j7k x9c6wpo x1ff4b4a x1f9pz31 x992rv9 x1717udv xmkeg23 x1y0btm7 x1ey3b81 x1ok0vyi xbixft xpvm0e4 x67bb7w x1ypdohk x19tlqzf xtgyt42 xqqsu6m xzro3xz x13qnu6 x9v5kkp x19rmrnh x1bqaal",
|
|
232
|
-
children: /* @__PURE__ */
|
|
234
|
+
children: /* @__PURE__ */ m(_, {
|
|
233
235
|
"aria-hidden": "true",
|
|
234
236
|
className: "xtwnzbg x18utl2x"
|
|
235
237
|
})
|
|
236
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ m(y.CalendarNext, {
|
|
237
239
|
className: "x3nfvp2 x9f619 x6s0dn4 xl56j7k x9c6wpo x1ff4b4a x1f9pz31 x992rv9 x1717udv xmkeg23 x1y0btm7 x1ey3b81 x1ok0vyi xbixft xpvm0e4 x67bb7w x1ypdohk x19tlqzf xtgyt42 xqqsu6m xzro3xz x13qnu6 x9v5kkp x19rmrnh x1bqaal",
|
|
238
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ m(v, {
|
|
239
241
|
"aria-hidden": "true",
|
|
240
242
|
className: "xtwnzbg x18utl2x"
|
|
241
243
|
})
|
|
242
244
|
})]
|
|
243
245
|
}),
|
|
244
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ h(y.CalendarGrid, {
|
|
245
247
|
ref: t,
|
|
246
248
|
className: "x1mwwwfo x1gukg7c",
|
|
247
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ m(y.CalendarWeekdays, { children: (e) => /* @__PURE__ */ m(y.CalendarWeekday, {
|
|
248
250
|
index: e,
|
|
249
251
|
className: "x153jb6y xj57cvi xy8obcc x1f9pz31 x2b8uid"
|
|
250
|
-
}) }), /* @__PURE__ */
|
|
252
|
+
}) }), /* @__PURE__ */ m(y.CalendarWeeks, { children: (e) => /* @__PURE__ */ m(y.CalendarDay, {
|
|
251
253
|
value: e.date,
|
|
252
254
|
className: (e) => {
|
|
253
|
-
let t = e.rangeStart || e.rangeEnd, n = e.date ===
|
|
254
|
-
return
|
|
255
|
+
let t = e.rangeStart || e.rangeEnd, n = e.date === o && c === void 0, r = e.selected || t || n, i = e.inRange && !t;
|
|
256
|
+
return s.props(I.dayButton, e.outside && I.outside, e.today && I.today, r && I.selected, i && I.rangeMiddle, e.disabled && I.disabledDay).className ?? "";
|
|
255
257
|
}
|
|
256
258
|
}) })]
|
|
257
259
|
})
|
|
@@ -260,73 +262,128 @@ function F(e) {
|
|
|
260
262
|
}, e.timeZone);
|
|
261
263
|
}
|
|
262
264
|
// packages/forms/src/dates/date-inputs.tsx
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
265
|
+
var z = {
|
|
266
|
+
input: {
|
|
267
|
+
kzqmXN: "xh8yej3",
|
|
268
|
+
k7Eaqz: "xeuugli",
|
|
269
|
+
$$css: !0
|
|
270
|
+
},
|
|
271
|
+
segments: {
|
|
272
|
+
k1xSpc: "x78zum5",
|
|
273
|
+
kGNEyG: "x6s0dn4",
|
|
274
|
+
kcqcaj: "xss6m8b",
|
|
275
|
+
krA4I7: "x1u8w8hx",
|
|
276
|
+
kXImzq: "x14xc8xn",
|
|
277
|
+
kpj6Ty: "x1nvizq4",
|
|
278
|
+
kfQpEX: "xjy7s37",
|
|
279
|
+
k90wUN: "xs95o9x",
|
|
280
|
+
$$css: !0
|
|
281
|
+
},
|
|
282
|
+
segment: {
|
|
283
|
+
kB7OPa: "x1afcbsf",
|
|
284
|
+
kzqmXN: "xu85ibj",
|
|
285
|
+
kmVPX3: "x1717udv",
|
|
286
|
+
kg3NbH: "x1r97e56",
|
|
287
|
+
kMzoRj: "xc342km",
|
|
288
|
+
kaIpWk: "x1ok0vyi",
|
|
289
|
+
kWkggS: "xjbqb8w",
|
|
290
|
+
kMwMTN: "x1heor9g",
|
|
291
|
+
kMv6JI: "xjb2p0i",
|
|
292
|
+
kGuDYH: "x1qlqyl8",
|
|
293
|
+
kLWn49: "x15bjb6t",
|
|
294
|
+
kcqcaj: "x1wgrp8u",
|
|
295
|
+
k9WMMc: "x2b8uid",
|
|
296
|
+
k3XXqK: "x1t137rt",
|
|
297
|
+
knGrYV: "xbuiw85",
|
|
298
|
+
kL3a3j: "xzhmotu",
|
|
299
|
+
kabz5l: "x1u2mymh",
|
|
300
|
+
k8Qsv1: "xz7023x",
|
|
301
|
+
$$css: !0
|
|
302
|
+
},
|
|
303
|
+
year: {
|
|
304
|
+
kzqmXN: "xl3ry0p",
|
|
305
|
+
$$css: !0
|
|
306
|
+
},
|
|
307
|
+
literal: {
|
|
308
|
+
kMwMTN: "x153jb6y",
|
|
309
|
+
$$css: !0
|
|
310
|
+
}
|
|
311
|
+
}, B = {
|
|
312
|
+
year: [z.segment, z.year],
|
|
313
|
+
month: [z.segment],
|
|
314
|
+
day: [z.segment],
|
|
315
|
+
hour: [z.segment],
|
|
316
|
+
minute: [z.segment],
|
|
317
|
+
second: [z.segment],
|
|
318
|
+
dayPeriod: [z.segment],
|
|
319
|
+
literal: [z.literal]
|
|
320
|
+
};
|
|
321
|
+
function V({ label: t, value: r, minimum: i, maximum: a, locale: o, onValueChange: c }) {
|
|
322
|
+
return /* @__PURE__ */ h(n.Root, { children: [/* @__PURE__ */ m(n.Label, { children: t }), /* @__PURE__ */ m(b, {
|
|
323
|
+
value: r === void 0 ? null : E(r),
|
|
324
|
+
...i !== void 0 && { min: E(i) },
|
|
325
|
+
...a !== void 0 && { max: E(a) },
|
|
326
|
+
locale: o,
|
|
327
|
+
onValueChange: (e) => c(e === null ? void 0 : O(e)),
|
|
328
|
+
...s.props(e.base, e.field, e.singleLineField, z.segments),
|
|
329
|
+
children: ({ segments: e }) => e.map((e) => /* @__PURE__ */ m(x, {
|
|
330
|
+
segment: e,
|
|
331
|
+
...s.props(B[e.type])
|
|
332
|
+
}, e.key))
|
|
276
333
|
})] });
|
|
277
334
|
}
|
|
278
|
-
function
|
|
279
|
-
return /* @__PURE__ */
|
|
335
|
+
function H({ label: e, value: r, minimum: i, maximum: a, onValueChange: o }) {
|
|
336
|
+
return /* @__PURE__ */ h(n.Root, { children: [/* @__PURE__ */ m(n.Label, { children: e }), /* @__PURE__ */ m(t, {
|
|
280
337
|
type: "month",
|
|
281
|
-
value: r === void 0 ? "" :
|
|
282
|
-
min: i === void 0 ? "0001-01" :
|
|
283
|
-
max: a === void 0 ? "9999-12" :
|
|
284
|
-
onChange: (e) => o(
|
|
285
|
-
xstyle:
|
|
338
|
+
value: r === void 0 ? "" : D(r),
|
|
339
|
+
min: i === void 0 ? "0001-01" : D(i),
|
|
340
|
+
max: a === void 0 ? "9999-12" : D(a),
|
|
341
|
+
onChange: (e) => o(k(e.target.value)),
|
|
342
|
+
xstyle: z.input
|
|
286
343
|
})] });
|
|
287
344
|
}
|
|
288
|
-
function
|
|
289
|
-
return /* @__PURE__ */
|
|
345
|
+
function U({ children: e }) {
|
|
346
|
+
return /* @__PURE__ */ m("div", {
|
|
290
347
|
className: "xrvj5dj xnby9oq x1hnptsi",
|
|
291
348
|
children: e
|
|
292
349
|
});
|
|
293
350
|
}
|
|
294
351
|
// packages/forms/src/dates/picker-popover.tsx
|
|
295
|
-
function
|
|
296
|
-
let [y, b] =
|
|
352
|
+
function W({ label: e, value: t, onValueChange: n, formatValue: r, validateValue: s, presets: c = [], density: u = "standard", disabled: d, isClearable: p = !0, timeZone: _, children: v }) {
|
|
353
|
+
let [y, b] = f(!1), [x, S] = f(t), C = l(), w = x === void 0 ? void 0 : s(x);
|
|
297
354
|
function T(e) {
|
|
298
355
|
n(e), b(!1);
|
|
299
356
|
}
|
|
300
|
-
return /* @__PURE__ */
|
|
357
|
+
return /* @__PURE__ */ h(o.Root, {
|
|
301
358
|
open: y,
|
|
302
359
|
onOpenChange: (e) => {
|
|
303
360
|
e && S(t), b(e);
|
|
304
361
|
},
|
|
305
|
-
children: [/* @__PURE__ */
|
|
306
|
-
disabled:
|
|
307
|
-
render: /* @__PURE__ */
|
|
362
|
+
children: [/* @__PURE__ */ h(o.Trigger, {
|
|
363
|
+
disabled: d ?? !1,
|
|
364
|
+
render: /* @__PURE__ */ m(i, {
|
|
308
365
|
density: u,
|
|
309
366
|
variant: "outline"
|
|
310
367
|
}),
|
|
311
|
-
"aria-label": t === void 0 ? e : `${e}: ${
|
|
312
|
-
children: [/* @__PURE__ */
|
|
368
|
+
"aria-label": t === void 0 ? e : `${e}: ${r(t)}`,
|
|
369
|
+
children: [/* @__PURE__ */ m(g, {
|
|
313
370
|
size: 16,
|
|
314
371
|
"aria-hidden": "true"
|
|
315
|
-
}), t === void 0 ? e :
|
|
316
|
-
}), /* @__PURE__ */
|
|
372
|
+
}), t === void 0 ? e : r(t)]
|
|
373
|
+
}), /* @__PURE__ */ m(o.Popup, {
|
|
317
374
|
align: "end",
|
|
318
375
|
collisionPadding: 1,
|
|
319
376
|
"aria-label": e,
|
|
320
377
|
className: "x1vae6as x1rxfojk",
|
|
321
|
-
children: /* @__PURE__ */
|
|
378
|
+
children: /* @__PURE__ */ h("div", {
|
|
322
379
|
className: "x78zum5 xdt5ytf x1n8ia3y xeuugli",
|
|
323
380
|
children: [
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
|
|
381
|
+
/* @__PURE__ */ m(o.Title, { children: e }),
|
|
382
|
+
c.length > 0 && /* @__PURE__ */ m("div", {
|
|
326
383
|
role: "group",
|
|
327
384
|
"aria-label": "Date presets",
|
|
328
385
|
className: "x78zum5 x1a02dak xunmzkg xmmm7uk xso031l x1q0q8m5 x1qndepd",
|
|
329
|
-
children:
|
|
386
|
+
children: c.map((e) => /* @__PURE__ */ m(i, {
|
|
330
387
|
variant: "ghost",
|
|
331
388
|
disabled: s(e.value) !== void 0,
|
|
332
389
|
onClick: () => T(e.value),
|
|
@@ -334,31 +391,31 @@ function B({ label: e, value: t, onValueChange: n, formatValue: o, validateValue
|
|
|
334
391
|
}, e.id))
|
|
335
392
|
}),
|
|
336
393
|
y && v(x, S),
|
|
337
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ m("div", {
|
|
338
395
|
id: C,
|
|
339
396
|
"aria-live": "polite",
|
|
340
397
|
className: "xr5kp14 xy8obcc xas2l8k",
|
|
341
398
|
children: w
|
|
342
399
|
}),
|
|
343
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ h("div", {
|
|
344
401
|
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi x3bg4vu x178xt8z x13fuv20 xhjagg4",
|
|
345
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ m("span", {
|
|
346
403
|
className: "x153jb6y xy8obcc xas2l8k",
|
|
347
404
|
children: _
|
|
348
|
-
}), /* @__PURE__ */
|
|
405
|
+
}), /* @__PURE__ */ h("div", {
|
|
349
406
|
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi",
|
|
350
407
|
children: [
|
|
351
|
-
|
|
408
|
+
p && /* @__PURE__ */ m(a, {
|
|
352
409
|
disabled: t === void 0,
|
|
353
410
|
onClick: () => T(void 0),
|
|
354
411
|
children: "Clear"
|
|
355
412
|
}),
|
|
356
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ m(i, {
|
|
357
414
|
variant: "ghost",
|
|
358
415
|
onClick: () => b(!1),
|
|
359
416
|
children: "Cancel"
|
|
360
417
|
}),
|
|
361
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ m(i, {
|
|
362
419
|
variant: "solid",
|
|
363
420
|
disabled: x === void 0 || w !== void 0,
|
|
364
421
|
"aria-describedby": w === void 0 ? void 0 : C,
|
|
@@ -376,53 +433,54 @@ function B({ label: e, value: t, onValueChange: n, formatValue: o, validateValue
|
|
|
376
433
|
});
|
|
377
434
|
}
|
|
378
435
|
// packages/forms/src/dates/date-picker.tsx
|
|
379
|
-
function
|
|
380
|
-
return /* @__PURE__ */
|
|
436
|
+
function G({ label: e, value: t, onValueChange: n, formatValue: r, density: i, disabled: a, isClearable: o, ...s }) {
|
|
437
|
+
return /* @__PURE__ */ m(W, {
|
|
381
438
|
label: e,
|
|
382
439
|
value: t,
|
|
383
440
|
onValueChange: n,
|
|
384
|
-
formatValue: r ?? ((e) =>
|
|
385
|
-
validateValue: (e) =>
|
|
441
|
+
formatValue: r ?? ((e) => M(e, s.locale)),
|
|
442
|
+
validateValue: (e) => P(e, s.minimum, s.maximum),
|
|
386
443
|
density: i,
|
|
387
444
|
disabled: a,
|
|
388
445
|
isClearable: o,
|
|
389
446
|
timeZone: s.timeZone,
|
|
390
|
-
children: (t, n) => /* @__PURE__ */
|
|
447
|
+
children: (t, n) => /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(V, {
|
|
391
448
|
label: "Date",
|
|
392
449
|
value: t,
|
|
450
|
+
locale: s.locale,
|
|
393
451
|
minimum: s.minimum,
|
|
394
452
|
maximum: s.maximum,
|
|
395
453
|
onValueChange: n
|
|
396
|
-
}), /* @__PURE__ */
|
|
454
|
+
}), /* @__PURE__ */ m(R, {
|
|
397
455
|
...s,
|
|
398
456
|
label: e,
|
|
399
457
|
mode: "single",
|
|
400
458
|
autoFocus: !0,
|
|
401
459
|
value: t,
|
|
402
|
-
initialMonth: t !== void 0 &&
|
|
460
|
+
initialMonth: t !== void 0 && w(t) ? t : s.initialMonth,
|
|
403
461
|
onValueChange: n
|
|
404
462
|
})] })
|
|
405
463
|
});
|
|
406
464
|
}
|
|
407
465
|
// packages/forms/src/dates/date-range-picker.tsx
|
|
408
|
-
function
|
|
466
|
+
function K({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, validateRange: a, density: o, disabled: s, isClearable: c, ...l }) {
|
|
409
467
|
function u(e) {
|
|
410
468
|
if (e.to === void 0) return "Select a start and end date.";
|
|
411
|
-
let t =
|
|
412
|
-
return t === void 0 ?
|
|
469
|
+
let t = P(e.from, l.minimum, l.maximum) ?? P(e.to, l.minimum, l.maximum);
|
|
470
|
+
return t === void 0 ? E(e.from) > E(e.to) ? "End date must be on or after start date." : a?.({
|
|
413
471
|
from: e.from,
|
|
414
472
|
to: e.to
|
|
415
473
|
}) : t;
|
|
416
474
|
}
|
|
417
475
|
function d(e) {
|
|
418
|
-
if (e.to === void 0) return
|
|
476
|
+
if (e.to === void 0) return M(e.from, l.locale);
|
|
419
477
|
let t = {
|
|
420
478
|
from: e.from,
|
|
421
479
|
to: e.to
|
|
422
480
|
};
|
|
423
|
-
return r?.(t) ?? `${
|
|
481
|
+
return r?.(t) ?? `${M(t.from, l.locale)} – ${M(t.to, l.locale)}`;
|
|
424
482
|
}
|
|
425
|
-
return /* @__PURE__ */
|
|
483
|
+
return /* @__PURE__ */ m(W, {
|
|
426
484
|
label: e,
|
|
427
485
|
value: t,
|
|
428
486
|
formatValue: d,
|
|
@@ -438,18 +496,20 @@ function H({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, v
|
|
|
438
496
|
to: e.to
|
|
439
497
|
});
|
|
440
498
|
},
|
|
441
|
-
children: (t, n) => /* @__PURE__ */
|
|
499
|
+
children: (t, n) => /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h(U, { children: [/* @__PURE__ */ m(V, {
|
|
442
500
|
label: "Start date",
|
|
443
501
|
value: t?.from,
|
|
502
|
+
locale: l.locale,
|
|
444
503
|
minimum: l.minimum,
|
|
445
504
|
maximum: l.maximum,
|
|
446
505
|
onValueChange: (e) => n(e === void 0 ? void 0 : {
|
|
447
506
|
from: e,
|
|
448
507
|
to: t?.to
|
|
449
508
|
})
|
|
450
|
-
}), /* @__PURE__ */
|
|
509
|
+
}), /* @__PURE__ */ m(V, {
|
|
451
510
|
label: "End date",
|
|
452
511
|
value: t?.to,
|
|
512
|
+
locale: l.locale,
|
|
453
513
|
minimum: l.minimum,
|
|
454
514
|
maximum: l.maximum,
|
|
455
515
|
onValueChange: (e) => {
|
|
@@ -461,35 +521,35 @@ function H({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, v
|
|
|
461
521
|
to: e
|
|
462
522
|
});
|
|
463
523
|
}
|
|
464
|
-
})] }), /* @__PURE__ */
|
|
524
|
+
})] }), /* @__PURE__ */ m(R, {
|
|
465
525
|
...l,
|
|
466
526
|
label: e,
|
|
467
527
|
mode: "range",
|
|
468
528
|
autoFocus: !0,
|
|
469
529
|
value: t,
|
|
470
|
-
initialMonth: t !== void 0 &&
|
|
530
|
+
initialMonth: t !== void 0 && w(t.from) ? t.from : l.initialMonth,
|
|
471
531
|
onValueChange: n
|
|
472
532
|
})] })
|
|
473
533
|
});
|
|
474
534
|
}
|
|
475
535
|
// packages/forms/src/dates/month-calendar.tsx
|
|
476
|
-
var
|
|
536
|
+
var q = { month: {
|
|
477
537
|
kzqmXN: "xh8yej3",
|
|
478
538
|
$$css: !0
|
|
479
539
|
} };
|
|
480
|
-
function
|
|
481
|
-
let r =
|
|
540
|
+
function J(e, t, n) {
|
|
541
|
+
let r = C(e) ? e : {
|
|
482
542
|
year: 2e3,
|
|
483
543
|
month: 1
|
|
484
544
|
};
|
|
485
|
-
return t !== void 0 &&
|
|
545
|
+
return t !== void 0 && T(r) < T(t) ? t : n !== void 0 && T(r) > T(n) ? n : r;
|
|
486
546
|
}
|
|
487
|
-
function
|
|
488
|
-
let
|
|
489
|
-
|
|
490
|
-
|
|
547
|
+
function Y({ label: e, selection: t, onSelect: n, locale: a, today: o, initialMonth: s, minimum: l, maximum: u }) {
|
|
548
|
+
let p = J(s, l, u), [g, y] = f(p.year), [b, x] = f(p), S = d(/* @__PURE__ */ new Map()), C = d(!1);
|
|
549
|
+
c(() => {
|
|
550
|
+
C.current && (C.current = !1, S.current.get(b.month)?.focus());
|
|
491
551
|
}, [b]);
|
|
492
|
-
function
|
|
552
|
+
function w(e, t) {
|
|
493
553
|
let n = {
|
|
494
554
|
ArrowLeft: -1,
|
|
495
555
|
ArrowRight: 1,
|
|
@@ -500,121 +560,121 @@ function G({ label: e, selection: t, onSelect: r, locale: a, today: o, initialMo
|
|
|
500
560
|
}[e.key];
|
|
501
561
|
if (e.key === "Home" && (n = 1 - t.month), e.key === "End" && (n = 12 - t.month), n === void 0) return;
|
|
502
562
|
e.preventDefault();
|
|
503
|
-
let r = Math.max(12, Math.min(119999,
|
|
563
|
+
let r = Math.max(12, Math.min(119999, T(t) - 1 + n)), i = J({
|
|
504
564
|
year: Math.floor(r / 12),
|
|
505
565
|
month: r % 12 + 1
|
|
506
|
-
}, l,
|
|
507
|
-
|
|
566
|
+
}, l, u);
|
|
567
|
+
C.current = !0, y(i.year), x(i);
|
|
508
568
|
}
|
|
509
569
|
function E(e) {
|
|
510
|
-
let t =
|
|
570
|
+
let t = J({
|
|
511
571
|
year: e,
|
|
512
572
|
month: b.month
|
|
513
|
-
}, l,
|
|
573
|
+
}, l, u);
|
|
514
574
|
y(t.year), x(t);
|
|
515
575
|
}
|
|
516
|
-
return /* @__PURE__ */
|
|
576
|
+
return /* @__PURE__ */ h("div", {
|
|
517
577
|
className: "x78zum5 xdt5ytf x1hnptsi xeuugli",
|
|
518
|
-
children: [/* @__PURE__ */
|
|
578
|
+
children: [/* @__PURE__ */ h("div", {
|
|
519
579
|
className: "x78zum5 x6s0dn4 x1qughib x1hnptsi",
|
|
520
580
|
children: [
|
|
521
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ m(r, {
|
|
522
582
|
"aria-label": "Previous year",
|
|
523
|
-
disabled:
|
|
524
|
-
onClick: () => E(
|
|
525
|
-
children: /* @__PURE__ */
|
|
583
|
+
disabled: g <= (l?.year ?? 1),
|
|
584
|
+
onClick: () => E(g - 1),
|
|
585
|
+
children: /* @__PURE__ */ m(_, { size: 16 })
|
|
526
586
|
}),
|
|
527
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ m("span", {
|
|
528
588
|
"aria-live": "polite",
|
|
529
589
|
className: "xk4h15q xss6m8b",
|
|
530
|
-
children:
|
|
590
|
+
children: g
|
|
531
591
|
}),
|
|
532
|
-
/* @__PURE__ */
|
|
592
|
+
/* @__PURE__ */ m(r, {
|
|
533
593
|
"aria-label": "Next year",
|
|
534
|
-
disabled:
|
|
535
|
-
onClick: () => E(
|
|
536
|
-
children: /* @__PURE__ */
|
|
594
|
+
disabled: g >= (u?.year ?? 9999),
|
|
595
|
+
onClick: () => E(g + 1),
|
|
596
|
+
children: /* @__PURE__ */ m(v, { size: 16 })
|
|
537
597
|
})
|
|
538
598
|
]
|
|
539
|
-
}), /* @__PURE__ */
|
|
599
|
+
}), /* @__PURE__ */ m("div", {
|
|
540
600
|
role: "group",
|
|
541
601
|
"aria-label": e,
|
|
542
602
|
className: "xrvj5dj x185a7wo xunmzkg",
|
|
543
|
-
children: Array.from({ length: 12 }, (e,
|
|
603
|
+
children: Array.from({ length: 12 }, (e, r) => {
|
|
544
604
|
let s = {
|
|
545
|
-
year:
|
|
546
|
-
month:
|
|
547
|
-
}, c =
|
|
548
|
-
return /* @__PURE__ */
|
|
549
|
-
variant:
|
|
550
|
-
"aria-label":
|
|
551
|
-
"aria-pressed":
|
|
552
|
-
"aria-current":
|
|
605
|
+
year: g,
|
|
606
|
+
month: r + 1
|
|
607
|
+
}, c = T(s), d = t === void 0 ? void 0 : T(t.from), f = t?.to === void 0 ? void 0 : T(t.to), p = c === d || c === f, h = d !== void 0 && f !== void 0 && c > d && c < f, _ = l !== void 0 && c < T(l), v = u !== void 0 && c > T(u), y = _ || v;
|
|
608
|
+
return /* @__PURE__ */ m(i, {
|
|
609
|
+
variant: p || h ? "solid" : "ghost",
|
|
610
|
+
"aria-label": N(s, a),
|
|
611
|
+
"aria-pressed": p || h,
|
|
612
|
+
"aria-current": g === o.year && s.month === o.month ? "date" : void 0,
|
|
553
613
|
disabled: y,
|
|
554
|
-
tabIndex: b.year ===
|
|
614
|
+
tabIndex: b.year === g && b.month === s.month ? 0 : -1,
|
|
555
615
|
ref: (e) => {
|
|
556
|
-
e === null ?
|
|
616
|
+
e === null ? S.current.delete(s.month) : S.current.set(s.month, e);
|
|
557
617
|
},
|
|
558
618
|
onFocus: () => x(s),
|
|
559
|
-
onKeyDown: (e) =>
|
|
560
|
-
onClick: () =>
|
|
561
|
-
xstyle:
|
|
619
|
+
onKeyDown: (e) => w(e, s),
|
|
620
|
+
onClick: () => n(s),
|
|
621
|
+
xstyle: q.month,
|
|
562
622
|
children: new Intl.DateTimeFormat(a, {
|
|
563
623
|
month: "short",
|
|
564
624
|
timeZone: "UTC",
|
|
565
625
|
calendar: "gregory"
|
|
566
|
-
}).format(/* @__PURE__ */ new Date(`${String(
|
|
626
|
+
}).format(/* @__PURE__ */ new Date(`${String(g).padStart(4, "0")}-${String(s.month).padStart(2, "0")}-01T12:00:00Z`))
|
|
567
627
|
}, s.month);
|
|
568
628
|
})
|
|
569
629
|
})]
|
|
570
630
|
});
|
|
571
631
|
}
|
|
572
632
|
// packages/forms/src/dates/month-picker.tsx
|
|
573
|
-
function
|
|
574
|
-
return /* @__PURE__ */
|
|
633
|
+
function X({ label: e, value: t, onValueChange: n, formatValue: r, density: i, disabled: a, isClearable: o, ...s }) {
|
|
634
|
+
return /* @__PURE__ */ m(W, {
|
|
575
635
|
label: e,
|
|
576
636
|
value: t,
|
|
577
637
|
onValueChange: n,
|
|
578
|
-
formatValue: r ?? ((e) =>
|
|
579
|
-
validateValue: (e) =>
|
|
638
|
+
formatValue: r ?? ((e) => N(e, s.locale)),
|
|
639
|
+
validateValue: (e) => F(e, s.minimum, s.maximum),
|
|
580
640
|
density: i,
|
|
581
641
|
disabled: a,
|
|
582
642
|
isClearable: o,
|
|
583
643
|
timeZone: s.timeZone,
|
|
584
|
-
children: (t, n) => /* @__PURE__ */
|
|
644
|
+
children: (t, n) => /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(H, {
|
|
585
645
|
label: "Month",
|
|
586
646
|
value: t,
|
|
587
647
|
minimum: s.minimum,
|
|
588
648
|
maximum: s.maximum,
|
|
589
649
|
onValueChange: n
|
|
590
|
-
}), /* @__PURE__ */
|
|
650
|
+
}), /* @__PURE__ */ m(Y, {
|
|
591
651
|
...s,
|
|
592
652
|
label: e,
|
|
593
653
|
selection: t === void 0 ? void 0 : { from: t },
|
|
594
|
-
initialMonth: t !== void 0 &&
|
|
654
|
+
initialMonth: t !== void 0 && C(t) ? t : s.initialMonth,
|
|
595
655
|
onSelect: n
|
|
596
656
|
})] })
|
|
597
657
|
});
|
|
598
658
|
}
|
|
599
659
|
// packages/forms/src/dates/month-range-picker.tsx
|
|
600
|
-
function
|
|
660
|
+
function Z({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, validateRange: a, density: o, disabled: s, isClearable: c, ...l }) {
|
|
601
661
|
function u(e) {
|
|
602
662
|
if (e.to === void 0) return "Select a start and end month.";
|
|
603
|
-
let t =
|
|
604
|
-
return t === void 0 ?
|
|
663
|
+
let t = F(e.from, l.minimum, l.maximum) ?? F(e.to, l.minimum, l.maximum);
|
|
664
|
+
return t === void 0 ? T(e.from) > T(e.to) ? "End month must be on or after start month." : a?.({
|
|
605
665
|
from: e.from,
|
|
606
666
|
to: e.to
|
|
607
667
|
}) : t;
|
|
608
668
|
}
|
|
609
669
|
function d(e) {
|
|
610
|
-
if (e.to === void 0) return
|
|
670
|
+
if (e.to === void 0) return N(e.from, l.locale);
|
|
611
671
|
let t = {
|
|
612
672
|
from: e.from,
|
|
613
673
|
to: e.to
|
|
614
674
|
};
|
|
615
|
-
return r?.(t) ?? `${
|
|
675
|
+
return r?.(t) ?? `${N(t.from, l.locale)} – ${N(t.to, l.locale)}`;
|
|
616
676
|
}
|
|
617
|
-
return /* @__PURE__ */
|
|
677
|
+
return /* @__PURE__ */ m(W, {
|
|
618
678
|
label: e,
|
|
619
679
|
value: t,
|
|
620
680
|
formatValue: d,
|
|
@@ -630,7 +690,7 @@ function q({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, v
|
|
|
630
690
|
to: e.to
|
|
631
691
|
});
|
|
632
692
|
},
|
|
633
|
-
children: (t, n) => /* @__PURE__ */
|
|
693
|
+
children: (t, n) => /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h(U, { children: [/* @__PURE__ */ m(H, {
|
|
634
694
|
label: "Start month",
|
|
635
695
|
value: t?.from,
|
|
636
696
|
minimum: l.minimum,
|
|
@@ -639,7 +699,7 @@ function q({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, v
|
|
|
639
699
|
from: e,
|
|
640
700
|
to: t?.to
|
|
641
701
|
})
|
|
642
|
-
}), /* @__PURE__ */
|
|
702
|
+
}), /* @__PURE__ */ m(H, {
|
|
643
703
|
label: "End month",
|
|
644
704
|
value: t?.to,
|
|
645
705
|
minimum: l.minimum,
|
|
@@ -653,13 +713,13 @@ function q({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, v
|
|
|
653
713
|
to: e
|
|
654
714
|
});
|
|
655
715
|
}
|
|
656
|
-
})] }), /* @__PURE__ */
|
|
716
|
+
})] }), /* @__PURE__ */ m(Y, {
|
|
657
717
|
...l,
|
|
658
718
|
label: e,
|
|
659
719
|
selection: t,
|
|
660
|
-
initialMonth: t !== void 0 &&
|
|
720
|
+
initialMonth: t !== void 0 && C(t.from) ? t.from : l.initialMonth,
|
|
661
721
|
onSelect: (e) => {
|
|
662
|
-
t === void 0 || t.to !== void 0 ? n({ from: e }) :
|
|
722
|
+
t === void 0 || t.to !== void 0 ? n({ from: e }) : T(e) < T(t.from) ? n({
|
|
663
723
|
from: e,
|
|
664
724
|
to: t.from
|
|
665
725
|
}) : n({
|
|
@@ -671,20 +731,20 @@ function q({ label: e, value: t, onValueChange: n, formatValue: r, presets: i, v
|
|
|
671
731
|
});
|
|
672
732
|
}
|
|
673
733
|
// packages/forms/src/dates/event-month.tsx
|
|
674
|
-
var
|
|
675
|
-
function
|
|
676
|
-
let c =
|
|
734
|
+
var Q = 2;
|
|
735
|
+
function $({ label: e, locale: t, timeZone: n, today: r, selected: i, weekStartsOn: a = 1, itemsByDate: o, onSelect: s }) {
|
|
736
|
+
let c = E(i), l = E(r);
|
|
677
737
|
function u(e) {
|
|
678
|
-
let t =
|
|
738
|
+
let t = O(e);
|
|
679
739
|
t !== void 0 && s(t);
|
|
680
740
|
}
|
|
681
|
-
return /* @__PURE__ */
|
|
741
|
+
return /* @__PURE__ */ m(y.Calendar, {
|
|
682
742
|
"aria-label": e,
|
|
683
743
|
mode: "single",
|
|
684
744
|
locale: t,
|
|
685
745
|
timeZone: n,
|
|
686
746
|
today: l,
|
|
687
|
-
month:
|
|
747
|
+
month: D(i),
|
|
688
748
|
value: c,
|
|
689
749
|
weekStartsOn: a,
|
|
690
750
|
weekdayFormat: "short",
|
|
@@ -695,20 +755,20 @@ function Y({ label: e, locale: t, timeZone: n, today: r, selected: i, weekStarts
|
|
|
695
755
|
onFocusedChange: (e, t) => {
|
|
696
756
|
t.reason === "list-navigation" && u(e);
|
|
697
757
|
},
|
|
698
|
-
children: /* @__PURE__ */
|
|
758
|
+
children: /* @__PURE__ */ h(y.CalendarGrid, {
|
|
699
759
|
className: "xh8yej3 x140o2bo x1mwwwfo x1y0btm7 xmkeg23 x1ey3b81 xpvm0e4 xbixft",
|
|
700
|
-
children: [/* @__PURE__ */
|
|
760
|
+
children: [/* @__PURE__ */ m(y.CalendarWeekdays, { children: (e) => /* @__PURE__ */ m(y.CalendarWeekday, {
|
|
701
761
|
index: e,
|
|
702
762
|
className: "xn9t2bk x14w6jbu x153jb6y x2b8uid xy8obcc xk4h15q"
|
|
703
|
-
}) }), /* @__PURE__ */
|
|
704
|
-
let n =
|
|
763
|
+
}) }), /* @__PURE__ */ m(y.CalendarWeeks, { children: (e) => {
|
|
764
|
+
let n = O(e.date);
|
|
705
765
|
if (n === void 0) return null;
|
|
706
|
-
let r = o.get(e.date) ?? [], a = r.length -
|
|
707
|
-
|
|
766
|
+
let r = o.get(e.date) ?? [], a = r.length - Q, s = r.slice(0, Q), u = [
|
|
767
|
+
M(n, t),
|
|
708
768
|
...s.map((e) => e.label),
|
|
709
769
|
a > 0 && `+${a} more`
|
|
710
770
|
].filter(Boolean).join(", ");
|
|
711
|
-
return /* @__PURE__ */
|
|
771
|
+
return /* @__PURE__ */ m(y.CalendarDay, {
|
|
712
772
|
value: e.date,
|
|
713
773
|
"aria-label": u,
|
|
714
774
|
...{
|
|
@@ -717,22 +777,22 @@ function Y({ label: e, locale: t, timeZone: n, today: r, selected: i, weekStarts
|
|
|
717
777
|
1: { className: "x1y0btm7 xmkeg23 x1ey3b81 x16dsc37 x1ypdohk x1t137rt x9v5kkp x12ei19c xx9gdjd x2ssjo2 x1r8u7ye" },
|
|
718
778
|
3: { className: "x1y0btm7 xmkeg23 x1ey3b81 x16dsc37 x1ypdohk x1t137rt x9v5kkp x12ei19c xx9gdjd x2ssjo2 x153jb6y x1r8u7ye" }
|
|
719
779
|
}[(n.month !== i.month) << 1 | e.date === c],
|
|
720
|
-
children: /* @__PURE__ */
|
|
780
|
+
children: /* @__PURE__ */ h("div", {
|
|
721
781
|
className: "xrvj5dj x10ukxgv xunmzkg xefclja x13wpdut x1s01oa9",
|
|
722
782
|
"aria-hidden": "true",
|
|
723
783
|
children: [
|
|
724
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ m("span", {
|
|
725
785
|
...{
|
|
726
786
|
0: { className: "x1lqcxt8 x14w6jbu xy8obcc x1ok0vyi" },
|
|
727
787
|
1: { className: "x1lqcxt8 x14w6jbu xy8obcc x1ok0vyi x7ixh4y x1r8u7ye xtjd4bd" }
|
|
728
788
|
}[e.date === l | 0],
|
|
729
789
|
children: n.day
|
|
730
790
|
}),
|
|
731
|
-
s.map((e) => /* @__PURE__ */
|
|
791
|
+
s.map((e) => /* @__PURE__ */ m("span", {
|
|
732
792
|
className: "x1lliihq xb3r6kr xlyipyv xuxw1ft x14w6jbu xy8obcc x1r7kqkb x1ok0vyi",
|
|
733
793
|
children: e.label
|
|
734
794
|
}, e.id)),
|
|
735
|
-
a > 0 && /* @__PURE__ */
|
|
795
|
+
a > 0 && /* @__PURE__ */ h("span", {
|
|
736
796
|
className: "xy8obcc x153jb6y xuxw1ft xb3r6kr",
|
|
737
797
|
children: [
|
|
738
798
|
"+",
|
|
@@ -747,4 +807,4 @@ function Y({ label: e, locale: t, timeZone: n, today: r, selected: i, weekStarts
|
|
|
747
807
|
})
|
|
748
808
|
});
|
|
749
809
|
}
|
|
750
|
-
export {
|
|
810
|
+
export { R as Calendar, G as DatePicker, K as DateRangePicker, $ as EventMonth, X as MonthPicker, Z as MonthRangePicker, A as addCalendarDays, j as addCalendarMonths, O as parseCalendarDate, k as parseCalendarMonth, E as serializeCalendarDate, D as serializeCalendarMonth };
|