@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.
- package/dist/components/rel-accordion/rel-accordion.stories.ts +313 -0
- package/dist/components/rel-accordion/rel-accordion.ts +114 -0
- package/dist/components/rel-alert/rel-alert.stories.ts +412 -0
- package/dist/components/rel-alert/rel-alert.ts +194 -0
- package/dist/components/rel-avatar/rel-avatar.stories.ts +327 -0
- package/dist/components/rel-avatar/rel-avatar.ts +100 -0
- package/dist/components/rel-badge/rel-badge.stories.ts +350 -0
- package/dist/components/rel-badge/rel-badge.ts +70 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.stories.ts +306 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +97 -0
- package/dist/components/rel-button/rel-button.stories.ts +356 -0
- package/dist/components/rel-button/rel-button.ts +204 -0
- package/dist/components/rel-card/rel-card.stories.ts +299 -0
- package/dist/components/rel-card/rel-card.ts +33 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.stories.ts +368 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +80 -0
- package/dist/components/rel-checkbox/rel-checkbox.stories.ts +414 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +164 -0
- package/dist/components/rel-chip/rel-chip.stories.ts +552 -0
- package/dist/components/rel-chip/rel-chip.ts +261 -0
- package/dist/components/rel-container/rel-container.stories.ts +239 -0
- package/dist/components/rel-container/rel-container.ts +74 -0
- package/dist/components/rel-divider/rel-divider.stories.ts +229 -0
- package/dist/components/rel-divider/rel-divider.ts +44 -0
- package/dist/components/rel-layout/rel-layout.stories.ts +713 -0
- package/dist/components/rel-layout/rel-layout.ts +60 -0
- package/dist/components/rel-menu/rel-menu.stories.ts +910 -0
- package/dist/components/rel-menu/rel-menu.ts +319 -0
- package/dist/components/rel-progress/rel-progress.stories.ts +817 -0
- package/dist/components/rel-progress/rel-progress.ts +182 -0
- package/dist/components/rel-radio/rel-radio.stories.ts +1048 -0
- package/dist/components/rel-radio/rel-radio.ts +187 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.stories.ts +1079 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +150 -0
- package/dist/components/rel-select/rel-select.stories.ts +1201 -0
- package/dist/components/rel-select/rel-select.ts +261 -0
- package/dist/components/rel-slider/rel-slider.stories.ts +730 -0
- package/dist/components/rel-slider/rel-slider.ts +440 -0
- package/dist/components/rel-snackbar/rel-snackbar.stories.ts +808 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +212 -0
- package/dist/components/rel-stepper/rel-stepper.stories.ts +752 -0
- package/dist/components/rel-stepper/rel-stepper.ts +425 -0
- package/dist/components/rel-switch/rel-switch.stories.ts +441 -0
- package/dist/components/rel-switch/rel-switch.ts +161 -0
- package/dist/components/rel-tab/rel-tab.stories.ts +492 -0
- package/dist/components/rel-tab/rel-tab.ts +145 -0
- package/dist/components/rel-textfield/rel-textfield.stories.ts +710 -0
- package/dist/components/rel-textfield/rel-textfield.ts +224 -0
- package/dist/components/rel-toast/rel-toast.stories.ts +394 -0
- package/dist/components/rel-toast/rel-toast.ts +154 -0
- package/dist/components/rel-tooltip/rel-tooltip.stories.ts +364 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +80 -0
- package/dist/index.d.mts +372 -0
- package/dist/index.d.ts +372 -0
- package/dist/index.js +4593 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4544 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles/vars.css +184 -0
- package/package.json +32 -0
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
export type StepStatus = "done" | "progress" | "disabled";
|
|
5
|
+
export type TextAlign = "right" | "below";
|
|
6
|
+
export type Orientation = "horizontal" | "vertical";
|
|
7
|
+
export type StepperSize = "small" | "large";
|
|
8
|
+
|
|
9
|
+
export interface Step {
|
|
10
|
+
title: string;
|
|
11
|
+
status: StepStatus;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@customElement("rel-stepper")
|
|
15
|
+
export class RelStepper extends LitElement {
|
|
16
|
+
@property({ type: Array }) steps: Step[] = [];
|
|
17
|
+
|
|
18
|
+
@property({ type: String }) textAlign: TextAlign = "below";
|
|
19
|
+
|
|
20
|
+
@property({ type: String }) orientation: Orientation = "horizontal";
|
|
21
|
+
|
|
22
|
+
@property({ type: String }) size: StepperSize = "large";
|
|
23
|
+
|
|
24
|
+
static styles = css`
|
|
25
|
+
:host {
|
|
26
|
+
display: block;
|
|
27
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/********************************************
|
|
31
|
+
* Base Stepper Styles
|
|
32
|
+
********************************************/
|
|
33
|
+
.rel-stepper {
|
|
34
|
+
display: flex;
|
|
35
|
+
font-family: var(--rel-fontFamilies-primary);
|
|
36
|
+
width: 100%;
|
|
37
|
+
position: relative;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Orientation */
|
|
41
|
+
.rel-stepper.horizontal {
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.rel-stepper.vertical.text-below {
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: start;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.rel-stepper.vertical.text-right {
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
align-items: flex-start;
|
|
56
|
+
justify-content: start;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/********************************************
|
|
60
|
+
* Step Container
|
|
61
|
+
********************************************/
|
|
62
|
+
.rel-step {
|
|
63
|
+
display: flex;
|
|
64
|
+
position: relative;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.rel-stepper.horizontal.text-below .rel-step {
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
align-items: center;
|
|
70
|
+
text-align: center;
|
|
71
|
+
position: relative;
|
|
72
|
+
flex: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.rel-stepper.horizontal.text-right .rel-step {
|
|
76
|
+
flex-direction: row;
|
|
77
|
+
align-items: center;
|
|
78
|
+
position: relative;
|
|
79
|
+
flex: 0;
|
|
80
|
+
gap: var(--rel-spacing-space-2xs);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Vertical layout variants */
|
|
84
|
+
.rel-stepper.vertical.text-below .rel-step {
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: start;
|
|
88
|
+
position: relative;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.rel-stepper.vertical.text-right .rel-step {
|
|
92
|
+
flex-direction: row;
|
|
93
|
+
align-items: flex-start;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
position: relative;
|
|
96
|
+
gap: var(--rel-spacing-space-2xs);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Wrapper for indicator and connector */
|
|
100
|
+
.indicator-wrapper {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
align-items: center;
|
|
104
|
+
position: relative;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Wrapper for indicator and label (text-below only) */
|
|
108
|
+
.step-content {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: var(--rel-spacing-space-2xs);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.text-below-content {
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.text-right-content {
|
|
119
|
+
flex-direction: row;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/********************************************
|
|
123
|
+
* Indicator
|
|
124
|
+
********************************************/
|
|
125
|
+
.indicator {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
width: 22px;
|
|
130
|
+
height: 22px;
|
|
131
|
+
border: 2px solid var(--rel-colors-gray-border);
|
|
132
|
+
background: var(--rel-colors-white);
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
font-size: var(--rel-fontSizes-sm);
|
|
135
|
+
font-weight: var(--rel-fontWeights-medium);
|
|
136
|
+
position: relative;
|
|
137
|
+
z-index: 2;
|
|
138
|
+
transition: all 0.2s ease;
|
|
139
|
+
flex-shrink: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.indicator svg {
|
|
143
|
+
width: 12px;
|
|
144
|
+
height: auto;
|
|
145
|
+
display: block;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/********************************************
|
|
149
|
+
* Labels
|
|
150
|
+
********************************************/
|
|
151
|
+
.step-label {
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
font-size: var(--rel-fontSizes-sm);
|
|
154
|
+
color: var(--rel-colors-gray-paragraph);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Horizontal text-below specific */
|
|
158
|
+
.rel-stepper.horizontal.text-below .step-label {
|
|
159
|
+
margin-top: var(--rel-spacing-space-2xs);
|
|
160
|
+
text-align: center;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Horizontal text-right specific */
|
|
164
|
+
.rel-stepper.horizontal.text-right .step-label {
|
|
165
|
+
margin-top: 0;
|
|
166
|
+
margin-left: 0;
|
|
167
|
+
margin-right: var(--rel-spacing-space-xs);
|
|
168
|
+
text-align: left;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Vertical text-right specific */
|
|
172
|
+
.rel-stepper.vertical.text-right .step-label {
|
|
173
|
+
margin-top: 0;
|
|
174
|
+
margin-left: 0;
|
|
175
|
+
text-align: left;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Vertical text-below specific */
|
|
179
|
+
.rel-stepper.vertical.text-below .step-label {
|
|
180
|
+
margin-top: 0;
|
|
181
|
+
margin-left: 0;
|
|
182
|
+
text-align: center;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/********************************************
|
|
186
|
+
* Connector Lines
|
|
187
|
+
********************************************/
|
|
188
|
+
.connector {
|
|
189
|
+
position: absolute;
|
|
190
|
+
background: var(--rel-colors-gray-border);
|
|
191
|
+
z-index: 1;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* Horizontal connector */
|
|
195
|
+
.rel-stepper.horizontal .connector {
|
|
196
|
+
top: 50%;
|
|
197
|
+
left: 100%;
|
|
198
|
+
transform: translateY(-50%);
|
|
199
|
+
height: 2px;
|
|
200
|
+
position: absolute;
|
|
201
|
+
background: var(--rel-colors-gray-border);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.rel-stepper.horizontal .rel-step:last-child .connector {
|
|
205
|
+
display: none;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Vertical connectors */
|
|
209
|
+
.rel-stepper.vertical.text-below .connector {
|
|
210
|
+
top: 100%;
|
|
211
|
+
left: 50%;
|
|
212
|
+
transform: translateX(-50%);
|
|
213
|
+
width: 2px;
|
|
214
|
+
position: absolute;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.rel-stepper.vertical.text-right .connector {
|
|
218
|
+
top: 100%;
|
|
219
|
+
left: 50%;
|
|
220
|
+
transform: translateX(-50%);
|
|
221
|
+
width: 2px;
|
|
222
|
+
position: absolute;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.rel-stepper.vertical .rel-step:last-child .connector {
|
|
226
|
+
display: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.rel-stepper.vertical.text-right .rel-step:last-child .indicator-wrapper .connector {
|
|
230
|
+
display: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/********************************************
|
|
234
|
+
* Step States
|
|
235
|
+
********************************************/
|
|
236
|
+
.rel-step.done .indicator {
|
|
237
|
+
background: var(--rel-colors-black);
|
|
238
|
+
border-color: var(--rel-colors-black);
|
|
239
|
+
color: var(--rel-colors-white);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.rel-step.progress .indicator {
|
|
243
|
+
border-color: var(--rel-colors-black);
|
|
244
|
+
color: var(--rel-colors-black);
|
|
245
|
+
background: var(--rel-colors-white);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.rel-step.disabled .indicator {
|
|
249
|
+
background: var(--rel-colors-gray-bg-subtle);
|
|
250
|
+
border-color: var(--rel-colors-gray-border);
|
|
251
|
+
color: var(--rel-colors-gray-disabled);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.rel-step.done .connector {
|
|
255
|
+
background: var(--rel-colors-black);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.rel-step.progress .connector {
|
|
259
|
+
background: var(--rel-colors-black);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.rel-step.done .step-label {
|
|
263
|
+
color: var(--rel-colors-black);
|
|
264
|
+
font-weight: var(--rel-fontWeights-semibold);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.rel-step.progress .step-label {
|
|
268
|
+
color: var(--rel-colors-black);
|
|
269
|
+
font-weight: var(--rel-fontWeights-semibold);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.rel-step.disabled .step-label {
|
|
273
|
+
color: var(--rel-colors-gray-disabled);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/********************************************
|
|
277
|
+
* Size Property — controls connector length
|
|
278
|
+
********************************************/
|
|
279
|
+
/* Horizontal */
|
|
280
|
+
.rel-stepper.large.horizontal {
|
|
281
|
+
gap: 86px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.rel-stepper.small.horizontal {
|
|
285
|
+
gap: 60px;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.rel-stepper.large.horizontal .connector {
|
|
289
|
+
width: 86px;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.rel-stepper.small.horizontal .connector {
|
|
293
|
+
width: 60px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* Vertical */
|
|
297
|
+
.rel-stepper.large.vertical .connector {
|
|
298
|
+
height: 86px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.rel-stepper.large.vertical {
|
|
302
|
+
gap: 86px;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.rel-stepper.small.vertical .connector {
|
|
306
|
+
height: 42px;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.rel-stepper.small.vertical {
|
|
310
|
+
gap: 42px;
|
|
311
|
+
}
|
|
312
|
+
`;
|
|
313
|
+
|
|
314
|
+
private isDone(step: Step): boolean {
|
|
315
|
+
return step.status === "done";
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
private isProgress(step: Step): boolean {
|
|
319
|
+
return step.status === "progress";
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
private isDisabled(step: Step): boolean {
|
|
323
|
+
return step.status === "disabled";
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
private getStepClasses(step: Step): string {
|
|
327
|
+
const classes = ["rel-step"];
|
|
328
|
+
if (this.isDone(step)) classes.push("done");
|
|
329
|
+
if (this.isProgress(step)) classes.push("progress");
|
|
330
|
+
if (this.isDisabled(step)) classes.push("disabled");
|
|
331
|
+
return classes.join(" ");
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
private renderIndicator(step: Step, index: number) {
|
|
335
|
+
if (step.status === "done") {
|
|
336
|
+
return html`
|
|
337
|
+
<svg
|
|
338
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
339
|
+
width="14"
|
|
340
|
+
height="10"
|
|
341
|
+
viewBox="0 0 18 14"
|
|
342
|
+
fill="none"
|
|
343
|
+
class="check-icon"
|
|
344
|
+
>
|
|
345
|
+
<path
|
|
346
|
+
d="M6.44479 14L0.5 7.36383L1.9862 5.70478L6.44479 10.6819L16.0138 0L17.5 1.65904L6.44479 14Z"
|
|
347
|
+
fill="white"
|
|
348
|
+
/>
|
|
349
|
+
</svg>
|
|
350
|
+
`;
|
|
351
|
+
}
|
|
352
|
+
return html`<span>${index + 1}</span>`;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
render() {
|
|
356
|
+
const stepperClasses = [
|
|
357
|
+
"rel-stepper",
|
|
358
|
+
this.orientation === "vertical" ? "vertical" : "horizontal",
|
|
359
|
+
this.textAlign === "below" ? "text-below" : "text-right",
|
|
360
|
+
this.size === "small" ? "small" : "large",
|
|
361
|
+
]
|
|
362
|
+
.filter(Boolean)
|
|
363
|
+
.join(" ");
|
|
364
|
+
|
|
365
|
+
const isVertical = this.orientation === "vertical";
|
|
366
|
+
const isTextRight = this.textAlign === "right";
|
|
367
|
+
|
|
368
|
+
return html`
|
|
369
|
+
<div class="${stepperClasses}">
|
|
370
|
+
${this.steps.map(
|
|
371
|
+
(step, idx) => html`
|
|
372
|
+
<div class="${this.getStepClasses(step)}">
|
|
373
|
+
${isVertical && isTextRight
|
|
374
|
+
? html`
|
|
375
|
+
<!-- Indicator with connector below -->
|
|
376
|
+
<div class="indicator-wrapper">
|
|
377
|
+
<div class="indicator">
|
|
378
|
+
${this.renderIndicator(step, idx)}
|
|
379
|
+
</div>
|
|
380
|
+
${idx < this.steps.length - 1
|
|
381
|
+
? html`<div class="connector"></div>`
|
|
382
|
+
: ""}
|
|
383
|
+
</div>
|
|
384
|
+
|
|
385
|
+
<!-- Step Label to the right -->
|
|
386
|
+
<div class="step-label">${step.title}</div>
|
|
387
|
+
`
|
|
388
|
+
: isVertical
|
|
389
|
+
? html`
|
|
390
|
+
<div class="step-content text-below-content">
|
|
391
|
+
<!-- Step Indicator -->
|
|
392
|
+
<div class="indicator">
|
|
393
|
+
${this.renderIndicator(step, idx)}
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
<!-- Step Label -->
|
|
397
|
+
<div class="step-label">${step.title}</div>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
<!-- Connector -->
|
|
401
|
+
${idx < this.steps.length - 1
|
|
402
|
+
? html`<div class="connector"></div>`
|
|
403
|
+
: ""}
|
|
404
|
+
`
|
|
405
|
+
: html`
|
|
406
|
+
<!-- Step Indicator -->
|
|
407
|
+
<div class="indicator">
|
|
408
|
+
${this.renderIndicator(step, idx)}
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
<!-- Step Label -->
|
|
412
|
+
<div class="step-label">${step.title}</div>
|
|
413
|
+
|
|
414
|
+
<!-- Connector (for horizontal only) -->
|
|
415
|
+
${!isVertical && idx < this.steps.length - 1
|
|
416
|
+
? html`<div class="connector"></div>`
|
|
417
|
+
: ""}
|
|
418
|
+
`}
|
|
419
|
+
</div>
|
|
420
|
+
`
|
|
421
|
+
)}
|
|
422
|
+
</div>
|
|
423
|
+
`;
|
|
424
|
+
}
|
|
425
|
+
}
|