@repobit/dex-system-design 0.21.2 → 0.22.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 (52) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/package.json +4 -2
  3. package/src/components/Button/Button.js +7 -2
  4. package/src/components/Button/button.css.js +30 -0
  5. package/src/components/accordion/accordion-bg.stories.js +341 -171
  6. package/src/components/accordion/accordion.stories.js +345 -0
  7. package/src/components/anchor/anchor.stories.js +134 -76
  8. package/src/components/back/back.css.js +1 -1
  9. package/src/components/back/back.stories.js +301 -63
  10. package/src/components/badge/badge.js +4 -7
  11. package/src/components/badge/badge.stories.js +89 -96
  12. package/src/components/breadcrumb/breadcrumb.stories.js +167 -3
  13. package/src/components/cards/card.stories.js +153 -3
  14. package/src/components/display/display.css.js +7 -10
  15. package/src/components/display/display.js +14 -2
  16. package/src/components/display/display.stories.js +213 -219
  17. package/src/components/divider/divider.stories.js +337 -30
  18. package/src/components/footer/footer-lp.stories.js +346 -3
  19. package/src/components/footer/footer.js +0 -3
  20. package/src/components/footer/footer.stories.js +267 -4
  21. package/src/components/header/header.css.js +1 -1
  22. package/src/components/header/header.js +77 -56
  23. package/src/components/header/header.stories.js +298 -22
  24. package/src/components/heading/heading.css.js +1 -1
  25. package/src/components/heading/heading.stories.js +355 -113
  26. package/src/components/image/image.css.js +146 -98
  27. package/src/components/image/image.js +13 -2
  28. package/src/components/image/image.stories.js +546 -160
  29. package/src/components/input/custom-form.stories.js +209 -12
  30. package/src/components/link/link.css.js +2 -2
  31. package/src/components/link/link.stories.js +383 -53
  32. package/src/components/paragraph/paragraph.css.js +1 -1
  33. package/src/components/paragraph/paragraph.stories.js +365 -157
  34. package/src/components/picture/picture.css.js +209 -0
  35. package/src/components/picture/picture.js +16 -2
  36. package/src/components/picture/picture.stories.js +525 -180
  37. package/src/components/pricing-cards/new-pricing-card.js +19 -4
  38. package/src/components/pricing-cards/new-pricing-card.stories.js +422 -0
  39. package/src/components/pricing-cards/new-pricing.css.js +8 -0
  40. package/src/components/pricing-cards/pricing-card-actions.js +49 -9
  41. package/src/components/pricing-cards/pricing-card-container.css.js +1 -1
  42. package/src/components/pricing-cards/pricing-card-header.css.js +73 -63
  43. package/src/components/pricing-cards/pricing-card-header.js +44 -10
  44. package/src/components/pricing-cards/pricing-card-pricing.js +63 -64
  45. package/src/components/pricing-cards/pricing-card.css.js +7 -15
  46. package/src/components/pricing-cards/pricing-card.js +353 -270
  47. package/src/components/pricing-cards/pricing-card.stories.js +3 -3
  48. package/src/tokens/fonts.stories.js +335 -8
  49. package/src/tokens/spacing.stories.js +701 -34
  50. package/src/tokens/tokens-grid.stories.js +897 -48
  51. package/src/tokens/typography.stories.js +980 -38
  52. package/src/components/accordion/accordion-light.stories.js +0 -241
@@ -1,41 +1,85 @@
1
1
  import { html } from 'lit';
2
2
  import '../heading/heading.js';
3
+ import '../paragraph/paragraph.js';
3
4
  import './picture.js';
4
5
 
5
6
  export default {
6
7
  title : 'Atoms/Picture',
7
8
  component: 'bd-picture',
9
+ tags : ['autodocs'],
8
10
  argTypes : {
9
11
  sources: {
10
12
  control : 'object',
11
- description: 'Array of source objects for responsive images'
13
+ description: 'Array of source objects for responsive images with media queries and format options',
14
+ table : {
15
+ type : { summary: 'Array<SourceObject>' },
16
+ defaultValue: { summary: '[]' }
17
+ }
12
18
  },
13
19
  alt: {
14
20
  control : 'text',
15
- description: 'Alt text for accessibility'
21
+ description: 'Alternative text for accessibility and SEO',
22
+ table : {
23
+ type : { summary: 'string' },
24
+ defaultValue: { summary: '' }
25
+ }
16
26
  },
17
27
  fallbackSrc: {
18
28
  control : 'text',
19
- description: 'Fallback image source for older browsers'
29
+ description: 'Fallback image source for browsers that don\'t support picture element or specific formats',
30
+ table : {
31
+ type : { summary: 'string' },
32
+ defaultValue: { summary: '' }
33
+ }
20
34
  },
21
35
  width: {
22
36
  control : 'number',
23
- description: 'Image width attribute'
37
+ description: 'Image width in pixels for layout stability',
38
+ table : {
39
+ type : { summary: 'number' },
40
+ defaultValue: { summary: 'null' }
41
+ }
24
42
  },
25
43
  height: {
26
44
  control : 'number',
27
- description: 'Image height attribute'
45
+ description: 'Image height in pixels for layout stability',
46
+ table : {
47
+ type : { summary: 'number' },
48
+ defaultValue: { summary: 'null' }
49
+ }
28
50
  },
29
51
  loading: {
30
52
  control : { type: 'select' },
31
53
  options : ['lazy', 'eager'],
32
- description: 'Image loading strategy'
54
+ description: 'Image loading strategy for performance optimization',
55
+ table : {
56
+ type : { summary: 'string' },
57
+ defaultValue: { summary: 'lazy' }
58
+ }
59
+ },
60
+ fit: {
61
+ control : { type: 'select' },
62
+ options : ['cover', 'contain', 'fill', 'none', 'scale-down'],
63
+ description: 'How the image should be resized to fit its container',
64
+ table : {
65
+ type : { summary: 'string' },
66
+ defaultValue: { summary: 'cover' }
67
+ }
68
+ },
69
+ radius: {
70
+ control : { type: 'select' },
71
+ options : ['none', 'sm', 'md', 'lg', 'full'],
72
+ description: 'Border radius for rounded corners',
73
+ table : {
74
+ type : { summary: 'string' },
75
+ defaultValue: { summary: 'none' }
76
+ }
33
77
  }
34
78
  },
35
79
  parameters: {
36
80
  docs: {
37
81
  description: {
38
- component: 'A responsive picture component that supports multiple image formats and breakpoints.'
82
+ component: 'A responsive picture component that supports multiple image formats, breakpoints, and modern web features. Provides optimal performance and accessibility with fallback support for older browsers.'
39
83
  }
40
84
  }
41
85
  }
@@ -49,9 +93,13 @@ const Template = (args) => html`
49
93
  width="${args.width}"
50
94
  height="${args.height}"
51
95
  loading="${args.loading}"
96
+ fit="${args.fit}"
97
+ radius="${args.radius}"
52
98
  ></bd-picture>
53
99
  `;
54
100
 
101
+ // ============ STORIES ============
102
+
55
103
  export const Default = Template.bind({});
56
104
  Default.args = {
57
105
  sources: [
@@ -70,11 +118,157 @@ Default.args = {
70
118
  srcset: '/assets/bd-header-us-750.webp'
71
119
  }
72
120
  ],
73
- alt : 'Bitdefender Security Illustration',
121
+ alt : 'Bitdefender Security Illustration showing comprehensive protection features',
74
122
  fallbackSrc: '/assets/bd-header-us.jpg',
75
123
  width : 750,
76
124
  height : 500,
77
- loading : 'lazy'
125
+ loading : 'lazy',
126
+ fit : 'cover',
127
+ radius : 'none'
128
+ };
129
+ Default.parameters = {
130
+ docs: {
131
+ description: {
132
+ story: 'Default picture component with responsive WebP sources and JPEG fallback. Optimized for performance with lazy loading and proper aspect ratio.'
133
+ }
134
+ }
135
+ };
136
+
137
+ export const AllSourceTypes = () => html`
138
+ <div style="display: flex; flex-direction: column; gap: 3rem; max-width: 1000px; margin: 0 auto; padding: 2rem;">
139
+ <bd-h as="h2" style="margin-bottom: 1rem;">Picture Source Types and Strategies</bd-h>
140
+ <bd-p kind="regular" style="margin-bottom: 2rem;">
141
+ The picture element supports multiple image formats and responsive breakpoints for optimal performance and visual quality across different devices and browsers.
142
+ </bd-p>
143
+
144
+ <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 8px;">
145
+ <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">WebP with JPEG Fallback</bd-h>
146
+ <bd-picture
147
+ .sources="${[
148
+ {
149
+ type : 'image/webp',
150
+ srcset: '/assets/bd-header-us-2000.webp',
151
+ media : '(min-width: 1200px)'
152
+ },
153
+ {
154
+ type : 'image/webp',
155
+ srcset: '/assets/bd-header-us-1000.webp',
156
+ media : '(min-width: 768px)'
157
+ },
158
+ {
159
+ type : 'image/webp',
160
+ srcset: '/assets/bd-header-us-750.webp'
161
+ },
162
+ {
163
+ type : 'image/jpeg',
164
+ srcset: '/assets/bd-header-us-2000.jpg',
165
+ media : '(min-width: 1200px)'
166
+ },
167
+ {
168
+ type : 'image/jpeg',
169
+ srcset: '/assets/bd-header-us-1000.jpg',
170
+ media : '(min-width: 768px)'
171
+ }
172
+ ]}"
173
+ alt="Bitdefender Security with WebP and JPEG fallback support"
174
+ fallback-src="/assets/bd-header-us.jpg"
175
+ width="800"
176
+ height="500"
177
+ loading="lazy"
178
+ fit="cover"
179
+ radius="md"
180
+ ></bd-picture>
181
+ <bd-p kind="regular" style="margin-top: 1.5rem;">
182
+ <strong>Strategy:</strong> Modern WebP format for supported browsers with JPEG fallback for compatibility<br>
183
+ <strong>Benefits:</strong> Better compression + wide browser support<br>
184
+ <strong>Use case:</strong> Production websites requiring optimal performance
185
+ </bd-p>
186
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
187
+ 💡 <strong>Best practice:</strong> Always provide JPEG fallback for maximum browser compatibility
188
+ </bd-p>
189
+ </div>
190
+
191
+ <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 8px;">
192
+ <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Multiple Breakpoint Strategy</bd-h>
193
+ <bd-picture
194
+ .sources="${[
195
+ {
196
+ type : 'image/webp',
197
+ srcset: '/assets/bd-header-us-2000.webp',
198
+ media : '(min-width: 1440px)'
199
+ },
200
+ {
201
+ type : 'image/webp',
202
+ srcset: '/assets/bd-header-us-1200.webp',
203
+ media : '(min-width: 1024px)'
204
+ },
205
+ {
206
+ type : 'image/webp',
207
+ srcset: '/assets/bd-header-us-800.webp',
208
+ media : '(min-width: 768px)'
209
+ },
210
+ {
211
+ type : 'image/webp',
212
+ srcset: '/assets/bd-header-us-600.webp',
213
+ media : '(min-width: 480px)'
214
+ },
215
+ {
216
+ type : 'image/webp',
217
+ srcset: '/assets/bd-header-us-400.webp'
218
+ }
219
+ ]}"
220
+ alt="Bitdefender Security optimized for multiple screen sizes"
221
+ fallback-src="/assets/bd-header-us.jpg"
222
+ width="800"
223
+ height="500"
224
+ loading="lazy"
225
+ fit="cover"
226
+ radius="md"
227
+ ></bd-picture>
228
+ <bd-p kind="regular" style="margin-top: 1.5rem;">
229
+ <strong>Breakpoints:</strong> 1440px+ (desktop), 1024px+ (laptop), 768px+ (tablet), 480px+ (large mobile), default (mobile)<br>
230
+ <strong>Benefits:</strong> Optimal image size for each device, faster loading<br>
231
+ <strong>Use case:</strong> High-traffic websites with diverse device usage
232
+ </bd-p>
233
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
234
+ 📱 <strong>Performance:</strong> Mobile users download smaller images, improving page speed
235
+ </bd-p>
236
+ </div>
237
+
238
+ <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 8px;">
239
+ <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Single Source Simplicity</bd-h>
240
+ <bd-picture
241
+ .sources="${[
242
+ {
243
+ type : 'image/jpeg',
244
+ srcset: '/assets/bd-header-us.jpg'
245
+ }
246
+ ]}"
247
+ alt="Simple Bitdefender Security image implementation"
248
+ fallback-src="/assets/bd-header-us.jpg"
249
+ width="600"
250
+ height="400"
251
+ loading="lazy"
252
+ fit="cover"
253
+ radius="lg"
254
+ ></bd-picture>
255
+ <bd-p kind="regular" style="margin-top: 1.5rem;">
256
+ <strong>Strategy:</strong> Single image source without responsive variants<br>
257
+ <strong>Benefits:</strong> Simpler implementation, fewer image files to manage<br>
258
+ <strong>Use case:</strong> Internal applications, prototypes, simple websites
259
+ </bd-p>
260
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
261
+ ⚡ <strong>Quick setup:</strong> Perfect for MVPs and projects with limited image requirements
262
+ </bd-p>
263
+ </div>
264
+ </div>
265
+ `;
266
+ AllSourceTypes.parameters = {
267
+ docs: {
268
+ description: {
269
+ story: 'Comprehensive demonstration of different picture source strategies including WebP with JPEG fallback, multiple breakpoint optimization, and simple single-source implementations with detailed use case recommendations.'
270
+ }
271
+ }
78
272
  };
79
273
 
80
274
  export const SimplePicture = Template.bind({});
@@ -85,191 +279,342 @@ SimplePicture.args = {
85
279
  srcset: '/assets/bd-header-us.jpg'
86
280
  }
87
281
  ],
88
- alt : 'Simple Bitdefender Security Image',
282
+ alt : 'Simple Bitdefender Security Image showing protection interface',
89
283
  fallbackSrc: '/assets/bd-header-us.jpg',
90
- width : 750,
91
- height : 500,
92
- loading : 'eager'
284
+ width : 600,
285
+ height : 400,
286
+ loading : 'eager',
287
+ fit : 'cover',
288
+ radius : 'none'
289
+ };
290
+ SimplePicture.parameters = {
291
+ docs: {
292
+ description: {
293
+ story: 'Simple picture implementation with single JPEG source. Ideal for prototypes, internal applications, or situations where multiple image formats and breakpoints are not required.'
294
+ }
295
+ }
93
296
  };
94
297
 
95
- export const WebPWithJPEGFallback = () => html`
96
- <div style="max-width: 800px; margin: 0 auto;">
97
- <bd-h as="h4">WebP with JPEG Fallback</bd-h>
98
- <bd-picture
99
- .sources="${[
100
- {
101
- type : 'image/webp',
102
- srcset: '/assets/bd-header-us-2000.webp',
103
- media : '(min-width: 1200px)'
104
- },
105
- {
106
- type : 'image/webp',
107
- srcset: '/assets/bd-header-us-1000.webp',
108
- media : '(min-width: 768px)'
109
- },
110
- {
111
- type : 'image/webp',
112
- srcset: '/assets/bd-header-us-750.webp'
113
- },
114
- {
115
- type : 'image/jpeg',
116
- srcset: '/assets/bd-header-us-2000.jpg',
117
- media : '(min-width: 1200px)'
118
- },
119
- {
120
- type : 'image/jpeg',
121
- srcset: '/assets/bd-header-us-1000.jpg',
122
- media : '(min-width: 768px)'
123
- }
124
- ]}"
125
- alt="Bitdefender Security with WebP and JPEG fallback"
126
- fallback-src="/assets/bd-header-us.jpg"
127
- width="750"
128
- height="500"
129
- loading="eager"
130
- ></bd-picture>
131
- <p style="margin-top: 1rem; font-size: 0.875rem; color: #666;">
132
- Modern WebP format with JPEG fallback for maximum browser compatibility.
133
- </p>
134
- </div>
135
- `;
298
+ export const AdvancedResponsive = Template.bind({});
299
+ AdvancedResponsive.args = {
300
+ sources: [
301
+ {
302
+ type : 'image/avif',
303
+ srcset: '/assets/bd-header-us-2000.avif',
304
+ media : '(min-width: 1440px)'
305
+ },
306
+ {
307
+ type : 'image/webp',
308
+ srcset: '/assets/bd-header-us-1200.webp',
309
+ media : '(min-width: 1024px)'
310
+ },
311
+ {
312
+ type : 'image/webp',
313
+ srcset: '/assets/bd-header-us-800.webp',
314
+ media : '(min-width: 768px)'
315
+ },
316
+ {
317
+ type : 'image/webp',
318
+ srcset: '/assets/bd-header-us-400.webp'
319
+ }
320
+ ],
321
+ alt : 'Advanced Bitdefender Security with AVIF and WebP formats',
322
+ fallbackSrc: '/assets/bd-header-us.jpg',
323
+ width : 800,
324
+ height : 500,
325
+ loading : 'lazy',
326
+ fit : 'cover',
327
+ radius : 'md'
328
+ };
329
+ AdvancedResponsive.parameters = {
330
+ docs: {
331
+ description: {
332
+ story: 'Advanced responsive picture with AVIF format for modern browsers, WebP for broader support, and multiple breakpoints for optimal performance across all device types.'
333
+ }
334
+ }
335
+ };
136
336
 
137
- export const DifferentBreakpoints = () => html`
138
- <div style="max-width: 1000px; margin: 0 auto;">
139
- <bd-h as="h4">Multiple Breakpoints</bd-h>
140
- <bd-picture
141
- .sources="${[
142
- {
143
- type : 'image/webp',
144
- srcset: '/assets/bd-header-us-2000.webp',
145
- media : '(min-width: 1440px)'
146
- },
147
- {
148
- type : 'image/webp',
149
- srcset: '/assets/bd-header-us-1200.webp',
150
- media : '(min-width: 1024px)'
151
- },
152
- {
153
- type : 'image/webp',
154
- srcset: '/assets/bd-header-us-800.webp',
155
- media : '(min-width: 768px)'
156
- },
157
- {
158
- type : 'image/webp',
159
- srcset: '/assets/bd-header-us-600.webp',
160
- media : '(min-width: 480px)'
161
- },
162
- {
163
- type : 'image/webp',
164
- srcset: '/assets/bd-header-us-400.webp'
165
- }
166
- ]}"
167
- alt="Bitdefender Security with multiple breakpoints"
168
- fallback-src="/assets/bd-header-us.jpg"
169
- width="750"
170
- height="500"
171
- ></bd-picture>
172
- <p style="margin-top: 1rem; font-size: 0.875rem; color: #666;">
173
- This image loads different sizes at: 1440px+, 1024px+, 768px+, 480px+, and mobile.
174
- </p>
337
+ export const ObjectFitOptions = () => html`
338
+ <div style="display: flex; flex-direction: column; gap: 2rem; max-width: 1000px; margin: 0 auto; padding: 2rem;">
339
+ <bd-h as="h2" style="margin-bottom: 1rem;">Object Fit Property Examples</bd-h>
340
+ <bd-p kind="regular" style="margin-bottom: 2rem;">
341
+ The object-fit property controls how the image content is resized to fit its container. Choose the appropriate option based on your layout requirements.
342
+ </bd-p>
343
+
344
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem;">
345
+ <div style="text-align: center;">
346
+ <bd-h as="h4" style="margin-bottom: 1rem;">Cover</bd-h>
347
+ <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden;">
348
+ <bd-picture
349
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
350
+ alt="Cover fit example"
351
+ fallback-src="/assets/bd-header-us.jpg"
352
+ width="250"
353
+ height="200"
354
+ fit="cover"
355
+ ></bd-picture>
356
+ </div>
357
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
358
+ <strong>Use case:</strong> Hero images, profile pictures<br>
359
+ <strong>Behavior:</strong> Fills container, may crop edges
360
+ </bd-p>
361
+ </div>
362
+
363
+ <div style="text-align: center;">
364
+ <bd-h as="h4" style="margin-bottom: 1rem;">Contain</bd-h>
365
+ <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f8fafc;">
366
+ <bd-picture
367
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
368
+ alt="Contain fit example"
369
+ fallback-src="/assets/bd-header-us.jpg"
370
+ width="250"
371
+ height="200"
372
+ fit="contain"
373
+ ></bd-picture>
374
+ </div>
375
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
376
+ <strong>Use case:</strong> Product images, logos<br>
377
+ <strong>Behavior:</strong> Fits entirely, may have empty space
378
+ </bd-p>
379
+ </div>
380
+
381
+ <div style="text-align: center;">
382
+ <bd-h as="h4" style="margin-bottom: 1rem;">Fill</bd-h>
383
+ <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden;">
384
+ <bd-picture
385
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
386
+ alt="Fill fit example"
387
+ fallback-src="/assets/bd-header-us.jpg"
388
+ width="250"
389
+ height="200"
390
+ fit="fill"
391
+ ></bd-picture>
392
+ </div>
393
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
394
+ <strong>Use case:</strong> Background patterns<br>
395
+ <strong>Behavior:</strong> Stretches to fill, may distort
396
+ </bd-p>
397
+ </div>
398
+ </div>
175
399
  </div>
176
400
  `;
401
+ ObjectFitOptions.parameters = {
402
+ docs: {
403
+ description: {
404
+ story: 'Demonstration of different object-fit properties (cover, contain, fill) with visual examples and recommendations for when to use each option based on layout requirements and image content.'
405
+ }
406
+ }
407
+ };
177
408
 
178
- export const HeaderImageExample = () => html`
179
- <div style="background: #f8fafc; padding: 2rem; border-radius: 8px; border: 1px solid #e2e8f0;">
180
- <bd-h as="h4">Header Image Example</bd-h>
181
- <bd-picture
182
- .sources="${[
183
- {
184
- type : 'image/webp',
185
- srcset: '/assets/bd-header-us-2000.webp',
186
- media : '(min-width: 1200px)'
187
- },
188
- {
189
- type : 'image/webp',
190
- srcset: '/assets/bd-header-us-1000.webp',
191
- media : '(min-width: 768px)'
192
- },
193
- {
194
- type : 'image/webp',
195
- srcset: '/assets/bd-header-us-750.webp'
196
- }
197
- ]}"
198
- alt="Bitdefender Security Header Illustration"
199
- fallback-src="/assets/bd-header-us.jpg"
200
- width="800"
201
- height="400"
202
- loading="eager"
203
- ></bd-picture>
204
- <div style="margin-top: 1rem; padding: 1rem; background: white; border-radius: 4px;">
205
- <bd-h as="h4" style="margin: 0 0 0.5rem 0;">Bitdefender Ultimate Security</bd-h>
206
- <p style="margin: 0; color: #666;">Complete protection for your digital life</p>
409
+ export const LoadingStrategies = () => html`
410
+ <div style="display: flex; flex-direction: column; gap: 2rem; max-width: 800px; margin: 0 auto; padding: 2rem;">
411
+ <bd-h as="h2" style="margin-bottom: 1rem;">Loading Strategy Comparison</bd-h>
412
+
413
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem;">
414
+ <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 12px;">
415
+ <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Lazy Loading</bd-h>
416
+ <bd-picture
417
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
418
+ alt="Lazy loaded security image"
419
+ fallback-src="/assets/bd-header-us.jpg"
420
+ width="300"
421
+ height="200"
422
+ loading="lazy"
423
+ fit="cover"
424
+ radius="md"
425
+ ></bd-picture>
426
+ <bd-p kind="regular" style="margin-top: 1.5rem;">
427
+ <strong>When to use:</strong> Images below the fold, gallery items, non-critical content<br>
428
+ <strong>Performance:</strong> Improves initial page load time<br>
429
+ <strong>User experience:</strong> Images load as user scrolls near them
430
+ </bd-p>
431
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
432
+ ✅ <strong>Best practice:</strong> Use for all non-essential images
433
+ </bd-p>
434
+ </div>
435
+
436
+ <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 12px;">
437
+ <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Eager Loading</bd-h>
438
+ <bd-picture
439
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
440
+ alt="Eager loaded security image"
441
+ fallback-src="/assets/bd-header-us.jpg"
442
+ width="300"
443
+ height="200"
444
+ loading="eager"
445
+ fit="cover"
446
+ radius="md"
447
+ ></bd-picture>
448
+ <bd-p kind="regular" style="margin-top: 1.5rem;">
449
+ <strong>When to use:</strong> Hero images, above-the-fold content, LCP elements<br>
450
+ <strong>Performance:</strong> Loads immediately, may impact initial load<br>
451
+ <strong>User experience:</strong> Critical images ready when page renders
452
+ </bd-p>
453
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
454
+ ⚠️ <strong>Use sparingly:</strong> Only for images essential to initial rendering
455
+ </bd-p>
456
+ </div>
207
457
  </div>
208
458
  </div>
209
459
  `;
460
+ LoadingStrategies.parameters = {
461
+ docs: {
462
+ description: {
463
+ story: 'Comparison of lazy vs eager loading strategies with performance implications and guidelines for when to use each approach based on image importance and position in the page layout.'
464
+ }
465
+ }
466
+ };
210
467
 
211
- export const SingleSourceExample = () => html`
212
- <div style="max-width: 600px; margin: 0 auto;">
213
- <bd-h as="h4">Single Source Picture</bd-h>
214
- <bd-picture
215
- .sources="${[
216
- {
217
- type : 'image/jpeg',
218
- srcset: '/assets/bd-header-us.jpg'
219
- }
220
- ]}"
221
- alt="Simple Bitdefender Security Image"
222
- fallback-src="/assets/bd-header-us.jpg"
223
- width="600"
224
- height="400"
225
- loading="lazy"
226
- ></bd-picture>
227
- <p style="margin-top: 1rem; font-size: 0.875rem; color: #666;">
228
- Simple picture with single JPEG source - perfect when you don't need multiple formats.
229
- </p>
468
+ export const AccessibilityExamples = () => html`
469
+ <div style="display: flex; flex-direction: column; gap: 2rem; max-width: 800px; margin: 0 auto; padding: 2rem;">
470
+ <bd-h as="h2" style="margin-bottom: 1rem;">Accessibility Best Practices</bd-h>
471
+
472
+ <div style="border: 2px solid #10b981; padding: 2rem; border-radius: 12px; background: #f0fdf4;">
473
+ <bd-h as="h3" style="color: #059669; margin-bottom: 1rem;">✅ Good Alt Text Examples</bd-h>
474
+
475
+ <bd-picture
476
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
477
+ alt="Bitdefender security software dashboard showing real-time threat protection, firewall status, and privacy tools with green status indicators"
478
+ fallback-src="/assets/bd-header-us.jpg"
479
+ width="600"
480
+ height="400"
481
+ loading="lazy"
482
+ fit="cover"
483
+ radius="md"
484
+ ></bd-picture>
485
+
486
+ <bd-p kind="regular" style="margin-top: 1.5rem;">
487
+ <strong>Descriptive:</strong> Clearly describes the image content and context<br>
488
+ <strong>Concise:</strong> Meaningful but not overly verbose<br>
489
+ <strong>Relevant:</strong> Relates to the surrounding content and purpose
490
+ </bd-p>
491
+ <bd-p kind="small" style="color: #059669; margin-top: 1rem;">
492
+ ✅ Screen readers will provide meaningful context about the image content
493
+ </bd-p>
494
+ </div>
495
+
496
+ <div style="border: 2px solid #ef4444; padding: 2rem; border-radius: 12px; background: #fef2f2;">
497
+ <bd-h as="h3" style="color: #dc2626; margin-bottom: 1rem;">❌ Poor Alt Text Examples</bd-h>
498
+
499
+ <bd-picture
500
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
501
+ alt="image123.jpg"
502
+ fallback-src="/assets/bd-header-us.jpg"
503
+ width="600"
504
+ height="400"
505
+ loading="lazy"
506
+ fit="cover"
507
+ radius="md"
508
+ ></bd-picture>
509
+
510
+ <bd-p kind="regular" style="margin-top: 1.5rem;">
511
+ <strong>Avoid:</strong> File names, placeholder text, or generic descriptions<br>
512
+ <strong>Don't:</strong> Start with "image of" or "picture of"<br>
513
+ <strong>Never:</strong> Leave alt text empty for meaningful images
514
+ </bd-p>
515
+ <bd-p kind="small" style="color: #dc2626; margin-top: 1rem;">
516
+ ❌ Screen readers will announce meaningless file names to users
517
+ </bd-p>
518
+ </div>
519
+
520
+ <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 12px;">
521
+ <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Decorative Images</bd-h>
522
+ <bd-p kind="regular" style="margin-bottom: 1.5rem;">
523
+ For purely decorative images that don't convey meaningful content, use empty alt text to prevent screen readers from announcing them.
524
+ </bd-p>
525
+ <bd-picture
526
+ .sources="${[{ type: 'image/jpeg', srcset: '/assets/bd-header-us.jpg' }]}"
527
+ alt=""
528
+ fallback-src="/assets/bd-header-us.jpg"
529
+ width="400"
530
+ height="200"
531
+ loading="lazy"
532
+ fit="cover"
533
+ radius="md"
534
+ ></bd-picture>
535
+ <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
536
+ ✅ Empty alt attribute: <code>alt=""</code> - Screen readers will skip this image entirely
537
+ </bd-p>
538
+ </div>
230
539
  </div>
231
540
  `;
541
+ AccessibilityExamples.parameters = {
542
+ docs: {
543
+ description: {
544
+ story: 'Accessibility guidelines and examples showing proper alt text usage, common mistakes to avoid, and how to handle decorative images. Essential for creating inclusive experiences for screen reader users.'
545
+ }
546
+ }
547
+ };
232
548
 
233
- export const WithFixedDimensions = () => html`
234
- <div>
235
- <bd-h as="h4">Fixed Dimensions</bd-h>
236
- <bd-picture
237
- .sources="${[
238
- {
239
- type : 'image/jpeg',
240
- srcset: '/assets/bd-header-us.jpg'
241
- }
242
- ]}"
243
- alt="Bitdefender Security with fixed dimensions"
244
- fallback-src="/assets/bd-header-us.jpg"
245
- width="400"
246
- height="300"
247
- loading="lazy"
248
- ></bd-picture>
249
- <p style="margin-top: 1rem; font-size: 0.875rem; color: #666;">
250
- Fixed 400x300 dimensions prevent layout shifts during loading.
251
- </p>
549
+ export const HeaderImageExample = () => html`
550
+ <div style="max-width: 1000px; margin: 0 auto; padding: 2rem;">
551
+ <bd-h as="h2" style="margin-bottom: 2rem; text-align: center;">Bitdefender Ultimate Security</bd-h>
552
+
553
+ <div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 3rem; border-radius: 12px; color: white;">
554
+ <bd-picture
555
+ .sources="${[
556
+ {
557
+ type : 'image/webp',
558
+ srcset: '/assets/bd-header-us-2000.webp',
559
+ media : '(min-width: 1200px)'
560
+ },
561
+ {
562
+ type : 'image/webp',
563
+ srcset: '/assets/bd-header-us-1000.webp',
564
+ media : '(min-width: 768px)'
565
+ },
566
+ {
567
+ type : 'image/webp',
568
+ srcset: '/assets/bd-header-us-750.webp'
569
+ }
570
+ ]}"
571
+ alt="Bitdefender Security Suite dashboard showing comprehensive protection features including antivirus, firewall, and privacy tools"
572
+ fallback-src="/assets/bd-header-us.jpg"
573
+ width="800"
574
+ height="400"
575
+ loading="eager"
576
+ fit="cover"
577
+ radius="lg"
578
+ ></bd-picture>
579
+
580
+ <div style="margin-top: 2rem; text-align: center;">
581
+ <bd-h as="h3" style="color: white; margin-bottom: 1rem;">Complete Digital Protection</bd-h>
582
+ <bd-p kind="lead" style="color: white; opacity: 0.9;">
583
+ Enterprise-grade security solutions for home and business users.
584
+ Real-time threat detection, advanced firewall, and privacy protection in one package.
585
+ </bd-p>
586
+ </div>
587
+ </div>
252
588
  </div>
253
589
  `;
590
+ HeaderImageExample.parameters = {
591
+ docs: {
592
+ description: {
593
+ story: 'Real-world example of a hero section using the picture component with responsive images, eager loading for above-the-fold content, and proper accessibility attributes in a marketing context.'
594
+ }
595
+ }
596
+ };
254
597
 
255
- export const AccessibilityExample = () => html`
256
- <div style="max-width: 600px; margin: 0 auto;">
257
- <bd-h as="h4">Accessible Picture</bd-h>
258
- <bd-picture
259
- .sources="${[
260
- {
261
- type : 'image/jpeg',
262
- srcset: '/assets/bd-header-us.jpg'
263
- }
264
- ]}"
265
- alt="Bitdefender Security Suite showing advanced protection features including real-time scanning, firewall protection, and privacy tools for comprehensive digital security"
266
- fallback-src="/assets/bd-header-us.jpg"
267
- width="600"
268
- height="400"
269
- loading="lazy"
270
- ></bd-picture>
271
- <p style="margin-top: 1rem; font-size: 0.875rem; color: #666;">
272
- Always provide meaningful alt text for screen readers and SEO.
273
- </p>
274
- </div>
275
- `;
598
+ export const InteractivePlayground = Template.bind({});
599
+ InteractivePlayground.args = {
600
+ sources: [
601
+ {
602
+ type : 'image/jpeg',
603
+ srcset: '/assets/bd-header-us.jpg'
604
+ }
605
+ ],
606
+ alt : 'Customizable picture component example',
607
+ fallbackSrc: '/assets/bd-header-us.jpg',
608
+ width : 400,
609
+ height : 300,
610
+ loading : 'lazy',
611
+ fit : 'cover',
612
+ radius : 'none'
613
+ };
614
+ InteractivePlayground.parameters = {
615
+ docs: {
616
+ description: {
617
+ story: 'Interactive playground where you can test all picture properties in real-time. Use the controls panel to modify the image sources, dimensions, loading strategy, fit behavior, and styling options.'
618
+ }
619
+ }
620
+ };