@frontify/fondue-components 27.0.1 → 28.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fondue-components.js +55 -53
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +1 -1
- package/dist/fondue-components100.js +17 -6
- package/dist/fondue-components100.js.map +1 -1
- package/dist/fondue-components101.js +150 -11
- package/dist/fondue-components101.js.map +1 -1
- package/dist/fondue-components102.js +44 -70
- package/dist/fondue-components102.js.map +1 -1
- package/dist/fondue-components103.js +14 -15
- package/dist/fondue-components103.js.map +1 -1
- package/dist/fondue-components104.js +15 -7
- package/dist/fondue-components104.js.map +1 -1
- package/dist/fondue-components105.js +107 -85
- package/dist/fondue-components105.js.map +1 -1
- package/dist/fondue-components106.js +11 -79
- package/dist/fondue-components106.js.map +1 -1
- package/dist/fondue-components107.js +17 -31
- package/dist/fondue-components107.js.map +1 -1
- package/dist/fondue-components108.js +11 -19
- package/dist/fondue-components108.js.map +1 -1
- package/dist/fondue-components109.js +16 -39
- package/dist/fondue-components109.js.map +1 -1
- package/dist/fondue-components11.js +3 -3
- package/dist/fondue-components110.js +9 -0
- package/dist/fondue-components110.js.map +1 -0
- package/dist/fondue-components111.js +15 -0
- package/dist/fondue-components111.js.map +1 -0
- package/dist/fondue-components112.js +74 -0
- package/dist/fondue-components112.js.map +1 -0
- package/dist/fondue-components113.js +18 -0
- package/dist/fondue-components113.js.map +1 -0
- package/dist/fondue-components114.js +10 -0
- package/dist/fondue-components114.js.map +1 -0
- package/dist/fondue-components115.js +92 -0
- package/dist/fondue-components115.js.map +1 -0
- package/dist/fondue-components116.js +84 -0
- package/dist/fondue-components116.js.map +1 -0
- package/dist/fondue-components117.js +34 -0
- package/dist/fondue-components117.js.map +1 -0
- package/dist/fondue-components118.js +32 -0
- package/dist/fondue-components118.js.map +1 -0
- package/dist/fondue-components12.js +7 -37
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components120.js +44 -0
- package/dist/fondue-components120.js.map +1 -0
- package/dist/fondue-components121.js +22 -0
- package/dist/fondue-components121.js.map +1 -0
- package/dist/fondue-components122.js +24 -0
- package/dist/fondue-components122.js.map +1 -0
- package/dist/fondue-components123.js +43 -0
- package/dist/fondue-components123.js.map +1 -0
- package/dist/fondue-components124.js +71 -0
- package/dist/fondue-components124.js.map +1 -0
- package/dist/fondue-components125.js +34 -0
- package/dist/fondue-components125.js.map +1 -0
- package/dist/fondue-components126.js +12 -0
- package/dist/fondue-components126.js.map +1 -0
- package/dist/fondue-components127.js +156 -0
- package/dist/fondue-components127.js.map +1 -0
- package/dist/fondue-components128.js +111 -0
- package/dist/fondue-components128.js.map +1 -0
- package/dist/fondue-components129.js +19 -0
- package/dist/fondue-components129.js.map +1 -0
- package/dist/fondue-components13.js +36 -121
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components130.js +19 -0
- package/dist/fondue-components130.js.map +1 -0
- package/dist/fondue-components131.js +32 -0
- package/dist/fondue-components131.js.map +1 -0
- package/dist/fondue-components132.js +16 -0
- package/dist/fondue-components132.js.map +1 -0
- package/dist/fondue-components133.js +10 -0
- package/dist/fondue-components133.js.map +1 -0
- package/dist/fondue-components14.js +121 -36
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +30 -39
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +44 -41
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +42 -57
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +55 -41
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +39 -16
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +17 -43
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +42 -69
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +72 -16
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +18 -77
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +75 -34
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +34 -53
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +55 -23
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +23 -55
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +52 -97
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +98 -31
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +31 -194
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +184 -134
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +143 -130
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +131 -30
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +29 -78
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +67 -110
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +121 -34
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +36 -56
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +56 -20
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +20 -23
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +3 -3
- package/dist/fondue-components40.js +25 -7
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +7 -8
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +9 -41
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +41 -5
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +1 -1
- package/dist/fondue-components45.js +3 -11
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +13 -32
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +32 -54
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +48 -125
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +130 -20
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +21 -53
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +53 -8
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +8 -13
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +13 -17
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +16 -4
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +5 -18
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +18 -19
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +18 -4
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +43 -12
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +24 -4
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +1 -1
- package/dist/fondue-components60.js +22 -17
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +4 -10
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +11 -35
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +4 -6
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +17 -4
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +10 -12
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +35 -7
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +6 -12
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +1 -1
- package/dist/fondue-components69.js +12 -24
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +1 -1
- package/dist/fondue-components70.js +8 -16
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +13 -20
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +5 -20
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +24 -19
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +17 -20
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +20 -19
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +20 -8
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +20 -11
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +20 -11
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +19 -7
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +8 -13
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +10 -22
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +11 -34
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +6 -10
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +12 -67
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +22 -14
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +34 -25
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +8 -16
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +67 -24
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +14 -8
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +5 -5
- package/dist/fondue-components90.js +24 -25
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +18 -6
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +24 -4
- package/dist/fondue-components92.js.map +1 -1
- package/dist/fondue-components93.js +8 -4
- package/dist/fondue-components93.js.map +1 -1
- package/dist/fondue-components94.js +30 -16
- package/dist/fondue-components94.js.map +1 -1
- package/dist/fondue-components95.js +6 -216
- package/dist/fondue-components95.js.map +1 -1
- package/dist/fondue-components96.js +4 -18
- package/dist/fondue-components96.js.map +1 -1
- package/dist/fondue-components97.js +4 -16
- package/dist/fondue-components97.js.map +1 -1
- package/dist/fondue-components98.js +188 -122
- package/dist/fondue-components98.js.map +1 -1
- package/dist/fondue-components99.js +18 -44
- package/dist/fondue-components99.js.map +1 -1
- package/dist/index.d.ts +101 -24
- package/dist/style.css +1 -1
- package/package.json +5 -3
|
@@ -1,36 +1,103 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}, h) => {
|
|
15
|
-
const { t: l } = f();
|
|
16
|
-
return /* @__PURE__ */ t(
|
|
17
|
-
a.Root,
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c } from "react";
|
|
3
|
+
import d from "./fondue-components82.js";
|
|
4
|
+
const b = c(
|
|
5
|
+
({
|
|
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",
|
|
18
14
|
{
|
|
19
|
-
ref:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"data-
|
|
26
|
-
"data-
|
|
27
|
-
|
|
28
|
-
children:
|
|
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
|
|
29
25
|
}
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
)
|
|
27
|
+
);
|
|
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
|
+
)
|
|
54
|
+
);
|
|
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
|
+
)
|
|
88
|
+
);
|
|
89
|
+
B.displayName = "SplitButton.ActionButton";
|
|
90
|
+
const N = {
|
|
91
|
+
Root: b,
|
|
92
|
+
Content: p,
|
|
93
|
+
Action: m,
|
|
94
|
+
ActionButton: B
|
|
95
|
+
};
|
|
33
96
|
export {
|
|
34
|
-
|
|
97
|
+
N as SplitButton,
|
|
98
|
+
m as SplitButtonAction,
|
|
99
|
+
B as SplitButtonActionButton,
|
|
100
|
+
p as SplitButtonContent,
|
|
101
|
+
b as SplitButtonRoot
|
|
35
102
|
};
|
|
36
103
|
//# sourceMappingURL=fondue-components29.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components29.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components29.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,cAAcC;AAAA,IACd,gBAAgB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C;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;"}
|
|
@@ -2,7 +2,7 @@ import { jsx as n, jsxs as m } from "react/jsx-runtime";
|
|
|
2
2
|
import { IconCaretDown as C } from "@frontify/fondue-icons";
|
|
3
3
|
import * as s from "@radix-ui/react-accordion";
|
|
4
4
|
import { forwardRef as y, useMemo as R, Children as w, isValidElement as T } from "react";
|
|
5
|
-
import d from "./fondue-
|
|
5
|
+
import d from "./fondue-components39.js";
|
|
6
6
|
const g = ({
|
|
7
7
|
"data-test-id": o = "fondue-accordion",
|
|
8
8
|
border: e = !0,
|
|
@@ -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-components40.js";
|
|
5
|
+
import e from "./fondue-components83.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-components30.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components30.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,IA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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-components30.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;"}
|