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
package/scb-logo.svg
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg viewBox="-0.0002 -0.0066 1344.9076 377.9532" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<defs>
|
|
4
|
+
<style type="text/css">
|
|
5
|
+
g {
|
|
6
|
+
fill: #100f0d;
|
|
7
|
+
}
|
|
8
|
+
g:target {
|
|
9
|
+
fill: #fff;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
12
|
+
</defs>
|
|
13
|
+
<g transform="matrix(1.3333330154418945, 0, 0, -1.3333330154418945, 0, 377.9466552734375)" id="g10">
|
|
14
|
+
<g transform="scale(0.1)" id="inverted">
|
|
15
|
+
<path id="path14" d="m 1346.6,2515.59 c 0,48.24 -39.11,87.31 -87.4,87.31 -48.29,0 -87.4,-39.07 -87.4,-87.31 V 312.898 c 0,-48.339 39.11,-87.5 87.4,-87.5 48.29,0 87.4,39.161 87.4,87.5 V 1106.8 c 0,5.77 4.79,10.45 10.51,10.45 h 287.22 c 5.76,0 10.5,-4.68 10.5,-10.45 V 305.969 C 1654.83,137.02 1477.67,0 1259.2,0 1040.63,0 863.523,137.02 863.523,305.969 V 2528.77 c 0,168.86 177.107,305.88 395.677,305.88 218.47,0 395.63,-137.02 395.63,-305.88 V 1738.1 c 0,-5.86 -4.74,-10.45 -10.5,-10.45 h -287.22 c -5.72,0 -10.51,4.59 -10.51,10.45 v 777.49"/>
|
|
16
|
+
<path id="path16" d="M 10.4414,2265.38 C -8.01563,2136.85 -1.52734,1926.1 26.1172,1807.73 56.4922,1678.71 231.645,1417.96 310.555,1296.86 389.566,1175.85 494.949,1049.49 493.375,880.922 V 477.18 c 0,-48.25 -39.109,-87.41 -87.406,-87.41 -48.145,0 -87.254,39.16 -87.254,87.41 v 618.79 c 0,5.76 -4.785,10.55 -10.645,10.55 H 20.9453 c -5.8711,0 -10.5039,-4.79 -10.5039,-10.55 V 458.719 c 0,-168.957 177.1056,-305.969 395.5276,-305.969 218.574,0 395.683,137.012 395.683,305.969 v 422.203 c -1.324,289.568 -80.332,331.748 -182.867,505.398 -73.445,124.71 -254.121,381.95 -284.398,510.97 -27.735,118.36 -26.516,255.39 -15.672,379.9 0,48.25 39.109,87.41 87.254,87.41 48.297,0 87.406,-39.16 87.406,-87.41 v -550.32 c 0,-5.77 4.746,-10.45 10.645,-10.45 h 287.085 c 5.911,0 10.547,4.68 10.547,10.45 v 538.51 c 0,169.06 -177.109,305.97 -395.683,305.97 -218.422,0 -395.5276,-136.91 -395.5276,-305.97"/>
|
|
17
|
+
<path id="path18" d="m 1726.57,2547.82 h 440.8 c 182.04,0 329.61,-147.57 329.61,-329.52 v -462.24 c 0,-129.59 -84.97,-238.98 -202.16,-276.48 v -6.24 c 117.19,-37.4 202.16,-146.89 202.16,-276.58 V 491.148 c 0,-160.367 -130.2,-290.457 -290.45,-290.457 l -479.96,-0.293 c -5.91,0 -10.6,4.793 -10.6,10.454 V 2537.37 c 0,5.66 4.69,10.45 10.6,10.45 m 308.27,-229.22 c -5.97,0 -10.65,-4.78 -10.65,-10.55 v -729.33 c 0,-5.97 4.68,-10.65 10.65,-10.65 h 43.36 c 58.01,0 105.08,47.16 105.08,105.18 v 540.18 c 0,58 -47.07,105.17 -105.08,105.17 z m 0,-982.29 c -5.97,0 -10.65,-4.69 -10.65,-10.45 V 430.59 c 0,-5.86 4.68,-10.649 10.65,-10.649 h 51.85 c 58.12,0 105.09,47.18 105.09,105.188 v 706.011 c 0,58.19 -46.97,105.17 -105.09,105.17 h -51.85"/>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
<text style="fill: rgb(1, 1, 1); font-family: Roboto; font-size: 139.2px; font-weight: 500; stroke: rgb(0, 0, 0); white-space: pre;" x="455.182" y="234.25">Designsystem</text>
|
|
21
|
+
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbMenuItem extends LitElement {
|
|
4
|
+
label: string;
|
|
5
|
+
hasSubMenu: boolean;
|
|
6
|
+
openLeft: boolean;
|
|
7
|
+
divider: boolean;
|
|
8
|
+
leadingIcon: string;
|
|
9
|
+
trailingIcon: string;
|
|
10
|
+
itemHref: string;
|
|
11
|
+
private static __iconLoaded;
|
|
12
|
+
private static __rippleLoaded;
|
|
13
|
+
protected firstUpdated(): Promise<void>;
|
|
14
|
+
static styles: import('lit').CSSResult;
|
|
15
|
+
updated(): void;
|
|
16
|
+
private handleClick;
|
|
17
|
+
render(): TemplateResult;
|
|
18
|
+
_navigateToHref(e: Event): void;
|
|
19
|
+
_toggleSubMenu(): void;
|
|
20
|
+
/** Trigger click handler on Enter/Space for accessibility */
|
|
21
|
+
private _onKeyDown;
|
|
22
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { css as h, LitElement as c, html as i } from "lit";
|
|
2
|
+
import { property as r, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import "../scb-divider/scb-divider.js";
|
|
4
|
+
var u = Object.defineProperty, f = Object.getOwnPropertyDescriptor, n = (e, s, l, a) => {
|
|
5
|
+
for (var o = a > 1 ? void 0 : a ? f(s, l) : s, p = e.length - 1, d; p >= 0; p--)
|
|
6
|
+
(d = e[p]) && (o = (a ? d(s, l, o) : d(o)) || o);
|
|
7
|
+
return a && o && u(s, l, o), o;
|
|
8
|
+
};
|
|
9
|
+
let t = class extends c {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.label = "", this.hasSubMenu = !1, this.openLeft = !1, this.divider = !1, this.leadingIcon = "", this.trailingIcon = "", this.itemHref = "", this.handleClick = (e) => {
|
|
12
|
+
this.itemHref ? this._navigateToHref(e) : this._toggleSubMenu();
|
|
13
|
+
}, this._onKeyDown = (e) => {
|
|
14
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.handleClick(e));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// Ladda in md-icon + md-ripple on-demand (första gången komponenten mountas)
|
|
18
|
+
async firstUpdated() {
|
|
19
|
+
t.__iconLoaded || (await import("@material/web/icon/icon.js"), t.__iconLoaded = !0), t.__rippleLoaded || (await import("@material/web/ripple/ripple.js"), t.__rippleLoaded = !0);
|
|
20
|
+
}
|
|
21
|
+
updated() {
|
|
22
|
+
const e = this.nextElementSibling;
|
|
23
|
+
this.hasSubMenu = !!(e && e.tagName === "SCB-SUB-MENU"), this.openLeft = !!(this.hasSubMenu && e && e.hasAttribute("open-left"));
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
return i`
|
|
27
|
+
${this.divider ? i`<scb-divider></scb-divider>` : ""}
|
|
28
|
+
<li @click=${this.handleClick} @keydown=${this._onKeyDown} role="menuitem" tabindex="0">
|
|
29
|
+
${this.itemHref ? i`<a href="${this.itemHref}" tabindex="-1">
|
|
30
|
+
${this.leadingIcon ? i`<md-icon>${this.leadingIcon}</md-icon>` : ""}
|
|
31
|
+
<div>${this.label}</div>
|
|
32
|
+
${this.trailingIcon ? i`<md-icon>${this.trailingIcon}</md-icon>` : ""}
|
|
33
|
+
<md-ripple></md-ripple>
|
|
34
|
+
</a>` : i`
|
|
35
|
+
${this.leadingIcon ? i`<md-icon>${this.leadingIcon}</md-icon>` : ""}
|
|
36
|
+
<div>${this.label}</div>
|
|
37
|
+
${this.trailingIcon ? i`<md-icon>${this.trailingIcon}</md-icon>` : ""}
|
|
38
|
+
<md-ripple></md-ripple>
|
|
39
|
+
`}
|
|
40
|
+
</li>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
_navigateToHref(e) {
|
|
44
|
+
this.itemHref && (window.location.href = this.itemHref), e.stopPropagation();
|
|
45
|
+
}
|
|
46
|
+
_toggleSubMenu() {
|
|
47
|
+
const e = this.nextElementSibling;
|
|
48
|
+
e && e.tagName === "SCB-SUB-MENU" && (e.hasAttribute("open") ? e.dispatchEvent(new CustomEvent("hide-submenu", { bubbles: !0, composed: !0 })) : e.dispatchEvent(new CustomEvent("show-submenu", { bubbles: !0, composed: !0 })));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
t.__iconLoaded = !1;
|
|
52
|
+
t.__rippleLoaded = !1;
|
|
53
|
+
t.styles = h`
|
|
54
|
+
:host { display: block; }
|
|
55
|
+
:host li{
|
|
56
|
+
position: relative;
|
|
57
|
+
list-style: none;
|
|
58
|
+
padding: 8px 16px;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
min-height: 56px;
|
|
61
|
+
font-size: 18px;
|
|
62
|
+
display: flex;
|
|
63
|
+
gap: 12px;
|
|
64
|
+
align-items: center;
|
|
65
|
+
max-width: 300px;
|
|
66
|
+
min-width: 112px;
|
|
67
|
+
}
|
|
68
|
+
:host li a {
|
|
69
|
+
display: flex;
|
|
70
|
+
gap: 12px;
|
|
71
|
+
align-items: center;
|
|
72
|
+
color: var(--md-sys-color-on-surface);
|
|
73
|
+
text-decoration: none;
|
|
74
|
+
}
|
|
75
|
+
li:hover md-ripple {
|
|
76
|
+
--md-ripple-hover-color: transparent;
|
|
77
|
+
--md-ripple-hover-opacity: 0;
|
|
78
|
+
}
|
|
79
|
+
li:hover { background: var(--md-sys-color-secondary-container, #D6F1FF); }
|
|
80
|
+
`;
|
|
81
|
+
n([
|
|
82
|
+
r({ type: String })
|
|
83
|
+
], t.prototype, "label", 2);
|
|
84
|
+
n([
|
|
85
|
+
r({ type: Boolean })
|
|
86
|
+
], t.prototype, "hasSubMenu", 2);
|
|
87
|
+
n([
|
|
88
|
+
r({ type: Boolean })
|
|
89
|
+
], t.prototype, "openLeft", 2);
|
|
90
|
+
n([
|
|
91
|
+
r({ type: Boolean })
|
|
92
|
+
], t.prototype, "divider", 2);
|
|
93
|
+
n([
|
|
94
|
+
r({ type: String, attribute: "leading-icon" })
|
|
95
|
+
], t.prototype, "leadingIcon", 2);
|
|
96
|
+
n([
|
|
97
|
+
r({ type: String, attribute: "trailing-icon" })
|
|
98
|
+
], t.prototype, "trailingIcon", 2);
|
|
99
|
+
n([
|
|
100
|
+
r({ type: String, attribute: "item-href" })
|
|
101
|
+
], t.prototype, "itemHref", 2);
|
|
102
|
+
t = n([
|
|
103
|
+
m("scb-menu-item")
|
|
104
|
+
], t);
|
|
105
|
+
export {
|
|
106
|
+
t as ScbMenuItem
|
|
107
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbMenu extends LitElement {
|
|
4
|
+
open: boolean;
|
|
5
|
+
__lastTriggerEl: HTMLElement | null;
|
|
6
|
+
static styles: import('lit').CSSResult;
|
|
7
|
+
render(): TemplateResult;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
/** Sätt endast state; side effects (overlay, fokus, events mm) hanteras i `updated()`. */
|
|
11
|
+
private __setOpen;
|
|
12
|
+
private __getActionFromEvent;
|
|
13
|
+
private __onDocumentClick;
|
|
14
|
+
private __onDocumentKeydown;
|
|
15
|
+
/** Reagera på ändrat `open` oavsett om det kom från triggers eller från kod (menu.open = …). */
|
|
16
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
17
|
+
/** scroll lock, aria-uppdatering, fokusflytt och öppna/stäng-events. */
|
|
18
|
+
private __applyOpenSideEffects;
|
|
19
|
+
/** Sätt aria-expanded=true/false på alla kontroller som pekar på aktuell meny via id. */
|
|
20
|
+
private __updateTriggersExpanded;
|
|
21
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { css as c, LitElement as u, html as d } from "lit";
|
|
2
|
+
import { property as p, customElement as _ } from "lit/decorators.js";
|
|
3
|
+
import "./scb-menu-item.js";
|
|
4
|
+
import "./scb-sub-menu.js";
|
|
5
|
+
var h = Object.defineProperty, f = Object.getOwnPropertyDescriptor, l = (e, t, n, o) => {
|
|
6
|
+
for (var s = o > 1 ? void 0 : o ? f(t, n) : t, i = e.length - 1, a; i >= 0; i--)
|
|
7
|
+
(a = e[i]) && (s = (o ? a(t, n, s) : a(s)) || s);
|
|
8
|
+
return o && s && h(t, n, s), s;
|
|
9
|
+
};
|
|
10
|
+
let r = class extends u {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.open = !1, this.__lastTriggerEl = null, this.__onDocumentClick = (e) => {
|
|
13
|
+
const t = this.__getActionFromEvent(e);
|
|
14
|
+
if (t) {
|
|
15
|
+
t === "open" && this.__setOpen(!0), t === "close" && this.__setOpen(!1), t === "toggle" && this.__setOpen(!this.open), e.stopPropagation();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}, this.__onDocumentKeydown = (e) => {
|
|
19
|
+
if (this.open && e.key === "Escape") {
|
|
20
|
+
this.__setOpen(!1);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
return d`
|
|
27
|
+
<div style="display:${this.open ? "block" : "none"};">
|
|
28
|
+
<slot></slot>
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback(), document.addEventListener("click", this.__onDocumentClick, !1), document.addEventListener("keydown", this.__onDocumentKeydown, !0);
|
|
34
|
+
}
|
|
35
|
+
disconnectedCallback() {
|
|
36
|
+
document.removeEventListener("click", this.__onDocumentClick, !1), document.removeEventListener("keydown", this.__onDocumentKeydown, !0), super.disconnectedCallback();
|
|
37
|
+
}
|
|
38
|
+
/** Sätt endast state; side effects (overlay, fokus, events mm) hanteras i `updated()`. */
|
|
39
|
+
__setOpen(e) {
|
|
40
|
+
this.open = e;
|
|
41
|
+
}
|
|
42
|
+
// Kolla trigger via composedPath() (fungerar i shadow DOM)
|
|
43
|
+
__getActionFromEvent(e) {
|
|
44
|
+
if (!this.id) return null;
|
|
45
|
+
const t = e.composedPath();
|
|
46
|
+
for (const n of t)
|
|
47
|
+
if (n instanceof Element) {
|
|
48
|
+
if (n.getAttribute("data-menu-open") === this.id)
|
|
49
|
+
return this.__lastTriggerEl = n, "open";
|
|
50
|
+
if (n.getAttribute("data-menu-close") === this.id)
|
|
51
|
+
return this.__lastTriggerEl = n, "close";
|
|
52
|
+
if (n.getAttribute("data-menu-toggle") === this.id)
|
|
53
|
+
return this.__lastTriggerEl = n, "toggle";
|
|
54
|
+
if (n.getAttribute("aria-controls") === this.id)
|
|
55
|
+
return this.__lastTriggerEl = n, "toggle";
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
/** Reagera på ändrat `open` oavsett om det kom från triggers eller från kod (menu.open = …). */
|
|
60
|
+
updated(e) {
|
|
61
|
+
e.has("open") && this.__applyOpenSideEffects();
|
|
62
|
+
}
|
|
63
|
+
/** scroll lock, aria-uppdatering, fokusflytt och öppna/stäng-events. */
|
|
64
|
+
__applyOpenSideEffects() {
|
|
65
|
+
this.__updateTriggersExpanded();
|
|
66
|
+
}
|
|
67
|
+
/** Sätt aria-expanded=true/false på alla kontroller som pekar på aktuell meny via id. */
|
|
68
|
+
__updateTriggersExpanded() {
|
|
69
|
+
if (!this.id) return;
|
|
70
|
+
document.querySelectorAll(
|
|
71
|
+
`[aria-controls="${this.id}"], [data-menu-open="${this.id}"], [data-menu-close="${this.id}"], [data-menu-toggle="${this.id}"]`
|
|
72
|
+
).forEach((t) => {
|
|
73
|
+
t.hasAttribute("aria-controls") && t.setAttribute("aria-expanded", String(this.open));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
r.styles = c`
|
|
78
|
+
:host {
|
|
79
|
+
position: absolute;
|
|
80
|
+
display: block;
|
|
81
|
+
color: var(--md-sys-color-on-surface);
|
|
82
|
+
border-radius: var(--Radius-Extra-small, 4px);
|
|
83
|
+
background: var(--md-sys-color-surface, #FFF);
|
|
84
|
+
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.20), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 4px 5px 0 rgba(0, 0, 0, 0.14);
|
|
85
|
+
}
|
|
86
|
+
:host div {
|
|
87
|
+
background: var(--md-sys-color-surface, #FFF);
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
l([
|
|
91
|
+
p({ type: Boolean, reflect: !0 })
|
|
92
|
+
], r.prototype, "open", 2);
|
|
93
|
+
r = l([
|
|
94
|
+
_("scb-menu")
|
|
95
|
+
], r);
|
|
96
|
+
export {
|
|
97
|
+
r as ScbMenu
|
|
98
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbSubMenu extends LitElement {
|
|
4
|
+
open: boolean;
|
|
5
|
+
static styles: import('lit').CSSResult;
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
disconnectedCallback(): void;
|
|
8
|
+
_show: () => void;
|
|
9
|
+
_hide: (e?: Event) => void;
|
|
10
|
+
firstUpdated(): void;
|
|
11
|
+
render(): TemplateResult;
|
|
12
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { css as u, LitElement as a, html as h } from "lit";
|
|
2
|
+
import { property as b, customElement as d } from "lit/decorators.js";
|
|
3
|
+
var c = Object.defineProperty, m = Object.getOwnPropertyDescriptor, l = (t, e, r, o) => {
|
|
4
|
+
for (var s = o > 1 ? void 0 : o ? m(e, r) : e, i = t.length - 1, p; i >= 0; i--)
|
|
5
|
+
(p = t[i]) && (s = (o ? p(e, r, s) : p(s)) || s);
|
|
6
|
+
return o && s && c(e, r, s), s;
|
|
7
|
+
};
|
|
8
|
+
let n = class extends a {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.open = !1, this._show = () => {
|
|
11
|
+
this.setAttribute("open", ""), this.open = !0;
|
|
12
|
+
}, this._hide = (t) => {
|
|
13
|
+
this.removeAttribute("open"), this.open = !1, t && t.stopPropagation();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
super.connectedCallback(), this.addEventListener("show-submenu", this._show), this.addEventListener("hide-submenu", this._hide);
|
|
18
|
+
}
|
|
19
|
+
disconnectedCallback() {
|
|
20
|
+
this.removeEventListener("show-submenu", this._show), this.removeEventListener("hide-submenu", this._hide), super.disconnectedCallback();
|
|
21
|
+
}
|
|
22
|
+
firstUpdated() {
|
|
23
|
+
let t = 0, e = this.parentElement;
|
|
24
|
+
for (; e; )
|
|
25
|
+
e.tagName === "SCB-SUB-MENU" && t++, e = e.parentElement;
|
|
26
|
+
t % 2 === 1 ? this.setAttribute("open-left", "") : this.removeAttribute("open-left");
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
return h`
|
|
30
|
+
<div class="submenu${this.open ? " open" : ""}">
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
n.styles = u`
|
|
37
|
+
:host {
|
|
38
|
+
display: block;
|
|
39
|
+
position: relative;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
.submenu {
|
|
43
|
+
display: none;
|
|
44
|
+
position: absolute;
|
|
45
|
+
left: 100%;
|
|
46
|
+
top: -44px;
|
|
47
|
+
z-index: 100;
|
|
48
|
+
border-radius: var(--Radius-Extra-small, 4px);
|
|
49
|
+
background: var(--md-sys-color-surface, #FFF);
|
|
50
|
+
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.20), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 4px 5px 0 rgba(0, 0, 0, 0.14);
|
|
51
|
+
}
|
|
52
|
+
:host([open-left]) .submenu {
|
|
53
|
+
left: auto;
|
|
54
|
+
right: 100%;
|
|
55
|
+
}
|
|
56
|
+
:host([open]) .submenu,
|
|
57
|
+
.submenu.open {
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
l([
|
|
62
|
+
b({ type: Boolean, reflect: !0 })
|
|
63
|
+
], n.prototype, "open", 2);
|
|
64
|
+
n = l([
|
|
65
|
+
d("scb-sub-menu")
|
|
66
|
+
], n);
|
|
67
|
+
export {
|
|
68
|
+
n as ScbSubMenu
|
|
69
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbNotification extends LitElement {
|
|
4
|
+
open: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
type: string;
|
|
7
|
+
linkText: string;
|
|
8
|
+
linkhref: string;
|
|
9
|
+
showIcon: boolean;
|
|
10
|
+
showCloseButton: boolean;
|
|
11
|
+
static styles: import('lit').CSSResult[];
|
|
12
|
+
/** Return icon name for notification type */
|
|
13
|
+
private _iconForType;
|
|
14
|
+
private _closeNotification;
|
|
15
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { css as h, LitElement as f, html as n } from "lit";
|
|
2
|
+
import { property as i, customElement as d } from "lit/decorators.js";
|
|
3
|
+
import "../scb-icon-button/scb-icon-button.js";
|
|
4
|
+
import "@material/web/icon/icon.js";
|
|
5
|
+
var x = Object.defineProperty, u = Object.getOwnPropertyDescriptor, o = (r, s, a, c) => {
|
|
6
|
+
for (var e = c > 1 ? void 0 : c ? u(s, a) : s, l = r.length - 1, p; l >= 0; l--)
|
|
7
|
+
(p = r[l]) && (e = (c ? p(s, a, e) : p(e)) || e);
|
|
8
|
+
return c && e && x(s, a, e), e;
|
|
9
|
+
};
|
|
10
|
+
let t = class extends f {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.open = !1, this.label = "", this.type = "success", this.linkText = "", this.linkhref = "#", this.showIcon = !1, this.showCloseButton = !1, this._closeNotification = () => {
|
|
13
|
+
this.open = !1;
|
|
14
|
+
const r = new CustomEvent("close", {
|
|
15
|
+
detail: { open: this.open }
|
|
16
|
+
});
|
|
17
|
+
this.dispatchEvent(r);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Return icon name for notification type */
|
|
21
|
+
_iconForType() {
|
|
22
|
+
switch (this.type) {
|
|
23
|
+
case "success":
|
|
24
|
+
return "check_circle";
|
|
25
|
+
case "error":
|
|
26
|
+
return "error";
|
|
27
|
+
case "warning":
|
|
28
|
+
return "warning";
|
|
29
|
+
case "info":
|
|
30
|
+
return "info";
|
|
31
|
+
default:
|
|
32
|
+
return "info";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return n`
|
|
37
|
+
<div class="notification" type=${this.type} role="alert" aria-live="assertive" aria-atomic="true" style="display: ${this.open ? "flex" : "none"};">
|
|
38
|
+
${this.showIcon || this.showCloseButton ? n`<div class="notification-header">
|
|
39
|
+
${this.showIcon ? n`<md-icon>${this._iconForType()}</md-icon>` : ""}
|
|
40
|
+
${this.showCloseButton ? n`<scb-icon-button icon="close" @click=${this._closeNotification}></scb-icon-button>` : ""}
|
|
41
|
+
</div>` : ""}
|
|
42
|
+
<div class="notification-content">
|
|
43
|
+
${this.label ? n`<div class="notification-label">${this.label}</div>` : ""}
|
|
44
|
+
<slot></slot>
|
|
45
|
+
${this.linkText ? n`
|
|
46
|
+
<div class="notification-footer">
|
|
47
|
+
<a class="footer-link" href="${this.linkhref}">${this.linkText}</a>
|
|
48
|
+
</div>
|
|
49
|
+
` : ""}
|
|
50
|
+
<div>
|
|
51
|
+
</div>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
t.styles = [
|
|
56
|
+
h`
|
|
57
|
+
:host {
|
|
58
|
+
display: block;
|
|
59
|
+
position: relative;
|
|
60
|
+
container-type: inline-size;
|
|
61
|
+
container-name: notification-container;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.notification {
|
|
65
|
+
border-radius: 12px;
|
|
66
|
+
padding: 16px;
|
|
67
|
+
display: flex;
|
|
68
|
+
gap: 12px;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
@container notification-container (min-width: 400px) {
|
|
73
|
+
.notification {
|
|
74
|
+
flex-direction: row;
|
|
75
|
+
}
|
|
76
|
+
.notification-label {
|
|
77
|
+
margin-right: 40px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
.notification-label {
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
font-size: 20px;
|
|
83
|
+
line-height: 28px; /* 140% */
|
|
84
|
+
letter-spacing: -0.4px;
|
|
85
|
+
}
|
|
86
|
+
.notification[type="success"] {
|
|
87
|
+
background: var(--md-sys-color-success-container);
|
|
88
|
+
color: var(--md-sys-color-on-success-container);
|
|
89
|
+
|
|
90
|
+
a{
|
|
91
|
+
text-decoration: underline;
|
|
92
|
+
text-decoration-thickness: 1px;
|
|
93
|
+
text-underline-offset: .1578em;
|
|
94
|
+
color: var(--md-sys-color-on-success-container);
|
|
95
|
+
&:hover {text-decoration-thickness: 2px;}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
.notification[type="error"] {
|
|
99
|
+
background: var(--md-sys-color-error-container);
|
|
100
|
+
color: var(--md-sys-color-on-error-container);
|
|
101
|
+
a{
|
|
102
|
+
text-decoration: underline;
|
|
103
|
+
text-decoration-thickness: 1px;
|
|
104
|
+
text-underline-offset: .1578em;
|
|
105
|
+
color: var(--md-sys-color-on-error-container);
|
|
106
|
+
&:hover {text-decoration-thickness: 2px;}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
.notification[type="warning"] {
|
|
110
|
+
background: var(--md-sys-color-warning-container);
|
|
111
|
+
color: var(--md-sys-color-on-warning-container);
|
|
112
|
+
a{
|
|
113
|
+
text-decoration: underline;
|
|
114
|
+
text-decoration-thickness: 1px;
|
|
115
|
+
text-underline-offset: .1578em;
|
|
116
|
+
color: var(--md-sys-color-on-warning-container);
|
|
117
|
+
&:hover {text-decoration-thickness: 2px;}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
.notification[type="info"] {
|
|
121
|
+
background: var(--md-sys-color-info-container);
|
|
122
|
+
color: var(--md-sys-color-on-info-container);
|
|
123
|
+
a{
|
|
124
|
+
text-decoration: underline;
|
|
125
|
+
text-decoration-thickness: 1px;
|
|
126
|
+
text-underline-offset: .1578em;
|
|
127
|
+
color: var(--md-sys-color-on-info-container);
|
|
128
|
+
&:hover {text-decoration-thickness: 2px;}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
.notification-header scb-icon-button {
|
|
132
|
+
position: absolute;
|
|
133
|
+
right: 8px;
|
|
134
|
+
top: 8px;
|
|
135
|
+
}
|
|
136
|
+
.notification-content{
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: 4px;
|
|
140
|
+
}
|
|
141
|
+
slot{
|
|
142
|
+
font-size: 18px;
|
|
143
|
+
line-height: 26px;
|
|
144
|
+
}
|
|
145
|
+
.notification-footer {
|
|
146
|
+
font-size: 18px;
|
|
147
|
+
margin-top: 4px;
|
|
148
|
+
line-height: 26px; /* 133% */
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host([open]) .notification {
|
|
152
|
+
opacity: 1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:host(:not([open])) .notification {
|
|
156
|
+
opacity: 0;
|
|
157
|
+
pointer-events: none;
|
|
158
|
+
}
|
|
159
|
+
`
|
|
160
|
+
];
|
|
161
|
+
o([
|
|
162
|
+
i({ type: Boolean, reflect: !0 })
|
|
163
|
+
], t.prototype, "open", 2);
|
|
164
|
+
o([
|
|
165
|
+
i({ type: String })
|
|
166
|
+
], t.prototype, "label", 2);
|
|
167
|
+
o([
|
|
168
|
+
i({ type: String })
|
|
169
|
+
], t.prototype, "type", 2);
|
|
170
|
+
o([
|
|
171
|
+
i({ type: String, attribute: "link-text" })
|
|
172
|
+
], t.prototype, "linkText", 2);
|
|
173
|
+
o([
|
|
174
|
+
i({ type: String, attribute: "link-href" })
|
|
175
|
+
], t.prototype, "linkhref", 2);
|
|
176
|
+
o([
|
|
177
|
+
i({ type: Boolean, attribute: "show-icon" })
|
|
178
|
+
], t.prototype, "showIcon", 2);
|
|
179
|
+
o([
|
|
180
|
+
i({ type: Boolean, attribute: "show-close-button" })
|
|
181
|
+
], t.prototype, "showCloseButton", 2);
|
|
182
|
+
t = o([
|
|
183
|
+
d("scb-notification")
|
|
184
|
+
], t);
|
|
185
|
+
export {
|
|
186
|
+
t as ScbNotification
|
|
187
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbProgressIndicator extends LitElement {
|
|
4
|
+
label: string;
|
|
5
|
+
type: 'circular' | 'linear';
|
|
6
|
+
color: string;
|
|
7
|
+
progress: number;
|
|
8
|
+
isStatic: boolean;
|
|
9
|
+
static styles: import('lit').CSSResult[];
|
|
10
|
+
render(): TemplateResult;
|
|
11
|
+
}
|