@repobit/dex-system-design 0.23.9 → 0.23.11
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 +15 -0
- package/package.json +2 -2
- package/src/components/accordion/accordion-indicators.js +2 -0
- package/src/components/anchor/anchor-nav.css.js +333 -84
- package/src/components/anchor/anchor-nav.js +333 -58
- package/src/components/awards/awards-light.js +240 -0
- package/src/components/awards/awards-light.stories.js +354 -0
- package/src/components/awards/awards.css.js +1 -1
- package/src/components/compare/compare.css.js +29 -26
- package/src/components/compare/compare.stories.js +1 -1
- package/src/components/dropdown/dropdown.stories.js +221 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import './dropdown.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title : 'Components/Dropdown',
|
|
6
|
+
tags : ['autodocs'],
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: `
|
|
11
|
+
**CustomDropdown** is a Lit form select component with label, validation states, tooltip, and size variants.
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
\`\`\`html
|
|
15
|
+
<bd-custom-dropdown
|
|
16
|
+
label="Select country"
|
|
17
|
+
.options="${['Romania', 'Germany', 'France']}"
|
|
18
|
+
kind="md"
|
|
19
|
+
required
|
|
20
|
+
></bd-custom-dropdown>
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
### States
|
|
24
|
+
| State | Prop | CSS Class |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| Default | — | — |
|
|
27
|
+
| Invalid | \`invalid\` | \`form-input--error\` |
|
|
28
|
+
| Valid | \`validated\` | \`form-input--success\` |
|
|
29
|
+
| Disabled | \`disabled\` | \`form-input--disabled\` |
|
|
30
|
+
|
|
31
|
+
### Size Variants
|
|
32
|
+
| Kind | Input Class | Label Class |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| \`sm\` | \`input-sm\` | \`label-sm\` |
|
|
35
|
+
| \`md\` | \`input-md\` | \`label-md\` |
|
|
36
|
+
| \`lg\` | \`input-lg\` | \`label-lg\` |
|
|
37
|
+
|
|
38
|
+
### Notes
|
|
39
|
+
- Options can be passed as an Array or a JSON string
|
|
40
|
+
- First option is auto-selected by default
|
|
41
|
+
- Tooltip/help text is only rendered when \`tooltip\` prop is non-empty
|
|
42
|
+
`
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
argTypes: {
|
|
47
|
+
label: {
|
|
48
|
+
control : 'text',
|
|
49
|
+
description: 'Label text shown above the select',
|
|
50
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: 'Select an option' }, category: 'Content' }
|
|
51
|
+
},
|
|
52
|
+
options: {
|
|
53
|
+
control : 'object',
|
|
54
|
+
description: 'Array of option strings. Can also be passed as a JSON string.',
|
|
55
|
+
table : { type: { summary: 'string[]' }, defaultValue: { summary: '[]' }, category: 'Content' }
|
|
56
|
+
},
|
|
57
|
+
kind: {
|
|
58
|
+
control : { type: 'select' },
|
|
59
|
+
options : ['sm', 'md', 'lg'],
|
|
60
|
+
description: 'Size variant controlling input and label CSS classes',
|
|
61
|
+
table : { type: { summary: "'sm'|'md'|'lg'" }, defaultValue: { summary: 'md' }, category: 'Appearance' }
|
|
62
|
+
},
|
|
63
|
+
required: {
|
|
64
|
+
control : 'boolean',
|
|
65
|
+
description: 'Adds a required asterisk to the label and `required` attribute to the select',
|
|
66
|
+
table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'Validation' }
|
|
67
|
+
},
|
|
68
|
+
invalid: {
|
|
69
|
+
control : 'boolean',
|
|
70
|
+
description: 'Applies error styling and `form-help-text--error` to the tooltip',
|
|
71
|
+
table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'Validation' }
|
|
72
|
+
},
|
|
73
|
+
validated: {
|
|
74
|
+
control : 'boolean',
|
|
75
|
+
description: 'Applies success styling and `form-help-text--success` to the tooltip',
|
|
76
|
+
table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'Validation' }
|
|
77
|
+
},
|
|
78
|
+
disabled: {
|
|
79
|
+
control : 'boolean',
|
|
80
|
+
description: 'Disables the select element',
|
|
81
|
+
table : { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'State' }
|
|
82
|
+
},
|
|
83
|
+
tooltip: {
|
|
84
|
+
control : 'text',
|
|
85
|
+
description: 'Help text shown below the select. Empty string hides it.',
|
|
86
|
+
table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Content' }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const defaultOptions = ['Select a plan', 'Antivirus Plus', 'Total Security', 'Premium Security'];
|
|
92
|
+
|
|
93
|
+
const render = (args) => html`
|
|
94
|
+
<bd-custom-dropdown
|
|
95
|
+
label="${args.label}"
|
|
96
|
+
.options="${args.options}"
|
|
97
|
+
kind="${args.kind}"
|
|
98
|
+
tooltip="${args.tooltip}"
|
|
99
|
+
?required="${args.required}"
|
|
100
|
+
?invalid="${args.invalid}"
|
|
101
|
+
?validated="${args.validated}"
|
|
102
|
+
?disabled="${args.disabled}"
|
|
103
|
+
></bd-custom-dropdown>
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const defaultArgs = {
|
|
107
|
+
label : 'Select a plan', options : defaultOptions,
|
|
108
|
+
kind : 'md', tooltip : '', required : false,
|
|
109
|
+
invalid : false, validated: false, disabled : false
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// ─── Stories ───────────────────────────────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
export const Default = {
|
|
115
|
+
name : 'Default',
|
|
116
|
+
render: () => html`
|
|
117
|
+
<bd-custom-dropdown label="Select a plan" .options="${defaultOptions}" kind="md"></bd-custom-dropdown>
|
|
118
|
+
`,
|
|
119
|
+
parameters: { docs: { description: { story: 'Default dropdown with no validation state and no tooltip.' } } }
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const AllSizes = {
|
|
123
|
+
name : 'All Sizes',
|
|
124
|
+
render: () => html`
|
|
125
|
+
<div style="display:flex; flex-direction:column; gap:20px; max-width:400px;">
|
|
126
|
+
<bd-custom-dropdown label="Small" .options="${defaultOptions}" kind="sm"></bd-custom-dropdown>
|
|
127
|
+
<bd-custom-dropdown label="Medium" .options="${defaultOptions}" kind="md"></bd-custom-dropdown>
|
|
128
|
+
<bd-custom-dropdown label="Large" .options="${defaultOptions}" kind="lg"></bd-custom-dropdown>
|
|
129
|
+
</div>
|
|
130
|
+
`,
|
|
131
|
+
parameters: { docs: { description: { story: 'All three size variants stacked for comparison.' } } }
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const Required = {
|
|
135
|
+
name : 'Required',
|
|
136
|
+
render: () => html`
|
|
137
|
+
<bd-custom-dropdown label="Select a plan" .options="${defaultOptions}" kind="md" required></bd-custom-dropdown>
|
|
138
|
+
`,
|
|
139
|
+
parameters: { docs: { description: { story: 'Required field — shows a `*` after the label.' } } }
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const WithTooltip = {
|
|
143
|
+
name : 'With Tooltip / Help Text',
|
|
144
|
+
render: () => html`
|
|
145
|
+
<bd-custom-dropdown
|
|
146
|
+
label="Select a plan"
|
|
147
|
+
.options="${defaultOptions}"
|
|
148
|
+
kind="md"
|
|
149
|
+
tooltip="Choose the plan that best fits your needs."
|
|
150
|
+
></bd-custom-dropdown>
|
|
151
|
+
`,
|
|
152
|
+
parameters: { docs: { description: { story: 'Help text rendered below the select via the `tooltip` prop.' } } }
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const Invalid = {
|
|
156
|
+
name : 'Invalid State',
|
|
157
|
+
render: () => html`
|
|
158
|
+
<bd-custom-dropdown
|
|
159
|
+
label="Select a plan"
|
|
160
|
+
.options="${defaultOptions}"
|
|
161
|
+
kind="md"
|
|
162
|
+
invalid
|
|
163
|
+
tooltip="Please select a valid option."
|
|
164
|
+
></bd-custom-dropdown>
|
|
165
|
+
`,
|
|
166
|
+
parameters: { docs: { description: { story: 'Error state — applies `form-input--error` and `form-help-text--error` classes.' } } }
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const Validated = {
|
|
170
|
+
name : 'Validated State',
|
|
171
|
+
render: () => html`
|
|
172
|
+
<bd-custom-dropdown
|
|
173
|
+
label="Select a plan"
|
|
174
|
+
.options="${defaultOptions}"
|
|
175
|
+
kind="md"
|
|
176
|
+
validated
|
|
177
|
+
tooltip="Great choice!"
|
|
178
|
+
></bd-custom-dropdown>
|
|
179
|
+
`,
|
|
180
|
+
parameters: { docs: { description: { story: 'Success state — applies `form-input--success` and `form-help-text--success` classes.' } } }
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const Disabled = {
|
|
184
|
+
name : 'Disabled',
|
|
185
|
+
render: () => html`
|
|
186
|
+
<bd-custom-dropdown label="Select a plan" .options="${defaultOptions}" kind="md" disabled></bd-custom-dropdown>
|
|
187
|
+
`,
|
|
188
|
+
parameters: { docs: { description: { story: 'Disabled select — applies `form-input--disabled` class.' } } }
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export const AllStates = {
|
|
192
|
+
name : 'All Validation States',
|
|
193
|
+
render: () => html`
|
|
194
|
+
<div style="display:flex; flex-direction:column; gap:20px; max-width:400px;">
|
|
195
|
+
<bd-custom-dropdown label="Default" .options="${defaultOptions}" kind="md" tooltip="Default help text."></bd-custom-dropdown>
|
|
196
|
+
<bd-custom-dropdown label="Invalid" .options="${defaultOptions}" kind="md" invalid tooltip="This field has an error."></bd-custom-dropdown>
|
|
197
|
+
<bd-custom-dropdown label="Validated" .options="${defaultOptions}" kind="md" validated tooltip="Looks good!"></bd-custom-dropdown>
|
|
198
|
+
<bd-custom-dropdown label="Disabled" .options="${defaultOptions}" kind="md" disabled></bd-custom-dropdown>
|
|
199
|
+
</div>
|
|
200
|
+
`,
|
|
201
|
+
parameters: { docs: { description: { story: 'All four states stacked: default, invalid, validated, disabled.' } } }
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export const ManyOptions = {
|
|
205
|
+
name : 'Many Options',
|
|
206
|
+
render: () => html`
|
|
207
|
+
<bd-custom-dropdown
|
|
208
|
+
label="Select your country"
|
|
209
|
+
.options="${['Select country', 'Romania', 'Germany', 'France', 'Spain', 'Italy', 'Netherlands', 'Belgium', 'Poland', 'Sweden']}"
|
|
210
|
+
kind="md"
|
|
211
|
+
></bd-custom-dropdown>
|
|
212
|
+
`,
|
|
213
|
+
parameters: { docs: { description: { story: 'Dropdown with 10 options. Tests scroll behavior of the native select.' } } }
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const Playground = {
|
|
217
|
+
name : '🛝 Playground',
|
|
218
|
+
args : { ...defaultArgs },
|
|
219
|
+
render,
|
|
220
|
+
parameters: { docs: { description: { story: 'Fully interactive playground. Adjust all props via Controls.' } } }
|
|
221
|
+
};
|