scb-wc-test 0.1.105 → 0.1.107
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/mvc/components/scb-accordion/scb-accordion.js +8 -2
- package/mvc/components/scb-avatar/scb-avatar.js +19 -10
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +2 -3
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +13 -7
- package/mvc/components/scb-button/scb-button.js +34 -32
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +13 -11
- package/mvc/components/scb-card/scb-card.js +44 -41
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +15 -13
- package/mvc/components/scb-checkbox/scb-checkbox.js +6 -6
- package/mvc/components/scb-chip/scb-chip.js +27 -7
- package/mvc/components/scb-divider/scb-divider.js +41 -15
- package/mvc/components/scb-fact-card/scb-fact-card.js +37 -18
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +71 -43
- package/mvc/components/scb-icon-button/scb-icon-button.js +16 -10
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -4
- package/mvc/components/scb-list/scb-list.js +3 -3
- package/mvc/components/scb-notification-card/scb-notification-card.js +5 -5
- package/mvc/components/scb-pagination/scb-pagination.js +165 -107
- package/mvc/components/scb-radio-button/scb-radio-group.js +22 -11
- package/mvc/components/scb-search/scb-search.js +84 -32
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +15 -13
- package/mvc/components/scb-status-pill/scb-status-pill.js +17 -13
- package/mvc/components/scb-stepper/scb-stepper.js +32 -29
- package/mvc/components/scb-switch/scb-switch.js +11 -8
- package/mvc/components/scb-tabs/scb-tabs.js +22 -19
- package/mvc/components/scb-textfield/scb-textfield.js +14 -10
- package/mvc/components/scb-toc/scb-toc.js +6 -3
- package/mvc/components/scb-viz/scb-viz.js +188 -178
- package/package.json +2 -2
- package/scb-accordion/scb-accordion.d.ts +13 -0
- package/scb-accordion/scb-accordion.js +53 -21
- package/scb-avatar/scb-avatar.d.ts +6 -0
- package/scb-avatar/scb-avatar.js +96 -61
- package/scb-breadcrumb/scb-breadcrumb-item.js +8 -9
- package/scb-breadcrumb/scb-breadcrumb.d.ts +6 -0
- package/scb-breadcrumb/scb-breadcrumb.js +61 -30
- package/scb-button/scb-button.d.ts +10 -0
- package/scb-button/scb-button.js +89 -65
- package/scb-calendar-card/scb-calendar-card.d.ts +5 -0
- package/scb-calendar-card/scb-calendar-card.js +79 -55
- package/scb-card/scb-card.d.ts +5 -0
- package/scb-card/scb-card.js +165 -140
- package/scb-checkbox/scb-checkbox-group.d.ts +3 -1
- package/scb-checkbox/scb-checkbox-group.js +59 -40
- package/scb-checkbox/scb-checkbox.d.ts +11 -0
- package/scb-checkbox/scb-checkbox.js +78 -56
- package/scb-chip/scb-chip.d.ts +24 -0
- package/scb-chip/scb-chip.js +137 -65
- package/scb-divider/scb-divider.d.ts +14 -0
- package/scb-divider/scb-divider.js +91 -43
- package/scb-fact-card/scb-fact-card.d.ts +10 -0
- package/scb-fact-card/scb-fact-card.js +135 -94
- package/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +10 -0
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +179 -120
- package/scb-icon-button/scb-icon-button.d.ts +10 -1
- package/scb-icon-button/scb-icon-button.js +88 -59
- package/scb-keyfigure-card/scb-keyfigure-card.d.ts +10 -0
- package/scb-keyfigure-card/scb-keyfigure-card.js +76 -52
- package/scb-list/scb-list.d.ts +7 -1
- package/scb-list/scb-list.js +62 -40
- package/scb-notification-card/scb-notification-card.d.ts +5 -0
- package/scb-notification-card/scb-notification-card.js +56 -39
- package/scb-pagination/scb-pagination.d.ts +12 -1
- package/scb-pagination/scb-pagination.js +235 -147
- package/scb-radio-button/scb-radio-group.d.ts +14 -3
- package/scb-radio-button/scb-radio-group.js +120 -67
- package/scb-search/scb-search.d.ts +15 -2
- package/scb-search/scb-search.js +152 -69
- package/scb-segmented-button/scb-segmented-button.d.ts +45 -4
- package/scb-segmented-button/scb-segmented-button.js +163 -72
- package/scb-status-pill/scb-status-pill.d.ts +12 -1
- package/scb-status-pill/scb-status-pill.js +51 -27
- package/scb-stepper/scb-stepper.d.ts +11 -3
- package/scb-stepper/scb-stepper.js +134 -101
- package/scb-switch/scb-switch.d.ts +21 -2
- package/scb-switch/scb-switch.js +97 -45
- package/scb-tabs/scb-tabs.d.ts +8 -0
- package/scb-tabs/scb-tabs.js +74 -44
- package/scb-textfield/scb-textfield.d.ts +7 -0
- package/scb-textfield/scb-textfield.js +43 -16
- package/scb-toc/scb-toc.d.ts +10 -1
- package/scb-toc/scb-toc.js +49 -18
- package/scb-viz/scb-viz.d.ts +10 -3
- package/scb-viz/scb-viz.js +278 -236
- package/scb-wc-test.bundle.js +1184 -901
|
@@ -1,59 +1,69 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as g, LitElement as b, html as u } from "lit";
|
|
2
|
+
import { property as o, state as m, customElement as y } from "lit/decorators.js";
|
|
3
3
|
import "./scb-step.js";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var S = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, f = (t) => {
|
|
5
|
+
throw TypeError(t);
|
|
6
|
+
}, a = (t, e, s, i) => {
|
|
7
|
+
for (var n = i > 1 ? void 0 : i ? _(e, s) : e, c = t.length - 1, d; c >= 0; c--)
|
|
8
|
+
(d = t[c]) && (n = (i ? d(e, s, n) : d(n)) || n);
|
|
9
|
+
return i && n && S(e, s, n), n;
|
|
10
|
+
}, x = (t, e, s) => e.has(t) || f("Cannot " + s), k = (t, e, s) => e.has(t) ? f("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), l = (t, e, s) => (x(t, e, "access private method"), s), p, v, h;
|
|
11
|
+
let r = class extends b {
|
|
10
12
|
constructor() {
|
|
11
|
-
super(...arguments), this.type = "", this.label = "", this.changeOnCompleted = !1, this.variant = "horizontal", this.symbolVariant = "number", this.activeIndex = 0, this._onKeyNav = (
|
|
12
|
-
const
|
|
13
|
+
super(...arguments), k(this, p), this.type = "", this.label = "", this.changeOnCompleted = !1, this.variant = "horizontal", this.symbolVariant = "number", this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.activeIndex = 0, this._onKeyNav = (t) => {
|
|
14
|
+
const e = this._getSteps(), s = this.activeIndex;
|
|
13
15
|
let i = s;
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
const n = (
|
|
16
|
+
t.detail.key === "ArrowRight" ? s < e.length - 1 ? i = s + 1 : i = 0 : t.detail.key === "ArrowLeft" && (s > 0 ? i = s - 1 : i = e.length - 1), i !== s && (this._onStepClick(i), setTimeout(() => {
|
|
17
|
+
var c;
|
|
18
|
+
const n = (c = e[i].shadowRoot) == null ? void 0 : c.querySelector(
|
|
19
|
+
".scb-step-content"
|
|
20
|
+
);
|
|
17
21
|
n && "focus" in n && typeof n.focus == "function" && n.focus();
|
|
18
22
|
}, 0));
|
|
19
|
-
}, this._onStepContainerClick = (
|
|
20
|
-
const
|
|
23
|
+
}, this._onStepContainerClick = (t) => {
|
|
24
|
+
const e = this._getSteps(), s = t.composedPath(), i = e.findIndex((n) => s.includes(n));
|
|
21
25
|
i !== -1 && this._onStepClick(i);
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
|
-
_onStepClick(
|
|
25
|
-
const
|
|
26
|
-
this.activeIndex =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
_onStepClick(t) {
|
|
29
|
+
const e = this.activeIndex;
|
|
30
|
+
this.activeIndex = t, this._updateSteps(), this.dispatchEvent(
|
|
31
|
+
new CustomEvent("scb-step-change", {
|
|
32
|
+
detail: {
|
|
33
|
+
index: this.activeIndex,
|
|
34
|
+
step: this._getSteps()[this.activeIndex]
|
|
35
|
+
},
|
|
36
|
+
bubbles: !0,
|
|
37
|
+
composed: !0
|
|
38
|
+
})
|
|
39
|
+
), t > e ? this.dispatchEvent(
|
|
40
|
+
new CustomEvent("scb-step-next", {
|
|
41
|
+
detail: {
|
|
42
|
+
from: e,
|
|
43
|
+
to: t,
|
|
44
|
+
step: this._getSteps()[t]
|
|
45
|
+
},
|
|
46
|
+
bubbles: !0,
|
|
47
|
+
composed: !0
|
|
48
|
+
})
|
|
49
|
+
) : t < e && this.dispatchEvent(
|
|
50
|
+
new CustomEvent("scb-step-prev", {
|
|
51
|
+
detail: {
|
|
52
|
+
from: e,
|
|
53
|
+
to: t,
|
|
54
|
+
step: this._getSteps()[t]
|
|
55
|
+
},
|
|
56
|
+
bubbles: !0,
|
|
57
|
+
composed: !0
|
|
58
|
+
})
|
|
59
|
+
);
|
|
50
60
|
}
|
|
51
61
|
/**
|
|
52
62
|
* Gå till nästa steg programatiskt
|
|
53
63
|
*/
|
|
54
64
|
nextStep() {
|
|
55
|
-
const
|
|
56
|
-
this.activeIndex <
|
|
65
|
+
const t = this._getSteps();
|
|
66
|
+
this.activeIndex < t.length - 1 && this._onStepClick(this.activeIndex + 1);
|
|
57
67
|
}
|
|
58
68
|
/**
|
|
59
69
|
* Gå till föregående steg programatiskt
|
|
@@ -68,22 +78,22 @@ let o = class extends h {
|
|
|
68
78
|
return this.activeIndex;
|
|
69
79
|
}
|
|
70
80
|
_updateSteps() {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}),
|
|
81
|
+
const t = this._getSteps();
|
|
82
|
+
t.forEach((e, s) => {
|
|
83
|
+
e.active = s === this.activeIndex, e.completed = s < this.activeIndex, e.islast = !1, e.changeOnCompleted = this.changeOnCompleted, e.number = s + 1, e.variant = this.variant, e.symbolVariant = this.symbolVariant;
|
|
84
|
+
}), t.length > 0 && (t[t.length - 1].islast = !0);
|
|
75
85
|
}
|
|
76
86
|
_getSteps() {
|
|
77
87
|
return Array.from(this.querySelectorAll("scb-step"));
|
|
78
88
|
}
|
|
79
|
-
firstUpdated() {
|
|
80
|
-
this._updateSteps();
|
|
89
|
+
firstUpdated(t) {
|
|
90
|
+
this._updateSteps(), l(this, p, v).call(this);
|
|
81
91
|
}
|
|
82
|
-
updated() {
|
|
83
|
-
this._updateSteps();
|
|
92
|
+
updated(t) {
|
|
93
|
+
this._updateSteps(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && l(this, p, v).call(this);
|
|
84
94
|
}
|
|
85
95
|
render() {
|
|
86
|
-
return
|
|
96
|
+
return u`
|
|
87
97
|
<div
|
|
88
98
|
class="steps"
|
|
89
99
|
role="list"
|
|
@@ -96,10 +106,21 @@ let o = class extends h {
|
|
|
96
106
|
`;
|
|
97
107
|
}
|
|
98
108
|
};
|
|
99
|
-
|
|
109
|
+
p = /* @__PURE__ */ new WeakSet();
|
|
110
|
+
v = function() {
|
|
111
|
+
const t = l(this, p, h).call(this, this.spacing), e = l(this, p, h).call(this, this.spacingTop) ?? t, s = l(this, p, h).call(this, this.spacingBottom) ?? t;
|
|
112
|
+
e ? this.style.setProperty("--scb-stepper-spacing-block-start", e) : this.style.removeProperty("--scb-stepper-spacing-block-start"), s ? this.style.setProperty("--scb-stepper-spacing-block-end", s) : this.style.removeProperty("--scb-stepper-spacing-block-end");
|
|
113
|
+
};
|
|
114
|
+
h = function(t) {
|
|
115
|
+
if (!t) return;
|
|
116
|
+
const e = String(t).trim();
|
|
117
|
+
if (e)
|
|
118
|
+
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
119
|
+
};
|
|
120
|
+
r.styles = g`
|
|
100
121
|
:host {
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
--scb-stepper-width: 100%;
|
|
123
|
+
--scb-stepper-height: 100%;
|
|
103
124
|
display: block;
|
|
104
125
|
padding: var(--spacing-5) 0;
|
|
105
126
|
width: 100%;
|
|
@@ -107,6 +128,9 @@ o.styles = l`
|
|
|
107
128
|
font-family: var(--brand-font);
|
|
108
129
|
max-width: var(--scb-stepper-width);
|
|
109
130
|
height: var(--scb-stepper-height);
|
|
131
|
+
|
|
132
|
+
margin-block-start: var(--scb-stepper-spacing-block-start, 0);
|
|
133
|
+
margin-block-end: var(--scb-stepper-spacing-block-end, 0);
|
|
110
134
|
}
|
|
111
135
|
.steps {
|
|
112
136
|
display: flex;
|
|
@@ -140,56 +164,65 @@ o.styles = l`
|
|
|
140
164
|
z-index: 0;
|
|
141
165
|
}
|
|
142
166
|
/* Vertikal connector */
|
|
143
|
-
::slotted(scb-step[variant=
|
|
144
|
-
|
|
167
|
+
::slotted(scb-step[variant='vertical']:not(:first-child))::before {
|
|
168
|
+
display: none;
|
|
145
169
|
}
|
|
146
|
-
::slotted(scb-step[variant=
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
::slotted(scb-step[variant='vertical']:not(:last-child))::after {
|
|
171
|
+
content: '';
|
|
172
|
+
position: absolute;
|
|
173
|
+
left: 28px;
|
|
174
|
+
top: 52px;
|
|
175
|
+
width: 1px;
|
|
176
|
+
height: calc(100% - 16px);
|
|
177
|
+
background: var(--n-70);
|
|
178
|
+
z-index: 0;
|
|
179
|
+
transform: translateX(-50%);
|
|
156
180
|
}
|
|
157
|
-
::slotted(scb-step[variant=
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
181
|
+
::slotted(scb-step[variant='vertical'][symbol-variant='marker']:not(:last-child))::after {
|
|
182
|
+
content: '';
|
|
183
|
+
position: absolute;
|
|
184
|
+
left: 20px;
|
|
185
|
+
top: 38px;
|
|
186
|
+
width: 1px;
|
|
187
|
+
height: calc(100% - 2px);
|
|
188
|
+
background: var(--n-70);
|
|
189
|
+
z-index: 0;
|
|
190
|
+
transform: translateX(-50%);
|
|
167
191
|
}
|
|
168
|
-
::slotted(scb-step[symbol-variant=
|
|
169
|
-
|
|
192
|
+
::slotted(scb-step[symbol-variant='marker']:not(:first-child))::before {
|
|
193
|
+
top: 20px;
|
|
170
194
|
}
|
|
171
195
|
`;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
],
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
],
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
],
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
],
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
],
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
],
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
],
|
|
196
|
+
a([
|
|
197
|
+
o({ type: String, reflect: !0 })
|
|
198
|
+
], r.prototype, "type", 2);
|
|
199
|
+
a([
|
|
200
|
+
o({ type: String, reflect: !0 })
|
|
201
|
+
], r.prototype, "label", 2);
|
|
202
|
+
a([
|
|
203
|
+
o({ type: Boolean, reflect: !0, attribute: "change-on-completed" })
|
|
204
|
+
], r.prototype, "changeOnCompleted", 2);
|
|
205
|
+
a([
|
|
206
|
+
o({ type: String })
|
|
207
|
+
], r.prototype, "variant", 2);
|
|
208
|
+
a([
|
|
209
|
+
o({ type: String, reflect: !0, attribute: "symbol-variant" })
|
|
210
|
+
], r.prototype, "symbolVariant", 2);
|
|
211
|
+
a([
|
|
212
|
+
o({ type: String, reflect: !0 })
|
|
213
|
+
], r.prototype, "spacing", 2);
|
|
214
|
+
a([
|
|
215
|
+
o({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
216
|
+
], r.prototype, "spacingTop", 2);
|
|
217
|
+
a([
|
|
218
|
+
o({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
219
|
+
], r.prototype, "spacingBottom", 2);
|
|
220
|
+
a([
|
|
221
|
+
m()
|
|
222
|
+
], r.prototype, "activeIndex", 2);
|
|
223
|
+
r = a([
|
|
224
|
+
y("scb-stepper")
|
|
225
|
+
], r);
|
|
193
226
|
export {
|
|
194
|
-
|
|
227
|
+
r as ScbStepper
|
|
195
228
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from 'lit';
|
|
1
|
+
import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
2
2
|
export declare class ScbSwitch extends LitElement {
|
|
3
|
+
#private;
|
|
4
|
+
static formAssociated: boolean;
|
|
5
|
+
private _internals;
|
|
6
|
+
constructor();
|
|
3
7
|
label: string;
|
|
4
8
|
ariaLabel: string;
|
|
5
9
|
icons: boolean;
|
|
@@ -7,9 +11,24 @@ export declare class ScbSwitch extends LitElement {
|
|
|
7
11
|
disabled: boolean;
|
|
8
12
|
/** Full-width layout: space-between + width:100% när true */
|
|
9
13
|
fullWidth: boolean;
|
|
14
|
+
/** Vertikalt avstånd ovanför/under komponenten. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
15
|
+
spacing: string;
|
|
16
|
+
/** Överkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
17
|
+
spacingTop: string;
|
|
18
|
+
/** Nederkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
19
|
+
spacingBottom: string;
|
|
20
|
+
name: string;
|
|
21
|
+
value: string;
|
|
22
|
+
private _form;
|
|
23
|
+
private _formResetHandler;
|
|
24
|
+
private _initialSelected;
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
10
27
|
static styles: import('lit').CSSResult;
|
|
11
|
-
protected updated(): void;
|
|
12
28
|
protected firstUpdated(): void;
|
|
29
|
+
protected updated(changed: PropertyValues): void;
|
|
30
|
+
formDisabledCallback(disabled: boolean): void;
|
|
31
|
+
private __syncFormValue;
|
|
13
32
|
render(): TemplateResult;
|
|
14
33
|
}
|
|
15
34
|
declare global {
|
package/scb-switch/scb-switch.js
CHANGED
|
@@ -1,49 +1,86 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as r, customElement as
|
|
1
|
+
import { css as y, LitElement as g, nothing as b, html as u } from "lit";
|
|
2
|
+
import { property as r, customElement as v } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/switch/switch.js";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var _ = Object.defineProperty, w = Object.getOwnPropertyDescriptor, m = (t) => {
|
|
5
|
+
throw TypeError(t);
|
|
6
|
+
}, a = (t, e, s, o) => {
|
|
7
|
+
for (var l = o > 1 ? void 0 : o ? w(e, s) : e, p = t.length - 1, d; p >= 0; p--)
|
|
8
|
+
(d = t[p]) && (l = (o ? d(e, s, l) : d(l)) || l);
|
|
9
|
+
return o && l && _(e, s, l), l;
|
|
10
|
+
}, k = (t, e, s) => e.has(t) || m("Cannot " + s), S = (t, e, s) => e.has(t) ? m("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), c = (t, e, s) => (k(t, e, "access private method"), s), n, f, h;
|
|
11
|
+
let i = class extends g {
|
|
10
12
|
constructor() {
|
|
11
|
-
super(
|
|
13
|
+
super(), S(this, n), this._internals = null, this.label = "", this.ariaLabel = "", this.icons = !1, this.selected = !1, this.disabled = !1, this.fullWidth = !1, this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.name = "", this.value = "on", this._form = null, this._formResetHandler = null, this._initialSelected = !1, "attachInternals" in this && (this._internals = this.attachInternals());
|
|
14
|
+
}
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback(), this._initialSelected = this.selected, this._form = this.closest("form"), this._form && (this._formResetHandler = () => {
|
|
17
|
+
this.selected = this._initialSelected, this.__syncFormValue();
|
|
18
|
+
}, this._form.addEventListener("reset", this._formResetHandler, !0)), this.__syncFormValue();
|
|
12
19
|
}
|
|
13
|
-
|
|
14
|
-
this.
|
|
20
|
+
disconnectedCallback() {
|
|
21
|
+
this._form && this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0), super.disconnectedCallback();
|
|
15
22
|
}
|
|
16
23
|
firstUpdated() {
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
this.selected =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
var e;
|
|
25
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("md-switch");
|
|
26
|
+
t == null || t.addEventListener("change", (s) => {
|
|
27
|
+
this.selected = s.target.selected, this.dispatchEvent(
|
|
28
|
+
new CustomEvent("change", {
|
|
29
|
+
detail: { selected: this.selected },
|
|
30
|
+
bubbles: !0,
|
|
31
|
+
composed: !0
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
}), c(this, n, f).call(this);
|
|
35
|
+
}
|
|
36
|
+
updated(t) {
|
|
37
|
+
super.updated(t), t.has("disabled") && this.toggleAttribute("aria-disabled", this.disabled), (t.has("selected") || t.has("disabled") || t.has("value")) && this.__syncFormValue(), (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && c(this, n, f).call(this);
|
|
38
|
+
}
|
|
39
|
+
// Körs av webbläsaren när formuläret sätter disabled
|
|
40
|
+
formDisabledCallback(t) {
|
|
41
|
+
this.disabled = t;
|
|
42
|
+
}
|
|
43
|
+
// Synkar selected/disabled mot value
|
|
44
|
+
__syncFormValue() {
|
|
45
|
+
if (!this._internals) return;
|
|
46
|
+
const t = this.disabled || !this.selected ? null : this.value;
|
|
47
|
+
this._internals.setFormValue(t);
|
|
26
48
|
}
|
|
27
49
|
render() {
|
|
28
|
-
const
|
|
50
|
+
const t = this.label.trim().length > 0, e = t ? b : this.ariaLabel || b, s = u`
|
|
29
51
|
<md-switch
|
|
30
52
|
?icons=${this.icons}
|
|
31
53
|
?selected=${this.selected}
|
|
32
54
|
?disabled=${this.disabled}
|
|
33
|
-
aria-label=${
|
|
55
|
+
aria-label=${e}
|
|
34
56
|
></md-switch>
|
|
35
57
|
`;
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
return t ? u`
|
|
59
|
+
<label class="switch-container" ?disabled=${this.disabled}>
|
|
60
|
+
<span class="switch-label">${this.label}</span>
|
|
61
|
+
${s}
|
|
62
|
+
</label>
|
|
63
|
+
` : s;
|
|
42
64
|
}
|
|
43
65
|
};
|
|
44
|
-
|
|
66
|
+
n = /* @__PURE__ */ new WeakSet();
|
|
67
|
+
f = function() {
|
|
68
|
+
const t = c(this, n, h).call(this, this.spacing), e = c(this, n, h).call(this, this.spacingTop) ?? t, s = c(this, n, h).call(this, this.spacingBottom) ?? t;
|
|
69
|
+
e ? this.style.setProperty("--scb-switch-spacing-block-start", e) : this.style.removeProperty("--scb-switch-spacing-block-start"), s ? this.style.setProperty("--scb-switch-spacing-block-end", s) : this.style.removeProperty("--scb-switch-spacing-block-end");
|
|
70
|
+
};
|
|
71
|
+
h = function(t) {
|
|
72
|
+
if (!t) return;
|
|
73
|
+
const e = String(t).trim();
|
|
74
|
+
if (e)
|
|
75
|
+
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
76
|
+
};
|
|
77
|
+
i.formAssociated = !0;
|
|
78
|
+
i.styles = y`
|
|
45
79
|
:host {
|
|
46
80
|
display: block;
|
|
81
|
+
/* Vertikalt avstånd styrs av spacing-attributen via CSS-variabler */
|
|
82
|
+
margin-block-start: var(--scb-switch-spacing-block-start, 0);
|
|
83
|
+
margin-block-end: var(--scb-switch-spacing-block-end, 0);
|
|
47
84
|
}
|
|
48
85
|
|
|
49
86
|
.switch-container {
|
|
@@ -82,27 +119,42 @@ s.styles = d`
|
|
|
82
119
|
color: var(--scb-switch-label-color, inherit);
|
|
83
120
|
}
|
|
84
121
|
`;
|
|
85
|
-
|
|
122
|
+
a([
|
|
86
123
|
r({ type: String })
|
|
87
|
-
],
|
|
88
|
-
|
|
124
|
+
], i.prototype, "label", 2);
|
|
125
|
+
a([
|
|
89
126
|
r({ type: String, reflect: !0, attribute: "aria-label" })
|
|
90
|
-
],
|
|
91
|
-
|
|
127
|
+
], i.prototype, "ariaLabel", 2);
|
|
128
|
+
a([
|
|
92
129
|
r({ type: Boolean, reflect: !0 })
|
|
93
|
-
],
|
|
94
|
-
|
|
130
|
+
], i.prototype, "icons", 2);
|
|
131
|
+
a([
|
|
95
132
|
r({ type: Boolean, reflect: !0 })
|
|
96
|
-
],
|
|
97
|
-
|
|
133
|
+
], i.prototype, "selected", 2);
|
|
134
|
+
a([
|
|
98
135
|
r({ type: Boolean, reflect: !0 })
|
|
99
|
-
],
|
|
100
|
-
|
|
136
|
+
], i.prototype, "disabled", 2);
|
|
137
|
+
a([
|
|
101
138
|
r({ type: Boolean, reflect: !0, attribute: "full-width" })
|
|
102
|
-
],
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
],
|
|
139
|
+
], i.prototype, "fullWidth", 2);
|
|
140
|
+
a([
|
|
141
|
+
r({ type: String, reflect: !0 })
|
|
142
|
+
], i.prototype, "spacing", 2);
|
|
143
|
+
a([
|
|
144
|
+
r({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
145
|
+
], i.prototype, "spacingTop", 2);
|
|
146
|
+
a([
|
|
147
|
+
r({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
148
|
+
], i.prototype, "spacingBottom", 2);
|
|
149
|
+
a([
|
|
150
|
+
r({ type: String })
|
|
151
|
+
], i.prototype, "name", 2);
|
|
152
|
+
a([
|
|
153
|
+
r({ type: String })
|
|
154
|
+
], i.prototype, "value", 2);
|
|
155
|
+
i = a([
|
|
156
|
+
v("scb-switch")
|
|
157
|
+
], i);
|
|
106
158
|
export {
|
|
107
|
-
|
|
159
|
+
i as ScbSwitch
|
|
108
160
|
};
|
package/scb-tabs/scb-tabs.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { MdTabs } from '@material/web/tabs/tabs.js';
|
|
2
2
|
export declare class ScbTabs extends MdTabs {
|
|
3
|
+
#private;
|
|
3
4
|
ariaLabel: string;
|
|
5
|
+
/** Vertikalt avstånd ovanför/under tabs-komponenten. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
6
|
+
spacing: string;
|
|
7
|
+
/** Överkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
8
|
+
spacingTop: string;
|
|
9
|
+
/** Nederkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
10
|
+
spacingBottom: string;
|
|
4
11
|
private _isDispatching;
|
|
5
12
|
static styles: import('lit').CSSResultOrNative[];
|
|
6
13
|
connectedCallback(): void;
|
|
7
14
|
protected firstUpdated(changedProperties: Map<string, unknown>): void;
|
|
15
|
+
updated(changed: Map<string, unknown>): void;
|
|
8
16
|
private _onChange;
|
|
9
17
|
}
|