@tedi-design-system/react 19.0.0-rc.12 → 19.0.0-rc.14
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/bundle-stats.html +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/content/list/list-item.cjs.js +1 -1
- package/src/tedi/components/content/list/list-item.d.ts +1 -1
- package/src/tedi/components/content/list/list-item.es.js +8 -8
- package/src/tedi/components/content/list/list.cjs.js +1 -1
- package/src/tedi/components/content/list/list.d.ts +1 -1
- package/src/tedi/components/content/list/list.es.js +29 -23
- package/src/tedi/components/content/list/list.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/list/list.module.scss.es.js +3 -2
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +6 -0
- package/src/tedi/components/form/date-field/date-field.es.js +163 -162
- package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -1
- package/src/tedi/components/form/date-time-field/date-time-field.d.ts +6 -0
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +101 -100
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.d.ts +6 -0
- package/src/tedi/components/form/time-field/time-field.es.js +37 -36
- package/src/tedi/components/layout/vertical-spacing/vertical-spacing-item.cjs.js +1 -1
- package/src/tedi/components/layout/vertical-spacing/vertical-spacing-item.d.ts +5 -0
- package/src/tedi/components/layout/vertical-spacing/vertical-spacing-item.es.js +14 -13
- package/src/tedi/components/layout/vertical-spacing/vertical-spacing.cjs.js +1 -1
- package/src/tedi/components/layout/vertical-spacing/vertical-spacing.d.ts +5 -0
- package/src/tedi/components/layout/vertical-spacing/vertical-spacing.es.js +18 -17
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { jsx as r, jsxs as f, Fragment as
|
|
2
|
-
import { useFloating as
|
|
1
|
+
import { jsx as r, jsxs as f, Fragment as Ft } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as Tt, useInteractions as kt, useDismiss as Mt, useRole as wt, FloatingPortal as xt, FloatingFocusManager as Rt } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
3
|
import C from "../../../../../external/classnames/index.es.js";
|
|
4
|
-
import Me, { useState as g, useRef as
|
|
4
|
+
import Me, { useState as g, useRef as Vt, useEffect as se, useMemo as G, useCallback as F } from "react";
|
|
5
5
|
import { Button as we } from "../../buttons/button/button.es.js";
|
|
6
|
-
import { Calendar as
|
|
7
|
-
import { getLocaleDateParts as
|
|
8
|
-
import { TextField as
|
|
6
|
+
import { Calendar as Ct } from "../../content/calendar/calendar.es.js";
|
|
7
|
+
import { getLocaleDateParts as Et, buildDateRegexSource as St, buildDisabledMatchers as Pt, CALENDAR_POPOVER_OFFSET as $t, CALENDAR_POPOVER_PADDING as xe } from "../date-field/date-field-helpers.es.js";
|
|
8
|
+
import { TextField as At } from "../textfield/textfield.es.js";
|
|
9
9
|
import { TimePicker as Re } from "../time-picker/time-picker.es.js";
|
|
10
10
|
import i from "./date-time-field.module.scss.es.js";
|
|
11
|
-
import { useBreakpointProps as
|
|
12
|
-
import { useLabels as
|
|
13
|
-
import
|
|
14
|
-
import { et as
|
|
15
|
-
import { autoUpdate as
|
|
16
|
-
import { offset as
|
|
17
|
-
import { dateMatchModifiers as
|
|
11
|
+
import { useBreakpointProps as Ot } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
12
|
+
import { useLabels as Lt } from "../../../providers/label-provider/use-labels.es.js";
|
|
13
|
+
import Ht, { isBreakpointBelow as It } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
14
|
+
import { et as Bt } from "../../../../../external/react-day-picker/dist/esm/locale/et.es.js";
|
|
15
|
+
import { autoUpdate as Yt } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
16
|
+
import { offset as zt, flip as Gt, shift as Wt, size as jt } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
17
|
+
import { dateMatchModifiers as qt } from "../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.es.js";
|
|
18
18
|
const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:${p(a.getMinutes())}` : "00:00", v = (a, o) => {
|
|
19
19
|
const [W, b] = o.split(":"), E = Number(W), S = Number(b), P = new Date(a);
|
|
20
20
|
return P.setHours(Number.isFinite(E) ? E : 0, Number.isFinite(S) ? S : 0, 0, 0), P;
|
|
21
|
-
}, le = (a) => a instanceof Date,
|
|
21
|
+
}, le = (a) => a instanceof Date, Ut = (a) => a ? `${a.getFullYear()}-${p(a.getMonth() + 1)}-${p(a.getDate())}T${p(a.getHours())}:${p(a.getMinutes())}` : "", Jt = (a) => {
|
|
22
22
|
if (!a) return;
|
|
23
23
|
const o = new Date(a);
|
|
24
24
|
return isNaN(o.getTime()) ? void 0 : o;
|
|
25
|
-
},
|
|
26
|
-
const { getCurrentBreakpointProps: W } =
|
|
25
|
+
}, Kt = (a) => !a || le(a) ? {} : a, Qt = (a) => le(a) ? a : void 0, Xt = Me.forwardRef((a, o) => {
|
|
26
|
+
const { getCurrentBreakpointProps: W } = Ot(a.defaultServerBreakpoint), { getLabel: b } = Lt(), E = Ht(a.defaultServerBreakpoint), S = It(E, "md"), {
|
|
27
27
|
layout: P = "side-by-side",
|
|
28
28
|
useNativePicker: Ve = !1,
|
|
29
29
|
monthYearSelectType: Ce = "dropdown",
|
|
30
30
|
timeGridVariant: Ee,
|
|
31
31
|
showOutsideDays: Se = !0,
|
|
32
32
|
availableTimes: N,
|
|
33
|
-
timeHeading: j = b("dateTimeField.timeHeading")
|
|
33
|
+
timeHeading: j = b("dateTimeField.timeHeading"),
|
|
34
|
+
clearable: Pe = !0
|
|
34
35
|
} = W(a), {
|
|
35
|
-
id:
|
|
36
|
-
label:
|
|
37
|
-
placeholder:
|
|
38
|
-
className:
|
|
36
|
+
id: $e,
|
|
37
|
+
label: Ae,
|
|
38
|
+
placeholder: Oe,
|
|
39
|
+
className: Le,
|
|
39
40
|
value: de,
|
|
40
|
-
defaultValue:
|
|
41
|
+
defaultValue: He,
|
|
41
42
|
onChange: q,
|
|
42
43
|
required: oe,
|
|
43
|
-
readOnly:
|
|
44
|
+
readOnly: Ie,
|
|
44
45
|
disabled: $,
|
|
45
46
|
minDate: ce,
|
|
46
47
|
maxDate: me,
|
|
@@ -49,17 +50,17 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
49
50
|
disabledMatchers: T,
|
|
50
51
|
stepMinutes: pe = 15,
|
|
51
52
|
initialMonth: U,
|
|
52
|
-
locale:
|
|
53
|
+
locale: Be = Bt,
|
|
53
54
|
localeCode: k = "et-EE",
|
|
54
|
-
selectTimeLabel:
|
|
55
|
-
backLabel:
|
|
56
|
-
mode:
|
|
57
|
-
selectionLevel:
|
|
58
|
-
minYear:
|
|
59
|
-
maxYear:
|
|
55
|
+
selectTimeLabel: Ye = b("dateTimeField.selectTime"),
|
|
56
|
+
backLabel: ze = b("dateTimeField.back"),
|
|
57
|
+
mode: Ge = "single",
|
|
58
|
+
selectionLevel: We = "days",
|
|
59
|
+
minYear: je,
|
|
60
|
+
maxYear: qe,
|
|
60
61
|
inputProps: s,
|
|
61
|
-
disabledDateErrorMessage:
|
|
62
|
-
} = a, l =
|
|
62
|
+
disabledDateErrorMessage: Ue = b("dateField.disabledDateError")
|
|
63
|
+
} = a, l = Ge === "range", u = Ve && !l, M = l ? "side-by-side" : P, he = Ee ?? (M === "multi-step" ? "radio" : "button"), ge = de !== void 0, [Je, Ke] = g(He), y = ge ? de : Je, c = l ? Kt(y) : {}, m = l ? void 0 : Qt(y), [D, J] = g(!1), [Qe, K] = g("date"), [Xe, _e] = g("days"), Q = l ? c.from : m, [Ze, A] = g(() => Q ?? U ?? /* @__PURE__ */ new Date()), ve = Vt(Q);
|
|
63
64
|
ve.current = Q, se(() => {
|
|
64
65
|
D || (K("date"), _e("days"), A(ve.current ?? U ?? /* @__PURE__ */ new Date()));
|
|
65
66
|
}, [D, U]);
|
|
@@ -70,7 +71,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
70
71
|
year: "numeric"
|
|
71
72
|
}),
|
|
72
73
|
[k]
|
|
73
|
-
),
|
|
74
|
+
), et = G(
|
|
74
75
|
() => new Intl.DateTimeFormat(k, {
|
|
75
76
|
day: "2-digit",
|
|
76
77
|
month: "2-digit",
|
|
@@ -88,14 +89,14 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
88
89
|
return !t && !n ? "" : n ? t ? `${t} – ${n}` : n : t;
|
|
89
90
|
},
|
|
90
91
|
[L]
|
|
91
|
-
),
|
|
92
|
-
const e =
|
|
93
|
-
return (
|
|
94
|
-
const z =
|
|
92
|
+
), tt = G(() => {
|
|
93
|
+
const e = Et(O), { fieldOrder: t } = e, n = new RegExp(`^${St(e)}\\s+(\\d{2}):(\\d{2})$`);
|
|
94
|
+
return (Nt) => {
|
|
95
|
+
const z = Nt.trim().match(n);
|
|
95
96
|
if (!z) return;
|
|
96
97
|
const Fe = {};
|
|
97
|
-
t.forEach((
|
|
98
|
-
Fe[
|
|
98
|
+
t.forEach((yt, Dt) => {
|
|
99
|
+
Fe[yt] = Number(z[Dt + 1]);
|
|
99
100
|
});
|
|
100
101
|
const Te = Number(z[t.length + 1]), ke = Number(z[t.length + 2]), { day: ae, month: re, year: ne } = Fe;
|
|
101
102
|
if (ae === void 0 || re === void 0 || ne === void 0 || Te > 23 || ke > 59) return;
|
|
@@ -103,35 +104,35 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
103
104
|
if (!(isNaN(V.getTime()) || V.getFullYear() !== ne || V.getMonth() !== re - 1 || V.getDate() !== ae))
|
|
104
105
|
return V;
|
|
105
106
|
};
|
|
106
|
-
}, [O]), [
|
|
107
|
+
}, [O]), [it, X] = g(() => H(y)), [be, h] = g(!1);
|
|
107
108
|
se(() => {
|
|
108
109
|
X(H(y));
|
|
109
110
|
}, [y, H]);
|
|
110
|
-
const
|
|
111
|
+
const at = Tt({
|
|
111
112
|
open: D,
|
|
112
113
|
onOpenChange: J,
|
|
113
114
|
placement: "bottom-end",
|
|
114
115
|
middleware: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
zt($t),
|
|
117
|
+
Gt(),
|
|
118
|
+
Wt({ padding: xe }),
|
|
119
|
+
jt({
|
|
119
120
|
padding: xe,
|
|
120
121
|
apply({ availableWidth: e, elements: t }) {
|
|
121
122
|
t.floating.style.maxWidth = `${e}px`;
|
|
122
123
|
}
|
|
123
124
|
})
|
|
124
125
|
],
|
|
125
|
-
whileElementsMounted:
|
|
126
|
-
}), { refs: Z, context: ee, x:
|
|
127
|
-
|
|
126
|
+
whileElementsMounted: Yt
|
|
127
|
+
}), { refs: Z, context: ee, x: rt, y: nt, strategy: st } = at, lt = kt([
|
|
128
|
+
Mt(ee, {
|
|
128
129
|
outsidePress: (e) => {
|
|
129
130
|
const t = e.target;
|
|
130
131
|
return !(t != null && t.closest('[role="menu"], [role="listbox"]'));
|
|
131
132
|
}
|
|
132
133
|
}),
|
|
133
|
-
|
|
134
|
-
]), I = Me.useRef(null),
|
|
134
|
+
wt(ee, { role: "dialog" })
|
|
135
|
+
]), I = Me.useRef(null), dt = F(
|
|
135
136
|
(e) => {
|
|
136
137
|
I.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
|
|
137
138
|
},
|
|
@@ -142,7 +143,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
142
143
|
(e = I.current) != null && e.inner && Z.setReference(I.current.inner);
|
|
143
144
|
}, [Z]);
|
|
144
145
|
const d = (e) => {
|
|
145
|
-
ge ||
|
|
146
|
+
ge || Ke(e), q == null || q(e), X(H(e));
|
|
146
147
|
}, w = F(
|
|
147
148
|
(e) => {
|
|
148
149
|
if (N)
|
|
@@ -155,7 +156,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
155
156
|
return !n || n.length === 0 || n.includes(t) ? t : n[0];
|
|
156
157
|
},
|
|
157
158
|
[w]
|
|
158
|
-
),
|
|
159
|
+
), ot = (e) => {
|
|
159
160
|
if (l) {
|
|
160
161
|
const t = e;
|
|
161
162
|
if (!t || !t.from && !t.to) {
|
|
@@ -167,21 +168,21 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
167
168
|
return;
|
|
168
169
|
}
|
|
169
170
|
e instanceof Date ? d(v(e, x(e, _(m)))) : e === void 0 && d(void 0);
|
|
170
|
-
},
|
|
171
|
+
}, ct = (e) => {
|
|
171
172
|
if (l) {
|
|
172
173
|
d({ from: v(e, x(e, _(c.from))) });
|
|
173
174
|
return;
|
|
174
175
|
}
|
|
175
176
|
d(v(e, x(e, _(m))));
|
|
176
|
-
},
|
|
177
|
+
}, mt = (e) => {
|
|
177
178
|
const t = m ?? /* @__PURE__ */ new Date();
|
|
178
179
|
d(v(t, e)), M === "multi-step" && w(t) && J(!1);
|
|
179
|
-
},
|
|
180
|
+
}, ft = (e) => (t) => {
|
|
180
181
|
const n = c[e] ?? c.from ?? /* @__PURE__ */ new Date();
|
|
181
182
|
d({ ...c, [e]: v(n, t) });
|
|
182
183
|
}, B = G(
|
|
183
184
|
() => [
|
|
184
|
-
...
|
|
185
|
+
...Pt({
|
|
185
186
|
minDate: ce,
|
|
186
187
|
maxDate: me,
|
|
187
188
|
disablePast: fe,
|
|
@@ -191,15 +192,15 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
191
192
|
],
|
|
192
193
|
[ce, me, fe, ue, T]
|
|
193
194
|
), Ne = F(
|
|
194
|
-
(e) =>
|
|
195
|
+
(e) => qt(e, B),
|
|
195
196
|
[B]
|
|
196
|
-
),
|
|
197
|
+
), ut = (e) => {
|
|
197
198
|
if (X(e), e === "") {
|
|
198
199
|
h(!1), d(void 0);
|
|
199
200
|
return;
|
|
200
201
|
}
|
|
201
202
|
if (u) {
|
|
202
|
-
const n =
|
|
203
|
+
const n = Jt(e);
|
|
203
204
|
if (!n) {
|
|
204
205
|
h(!1);
|
|
205
206
|
return;
|
|
@@ -212,7 +213,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
212
213
|
return;
|
|
213
214
|
}
|
|
214
215
|
if (l) return;
|
|
215
|
-
const t =
|
|
216
|
+
const t = tt(e);
|
|
216
217
|
if (!t) {
|
|
217
218
|
h(!1);
|
|
218
219
|
return;
|
|
@@ -222,7 +223,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
222
223
|
return;
|
|
223
224
|
}
|
|
224
225
|
h(!1), d(t), A(t);
|
|
225
|
-
},
|
|
226
|
+
}, pt = () => {
|
|
226
227
|
var t;
|
|
227
228
|
const e = (t = I.current) == null ? void 0 : t.input;
|
|
228
229
|
if (e) {
|
|
@@ -232,51 +233,51 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
232
233
|
}
|
|
233
234
|
e.focus();
|
|
234
235
|
}
|
|
235
|
-
},
|
|
236
|
+
}, ht = () => {
|
|
236
237
|
if (!$) {
|
|
237
238
|
if (u) {
|
|
238
|
-
|
|
239
|
+
pt();
|
|
239
240
|
return;
|
|
240
241
|
}
|
|
241
242
|
J((e) => !e);
|
|
242
243
|
}
|
|
243
|
-
},
|
|
244
|
-
|
|
244
|
+
}, gt = M === "multi-step" ? /* @__PURE__ */ r("div", { className: i["tedi-date-time-field__select-time-wrapper"], children: /* @__PURE__ */ r(we, { type: "button", visualType: "link", size: "small", iconLeft: "schedule", onClick: () => K("time"), children: Ye }) }) : void 0, te = /* @__PURE__ */ r(
|
|
245
|
+
Ct,
|
|
245
246
|
{
|
|
246
|
-
view:
|
|
247
|
+
view: Xe,
|
|
247
248
|
setView: _e,
|
|
248
|
-
selectionLevel:
|
|
249
|
-
currentMonth:
|
|
249
|
+
selectionLevel: We,
|
|
250
|
+
currentMonth: Ze,
|
|
250
251
|
setCurrentMonth: A,
|
|
251
252
|
mode: l ? "range" : "single",
|
|
252
253
|
value: l ? c : m,
|
|
253
254
|
numberOfMonths: l && !S ? 2 : 1,
|
|
254
|
-
locale:
|
|
255
|
+
locale: Be,
|
|
255
256
|
localeCode: k,
|
|
256
257
|
showOutsideDays: Se,
|
|
257
258
|
monthYearSelectType: Ce,
|
|
258
|
-
minYear:
|
|
259
|
-
maxYear:
|
|
259
|
+
minYear: je,
|
|
260
|
+
maxYear: qe,
|
|
260
261
|
disabledMatchers: B.length ? B : void 0,
|
|
261
262
|
required: oe,
|
|
262
|
-
handleSelect:
|
|
263
|
-
applyValue:
|
|
264
|
-
footer:
|
|
263
|
+
handleSelect: ot,
|
|
264
|
+
applyValue: ct,
|
|
265
|
+
footer: gt,
|
|
265
266
|
className: C(
|
|
266
267
|
i["tedi-date-time-field__calendar"],
|
|
267
268
|
M === "side-by-side" && i["tedi-date-time-field__calendar--split"]
|
|
268
269
|
)
|
|
269
270
|
}
|
|
270
|
-
), ie = w(m),
|
|
271
|
+
), ie = w(m), _t = !ie || ie.length === 0, ye = /* @__PURE__ */ r(
|
|
271
272
|
Re,
|
|
272
273
|
{
|
|
273
274
|
value: _(m),
|
|
274
275
|
stepMinutes: pe,
|
|
275
276
|
availableTimes: ie,
|
|
276
277
|
gridVariant: he,
|
|
277
|
-
onChange:
|
|
278
|
+
onChange: mt,
|
|
278
279
|
className: C(i["tedi-date-time-field__time-picker"], {
|
|
279
|
-
[i["tedi-date-time-field__time-picker--wheel"]]:
|
|
280
|
+
[i["tedi-date-time-field__time-picker--wheel"]]: _t
|
|
280
281
|
})
|
|
281
282
|
}
|
|
282
283
|
), De = (e) => {
|
|
@@ -288,27 +289,27 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
288
289
|
stepMinutes: pe,
|
|
289
290
|
availableTimes: t,
|
|
290
291
|
gridVariant: he,
|
|
291
|
-
onChange:
|
|
292
|
+
onChange: ft(e),
|
|
292
293
|
className: C(i["tedi-date-time-field__time-picker"], {
|
|
293
294
|
[i["tedi-date-time-field__time-picker--wheel"]]: n
|
|
294
295
|
})
|
|
295
296
|
}
|
|
296
297
|
);
|
|
297
|
-
}, R = s == null ? void 0 : s.helper, Y = be ? { text:
|
|
298
|
+
}, R = s == null ? void 0 : s.helper, Y = be ? { text: Ue, type: "error" } : null, vt = Y ? R ? Array.isArray(R) ? [...R, Y] : [R, Y] : Y : R, bt = {
|
|
298
299
|
...s,
|
|
299
|
-
id:
|
|
300
|
-
label:
|
|
301
|
-
value: u ?
|
|
302
|
-
placeholder:
|
|
303
|
-
readOnly:
|
|
300
|
+
id: $e,
|
|
301
|
+
label: Ae,
|
|
302
|
+
value: u ? Ut(m) : it,
|
|
303
|
+
placeholder: Oe,
|
|
304
|
+
readOnly: Ie || !u && !!N && !!y,
|
|
304
305
|
icon: "calendar_today",
|
|
305
|
-
isClearable:
|
|
306
|
+
isClearable: Pe,
|
|
306
307
|
required: oe,
|
|
307
308
|
disabled: $,
|
|
308
309
|
invalid: be || (s == null ? void 0 : s.invalid),
|
|
309
|
-
helper:
|
|
310
|
-
onIconClick:
|
|
311
|
-
onChange:
|
|
310
|
+
helper: vt,
|
|
311
|
+
onIconClick: ht,
|
|
312
|
+
onChange: ut,
|
|
312
313
|
className: C(i["tedi-date-time-field__textfield"], s == null ? void 0 : s.className, {
|
|
313
314
|
[i["tedi-date-time-field__icon--disabled"]]: $
|
|
314
315
|
}),
|
|
@@ -318,18 +319,18 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
318
319
|
"aria-expanded": u ? void 0 : D
|
|
319
320
|
}
|
|
320
321
|
};
|
|
321
|
-
return /* @__PURE__ */ f(
|
|
322
|
-
/* @__PURE__ */ r("div", { className: C(i["tedi-date-time-field__container"],
|
|
323
|
-
!u && /* @__PURE__ */ r(
|
|
322
|
+
return /* @__PURE__ */ f(Ft, { children: [
|
|
323
|
+
/* @__PURE__ */ r("div", { className: C(i["tedi-date-time-field__container"], Le), "aria-haspopup": "dialog", children: /* @__PURE__ */ r(At, { ref: dt, "aria-expanded": u ? void 0 : D, ...bt }) }),
|
|
324
|
+
!u && /* @__PURE__ */ r(xt, { children: D && !$ && /* @__PURE__ */ r(Rt, { context: ee, modal: !1, initialFocus: -1, children: /* @__PURE__ */ r(
|
|
324
325
|
"div",
|
|
325
326
|
{
|
|
326
327
|
ref: Z.setFloating,
|
|
327
328
|
className: i["tedi-date-time-field__popup"],
|
|
328
|
-
...
|
|
329
|
+
...lt.getFloatingProps({
|
|
329
330
|
style: {
|
|
330
|
-
position:
|
|
331
|
-
top:
|
|
332
|
-
left:
|
|
331
|
+
position: st,
|
|
332
|
+
top: nt ?? 0,
|
|
333
|
+
left: rt ?? 0
|
|
333
334
|
}
|
|
334
335
|
}),
|
|
335
336
|
children: l ? /* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range"], children: [
|
|
@@ -352,7 +353,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
352
353
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-header"], children: /* @__PURE__ */ r("span", { className: i["tedi-date-time-field__split-heading"], children: j }) }),
|
|
353
354
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-body"], children: ye })
|
|
354
355
|
] })
|
|
355
|
-
] }) :
|
|
356
|
+
] }) : Qe === "date" ? te : /* @__PURE__ */ f("div", { className: i["tedi-date-time-field__time-step"], children: [
|
|
356
357
|
/* @__PURE__ */ f("header", { className: i["tedi-date-time-field__time-header"], children: [
|
|
357
358
|
/* @__PURE__ */ r(
|
|
358
359
|
we,
|
|
@@ -362,10 +363,10 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
362
363
|
size: "small",
|
|
363
364
|
iconLeft: "arrow_back",
|
|
364
365
|
onClick: () => K("date"),
|
|
365
|
-
children:
|
|
366
|
+
children: ze
|
|
366
367
|
}
|
|
367
368
|
),
|
|
368
|
-
/* @__PURE__ */ r("span", { className: i["tedi-date-time-field__time-date"], children:
|
|
369
|
+
/* @__PURE__ */ r("span", { className: i["tedi-date-time-field__time-date"], children: et.format(m ?? /* @__PURE__ */ new Date()) })
|
|
369
370
|
] }),
|
|
370
371
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__time-body"], children: ye })
|
|
371
372
|
] })
|
|
@@ -373,7 +374,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
373
374
|
) }) })
|
|
374
375
|
] });
|
|
375
376
|
});
|
|
376
|
-
|
|
377
|
+
Xt.displayName = "DateTimeField";
|
|
377
378
|
export {
|
|
378
|
-
|
|
379
|
+
Xt as DateTimeField
|
|
379
380
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),y=require("../../../../../external/classnames/index.cjs.js"),f=require("react"),A=require("../textfield/textfield.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),y=require("../../../../../external/classnames/index.cjs.js"),f=require("react"),A=require("../textfield/textfield.cjs.js"),ge=require("../time-picker/time-picker.cjs.js"),d=require("./time-field.module.scss.cjs.js"),H=require("./time-field-helpers.cjs.js"),ke=require("./time-picker-modal/time-picker-modal.cjs.js"),xe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),K=require("../../../helpers/hooks/use-breakpoint.cjs.js"),F=require("../../overlays/dropdown/dropdown.cjs.js"),he=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),B=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),G=_=>{const{getCurrentBreakpointProps:J}=xe.useBreakpointProps(_.defaultServerBreakpoint),{id:L,label:Q,value:u,defaultValue:W,onChange:C,readOnly:h=!1,disabled:l=!1,required:X,placeholder:Y,inputProps:t,stepMinutes:M=1,className:O,availableTimes:a,modal:P=!1,modalProps:Z}=_,{useNativePicker:$=!1,timePickerTrigger:N="button",showPicker:n=!0,availableTimesVariant:w="grid-buttons",clearable:ee=!0}=J(_),D=u!==void 0,[te,R]=f.useState(u??W??""),m=D?u:te,[T,j]=f.useState(!1),[ie,U]=f.useState(!1),p=N==="input",s=$,ne=K.default(),g=!s&&n&&!h&&!l&&(P===!0||typeof P=="string"&&K.isBreakpointBelow(ne,P)),oe=c.useFloating({open:T,onOpenChange:j,placement:p?"bottom-start":"bottom-end",middleware:[B.offset(H.TIMEPICKER_OFFSET),B.flip(),B.shift()],whileElementsMounted:he.autoUpdate}),{refs:q,context:b,x:re,y:se,strategy:le}=oe,ae=c.useClick(b),de=c.useDismiss(b),ce=c.useRole(b,{role:"listbox"}),S=n&&p&&!h&&!l&&!s&&!g,V=c.useInteractions([...S?[ae]:[],de,ce]),k=e=>{const o=e.trim();D||R(o),C==null||C(o)},ue=e=>{var v;const o=e.target.value??"";(v=t==null?void 0:t.onBlur)==null||v.call(t,e);const r=H.normalizeTime(o);r!==null&&r!==o&&k(r)};f.useEffect(()=>{u!==void 0&&R(u)},[u]);const x=f.useRef(null);f.useEffect(()=>{var e;(e=x.current)!=null&&e.inner&&q.setReference(x.current.inner)},[q]);const fe=()=>{var o;const e=(o=x.current)==null?void 0:o.input;if(e){if(typeof e.showPicker=="function"){e.showPicker();return}e.focus()}},me=()=>j(e=>!e),E=()=>U(!0),pe=()=>{!n||l||(s?fe():g?E():N==="button"&&me())},z=g&&p&&!h?()=>{E()}:void 0,I={...t,id:L,label:Q,value:m,placeholder:Y,readOnly:h||!s&&p,disabled:l||(t==null?void 0:t.disabled),icon:n?"schedule":{name:"schedule",color:"inherit"},isClearable:ee,required:X,onIconClick:n?pe:void 0,onChange:k,onBlur:ue,className:y.default(d.default["tedi-time-field__textfield"],{[d.default["tedi-time-field__icon--disabled"]]:!n||l},{[d.default["tedi-time-field__textfield--disabled"]]:l||(t==null?void 0:t.disabled)},{[d.default["tedi-time-field--native"]]:s}),input:{...t==null?void 0:t.input,...s&&{type:"time"},...z&&{onClick:z}}};if(!s&&n&&!l&&w==="dropdown"&&!!(a!=null&&a.length)){const e=a.indexOf(m),o=e>=0?e:0;return i.jsxs(F.Dropdown,{width:"trigger",defaultActiveIndex:o,children:[i.jsx(F.Dropdown.Trigger,{children:i.jsx("div",{className:y.default(d.default["tedi-time-field__container"],O,{[d.default["tedi-time-field__container--native"]]:s}),children:i.jsx(A.TextField,{ref:x,...I,input:{...I.input,...!p&&{onClick:r=>r.stopPropagation()}}})})}),i.jsx(F.Dropdown.Content,{children:a.map((r,v)=>i.jsx(F.Dropdown.Item,{index:v,active:r===m,onClick:()=>k(r),children:r},r))})]})}return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:y.default(d.default["tedi-time-field__container"],O),...S?V.getReferenceProps():{},"aria-haspopup":n?"listbox":void 0,tabIndex:-1,children:i.jsx(A.TextField,{ref:x,"aria-expanded":n?T:void 0,...I})}),g&&i.jsx(ke.TimePickerModal,{open:ie,onOpenChange:U,value:m,onConfirm:k,stepMinutes:M,availableTimes:a,gridVariant:w==="grid-radio"?"radio":"button",modalProps:Z}),!s&&n&&!l&&!g&&i.jsx(c.FloatingPortal,{children:T&&i.jsx(c.FloatingFocusManager,{context:b,modal:!1,initialFocus:-1,children:i.jsx("div",{ref:q.setFloating,...V.getFloatingProps({style:{position:le,top:se??0,left:re??0}}),children:i.jsx(ge.TimePicker,{value:m,stepMinutes:M,availableTimes:a,onChange:e=>{k(e),a&&j(!1)},gridVariant:w==="grid-radio"?"radio":"button",className:d.default["tedi-time-field__picker-wrapper"]})})})})]})};G.displayName="TimeField";exports.TimeField=G;
|
|
@@ -31,6 +31,12 @@ type TimeFieldBreakpointProps = {
|
|
|
31
31
|
* - 'dropdown' – dropdown list
|
|
32
32
|
*/
|
|
33
33
|
availableTimesVariant?: 'grid-buttons' | 'grid-radio' | 'dropdown';
|
|
34
|
+
/**
|
|
35
|
+
* Whether the field shows a clear button to reset the value. Disable it
|
|
36
|
+
* when the field is required or the value should not be cleared.
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
clearable?: boolean;
|
|
34
40
|
};
|
|
35
41
|
export interface TimeFieldProps extends BreakpointSupport<TimeFieldBreakpointProps> {
|
|
36
42
|
/**
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as q, jsx as i, Fragment as
|
|
2
|
-
import { useFloating as
|
|
1
|
+
import { jsxs as q, jsx as i, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as ue, useClick as pe, useDismiss as ge, useRole as he, useInteractions as ke, FloatingPortal as ve, FloatingFocusManager as be } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
3
|
import y from "../../../../../external/classnames/index.es.js";
|
|
4
|
-
import
|
|
4
|
+
import Ce, { useState as N, useEffect as z } from "react";
|
|
5
5
|
import { TextField as A } from "../textfield/textfield.es.js";
|
|
6
|
-
import { TimePicker as
|
|
6
|
+
import { TimePicker as xe } from "../time-picker/time-picker.es.js";
|
|
7
7
|
import d from "./time-field.module.scss.es.js";
|
|
8
|
-
import { normalizeTime as
|
|
9
|
-
import { TimePickerModal as
|
|
10
|
-
import { useBreakpointProps as
|
|
11
|
-
import
|
|
8
|
+
import { normalizeTime as _e, TIMEPICKER_OFFSET as Fe } from "./time-field-helpers.es.js";
|
|
9
|
+
import { TimePickerModal as Pe } from "./time-picker-modal/time-picker-modal.es.js";
|
|
10
|
+
import { useBreakpointProps as Te } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
11
|
+
import we, { isBreakpointBelow as Ie } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
12
12
|
import { Dropdown as b } from "../../overlays/dropdown/dropdown.es.js";
|
|
13
|
-
import { autoUpdate as
|
|
14
|
-
import { offset as
|
|
15
|
-
const
|
|
16
|
-
const { getCurrentBreakpointProps: K } =
|
|
13
|
+
import { autoUpdate as ye } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
14
|
+
import { offset as Ne, flip as Be, shift as Oe } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
15
|
+
const Me = (C) => {
|
|
16
|
+
const { getCurrentBreakpointProps: K } = Te(C.defaultServerBreakpoint), {
|
|
17
17
|
id: G,
|
|
18
18
|
label: H,
|
|
19
19
|
value: c,
|
|
@@ -33,32 +33,33 @@ const Oe = (C) => {
|
|
|
33
33
|
useNativePicker: X = !1,
|
|
34
34
|
timePickerTrigger: M = "button",
|
|
35
35
|
showPicker: o = !0,
|
|
36
|
-
availableTimesVariant: F = "grid-buttons"
|
|
37
|
-
|
|
36
|
+
availableTimesVariant: F = "grid-buttons",
|
|
37
|
+
clearable: Y = !0
|
|
38
|
+
} = K(C), R = c !== void 0, [Z, V] = N(c ?? J ?? ""), f = R ? c : Z, [P, T] = N(!1), [$, E] = N(!1), m = M === "input", l = X, ee = we(), u = !l && o && !h && !s && (_ === !0 || typeof _ == "string" && Ie(ee, _)), te = ue({
|
|
38
39
|
open: P,
|
|
39
40
|
onOpenChange: T,
|
|
40
41
|
placement: m ? "bottom-start" : "bottom-end",
|
|
41
|
-
middleware: [
|
|
42
|
-
whileElementsMounted:
|
|
43
|
-
}), { refs: w, context: k, x:
|
|
42
|
+
middleware: [Ne(Fe), Be(), Oe()],
|
|
43
|
+
whileElementsMounted: ye
|
|
44
|
+
}), { refs: w, context: k, x: ie, y: oe, strategy: ne } = te, re = pe(k), le = ge(k), se = he(k, { role: "listbox" }), U = o && m && !h && !s && !l && !u, D = ke([...U ? [re] : [], le, se]), p = (e) => {
|
|
44
45
|
const n = e.trim();
|
|
45
46
|
R || V(n), x == null || x(n);
|
|
46
|
-
},
|
|
47
|
+
}, ae = (e) => {
|
|
47
48
|
var v;
|
|
48
49
|
const n = e.target.value ?? "";
|
|
49
50
|
(v = t == null ? void 0 : t.onBlur) == null || v.call(t, e);
|
|
50
|
-
const r =
|
|
51
|
+
const r = _e(n);
|
|
51
52
|
r !== null && r !== n && p(r);
|
|
52
53
|
};
|
|
53
54
|
z(() => {
|
|
54
55
|
c !== void 0 && V(c);
|
|
55
56
|
}, [c]);
|
|
56
|
-
const g =
|
|
57
|
+
const g = Ce.useRef(null);
|
|
57
58
|
z(() => {
|
|
58
59
|
var e;
|
|
59
60
|
(e = g.current) != null && e.inner && w.setReference(g.current.inner);
|
|
60
61
|
}, [w]);
|
|
61
|
-
const
|
|
62
|
+
const de = () => {
|
|
62
63
|
var n;
|
|
63
64
|
const e = (n = g.current) == null ? void 0 : n.input;
|
|
64
65
|
if (e) {
|
|
@@ -68,8 +69,8 @@ const Oe = (C) => {
|
|
|
68
69
|
}
|
|
69
70
|
e.focus();
|
|
70
71
|
}
|
|
71
|
-
},
|
|
72
|
-
!o || s || (l ?
|
|
72
|
+
}, ce = () => T((e) => !e), S = () => E(!0), fe = () => {
|
|
73
|
+
!o || s || (l ? de() : u ? S() : M === "button" && ce());
|
|
73
74
|
}, j = u && m && !h ? () => {
|
|
74
75
|
S();
|
|
75
76
|
} : void 0, I = {
|
|
@@ -81,11 +82,11 @@ const Oe = (C) => {
|
|
|
81
82
|
readOnly: h || !l && m,
|
|
82
83
|
disabled: s || (t == null ? void 0 : t.disabled),
|
|
83
84
|
icon: o ? "schedule" : { name: "schedule", color: "inherit" },
|
|
84
|
-
isClearable:
|
|
85
|
+
isClearable: Y,
|
|
85
86
|
required: L,
|
|
86
|
-
onIconClick: o ?
|
|
87
|
+
onIconClick: o ? fe : void 0,
|
|
87
88
|
onChange: p,
|
|
88
|
-
onBlur:
|
|
89
|
+
onBlur: ae,
|
|
89
90
|
className: y(
|
|
90
91
|
d["tedi-time-field__textfield"],
|
|
91
92
|
{ [d["tedi-time-field__icon--disabled"]]: !o || s },
|
|
@@ -125,7 +126,7 @@ const Oe = (C) => {
|
|
|
125
126
|
/* @__PURE__ */ i(b.Content, { children: a.map((r, v) => /* @__PURE__ */ i(b.Item, { index: v, active: r === f, onClick: () => p(r), children: r }, r)) })
|
|
126
127
|
] });
|
|
127
128
|
}
|
|
128
|
-
return /* @__PURE__ */ q(
|
|
129
|
+
return /* @__PURE__ */ q(me, { children: [
|
|
129
130
|
/* @__PURE__ */ i(
|
|
130
131
|
"div",
|
|
131
132
|
{
|
|
@@ -137,9 +138,9 @@ const Oe = (C) => {
|
|
|
137
138
|
}
|
|
138
139
|
),
|
|
139
140
|
u && /* @__PURE__ */ i(
|
|
140
|
-
|
|
141
|
+
Pe,
|
|
141
142
|
{
|
|
142
|
-
open:
|
|
143
|
+
open: $,
|
|
143
144
|
onOpenChange: E,
|
|
144
145
|
value: f,
|
|
145
146
|
onConfirm: p,
|
|
@@ -149,19 +150,19 @@ const Oe = (C) => {
|
|
|
149
150
|
modalProps: W
|
|
150
151
|
}
|
|
151
152
|
),
|
|
152
|
-
!l && o && !s && !u && /* @__PURE__ */ i(
|
|
153
|
+
!l && o && !s && !u && /* @__PURE__ */ i(ve, { children: P && /* @__PURE__ */ i(be, { context: k, modal: !1, initialFocus: -1, children: /* @__PURE__ */ i(
|
|
153
154
|
"div",
|
|
154
155
|
{
|
|
155
156
|
ref: w.setFloating,
|
|
156
157
|
...D.getFloatingProps({
|
|
157
158
|
style: {
|
|
158
|
-
position:
|
|
159
|
-
top:
|
|
160
|
-
left:
|
|
159
|
+
position: ne,
|
|
160
|
+
top: oe ?? 0,
|
|
161
|
+
left: ie ?? 0
|
|
161
162
|
}
|
|
162
163
|
}),
|
|
163
164
|
children: /* @__PURE__ */ i(
|
|
164
|
-
|
|
165
|
+
xe,
|
|
165
166
|
{
|
|
166
167
|
value: f,
|
|
167
168
|
stepMinutes: B,
|
|
@@ -177,7 +178,7 @@ const Oe = (C) => {
|
|
|
177
178
|
) }) })
|
|
178
179
|
] });
|
|
179
180
|
};
|
|
180
|
-
|
|
181
|
+
Me.displayName = "TimeField";
|
|
181
182
|
export {
|
|
182
|
-
|
|
183
|
+
Me as TimeField
|
|
183
184
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),m=require("../../../../../external/classnames/index.cjs.js"),d=require("./vertical-spacing.module.scss.cjs.js"),p=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),i=e=>{const{getCurrentBreakpointProps:r}=p.useBreakpointProps(e.defaultServerBreakpoint),{children:a,className:n,element:s="div",size:t=1,style:c,...l}=r(e),o=m.default(d.default["tedi-vertical-spacing__item"],n);return u.jsx(s,{"data-name":"vertical-spacing-item",...l,style:{"--vertical-spacing-internal":`${t}${t!==0?"em":""}`,...c},className:o,children:a})};exports.VerticalSpacingItem=i;exports.default=i;
|
|
@@ -21,6 +21,11 @@ export interface VerticalSpacingItemProps extends BreakpointSupport<VerticalSpac
|
|
|
21
21
|
* Additional class name(s) to apply to the element
|
|
22
22
|
*/
|
|
23
23
|
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Additional inline styles, merged with the internal spacing custom property
|
|
26
|
+
* (rather than replacing it).
|
|
27
|
+
*/
|
|
28
|
+
style?: React.CSSProperties;
|
|
24
29
|
}
|
|
25
30
|
export declare const VerticalSpacingItem: (props: VerticalSpacingItemProps) => JSX.Element;
|
|
26
31
|
export default VerticalSpacingItem;
|