@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,313 @@
1
+ import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ import { html } from 'lit';
3
+ import './rel-accordion';
4
+
5
+ /**
6
+ * The Accordion component allows users to toggle the visibility of content sections.
7
+ * Built with Lit web components for framework-agnostic usage.
8
+ *
9
+ * ## Features
10
+ * - **Expandable Sections**: Click to expand/collapse content
11
+ * - **Smooth Animation**: Fade-in effect when expanding
12
+ * - **Chevron Indicator**: Rotating chevron shows state
13
+ * - **Customizable Title**: Set accordion header text
14
+ * - **Slotted Content**: Any content can be placed inside
15
+ * - **Open State**: Can be initialized as open or closed
16
+ */
17
+ const meta: Meta = {
18
+ title: 'Components/Accordion',
19
+ tags: ['autodocs'],
20
+ component: 'rel-accordion',
21
+ argTypes: {
22
+ title: {
23
+ control: 'text',
24
+ description: 'Accordion header title',
25
+ table: {
26
+ defaultValue: { summary: 'Accordion' },
27
+ type: { summary: 'string' },
28
+ },
29
+ },
30
+ open: {
31
+ control: 'boolean',
32
+ description: 'Initial open state',
33
+ table: {
34
+ defaultValue: { summary: false },
35
+ type: { summary: 'boolean' },
36
+ },
37
+ },
38
+ },
39
+ render: (args) => html`
40
+ <rel-accordion
41
+ title="${args.title || 'Accordion'}"
42
+ ?open="${args.open}"
43
+ >
44
+ ${args.content || 'Accordion content goes here. This section can contain any type of content including text, images, or other components.'}
45
+ </rel-accordion>
46
+ `,
47
+ };
48
+
49
+ export default meta;
50
+ type Story = StoryObj;
51
+
52
+ /**
53
+ * Default accordion - closed by default
54
+ */
55
+ export const Default: Story = {
56
+ args: {
57
+ title: 'What is Reliability Design System?',
58
+ content: 'Reliability is a modern design system built with web components. It provides a comprehensive set of UI components that work across all JavaScript frameworks.',
59
+ open: false,
60
+ },
61
+ };
62
+
63
+ /**
64
+ * Open accordion - initially expanded
65
+ */
66
+ export const Open: Story = {
67
+ args: {
68
+ title: 'Frequently Asked Questions',
69
+ content: 'This accordion starts in an open state, showing its content immediately. Users can click to collapse it.',
70
+ open: true,
71
+ },
72
+ };
73
+
74
+ /**
75
+ * Simple text content
76
+ */
77
+ export const SimpleText: Story = {
78
+ args: {
79
+ title: 'Shipping Information',
80
+ content: 'We offer free shipping on all orders over $50. Standard delivery takes 3-5 business days.',
81
+ },
82
+ };
83
+
84
+ /**
85
+ * Long content - accordion with extensive text
86
+ */
87
+ export const LongContent: Story = {
88
+ args: {
89
+ title: 'Privacy Policy',
90
+ content: `We take your privacy seriously. This privacy policy explains how we collect, use, and protect your personal information.
91
+
92
+ Data Collection: We collect information you provide directly to us, such as when you create an account, make a purchase, or contact customer support.
93
+
94
+ Data Usage: We use your information to process transactions, improve our services, and communicate with you about your account.
95
+
96
+ Data Protection: We implement industry-standard security measures to protect your personal information from unauthorized access or disclosure.`,
97
+ },
98
+ };
99
+
100
+ /**
101
+ * Multiple accordions - FAQ section
102
+ */
103
+ export const FAQSection: Story = {
104
+ render: () => html`
105
+ <div style="display: flex; flex-direction: column; gap: 12px; padding: 24px; background: #000; max-width: 800px;">
106
+ <h2 style="color: #00F49C; margin: 0 0 16px 0;">Frequently Asked Questions</h2>
107
+
108
+ <rel-accordion title="What payment methods do you accept?">
109
+ We accept all major credit cards (Visa, MasterCard, American Express), PayPal, and Apple Pay.
110
+ </rel-accordion>
111
+
112
+ <rel-accordion title="How long does shipping take?">
113
+ Standard shipping takes 3-5 business days. Express shipping is available for 1-2 day delivery.
114
+ </rel-accordion>
115
+
116
+ <rel-accordion title="What is your return policy?">
117
+ We offer a 30-day money-back guarantee. Items must be returned in original condition with all tags attached.
118
+ </rel-accordion>
119
+
120
+ <rel-accordion title="Do you ship internationally?">
121
+ Yes, we ship to over 100 countries worldwide. Shipping costs and delivery times vary by location.
122
+ </rel-accordion>
123
+ </div>
124
+ `,
125
+ };
126
+
127
+ /**
128
+ * Product details - accordion for product information
129
+ */
130
+ export const ProductDetails: Story = {
131
+ render: () => html`
132
+ <div style="display: flex; flex-direction: column; gap: 12px; padding: 24px; background: #000; max-width: 800px;">
133
+ <h2 style="color: #00F49C; margin: 0 0 16px 0;">Product Information</h2>
134
+
135
+ <rel-accordion title="Description" open>
136
+ Premium wireless headphones with active noise cancellation, 30-hour battery life, and exceptional sound quality. Perfect for music lovers and frequent travelers.
137
+ </rel-accordion>
138
+
139
+ <rel-accordion title="Specifications">
140
+ <ul style="margin: 0; padding-left: 20px;">
141
+ <li>Driver Size: 40mm</li>
142
+ <li>Frequency Response: 20Hz - 20kHz</li>
143
+ <li>Impedance: 32 Ω</li>
144
+ <li>Battery Life: 30 hours</li>
145
+ <li>Charging Time: 2 hours</li>
146
+ <li>Weight: 250g</li>
147
+ </ul>
148
+ </rel-accordion>
149
+
150
+ <rel-accordion title="What's in the Box">
151
+ <ul style="margin: 0; padding-left: 20px;">
152
+ <li>Wireless Headphones</li>
153
+ <li>USB-C Charging Cable</li>
154
+ <li>3.5mm Audio Cable</li>
155
+ <li>Carrying Case</li>
156
+ <li>User Manual</li>
157
+ </ul>
158
+ </rel-accordion>
159
+ </div>
160
+ `,
161
+ };
162
+
163
+ /**
164
+ * Documentation sections
165
+ */
166
+ export const DocumentationSections: Story = {
167
+ render: () => html`
168
+ <div style="display: flex; flex-direction: column; gap: 12px; padding: 24px; background: #000; max-width: 800px;">
169
+ <h2 style="color: #00F49C; margin: 0 0 16px 0;">Component Documentation</h2>
170
+
171
+ <rel-accordion title="Installation" open>
172
+ Install the component via npm:
173
+ <pre style="background: #1A1A1A; padding: 12px; border-radius: 8px; margin-top: 12px;">
174
+ npm install @reliability/components
175
+ </pre>
176
+ </rel-accordion>
177
+
178
+ <rel-accordion title="Usage">
179
+ Import and use the accordion component in your application:
180
+ <pre style="background: #1A1A1A; padding: 12px; border-radius: 8px; margin-top: 12px;">
181
+ import '@reliability/components/accordion';
182
+
183
+ &lt;rel-accordion title="My Title"&gt;
184
+ Content here
185
+ &lt;/rel-accordion&gt;
186
+ </pre>
187
+ </rel-accordion>
188
+
189
+ <rel-accordion title="Properties">
190
+ <ul style="margin: 0; padding-left: 20px;">
191
+ <li><strong>title</strong>: string - Accordion header text</li>
192
+ <li><strong>open</strong>: boolean - Initial open/closed state</li>
193
+ </ul>
194
+ </rel-accordion>
195
+ </div>
196
+ `,
197
+ };
198
+
199
+ /**
200
+ * Settings panels
201
+ */
202
+ export const SettingsPanels: Story = {
203
+ render: () => html`
204
+ <div style="display: flex; flex-direction: column; gap: 12px; padding: 24px; background: #000; max-width: 800px;">
205
+ <h2 style="color: #00F49C; margin: 0 0 16px 0;">Account Settings</h2>
206
+
207
+ <rel-accordion title="Profile Settings">
208
+ <div style="display: flex; flex-direction: column; gap: 12px;">
209
+ <div>
210
+ <label style="display: block; margin-bottom: 4px; color: #fff; font-size: 14px;">Display Name</label>
211
+ <input type="text" value="John Doe" style="width: 100%; padding: 8px; border-radius: 4px; border: 1px solid #2A2A2A; background: #1A1A1A; color: #fff;">
212
+ </div>
213
+ <div>
214
+ <label style="display: block; margin-bottom: 4px; color: #fff; font-size: 14px;">Email</label>
215
+ <input type="email" value="john@example.com" style="width: 100%; padding: 8px; border-radius: 4px; border: 1px solid #2A2A2A; background: #1A1A1A; color: #fff;">
216
+ </div>
217
+ </div>
218
+ </rel-accordion>
219
+
220
+ <rel-accordion title="Privacy Settings">
221
+ <div style="display: flex; flex-direction: column; gap: 12px;">
222
+ <label style="display: flex; align-items: center; gap: 8px; color: #fff;">
223
+ <input type="checkbox" checked>
224
+ Make profile public
225
+ </label>
226
+ <label style="display: flex; align-items: center; gap: 8px; color: #fff;">
227
+ <input type="checkbox" checked>
228
+ Allow email notifications
229
+ </label>
230
+ <label style="display: flex; align-items: center; gap: 8px; color: #fff;">
231
+ <input type="checkbox">
232
+ Share analytics data
233
+ </label>
234
+ </div>
235
+ </rel-accordion>
236
+
237
+ <rel-accordion title="Notification Preferences">
238
+ <div style="display: flex; flex-direction: column; gap: 12px;">
239
+ <label style="display: flex; align-items: center; gap: 8px; color: #fff;">
240
+ <input type="checkbox" checked>
241
+ Email notifications
242
+ </label>
243
+ <label style="display: flex; align-items: center; gap: 8px; color: #fff;">
244
+ <input type="checkbox" checked>
245
+ Push notifications
246
+ </label>
247
+ <label style="display: flex; align-items: center; gap: 8px; color: #fff;">
248
+ <input type="checkbox">
249
+ SMS notifications
250
+ </label>
251
+ </div>
252
+ </rel-accordion>
253
+ </div>
254
+ `,
255
+ };
256
+
257
+ /**
258
+ * Rich content - accordion with various content types
259
+ */
260
+ export const RichContent: Story = {
261
+ render: () => html`
262
+ <div style="display: flex; flex-direction: column; gap: 12px; padding: 24px; background: #000; max-width: 800px;">
263
+ <rel-accordion title="Image Gallery" open>
264
+ <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px;">
265
+ <div style="aspect-ratio: 1; background: #2A2A2A; border-radius: 8px;"></div>
266
+ <div style="aspect-ratio: 1; background: #2A2A2A; border-radius: 8px;"></div>
267
+ <div style="aspect-ratio: 1; background: #2A2A2A; border-radius: 8px;"></div>
268
+ </div>
269
+ </rel-accordion>
270
+
271
+ <rel-accordion title="Video Tutorial">
272
+ <div style="aspect-ratio: 16/9; background: #2A2A2A; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #999; margin-top: 12px;">
273
+ Video Player Placeholder
274
+ </div>
275
+ </rel-accordion>
276
+
277
+ <rel-accordion title="Code Example">
278
+ <pre style="background: #1A1A1A; padding: 16px; border-radius: 8px; margin-top: 12px; overflow-x: auto;">
279
+ function greet(name) {
280
+ return \`Hello, \${name}!\`;
281
+ }
282
+
283
+ console.log(greet('World'));
284
+ </pre>
285
+ </rel-accordion>
286
+ </div>
287
+ `,
288
+ };
289
+
290
+ /**
291
+ * All states - various accordion configurations
292
+ */
293
+ export const AllStates: Story = {
294
+ render: () => html`
295
+ <div style="display: flex; flex-direction: column; gap: 12px; padding: 24px; background: #000; max-width: 800px;">
296
+ <rel-accordion title="Closed Accordion (Default)">
297
+ This accordion is closed by default. Click to expand.
298
+ </rel-accordion>
299
+
300
+ <rel-accordion title="Open Accordion" open>
301
+ This accordion is open by default. Click to collapse.
302
+ </rel-accordion>
303
+
304
+ <rel-accordion title="Short Content">
305
+ Brief content.
306
+ </rel-accordion>
307
+
308
+ <rel-accordion title="Long Title: This is an Example of a Very Long Accordion Title That Might Wrap">
309
+ Content for accordion with long title.
310
+ </rel-accordion>
311
+ </div>
312
+ `,
313
+ };
@@ -0,0 +1,114 @@
1
+ import { LitElement, html, css } from "lit";
2
+ import { customElement, property, state } from "lit/decorators.js";
3
+
4
+ @customElement("rel-accordion")
5
+ export class RelAccordion extends LitElement {
6
+ @property({ type: String }) title = "Accordion";
7
+ @property({ type: Boolean }) open = false;
8
+
9
+ static styles = css`
10
+ :host {
11
+ display: block;
12
+ width: 100%;
13
+ font-family: var(--rel-fontFamilies-primary);
14
+ }
15
+
16
+ .accordion {
17
+ background: var(--rel-colors-white);
18
+ border: 1px solid var(--rel-border-default);
19
+ border-radius: var(--rel-borders-radius-border-radius-200); /* 8px */
20
+ box-shadow: var(--rel-shadows-shadow-100);
21
+ transition: all 0.2s ease;
22
+ overflow: hidden;
23
+ }
24
+
25
+ /* HEADER --------------------------------------------------- */
26
+ .header {
27
+ display: flex;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ padding: var(--rel-spacing-space-md); /* 16px */
31
+ cursor: pointer;
32
+ user-select: none;
33
+ }
34
+
35
+ .title {
36
+ font-size: var(--rel-fontSizes-lg); /* 20px */
37
+ font-weight: var(--rel-fontWeights-medium);
38
+ color: var(--rel-colors-black);
39
+ }
40
+
41
+ /* ICON ----------------------------------------------------- */
42
+ .icon {
43
+ width: 20px;
44
+ height: 20px;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ transition: transform 0.25s ease;
49
+ }
50
+
51
+ .icon svg {
52
+ width: 20px;
53
+ height: 20px;
54
+ stroke: var(--rel-colors-gray-primary);
55
+ stroke-width: 2;
56
+ fill: none;
57
+ stroke-linecap: round;
58
+ stroke-linejoin: round;
59
+ }
60
+
61
+ .rotated {
62
+ transform: rotate(180deg);
63
+ }
64
+
65
+ /* BODY ------------------------------------------------------ */
66
+ .body {
67
+ padding: var(--rel-spacing-space-xl) var(--rel-spacing-space-md)
68
+ var(--rel-spacing-space-lg);
69
+ /* 24px 16px 20px */
70
+ font-size: var(--rel-fontSizes-lg); /* 20px */
71
+ color: var(--rel-colors-gray-primary);
72
+ animation: fadeIn 0.2s ease;
73
+ }
74
+
75
+ @keyframes fadeIn {
76
+ from {
77
+ opacity: 0;
78
+ transform: translateY(-4px);
79
+ }
80
+ to {
81
+ opacity: 1;
82
+ transform: translateY(0);
83
+ }
84
+ }
85
+ `;
86
+
87
+ private toggle() {
88
+ this.open = !this.open;
89
+ }
90
+
91
+ private chevron() {
92
+ return html`
93
+ <svg viewBox="0 0 24 24">
94
+ <polyline points="6 9 12 15 18 9"></polyline>
95
+ </svg>
96
+ `;
97
+ }
98
+
99
+ render() {
100
+ return html`
101
+ <div class="accordion">
102
+ <div class="header" @click=${this.toggle}>
103
+ <div class="title">${this.title}</div>
104
+
105
+ <div class="icon ${this.open ? "rotated" : ""}">
106
+ ${this.chevron()}
107
+ </div>
108
+ </div>
109
+
110
+ ${this.open ? html`<div class="body"><slot></slot></div>` : ""}
111
+ </div>
112
+ `;
113
+ }
114
+ }