@nuvia-ui/components 4.0.1
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/package.json +27 -0
- package/src/ds-accordion/ds-accordion-item.js +288 -0
- package/src/ds-accordion/ds-accordion-item.stories.js +82 -0
- package/src/ds-accordion/ds-accordion.a11y.test.js +92 -0
- package/src/ds-accordion/ds-accordion.js +68 -0
- package/src/ds-accordion/ds-accordion.stories.js +118 -0
- package/src/ds-accordion/ds-accordion.test.js +146 -0
- package/src/ds-accordion/index.js +2 -0
- package/src/ds-action-bar/ds-action-bar.js +116 -0
- package/src/ds-action-bar/ds-action-bar.stories.js +86 -0
- package/src/ds-action-bar/ds-action-bar.test.js +64 -0
- package/src/ds-action-bar/index.js +1 -0
- package/src/ds-alert/ds-alert.a11y.test.js +151 -0
- package/src/ds-alert/ds-alert.js +223 -0
- package/src/ds-alert/ds-alert.mdx +142 -0
- package/src/ds-alert/ds-alert.stories.js +166 -0
- package/src/ds-alert/ds-alert.test.js +256 -0
- package/src/ds-alert/index.js +1 -0
- package/src/ds-avatar/ds-avatar.a11y.test.js +45 -0
- package/src/ds-avatar/ds-avatar.js +216 -0
- package/src/ds-avatar/ds-avatar.stories.js +120 -0
- package/src/ds-avatar/ds-avatar.test.js +83 -0
- package/src/ds-avatar/index.js +1 -0
- package/src/ds-avatar-extended/ds-avatar-extended.a11y.test.js +29 -0
- package/src/ds-avatar-extended/ds-avatar-extended.js +108 -0
- package/src/ds-avatar-extended/ds-avatar-extended.stories.js +93 -0
- package/src/ds-avatar-extended/ds-avatar-extended.test.js +66 -0
- package/src/ds-avatar-extended/index.js +1 -0
- package/src/ds-banner/ds-banner.a11y.test.js +51 -0
- package/src/ds-banner/ds-banner.js +233 -0
- package/src/ds-banner/ds-banner.stories.js +185 -0
- package/src/ds-banner/ds-banner.test.js +116 -0
- package/src/ds-banner/index.js +1 -0
- package/src/ds-breadcrumb-item/ds-breadcrumb-item.js +135 -0
- package/src/ds-breadcrumb-item/ds-breadcrumb-item.stories.js +49 -0
- package/src/ds-breadcrumb-item/ds-breadcrumb-item.test.js +55 -0
- package/src/ds-breadcrumbs/ds-breadcrumbs.js +194 -0
- package/src/ds-breadcrumbs/ds-breadcrumbs.stories.js +54 -0
- package/src/ds-breadcrumbs/ds-breadcrumbs.test.js +33 -0
- package/src/ds-button/ds-button.a11y.test.js +49 -0
- package/src/ds-button/ds-button.js +205 -0
- package/src/ds-button/ds-button.mdx +141 -0
- package/src/ds-button/ds-button.stories.js +152 -0
- package/src/ds-button/ds-button.test.js +62 -0
- package/src/ds-button/index.js +1 -0
- package/src/ds-button-group/ds-button-group.js +82 -0
- package/src/ds-button-group/ds-button-group.mdx +39 -0
- package/src/ds-button-group/ds-button-group.stories.js +47 -0
- package/src/ds-button-group/ds-button-group.test.js +47 -0
- package/src/ds-button-group/index.js +1 -0
- package/src/ds-checkbox/ds-checkbox.a11y.test.js +79 -0
- package/src/ds-checkbox/ds-checkbox.js +271 -0
- package/src/ds-checkbox/ds-checkbox.stories.js +77 -0
- package/src/ds-checkbox/ds-checkbox.test.js +191 -0
- package/src/ds-checkbox/index.js +1 -0
- package/src/ds-checkbox-group/ds-checkbox-group.a11y.test.js +146 -0
- package/src/ds-checkbox-group/ds-checkbox-group.js +235 -0
- package/src/ds-checkbox-group/ds-checkbox-group.stories.js +210 -0
- package/src/ds-checkbox-group/ds-checkbox-group.test.js +150 -0
- package/src/ds-checkbox-group/index.js +1 -0
- package/src/ds-dialog/ds-dialog.js +466 -0
- package/src/ds-dialog/ds-dialog.stories.js +274 -0
- package/src/ds-dialog/ds-dialog.test.js +441 -0
- package/src/ds-dialog/index.js +1 -0
- package/src/ds-dropdown/ds-dropdown.a11y.test.js +80 -0
- package/src/ds-dropdown/ds-dropdown.js +891 -0
- package/src/ds-dropdown/ds-dropdown.stories.js +259 -0
- package/src/ds-dropdown/ds-dropdown.test.js +268 -0
- package/src/ds-dropdown/index.js +1 -0
- package/src/ds-dropdown-group/ds-dropdown-group.js +55 -0
- package/src/ds-dropdown-panel/ds-dropdown-panel.js +34 -0
- package/src/ds-file-uploaded/ds-file-uploaded.a11y.test.js +40 -0
- package/src/ds-file-uploaded/ds-file-uploaded.js +135 -0
- package/src/ds-file-uploaded/ds-file-uploaded.mdx +33 -0
- package/src/ds-file-uploaded/ds-file-uploaded.stories.js +81 -0
- package/src/ds-file-uploaded/ds-file-uploaded.test.js +85 -0
- package/src/ds-file-uploader/ds-file-uploader.a11y.test.js +61 -0
- package/src/ds-file-uploader/ds-file-uploader.js +442 -0
- package/src/ds-file-uploader/ds-file-uploader.mdx +44 -0
- package/src/ds-file-uploader/ds-file-uploader.stories.js +76 -0
- package/src/ds-file-uploader/ds-file-uploader.test.js +142 -0
- package/src/ds-header/ds-header.a11y.test.js +38 -0
- package/src/ds-header/ds-header.js +149 -0
- package/src/ds-header/ds-header.stories.js +63 -0
- package/src/ds-header/ds-header.test.js +52 -0
- package/src/ds-header/index.js +1 -0
- package/src/ds-header-nav/ds-header-nav.a11y.test.js +69 -0
- package/src/ds-header-nav/ds-header-nav.js +114 -0
- package/src/ds-header-nav/ds-header-nav.stories.js +17 -0
- package/src/ds-header-nav/ds-header-nav.test.js +93 -0
- package/src/ds-header-nav-item/ds-header-nav-item.a11y.test.js +71 -0
- package/src/ds-header-nav-item/ds-header-nav-item.js +124 -0
- package/src/ds-header-nav-item/ds-header-nav-item.stories.js +43 -0
- package/src/ds-header-nav-item/ds-header-nav-item.test.js +61 -0
- package/src/ds-icon/ds-icon.a11y.test.js +49 -0
- package/src/ds-icon/ds-icon.js +75 -0
- package/src/ds-icon/ds-icon.mdx +36 -0
- package/src/ds-icon/ds-icon.stories.js +88 -0
- package/src/ds-icon/ds-icon.test.js +97 -0
- package/src/ds-icon/index.js +1 -0
- package/src/ds-icon-button/ds-icon-button.a11y.test.js +55 -0
- package/src/ds-icon-button/ds-icon-button.js +224 -0
- package/src/ds-icon-button/ds-icon-button.mdx +131 -0
- package/src/ds-icon-button/ds-icon-button.stories.js +128 -0
- package/src/ds-icon-button/ds-icon-button.test.js +90 -0
- package/src/ds-icon-button/index.js +1 -0
- package/src/ds-input/ds-input.a11y.test.js +145 -0
- package/src/ds-input/ds-input.js +645 -0
- package/src/ds-input/ds-input.mdx +251 -0
- package/src/ds-input/ds-input.stories.js +298 -0
- package/src/ds-input/ds-input.test.js +792 -0
- package/src/ds-input/index.js +1 -0
- package/src/ds-link/ds-link.js +111 -0
- package/src/ds-link/ds-link.stories.js +56 -0
- package/src/ds-link/ds-link.test.js +74 -0
- package/src/ds-list-item/ds-list-item.a11y.test.js +39 -0
- package/src/ds-list-item/ds-list-item.js +292 -0
- package/src/ds-list-item/ds-list-item.stories.js +101 -0
- package/src/ds-list-item/ds-list-item.test.js +63 -0
- package/src/ds-menu/ds-menu.js +30 -0
- package/src/ds-menu/ds-menu.stories.js +120 -0
- package/src/ds-menu/ds-menu.test.js +123 -0
- package/src/ds-menu-group/ds-menu-group.js +101 -0
- package/src/ds-menu-group/ds-menu-group.stories.js +99 -0
- package/src/ds-nav-item/ds-nav-item.a11y.test.js +91 -0
- package/src/ds-nav-item/ds-nav-item.js +307 -0
- package/src/ds-nav-item/ds-nav-item.stories.js +99 -0
- package/src/ds-nav-item/ds-nav-item.test.js +169 -0
- package/src/ds-nav-item/index.js +1 -0
- package/src/ds-nav-vertical/ds-nav-vertical.a11y.test.js +69 -0
- package/src/ds-nav-vertical/ds-nav-vertical.js +173 -0
- package/src/ds-nav-vertical/ds-nav-vertical.stories.js +124 -0
- package/src/ds-nav-vertical/ds-nav-vertical.test.js +176 -0
- package/src/ds-nav-vertical/index.js +1 -0
- package/src/ds-pagination/ds-pagination.a11y.test.js +50 -0
- package/src/ds-pagination/ds-pagination.js +232 -0
- package/src/ds-pagination/ds-pagination.stories.js +63 -0
- package/src/ds-pagination/ds-pagination.test.js +141 -0
- package/src/ds-pagination/index.js +1 -0
- package/src/ds-progress-bar/ds-progress-bar.a11y.test.js +25 -0
- package/src/ds-progress-bar/ds-progress-bar.js +81 -0
- package/src/ds-progress-bar/ds-progress-bar.stories.js +69 -0
- package/src/ds-progress-bar/ds-progress-bar.test.js +60 -0
- package/src/ds-radio/ds-radio.a11y.test.js +69 -0
- package/src/ds-radio/ds-radio.js +240 -0
- package/src/ds-radio/ds-radio.stories.js +102 -0
- package/src/ds-radio/ds-radio.test.js +114 -0
- package/src/ds-radio/index.js +1 -0
- package/src/ds-radio-group/ds-radio-group.a11y.test.js +164 -0
- package/src/ds-radio-group/ds-radio-group.js +257 -0
- package/src/ds-radio-group/ds-radio-group.stories.js +247 -0
- package/src/ds-radio-group/ds-radio-group.test.js +194 -0
- package/src/ds-radio-group/index.js +1 -0
- package/src/ds-rich-list/ds-rich-list.js +246 -0
- package/src/ds-rich-list/ds-rich-list.stories.js +368 -0
- package/src/ds-rich-list/ds-rich-list.test.js +293 -0
- package/src/ds-rich-list-item/ds-rich-list-item.js +579 -0
- package/src/ds-rich-list-item/ds-rich-list-item.stories.js +197 -0
- package/src/ds-rich-list-item/ds-rich-list-item.test.js +434 -0
- package/src/ds-slider/ds-slider.js +399 -0
- package/src/ds-slider/ds-slider.stories.js +107 -0
- package/src/ds-slider/ds-slider.test.js +308 -0
- package/src/ds-spinner/ds-spinner.js +173 -0
- package/src/ds-spinner/ds-spinner.stories.js +52 -0
- package/src/ds-spinner/ds-spinner.test.js +50 -0
- package/src/ds-status-border/ds-status-border.js +88 -0
- package/src/ds-status-border/ds-status-border.stories.js +242 -0
- package/src/ds-status-border/ds-status-border.test.js +168 -0
- package/src/ds-stepper/ds-stepper.a11y.test.js +198 -0
- package/src/ds-stepper/ds-stepper.js +207 -0
- package/src/ds-stepper/ds-stepper.stories.js +530 -0
- package/src/ds-stepper/ds-stepper.test.js +311 -0
- package/src/ds-stepper-item/ds-stepper-item.js +485 -0
- package/src/ds-stepper-item/ds-stepper-item.stories.js +288 -0
- package/src/ds-switch/ds-switch.js +348 -0
- package/src/ds-switch/ds-switch.stories.js +145 -0
- package/src/ds-switch/ds-switch.test.js +226 -0
- package/src/ds-switch/index.js +1 -0
- package/src/ds-tab-item/ds-tab-item.js +341 -0
- package/src/ds-tab-item/ds-tab-item.stories.js +69 -0
- package/src/ds-tabs/ds-tab-panel.js +48 -0
- package/src/ds-tabs/ds-tabs.a11y.test.js +56 -0
- package/src/ds-tabs/ds-tabs.js +180 -0
- package/src/ds-tabs/ds-tabs.stories.js +152 -0
- package/src/ds-tabs/ds-tabs.test.js +306 -0
- package/src/ds-tabs/index.js +3 -0
- package/src/ds-tag-action/ds-tag-action.a11y.test.js +32 -0
- package/src/ds-tag-action/ds-tag-action.js +185 -0
- package/src/ds-tag-action/ds-tag-action.stories.js +55 -0
- package/src/ds-tag-action/ds-tag-action.test.js +44 -0
- package/src/ds-tag-removable/ds-tag-removable.a11y.test.js +24 -0
- package/src/ds-tag-removable/ds-tag-removable.js +146 -0
- package/src/ds-tag-removable/ds-tag-removable.stories.js +52 -0
- package/src/ds-tag-removable/ds-tag-removable.test.js +46 -0
- package/src/ds-tag-status/ds-tag-status.a11y.test.js +93 -0
- package/src/ds-tag-status/ds-tag-status.js +164 -0
- package/src/ds-tag-status/ds-tag-status.stories.js +200 -0
- package/src/ds-tag-status/ds-tag-status.test.js +140 -0
- package/src/ds-tag-status/index.js +1 -0
- package/src/ds-textarea/ds-textarea-clearable.test.js +89 -0
- package/src/ds-textarea/ds-textarea.a11y.test.js +66 -0
- package/src/ds-textarea/ds-textarea.js +505 -0
- package/src/ds-textarea/ds-textarea.stories.js +335 -0
- package/src/ds-textarea/ds-textarea.test.js +218 -0
- package/src/ds-textarea/index.js +1 -0
- package/src/ds-thumbnail/ds-thumbnail.js +207 -0
- package/src/ds-thumbnail/ds-thumbnail.stories.js +217 -0
- package/src/ds-thumbnail/ds-thumbnail.test.js +220 -0
- package/src/ds-toast/ds-toast-provider.js +110 -0
- package/src/ds-toast/ds-toast.a11y.test.js +34 -0
- package/src/ds-toast/ds-toast.js +243 -0
- package/src/ds-toast/ds-toast.stories.js +143 -0
- package/src/ds-toast/ds-toast.test.js +93 -0
- package/src/ds-toast/index.js +2 -0
- package/src/ds-tooltip/ds-tooltip.a11y.test.js +110 -0
- package/src/ds-tooltip/ds-tooltip.js +217 -0
- package/src/ds-tooltip/ds-tooltip.mdx +75 -0
- package/src/ds-tooltip/ds-tooltip.stories.js +72 -0
- package/src/ds-tooltip/ds-tooltip.test.js +191 -0
- package/src/ds-tooltip/index.js +1 -0
- package/src/ds-tooltip/positioner.js +117 -0
- package/src/index.js +50 -0
- package/src/mixins/field-label.mixin.js +113 -0
- package/src/mixins/field-message.mixin.js +66 -0
- package/src/token-provider/index.js +1 -0
- package/src/token-provider/token-provider.a11y.test.js +44 -0
- package/src/token-provider/token-provider.js +85 -0
- package/src/token-provider/token-provider.stories.js +105 -0
- package/src/token-provider/token-provider.test.js +134 -0
- package/src/utils/number-input.utils.js +42 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import '../ds-stepper-item/ds-stepper-item.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Stepper container component for displaying progress through steps.
|
|
6
|
+
*
|
|
7
|
+
* Supports two modes:
|
|
8
|
+
* - **Uncontrolled**: Omit `active-step` and the component manages its own state.
|
|
9
|
+
* - **Controlled**: Set `active-step` to control state from the parent.
|
|
10
|
+
*
|
|
11
|
+
* @element ds-stepper
|
|
12
|
+
*
|
|
13
|
+
* @prop {string} direction - Layout direction: 'horizontal' | 'vertical'
|
|
14
|
+
* @prop {number} activeStep - Zero-based index of the active step (controlled mode).
|
|
15
|
+
* @prop {number} defaultActiveStep - Initial active step for uncontrolled mode (default: 0).
|
|
16
|
+
* @prop {boolean} linear - When true, only completed and current steps are
|
|
17
|
+
* interactive. When false (default), all non-disabled steps are clickable.
|
|
18
|
+
* @prop {boolean} autoComplete - When true (default), steps before activeStep are
|
|
19
|
+
* automatically marked as completed. When false, completed state is controlled
|
|
20
|
+
* manually via the `completed` prop on each ds-stepper-item.
|
|
21
|
+
* @prop {string} label - Accessible label for the stepper group (default: "Progress")
|
|
22
|
+
*
|
|
23
|
+
* @slot - Default slot for ds-stepper-item elements
|
|
24
|
+
*
|
|
25
|
+
* @fires ds-change - Fired when the active step changes, with detail { currentStep, previousStep }
|
|
26
|
+
*/
|
|
27
|
+
export class DsStepper extends LitElement {
|
|
28
|
+
static properties = {
|
|
29
|
+
direction: { type: String, reflect: true },
|
|
30
|
+
activeStep: { type: Number, attribute: 'active-step', reflect: true },
|
|
31
|
+
defaultActiveStep: { type: Number, attribute: 'default-active-step' },
|
|
32
|
+
linear: { type: Boolean, reflect: true },
|
|
33
|
+
autoComplete: { type: Boolean, attribute: 'auto-complete', reflect: true },
|
|
34
|
+
label: { type: String },
|
|
35
|
+
_internalActiveStep: { type: Number, state: true }
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
static styles = css`
|
|
39
|
+
:host {
|
|
40
|
+
display: flex;
|
|
41
|
+
width: 100%;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([direction="vertical"]) {
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
::slotted(ds-stepper-item) {
|
|
50
|
+
flex: 1;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
constructor() {
|
|
55
|
+
super();
|
|
56
|
+
this.direction = 'horizontal';
|
|
57
|
+
this.activeStep = undefined;
|
|
58
|
+
this.defaultActiveStep = 0;
|
|
59
|
+
this.linear = false;
|
|
60
|
+
this.autoComplete = true;
|
|
61
|
+
this.label = 'Progress';
|
|
62
|
+
this._internalActiveStep = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
connectedCallback() {
|
|
66
|
+
super.connectedCallback();
|
|
67
|
+
// ARIA: group role with label
|
|
68
|
+
this.setAttribute('role', 'group');
|
|
69
|
+
this.addEventListener('ds-step-click', this._handleStepClick);
|
|
70
|
+
this.addEventListener('ds-step-update', this._handleStepUpdate);
|
|
71
|
+
|
|
72
|
+
// Initialize internal state if controlled prop is present
|
|
73
|
+
if (this.activeStep !== undefined) {
|
|
74
|
+
this._internalActiveStep = this.activeStep;
|
|
75
|
+
} else {
|
|
76
|
+
this._internalActiveStep = this.defaultActiveStep;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
disconnectedCallback() {
|
|
81
|
+
super.disconnectedCallback();
|
|
82
|
+
this.removeEventListener('ds-step-click', this._handleStepClick);
|
|
83
|
+
this.removeEventListener('ds-step-update', this._handleStepUpdate);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
firstUpdated() {
|
|
87
|
+
this._updateChildren();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
updated(changedProperties) {
|
|
91
|
+
super.updated(changedProperties);
|
|
92
|
+
|
|
93
|
+
// Sync internal state with controlled prop
|
|
94
|
+
if (changedProperties.has('activeStep') && this.activeStep !== undefined) {
|
|
95
|
+
this._internalActiveStep = this.activeStep;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (changedProperties.has('direction') ||
|
|
99
|
+
changedProperties.has('activeStep') ||
|
|
100
|
+
changedProperties.has('_internalActiveStep') ||
|
|
101
|
+
changedProperties.has('linear') ||
|
|
102
|
+
changedProperties.has('autoComplete')) {
|
|
103
|
+
this._updateChildren();
|
|
104
|
+
}
|
|
105
|
+
// Keep aria-label in sync
|
|
106
|
+
if (changedProperties.has('label')) {
|
|
107
|
+
this.setAttribute('aria-label', this.label);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_handleStepClick = (e) => {
|
|
112
|
+
// Stop the raw step click from bubbling out, we will emit ds-change instead
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
|
|
115
|
+
const stepIndex = e.detail.step - 1; // Convert 1-based to 0-based
|
|
116
|
+
const oldStep = this._internalActiveStep;
|
|
117
|
+
|
|
118
|
+
// If clicked same step, do nothing
|
|
119
|
+
if (stepIndex === oldStep) return;
|
|
120
|
+
|
|
121
|
+
// Emit change event
|
|
122
|
+
const event = new CustomEvent('ds-change', {
|
|
123
|
+
bubbles: true,
|
|
124
|
+
composed: true,
|
|
125
|
+
detail: {
|
|
126
|
+
currentStep: stepIndex, // 0-based to match activeStep prop
|
|
127
|
+
previousStep: oldStep
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
this.dispatchEvent(event);
|
|
131
|
+
|
|
132
|
+
// If Uncontrolled (activeStep prop is undefined), update internal state
|
|
133
|
+
if (this.activeStep === undefined && !event.defaultPrevented) {
|
|
134
|
+
this._internalActiveStep = stepIndex;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
_handleStepUpdate = () => {
|
|
139
|
+
this._updateChildren();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_handleSlotChange() {
|
|
143
|
+
this._updateChildren();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
_updateChildren() {
|
|
147
|
+
const slot = this.shadowRoot?.querySelector('slot');
|
|
148
|
+
if (!slot) return;
|
|
149
|
+
|
|
150
|
+
const items = slot.assignedElements().filter(el => el.tagName === 'DS-STEPPER-ITEM');
|
|
151
|
+
const total = items.length;
|
|
152
|
+
|
|
153
|
+
// Use internal state which handles both controlled and uncontrolled
|
|
154
|
+
const currentActiveIndex = this._internalActiveStep;
|
|
155
|
+
|
|
156
|
+
items.forEach((item, index) => {
|
|
157
|
+
// Set direction
|
|
158
|
+
item._direction = this.direction;
|
|
159
|
+
|
|
160
|
+
// Set position
|
|
161
|
+
if (index === 0) {
|
|
162
|
+
item._position = 'first';
|
|
163
|
+
} else if (index === total - 1) {
|
|
164
|
+
item._position = 'last';
|
|
165
|
+
} else {
|
|
166
|
+
item._position = 'middle';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Set step number and total
|
|
170
|
+
item._step = index + 1;
|
|
171
|
+
item._totalSteps = total;
|
|
172
|
+
|
|
173
|
+
// Set linear mode
|
|
174
|
+
item._linear = this.linear;
|
|
175
|
+
|
|
176
|
+
// Update state based on current internal active index
|
|
177
|
+
// Only auto-complete if autoComplete=true
|
|
178
|
+
if (this.autoComplete) {
|
|
179
|
+
item.completed = index < currentActiveIndex;
|
|
180
|
+
}
|
|
181
|
+
// Note: if autoComplete=false, we never set completed —
|
|
182
|
+
// it is fully controlled by the consumer via the `completed` attribute
|
|
183
|
+
|
|
184
|
+
item.current = index === currentActiveIndex;
|
|
185
|
+
|
|
186
|
+
// Set previous step completed status (for connector coloring)
|
|
187
|
+
if (index > 0) {
|
|
188
|
+
const prevItem = items[index - 1];
|
|
189
|
+
item._prevCompleted = prevItem.completed;
|
|
190
|
+
item._prevError = prevItem.error || false;
|
|
191
|
+
} else {
|
|
192
|
+
item._prevCompleted = false;
|
|
193
|
+
item._prevError = false;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
render() {
|
|
199
|
+
return html`
|
|
200
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
201
|
+
`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (!customElements.get('ds-stepper')) {
|
|
206
|
+
customElements.define('ds-stepper', DsStepper);
|
|
207
|
+
}
|