@repobit/dex-system-design 2.5.0 → 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.
Files changed (173) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +2 -1
  3. package/package.json +14 -27
  4. package/schemas/component-manifest.json +226 -33
  5. package/schemas/manifest-omissions.json +23 -0
  6. package/src/components/accordion/accordion-bg.css.js +39 -30
  7. package/src/components/accordion/accordion-bg.js +17 -28
  8. package/src/components/accordion/accordion-bg.stories.js +5 -0
  9. package/src/components/accordion/accordion-panel.js +24 -0
  10. package/src/components/accordion/accordion.css.js +105 -111
  11. package/src/components/accordion/accordion.js +23 -37
  12. package/src/components/accordion/accordion.stories.js +5 -1
  13. package/src/components/anchor/anchor-nav.css.js +131 -53
  14. package/src/components/anchor/anchor-nav.js +276 -201
  15. package/src/components/annotation/annotation.css.js +7 -4
  16. package/src/components/architecture.stories.js +8 -7
  17. package/src/components/audience-card/audience-card.css.js +30 -4
  18. package/src/components/audience-card/audience-card.js +8 -13
  19. package/src/components/awards/awards-flex.css.js +23 -6
  20. package/src/components/awards/awards-flex.js +21 -6
  21. package/src/components/awards/awards-spotlight.css.js +25 -5
  22. package/src/components/awards/awards-spotlight.js +19 -7
  23. package/src/components/awards/awards.css.js +20 -8
  24. package/src/components/awards/awards.js +30 -91
  25. package/src/components/awards/awards.stories.js +5 -5
  26. package/src/components/awards/scroll-slides.js +128 -0
  27. package/src/components/back/back.css.js +2 -0
  28. package/src/components/badge/badge.css.js +15 -0
  29. package/src/components/bento-grid/bento-grid.css.js +105 -11
  30. package/src/components/bento-grid/bento-grid.js +37 -124
  31. package/src/components/bento-grid/bento-grid.stories.js +3 -2
  32. package/src/components/bento-grid/bento-item.css.js +71 -32
  33. package/src/components/bento-grid/bento-item.js +3 -30
  34. package/src/components/blockquote/blockquote.css.js +2 -2
  35. package/src/components/breadcrumb/breadcrumb.css.js +10 -9
  36. package/src/components/breadcrumb/breadcrumb.js +35 -34
  37. package/src/components/button/button.css.js +42 -17
  38. package/src/components/button/button.js +84 -3
  39. package/src/components/button/button.stories.js +17 -0
  40. package/src/components/card-features/card-features.css.js +23 -2
  41. package/src/components/card-features/card-features.js +6 -48
  42. package/src/components/cards/card.css.js +43 -14
  43. package/src/components/cards/card.js +43 -177
  44. package/src/components/cards/card.stories.js +8 -10
  45. package/src/components/carousel/carousel.css.js +101 -70
  46. package/src/components/carousel/carousel.js +107 -71
  47. package/src/components/carousel/carousel.stories.js +18 -16
  48. package/src/components/checkbox/checkbox.css.js +26 -9
  49. package/src/components/checkbox/checkbox.js +73 -39
  50. package/src/components/checkbox/checkbox.stories.js +35 -18
  51. package/src/components/compare/compare.css.js +68 -10
  52. package/src/components/compare/compare.js +40 -103
  53. package/src/components/compare/compare.stories.js +1 -1
  54. package/src/components/compatibility-table/compatibility-table.css.js +70 -37
  55. package/src/components/compatibility-table/compatibility-table.js +47 -40
  56. package/src/components/compatibility-table/compatibility-table.stories.js +78 -1
  57. package/src/components/display/display.css.js +7 -0
  58. package/src/components/dropdown/dropdown.css.js +20 -3
  59. package/src/components/dropdown/dropdown.js +57 -21
  60. package/src/components/dropdown/dropdown.stories.js +31 -9
  61. package/src/components/features/features.css.js +56 -21
  62. package/src/components/features/features.js +7 -117
  63. package/src/components/fieldset/fieldset.stories.js +68 -0
  64. package/src/components/footer/footer-images.js +34 -0
  65. package/src/components/footer/footer-links-group.css.js +10 -10
  66. package/src/components/footer/footer-locale.js +47 -0
  67. package/src/components/footer/footer-lp.js +27 -114
  68. package/src/components/footer/footer-lp.stories.js +2 -2
  69. package/src/components/footer/footer-nav-menu.css.js +2 -2
  70. package/src/components/footer/footer-nav-menu.js +8 -3
  71. package/src/components/footer/footer.css.js +238 -197
  72. package/src/components/footer/footer.js +109 -187
  73. package/src/components/footer/footer.stories.js +14 -4
  74. package/src/components/grid/grid.css.js +64 -5
  75. package/src/components/header/header-code.css.js +20 -11
  76. package/src/components/header/header-code.js +1 -1
  77. package/src/components/header/header.css.js +20 -14
  78. package/src/components/header/header.js +6 -7
  79. package/src/components/header/header.stories.js +29 -24
  80. package/src/components/heading/heading.css.js +11 -0
  81. package/src/components/hero/hero.js +10 -2
  82. package/src/components/highlight/highlight.css.js +30 -6
  83. package/src/components/icons/arrow-icon.js +4 -1
  84. package/src/components/icons/arrow-right-icon.js +5 -1
  85. package/src/components/icons/icon-element.js +18 -0
  86. package/src/components/image/image.js +29 -9
  87. package/src/components/image/image.stories.js +38 -2
  88. package/src/components/input/custom-form.stories.js +38 -7
  89. package/src/components/input/input-clipboard.css.js +15 -1
  90. package/src/components/input/input-clipboard.js +84 -21
  91. package/src/components/input/input.js +27 -7
  92. package/src/components/install-options/install-options.css.js +26 -6
  93. package/src/components/install-options/install-options.js +32 -8
  94. package/src/components/label/label.css.js +1 -1
  95. package/src/components/light-carousel/light-carousel.css.js +100 -48
  96. package/src/components/light-carousel/light-carousel.js +43 -5
  97. package/src/components/link/link.css.js +15 -15
  98. package/src/components/link/link.js +17 -1
  99. package/src/components/link/link.stories.js +20 -7
  100. package/src/components/list/list.css.js +3 -3
  101. package/src/components/logo-marquee/logo-marquee.css.js +12 -1
  102. package/src/components/logo-marquee/logo-marquee.js +33 -8
  103. package/src/components/logo-marquee/logo-marquee.stories.js +10 -4
  104. package/src/components/modal/modal.css.js +74 -40
  105. package/src/components/modal/modal.js +85 -74
  106. package/src/components/modal/modal.stories.js +27 -14
  107. package/src/components/motion-art/motion-art.js +67 -1
  108. package/src/components/page-switcher/page-switcher.css.js +27 -9
  109. package/src/components/page-switcher/page-switcher.js +11 -8
  110. package/src/components/partner-banner/partner-banner.css.js +2 -0
  111. package/src/components/picture/picture.css.js +4 -4
  112. package/src/components/picture/picture.js +13 -3
  113. package/src/components/picture/picture.stories.js +28 -2
  114. package/src/components/post-card/post-card.css.js +18 -3
  115. package/src/components/pricing-cards/adopt-styles.js +16 -0
  116. package/src/components/pricing-cards/new-pricing-card.js +2 -4
  117. package/src/components/pricing-cards/new-pricing-card.stories.js +20 -22
  118. package/src/components/pricing-cards/pricing-card-actions.css.js +8 -12
  119. package/src/components/pricing-cards/pricing-card-actions.js +26 -13
  120. package/src/components/pricing-cards/pricing-card-container.css.js +4 -3
  121. package/src/components/pricing-cards/pricing-card-container.js +10 -4
  122. package/src/components/pricing-cards/pricing-card-header.css.js +5 -4
  123. package/src/components/pricing-cards/pricing-card-header.js +18 -31
  124. package/src/components/pricing-cards/pricing-card-pricing.css.js +84 -61
  125. package/src/components/pricing-cards/pricing-card-pricing.js +38 -24
  126. package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
  127. package/src/components/pricing-cards/pricing-card.css.js +75 -41
  128. package/src/components/pricing-cards/pricing-card.js +356 -308
  129. package/src/components/progress/progress.css.js +58 -13
  130. package/src/components/progress/progress.js +13 -10
  131. package/src/components/progress/progress.stories.js +9 -7
  132. package/src/components/radio/radio-group.css.js +42 -0
  133. package/src/components/radio/radio-group.js +89 -0
  134. package/src/components/radio/radio.css.js +63 -6
  135. package/src/components/radio/radio.js +173 -140
  136. package/src/components/radio/radio.stories.js +99 -44
  137. package/src/components/radio/toggle-radio.js +44 -0
  138. package/src/components/review/review-grid.css.js +5 -1
  139. package/src/components/review/review-grid.js +2 -0
  140. package/src/components/review/review.js +13 -0
  141. package/src/components/shared/announcer.js +37 -0
  142. package/src/components/shared/fill-width.css.js +33 -0
  143. package/src/components/shared/form-control.js +194 -0
  144. package/src/components/shared/form-field.css.js +31 -3
  145. package/src/components/shared/token-scales.js +75 -26
  146. package/src/components/spotlight-section/spotlight-section.js +2 -2
  147. package/src/components/stat/stat-highlight.js +1 -1
  148. package/src/components/stat/stat.css.js +18 -3
  149. package/src/components/switch/switch.css.js +58 -5
  150. package/src/components/switch/switch.js +53 -5
  151. package/src/components/switch/switch.stories.js +30 -8
  152. package/src/components/tab-list/tab-list.css.js +51 -13
  153. package/src/components/tab-list/tab-list.js +7 -2
  154. package/src/components/tab-list/tab-list.stories.js +2 -2
  155. package/src/components/tabs/tabs.css.js +18 -1
  156. package/src/components/tabs/tabs.js +119 -41
  157. package/src/components/terminal/terminal-message.css.js +6 -1
  158. package/src/components/termsOfUse/terms.css.js +4 -2
  159. package/src/components/textarea/textarea.js +22 -7
  160. package/src/components/textarea/textarea.stories.js +12 -9
  161. package/src/components/trust-panel/trust-panel.css.js +13 -3
  162. package/src/components/ultimate-security-demo.stories.js +5 -5
  163. package/src/components/video/video.css.js +5 -0
  164. package/src/components/video/video.js +5 -0
  165. package/src/components/video/video.stories.js +12 -0
  166. package/src/components/video-player/video-player.css.js +20 -8
  167. package/src/components/video-player/video-player.js +74 -20
  168. package/src/components/video-player/video-player.stories.js +17 -3
  169. package/src/tokens/brands.stories.js +1 -1
  170. package/src/tokens/themes/index.js +2 -2
  171. package/src/tokens/typography.stories.js +4 -3
  172. package/src/vendor/motion-art/README.md +4 -1
  173. package/src/components/footer/footer-lp.css.js +0 -159
@@ -33,10 +33,24 @@ export default css`
33
33
  line-height: var(--typography-body-small-lineHeight);
34
34
  color: var(--color-text-primary);
35
35
  vertical-align: middle;
36
- outline: none;
37
36
  }
38
37
 
39
- .bd-checkbox:focus-visible {
38
+ /* The native checkbox is the control and stays in the accessibility tree;
39
+ the box below draws it. The clip idiom bd-switch uses. */
40
+ input {
41
+ position: absolute;
42
+ /* no token: 1px is the clip idiom's own measure, not a border -- as in
43
+ switch.css.js, with the -1px below. */
44
+ width: 1px;
45
+ height: 1px;
46
+ margin: -1px;
47
+ overflow: hidden;
48
+ clip-path: inset(50%);
49
+ }
50
+
51
+ /* On the row rather than the box, so the ring and the target are the same
52
+ shape, as on bd-radio and bd-switch. */
53
+ .bd-checkbox:has(input:focus-visible) {
40
54
  /* the one focus ring — see Foundations/Focus. A two-colour ring whose
41
55
  white inner band keeps it visible on a coloured or dark surface, which a
42
56
  single-colour outline cannot do. */
@@ -106,6 +120,9 @@ export default css`
106
120
  }
107
121
 
108
122
  /* ---- disabled --------------------------------------------------------
123
+ :disabled rather than [disabled], so a <fieldset disabled> around the box
124
+ greys it too: a form-associated element matches :disabled for both.
125
+
109
126
  Grey throughout, and the label greys too rather than the whole row
110
127
  dropping to an opacity, which is what the design specifies. Exempt from
111
128
  contrast under WCAG 1.4.3.
@@ -124,28 +141,28 @@ export default css`
124
141
  The fills below still draw neutral-200. A fill is not an edge, and whether
125
142
  a disabled checked box should darken along with its border is a separate
126
143
  question that has not been put yet. */
127
- :host([disabled]) .bd-checkbox {
144
+ :host(:disabled) .bd-checkbox {
128
145
  cursor: not-allowed;
129
146
  color: var(--color-text-subtle);
130
147
  }
131
148
 
132
- :host([disabled]) .box {
149
+ :host(:disabled) .box {
133
150
  border-color: var(--color-border-disabled);
134
151
  background: var(--color-surface-default);
135
152
  }
136
153
 
137
- :host([disabled][checked]) .box,
138
- :host([disabled][indeterminate]) .box {
154
+ :host(:disabled[checked]) .box,
155
+ :host(:disabled[indeterminate]) .box {
139
156
  background: var(--color-border-subtle);
140
157
  border-color: var(--color-border-disabled);
141
158
  }
142
159
 
143
- :host([disabled]) .bd-checkbox:hover .box {
160
+ :host(:disabled) .bd-checkbox:hover .box {
144
161
  border-color: var(--color-border-disabled);
145
162
  }
146
163
 
147
- :host([disabled][checked]) .bd-checkbox:hover .box,
148
- :host([disabled][indeterminate]) .bd-checkbox:hover .box {
164
+ :host(:disabled[checked]) .bd-checkbox:hover .box,
165
+ :host(:disabled[indeterminate]) .bd-checkbox:hover .box {
149
166
  background: var(--color-border-subtle);
150
167
  }
151
168
 
@@ -4,16 +4,20 @@ import "../../tokens/tokens.js";
4
4
  // the extension matters: "./checkbox.css" only resolved because Vite appends
5
5
  // .js for us, and failed outright under native ESM
6
6
  import checkboxCSS from "./checkbox.css.js";
7
+ import { FormControl, omitEmpty } from "../shared/form-control.js";
7
8
 
8
- export class BdCheckbox extends LitElement {
9
+ export class BdCheckbox extends FormControl(LitElement) {
9
10
  static styles = [checkboxCSS];
10
11
 
11
12
  static properties = {
12
- name : { type: String },
13
+ /* reflected, because a form reads the name off the element: see
14
+ shared/form-control.js */
15
+ name : { type: String, reflect: true, converter: omitEmpty },
13
16
  value : { type: String },
14
17
  checked : { type: Boolean, reflect: true },
15
18
  indeterminate: { type: Boolean, reflect: true },
16
19
  disabled : { type: Boolean, reflect: true },
20
+ required : { type: Boolean },
17
21
  label : { type: String }
18
22
  };
19
23
 
@@ -26,42 +30,71 @@ export class BdCheckbox extends LitElement {
26
30
  this.checked = false;
27
31
  this.indeterminate = false;
28
32
  this.disabled = false;
33
+ this.required = false;
29
34
  this.label = "";
30
35
  }
31
36
 
32
- /** true | false | mixed — mixed wins, as it does natively. */
33
- get _ariaChecked() {
34
- if (this.indeterminate) return "mixed";
35
- return this.checked ? "true" : "false";
37
+ connectedCallback() {
38
+ super.connectedCallback();
39
+ /* What reset returns to: the state the box joined the page in. A native
40
+ checkbox keeps its default in the checked attribute, but this one's
41
+ checked reflects, so the attribute follows every click and cannot. */
42
+ this._defaults ??= { checked: this.checked, indeterminate: this.indeterminate };
36
43
  }
37
44
 
38
- _toggle() {
39
- if (this.disabled) return;
45
+ get _control() {
46
+ return this.renderRoot?.querySelector?.("input");
47
+ }
40
48
 
41
- // clicking an indeterminate box resolves it to checked, as it does natively
42
- if (this.indeterminate) {
43
- this.indeterminate = false;
44
- this.checked = true;
45
- } else {
46
- this.checked = !this.checked;
47
- }
49
+ // a native checkbox toggles when its label is clicked, or on el.click()
50
+ _activate() {
51
+ this._control?.click();
52
+ }
48
53
 
54
+ updated() {
55
+ // with no value it submits "on", as a native checkbox does
56
+ this._internals.setFormValue(this.checked ? this.value || "on" : null, String(this.checked));
57
+ this._mirrorValidity(this._control);
58
+ }
59
+
60
+ formResetCallback() {
61
+ super.formResetCallback();
62
+ this.checked = this._defaults.checked;
63
+ this.indeterminate = this._defaults.indeterminate;
64
+ }
65
+
66
+ formStateRestoreCallback(state) {
67
+ this.checked = state === "true";
68
+ }
69
+
70
+ _onChange(e) {
71
+ /* Clicking an indeterminate box resolves it to checked. A native one
72
+ toggles whatever it held underneath, so a box that was indeterminate
73
+ and checked would clear; this one always resolved to checked, and
74
+ still does. */
75
+ if (this.indeterminate) e.target.checked = true;
76
+ this.indeterminate = false;
77
+ this.checked = e.target.checked;
78
+
79
+ // name is carried so a handler can tell which control changed, as
80
+ // bd-radio's change carries it
49
81
  this.dispatchEvent(
50
82
  new CustomEvent("change", {
51
- detail : { checked: this.checked, value: this.checked ? this.value : null },
83
+ detail : { checked: this.checked, value: this.checked ? this.value : null, name: this.name },
52
84
  bubbles : true,
53
85
  composed: true
54
86
  })
55
87
  );
56
88
  }
57
89
 
58
- _handleKeydown(e) {
59
- // Space is the native activation key. Enter is kept as a convenience: this
60
- // control is not form-associated, so Enter has nothing else to do here.
61
- if (e.key === " " || e.key === "Enter") {
62
- e.preventDefault();
63
- this._toggle();
64
- }
90
+ /* Space is the native input's own, and the only key that toggles. Enter
91
+ submits the form, as it does on a native checkbox -- it used to toggle
92
+ here, which no native checkbox does, so a reader pressing Enter to send
93
+ a form changed their answer instead. See shared/form-control.js. */
94
+ _onKeydown(e) {
95
+ if (e.key !== "Enter") return;
96
+ e.preventDefault();
97
+ this._submitImplicitly();
65
98
  }
66
99
 
67
100
  _renderMark() {
@@ -79,25 +112,26 @@ export class BdCheckbox extends LitElement {
79
112
  }
80
113
 
81
114
  render() {
82
- // The row carries the role, the focus and the click target, so the label is
83
- // part of the control rather than decoration beside it. The previous markup
84
- // put role and tabindex on the box alone, which meant clicking the label
85
- // did nothing and the only target was 20px — under the 24px WCAG 2.5.8 asks
86
- // for. There is no native input to associate a <label> with, so <div> is
87
- // honest about what this is.
115
+ // The row is the control, so the label is part of it rather than
116
+ // decoration beside it: clicking the label toggles, and the target clears
117
+ // the 24px WCAG 2.5.8 asks for, which the 20px box alone cannot. It used
118
+ // to be a <div role="checkbox"> with its keys written by hand; it is a
119
+ // native checkbox now, drawn over by the box, so the browser supplies the
120
+ // role, the states, Space and the disabled tab order.
88
121
  return html`
89
- <div
90
- class="bd-checkbox"
91
- role="checkbox"
92
- aria-checked="${this._ariaChecked}"
93
- aria-disabled="${this.disabled ? "true" : "false"}"
94
- tabindex="${this.disabled ? -1 : 0}"
95
- @click=${this._toggle}
96
- @keydown=${this._handleKeydown}
97
- >
122
+ <label class="bd-checkbox">
123
+ <input
124
+ type="checkbox"
125
+ .checked=${this.checked}
126
+ .indeterminate=${this.indeterminate}
127
+ ?disabled=${this.disabled || this._formDisabled}
128
+ ?required=${this.required}
129
+ @change=${this._onChange}
130
+ @keydown=${this._onKeydown}
131
+ />
98
132
  <span class="box" part="box">${this._renderMark()}</span>
99
133
  <span class="label" part="label"><slot>${this.label}</slot></span>
100
- </div>
134
+ </label>
101
135
  `;
102
136
  }
103
137
  }
@@ -33,22 +33,34 @@ Both marks are drawn in \`currentColor\` with flat caps and a mitred join, so
33
33
  they read sharp against the square corners of the box.
34
34
 
35
35
  ### Accessibility
36
- - The **whole row is the control**, not just the box. Clicking the label
37
- toggles, and the target measures 25px tall against the 24px WCAG 2.5.8 asks
38
- for — a 20px box on its own cannot reach it.
39
- - \`role="checkbox"\` with \`aria-checked\` reporting \`true\`, \`false\` or
40
- \`mixed\`, plus \`aria-disabled\`.
41
- - Space toggles. Enter also toggles as a convenience: this control is not
42
- form-associated, so Enter has nothing else to do here.
36
+ - A **native checkbox** is the control: \`<input type="checkbox">\` in the
37
+ shadow root, clipped out of sight, with the box drawn over it. The browser
38
+ supplies the role, \`checked\`/\`mixed\`, \`disabled\` and \`required\`.
39
+ - The **whole row is the control**, not just the box. The row is a \`<label>\`,
40
+ so clicking it toggles, and the target measures 25px tall against the 24px
41
+ WCAG 2.5.8 asks for — a 20px box on its own cannot reach it. A link in a
42
+ slotted label follows the link and leaves the box alone.
43
+ - Space toggles, natively. Enter submits the form, as on a native checkbox,
44
+ and does not toggle: it used to, which no native checkbox does.
43
45
  - The focus ring appears on keyboard navigation only, via \`:focus-visible\`,
44
46
  and is inset evenly on all four sides.
45
- - \`tabindex="-1"\` when disabled.
47
+ - Disabled boxes leave the tab order, as native ones do.
46
48
 
47
- ### Not form-associated
48
- \`name\` and \`value\` are carried on the \`change\` event, but this element does
49
- **not** participate in form submission — a \`<form>\` containing it yields no
50
- \`FormData\` entry, because there is no native input behind it. Read the state
51
- from the event or the \`checked\` property instead.
49
+ ### In a form
50
+ \`bd-checkbox\` is **form-associated**: inside a \`<form>\` it behaves as a
51
+ native checkbox does.
52
+
53
+ | | |
54
+ |---|---|
55
+ | Submit | \`name=value\` when checked — \`name=on\` when it has no \`value\` — and nothing when not. |
56
+ | Reset | Back to the \`checked\` and \`indeterminate\` it joined the page with. |
57
+ | \`required\` | Blocks the submit until it is checked, with the browser's own message. |
58
+ | \`<fieldset disabled>\` | Disables it and leaves it out of the submit, without touching its \`disabled\`. |
59
+ | \`<label for>\`, \`el.click()\` | Toggle it. |
60
+
61
+ \`form\`, \`validity\`, \`validationMessage\`, \`willValidate\`,
62
+ \`checkValidity()\` and \`reportValidity()\` are on the element, as on an
63
+ \`<input>\`. **Fieldset → In a form** shows every control together.
52
64
 
53
65
  ### Events
54
66
  - \`change\` — \`detail: { checked, value }\`, where \`value\` is the \`value\` prop
@@ -75,17 +87,22 @@ from the event or the \`checked\` property instead.
75
87
  },
76
88
  disabled: {
77
89
  control : 'boolean',
78
- description: 'Blocks interaction, greys the box and label, and sets `tabindex="-1"`.',
90
+ description: 'Blocks interaction, greys the box and label, and takes it out of the tab order and out of a form submit.',
91
+ table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'State' }
92
+ },
93
+ required: {
94
+ control : 'boolean',
95
+ description: 'In a form, blocks the submit until the box is checked.',
79
96
  table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'State' }
80
97
  },
81
98
  name: {
82
99
  control : 'text',
83
- description: 'Carried on the `change` event only — this element does not participate in form submission.',
100
+ description: 'The name it submits under in a form. Also carried on the `change` event.',
84
101
  table : { type: { summary: 'string' }, defaultValue: { summary: "''" }, category: 'Data' }
85
102
  },
86
103
  value: {
87
104
  control : 'text',
88
- description: 'Emitted in the `change` event detail when checked, `null` when not.',
105
+ description: 'Submitted with a form when checked (`on` when empty), and emitted in the `change` event detail when checked — `null` when not.',
89
106
  table : { type: { summary: 'string' }, defaultValue: { summary: "''" }, category: 'Data' }
90
107
  }
91
108
  }
@@ -128,7 +145,7 @@ export const Checked = {
128
145
  export const Disabled = {
129
146
  name : 'Disabled (Unchecked)',
130
147
  render : () => html`<bd-checkbox label="This option is unavailable" name="unavailable" value="n/a" disabled></bd-checkbox>`,
131
- parameters: { docs: { description: { story: 'Disabled checkbox — not interactable, `tabindex="-1"`, `aria-disabled="true"`.' } } }
148
+ parameters: { docs: { description: { story: 'Disabled checkbox — not interactable, out of the tab order, announced as disabled.' } } }
132
149
  };
133
150
 
134
151
  export const DisabledChecked = {
@@ -201,7 +218,7 @@ export const Group = {
201
218
  export const KeyboardFocus = {
202
219
  name : 'Keyboard Focus',
203
220
  render: () => html`
204
- <p style="font-size:14px; margin-bottom:8px;">Tab to focus, Space or Enter to toggle.</p>
221
+ <p style="font-size:14px; margin-bottom:8px;">Tab to focus, Space to toggle.</p>
205
222
  <bd-checkbox label="Keyboard accessible checkbox" name="kb" value="kb"></bd-checkbox>
206
223
  `,
207
224
  parameters: { docs: { description: { story: 'Focus ring appears only via keyboard Tab navigation. Clicking with mouse does not show the focus ring.' } } }
@@ -1,10 +1,18 @@
1
1
  import { css, unsafeCSS } from "lit";
2
- import { below } from "../shared/token-scales.js";
2
+ import { below, readAs } from "../shared/token-scales.js";
3
3
 
4
4
  export default css`
5
5
 
6
6
  :host(bd-compare-section) {
7
7
  display: block;
8
+ /* The section is the container its narrow layout reads -- one column of
9
+ cards, the horizontal card stacked, the type a step down -- where it read
10
+ the screen. Across the page the section is as wide as the screen, so
11
+ nothing moves there. width: 100% because a size container contributes
12
+ nothing to its own intrinsic width. */
13
+ container-type: inline-size;
14
+ width: 100%;
15
+ box-sizing: border-box;
8
16
 
9
17
  /* The brand fill and the ink that belongs to it. theme-green and theme-red
10
18
  adopted --status-*-fill / --status-*-on-fill below with the argument that a
@@ -58,7 +66,7 @@ export default css`
58
66
  padding: 0;
59
67
  margin: -1px;
60
68
  overflow: hidden;
61
- clip: rect(0, 0, 0, 0);
69
+ clip-path: inset(50%);
62
70
  white-space: nowrap;
63
71
  border: 0;
64
72
  }
@@ -88,9 +96,9 @@ export default css`
88
96
  align-items: stretch;
89
97
  }
90
98
 
91
- @media ${unsafeCSS(below('md'))} {
99
+ @container ${unsafeCSS(below('md'))} {
92
100
  .cs-grid {
93
- grid-template-columns: 1fr !important;
101
+ grid-template-columns: 1fr;
94
102
  }
95
103
  }
96
104
 
@@ -98,6 +106,18 @@ export default css`
98
106
  grid-column: 1 / -1;
99
107
  }
100
108
 
109
+ /* A card's three parts -- the header, the bars, the footnote -- are three of
110
+ the section's rows, so the bars start on one line across a row of cards
111
+ however many lines a title or a description wraps to. The card spans them
112
+ as a subgrid and so does its .card; inside a card they are 24 apart, the
113
+ card's own gap, while rows of cards keep --cs-gap between them. */
114
+ .cs-grid > ::slotted(compare-card:not([layout="horizontal"])) {
115
+ display: grid;
116
+ grid-row: span 3;
117
+ grid-template-rows: subgrid;
118
+ row-gap: var(--spacing-24);
119
+ }
120
+
101
121
  .card {
102
122
  background: var(--color-surface-container);
103
123
  /* --radius-2xl, the established card-family corner. This card sat at
@@ -109,12 +129,16 @@ export default css`
109
129
  recorded open question. */
110
130
  border-radius: var(--card-radius);
111
131
  padding: var(--card-padding);
112
- display: flex;
113
- flex-direction: column;
114
- gap: var(--spacing-24);
115
- box-sizing: border-box;
116
- height: 100%;
117
- justify-content: flex-start;
132
+ /* In a section, the card's rows are the section's (see above); on its own
133
+ the subgrid has no grid to inherit from, and the parts stack in rows of
134
+ their own, 24 apart either way. */
135
+ display: grid;
136
+ grid-row: 1 / -1;
137
+ grid-template-rows: subgrid;
138
+ row-gap: var(--spacing-24);
139
+ align-content: start;
140
+ box-sizing: border-box;
141
+ height: 100%;
118
142
  }
119
143
 
120
144
  .card-header {
@@ -161,6 +185,13 @@ export default css`
161
185
  flex: 0 0 auto;
162
186
  }
163
187
 
188
+ /* In a card's rows, each part is as tall as itself; the row is as tall as
189
+ the tallest of its row across the cards. */
190
+ .card > .card-bars,
191
+ .card > .card-footnote {
192
+ align-self: start;
193
+ }
194
+
164
195
  /* ── Horizontal layout ──────────────────────────────────────────────────────── */
165
196
 
166
197
  .card--horizontal {
@@ -206,12 +237,39 @@ slot[name="header"] { display: contents; }
206
237
  justify-content: center;
207
238
  }
208
239
 
240
+ /* Narrow, the horizontal card stacks and the type steps down: the section
241
+ title h3 to the h4 size, a card's title h4 to h5, the subtitle and the
242
+ card descriptions regular to small (the horizontal card keeps its type). The level -- as= -- is the page's outline
243
+ and does not move; see readAs() in token-scales.js for how the size does.
244
+
245
+ Twice, because a card is sometimes placed on its own (the SingleCard
246
+ story): with no section around it there is no container to ask, and it
247
+ reads the screen as it always did. In a section the container rule says
248
+ the same thing whenever the screen rule does -- a section is never wider
249
+ than the screen -- and says it alone when the section is narrow on a wide
250
+ screen. */
209
251
  @media ${unsafeCSS(below('md'))} {
210
252
  .card--horizontal {
211
253
  grid-template-columns: 1fr;
212
254
  }
213
255
 
214
256
  .card--horizontal .card-footnote { margin-top: 0; }
257
+
258
+ .card-text-wrap .card-title { ${unsafeCSS(readAs('heading-h4', 'heading-h5'))} }
259
+ .card-text-wrap .card-description { ${unsafeCSS(readAs('body-regular', 'body-small'))} }
260
+ }
261
+
262
+ @container ${unsafeCSS(below('md'))} {
263
+ .card--horizontal {
264
+ grid-template-columns: 1fr;
265
+ }
266
+
267
+ .card--horizontal .card-footnote { margin-top: 0; }
268
+
269
+ .card-text-wrap .card-title { ${unsafeCSS(readAs('heading-h4', 'heading-h5'))} }
270
+ .card-text-wrap .card-description { ${unsafeCSS(readAs('body-regular', 'body-small'))} }
271
+ .cs-title { ${unsafeCSS(readAs('heading-h3', 'heading-h4'))} }
272
+ .cs-subtitle { ${unsafeCSS(readAs('body-regular', 'body-small'))} }
215
273
  }
216
274
 
217
275
  /* Every --cs-bar-* read here carries a fallback, because all of them are