@repobit/dex-system-design 0.20.0 → 0.21.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.
- package/CHANGELOG.md +17 -0
- package/package.json +7 -2
- package/src/components/Button/button.stories.js +51 -51
- package/src/components/accordion/accordion-bg.css.js +141 -123
- package/src/components/accordion/accordion-bg.stories.js +102 -72
- package/src/components/accordion/accordion-light.stories.js +78 -53
- 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.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.js +2 -1
- package/src/components/cards/card.stories.js +49 -49
- package/src/components/carousel/carousel.css.js +8 -1
- 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.js +3 -3
- package/src/components/footer/footer-lp.stories.js +0 -1
- package/src/components/footer/footer.css.js +0 -6
- package/src/components/footer/footer.js +21 -41
- package/src/components/footer/footer.stories.js +0 -1
- 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 +12 -13
- 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-header.js +9 -7
- package/src/components/pricing-cards/pricing-card-pricing.js +11 -12
- package/src/components/pricing-cards/pricing-card.js +37 -36
- 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/tokens.stories.js +9 -8
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
@layer bd-components {
|
|
5
|
+
.bd-back {
|
|
6
|
+
all: unset;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 0.5rem;
|
|
10
|
+
padding: 0.75rem 1rem;
|
|
11
|
+
font-family: var(--typography-fontFamily-sans);
|
|
12
|
+
font-size: var(--typography-body-regular-fontSize);
|
|
13
|
+
font-weight: var(--typography-fontWeight-bold);
|
|
14
|
+
color: var(--color-neutral-1000);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
border-radius: 0.5rem;
|
|
17
|
+
transition: all 0.2s ease;
|
|
18
|
+
user-select: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.bd-back:hover {
|
|
22
|
+
background-color: var(--color-neutral-100);
|
|
23
|
+
color: var(--color-neutral-1000);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.bd-back:active {
|
|
27
|
+
background-color: var(--color-neutral-200);
|
|
28
|
+
transform: translateY(1px);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.bd-back:focus-visible {
|
|
32
|
+
outline: 2px solid var(--color-neutral-1000);
|
|
33
|
+
outline-offset: 2px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.bd-back-arrow {
|
|
37
|
+
font-size: 1.125em;
|
|
38
|
+
font-weight: var(--typography-fontWeight-bold);
|
|
39
|
+
/* Săgeată mai simplă și mai groasă */
|
|
40
|
+
transform: scale(1.2);
|
|
41
|
+
letter-spacing: -0.05em;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.bd-back-label {
|
|
45
|
+
line-height: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Mobile-first responsive */
|
|
49
|
+
@media (max-width: 768px) {
|
|
50
|
+
.bd-back {
|
|
51
|
+
padding: 0.875rem 1rem;
|
|
52
|
+
font-size: var(--typography-body-large-fontSize);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LitElement, html } from "lit";
|
|
2
|
+
import { tokens } from "../../tokens/tokens.js";
|
|
3
|
+
import backCSS from "./back.css.js";
|
|
4
|
+
|
|
5
|
+
export class BdBack extends LitElement {
|
|
6
|
+
static properties = {
|
|
7
|
+
href : { type: String },
|
|
8
|
+
label: { type: String }
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.href = "";
|
|
14
|
+
this.label = "Back";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
handleClick() {
|
|
18
|
+
if (this.href) {
|
|
19
|
+
window.location.href = this.href;
|
|
20
|
+
} else {
|
|
21
|
+
window.history.back();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
return html`
|
|
27
|
+
<button class="bd-back" @click="${this.handleClick}">
|
|
28
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="mi-solid mi-arrow-back" viewBox="0 0 24 24">
|
|
29
|
+
<path d="M19 11H7.83l4.88-4.88c.39-.39.39-1.03 0-1.42a.996.996 0 0 0-1.41 0l-6.59 6.59a.996.996 0 0 0 0 1.41l6.59 6.59a.996.996 0 1 0 1.41-1.41L7.83 13H19c.55 0 1-.45 1-1s-.45-1-1-1"/>
|
|
30
|
+
</svg>
|
|
31
|
+
<span class="bd-back-label">${this.label}</span>
|
|
32
|
+
</button>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static styles = [tokens, backCSS];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
customElements.define("bd-back", BdBack);
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import '../heading/heading.js';
|
|
3
|
+
import './back.js';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title : 'Components/Back',
|
|
7
|
+
component: 'bd-back',
|
|
8
|
+
argTypes : {
|
|
9
|
+
label: {
|
|
10
|
+
control : 'text',
|
|
11
|
+
description: 'Back button label'
|
|
12
|
+
},
|
|
13
|
+
href: {
|
|
14
|
+
control : 'text',
|
|
15
|
+
description: 'Optional href for specific navigation'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: 'A simple, mobile-inspired back button component with bold black styling for intuitive navigation.'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const Template = ({ label, href }) => html`
|
|
28
|
+
<bd-back label="${label}" href="${href}"></bd-back>
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const Default = Template.bind({});
|
|
32
|
+
Default.args = {
|
|
33
|
+
label: 'Back'
|
|
34
|
+
};
|
|
35
|
+
Default.parameters = {
|
|
36
|
+
docs: {
|
|
37
|
+
description: {
|
|
38
|
+
story: 'Default back button with bold black styling that uses browser history back() when clicked.'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const CustomLabel = Template.bind({});
|
|
44
|
+
CustomLabel.args = {
|
|
45
|
+
label: 'Înapoi'
|
|
46
|
+
};
|
|
47
|
+
CustomLabel.parameters = {
|
|
48
|
+
docs: {
|
|
49
|
+
description: {
|
|
50
|
+
story: 'Back button with custom label and bold black styling for localization or specific contexts.'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const WithHref = Template.bind({});
|
|
56
|
+
WithHref.args = {
|
|
57
|
+
label: 'Back to Home',
|
|
58
|
+
href : '/home'
|
|
59
|
+
};
|
|
60
|
+
WithHref.parameters = {
|
|
61
|
+
docs: {
|
|
62
|
+
description: {
|
|
63
|
+
story: 'Back button with bold black styling that navigates to a specific URL when provided with href.'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const MobileContext = () => html`
|
|
69
|
+
<div style="max-width: 400px; margin: 0 auto; padding: 1rem; background: #f8fafc; min-height: 100vh;">
|
|
70
|
+
<div style="margin-bottom: 2rem;">
|
|
71
|
+
<bd-back label="Back"></bd-back>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div style="background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">
|
|
75
|
+
<bd-h as="h2" style="margin-bottom: 1rem;">Product Details</bd-h>
|
|
76
|
+
<bd-p kind="regular" style="margin-bottom: 1rem;">
|
|
77
|
+
This is a mobile-style page layout with the bold black back button at the top, following mobile navigation patterns.
|
|
78
|
+
</bd-p>
|
|
79
|
+
<bd-p kind="small" style="color: #64748b;">
|
|
80
|
+
Tap the back button to return to the previous screen.
|
|
81
|
+
</bd-p>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
`;
|
|
85
|
+
MobileContext.parameters = {
|
|
86
|
+
docs: {
|
|
87
|
+
description: {
|
|
88
|
+
story: 'Bold black back button used in a mobile-style layout context, demonstrating the mobile paradigm with strong visual hierarchy.'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const MultipleVariants = () => html`
|
|
94
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; max-width: 300px;">
|
|
95
|
+
<bd-back label="Back"></bd-back>
|
|
96
|
+
<bd-back label="Înapoi"></bd-back>
|
|
97
|
+
<bd-back label="Back to Products" href="/products"></bd-back>
|
|
98
|
+
<bd-back label="← Back" style="font-size: 0.9rem;"></bd-back>
|
|
99
|
+
</div>
|
|
100
|
+
`;
|
|
101
|
+
MultipleVariants.parameters = {
|
|
102
|
+
docs: {
|
|
103
|
+
description: {
|
|
104
|
+
story: 'Different variants of the bold black back button showing various use cases and labels.'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const OnLightBackground = () => html`
|
|
110
|
+
<div style="background: white; padding: 2rem;">
|
|
111
|
+
<bd-back label="Back"></bd-back>
|
|
112
|
+
<bd-p kind="small" style="margin-top: 1rem; color: #64748b;">
|
|
113
|
+
Bold black back button on light background for maximum contrast and visibility.
|
|
114
|
+
</bd-p>
|
|
115
|
+
</div>
|
|
116
|
+
`;
|
|
117
|
+
OnLightBackground.parameters = {
|
|
118
|
+
docs: {
|
|
119
|
+
description: {
|
|
120
|
+
story: 'Back button with bold black styling on light background, ensuring high contrast and clear visibility.'
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const OnDarkBackground = () => html`
|
|
126
|
+
<div style="background: #1e293b; padding: 2rem;">
|
|
127
|
+
<bd-back label="Back"></bd-back>
|
|
128
|
+
<bd-p kind="small" style="margin-top: 1rem; color: #cbd5e1;">
|
|
129
|
+
Bold black back button on dark background maintains its strong visual presence.
|
|
130
|
+
</bd-p>
|
|
131
|
+
</div>
|
|
132
|
+
`;
|
|
133
|
+
OnDarkBackground.parameters = {
|
|
134
|
+
docs: {
|
|
135
|
+
description: {
|
|
136
|
+
story: 'Back button with bold black styling on dark background, demonstrating its versatility across different backgrounds.'
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const InteractiveDemo = () => {
|
|
142
|
+
return html`
|
|
143
|
+
<div style="max-width: 600px; margin: 0 auto;">
|
|
144
|
+
<bd-h as="h2" style="margin-bottom: 2rem;">Bold Black Back Button Demo</bd-h>
|
|
145
|
+
|
|
146
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;">
|
|
147
|
+
<div>
|
|
148
|
+
<bd-h as="h3" style="margin-bottom: 1rem;">Standard Usage</bd-h>
|
|
149
|
+
<bd-back label="Back"></bd-back>
|
|
150
|
+
<bd-p kind="small" style="margin-top: 0.5rem;">
|
|
151
|
+
Uses browser history back()<br>
|
|
152
|
+
Color: var(--color-neutral-1000)<br>
|
|
153
|
+
Font-weight: var(--typography-fontWeight-bold)
|
|
154
|
+
</bd-p>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div>
|
|
158
|
+
<bd-h as="h3" style="margin-bottom: 1rem;">With Href</bd-h>
|
|
159
|
+
<bd-back label="Go Home" href="#home"></bd-back>
|
|
160
|
+
<bd-p kind="small" style="margin-top: 0.5rem;">
|
|
161
|
+
Navigates to specific URL<br>
|
|
162
|
+
Same bold black styling
|
|
163
|
+
</bd-p>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<bd-p kind="regular" style="margin-top: 2rem;">
|
|
168
|
+
<strong>Design Features:</strong><br>
|
|
169
|
+
• Bold black color for maximum visibility<br>
|
|
170
|
+
• Strong font weight for clear hierarchy<br>
|
|
171
|
+
• Large touch target for mobile use<br>
|
|
172
|
+
• Clean, minimalist design<br>
|
|
173
|
+
• Consistent with mobile navigation patterns
|
|
174
|
+
</bd-p>
|
|
175
|
+
</div>
|
|
176
|
+
`;
|
|
177
|
+
};
|
|
178
|
+
InteractiveDemo.parameters = {
|
|
179
|
+
docs: {
|
|
180
|
+
description: {
|
|
181
|
+
story: 'Interactive demonstration of the bold black back button component with mobile-first design principles and strong visual hierarchy.'
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
|
+
import '../heading/heading.js';
|
|
2
3
|
import './badge.js';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
@@ -49,7 +50,6 @@ export default {
|
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
// Template principal
|
|
53
53
|
const Template = ({ children, color, variant, size, fontsize }) => html`
|
|
54
54
|
<bd-badge
|
|
55
55
|
color="${color}"
|
|
@@ -61,17 +61,15 @@ const Template = ({ children, color, variant, size, fontsize }) => html`
|
|
|
61
61
|
</bd-badge>
|
|
62
62
|
`;
|
|
63
63
|
|
|
64
|
-
// Template pentru grid cu multiple badge-uri
|
|
65
64
|
const GridTemplate = (items) => html`
|
|
66
65
|
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px;">
|
|
67
66
|
${items}
|
|
68
67
|
</div>
|
|
69
68
|
`;
|
|
70
69
|
|
|
71
|
-
// Template pentru secțiune cu titlu
|
|
72
70
|
const SectionTemplate = (title, items) => html`
|
|
73
71
|
<div style="margin-bottom: 32px;">
|
|
74
|
-
<h3 style="margin-bottom: 16px; color: #333;">${title}</
|
|
72
|
+
<bd-h as="h3" style="margin-bottom: 16px; color: #333;">${title}</bd-h>
|
|
75
73
|
${GridTemplate(items)}
|
|
76
74
|
</div>
|
|
77
75
|
`;
|
|
@@ -166,9 +164,6 @@ export const CustomColors = () => {
|
|
|
166
164
|
);
|
|
167
165
|
};
|
|
168
166
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// Setări pentru fiecare story
|
|
172
167
|
AllVariants.parameters = {
|
|
173
168
|
docs: {
|
|
174
169
|
description: {
|
|
@@ -199,6 +194,4 @@ Combinations.parameters = {
|
|
|
199
194
|
story: 'Diverse combinații între variante și dimensiuni.'
|
|
200
195
|
}
|
|
201
196
|
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
|
|
197
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
@layer bd-components {
|
|
5
|
+
.bd-breadcrumb {
|
|
6
|
+
font-family: var(--typography-fontFamily-sans);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.bd-breadcrumb__items {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
gap: 0;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Item container */
|
|
19
|
+
.bd-breadcrumb-item {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Horizontal layout */
|
|
25
|
+
.bd-breadcrumb--horizontal .bd-breadcrumb__items {
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.bd-breadcrumb--horizontal .bd-breadcrumb-item:not(:last-child) {
|
|
30
|
+
margin-right: var(--spacing-8);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Divider styles */
|
|
34
|
+
.bd-breadcrumb__divider {
|
|
35
|
+
margin-left: var(--spacing-8);
|
|
36
|
+
margin-right: var(--spacing-8);
|
|
37
|
+
color: var(--color-neutral-400);
|
|
38
|
+
font-size: var(--typography-fontSize-sm);
|
|
39
|
+
line-height: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Vertical layout */
|
|
43
|
+
.bd-breadcrumb--vertical .bd-breadcrumb__items {
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: stretch;
|
|
46
|
+
gap: var(--spacing-4);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.bd-breadcrumb--vertical .bd-breadcrumb__divider {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Item styles */
|
|
54
|
+
.bd-breadcrumb__item {
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
text-decoration: none;
|
|
58
|
+
color: inherit;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Link styles */
|
|
62
|
+
bd-link.bd-breadcrumb__item {
|
|
63
|
+
color: var(--color-blue-400);
|
|
64
|
+
text-decoration: none;
|
|
65
|
+
transition: all 0.15s ease-in-out;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
bd-link.bd-breadcrumb__item:hover {
|
|
69
|
+
color: var(--color-blue-700);
|
|
70
|
+
text-decoration: underline;
|
|
71
|
+
text-underline-offset: 2px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Vertical item styles */
|
|
75
|
+
.bd-breadcrumb--vertical .bd-breadcrumb__item {
|
|
76
|
+
padding: var(--spacing-8) var(--spacing-12);
|
|
77
|
+
background: var(--color-neutral-50);
|
|
78
|
+
border-radius: var(--spacing-4);
|
|
79
|
+
width: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.bd-breadcrumb--vertical bd-link.bd-breadcrumb__item:hover {
|
|
83
|
+
background: var(--color-neutral-100);
|
|
84
|
+
text-decoration: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Current item styles */
|
|
88
|
+
.bd-breadcrumb__item--current {
|
|
89
|
+
color: var(--color-neutral-900);
|
|
90
|
+
font-weight: var(--typography-fontWeight-medium);
|
|
91
|
+
cursor: default;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.bd-breadcrumb--vertical .bd-breadcrumb__item--current {
|
|
95
|
+
background: var(--color-neutral-100);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import { tokens } from '../../tokens/tokens.js';
|
|
3
|
+
import '../link/link.js';
|
|
4
|
+
import '../paragraph/paragraph.js';
|
|
5
|
+
import breadcrumbCSS from './breadcrumb.css.js';
|
|
6
|
+
|
|
7
|
+
export class Breadcrumb extends LitElement {
|
|
8
|
+
static properties = {
|
|
9
|
+
noTrailingSlash : { type: Boolean, attribute: 'no-trailing-slash' },
|
|
10
|
+
mobileBreakpoint: { type: Number, attribute: 'mobile-breakpoint' },
|
|
11
|
+
_isMobile : { type: Boolean, state: true }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.noTrailingSlash = false;
|
|
17
|
+
this.mobileBreakpoint = 768;
|
|
18
|
+
this._isMobile = false;
|
|
19
|
+
this._resizeObserver = null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
firstUpdated() {
|
|
23
|
+
this._checkMobile();
|
|
24
|
+
this._setupResizeListener();
|
|
25
|
+
this._updateChildItems();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
updated(changedProperties) {
|
|
29
|
+
if (changedProperties.has('noTrailingSlash')) {
|
|
30
|
+
this._updateChildItems();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_updateChildItems() {
|
|
35
|
+
const slot = this.shadowRoot?.querySelector('slot');
|
|
36
|
+
if (!slot) return;
|
|
37
|
+
|
|
38
|
+
const items = slot.assignedElements({ flatten: true });
|
|
39
|
+
items.forEach(item => {
|
|
40
|
+
if (item.updateNoTrailingSlash) {
|
|
41
|
+
item.updateNoTrailingSlash(this.noTrailingSlash);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_checkMobile() {
|
|
47
|
+
this._isMobile = window.innerWidth <= this.mobileBreakpoint;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_setupResizeListener() {
|
|
51
|
+
let resizeTimeout;
|
|
52
|
+
const handleResize = () => {
|
|
53
|
+
clearTimeout(resizeTimeout);
|
|
54
|
+
resizeTimeout = setTimeout(() => {
|
|
55
|
+
const wasMobile = this._isMobile;
|
|
56
|
+
this._checkMobile();
|
|
57
|
+
if (wasMobile !== this._isMobile) {
|
|
58
|
+
this.requestUpdate();
|
|
59
|
+
}
|
|
60
|
+
}, 100);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
window.addEventListener('resize', handleResize);
|
|
64
|
+
this._resizeObserver = handleResize;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
disconnectedCallback() {
|
|
68
|
+
if (this._resizeObserver) {
|
|
69
|
+
window.removeEventListener('resize', this._resizeObserver);
|
|
70
|
+
}
|
|
71
|
+
super.disconnectedCallback();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
render() {
|
|
75
|
+
const orientation = this._isMobile ? 'vertical' : 'horizontal';
|
|
76
|
+
|
|
77
|
+
return html`
|
|
78
|
+
<nav class="bd-breadcrumb bd-breadcrumb--${orientation}"
|
|
79
|
+
aria-label="Breadcrumb">
|
|
80
|
+
<div class="bd-breadcrumb__items">
|
|
81
|
+
<slot></slot>
|
|
82
|
+
</div>
|
|
83
|
+
</nav>
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static styles = [tokens, breadcrumbCSS];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export class BreadcrumbItem extends LitElement {
|
|
91
|
+
static properties = {
|
|
92
|
+
href : { type: String },
|
|
93
|
+
current : { type: Boolean, reflect: true },
|
|
94
|
+
noTrailingSlash: { type: Boolean }
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
constructor() {
|
|
98
|
+
super();
|
|
99
|
+
this.href = '';
|
|
100
|
+
this.current = false;
|
|
101
|
+
this.noTrailingSlash = false;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
updateNoTrailingSlash(value) {
|
|
105
|
+
this.noTrailingSlash = value;
|
|
106
|
+
this.requestUpdate();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
render() {
|
|
110
|
+
const showDivider = !this.current && !this.noTrailingSlash;
|
|
111
|
+
|
|
112
|
+
const content = this.current
|
|
113
|
+
? html`<span class="bd-breadcrumb__item bd-breadcrumb__item--current" aria-current="page">
|
|
114
|
+
<bd-p kind="small"><slot></slot></bd-p>
|
|
115
|
+
</span>`
|
|
116
|
+
: this.href
|
|
117
|
+
? html`<bd-link href="${this.href}" size="small" class="bd-breadcrumb__item">
|
|
118
|
+
<slot></slot>
|
|
119
|
+
</bd-link>`
|
|
120
|
+
: html`<span class="bd-breadcrumb__item">
|
|
121
|
+
<bd-p kind="small"><slot></slot></bd-p>
|
|
122
|
+
</span>`;
|
|
123
|
+
|
|
124
|
+
return html`
|
|
125
|
+
<div class="bd-breadcrumb-item">
|
|
126
|
+
${content}
|
|
127
|
+
${showDivider ? html`<span class="bd-breadcrumb__divider">/</span>` : ''}
|
|
128
|
+
</div>
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static styles = [tokens, breadcrumbCSS];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
customElements.define('bd-breadcrumb', Breadcrumb);
|
|
136
|
+
customElements.define('bd-breadcrumb-item', BreadcrumbItem);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import './breadcrumb.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title : 'Components/Breadcrumb',
|
|
6
|
+
component : 'bd-breadcrumb',
|
|
7
|
+
subcomponents: { 'BreadcrumbItem': 'bd-breadcrumb-item' },
|
|
8
|
+
parameters : {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'A navigation component that shows the current page location within a hierarchy.'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Default = () => html`
|
|
18
|
+
<bd-breadcrumb>
|
|
19
|
+
<bd-breadcrumb-item href="/">
|
|
20
|
+
Home
|
|
21
|
+
</bd-breadcrumb-item>
|
|
22
|
+
<bd-breadcrumb-item href="/products">
|
|
23
|
+
Products
|
|
24
|
+
</bd-breadcrumb-item>
|
|
25
|
+
<bd-breadcrumb-item href="/products/security">
|
|
26
|
+
Security
|
|
27
|
+
</bd-breadcrumb-item>
|
|
28
|
+
<bd-breadcrumb-item current>
|
|
29
|
+
Bitdefender Total Security
|
|
30
|
+
</bd-breadcrumb-item>
|
|
31
|
+
</bd-breadcrumb>
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export const WithNestedLinks = () => html`
|
|
35
|
+
<bd-breadcrumb>
|
|
36
|
+
<bd-breadcrumb-item href="/">
|
|
37
|
+
Home
|
|
38
|
+
</bd-breadcrumb-item>
|
|
39
|
+
<bd-breadcrumb-item href="/products">
|
|
40
|
+
All Products
|
|
41
|
+
</bd-breadcrumb-item>
|
|
42
|
+
<bd-breadcrumb-item href="/products/security">
|
|
43
|
+
Security Suite
|
|
44
|
+
</bd-breadcrumb-item>
|
|
45
|
+
<bd-breadcrumb-item current>
|
|
46
|
+
Internet Security 2024
|
|
47
|
+
</bd-breadcrumb-item>
|
|
48
|
+
</bd-breadcrumb>
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
export const MixedItems = () => html`
|
|
52
|
+
<bd-breadcrumb>
|
|
53
|
+
<bd-breadcrumb-item href="/">
|
|
54
|
+
Home
|
|
55
|
+
</bd-breadcrumb-item>
|
|
56
|
+
<bd-breadcrumb-item>
|
|
57
|
+
Documentation
|
|
58
|
+
</bd-breadcrumb-item>
|
|
59
|
+
<bd-breadcrumb-item href="/docs/components">
|
|
60
|
+
Components
|
|
61
|
+
</bd-breadcrumb-item>
|
|
62
|
+
<bd-breadcrumb-item current>
|
|
63
|
+
Breadcrumb
|
|
64
|
+
</bd-breadcrumb-item>
|
|
65
|
+
</bd-breadcrumb>
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
export const LongPath = () => html`
|
|
69
|
+
<bd-breadcrumb>
|
|
70
|
+
<bd-breadcrumb-item href="/">
|
|
71
|
+
Home
|
|
72
|
+
</bd-breadcrumb-item>
|
|
73
|
+
<bd-breadcrumb-item href="/categories">
|
|
74
|
+
Categories
|
|
75
|
+
</bd-breadcrumb-item>
|
|
76
|
+
<bd-breadcrumb-item href="/categories/technology">
|
|
77
|
+
Technology
|
|
78
|
+
</bd-breadcrumb-item>
|
|
79
|
+
<bd-breadcrumb-item href="/categories/technology/software">
|
|
80
|
+
Software
|
|
81
|
+
</bd-breadcrumb-item>
|
|
82
|
+
<bd-breadcrumb-item href="/categories/technology/software/security">
|
|
83
|
+
Security Software
|
|
84
|
+
</bd-breadcrumb-item>
|
|
85
|
+
<bd-breadcrumb-item current>
|
|
86
|
+
Bitdefender Internet Security Complete Edition
|
|
87
|
+
</bd-breadcrumb-item>
|
|
88
|
+
</bd-breadcrumb>
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
export const MobileView = () => html`
|
|
92
|
+
<div style="max-width: 400px; border: 1px solid #ccc; padding: 20px;">
|
|
93
|
+
<bd-breadcrumb mobile-breakpoint="1200">
|
|
94
|
+
<bd-breadcrumb-item href="/">
|
|
95
|
+
Home
|
|
96
|
+
</bd-breadcrumb-item>
|
|
97
|
+
<bd-breadcrumb-item href="/products">
|
|
98
|
+
Products
|
|
99
|
+
</bd-breadcrumb-item>
|
|
100
|
+
<bd-breadcrumb-item current>
|
|
101
|
+
Current Page
|
|
102
|
+
</bd-breadcrumb-item>
|
|
103
|
+
</bd-breadcrumb>
|
|
104
|
+
<p style="margin-top: 20px; font-size: 12px; color: #666;">
|
|
105
|
+
This demo forces mobile view by setting breakpoint to 1200px.
|
|
106
|
+
Resize window to see responsive behavior.
|
|
107
|
+
</p>
|
|
108
|
+
</div>
|
|
109
|
+
`;
|
|
@@ -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 "./card.css.js";
|
|
4
5
|
|
|
5
6
|
class Card extends LitElement {
|
|
@@ -62,7 +63,7 @@ class CardItem extends LitElement {
|
|
|
62
63
|
${this.title
|
|
63
64
|
? html`
|
|
64
65
|
<div class="bd-light-title-badge-wrapper-s ${!hasContent ? 'bd-light-title-no-content' : ''}">
|
|
65
|
-
<
|
|
66
|
+
<bd-h as="h4" padding="10px 0">${this.title}</bd-h>
|
|
66
67
|
</div>
|
|
67
68
|
`
|
|
68
69
|
: ""}
|