@recursica/mui-adapter 0.28.0 → 0.29.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/CHANGELOG.md +16 -0
- package/dist/index.d.ts +45 -6
- package/dist/mui-adapter.cjs +62 -62
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +3436 -3413
- package/dist/mui-adapter.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Link/Link.module.css +4 -0
- package/src/components/Table/TABLE_IMPLEMENTATION_NOTES.md +64 -0
- package/src/components/Table/Table.module.css +443 -2
- package/src/components/Table/Table.stories.tsx +105 -0
- package/src/components/Table/Table.tsx +62 -5
- package/src/components/Table/USAGE.md +55 -16
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git+https://github.com/borderux/recursica.git",
|
|
14
14
|
"directory": "packages/mui-adapter"
|
|
15
15
|
},
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.29.0",
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
"vitest": "^3.2.4"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@recursica/adapter-common": "
|
|
106
|
-
"@recursica/official-release": "
|
|
105
|
+
"@recursica/adapter-common": "^0.20.0",
|
|
106
|
+
"@recursica/official-release": "^2.8.0",
|
|
107
107
|
"dayjs": "^1.11.21"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Table — Implementation Notes (Internal)
|
|
2
|
+
|
|
3
|
+
## Background
|
|
4
|
+
|
|
5
|
+
Unlike `mantine-adapter`, this package's `Table.module.css` was an empty stub — none of the
|
|
6
|
+
header/cell/footer/row tokens were wired at all (the "table-header/table-footer/table-cell, 88
|
|
7
|
+
tokens" gap from the 2026-08-21 token-analyzer review). This pass writes that CSS from scratch,
|
|
8
|
+
porting the structure/token references already proven out in `mantine-adapter`'s
|
|
9
|
+
`Table.module.css`, adapted to MUI's DOM and class model.
|
|
10
|
+
|
|
11
|
+
## One `Table.Cell`, not separate header/body/footer components
|
|
12
|
+
|
|
13
|
+
MUI's own `TableCell` is a single primitive for header, body, and footer cells — it auto-detects
|
|
14
|
+
which one it is (and whether to render `<th>` or `<td>`) from its ancestor
|
|
15
|
+
(`Table.Head`/`Table.Body`/`Table.Footer`). Recursica's `Table.Cell` mirrors that instead of
|
|
16
|
+
splitting into per-context components (see the Forge reference-implementation review,
|
|
17
|
+
2026-08-22, and direction from Matt the same day: align with the underlying kit's own
|
|
18
|
+
components). Its props cover both concerns: `sorted` (header-only in practice) and `variant`
|
|
19
|
+
(body/footer). `sorted` has no effect on styling unless the cell also carries the header's
|
|
20
|
+
`data-sorted`-driven CSS (i.e. it's meaningless on a body/footer cell) — nothing prevents a
|
|
21
|
+
caller from passing it there by mistake; that's an accepted tradeoff of unifying the three
|
|
22
|
+
contexts into one component, same tradeoff MUI's own `TableCell` makes.
|
|
23
|
+
|
|
24
|
+
## Every sub-component now attaches its own CSS module class
|
|
25
|
+
|
|
26
|
+
Before this change, `Table.Body`/`Table.Cell`/`Table.Container`/`Table.Head`/`Table.Row`/
|
|
27
|
+
`Table.Footer`/`Table.SortLabel` attached no Recursica class at all — only the root `Table` did.
|
|
28
|
+
`Table.Cell` and `Table.Row` now attach `.cell`/`.row` (needed so the CSS in `Table.module.css`
|
|
29
|
+
can select on state, e.g. `.cell[data-disabled="true"]`, instead of bare `td`/`tr` tag
|
|
30
|
+
selectors). `Table.SortLabel` attaches `.sortLabel` (see below). `Body`/`Container`/`Head`/
|
|
31
|
+
`Footer` were left alone — the CSS only needs to reach them structurally (`thead`/`tbody`/
|
|
32
|
+
`tfoot`), so they don't need a class of their own for this to work.
|
|
33
|
+
|
|
34
|
+
## Sort icon comes from `Table.SortLabel`, not `Table.Cell`
|
|
35
|
+
|
|
36
|
+
MUI already has a sortable-header primitive — `TableSortLabel` — that renders its own
|
|
37
|
+
arrow icon and flips it based on `direction`/`active`. `Table.Cell` only sets the sorted-state
|
|
38
|
+
_styling_ (`data-sorted` → background/text/font tokens, matching `mantine-adapter`'s `Table.Th`);
|
|
39
|
+
the icon itself is `Table.SortLabel`'s job, composed by the consumer the same way MUI's own docs
|
|
40
|
+
demonstrate (`<Table.Cell sorted><Table.SortLabel active direction="asc">Name</Table.SortLabel></Table.Cell>`).
|
|
41
|
+
`Table.module.css` re-colors the icon to `inherit` (overriding MUI's default sort-label color)
|
|
42
|
+
and sizes/spaces it with the same `table-header` icon-size/label-sort-gap tokens
|
|
43
|
+
`mantine-adapter` uses for its own inline chevron — see that adapter's `Table.icons.tsx` for the
|
|
44
|
+
Mantine-side equivalent. This is intentionally asymmetric between the two adapters: Mantine has
|
|
45
|
+
no equivalent primitive, so its `Table.Th` renders the chevron itself.
|
|
46
|
+
|
|
47
|
+
## MUI's own `.Mui-selected` background is reset
|
|
48
|
+
|
|
49
|
+
`Table.Row`'s `selected` prop passes straight through to MUI's native `TableRow.selected` (kept
|
|
50
|
+
for the `aria-selected`/`Mui-selected` semantics it drives) _and_ sets `data-selected`. Found via
|
|
51
|
+
screenshot comparison against `mantine-adapter` (2026-08-22): MUI's own default `.Mui-selected`
|
|
52
|
+
row background was compositing underneath our token-driven `.cell` background (semi-transparent
|
|
53
|
+
`color-mix` over MUI's own tint instead of over nothing), producing a visibly different color
|
|
54
|
+
than Mantine's. `Table.module.css` resets `.row:global(.Mui-selected)` to
|
|
55
|
+
`background-color: transparent` so only the Recursica token color shows — same
|
|
56
|
+
override-the-library's-own-styling rule the canonical guide documents for hover.
|
|
57
|
+
|
|
58
|
+
## Selectable rows (checkboxes)
|
|
59
|
+
|
|
60
|
+
See `mantine-adapter`'s `TABLE_IMPLEMENTATION_NOTES.md` — confirmed 2026-08-22 that neither
|
|
61
|
+
Mantine's nor MUI's base `Table` has a built-in checkbox-selection feature (MUI's only comes via
|
|
62
|
+
`@mui/x-data-grid`, not installed here). `Table.Row`'s `selected` prop maps directly onto MUI's
|
|
63
|
+
own native `TableRow.selected` (which already sets `aria-selected`/`Mui-selected`) plus a
|
|
64
|
+
`data-selected` attribute so our CSS selectors stay identical in shape to `mantine-adapter`'s.
|
|
@@ -1,7 +1,448 @@
|
|
|
1
|
+
/* Brand-layer exemptions (recursica-allow-brand) — see recursica-token-analyzer README.md.
|
|
2
|
+
* Global hover state tokens (recursica_variables_scoped.css header, 'Hover & Focus states' —
|
|
3
|
+
* implicit rule for every interactive element; components must not define their own
|
|
4
|
+
* per-component hover treatment).
|
|
5
|
+
* recursica-allow-brand: --recursica_brand_states_hover_color
|
|
6
|
+
* recursica-allow-brand: --recursica_brand_states_hover_opacity
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
/* HARDCODED VALUES:
|
|
2
|
-
*
|
|
10
|
+
* - border-collapse: separate; border-spacing: 0; (To support custom border-radius on table elements)
|
|
11
|
+
* - overflow: hidden; (To prevent content from bleeding outside the rounded table border)
|
|
3
12
|
*/
|
|
4
13
|
|
|
5
14
|
.root {
|
|
6
|
-
|
|
15
|
+
border-collapse: separate;
|
|
16
|
+
border-spacing: 0;
|
|
17
|
+
border-radius: var(
|
|
18
|
+
--recursica_ui-kit_components_table_properties_border-radius
|
|
19
|
+
);
|
|
20
|
+
border: var(--recursica_ui-kit_components_table_properties_border-size) solid
|
|
21
|
+
var(--recursica_ui-kit_components_table_properties_colors_border-color);
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* ==========================================
|
|
26
|
+
1. General Cell Dividers & Padding Defaults
|
|
27
|
+
========================================== */
|
|
28
|
+
|
|
29
|
+
.root .cell {
|
|
30
|
+
padding: var(--recursica_ui-kit_components_table_properties_row-padding)
|
|
31
|
+
var(--recursica_ui-kit_components_table_properties_padding);
|
|
32
|
+
border-bottom: var(
|
|
33
|
+
--recursica_ui-kit_components_table_properties_row-divider-size
|
|
34
|
+
)
|
|
35
|
+
solid
|
|
36
|
+
var(--recursica_ui-kit_components_table_properties_colors_row-divider-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.root .cell + .cell {
|
|
40
|
+
border-left: var(
|
|
41
|
+
--recursica_ui-kit_components_table_properties_column-divider-size
|
|
42
|
+
)
|
|
43
|
+
solid
|
|
44
|
+
var(
|
|
45
|
+
--recursica_ui-kit_components_table_properties_colors_column-divider-color
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* ==========================================
|
|
50
|
+
2. Row Highlighting & Selection Styles
|
|
51
|
+
========================================== */
|
|
52
|
+
|
|
53
|
+
/* Striped rows */
|
|
54
|
+
.root tbody .row:nth-of-type(even) .cell {
|
|
55
|
+
background-color: color-mix(
|
|
56
|
+
in srgb,
|
|
57
|
+
var(--recursica_ui-kit_components_table_properties_colors_striped-color)
|
|
58
|
+
calc(
|
|
59
|
+
var(
|
|
60
|
+
--recursica_ui-kit_components_table_properties_opacities_striped-opacity
|
|
61
|
+
) *
|
|
62
|
+
100%
|
|
63
|
+
),
|
|
64
|
+
transparent
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* MUI's TableRow applies its own default background when `selected` — reset it so only the
|
|
69
|
+
token-driven .cell background below shows (kept as a genuine `<tr selected>` for the
|
|
70
|
+
aria-selected/Mui-selected semantics MUI derives from it, just not its default coloring). */
|
|
71
|
+
.root tbody .row:global(.Mui-selected) {
|
|
72
|
+
background-color: transparent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Selected rows */
|
|
76
|
+
.root tbody .row[data-selected="true"] .cell {
|
|
77
|
+
background-color: color-mix(
|
|
78
|
+
in srgb,
|
|
79
|
+
var(--recursica_ui-kit_components_table_properties_colors_selected-color)
|
|
80
|
+
calc(
|
|
81
|
+
var(
|
|
82
|
+
--recursica_ui-kit_components_table_properties_opacities_selected-opacity
|
|
83
|
+
) *
|
|
84
|
+
100%
|
|
85
|
+
),
|
|
86
|
+
transparent
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Hover rows */
|
|
91
|
+
/* Table's dedicated highlight-on-hover token was removed from the schema; hover feedback now
|
|
92
|
+
uses the generic cross-component overlay tokens instead. */
|
|
93
|
+
.root tbody .row:hover .cell {
|
|
94
|
+
background-color: color-mix(
|
|
95
|
+
in srgb,
|
|
96
|
+
var(--recursica_brand_states_hover_color)
|
|
97
|
+
calc(var(--recursica_brand_states_hover_opacity) * 100%),
|
|
98
|
+
transparent
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* ==========================================
|
|
103
|
+
3. Table Headers (th)
|
|
104
|
+
========================================== */
|
|
105
|
+
|
|
106
|
+
.root thead .cell {
|
|
107
|
+
background-color: var(
|
|
108
|
+
--recursica_ui-kit_components_table-header_properties_colors_cell-color
|
|
109
|
+
);
|
|
110
|
+
color: var(
|
|
111
|
+
--recursica_ui-kit_components_table-header_properties_colors_text-color
|
|
112
|
+
);
|
|
113
|
+
padding: var(
|
|
114
|
+
--recursica_ui-kit_components_table-header_properties_padding-vertical
|
|
115
|
+
)
|
|
116
|
+
var(
|
|
117
|
+
--recursica_ui-kit_components_table-header_properties_padding-horizontal
|
|
118
|
+
);
|
|
119
|
+
margin-top: var(
|
|
120
|
+
--recursica_ui-kit_components_table-header_properties_vertical-margin
|
|
121
|
+
);
|
|
122
|
+
margin-bottom: var(
|
|
123
|
+
--recursica_ui-kit_components_table-header_properties_vertical-margin
|
|
124
|
+
);
|
|
125
|
+
border-bottom: var(
|
|
126
|
+
--recursica_ui-kit_components_table-header_properties_horizontal-divider-size
|
|
127
|
+
)
|
|
128
|
+
solid
|
|
129
|
+
var(
|
|
130
|
+
--recursica_ui-kit_components_table-header_properties_colors_horizontal-divider-color
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
/* Unsorted text style by default */
|
|
134
|
+
font-family: var(
|
|
135
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_font-family
|
|
136
|
+
);
|
|
137
|
+
font-size: var(
|
|
138
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_font-size
|
|
139
|
+
);
|
|
140
|
+
font-style: var(
|
|
141
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_font-style
|
|
142
|
+
);
|
|
143
|
+
font-weight: var(
|
|
144
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_font-weight
|
|
145
|
+
);
|
|
146
|
+
letter-spacing: var(
|
|
147
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_letter-spacing
|
|
148
|
+
);
|
|
149
|
+
line-height: var(
|
|
150
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_line-height
|
|
151
|
+
);
|
|
152
|
+
text-decoration: var(
|
|
153
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_text-decoration
|
|
154
|
+
);
|
|
155
|
+
text-transform: var(
|
|
156
|
+
--recursica_ui-kit_components_table-header_properties_unsorted-text-style_text-transform
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.root thead .cell + .cell {
|
|
161
|
+
border-left: var(
|
|
162
|
+
--recursica_ui-kit_components_table-header_properties_vertical-divider-size
|
|
163
|
+
)
|
|
164
|
+
solid
|
|
165
|
+
var(
|
|
166
|
+
--recursica_ui-kit_components_table-header_properties_colors_vertical-divider-color
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Unsorted specific state overrides */
|
|
171
|
+
.root thead .cell:not([data-sorted="true"]) {
|
|
172
|
+
background-color: var(
|
|
173
|
+
--recursica_ui-kit_components_table-header_properties_colors_unsorted-cell-color
|
|
174
|
+
);
|
|
175
|
+
color: var(
|
|
176
|
+
--recursica_ui-kit_components_table-header_properties_colors_unsorted-text-color
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* Sorted specific state overrides */
|
|
181
|
+
.root thead .cell[data-sorted="true"] {
|
|
182
|
+
background-color: var(
|
|
183
|
+
--recursica_ui-kit_components_table-header_properties_colors_sorted-cell-color
|
|
184
|
+
);
|
|
185
|
+
color: var(
|
|
186
|
+
--recursica_ui-kit_components_table-header_properties_colors_sorted-text-color
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
font-family: var(
|
|
190
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_font-family
|
|
191
|
+
);
|
|
192
|
+
font-size: var(
|
|
193
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_font-size
|
|
194
|
+
);
|
|
195
|
+
font-style: var(
|
|
196
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_font-style
|
|
197
|
+
);
|
|
198
|
+
font-weight: var(
|
|
199
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_font-weight
|
|
200
|
+
);
|
|
201
|
+
letter-spacing: var(
|
|
202
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_letter-spacing
|
|
203
|
+
);
|
|
204
|
+
line-height: var(
|
|
205
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_line-height
|
|
206
|
+
);
|
|
207
|
+
text-decoration: var(
|
|
208
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_text-decoration
|
|
209
|
+
);
|
|
210
|
+
text-transform: var(
|
|
211
|
+
--recursica_ui-kit_components_table-header_properties_sorted-text-style_text-transform
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* Disabled Header */
|
|
216
|
+
.root thead .cell[data-disabled="true"] {
|
|
217
|
+
background-color: var(
|
|
218
|
+
--recursica_ui-kit_components_table-header_variants_states_disabled_properties_colors_cell-color
|
|
219
|
+
);
|
|
220
|
+
color: var(
|
|
221
|
+
--recursica_ui-kit_components_table-header_variants_states_disabled_properties_colors_text-color
|
|
222
|
+
);
|
|
223
|
+
opacity: var(
|
|
224
|
+
--recursica_ui-kit_components_table-header_variants_states_disabled_properties_opacity
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Sort label — MUI's TableSortLabel renders its own arrow icon; re-color it to inherit the
|
|
229
|
+
cell's own text color (instead of MUI's default sort-label color) and size/space it with the
|
|
230
|
+
same tokens Mantine's own inline chevron uses. */
|
|
231
|
+
.sortLabel {
|
|
232
|
+
color: inherit;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.sortLabel:global(.Mui-active) {
|
|
236
|
+
color: inherit;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.sortLabel :global(.MuiTableSortLabel-icon) {
|
|
240
|
+
width: var(--recursica_ui-kit_components_table-header_properties_icon-size);
|
|
241
|
+
height: var(--recursica_ui-kit_components_table-header_properties_icon-size);
|
|
242
|
+
margin-left: var(
|
|
243
|
+
--recursica_ui-kit_components_table-header_properties_label-sort-gap
|
|
244
|
+
);
|
|
245
|
+
color: inherit;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* ==========================================
|
|
249
|
+
4. Table Cells (td)
|
|
250
|
+
========================================== */
|
|
251
|
+
|
|
252
|
+
.root tbody .cell {
|
|
253
|
+
background-color: var(
|
|
254
|
+
--recursica_ui-kit_components_table-cell_properties_colors_cell-color
|
|
255
|
+
);
|
|
256
|
+
color: var(
|
|
257
|
+
--recursica_ui-kit_components_table-cell_properties_colors_text-color
|
|
258
|
+
);
|
|
259
|
+
padding: var(
|
|
260
|
+
--recursica_ui-kit_components_table-cell_properties_padding-vertical
|
|
261
|
+
)
|
|
262
|
+
var(--recursica_ui-kit_components_table-cell_properties_padding-horizontal);
|
|
263
|
+
max-width: var(--recursica_ui-kit_components_table-cell_properties_max-width);
|
|
264
|
+
|
|
265
|
+
/* Standard text style */
|
|
266
|
+
font-family: var(
|
|
267
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_font-family
|
|
268
|
+
);
|
|
269
|
+
font-size: var(
|
|
270
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_font-size
|
|
271
|
+
);
|
|
272
|
+
font-style: var(
|
|
273
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_font-style
|
|
274
|
+
);
|
|
275
|
+
font-weight: var(
|
|
276
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_font-weight
|
|
277
|
+
);
|
|
278
|
+
letter-spacing: var(
|
|
279
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_letter-spacing
|
|
280
|
+
);
|
|
281
|
+
line-height: var(
|
|
282
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_line-height
|
|
283
|
+
);
|
|
284
|
+
text-align: var(
|
|
285
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_text-align
|
|
286
|
+
);
|
|
287
|
+
text-decoration: var(
|
|
288
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_text-decoration
|
|
289
|
+
);
|
|
290
|
+
text-transform: var(
|
|
291
|
+
--recursica_ui-kit_components_table-cell_properties_text-style_text-transform
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* Currency formatted cell layout override */
|
|
296
|
+
.root tbody .cell[data-currency="true"] {
|
|
297
|
+
font-family: var(
|
|
298
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_font-family
|
|
299
|
+
);
|
|
300
|
+
font-size: var(
|
|
301
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_font-size
|
|
302
|
+
);
|
|
303
|
+
font-style: var(
|
|
304
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_font-style
|
|
305
|
+
);
|
|
306
|
+
font-weight: var(
|
|
307
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_font-weight
|
|
308
|
+
);
|
|
309
|
+
letter-spacing: var(
|
|
310
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_letter-spacing
|
|
311
|
+
);
|
|
312
|
+
line-height: var(
|
|
313
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_line-height
|
|
314
|
+
);
|
|
315
|
+
text-align: var(
|
|
316
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_text-align
|
|
317
|
+
);
|
|
318
|
+
text-decoration: var(
|
|
319
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_text-decoration
|
|
320
|
+
);
|
|
321
|
+
text-transform: var(
|
|
322
|
+
--recursica_ui-kit_components_table-cell_properties_currency-style_text-transform
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/* Disabled Cells */
|
|
327
|
+
.root tbody .row[data-disabled="true"] .cell,
|
|
328
|
+
.root tbody .cell[data-disabled="true"] {
|
|
329
|
+
background-color: var(
|
|
330
|
+
--recursica_ui-kit_components_table-cell_variants_states_disabled_properties_colors_cell-color
|
|
331
|
+
);
|
|
332
|
+
color: var(
|
|
333
|
+
--recursica_ui-kit_components_table-cell_variants_states_disabled_properties_colors_text-color
|
|
334
|
+
);
|
|
335
|
+
opacity: var(
|
|
336
|
+
--recursica_ui-kit_components_table-cell_variants_states_disabled_properties_opacity
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* ==========================================
|
|
341
|
+
5. Table Footers (tfoot td)
|
|
342
|
+
========================================== */
|
|
343
|
+
|
|
344
|
+
.root tfoot .cell {
|
|
345
|
+
background-color: var(
|
|
346
|
+
--recursica_ui-kit_components_table-footer_properties_colors_cell-color
|
|
347
|
+
);
|
|
348
|
+
color: var(
|
|
349
|
+
--recursica_ui-kit_components_table-footer_properties_colors_text-color
|
|
350
|
+
);
|
|
351
|
+
padding: var(
|
|
352
|
+
--recursica_ui-kit_components_table-footer_properties_padding-vertical
|
|
353
|
+
)
|
|
354
|
+
var(
|
|
355
|
+
--recursica_ui-kit_components_table-footer_properties_padding-horizontal
|
|
356
|
+
);
|
|
357
|
+
margin-top: var(
|
|
358
|
+
--recursica_ui-kit_components_table-footer_properties_vertical-margin
|
|
359
|
+
);
|
|
360
|
+
margin-bottom: var(
|
|
361
|
+
--recursica_ui-kit_components_table-footer_properties_vertical-margin
|
|
362
|
+
);
|
|
363
|
+
border-top: var(
|
|
364
|
+
--recursica_ui-kit_components_table-footer_properties_horizontal-divider-size
|
|
365
|
+
)
|
|
366
|
+
solid
|
|
367
|
+
var(
|
|
368
|
+
--recursica_ui-kit_components_table-footer_properties_colors_horizontal-divider-color
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
/* Footer typography style */
|
|
372
|
+
font-family: var(
|
|
373
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_font-family
|
|
374
|
+
);
|
|
375
|
+
font-size: var(
|
|
376
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_font-size
|
|
377
|
+
);
|
|
378
|
+
font-style: var(
|
|
379
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_font-style
|
|
380
|
+
);
|
|
381
|
+
font-weight: var(
|
|
382
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_font-weight
|
|
383
|
+
);
|
|
384
|
+
letter-spacing: var(
|
|
385
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_letter-spacing
|
|
386
|
+
);
|
|
387
|
+
line-height: var(
|
|
388
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_line-height
|
|
389
|
+
);
|
|
390
|
+
text-decoration: var(
|
|
391
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_text-decoration
|
|
392
|
+
);
|
|
393
|
+
text-transform: var(
|
|
394
|
+
--recursica_ui-kit_components_table-footer_properties_text-style_text-transform
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.root tfoot .cell + .cell {
|
|
399
|
+
border-left: var(
|
|
400
|
+
--recursica_ui-kit_components_table-footer_properties_vertical-divider-size
|
|
401
|
+
)
|
|
402
|
+
solid
|
|
403
|
+
var(
|
|
404
|
+
--recursica_ui-kit_components_table-footer_properties_colors_vertical-divider-color
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* Currency formatted footer cell layout override */
|
|
409
|
+
.root tfoot .cell[data-currency="true"] {
|
|
410
|
+
font-family: var(
|
|
411
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_font-family
|
|
412
|
+
);
|
|
413
|
+
font-size: var(
|
|
414
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_font-size
|
|
415
|
+
);
|
|
416
|
+
font-style: var(
|
|
417
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_font-style
|
|
418
|
+
);
|
|
419
|
+
font-weight: var(
|
|
420
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_font-weight
|
|
421
|
+
);
|
|
422
|
+
letter-spacing: var(
|
|
423
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_letter-spacing
|
|
424
|
+
);
|
|
425
|
+
line-height: var(
|
|
426
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_line-height
|
|
427
|
+
);
|
|
428
|
+
text-decoration: var(
|
|
429
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_text-decoration
|
|
430
|
+
);
|
|
431
|
+
text-transform: var(
|
|
432
|
+
--recursica_ui-kit_components_table-footer_properties_currency-style_text-transform
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* Disabled Footer Row/Cells */
|
|
437
|
+
.root tfoot .row[data-disabled="true"] .cell,
|
|
438
|
+
.root tfoot .cell[data-disabled="true"] {
|
|
439
|
+
background-color: var(
|
|
440
|
+
--recursica_ui-kit_components_table-footer_variants_states_disabled_properties_colors_cell-color
|
|
441
|
+
);
|
|
442
|
+
color: var(
|
|
443
|
+
--recursica_ui-kit_components_table-footer_variants_states_disabled_properties_colors_text-color
|
|
444
|
+
);
|
|
445
|
+
opacity: var(
|
|
446
|
+
--recursica_ui-kit_components_table-footer_variants_states_disabled_properties_opacity
|
|
447
|
+
);
|
|
7
448
|
}
|
|
@@ -47,3 +47,108 @@ export const Default: Story = {
|
|
|
47
47
|
);
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
|
+
|
|
51
|
+
export const SortedColumn: Story = {
|
|
52
|
+
render: () => {
|
|
53
|
+
const sorted = [...elements].sort((a, b) => a.mass - b.mass);
|
|
54
|
+
const rows = sorted.map((element) => (
|
|
55
|
+
<Table.Row key={element.name}>
|
|
56
|
+
<Table.Cell>{element.position}</Table.Cell>
|
|
57
|
+
<Table.Cell>{element.name}</Table.Cell>
|
|
58
|
+
<Table.Cell>{element.symbol}</Table.Cell>
|
|
59
|
+
<Table.Cell>{element.mass}</Table.Cell>
|
|
60
|
+
</Table.Row>
|
|
61
|
+
));
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Table.Container>
|
|
65
|
+
<Table>
|
|
66
|
+
<Table.Head>
|
|
67
|
+
<Table.Row>
|
|
68
|
+
<Table.Cell>Element position</Table.Cell>
|
|
69
|
+
<Table.Cell>Element name</Table.Cell>
|
|
70
|
+
<Table.Cell>Symbol</Table.Cell>
|
|
71
|
+
<Table.Cell sorted="asc">
|
|
72
|
+
<Table.SortLabel active direction="asc">
|
|
73
|
+
Atomic mass
|
|
74
|
+
</Table.SortLabel>
|
|
75
|
+
</Table.Cell>
|
|
76
|
+
</Table.Row>
|
|
77
|
+
</Table.Head>
|
|
78
|
+
<Table.Body>{rows}</Table.Body>
|
|
79
|
+
</Table>
|
|
80
|
+
</Table.Container>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const SelectedAndDisabledRows: Story = {
|
|
86
|
+
render: () => (
|
|
87
|
+
<Table.Container>
|
|
88
|
+
<Table>
|
|
89
|
+
<Table.Head>
|
|
90
|
+
<Table.Row>
|
|
91
|
+
<Table.Cell>Element position</Table.Cell>
|
|
92
|
+
<Table.Cell>Element name</Table.Cell>
|
|
93
|
+
<Table.Cell>Symbol</Table.Cell>
|
|
94
|
+
<Table.Cell>Atomic mass</Table.Cell>
|
|
95
|
+
</Table.Row>
|
|
96
|
+
</Table.Head>
|
|
97
|
+
<Table.Body>
|
|
98
|
+
{elements.map((element, index) => (
|
|
99
|
+
<Table.Row
|
|
100
|
+
key={element.name}
|
|
101
|
+
selected={index === 0}
|
|
102
|
+
disabled={index === elements.length - 1}
|
|
103
|
+
>
|
|
104
|
+
<Table.Cell>{element.position}</Table.Cell>
|
|
105
|
+
<Table.Cell>{element.name}</Table.Cell>
|
|
106
|
+
<Table.Cell>{element.symbol}</Table.Cell>
|
|
107
|
+
<Table.Cell>{element.mass}</Table.Cell>
|
|
108
|
+
</Table.Row>
|
|
109
|
+
))}
|
|
110
|
+
</Table.Body>
|
|
111
|
+
</Table>
|
|
112
|
+
</Table.Container>
|
|
113
|
+
),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const CurrencyColumnWithFooter: Story = {
|
|
117
|
+
render: () => {
|
|
118
|
+
const prices = [
|
|
119
|
+
{ item: "Widget", price: 19.99 },
|
|
120
|
+
{ item: "Gadget", price: 49.5 },
|
|
121
|
+
{ item: "Gizmo", price: 9.25 },
|
|
122
|
+
];
|
|
123
|
+
const total = prices.reduce((sum, row) => sum + row.price, 0);
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<Table.Container>
|
|
127
|
+
<Table>
|
|
128
|
+
<Table.Head>
|
|
129
|
+
<Table.Row>
|
|
130
|
+
<Table.Cell>Item</Table.Cell>
|
|
131
|
+
<Table.Cell>Price</Table.Cell>
|
|
132
|
+
</Table.Row>
|
|
133
|
+
</Table.Head>
|
|
134
|
+
<Table.Body>
|
|
135
|
+
{prices.map((row) => (
|
|
136
|
+
<Table.Row key={row.item}>
|
|
137
|
+
<Table.Cell>{row.item}</Table.Cell>
|
|
138
|
+
<Table.Cell variant="currency">
|
|
139
|
+
${row.price.toFixed(2)}
|
|
140
|
+
</Table.Cell>
|
|
141
|
+
</Table.Row>
|
|
142
|
+
))}
|
|
143
|
+
</Table.Body>
|
|
144
|
+
<Table.Footer>
|
|
145
|
+
<Table.Row>
|
|
146
|
+
<Table.Cell>Total</Table.Cell>
|
|
147
|
+
<Table.Cell variant="currency">${total.toFixed(2)}</Table.Cell>
|
|
148
|
+
</Table.Row>
|
|
149
|
+
</Table.Footer>
|
|
150
|
+
</Table>
|
|
151
|
+
</Table.Container>
|
|
152
|
+
);
|
|
153
|
+
},
|
|
154
|
+
};
|