@repobit/dex-system-design 2.5.1 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) 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 +233 -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 +1 -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 +228 -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 +56 -20
  75. package/src/components/grid/grid.js +20 -15
  76. package/src/components/grid/grid.stories.js +39 -11
  77. package/src/components/header/header-code.css.js +20 -11
  78. package/src/components/header/header-code.js +1 -1
  79. package/src/components/header/header.css.js +20 -14
  80. package/src/components/header/header.js +6 -7
  81. package/src/components/header/header.stories.js +29 -24
  82. package/src/components/heading/heading.css.js +11 -0
  83. package/src/components/hero/hero.js +10 -2
  84. package/src/components/highlight/highlight.css.js +30 -6
  85. package/src/components/icons/arrow-icon.js +4 -1
  86. package/src/components/icons/arrow-right-icon.js +5 -1
  87. package/src/components/icons/icon-element.js +18 -0
  88. package/src/components/image/image.js +29 -9
  89. package/src/components/image/image.stories.js +38 -2
  90. package/src/components/input/custom-form.stories.js +38 -7
  91. package/src/components/input/input-clipboard.css.js +15 -1
  92. package/src/components/input/input-clipboard.js +84 -21
  93. package/src/components/input/input.js +27 -7
  94. package/src/components/install-options/install-options.css.js +26 -6
  95. package/src/components/install-options/install-options.js +32 -8
  96. package/src/components/label/label.css.js +1 -1
  97. package/src/components/light-carousel/light-carousel.css.js +100 -48
  98. package/src/components/light-carousel/light-carousel.js +43 -5
  99. package/src/components/link/link.css.js +15 -15
  100. package/src/components/link/link.js +17 -1
  101. package/src/components/link/link.stories.js +20 -7
  102. package/src/components/list/list.css.js +3 -3
  103. package/src/components/logo-marquee/logo-marquee.css.js +12 -1
  104. package/src/components/logo-marquee/logo-marquee.js +33 -8
  105. package/src/components/logo-marquee/logo-marquee.stories.js +10 -4
  106. package/src/components/modal/modal.css.js +74 -40
  107. package/src/components/modal/modal.js +85 -74
  108. package/src/components/modal/modal.stories.js +27 -14
  109. package/src/components/motion-art/motion-art.js +67 -1
  110. package/src/components/page-switcher/page-switcher.css.js +27 -9
  111. package/src/components/page-switcher/page-switcher.js +11 -8
  112. package/src/components/partner-banner/partner-banner.css.js +2 -0
  113. package/src/components/picture/picture.css.js +4 -4
  114. package/src/components/picture/picture.js +13 -3
  115. package/src/components/picture/picture.stories.js +28 -2
  116. package/src/components/post-card/post-card.css.js +18 -3
  117. package/src/components/pricing-cards/adopt-styles.js +16 -0
  118. package/src/components/pricing-cards/new-pricing-card.js +2 -4
  119. package/src/components/pricing-cards/new-pricing-card.stories.js +20 -22
  120. package/src/components/pricing-cards/pricing-card-actions.css.js +8 -12
  121. package/src/components/pricing-cards/pricing-card-actions.js +26 -13
  122. package/src/components/pricing-cards/pricing-card-container.css.js +4 -3
  123. package/src/components/pricing-cards/pricing-card-container.js +10 -4
  124. package/src/components/pricing-cards/pricing-card-header.css.js +5 -4
  125. package/src/components/pricing-cards/pricing-card-header.js +18 -31
  126. package/src/components/pricing-cards/pricing-card-pricing.css.js +84 -61
  127. package/src/components/pricing-cards/pricing-card-pricing.js +38 -24
  128. package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
  129. package/src/components/pricing-cards/pricing-card.css.js +75 -41
  130. package/src/components/pricing-cards/pricing-card.js +356 -308
  131. package/src/components/progress/progress.css.js +58 -13
  132. package/src/components/progress/progress.js +13 -10
  133. package/src/components/progress/progress.stories.js +9 -7
  134. package/src/components/radio/radio-group.css.js +42 -0
  135. package/src/components/radio/radio-group.js +89 -0
  136. package/src/components/radio/radio.css.js +63 -6
  137. package/src/components/radio/radio.js +173 -140
  138. package/src/components/radio/radio.stories.js +99 -44
  139. package/src/components/radio/toggle-radio.js +44 -0
  140. package/src/components/review/review-grid.css.js +5 -1
  141. package/src/components/review/review-grid.js +2 -0
  142. package/src/components/review/review.js +13 -0
  143. package/src/components/shared/announcer.js +37 -0
  144. package/src/components/shared/fill-width.css.js +29 -0
  145. package/src/components/shared/form-control.js +194 -0
  146. package/src/components/shared/form-field.css.js +31 -3
  147. package/src/components/shared/token-scales.js +75 -26
  148. package/src/components/spotlight-section/spotlight-section.js +2 -2
  149. package/src/components/stat/stat-highlight.js +1 -1
  150. package/src/components/stat/stat.css.js +18 -3
  151. package/src/components/switch/switch.css.js +58 -5
  152. package/src/components/switch/switch.js +53 -5
  153. package/src/components/switch/switch.stories.js +30 -8
  154. package/src/components/tab-list/tab-list.css.js +51 -13
  155. package/src/components/tab-list/tab-list.js +7 -2
  156. package/src/components/tab-list/tab-list.stories.js +2 -2
  157. package/src/components/tabs/tabs.css.js +18 -1
  158. package/src/components/tabs/tabs.js +119 -41
  159. package/src/components/terminal/terminal-message.css.js +6 -1
  160. package/src/components/termsOfUse/terms.css.js +4 -2
  161. package/src/components/textarea/textarea.js +22 -7
  162. package/src/components/textarea/textarea.stories.js +12 -9
  163. package/src/components/trust-panel/trust-panel.css.js +13 -3
  164. package/src/components/ultimate-security-demo.stories.js +5 -5
  165. package/src/components/video/video.css.js +5 -0
  166. package/src/components/video/video.js +5 -0
  167. package/src/components/video/video.stories.js +12 -0
  168. package/src/components/video-player/video-player.css.js +20 -8
  169. package/src/components/video-player/video-player.js +74 -20
  170. package/src/components/video-player/video-player.stories.js +17 -3
  171. package/src/tokens/brands.stories.js +1 -1
  172. package/src/tokens/themes/index.js +2 -2
  173. package/src/tokens/typography.stories.js +4 -3
  174. package/src/vendor/motion-art/README.md +4 -1
  175. package/src/components/footer/footer-lp.css.js +0 -159
@@ -5,6 +5,18 @@ export default css`
5
5
  display: block;
6
6
  }
7
7
 
8
+ /* The section is the container its columns and its cards' layout read,
9
+ where they read the screen: across the page the two are the same width,
10
+ in a narrower column the cards step down with it. Only the section --
11
+ this sheet is the item's too, and a card that answered its own queries
12
+ would stack its icon in a two-up row. width: 100% because a size
13
+ container contributes nothing to its own intrinsic width. */
14
+ :host(bd-card-features-section) {
15
+ container-type: inline-size;
16
+ width: 100%;
17
+ box-sizing: border-box;
18
+ }
19
+
8
20
  .bd-card-features-s {
9
21
  display: flex;
10
22
  align-items: center;
@@ -80,13 +92,22 @@ export default css`
80
92
  font-family: var(--typography-fontFamily-sans);
81
93
  }
82
94
 
83
- @media (max-width: 1024px) {
95
+ @container (width <= 1024px) {
84
96
  .bd-card-features-track-s {
85
97
  grid-template-columns: repeat(2, 1fr);
86
98
  }
87
99
  }
88
100
 
89
- @media (max-width: 600px) {
101
+ /* Side by side, every card is as tall as the tallest one in the section,
102
+ row or not: 1fr implicit rows in a grid of auto height all resolve to the
103
+ tallest row's content. The box's height: 100% then fills its row. */
104
+ @container (width > 600px) {
105
+ .bd-card-features-track-s {
106
+ grid-auto-rows: 1fr;
107
+ }
108
+ }
109
+
110
+ @container (width <= 600px) {
90
111
  .bd-card-features-track-s {
91
112
  grid-template-columns: 1fr;
92
113
  }
@@ -16,54 +16,12 @@ class CardFeatures extends LitElement {
16
16
  super();
17
17
  this.title = "";
18
18
  this.headingLevel = 2;
19
- this._resizeObserver = null;
20
- }
21
-
22
- connectedCallback() {
23
- super.connectedCallback();
24
- this._resizeObserver = new ResizeObserver(() => this._equalizeHeights());
25
- this._resizeObserver.observe(this);
26
- }
27
-
28
- disconnectedCallback() {
29
- super.disconnectedCallback();
30
- this._resizeObserver?.disconnect();
31
- }
32
-
33
- firstUpdated() {
34
- this._equalizeHeights();
35
- }
36
-
37
- async _equalizeHeights() {
38
- const items = [...this.querySelectorAll("bd-card-features-item")];
39
- if (!items.length) return;
40
-
41
- // Asteptam ca toate item-urile sa fie randate
42
- await Promise.all(items.map((item) => item.updateComplete));
43
-
44
- const boxes = items
45
- .map((item) => item.shadowRoot?.querySelector(".bd-card-features-box-s"))
46
- .filter(Boolean);
47
-
48
- if (!boxes.length) return;
49
-
50
- // Resetam inaltimea inainte de a masura, altfel maxHeight ramane "blocat"
51
- boxes.forEach((box) => {
52
- box.style.height = "auto";
53
- });
54
-
55
- requestAnimationFrame(() => {
56
- const maxHeight = boxes.reduce(
57
- (max, box) => Math.max(max, box.getBoundingClientRect().height),
58
- 0
59
- );
60
-
61
- boxes.forEach((box) => {
62
- box.style.height = `${maxHeight}px`;
63
- });
64
- });
65
19
  }
66
20
 
21
+ /* Every card in the section is as tall as the tallest, with no script: the
22
+ track's implicit rows are 1fr, which a grid of auto height resolves to its
23
+ tallest row (card-features.css.js). This used to be a ResizeObserver
24
+ measuring every box and writing the tallest height back onto each. */
67
25
 
68
26
  /**
69
27
  * The heading element this section renders. Level is the document-outline
@@ -98,7 +56,7 @@ class CardFeatures extends LitElement {
98
56
  `
99
57
  : null}
100
58
  <div class="bd-card-features-track-s">
101
- <slot @slotchange=${this._equalizeHeights}></slot>
59
+ <slot></slot>
102
60
  </div>
103
61
  </section>
104
62
  `;
@@ -151,7 +109,7 @@ class CardFeaturesItem extends LitElement {
151
109
  if (this.icon) {
152
110
  return html`<img
153
111
  src="${this.icon}"
154
- alt="icon"
112
+ alt=""
155
113
  class="bd-card-features-icon-s"
156
114
  />`;
157
115
  }
@@ -4,15 +4,16 @@ import { above, below } from "../shared/token-scales.js";
4
4
  export default css`
5
5
  :host {
6
6
  display: block;
7
- --bd-card-cols: 4;
8
7
  }
9
8
 
10
9
 
10
+ /* The card's width is the track's: a column of the grid from md (see
11
+ ALIGNED ROWS), the full column below it. The counts the grid reads are
12
+ card.js's, set on the section and inherited; they have no default on
13
+ :host, because bd-card-item adopts this sheet too and a default there
14
+ would shadow the section's count on every card. */
11
15
  ::slotted(bd-card-item) {
12
16
  display: block;
13
- width: var(--bd-card-width, 280px);
14
- flex: 0 0 var(--bd-card-width, 280px);
15
- min-width: 200px;
16
17
  margin: 0;
17
18
  }
18
19
 
@@ -60,7 +61,7 @@ export default css`
60
61
  display: flex;
61
62
  flex-wrap: wrap;
62
63
  justify-content: center;
63
- gap: 1.5rem;
64
+ gap: var(--spacing-24);
64
65
  width: 100%;
65
66
  box-sizing: border-box;
66
67
  padding: 0;
@@ -233,25 +234,40 @@ export default css`
233
234
  display: none;
234
235
  }
235
236
 
236
- /* === ALIGN ROWS — opt-in with align-rows on bd-card-section. The track is
237
- a grid and every card is a subgrid spanning the same rows (header, title,
238
- one per content node, CTA), so rows line up across cards even when their
239
- content wraps differently. Row counts come from _syncAlignRows(). Row gaps
240
- between tracks stay 0 so spacing inside cards is unchanged; spacing
241
- between wrapped card rows comes from the item margin instead. === */
237
+ /* === ALIGNED ROWS. The track is a grid and every card is a subgrid
238
+ spanning the same rows (header, title, one per content node, CTA), so
239
+ rows line up across cards even when their content wraps differently. Row
240
+ counts come from _syncAlignRows(). Row gaps between tracks stay 0 so
241
+ spacing inside cards is unchanged; spacing between wrapped card rows
242
+ comes from the item margin instead.
243
+
244
+ This was the align-rows opt-in, and the default evened the cards out in
245
+ script; it is the only layout now. The track keeps the default's
246
+ geometry: --bd-card-cols cards a row, none narrower than 200, and a short
247
+ last row in the middle. Each card spans two tracks of a grid twice as
248
+ fine, and the first card of a short row starts as many tracks in as the
249
+ row is short (card.js, _syncColumns) -- a wrapping row of cards could
250
+ centre itself, a grid row cannot. The tracks are fixed, not fractions,
251
+ and the grid is centred, which is the flex row's spare space split
252
+ either side. === */
242
253
  @media ${unsafeCSS(above('md'))} {
243
- :host([align-rows]) .bd-light-carousel-track-s {
254
+ .bd-light-carousel-track-s {
255
+ /* half a card: the card is the larger of 200 and its share of the row */
256
+ /* no token: the 200 floor the wrapping row's min-width set */
257
+ --_card-track: calc((max(200px, (100% - (var(--bd-card-cols, 4) - 1) * var(--spacing-24)) / var(--bd-card-cols, 4)) - var(--spacing-24)) / 2);
244
258
  display: grid;
245
- grid-template-columns: repeat(var(--bd-card-cols), minmax(0, 1fr));
259
+ grid-template-columns: repeat(var(--bd-card-tracks, 8), var(--_card-track));
260
+ justify-content: center;
246
261
  column-gap: var(--spacing-24);
247
262
  row-gap: 0;
248
263
  margin-bottom: calc(-1 * var(--spacing-24));
249
264
  }
250
265
 
251
- :host([align-rows]) ::slotted(bd-card-item) {
266
+ ::slotted(bd-card-item) {
252
267
  display: grid;
253
268
  grid-template-rows: subgrid;
254
269
  grid-row: span var(--bd-card-rows, 4);
270
+ grid-column: var(--bd-card-start, auto) / span 2;
255
271
  width: auto;
256
272
  min-width: 0;
257
273
  margin: 0 0 var(--spacing-24) !important;
@@ -295,6 +311,19 @@ export default css`
295
311
  }
296
312
  }
297
313
 
314
+ /* Between md and lg four cards of 200 do not fit the column, so a row
315
+ holds three, as the wrapping row did, and the short row is counted in
316
+ threes. */
317
+ @media ${unsafeCSS(above('md'))} and ${unsafeCSS(below('lg'))} {
318
+ .bd-light-carousel-track-s {
319
+ grid-template-columns: repeat(var(--bd-card-tracks-md, 6), var(--_card-track));
320
+ }
321
+
322
+ ::slotted(bd-card-item) {
323
+ grid-column: var(--bd-card-start-md, auto) / span 2;
324
+ }
325
+ }
326
+
298
327
 
299
328
  @media ${unsafeCSS(below('md'))} {
300
329
  .bd-light-carousel-track-s {
@@ -5,7 +5,6 @@ import "../button/button.js";
5
5
  import "../heading/heading.js";
6
6
  import carouselCSS from "./card.css.js";
7
7
  import { ensembleCSS } from "../shared/ensemble.css.js";
8
- import { matchesBelow } from "../shared/token-scales.js";
9
8
 
10
9
  class Card extends LitElement {
11
10
  static properties = {
@@ -17,12 +16,7 @@ class Card extends LitElement {
17
16
  // centered cards with a light-blue tint, blue title and centered icon.
18
17
  // Propagated to every slotted bd-card-item (see _onSlotChange) unless an
19
18
  // item sets its own variant attribute.
20
- variant : { type: String, reflect: true },
21
- // Opt-in: lays the cards out on a CSS grid and makes every card a subgrid,
22
- // so icon, title, each content row and CTA line up across cards (desktop
23
- // only). Replaces the JS height equalization for this section.
24
- alignRows : { type: Boolean, reflect: true, attribute: "align-rows" },
25
- _itemCount : { state: true }
19
+ variant : { type: String, reflect: true }
26
20
  };
27
21
 
28
22
  constructor() {
@@ -32,16 +26,9 @@ class Card extends LitElement {
32
26
  this.subtitle = "";
33
27
  this.bgBlue = false;
34
28
  this.variant = "";
35
- this.alignRows = false;
36
- this._itemCount = 0;
37
- this._resizeObserver = null;
38
29
  this._mutationObserver = null;
39
30
  }
40
31
 
41
- _isVisible() {
42
- return this.offsetWidth > 0 && this.offsetHeight > 0;
43
- }
44
-
45
32
  _getColumnCount(itemCount) {
46
33
  if (itemCount <= 4) return itemCount;
47
34
  if (itemCount <= 6) return 3;
@@ -50,18 +37,35 @@ class Card extends LitElement {
50
37
  return 4;
51
38
  }
52
39
 
53
- _updateCardWidth() {
54
- const colCount = this._getColumnCount(this._itemCount);
55
- const track = this.renderRoot?.querySelector(".bd-light-carousel-track-s");
56
- if (!track) return;
57
-
58
- const trackW = track.getBoundingClientRect().width;
59
- const gap = 24;
60
- const totalGaps = (colCount - 1) * gap;
61
- const cardW = Math.floor((trackW - totalGaps) / colCount);
40
+ /* The column count follows the number of cards, and card.css.js turns it
41
+ into tracks, so nothing here measures the track. Every card spans two
42
+ tracks of a grid twice as fine, which is what lets a short last row sit
43
+ in the middle, the way the wrapping row this replaces centred it: its
44
+ first card starts as many tracks in as the row is short of cards.
62
45
 
63
- this.style.setProperty("--bd-card-cols", colCount);
64
- this.style.setProperty("--bd-card-width", `${cardW}px`);
46
+ Between md and lg a card's 200px floor fits three to a row, not four,
47
+ so that band has its own count and its own short row. */
48
+ _syncColumns() {
49
+ const items = [...this.querySelectorAll("bd-card-item")];
50
+ const count = items.length;
51
+ const cols = this._getColumnCount(count);
52
+ const colsMd = Math.min(cols, 3);
53
+ this.style.setProperty("--bd-card-cols", cols);
54
+ this.style.setProperty("--bd-card-tracks", cols * 2);
55
+ this.style.setProperty("--bd-card-tracks-md", colsMd * 2);
56
+
57
+ const shortRow = (n) => {
58
+ const left = count % n;
59
+ return left ? { first: count - left, start: n - left + 1 } : null;
60
+ };
61
+ const wide = shortRow(cols);
62
+ const md = shortRow(colsMd);
63
+ items.forEach((item, i) => {
64
+ if (wide?.first === i) item.style.setProperty("--bd-card-start", wide.start);
65
+ else item.style.removeProperty("--bd-card-start");
66
+ if (md?.first === i) item.style.setProperty("--bd-card-start-md", md.start);
67
+ else item.style.removeProperty("--bd-card-start-md");
68
+ });
65
69
  }
66
70
 
67
71
  // Propagates this.variant onto every slotted bd-card-item that didn't
@@ -81,171 +85,34 @@ class Card extends LitElement {
81
85
  });
82
86
  }
83
87
 
84
- // Mirrors align-rows onto every item (their shadow styles key off it) and
85
- // sizes the shared row tracks: header, title, the longest content list, CTA.
88
+ /* Marks every item as a subgrid of the section (their shadow styles key off
89
+ align-rows) and sizes the shared row tracks: header, title, the longest
90
+ content list, CTA. Above md the cards line up row by row through those
91
+ tracks -- card.css.js -- which is what the section used to do in script:
92
+ a ResizeObserver, a wait for the fonts, two animation frames and a px
93
+ height written on every card's header, title, content and box.
94
+
95
+ align-rows was the opt-in to this layout; it is the only one now, so the
96
+ section no longer reads the attribute. */
86
97
  _syncAlignRows() {
87
98
  const items = [...this.querySelectorAll("bd-card-item")];
88
- items.forEach((item) => item.toggleAttribute("align-rows", this.alignRows));
89
- if (!this.alignRows) return;
99
+ items.forEach((item) => item.setAttribute("align-rows", ""));
90
100
 
91
101
  const contentRows = Math.max(0, ...items.map((item) => item._contentNodes?.().length ?? 0));
92
102
  this.style.setProperty("--bd-card-content-rows", contentRows);
93
103
  this.style.setProperty("--bd-card-rows", contentRows + 3);
94
104
  }
95
105
 
96
- updated(changed) {
97
- if (!changed.has("alignRows")) return;
98
- this._syncAlignRows();
99
- if (this.alignRows) this._clearEqualizedHeights();
100
- else this._equalizeHeights();
101
- }
102
-
103
- // Removes the inline heights written by _equalizeHeights (e.g. when
104
- // align-rows is switched on after the section already rendered).
105
- _clearEqualizedHeights() {
106
- this.querySelectorAll("bd-card-item").forEach((item) => {
107
- const root = item.renderRoot;
108
- if (!root) return;
109
- [".bd-light-box-s", ".bd-light-box-header-s", ".bd-light-title-badge-wrapper-s", ".bd-card-content-wrapper"]
110
- .forEach((selector) => {
111
- const el = root.querySelector(selector);
112
- if (el) { el.style.height = ""; el.style.minHeight = ""; }
113
- });
114
- });
115
- }
116
-
117
106
  _onSlotChange = () => {
118
- this._itemCount = this.querySelectorAll("bd-card-item").length;
119
107
  this._propagateVariant();
120
108
  this._syncAlignRows();
121
- this._updateCardWidth();
122
- this.requestUpdate();
123
- this._equalizeHeights();
124
- }
125
-
126
- _equalizeHeights() {
127
- // align-rows sizes cards with subgrid; inline heights would fight it
128
- if (this.alignRows || !this._isVisible()) return;
129
-
130
- const items = Array.from(this.querySelectorAll("bd-card-item"));
131
- if (!items.length) return;
132
-
133
-
134
- /* matchesBelow, not innerWidth <= 768: at exactly 768 the old test was
135
- true while this component's own CSS, which uses below('md'), had
136
- already switched to the wide layout. The two disagreed on one pixel. */
137
- if (matchesBelow('md')) {
138
- items.forEach(item => {
139
- const box = item.renderRoot?.querySelector(".bd-light-box-s");
140
- const iconW = item.renderRoot?.querySelector(".bd-light-box-header-s");
141
- const titleW = item.renderRoot?.querySelector(".bd-light-title-badge-wrapper-s");
142
- const contentW = item.renderRoot?.querySelector(".bd-card-content-wrapper");
143
-
144
- if (box) { box.style.cssText = ""; box.style.width = "100%"; box.style.boxSizing = "border-box"; }
145
- if (iconW) { iconW.style.height = ""; }
146
- if (titleW) { titleW.style.height = ""; }
147
- if (contentW) { contentW.style.height = ""; }
148
- });
149
- return;
150
- }
151
-
152
- items.forEach(item => {
153
- const box = item.renderRoot?.querySelector(".bd-light-box-s");
154
- const iconW = item.renderRoot?.querySelector(".bd-light-box-header-s");
155
- const titleW = item.renderRoot?.querySelector(".bd-light-title-badge-wrapper-s");
156
- const contentW = item.renderRoot?.querySelector(".bd-card-content-wrapper");
157
-
158
- if (box) { box.style.height = "auto"; box.style.minHeight = "0"; }
159
- if (iconW) { iconW.style.height = "auto"; }
160
- if (titleW) { titleW.style.height = "auto"; }
161
- if (contentW) { contentW.style.height = "auto"; }
162
- });
163
-
164
- requestAnimationFrame(() => {
165
- // Egalizare icon wrappers
166
- let maxIcon = 0;
167
- items.forEach(item => {
168
- const el = item.renderRoot?.querySelector(".bd-light-box-header-s");
169
- if (!el) return;
170
- const h = el.getBoundingClientRect().height;
171
- if (h > maxIcon) maxIcon = h;
172
- });
173
- if (maxIcon > 0) {
174
- items.forEach(item => {
175
- const el = item.renderRoot?.querySelector(".bd-light-box-header-s");
176
- if (el) el.style.height = `${maxIcon}px`;
177
- });
178
- }
179
-
180
- // Egalizare title wrappers
181
- let maxTitle = 0;
182
- items.forEach(item => {
183
- const el = item.renderRoot?.querySelector(".bd-light-title-badge-wrapper-s");
184
- if (!el) return;
185
- const h = el.getBoundingClientRect().height;
186
- if (h > maxTitle) maxTitle = h;
187
- });
188
- if (maxTitle > 0) {
189
- items.forEach(item => {
190
- const el = item.renderRoot?.querySelector(".bd-light-title-badge-wrapper-s");
191
- if (el) el.style.height = `${maxTitle}px`;
192
- });
193
- }
194
-
195
- // Egalizare content wrappers
196
- let maxContent = 0;
197
- items.forEach(item => {
198
- const el = item.renderRoot?.querySelector(".bd-card-content-wrapper");
199
- if (!el) return;
200
- const h = el.getBoundingClientRect().height;
201
- if (h > maxContent) maxContent = h;
202
- });
203
- if (maxContent > 0) {
204
- items.forEach(item => {
205
- const el = item.renderRoot?.querySelector(".bd-card-content-wrapper");
206
- if (el) el.style.height = `${maxContent}px`;
207
- });
208
- }
209
-
210
- // Egalizare height total
211
- let maxH = 0;
212
- items.forEach(item => {
213
- const box = item.renderRoot?.querySelector(".bd-light-box-s");
214
- if (!box) return;
215
- const h = box.getBoundingClientRect().height;
216
- if (h > maxH) maxH = h;
217
- });
218
- if (maxH > 0) {
219
- items.forEach(item => {
220
- const box = item.renderRoot?.querySelector(".bd-light-box-s");
221
- if (box) {
222
- box.style.height = `${maxH}px`;
223
- box.style.minHeight = `${maxH}px`;
224
- }
225
- });
226
- }
227
- });
109
+ this._syncColumns();
228
110
  }
229
111
 
230
- async firstUpdated() {
231
- if (document.fonts?.ready) {
232
- await document.fonts.ready;
233
- }
234
-
235
- await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)));
112
+ firstUpdated() {
236
113
  this._propagateVariant();
237
114
  this._syncAlignRows();
238
- this._updateCardWidth();
239
- this._equalizeHeights();
240
-
241
- const track = this.renderRoot.querySelector(".bd-light-carousel-track-s");
242
- if (track) {
243
- this._resizeObserver = new ResizeObserver(() => {
244
- this._updateCardWidth();
245
- this._equalizeHeights();
246
- });
247
- this._resizeObserver.observe(track);
248
- }
115
+ this._syncColumns();
249
116
 
250
117
  // Content added to or removed from an item changes its row count, which
251
118
  // doesn't trigger slotchange on the section.
@@ -255,7 +122,6 @@ class Card extends LitElement {
255
122
 
256
123
  disconnectedCallback() {
257
124
  super.disconnectedCallback();
258
- this._resizeObserver?.disconnect();
259
125
  this._mutationObserver?.disconnect();
260
126
  }
261
127
 
@@ -370,7 +236,7 @@ class CardItem extends LitElement {
370
236
  if (this.icon) {
371
237
  return html`<img
372
238
  src="${this.icon}"
373
- alt="icon"
239
+ alt=""
374
240
  class="bd-light-icon-s"
375
241
  style="width: ${iconW}px; height: ${iconH}px;"
376
242
  />`;
@@ -35,12 +35,12 @@ icon/text) — set it once on the section, it propagates to all items
35
35
  automatically. Leaving \`variant\` unset keeps the existing grey-box look.
36
36
  An individual \`bd-card-item\` can opt out with \`variant=""\` explicitly.
37
37
 
38
- ### Align rows
39
- \`align-rows\` on \`bd-card-section\` lays the cards out with CSS subgrid
40
- (above 768px): icon, title, each content element and the CTA line up across
41
- cards, even when one card's text wraps to more lines. It replaces the JS
42
- height equalization for that section. Note: an incomplete last row is
43
- left-aligned instead of centered.
38
+ ### Aligned rows
39
+ Above 768px the cards are laid out with CSS subgrid: icon, title, each content
40
+ element and the CTA line up across the cards of a row, even when one card's
41
+ text wraps to more lines. A short last row is centred. This used to be the
42
+ \`align-rows\` opt-in beside a script that evened card heights out; it is the
43
+ only layout now, so the attribute does nothing and can be dropped.
44
44
  `
45
45
  }
46
46
  }
@@ -284,7 +284,6 @@ const storeBadge = (n) => {
284
284
  export const AlignRows = {
285
285
  name: 'Align Rows (subgrid)',
286
286
  args: {
287
- alignRows : true,
288
287
  align : 'center',
289
288
  variant : '',
290
289
  showCta : true,
@@ -303,7 +302,6 @@ export const AlignRows = {
303
302
  card4Extra: ''
304
303
  },
305
304
  argTypes: {
306
- alignRows : { control: 'boolean', description: '`align-rows` on bd-card-section — toggle to compare with the JS height equalization' },
307
305
  align : { control: { type: 'select' }, options: ['start', 'center'], description: 'bd-card-item align' },
308
306
  variant : { control: { type: 'select' }, options: ['', 'outline'], description: 'bd-card-section variant' },
309
307
  showCta : { control: 'boolean', description: 'Render a CTA (slot="cta") in every card' },
@@ -315,7 +313,7 @@ export const AlignRows = {
315
313
  ]))
316
314
  },
317
315
  render: (args) => html`
318
- <bd-card-section title="Also free" variant="${args.variant}" ?align-rows=${args.alignRows}>
316
+ <bd-card-section title="Also free" variant="${args.variant}">
319
317
  ${[1, 2, 3, 4]
320
318
  .filter((n) => args[`card${n}Title`])
321
319
  .map((n) => html`
@@ -329,7 +327,7 @@ export const AlignRows = {
329
327
  `)}
330
328
  </bd-card-section>
331
329
  `,
332
- parameters: { docs: { description: { story: 'With `align-rows`, each row (icon, title, every content element, CTA) has the same height across cards, via CSS subgrid. Use the controls to toggle it and change card content. Rows only align above 768px — widen the canvas.' } } }
330
+ parameters: { docs: { description: { story: 'Each row (icon, title, every content element, CTA) has the same height across cards, via CSS subgrid. Change card content in the controls to see a longer title or an extra paragraph move its row in every card. Rows only align above 768px — widen the canvas.' } } }
333
331
  };
334
332
 
335
333
  // ─── No Slotted Content ───────────────────────────────────────────────────────