@repobit/dex-system-design 0.22.12 → 0.23.1

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 (39) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +3 -2
  3. package/src/components/Button/button.stories.js +292 -120
  4. package/src/components/accordion/accordion-bg.css.js +7 -2
  5. package/src/components/accordion/accordion-bg.stories.js +268 -449
  6. package/src/components/accordion/accordion.stories.js +259 -265
  7. package/src/components/anchor/anchor.stories.js +160 -159
  8. package/src/components/awards/awards-icon.js +44 -0
  9. package/src/components/awards/awards.css.js +328 -0
  10. package/src/components/awards/awards.js +224 -0
  11. package/src/components/awards/awards.stories.js +447 -0
  12. package/src/components/back/back.stories.js +100 -375
  13. package/src/components/badge/badge.stories.js +241 -129
  14. package/src/components/breadcrumb/breadcrumb.stories.js +218 -219
  15. package/src/components/cards/card.stories.js +174 -622
  16. package/src/components/carousel/carousel.stories.js +196 -225
  17. package/src/components/checkbox/checkbox.stories.js +136 -51
  18. package/src/components/compare/compare.css.js +237 -0
  19. package/src/components/compare/compare.js +253 -0
  20. package/src/components/compare/compare.stories.js +372 -0
  21. package/src/components/display/display.stories.js +91 -297
  22. package/src/components/divider/divider.stories.js +160 -342
  23. package/src/components/footer/footer.stories.js +177 -402
  24. package/src/components/header/header.stories.js +130 -338
  25. package/src/components/heading/heading.js +8 -5
  26. package/src/components/heading/heading.stories.js +162 -471
  27. package/src/components/highlight/highlight.stories.js +153 -38
  28. package/src/components/image/image.stories.js +135 -563
  29. package/src/components/input/custom-form.stories.js +761 -224
  30. package/src/components/link/link.js +29 -12
  31. package/src/components/link/link.stories.js +130 -468
  32. package/src/components/modal/modal.stories.js +174 -28
  33. package/src/components/paragraph/paragraph.css.js +10 -1
  34. package/src/components/paragraph/paragraph.stories.js +85 -410
  35. package/src/components/picture/picture.stories.js +147 -561
  36. package/src/components/radio/radio.stories.js +230 -81
  37. package/src/components/tabs/tabs.stories.js +126 -10
  38. package/src/components/termsOfUse/terms.stories.js +223 -8
  39. package/src/tokens/tokens.js +1 -0
@@ -1,92 +1,95 @@
1
1
  import { html } from 'lit';
2
- import '../heading/heading.js';
3
- import '../paragraph/paragraph.js';
4
2
  import './image.js';
5
3
 
6
4
  export default {
7
- title : 'Atoms/Image',
8
- component: 'bd-img',
9
- tags : ['autodocs'],
10
- argTypes : {
5
+ title : 'Components/Image',
6
+ tags : ['autodocs'],
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: `
11
+ **BdImg** is a Lit image component with fit, radius, shadow, and loading configuration.
12
+
13
+ ### Usage
14
+ \`\`\`html
15
+ <bd-img
16
+ src="/assets/product.png"
17
+ alt="Product screenshot"
18
+ width="800"
19
+ height="600"
20
+ fit="cover"
21
+ radius="md"
22
+ shadow="lg"
23
+ loading="lazy"
24
+ ></bd-img>
25
+ \`\`\`
26
+
27
+ ### CSS Classes Applied
28
+ | Prop | Class Pattern |
29
+ |---|---|
30
+ | \`fit\` | value used directly (e.g. \`cover\`, \`contain\`) |
31
+ | \`radius\` | \`radius-{value}\` (e.g. \`radius-none\`, \`radius-md\`) |
32
+ | \`shadow\` | \`shadow-{value}\` (e.g. \`shadow-none\`, \`shadow-lg\`) |
33
+
34
+ ### Events
35
+ - \`image-loaded\` — fired on successful image load
36
+ - \`image-error\` — fired when the image fails to load
37
+ `
38
+ }
39
+ }
40
+ },
41
+ argTypes: {
11
42
  src: {
12
43
  control : 'text',
13
- description: 'Image source URL or path',
14
- table : {
15
- type : { summary: 'string' },
16
- defaultValue: { summary: '' }
17
- }
44
+ description: 'Image source URL',
45
+ table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Content' }
18
46
  },
19
47
  alt: {
20
48
  control : 'text',
21
- description: 'Alternative text for accessibility and SEO',
22
- table : {
23
- type : { summary: 'string' },
24
- defaultValue: { summary: '' }
25
- }
49
+ description: 'Alt text for accessibility',
50
+ table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Content' }
26
51
  },
27
52
  width: {
28
53
  control : 'number',
29
- description: 'Image width in pixels',
30
- table : {
31
- type : { summary: 'number' },
32
- defaultValue: { summary: 'auto' }
33
- }
54
+ description: 'Intrinsic width of the image',
55
+ table : { type: { summary: 'number' }, defaultValue: { summary: 'null' }, category: 'Dimensions' }
34
56
  },
35
57
  height: {
36
58
  control : 'number',
37
- description: 'Image height in pixels',
38
- table : {
39
- type : { summary: 'number' },
40
- defaultValue: { summary: 'auto' }
41
- }
59
+ description: 'Intrinsic height of the image',
60
+ table : { type: { summary: 'number' }, defaultValue: { summary: 'null' }, category: 'Dimensions' }
42
61
  },
43
62
  loading: {
44
63
  control : { type: 'select' },
45
64
  options : ['lazy', 'eager'],
46
- description: 'Image loading strategy',
47
- table : {
48
- type : { summary: 'string' },
49
- defaultValue: { summary: 'lazy' }
50
- }
65
+ description: 'Native browser loading strategy',
66
+ table : { type: { summary: "'lazy' | 'eager'" }, defaultValue: { summary: 'lazy' }, category: 'Performance' }
51
67
  },
52
68
  fit: {
53
69
  control : { type: 'select' },
54
70
  options : ['cover', 'contain', 'fill', 'none', 'scale-down'],
55
- description: 'How the image should be resized to fit its container',
56
- table : {
57
- type : { summary: 'string' },
58
- defaultValue: { summary: 'cover' }
59
- }
71
+ description: 'Object-fit behavior applied as a CSS class',
72
+ table : { type: { summary: 'string' }, defaultValue: { summary: 'cover' }, category: 'Appearance' }
60
73
  },
61
74
  radius: {
62
75
  control : { type: 'select' },
63
- options : ['none', 'sm', 'md', 'lg', 'full'],
64
- description: 'Border radius for rounded corners',
65
- table : {
66
- type : { summary: 'string' },
67
- defaultValue: { summary: 'none' }
68
- }
76
+ options : ['none', 'sm', 'md', 'lg', 'xl', 'full'],
77
+ description: 'Border radius applied as `radius-{value}` class',
78
+ table : { type: { summary: 'string' }, defaultValue: { summary: 'none' }, category: 'Appearance' }
69
79
  },
70
80
  shadow: {
71
81
  control : { type: 'select' },
72
- options : ['none', 'sm', 'md', 'lg'],
73
- description: 'Box shadow for depth effect',
74
- table : {
75
- type : { summary: 'string' },
76
- defaultValue: { summary: 'none' }
77
- }
78
- }
79
- },
80
- parameters: {
81
- docs: {
82
- description: {
83
- component: 'An enhanced image component with built-in styling options, loading strategies, and accessibility features. Provides consistent image handling across the application with performance optimizations.'
84
- }
82
+ options : ['none', 'sm', 'md', 'lg', 'xl'],
83
+ description: 'Box shadow applied as `shadow-{value}` class',
84
+ table : { type: { summary: 'string' }, defaultValue: { summary: 'none' }, category: 'Appearance' }
85
85
  }
86
86
  }
87
87
  };
88
88
 
89
- const Template = (args) => html`
89
+ const sampleSrc = 'https://via.placeholder.com/800x450';
90
+ const defaultArgs = { src: sampleSrc, alt: 'Sample image', width: 800, height: 450, loading: 'lazy', fit: 'cover', radius: 'none', shadow: 'none' };
91
+
92
+ const render = (args) => html`
90
93
  <bd-img
91
94
  src="${args.src}"
92
95
  alt="${args.alt}"
@@ -99,533 +102,102 @@ const Template = (args) => html`
99
102
  ></bd-img>
100
103
  `;
101
104
 
102
- // ============ STORIES ============
105
+ // ─── Stories ───────────────────────────────────────────────────────────────
103
106
 
104
- export const Default = Template.bind({});
105
- Default.args = {
106
- src : '/assets/bd-header-us.jpg',
107
- alt : 'Bitdefender Security Illustration',
108
- width : 400,
109
- height : 250,
110
- loading: 'lazy',
111
- fit : 'cover',
112
- radius : 'none',
113
- shadow : 'none'
114
- };
115
- Default.parameters = {
116
- docs: {
117
- description: {
118
- story: 'Default image component with standard configuration. Uses lazy loading and cover fit for optimal performance and appearance.'
119
- }
120
- }
107
+ export const Default = {
108
+ name : 'Default',
109
+ render : () => html`<bd-img src="${sampleSrc}" alt="Sample image" width="800" height="450"></bd-img>`,
110
+ parameters: { docs: { description: { story: 'Default image with `fit="cover"`, `radius="none"`, `shadow="none"`, and `loading="lazy"`.' } } }
121
111
  };
122
112
 
123
- export const AllObjectFitOptions = () => html`
124
- <div style="display: flex; flex-direction: column; gap: 3rem; max-width: 900px; margin: 0 auto; padding: 2rem;">
125
- <bd-h as="h2" style="margin-bottom: 1rem;">Object Fit Property Examples</bd-h>
126
- <bd-p kind="regular" style="margin-bottom: 2rem;">
127
- The object-fit property defines how an image should be resized to fit its container. Each option has specific use cases and behaviors.
128
- </bd-p>
129
-
130
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem;">
131
- <div style="text-align: center;">
132
- <bd-h as="h4" style="margin-bottom: 1rem;">Cover</bd-h>
133
- <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden;">
134
- <bd-img
135
- src="/assets/bd-header-us.jpg"
136
- alt="Cover fit example"
137
- width="250"
138
- height="200"
139
- fit="cover"
140
- ></bd-img>
141
- </div>
142
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
143
- <strong>Use case:</strong> Hero images, profile pictures<br>
144
- <strong>Behavior:</strong> Fills entire container, may crop edges<br>
145
- <strong>Best for:</strong> Maintaining aspect ratio while filling space
146
- </bd-p>
147
- </div>
148
-
149
- <div style="text-align: center;">
150
- <bd-h as="h4" style="margin-bottom: 1rem;">Contain</bd-h>
151
- <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f8fafc;">
152
- <bd-img
153
- src="/assets/bd-header-us.jpg"
154
- alt="Contain fit example"
155
- width="250"
156
- height="200"
157
- fit="contain"
158
- ></bd-img>
159
- </div>
160
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
161
- <strong>Use case:</strong> Product images, logos<br>
162
- <strong>Behavior:</strong> Fits entirely within container, may have empty space<br>
163
- <strong>Best for:</strong> Showing complete image without cropping
164
- </bd-p>
165
- </div>
166
-
167
- <div style="text-align: center;">
168
- <bd-h as="h4" style="margin-bottom: 1rem;">Fill</bd-h>
169
- <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden;">
170
- <bd-img
171
- src="/assets/bd-header-us.jpg"
172
- alt="Fill fit example"
173
- width="250"
174
- height="200"
175
- fit="fill"
176
- ></bd-img>
113
+ export const FitVariants = {
114
+ name : 'Fit Variants',
115
+ render: () => html`
116
+ <div style="display:flex; gap:16px; flex-wrap:wrap;">
117
+ ${['cover', 'contain', 'fill', 'none', 'scale-down'].map(fit => html`
118
+ <div>
119
+ <p style="font-size:12px; margin-bottom:4px; font-weight:600;">${fit}</p>
120
+ <bd-img src="${sampleSrc}" alt="${fit}" width="200" height="150" fit="${fit}"></bd-img>
177
121
  </div>
178
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
179
- <strong>Use case:</strong> Background patterns, decorative images<br>
180
- <strong>Behavior:</strong> Stretches to fill container, may distort<br>
181
- <strong>Best for:</strong> When aspect ratio preservation isn't important
182
- </bd-p>
183
- </div>
184
-
185
- <div style="text-align: center;">
186
- <bd-h as="h4" style="margin-bottom: 1rem;">None</bd-h>
187
- <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden;">
188
- <bd-img
189
- src="/assets/bd-header-us.jpg"
190
- alt="None fit example"
191
- width="250"
192
- height="200"
193
- fit="none"
194
- ></bd-img>
195
- </div>
196
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
197
- <strong>Use case:</strong> Icons, small graphics<br>
198
- <strong>Behavior:</strong> Original size, may overflow container<br>
199
- <strong>Best for:</strong> When you need the original image dimensions
200
- </bd-p>
201
- </div>
202
-
203
- <div style="text-align: center;">
204
- <bd-h as="h4" style="margin-bottom: 1rem;">Scale Down</bd-h>
205
- <div style="width: 250px; height: 200px; margin: 0 auto; border: 2px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f8fafc;">
206
- <bd-img
207
- src="/assets/bd-header-us.jpg"
208
- alt="Scale down fit example"
209
- width="250"
210
- height="200"
211
- fit="scale-down"
212
- ></bd-img>
213
- </div>
214
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
215
- <strong>Use case:</strong> Responsive images, variable content<br>
216
- <strong>Behavior:</strong> Like contain, but never scales up<br>
217
- <strong>Best for:</strong> Preventing pixelation on large containers
218
- </bd-p>
219
- </div>
122
+ `)}
220
123
  </div>
221
- </div>
222
- `;
223
- AllObjectFitOptions.parameters = {
224
- docs: {
225
- description: {
226
- story: 'Comprehensive demonstration of all object-fit property options with detailed explanations of when to use each option and their specific behaviors in different layout scenarios.'
227
- }
228
- }
124
+ `,
125
+ parameters: { docs: { description: { story: 'All five `fit` values: cover, contain, fill, none, scale-down.' } } }
229
126
  };
230
127
 
231
- export const LoadingStrategies = () => html`
232
- <div style="display: flex; flex-direction: column; gap: 3rem; max-width: 800px; margin: 0 auto; padding: 2rem;">
233
- <bd-h as="h2" style="margin-bottom: 1rem;">Image Loading Strategies</bd-h>
234
- <bd-p kind="regular" style="margin-bottom: 2rem;">
235
- Choose the right loading strategy based on image importance and position on the page to optimize performance and user experience.
236
- </bd-p>
237
-
238
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem;">
239
- <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 12px;">
240
- <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Lazy Loading</bd-h>
241
- <bd-img
242
- src="/assets/bd-header-us.jpg"
243
- alt="Lazy loaded security image"
244
- width="300"
245
- height="200"
246
- loading="lazy"
247
- fit="cover"
248
- radius="md"
249
- ></bd-img>
250
- <bd-p kind="regular" style="margin-top: 1.5rem;">
251
- <strong>When to use:</strong> Images below the fold, gallery items, non-critical content<br>
252
- <strong>Performance:</strong> Improves page load time by deferring off-screen images<br>
253
- <strong>User experience:</strong> Smooth scrolling with images loading as needed
254
- </bd-p>
255
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
256
- 💡 <strong>Best practice:</strong> Use for all images that aren't immediately visible
257
- </bd-p>
258
- </div>
259
-
260
- <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 12px;">
261
- <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Eager Loading</bd-h>
262
- <bd-img
263
- src="/assets/bd-header-us.jpg"
264
- alt="Eager loaded security image"
265
- width="300"
266
- height="200"
267
- loading="eager"
268
- fit="cover"
269
- radius="md"
270
- ></bd-img>
271
- <bd-p kind="regular" style="margin-top: 1.5rem;">
272
- <strong>When to use:</strong> Hero images, above-the-fold content, critical visuals<br>
273
- <strong>Performance:</strong> Loads immediately, may impact initial page load<br>
274
- <strong>User experience:</strong> Important images are ready when page renders
275
- </bd-p>
276
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
277
- ⚠️ <strong>Use sparingly:</strong> Only for images essential to initial page rendering
278
- </bd-p>
279
- </div>
128
+ export const RadiusVariants = {
129
+ name : 'Radius Variants',
130
+ render: () => html`
131
+ <div style="display:flex; gap:16px; flex-wrap:wrap;">
132
+ ${['none', 'sm', 'md', 'lg', 'xl', 'full'].map(r => html`
133
+ <div>
134
+ <p style="font-size:12px; margin-bottom:4px; font-weight:600;">radius-${r}</p>
135
+ <bd-img src="${sampleSrc}" alt="radius ${r}" width="150" height="150" radius="${r}" fit="cover"></bd-img>
136
+ </div>
137
+ `)}
280
138
  </div>
281
- </div>
282
- `;
283
- LoadingStrategies.parameters = {
284
- docs: {
285
- description: {
286
- story: 'Comparison of lazy vs eager loading strategies with performance implications and guidelines for when to use each approach based on image importance and page position.'
287
- }
288
- }
139
+ `,
140
+ parameters: { docs: { description: { story: 'All radius values: none, sm, md, lg, xl, full — applied as `radius-{value}` CSS class.' } } }
289
141
  };
290
142
 
291
- export const StylingVariants = () => html`
292
- <div style="display: flex; flex-direction: column; gap: 3rem; max-width: 1000px; margin: 0 auto; padding: 2rem;">
293
- <bd-h as="h2" style="margin-bottom: 1rem;">Styling and Appearance Variants</bd-h>
294
- <bd-p kind="regular" style="margin-bottom: 2rem;">
295
- Customize the appearance of images with border radius and shadow options to match your design system and create visual hierarchy.
296
- </bd-p>
297
-
298
- <div>
299
- <bd-h as="h3" style="margin-bottom: 2rem; color: #3b82f6;">Border Radius Options</bd-h>
300
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem;">
301
- <div style="text-align: center;">
302
- <bd-img
303
- src="/assets/bd-header-us.jpg"
304
- alt="No border radius"
305
- width="150"
306
- height="100"
307
- fit="cover"
308
- radius="none"
309
- ></bd-img>
310
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
311
- <strong>None</strong><br>
312
- Square corners
313
- </bd-p>
314
- </div>
315
-
316
- <div style="text-align: center;">
317
- <bd-img
318
- src="/assets/bd-header-us.jpg"
319
- alt="Small border radius"
320
- width="150"
321
- height="100"
322
- fit="cover"
323
- radius="sm"
324
- ></bd-img>
325
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
326
- <strong>Small</strong><br>
327
- Subtle rounding
328
- </bd-p>
329
- </div>
330
-
331
- <div style="text-align: center;">
332
- <bd-img
333
- src="/assets/bd-header-us.jpg"
334
- alt="Medium border radius"
335
- width="150"
336
- height="100"
337
- fit="cover"
338
- radius="md"
339
- ></bd-img>
340
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
341
- <strong>Medium</strong><br>
342
- Balanced rounding
343
- </bd-p>
344
- </div>
345
-
346
- <div style="text-align: center;">
347
- <bd-img
348
- src="/assets/bd-header-us.jpg"
349
- alt="Large border radius"
350
- width="150"
351
- height="100"
352
- fit="cover"
353
- radius="lg"
354
- ></bd-img>
355
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
356
- <strong>Large</strong><br>
357
- Prominent rounding
358
- </bd-p>
143
+ export const ShadowVariants = {
144
+ name : 'Shadow Variants',
145
+ render: () => html`
146
+ <div style="display:flex; gap:24px; flex-wrap:wrap; padding:16px;">
147
+ ${['none', 'sm', 'md', 'lg', 'xl'].map(s => html`
148
+ <div>
149
+ <p style="font-size:12px; margin-bottom:8px; font-weight:600;">shadow-${s}</p>
150
+ <bd-img src="${sampleSrc}" alt="shadow ${s}" width="180" height="120" shadow="${s}" radius="md"></bd-img>
359
151
  </div>
360
-
361
- <div style="text-align: center;">
362
- <bd-img
363
- src="/assets/bd-header-us.jpg"
364
- alt="Full border radius"
365
- width="150"
366
- height="100"
367
- fit="cover"
368
- radius="full"
369
- ></bd-img>
370
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
371
- <strong>Full</strong><br>
372
- Circular/oval shape
373
- </bd-p>
374
- </div>
375
- </div>
376
- </div>
377
-
378
- <div>
379
- <bd-h as="h3" style="margin-bottom: 2rem; color: #3b82f6;">Shadow Options</bd-h>
380
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem;">
381
- <div style="text-align: center;">
382
- <bd-img
383
- src="/assets/bd-header-us.jpg"
384
- alt="No shadow"
385
- width="150"
386
- height="100"
387
- fit="cover"
388
- radius="md"
389
- shadow="none"
390
- ></bd-img>
391
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
392
- <strong>None</strong><br>
393
- Flat appearance
394
- </bd-p>
395
- </div>
396
-
397
- <div style="text-align: center;">
398
- <bd-img
399
- src="/assets/bd-header-us.jpg"
400
- alt="Small shadow"
401
- width="150"
402
- height="100"
403
- fit="cover"
404
- radius="md"
405
- shadow="sm"
406
- ></bd-img>
407
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
408
- <strong>Small</strong><br>
409
- Subtle elevation
410
- </bd-p>
411
- </div>
412
-
413
- <div style="text-align: center;">
414
- <bd-img
415
- src="/assets/bd-header-us.jpg"
416
- alt="Medium shadow"
417
- width="150"
418
- height="100"
419
- fit="cover"
420
- radius="md"
421
- shadow="md"
422
- ></bd-img>
423
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
424
- <strong>Medium</strong><br>
425
- Noticeable depth
426
- </bd-p>
427
- </div>
428
-
429
- <div style="text-align: center;">
430
- <bd-img
431
- src="/assets/bd-header-us.jpg"
432
- alt="Large shadow"
433
- width="150"
434
- height="100"
435
- fit="cover"
436
- radius="md"
437
- shadow="lg"
438
- ></bd-img>
439
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
440
- <strong>Large</strong><br>
441
- Prominent elevation
442
- </bd-p>
443
- </div>
444
- </div>
152
+ `)}
445
153
  </div>
446
- </div>
447
- `;
448
- StylingVariants.parameters = {
449
- docs: {
450
- description: {
451
- story: 'Comprehensive showcase of styling options including border radius variations (none, small, medium, large, full) and shadow effects (none, small, medium, large) to create different visual appearances and depth effects.'
452
- }
453
- }
154
+ `,
155
+ parameters: { docs: { description: { story: 'Shadow levels from none to xl — applied as `shadow-{value}` CSS class.' } } }
454
156
  };
455
157
 
456
- export const AccessibilityExamples = () => html`
457
- <div style="display: flex; flex-direction: column; gap: 3rem; max-width: 800px; margin: 0 auto; padding: 2rem;">
458
- <bd-h as="h2" style="margin-bottom: 1rem;">Accessibility Best Practices</bd-h>
459
- <bd-p kind="regular" style="margin-bottom: 2rem;">
460
- Proper image accessibility ensures that all users, including those using screen readers, can understand and interact with your content effectively.
461
- </bd-p>
462
-
463
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem;">
464
- <div style="border: 2px solid #10b981; padding: 2rem; border-radius: 12px; background: #f0fdf4;">
465
- <bd-h as="h3" style="color: #059669; margin-bottom: 1rem;">✅ Good Alt Text</bd-h>
466
- <bd-img
467
- src="/assets/bd-header-us.jpg"
468
- alt="Bitdefender security software interface showing real-time threat protection dashboard"
469
- width="300"
470
- height="200"
471
- fit="cover"
472
- radius="md"
473
- ></bd-img>
474
- <bd-p kind="regular" style="margin-top: 1.5rem;">
475
- <strong>Descriptive:</strong> Clearly describes the image content and context<br>
476
- <strong>Concise:</strong> Brief but meaningful (125 characters or less)<br>
477
- <strong>Relevant:</strong> Relates to the surrounding content
478
- </bd-p>
479
- <bd-p kind="small" style="color: #059669; margin-top: 1rem;">
480
- ✅ Screen readers will read: "Bitdefender security software interface showing real-time threat protection dashboard"
481
- </bd-p>
482
- </div>
483
-
484
- <div style="border: 2px solid #ef4444; padding: 2rem; border-radius: 12px; background: #fef2f2;">
485
- <bd-h as="h3" style="color: #dc2626; margin-bottom: 1rem;">❌ Poor Alt Text</bd-h>
486
- <bd-img
487
- src="/assets/bd-header-us.jpg"
488
- alt="image123.jpg"
489
- width="300"
490
- height="200"
491
- fit="cover"
492
- radius="md"
493
- ></bd-img>
494
- <bd-p kind="regular" style="margin-top: 1.5rem;">
495
- <strong>File names:</strong> Never use file names as alt text<br>
496
- <strong>Placeholders:</strong> Avoid generic text like "image" or "photo"<br>
497
- <strong>Redundancy:</strong> Don't start with "image of" or "picture of"
498
- </bd-p>
499
- <bd-p kind="small" style="color: #dc2626; margin-top: 1rem;">
500
- ❌ Screen readers will read: "image123.jpg" - meaningless to users
501
- </bd-p>
502
- </div>
503
- </div>
504
-
505
- <div style="border: 2px solid #e2e8f0; padding: 2rem; border-radius: 12px;">
506
- <bd-h as="h3" style="color: #3b82f6; margin-bottom: 1rem;">Decorative Images</bd-h>
507
- <bd-p kind="regular" style="margin-bottom: 1.5rem;">
508
- For purely decorative images that don't convey meaningful content, use empty alt text to prevent screen readers from announcing them.
509
- </bd-p>
510
- <bd-img
511
- src="/assets/bd-header-us.jpg"
512
- alt=""
513
- width="300"
514
- height="100"
515
- fit="cover"
516
- radius="md"
517
- ></bd-img>
518
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
519
- ✅ Empty alt attribute: <code>alt=""</code> - Screen readers will skip this image entirely
520
- </bd-p>
521
- </div>
522
- </div>
523
- `;
524
- AccessibilityExamples.parameters = {
525
- docs: {
526
- description: {
527
- 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.'
528
- }
529
- }
158
+ export const LazyLoading = {
159
+ name : 'Lazy Loading',
160
+ render: () => html`
161
+ <bd-img src="${sampleSrc}" alt="Lazy loaded" width="800" height="450" loading="lazy"></bd-img>
162
+ `,
163
+ parameters: { docs: { description: { story: '`loading="lazy"` — default. The browser defers loading until the image is near the viewport.' } } }
530
164
  };
531
165
 
532
- export const ResponsiveSizes = () => html`
533
- <div style="display: flex; flex-direction: column; gap: 3rem; max-width: 800px; margin: 0 auto; padding: 2rem;">
534
- <bd-h as="h2" style="margin-bottom: 1rem;">Responsive Size Examples</bd-h>
535
- <bd-p kind="regular" style="margin-bottom: 2rem;">
536
- Images should adapt to different screen sizes and layout requirements. Here are common size patterns for various use cases.
537
- </bd-p>
538
-
539
- <div style="display: flex; flex-direction: column; gap: 2rem;">
540
- <div>
541
- <bd-h as="h4" style="margin-bottom: 1rem;">Small (400px) - Thumbnails & Icons</bd-h>
542
- <bd-img
543
- src="/assets/bd-header-us.jpg"
544
- alt="Small security image for thumbnails"
545
- width="400"
546
- height="250"
547
- fit="cover"
548
- radius="md"
549
- ></bd-img>
550
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
551
- Ideal for product thumbnails, user avatars, and icon-sized images in lists and grids.
552
- </bd-p>
553
- </div>
554
-
555
- <div>
556
- <bd-h as="h4" style="margin-bottom: 1rem;">Medium (600px) - Content Images</bd-h>
557
- <bd-img
558
- src="/assets/bd-header-us.jpg"
559
- alt="Medium security image for content"
560
- width="600"
561
- height="375"
562
- fit="cover"
563
- radius="md"
564
- ></bd-img>
565
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
566
- Perfect for blog posts, article content, and feature sections within page layouts.
567
- </bd-p>
568
- </div>
569
-
570
- <div>
571
- <bd-h as="h4" style="margin-bottom: 1rem;">Large (750px) - Hero & Header Images</bd-h>
572
- <bd-img
573
- src="/assets/bd-header-us.jpg"
574
- alt="Large security image for hero sections"
575
- width="750"
576
- height="500"
577
- fit="cover"
578
- radius="none"
579
- ></bd-img>
580
- <bd-p kind="small" style="color: #64748b; margin-top: 1rem;">
581
- Designed for hero sections, header images, and prominent visual elements that need maximum impact.
582
- </bd-p>
583
- </div>
584
- </div>
585
- </div>
586
- `;
587
- ResponsiveSizes.parameters = {
588
- docs: {
589
- description: {
590
- story: 'Common image size patterns for different use cases including thumbnails (small), content images (medium), and hero images (large) with recommendations for when to use each size category.'
591
- }
592
- }
166
+ export const EagerLoading = {
167
+ name : 'Eager Loading',
168
+ render: () => html`
169
+ <bd-img src="${sampleSrc}" alt="Eagerly loaded" width="800" height="450" loading="eager"></bd-img>
170
+ `,
171
+ parameters: { docs: { description: { story: '`loading="eager"` — image loads immediately regardless of viewport position.' } } }
593
172
  };
594
173
 
595
- export const HeaderImageExample = Template.bind({});
596
- HeaderImageExample.args = {
597
- src : '/assets/bd-header-us.jpg',
598
- alt : 'Bitdefender Ultimate Security Header - Advanced threat protection dashboard with real-time monitoring',
599
- width : 750,
600
- height : 500,
601
- loading: 'eager',
602
- fit : 'cover',
603
- radius : 'none',
604
- shadow : 'none'
174
+ export const RoundedWithShadow = {
175
+ name : 'Rounded + Shadow',
176
+ render: () => html`
177
+ <bd-img src="${sampleSrc}" alt="Styled image" width="600" height="400" radius="lg" shadow="lg" fit="cover"></bd-img>
178
+ `,
179
+ parameters: { docs: { description: { story: 'Combined `radius="lg"` and `shadow="lg"` for a polished card-style image.' } } }
605
180
  };
606
- HeaderImageExample.parameters = {
607
- docs: {
608
- description: {
609
- story: 'Example of a header image configuration with eager loading (for above-the-fold content), cover fit to fill the container, and descriptive alt text for accessibility.'
610
- }
611
- }
181
+
182
+ export const CircleImage = {
183
+ name : 'Circle Image (radius full)',
184
+ render: () => html`
185
+ <bd-img src="${sampleSrc}" alt="Avatar" width="200" height="200" radius="full" fit="cover"></bd-img>
186
+ `,
187
+ parameters: { docs: { description: { story: 'Equal width/height with `radius="full"` creates a circular avatar-style image.' } } }
612
188
  };
613
189
 
614
- export const InteractivePlayground = Template.bind({});
615
- InteractivePlayground.args = {
616
- src : '/assets/bd-header-us.jpg',
617
- alt : 'Customizable image example',
618
- width : 400,
619
- height : 250,
620
- loading: 'lazy',
621
- fit : 'cover',
622
- radius : 'none',
623
- shadow : 'none'
190
+ export const ErrorState = {
191
+ name : 'Error State (broken src)',
192
+ render: () => html`
193
+ <bd-img src="/nonexistent-image.png" alt="Broken image" width="400" height="300"></bd-img>
194
+ `,
195
+ parameters: { docs: { description: { story: 'Image with a broken `src`. The `image-error` custom event is dispatched. The browser renders its default broken image indicator.' } } }
624
196
  };
625
- InteractivePlayground.parameters = {
626
- docs: {
627
- description: {
628
- story: 'Interactive playground where you can test all image properties in real-time. Use the controls panel to modify the image source, dimensions, loading strategy, fit behavior, and styling options.'
629
- }
630
- }
197
+
198
+ export const Playground = {
199
+ name : '🛝 Playground',
200
+ args : { ...defaultArgs },
201
+ render,
202
+ parameters: { docs: { description: { story: 'Fully interactive. Adjust all props via Controls.' } } }
631
203
  };