@tedi-design-system/react 19.1.0-rc.11 → 19.1.0-rc.13
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/carousel/carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/carousel.d.ts +5 -0
- package/src/tedi/components/content/carousel/carousel.es.js +20 -20
- package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/use-carousel.d.ts +1 -1
- package/src/tedi/components/content/carousel/use-carousel.es.js +127 -127
- 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.es.js +181 -176
- package/src/tedi/components/form/slider/slider.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.es.js +38 -38
- package/src/tedi/components/form/slider/slider.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.module.scss.es.js +0 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsx as r, jsxs as f, Fragment as
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Calendar as
|
|
7
|
-
import { getLocaleDateParts as
|
|
8
|
-
import { TextField as
|
|
1
|
+
import { jsx as r, jsxs as f, Fragment as kt } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as Mt, useInteractions as wt, useDismiss as xt, useRole as Ct, FloatingPortal as Rt, FloatingFocusManager as Vt } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import V from "../../../../../external/classnames/index.es.js";
|
|
4
|
+
import we, { useState as _, useRef as Et, useEffect as se, useMemo as W, useCallback as F } from "react";
|
|
5
|
+
import { Button as xe } from "../../buttons/button/button.es.js";
|
|
6
|
+
import { Calendar as Pt } from "../../content/calendar/calendar.es.js";
|
|
7
|
+
import { getLocaleDateParts as St, buildDateRegexSource as $t, buildDisabledMatchers as At, CALENDAR_POPOVER_OFFSET as Ot, CALENDAR_POPOVER_PADDING as Ce } from "../date-field/date-field-helpers.es.js";
|
|
8
|
+
import { TextField as Lt } 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
|
|
18
|
-
const
|
|
19
|
-
const [
|
|
20
|
-
return
|
|
21
|
-
}, le = (a) => a instanceof Date,
|
|
11
|
+
import { useBreakpointProps as Ht } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
12
|
+
import { useLabels as It } from "../../../providers/label-provider/use-labels.es.js";
|
|
13
|
+
import Bt, { isBreakpointBelow as Yt } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
14
|
+
import { et as zt } from "../../../../../external/react-day-picker/dist/esm/locale/et.es.js";
|
|
15
|
+
import { autoUpdate as Gt } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
16
|
+
import { offset as Wt, flip as jt, shift as qt, size as Ut } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
17
|
+
import { dateMatchModifiers as Jt } from "../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.es.js";
|
|
18
|
+
const u = (a) => String(a).padStart(2, "0"), b = (a) => a ? `${u(a.getHours())}:${u(a.getMinutes())}` : "00:00", v = (a, d) => {
|
|
19
|
+
const [j, p] = d.split(":"), E = Number(j), P = Number(p), S = new Date(a);
|
|
20
|
+
return S.setHours(Number.isFinite(E) ? E : 0, Number.isFinite(P) ? P : 0, 0, 0), S;
|
|
21
|
+
}, le = (a) => a instanceof Date, Kt = (a) => a ? `${a.getFullYear()}-${u(a.getMonth() + 1)}-${u(a.getDate())}T${u(a.getHours())}:${u(a.getMinutes())}` : "", Qt = (a) => {
|
|
22
22
|
if (!a) return;
|
|
23
|
-
const
|
|
24
|
-
return isNaN(
|
|
25
|
-
},
|
|
26
|
-
const { getCurrentBreakpointProps:
|
|
27
|
-
layout:
|
|
23
|
+
const d = new Date(a);
|
|
24
|
+
return isNaN(d.getTime()) ? void 0 : d;
|
|
25
|
+
}, Xt = (a) => !a || le(a) ? {} : a, Zt = (a) => le(a) ? a : void 0, ei = we.forwardRef((a, d) => {
|
|
26
|
+
const { getCurrentBreakpointProps: j } = Ht(a.defaultServerBreakpoint), { getLabel: p } = It(), E = Bt(a.defaultServerBreakpoint), P = Yt(E, "md"), {
|
|
27
|
+
layout: S = "side-by-side",
|
|
28
28
|
useNativePicker: Ve = !1,
|
|
29
|
-
monthYearSelectType:
|
|
30
|
-
timeGridVariant:
|
|
29
|
+
monthYearSelectType: Ee = "dropdown",
|
|
30
|
+
timeGridVariant: Pe,
|
|
31
31
|
showOutsideDays: Se = !0,
|
|
32
32
|
availableTimes: N,
|
|
33
|
-
timeHeading:
|
|
34
|
-
clearable:
|
|
35
|
-
} =
|
|
36
|
-
id:
|
|
37
|
-
label:
|
|
38
|
-
placeholder:
|
|
39
|
-
className:
|
|
40
|
-
value:
|
|
41
|
-
defaultValue:
|
|
42
|
-
onChange:
|
|
43
|
-
required:
|
|
44
|
-
readOnly:
|
|
33
|
+
timeHeading: q = p("dateTimeField.timeHeading"),
|
|
34
|
+
clearable: $e = !0
|
|
35
|
+
} = j(a), {
|
|
36
|
+
id: Ae,
|
|
37
|
+
label: Oe,
|
|
38
|
+
placeholder: Le,
|
|
39
|
+
className: He,
|
|
40
|
+
value: oe,
|
|
41
|
+
defaultValue: Ie,
|
|
42
|
+
onChange: U,
|
|
43
|
+
required: de,
|
|
44
|
+
readOnly: Be,
|
|
45
45
|
disabled: $,
|
|
46
46
|
minDate: ce,
|
|
47
47
|
maxDate: me,
|
|
@@ -49,29 +49,29 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
49
49
|
disableFuture: ue,
|
|
50
50
|
disabledMatchers: T,
|
|
51
51
|
stepMinutes: pe = 15,
|
|
52
|
-
initialMonth:
|
|
53
|
-
locale:
|
|
52
|
+
initialMonth: J,
|
|
53
|
+
locale: Ye = zt,
|
|
54
54
|
localeCode: k = "et-EE",
|
|
55
|
-
selectTimeLabel:
|
|
56
|
-
backLabel:
|
|
57
|
-
mode:
|
|
58
|
-
selectionLevel:
|
|
59
|
-
minYear:
|
|
60
|
-
maxYear:
|
|
55
|
+
selectTimeLabel: ze = p("dateTimeField.selectTime"),
|
|
56
|
+
backLabel: Ge = p("dateTimeField.back"),
|
|
57
|
+
mode: We = "single",
|
|
58
|
+
selectionLevel: je = "days",
|
|
59
|
+
minYear: qe,
|
|
60
|
+
maxYear: Ue,
|
|
61
61
|
inputProps: s,
|
|
62
|
-
disabledDateErrorMessage:
|
|
63
|
-
} = a, l =
|
|
64
|
-
|
|
65
|
-
D || (
|
|
66
|
-
}, [D,
|
|
67
|
-
const O =
|
|
62
|
+
disabledDateErrorMessage: Je = p("dateField.disabledDateError")
|
|
63
|
+
} = a, l = We === "range", h = Ve && !l, M = l ? "side-by-side" : S, he = Pe ?? (M === "multi-step" ? "radio" : "button"), ge = oe !== void 0, [Ke, Qe] = _(Ie), y = ge ? oe : Ke, c = l ? Xt(y) : {}, m = l ? void 0 : Zt(y), [D, K] = _(!1), [Xe, Q] = _("date"), [Ze, _e] = _("days"), X = l ? c.from : m, [et, A] = _(() => X ?? J ?? /* @__PURE__ */ new Date()), be = Et(X);
|
|
64
|
+
be.current = X, se(() => {
|
|
65
|
+
D || (Q("date"), _e("days"), A(be.current ?? J ?? /* @__PURE__ */ new Date()));
|
|
66
|
+
}, [D, J]);
|
|
67
|
+
const O = W(
|
|
68
68
|
() => new Intl.DateTimeFormat(k, {
|
|
69
69
|
day: "2-digit",
|
|
70
70
|
month: "2-digit",
|
|
71
71
|
year: "numeric"
|
|
72
72
|
}),
|
|
73
73
|
[k]
|
|
74
|
-
),
|
|
74
|
+
), tt = W(
|
|
75
75
|
() => new Intl.DateTimeFormat(k, {
|
|
76
76
|
day: "2-digit",
|
|
77
77
|
month: "2-digit",
|
|
@@ -79,7 +79,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
79
79
|
}),
|
|
80
80
|
[k]
|
|
81
81
|
), L = F(
|
|
82
|
-
(e) => e ? `${O.format(e)} ${
|
|
82
|
+
(e) => e ? `${O.format(e)} ${u(e.getHours())}:${u(e.getMinutes())}` : "",
|
|
83
83
|
[O]
|
|
84
84
|
), H = F(
|
|
85
85
|
(e) => {
|
|
@@ -89,61 +89,61 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
89
89
|
return !t && !n ? "" : n ? t ? `${t} – ${n}` : n : t;
|
|
90
90
|
},
|
|
91
91
|
[L]
|
|
92
|
-
),
|
|
93
|
-
const e =
|
|
94
|
-
return (
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
97
|
-
const
|
|
98
|
-
t.forEach((
|
|
99
|
-
|
|
92
|
+
), it = W(() => {
|
|
93
|
+
const e = St(O), { fieldOrder: t } = e, n = new RegExp(`^${$t(e)}\\s+(\\d{2}):(\\d{2})$`);
|
|
94
|
+
return (Dt) => {
|
|
95
|
+
const G = Dt.trim().match(n);
|
|
96
|
+
if (!G) return;
|
|
97
|
+
const Te = {};
|
|
98
|
+
t.forEach((Ft, Tt) => {
|
|
99
|
+
Te[Ft] = Number(G[Tt + 1]);
|
|
100
100
|
});
|
|
101
|
-
const
|
|
102
|
-
if (ae === void 0 || re === void 0 || ne === void 0 ||
|
|
103
|
-
const
|
|
104
|
-
if (!(isNaN(
|
|
105
|
-
return
|
|
101
|
+
const ke = Number(G[t.length + 1]), Me = Number(G[t.length + 2]), { day: ae, month: re, year: ne } = Te;
|
|
102
|
+
if (ae === void 0 || re === void 0 || ne === void 0 || ke > 23 || Me > 59) return;
|
|
103
|
+
const R = new Date(ne, re - 1, ae, ke, Me, 0, 0);
|
|
104
|
+
if (!(isNaN(R.getTime()) || R.getFullYear() !== ne || R.getMonth() !== re - 1 || R.getDate() !== ae))
|
|
105
|
+
return R;
|
|
106
106
|
};
|
|
107
|
-
}, [O]), [
|
|
107
|
+
}, [O]), [at, Z] = _(() => H(y)), [ve, g] = _(!1);
|
|
108
108
|
se(() => {
|
|
109
|
-
|
|
109
|
+
Z(H(y));
|
|
110
110
|
}, [y, H]);
|
|
111
|
-
const
|
|
111
|
+
const rt = Mt({
|
|
112
112
|
open: D,
|
|
113
|
-
onOpenChange:
|
|
113
|
+
onOpenChange: K,
|
|
114
114
|
placement: "bottom-end",
|
|
115
115
|
middleware: [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
padding:
|
|
116
|
+
Wt(Ot),
|
|
117
|
+
jt(),
|
|
118
|
+
qt({ padding: Ce }),
|
|
119
|
+
Ut({
|
|
120
|
+
padding: Ce,
|
|
121
121
|
apply({ availableWidth: e, elements: t }) {
|
|
122
122
|
t.floating.style.maxWidth = `${e}px`;
|
|
123
123
|
}
|
|
124
124
|
})
|
|
125
125
|
],
|
|
126
|
-
whileElementsMounted:
|
|
127
|
-
}), { refs:
|
|
128
|
-
|
|
126
|
+
whileElementsMounted: Gt
|
|
127
|
+
}), { refs: ee, context: I, x: nt, y: st, strategy: lt } = rt, ot = wt([
|
|
128
|
+
xt(I, {
|
|
129
129
|
outsidePress: (e) => {
|
|
130
130
|
const t = e.target;
|
|
131
131
|
return !(t != null && t.closest('[role="menu"], [role="listbox"]'));
|
|
132
132
|
}
|
|
133
133
|
}),
|
|
134
|
-
|
|
135
|
-
]),
|
|
134
|
+
Ct(I, { role: "dialog" })
|
|
135
|
+
]), B = we.useRef(null), dt = F(
|
|
136
136
|
(e) => {
|
|
137
|
-
|
|
137
|
+
B.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
|
|
138
138
|
},
|
|
139
|
-
[
|
|
139
|
+
[d]
|
|
140
140
|
);
|
|
141
141
|
se(() => {
|
|
142
142
|
var e;
|
|
143
|
-
(e =
|
|
144
|
-
}, [
|
|
145
|
-
const
|
|
146
|
-
ge ||
|
|
143
|
+
(e = B.current) != null && e.inner && ee.setReference(B.current.inner);
|
|
144
|
+
}, [ee]);
|
|
145
|
+
const o = (e) => {
|
|
146
|
+
ge || Qe(e), U == null || U(e), Z(H(e));
|
|
147
147
|
}, w = F(
|
|
148
148
|
(e) => {
|
|
149
149
|
if (N)
|
|
@@ -156,33 +156,33 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
156
156
|
return !n || n.length === 0 || n.includes(t) ? t : n[0];
|
|
157
157
|
},
|
|
158
158
|
[w]
|
|
159
|
-
),
|
|
159
|
+
), ct = (e) => {
|
|
160
160
|
if (l) {
|
|
161
161
|
const t = e;
|
|
162
162
|
if (!t || !t.from && !t.to) {
|
|
163
|
-
|
|
163
|
+
o(void 0);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
const n = {};
|
|
167
|
-
t.from && (n.from = v(t.from, x(t.from,
|
|
167
|
+
t.from && (n.from = v(t.from, x(t.from, b(c.from)))), t.to && (n.to = v(t.to, x(t.to, b(c.to)))), o(n);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
e instanceof Date ?
|
|
171
|
-
},
|
|
170
|
+
e instanceof Date ? o(v(e, x(e, b(m)))) : e === void 0 && o(void 0);
|
|
171
|
+
}, mt = (e) => {
|
|
172
172
|
if (l) {
|
|
173
|
-
|
|
173
|
+
o({ from: v(e, x(e, b(c.from))) });
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
},
|
|
176
|
+
o(v(e, x(e, b(m))));
|
|
177
|
+
}, ft = (e) => {
|
|
178
178
|
const t = m ?? /* @__PURE__ */ new Date();
|
|
179
|
-
|
|
180
|
-
},
|
|
179
|
+
o(v(t, e)), M === "multi-step" && w(t) && K(!1);
|
|
180
|
+
}, ut = (e) => (t) => {
|
|
181
181
|
const n = c[e] ?? c.from ?? /* @__PURE__ */ new Date();
|
|
182
|
-
|
|
183
|
-
},
|
|
182
|
+
o({ ...c, [e]: v(n, t) });
|
|
183
|
+
}, Y = W(
|
|
184
184
|
() => [
|
|
185
|
-
...
|
|
185
|
+
...At({
|
|
186
186
|
minDate: ce,
|
|
187
187
|
maxDate: me,
|
|
188
188
|
disablePast: fe,
|
|
@@ -192,40 +192,40 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
192
192
|
],
|
|
193
193
|
[ce, me, fe, ue, T]
|
|
194
194
|
), Ne = F(
|
|
195
|
-
(e) =>
|
|
196
|
-
[
|
|
197
|
-
),
|
|
198
|
-
if (
|
|
199
|
-
|
|
195
|
+
(e) => Jt(e, Y),
|
|
196
|
+
[Y]
|
|
197
|
+
), pt = (e) => {
|
|
198
|
+
if (Z(e), e === "") {
|
|
199
|
+
g(!1), o(void 0);
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
|
-
if (
|
|
203
|
-
const n =
|
|
202
|
+
if (h) {
|
|
203
|
+
const n = Qt(e);
|
|
204
204
|
if (!n) {
|
|
205
|
-
|
|
205
|
+
g(!1);
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
if (Ne(n)) {
|
|
209
|
-
|
|
209
|
+
g(!0);
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
g(!1), o(n), A(n);
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
if (l) return;
|
|
216
|
-
const t =
|
|
216
|
+
const t = it(e);
|
|
217
217
|
if (!t) {
|
|
218
|
-
|
|
218
|
+
g(!1);
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
221
|
if (Ne(t)) {
|
|
222
|
-
|
|
222
|
+
g(!0);
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
|
-
|
|
226
|
-
},
|
|
225
|
+
g(!1), o(t), A(t);
|
|
226
|
+
}, ht = () => {
|
|
227
227
|
var t;
|
|
228
|
-
const e = (t =
|
|
228
|
+
const e = (t = B.current) == null ? void 0 : t.input;
|
|
229
229
|
if (e) {
|
|
230
230
|
if (typeof e.showPicker == "function") {
|
|
231
231
|
e.showPicker();
|
|
@@ -233,51 +233,51 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
233
233
|
}
|
|
234
234
|
e.focus();
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, gt = () => {
|
|
237
237
|
if (!$) {
|
|
238
|
-
if (
|
|
239
|
-
|
|
238
|
+
if (h) {
|
|
239
|
+
ht();
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
K((e) => !e);
|
|
243
243
|
}
|
|
244
|
-
},
|
|
245
|
-
|
|
244
|
+
}, _t = M === "multi-step" ? /* @__PURE__ */ r("div", { className: i["tedi-date-time-field__select-time-wrapper"], children: /* @__PURE__ */ r(xe, { type: "button", visualType: "link", size: "small", iconLeft: "schedule", onClick: () => Q("time"), children: ze }) }) : void 0, te = /* @__PURE__ */ r(
|
|
245
|
+
Pt,
|
|
246
246
|
{
|
|
247
|
-
view:
|
|
247
|
+
view: Ze,
|
|
248
248
|
setView: _e,
|
|
249
|
-
selectionLevel:
|
|
250
|
-
currentMonth:
|
|
249
|
+
selectionLevel: je,
|
|
250
|
+
currentMonth: et,
|
|
251
251
|
setCurrentMonth: A,
|
|
252
252
|
mode: l ? "range" : "single",
|
|
253
253
|
value: l ? c : m,
|
|
254
|
-
numberOfMonths: l && !
|
|
255
|
-
locale:
|
|
254
|
+
numberOfMonths: l && !P ? 2 : 1,
|
|
255
|
+
locale: Ye,
|
|
256
256
|
localeCode: k,
|
|
257
257
|
showOutsideDays: Se,
|
|
258
|
-
monthYearSelectType:
|
|
259
|
-
minYear:
|
|
260
|
-
maxYear:
|
|
261
|
-
disabledMatchers:
|
|
262
|
-
required:
|
|
263
|
-
handleSelect:
|
|
264
|
-
applyValue:
|
|
265
|
-
footer:
|
|
266
|
-
className:
|
|
258
|
+
monthYearSelectType: Ee,
|
|
259
|
+
minYear: qe,
|
|
260
|
+
maxYear: Ue,
|
|
261
|
+
disabledMatchers: Y.length ? Y : void 0,
|
|
262
|
+
required: de,
|
|
263
|
+
handleSelect: ct,
|
|
264
|
+
applyValue: mt,
|
|
265
|
+
footer: _t,
|
|
266
|
+
className: V(
|
|
267
267
|
i["tedi-date-time-field__calendar"],
|
|
268
268
|
M === "side-by-side" && i["tedi-date-time-field__calendar--split"]
|
|
269
269
|
)
|
|
270
270
|
}
|
|
271
|
-
), ie = w(m),
|
|
271
|
+
), ie = w(m), bt = !ie || ie.length === 0, ye = /* @__PURE__ */ r(
|
|
272
272
|
Re,
|
|
273
273
|
{
|
|
274
|
-
value:
|
|
274
|
+
value: b(m),
|
|
275
275
|
stepMinutes: pe,
|
|
276
276
|
availableTimes: ie,
|
|
277
277
|
gridVariant: he,
|
|
278
|
-
onChange:
|
|
279
|
-
className:
|
|
280
|
-
[i["tedi-date-time-field__time-picker--wheel"]]:
|
|
278
|
+
onChange: ft,
|
|
279
|
+
className: V(i["tedi-date-time-field__time-picker"], {
|
|
280
|
+
[i["tedi-date-time-field__time-picker--wheel"]]: bt
|
|
281
281
|
})
|
|
282
282
|
}
|
|
283
283
|
), De = (e) => {
|
|
@@ -285,52 +285,57 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
285
285
|
return /* @__PURE__ */ r(
|
|
286
286
|
Re,
|
|
287
287
|
{
|
|
288
|
-
value:
|
|
288
|
+
value: b(c[e]),
|
|
289
289
|
stepMinutes: pe,
|
|
290
290
|
availableTimes: t,
|
|
291
291
|
gridVariant: he,
|
|
292
|
-
onChange:
|
|
293
|
-
className:
|
|
292
|
+
onChange: ut(e),
|
|
293
|
+
className: V(i["tedi-date-time-field__time-picker"], {
|
|
294
294
|
[i["tedi-date-time-field__time-picker--wheel"]]: n
|
|
295
295
|
})
|
|
296
296
|
}
|
|
297
297
|
);
|
|
298
|
-
},
|
|
298
|
+
}, C = s == null ? void 0 : s.helper, z = ve ? { text: Je, type: "error" } : null, vt = z ? C ? Array.isArray(C) ? [...C, z] : [C, z] : z : C, Fe = p("dateField.openCalendar"), Nt = h ? { "aria-label": Fe } : {
|
|
299
|
+
"aria-label": Fe,
|
|
300
|
+
"aria-haspopup": "dialog",
|
|
301
|
+
"aria-expanded": D,
|
|
302
|
+
"aria-controls": D ? I.floatingId : void 0
|
|
303
|
+
}, yt = {
|
|
299
304
|
...s,
|
|
300
|
-
id:
|
|
301
|
-
label:
|
|
302
|
-
value:
|
|
303
|
-
placeholder:
|
|
304
|
-
readOnly:
|
|
305
|
+
id: Ae,
|
|
306
|
+
label: Oe,
|
|
307
|
+
value: h ? Kt(m) : at,
|
|
308
|
+
placeholder: Le,
|
|
309
|
+
readOnly: Be || !h && !!N && !!y,
|
|
305
310
|
icon: "calendar_today",
|
|
306
|
-
isClearable:
|
|
307
|
-
required:
|
|
311
|
+
isClearable: $e,
|
|
312
|
+
required: de,
|
|
308
313
|
disabled: $,
|
|
309
|
-
invalid:
|
|
314
|
+
invalid: ve || (s == null ? void 0 : s.invalid),
|
|
310
315
|
helper: vt,
|
|
311
|
-
onIconClick:
|
|
312
|
-
|
|
313
|
-
|
|
316
|
+
onIconClick: gt,
|
|
317
|
+
iconButtonProps: Nt,
|
|
318
|
+
onChange: pt,
|
|
319
|
+
className: V(i["tedi-date-time-field__textfield"], s == null ? void 0 : s.className, {
|
|
314
320
|
[i["tedi-date-time-field__icon--disabled"]]: $
|
|
315
321
|
}),
|
|
316
322
|
input: {
|
|
317
323
|
...s == null ? void 0 : s.input,
|
|
318
|
-
type:
|
|
319
|
-
"aria-expanded": u ? void 0 : D
|
|
324
|
+
type: h ? "datetime-local" : "text"
|
|
320
325
|
}
|
|
321
326
|
};
|
|
322
|
-
return /* @__PURE__ */ f(
|
|
323
|
-
/* @__PURE__ */ r("div", { className:
|
|
324
|
-
!
|
|
327
|
+
return /* @__PURE__ */ f(kt, { children: [
|
|
328
|
+
/* @__PURE__ */ r("div", { className: V(i["tedi-date-time-field__container"], He), children: /* @__PURE__ */ r(Lt, { ref: dt, ...yt }) }),
|
|
329
|
+
!h && /* @__PURE__ */ r(Rt, { children: D && !$ && /* @__PURE__ */ r(Vt, { context: I, modal: !1, initialFocus: -1, children: /* @__PURE__ */ r(
|
|
325
330
|
"div",
|
|
326
331
|
{
|
|
327
|
-
ref:
|
|
332
|
+
ref: ee.setFloating,
|
|
328
333
|
className: i["tedi-date-time-field__popup"],
|
|
329
|
-
...
|
|
334
|
+
...ot.getFloatingProps({
|
|
330
335
|
style: {
|
|
331
|
-
position:
|
|
332
|
-
top:
|
|
333
|
-
left:
|
|
336
|
+
position: lt,
|
|
337
|
+
top: st ?? 0,
|
|
338
|
+
left: nt ?? 0
|
|
334
339
|
}
|
|
335
340
|
}),
|
|
336
341
|
children: l ? /* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range"], children: [
|
|
@@ -338,11 +343,11 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
338
343
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__range-separator"], "aria-hidden": "true", children: /* @__PURE__ */ r("div", { className: i["tedi-date-time-field__range-separator-line"] }) }),
|
|
339
344
|
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range-times"], children: [
|
|
340
345
|
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range-time"], children: [
|
|
341
|
-
/* @__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:
|
|
346
|
+
/* @__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: q }) }),
|
|
342
347
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-body"], children: De("from") })
|
|
343
348
|
] }),
|
|
344
349
|
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__range-time"], children: [
|
|
345
|
-
/* @__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:
|
|
350
|
+
/* @__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: q }) }),
|
|
346
351
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-body"], children: De("to") })
|
|
347
352
|
] })
|
|
348
353
|
] })
|
|
@@ -350,23 +355,23 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
350
355
|
te,
|
|
351
356
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-separator"], "aria-hidden": "true", children: /* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-separator-line"] }) }),
|
|
352
357
|
/* @__PURE__ */ f("div", { className: i["tedi-date-time-field__split-time"], children: [
|
|
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:
|
|
358
|
+
/* @__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: q }) }),
|
|
354
359
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__split-time-body"], children: ye })
|
|
355
360
|
] })
|
|
356
|
-
] }) :
|
|
361
|
+
] }) : Xe === "date" ? te : /* @__PURE__ */ f("div", { className: i["tedi-date-time-field__time-step"], children: [
|
|
357
362
|
/* @__PURE__ */ f("header", { className: i["tedi-date-time-field__time-header"], children: [
|
|
358
363
|
/* @__PURE__ */ r(
|
|
359
|
-
|
|
364
|
+
xe,
|
|
360
365
|
{
|
|
361
366
|
type: "button",
|
|
362
367
|
visualType: "link",
|
|
363
368
|
size: "small",
|
|
364
369
|
iconLeft: "arrow_back",
|
|
365
|
-
onClick: () =>
|
|
366
|
-
children:
|
|
370
|
+
onClick: () => Q("date"),
|
|
371
|
+
children: Ge
|
|
367
372
|
}
|
|
368
373
|
),
|
|
369
|
-
/* @__PURE__ */ r("span", { className: i["tedi-date-time-field__time-date"], children:
|
|
374
|
+
/* @__PURE__ */ r("span", { className: i["tedi-date-time-field__time-date"], children: tt.format(m ?? /* @__PURE__ */ new Date()) })
|
|
370
375
|
] }),
|
|
371
376
|
/* @__PURE__ */ r("div", { className: i["tedi-date-time-field__time-body"], children: ye })
|
|
372
377
|
] })
|
|
@@ -374,7 +379,7 @@ const p = (a) => String(a).padStart(2, "0"), _ = (a) => a ? `${p(a.getHours())}:
|
|
|
374
379
|
) }) })
|
|
375
380
|
] });
|
|
376
381
|
});
|
|
377
|
-
|
|
382
|
+
ei.displayName = "DateTimeField";
|
|
378
383
|
export {
|
|
379
|
-
|
|
384
|
+
ei as DateTimeField
|
|
380
385
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),B=require("../../../../../external/classnames/index.cjs.js"),e=require("react"),ne=require("../../overlays/tooltip/tooltip.cjs.js"),de=require("../../overlays/tooltip/tooltip-content.cjs.js"),oe=require("../../overlays/tooltip/tooltip-trigger.cjs.js"),ue=require("../feedback-text/feedback-text.cjs.js"),ce=require("../form-label/form-label.cjs.js"),t=require("./slider.module.scss.cjs.js"),pe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=e.forwardRef((m,M)=>{const{getCurrentBreakpointProps:V}=pe.useBreakpointProps(m.defaultServerBreakpoint),{id:E,name:P,label:h,hideLabel:R,required:x,min:l=0,max:d=100,step:D=1,value:c,defaultValue:$,onChange:o,disabled:i=!1,invalid:H=!1,minLabel:p,maxLabel:O,showCurrentValue:f=!1,valueFormatter:_,tooltip:U=!0,addonRight:j,helper:r,className:z,"aria-label":A,"aria-labelledby":G,"aria-valuetext":J}=V(m),K=e.useId(),v=E??`tedi-slider-${K}`,k=r?r.id??`${v}-helper`:void 0,[Q,W]=e.useState($??l),u=Math.min(d,Math.max(l,c??Q)),[X,w]=e.useState(!1),[Y,L]=e.useState(!1),[s,C]=e.useState(!1),N=!!U&&!i,Z=N&&(X||Y||s),ee=e.useCallback(()=>w(!0),[]),ae=e.useCallback(()=>w(!1),[]),te=e.useCallback(()=>L(!0),[]),re=e.useCallback(()=>L(!1),[]),S=e.useRef(null),n=e.useCallback(()=>{S.current=null,C(!1)},[]);e.useEffect(()=>{if(s)return window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[s,n]);const le=e.useCallback(g=>{i||(S.current=g.pointerId,C(!0))},[i]),ie=e.useCallback(g=>{const y=Number(g.target.value);c===void 0&&W(y),o==null||o(y)},[o,c]),T=H||(r==null?void 0:r.type)==="error",q=d===l?0:(u-l)/(d-l)*100,I=_?_(u):u,b=f?I:O,se=B.default(t.default["tedi-slider"],{[t.default["tedi-slider--disabled"]]:i,[t.default["tedi-slider--invalid"]]:T,[t.default["tedi-slider--dragging"]]:s&&!i},z);return a.jsxs("div",{"data-name":"slider",className:se,children:[h&&a.jsx(ce.FormLabel,{id:v,label:h,required:x,hideLabel:R}),a.jsxs("div",{className:t.default["tedi-slider__container"],children:[a.jsxs("div",{className:t.default["tedi-slider__track-row"],children:[p!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":"true",children:p}),a.jsxs("div",{className:t.default["tedi-slider__track"],style:{"--tedi-slider-progress":`${q}%`,"--tedi-slider-progress-ratio":`${q/100}`},children:[a.jsx("input",{ref:M,id:v,name:P,type:"range",min:l,max:d,step:D,value:u,disabled:i,required:x,"aria-invalid":T?"true":void 0,"aria-describedby":k,"aria-label":A,"aria-labelledby":G,"aria-valuetext":J,onChange:ie,onMouseEnter:ee,onMouseLeave:ae,onPointerDown:le,onFocus:te,onBlur:re,className:B.default(t.default["tedi-slider__input"],{[t.default["tedi-slider__input--dragging"]]:s})}),N&&a.jsxs(ne.Tooltip,{open:Z,onToggle:()=>{},focusManager:{returnFocus:!1,initialFocus:-1},placement:"top",trackReferencePosition:!0,children:[a.jsx(oe.TooltipTrigger,{children:a.jsx("span",{className:t.default["tedi-slider__thumb-anchor"],"aria-hidden":"true",tabIndex:-1})}),a.jsx(de.TooltipContent,{children:I})]})]}),b!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":f?void 0:"true","aria-live":f?"polite":void 0,children:b})]}),j&&a.jsx("div",{className:t.default["tedi-slider__addon"],children:j})]}),r&&a.jsx(ue.FeedbackText,{...r,id:k})]})});F.displayName="Slider";exports.Slider=F;
|