@duskmoon-dev/el-stepper 0.4.0
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/cjs/index.js +467 -0
- package/dist/cjs/index.js.map +11 -0
- package/dist/cjs/register.js +470 -0
- package/dist/cjs/register.js.map +12 -0
- package/dist/esm/index.js +435 -0
- package/dist/esm/index.js.map +11 -0
- package/dist/esm/register.js +433 -0
- package/dist/esm/register.js.map +12 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/el-dm-stepper.d.ts +121 -0
- package/dist/types/el-dm-stepper.d.ts.map +1 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/register.d.ts +2 -0
- package/dist/types/register.d.ts.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
// src/el-dm-stepper.ts
|
|
2
|
+
import { BaseElement, css } from "@duskmoon-dev/el-core";
|
|
3
|
+
var COLOR_MAP = {
|
|
4
|
+
primary: "var(--color-primary)",
|
|
5
|
+
secondary: "var(--color-secondary)",
|
|
6
|
+
tertiary: "var(--color-tertiary)",
|
|
7
|
+
success: "var(--color-success)",
|
|
8
|
+
warning: "var(--color-warning)",
|
|
9
|
+
error: "var(--color-error)",
|
|
10
|
+
info: "var(--color-info)"
|
|
11
|
+
};
|
|
12
|
+
var styles = css`
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
font-family: var(--font-family-sans, system-ui, sans-serif);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([hidden]) {
|
|
19
|
+
display: none !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.stepper {
|
|
23
|
+
display: flex;
|
|
24
|
+
gap: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.stepper--horizontal {
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
align-items: flex-start;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.stepper--vertical {
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.step {
|
|
37
|
+
display: flex;
|
|
38
|
+
position: relative;
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.stepper--horizontal .step {
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
text-align: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.stepper--vertical .step {
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
align-items: flex-start;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.step-header {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
position: relative;
|
|
57
|
+
z-index: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.stepper--horizontal .step-header {
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
width: 100%;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.stepper--vertical .step-header {
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
min-height: 4rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.step-indicator-wrapper {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
position: relative;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.stepper--horizontal .step-indicator-wrapper {
|
|
77
|
+
width: 100%;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.step-indicator {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
width: 2rem;
|
|
86
|
+
height: 2rem;
|
|
87
|
+
border-radius: 50%;
|
|
88
|
+
font-size: 0.875rem;
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
transition: all 0.2s ease;
|
|
92
|
+
background-color: var(--color-surface-variant, #e0e0e0);
|
|
93
|
+
color: var(--color-on-surface-variant, #666);
|
|
94
|
+
border: 2px solid transparent;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.step--clickable .step-indicator {
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.step--clickable .step-indicator:hover {
|
|
102
|
+
transform: scale(1.1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.step--completed .step-indicator {
|
|
106
|
+
background-color: var(--stepper-color, var(--color-primary));
|
|
107
|
+
color: var(--color-on-primary, #fff);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.step--current .step-indicator {
|
|
111
|
+
background-color: var(--color-surface, #fff);
|
|
112
|
+
color: var(--stepper-color, var(--color-primary));
|
|
113
|
+
border-color: var(--stepper-color, var(--color-primary));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.step--upcoming .step-indicator {
|
|
117
|
+
background-color: var(--color-surface-variant, #e0e0e0);
|
|
118
|
+
color: var(--color-on-surface-variant, #666);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.step-content {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
gap: 0.25rem;
|
|
125
|
+
padding: 0.5rem 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.stepper--horizontal .step-content {
|
|
129
|
+
align-items: center;
|
|
130
|
+
padding: 0.5rem 0.5rem 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.stepper--vertical .step-content {
|
|
134
|
+
padding-left: 0.75rem;
|
|
135
|
+
padding-top: 0.25rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.step-label {
|
|
139
|
+
font-size: 0.875rem;
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
color: var(--color-on-surface, #1a1a1a);
|
|
142
|
+
transition: color 0.2s ease;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.step--clickable .step-label {
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.step--upcoming .step-label {
|
|
150
|
+
color: var(--color-on-surface-variant, #666);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.step--current .step-label {
|
|
154
|
+
color: var(--stepper-color, var(--color-primary));
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.step-description {
|
|
159
|
+
font-size: 0.75rem;
|
|
160
|
+
color: var(--color-on-surface-variant, #666);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Connector lines */
|
|
164
|
+
.connector {
|
|
165
|
+
position: absolute;
|
|
166
|
+
background-color: var(--color-surface-variant, #e0e0e0);
|
|
167
|
+
transition: background-color 0.2s ease;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.step--completed .connector {
|
|
171
|
+
background-color: var(--stepper-color, var(--color-primary));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.stepper--horizontal .connector {
|
|
175
|
+
height: 2px;
|
|
176
|
+
top: 1rem;
|
|
177
|
+
left: calc(50% + 1rem + 0.25rem);
|
|
178
|
+
right: calc(-50% + 1rem + 0.25rem);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.stepper--horizontal .step:last-child .connector {
|
|
182
|
+
display: none;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.stepper--vertical .connector {
|
|
186
|
+
width: 2px;
|
|
187
|
+
left: calc(1rem - 1px);
|
|
188
|
+
top: 2.5rem;
|
|
189
|
+
bottom: 0.5rem;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.stepper--vertical .step:last-child .connector {
|
|
193
|
+
display: none;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Icon support */
|
|
197
|
+
.step-icon {
|
|
198
|
+
font-size: 1rem;
|
|
199
|
+
line-height: 1;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Completed checkmark */
|
|
203
|
+
.step--completed .step-indicator::after {
|
|
204
|
+
content: '';
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
|
|
208
|
+
class ElDmStepper extends BaseElement {
|
|
209
|
+
static properties = {
|
|
210
|
+
steps: { type: Array, reflect: false, default: [] },
|
|
211
|
+
current: { type: Number, reflect: true, default: 0 },
|
|
212
|
+
orientation: { type: String, reflect: true, default: "horizontal" },
|
|
213
|
+
color: { type: String, reflect: true, default: "primary" },
|
|
214
|
+
clickable: { type: Boolean, reflect: true, default: false }
|
|
215
|
+
};
|
|
216
|
+
constructor() {
|
|
217
|
+
super();
|
|
218
|
+
this.attachStyles(styles);
|
|
219
|
+
}
|
|
220
|
+
connectedCallback() {
|
|
221
|
+
super.connectedCallback();
|
|
222
|
+
this.addEventListener("click", this._handleClick.bind(this));
|
|
223
|
+
}
|
|
224
|
+
disconnectedCallback() {
|
|
225
|
+
super.disconnectedCallback();
|
|
226
|
+
this.removeEventListener("click", this._handleClick.bind(this));
|
|
227
|
+
}
|
|
228
|
+
_handleClick(e) {
|
|
229
|
+
if (!this.clickable)
|
|
230
|
+
return;
|
|
231
|
+
const target = e.target;
|
|
232
|
+
const stepEl = target.closest("[data-step-index]");
|
|
233
|
+
if (!stepEl)
|
|
234
|
+
return;
|
|
235
|
+
const index = parseInt(stepEl.dataset.stepIndex || "0", 10);
|
|
236
|
+
if (index !== this.current) {
|
|
237
|
+
const oldValue = this.current;
|
|
238
|
+
this.current = index;
|
|
239
|
+
this.emit("change", { current: index, previous: oldValue });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
_getStepState(index) {
|
|
243
|
+
if (index < this.current)
|
|
244
|
+
return "completed";
|
|
245
|
+
if (index === this.current)
|
|
246
|
+
return "current";
|
|
247
|
+
return "upcoming";
|
|
248
|
+
}
|
|
249
|
+
_renderStepIndicator(step, index, state) {
|
|
250
|
+
if (state === "completed") {
|
|
251
|
+
return step.icon ? `<span class="step-icon">${step.icon}</span>` : `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>`;
|
|
252
|
+
}
|
|
253
|
+
if (step.icon) {
|
|
254
|
+
return `<span class="step-icon">${step.icon}</span>`;
|
|
255
|
+
}
|
|
256
|
+
return `${index + 1}`;
|
|
257
|
+
}
|
|
258
|
+
render() {
|
|
259
|
+
const stepsArray = Array.isArray(this.steps) ? this.steps : [];
|
|
260
|
+
const colorValue = COLOR_MAP[this.color] || COLOR_MAP.primary;
|
|
261
|
+
const stepsHtml = stepsArray.map((step, index) => {
|
|
262
|
+
const state = this._getStepState(index);
|
|
263
|
+
const stateClass = `step--${state}`;
|
|
264
|
+
const clickableClass = this.clickable ? "step--clickable" : "";
|
|
265
|
+
return `
|
|
266
|
+
<div
|
|
267
|
+
class="step ${stateClass} ${clickableClass}"
|
|
268
|
+
data-step-index="${index}"
|
|
269
|
+
part="step"
|
|
270
|
+
>
|
|
271
|
+
<div class="step-header">
|
|
272
|
+
<div class="step-indicator-wrapper">
|
|
273
|
+
<div class="step-indicator" part="indicator">
|
|
274
|
+
${this._renderStepIndicator(step, index, state)}
|
|
275
|
+
</div>
|
|
276
|
+
<div class="connector" part="connector"></div>
|
|
277
|
+
</div>
|
|
278
|
+
<div class="step-content" part="content">
|
|
279
|
+
<span class="step-label" part="label">${step.label}</span>
|
|
280
|
+
${step.description ? `<span class="step-description" part="description">${step.description}</span>` : ""}
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
`;
|
|
285
|
+
}).join("");
|
|
286
|
+
return `
|
|
287
|
+
<div
|
|
288
|
+
class="stepper stepper--${this.orientation}"
|
|
289
|
+
style="--stepper-color: ${colorValue}"
|
|
290
|
+
role="navigation"
|
|
291
|
+
aria-label="Progress steps"
|
|
292
|
+
part="stepper"
|
|
293
|
+
>
|
|
294
|
+
${stepsHtml}
|
|
295
|
+
</div>
|
|
296
|
+
`;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
var stepStyles = css`
|
|
300
|
+
:host {
|
|
301
|
+
display: flex;
|
|
302
|
+
position: relative;
|
|
303
|
+
flex: 1;
|
|
304
|
+
font-family: var(--font-family-sans, system-ui, sans-serif);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
:host([hidden]) {
|
|
308
|
+
display: none !important;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
:host([orientation='horizontal']) {
|
|
312
|
+
flex-direction: column;
|
|
313
|
+
align-items: center;
|
|
314
|
+
text-align: center;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
:host([orientation='vertical']) {
|
|
318
|
+
flex-direction: row;
|
|
319
|
+
align-items: flex-start;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.step-indicator {
|
|
323
|
+
display: flex;
|
|
324
|
+
align-items: center;
|
|
325
|
+
justify-content: center;
|
|
326
|
+
width: 2rem;
|
|
327
|
+
height: 2rem;
|
|
328
|
+
border-radius: 50%;
|
|
329
|
+
font-size: 0.875rem;
|
|
330
|
+
font-weight: 600;
|
|
331
|
+
flex-shrink: 0;
|
|
332
|
+
transition: all 0.2s ease;
|
|
333
|
+
background-color: var(--color-surface-variant, #e0e0e0);
|
|
334
|
+
color: var(--color-on-surface-variant, #666);
|
|
335
|
+
border: 2px solid transparent;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
:host([status='completed']) .step-indicator {
|
|
339
|
+
background-color: var(--step-color, var(--color-primary));
|
|
340
|
+
color: var(--color-on-primary, #fff);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
:host([status='current']) .step-indicator {
|
|
344
|
+
background-color: var(--color-surface, #fff);
|
|
345
|
+
color: var(--step-color, var(--color-primary));
|
|
346
|
+
border-color: var(--step-color, var(--color-primary));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.step-content {
|
|
350
|
+
display: flex;
|
|
351
|
+
flex-direction: column;
|
|
352
|
+
gap: 0.25rem;
|
|
353
|
+
padding: 0.5rem;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.step-label {
|
|
357
|
+
font-size: 0.875rem;
|
|
358
|
+
font-weight: 500;
|
|
359
|
+
color: var(--color-on-surface, #1a1a1a);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
:host([status='current']) .step-label {
|
|
363
|
+
color: var(--step-color, var(--color-primary));
|
|
364
|
+
font-weight: 600;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
:host([status='upcoming']) .step-label {
|
|
368
|
+
color: var(--color-on-surface-variant, #666);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.step-description {
|
|
372
|
+
font-size: 0.75rem;
|
|
373
|
+
color: var(--color-on-surface-variant, #666);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
::slotted(*) {
|
|
377
|
+
margin-top: 0.5rem;
|
|
378
|
+
}
|
|
379
|
+
`;
|
|
380
|
+
|
|
381
|
+
class ElDmStep extends BaseElement {
|
|
382
|
+
static properties = {
|
|
383
|
+
label: { type: String, reflect: true },
|
|
384
|
+
description: { type: String, reflect: true },
|
|
385
|
+
icon: { type: String, reflect: true },
|
|
386
|
+
status: { type: String, reflect: true, default: "upcoming" },
|
|
387
|
+
orientation: { type: String, reflect: true, default: "horizontal" },
|
|
388
|
+
color: { type: String, reflect: true, default: "primary" },
|
|
389
|
+
stepNumber: { type: Number, reflect: true, attribute: "step-number", default: 1 }
|
|
390
|
+
};
|
|
391
|
+
constructor() {
|
|
392
|
+
super();
|
|
393
|
+
this.attachStyles(stepStyles);
|
|
394
|
+
}
|
|
395
|
+
_renderIndicator() {
|
|
396
|
+
if (this.status === "completed" && !this.icon) {
|
|
397
|
+
return `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>`;
|
|
398
|
+
}
|
|
399
|
+
if (this.icon) {
|
|
400
|
+
return this.icon;
|
|
401
|
+
}
|
|
402
|
+
return `${this.stepNumber}`;
|
|
403
|
+
}
|
|
404
|
+
render() {
|
|
405
|
+
const colorValue = COLOR_MAP[this.color] || COLOR_MAP.primary;
|
|
406
|
+
return `
|
|
407
|
+
<div class="step-indicator" style="--step-color: ${colorValue}" part="indicator">
|
|
408
|
+
<slot name="icon">${this._renderIndicator()}</slot>
|
|
409
|
+
</div>
|
|
410
|
+
<div class="step-content" part="content">
|
|
411
|
+
${this.label ? `<span class="step-label" part="label">${this.label}</span>` : ""}
|
|
412
|
+
${this.description ? `<span class="step-description" part="description">${this.description}</span>` : ""}
|
|
413
|
+
<slot></slot>
|
|
414
|
+
</div>
|
|
415
|
+
`;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// src/index.ts
|
|
420
|
+
function register() {
|
|
421
|
+
if (!customElements.get("el-dm-stepper")) {
|
|
422
|
+
customElements.define("el-dm-stepper", ElDmStepper);
|
|
423
|
+
}
|
|
424
|
+
if (!customElements.get("el-dm-step")) {
|
|
425
|
+
customElements.define("el-dm-step", ElDmStep);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
export {
|
|
429
|
+
register,
|
|
430
|
+
ElDmStepper,
|
|
431
|
+
ElDmStep
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
//# debugId=F2367279F56CA2B564756E2164756E21
|
|
435
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/el-dm-stepper.ts", "../../src/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * DuskMoon Stepper Element\n *\n * A multi-step progress indicator/wizard component.\n * Uses custom CSS with theme variables for consistent theming.\n *\n * @element el-dm-stepper\n *\n * @attr {string} steps - JSON array of step objects [{label, description?, icon?}]\n * @attr {number} current - Current step index (0-based)\n * @attr {string} orientation - Layout orientation: horizontal, vertical\n * @attr {string} color - Stepper color: primary, secondary, tertiary, success, warning, error, info\n * @attr {boolean} clickable - Whether steps are clickable for navigation\n *\n * @fires change - Fired when step changes via click\n *\n * @csspart stepper - The stepper container\n * @csspart step - Individual step wrapper\n * @csspart indicator - The step number/icon circle\n * @csspart content - The step label and description wrapper\n * @csspart label - The step label text\n * @csspart description - The step description text\n * @csspart connector - The connector line between steps\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-core';\n\nexport interface StepData {\n label: string;\n description?: string;\n icon?: string;\n}\n\nexport type StepperOrientation = 'horizontal' | 'vertical';\nexport type StepperColor =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\n\nconst COLOR_MAP: Record<string, string> = {\n primary: 'var(--color-primary)',\n secondary: 'var(--color-secondary)',\n tertiary: 'var(--color-tertiary)',\n success: 'var(--color-success)',\n warning: 'var(--color-warning)',\n error: 'var(--color-error)',\n info: 'var(--color-info)',\n};\n\nconst styles = css`\n :host {\n display: block;\n font-family: var(--font-family-sans, system-ui, sans-serif);\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n .stepper {\n display: flex;\n gap: 0;\n }\n\n .stepper--horizontal {\n flex-direction: row;\n align-items: flex-start;\n }\n\n .stepper--vertical {\n flex-direction: column;\n }\n\n .step {\n display: flex;\n position: relative;\n flex: 1;\n }\n\n .stepper--horizontal .step {\n flex-direction: column;\n align-items: center;\n text-align: center;\n }\n\n .stepper--vertical .step {\n flex-direction: row;\n align-items: flex-start;\n }\n\n .step-header {\n display: flex;\n align-items: center;\n position: relative;\n z-index: 1;\n }\n\n .stepper--horizontal .step-header {\n flex-direction: column;\n width: 100%;\n }\n\n .stepper--vertical .step-header {\n flex-direction: row;\n min-height: 4rem;\n }\n\n .step-indicator-wrapper {\n display: flex;\n align-items: center;\n position: relative;\n }\n\n .stepper--horizontal .step-indicator-wrapper {\n width: 100%;\n justify-content: center;\n }\n\n .step-indicator {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n font-size: 0.875rem;\n font-weight: 600;\n flex-shrink: 0;\n transition: all 0.2s ease;\n background-color: var(--color-surface-variant, #e0e0e0);\n color: var(--color-on-surface-variant, #666);\n border: 2px solid transparent;\n }\n\n .step--clickable .step-indicator {\n cursor: pointer;\n }\n\n .step--clickable .step-indicator:hover {\n transform: scale(1.1);\n }\n\n .step--completed .step-indicator {\n background-color: var(--stepper-color, var(--color-primary));\n color: var(--color-on-primary, #fff);\n }\n\n .step--current .step-indicator {\n background-color: var(--color-surface, #fff);\n color: var(--stepper-color, var(--color-primary));\n border-color: var(--stepper-color, var(--color-primary));\n }\n\n .step--upcoming .step-indicator {\n background-color: var(--color-surface-variant, #e0e0e0);\n color: var(--color-on-surface-variant, #666);\n }\n\n .step-content {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.5rem 0;\n }\n\n .stepper--horizontal .step-content {\n align-items: center;\n padding: 0.5rem 0.5rem 0;\n }\n\n .stepper--vertical .step-content {\n padding-left: 0.75rem;\n padding-top: 0.25rem;\n }\n\n .step-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-on-surface, #1a1a1a);\n transition: color 0.2s ease;\n }\n\n .step--clickable .step-label {\n cursor: pointer;\n }\n\n .step--upcoming .step-label {\n color: var(--color-on-surface-variant, #666);\n }\n\n .step--current .step-label {\n color: var(--stepper-color, var(--color-primary));\n font-weight: 600;\n }\n\n .step-description {\n font-size: 0.75rem;\n color: var(--color-on-surface-variant, #666);\n }\n\n /* Connector lines */\n .connector {\n position: absolute;\n background-color: var(--color-surface-variant, #e0e0e0);\n transition: background-color 0.2s ease;\n }\n\n .step--completed .connector {\n background-color: var(--stepper-color, var(--color-primary));\n }\n\n .stepper--horizontal .connector {\n height: 2px;\n top: 1rem;\n left: calc(50% + 1rem + 0.25rem);\n right: calc(-50% + 1rem + 0.25rem);\n }\n\n .stepper--horizontal .step:last-child .connector {\n display: none;\n }\n\n .stepper--vertical .connector {\n width: 2px;\n left: calc(1rem - 1px);\n top: 2.5rem;\n bottom: 0.5rem;\n }\n\n .stepper--vertical .step:last-child .connector {\n display: none;\n }\n\n /* Icon support */\n .step-icon {\n font-size: 1rem;\n line-height: 1;\n }\n\n /* Completed checkmark */\n .step--completed .step-indicator::after {\n content: '';\n }\n`;\n\nexport class ElDmStepper extends BaseElement {\n static properties = {\n steps: { type: Array, reflect: false, default: [] },\n current: { type: Number, reflect: true, default: 0 },\n orientation: { type: String, reflect: true, default: 'horizontal' },\n color: { type: String, reflect: true, default: 'primary' },\n clickable: { type: Boolean, reflect: true, default: false },\n };\n\n declare steps: StepData[];\n declare current: number;\n declare orientation: StepperOrientation;\n declare color: StepperColor;\n declare clickable: boolean;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('click', this._handleClick.bind(this));\n }\n\n private _handleClick(e: Event): void {\n if (!this.clickable) return;\n\n const target = e.target as HTMLElement;\n const stepEl = target.closest('[data-step-index]') as HTMLElement;\n if (!stepEl) return;\n\n const index = parseInt(stepEl.dataset.stepIndex || '0', 10);\n if (index !== this.current) {\n const oldValue = this.current;\n this.current = index;\n this.emit('change', { current: index, previous: oldValue });\n }\n }\n\n private _getStepState(index: number): 'completed' | 'current' | 'upcoming' {\n if (index < this.current) return 'completed';\n if (index === this.current) return 'current';\n return 'upcoming';\n }\n\n private _renderStepIndicator(step: StepData, index: number, state: string): string {\n if (state === 'completed') {\n return step.icon\n ? `<span class=\"step-icon\">${step.icon}</span>`\n : `<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"></polyline></svg>`;\n }\n if (step.icon) {\n return `<span class=\"step-icon\">${step.icon}</span>`;\n }\n return `${index + 1}`;\n }\n\n render(): string {\n const stepsArray = Array.isArray(this.steps) ? this.steps : [];\n const colorValue = COLOR_MAP[this.color] || COLOR_MAP.primary;\n\n const stepsHtml = stepsArray\n .map((step, index) => {\n const state = this._getStepState(index);\n const stateClass = `step--${state}`;\n const clickableClass = this.clickable ? 'step--clickable' : '';\n\n return `\n <div\n class=\"step ${stateClass} ${clickableClass}\"\n data-step-index=\"${index}\"\n part=\"step\"\n >\n <div class=\"step-header\">\n <div class=\"step-indicator-wrapper\">\n <div class=\"step-indicator\" part=\"indicator\">\n ${this._renderStepIndicator(step, index, state)}\n </div>\n <div class=\"connector\" part=\"connector\"></div>\n </div>\n <div class=\"step-content\" part=\"content\">\n <span class=\"step-label\" part=\"label\">${step.label}</span>\n ${step.description ? `<span class=\"step-description\" part=\"description\">${step.description}</span>` : ''}\n </div>\n </div>\n </div>\n `;\n })\n .join('');\n\n return `\n <div\n class=\"stepper stepper--${this.orientation}\"\n style=\"--stepper-color: ${colorValue}\"\n role=\"navigation\"\n aria-label=\"Progress steps\"\n part=\"stepper\"\n >\n ${stepsHtml}\n </div>\n `;\n }\n}\n\n/**\n * DuskMoon Step Element\n *\n * Individual step element for use within el-dm-stepper.\n * Allows for custom content and styling of individual steps.\n *\n * @element el-dm-step\n *\n * @attr {string} label - Step label text\n * @attr {string} description - Optional description text\n * @attr {string} icon - Optional icon (text/emoji/html)\n * @attr {string} status - Step status: completed, current, upcoming\n *\n * @slot - Default slot for custom step content\n * @slot icon - Slot for custom icon content\n *\n * @csspart step - The step container\n * @csspart indicator - The step indicator circle\n * @csspart content - The content wrapper\n * @csspart label - The label text\n * @csspart description - The description text\n */\n\nconst stepStyles = css`\n :host {\n display: flex;\n position: relative;\n flex: 1;\n font-family: var(--font-family-sans, system-ui, sans-serif);\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n :host([orientation='horizontal']) {\n flex-direction: column;\n align-items: center;\n text-align: center;\n }\n\n :host([orientation='vertical']) {\n flex-direction: row;\n align-items: flex-start;\n }\n\n .step-indicator {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n border-radius: 50%;\n font-size: 0.875rem;\n font-weight: 600;\n flex-shrink: 0;\n transition: all 0.2s ease;\n background-color: var(--color-surface-variant, #e0e0e0);\n color: var(--color-on-surface-variant, #666);\n border: 2px solid transparent;\n }\n\n :host([status='completed']) .step-indicator {\n background-color: var(--step-color, var(--color-primary));\n color: var(--color-on-primary, #fff);\n }\n\n :host([status='current']) .step-indicator {\n background-color: var(--color-surface, #fff);\n color: var(--step-color, var(--color-primary));\n border-color: var(--step-color, var(--color-primary));\n }\n\n .step-content {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.5rem;\n }\n\n .step-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-on-surface, #1a1a1a);\n }\n\n :host([status='current']) .step-label {\n color: var(--step-color, var(--color-primary));\n font-weight: 600;\n }\n\n :host([status='upcoming']) .step-label {\n color: var(--color-on-surface-variant, #666);\n }\n\n .step-description {\n font-size: 0.75rem;\n color: var(--color-on-surface-variant, #666);\n }\n\n ::slotted(*) {\n margin-top: 0.5rem;\n }\n`;\n\nexport class ElDmStep extends BaseElement {\n static properties = {\n label: { type: String, reflect: true },\n description: { type: String, reflect: true },\n icon: { type: String, reflect: true },\n status: { type: String, reflect: true, default: 'upcoming' },\n orientation: { type: String, reflect: true, default: 'horizontal' },\n color: { type: String, reflect: true, default: 'primary' },\n stepNumber: { type: Number, reflect: true, attribute: 'step-number', default: 1 },\n };\n\n declare label: string;\n declare description: string;\n declare icon: string;\n declare status: 'completed' | 'current' | 'upcoming';\n declare orientation: 'horizontal' | 'vertical';\n declare color: string;\n declare stepNumber: number;\n\n constructor() {\n super();\n this.attachStyles(stepStyles);\n }\n\n private _renderIndicator(): string {\n if (this.status === 'completed' && !this.icon) {\n return `<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"></polyline></svg>`;\n }\n if (this.icon) {\n return this.icon;\n }\n return `${this.stepNumber}`;\n }\n\n render(): string {\n const colorValue = COLOR_MAP[this.color] || COLOR_MAP.primary;\n\n return `\n <div class=\"step-indicator\" style=\"--step-color: ${colorValue}\" part=\"indicator\">\n <slot name=\"icon\">${this._renderIndicator()}</slot>\n </div>\n <div class=\"step-content\" part=\"content\">\n ${this.label ? `<span class=\"step-label\" part=\"label\">${this.label}</span>` : ''}\n ${this.description ? `<span class=\"step-description\" part=\"description\">${this.description}</span>` : ''}\n <slot></slot>\n </div>\n `;\n }\n}\n",
|
|
6
|
+
"/**\n * @duskmoon-dev/el-stepper\n *\n * DuskMoon Stepper custom elements for multi-step progress indicators\n */\n\nimport { ElDmStepper, ElDmStep } from './el-dm-stepper.js';\n\nexport { ElDmStepper, ElDmStep };\nexport type { StepData, StepperOrientation, StepperColor } from './el-dm-stepper.js';\n\n/**\n * Register the el-dm-stepper and el-dm-step custom elements\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-stepper';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-stepper')) {\n customElements.define('el-dm-stepper', ElDmStepper);\n }\n if (!customElements.get('el-dm-step')) {\n customElements.define('el-dm-step', ElDmStep);\n }\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";AAyBA;AAkBA,IAAM,YAAoC;AAAA,EACxC,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR;AAEA,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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