@frontify/fondue-components 29.1.0 → 30.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 +72 -70
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +181 -33
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components100.js +8 -23
- package/dist/fondue-components100.js.map +1 -1
- package/dist/fondue-components101.js +11 -34
- package/dist/fondue-components101.js.map +1 -1
- package/dist/fondue-components102.js +10 -10
- package/dist/fondue-components103.js +6 -67
- package/dist/fondue-components103.js.map +1 -1
- package/dist/fondue-components104.js +12 -14
- package/dist/fondue-components104.js.map +1 -1
- package/dist/fondue-components105.js +22 -25
- package/dist/fondue-components105.js.map +1 -1
- package/dist/fondue-components106.js +34 -19
- package/dist/fondue-components106.js.map +1 -1
- package/dist/fondue-components107.js +10 -24
- package/dist/fondue-components107.js.map +1 -1
- package/dist/fondue-components108.js +67 -8
- package/dist/fondue-components108.js.map +1 -1
- package/dist/fondue-components109.js +14 -30
- package/dist/fondue-components109.js.map +1 -1
- package/dist/fondue-components11.js +35 -185
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components110.js +23 -4
- package/dist/fondue-components110.js.map +1 -1
- package/dist/fondue-components111.js +18 -4
- package/dist/fondue-components111.js.map +1 -1
- package/dist/fondue-components112.js +24 -4
- package/dist/fondue-components112.js.map +1 -1
- package/dist/fondue-components113.js +9 -14
- package/dist/fondue-components113.js.map +1 -1
- package/dist/fondue-components114.js +32 -16
- package/dist/fondue-components114.js.map +1 -1
- package/dist/fondue-components115.js +7 -111
- package/dist/fondue-components115.js.map +1 -1
- package/dist/fondue-components116.js +4 -12
- package/dist/fondue-components116.js.map +1 -1
- package/dist/fondue-components117.js +5 -17
- package/dist/fondue-components117.js.map +1 -1
- package/dist/fondue-components118.js +214 -10
- package/dist/fondue-components118.js.map +1 -1
- package/dist/fondue-components119.js +18 -16
- package/dist/fondue-components119.js.map +1 -1
- package/dist/fondue-components12.js +185 -7
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components120.js +15 -125
- package/dist/fondue-components120.js.map +1 -1
- package/dist/fondue-components121.js +151 -11
- package/dist/fondue-components121.js.map +1 -1
- package/dist/fondue-components122.js +45 -36
- package/dist/fondue-components122.js.map +1 -1
- package/dist/fondue-components123.js +16 -216
- package/dist/fondue-components123.js.map +1 -1
- package/dist/fondue-components124.js +14 -19
- package/dist/fondue-components124.js.map +1 -1
- package/dist/fondue-components125.js +16 -16
- package/dist/fondue-components125.js.map +1 -1
- package/dist/fondue-components126.js +107 -147
- package/dist/fondue-components126.js.map +1 -1
- package/dist/fondue-components127.js +12 -44
- package/dist/fondue-components127.js.map +1 -1
- package/dist/fondue-components128.js +17 -42
- package/dist/fondue-components128.js.map +1 -1
- package/dist/fondue-components129.js +16 -0
- package/dist/fondue-components129.js.map +1 -0
- package/dist/fondue-components13.js +8 -63
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components130.js +127 -41
- package/dist/fondue-components130.js.map +1 -1
- package/dist/fondue-components131.js +11 -170
- package/dist/fondue-components131.js.map +1 -1
- package/dist/fondue-components132.js +34 -58
- package/dist/fondue-components132.js.map +1 -1
- package/dist/fondue-components133.js +33 -9
- package/dist/fondue-components133.js.map +1 -1
- package/dist/fondue-components134.js +6 -256
- package/dist/fondue-components134.js.map +1 -1
- package/dist/fondue-components137.js +4 -4
- package/dist/fondue-components138.js +1 -1
- package/dist/fondue-components139.js +1 -1
- package/dist/fondue-components14.js +61 -35
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components140.js +2 -2
- package/dist/fondue-components141.js +3 -3
- package/dist/fondue-components142.js +2 -2
- package/dist/fondue-components143.js +168 -17
- package/dist/fondue-components143.js.map +1 -1
- package/dist/fondue-components144.js +60 -70
- package/dist/fondue-components144.js.map +1 -1
- package/dist/fondue-components145.js +7 -1350
- package/dist/fondue-components145.js.map +1 -1
- package/dist/fondue-components146.js +217 -902
- package/dist/fondue-components146.js.map +1 -1
- package/dist/fondue-components147.js +17 -196
- package/dist/fondue-components147.js.map +1 -1
- package/dist/fondue-components149.js +41 -39
- package/dist/fondue-components149.js.map +1 -1
- package/dist/fondue-components15.js +36 -121
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components150.js +40 -67
- package/dist/fondue-components150.js.map +1 -1
- package/dist/fondue-components151.js +20 -30
- package/dist/fondue-components151.js.map +1 -1
- package/dist/fondue-components152.js +40 -9
- package/dist/fondue-components152.js.map +1 -1
- package/dist/fondue-components153.js +67 -150
- package/dist/fondue-components153.js.map +1 -1
- package/dist/fondue-components154.js +1351 -107
- package/dist/fondue-components154.js.map +1 -1
- package/dist/fondue-components155.js +943 -18
- package/dist/fondue-components155.js.map +1 -1
- package/dist/fondue-components156.js +197 -15
- package/dist/fondue-components156.js.map +1 -1
- package/dist/fondue-components157.js +68 -29
- package/dist/fondue-components157.js.map +1 -1
- package/dist/fondue-components158.js +31 -13
- package/dist/fondue-components158.js.map +1 -1
- package/dist/fondue-components159.js +9 -7
- package/dist/fondue-components159.js.map +1 -1
- package/dist/fondue-components16.js +121 -36
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components160.js +156 -0
- package/dist/fondue-components160.js.map +1 -0
- package/dist/fondue-components161.js +111 -0
- package/dist/fondue-components161.js.map +1 -0
- package/dist/fondue-components162.js +19 -0
- package/dist/fondue-components162.js.map +1 -0
- package/dist/fondue-components163.js +32 -0
- package/dist/fondue-components163.js.map +1 -0
- package/dist/fondue-components164.js +16 -0
- package/dist/fondue-components164.js.map +1 -0
- package/dist/fondue-components165.js +19 -0
- package/dist/fondue-components165.js.map +1 -0
- package/dist/fondue-components166.js +10 -0
- package/dist/fondue-components166.js.map +1 -0
- package/dist/fondue-components17.js +30 -39
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +44 -41
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +42 -57
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +55 -41
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +39 -16
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +17 -43
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +46 -68
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +67 -71
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +72 -16
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +18 -77
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +75 -34
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +34 -53
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +55 -23
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +23 -55
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +52 -97
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +98 -31
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +31 -194
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +184 -134
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +143 -130
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +131 -30
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +29 -79
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +68 -110
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +121 -34
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +21 -19
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +36 -56
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +56 -20
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +20 -25
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +25 -7
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +7 -8
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +9 -41
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +41 -5
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +1 -1
- package/dist/fondue-components48.js +3 -11
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +25 -29
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +33 -54
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +20 -130
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +85 -20
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +13 -53
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +32 -8
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +54 -13
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +130 -16
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +20 -4
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +52 -17
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +7 -18
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +1 -1
- package/dist/fondue-components60.js +13 -44
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +16 -24
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +4 -22
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +18 -7
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +18 -4
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +43 -12
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +24 -4
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +22 -17
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +4 -8
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +4 -36
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +32 -65
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components70.js +12 -6
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +1 -1
- package/dist/fondue-components72.js +17 -12
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +10 -51
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +37 -44
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +7 -6
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +5 -6
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +13 -13
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +51 -27
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +42 -11
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +65 -51
- package/dist/fondue-components8.js.map +1 -1
- package/dist/fondue-components80.js +6 -5
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +6 -13
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +13 -48
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +27 -22
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +13 -629
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +4 -8
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +12 -12
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +47 -4
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +22 -24
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +628 -16
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +46 -173
- package/dist/fondue-components9.js.map +1 -1
- package/dist/fondue-components90.js +9 -20
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +13 -20
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +5 -20
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +24 -19
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +17 -19
- package/dist/fondue-components94.js.map +1 -1
- package/dist/fondue-components95.js +20 -8
- package/dist/fondue-components95.js.map +1 -1
- package/dist/fondue-components96.js +20 -11
- package/dist/fondue-components96.js.map +1 -1
- package/dist/fondue-components97.js +20 -11
- package/dist/fondue-components97.js.map +1 -1
- package/dist/fondue-components98.js +20 -7
- package/dist/fondue-components98.js.map +1 -1
- package/dist/fondue-components99.js +19 -13
- package/dist/fondue-components99.js.map +1 -1
- package/dist/index.d.ts +187 -15
- package/dist/style.css +1 -1
- package/package.json +9 -5
- package/dist/fondue-components148.js +0 -24
- package/dist/fondue-components148.js.map +0 -1
|
@@ -1,199 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
);
|
|
53
|
-
}
|
|
54
|
-
);
|
|
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(
|
|
63
|
-
({
|
|
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",
|
|
86
|
-
{
|
|
87
|
-
ref: y,
|
|
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
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
);
|
|
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",
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "@radix-ui/react-switch";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { useTranslation as f } from "./fondue-components43.js";
|
|
5
|
+
import e from "./fondue-components103.js";
|
|
6
|
+
const p = ({
|
|
7
|
+
value: o,
|
|
8
|
+
defaultValue: i,
|
|
9
|
+
size: r = "medium",
|
|
10
|
+
onChange: m,
|
|
11
|
+
"data-test-id": s = "fondue-switch",
|
|
12
|
+
"aria-label": c,
|
|
13
|
+
...d
|
|
14
|
+
}, h) => {
|
|
15
|
+
const { t: l } = f();
|
|
16
|
+
return /* @__PURE__ */ t(
|
|
17
|
+
a.Root,
|
|
122
18
|
{
|
|
123
|
-
ref:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
19
|
+
ref: h,
|
|
20
|
+
checked: o,
|
|
21
|
+
defaultChecked: i,
|
|
22
|
+
className: e.root,
|
|
23
|
+
onCheckedChange: m,
|
|
24
|
+
"aria-label": c ?? l("Switch_defaultLabel"),
|
|
25
|
+
"data-test-id": s,
|
|
26
|
+
"data-size": r,
|
|
27
|
+
...d,
|
|
28
|
+
children: /* @__PURE__ */ t(a.Thumb, { className: e.thumb })
|
|
129
29
|
}
|
|
130
|
-
)
|
|
131
|
-
);
|
|
132
|
-
|
|
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
|
-
};
|
|
30
|
+
);
|
|
31
|
+
}, u = n(p);
|
|
32
|
+
u.displayName = "Switch";
|
|
189
33
|
export {
|
|
190
|
-
|
|
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
|
|
34
|
+
u as Switch
|
|
198
35
|
};
|
|
199
36
|
//# sourceMappingURL=fondue-components33.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components33.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,QAAAC,IAAS,QAAQ,UAAAC,IAAW,UAAU,QAAAC,IAAS,OAAO,QAAAC,GAAQ,UAAAC,IAAW,IAAO,UAAAC,GAAU,GAAGC,EAAA,GAASC,MAAQ;AAC7G,UAAMC,IAAWC,EAAyB,IAAI,GACxC,CAACC,GAAuBC,CAAwB,IAAIC,EAAS,EAAK;AAExE,IAAAC,EAA8BL,GAAUD,CAAG;AAG3C,UAAMO,IAAqBX,MAAW,UAAUA,MAAW,QACrDY,IAAyBZ,MAAW,SAASA,MAAW;AAE9D,WAAAa,EAAU,MAAM;AACZ,YAAMC,IAAQT,EAAS;AACvB,UAAI,CAACS;AACD;AAGJ,YAAMC,IAAgB,MAAM;AACxB,cAAMC,IAASF,EAAM;AACrB,YAAI,CAACE;AACD;AAGJ,cAAMC,IAAaH,EAAM,aACnBI,IAAcF,EAAO;AAC3B,QAAAR,EAAyBS,IAAaC,CAAW;AAAA,MACrD;AAEA,MAAAH,EAAA;AAEA,YAAMI,IAAiB,IAAI,eAAeJ,CAAa;AACvD,aAAAI,EAAe,QAAQL,CAAK,GACxBA,EAAM,iBACNK,EAAe,QAAQL,EAAM,aA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,EACR,YAAYG;AAAA,EACZ,MAAMyB;AAAA,EACN,KAAKG;AAAA,EACL,SAASS;AACb;"}
|
|
1
|
+
{"version":3,"file":"fondue-components33.js","sources":["../src/components/Switch/Switch.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixSwitch from '@radix-ui/react-switch';\nimport { type FormEvent, type ForwardedRef, forwardRef } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport styles from './styles/switch.module.scss';\n\ntype SwitchProps = {\n id?: string;\n name?: string;\n /**\n * The size of the switch component.\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * The active value in the select component. This is used to control the select externally.\n * @default false\n */\n value?: boolean;\n /**\n * The default value of the select component. Used for uncontrolled usages.\n * @default false\n */\n defaultValue?: boolean;\n /**\n * Disables the select component.\n * @default false\n */\n disabled?: boolean;\n /**\n * Whether the switch is required.\n * @default false\n */\n required?: boolean;\n /**\n * Callback function that is called when the switch is toggled.\n * @param checked - The new checked state of the switch\n */\n onChange?: (checked: boolean) => void;\n /**\n * Event handler called when the checkbox is blurred\n * @param event - The event object\n */\n onBlur?: (event: FormEvent<HTMLButtonElement>) => void;\n /**\n * Event handler called when the checkbox is focused\n * @param event - The event object\n */\n onFocus?: (event: FormEvent<HTMLButtonElement>) => void;\n 'data-test-id'?: string;\n} & CommonAriaAttrs;\n\nconst SwitchComponent = (\n {\n value,\n defaultValue,\n size = 'medium',\n onChange,\n 'data-test-id': dataTestId = 'fondue-switch',\n 'aria-label': ariaLabel,\n ...props\n }: SwitchProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n const { t } = useTranslation();\n\n return (\n <RadixSwitch.Root\n ref={ref}\n checked={value}\n defaultChecked={defaultValue}\n className={styles.root}\n onCheckedChange={onChange}\n aria-label={ariaLabel ?? t('Switch_defaultLabel')}\n data-test-id={dataTestId}\n data-size={size}\n {...props}\n >\n <RadixSwitch.Thumb className={styles.thumb} />\n </RadixSwitch.Root>\n );\n};\n\nexport const Switch = forwardRef<HTMLButtonElement, SwitchProps>(SwitchComponent);\nSwitch.displayName = 'Switch';\n"],"names":["SwitchComponent","value","defaultValue","size","onChange","dataTestId","ariaLabel","props","ref","t","useTranslation","jsx","RadixSwitch","styles","Switch","forwardRef"],"mappings":";;;;;AAwDA,MAAMA,IAAkB,CACpB;AAAA,EACI,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,cAAcC;AAAA,EACd,GAAGC;AACP,GACAC,MACC;AACD,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,SACI,gBAAAC;AAAA,IAACC,EAAY;AAAA,IAAZ;AAAA,MACG,KAAAJ;AAAA,MACA,SAASP;AAAA,MACT,gBAAgBC;AAAA,MAChB,WAAWW,EAAO;AAAA,MAClB,iBAAiBT;AAAA,MACjB,cAAYE,KAAaG,EAAE,qBAAqB;AAAA,MAChD,gBAAcJ;AAAA,MACd,aAAWF;AAAA,MACV,GAAGI;AAAA,MAEJ,4BAACK,EAAY,OAAZ,EAAkB,WAAWC,EAAO,MAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGxD,GAEaC,IAASC,EAA2Cf,CAAe;AAChFc,EAAO,cAAc;"}
|
|
@@ -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-components59.js";
|
|
5
|
+
import { useTextTruncation as h } from "./fondue-components104.js";
|
|
6
|
+
import { useTranslation as j } from "./fondue-components43.js";
|
|
7
|
+
import { Box as M } from "./fondue-components5.js";
|
|
8
|
+
import { LoadingCircle as S } from "./fondue-components22.js";
|
|
9
|
+
import s from "./fondue-components105.js";
|
|
10
|
+
import { handleKeyDown as U, shouldIgnoreRowClick as q } from "./fondue-components106.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-components34.js.map
|