@prioticket/design-system-web 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENT-DOCUMENTATION.md +3 -1
- package/README.md +107 -27
- package/component-documentation.json +11 -1
- package/dist/components/pd-dialog.cjs.js +1 -1
- package/dist/components/pd-dialog.es.js +7 -7
- package/dist/components/pd-expandable-card.cjs.js +6 -0
- package/dist/components/pd-expandable-card.es.js +18 -12
- package/dist/components/pd-icon-button.cjs.js +77 -46
- package/dist/components/pd-icon-button.es.js +143 -110
- package/dist/components/pd-segmented-button.cjs.js +2 -2
- package/dist/components/pd-segmented-button.es.js +2 -2
- package/dist/components/pd-segmented-stepper.cjs.js +8 -8
- package/dist/components/pd-segmented-stepper.es.js +96 -64
- package/dist/demo-theming.html +331 -0
- package/dist/theming.cjs.js +1 -0
- package/dist/theming.es.js +66 -0
- package/dist/types/components/pd-icon-button.d.ts +3 -2
- package/dist/types/components/pd-segmented-stepper.d.ts +12 -1
- package/dist/types/theming/index.d.ts +47 -0
- package/dist/types/theming/theme-service.d.ts +20 -0
- package/dist/types/theming/types.d.ts +39 -0
- package/package.json +6 -1
|
@@ -1,100 +1,96 @@
|
|
|
1
|
-
import { css as m, LitElement as b, html as
|
|
2
|
-
import { property as i, customElement as h } from "lit/decorators.js";
|
|
1
|
+
import { css as m, LitElement as b, html as c, nothing as a } from "lit";
|
|
2
|
+
import { property as i, state as f, customElement as h } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/iconbutton/icon-button.js";
|
|
4
4
|
import "@material/web/iconbutton/filled-icon-button.js";
|
|
5
5
|
import "@material/web/iconbutton/filled-tonal-icon-button.js";
|
|
6
6
|
import "@material/web/iconbutton/outlined-icon-button.js";
|
|
7
7
|
import "@material/web/icon/icon.js";
|
|
8
|
-
var v = Object.defineProperty,
|
|
9
|
-
for (var
|
|
10
|
-
(u =
|
|
11
|
-
return
|
|
8
|
+
var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, t = (r, n, s, l) => {
|
|
9
|
+
for (var o = l > 1 ? void 0 : l ? y(n, s) : n, d = r.length - 1, u; d >= 0; d--)
|
|
10
|
+
(u = r[d]) && (o = (l ? u(n, s, o) : u(o)) || o);
|
|
11
|
+
return l && o && v(n, s, o), o;
|
|
12
12
|
};
|
|
13
|
-
let
|
|
13
|
+
let e = class extends b {
|
|
14
14
|
constructor() {
|
|
15
|
-
super(...arguments), this.variant = "standard", this.icon = "", this.selectedIcon = "", this.disabled = !1, this.toggle = !1, this.selected = !1, this.href = "", this.target = "", this.ariaLabel = "", this.ariaLabelSelected = "";
|
|
15
|
+
super(...arguments), this.variant = "standard", this.icon = "", this.selectedIcon = "", this.disabled = !1, this.toggle = !1, this.selected = !1, this.href = "", this.target = "", this.ariaLabel = "", this.ariaLabelSelected = "", this._internalSelected = !1;
|
|
16
|
+
}
|
|
17
|
+
// Initialize internal state from selected property
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
super.connectedCallback(), this._internalSelected = this.selected;
|
|
20
|
+
}
|
|
21
|
+
// Get the current selected state (controlled vs uncontrolled)
|
|
22
|
+
get isSelected() {
|
|
23
|
+
return this.toggle ? this._internalSelected : this.selected;
|
|
16
24
|
}
|
|
17
25
|
getIconButtonTemplate() {
|
|
18
|
-
const n = this.
|
|
26
|
+
const r = this.isSelected, n = r && this.selectedIcon ? this.selectedIcon : this.icon, l = n ? c`<md-icon class="${r ? "icon-selected" : "icon-unselected"}">${n}</md-icon>` : c`<slot></slot>`, o = {
|
|
19
27
|
disabled: this.disabled,
|
|
20
28
|
toggle: this.toggle,
|
|
21
|
-
selected:
|
|
22
|
-
href: this.href ||
|
|
23
|
-
target: this.target ||
|
|
24
|
-
"aria-label": this.ariaLabel ||
|
|
25
|
-
"aria-label-selected": this.ariaLabelSelected ||
|
|
29
|
+
selected: r,
|
|
30
|
+
href: this.href || a,
|
|
31
|
+
target: this.target || a,
|
|
32
|
+
"aria-label": this.ariaLabel || a,
|
|
33
|
+
"aria-label-selected": this.ariaLabelSelected || a
|
|
26
34
|
};
|
|
27
35
|
switch (this.variant) {
|
|
28
36
|
case "filled":
|
|
29
|
-
return
|
|
37
|
+
return c`
|
|
30
38
|
<md-filled-icon-button
|
|
31
|
-
?disabled=${
|
|
32
|
-
?toggle=${
|
|
33
|
-
?selected=${
|
|
34
|
-
.href=${
|
|
35
|
-
.target=${
|
|
36
|
-
aria-label=${
|
|
37
|
-
aria-label-selected=${
|
|
38
|
-
@input=${this._handleInput}
|
|
39
|
-
@change=${this._handleChange}
|
|
39
|
+
?disabled=${o.disabled}
|
|
40
|
+
?toggle=${o.toggle}
|
|
41
|
+
?selected=${o.selected}
|
|
42
|
+
.href=${o.href}
|
|
43
|
+
.target=${o.target}
|
|
44
|
+
aria-label=${o["aria-label"]}
|
|
45
|
+
aria-label-selected=${o["aria-label-selected"]}
|
|
40
46
|
@click=${this._handleClick}
|
|
41
47
|
>
|
|
42
|
-
${
|
|
43
|
-
${t}
|
|
48
|
+
${l}
|
|
44
49
|
</md-filled-icon-button>
|
|
45
50
|
`;
|
|
46
51
|
case "tonal":
|
|
47
|
-
return
|
|
52
|
+
return c`
|
|
48
53
|
<md-filled-tonal-icon-button
|
|
49
|
-
?disabled=${
|
|
50
|
-
?toggle=${
|
|
51
|
-
?selected=${
|
|
52
|
-
.href=${
|
|
53
|
-
.target=${
|
|
54
|
-
aria-label=${
|
|
55
|
-
aria-label-selected=${
|
|
56
|
-
@input=${this._handleInput}
|
|
57
|
-
@change=${this._handleChange}
|
|
54
|
+
?disabled=${o.disabled}
|
|
55
|
+
?toggle=${o.toggle}
|
|
56
|
+
?selected=${o.selected}
|
|
57
|
+
.href=${o.href}
|
|
58
|
+
.target=${o.target}
|
|
59
|
+
aria-label=${o["aria-label"]}
|
|
60
|
+
aria-label-selected=${o["aria-label-selected"]}
|
|
58
61
|
@click=${this._handleClick}
|
|
59
62
|
>
|
|
60
|
-
${
|
|
61
|
-
${t}
|
|
63
|
+
${l}
|
|
62
64
|
</md-filled-tonal-icon-button>
|
|
63
65
|
`;
|
|
64
66
|
case "outlined":
|
|
65
|
-
return
|
|
67
|
+
return c`
|
|
66
68
|
<md-outlined-icon-button
|
|
67
|
-
?disabled=${
|
|
68
|
-
?toggle=${
|
|
69
|
-
?selected=${
|
|
70
|
-
.href=${
|
|
71
|
-
.target=${
|
|
72
|
-
aria-label=${
|
|
73
|
-
aria-label-selected=${
|
|
74
|
-
@input=${this._handleInput}
|
|
75
|
-
@change=${this._handleChange}
|
|
69
|
+
?disabled=${o.disabled}
|
|
70
|
+
?toggle=${o.toggle}
|
|
71
|
+
?selected=${o.selected}
|
|
72
|
+
.href=${o.href}
|
|
73
|
+
.target=${o.target}
|
|
74
|
+
aria-label=${o["aria-label"]}
|
|
75
|
+
aria-label-selected=${o["aria-label-selected"]}
|
|
76
76
|
@click=${this._handleClick}
|
|
77
77
|
>
|
|
78
|
-
${
|
|
79
|
-
${t}
|
|
78
|
+
${l}
|
|
80
79
|
</md-outlined-icon-button>
|
|
81
80
|
`;
|
|
82
81
|
default:
|
|
83
|
-
return
|
|
82
|
+
return c`
|
|
84
83
|
<md-icon-button
|
|
85
|
-
?disabled=${
|
|
86
|
-
?toggle=${
|
|
87
|
-
?selected=${
|
|
88
|
-
.href=${
|
|
89
|
-
.target=${
|
|
90
|
-
aria-label=${
|
|
91
|
-
aria-label-selected=${
|
|
92
|
-
@input=${this._handleInput}
|
|
93
|
-
@change=${this._handleChange}
|
|
84
|
+
?disabled=${o.disabled}
|
|
85
|
+
?toggle=${o.toggle}
|
|
86
|
+
?selected=${o.selected}
|
|
87
|
+
.href=${o.href}
|
|
88
|
+
.target=${o.target}
|
|
89
|
+
aria-label=${o["aria-label"]}
|
|
90
|
+
aria-label-selected=${o["aria-label-selected"]}
|
|
94
91
|
@click=${this._handleClick}
|
|
95
92
|
>
|
|
96
|
-
${
|
|
97
|
-
${t}
|
|
93
|
+
${l}
|
|
98
94
|
</md-icon-button>
|
|
99
95
|
`;
|
|
100
96
|
}
|
|
@@ -102,40 +98,31 @@ let o = class extends b {
|
|
|
102
98
|
render() {
|
|
103
99
|
return this.getIconButtonTemplate();
|
|
104
100
|
}
|
|
105
|
-
_handleClick(
|
|
106
|
-
this.disabled || this.dispatchEvent(new CustomEvent("icon-button-click", {
|
|
107
|
-
detail: {
|
|
108
|
-
variant: this.variant,
|
|
109
|
-
selected: this.selected,
|
|
110
|
-
toggle: this.toggle
|
|
111
|
-
},
|
|
112
|
-
bubbles: !0
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
_handleInput(n) {
|
|
101
|
+
_handleClick(r) {
|
|
116
102
|
if (this.disabled) return;
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
this.toggle && (this._internalSelected = !this._internalSelected);
|
|
104
|
+
const n = this.isSelected, s = r.target;
|
|
105
|
+
s && s.blur(), this.dispatchEvent(new CustomEvent("pd-icon-button-click", {
|
|
119
106
|
detail: {
|
|
120
|
-
|
|
121
|
-
|
|
107
|
+
variant: this.variant,
|
|
108
|
+
selected: n,
|
|
109
|
+
toggle: this.toggle,
|
|
110
|
+
icon: this.icon,
|
|
111
|
+
selectedIcon: this.selectedIcon
|
|
122
112
|
},
|
|
123
|
-
bubbles: !0
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
_handleChange(n) {
|
|
127
|
-
if (this.disabled) return;
|
|
128
|
-
const t = n.target;
|
|
129
|
-
this.selected = t.selected, this.dispatchEvent(new CustomEvent("change", {
|
|
113
|
+
bubbles: !0,
|
|
114
|
+
composed: !0
|
|
115
|
+
})), this.toggle && this.dispatchEvent(new CustomEvent("change", {
|
|
130
116
|
detail: {
|
|
131
|
-
selected:
|
|
117
|
+
selected: n,
|
|
132
118
|
variant: this.variant
|
|
133
119
|
},
|
|
134
|
-
bubbles: !0
|
|
120
|
+
bubbles: !0,
|
|
121
|
+
composed: !0
|
|
135
122
|
}));
|
|
136
123
|
}
|
|
137
124
|
};
|
|
138
|
-
|
|
125
|
+
e.styles = m`
|
|
139
126
|
:host {
|
|
140
127
|
display: inline-block;
|
|
141
128
|
--md-icon-button-icon-size: var(--md-sys-icon-size, 1.5rem);
|
|
@@ -144,6 +131,17 @@ o.styles = m`
|
|
|
144
131
|
--md-outlined-icon-button-icon-size: var(--md-sys-icon-size, 1.5rem);
|
|
145
132
|
}
|
|
146
133
|
|
|
134
|
+
/* Icon fill states - Industry standard approach */
|
|
135
|
+
.icon-unselected {
|
|
136
|
+
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
137
|
+
transition: font-variation-settings var(--md-sys-motion-duration-short2, 200ms) var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0.0, 0, 1.0));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.icon-selected {
|
|
141
|
+
font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
142
|
+
transition: font-variation-settings var(--md-sys-motion-duration-short2, 200ms) var(--md-sys-motion-easing-standard, cubic-bezier(0.2, 0.0, 0, 1.0));
|
|
143
|
+
}
|
|
144
|
+
|
|
147
145
|
:host([variant="standard"]) {
|
|
148
146
|
--md-icon-button-icon-color: var(--md-sys-color-on-surface-variant);
|
|
149
147
|
--md-icon-button-hover-icon-color: var(--md-sys-color-on-surface-variant-hover);
|
|
@@ -201,6 +199,7 @@ o.styles = m`
|
|
|
201
199
|
--md-outlined-icon-button-container-shape: var(--md-sys-shape-corner-full);
|
|
202
200
|
}
|
|
203
201
|
|
|
202
|
+
/* Enhanced visual feedback */
|
|
204
203
|
md-icon-button:hover,
|
|
205
204
|
md-filled-icon-button:hover,
|
|
206
205
|
md-filled-tonal-icon-button:hover,
|
|
@@ -215,6 +214,31 @@ o.styles = m`
|
|
|
215
214
|
transform: scale(0.95);
|
|
216
215
|
}
|
|
217
216
|
|
|
217
|
+
/* Remove focus after click to prevent gray state */
|
|
218
|
+
md-icon-button,
|
|
219
|
+
md-filled-icon-button,
|
|
220
|
+
md-filled-tonal-icon-button,
|
|
221
|
+
md-outlined-icon-button {
|
|
222
|
+
outline: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
md-icon-button:focus,
|
|
226
|
+
md-filled-icon-button:focus,
|
|
227
|
+
md-filled-tonal-icon-button:focus,
|
|
228
|
+
md-outlined-icon-button:focus {
|
|
229
|
+
outline: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Only show focus outline for keyboard navigation */
|
|
233
|
+
md-icon-button:focus-visible,
|
|
234
|
+
md-filled-icon-button:focus-visible,
|
|
235
|
+
md-filled-tonal-icon-button:focus-visible,
|
|
236
|
+
md-outlined-icon-button:focus-visible {
|
|
237
|
+
outline: 2px solid var(--md-sys-color-primary);
|
|
238
|
+
outline-offset: 2px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* Disabled state */
|
|
218
242
|
:host([disabled]) md-icon-button,
|
|
219
243
|
:host([disabled]) md-filled-icon-button,
|
|
220
244
|
:host([disabled]) md-filled-tonal-icon-button,
|
|
@@ -229,40 +253,49 @@ o.styles = m`
|
|
|
229
253
|
:host([disabled]) md-outlined-icon-button:hover {
|
|
230
254
|
transform: none;
|
|
231
255
|
}
|
|
256
|
+
|
|
257
|
+
/* Icon accessibility improvements */
|
|
258
|
+
md-icon {
|
|
259
|
+
user-select: none;
|
|
260
|
+
pointer-events: none;
|
|
261
|
+
}
|
|
232
262
|
`;
|
|
233
|
-
|
|
263
|
+
t([
|
|
234
264
|
i({ type: String })
|
|
235
|
-
],
|
|
236
|
-
|
|
265
|
+
], e.prototype, "variant", 2);
|
|
266
|
+
t([
|
|
237
267
|
i({ type: String })
|
|
238
|
-
],
|
|
239
|
-
|
|
268
|
+
], e.prototype, "icon", 2);
|
|
269
|
+
t([
|
|
240
270
|
i({ type: String, attribute: "selected-icon" })
|
|
241
|
-
],
|
|
242
|
-
|
|
271
|
+
], e.prototype, "selectedIcon", 2);
|
|
272
|
+
t([
|
|
243
273
|
i({ type: Boolean })
|
|
244
|
-
],
|
|
245
|
-
|
|
274
|
+
], e.prototype, "disabled", 2);
|
|
275
|
+
t([
|
|
246
276
|
i({ type: Boolean })
|
|
247
|
-
],
|
|
248
|
-
|
|
277
|
+
], e.prototype, "toggle", 2);
|
|
278
|
+
t([
|
|
249
279
|
i({ type: Boolean })
|
|
250
|
-
],
|
|
251
|
-
|
|
280
|
+
], e.prototype, "selected", 2);
|
|
281
|
+
t([
|
|
252
282
|
i({ type: String })
|
|
253
|
-
],
|
|
254
|
-
|
|
283
|
+
], e.prototype, "href", 2);
|
|
284
|
+
t([
|
|
255
285
|
i({ type: String })
|
|
256
|
-
],
|
|
257
|
-
|
|
286
|
+
], e.prototype, "target", 2);
|
|
287
|
+
t([
|
|
258
288
|
i({ type: String, attribute: "aria-label" })
|
|
259
|
-
],
|
|
260
|
-
|
|
289
|
+
], e.prototype, "ariaLabel", 2);
|
|
290
|
+
t([
|
|
261
291
|
i({ type: String, attribute: "aria-label-selected" })
|
|
262
|
-
],
|
|
263
|
-
|
|
292
|
+
], e.prototype, "ariaLabelSelected", 2);
|
|
293
|
+
t([
|
|
294
|
+
f()
|
|
295
|
+
], e.prototype, "_internalSelected", 2);
|
|
296
|
+
e = t([
|
|
264
297
|
h("pd-icon-button")
|
|
265
|
-
],
|
|
298
|
+
], e);
|
|
266
299
|
export {
|
|
267
|
-
|
|
300
|
+
e as PdIconButton
|
|
268
301
|
};
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
border-right-color: var(--md-sys-color-on-surface-opacity-12, rgba(29, 27, 32, 0.12));
|
|
46
46
|
}
|
|
47
47
|
`;n([s.property({type:Boolean,attribute:"multi-select"})],exports.PdSegmentedButton.prototype,"multiSelect",2);n([s.property({type:String,reflect:!0})],exports.PdSegmentedButton.prototype,"size",2);n([s.property({type:Boolean,reflect:!0})],exports.PdSegmentedButton.prototype,"disabled",2);n([s.property({type:Array})],exports.PdSegmentedButton.prototype,"selectedValues",2);n([s.state()],exports.PdSegmentedButton.prototype,"_segments",2);exports.PdSegmentedButton=n([s.customElement("pd-segmented-button")],exports.PdSegmentedButton);exports.PdSegmentItem=class extends l.LitElement{constructor(){super(...arguments),this.value="",this.selected=!1,this.disabled=!1,this.icon="",this.iconOnly=!1}_handleClick(){this.disabled||this.dispatchEvent(new CustomEvent("segment-click",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return l.html`
|
|
48
|
-
<button
|
|
48
|
+
<pd-button
|
|
49
49
|
class="segment ${this.selected?"selected":""} ${this.iconOnly?"icon-only":""}"
|
|
50
50
|
?disabled=${this.disabled}
|
|
51
51
|
@click=${this._handleClick}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
>
|
|
54
54
|
${this.icon?l.html`<md-icon class="segment-icon">${this.icon}</md-icon>`:""}
|
|
55
55
|
${this.iconOnly?"":l.html`<span class="segment-label"><slot></slot></span>`}
|
|
56
|
-
</button>
|
|
56
|
+
</pd-button>
|
|
57
57
|
`}};exports.PdSegmentItem.styles=l.css`
|
|
58
58
|
:host {
|
|
59
59
|
display: inline-flex;
|
|
@@ -119,7 +119,7 @@ let l = class extends p {
|
|
|
119
119
|
}
|
|
120
120
|
render() {
|
|
121
121
|
return d`
|
|
122
|
-
<button
|
|
122
|
+
<pd-button
|
|
123
123
|
class="segment ${this.selected ? "selected" : ""} ${this.iconOnly ? "icon-only" : ""}"
|
|
124
124
|
?disabled=${this.disabled}
|
|
125
125
|
@click=${this._handleClick}
|
|
@@ -127,7 +127,7 @@ let l = class extends p {
|
|
|
127
127
|
>
|
|
128
128
|
${this.icon ? d`<md-icon class="segment-icon">${this.icon}</md-icon>` : ""}
|
|
129
129
|
${this.iconOnly ? "" : d`<span class="segment-label"><slot></slot></span>`}
|
|
130
|
-
</button>
|
|
130
|
+
</pd-button>
|
|
131
131
|
`;
|
|
132
132
|
}
|
|
133
133
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lit"),i=require("lit/decorators.js");require("@material/web/icon/icon.js");var n=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(c,e,t,s)=>{for(var o=s>1?void 0:s?d(e,t):e,a=c.length-1,l;a>=0;a--)(l=c[a])&&(o=(s?l(e,t,o):l(o))||o);return s&&o&&n(e,t,o),o};exports.PdSegmentedStepper=class extends p.LitElement{constructor(){super(...arguments),this.activeStep=0,this.completedSteps=[],this.size="medium",this.disabled=!1,this.allowStepNavigation=!0,this.linear=!0,this._steps=[],this._completedStepsSet=new Set}connectedCallback(){super.connectedCallback(),this.addEventListener("stepper-item-click",this._handleStepClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("stepper-item-click",this._handleStepClick)}firstUpdated(){this._updateSteps()}updated(e){super.updated(e),(e.has("activeStep")||e.has("completedSteps")||e.has("disabled")||e.has("allowStepNavigation")||e.has("linear"))&&(this._updateSteps(),e.has("completedSteps")&&(this._completedStepsSet=new Set(this.completedSteps)))}_updateSteps(){const e=this.querySelectorAll("pd-stepper-item");this._steps=Array.from(e),this._steps.forEach((t,s)=>{t.disabled=this.disabled,t.setAttribute("data-step-index",s.toString()),t.stepNumber=s+1;const o=this._completedStepsSet.has(s)||this.completedSteps.includes(s);o?t.state="completed":s===this.activeStep?t.state="active":t.state="pending";const a=!this.linear||s<=this.activeStep||o;t.clickable=this.allowStepNavigation&&a&&!this.disabled})}_handleStepClick(e){if(this.disabled)return;const t=e.target,s=parseInt(t.getAttribute("data-step-index")||"0");t.clickable&&this.allowStepNavigation&&this.goToStep(s)}goToStep(e){if(e>=0&&e<this._steps.length&&e!==this.activeStep){const t=this.activeStep;this.activeStep=e,this._completedStepsSet=new Set(this.completedSteps),this._updateSteps(),this._dispatchStepChange(t)}}_dispatchStepChange(e){this.dispatchEvent(new CustomEvent("step-change",{detail:{currentStep:this.activeStep,previousStep:e??this.activeStep},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("stepchange",{detail:{activeStep:this.activeStep,previousStep:e??this.activeStep,totalSteps:this._steps.length},bubbles:!0,composed:!0}))}next(){this.activeStep<this._steps.length-1&&(this.completeStep(this.activeStep),this.goToStep(this.activeStep+1))}back(){this.activeStep>0&&this.goToStep(this.activeStep-1)}nextStep(){this.next()}previousStep(){this.back()}completeCurrentStep(){this.completeStep(this.activeStep)}completeStep(e){e>=0&&e<this._steps.length&&!this._completedStepsSet.has(e)&&(this._completedStepsSet.add(e),this.completedSteps=Array.from(this._completedStepsSet).sort((t,s)=>t-s),this._updateSteps(),this.dispatchEvent(new CustomEvent("stepcomplete",{detail:{completedStep:e,completedSteps:this.completedSteps,totalSteps:this._steps.length},bubbles:!0,composed:!0})))}resetStep(e){e>=0&&e<this._steps.length&&this._completedStepsSet.has(e)&&(this._completedStepsSet.delete(e),this.completedSteps=Array.from(this._completedStepsSet).sort((t,s)=>t-s),this._updateSteps())}reset(){this.activeStep=0,this.completedSteps=[],this._completedStepsSet.clear(),this._updateSteps()}render(){return p.html`
|
|
2
2
|
<div class="segmented-stepper" role="group" aria-label="Progress stepper">
|
|
3
3
|
<slot @slotchange=${this._updateSteps}></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}};exports.PdSegmentedStepper.styles=
|
|
5
|
+
`}};exports.PdSegmentedStepper.styles=p.css`
|
|
6
6
|
:host {
|
|
7
7
|
display: inline-flex;
|
|
8
8
|
font-family: var(--md-sys-typescale-body-large-font, 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
:host([disabled]) ::slotted(pd-stepper-item) {
|
|
46
46
|
border-right-color: var(--md-sys-color-on-surface-opacity-12, rgba(29, 27, 32, 0.12));
|
|
47
47
|
}
|
|
48
|
-
`;
|
|
48
|
+
`;r([i.property({type:Number,attribute:"active-step"})],exports.PdSegmentedStepper.prototype,"activeStep",2);r([i.property({type:Array,attribute:"completed-steps"})],exports.PdSegmentedStepper.prototype,"completedSteps",2);r([i.property({type:String,reflect:!0})],exports.PdSegmentedStepper.prototype,"size",2);r([i.property({type:Boolean,reflect:!0})],exports.PdSegmentedStepper.prototype,"disabled",2);r([i.property({type:Boolean,attribute:"allow-step-navigation"})],exports.PdSegmentedStepper.prototype,"allowStepNavigation",2);r([i.property({type:Boolean})],exports.PdSegmentedStepper.prototype,"linear",2);r([i.state()],exports.PdSegmentedStepper.prototype,"_steps",2);r([i.state()],exports.PdSegmentedStepper.prototype,"_completedStepsSet",2);exports.PdSegmentedStepper=r([i.customElement("pd-segmented-stepper")],exports.PdSegmentedStepper);exports.PdStepperItem=class extends p.LitElement{constructor(){super(...arguments),this.stepNumber=1,this.state="pending",this.disabled=!1,this.clickable=!1,this.icon=""}_handleClick(){this.disabled||!this.clickable||this.dispatchEvent(new CustomEvent("stepper-item-click",{detail:{stepNumber:this.stepNumber},bubbles:!0,composed:!0}))}render(){const e=this.state==="completed"&&!this.icon,t=this.state!=="completed"&&!this.icon;return p.html`
|
|
49
49
|
<button
|
|
50
50
|
class="step ${this.state} ${this.clickable?"clickable":""}"
|
|
51
51
|
?disabled=${this.disabled}
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
aria-label="Step ${this.stepNumber}: ${this.state}"
|
|
55
55
|
>
|
|
56
56
|
<div class="step-indicator">
|
|
57
|
-
${e?
|
|
58
|
-
${this.icon?
|
|
59
|
-
${t?
|
|
57
|
+
${e?p.html`<md-icon class="check-icon">check</md-icon>`:""}
|
|
58
|
+
${this.icon?p.html`<md-icon class="step-icon">${this.icon}</md-icon>`:""}
|
|
59
|
+
${t?p.html`<span class="step-number">${this.stepNumber}</span>`:""}
|
|
60
60
|
</div>
|
|
61
61
|
<span class="step-label"><slot></slot></span>
|
|
62
62
|
</button>
|
|
63
|
-
`}};exports.PdStepperItem.styles=
|
|
63
|
+
`}};exports.PdStepperItem.styles=p.css`
|
|
64
64
|
:host {
|
|
65
65
|
display: inline-flex;
|
|
66
66
|
}
|
|
@@ -188,4 +188,4 @@
|
|
|
188
188
|
outline: 2px solid var(--md-sys-color-primary, #6750a4);
|
|
189
189
|
outline-offset: 2px;
|
|
190
190
|
}
|
|
191
|
-
`;
|
|
191
|
+
`;r([i.property({type:Number,attribute:"step-number"})],exports.PdStepperItem.prototype,"stepNumber",2);r([i.property({type:String,reflect:!0})],exports.PdStepperItem.prototype,"state",2);r([i.property({type:Boolean,reflect:!0})],exports.PdStepperItem.prototype,"disabled",2);r([i.property({type:Boolean})],exports.PdStepperItem.prototype,"clickable",2);r([i.property({type:String})],exports.PdStepperItem.prototype,"icon",2);exports.PdStepperItem=r([i.customElement("pd-stepper-item")],exports.PdStepperItem);
|