@prioticket/design-system-web 1.0.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/COMPONENT-DOCUMENTATION.md +608 -0
- package/README.md +229 -0
- package/component-documentation.json +1681 -0
- package/dist/components/pd-button.cjs.js +99 -0
- package/dist/components/pd-button.es.js +156 -0
- package/dist/components/pd-card.cjs.js +59 -0
- package/dist/components/pd-card.es.js +93 -0
- package/dist/components/pd-checkbox.cjs.js +85 -0
- package/dist/components/pd-checkbox.es.js +154 -0
- package/dist/components/pd-chip.cjs.js +118 -0
- package/dist/components/pd-chip.es.js +220 -0
- package/dist/components/pd-dialog.cjs.js +195 -0
- package/dist/components/pd-dialog.es.js +285 -0
- package/dist/components/pd-expandable-card.cjs.js +134 -0
- package/dist/components/pd-expandable-card.es.js +205 -0
- package/dist/components/pd-fab.cjs.js +119 -0
- package/dist/components/pd-fab.es.js +179 -0
- package/dist/components/pd-icon-button.cjs.js +159 -0
- package/dist/components/pd-icon-button.es.js +268 -0
- package/dist/components/pd-icon.cjs.js +71 -0
- package/dist/components/pd-icon.es.js +102 -0
- package/dist/components/pd-list.cjs.js +108 -0
- package/dist/components/pd-list.es.js +229 -0
- package/dist/components/pd-menu-item.cjs.js +85 -0
- package/dist/components/pd-menu-item.es.js +156 -0
- package/dist/components/pd-menu.cjs.js +42 -0
- package/dist/components/pd-menu.es.js +122 -0
- package/dist/components/pd-progress.cjs.js +72 -0
- package/dist/components/pd-progress.es.js +119 -0
- package/dist/components/pd-radio.cjs.js +38 -0
- package/dist/components/pd-radio.es.js +153 -0
- package/dist/components/pd-segmented-button.cjs.js +135 -0
- package/dist/components/pd-segmented-button.es.js +234 -0
- package/dist/components/pd-segmented-stepper.cjs.js +191 -0
- package/dist/components/pd-segmented-stepper.es.js +333 -0
- package/dist/components/pd-select.cjs.js +59 -0
- package/dist/components/pd-select.es.js +136 -0
- package/dist/components/pd-slider.cjs.js +42 -0
- package/dist/components/pd-slider.es.js +123 -0
- package/dist/components/pd-stepper.cjs.js +279 -0
- package/dist/components/pd-stepper.es.js +375 -0
- package/dist/components/pd-switch.cjs.js +57 -0
- package/dist/components/pd-switch.es.js +126 -0
- package/dist/components/pd-tabs.cjs.js +32 -0
- package/dist/components/pd-tabs.es.js +139 -0
- package/dist/components/pd-text-field.cjs.js +86 -0
- package/dist/components/pd-text-field.es.js +202 -0
- package/dist/design-system-web.css +1 -0
- package/dist/fonts/ProximaNova-Bold.woff2 +0 -0
- package/dist/fonts/ProximaNova-Extrabld.woff2 +0 -0
- package/dist/fonts/ProximaNova-Light.woff2 +0 -0
- package/dist/fonts/ProximaNova-Medium.woff2 +0 -0
- package/dist/fonts/ProximaNova-Regular.woff2 +0 -0
- package/dist/fonts/ProximaNova-Semibold.woff2 +0 -0
- package/dist/fonts/ProximaNovaCond-Semibold.woff2 +0 -0
- package/dist/fonts-only.css +59 -0
- package/dist/fonts.cjs.js +1 -0
- package/dist/fonts.es.js +1 -0
- package/dist/prioticket-design-system-web.cjs.js +1 -0
- package/dist/prioticket-design-system-web.es.js +52 -0
- package/dist/theme-only.css +311 -0
- package/dist/theme-with-fonts.cjs.js +1 -0
- package/dist/theme-with-fonts.css +372 -0
- package/dist/theme-with-fonts.es.js +2 -0
- package/dist/theme.cjs.js +1 -0
- package/dist/theme.es.js +1 -0
- package/dist/types/components/pd-button.d.ts +30 -0
- package/dist/types/components/pd-card.d.ts +8 -0
- package/dist/types/components/pd-checkbox.d.ts +16 -0
- package/dist/types/components/pd-chip.d.ts +26 -0
- package/dist/types/components/pd-dialog.d.ts +49 -0
- package/dist/types/components/pd-expandable-card.d.ts +39 -0
- package/dist/types/components/pd-fab.d.ts +17 -0
- package/dist/types/components/pd-icon-button.d.ts +24 -0
- package/dist/types/components/pd-icon.d.ts +9 -0
- package/dist/types/components/pd-list.d.ts +36 -0
- package/dist/types/components/pd-menu-item.d.ts +38 -0
- package/dist/types/components/pd-menu.d.ts +58 -0
- package/dist/types/components/pd-progress.d.ts +30 -0
- package/dist/types/components/pd-radio.d.ts +54 -0
- package/dist/types/components/pd-segmented-button.d.ts +53 -0
- package/dist/types/components/pd-segmented-stepper.d.ts +65 -0
- package/dist/types/components/pd-select.d.ts +46 -0
- package/dist/types/components/pd-slider.d.ts +43 -0
- package/dist/types/components/pd-stepper.d.ts +47 -0
- package/dist/types/components/pd-switch.d.ts +37 -0
- package/dist/types/components/pd-tabs.d.ts +54 -0
- package/dist/types/components/pd-text-field.d.ts +30 -0
- package/dist/types/fonts.d.ts +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/theme-with-fonts.d.ts +2 -0
- package/dist/types/theme.d.ts +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lit"),a=require("lit/decorators.js"),n=require("lit/directives/class-map.js");var u=Object.defineProperty,y=Object.getOwnPropertyDescriptor,p=(c,e,t,s)=>{for(var r=s>1?void 0:s?y(e,t):e,i=c.length-1,l;i>=0;i--)(l=c[i])&&(r=(s?l(e,t,r):l(r))||r);return s&&r&&u(e,t,r),r};exports.PdStepper=class extends o.LitElement{constructor(){super(...arguments),this.steps=[],this.currentStep=0,this.orientation="horizontal",this.linear=!0,this.showContent=!0,this.alternativeLabel=!1,this._completedSteps=new Set}render(){const e=this.orientation==="vertical",t={stepper:!0,vertical:e,horizontal:!e,"alternative-label":this.alternativeLabel&&!e};return o.html`
|
|
2
|
+
<div class=${n.classMap(t)}>
|
|
3
|
+
${this.steps.map((s,r)=>this._renderStep(s,r))}
|
|
4
|
+
${this.showContent&&!e?this._renderContent():""}
|
|
5
|
+
</div>
|
|
6
|
+
`}_renderStep(e,t){const s=this.currentStep===t,r=this._completedSteps.has(t)||e.completed,i=e.error&&!r,l=!this.linear||t<=this.currentStep||r,d=this.orientation==="vertical",m={step:!0,active:s,completed:r||!1,error:i||!1,clickable:l||!1,optional:e.optional||!1},v=r?"✓":(t+1).toString(),h=t===this.steps.length-1;return o.html`
|
|
7
|
+
<div class=${n.classMap(m)}>
|
|
8
|
+
<div class="step-header" @click=${()=>this._handleStepClick(t,l||!1)}>
|
|
9
|
+
<div class="step-icon">
|
|
10
|
+
<span class="step-number">${i?"!":v}</span>
|
|
11
|
+
</div>
|
|
12
|
+
${h?"":o.html`<div class="step-connector"></div>`}
|
|
13
|
+
<div class="step-label-container">
|
|
14
|
+
<span class="step-label">${e.label}</span>
|
|
15
|
+
${e.optional?o.html`<span class="step-optional">Optional</span>`:""}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
${d&&this.showContent&&s&&e.content?o.html`
|
|
19
|
+
<div class="step-content">
|
|
20
|
+
${e.content}
|
|
21
|
+
</div>
|
|
22
|
+
`:""}
|
|
23
|
+
</div>
|
|
24
|
+
`}_renderContent(){const e=this.steps[this.currentStep];return e?.content?o.html`
|
|
25
|
+
<div class="stepper-content">
|
|
26
|
+
${e.content}
|
|
27
|
+
</div>
|
|
28
|
+
`:""}_handleStepClick(e,t){if(!t)return;const s=this.currentStep;this.currentStep=e,this.dispatchEvent(new CustomEvent("step-change",{detail:{currentStep:e,previousStep:s},bubbles:!0,composed:!0}))}completeStep(e){this._completedSteps.add(e),this.requestUpdate()}resetStep(e){this._completedSteps.delete(e),this.requestUpdate()}next(){this.currentStep<this.steps.length-1&&(this.completeStep(this.currentStep),this.currentStep++,this._dispatchStepChange())}back(){this.currentStep>0&&(this.currentStep--,this._dispatchStepChange())}_dispatchStepChange(){this.dispatchEvent(new CustomEvent("step-change",{detail:{currentStep:this.currentStep},bubbles:!0,composed:!0}))}};exports.PdStepper.styles=o.css`
|
|
29
|
+
:host {
|
|
30
|
+
display: block;
|
|
31
|
+
font-family: var(--md-sys-typescale-body-large-font, 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.stepper {
|
|
35
|
+
display: flex;
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.stepper.horizontal {
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.stepper.vertical {
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.stepper.alternative-label .step {
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
text-align: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Step container */
|
|
54
|
+
.step {
|
|
55
|
+
display: flex;
|
|
56
|
+
position: relative;
|
|
57
|
+
min-height: 72px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.stepper.horizontal .step {
|
|
61
|
+
flex: 1;
|
|
62
|
+
flex-direction: row;
|
|
63
|
+
align-items: flex-start;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.stepper.vertical .step {
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
width: 100%;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Step header */
|
|
72
|
+
.step-header {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: flex-start;
|
|
75
|
+
cursor: default;
|
|
76
|
+
position: relative;
|
|
77
|
+
padding: var(--md-sys-spacing-medium, 8px);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.step.clickable .step-header {
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.stepper.horizontal .step-header {
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
align-items: center;
|
|
87
|
+
text-align: center;
|
|
88
|
+
width: 100%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.stepper.vertical .step-header {
|
|
92
|
+
flex-direction: row;
|
|
93
|
+
align-items: flex-start;
|
|
94
|
+
text-align: left;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.stepper.alternative-label .step-header {
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Step icon */
|
|
102
|
+
.step-icon {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
width: 40px;
|
|
107
|
+
height: 40px;
|
|
108
|
+
border-radius: 50%;
|
|
109
|
+
background-color: var(--pd-stepper-inactive-color, var(--md-sys-color-surface-variant, #f3f3f3));
|
|
110
|
+
color: var(--md-sys-color-on-surface-variant, #666);
|
|
111
|
+
border: 2px solid var(--pd-stepper-inactive-color, var(--md-sys-color-outline-variant, #ddd));
|
|
112
|
+
transition: all 0.2s ease;
|
|
113
|
+
z-index: 1;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.step.active .step-icon {
|
|
117
|
+
background-color: var(--pd-stepper-active-color, var(--md-sys-color-primary, #6750a4));
|
|
118
|
+
color: var(--md-sys-color-on-primary, #fff);
|
|
119
|
+
border-color: var(--pd-stepper-active-color, var(--md-sys-color-primary, #6750a4));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.step.completed .step-icon {
|
|
123
|
+
background-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
124
|
+
color: var(--md-sys-color-on-primary, #fff);
|
|
125
|
+
border-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.step.error .step-icon {
|
|
129
|
+
background-color: var(--pd-stepper-error-color, var(--md-sys-color-error, #ba1a1a));
|
|
130
|
+
color: var(--md-sys-color-on-error, #fff);
|
|
131
|
+
border-color: var(--pd-stepper-error-color, var(--md-sys-color-error, #ba1a1a));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.step-number {
|
|
135
|
+
font-size: var(--md-sys-typescale-label-medium-size, 12px);
|
|
136
|
+
font-weight: var(--md-sys-typescale-label-medium-weight, 500);
|
|
137
|
+
line-height: 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Step connector */
|
|
141
|
+
.step-connector {
|
|
142
|
+
position: absolute;
|
|
143
|
+
background-color: var(--pd-stepper-connector-color, var(--md-sys-color-outline-variant, #ddd));
|
|
144
|
+
transition: background-color 0.2s ease;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.stepper.horizontal .step-connector {
|
|
148
|
+
height: 2px;
|
|
149
|
+
left: calc(50% + 20px);
|
|
150
|
+
right: calc(-50% + 20px);
|
|
151
|
+
top: calc(var(--md-sys-spacing-medium, 8px) + 20px);
|
|
152
|
+
width: calc(100% - 40px);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.stepper.vertical .step-connector {
|
|
156
|
+
width: 2px;
|
|
157
|
+
left: calc(var(--md-sys-spacing-medium, 8px) + 20px);
|
|
158
|
+
top: calc(var(--md-sys-spacing-medium, 8px) + 40px);
|
|
159
|
+
bottom: calc(-100% + var(--md-sys-spacing-medium, 8px));
|
|
160
|
+
height: calc(100% - 40px);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.step.completed .step-connector {
|
|
164
|
+
background-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.step.active .step-connector {
|
|
168
|
+
background-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Step labels */
|
|
172
|
+
.step-label-container {
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: column;
|
|
175
|
+
gap: 4px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.stepper.horizontal .step-label-container {
|
|
179
|
+
margin-top: var(--md-sys-spacing-small, 8px);
|
|
180
|
+
align-items: center;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.stepper.vertical .step-label-container {
|
|
184
|
+
margin-left: var(--md-sys-spacing-medium, 16px);
|
|
185
|
+
align-items: flex-start;
|
|
186
|
+
margin-top: 8px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.step-label {
|
|
190
|
+
font-size: var(--md-sys-typescale-body-medium-size, 14px);
|
|
191
|
+
font-weight: var(--md-sys-typescale-body-medium-weight, 400);
|
|
192
|
+
color: var(--md-sys-color-on-surface-variant, #666);
|
|
193
|
+
line-height: 1.4;
|
|
194
|
+
margin: 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.step.active .step-label {
|
|
198
|
+
color: var(--md-sys-color-on-surface, #000);
|
|
199
|
+
font-weight: var(--md-sys-typescale-body-medium-weight, 500);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.step.completed .step-label {
|
|
203
|
+
color: var(--md-sys-color-on-surface, #000);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.step.error .step-label {
|
|
207
|
+
color: var(--pd-stepper-error-color, var(--md-sys-color-error, #ba1a1a));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.step-optional {
|
|
211
|
+
font-size: var(--md-sys-typescale-body-small-size, 12px);
|
|
212
|
+
color: var(--md-sys-color-on-surface-variant, #999);
|
|
213
|
+
font-style: italic;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* Step content */
|
|
217
|
+
.step-content {
|
|
218
|
+
margin-left: calc(var(--md-sys-spacing-medium, 8px) + 40px + var(--md-sys-spacing-medium, 16px));
|
|
219
|
+
margin-top: var(--md-sys-spacing-medium, 16px);
|
|
220
|
+
margin-bottom: var(--md-sys-spacing-large, 24px);
|
|
221
|
+
padding: var(--md-sys-spacing-medium, 16px);
|
|
222
|
+
border-radius: var(--md-sys-shape-corner-small, 8px);
|
|
223
|
+
background-color: var(--md-sys-color-surface-container-lowest, #fff);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.stepper-content {
|
|
227
|
+
margin-top: var(--md-sys-spacing-large, 24px);
|
|
228
|
+
padding: var(--md-sys-spacing-large, 24px);
|
|
229
|
+
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
230
|
+
background-color: var(--md-sys-color-surface-container-lowest, #fff);
|
|
231
|
+
border: 1px solid var(--md-sys-color-outline-variant, #ddd);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* Hover states */
|
|
235
|
+
.step.clickable .step-header:hover .step-icon {
|
|
236
|
+
transform: scale(1.1);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.step.clickable .step-header:hover .step-label {
|
|
240
|
+
color: var(--md-sys-color-on-surface, #000);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* Focus states for accessibility */
|
|
244
|
+
.step.clickable .step-header:focus-visible {
|
|
245
|
+
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
246
|
+
outline-offset: 2px;
|
|
247
|
+
border-radius: var(--md-sys-shape-corner-small, 8px);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* Responsive adjustments */
|
|
251
|
+
@media (max-width: 768px) {
|
|
252
|
+
.stepper.horizontal {
|
|
253
|
+
flex-direction: column;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.stepper.horizontal .step {
|
|
257
|
+
flex-direction: row;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.stepper.horizontal .step-header {
|
|
261
|
+
flex-direction: row;
|
|
262
|
+
text-align: left;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.stepper.horizontal .step-connector {
|
|
266
|
+
left: calc(var(--md-sys-spacing-medium, 8px) + 20px);
|
|
267
|
+
top: calc(var(--md-sys-spacing-medium, 8px) + 40px);
|
|
268
|
+
width: 2px;
|
|
269
|
+
height: calc(100% - 40px);
|
|
270
|
+
right: auto;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.stepper.horizontal .step-label-container {
|
|
274
|
+
margin-top: 8px;
|
|
275
|
+
margin-left: var(--md-sys-spacing-medium, 16px);
|
|
276
|
+
align-items: flex-start;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
`;p([a.property({type:Array})],exports.PdStepper.prototype,"steps",2);p([a.property({type:Number})],exports.PdStepper.prototype,"currentStep",2);p([a.property({type:String})],exports.PdStepper.prototype,"orientation",2);p([a.property({type:Boolean})],exports.PdStepper.prototype,"linear",2);p([a.property({type:Boolean})],exports.PdStepper.prototype,"showContent",2);p([a.property({type:Boolean})],exports.PdStepper.prototype,"alternativeLabel",2);p([a.state()],exports.PdStepper.prototype,"_completedSteps",2);exports.PdStepper=p([a.customElement("pd-stepper")],exports.PdStepper);
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { css as u, LitElement as y, html as l } from "lit";
|
|
2
|
+
import { property as c, state as f, customElement as g } from "lit/decorators.js";
|
|
3
|
+
import { classMap as d } from "lit/directives/class-map.js";
|
|
4
|
+
var x = Object.defineProperty, b = Object.getOwnPropertyDescriptor, p = (e, t, s, r) => {
|
|
5
|
+
for (var o = r > 1 ? void 0 : r ? b(t, s) : t, i = e.length - 1, n; i >= 0; i--)
|
|
6
|
+
(n = e[i]) && (o = (r ? n(t, s, o) : n(o)) || o);
|
|
7
|
+
return r && o && x(t, s, o), o;
|
|
8
|
+
};
|
|
9
|
+
let a = class extends y {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.steps = [], this.currentStep = 0, this.orientation = "horizontal", this.linear = !0, this.showContent = !0, this.alternativeLabel = !1, this._completedSteps = /* @__PURE__ */ new Set();
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const e = this.orientation === "vertical", t = {
|
|
15
|
+
stepper: !0,
|
|
16
|
+
vertical: e,
|
|
17
|
+
horizontal: !e,
|
|
18
|
+
"alternative-label": this.alternativeLabel && !e
|
|
19
|
+
};
|
|
20
|
+
return l`
|
|
21
|
+
<div class=${d(t)}>
|
|
22
|
+
${this.steps.map((s, r) => this._renderStep(s, r))}
|
|
23
|
+
${this.showContent && !e ? this._renderContent() : ""}
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
_renderStep(e, t) {
|
|
28
|
+
const s = this.currentStep === t, r = this._completedSteps.has(t) || e.completed, o = e.error && !r, i = !this.linear || t <= this.currentStep || r, n = this.orientation === "vertical", m = {
|
|
29
|
+
step: !0,
|
|
30
|
+
active: s,
|
|
31
|
+
completed: r || !1,
|
|
32
|
+
error: o || !1,
|
|
33
|
+
clickable: i || !1,
|
|
34
|
+
optional: e.optional || !1
|
|
35
|
+
}, v = r ? "✓" : (t + 1).toString(), h = t === this.steps.length - 1;
|
|
36
|
+
return l`
|
|
37
|
+
<div class=${d(m)}>
|
|
38
|
+
<div class="step-header" @click=${() => this._handleStepClick(t, i || !1)}>
|
|
39
|
+
<div class="step-icon">
|
|
40
|
+
<span class="step-number">${o ? "!" : v}</span>
|
|
41
|
+
</div>
|
|
42
|
+
${h ? "" : l`<div class="step-connector"></div>`}
|
|
43
|
+
<div class="step-label-container">
|
|
44
|
+
<span class="step-label">${e.label}</span>
|
|
45
|
+
${e.optional ? l`<span class="step-optional">Optional</span>` : ""}
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
${n && this.showContent && s && e.content ? l`
|
|
49
|
+
<div class="step-content">
|
|
50
|
+
${e.content}
|
|
51
|
+
</div>
|
|
52
|
+
` : ""}
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
_renderContent() {
|
|
57
|
+
const e = this.steps[this.currentStep];
|
|
58
|
+
return e?.content ? l`
|
|
59
|
+
<div class="stepper-content">
|
|
60
|
+
${e.content}
|
|
61
|
+
</div>
|
|
62
|
+
` : "";
|
|
63
|
+
}
|
|
64
|
+
_handleStepClick(e, t) {
|
|
65
|
+
if (!t) return;
|
|
66
|
+
const s = this.currentStep;
|
|
67
|
+
this.currentStep = e, this.dispatchEvent(new CustomEvent("step-change", {
|
|
68
|
+
detail: { currentStep: e, previousStep: s },
|
|
69
|
+
bubbles: !0,
|
|
70
|
+
composed: !0
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
/** Mark a step as completed */
|
|
74
|
+
completeStep(e) {
|
|
75
|
+
this._completedSteps.add(e), this.requestUpdate();
|
|
76
|
+
}
|
|
77
|
+
/** Mark a step as incomplete */
|
|
78
|
+
resetStep(e) {
|
|
79
|
+
this._completedSteps.delete(e), this.requestUpdate();
|
|
80
|
+
}
|
|
81
|
+
/** Go to next step */
|
|
82
|
+
next() {
|
|
83
|
+
this.currentStep < this.steps.length - 1 && (this.completeStep(this.currentStep), this.currentStep++, this._dispatchStepChange());
|
|
84
|
+
}
|
|
85
|
+
/** Go to previous step */
|
|
86
|
+
back() {
|
|
87
|
+
this.currentStep > 0 && (this.currentStep--, this._dispatchStepChange());
|
|
88
|
+
}
|
|
89
|
+
_dispatchStepChange() {
|
|
90
|
+
this.dispatchEvent(new CustomEvent("step-change", {
|
|
91
|
+
detail: { currentStep: this.currentStep },
|
|
92
|
+
bubbles: !0,
|
|
93
|
+
composed: !0
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
a.styles = u`
|
|
98
|
+
:host {
|
|
99
|
+
display: block;
|
|
100
|
+
font-family: var(--md-sys-typescale-body-large-font, 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.stepper {
|
|
104
|
+
display: flex;
|
|
105
|
+
position: relative;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.stepper.horizontal {
|
|
109
|
+
flex-direction: row;
|
|
110
|
+
align-items: flex-start;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.stepper.vertical {
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.stepper.alternative-label .step {
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
text-align: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Step container */
|
|
123
|
+
.step {
|
|
124
|
+
display: flex;
|
|
125
|
+
position: relative;
|
|
126
|
+
min-height: 72px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.stepper.horizontal .step {
|
|
130
|
+
flex: 1;
|
|
131
|
+
flex-direction: row;
|
|
132
|
+
align-items: flex-start;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.stepper.vertical .step {
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
width: 100%;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Step header */
|
|
141
|
+
.step-header {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: flex-start;
|
|
144
|
+
cursor: default;
|
|
145
|
+
position: relative;
|
|
146
|
+
padding: var(--md-sys-spacing-medium, 8px);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.step.clickable .step-header {
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.stepper.horizontal .step-header {
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
align-items: center;
|
|
156
|
+
text-align: center;
|
|
157
|
+
width: 100%;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.stepper.vertical .step-header {
|
|
161
|
+
flex-direction: row;
|
|
162
|
+
align-items: flex-start;
|
|
163
|
+
text-align: left;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.stepper.alternative-label .step-header {
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Step icon */
|
|
171
|
+
.step-icon {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
width: 40px;
|
|
176
|
+
height: 40px;
|
|
177
|
+
border-radius: 50%;
|
|
178
|
+
background-color: var(--pd-stepper-inactive-color, var(--md-sys-color-surface-variant, #f3f3f3));
|
|
179
|
+
color: var(--md-sys-color-on-surface-variant, #666);
|
|
180
|
+
border: 2px solid var(--pd-stepper-inactive-color, var(--md-sys-color-outline-variant, #ddd));
|
|
181
|
+
transition: all 0.2s ease;
|
|
182
|
+
z-index: 1;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.step.active .step-icon {
|
|
186
|
+
background-color: var(--pd-stepper-active-color, var(--md-sys-color-primary, #6750a4));
|
|
187
|
+
color: var(--md-sys-color-on-primary, #fff);
|
|
188
|
+
border-color: var(--pd-stepper-active-color, var(--md-sys-color-primary, #6750a4));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.step.completed .step-icon {
|
|
192
|
+
background-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
193
|
+
color: var(--md-sys-color-on-primary, #fff);
|
|
194
|
+
border-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.step.error .step-icon {
|
|
198
|
+
background-color: var(--pd-stepper-error-color, var(--md-sys-color-error, #ba1a1a));
|
|
199
|
+
color: var(--md-sys-color-on-error, #fff);
|
|
200
|
+
border-color: var(--pd-stepper-error-color, var(--md-sys-color-error, #ba1a1a));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.step-number {
|
|
204
|
+
font-size: var(--md-sys-typescale-label-medium-size, 12px);
|
|
205
|
+
font-weight: var(--md-sys-typescale-label-medium-weight, 500);
|
|
206
|
+
line-height: 1;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Step connector */
|
|
210
|
+
.step-connector {
|
|
211
|
+
position: absolute;
|
|
212
|
+
background-color: var(--pd-stepper-connector-color, var(--md-sys-color-outline-variant, #ddd));
|
|
213
|
+
transition: background-color 0.2s ease;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.stepper.horizontal .step-connector {
|
|
217
|
+
height: 2px;
|
|
218
|
+
left: calc(50% + 20px);
|
|
219
|
+
right: calc(-50% + 20px);
|
|
220
|
+
top: calc(var(--md-sys-spacing-medium, 8px) + 20px);
|
|
221
|
+
width: calc(100% - 40px);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.stepper.vertical .step-connector {
|
|
225
|
+
width: 2px;
|
|
226
|
+
left: calc(var(--md-sys-spacing-medium, 8px) + 20px);
|
|
227
|
+
top: calc(var(--md-sys-spacing-medium, 8px) + 40px);
|
|
228
|
+
bottom: calc(-100% + var(--md-sys-spacing-medium, 8px));
|
|
229
|
+
height: calc(100% - 40px);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.step.completed .step-connector {
|
|
233
|
+
background-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.step.active .step-connector {
|
|
237
|
+
background-color: var(--pd-stepper-completed-color, var(--md-sys-color-primary, #6750a4));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Step labels */
|
|
241
|
+
.step-label-container {
|
|
242
|
+
display: flex;
|
|
243
|
+
flex-direction: column;
|
|
244
|
+
gap: 4px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.stepper.horizontal .step-label-container {
|
|
248
|
+
margin-top: var(--md-sys-spacing-small, 8px);
|
|
249
|
+
align-items: center;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.stepper.vertical .step-label-container {
|
|
253
|
+
margin-left: var(--md-sys-spacing-medium, 16px);
|
|
254
|
+
align-items: flex-start;
|
|
255
|
+
margin-top: 8px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.step-label {
|
|
259
|
+
font-size: var(--md-sys-typescale-body-medium-size, 14px);
|
|
260
|
+
font-weight: var(--md-sys-typescale-body-medium-weight, 400);
|
|
261
|
+
color: var(--md-sys-color-on-surface-variant, #666);
|
|
262
|
+
line-height: 1.4;
|
|
263
|
+
margin: 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.step.active .step-label {
|
|
267
|
+
color: var(--md-sys-color-on-surface, #000);
|
|
268
|
+
font-weight: var(--md-sys-typescale-body-medium-weight, 500);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.step.completed .step-label {
|
|
272
|
+
color: var(--md-sys-color-on-surface, #000);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.step.error .step-label {
|
|
276
|
+
color: var(--pd-stepper-error-color, var(--md-sys-color-error, #ba1a1a));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.step-optional {
|
|
280
|
+
font-size: var(--md-sys-typescale-body-small-size, 12px);
|
|
281
|
+
color: var(--md-sys-color-on-surface-variant, #999);
|
|
282
|
+
font-style: italic;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* Step content */
|
|
286
|
+
.step-content {
|
|
287
|
+
margin-left: calc(var(--md-sys-spacing-medium, 8px) + 40px + var(--md-sys-spacing-medium, 16px));
|
|
288
|
+
margin-top: var(--md-sys-spacing-medium, 16px);
|
|
289
|
+
margin-bottom: var(--md-sys-spacing-large, 24px);
|
|
290
|
+
padding: var(--md-sys-spacing-medium, 16px);
|
|
291
|
+
border-radius: var(--md-sys-shape-corner-small, 8px);
|
|
292
|
+
background-color: var(--md-sys-color-surface-container-lowest, #fff);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.stepper-content {
|
|
296
|
+
margin-top: var(--md-sys-spacing-large, 24px);
|
|
297
|
+
padding: var(--md-sys-spacing-large, 24px);
|
|
298
|
+
border-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
299
|
+
background-color: var(--md-sys-color-surface-container-lowest, #fff);
|
|
300
|
+
border: 1px solid var(--md-sys-color-outline-variant, #ddd);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* Hover states */
|
|
304
|
+
.step.clickable .step-header:hover .step-icon {
|
|
305
|
+
transform: scale(1.1);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.step.clickable .step-header:hover .step-label {
|
|
309
|
+
color: var(--md-sys-color-on-surface, #000);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Focus states for accessibility */
|
|
313
|
+
.step.clickable .step-header:focus-visible {
|
|
314
|
+
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
315
|
+
outline-offset: 2px;
|
|
316
|
+
border-radius: var(--md-sys-shape-corner-small, 8px);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* Responsive adjustments */
|
|
320
|
+
@media (max-width: 768px) {
|
|
321
|
+
.stepper.horizontal {
|
|
322
|
+
flex-direction: column;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.stepper.horizontal .step {
|
|
326
|
+
flex-direction: row;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.stepper.horizontal .step-header {
|
|
330
|
+
flex-direction: row;
|
|
331
|
+
text-align: left;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.stepper.horizontal .step-connector {
|
|
335
|
+
left: calc(var(--md-sys-spacing-medium, 8px) + 20px);
|
|
336
|
+
top: calc(var(--md-sys-spacing-medium, 8px) + 40px);
|
|
337
|
+
width: 2px;
|
|
338
|
+
height: calc(100% - 40px);
|
|
339
|
+
right: auto;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.stepper.horizontal .step-label-container {
|
|
343
|
+
margin-top: 8px;
|
|
344
|
+
margin-left: var(--md-sys-spacing-medium, 16px);
|
|
345
|
+
align-items: flex-start;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
`;
|
|
349
|
+
p([
|
|
350
|
+
c({ type: Array })
|
|
351
|
+
], a.prototype, "steps", 2);
|
|
352
|
+
p([
|
|
353
|
+
c({ type: Number })
|
|
354
|
+
], a.prototype, "currentStep", 2);
|
|
355
|
+
p([
|
|
356
|
+
c({ type: String })
|
|
357
|
+
], a.prototype, "orientation", 2);
|
|
358
|
+
p([
|
|
359
|
+
c({ type: Boolean })
|
|
360
|
+
], a.prototype, "linear", 2);
|
|
361
|
+
p([
|
|
362
|
+
c({ type: Boolean })
|
|
363
|
+
], a.prototype, "showContent", 2);
|
|
364
|
+
p([
|
|
365
|
+
c({ type: Boolean })
|
|
366
|
+
], a.prototype, "alternativeLabel", 2);
|
|
367
|
+
p([
|
|
368
|
+
f()
|
|
369
|
+
], a.prototype, "_completedSteps", 2);
|
|
370
|
+
a = p([
|
|
371
|
+
g("pd-stepper")
|
|
372
|
+
], a);
|
|
373
|
+
export {
|
|
374
|
+
a as PdStepper
|
|
375
|
+
};
|