@reliability-design/web 1.0.2

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 (60) hide show
  1. package/dist/components/rel-accordion/rel-accordion.stories.ts +313 -0
  2. package/dist/components/rel-accordion/rel-accordion.ts +114 -0
  3. package/dist/components/rel-alert/rel-alert.stories.ts +412 -0
  4. package/dist/components/rel-alert/rel-alert.ts +194 -0
  5. package/dist/components/rel-avatar/rel-avatar.stories.ts +327 -0
  6. package/dist/components/rel-avatar/rel-avatar.ts +100 -0
  7. package/dist/components/rel-badge/rel-badge.stories.ts +350 -0
  8. package/dist/components/rel-badge/rel-badge.ts +70 -0
  9. package/dist/components/rel-breadcrumb/rel-breadcrumb.stories.ts +306 -0
  10. package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +97 -0
  11. package/dist/components/rel-button/rel-button.stories.ts +356 -0
  12. package/dist/components/rel-button/rel-button.ts +204 -0
  13. package/dist/components/rel-card/rel-card.stories.ts +299 -0
  14. package/dist/components/rel-card/rel-card.ts +33 -0
  15. package/dist/components/rel-cardmedia/rel-cardmedia.stories.ts +368 -0
  16. package/dist/components/rel-cardmedia/rel-cardmedia.ts +80 -0
  17. package/dist/components/rel-checkbox/rel-checkbox.stories.ts +414 -0
  18. package/dist/components/rel-checkbox/rel-checkbox.ts +164 -0
  19. package/dist/components/rel-chip/rel-chip.stories.ts +552 -0
  20. package/dist/components/rel-chip/rel-chip.ts +261 -0
  21. package/dist/components/rel-container/rel-container.stories.ts +239 -0
  22. package/dist/components/rel-container/rel-container.ts +74 -0
  23. package/dist/components/rel-divider/rel-divider.stories.ts +229 -0
  24. package/dist/components/rel-divider/rel-divider.ts +44 -0
  25. package/dist/components/rel-layout/rel-layout.stories.ts +713 -0
  26. package/dist/components/rel-layout/rel-layout.ts +60 -0
  27. package/dist/components/rel-menu/rel-menu.stories.ts +910 -0
  28. package/dist/components/rel-menu/rel-menu.ts +319 -0
  29. package/dist/components/rel-progress/rel-progress.stories.ts +817 -0
  30. package/dist/components/rel-progress/rel-progress.ts +182 -0
  31. package/dist/components/rel-radio/rel-radio.stories.ts +1048 -0
  32. package/dist/components/rel-radio/rel-radio.ts +187 -0
  33. package/dist/components/rel-segmented-button/rel-segmented-button.stories.ts +1079 -0
  34. package/dist/components/rel-segmented-button/rel-segmented-button.ts +150 -0
  35. package/dist/components/rel-select/rel-select.stories.ts +1201 -0
  36. package/dist/components/rel-select/rel-select.ts +261 -0
  37. package/dist/components/rel-slider/rel-slider.stories.ts +730 -0
  38. package/dist/components/rel-slider/rel-slider.ts +440 -0
  39. package/dist/components/rel-snackbar/rel-snackbar.stories.ts +808 -0
  40. package/dist/components/rel-snackbar/rel-snackbar.ts +212 -0
  41. package/dist/components/rel-stepper/rel-stepper.stories.ts +752 -0
  42. package/dist/components/rel-stepper/rel-stepper.ts +425 -0
  43. package/dist/components/rel-switch/rel-switch.stories.ts +441 -0
  44. package/dist/components/rel-switch/rel-switch.ts +161 -0
  45. package/dist/components/rel-tab/rel-tab.stories.ts +492 -0
  46. package/dist/components/rel-tab/rel-tab.ts +145 -0
  47. package/dist/components/rel-textfield/rel-textfield.stories.ts +710 -0
  48. package/dist/components/rel-textfield/rel-textfield.ts +224 -0
  49. package/dist/components/rel-toast/rel-toast.stories.ts +394 -0
  50. package/dist/components/rel-toast/rel-toast.ts +154 -0
  51. package/dist/components/rel-tooltip/rel-tooltip.stories.ts +364 -0
  52. package/dist/components/rel-tooltip/rel-tooltip.ts +80 -0
  53. package/dist/index.d.mts +372 -0
  54. package/dist/index.d.ts +372 -0
  55. package/dist/index.js +4593 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/index.mjs +4544 -0
  58. package/dist/index.mjs.map +1 -0
  59. package/dist/styles/vars.css +184 -0
  60. package/package.json +32 -0
@@ -0,0 +1,356 @@
1
+ import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ import { html } from 'lit';
3
+ import './rel-button';
4
+
5
+ /**
6
+ * The Button component is a versatile interactive element that supports multiple variants,
7
+ * tones, sizes, and border styles. Built with Lit web components for framework-agnostic usage.
8
+ *
9
+ * ## Features
10
+ * - **6 Variants**: default, primary, secondary, text, link, icon
11
+ * - **3 Tones**: default, critical, success
12
+ * - **3 Sizes**: small (32px), medium (40px), large (48px)
13
+ * - **3 Border Styles**: corner-radius (pill), small-corner-radius, no-corner-radius
14
+ * - **Disabled State**: Full accessibility support
15
+ * - **Keyboard Navigation**: Focus ring and keyboard interactions
16
+ */
17
+ const meta: Meta = {
18
+ title: 'Components/Button',
19
+ tags: ['autodocs'],
20
+ component: 'rel-button',
21
+ argTypes: {
22
+ variant: {
23
+ control: { type: 'select' },
24
+ options: ['default', 'primary', 'secondary', 'text', 'link', 'icon'],
25
+ description: 'Visual style variant',
26
+ table: {
27
+ defaultValue: { summary: 'default' },
28
+ type: { summary: 'string' },
29
+ },
30
+ },
31
+ tone: {
32
+ control: { type: 'select' },
33
+ options: ['default', 'critical', 'success'],
34
+ description: 'Semantic tone for user feedback',
35
+ table: {
36
+ defaultValue: { summary: 'default' },
37
+ type: { summary: 'string' },
38
+ },
39
+ },
40
+ size: {
41
+ control: { type: 'select' },
42
+ options: ['small', 'medium', 'large'],
43
+ description: 'Button size',
44
+ table: {
45
+ defaultValue: { summary: 'medium' },
46
+ type: { summary: 'string' },
47
+ },
48
+ },
49
+ border: {
50
+ control: { type: 'select' },
51
+ options: ['corner-radius', 'small-corner-radius', 'no-corner-radius'],
52
+ description: 'Border radius style',
53
+ table: {
54
+ defaultValue: { summary: 'corner-radius' },
55
+ type: { summary: 'string' },
56
+ },
57
+ },
58
+ disabled: {
59
+ control: 'boolean',
60
+ description: 'Disabled state',
61
+ table: {
62
+ defaultValue: { summary: false },
63
+ type: { summary: 'boolean' },
64
+ },
65
+ },
66
+ },
67
+ render: (args) => html`
68
+ <rel-button
69
+ variant="${args.variant || 'default'}"
70
+ tone="${args.tone || 'default'}"
71
+ size="${args.size || 'medium'}"
72
+ border="${args.border || 'corner-radius'}"
73
+ ?disabled="${args.disabled}"
74
+ >
75
+ ${args.label || 'Button'}
76
+ </rel-button>
77
+ `,
78
+ };
79
+
80
+ export default meta;
81
+ type Story = StoryObj;
82
+
83
+ /**
84
+ * Default button with gray background - standard action button
85
+ */
86
+ export const Default: Story = {
87
+ args: {
88
+ variant: 'default',
89
+ tone: 'default',
90
+ size: 'medium',
91
+ label: 'Default Button',
92
+ },
93
+ };
94
+
95
+ /**
96
+ * Primary button with neon green background - main call-to-action
97
+ */
98
+ export const Primary: Story = {
99
+ args: {
100
+ variant: 'primary',
101
+ tone: 'default',
102
+ size: 'medium',
103
+ label: 'Primary Button',
104
+ },
105
+ };
106
+
107
+ /**
108
+ * Secondary button with white background and border - alternative action
109
+ */
110
+ export const Secondary: Story = {
111
+ args: {
112
+ variant: 'secondary',
113
+ size: 'medium',
114
+ label: 'Secondary Button',
115
+ },
116
+ };
117
+
118
+ /**
119
+ * Text button with transparent background - subtle action
120
+ */
121
+ export const Text: Story = {
122
+ args: {
123
+ variant: 'text',
124
+ size: 'medium',
125
+ label: 'Text Button',
126
+ },
127
+ };
128
+
129
+ /**
130
+ * Link button with underlined text - navigation action
131
+ */
132
+ export const Link: Story = {
133
+ args: {
134
+ variant: 'link',
135
+ size: 'medium',
136
+ label: 'Link Button',
137
+ },
138
+ };
139
+
140
+ /**
141
+ * Icon button with circular shape - icon-only action
142
+ */
143
+ export const Icon: Story = {
144
+ args: {
145
+ variant: 'icon',
146
+ label: '✓',
147
+ },
148
+ };
149
+
150
+ /**
151
+ * Critical tone - used for destructive or warning actions
152
+ */
153
+ export const Critical: Story = {
154
+ args: {
155
+ variant: 'primary',
156
+ tone: 'critical',
157
+ size: 'medium',
158
+ label: 'Delete Account',
159
+ },
160
+ };
161
+
162
+ /**
163
+ * Success tone - used for positive confirmation actions
164
+ */
165
+ export const Success: Story = {
166
+ args: {
167
+ variant: 'primary',
168
+ tone: 'success',
169
+ size: 'medium',
170
+ label: 'Confirm Payment',
171
+ },
172
+ };
173
+
174
+ /**
175
+ * Small size - compact button for tight layouts
176
+ */
177
+ export const Small: Story = {
178
+ args: {
179
+ variant: 'primary',
180
+ size: 'small',
181
+ label: 'Small Button',
182
+ },
183
+ };
184
+
185
+ /**
186
+ * Large size - prominent button for important actions
187
+ */
188
+ export const Large: Story = {
189
+ args: {
190
+ variant: 'primary',
191
+ size: 'large',
192
+ label: 'Large Button',
193
+ },
194
+ };
195
+
196
+ /**
197
+ * Disabled state - non-interactive button
198
+ */
199
+ export const Disabled: Story = {
200
+ args: {
201
+ variant: 'primary',
202
+ size: 'medium',
203
+ label: 'Disabled Button',
204
+ disabled: true,
205
+ },
206
+ };
207
+
208
+ /**
209
+ * Small corner radius - subtle rounded corners
210
+ */
211
+ export const SmallRadius: Story = {
212
+ args: {
213
+ variant: 'primary',
214
+ size: 'medium',
215
+ border: 'small-corner-radius',
216
+ label: 'Small Radius',
217
+ },
218
+ };
219
+
220
+ /**
221
+ * No corner radius - sharp rectangular edges
222
+ */
223
+ export const NoRadius: Story = {
224
+ args: {
225
+ variant: 'primary',
226
+ size: 'medium',
227
+ border: 'no-corner-radius',
228
+ label: 'No Radius',
229
+ },
230
+ };
231
+
232
+ /**
233
+ * All variants showcase - displays all button variants together
234
+ */
235
+ export const AllVariants: Story = {
236
+ render: () => html`
237
+ <div style="display: flex; flex-direction: column; gap: 24px; padding: 24px; background: #000;">
238
+ <div style="display: flex; gap: 16px; flex-wrap: wrap; align-items: center;">
239
+ <rel-button variant="default">Default</rel-button>
240
+ <rel-button variant="primary">Primary</rel-button>
241
+ <rel-button variant="secondary">Secondary</rel-button>
242
+ <rel-button variant="text">Text</rel-button>
243
+ <rel-button variant="link">Link</rel-button>
244
+ <rel-button variant="icon">✓</rel-button>
245
+ </div>
246
+ </div>
247
+ `,
248
+ };
249
+
250
+ /**
251
+ * All sizes showcase - displays all button sizes together
252
+ */
253
+ export const AllSizes: Story = {
254
+ render: () => html`
255
+ <div style="display: flex; gap: 16px; align-items: center; padding: 24px; background: #000;">
256
+ <rel-button variant="primary" size="small">Small (32px)</rel-button>
257
+ <rel-button variant="primary" size="medium">Medium (40px)</rel-button>
258
+ <rel-button variant="primary" size="large">Large (48px)</rel-button>
259
+ </div>
260
+ `,
261
+ };
262
+
263
+ /**
264
+ * All tones showcase - displays all semantic tones
265
+ */
266
+ export const AllTones: Story = {
267
+ render: () => html`
268
+ <div style="display: flex; gap: 16px; padding: 24px; background: #000;">
269
+ <rel-button variant="primary" tone="default">Default</rel-button>
270
+ <rel-button variant="primary" tone="critical">Critical</rel-button>
271
+ <rel-button variant="primary" tone="success">Success</rel-button>
272
+ </div>
273
+ `,
274
+ };
275
+
276
+ /**
277
+ * Border radius showcase - displays all border radius options
278
+ */
279
+ export const AllBorderStyles: Story = {
280
+ render: () => html`
281
+ <div style="display: flex; gap: 16px; padding: 24px; background: #000;">
282
+ <rel-button variant="primary" border="corner-radius">Pill Shape</rel-button>
283
+ <rel-button variant="primary" border="small-corner-radius">Small Radius</rel-button>
284
+ <rel-button variant="primary" border="no-corner-radius">No Radius</rel-button>
285
+ </div>
286
+ `,
287
+ };
288
+
289
+ /**
290
+ * Disabled states across variants
291
+ */
292
+ export const DisabledStates: Story = {
293
+ render: () => html`
294
+ <div style="display: flex; gap: 16px; padding: 24px; background: #000;">
295
+ <rel-button variant="default" disabled>Default</rel-button>
296
+ <rel-button variant="primary" disabled>Primary</rel-button>
297
+ <rel-button variant="secondary" disabled>Secondary</rel-button>
298
+ <rel-button variant="text" disabled>Text</rel-button>
299
+ </div>
300
+ `,
301
+ };
302
+
303
+ /**
304
+ * Text button with critical tone - destructive text action
305
+ */
306
+ export const TextCritical: Story = {
307
+ args: {
308
+ variant: 'text',
309
+ tone: 'critical',
310
+ label: 'Delete',
311
+ },
312
+ };
313
+
314
+ /**
315
+ * Text button with success tone - positive text action
316
+ */
317
+ export const TextSuccess: Story = {
318
+ args: {
319
+ variant: 'text',
320
+ tone: 'success',
321
+ label: 'Approve',
322
+ },
323
+ };
324
+
325
+ /**
326
+ * Link button with critical tone - destructive link action
327
+ */
328
+ export const LinkCritical: Story = {
329
+ args: {
330
+ variant: 'link',
331
+ tone: 'critical',
332
+ label: 'Remove Account',
333
+ },
334
+ };
335
+
336
+ /**
337
+ * Icon button with critical tone - destructive icon action
338
+ */
339
+ export const IconCritical: Story = {
340
+ args: {
341
+ variant: 'icon',
342
+ tone: 'critical',
343
+ label: '✕',
344
+ },
345
+ };
346
+
347
+ /**
348
+ * Icon button with success tone - positive icon action
349
+ */
350
+ export const IconSuccess: Story = {
351
+ args: {
352
+ variant: 'icon',
353
+ tone: 'success',
354
+ label: '✓',
355
+ },
356
+ };
@@ -0,0 +1,204 @@
1
+ import { LitElement, html, css } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+
4
+ @customElement("rel-button")
5
+ export class RelButton extends LitElement {
6
+ @property({ type: String }) variant:
7
+ | "default"
8
+ | "primary"
9
+ | "secondary"
10
+ | "text"
11
+ | "link"
12
+ | "icon" = "default";
13
+
14
+ @property({ type: String }) tone: "default" | "critical" | "success" =
15
+ "default";
16
+
17
+ @property({ type: String }) size: "small" | "medium" | "large" = "medium";
18
+
19
+ @property({ type: String }) border:
20
+ | "corner-radius"
21
+ | "small-corner-radius"
22
+ | "no-corner-radius" = "corner-radius";
23
+
24
+ @property({ type: Boolean, reflect: true }) disabled = false;
25
+
26
+ static styles = css`
27
+ :host {
28
+ display: inline-flex;
29
+ }
30
+
31
+ button {
32
+ font-family: var(--rel-fontFamilies-primary);
33
+ font-weight: var(--rel-fontWeights-semibold);
34
+ cursor: pointer;
35
+ border: none;
36
+ transition: all 0.15s ease;
37
+ display: inline-flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ gap: var(--rel-spacing-space-2xs);
41
+ outline: none;
42
+ }
43
+
44
+ /* -------------------------
45
+ SIZES (Figma)
46
+ -------------------------- */
47
+ .size-small {
48
+ height: 32px;
49
+ padding: 0 var(--rel-spacing-space-md);
50
+ font-size: var(--rel-fontSizes-sm);
51
+ }
52
+
53
+ .size-medium {
54
+ height: 40px;
55
+ padding: 0 var(--rel-spacing-space-lg);
56
+ font-size: var(--rel-fontSizes-md);
57
+ }
58
+
59
+ .size-large {
60
+ height: 48px;
61
+ padding: 0 var(--rel-spacing-space-xl);
62
+ font-size: var(--rel-fontSizes-lg);
63
+ }
64
+
65
+ /* -------------------------
66
+ BORDER RADII (Tokens)
67
+ -------------------------- */
68
+ .border-corner-radius {
69
+ border-radius: var(--rel-borders-radius-border-radius-500);
70
+ }
71
+
72
+ .border-small-corner-radius {
73
+ border-radius: var(--rel-borders-radius-border-radius-200);
74
+ }
75
+
76
+ .border-no-corner-radius {
77
+ border-radius: var(--rel-borders-radius-border-radius-0);
78
+ }
79
+
80
+ /* -------------------------
81
+ DISABLED STATE
82
+ -------------------------- */
83
+ :host([disabled]) button,
84
+ button:disabled {
85
+ cursor: not-allowed;
86
+ background-color: var(--rel-colors-gray-border) !important;
87
+ color: var(--rel-colors-gray-disabled-text) !important;
88
+ border-color: var(--rel-colors-gray-border) !important;
89
+ opacity: 1;
90
+ pointer-events: none;
91
+ }
92
+
93
+ /* -------------------------
94
+ VARIANTS & TONES
95
+ -------------------------- */
96
+
97
+ /* DEFAULT */
98
+ .btn-default.tone-default {
99
+ background: var(--rel-colors-gray-primary);
100
+ color: var(--rel-colors-white);
101
+ }
102
+ .btn-default.tone-critical {
103
+ background: var(--rel-colors-red-primary);
104
+ color: var(--rel-colors-white);
105
+ }
106
+ .btn-default.tone-success {
107
+ background: var(--rel-colors-green-success);
108
+ color: var(--rel-colors-white);
109
+ }
110
+
111
+ /* PRIMARY */
112
+ .btn-primary.tone-default {
113
+ background: var(--rel-colors-green-primary);
114
+ color: var(--rel-colors-black);
115
+ }
116
+ .btn-primary.tone-critical {
117
+ background: var(--rel-colors-red-primary);
118
+ color: var(--rel-colors-white);
119
+ }
120
+ .btn-primary.tone-success {
121
+ background: var(--rel-colors-green-success);
122
+ color: var(--rel-colors-white);
123
+ }
124
+
125
+ /* SECONDARY */
126
+ .btn-secondary {
127
+ background: var(--rel-colors-white);
128
+ border: 1px solid var(--rel-colors-black);
129
+ color: var(--rel-colors-black);
130
+ }
131
+
132
+ /* TEXT */
133
+ .btn-text {
134
+ background: transparent;
135
+ color: var(--rel-colors-black);
136
+ }
137
+
138
+ /* LINK */
139
+ .btn-link {
140
+ background: transparent;
141
+ color: var(--rel-colors-blue-primary);
142
+ text-decoration: underline;
143
+ }
144
+
145
+ /* ICON */
146
+ .btn-icon {
147
+ width: 40px;
148
+ height: 40px;
149
+ padding: 0;
150
+ border-radius: 50%;
151
+ background: var(--rel-colors-gray-light);
152
+ color: var(--rel-colors-black);
153
+ }
154
+
155
+ /* -------------------------
156
+ STATES: Hover / Active
157
+ -------------------------- */
158
+ button:hover:not(.btn-disabled) {
159
+ filter: brightness(0.92);
160
+ }
161
+
162
+ button:active:not(.btn-disabled) {
163
+ transform: scale(0.97);
164
+ }
165
+
166
+ /* TEXT BUTTON — hover border */
167
+ .btn-text:not(.btn-disabled):hover {
168
+ border: 1px solid var(--rel-colors-black);
169
+ text-decoration: none;
170
+ }
171
+
172
+ /* LINK BUTTON — hover border */
173
+ .btn-link:not(.btn-disabled):hover {
174
+ border: 1px solid var(--rel-colors-blue-primary);
175
+ text-decoration: underline;
176
+ }
177
+
178
+ /* -------------------------
179
+ FOCUS RING
180
+ -------------------------- */
181
+ button:focus-visible {
182
+ outline: 2px solid var(--rel-colors-blue-primary);
183
+ outline-offset: 2px;
184
+ }
185
+ `;
186
+
187
+ private get classes() {
188
+ return [
189
+ `btn-${this.variant}`,
190
+ `tone-${this.tone}`,
191
+ `size-${this.size}`,
192
+ `border-${this.border}`,
193
+ this.disabled ? "btn-disabled" : "",
194
+ ].join(" ");
195
+ }
196
+
197
+ render() {
198
+ return html`
199
+ <button class="${this.classes}" ?disabled=${this.disabled}>
200
+ <slot></slot>
201
+ </button>
202
+ `;
203
+ }
204
+ }