@frontify/fondue-components 28.0.0 → 29.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 +60 -56
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +1 -1
- package/dist/fondue-components100.js +22 -16
- package/dist/fondue-components100.js.map +1 -1
- package/dist/fondue-components101.js +34 -151
- package/dist/fondue-components101.js.map +1 -1
- package/dist/fondue-components102.js +10 -44
- package/dist/fondue-components102.js.map +1 -1
- package/dist/fondue-components103.js +67 -13
- package/dist/fondue-components103.js.map +1 -1
- package/dist/fondue-components104.js +13 -13
- package/dist/fondue-components105.js +26 -111
- package/dist/fondue-components105.js.map +1 -1
- package/dist/fondue-components106.js +18 -12
- package/dist/fondue-components106.js.map +1 -1
- package/dist/fondue-components107.js +25 -17
- package/dist/fondue-components107.js.map +1 -1
- package/dist/fondue-components108.js +8 -12
- package/dist/fondue-components108.js.map +1 -1
- package/dist/fondue-components109.js +30 -16
- package/dist/fondue-components109.js.map +1 -1
- package/dist/fondue-components11.js +3 -3
- package/dist/fondue-components110.js +7 -6
- package/dist/fondue-components110.js.map +1 -1
- package/dist/fondue-components111.js +4 -11
- package/dist/fondue-components111.js.map +1 -1
- package/dist/fondue-components112.js +4 -70
- package/dist/fondue-components112.js.map +1 -1
- package/dist/fondue-components113.js +16 -14
- package/dist/fondue-components113.js.map +1 -1
- package/dist/fondue-components114.js +14 -7
- package/dist/fondue-components114.js.map +1 -1
- package/dist/fondue-components115.js +14 -88
- package/dist/fondue-components115.js.map +1 -1
- package/dist/fondue-components116.js +108 -78
- package/dist/fondue-components116.js.map +1 -1
- package/dist/fondue-components117.js +12 -30
- package/dist/fondue-components117.js.map +1 -1
- package/dist/fondue-components118.js +17 -29
- package/dist/fondue-components118.js.map +1 -1
- package/dist/fondue-components119.js +16 -0
- package/dist/fondue-components119.js.map +1 -0
- package/dist/fondue-components12.js +3 -3
- package/dist/fondue-components120.js +127 -41
- package/dist/fondue-components120.js.map +1 -1
- package/dist/fondue-components121.js +11 -19
- package/dist/fondue-components121.js.map +1 -1
- package/dist/fondue-components122.js +33 -18
- package/dist/fondue-components122.js.map +1 -1
- package/dist/fondue-components123.js +215 -38
- package/dist/fondue-components123.js.map +1 -1
- package/dist/fondue-components124.js +18 -67
- package/dist/fondue-components124.js.map +1 -1
- package/dist/fondue-components125.js +16 -30
- package/dist/fondue-components125.js.map +1 -1
- package/dist/fondue-components126.js +151 -9
- package/dist/fondue-components126.js.map +1 -1
- package/dist/fondue-components127.js +44 -152
- package/dist/fondue-components127.js.map +1 -1
- package/dist/fondue-components128.js +168 -106
- package/dist/fondue-components128.js.map +1 -1
- package/dist/fondue-components129.js +61 -17
- package/dist/fondue-components129.js.map +1 -1
- package/dist/fondue-components13.js +61 -35
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components130.js +8 -15
- package/dist/fondue-components130.js.map +1 -1
- package/dist/fondue-components131.js +255 -28
- package/dist/fondue-components131.js.map +1 -1
- package/dist/fondue-components132.js +29 -13
- package/dist/fondue-components132.js.map +1 -1
- package/dist/fondue-components134.js +44 -0
- package/dist/fondue-components134.js.map +1 -0
- package/dist/fondue-components135.js +9 -0
- package/dist/fondue-components135.js.map +1 -0
- package/dist/fondue-components136.js +15 -0
- package/dist/fondue-components136.js.map +1 -0
- package/dist/fondue-components137.js +74 -0
- package/dist/fondue-components137.js.map +1 -0
- package/dist/fondue-components138.js +18 -0
- package/dist/fondue-components138.js.map +1 -0
- package/dist/fondue-components139.js +10 -0
- package/dist/fondue-components139.js.map +1 -0
- package/dist/fondue-components14.js +36 -121
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components140.js +92 -0
- package/dist/fondue-components140.js.map +1 -0
- package/dist/fondue-components141.js +84 -0
- package/dist/fondue-components141.js.map +1 -0
- package/dist/fondue-components142.js +34 -0
- package/dist/fondue-components142.js.map +1 -0
- package/dist/fondue-components143.js +22 -0
- package/dist/fondue-components143.js.map +1 -0
- package/dist/fondue-components144.js +73 -0
- package/dist/fondue-components144.js.map +1 -0
- package/dist/fondue-components145.js +1355 -0
- package/dist/fondue-components145.js.map +1 -0
- package/dist/fondue-components146.js +944 -0
- package/dist/fondue-components146.js.map +1 -0
- package/dist/fondue-components147.js +201 -0
- package/dist/fondue-components147.js.map +1 -0
- package/dist/fondue-components148.js +24 -0
- package/dist/fondue-components148.js.map +1 -0
- package/dist/fondue-components149.js +43 -0
- package/dist/fondue-components149.js.map +1 -0
- package/dist/fondue-components15.js +121 -36
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components150.js +71 -0
- package/dist/fondue-components150.js.map +1 -0
- package/dist/fondue-components151.js +34 -0
- package/dist/fondue-components151.js.map +1 -0
- package/dist/fondue-components152.js +12 -0
- package/dist/fondue-components152.js.map +1 -0
- package/dist/fondue-components153.js +156 -0
- package/dist/fondue-components153.js.map +1 -0
- package/dist/fondue-components154.js +111 -0
- package/dist/fondue-components154.js.map +1 -0
- package/dist/fondue-components155.js +19 -0
- package/dist/fondue-components155.js.map +1 -0
- package/dist/fondue-components156.js +19 -0
- package/dist/fondue-components156.js.map +1 -0
- package/dist/fondue-components157.js +32 -0
- package/dist/fondue-components157.js.map +1 -0
- package/dist/fondue-components158.js +16 -0
- package/dist/fondue-components158.js.map +1 -0
- package/dist/{fondue-components133.js → fondue-components159.js} +1 -1
- package/dist/{fondue-components133.js.map → fondue-components159.js.map} +1 -1
- package/dist/fondue-components16.js +30 -39
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +44 -41
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +42 -57
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +55 -41
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +39 -16
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +17 -43
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +42 -69
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +69 -17
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +71 -74
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +18 -36
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +72 -50
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +36 -23
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +50 -50
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +23 -100
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +50 -28
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +92 -188
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +31 -144
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +192 -129
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +141 -27
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +123 -71
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +28 -120
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +80 -35
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +119 -52
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +36 -20
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +3 -3
- package/dist/fondue-components40.js +56 -25
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +20 -7
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +25 -8
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +8 -41
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +8 -4
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +41 -5
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +3 -11
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +5 -32
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +12 -53
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +32 -131
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +53 -20
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +131 -53
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +20 -7
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +53 -13
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +7 -16
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +13 -5
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +17 -18
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +4 -18
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +18 -44
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +18 -24
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +1 -1
- package/dist/fondue-components60.js +43 -22
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +24 -4
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +22 -12
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +6 -4
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +4 -17
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +12 -10
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +4 -36
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +17 -6
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +10 -4
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +34 -10
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +1 -1
- package/dist/fondue-components70.js +6 -8
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +4 -12
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +11 -3
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +50 -23
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +44 -17
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +6 -20
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +6 -20
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +12 -19
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +24 -16
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +13 -19
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +5 -8
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +12 -10
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +47 -10
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +20 -4
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +628 -12
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +8 -22
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +13 -34
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +4 -10
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +23 -66
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +14 -12
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +5 -5
- package/dist/fondue-components90.js +20 -25
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +20 -19
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +20 -25
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +20 -9
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +19 -31
- package/dist/fondue-components94.js.map +1 -1
- package/dist/fondue-components95.js +8 -7
- package/dist/fondue-components95.js.map +1 -1
- package/dist/fondue-components96.js +10 -4
- package/dist/fondue-components96.js.map +1 -1
- package/dist/fondue-components97.js +10 -4
- package/dist/fondue-components97.js.map +1 -1
- package/dist/fondue-components98.js +6 -216
- package/dist/fondue-components98.js.map +1 -1
- package/dist/fondue-components99.js +12 -18
- package/dist/fondue-components99.js.map +1 -1
- package/dist/index.d.ts +100 -2
- package/dist/style.css +1 -1
- package/package.json +6 -4
|
@@ -1,199 +1,103 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
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
|
-
);
|
|
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(
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
import d from "./fondue-components97.js";
|
|
4
|
+
const b = c(
|
|
63
5
|
({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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",
|
|
6
|
+
"aria-label": t,
|
|
7
|
+
"data-test-id": a = "split-button",
|
|
8
|
+
children: o,
|
|
9
|
+
disabled: i = !1,
|
|
10
|
+
emphasis: e = "default",
|
|
11
|
+
size: n = "medium"
|
|
12
|
+
}, l) => /* @__PURE__ */ s(
|
|
13
|
+
"div",
|
|
122
14
|
{
|
|
123
|
-
ref:
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
"data-
|
|
127
|
-
"
|
|
128
|
-
|
|
15
|
+
ref: l,
|
|
16
|
+
role: "group",
|
|
17
|
+
"aria-label": t,
|
|
18
|
+
"data-test-id": a,
|
|
19
|
+
"data-component": "split-button",
|
|
20
|
+
"data-emphasis": e,
|
|
21
|
+
"data-size": n,
|
|
22
|
+
"data-disabled": i,
|
|
23
|
+
className: d.root,
|
|
24
|
+
children: o
|
|
129
25
|
}
|
|
130
26
|
)
|
|
131
27
|
);
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
({
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
);
|
|
159
|
-
}
|
|
28
|
+
b.displayName = "SplitButton.Root";
|
|
29
|
+
const p = c(
|
|
30
|
+
({
|
|
31
|
+
"aria-label": t,
|
|
32
|
+
"aria-describedby": a,
|
|
33
|
+
"data-test-id": o = "split-button-content",
|
|
34
|
+
children: i,
|
|
35
|
+
disabled: e = !1,
|
|
36
|
+
onPress: n,
|
|
37
|
+
title: l,
|
|
38
|
+
type: r = "button"
|
|
39
|
+
}, u) => /* @__PURE__ */ s(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
ref: u,
|
|
43
|
+
type: r,
|
|
44
|
+
disabled: e,
|
|
45
|
+
"aria-label": t,
|
|
46
|
+
"aria-describedby": a,
|
|
47
|
+
title: l,
|
|
48
|
+
"data-test-id": o,
|
|
49
|
+
className: d.content,
|
|
50
|
+
onClick: n,
|
|
51
|
+
children: i
|
|
52
|
+
}
|
|
53
|
+
)
|
|
160
54
|
);
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
55
|
+
p.displayName = "SplitButton.Content";
|
|
56
|
+
const m = ({
|
|
57
|
+
"aria-label": t,
|
|
58
|
+
"data-test-id": a = "split-button-action",
|
|
59
|
+
rotateIcon: o = !0,
|
|
60
|
+
children: i
|
|
61
|
+
}) => /* @__PURE__ */ s("div", { "aria-label": t, "data-test-id": a, "data-rotate-icon": o, className: d.action, children: i });
|
|
62
|
+
m.displayName = "SplitButton.Action";
|
|
63
|
+
const B = c(
|
|
64
|
+
({
|
|
65
|
+
"aria-label": t,
|
|
66
|
+
"aria-describedby": a,
|
|
67
|
+
"data-test-id": o = "split-button-action-button",
|
|
68
|
+
children: i,
|
|
69
|
+
disabled: e = !1,
|
|
70
|
+
title: n,
|
|
71
|
+
type: l = "button",
|
|
72
|
+
...r
|
|
73
|
+
}, u) => /* @__PURE__ */ s(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
ref: u,
|
|
77
|
+
type: l,
|
|
78
|
+
disabled: e,
|
|
79
|
+
"aria-label": t,
|
|
80
|
+
"aria-describedby": a,
|
|
81
|
+
title: n,
|
|
82
|
+
"data-test-id": o,
|
|
83
|
+
className: d.actionButton,
|
|
84
|
+
...r,
|
|
85
|
+
children: i
|
|
86
|
+
}
|
|
87
|
+
)
|
|
178
88
|
);
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
Root:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
Body: I,
|
|
186
|
-
Row: B,
|
|
187
|
-
RowCell: A
|
|
89
|
+
B.displayName = "SplitButton.ActionButton";
|
|
90
|
+
const N = {
|
|
91
|
+
Root: b,
|
|
92
|
+
Content: p,
|
|
93
|
+
Action: m,
|
|
94
|
+
ActionButton: B
|
|
188
95
|
};
|
|
189
96
|
export {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
x as TableRoot,
|
|
196
|
-
B as TableRow,
|
|
197
|
-
A as TableRowCell
|
|
97
|
+
N as SplitButton,
|
|
98
|
+
m as SplitButtonAction,
|
|
99
|
+
B as SplitButtonActionButton,
|
|
100
|
+
p as SplitButtonContent,
|
|
101
|
+
b as SplitButtonRoot
|
|
198
102
|
};
|
|
199
103
|
//# sourceMappingURL=fondue-components31.js.map
|
|
@@ -1 +1 @@
|
|
|
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,QAAAC,IAAS,QAAQ,UAAAC,IAAW,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AgB;AAAA,QAC3C,gBAAcqC;AAAA,QAEb,UAAAzD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGb;AACJ;AACAqD,EAAS,cAAc;AAqBhB,MAAMS,IAAepE;AAAA,EACxB,CAAC,EAAE,SAAAsC,GAAS,UAAAL,GAAU,OAAAC,IAAQ,QAAQ,UAAA5B,GAAU,cAAcuB,EAAA,GAAarB,MAAsB;AAC7F,UAAMqC,IAAUnC,EAA6B,IAAI;AACjD,WAAAI,EAAkC+B,GAASrC,CAAG,GAE9CsC,EAAkBD,CAAO,GAGrB,gBAAArB;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAKqB;AAAA,QACL,WAAWpB,EAAO;AAAA,QAClB,SAAAa;AAAA,QACA,cAAYJ;AAAA,QACZ,iBAAeD;AAAA,QACf,cAAYJ;AAAA,QAEX,UAAAvB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGb;AACJ;AACA8D,EAAa,cAAc;AAEpB,MAAMC,KAAQ;AAAA,EACjB,MAAMtE;AAAA,EACN,SAAS4B;AAAA,EACT,QAAQC;AAAA,EACR,YAAYG;AAAA,EACZ,MAAMyB;AAAA,EACN,KAAKG;AAAA,EACL,SAASS;AACb;"}
|
|
1
|
+
{"version":3,"file":"fondue-components31.js","sources":["../src/components/SplitButton/SplitButton.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef, type MouseEvent, type ReactNode } from 'react';\n\nimport styles from './styles/splitButton.module.scss';\n\ntype ButtonSize = 'small' | 'medium' | 'large';\n\ntype ButtonEmphasis = 'default' | 'weak' | 'strong';\n\nexport type SplitButtonProps = {\n /**\n * @default 'default'\n */\n emphasis?: ButtonEmphasis;\n /**\n * @default 'medium'\n */\n size?: ButtonSize;\n /**\n * @default false\n */\n disabled?: boolean;\n /**\n * Accessible label for the button group\n */\n 'aria-label'?: string;\n /**\n * Test ID for the root element\n */\n 'data-test-id'?: string;\n children: ReactNode;\n};\n\nexport type SplitButtonContentProps = {\n /**\n * Button type\n * @default 'button'\n */\n type?: 'button' | 'submit' | 'reset';\n /**\n * Whether the button is disabled\n * @default false\n */\n disabled?: boolean;\n /**\n * Click handler\n */\n onPress?: (event?: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Accessible label\n */\n 'aria-label'?: string;\n /**\n * Accessible description\n */\n 'aria-describedby'?: string;\n /**\n * Test ID for the content section\n */\n 'data-test-id'?: string;\n /**\n * Button title\n */\n title?: string;\n children: ReactNode;\n};\n\nexport type SplitButtonActionProps = {\n /**\n * Accessible label\n */\n 'aria-label'?: string;\n /**\n * Test ID for the action slot\n */\n 'data-test-id'?: string;\n /**\n * Whether to rotate the icon 180 degrees when active (typically for caret icons)\n * @default true\n */\n rotateIcon?: boolean;\n children: ReactNode;\n};\n\nexport type SplitButtonActionButtonProps = {\n /**\n * Button type\n * @default 'button'\n */\n type?: 'button' | 'submit' | 'reset';\n /**\n * Whether the button is disabled\n * @default false\n */\n disabled?: boolean;\n /**\n * Accessible label\n */\n 'aria-label'?: string;\n /**\n * Accessible description\n */\n 'aria-describedby'?: string;\n /**\n * Test ID for the action button\n */\n 'data-test-id'?: string;\n /**\n * Button title\n */\n title?: string;\n children: ReactNode;\n};\n\nexport const SplitButtonRoot = forwardRef<HTMLDivElement, SplitButtonProps>(\n (\n {\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'split-button',\n children,\n disabled = false,\n emphasis = 'default',\n size = 'medium',\n }: SplitButtonProps,\n ref: ForwardedRef<HTMLDivElement>,\n ) => {\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={ariaLabel}\n data-test-id={dataTestId}\n data-component=\"split-button\"\n data-emphasis={emphasis}\n data-size={size}\n data-disabled={disabled}\n className={styles.root}\n >\n {children}\n </div>\n );\n },\n);\nSplitButtonRoot.displayName = 'SplitButton.Root';\n\nexport const SplitButtonContent = forwardRef<HTMLButtonElement, SplitButtonContentProps>(\n (\n {\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedby,\n 'data-test-id': dataTestId = 'split-button-content',\n children,\n disabled = false,\n onPress,\n title,\n type = 'button',\n }: SplitButtonContentProps,\n ref: ForwardedRef<HTMLButtonElement>,\n ) => {\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n title={title}\n data-test-id={dataTestId}\n className={styles.content}\n onClick={onPress}\n >\n {children}\n </button>\n );\n },\n);\nSplitButtonContent.displayName = 'SplitButton.Content';\n\nexport const SplitButtonAction = ({\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'split-button-action',\n rotateIcon = true,\n children,\n}: SplitButtonActionProps) => {\n return (\n <div aria-label={ariaLabel} data-test-id={dataTestId} data-rotate-icon={rotateIcon} className={styles.action}>\n {children}\n </div>\n );\n};\nSplitButtonAction.displayName = 'SplitButton.Action';\n\nexport const SplitButtonActionButton = forwardRef<HTMLButtonElement, SplitButtonActionButtonProps>(\n (\n {\n 'aria-label': ariaLabel,\n 'aria-describedby': ariaDescribedby,\n 'data-test-id': dataTestId = 'split-button-action-button',\n children,\n disabled = false,\n title,\n type = 'button',\n ...props\n },\n ref,\n ) => {\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n title={title}\n data-test-id={dataTestId}\n className={styles.actionButton}\n {...props}\n >\n {children}\n </button>\n );\n },\n);\nSplitButtonActionButton.displayName = 'SplitButton.ActionButton';\n\nexport const SplitButton = {\n Root: SplitButtonRoot,\n Content: SplitButtonContent,\n Action: SplitButtonAction,\n ActionButton: SplitButtonActionButton,\n};\n"],"names":["SplitButtonRoot","forwardRef","ariaLabel","dataTestId","children","disabled","emphasis","size","ref","jsx","styles","SplitButtonContent","ariaDescribedby","onPress","title","type","SplitButtonAction","rotateIcon","SplitButtonActionButton","props","SplitButton"],"mappings":";;;AAmHO,MAAMA,IAAkBC;AAAA,EAC3B,CACI;AAAA,IACI,c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nC,CACI;AAAA,IACI,cAAcC;AAAA,IACd,oBAAoBU;AAAA,IACpB,gBAAgBT,IAAa;AAAA,IAC7B,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,OAAAS;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,GAAGI;AAAA,EAAA,GAEPX,MAGI,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAAD;AAAA,MACA,MAAAO;AAAA,MACA,UAAAV;AAAA,MACA,cAAYH;AAAA,MACZ,oBAAkBU;AAAA,MAClB,OAAAE;AAAA,MACA,gBAAcX;AAAA,MACd,WAAWO,EAAO;AAAA,MACjB,GAAGS;AAAA,MAEH,UAAAf;AAAA,IAAA;AAAA,EAAA;AAIjB;AACAc,EAAwB,cAAc;AAE/B,MAAME,IAAc;AAAA,EACvB,MAAMpB;AAAA,EACN,SAASW;AAAA,EACT,QAAQK;AAAA,EACR,cAAcE;AAClB;"}
|
|
@@ -1,149 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, v) => {
|
|
19
|
-
const [C, d] = P(!1);
|
|
20
|
-
let r = null;
|
|
21
|
-
const g = H.map(o, (f) => I(f) && f.type === N ? (r = f.props.children, null) : f), $ = {
|
|
22
|
-
"data-addable": !!m,
|
|
23
|
-
"data-component": "tag",
|
|
24
|
-
"data-disabled": a,
|
|
25
|
-
"data-dismissable": !!i,
|
|
26
|
-
"data-emphasis": c,
|
|
27
|
-
"data-size": p,
|
|
28
|
-
"data-variant": y,
|
|
29
|
-
className: s.root
|
|
30
|
-
};
|
|
31
|
-
return /* @__PURE__ */ h("div", { ...$, children: [
|
|
32
|
-
/* @__PURE__ */ t(
|
|
33
|
-
z,
|
|
34
|
-
{
|
|
35
|
-
ref: v,
|
|
36
|
-
"aria-label": e || l,
|
|
37
|
-
disabled: a,
|
|
38
|
-
hoverContent: r,
|
|
39
|
-
isHover: C,
|
|
40
|
-
onClick: u,
|
|
41
|
-
onMouseEnter: () => d(!0),
|
|
42
|
-
onMouseLeave: () => d(!1),
|
|
43
|
-
title: l,
|
|
44
|
-
"data-test-id": n,
|
|
45
|
-
children: g
|
|
46
|
-
}
|
|
47
|
-
),
|
|
48
|
-
/* @__PURE__ */ t(
|
|
49
|
-
R,
|
|
50
|
-
{
|
|
51
|
-
"aria-label": e || l,
|
|
52
|
-
disabled: a,
|
|
53
|
-
onAddClick: m,
|
|
54
|
-
onDismiss: i
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
] });
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
S.displayName = "Tag";
|
|
61
|
-
const z = x(
|
|
62
|
-
({
|
|
63
|
-
"aria-label": e,
|
|
64
|
-
"data-test-id": n,
|
|
65
|
-
children: o,
|
|
66
|
-
disabled: a = !1,
|
|
67
|
-
hoverContent: c,
|
|
68
|
-
isHover: m = !1,
|
|
69
|
-
onClick: u,
|
|
70
|
-
onMouseEnter: i,
|
|
71
|
-
onMouseLeave: p,
|
|
72
|
-
title: l
|
|
73
|
-
}, y) => {
|
|
74
|
-
let v = 0;
|
|
75
|
-
const C = H.map(o, (r) => {
|
|
76
|
-
if (I(r) && r.type === T) {
|
|
77
|
-
const g = v++;
|
|
78
|
-
return /* @__PURE__ */ t("div", { className: s.secondaryContent, children: r.props.children }, `secondary-${g}`);
|
|
79
|
-
}
|
|
80
|
-
return r;
|
|
81
|
-
}), d = c ? /* @__PURE__ */ h("div", { "data-hover": m, children: [
|
|
82
|
-
/* @__PURE__ */ t("div", { children: c }),
|
|
83
|
-
/* @__PURE__ */ t("div", { children: C })
|
|
84
|
-
] }) : C;
|
|
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",
|
|
102
|
-
{
|
|
103
|
-
ref: y,
|
|
104
|
-
className: s.mainContent,
|
|
105
|
-
onMouseEnter: i,
|
|
106
|
-
onMouseLeave: p,
|
|
107
|
-
"data-test-id": n,
|
|
108
|
-
children: d
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
z.displayName = "TagMainContent";
|
|
114
|
-
const R = ({ "aria-label": e, disabled: n, onAddClick: o, onDismiss: a }) => /* @__PURE__ */ h(b, { children: [
|
|
115
|
-
o && /* @__PURE__ */ t(
|
|
116
|
-
"button",
|
|
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-components42.js";
|
|
5
|
+
import e from "./fondue-components98.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,
|
|
117
18
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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 })
|
|
124
29
|
}
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
type: "button",
|
|
130
|
-
"aria-label": `Dismiss ${e || ""}`,
|
|
131
|
-
className: s.actionButton,
|
|
132
|
-
disabled: n,
|
|
133
|
-
onClick: a,
|
|
134
|
-
children: /* @__PURE__ */ t(M, { size: "16" })
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
] }), N = ({ children: e }) => /* @__PURE__ */ t(b, { children: e });
|
|
138
|
-
N.displayName = "Tag.HoverContent";
|
|
139
|
-
const T = ({ children: e }) => /* @__PURE__ */ t(b, { children: e });
|
|
140
|
-
T.displayName = "Tag.SecondaryContent";
|
|
141
|
-
const B = S;
|
|
142
|
-
B.HoverContent = N;
|
|
143
|
-
B.SecondaryContent = T;
|
|
30
|
+
);
|
|
31
|
+
}, u = n(p);
|
|
32
|
+
u.displayName = "Switch";
|
|
144
33
|
export {
|
|
145
|
-
|
|
146
|
-
N as TagHoverContent,
|
|
147
|
-
T as TagSecondaryContent
|
|
34
|
+
u as Switch
|
|
148
35
|
};
|
|
149
36
|
//# sourceMappingURL=fondue-components32.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components32.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,gBAAg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ET,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-components32.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;"}
|