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,56 +1,58 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
3
|
-
var
|
|
1
|
+
import { css as k, LitElement as S, html as C } from "lit";
|
|
2
|
+
import { property as c, customElement as V } from "lit/decorators.js";
|
|
3
|
+
var w = Object.defineProperty, E = Object.getOwnPropertyDescriptor, _ = (t) => {
|
|
4
4
|
throw TypeError(t);
|
|
5
|
-
},
|
|
6
|
-
for (var
|
|
7
|
-
(
|
|
8
|
-
return
|
|
9
|
-
},
|
|
10
|
-
let
|
|
5
|
+
}, l = (t, e, i, s) => {
|
|
6
|
+
for (var a = s > 1 ? void 0 : s ? E(e, i) : e, o = t.length - 1, n; o >= 0; o--)
|
|
7
|
+
(n = t[o]) && (a = (s ? n(e, i, a) : n(a)) || a);
|
|
8
|
+
return s && a && w(e, i, a), a;
|
|
9
|
+
}, y = (t, e, i) => e.has(t) || _("Cannot " + i), h = (t, e, i) => (y(t, e, "read from private field"), i ? i.call(t) : e.get(t)), g = (t, e, i) => e.has(t) ? _("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), d = (t, e, i) => (y(t, e, "access private method"), i), v, u, m, p, b, f;
|
|
10
|
+
let r = class extends S {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(
|
|
12
|
+
super(), g(this, p), this.name = "", this.orientation = "vertical", this.disabled = !1, this.ariaLabel = null, this.spacing = "", this.spacingTop = "", this.spacingBottom = "", this.value = "", this._internals = null, this._form = null, this._formResetHandler = null, this._initialValue = "", g(this, v, () => {
|
|
13
13
|
var e;
|
|
14
14
|
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
|
|
15
|
-
return t ? t.assignedElements({ flatten: !0 }).filter(
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
return t ? t.assignedElements({ flatten: !0 }).filter(
|
|
16
|
+
(i) => i.tagName.toLowerCase() === "scb-radio-button"
|
|
17
|
+
) : [];
|
|
18
|
+
}), g(this, u, () => {
|
|
19
|
+
const t = h(this, v).call(this);
|
|
18
20
|
if (!t.length) return;
|
|
19
21
|
let e = null;
|
|
20
|
-
for (const
|
|
21
|
-
const
|
|
22
|
-
this.name &&
|
|
23
|
-
const
|
|
22
|
+
for (const i of t) {
|
|
23
|
+
const s = i;
|
|
24
|
+
this.name && i.setAttribute("name", this.name), this.disabled ? i.setAttribute("disabled", "") : i.removeAttribute("disabled"), this.orientation === "horizontal" ? i.setAttribute("orientation", "horizontal") : i.removeAttribute("orientation");
|
|
25
|
+
const a = s.value ?? i.getAttribute("value") ?? "", o = typeof s.checked == "boolean" ? s.checked : i.hasAttribute("checked");
|
|
24
26
|
if (this.value) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
+
const n = String(a) === this.value;
|
|
28
|
+
n && !o ? s.checked = !0 : !n && o && (s.checked = !1);
|
|
27
29
|
} else
|
|
28
|
-
|
|
30
|
+
o && e === null && (e = String(a));
|
|
29
31
|
}
|
|
30
32
|
!this.value && e !== null && (this.value = e);
|
|
31
|
-
}),
|
|
32
|
-
var
|
|
33
|
+
}), g(this, m, (t) => {
|
|
34
|
+
var s, a;
|
|
33
35
|
const e = t.composedPath().find(
|
|
34
|
-
(
|
|
35
|
-
var
|
|
36
|
-
return ((
|
|
36
|
+
(o) => {
|
|
37
|
+
var n;
|
|
38
|
+
return ((n = o == null ? void 0 : o.tagName) == null ? void 0 : n.toLowerCase()) === "scb-radio-button";
|
|
37
39
|
}
|
|
38
|
-
),
|
|
39
|
-
this.value = String(
|
|
40
|
+
), i = (e == null ? void 0 : e.value) ?? ((s = e == null ? void 0 : e.getAttribute) == null ? void 0 : s.call(e, "value")) ?? ((a = t.target) == null ? void 0 : a.value) ?? "";
|
|
41
|
+
this.value = String(i ?? ""), this.dispatchEvent(
|
|
40
42
|
new CustomEvent("scb-change", {
|
|
41
43
|
detail: {
|
|
42
|
-
value: String(
|
|
44
|
+
value: String(i ?? ""),
|
|
43
45
|
originalIsTrusted: (t == null ? void 0 : t.isTrusted) === !0
|
|
44
46
|
},
|
|
45
47
|
bubbles: !0,
|
|
46
48
|
composed: !0
|
|
47
49
|
})
|
|
48
50
|
);
|
|
49
|
-
});
|
|
51
|
+
}), "attachInternals" in this && (this._internals = this.attachInternals());
|
|
50
52
|
}
|
|
51
53
|
render() {
|
|
52
54
|
const t = this.orientation === "horizontal" ? "row" : "column";
|
|
53
|
-
return
|
|
55
|
+
return C`
|
|
54
56
|
<div
|
|
55
57
|
class="g"
|
|
56
58
|
role="radiogroup"
|
|
@@ -58,62 +60,113 @@ let l = class extends b {
|
|
|
58
60
|
aria-label=${this.ariaLabel ?? ""}
|
|
59
61
|
style=${`--_dir:${t}`}
|
|
60
62
|
>
|
|
61
|
-
<slot @slotchange=${
|
|
63
|
+
<slot @slotchange=${h(this, u)}></slot>
|
|
62
64
|
</div>
|
|
63
65
|
`;
|
|
64
66
|
}
|
|
65
67
|
firstUpdated() {
|
|
66
|
-
|
|
68
|
+
d(this, p, b).call(this), h(this, u).call(this), this.addEventListener("change", h(this, m)), this._initialValue = this.value, this._form = this.closest("form"), this._form && (this._formResetHandler = () => {
|
|
69
|
+
this.value = this._initialValue, this.requestUpdate(), h(this, u).call(this), this.__syncFormValue();
|
|
70
|
+
}, this._form.addEventListener("reset", this._formResetHandler, !0)), this.__syncFormValue();
|
|
67
71
|
}
|
|
68
72
|
disconnectedCallback() {
|
|
69
|
-
this.removeEventListener("change",
|
|
73
|
+
this.removeEventListener("change", h(this, m)), this._form && this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0), super.disconnectedCallback();
|
|
70
74
|
}
|
|
71
75
|
updated(t) {
|
|
72
|
-
(t.has("
|
|
76
|
+
(t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && d(this, p, b).call(this), (t.has("name") || t.has("disabled") || t.has("orientation") || t.has("value")) && h(this, u).call(this), (t.has("value") || t.has("disabled") || t.has("name")) && this.__syncFormValue();
|
|
73
77
|
}
|
|
78
|
+
// Körs av webbläsaren när formuläret sätter disabled
|
|
79
|
+
formDisabledCallback(t) {
|
|
80
|
+
this.disabled = t;
|
|
81
|
+
}
|
|
82
|
+
// Synkar gruppens value/disabled mot FormData
|
|
83
|
+
__syncFormValue() {
|
|
84
|
+
if (!this._internals) return;
|
|
85
|
+
const t = typeof this.name == "string" && this.name.trim() !== "", e = typeof this.value == "string" && this.value.trim() !== "", i = this.disabled || !t || !e ? null : this.value;
|
|
86
|
+
this._internals.setFormValue(i);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
v = /* @__PURE__ */ new WeakMap();
|
|
90
|
+
u = /* @__PURE__ */ new WeakMap();
|
|
91
|
+
m = /* @__PURE__ */ new WeakMap();
|
|
92
|
+
p = /* @__PURE__ */ new WeakSet();
|
|
93
|
+
b = function() {
|
|
94
|
+
const t = d(this, p, f).call(this, this.spacing), e = d(this, p, f).call(this, this.spacingTop) ?? t, i = d(this, p, f).call(this, this.spacingBottom) ?? t;
|
|
95
|
+
e ? this.style.setProperty(
|
|
96
|
+
"--scb-radio-group-spacing-block-start",
|
|
97
|
+
e
|
|
98
|
+
) : this.style.removeProperty(
|
|
99
|
+
"--scb-radio-group-spacing-block-start"
|
|
100
|
+
), i ? this.style.setProperty(
|
|
101
|
+
"--scb-radio-group-spacing-block-end",
|
|
102
|
+
i
|
|
103
|
+
) : this.style.removeProperty(
|
|
104
|
+
"--scb-radio-group-spacing-block-end"
|
|
105
|
+
);
|
|
74
106
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
107
|
+
f = function(t) {
|
|
108
|
+
if (!t) return;
|
|
109
|
+
const e = String(t).trim();
|
|
110
|
+
if (e)
|
|
111
|
+
return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
|
|
112
|
+
};
|
|
113
|
+
r.formAssociated = !0;
|
|
114
|
+
r.styles = k`
|
|
115
|
+
:host {
|
|
116
|
+
display: block;
|
|
117
|
+
|
|
118
|
+
/* Vertikal standard-spacing mellan items i gruppen */
|
|
119
|
+
--scb-radio-gap: var(--spacing-4, 12px);
|
|
120
|
+
|
|
121
|
+
/* Vertikalt avstånd mot omgivande innehåll, styrs via spacing/spacing-top/spacing-bottom */
|
|
122
|
+
margin-block-start: var(--scb-radio-group-spacing-block-start, 0);
|
|
123
|
+
margin-block-end: var(--scb-radio-group-spacing-block-end, 0);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Horisontell standard-spacing mellan items om gap inte overrideas via CSS-variabel */
|
|
127
|
+
:host([orientation='horizontal']) {
|
|
128
|
+
--scb-radio-gap: var(--spacing-8, 32px);
|
|
129
|
+
}
|
|
80
130
|
|
|
81
131
|
.g {
|
|
82
132
|
display: flex;
|
|
83
133
|
flex-direction: var(--_dir, column);
|
|
84
|
-
gap: 0; /* default: inget extra gap */
|
|
85
134
|
align-items: flex-start;
|
|
135
|
+
gap: var(--scb-radio-gap);
|
|
86
136
|
}
|
|
87
137
|
|
|
88
|
-
/*
|
|
89
|
-
|
|
90
|
-
gap: var(--scb-radio-gap, 12px);
|
|
91
|
-
}
|
|
92
|
-
:host([spacing="group"]) ::slotted(scb-radio-button) {
|
|
138
|
+
/* När radioknappar ligger i en grupp ska spacing ägas av gruppen, inte av enskilda items */
|
|
139
|
+
::slotted(scb-radio-button) {
|
|
93
140
|
--scb-radio-gap: 0;
|
|
94
141
|
}
|
|
95
142
|
`;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
],
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
],
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
],
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
],
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
],
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
],
|
|
114
|
-
l
|
|
115
|
-
|
|
116
|
-
],
|
|
143
|
+
l([
|
|
144
|
+
c({ type: String })
|
|
145
|
+
], r.prototype, "name", 2);
|
|
146
|
+
l([
|
|
147
|
+
c({ type: String, reflect: !0 })
|
|
148
|
+
], r.prototype, "orientation", 2);
|
|
149
|
+
l([
|
|
150
|
+
c({ type: Boolean, reflect: !0 })
|
|
151
|
+
], r.prototype, "disabled", 2);
|
|
152
|
+
l([
|
|
153
|
+
c({ type: String, attribute: "aria-label" })
|
|
154
|
+
], r.prototype, "ariaLabel", 2);
|
|
155
|
+
l([
|
|
156
|
+
c({ type: String, reflect: !0 })
|
|
157
|
+
], r.prototype, "spacing", 2);
|
|
158
|
+
l([
|
|
159
|
+
c({ type: String, attribute: "spacing-top", reflect: !0 })
|
|
160
|
+
], r.prototype, "spacingTop", 2);
|
|
161
|
+
l([
|
|
162
|
+
c({ type: String, attribute: "spacing-bottom", reflect: !0 })
|
|
163
|
+
], r.prototype, "spacingBottom", 2);
|
|
164
|
+
l([
|
|
165
|
+
c({ type: String, reflect: !0 })
|
|
166
|
+
], r.prototype, "value", 2);
|
|
167
|
+
r = l([
|
|
168
|
+
V("scb-radio-group")
|
|
169
|
+
], r);
|
|
117
170
|
export {
|
|
118
|
-
|
|
171
|
+
r as ScbRadioGroup
|
|
119
172
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from 'lit';
|
|
1
|
+
import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
2
2
|
export declare class ScbSearch extends LitElement {
|
|
3
|
+
static formAssociated: boolean;
|
|
4
|
+
private _internals;
|
|
3
5
|
trailingIcon?: string;
|
|
4
6
|
supportingText: string;
|
|
5
7
|
value: string;
|
|
8
|
+
/** Namn för HTML-formulär (hamnar som nyckel i FormData när formuläret skickas) */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Inaktiverat läge; speglas mot inre input och FormData (skickas inte när disabled). */
|
|
11
|
+
disabled: boolean;
|
|
6
12
|
size: 'default' | 'compact';
|
|
7
13
|
fullScreen: boolean;
|
|
8
14
|
private _inputFocused;
|
|
@@ -14,12 +20,18 @@ export declare class ScbSearch extends LitElement {
|
|
|
14
20
|
private _kbShouldShowRing;
|
|
15
21
|
private _onGlobalKeydown;
|
|
16
22
|
private _onGlobalPointerDown;
|
|
23
|
+
private _form;
|
|
24
|
+
private _formResetHandler;
|
|
25
|
+
private _initialValue;
|
|
26
|
+
constructor();
|
|
17
27
|
static styles: import('lit').CSSResult;
|
|
18
28
|
connectedCallback(): void;
|
|
19
29
|
disconnectedCallback(): void;
|
|
20
30
|
firstUpdated(): void;
|
|
21
|
-
updated(): void;
|
|
31
|
+
updated(changed: PropertyValues): void;
|
|
22
32
|
render(): TemplateResult;
|
|
33
|
+
/** Gör så att native formulär kan sätta disabled på kontrollen. */
|
|
34
|
+
formDisabledCallback(disabled: boolean): void;
|
|
23
35
|
submit(): void;
|
|
24
36
|
private get _hasSuggestions();
|
|
25
37
|
private _onSlotChange;
|
|
@@ -48,6 +60,7 @@ export declare class ScbSearch extends LitElement {
|
|
|
48
60
|
private _listWithHandler?;
|
|
49
61
|
private _attachListScrollListener;
|
|
50
62
|
private _detachListScrollListener;
|
|
63
|
+
private _syncFormValue;
|
|
51
64
|
}
|
|
52
65
|
declare global {
|
|
53
66
|
interface HTMLElementTagNameMap {
|