scb-wc-test 0.1.93 → 0.1.95
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-item.js +6 -7
- package/mvc/components/scb-accordion/scb-accordion.js +2 -2
- package/mvc/components/scb-button/scb-button.js +2 -2
- package/mvc/components/scb-chip/scb-chip.js +1 -1
- package/mvc/components/scb-dialog/scb-dialog.js +14 -15
- package/mvc/components/scb-header/scb-header.js +12 -7
- package/mvc/components/scb-link/scb-link.js +6 -6
- package/mvc/components/scb-list/scb-list-item.js +2 -2
- package/mvc/components/scb-list/scb-list.js +1 -1
- package/mvc/components/scb-radio-button/scb-radio-button.js +3 -3
- package/mvc/components/scb-switch/scb-switch.js +5 -6
- package/mvc/components/scb-tabs/scb-primary-tab.js +1 -2
- package/mvc/components/scb-tabs/scb-secondary-tab.js +2 -3
- package/mvc/components/scb-tabs/scb-tabs.js +1 -1
- package/mvc/components/scb-textfield/scb-textfield.js +6 -7
- package/mvc/scb-wc-test.css +1 -1
- package/mvc/vendor/vendor-material.js +147 -147
- package/mvc/vendor/vendor.js +1 -1
- package/package.json +2 -2
- package/scb-accordion/scb-accordion-item.d.ts +1 -3
- package/scb-accordion/scb-accordion-item.js +49 -49
- package/scb-dialog/scb-dialog.d.ts +0 -3
- package/scb-dialog/scb-dialog.js +74 -94
- package/scb-header/scb-header.js +25 -20
- package/scb-link/scb-link.js +3 -3
- package/scb-radio-button/scb-radio-button.js +3 -3
- package/scb-switch/scb-switch.d.ts +1 -2
- package/scb-switch/scb-switch.js +39 -42
- package/scb-tabs/scb-primary-tab.d.ts +0 -1
- package/scb-tabs/scb-primary-tab.js +24 -28
- package/scb-tabs/scb-secondary-tab.d.ts +0 -1
- package/scb-tabs/scb-secondary-tab.js +31 -35
- package/scb-textfield/scb-textfield.d.ts +0 -6
- package/scb-textfield/scb-textfield.js +34 -39
- package/scb-wc-test.bundle.js +745 -740
- package/scb-wc-test.css +1 -1
package/mvc/vendor/vendor.js
CHANGED
|
@@ -61,4 +61,4 @@
|
|
|
61
61
|
* Copyright 2020 Google LLC
|
|
62
62
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
63
|
*/const nt=Symbol.for(""),Nt=r=>{if(r?.r===nt)return r?._$litStatic$},Gt=(r,...t)=>({_$litStatic$:t.reduce((e,s,i)=>e+(n=>{if(n._$litStatic$!==void 0)return n._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${n}. Use 'unsafeStatic' to pass non-literal values, but
|
|
64
|
-
take care to ensure page security.`)})(s)+r[i+1],r[0]),r:nt}),Y=new Map,jt=r=>(t,...e)=>{const s=e.length;let i,n;const o=[],a=[];let h,l=0,d=!1;for(;l<s;){for(h=t[l];l<s&&(n=e[l],(i=Nt(n))!==void 0);)h+=i+t[++l],d=!0;l!==s&&a.push(n),o.push(h),l++}if(l===s&&o.push(t[s]),d){const c=o.join("$$lit$$");(t=Y.get(c))===void 0&&(o.raw=o,Y.set(c,t=o)),e=a}return r(t,...e)},Qt=jt(yt);export{u as E,Jt as _,Dt as a,
|
|
64
|
+
take care to ensure page security.`)})(s)+r[i+1],r[0]),r:nt}),Y=new Map,jt=r=>(t,...e)=>{const s=e.length;let i,n;const o=[],a=[];let h,l=0,d=!1;for(;l<s;){for(h=t[l];l<s&&(n=e[l],(i=Nt(n))!==void 0);)h+=i+t[++l],d=!0;l!==s&&a.push(n),o.push(h),l++}if(l===s&&o.push(t[s]),d){const c=o.join("$$lit$$");(t=Y.get(c))===void 0&&(o.raw=o,Y.set(c,t=o)),e=a}return r(t,...e)},Qt=jt(yt);export{u as E,Jt as _,Dt as a,Zt as b,Wt as c,Gt as d,qt as e,Ft as f,R as i,Tt as n,Vt as o,Bt as r,It as t,Qt as u,yt as x};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.95",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -316,5 +316,5 @@
|
|
|
316
316
|
},
|
|
317
317
|
"./mvc/*": "./mvc/*"
|
|
318
318
|
},
|
|
319
|
-
"buildHash": "
|
|
319
|
+
"buildHash": "B757576F758E9838EE0892469702B5E6590527CE770B3CE5D71D228F200BCCD7"
|
|
320
320
|
}
|
|
@@ -18,9 +18,7 @@ export declare class ScbAccordionItem extends LitElement {
|
|
|
18
18
|
private static _uidSeq;
|
|
19
19
|
private static _uid;
|
|
20
20
|
private _unique;
|
|
21
|
-
|
|
22
|
-
private static _mdRippleLoaded;
|
|
23
|
-
protected firstUpdated(): Promise<void>;
|
|
21
|
+
protected firstUpdated(): void;
|
|
24
22
|
static styles: import('lit').CSSResult[];
|
|
25
23
|
private _applyInertByOpen;
|
|
26
24
|
private _onToggle;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as o, customElement as
|
|
1
|
+
import { css as v, LitElement as h, nothing as p, html as l } from "lit";
|
|
2
|
+
import { property as o, customElement as m } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/focus/md-focus-ring.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import "@material/web/icon/icon.js";
|
|
5
|
+
import "@material/web/ripple/ripple.js";
|
|
6
|
+
var u = Object.defineProperty, b = Object.getOwnPropertyDescriptor, a = (t, e, s, r) => {
|
|
7
|
+
for (var n = r > 1 ? void 0 : r ? b(e, s) : e, c = t.length - 1, d; c >= 0; c--)
|
|
8
|
+
(d = t[c]) && (n = (r ? d(e, s, n) : d(n)) || n);
|
|
9
|
+
return r && n && u(e, s, n), n;
|
|
8
10
|
};
|
|
9
|
-
let
|
|
11
|
+
let i = class extends h {
|
|
10
12
|
constructor() {
|
|
11
|
-
super(...arguments), this.open = !1, this.title = "", this.content = "", this.overline = "", this.supportingText = "", this.leading = !1, this.leadingVariant = "", this.leadingIcon = "", this.imgHrefImage = "", this.avatarLabel = "", this.avatarAlt = "", this.avatarVariant = "icon", this.avatarSrc = "", this.density = 0, this._unique =
|
|
12
|
-
const
|
|
13
|
-
this.open = !!
|
|
13
|
+
super(...arguments), this.open = !1, this.title = "", this.content = "", this.overline = "", this.supportingText = "", this.leading = !1, this.leadingVariant = "", this.leadingIcon = "", this.imgHrefImage = "", this.avatarLabel = "", this.avatarAlt = "", this.avatarVariant = "icon", this.avatarSrc = "", this.density = 0, this._unique = i._uid(), this._onToggle = (t) => {
|
|
14
|
+
const e = t.currentTarget;
|
|
15
|
+
this.open = !!e.open;
|
|
14
16
|
const s = this.closest("scb-accordion");
|
|
15
17
|
this.open && s && !s.hasAttribute("detached") && s.querySelectorAll("scb-accordion-item").forEach((n) => {
|
|
16
18
|
n !== this && n.setOpen(!1);
|
|
@@ -18,18 +20,18 @@ let e = class extends v {
|
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
22
|
static _uid() {
|
|
21
|
-
var t,
|
|
22
|
-
return ((
|
|
23
|
+
var t, e;
|
|
24
|
+
return ((e = (t = globalThis.crypto) == null ? void 0 : t.randomUUID) == null ? void 0 : e.call(t)) ?? `${i._uidPrefix}-${++i._uidSeq}`;
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
firstUpdated() {
|
|
27
|
+
this._applyInertByOpen();
|
|
26
28
|
}
|
|
27
29
|
_applyInertByOpen() {
|
|
28
|
-
const t = this.renderRoot.querySelector(".scb-accordion-bottom"),
|
|
29
|
-
!t || !
|
|
30
|
+
const t = this.renderRoot.querySelector(".scb-accordion-bottom"), e = this.renderRoot.querySelector("details");
|
|
31
|
+
!t || !e || (e.open ? (t.removeAttribute("inert"), t.setAttribute("aria-hidden", "false")) : (t.setAttribute("inert", ""), t.setAttribute("aria-hidden", "true")));
|
|
30
32
|
}
|
|
31
33
|
_onKeyDown(t) {
|
|
32
|
-
const
|
|
34
|
+
const e = this.closest("scb-accordion"), r = Array.from((e == null ? void 0 : e.querySelectorAll("scb-accordion-item")) || []).map((d) => {
|
|
33
35
|
var g;
|
|
34
36
|
return ((g = d.renderRoot.querySelector("details")) == null ? void 0 : g.querySelector(".scb-accordion-top")) || null;
|
|
35
37
|
}).filter((d) => !!d), n = t.currentTarget, c = r.indexOf(n);
|
|
@@ -51,13 +53,13 @@ let e = class extends v {
|
|
|
51
53
|
/** Programmatisk uppdatering som även speglar <details>. */
|
|
52
54
|
setOpen(t) {
|
|
53
55
|
this.open = !!t;
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
+
const e = this.renderRoot.querySelector("details");
|
|
57
|
+
e && (e.open = this.open), this._applyInertByOpen();
|
|
56
58
|
}
|
|
57
59
|
updated(t) {
|
|
58
60
|
if (t.has("open")) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
+
const e = this.renderRoot.querySelector("details");
|
|
62
|
+
e && e.open !== this.open && (e.open = this.open), this._applyInertByOpen(), this.dispatchEvent(new CustomEvent("open-changed", {
|
|
61
63
|
detail: { open: this.open, title: this.title },
|
|
62
64
|
bubbles: !0,
|
|
63
65
|
composed: !0
|
|
@@ -65,7 +67,7 @@ let e = class extends v {
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
render() {
|
|
68
|
-
const t = `bottom-${this._unique}`,
|
|
70
|
+
const t = `bottom-${this._unique}`, e = `header-${this._unique}`, s = this.leading ? this.leadingVariant === "image" && this.imgHrefImage ? l`<img part="leading-image" class="img" src="${this.imgHrefImage}" alt="" />` : this.leadingVariant === "avatar" ? l`
|
|
69
71
|
<scb-avatar
|
|
70
72
|
label=${this.avatarLabel}
|
|
71
73
|
alt=${this.avatarAlt}
|
|
@@ -78,7 +80,7 @@ let e = class extends v {
|
|
|
78
80
|
return l`
|
|
79
81
|
<details class="scb-accordion-item" ?open=${this.open} @toggle=${this._onToggle}>
|
|
80
82
|
<summary
|
|
81
|
-
id=${
|
|
83
|
+
id=${e}
|
|
82
84
|
class="scb-accordion-top"
|
|
83
85
|
aria-controls=${t}
|
|
84
86
|
@keydown=${this._onKeyDown}
|
|
@@ -96,23 +98,21 @@ let e = class extends v {
|
|
|
96
98
|
<md-icon class="chevron">expand_more</md-icon>
|
|
97
99
|
</summary>
|
|
98
100
|
|
|
99
|
-
<div id=${t} class="scb-accordion-bottom" role="region" aria-labelledby=${
|
|
101
|
+
<div id=${t} class="scb-accordion-bottom" role="region" aria-labelledby=${e}>
|
|
100
102
|
<div class="bottom-inner">
|
|
101
103
|
<slot>${this.content}</slot>
|
|
102
104
|
</div>
|
|
103
105
|
</div>
|
|
104
106
|
</details>
|
|
105
107
|
|
|
106
|
-
<md-focus-ring for=${
|
|
108
|
+
<md-focus-ring for=${e} inward></md-focus-ring>
|
|
107
109
|
`;
|
|
108
110
|
}
|
|
109
111
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
e.styles = [
|
|
115
|
-
m`
|
|
112
|
+
i._uidPrefix = `uid-${Math.random().toString(36).slice(2)}`;
|
|
113
|
+
i._uidSeq = 0;
|
|
114
|
+
i.styles = [
|
|
115
|
+
v`
|
|
116
116
|
:host {
|
|
117
117
|
display: block;
|
|
118
118
|
position: relative;
|
|
@@ -246,49 +246,49 @@ e.styles = [
|
|
|
246
246
|
];
|
|
247
247
|
a([
|
|
248
248
|
o({ type: Boolean, reflect: !0 })
|
|
249
|
-
],
|
|
249
|
+
], i.prototype, "open", 2);
|
|
250
250
|
a([
|
|
251
251
|
o({ type: String, reflect: !0 })
|
|
252
|
-
],
|
|
252
|
+
], i.prototype, "title", 2);
|
|
253
253
|
a([
|
|
254
254
|
o({ type: String })
|
|
255
|
-
],
|
|
255
|
+
], i.prototype, "content", 2);
|
|
256
256
|
a([
|
|
257
257
|
o({ type: String, attribute: "overline" })
|
|
258
|
-
],
|
|
258
|
+
], i.prototype, "overline", 2);
|
|
259
259
|
a([
|
|
260
260
|
o({ type: String, attribute: "supporting-text" })
|
|
261
|
-
],
|
|
261
|
+
], i.prototype, "supportingText", 2);
|
|
262
262
|
a([
|
|
263
263
|
o({ type: Boolean })
|
|
264
|
-
],
|
|
264
|
+
], i.prototype, "leading", 2);
|
|
265
265
|
a([
|
|
266
266
|
o({ type: String, attribute: "leading-variant", reflect: !0 })
|
|
267
|
-
],
|
|
267
|
+
], i.prototype, "leadingVariant", 2);
|
|
268
268
|
a([
|
|
269
269
|
o({ type: String, attribute: "leading-icon" })
|
|
270
|
-
],
|
|
270
|
+
], i.prototype, "leadingIcon", 2);
|
|
271
271
|
a([
|
|
272
272
|
o({ type: String, attribute: "img-href-image", reflect: !0 })
|
|
273
|
-
],
|
|
273
|
+
], i.prototype, "imgHrefImage", 2);
|
|
274
274
|
a([
|
|
275
275
|
o({ type: String, attribute: "avatar-label" })
|
|
276
|
-
],
|
|
276
|
+
], i.prototype, "avatarLabel", 2);
|
|
277
277
|
a([
|
|
278
278
|
o({ type: String, attribute: "avatar-alt" })
|
|
279
|
-
],
|
|
279
|
+
], i.prototype, "avatarAlt", 2);
|
|
280
280
|
a([
|
|
281
281
|
o({ type: String, attribute: "avatar-variant" })
|
|
282
|
-
],
|
|
282
|
+
], i.prototype, "avatarVariant", 2);
|
|
283
283
|
a([
|
|
284
284
|
o({ type: String, attribute: "avatar-src" })
|
|
285
|
-
],
|
|
285
|
+
], i.prototype, "avatarSrc", 2);
|
|
286
286
|
a([
|
|
287
287
|
o({ type: Number, reflect: !0 })
|
|
288
|
-
],
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
],
|
|
288
|
+
], i.prototype, "density", 2);
|
|
289
|
+
i = a([
|
|
290
|
+
m("scb-accordion-item")
|
|
291
|
+
], i);
|
|
292
292
|
export {
|
|
293
|
-
|
|
293
|
+
i as ScbAccordionItem
|
|
294
294
|
};
|
|
@@ -20,10 +20,7 @@ export declare class ScbDialog extends LitElement {
|
|
|
20
20
|
formAction: string;
|
|
21
21
|
formMethod: FormMethod;
|
|
22
22
|
private __lastTriggerEl;
|
|
23
|
-
private __slotDeps;
|
|
24
23
|
static styles: import('lit').CSSResult;
|
|
25
|
-
protected firstUpdated(): Promise<void>;
|
|
26
|
-
private __ensureSlottedDeps;
|
|
27
24
|
private __getActionFromEvent;
|
|
28
25
|
private __onDocumentClick;
|
|
29
26
|
private __onDocumentKeydown;
|
package/scb-dialog/scb-dialog.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { css as h, LitElement as u, nothing as p, html as
|
|
2
|
-
import { property as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { css as h, LitElement as u, nothing as p, html as a } from "lit";
|
|
2
|
+
import { property as s, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import "../scb-button/scb-button.js";
|
|
4
|
+
import "../scb-icon-button/scb-icon-button.js";
|
|
5
|
+
import "../scb-textfield/scb-textfield.js";
|
|
6
|
+
import "../scb-checkbox/scb-checkbox.js";
|
|
7
|
+
import "../scb-radio-button/scb-radio-button.js";
|
|
8
|
+
import "../scb-switch/scb-switch.js";
|
|
9
|
+
import "../scb-chip/scb-chip.js";
|
|
10
|
+
import "@material/web/icon/icon.js";
|
|
11
|
+
var b = Object.defineProperty, f = Object.getOwnPropertyDescriptor, o = (t, e, l, c) => {
|
|
12
|
+
for (var n = c > 1 ? void 0 : c ? f(e, l) : e, r = t.length - 1, d; r >= 0; r--)
|
|
13
|
+
(d = t[r]) && (n = (c ? d(e, l, n) : d(n)) || n);
|
|
14
|
+
return c && n && b(e, l, n), n;
|
|
7
15
|
};
|
|
8
16
|
let i = class extends u {
|
|
9
17
|
constructor() {
|
|
10
|
-
super(...arguments), this.open = !1, this.inSb = !1, this.scrimClose = !0, this.variant = "basic", this.label = "", this.icon = "", this.supportingText = "", this.okButton = "OK", this.cancelButton = "Avbryt", this.deleteButton = "Delete", this.confirmButton = "Ta bort", this.denyButton = "Avbryt", this.resetButton = "Återställ", this.submitButton = "Spara", this.formId = "", this.formAction = "", this.formMethod = "", this.__lastTriggerEl = null, this.
|
|
11
|
-
"SCB-TEXTFIELD": () => import("../scb-textfield/scb-textfield.js"),
|
|
12
|
-
"SCB-CHECKBOX": () => import("../scb-checkbox/scb-checkbox.js"),
|
|
13
|
-
"SCB-RADIO-BUTTON": () => import("../scb-radio-button/scb-radio-button.js"),
|
|
14
|
-
"SCB-SWITCH": () => import("../scb-switch/scb-switch.js"),
|
|
15
|
-
"SCB-CHIP": () => import("../scb-chip/scb-chip.js")
|
|
16
|
-
}, this.__onDocumentClick = (t) => {
|
|
18
|
+
super(...arguments), this.open = !1, this.inSb = !1, this.scrimClose = !0, this.variant = "basic", this.label = "", this.icon = "", this.supportingText = "", this.okButton = "OK", this.cancelButton = "Avbryt", this.deleteButton = "Delete", this.confirmButton = "Ta bort", this.denyButton = "Avbryt", this.resetButton = "Återställ", this.submitButton = "Spara", this.formId = "", this.formAction = "", this.formMethod = "", this.__lastTriggerEl = null, this.__onDocumentClick = (t) => {
|
|
17
19
|
this.__getActionFromEvent(t) === "toggle" && (this.__setOpen(!this.open), t.stopPropagation());
|
|
18
20
|
}, this.__onDocumentKeydown = (t) => {
|
|
19
21
|
this.open && t.key === "Escape" && (this.__fire("esc"), this.__setOpen(!1));
|
|
@@ -28,10 +30,10 @@ let i = class extends u {
|
|
|
28
30
|
}, this.__onDeny = () => {
|
|
29
31
|
this.__fire("deny"), this.__setOpen(!1);
|
|
30
32
|
}, this.__onReset = () => {
|
|
31
|
-
var e,
|
|
32
|
-
(
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
var e, l, c, n;
|
|
34
|
+
(l = (e = this.shadowRoot) == null ? void 0 : e.querySelector("form")) == null || l.reset(), (((n = (c = this.shadowRoot) == null ? void 0 : c.querySelector("slot")) == null ? void 0 : n.assignedElements({ flatten: !0 })) ?? []).forEach((r) => {
|
|
35
|
+
const d = r.tagName;
|
|
36
|
+
d === "SCB-TEXTFIELD" && (r.value = ""), d === "SCB-CHECKBOX" && (r.checked = !1), d === "SCB-RADIO-BUTTON" && (r.checked = !1), d === "SCB-SWITCH" && (r.selected = !1), d === "SCB-CHIP" && (r.selected = !1);
|
|
35
37
|
}), this.__fire("reset");
|
|
36
38
|
}, this.__onSubmit = () => {
|
|
37
39
|
var t, e;
|
|
@@ -44,31 +46,10 @@ let i = class extends u {
|
|
|
44
46
|
)
|
|
45
47
|
).filter((n) => !n.hasAttribute("disabled"));
|
|
46
48
|
if (!e.length) return;
|
|
47
|
-
const
|
|
48
|
-
t.shiftKey && document.activeElement ===
|
|
49
|
+
const l = e[0], c = e[e.length - 1];
|
|
50
|
+
t.shiftKey && document.activeElement === l ? (c.focus(), t.preventDefault()) : !t.shiftKey && document.activeElement === c && (l.focus(), t.preventDefault());
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
|
-
/* Första uppdatering: se till att knappar/ikoner finns och slottade deps laddas on-demand. */
|
|
52
|
-
async firstUpdated() {
|
|
53
|
-
await import("../scb-button/scb-button.js"), await import("../scb-icon-button/scb-icon-button.js"), this.icon && await import("@material/web/icon/icon.js"), await this.__ensureSlottedDeps();
|
|
54
|
-
}
|
|
55
|
-
/* Ladda underkomponenter som faktiskt används i slotten (prestanda: undvik onödiga imports). */
|
|
56
|
-
async __ensureSlottedDeps() {
|
|
57
|
-
var r;
|
|
58
|
-
const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector("slot");
|
|
59
|
-
if (!t) return;
|
|
60
|
-
const e = async (c) => {
|
|
61
|
-
const n = new Set(c.map((o) => o.tagName));
|
|
62
|
-
for (const o of n) {
|
|
63
|
-
const l = this.__slotDeps[o];
|
|
64
|
-
l && await l();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
await e(t.assignedElements({ flatten: !0 })), t.addEventListener(
|
|
68
|
-
"slotchange",
|
|
69
|
-
async () => e(t.assignedElements({ flatten: !0 }))
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
53
|
/* Triggers + ESC + fokusåterställning
|
|
73
54
|
– aria-controls="dlg-id" eller data-dialog-toggle="dlg-id" växlar open-state
|
|
74
55
|
– ESC stänger och skickar 'esc'-event
|
|
@@ -99,17 +80,16 @@ let i = class extends u {
|
|
|
99
80
|
– lås/lås upp sid-scroll (inte i SB-läge)
|
|
100
81
|
*/
|
|
101
82
|
updated(t) {
|
|
102
|
-
var e,
|
|
83
|
+
var e, l;
|
|
103
84
|
if (t.has("open")) {
|
|
104
85
|
const c = t.get("open");
|
|
105
86
|
this.__updateTriggersExpanded(), this.open && !c ? this.updateComplete.then(() => {
|
|
106
|
-
var n,
|
|
107
|
-
(
|
|
87
|
+
var n, r, d;
|
|
88
|
+
(d = (r = (n = this.shadowRoot) == null ? void 0 : n.querySelector(
|
|
108
89
|
'button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'
|
|
109
|
-
)) == null ? void 0 :
|
|
110
|
-
}) : !this.open && c && ((
|
|
90
|
+
)) == null ? void 0 : r.focus) == null || d.call(r);
|
|
91
|
+
}) : !this.open && c && ((l = (e = this.__lastTriggerEl) == null ? void 0 : e.focus) == null || l.call(e)), this.__toggleScrollLock(this.open);
|
|
111
92
|
}
|
|
112
|
-
t.has("icon") && this.icon && import("@material/web/icon/icon.js");
|
|
113
93
|
}
|
|
114
94
|
/* Håll aria-expanded i synk på alla triggers som pekar på dialogens id. */
|
|
115
95
|
__updateTriggersExpanded() {
|
|
@@ -140,22 +120,22 @@ let i = class extends u {
|
|
|
140
120
|
/* Header: ikon (om satt), titel + ev. stäng-ikon i form/floating. */
|
|
141
121
|
renderHeader(t) {
|
|
142
122
|
const e = this.variant === "form" || this.variant === "floating";
|
|
143
|
-
return
|
|
123
|
+
return a`
|
|
144
124
|
<div class="header">
|
|
145
125
|
<div class="title">
|
|
146
|
-
${this.icon ?
|
|
126
|
+
${this.icon ? a`<md-icon class="dialog-icon">${this.icon}</md-icon>` : p}
|
|
147
127
|
<div class="label" id=${t}>${this.label}</div>
|
|
148
128
|
</div>
|
|
149
|
-
${e ?
|
|
129
|
+
${e ? a`<scb-icon-button class="close" icon="close" @click=${this.__onCancel}></scb-icon-button>` : p}
|
|
150
130
|
</div>
|
|
151
131
|
`;
|
|
152
132
|
}
|
|
153
133
|
/* Content för varianter som inte använder form. Faller tillbaka till supportingText om slotten är tom. */
|
|
154
134
|
renderContentDefault(t) {
|
|
155
135
|
const e = this.__slotIsEmpty();
|
|
156
|
-
return
|
|
136
|
+
return a`
|
|
157
137
|
<div class="content" id=${t}>
|
|
158
|
-
${e && this.supportingText ?
|
|
138
|
+
${e && this.supportingText ? a`${this.supportingText}` : a`<slot></slot>`}
|
|
159
139
|
</div>
|
|
160
140
|
`;
|
|
161
141
|
}
|
|
@@ -163,21 +143,21 @@ let i = class extends u {
|
|
|
163
143
|
renderActions() {
|
|
164
144
|
switch (this.variant) {
|
|
165
145
|
case "alert":
|
|
166
|
-
return
|
|
146
|
+
return a`<div class="actions">
|
|
167
147
|
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
168
148
|
</div>`;
|
|
169
149
|
case "confirm":
|
|
170
|
-
return
|
|
150
|
+
return a`<div class="actions">
|
|
171
151
|
<scb-button variant="text" label=${this.confirmButton} @click=${this.__onConfirm}></scb-button>
|
|
172
152
|
<scb-button variant="text" label=${this.denyButton} @click=${this.__onDeny}></scb-button>
|
|
173
153
|
</div>`;
|
|
174
154
|
case "choose":
|
|
175
|
-
return
|
|
155
|
+
return a`<div class="actions">
|
|
176
156
|
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
177
157
|
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
178
158
|
</div>`;
|
|
179
159
|
case "form":
|
|
180
|
-
return
|
|
160
|
+
return a`<div class="actions">
|
|
181
161
|
<scb-button class="start" variant="text" label=${this.resetButton} @click=${this.__onReset}></scb-button>
|
|
182
162
|
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
183
163
|
<scb-button variant="text" label=${this.submitButton} @click=${this.__onSubmit}></scb-button>
|
|
@@ -185,7 +165,7 @@ let i = class extends u {
|
|
|
185
165
|
case "floating":
|
|
186
166
|
return p;
|
|
187
167
|
default:
|
|
188
|
-
return
|
|
168
|
+
return a`<div class="actions">
|
|
189
169
|
<scb-button variant="text" label=${this.cancelButton} @click=${this.__onCancel}></scb-button>
|
|
190
170
|
<scb-button variant="text" label=${this.okButton} @click=${this.__onOk}></scb-button>
|
|
191
171
|
</div>`;
|
|
@@ -193,7 +173,7 @@ let i = class extends u {
|
|
|
193
173
|
}
|
|
194
174
|
/* Body skiljer på form-varianten (wrapper <form>) och övriga. */
|
|
195
175
|
renderBody(t, e) {
|
|
196
|
-
return this.variant === "form" ?
|
|
176
|
+
return this.variant === "form" ? a`
|
|
197
177
|
${this.renderHeader(t)}
|
|
198
178
|
<div class="content" id=${e}>
|
|
199
179
|
<form id=${this.formId} action=${this.formAction} method=${this.formMethod || p}>
|
|
@@ -201,12 +181,12 @@ let i = class extends u {
|
|
|
201
181
|
</form>
|
|
202
182
|
</div>
|
|
203
183
|
${this.renderActions()}
|
|
204
|
-
` :
|
|
184
|
+
` : a`${this.renderHeader(t)} ${this.renderContentDefault(e)} ${this.renderActions()}`;
|
|
205
185
|
}
|
|
206
186
|
/* Root render: role/aria-attribut sätts här för att para ihop titel och beskrivning. */
|
|
207
187
|
render() {
|
|
208
188
|
const t = "dlg-title", e = "dlg-desc";
|
|
209
|
-
return
|
|
189
|
+
return a`
|
|
210
190
|
<div class="scrim" @click=${this.__onScrimClick} aria-hidden="true"></div>
|
|
211
191
|
<div
|
|
212
192
|
class="container"
|
|
@@ -335,58 +315,58 @@ i.styles = h`
|
|
|
335
315
|
margin-block: var(--scb-choice-gap, 6px);
|
|
336
316
|
}
|
|
337
317
|
`;
|
|
338
|
-
|
|
339
|
-
|
|
318
|
+
o([
|
|
319
|
+
s({ type: Boolean, reflect: !0 })
|
|
340
320
|
], i.prototype, "open", 2);
|
|
341
|
-
|
|
342
|
-
|
|
321
|
+
o([
|
|
322
|
+
s({ type: Boolean, attribute: !1 })
|
|
343
323
|
], i.prototype, "inSb", 2);
|
|
344
|
-
|
|
345
|
-
|
|
324
|
+
o([
|
|
325
|
+
s({ type: Boolean, attribute: "scrim-close" })
|
|
346
326
|
], i.prototype, "scrimClose", 2);
|
|
347
|
-
|
|
348
|
-
|
|
327
|
+
o([
|
|
328
|
+
s({ type: String })
|
|
349
329
|
], i.prototype, "variant", 2);
|
|
350
|
-
|
|
351
|
-
|
|
330
|
+
o([
|
|
331
|
+
s({ type: String })
|
|
352
332
|
], i.prototype, "label", 2);
|
|
353
|
-
|
|
354
|
-
|
|
333
|
+
o([
|
|
334
|
+
s({ type: String })
|
|
355
335
|
], i.prototype, "icon", 2);
|
|
356
|
-
|
|
357
|
-
|
|
336
|
+
o([
|
|
337
|
+
s({ type: String, attribute: "supporting-text" })
|
|
358
338
|
], i.prototype, "supportingText", 2);
|
|
359
|
-
|
|
360
|
-
|
|
339
|
+
o([
|
|
340
|
+
s({ type: String, attribute: "ok-button" })
|
|
361
341
|
], i.prototype, "okButton", 2);
|
|
362
|
-
|
|
363
|
-
|
|
342
|
+
o([
|
|
343
|
+
s({ type: String, attribute: "cancel-button" })
|
|
364
344
|
], i.prototype, "cancelButton", 2);
|
|
365
|
-
|
|
366
|
-
|
|
345
|
+
o([
|
|
346
|
+
s({ type: String, attribute: "delete-button" })
|
|
367
347
|
], i.prototype, "deleteButton", 2);
|
|
368
|
-
|
|
369
|
-
|
|
348
|
+
o([
|
|
349
|
+
s({ type: String, attribute: "confirm-button" })
|
|
370
350
|
], i.prototype, "confirmButton", 2);
|
|
371
|
-
|
|
372
|
-
|
|
351
|
+
o([
|
|
352
|
+
s({ type: String, attribute: "deny-button" })
|
|
373
353
|
], i.prototype, "denyButton", 2);
|
|
374
|
-
|
|
375
|
-
|
|
354
|
+
o([
|
|
355
|
+
s({ type: String, attribute: "reset-button" })
|
|
376
356
|
], i.prototype, "resetButton", 2);
|
|
377
|
-
|
|
378
|
-
|
|
357
|
+
o([
|
|
358
|
+
s({ type: String, attribute: "submit-button" })
|
|
379
359
|
], i.prototype, "submitButton", 2);
|
|
380
|
-
|
|
381
|
-
|
|
360
|
+
o([
|
|
361
|
+
s({ type: String, attribute: "form-id" })
|
|
382
362
|
], i.prototype, "formId", 2);
|
|
383
|
-
|
|
384
|
-
|
|
363
|
+
o([
|
|
364
|
+
s({ type: String, attribute: "form-action" })
|
|
385
365
|
], i.prototype, "formAction", 2);
|
|
386
|
-
|
|
387
|
-
|
|
366
|
+
o([
|
|
367
|
+
s({ type: String, attribute: "form-method" })
|
|
388
368
|
], i.prototype, "formMethod", 2);
|
|
389
|
-
i =
|
|
369
|
+
i = o([
|
|
390
370
|
m("scb-dialog")
|
|
391
371
|
], i);
|
|
392
372
|
export {
|