@repobit/dex-system-design 2.1.1 → 2.2.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 (80) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +6 -3
  3. package/schemas/component-manifest.json +16 -7
  4. package/src/assets/images/awards/av-comparatives-2025.png +0 -0
  5. package/src/assets/images/awards/av-test-top-product.png +0 -0
  6. package/src/assets/images/awards/gartner-peer-insights.png +0 -0
  7. package/src/assets/images/awards/idc.png +0 -0
  8. package/src/assets/images/awards/pcmag-best-of-2026.png +0 -0
  9. package/src/components/accordion/accordion-bg.css.js +1 -1
  10. package/src/components/accordion/accordion.css.js +2 -2
  11. package/src/components/alert/alert.css.js +1 -1
  12. package/src/components/anchor/anchor-nav.css.js +7 -7
  13. package/src/components/awards/awards-flex.css.js +3 -3
  14. package/src/components/awards/awards-spotlight.css.js +132 -0
  15. package/src/components/awards/awards-spotlight.js +130 -0
  16. package/src/components/awards/awards-spotlight.stories.js +205 -0
  17. package/src/components/awards/awards.css.js +1 -1
  18. package/src/components/back/back.css.js +1 -1
  19. package/src/components/bento-grid/bento-grid.css.js +1 -1
  20. package/src/components/bento-grid/bento-item.css.js +1 -1
  21. package/src/components/breadcrumb/breadcrumb.css.js +1 -1
  22. package/src/components/button/button.css.js +72 -1
  23. package/src/components/button/button.js +3 -2
  24. package/src/components/button/button.stories.js +18 -2
  25. package/src/components/cards/card.css.js +1 -1
  26. package/src/components/checkbox/checkbox.css.js +5 -3
  27. package/src/components/code/code.css.js +2 -2
  28. package/src/components/compare/compare.css.js +2 -2
  29. package/src/components/compatibility-table/compatibility-table.css.js +3 -3
  30. package/src/components/cta-banner/cta-banner.css.js +3 -3
  31. package/src/components/cta-banner/cta-banner.js +1 -1
  32. package/src/components/display/display.stories.js +1 -1
  33. package/src/components/divider/divider.stories.js +2 -2
  34. package/src/components/features-tab/features-tab.css.js +1 -1
  35. package/src/components/fieldset/fieldset.css.js +1 -1
  36. package/src/components/footer/footer-lp.css.js +1 -1
  37. package/src/components/footer/footer-lp.js +8 -0
  38. package/src/components/footer/footer.css.js +2 -2
  39. package/src/components/footer/footer.js +8 -0
  40. package/src/components/header/header-code.css.js +4 -4
  41. package/src/components/header/header.css.js +6 -6
  42. package/src/components/heading/heading.stories.js +1 -1
  43. package/src/components/highlight/highlight.css.js +2 -2
  44. package/src/components/image/image.css.js +6 -6
  45. package/src/components/install-options/install-options.css.js +7 -7
  46. package/src/components/link/link.css.js +23 -0
  47. package/src/components/link/link.stories.js +16 -1
  48. package/src/components/modal/modal.css.js +3 -3
  49. package/src/components/paragraph/paragraph.stories.js +4 -4
  50. package/src/components/picture/picture.css.js +6 -6
  51. package/src/components/pricing-cards/new-pricing.css.js +1 -1
  52. package/src/components/pricing-cards/pricing-card-header.css.js +1 -1
  53. package/src/components/pricing-cards/pricing-card.css.js +3 -3
  54. package/src/components/radio/radio.css.js +2 -2
  55. package/src/components/review/review.css.js +1 -1
  56. package/src/components/review/review.js +3 -2
  57. package/src/components/shared/token-scales.js +19 -9
  58. package/src/components/skeleton/skeleton.css.js +1 -1
  59. package/src/components/spinner/spinner.css.js +1 -1
  60. package/src/components/spotlight-section/spotlight-section.css.js +7 -7
  61. package/src/components/spotlight-section/spotlight-section.js +3 -3
  62. package/src/components/switch/switch.css.js +3 -0
  63. package/src/components/tab-list/tab-list.css.js +2 -2
  64. package/src/components/tabs/tabs.css.js +1 -1
  65. package/src/components/terminal/terminal-cursor.js +1 -1
  66. package/src/components/terminal/terminal-message.css.js +4 -4
  67. package/src/components/tooltip/tooltip.css.js +1 -1
  68. package/src/components/video/video.css.js +1 -1
  69. package/src/components/video-player/video-player.css.js +3 -3
  70. package/src/components/video-player/video-player.js +1 -1
  71. package/src/tokens/brand-layer.js +185 -0
  72. package/src/tokens/brands.stories.js +235 -0
  73. package/src/tokens/dark-derivation.js +10 -1
  74. package/src/tokens/dark-findings.js +14 -7
  75. package/src/tokens/shape.stories.js +5 -0
  76. package/src/tokens/themes/bitdefender.js +30 -0
  77. package/src/tokens/themes/contract.js +27 -0
  78. package/src/tokens/themes/index.js +41 -0
  79. package/src/tokens/tokens.css +121 -39
  80. package/src/tokens/tokens.js +130 -40
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.2.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@2.1.1...@repobit/dex-system-design@2.2.0) (2026-10-21)
7
+
8
+ ### Features
9
+
10
+ * **DEX-1014:** bd-awards-spotlight is the homepage awards carousel, one award a slide
11
+ * **DEX-28949:** a shape ramp, so a partner theme can restate corners
12
+ * **DEX-28949:** brand themes on one foundation, Bitdefender as the default
13
+ * **DEX-28949:** color="on-brand", the ink for a brand band
14
+ * **DEX-28949:** fail a component that names the brand family's palette step
15
+ * **DEX-28949:** give a brand its own ink, for the fills that are the brand's
16
+ * **DEX-28949:** give the brand a ramp, and a [data-brand] block per brand
17
+ * **DEX-28949:** surface="brand" for bd-button and bd-link
18
+ * **DEX-28949:** the footer stays Bitdefender on a co-branded page
19
+
20
+ ### Bug Fixes
21
+
22
+ * **DEX-1014:** awards spotlight slides fade into the card's edge as they move
23
+ * **DEX-28949:** the dark-mode derivation sees through the brand's ink too
24
+
25
+
6
26
  ## [2.1.1](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@2.1.0...@repobit/dex-system-design@2.1.1) (2026-10-19)
7
27
 
8
28
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repobit/dex-system-design",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Design system based on Web Components.",
5
5
  "author": "Iordache Matei Cezar <miordache@bitdefender.com>",
6
6
  "homepage": "https://github.com/bitdefender/dex-core#readme",
@@ -128,10 +128,13 @@
128
128
  "check:attributes:selftest": "node scripts/check-attribute-contract.mjs --contract-selftest",
129
129
  "check:attributes:negative": "node scripts/check-attribute-contract.mjs --negative-control",
130
130
  "lint:tokens:selftest": "node scripts/lint-tokens.mjs --selftest",
131
- "check:ds": "npm run build:tokens:check && npm run check:token-tiers:selftest && npm run check:token-tiers:negative && npm run check:token-tiers && npm run check:manifest && npm run check:architecture && npm run check:architecture:selftest && npm run check:architecture:negative && npm run check:ensemble && npm run check:ensemble:selftest && npm run check:ensemble:negative && npm run check:baseline:selftest && npm run check:semantic-coverage:selftest && npm run check:semantic-coverage:negative && npm run check:semantic-coverage && npm run check:color-coverage:selftest && npm run check:color-coverage && npm run check:icons:selftest && npm run check:icons:negative && npm run check:icons && npm run check:aliases:selftest && npm run check:aliases && npm run check:host-selectors:selftest && npm run check:host-selectors:negative && npm run check:host-selectors && npm run check:spacing-scale:selftest && npm run check:spacing-scale:negative && npm run check:spacing-scale && npm run check:enum-vocabulary:selftest && npm run check:enum-vocabulary:negative && npm run check:enum-vocabulary && npm run check:accessible-names:selftest && npm run check:accessible-names:negative && npm run check:accessible-names && npm run check:docs:selftest && npm run check:docs:negative && npm run check:docs && npm run lint:tokens:selftest && npm run lint:tokens",
131
+ "check:ds": "npm run build:tokens:check && npm run verify:brands:selftest && npm run check:token-tiers:selftest && npm run check:token-tiers:negative && npm run check:token-tiers && npm run check:manifest && npm run check:architecture && npm run check:architecture:selftest && npm run check:architecture:negative && npm run check:ensemble && npm run check:ensemble:selftest && npm run check:ensemble:negative && npm run check:baseline:selftest && npm run check:semantic-coverage:selftest && npm run check:semantic-coverage:negative && npm run check:semantic-coverage && npm run check:color-coverage:selftest && npm run check:color-coverage && npm run check:icons:selftest && npm run check:icons:negative && npm run check:icons && npm run check:aliases:selftest && npm run check:aliases && npm run check:host-selectors:selftest && npm run check:host-selectors:negative && npm run check:host-selectors && npm run check:spacing-scale:selftest && npm run check:spacing-scale:negative && npm run check:spacing-scale && npm run check:enum-vocabulary:selftest && npm run check:enum-vocabulary:negative && npm run check:enum-vocabulary && npm run check:accessible-names:selftest && npm run check:accessible-names:negative && npm run check:accessible-names && npm run check:docs:selftest && npm run check:docs:negative && npm run check:docs && npm run lint:tokens:selftest && npm run lint:tokens",
132
132
  "version": "node scripts/sync-manifest-version.mjs",
133
133
  "ci:ds": "npm run check:ds && npm run verify:runtime && npm run check:attributes:selftest && npm run check:attributes:negative && npm run check:attributes",
134
134
  "verify:runtime": "node scripts/verify-runtime.mjs --selftest",
135
+ "verify:brands": "node scripts/verify-brands.mjs",
136
+ "verify:brands:selftest": "node scripts/verify-brands.mjs --selftest",
137
+ "verify:brands:sweep": "node scripts/verify-brands.mjs --sweep",
135
138
  "verify:render": "node scripts/render-health.mjs",
136
139
  "verify:render:negative": "node scripts/render-health.mjs --negative-control",
137
140
  "verify:typography": "node scripts/render-health.mjs --typography",
@@ -179,5 +182,5 @@
179
182
  "volta": {
180
183
  "node": "24.14.0"
181
184
  },
182
- "gitHead": "543f46ab9cfdf4943d3c1b9839eb414fd12bd835"
185
+ "gitHead": "a168633de5b60ac6754e69314b2d723eee2ebeda"
183
186
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifestVersion": 1,
3
3
  "package": "@repobit/dex-system-design",
4
- "packageVersion": "2.1.1",
4
+ "packageVersion": "2.2.0",
5
5
  "generatedFrom": [
6
6
  "package.json exports",
7
7
  "Lit static properties",
@@ -746,9 +746,10 @@
746
746
  "type": "string",
747
747
  "enum": [
748
748
  "light",
749
- "dark"
749
+ "dark",
750
+ "brand"
750
751
  ],
751
- "description": "The surface the button sits on. Use \"dark\" inside a hero or panel that has a full background colour — on a light page every variant is legible, on a coloured one most are not."
752
+ "description": "The surface the button sits on. Use \"dark\" inside a hero or panel that has a full background colour — on a light page every variant is legible, on a coloured one most are not. Use \"brand\" on a band filled with the brand itself (--color-surface-brand): every variant is drawn in the brand's ink, so it stays legible on a co-branded page whose partner brand is light."
752
753
  },
753
754
  {
754
755
  "name": "shape",
@@ -916,9 +917,10 @@
916
917
  "type": "string",
917
918
  "enum": [
918
919
  "light",
919
- "dark"
920
+ "dark",
921
+ "brand"
920
922
  ],
921
- "description": "The surface the button sits on. Use \"dark\" inside a hero or panel that has a full background colour — on a light page every variant is legible, on a coloured one most are not."
923
+ "description": "The surface the button sits on. Use \"dark\" inside a hero or panel that has a full background colour — on a light page every variant is legible, on a coloured one most are not. Use \"brand\" on a band filled with the brand itself (--color-surface-brand): every variant is drawn in the brand's ink, so it stays legible on a co-branded page whose partner brand is light."
922
924
  },
923
925
  {
924
926
  "name": "shape",
@@ -1422,6 +1424,7 @@
1422
1424
  "muted",
1423
1425
  "subtle",
1424
1426
  "inverse",
1427
+ "on-brand",
1425
1428
  "success",
1426
1429
  "warning",
1427
1430
  "error"
@@ -1461,6 +1464,7 @@
1461
1464
  "muted",
1462
1465
  "subtle",
1463
1466
  "inverse",
1467
+ "on-brand",
1464
1468
  "success",
1465
1469
  "warning",
1466
1470
  "error"
@@ -1536,6 +1540,7 @@
1536
1540
  "muted",
1537
1541
  "subtle",
1538
1542
  "inverse",
1543
+ "on-brand",
1539
1544
  "success",
1540
1545
  "warning",
1541
1546
  "error"
@@ -1945,6 +1950,7 @@
1945
1950
  "muted",
1946
1951
  "subtle",
1947
1952
  "inverse",
1953
+ "on-brand",
1948
1954
  "success",
1949
1955
  "warning",
1950
1956
  "error"
@@ -2396,9 +2402,10 @@
2396
2402
  "type": "string",
2397
2403
  "enum": [
2398
2404
  "light",
2399
- "dark"
2405
+ "dark",
2406
+ "brand"
2400
2407
  ],
2401
- "description": "The surface the link sits on, as on bd-button. Replaces the earlier kind=\"light\", which described the surface rather than the link and could not be combined with a real kind; that value still maps onto surface=\"dark\"."
2408
+ "description": "The surface the link sits on, as on bd-button. \"brand\" is a band filled with the brand itself, and takes the brand's ink. Replaces the earlier kind=\"light\", which described the surface rather than the link and could not be combined with a real kind; that value still maps onto surface=\"dark\"."
2402
2409
  },
2403
2410
  {
2404
2411
  "name": "href",
@@ -2455,6 +2462,7 @@
2455
2462
  "muted",
2456
2463
  "subtle",
2457
2464
  "inverse",
2465
+ "on-brand",
2458
2466
  "success",
2459
2467
  "warning",
2460
2468
  "error"
@@ -2735,6 +2743,7 @@
2735
2743
  "muted",
2736
2744
  "subtle",
2737
2745
  "inverse",
2746
+ "on-brand",
2738
2747
  "success",
2739
2748
  "warning",
2740
2749
  "error"
Binary file
@@ -17,7 +17,7 @@ export default css`
17
17
  padding: 0 var(--spacing-16);
18
18
  box-sizing: border-box;
19
19
  background-color: var(--status-brand-surface);
20
- border-radius: var(--radius-lg);
20
+ border-radius: var(--shape-radius-lg);
21
21
  overflow: visible;
22
22
  }
23
23
 
@@ -5,7 +5,7 @@ export const accordionItem = css`
5
5
  display: block;
6
6
  margin-bottom: var(--bd-acc-item-margin-bottom, var(--spacing-16));
7
7
  box-sizing: border-box;
8
- border-radius: var(--radius-sm);
8
+ border-radius: var(--shape-radius-sm);
9
9
  }
10
10
 
11
11
  /* The one focus ring, on the item.
@@ -179,7 +179,7 @@ export const accordionItem = css`
179
179
  }
180
180
 
181
181
  :host-context(bd-accordion-section[variant="small"]) .header[aria-expanded="true"] .title {
182
- color: var(--color-blue-800);
182
+ color: var(--color-brand-800);
183
183
  }
184
184
 
185
185
  :host-context(bd-accordion-section[variant="small"]) .header[aria-expanded="true"]:hover .title {
@@ -53,7 +53,7 @@ export const alertCSS = css`
53
53
  align-items: flex-start;
54
54
  gap: var(--spacing-12);
55
55
  padding: var(--spacing-16);
56
- border-radius: var(--radius-lg);
56
+ border-radius: var(--shape-radius-lg);
57
57
  font-family: var(--typography-fontFamily-sans);
58
58
  /* Set ONCE, here. The title differs from the description by weight only,
59
59
  which is what the design does too -- Body/medium/semibold over
@@ -221,7 +221,7 @@ export const anchorNavStyles = css`
221
221
  neutral-200 is border-subtle's value, which is documented as the wrong
222
222
  role for the edge of something a person operates. */
223
223
  border: var(--border-width-1) solid var(--color-border-default);
224
- border-radius: var(--radius-lg);
224
+ border-radius: var(--shape-radius-lg);
225
225
  cursor: pointer;
226
226
  text-align: left;
227
227
  transition:
@@ -259,7 +259,7 @@ export const anchorNavStyles = css`
259
259
  means focused rather than expanded; the two states are independent here,
260
260
  since the toggle can be focused and closed. Expanded has no vocabulary
261
261
  in either control family. */
262
- border-color: var(--color-blue-200);
262
+ border-color: var(--color-brand-200);
263
263
  }
264
264
 
265
265
  .bd-anchor-nav__dropdown-label {
@@ -302,9 +302,9 @@ export const anchorNavStyles = css`
302
302
  max-height: min(50vh, 20rem);
303
303
  overflow-y: auto;
304
304
  background: var(--color-surface-default);
305
- border: var(--border-width-1) solid var(--color-blue-200);
305
+ border: var(--border-width-1) solid var(--color-brand-200);
306
306
  border-top: none;
307
- border-radius: var(--radius-none) var(--radius-none) var(--radius-lg) var(--radius-lg);
307
+ border-radius: var(--radius-none) var(--radius-none) var(--shape-radius-lg) var(--shape-radius-lg);
308
308
  box-shadow: var(--shadow-md);
309
309
  }
310
310
 
@@ -343,7 +343,7 @@ export const anchorNavStyles = css`
343
343
  color: var(--color-text-brand);
344
344
  background: transparent;
345
345
  border: none;
346
- border-radius: var(--radius-md);
346
+ border-radius: var(--shape-radius-md);
347
347
  cursor: pointer;
348
348
  text-align: left;
349
349
  transition:
@@ -378,14 +378,14 @@ export const anchorNavStyles = css`
378
378
  weight, not a text-content type. 700, the same as bd-link's
379
379
  .bd-link--active and bd-tab-list's selected tab. */
380
380
  font-weight: var(--typography-fontWeight-bold);
381
- background: var(--color-blue-50);
381
+ background: var(--color-brand-50);
382
382
  color: var(--color-text-primary);
383
383
  }
384
384
 
385
385
  /* The current option does not move under the pointer, as on the bars. */
386
386
  .bd-anchor-nav__dropdown-option--active:hover {
387
387
  color: var(--color-text-primary);
388
- background: var(--color-blue-50);
388
+ background: var(--color-brand-50);
389
389
  }
390
390
 
391
391
  ::slotted([slot="cta"]) {
@@ -10,7 +10,7 @@ export const awardsFlexCSS = css`
10
10
  width: 100%;
11
11
  box-sizing: border-box;
12
12
  padding-block: var(--spacing-32);
13
- border-radius: var(--radius-2xl);
13
+ border-radius: var(--shape-radius-2xl);
14
14
  text-align: center;
15
15
  font-family: var(--typography-fontFamily-sans);
16
16
  min-height: var(--bd-awardsflex-min-height, 320px);
@@ -53,7 +53,7 @@ export const awardsFlexCSS = css`
53
53
  gained is a line that means something. Visible: the hairline becomes
54
54
  slightly more definite. */
55
55
  border: var(--border-width-2) solid var(--color-border-container);
56
- border-radius: var(--radius-2xl);
56
+ border-radius: var(--shape-radius-2xl);
57
57
  padding-block: var(--spacing-64);
58
58
  }
59
59
 
@@ -80,7 +80,7 @@ export const awardsFlexCSS = css`
80
80
  6.18:1 -> 4.53:1; against the tint variant's blue-50 host, 5.72:1 ->
81
81
  4.20:1. Both clear the 3:1 non-text minimum, and a decorative graphic
82
82
  has no minimum at all. */
83
- color: var(--color-blue-500);
83
+ color: var(--color-brand-500);
84
84
  margin-bottom: var(--spacing-8);
85
85
  }
86
86
 
@@ -0,0 +1,132 @@
1
+ import { css, unsafeCSS } from "lit";
2
+ import { above } from "../shared/token-scales.js";
3
+
4
+ /* Mobile first, in the three steps the Figma set draws: a phone (24 inside
5
+ the card), sm and up (32, the 656 tablet card), and lg and up, where the
6
+ mark moves beside the copy (64, the 1200 desktop card). Each step's gaps are
7
+ the ones the design declares for it. */
8
+ export const awardsSpotlightCSS = css`
9
+ :host {
10
+ display: block;
11
+ }
12
+
13
+ .card {
14
+ /* the card's inside edge, at each step: the padding, and the width of
15
+ the band the slides fade across */
16
+ --bd-awards-spotlight-inset: var(--spacing-24);
17
+ display: flex;
18
+ flex-direction: column;
19
+ align-items: center;
20
+ gap: var(--spacing-24);
21
+ padding: var(--bd-awards-spotlight-inset);
22
+ /* surface/info, the role the design binds: a tint that marks the card
23
+ off from the page without an edge. On it the title is text-brand,
24
+ blue-600 on blue-50 at 5.72:1, and the body text-primary at 16.65:1. */
25
+ background: var(--color-surface-info);
26
+ border-radius: var(--shape-radius-3xl);
27
+ }
28
+
29
+ /* The window the slides move through runs to the card's own edges, and
30
+ fades out across the padding. A slide at rest starts where the fade
31
+ ends, so it is untouched; a slide on the move dissolves into the card's
32
+ edge instead of being cut on a hard line inside it -- which is what
33
+ clipping at the padding did. */
34
+ .viewport {
35
+ width: calc(100% + 2 * var(--bd-awards-spotlight-inset));
36
+ margin-inline: calc(-1 * var(--bd-awards-spotlight-inset));
37
+ overflow: hidden;
38
+ /* no token: a mask is read for its alpha only, so the colour is a
39
+ placeholder for "opaque" and carries no ink */
40
+ mask-image: linear-gradient(
41
+ to right,
42
+ transparent,
43
+ black var(--bd-awards-spotlight-inset),
44
+ black calc(100% - var(--bd-awards-spotlight-inset)),
45
+ transparent
46
+ );
47
+ }
48
+
49
+ /* Every slide stretches to the tallest, which is what keeps the dots in one
50
+ place as the slides change. */
51
+ .track {
52
+ display: flex;
53
+ transition: transform var(--transition-duration-slower) var(--transition-easing-smooth);
54
+ }
55
+
56
+ .slide {
57
+ flex: 0 0 100%;
58
+ display: flex;
59
+ flex-direction: column;
60
+ gap: var(--spacing-16);
61
+ padding-inline: var(--bd-awards-spotlight-inset);
62
+ box-sizing: border-box;
63
+ min-width: 0;
64
+ }
65
+
66
+ .logo {
67
+ flex: none;
68
+ /* no token: the award column. The marks are publisher artwork at 160
69
+ wide (IDC 132), and the column holds 160 so every title starts on the
70
+ same line; the dimension scale stops at 64. */
71
+ width: 160px;
72
+ }
73
+
74
+ .copy {
75
+ display: flex;
76
+ flex-direction: column;
77
+ gap: var(--spacing-12);
78
+ min-width: 0;
79
+ }
80
+
81
+ .title {
82
+ margin: 0;
83
+ }
84
+
85
+ /* The paragraph is the body-regular role, set here rather than through
86
+ bd-p: bd-p closes every paragraph with a 16px margin inside its own
87
+ shadow root, which this component cannot reach, and it would land under
88
+ the last line of every slide. */
89
+ .body {
90
+ margin: 0;
91
+ font-family: var(--typography-body-regular-fontFamily);
92
+ font-size: var(--typography-body-regular-fontSize);
93
+ font-weight: var(--typography-body-regular-fontWeight);
94
+ line-height: var(--typography-body-regular-lineHeight);
95
+ letter-spacing: var(--typography-body-regular-letterSpacing);
96
+ color: var(--color-text-primary);
97
+ }
98
+
99
+ @media ${unsafeCSS(above("sm"))} {
100
+ .card {
101
+ --bd-awards-spotlight-inset: var(--spacing-32);
102
+ gap: var(--spacing-32);
103
+ }
104
+
105
+ .slide {
106
+ gap: var(--spacing-24);
107
+ }
108
+ }
109
+
110
+ @media ${unsafeCSS(above("lg"))} {
111
+ .card {
112
+ --bd-awards-spotlight-inset: var(--spacing-64);
113
+ gap: var(--spacing-48);
114
+ }
115
+
116
+ .slide {
117
+ flex-direction: row;
118
+ gap: var(--spacing-48);
119
+ }
120
+
121
+ .copy {
122
+ flex: 1;
123
+ gap: var(--spacing-24);
124
+ }
125
+ }
126
+
127
+ @media (prefers-reduced-motion: reduce) {
128
+ .track {
129
+ transition: none;
130
+ }
131
+ }
132
+ `;
@@ -0,0 +1,130 @@
1
+ import { LitElement, html, nothing } from "lit";
2
+ import { tokens } from "../../tokens/tokens.js";
3
+ import "../heading/heading.js";
4
+ import "../image/image.js";
5
+ import "../pagination-dots/pagination-dots.js";
6
+ import { awardsSpotlightCSS } from "./awards-spotlight.css.js";
7
+ import { ensembleCSS } from "../shared/ensemble.css.js";
8
+
9
+ /**
10
+ * The homepage awards carousel: one award a slide, on a card. Each slide is
11
+ * the award's mark, a title and a paragraph that says what the award is for;
12
+ * the dots sit inside the card, under the slides. Drawn in the foundation
13
+ * Figma file as Awards spotlight (desktop, tablet and mobile) and Award logo.
14
+ *
15
+ * Not bd-awards-flex. That one pages small quote cards, three a slide, under a
16
+ * laurel and a headline of its own; this one gives each award room to say why
17
+ * it was won, and leaves the section heading to the page around it.
18
+ *
19
+ * The slides are as tall as the tallest one -- the track stretches them -- so
20
+ * the dots stay put from slide to slide and the section does not jump.
21
+ *
22
+ * Autoplay is bd-pagination-dots': the progress in the current pill is the
23
+ * clock. The pointer or focus on the slides holds it, a visitor picking a dot
24
+ * stops it for good, and under prefers-reduced-motion it never starts.
25
+ */
26
+ export class AwardsSpotlight extends LitElement {
27
+ static properties = {
28
+ awards : { type: Array },
29
+ label : { type: String },
30
+ as : { type: String },
31
+ autoplay : { type: Boolean },
32
+ autoplayDelay: { type: Number, attribute: "autoplay-delay" },
33
+ _slide : { state: true },
34
+ _hovered : { state: true },
35
+ _focusWithin : { state: true },
36
+ _live : { state: true }
37
+ };
38
+
39
+ static styles = [tokens, ensembleCSS, awardsSpotlightCSS];
40
+
41
+ constructor() {
42
+ super();
43
+ this.awards = [];
44
+ this.label = "Awards and recognition";
45
+ // The page's section heading is the h2 above this; each award is under it.
46
+ this.as = "h3";
47
+ this.autoplay = false;
48
+ this.autoplayDelay = 6000;
49
+ this._slide = 0;
50
+ this._hovered = false;
51
+ this._focusWithin = false;
52
+ /* Off while the slides change on their own, so a screen reader is not
53
+ read a new award every few seconds; polite once they are still, so a
54
+ change the visitor asks for is announced. The dots say which. */
55
+ this._live = "polite";
56
+ }
57
+
58
+ updated(changed) {
59
+ // a shorter list must not leave the carousel on a slide that is gone
60
+ if (changed.has("awards") && this._slide >= this.awards.length) this._slide = 0;
61
+ }
62
+
63
+ _renderSlide(award, i) {
64
+ const current = i === this._slide;
65
+ return html`
66
+ <div
67
+ class="slide"
68
+ role="group"
69
+ aria-roledescription="slide"
70
+ aria-label="${i + 1} of ${this.awards.length}"
71
+ ?inert=${!current}
72
+ >
73
+ ${award.logo
74
+ ? html`<div class="logo">
75
+ <bd-img
76
+ src="${award.logo}"
77
+ alt="${award.logoAlt || ""}"
78
+ width="${award.logoWidth ?? nothing}"
79
+ height="${award.logoHeight ?? nothing}"
80
+ fit="contain"
81
+ ></bd-img>
82
+ </div>`
83
+ : nothing}
84
+ <div class="copy">
85
+ <bd-h as="${this.as}" visual-level="h3" color="primary" class="title">${award.title}</bd-h>
86
+ ${award.body ? html`<p class="body">${award.body}</p>` : nothing}
87
+ </div>
88
+ </div>
89
+ `;
90
+ }
91
+
92
+ render() {
93
+ const count = this.awards.length;
94
+ if (!count) return nothing;
95
+ return html`
96
+ <section class="bd-ensemble root" aria-label="${this.label}" aria-roledescription="carousel">
97
+ <div class="card">
98
+ <div
99
+ class="viewport"
100
+ @mouseenter=${() => { this._hovered = true; }}
101
+ @mouseleave=${() => { this._hovered = false; }}
102
+ @focusin=${() => { this._focusWithin = true; }}
103
+ @focusout=${e => { this._focusWithin = e.currentTarget.contains(e.relatedTarget); }}
104
+ >
105
+ <div
106
+ class="track"
107
+ style="transform: translateX(${-100 * this._slide}%);"
108
+ aria-live=${this._live}
109
+ >
110
+ ${this.awards.map((a, i) => this._renderSlide(a, i))}
111
+ </div>
112
+ </div>
113
+ <bd-pagination-dots
114
+ count=${count}
115
+ current=${this._slide + 1}
116
+ label="${this.label}"
117
+ item-label="Go to award"
118
+ ?autoplay=${this.autoplay && count > 1}
119
+ delay=${this.autoplayDelay}
120
+ ?held=${this._hovered || this._focusWithin}
121
+ @bd-change=${e => { this._slide = e.detail.current - 1; }}
122
+ @bd-toggle=${e => { this._live = e.detail.moving ? "off" : "polite"; }}
123
+ ></bd-pagination-dots>
124
+ </div>
125
+ </section>
126
+ `;
127
+ }
128
+ }
129
+
130
+ customElements.define("bd-awards-spotlight", AwardsSpotlight);