minerva-design 1.0.0 → 1.0.2
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/CHANGELOG.md +12 -0
- package/custom-elements.json +663 -0
- package/dist/angular/fesm2022/minerva-angular.mjs +1163 -34
- package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
- package/dist/angular/types/minerva-angular.d.ts +237 -1
- package/dist/core/calendar-date.d.cts +5 -0
- package/dist/core/calendar-date.d.ts +5 -0
- package/dist/core/contracts.cjs +1 -1
- package/dist/core/contracts.cjs.map +1 -1
- package/dist/core/contracts.js +1 -1
- package/dist/core/contracts.js.map +1 -1
- package/dist/core/index.cjs +6 -6
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +671 -630
- package/dist/core/index.js.map +1 -1
- package/dist/core/styling-hooks/components/date-picker.d.cts +45 -0
- package/dist/core/styling-hooks/components/date-picker.d.ts +45 -0
- package/dist/core/styling-hooks/manifest.d.cts +44 -0
- package/dist/core/styling-hooks/manifest.d.ts +44 -0
- package/dist/core/styling-hooks.cjs +1 -1
- package/dist/core/styling-hooks.cjs.map +1 -1
- package/dist/core/styling-hooks.js +62 -0
- package/dist/core/styling-hooks.js.map +1 -1
- package/dist/native/components/Calendar/Calendar.cjs +1 -1
- package/dist/native/components/Calendar/Calendar.cjs.map +1 -1
- package/dist/native/components/Calendar/Calendar.d.cts +2 -0
- package/dist/native/components/Calendar/Calendar.d.ts +2 -0
- package/dist/native/components/Calendar/Calendar.js +115 -112
- package/dist/native/components/Calendar/Calendar.js.map +1 -1
- package/dist/native/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/native/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/native/components/Checkbox/Checkbox.js +8 -8
- package/dist/native/components/Checkbox/CheckboxGroup.cjs +1 -1
- package/dist/native/components/Checkbox/CheckboxGroup.cjs.map +1 -1
- package/dist/native/components/Checkbox/CheckboxGroup.js +6 -6
- package/dist/native/components/DatePicker/DatePicker.cjs +2 -0
- package/dist/native/components/DatePicker/DatePicker.cjs.map +1 -0
- package/dist/native/components/DatePicker/DatePicker.d.cts +40 -0
- package/dist/native/components/DatePicker/DatePicker.d.ts +40 -0
- package/dist/native/components/DatePicker/DatePicker.js +110 -0
- package/dist/native/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/native/components/DatePicker/index.cjs +1 -0
- package/dist/native/components/DatePicker/index.d.cts +2 -0
- package/dist/native/components/DatePicker/index.d.ts +2 -0
- package/dist/native/components/DatePicker/index.js +2 -0
- package/dist/native/components/Radio/RadioGroup.cjs +1 -1
- package/dist/native/components/Radio/RadioGroup.cjs.map +1 -1
- package/dist/native/components/Radio/RadioGroup.js +9 -9
- package/dist/native/components/Switch/Switch.cjs +1 -1
- package/dist/native/components/Switch/Switch.cjs.map +1 -1
- package/dist/native/components/Switch/Switch.js +23 -23
- package/dist/native/components/Switch/Switch.js.map +1 -1
- package/dist/native/index.cjs +1 -1
- package/dist/native/index.d.cts +1 -0
- package/dist/native/index.d.ts +1 -0
- package/dist/native/index.js +70 -68
- package/dist/native/source/components/Calendar/Calendar.tsx +14 -6
- package/dist/native/source/components/DatePicker/DatePicker.tsx +201 -0
- package/dist/native/source/components/DatePicker/index.ts +2 -0
- package/dist/native/source/index.ts +1 -0
- package/dist/native/source/manifest.ts +6 -0
- package/dist/react/components/DatePicker/DatePicker.cjs +2 -0
- package/dist/react/components/DatePicker/DatePicker.cjs.map +1 -0
- package/dist/react/components/DatePicker/DatePicker.d.cts +13 -0
- package/dist/react/components/DatePicker/DatePicker.d.ts +13 -0
- package/dist/react/components/DatePicker/DatePicker.js +315 -0
- package/dist/react/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.cjs +2 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.cjs.map +1 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.js +23 -0
- package/dist/react/components/DatePicker/datePicker.module.scss.js.map +1 -0
- package/dist/react/components/DatePicker/index.cjs +1 -0
- package/dist/react/components/DatePicker/index.d.cts +5 -0
- package/dist/react/components/DatePicker/index.d.ts +5 -0
- package/dist/react/components/DatePicker/index.js +3 -0
- package/dist/react/components/DatePicker/types.d.cts +97 -0
- package/dist/react/components/DatePicker/types.d.ts +97 -0
- package/dist/react/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/react/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/react/components/Tooltip/Tooltip.js +5 -5
- package/dist/react/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/react/components/index.cjs +1 -1
- package/dist/react/components/index.d.cts +1 -0
- package/dist/react/components/index.d.ts +1 -0
- package/dist/react/components/index.js +3 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +7 -6
- package/dist/react/style.css +1 -0
- package/dist/react/styles/date-picker.css +7 -0
- package/dist/taro/date-picker.d.ts +20 -0
- package/dist/taro/index.d.ts +1 -0
- package/dist/taro/index.js +1155 -990
- package/dist/uni/DatePicker.vue +225 -0
- package/dist/uni/DatePicker.vue.d.ts +36 -0
- package/dist/uni/MonthCalendar.vue +2 -0
- package/dist/uni/MonthCalendar.vue.d.ts +2 -0
- package/dist/uni/index.d.ts +1 -0
- package/dist/uni/index.js +1 -0
- package/dist/uni/manifest.d.ts +7 -0
- package/dist/uni/manifest.js +8 -0
- package/dist/vue/components/DatePicker/DatePicker.vue.d.ts +36 -0
- package/dist/vue/components/DatePicker/DatePicker.vue.js +7 -0
- package/dist/vue/components/DatePicker/DatePicker.vue.js.map +1 -0
- package/dist/vue/components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js +380 -0
- package/dist/vue/components/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/vue/components/DatePicker/index.d.ts +2 -0
- package/dist/vue/components/DatePicker/index.js +2 -0
- package/dist/vue/components/DatePicker/types.d.ts +26 -0
- package/dist/vue/components/MonthCalendar/MonthCalendar.vue.d.ts +1 -1
- package/dist/vue/global.d.ts +108 -0
- package/dist/vue/groups/forms-pickers.d.ts +1 -0
- package/dist/vue/groups/forms-pickers.js +5 -2
- package/dist/vue/groups/forms-pickers.js.map +1 -1
- package/dist/vue/index.js +95 -94
- package/dist/weapp/controls.js +259 -76
- package/dist/weapp/date-picker/index.js +1 -0
- package/dist/weapp/date-picker/index.json +1 -0
- package/dist/weapp/date-picker/index.wxml +1 -0
- package/dist/weapp/date-picker/index.wxss +1 -0
- package/dist/weapp/types.d.ts +19 -0
- package/dist/web-components/cdn/minerva.js +461 -335
- package/dist/web-components/cdn/minerva.js.map +1 -1
- package/dist/web-components/components/date-picker/date-picker.d.ts +110 -0
- package/dist/web-components/components/date-picker/date-picker.js +378 -0
- package/dist/web-components/components/date-picker/date-picker.js.map +1 -0
- package/dist/web-components/elements/date-picker.d.ts +1 -0
- package/dist/web-components/elements/date-picker.js +8 -0
- package/dist/web-components/elements/date-picker.js.map +1 -0
- package/dist/web-components/html-custom-data.json +85 -0
- package/dist/web-components/index.d.ts +1 -0
- package/dist/web-components/index.js +8 -6
- package/dist/web-components/styles/DatePicker/datePicker.css.js +6 -0
- package/dist/web-components/styles/DatePicker/datePicker.css.js.map +1 -0
- package/dist/web-components/types/react.d.ts +12 -0
- package/dist/web-components/types/solid.d.ts +9 -0
- package/dist/web-components/types/svelte.d.ts +9 -0
- package/dist/web-components/types/vue.d.ts +10 -0
- package/package.json +9 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils/cn.js";
|
|
3
|
+
import t from "../../hooks/useI18n.js";
|
|
4
|
+
import { hooks as n } from "../../internal/stylingHooks.js";
|
|
5
|
+
import { warnControlledProps as r } from "../../internal/devWarnings.js";
|
|
6
|
+
import { IconCalendar as i, IconChevronLeft as a, IconChevronRight as ee, IconX as te } from "../../internal/icons.js";
|
|
7
|
+
import { useMergedRefs as ne } from "../../internal/mergeRefs.js";
|
|
8
|
+
import { pickDataAttributes as re } from "../../internal/dataAttributes.js";
|
|
9
|
+
import { useControllableState as ie } from "../../internal/useControllableState.js";
|
|
10
|
+
import { FormControlContext as ae, useFormControlContext as oe, useFormControlProps as se } from "../FormControl/context.js";
|
|
11
|
+
import { useLayerParent as ce } from "../../internal/useDismissableLayer.js";
|
|
12
|
+
import { logicalArrowKey as le } from "../../internal/direction.js";
|
|
13
|
+
import { FloatingPanel as ue } from "../../internal/FloatingPanel.js";
|
|
14
|
+
import de from "../IconButton/IconButton.js";
|
|
15
|
+
import "../IconButton/index.js";
|
|
16
|
+
import { Input as fe } from "../Input/Input.js";
|
|
17
|
+
import "../Input/index.js";
|
|
18
|
+
import { adjacentTabbable as pe, tabLeavesPanel as me } from "../../internal/tabbing.js";
|
|
19
|
+
import o from "./datePicker.module.scss.js";
|
|
20
|
+
import s, { useEffect as he, useId as ge, useRef as c, useState as l } from "react";
|
|
21
|
+
import { addDays as u, dayKey as d, localDate as _e, monthStart as f, parseDayKey as p, sameMonth as m } from "../../../core/index.js";
|
|
22
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
23
|
+
//#region src/components/DatePicker/DatePicker.tsx
|
|
24
|
+
var ve = [
|
|
25
|
+
"mon",
|
|
26
|
+
"tue",
|
|
27
|
+
"wed",
|
|
28
|
+
"thu",
|
|
29
|
+
"fri",
|
|
30
|
+
"sat",
|
|
31
|
+
"sun"
|
|
32
|
+
], _ = ({ ref: s, value: _, defaultValue: v, onChange: y, placeholder: ye, label: b, "aria-label": x, "aria-labelledby": be, "aria-describedby": xe, id: Se, required: Ce, readOnly: we, invalid: Te, name: Ee = "date-picker", disabled: De, clearable: S = !0, size: C = "medium", minDate: w, maxDate: T, locale: Oe, className: ke = "", style: Ae, onOpenChange: je, ...Me }) => {
|
|
33
|
+
let { t: E, language: Ne } = t(), D = ge(), O = oe(), k = se({
|
|
34
|
+
id: Se,
|
|
35
|
+
"aria-describedby": xe
|
|
36
|
+
}), A = De ?? O?.disabled ?? !1, j = we ?? O?.readOnly ?? !1, Pe = Ce ?? O?.required ?? !1, M = Te ?? O?.invalid ?? !1, N = b ?? x ?? E("datePicker.label"), P = be ?? (O && !b && !x ? O.labelId : void 0);
|
|
37
|
+
process.env.NODE_ENV !== "production" && r("DatePicker", {
|
|
38
|
+
prop: "value",
|
|
39
|
+
value: _ === null ? "" : _,
|
|
40
|
+
defaultProp: "defaultValue",
|
|
41
|
+
defaultValue: v,
|
|
42
|
+
handlerProp: "onChange",
|
|
43
|
+
handler: y,
|
|
44
|
+
locked: A || j,
|
|
45
|
+
lockHint: "set `disabled` / `readOnly`"
|
|
46
|
+
});
|
|
47
|
+
let [F, Fe] = ie({
|
|
48
|
+
value: _ === null ? "" : _,
|
|
49
|
+
defaultValue: v ?? "",
|
|
50
|
+
name: "DatePicker"
|
|
51
|
+
}), [I, L] = ie({
|
|
52
|
+
defaultValue: !1,
|
|
53
|
+
onChange: je,
|
|
54
|
+
name: "DatePicker",
|
|
55
|
+
prop: "open"
|
|
56
|
+
}), [R, z] = l(null), [B, Ie] = l(null), [Le, Re] = l(null), ze = ne(Ie, s), V = c(null), Be = ce(), Ve = p(F || "") ?? /* @__PURE__ */ new Date(), [H, U] = l(() => f(Ve)), [He, W] = l(""), [Ue, We] = l(!1), G = c(/* @__PURE__ */ new Map()), K = c(null), q = (e) => !!(w && e < w || T && e > T), J = (e) => {
|
|
57
|
+
Fe(e), y?.(e);
|
|
58
|
+
}, Ge = (e) => {
|
|
59
|
+
let t = p(e);
|
|
60
|
+
t && U(f(t));
|
|
61
|
+
}, Ke = (e) => {
|
|
62
|
+
if (z(e), e === "") {
|
|
63
|
+
J("");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
let t = p(e, !0);
|
|
67
|
+
if (t) {
|
|
68
|
+
let e = d(t);
|
|
69
|
+
q(e) || (J(e), U(f(t)));
|
|
70
|
+
}
|
|
71
|
+
}, qe = () => {
|
|
72
|
+
if (R === null) return;
|
|
73
|
+
let e = R.trim();
|
|
74
|
+
if (e === "") F && J("");
|
|
75
|
+
else {
|
|
76
|
+
let t = p(e, !1);
|
|
77
|
+
if (t) {
|
|
78
|
+
let e = d(t);
|
|
79
|
+
!q(e) && e !== F && (J(e), U(f(t)));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
z(null);
|
|
83
|
+
}, Je = () => {
|
|
84
|
+
z(null), J(""), B?.focus();
|
|
85
|
+
}, Y = (e) => {
|
|
86
|
+
let t = d(e);
|
|
87
|
+
A || j || q(t) || (z(null), J(t), U(f(e)), L(!1), B?.focus());
|
|
88
|
+
}, Ye = () => {
|
|
89
|
+
A || j || (We(!1), I || Ge(F), L((e) => !e));
|
|
90
|
+
}, X = f(H), Xe = u(X, -((X.getDay() + 6) % 7)), Ze = Array.from({ length: 42 }, (e, t) => u(Xe, t)), Qe = Ze.map(d), Z = /* @__PURE__ */ new Date(), Q = d(Z), $ = [
|
|
91
|
+
He,
|
|
92
|
+
F,
|
|
93
|
+
m(Z, H) ? Q : "",
|
|
94
|
+
d(X)
|
|
95
|
+
].find((e) => e && Qe.includes(e)), $e = d(X);
|
|
96
|
+
he(() => {
|
|
97
|
+
if (!I || A || !K.current) return;
|
|
98
|
+
let e = G.current.get(K.current);
|
|
99
|
+
e && (K.current = null, e.focus());
|
|
100
|
+
}, [
|
|
101
|
+
I,
|
|
102
|
+
$e,
|
|
103
|
+
He,
|
|
104
|
+
A
|
|
105
|
+
]);
|
|
106
|
+
let et = (e, t) => {
|
|
107
|
+
if (A || j) return;
|
|
108
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
109
|
+
e.preventDefault(), e.repeat || Y(t);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
let n, r = (t.getDay() + 6) % 7;
|
|
113
|
+
switch (le(e.key, e.currentTarget)) {
|
|
114
|
+
case "ArrowLeft":
|
|
115
|
+
n = u(t, -1);
|
|
116
|
+
break;
|
|
117
|
+
case "ArrowRight":
|
|
118
|
+
n = u(t, 1);
|
|
119
|
+
break;
|
|
120
|
+
case "ArrowUp":
|
|
121
|
+
n = u(t, -7);
|
|
122
|
+
break;
|
|
123
|
+
case "ArrowDown":
|
|
124
|
+
n = u(t, 7);
|
|
125
|
+
break;
|
|
126
|
+
case "Home":
|
|
127
|
+
n = u(t, -r);
|
|
128
|
+
break;
|
|
129
|
+
case "End":
|
|
130
|
+
n = u(t, 6 - r);
|
|
131
|
+
break;
|
|
132
|
+
case "PageUp":
|
|
133
|
+
case "PageDown": {
|
|
134
|
+
let r = (e.key === "PageUp" ? -1 : 1) * (e.shiftKey ? 12 : 1), i = f(t, r), a = u(f(i, 1), -1).getDate();
|
|
135
|
+
n = _e(i.getFullYear(), i.getMonth(), Math.min(t.getDate(), a));
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
default: return;
|
|
139
|
+
}
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
let i = d(n);
|
|
142
|
+
K.current = i, W(i), m(n, H) || U(f(n));
|
|
143
|
+
}, tt = (e) => {
|
|
144
|
+
let t = e.currentTarget;
|
|
145
|
+
!B || e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey || !me(t, e.target, e.shiftKey) || (e.preventDefault(), (e.shiftKey ? B : pe(B, Be ?? B.ownerDocument.body, !1) ?? B).focus(), L(!1));
|
|
146
|
+
}, nt = new Intl.DateTimeFormat(Oe ?? Ne, {
|
|
147
|
+
year: "numeric",
|
|
148
|
+
month: "long"
|
|
149
|
+
}).format(X), rt = R ?? F;
|
|
150
|
+
return /* @__PURE__ */ g("div", {
|
|
151
|
+
...re(Me),
|
|
152
|
+
...n("date-picker", "root", {
|
|
153
|
+
state: I && !A && !j ? "open" : "closed",
|
|
154
|
+
disabled: A,
|
|
155
|
+
readonly: j,
|
|
156
|
+
invalid: M,
|
|
157
|
+
size: C
|
|
158
|
+
}),
|
|
159
|
+
ref: Re,
|
|
160
|
+
className: e(o.datePicker, ke),
|
|
161
|
+
style: Ae,
|
|
162
|
+
onClick: (e) => {
|
|
163
|
+
e.target === B && Ye();
|
|
164
|
+
},
|
|
165
|
+
children: [/* @__PURE__ */ h(ae.Provider, {
|
|
166
|
+
value: null,
|
|
167
|
+
children: /* @__PURE__ */ h(fe, {
|
|
168
|
+
ref: ze,
|
|
169
|
+
value: rt,
|
|
170
|
+
placeholder: ye ?? E("datePicker.placeholder"),
|
|
171
|
+
id: k.id,
|
|
172
|
+
"aria-label": N,
|
|
173
|
+
"aria-labelledby": P,
|
|
174
|
+
"aria-describedby": k["aria-describedby"],
|
|
175
|
+
"aria-invalid": M || void 0,
|
|
176
|
+
"aria-readonly": j || void 0,
|
|
177
|
+
required: Pe,
|
|
178
|
+
readOnly: j,
|
|
179
|
+
onChange: (e) => Ke(e.target.value),
|
|
180
|
+
onBlur: qe,
|
|
181
|
+
onKeyDown: (e) => {
|
|
182
|
+
e.key === "ArrowDown" && (e.preventDefault(), I ? V.current?.querySelector("[role=\"gridcell\"][tabindex=\"0\"]")?.focus() : (Ge(F), W(F || Q), We(!0), L(!0)));
|
|
183
|
+
},
|
|
184
|
+
name: Ee,
|
|
185
|
+
disabled: A,
|
|
186
|
+
size: C,
|
|
187
|
+
suffix: S && F && !A && !j ? /* @__PURE__ */ h(de, {
|
|
188
|
+
icon: /* @__PURE__ */ h(te, {
|
|
189
|
+
"aria-hidden": !0,
|
|
190
|
+
focusable: !1
|
|
191
|
+
}),
|
|
192
|
+
size: "small",
|
|
193
|
+
"aria-label": E("datePicker.clear"),
|
|
194
|
+
onClick: Je,
|
|
195
|
+
className: o.clearButton
|
|
196
|
+
}) : /* @__PURE__ */ h("span", {
|
|
197
|
+
className: o.calendarIcon,
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
...n("date-picker", "icon"),
|
|
200
|
+
children: /* @__PURE__ */ h(i, {})
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
}), /* @__PURE__ */ h(ue, {
|
|
204
|
+
ref: V,
|
|
205
|
+
open: I && !A && !j,
|
|
206
|
+
anchor: B,
|
|
207
|
+
placement: "bottom-start",
|
|
208
|
+
branches: () => [Le],
|
|
209
|
+
onDismiss: () => L(!1),
|
|
210
|
+
returnFocusOnEscape: () => B,
|
|
211
|
+
focusable: !0,
|
|
212
|
+
role: "dialog",
|
|
213
|
+
tabIndex: -1,
|
|
214
|
+
"aria-label": N,
|
|
215
|
+
"aria-labelledby": P,
|
|
216
|
+
className: o.popup,
|
|
217
|
+
onKeyDown: tt,
|
|
218
|
+
...n("date-picker", "content", { state: "open" }),
|
|
219
|
+
children: /* @__PURE__ */ g("div", {
|
|
220
|
+
className: o.panel,
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ g("div", {
|
|
223
|
+
className: o.header,
|
|
224
|
+
children: [/* @__PURE__ */ h("h2", {
|
|
225
|
+
id: D,
|
|
226
|
+
className: o.heading,
|
|
227
|
+
"aria-live": "polite",
|
|
228
|
+
children: nt
|
|
229
|
+
}), /* @__PURE__ */ g("div", {
|
|
230
|
+
className: o.navGroup,
|
|
231
|
+
children: [/* @__PURE__ */ h("button", {
|
|
232
|
+
type: "button",
|
|
233
|
+
className: o.navButton,
|
|
234
|
+
"aria-label": E("monthCalendar.previousMonth"),
|
|
235
|
+
onClick: () => U(f(H, -1)),
|
|
236
|
+
children: /* @__PURE__ */ h(a, {
|
|
237
|
+
"aria-hidden": !0,
|
|
238
|
+
focusable: !1
|
|
239
|
+
})
|
|
240
|
+
}), /* @__PURE__ */ h("button", {
|
|
241
|
+
type: "button",
|
|
242
|
+
className: o.navButton,
|
|
243
|
+
"aria-label": E("monthCalendar.nextMonth"),
|
|
244
|
+
onClick: () => U(f(H, 1)),
|
|
245
|
+
children: /* @__PURE__ */ h(ee, {
|
|
246
|
+
"aria-hidden": !0,
|
|
247
|
+
focusable: !1
|
|
248
|
+
})
|
|
249
|
+
})]
|
|
250
|
+
})]
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ g("div", {
|
|
253
|
+
role: "grid",
|
|
254
|
+
"aria-labelledby": D,
|
|
255
|
+
className: o.grid,
|
|
256
|
+
children: [/* @__PURE__ */ h("div", {
|
|
257
|
+
role: "row",
|
|
258
|
+
className: o.week,
|
|
259
|
+
children: ve.map((e) => /* @__PURE__ */ h("div", {
|
|
260
|
+
role: "columnheader",
|
|
261
|
+
className: o.weekday,
|
|
262
|
+
children: E(`monthCalendar.weekdays.${e}`)
|
|
263
|
+
}, e))
|
|
264
|
+
}), Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ h("div", {
|
|
265
|
+
role: "row",
|
|
266
|
+
className: o.week,
|
|
267
|
+
children: Ze.slice(t * 7, t * 7 + 7).map((e) => {
|
|
268
|
+
let t = d(e), n = F === t, r = !m(e, H), i = t === Q, a = q(t);
|
|
269
|
+
return /* @__PURE__ */ h("div", {
|
|
270
|
+
role: "gridcell",
|
|
271
|
+
className: o.day,
|
|
272
|
+
ref: (e) => {
|
|
273
|
+
e ? (G.current.set(t, e), (Ue && t === $ || K.current === t) && (K.current = null, e.focus())) : G.current.delete(t);
|
|
274
|
+
},
|
|
275
|
+
"data-date": t,
|
|
276
|
+
"data-outside": r ? "" : void 0,
|
|
277
|
+
"aria-label": t,
|
|
278
|
+
"aria-selected": n,
|
|
279
|
+
"aria-current": i ? "date" : void 0,
|
|
280
|
+
"aria-disabled": a || void 0,
|
|
281
|
+
tabIndex: !a && t === $ ? 0 : -1,
|
|
282
|
+
onFocus: () => W(t),
|
|
283
|
+
onClick: () => Y(e),
|
|
284
|
+
onKeyDown: (t) => et(t, e),
|
|
285
|
+
children: e.getDate()
|
|
286
|
+
}, t);
|
|
287
|
+
})
|
|
288
|
+
}, t))]
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ g("div", {
|
|
291
|
+
className: o.footer,
|
|
292
|
+
children: [/* @__PURE__ */ h("button", {
|
|
293
|
+
type: "button",
|
|
294
|
+
className: o.footerButton,
|
|
295
|
+
disabled: q(Q),
|
|
296
|
+
onClick: () => Y(Z),
|
|
297
|
+
children: E("datePicker.today")
|
|
298
|
+
}), S && F && /* @__PURE__ */ h("button", {
|
|
299
|
+
type: "button",
|
|
300
|
+
className: o.footerButton,
|
|
301
|
+
onClick: () => {
|
|
302
|
+
Je(), L(!1);
|
|
303
|
+
},
|
|
304
|
+
children: E("datePicker.clear")
|
|
305
|
+
})]
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
})
|
|
309
|
+
})]
|
|
310
|
+
});
|
|
311
|
+
}, v = s.memo(_);
|
|
312
|
+
//#endregion
|
|
313
|
+
export { _ as DatePicker, v as default };
|
|
314
|
+
|
|
315
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","names":["styles","IconButton","useI18n","IconButton_default","datePicker_module_default","React","WEEKDAYS","DatePicker","ariaLabel","ariaLabelledBy","ariaDescribedBy","requiredProp","readOnlyProp","invalidProp","disabledProp","rest","headingId","useId","fc","useFormControlContext","fieldProps","useFormControlProps","disabled","readOnly","required","invalid","accessibleName","label","t","labelledBy","warnControlledProps","value","onChange","current","setCurrent","useControllableState","defaultValue","open","setOpen","onOpenChange","draft","setDraft","useState","input","setInput","field","setField","setInputRef","useMergedRefs","ref","panelRef","useRef","tabContainer","useLayerParent","initialDate","parseDayKey","month","setMonth","monthStart","focusedKey","setFocusedKey","focusPanelOnOpen","setFocusPanelOnOpen","cells","pendingFocus","isDayDisabled","minDate","key","maxDate","commit","next","syncMonthFromValue","parsed","val","handleInputChange","text","dayKey","handleInputBlur","trimmed","handleClear","selectDate","date","toggle","prev","first","start","addDays","days","index","visibleKeys","today","todayKey","activeKey","sameMonth","monthKey","cell","handleDayKeyDown","event","target","weekday","logicalArrowKey","offset","lastDay","localDate","nextKey","handlePanelKeyDown","panel","tabLeavesPanel","adjacentTabbable","heading","locale","language","displayValue","pickDataAttributes","hooks","cn","className","FormControlContext","Input","placeholder","clearable","IconX","IconCalendar","FloatingPanel","IconChevronLeft","IconChevronRight","day","week","selected","outside","isToday","dayDisabled","element","DatePicker_default"],"sources":["../../../../../react/src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from \"react\";\nimport {\n addDays,\n dayKey,\n localDate,\n monthStart,\n parseDayKey,\n sameMonth,\n} from \"@minerva/core\";\nimport { cn } from \"../../utils/cn\";\nimport {\n IconCalendar,\n IconChevronLeft,\n IconChevronRight,\n IconX,\n} from \"../../internal/icons\";\nimport { Input } from \"../Input\";\nimport { IconButton } from \"../IconButton\";\nimport { FloatingPanel } from \"../../internal/FloatingPanel\";\nimport { useLayerParent } from \"../../internal/useDismissableLayer\";\nimport { adjacentTabbable, tabLeavesPanel } from \"../../internal/tabbing\";\nimport { useControllableState } from \"../../internal/useControllableState\";\nimport { warnControlledProps } from \"../../internal/devWarnings\";\nimport { useMergedRefs } from \"../../internal/mergeRefs\";\nimport useI18n from \"../../hooks/useI18n\";\nimport { pickDataAttributes } from \"../../internal/dataAttributes\";\nimport { logicalArrowKey } from \"../../internal/direction\";\nimport {\n FormControlContext,\n useFormControlContext,\n useFormControlProps,\n} from \"../FormControl/context\";\nimport type { DatePickerProps } from \"./types\";\nimport { hooks } from \"../../internal/stylingHooks\";\nimport styles from \"./datePicker.module.scss\";\n\nconst WEEKDAYS = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"] as const;\n\n/**\n * DatePicker: type a `\"YYYY-MM-DD\"` date or pick a day from a popup month\n * calendar grid. Works controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`). Inside a FormControl the input picks up the field's id,\n * label, description, invalid, required, disabled and read-only state\n * (explicit props win).\n */\nconst DatePicker = ({\n ref,\n value,\n defaultValue,\n onChange,\n placeholder,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n id,\n required: requiredProp,\n readOnly: readOnlyProp,\n invalid: invalidProp,\n name = \"date-picker\",\n disabled: disabledProp,\n clearable = true,\n size = \"medium\",\n minDate,\n maxDate,\n locale,\n className = \"\",\n style,\n onOpenChange,\n ...rest\n}: DatePickerProps) => {\n const { t, language } = useI18n();\n const headingId = useId();\n const fc = useFormControlContext();\n const fieldProps = useFormControlProps({\n id,\n \"aria-describedby\": ariaDescribedBy,\n });\n const disabled = disabledProp ?? fc?.disabled ?? false;\n const readOnly = readOnlyProp ?? fc?.readOnly ?? false;\n const required = requiredProp ?? fc?.required ?? false;\n const invalid = invalidProp ?? fc?.invalid ?? false;\n const accessibleName = label ?? ariaLabel ?? t(\"datePicker.label\");\n const labelledBy =\n ariaLabelledBy ?? (fc && !label && !ariaLabel ? fc.labelId : undefined);\n\n if (process.env.NODE_ENV !== \"production\") {\n warnControlledProps(\"DatePicker\", {\n prop: \"value\",\n value: value === null ? \"\" : value,\n defaultProp: \"defaultValue\",\n defaultValue,\n handlerProp: \"onChange\",\n handler: onChange,\n locked: disabled || readOnly,\n lockHint: \"set `disabled` / `readOnly`\",\n });\n }\n\n const normalizedValue = value === null ? \"\" : value;\n const [current, setCurrent] = useControllableState<string>({\n value: normalizedValue,\n defaultValue: defaultValue ?? \"\",\n name: \"DatePicker\",\n });\n const [open, setOpen] = useControllableState({\n defaultValue: false,\n onChange: onOpenChange,\n name: \"DatePicker\",\n prop: \"open\",\n });\n\n const [draft, setDraft] = useState<string | null>(null);\n const [input, setInput] = useState<HTMLInputElement | null>(null);\n const [field, setField] = useState<HTMLDivElement | null>(null);\n const setInputRef = useMergedRefs<HTMLInputElement>(setInput, ref);\n const panelRef = useRef<HTMLDivElement>(null);\n const tabContainer = useLayerParent();\n\n const initialDate = parseDayKey(current || \"\") ?? new Date();\n const [month, setMonth] = useState<Date>(() => monthStart(initialDate));\n const [focusedKey, setFocusedKey] = useState(\"\");\n const [focusPanelOnOpen, setFocusPanelOnOpen] = useState(false);\n const cells = useRef(new Map<string, HTMLDivElement>());\n const pendingFocus = useRef<string | null>(null);\n\n const isDayDisabled = (key: string) => {\n if (minDate && key < minDate) return true;\n if (maxDate && key > maxDate) return true;\n return false;\n };\n\n const commit = (next: string) => {\n setCurrent(next);\n onChange?.(next);\n };\n\n const syncMonthFromValue = (val: string) => {\n const parsed = parseDayKey(val);\n if (parsed) setMonth(monthStart(parsed));\n };\n\n const handleInputChange = (text: string) => {\n setDraft(text);\n if (text === \"\") {\n commit(\"\");\n return;\n }\n const parsed = parseDayKey(text, true);\n if (parsed) {\n const key = dayKey(parsed);\n if (!isDayDisabled(key)) {\n commit(key);\n setMonth(monthStart(parsed));\n }\n }\n };\n\n const handleInputBlur = () => {\n if (draft === null) return;\n const trimmed = draft.trim();\n if (trimmed === \"\") {\n if (current) commit(\"\");\n } else {\n const parsed = parseDayKey(trimmed, false);\n if (parsed) {\n const key = dayKey(parsed);\n if (!isDayDisabled(key) && key !== current) {\n commit(key);\n setMonth(monthStart(parsed));\n }\n }\n }\n setDraft(null);\n };\n\n const handleClear = () => {\n setDraft(null);\n commit(\"\");\n input?.focus();\n };\n\n const selectDate = (date: Date) => {\n const key = dayKey(date);\n if (disabled || readOnly || isDayDisabled(key)) return;\n setDraft(null);\n commit(key);\n setMonth(monthStart(date));\n setOpen(false);\n input?.focus();\n };\n\n const toggle = () => {\n if (disabled || readOnly) return;\n setFocusPanelOnOpen(false);\n if (!open) syncMonthFromValue(current);\n setOpen((prev) => !prev);\n };\n\n const first = monthStart(month);\n const start = addDays(first, -((first.getDay() + 6) % 7));\n const days = Array.from({ length: 42 }, (_, index) => addDays(start, index));\n const visibleKeys = days.map(dayKey);\n const today = new Date();\n const todayKey = dayKey(today);\n const activeKey = [\n focusedKey,\n current,\n sameMonth(today, month) ? todayKey : \"\",\n dayKey(first),\n ].find((key) => key && visibleKeys.includes(key));\n const monthKey = dayKey(first);\n\n useEffect(() => {\n if (!open || disabled || !pendingFocus.current) return;\n const cell = cells.current.get(pendingFocus.current);\n if (cell) {\n pendingFocus.current = null;\n cell.focus();\n }\n }, [open, monthKey, focusedKey, disabled]);\n\n const handleDayKeyDown = (\n event: React.KeyboardEvent<HTMLDivElement>,\n date: Date,\n ) => {\n if (disabled || readOnly) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (!event.repeat) selectDate(date);\n return;\n }\n let target: Date;\n const weekday = (date.getDay() + 6) % 7;\n switch (logicalArrowKey(event.key, event.currentTarget)) {\n case \"ArrowLeft\":\n target = addDays(date, -1);\n break;\n case \"ArrowRight\":\n target = addDays(date, 1);\n break;\n case \"ArrowUp\":\n target = addDays(date, -7);\n break;\n case \"ArrowDown\":\n target = addDays(date, 7);\n break;\n case \"Home\":\n target = addDays(date, -weekday);\n break;\n case \"End\":\n target = addDays(date, 6 - weekday);\n break;\n case \"PageUp\":\n case \"PageDown\": {\n const offset =\n (event.key === \"PageUp\" ? -1 : 1) * (event.shiftKey ? 12 : 1);\n const next = monthStart(date, offset);\n const lastDay = addDays(monthStart(next, 1), -1).getDate();\n target = localDate(\n next.getFullYear(),\n next.getMonth(),\n Math.min(date.getDate(), lastDay),\n );\n break;\n }\n default:\n return;\n }\n event.preventDefault();\n const nextKey = dayKey(target);\n pendingFocus.current = nextKey;\n setFocusedKey(nextKey);\n if (!sameMonth(target, month)) setMonth(monthStart(target));\n };\n\n const handlePanelKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const panel = event.currentTarget;\n if (\n !input ||\n event.key !== \"Tab\" ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n !tabLeavesPanel(panel, event.target as Element, event.shiftKey)\n )\n return;\n event.preventDefault();\n const next = event.shiftKey\n ? input\n : (adjacentTabbable(\n input,\n tabContainer ?? input.ownerDocument.body,\n false,\n ) ?? input);\n next.focus();\n setOpen(false);\n };\n\n const heading = new Intl.DateTimeFormat(locale ?? language, {\n year: \"numeric\",\n month: \"long\",\n }).format(first);\n\n const displayValue = draft ?? current;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <div\n {...pickDataAttributes(rest)}\n {...hooks(\"date-picker\", \"root\", {\n state: open && !disabled && !readOnly ? \"open\" : \"closed\",\n disabled,\n readonly: readOnly,\n invalid,\n size,\n })}\n ref={setField}\n className={cn(styles.datePicker, className)}\n style={style}\n onClick={(e) => {\n if (e.target === input) toggle();\n }}\n >\n <FormControlContext.Provider value={null}>\n <Input\n ref={setInputRef}\n value={displayValue}\n placeholder={placeholder ?? t(\"datePicker.placeholder\")}\n id={fieldProps.id}\n aria-label={accessibleName}\n aria-labelledby={labelledBy}\n aria-describedby={fieldProps[\"aria-describedby\"]}\n aria-invalid={invalid || undefined}\n aria-readonly={readOnly || undefined}\n required={required}\n readOnly={readOnly}\n onChange={(e) => handleInputChange(e.target.value)}\n onBlur={handleInputBlur}\n onKeyDown={(e) => {\n if (e.key !== \"ArrowDown\") return;\n e.preventDefault();\n if (!open) {\n syncMonthFromValue(current);\n const focusTarget = current || todayKey;\n setFocusedKey(focusTarget);\n setFocusPanelOnOpen(true);\n setOpen(true);\n } else {\n panelRef.current\n ?.querySelector<HTMLElement>('[role=\"gridcell\"][tabindex=\"0\"]')\n ?.focus();\n }\n }}\n name={name}\n disabled={disabled}\n size={size}\n suffix={\n clearable && current && !disabled && !readOnly ? (\n <IconButton\n icon={<IconX aria-hidden focusable={false} />}\n size=\"small\"\n aria-label={t(\"datePicker.clear\")}\n onClick={handleClear}\n className={styles.clearButton}\n />\n ) : (\n <span\n className={styles.calendarIcon}\n aria-hidden=\"true\"\n {...hooks(\"date-picker\", \"icon\")}\n >\n <IconCalendar />\n </span>\n )\n }\n />\n </FormControlContext.Provider>\n <FloatingPanel\n ref={panelRef}\n open={open && !disabled && !readOnly}\n anchor={input}\n placement=\"bottom-start\"\n branches={() => [field]}\n onDismiss={() => setOpen(false)}\n returnFocusOnEscape={() => input}\n focusable\n role=\"dialog\"\n tabIndex={-1}\n aria-label={accessibleName}\n aria-labelledby={labelledBy}\n className={styles.popup}\n onKeyDown={handlePanelKeyDown}\n {...hooks(\"date-picker\", \"content\", { state: \"open\" })}\n >\n <div className={styles.panel}>\n <div className={styles.header}>\n <h2 id={headingId} className={styles.heading} aria-live=\"polite\">\n {heading}\n </h2>\n <div className={styles.navGroup}>\n <button\n type=\"button\"\n className={styles.navButton}\n aria-label={t(\"monthCalendar.previousMonth\")}\n onClick={() => setMonth(monthStart(month, -1))}\n >\n <IconChevronLeft aria-hidden focusable={false} />\n </button>\n <button\n type=\"button\"\n className={styles.navButton}\n aria-label={t(\"monthCalendar.nextMonth\")}\n onClick={() => setMonth(monthStart(month, 1))}\n >\n <IconChevronRight aria-hidden focusable={false} />\n </button>\n </div>\n </div>\n <div role=\"grid\" aria-labelledby={headingId} className={styles.grid}>\n <div role=\"row\" className={styles.week}>\n {WEEKDAYS.map((day) => (\n <div role=\"columnheader\" key={day} className={styles.weekday}>\n {t(`monthCalendar.weekdays.${day}`)}\n </div>\n ))}\n </div>\n {Array.from({ length: 6 }, (_, week) => (\n <div role=\"row\" className={styles.week} key={week}>\n {days.slice(week * 7, week * 7 + 7).map((date) => {\n const key = dayKey(date);\n const selected = current === key;\n const outside = !sameMonth(date, month);\n const isToday = key === todayKey;\n const dayDisabled = isDayDisabled(key);\n return (\n <div\n role=\"gridcell\"\n key={key}\n className={styles.day}\n ref={(element) => {\n if (element) {\n cells.current.set(key, element);\n if (\n (focusPanelOnOpen && key === activeKey) ||\n pendingFocus.current === key\n ) {\n pendingFocus.current = null;\n element.focus();\n }\n } else {\n cells.current.delete(key);\n }\n }}\n data-date={key}\n data-outside={outside ? \"\" : undefined}\n aria-label={key}\n aria-selected={selected}\n aria-current={isToday ? \"date\" : undefined}\n aria-disabled={dayDisabled || undefined}\n tabIndex={!dayDisabled && key === activeKey ? 0 : -1}\n onFocus={() => setFocusedKey(key)}\n onClick={() => selectDate(date)}\n onKeyDown={(event) => handleDayKeyDown(event, date)}\n >\n {date.getDate()}\n </div>\n );\n })}\n </div>\n ))}\n </div>\n <div className={styles.footer}>\n <button\n type=\"button\"\n className={styles.footerButton}\n disabled={isDayDisabled(todayKey)}\n onClick={() => selectDate(today)}\n >\n {t(\"datePicker.today\")}\n </button>\n {clearable && current && (\n <button\n type=\"button\"\n className={styles.footerButton}\n onClick={() => {\n handleClear();\n setOpen(false);\n }}\n >\n {t(\"datePicker.clear\")}\n </button>\n )}\n </div>\n </div>\n </FloatingPanel>\n </div>\n );\n};\n\nexport { DatePicker };\nexport default React.memo(DatePicker);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAMM,KAAW;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK,GAS3DC,KAAc,EAClB,QACA,UACA,iBACA,aACA,iBACA,UACA,cAAcC,GACd,mBAAmBC,IACnB,oBAAoBC,IACpB,QACA,UAAUC,IACV,UAAUC,IACV,SAASC,IACT,WAAO,eACP,UAAUC,IACV,eAAY,IACZ,UAAO,UACP,YACA,YACA,YACA,gBAAY,IACZ,WACA,kBACA,GAAGC,SACkB;CACrB,IAAM,EAAE,MAAG,iBAAab,EAAQ,GAC1Bc,IAAYC,GAAM,GAClBC,IAAKC,GAAsB,GAC3BC,IAAaC,GAAoB;EACrC;EACA,oBAAoBX;CACtB,CAAC,GACKY,IAAWR,MAAgBI,GAAI,YAAY,IAC3CK,IAAWX,MAAgBM,GAAI,YAAY,IAC3CM,KAAWb,MAAgBO,GAAI,YAAY,IAC3CO,IAAUZ,MAAeK,GAAI,WAAW,IACxCQ,IAAiBC,KAASnB,KAAaoB,EAAE,kBAAkB,GAC3DC,IACJpB,OAAmBS,KAAM,CAACS,KAAS,CAACnB,IAAYU,EAAG,UAAU,KAAA;CAE/D,AAAA,QAAA,IAAA,aAA6B,gBAC3BY,EAAoB,cAAc;EAChC,MAAM;EACN,OAAOC,MAAU,OAAO,KAAKA;EAC7B,aAAa;EACb;EACA,aAAa;EACb,SAASC;EACT,QAAQV,KAAYC;EACpB,UAAU;CACZ,CAAC;CAIH,IAAM,CAACU,GAASC,MAAcC,GAA6B;EACzD,OAFsBJ,MAAU,OAAO,KAAKA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6D;SACf,gBAAcE,IAAU,SAAS,KAAA;SACjC,iBAAeC,KAAe,KAAA;SAC9B,UAAU,CAACA,KAAehE,MAAQyB,IAAY,IAAI;SAClD,eAAehC,EAAcO,CAAG;SAChC,eAAea,EAAWC,CAAI;SAC9B,YAAY,MAAUe,GAAiBC,GAAOhB,CAAI;SAEjD,UAAAA,EAAK,QAAQ;QACX,GA5BEd,CA4BF;OAET,CAAC;MACE,GAzCwC4D,CAyCxC,CACN,CACE;;KACL,kBAAC,OAAD;MAAK,WAAW/H,EAAO;MAAvB,UAAA,CACE,kBAAC,UAAD;OACE,MAAK;OACL,WAAWA,EAAO;OAClB,UAAUiE,EAAc0B,CAAQ;OAChC,eAAeX,EAAWU,CAAK;OAE9B,UAAA9D,EAAE,kBAAkB;MACf,CAAA,GACP4F,KAAavF,KACZ,kBAAC,UAAD;OACE,MAAK;OACL,WAAWjC,EAAO;OAClB,eAAe;QAEb,AADA+E,GAAY,GACZzC,EAAQ,EAAK;OACf;OAEC,UAAAV,EAAE,kBAAkB;MACf,CAAA,CAEP;;IACF;;EACQ,CAAA,CACZ;;AAET,GAGAyG,IAAehI,EAAM,KAAKE,CAAU"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";var e=`_datePicker_6el17_1`,t=`_clearButton_6el17_6`,n=`_calendarIcon_6el17_22`,r=`_popup_6el17_29`,i=`_panel_6el17_34`,a=`_header_6el17_46`,o=`_heading_6el17_54`,s=`_navGroup_6el17_61`,c=`_navButton_6el17_67`,l=`_grid_6el17_92`,u=`_week_6el17_96`,d=`_weekday_6el17_103`,f=`_day_6el17_111`,p=`_footer_6el17_157`,m=`_footerButton_6el17_165`,h={datePicker:e,clearButton:t,calendarIcon:n,popup:r,panel:i,header:a,heading:o,navGroup:s,navButton:c,grid:l,week:u,weekday:d,day:f,footer:p,footerButton:m};exports.calendarIcon=n,exports.clearButton=t,exports.datePicker=e,exports.day=f,exports.default=h,exports.footer=p,exports.footerButton=m,exports.grid=l,exports.header=a,exports.heading=o,exports.navButton=c,exports.navGroup=s,exports.panel=i,exports.popup=r,exports.week=u,exports.weekday=d;
|
|
2
|
+
//# sourceMappingURL=datePicker.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datePicker.module.scss.cjs","names":["datePicker","clearButton","calendarIcon","popup","panel","header","heading","navGroup","navButton","grid","week","weekday","day","footer","footerButton","datePicker_module_default"],"sources":["../../../../../react/src/components/DatePicker/datePicker.module.scss"],"sourcesContent":["// Public CSS variables (set them on the date picker or any ancestor; the\n// panel is portaled, so set its variables on :root or the popup class):\n// @css-var --date-picker-width Width of the field\n// @css-var --date-picker-panel-width Width of the popup calendar panel\n// @css-var --date-picker-panel-radius Corner radius of the popup panel (defaults to --radius-lg)\n// @css-var --date-picker-panel-padding Inner padding of the popup panel\n// @css-var --date-picker-cell-size Width and height of a day cell in the popup grid\n.datePicker {\n display: inline-block;\n position: relative;\n width: var(--date-picker-width, 100%);\n\n .clearButton {\n opacity: 0.45;\n transition: opacity var(--transition-base);\n color: var(--text-secondary-color);\n\n &:hover,\n &:focus-visible {\n opacity: 1;\n color: var(--text-color);\n }\n\n &:focus-visible {\n outline: 2px solid var(--focus-ring-color);\n outline-offset: 2px;\n }\n }\n\n &:hover .clearButton {\n opacity: 0.8;\n }\n\n .calendarIcon {\n display: inline-flex;\n align-items: center;\n padding: 0 var(--space-1-5);\n color: var(--text-secondary-color);\n }\n}\n\n.popup {\n z-index: var(--z-dropdown);\n outline: none;\n}\n\n.panel {\n width: var(--date-picker-panel-width, 17.5rem);\n padding: var(--date-picker-panel-padding, var(--space-3));\n border: 1px solid var(--border-color);\n border-radius: var(--date-picker-panel-radius, var(--radius-lg));\n background: var(--surface-elevated-color, var(--surface-color));\n box-shadow: var(--shadow-lg);\n color: var(--text-color);\n font-family: var(--font-family-sans);\n font-size: var(--font-size-sm);\n}\n\n.header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-2);\n margin-bottom: var(--space-2);\n}\n\n.heading {\n margin: 0;\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-semibold);\n line-height: var(--line-height-tight);\n}\n\n.navGroup {\n display: flex;\n align-items: center;\n gap: var(--space-1);\n}\n\n.navButton {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--control-height-sm, 1.75rem);\n height: var(--control-height-sm, 1.75rem);\n padding: 0;\n border: 1px solid var(--border-color);\n border-radius: var(--radius-md);\n background: var(--surface-color);\n color: var(--text-color);\n cursor: pointer;\n transition:\n background-color var(--transition-fast),\n border-color var(--transition-fast);\n\n &:hover:not(:disabled) {\n background: var(--hover-color);\n border-color: var(--border-strong-color);\n }\n\n &:focus-visible {\n outline: 2px solid transparent;\n outline-offset: 2px;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) var(--focus-ring-color);\n }\n}\n\n.grid {\n width: 100%;\n}\n\n.week {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n gap: 2px;\n margin-bottom: 2px;\n}\n\n.weekday {\n padding-block: var(--space-1);\n text-align: center;\n color: var(--text-muted-color);\n font-size: var(--font-size-xs);\n font-weight: var(--font-weight-medium);\n}\n\n.day {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: var(--date-picker-cell-size, 2rem);\n padding: 0;\n border: 1px solid transparent;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--text-color);\n font: inherit;\n font-variant-numeric: tabular-nums;\n cursor: pointer;\n transition:\n background-color var(--transition-fast),\n border-color var(--transition-fast),\n color var(--transition-fast);\n\n &:hover:not([aria-disabled=\"true\"]) {\n background: var(--hover-color);\n }\n\n &[data-outside] {\n color: var(--text-disabled-color);\n }\n\n &[aria-current=\"date\"] {\n border-color: var(--primary-color);\n font-weight: var(--font-weight-semibold);\n }\n\n &[aria-selected=\"true\"] {\n border-color: var(--primary-color);\n background: var(--primary-color);\n color: var(--text-inverse-color);\n font-weight: var(--font-weight-semibold);\n\n &:hover {\n background: var(--primary-color-hover, var(--primary-color));\n }\n }\n\n &[aria-disabled=\"true\"] {\n cursor: not-allowed;\n opacity: 0.4;\n }\n\n &:focus-visible {\n outline: 2px solid transparent;\n outline-offset: -2px;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) var(--focus-ring-color);\n }\n}\n\n.footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-2);\n margin-top: var(--space-2);\n}\n\n.footerButton {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: var(--control-height-sm, 1.75rem);\n padding: 0 var(--space-2-5);\n border: 1px solid transparent;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--primary-color-text, var(--primary-color));\n font: inherit;\n font-size: var(--font-size-xs);\n font-weight: var(--font-weight-medium);\n cursor: pointer;\n transition: background-color var(--transition-fast);\n\n &:hover:not(:disabled) {\n background: var(--hover-color);\n }\n\n &:focus-visible {\n outline: 2px solid transparent;\n outline-offset: 2px;\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) var(--focus-ring-color);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .navButton,\n .day,\n .footerButton {\n transition: none;\n }\n}\n\n@media (forced-colors: active) {\n .day[aria-selected=\"true\"] {\n outline: 2px solid Highlight;\n outline-offset: -2px;\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/DatePicker/datePicker.module.scss
|
|
3
|
+
var e = "_datePicker_6el17_1", t = "_clearButton_6el17_6", n = "_calendarIcon_6el17_22", r = "_popup_6el17_29", i = "_panel_6el17_34", a = "_header_6el17_46", o = "_heading_6el17_54", s = "_navGroup_6el17_61", c = "_navButton_6el17_67", l = "_grid_6el17_92", u = "_week_6el17_96", d = "_weekday_6el17_103", f = "_day_6el17_111", p = "_footer_6el17_157", m = "_footerButton_6el17_165", h = {
|
|
4
|
+
datePicker: e,
|
|
5
|
+
clearButton: t,
|
|
6
|
+
calendarIcon: n,
|
|
7
|
+
popup: r,
|
|
8
|
+
panel: i,
|
|
9
|
+
header: a,
|
|
10
|
+
heading: o,
|
|
11
|
+
navGroup: s,
|
|
12
|
+
navButton: c,
|
|
13
|
+
grid: l,
|
|
14
|
+
week: u,
|
|
15
|
+
weekday: d,
|
|
16
|
+
day: f,
|
|
17
|
+
footer: p,
|
|
18
|
+
footerButton: m
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { n as calendarIcon, t as clearButton, e as datePicker, f as day, h as default, p as footer, m as footerButton, l as grid, a as header, o as heading, c as navButton, s as navGroup, i as panel, r as popup, u as week, d as weekday };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=datePicker.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datePicker.module.scss.js","names":["datePicker","clearButton","calendarIcon","popup","panel","header","heading","navGroup","navButton","grid","week","weekday","day","footer","footerButton","datePicker_module_default"],"sources":["../../../../../react/src/components/DatePicker/datePicker.module.scss"],"sourcesContent":["// Public CSS variables (set them on the date picker or any ancestor; the\n// panel is portaled, so set its variables on :root or the popup class):\n// @css-var --date-picker-width Width of the field\n// @css-var --date-picker-panel-width Width of the popup calendar panel\n// @css-var --date-picker-panel-radius Corner radius of the popup panel (defaults to --radius-lg)\n// @css-var --date-picker-panel-padding Inner padding of the popup panel\n// @css-var --date-picker-cell-size Width and height of a day cell in the popup grid\n.datePicker {\n display: inline-block;\n position: relative;\n width: var(--date-picker-width, 100%);\n\n .clearButton {\n opacity: 0.45;\n transition: opacity var(--transition-base);\n color: var(--text-secondary-color);\n\n &:hover,\n &:focus-visible {\n opacity: 1;\n color: var(--text-color);\n }\n\n &:focus-visible {\n outline: 2px solid var(--focus-ring-color);\n outline-offset: 2px;\n }\n }\n\n &:hover .clearButton {\n opacity: 0.8;\n }\n\n .calendarIcon {\n display: inline-flex;\n align-items: center;\n padding: 0 var(--space-1-5);\n color: var(--text-secondary-color);\n }\n}\n\n.popup {\n z-index: var(--z-dropdown);\n outline: none;\n}\n\n.panel {\n width: var(--date-picker-panel-width, 17.5rem);\n padding: var(--date-picker-panel-padding, var(--space-3));\n border: 1px solid var(--border-color);\n border-radius: var(--date-picker-panel-radius, var(--radius-lg));\n background: var(--surface-elevated-color, var(--surface-color));\n box-shadow: var(--shadow-lg);\n color: var(--text-color);\n font-family: var(--font-family-sans);\n font-size: var(--font-size-sm);\n}\n\n.header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-2);\n margin-bottom: var(--space-2);\n}\n\n.heading {\n margin: 0;\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-semibold);\n line-height: var(--line-height-tight);\n}\n\n.navGroup {\n display: flex;\n align-items: center;\n gap: var(--space-1);\n}\n\n.navButton {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--control-height-sm, 1.75rem);\n height: var(--control-height-sm, 1.75rem);\n padding: 0;\n border: 1px solid var(--border-color);\n border-radius: var(--radius-md);\n background: var(--surface-color);\n color: var(--text-color);\n cursor: pointer;\n transition:\n background-color var(--transition-fast),\n border-color var(--transition-fast);\n\n &:hover:not(:disabled) {\n background: var(--hover-color);\n border-color: var(--border-strong-color);\n }\n\n &:focus-visible {\n outline: 2px solid transparent;\n outline-offset: 2px;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) var(--focus-ring-color);\n }\n}\n\n.grid {\n width: 100%;\n}\n\n.week {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n gap: 2px;\n margin-bottom: 2px;\n}\n\n.weekday {\n padding-block: var(--space-1);\n text-align: center;\n color: var(--text-muted-color);\n font-size: var(--font-size-xs);\n font-weight: var(--font-weight-medium);\n}\n\n.day {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: var(--date-picker-cell-size, 2rem);\n padding: 0;\n border: 1px solid transparent;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--text-color);\n font: inherit;\n font-variant-numeric: tabular-nums;\n cursor: pointer;\n transition:\n background-color var(--transition-fast),\n border-color var(--transition-fast),\n color var(--transition-fast);\n\n &:hover:not([aria-disabled=\"true\"]) {\n background: var(--hover-color);\n }\n\n &[data-outside] {\n color: var(--text-disabled-color);\n }\n\n &[aria-current=\"date\"] {\n border-color: var(--primary-color);\n font-weight: var(--font-weight-semibold);\n }\n\n &[aria-selected=\"true\"] {\n border-color: var(--primary-color);\n background: var(--primary-color);\n color: var(--text-inverse-color);\n font-weight: var(--font-weight-semibold);\n\n &:hover {\n background: var(--primary-color-hover, var(--primary-color));\n }\n }\n\n &[aria-disabled=\"true\"] {\n cursor: not-allowed;\n opacity: 0.4;\n }\n\n &:focus-visible {\n outline: 2px solid transparent;\n outline-offset: -2px;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) var(--focus-ring-color);\n }\n}\n\n.footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-2);\n margin-top: var(--space-2);\n}\n\n.footerButton {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: var(--control-height-sm, 1.75rem);\n padding: 0 var(--space-2-5);\n border: 1px solid transparent;\n border-radius: var(--radius-md);\n background: transparent;\n color: var(--primary-color-text, var(--primary-color));\n font: inherit;\n font-size: var(--font-size-xs);\n font-weight: var(--font-weight-medium);\n cursor: pointer;\n transition: background-color var(--transition-fast);\n\n &:hover:not(:disabled) {\n background: var(--hover-color);\n }\n\n &:focus-visible {\n outline: 2px solid transparent;\n outline-offset: 2px;\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) var(--focus-ring-color);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .navButton,\n .day,\n .footerButton {\n transition: none;\n }\n}\n\n@media (forced-colors: active) {\n .day[aria-selected=\"true\"] {\n outline: 2px solid Highlight;\n outline-offset: -2px;\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("./DatePicker.cjs");exports.DatePicker=e.default;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CSSProperties, Ref } from 'react';
|
|
2
|
+
import { DataAttributes } from '../../internal/dataAttributes.cjs';
|
|
3
|
+
/** Props of DatePicker; `data-*` attributes are forwarded to the root element */
|
|
4
|
+
export interface DatePickerProps extends DataAttributes {
|
|
5
|
+
/** Ref to the <input> element */
|
|
6
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
|
+
/**
|
|
8
|
+
* Selected date as `"YYYY-MM-DD"` (controlled; pair with `onChange`).
|
|
9
|
+
* `""` or `null` means "no date" while staying controlled; `undefined`
|
|
10
|
+
* makes the picker uncontrolled.
|
|
11
|
+
*/
|
|
12
|
+
value?: string | null;
|
|
13
|
+
/** Initially selected date as `"YYYY-MM-DD"` (uncontrolled) */
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Called with the selected date (`"YYYY-MM-DD"`), or `""` when the value
|
|
17
|
+
* is cleared
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (value: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Placeholder of the input
|
|
22
|
+
* @default "Select date" (localized)
|
|
23
|
+
*/
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
/** Visible label of the input; without it the input is labelled "Date" (localized) */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Accessible label of the input when no visible label is shown */
|
|
28
|
+
"aria-label"?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Id(s) of the element(s) labelling the input; inside a FormControl it
|
|
31
|
+
* defaults to the FormLabel (unless `label` / `aria-label` is set)
|
|
32
|
+
*/
|
|
33
|
+
"aria-labelledby"?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Id(s) of the element(s) describing the input; merged with the helper /
|
|
36
|
+
* error text of an enclosing FormControl
|
|
37
|
+
*/
|
|
38
|
+
"aria-describedby"?: string;
|
|
39
|
+
/** Id of the input; defaults to the id of an enclosing FormControl */
|
|
40
|
+
id?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Marks the input as required; defaults to the enclosing FormControl's state
|
|
43
|
+
*/
|
|
44
|
+
required?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Shows the value without allowing changes (typing, panel, clearing);
|
|
47
|
+
* defaults to the enclosing FormControl's state
|
|
48
|
+
*/
|
|
49
|
+
readOnly?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Marks the input as invalid (aria-invalid); defaults to the enclosing
|
|
52
|
+
* FormControl's state
|
|
53
|
+
*/
|
|
54
|
+
invalid?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Name of the input
|
|
57
|
+
* @default "date-picker"
|
|
58
|
+
*/
|
|
59
|
+
name?: string;
|
|
60
|
+
/** Called when the popup calendar opens or closes */
|
|
61
|
+
onOpenChange?: (open: boolean) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Disables the picker; defaults to the enclosing FormControl's state
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Allows clearing the value with the suffix button
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
clearable?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Size of the input
|
|
74
|
+
* @default "medium"
|
|
75
|
+
*/
|
|
76
|
+
size?: "small" | "medium" | "large";
|
|
77
|
+
/**
|
|
78
|
+
* Earliest selectable date (`"YYYY-MM-DD"`); earlier days are disabled
|
|
79
|
+
*/
|
|
80
|
+
minDate?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Latest selectable date (`"YYYY-MM-DD"`); later days are disabled
|
|
83
|
+
*/
|
|
84
|
+
maxDate?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Locale of the month heading (`Intl.DateTimeFormat`)
|
|
87
|
+
* @default the library language
|
|
88
|
+
*/
|
|
89
|
+
locale?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Additional class name
|
|
92
|
+
* @default ""
|
|
93
|
+
*/
|
|
94
|
+
className?: string;
|
|
95
|
+
/** Inline styles of the root element */
|
|
96
|
+
style?: CSSProperties;
|
|
97
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CSSProperties, Ref } from 'react';
|
|
2
|
+
import { DataAttributes } from '../../internal/dataAttributes.js';
|
|
3
|
+
/** Props of DatePicker; `data-*` attributes are forwarded to the root element */
|
|
4
|
+
export interface DatePickerProps extends DataAttributes {
|
|
5
|
+
/** Ref to the <input> element */
|
|
6
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
|
+
/**
|
|
8
|
+
* Selected date as `"YYYY-MM-DD"` (controlled; pair with `onChange`).
|
|
9
|
+
* `""` or `null` means "no date" while staying controlled; `undefined`
|
|
10
|
+
* makes the picker uncontrolled.
|
|
11
|
+
*/
|
|
12
|
+
value?: string | null;
|
|
13
|
+
/** Initially selected date as `"YYYY-MM-DD"` (uncontrolled) */
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Called with the selected date (`"YYYY-MM-DD"`), or `""` when the value
|
|
17
|
+
* is cleared
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (value: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Placeholder of the input
|
|
22
|
+
* @default "Select date" (localized)
|
|
23
|
+
*/
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
/** Visible label of the input; without it the input is labelled "Date" (localized) */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Accessible label of the input when no visible label is shown */
|
|
28
|
+
"aria-label"?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Id(s) of the element(s) labelling the input; inside a FormControl it
|
|
31
|
+
* defaults to the FormLabel (unless `label` / `aria-label` is set)
|
|
32
|
+
*/
|
|
33
|
+
"aria-labelledby"?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Id(s) of the element(s) describing the input; merged with the helper /
|
|
36
|
+
* error text of an enclosing FormControl
|
|
37
|
+
*/
|
|
38
|
+
"aria-describedby"?: string;
|
|
39
|
+
/** Id of the input; defaults to the id of an enclosing FormControl */
|
|
40
|
+
id?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Marks the input as required; defaults to the enclosing FormControl's state
|
|
43
|
+
*/
|
|
44
|
+
required?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Shows the value without allowing changes (typing, panel, clearing);
|
|
47
|
+
* defaults to the enclosing FormControl's state
|
|
48
|
+
*/
|
|
49
|
+
readOnly?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Marks the input as invalid (aria-invalid); defaults to the enclosing
|
|
52
|
+
* FormControl's state
|
|
53
|
+
*/
|
|
54
|
+
invalid?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Name of the input
|
|
57
|
+
* @default "date-picker"
|
|
58
|
+
*/
|
|
59
|
+
name?: string;
|
|
60
|
+
/** Called when the popup calendar opens or closes */
|
|
61
|
+
onOpenChange?: (open: boolean) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Disables the picker; defaults to the enclosing FormControl's state
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Allows clearing the value with the suffix button
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
clearable?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Size of the input
|
|
74
|
+
* @default "medium"
|
|
75
|
+
*/
|
|
76
|
+
size?: "small" | "medium" | "large";
|
|
77
|
+
/**
|
|
78
|
+
* Earliest selectable date (`"YYYY-MM-DD"`); earlier days are disabled
|
|
79
|
+
*/
|
|
80
|
+
minDate?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Latest selectable date (`"YYYY-MM-DD"`); later days are disabled
|
|
83
|
+
*/
|
|
84
|
+
maxDate?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Locale of the month heading (`Intl.DateTimeFormat`)
|
|
87
|
+
* @default the library language
|
|
88
|
+
*/
|
|
89
|
+
locale?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Additional class name
|
|
92
|
+
* @default ""
|
|
93
|
+
*/
|
|
94
|
+
className?: string;
|
|
95
|
+
/** Inline styles of the root element */
|
|
96
|
+
style?: CSSProperties;
|
|
97
|
+
}
|