@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,306 @@
1
+ import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ import { html } from 'lit';
3
+ import './rel-breadcrumb';
4
+
5
+ /**
6
+ * The Breadcrumbs component displays hierarchical navigation showing the user's location.
7
+ * Built with Lit web components for framework-agnostic usage.
8
+ *
9
+ * ## Features
10
+ * - **Hierarchical Navigation**: Shows path from root to current page
11
+ * - **Clickable Links**: All items except current page are clickable
12
+ * - **Chevron Separators**: Visual arrow separators between items
13
+ * - **Current Page Indicator**: Bold styling for current location
14
+ * - **Accessible**: Uses semantic nav and aria-label for screen readers
15
+ * - **Flexible**: Supports any number of navigation levels
16
+ */
17
+ const meta: Meta = {
18
+ title: 'Components/Breadcrumbs',
19
+ tags: ['autodocs'],
20
+ component: 'rel-breadcrumbs',
21
+ argTypes: {
22
+ items: {
23
+ control: 'object',
24
+ description: 'Array of breadcrumb items with label and optional url',
25
+ table: {
26
+ type: { summary: 'BreadcrumbItem[]' },
27
+ },
28
+ },
29
+ },
30
+ render: (args) => html`
31
+ <rel-breadcrumbs .items="${args.items}"></rel-breadcrumbs>
32
+ `,
33
+ };
34
+
35
+ export default meta;
36
+ type Story = StoryObj;
37
+
38
+ /**
39
+ * Simple breadcrumb - two levels
40
+ */
41
+ export const Simple: Story = {
42
+ args: {
43
+ items: [
44
+ { label: 'Home', url: '#' },
45
+ { label: 'Products' },
46
+ ],
47
+ },
48
+ };
49
+
50
+ /**
51
+ * Three levels - typical navigation depth
52
+ */
53
+ export const ThreeLevels: Story = {
54
+ args: {
55
+ items: [
56
+ { label: 'Home', url: '#' },
57
+ { label: 'Products', url: '#products' },
58
+ { label: 'Electronics' },
59
+ ],
60
+ },
61
+ };
62
+
63
+ /**
64
+ * Deep navigation - four levels
65
+ */
66
+ export const DeepNavigation: Story = {
67
+ args: {
68
+ items: [
69
+ { label: 'Home', url: '#' },
70
+ { label: 'Products', url: '#products' },
71
+ { label: 'Electronics', url: '#electronics' },
72
+ { label: 'Laptops' },
73
+ ],
74
+ },
75
+ };
76
+
77
+ /**
78
+ * Very deep - five levels
79
+ */
80
+ export const VeryDeep: Story = {
81
+ args: {
82
+ items: [
83
+ { label: 'Home', url: '#' },
84
+ { label: 'Products', url: '#products' },
85
+ { label: 'Electronics', url: '#electronics' },
86
+ { label: 'Laptops', url: '#laptops' },
87
+ { label: 'Gaming Laptops' },
88
+ ],
89
+ },
90
+ };
91
+
92
+ /**
93
+ * E-commerce example - product category navigation
94
+ */
95
+ export const EcommerceExample: Story = {
96
+ args: {
97
+ items: [
98
+ { label: 'Home', url: '#' },
99
+ { label: 'Shop', url: '#shop' },
100
+ { label: 'Electronics', url: '#electronics' },
101
+ { label: 'Computers', url: '#computers' },
102
+ { label: 'MacBook Pro 16"' },
103
+ ],
104
+ },
105
+ };
106
+
107
+ /**
108
+ * Documentation example - docs site navigation
109
+ */
110
+ export const DocumentationExample: Story = {
111
+ args: {
112
+ items: [
113
+ { label: 'Docs', url: '#docs' },
114
+ { label: 'Components', url: '#components' },
115
+ { label: 'Navigation', url: '#navigation' },
116
+ { label: 'Breadcrumbs' },
117
+ ],
118
+ },
119
+ };
120
+
121
+ /**
122
+ * Dashboard example - app navigation
123
+ */
124
+ export const DashboardExample: Story = {
125
+ args: {
126
+ items: [
127
+ { label: 'Dashboard', url: '#dashboard' },
128
+ { label: 'Users', url: '#users' },
129
+ { label: 'User Details' },
130
+ ],
131
+ },
132
+ };
133
+
134
+ /**
135
+ * Settings example - nested settings
136
+ */
137
+ export const SettingsExample: Story = {
138
+ args: {
139
+ items: [
140
+ { label: 'Settings', url: '#settings' },
141
+ { label: 'Account', url: '#account' },
142
+ { label: 'Privacy', url: '#privacy' },
143
+ { label: 'Data & Permissions' },
144
+ ],
145
+ },
146
+ };
147
+
148
+ /**
149
+ * File system example - file browser navigation
150
+ */
151
+ export const FileSystemExample: Story = {
152
+ args: {
153
+ items: [
154
+ { label: 'Root', url: '#' },
155
+ { label: 'Documents', url: '#documents' },
156
+ { label: 'Work', url: '#work' },
157
+ { label: 'Projects', url: '#projects' },
158
+ { label: '2024', url: '#2024' },
159
+ { label: 'Q4 Report.pdf' },
160
+ ],
161
+ },
162
+ };
163
+
164
+ /**
165
+ * Various depths - different navigation levels
166
+ */
167
+ export const VariousDepths: Story = {
168
+ render: () => html`
169
+ <div style="display: flex; flex-direction: column; gap: 24px; padding: 24px; background: #000;">
170
+ <div>
171
+ <p style="color: #00F49C; margin: 0 0 12px 0; font-weight: 600;">Two Levels</p>
172
+ <rel-breadcrumbs .items="${[
173
+ { label: 'Home', url: '#' },
174
+ { label: 'Products' },
175
+ ]}"></rel-breadcrumbs>
176
+ </div>
177
+
178
+ <div>
179
+ <p style="color: #00F49C; margin: 0 0 12px 0; font-weight: 600;">Three Levels</p>
180
+ <rel-breadcrumbs .items="${[
181
+ { label: 'Home', url: '#' },
182
+ { label: 'Products', url: '#products' },
183
+ { label: 'Electronics' },
184
+ ]}"></rel-breadcrumbs>
185
+ </div>
186
+
187
+ <div>
188
+ <p style="color: #00F49C; margin: 0 0 12px 0; font-weight: 600;">Four Levels</p>
189
+ <rel-breadcrumbs .items="${[
190
+ { label: 'Home', url: '#' },
191
+ { label: 'Products', url: '#products' },
192
+ { label: 'Electronics', url: '#electronics' },
193
+ { label: 'Laptops' },
194
+ ]}"></rel-breadcrumbs>
195
+ </div>
196
+
197
+ <div>
198
+ <p style="color: #00F49C; margin: 0 0 12px 0; font-weight: 600;">Five Levels</p>
199
+ <rel-breadcrumbs .items="${[
200
+ { label: 'Home', url: '#' },
201
+ { label: 'Products', url: '#products' },
202
+ { label: 'Electronics', url: '#electronics' },
203
+ { label: 'Laptops', url: '#laptops' },
204
+ { label: 'Gaming' },
205
+ ]}"></rel-breadcrumbs>
206
+ </div>
207
+ </div>
208
+ `,
209
+ };
210
+
211
+ /**
212
+ * Real-world use cases
213
+ */
214
+ export const RealWorldUseCases: Story = {
215
+ render: () => html`
216
+ <div style="display: flex; flex-direction: column; gap: 32px; padding: 24px; background: #000;">
217
+ <!-- E-commerce Product Page -->
218
+ <div>
219
+ <p style="color: #00F49C; margin: 0 0 8px 0; font-weight: 600; font-size: 16px;">E-commerce Product Page</p>
220
+ <p style="color: #999; margin: 0 0 12px 0; font-size: 12px;">User browsing a specific product</p>
221
+ <rel-breadcrumbs .items="${[
222
+ { label: 'Home', url: '#' },
223
+ { label: 'Men', url: '#men' },
224
+ { label: 'Clothing', url: '#clothing' },
225
+ { label: 'T-Shirts', url: '#t-shirts' },
226
+ { label: 'Classic Fit Cotton Tee' },
227
+ ]}"></rel-breadcrumbs>
228
+ </div>
229
+
230
+ <!-- Blog Article -->
231
+ <div>
232
+ <p style="color: #00F49C; margin: 0 0 8px 0; font-weight: 600; font-size: 16px;">Blog Article</p>
233
+ <p style="color: #999; margin: 0 0 12px 0; font-size: 12px;">User reading a blog post</p>
234
+ <rel-breadcrumbs .items="${[
235
+ { label: 'Blog', url: '#blog' },
236
+ { label: 'Technology', url: '#technology' },
237
+ { label: 'Web Development', url: '#web-dev' },
238
+ { label: 'Getting Started with Web Components' },
239
+ ]}"></rel-breadcrumbs>
240
+ </div>
241
+
242
+ <!-- Admin Panel -->
243
+ <div>
244
+ <p style="color: #00F49C; margin: 0 0 8px 0; font-weight: 600; font-size: 16px;">Admin Panel</p>
245
+ <p style="color: #999; margin: 0 0 12px 0; font-size: 12px;">Admin managing user permissions</p>
246
+ <rel-breadcrumbs .items="${[
247
+ { label: 'Admin', url: '#admin' },
248
+ { label: 'Users', url: '#users' },
249
+ { label: 'John Doe', url: '#user-123' },
250
+ { label: 'Permissions' },
251
+ ]}"></rel-breadcrumbs>
252
+ </div>
253
+
254
+ <!-- Help Center -->
255
+ <div>
256
+ <p style="color: #00F49C; margin: 0 0 8px 0; font-weight: 600; font-size: 16px;">Help Center</p>
257
+ <p style="color: #999; margin: 0 0 12px 0; font-size: 12px;">User searching for help</p>
258
+ <rel-breadcrumbs .items="${[
259
+ { label: 'Help Center', url: '#help' },
260
+ { label: 'Account & Billing', url: '#billing' },
261
+ { label: 'Subscriptions', url: '#subscriptions' },
262
+ { label: 'How to Cancel Your Subscription' },
263
+ ]}"></rel-breadcrumbs>
264
+ </div>
265
+ </div>
266
+ `,
267
+ };
268
+
269
+ /**
270
+ * Long labels - breadcrumbs with lengthy text
271
+ */
272
+ export const LongLabels: Story = {
273
+ args: {
274
+ items: [
275
+ { label: 'Home', url: '#' },
276
+ { label: 'Product Categories', url: '#categories' },
277
+ { label: 'Consumer Electronics and Gadgets', url: '#electronics' },
278
+ { label: 'High-Performance Gaming Laptops and Workstations' },
279
+ ],
280
+ },
281
+ };
282
+
283
+ /**
284
+ * Single item - minimal breadcrumb
285
+ */
286
+ export const SingleItem: Story = {
287
+ args: {
288
+ items: [
289
+ { label: 'Current Page' },
290
+ ],
291
+ },
292
+ };
293
+
294
+ /**
295
+ * Without URLs - non-clickable breadcrumbs
296
+ */
297
+ export const WithoutURLs: Story = {
298
+ args: {
299
+ items: [
300
+ { label: 'Step 1' },
301
+ { label: 'Step 2' },
302
+ { label: 'Step 3' },
303
+ { label: 'Step 4' },
304
+ ],
305
+ },
306
+ };
@@ -0,0 +1,97 @@
1
+ import { LitElement, html, css } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+
4
+ interface BreadcrumbItem {
5
+ label: string;
6
+ url?: string;
7
+ }
8
+
9
+ @customElement("rel-breadcrumbs")
10
+ export class RelBreadcrumbs extends LitElement {
11
+ @property({ type: Array }) items: BreadcrumbItem[] = [];
12
+
13
+ static styles = css`
14
+ :host {
15
+ display: block;
16
+ font-family: var(--rel-fontFamilies-primary);
17
+ font-size: var(--rel-fontSizes-md);
18
+ color: var(--rel-colors-gray-text);
19
+ }
20
+
21
+ nav {
22
+ display: block;
23
+ width: 100%;
24
+ }
25
+
26
+ ol {
27
+ display: flex;
28
+ flex-wrap: wrap;
29
+ padding: 0;
30
+ margin: 0;
31
+ list-style: none;
32
+ }
33
+
34
+ li {
35
+ display: flex;
36
+ align-items: center;
37
+ }
38
+
39
+ a {
40
+ text-decoration: none;
41
+ font-weight: var(--rel-fontWeights-medium);
42
+ color: var(--rel-colors-gray-heading);
43
+ transition: color 0.2s ease;
44
+ }
45
+
46
+ a:hover {
47
+ text-decoration: underline;
48
+ color: var(--rel-colors-primary);
49
+ }
50
+
51
+ .current {
52
+ font-weight: var(--rel-fontWeights-bold);
53
+ color: var(--rel-colors-black);
54
+ cursor: default;
55
+ }
56
+
57
+ svg {
58
+ stroke: var(--rel-colors-gray-text);
59
+ width: 16px;
60
+ height: 16px;
61
+ margin: 0 10px;
62
+ }
63
+ `;
64
+
65
+ render() {
66
+ return html`
67
+ <nav aria-label="Breadcrumb">
68
+ <ol>
69
+ ${this.items.map((item, index) => {
70
+ const last = index === this.items.length - 1;
71
+ return html`
72
+ <li>
73
+ ${item.url && !last
74
+ ? html`<a href="${item.url}">${item.label}</a>`
75
+ : html`<span class="current">${item.label}</span>`}
76
+ ${!last
77
+ ? html`
78
+ <svg viewBox="0 0 24 24">
79
+ <polyline
80
+ points="9 18 15 12 9 6"
81
+ fill="none"
82
+ stroke="currentColor"
83
+ stroke-width="2"
84
+ stroke-linecap="round"
85
+ stroke-linejoin="round"
86
+ ></polyline>
87
+ </svg>
88
+ `
89
+ : ""}
90
+ </li>
91
+ `;
92
+ })}
93
+ </ol>
94
+ </nav>
95
+ `;
96
+ }
97
+ }