@repobit/dex-system-design 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +2 -1
  3. package/package.json +14 -27
  4. package/schemas/component-manifest.json +226 -33
  5. package/schemas/manifest-omissions.json +23 -0
  6. package/src/components/accordion/accordion-bg.css.js +39 -30
  7. package/src/components/accordion/accordion-bg.js +17 -28
  8. package/src/components/accordion/accordion-bg.stories.js +5 -0
  9. package/src/components/accordion/accordion-panel.js +24 -0
  10. package/src/components/accordion/accordion.css.js +105 -111
  11. package/src/components/accordion/accordion.js +23 -37
  12. package/src/components/accordion/accordion.stories.js +5 -1
  13. package/src/components/anchor/anchor-nav.css.js +131 -53
  14. package/src/components/anchor/anchor-nav.js +276 -201
  15. package/src/components/annotation/annotation.css.js +7 -4
  16. package/src/components/architecture.stories.js +8 -7
  17. package/src/components/audience-card/audience-card.css.js +30 -4
  18. package/src/components/audience-card/audience-card.js +8 -13
  19. package/src/components/awards/awards-flex.css.js +23 -6
  20. package/src/components/awards/awards-flex.js +21 -6
  21. package/src/components/awards/awards-spotlight.css.js +25 -5
  22. package/src/components/awards/awards-spotlight.js +19 -7
  23. package/src/components/awards/awards.css.js +20 -8
  24. package/src/components/awards/awards.js +30 -91
  25. package/src/components/awards/awards.stories.js +5 -5
  26. package/src/components/awards/scroll-slides.js +128 -0
  27. package/src/components/back/back.css.js +2 -0
  28. package/src/components/badge/badge.css.js +15 -0
  29. package/src/components/bento-grid/bento-grid.css.js +105 -11
  30. package/src/components/bento-grid/bento-grid.js +37 -124
  31. package/src/components/bento-grid/bento-grid.stories.js +3 -2
  32. package/src/components/bento-grid/bento-item.css.js +71 -32
  33. package/src/components/bento-grid/bento-item.js +3 -30
  34. package/src/components/blockquote/blockquote.css.js +2 -2
  35. package/src/components/breadcrumb/breadcrumb.css.js +10 -9
  36. package/src/components/breadcrumb/breadcrumb.js +35 -34
  37. package/src/components/button/button.css.js +42 -17
  38. package/src/components/button/button.js +84 -3
  39. package/src/components/button/button.stories.js +17 -0
  40. package/src/components/card-features/card-features.css.js +23 -2
  41. package/src/components/card-features/card-features.js +6 -48
  42. package/src/components/cards/card.css.js +43 -14
  43. package/src/components/cards/card.js +43 -177
  44. package/src/components/cards/card.stories.js +8 -10
  45. package/src/components/carousel/carousel.css.js +101 -70
  46. package/src/components/carousel/carousel.js +107 -71
  47. package/src/components/carousel/carousel.stories.js +18 -16
  48. package/src/components/checkbox/checkbox.css.js +26 -9
  49. package/src/components/checkbox/checkbox.js +73 -39
  50. package/src/components/checkbox/checkbox.stories.js +35 -18
  51. package/src/components/compare/compare.css.js +68 -10
  52. package/src/components/compare/compare.js +40 -103
  53. package/src/components/compare/compare.stories.js +1 -1
  54. package/src/components/compatibility-table/compatibility-table.css.js +70 -37
  55. package/src/components/compatibility-table/compatibility-table.js +47 -40
  56. package/src/components/compatibility-table/compatibility-table.stories.js +78 -1
  57. package/src/components/display/display.css.js +7 -0
  58. package/src/components/dropdown/dropdown.css.js +20 -3
  59. package/src/components/dropdown/dropdown.js +57 -21
  60. package/src/components/dropdown/dropdown.stories.js +31 -9
  61. package/src/components/features/features.css.js +56 -21
  62. package/src/components/features/features.js +7 -117
  63. package/src/components/fieldset/fieldset.stories.js +68 -0
  64. package/src/components/footer/footer-images.js +34 -0
  65. package/src/components/footer/footer-links-group.css.js +10 -10
  66. package/src/components/footer/footer-locale.js +47 -0
  67. package/src/components/footer/footer-lp.js +27 -114
  68. package/src/components/footer/footer-lp.stories.js +2 -2
  69. package/src/components/footer/footer-nav-menu.css.js +2 -2
  70. package/src/components/footer/footer-nav-menu.js +8 -3
  71. package/src/components/footer/footer.css.js +238 -197
  72. package/src/components/footer/footer.js +109 -187
  73. package/src/components/footer/footer.stories.js +14 -4
  74. package/src/components/grid/grid.css.js +64 -5
  75. package/src/components/header/header-code.css.js +20 -11
  76. package/src/components/header/header-code.js +1 -1
  77. package/src/components/header/header.css.js +20 -14
  78. package/src/components/header/header.js +6 -7
  79. package/src/components/header/header.stories.js +29 -24
  80. package/src/components/heading/heading.css.js +11 -0
  81. package/src/components/hero/hero.js +10 -2
  82. package/src/components/highlight/highlight.css.js +30 -6
  83. package/src/components/icons/arrow-icon.js +4 -1
  84. package/src/components/icons/arrow-right-icon.js +5 -1
  85. package/src/components/icons/icon-element.js +18 -0
  86. package/src/components/image/image.js +29 -9
  87. package/src/components/image/image.stories.js +38 -2
  88. package/src/components/input/custom-form.stories.js +38 -7
  89. package/src/components/input/input-clipboard.css.js +15 -1
  90. package/src/components/input/input-clipboard.js +84 -21
  91. package/src/components/input/input.js +27 -7
  92. package/src/components/install-options/install-options.css.js +26 -6
  93. package/src/components/install-options/install-options.js +32 -8
  94. package/src/components/label/label.css.js +1 -1
  95. package/src/components/light-carousel/light-carousel.css.js +100 -48
  96. package/src/components/light-carousel/light-carousel.js +43 -5
  97. package/src/components/link/link.css.js +15 -15
  98. package/src/components/link/link.js +17 -1
  99. package/src/components/link/link.stories.js +20 -7
  100. package/src/components/list/list.css.js +3 -3
  101. package/src/components/logo-marquee/logo-marquee.css.js +12 -1
  102. package/src/components/logo-marquee/logo-marquee.js +33 -8
  103. package/src/components/logo-marquee/logo-marquee.stories.js +10 -4
  104. package/src/components/modal/modal.css.js +74 -40
  105. package/src/components/modal/modal.js +85 -74
  106. package/src/components/modal/modal.stories.js +27 -14
  107. package/src/components/motion-art/motion-art.js +67 -1
  108. package/src/components/page-switcher/page-switcher.css.js +27 -9
  109. package/src/components/page-switcher/page-switcher.js +11 -8
  110. package/src/components/partner-banner/partner-banner.css.js +2 -0
  111. package/src/components/picture/picture.css.js +4 -4
  112. package/src/components/picture/picture.js +13 -3
  113. package/src/components/picture/picture.stories.js +28 -2
  114. package/src/components/post-card/post-card.css.js +18 -3
  115. package/src/components/pricing-cards/adopt-styles.js +16 -0
  116. package/src/components/pricing-cards/new-pricing-card.js +2 -4
  117. package/src/components/pricing-cards/new-pricing-card.stories.js +20 -22
  118. package/src/components/pricing-cards/pricing-card-actions.css.js +8 -12
  119. package/src/components/pricing-cards/pricing-card-actions.js +26 -13
  120. package/src/components/pricing-cards/pricing-card-container.css.js +4 -3
  121. package/src/components/pricing-cards/pricing-card-container.js +10 -4
  122. package/src/components/pricing-cards/pricing-card-header.css.js +5 -4
  123. package/src/components/pricing-cards/pricing-card-header.js +18 -31
  124. package/src/components/pricing-cards/pricing-card-pricing.css.js +84 -61
  125. package/src/components/pricing-cards/pricing-card-pricing.js +38 -24
  126. package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
  127. package/src/components/pricing-cards/pricing-card.css.js +75 -41
  128. package/src/components/pricing-cards/pricing-card.js +356 -308
  129. package/src/components/progress/progress.css.js +58 -13
  130. package/src/components/progress/progress.js +13 -10
  131. package/src/components/progress/progress.stories.js +9 -7
  132. package/src/components/radio/radio-group.css.js +42 -0
  133. package/src/components/radio/radio-group.js +89 -0
  134. package/src/components/radio/radio.css.js +63 -6
  135. package/src/components/radio/radio.js +173 -140
  136. package/src/components/radio/radio.stories.js +99 -44
  137. package/src/components/radio/toggle-radio.js +44 -0
  138. package/src/components/review/review-grid.css.js +5 -1
  139. package/src/components/review/review-grid.js +2 -0
  140. package/src/components/review/review.js +13 -0
  141. package/src/components/shared/announcer.js +37 -0
  142. package/src/components/shared/fill-width.css.js +33 -0
  143. package/src/components/shared/form-control.js +194 -0
  144. package/src/components/shared/form-field.css.js +31 -3
  145. package/src/components/shared/token-scales.js +75 -26
  146. package/src/components/spotlight-section/spotlight-section.js +2 -2
  147. package/src/components/stat/stat-highlight.js +1 -1
  148. package/src/components/stat/stat.css.js +18 -3
  149. package/src/components/switch/switch.css.js +58 -5
  150. package/src/components/switch/switch.js +53 -5
  151. package/src/components/switch/switch.stories.js +30 -8
  152. package/src/components/tab-list/tab-list.css.js +51 -13
  153. package/src/components/tab-list/tab-list.js +7 -2
  154. package/src/components/tab-list/tab-list.stories.js +2 -2
  155. package/src/components/tabs/tabs.css.js +18 -1
  156. package/src/components/tabs/tabs.js +119 -41
  157. package/src/components/terminal/terminal-message.css.js +6 -1
  158. package/src/components/termsOfUse/terms.css.js +4 -2
  159. package/src/components/textarea/textarea.js +22 -7
  160. package/src/components/textarea/textarea.stories.js +12 -9
  161. package/src/components/trust-panel/trust-panel.css.js +13 -3
  162. package/src/components/ultimate-security-demo.stories.js +5 -5
  163. package/src/components/video/video.css.js +5 -0
  164. package/src/components/video/video.js +5 -0
  165. package/src/components/video/video.stories.js +12 -0
  166. package/src/components/video-player/video-player.css.js +20 -8
  167. package/src/components/video-player/video-player.js +74 -20
  168. package/src/components/video-player/video-player.stories.js +17 -3
  169. package/src/tokens/brands.stories.js +1 -1
  170. package/src/tokens/themes/index.js +2 -2
  171. package/src/tokens/typography.stories.js +4 -3
  172. package/src/vendor/motion-art/README.md +4 -1
  173. package/src/components/footer/footer-lp.css.js +0 -159
@@ -3,6 +3,10 @@ import './fieldset.js';
3
3
  import '../switch/switch.js';
4
4
  import '../radio/radio.js';
5
5
  import '../input/input.js';
6
+ import '../checkbox/checkbox.js';
7
+ import '../dropdown/dropdown.js';
8
+ import '../radio/radio-group.js';
9
+ import '../textarea/textarea.js';
6
10
 
7
11
  export default {
8
12
  title : 'Atoms/Fieldset',
@@ -37,6 +41,17 @@ Because slotted controls sit inside the \`<fieldset>\` in the flattened tree, th
37
41
  native grouping does apply here — unlike a \`for\` reference, which cannot cross
38
42
  the shadow boundary.
39
43
 
44
+ ### In a form
45
+ Every form control in the package — \`bd-custom-input\`, \`bd-textarea\`,
46
+ \`bd-custom-dropdown\`, \`bd-checkbox\`, \`bd-radio\` (with
47
+ \`bd-radio-group\`) and \`bd-switch\` — is form-associated, so a plain
48
+ \`<form>\` submits, resets and validates them as it would native controls.
49
+ **In a form** below is one of each.
50
+
51
+ \`bd-fieldset\` itself is not a form control and has no \`disabled\`: its
52
+ \`<fieldset>\` is in a shadow root, and a fieldset disables only what is in its
53
+ own tree. To disable a group, wrap it in a native \`<fieldset disabled>\`.
54
+
40
55
  ### Labelling the fields inside it
41
56
  Give each field its own label and hint through its own props —
42
57
  \`label\`, \`required\` and \`tooltip\` on \`bd-custom-input\` — not a
@@ -107,3 +122,56 @@ export const FieldStack = () => html`
107
122
  ></bd-custom-input>
108
123
  </bd-fieldset>
109
124
  `;
125
+
126
+ /* What a submit sends, as `name = value` lines; written into the story's own
127
+ <output> rather than logged, so the page shows it. */
128
+ const showSubmit = e => {
129
+ e.preventDefault();
130
+ const lines = [...new FormData(e.target)].map(([name, value]) => `${name} = ${value}`);
131
+ e.target.querySelector('output').value = lines.length ? lines.join('\n') : '(nothing)';
132
+ };
133
+ const clearSubmit = e => {
134
+ e.target.querySelector('output').value = 'Submit to see what the form sends.';
135
+ };
136
+
137
+ /**
138
+ * One of each form control in a real <form>, with a native submit and reset.
139
+ * Submit with nothing filled in: the browser stops on the first required
140
+ * field, focuses it and says why, and each field the submit found wanting
141
+ * turns red. Fill them in and submit again to see what the form sends;
142
+ * reset puts every control back to the state it was written with.
143
+ *
144
+ * The buttons are native because bd-button is not form-associated yet -- its
145
+ * <button> is in a shadow root, so it can neither submit nor reset a form.
146
+ */
147
+ export const InAForm = {
148
+ name : 'In a form',
149
+ render: () => html`
150
+ <form
151
+ style="display: flex; flex-direction: column; gap: var(--form-fieldSpacing); max-width: 32rem"
152
+ @submit=${showSubmit}
153
+ @reset=${clearSubmit}
154
+ >
155
+ <bd-fieldset legend="You">
156
+ <bd-custom-input name="email" type="email" label="Email" autocomplete="email" required
157
+ tooltip="Where we send the licence."></bd-custom-input>
158
+ <bd-custom-dropdown name="country" label="Country" placeholder="Choose a country" required
159
+ options='["Romania", "Germany", "France"]'></bd-custom-dropdown>
160
+ <bd-textarea name="note" label="Anything we should know?" rows="2"></bd-textarea>
161
+ </bd-fieldset>
162
+ <bd-fieldset legend="Your plan">
163
+ <bd-radio-group label="Billing" name="billing" required>
164
+ <bd-radio value="monthly" label="Monthly"></bd-radio>
165
+ <bd-radio value="yearly" label="Yearly"></bd-radio>
166
+ </bd-radio-group>
167
+ <bd-switch name="renew" label="Renew automatically" checked></bd-switch>
168
+ <bd-checkbox name="terms" value="accepted" required>I accept the terms of use</bd-checkbox>
169
+ </bd-fieldset>
170
+ <div style="display: flex; gap: var(--spacing-8)">
171
+ <button type="submit">Submit</button>
172
+ <button type="reset">Reset</button>
173
+ </div>
174
+ <output style="white-space: pre-line; font-family: var(--typography-fontFamily-mono); font-size: var(--typography-fontSize-sm); line-height: var(--typography-lineHeight-normal)">Submit to see what the form sends.</output>
175
+ </form>
176
+ `
177
+ };
@@ -0,0 +1,34 @@
1
+ import { html } from 'lit';
2
+ import { below } from '../shared/token-scales.js';
3
+
4
+ /* The default images bd-footer and bd-footer-lp render when a page slots none.
5
+
6
+ The phone versions are art direction, so they are <source media> in a
7
+ <picture>: the browser picks one before it fetches anything. The footers
8
+ used to pick in script, from a matchMedia flag, which fetched the desktop
9
+ file first on every phone and swapped it on the first update.
10
+
11
+ Each candidate states its own size, so the box is reserved before the bytes
12
+ arrive, and all of them are lazy: a footer is the end of the page.
13
+
14
+ The wordmark is the brand's name. The masterbrand lockup beside it is the B
15
+ with "Trusted. Always.", so that is its text: naming the brand a second time
16
+ ("Bitdefender Logo", "Bitdefender Masterbrand") read it out twice. The ANPC
17
+ badge is the Romanian consumer authority's alternative dispute resolution
18
+ mark, named as it reads, in Romanian. */
19
+ const mobile = below('md');
20
+
21
+ export const footerLogo = html`<img src="/assets/BD_logo.png" alt="Bitdefender" width="174" height="24" loading="lazy">`;
22
+
23
+ /* No whitespace between the tags: a <picture> is inline, and a space inside
24
+ it would be a space in the line beside the image. */
25
+ export const footerMasterbrand = html`<picture><source
26
+ media="${mobile}" srcset="/assets/Bitdefender-Masterbrand_mobile.png" width="48" height="48"><img
27
+ src="/assets/Bitdefender-Masterbrand.png" alt="Trusted. Always." width="138" height="48" loading="lazy"
28
+ ></picture>`;
29
+
30
+ export const footerAnpc = html`<picture><source
31
+ media="${mobile}" srcset="/assets/anpc_mobile.png" width="143" height="36"><img
32
+ src="/assets/anpc.png" alt="ANPC – Soluționarea alternativă a litigiilor" lang="ro" width="106" height="28"
33
+ loading="lazy"
34
+ ></picture>`;
@@ -6,14 +6,13 @@ export default css`
6
6
  display: flex;
7
7
  flex-direction: column;
8
8
  gap: var(--spacing-12);
9
- padding-right: var(--spacing-64);
9
+ /* the space between side-by-side groups, after the group in reading order */
10
+ padding-inline-end: var(--spacing-64);
10
11
  }
11
12
 
12
- /* No type here: this needs a directly-slotted raw anchor, and every consumer
13
- slots bd-link -- measured, 2 instances, assigned [bd-link], 0 raw anchors.
14
- The fourth rule in this component family to name the anchor tag where the
15
- markup is bd-link. The remaining two declarations are dead by the same
16
- proof and are left for a follow-up. */
13
+ /* A raw anchor slotted straight in: bd-footer's country links are those.
14
+ bd-footer draws them in full; this is their ink and no underline for any
15
+ other footer that slots plain links. */
17
16
  ::slotted(a) {
18
17
  color: var(--color-text-inverse);
19
18
  text-decoration: none;
@@ -25,10 +24,11 @@ export default css`
25
24
  font-weight: var(--typography-heading-h1-fontWeight);
26
25
  }
27
26
 
27
+ /* No !important: this sheet is the outer one for bd-h's host, so it
28
+ already beats bd-h's own :host { display: block }. */
28
29
  @media ${unsafeCSS(below('md'))} {
29
-
30
- :host(:nth-of-type(2)) .group-title {
31
- display: none !important;
32
- }
30
+ :host(:nth-of-type(2)) .group-title {
31
+ display: none;
32
+ }
33
33
  }
34
34
  `;
@@ -0,0 +1,47 @@
1
+ import { localeMap } from './localeMap.js';
2
+
3
+ /* The locale a footer shows when neither the page nor the URL says otherwise. */
4
+ export const DEFAULT_LOCALE = 'en';
5
+
6
+ /* The locale a path's first segment names, as [localeMap key, country], or
7
+ null when it names none.
8
+
9
+ bd-footer and bd-footer-lp each carried a copy of this. bd-footer's was
10
+ fixed and bd-footer-lp's was not, so the LP footer went on adopting any
11
+ first segment verbatim: under Storybook the path is /iframe.html, its
12
+ locale became "iframe.html", and its German Legal story hid Impressum. One
13
+ function for both, so the two cannot drift apart again.
14
+
15
+ The resolution: the exact key, then a key with the segment's language and
16
+ region (a bare language prefers a bare key, and localeMap has none today),
17
+ then the first key with that language. The language is compared whole, not
18
+ as a prefix, so "/e/" does not resolve to en-AU. A segment that resolves to
19
+ nothing is not a locale, on any host -- there is no Storybook exception. */
20
+ export const localeFromPath = pathname => {
21
+ const segment = pathname.split('/')[1]?.toLowerCase();
22
+ if (!segment) return null;
23
+
24
+ const entries = Object.entries(localeMap);
25
+ const exact = entries.find(([key]) => key.toLowerCase() === segment);
26
+ if (exact) return exact;
27
+
28
+ const [language, region] = segment.split('-');
29
+ const sameLanguage = entries.filter(([key]) => key.toLowerCase().split('-')[0] === language);
30
+ const sameRegion = sameLanguage.find(([key]) => key.toLowerCase().split('-')[1] === region);
31
+
32
+ return sameRegion || sameLanguage[0] || null;
33
+ };
34
+
35
+ /* German law's Impressum: the link in the slotted secondary nav, and the
36
+ divider right before it, show on a German page only. hidden rather than an
37
+ inline display: none, which outranked every stylesheet and was written onto
38
+ markup the footer does not own. Both footers carried a copy of this too,
39
+ each finding the divider its own way. */
40
+ export const toggleImpressum = (slot, locale) => {
41
+ const link = slot?.assignedElements({ flatten: true })[0]?.querySelector('.impressum-link');
42
+ if (!link) return;
43
+ const show = locale === 'de-de' || locale === 'de';
44
+ link.hidden = !show;
45
+ const divider = link.previousElementSibling;
46
+ if (divider?.localName === 'bd-divider-vertical') divider.hidden = !show;
47
+ };
@@ -2,11 +2,6 @@ import { LitElement, html } 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';
5
- /* The md boundary comes from the shared breakpoint source so the CSS and the
6
- JS cannot drift apart again: bd-footer switched at 767 while bd-footer-lp,
7
- sharing footer-nav-menu.css.js, switched at 768 — so at exactly 768px the
8
- LP footer rendered its mobile markup under the desktop stylesheet. */
9
- import { matchesBelow } from '../shared/token-scales.js';
10
5
  import '../../components/divider/divider-horizontal.js';
11
6
  import '../../components/divider/divider-vertical.js';
12
7
  import '../../components/footer/footer-links-group.js';
@@ -14,18 +9,20 @@ import '../../components/footer/footer-nav-menu.js';
14
9
  import '../../components/grid/grid.js';
15
10
  import footerCSS from './footer.css.js';
16
11
  import { ensembleCSS } from '../shared/ensemble.css.js';
17
- import { localeMap } from './localeMap.js';
12
+ import { DEFAULT_LOCALE, localeFromPath, toggleImpressum } from './footer-locale.js';
13
+ import { footerAnpc, footerLogo, footerMasterbrand } from './footer-images.js';
18
14
 
19
15
  export class BdFooterLP extends LitElement {
20
16
  static properties = {
21
- currentLocale: { type: String },
22
- _isMobile : { state: true }
17
+ /* current-locale, as on bd-footer. Lit lowercases a property name to get
18
+ its observed attribute, so this listened for `currentlocale` and a
19
+ dash-cased attribute never reached it. */
20
+ currentLocale: { type: String, attribute: 'current-locale' }
23
21
  };
24
22
 
25
23
  constructor() {
26
24
  super();
27
- this.currentLocale = 'en';
28
- this._isMobile = matchesBelow('md');
25
+ this.currentLocale = DEFAULT_LOCALE;
29
26
  }
30
27
 
31
28
  connectedCallback() {
@@ -37,14 +34,16 @@ export class BdFooterLP extends LitElement {
37
34
  attributes are normally the page's; this one is the exception, because
38
35
  the requirement is absolute, not a default the page may override. */
39
36
  this.setAttribute('data-brand', DEFAULT_THEME);
37
+ /* Whether the page asked for a locale, captured before inference runs, as
38
+ in bd-footer: an attribute in the markup or a property assigned before
39
+ the element connects. */
40
+ this._localeExplicit =
41
+ this.hasAttribute('current-locale') || this.currentLocale !== DEFAULT_LOCALE;
40
42
  this._initLocaleFromUrl();
41
- window.addEventListener('resize', this._handleResize.bind(this));
42
43
  }
43
44
 
44
- disconnectedCallback() {
45
- super.disconnectedCallback();
46
- window.removeEventListener('resize', this._handleResize.bind(this));
47
- }
45
+ /* No viewport watch. The phone images were the only thing it changed, and
46
+ they are <source media> now (footer-images.js). */
48
47
 
49
48
  firstUpdated() {
50
49
  super.firstUpdated();
@@ -57,127 +56,43 @@ export class BdFooterLP extends LitElement {
57
56
  }
58
57
  }
59
58
 
59
+ /* bd-footer's precedence, less its country selector: an explicit
60
+ current-locale, then the first path segment if it resolves to a supported
61
+ locale, then DEFAULT_LOCALE. This copy used to end by assigning the raw
62
+ segment whatever it was, so an explicit locale was overwritten and
63
+ Storybook's /iframe.html became the locale "iframe.html". */
60
64
  _initLocaleFromUrl() {
61
- const urlLocale = window.location.pathname.split('/')[1]?.toLowerCase();
62
-
63
- if (!urlLocale) {
64
- return;
65
- }
66
-
67
- const normalizedLocaleMap = {};
68
- Object.entries(localeMap).forEach(([key, value]) => {
69
- normalizedLocaleMap[key.toLowerCase()] = value;
70
- });
71
-
72
- let country = normalizedLocaleMap[urlLocale];
73
-
74
- if (!country && urlLocale) {
75
- const localeParts = urlLocale.split('-');
76
- const language = localeParts[0];
77
- const region = localeParts[1];
78
-
79
- const possibleMatches = Object.entries(normalizedLocaleMap)
80
- .filter(([key]) => key.startsWith(language));
81
-
82
- if (possibleMatches.length > 0) {
83
- const exactRegionMatch = possibleMatches.find(([key]) => {
84
- const keyParts = key.split('-');
85
- const keyRegion = keyParts[1];
86
- const regionMatch = region && keyRegion === region;
87
- const languageOnlyMatch = !region && keyParts.length === 1;
88
-
89
- return regionMatch || languageOnlyMatch;
90
- });
91
-
92
- if (exactRegionMatch) {
93
- const originalKey = Object.keys(localeMap).find(k =>
94
- k.toLowerCase() === exactRegionMatch[0]
95
- );
96
- this.currentLocale = originalKey || exactRegionMatch[0];
97
- } else {
98
- const originalKey = Object.keys(localeMap).find(k =>
99
- k.toLowerCase() === possibleMatches[0][0]
100
- );
101
- this.currentLocale = originalKey || possibleMatches[0][0];
102
- }
103
- }
104
- }
65
+ if (this._localeExplicit) return;
105
66
 
106
- if (this.currentLocale !== urlLocale) {
107
- const originalKey = Object.keys(localeMap).find(k =>
108
- k.toLowerCase() === urlLocale
109
- );
110
- this.currentLocale = originalKey || urlLocale;
111
- }
67
+ const resolved = localeFromPath(window.location.pathname);
68
+ if (resolved) [this.currentLocale] = resolved;
112
69
  }
113
70
 
114
71
  _toggleImpressumVisibility() {
115
- const showImpressum = this.locale === 'de-de' || this.locale === 'de';
116
- const slot = this.shadowRoot?.querySelector('slot[name="secondary-nav"]');
117
- const assignedElements = slot?.assignedElements({ flatten: true }) || [];
118
-
119
- if (assignedElements.length > 0) {
120
- const footerNav = assignedElements[0];
121
- const impressumLink = footerNav.querySelector('.impressum-link');
122
-
123
- let impressumDivider = null;
124
- if (impressumLink) {
125
- impressumDivider = impressumLink.previousElementSibling;
126
-
127
- // Keep it only if it is the divider immediately before the link
128
- if (!(impressumDivider && impressumDivider.tagName === 'BD-DIVIDER-VERTICAL' &&
129
- impressumDivider.nextElementSibling === impressumLink)) {
130
- impressumDivider = null;
131
- }
132
- }
133
-
134
- if (impressumLink) {
135
- impressumLink.style.display = showImpressum ? '' : 'none';
136
-
137
- if (impressumDivider && impressumDivider.tagName === 'BD-DIVIDER-VERTICAL') {
138
- impressumDivider.style.display = showImpressum ? '' : 'none';
139
- }
140
- }
141
- }
142
- }
143
-
144
- _handleResize() {
145
- this._isMobile = matchesBelow('md');
72
+ toggleImpressum(this.shadowRoot?.querySelector('slot[name="secondary-nav"]'), this.locale);
146
73
  }
147
74
 
148
75
  get locale() {
149
- return (this.currentLocale || 'en').toLowerCase();
76
+ return (this.currentLocale || DEFAULT_LOCALE).toLowerCase();
150
77
  }
151
78
 
152
79
  render() {
153
80
  const year = new Date().getFullYear();
154
81
  const showAnpc = this.locale.startsWith('ro');
155
82
 
156
- const masterbrandUrl = this._isMobile
157
- ? '/assets/Bitdefender-Masterbrand_mobile.png'
158
- : '/assets/Bitdefender-Masterbrand.png';
159
-
160
- const anpcUrl = this._isMobile
161
- ? '/assets/anpc_mobile.png'
162
- : '/assets/anpc.png';
163
-
164
- const logoUrl = '/assets/BD_logo.png';
165
-
166
83
  return html`
167
84
  <div class="footer-top-bleed">
168
85
  <div class="bd-ensemble container">
169
86
  <div class="footer-top">
170
87
  <div class="footer-logo">
171
88
  <slot name="logo">
172
- <span><img src="${logoUrl}" alt="Bitdefender Logo"></span>
89
+ <span>${footerLogo}</span>
173
90
  </slot>
174
91
  </div>
175
92
  <div class="footer-top-right">
176
93
  <slot name="top-right">
177
94
  <div>
178
- <span>
179
- <img src="${masterbrandUrl}" alt="Bitdefender Masterbrand">
180
- </span>
95
+ <span>${footerMasterbrand}</span>
181
96
  </div>
182
97
  </slot>
183
98
  </div>
@@ -204,9 +119,7 @@ export class BdFooterLP extends LitElement {
204
119
  ${showAnpc
205
120
  ? html`
206
121
  <div class="footer-anpc-lp">
207
- <slot name="anpc">
208
- <img src="${anpcUrl}" alt="Certificat" />
209
- </slot>
122
+ <slot name="anpc">${footerAnpc}</slot>
210
123
  </div>
211
124
  `
212
125
  : ''}
@@ -148,7 +148,7 @@ InternationalCompliance.parameters = {
148
148
  };
149
149
 
150
150
  export const GermanLegal = () => html`
151
- <bd-footer-lp>
151
+ <bd-footer-lp current-locale="de">
152
152
  <bd-footer-nav slot="secondary-nav">
153
153
  <a href="/legal/">Rechtliche Informationen</a>
154
154
  <bd-divider-vertical color="inverse" height="18"></bd-divider-vertical>
@@ -169,7 +169,7 @@ export const GermanLegal = () => html`
169
169
  GermanLegal.parameters = {
170
170
  docs: {
171
171
  description: {
172
- story: 'German language footer with legal requirements. Includes mandatory Impressum link and proper German translations for all legal and privacy terms.'
172
+ story: '`current-locale="de"`: German language footer with legal requirements. Includes the mandatory Impressum link, which shows only for `de` and `de-de`, and proper German translations for all legal and privacy terms.'
173
173
  }
174
174
  }
175
175
  };
@@ -18,7 +18,7 @@ export default css`
18
18
  }
19
19
 
20
20
  ::slotted(a) {
21
- color: var(--color-text-inverse) !important;
21
+ color: var(--color-text-inverse);
22
22
  text-decoration: none;
23
23
  }
24
24
 
@@ -55,7 +55,7 @@ export default css`
55
55
  }
56
56
 
57
57
  .footer-nav-main ::slotted(bd-divider-vertical) {
58
- display: none !important;
58
+ display: none;
59
59
  }
60
60
  }
61
61
 
@@ -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 '../divider/divider-vertical.js';
@@ -6,12 +6,17 @@ import navCSS from './footer-nav-menu.css.js';
6
6
 
7
7
  export class BdFooterNav extends LitElement {
8
8
  static properties = {
9
- bold: { type: Boolean }
9
+ bold : { type: Boolean },
10
+ /* The landmark's name. A footer usually holds two of these, and a page has
11
+ its own site navigation besides, so each says which one it is -- without
12
+ the word "navigation", which a screen reader adds itself. */
13
+ label: { type: String }
10
14
  };
11
15
 
12
16
  constructor() {
13
17
  super();
14
18
  this.bold = false;
19
+ this.label = 'Footer';
15
20
  }
16
21
 
17
22
  render() {
@@ -25,7 +30,7 @@ export class BdFooterNav extends LitElement {
25
30
  .join(' ');
26
31
 
27
32
  return html`
28
- <nav class=${classString} part="links">
33
+ <nav class=${classString} part="links" aria-label="${this.label || nothing}">
29
34
  <slot></slot>
30
35
  </nav>
31
36
  `;