@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.
- package/CHANGELOG.md +32 -0
- package/package.json +2 -3
- package/src/components/Button/button.stories.js +51 -51
- package/src/components/accordion/accordion-bg.css.js +168 -102
- package/src/components/accordion/accordion-bg.js +13 -5
- package/src/components/accordion/accordion-bg.stories.js +281 -0
- package/src/components/accordion/accordion-light.stories.js +241 -0
- package/src/components/anchor/anchor.stories.js +24 -22
- package/src/components/back/back.css.js +56 -0
- package/src/components/back/back.js +39 -0
- package/src/components/back/back.stories.js +184 -0
- package/src/components/badge/badge.css.js +44 -6
- package/src/components/badge/badge.js +40 -2
- package/src/components/badge/badge.stories.js +3 -10
- package/src/components/breadcrumb/breadcrumb.css.js +98 -0
- package/src/components/breadcrumb/breadcrumb.js +136 -0
- package/src/components/breadcrumb/breadcrumb.stories.js +109 -0
- package/src/components/cards/card.css.js +245 -0
- package/src/components/cards/card.js +80 -0
- package/src/components/cards/card.stories.js +512 -0
- package/src/components/carousel/carousel.css.js +51 -36
- package/src/components/carousel/carousel.js +0 -1
- package/src/components/carousel/carousel.stories.js +21 -17
- package/src/components/display/display.css.js +68 -0
- package/src/components/display/display.js +26 -0
- package/src/components/display/display.stories.js +339 -0
- package/src/components/divider/divider-horizontal.js +1 -1
- package/src/components/footer/footer-links-group.css.js +1 -1
- package/src/components/footer/footer-links-group.js +3 -3
- package/src/components/footer/footer-lp.stories.js +26 -61
- package/src/components/footer/footer-nav-menu.css.js +9 -10
- package/src/components/footer/footer.css.js +95 -8
- package/src/components/footer/footer.js +31 -65
- package/src/components/footer/footer.stories.js +165 -48
- package/src/components/header/header.js +11 -11
- package/src/components/header/header.stories.js +36 -4
- package/src/components/heading/heading.css.js +79 -0
- package/src/components/heading/heading.js +79 -0
- package/src/components/heading/heading.stories.js +260 -0
- package/src/components/highlight/highlight.stories.js +1 -1
- package/src/components/image/image.css.js +101 -0
- package/src/components/image/image.js +57 -0
- package/src/components/image/image.stories.js +245 -0
- package/src/components/light-carousel/light-carousel-simple.js +3 -2
- package/src/components/light-carousel/light-carousel.js +3 -7
- package/src/components/light-carousel/light-carousel.stories.js +15 -16
- package/src/components/link/link.css.js +107 -18
- package/src/components/link/link.js +16 -12
- package/src/components/link/link.stories.js +177 -0
- package/src/components/list/list-item/list-item.css.js +106 -0
- package/src/components/list/list-item/list-item.js +43 -0
- package/src/components/list/list-item/list-item.stories.js +79 -0
- package/src/components/list/list.css.js +175 -0
- package/src/components/list/list.js +44 -0
- package/src/components/modal/modal.js +6 -5
- package/src/components/paragraph/paragraph.css.js +41 -11
- package/src/components/paragraph/paragraph.js +7 -45
- package/src/components/paragraph/paragraph.stories.js +235 -0
- package/src/components/picture/picture.css.js +0 -0
- package/src/components/picture/picture.js +46 -0
- package/src/components/picture/picture.stories.js +275 -0
- package/src/components/pricing-cards/pricing-card-actions.js +1 -1
- package/src/components/pricing-cards/pricing-card-header.js +9 -7
- package/src/components/pricing-cards/pricing-card-pricing.js +11 -12
- package/src/components/pricing-cards/pricing-card.css.js +28 -3
- package/src/components/pricing-cards/pricing-card.js +38 -50
- package/src/components/tabs/tabs.js +44 -47
- package/src/components/termsOfUse/terms.js +77 -161
- package/src/components/termsOfUse/terms.stories.js +4 -3
- package/src/stories/Header.js +6 -6
- package/src/tokens/layout.css +3 -3
- package/src/tokens/tokens.css +0 -23
- package/src/tokens/tokens.stories.js +9 -8
- package/src/components/accordion/accordion-no-bg.css.js +0 -114
- package/src/components/accordion/accordion-no-bg.js +0 -80
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import './heading.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title : 'Atoms/Heading',
|
|
6
|
+
component: 'bd-h',
|
|
7
|
+
argTypes : {
|
|
8
|
+
kind: {
|
|
9
|
+
control : { type: 'select' },
|
|
10
|
+
options : ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
|
11
|
+
description: 'Heading level (h1-h6)'
|
|
12
|
+
},
|
|
13
|
+
content: {
|
|
14
|
+
control : 'text',
|
|
15
|
+
description: 'Heading text content'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: 'A customizable heading component with semantic HTML and consistent typography.'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const Template = ({ kind, content }) => html`
|
|
28
|
+
<bd-h as="${kind}">${content}</bd-h>
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const AllHeadings = () => html`
|
|
32
|
+
<div style="display: flex; flex-direction: column; gap: 2rem;">
|
|
33
|
+
<bd-h as="h1">Heading Level 1 - Main Title</bd-h>
|
|
34
|
+
<bd-h as="h2">Heading Level 2 - Section Title</bd-h>
|
|
35
|
+
<bd-h as="h3">Heading Level 3 - Subsection Title</bd-h>
|
|
36
|
+
<bd-h as="h4">Heading Level 4 - Card Title</bd-h>
|
|
37
|
+
<bd-h as="h5">Heading Level 5 - Small Heading</bd-h>
|
|
38
|
+
<bd-h as="h6">Heading Level 6 - Minor Heading</bd-h>
|
|
39
|
+
</div>
|
|
40
|
+
`;
|
|
41
|
+
AllHeadings.parameters = {
|
|
42
|
+
docs: {
|
|
43
|
+
description: {
|
|
44
|
+
story: 'All heading levels from h1 to h6 displayed together for comparison.'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Heading1 = Template.bind({});
|
|
50
|
+
Heading1.args = {
|
|
51
|
+
kind : 'h1',
|
|
52
|
+
content: 'Main Page Title (h1)'
|
|
53
|
+
};
|
|
54
|
+
Heading1.parameters = {
|
|
55
|
+
docs: {
|
|
56
|
+
description: {
|
|
57
|
+
story: 'Primary heading level for main page titles and important sections.'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Heading2 = Template.bind({});
|
|
63
|
+
Heading2.args = {
|
|
64
|
+
kind : 'h2',
|
|
65
|
+
content: 'Section Title (h2)'
|
|
66
|
+
};
|
|
67
|
+
Heading2.parameters = {
|
|
68
|
+
docs: {
|
|
69
|
+
description: {
|
|
70
|
+
story: 'Secondary heading level for major section titles.'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const Heading3 = Template.bind({});
|
|
76
|
+
Heading3.args = {
|
|
77
|
+
kind : 'h3',
|
|
78
|
+
content: 'Subsection Title (h3)'
|
|
79
|
+
};
|
|
80
|
+
Heading3.parameters = {
|
|
81
|
+
docs: {
|
|
82
|
+
description: {
|
|
83
|
+
story: 'Tertiary heading level for subsection titles and card headers.'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Heading4 = Template.bind({});
|
|
89
|
+
Heading4.args = {
|
|
90
|
+
kind : 'h4',
|
|
91
|
+
content: 'Card Title (h4)'
|
|
92
|
+
};
|
|
93
|
+
Heading4.parameters = {
|
|
94
|
+
docs: {
|
|
95
|
+
description: {
|
|
96
|
+
story: 'Heading level for card titles, feature names, and smaller sections.'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const Heading5 = Template.bind({});
|
|
102
|
+
Heading5.args = {
|
|
103
|
+
kind : 'h5',
|
|
104
|
+
content: 'Small Heading (h5)'
|
|
105
|
+
};
|
|
106
|
+
Heading5.parameters = {
|
|
107
|
+
docs: {
|
|
108
|
+
description: {
|
|
109
|
+
story: 'Small heading level for less important titles and labels.'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const Heading6 = Template.bind({});
|
|
115
|
+
Heading6.args = {
|
|
116
|
+
kind : 'h6',
|
|
117
|
+
content: 'Minor Heading (h6)'
|
|
118
|
+
};
|
|
119
|
+
Heading6.parameters = {
|
|
120
|
+
docs: {
|
|
121
|
+
description: {
|
|
122
|
+
story: 'Smallest heading level for minor titles and captions.'
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const WithParagraphs = () => html`
|
|
128
|
+
<div style="max-width: 800px; margin: 0 auto;">
|
|
129
|
+
<bd-h as="h1">Product Features</bd-h>
|
|
130
|
+
<bd-p kind="regular">Discover all the powerful features that make our product stand out from the competition.</bd-p>
|
|
131
|
+
|
|
132
|
+
<bd-h as="h2">Security Features</bd-h>
|
|
133
|
+
<bd-p kind="regular">Our advanced security features protect you from all types of online threats.</bd-p>
|
|
134
|
+
|
|
135
|
+
<bd-h as="h3">Real-time Protection</bd-h>
|
|
136
|
+
<bd-p kind="regular">Continuous monitoring and protection against emerging threats.</bd-p>
|
|
137
|
+
|
|
138
|
+
<bd-h as="h4">Behavioral Detection</bd-h>
|
|
139
|
+
<bd-p kind="regular">Advanced algorithms detect suspicious behavior patterns.</bd-p>
|
|
140
|
+
|
|
141
|
+
<bd-h as="h5">System Requirements</bd-h>
|
|
142
|
+
<bd-p kind="small">Windows 10/11, 2GB RAM, 2.5GB free space</bd-p>
|
|
143
|
+
</div>
|
|
144
|
+
`;
|
|
145
|
+
WithParagraphs.parameters = {
|
|
146
|
+
docs: {
|
|
147
|
+
description: {
|
|
148
|
+
story: 'Headings used in context with paragraph components to demonstrate proper hierarchy.'
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export const InCardLayout = () => html`
|
|
154
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; padding: 2rem;">
|
|
155
|
+
<div style="border: 1px solid #e2e8f0; border-radius: 8px; padding: 1.5rem;">
|
|
156
|
+
<bd-h as="h3">Advanced Protection</bd-h>
|
|
157
|
+
<bd-p kind="regular">Comprehensive security against malware, ransomware, and online threats.</bd-p>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div style="border: 1px solid #e2e8f0; border-radius: 8px; padding: 1.5rem;">
|
|
161
|
+
<bd-h as="h3">Privacy Features</bd-h>
|
|
162
|
+
<bd-p kind="regular">VPN, password manager, and webcam protection to keep your data safe.</bd-p>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<div style="border: 1px solid #e2e8f0; border-radius: 8px; padding: 1.5rem;">
|
|
166
|
+
<bd-h as="h3">Performance</bd-h>
|
|
167
|
+
<bd-p kind="regular">Lightweight design with minimal impact on system resources.</bd-p>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
`;
|
|
171
|
+
InCardLayout.parameters = {
|
|
172
|
+
docs: {
|
|
173
|
+
description: {
|
|
174
|
+
story: 'Headings used in card layouts to demonstrate real-world usage patterns.'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const AccessibilityExample = () => html`
|
|
180
|
+
<div style="max-width: 800px; margin: 0 auto;">
|
|
181
|
+
<bd-h as="h1">Accessibility Guidelines</bd-h>
|
|
182
|
+
<bd-p kind="regular">Proper heading hierarchy is essential for screen reader users and SEO.</bd-p>
|
|
183
|
+
|
|
184
|
+
<bd-h as="h2">Semantic Structure</bd-h>
|
|
185
|
+
<bd-p kind="regular">Headings should follow a logical hierarchy without skipping levels.</bd-p>
|
|
186
|
+
|
|
187
|
+
<bd-h as="h3">Best Practices</bd-h>
|
|
188
|
+
<bd-p kind="regular">Each page should have one h1, followed by h2, h3, etc. in order.</bd-p>
|
|
189
|
+
|
|
190
|
+
<bd-h as="h4">Screen Readers</bd-h>
|
|
191
|
+
<bd-p kind="regular">Users can navigate by headings to understand page structure quickly.</bd-p>
|
|
192
|
+
|
|
193
|
+
<bd-h as="h5">SEO Benefits</bd-h>
|
|
194
|
+
<bd-p kind="regular">Search engines use heading structure to understand content importance.</bd-p>
|
|
195
|
+
</div>
|
|
196
|
+
`;
|
|
197
|
+
AccessibilityExample.parameters = {
|
|
198
|
+
docs: {
|
|
199
|
+
description: {
|
|
200
|
+
story: 'Demonstrates proper semantic heading hierarchy for accessibility and SEO.'
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const ResponsiveExample = () => html`
|
|
206
|
+
<div style="max-width: 100%; padding: 2rem;">
|
|
207
|
+
<bd-h as="h1">Responsive Design</bd-h>
|
|
208
|
+
<bd-p kind="regular">This heading will adjust its size based on the viewport and CSS variables.</bd-p>
|
|
209
|
+
|
|
210
|
+
<div style="display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 2rem;">
|
|
211
|
+
<div style="flex: 1; min-width: 200px;">
|
|
212
|
+
<bd-h as="h3">Mobile First</bd-h>
|
|
213
|
+
<bd-p kind="small">Optimized for small screens with appropriate font sizes.</bd-p>
|
|
214
|
+
</div>
|
|
215
|
+
<div style="flex: 1; min-width: 200px;">
|
|
216
|
+
<bd-h as="h3">Tablet Ready</bd-h>
|
|
217
|
+
<bd-p kind="small">Scales perfectly for medium-sized devices.</bd-p>
|
|
218
|
+
</div>
|
|
219
|
+
<div style="flex: 1; min-width: 200px;">
|
|
220
|
+
<bd-h as="h3">Desktop Perfect</bd-h>
|
|
221
|
+
<bd-p kind="small">Looks great on large screens and monitors.</bd-p>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
`;
|
|
226
|
+
ResponsiveExample.parameters = {
|
|
227
|
+
docs: {
|
|
228
|
+
description: {
|
|
229
|
+
story: 'Shows how headings work in responsive layouts and different screen sizes.'
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export const InteractiveExample = () => {
|
|
235
|
+
const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
236
|
+
|
|
237
|
+
return html`
|
|
238
|
+
<div style="max-width: 800px; margin: 0 auto;">
|
|
239
|
+
<bd-h as="h2">Interactive Heading Demo</bd-h>
|
|
240
|
+
<bd-p kind="regular">Select different heading levels to see how they look:</bd-p>
|
|
241
|
+
|
|
242
|
+
${headings.map(kind => html`
|
|
243
|
+
<div style="margin: 2rem 0; padding: 1rem; border-left: 4px solid #3b82f6;">
|
|
244
|
+
<bd-h as="${kind}">This is a ${kind.toUpperCase()} heading</bd-h>
|
|
245
|
+
<bd-p kind="small" style="margin-top: 0.5rem;">
|
|
246
|
+
Font size: var(--typography-heading-${kind}-fontSize)<br>
|
|
247
|
+
Font weight: var(--typography-heading-${kind}-fontWeight)
|
|
248
|
+
</bd-p>
|
|
249
|
+
</div>
|
|
250
|
+
`)}
|
|
251
|
+
</div>
|
|
252
|
+
`;
|
|
253
|
+
};
|
|
254
|
+
InteractiveExample.parameters = {
|
|
255
|
+
docs: {
|
|
256
|
+
description: {
|
|
257
|
+
story: 'Interactive demonstration showing all heading levels with their CSS variable values.'
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
@layer bd-components {
|
|
5
|
+
.bd-img {
|
|
6
|
+
display: block;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
height: auto;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Object Fit Variants */
|
|
12
|
+
.bd-img.cover {
|
|
13
|
+
object-fit: cover;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.bd-img.contain {
|
|
17
|
+
object-fit: contain;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.bd-img.fill {
|
|
21
|
+
object-fit: fill;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.bd-img.none {
|
|
25
|
+
object-fit: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.bd-img.scale-down {
|
|
29
|
+
object-fit: scale-down;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Rounded Variants */
|
|
33
|
+
.bd-img.rounded {
|
|
34
|
+
border-radius: var(--spacing-8);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.bd-img.rounded-lg {
|
|
38
|
+
border-radius: var(--spacing-12);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.bd-img.rounded-full {
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Shadow Variants */
|
|
46
|
+
.bd-img.shadow {
|
|
47
|
+
box-shadow: var(--shadow-sm);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.bd-img.shadow-lg {
|
|
51
|
+
box-shadow: var(--shadow-lg);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.bd-img.shadow-xl {
|
|
55
|
+
box-shadow: var(--shadow-xl);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Border Variants */
|
|
59
|
+
.bd-img.bordered {
|
|
60
|
+
border: 2px solid var(--color-neutral-200);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.bd-img.bordered-primary {
|
|
64
|
+
border: 2px solid var(--color-blue-500);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.bd-img.bordered-thick {
|
|
68
|
+
border: 4px solid var(--color-neutral-300);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Responsive Behavior */
|
|
72
|
+
.bd-img.responsive {
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Aspect Ratio Containers */
|
|
78
|
+
.bd-img.aspect-16-9 {
|
|
79
|
+
aspect-ratio: 16 / 9;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.bd-img.aspect-4-3 {
|
|
83
|
+
aspect-ratio: 4 / 3;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.bd-img.aspect-1-1 {
|
|
87
|
+
aspect-ratio: 1 / 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Hover Effects */
|
|
91
|
+
.bd-img.hover-zoom:hover {
|
|
92
|
+
transform: scale(1.05);
|
|
93
|
+
transition: transform 0.3s ease;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.bd-img.hover-shadow:hover {
|
|
97
|
+
box-shadow: var(--shadow-lg);
|
|
98
|
+
transition: box-shadow 0.3s ease;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
`
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LitElement, html } from "lit";
|
|
2
|
+
import { tokens } from "../../tokens/tokens.js";
|
|
3
|
+
import imgCSS from "./image.css.js";
|
|
4
|
+
|
|
5
|
+
export class BdImg extends LitElement {
|
|
6
|
+
static properties = {
|
|
7
|
+
src : { type: String },
|
|
8
|
+
alt : { type: String },
|
|
9
|
+
width : { type: Number },
|
|
10
|
+
height : { type: Number },
|
|
11
|
+
loading: { type: String },
|
|
12
|
+
fit : { type: String }
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.src = "";
|
|
18
|
+
this.alt = "";
|
|
19
|
+
this.width = null;
|
|
20
|
+
this.height = null;
|
|
21
|
+
this.loading = "lazy";
|
|
22
|
+
this.fit = "cover";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
return html`
|
|
27
|
+
<img
|
|
28
|
+
src="${this.src}"
|
|
29
|
+
alt="${this.alt}"
|
|
30
|
+
width="${this.width}"
|
|
31
|
+
height="${this.height}"
|
|
32
|
+
loading="${this.loading}"
|
|
33
|
+
class="bd-img ${this.fit}"
|
|
34
|
+
@load="${this._handleLoad}"
|
|
35
|
+
@error="${this._handleError}"
|
|
36
|
+
/>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_handleLoad() {
|
|
41
|
+
this.dispatchEvent(new CustomEvent('image-loaded', {
|
|
42
|
+
bubbles : true,
|
|
43
|
+
composed: true
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_handleError() {
|
|
48
|
+
this.dispatchEvent(new CustomEvent('image-error', {
|
|
49
|
+
bubbles : true,
|
|
50
|
+
composed: true
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static styles = [tokens, imgCSS];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
customElements.define("bd-img", BdImg);
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import '../heading/heading.js';
|
|
3
|
+
import './image.js';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title : 'Atoms/Image',
|
|
7
|
+
component: 'bd-img',
|
|
8
|
+
argTypes : {
|
|
9
|
+
src: {
|
|
10
|
+
control : 'text',
|
|
11
|
+
description: 'Image source URL'
|
|
12
|
+
},
|
|
13
|
+
alt: {
|
|
14
|
+
control : 'text',
|
|
15
|
+
description: 'Alt text for accessibility'
|
|
16
|
+
},
|
|
17
|
+
width: {
|
|
18
|
+
control : 'number',
|
|
19
|
+
description: 'Image width'
|
|
20
|
+
},
|
|
21
|
+
height: {
|
|
22
|
+
control : 'number',
|
|
23
|
+
description: 'Image height'
|
|
24
|
+
},
|
|
25
|
+
loading: {
|
|
26
|
+
control : { type: 'select' },
|
|
27
|
+
options : ['lazy', 'eager'],
|
|
28
|
+
description: 'Loading strategy'
|
|
29
|
+
},
|
|
30
|
+
fit: {
|
|
31
|
+
control : { type: 'select' },
|
|
32
|
+
options : ['cover', 'contain', 'fill', 'none', 'scale-down'],
|
|
33
|
+
description: 'Object fit property'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
parameters: {
|
|
37
|
+
docs: {
|
|
38
|
+
description: {
|
|
39
|
+
component: 'A simple image component with enhanced styling and event handling.'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const Template = (args) => html`
|
|
46
|
+
<bd-img
|
|
47
|
+
src="${args.src}"
|
|
48
|
+
alt="${args.alt}"
|
|
49
|
+
width="${args.width}"
|
|
50
|
+
height="${args.height}"
|
|
51
|
+
loading="${args.loading}"
|
|
52
|
+
fit="${args.fit}"
|
|
53
|
+
></bd-img>
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
export const Default = Template.bind({});
|
|
57
|
+
Default.args = {
|
|
58
|
+
src : '/assets/bd-header-us.jpg',
|
|
59
|
+
alt : 'Bitdefender Security Illustration',
|
|
60
|
+
width : 750,
|
|
61
|
+
height : 500,
|
|
62
|
+
loading: 'lazy',
|
|
63
|
+
fit : 'cover'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const HeaderImageExample = Template.bind({});
|
|
67
|
+
HeaderImageExample.args = {
|
|
68
|
+
src : '/assets/bd-header-us.jpg',
|
|
69
|
+
alt : 'Bitdefender Ultimate Security Header',
|
|
70
|
+
width : 750,
|
|
71
|
+
height : 500,
|
|
72
|
+
loading: 'eager',
|
|
73
|
+
fit : 'cover'
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const ObjectFitExamples = () => html`
|
|
77
|
+
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; max-width: 800px;">
|
|
78
|
+
<div>
|
|
79
|
+
<bd-h as="h4">Cover</bd-h>
|
|
80
|
+
<bd-img
|
|
81
|
+
src="/assets/bd-header-us.jpg"
|
|
82
|
+
alt="Cover fit example"
|
|
83
|
+
width="200"
|
|
84
|
+
height="200"
|
|
85
|
+
fit="cover"
|
|
86
|
+
></bd-img>
|
|
87
|
+
<p style="font-size: 0.875rem; color: #666; margin-top: 0.5rem;">
|
|
88
|
+
Fills container, may crop - perfect for headers
|
|
89
|
+
</p>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div>
|
|
93
|
+
<bd-h as="h4">Contain</bd-h>
|
|
94
|
+
<bd-img
|
|
95
|
+
src="/assets/bd-header-us.jpg"
|
|
96
|
+
alt="Contain fit example"
|
|
97
|
+
width="200"
|
|
98
|
+
height="200"
|
|
99
|
+
fit="contain"
|
|
100
|
+
></bd-img>
|
|
101
|
+
<p style="font-size: 0.875rem; color: #666; margin-top: 0.5rem;">
|
|
102
|
+
Fits entirely, may have empty space
|
|
103
|
+
</p>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div>
|
|
107
|
+
<bd-h as="h4">Fill</bd-h>
|
|
108
|
+
<bd-img
|
|
109
|
+
src="/assets/bd-header-us.jpg"
|
|
110
|
+
alt="Fill fit example"
|
|
111
|
+
width="200"
|
|
112
|
+
height="200"
|
|
113
|
+
fit="fill"
|
|
114
|
+
></bd-img>
|
|
115
|
+
<p style="font-size: 0.875rem; color: #666; margin-top: 0.5rem;">
|
|
116
|
+
Stretches to fill container - may distort
|
|
117
|
+
</p>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<div>
|
|
121
|
+
<bd-h as="h4">Scale Down</bd-h>
|
|
122
|
+
<bd-img
|
|
123
|
+
src="/assets/bd-header-us.jpg"
|
|
124
|
+
alt="Scale down fit example"
|
|
125
|
+
width="200"
|
|
126
|
+
height="200"
|
|
127
|
+
fit="scale-down"
|
|
128
|
+
></bd-img>
|
|
129
|
+
<p style="font-size: 0.875rem; color: #666; margin-top: 0.5rem;">
|
|
130
|
+
Like contain, but never scales up
|
|
131
|
+
</p>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
export const StylingVariants = () => html`
|
|
137
|
+
<div style="display: flex; flex-wrap: wrap; gap: 2rem; align-items: start;">
|
|
138
|
+
<div style="text-align: center;">
|
|
139
|
+
<bd-h as="h4">Rounded</bd-h>
|
|
140
|
+
<bd-img
|
|
141
|
+
src="/assets/bd-header-us.jpg"
|
|
142
|
+
alt="Rounded security image"
|
|
143
|
+
width="150"
|
|
144
|
+
height="100"
|
|
145
|
+
fit="cover"
|
|
146
|
+
class="rounded"
|
|
147
|
+
></bd-img>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<div style="text-align: center;">
|
|
151
|
+
<bd-h as="h4">With Shadow</bd-h>
|
|
152
|
+
<bd-img
|
|
153
|
+
src="/assets/bd-header-us.jpg"
|
|
154
|
+
alt="Image with shadow"
|
|
155
|
+
width="150"
|
|
156
|
+
height="100"
|
|
157
|
+
fit="cover"
|
|
158
|
+
class="shadow-lg"
|
|
159
|
+
></bd-img>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div style="text-align: center;">
|
|
163
|
+
<bd-h as="h4">Bordered</bd-h>
|
|
164
|
+
<bd-img
|
|
165
|
+
src="/assets/bd-header-us.jpg"
|
|
166
|
+
alt="Bordered image"
|
|
167
|
+
width="150"
|
|
168
|
+
height="100"
|
|
169
|
+
fit="cover"
|
|
170
|
+
class="bordered-primary"
|
|
171
|
+
></bd-img>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
`;
|
|
175
|
+
|
|
176
|
+
export const LoadingExamples = () => html`
|
|
177
|
+
<div style="display: flex; flex-direction: column; gap: 2rem; max-width: 600px;">
|
|
178
|
+
<div>
|
|
179
|
+
<bd-h as="h4">Lazy Loading</bd-h>
|
|
180
|
+
<bd-img
|
|
181
|
+
src="/assets/bd-header-us.jpg"
|
|
182
|
+
alt="Lazy loaded security image"
|
|
183
|
+
width="400"
|
|
184
|
+
height="250"
|
|
185
|
+
loading="lazy"
|
|
186
|
+
fit="cover"
|
|
187
|
+
></bd-img>
|
|
188
|
+
<p style="font-size: 0.875rem; color: #666; margin-top: 0.5rem;">
|
|
189
|
+
Loads when image enters viewport - better for performance
|
|
190
|
+
</p>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div>
|
|
194
|
+
<bd-h as="h4">Eager Loading</bd-h>
|
|
195
|
+
<bd-img
|
|
196
|
+
src="/assets/bd-header-us.jpg"
|
|
197
|
+
alt="Eager loaded security image"
|
|
198
|
+
width="400"
|
|
199
|
+
height="250"
|
|
200
|
+
loading="eager"
|
|
201
|
+
fit="cover"
|
|
202
|
+
></bd-img>
|
|
203
|
+
<p style="font-size: 0.875rem; color: #666; margin-top: 0.5rem;">
|
|
204
|
+
Loads immediately - use for header images
|
|
205
|
+
</p>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
`;
|
|
209
|
+
|
|
210
|
+
export const ResponsiveSizes = () => html`
|
|
211
|
+
<div style="display: flex; flex-direction: column; gap: 2rem; max-width: 800px;">
|
|
212
|
+
<div>
|
|
213
|
+
<bd-h as="h4">Small (400px)</bd-h>
|
|
214
|
+
<bd-img
|
|
215
|
+
src="/assets/bd-header-us.jpg"
|
|
216
|
+
alt="Small security image"
|
|
217
|
+
width="400"
|
|
218
|
+
height="250"
|
|
219
|
+
fit="cover"
|
|
220
|
+
></bd-img>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<div>
|
|
224
|
+
<bd-h as="h4">Medium (600px)</bd-h>
|
|
225
|
+
<bd-img
|
|
226
|
+
src="/assets/bd-header-us.jpg"
|
|
227
|
+
alt="Medium security image"
|
|
228
|
+
width="600"
|
|
229
|
+
height="375"
|
|
230
|
+
fit="cover"
|
|
231
|
+
></bd-img>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div>
|
|
235
|
+
<bd-h as="h4">Large (750px - Original)</bd-h>
|
|
236
|
+
<bd-img
|
|
237
|
+
src="/assets/bd-header-us.jpg"
|
|
238
|
+
alt="Large security image"
|
|
239
|
+
width="750"
|
|
240
|
+
height="500"
|
|
241
|
+
fit="cover"
|
|
242
|
+
></bd-img>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html } from "lit";
|
|
2
2
|
import { tokens } from "../../tokens/tokens.js";
|
|
3
|
+
import "../heading/heading.js";
|
|
3
4
|
import carouselCSS from "../light-carousel/light-carousel-simple.css.js";
|
|
4
5
|
|
|
5
6
|
class CustomLightCarouselSimple extends LitElement {
|
|
@@ -56,7 +57,7 @@ class LightCarouselSimpleItem extends LitElement {
|
|
|
56
57
|
${this.title
|
|
57
58
|
? html`
|
|
58
59
|
<div class="bd-light-title-badge-wrapper-s">
|
|
59
|
-
<
|
|
60
|
+
<bd-h as="h4">${this.title}</bd-h>
|
|
60
61
|
</div>
|
|
61
62
|
`
|
|
62
63
|
: ""}
|
|
@@ -70,4 +71,4 @@ CustomLightCarouselSimple.styles = [tokens, carouselCSS];
|
|
|
70
71
|
LightCarouselSimpleItem.styles = [tokens, carouselCSS];
|
|
71
72
|
|
|
72
73
|
customElements.define("bd-light-carousel-simple-item", LightCarouselSimpleItem);
|
|
73
|
-
customElements.define("bd-light-carousel-simple-section", CustomLightCarouselSimple);
|
|
74
|
+
customElements.define("bd-light-carousel-simple-section", CustomLightCarouselSimple);
|