@krollins/blueprint 0.1.11 → 0.1.13
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/accordion.js +393 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert.js +213 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/avatar.js +237 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.js +144 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.js +481 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.js +192 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/card.js +223 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox.js +337 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/color-picker.js +1660 -0
- package/dist/components/color-picker.js.map +1 -0
- package/dist/components/combobox.js +595 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/date-picker.js +726 -0
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/divider.js +214 -0
- package/dist/components/divider.js.map +1 -0
- package/dist/components/drawer.js +568 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown.js +377 -0
- package/dist/components/dropdown.js.map +1 -0
- package/dist/components/file-upload.js +669 -0
- package/dist/components/file-upload.js.map +1 -0
- package/dist/components/heading.js +161 -0
- package/dist/components/heading.js.map +1 -0
- package/dist/components/icon.js +599 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/input.js +363 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/link.js +178 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/menu.js +331 -0
- package/dist/components/menu.js.map +1 -0
- package/dist/components/modal.js +317 -0
- package/dist/components/modal.js.map +1 -0
- package/dist/components/multi-select.js +642 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/notification.js +429 -0
- package/dist/components/notification.js.map +1 -0
- package/dist/components/number-input.js +556 -0
- package/dist/components/number-input.js.map +1 -0
- package/dist/components/pagination.js +320 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.js +597 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.js +219 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio.js +321 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/select.js +498 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/skeleton.js +240 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.js +9 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/spinner.js +133 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stepper.js +812 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/switch.js +380 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.js +642 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.js +547 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tag.js +291 -0
- package/dist/components/tag.js.map +1 -0
- package/dist/components/text.js +278 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/textarea.js +380 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/time-picker.js +457 -0
- package/dist/components/time-picker.js.map +1 -0
- package/dist/components/tooltip.js +239 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/tree.js +582 -0
- package/dist/components/tree.js.map +1 -0
- package/dist/index.js +93 -17799
- package/dist/index.js.map +1 -1
- package/dist/shared/boolean-converter-XDGfS9LC.js +12 -0
- package/dist/shared/boolean-converter-XDGfS9LC.js.map +1 -0
- package/dist/shared/debounce-BckY30Sf.js +23 -0
- package/dist/shared/debounce-BckY30Sf.js.map +1 -0
- package/dist/shared/memoize-DlOFy-92.js +16 -0
- package/dist/shared/memoize-DlOFy-92.js.map +1 -0
- package/dist/shared/slider-BNt5TITl.js +484 -0
- package/dist/shared/slider-BNt5TITl.js.map +1 -0
- package/package.json +49 -3
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
import { css as v, LitElement as f, html as a, nothing as c } from "lit";
|
|
2
|
+
import { property as n, state as h, customElement as g } from "lit/decorators.js";
|
|
3
|
+
import { classMap as b } from "lit/directives/class-map.js";
|
|
4
|
+
import { b as u } from "../shared/boolean-converter-XDGfS9LC.js";
|
|
5
|
+
const m = v`
|
|
6
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
* Base Styles
|
|
8
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
font-family: var(--bp-font-family);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([disabled]) {
|
|
16
|
+
opacity: var(--bp-opacity-disabled);
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.stepper {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: var(--bp-spacing-lg);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
27
|
+
* Step List
|
|
28
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
29
|
+
|
|
30
|
+
.step-list {
|
|
31
|
+
display: flex;
|
|
32
|
+
gap: var(--bp-spacing-xs);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
36
|
+
* Individual Step
|
|
37
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
38
|
+
|
|
39
|
+
.step {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
flex: 1;
|
|
43
|
+
position: relative;
|
|
44
|
+
outline: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.step--clickable {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.step--clickable:focus-visible .step-indicator {
|
|
52
|
+
outline: var(--bp-focus-width) var(--bp-focus-style) var(--bp-color-focus);
|
|
53
|
+
outline-offset: var(--bp-focus-offset);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.step--disabled {
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
61
|
+
* Step Indicator (Number Circle)
|
|
62
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
63
|
+
|
|
64
|
+
.step-indicator {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
width: var(--bp-spacing-xl);
|
|
70
|
+
height: var(--bp-spacing-xl);
|
|
71
|
+
border-radius: 50%;
|
|
72
|
+
border: var(--bp-border-width) solid var(--bp-color-border);
|
|
73
|
+
background-color: var(--bp-color-surface);
|
|
74
|
+
color: var(--bp-color-text-muted);
|
|
75
|
+
font-size: var(--bp-font-size-sm);
|
|
76
|
+
font-weight: var(--bp-font-weight-medium);
|
|
77
|
+
position: relative;
|
|
78
|
+
transition:
|
|
79
|
+
background-color var(--bp-transition-fast),
|
|
80
|
+
border-color var(--bp-transition-fast),
|
|
81
|
+
color var(--bp-transition-fast);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Expand touch target to 44×44px for WCAG 2.2 AA compliance */
|
|
85
|
+
.step--clickable .step-indicator::after {
|
|
86
|
+
content: '';
|
|
87
|
+
position: absolute;
|
|
88
|
+
inset: calc((var(--bp-spacing-11) - var(--bp-spacing-xl)) / -2);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.step-indicator--current {
|
|
92
|
+
background-color: var(--bp-color-primary);
|
|
93
|
+
border-color: var(--bp-color-primary);
|
|
94
|
+
color: var(--bp-color-text-inverse);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.step-indicator--complete {
|
|
98
|
+
background-color: var(--bp-color-success);
|
|
99
|
+
border-color: var(--bp-color-success);
|
|
100
|
+
color: var(--bp-color-text-inverse);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.step-indicator--error {
|
|
104
|
+
background-color: var(--bp-color-error);
|
|
105
|
+
border-color: var(--bp-color-error);
|
|
106
|
+
color: var(--bp-color-text-inverse);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.step-number {
|
|
110
|
+
line-height: 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.step-icon {
|
|
114
|
+
width: var(--bp-spacing-md);
|
|
115
|
+
height: var(--bp-spacing-md);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
119
|
+
* Step Content (Label & Description)
|
|
120
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
121
|
+
|
|
122
|
+
.step-content {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
gap: var(--bp-spacing-2xs);
|
|
126
|
+
padding-left: var(--bp-spacing-sm);
|
|
127
|
+
padding-right: var(--bp-spacing-md);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.step-label {
|
|
131
|
+
font-size: var(--bp-font-size-sm);
|
|
132
|
+
font-weight: var(--bp-font-weight-medium);
|
|
133
|
+
color: var(--bp-color-text);
|
|
134
|
+
line-height: var(--bp-line-height-tight);
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
text-overflow: ellipsis;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.step--current .step-label {
|
|
141
|
+
color: var(--bp-color-primary);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.step--complete .step-label {
|
|
145
|
+
color: var(--bp-color-text);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.step--error .step-label {
|
|
149
|
+
color: var(--bp-color-error);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.step--disabled .step-label {
|
|
153
|
+
color: var(--bp-color-text-muted);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.step--pending .step-label {
|
|
157
|
+
color: var(--bp-color-text-muted);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.step-description {
|
|
161
|
+
font-size: var(--bp-font-size-xs);
|
|
162
|
+
color: var(--bp-color-text-muted);
|
|
163
|
+
line-height: var(--bp-line-height-normal);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.step-error {
|
|
167
|
+
font-size: var(--bp-font-size-xs);
|
|
168
|
+
color: var(--bp-color-error);
|
|
169
|
+
line-height: var(--bp-line-height-normal);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
173
|
+
* Connector Lines
|
|
174
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
175
|
+
|
|
176
|
+
.connector {
|
|
177
|
+
flex: 1;
|
|
178
|
+
height: calc(var(--bp-border-width) * 2);
|
|
179
|
+
background-color: var(--bp-color-border);
|
|
180
|
+
margin-top: calc(var(--bp-spacing-xl) / 2);
|
|
181
|
+
margin-left: var(--bp-spacing-sm);
|
|
182
|
+
margin-right: var(--bp-spacing-sm);
|
|
183
|
+
transition: background-color var(--bp-transition-fast);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.step--complete .connector {
|
|
187
|
+
background-color: var(--bp-color-success);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.step--error .connector {
|
|
191
|
+
background-color: var(--bp-color-error);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
195
|
+
* Horizontal Orientation (Default)
|
|
196
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
197
|
+
|
|
198
|
+
.stepper--horizontal .step-list {
|
|
199
|
+
flex-direction: row;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.stepper--horizontal .step {
|
|
203
|
+
flex-direction: row;
|
|
204
|
+
align-items: flex-start;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.stepper--horizontal .step-content {
|
|
208
|
+
max-width: var(--bp-spacing-24);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
212
|
+
* Vertical Orientation
|
|
213
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
214
|
+
|
|
215
|
+
.stepper--vertical .step-list {
|
|
216
|
+
flex-direction: column;
|
|
217
|
+
gap: 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.stepper--vertical .step {
|
|
221
|
+
flex-direction: row;
|
|
222
|
+
padding-bottom: var(--bp-spacing-lg);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.stepper--vertical .step:last-child {
|
|
226
|
+
padding-bottom: 0;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.stepper--vertical .step-content {
|
|
230
|
+
flex: 1;
|
|
231
|
+
padding-right: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.stepper--vertical .connector {
|
|
235
|
+
position: absolute;
|
|
236
|
+
left: calc(var(--bp-spacing-xl) / 2);
|
|
237
|
+
top: calc(var(--bp-spacing-xl) + var(--bp-spacing-xs));
|
|
238
|
+
bottom: 0;
|
|
239
|
+
width: calc(var(--bp-border-width) * 2);
|
|
240
|
+
height: auto;
|
|
241
|
+
margin: 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
245
|
+
* Size Variants
|
|
246
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
247
|
+
|
|
248
|
+
/* Small */
|
|
249
|
+
.stepper--sm .step-indicator {
|
|
250
|
+
width: var(--bp-spacing-lg);
|
|
251
|
+
height: var(--bp-spacing-lg);
|
|
252
|
+
font-size: var(--bp-font-size-xs);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.stepper--sm .step--clickable .step-indicator::after {
|
|
256
|
+
inset: calc((var(--bp-spacing-11) - var(--bp-spacing-lg)) / -2);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.stepper--sm .step-icon {
|
|
260
|
+
width: var(--bp-spacing-sm);
|
|
261
|
+
height: var(--bp-spacing-sm);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.stepper--sm .step-label {
|
|
265
|
+
font-size: var(--bp-font-size-xs);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.stepper--sm .step-description {
|
|
269
|
+
font-size: var(--bp-font-size-xs);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.stepper--sm .connector {
|
|
273
|
+
margin-top: calc(var(--bp-spacing-lg) / 2);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.stepper--sm.stepper--vertical .connector {
|
|
277
|
+
left: calc(var(--bp-spacing-lg) / 2);
|
|
278
|
+
top: calc(var(--bp-spacing-lg) + var(--bp-spacing-xs));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* Large */
|
|
282
|
+
.stepper--lg .step-indicator {
|
|
283
|
+
width: var(--bp-spacing-2xl);
|
|
284
|
+
height: var(--bp-spacing-2xl);
|
|
285
|
+
font-size: var(--bp-font-size-base);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.stepper--lg .step--clickable .step-indicator::after {
|
|
289
|
+
inset: calc((var(--bp-spacing-11) - var(--bp-spacing-2xl)) / -2);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.stepper--lg .step-icon {
|
|
293
|
+
width: var(--bp-spacing-lg);
|
|
294
|
+
height: var(--bp-spacing-lg);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.stepper--lg .step-label {
|
|
298
|
+
font-size: var(--bp-font-size-base);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.stepper--lg .step-description {
|
|
302
|
+
font-size: var(--bp-font-size-sm);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.stepper--lg .connector {
|
|
306
|
+
margin-top: calc(var(--bp-spacing-2xl) / 2);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.stepper--lg.stepper--vertical .connector {
|
|
310
|
+
left: calc(var(--bp-spacing-2xl) / 2);
|
|
311
|
+
top: calc(var(--bp-spacing-2xl) + var(--bp-spacing-xs));
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
315
|
+
* Panel
|
|
316
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
317
|
+
|
|
318
|
+
.panel {
|
|
319
|
+
padding: var(--bp-spacing-md);
|
|
320
|
+
background-color: var(--bp-color-surface);
|
|
321
|
+
border: var(--bp-border-width) solid var(--bp-color-border);
|
|
322
|
+
border-radius: var(--bp-border-radius-md);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.panel:not(.panel--has-content) {
|
|
326
|
+
display: none;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
330
|
+
* Actions
|
|
331
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
332
|
+
|
|
333
|
+
.actions {
|
|
334
|
+
display: flex;
|
|
335
|
+
gap: var(--bp-spacing-sm);
|
|
336
|
+
justify-content: flex-end;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.actions:empty {
|
|
340
|
+
display: none;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
344
|
+
* Navigation Buttons
|
|
345
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
346
|
+
|
|
347
|
+
.nav-button {
|
|
348
|
+
display: inline-flex;
|
|
349
|
+
align-items: center;
|
|
350
|
+
justify-content: center;
|
|
351
|
+
padding: var(--bp-spacing-sm) var(--bp-spacing-md);
|
|
352
|
+
font-family: var(--bp-font-family);
|
|
353
|
+
font-size: var(--bp-font-size-sm);
|
|
354
|
+
font-weight: var(--bp-font-weight-medium);
|
|
355
|
+
line-height: var(--bp-line-height-tight);
|
|
356
|
+
border-radius: var(--bp-border-radius-md);
|
|
357
|
+
cursor: pointer;
|
|
358
|
+
transition:
|
|
359
|
+
background-color var(--bp-transition-fast),
|
|
360
|
+
border-color var(--bp-transition-fast),
|
|
361
|
+
color var(--bp-transition-fast);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.nav-button--previous {
|
|
365
|
+
background-color: var(--bp-color-surface);
|
|
366
|
+
border: var(--bp-border-width) solid var(--bp-color-border);
|
|
367
|
+
color: var(--bp-color-text);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.nav-button--previous:hover:not(:disabled) {
|
|
371
|
+
background-color: var(--bp-color-surface-hover);
|
|
372
|
+
border-color: var(--bp-color-border-strong);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.nav-button--next {
|
|
376
|
+
background-color: var(--bp-color-primary);
|
|
377
|
+
border: var(--bp-border-width) solid var(--bp-color-primary);
|
|
378
|
+
color: var(--bp-color-text-inverse);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.nav-button--next:hover:not(:disabled) {
|
|
382
|
+
background-color: var(--bp-color-primary-hover);
|
|
383
|
+
border-color: var(--bp-color-primary-hover);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.nav-button:disabled {
|
|
387
|
+
opacity: var(--bp-opacity-disabled);
|
|
388
|
+
cursor: not-allowed;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.nav-button:focus-visible {
|
|
392
|
+
outline: var(--bp-focus-width) var(--bp-focus-style) var(--bp-color-focus);
|
|
393
|
+
outline-offset: var(--bp-focus-offset);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
397
|
+
* Hover States
|
|
398
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
399
|
+
|
|
400
|
+
.step--clickable:hover .step-indicator--pending {
|
|
401
|
+
border-color: var(--bp-color-border-strong);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.step--clickable:hover .step-indicator--complete {
|
|
405
|
+
background-color: var(--bp-color-success-hover);
|
|
406
|
+
border-color: var(--bp-color-success-hover);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.step--clickable:hover .step-indicator--current {
|
|
410
|
+
background-color: var(--bp-color-primary-hover);
|
|
411
|
+
border-color: var(--bp-color-primary-hover);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/* ─────────────────────────────────────────────────────────────────────────────
|
|
415
|
+
* Reduced Motion
|
|
416
|
+
* ───────────────────────────────────────────────────────────────────────────── */
|
|
417
|
+
|
|
418
|
+
@media (prefers-reduced-motion: reduce) {
|
|
419
|
+
.step-indicator,
|
|
420
|
+
.connector {
|
|
421
|
+
transition: none;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
`;
|
|
425
|
+
var S = Object.defineProperty, y = Object.getOwnPropertyDescriptor, p = (t, e, r, s) => {
|
|
426
|
+
for (var o = s > 1 ? void 0 : s ? y(e, r) : e, l = t.length - 1, d; l >= 0; l--)
|
|
427
|
+
(d = t[l]) && (o = (s ? d(e, r, o) : d(o)) || o);
|
|
428
|
+
return s && o && S(e, r, o), o;
|
|
429
|
+
};
|
|
430
|
+
let i = class extends f {
|
|
431
|
+
constructor() {
|
|
432
|
+
super(), this.completedSteps = /* @__PURE__ */ new Set(), this.errorSteps = /* @__PURE__ */ new Set(), this.panelHasContent = !1, this.steps = [], this.currentStep = 0, this.orientation = "horizontal", this.size = "md", this.linear = !0, this.disabled = !1, this.hideLabels = !1, this.clickable = !0, this.showNavigation = !0;
|
|
433
|
+
}
|
|
434
|
+
willUpdate(t) {
|
|
435
|
+
if (super.willUpdate(t), t.has("steps")) {
|
|
436
|
+
const e = /* @__PURE__ */ new Set();
|
|
437
|
+
this.steps.forEach((r, s) => {
|
|
438
|
+
r.error && e.add(s);
|
|
439
|
+
}), this.errorSteps = e;
|
|
440
|
+
}
|
|
441
|
+
if (t.has("currentStep")) {
|
|
442
|
+
const e = t.get("currentStep");
|
|
443
|
+
if (e !== void 0 && this.currentStep > e) {
|
|
444
|
+
const r = new Set(this.completedSteps);
|
|
445
|
+
for (let s = 0; s < this.currentStep; s++)
|
|
446
|
+
this.errorSteps.has(s) || r.add(s);
|
|
447
|
+
this.completedSteps = r;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Get the status of a step based on index
|
|
453
|
+
* @param index Zero-based step index
|
|
454
|
+
* @returns Step status (pending, current, complete, or error)
|
|
455
|
+
*/
|
|
456
|
+
_getStepStatus(t) {
|
|
457
|
+
return this.errorSteps.has(t) ? "error" : this.completedSteps.has(t) ? "complete" : t === this.currentStep ? "current" : t < this.currentStep ? "complete" : "pending";
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Check if a step is clickable based on linear mode and step state
|
|
461
|
+
* @param index Zero-based step index
|
|
462
|
+
* @param step Step configuration
|
|
463
|
+
* @returns True if the step can be clicked to navigate
|
|
464
|
+
*/
|
|
465
|
+
_isStepClickable(t, e) {
|
|
466
|
+
if (this.disabled || e.disabled || !this.clickable) return !1;
|
|
467
|
+
const r = this._getStepStatus(t);
|
|
468
|
+
return this.linear ? r === "complete" || t === this.currentStep : !0;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Handle click events on step indicators
|
|
472
|
+
* Validates clickability and emits bp-step-click event before navigating
|
|
473
|
+
* @param index Zero-based step index that was clicked
|
|
474
|
+
* @param step Step configuration
|
|
475
|
+
*/
|
|
476
|
+
_handleStepClick(t, e) {
|
|
477
|
+
if (!this._isStepClickable(t, e)) return;
|
|
478
|
+
const r = {
|
|
479
|
+
step: t,
|
|
480
|
+
stepId: e.id,
|
|
481
|
+
previousStep: this.currentStep
|
|
482
|
+
}, s = new CustomEvent("bp-step-click", {
|
|
483
|
+
detail: r,
|
|
484
|
+
bubbles: !0,
|
|
485
|
+
composed: !0
|
|
486
|
+
});
|
|
487
|
+
if (this.dispatchEvent(s), t !== this.currentStep) {
|
|
488
|
+
if (t < this.currentStep)
|
|
489
|
+
for (let o = t; o < this.steps.length; o++)
|
|
490
|
+
this.completedSteps.delete(o);
|
|
491
|
+
this.currentStep = t, this._emitStepChange(t, e);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Handle keyboard navigation on step indicators
|
|
496
|
+
* Supports Enter/Space for activation and Arrow keys for focus movement
|
|
497
|
+
* @param event Keyboard event
|
|
498
|
+
* @param index Zero-based step index
|
|
499
|
+
* @param step Step configuration
|
|
500
|
+
*/
|
|
501
|
+
_handleStepKeydown(t, e, r) {
|
|
502
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this._handleStepClick(e, r));
|
|
503
|
+
const s = this.orientation === "horizontal", o = s ? "ArrowLeft" : "ArrowUp", l = s ? "ArrowRight" : "ArrowDown";
|
|
504
|
+
t.key === o && e > 0 ? (t.preventDefault(), this._focusStep(e - 1)) : t.key === l && e < this.steps.length - 1 && (t.preventDefault(), this._focusStep(e + 1));
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Focus a specific step indicator element
|
|
508
|
+
* @param index Zero-based step index to focus
|
|
509
|
+
*/
|
|
510
|
+
_focusStep(t) {
|
|
511
|
+
this.shadowRoot?.querySelector(
|
|
512
|
+
`[data-step-index="${t}"]`
|
|
513
|
+
)?.focus();
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Emit bp-step-change event when navigating between steps
|
|
517
|
+
* @param index Zero-based step index navigated to
|
|
518
|
+
* @param step Step configuration
|
|
519
|
+
*/
|
|
520
|
+
_emitStepChange(t, e) {
|
|
521
|
+
const r = new CustomEvent("bp-step-change", {
|
|
522
|
+
detail: { step: t, stepId: e.id },
|
|
523
|
+
bubbles: !0,
|
|
524
|
+
composed: !0
|
|
525
|
+
});
|
|
526
|
+
this.dispatchEvent(r);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Navigate to the next step
|
|
530
|
+
*/
|
|
531
|
+
next() {
|
|
532
|
+
if (this.currentStep >= this.steps.length - 1 || this.disabled) return !1;
|
|
533
|
+
const t = this.steps[this.currentStep];
|
|
534
|
+
if (this.errorSteps.has(this.currentStep)) return !1;
|
|
535
|
+
this.completedSteps.add(this.currentStep), this.currentStep++, this._emitStepChange(this.currentStep, this.steps[this.currentStep]);
|
|
536
|
+
const e = new CustomEvent("bp-step-complete", {
|
|
537
|
+
detail: { step: this.currentStep - 1, stepId: t.id },
|
|
538
|
+
bubbles: !0,
|
|
539
|
+
composed: !0
|
|
540
|
+
});
|
|
541
|
+
return this.dispatchEvent(e), !0;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Navigate to the previous step
|
|
545
|
+
*/
|
|
546
|
+
previous() {
|
|
547
|
+
if (this.currentStep <= 0 || this.disabled) return !1;
|
|
548
|
+
for (let t = this.currentStep - 1; t < this.steps.length; t++)
|
|
549
|
+
this.completedSteps.delete(t);
|
|
550
|
+
return this.currentStep--, this._emitStepChange(this.currentStep, this.steps[this.currentStep]), !0;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Go to a specific step
|
|
554
|
+
*/
|
|
555
|
+
goToStep(t) {
|
|
556
|
+
if (t < 0 || t >= this.steps.length || this.disabled) return !1;
|
|
557
|
+
const e = this.steps[t];
|
|
558
|
+
if (e.disabled || this.linear && t > this.currentStep)
|
|
559
|
+
return !1;
|
|
560
|
+
if (t < this.currentStep)
|
|
561
|
+
for (let r = t; r < this.steps.length; r++)
|
|
562
|
+
this.completedSteps.delete(r);
|
|
563
|
+
return this.currentStep = t, this._emitStepChange(t, e), !0;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Mark a step as having an error
|
|
567
|
+
*/
|
|
568
|
+
setStepError(t, e) {
|
|
569
|
+
e ? (this.errorSteps.add(t), this.completedSteps.delete(t)) : this.errorSteps.delete(t), this.requestUpdate();
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Mark a step as complete
|
|
573
|
+
*/
|
|
574
|
+
setStepComplete(t, e) {
|
|
575
|
+
e ? (this.completedSteps.add(t), this.errorSteps.delete(t)) : this.completedSteps.delete(t), this.requestUpdate();
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Reset the stepper to the first step
|
|
579
|
+
*/
|
|
580
|
+
reset() {
|
|
581
|
+
this.currentStep = 0, this.completedSteps.clear(), this.errorSteps.clear(), this.requestUpdate();
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Check if we're on the first step
|
|
585
|
+
*/
|
|
586
|
+
get isFirstStep() {
|
|
587
|
+
return this.currentStep === 0;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Check if we're on the last step
|
|
591
|
+
*/
|
|
592
|
+
get isLastStep() {
|
|
593
|
+
return this.currentStep === this.steps.length - 1;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Get the current step configuration
|
|
597
|
+
*/
|
|
598
|
+
get currentStepConfig() {
|
|
599
|
+
return this.steps[this.currentStep];
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Render the step indicator (number circle with optional icon)
|
|
603
|
+
* Shows checkmark for complete, X for error, or step number for other states
|
|
604
|
+
* @param index Zero-based step index
|
|
605
|
+
* @param status Current step status
|
|
606
|
+
* @returns TemplateResult for step indicator
|
|
607
|
+
*/
|
|
608
|
+
_renderStepIndicator(t, e) {
|
|
609
|
+
const r = e === "complete", s = e === "error";
|
|
610
|
+
return a`
|
|
611
|
+
<div
|
|
612
|
+
class=${b({
|
|
613
|
+
"step-indicator": !0,
|
|
614
|
+
[`step-indicator--${e}`]: !0
|
|
615
|
+
})}
|
|
616
|
+
part="step-indicator"
|
|
617
|
+
>
|
|
618
|
+
${r ? a`<svg
|
|
619
|
+
class="step-icon"
|
|
620
|
+
viewBox="0 0 24 24"
|
|
621
|
+
fill="none"
|
|
622
|
+
stroke="currentColor"
|
|
623
|
+
stroke-width="3"
|
|
624
|
+
aria-hidden="true"
|
|
625
|
+
>
|
|
626
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
627
|
+
</svg>` : s ? a`<svg
|
|
628
|
+
class="step-icon"
|
|
629
|
+
viewBox="0 0 24 24"
|
|
630
|
+
fill="none"
|
|
631
|
+
stroke="currentColor"
|
|
632
|
+
stroke-width="2"
|
|
633
|
+
aria-hidden="true"
|
|
634
|
+
>
|
|
635
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
636
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
637
|
+
</svg>` : a`<span class="step-number">${t + 1}</span>`}
|
|
638
|
+
</div>
|
|
639
|
+
`;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Render a complete step with indicator, label, description, and connector
|
|
643
|
+
* @param step Step configuration
|
|
644
|
+
* @param index Zero-based step index
|
|
645
|
+
* @returns TemplateResult for step
|
|
646
|
+
*/
|
|
647
|
+
_renderStep(t, e) {
|
|
648
|
+
const r = this._getStepStatus(e), s = this._isStepClickable(e, t), o = e === this.steps.length - 1;
|
|
649
|
+
return a`
|
|
650
|
+
<div
|
|
651
|
+
class=${b({
|
|
652
|
+
step: !0,
|
|
653
|
+
[`step--${r}`]: !0,
|
|
654
|
+
"step--disabled": t.disabled || this.disabled,
|
|
655
|
+
"step--clickable": s
|
|
656
|
+
})}
|
|
657
|
+
part="step"
|
|
658
|
+
role="listitem"
|
|
659
|
+
data-step-index=${e}
|
|
660
|
+
tabindex=${s ? 0 : -1}
|
|
661
|
+
aria-current=${r === "current" ? "step" : "false"}
|
|
662
|
+
aria-disabled=${t.disabled || this.disabled ? "true" : "false"}
|
|
663
|
+
@click=${() => this._handleStepClick(e, t)}
|
|
664
|
+
@keydown=${(l) => this._handleStepKeydown(l, e, t)}
|
|
665
|
+
>
|
|
666
|
+
${this._renderStepIndicator(e, r)}
|
|
667
|
+
${this.hideLabels ? c : a`
|
|
668
|
+
<div class="step-content" part="step-content">
|
|
669
|
+
<span class="step-label" part="step-label" title=${t.label}
|
|
670
|
+
>${t.label}</span
|
|
671
|
+
>
|
|
672
|
+
${t.description ? a`<span class="step-description" part="step-description"
|
|
673
|
+
>${t.description}</span
|
|
674
|
+
>` : c}
|
|
675
|
+
${r === "error" && t.error ? a`<span class="step-error">${t.error}</span>` : c}
|
|
676
|
+
</div>
|
|
677
|
+
`}
|
|
678
|
+
${o ? c : a`<div class="connector" part="connector"></div>`}
|
|
679
|
+
</div>
|
|
680
|
+
`;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Handle slotchange on the panel slot to track whether content is provided
|
|
684
|
+
*/
|
|
685
|
+
_handlePanelSlotChange(t) {
|
|
686
|
+
const e = t.target;
|
|
687
|
+
this.panelHasContent = e.assignedNodes({ flatten: !0 }).length > 0;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Render the content panel for the current step
|
|
691
|
+
* Shows slotted content via step-{id} slot
|
|
692
|
+
* @returns TemplateResult for panel or nothing if no current step
|
|
693
|
+
*/
|
|
694
|
+
_renderPanel() {
|
|
695
|
+
const t = this.steps[this.currentStep];
|
|
696
|
+
return t ? a`
|
|
697
|
+
<div
|
|
698
|
+
class=${b({
|
|
699
|
+
panel: !0,
|
|
700
|
+
"panel--has-content": this.panelHasContent
|
|
701
|
+
})}
|
|
702
|
+
part="panel"
|
|
703
|
+
role="tabpanel"
|
|
704
|
+
>
|
|
705
|
+
<slot
|
|
706
|
+
name="step-${t.id}"
|
|
707
|
+
@slotchange=${this._handlePanelSlotChange}
|
|
708
|
+
></slot>
|
|
709
|
+
</div>
|
|
710
|
+
` : c;
|
|
711
|
+
}
|
|
712
|
+
render() {
|
|
713
|
+
return a`
|
|
714
|
+
<div
|
|
715
|
+
class=${b({
|
|
716
|
+
stepper: !0,
|
|
717
|
+
[`stepper--${this.orientation}`]: !0,
|
|
718
|
+
[`stepper--${this.size}`]: !0,
|
|
719
|
+
"stepper--disabled": this.disabled
|
|
720
|
+
})}
|
|
721
|
+
part="stepper"
|
|
722
|
+
>
|
|
723
|
+
<div
|
|
724
|
+
class="step-list"
|
|
725
|
+
part="step-list"
|
|
726
|
+
role="list"
|
|
727
|
+
aria-label="Progress steps"
|
|
728
|
+
>
|
|
729
|
+
${this.steps.map((t, e) => this._renderStep(t, e))}
|
|
730
|
+
</div>
|
|
731
|
+
${this._renderPanel()}
|
|
732
|
+
<div class="actions" part="actions">
|
|
733
|
+
<slot name="actions">
|
|
734
|
+
${this.showNavigation ? this._renderDefaultNavigation() : c}
|
|
735
|
+
</slot>
|
|
736
|
+
</div>
|
|
737
|
+
</div>
|
|
738
|
+
`;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Render default navigation buttons (Previous/Next)
|
|
742
|
+
* Only shown when showNavigation is true and no custom actions are slotted
|
|
743
|
+
*/
|
|
744
|
+
_renderDefaultNavigation() {
|
|
745
|
+
return a`
|
|
746
|
+
<button
|
|
747
|
+
class="nav-button nav-button--previous"
|
|
748
|
+
part="nav-button-previous"
|
|
749
|
+
?disabled=${this.isFirstStep || this.disabled}
|
|
750
|
+
@click=${() => this.previous()}
|
|
751
|
+
>
|
|
752
|
+
Previous
|
|
753
|
+
</button>
|
|
754
|
+
<button
|
|
755
|
+
class="nav-button nav-button--next"
|
|
756
|
+
part="nav-button-next"
|
|
757
|
+
?disabled=${this.isLastStep || this.disabled}
|
|
758
|
+
@click=${() => this.next()}
|
|
759
|
+
>
|
|
760
|
+
${this.isLastStep ? "Finish" : "Next"}
|
|
761
|
+
</button>
|
|
762
|
+
`;
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
i.styles = [m];
|
|
766
|
+
p([
|
|
767
|
+
n({ type: Array })
|
|
768
|
+
], i.prototype, "steps", 2);
|
|
769
|
+
p([
|
|
770
|
+
n({ type: Number, reflect: !0, attribute: "current-step" })
|
|
771
|
+
], i.prototype, "currentStep", 2);
|
|
772
|
+
p([
|
|
773
|
+
n({ type: String, reflect: !0 })
|
|
774
|
+
], i.prototype, "orientation", 2);
|
|
775
|
+
p([
|
|
776
|
+
n({ type: String, reflect: !0 })
|
|
777
|
+
], i.prototype, "size", 2);
|
|
778
|
+
p([
|
|
779
|
+
n({ converter: u, reflect: !0 })
|
|
780
|
+
], i.prototype, "linear", 2);
|
|
781
|
+
p([
|
|
782
|
+
n({ type: Boolean, reflect: !0 })
|
|
783
|
+
], i.prototype, "disabled", 2);
|
|
784
|
+
p([
|
|
785
|
+
n({ type: Boolean, reflect: !0, attribute: "hide-labels" })
|
|
786
|
+
], i.prototype, "hideLabels", 2);
|
|
787
|
+
p([
|
|
788
|
+
n({ converter: u, reflect: !0 })
|
|
789
|
+
], i.prototype, "clickable", 2);
|
|
790
|
+
p([
|
|
791
|
+
n({
|
|
792
|
+
converter: u,
|
|
793
|
+
reflect: !0,
|
|
794
|
+
attribute: "show-navigation"
|
|
795
|
+
})
|
|
796
|
+
], i.prototype, "showNavigation", 2);
|
|
797
|
+
p([
|
|
798
|
+
h()
|
|
799
|
+
], i.prototype, "completedSteps", 2);
|
|
800
|
+
p([
|
|
801
|
+
h()
|
|
802
|
+
], i.prototype, "errorSteps", 2);
|
|
803
|
+
p([
|
|
804
|
+
h()
|
|
805
|
+
], i.prototype, "panelHasContent", 2);
|
|
806
|
+
i = p([
|
|
807
|
+
g("bp-stepper")
|
|
808
|
+
], i);
|
|
809
|
+
export {
|
|
810
|
+
i as BpStepper
|
|
811
|
+
};
|
|
812
|
+
//# sourceMappingURL=stepper.js.map
|