scb-wc-test 0.1.74 → 0.1.76
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/all.js +4 -0
- package/index.d.ts +2 -0
- package/index.js +28 -24
- package/mvc/components/all.js +2 -0
- package/mvc/components/scb-app-bar/scb-app-bar.js +3 -2
- package/mvc/components/scb-dialog/scb-dialog.js +5 -1
- package/mvc/components/scb-menu/scb-menu.js +4 -2
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +1 -0
- package/mvc/components/scb-stepper/scb-step.js +95 -0
- package/mvc/components/scb-stepper/scb-stepper.js +78 -0
- package/package.json +10 -2
- package/scb-app-bar/scb-app-bar.d.ts +1 -0
- package/scb-app-bar/scb-app-bar.js +33 -28
- package/scb-dialog/scb-dialog.js +5 -1
- package/scb-menu/scb-menu.js +2 -0
- package/scb-segmented-button/scb-segmented-button.js +5 -4
- package/scb-stepper/scb-step.d.ts +18 -0
- package/scb-stepper/scb-step.js +151 -0
- package/scb-stepper/scb-stepper.d.ts +20 -0
- package/scb-stepper/scb-stepper.js +136 -0
- package/scb-wc-test.bundle.js +622 -443
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { css as m, LitElement as d, html as i } from "lit";
|
|
2
|
+
import { property as o, customElement as h } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/icon/icon.js";
|
|
4
|
+
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, e = (p, s, n, l) => {
|
|
5
|
+
for (var r = l > 1 ? void 0 : l ? b(s, n) : s, a = p.length - 1, c; a >= 0; a--)
|
|
6
|
+
(c = p[a]) && (r = (l ? c(s, n, r) : c(r)) || r);
|
|
7
|
+
return l && r && v(s, n, r), r;
|
|
8
|
+
};
|
|
9
|
+
let t = class extends d {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.label = "", this.symbolVariant = "number", this.number = 0, this.active = !1, this.completed = !1, this.changeOnCompleted = !1, this.islast = !1, this.variant = "horizontal", this.icon = "";
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
switch (this.symbolVariant) {
|
|
15
|
+
case "icon":
|
|
16
|
+
return i`
|
|
17
|
+
<div class="symbol">
|
|
18
|
+
${this.completed && this.changeOnCompleted ? i`<md-icon>check</md-icon>` : i`<md-icon>${this.icon}</md-icon>`}
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="content">
|
|
22
|
+
<div class="label">${this.label}</div>
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</div>
|
|
25
|
+
`;
|
|
26
|
+
case "marker":
|
|
27
|
+
return i`
|
|
28
|
+
<div class="symbol">
|
|
29
|
+
</div>
|
|
30
|
+
<div class="content">
|
|
31
|
+
<div class="label">${this.label}</div>
|
|
32
|
+
<slot></slot>
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
35
|
+
default:
|
|
36
|
+
return i`
|
|
37
|
+
<div class="symbol">
|
|
38
|
+
${this.completed && this.changeOnCompleted ? i`<md-icon>check</md-icon>` : i`<span>${this.number}</span>`}
|
|
39
|
+
</div>
|
|
40
|
+
<div class="content">
|
|
41
|
+
<div class="label">${this.label}</div>
|
|
42
|
+
<slot></slot>
|
|
43
|
+
</div>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
t.styles = m`
|
|
49
|
+
:host {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
align-items: center;
|
|
53
|
+
min-width: 80px;
|
|
54
|
+
flex: 1 1 0;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
background: none;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
user-select: none;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.symbol {
|
|
63
|
+
background-color: var(--n-70);
|
|
64
|
+
color: var(--md-sys-color-on-primary);
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
min-width: 32px;
|
|
67
|
+
height: 32px;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
position: relative;
|
|
74
|
+
z-index: 1;
|
|
75
|
+
}
|
|
76
|
+
md-icon {
|
|
77
|
+
font-size: 20px;
|
|
78
|
+
}
|
|
79
|
+
:host([active]) .symbol {
|
|
80
|
+
background-color: var(--md-sys-color-primary);
|
|
81
|
+
}
|
|
82
|
+
:host([completed]) .symbol {
|
|
83
|
+
background-color: var(--md-sys-color-primary);
|
|
84
|
+
}
|
|
85
|
+
.label {
|
|
86
|
+
margin-top: 8px;
|
|
87
|
+
text-align: center;
|
|
88
|
+
font-size: 16px;
|
|
89
|
+
color: var(--md-sys-color-on-surface, #222);
|
|
90
|
+
max-width: 90px;
|
|
91
|
+
word-break: break-word;
|
|
92
|
+
margin-bottom: 8px;
|
|
93
|
+
}
|
|
94
|
+
:host([active]) .label, :host([active]) slot {
|
|
95
|
+
font-weight: 600;
|
|
96
|
+
}
|
|
97
|
+
.content{
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
align-items: center;
|
|
101
|
+
}
|
|
102
|
+
:host([variant="vertical"]) {
|
|
103
|
+
flex-direction: row;
|
|
104
|
+
align-items: flex-start;
|
|
105
|
+
gap: 16px;
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
:host([variant="vertical"]) .label{
|
|
109
|
+
margin-top: 0;
|
|
110
|
+
}
|
|
111
|
+
:host([variant="vertical"]) .content{
|
|
112
|
+
align-items: flex-start;
|
|
113
|
+
}
|
|
114
|
+
:host([symbol-variant="marker"]) .symbol {
|
|
115
|
+
min-width: 16px;
|
|
116
|
+
height: 16px;
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
e([
|
|
120
|
+
o({ type: String, reflect: !0 })
|
|
121
|
+
], t.prototype, "label", 2);
|
|
122
|
+
e([
|
|
123
|
+
o({ type: String, reflect: !0, attribute: "symbol-variant" })
|
|
124
|
+
], t.prototype, "symbolVariant", 2);
|
|
125
|
+
e([
|
|
126
|
+
o({ type: Number, reflect: !0 })
|
|
127
|
+
], t.prototype, "number", 2);
|
|
128
|
+
e([
|
|
129
|
+
o({ type: Boolean, reflect: !0 })
|
|
130
|
+
], t.prototype, "active", 2);
|
|
131
|
+
e([
|
|
132
|
+
o({ type: Boolean, reflect: !0 })
|
|
133
|
+
], t.prototype, "completed", 2);
|
|
134
|
+
e([
|
|
135
|
+
o({ type: Boolean, reflect: !0 })
|
|
136
|
+
], t.prototype, "changeOnCompleted", 2);
|
|
137
|
+
e([
|
|
138
|
+
o({ type: Boolean, reflect: !0 })
|
|
139
|
+
], t.prototype, "islast", 2);
|
|
140
|
+
e([
|
|
141
|
+
o({ type: String, reflect: !0 })
|
|
142
|
+
], t.prototype, "variant", 2);
|
|
143
|
+
e([
|
|
144
|
+
o({ type: String })
|
|
145
|
+
], t.prototype, "icon", 2);
|
|
146
|
+
t = e([
|
|
147
|
+
h("scb-step")
|
|
148
|
+
], t);
|
|
149
|
+
export {
|
|
150
|
+
t as ScbStep
|
|
151
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* En stepper-komponent enligt SCB-standard.
|
|
4
|
+
* @slot - Innehåll för stegen
|
|
5
|
+
*/
|
|
6
|
+
export declare class ScbStepper extends LitElement {
|
|
7
|
+
label: string;
|
|
8
|
+
changeOnCompleted: boolean;
|
|
9
|
+
variant: 'horizontal' | 'vertical';
|
|
10
|
+
symbolVariant: 'number' | 'icon' | 'marker';
|
|
11
|
+
private activeIndex;
|
|
12
|
+
static styles: import('lit').CSSResult;
|
|
13
|
+
private _onStepClick;
|
|
14
|
+
private _updateSteps;
|
|
15
|
+
private _getSteps;
|
|
16
|
+
firstUpdated(): void;
|
|
17
|
+
updated(): void;
|
|
18
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
19
|
+
private _onStepContainerClick;
|
|
20
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { css as c, LitElement as d, html as h } from "lit";
|
|
2
|
+
import { property as n, state as f, customElement as v } from "lit/decorators.js";
|
|
3
|
+
import "./scb-step.js";
|
|
4
|
+
var b = Object.defineProperty, x = Object.getOwnPropertyDescriptor, o = (e, t, i, a) => {
|
|
5
|
+
for (var r = a > 1 ? void 0 : a ? x(t, i) : t, l = e.length - 1, p; l >= 0; l--)
|
|
6
|
+
(p = e[l]) && (r = (a ? p(t, i, r) : p(r)) || r);
|
|
7
|
+
return a && r && b(t, i, r), r;
|
|
8
|
+
};
|
|
9
|
+
let s = class extends d {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.label = "", this.changeOnCompleted = !1, this.variant = "horizontal", this.symbolVariant = "number", this.activeIndex = 0, this._onStepContainerClick = (e) => {
|
|
12
|
+
const t = this._getSteps(), i = e.composedPath(), a = t.findIndex((r) => i.includes(r));
|
|
13
|
+
a !== -1 && this._onStepClick(a);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
_onStepClick(e) {
|
|
17
|
+
this.activeIndex = e, this._updateSteps();
|
|
18
|
+
}
|
|
19
|
+
_updateSteps() {
|
|
20
|
+
const e = this._getSteps();
|
|
21
|
+
e.forEach((t, i) => {
|
|
22
|
+
t.active = i === this.activeIndex, t.completed = i < this.activeIndex, t.islast = !1, t.changeOnCompleted = this.changeOnCompleted, t.number = i + 1, t.variant = this.variant, t.symbolVariant = this.symbolVariant;
|
|
23
|
+
}), e.length > 0 && (e[e.length - 1].islast = !0);
|
|
24
|
+
}
|
|
25
|
+
_getSteps() {
|
|
26
|
+
return Array.from(this.querySelectorAll("scb-step"));
|
|
27
|
+
}
|
|
28
|
+
firstUpdated() {
|
|
29
|
+
this._updateSteps();
|
|
30
|
+
}
|
|
31
|
+
updated() {
|
|
32
|
+
this._updateSteps();
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return h`
|
|
36
|
+
<div class="steps" style="flex-direction: ${this.variant === "vertical" ? "column" : "row"}; align-items: ${this.variant === "vertical", "flex-start"};" @click=${this._onStepContainerClick}>
|
|
37
|
+
<slot></slot>
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
s.styles = c`
|
|
43
|
+
:host {
|
|
44
|
+
--scb-stepper-width: 100%;
|
|
45
|
+
--scb-stepper-height: 100%;
|
|
46
|
+
display: block;
|
|
47
|
+
padding: 16px;
|
|
48
|
+
width: 100%;
|
|
49
|
+
color: var(--md-sys-color-on-surface);
|
|
50
|
+
font-family: var(--brand-font);
|
|
51
|
+
max-width: var(--scb-stepper-width);
|
|
52
|
+
height: var(--scb-stepper-height);
|
|
53
|
+
}
|
|
54
|
+
.steps {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
align-items: flex-start;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
position: relative;
|
|
60
|
+
width: 100%;
|
|
61
|
+
gap: 24px;
|
|
62
|
+
height: 100%;
|
|
63
|
+
}
|
|
64
|
+
:host([variant='vertical']) .steps {
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
align-items: flex-start;
|
|
67
|
+
gap: 32px;
|
|
68
|
+
}
|
|
69
|
+
::slotted(scb-step) {
|
|
70
|
+
position: relative;
|
|
71
|
+
flex: 1 1 0;
|
|
72
|
+
min-width: 80px;
|
|
73
|
+
z-index: 1;
|
|
74
|
+
}
|
|
75
|
+
/* Horisontell connector */
|
|
76
|
+
::slotted(scb-step:not(:first-child))::before {
|
|
77
|
+
content: '';
|
|
78
|
+
position: absolute;
|
|
79
|
+
left: -50%;
|
|
80
|
+
top: 16px;
|
|
81
|
+
width: calc(100% - 24px);
|
|
82
|
+
height: 1px;
|
|
83
|
+
background: var(--n-70);
|
|
84
|
+
border-radius: 1px;
|
|
85
|
+
z-index: 0;
|
|
86
|
+
}
|
|
87
|
+
/* Vertikal connector */
|
|
88
|
+
::slotted(scb-step[variant="vertical"]:not(:first-child))::before {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
91
|
+
::slotted(scb-step[variant="vertical"]:not(:last-child))::after {
|
|
92
|
+
content: '';
|
|
93
|
+
position: absolute;
|
|
94
|
+
left: 16px;
|
|
95
|
+
top: 40px;
|
|
96
|
+
width: 1px;
|
|
97
|
+
height: calc(100% - 16px);
|
|
98
|
+
background: var(--n-70);
|
|
99
|
+
border-radius: 1px;
|
|
100
|
+
z-index: 0;
|
|
101
|
+
transform: translateX(-50%);
|
|
102
|
+
}
|
|
103
|
+
::slotted(scb-step[variant="vertical"][symbol-variant="marker"]:not(:last-child))::after {
|
|
104
|
+
content: "";
|
|
105
|
+
position: absolute;
|
|
106
|
+
left: 8px;
|
|
107
|
+
top: 25px;
|
|
108
|
+
width: 1px;
|
|
109
|
+
height: calc(100% - 2px);
|
|
110
|
+
background: var(--n-70);
|
|
111
|
+
border-radius: 1px;
|
|
112
|
+
z-index: 0;
|
|
113
|
+
transform: translateX(-50%);
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
o([
|
|
117
|
+
n({ type: String, reflect: !0 })
|
|
118
|
+
], s.prototype, "label", 2);
|
|
119
|
+
o([
|
|
120
|
+
n({ type: Boolean, reflect: !0, attribute: "change-on-completed" })
|
|
121
|
+
], s.prototype, "changeOnCompleted", 2);
|
|
122
|
+
o([
|
|
123
|
+
n({ type: String })
|
|
124
|
+
], s.prototype, "variant", 2);
|
|
125
|
+
o([
|
|
126
|
+
n({ type: String, reflect: !0, attribute: "symbol-variant" })
|
|
127
|
+
], s.prototype, "symbolVariant", 2);
|
|
128
|
+
o([
|
|
129
|
+
f()
|
|
130
|
+
], s.prototype, "activeIndex", 2);
|
|
131
|
+
s = o([
|
|
132
|
+
v("scb-stepper")
|
|
133
|
+
], s);
|
|
134
|
+
export {
|
|
135
|
+
s as ScbStepper
|
|
136
|
+
};
|