@repobit/dex-system-design 0.23.41 → 0.23.43

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.
@@ -0,0 +1,267 @@
1
+ import { css } from "lit";
2
+
3
+ export default css`
4
+ :host {
5
+ --background-card-grey: var(--color-neutral-25);
6
+ --border-card-grey: var(--color-neutral-50);
7
+ --border-card-green: var(--color-green-700);
8
+ --badge-background: var(--color-blue-700);
9
+ --bd-accesibility-focus: var(--color-blue-500);
10
+
11
+ --text-color-white: var(--color-neutral-0);
12
+ font-size: 100%;
13
+ display: block;
14
+ font-family: var(--typography-fontFamily-sans);
15
+ padding-top: var(--spacing-64);
16
+ padding-bottom: var(--spacing-64);
17
+ }
18
+ .bd-tabs-subtitle{
19
+ font-size: var(--typography-body-regular-fontSize);
20
+ max-width: 500px;
21
+ text-align: center;
22
+ font-family: var(--typography-fontFamily-sans);
23
+ margin-top: var(--spacing-32);
24
+ margin-bottom: var(--spacing-32);
25
+
26
+ }
27
+ .bd-tab-button p {
28
+ margin-top: 1em;
29
+ margin-bottom: 1em;
30
+ }
31
+ .bd-tab-button:focus-visible,
32
+ .bd-find-out-more:focus-visible {
33
+ outline: var(--spacing-2) solid var(--bd-accesibility-focus);
34
+ outline-offset: var(--spacing-2);
35
+ border-radius: var(--space-2xs);
36
+ }
37
+ .bd-tabs-component .bd-left img {
38
+ max-width: 90%;
39
+ }
40
+
41
+ .bd-card-container {
42
+ display: flex;
43
+ justify-content: space-between;
44
+ padding: 36px 0px;
45
+ border-radius: 5px;
46
+ margin-top: 10px;
47
+ margin: auto;
48
+ width: 50%;
49
+ }
50
+
51
+ .bd-card-container .bd-left {
52
+ flex: 1;
53
+ padding-right: 20px;
54
+ }
55
+
56
+ .bd-card-container .bd-right {
57
+ flex: 1;
58
+ justify-content: center;
59
+ align-items: center;
60
+ padding: var(--spacing-0) var(--spacing-24);
61
+ }
62
+
63
+ .bd-tabs-container {
64
+ display: flex;
65
+ justify-content: center;
66
+ margin-bottom: 40px;
67
+ flex-wrap: wrap;
68
+ border-bottom: 1px solid #e4f2ff;
69
+ margin: 0 auto;
70
+ margin-bottom: var(--spacing-32);
71
+ }
72
+
73
+ .bd-tabs-container button {
74
+ color: #006eff;
75
+ border: 0;
76
+ padding: 9px;
77
+ display: flex;
78
+ gap: 10px;
79
+ align-items: center;
80
+ position: relative;
81
+ cursor: pointer;
82
+ font-size: 1.125em;
83
+ max-height: 55px;
84
+ }
85
+
86
+ .bd-tabs-container button::after {
87
+ background: #006eff;
88
+ content: "";
89
+ height: 4px;
90
+ position: absolute;
91
+ left: 0;
92
+ bottom: 0;
93
+ width: 0;
94
+ transition: width 1s ease;
95
+ }
96
+
97
+ .bd-tabs-container button.bd-selected::after {
98
+ width: 100%;
99
+ }
100
+
101
+ .bd-tabs-container button.bd-selected {
102
+ color: black;
103
+ }
104
+
105
+ .bd-tab-button {
106
+ display: inline-flex;
107
+ align-items: center;
108
+ justify-content: center;
109
+ gap: 8px;
110
+ background: none;
111
+ border: none;
112
+ padding: 10px;
113
+ cursor: pointer;
114
+ <!-- font-weight: bold; -->
115
+ }
116
+
117
+ .bd-tab-button img {
118
+ margin-right: 8px;
119
+ height: 30px;
120
+ width: 30px;
121
+ }
122
+
123
+ .bd-tabs-component h2 {
124
+ margin-bottom: 75px;
125
+ max-width: 630px;
126
+ text-align: center;
127
+ }
128
+
129
+ .bd-tabs-component {
130
+ display: flex;
131
+ flex-direction: column;
132
+ align-items: center;
133
+ }
134
+
135
+ .bd-ul-privacy {
136
+ list-style: none;
137
+ padding-inline-start: 0px;
138
+ }
139
+
140
+ .bd-find-out-more {
141
+ text-decoration: none;
142
+ background-color: white;
143
+ color: #006eff;
144
+ border: 0;
145
+ display: flex;
146
+ gap: 10px;
147
+ align-items: start;
148
+ position: relative;
149
+ cursor: pointer;
150
+ font-family: var(--typography-fontFamily-sans);
151
+ font-weight: var(--typography-fontWeight-semibold);
152
+ }
153
+
154
+ .bd-find-out-more .bd-arrow svg {
155
+ width: 12px;
156
+ height: 12px;
157
+ position: relative;
158
+ top: 1.5px;
159
+ }
160
+
161
+ .bd-right h3 {
162
+ font-size: var(--typography-heading-h4-fontSize);
163
+ }
164
+
165
+ .bd-section-title {
166
+ font-family: var(--typography-fontFamily-sans);
167
+ font-weight: var(--typography-fontWeight-semibold);
168
+ }
169
+
170
+ /* ✅ Responsive Design */
171
+ @media (max-width: 1200px) {
172
+ .bd-tabs-component.bd-we-container {
173
+ max-width: 100%;
174
+ padding: 0 20px;
175
+ }
176
+ }
177
+
178
+ @media (max-width: 992px) {
179
+ .bd-tabs-component .bd-card-container {
180
+ flex-direction: column;
181
+ width: 90%;
182
+ }
183
+
184
+ .bd-tabs-component .bd-tabs-container {
185
+ flex-wrap: wrap;
186
+ }
187
+
188
+ .bd-tabs-component .bd-tabs-container button picture img {
189
+ width: 24px;
190
+ }
191
+
192
+ .bd-tabs-component .bd-card-container {
193
+ align-items: center;
194
+ text-align: center;
195
+ }
196
+
197
+ .bd-tabs-component .bd-left {
198
+ width: 100%;
199
+ padding: 10px;
200
+ }
201
+
202
+ .bd-tabs-component .bd-left img {
203
+ max-width: 50%;
204
+ }
205
+
206
+ .bd-tabs-component .bd-right {
207
+ width: 100%;
208
+ padding: 10px;
209
+ }
210
+
211
+ .bd-tabs-component.bd-we-container {
212
+ max-width: 100%;
213
+ padding-left: 30px;
214
+ padding-right: 30px;
215
+ }
216
+ }
217
+
218
+ @media (max-width: 768px) {
219
+ .bd-card-container {
220
+ flex-direction: column;
221
+ width: 100%;
222
+ padding: 20px;
223
+ }
224
+
225
+ .bd-section-title {
226
+ text-align: center;
227
+ font-size: 1.6em;
228
+ margin-bottom: 30px;
229
+ padding: 10px;
230
+ }
231
+
232
+ .bd-right h3 {
233
+ text-align: center;
234
+ }
235
+
236
+ .bd-tabs-component {
237
+ margin-top: 24px;
238
+ }
239
+
240
+ .bd-tabs-container {
241
+ flex-direction: column;
242
+ align-items: center;
243
+ text-align: center;
244
+ width: 100%;
245
+ }
246
+
247
+ .bd-tabs-container button {
248
+ font-size: 1.2em;
249
+ padding: 6px;
250
+ }
251
+
252
+ .bd-tabs-component .bd-left img {
253
+ max-width: 100%;
254
+ height: auto;
255
+ }
256
+
257
+ .bd-tabs-component .bd-right {
258
+ text-align: center;
259
+ padding: 10px;
260
+ text-align: left;
261
+ }
262
+
263
+ .bd-find-out-more {
264
+ justify-content: center;
265
+ }
266
+ }
267
+ `;
@@ -0,0 +1,193 @@
1
+ import { LitElement, html } from "lit";
2
+ import { tokens } from "../../tokens/tokens.js";
3
+ import "../heading/heading.js";
4
+ import "../highlight/highlight.js";
5
+ import "../list/list-item/list-item.js";
6
+ import "../list/list.js";
7
+ import "../paragraph/paragraph.js";
8
+ import tabsCSS from "./tabsComponent.css.js";
9
+
10
+ class TabsComponent extends LitElement {
11
+ static properties = {
12
+ selectedTab: { type: Number }
13
+ };
14
+
15
+ constructor() {
16
+ super();
17
+ this.selectedTab = 0;
18
+ }
19
+
20
+ selectTab(index) {
21
+ this.selectedTab = index;
22
+ this.requestUpdate();
23
+ }
24
+
25
+ render() {
26
+ const tabs = [
27
+ {
28
+ title : "Privacy Protection",
29
+ imageBase: "/assets/tabs-img1.png",
30
+ icon : "/assets/pic1.png"
31
+ },
32
+ {
33
+ title : "Identity Protection",
34
+ imageBase: "/assets/tabs-img2.png",
35
+ icon : "/assets/pic2.png"
36
+ },
37
+ {
38
+ title : "Device Protection",
39
+ imageBase: "/assets/tabs-img3.png",
40
+ icon : "/assets/pic3.png"
41
+ },
42
+ {
43
+ title : "Financial Insurance",
44
+ imageBase: "/assets/tabs-img3.png",
45
+ icon : "/assets/pic3.png"
46
+ }
47
+ ];
48
+
49
+ const content = [
50
+ {
51
+ heading : "Take back your family's digital privacy",
52
+ description: () => html`
53
+ <bd-list type="unordered" spacing="md" variant="default" orientation="vertical">
54
+ <bd-li kind="bullet" size="md">
55
+ <bd-p kind="small">Enjoy complete data privacy with
56
+ <strong>Bitdefender Premium VPN</strong>.</bd-p>
57
+ </bd-li>
58
+ <bd-li kind="bullet" size="md">
59
+ <bd-p kind="small">Escape intrusive ads and trackers with our advanced
60
+ <strong>Ad-Blocker</strong> and
61
+ <strong>Anti-Tracker</strong> features.</bd-p>
62
+ </bd-li>
63
+ <bd-li kind="bullet" size="md">
64
+ <bd-p kind="small">Shield yourself with robust
65
+ <strong>Webcam and Microphone Protection</strong>.</bd-p>
66
+ </bd-li>
67
+ </bd-list>`,
68
+ href: "#1"
69
+ },
70
+ {
71
+ heading : "Safe data. Safe you.",
72
+ description: () => html`
73
+ <bd-p kind="small">Get instant alerts for potential threats to your personal data and
74
+ finances.</bd-p>
75
+ <bd-p kind="small">Receive clear and concise advice on handling data breaches.</bd-p>
76
+ <bd-p kind="small">Reduce the risk of online ID theft by scanning your digital
77
+ footprint.</bd-p>`,
78
+ href: "#2"
79
+ },
80
+ {
81
+ heading : "We secure what you hold dear",
82
+ description: () => html`
83
+ <bd-p kind="small">Enjoy seamless security across all devices.</bd-p>
84
+ <bd-p kind="small">Protection from corrupt websites, risky downloads, and phishing
85
+ attempts.</bd-p>
86
+ <bd-p kind="small">Lightweight performance ensures smooth device operation.</bd-p>`,
87
+ href: "#3"
88
+ },
89
+ {
90
+ heading : "Financial Insurance",
91
+ description: () => html`
92
+ <bd-p kind="small">Enjoy seamless security across all devices.</bd-p>
93
+ <bd-p kind="small">Protection from corrupt websites, risky downloads, and phishing
94
+ attempts.</bd-p>
95
+ <bd-p kind="small">Lightweight performance ensures smooth device operation.</bd-p>`,
96
+ href: "#4"
97
+ }
98
+ ];
99
+
100
+ const selectedTabData = tabs[this.selectedTab];
101
+
102
+ return html`
103
+ <div class="bd-tabs-component">
104
+ <bd-highlight highlight-text="family member">
105
+ Customized online protection for each family member - Smart, Private &
106
+ Safe
107
+ </bd-highlight>
108
+ <bd-p kind="regular" class="bd-tabs-subtitle">Your family is unique and so should be your online security. Our family protection plan adapts to each member's needs, offering the ideal mix of privacy, freedom, and safety.</bd-p>
109
+ <div class="bd-tabs-container">
110
+ ${tabs.map(
111
+ (tab, index) => html`
112
+ <button
113
+ role="tab"
114
+ aria-selected="${this.selectedTab === index ? "true" : "false"}"
115
+ class=${this.selectedTab === index
116
+ ? "bd-selected bd-tab-button"
117
+ : "bd-tab-button"}
118
+ @click=${() => this.selectTab(index)}
119
+ aria-controls="tab-content-${index}"
120
+ id="tab-${index}"
121
+ >
122
+ <img src="${tab.icon}" alt="${tab.title} Icon" />
123
+ <bd-p kind="small"><strong>${tab.title}</strong></bd-p>
124
+ </button>
125
+ `
126
+ )}
127
+ </div>
128
+ <div class="bd-card-container">
129
+ <div class="bd-left">
130
+ <picture>
131
+ ${["webp", "png"].map((format) =>
132
+ ["2000", "750"].map(
133
+ (width) => html`
134
+ <source
135
+ type="image/${format}"
136
+ srcset="
137
+ ${selectedTabData.imageBase}?width=${width}&format=${format}&optimize=medium
138
+ "
139
+ media="${width === "2000" ? "(min-width: 600px)" : ""}"
140
+ />
141
+ `
142
+ )
143
+ )}
144
+ <img
145
+ loading="lazy"
146
+ alt="${selectedTabData.title} Image"
147
+ src="${selectedTabData.imageBase}?width=750&format=png&optimize=medium"
148
+ />
149
+ </picture>
150
+ </div>
151
+ <div class="bd-right">
152
+ <bd-h as="h3" id="tab-content-heading-${this.selectedTab}">
153
+ ${content[this.selectedTab].heading}
154
+ </bd-h>
155
+ <div
156
+ id="tab-content-${this.selectedTab}"
157
+ aria-labelledby="tab-content-heading-${this.selectedTab}"
158
+ >
159
+ ${content[this.selectedTab].description()}
160
+ </div>
161
+ <a
162
+ href="${content[this.selectedTab].href}"
163
+ class="bd-find-out-more"
164
+ aria-label="Find out more about ${content[this.selectedTab]
165
+ .heading}"
166
+ >
167
+ <bd-p kind="small">Find out more</bd-p>
168
+ <span class="bd-arrow">
169
+ <svg
170
+ width="14"
171
+ height="14"
172
+ viewBox="0 0 24 24"
173
+ fill="none"
174
+ stroke="currentColor"
175
+ stroke-width="3"
176
+ stroke-linecap="round"
177
+ stroke-linejoin="round"
178
+ >
179
+ <path d="M5 12h14"></path>
180
+ <path d="M12 5l7 7-7 7"></path>
181
+ </svg>
182
+ </span>
183
+ </a>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ `;
188
+ }
189
+ }
190
+
191
+ TabsComponent.styles = [tokens, tabsCSS];
192
+
193
+ customElements.define("bd-tabs-component", TabsComponent);
@@ -0,0 +1,134 @@
1
+ import { html } from 'lit';
2
+ import './tabsComponent.js';
3
+
4
+ export default {
5
+ title : 'Components/TabsComponent',
6
+ tags : ['autodocs'],
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: `
11
+ **TabsComponent** is a Lit component that renders a four-tab feature showcase with image, heading, description, and a "Find out more" link.
12
+
13
+ ### Usage
14
+ \`\`\`html
15
+ <bd-tabs-component></bd-tabs-component>
16
+ \`\`\`
17
+
18
+ ### Tabs
19
+ | Index | Title |
20
+ |---|---|
21
+ | 0 | Privacy Protection |
22
+ | 1 | Identity Protection |
23
+ | 2 | Device Protection |
24
+ | 3 | Financial Insurance |
25
+
26
+ ### Structure
27
+ - A \`<bd-highlight>\` heading with subtitle
28
+ - A row of tab buttons (icon + label), each with \`role="tab"\` and \`aria-selected\`
29
+ - A card with left image (\`<picture>\` with WebP/PNG sources) and right content (heading + description + link)
30
+
31
+ ### Behavior
32
+ - Clicking a tab updates \`selectedTab\` and re-renders the card content
33
+ - Image sources include width/format/optimize query params for responsive loading
34
+ - Active tab has \`bd-selected\` class and \`aria-selected="true"\`
35
+
36
+ ### Accessibility
37
+ - Tab buttons have \`role="tab"\`, \`aria-selected\`, \`aria-controls\`, and \`id\` attributes
38
+ - Content panel has \`aria-labelledby\` linked to the heading
39
+ `
40
+ }
41
+ }
42
+ },
43
+ argTypes: {
44
+ selectedTab: {
45
+ control : { type: 'select' },
46
+ options : [0, 1, 2, 3],
47
+ description: 'Index of the initially selected tab (0–3)',
48
+ table : { type: { summary: 'number' }, defaultValue: { summary: '0' }, category: 'State' }
49
+ }
50
+ }
51
+ };
52
+
53
+ // ─── Stories ───────────────────────────────────────────────────────────────
54
+
55
+ export const Default = {
56
+ name : 'Default (Tab 0 — Privacy Protection)',
57
+ render : () => html`<bd-tabs-component></bd-tabs-component>`,
58
+ parameters: { docs: { description: { story: 'Default state with the first tab (Privacy Protection) selected.' } } }
59
+ };
60
+
61
+ export const Tab1Selected = {
62
+ name : 'Tab 1 — Identity Protection',
63
+ render: () => {
64
+ const el = document.createElement('bd-tabs-component');
65
+ el.selectedTab = 1;
66
+ return el;
67
+ },
68
+ parameters: { docs: { description: { story: 'Component initialized with the Identity Protection tab selected.' } } }
69
+ };
70
+
71
+ export const Tab2Selected = {
72
+ name : 'Tab 2 — Device Protection',
73
+ render: () => {
74
+ const el = document.createElement('bd-tabs-component');
75
+ el.selectedTab = 2;
76
+ return el;
77
+ },
78
+ parameters: { docs: { description: { story: 'Component initialized with the Device Protection tab selected.' } } }
79
+ };
80
+
81
+ export const Tab3Selected = {
82
+ name : 'Tab 3 — Financial Insurance',
83
+ render: () => {
84
+ const el = document.createElement('bd-tabs-component');
85
+ el.selectedTab = 3;
86
+ return el;
87
+ },
88
+ parameters: { docs: { description: { story: 'Component initialized with the Financial Insurance tab selected.' } } }
89
+ };
90
+
91
+ export const AllTabsOverview = {
92
+ name : 'All Tabs Overview',
93
+ render: () => html`
94
+ <div style="display:flex; flex-direction:column; gap:64px;">
95
+ <div>
96
+ <p style="font-weight:600; margin-bottom:8px;">Tab 0 — Privacy Protection</p>
97
+ <bd-tabs-component></bd-tabs-component>
98
+ </div>
99
+ </div>
100
+ <p style="font-size:14px; margin-top:16px; color:#666;">
101
+ Click the tab buttons above to switch between Privacy, Identity, Device, and Financial Insurance tabs.
102
+ </p>
103
+ `,
104
+ parameters: { docs: { description: { story: 'Full interactive component. Click each tab to see the content switch between the four protection categories.' } } }
105
+ };
106
+
107
+ export const MobileView = {
108
+ name : 'Mobile View (375px)',
109
+ render : () => html`<bd-tabs-component></bd-tabs-component>`,
110
+ parameters: {
111
+ viewport: { defaultViewport: 'mobile1' },
112
+ docs : { description: { story: 'Tabs component at 375px. Tests tab button layout, image sizing, and content reflow on small screens.' } }
113
+ }
114
+ };
115
+
116
+ export const TabletView = {
117
+ name : 'Tablet View (768px)',
118
+ render : () => html`<bd-tabs-component></bd-tabs-component>`,
119
+ parameters: {
120
+ viewport: { defaultViewport: 'tablet' },
121
+ docs : { description: { story: 'Tabs component at 768px tablet width.' } }
122
+ }
123
+ };
124
+
125
+ export const Playground = {
126
+ name : '🛝 Playground',
127
+ args : { selectedTab: 0 },
128
+ render: (args) => {
129
+ const el = document.createElement('bd-tabs-component');
130
+ el.selectedTab = args.selectedTab;
131
+ return el;
132
+ },
133
+ parameters: { docs: { description: { story: 'Interactive playground. Use the Controls panel to select which tab is initially active (0–3).' } } }
134
+ };