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,343 @@
|
|
|
1
|
+
import { css as h, LitElement as g, nothing as p, html as l } from "lit";
|
|
2
|
+
import { property as o, customElement as v } from "lit/decorators.js";
|
|
3
|
+
var u = Object.defineProperty, m = Object.getOwnPropertyDescriptor, r = (t, a, s, i) => {
|
|
4
|
+
for (var n = i > 1 ? void 0 : i ? m(a, s) : a, d = t.length - 1, c; d >= 0; d--)
|
|
5
|
+
(c = t[d]) && (n = (i ? c(a, s, n) : c(n)) || n);
|
|
6
|
+
return i && n && u(a, s, n), n;
|
|
7
|
+
};
|
|
8
|
+
let e = class extends g {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.expanded = !1, this.label = "", this.content = "", this.overline = "", this.supportingText = "", this.leading = !1, this.leadingVariant = "", this.leadingIcon = "", this.imgHrefImage = "https://www.scb.se/img/scb-logo.svg", this.avatarLabel = "", this.avatarAlt = "", this.avatarVariant = "icon", this.avatarSrc = "", this.density = 0, this._unique = e._uid(), this.toggleAccordion = () => {
|
|
11
|
+
const t = this.closest("scb-accordion");
|
|
12
|
+
t != null && t.hasAttribute("detached") || t.querySelectorAll("scb-accordion-item").forEach((s) => {
|
|
13
|
+
s !== this && (s.expanded = !1, s._applyInert(), s._setBottomMaxHeight(s));
|
|
14
|
+
}), this.expanded = !this.expanded, this._applyInert(), this._setBottomMaxHeight(this);
|
|
15
|
+
}, this._onSlotChange = () => {
|
|
16
|
+
this.expanded && this._setBottomMaxHeight(this);
|
|
17
|
+
}, this._onContentLoad = () => {
|
|
18
|
+
this.expanded && this._setBottomMaxHeight(this);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
static _uid() {
|
|
22
|
+
var t, a;
|
|
23
|
+
return ((a = (t = globalThis.crypto) == null ? void 0 : t.randomUUID) == null ? void 0 : a.call(t)) ?? `${e._uidPrefix}-${++e._uidSeq}`;
|
|
24
|
+
}
|
|
25
|
+
async firstUpdated() {
|
|
26
|
+
var t;
|
|
27
|
+
e._mdIconLoaded || (await import("@material/web/icon/icon.js"), e._mdIconLoaded = !0), e._mdRippleLoaded || (await import("@material/web/ripple/ripple.js"), e._mdRippleLoaded = !0), this._applyInert(), (t = this._bottomEl()) == null || t.addEventListener("load", this._onContentLoad, !0);
|
|
28
|
+
}
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
var t;
|
|
31
|
+
(t = this._bottomEl()) == null || t.removeEventListener("load", this._onContentLoad, !0), super.disconnectedCallback();
|
|
32
|
+
}
|
|
33
|
+
// Animerar max-height vid öppning/stängning för snygg transition
|
|
34
|
+
_setBottomMaxHeight(t) {
|
|
35
|
+
const a = t._bottomEl();
|
|
36
|
+
a && (t.expanded ? (a.style.maxHeight = `${a.scrollHeight}px`, setTimeout(() => a.style.maxHeight = "unset", 160)) : (a.style.maxHeight = `${a.scrollHeight}px`, requestAnimationFrame(() => a.style.maxHeight = "0")));
|
|
37
|
+
}
|
|
38
|
+
/*
|
|
39
|
+
Tangentbordsnavigering:
|
|
40
|
+
enter/space togglar,
|
|
41
|
+
Arrowup/down flyttar fokus,
|
|
42
|
+
home/end hoppar till första/sista item.
|
|
43
|
+
*/
|
|
44
|
+
_onKeyDown(t) {
|
|
45
|
+
const a = this.closest("scb-accordion"), i = Array.from((a == null ? void 0 : a.querySelectorAll("scb-accordion-item")) || []).map((c) => c.renderRoot.querySelector(".scb-accordion-top")).filter((c) => !!c), n = t.currentTarget, d = i.indexOf(n);
|
|
46
|
+
switch (t.key) {
|
|
47
|
+
case "Enter":
|
|
48
|
+
case " ":
|
|
49
|
+
t.preventDefault(), this.toggleAccordion();
|
|
50
|
+
break;
|
|
51
|
+
case "ArrowDown":
|
|
52
|
+
t.preventDefault(), d < i.length - 1 && i[d + 1].focus();
|
|
53
|
+
break;
|
|
54
|
+
case "ArrowUp":
|
|
55
|
+
t.preventDefault(), d > 0 && i[d - 1].focus();
|
|
56
|
+
break;
|
|
57
|
+
case "Home":
|
|
58
|
+
t.preventDefault(), i.length && i[0].focus();
|
|
59
|
+
break;
|
|
60
|
+
case "End":
|
|
61
|
+
t.preventDefault(), i.length && i[i.length - 1].focus();
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Leading-template (ikon/avatar/bild)
|
|
66
|
+
_renderLeading() {
|
|
67
|
+
if (!this.leading) return p;
|
|
68
|
+
switch (this.leadingVariant) {
|
|
69
|
+
case "icon":
|
|
70
|
+
return l`<md-icon>${this.leadingIcon}</md-icon>`;
|
|
71
|
+
case "avatar":
|
|
72
|
+
return l`
|
|
73
|
+
<scb-avatar
|
|
74
|
+
label=${this.avatarLabel}
|
|
75
|
+
alt=${this.avatarAlt}
|
|
76
|
+
src=${this.avatarVariant === "image" ? this.avatarSrc : ""}
|
|
77
|
+
size="medium"
|
|
78
|
+
shape="circular"
|
|
79
|
+
variant=${this.avatarVariant}
|
|
80
|
+
></scb-avatar>
|
|
81
|
+
`;
|
|
82
|
+
case "image":
|
|
83
|
+
return l`<img part="leading-image" class="img" src="${this.imgHrefImage}" alt="" />`;
|
|
84
|
+
default:
|
|
85
|
+
return p;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Panel-elementet
|
|
89
|
+
_bottomEl() {
|
|
90
|
+
return this.renderRoot.querySelector(".scb-accordion-bottom");
|
|
91
|
+
}
|
|
92
|
+
// Håll tabb-ordningen korrekt med inert och aria-hidden
|
|
93
|
+
_applyInert() {
|
|
94
|
+
const t = this._bottomEl();
|
|
95
|
+
t && (this.expanded ? (t.removeAttribute("inert"), t.setAttribute("aria-hidden", "false")) : (t.setAttribute("inert", ""), t.setAttribute("aria-hidden", "true")));
|
|
96
|
+
}
|
|
97
|
+
updated(t) {
|
|
98
|
+
t.has("expanded") && (this._applyInert(), this._setBottomMaxHeight(this));
|
|
99
|
+
}
|
|
100
|
+
// Renderar struktur med korrekt aria-controls kopplat till botten-delen
|
|
101
|
+
render() {
|
|
102
|
+
const t = `bottom-${this._unique}`, a = `header-${this._unique}`, s = !!this.overline, i = !!this.supportingText;
|
|
103
|
+
return l`
|
|
104
|
+
<div part="scb-accordion-item" class="scb-accordion-item">
|
|
105
|
+
<div
|
|
106
|
+
id=${a}
|
|
107
|
+
class="scb-accordion-top"
|
|
108
|
+
tabindex="0"
|
|
109
|
+
role="button"
|
|
110
|
+
aria-expanded=${this.expanded}
|
|
111
|
+
aria-controls=${t}
|
|
112
|
+
@click=${this.toggleAccordion}
|
|
113
|
+
@keydown=${this._onKeyDown}
|
|
114
|
+
>
|
|
115
|
+
<!-- Ripple för press/hover/focus state-layer -->
|
|
116
|
+
<md-ripple></md-ripple>
|
|
117
|
+
|
|
118
|
+
${this.leading ? l`<div class="leading">${this._renderLeading()}</div>` : p}
|
|
119
|
+
|
|
120
|
+
<div class="texts">
|
|
121
|
+
${s ? l`<div class="overline">${this.overline}</div>` : p}
|
|
122
|
+
<div class="label">${this.label}</div>
|
|
123
|
+
${i ? l`<div class="supporting-text">${this.supportingText}</div>` : p}
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<md-icon class="chevron">
|
|
127
|
+
${this.expanded ? "keyboard_arrow_up" : "keyboard_arrow_down"}
|
|
128
|
+
</md-icon>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div
|
|
132
|
+
id=${t}
|
|
133
|
+
class="scb-accordion-bottom ${this.expanded ? "expanded" : ""}"
|
|
134
|
+
role="region"
|
|
135
|
+
aria-labelledby=${a}
|
|
136
|
+
aria-hidden=${this.expanded ? "false" : "true"}
|
|
137
|
+
>
|
|
138
|
+
<slot @slotchange=${this._onSlotChange}>${this.content}</slot>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
e._uidPrefix = `uid-${Math.random().toString(36).slice(2)}`;
|
|
145
|
+
e._uidSeq = 0;
|
|
146
|
+
e._mdIconLoaded = !1;
|
|
147
|
+
e._mdRippleLoaded = !1;
|
|
148
|
+
e.styles = [
|
|
149
|
+
h`
|
|
150
|
+
:host {
|
|
151
|
+
display: block;
|
|
152
|
+
--_focus-width: var(--md-focus-ring-width, var(--stroke-focus-ring, 2px));
|
|
153
|
+
--_focus-radius: var(--md-sys-shape-corner-small, var(--radius-s, 8px));
|
|
154
|
+
|
|
155
|
+
--scb-accordion-hover-radius: var(--radius-none, 0px);
|
|
156
|
+
--scb-accordion-chevron-nudge-y: 3px;
|
|
157
|
+
--scb-accordion-transition-duration: 150ms;
|
|
158
|
+
--scb-accordion-transition-easing: cubic-bezier(.69,.16,.2,.98);
|
|
159
|
+
--scb-accordion-panel-padding-closed: var(--spacing-0, 0px);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.scb-accordion-item{
|
|
163
|
+
border-bottom: var(--stroke-border, 1px) solid var(--md-sys-color-outline-variant);
|
|
164
|
+
margin-bottom: calc(var(--stroke-border, 1px) * -1);
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
color: var(--md-sys-color-on-surface);
|
|
168
|
+
font-family: var(--brand-font);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.scb-accordion-top {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-direction: row;
|
|
174
|
+
align-items: center;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
/* default density 0: 24px över/under, 16px i sidled */
|
|
177
|
+
padding-block: var(--spacing-7, 24px);
|
|
178
|
+
padding-inline: var(--spacing-5, 16px);
|
|
179
|
+
outline: none;
|
|
180
|
+
/* för att undvika rundade hörn på hover */
|
|
181
|
+
border-radius: var(--radius-none, 0px);
|
|
182
|
+
gap: var(--spacing-5, 16px);
|
|
183
|
+
color: var(--md-sys-color-on-surface);
|
|
184
|
+
/* För ripple */
|
|
185
|
+
position: relative;
|
|
186
|
+
overflow: hidden;
|
|
187
|
+
-webkit-tap-highlight-color: transparent;
|
|
188
|
+
}
|
|
189
|
+
.scb-accordion-top:hover {
|
|
190
|
+
/* Inga runda hörn på hover */
|
|
191
|
+
border-radius: var(--scb-accordion-hover-radius);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.scb-accordion-top:focus-visible {
|
|
195
|
+
outline: var(--_focus-width) solid var(--md-focus-ring-color, var(--p-40));
|
|
196
|
+
outline-offset: var(--spacing-1, 2px);
|
|
197
|
+
/* Tillåt runda hörn endast vid fokusmarkering */
|
|
198
|
+
border-radius: var(--_focus-radius);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* Om både om hosten har data-density och om en förälder har det. */
|
|
202
|
+
:host([density="-2"]) .scb-accordion-top,
|
|
203
|
+
:host-context([data-density="-2"]) .scb-accordion-top {
|
|
204
|
+
padding-block: var(--spacing-5, 16px);
|
|
205
|
+
}
|
|
206
|
+
:host([density="-4"]) .scb-accordion-top,
|
|
207
|
+
:host-context([data-density="-4"]) .scb-accordion-top {
|
|
208
|
+
padding-block: var(--spacing-4, 12px);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.scb-accordion-bottom {
|
|
212
|
+
padding-block: var(--scb-accordion-panel-padding-closed);
|
|
213
|
+
padding-inline: var(--spacing-5, 16px);
|
|
214
|
+
max-height: 0;
|
|
215
|
+
overflow: hidden;
|
|
216
|
+
transition: var(--scb-accordion-transition-duration) var(--scb-accordion-transition-easing);
|
|
217
|
+
opacity: 0;
|
|
218
|
+
}
|
|
219
|
+
.scb-accordion-bottom.expanded {
|
|
220
|
+
opacity: 1;
|
|
221
|
+
padding-top: var(--spacing-2, 4px);
|
|
222
|
+
padding-right: var(--spacing-5, 16px);
|
|
223
|
+
padding-bottom: var(--spacing-5, 16px);
|
|
224
|
+
padding-left: var(--spacing-5, 16px);
|
|
225
|
+
max-height: 100%;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.label {
|
|
229
|
+
font-family: var(--brand-font);
|
|
230
|
+
font-size: var(--md-sys-typescale-title-large-size);
|
|
231
|
+
line-height: var(--md-sys-typescale-title-large-line-height);
|
|
232
|
+
font-weight: var(--weight-semibold);
|
|
233
|
+
letter-spacing: var(--md-sys-typescale-title-large-tracking);
|
|
234
|
+
color: var(--md-sys-color-on-surface);
|
|
235
|
+
}
|
|
236
|
+
.overline {
|
|
237
|
+
font-family: var(--brand-font);
|
|
238
|
+
font-size: var(--md-sys-typescale-label-medium-size);
|
|
239
|
+
line-height: var(--md-sys-typescale-label-medium-line-height);
|
|
240
|
+
font-weight: var(--weight-regular);
|
|
241
|
+
letter-spacing: var(--md-sys-typescale-label-medium-tracking);
|
|
242
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
243
|
+
}
|
|
244
|
+
.supporting-text {
|
|
245
|
+
font-family: var(--brand-font);
|
|
246
|
+
font-size: var(--md-sys-typescale-body-medium-size);
|
|
247
|
+
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
248
|
+
font-weight: var(--weight-regular);
|
|
249
|
+
letter-spacing: var(--md-sys-typescale-body-medium-tracking);
|
|
250
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.leading {
|
|
254
|
+
align-self: center;
|
|
255
|
+
display: grid;
|
|
256
|
+
place-items: center;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.avatar {
|
|
260
|
+
width: var(--icon-size-small, 24px);
|
|
261
|
+
height: var(--icon-size-small, 24px);
|
|
262
|
+
display: flex;
|
|
263
|
+
object-fit: contain;
|
|
264
|
+
}
|
|
265
|
+
.img {
|
|
266
|
+
width: calc(var(--icon-size-large, 40px) + var(--spacing-5, 16px));
|
|
267
|
+
height: calc(var(--icon-size-large, 40px) + var(--spacing-5, 16px));
|
|
268
|
+
object-fit: contain;
|
|
269
|
+
border-radius: var(--radius-s, 8px);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.texts {
|
|
273
|
+
display: grid;
|
|
274
|
+
gap: var(--spacing-1, 2px);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* chevron till höger */
|
|
278
|
+
.chevron {
|
|
279
|
+
margin-left: auto;
|
|
280
|
+
padding-top: var(--scb-accordion-chevron-nudge-y, 3px);
|
|
281
|
+
font-size: var(--icon-size-small, 24px);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* Ripple ska fylla den klickbara ytan och ärver ev. rundning vid fokus */
|
|
285
|
+
md-ripple {
|
|
286
|
+
border-radius: inherit;
|
|
287
|
+
inset: 0;
|
|
288
|
+
position: absolute;
|
|
289
|
+
pointer-events: none;
|
|
290
|
+
}
|
|
291
|
+
@media (prefers-reduced-motion: reduce) {
|
|
292
|
+
md-ripple { display: none; } /* endast fokusring visas */
|
|
293
|
+
}
|
|
294
|
+
`
|
|
295
|
+
];
|
|
296
|
+
r([
|
|
297
|
+
o({ type: Boolean })
|
|
298
|
+
], e.prototype, "expanded", 2);
|
|
299
|
+
r([
|
|
300
|
+
o({ type: String, reflect: !0 })
|
|
301
|
+
], e.prototype, "label", 2);
|
|
302
|
+
r([
|
|
303
|
+
o({ type: String })
|
|
304
|
+
], e.prototype, "content", 2);
|
|
305
|
+
r([
|
|
306
|
+
o({ type: String, attribute: "overline" })
|
|
307
|
+
], e.prototype, "overline", 2);
|
|
308
|
+
r([
|
|
309
|
+
o({ type: String, attribute: "supporting-text" })
|
|
310
|
+
], e.prototype, "supportingText", 2);
|
|
311
|
+
r([
|
|
312
|
+
o({ type: Boolean })
|
|
313
|
+
], e.prototype, "leading", 2);
|
|
314
|
+
r([
|
|
315
|
+
o({ type: String, attribute: "leading-variant", reflect: !0 })
|
|
316
|
+
], e.prototype, "leadingVariant", 2);
|
|
317
|
+
r([
|
|
318
|
+
o({ type: String, attribute: "leading-icon" })
|
|
319
|
+
], e.prototype, "leadingIcon", 2);
|
|
320
|
+
r([
|
|
321
|
+
o({ type: String, attribute: "img-href-image", reflect: !0 })
|
|
322
|
+
], e.prototype, "imgHrefImage", 2);
|
|
323
|
+
r([
|
|
324
|
+
o({ type: String, attribute: "avatar-label" })
|
|
325
|
+
], e.prototype, "avatarLabel", 2);
|
|
326
|
+
r([
|
|
327
|
+
o({ type: String, attribute: "avatar-alt" })
|
|
328
|
+
], e.prototype, "avatarAlt", 2);
|
|
329
|
+
r([
|
|
330
|
+
o({ type: String, attribute: "avatar-variant" })
|
|
331
|
+
], e.prototype, "avatarVariant", 2);
|
|
332
|
+
r([
|
|
333
|
+
o({ type: String, attribute: "avatar-src" })
|
|
334
|
+
], e.prototype, "avatarSrc", 2);
|
|
335
|
+
r([
|
|
336
|
+
o({ type: Number, reflect: !0 })
|
|
337
|
+
], e.prototype, "density", 2);
|
|
338
|
+
e = r([
|
|
339
|
+
v("scb-accordion-item")
|
|
340
|
+
], e);
|
|
341
|
+
export {
|
|
342
|
+
e as ScbAccordionItem
|
|
343
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LitElement as n, html as a } from "lit";
|
|
2
|
+
import { property as i, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import "./scb-accordion-item.js";
|
|
4
|
+
var f = Object.defineProperty, h = Object.getOwnPropertyDescriptor, d = (l, r, o, t) => {
|
|
5
|
+
for (var e = t > 1 ? void 0 : t ? h(r, o) : r, c = l.length - 1, s; c >= 0; c--)
|
|
6
|
+
(s = l[c]) && (e = (t ? s(r, o, e) : s(e)) || e);
|
|
7
|
+
return t && e && f(r, o, e), e;
|
|
8
|
+
};
|
|
9
|
+
let p = class extends n {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.detached = !1;
|
|
12
|
+
}
|
|
13
|
+
/*
|
|
14
|
+
Renderar containern och slottar in alla scb-accordion-item.
|
|
15
|
+
Sätter attributet `detached` på wrappern om relevant.
|
|
16
|
+
*/
|
|
17
|
+
render() {
|
|
18
|
+
return a`
|
|
19
|
+
<div class="scb-accordion" ?detached=${this.detached}>
|
|
20
|
+
<slot></slot>
|
|
21
|
+
</div>
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
d([
|
|
26
|
+
i({ type: Boolean, reflect: !0 })
|
|
27
|
+
], p.prototype, "detached", 2);
|
|
28
|
+
p = d([
|
|
29
|
+
m("scb-accordion")
|
|
30
|
+
], p);
|
|
31
|
+
export {
|
|
32
|
+
p as ScbAccordion
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbAppBar extends LitElement {
|
|
4
|
+
title: string;
|
|
5
|
+
type: 'default' | 'small-flexible' | 'search' | 'medium-flexible' | 'large-flexible';
|
|
6
|
+
position: string;
|
|
7
|
+
searchSupportingText: string;
|
|
8
|
+
static styles: import('lit').CSSResult[];
|
|
9
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { css as h, LitElement as c, html as i } from "lit";
|
|
2
|
+
import { property as s, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import "../scb-icon-button/scb-icon-button.js";
|
|
4
|
+
import "../scb-search/scb-search.js";
|
|
5
|
+
var g = Object.defineProperty, x = Object.getOwnPropertyDescriptor, a = (d, l, n, o) => {
|
|
6
|
+
for (var e = o > 1 ? void 0 : o ? x(l, n) : l, r = d.length - 1, p; r >= 0; r--)
|
|
7
|
+
(p = d[r]) && (e = (o ? p(l, n, e) : p(e)) || e);
|
|
8
|
+
return o && e && g(l, n, e), e;
|
|
9
|
+
};
|
|
10
|
+
let t = class extends c {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.title = "App title", this.type = "default", this.position = "default", this.searchSupportingText = "";
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
switch (this.type) {
|
|
16
|
+
case "small-flexible":
|
|
17
|
+
return i`
|
|
18
|
+
<header class="small-flexible ${this.position == "bottom" ? "position-bottom" : this.position == "top" ? "position-top" : ""}" role="banner" aria-label="Small app bar">
|
|
19
|
+
<div class="leading">
|
|
20
|
+
<slot name="leading"></slot>
|
|
21
|
+
</div>
|
|
22
|
+
<h1 class="headline">${this.title}</h1>
|
|
23
|
+
<div class="trailing">
|
|
24
|
+
<slot name="trailing"></slot>
|
|
25
|
+
</div>
|
|
26
|
+
</header>
|
|
27
|
+
`;
|
|
28
|
+
case "medium-flexible":
|
|
29
|
+
return i`
|
|
30
|
+
<header class="medium-flexible ${this.position == "bottom" ? "position-bottom" : this.position == "top" ? "position-top" : ""}" role="banner" aria-label="Medium flexible app bar">
|
|
31
|
+
<div class="action-elements">
|
|
32
|
+
<div>
|
|
33
|
+
<slot name="leading"></slot>
|
|
34
|
+
</div>
|
|
35
|
+
<div>
|
|
36
|
+
<slot name="trailing"></slot>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<h1 class="headline">${this.title}</h1>
|
|
40
|
+
</header>
|
|
41
|
+
`;
|
|
42
|
+
case "large-flexible":
|
|
43
|
+
return i`
|
|
44
|
+
<header class="large-flexible ${this.position == "bottom" ? "position-bottom" : this.position == "top" ? "position-top" : ""}" role="banner" aria-label="Large flexible app bar">
|
|
45
|
+
<div class="action-elements">
|
|
46
|
+
<div style="">
|
|
47
|
+
<slot name="leading"></slot>
|
|
48
|
+
</div>
|
|
49
|
+
<div style="">
|
|
50
|
+
<slot name="trailing"></slot>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<h1 class="headline">${this.title}</h1>
|
|
54
|
+
</header>
|
|
55
|
+
`;
|
|
56
|
+
case "search":
|
|
57
|
+
return i`
|
|
58
|
+
<header class="search ${this.position == "bottom" ? "position-bottom" : this.position == "top" ? "position-top" : ""}" role="banner" aria-label="Search app bar">
|
|
59
|
+
<div class="leading">
|
|
60
|
+
<slot name="leading"></slot>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="search-container">
|
|
63
|
+
<scb-search supporting-text=${this.searchSupportingText}></scb-search>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="trailing">
|
|
66
|
+
<slot name="trailing"></slot>
|
|
67
|
+
</div>
|
|
68
|
+
</header>
|
|
69
|
+
`;
|
|
70
|
+
default:
|
|
71
|
+
return i`
|
|
72
|
+
<header class="default ${this.position == "bottom" ? "position-bottom" : this.position == "top" ? "position-top" : ""}" role="banner" aria-label="Small app bar">
|
|
73
|
+
<div class="leading">
|
|
74
|
+
<slot name="leading"></slot>
|
|
75
|
+
</div>
|
|
76
|
+
<h1 class="headline">${this.title}</h1>
|
|
77
|
+
<div class="trailing">
|
|
78
|
+
<slot name="trailing"></slot>
|
|
79
|
+
</div>
|
|
80
|
+
</header>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
t.styles = [
|
|
86
|
+
h`
|
|
87
|
+
:host {
|
|
88
|
+
display: block;
|
|
89
|
+
position: relative;
|
|
90
|
+
container-type: inline-size;
|
|
91
|
+
container-name: app-bar-container;
|
|
92
|
+
}
|
|
93
|
+
header {
|
|
94
|
+
background: var(--md-sys-color-surface-container);
|
|
95
|
+
color: var(--md-sys-color-on-surface);
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
padding: 0 16px;
|
|
99
|
+
position: relative;
|
|
100
|
+
z-index: 10;
|
|
101
|
+
transition: height 0.3s;
|
|
102
|
+
min-height: 64px;
|
|
103
|
+
}
|
|
104
|
+
header.search {
|
|
105
|
+
height: 64px;
|
|
106
|
+
}
|
|
107
|
+
header.medium-flexible {
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
align-items: flex-start;
|
|
110
|
+
padding: 16px;
|
|
111
|
+
}
|
|
112
|
+
header.large-flexible {
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
align-items: flex-start;
|
|
115
|
+
padding: 16px;
|
|
116
|
+
}
|
|
117
|
+
header.position-top {
|
|
118
|
+
position: fixed;
|
|
119
|
+
top: 0;
|
|
120
|
+
left: 0;
|
|
121
|
+
right: 0;
|
|
122
|
+
z-index: 100;
|
|
123
|
+
}
|
|
124
|
+
header.position-bottom {
|
|
125
|
+
position: fixed;
|
|
126
|
+
bottom: 0;
|
|
127
|
+
left: 0;
|
|
128
|
+
right: 0;
|
|
129
|
+
z-index: 100;
|
|
130
|
+
}
|
|
131
|
+
.headline {
|
|
132
|
+
flex: 1 1 auto;
|
|
133
|
+
text-align: center;
|
|
134
|
+
font-size: 20px;
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
margin: 0;
|
|
137
|
+
}
|
|
138
|
+
header.small-flexible .headline {
|
|
139
|
+
text-align: left;
|
|
140
|
+
margin-left: 16px;
|
|
141
|
+
}
|
|
142
|
+
header.medium-flexible .headline {
|
|
143
|
+
font-size: 24px;
|
|
144
|
+
line-height: 30px;
|
|
145
|
+
font-weight: 700;
|
|
146
|
+
letter-spacing: -0.6px;
|
|
147
|
+
text-align: left;
|
|
148
|
+
margin: 8px 0 0 8px;
|
|
149
|
+
}
|
|
150
|
+
header.large-flexible .headline {
|
|
151
|
+
font-size: 28px;
|
|
152
|
+
font-weight: 700;
|
|
153
|
+
line-height: 34px;
|
|
154
|
+
letter-spacing: -0.6px;
|
|
155
|
+
text-align: left;
|
|
156
|
+
margin: 32px 0 0 8px;
|
|
157
|
+
}
|
|
158
|
+
.search-container {
|
|
159
|
+
flex: 1 1 auto;
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
padding: 0 8px;
|
|
164
|
+
}
|
|
165
|
+
.action-elements {
|
|
166
|
+
width: 100%;
|
|
167
|
+
display: flex;
|
|
168
|
+
flex-direction: row;
|
|
169
|
+
justify-content: space-between;
|
|
170
|
+
align-items: center;
|
|
171
|
+
margin-bottom: 8px;
|
|
172
|
+
}
|
|
173
|
+
`
|
|
174
|
+
];
|
|
175
|
+
a([
|
|
176
|
+
s({ type: String })
|
|
177
|
+
], t.prototype, "title", 2);
|
|
178
|
+
a([
|
|
179
|
+
s({ type: String })
|
|
180
|
+
], t.prototype, "type", 2);
|
|
181
|
+
a([
|
|
182
|
+
s({ type: String, reflect: !0 })
|
|
183
|
+
], t.prototype, "position", 2);
|
|
184
|
+
a([
|
|
185
|
+
s({ type: String, attribute: "search-supporting-text" })
|
|
186
|
+
], t.prototype, "searchSupportingText", 2);
|
|
187
|
+
t = a([
|
|
188
|
+
m("scb-app-bar")
|
|
189
|
+
], t);
|
|
190
|
+
export {
|
|
191
|
+
t as ScbAppBar
|
|
192
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
type AvatarSize = 'small' | 'medium' | 'large';
|
|
4
|
+
type AvatarShape = 'circular' | 'rounded' | 'square';
|
|
5
|
+
type AvatarVariant = 'image' | 'icon';
|
|
6
|
+
export declare class ScbAvatar extends LitElement {
|
|
7
|
+
src: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
label: string;
|
|
10
|
+
size: AvatarSize;
|
|
11
|
+
shape: AvatarShape;
|
|
12
|
+
iconName: string;
|
|
13
|
+
variant: AvatarVariant;
|
|
14
|
+
private _imgError;
|
|
15
|
+
private _hasIconSlot;
|
|
16
|
+
static styles: import('lit').CSSResult;
|
|
17
|
+
private _onImgLoad;
|
|
18
|
+
private _onImgError;
|
|
19
|
+
private _onIconSlotChange;
|
|
20
|
+
protected firstUpdated(): Promise<void>;
|
|
21
|
+
private _initials;
|
|
22
|
+
private _ariaLabel;
|
|
23
|
+
render(): TemplateResult;
|
|
24
|
+
}
|
|
25
|
+
declare global {
|
|
26
|
+
interface HTMLElementTagNameMap {
|
|
27
|
+
'scb-avatar': ScbAvatar;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export {};
|