scb-wc-test 0.1.1
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/README.md +130 -0
- package/all.js +54 -0
- package/dummy.png +0 -0
- package/index.d.ts +54 -0
- package/index.js +108 -0
- package/mvc/components/all.js +53 -0
- package/mvc/components/scb-accordion/scb-accordion-item.js +194 -0
- package/mvc/components/scb-accordion/scb-accordion.js +5 -0
- package/mvc/components/scb-app-bar/scb-app-bar.js +144 -0
- package/mvc/components/scb-avatar/scb-avatar.js +99 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +17 -0
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +52 -0
- package/mvc/components/scb-button/scb-button.js +121 -0
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +140 -0
- package/mvc/components/scb-card/scb-card.js +256 -0
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +33 -0
- package/mvc/components/scb-checkbox/scb-checkbox.js +99 -0
- package/mvc/components/scb-chips/scb-chip.js +46 -0
- package/mvc/components/scb-dialog/scb-dialog.js +158 -0
- package/mvc/components/scb-divider/scb-divider.js +53 -0
- package/mvc/components/scb-drawer/scb-drawer-item.js +114 -0
- package/mvc/components/scb-drawer/scb-drawer-section.js +19 -0
- package/mvc/components/scb-drawer/scb-drawer.js +79 -0
- package/mvc/components/scb-drawer/scb-sub-drawer.js +10 -0
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +44 -0
- package/mvc/components/scb-fact-card/scb-fact-card.js +66 -0
- package/mvc/components/scb-footer/scb-footer-section.js +3 -0
- package/mvc/components/scb-footer/scb-footer.js +205 -0
- package/mvc/components/scb-grid/scb-grid-item.js +9 -0
- package/mvc/components/scb-grid/scb-grid.js +81 -0
- package/mvc/components/scb-grid/scb-stack.js +16 -0
- package/mvc/components/scb-header/scb-header-drawer-group.js +1 -0
- package/mvc/components/scb-header/scb-header-drawer-item.js +1 -0
- package/mvc/components/scb-header/scb-header-tab.js +1 -0
- package/mvc/components/scb-header/scb-header-utility.js +1 -0
- package/mvc/components/scb-header/scb-header.js +240 -0
- package/mvc/components/scb-icon-button/scb-icon-button.js +95 -0
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +69 -0
- package/mvc/components/scb-link/scb-link.js +31 -0
- package/mvc/components/scb-list/scb-list-item.js +38 -0
- package/mvc/components/scb-list/scb-list.js +10 -0
- package/mvc/components/scb-menu/scb-menu-item.js +44 -0
- package/mvc/components/scb-menu/scb-menu.js +17 -0
- package/mvc/components/scb-menu/scb-sub-menu.js +29 -0
- package/mvc/components/scb-notification/scb-notification.js +120 -0
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +84 -0
- package/mvc/components/scb-radio-button/scb-radio-button.js +95 -0
- package/mvc/components/scb-radio-button/scb-radio-group.js +28 -0
- package/mvc/components/scb-search/scb-search.js +211 -0
- package/mvc/components/scb-snackbar/scb-snackbar.js +83 -0
- package/mvc/components/scb-status-pill/scb-status-pill.js +31 -0
- package/mvc/components/scb-switch/scb-switch.js +54 -0
- package/mvc/components/scb-tabs/scb-primary-tab.js +7 -0
- package/mvc/components/scb-tabs/scb-secondary-tab.js +7 -0
- package/mvc/components/scb-tabs/scb-tabs.js +23 -0
- package/mvc/components/scb-textfield/scb-textfield.js +135 -0
- package/mvc/components/scb-toc/scb-toc-item.js +84 -0
- package/mvc/components/scb-toc/scb-toc.js +6 -0
- package/mvc/components/scb-tooltip/scb-tooltip.js +216 -0
- package/mvc/scb-logo.svg +21 -0
- package/mvc/scb-wc-test.css +1 -0
- package/mvc/scb.svg +14 -0
- package/mvc/vendor/preload-helper.js +1 -0
- package/mvc/vendor/vendor-lit.js +1 -0
- package/mvc/vendor/vendor-material.js +764 -0
- package/mvc/vendor/vendor.js +68 -0
- package/package.json +248 -0
- package/scb-accordion/scb-accordion-item.d.ts +37 -0
- package/scb-accordion/scb-accordion-item.js +343 -0
- package/scb-accordion/scb-accordion.d.ts +6 -0
- package/scb-accordion/scb-accordion.js +33 -0
- package/scb-app-bar/scb-app-bar.d.ts +10 -0
- package/scb-app-bar/scb-app-bar.js +192 -0
- package/scb-avatar/scb-avatar.d.ts +30 -0
- package/scb-avatar/scb-avatar.js +169 -0
- package/scb-breadcrumb/scb-breadcrumb-item.d.ts +9 -0
- package/scb-breadcrumb/scb-breadcrumb-item.js +54 -0
- package/scb-breadcrumb/scb-breadcrumb.d.ts +16 -0
- package/scb-breadcrumb/scb-breadcrumb.js +105 -0
- package/scb-button/scb-button.d.ts +26 -0
- package/scb-button/scb-button.js +247 -0
- package/scb-calendar-card/scb-calendar-card.d.ts +20 -0
- package/scb-calendar-card/scb-calendar-card.js +191 -0
- package/scb-card/scb-card.d.ts +24 -0
- package/scb-card/scb-card.js +345 -0
- package/scb-checkbox/scb-checkbox-group.d.ts +17 -0
- package/scb-checkbox/scb-checkbox-group.js +80 -0
- package/scb-checkbox/scb-checkbox.d.ts +20 -0
- package/scb-checkbox/scb-checkbox.js +157 -0
- package/scb-chips/scb-chip.d.ts +24 -0
- package/scb-chips/scb-chip.js +150 -0
- package/scb-dialog/scb-dialog.d.ts +58 -0
- package/scb-dialog/scb-dialog.js +390 -0
- package/scb-divider/scb-divider.d.ts +9 -0
- package/scb-divider/scb-divider.js +85 -0
- package/scb-drawer/scb-drawer-item.d.ts +61 -0
- package/scb-drawer/scb-drawer-item.js +220 -0
- package/scb-drawer/scb-drawer-section.d.ts +7 -0
- package/scb-drawer/scb-drawer-section.js +44 -0
- package/scb-drawer/scb-drawer.d.ts +97 -0
- package/scb-drawer/scb-drawer.js +258 -0
- package/scb-drawer/scb-sub-drawer.d.ts +10 -0
- package/scb-drawer/scb-sub-drawer.js +43 -0
- package/scb-fact-card/scb-fact-card-content.d.ts +10 -0
- package/scb-fact-card/scb-fact-card-content.js +83 -0
- package/scb-fact-card/scb-fact-card.d.ts +15 -0
- package/scb-fact-card/scb-fact-card.js +110 -0
- package/scb-footer/scb-footer-section.d.ts +21 -0
- package/scb-footer/scb-footer-section.js +28 -0
- package/scb-footer/scb-footer.d.ts +27 -0
- package/scb-footer/scb-footer.js +326 -0
- package/scb-grid/scb-grid-item.d.ts +28 -0
- package/scb-grid/scb-grid-item.js +66 -0
- package/scb-grid/scb-grid.d.ts +33 -0
- package/scb-grid/scb-grid.js +152 -0
- package/scb-grid/scb-stack.d.ts +29 -0
- package/scb-grid/scb-stack.js +82 -0
- package/scb-header/scb-header-drawer-group.d.ts +13 -0
- package/scb-header/scb-header-drawer-group.js +28 -0
- package/scb-header/scb-header-drawer-item.d.ts +14 -0
- package/scb-header/scb-header-drawer-item.js +31 -0
- package/scb-header/scb-header-tab.d.ts +13 -0
- package/scb-header/scb-header-tab.js +28 -0
- package/scb-header/scb-header-utility.d.ts +14 -0
- package/scb-header/scb-header-utility.js +31 -0
- package/scb-header/scb-header.d.ts +105 -0
- package/scb-header/scb-header.js +618 -0
- package/scb-icon-button/scb-icon-button.d.ts +31 -0
- package/scb-icon-button/scb-icon-button.js +208 -0
- package/scb-keyfigure-card/scb-keyfigure-card.d.ts +13 -0
- package/scb-keyfigure-card/scb-keyfigure-card.js +119 -0
- package/scb-link/scb-link.d.ts +17 -0
- package/scb-link/scb-link.js +74 -0
- package/scb-list/scb-list-item.d.ts +32 -0
- package/scb-list/scb-list-item.js +144 -0
- package/scb-list/scb-list.d.ts +8 -0
- package/scb-list/scb-list.js +39 -0
- package/scb-logo.svg +21 -0
- package/scb-menu/scb-menu-item.d.ts +22 -0
- package/scb-menu/scb-menu-item.js +107 -0
- package/scb-menu/scb-menu.d.ts +21 -0
- package/scb-menu/scb-menu.js +98 -0
- package/scb-menu/scb-sub-menu.d.ts +12 -0
- package/scb-menu/scb-sub-menu.js +69 -0
- package/scb-notification/scb-notification.d.ts +16 -0
- package/scb-notification/scb-notification.js +187 -0
- package/scb-progress-indicator/scb-progress-indicator.d.ts +11 -0
- package/scb-progress-indicator/scb-progress-indicator.js +122 -0
- package/scb-radio-button/scb-radio-button.d.ts +19 -0
- package/scb-radio-button/scb-radio-button.js +176 -0
- package/scb-radio-button/scb-radio-group.d.ts +20 -0
- package/scb-radio-button/scb-radio-group.js +81 -0
- package/scb-search/scb-search.d.ts +45 -0
- package/scb-search/scb-search.js +410 -0
- package/scb-snackbar/scb-snackbar.d.ts +17 -0
- package/scb-snackbar/scb-snackbar.js +140 -0
- package/scb-status-pill/scb-status-pill.d.ts +9 -0
- package/scb-status-pill/scb-status-pill.js +62 -0
- package/scb-switch/scb-switch.d.ts +21 -0
- package/scb-switch/scb-switch.js +111 -0
- package/scb-tabs/scb-primary-tab.d.ts +17 -0
- package/scb-tabs/scb-primary-tab.js +93 -0
- package/scb-tabs/scb-secondary-tab.d.ts +17 -0
- package/scb-tabs/scb-secondary-tab.js +97 -0
- package/scb-tabs/scb-tabs.d.ts +10 -0
- package/scb-tabs/scb-tabs.js +66 -0
- package/scb-textfield/scb-textfield.d.ts +41 -0
- package/scb-textfield/scb-textfield.js +258 -0
- package/scb-toc/scb-toc-item.d.ts +21 -0
- package/scb-toc/scb-toc-item.js +196 -0
- package/scb-toc/scb-toc.d.ts +6 -0
- package/scb-toc/scb-toc.js +27 -0
- package/scb-tooltip/scb-tooltip.d.ts +32 -0
- package/scb-tooltip/scb-tooltip.js +329 -0
- package/scb-wc-test.bundle.js +5429 -0
- package/scb-wc-test.css +1 -0
- package/scb-wc-test.d.ts +106 -0
- package/scb.svg +14 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { LitElement as b, nothing as h, html as p, css as y } from "lit";
|
|
2
|
+
import { property as l, customElement as v } from "lit/decorators.js";
|
|
3
|
+
var g = Object.defineProperty, w = Object.getOwnPropertyDescriptor, f = (e) => {
|
|
4
|
+
throw TypeError(e);
|
|
5
|
+
}, i = (e, t, s, n) => {
|
|
6
|
+
for (var r = n > 1 ? void 0 : n ? w(t, s) : t, c = e.length - 1, d; c >= 0; c--)
|
|
7
|
+
(d = e[c]) && (r = (n ? d(t, s, r) : d(r)) || r);
|
|
8
|
+
return n && r && g(t, s, r), r;
|
|
9
|
+
}, u = (e, t, s) => t.has(e) || f("Cannot " + s), m = (e, t, s) => (u(e, t, "read from private field"), t.get(e)), _ = (e, t, s) => t.has(e) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), x = (e, t, s, n) => (u(e, t, "write to private field"), t.set(e, s), s), o;
|
|
10
|
+
let a = class extends b {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.label = "", this.ariaLabel = "", this.icons = !1, this.selected = !1, this.disabled = !1, this.fullWidth = !1, _(this, o, !1);
|
|
13
|
+
}
|
|
14
|
+
updated() {
|
|
15
|
+
this.toggleAttribute("aria-disabled", this.disabled);
|
|
16
|
+
}
|
|
17
|
+
async firstUpdated() {
|
|
18
|
+
var t;
|
|
19
|
+
m(this, o) || (await import("@material/web/switch/switch.js"), x(this, o, !0));
|
|
20
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("md-switch");
|
|
21
|
+
e == null || e.addEventListener("change", (s) => {
|
|
22
|
+
this.selected = s.target.selected, this.dispatchEvent(new CustomEvent("change", {
|
|
23
|
+
detail: { selected: this.selected },
|
|
24
|
+
bubbles: !0,
|
|
25
|
+
composed: !0
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
const e = this.label.trim().length > 0, t = e ? h : this.ariaLabel || h, s = p`
|
|
31
|
+
<md-switch
|
|
32
|
+
?icons=${this.icons}
|
|
33
|
+
?selected=${this.selected}
|
|
34
|
+
?disabled=${this.disabled}
|
|
35
|
+
aria-label=${t}
|
|
36
|
+
></md-switch>
|
|
37
|
+
`;
|
|
38
|
+
return e ? p`
|
|
39
|
+
<label class="switch-container" ?disabled=${this.disabled}>
|
|
40
|
+
<span class="switch-label">${this.label}</span>
|
|
41
|
+
${s}
|
|
42
|
+
</label>
|
|
43
|
+
` : s;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
o = /* @__PURE__ */ new WeakMap();
|
|
47
|
+
a.styles = y`
|
|
48
|
+
:host {
|
|
49
|
+
display: block;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.switch-container {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
width: auto;
|
|
57
|
+
|
|
58
|
+
/* Gap hämtas från spacing-tokens och följer density-lägen */
|
|
59
|
+
gap: var(--scb-switch-gap, var(--spacing-3, 8px));
|
|
60
|
+
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
|
|
63
|
+
/* Basfärg för innehållet. Labeln ärver om inget annat anges. */
|
|
64
|
+
color: var(--md-sys-color-on-surface);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* När full-width är true, kör space-between + 100% bredd */
|
|
68
|
+
:host([full-width]) .switch-container {
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
width: 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.switch-label {
|
|
74
|
+
/* liten vertikal justering kopplad till spacing-tokens */
|
|
75
|
+
transform: translateY(var(--scb-switch-label-offset-y, var(--spacing-1, 2px)));
|
|
76
|
+
|
|
77
|
+
/* Typografiska tokens*/
|
|
78
|
+
font-family: var(--brand-font, 'Inter', sans-serif);
|
|
79
|
+
font-size: var(--md-sys-typescale-title-medium-size, 18px);
|
|
80
|
+
line-height: var(--md-sys-typescale-title-medium-line-height, 26px);
|
|
81
|
+
font-weight: var(--md-sys-typescale-title-large-weight, 600);
|
|
82
|
+
letter-spacing: var(--md-sys-typescale-title-medium-tracking, -0.3px);
|
|
83
|
+
|
|
84
|
+
/* Ärver färg från container */
|
|
85
|
+
color: var(--scb-switch-label-color, inherit);
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
i([
|
|
89
|
+
l({ type: String })
|
|
90
|
+
], a.prototype, "label", 2);
|
|
91
|
+
i([
|
|
92
|
+
l({ type: String, reflect: !0, attribute: "aria-label" })
|
|
93
|
+
], a.prototype, "ariaLabel", 2);
|
|
94
|
+
i([
|
|
95
|
+
l({ type: Boolean, reflect: !0 })
|
|
96
|
+
], a.prototype, "icons", 2);
|
|
97
|
+
i([
|
|
98
|
+
l({ type: Boolean, reflect: !0 })
|
|
99
|
+
], a.prototype, "selected", 2);
|
|
100
|
+
i([
|
|
101
|
+
l({ type: Boolean, reflect: !0 })
|
|
102
|
+
], a.prototype, "disabled", 2);
|
|
103
|
+
i([
|
|
104
|
+
l({ type: Boolean, reflect: !0, attribute: "full-width" })
|
|
105
|
+
], a.prototype, "fullWidth", 2);
|
|
106
|
+
a = i([
|
|
107
|
+
v("scb-switch")
|
|
108
|
+
], a);
|
|
109
|
+
export {
|
|
110
|
+
a as ScbSwitch
|
|
111
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MdPrimaryTab } from '@material/web/tabs/primary-tab.js';
|
|
2
|
+
import { PropertyValues } from 'lit';
|
|
3
|
+
|
|
4
|
+
export declare class ScbPrimaryTab extends MdPrimaryTab {
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
private _icon?;
|
|
7
|
+
get icon(): string | undefined;
|
|
8
|
+
set icon(value: string | undefined);
|
|
9
|
+
iconOnly: boolean;
|
|
10
|
+
inlineIcon: boolean;
|
|
11
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
12
|
+
private _onActivate;
|
|
13
|
+
protected updated(): void;
|
|
14
|
+
static styles: import('lit').CSSResultOrNative[];
|
|
15
|
+
private ensureMdIconLoaded;
|
|
16
|
+
private updateIconSlot;
|
|
17
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { MdPrimaryTab as d } from "@material/web/tabs/primary-tab.js";
|
|
2
|
+
import { property as l, customElement as p } from "lit/decorators.js";
|
|
3
|
+
import { css as u } from "lit";
|
|
4
|
+
var h = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (t, e, r, n) => {
|
|
5
|
+
for (var o = n > 1 ? void 0 : n ? b(e, r) : e, c = t.length - 1, a; c >= 0; c--)
|
|
6
|
+
(a = t[c]) && (o = (n ? a(e, r, o) : a(o)) || o);
|
|
7
|
+
return n && o && h(e, r, o), o;
|
|
8
|
+
};
|
|
9
|
+
let i = class extends d {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.iconOnly = !1, this.inlineIcon = !1, this._onActivate = () => {
|
|
12
|
+
var e;
|
|
13
|
+
const t = ((e = this.textContent) == null ? void 0 : e.trim()) ?? "";
|
|
14
|
+
this.dispatchEvent(new CustomEvent("activate", {
|
|
15
|
+
detail: { label: t },
|
|
16
|
+
bubbles: !0,
|
|
17
|
+
composed: !0
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/* Semantisk role för en enskild flik */
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback(), this.setAttribute("role", "tab");
|
|
24
|
+
}
|
|
25
|
+
get icon() {
|
|
26
|
+
return this._icon;
|
|
27
|
+
}
|
|
28
|
+
set icon(t) {
|
|
29
|
+
const e = this._icon;
|
|
30
|
+
e !== t && (this._icon = t, this.requestUpdate("icon", e), this.updateIconSlot());
|
|
31
|
+
}
|
|
32
|
+
/*
|
|
33
|
+
Efter första render, fånga click och dispatcha eget 'activate'-event
|
|
34
|
+
med detail.label för enklare hantering hos konsumenter.
|
|
35
|
+
*/
|
|
36
|
+
firstUpdated(t) {
|
|
37
|
+
super.firstUpdated(t), this.addEventListener("click", this._onActivate), this._icon && this.updateIconSlot();
|
|
38
|
+
}
|
|
39
|
+
/*
|
|
40
|
+
Körs efter varje uppdatering.
|
|
41
|
+
- Sätter aria-selected baserat på active.
|
|
42
|
+
- Om iconOnly utan egen aria-label: fallback till slot-texten.
|
|
43
|
+
*/
|
|
44
|
+
updated() {
|
|
45
|
+
var t;
|
|
46
|
+
if (super.updated(), this.setAttribute("aria-selected", this.active ? "true" : "false"), this.iconOnly && !this.hasAttribute("aria-label")) {
|
|
47
|
+
const e = ((t = this.textContent) == null ? void 0 : t.trim()) ?? "";
|
|
48
|
+
e && this.setAttribute("aria-label", e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Lazy import av md-icon – laddas EN gång globalt när det behövs
|
|
52
|
+
async ensureMdIconLoaded() {
|
|
53
|
+
const t = globalThis;
|
|
54
|
+
t.__mdIconLoaded || (await import("@material/web/icon/icon.js"), t.__mdIconLoaded = !0);
|
|
55
|
+
}
|
|
56
|
+
async updateIconSlot() {
|
|
57
|
+
const t = this.querySelector('md-icon[slot="icon"]');
|
|
58
|
+
if (!this._icon) {
|
|
59
|
+
t == null || t.remove();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (await this.ensureMdIconLoaded(), t)
|
|
63
|
+
t.textContent = this._icon;
|
|
64
|
+
else {
|
|
65
|
+
const e = document.createElement("md-icon");
|
|
66
|
+
e.setAttribute("slot", "icon"), e.textContent = this._icon, this.appendChild(e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
i.styles = [
|
|
71
|
+
...d.styles,
|
|
72
|
+
u`
|
|
73
|
+
/* Icon-only: dölj textslot */
|
|
74
|
+
:host([icon-only]) slot:not([name='icon']) {
|
|
75
|
+
display: none;
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
];
|
|
79
|
+
s([
|
|
80
|
+
l({ type: String })
|
|
81
|
+
], i.prototype, "icon", 1);
|
|
82
|
+
s([
|
|
83
|
+
l({ type: Boolean, reflect: !0, attribute: "icon-only" })
|
|
84
|
+
], i.prototype, "iconOnly", 2);
|
|
85
|
+
s([
|
|
86
|
+
l({ type: Boolean, reflect: !0, attribute: "inline-icon" })
|
|
87
|
+
], i.prototype, "inlineIcon", 2);
|
|
88
|
+
i = s([
|
|
89
|
+
p("scb-primary-tab")
|
|
90
|
+
], i);
|
|
91
|
+
export {
|
|
92
|
+
i as ScbPrimaryTab
|
|
93
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MdSecondaryTab } from '@material/web/tabs/secondary-tab.js';
|
|
2
|
+
import { PropertyValues } from 'lit';
|
|
3
|
+
|
|
4
|
+
export declare class ScbSecondaryTab extends MdSecondaryTab {
|
|
5
|
+
/** Semantisk role för en enskild flik */
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
private _icon?;
|
|
8
|
+
get icon(): string | undefined;
|
|
9
|
+
set icon(value: string | undefined);
|
|
10
|
+
iconOnly: boolean;
|
|
11
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
12
|
+
protected updated(): void;
|
|
13
|
+
private _onActivate;
|
|
14
|
+
static styles: import('lit').CSSResultOrNative[];
|
|
15
|
+
private ensureMdIconLoaded;
|
|
16
|
+
private updateIconSlot;
|
|
17
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { MdSecondaryTab as l } from "@material/web/tabs/secondary-tab.js";
|
|
2
|
+
import { property as d, customElement as h } from "lit/decorators.js";
|
|
3
|
+
import { css as p } from "lit";
|
|
4
|
+
var u = Object.defineProperty, b = Object.getOwnPropertyDescriptor, a = (t, e, i, s) => {
|
|
5
|
+
for (var o = s > 1 ? void 0 : s ? b(e, i) : e, c = t.length - 1, r; c >= 0; c--)
|
|
6
|
+
(r = t[c]) && (o = (s ? r(e, i, o) : r(o)) || o);
|
|
7
|
+
return s && o && u(e, i, o), o;
|
|
8
|
+
};
|
|
9
|
+
let n = class extends l {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.iconOnly = !1, this._onActivate = () => {
|
|
12
|
+
var e;
|
|
13
|
+
const t = ((e = this.textContent) == null ? void 0 : e.trim()) ?? "";
|
|
14
|
+
this.dispatchEvent(
|
|
15
|
+
new CustomEvent("activate", {
|
|
16
|
+
detail: { label: t },
|
|
17
|
+
bubbles: !0,
|
|
18
|
+
composed: !0
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Semantisk role för en enskild flik */
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback(), this.setAttribute("role", "tab");
|
|
26
|
+
}
|
|
27
|
+
get icon() {
|
|
28
|
+
return this._icon;
|
|
29
|
+
}
|
|
30
|
+
set icon(t) {
|
|
31
|
+
const e = this._icon;
|
|
32
|
+
e !== t && (this._icon = t, this.requestUpdate("icon", e), this.updateIconSlot());
|
|
33
|
+
}
|
|
34
|
+
/*
|
|
35
|
+
Efter första render:
|
|
36
|
+
- Sätt fallback aria-label om iconOnly används utan egen label.
|
|
37
|
+
- Fånga click och dispatcha ett 'activate'-event med detail.label.
|
|
38
|
+
*/
|
|
39
|
+
firstUpdated(t) {
|
|
40
|
+
var e;
|
|
41
|
+
if (super.firstUpdated(t), this.iconOnly && !this.hasAttribute("aria-label")) {
|
|
42
|
+
const i = ((e = this.textContent) == null ? void 0 : e.trim()) ?? "";
|
|
43
|
+
i && this.setAttribute("aria-label", i);
|
|
44
|
+
}
|
|
45
|
+
this.addEventListener("click", this._onActivate), this._icon && this.updateIconSlot();
|
|
46
|
+
}
|
|
47
|
+
/*
|
|
48
|
+
Körs efter varje uppdatering.
|
|
49
|
+
- Hanterar fallback aria-label för icon-only.
|
|
50
|
+
*/
|
|
51
|
+
updated() {
|
|
52
|
+
var t;
|
|
53
|
+
if (super.updated(), this.iconOnly && !this.hasAttribute("aria-label")) {
|
|
54
|
+
const e = ((t = this.textContent) == null ? void 0 : t.trim()) ?? "";
|
|
55
|
+
e && this.setAttribute("aria-label", e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Lazy import av md-icon – laddas EN gång globalt
|
|
59
|
+
async ensureMdIconLoaded() {
|
|
60
|
+
const t = globalThis;
|
|
61
|
+
t.__mdIconLoaded || (await import("@material/web/icon/icon.js"), t.__mdIconLoaded = !0);
|
|
62
|
+
}
|
|
63
|
+
async updateIconSlot() {
|
|
64
|
+
const t = this.querySelector('md-icon[slot="icon"]');
|
|
65
|
+
if (!this._icon) {
|
|
66
|
+
t == null || t.remove();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (await this.ensureMdIconLoaded(), t)
|
|
70
|
+
t.textContent = this._icon;
|
|
71
|
+
else {
|
|
72
|
+
const e = document.createElement("md-icon");
|
|
73
|
+
e.setAttribute("slot", "icon"), e.textContent = this._icon, this.appendChild(e);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
n.styles = [
|
|
78
|
+
...l.styles,
|
|
79
|
+
p`
|
|
80
|
+
/* Icon-only: göm all text utom slot="icon" */
|
|
81
|
+
:host([icon-only]) slot:not([name='icon']) {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
`
|
|
85
|
+
];
|
|
86
|
+
a([
|
|
87
|
+
d({ type: String })
|
|
88
|
+
], n.prototype, "icon", 1);
|
|
89
|
+
a([
|
|
90
|
+
d({ type: Boolean, reflect: !0, attribute: "icon-only" })
|
|
91
|
+
], n.prototype, "iconOnly", 2);
|
|
92
|
+
n = a([
|
|
93
|
+
h("scb-secondary-tab")
|
|
94
|
+
], n);
|
|
95
|
+
export {
|
|
96
|
+
n as ScbSecondaryTab
|
|
97
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MdTabs } from '@material/web/tabs/tabs.js';
|
|
2
|
+
|
|
3
|
+
export declare class ScbTabs extends MdTabs {
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
private _isDispatching;
|
|
6
|
+
static styles: import('lit').CSSResultOrNative[];
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
protected firstUpdated(changedProperties: Map<string, unknown>): void;
|
|
9
|
+
private _onChange;
|
|
10
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { MdTabs as l } from "@material/web/tabs/tabs.js";
|
|
2
|
+
import { property as d, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { css as p } from "lit";
|
|
4
|
+
import "./scb-primary-tab.js";
|
|
5
|
+
import "./scb-secondary-tab.js";
|
|
6
|
+
var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor, n = (r, t, s, e) => {
|
|
7
|
+
for (var a = e > 1 ? void 0 : e ? v(t, s) : t, i = r.length - 1, c; i >= 0; i--)
|
|
8
|
+
(c = r[i]) && (a = (e ? c(t, s, a) : c(a)) || a);
|
|
9
|
+
return e && a && b(t, s, a), a;
|
|
10
|
+
};
|
|
11
|
+
let o = class extends l {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.ariaLabel = "", this._isDispatching = !1, this._onChange = (r) => {
|
|
14
|
+
if (!r.composed && !this._isDispatching) {
|
|
15
|
+
r.stopPropagation(), this._isDispatching = !0;
|
|
16
|
+
const t = r.target.activeTabIndex;
|
|
17
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
18
|
+
detail: { activeTabIndex: t },
|
|
19
|
+
bubbles: !0,
|
|
20
|
+
composed: !0
|
|
21
|
+
})), this._isDispatching = !1;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
super.connectedCallback(), this.setAttribute("role", "tablist");
|
|
27
|
+
}
|
|
28
|
+
firstUpdated(r) {
|
|
29
|
+
super.firstUpdated(r), this.addEventListener("change", this._onChange);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
o.styles = [
|
|
33
|
+
...l.styles,
|
|
34
|
+
p`
|
|
35
|
+
:host {
|
|
36
|
+
/*Containerfärg */
|
|
37
|
+
--md-primary-tab-container-color: var(--md-sys-color-surface);
|
|
38
|
+
--md-secondary-tab-container-color: var(--md-sys-color-surface);
|
|
39
|
+
|
|
40
|
+
/* Text- och ikonfärger */
|
|
41
|
+
--md-primary-tab-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
42
|
+
--md-secondary-tab-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
43
|
+
--md-primary-tab-active-label-text-color: var(--md-sys-color-on-surface);
|
|
44
|
+
--md-secondary-tab-active-label-text-color: var(--md-sys-color-on-surface);
|
|
45
|
+
|
|
46
|
+
/* Indikator och divider */
|
|
47
|
+
--md-primary-tab-active-indicator-color: var(--md-sys-color-primary);
|
|
48
|
+
--md-primary-tab-divider-color: var(--md-sys-color-outline-variant);
|
|
49
|
+
--md-secondary-tab-divider-color: var(--md-sys-color-outline-variant);
|
|
50
|
+
|
|
51
|
+
/* State layers (hover/press) */
|
|
52
|
+
--md-primary-tab-hover-state-layer-color: var(--md-sys-color-on-surface);
|
|
53
|
+
--md-secondary-tab-hover-state-layer-color: var(--md-sys-color-on-surface);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
`
|
|
57
|
+
];
|
|
58
|
+
n([
|
|
59
|
+
d({ type: String, reflect: !0, attribute: "aria-label" })
|
|
60
|
+
], o.prototype, "ariaLabel", 2);
|
|
61
|
+
o = n([
|
|
62
|
+
m("scb-tabs")
|
|
63
|
+
], o);
|
|
64
|
+
export {
|
|
65
|
+
o as ScbTabs
|
|
66
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__scb_md_icon_loaded?: boolean;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class ScbTextField2 extends LitElement {
|
|
9
|
+
type: 'number' | 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'textarea' | 'color' | 'date' | 'datetime-local' | 'file' | 'month' | 'time' | 'week';
|
|
10
|
+
label: string;
|
|
11
|
+
supportingText: string;
|
|
12
|
+
errorText: string;
|
|
13
|
+
leadingIcon: string;
|
|
14
|
+
name: string;
|
|
15
|
+
pattern: string;
|
|
16
|
+
value: string;
|
|
17
|
+
underLabel: string;
|
|
18
|
+
error: boolean;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
required: boolean;
|
|
21
|
+
private _form;
|
|
22
|
+
private _formSubmitHandler;
|
|
23
|
+
private _formResetHandler;
|
|
24
|
+
private _initialValue;
|
|
25
|
+
private _inputId;
|
|
26
|
+
static styles: import('lit').CSSResult[];
|
|
27
|
+
render(): TemplateResult;
|
|
28
|
+
/**
|
|
29
|
+
Vi re-dispatchar inbyggda "input", "change" och "select" events med { bubbles: true, composed: true },
|
|
30
|
+
så att konsumenter kan lyssna på events direkt från <scb-text-field>. Vi kör också ett customevent onValueChanged.
|
|
31
|
+
*/
|
|
32
|
+
firstUpdated(changedProperties: Map<string, unknown>): void;
|
|
33
|
+
updated(changed: PropertyValues): void;
|
|
34
|
+
connectedCallback(): void;
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Kallar på reportValidity på den inbyggda input/textarea och sätter felstatus till error-text.
|
|
38
|
+
*/
|
|
39
|
+
reportValidity(): boolean;
|
|
40
|
+
private __ensureMdIconLoaded;
|
|
41
|
+
}
|