@repobit/dex-system-design 0.19.2 → 0.21.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 (75) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +2 -3
  3. package/src/components/Button/button.stories.js +51 -51
  4. package/src/components/accordion/accordion-bg.css.js +168 -102
  5. package/src/components/accordion/accordion-bg.js +13 -5
  6. package/src/components/accordion/accordion-bg.stories.js +281 -0
  7. package/src/components/accordion/accordion-light.stories.js +241 -0
  8. package/src/components/anchor/anchor.stories.js +24 -22
  9. package/src/components/back/back.css.js +56 -0
  10. package/src/components/back/back.js +39 -0
  11. package/src/components/back/back.stories.js +184 -0
  12. package/src/components/badge/badge.css.js +44 -6
  13. package/src/components/badge/badge.js +40 -2
  14. package/src/components/badge/badge.stories.js +3 -10
  15. package/src/components/breadcrumb/breadcrumb.css.js +98 -0
  16. package/src/components/breadcrumb/breadcrumb.js +136 -0
  17. package/src/components/breadcrumb/breadcrumb.stories.js +109 -0
  18. package/src/components/cards/card.css.js +245 -0
  19. package/src/components/cards/card.js +80 -0
  20. package/src/components/cards/card.stories.js +512 -0
  21. package/src/components/carousel/carousel.css.js +51 -36
  22. package/src/components/carousel/carousel.js +0 -1
  23. package/src/components/carousel/carousel.stories.js +21 -17
  24. package/src/components/display/display.css.js +68 -0
  25. package/src/components/display/display.js +26 -0
  26. package/src/components/display/display.stories.js +339 -0
  27. package/src/components/divider/divider-horizontal.js +1 -1
  28. package/src/components/footer/footer-links-group.css.js +1 -1
  29. package/src/components/footer/footer-links-group.js +3 -3
  30. package/src/components/footer/footer-lp.stories.js +26 -61
  31. package/src/components/footer/footer-nav-menu.css.js +9 -10
  32. package/src/components/footer/footer.css.js +95 -8
  33. package/src/components/footer/footer.js +31 -65
  34. package/src/components/footer/footer.stories.js +165 -48
  35. package/src/components/header/header.js +11 -11
  36. package/src/components/header/header.stories.js +36 -4
  37. package/src/components/heading/heading.css.js +79 -0
  38. package/src/components/heading/heading.js +79 -0
  39. package/src/components/heading/heading.stories.js +260 -0
  40. package/src/components/highlight/highlight.stories.js +1 -1
  41. package/src/components/image/image.css.js +101 -0
  42. package/src/components/image/image.js +57 -0
  43. package/src/components/image/image.stories.js +245 -0
  44. package/src/components/light-carousel/light-carousel-simple.js +3 -2
  45. package/src/components/light-carousel/light-carousel.js +3 -7
  46. package/src/components/light-carousel/light-carousel.stories.js +15 -16
  47. package/src/components/link/link.css.js +107 -18
  48. package/src/components/link/link.js +16 -12
  49. package/src/components/link/link.stories.js +177 -0
  50. package/src/components/list/list-item/list-item.css.js +106 -0
  51. package/src/components/list/list-item/list-item.js +43 -0
  52. package/src/components/list/list-item/list-item.stories.js +79 -0
  53. package/src/components/list/list.css.js +175 -0
  54. package/src/components/list/list.js +44 -0
  55. package/src/components/modal/modal.js +6 -5
  56. package/src/components/paragraph/paragraph.css.js +41 -11
  57. package/src/components/paragraph/paragraph.js +7 -45
  58. package/src/components/paragraph/paragraph.stories.js +235 -0
  59. package/src/components/picture/picture.css.js +0 -0
  60. package/src/components/picture/picture.js +46 -0
  61. package/src/components/picture/picture.stories.js +275 -0
  62. package/src/components/pricing-cards/pricing-card-actions.js +1 -1
  63. package/src/components/pricing-cards/pricing-card-header.js +9 -7
  64. package/src/components/pricing-cards/pricing-card-pricing.js +11 -12
  65. package/src/components/pricing-cards/pricing-card.css.js +28 -3
  66. package/src/components/pricing-cards/pricing-card.js +38 -50
  67. package/src/components/tabs/tabs.js +44 -47
  68. package/src/components/termsOfUse/terms.js +77 -161
  69. package/src/components/termsOfUse/terms.stories.js +4 -3
  70. package/src/stories/Header.js +6 -6
  71. package/src/tokens/layout.css +3 -3
  72. package/src/tokens/tokens.css +0 -23
  73. package/src/tokens/tokens.stories.js +9 -8
  74. package/src/components/accordion/accordion-no-bg.css.js +0 -114
  75. package/src/components/accordion/accordion-no-bg.js +0 -80
@@ -1,60 +1,177 @@
1
- // BdFooter.stories.js
2
1
  import { html } from 'lit';
3
2
  import './footer.js';
4
3
 
5
4
  export default {
6
- title : 'Components/Footer',
7
- component: 'bd-footer',
8
- argTypes : {
9
- currentLocale : { control: 'text' },
10
- selectedCountry : { control: 'text' },
11
- maxColumnsPerRow: { control: { type: 'number', min: 1, max: 4 } },
12
- quickLinks1 : { control: 'object' },
13
- quickLinks2 : { control: 'object' },
14
- address : { control: 'text' }
5
+ title : 'Components/Footer/BdFooter',
6
+ component : 'bd-footer',
7
+ parameters: {
8
+ layout: 'fullscreen'
15
9
  }
16
10
  };
17
11
 
18
- const Template = ({ currentLocale, selectedCountry, maxColumnsPerRow, quickLinks1, quickLinks2, address }) => {
19
- return html`
20
- <bd-footer
21
- .currentLocale=${currentLocale}
22
- .selectedCountry=${selectedCountry}
23
- .maxColumnsPerRow=${maxColumnsPerRow}
24
- >
25
- <span slot="logo"><img src="/assets/BD_logo.png" alt="Bitdefender Logo"></span>
26
-
27
- <bd-footer-links-group slot="quick-links" title="Quick Links 1">
28
- ${quickLinks1.map(
29
- link => html`<a href="${link.href}" target="_blank">${link.label}</a>`
30
- )}
31
- </bd-footer-links-group>
12
+ export const Default = () => html`
13
+ <bd-footer maxColumnsPerRow="3">
14
+ <bd-footer-nav slot="nav" class="footer-nav-main" bold>
15
+ <a href="/en/consumer/">For Consumer</a>
16
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
17
+ <a href="/en/small-business/">For Small Business</a>
18
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
19
+ <a href="/en/business/">For Enterprise</a>
20
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
21
+ <a href="/en/partners/">For Partners</a>
22
+ </bd-footer-nav>
23
+ <bd-footer-links-group slot="quick-links" title="Quick links">
24
+ <a href="https://central.bitdefender.com/">Bitdefender Central</a>
25
+ <a href="https://gravityzone.bitdefender.com/">GravityZone Cloud Control Center</a>
26
+ <a href="https://www.bitdefender.com/en-us/cyberpedia/">Bitdefender Cyberpedia</a>
27
+ <a href="https://pan.bitdefender.com/partners/save/">Partner Advantage Network Portal</a>
28
+ <a href="https://brand.bitdefender.com/point/en/bitdefenderhub/component/default/">Brand Portal</a>
29
+ </bd-footer-links-group>
30
+
31
+ <bd-footer-links-group slot="quick-links">
32
+ <a href="https://www.bitdefender.com/consumer/support/">Support for Home Products</a>
33
+ <a href="https://www.bitdefender.com/business/support/">Support for Business Products</a>
34
+ <a href="/company/">Investors</a>
35
+ <a href="/company/job-opportunities/">Careers</a>
36
+ <a href="/business/infozone/">InfoZone</a>
37
+ </bd-footer-links-group>
38
+
39
+ <bd-footer-nav slot="secondary-nav">
40
+ <a href="/legal/">Legal Information</a>
41
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
42
+ <a href="/site/view/legal-privacy-policy-for-bitdefender-websites/">Privacy Policy</a>
43
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
44
+ <a href="/sitemap/">Site Map</a>
45
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
46
+ <a href="/company/">Company</a>
47
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
48
+ <a href="https://www.bitdefender.com/consumer/support/">Contact Us</a>
49
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
50
+ <a href="#">Privacy Settings</a>
51
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
52
+ <a href="#" class="impressum-link">Impressum</a>
53
+ </bd-footer-nav>
54
+ </bd-footer>
55
+ `;
56
+
57
+ export const Romanian = () => html`
58
+ <bd-footer maxColumnsPerRow="3">
59
+ <bd-footer-nav slot="nav" class="footer-nav-main" bold>
60
+ <a href="/ro-ro/consumer/">Pentru Consumatori</a>
61
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
62
+ <a href="/ro-ro/small-business/">Pentru Afaceri Mici</a>
63
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
64
+ <a href="/ro-ro/business/">Pentru Întreprinderi</a>
65
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
66
+ <a href="/ro-ro/partners/">Pentru Parteneri</a>
67
+ </bd-footer-nav>
68
+
69
+ <bd-footer-links-group slot="quick-links" title="Linkuri rapide">
70
+ <a href="https://central.bitdefender.com/">Bitdefender Central</a>
71
+ <a href="https://gravityzone.bitdefender.com/">GravityZone Cloud Control Center</a>
72
+ <a href="https://www.bitdefender.com/ro-ro/cyberpedia/">Bitdefender Cyberpedia</a>
73
+ <a href="https://pan.bitdefender.com/partners/save/">Partner Advantage Network Portal</a>
74
+ <a href="https://brand.bitdefender.com/point/en/bitdefenderhub/component/default/">Brand Portal</a>
75
+ </bd-footer-links-group>
76
+
77
+ <bd-footer-links-group slot="quick-links">
78
+ <a href="https://www.bitdefender.com/consumer/support/">Suport pentru Produse Casnice</a>
79
+ <a href="https://www.bitdefender.com/business/support/">Suport pentru Produse Business</a>
80
+ <a href="/company/">Investitori</a>
81
+ <a href="/company/job-opportunities/">Cariere</a>
82
+ <a href="/business/infozone/">InfoZone</a>
83
+ </bd-footer-links-group>
84
+
85
+ <bd-footer-nav slot="secondary-nav">
86
+ <a href="/legal/">Informații Legale</a>
87
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
88
+ <a href="/site/view/legal-privacy-policy-for-bitdefender-websites/">Politica de Confidențialitate</a>
89
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
90
+ <a href="/sitemap/">Harta Site</a>
91
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
92
+ <a href="/company/">Companie</a>
93
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
94
+ <a href="https://www.bitdefender.com/consumer/support/">Contactați-ne</a>
95
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
96
+ <a href="#">Setări Confidențialitate</a>
97
+ </bd-footer-nav>
98
+ </bd-footer>
99
+ `;
32
100
 
33
- <bd-footer-links-group slot="quick-links" title="Quick Links 2">
34
- ${quickLinks2.map(
35
- link => html`<a href="${link.href}" target="_blank">${link.label}</a>`
36
- )}
101
+ export const German = () => html`
102
+ <bd-footer maxColumnsPerRow="3">
103
+ <bd-footer-nav slot="nav" class="footer-nav-main" bold>
104
+ <a href="/de-de/consumer/">Für Verbraucher</a>
105
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
106
+ <a href="/de-de/small-business/">Für Kleinunternehmen</a>
107
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
108
+ <a href="/de-de/business/">Für Unternehmen</a>
109
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
110
+ <a href="/de-de/partners/">Für Partner</a>
111
+ </bd-footer-nav>
112
+
113
+ <bd-footer-links-group slot="quick-links" title="Schnelllinks">
114
+ <a href="https://central.bitdefender.com/">Bitdefender Central</a>
115
+ <a href="https://gravityzone.bitdefender.com/">GravityZone Cloud Control Center</a>
116
+ <a href="https://www.bitdefender.com/de-de/cyberpedia/">Bitdefender Cyberpedia</a>
117
+ <a href="https://pan.bitdefender.com/partners/save/">Partner Advantage Network Portal</a>
118
+ <a href="https://brand.bitdefender.com/point/en/bitdefenderhub/component/default/">Brand Portal</a>
119
+ </bd-footer-links-group>
120
+
121
+ <bd-footer-links-group slot="quick-links">
122
+ <a href="https://www.bitdefender.com/consumer/support/">Support für Home-Produkte</a>
123
+ <a href="https://www.bitdefender.com/business/support/">Support für Business-Produkte</a>
124
+ <a href="/company/">Investoren</a>
125
+ <a href="/company/job-opportunities/">Karriere</a>
126
+ <a href="/business/infozone/">InfoZone</a>
127
+ </bd-footer-links-group>
128
+
129
+ <bd-footer-nav slot="secondary-nav">
130
+ <a href="/legal/">Rechtliche Informationen</a>
131
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
132
+ <a href="/site/view/legal-privacy-policy-for-bitdefender-websites/">Datenschutzrichtlinie</a>
133
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
134
+ <a href="/sitemap/">Sitemap</a>
135
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
136
+ <a href="/company/">Unternehmen</a>
137
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
138
+ <a href="https://www.bitdefender.com/consumer/support/">Kontakt</a>
139
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
140
+ <a href="#">Datenschutzeinstellungen</a>
141
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
142
+ <a href="#" class="impressum-link">Impressum</a>
143
+ </bd-footer-nav>
144
+ </bd-footer>
145
+ `;
146
+
147
+ export const WithDividers = () => html`
148
+ <div>
149
+ <bd-footer maxColumnsPerRow="3">
150
+ <bd-footer-nav slot="nav" class="footer-nav-main" bold>
151
+ <a href="/en/consumer/">For Consumer</a>
152
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
153
+ <a href="/en/small-business/">For Small Business</a>
154
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
155
+ <a href="/en/business/">For Enterprise</a>
156
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
157
+ <a href="/en/partners/">For Partners</a>
158
+ </bd-footer-nav>
159
+
160
+ <bd-footer-links-group slot="quick-links" title="Quick links">
161
+ <a href="https://central.bitdefender.com/">Bitdefender Central</a>
162
+ <a href="https://gravityzone.bitdefender.com/">GravityZone Cloud Control Center</a>
37
163
  </bd-footer-links-group>
38
164
 
39
- <div slot="address">${address}</div>
165
+ <bd-footer-nav slot="secondary-nav">
166
+ <a href="/legal/">Legal Information</a>
167
+ <bd-divider-vertical color="white" height="18px"></bd-divider-vertical>
168
+ <a href="/privacy/">Privacy Policy</a>
169
+ </bd-footer-nav>
40
170
  </bd-footer>
41
- `;
42
- };
43
171
 
44
- export const Default = Template.bind({});
45
- Default.args = {
46
- currentLocale : 'en',
47
- selectedCountry : 'Choose your country',
48
- maxColumnsPerRow: 2,
49
- quickLinks1 : [
50
- { label: 'Bitdefender Central', href: 'https://central.bitdefender.com/' },
51
- { label: 'GravityZone Cloud Control Center', href: 'https://gravityzone.bitdefender.com/' },
52
- { label: 'Bitdefender Cyberpedia', href: 'https://www.bitdefender.com/en-us/cyberpedia/' }
53
- ],
54
- quickLinks2: [
55
- { label: 'Support for Home Products', href: 'https://www.bitdefender.com/consumer/support/' },
56
- { label: 'Support for Business Products', href: 'https://www.bitdefender.com/business/support/' },
57
- { label: 'Careers', href: '/en/company/job-opportunities/' }
58
- ],
59
- address: '111 W. Houston Street, Suite 2105, Frost Tower Building<br/>San Antonio, Texas 78205'
60
- };
172
+ <bd-divider-horizontal width="95%"></bd-divider-horizontal>
173
+ <bd-divider-horizontal width="95%"></bd-divider-horizontal>
174
+ <bd-divider-horizontal width="95%"></bd-divider-horizontal>
175
+ <bd-divider-horizontal width="95%"></bd-divider-horizontal>
176
+ </div>
177
+ `;
@@ -1,6 +1,8 @@
1
1
  import { LitElement, html } from "lit";
2
2
  import { tokens } from "../../tokens/tokens.js";
3
3
  import headerCSS from "../header/header.css.js";
4
+ import "../heading/heading.js";
5
+ import "../paragraph/paragraph.js";
4
6
 
5
7
  class Header extends LitElement {
6
8
  static properties = {
@@ -20,15 +22,13 @@ class Header extends LitElement {
20
22
  super.attributeChangedCallback(name, oldVal, newVal);
21
23
  }
22
24
 
23
-
24
-
25
25
  render() {
26
26
  return html`
27
27
  <div class="bd-container">
28
28
  <div class="bd-header-left">
29
- <h2 class="bd-product-name">${this.productName}</h2>
30
- <h3 class="bd-value-prop">${this.valueProp}</h3>
31
- <p class="bd-description">${this.description}</p>
29
+ <bd-h as="h2" class="bd-product-name">${this.productName}</bd-h>
30
+ <bd-h as="h4" class="bd-value-prop">${this.valueProp}</bd-h>
31
+ <bd-p kind="regular" class="bd-description">${this.description}</bd-p>
32
32
 
33
33
  <div class="bd-price-zone-top">
34
34
  <span class="bd-full-price">${this.fullPrice}</span>
@@ -58,23 +58,23 @@ class Header extends LitElement {
58
58
  </bd-button>
59
59
  </div>
60
60
 
61
- <small class="bd-disclaimer-top">
61
+ <bd-p kind="small" class="bd-disclaimer-top">
62
62
  <slot name="disclaimer-top">
63
63
  Protection for 1 account & 5 PCs, Macs, tablets, or smartphones.
64
64
  Windows® | macOS® | Android™ | iOS®
65
65
  </slot>
66
- </small>
66
+ </bd-p>
67
67
 
68
- <small class="bd-disclaimer-bottom">
68
+ <bd-p kind="small" class="bd-disclaimer-bottom">
69
69
  <slot name="disclaimer-bottom-text-start"></slot>
70
70
  <slot name="disclaimer-bottom-link"></slot>
71
71
  <slot name="disclaimer-bottom-text-end"></slot>
72
- </small>
72
+ </bd-p>
73
73
  </div>
74
74
 
75
75
  <div class="bd-header-right">
76
76
  <div class="bd-header-image-wrapper">
77
- <slot name="header-image"></slot>
77
+ <slot name="header-picture"></slot>
78
78
  <div class="bd-header-watermark"><span>Trusted. Always.</span></div>
79
79
  </div>
80
80
  </div>
@@ -85,4 +85,4 @@ class Header extends LitElement {
85
85
 
86
86
  Header.styles = [tokens, headerCSS];
87
87
 
88
- customElements.define("bd-header", Header);
88
+ customElements.define("bd-header", Header);
@@ -1,4 +1,5 @@
1
1
  import { html } from 'lit';
2
+ import '../picture/picture.js';
2
3
  import './header.js';
3
4
 
4
5
  export default {
@@ -29,7 +30,32 @@ const Template = (args) => html`
29
30
  .finalPrice=${args.finalPrice}
30
31
  >
31
32
  ${args.headerImage
32
- ? html`<img slot="header-image" src="${args.headerImage}" alt="Header Image">`
33
+ ? html`
34
+ <bd-picture
35
+ slot="header-picture"
36
+ .sources=${[
37
+ {
38
+ type : 'image/webp',
39
+ srcset: args.headerImage,
40
+ media : '(min-width: 1200px)'
41
+ },
42
+ {
43
+ type : 'image/webp',
44
+ srcset: args.headerImage,
45
+ media : '(min-width: 768px)'
46
+ },
47
+ {
48
+ type : 'image/webp',
49
+ srcset: args.headerImage
50
+ }
51
+ ]}
52
+ alt="Security illustration"
53
+ fallback-src="${args.headerImage}"
54
+ loading="eager"
55
+ width="750"
56
+ height="500"
57
+ ></bd-picture>
58
+ `
33
59
  : ''}
34
60
 
35
61
  ${args.disclaimerTop
@@ -54,7 +80,7 @@ Default.args = {
54
80
  fullPrice : '$139.99',
55
81
  discount : 'Save 44%',
56
82
  finalPrice : '$79.99*',
57
- headerImage : '/assets/bd-header-us.jpg',
83
+ headerImage : 'https://picsum.photos/750/500',
58
84
  disclaimerTop : 'Protection for 1 account & 5 PCs, Macs, tablets, or smartphones. Windows® | macOS® | Android™ | iOS®',
59
85
  disclaimerBottomStart: 'Learn more about',
60
86
  disclaimerBottomLink : 'Terms & Conditions',
@@ -64,7 +90,7 @@ Default.args = {
64
90
  export const WithCustomImage = Template.bind({});
65
91
  WithCustomImage.args = {
66
92
  ...Default.args,
67
- headerImage: '/assets/bd-header-us.jpg'
93
+ headerImage: 'https://picsum.photos/750/500?random=1'
68
94
  };
69
95
 
70
96
  export const WithDiscountedPrice = Template.bind({});
@@ -75,9 +101,15 @@ WithDiscountedPrice.args = {
75
101
  fullPrice : '$199.99',
76
102
  discount : 'Save 35%',
77
103
  finalPrice : '$129.99*',
78
- headerImage : '/assets/bd-header-us.jpg',
104
+ headerImage : 'https://picsum.photos/750/500?random=2',
79
105
  disclaimerTop : 'Protection for 1 account & 5 devices.',
80
106
  disclaimerBottomStart: 'See',
81
107
  disclaimerBottomLink : 'Details',
82
108
  disclaimerBottomEnd : 'for more info.'
83
109
  };
110
+
111
+ export const WithLocalImage = Template.bind({});
112
+ WithLocalImage.args = {
113
+ ...Default.args,
114
+ headerImage: '/assets/bd-header-us.jpg'
115
+ };
@@ -0,0 +1,79 @@
1
+ import { css } from "lit";
2
+
3
+ export default css`
4
+ @layer bd-components {
5
+ .bd-heading {
6
+ margin: 0;
7
+ padding: 0;
8
+ color: var(--color-neutral-900);
9
+ }
10
+
11
+ /* h1 */
12
+ .bd-heading.h1 {
13
+ font-size: var(--typography-heading-h1-fontSize);
14
+ font-weight: var(--typography-heading-h1-fontWeight);
15
+ line-height: var(--typography-heading-h1-lineHeight);
16
+ letter-spacing: var(--typography-heading-h1-letterSpacing);
17
+ font-family: var(--typography-heading-h1-fontFamily);
18
+ // margin-bottom: var(--spacing-24);
19
+ // margin-top: var(--spacing-32);
20
+ }
21
+
22
+ /* h2 */
23
+ .bd-heading.h2 {
24
+ font-size: var(--typography-heading-h2-fontSize);
25
+ font-weight: var(--typography-heading-h2-fontWeight);
26
+ line-height: var(--typography-heading-h2-lineHeight);
27
+ letter-spacing: var(--typography-heading-h2-letterSpacing);
28
+ font-family: var(--typography-heading-h2-fontFamily);
29
+ // margin-bottom: var(--spacing-20);
30
+ // margin-top: var(--spacing-28);
31
+ }
32
+
33
+ /* h3 */
34
+ .bd-heading.h3 {
35
+ font-size: var(--typography-heading-h3-fontSize);
36
+ font-weight: var(--typography-heading-h3-fontWeight);
37
+ line-height: var(--typography-heading-h3-lineHeight);
38
+ letter-spacing: var(--typography-heading-h3-letterSpacing);
39
+ font-family: var(--typography-heading-h3-fontFamily);
40
+ // margin-bottom: var(--spacing-16);
41
+ // margin-top: var(--spacing-24);
42
+ }
43
+
44
+ /* h4 */
45
+ .bd-heading.h4 {
46
+ font-size: var(--typography-heading-h4-fontSize);
47
+ font-weight: var(--typography-heading-h4-fontWeight);
48
+ line-height: var(--typography-heading-h4-lineHeight);
49
+ letter-spacing: var(--typography-heading-h4-letterSpacing);
50
+ font-family: var(--typography-heading-h4-fontFamily);
51
+ // margin-bottom: var(--spacing-12);
52
+ // margin-top: var(--spacing-20);
53
+ }
54
+
55
+ /* h5 */
56
+ .bd-heading.h5 {
57
+ font-size: var(--typography-heading-h5-fontSize);
58
+ font-weight: var(--typography-heading-h5-fontWeight);
59
+ line-height: var(--typography-heading-h5-lineHeight);
60
+ letter-spacing: var(--typography-heading-h5-letterSpacing);
61
+ font-family: var(--typography-heading-h5-fontFamily);
62
+ // margin-bottom: var(--spacing-8);
63
+ // margin-top: var(--spacing-16);
64
+ }
65
+
66
+ /* h6 */
67
+ .bd-heading.h6 {
68
+ font-size: var(--typography-heading-h6-fontSize);
69
+ font-weight: var(--typography-heading-h6-fontWeight);
70
+ line-height: var(--typography-heading-h6-lineHeight);
71
+ letter-spacing: var(--typography-heading-h6-letterSpacing);
72
+ font-family: var(--typography-heading-h6-fontFamily);
73
+ // margin-bottom: var(--spacing-6);
74
+ // margin-top: var(--spacing-12);
75
+ }
76
+
77
+
78
+
79
+ `;
@@ -0,0 +1,79 @@
1
+ import { LitElement, html } from "lit";
2
+ import { tokens } from "../../tokens/tokens.js";
3
+ import headingCSS from "./heading.css.js";
4
+
5
+ export class BdH extends LitElement {
6
+ static properties = {
7
+ as : { type: String, reflect: true },
8
+ ariaLevel : { type: Number, attribute: "aria-level" },
9
+ padding : { type: String },
10
+ fontWeight: { type: String },
11
+ color : { type: String }
12
+ };
13
+
14
+ constructor() {
15
+ super();
16
+ this.as = "h1";
17
+ this.ariaLevel = null;
18
+ this.padding = "";
19
+ this.fontWeight = "";
20
+ this.color = "";
21
+ }
22
+
23
+ _isValidHeadingTag(tag) {
24
+ return ["h1", "h2", "h3", "h4", "h5", "h6"].includes(tag);
25
+ }
26
+
27
+ _getValidFontWeight(weight) {
28
+ const validWeights = [
29
+ "100", "200", "300", "400", "500", "600", "700", "800", "900",
30
+ "normal", "bold", "lighter", "bolder"
31
+ ];
32
+ return validWeights.includes(weight) ? weight : "";
33
+ }
34
+
35
+ _getValidColor(color) {
36
+ if (!color) return "";
37
+ if (
38
+ color.startsWith("var(") ||
39
+ color.startsWith("#") ||
40
+ color.startsWith("rgb") ||
41
+ color.startsWith("hsl")
42
+ ) {
43
+ return color;
44
+ }
45
+ return "";
46
+ }
47
+
48
+ _computeStyles() {
49
+ const styles = [];
50
+
51
+ const validFontWeight = this._getValidFontWeight(this.fontWeight);
52
+ const validColor = this._getValidColor(this.color);
53
+
54
+ if (this.padding) styles.push(`padding: ${this.padding};`);
55
+ if (validFontWeight) styles.push(`font-weight: ${validFontWeight};`);
56
+ if (validColor) styles.push(`color: ${validColor};`);
57
+
58
+ return styles.join(" ");
59
+ }
60
+
61
+
62
+ render() {
63
+ const tag = this._isValidHeadingTag(this.as) ? this.as : "h1";
64
+ const element = document.createElement(tag);
65
+ element.className = `bd-heading ${tag}`;
66
+ if (this.ariaLevel) element.setAttribute("aria-level", this.ariaLevel);
67
+
68
+ const styles = this._computeStyles();
69
+ if (styles) element.setAttribute("style", styles);
70
+
71
+ element.innerHTML = `<slot></slot>`;
72
+ return html`${element}`;
73
+ }
74
+
75
+
76
+ static styles = [tokens, headingCSS];
77
+ }
78
+
79
+ customElements.define("bd-h", BdH);