@repobit/dex-system-design 2.5.1 → 2.6.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 +84 -0
- package/README.md +2 -1
- package/package.json +14 -27
- package/schemas/component-manifest.json +226 -33
- package/schemas/manifest-omissions.json +23 -0
- package/src/components/accordion/accordion-bg.css.js +39 -30
- package/src/components/accordion/accordion-bg.js +17 -28
- package/src/components/accordion/accordion-bg.stories.js +5 -0
- package/src/components/accordion/accordion-panel.js +24 -0
- package/src/components/accordion/accordion.css.js +105 -111
- package/src/components/accordion/accordion.js +23 -37
- package/src/components/accordion/accordion.stories.js +5 -1
- package/src/components/anchor/anchor-nav.css.js +131 -53
- package/src/components/anchor/anchor-nav.js +276 -201
- package/src/components/annotation/annotation.css.js +7 -4
- package/src/components/architecture.stories.js +8 -7
- package/src/components/audience-card/audience-card.css.js +30 -4
- package/src/components/audience-card/audience-card.js +8 -13
- package/src/components/awards/awards-flex.css.js +23 -6
- package/src/components/awards/awards-flex.js +21 -6
- package/src/components/awards/awards-spotlight.css.js +25 -5
- package/src/components/awards/awards-spotlight.js +19 -7
- package/src/components/awards/awards.css.js +20 -8
- package/src/components/awards/awards.js +30 -91
- package/src/components/awards/awards.stories.js +5 -5
- package/src/components/awards/scroll-slides.js +128 -0
- package/src/components/back/back.css.js +2 -0
- package/src/components/badge/badge.css.js +15 -0
- package/src/components/bento-grid/bento-grid.css.js +105 -11
- package/src/components/bento-grid/bento-grid.js +37 -124
- package/src/components/bento-grid/bento-grid.stories.js +3 -2
- package/src/components/bento-grid/bento-item.css.js +71 -32
- package/src/components/bento-grid/bento-item.js +1 -30
- package/src/components/blockquote/blockquote.css.js +2 -2
- package/src/components/breadcrumb/breadcrumb.css.js +10 -9
- package/src/components/breadcrumb/breadcrumb.js +35 -34
- package/src/components/button/button.css.js +42 -17
- package/src/components/button/button.js +84 -3
- package/src/components/button/button.stories.js +17 -0
- package/src/components/card-features/card-features.css.js +23 -2
- package/src/components/card-features/card-features.js +6 -48
- package/src/components/cards/card.css.js +43 -14
- package/src/components/cards/card.js +43 -177
- package/src/components/cards/card.stories.js +8 -10
- package/src/components/carousel/carousel.css.js +101 -70
- package/src/components/carousel/carousel.js +107 -71
- package/src/components/carousel/carousel.stories.js +18 -16
- package/src/components/checkbox/checkbox.css.js +26 -9
- package/src/components/checkbox/checkbox.js +73 -39
- package/src/components/checkbox/checkbox.stories.js +35 -18
- package/src/components/compare/compare.css.js +68 -10
- package/src/components/compare/compare.js +40 -103
- package/src/components/compare/compare.stories.js +1 -1
- package/src/components/compatibility-table/compatibility-table.css.js +70 -37
- package/src/components/compatibility-table/compatibility-table.js +47 -40
- package/src/components/compatibility-table/compatibility-table.stories.js +78 -1
- package/src/components/display/display.css.js +7 -0
- package/src/components/dropdown/dropdown.css.js +20 -3
- package/src/components/dropdown/dropdown.js +57 -21
- package/src/components/dropdown/dropdown.stories.js +31 -9
- package/src/components/features/features.css.js +56 -21
- package/src/components/features/features.js +7 -117
- package/src/components/fieldset/fieldset.stories.js +68 -0
- package/src/components/footer/footer-images.js +34 -0
- package/src/components/footer/footer-links-group.css.js +10 -10
- package/src/components/footer/footer-locale.js +47 -0
- package/src/components/footer/footer-lp.js +27 -114
- package/src/components/footer/footer-lp.stories.js +2 -2
- package/src/components/footer/footer-nav-menu.css.js +2 -2
- package/src/components/footer/footer-nav-menu.js +8 -3
- package/src/components/footer/footer.css.js +238 -197
- package/src/components/footer/footer.js +109 -187
- package/src/components/footer/footer.stories.js +14 -4
- package/src/components/grid/grid.css.js +64 -5
- package/src/components/header/header-code.css.js +20 -11
- package/src/components/header/header-code.js +1 -1
- package/src/components/header/header.css.js +20 -14
- package/src/components/header/header.js +6 -7
- package/src/components/header/header.stories.js +29 -24
- package/src/components/heading/heading.css.js +11 -0
- package/src/components/hero/hero.js +10 -2
- package/src/components/highlight/highlight.css.js +30 -6
- package/src/components/icons/arrow-icon.js +4 -1
- package/src/components/icons/arrow-right-icon.js +5 -1
- package/src/components/icons/icon-element.js +18 -0
- package/src/components/image/image.js +29 -9
- package/src/components/image/image.stories.js +38 -2
- package/src/components/input/custom-form.stories.js +38 -7
- package/src/components/input/input-clipboard.css.js +15 -1
- package/src/components/input/input-clipboard.js +84 -21
- package/src/components/input/input.js +27 -7
- package/src/components/install-options/install-options.css.js +26 -6
- package/src/components/install-options/install-options.js +32 -8
- package/src/components/label/label.css.js +1 -1
- package/src/components/light-carousel/light-carousel.css.js +100 -48
- package/src/components/light-carousel/light-carousel.js +43 -5
- package/src/components/link/link.css.js +15 -15
- package/src/components/link/link.js +17 -1
- package/src/components/link/link.stories.js +20 -7
- package/src/components/list/list.css.js +3 -3
- package/src/components/logo-marquee/logo-marquee.css.js +12 -1
- package/src/components/logo-marquee/logo-marquee.js +33 -8
- package/src/components/logo-marquee/logo-marquee.stories.js +10 -4
- package/src/components/modal/modal.css.js +74 -40
- package/src/components/modal/modal.js +85 -74
- package/src/components/modal/modal.stories.js +27 -14
- package/src/components/motion-art/motion-art.js +67 -1
- package/src/components/page-switcher/page-switcher.css.js +27 -9
- package/src/components/page-switcher/page-switcher.js +11 -8
- package/src/components/partner-banner/partner-banner.css.js +2 -0
- package/src/components/picture/picture.css.js +4 -4
- package/src/components/picture/picture.js +13 -3
- package/src/components/picture/picture.stories.js +28 -2
- package/src/components/post-card/post-card.css.js +18 -3
- package/src/components/pricing-cards/adopt-styles.js +16 -0
- package/src/components/pricing-cards/new-pricing-card.js +2 -4
- package/src/components/pricing-cards/new-pricing-card.stories.js +20 -22
- package/src/components/pricing-cards/pricing-card-actions.css.js +8 -12
- package/src/components/pricing-cards/pricing-card-actions.js +26 -13
- package/src/components/pricing-cards/pricing-card-container.css.js +4 -3
- package/src/components/pricing-cards/pricing-card-container.js +10 -4
- package/src/components/pricing-cards/pricing-card-header.css.js +5 -4
- package/src/components/pricing-cards/pricing-card-header.js +18 -31
- package/src/components/pricing-cards/pricing-card-pricing.css.js +84 -61
- package/src/components/pricing-cards/pricing-card-pricing.js +38 -24
- package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
- package/src/components/pricing-cards/pricing-card.css.js +75 -41
- package/src/components/pricing-cards/pricing-card.js +356 -308
- package/src/components/progress/progress.css.js +58 -13
- package/src/components/progress/progress.js +13 -10
- package/src/components/progress/progress.stories.js +9 -7
- package/src/components/radio/radio-group.css.js +42 -0
- package/src/components/radio/radio-group.js +89 -0
- package/src/components/radio/radio.css.js +63 -6
- package/src/components/radio/radio.js +173 -140
- package/src/components/radio/radio.stories.js +99 -44
- package/src/components/radio/toggle-radio.js +44 -0
- package/src/components/review/review-grid.css.js +5 -1
- package/src/components/review/review-grid.js +2 -0
- package/src/components/review/review.js +13 -0
- package/src/components/shared/announcer.js +37 -0
- package/src/components/shared/fill-width.css.js +33 -0
- package/src/components/shared/form-control.js +194 -0
- package/src/components/shared/form-field.css.js +31 -3
- package/src/components/shared/token-scales.js +75 -26
- package/src/components/spotlight-section/spotlight-section.js +2 -2
- package/src/components/stat/stat-highlight.js +1 -1
- package/src/components/stat/stat.css.js +18 -3
- package/src/components/switch/switch.css.js +58 -5
- package/src/components/switch/switch.js +53 -5
- package/src/components/switch/switch.stories.js +30 -8
- package/src/components/tab-list/tab-list.css.js +51 -13
- package/src/components/tab-list/tab-list.js +7 -2
- package/src/components/tab-list/tab-list.stories.js +2 -2
- package/src/components/tabs/tabs.css.js +18 -1
- package/src/components/tabs/tabs.js +119 -41
- package/src/components/terminal/terminal-message.css.js +6 -1
- package/src/components/termsOfUse/terms.css.js +4 -2
- package/src/components/textarea/textarea.js +22 -7
- package/src/components/textarea/textarea.stories.js +12 -9
- package/src/components/trust-panel/trust-panel.css.js +13 -3
- package/src/components/ultimate-security-demo.stories.js +5 -5
- package/src/components/video/video.css.js +5 -0
- package/src/components/video/video.js +5 -0
- package/src/components/video/video.stories.js +12 -0
- package/src/components/video-player/video-player.css.js +20 -8
- package/src/components/video-player/video-player.js +74 -20
- package/src/components/video-player/video-player.stories.js +17 -3
- package/src/tokens/brands.stories.js +1 -1
- package/src/tokens/themes/index.js +2 -2
- package/src/tokens/typography.stories.js +4 -3
- package/src/vendor/motion-art/README.md +4 -1
- package/src/components/footer/footer-lp.css.js +0 -159
|
@@ -2,20 +2,45 @@ import { css } from 'lit';
|
|
|
2
2
|
|
|
3
3
|
/** Styled entirely from design tokens — see npm run lint:tokens. */
|
|
4
4
|
export const progressCSS = css`
|
|
5
|
-
:host {
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
/* the fill's colour, which the tones below set: each engine's fill
|
|
8
|
+
pseudo-element is written once, and reads it from here */
|
|
9
|
+
--bd-progress-fill: var(--status-info-accent);
|
|
10
|
+
}
|
|
6
11
|
|
|
12
|
+
/* A native <progress>, fully restyled: appearance: none is what lets the
|
|
13
|
+
track and the fill take these rules at all, and the border reset clears
|
|
14
|
+
the UA's. The track is the element; the fill is ::-webkit-progress-value
|
|
15
|
+
in Blink and WebKit and ::-moz-progress-bar in Gecko, each in a rule of
|
|
16
|
+
its own -- a selector list naming both is invalid in every engine and is
|
|
17
|
+
dropped whole. Same box as the two divs it replaced: full width, 8 high,
|
|
18
|
+
a full round. */
|
|
7
19
|
.track {
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
8
22
|
height: var(--spacing-8);
|
|
23
|
+
appearance: none;
|
|
24
|
+
border: none;
|
|
9
25
|
background: var(--color-surface-muted);
|
|
10
26
|
border-radius: var(--radius-full);
|
|
11
|
-
overflow:
|
|
27
|
+
overflow: clip;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.track::-webkit-progress-bar {
|
|
31
|
+
background: transparent;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Gecko sizes its fill in layout and ignores the transition, harmlessly. */
|
|
35
|
+
.track::-webkit-progress-value {
|
|
36
|
+
background: var(--bd-progress-fill);
|
|
37
|
+
border-radius: var(--radius-full);
|
|
38
|
+
transition: inline-size var(--transition-duration-slow) var(--transition-easing-smooth);
|
|
12
39
|
}
|
|
13
40
|
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
background: var(--status-info-accent);
|
|
41
|
+
.track::-moz-progress-bar {
|
|
42
|
+
background: var(--bd-progress-fill);
|
|
17
43
|
border-radius: var(--radius-full);
|
|
18
|
-
transition: width var(--transition-duration-slow) var(--transition-easing-smooth);
|
|
19
44
|
}
|
|
20
45
|
|
|
21
46
|
/* The tones come from the shared status roles, so a progress bar and a
|
|
@@ -29,7 +54,7 @@ export const progressCSS = css`
|
|
|
29
54
|
On the track the default blue is 3.52 and error red-600 is 4.23, but
|
|
30
55
|
success at green-600 was only 2.49. green-700 — which is the step
|
|
31
56
|
--status-success-accent names — is 3.69. */
|
|
32
|
-
/* info has its own rule even though
|
|
57
|
+
/* info has its own rule even though :host above already resolves to the same
|
|
33
58
|
token, and the duplication is the point. It used to work by OMISSION --
|
|
34
59
|
there was no info rule, so tone="info" fell through to the default fill,
|
|
35
60
|
which happened to be --status-info-accent. Nothing rendered wrong, and
|
|
@@ -38,13 +63,13 @@ export const progressCSS = css`
|
|
|
38
63
|
stories only ever exercised success and error, so the info path had never
|
|
39
64
|
been rendered anywhere.
|
|
40
65
|
.
|
|
41
|
-
Two things stay separate now. The bare
|
|
66
|
+
Two things stay separate now. The bare :host is what a bd-progress with NO
|
|
42
67
|
tone attribute looks like; this rule is what tone="info" MEANS. They agree
|
|
43
68
|
today. If somebody later changes the untoned default, info keeps its
|
|
44
69
|
meaning instead of silently following it. */
|
|
45
|
-
:host([tone='info'])
|
|
46
|
-
:host([tone='success'])
|
|
47
|
-
:host([tone='error'])
|
|
70
|
+
:host([tone='info']) { --bd-progress-fill: var(--status-info-accent); }
|
|
71
|
+
:host([tone='success']) { --bd-progress-fill: var(--status-success-accent); }
|
|
72
|
+
:host([tone='error']) { --bd-progress-fill: var(--status-error-accent); }
|
|
48
73
|
|
|
49
74
|
/* The caption role, all five axes from the role rather than one from it and
|
|
50
75
|
the rest from nowhere. This box holds the label and the percentage, so it
|
|
@@ -58,7 +83,7 @@ export const progressCSS = css`
|
|
|
58
83
|
retinting captions moves this label with them.
|
|
59
84
|
|
|
60
85
|
Neither gate could see it. lint:tokens has nothing to scan when a leading
|
|
61
|
-
is absent rather than wrong, and
|
|
86
|
+
is absent rather than wrong, and typography coverage fails on multi-line
|
|
62
87
|
text a component renders with no role -- these two spans are single-line. */
|
|
63
88
|
.label {
|
|
64
89
|
display: flex;
|
|
@@ -73,7 +98,27 @@ export const progressCSS = css`
|
|
|
73
98
|
}
|
|
74
99
|
|
|
75
100
|
@media (prefers-reduced-motion: reduce) {
|
|
76
|
-
.
|
|
101
|
+
.track::-webkit-progress-value { transition: none; }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Forced colours repaint every background as Canvas, so the track and the
|
|
105
|
+
fill both vanished there -- the divs this replaced did the same. The bar
|
|
106
|
+
opts out and states the system colours itself: a CanvasText edge round
|
|
107
|
+
the track and a Highlight fill, which every forced palette keeps apart. */
|
|
108
|
+
@media (forced-colors: active) {
|
|
109
|
+
.track {
|
|
110
|
+
forced-color-adjust: none;
|
|
111
|
+
border: var(--border-width-1) solid CanvasText;
|
|
112
|
+
background: Canvas;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.track::-webkit-progress-value {
|
|
116
|
+
background: Highlight;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.track::-moz-progress-bar {
|
|
120
|
+
background: Highlight;
|
|
121
|
+
}
|
|
77
122
|
}
|
|
78
123
|
`;
|
|
79
124
|
|
|
@@ -41,20 +41,23 @@ export class BdProgress extends LitElement {
|
|
|
41
41
|
const value = Number.isFinite(this.value) ? Math.min(Math.max(this.value, 0), max) : 0;
|
|
42
42
|
const percent = (value / max) * 100;
|
|
43
43
|
|
|
44
|
+
/* A native <progress>: the progressbar role, its value and its range come
|
|
45
|
+
with the element. It was a div with role="progressbar" and the three
|
|
46
|
+
aria-value* attributes over a second div whose width was the value; the
|
|
47
|
+
element says all of that itself. The label row is a <label> for it, so
|
|
48
|
+
the caption is the bar's name; with no label the name is the literal
|
|
49
|
+
"Progress". */
|
|
44
50
|
return html`
|
|
45
51
|
${this.label
|
|
46
|
-
? html`<span class="label"><
|
|
52
|
+
? html`<span class="label"><label for="bar">${this.label}</label><span>${Math.round(percent)}%</span></span>`
|
|
47
53
|
: nothing}
|
|
48
|
-
<
|
|
54
|
+
<progress
|
|
55
|
+
id="bar"
|
|
49
56
|
class="track"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
aria-
|
|
53
|
-
|
|
54
|
-
aria-label=${this.label || 'Progress'}
|
|
55
|
-
>
|
|
56
|
-
<div class="fill" style="width: ${percent}%"></div>
|
|
57
|
-
</div>
|
|
57
|
+
value=${value}
|
|
58
|
+
max=${max}
|
|
59
|
+
aria-label=${this.label ? nothing : 'Progress'}
|
|
60
|
+
></progress>
|
|
58
61
|
`;
|
|
59
62
|
}
|
|
60
63
|
}
|
|
@@ -31,16 +31,18 @@ When \`label\` is set, a row above the bar shows the label on the left and the
|
|
|
31
31
|
rounded percentage on the right, so the number is visible and not only
|
|
32
32
|
announced.
|
|
33
33
|
|
|
34
|
-
\`value\` is clamped to 0…\`max\`, and the fill, the percentage and
|
|
35
|
-
|
|
36
|
-
full bar, "100%" and a
|
|
34
|
+
\`value\` is clamped to 0…\`max\`, and the fill, the percentage and the
|
|
35
|
+
value the bar reports all read the clamped number, so a value above \`max\`
|
|
36
|
+
shows a full bar, "100%" and a value equal to the max. A \`max\` that is not a
|
|
37
37
|
positive number falls back to \`100\`.
|
|
38
38
|
|
|
39
39
|
### Accessibility
|
|
40
|
-
The
|
|
41
|
-
and
|
|
42
|
-
"busy". Its accessible name
|
|
43
|
-
"Progress" — pass a \`label\` so it
|
|
40
|
+
The bar is a native \`<progress>\`, so assistive tech gets the progressbar
|
|
41
|
+
role, its value and its range from the element and reports real progress
|
|
42
|
+
rather than just "busy". Its accessible name is \`label\`, through a
|
|
43
|
+
\`<label for>\`, falling back to the literal "Progress" — pass a \`label\` so it
|
|
44
|
+
says what is progressing. Under forced colours (Windows High Contrast) the
|
|
45
|
+
track is outlined in CanvasText and the fill drawn in Highlight.
|
|
44
46
|
`
|
|
45
47
|
}
|
|
46
48
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The group's own chrome: a label over the radios, and the radios stacked.
|
|
5
|
+
*
|
|
6
|
+
* The label is a field label, so it reads the --form-label-* tokens the
|
|
7
|
+
* fields' built-in labels and bd-label read, at the default size, with the
|
|
8
|
+
* same required mark. The stack is the 8px every radio story already set by
|
|
9
|
+
* hand around its group.
|
|
10
|
+
*/
|
|
11
|
+
export default css`
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.label {
|
|
17
|
+
display: block;
|
|
18
|
+
font-family: var(--form-label-default-fontFamily);
|
|
19
|
+
font-size: var(--form-label-default-fontSize);
|
|
20
|
+
font-weight: var(--form-label-default-fontWeight);
|
|
21
|
+
line-height: var(--form-label-default-lineHeight);
|
|
22
|
+
letter-spacing: var(--form-label-default-letterSpacing);
|
|
23
|
+
color: var(--form-label-default-color);
|
|
24
|
+
margin-bottom: var(--form-label-default-marginBottom);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.required {
|
|
28
|
+
color: var(--form-label-required-color);
|
|
29
|
+
margin-inline-start: var(--form-label-required-marginLeft);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* flex-start, so each radio stays as wide as its own row. Stretched, the
|
|
33
|
+
empty run beside a short label would be part of the host and select it
|
|
34
|
+
from across the column. A page lays the options out in a row through
|
|
35
|
+
::part(options). */
|
|
36
|
+
.options {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
align-items: flex-start;
|
|
40
|
+
gap: var(--spacing-8);
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from "lit";
|
|
2
|
+
// Installs the design tokens into document scope; see src/tokens/tokens.js
|
|
3
|
+
import "../../tokens/tokens.js";
|
|
4
|
+
import { radiosOf } from "./radio.js";
|
|
5
|
+
import radioGroupCSS from "./radio-group.css.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The element that owns a set of bd-radio: what a <fieldset> of native radios
|
|
9
|
+
* would be, and what the browser cannot do for radios that each live in a
|
|
10
|
+
* shadow root of their own.
|
|
11
|
+
*
|
|
12
|
+
* <bd-radio-group label="Billing" name="billing" required>
|
|
13
|
+
* <bd-radio value="monthly" label="Monthly"></bd-radio>
|
|
14
|
+
* <bd-radio value="yearly" label="Yearly" checked></bd-radio>
|
|
15
|
+
* </bd-radio-group>
|
|
16
|
+
*
|
|
17
|
+
* It renders role="radiogroup", named by its label, so a screen reader hears
|
|
18
|
+
* the group and its question, and it scopes the radios: the ones inside it
|
|
19
|
+
* exclude each other, take its name and are required when it is, whatever
|
|
20
|
+
* else on the page shares their name. The radios still do everything a radio
|
|
21
|
+
* does themselves -- each is the form control, each submits its own value --
|
|
22
|
+
* so radios without a group keep working exactly as before.
|
|
23
|
+
*
|
|
24
|
+
* The role sits on an element in this shadow root, around the slot, rather
|
|
25
|
+
* than on the host: the accessibility tree follows the slot, so the radios
|
|
26
|
+
* are its children there, and the label it points at is in the same root.
|
|
27
|
+
*/
|
|
28
|
+
export class BdRadioGroup extends LitElement {
|
|
29
|
+
static styles = [radioGroupCSS];
|
|
30
|
+
|
|
31
|
+
static properties = {
|
|
32
|
+
label : { type: String },
|
|
33
|
+
/** Given to every radio inside, which is the name they submit under. */
|
|
34
|
+
name : { type: String },
|
|
35
|
+
required: { type: Boolean }
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
this.label = "";
|
|
41
|
+
this.name = "";
|
|
42
|
+
this.required = false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Its radios, in document order. A group nested inside keeps its own. */
|
|
46
|
+
get radios() {
|
|
47
|
+
return radiosOf(this);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The selected radio's value, or "" when none is, as RadioNodeList.value. */
|
|
51
|
+
get value() {
|
|
52
|
+
return this.radios.find(radio => radio.checked)?.value ?? "";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Selects the radio with this value; a value no radio has changes nothing. */
|
|
56
|
+
set value(value) {
|
|
57
|
+
const radio = this.radios.find(r => r.value === value);
|
|
58
|
+
if (radio) radio.checked = true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
updated(changed) {
|
|
62
|
+
if (changed.has("name") && this.name) {
|
|
63
|
+
for (const radio of this.radios) radio.name = this.name;
|
|
64
|
+
}
|
|
65
|
+
if (changed.has("required")) {
|
|
66
|
+
for (const radio of this.radios) radio.requestUpdate?.();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
render() {
|
|
71
|
+
return html`
|
|
72
|
+
<div
|
|
73
|
+
class="bd-radio-group"
|
|
74
|
+
role="radiogroup"
|
|
75
|
+
aria-labelledby=${this.label ? "label" : nothing}
|
|
76
|
+
aria-required=${this.required ? "true" : nothing}
|
|
77
|
+
>
|
|
78
|
+
${this.label
|
|
79
|
+
? html`<span id="label" class="label" part="label">${this.label}${this.required
|
|
80
|
+
? html`<span class="required" aria-hidden="true">*</span>`
|
|
81
|
+
: nothing}</span>`
|
|
82
|
+
: nothing}
|
|
83
|
+
<div class="options" part="options"><slot></slot></div>
|
|
84
|
+
</div>
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
customElements.define("bd-radio-group", BdRadioGroup);
|
|
@@ -35,7 +35,21 @@ export default css`
|
|
|
35
35
|
outline: none;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/* Each row is a <label> around the native control -- a radio in bd-radio,
|
|
39
|
+
a checkbox in bd-toggle-radio -- which stays in the accessibility tree;
|
|
40
|
+
the circle draws it. The clip idiom bd-switch uses. */
|
|
41
|
+
input {
|
|
42
|
+
position: absolute;
|
|
43
|
+
/* no token: 1px is the clip idiom's own measure, not a border -- as in
|
|
44
|
+
switch.css.js, with the -1px below. */
|
|
45
|
+
width: 1px;
|
|
46
|
+
height: 1px;
|
|
47
|
+
margin: -1px;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
clip-path: inset(50%);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.bd-radio:has(input:focus-visible) {
|
|
39
53
|
/* the one focus ring — see Foundations/Focus. A two-colour ring whose
|
|
40
54
|
white inner band keeps it visible on a coloured or dark surface, which a
|
|
41
55
|
single-colour outline cannot do. */
|
|
@@ -104,6 +118,11 @@ export default css`
|
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
/* ---- disabled --------------------------------------------------------
|
|
121
|
+
:disabled rather than [disabled]: a <fieldset disabled> around either
|
|
122
|
+
radio disables it without the attribute, and a form-associated element
|
|
123
|
+
matches :disabled for both. bd-toggle-radio is form-associated too now,
|
|
124
|
+
so the [disabled] spelling it alone needed is gone.
|
|
125
|
+
|
|
107
126
|
The label greys with the control rather than the whole row dropping to an
|
|
108
127
|
opacity. Exempt from contrast under WCAG 1.4.3.
|
|
109
128
|
|
|
@@ -111,19 +130,19 @@ export default css`
|
|
|
111
130
|
written out over bd-checkbox's disabled block: one disabled-edge value
|
|
112
131
|
across the control family, and 2.27:1 where the hierarchy role gave 1.66.
|
|
113
132
|
The dot fill below is a fill rather than an edge and is unchanged. */
|
|
114
|
-
:host(
|
|
133
|
+
:host(:disabled) .bd-radio {
|
|
115
134
|
cursor: not-allowed;
|
|
116
135
|
color: var(--color-text-subtle);
|
|
117
136
|
}
|
|
118
137
|
|
|
119
|
-
:host(
|
|
120
|
-
:host(
|
|
138
|
+
:host(:disabled) .box,
|
|
139
|
+
:host(:disabled) .bd-radio:hover .box {
|
|
121
140
|
border-color: var(--color-border-disabled);
|
|
122
141
|
background: var(--color-surface-default);
|
|
123
142
|
}
|
|
124
143
|
|
|
125
|
-
:host(
|
|
126
|
-
:host(
|
|
144
|
+
:host(:disabled[checked]) .box,
|
|
145
|
+
:host(:disabled[checked]) .bd-radio:hover .box {
|
|
127
146
|
background: var(--color-border-subtle);
|
|
128
147
|
border-color: var(--color-border-disabled);
|
|
129
148
|
}
|
|
@@ -134,4 +153,42 @@ export default css`
|
|
|
134
153
|
transition: none;
|
|
135
154
|
}
|
|
136
155
|
}
|
|
156
|
+
|
|
157
|
+
/* Forced colours keep the ring -- a border is repainted, not dropped --
|
|
158
|
+
but repaint both fills as Canvas, and the dot is a fill: a checked radio
|
|
159
|
+
drew exactly what an unchecked one did. The circle and the dot opt out
|
|
160
|
+
and state system colours: a CanvasText ring at rest, and once checked a
|
|
161
|
+
Highlight ring holding a Highlight dot, the native radio's own reading.
|
|
162
|
+
Disabled is GrayText. Each state's selector is repeated with its hover,
|
|
163
|
+
because those outrank a plain .box. */
|
|
164
|
+
@media (forced-colors: active) {
|
|
165
|
+
.box,
|
|
166
|
+
.dot {
|
|
167
|
+
forced-color-adjust: none;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.box,
|
|
171
|
+
.bd-radio:hover .box {
|
|
172
|
+
border-color: CanvasText;
|
|
173
|
+
background: Canvas;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.dot { background: Highlight; }
|
|
177
|
+
|
|
178
|
+
:host([checked]) .box,
|
|
179
|
+
:host([checked]) .bd-radio:hover .box {
|
|
180
|
+
border-color: Highlight;
|
|
181
|
+
background: Canvas;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:host(:disabled) .box,
|
|
185
|
+
:host(:disabled) .bd-radio:hover .box,
|
|
186
|
+
:host(:disabled[checked]) .box,
|
|
187
|
+
:host(:disabled[checked]) .bd-radio:hover .box {
|
|
188
|
+
border-color: GrayText;
|
|
189
|
+
background: Canvas;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host(:disabled) .dot { background: GrayText; }
|
|
193
|
+
}
|
|
137
194
|
`;
|