@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.
- package/CHANGELOG.md +91 -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 +3 -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
|
@@ -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
|
-
@
|
|
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
|
-
|
|
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
|
|
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="
|
|
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:
|
|
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
|
-
/* ===
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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
|
-
|
|
85
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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="
|
|
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
|
-
###
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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}"
|
|
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: '
|
|
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 ───────────────────────────────────────────────────────
|