@tedi-design-system/react 19.0.0-rc.8 → 19.0.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/bundle-stats.html +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +4 -3
- package/src/community/components/card/card.cjs.js +1 -1
- package/src/community/components/card/card.es.js +20 -19
- package/src/community/components/color-tokens.cjs.js +1 -0
- package/src/community/components/color-tokens.d.ts +14 -0
- package/src/community/components/color-tokens.es.js +35 -0
- package/src/community/components/layout/header/components/header-role/header-role.cjs.js +1 -1
- package/src/community/components/layout/header/components/header-role/header-role.es.js +19 -19
- package/src/community/components/layout/header/components/header-role/header-role.module.scss.cjs.js +1 -1
- package/src/community/components/layout/header/components/header-role/header-role.module.scss.es.js +2 -1
- package/src/community/components/map-components/button-group/button-group.cjs.js +1 -1
- package/src/community/components/map-components/button-group/button-group.es.js +18 -14
- package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
- package/src/community/components/map-components/map-button/map-button.es.js +34 -33
- package/src/community/components/tooltip/tooltip.cjs.js +1 -1
- package/src/community/components/tooltip/tooltip.es.js +31 -30
- 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/content/text-group/text-group-list/text-group-list.d.ts +6 -5
- package/src/tedi/components/content/text-group/text-group.d.ts +7 -5
- 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/select/components/select-multi-option.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-multi-option.es.js +24 -23
- package/src/tedi/components/form/select/components/select-single-option.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-single-option.es.js +11 -10
- package/src/tedi/components/form/select/select.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/select/select.module.scss.es.js +2 -1
- 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/form/time-picker/time-picker.cjs.js +1 -1
- package/src/tedi/components/form/time-picker/time-picker.es.js +1 -1
- 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
- package/src/tedi/components/misc/ellipsis/ellipsis.cjs.js +1 -1
- package/src/tedi/components/misc/ellipsis/ellipsis.es.js +20 -19
- package/src/tedi/components/misc/timeline/timeline.cjs.js +1 -1
- package/src/tedi/components/misc/timeline/timeline.es.js +24 -27
- package/src/tedi/components/overlays/overlay/overlay-content.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-content.d.ts +6 -1
- package/src/tedi/components/overlays/overlay/overlay-content.es.js +28 -27
- package/src/tedi/components/overlays/overlay/overlay.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay.es.js +29 -28
- package/src/tedi/components/overlays/popover/popover-content.cjs.js +1 -1
- package/src/tedi/components/overlays/popover/popover-content.d.ts +7 -0
- package/src/tedi/components/overlays/popover/popover-content.es.js +47 -36
- package/src/tedi/helpers/index.d.ts +1 -0
|
@@ -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 _=require("react/jsx-runtime"),I=require("../../../../../../external/classnames/index.cjs.js"),E=require("../../../misc/option-content/option-content.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),I=require("../../../../../../external/classnames/index.cjs.js"),E=require("../../../misc/option-content/option-content.cjs.js"),i=require("../select.module.scss.cjs.js"),t=require("./select-bulk-helpers.cjs.js"),O=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),g=({renderOption:f,...e})=>{var L;const c=e.data.value===t.SELECT_ALL_VALUE,u=t.isGroupSentinel(e.data),S=!!((L=e.data.customData)!=null&&L.__tediInGroup);let a=e.isSelected,r=!1;if(c){const l=t.getEnabledOptions(e.options).filter(s=>s.value!==t.SELECT_ALL_VALUE),n=(e.getValue()??[]).filter(s=>s.value!==t.SELECT_ALL_VALUE);a=t.areAllSelected(n,l),r=t.isIndeterminate(n,l)}else if(u){const l=e.options,b=l.findIndex(o=>o.value===e.data.value),n=[];for(let o=b+1;o<l.length;o++){const d=l[o];if(!d||typeof d.value=="string"&&(d.value.startsWith(t.GROUP_OPTION_PREFIX)||d.value===t.SELECT_ALL_VALUE))break;d.isDisabled||n.push(d)}const s=e.getValue()??[];a=t.areAllSelected(s,n),r=t.isIndeterminate(s,n)}const m=I.default(i.default["tedi-select__option"],i.default["tedi-select__option--control"],{[i.default["tedi-select__option--disabled"]]:e.isDisabled},{[i.default["tedi-select__option--focused"]]:e.isFocused},{[i.default["tedi-select__option--select-all"]]:c},{[i.default["tedi-select__option--group"]]:u},{[i.default["tedi-select__option--indented"]]:S}),{tabIndex:A,...x}=e.innerProps;return _.jsx(O.c.Option,{...e,innerProps:{...x,tabIndex:A,role:"option","aria-selected":a},className:m,children:f&&!c&&!u?f(e):_.jsx(E.OptionContent,{type:"checkbox",indicatorSemantics:"control",selected:a,indeterminate:r,disabled:e.isDisabled,children:_.jsx(E.OptionContent.Label,{children:e.children})})})};exports.SelectMultiOption=g;
|
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import E from "../../../../../../external/classnames/index.es.js";
|
|
3
3
|
import { OptionContent as h } from "../../../misc/option-content/option-content.es.js";
|
|
4
|
-
import
|
|
5
|
-
import { SELECT_ALL_VALUE as c, isGroupSentinel as P, getEnabledOptions as
|
|
6
|
-
import { c as
|
|
7
|
-
const V = ({ renderOption:
|
|
8
|
-
var
|
|
9
|
-
const d = e.data.value === c, r = P(e.data), S = !!((
|
|
4
|
+
import t from "../select.module.scss.es.js";
|
|
5
|
+
import { SELECT_ALL_VALUE as c, isGroupSentinel as P, getEnabledOptions as p, areAllSelected as I, isIndeterminate as v, GROUP_OPTION_PREFIX as y } from "./select-bulk-helpers.es.js";
|
|
6
|
+
import { c as G } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
7
|
+
const V = ({ renderOption: _, ...e }) => {
|
|
8
|
+
var f;
|
|
9
|
+
const d = e.data.value === c, r = P(e.data), S = !!((f = e.data.customData) != null && f.__tediInGroup);
|
|
10
10
|
let a = e.isSelected, u = !1;
|
|
11
11
|
if (d) {
|
|
12
|
-
const
|
|
13
|
-
a = I(
|
|
12
|
+
const i = p(e.options).filter((n) => n.value !== c), l = (e.getValue() ?? []).filter((n) => n.value !== c);
|
|
13
|
+
a = I(l, i), u = v(l, i);
|
|
14
14
|
} else if (r) {
|
|
15
|
-
const
|
|
16
|
-
for (let
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
15
|
+
const i = e.options, b = i.findIndex((s) => s.value === e.data.value), l = [];
|
|
16
|
+
for (let s = b + 1; s < i.length; s++) {
|
|
17
|
+
const o = i[s];
|
|
18
|
+
if (!o || typeof o.value == "string" && (o.value.startsWith(y) || o.value === c))
|
|
19
19
|
break;
|
|
20
|
-
|
|
20
|
+
o.isDisabled || l.push(o);
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
a = I(
|
|
22
|
+
const n = e.getValue() ?? [];
|
|
23
|
+
a = I(n, l), u = v(n, l);
|
|
24
24
|
}
|
|
25
25
|
const g = E(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{ [
|
|
29
|
-
{ [
|
|
30
|
-
{ [
|
|
31
|
-
{ [
|
|
26
|
+
t["tedi-select__option"],
|
|
27
|
+
t["tedi-select__option--control"],
|
|
28
|
+
{ [t["tedi-select__option--disabled"]]: e.isDisabled },
|
|
29
|
+
{ [t["tedi-select__option--focused"]]: e.isFocused },
|
|
30
|
+
{ [t["tedi-select__option--select-all"]]: d },
|
|
31
|
+
{ [t["tedi-select__option--group"]]: r },
|
|
32
|
+
{ [t["tedi-select__option--indented"]]: S }
|
|
32
33
|
), { tabIndex: O, ...x } = e.innerProps;
|
|
33
34
|
return /* @__PURE__ */ m(
|
|
34
|
-
|
|
35
|
+
G.Option,
|
|
35
36
|
{
|
|
36
37
|
...e,
|
|
37
38
|
innerProps: { ...x, tabIndex: O, role: "option", "aria-selected": a },
|
|
38
39
|
className: g,
|
|
39
|
-
children:
|
|
40
|
+
children: _ && !d && !r ? _(e) : /* @__PURE__ */ m(
|
|
40
41
|
h,
|
|
41
42
|
{
|
|
42
43
|
type: "checkbox",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("../../../../../../external/classnames/index.cjs.js"),d=require("../../../misc/option-content/option-content.cjs.js"),t=require("../select.module.scss.cjs.js"),s=require("../../../../../../external/react-select/dist/index-641ee5b8.esm.cjs.js"),a=({showRadioButtons:i,renderOption:l,...e})=>{const c=o.default(t.default["tedi-select__option"],{[t.default["tedi-select__option--control"]]:i},{[t.default["tedi-select__option--disabled"]]:e.isDisabled},{[t.default["tedi-select__option--selected"]]:e.isSelected&&!i},{[t.default["tedi-select__option--focused"]]:e.isFocused});return n.jsx(s.c.Option,{...e,innerProps:{role:"option","aria-selected":e.isSelected,"aria-disabled":e.isDisabled,...e.innerProps},className:c,children:i?n.jsx(d.OptionContent,{type:"radio",indicatorSemantics:"control",selected:e.isSelected,disabled:e.isDisabled,children:n.jsx(d.OptionContent.Label,{children:e.children})}):l?l(e):e.children})};exports.SelectSingleOption=a;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import o from "../../../../../../external/classnames/index.es.js";
|
|
3
|
-
import { OptionContent as
|
|
3
|
+
import { OptionContent as n } from "../../../misc/option-content/option-content.es.js";
|
|
4
4
|
import i from "../select.module.scss.es.js";
|
|
5
5
|
import { c as s } from "../../../../../../external/react-select/dist/index-641ee5b8.esm.es.js";
|
|
6
|
-
const f = ({ showRadioButtons:
|
|
7
|
-
const
|
|
6
|
+
const f = ({ showRadioButtons: t, renderOption: c, ...e }) => {
|
|
7
|
+
const d = o(
|
|
8
8
|
i["tedi-select__option"],
|
|
9
|
+
{ [i["tedi-select__option--control"]]: t },
|
|
9
10
|
{ [i["tedi-select__option--disabled"]]: e.isDisabled },
|
|
10
|
-
{ [i["tedi-select__option--selected"]]: e.isSelected && !
|
|
11
|
+
{ [i["tedi-select__option--selected"]]: e.isSelected && !t },
|
|
11
12
|
{ [i["tedi-select__option--focused"]]: e.isFocused }
|
|
12
13
|
);
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ l(
|
|
14
15
|
s.Option,
|
|
15
16
|
{
|
|
16
17
|
...e,
|
|
@@ -20,15 +21,15 @@ const f = ({ showRadioButtons: l, renderOption: c, ...e }) => {
|
|
|
20
21
|
"aria-disabled": e.isDisabled,
|
|
21
22
|
...e.innerProps
|
|
22
23
|
},
|
|
23
|
-
className:
|
|
24
|
-
children:
|
|
25
|
-
|
|
24
|
+
className: d,
|
|
25
|
+
children: t ? /* @__PURE__ */ l(
|
|
26
|
+
n,
|
|
26
27
|
{
|
|
27
28
|
type: "radio",
|
|
28
29
|
indicatorSemantics: "control",
|
|
29
30
|
selected: e.isSelected,
|
|
30
31
|
disabled: e.isDisabled,
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
+
children: /* @__PURE__ */ l(n.Label, { children: e.children })
|
|
32
33
|
}
|
|
33
34
|
) : c ? c(e) : e.children
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-select__control":"tedi-select__control-dbce8bb7","tedi-select__value-container":"tedi-select__value-container-253d079a","tedi-select__indicators-container":"tedi-select__indicators-container-0fc8fa2a","tedi-select__input":"tedi-select__input-5525b622","tedi-select":"tedi-select-8b014852","tedi-select--disabled":"tedi-select--disabled-2d4b8ddd","tedi-select--invalid":"tedi-select--invalid-3901c89c","tedi-select--valid":"tedi-select--valid-969c0297","tedi-select__control--focused":"tedi-select__control--focused-0e632efe","tedi-select__arrow":"tedi-select__arrow-94b5ef4a","tedi-select__loading-indicator":"tedi-select__loading-indicator-a35a63ca","tedi-select__dropdown-indicator":"tedi-select__dropdown-indicator-5a948baa","tedi-select__clear-indicator":"tedi-select__clear-indicator-68b60b12","tedi-select__menu-portal":"tedi-select__menu-portal-d5349f37","tedi-select__menu":"tedi-select__menu-bf54b75b","tedi-select__menu-list--grid":"tedi-select__menu-list--grid-393f3232","tedi-select__menu-list":"tedi-select__menu-list-0aa06e24","tedi-select__menu-list-inner":"tedi-select__menu-list-inner-471e5cf8","tedi-select__menu-list-footer":"tedi-select__menu-list-footer-eb1d3bbc","tedi-select__option":"tedi-select__option-6f811381","tedi-select__option--disabled":"tedi-select__option--disabled-d3aff112","tedi-select__option--focused":"tedi-select__option--focused-1d972ff1","tedi-select__option--
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-select__control":"tedi-select__control-dbce8bb7","tedi-select__value-container":"tedi-select__value-container-253d079a","tedi-select__indicators-container":"tedi-select__indicators-container-0fc8fa2a","tedi-select__input":"tedi-select__input-5525b622","tedi-select":"tedi-select-8b014852","tedi-select--disabled":"tedi-select--disabled-2d4b8ddd","tedi-select--invalid":"tedi-select--invalid-3901c89c","tedi-select--valid":"tedi-select--valid-969c0297","tedi-select__control--focused":"tedi-select__control--focused-0e632efe","tedi-select__arrow":"tedi-select__arrow-94b5ef4a","tedi-select__loading-indicator":"tedi-select__loading-indicator-a35a63ca","tedi-select__dropdown-indicator":"tedi-select__dropdown-indicator-5a948baa","tedi-select__clear-indicator":"tedi-select__clear-indicator-68b60b12","tedi-select__menu-portal":"tedi-select__menu-portal-d5349f37","tedi-select__menu":"tedi-select__menu-bf54b75b","tedi-select__menu-list--grid":"tedi-select__menu-list--grid-393f3232","tedi-select__menu-list":"tedi-select__menu-list-0aa06e24","tedi-select__menu-list-inner":"tedi-select__menu-list-inner-471e5cf8","tedi-select__menu-list-footer":"tedi-select__menu-list-footer-eb1d3bbc","tedi-select__option":"tedi-select__option-6f811381","tedi-select__option--disabled":"tedi-select__option--disabled-d3aff112","tedi-select__option--selected":"tedi-select__option--selected-a93e5fb0","tedi-select__option--focused":"tedi-select__option--focused-1d972ff1","tedi-select__option--control":"tedi-select__option--control-f69f3f48","tedi-select--small":"tedi-select--small-2659608b","tedi-select__multi-value-item":"tedi-select__multi-value-item-b8ec59ae","tedi-select__multi-value--ellipsis":"tedi-select__multi-value--ellipsis-1d821ed7","tedi-select__group":"tedi-select__group-b275e954","tedi-select__group-heading":"tedi-select__group-heading-02b3d9bc","tedi-select__group-heading--selectable":"tedi-select__group-heading--selectable-c84cd617","tedi-select__option--indented":"tedi-select__option--indented-bf4a1661","tedi-select__multi-value-clear":"tedi-select__multi-value-clear-d231f7de","tedi-select--tags-row":"tedi-select--tags-row-c9f33e4b","tedi-select__overflow-tag":"tedi-select__overflow-tag-c0391df2","tedi-select__menu-list--keyboard":"tedi-select__menu-list--keyboard-3d066942","tedi-select__select-all":"tedi-select__select-all-12c3e7f1","tedi-select__group-heading-toggle":"tedi-select__group-heading-toggle-34296a63","tedi-select--tags-stack":"tedi-select--tags-stack-ddb929a9","tedi-select__separator":"tedi-select__separator-b1045f3f","tedi-select--searchable":"tedi-select--searchable-d56eb325"};exports.default=e;
|
|
@@ -20,8 +20,9 @@ const e = {
|
|
|
20
20
|
"tedi-select__menu-list-footer": "tedi-select__menu-list-footer-eb1d3bbc",
|
|
21
21
|
"tedi-select__option": "tedi-select__option-6f811381",
|
|
22
22
|
"tedi-select__option--disabled": "tedi-select__option--disabled-d3aff112",
|
|
23
|
-
"tedi-select__option--focused": "tedi-select__option--focused-1d972ff1",
|
|
24
23
|
"tedi-select__option--selected": "tedi-select__option--selected-a93e5fb0",
|
|
24
|
+
"tedi-select__option--focused": "tedi-select__option--focused-1d972ff1",
|
|
25
|
+
"tedi-select__option--control": "tedi-select__option--control-f69f3f48",
|
|
25
26
|
"tedi-select--small": "tedi-select--small-2659608b",
|
|
26
27
|
"tedi-select__multi-value-item": "tedi-select__multi-value-item-b8ec59ae",
|
|
27
28
|
"tedi-select__multi-value--ellipsis": "tedi-select__multi-value--ellipsis-1d821ed7",
|
|
@@ -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
|
/**
|