@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
@@ -1,4 +1,4 @@
1
- import { LitElement, html } from 'lit';
1
+ import { LitElement, html, nothing } from 'lit';
2
2
  // Installs the design tokens into document scope; see src/tokens/tokens.js
3
3
  import "../../tokens/tokens.js";
4
4
  import { DEFAULT_THEME } from '../../tokens/themes/index.js';
@@ -6,7 +6,7 @@ import { DEFAULT_THEME } from '../../tokens/themes/index.js';
6
6
  JS cannot drift apart again: bd-footer switched at 767 while bd-footer-lp,
7
7
  sharing footer-nav-menu.css.js, switched at 768 — so at exactly 768px the
8
8
  LP footer rendered its mobile markup under the desktop stylesheet. */
9
- import { matchesBelow } from '../shared/token-scales.js';
9
+ import { below, matchesBelow } from '../shared/token-scales.js';
10
10
  import '../../components/divider/divider-horizontal.js';
11
11
  import '../../components/divider/divider-vertical.js';
12
12
  import '../../components/footer/footer-links-group.js';
@@ -20,14 +20,21 @@ import "../icons/globe-icon.js";
20
20
  import footerCSS from './footer.css.js';
21
21
  import { ensembleCSS } from '../shared/ensemble.css.js';
22
22
  import { localeMap } from './localeMap.js';
23
-
24
- /* The locale a footer shows when neither the page nor the URL says otherwise. */
25
- const DEFAULT_LOCALE = 'en';
23
+ import { DEFAULT_LOCALE, localeFromPath, toggleImpressum } from './footer-locale.js';
24
+ import { footerAnpc, footerLogo, footerMasterbrand } from './footer-images.js';
25
+
26
+ /* The labels in localeMap not written in their locale's language. A label is
27
+ "<place> - <language>", and these two were read in a Chinese voice: Hong
28
+ Kong's is English throughout, and Taiwan's place name is English beside
29
+ 台灣. */
30
+ const LABEL_LANG = {
31
+ 'zh-HK': { place: 'en', language: 'en' },
32
+ 'zh-TW': { place: 'en' }
33
+ };
26
34
 
27
35
  export class BdFooter extends LitElement {
28
36
  static properties = {
29
- _countriesOpen : { state: true },
30
- selectedCountry : { state: true },
37
+ selectedCountry : { state: true },
31
38
  /* `current-locale` and `max-columns-per-row`, both documented dash-cased
32
39
  and both previously inert for the same reason as bd-header above: Lit
33
40
  lowercases a property name to get its observed attribute, so these were
@@ -48,20 +55,17 @@ export class BdFooter extends LitElement {
48
55
 
49
56
  Zero consumers of either working lowercase spelling across src, schemas
50
57
  and docs, and no property bindings, so naming the attributes is safe. */
51
- currentLocale : { type: String, attribute: "current-locale" },
52
- maxColumnsPerRow : { type: Number, attribute: "max-columns-per-row" },
53
- _isMobile : { state: true },
54
- _countriesContainer: { state: true }
58
+ currentLocale : { type: String, attribute: "current-locale" },
59
+ maxColumnsPerRow: { type: Number, attribute: "max-columns-per-row" },
60
+ _isMobile : { state: true }
55
61
  };
56
62
 
57
63
  constructor() {
58
64
  super();
59
- this._countriesOpen = false;
60
65
  this.maxColumnsPerRow = 2;
61
66
  this.currentLocale = DEFAULT_LOCALE;
62
67
  this.selectedCountry = 'Choose your country';
63
68
  this._isMobile = matchesBelow('md');
64
- this._countriesContainer = null;
65
69
  }
66
70
 
67
71
  connectedCallback() {
@@ -81,12 +85,22 @@ export class BdFooter extends LitElement {
81
85
  this._localeExplicit =
82
86
  this.hasAttribute('current-locale') || this.currentLocale !== DEFAULT_LOCALE;
83
87
  this._initLocaleFromUrl();
84
- window.addEventListener('resize', this._handleResize.bind(this));
88
+ this._watchViewport();
85
89
  }
86
90
 
87
91
  disconnectedCallback() {
88
92
  super.disconnectedCallback();
89
- window.removeEventListener('resize', this._handleResize.bind(this));
93
+ this._viewport?.removeEventListener('change', this._onViewport);
94
+ }
95
+
96
+ /* The viewport, as one media query's change event. It was a window resize
97
+ listener, removed with a fresh .bind(this) that matched nothing, so every
98
+ footer ever disconnected kept its listener and kept running. */
99
+ _watchViewport() {
100
+ this._onViewport ??= e => { this._isMobile = e.matches; };
101
+ this._viewport ??= window.matchMedia(below('md'));
102
+ this._viewport.addEventListener('change', this._onViewport);
103
+ this._isMobile = this._viewport.matches;
90
104
  }
91
105
 
92
106
  firstUpdated() {
@@ -97,11 +111,6 @@ export class BdFooter extends LitElement {
97
111
  if (changedProps.has('currentLocale')) {
98
112
  this._toggleImpressumVisibility();
99
113
  }
100
-
101
- if (changedProps.has('_countriesOpen') && this._countriesOpen) {
102
- this._countriesContainer = this.shadowRoot.querySelector('.footer-countries-container');
103
- this._scrollToCountries();
104
- }
105
114
  }
106
115
 
107
116
  /* maxColumnsPerRow, finally read. The property has been declared here with
@@ -129,51 +138,21 @@ export class BdFooter extends LitElement {
129
138
  }
130
139
 
131
140
  _toggleImpressumVisibility() {
132
- const showImpressum = this.locale === 'de-de' || this.locale === 'de';
133
- const slot = this.shadowRoot.querySelector('slot[name="secondary-nav"]');
134
- const assignedElements = slot?.assignedElements({ flatten: true }) || [];
135
-
136
- if (assignedElements.length > 0) {
137
- const footerNav = assignedElements[0];
138
- const impressumLink = footerNav.querySelector('.impressum-link');
139
- const impressumDivider = footerNav.querySelector('bd-divider-vertical + .impressum-link')?.previousElementSibling;
140
-
141
- if (impressumLink) {
142
- impressumLink.style.display = showImpressum ? '' : 'none';
143
-
144
- if (impressumDivider && impressumDivider.tagName === 'BD-DIVIDER-VERTICAL') {
145
- impressumDivider.style.display = showImpressum ? '' : 'none';
146
- }
147
- }
148
- }
141
+ toggleImpressum(this.shadowRoot.querySelector('slot[name="secondary-nav"]'), this.locale);
149
142
  }
150
143
 
144
+ /* Smooth only for a reader who has not asked for reduced motion. */
151
145
  _scrollToCountries() {
152
- const container = this.shadowRoot.querySelector('.footer-countries-container');
153
- if (container) {
154
- setTimeout(() => {
155
- container.scrollIntoView({
156
- behavior: 'smooth',
157
- block : 'start'
158
- });
159
- }, 100);
160
- }
146
+ this.shadowRoot.querySelector('.footer-countries-container')
147
+ ?.scrollIntoView({ behavior: this._scrollBehavior, block: 'start' });
161
148
  }
162
149
 
163
150
  _scrollToTop() {
164
- this.scrollIntoView({
165
- behavior: 'smooth',
166
- block : 'start'
167
- });
151
+ this.scrollIntoView({ behavior: this._scrollBehavior, block: 'start' });
168
152
  }
169
153
 
170
- _handleResize() {
171
- this._isMobile = matchesBelow('md');
172
- const newIsMobile = matchesBelow('md');
173
-
174
- if (this._isMobile !== newIsMobile) {
175
- this._isMobile = newIsMobile;
176
- }
154
+ get _scrollBehavior() {
155
+ return window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth';
177
156
  }
178
157
 
179
158
  /* Locale precedence, and it is a precedence rather than a sequence of
@@ -198,89 +177,40 @@ export class BdFooter extends LitElement {
198
177
  The second is why Storybook showed "iframe.html" as a locale, and the fix
199
178
  is not a Storybook exception -- there is none here. A segment that does
200
179
  not resolve against localeMap is simply not a locale, on any host. The
201
- resolution itself (exact key, then language with a matching region, then
202
- any key sharing the language) is unchanged; only its authority is. */
180
+ resolution itself is localeFromPath (footer-locale.js), which bd-footer-lp
181
+ shares; only its authority is decided here. */
203
182
  _initLocaleFromUrl() {
204
183
  if (this._localeExplicit) return;
205
184
 
206
- const urlLocale = window.location.pathname.split('/')[1]?.toLowerCase();
207
- if (!urlLocale) return;
208
-
209
- const normalized = {};
210
- Object.entries(localeMap).forEach(([key, value]) => {
211
- normalized[key.toLowerCase()] = value;
212
- });
213
- const originalKeyFor = lower =>
214
- Object.keys(localeMap).find(k => k.toLowerCase() === lower);
215
-
216
- let resolvedKey = null;
217
- let country = null;
218
-
219
- if (normalized[urlLocale]) {
220
- resolvedKey = originalKeyFor(urlLocale) || urlLocale;
221
- country = normalized[urlLocale];
222
- } else {
223
- const [language, region] = urlLocale.split('-');
224
- const sameLanguage = Object.entries(normalized)
225
- .filter(([key]) => key.startsWith(language));
226
-
227
- if (sameLanguage.length) {
228
- const exactRegion = sameLanguage.find(([key]) => {
229
- const keyRegion = key.split('-')[1];
230
- return (region && keyRegion === region) || (!region && !keyRegion);
231
- });
232
- const [matchKey, matchCountry] = exactRegion || sameLanguage[0];
233
- resolvedKey = originalKeyFor(matchKey) || matchKey;
234
- country = matchCountry;
235
- }
236
- }
185
+ const resolved = localeFromPath(window.location.pathname);
237
186
 
238
187
  /* Nothing resolved: the segment is not a locale, so neither the locale nor
239
188
  the country is touched. This is the line that used to assign the raw
240
189
  path segment. */
241
- if (!resolvedKey) return;
242
-
243
- this.currentLocale = resolvedKey;
244
- this.selectedCountry = country;
245
- }
246
-
247
- _toggleCountries() {
248
- this._countriesOpen = !this._countriesOpen;
249
-
250
- if (!this._countriesOpen) {
251
- this._scrollToTop();
252
- }
253
- }
190
+ if (!resolved) return;
254
191
 
255
- _closeCountries() {
256
- this._countriesOpen = false;
257
-
258
- if (!this._isMobile) {
259
- this._scrollToTop();
260
- }
192
+ [this.currentLocale, this.selectedCountry] = resolved;
261
193
  }
262
194
 
263
- _handleCountryClick(e, countryLabel, locale) {
264
- e.preventDefault();
265
- this._selectCountry(countryLabel);
266
-
267
- const newPath = `/${locale.toLowerCase()}/`;
268
- window.location.href = newPath;
195
+ /* The country list is a <details>, so the browser keeps its state, its
196
+ expanded/collapsed announcement and its keyboard, and finds a country in
197
+ it with Ctrl+F while it is shut. What is left here is where the page
198
+ scrolls: to the list when it opens, back to the footer when it shuts --
199
+ except from the list's own close button on a phone, where the reader is
200
+ already where they want to be. */
201
+ _onCountriesToggle(e) {
202
+ if (e.target.open) this._scrollToCountries();
203
+ else if (!this._closingInPlace) this._scrollToTop();
204
+ this._closingInPlace = false;
269
205
  }
270
206
 
271
- _selectCountry(countryLabel) {
272
- this.selectedCountry = countryLabel;
273
- this._countriesOpen = false;
274
-
275
- const localeEntry = Object.entries(localeMap).find(
276
- ([, country]) => country === countryLabel
277
- );
278
-
279
- if (localeEntry) {
280
- this.currentLocale = localeEntry[0];
281
- }
282
-
283
- this._scrollToTop();
207
+ /* Focus goes back to the summary, which is what opened the list: the
208
+ button that had it is inside the list, and closing it hides it. */
209
+ _closeCountries(e) {
210
+ const details = e.currentTarget.closest('details');
211
+ this._closingInPlace = this._isMobile;
212
+ details.open = false;
213
+ details.querySelector('summary').focus({ preventScroll: true });
284
214
  }
285
215
 
286
216
  getCountriesList() {
@@ -290,25 +220,32 @@ export class BdFooter extends LitElement {
290
220
  }));
291
221
  }
292
222
 
293
- get locale() {
294
- const val = (this.currentLocale || 'en').toLowerCase();
295
- return val;
223
+ /* The languages a country's label is written in: its place, and the
224
+ language after the dash. lang is how the label is read aloud, and
225
+ hreflang, not lang, says what the link leads to, so a label written in
226
+ another language than its locale's says so (LABEL_LANG). */
227
+ _labelLang({ locale }) {
228
+ return { place: locale, language: locale, ...LABEL_LANG[locale] };
296
229
  }
297
230
 
298
- _updateSlotStyles() {
299
- const isMobile = matchesBelow('md');
300
- const slot = this.shadowRoot.querySelector('slot[name="nav"]');
301
- const assignedElements = slot.assignedElements();
231
+ /* The place in a lang of its own only when it differs from the rest. No
232
+ whitespace is added: the label reads as localeMap spells it. */
233
+ _renderCountryLabel(c) {
234
+ const { place, language } = this._labelLang(c);
235
+ const [name, tongue] = c.label.split(' - ');
236
+ if (place === language || tongue === undefined) return c.label;
237
+ return html`<span lang="${place}">${name}</span> - ${tongue}`;
238
+ }
302
239
 
303
- assignedElements.forEach(element => {
304
- if (isMobile) {
305
- element.style.color = 'var(--color-neutral-900)';
306
- element.style.setProperty('color', 'var(--color-neutral-900)', 'important');
307
- } else {
308
- element.style.color = '';
309
- element.style.removeProperty('color');
310
- }
311
- });
240
+ /* The country the page is in: the one picked from the URL, or the one an
241
+ explicit current-locale names exactly. */
242
+ _isCurrentCountry({ locale, label }) {
243
+ return this.selectedCountry === label || locale.toLowerCase() === this.locale;
244
+ }
245
+
246
+ get locale() {
247
+ const val = (this.currentLocale || 'en').toLowerCase();
248
+ return val;
312
249
  }
313
250
 
314
251
  /* No _updateNavLinks. It queried '.footer-nav-main bd-link' inside this
@@ -330,15 +267,6 @@ export class BdFooter extends LitElement {
330
267
  const showAnpc = this.locale.startsWith('ro');
331
268
  const countriesList = this.getCountriesList();
332
269
 
333
- const masterbrandUrl = this._isMobile
334
- ? '/assets/Bitdefender-Masterbrand_mobile.png'
335
- : '/assets/Bitdefender-Masterbrand.png';
336
-
337
- const anpcUrl = this._isMobile
338
- ? '/assets/anpc_mobile.png'
339
- : '/assets/anpc.png';
340
-
341
- const logoUrl = '/assets/BD_logo.png';
342
270
  const chunkSize = Math.ceil(countriesList.length / 3);
343
271
  const countryChunks = [
344
272
  countriesList.slice(0, chunkSize),
@@ -365,15 +293,13 @@ export class BdFooter extends LitElement {
365
293
  <div class="footer-top">
366
294
  <div class="footer-logo">
367
295
  <slot name="logo">
368
- <span><img src="${logoUrl}" alt="Bitdefender Logo"></span>
296
+ <span>${footerLogo}</span>
369
297
  </slot>
370
298
  </div>
371
299
  <div class="footer-top-right">
372
300
  <slot name="top-right">
373
301
  <div slot="top-right">
374
- <span slot="logo">
375
- <img src="${masterbrandUrl}" alt="Bitdefender Masterbrand">
376
- </span>
302
+ <span slot="logo">${footerMasterbrand}</span>
377
303
  </div>
378
304
  </slot>
379
305
  </div>
@@ -452,27 +378,27 @@ export class BdFooter extends LitElement {
452
378
  ${showAnpc
453
379
  ? html`
454
380
  <div class="footer-anpc">
455
- <slot name="anpc">
456
- <img src="${anpcUrl}" alt="Certificat" />
457
- </slot>
381
+ <slot name="anpc">${footerAnpc}</slot>
458
382
  </div>
459
383
  `
460
384
  : null}
461
385
 
462
- <div class="footer-countries-toggle">
463
- <button class="country-toggle" @click="${this._toggleCountries}">
464
- <bd-globe-icon size="20" color="white"></bd-globe-icon>
465
- ${this.selectedCountry}
466
- ${this._countriesOpen
467
- ? html`<bd-arrow-up-icon size="20" color="white"></bd-arrow-up-icon>`
468
- : html`<bd-arrow-down-icon size="20" color="white"></bd-arrow-down-icon>`
469
- }
470
- </button>
471
- </div>
472
- </div>
473
-
474
- ${this._countriesOpen
475
- ? html`
386
+ <!-- The list is the summary's own content, so it opens under the
387
+ toggle in the same row; the stylesheet runs it the row's full width.
388
+ Its links are plain anchors: a reader who picks a country follows a
389
+ link: hreflang says which language it leads to, lang which one its
390
+ label is in. -->
391
+ <!-- No icon here has a colour of its own: each takes its summary's or
392
+ button's, so forced colours repaint it (footer.css.js). -->
393
+ <details class="footer-countries-toggle" @toggle="${this._onCountriesToggle}">
394
+ <summary class="country-toggle">
395
+ <span class="country-toggle-row">
396
+ <bd-globe-icon size="20"></bd-globe-icon>
397
+ <span class="country-toggle-label">${this.selectedCountry}</span>
398
+ <bd-arrow-down-icon class="when-closed" size="20"></bd-arrow-down-icon>
399
+ <bd-arrow-up-icon class="when-open" size="20"></bd-arrow-up-icon>
400
+ </span>
401
+ </summary>
476
402
  <div class="footer-countries-container">
477
403
  <!-- The icon is the only content and bd-close-icon's svg is aria-hidden,
478
404
  so without a label this button had no accessible name at all: a
@@ -484,25 +410,21 @@ export class BdFooter extends LitElement {
484
410
  aria-label="Close country list"
485
411
  @click="${this._closeCountries}"
486
412
  >
487
- <bd-close-icon size="18" color="white"></bd-close-icon>
413
+ <bd-close-icon size="18"></bd-close-icon>
488
414
  </button>
489
415
  ${countryChunks.map(chunk => html`
490
- <bd-footer-links-group slot="countries" title="${chunk === countryChunks[0] ? 'Choose your country' : ''}">
491
- ${chunk.map(c => html`
492
- <bd-link
416
+ <bd-footer-links-group title="${chunk === countryChunks[0] ? 'Choose your country' : ''}">
417
+ ${chunk.map(c => html`<a
493
418
  href="/${c.locale.toLowerCase()}/"
494
- data-locale="${c.locale}"
495
- variant="light"
496
- class="${this.selectedCountry === c.label ? 'selected' : ''}"
497
- @click="${(e) => this._handleCountryClick(e, c.label, c.locale)}">
498
- ${c.label}
499
- </bd-link>
500
- `)}
419
+ hreflang="${c.locale}"
420
+ lang="${this._labelLang(c).language}"
421
+ aria-current="${this._isCurrentCountry(c) ? 'true' : nothing}"
422
+ >${this._renderCountryLabel(c)}</a>`)}
501
423
  </bd-footer-links-group>
502
424
  `)}
503
425
  </div>
504
- `
505
- : null}
426
+ </details>
427
+ </div>
506
428
  </footer>
507
429
  `;
508
430
  }
@@ -38,14 +38,24 @@ export default {
38
38
  ### Responsive Behavior
39
39
  | Width | Behavior |
40
40
  |---|---|
41
- | \`≤ 767px\` | Mobile layout, extra dividers, mobile masterbrand image |
41
+ | \`≤ 767px\` | Mobile layout, extra dividers, mobile masterbrand and ANPC images |
42
42
  | \`> 767px\` | Desktop layout |
43
43
 
44
+ The phone images are \`<picture><source media>\`, so the browser fetches one
45
+ file per image; every default image is lazy and sized.
46
+
44
47
  ### Country Selector
45
- - Clicking the country toggle opens a 3-column country grid
46
- - Selecting a country navigates to \`/{locale}/\`
48
+ - A native \`<details>\`: the toggle is its \`<summary>\`, announced as expanded
49
+ or collapsed, and the list opens under it in a 3-column grid
50
+ - Each country is a plain link to \`/{locale}/\` with \`hreflang\` and \`lang\`;
51
+ the current one carries \`aria-current\`
47
52
  - Locale is auto-detected from \`window.location.pathname\`
48
53
 
54
+ ### Navigation names
55
+ Each \`bd-footer-nav\` is a \`<nav>\` named by its \`label\` ("Footer" by
56
+ default). With two in one footer, give each its own: \`label="Solutions"\`,
57
+ \`label="Company and legal"\`.
58
+
49
59
  ### Locale-specific Features
50
60
  - \`de\` / \`de-de\`: Shows Impressum link in secondary nav
51
61
  - \`ro*\`: Shows ANPC compliance image
@@ -124,7 +134,7 @@ export const WithCustomLogo = {
124
134
  render: () => html`
125
135
  <bd-footer current-locale="en">
126
136
  <span slot="logo">
127
- <img src="/assets/custom-logo.png" alt="Custom Logo" style="height:32px;">
137
+ <img src="/assets/BD_logo.png" alt="Custom Logo" style="height:32px;">
128
138
  </span>
129
139
  ${quickLinks}
130
140
  </bd-footer>
@@ -1,43 +1,79 @@
1
- import { css } from "lit";
1
+ import { css, unsafeCSS } from "lit";
2
+ import { above } from "../shared/token-scales.js";
2
3
 
4
+ /* The column steps follow the screen: cols, then cols-sm, cols-md and
5
+ cols-lg from 576, 768 and 992 -- the sm, md and lg every other breakpoint
6
+ in this package means. A grid's steps are a page's structure, and that is
7
+ a question about the screen; it can answer differently at the same width
8
+ in two places -- a 492 grid across a 600 screen and a 518 one beside the
9
+ stat highlight at 1280 hold different layouts on the homepage.
10
+
11
+ 2.6.0 stepped by the grid's own width instead, at the page column's widths
12
+ (492, 656, 880). A grid as wide as the page stepped where it always had; a
13
+ narrower one never reached its upper steps, so the homepage's stat tiles,
14
+ two across beside the highlight since they were drawn, stacked one a row
15
+ on every desktop, and bd-footer opted its grid out to keep its layout.
16
+ Nothing that was measured gained from it, so the steps read the screen
17
+ again.
18
+
19
+ What reading its own width was for -- a 3-column step taken at a 992
20
+ screen gave a 360 column 104px cells -- is min-col-width's: each step's
21
+ count becomes the most columns there will be, and a column is never
22
+ narrower than min-col-width, so a grid in a narrow column takes fewer,
23
+ wider ones, wherever it is laid out. It asks the cells, which is the
24
+ question a collection has, where the page's widths could only be answered
25
+ by a grid as wide as the page. */
3
26
  export default css`
4
- :host {
27
+ :host {
5
28
  display: block;
6
29
  }
7
30
 
31
+ /* Each step below says only which columns and which gap apply; they are
32
+ laid out here, once, so that min-col-width reads the same two. */
8
33
  .grid {
9
34
  display: grid;
10
- gap: var(--spacing-24);
11
35
  align-items: stretch;
12
36
  justify-items: start;
37
+ --grid-cols-active: var(--grid-cols);
38
+ --grid-gap-active: var(--grid-gap, var(--spacing-24));
39
+ grid-template-columns: repeat(var(--grid-cols-active), 1fr);
40
+ gap: var(--grid-gap-active);
13
41
  }
14
42
 
15
- /* Default */
16
- .grid {
17
- grid-template-columns: repeat(var(--grid-cols), 1fr);
18
- gap: var(--grid-gap, var(--spacing-24));
19
- }
20
-
21
- /* Responsive overrides: the columns and the gap step together; a gap
22
- left unset carries the one below it up */
23
- @media (min-width: 576px) {
43
+ /* The columns and the gap step together; a gap left unset carries the
44
+ one below it up. */
45
+ @media ${unsafeCSS(above('sm'))} {
24
46
  .grid {
25
- grid-template-columns: repeat(var(--grid-cols-sm), 1fr);
26
- gap: var(--grid-gap-sm, var(--spacing-24));
47
+ --grid-cols-active: var(--grid-cols-sm);
48
+ --grid-gap-active: var(--grid-gap-sm, var(--spacing-24));
27
49
  }
28
50
  }
29
51
 
30
- @media (min-width: 768px) {
52
+ @media ${unsafeCSS(above('md'))} {
31
53
  .grid {
32
- grid-template-columns: repeat(var(--grid-cols-md), 1fr);
33
- gap: var(--grid-gap-md, var(--spacing-24));
54
+ --grid-cols-active: var(--grid-cols-md);
55
+ --grid-gap-active: var(--grid-gap-md, var(--spacing-24));
34
56
  }
35
57
  }
36
58
 
37
- @media (min-width: 992px) {
59
+ @media ${unsafeCSS(above('lg'))} {
38
60
  .grid {
39
- grid-template-columns: repeat(var(--grid-cols-lg), 1fr);
40
- gap: var(--grid-gap-lg, var(--spacing-24));
61
+ --grid-cols-active: var(--grid-cols-lg);
62
+ --grid-gap-active: var(--grid-gap-lg, var(--spacing-24));
41
63
  }
42
64
  }
65
+
66
+ /* min-col-width: as many columns as fit at min-col-width, up to the
67
+ step's count. auto-fill takes as many as fit; the second term of max()
68
+ is what holds it to the count -- a column at least the grid less the
69
+ count's gaps, over the count, leaves no room for one more, with a gap
70
+ to spare so rounding cannot drop one either; and min(100%, ...) keeps
71
+ one column inside a grid narrower than the floor. The columns then
72
+ share what is left, as 1fr always has. */
73
+ .grid.grid--fit {
74
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, max(
75
+ var(--grid-min-col-width),
76
+ (100% - var(--grid-cols-active) * var(--grid-gap-active)) / var(--grid-cols-active)
77
+ )), 1fr));
78
+ }
43
79
  `;
@@ -46,18 +46,23 @@ class BdGrid extends LitElement {
46
46
  the ones that were already there, and this adds no smartness to a layout
47
47
  primitive -- it only lets the primitive hear what it is told. */
48
48
  static properties = {
49
- cols : { type: Number }, // default cols
50
- colsSm : { type: Number, attribute: "cols-sm" }, // optional cols on small screens
51
- colsMd : { type: Number, attribute: "cols-md" }, // optional cols on medium
52
- colsLg : { type: Number, attribute: "cols-lg" }, // optional cols on large
53
- gap : { type: String }, // e.g., 'sm', 'md'
54
- gapSm : { type: String, attribute: "gap-sm" }, // optional gap from sm; unset keeps the step below
55
- gapMd : { type: String, attribute: "gap-md" }, // optional gap from md
56
- gapLg : { type: String, attribute: "gap-lg" }, // optional gap from lg
57
- align : { type: String }, // start, center, end, stretch
58
- justify: { type: String }, // start, center, end, space-between
59
- padding: { type: String } // e.g., 'none', 'sm', 'md', 'lg'
60
-
49
+ cols : { type: Number }, // default cols
50
+ colsSm : { type: Number, attribute: "cols-sm" }, // optional cols on small screens
51
+ colsMd : { type: Number, attribute: "cols-md" }, // optional cols on medium
52
+ colsLg : { type: Number, attribute: "cols-lg" }, // optional cols on large
53
+ gap : { type: String }, // e.g., 'sm', 'md'
54
+ gapSm : { type: String, attribute: "gap-sm" }, // optional gap from sm; unset keeps the step below
55
+ gapMd : { type: String, attribute: "gap-md" }, // optional gap from md
56
+ gapLg : { type: String, attribute: "gap-lg" }, // optional gap from lg
57
+ align : { type: String }, // start, center, end, stretch
58
+ justify : { type: String }, // start, center, end, space-between
59
+ padding : { type: String }, // e.g., 'none', 'sm', 'md', 'lg'
60
+ /* The narrowest a column may be. Unset, each step's count is the
61
+ columns there are; set, it is the most there will be, and the grid
62
+ takes fewer, wider ones where that many would not fit (grid.css.js).
63
+ A number of px at the default text size, laid out in rem: a cell holds
64
+ text, so its floor grows with the reader's text, as the gaps do. */
65
+ minColWidth: { type: Number, attribute: "min-col-width" }
61
66
  };
62
67
 
63
68
  constructor() {
@@ -73,14 +78,14 @@ class BdGrid extends LitElement {
73
78
  this.align = "stretch";
74
79
  this.justify = "start";
75
80
  this.padding = "none";
76
-
81
+ this.minColWidth = 0;
77
82
  }
78
83
 
79
84
 
80
85
  render() {
81
86
  return html`
82
87
  <div
83
- class="grid"
88
+ class="grid ${this.minColWidth > 0 ? "grid--fit" : ""}"
84
89
  style="
85
90
  --grid-cols: ${this.cols};
86
91
  --grid-cols-sm: ${this.colsSm};
@@ -93,7 +98,7 @@ class BdGrid extends LitElement {
93
98
  align-items: ${this.align};
94
99
  justify-items: ${this.justify};
95
100
  padding: ${space(this.padding)};
96
-
101
+ ${this.minColWidth > 0 ? `--grid-min-col-width: ${this.minColWidth / 16}rem;` : ""}
97
102
  "
98
103
  >
99
104
  <slot></slot>