@repobit/dex-system-design 0.22.11 → 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 +40 -0
  2. package/package.json +4 -3
  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,191 +1,192 @@
1
1
  import { html } from 'lit';
2
- import '../accordion/accordion-bg.js';
3
- import '../anchor/anchor-nav.js';
4
- import '../carousel/carousel.js';
5
- import '../heading/heading.js';
6
- import '../pricing-cards/pricing-card.js';
7
- import '../tabs/tabs.js';
2
+ import './anchor-nav.js';
8
3
 
9
4
  export default {
10
- title : 'Navigation/Anchor - Navbar',
11
- component : 'bd-anchor-nav',
12
- subcomponents: {
13
- 'bd-anchor-nav-item': 'bd-anchor-nav-item'
14
- },
15
- tags: ['autodocs'],
16
-
17
- argTypes: {
18
- // Proprietăți pentru bd-anchor-nav
19
- position: {
20
- control : { type: 'select' },
21
- options : ['fixed', 'sticky', 'relative'],
22
- description: 'Position of the navigation bar',
23
- table : {
24
- type : { summary: 'string' },
25
- defaultValue: { summary: 'fixed' },
26
- category : 'bd-anchor-nav'
27
- }
28
- },
29
- theme: {
30
- control : { type: 'select' },
31
- options : ['light', 'dark'],
32
- description: 'Color theme of the navigation bar',
33
- table : {
34
- type : { summary: 'string' },
35
- defaultValue: { summary: 'light' },
36
- category : 'bd-anchor-nav'
37
- }
38
- },
39
- offset: {
40
- control : { type: 'number', min: 0, max: 200, step: 10 },
41
- description: 'Offset in pixels from the top when scrolling',
42
- table : {
43
- type : { summary: 'number' },
44
- defaultValue: { summary: '0' },
45
- category : 'bd-anchor-nav'
46
- }
47
- }
48
- },
49
-
5
+ title : 'Components/AnchorNav',
6
+ tags : ['autodocs'],
50
7
  parameters: {
51
8
  docs: {
52
9
  description: {
53
10
  component: `
54
- # bd-anchor-nav & bd-anchor-nav-item
55
-
56
- Navigation component for smooth scrolling to page sections.
11
+ **BdAnchorNav** is a Lit web component that renders a sticky navigation bar with anchor links and a "Buy now" CTA button.
57
12
 
58
- ## Usage
13
+ It consists of two elements:
14
+ - \`<bd-anchor-nav>\` — the nav container with auto-generated anchor links and a Buy button
15
+ - \`<bd-anchor-nav-item>\` — declarative items that define the link labels via their \`title\` attribute
59
16
 
17
+ ### Usage
60
18
  \`\`\`html
61
19
  <bd-anchor-nav>
62
- <bd-anchor-nav-item title="Features" id="features"></bd-anchor-nav-item>
63
- <bd-anchor-nav-item title="Pricing" id="pricing"></bd-anchor-nav-item>
64
- <bd-anchor-nav-item title="FAQ" id="faq"></bd-anchor-nav-item>
20
+ <bd-anchor-nav-item title="Overview"></bd-anchor-nav-item>
21
+ <bd-anchor-nav-item title="Features"></bd-anchor-nav-item>
22
+ <bd-anchor-nav-item title="Reviews"></bd-anchor-nav-item>
23
+ <bd-anchor-nav-item title="Pricing"></bd-anchor-nav-item>
65
24
  </bd-anchor-nav>
66
25
  \`\`\`
67
26
 
68
- ## Properties
69
-
70
- ### bd-anchor-nav
71
- | Attribute | Type | Default | Description |
72
- |-----------|------|---------|-------------|
73
- | \`position\` | 'fixed' \| 'sticky' \| 'relative' | \`fixed\` | CSS position |
74
- | \`theme\` | 'light' \| 'dark' | \`light\` | Color theme |
75
- | \`offset\` | number | \`0\` | Scroll offset from top |
76
-
77
- ### bd-anchor-nav-item
78
- | Attribute | Type | Required | Description |
79
- |-----------|------|----------|-------------|
80
- | \`title\` | string | Yes | Navigation link text |
81
- | \`id\` | string | Yes | Target section ID |
82
-
83
- ## Features
84
- - Smooth scrolling to sections
85
- - Active state highlighting
86
- - Responsive design
87
- - Keyboard navigation support
27
+ ### Behavior
28
+ - Links are auto-indexed as \`anchor-1\`, \`anchor-2\`, etc.
29
+ - Clicking a link sets it as active and smooth-scrolls to \`#anchor-N-section\` with a 120px offset
30
+ - The Buy now button smooth-scrolls to \`#section-pricing\`
31
+ - Active state is tracked internally via \`this.activeId\`
32
+
33
+ ### Notes
34
+ - \`bd-anchor-nav-item\` is a plain \`HTMLElement\` (not LitElement) it is used only as a declarative data source
35
+ - The nav renders all links dynamically from its children
88
36
  `
89
37
  }
90
38
  }
39
+ },
40
+ argTypes: {
41
+ items: {
42
+ control : 'object',
43
+ description: 'Array of nav item labels rendered as anchor links',
44
+ table : {
45
+ type : { summary: 'string[]' },
46
+ defaultValue: { summary: "['Overview', 'Features', 'Reviews', 'Pricing']" },
47
+ category : 'Content'
48
+ }
49
+ }
91
50
  }
92
51
  };
93
52
 
94
- const Template = (args) => html`
95
- <bd-anchor-nav
96
- position="${args.position}"
97
- theme="${args.theme}"
98
- offset="${args.offset}"
99
- >
100
- <bd-anchor-nav-item title="Anchor 1" id="anchor-1"></bd-anchor-nav-item>
101
- <bd-anchor-nav-item title="Anchor 2" id="anchor-2"></bd-anchor-nav-item>
102
- <bd-anchor-nav-item title="Anchor 3" id="anchor-3"></bd-anchor-nav-item>
53
+ const renderNav = (items) => html`
54
+ <bd-anchor-nav>
55
+ ${items.map(label => html`
56
+ <bd-anchor-nav-item title="${label}"></bd-anchor-nav-item>
57
+ `)}
103
58
  </bd-anchor-nav>
104
-
105
- <bd-container>
106
- <section id="anchor-1" style="height: 800px; padding-top: 80px;">
107
- <hr />
108
- <bd-accordion-bg title="Questions? Answers.">
109
- <bd-accordion-bg-item title="How does Bitdefender Internet Security protect me?">
110
- <bd-p kind="small">Provides comprehensive protection against online threats.</bd-p>
111
- </bd-accordion-bg-item>
112
- <bd-accordion-bg-item title="Does Bitdefender protect against ransomware?">
113
- <bd-p kind="small">Yes, with multi-layered defense mechanisms.</bd-p>
114
- </bd-accordion-bg-item>
115
- </bd-accordion-bg>
116
- </section>
117
-
118
- <section id="anchor-2" style="height: 800px; padding-top: 80px;">
119
- <hr />
120
- <bd-tabs-component></bd-tabs-component>
121
- </section>
122
-
123
- <section id="anchor-3" style="height: 800px; padding-top: 80px;">
124
- <hr />
125
- <bd-carousel-section title="Need help? We've got answers!">
126
- <bd-carousel-item
127
- title="Scam Copilot Bot"
128
- subTitle="AI chatbot for suspicious interaction detection"
129
- icon="/assets/light-carousel-img1.png"
130
- >
131
- <bd-h as="h4">Scam Copilot Bot</bd-h>
132
- <bd-p kind="small">Helps identify suspicious online interactions.</bd-p>
133
- </bd-carousel-item>
134
- </bd-carousel-section>
135
- </section>
136
-
137
- <section id="section-pricing" style="height: 800px; padding-top: 80px;">
138
- <bd-pricing-container></bd-pricing-container>
139
- </section>
140
- </bd-container>
141
59
  `;
142
60
 
143
- export const Default = Template.bind({});
144
- Default.args = {
145
- position: 'fixed',
146
- theme : 'light',
147
- offset : 0
61
+ // ─── Stories ───────────────────────────────────────────────────────────────
62
+
63
+ export const Default = {
64
+ name : 'Default (4 items)',
65
+ render : () => renderNav(['Overview', 'Features', 'Reviews', 'Pricing']),
66
+ parameters: {
67
+ docs: {
68
+ description: {
69
+ story: 'Default nav with four anchor links and the Buy now button. The first link is active on mount.'
70
+ }
71
+ }
72
+ }
148
73
  };
149
74
 
150
- export const Sticky = Template.bind({});
151
- Sticky.args = {
152
- ...Default.args,
153
- position: 'sticky'
75
+ export const TwoItems = {
76
+ name : 'Two Items',
77
+ render : () => renderNav(['Overview', 'Pricing']),
78
+ parameters: {
79
+ docs: {
80
+ description: {
81
+ story: 'Minimal nav with only two items. Verifies layout and active state with a small item count.'
82
+ }
83
+ }
84
+ }
154
85
  };
155
86
 
156
- export const DarkTheme = Template.bind({});
157
- DarkTheme.args = {
158
- ...Default.args,
159
- theme: 'dark'
87
+ export const ManyItems = {
88
+ name : 'Many Items (7)',
89
+ render : () => renderNav(['Overview', 'Features', 'Security', 'Performance', 'Reviews', 'FAQ', 'Pricing']),
90
+ parameters: {
91
+ docs: {
92
+ description: {
93
+ story: 'Nav with 7 items. Useful for testing overflow behavior and link truncation on smaller viewports.'
94
+ }
95
+ }
96
+ }
160
97
  };
161
98
 
162
- export const WithOffset = Template.bind({});
163
- WithOffset.args = {
164
- ...Default.args,
165
- offset: 80
99
+ export const SingleItem = {
100
+ name : 'Single Item (edge case)',
101
+ render : () => renderNav(['Pricing']),
102
+ parameters: {
103
+ docs: {
104
+ description: {
105
+ story: 'Edge case: only one anchor item. The single link should be active by default.'
106
+ }
107
+ }
108
+ }
166
109
  };
167
110
 
168
- export const MinimalExample = () => html`
169
- <bd-anchor-nav>
170
- <bd-anchor-nav-item title="Home" id="home"></bd-anchor-nav-item>
171
- <bd-anchor-nav-item title="About" id="about"></bd-anchor-nav-item>
172
- <bd-anchor-nav-item title="Contact" id="contact"></bd-anchor-nav-item>
173
- </bd-anchor-nav>
111
+ export const LongLabels = {
112
+ name : 'Long Item Labels',
113
+ render: () => renderNav([
114
+ 'Product Overview',
115
+ 'Advanced Security Features',
116
+ 'Performance Benchmarks',
117
+ 'Customer Reviews & Ratings',
118
+ 'Plans & Pricing'
119
+ ]),
120
+ parameters: {
121
+ docs: {
122
+ description: {
123
+ story: 'Items with longer label strings. Tests whether the nav handles text overflow or wrapping gracefully.'
124
+ }
125
+ }
126
+ }
127
+ };
128
+
129
+ export const WithScrollTargets = {
130
+ name : 'With Scroll Targets',
131
+ render: () => html`
132
+ <div style="position: sticky; top: 0; z-index: 100;">
133
+ <bd-anchor-nav>
134
+ <bd-anchor-nav-item title="Overview"></bd-anchor-nav-item>
135
+ <bd-anchor-nav-item title="Features"></bd-anchor-nav-item>
136
+ <bd-anchor-nav-item title="Pricing"></bd-anchor-nav-item>
137
+ </bd-anchor-nav>
138
+ </div>
139
+
140
+ <div id="anchor-1-section" style="padding: 80px 24px; background: #EDF9FF;">
141
+ <h2>Overview Section</h2>
142
+ <p>This is the overview content area. The nav scrolls here when "Overview" is clicked.</p>
143
+ </div>
144
+ <div id="anchor-2-section" style="padding: 80px 24px; background: #fff;">
145
+ <h2>Features Section</h2>
146
+ <p>This is the features content area.</p>
147
+ </div>
148
+ <div id="anchor-3-section" style="padding: 80px 24px; background: #EDF9FF;">
149
+ <h2>Pricing Section</h2>
150
+ <p>This is the pricing content area.</p>
151
+ </div>
152
+ <div id="section-pricing" style="padding: 80px 24px; background: #fff;">
153
+ <h2>Buy Now Target</h2>
154
+ <p>The "Buy now" button scrolls to this element (#section-pricing).</p>
155
+ </div>
156
+ `,
157
+ parameters: {
158
+ docs: {
159
+ description: {
160
+ story: 'Full scroll demo with actual target sections in the DOM. Click nav links or the Buy now button to trigger smooth scroll behavior.'
161
+ }
162
+ }
163
+ }
164
+ };
174
165
 
175
- <bd-container>
176
- <section id="home" style="height: 400px; padding-top: 80px;">
177
- <bd-h as="h2">Home</bd-h>
178
- <bd-p>Home section content.</bd-p>
179
- </section>
180
-
181
- <section id="about" style="height: 400px;">
182
- <bd-h as="h2">About</bd-h>
183
- <bd-p>About section content.</bd-p>
184
- </section>
185
-
186
- <section id="contact" style="height: 400px;">
187
- <bd-h as="h2">Contact</bd-h>
188
- <bd-p>Contact section content.</bd-p>
189
- </section>
190
- </bd-container>
191
- `;
166
+ export const MobileView = {
167
+ name : 'Mobile View',
168
+ render : () => renderNav(['Overview', 'Features', 'Reviews', 'Pricing']),
169
+ parameters: {
170
+ viewport: { defaultViewport: 'mobile1' },
171
+ docs : {
172
+ description: {
173
+ story: 'Nav rendered at 375px mobile width. Tests horizontal overflow and Buy now button layout at small viewports.'
174
+ }
175
+ }
176
+ }
177
+ };
178
+
179
+ export const Playground = {
180
+ name: '🛝 Playground',
181
+ args: {
182
+ items: ['Overview', 'Features', 'Reviews', 'Pricing']
183
+ },
184
+ render : (args) => renderNav(args.items),
185
+ parameters: {
186
+ docs: {
187
+ description: {
188
+ story: 'Interactive playground. Edit the `items` array in Controls to add, remove, or rename nav links.'
189
+ }
190
+ }
191
+ }
192
+ };
@@ -0,0 +1,44 @@
1
+ import { LitElement, html } from 'lit';
2
+
3
+ export class BdIcon extends LitElement {
4
+ static properties = {
5
+ src : { type: String },
6
+ label : { type: String },
7
+ width : { type: String },
8
+ height: { type: String }
9
+ };
10
+
11
+ constructor() {
12
+ super();
13
+ this.width = '100%';
14
+ this.height = '100%';
15
+ }
16
+
17
+ render() {
18
+ const ariaLabel = this.label || null;
19
+
20
+ const commonStyles = `
21
+ display: block;
22
+ width: 100%;
23
+ height: 100%;
24
+ `;
25
+
26
+ return html`
27
+ ${this.src
28
+ ? html`<img
29
+ src="${this.src}"
30
+ alt="${ariaLabel}"
31
+ aria-label="${ariaLabel}"
32
+ width="${this.width}"
33
+ height="${this.height}"
34
+ style="${commonStyles} object-fit: contain;"
35
+ >`
36
+ : html`<div style="${commonStyles}">
37
+ <slot></slot>
38
+ </div>`
39
+ }
40
+ `;
41
+ }
42
+ }
43
+
44
+ customElements.define('bd-icon', BdIcon);