@boostdev/design-system-components 2.13.0 → 2.14.1
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/client.cjs +52 -52
- package/dist/client.css +597 -597
- package/dist/client.js +52 -52
- package/dist/index.cjs +52 -52
- package/dist/index.css +597 -597
- package/dist/index.js +52 -52
- package/dist/web-components/{chunk-YFAXGRPR.js → chunk-6ZNQPSQJ.js} +1 -1
- package/dist/web-components/{chunk-JMCXAAFK.js → chunk-HBLJ4SLY.js} +2 -2
- package/dist/web-components/{chunk-F3ZDNHZZ.js → chunk-Z3BPJNEL.js} +1 -1
- package/dist/web-components/index.js +3 -3
- package/dist/web-components/interaction/bds-accordion-item.js +1 -1
- package/dist/web-components/interaction/bds-tabs.js +1 -1
- package/dist/web-components/ui/bds-table.js +1 -1
- package/package.json +1 -1
- package/src/components/ui/Accordion/Accordion.mdx +1 -0
- package/src/components/ui/Accordion/Accordion.module.css +1 -1
- package/src/components/ui/Table/Table.mdx +1 -0
- package/src/components/ui/Table/Table.module.css +2 -2
- package/src/components/ui/Tabs/Tabs.mdx +1 -0
- package/src/components/ui/Tabs/Tabs.module.css +1 -1
- package/src/stories/DesignSystem/TokenSets.mdx +22 -2
- package/src/test/token-contract.spec.ts +41 -0
- package/src/web-components/interaction/BdsAccordion.mdx +1 -0
- package/src/web-components/interaction/BdsTabs.mdx +1 -0
- package/src/web-components/interaction/bds-accordion-item.ts +1 -1
- package/src/web-components/interaction/bds-tabs.ts +1 -1
- package/src/web-components/ui/BdsTable.mdx +1 -0
- package/src/web-components/ui/bds-table.ts +2 -2
package/package.json
CHANGED
|
@@ -43,6 +43,7 @@ Vertically stacked sections that can be expanded and collapsed independently.
|
|
|
43
43
|
<tr><th>Variable</th><th>Default</th><th>Description</th></tr>
|
|
44
44
|
</thead>
|
|
45
45
|
<tbody>
|
|
46
|
+
<tr><td>`--accordion_divider-color`</td><td>`var(--bds-color_on-bg--as-surface)`</td><td>Colour of the rule between items — the non-text member of the colour set (≥ 3:1), not a ground colour</td></tr>
|
|
46
47
|
<tr><td>`--accordion_border`</td><td>`none`</td><td>Container border</td></tr>
|
|
47
48
|
<tr><td>`--accordion_radius`</td><td>`var(--bdc-outline_radius)`</td><td>Container corner radius</td></tr>
|
|
48
49
|
<tr><td>`--accordion_shadow`</td><td>`var(--bdc-outline_shadow)`</td><td>Container box-shadow tail (layered after the frame border)</td></tr>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.item {
|
|
16
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
16
|
+
border-block-end: 1px solid var(--accordion_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.item:last-child {
|
|
@@ -40,6 +40,7 @@ Data table with optional sortable columns and caption.
|
|
|
40
40
|
<tr><th>Variable</th><th>Default</th><th>Description</th></tr>
|
|
41
41
|
</thead>
|
|
42
42
|
<tbody>
|
|
43
|
+
<tr><td>`--table_divider-color`</td><td>`var(--bds-color_on-bg--as-surface)`</td><td>Colour of the header underline and the row rules — the non-text member of the colour set (≥ 3:1), not a ground colour</td></tr>
|
|
43
44
|
<tr><td>`--table_border`</td><td>`none`</td><td>Container border</td></tr>
|
|
44
45
|
<tr><td>`--table_radius`</td><td>`var(--bdc-outline_radius)`</td><td>Container corner radius</td></tr>
|
|
45
46
|
<tr><td>`--table_shadow`</td><td>`var(--bdc-outline_shadow)`</td><td>Container frame shadow (appended to the inset border box-shadow)</td></tr>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
font-size: var(--table_header-font-size, var(--bds-font_size--body--s));
|
|
42
42
|
color: var(--bds-color_on-bg--subtle);
|
|
43
43
|
white-space: nowrap;
|
|
44
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
44
|
+
border-block-end: 1px solid var(--table_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.th.--sortable {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.tbody .tr {
|
|
95
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
95
|
+
border-block-end: 1px solid var(--table_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
96
96
|
transition: var(--bds-animation_transition);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -74,6 +74,7 @@ Defaults: hover/active text resolves to `--bds-color_interactive_on-bg`; active
|
|
|
74
74
|
</thead>
|
|
75
75
|
<tbody>
|
|
76
76
|
<tr><td>`--tab_padding`</td><td>`var(--bds-space_s) var(--bds-space_m)`</td><td>Padding of each tab button.</td></tr>
|
|
77
|
+
<tr><td>`--tabs_divider-color`</td><td>`var(--bds-color_on-bg--as-surface)`</td><td>Colour of the rail under the tablist — the non-text member of the colour set (≥ 3:1), not a ground colour</td></tr>
|
|
77
78
|
<tr><td>`--tabs_gap`</td><td>`var(--bds-space_xxs)`</td><td>Gap between tab buttons in the tablist.</td></tr>
|
|
78
79
|
<tr><td>`--tabs_panel-padding`</td><td>`var(--bds-space_m)`</td><td>Block-start padding of the active panel.</td></tr>
|
|
79
80
|
</tbody>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.tabList {
|
|
8
8
|
display: flex;
|
|
9
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
9
|
+
border-block-end: 1px solid var(--tabs_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
10
10
|
gap: var(--tabs_gap, var(--bds-space_xxs));
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -149,8 +149,28 @@ something else:
|
|
|
149
149
|
</Split>
|
|
150
150
|
|
|
151
151
|
The requirement follows from **what** you place, not from **who** places it. That saves another
|
|
152
|
-
decision at the call site — which is why
|
|
153
|
-
|
|
152
|
+
decision at the call site — which is why every rule this library draws takes `--as-surface`:
|
|
153
|
+
`Separator`, the `DropdownMenu` divider, the `Drawer` header rule, the line between `Accordion`
|
|
154
|
+
items, the rail under the `Tabs` tablist, and the `Table`'s header underline and row rules. None of
|
|
155
|
+
them softens a text colour with a hand-rolled opacity, and none picks a shade at the call site.
|
|
156
|
+
|
|
157
|
+
### Both ways of getting it wrong
|
|
158
|
+
|
|
159
|
+
Without a name for the non-text member, the two colours nearest to hand are the text colour and the
|
|
160
|
+
ground colour — and both are wrong, in opposite directions. This library shipped one of each:
|
|
161
|
+
|
|
162
|
+
| | On a 1px rule against `bg` | |
|
|
163
|
+
|---|---|---|
|
|
164
|
+
| `--bds-color_on-bg` (text) | 21:1 light, 16:1 dark | far too loud — reads as a hard edge |
|
|
165
|
+
| `--bds-color_bg--subtle` (ground) | 1.1:1 light, 1.7:1 dark | far too faint — separates nothing |
|
|
166
|
+
| `--bds-color_on-bg--as-surface` | 4.8:1 light, 6.8:1 dark | over the 3:1 band, under the text colour |
|
|
167
|
+
|
|
168
|
+
The first is the tempting mistake, because the text colour is right there in the set and obviously
|
|
169
|
+
visible. The second is the tidy-looking mistake, because a ground colour feels appropriately quiet.
|
|
170
|
+
They come from the same gap: no third member, so the choice falls to whoever writes the line.
|
|
171
|
+
|
|
172
|
+
Both directions are checked in CI, not by review. A hairline may not be painted with an
|
|
173
|
+
`--bds-color_on-*` token, and it may not be painted with a `--bds-color_bg*` token either.
|
|
154
174
|
|
|
155
175
|
`--as-surface` exists on the base rung of `bg`, `primary`, `secondary` and `accent-1..3`. It is a
|
|
156
176
|
partner of the content side, so it is named `on-<x>--as-surface` and never on the surface side.
|
|
@@ -93,6 +93,9 @@ const NON_TEXT_MARKS: { file: string; rule: string }[] = [
|
|
|
93
93
|
{ file: 'components/ui/Separator/Separator.module.css', rule: '.separator' },
|
|
94
94
|
{ file: 'components/interaction/DropdownMenu/DropdownMenu.module.css', rule: '.separator' },
|
|
95
95
|
{ file: 'components/interaction/Drawer/Drawer.module.css', rule: '.header' },
|
|
96
|
+
{ file: 'components/ui/Accordion/Accordion.module.css', rule: '.item' },
|
|
97
|
+
{ file: 'components/ui/Tabs/Tabs.module.css', rule: '.tabList' },
|
|
98
|
+
{ file: 'components/ui/Table/Table.module.css', rule: '.th' },
|
|
96
99
|
];
|
|
97
100
|
|
|
98
101
|
describe('non-text marks use the as-surface member of the colour set', () => {
|
|
@@ -114,3 +117,41 @@ describe('non-text marks use the as-surface member of the colour set', () => {
|
|
|
114
117
|
});
|
|
115
118
|
}
|
|
116
119
|
});
|
|
120
|
+
|
|
121
|
+
// A surface token on a hairline is the mirror of the same mistake: `bg--subtle`
|
|
122
|
+
// on `bg` measures 1.10:1 in light and 1.72:1 in dark, well under the 3:1 a
|
|
123
|
+
// non-text mark needs. Dividers must not be painted with a ground colour.
|
|
124
|
+
// A ground colour is correct where the border is not separating anything: the
|
|
125
|
+
// Loading spinner's ring is the track its coloured arc rotates against, and is
|
|
126
|
+
// meant to recede. The contrast that matters there is arc-vs-track, not
|
|
127
|
+
// track-vs-page.
|
|
128
|
+
const GROUND_BORDER_EXEMPTIONS = ['Loading/Loading.module.css', 'bds-loading.ts'];
|
|
129
|
+
|
|
130
|
+
describe('no component paints a hairline with a background token', () => {
|
|
131
|
+
const srcRoot = join(__dirname, '../');
|
|
132
|
+
|
|
133
|
+
it('component CSS and web component styles', () => {
|
|
134
|
+
const offenders: string[] = [];
|
|
135
|
+
const files = [
|
|
136
|
+
...collectFiles(join(srcRoot, 'components'), '.module.css'),
|
|
137
|
+
...collectFiles(join(srcRoot, 'web-components'), '.ts').filter((f) => !f.endsWith('.spec.ts')),
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
for (const file of files) {
|
|
141
|
+
if (GROUND_BORDER_EXEMPTIONS.some((e) => file.endsWith(e))) continue;
|
|
142
|
+
|
|
143
|
+
const css = readFileSync(file, 'utf-8');
|
|
144
|
+
for (const [, side] of css.matchAll(
|
|
145
|
+
/border[\w-]*:\s*\d+px\s+solid\s+var\(--bds-color_(bg[\w-]*)\)/g,
|
|
146
|
+
)) {
|
|
147
|
+
offenders.push(` --bds-color_${side} in ${relative(srcRoot, file)}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (offenders.length > 0) {
|
|
152
|
+
expect.fail(
|
|
153
|
+
`Hairlines painted with a ground colour (needs --bds-color_on-X--as-surface):\n${offenders.join('\n')}`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
@@ -79,6 +79,7 @@ Or in HTML without a bundler:
|
|
|
79
79
|
|
|
80
80
|
| Property | Default | Description |
|
|
81
81
|
|----------|---------|-------------|
|
|
82
|
+
| `--accordion_divider-color` | `var(--bds-color_on-bg--as-surface)` | Colour of the rule between items — the non-text member of the colour set (≥ 3:1), not a ground colour |
|
|
82
83
|
| `--accordion_border` | `none` | Container border |
|
|
83
84
|
| `--accordion_radius` | `var(--bdc-outline_radius)` | Container corner radius |
|
|
84
85
|
| `--accordion_shadow` | `var(--bdc-outline_shadow)` | Container box-shadow tail (layered after the frame border) |
|
|
@@ -96,6 +96,7 @@ across every state; set `--tab_color--active` to theme only the selected tab.
|
|
|
96
96
|
|
|
97
97
|
| Property | Description |
|
|
98
98
|
|----------|-------------|
|
|
99
|
+
| `--tabs_divider-color` | Colour of the rail under the tablist (default: `--bds-color_on-bg--as-surface`, the non-text member of the set — ≥ 3:1, not a ground colour) |
|
|
99
100
|
| `--tab_color` | Tab text colour override (all states) |
|
|
100
101
|
| `--tab_border-color` | Tab bottom-border colour override (all states) |
|
|
101
102
|
| `--tab_color--active` | Text colour override for the selected tab |
|
|
@@ -39,7 +39,7 @@ export class BdsAccordionItem extends LitElement {
|
|
|
39
39
|
|
|
40
40
|
:host {
|
|
41
41
|
display: block;
|
|
42
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
42
|
+
border-block-end: 1px solid var(--accordion_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
:host(:last-child) {
|
|
@@ -43,7 +43,7 @@ export class BdsTabs extends LitElement {
|
|
|
43
43
|
|
|
44
44
|
.tablist {
|
|
45
45
|
display: flex;
|
|
46
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
46
|
+
border-block-end: 1px solid var(--tabs_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
47
47
|
gap: var(--bds-space_xxs);
|
|
48
48
|
}
|
|
49
49
|
`;
|
|
@@ -56,6 +56,7 @@ import '@boostdev/design-system-components/web-components';
|
|
|
56
56
|
|
|
57
57
|
| Property | Description |
|
|
58
58
|
|----------|-------------|
|
|
59
|
+
| `--table_divider-color` | Colour of the header underline and row rules (default: `--bds-color_on-bg--as-surface`, the non-text member of the set — ≥ 3:1, not a ground colour) |
|
|
59
60
|
| `--table_border` | Wrapper border (default: `none`) |
|
|
60
61
|
| `--table_radius` | Wrapper corner radius (default: `var(--bdc-outline_radius)`, itself set to `var(--bds-border_radius--s)` on the wrapper) |
|
|
61
62
|
| `--table_row-bg--hover` | Row background on hover, pointer devices only (default: `var(--bds-color_bg--subtle)`) |
|
|
@@ -20,13 +20,13 @@ const tableLightDomCss = `
|
|
|
20
20
|
font-size: var(--bds-font_size--body--s);
|
|
21
21
|
text-align: start;
|
|
22
22
|
color: var(--bds-color_on-bg--subtle);
|
|
23
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
23
|
+
border-block-end: 1px solid var(--table_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
24
24
|
white-space: nowrap;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
bds-table > table td {
|
|
28
28
|
padding: var(--bds-space_s) var(--bds-space_m);
|
|
29
|
-
border-block-end: 1px solid var(--bds-color_bg--subtle);
|
|
29
|
+
border-block-end: 1px solid var(--table_divider-color, var(--bds-color_on-bg--as-surface, var(--bds-color_on-bg--border, var(--bds-color_bg--subtle))));
|
|
30
30
|
vertical-align: middle;
|
|
31
31
|
}
|
|
32
32
|
|