@tedi-design-system/react 19.2.0-rc.5 → 19.2.0-rc.7
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/package.json +1 -1
- package/src/tedi/components/content/carousel/components/carousel-indicators/carousel-indicators.cjs.js +1 -1
- package/src/tedi/components/content/carousel/components/carousel-indicators/carousel-indicators.es.js +18 -18
- package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/use-carousel.d.ts +2 -1
- package/src/tedi/components/content/carousel/use-carousel.es.js +177 -163
- package/src/tedi/components/content/label/label.cjs.js +1 -1
- package/src/tedi/components/content/label/label.d.ts +22 -0
- package/src/tedi/components/content/label/label.es.js +30 -28
- package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.es.js +32 -30
- package/src/tedi/components/form/choice-group/choice-group.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/choice-group.es.js +80 -69
- package/src/tedi/components/form/choice-input.types.d.ts +7 -0
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +5 -0
- package/src/tedi/components/form/date-field/date-field.es.js +187 -184
- 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 +5 -0
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +103 -101
- package/src/tedi/components/form/form-label/form-label.cjs.js +1 -1
- package/src/tedi/components/form/form-label/form-label.d.ts +9 -0
- package/src/tedi/components/form/form-label/form-label.es.js +15 -14
- package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +7 -0
- package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +41 -40
- package/src/tedi/components/form/number-field/number-field.cjs.js +1 -1
- package/src/tedi/components/form/number-field/number-field.es.js +54 -43
- package/src/tedi/components/form/radio/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.es.js +30 -28
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.es.js +79 -77
- package/src/tedi/components/form/slider/slider.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.d.ts +7 -0
- package/src/tedi/components/form/slider/slider.es.js +48 -47
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +72 -61
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.d.ts +5 -0
- package/src/tedi/components/form/time-field/time-field.es.js +87 -85
- package/src/tedi/components/form/toggle/toggle.cjs.js +1 -1
- package/src/tedi/components/form/toggle/toggle.d.ts +7 -0
- package/src/tedi/components/form/toggle/toggle.es.js +26 -24
|
@@ -1,230 +1,244 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import
|
|
3
|
-
import { resolveBreakpointValue as
|
|
4
|
-
import { useLabels as
|
|
5
|
-
const
|
|
1
|
+
import { useState as k, useRef as p, useEffect as K, useMemo as b, useCallback as f, useLayoutEffect as Vt } from "react";
|
|
2
|
+
import Wt from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
3
|
+
import { resolveBreakpointValue as ht } from "./carousel-utils.es.js";
|
|
4
|
+
import { useLabels as vt } from "../../../providers/label-provider/use-labels.es.js";
|
|
5
|
+
const Ot = {
|
|
6
6
|
slidesPerView: { xs: 1 },
|
|
7
7
|
gap: { xs: 1 },
|
|
8
8
|
fade: !1,
|
|
9
9
|
transitionMs: 400,
|
|
10
10
|
loop: !0,
|
|
11
11
|
centered: !1
|
|
12
|
-
},
|
|
13
|
-
|
|
12
|
+
}, zt = 0.3, $t = 1e-6, v = (T, x) => (T % x + x) % x, rt = (T, x) => T.reduce(
|
|
13
|
+
(D, d, U) => Math.abs(d - x) < Math.abs(T[D] - x) ? U : D,
|
|
14
|
+
0
|
|
15
|
+
), Ut = (T) => {
|
|
16
|
+
const { getLabel: x } = vt(), D = Wt(), [d, U] = k(Ot), [n, pt] = k(0), [m, R] = k(0), [w, nt] = k(0), [st, C] = k(!1), [N, Mt] = k(0), [ot, gt] = k(16), [xt, wt] = k(""), O = p(null), ct = p(null), at = p([]), F = p(!1), X = p(!1), Y = p(!1), j = p(0), z = p(0), it = p(0), q = p(0), J = p(0), $ = p(), V = p(0), ut = p(!0), h = p(m), lt = p(w);
|
|
14
17
|
K(() => {
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
|
|
18
|
-
}, [
|
|
19
|
-
const
|
|
20
|
-
() =>
|
|
21
|
-
[
|
|
22
|
-
),
|
|
23
|
-
|
|
18
|
+
h.current = m;
|
|
19
|
+
}, [m]), K(() => {
|
|
20
|
+
lt.current = w;
|
|
21
|
+
}, [w]);
|
|
22
|
+
const u = b(
|
|
23
|
+
() => ht(d.slidesPerView, D),
|
|
24
|
+
[d.slidesPerView, D]
|
|
25
|
+
), A = b(() => ht(d.gap, D), [d.gap, D]), y = b(() => A * ot, [A, ot]), e = d.loop, a = b(() => {
|
|
26
|
+
const t = Math.max(0, n - u), r = Math.round(t);
|
|
27
|
+
return Math.abs(t - r) < $t ? r : t;
|
|
28
|
+
}, [n, u]), l = b(() => {
|
|
29
|
+
if (!n) return [];
|
|
30
|
+
if (e) return Array.from({ length: n }, (s, o) => o);
|
|
31
|
+
const t = Math.floor(a), r = Array.from({ length: t + 1 }, (s, o) => o);
|
|
32
|
+
return a > t && r.push(a), r;
|
|
33
|
+
}, [n, e, a]), E = f(
|
|
34
|
+
(t) => e ? t : Math.min(Math.max(t, 0), a),
|
|
24
35
|
[e, a]
|
|
25
|
-
),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!n) return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
), g = e ? n : 0, It = b(() => l.length ? e ? v(Math.floor(m), n) : rt(l, m) : 0, [l, m, n, e]), B = e ? m - w + g : Math.ceil(m), Rt = n > 0 && (e || m > 0), St = n > 0 && (e || m < a);
|
|
37
|
+
Vt(() => {
|
|
38
|
+
e || (clearTimeout($.current), V.current = 0, h.current = E(h.current), R((t) => E(t)));
|
|
39
|
+
}, [e, a, E]);
|
|
40
|
+
const bt = b(() => {
|
|
41
|
+
if (!n) return [];
|
|
42
|
+
if (!e) return Array.from({ length: n }, (s, o) => o);
|
|
43
|
+
const t = 2 * g + Math.ceil(u), r = w - g;
|
|
44
|
+
return Array.from({ length: t }, (s, o) => v(r + o, n));
|
|
45
|
+
}, [n, g, u, w, e]), Tt = b(
|
|
46
|
+
() => `0 0 calc((100% - ${(u - 1) * A}rem) / ${u})`,
|
|
47
|
+
[u, A]
|
|
48
|
+
), Ct = b(() => {
|
|
49
|
+
if (!N)
|
|
50
|
+
return { gap: `${A}rem`, transform: "translate3d(0,0,0)", transition: "none" };
|
|
51
|
+
const t = y * (u - 1), r = (N - t) / u, s = e ? m - w + g : m, o = d.centered ? (N - r) / 2 : 0, i = -s * (r + y) + o;
|
|
40
52
|
return {
|
|
41
|
-
gap: `${
|
|
53
|
+
gap: `${A}rem`,
|
|
42
54
|
transform: `translate3d(${i}px, 0, 0)`,
|
|
43
|
-
transition:
|
|
55
|
+
transition: st ? `transform ${d.transitionMs}ms ease` : "none"
|
|
44
56
|
};
|
|
45
57
|
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]),
|
|
58
|
+
N,
|
|
59
|
+
A,
|
|
60
|
+
y,
|
|
61
|
+
u,
|
|
62
|
+
m,
|
|
63
|
+
w,
|
|
64
|
+
g,
|
|
65
|
+
st,
|
|
66
|
+
d.transitionMs,
|
|
67
|
+
d.centered,
|
|
68
|
+
e
|
|
69
|
+
]), Pt = f(
|
|
58
70
|
(t) => {
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
if (!e) return t + 1 > m && t < m + u;
|
|
72
|
+
const r = Math.ceil(u);
|
|
73
|
+
return t >= B && t < B + r;
|
|
61
74
|
},
|
|
62
|
-
[
|
|
63
|
-
),
|
|
64
|
-
(t, r,
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
const i =
|
|
68
|
-
|
|
75
|
+
[u, B, e, m]
|
|
76
|
+
), kt = f(
|
|
77
|
+
(t, r, s) => {
|
|
78
|
+
const o = [t];
|
|
79
|
+
if (d.fade) {
|
|
80
|
+
const i = d.fade === "both" || d.fade !== "right" && u <= 1;
|
|
81
|
+
o.push(i ? s : r);
|
|
69
82
|
}
|
|
70
|
-
return
|
|
83
|
+
return o.join(" ");
|
|
71
84
|
},
|
|
72
|
-
[
|
|
73
|
-
),
|
|
74
|
-
|
|
75
|
-
}, []),
|
|
85
|
+
[d.fade, u]
|
|
86
|
+
), Dt = f((t, r) => {
|
|
87
|
+
at.current[t] = r;
|
|
88
|
+
}, []), L = f(() => {
|
|
76
89
|
setTimeout(() => {
|
|
77
|
-
if (!
|
|
78
|
-
const t =
|
|
79
|
-
|
|
90
|
+
if (!ut.current || !n) return;
|
|
91
|
+
const t = e ? v(Math.floor(h.current), n) : Math.min(Math.max(Math.ceil(h.current), 0), n - 1);
|
|
92
|
+
wt(x("carousel.slide", t + 1, n));
|
|
80
93
|
}, 100);
|
|
81
|
-
}, [x,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
}, [
|
|
94
|
+
}, [x, n, e]), G = f(() => {
|
|
95
|
+
F.current = !0, setTimeout(() => {
|
|
96
|
+
F.current = !1;
|
|
97
|
+
}, d.transitionMs);
|
|
98
|
+
}, [d.transitionMs]), ft = f(() => {
|
|
86
99
|
setTimeout(() => {
|
|
87
100
|
var r;
|
|
88
|
-
const t =
|
|
89
|
-
(r =
|
|
101
|
+
const t = e ? h.current - lt.current + g : Math.ceil(h.current);
|
|
102
|
+
(r = at.current[t]) == null || r.focus({ preventScroll: !0 });
|
|
90
103
|
});
|
|
91
|
-
}, [
|
|
92
|
-
!
|
|
93
|
-
}, [e,
|
|
94
|
-
!
|
|
95
|
-
}, [e,
|
|
104
|
+
}, [g, e]), Q = f(() => {
|
|
105
|
+
!n || F.current || !e && h.current >= a || (C(!0), R((t) => e ? t + 1 : l.find((r) => r > t) ?? a), G(), L());
|
|
106
|
+
}, [n, e, a, l, G, L]), Z = f(() => {
|
|
107
|
+
!n || F.current || !e && h.current <= 0 || (C(!0), R((t) => e ? t - 1 : [...l].reverse().find((r) => r < t) ?? 0), G(), L());
|
|
108
|
+
}, [n, e, l, G, L]), H = f(
|
|
96
109
|
(t, r) => {
|
|
97
|
-
if (!(!
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
|
|
110
|
+
if (!(!n || F.current)) {
|
|
111
|
+
if (C(!0), e) {
|
|
112
|
+
const s = v(Math.floor(h.current), n), i = v(t, n) - s;
|
|
113
|
+
R((c) => c + i);
|
|
101
114
|
} else
|
|
102
|
-
|
|
103
|
-
r != null && r.focusSlide ?
|
|
115
|
+
R(E(t));
|
|
116
|
+
r != null && r.focusSlide ? Y.current = !0 : L();
|
|
104
117
|
}
|
|
105
118
|
},
|
|
106
|
-
[
|
|
107
|
-
),
|
|
119
|
+
[n, e, E, L]
|
|
120
|
+
), At = f(
|
|
108
121
|
(t) => {
|
|
109
|
-
t.target !==
|
|
122
|
+
t.target !== ct.current || t.propertyName !== "transform" || X.current || (C(!1), nt(Math.floor(h.current)), Y.current && (Y.current = !1, ft()));
|
|
110
123
|
},
|
|
111
|
-
[
|
|
112
|
-
),
|
|
113
|
-
const t =
|
|
124
|
+
[ft]
|
|
125
|
+
), Et = f(() => {
|
|
126
|
+
const t = O.current;
|
|
114
127
|
t && (t.scrollLeft = 0, t.scrollTop = 0);
|
|
115
|
-
}, []),
|
|
128
|
+
}, []), _ = f(() => (N - y * (u - 1)) / u + y, [N, y, u]), Nt = f(
|
|
116
129
|
(t) => {
|
|
117
|
-
if (!
|
|
130
|
+
if (!n) return;
|
|
118
131
|
const r = Math.abs(t.deltaX) > Math.abs(t.deltaY) ? t.deltaX : t.shiftKey ? t.deltaY : 0;
|
|
119
132
|
if (!r) return;
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const i =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
let
|
|
129
|
-
Math.
|
|
130
|
-
const
|
|
131
|
-
|
|
133
|
+
const s = _();
|
|
134
|
+
if (!s) return;
|
|
135
|
+
const o = r / s;
|
|
136
|
+
V.current += o;
|
|
137
|
+
const i = g * 0.9, c = e ? w - i : 0, M = e ? w + i : a, W = h.current + o, P = Math.min(Math.max(W, c), M), tt = P !== W;
|
|
138
|
+
C(!1), R(P), clearTimeout($.current), $.current = setTimeout(() => {
|
|
139
|
+
C(!0);
|
|
140
|
+
const dt = Math.sign(V.current), mt = Math.abs(V.current) > zt, I = h.current;
|
|
141
|
+
let S;
|
|
142
|
+
e ? (S = Math.round(I), mt && (S = dt > 0 ? Math.ceil(I) : Math.floor(I)), tt && (I <= c && (S = Math.ceil(c)), I >= M && (S = Math.floor(M)))) : tt && I >= M ? S = M : tt && I <= c ? S = c : mt ? S = dt > 0 ? l.find((et) => et >= I) ?? M : [...l].reverse().find((et) => et <= I) ?? c : S = l[rt(l, I)];
|
|
143
|
+
const Xt = Math.min(Math.max(S, c), M);
|
|
144
|
+
R(Xt), V.current = 0;
|
|
132
145
|
}, 120);
|
|
133
146
|
},
|
|
134
|
-
[
|
|
135
|
-
),
|
|
147
|
+
[n, _, g, w, e, a, l]
|
|
148
|
+
), yt = f(
|
|
136
149
|
(t) => {
|
|
137
150
|
switch (t.key) {
|
|
138
151
|
case "ArrowRight":
|
|
139
152
|
case "PageDown":
|
|
140
|
-
t.preventDefault(),
|
|
153
|
+
t.preventDefault(), Q();
|
|
141
154
|
break;
|
|
142
155
|
case "ArrowLeft":
|
|
143
156
|
case "PageUp":
|
|
144
|
-
t.preventDefault(),
|
|
157
|
+
t.preventDefault(), Z();
|
|
145
158
|
break;
|
|
146
159
|
case "Home":
|
|
147
|
-
t.preventDefault(),
|
|
160
|
+
t.preventDefault(), H(0);
|
|
148
161
|
break;
|
|
149
162
|
case "End":
|
|
150
|
-
t.preventDefault(),
|
|
163
|
+
t.preventDefault(), H(e ? n - 1 : a);
|
|
151
164
|
break;
|
|
152
165
|
}
|
|
153
166
|
},
|
|
154
|
-
[
|
|
155
|
-
),
|
|
167
|
+
[Q, Z, H, n, e, a]
|
|
168
|
+
), Lt = f(
|
|
156
169
|
(t) => {
|
|
157
170
|
var r;
|
|
158
|
-
|
|
171
|
+
n && ((r = O.current) == null || r.setPointerCapture(t.pointerId), X.current = !0, C(!1), j.current = t.clientX, z.current = h.current, it.current = t.timeStamp, q.current = t.clientX, J.current = t.timeStamp, e && nt(Math.floor(h.current)));
|
|
159
172
|
},
|
|
160
|
-
[
|
|
161
|
-
),
|
|
173
|
+
[n, e]
|
|
174
|
+
), _t = f(
|
|
162
175
|
(t) => {
|
|
163
|
-
if (!
|
|
164
|
-
const r =
|
|
176
|
+
if (!X.current) return;
|
|
177
|
+
const r = _();
|
|
165
178
|
if (!r) return;
|
|
166
|
-
const
|
|
167
|
-
if (Number.isNaN(
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
179
|
+
const s = t.clientX - j.current;
|
|
180
|
+
if (Number.isNaN(s)) return;
|
|
181
|
+
q.current = t.clientX, J.current = t.timeStamp;
|
|
182
|
+
const o = s / r, i = z.current - o, c = g * 0.9, M = Math.floor(z.current), W = e ? M - c : 0, P = e ? M + c : a;
|
|
183
|
+
R(Math.min(Math.max(i, W), P));
|
|
171
184
|
},
|
|
172
|
-
[
|
|
173
|
-
), Ft =
|
|
174
|
-
if (!
|
|
175
|
-
|
|
176
|
-
const t =
|
|
177
|
-
let
|
|
178
|
-
const
|
|
179
|
-
Math.abs(
|
|
180
|
-
}, [
|
|
185
|
+
[_, g, e, a]
|
|
186
|
+
), Ft = f(() => {
|
|
187
|
+
if (!X.current) return;
|
|
188
|
+
X.current = !1, C(!0);
|
|
189
|
+
const t = _(), r = h.current, s = z.current, o = e ? Math.round(s) : s;
|
|
190
|
+
let i = e ? Math.round(r) : l[rt(l, r)];
|
|
191
|
+
const c = J.current - it.current, M = c > 0 && t ? -(q.current - j.current) / t / c : 0;
|
|
192
|
+
Math.abs(M) > 15e-4 && i === o && (e ? i = o + Math.sign(M) : M > 0 ? i = l.find((P) => P > s) ?? a : i = [...l].reverse().find((P) => P < s) ?? 0), R(E(i));
|
|
193
|
+
}, [_, E, e, l, a]);
|
|
181
194
|
return K(() => {
|
|
182
|
-
const t =
|
|
195
|
+
const t = O.current;
|
|
183
196
|
if (!t) return;
|
|
184
|
-
const r = (
|
|
185
|
-
|
|
186
|
-
},
|
|
187
|
-
r(t.clientWidth -
|
|
188
|
-
const i = new ResizeObserver(([
|
|
189
|
-
|
|
197
|
+
const r = (c) => {
|
|
198
|
+
Mt(c), gt(parseFloat(getComputedStyle(document.documentElement).fontSize) || 16);
|
|
199
|
+
}, s = getComputedStyle(t), o = (parseFloat(s.paddingLeft) || 0) + (parseFloat(s.paddingRight) || 0);
|
|
200
|
+
r(t.clientWidth - o);
|
|
201
|
+
const i = new ResizeObserver(([c]) => {
|
|
202
|
+
c && r(c.contentRect.width);
|
|
190
203
|
});
|
|
191
204
|
return i.observe(t), () => i.disconnect();
|
|
192
205
|
}, []), K(
|
|
193
206
|
() => () => {
|
|
194
|
-
|
|
207
|
+
ut.current = !1, clearTimeout($.current);
|
|
195
208
|
},
|
|
196
209
|
[]
|
|
197
210
|
), {
|
|
198
|
-
viewportRef:
|
|
199
|
-
trackRef:
|
|
200
|
-
setSlideRef:
|
|
201
|
-
setConfig:
|
|
202
|
-
setSlidesCount:
|
|
203
|
-
slidesCount:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
211
|
+
viewportRef: O,
|
|
212
|
+
trackRef: ct,
|
|
213
|
+
setSlideRef: Dt,
|
|
214
|
+
setConfig: U,
|
|
215
|
+
setSlidesCount: pt,
|
|
216
|
+
slidesCount: n,
|
|
217
|
+
positions: l,
|
|
218
|
+
activePositionIndex: It,
|
|
219
|
+
canPrev: Rt,
|
|
220
|
+
canNext: St,
|
|
221
|
+
renderedIndices: bt,
|
|
222
|
+
renderedActiveIndex: B,
|
|
223
|
+
slideFlex: Tt,
|
|
224
|
+
trackStyle: Ct,
|
|
225
|
+
contentClassName: kt,
|
|
226
|
+
isSlideVisible: Pt,
|
|
227
|
+
announcement: xt,
|
|
228
|
+
regionLabel: (T == null ? void 0 : T.trim()) || x("carousel"),
|
|
229
|
+
slideLabel: (t) => x("carousel.slide", t, n),
|
|
230
|
+
next: Q,
|
|
231
|
+
prev: Z,
|
|
232
|
+
goToIndex: H,
|
|
233
|
+
onTransitionEnd: At,
|
|
234
|
+
onScroll: Et,
|
|
235
|
+
onWheel: Nt,
|
|
236
|
+
onKeyDown: yt,
|
|
237
|
+
onPointerDown: Lt,
|
|
238
|
+
onPointerMove: _t,
|
|
225
239
|
onPointerUp: Ft
|
|
226
240
|
};
|
|
227
241
|
};
|
|
228
242
|
export {
|
|
229
|
-
|
|
243
|
+
Ut as useCarousel
|
|
230
244
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),j=require("../../../../../external/classnames/index.cjs.js"),_=require("react"),B=require("../../overlays/tooltip/info-tooltip.cjs.js"),e=require("./label.module.scss.cjs.js"),N=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),o=_.forwardRef((r,d)=>{const{getCurrentBreakpointProps:u}=N.useBreakpointProps(r.defaultServerBreakpoint),{as:c="label",children:p,className:b,isBold:f,isSmall:s,modifiers:t,required:m,tooltip:i,...q}=u(r),a=typeof t=="string"?[t]:t,x=j.default(e.default["tedi-label"],f&&e.default["tedi-label--bold"],s&&e.default["tedi-label--small"],a==null?void 0:a.map(h=>`text-${h}`),b),n=l.jsxs(c,{ref:d,className:x,...q,children:[p,m&&l.jsx("span",{className:e.default["tedi-label__required"],"aria-hidden":"true",children:"*"})]});return i?l.jsxs("span",{className:e.default["tedi-label__wrapper"],children:[n,l.jsx("span",{className:e.default["tedi-label__info"],children:l.jsx(B.InfoTooltip,{isSmall:s,children:i})})]}):n});o.displayName="Label";exports.Label=o;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { ElementType, LabelHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { BreakpointSupport } from '../../../helpers';
|
|
3
|
+
import { TextModifiers } from '../../base/typography/text/text';
|
|
4
|
+
/**
|
|
5
|
+
* Subset of {@link TextModifiers} that is meaningful for a label. `.tedi-label` is
|
|
6
|
+
* `display: inline`, so text-alignment (`center`/`left`/`right`) and `::first-letter`
|
|
7
|
+
* (`capitalize-first`) have no effect and are intentionally excluded — only wrapping,
|
|
8
|
+
* text-transform and italic controls that actually apply to inline text remain.
|
|
9
|
+
*/
|
|
10
|
+
export type LabelModifiers = Extract<TextModifiers, 'nowrap' | 'break-all' | 'break-word' | 'break-spaces' | 'italic' | 'uppercase' | 'lowercase' | 'capitalize'>;
|
|
11
|
+
/**
|
|
12
|
+
* Breakpoint-aware `modifiers` for a label, so consumers can vary wrapping responsively
|
|
13
|
+
* (e.g. `{ modifiers: 'nowrap', sm: { modifiers: 'break-word' } }`).
|
|
14
|
+
*/
|
|
15
|
+
export type LabelModifierProps = BreakpointSupport<{
|
|
16
|
+
modifiers?: LabelModifiers[] | LabelModifiers;
|
|
17
|
+
}>;
|
|
3
18
|
type LabelBreakpointProps = {
|
|
4
19
|
/**
|
|
5
20
|
* If true, applies a bold font weight to the label text.
|
|
@@ -11,6 +26,13 @@ type LabelBreakpointProps = {
|
|
|
11
26
|
* @default false
|
|
12
27
|
*/
|
|
13
28
|
isSmall?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Text modifiers that control how the label text is rendered, e.g. wrapping and
|
|
31
|
+
* line-breaking behavior (`'nowrap'`, `'break-word'`, `'break-all'`, `'break-spaces'`).
|
|
32
|
+
* Reuses the same modifiers as the `Text` component. Useful to prevent long labels
|
|
33
|
+
* from breaking across multiple lines and distorting form layouts.
|
|
34
|
+
*/
|
|
35
|
+
modifiers?: LabelModifiers[] | LabelModifiers;
|
|
14
36
|
};
|
|
15
37
|
export interface LabelProps extends BreakpointSupport<LabelBreakpointProps>, LabelHTMLAttributes<HTMLLabelElement | HTMLSpanElement> {
|
|
16
38
|
/**
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { InfoTooltip as
|
|
1
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import B from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { forwardRef as x } from "react";
|
|
4
|
+
import { InfoTooltip as k } from "../../overlays/tooltip/info-tooltip.es.js";
|
|
5
5
|
import e from "./label.module.scss.es.js";
|
|
6
|
-
import { useBreakpointProps as
|
|
7
|
-
const
|
|
8
|
-
const { getCurrentBreakpointProps:
|
|
9
|
-
as:
|
|
10
|
-
children:
|
|
11
|
-
className:
|
|
12
|
-
isBold:
|
|
13
|
-
isSmall:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
import { useBreakpointProps as E } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
7
|
+
const g = x((t, m) => {
|
|
8
|
+
const { getCurrentBreakpointProps: d } = E(t.defaultServerBreakpoint), {
|
|
9
|
+
as: p = "label",
|
|
10
|
+
children: c,
|
|
11
|
+
className: f,
|
|
12
|
+
isBold: b,
|
|
13
|
+
isSmall: s,
|
|
14
|
+
modifiers: l,
|
|
15
|
+
required: u,
|
|
16
|
+
tooltip: i,
|
|
17
|
+
...h
|
|
18
|
+
} = d(t), r = typeof l == "string" ? [l] : l, N = B(
|
|
18
19
|
e["tedi-label"],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
b && e["tedi-label--bold"],
|
|
21
|
+
s && e["tedi-label--small"],
|
|
22
|
+
r == null ? void 0 : r.map((_) => `text-${_}`),
|
|
23
|
+
f
|
|
24
|
+
), o = /* @__PURE__ */ n(p, { ref: m, className: N, ...h, children: [
|
|
25
|
+
c,
|
|
26
|
+
u && /* @__PURE__ */ a("span", { className: e["tedi-label__required"], "aria-hidden": "true", children: "*" })
|
|
25
27
|
] });
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
] }) :
|
|
28
|
+
return i ? /* @__PURE__ */ n("span", { className: e["tedi-label__wrapper"], children: [
|
|
29
|
+
o,
|
|
30
|
+
/* @__PURE__ */ a("span", { className: e["tedi-label__info"], children: /* @__PURE__ */ a(k, { isSmall: s, children: i }) })
|
|
31
|
+
] }) : o;
|
|
30
32
|
});
|
|
31
|
-
|
|
33
|
+
g.displayName = "Label";
|
|
32
34
|
export {
|
|
33
|
-
|
|
35
|
+
g as Label
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),j=require("../../base/icon/icon.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),d=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),j=require("../../base/icon/icon.cjs.js"),E=require("../feedback-text/feedback-text.cjs.js"),F=require("../form-label/form-label.cjs.js"),e=require("./checkbox.module.scss.cjs.js"),P=require("../../layout/grid/row.cjs.js"),q=require("../../layout/grid/col.cjs.js"),C=N=>{const{id:a,label:h,value:b,className:R,disabled:n=!1,onChange:l,hideLabel:g=!1,helper:i,checked:u,defaultChecked:v,indeterminate:o,hover:y,name:I,tooltip:k,labelProps:w,invalid:x,size:s="default",required:_,...z}=N,[L,M]=r.useState(v||!1),m=r.useRef(null),f=r.useRef(null),S=l&&typeof u<"u"?u:L;r.useEffect(()=>{f.current&&(f.current.indeterminate=!!o)},[o]);const T=t=>{typeof u>"u"&&M(t==null?void 0:t.target.checked),l==null||l(b,t==null?void 0:t.target.checked)},p=i?i.id??`${a}-helper`:void 0,$=k?`${a}-tooltip`:void 0,B=d.default(e.default["tedi-checkbox__label"],{[e.default["tedi-checkbox--disabled"]]:n});return c.jsxs("div",{className:d.default(e.default["tedi-checkbox"],{[e.default["tedi-checkbox--disabled"]]:n}),"data-name":"check",...z,children:[c.jsxs(P.Row,{gutter:0,children:[c.jsx(q.Col,{width:"auto",children:c.jsxs("div",{className:e.default["tedi-checkbox__outer-indicator-wrapper"],children:[c.jsx("input",{ref:f,id:a,value:b,name:I,type:"checkbox",disabled:n,checked:o?!1:S,onChange:T,className:e.default["tedi-checkbox__input"],"aria-describedby":[p,$].filter(Boolean).join(" "),required:_,"aria-invalid":x||void 0}),c.jsxs("div",{"aria-hidden":"true",onClick:()=>{var t;return(t=m.current)==null?void 0:t.click()},className:d.default(e.default["tedi-checkbox__indicator"],{[e.default["tedi-checkbox__indicator--hover"]]:y,[e.default["tedi-checkbox__indicator--indeterminate"]]:o,[e.default[`tedi-checkbox__indicator--size-${s}`]]:s,[e.default["tedi-checkbox__indicator--invalid"]]:x},R),"data-testid":"checkbox-indicator",children:[c.jsx(j.Icon,{size:s==="default"?16:18,name:"remove",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--indeterminate"])}),c.jsx(j.Icon,{size:s==="default"?16:18,name:"check",className:d.default(e.default["tedi-checkbox__icon"],e.default["tedi-checkbox__icon--check"])})]})]})}),h&&c.jsx(q.Col,{children:c.jsx(F.FormLabel,{ref:m,className:B,id:a,"data-testid":"checkbox-label",hideLabel:g,label:h,tooltip:k,required:_,labelProps:w})})]}),i&&c.jsx(E.FeedbackText,{id:p,...i,className:d.default(e.default["tedi-checkbox__helper"],i.className)})]})};exports.Checkbox=C;exports.default=C;
|