@namroodinc/liquid-editorial 0.3.3 → 0.4.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/AGENTS.md +4 -0
- package/README.md +19 -8
- package/UPGRADING.md +145 -0
- package/dist/chunks/ColourField-CJicr3OT.cjs +2 -0
- package/dist/chunks/ColourField-CJicr3OT.cjs.map +1 -0
- package/dist/chunks/{ColourField-Bd4twbaG.js → ColourField-DjHRiFDU.js} +74 -62
- package/dist/chunks/ColourField-DjHRiFDU.js.map +1 -0
- package/dist/chunks/DatePicker-D_6CQpUd.js +296 -0
- package/dist/chunks/DatePicker-D_6CQpUd.js.map +1 -0
- package/dist/chunks/DatePicker-aSlYLjtW.cjs +2 -0
- package/dist/chunks/DatePicker-aSlYLjtW.cjs.map +1 -0
- package/dist/chunks/FormEditor-M7tNidFo.js +584 -0
- package/dist/chunks/FormEditor-M7tNidFo.js.map +1 -0
- package/dist/chunks/FormEditor-UzbPdiJo.cjs +2 -0
- package/dist/chunks/FormEditor-UzbPdiJo.cjs.map +1 -0
- package/dist/chunks/Slider-k8weRl34.cjs +2 -0
- package/dist/chunks/Slider-k8weRl34.cjs.map +1 -0
- package/dist/chunks/Slider-vdMFLX-H.js +174 -0
- package/dist/chunks/Slider-vdMFLX-H.js.map +1 -0
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.d.cts.map +1 -1
- package/dist/components/Choice/index.d.ts.map +1 -1
- package/dist/components/Choice/index.js +2 -0
- package/dist/components/Choice/index.js.map +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.d.cts.map +1 -1
- package/dist/components/ColourField/index.d.ts.map +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/ColourField/value.d.cts +6 -0
- package/dist/components/ColourField/value.d.cts.map +1 -1
- package/dist/components/ColourField/value.d.ts +6 -0
- package/dist/components/ColourField/value.d.ts.map +1 -1
- package/dist/components/DatePicker/date.d.cts +9 -0
- package/dist/components/DatePicker/date.d.cts.map +1 -0
- package/dist/components/DatePicker/date.d.ts +9 -0
- package/dist/components/DatePicker/date.d.ts.map +1 -0
- package/dist/components/DatePicker/index.cjs +1 -2
- package/dist/components/DatePicker/index.d.cts +9 -6
- package/dist/components/DatePicker/index.d.cts.map +1 -1
- package/dist/components/DatePicker/index.d.ts +9 -6
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +1 -259
- package/dist/components/DatePicker/style.css +5 -0
- package/dist/components/Field/style.css +20 -0
- package/dist/components/FormEditor/README.md +375 -0
- package/dist/components/FormEditor/additional-control.d.cts +6 -0
- package/dist/components/FormEditor/additional-control.d.cts.map +1 -0
- package/dist/components/FormEditor/additional-control.d.ts +6 -0
- package/dist/components/FormEditor/additional-control.d.ts.map +1 -0
- package/dist/components/FormEditor/choice-control.d.cts +6 -0
- package/dist/components/FormEditor/choice-control.d.cts.map +1 -0
- package/dist/components/FormEditor/choice-control.d.ts +6 -0
- package/dist/components/FormEditor/choice-control.d.ts.map +1 -0
- package/dist/components/FormEditor/control.d.cts +8 -0
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +8 -0
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts +1 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts +1 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts +68 -2
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +68 -2
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/FormEditor/style.css +12 -0
- package/dist/components/Grid/style.css +2 -1
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.js +6 -6
- package/dist/components/ImageCropper/index.js.map +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.cjs.map +1 -1
- package/dist/components/NumberField/index.d.cts.map +1 -1
- package/dist/components/NumberField/index.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +4 -0
- package/dist/components/NumberField/index.js.map +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts +2 -0
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.d.cts.map +1 -1
- package/dist/components/SelectionCard/index.d.ts.map +1 -1
- package/dist/components/SelectionCard/index.js +2 -1
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/Slider/index.cjs +1 -2
- package/dist/components/Slider/index.d.cts +14 -1
- package/dist/components/Slider/index.d.cts.map +1 -1
- package/dist/components/Slider/index.d.ts +14 -1
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +1 -127
- package/dist/components/Slider/scale.d.cts +13 -0
- package/dist/components/Slider/scale.d.cts.map +1 -0
- package/dist/components/Slider/scale.d.ts +13 -0
- package/dist/components/Slider/scale.d.ts.map +1 -0
- package/dist/elements.css +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -20
- package/dist/reset.css +2 -0
- package/dist/styles.css +1 -0
- package/package.json +1 -1
- package/dist/chunks/ColourField-Bd4twbaG.js.map +0 -1
- package/dist/chunks/ColourField-BdAbjgmY.cjs +0 -2
- package/dist/chunks/ColourField-BdAbjgmY.cjs.map +0 -1
- package/dist/chunks/FormEditor-DRmPFe2E.js +0 -328
- package/dist/chunks/FormEditor-DRmPFe2E.js.map +0 -1
- package/dist/chunks/FormEditor-PVkvKep1.cjs +0 -2
- package/dist/chunks/FormEditor-PVkvKep1.cjs.map +0 -1
- package/dist/components/DatePicker/index.cjs.map +0 -1
- package/dist/components/DatePicker/index.js.map +0 -1
- package/dist/components/Slider/index.cjs.map +0 -1
- package/dist/components/Slider/index.js.map +0 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { t as e } from "./Icon-XNismJDm.js";
|
|
2
|
+
import { Button as t } from "../components/Button/index.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { n, r } from "./binding-Bshy43sG.js";
|
|
5
|
+
import { Popover as i } from "../components/Popover/index.js";
|
|
6
|
+
import { forwardRef as a, useEffect as o, useId as s, useRef as c, useState as l } from "react";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/DatePicker/date.ts
|
|
9
|
+
function f(e) {
|
|
10
|
+
let t = `${e.getMonth() + 1}`.padStart(2, "0"), n = `${e.getDate()}`.padStart(2, "0");
|
|
11
|
+
return `${e.getFullYear()}-${t}-${n}`;
|
|
12
|
+
}
|
|
13
|
+
function p(e) {
|
|
14
|
+
if (!e || !/^\d{4}-\d{2}-\d{2}$/.test(e)) return null;
|
|
15
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
16
|
+
if (!t || !n || !r) return null;
|
|
17
|
+
let i = new Date(t, n - 1, r);
|
|
18
|
+
return Number.isNaN(i.getTime()) || f(i) !== e ? null : i;
|
|
19
|
+
}
|
|
20
|
+
function m(e) {
|
|
21
|
+
return p(e) !== null;
|
|
22
|
+
}
|
|
23
|
+
function h(e) {
|
|
24
|
+
let t = p(e);
|
|
25
|
+
return t ? t.toLocaleDateString("en-GB", {
|
|
26
|
+
day: "numeric",
|
|
27
|
+
month: "long",
|
|
28
|
+
year: "numeric"
|
|
29
|
+
}) : "";
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/components/DatePicker/index.tsx
|
|
33
|
+
function g(...e) {
|
|
34
|
+
return e.filter(Boolean).join(" ");
|
|
35
|
+
}
|
|
36
|
+
var _ = [
|
|
37
|
+
"Mon",
|
|
38
|
+
"Tue",
|
|
39
|
+
"Wed",
|
|
40
|
+
"Thu",
|
|
41
|
+
"Fri",
|
|
42
|
+
"Sat",
|
|
43
|
+
"Sun"
|
|
44
|
+
];
|
|
45
|
+
function v(e, t, n) {
|
|
46
|
+
let r = p(e) ? e : f(/* @__PURE__ */ new Date());
|
|
47
|
+
return t && r < t ? t : n && r > n ? n : r;
|
|
48
|
+
}
|
|
49
|
+
function y(e) {
|
|
50
|
+
return e.toLocaleDateString("en-GB", {
|
|
51
|
+
month: "long",
|
|
52
|
+
year: "numeric"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function b(e) {
|
|
56
|
+
let t = new Date(e.getFullYear(), e.getMonth(), 1), n = (t.getDay() + 6) % 7;
|
|
57
|
+
return new Date(t.getFullYear(), t.getMonth(), 1 - n);
|
|
58
|
+
}
|
|
59
|
+
function x(e, t, n) {
|
|
60
|
+
return e ? "primary" : t ? "active" : n ? "neutral" : "simple";
|
|
61
|
+
}
|
|
62
|
+
var S = a(function({ value: e, endValue: r, onSelect: i, min: a, max: s, className: m, ...S }, C) {
|
|
63
|
+
let [w, T] = l(() => v(e, a, s)), [E, D] = l(() => p(w) ?? /* @__PURE__ */ new Date()), O = c(null), k = c(!1);
|
|
64
|
+
o(() => {
|
|
65
|
+
if (!p(e)) return;
|
|
66
|
+
let t = v(e, a, s), n = p(t) ?? /* @__PURE__ */ new Date();
|
|
67
|
+
T(t), D(new Date(n.getFullYear(), n.getMonth(), 1));
|
|
68
|
+
}, [
|
|
69
|
+
e,
|
|
70
|
+
a,
|
|
71
|
+
s
|
|
72
|
+
]), o(() => {
|
|
73
|
+
k.current && (k.current = !1, O.current?.querySelector("[data-focused]")?.focus());
|
|
74
|
+
}, [w]);
|
|
75
|
+
let A = Array.from({ length: 42 }, (e, t) => {
|
|
76
|
+
let n = b(E);
|
|
77
|
+
return new Date(n.getFullYear(), n.getMonth(), n.getDate() + t);
|
|
78
|
+
}), j = f(/* @__PURE__ */ new Date()), M = (e) => {
|
|
79
|
+
let t = new Date(E.getFullYear(), E.getMonth() + e, 1);
|
|
80
|
+
D(t), T(f(t));
|
|
81
|
+
}, N = (e) => {
|
|
82
|
+
let t = p(w) ?? /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), t.getDate() + e);
|
|
83
|
+
k.current = !0, T(f(n)), D(new Date(n.getFullYear(), n.getMonth(), 1));
|
|
84
|
+
}, P = (e) => {
|
|
85
|
+
let t = {
|
|
86
|
+
ArrowLeft: -1,
|
|
87
|
+
ArrowRight: 1,
|
|
88
|
+
ArrowUp: -7,
|
|
89
|
+
ArrowDown: 7,
|
|
90
|
+
PageUp: -28,
|
|
91
|
+
PageDown: 28
|
|
92
|
+
}[e.key];
|
|
93
|
+
t !== void 0 && (e.preventDefault(), N(t));
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ d("div", {
|
|
96
|
+
ref: C,
|
|
97
|
+
className: g("ds-calendar", m),
|
|
98
|
+
...n(S),
|
|
99
|
+
children: [
|
|
100
|
+
/* @__PURE__ */ d("div", {
|
|
101
|
+
className: "ds-calendar__head",
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ u(t, {
|
|
104
|
+
variant: "simple",
|
|
105
|
+
size: "sm",
|
|
106
|
+
isIconOnly: !0,
|
|
107
|
+
iconStart: "chevron-left",
|
|
108
|
+
"aria-label": "Previous month",
|
|
109
|
+
onClick: () => M(-1)
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ u("span", {
|
|
112
|
+
className: "ds-calendar__month",
|
|
113
|
+
children: y(E)
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ u(t, {
|
|
116
|
+
variant: "simple",
|
|
117
|
+
size: "sm",
|
|
118
|
+
isIconOnly: !0,
|
|
119
|
+
iconStart: "chevron-right",
|
|
120
|
+
"aria-label": "Next month",
|
|
121
|
+
onClick: () => M(1)
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ u("div", {
|
|
126
|
+
className: "ds-calendar__weekdays",
|
|
127
|
+
"aria-hidden": "true",
|
|
128
|
+
children: _.map((e) => /* @__PURE__ */ u("span", { children: e.slice(0, 2) }, e))
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ u("div", {
|
|
131
|
+
ref: O,
|
|
132
|
+
className: "ds-calendar__grid",
|
|
133
|
+
role: "grid",
|
|
134
|
+
onKeyDown: P,
|
|
135
|
+
children: Array.from({ length: 6 }, (n, o) => /* @__PURE__ */ u("div", {
|
|
136
|
+
role: "row",
|
|
137
|
+
className: "ds-calendar__row",
|
|
138
|
+
children: A.slice(o * 7, o * 7 + 7).map((n) => {
|
|
139
|
+
let o = f(n), c = n.getMonth() !== E.getMonth(), l = a && o < a || s && o > s, d = !!(e && r && o > e && o < r), p = o === e || o === r;
|
|
140
|
+
return /* @__PURE__ */ u(t, {
|
|
141
|
+
variant: x(p, d, o === j),
|
|
142
|
+
size: "sm",
|
|
143
|
+
isIconOnly: !0,
|
|
144
|
+
role: "gridcell",
|
|
145
|
+
"aria-label": h(o),
|
|
146
|
+
tabIndex: o === w ? 0 : -1,
|
|
147
|
+
isDisabled: !!l,
|
|
148
|
+
"aria-selected": p || void 0,
|
|
149
|
+
"data-outside": c || void 0,
|
|
150
|
+
"data-today": o === j || void 0,
|
|
151
|
+
"data-in-range": d || void 0,
|
|
152
|
+
"data-focused": o === w || void 0,
|
|
153
|
+
className: "ds-calendar__day",
|
|
154
|
+
onClick: () => {
|
|
155
|
+
T(o), i?.(o);
|
|
156
|
+
},
|
|
157
|
+
children: n.getDate()
|
|
158
|
+
}, o);
|
|
159
|
+
})
|
|
160
|
+
}, o))
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
function C({ value: r, defaultValue: a = "", onValueChange: f, size: p = "md", placeholder: m = "Pick a date", placement: _, min: v, max: y, isDisabled: b = !1, isInvalid: x = !1, isClearable: C = !1, clearLabel: w = "Clear date", "aria-invalid": T, id: E, className: D, ...O }) {
|
|
166
|
+
let [k, A] = l(a), j = r ?? k, [M, N] = l(!1), P = c(null), F = c(null), I = c(null), L = s(), R = E ?? L;
|
|
167
|
+
return M && b && N(!1), o(() => {
|
|
168
|
+
if (!M) return;
|
|
169
|
+
let e = I.current;
|
|
170
|
+
(e?.querySelector("[data-focused]:not(:disabled)") ?? e)?.focus();
|
|
171
|
+
let t = (e) => {
|
|
172
|
+
let t = e.target;
|
|
173
|
+
!P.current?.contains(t) && !I.current?.contains(t) && N(!1);
|
|
174
|
+
};
|
|
175
|
+
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
176
|
+
}, [M]), /* @__PURE__ */ d("div", {
|
|
177
|
+
className: g("ds-datefield", D),
|
|
178
|
+
ref: P,
|
|
179
|
+
onKeyDown: (e) => {
|
|
180
|
+
M && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), N(!1), F.current?.focus());
|
|
181
|
+
},
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ d(t, {
|
|
184
|
+
...n(O),
|
|
185
|
+
ref: F,
|
|
186
|
+
id: R,
|
|
187
|
+
size: p,
|
|
188
|
+
"aria-haspopup": "dialog",
|
|
189
|
+
"aria-expanded": M,
|
|
190
|
+
"aria-invalid": x || T || void 0,
|
|
191
|
+
isDisabled: b,
|
|
192
|
+
"data-placeholder": j ? void 0 : "",
|
|
193
|
+
className: "ds-field-skin ds-datefield__control",
|
|
194
|
+
onClick: () => N((e) => !e),
|
|
195
|
+
children: [/* @__PURE__ */ u("span", {
|
|
196
|
+
className: "ds-datefield__value",
|
|
197
|
+
children: j ? h(j) : m
|
|
198
|
+
}), /* @__PURE__ */ u(e, {
|
|
199
|
+
name: "calendar",
|
|
200
|
+
size: 16,
|
|
201
|
+
className: "ds-datefield__glyph"
|
|
202
|
+
})]
|
|
203
|
+
}),
|
|
204
|
+
C && j && /* @__PURE__ */ u(t, {
|
|
205
|
+
variant: "simple",
|
|
206
|
+
size: p,
|
|
207
|
+
isIconOnly: !0,
|
|
208
|
+
iconStart: "x",
|
|
209
|
+
"aria-label": w,
|
|
210
|
+
isDisabled: b,
|
|
211
|
+
onClick: () => {
|
|
212
|
+
r === void 0 && A(""), f?.(""), N(!1), F.current?.focus();
|
|
213
|
+
}
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ u(i, {
|
|
216
|
+
anchorRef: F,
|
|
217
|
+
placement: _,
|
|
218
|
+
anchorId: R,
|
|
219
|
+
isOpen: M,
|
|
220
|
+
panelRef: I,
|
|
221
|
+
className: "ds-datefield__popover",
|
|
222
|
+
role: "dialog",
|
|
223
|
+
"aria-label": "Choose a date",
|
|
224
|
+
tabIndex: -1,
|
|
225
|
+
children: /* @__PURE__ */ u(S, {
|
|
226
|
+
value: j,
|
|
227
|
+
min: v,
|
|
228
|
+
max: y,
|
|
229
|
+
onSelect: (e) => {
|
|
230
|
+
r === void 0 && A(e), f?.(e), N(!1), F.current?.focus();
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function w(e, t, n) {
|
|
238
|
+
return p(e) ? t ? n === "min" ? e > t ? e : t : e < t ? e : t : e : t;
|
|
239
|
+
}
|
|
240
|
+
function T({ value: e, defaultValue: t = {
|
|
241
|
+
start: "",
|
|
242
|
+
end: ""
|
|
243
|
+
}, onValueChange: n, size: i = "md", min: a, max: o, isDisabled: s = !1, isClearable: c = !1, startLabel: f = "Start date", endLabel: p = "End date", placement: m, className: h, ..._ }) {
|
|
244
|
+
let [v, y] = l(t), b = e ?? v, x = (t) => {
|
|
245
|
+
e === void 0 && y(t), n?.(t);
|
|
246
|
+
}, { attributes: S } = r(_);
|
|
247
|
+
return /* @__PURE__ */ d("div", {
|
|
248
|
+
...S,
|
|
249
|
+
className: g("ds-daterange", h),
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ u(C, {
|
|
252
|
+
"aria-invalid": _["aria-invalid"],
|
|
253
|
+
"aria-label": f,
|
|
254
|
+
placement: m,
|
|
255
|
+
size: i,
|
|
256
|
+
value: b.start,
|
|
257
|
+
min: a,
|
|
258
|
+
max: w(b.end, o, "max"),
|
|
259
|
+
isDisabled: s,
|
|
260
|
+
isClearable: c,
|
|
261
|
+
clearLabel: `Clear ${f}`,
|
|
262
|
+
placeholder: f,
|
|
263
|
+
onValueChange: (e) => x({
|
|
264
|
+
...b,
|
|
265
|
+
start: e
|
|
266
|
+
})
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ u("span", {
|
|
269
|
+
className: "ds-daterange__dash",
|
|
270
|
+
"aria-hidden": "true",
|
|
271
|
+
children: "–"
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ u(C, {
|
|
274
|
+
"aria-invalid": _["aria-invalid"],
|
|
275
|
+
"aria-label": p,
|
|
276
|
+
placement: m,
|
|
277
|
+
size: i,
|
|
278
|
+
value: b.end,
|
|
279
|
+
min: w(b.start, a, "min"),
|
|
280
|
+
max: o,
|
|
281
|
+
isDisabled: s,
|
|
282
|
+
isClearable: c,
|
|
283
|
+
clearLabel: `Clear ${p}`,
|
|
284
|
+
placeholder: p,
|
|
285
|
+
onValueChange: (e) => x({
|
|
286
|
+
...b,
|
|
287
|
+
end: e
|
|
288
|
+
})
|
|
289
|
+
})
|
|
290
|
+
]
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
export { m as a, h as i, C as n, T as r, S as t };
|
|
295
|
+
|
|
296
|
+
//# sourceMappingURL=DatePicker-D_6CQpUd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker-D_6CQpUd.js","names":["Icon","toIso","month","date","day","fromIso","value","year","isIsoDate","formatIsoDate","cx","parts","WEEKDAYS","focusableDay","min","max","monthLabel","startOfGrid","first","weekday","dayVariant","isEdge","inRange","isToday","Calendar","forwardRef","rest","focused","setFocused","useState","setMonth","gridRef","useRef","shouldFocus","useEffect","next","days","start","index","today","changeMonth","delta","move","base","deltaDays","onKeyDown","event","className","omitRequired","Button","rowIndex","iso","isOutside","isDisabled","endValue","onSelect","DateField","ariaInvalid","internal","setInternal","defaultValue","current","isOpen","setOpen","rootRef","triggerRef","panelRef","generatedId","useId","triggerId","id","panel","onPointerDown","target","isInvalid","open","placeholder","isClearable","clearLabel","onValueChange","Popover","rangeBound","endpoint","bound","kind","DateRangeField","binding","commit","useGroupBinding","attributes","startLabel","endLabel"],"sources":["../../src/components/DatePicker/date.ts","../../src/components/DatePicker/index.tsx"],"sourcesContent":["/** ISO calendar date, \"YYYY-MM-DD\" — the only date shape the system passes around. */\nexport type IsoDate = string;\n\nexport function toIso(date: Date): IsoDate {\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function fromIso(value: string | undefined): Date | null {\n if (!value || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return null;\n }\n const [year, month, day] = value.split(\"-\").map(Number);\n if (!year || !month || !day) {\n return null;\n }\n const date = new Date(year, month - 1, day);\n return Number.isNaN(date.getTime()) || toIso(date) !== value ? null : date;\n}\n\n/** A real calendar day in \"YYYY-MM-DD\" form, checked without locale formatting. */\nexport function isIsoDate(value: string) {\n return fromIso(value) !== null;\n}\n\n/** \"12 March 2026\" — the system's one long date format. */\nexport function formatIsoDate(value: string | undefined): string {\n const date = fromIso(value);\n if (!date) {\n return \"\";\n }\n return date.toLocaleDateString(\"en-GB\", { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n","import { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { omitRequired, useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport { formatIsoDate, fromIso, toIso, type IsoDate } from \"./date\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport { formatIsoDate } from \"./date\";\nexport type { IsoDate } from \"./date\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst WEEKDAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n/** The selected day, or today when none is valid, moved inside the bounds so it can take focus. */\nfunction focusableDay(value: string | undefined, min?: IsoDate, max?: IsoDate): IsoDate {\n const day = fromIso(value) ? (value as IsoDate) : toIso(new Date());\n if (min && day < min) {\n return min;\n }\n return max && day > max ? max : day;\n}\n\nfunction monthLabel(date: Date) {\n return date.toLocaleDateString(\"en-GB\", { month: \"long\", year: \"numeric\" });\n}\n\nfunction startOfGrid(month: Date) {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const weekday = (first.getDay() + 6) % 7; // Monday-first\n return new Date(first.getFullYear(), first.getMonth(), 1 - weekday);\n}\n\nfunction dayVariant(isEdge: boolean, inRange: boolean, isToday: boolean) {\n if (isEdge) {\n return \"primary\";\n }\n if (inRange) {\n return \"active\";\n }\n return isToday ? \"neutral\" : \"simple\";\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Selected day, or the start of a selected span. */\n value?: IsoDate;\n /** End of a selected span. Set it to put the calendar in range mode. */\n endValue?: IsoDate;\n onSelect?: (value: IsoDate) => void;\n min?: IsoDate;\n max?: IsoDate;\n}\n\n/**\n * A month of days, Monday first. Arrow keys walk the grid; the month follows\n * the focused day, so a whole year is reachable from the keyboard.\n */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(function Calendar(\n { value, endValue, onSelect, min, max, className, ...rest },\n ref,\n) {\n const [focused, setFocused] = useState<IsoDate>(() => focusableDay(value, min, max));\n const [month, setMonth] = useState(() => fromIso(focused) ?? new Date());\n const gridRef = useRef<HTMLDivElement | null>(null);\n const shouldFocus = useRef(false);\n\n useEffect(() => {\n if (!fromIso(value)) {\n return;\n }\n const day = focusableDay(value, min, max);\n const next = fromIso(day) ?? new Date();\n // Controlled changes intentionally reposition the visible and roving-focus month.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setFocused(day);\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n }, [value, min, max]);\n\n useEffect(() => {\n if (!shouldFocus.current) {\n return;\n }\n shouldFocus.current = false;\n gridRef.current?.querySelector<HTMLButtonElement>(\"[data-focused]\")?.focus();\n }, [focused]);\n\n const days = Array.from({ length: 42 }, (_, index) => {\n const start = startOfGrid(month);\n return new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);\n });\n\n const today = toIso(new Date());\n\n const changeMonth = (delta: number) => {\n const next = new Date(month.getFullYear(), month.getMonth() + delta, 1);\n setMonth(next);\n setFocused(toIso(next));\n };\n\n const move = (deltaDays: number) => {\n const base = fromIso(focused) ?? new Date();\n const next = new Date(base.getFullYear(), base.getMonth(), base.getDate() + deltaDays);\n shouldFocus.current = true;\n setFocused(toIso(next));\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const steps: Record<string, number> = {\n ArrowLeft: -1,\n ArrowRight: 1,\n ArrowUp: -7,\n ArrowDown: 7,\n PageUp: -28,\n PageDown: 28,\n };\n const delta = steps[event.key];\n if (delta === undefined) {\n return;\n }\n event.preventDefault();\n move(delta);\n };\n\n return (\n <div\n ref={ref}\n className={cx(\"ds-calendar\", className)}\n {...omitRequired(rest)}\n >\n <div className=\"ds-calendar__head\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-left\"\n aria-label=\"Previous month\"\n onClick={() => changeMonth(-1)}\n />\n <span className=\"ds-calendar__month\">{monthLabel(month)}</span>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-right\"\n aria-label=\"Next month\"\n onClick={() => changeMonth(1)}\n />\n </div>\n <div\n className=\"ds-calendar__weekdays\"\n aria-hidden=\"true\"\n >\n {WEEKDAYS.map((day) => (\n <span key={day}>{day.slice(0, 2)}</span>\n ))}\n </div>\n <div\n ref={gridRef}\n className=\"ds-calendar__grid\"\n role=\"grid\"\n onKeyDown={onKeyDown}\n >\n {Array.from({ length: 6 }, (_, rowIndex) => (\n <div\n role=\"row\"\n className=\"ds-calendar__row\"\n key={rowIndex}\n >\n {days.slice(rowIndex * 7, rowIndex * 7 + 7).map((day) => {\n const iso = toIso(day);\n const isOutside = day.getMonth() !== month.getMonth();\n const isDisabled = (min && iso < min) || (max && iso > max);\n const inRange = Boolean(value && endValue && iso > value && iso < endValue);\n const isEdge = iso === value || iso === endValue;\n return (\n <Button\n key={iso}\n variant={dayVariant(isEdge, inRange, iso === today)}\n size=\"sm\"\n isIconOnly\n role=\"gridcell\"\n aria-label={formatIsoDate(iso)}\n tabIndex={iso === focused ? 0 : -1}\n isDisabled={Boolean(isDisabled)}\n aria-selected={isEdge || undefined}\n data-outside={isOutside || undefined}\n data-today={iso === today || undefined}\n data-in-range={inRange || undefined}\n data-focused={iso === focused || undefined}\n className=\"ds-calendar__day\"\n onClick={() => {\n setFocused(iso);\n onSelect?.(iso);\n }}\n >\n {day.getDate()}\n </Button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n});\n\nexport interface DateFieldProps extends FieldBinding {\n /** Preferred side; the shared Popover flips when space requires it. */\n placement?: PopoverPlacement;\n value?: IsoDate;\n defaultValue?: IsoDate;\n onValueChange?: (value: IsoDate) => void;\n size?: FieldSize;\n placeholder?: string;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Show a separate clear action when populated. Defaults to false. */\n isClearable?: boolean;\n clearLabel?: string;\n className?: string;\n}\n\n/** One day, picked from a calendar. The field prints the long date, never a mask. */\nexport function DateField({\n value,\n defaultValue = \"\",\n onValueChange,\n size = \"md\",\n placeholder = \"Pick a date\",\n placement,\n min,\n max,\n isDisabled = false,\n isInvalid = false,\n isClearable = false,\n clearLabel = \"Clear date\",\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n ...rest\n}: DateFieldProps) {\n const [internal, setInternal] = useState<IsoDate>(defaultValue);\n const current = value ?? internal;\n const [isOpen, setOpen] = useState(false);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const triggerId = id ?? generatedId;\n if (isOpen && isDisabled) {\n setOpen(false);\n }\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n // The roving day is always in bounds; the panel takes focus only if bounds exclude every day.\n const panel = panelRef.current;\n (panel?.querySelector<HTMLButtonElement>(\"[data-focused]:not(:disabled)\") ?? panel)?.focus();\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n }, [isOpen]);\n\n return (\n <div\n className={cx(\"ds-datefield\", className)}\n ref={rootRef}\n onKeyDown={(event) => {\n if (isOpen && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus();\n }\n }}\n >\n <Button\n {...omitRequired(rest)}\n ref={triggerRef}\n id={triggerId}\n size={size}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-invalid={isInvalid || ariaInvalid || undefined}\n isDisabled={isDisabled}\n data-placeholder={current ? undefined : \"\"}\n className=\"ds-field-skin ds-datefield__control\"\n onClick={() => setOpen((open) => !open)}\n >\n <span className=\"ds-datefield__value\">\n {current ? formatIsoDate(current) : placeholder}\n </span>\n <Icon\n name=\"calendar\"\n size={16}\n className=\"ds-datefield__glyph\"\n />\n </Button>\n {isClearable && current && (\n <Button\n variant=\"simple\"\n size={size}\n isIconOnly\n iconStart=\"x\"\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onClick={() => {\n if (value === undefined) {\n setInternal(\"\");\n }\n onValueChange?.(\"\");\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n )}\n <Popover\n anchorRef={triggerRef}\n placement={placement}\n anchorId={triggerId}\n isOpen={isOpen}\n panelRef={panelRef}\n className=\"ds-datefield__popover\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n // A click on the heading or padding focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n >\n <Calendar\n value={current}\n min={min}\n max={max}\n onSelect={(next) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n </Popover>\n </div>\n );\n}\n\nexport interface DateRangeValue {\n start: IsoDate;\n end: IsoDate;\n}\n\nexport interface DateRangeFieldProps extends FieldBinding {\n placement?: PopoverPlacement;\n value?: DateRangeValue;\n defaultValue?: DateRangeValue;\n onValueChange?: (value: DateRangeValue) => void;\n size?: FieldSize;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isClearable?: boolean;\n startLabel?: string;\n endLabel?: string;\n className?: string;\n}\n\nfunction rangeBound(endpoint: string, bound: string | undefined, kind: \"min\" | \"max\") {\n if (!fromIso(endpoint)) {\n return bound;\n }\n if (!bound) {\n return endpoint;\n }\n return kind === \"min\"\n ? endpoint > bound\n ? endpoint\n : bound\n : endpoint < bound\n ? endpoint\n : bound;\n}\n\n/** A span of days. The end field never offers a day before the start. */\nexport function DateRangeField({\n value,\n defaultValue = { start: \"\", end: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n isDisabled = false,\n isClearable = false,\n startLabel = \"Start date\",\n endLabel = \"End date\",\n placement,\n className,\n ...binding\n}: DateRangeFieldProps) {\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: DateRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-daterange\", className)}\n >\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={startLabel}\n placement={placement}\n size={size}\n value={current.start}\n min={min}\n max={rangeBound(current.end, max, \"max\")}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${startLabel}`}\n placeholder={startLabel}\n onValueChange={(next) => commit({ ...current, start: next })}\n />\n <span\n className=\"ds-daterange__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={endLabel}\n placement={placement}\n size={size}\n value={current.end}\n min={rangeBound(current.start, min, \"min\")}\n max={max}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${endLabel}`}\n placeholder={endLabel}\n onValueChange={(next) => commit({ ...current, end: next })}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAGA,SAAgBC,EAAM,GAAqB;CACzC,IAAMC,IAAQ,GAAGC,EAAK,SAAS,IAAI,IAAI,SAAS,GAAG,GAAG,GAChDC,IAAM,GAAGD,EAAK,QAAQ,IAAI,SAAS,GAAG,GAAG;CAC/C,OAAO,GAAGA,EAAK,YAAY,EAAE,GAAGD,EAAM,GAAGE;AAC3C;AAEA,SAAgBC,EAAQ,GAAwC;CAC9D,IAAI,CAACC,KAAS,CAAC,sBAAsB,KAAKA,CAAK,GAC7C,OAAO;CAET,IAAM,CAACC,GAAML,GAAOE,K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9C,GAAK,KAAK;IAC3B;IACC;IACb,YAAY,SAAS2E;IACrB,aAAaA;IACb,gBAAgB,MAASH,EAAO;KAAE,GAAG1B;KAAS,OAAO1B;IAAK,CAAC;GAC5D,CAAA;GACD,kBAAC,QAAD;IACE,WAAU;IACV,eAAY;IACb,UAAA;GAEK,CAAA;GACN,kBAACqB,GAAD;IACE,gBAAc8B,EAAQ;IACtB,cAAYK;IACD;IACL;IACN,OAAO9B,EAAQ;IACf,KAAKoB,EAAWpB,EAAQ,OAAO/C,GAAK,KAAK;IACpC;IACO;IACC;IACb,YAAY,SAAS6E;IACrB,aAAaA;IACb,gBAAgB,MAASJ,EAAO;KAAE,GAAG1B;KAAS,KAAK1B;IAAK,CAAC;GAC1D,CAAA;EACE;;AAET"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./Icon-BBoWP_Y6.cjs"),t=require("../components/Button/index.cjs");;/* empty css */const n=require("./binding-tMjrUzkU.cjs"),r=require("../components/Popover/index.cjs");let i=require("react"),a=require("react/jsx-runtime");function o(e){let t=`${e.getMonth()+1}`.padStart(2,`0`),n=`${e.getDate()}`.padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function s(e){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let[t,n,r]=e.split(`-`).map(Number);if(!t||!n||!r)return null;let i=new Date(t,n-1,r);return Number.isNaN(i.getTime())||o(i)!==e?null:i}function c(e){return s(e)!==null}function l(e){let t=s(e);return t?t.toLocaleDateString(`en-GB`,{day:`numeric`,month:`long`,year:`numeric`}):``}function u(...e){return e.filter(Boolean).join(` `)}var d=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`];function f(e,t,n){let r=s(e)?e:o(new Date);return t&&r<t?t:n&&r>n?n:r}function p(e){return e.toLocaleDateString(`en-GB`,{month:`long`,year:`numeric`})}function m(e){let t=new Date(e.getFullYear(),e.getMonth(),1),n=(t.getDay()+6)%7;return new Date(t.getFullYear(),t.getMonth(),1-n)}function h(e,t,n){return e?`primary`:t?`active`:n?`neutral`:`simple`}var g=(0,i.forwardRef)(function({value:e,endValue:r,onSelect:c,min:g,max:_,className:v,...y},b){let[x,S]=(0,i.useState)(()=>f(e,g,_)),[C,w]=(0,i.useState)(()=>s(x)??new Date),T=(0,i.useRef)(null),E=(0,i.useRef)(!1);(0,i.useEffect)(()=>{if(!s(e))return;let t=f(e,g,_),n=s(t)??new Date;S(t),w(new Date(n.getFullYear(),n.getMonth(),1))},[e,g,_]),(0,i.useEffect)(()=>{E.current&&(E.current=!1,T.current?.querySelector(`[data-focused]`)?.focus())},[x]);let D=Array.from({length:42},(e,t)=>{let n=m(C);return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t)}),O=o(new Date),k=e=>{let t=new Date(C.getFullYear(),C.getMonth()+e,1);w(t),S(o(t))},A=e=>{let t=s(x)??new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+e);E.current=!0,S(o(n)),w(new Date(n.getFullYear(),n.getMonth(),1))},j=e=>{let t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,PageUp:-28,PageDown:28}[e.key];t!==void 0&&(e.preventDefault(),A(t))};return(0,a.jsxs)(`div`,{ref:b,className:u(`ds-calendar`,v),...n.n(y),children:[(0,a.jsxs)(`div`,{className:`ds-calendar__head`,children:[(0,a.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`chevron-left`,"aria-label":`Previous month`,onClick:()=>k(-1)}),(0,a.jsx)(`span`,{className:`ds-calendar__month`,children:p(C)}),(0,a.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`chevron-right`,"aria-label":`Next month`,onClick:()=>k(1)})]}),(0,a.jsx)(`div`,{className:`ds-calendar__weekdays`,"aria-hidden":`true`,children:d.map(e=>(0,a.jsx)(`span`,{children:e.slice(0,2)},e))}),(0,a.jsx)(`div`,{ref:T,className:`ds-calendar__grid`,role:`grid`,onKeyDown:j,children:Array.from({length:6},(n,i)=>(0,a.jsx)(`div`,{role:`row`,className:`ds-calendar__row`,children:D.slice(i*7,i*7+7).map(n=>{let i=o(n),s=n.getMonth()!==C.getMonth(),u=g&&i<g||_&&i>_,d=!!(e&&r&&i>e&&i<r),f=i===e||i===r;return(0,a.jsx)(t.Button,{variant:h(f,d,i===O),size:`sm`,isIconOnly:!0,role:`gridcell`,"aria-label":l(i),tabIndex:i===x?0:-1,isDisabled:!!u,"aria-selected":f||void 0,"data-outside":s||void 0,"data-today":i===O||void 0,"data-in-range":d||void 0,"data-focused":i===x||void 0,className:`ds-calendar__day`,onClick:()=>{S(i),c?.(i)},children:n.getDate()},i)})},i))})]})});function _({value:o,defaultValue:s=``,onValueChange:c,size:d=`md`,placeholder:f=`Pick a date`,placement:p,min:m,max:h,isDisabled:_=!1,isInvalid:v=!1,isClearable:y=!1,clearLabel:b=`Clear date`,"aria-invalid":x,id:S,className:C,...w}){let[T,E]=(0,i.useState)(s),D=o??T,[O,k]=(0,i.useState)(!1),A=(0,i.useRef)(null),j=(0,i.useRef)(null),M=(0,i.useRef)(null),N=(0,i.useId)(),P=S??N;return O&&_&&k(!1),(0,i.useEffect)(()=>{if(!O)return;let e=M.current;(e?.querySelector(`[data-focused]:not(:disabled)`)??e)?.focus();let t=e=>{let t=e.target;!A.current?.contains(t)&&!M.current?.contains(t)&&k(!1)};return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[O]),(0,a.jsxs)(`div`,{className:u(`ds-datefield`,C),ref:A,onKeyDown:e=>{O&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),k(!1),j.current?.focus())},children:[(0,a.jsxs)(t.Button,{...n.n(w),ref:j,id:P,size:d,"aria-haspopup":`dialog`,"aria-expanded":O,"aria-invalid":v||x||void 0,isDisabled:_,"data-placeholder":D?void 0:``,className:`ds-field-skin ds-datefield__control`,onClick:()=>k(e=>!e),children:[(0,a.jsx)(`span`,{className:`ds-datefield__value`,children:D?l(D):f}),(0,a.jsx)(e.t,{name:`calendar`,size:16,className:`ds-datefield__glyph`})]}),y&&D&&(0,a.jsx)(t.Button,{variant:`simple`,size:d,isIconOnly:!0,iconStart:`x`,"aria-label":b,isDisabled:_,onClick:()=>{o===void 0&&E(``),c?.(``),k(!1),j.current?.focus()}}),(0,a.jsx)(r.Popover,{anchorRef:j,placement:p,anchorId:P,isOpen:O,panelRef:M,className:`ds-datefield__popover`,role:`dialog`,"aria-label":`Choose a date`,tabIndex:-1,children:(0,a.jsx)(g,{value:D,min:m,max:h,onSelect:e=>{o===void 0&&E(e),c?.(e),k(!1),j.current?.focus()}})})]})}function v(e,t,n){return s(e)?t?n===`min`?e>t?e:t:e<t?e:t:e:t}function y({value:e,defaultValue:t={start:``,end:``},onValueChange:r,size:o=`md`,min:s,max:c,isDisabled:l=!1,isClearable:d=!1,startLabel:f=`Start date`,endLabel:p=`End date`,placement:m,className:h,...g}){let[y,b]=(0,i.useState)(t),x=e??y,S=t=>{e===void 0&&b(t),r?.(t)},{attributes:C}=n.r(g);return(0,a.jsxs)(`div`,{...C,className:u(`ds-daterange`,h),children:[(0,a.jsx)(_,{"aria-invalid":g[`aria-invalid`],"aria-label":f,placement:m,size:o,value:x.start,min:s,max:v(x.end,c,`max`),isDisabled:l,isClearable:d,clearLabel:`Clear ${f}`,placeholder:f,onValueChange:e=>S({...x,start:e})}),(0,a.jsx)(`span`,{className:`ds-daterange__dash`,"aria-hidden":`true`,children:`–`}),(0,a.jsx)(_,{"aria-invalid":g[`aria-invalid`],"aria-label":p,placement:m,size:o,value:x.end,min:v(x.start,s,`min`),max:c,isDisabled:l,isClearable:d,clearLabel:`Clear ${p}`,placeholder:p,onValueChange:e=>S({...x,end:e})})]})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return g}});
|
|
2
|
+
//# sourceMappingURL=DatePicker-aSlYLjtW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker-aSlYLjtW.cjs","names":["forwardRef","useState","useRef","omitRequired","Button","useId","Icon","Popover","useGroupBinding","require_Icon","require_components_Button_index","require_binding","require_components_Popover_index","react","react_jsx_runtime","toIso","month","date","day","fromIso","value","year","isIsoDate","formatIsoDate","cx","parts","WEEKDAYS","focusableDay","min","max","monthLabel","startOfGrid","first","weekday","dayVariant","isEdge","inRange","isToday","Calendar","rest","focused","setFocused","setMonth","gridRef","shouldFocus","next","days","start","index","today","changeMonth","delta","move","base","deltaDays","onKeyDown","event","className","rowIndex","iso","isOutside","isDisabled","endValue","onSelect","DateField","ariaInvalid","internal","setInternal","defaultValue","current","isOpen","setOpen","rootRef","triggerRef","panelRef","generatedId","triggerId","id","panel","onPointerDown","target","isInvalid","open","placeholder","isClearable","clearLabel","onValueChange","rangeBound","endpoint","bound","kind","DateRangeField","binding","commit","attributes","startLabel","endLabel"],"sources":["../../src/components/DatePicker/date.ts","../../src/components/DatePicker/index.tsx"],"sourcesContent":["/** ISO calendar date, \"YYYY-MM-DD\" — the only date shape the system passes around. */\nexport type IsoDate = string;\n\nexport function toIso(date: Date): IsoDate {\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function fromIso(value: string | undefined): Date | null {\n if (!value || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return null;\n }\n const [year, month, day] = value.split(\"-\").map(Number);\n if (!year || !month || !day) {\n return null;\n }\n const date = new Date(year, month - 1, day);\n return Number.isNaN(date.getTime()) || toIso(date) !== value ? null : date;\n}\n\n/** A real calendar day in \"YYYY-MM-DD\" form, checked without locale formatting. */\nexport function isIsoDate(value: string) {\n return fromIso(value) !== null;\n}\n\n/** \"12 March 2026\" — the system's one long date format. */\nexport function formatIsoDate(value: string | undefined): string {\n const date = fromIso(value);\n if (!date) {\n return \"\";\n }\n return date.toLocaleDateString(\"en-GB\", { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n","import { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { omitRequired, useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport { formatIsoDate, fromIso, toIso, type IsoDate } from \"./date\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport { formatIsoDate } from \"./date\";\nexport type { IsoDate } from \"./date\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst WEEKDAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n/** The selected day, or today when none is valid, moved inside the bounds so it can take focus. */\nfunction focusableDay(value: string | undefined, min?: IsoDate, max?: IsoDate): IsoDate {\n const day = fromIso(value) ? (value as IsoDate) : toIso(new Date());\n if (min && day < min) {\n return min;\n }\n return max && day > max ? max : day;\n}\n\nfunction monthLabel(date: Date) {\n return date.toLocaleDateString(\"en-GB\", { month: \"long\", year: \"numeric\" });\n}\n\nfunction startOfGrid(month: Date) {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const weekday = (first.getDay() + 6) % 7; // Monday-first\n return new Date(first.getFullYear(), first.getMonth(), 1 - weekday);\n}\n\nfunction dayVariant(isEdge: boolean, inRange: boolean, isToday: boolean) {\n if (isEdge) {\n return \"primary\";\n }\n if (inRange) {\n return \"active\";\n }\n return isToday ? \"neutral\" : \"simple\";\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Selected day, or the start of a selected span. */\n value?: IsoDate;\n /** End of a selected span. Set it to put the calendar in range mode. */\n endValue?: IsoDate;\n onSelect?: (value: IsoDate) => void;\n min?: IsoDate;\n max?: IsoDate;\n}\n\n/**\n * A month of days, Monday first. Arrow keys walk the grid; the month follows\n * the focused day, so a whole year is reachable from the keyboard.\n */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(function Calendar(\n { value, endValue, onSelect, min, max, className, ...rest },\n ref,\n) {\n const [focused, setFocused] = useState<IsoDate>(() => focusableDay(value, min, max));\n const [month, setMonth] = useState(() => fromIso(focused) ?? new Date());\n const gridRef = useRef<HTMLDivElement | null>(null);\n const shouldFocus = useRef(false);\n\n useEffect(() => {\n if (!fromIso(value)) {\n return;\n }\n const day = focusableDay(value, min, max);\n const next = fromIso(day) ?? new Date();\n // Controlled changes intentionally reposition the visible and roving-focus month.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setFocused(day);\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n }, [value, min, max]);\n\n useEffect(() => {\n if (!shouldFocus.current) {\n return;\n }\n shouldFocus.current = false;\n gridRef.current?.querySelector<HTMLButtonElement>(\"[data-focused]\")?.focus();\n }, [focused]);\n\n const days = Array.from({ length: 42 }, (_, index) => {\n const start = startOfGrid(month);\n return new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);\n });\n\n const today = toIso(new Date());\n\n const changeMonth = (delta: number) => {\n const next = new Date(month.getFullYear(), month.getMonth() + delta, 1);\n setMonth(next);\n setFocused(toIso(next));\n };\n\n const move = (deltaDays: number) => {\n const base = fromIso(focused) ?? new Date();\n const next = new Date(base.getFullYear(), base.getMonth(), base.getDate() + deltaDays);\n shouldFocus.current = true;\n setFocused(toIso(next));\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const steps: Record<string, number> = {\n ArrowLeft: -1,\n ArrowRight: 1,\n ArrowUp: -7,\n ArrowDown: 7,\n PageUp: -28,\n PageDown: 28,\n };\n const delta = steps[event.key];\n if (delta === undefined) {\n return;\n }\n event.preventDefault();\n move(delta);\n };\n\n return (\n <div\n ref={ref}\n className={cx(\"ds-calendar\", className)}\n {...omitRequired(rest)}\n >\n <div className=\"ds-calendar__head\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-left\"\n aria-label=\"Previous month\"\n onClick={() => changeMonth(-1)}\n />\n <span className=\"ds-calendar__month\">{monthLabel(month)}</span>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-right\"\n aria-label=\"Next month\"\n onClick={() => changeMonth(1)}\n />\n </div>\n <div\n className=\"ds-calendar__weekdays\"\n aria-hidden=\"true\"\n >\n {WEEKDAYS.map((day) => (\n <span key={day}>{day.slice(0, 2)}</span>\n ))}\n </div>\n <div\n ref={gridRef}\n className=\"ds-calendar__grid\"\n role=\"grid\"\n onKeyDown={onKeyDown}\n >\n {Array.from({ length: 6 }, (_, rowIndex) => (\n <div\n role=\"row\"\n className=\"ds-calendar__row\"\n key={rowIndex}\n >\n {days.slice(rowIndex * 7, rowIndex * 7 + 7).map((day) => {\n const iso = toIso(day);\n const isOutside = day.getMonth() !== month.getMonth();\n const isDisabled = (min && iso < min) || (max && iso > max);\n const inRange = Boolean(value && endValue && iso > value && iso < endValue);\n const isEdge = iso === value || iso === endValue;\n return (\n <Button\n key={iso}\n variant={dayVariant(isEdge, inRange, iso === today)}\n size=\"sm\"\n isIconOnly\n role=\"gridcell\"\n aria-label={formatIsoDate(iso)}\n tabIndex={iso === focused ? 0 : -1}\n isDisabled={Boolean(isDisabled)}\n aria-selected={isEdge || undefined}\n data-outside={isOutside || undefined}\n data-today={iso === today || undefined}\n data-in-range={inRange || undefined}\n data-focused={iso === focused || undefined}\n className=\"ds-calendar__day\"\n onClick={() => {\n setFocused(iso);\n onSelect?.(iso);\n }}\n >\n {day.getDate()}\n </Button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n});\n\nexport interface DateFieldProps extends FieldBinding {\n /** Preferred side; the shared Popover flips when space requires it. */\n placement?: PopoverPlacement;\n value?: IsoDate;\n defaultValue?: IsoDate;\n onValueChange?: (value: IsoDate) => void;\n size?: FieldSize;\n placeholder?: string;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Show a separate clear action when populated. Defaults to false. */\n isClearable?: boolean;\n clearLabel?: string;\n className?: string;\n}\n\n/** One day, picked from a calendar. The field prints the long date, never a mask. */\nexport function DateField({\n value,\n defaultValue = \"\",\n onValueChange,\n size = \"md\",\n placeholder = \"Pick a date\",\n placement,\n min,\n max,\n isDisabled = false,\n isInvalid = false,\n isClearable = false,\n clearLabel = \"Clear date\",\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n ...rest\n}: DateFieldProps) {\n const [internal, setInternal] = useState<IsoDate>(defaultValue);\n const current = value ?? internal;\n const [isOpen, setOpen] = useState(false);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const triggerId = id ?? generatedId;\n if (isOpen && isDisabled) {\n setOpen(false);\n }\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n // The roving day is always in bounds; the panel takes focus only if bounds exclude every day.\n const panel = panelRef.current;\n (panel?.querySelector<HTMLButtonElement>(\"[data-focused]:not(:disabled)\") ?? panel)?.focus();\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n }, [isOpen]);\n\n return (\n <div\n className={cx(\"ds-datefield\", className)}\n ref={rootRef}\n onKeyDown={(event) => {\n if (isOpen && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus();\n }\n }}\n >\n <Button\n {...omitRequired(rest)}\n ref={triggerRef}\n id={triggerId}\n size={size}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-invalid={isInvalid || ariaInvalid || undefined}\n isDisabled={isDisabled}\n data-placeholder={current ? undefined : \"\"}\n className=\"ds-field-skin ds-datefield__control\"\n onClick={() => setOpen((open) => !open)}\n >\n <span className=\"ds-datefield__value\">\n {current ? formatIsoDate(current) : placeholder}\n </span>\n <Icon\n name=\"calendar\"\n size={16}\n className=\"ds-datefield__glyph\"\n />\n </Button>\n {isClearable && current && (\n <Button\n variant=\"simple\"\n size={size}\n isIconOnly\n iconStart=\"x\"\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onClick={() => {\n if (value === undefined) {\n setInternal(\"\");\n }\n onValueChange?.(\"\");\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n )}\n <Popover\n anchorRef={triggerRef}\n placement={placement}\n anchorId={triggerId}\n isOpen={isOpen}\n panelRef={panelRef}\n className=\"ds-datefield__popover\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n // A click on the heading or padding focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n >\n <Calendar\n value={current}\n min={min}\n max={max}\n onSelect={(next) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n </Popover>\n </div>\n );\n}\n\nexport interface DateRangeValue {\n start: IsoDate;\n end: IsoDate;\n}\n\nexport interface DateRangeFieldProps extends FieldBinding {\n placement?: PopoverPlacement;\n value?: DateRangeValue;\n defaultValue?: DateRangeValue;\n onValueChange?: (value: DateRangeValue) => void;\n size?: FieldSize;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isClearable?: boolean;\n startLabel?: string;\n endLabel?: string;\n className?: string;\n}\n\nfunction rangeBound(endpoint: string, bound: string | undefined, kind: \"min\" | \"max\") {\n if (!fromIso(endpoint)) {\n return bound;\n }\n if (!bound) {\n return endpoint;\n }\n return kind === \"min\"\n ? endpoint > bound\n ? endpoint\n : bound\n : endpoint < bound\n ? endpoint\n : bound;\n}\n\n/** A span of days. The end field never offers a day before the start. */\nexport function DateRangeField({\n value,\n defaultValue = { start: \"\", end: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n isDisabled = false,\n isClearable = false,\n startLabel = \"Start date\",\n endLabel = \"End date\",\n placement,\n className,\n ...binding\n}: DateRangeFieldProps) {\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: DateRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-daterange\", className)}\n >\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={startLabel}\n placement={placement}\n size={size}\n value={current.start}\n min={min}\n max={rangeBound(current.end, max, \"max\")}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${startLabel}`}\n placeholder={startLabel}\n onValueChange={(next) => commit({ ...current, start: next })}\n />\n <span\n className=\"ds-daterange__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={endLabel}\n placement={placement}\n size={size}\n value={current.end}\n min={rangeBound(current.start, min, \"min\")}\n max={max}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${endLabel}`}\n placeholder={endLabel}\n onValueChange={(next) => commit({ ...current, end: next })}\n />\n </div>\n );\n}\n"],"mappings":"A,gQAGA,SAAgBe,EAAM,EAAqB,CACzC,IAAMC,EAAQ,GAAGC,EAAK,SAAS,EAAI,IAAI,SAAS,EAAG,GAAG,EAChDC,EAAM,GAAGD,EAAK,QAAQ,IAAI,SAAS,EAAG,GAAG,EAC/C,MAAO,GAAGA,EAAK,YAAY,EAAE,GAAGD,EAAM,GAAGE,GAC3C,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