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,169 @@
|
|
|
1
|
+
import { css as d, LitElement as g, nothing as c, html as a } from "lit";
|
|
2
|
+
import { property as l, state as m, customElement as v } from "lit/decorators.js";
|
|
3
|
+
var u = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, r = (i, t, o, s) => {
|
|
4
|
+
for (var n = s > 1 ? void 0 : s ? _(t, o) : t, h = i.length - 1, p; h >= 0; h--)
|
|
5
|
+
(p = i[h]) && (n = (s ? p(t, o, n) : p(n)) || n);
|
|
6
|
+
return s && n && u(t, o, n), n;
|
|
7
|
+
};
|
|
8
|
+
let e = class extends g {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.src = "", this.alt = "", this.label = "", this.size = "medium", this.shape = "circular", this.iconName = "", this.variant = "image", this._imgError = !1, this._hasIconSlot = !1, this._onImgLoad = () => {
|
|
11
|
+
this._imgError = !1, this.dispatchEvent(new CustomEvent("image-load", { bubbles: !0, composed: !0 }));
|
|
12
|
+
}, this._onImgError = () => {
|
|
13
|
+
this._imgError = !0, this.dispatchEvent(new CustomEvent("image-error", { bubbles: !0, composed: !0 }));
|
|
14
|
+
}, this._onIconSlotChange = (i) => {
|
|
15
|
+
const t = i.currentTarget;
|
|
16
|
+
this._hasIconSlot = (t.assignedNodes({ flatten: !0 }) || []).length > 0;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async firstUpdated() {
|
|
20
|
+
this.variant === "icon" && await import("@material/web/icon/icon.js");
|
|
21
|
+
}
|
|
22
|
+
_initials() {
|
|
23
|
+
const i = (this.label || this.alt || "").trim();
|
|
24
|
+
if (!i) return "?";
|
|
25
|
+
const t = i.split(/\s+/).filter(Boolean);
|
|
26
|
+
if (t.length === 1) return t[0].slice(0, 1).toUpperCase();
|
|
27
|
+
const o = t[0].slice(0, 1), s = t[t.length - 1].slice(0, 1);
|
|
28
|
+
return (o + s).toUpperCase();
|
|
29
|
+
}
|
|
30
|
+
_ariaLabel() {
|
|
31
|
+
const i = (this.label || this.alt || "").trim();
|
|
32
|
+
return i || null;
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
const i = this._ariaLabel(), t = this.variant === "image" && !!this.src && !this._imgError, o = a`${c}
|
|
36
|
+
<slot name="icon" @slotchange=${this._onIconSlotChange}></slot>
|
|
37
|
+
${this._hasIconSlot ? c : this.iconName ? a`<md-icon aria-hidden="true">${this.iconName}</md-icon>` : a`<div class="fallback" part="fallback">${this._initials()}</div>`}
|
|
38
|
+
`, s = t ? a`<img class="photo" part="image" src=${this.src} alt=${this.alt}
|
|
39
|
+
@load=${this._onImgLoad} @error=${this._onImgError} />` : a`
|
|
40
|
+
<slot name="icon" @slotchange=${this._onIconSlotChange}></slot>
|
|
41
|
+
${this._hasIconSlot ? c : this.iconName ? a`<md-icon aria-hidden="true">${this.iconName}</md-icon>` : a`<div class="fallback" part="fallback">${this._initials()}</div>`}
|
|
42
|
+
`;
|
|
43
|
+
return a`
|
|
44
|
+
<div class="container" part="container" role="img" aria-label=${i ?? c}>
|
|
45
|
+
${this.variant === "icon" ? o : s}
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
e.styles = d`
|
|
51
|
+
:host {
|
|
52
|
+
display: inline-block;
|
|
53
|
+
vertical-align: middle;
|
|
54
|
+
--_size: 40px;
|
|
55
|
+
--_font-size: 16px;
|
|
56
|
+
--_bg: var(--md-sys-color-primary-fixed-dim, var(--md-sys-color-primary-container));
|
|
57
|
+
--_fg: var(--md-sys-color-on-primary-fixed, var(--md-sys-color-on-primary-container));
|
|
58
|
+
--_radius: var(--radius-full, 1000px);
|
|
59
|
+
--_border: 0 solid transparent;
|
|
60
|
+
|
|
61
|
+
font-family: var(--brand-font, Inter, system-ui, sans-serif);
|
|
62
|
+
color-scheme: light dark;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([size="small"]) { --_size: 32px; --_font-size: var(--md-sys-typescale-label-medium-size, 14px); }
|
|
66
|
+
:host([size="medium"]) { --_size: 40px; --_font-size: var(--md-sys-typescale-label-large-size, 16px); }
|
|
67
|
+
:host([size="large"]) { --_size: 56px; --_font-size: var(--md-sys-typescale-title-large-size, 20px); }
|
|
68
|
+
|
|
69
|
+
:host([shape="circular"]) { --_radius: var(--radius-full, 1000px); }
|
|
70
|
+
:host([shape="rounded"]) { --_radius: var(--radius-s, 8px); }
|
|
71
|
+
:host([shape="square"]) { --_radius: 0; }
|
|
72
|
+
|
|
73
|
+
.container {
|
|
74
|
+
inline-size: var(--_size);
|
|
75
|
+
block-size: var(--_size);
|
|
76
|
+
border-radius: var(--_radius);
|
|
77
|
+
position: relative;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
user-select: none;
|
|
80
|
+
line-height: 1;
|
|
81
|
+
border: var(--_border);
|
|
82
|
+
display: grid;
|
|
83
|
+
place-items: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:host([variant="image"]) .container { background: none; }
|
|
87
|
+
:host([variant="image"]) img.photo {
|
|
88
|
+
width: 100%;
|
|
89
|
+
height: 100%;
|
|
90
|
+
object-fit: cover;
|
|
91
|
+
display: block;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host([size="small"]) { --_icon-size: var(--icon-size-small, 24px); }
|
|
95
|
+
:host([size="medium"]) { --_icon-size: var(--icon-size-medium, 32px); }
|
|
96
|
+
:host([size="large"]) { --_icon-size: var(--icon-size-large, 40px); }
|
|
97
|
+
|
|
98
|
+
:host([variant="icon"]) .container { background: var(--_bg); color: var(--_fg); }
|
|
99
|
+
|
|
100
|
+
img.icon {
|
|
101
|
+
width: var(--_icon-size);
|
|
102
|
+
height: var(--_icon-size);
|
|
103
|
+
object-fit: contain;
|
|
104
|
+
display: block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.fallback {
|
|
108
|
+
display: grid;
|
|
109
|
+
place-items: center;
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
font-size: var(--_font-size);
|
|
113
|
+
font-weight: var(--weight-semibold, 600);
|
|
114
|
+
letter-spacing: .01em;
|
|
115
|
+
text-transform: uppercase;
|
|
116
|
+
color: var(--_fg);
|
|
117
|
+
background: var(--_bg);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:host([variant="image"]) .fallback {
|
|
121
|
+
color: var(--md-sys-color-on-primary-container);
|
|
122
|
+
background: var(--md-sys-color-primary-container);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
::slotted([slot="icon"]) {
|
|
126
|
+
width: var(--_icon-size);
|
|
127
|
+
height: var(--_icon-size);
|
|
128
|
+
line-height: 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:host(:focus-visible) .container {
|
|
132
|
+
outline: var(--md-focus-ring-width, 2px) solid var(--md-focus-ring-color, var(--p-40));
|
|
133
|
+
outline-offset: 2px;
|
|
134
|
+
border-radius: var(--_radius);
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
r([
|
|
138
|
+
l({ type: String })
|
|
139
|
+
], e.prototype, "src", 2);
|
|
140
|
+
r([
|
|
141
|
+
l({ type: String })
|
|
142
|
+
], e.prototype, "alt", 2);
|
|
143
|
+
r([
|
|
144
|
+
l({ type: String })
|
|
145
|
+
], e.prototype, "label", 2);
|
|
146
|
+
r([
|
|
147
|
+
l({ type: String, reflect: !0 })
|
|
148
|
+
], e.prototype, "size", 2);
|
|
149
|
+
r([
|
|
150
|
+
l({ type: String, reflect: !0 })
|
|
151
|
+
], e.prototype, "shape", 2);
|
|
152
|
+
r([
|
|
153
|
+
l({ type: String, attribute: "icon-name", reflect: !0 })
|
|
154
|
+
], e.prototype, "iconName", 2);
|
|
155
|
+
r([
|
|
156
|
+
l({ type: String, reflect: !0 })
|
|
157
|
+
], e.prototype, "variant", 2);
|
|
158
|
+
r([
|
|
159
|
+
m()
|
|
160
|
+
], e.prototype, "_imgError", 2);
|
|
161
|
+
r([
|
|
162
|
+
m()
|
|
163
|
+
], e.prototype, "_hasIconSlot", 2);
|
|
164
|
+
e = r([
|
|
165
|
+
v("scb-avatar")
|
|
166
|
+
], e);
|
|
167
|
+
export {
|
|
168
|
+
e as ScbAvatar
|
|
169
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { LitElement as u, css as b, html as p } from "lit";
|
|
2
|
+
import { property as i, customElement as m } from "lit/decorators.js";
|
|
3
|
+
var h = Object.defineProperty, f = Object.getOwnPropertyDescriptor, a = (l, t, o, s) => {
|
|
4
|
+
for (var r = s > 1 ? void 0 : s ? f(t, o) : t, c = l.length - 1, n; c >= 0; c--)
|
|
5
|
+
(n = l[c]) && (r = (s ? n(t, o, r) : n(r)) || r);
|
|
6
|
+
return s && r && h(t, o, r), r;
|
|
7
|
+
};
|
|
8
|
+
let e = class extends u {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.label = "", this.isCurrent = !1, this.href = "";
|
|
11
|
+
}
|
|
12
|
+
static get styles() {
|
|
13
|
+
return b`
|
|
14
|
+
.breadcrumb-separator {
|
|
15
|
+
margin: 0 8px;
|
|
16
|
+
color: var(--md-sys-color-on-surface);
|
|
17
|
+
}
|
|
18
|
+
.breadcrumb-link {
|
|
19
|
+
color: var(--md-sys-color-primary);
|
|
20
|
+
text-decoration-thickness: 1px;
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
.breadcrumb-link:hover {
|
|
24
|
+
text-decoration-thickness: 2px;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
switch (!0) {
|
|
30
|
+
case this.isCurrent:
|
|
31
|
+
return p`<span class="breadcrumb-current">${this.label}</span>`;
|
|
32
|
+
default:
|
|
33
|
+
return p`
|
|
34
|
+
<a href="${this.href}" class="breadcrumb-link">${this.label}</a>
|
|
35
|
+
<span class="breadcrumb-separator">/</span>
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
a([
|
|
41
|
+
i({ type: String })
|
|
42
|
+
], e.prototype, "label", 2);
|
|
43
|
+
a([
|
|
44
|
+
i({ type: Boolean, attribute: "is-current" })
|
|
45
|
+
], e.prototype, "isCurrent", 2);
|
|
46
|
+
a([
|
|
47
|
+
i({ type: String, attribute: "item-href" })
|
|
48
|
+
], e.prototype, "href", 2);
|
|
49
|
+
e = a([
|
|
50
|
+
m("scb-breadcrumb-item")
|
|
51
|
+
], e);
|
|
52
|
+
export {
|
|
53
|
+
e as SCBBreadcrumbItem
|
|
54
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class SCBBreadcrumb extends LitElement {
|
|
4
|
+
showAll: boolean;
|
|
5
|
+
private static __iconLoaded;
|
|
6
|
+
private __ensureIconLoaded;
|
|
7
|
+
static get styles(): import('lit').CSSResult;
|
|
8
|
+
protected firstUpdated(): void;
|
|
9
|
+
private _onEllipsisClick;
|
|
10
|
+
render(): TemplateResult;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'scb-breadcrumb': SCBBreadcrumb;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { LitElement as d, css as m, html as n } from "lit";
|
|
2
|
+
import { property as p, customElement as b } from "lit/decorators.js";
|
|
3
|
+
import "./scb-breadcrumb-item.js";
|
|
4
|
+
var h = Object.defineProperty, u = Object.getOwnPropertyDescriptor, c = (e, r, s, t) => {
|
|
5
|
+
for (var a = t > 1 ? void 0 : t ? u(r, s) : r, i = e.length - 1, o; i >= 0; i--)
|
|
6
|
+
(o = e[i]) && (a = (t ? o(r, s, a) : o(a)) || a);
|
|
7
|
+
return t && a && h(r, s, a), a;
|
|
8
|
+
};
|
|
9
|
+
let l = class extends d {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.showAll = !1;
|
|
12
|
+
}
|
|
13
|
+
async __ensureIconLoaded() {
|
|
14
|
+
l.__iconLoaded || (await import("@material/web/icon/icon.js"), l.__iconLoaded = !0);
|
|
15
|
+
}
|
|
16
|
+
static get styles() {
|
|
17
|
+
return m`
|
|
18
|
+
.scb-breadcrumb {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
}
|
|
23
|
+
.breadcrumb-separator {
|
|
24
|
+
margin: 0 8px;
|
|
25
|
+
color: var(--md-sys-color-on-surface);
|
|
26
|
+
}
|
|
27
|
+
.collapsed > scb-breadcrumb-item {
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
30
|
+
.collapsed > scb-breadcrumb-item:nth-child(-n+3),
|
|
31
|
+
.collapsed > scb-breadcrumb-item:nth-last-child(-n+3) {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
}
|
|
34
|
+
.ellipsis {
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
color: var(--md-sys-color-primary);
|
|
38
|
+
}
|
|
39
|
+
.collapsed .ellipsis {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
}
|
|
42
|
+
.expanded .ellipsis {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
.breadcrumb-animate {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transform: translateY(10px);
|
|
48
|
+
animation: fadeInBreadcrumb 0.4s cubic-bezier(0.4,0,0.2,1) forwards;
|
|
49
|
+
}
|
|
50
|
+
@keyframes fadeInBreadcrumb {
|
|
51
|
+
to {
|
|
52
|
+
opacity: 1;
|
|
53
|
+
transform: translateY(0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
firstUpdated() {
|
|
59
|
+
this.children.length > 6 && !this.showAll && this.__ensureIconLoaded();
|
|
60
|
+
}
|
|
61
|
+
_onEllipsisClick() {
|
|
62
|
+
this.showAll ? (this.showAll = !1, l.__iconLoaded || this.__ensureIconLoaded()) : (this.showAll = !0, this.updateComplete.then(() => {
|
|
63
|
+
var r;
|
|
64
|
+
const e = (r = this.shadowRoot) == null ? void 0 : r.querySelectorAll(".scb-breadcrumb.expanded > scb-breadcrumb-item");
|
|
65
|
+
e && (e.forEach((s, t) => {
|
|
66
|
+
s.classList.add("breadcrumb-animate"), s.style.animationDelay = `${t * 60}ms`;
|
|
67
|
+
}), setTimeout(() => {
|
|
68
|
+
e.forEach((s) => {
|
|
69
|
+
s.classList.remove("breadcrumb-animate"), s.style.animationDelay = "";
|
|
70
|
+
});
|
|
71
|
+
}, 600));
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
let e = [];
|
|
76
|
+
this.children.length || (e = Array.from(this.shadowRoot ? this.shadowRoot.querySelectorAll("scb-breadcrumb-item") : [])), e.length || (e = Array.from(this.children).filter((s) => s.tagName.toLowerCase() === "scb-breadcrumb-item")), e.length > 0 && e[e.length - 1].setAttribute("is-current", "true");
|
|
77
|
+
const r = e.length > 6 && !this.showAll;
|
|
78
|
+
return n`
|
|
79
|
+
<div class="scb-breadcrumb ${r ? "collapsed" : "expanded"}">
|
|
80
|
+
${r ? e.map(
|
|
81
|
+
(s, t) => t === 3 ? n`<span
|
|
82
|
+
class="ellipsis"
|
|
83
|
+
aria-label="Visa alla"
|
|
84
|
+
role="button"
|
|
85
|
+
tabindex="0"
|
|
86
|
+
@click=${this._onEllipsisClick}
|
|
87
|
+
@keydown=${(a) => {
|
|
88
|
+
(a.key === "Enter" || a.key === " ") && this._onEllipsisClick();
|
|
89
|
+
}}
|
|
90
|
+
><md-icon>more_horiz</md-icon></span><span class="breadcrumb-separator">/</span>${s}` : n`${s}`
|
|
91
|
+
) : e.map((s) => s)}
|
|
92
|
+
</div>
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
l.__iconLoaded = !1;
|
|
97
|
+
c([
|
|
98
|
+
p({ type: Boolean })
|
|
99
|
+
], l.prototype, "showAll", 2);
|
|
100
|
+
l = c([
|
|
101
|
+
b("scb-breadcrumb")
|
|
102
|
+
], l);
|
|
103
|
+
export {
|
|
104
|
+
l as SCBBreadcrumb
|
|
105
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
/** "filled", "outlined", "filled-tonal" eller "text" */
|
|
4
|
+
export type ScbButtonVariant = 'filled' | 'outlined' | 'filled-tonal' | 'text';
|
|
5
|
+
export declare class ScbButton extends LitElement {
|
|
6
|
+
variant: ScbButtonVariant;
|
|
7
|
+
type: string;
|
|
8
|
+
label: string;
|
|
9
|
+
trailingIcon: boolean;
|
|
10
|
+
icon: string;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
href: string;
|
|
13
|
+
target: string;
|
|
14
|
+
rel: string;
|
|
15
|
+
private __loadedButtons;
|
|
16
|
+
private __iconLoaded;
|
|
17
|
+
private __ariaObserver?;
|
|
18
|
+
private __ensureDepsLoaded;
|
|
19
|
+
private __getInnerButton;
|
|
20
|
+
private __syncAriaToInner;
|
|
21
|
+
protected firstUpdated(): void;
|
|
22
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
static get styles(): import('lit').CSSResult;
|
|
25
|
+
render(): TemplateResult;
|
|
26
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { LitElement as b, css as m, html as u, nothing as e } from "lit";
|
|
2
|
+
import { property as d, customElement as p } from "lit/decorators.js";
|
|
3
|
+
var f = Object.defineProperty, v = Object.getOwnPropertyDescriptor, s = (t, r, a, i) => {
|
|
4
|
+
for (var o = i > 1 ? void 0 : i ? v(r, a) : r, c = t.length - 1, n; c >= 0; c--)
|
|
5
|
+
(n = t[c]) && (o = (i ? n(r, a, o) : n(o)) || o);
|
|
6
|
+
return i && o && f(r, a, o), o;
|
|
7
|
+
};
|
|
8
|
+
let l = class extends b {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.variant = "filled", this.type = "button", this.label = "Button", this.trailingIcon = !1, this.icon = "", this.disabled = !1, this.href = "", this.target = "", this.rel = "", this.__loadedButtons = /* @__PURE__ */ new Set(), this.__iconLoaded = !1;
|
|
11
|
+
}
|
|
12
|
+
// Ladda in nödvändiga Material-web-komponenter vid behov (variant + ev. ikon)
|
|
13
|
+
async __ensureDepsLoaded() {
|
|
14
|
+
if (!this.__loadedButtons.has(this.variant)) {
|
|
15
|
+
switch (this.variant) {
|
|
16
|
+
case "filled":
|
|
17
|
+
await import("@material/web/button/filled-button.js");
|
|
18
|
+
break;
|
|
19
|
+
case "outlined":
|
|
20
|
+
await import("@material/web/button/outlined-button.js");
|
|
21
|
+
break;
|
|
22
|
+
case "filled-tonal":
|
|
23
|
+
await import("@material/web/button/filled-tonal-button.js");
|
|
24
|
+
break;
|
|
25
|
+
case "text":
|
|
26
|
+
await import("@material/web/button/text-button.js");
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
this.__loadedButtons.add(this.variant);
|
|
30
|
+
}
|
|
31
|
+
this.icon && !this.__iconLoaded && (await import("@material/web/icon/icon.js"), this.__iconLoaded = !0);
|
|
32
|
+
}
|
|
33
|
+
// Hämta inre md-knapp (oavsett variant)
|
|
34
|
+
__getInnerButton() {
|
|
35
|
+
return this.renderRoot.querySelector(
|
|
36
|
+
"md-filled-button, md-outlined-button, md-filled-tonal-button, md-text-button"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
// Spegla aria-attribut från host -> inre md-knapp
|
|
40
|
+
// (behåll aria-controls på host; ta bort aria-expanded från host
|
|
41
|
+
__syncAriaToInner() {
|
|
42
|
+
var i;
|
|
43
|
+
const t = this.__getInnerButton();
|
|
44
|
+
if (!t) return;
|
|
45
|
+
const r = this.getAttribute("aria-controls");
|
|
46
|
+
r && t.setAttribute("aria-controls", r);
|
|
47
|
+
const a = this.getAttribute("aria-expanded");
|
|
48
|
+
a !== null && (t.setAttribute("aria-expanded", a), this.removeAttribute("aria-expanded")), (i = this.__ariaObserver) == null || i.disconnect(), this.__ariaObserver = new MutationObserver((o) => {
|
|
49
|
+
const c = this.__getInnerButton();
|
|
50
|
+
if (c) {
|
|
51
|
+
for (const n of o)
|
|
52
|
+
if (!(n.type !== "attributes" || !n.attributeName) && (n.attributeName === "aria-controls" || n.attributeName === "aria-expanded")) {
|
|
53
|
+
const h = this.getAttribute(n.attributeName);
|
|
54
|
+
h === null ? c.removeAttribute(n.attributeName) : c.setAttribute(n.attributeName, h), n.attributeName === "aria-expanded" && this.removeAttribute("aria-expanded");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}), this.__ariaObserver.observe(this, { attributes: !0, attributeFilter: ["aria-controls", "aria-expanded"] });
|
|
58
|
+
}
|
|
59
|
+
// Kör dynamisk import första gången komponenten renderats
|
|
60
|
+
firstUpdated() {
|
|
61
|
+
(this.type === "submit" || this.type === "reset") && this.addEventListener("click", () => {
|
|
62
|
+
if (!this.disabled) {
|
|
63
|
+
const t = this.closest("form");
|
|
64
|
+
t && (this.type === "submit" && t.requestSubmit(), this.type === "reset" && t.reset());
|
|
65
|
+
}
|
|
66
|
+
}), this.__ensureDepsLoaded(), this.__syncAriaToInner();
|
|
67
|
+
}
|
|
68
|
+
// Kör även när variant/icon ändras
|
|
69
|
+
updated(t) {
|
|
70
|
+
(t.has("variant") || t.has("icon") && this.icon) && this.__ensureDepsLoaded(), t.has("variant") && this.__syncAriaToInner();
|
|
71
|
+
}
|
|
72
|
+
disconnectedCallback() {
|
|
73
|
+
var t;
|
|
74
|
+
(t = this.__ariaObserver) == null || t.disconnect(), super.disconnectedCallback();
|
|
75
|
+
}
|
|
76
|
+
static get styles() {
|
|
77
|
+
return m`
|
|
78
|
+
/* Gör hosten stretchbar i t.ex. flex/grid */
|
|
79
|
+
:host {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
block-size: var(--scb-button-block-size, auto);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Låt inre md-knappen fylla hostens höjd*/
|
|
85
|
+
md-filled-button,
|
|
86
|
+
md-outlined-button,
|
|
87
|
+
md-filled-tonal-button,
|
|
88
|
+
md-text-button {
|
|
89
|
+
block-size: 100%;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Errorvarianter */
|
|
93
|
+
/*
|
|
94
|
+
md-filled-button[variant='error'],
|
|
95
|
+
md-outlined-button[variant='error'],
|
|
96
|
+
md-filled-tonal-button[variant='error'],
|
|
97
|
+
md-text-button[variant='error'] {
|
|
98
|
+
--md-sys-color-primary: var(--md-sys-color-error);
|
|
99
|
+
--md-sys-color-on-primary: var(--md-sys-color-on-error);
|
|
100
|
+
}
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/* Outlined – röd outline vid error + tjockare vid hover */
|
|
104
|
+
/*
|
|
105
|
+
md-outlined-button[variant='error'] {
|
|
106
|
+
--_outline-color: var(--md-sys-color-error);
|
|
107
|
+
--md-outlined-button-pressed-outline-color: var(--md-sys-color-error);
|
|
108
|
+
}
|
|
109
|
+
*/
|
|
110
|
+
/* md-outlined-button[variant='error']:hover, */
|
|
111
|
+
md-outlined-button:hover {
|
|
112
|
+
--md-outlined-button-outline-width: var(--spacing-1, 1px);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Filled-tonal – error-färger */
|
|
116
|
+
/*
|
|
117
|
+
md-filled-tonal-button[variant='error'] {
|
|
118
|
+
--md-filled-tonal-button-container-color: var(--md-sys-color-error-container);
|
|
119
|
+
--md-filled-tonal-button-label-text-color: var(--md-sys-color-on-error-container);
|
|
120
|
+
--md-filled-tonal-button-hover-label-text-color: var(--md-sys-color-on-error-container);
|
|
121
|
+
--md-filled-tonal-button-pressed-label-text-color: var(--md-sys-color-on-error-container);
|
|
122
|
+
--md-filled-tonal-button-focus-label-text-color: var(--md-sys-color-on-error-container);
|
|
123
|
+
--md-filled-tonal-button-icon-color: var(--md-sys-color-on-error-container);
|
|
124
|
+
--md-filled-tonal-button-hover-icon-color: var(--md-sys-color-on-error-container);
|
|
125
|
+
--md-filled-tonal-button-pressed-icon-color: var(--md-sys-color-on-error-container);
|
|
126
|
+
--md-filled-tonal-button-focus-icon-color: var(--md-sys-color-on-error-container);
|
|
127
|
+
--md-filled-tonal-button-hover-state-layer-color: var(--md-sys-color-on-error-container);
|
|
128
|
+
--md-filled-tonal-button-pressed-state-layer-color: var(--md-sys-color-on-error-container);
|
|
129
|
+
}
|
|
130
|
+
@media (prefers-color-scheme: dark) {
|
|
131
|
+
md-filled-tonal-button[variant='error'] {
|
|
132
|
+
--md-filled-tonal-button-container-color: var(--md-sys-color-on-error);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
*/
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
render() {
|
|
139
|
+
var o;
|
|
140
|
+
const t = !!((o = this.icon) != null && o.trim()), r = t ? u`<md-icon slot="icon">${this.icon}</md-icon>` : e, a = e, i = this.label.trim() === "" ? this.icon : void 0;
|
|
141
|
+
switch (this.variant) {
|
|
142
|
+
case "filled":
|
|
143
|
+
return u`
|
|
144
|
+
<md-filled-button
|
|
145
|
+
type=${this.type}
|
|
146
|
+
variant=${a}
|
|
147
|
+
?trailing-icon=${this.trailingIcon}
|
|
148
|
+
?disabled=${this.disabled}
|
|
149
|
+
aria-label=${i}
|
|
150
|
+
href=${this.href || e}
|
|
151
|
+
target=${this.target || e}
|
|
152
|
+
rel=${this.rel || e}
|
|
153
|
+
>
|
|
154
|
+
${t && !this.trailingIcon ? r : e}
|
|
155
|
+
${this.label}
|
|
156
|
+
${t && this.trailingIcon ? r : e}
|
|
157
|
+
</md-filled-button>
|
|
158
|
+
`;
|
|
159
|
+
case "outlined":
|
|
160
|
+
return u`
|
|
161
|
+
<md-outlined-button
|
|
162
|
+
type=${this.type}
|
|
163
|
+
variant=${a}
|
|
164
|
+
?trailing-icon=${this.trailingIcon}
|
|
165
|
+
?disabled=${this.disabled}
|
|
166
|
+
aria-label=${i}
|
|
167
|
+
href=${this.href || e}
|
|
168
|
+
target=${this.target || e}
|
|
169
|
+
rel=${this.rel || e}
|
|
170
|
+
>
|
|
171
|
+
${t && !this.trailingIcon ? r : e}
|
|
172
|
+
${this.label}
|
|
173
|
+
${t && this.trailingIcon ? r : e}
|
|
174
|
+
</md-outlined-button>
|
|
175
|
+
`;
|
|
176
|
+
case "filled-tonal":
|
|
177
|
+
return u`
|
|
178
|
+
<md-filled-tonal-button
|
|
179
|
+
type=${this.type}
|
|
180
|
+
variant=${a}
|
|
181
|
+
?trailing-icon=${this.trailingIcon}
|
|
182
|
+
?disabled=${this.disabled}
|
|
183
|
+
aria-label=${i}
|
|
184
|
+
href=${this.href || e}
|
|
185
|
+
target=${this.target || e}
|
|
186
|
+
rel=${this.rel || e}
|
|
187
|
+
>
|
|
188
|
+
${t && !this.trailingIcon ? r : e}
|
|
189
|
+
${this.label}
|
|
190
|
+
${t && this.trailingIcon ? r : e}
|
|
191
|
+
</md-filled-tonal-button>
|
|
192
|
+
`;
|
|
193
|
+
case "text":
|
|
194
|
+
return u`
|
|
195
|
+
<md-text-button
|
|
196
|
+
type=${this.type}
|
|
197
|
+
variant=${a}
|
|
198
|
+
?trailing-icon=${this.trailingIcon}
|
|
199
|
+
?disabled=${this.disabled}
|
|
200
|
+
aria-label=${i}
|
|
201
|
+
href=${this.href || e}
|
|
202
|
+
target=${this.target || e}
|
|
203
|
+
rel=${this.rel || e}
|
|
204
|
+
>
|
|
205
|
+
${t && !this.trailingIcon ? r : e}
|
|
206
|
+
${this.label}
|
|
207
|
+
${t && this.trailingIcon ? r : e}
|
|
208
|
+
</md-text-button>
|
|
209
|
+
`;
|
|
210
|
+
default:
|
|
211
|
+
return u``;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
s([
|
|
216
|
+
d({ type: String, reflect: !0 })
|
|
217
|
+
], l.prototype, "variant", 2);
|
|
218
|
+
s([
|
|
219
|
+
d({ type: String, reflect: !0 })
|
|
220
|
+
], l.prototype, "type", 2);
|
|
221
|
+
s([
|
|
222
|
+
d({ type: String })
|
|
223
|
+
], l.prototype, "label", 2);
|
|
224
|
+
s([
|
|
225
|
+
d({ type: Boolean, attribute: "trailing-icon" })
|
|
226
|
+
], l.prototype, "trailingIcon", 2);
|
|
227
|
+
s([
|
|
228
|
+
d({ type: String })
|
|
229
|
+
], l.prototype, "icon", 2);
|
|
230
|
+
s([
|
|
231
|
+
d({ type: Boolean, reflect: !0 })
|
|
232
|
+
], l.prototype, "disabled", 2);
|
|
233
|
+
s([
|
|
234
|
+
d({ type: String })
|
|
235
|
+
], l.prototype, "href", 2);
|
|
236
|
+
s([
|
|
237
|
+
d({ type: String })
|
|
238
|
+
], l.prototype, "target", 2);
|
|
239
|
+
s([
|
|
240
|
+
d({ type: String })
|
|
241
|
+
], l.prototype, "rel", 2);
|
|
242
|
+
l = s([
|
|
243
|
+
p("scb-button")
|
|
244
|
+
], l);
|
|
245
|
+
export {
|
|
246
|
+
l as ScbButton
|
|
247
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enkel kort-komponent för SCB-designsystemet
|
|
5
|
+
*/
|
|
6
|
+
export declare class ScbCalendarCard extends LitElement {
|
|
7
|
+
variant: 'default' | 'outlined' | 'filled';
|
|
8
|
+
direction: 'horizontal' | 'vertical';
|
|
9
|
+
header: string;
|
|
10
|
+
subtitle: string;
|
|
11
|
+
supportingText: string;
|
|
12
|
+
cardHref: string;
|
|
13
|
+
showMedia: boolean | null;
|
|
14
|
+
private static __iconLoaded;
|
|
15
|
+
private static __rippleLoaded;
|
|
16
|
+
protected firstUpdated(): Promise<void>;
|
|
17
|
+
static styles: import('lit').CSSResult;
|
|
18
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
19
|
+
private _onKeyDown;
|
|
20
|
+
}
|