@tedi-design-system/react 19.1.0-rc.9 → 19.1.1
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/community.cjs.js +1 -1
- package/community.es.js +215 -223
- package/component.manifest.json +63 -20
- package/external/@floating-ui/core/dist/floating-ui.core.es.js +1 -1
- package/external/@floating-ui/dom/dist/floating-ui.dom.es.js +2 -2
- package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js +5 -5
- package/external/@mui/x-date-pickers/DatePicker/shared.es.js +1 -1
- package/external/@mui/x-date-pickers/DateTimePicker/shared.es.js +1 -1
- package/index.css +1 -1
- package/package.json +2 -2
- package/src/community/components/accordion/accordion.cjs.js +1 -1
- package/src/community/components/accordion/accordion.es.js +14 -9
- package/src/community/components/card/card-notification/card-notification.cjs.js +1 -1
- package/src/community/components/card/card-notification/card-notification.es.js +10 -8
- package/src/community/components/dock-panel/dock-panel.cjs.js +2 -0
- package/src/community/components/dock-panel/dock-panel.d.ts +110 -0
- package/src/community/components/dock-panel/dock-panel.es.js +138 -0
- package/src/community/components/dock-panel/dock-panel.module.scss.cjs.js +1 -0
- package/src/community/components/dock-panel/dock-panel.module.scss.es.js +18 -0
- package/src/community/components/dropdown/dropdown.cjs.js +1 -1
- package/src/community/components/dropdown/dropdown.es.js +34 -32
- package/src/community/components/form/category-search/category-search.cjs.js +1 -0
- package/src/community/components/form/category-search/category-search.d.ts +9 -0
- package/src/community/components/form/category-search/category-search.es.js +297 -0
- package/src/community/components/form/category-search/category-search.module.scss.cjs.js +1 -0
- package/src/community/components/form/category-search/category-search.module.scss.es.js +21 -0
- package/src/community/components/form/category-search/category-search.types.d.ts +162 -0
- package/src/community/components/form/category-search/define-category-search-category.cjs.js +1 -0
- package/src/community/components/form/category-search/define-category-search-category.d.ts +7 -0
- package/src/community/components/form/category-search/define-category-search-category.es.js +25 -0
- package/src/community/components/form/category-search/index.d.ts +3 -0
- package/src/community/components/form/category-search/use-category-search.cjs.js +1 -0
- package/src/community/components/form/category-search/use-category-search.d.ts +17 -0
- package/src/community/components/form/category-search/use-category-search.es.js +64 -0
- package/src/community/components/form/file-upload/file-upload.cjs.js +1 -1
- package/src/community/components/form/file-upload/file-upload.es.js +43 -41
- package/src/community/components/form/pickers/calendar/calendar.cjs.js +1 -1
- package/src/community/components/form/pickers/calendar/calendar.es.js +41 -39
- package/src/community/components/form/pickers/timepicker/timepicker.cjs.js +1 -1
- package/src/community/components/form/pickers/timepicker/timepicker.es.js +33 -31
- package/src/community/components/form/toggle/toggle.cjs.js +1 -1
- package/src/community/components/form/toggle/toggle.es.js +30 -28
- package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js +1 -1
- package/src/community/components/map-components/base-map-selection/base-map-selection.es.js +19 -19
- package/src/community/components/map-components/carousel/carousel.cjs.js +1 -1
- package/src/community/components/map-components/carousel/carousel.es.js +19 -17
- package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
- package/src/community/components/map-components/map-button/map-button.d.ts +10 -1
- package/src/community/components/map-components/map-button/map-button.es.js +31 -29
- package/src/community/components/status/status.cjs.js +1 -1
- package/src/community/components/status/status.es.js +14 -12
- package/src/community/components/stepper/stepper.cjs.js +1 -1
- package/src/community/components/stepper/stepper.es.js +33 -31
- package/src/community/components/table/table.cjs.js +1 -1
- package/src/community/components/table/table.es.js +9 -9
- package/src/community/components/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/community/components/table-of-contents/table-of-contents.es.js +21 -19
- package/src/community/components/tabs/tabs/tabs.cjs.js +1 -1
- package/src/community/components/tabs/tabs/tabs.es.js +29 -27
- package/src/community/components/vertical-stepper/vertical-stepper.cjs.js +1 -1
- package/src/community/components/vertical-stepper/vertical-stepper.es.js +8 -6
- package/src/community/deprecated-exports.cjs.js +1 -0
- package/src/community/deprecated-exports.d.ts +19 -0
- package/src/community/deprecated-exports.es.js +112 -0
- package/src/community/index.d.ts +3 -0
- package/src/tedi/components/content/card/card.d.ts +4 -0
- 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/content/table-card/index.d.ts +1 -0
- package/src/tedi/components/content/table-card/table-card.cjs.js +1 -0
- package/src/tedi/components/content/table-card/table-card.d.ts +131 -0
- package/src/tedi/components/content/table-card/table-card.es.js +206 -0
- package/src/tedi/components/content/table-card/table-card.module.scss.cjs.js +1 -0
- package/src/tedi/components/content/table-card/table-card.module.scss.es.js +18 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.d.ts +42 -0
- package/src/tedi/components/content/text-group/text-group-list/text-group-list.es.js +41 -23
- package/src/tedi/components/content/text-group/text-group.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.d.ts +10 -0
- package/src/tedi/components/content/text-group/text-group.es.js +14 -13
- package/src/tedi/components/content/text-group/text-group.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/text-group/text-group.module.scss.es.js +5 -1
- package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field-helpers.d.ts +12 -19
- package/src/tedi/components/form/date-field/date-field-helpers.es.js +27 -21
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +1 -1
- package/src/tedi/components/form/date-field/date-field.es.js +169 -164
- 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/search/index.d.ts +1 -0
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.d.ts +92 -1
- package/src/tedi/components/form/search/search.es.js +265 -69
- package/src/tedi/components/form/search/search.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/search/search.module.scss.es.js +9 -1
- 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
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +21 -21
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.cjs.js +1 -1
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.d.ts +1 -1
- package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.es.js +28 -27
- package/src/tedi/components/layout/mobile-nav/mobile-nav.cjs.js +1 -1
- package/src/tedi/components/layout/mobile-nav/mobile-nav.d.ts +1 -1
- package/src/tedi/components/layout/mobile-nav/mobile-nav.es.js +124 -92
- package/src/tedi/components/layout/sidenav/sidenav.module.scss.cjs.js +1 -1
- package/src/tedi/components/layout/sidenav/sidenav.module.scss.es.js +1 -0
- package/src/tedi/components/navigation/tabs/tabs-helpers.cjs.js +1 -1
- package/src/tedi/components/navigation/tabs/tabs-helpers.d.ts +5 -0
- package/src/tedi/components/navigation/tabs/tabs-helpers.es.js +7 -4
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.cjs.js +1 -1
- package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.es.js +17 -17
- package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +8 -6
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.cjs.js +1 -0
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.d.ts +12 -0
- package/src/tedi/helpers/warn-deprecated/warn-deprecated.es.js +11 -0
- package/src/tedi/index.d.ts +2 -1
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +30 -2
- package/src/tedi/providers/label-provider/labels-map.es.js +29 -1
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +326 -324
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import
|
|
3
|
-
import { resolveBreakpointValue as
|
|
4
|
-
import { useLabels as
|
|
5
|
-
const
|
|
1
|
+
import { useState as S, useRef as i, useEffect as K, useMemo as I, useCallback as s } from "react";
|
|
2
|
+
import Xt from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
3
|
+
import { resolveBreakpointValue as at } from "./carousel-utils.es.js";
|
|
4
|
+
import { useLabels as Nt } from "../../../providers/label-provider/use-labels.es.js";
|
|
5
|
+
const Wt = {
|
|
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
|
-
const { getLabel:
|
|
14
|
-
|
|
12
|
+
}, N = (V, x) => (V % x + x) % x, vt = (V) => {
|
|
13
|
+
const { getLabel: x } = Nt(), W = Xt(), [u, it] = S(Wt), [e, ut] = S(0), [l, w] = S(0), [h, Q] = S(0), [Z, g] = S(!1), [T, lt] = S(0), [tt, ft] = S(16), [dt, mt] = S(""), E = i(null), et = i(null), rt = i([]), y = i(!1), A = i(!1), O = i(!1), Y = i(0), F = i(0), nt = i(0), U = i(0), j = i(0), H = i(), L = i(0), ot = i(!0), f = i(l), st = i(h);
|
|
14
|
+
K(() => {
|
|
15
15
|
f.current = l;
|
|
16
|
-
}, [l]),
|
|
17
|
-
|
|
16
|
+
}, [l]), K(() => {
|
|
17
|
+
st.current = h;
|
|
18
18
|
}, [h]);
|
|
19
|
-
const c =
|
|
20
|
-
() =>
|
|
21
|
-
[u.slidesPerView,
|
|
22
|
-
),
|
|
19
|
+
const c = I(
|
|
20
|
+
() => at(u.slidesPerView, W),
|
|
21
|
+
[u.slidesPerView, W]
|
|
22
|
+
), b = I(() => at(u.gap, W), [u.gap, W]), C = I(() => b * tt, [b, tt]), n = u.loop, M = I(
|
|
23
23
|
() => Math.max(0, e - Math.ceil(c)),
|
|
24
24
|
[e, c]
|
|
25
|
-
),
|
|
25
|
+
), R = s(
|
|
26
26
|
(t) => n ? t : Math.min(Math.max(t, 0), M),
|
|
27
27
|
[n, M]
|
|
28
|
-
), m = n ? e : 0,
|
|
28
|
+
), m = n ? e : 0, ht = I(() => e === 0 ? 0 : n ? N(Math.floor(l), e) : Math.min(Math.max(Math.round(l), 0), e - 1), [l, e, n]), z = n ? l - h + m : l, pt = n || l > 1e-3, Mt = n || l < M - 1e-3, xt = I(() => {
|
|
29
29
|
if (!e) return [];
|
|
30
30
|
if (!n) return Array.from({ length: e }, (o, a) => a);
|
|
31
31
|
const t = 2 * m + Math.ceil(c), r = h - m;
|
|
32
|
-
return Array.from({ length: t }, (o, a) =>
|
|
33
|
-
}, [e, m, c, h, n]),
|
|
34
|
-
() => `0 0 calc((100% - ${(c - 1) *
|
|
35
|
-
[c,
|
|
36
|
-
),
|
|
37
|
-
if (!
|
|
38
|
-
return { gap: `${
|
|
39
|
-
const t =
|
|
32
|
+
return Array.from({ length: t }, (o, a) => N(r + a, e));
|
|
33
|
+
}, [e, m, c, h, n]), wt = I(
|
|
34
|
+
() => `0 0 calc((100% - ${(c - 1) * b}rem) / ${c})`,
|
|
35
|
+
[c, b]
|
|
36
|
+
), gt = I(() => {
|
|
37
|
+
if (!T)
|
|
38
|
+
return { gap: `${b}rem`, transform: "translate3d(0,0,0)", transition: "none" };
|
|
39
|
+
const t = C * (c - 1), r = (T - t) / c, o = n ? l - h + m : l, a = u.centered ? (T - r) / 2 : 0, d = -o * (r + C) + a;
|
|
40
40
|
return {
|
|
41
|
-
gap: `${
|
|
41
|
+
gap: `${b}rem`,
|
|
42
42
|
transform: `translate3d(${d}px, 0, 0)`,
|
|
43
|
-
transition:
|
|
43
|
+
transition: Z ? `transform ${u.transitionMs}ms ease` : "none"
|
|
44
44
|
};
|
|
45
45
|
}, [
|
|
46
|
+
T,
|
|
47
|
+
b,
|
|
46
48
|
C,
|
|
47
|
-
I,
|
|
48
|
-
P,
|
|
49
49
|
c,
|
|
50
50
|
l,
|
|
51
51
|
h,
|
|
52
52
|
m,
|
|
53
|
-
|
|
53
|
+
Z,
|
|
54
54
|
u.transitionMs,
|
|
55
55
|
u.centered,
|
|
56
56
|
n
|
|
57
|
-
]),
|
|
57
|
+
]), Rt = s(
|
|
58
58
|
(t) => {
|
|
59
59
|
const r = Math.ceil(c);
|
|
60
|
-
return t >=
|
|
60
|
+
return t >= z && t < z + r;
|
|
61
61
|
},
|
|
62
|
-
[c,
|
|
63
|
-
),
|
|
62
|
+
[c, z]
|
|
63
|
+
), St = s(
|
|
64
64
|
(t, r, o) => {
|
|
65
65
|
const a = [t];
|
|
66
66
|
if (u.fade) {
|
|
@@ -70,159 +70,159 @@ const Xt = {
|
|
|
70
70
|
return a.join(" ");
|
|
71
71
|
},
|
|
72
72
|
[u.fade, c]
|
|
73
|
-
),
|
|
74
|
-
|
|
75
|
-
}, []),
|
|
73
|
+
), It = s((t, r) => {
|
|
74
|
+
rt.current[t] = r;
|
|
75
|
+
}, []), P = s(() => {
|
|
76
76
|
setTimeout(() => {
|
|
77
|
-
if (!
|
|
78
|
-
const t = n ?
|
|
79
|
-
|
|
77
|
+
if (!ot.current || !e) return;
|
|
78
|
+
const t = n ? N(Math.floor(f.current), e) : Math.min(Math.max(Math.round(f.current), 0), e - 1);
|
|
79
|
+
mt(x("carousel.slide", t + 1, e));
|
|
80
80
|
}, 100);
|
|
81
|
-
}, [
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
}, [x, e, n]), $ = s(() => {
|
|
82
|
+
y.current = !0, setTimeout(() => {
|
|
83
|
+
y.current = !1;
|
|
84
84
|
}, u.transitionMs);
|
|
85
|
-
}, [u.transitionMs]),
|
|
85
|
+
}, [u.transitionMs]), ct = s(() => {
|
|
86
86
|
setTimeout(() => {
|
|
87
87
|
var r;
|
|
88
|
-
const t = f.current -
|
|
89
|
-
(r =
|
|
88
|
+
const t = f.current - st.current + m;
|
|
89
|
+
(r = rt.current[t]) == null || r.focus({ preventScroll: !0 });
|
|
90
90
|
});
|
|
91
|
-
}, [m]),
|
|
92
|
-
!e ||
|
|
93
|
-
}, [e, n, M,
|
|
94
|
-
!e ||
|
|
95
|
-
}, [e, n,
|
|
91
|
+
}, [m]), q = s(() => {
|
|
92
|
+
!e || y.current || !n && f.current >= M - 1e-3 || (g(!0), w((t) => R(t + 1)), $(), P());
|
|
93
|
+
}, [e, n, M, R, $, P]), J = s(() => {
|
|
94
|
+
!e || y.current || !n && f.current <= 1e-3 || (g(!0), w((t) => R(t - 1)), $(), P());
|
|
95
|
+
}, [e, n, R, $, P]), v = s(
|
|
96
96
|
(t, r) => {
|
|
97
|
-
if (!(!e ||
|
|
97
|
+
if (!(!e || y.current)) {
|
|
98
98
|
if (g(!0), n) {
|
|
99
|
-
const o =
|
|
99
|
+
const o = N(Math.floor(f.current), e), d = N(t, e) - o;
|
|
100
100
|
w((p) => p + d);
|
|
101
101
|
} else
|
|
102
|
-
w(
|
|
103
|
-
r != null && r.focusSlide ?
|
|
102
|
+
w(R(t));
|
|
103
|
+
r != null && r.focusSlide ? O.current = !0 : P();
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
[e, n,
|
|
107
|
-
),
|
|
106
|
+
[e, n, R, P]
|
|
107
|
+
), bt = s(
|
|
108
108
|
(t) => {
|
|
109
|
-
t.target !==
|
|
109
|
+
t.target !== et.current || t.propertyName !== "transform" || A.current || (g(!1), Q(Math.floor(f.current)), O.current && (O.current = !1, ct()));
|
|
110
110
|
},
|
|
111
|
-
[
|
|
112
|
-
),
|
|
113
|
-
const t =
|
|
111
|
+
[ct]
|
|
112
|
+
), kt = s(() => {
|
|
113
|
+
const t = E.current;
|
|
114
114
|
t && (t.scrollLeft = 0, t.scrollTop = 0);
|
|
115
|
-
}, []),
|
|
115
|
+
}, []), D = s(() => (T - C * (c - 1)) / c + C, [T, C, c]), Tt = s(
|
|
116
116
|
(t) => {
|
|
117
117
|
if (!e) return;
|
|
118
118
|
const r = Math.abs(t.deltaX) > Math.abs(t.deltaY) ? t.deltaX : t.shiftKey ? t.deltaY : 0;
|
|
119
119
|
if (!r) return;
|
|
120
|
-
const o =
|
|
120
|
+
const o = D();
|
|
121
121
|
if (!o) return;
|
|
122
122
|
const a = r / o;
|
|
123
|
-
|
|
124
|
-
const d = m * 0.9, p = n ? h - d : 0, k = n ? h + d : M,
|
|
125
|
-
g(!1), w(
|
|
123
|
+
L.current += a;
|
|
124
|
+
const d = m * 0.9, p = n ? h - d : 0, k = n ? h + d : M, B = f.current + a, _ = Math.min(Math.max(B, p), k), yt = _ !== B;
|
|
125
|
+
g(!1), w(_), clearTimeout(H.current), H.current = setTimeout(() => {
|
|
126
126
|
g(!0);
|
|
127
|
-
const
|
|
128
|
-
let
|
|
129
|
-
Math.abs(
|
|
130
|
-
const
|
|
131
|
-
w(
|
|
127
|
+
const At = Math.sign(L.current), X = f.current;
|
|
128
|
+
let G = Math.round(X);
|
|
129
|
+
Math.abs(L.current) > 0.3 && (G = At > 0 ? Math.ceil(X) : Math.floor(X)), yt && (X <= p && (G = Math.ceil(p)), X >= k && (G = Math.floor(k)));
|
|
130
|
+
const Ft = Math.min(Math.max(G, p), k);
|
|
131
|
+
w(Ft), L.current = 0;
|
|
132
132
|
}, 120);
|
|
133
133
|
},
|
|
134
|
-
[e,
|
|
135
|
-
),
|
|
134
|
+
[e, D, m, h, n, M]
|
|
135
|
+
), Ct = s(
|
|
136
136
|
(t) => {
|
|
137
137
|
switch (t.key) {
|
|
138
138
|
case "ArrowRight":
|
|
139
139
|
case "PageDown":
|
|
140
|
-
t.preventDefault(),
|
|
140
|
+
t.preventDefault(), q();
|
|
141
141
|
break;
|
|
142
142
|
case "ArrowLeft":
|
|
143
143
|
case "PageUp":
|
|
144
|
-
t.preventDefault(),
|
|
144
|
+
t.preventDefault(), J();
|
|
145
145
|
break;
|
|
146
146
|
case "Home":
|
|
147
|
-
t.preventDefault(),
|
|
147
|
+
t.preventDefault(), v(0);
|
|
148
148
|
break;
|
|
149
149
|
case "End":
|
|
150
|
-
t.preventDefault(),
|
|
150
|
+
t.preventDefault(), v(e - 1);
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
|
-
[
|
|
155
|
-
),
|
|
154
|
+
[q, J, v, e]
|
|
155
|
+
), Pt = s(
|
|
156
156
|
(t) => {
|
|
157
157
|
var r;
|
|
158
|
-
e && ((r =
|
|
158
|
+
e && ((r = E.current) == null || r.setPointerCapture(t.pointerId), A.current = !0, g(!1), Y.current = t.clientX, F.current = f.current, nt.current = t.timeStamp, U.current = t.clientX, j.current = t.timeStamp, n && Q(Math.floor(f.current)));
|
|
159
159
|
},
|
|
160
160
|
[e, n]
|
|
161
|
-
),
|
|
161
|
+
), Dt = s(
|
|
162
162
|
(t) => {
|
|
163
|
-
if (!
|
|
164
|
-
const r =
|
|
163
|
+
if (!A.current) return;
|
|
164
|
+
const r = D();
|
|
165
165
|
if (!r) return;
|
|
166
|
-
const o = t.clientX -
|
|
166
|
+
const o = t.clientX - Y.current;
|
|
167
167
|
if (Number.isNaN(o)) return;
|
|
168
|
-
|
|
169
|
-
const a = o / r, d =
|
|
170
|
-
w(Math.min(Math.max(d,
|
|
168
|
+
U.current = t.clientX, j.current = t.timeStamp;
|
|
169
|
+
const a = o / r, d = F.current - a, p = m * 0.9, k = Math.floor(F.current), B = n ? k - p : 0, _ = n ? k + p : M;
|
|
170
|
+
w(Math.min(Math.max(d, B), _));
|
|
171
171
|
},
|
|
172
|
-
[
|
|
173
|
-
),
|
|
174
|
-
if (!
|
|
175
|
-
|
|
176
|
-
const t =
|
|
172
|
+
[D, m, n, M]
|
|
173
|
+
), Vt = s(() => {
|
|
174
|
+
if (!A.current) return;
|
|
175
|
+
A.current = !1, g(!0);
|
|
176
|
+
const t = D(), r = Math.round(f.current);
|
|
177
177
|
let o = r;
|
|
178
|
-
const a =
|
|
179
|
-
Math.abs(d) > 15e-4 && r === Math.round(
|
|
180
|
-
}, [
|
|
181
|
-
return
|
|
182
|
-
const t =
|
|
178
|
+
const a = j.current - nt.current, d = a > 0 && t ? -(U.current - Y.current) / t / a : 0;
|
|
179
|
+
Math.abs(d) > 15e-4 && r === Math.round(F.current) && (o = Math.round(F.current) + (d > 0 ? 1 : -1)), w(R(o));
|
|
180
|
+
}, [D, R]);
|
|
181
|
+
return K(() => {
|
|
182
|
+
const t = E.current;
|
|
183
183
|
if (!t) return;
|
|
184
184
|
const r = () => {
|
|
185
|
-
|
|
185
|
+
lt(t.clientWidth), ft(parseFloat(getComputedStyle(document.documentElement).fontSize) || 16);
|
|
186
186
|
};
|
|
187
187
|
r();
|
|
188
188
|
const o = new ResizeObserver(r);
|
|
189
189
|
return o.observe(t), () => o.disconnect();
|
|
190
|
-
}, []),
|
|
190
|
+
}, []), K(
|
|
191
191
|
() => () => {
|
|
192
|
-
|
|
192
|
+
ot.current = !1, clearTimeout(H.current);
|
|
193
193
|
},
|
|
194
194
|
[]
|
|
195
195
|
), {
|
|
196
|
-
viewportRef:
|
|
197
|
-
trackRef:
|
|
198
|
-
setSlideRef:
|
|
199
|
-
setConfig:
|
|
200
|
-
setSlidesCount:
|
|
196
|
+
viewportRef: E,
|
|
197
|
+
trackRef: et,
|
|
198
|
+
setSlideRef: It,
|
|
199
|
+
setConfig: it,
|
|
200
|
+
setSlidesCount: ut,
|
|
201
201
|
slidesCount: e,
|
|
202
|
-
slideIndex:
|
|
203
|
-
canPrev:
|
|
204
|
-
canNext:
|
|
205
|
-
renderedIndices:
|
|
206
|
-
renderedActiveIndex:
|
|
207
|
-
slideFlex:
|
|
208
|
-
trackStyle:
|
|
209
|
-
contentClassName:
|
|
210
|
-
isSlideVisible:
|
|
211
|
-
announcement:
|
|
212
|
-
regionLabel:
|
|
213
|
-
slideLabel: (t) =>
|
|
214
|
-
next:
|
|
215
|
-
prev:
|
|
216
|
-
goToIndex:
|
|
217
|
-
onTransitionEnd:
|
|
218
|
-
onScroll:
|
|
219
|
-
onWheel:
|
|
220
|
-
onKeyDown:
|
|
221
|
-
onPointerDown:
|
|
222
|
-
onPointerMove:
|
|
223
|
-
onPointerUp:
|
|
202
|
+
slideIndex: ht,
|
|
203
|
+
canPrev: pt,
|
|
204
|
+
canNext: Mt,
|
|
205
|
+
renderedIndices: xt,
|
|
206
|
+
renderedActiveIndex: z,
|
|
207
|
+
slideFlex: wt,
|
|
208
|
+
trackStyle: gt,
|
|
209
|
+
contentClassName: St,
|
|
210
|
+
isSlideVisible: Rt,
|
|
211
|
+
announcement: dt,
|
|
212
|
+
regionLabel: (V == null ? void 0 : V.trim()) || x("carousel"),
|
|
213
|
+
slideLabel: (t) => x("carousel.slide", t, e),
|
|
214
|
+
next: q,
|
|
215
|
+
prev: J,
|
|
216
|
+
goToIndex: v,
|
|
217
|
+
onTransitionEnd: bt,
|
|
218
|
+
onScroll: kt,
|
|
219
|
+
onWheel: Tt,
|
|
220
|
+
onKeyDown: Ct,
|
|
221
|
+
onPointerDown: Pt,
|
|
222
|
+
onPointerMove: Dt,
|
|
223
|
+
onPointerUp: Vt
|
|
224
224
|
};
|
|
225
225
|
};
|
|
226
226
|
export {
|
|
227
|
-
|
|
227
|
+
vt as useCarousel
|
|
228
228
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './table-card';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../../../../../external/classnames/index.cjs.js"),C=require("react"),ve=require("../../base/icon/icon.cjs.js"),c=require("../../base/typography/text/text.cjs.js"),je=require("../../form/checkbox/checkbox.cjs.js"),f=require("../card/card.cjs.js"),Se=require("../label/label.cjs.js"),R=require("../text-group/text-group-list/text-group-list.cjs.js"),t=require("./table-card.module.scss.cjs.js"),ye=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Ce=require("../../../providers/label-provider/use-labels.cjs.js"),Ae={horizontal:{labelAlign:"right",valueAlign:"right",labelWidth:"var(--text-group-label-width-sm)",rowGap:"0"},vertical:{labelAlign:"left",valueAlign:"left",labelWidth:"auto",rowGap:"var(--layout-grid-gutters-16)"}},Te=l=>l.bold?e.jsx(c.Text,{element:"span",modifiers:"bold",children:l.value}):l.value,Le=(l,_)=>typeof l=="string"?e.jsx(Se.Label,{isSmall:_,children:l}):l,D=l=>{const{getCurrentBreakpointProps:_}=ye.useBreakpointProps(l.defaultServerBreakpoint),{getLabel:A}=Ce.useLabels(),{rows:E,title:s,subtitle:n,endSlot:b,titleElement:T="h3",titleModifiers:u,collapsible:d=!1,defaultOpen:F=!0,open:L,onOpenChange:v,actions:N,summary:i,selectable:m=!1,selected:q,defaultSelected:M=!1,onSelectedChange:j,labelSize:U="default",selectionLabel:V=A("table-card.select-row"),ariaLabel:S,id:$,children:k,layout:z="horizontal",columns:Y=1,labelWidth:J,labelAlign:K,valueAlign:Q,rowAlign:X="start",padding:Z=1,rowGap:y,className:ee}=_(l),te=z==="horizontal",g=Ae[z],ae=K??g.labelAlign,le=Q??g.valueAlign,B=J??g.labelWidth,se=typeof y=="number"?`${y}rem`:y??g.rowGap,ne=C.useId(),x=$??ne,G=`${x}-body`,[de,ie]=C.useState(F),w=L!==void 0,r=d?w?L:de:!0,re=()=>{const a=!r;w||ie(a),v==null||v(a)},[oe,ce]=C.useState(M),H=q!==void 0,ue=H?q:oe,be=a=>{H||ce(a),j==null||j(a)},W=T;d&&!s&&!S&&console.warn("TableCard: a `collapsible` card needs a `title` or `ariaLabel` so its toggle has an accessible name.");const he=!!(m||s||n||b||d),h=!!N,I=!!i,pe=!!k,O=d?r||h:m,fe=r&&!O,me=I||h||pe,ge=h,p=m&&!d&&!!s&&!n,xe=E.map(a=>({label:Le(a.label,U==="small"),value:Te(a),...a.colSpan?{colSpan:a.colSpan}:{}})),P=m?e.jsx(je.Checkbox,{id:`${x}-select`,name:`${x}-select`,value:"selected",label:p?e.jsx(c.Text,{element:"span",color:"primary",modifiers:u,className:o.default(t.default["tedi-table-card__title"],{[t.default["tedi-table-card__title--body"]]:!u}),children:s}):V,hideLabel:!p,checked:ue,onChange:(a,_e)=>be(_e)}):null;return e.jsxs(f.Card,{padding:0,className:o.default(t.default["tedi-table-card"],ee),"aria-label":S,id:x,children:[he&&e.jsxs(f.Card.Content,{padding:fe?{top:1,right:1,bottom:0,left:1}:1,hasSeparator:O,className:o.default(t.default["tedi-table-card__header"],{[t.default["tedi-table-card__header--select-title"]]:p}),children:[p?e.jsx(W,{className:t.default["tedi-table-card__heading"],children:P}):P,d?e.jsx(W,{className:t.default["tedi-table-card__heading"],children:e.jsxs("button",{type:"button",className:t.default["tedi-table-card__toggle"],"aria-expanded":r,"aria-controls":G,"aria-label":s?void 0:S??A(r?"close":"open"),onClick:re,children:[e.jsxs("span",{className:t.default["tedi-table-card__title-group"],children:[s&&e.jsx(c.Text,{element:"span",modifiers:u,className:o.default(t.default["tedi-table-card__title"],{[t.default["tedi-table-card__title--body"]]:!u}),children:s}),n&&e.jsx(c.Text,{element:"span",color:"secondary",modifiers:"small",children:n})]}),b&&e.jsx("span",{className:t.default["tedi-table-card__end-slot"],children:b}),e.jsx("span",{className:o.default(t.default["tedi-table-card__chevron"],{[t.default["tedi-table-card__chevron--open"]]:r}),children:e.jsx(ve.Icon,{name:"expand_more",size:24,color:"inherit"})})]})}):e.jsxs(e.Fragment,{children:[(s||n)&&!p&&e.jsxs("span",{className:t.default["tedi-table-card__title-group"],children:[s&&e.jsx(c.Text,{element:T,modifiers:u,className:o.default(t.default["tedi-table-card__title"],{[t.default["tedi-table-card__title--body"]]:!u}),children:s}),n&&e.jsx(c.Text,{element:"span",color:"secondary",modifiers:"small",children:n})]}),b&&e.jsx("div",{className:t.default["tedi-table-card__end-slot"],children:b})]})]}),e.jsxs("div",{id:G,hidden:d&&!r,className:o.default({[t.default["tedi-table-card__body--has-footer"]]:h}),children:[e.jsx(f.Card.Content,{padding:Z,hasSeparator:me,children:e.jsx(R.TextGroupList,{columns:Y,items:xe,rowGap:se,...te?{type:"horizontal",labelAlign:ae,valueAlign:le,labelWidth:B,rowAlign:X}:{type:"vertical",labelAlign:"left",labelWidth:B}})}),k,I&&e.jsx(f.Card.Content,{padding:1,background:"tertiary",hasSeparator:ge,children:e.jsx(R.TextGroupList,{type:"horizontal",labelAlign:"left",valueAlign:"right",items:[{label:i==null?void 0:i.label,value:e.jsx(c.Text,{element:"span",modifiers:"bold",children:i==null?void 0:i.value})}]})})]}),h&&e.jsx(f.Card.Content,{padding:{vertical:.5,horizontal:1},className:t.default["tedi-table-card__actions"],children:N})]})};D.displayName="TableCard";exports.TableCard=D;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BreakpointSupport } from '../../../helpers';
|
|
3
|
+
import { TextModifiers } from '../../base/typography/text/text';
|
|
4
|
+
import { CardContentPadding } from '../card/card';
|
|
5
|
+
type TableCardAlign = 'left' | 'right';
|
|
6
|
+
export interface TableCardRow {
|
|
7
|
+
/** Row label (usually the column header). Strings are wrapped in a `<Label>`; nodes render as-is. */
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
/** Row value — text, a `StatusBadge`, a link, etc. */
|
|
10
|
+
value: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Show the value in bold.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
bold?: boolean;
|
|
16
|
+
/** In a multi-column body, span this row across N columns. Ignored when `columns` is 1. */
|
|
17
|
+
colSpan?: number;
|
|
18
|
+
}
|
|
19
|
+
type TableCardBreakpointProps = {
|
|
20
|
+
/**
|
|
21
|
+
* Row layout: `horizontal` (label beside value) or `vertical` (label above value).
|
|
22
|
+
* @default horizontal
|
|
23
|
+
*/
|
|
24
|
+
layout?: 'horizontal' | 'vertical';
|
|
25
|
+
/**
|
|
26
|
+
* Number of equal-width columns. Best with `layout="vertical"`.
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
columns?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Label column width (horizontal layout); a `number` is pixels.
|
|
32
|
+
* @default 8.25rem horizontal, auto vertical
|
|
33
|
+
*/
|
|
34
|
+
labelWidth?: string | number;
|
|
35
|
+
/** Label text alignment. Defaults to `right` in horizontal layout, `left` otherwise. */
|
|
36
|
+
labelAlign?: TableCardAlign;
|
|
37
|
+
/** Value text alignment. Defaults to `right` in horizontal layout, `left` otherwise. */
|
|
38
|
+
valueAlign?: TableCardAlign;
|
|
39
|
+
/**
|
|
40
|
+
* Vertical alignment of each label against its value (horizontal layout only).
|
|
41
|
+
* `'center'` keeps the label centred when a value is taller, e.g. a `StatusBadge`.
|
|
42
|
+
* @default start
|
|
43
|
+
*/
|
|
44
|
+
rowAlign?: 'start' | 'center';
|
|
45
|
+
/**
|
|
46
|
+
* Padding of the card body (the rows section). Accepts the same values as `Card.Content`:
|
|
47
|
+
* a number in rems, `{ vertical, horizontal }`, or `{ top, right, bottom, left }`.
|
|
48
|
+
* @default 1
|
|
49
|
+
*/
|
|
50
|
+
padding?: CardContentPadding;
|
|
51
|
+
/**
|
|
52
|
+
* Vertical gap between rows in the body. A `number` is rems (matching `padding`); pass a
|
|
53
|
+
* string for any other CSS length.
|
|
54
|
+
* Defaults to the layout gutter in `vertical` layout and the list's compact spacing otherwise.
|
|
55
|
+
*/
|
|
56
|
+
rowGap?: string | number;
|
|
57
|
+
/** Class name for the root element. */
|
|
58
|
+
className?: string;
|
|
59
|
+
};
|
|
60
|
+
export interface TableCardProps extends BreakpointSupport<TableCardBreakpointProps> {
|
|
61
|
+
/** Label / value pairs (one per column) rendered as the card body - a single `<dl>`. */
|
|
62
|
+
rows: TableCardRow[];
|
|
63
|
+
/** Header title. Required for `collapsible`. */
|
|
64
|
+
title?: React.ReactNode;
|
|
65
|
+
/** Secondary line under the title. */
|
|
66
|
+
subtitle?: React.ReactNode;
|
|
67
|
+
/** Content rendered at the end of the header — a `StatusBadge`, a link, etc. */
|
|
68
|
+
endSlot?: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* Heading tag for `title` (for the document outline). The title stays body-sized unless
|
|
71
|
+
* `titleModifiers` is set.
|
|
72
|
+
* @default h3
|
|
73
|
+
*/
|
|
74
|
+
titleElement?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
75
|
+
/** Visual size / weight of the title (`Text` modifiers), independent of `titleElement`. */
|
|
76
|
+
titleModifiers?: TextModifiers;
|
|
77
|
+
/**
|
|
78
|
+
* Make the header a toggle that shows / hides the body. Provide a `title` (or, failing that,
|
|
79
|
+
* `ariaLabel`) so the toggle has an accessible name.
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
collapsible?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Initial open state (uncontrolled). Ignored when `open` is set.
|
|
85
|
+
* @default true
|
|
86
|
+
*/
|
|
87
|
+
defaultOpen?: boolean;
|
|
88
|
+
/** Controlled open state. Pair with `onOpenChange`. */
|
|
89
|
+
open?: boolean;
|
|
90
|
+
/** Called with the next open state when the header toggles. */
|
|
91
|
+
onOpenChange?: (open: boolean) => void;
|
|
92
|
+
/** Footer content (e.g. `Button`s), divided from the body. */
|
|
93
|
+
actions?: React.ReactNode;
|
|
94
|
+
/** Emphasised summary / total row after the body, on a muted background. */
|
|
95
|
+
summary?: {
|
|
96
|
+
label: React.ReactNode;
|
|
97
|
+
value: React.ReactNode;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Show a leading checkbox to select the row.
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
selectable?: boolean;
|
|
104
|
+
/** Controlled selected state. Pair with `onSelectedChange`. */
|
|
105
|
+
selected?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Initial selected state in uncontrolled mode. Ignored when `selected` is provided.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
defaultSelected?: boolean;
|
|
111
|
+
/** Called with the next selected state when the checkbox toggles. */
|
|
112
|
+
onSelectedChange?: (selected: boolean) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Label text size — `small` uses the 14px label style, `default` the 16px body style.
|
|
115
|
+
* @default default
|
|
116
|
+
*/
|
|
117
|
+
labelSize?: 'small' | 'default';
|
|
118
|
+
/** Accessible name for the selection checkbox. Defaults to the `table-card.select-row` label. */
|
|
119
|
+
selectionLabel?: string;
|
|
120
|
+
/** Accessible name for the card region. */
|
|
121
|
+
ariaLabel?: string;
|
|
122
|
+
/** Root element id (also wires the collapsible ARIA). Auto-generated when omitted. */
|
|
123
|
+
id?: string;
|
|
124
|
+
/** Extra full-width body content after `rows` (e.g. child row-groups). Collapses with the body. */
|
|
125
|
+
children?: React.ReactNode;
|
|
126
|
+
}
|
|
127
|
+
export declare const TableCard: {
|
|
128
|
+
(props: TableCardProps): JSX.Element;
|
|
129
|
+
displayName: string;
|
|
130
|
+
};
|
|
131
|
+
export default TableCard;
|