@frontify/fondue-components 27.0.0 → 28.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/dist/fondue-components.js +55 -53
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +1 -1
- package/dist/fondue-components100.js +17 -6
- package/dist/fondue-components100.js.map +1 -1
- package/dist/fondue-components101.js +150 -11
- package/dist/fondue-components101.js.map +1 -1
- package/dist/fondue-components102.js +44 -70
- package/dist/fondue-components102.js.map +1 -1
- package/dist/fondue-components103.js +14 -15
- package/dist/fondue-components103.js.map +1 -1
- package/dist/fondue-components104.js +15 -7
- package/dist/fondue-components104.js.map +1 -1
- package/dist/fondue-components105.js +107 -85
- package/dist/fondue-components105.js.map +1 -1
- package/dist/fondue-components106.js +11 -79
- package/dist/fondue-components106.js.map +1 -1
- package/dist/fondue-components107.js +17 -31
- package/dist/fondue-components107.js.map +1 -1
- package/dist/fondue-components108.js +11 -19
- package/dist/fondue-components108.js.map +1 -1
- package/dist/fondue-components109.js +16 -39
- package/dist/fondue-components109.js.map +1 -1
- package/dist/fondue-components11.js +3 -3
- package/dist/fondue-components110.js +9 -0
- package/dist/fondue-components110.js.map +1 -0
- package/dist/fondue-components111.js +15 -0
- package/dist/fondue-components111.js.map +1 -0
- package/dist/fondue-components112.js +74 -0
- package/dist/fondue-components112.js.map +1 -0
- package/dist/fondue-components113.js +18 -0
- package/dist/fondue-components113.js.map +1 -0
- package/dist/fondue-components114.js +10 -0
- package/dist/fondue-components114.js.map +1 -0
- package/dist/fondue-components115.js +92 -0
- package/dist/fondue-components115.js.map +1 -0
- package/dist/fondue-components116.js +84 -0
- package/dist/fondue-components116.js.map +1 -0
- package/dist/fondue-components117.js +34 -0
- package/dist/fondue-components117.js.map +1 -0
- package/dist/fondue-components118.js +32 -0
- package/dist/fondue-components118.js.map +1 -0
- package/dist/fondue-components12.js +7 -37
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components120.js +44 -0
- package/dist/fondue-components120.js.map +1 -0
- package/dist/fondue-components121.js +22 -0
- package/dist/fondue-components121.js.map +1 -0
- package/dist/fondue-components122.js +24 -0
- package/dist/fondue-components122.js.map +1 -0
- package/dist/fondue-components123.js +43 -0
- package/dist/fondue-components123.js.map +1 -0
- package/dist/fondue-components124.js +71 -0
- package/dist/fondue-components124.js.map +1 -0
- package/dist/fondue-components125.js +34 -0
- package/dist/fondue-components125.js.map +1 -0
- package/dist/fondue-components126.js +12 -0
- package/dist/fondue-components126.js.map +1 -0
- package/dist/fondue-components127.js +156 -0
- package/dist/fondue-components127.js.map +1 -0
- package/dist/fondue-components128.js +111 -0
- package/dist/fondue-components128.js.map +1 -0
- package/dist/fondue-components129.js +19 -0
- package/dist/fondue-components129.js.map +1 -0
- package/dist/fondue-components13.js +36 -121
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components130.js +19 -0
- package/dist/fondue-components130.js.map +1 -0
- package/dist/fondue-components131.js +32 -0
- package/dist/fondue-components131.js.map +1 -0
- package/dist/fondue-components132.js +16 -0
- package/dist/fondue-components132.js.map +1 -0
- package/dist/fondue-components133.js +10 -0
- package/dist/fondue-components133.js.map +1 -0
- package/dist/fondue-components14.js +121 -36
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +30 -39
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +44 -41
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +42 -57
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +55 -41
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +39 -16
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +17 -43
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +42 -69
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +72 -16
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +18 -76
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +75 -34
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +34 -53
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +55 -23
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +23 -55
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +52 -97
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +98 -31
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +31 -194
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +184 -134
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +143 -130
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +131 -30
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +29 -78
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +67 -110
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +121 -34
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +36 -56
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +56 -20
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +20 -23
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +3 -3
- package/dist/fondue-components40.js +25 -7
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +7 -8
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +9 -41
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +41 -5
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +1 -1
- package/dist/fondue-components45.js +3 -11
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +13 -32
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +32 -54
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +48 -125
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +130 -20
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +21 -53
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +53 -8
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +8 -13
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +13 -17
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +16 -4
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +5 -18
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +18 -19
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +18 -4
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +43 -12
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +24 -4
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +1 -1
- package/dist/fondue-components60.js +22 -17
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +4 -10
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +11 -35
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +4 -6
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +17 -4
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +10 -12
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +35 -7
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +6 -12
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +1 -1
- package/dist/fondue-components69.js +12 -24
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +1 -1
- package/dist/fondue-components70.js +8 -16
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +13 -20
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +5 -20
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +24 -19
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +17 -20
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +20 -19
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +20 -8
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +20 -11
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +20 -11
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +19 -7
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +8 -13
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +10 -22
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +11 -34
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +6 -10
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +12 -67
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +22 -14
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +34 -25
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +8 -16
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +67 -24
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +14 -8
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +5 -5
- package/dist/fondue-components90.js +24 -25
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +18 -6
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +24 -4
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +8 -4
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +30 -16
- package/dist/fondue-components94.js.map +1 -1
- package/dist/fondue-components95.js +6 -216
- package/dist/fondue-components95.js.map +1 -1
- package/dist/fondue-components96.js +4 -18
- package/dist/fondue-components96.js.map +1 -1
- package/dist/fondue-components97.js +4 -16
- package/dist/fondue-components97.js.map +1 -1
- package/dist/fondue-components98.js +188 -122
- package/dist/fondue-components98.js.map +1 -1
- package/dist/fondue-components99.js +18 -44
- package/dist/fondue-components99.js.map +1 -1
- package/dist/index.d.ts +101 -24
- package/dist/style.css +1 -1
- package/package.json +7 -5
|
@@ -1,149 +1,199 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
onAddClick: m,
|
|
54
|
-
onDismiss: i
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
] });
|
|
1
|
+
import { jsx as n, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { IconArrowUp as O, IconArrowDown as K, IconArrowBidirectional as W } from "@frontify/fondue-icons";
|
|
3
|
+
import { forwardRef as u, useRef as v, useState as _, useEffect as D, useMemo as L } from "react";
|
|
4
|
+
import { useSyncRefs as R } from "./fondue-components52.js";
|
|
5
|
+
import { useTextTruncation as h } from "./fondue-components84.js";
|
|
6
|
+
import { useTranslation as j } from "./fondue-components40.js";
|
|
7
|
+
import { Box as M } from "./fondue-components5.js";
|
|
8
|
+
import { LoadingCircle as S } from "./fondue-components20.js";
|
|
9
|
+
import s from "./fondue-components85.js";
|
|
10
|
+
import { handleKeyDown as U, shouldIgnoreRowClick as q } from "./fondue-components86.js";
|
|
11
|
+
const x = u(
|
|
12
|
+
({ layout: t = "auto", fontSize: e = "medium", gutter: r = "0px", sticky: o, noBorder: a = !1, children: l, ...m }, f) => {
|
|
13
|
+
const b = v(null), [p, i] = _(!1);
|
|
14
|
+
R(b, f);
|
|
15
|
+
const d = o === "head" || o === "both", N = o === "col" || o === "both";
|
|
16
|
+
return D(() => {
|
|
17
|
+
const c = b.current;
|
|
18
|
+
if (!c)
|
|
19
|
+
return;
|
|
20
|
+
const y = () => {
|
|
21
|
+
const g = c.parentElement;
|
|
22
|
+
if (!g)
|
|
23
|
+
return;
|
|
24
|
+
const C = c.scrollWidth, E = g.clientWidth;
|
|
25
|
+
i(C > E);
|
|
26
|
+
};
|
|
27
|
+
y();
|
|
28
|
+
const w = new ResizeObserver(y);
|
|
29
|
+
return w.observe(c), c.parentElement && w.observe(c.parentElement), () => {
|
|
30
|
+
w.disconnect();
|
|
31
|
+
};
|
|
32
|
+
}, [l]), // eslint-disable-next-line jsx-a11y-x/no-noninteractive-element-interactions
|
|
33
|
+
/* @__PURE__ */ n(
|
|
34
|
+
"table",
|
|
35
|
+
{
|
|
36
|
+
ref: b,
|
|
37
|
+
className: s.table,
|
|
38
|
+
style: {
|
|
39
|
+
// @ts-expect-error CSS custom properties are not in CSSProperties type
|
|
40
|
+
"--table-gutter": r
|
|
41
|
+
},
|
|
42
|
+
"data-layout": t,
|
|
43
|
+
"data-font-size": e,
|
|
44
|
+
"data-sticky-header": d,
|
|
45
|
+
"data-sticky-left-column": N,
|
|
46
|
+
"data-no-border": a,
|
|
47
|
+
"data-has-horizontal-overflow": p,
|
|
48
|
+
onKeyDown: U,
|
|
49
|
+
...m,
|
|
50
|
+
children: l
|
|
51
|
+
}
|
|
52
|
+
);
|
|
58
53
|
}
|
|
59
54
|
);
|
|
60
|
-
|
|
61
|
-
const
|
|
55
|
+
x.displayName = "Table.Root";
|
|
56
|
+
const k = u(({ children: t }, e) => /* @__PURE__ */ n("caption", { ref: e, className: s.caption, children: t }));
|
|
57
|
+
k.displayName = "Table.Caption";
|
|
58
|
+
const z = u(
|
|
59
|
+
({ sticky: t = !1, children: e, "aria-label": r, "aria-busy": o }, a) => /* @__PURE__ */ n("thead", { ref: a, className: s.header, "data-sticky": t, "aria-label": r, "aria-busy": o, children: e })
|
|
60
|
+
);
|
|
61
|
+
z.displayName = "Table.Header";
|
|
62
|
+
const H = u(
|
|
62
63
|
({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return u ? /* @__PURE__ */ t(
|
|
86
|
-
"button",
|
|
87
|
-
{
|
|
88
|
-
ref: y,
|
|
89
|
-
type: "button",
|
|
90
|
-
"aria-label": e,
|
|
91
|
-
title: l,
|
|
92
|
-
className: s.mainContent,
|
|
93
|
-
onClick: a ? void 0 : u,
|
|
94
|
-
onMouseEnter: i,
|
|
95
|
-
onMouseLeave: p,
|
|
96
|
-
disabled: a,
|
|
97
|
-
"data-test-id": n,
|
|
98
|
-
children: d
|
|
99
|
-
}
|
|
100
|
-
) : /* @__PURE__ */ t(
|
|
101
|
-
"div",
|
|
64
|
+
noShrink: t = !1,
|
|
65
|
+
truncate: e = !1,
|
|
66
|
+
align: r = "left",
|
|
67
|
+
scope: o = "col",
|
|
68
|
+
sortTranslations: a,
|
|
69
|
+
sortDirection: l,
|
|
70
|
+
colSpan: m,
|
|
71
|
+
width: f,
|
|
72
|
+
state: b = "idle",
|
|
73
|
+
loadingStateAriaLabel: p,
|
|
74
|
+
onSortChange: i,
|
|
75
|
+
children: d
|
|
76
|
+
}, N) => {
|
|
77
|
+
const { t: c } = j(), y = v(null);
|
|
78
|
+
R(y, N), h(y);
|
|
79
|
+
const w = L(() => typeof d == "string" ? l === "ascending" ? (a == null ? void 0 : a.sortDescending) ?? c("Table_sortByDescending", { column: d }) : (a == null ? void 0 : a.sortAscending) ?? c("Table_sortByAscending", { column: d }) : c(l === "ascending" ? "Table_sortDescending" : "Table_sortAscending"), [d, l, a, c]), g = () => {
|
|
80
|
+
if (!i)
|
|
81
|
+
return;
|
|
82
|
+
i(l === void 0 || l === "descending" ? "ascending" : "descending");
|
|
83
|
+
};
|
|
84
|
+
return /* @__PURE__ */ n(
|
|
85
|
+
"th",
|
|
102
86
|
{
|
|
103
87
|
ref: y,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
88
|
+
style: { width: f },
|
|
89
|
+
className: s.headerCell,
|
|
90
|
+
scope: o,
|
|
91
|
+
colSpan: m,
|
|
92
|
+
"data-align": r,
|
|
93
|
+
"data-truncate": e,
|
|
94
|
+
"data-no-shrink": t,
|
|
95
|
+
"data-sortable": !!i,
|
|
96
|
+
"aria-sort": i ? l || "none" : void 0,
|
|
97
|
+
children: b === "loading" ? /* @__PURE__ */ T("div", { className: s.cellContent, "aria-live": "polite", "aria-label": p, children: [
|
|
98
|
+
typeof d == "string" && e ? /* @__PURE__ */ n("span", { className: s.buttonText, children: d }) : d,
|
|
99
|
+
/* @__PURE__ */ n(S, { "data-test-id": "fondue-loading-circle", size: "xx-small" })
|
|
100
|
+
] }) : i ? /* @__PURE__ */ T(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
className: s.cellContent,
|
|
104
|
+
"aria-label": w,
|
|
105
|
+
"data-active": !!l,
|
|
106
|
+
onClick: g,
|
|
107
|
+
type: "button",
|
|
108
|
+
children: [
|
|
109
|
+
typeof d == "string" && e ? /* @__PURE__ */ n("span", { className: s.buttonText, children: d }) : d,
|
|
110
|
+
/* @__PURE__ */ n(M, { width: 3, children: l === "ascending" ? /* @__PURE__ */ n(O, { className: s.sortIndicator, size: "12" }) : l === "descending" ? /* @__PURE__ */ n(K, { className: s.sortIndicator, size: "12" }) : /* @__PURE__ */ n(W, { className: s.sortIndicator, size: "12" }) })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
) : d
|
|
109
114
|
}
|
|
110
115
|
);
|
|
111
116
|
}
|
|
112
117
|
);
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
o
|
|
116
|
-
"
|
|
117
|
-
{
|
|
118
|
-
type: "button",
|
|
119
|
-
"aria-label": `Add ${e || ""}`,
|
|
120
|
-
className: s.actionButton,
|
|
121
|
-
disabled: n,
|
|
122
|
-
onClick: o,
|
|
123
|
-
children: /* @__PURE__ */ t(j, { size: "16" })
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
a && /* @__PURE__ */ t(
|
|
127
|
-
"button",
|
|
118
|
+
H.displayName = "Table.HeaderCell";
|
|
119
|
+
const I = u(
|
|
120
|
+
({ firstColumnSticky: t = !1, lastColumnSticky: e = !1, children: r, "aria-busy": o }, a) => /* @__PURE__ */ n(
|
|
121
|
+
"tbody",
|
|
128
122
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
children:
|
|
123
|
+
ref: a,
|
|
124
|
+
className: s.body,
|
|
125
|
+
"data-first-column-sticky": t,
|
|
126
|
+
"data-last-column-sticky": e,
|
|
127
|
+
"aria-busy": o,
|
|
128
|
+
children: r
|
|
135
129
|
}
|
|
136
130
|
)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
131
|
+
);
|
|
132
|
+
I.displayName = "Table.Body";
|
|
133
|
+
const B = u(
|
|
134
|
+
({ disabled: t = !1, selected: e = !1, onClick: r, children: o, "aria-label": a, "data-test-id": l }, m) => {
|
|
135
|
+
const f = r !== void 0 && !t, b = (i) => {
|
|
136
|
+
t || q(i) || r && r(e);
|
|
137
|
+
}, p = (i) => {
|
|
138
|
+
f && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), b());
|
|
139
|
+
};
|
|
140
|
+
return /* @__PURE__ */ n(
|
|
141
|
+
"tr",
|
|
142
|
+
{
|
|
143
|
+
ref: m,
|
|
144
|
+
className: s.row,
|
|
145
|
+
tabIndex: 0,
|
|
146
|
+
role: f ? "button" : "row",
|
|
147
|
+
"data-disabled": t,
|
|
148
|
+
"data-interactive": f,
|
|
149
|
+
"data-selected": f ? void 0 : e,
|
|
150
|
+
"aria-disabled": t,
|
|
151
|
+
"aria-label": a,
|
|
152
|
+
"aria-selected": f ? void 0 : e,
|
|
153
|
+
onClick: f ? b : void 0,
|
|
154
|
+
onKeyDown: f ? p : void 0,
|
|
155
|
+
"data-test-id": l,
|
|
156
|
+
children: o
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
B.displayName = "Table.Row";
|
|
162
|
+
const A = u(
|
|
163
|
+
({ colSpan: t, truncate: e, align: r = "left", children: o, "aria-label": a }, l) => {
|
|
164
|
+
const m = v(null);
|
|
165
|
+
return R(m, l), h(m), /* @__PURE__ */ n(
|
|
166
|
+
"td",
|
|
167
|
+
{
|
|
168
|
+
ref: m,
|
|
169
|
+
className: s.rowCell,
|
|
170
|
+
colSpan: t,
|
|
171
|
+
"data-align": r,
|
|
172
|
+
"data-truncate": e,
|
|
173
|
+
"aria-label": a,
|
|
174
|
+
children: o
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
A.displayName = "Table.RowCell";
|
|
180
|
+
const ee = {
|
|
181
|
+
Root: x,
|
|
182
|
+
Caption: k,
|
|
183
|
+
Header: z,
|
|
184
|
+
HeaderCell: H,
|
|
185
|
+
Body: I,
|
|
186
|
+
Row: B,
|
|
187
|
+
RowCell: A
|
|
188
|
+
};
|
|
144
189
|
export {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
190
|
+
ee as Table,
|
|
191
|
+
I as TableBody,
|
|
192
|
+
k as TableCaption,
|
|
193
|
+
z as TableHeader,
|
|
194
|
+
H as TableHeaderCell,
|
|
195
|
+
x as TableRoot,
|
|
196
|
+
B as TableRow,
|
|
197
|
+
A as TableRowCell
|
|
148
198
|
};
|
|
149
199
|
//# sourceMappingURL=fondue-components31.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components31.js","sources":["../src/components/Tag/Tag.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross, IconPlus } from '@frontify/fondue-icons';\nimport { Children, forwardRef, isValidElement, useState, type MouseEvent, type ReactNode } from 'react';\n\nimport styles from './styles/tag.module.scss';\n\ntype TagStyle = 'default' | 'highlight';\n\ntype TagEmphasis = 'strong' | 'weak';\n\ntype TagSize = 'default' | 'small';\n\ntype TagProps = {\n /**\n * @default 'strong'\n */\n emphasis?: TagEmphasis;\n /**\n * @default 'default'\n */\n variant?: TagStyle;\n /**\n * @default 'default'\n */\n size?: TagSize;\n /**\n * @default false\n */\n disabled?: boolean;\n /**\n * Click handler - when provided, the Tag renders as a button element\n */\n onClick?: (event?: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Click handler on dismiss - providing this will show the dismiss button\n */\n onDismiss?: (event?: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Click handler on add click - providing this will show the add button\n */\n onAddClick?: (event?: MouseEvent<HTMLButtonElement>) => void;\n title?: string;\n 'aria-label'?: string;\n 'data-test-id'?: string;\n children: ReactNode;\n};\n\nexport type TagPropsWithClick = Omit<TagProps, 'onClick'> & {\n onClick: (event?: MouseEvent<HTMLButtonElement>) => void;\n};\n\nexport type TagPropsWithoutClick = Omit<TagProps, 'onClick'> & {\n onClick?: undefined;\n};\n\nexport type TagHoverContentProps = {\n children: ReactNode;\n};\n\nexport type TagSecondaryContentProps = {\n children: ReactNode;\n};\n\nconst TagRoot = forwardRef<HTMLButtonElement | HTMLDivElement, TagProps>(\n (\n {\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'tag',\n children,\n disabled = false,\n emphasis = 'strong',\n onAddClick,\n onClick,\n onDismiss,\n size = 'default',\n title,\n variant = 'default',\n },\n ref,\n ) => {\n const [isHover, setIsHover] = useState(false);\n\n // Extract hover content from slots\n let extractedHoverContent: ReactNode = null;\n const processedChildren = Children.map(children, (child) => {\n if (isValidElement(child) && child.type === TagHoverContent) {\n // eslint-disable-next-line react-hooks/immutability\n extractedHoverContent = child.props.children;\n return null;\n }\n return child;\n });\n\n const commonProps = {\n 'data-addable': !!onAddClick,\n 'data-component': 'tag',\n 'data-disabled': disabled,\n 'data-dismissable': !!onDismiss,\n 'data-emphasis': emphasis,\n 'data-size': size,\n 'data-variant': variant,\n className: styles.root,\n };\n\n return (\n <div {...commonProps}>\n <TagMainContent\n ref={ref}\n aria-label={ariaLabel || title}\n disabled={disabled}\n hoverContent={extractedHoverContent}\n isHover={isHover}\n onClick={onClick}\n onMouseEnter={() => setIsHover(true)}\n onMouseLeave={() => setIsHover(false)}\n title={title}\n data-test-id={dataTestId}\n >\n {processedChildren}\n </TagMainContent>\n <TagActionButtons\n aria-label={ariaLabel || title}\n disabled={disabled}\n onAddClick={onAddClick}\n onDismiss={onDismiss}\n />\n </div>\n );\n },\n);\nTagRoot.displayName = 'Tag';\n\ntype TagMainContentProps = {\n 'aria-label'?: string;\n 'data-test-id'?: string;\n children: ReactNode;\n disabled?: boolean;\n hoverContent?: ReactNode;\n isHover?: boolean;\n onClick?: (event?: MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n title?: string;\n};\n\nconst TagMainContent = forwardRef<HTMLButtonElement | HTMLDivElement, TagMainContentProps>(\n (\n {\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId,\n children,\n disabled = false,\n hoverContent,\n isHover = false,\n onClick,\n onMouseEnter,\n onMouseLeave,\n title,\n },\n ref,\n ) => {\n // Process children to handle secondary content slots in their natural position\n let secondaryIndex = 0;\n const processedChildren = Children.map(children, (child) => {\n if (isValidElement(child) && child.type === TagSecondaryContent) {\n const currentIndex = secondaryIndex++;\n return (\n <div className={styles.secondaryContent} key={`secondary-${currentIndex}`}>\n {/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */}\n {child.props.children}\n </div>\n );\n }\n return child;\n });\n\n const content = hoverContent ? (\n <div data-hover={isHover}>\n <div>{hoverContent}</div>\n <div>{processedChildren}</div>\n </div>\n ) : (\n processedChildren\n );\n\n if (onClick) {\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n aria-label={ariaLabel}\n title={title}\n className={styles.mainContent}\n onClick={disabled ? undefined : onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n disabled={disabled}\n data-test-id={dataTestId}\n >\n {content}\n </button>\n );\n }\n\n return (\n <div\n ref={ref as React.Ref<HTMLDivElement>}\n className={styles.mainContent}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n data-test-id={dataTestId}\n >\n {content}\n </div>\n );\n },\n);\nTagMainContent.displayName = 'TagMainContent';\n\ntype TagActionButtonsProps = {\n /**\n * @default false\n */\n disabled?: boolean;\n /**\n * Click handler on dismiss\n */\n onDismiss?: (event?: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Click handler on add click\n */\n onAddClick?: (event?: MouseEvent<HTMLButtonElement>) => void;\n 'aria-label'?: string;\n};\n\nconst TagActionButtons = ({ 'aria-label': ariaLabel, disabled, onAddClick, onDismiss }: TagActionButtonsProps) => {\n return (\n <>\n {onAddClick && (\n <button\n type=\"button\"\n aria-label={`Add ${ariaLabel || ''}`}\n className={styles.actionButton}\n disabled={disabled}\n onClick={onAddClick}\n >\n <IconPlus size=\"16\" />\n </button>\n )}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label={`Dismiss ${ariaLabel || ''}`}\n className={styles.actionButton}\n disabled={disabled}\n onClick={onDismiss}\n >\n <IconCross size=\"16\" />\n </button>\n )}\n </>\n );\n};\n\nexport const TagHoverContent = ({ children }: TagHoverContentProps) => {\n return <>{children}</>;\n};\nTagHoverContent.displayName = 'Tag.HoverContent';\n\nexport const TagSecondaryContent = ({ children }: TagSecondaryContentProps) => {\n return <>{children}</>;\n};\nTagSecondaryContent.displayName = 'Tag.SecondaryContent';\n\n/**\n * TagComponent interface with function overloads for conditional ref typing.\n *\n * The overload order matters for TypeScript's type inference:\n * - TypeScript uses the FIRST matching overload when inferring types in generic contexts\n * (e.g., Storybook's StoryObj<typeof Tag>)\n * - By placing TagPropsWithoutClick first, generic inference defaults to HTMLDivElement\n * - When onClick is explicitly provided, TypeScript matches the second overload,\n * correctly inferring HTMLButtonElement for the ref\n */\ntype TagComponent = {\n (props: TagPropsWithoutClick & React.RefAttributes<HTMLDivElement>): React.ReactNode;\n (props: TagPropsWithClick & React.RefAttributes<HTMLButtonElement>): React.ReactNode;\n displayName?: string;\n HoverContent: typeof TagHoverContent;\n SecondaryContent: typeof TagSecondaryContent;\n};\n\nexport const Tag: TagComponent = TagRoot as unknown as TagComponent;\nTag.HoverContent = TagHoverContent;\nTag.SecondaryContent = TagSecondaryContent;\n"],"names":["TagRoot","forwardRef","ariaLabel","dataTestId","children","disabled","emphasis","onAddClick","onClick","onDismiss","size","title","variant","ref","isHover","setIsHover","useState","extractedHoverContent","processedChildren","Children","child","isValidElement","TagHoverContent","commonProps","styles","jsxs","jsx","TagMainContent","TagActionButtons","hoverContent","onMouseEnter","onMouseLeave","secondaryIndex","TagSecondaryContent","currentIndex","content","Fragment","IconPlus","IconCross","Tag"],"mappings":";;;;AAgEA,MAAMA,IAAUC;AAAA,EACZ,CACI;AAAA,IACI,cAAcC;AAAA,IACd,gBAAgBC,IAAa;AAAA,IAC7B,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,EAAA,GAEdC,MACC;AACD,UAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK;AAG5C,QAAIC,IAAmC;AACvC,UAAMC,IAAoBC,EAAS,IAAIf,GAAU,CAACgB,MAC1CC,EAAeD,CAAK,KAAKA,EAAM,SAASE,KAExCL,IAAwBG,EAAM,MAAM,UAC7B,QAEJA,CACV,GAEKG,IAAc;AAAA,MAChB,gBAAgB,CAAC,CAAChB;AAAA,MAClB,kBAAkB;AAAA,MAClB,iBAAiBF;AAAA,MACjB,oBAAoB,CAAC,CAACI;AAAA,MACtB,iBAAiBH;AAAA,MACjB,aAAaI;AAAA,MACb,gBAAgBE;AAAA,MAChB,WAAWY,EAAO;AAAA,IAAA;AAGtB,WACI,gBAAAC,EAAC,OAAA,EAAK,GAAGF,GACL,UAAA;AAAA,MAAA,gBAAAG;AAAA,QAACC;AAAA,QAAA;AAAA,UACG,KAAAd;AAAA,UACA,cAAYX,KAAaS;AAAA,UACzB,UAAAN;AAAA,UACA,cAAcY;AAAA,UACd,SAAAH;AAAA,UACA,SAAAN;AAAA,UACA,cAAc,MAAMO,EAAW,EAAI;AAAA,UACnC,cAAc,MAAMA,EAAW,EAAK;AAAA,UACpC,OAAAJ;AAAA,UACA,gBAAcR;AAAA,UAEb,UAAAe;AAAA,QAAA;AAAA,MAAA;AAAA,MAEL,gB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AA,MAAA;AAAA,IAAA,IAMT,gBAAAT;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAAb;AAAA,QACA,WAAWW,EAAO;AAAA,QAClB,cAAAM;AAAA,QACA,cAAAC;AAAA,QACA,gBAAc5B;AAAA,QAEb,UAAAgC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGb;AACJ;AACAR,EAAe,cAAc;AAkB7B,MAAMC,IAAmB,CAAC,EAAE,cAAc1B,GAAW,UAAAG,GAAU,YAAAE,GAAY,WAAAE,QAEnE,gBAAAgB,EAAAW,GAAA,EACK,UAAA;AAAA,EAAA7B,KACG,gBAAAmB;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,cAAY,OAAOxB,KAAa,EAAE;AAAA,MAClC,WAAWsB,EAAO;AAAA,MAClB,UAAAnB;AAAA,MACA,SAASE;AAAA,MAET,UAAA,gBAAAmB,EAACW,GAAA,EAAS,MAAK,KAAA,CAAK;AAAA,IAAA;AAAA,EAAA;AAAA,EAG3B5B,KACG,gBAAAiB;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,cAAY,WAAWxB,KAAa,EAAE;AAAA,MACtC,WAAWsB,EAAO;AAAA,MAClB,UAAAnB;AAAA,MACA,SAASI;AAAA,MAET,UAAA,gBAAAiB,EAACY,GAAA,EAAU,MAAK,KAAA,CAAK;AAAA,IAAA;AAAA,EAAA;AACzB,GAER,GAIKhB,IAAkB,CAAC,EAAE,UAAAlB,+BACpB,UAAAA,GAAS;AAEvBkB,EAAgB,cAAc;AAEvB,MAAMW,IAAsB,CAAC,EAAE,UAAA7B,+BACxB,UAAAA,GAAS;AAEvB6B,EAAoB,cAAc;AAoB3B,MAAMM,IAAoBvC;AACjCuC,EAAI,eAAejB;AACnBiB,EAAI,mBAAmBN;"}
|
|
1
|
+
{"version":3,"file":"fondue-components31.js","sources":["../src/components/Table/Table.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconArrowBidirectional, IconArrowDown, IconArrowUp } from '@frontify/fondue-icons';\nimport {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type AriaAttributes,\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { useTextTruncation } from '#/hooks/useTextTruncation';\nimport { useTranslation } from '#/hooks/useTranslation';\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport { Box } from '../Box/Box';\nimport { LoadingCircle } from '../LoadingCircle/LoadingCircle';\n\nimport styles from './styles/table.module.scss';\nimport { handleKeyDown, shouldIgnoreRowClick } from './utils';\n\ntype TableRootProps = {\n /**\n * Whether the table should have a fixed or auto layout\n * @default 'auto'\n */\n layout?: 'auto' | 'fixed';\n /**\n * Font size of the table content\n * @default 'small'\n */\n fontSize?: 'small' | 'medium';\n /**\n * Additional spacing between table cells (both horizontal and vertical)\n *\n * This value is added to the default cell spacing. For example, with `gutter=\"48px\"`,\n * cells will have 48px of additional space between them in both directions\n * (24px added to each side).\n *\n * Accepts any CSS length value with units (e.g., '16px', '1rem', '48px')\n *\n * **Important:** Always include a unit, even for zero (use '0px', not '0')\n * @default '0px'\n */\n gutter?: CSSProperties['borderSpacing'];\n /**\n * Whether header should stick to the top when scrolling\n * @deprecated Use `Table.Header sticky` prop instead. For sticky columns, use `Table.Body firstColumnSticky` or `lastColumnSticky` props\n */\n sticky?: 'head' | 'col' | 'both';\n /**\n * Whether to remove the top and bottom borders from the table\n * @default false\n */\n noBorder?: boolean;\n children: ReactNode;\n} & CommonAriaAttrs &\n Pick<AriaAttributes, 'aria-multiselectable'>;\n\nexport const TableRoot = forwardRef<HTMLTableElement, TableRootProps>(\n ({ layout = 'auto', fontSize = 'medium', gutter = '0px', sticky, noBorder = false, children, ...props }, ref) => {\n const tableRef = useRef<HTMLTableElement>(null);\n const [hasHorizontalOverflow, setHasHorizontalOverflow] = useState(false);\n\n useSyncRefs<HTMLTableElement>(tableRef, ref);\n\n // Handle deprecated `sticky` prop for backward compatibility\n const legacyStickyHeader = sticky === 'head' || sticky === 'both';\n const legacyStickyLeftColumn = sticky === 'col' || sticky === 'both';\n\n useEffect(() => {\n const table = tableRef.current;\n if (!table) {\n return;\n }\n\n const checkOverflow = () => {\n const parent = table.parentElement;\n if (!parent) {\n return;\n }\n\n const tableWidth = table.scrollWidth;\n const parentWidth = parent.clientWidth;\n setHasHorizontalOverflow(tableWidth > parentWidth);\n };\n\n checkOverflow();\n\n const resizeObserver = new ResizeObserver(checkOverflow);\n resizeObserver.observe(table);\n if (table.parentElement) {\n resizeObserver.observe(table.parentElement);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [children]);\n\n return (\n // eslint-disable-next-line jsx-a11y-x/no-noninteractive-element-interactions\n <table\n ref={tableRef}\n className={styles.table}\n style={{\n // @ts-expect-error CSS custom properties are not in CSSProperties type\n '--table-gutter': gutter,\n }}\n data-layout={layout}\n data-font-size={fontSize}\n data-sticky-header={legacyStickyHeader}\n data-sticky-left-column={legacyStickyLeftColumn}\n data-no-border={noBorder}\n data-has-horizontal-overflow={hasHorizontalOverflow}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {children}\n </table>\n );\n },\n);\nTableRoot.displayName = 'Table.Root';\n\nexport const TableCaption = forwardRef<HTMLTableCaptionElement, { children: ReactNode }>(({ children }, ref) => {\n return (\n <caption ref={ref} className={styles.caption}>\n {children}\n </caption>\n );\n});\nTableCaption.displayName = 'Table.Caption';\n\ntype TableHeaderProps = {\n /**\n * Whether the header should stick to the top when scrolling\n * @default false\n */\n sticky?: boolean;\n children: ReactNode;\n 'aria-label'?: string;\n 'aria-busy'?: boolean;\n};\n\nexport const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({ sticky = false, children, 'aria-label': ariaLabel, 'aria-busy': ariaBusy }, ref) => {\n return (\n <thead ref={ref} className={styles.header} data-sticky={sticky} aria-label={ariaLabel} aria-busy={ariaBusy}>\n {children}\n </thead>\n );\n },\n);\nTableHeader.displayName = 'Table.Header';\n\ntype SortDirection = 'ascending' | 'descending' | undefined;\ntype HorizontalAlignment = 'left' | 'center' | 'right';\n\ntype TableHeaderCellProps = {\n /**\n * Scope of the column\n * @default 'col'\n */\n scope?: HTMLTableCellElement['scope'];\n /**\n * Number of columns the cell should span\n */\n colSpan?: HTMLTableCellElement['colSpan'];\n /**\n * Width of the column\n */\n width?: CSSProperties['width'];\n /**\n * Current sort direction of the column\n */\n sortDirection?: SortDirection;\n /**\n * Horizontal alignment of the content\n * @default 'left'\n */\n align?: HorizontalAlignment;\n /**\n * Whether to truncate content with ellipsis when it overflows\n * @default false\n */\n truncate?: boolean;\n /**\n * Aria label for ascending/descending sort. Variables: {column} - column name\n * @default \"Sort by {column} ascending/descending\"\n */\n sortTranslations?: {\n sortAscending?: string;\n sortDescending?: string;\n };\n /**\n * Whether the column should have a minimum width\n * @default false\n */\n noShrink?: boolean;\n /**\n * State of the cell, used for displaying loading state\n * @default 'idle'\n */\n state?: 'idle' | 'loading';\n /**\n * The aria-label to be applied when state='loading'\n */\n loadingStateAriaLabel?: string;\n /**\n * Handler called when the sort direction changes\n * @param direction - The new sort direction\n */\n onSortChange?: (direction: SortDirection) => void;\n children: ReactNode;\n};\n\nexport const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(\n (\n {\n noShrink = false,\n truncate = false,\n align = 'left',\n scope = 'col',\n sortTranslations,\n sortDirection,\n colSpan,\n width,\n state = 'idle',\n loadingStateAriaLabel,\n onSortChange,\n children,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const cellRef = useRef<HTMLTableCellElement>(null);\n useSyncRefs<HTMLTableCellElement>(cellRef, ref);\n\n useTextTruncation(cellRef);\n\n const sortLabel = useMemo(() => {\n if (typeof children === 'string') {\n if (sortDirection === 'ascending') {\n return sortTranslations?.sortDescending ?? t('Table_sortByDescending', { column: children });\n }\n return sortTranslations?.sortAscending ?? t('Table_sortByAscending', { column: children });\n }\n\n return sortDirection === 'ascending' ? t('Table_sortDescending') : t('Table_sortAscending');\n }, [children, sortDirection, sortTranslations, t]);\n\n const handleSortChange = () => {\n if (!onSortChange) {\n return;\n }\n\n const newDirection: SortDirection =\n sortDirection === undefined || sortDirection === 'descending' ? 'ascending' : 'descending';\n\n onSortChange(newDirection);\n };\n\n return (\n <th\n ref={cellRef}\n style={{ width }}\n className={styles.headerCell}\n scope={scope}\n colSpan={colSpan}\n data-align={align}\n data-truncate={truncate}\n data-no-shrink={noShrink}\n data-sortable={!!onSortChange}\n aria-sort={onSortChange ? sortDirection || 'none' : undefined}\n >\n {state === 'loading' ? (\n <div className={styles.cellContent} aria-live=\"polite\" aria-label={loadingStateAriaLabel}>\n {typeof children === 'string' && truncate ? (\n <span className={styles.buttonText}>{children}</span>\n ) : (\n children\n )}\n <LoadingCircle data-test-id=\"fondue-loading-circle\" size=\"xx-small\" />\n </div>\n ) : onSortChange ? (\n <button\n className={styles.cellContent}\n aria-label={sortLabel}\n data-active={!!sortDirection}\n onClick={handleSortChange}\n type=\"button\"\n >\n {typeof children === 'string' && truncate ? (\n <span className={styles.buttonText}>{children}</span>\n ) : (\n children\n )}\n <Box width={3}>\n {sortDirection === 'ascending' ? (\n <IconArrowUp className={styles.sortIndicator} size=\"12\" />\n ) : sortDirection === 'descending' ? (\n <IconArrowDown className={styles.sortIndicator} size=\"12\" />\n ) : (\n <IconArrowBidirectional className={styles.sortIndicator} size=\"12\" />\n )}\n </Box>\n </button>\n ) : (\n children\n )}\n </th>\n );\n },\n);\nTableHeaderCell.displayName = 'Table.HeaderCell';\n\ntype TableBodyProps = {\n /**\n * Whether the first column should stick to the left when scrolling horizontally\n * @default false\n */\n firstColumnSticky?: boolean;\n /**\n * Whether the last column should stick to the right when scrolling horizontally\n * @default false\n */\n lastColumnSticky?: boolean;\n children: ReactNode;\n 'aria-busy'?: boolean;\n};\n\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({ firstColumnSticky = false, lastColumnSticky = false, children, 'aria-busy': ariaBusy }, ref) => {\n return (\n <tbody\n ref={ref}\n className={styles.body}\n data-first-column-sticky={firstColumnSticky}\n data-last-column-sticky={lastColumnSticky}\n aria-busy={ariaBusy}\n >\n {children}\n </tbody>\n );\n },\n);\nTableBody.displayName = 'Table.Body';\n\ntype TableRowProps = {\n /**\n * Whether the row is in a selected state\n * @default false\n */\n selected?: boolean;\n /**\n * Whether to disable interactions for this row\n * @default false\n */\n disabled?: boolean;\n /**\n * Handler called when the row is clicked or activated via keyboard\n * If provided, the row will be hoverable and interactive\n */\n onClick?: (selected: boolean) => void;\n /**\n * Content to be rendered within the row\n */\n children: ReactNode;\n /**\n * Accessible label for the row\n */\n 'aria-label'?: string;\n 'data-test-id'?: string;\n};\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(\n (\n { disabled = false, selected = false, onClick, children, 'aria-label': ariaLabel, 'data-test-id': dataTestId },\n ref,\n ) => {\n const isInteractive = onClick !== undefined && !disabled;\n\n const handleClick = (event?: MouseEvent) => {\n if (disabled) {\n return;\n }\n\n if (shouldIgnoreRowClick(event)) {\n return;\n }\n\n if (onClick) {\n onClick(selected);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTableRowElement>) => {\n if (!isInteractive) {\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClick();\n }\n };\n\n return (\n <tr\n ref={ref}\n className={styles.row}\n tabIndex={0}\n role={isInteractive ? 'button' : 'row'}\n data-disabled={disabled}\n data-interactive={isInteractive}\n data-selected={!isInteractive ? selected : undefined}\n aria-disabled={disabled}\n aria-label={ariaLabel}\n aria-selected={!isInteractive ? selected : undefined}\n onClick={isInteractive ? handleClick : undefined}\n onKeyDown={isInteractive ? handleKeyDown : undefined}\n data-test-id={dataTestId}\n >\n {children}\n </tr>\n );\n },\n);\nTableRow.displayName = 'Table.Row';\n\ntype TableRowCellProps = {\n /**\n * Number of columns the cell should span\n */\n colSpan?: HTMLTableCellElement['colSpan'];\n /**\n * Whether to truncate content with ellipsis when it overflows\n * @default false\n */\n truncate?: boolean;\n /**\n * Horizontal alignment of the content\n * @default 'left'\n */\n align?: HorizontalAlignment;\n children: ReactNode;\n 'aria-label'?: string;\n};\n\nexport const TableRowCell = forwardRef<HTMLTableCellElement, TableRowCellProps>(\n ({ colSpan, truncate, align = 'left', children, 'aria-label': ariaLabel }, ref): ReactElement => {\n const cellRef = useRef<HTMLTableCellElement>(null);\n useSyncRefs<HTMLTableCellElement>(cellRef, ref);\n\n useTextTruncation(cellRef);\n\n return (\n <td\n ref={cellRef}\n className={styles.rowCell}\n colSpan={colSpan}\n data-align={align}\n data-truncate={truncate}\n aria-label={ariaLabel}\n >\n {children}\n </td>\n );\n },\n);\nTableRowCell.displayName = 'Table.RowCell';\n\nexport const Table = {\n Root: TableRoot,\n Caption: TableCaption,\n Header: TableHeader,\n HeaderCell: TableHeaderCell,\n Body: TableBody,\n Row: TableRow,\n RowCell: TableRowCell,\n};\n"],"names":["TableRoot","forwardRef","layout","fontSize","gutter","sticky","noBorder","children","props","ref","tableRef","useRef","hasHorizontalOverflow","setHasHorizontalOverflow","useState","useSyncRefs","legacyStickyHeader","legacyStickyLeftColumn","useEffect","table","checkOverflow","parent","tableWidth","parentWidth","resizeObserver","jsx","styles","handleKeyDown","TableCaption","TableHeader","ariaLabel","ariaBusy","TableHeaderCell","noShrink","truncate","align","scope","sortTranslations","sortDirection","colSpan","width","state","loadingStateAriaLabel","onSortChange","t","useTranslation","cellRef","useTextTruncation","sortLabel","useMemo","handleSortChange","jsxs","LoadingCircle","Box","IconArrowUp","IconArrowDown","IconArrowBidirectional","TableBody","firstColumnSticky","lastColumnSticky","TableRow","disabled","selected","onClick","dataTestId","isInteractive","handleClick","event","shouldIgnoreRowClick","TableRowCell","Table"],"mappings":";;;;;;;;;;AAkEO,MAAMA,IAAYC;AAAA,EACrB,CAAC,EAAE,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