nve-designsystem 2.15.2 → 2.16.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/components/nve-stepper/nve-stepper-mobile.component.d.ts +1 -2
- package/components/nve-stepper/nve-stepper-mobile.component.js +32 -29
- package/components/nve-stepper/nve-stepper.component.d.ts +2 -2
- package/components/nve-stepper/nve-stepper.component.js +29 -22
- package/custom-elements.json +504 -460
- package/package.json +1 -1
- package/vscode.css-custom-data.json +4 -4
- package/vscode.html-custom-data.json +51 -51
|
@@ -6,8 +6,7 @@ export default class NveStepperMobile extends LitElement {
|
|
|
6
6
|
steps: StepProps[];
|
|
7
7
|
/** Skjuler Neste og Forrige knappene slik at du kan implementere dine egne Neste og Forrige knappene. */
|
|
8
8
|
hideStepButtons: boolean;
|
|
9
|
-
private
|
|
10
|
-
private handlePrevStep;
|
|
9
|
+
private handleStepClick;
|
|
11
10
|
selectedStepIndex: {
|
|
12
11
|
value: number;
|
|
13
12
|
};
|
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import { a
|
|
2
|
-
import { n as v, t as
|
|
1
|
+
import { a, x as n } from "../../chunks/lit-element.js";
|
|
2
|
+
import { n as v, t as o } from "../../chunks/property.js";
|
|
3
3
|
import h from "./nve-stepper-mobile.styles.js";
|
|
4
|
-
var u = Object.defineProperty,
|
|
5
|
-
for (var t =
|
|
6
|
-
(
|
|
7
|
-
return
|
|
4
|
+
var u = Object.defineProperty, x = Object.getOwnPropertyDescriptor, r = (e, s, l, p) => {
|
|
5
|
+
for (var t = p > 1 ? void 0 : p ? x(s, l) : s, d = e.length - 1, c; d >= 0; d--)
|
|
6
|
+
(c = e[d]) && (t = (p ? c(s, l, t) : c(t)) || t);
|
|
7
|
+
return p && t && u(s, l, t), t;
|
|
8
8
|
};
|
|
9
|
-
let i = class extends
|
|
9
|
+
let i = class extends a {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments), this.steps = [], this.hideStepButtons = !1, this.selectedStepIndex = { value: 0 };
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
handleStepClick(e) {
|
|
14
|
+
this.dispatchEvent(
|
|
15
|
+
new CustomEvent("step-click", {
|
|
16
|
+
detail: {
|
|
17
|
+
action: e,
|
|
18
|
+
currentIndex: this.selectedStepIndex.value,
|
|
19
|
+
step: this.steps[this.selectedStepIndex.value],
|
|
20
|
+
nextIndex: e === "next" ? this.selectedStepIndex.value + 1 : this.selectedStepIndex.value - 1,
|
|
21
|
+
nextStep: this.steps[e === "next" ? this.selectedStepIndex.value + 1 : this.selectedStepIndex.value - 1]
|
|
22
|
+
},
|
|
23
|
+
bubbles: !0,
|
|
24
|
+
composed: !0
|
|
25
|
+
})
|
|
26
|
+
);
|
|
26
27
|
}
|
|
27
28
|
render() {
|
|
28
|
-
const e = this.steps[this.selectedStepIndex.value], s = this.steps[this.selectedStepIndex.value + 1],
|
|
29
|
-
return
|
|
29
|
+
const e = this.steps[this.selectedStepIndex.value], s = this.steps[this.selectedStepIndex.value + 1], l = this.selectedStepIndex.value === this.steps.length - 1;
|
|
30
|
+
return n`
|
|
30
31
|
<div class="mobile-stepper">
|
|
31
32
|
<div class="progress-circle">${this.selectedStepIndex.value + 1} of ${this.steps.length}</div>
|
|
32
33
|
<div class="step-info">
|
|
33
34
|
<div class="step-label">${e.label}</div>
|
|
34
|
-
${this.hideStepButtons ? "" :
|
|
35
|
-
${
|
|
35
|
+
${this.hideStepButtons ? "" : n` <div>
|
|
36
|
+
${l ? n` <div class="step-buttons next-button" @click=${() => this.handleStepClick("next")}>
|
|
37
|
+
Finish
|
|
38
|
+
</div>` : n` <div class="step-buttons next-button" @click=${() => this.handleStepClick("next")}>
|
|
36
39
|
Neste: ${s.label}
|
|
37
40
|
</div>`}
|
|
38
|
-
<div class="step-buttons back-button" @click=${this.
|
|
41
|
+
<div class="step-buttons back-button" @click=${() => this.handleStepClick("prev")}>Forrige</div>
|
|
39
42
|
</div>`}
|
|
40
43
|
</div>
|
|
41
44
|
</div>
|
|
@@ -43,14 +46,14 @@ let i = class extends c {
|
|
|
43
46
|
}
|
|
44
47
|
};
|
|
45
48
|
i.styles = [h];
|
|
46
|
-
|
|
49
|
+
r([
|
|
47
50
|
v({ type: Array })
|
|
48
51
|
], i.prototype, "steps", 2);
|
|
49
|
-
|
|
52
|
+
r([
|
|
50
53
|
v({ type: Boolean })
|
|
51
54
|
], i.prototype, "hideStepButtons", 2);
|
|
52
|
-
i =
|
|
53
|
-
|
|
55
|
+
i = r([
|
|
56
|
+
o("nve-stepper-mobile")
|
|
54
57
|
], i);
|
|
55
58
|
export {
|
|
56
59
|
i as default
|
|
@@ -75,10 +75,10 @@ export default class NveStepper extends LitElement {
|
|
|
75
75
|
finishSteps(): void;
|
|
76
76
|
/** Metode for å hente den gjeldende indeksen */
|
|
77
77
|
getCurrentIndex(): number;
|
|
78
|
+
handleStepClick(step: StepProps, index: number): void;
|
|
78
79
|
private setStep;
|
|
79
80
|
private getExtremes;
|
|
80
|
-
private
|
|
81
|
-
private handleMobilePrevStep;
|
|
81
|
+
private handleMobileStepClick;
|
|
82
82
|
private renderBackButton;
|
|
83
83
|
private isOrientationVertical;
|
|
84
84
|
private renderForwardButton;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n, t as
|
|
1
|
+
import { a as c, x as o } from "../../chunks/lit-element.js";
|
|
2
|
+
import { n, t as u } from "../../chunks/property.js";
|
|
3
3
|
import { StepState as h } from "./nve-step/nve-step.component.js";
|
|
4
4
|
import S from "./nve-stepper.styles.js";
|
|
5
5
|
import "./nve-stepper-mobile.component.js";
|
|
6
|
-
var v = Object.defineProperty, f = Object.getOwnPropertyDescriptor, i = (e, t, a,
|
|
7
|
-
for (var r =
|
|
8
|
-
(l = e[d]) && (r = (
|
|
9
|
-
return
|
|
6
|
+
var v = Object.defineProperty, f = Object.getOwnPropertyDescriptor, i = (e, t, a, p) => {
|
|
7
|
+
for (var r = p > 1 ? void 0 : p ? f(t, a) : t, d = e.length - 1, l; d >= 0; d--)
|
|
8
|
+
(l = e[d]) && (r = (p ? l(t, a, r) : l(r)) || r);
|
|
9
|
+
return p && r && v(t, a, r), r;
|
|
10
10
|
};
|
|
11
11
|
function x() {
|
|
12
12
|
return /Mobi|Android/i.test(navigator.userAgent);
|
|
13
13
|
}
|
|
14
|
-
let s = class extends
|
|
14
|
+
let s = class extends c {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments), this.orientation = "horizontal", this.endButtonText = "Sende", this.steps = [], this.hideStepButtons = !1, this.hideMobileStepButtons = !1, this.displayMobileVersion = !1, this.hideStateText = !1, this.hideDescriptions = !1, this.selectedStepIndex = { value: 0 };
|
|
17
17
|
}
|
|
@@ -49,6 +49,15 @@ let s = class extends u {
|
|
|
49
49
|
getCurrentIndex() {
|
|
50
50
|
return this.selectedStepIndex.value;
|
|
51
51
|
}
|
|
52
|
+
handleStepClick(e, t) {
|
|
53
|
+
this.dispatchEvent(
|
|
54
|
+
new CustomEvent("step-click", {
|
|
55
|
+
detail: { step: e, index: t },
|
|
56
|
+
bubbles: !0,
|
|
57
|
+
composed: !0
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
52
61
|
setStep(e) {
|
|
53
62
|
if (this.steps[e].readyForEntrance) {
|
|
54
63
|
this.selectedStepIndex.value = e;
|
|
@@ -62,14 +71,12 @@ let s = class extends u {
|
|
|
62
71
|
if (this.selectedStepIndex.value === this.steps.length - 1)
|
|
63
72
|
return "end";
|
|
64
73
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
handleMobilePrevStep() {
|
|
69
|
-
this.prevStep();
|
|
74
|
+
handleMobileStepClick(e) {
|
|
75
|
+
const t = e.detail?.action;
|
|
76
|
+
t === "next" ? this.selectedStepIndex.value < this.steps.length - 1 ? this.nextStep() : this.finishSteps() : t === "prev" && this.prevStep();
|
|
70
77
|
}
|
|
71
78
|
renderBackButton() {
|
|
72
|
-
return this.hideStepButtons ? "" :
|
|
79
|
+
return this.hideStepButtons ? "" : o`
|
|
73
80
|
<nve-button
|
|
74
81
|
.disabled=${this.getExtremes() === "start"}
|
|
75
82
|
size="medium"
|
|
@@ -85,12 +92,12 @@ let s = class extends u {
|
|
|
85
92
|
return this.orientation === "vertical";
|
|
86
93
|
}
|
|
87
94
|
renderForwardButton() {
|
|
88
|
-
return this.hideStepButtons ? "" : this.getExtremes() === "end" ?
|
|
95
|
+
return this.hideStepButtons ? "" : this.getExtremes() === "end" ? o`
|
|
89
96
|
<nve-button size="medium" variant="primary" @click=${this.finishSteps}>
|
|
90
97
|
<nve-icon slot="suffix" name="done"></nve-icon>
|
|
91
98
|
${this.endButtonText}
|
|
92
99
|
</nve-button>
|
|
93
|
-
` :
|
|
100
|
+
` : o`
|
|
94
101
|
<nve-button .disabled=${this.getExtremes() === "end"} size="medium" variant="primary" @click=${this.nextStep}>
|
|
95
102
|
<nve-icon slot="suffix" name="navigate_next"></nve-icon>
|
|
96
103
|
Neste
|
|
@@ -98,24 +105,23 @@ let s = class extends u {
|
|
|
98
105
|
`;
|
|
99
106
|
}
|
|
100
107
|
renderVerticalButtons() {
|
|
101
|
-
return this.hideStepButtons ? "" :
|
|
108
|
+
return this.hideStepButtons ? "" : o` <div class="vertical-btn-container">${this.renderBackButton()} ${this.renderForwardButton()}</div> `;
|
|
102
109
|
}
|
|
103
110
|
/** Hoved render-metode */
|
|
104
111
|
render() {
|
|
105
|
-
return x() || this.displayMobileVersion ?
|
|
112
|
+
return x() || this.displayMobileVersion ? o`
|
|
106
113
|
<nve-stepper-mobile
|
|
107
114
|
.steps=${this.steps}
|
|
108
115
|
.selectedStepIndex=${this.selectedStepIndex}
|
|
109
116
|
.hideStepButtons=${this.hideMobileStepButtons}
|
|
110
|
-
@
|
|
111
|
-
@prev-step=${this.handleMobilePrevStep}
|
|
117
|
+
@step-click=${this.handleMobileStepClick}
|
|
112
118
|
></nve-stepper-mobile>
|
|
113
|
-
` :
|
|
119
|
+
` : o`
|
|
114
120
|
<div class="stepper ${this.orientation}">
|
|
115
121
|
${this.isOrientationVertical() ? "" : this.renderBackButton()}
|
|
116
122
|
<div class="steps-container ${this.orientation} ${this.hideStepButtons ? "" : "steps-container-with-buttons"}">
|
|
117
123
|
${this.steps.map(
|
|
118
|
-
(e, t) =>
|
|
124
|
+
(e, t) => o`
|
|
119
125
|
<nve-step
|
|
120
126
|
.label=${e.label}
|
|
121
127
|
.description=${e.description}
|
|
@@ -128,6 +134,7 @@ let s = class extends u {
|
|
|
128
134
|
.orientation=${this.orientation}
|
|
129
135
|
.hideStateText=${this.hideStateText}
|
|
130
136
|
.hideDescriptions=${this.hideDescriptions}
|
|
137
|
+
@click=${() => this.handleStepClick(e, t)}
|
|
131
138
|
>
|
|
132
139
|
</nve-step>
|
|
133
140
|
`
|
|
@@ -165,7 +172,7 @@ i([
|
|
|
165
172
|
n({ type: Boolean })
|
|
166
173
|
], s.prototype, "hideDescriptions", 2);
|
|
167
174
|
s = i([
|
|
168
|
-
|
|
175
|
+
u("nve-stepper")
|
|
169
176
|
], s);
|
|
170
177
|
export {
|
|
171
178
|
s as default
|