@prioticket/design-system-web 1.0.0 → 1.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/COMPONENT-DOCUMENTATION.md +3 -1
- package/README.md +39 -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/types/components/pd-icon-button.d.ts +3 -2
- package/dist/types/components/pd-segmented-stepper.d.ts +12 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { css as h, LitElement as m, html as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as h, LitElement as m, html as l } from "lit";
|
|
2
|
+
import { property as a, state as u, customElement as b } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/icon/icon.js";
|
|
4
|
-
var v = Object.defineProperty,
|
|
5
|
-
for (var
|
|
6
|
-
(d = e[n]) && (
|
|
7
|
-
return
|
|
4
|
+
var v = Object.defineProperty, S = Object.getOwnPropertyDescriptor, i = (e, t, s, c) => {
|
|
5
|
+
for (var r = c > 1 ? void 0 : c ? S(t, s) : t, n = e.length - 1, d; n >= 0; n--)
|
|
6
|
+
(d = e[n]) && (r = (c ? d(t, s, r) : d(r)) || r);
|
|
7
|
+
return c && r && v(t, s, r), r;
|
|
8
8
|
};
|
|
9
|
-
let
|
|
9
|
+
let o = class extends m {
|
|
10
10
|
constructor() {
|
|
11
|
-
super(...arguments), this.activeStep = 0, this.completedSteps = [], this.size = "medium", this.disabled = !1, this.allowStepNavigation = !0, this._steps = [];
|
|
11
|
+
super(...arguments), this.activeStep = 0, this.completedSteps = [], this.size = "medium", this.disabled = !1, this.allowStepNavigation = !0, this.linear = !0, this._steps = [], this._completedStepsSet = /* @__PURE__ */ new Set();
|
|
12
12
|
}
|
|
13
13
|
connectedCallback() {
|
|
14
14
|
super.connectedCallback(), this.addEventListener("stepper-item-click", this._handleStepClick);
|
|
@@ -20,41 +20,63 @@ let a = class extends m {
|
|
|
20
20
|
this._updateSteps();
|
|
21
21
|
}
|
|
22
22
|
updated(e) {
|
|
23
|
-
super.updated(e), (e.has("activeStep") || e.has("completedSteps") || e.has("disabled") || e.has("allowStepNavigation")) && this._updateSteps();
|
|
23
|
+
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)));
|
|
24
24
|
}
|
|
25
25
|
_updateSteps() {
|
|
26
26
|
const e = this.querySelectorAll("pd-stepper-item");
|
|
27
27
|
this._steps = Array.from(e), this._steps.forEach((t, s) => {
|
|
28
|
-
t.disabled = this.disabled
|
|
28
|
+
t.disabled = this.disabled, t.setAttribute("data-step-index", s.toString()), t.stepNumber = s + 1;
|
|
29
|
+
const c = this._completedStepsSet.has(s) || this.completedSteps.includes(s);
|
|
30
|
+
c ? t.state = "completed" : s === this.activeStep ? t.state = "active" : t.state = "pending";
|
|
31
|
+
const r = !this.linear || s <= this.activeStep || c;
|
|
32
|
+
t.clickable = this.allowStepNavigation && r && !this.disabled;
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
35
|
_handleStepClick(e) {
|
|
32
36
|
if (this.disabled) return;
|
|
33
37
|
const t = e.target, s = parseInt(t.getAttribute("data-step-index") || "0");
|
|
34
|
-
|
|
38
|
+
t.clickable && this.allowStepNavigation && this.goToStep(s);
|
|
35
39
|
}
|
|
36
40
|
/** Navigate to a specific step. */
|
|
37
41
|
goToStep(e) {
|
|
38
|
-
if (e >= 0 && e < this._steps.length) {
|
|
42
|
+
if (e >= 0 && e < this._steps.length && e !== this.activeStep) {
|
|
39
43
|
const t = this.activeStep;
|
|
40
|
-
this.activeStep = e, this.
|
|
41
|
-
detail: {
|
|
42
|
-
activeStep: this.activeStep,
|
|
43
|
-
previousStep: t,
|
|
44
|
-
totalSteps: this._steps.length
|
|
45
|
-
},
|
|
46
|
-
bubbles: !0,
|
|
47
|
-
composed: !0
|
|
48
|
-
}));
|
|
44
|
+
this.activeStep = e, this._completedStepsSet = new Set(this.completedSteps), this._updateSteps(), this._dispatchStepChange(t);
|
|
49
45
|
}
|
|
50
46
|
}
|
|
47
|
+
_dispatchStepChange(e) {
|
|
48
|
+
this.dispatchEvent(new CustomEvent("step-change", {
|
|
49
|
+
detail: {
|
|
50
|
+
currentStep: this.activeStep,
|
|
51
|
+
previousStep: e ?? this.activeStep
|
|
52
|
+
},
|
|
53
|
+
bubbles: !0,
|
|
54
|
+
composed: !0
|
|
55
|
+
})), this.dispatchEvent(new CustomEvent("stepchange", {
|
|
56
|
+
detail: {
|
|
57
|
+
activeStep: this.activeStep,
|
|
58
|
+
previousStep: e ?? this.activeStep,
|
|
59
|
+
totalSteps: this._steps.length
|
|
60
|
+
},
|
|
61
|
+
bubbles: !0,
|
|
62
|
+
composed: !0
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
/** Move to the next step (alias for nextStep). */
|
|
66
|
+
next() {
|
|
67
|
+
this.activeStep < this._steps.length - 1 && (this.completeStep(this.activeStep), this.goToStep(this.activeStep + 1));
|
|
68
|
+
}
|
|
69
|
+
/** Move to the previous step (alias for previousStep). */
|
|
70
|
+
back() {
|
|
71
|
+
this.activeStep > 0 && this.goToStep(this.activeStep - 1);
|
|
72
|
+
}
|
|
51
73
|
/** Move to the next step. */
|
|
52
74
|
nextStep() {
|
|
53
|
-
this.
|
|
75
|
+
this.next();
|
|
54
76
|
}
|
|
55
77
|
/** Move to the previous step. */
|
|
56
78
|
previousStep() {
|
|
57
|
-
this.
|
|
79
|
+
this.back();
|
|
58
80
|
}
|
|
59
81
|
/** Mark the current step as completed and move to the next step. */
|
|
60
82
|
completeCurrentStep() {
|
|
@@ -62,7 +84,7 @@ let a = class extends m {
|
|
|
62
84
|
}
|
|
63
85
|
/** Mark a specific step as completed. */
|
|
64
86
|
completeStep(e) {
|
|
65
|
-
this.
|
|
87
|
+
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", {
|
|
66
88
|
detail: {
|
|
67
89
|
completedStep: e,
|
|
68
90
|
completedSteps: this.completedSteps,
|
|
@@ -70,21 +92,25 @@ let a = class extends m {
|
|
|
70
92
|
},
|
|
71
93
|
bubbles: !0,
|
|
72
94
|
composed: !0
|
|
73
|
-
})))
|
|
95
|
+
})));
|
|
96
|
+
}
|
|
97
|
+
/** Mark a step as incomplete. */
|
|
98
|
+
resetStep(e) {
|
|
99
|
+
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());
|
|
74
100
|
}
|
|
75
101
|
/** Reset all steps to pending state. */
|
|
76
102
|
reset() {
|
|
77
|
-
this.activeStep = 0, this.completedSteps = [], this._updateSteps();
|
|
103
|
+
this.activeStep = 0, this.completedSteps = [], this._completedStepsSet.clear(), this._updateSteps();
|
|
78
104
|
}
|
|
79
105
|
render() {
|
|
80
|
-
return
|
|
106
|
+
return l`
|
|
81
107
|
<div class="segmented-stepper" role="group" aria-label="Progress stepper">
|
|
82
108
|
<slot @slotchange=${this._updateSteps}></slot>
|
|
83
109
|
</div>
|
|
84
110
|
`;
|
|
85
111
|
}
|
|
86
112
|
};
|
|
87
|
-
|
|
113
|
+
o.styles = h`
|
|
88
114
|
:host {
|
|
89
115
|
display: inline-flex;
|
|
90
116
|
font-family: var(--md-sys-typescale-body-large-font, 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
@@ -129,27 +155,33 @@ a.styles = h`
|
|
|
129
155
|
}
|
|
130
156
|
`;
|
|
131
157
|
i([
|
|
132
|
-
|
|
133
|
-
],
|
|
158
|
+
a({ type: Number, attribute: "active-step" })
|
|
159
|
+
], o.prototype, "activeStep", 2);
|
|
160
|
+
i([
|
|
161
|
+
a({ type: Array, attribute: "completed-steps" })
|
|
162
|
+
], o.prototype, "completedSteps", 2);
|
|
163
|
+
i([
|
|
164
|
+
a({ type: String, reflect: !0 })
|
|
165
|
+
], o.prototype, "size", 2);
|
|
134
166
|
i([
|
|
135
|
-
|
|
136
|
-
],
|
|
167
|
+
a({ type: Boolean, reflect: !0 })
|
|
168
|
+
], o.prototype, "disabled", 2);
|
|
137
169
|
i([
|
|
138
|
-
|
|
139
|
-
],
|
|
170
|
+
a({ type: Boolean, attribute: "allow-step-navigation" })
|
|
171
|
+
], o.prototype, "allowStepNavigation", 2);
|
|
140
172
|
i([
|
|
141
|
-
|
|
142
|
-
],
|
|
173
|
+
a({ type: Boolean })
|
|
174
|
+
], o.prototype, "linear", 2);
|
|
143
175
|
i([
|
|
144
|
-
|
|
145
|
-
],
|
|
176
|
+
u()
|
|
177
|
+
], o.prototype, "_steps", 2);
|
|
146
178
|
i([
|
|
147
|
-
|
|
148
|
-
],
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
],
|
|
152
|
-
let
|
|
179
|
+
u()
|
|
180
|
+
], o.prototype, "_completedStepsSet", 2);
|
|
181
|
+
o = i([
|
|
182
|
+
b("pd-segmented-stepper")
|
|
183
|
+
], o);
|
|
184
|
+
let p = class extends m {
|
|
153
185
|
constructor() {
|
|
154
186
|
super(...arguments), this.stepNumber = 1, this.state = "pending", this.disabled = !1, this.clickable = !1, this.icon = "";
|
|
155
187
|
}
|
|
@@ -162,7 +194,7 @@ let r = class extends m {
|
|
|
162
194
|
}
|
|
163
195
|
render() {
|
|
164
196
|
const e = this.state === "completed" && !this.icon, t = this.state !== "completed" && !this.icon;
|
|
165
|
-
return
|
|
197
|
+
return l`
|
|
166
198
|
<button
|
|
167
199
|
class="step ${this.state} ${this.clickable ? "clickable" : ""}"
|
|
168
200
|
?disabled=${this.disabled}
|
|
@@ -171,16 +203,16 @@ let r = class extends m {
|
|
|
171
203
|
aria-label="Step ${this.stepNumber}: ${this.state}"
|
|
172
204
|
>
|
|
173
205
|
<div class="step-indicator">
|
|
174
|
-
${e ?
|
|
175
|
-
${this.icon ?
|
|
176
|
-
${t ?
|
|
206
|
+
${e ? l`<md-icon class="check-icon">check</md-icon>` : ""}
|
|
207
|
+
${this.icon ? l`<md-icon class="step-icon">${this.icon}</md-icon>` : ""}
|
|
208
|
+
${t ? l`<span class="step-number">${this.stepNumber}</span>` : ""}
|
|
177
209
|
</div>
|
|
178
210
|
<span class="step-label"><slot></slot></span>
|
|
179
211
|
</button>
|
|
180
212
|
`;
|
|
181
213
|
}
|
|
182
214
|
};
|
|
183
|
-
|
|
215
|
+
p.styles = h`
|
|
184
216
|
:host {
|
|
185
217
|
display: inline-flex;
|
|
186
218
|
}
|
|
@@ -310,24 +342,24 @@ r.styles = h`
|
|
|
310
342
|
}
|
|
311
343
|
`;
|
|
312
344
|
i([
|
|
313
|
-
|
|
314
|
-
],
|
|
345
|
+
a({ type: Number, attribute: "step-number" })
|
|
346
|
+
], p.prototype, "stepNumber", 2);
|
|
315
347
|
i([
|
|
316
|
-
|
|
317
|
-
],
|
|
348
|
+
a({ type: String, reflect: !0 })
|
|
349
|
+
], p.prototype, "state", 2);
|
|
318
350
|
i([
|
|
319
|
-
|
|
320
|
-
],
|
|
351
|
+
a({ type: Boolean, reflect: !0 })
|
|
352
|
+
], p.prototype, "disabled", 2);
|
|
321
353
|
i([
|
|
322
|
-
|
|
323
|
-
],
|
|
354
|
+
a({ type: Boolean })
|
|
355
|
+
], p.prototype, "clickable", 2);
|
|
324
356
|
i([
|
|
325
|
-
|
|
326
|
-
],
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
],
|
|
357
|
+
a({ type: String })
|
|
358
|
+
], p.prototype, "icon", 2);
|
|
359
|
+
p = i([
|
|
360
|
+
b("pd-stepper-item")
|
|
361
|
+
], p);
|
|
330
362
|
export {
|
|
331
|
-
|
|
332
|
-
|
|
363
|
+
o as PdSegmentedStepper,
|
|
364
|
+
p as PdStepperItem
|
|
333
365
|
};
|
|
@@ -15,10 +15,11 @@ export declare class PdIconButton extends LitElement {
|
|
|
15
15
|
target: string;
|
|
16
16
|
ariaLabel: string;
|
|
17
17
|
ariaLabelSelected: string;
|
|
18
|
+
private _internalSelected;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
private get isSelected();
|
|
18
21
|
private getIconButtonTemplate;
|
|
19
22
|
render(): import("lit-html").TemplateResult<1>;
|
|
20
23
|
private _handleClick;
|
|
21
|
-
private _handleInput;
|
|
22
|
-
private _handleChange;
|
|
23
24
|
static styles: import("lit").CSSResult;
|
|
24
25
|
}
|
|
@@ -6,7 +6,8 @@ import '@material/web/icon/icon.js';
|
|
|
6
6
|
*
|
|
7
7
|
* @slot - The default slot for pd-stepper-item elements.
|
|
8
8
|
*
|
|
9
|
-
* @fires
|
|
9
|
+
* @fires step-change - Fired when the active step changes (consistent with pd-stepper).
|
|
10
|
+
* @fires stepchange - Fired when the active step changes (backwards compatibility).
|
|
10
11
|
* @fires stepcomplete - Fired when a step is marked as completed.
|
|
11
12
|
*/
|
|
12
13
|
export declare class PdSegmentedStepper extends LitElement {
|
|
@@ -20,7 +21,10 @@ export declare class PdSegmentedStepper extends LitElement {
|
|
|
20
21
|
disabled: boolean;
|
|
21
22
|
/** Whether users can click on completed steps to go back. */
|
|
22
23
|
allowStepNavigation: boolean;
|
|
24
|
+
/** Whether the stepper is linear (steps must be completed in order). */
|
|
25
|
+
linear: boolean;
|
|
23
26
|
private _steps;
|
|
27
|
+
private _completedStepsSet;
|
|
24
28
|
connectedCallback(): void;
|
|
25
29
|
disconnectedCallback(): void;
|
|
26
30
|
firstUpdated(): void;
|
|
@@ -29,6 +33,11 @@ export declare class PdSegmentedStepper extends LitElement {
|
|
|
29
33
|
private _handleStepClick;
|
|
30
34
|
/** Navigate to a specific step. */
|
|
31
35
|
goToStep(stepIndex: number): void;
|
|
36
|
+
private _dispatchStepChange;
|
|
37
|
+
/** Move to the next step (alias for nextStep). */
|
|
38
|
+
next(): void;
|
|
39
|
+
/** Move to the previous step (alias for previousStep). */
|
|
40
|
+
back(): void;
|
|
32
41
|
/** Move to the next step. */
|
|
33
42
|
nextStep(): void;
|
|
34
43
|
/** Move to the previous step. */
|
|
@@ -37,6 +46,8 @@ export declare class PdSegmentedStepper extends LitElement {
|
|
|
37
46
|
completeCurrentStep(): void;
|
|
38
47
|
/** Mark a specific step as completed. */
|
|
39
48
|
completeStep(stepIndex: number): void;
|
|
49
|
+
/** Mark a step as incomplete. */
|
|
50
|
+
resetStep(stepIndex: number): void;
|
|
40
51
|
/** Reset all steps to pending state. */
|
|
41
52
|
reset(): void;
|
|
42
53
|
render(): import("lit-html").TemplateResult<1>;
|
package/package.json
CHANGED