@traefik-labs/faency 13.5.0 → 13.7.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/components/AriaTable/AriaTable.cjs +3 -5
- package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
- package/dist/components/AriaTable/AriaTable.constants.cjs +5 -0
- package/dist/components/AriaTable/AriaTable.constants.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.constants.js +5 -0
- package/dist/components/AriaTable/AriaTable.constants.js.map +1 -0
- package/dist/components/AriaTable/AriaTable.js +7 -9
- package/dist/components/AriaTable/AriaTable.js.map +1 -1
- package/dist/components/AriaTable/AriaTable.vanilla.cjs +194 -0
- package/dist/components/AriaTable/AriaTable.vanilla.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.cjs +28 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.js +17 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.js.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.js +185 -0
- package/dist/components/AriaTable/AriaTable.vanilla.js.map +1 -0
- package/dist/components/Badge/Badge.vanilla.cjs +2 -1
- package/dist/components/Badge/Badge.vanilla.cjs.map +1 -1
- package/dist/components/Badge/Badge.vanilla.js +2 -1
- package/dist/components/Badge/Badge.vanilla.js.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.cjs +2 -1
- package/dist/components/Blockquote/Blockquote.vanilla.cjs.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.js +2 -1
- package/dist/components/Blockquote/Blockquote.vanilla.js.map +1 -1
- package/dist/components/Box/Box.vanilla.cjs +2 -1
- package/dist/components/Box/Box.vanilla.cjs.map +1 -1
- package/dist/components/Box/Box.vanilla.js +2 -1
- package/dist/components/Box/Box.vanilla.js.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.cjs +2 -1
- package/dist/components/Bubble/Bubble.vanilla.cjs.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.js +2 -1
- package/dist/components/Bubble/Bubble.vanilla.js.map +1 -1
- package/dist/components/Button/Button.vanilla.cjs +2 -1
- package/dist/components/Button/Button.vanilla.cjs.map +1 -1
- package/dist/components/Button/Button.vanilla.js +2 -1
- package/dist/components/Button/Button.vanilla.js.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs +5 -4
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js +5 -4
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js.map +1 -1
- package/dist/components/Card/Card.vanilla.cjs +2 -1
- package/dist/components/Card/Card.vanilla.cjs.map +1 -1
- package/dist/components/Card/Card.vanilla.js +2 -1
- package/dist/components/Card/Card.vanilla.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +3 -11
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.js +4 -12
- package/dist/components/CodeBlock/CodeBlock.vanilla.js.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.cjs +2 -2
- package/dist/components/Combobox/Combobox.vanilla.cjs.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.js +2 -2
- package/dist/components/Combobox/Combobox.vanilla.js.map +1 -1
- package/dist/components/Container/Container.vanilla.cjs +2 -1
- package/dist/components/Container/Container.vanilla.cjs.map +1 -1
- package/dist/components/Container/Container.vanilla.js +2 -1
- package/dist/components/Container/Container.vanilla.js.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.cjs +2 -1
- package/dist/components/Elevation/Elevation.vanilla.cjs.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.css.cjs.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.css.js.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.js +2 -1
- package/dist/components/Elevation/Elevation.vanilla.js.map +1 -1
- package/dist/components/Field/Field.js +5 -5
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/Field.vanilla.js +5 -5
- package/dist/components/Field/Field.vanilla.js.map +1 -1
- package/dist/components/Flex/Flex.vanilla.cjs +2 -1
- package/dist/components/Flex/Flex.vanilla.cjs.map +1 -1
- package/dist/components/Flex/Flex.vanilla.js +2 -1
- package/dist/components/Flex/Flex.vanilla.js.map +1 -1
- package/dist/components/Grid/Grid.vanilla.cjs +2 -1
- package/dist/components/Grid/Grid.vanilla.cjs.map +1 -1
- package/dist/components/Grid/Grid.vanilla.js +2 -1
- package/dist/components/Grid/Grid.vanilla.js.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.cjs +2 -1
- package/dist/components/IconButton/IconButton.vanilla.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.js +2 -1
- package/dist/components/IconButton/IconButton.vanilla.js.map +1 -1
- package/dist/components/Image/Image.vanilla.cjs +2 -1
- package/dist/components/Image/Image.vanilla.cjs.map +1 -1
- package/dist/components/Image/Image.vanilla.js +2 -1
- package/dist/components/Image/Image.vanilla.js.map +1 -1
- package/dist/components/Input/Input.vanilla.cjs +2 -1
- package/dist/components/Input/Input.vanilla.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.js +2 -1
- package/dist/components/Input/Input.vanilla.js.map +1 -1
- package/dist/components/Label/Label.vanilla.cjs +2 -1
- package/dist/components/Label/Label.vanilla.cjs.map +1 -1
- package/dist/components/Label/Label.vanilla.js +2 -1
- package/dist/components/Label/Label.vanilla.js.map +1 -1
- package/dist/components/List/List.vanilla.cjs +128 -0
- package/dist/components/List/List.vanilla.cjs.map +1 -0
- package/dist/components/List/List.vanilla.css.cjs +30 -0
- package/dist/components/List/List.vanilla.css.cjs.map +1 -0
- package/dist/components/List/List.vanilla.css.js +25 -0
- package/dist/components/List/List.vanilla.css.js.map +1 -0
- package/dist/components/List/List.vanilla.js +124 -0
- package/dist/components/List/List.vanilla.js.map +1 -0
- package/dist/components/Meter/Meter.vanilla.cjs +2 -1
- package/dist/components/Meter/Meter.vanilla.cjs.map +1 -1
- package/dist/components/Meter/Meter.vanilla.js +2 -1
- package/dist/components/Meter/Meter.vanilla.js.map +1 -1
- package/dist/components/Panel/Panel.vanilla.cjs +2 -1
- package/dist/components/Panel/Panel.vanilla.cjs.map +1 -1
- package/dist/components/Panel/Panel.vanilla.js +2 -1
- package/dist/components/Panel/Panel.vanilla.js.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.cjs +2 -1
- package/dist/components/Paragraph/Paragraph.vanilla.cjs.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.js +2 -1
- package/dist/components/Paragraph/Paragraph.vanilla.js.map +1 -1
- package/dist/components/RowLink/RowLink.cjs +12 -63
- package/dist/components/RowLink/RowLink.cjs.map +1 -1
- package/dist/components/RowLink/RowLink.constants.cjs +7 -0
- package/dist/components/RowLink/RowLink.constants.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.constants.js +6 -0
- package/dist/components/RowLink/RowLink.constants.js.map +1 -0
- package/dist/components/RowLink/RowLink.js +6 -58
- package/dist/components/RowLink/RowLink.js.map +1 -1
- package/dist/components/RowLink/RowLink.utils.cjs +87 -0
- package/dist/components/RowLink/RowLink.utils.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.utils.js +83 -0
- package/dist/components/RowLink/RowLink.utils.js.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.cjs +21 -0
- package/dist/components/RowLink/RowLink.vanilla.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.css.cjs +10 -0
- package/dist/components/RowLink/RowLink.vanilla.css.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.css.js +8 -0
- package/dist/components/RowLink/RowLink.vanilla.css.js.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.js +19 -0
- package/dist/components/RowLink/RowLink.vanilla.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.cjs +2 -1
- package/dist/components/Skeleton/Skeleton.vanilla.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.js +2 -1
- package/dist/components/Skeleton/Skeleton.vanilla.js.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.cjs +2 -1
- package/dist/components/Spinner/Spinner.vanilla.cjs.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.js +2 -1
- package/dist/components/Spinner/Spinner.vanilla.js.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs +4 -3
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.js +6 -5
- package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -1
- package/dist/components/Table/ExpandToggle.vanilla.cjs +30 -0
- package/dist/components/Table/ExpandToggle.vanilla.cjs.map +1 -0
- package/dist/components/Table/ExpandToggle.vanilla.js +27 -0
- package/dist/components/Table/ExpandToggle.vanilla.js.map +1 -0
- package/dist/components/Table/SortButton.vanilla.cjs +38 -0
- package/dist/components/Table/SortButton.vanilla.cjs.map +1 -0
- package/dist/components/Table/SortButton.vanilla.js +35 -0
- package/dist/components/Table/SortButton.vanilla.js.map +1 -0
- package/dist/components/Table/Table.cjs +3 -5
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.js +5 -7
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.vanilla.cjs +142 -0
- package/dist/components/Table/Table.vanilla.cjs.map +1 -0
- package/dist/components/Table/Table.vanilla.css.cjs +178 -0
- package/dist/components/Table/Table.vanilla.css.cjs.map +1 -0
- package/dist/components/Table/Table.vanilla.css.js +161 -0
- package/dist/components/Table/Table.vanilla.css.js.map +1 -0
- package/dist/components/Table/Table.vanilla.js +133 -0
- package/dist/components/Table/Table.vanilla.js.map +1 -0
- package/dist/components/Table/useTableSort.cjs +60 -0
- package/dist/components/Table/useTableSort.cjs.map +1 -0
- package/dist/components/Table/useTableSort.js +59 -0
- package/dist/components/Table/useTableSort.js.map +1 -0
- package/dist/components/Text/Text.vanilla.cjs +2 -1
- package/dist/components/Text/Text.vanilla.cjs.map +1 -1
- package/dist/components/Text/Text.vanilla.js +2 -1
- package/dist/components/Text/Text.vanilla.js.map +1 -1
- package/dist/components/TextField/TextField.vanilla.js +2 -2
- package/dist/components/TextField/TextField.vanilla.js.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.cjs +2 -1
- package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.js +2 -1
- package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
- package/dist/components/Toast/Toast.vanilla.cjs +5 -5
- package/dist/components/Toast/Toast.vanilla.cjs.map +1 -1
- package/dist/components/Toast/Toast.vanilla.js +5 -5
- package/dist/components/Toast/Toast.vanilla.js.map +1 -1
- package/dist/faency.css +2495 -1638
- package/dist/index.cjs +25 -0
- package/dist/index.d.ts +611 -6
- package/dist/index.js +5 -1
- package/dist/styles/cx.cjs +5 -0
- package/dist/styles/cx.cjs.map +1 -0
- package/dist/styles/cx.js +5 -0
- package/dist/styles/cx.js.map +1 -0
- package/dist/styles/themes.css.cjs.map +1 -1
- package/dist/styles/themes.css.js.map +1 -1
- package/dist/styles/tokens.css.cjs +93 -79
- package/dist/styles/tokens.css.cjs.map +1 -1
- package/dist/styles/tokens.css.js +93 -79
- package/dist/styles/tokens.css.js.map +1 -1
- package/dist/styles/useInlineStyle.cjs +16 -0
- package/dist/styles/useInlineStyle.cjs.map +1 -0
- package/dist/styles/useInlineStyle.js +16 -0
- package/dist/styles/useInlineStyle.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
;/* empty css */
|
|
2
|
+
;/* empty css */
|
|
3
|
+
let _vanilla_extract_recipes_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
|
|
4
|
+
// components/Table/Table.vanilla.css.ts
|
|
5
|
+
var tableRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
|
|
6
|
+
defaultClassName: "_1aa2xbm1 _1aa2xbm0",
|
|
7
|
+
variantClassNames: { elevation: {
|
|
8
|
+
"0": "_1aa2xbm2",
|
|
9
|
+
"1": "_1aa2xbm3",
|
|
10
|
+
"2": "_1aa2xbm4",
|
|
11
|
+
"3": "_1aa2xbm5",
|
|
12
|
+
"4": "_1aa2xbm6",
|
|
13
|
+
"5": "_1aa2xbm7"
|
|
14
|
+
} },
|
|
15
|
+
defaultVariants: { elevation: 1 },
|
|
16
|
+
compoundVariants: []
|
|
17
|
+
});
|
|
18
|
+
var captionRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
|
|
19
|
+
defaultClassName: "_1aa2xbm9 _1aa2xbm8",
|
|
20
|
+
variantClassNames: {
|
|
21
|
+
size: {
|
|
22
|
+
"0": "_1aa2xbma",
|
|
23
|
+
"1": "_1aa2xbmb",
|
|
24
|
+
"2": "_1aa2xbmc",
|
|
25
|
+
"3": "_1aa2xbmd",
|
|
26
|
+
"4": "_1aa2xbme",
|
|
27
|
+
"5": "_1aa2xbmf",
|
|
28
|
+
"6": "_1aa2xbmg",
|
|
29
|
+
"7": "_1aa2xbmh",
|
|
30
|
+
"8": "_1aa2xbmi",
|
|
31
|
+
"9": "_1aa2xbmj",
|
|
32
|
+
"10": "_1aa2xbmk",
|
|
33
|
+
"11": "_1aa2xbml",
|
|
34
|
+
"12": "_1aa2xbmm",
|
|
35
|
+
inherit: "_1aa2xbmn"
|
|
36
|
+
},
|
|
37
|
+
weight: {
|
|
38
|
+
light: "_1aa2xbmo",
|
|
39
|
+
regular: "_1aa2xbmp",
|
|
40
|
+
medium: "_1aa2xbmq",
|
|
41
|
+
semiBold: "_1aa2xbmr",
|
|
42
|
+
bold: "_1aa2xbms"
|
|
43
|
+
},
|
|
44
|
+
variant: {
|
|
45
|
+
red: "_1aa2xbmt",
|
|
46
|
+
subtle: "_1aa2xbmu",
|
|
47
|
+
"default": "_1aa2xbmv",
|
|
48
|
+
contrast: "_1aa2xbmw",
|
|
49
|
+
inherit: "_1aa2xbmx",
|
|
50
|
+
invalid: "_1aa2xbmy"
|
|
51
|
+
},
|
|
52
|
+
gradient: { true: "_1aa2xbmz" },
|
|
53
|
+
noWrap: { true: "_1aa2xbm10" },
|
|
54
|
+
transform: {
|
|
55
|
+
uppercase: "_1aa2xbm11",
|
|
56
|
+
capitalize: "_1aa2xbm12",
|
|
57
|
+
capitalizeWords: "_1aa2xbm13"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
size: "3",
|
|
62
|
+
variant: "default"
|
|
63
|
+
},
|
|
64
|
+
compoundVariants: []
|
|
65
|
+
});
|
|
66
|
+
var tbody = "_1aa2xbm14";
|
|
67
|
+
var thead = "_1aa2xbm15";
|
|
68
|
+
var tfoot = "_1aa2xbm16";
|
|
69
|
+
var trRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
|
|
70
|
+
defaultClassName: "_1aa2xbm18 _1aa2xbm17",
|
|
71
|
+
variantClassNames: {
|
|
72
|
+
interactive: { true: "_1aa2xbm19" },
|
|
73
|
+
active: { true: "_1aa2xbm1a" }
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: {},
|
|
76
|
+
compoundVariants: [[{
|
|
77
|
+
interactive: true,
|
|
78
|
+
active: true
|
|
79
|
+
}, "_1aa2xbm1b"]]
|
|
80
|
+
});
|
|
81
|
+
var thRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
|
|
82
|
+
defaultClassName: "_1aa2xbm1d _1aa2xbm1c",
|
|
83
|
+
variantClassNames: {
|
|
84
|
+
size: {
|
|
85
|
+
"0": "_1aa2xbm1e",
|
|
86
|
+
"1": "_1aa2xbm1f",
|
|
87
|
+
"2": "_1aa2xbm1g",
|
|
88
|
+
"3": "_1aa2xbm1h",
|
|
89
|
+
"4": "_1aa2xbm1i",
|
|
90
|
+
"5": "_1aa2xbm1j",
|
|
91
|
+
"6": "_1aa2xbm1k",
|
|
92
|
+
"7": "_1aa2xbm1l",
|
|
93
|
+
"8": "_1aa2xbm1m",
|
|
94
|
+
"9": "_1aa2xbm1n",
|
|
95
|
+
"10": "_1aa2xbm1o",
|
|
96
|
+
"11": "_1aa2xbm1p",
|
|
97
|
+
"12": "_1aa2xbm1q",
|
|
98
|
+
inherit: "_1aa2xbm1r"
|
|
99
|
+
},
|
|
100
|
+
weight: {
|
|
101
|
+
light: "_1aa2xbm1s",
|
|
102
|
+
regular: "_1aa2xbm1t",
|
|
103
|
+
medium: "_1aa2xbm1u",
|
|
104
|
+
semiBold: "_1aa2xbm1v",
|
|
105
|
+
bold: "_1aa2xbm1w"
|
|
106
|
+
},
|
|
107
|
+
variant: {
|
|
108
|
+
red: "_1aa2xbm1x",
|
|
109
|
+
subtle: "_1aa2xbm1y",
|
|
110
|
+
"default": "_1aa2xbm1z",
|
|
111
|
+
contrast: "_1aa2xbm20",
|
|
112
|
+
inherit: "_1aa2xbm21",
|
|
113
|
+
invalid: "_1aa2xbm22"
|
|
114
|
+
},
|
|
115
|
+
gradient: { true: "_1aa2xbm23" },
|
|
116
|
+
noWrap: { true: "_1aa2xbm24" },
|
|
117
|
+
transform: {
|
|
118
|
+
uppercase: "_1aa2xbm25",
|
|
119
|
+
capitalize: "_1aa2xbm26",
|
|
120
|
+
capitalizeWords: "_1aa2xbm27"
|
|
121
|
+
},
|
|
122
|
+
align: {
|
|
123
|
+
start: "_1aa2xbm28",
|
|
124
|
+
center: "_1aa2xbm29",
|
|
125
|
+
end: "_1aa2xbm2a"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
defaultVariants: {
|
|
129
|
+
size: "0",
|
|
130
|
+
variant: "subtle",
|
|
131
|
+
transform: "capitalize",
|
|
132
|
+
align: "start"
|
|
133
|
+
},
|
|
134
|
+
compoundVariants: []
|
|
135
|
+
});
|
|
136
|
+
var sortButton = "_1aa2xbm2b";
|
|
137
|
+
var sortIcon = "_1aa2xbm2c";
|
|
138
|
+
var sortIconActive = "_1aa2xbm2d";
|
|
139
|
+
var emptyHeaderCell = "_1aa2xbm2e";
|
|
140
|
+
var tdRecipe = (0, _vanilla_extract_recipes_createRuntimeFn.createRuntimeFn)({
|
|
141
|
+
defaultClassName: "_1aa2xbm2g _1aa2xbm2f",
|
|
142
|
+
variantClassNames: {
|
|
143
|
+
subtle: { true: "_1aa2xbm2h" },
|
|
144
|
+
align: {
|
|
145
|
+
start: "_1aa2xbm2i",
|
|
146
|
+
center: "_1aa2xbm2j",
|
|
147
|
+
end: "_1aa2xbm2k"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
defaultVariants: { align: "start" },
|
|
151
|
+
compoundVariants: []
|
|
152
|
+
});
|
|
153
|
+
var toggleCell = "_1aa2xbm2l";
|
|
154
|
+
var toggle = "_1aa2xbm2m";
|
|
155
|
+
var expandButton = "_1aa2xbm2n";
|
|
156
|
+
var chevron = "_1aa2xbm2o";
|
|
157
|
+
var collapsedCell = "_1aa2xbm2p";
|
|
158
|
+
var collapsedContent = "_1aa2xbm2q";
|
|
159
|
+
exports.captionRecipe = captionRecipe;
|
|
160
|
+
exports.chevron = chevron;
|
|
161
|
+
exports.collapsedCell = collapsedCell;
|
|
162
|
+
exports.collapsedContent = collapsedContent;
|
|
163
|
+
exports.emptyHeaderCell = emptyHeaderCell;
|
|
164
|
+
exports.expandButton = expandButton;
|
|
165
|
+
exports.sortButton = sortButton;
|
|
166
|
+
exports.sortIcon = sortIcon;
|
|
167
|
+
exports.sortIconActive = sortIconActive;
|
|
168
|
+
exports.tableRecipe = tableRecipe;
|
|
169
|
+
exports.tbody = tbody;
|
|
170
|
+
exports.tdRecipe = tdRecipe;
|
|
171
|
+
exports.tfoot = tfoot;
|
|
172
|
+
exports.thRecipe = thRecipe;
|
|
173
|
+
exports.thead = thead;
|
|
174
|
+
exports.toggle = toggle;
|
|
175
|
+
exports.toggleCell = toggleCell;
|
|
176
|
+
exports.trRecipe = trRecipe;
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=Table.vanilla.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Table/Table.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport {\n colorVariants,\n gradientVariants,\n noWrapVariants,\n sizeVariants,\n transformVariants,\n weightVariants,\n} from '../../styles/textVariants.css';\nimport { tokens } from '../../styles/tokens.css';\nimport { elevationVariants } from '../Elevation/Elevation.vanilla.css';\nimport { ROW_LINK_CONTROL_Z_INDEX } from '../RowLink/RowLink.constants';\n\nconst rowBorder = `1px solid ${tokens.colors.tableRowBorder}`;\n\nconst alignVariants = {\n start: { textAlign: 'start' },\n center: { textAlign: 'center' },\n end: { textAlign: 'end' },\n} as const;\n\nconst textVariants = {\n size: sizeVariants,\n weight: weightVariants,\n variant: colorVariants,\n gradient: gradientVariants,\n noWrap: noWrapVariants,\n} as const;\n\nconst layer = (backgroundColor: string, borderRadius: Record<string, string>) =>\n ({\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor,\n ...borderRadius,\n }) as const;\n\nexport const table = style({\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: tokens.fonts.rubik,\n color: tokens.colors.tableText,\n borderRadius: tokens.radii['3'],\n overflow: 'hidden',\n});\n\nexport const tableRecipe = recipe({\n base: table,\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nconst captionBase = style({\n lineHeight: '1.25',\n margin: '0',\n fontFamily: tokens.fonts.rubik,\n fontVariantNumeric: 'proportional-nums',\n display: 'table-caption',\n textAlign: 'start',\n fontWeight: tokens.fontWeights.medium,\n});\n\nexport const captionRecipe = recipe({\n base: captionBase,\n variants: {\n ...textVariants,\n transform: transformVariants,\n },\n defaultVariants: {\n size: '3',\n variant: 'default',\n },\n});\n\nexport const tbody = style({\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const thead = style({\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '::after': layer(tokens.colors.tableHeaderLayerBackground, {\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n }),\n});\n\nexport const tfoot = style({\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '::after': layer(tokens.colors.tableFooterLayerBackground, { borderRadius: 'inherit' }),\n\n selectors: {\n [`${table} ${tbody}:not(:empty) ~ &, ${table} ${thead}:not(:empty) ~ &`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n },\n});\n\nconst tr = style({\n verticalAlign: 'inherit',\n selectors: {\n '&:hover': {\n color: tokens.colors.tableHoverText,\n },\n },\n});\n\nexport const trRecipe = recipe({\n base: tr,\n variants: {\n interactive: {\n true: {\n selectors: {\n '&:hover': {\n backgroundColor: tokens.colors.tableHoverBackground,\n cursor: 'pointer',\n },\n },\n },\n },\n active: {\n true: {\n backgroundColor: tokens.colors.tableHoverBackground,\n color: tokens.colors.tableActiveText,\n fontWeight: tokens.fontWeights.semiBold,\n },\n },\n },\n compoundVariants: [\n {\n variants: { interactive: true, active: true },\n style: {\n selectors: {\n '&:hover': {\n color: tokens.colors.tableActiveHoverText,\n },\n },\n },\n },\n ],\n});\n\n// Text and Label base styles, then the header cell's own.\nconst th = style({\n margin: '0',\n fontFamily: tokens.fonts.rubik,\n fontVariantNumeric: 'tabular-nums',\n cursor: 'default',\n fontWeight: tokens.fontWeights.medium,\n lineHeight: '2.18',\n\n display: 'table-cell',\n verticalAlign: 'inherit',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n textAlign: 'start',\n padding: `${tokens.space['2']} ${tokens.space['3']}`,\n borderBottom: rowBorder,\n\n selectors: {\n [`${thead} &`]: {\n fontSize: tokens.fontSizes['1'],\n color: tokens.colors.tableHeaderText,\n fontWeight: tokens.fontWeights.light,\n },\n },\n});\n\nexport const thRecipe = recipe({\n base: th,\n variants: {\n ...textVariants,\n transform: {\n ...transformVariants,\n // Label's capitalize sets inline-block; a cell must stay a cell.\n capitalize: { ...transformVariants.capitalize, display: 'table-cell' },\n },\n align: alignVariants,\n },\n defaultVariants: {\n size: '0',\n variant: 'subtle',\n transform: 'capitalize',\n align: 'start',\n },\n});\n\nexport const sortButton = style({\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n gap: tokens.space['2'],\n borderRadius: tokens.radii['1'],\n cursor: 'pointer',\n selectors: {\n '&:hover': {\n color: tokens.colors.hiContrast,\n },\n '&:focus-visible': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '2px',\n },\n },\n});\n\nexport const sortIcon = style({\n flexShrink: 0,\n});\n\nglobalStyle(`${sortIcon} > path`, {\n opacity: 0.4,\n});\n\nexport const sortIconActive = style({\n selectors: {\n [`${sortIcon} > &`]: {\n opacity: 1,\n },\n },\n});\n\nexport const emptyHeaderCell = style({\n width: 24,\n});\n\nconst td = style({\n boxSizing: 'border-box',\n padding: `${tokens.space['5']} ${tokens.space['3']}`,\n borderBottom: rowBorder,\n fontSize: tokens.fontSizes['3'],\n lineHeight: '16px',\n verticalAlign: 'inherit',\n\n selectors: {\n [`${tr}:last-child > &`]: {\n borderBottom: 'none',\n },\n // A closed collapsible row is followed only by its hidden content row.\n [`${tr}[data-collapsed]:nth-last-child(2) > &`]: {\n borderBottom: 'none',\n },\n [`${tfoot} &`]: {\n fontSize: tokens.fontSizes['1'],\n color: tokens.colors.tableHeaderText,\n fontWeight: tokens.fontWeights.light,\n padding: `${tokens.space['2']} ${tokens.space['3']}`,\n },\n [`${table} ${tbody}:not(:empty) ~ ${tfoot} &`]: {\n borderTop: rowBorder,\n },\n },\n});\n\nexport const tdRecipe = recipe({\n base: td,\n variants: {\n subtle: {\n true: {\n fontWeight: tokens.fontWeights.regular,\n color: tokens.colors.tableSubtleText,\n },\n },\n align: alignVariants,\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const toggleCell = style({\n selectors: {\n '&&': {\n padding: `0 0 0 ${tokens.space['3']}`,\n },\n },\n});\n\nexport const toggle = style({\n boxSizing: 'border-box',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n ':hover': {\n color: tokens.colors.tableActiveText,\n },\n});\n\nexport const expandButton = style({\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n borderRadius: tokens.radii['1'],\n cursor: 'pointer',\n selectors: {\n '&:focus-visible': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '2px',\n },\n },\n});\n\nexport const chevron = style({\n transition: 'transform 0.2s ease-out',\n selectors: {\n [`${expandButton}[aria-expanded=\"true\"] > &`]: {\n transform: 'rotate(90deg)',\n },\n },\n});\n\n// Visibility switches after the collapse animation, so closed content leaves the tab order.\nexport const collapsedCell = style({\n transition: 'padding 0.2s ease-out, visibility 0s',\n selectors: {\n '&&[data-closed]': {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: `0px ${tokens.space['3']}`,\n border: 'none',\n },\n },\n});\n\nexport const collapsedContent = style({\n boxSizing: 'border-box',\n transition: 'all 0.2s ease-out',\n selectors: {\n [`${collapsedCell}[data-closed] > &`]: {\n height: 0,\n overflow: 'hidden',\n },\n },\n});\n"],"mappings":""}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
4
|
+
// components/Table/Table.vanilla.css.ts
|
|
5
|
+
var tableRecipe = createRuntimeFn({
|
|
6
|
+
defaultClassName: "_1aa2xbm1 _1aa2xbm0",
|
|
7
|
+
variantClassNames: { elevation: {
|
|
8
|
+
"0": "_1aa2xbm2",
|
|
9
|
+
"1": "_1aa2xbm3",
|
|
10
|
+
"2": "_1aa2xbm4",
|
|
11
|
+
"3": "_1aa2xbm5",
|
|
12
|
+
"4": "_1aa2xbm6",
|
|
13
|
+
"5": "_1aa2xbm7"
|
|
14
|
+
} },
|
|
15
|
+
defaultVariants: { elevation: 1 },
|
|
16
|
+
compoundVariants: []
|
|
17
|
+
});
|
|
18
|
+
var captionRecipe = createRuntimeFn({
|
|
19
|
+
defaultClassName: "_1aa2xbm9 _1aa2xbm8",
|
|
20
|
+
variantClassNames: {
|
|
21
|
+
size: {
|
|
22
|
+
"0": "_1aa2xbma",
|
|
23
|
+
"1": "_1aa2xbmb",
|
|
24
|
+
"2": "_1aa2xbmc",
|
|
25
|
+
"3": "_1aa2xbmd",
|
|
26
|
+
"4": "_1aa2xbme",
|
|
27
|
+
"5": "_1aa2xbmf",
|
|
28
|
+
"6": "_1aa2xbmg",
|
|
29
|
+
"7": "_1aa2xbmh",
|
|
30
|
+
"8": "_1aa2xbmi",
|
|
31
|
+
"9": "_1aa2xbmj",
|
|
32
|
+
"10": "_1aa2xbmk",
|
|
33
|
+
"11": "_1aa2xbml",
|
|
34
|
+
"12": "_1aa2xbmm",
|
|
35
|
+
inherit: "_1aa2xbmn"
|
|
36
|
+
},
|
|
37
|
+
weight: {
|
|
38
|
+
light: "_1aa2xbmo",
|
|
39
|
+
regular: "_1aa2xbmp",
|
|
40
|
+
medium: "_1aa2xbmq",
|
|
41
|
+
semiBold: "_1aa2xbmr",
|
|
42
|
+
bold: "_1aa2xbms"
|
|
43
|
+
},
|
|
44
|
+
variant: {
|
|
45
|
+
red: "_1aa2xbmt",
|
|
46
|
+
subtle: "_1aa2xbmu",
|
|
47
|
+
"default": "_1aa2xbmv",
|
|
48
|
+
contrast: "_1aa2xbmw",
|
|
49
|
+
inherit: "_1aa2xbmx",
|
|
50
|
+
invalid: "_1aa2xbmy"
|
|
51
|
+
},
|
|
52
|
+
gradient: { true: "_1aa2xbmz" },
|
|
53
|
+
noWrap: { true: "_1aa2xbm10" },
|
|
54
|
+
transform: {
|
|
55
|
+
uppercase: "_1aa2xbm11",
|
|
56
|
+
capitalize: "_1aa2xbm12",
|
|
57
|
+
capitalizeWords: "_1aa2xbm13"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
size: "3",
|
|
62
|
+
variant: "default"
|
|
63
|
+
},
|
|
64
|
+
compoundVariants: []
|
|
65
|
+
});
|
|
66
|
+
var tbody = "_1aa2xbm14";
|
|
67
|
+
var thead = "_1aa2xbm15";
|
|
68
|
+
var tfoot = "_1aa2xbm16";
|
|
69
|
+
var trRecipe = createRuntimeFn({
|
|
70
|
+
defaultClassName: "_1aa2xbm18 _1aa2xbm17",
|
|
71
|
+
variantClassNames: {
|
|
72
|
+
interactive: { true: "_1aa2xbm19" },
|
|
73
|
+
active: { true: "_1aa2xbm1a" }
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: {},
|
|
76
|
+
compoundVariants: [[{
|
|
77
|
+
interactive: true,
|
|
78
|
+
active: true
|
|
79
|
+
}, "_1aa2xbm1b"]]
|
|
80
|
+
});
|
|
81
|
+
var thRecipe = createRuntimeFn({
|
|
82
|
+
defaultClassName: "_1aa2xbm1d _1aa2xbm1c",
|
|
83
|
+
variantClassNames: {
|
|
84
|
+
size: {
|
|
85
|
+
"0": "_1aa2xbm1e",
|
|
86
|
+
"1": "_1aa2xbm1f",
|
|
87
|
+
"2": "_1aa2xbm1g",
|
|
88
|
+
"3": "_1aa2xbm1h",
|
|
89
|
+
"4": "_1aa2xbm1i",
|
|
90
|
+
"5": "_1aa2xbm1j",
|
|
91
|
+
"6": "_1aa2xbm1k",
|
|
92
|
+
"7": "_1aa2xbm1l",
|
|
93
|
+
"8": "_1aa2xbm1m",
|
|
94
|
+
"9": "_1aa2xbm1n",
|
|
95
|
+
"10": "_1aa2xbm1o",
|
|
96
|
+
"11": "_1aa2xbm1p",
|
|
97
|
+
"12": "_1aa2xbm1q",
|
|
98
|
+
inherit: "_1aa2xbm1r"
|
|
99
|
+
},
|
|
100
|
+
weight: {
|
|
101
|
+
light: "_1aa2xbm1s",
|
|
102
|
+
regular: "_1aa2xbm1t",
|
|
103
|
+
medium: "_1aa2xbm1u",
|
|
104
|
+
semiBold: "_1aa2xbm1v",
|
|
105
|
+
bold: "_1aa2xbm1w"
|
|
106
|
+
},
|
|
107
|
+
variant: {
|
|
108
|
+
red: "_1aa2xbm1x",
|
|
109
|
+
subtle: "_1aa2xbm1y",
|
|
110
|
+
"default": "_1aa2xbm1z",
|
|
111
|
+
contrast: "_1aa2xbm20",
|
|
112
|
+
inherit: "_1aa2xbm21",
|
|
113
|
+
invalid: "_1aa2xbm22"
|
|
114
|
+
},
|
|
115
|
+
gradient: { true: "_1aa2xbm23" },
|
|
116
|
+
noWrap: { true: "_1aa2xbm24" },
|
|
117
|
+
transform: {
|
|
118
|
+
uppercase: "_1aa2xbm25",
|
|
119
|
+
capitalize: "_1aa2xbm26",
|
|
120
|
+
capitalizeWords: "_1aa2xbm27"
|
|
121
|
+
},
|
|
122
|
+
align: {
|
|
123
|
+
start: "_1aa2xbm28",
|
|
124
|
+
center: "_1aa2xbm29",
|
|
125
|
+
end: "_1aa2xbm2a"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
defaultVariants: {
|
|
129
|
+
size: "0",
|
|
130
|
+
variant: "subtle",
|
|
131
|
+
transform: "capitalize",
|
|
132
|
+
align: "start"
|
|
133
|
+
},
|
|
134
|
+
compoundVariants: []
|
|
135
|
+
});
|
|
136
|
+
var sortButton = "_1aa2xbm2b";
|
|
137
|
+
var sortIcon = "_1aa2xbm2c";
|
|
138
|
+
var sortIconActive = "_1aa2xbm2d";
|
|
139
|
+
var emptyHeaderCell = "_1aa2xbm2e";
|
|
140
|
+
var tdRecipe = createRuntimeFn({
|
|
141
|
+
defaultClassName: "_1aa2xbm2g _1aa2xbm2f",
|
|
142
|
+
variantClassNames: {
|
|
143
|
+
subtle: { true: "_1aa2xbm2h" },
|
|
144
|
+
align: {
|
|
145
|
+
start: "_1aa2xbm2i",
|
|
146
|
+
center: "_1aa2xbm2j",
|
|
147
|
+
end: "_1aa2xbm2k"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
defaultVariants: { align: "start" },
|
|
151
|
+
compoundVariants: []
|
|
152
|
+
});
|
|
153
|
+
var toggleCell = "_1aa2xbm2l";
|
|
154
|
+
var toggle = "_1aa2xbm2m";
|
|
155
|
+
var expandButton = "_1aa2xbm2n";
|
|
156
|
+
var chevron = "_1aa2xbm2o";
|
|
157
|
+
var collapsedCell = "_1aa2xbm2p";
|
|
158
|
+
var collapsedContent = "_1aa2xbm2q";
|
|
159
|
+
export { captionRecipe, chevron, collapsedCell, collapsedContent, emptyHeaderCell, expandButton, sortButton, sortIcon, sortIconActive, tableRecipe, tbody, tdRecipe, tfoot, thRecipe, thead, toggle, toggleCell, trRecipe };
|
|
160
|
+
|
|
161
|
+
//# sourceMappingURL=Table.vanilla.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.vanilla.css.js","names":["_7a468"],"sources":["../../../components/Table/Table.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport {\n colorVariants,\n gradientVariants,\n noWrapVariants,\n sizeVariants,\n transformVariants,\n weightVariants,\n} from '../../styles/textVariants.css';\nimport { tokens } from '../../styles/tokens.css';\nimport { elevationVariants } from '../Elevation/Elevation.vanilla.css';\nimport { ROW_LINK_CONTROL_Z_INDEX } from '../RowLink/RowLink.constants';\n\nconst rowBorder = `1px solid ${tokens.colors.tableRowBorder}`;\n\nconst alignVariants = {\n start: { textAlign: 'start' },\n center: { textAlign: 'center' },\n end: { textAlign: 'end' },\n} as const;\n\nconst textVariants = {\n size: sizeVariants,\n weight: weightVariants,\n variant: colorVariants,\n gradient: gradientVariants,\n noWrap: noWrapVariants,\n} as const;\n\nconst layer = (backgroundColor: string, borderRadius: Record<string, string>) =>\n ({\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor,\n ...borderRadius,\n }) as const;\n\nexport const table = style({\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: tokens.fonts.rubik,\n color: tokens.colors.tableText,\n borderRadius: tokens.radii['3'],\n overflow: 'hidden',\n});\n\nexport const tableRecipe = recipe({\n base: table,\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nconst captionBase = style({\n lineHeight: '1.25',\n margin: '0',\n fontFamily: tokens.fonts.rubik,\n fontVariantNumeric: 'proportional-nums',\n display: 'table-caption',\n textAlign: 'start',\n fontWeight: tokens.fontWeights.medium,\n});\n\nexport const captionRecipe = recipe({\n base: captionBase,\n variants: {\n ...textVariants,\n transform: transformVariants,\n },\n defaultVariants: {\n size: '3',\n variant: 'default',\n },\n});\n\nexport const tbody = style({\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const thead = style({\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '::after': layer(tokens.colors.tableHeaderLayerBackground, {\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n }),\n});\n\nexport const tfoot = style({\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '::after': layer(tokens.colors.tableFooterLayerBackground, { borderRadius: 'inherit' }),\n\n selectors: {\n [`${table} ${tbody}:not(:empty) ~ &, ${table} ${thead}:not(:empty) ~ &`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n },\n});\n\nconst tr = style({\n verticalAlign: 'inherit',\n selectors: {\n '&:hover': {\n color: tokens.colors.tableHoverText,\n },\n },\n});\n\nexport const trRecipe = recipe({\n base: tr,\n variants: {\n interactive: {\n true: {\n selectors: {\n '&:hover': {\n backgroundColor: tokens.colors.tableHoverBackground,\n cursor: 'pointer',\n },\n },\n },\n },\n active: {\n true: {\n backgroundColor: tokens.colors.tableHoverBackground,\n color: tokens.colors.tableActiveText,\n fontWeight: tokens.fontWeights.semiBold,\n },\n },\n },\n compoundVariants: [\n {\n variants: { interactive: true, active: true },\n style: {\n selectors: {\n '&:hover': {\n color: tokens.colors.tableActiveHoverText,\n },\n },\n },\n },\n ],\n});\n\n// Text and Label base styles, then the header cell's own.\nconst th = style({\n margin: '0',\n fontFamily: tokens.fonts.rubik,\n fontVariantNumeric: 'tabular-nums',\n cursor: 'default',\n fontWeight: tokens.fontWeights.medium,\n lineHeight: '2.18',\n\n display: 'table-cell',\n verticalAlign: 'inherit',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n textAlign: 'start',\n padding: `${tokens.space['2']} ${tokens.space['3']}`,\n borderBottom: rowBorder,\n\n selectors: {\n [`${thead} &`]: {\n fontSize: tokens.fontSizes['1'],\n color: tokens.colors.tableHeaderText,\n fontWeight: tokens.fontWeights.light,\n },\n },\n});\n\nexport const thRecipe = recipe({\n base: th,\n variants: {\n ...textVariants,\n transform: {\n ...transformVariants,\n // Label's capitalize sets inline-block; a cell must stay a cell.\n capitalize: { ...transformVariants.capitalize, display: 'table-cell' },\n },\n align: alignVariants,\n },\n defaultVariants: {\n size: '0',\n variant: 'subtle',\n transform: 'capitalize',\n align: 'start',\n },\n});\n\nexport const sortButton = style({\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n gap: tokens.space['2'],\n borderRadius: tokens.radii['1'],\n cursor: 'pointer',\n selectors: {\n '&:hover': {\n color: tokens.colors.hiContrast,\n },\n '&:focus-visible': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '2px',\n },\n },\n});\n\nexport const sortIcon = style({\n flexShrink: 0,\n});\n\nglobalStyle(`${sortIcon} > path`, {\n opacity: 0.4,\n});\n\nexport const sortIconActive = style({\n selectors: {\n [`${sortIcon} > &`]: {\n opacity: 1,\n },\n },\n});\n\nexport const emptyHeaderCell = style({\n width: 24,\n});\n\nconst td = style({\n boxSizing: 'border-box',\n padding: `${tokens.space['5']} ${tokens.space['3']}`,\n borderBottom: rowBorder,\n fontSize: tokens.fontSizes['3'],\n lineHeight: '16px',\n verticalAlign: 'inherit',\n\n selectors: {\n [`${tr}:last-child > &`]: {\n borderBottom: 'none',\n },\n // A closed collapsible row is followed only by its hidden content row.\n [`${tr}[data-collapsed]:nth-last-child(2) > &`]: {\n borderBottom: 'none',\n },\n [`${tfoot} &`]: {\n fontSize: tokens.fontSizes['1'],\n color: tokens.colors.tableHeaderText,\n fontWeight: tokens.fontWeights.light,\n padding: `${tokens.space['2']} ${tokens.space['3']}`,\n },\n [`${table} ${tbody}:not(:empty) ~ ${tfoot} &`]: {\n borderTop: rowBorder,\n },\n },\n});\n\nexport const tdRecipe = recipe({\n base: td,\n variants: {\n subtle: {\n true: {\n fontWeight: tokens.fontWeights.regular,\n color: tokens.colors.tableSubtleText,\n },\n },\n align: alignVariants,\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const toggleCell = style({\n selectors: {\n '&&': {\n padding: `0 0 0 ${tokens.space['3']}`,\n },\n },\n});\n\nexport const toggle = style({\n boxSizing: 'border-box',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n ':hover': {\n color: tokens.colors.tableActiveText,\n },\n});\n\nexport const expandButton = style({\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n borderRadius: tokens.radii['1'],\n cursor: 'pointer',\n selectors: {\n '&:focus-visible': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '2px',\n },\n },\n});\n\nexport const chevron = style({\n transition: 'transform 0.2s ease-out',\n selectors: {\n [`${expandButton}[aria-expanded=\"true\"] > &`]: {\n transform: 'rotate(90deg)',\n },\n },\n});\n\n// Visibility switches after the collapse animation, so closed content leaves the tab order.\nexport const collapsedCell = style({\n transition: 'padding 0.2s ease-out, visibility 0s',\n selectors: {\n '&&[data-closed]': {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: `0px ${tokens.space['3']}`,\n border: 'none',\n },\n },\n});\n\nexport const collapsedContent = style({\n boxSizing: 'border-box',\n transition: 'all 0.2s ease-out',\n selectors: {\n [`${collapsedCell}[data-closed] > &`]: {\n height: 0,\n overflow: 'hidden',\n },\n },\n});\n"],"mappings":""}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { cx } from "../../styles/cx.js";
|
|
2
|
+
import { useInlineStyle } from "../../styles/useInlineStyle.js";
|
|
3
|
+
import { handleRowClick, mapRowLink, openRowLink } from "../RowLink/RowLink.utils.js";
|
|
4
|
+
import { RowLinkVanilla } from "../RowLink/RowLink.vanilla.js";
|
|
5
|
+
import { rowLinkRow, rowLinkTable } from "../RowLink/RowLink.vanilla.css.js";
|
|
6
|
+
import { ExpandToggleVanilla, stopEvent } from "./ExpandToggle.vanilla.js";
|
|
7
|
+
import { ARIA_SORT, SortButtonVanilla } from "./SortButton.vanilla.js";
|
|
8
|
+
import { captionRecipe, tableRecipe, tbody, tdRecipe, tfoot, thRecipe, thead, trRecipe } from "./Table.vanilla.css.js";
|
|
9
|
+
import { forwardRef, useId, useState } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
// components/Table/Table.vanilla.tsx
|
|
12
|
+
var TableVanilla = forwardRef(({ elevation, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("table", {
|
|
13
|
+
ref,
|
|
14
|
+
className: cx(tableRecipe({ elevation }), rowLinkTable, className),
|
|
15
|
+
style: useInlineStyle(css, style),
|
|
16
|
+
...props
|
|
17
|
+
}));
|
|
18
|
+
TableVanilla.displayName = "TableVanilla";
|
|
19
|
+
var CaptionVanilla = forwardRef(({ size, weight, variant, gradient, transform, noWrap, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("caption", {
|
|
20
|
+
ref,
|
|
21
|
+
className: cx(captionRecipe({
|
|
22
|
+
size,
|
|
23
|
+
weight,
|
|
24
|
+
variant,
|
|
25
|
+
gradient,
|
|
26
|
+
transform,
|
|
27
|
+
noWrap
|
|
28
|
+
}), className),
|
|
29
|
+
style: useInlineStyle(css, style),
|
|
30
|
+
...props
|
|
31
|
+
}));
|
|
32
|
+
CaptionVanilla.displayName = "CaptionVanilla";
|
|
33
|
+
var section = (Tag, sectionClass, displayName) => {
|
|
34
|
+
const Section = forwardRef(({ className, css, style, ...props }, ref) => /* @__PURE__ */ jsx(Tag, {
|
|
35
|
+
ref,
|
|
36
|
+
className: cx(sectionClass, className),
|
|
37
|
+
style: useInlineStyle(css, style),
|
|
38
|
+
...props
|
|
39
|
+
}));
|
|
40
|
+
Section.displayName = displayName;
|
|
41
|
+
return Section;
|
|
42
|
+
};
|
|
43
|
+
var TheadVanilla = section("thead", thead, "TheadVanilla");
|
|
44
|
+
var TbodyVanilla = section("tbody", tbody, "TbodyVanilla");
|
|
45
|
+
var TfootVanilla = section("tfoot", tfoot, "TfootVanilla");
|
|
46
|
+
var ThVanilla = forwardRef(({ size, weight, variant, gradient, transform, noWrap, align, sort, onSort, className, css, style, children, ...props }, ref) => /* @__PURE__ */ jsx("th", {
|
|
47
|
+
ref,
|
|
48
|
+
"aria-sort": sort && ARIA_SORT[sort],
|
|
49
|
+
className: cx(thRecipe({
|
|
50
|
+
size,
|
|
51
|
+
weight,
|
|
52
|
+
variant,
|
|
53
|
+
gradient,
|
|
54
|
+
transform,
|
|
55
|
+
noWrap,
|
|
56
|
+
align
|
|
57
|
+
}), className),
|
|
58
|
+
style: useInlineStyle(css, style),
|
|
59
|
+
...props,
|
|
60
|
+
children: onSort ? /* @__PURE__ */ jsx(SortButtonVanilla, {
|
|
61
|
+
sort,
|
|
62
|
+
onSort,
|
|
63
|
+
children
|
|
64
|
+
}) : children
|
|
65
|
+
}));
|
|
66
|
+
ThVanilla.displayName = "ThVanilla";
|
|
67
|
+
var TdVanilla = forwardRef(({ subtle, align, className, css, style, ...props }, ref) => /* @__PURE__ */ jsx("td", {
|
|
68
|
+
ref,
|
|
69
|
+
className: cx(tdRecipe({
|
|
70
|
+
subtle,
|
|
71
|
+
align
|
|
72
|
+
}), className),
|
|
73
|
+
style: useInlineStyle(css, style),
|
|
74
|
+
...props
|
|
75
|
+
}));
|
|
76
|
+
TdVanilla.displayName = "TdVanilla";
|
|
77
|
+
var TrVanilla = forwardRef(({ collapsedContent: collapsedContent$1, collapsedContentColSpan = 1, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, href, linkAs, linkCell, linkProps, linkOverlay, interactive, active, className, css, style, children, onClick, onAuxClick, ...props }, ref) => {
|
|
78
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
79
|
+
const contentId = useId();
|
|
80
|
+
const inlineStyle = useInlineStyle(css, style);
|
|
81
|
+
const collapsible = !!collapsedContent$1;
|
|
82
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
83
|
+
ref,
|
|
84
|
+
className: cx(trRecipe({
|
|
85
|
+
interactive: interactive ?? (href !== void 0 || void 0),
|
|
86
|
+
active
|
|
87
|
+
}), rowLinkRow, className),
|
|
88
|
+
"data-collapsed": collapsible && !isOpen ? "" : void 0,
|
|
89
|
+
style: inlineStyle,
|
|
90
|
+
onClick: (event) => handleRowClick(event, onClick),
|
|
91
|
+
onAuxClick: (event) => {
|
|
92
|
+
onAuxClick?.(event);
|
|
93
|
+
openRowLink(event);
|
|
94
|
+
},
|
|
95
|
+
...props,
|
|
96
|
+
children: [
|
|
97
|
+
emptyFirstColumn && (tableHead ? /* @__PURE__ */ jsx("td", { className: cx(thRecipe(), "_1aa2xbm2e") }) : /* @__PURE__ */ jsx(TdVanilla, {})),
|
|
98
|
+
collapsible && /* @__PURE__ */ jsx(TdVanilla, {
|
|
99
|
+
className: "_1aa2xbm2l",
|
|
100
|
+
onClick: stopEvent,
|
|
101
|
+
children: /* @__PURE__ */ jsx(ExpandToggleVanilla, {
|
|
102
|
+
label: expandLabel,
|
|
103
|
+
isOpen,
|
|
104
|
+
controls: contentId,
|
|
105
|
+
onToggle: () => setIsOpen((open) => !open)
|
|
106
|
+
})
|
|
107
|
+
}),
|
|
108
|
+
mapRowLink(children, {
|
|
109
|
+
href,
|
|
110
|
+
linkAs,
|
|
111
|
+
linkCell,
|
|
112
|
+
linkProps,
|
|
113
|
+
linkOverlay
|
|
114
|
+
}, TdVanilla, RowLinkVanilla, {
|
|
115
|
+
row: "TrVanilla",
|
|
116
|
+
cell: "TdVanilla"
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
}), collapsible && /* @__PURE__ */ jsx(TrVanilla, { children: /* @__PURE__ */ jsx(TdVanilla, {
|
|
120
|
+
id: contentId,
|
|
121
|
+
colSpan: collapsedContentColSpan,
|
|
122
|
+
className: "_1aa2xbm2p",
|
|
123
|
+
"data-closed": isOpen ? void 0 : "",
|
|
124
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "_1aa2xbm2q",
|
|
126
|
+
children: collapsedContent$1
|
|
127
|
+
})
|
|
128
|
+
}) })] });
|
|
129
|
+
});
|
|
130
|
+
TrVanilla.displayName = "TrVanilla";
|
|
131
|
+
export { CaptionVanilla, TableVanilla, TbodyVanilla, TdVanilla, TfootVanilla, ThVanilla, TheadVanilla, TrVanilla };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=Table.vanilla.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.vanilla.js","names":["collapsedContent","_Fragment"],"sources":["../../../components/Table/Table.vanilla.tsx"],"sourcesContent":["import { RecipeVariants } from '@vanilla-extract/recipes';\nimport React, { forwardRef, ReactNode, useId, useState } from 'react';\n\nimport { CSSProps } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useInlineStyle } from '../../styles/useInlineStyle';\nimport {\n handleRowClick,\n mapRowLink,\n openRowLink,\n RowLinkShortcutProps,\n} from '../RowLink/RowLink.utils';\nimport { RowLinkVanilla } from '../RowLink/RowLink.vanilla';\nimport { rowLinkRow, rowLinkTable } from '../RowLink/RowLink.vanilla.css';\nimport { ExpandToggleVanilla, stopEvent } from './ExpandToggle.vanilla';\nimport { ARIA_SORT, SortButtonVanilla } from './SortButton.vanilla';\nimport {\n captionRecipe,\n collapsedCell,\n collapsedContent as collapsedContentClass,\n emptyHeaderCell,\n tableRecipe,\n tbody,\n tdRecipe,\n tfoot,\n thead,\n thRecipe,\n toggleCell,\n trRecipe,\n} from './Table.vanilla.css';\nimport { TableSortProps } from './useTableSort';\n\ntype TableRecipeVariants = NonNullable<RecipeVariants<typeof tableRecipe>>;\ntype CaptionRecipeVariants = NonNullable<RecipeVariants<typeof captionRecipe>>;\ntype TrRecipeVariants = NonNullable<RecipeVariants<typeof trRecipe>>;\ntype ThRecipeVariants = NonNullable<RecipeVariants<typeof thRecipe>>;\ntype TdRecipeVariants = NonNullable<RecipeVariants<typeof tdRecipe>>;\n\nexport type TableVanillaProps = React.TableHTMLAttributes<HTMLTableElement> &\n CSSProps &\n TableRecipeVariants;\n\nexport const TableVanilla = forwardRef<HTMLTableElement, TableVanillaProps>(\n ({ elevation, className, css, style, ...props }, ref) => (\n <table\n ref={ref}\n className={cx(tableRecipe({ elevation }), rowLinkTable, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTableVanilla.displayName = 'TableVanilla';\n\nexport type CaptionVanillaProps = React.HTMLAttributes<HTMLTableCaptionElement> &\n CSSProps &\n CaptionRecipeVariants;\n\nexport const CaptionVanilla = forwardRef<HTMLTableCaptionElement, CaptionVanillaProps>(\n (\n { size, weight, variant, gradient, transform, noWrap, className, css, style, ...props },\n ref,\n ) => (\n <caption\n ref={ref}\n className={cx(\n captionRecipe({ size, weight, variant, gradient, transform, noWrap }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nCaptionVanilla.displayName = 'CaptionVanilla';\n\nexport type TableSectionVanillaProps = React.HTMLAttributes<HTMLTableSectionElement> & CSSProps;\n\nconst section = (Tag: 'thead' | 'tbody' | 'tfoot', sectionClass: string, displayName: string) => {\n const Section = forwardRef<HTMLTableSectionElement, TableSectionVanillaProps>(\n ({ className, css, style, ...props }, ref) => (\n <Tag\n ref={ref}\n className={cx(sectionClass, className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n );\n Section.displayName = displayName;\n return Section;\n};\n\nexport const TheadVanilla = section('thead', thead, 'TheadVanilla');\nexport const TbodyVanilla = section('tbody', tbody, 'TbodyVanilla');\nexport const TfootVanilla = section('tfoot', tfoot, 'TfootVanilla');\n\nexport type ThVanillaProps = Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n ThRecipeVariants &\n TableSortProps;\n\nexport const ThVanilla = forwardRef<HTMLTableCellElement, ThVanillaProps>(\n (\n {\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n align,\n sort,\n onSort,\n className,\n css,\n style,\n children,\n ...props\n },\n ref,\n ) => (\n <th\n ref={ref}\n aria-sort={sort && ARIA_SORT[sort]}\n className={cx(\n thRecipe({ size, weight, variant, gradient, transform, noWrap, align }),\n className,\n )}\n style={useInlineStyle(css, style)}\n {...props}\n >\n {onSort ? (\n <SortButtonVanilla sort={sort} onSort={onSort}>\n {children}\n </SortButtonVanilla>\n ) : (\n children\n )}\n </th>\n ),\n);\n\nThVanilla.displayName = 'ThVanilla';\n\nexport type TdVanillaProps = Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'align'> &\n CSSProps &\n TdRecipeVariants;\n\nexport const TdVanilla = forwardRef<HTMLTableCellElement, TdVanillaProps>(\n ({ subtle, align, className, css, style, ...props }, ref) => (\n <td\n ref={ref}\n className={cx(tdRecipe({ subtle, align }), className)}\n style={useInlineStyle(css, style)}\n {...props}\n />\n ),\n);\n\nTdVanilla.displayName = 'TdVanilla';\n\nexport type TrVanillaProps = React.HTMLAttributes<HTMLTableRowElement> &\n CSSProps &\n TrRecipeVariants &\n RowLinkShortcutProps & {\n /** Content shown in a full-width row below, toggled by a button in a new first cell. */\n collapsedContent?: ReactNode;\n /** Column span of the collapsed content row; set it to the number of columns. */\n collapsedContentColSpan?: number;\n /** Accessible name of the expand button. */\n expandLabel?: string;\n /** Adds an empty first cell, to line up with rows that have an expand button. */\n emptyFirstColumn?: boolean;\n /** Styles the empty first cell as a header, for a row in `TheadVanilla`. */\n tableHead?: boolean;\n };\n\nexport const TrVanilla = forwardRef<HTMLTableRowElement, TrVanillaProps>(\n (\n {\n collapsedContent,\n collapsedContentColSpan = 1,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n href,\n linkAs,\n linkCell,\n linkProps,\n linkOverlay,\n interactive,\n active,\n className,\n css,\n style,\n children,\n onClick,\n onAuxClick,\n ...props\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const contentId = useId();\n const inlineStyle = useInlineStyle(css, style);\n const collapsible = !!collapsedContent;\n\n return (\n <>\n <tr\n ref={ref}\n className={cx(\n trRecipe({ interactive: interactive ?? (href !== undefined || undefined), active }),\n rowLinkRow,\n className,\n )}\n data-collapsed={collapsible && !isOpen ? '' : undefined}\n style={inlineStyle}\n onClick={(event) => handleRowClick(event, onClick)}\n onAuxClick={(event) => {\n onAuxClick?.(event);\n openRowLink(event);\n }}\n {...props}\n >\n {emptyFirstColumn &&\n (tableHead ? <td className={cx(thRecipe(), emptyHeaderCell)} /> : <TdVanilla />)}\n {collapsible && (\n <TdVanilla className={toggleCell} onClick={stopEvent}>\n <ExpandToggleVanilla\n label={expandLabel}\n isOpen={isOpen}\n controls={contentId}\n onToggle={() => setIsOpen((open) => !open)}\n />\n </TdVanilla>\n )}\n {mapRowLink(\n children,\n { href, linkAs, linkCell, linkProps, linkOverlay },\n TdVanilla,\n RowLinkVanilla,\n { row: 'TrVanilla', cell: 'TdVanilla' },\n )}\n </tr>\n {collapsible && (\n <TrVanilla>\n <TdVanilla\n id={contentId}\n colSpan={collapsedContentColSpan}\n className={collapsedCell}\n data-closed={isOpen ? undefined : ''}\n >\n <div className={collapsedContentClass}>{collapsedContent}</div>\n </TdVanilla>\n </TrVanilla>\n )}\n </>\n );\n },\n);\n\nTrVanilla.displayName = 'TrVanilla';\n"],"mappings":";;;;;;;;;;;AA0CA,IAAa,eAAe,YACzB,EAAE,WAAW,WAAW,KAAK,OAAO,GAAG,SAAS,QAC/C,oBAAC,SAAD;CACO;CACL,WAAW,GAAG,YAAY,EAAE,UAAU,CAAC,GAAG,cAAc,SAAS;CACjE,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,aAAa,cAAc;AAM3B,IAAa,iBAAiB,YAE1B,EAAE,MAAM,QAAQ,SAAS,UAAU,WAAW,QAAQ,WAAW,KAAK,OAAO,GAAG,SAChF,QAEA,oBAAC,WAAD;CACO;CACL,WAAW,GACT,cAAc;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC,GACpE,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,eAAe,cAAc;AAI7B,IAAM,WAAW,KAAkC,cAAsB,gBAAwB;CAC/F,MAAM,UAAU,YACb,EAAE,WAAW,KAAK,OAAO,GAAG,SAAS,QACpC,oBAAC,KAAD;EACO;EACL,WAAW,GAAG,cAAc,SAAS;EACrC,OAAO,eAAe,KAAK,KAAK;EAChC,GAAI;CACL,CAAA,CAEL;CACA,QAAQ,cAAc;CACtB,OAAO;AACT;AAEA,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAClE,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAClE,IAAa,eAAe,QAAQ,SAAS,OAAO,cAAc;AAOlE,IAAa,YAAY,YAErB,EACE,MACA,QACA,SACA,UACA,WACA,QACA,OACA,MACA,QACA,WACA,KACA,OACA,UACA,GAAG,SAEL,QAEA,oBAAC,MAAD;CACO;CACL,aAAW,QAAQ,UAAU;CAC7B,WAAW,GACT,SAAS;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;EAAQ;CAAM,CAAC,GACtE,SACF;CACA,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;CAEH,UAAA,SACC,oBAAC,mBAAD;EAAyB;EAAc;EACpC;CACgB,CAAA,IAEnB;AAEA,CAAA,CAER;AAEA,UAAU,cAAc;AAMxB,IAAa,YAAY,YACtB,EAAE,QAAQ,OAAO,WAAW,KAAK,OAAO,GAAG,SAAS,QACnD,oBAAC,MAAD;CACO;CACL,WAAW,GAAG,SAAS;EAAE;EAAQ;CAAM,CAAC,GAAG,SAAS;CACpD,OAAO,eAAe,KAAK,KAAK;CAChC,GAAI;AACL,CAAA,CAEL;AAEA,UAAU,cAAc;AAkBxB,IAAa,YAAY,YAErB,EACE,kBAAA,oBACA,0BAA0B,GAC1B,cAAc,cACd,mBAAmB,OACnB,YAAY,OACZ,MACA,QACA,UACA,WACA,aACA,aACA,QACA,WACA,KACA,OACA,UACA,SACA,YACA,GAAG,SAEL,QACG;CACH,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAC1C,MAAM,YAAY,MAAM;CACxB,MAAM,cAAc,eAAe,KAAK,KAAK;CAC7C,MAAM,cAAc,CAAC,CAACA;CAEtB,OACE,qBAAAC,YAAA,EAAA,UAAA,CACE,qBAAC,MAAD;EACO;EACL,WAAW,GACT,SAAS;GAAE,aAAa,gBAAgB,SAAS,KAAA,KAAa,KAAA;GAAY;EAAO,CAAC,GAClF,YACA,SACF;EACA,kBAAgB,eAAe,CAAC,SAAS,KAAK,KAAA;EAC9C,OAAO;EACP,UAAU,UAAU,eAAe,OAAO,OAAO;EACjD,aAAa,UAAU;GACrB,aAAa,KAAK;GAClB,YAAY,KAAK;EACnB;EACA,GAAI;EAdN,UAAA;GAgBG,qBACE,YAAY,oBAAC,MAAD,EAAI,WAAW,GAAG,SAAS,GAAA,YAAkB,EAAI,CAAA,IAAI,oBAAC,WAAD,CAAY,CAAA;GAC/E,eACC,oBAAC,WAAD;IAAW,WAAA;IAAuB,SAAS;IACzC,UAAA,oBAAC,qBAAD;KACE,OAAO;KACC;KACR,UAAU;KACV,gBAAgB,WAAW,SAAS,CAAC,IAAI;IAC1C,CAAA;GACQ,CAAA;GAEZ,WACC,UACA;IAAE;IAAM;IAAQ;IAAU;IAAW;GAAY,GACjD,WACA,gBACA;IAAE,KAAK;IAAa,MAAM;GAAY,CACxC;EACE;CACH,CAAA,GAAA,eACC,oBAAC,WAAD,EAAA,UACE,oBAAC,WAAD;EACE,IAAI;EACJ,SAAS;EACT,WAAA;EACA,eAAa,SAAS,KAAA,IAAY;EAElC,UAAA,oBAAC,OAAD;GAAK,WAAA;GAAmC,UAAAD;EAAsB,CAAA;CACrD,CAAA,EACF,CAAA,CAEb,EAAA,CAAA;AAEN,CACF;AAEA,UAAU,cAAc"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
let react = require("react");
|
|
2
|
+
// components/Table/useTableSort.ts
|
|
3
|
+
/**
|
|
4
|
+
* Keeps the sorted column and direction, and gives each header its `sort` and `onSort`.
|
|
5
|
+
* It does not sort: pass `key` and `direction` to `sortRows`, or to the API.
|
|
6
|
+
*/
|
|
7
|
+
var useTableSort = ({ initialKey, initialDirection, newColumnDirection = "asc" }) => {
|
|
8
|
+
const [state, setState] = (0, react.useState)({
|
|
9
|
+
key: initialKey,
|
|
10
|
+
direction: initialDirection ?? newColumnDirection
|
|
11
|
+
});
|
|
12
|
+
const { key, direction } = state;
|
|
13
|
+
const toggle = (column) => setState((state) => state.key === column ? {
|
|
14
|
+
key: column,
|
|
15
|
+
direction: state.direction === "asc" ? "desc" : "asc"
|
|
16
|
+
} : {
|
|
17
|
+
key: column,
|
|
18
|
+
direction: newColumnDirection
|
|
19
|
+
});
|
|
20
|
+
const sortProps = (column) => ({
|
|
21
|
+
sort: column === key ? direction : void 0,
|
|
22
|
+
onSort: () => toggle(column)
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
key,
|
|
26
|
+
direction,
|
|
27
|
+
sortProps
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
var isEmpty = (value) => value === null || value === void 0 || value === "" || Number.isNaN(value);
|
|
31
|
+
var collator = new Intl.Collator(void 0, {
|
|
32
|
+
numeric: true,
|
|
33
|
+
sensitivity: "base"
|
|
34
|
+
});
|
|
35
|
+
var compareValues = (a, b) => {
|
|
36
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
37
|
+
if (typeof a === "number") return -1;
|
|
38
|
+
if (typeof b === "number") return 1;
|
|
39
|
+
return collator.compare(String(a), String(b));
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Returns a sorted copy of `rows`: numbers by value, then strings in locale order,
|
|
43
|
+
* ignoring case and comparing digit runs as numbers ("item2" before "item10").
|
|
44
|
+
* Empty values (`null`, `undefined`, `''`, `NaN`) go last in both directions. Ties keep their order.
|
|
45
|
+
*/
|
|
46
|
+
var sortRows = (rows, getValue, key, direction) => {
|
|
47
|
+
const factor = direction === "asc" ? 1 : -1;
|
|
48
|
+
return [...rows].sort((rowA, rowB) => {
|
|
49
|
+
const a = getValue(rowA, key);
|
|
50
|
+
const b = getValue(rowB, key);
|
|
51
|
+
const emptyA = isEmpty(a);
|
|
52
|
+
const emptyB = isEmpty(b);
|
|
53
|
+
if (emptyA || emptyB) return Number(emptyA) - Number(emptyB);
|
|
54
|
+
return factor * compareValues(a, b);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.sortRows = sortRows;
|
|
58
|
+
exports.useTableSort = useTableSort;
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=useTableSort.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableSort.cjs","names":["useState"],"sources":["../../../components/Table/useTableSort.ts"],"sourcesContent":["import { useState } from 'react';\n\nexport type TableSortDirection = 'asc' | 'desc';\n\nexport type TableSortProps = {\n /** The direction the column is sorted in, or `undefined` when it is not sorted. */\n sort?: TableSortDirection;\n /** Makes the column sortable: called when its header is clicked. */\n onSort?: () => void;\n};\n\nexport type UseTableSortOptions<K extends string> = {\n /** The column sorted on the first render. Later changes are ignored. */\n initialKey: K;\n /** The direction on the first render, `newColumnDirection` by default. Later changes are ignored. */\n initialDirection?: TableSortDirection;\n /** The direction a column is sorted in when it is clicked while another one is sorted. */\n newColumnDirection?: TableSortDirection;\n};\n\n/**\n * Keeps the sorted column and direction, and gives each header its `sort` and `onSort`.\n * It does not sort: pass `key` and `direction` to `sortRows`, or to the API.\n */\nexport const useTableSort = <K extends string>({\n initialKey,\n initialDirection,\n newColumnDirection = 'asc',\n}: UseTableSortOptions<K>) => {\n const [state, setState] = useState({\n key: initialKey,\n direction: initialDirection ?? newColumnDirection,\n });\n const { key, direction } = state;\n\n const toggle = (column: K) =>\n setState((state) =>\n state.key === column\n ? { key: column, direction: state.direction === 'asc' ? 'desc' : 'asc' }\n : { key: column, direction: newColumnDirection },\n );\n\n const sortProps = (column: K): TableSortProps => ({\n sort: column === key ? direction : undefined,\n onSort: () => toggle(column),\n });\n\n return { key, direction, sortProps };\n};\n\nexport type TableSortValue = string | number | null | undefined;\n\nconst isEmpty = (value: TableSortValue) =>\n value === null || value === undefined || value === '' || Number.isNaN(value);\n\nconst collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });\n\nconst compareValues = (a: TableSortValue, b: TableSortValue) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b;\n }\n if (typeof a === 'number') {\n return -1;\n }\n if (typeof b === 'number') {\n return 1;\n }\n return collator.compare(String(a), String(b));\n};\n\n/**\n * Returns a sorted copy of `rows`: numbers by value, then strings in locale order,\n * ignoring case and comparing digit runs as numbers (\"item2\" before \"item10\").\n * Empty values (`null`, `undefined`, `''`, `NaN`) go last in both directions. Ties keep their order.\n */\nexport const sortRows = <T, K extends string>(\n rows: readonly T[],\n getValue: (row: T, key: K) => TableSortValue,\n key: K,\n direction: TableSortDirection,\n): T[] => {\n const factor = direction === 'asc' ? 1 : -1;\n return [...rows].sort((rowA, rowB) => {\n const a = getValue(rowA, key);\n const b = getValue(rowB, key);\n const emptyA = isEmpty(a);\n const emptyB = isEmpty(b);\n if (emptyA || emptyB) {\n return Number(emptyA) - Number(emptyB);\n }\n return factor * compareValues(a, b);\n });\n};\n"],"mappings":";;;;;;AAwBA,IAAa,gBAAkC,EAC7C,YACA,kBACA,qBAAqB,YACO;CAC5B,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAS;EACjC,KAAK;EACL,WAAW,oBAAoB;CACjC,CAAC;CACD,MAAM,EAAE,KAAK,cAAc;CAE3B,MAAM,UAAU,WACd,UAAU,UACR,MAAM,QAAQ,SACV;EAAE,KAAK;EAAQ,WAAW,MAAM,cAAc,QAAQ,SAAS;CAAM,IACrE;EAAE,KAAK;EAAQ,WAAW;CAAmB,CACnD;CAEF,MAAM,aAAa,YAA+B;EAChD,MAAM,WAAW,MAAM,YAAY,KAAA;EACnC,cAAc,OAAO,MAAM;CAC7B;CAEA,OAAO;EAAE;EAAK;EAAW;CAAU;AACrC;AAIA,IAAM,WAAW,UACf,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO,MAAM,KAAK;AAE7E,IAAM,WAAW,IAAI,KAAK,SAAS,KAAA,GAAW;CAAE,SAAS;CAAM,aAAa;AAAO,CAAC;AAEpF,IAAM,iBAAiB,GAAmB,MAAsB;CAC9D,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UACxC,OAAO,IAAI;CAEb,IAAI,OAAO,MAAM,UACf,OAAO;CAET,IAAI,OAAO,MAAM,UACf,OAAO;CAET,OAAO,SAAS,QAAQ,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC9C;;;;;;AAOA,IAAa,YACX,MACA,UACA,KACA,cACQ;CACR,MAAM,SAAS,cAAc,QAAQ,IAAI;CACzC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,MAAM,SAAS;EACpC,MAAM,IAAI,SAAS,MAAM,GAAG;EAC5B,MAAM,IAAI,SAAS,MAAM,GAAG;EAC5B,MAAM,SAAS,QAAQ,CAAC;EACxB,MAAM,SAAS,QAAQ,CAAC;EACxB,IAAI,UAAU,QACZ,OAAO,OAAO,MAAM,IAAI,OAAO,MAAM;EAEvC,OAAO,SAAS,cAAc,GAAG,CAAC;CACpC,CAAC;AACH"}
|