@overdoser/react-toolkit 0.15.0 → 0.17.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 +2 -0
- package/CHANGELOG.md +87 -0
- package/components/Chart/AreaChart.d.ts +5 -1
- package/components/Chart/AreaChart.js +155 -144
- package/components/Chart/BarChart.js +5 -5
- package/components/Chart/PieChart.js +2 -5
- package/components/Chart/RadarChart.js +2 -5
- package/components/Chart/TradingChart.js +258 -257
- package/components/Drawer/Drawer.js +69 -70
- package/components/Dropdown/Dropdown.js +51 -56
- package/components/Modal/Modal.js +42 -47
- package/components/Popover/Popover.js +52 -55
- package/components/SplitButton/SplitButton.js +50 -55
- package/components/inputs/DatePicker/CalendarPanel.d.ts +40 -0
- package/components/inputs/DatePicker/CalendarPanel.js +287 -0
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +41 -0
- package/components/inputs/DatePicker/DatePicker.d.ts +3 -1
- package/components/inputs/DatePicker/DatePicker.js +105 -192
- package/components/inputs/DatePicker/DatePicker.module.scss.js +20 -40
- package/components/inputs/DateTimePicker/DateTimePicker.d.ts +141 -0
- package/components/inputs/DateTimePicker/DateTimePicker.js +232 -0
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +37 -0
- package/components/inputs/DateTimePicker/DateTimeSegments.d.ts +48 -0
- package/components/inputs/DateTimePicker/DateTimeSegments.js +252 -0
- package/components/inputs/DateTimePicker/TimeField.d.ts +18 -0
- package/components/inputs/DateTimePicker/TimeField.js +135 -0
- package/components/inputs/DateTimePicker/index.d.ts +3 -0
- package/components/inputs/DateTimePicker/timeZoneUtils.d.ts +44 -0
- package/components/inputs/DateTimePicker/timeZoneUtils.js +102 -0
- package/components/inputs/NumberInput/NumberInput.js +79 -81
- package/components/inputs/Select/Select.d.ts +5 -0
- package/components/inputs/Select/Select.js +340 -285
- package/hooks/useEscapeLayer.d.ts +36 -0
- package/hooks/useEscapeLayer.js +33 -0
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.js +108 -106
- package/index.layered.css +1 -1
- package/llms.txt +29 -4
- package/manifest.json +127 -1
- package/package.json +1 -1
|
@@ -1,229 +1,142 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import { useClickOutside as
|
|
6
|
-
import { usePortalPosition as
|
|
1
|
+
import { jsx as n, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ee, useState as m, useRef as j, useMemo as y, useCallback as s } from "react";
|
|
3
|
+
import { createPortal as te } from "react-dom";
|
|
4
|
+
import D from "clsx";
|
|
5
|
+
import { useClickOutside as oe } from "../../../hooks/useClickOutside.js";
|
|
6
|
+
import { usePortalPosition as ne } from "../../../hooks/usePortalPosition.js";
|
|
7
7
|
import t from "./DatePicker.module.scss.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { CalendarPanel as re } from "./CalendarPanel.js";
|
|
9
|
+
import { startOfMonth as V, startOfDay as l } from "./dateUtils.js";
|
|
10
|
+
const ae = ee(
|
|
10
11
|
({
|
|
11
|
-
value:
|
|
12
|
-
defaultValue:
|
|
13
|
-
onChange:
|
|
14
|
-
min:
|
|
15
|
-
max:
|
|
12
|
+
value: P,
|
|
13
|
+
defaultValue: q,
|
|
14
|
+
onChange: b,
|
|
15
|
+
min: v,
|
|
16
|
+
max: w,
|
|
16
17
|
disabledDate: O,
|
|
17
|
-
weekStartsOn:
|
|
18
|
-
locale:
|
|
19
|
-
format:
|
|
20
|
-
placeholder:
|
|
21
|
-
inputSize:
|
|
22
|
-
error:
|
|
23
|
-
disabled:
|
|
24
|
-
portal:
|
|
25
|
-
classes:
|
|
26
|
-
className:
|
|
27
|
-
style:
|
|
28
|
-
"aria-label":
|
|
29
|
-
},
|
|
30
|
-
const
|
|
31
|
-
() =>
|
|
32
|
-
[
|
|
33
|
-
),
|
|
34
|
-
() =>
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
-
(e) => C && e < y(C) || N && e > y(N) ? !0 : O?.(e) ?? !1,
|
|
38
|
-
[C, N, O]
|
|
39
|
-
), V = f(
|
|
18
|
+
weekStartsOn: A = 0,
|
|
19
|
+
locale: h,
|
|
20
|
+
format: g,
|
|
21
|
+
placeholder: B = "Select date",
|
|
22
|
+
inputSize: L = "md",
|
|
23
|
+
error: K = !1,
|
|
24
|
+
disabled: r = !1,
|
|
25
|
+
portal: c = !0,
|
|
26
|
+
classes: a,
|
|
27
|
+
className: T,
|
|
28
|
+
style: W,
|
|
29
|
+
"aria-label": z
|
|
30
|
+
}, G) => {
|
|
31
|
+
const k = P !== void 0, [H, J] = m(q ?? null), o = k ? P ?? null : H, [i, f] = m(!1), [Q, M] = m(() => V(o ?? /* @__PURE__ */ new Date())), [U, N] = m(() => l(o ?? /* @__PURE__ */ new Date())), C = j(null), S = j(null), E = ne(C, i && c), X = y(() => l(/* @__PURE__ */ new Date()), []), Y = y(
|
|
32
|
+
() => g ?? ((e) => new Intl.DateTimeFormat(h, { year: "numeric", month: "short", day: "numeric" }).format(e)),
|
|
33
|
+
[g, h]
|
|
34
|
+
), u = y(() => v ? l(v) : void 0, [v]), p = y(() => w ? l(w) : void 0, [w]), Z = s(
|
|
35
|
+
(e) => u && e < u || p && e > p ? !0 : O?.(e) ?? !1,
|
|
36
|
+
[u, p, O]
|
|
37
|
+
), I = s(
|
|
40
38
|
(e) => {
|
|
41
|
-
|
|
39
|
+
k || J(e), b?.(e);
|
|
42
40
|
},
|
|
43
|
-
[
|
|
44
|
-
),
|
|
45
|
-
if (
|
|
46
|
-
const e =
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, []),
|
|
41
|
+
[k, b]
|
|
42
|
+
), x = s(() => {
|
|
43
|
+
if (r) return;
|
|
44
|
+
const e = l(o ?? /* @__PURE__ */ new Date());
|
|
45
|
+
M(V(e)), N(e), f(!0);
|
|
46
|
+
}, [r, o]), d = s((e = !0) => {
|
|
47
|
+
f(!1), e && C.current?.querySelector("input")?.focus();
|
|
48
|
+
}, []), _ = s(
|
|
51
49
|
(e) => {
|
|
52
|
-
|
|
50
|
+
I(e), d();
|
|
53
51
|
},
|
|
54
|
-
[
|
|
52
|
+
[I, d]
|
|
55
53
|
);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
o = p(a, -7);
|
|
76
|
-
break;
|
|
77
|
-
case "ArrowDown":
|
|
78
|
-
o = p(a, 7);
|
|
79
|
-
break;
|
|
80
|
-
case "Home":
|
|
81
|
-
o = p(a, -((a.getDay() - u + 7) % 7));
|
|
82
|
-
break;
|
|
83
|
-
case "End":
|
|
84
|
-
o = p(a, 6 - (a.getDay() - u + 7) % 7);
|
|
85
|
-
break;
|
|
86
|
-
case "PageUp":
|
|
87
|
-
o = g(a, -1);
|
|
88
|
-
break;
|
|
89
|
-
case "PageDown":
|
|
90
|
-
o = g(a, 1);
|
|
91
|
-
break;
|
|
92
|
-
case "Enter":
|
|
93
|
-
case " ":
|
|
94
|
-
e.preventDefault(), $(a);
|
|
95
|
-
return;
|
|
96
|
-
case "Escape":
|
|
97
|
-
e.preventDefault(), P();
|
|
98
|
-
return;
|
|
99
|
-
default:
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
e.preventDefault(), de(o);
|
|
103
|
-
}, ue = (e) => {
|
|
104
|
-
e.key === "ArrowDown" || e.key === "Enter" ? (e.preventDefault(), I()) : e.key === "Escape" && c && v(!1);
|
|
105
|
-
}, z = /* @__PURE__ */ k(
|
|
106
|
-
"div",
|
|
107
|
-
{
|
|
108
|
-
ref: U,
|
|
109
|
-
className: l(t.popover, D && t.portalled, n?.popover),
|
|
110
|
-
style: D ? { position: "fixed", top: H.top + 4, left: H.left } : void 0,
|
|
111
|
-
role: "dialog",
|
|
112
|
-
"aria-modal": "false",
|
|
113
|
-
"aria-label": "Choose date",
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ k("div", { className: l(t.header, n?.header), children: [
|
|
116
|
-
/* @__PURE__ */ r(
|
|
117
|
-
"button",
|
|
118
|
-
{
|
|
119
|
-
type: "button",
|
|
120
|
-
className: l(t.nav, n?.nav),
|
|
121
|
-
onClick: () => b(g(i, -1)),
|
|
122
|
-
"aria-label": "Previous month",
|
|
123
|
-
children: /* @__PURE__ */ r("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M7 2L3 6l4 4" }) })
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
/* @__PURE__ */ r("span", { className: t.monthLabel, "aria-live": "polite", children: ie }),
|
|
127
|
-
/* @__PURE__ */ r(
|
|
128
|
-
"button",
|
|
129
|
-
{
|
|
130
|
-
type: "button",
|
|
131
|
-
className: l(t.nav, n?.nav),
|
|
132
|
-
onClick: () => b(g(i, 1)),
|
|
133
|
-
"aria-label": "Next month",
|
|
134
|
-
children: /* @__PURE__ */ r("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M5 2l4 4-4 4" }) })
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
] }),
|
|
138
|
-
/* @__PURE__ */ r("div", { className: t.weekdays, "aria-hidden": "true", children: le.map((e, o) => /* @__PURE__ */ r("span", { className: t.weekday, children: e }, o)) }),
|
|
139
|
-
/* @__PURE__ */ r(
|
|
140
|
-
"div",
|
|
54
|
+
oe(S, () => f(!1), i);
|
|
55
|
+
const $ = (e) => {
|
|
56
|
+
e.key === "ArrowDown" || e.key === "Enter" ? (e.preventDefault(), x()) : e.key === "Escape" && i && (e.preventDefault(), f(!1));
|
|
57
|
+
}, R = (
|
|
58
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
59
|
+
/* @__PURE__ */ n(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref: S,
|
|
63
|
+
onKeyDown: (e) => {
|
|
64
|
+
e.key === "Escape" && !e.defaultPrevented && (e.preventDefault(), d());
|
|
65
|
+
},
|
|
66
|
+
className: D(t.popover, c && t.portalled, a?.popover),
|
|
67
|
+
style: c ? { position: "fixed", top: E.top + 4, left: E.left } : void 0,
|
|
68
|
+
role: "dialog",
|
|
69
|
+
"aria-modal": "false",
|
|
70
|
+
"aria-label": "Choose date",
|
|
71
|
+
children: /* @__PURE__ */ n(
|
|
72
|
+
re,
|
|
141
73
|
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
t.day,
|
|
157
|
-
o && t.dayOutside,
|
|
158
|
-
E && t.dayToday,
|
|
159
|
-
T && t.daySelected,
|
|
160
|
-
o && n?.dayOutside,
|
|
161
|
-
E && n?.dayToday,
|
|
162
|
-
T && n?.daySelected,
|
|
163
|
-
n?.day
|
|
164
|
-
),
|
|
165
|
-
"aria-selected": T,
|
|
166
|
-
"aria-disabled": fe || void 0,
|
|
167
|
-
"aria-current": E ? "date" : void 0,
|
|
168
|
-
"aria-label": new Intl.DateTimeFormat(s, { dateStyle: "full" }).format(e),
|
|
169
|
-
onClick: () => $(e),
|
|
170
|
-
children: e.getDate()
|
|
171
|
-
},
|
|
172
|
-
S(e)
|
|
173
|
-
);
|
|
174
|
-
})
|
|
74
|
+
viewDate: Q,
|
|
75
|
+
focusedDate: U,
|
|
76
|
+
selected: o,
|
|
77
|
+
today: X,
|
|
78
|
+
minDay: u,
|
|
79
|
+
maxDay: p,
|
|
80
|
+
locale: h,
|
|
81
|
+
weekStartsOn: A,
|
|
82
|
+
isDisabledDay: Z,
|
|
83
|
+
onSelect: _,
|
|
84
|
+
onViewDateChange: M,
|
|
85
|
+
onFocusedDateChange: N,
|
|
86
|
+
onEscape: d,
|
|
87
|
+
classes: a
|
|
175
88
|
}
|
|
176
89
|
)
|
|
177
|
-
|
|
178
|
-
|
|
90
|
+
}
|
|
91
|
+
)
|
|
179
92
|
);
|
|
180
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ F(
|
|
181
94
|
"div",
|
|
182
95
|
{
|
|
183
|
-
ref:
|
|
184
|
-
className:
|
|
185
|
-
style:
|
|
96
|
+
ref: C,
|
|
97
|
+
className: D(t.root, t[L], K && t.error, r && t.disabled, a?.root, T),
|
|
98
|
+
style: W,
|
|
186
99
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ n(
|
|
188
101
|
"input",
|
|
189
102
|
{
|
|
190
|
-
ref:
|
|
103
|
+
ref: G,
|
|
191
104
|
type: "text",
|
|
192
105
|
readOnly: !0,
|
|
193
|
-
className:
|
|
194
|
-
value:
|
|
195
|
-
placeholder:
|
|
196
|
-
disabled:
|
|
197
|
-
"aria-label":
|
|
106
|
+
className: D(t.input, a?.input),
|
|
107
|
+
value: o ? Y(o) : "",
|
|
108
|
+
placeholder: B,
|
|
109
|
+
disabled: r,
|
|
110
|
+
"aria-label": z,
|
|
198
111
|
"aria-haspopup": "dialog",
|
|
199
|
-
"aria-expanded":
|
|
200
|
-
"aria-invalid":
|
|
201
|
-
onClick:
|
|
202
|
-
onKeyDown:
|
|
112
|
+
"aria-expanded": i,
|
|
113
|
+
"aria-invalid": K || void 0,
|
|
114
|
+
onClick: x,
|
|
115
|
+
onKeyDown: $
|
|
203
116
|
}
|
|
204
117
|
),
|
|
205
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ n(
|
|
206
119
|
"button",
|
|
207
120
|
{
|
|
208
121
|
type: "button",
|
|
209
122
|
tabIndex: -1,
|
|
210
|
-
className:
|
|
211
|
-
onClick:
|
|
212
|
-
disabled:
|
|
123
|
+
className: D(t.icon, a?.icon),
|
|
124
|
+
onClick: x,
|
|
125
|
+
disabled: r,
|
|
213
126
|
"aria-label": "Open calendar",
|
|
214
|
-
children: /* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ F("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: [
|
|
128
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "14", height: "13", rx: "2" }),
|
|
129
|
+
/* @__PURE__ */ n("path", { d: "M3 8h14M7 2v3M13 2v3", strokeLinecap: "round" })
|
|
217
130
|
] })
|
|
218
131
|
}
|
|
219
132
|
),
|
|
220
|
-
|
|
133
|
+
i && (c ? typeof document < "u" && te(R, document.body) : R)
|
|
221
134
|
]
|
|
222
135
|
}
|
|
223
136
|
);
|
|
224
137
|
}
|
|
225
138
|
);
|
|
226
|
-
|
|
139
|
+
ae.displayName = "DatePicker";
|
|
227
140
|
export {
|
|
228
|
-
|
|
141
|
+
ae as DatePicker
|
|
229
142
|
};
|
|
@@ -1,45 +1,25 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
3
|
-
sm:
|
|
1
|
+
const o = "crk-root-ZBCoP", r = "crk-sm-7EeFF", c = "crk-input-62G21", t = "crk-md-OVdqx", s = "crk-lg-a9KsJ", e = "crk-icon-jS307", n = "crk-error-c4lUO", l = "crk-disabled-3PiA5", d = "crk-popover-x1-UT", p = "crk-portalled-iPe0Y", i = {
|
|
2
|
+
root: o,
|
|
3
|
+
sm: r,
|
|
4
4
|
input: c,
|
|
5
|
-
md:
|
|
6
|
-
lg:
|
|
7
|
-
icon:
|
|
8
|
-
error:
|
|
9
|
-
disabled:
|
|
10
|
-
popover:
|
|
11
|
-
portalled:
|
|
12
|
-
header: y,
|
|
13
|
-
monthLabel: l,
|
|
14
|
-
nav: i,
|
|
15
|
-
weekdays: p,
|
|
16
|
-
grid: m,
|
|
17
|
-
weekday: u,
|
|
18
|
-
day: h,
|
|
19
|
-
dayOutside: w,
|
|
20
|
-
dayToday: S,
|
|
21
|
-
daySelected: b
|
|
5
|
+
md: t,
|
|
6
|
+
lg: s,
|
|
7
|
+
icon: e,
|
|
8
|
+
error: n,
|
|
9
|
+
disabled: l,
|
|
10
|
+
popover: d,
|
|
11
|
+
portalled: p
|
|
22
12
|
};
|
|
23
13
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
g as default,
|
|
29
|
-
s as disabled,
|
|
30
|
-
a as error,
|
|
31
|
-
m as grid,
|
|
32
|
-
y as header,
|
|
33
|
-
t as icon,
|
|
14
|
+
i as default,
|
|
15
|
+
l as disabled,
|
|
16
|
+
n as error,
|
|
17
|
+
e as icon,
|
|
34
18
|
c as input,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
e as root,
|
|
42
|
-
o as sm,
|
|
43
|
-
u as weekday,
|
|
44
|
-
p as weekdays
|
|
19
|
+
s as lg,
|
|
20
|
+
t as md,
|
|
21
|
+
d as popover,
|
|
22
|
+
p as portalled,
|
|
23
|
+
o as root,
|
|
24
|
+
r as sm
|
|
45
25
|
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { TimeZoneNameStyle } from './timeZoneUtils';
|
|
3
|
+
export interface DateTimePickerClasses {
|
|
4
|
+
root: string;
|
|
5
|
+
/** The segment row (or the read-only input when `format` is set). */
|
|
6
|
+
input: string;
|
|
7
|
+
/** Each editable segment in the field. */
|
|
8
|
+
segment: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
/** Zone label — inline after the time in the field, and in the popover footer. */
|
|
11
|
+
timeZone: string;
|
|
12
|
+
popover: string;
|
|
13
|
+
header: string;
|
|
14
|
+
nav: string;
|
|
15
|
+
grid: string;
|
|
16
|
+
day: string;
|
|
17
|
+
daySelected: string;
|
|
18
|
+
dayToday: string;
|
|
19
|
+
dayOutside: string;
|
|
20
|
+
/** The group of time columns. */
|
|
21
|
+
time: string;
|
|
22
|
+
/** Each scrollable column (hours, minutes, seconds, AM/PM). */
|
|
23
|
+
column: string;
|
|
24
|
+
/** Each option inside a column. */
|
|
25
|
+
option: string;
|
|
26
|
+
/** The selected option in each column. */
|
|
27
|
+
optionSelected: string;
|
|
28
|
+
footer: string;
|
|
29
|
+
}
|
|
30
|
+
export interface DateTimePickerProps {
|
|
31
|
+
/** Controlled selected instant (`null` for empty). */
|
|
32
|
+
value?: Date | null;
|
|
33
|
+
/** Uncontrolled initial instant. */
|
|
34
|
+
defaultValue?: Date | null;
|
|
35
|
+
/** Called with the new instant on every day or time change. */
|
|
36
|
+
onChange?: (date: Date | null) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Earliest selectable instant (inclusive). Days before it are disabled and
|
|
39
|
+
* a time picked before it on the same day clamps up to it.
|
|
40
|
+
*/
|
|
41
|
+
min?: Date;
|
|
42
|
+
/** Latest selectable instant (inclusive). Mirror of `min`. */
|
|
43
|
+
max?: Date;
|
|
44
|
+
/**
|
|
45
|
+
* Predicate to disable arbitrary days. Receives the calendar day at local
|
|
46
|
+
* midnight — with `timeZone` set, that is the wall-clock day in that zone.
|
|
47
|
+
*/
|
|
48
|
+
disabledDate?: (date: Date) => boolean;
|
|
49
|
+
/** First day of the week (0 = Sunday). @default 0 */
|
|
50
|
+
weekStartsOn?: number;
|
|
51
|
+
/** BCP-47 locale for month/weekday names, the default format, and the default hour cycle. */
|
|
52
|
+
locale?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Time zone the picker renders and edits in: any IANA name
|
|
55
|
+
* (`'America/New_York'`), `'UTC'`, or `'system'` for the runtime's local
|
|
56
|
+
* zone. The value stays an absolute instant; only the wall clock shown to
|
|
57
|
+
* the user changes. An unknown zone logs a warning and falls back to UTC.
|
|
58
|
+
* @default 'UTC'
|
|
59
|
+
*/
|
|
60
|
+
timeZone?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Show the zone as a plain label right after the time
|
|
63
|
+
* (`2026-06-15 14:30:00 UTC`, `… GMT+03:00`) and in the popover footer.
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
showTimeZone?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* How the zone label reads: `'longOffset'` → `GMT+03:00`, `'shortOffset'`
|
|
69
|
+
* → `GMT+3`, `'short'` → `EEST`, `'long'` → `Eastern European Summer Time`.
|
|
70
|
+
* UTC always reads `UTC`. @default 'longOffset'
|
|
71
|
+
*/
|
|
72
|
+
timeZoneStyle?: TimeZoneNameStyle;
|
|
73
|
+
/**
|
|
74
|
+
* Layout of the field's segments. `'iso'` is `YYYY-MM-DD HH:mm:ss`
|
|
75
|
+
* regardless of locale; `'locale'` follows the locale's numeric date/time
|
|
76
|
+
* order (e.g. `MM/DD/YYYY, hh:mm:ss AM` for `en-US`). @default 'iso'
|
|
77
|
+
*/
|
|
78
|
+
fieldFormat?: 'iso' | 'locale';
|
|
79
|
+
/**
|
|
80
|
+
* 12- or 24-hour clock for the field and the time columns. Defaults to 24;
|
|
81
|
+
* with `fieldFormat="locale"` it defaults to the locale's convention instead.
|
|
82
|
+
*/
|
|
83
|
+
hourCycle?: 12 | 24;
|
|
84
|
+
/**
|
|
85
|
+
* Spacing of the minute options (5 → 00, 05, 10, …). A value that is not
|
|
86
|
+
* on the grid is still listed so the selection is always visible. @default 5
|
|
87
|
+
*/
|
|
88
|
+
minuteStep?: number;
|
|
89
|
+
/** Show seconds in the field and as a popover column. @default true */
|
|
90
|
+
showSeconds?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Custom display text for the field. Setting it switches the field to a
|
|
93
|
+
* read-only display (click opens the popover) because free-form text cannot
|
|
94
|
+
* be edited segment by segment. Receives the raw instant — pass `timeZone`
|
|
95
|
+
* to `Intl.DateTimeFormat` yourself if needed. Omit it to keep the editable
|
|
96
|
+
* segments (`YYYY-MM-DD HH:mm:ss` by default, see `fieldFormat`).
|
|
97
|
+
*/
|
|
98
|
+
format?: (date: Date) => string;
|
|
99
|
+
/** Placeholder of the read-only display used with `format`. @default 'Select date and time' */
|
|
100
|
+
placeholder?: string;
|
|
101
|
+
/** Text of the button that closes the popover. @default 'Done' */
|
|
102
|
+
doneLabel?: string;
|
|
103
|
+
/** Toolkit size scale. @default 'md' */
|
|
104
|
+
inputSize?: 'sm' | 'md' | 'lg';
|
|
105
|
+
/** Apply error styling. @default false */
|
|
106
|
+
error?: boolean;
|
|
107
|
+
/** Disable the field. @default false */
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
/** Render the popover in a portal at `document.body` (escapes overflow). @default true */
|
|
110
|
+
portal?: boolean;
|
|
111
|
+
/** Override class names on internal elements. */
|
|
112
|
+
classes?: Partial<DateTimePickerClasses>;
|
|
113
|
+
className?: string;
|
|
114
|
+
style?: CSSProperties;
|
|
115
|
+
'aria-label'?: string;
|
|
116
|
+
'aria-describedby'?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Date + time input with two ways to edit. The field itself is a row of
|
|
120
|
+
* segments — `YYYY-MM-DD HH:mm:ss`, 24-hour, in UTC by default (see
|
|
121
|
+
* `fieldFormat`, `hourCycle`, `timeZone`): click one,
|
|
122
|
+
* Up/Down steps it, Left/Right moves between segments, digits type with
|
|
123
|
+
* auto-advance, Backspace clears; on an empty field the first arrow press
|
|
124
|
+
* fills in "now" and typing starts from it. The calendar icon (or Alt+ArrowDown) opens a popover with the
|
|
125
|
+
* `DatePicker` calendar beside scrollable hours / minutes (/ seconds / AM-PM)
|
|
126
|
+
* columns. Picking a day keeps the current time and leaves the popover open;
|
|
127
|
+
* every change commits immediately; "Done", Escape or clicking outside
|
|
128
|
+
* closes. Forwards its ref to the root `<div>`. Binds inside `FormField`
|
|
129
|
+
* (`value: Date | null` / `onChange`).
|
|
130
|
+
*
|
|
131
|
+
* Time-zone aware: the value is always an absolute instant, and `timeZone`
|
|
132
|
+
* chooses the wall clock it is shown and edited in (local by default).
|
|
133
|
+
* The zone is labelled right after the time so users always know which
|
|
134
|
+
* clock they are looking at (`showTimeZone={false}` hides it).
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* <DateTimePicker value={at} onChange={setAt} showTimeZone />
|
|
138
|
+
* // Local zone, locale layout, 12-hour clock where the locale uses it:
|
|
139
|
+
* <DateTimePicker value={at} onChange={setAt} timeZone="system" fieldFormat="locale" />
|
|
140
|
+
*/
|
|
141
|
+
export declare const DateTimePicker: import('react').ForwardRefExoticComponent<DateTimePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|