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,258 @@
|
|
|
1
|
+
import { LitElement as c, html as d, css as u } from "lit";
|
|
2
|
+
import { property as o, customElement as h } from "lit/decorators.js";
|
|
3
|
+
var b = Object.defineProperty, f = Object.getOwnPropertyDescriptor, s = (e, t, i, a) => {
|
|
4
|
+
for (var n = a > 1 ? void 0 : a ? f(t, i) : t, l = e.length - 1, p; l >= 0; l--)
|
|
5
|
+
(p = e[l]) && (n = (a ? p(t, i, n) : p(n)) || n);
|
|
6
|
+
return a && n && b(t, i, n), n;
|
|
7
|
+
};
|
|
8
|
+
let r = class extends c {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.type = "text", this.label = "", this.supportingText = "", this.errorText = "", this.leadingIcon = "", this.name = "", this.pattern = "", this.value = "", this.underLabel = "", this.error = !1, this.disabled = !1, this.required = !1, this._form = null, this._formSubmitHandler = null, this._formResetHandler = null, this._initialValue = "", this._inputId = "";
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
const e = this.leadingIcon ? d`<md-icon class="scb-textfield-icon">${this.leadingIcon}</md-icon>` : null, t = this.error ? d`<md-icon class="scb-textfield-error-icon" aria-hidden="true">error</md-icon>` : null;
|
|
14
|
+
this.underLabel = this.error ? this.errorText || "Ogiltig inmatning." : this.supportingText, this.value = this.value || "";
|
|
15
|
+
const i = this.underLabel ? `${this._inputId}-supporting-text` : void 0;
|
|
16
|
+
return this.type === "textarea" ? d`
|
|
17
|
+
<label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
|
|
18
|
+
<span
|
|
19
|
+
class="scb-textfield-supporting-text"
|
|
20
|
+
id="${this.underLabel ? `${this._inputId}-supporting-text` : ""}"
|
|
21
|
+
>${this.underLabel}</span>
|
|
22
|
+
<div class="scb-textfield-wrapper">
|
|
23
|
+
<textarea
|
|
24
|
+
class="scb-textfield"
|
|
25
|
+
?disabled=${this.disabled}
|
|
26
|
+
name="${this.name}"
|
|
27
|
+
id="${this._inputId}"
|
|
28
|
+
?required=${this.required}
|
|
29
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
30
|
+
aria-describedby=${i}
|
|
31
|
+
>${this.value}</textarea>
|
|
32
|
+
</div>
|
|
33
|
+
` : d`
|
|
34
|
+
<label class="scb-textfield-label" for="${this._inputId}">${this.label}</label>
|
|
35
|
+
<span
|
|
36
|
+
class="scb-textfield-supporting-text"
|
|
37
|
+
id="${this.underLabel ? `${this._inputId}-supporting-text` : ""}"
|
|
38
|
+
>${this.underLabel}</span>
|
|
39
|
+
<div class="scb-textfield-wrapper">
|
|
40
|
+
${e}
|
|
41
|
+
<input
|
|
42
|
+
class="scb-textfield${this.error ? " has-error-icon" : ""}"
|
|
43
|
+
.value=${this.value}
|
|
44
|
+
type="${this.type}"
|
|
45
|
+
name="${this.name}"
|
|
46
|
+
id="${this._inputId}"
|
|
47
|
+
?disabled=${this.disabled}
|
|
48
|
+
?required=${this.required}
|
|
49
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
50
|
+
aria-describedby=${i}
|
|
51
|
+
/>
|
|
52
|
+
${t}
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
Vi re-dispatchar inbyggda "input", "change" och "select" events med { bubbles: true, composed: true },
|
|
58
|
+
så att konsumenter kan lyssna på events direkt från <scb-text-field>. Vi kör också ett customevent onValueChanged.
|
|
59
|
+
*/
|
|
60
|
+
firstUpdated(e) {
|
|
61
|
+
var i;
|
|
62
|
+
super.firstUpdated(e), this._initialValue = this.value, (this.leadingIcon || this.error) && this.__ensureMdIconLoaded();
|
|
63
|
+
const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".scb-textfield");
|
|
64
|
+
t && (t.addEventListener("input", (a) => {
|
|
65
|
+
const n = t;
|
|
66
|
+
if (this.value = n.value, this.pattern) {
|
|
67
|
+
const l = new RegExp(this.pattern);
|
|
68
|
+
this.error = !l.test(this.value);
|
|
69
|
+
}
|
|
70
|
+
this.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("onValueChanged", {
|
|
71
|
+
detail: { value: this.value },
|
|
72
|
+
bubbles: !0,
|
|
73
|
+
composed: !0
|
|
74
|
+
}));
|
|
75
|
+
}), t.addEventListener("change", (a) => {
|
|
76
|
+
this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
|
|
77
|
+
}), t.addEventListener("select", (a) => {
|
|
78
|
+
this.dispatchEvent(new Event("select", { bubbles: !0, composed: !0 }));
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
/* Reagera på ändringar som kan kräva att md-icon laddas in (leadingIcon / error) */
|
|
82
|
+
updated(e) {
|
|
83
|
+
super.updated(e), (e.has("leadingIcon") || e.has("error")) && (this.leadingIcon && this.leadingIcon.trim() || this.error) && this.__ensureMdIconLoaded(), this.toggleAttribute("aria-disabled", this.disabled);
|
|
84
|
+
}
|
|
85
|
+
// Om scb-textfield är inuti ett formulär
|
|
86
|
+
connectedCallback() {
|
|
87
|
+
super.connectedCallback(), this._inputId = this.id || `scb-textfield-${Math.random().toString(36).substr(2, 9)}`, this._formSubmitHandler = (e) => {
|
|
88
|
+
this.reportValidity() || (e.preventDefault(), e.stopPropagation());
|
|
89
|
+
}, this._form = this.closest("form"), this._form && (this._form.addEventListener("submit", this._formSubmitHandler, !0), this._formResetHandler = () => {
|
|
90
|
+
var t;
|
|
91
|
+
this.value = this._initialValue;
|
|
92
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".scb-textfield");
|
|
93
|
+
e && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) && (e.value = this._initialValue), this.error = !1;
|
|
94
|
+
}, this._form.addEventListener("reset", this._formResetHandler, !0));
|
|
95
|
+
}
|
|
96
|
+
disconnectedCallback() {
|
|
97
|
+
super.disconnectedCallback(), this._form && this._formSubmitHandler && (this._form.removeEventListener("submit", this._formSubmitHandler, !0), this._formResetHandler && this._form.removeEventListener("reset", this._formResetHandler, !0));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Kallar på reportValidity på den inbyggda input/textarea och sätter felstatus till error-text.
|
|
101
|
+
*/
|
|
102
|
+
reportValidity() {
|
|
103
|
+
var t;
|
|
104
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".scb-textfield");
|
|
105
|
+
if (e && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement)) {
|
|
106
|
+
this.required && !e.value ? e.setCustomValidity(this.errorText || "Ogiltig inmatning.") : e.setCustomValidity("");
|
|
107
|
+
const i = e.reportValidity();
|
|
108
|
+
return this.error = !i, i || (this.errorText = this.errorText || e.validationMessage || "Ogiltig inmatning."), i;
|
|
109
|
+
}
|
|
110
|
+
return !0;
|
|
111
|
+
}
|
|
112
|
+
/*
|
|
113
|
+
Lazy-loader för md-icon
|
|
114
|
+
*/
|
|
115
|
+
async __ensureMdIconLoaded() {
|
|
116
|
+
window.__scb_md_icon_loaded || (await import("@material/web/icon/icon.js"), window.__scb_md_icon_loaded = !0);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
r.styles = [
|
|
120
|
+
u`
|
|
121
|
+
:host {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
max-width: 280px;
|
|
125
|
+
/* Följ aktuellt tema (light/dark) via tokens */
|
|
126
|
+
color: var(--md-sys-color-on-surface);
|
|
127
|
+
}
|
|
128
|
+
:host([error]) .scb-textfield-supporting-text {
|
|
129
|
+
color: var(--md-sys-color-error);
|
|
130
|
+
}
|
|
131
|
+
:host([error]) .scb-textfield {
|
|
132
|
+
border-color: var(--md-sys-color-error);
|
|
133
|
+
}
|
|
134
|
+
:host([error]) .scb-textfield:focus-visible {
|
|
135
|
+
border-color: var(--md-sys-color-error);
|
|
136
|
+
box-shadow: inset 0 0 0 2px var(--md-sys-color-error);
|
|
137
|
+
}
|
|
138
|
+
:host([disabled]) {
|
|
139
|
+
opacity: 0.38;
|
|
140
|
+
cursor: default;
|
|
141
|
+
}
|
|
142
|
+
.scb-textfield-label {
|
|
143
|
+
font-size: 16px;
|
|
144
|
+
line-height: 20px;
|
|
145
|
+
font-weight: 600;
|
|
146
|
+
}
|
|
147
|
+
.scb-textfield-supporting-text {
|
|
148
|
+
font-size: 16px;
|
|
149
|
+
line-height: 24px;
|
|
150
|
+
margin-bottom: 8px;
|
|
151
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
152
|
+
}
|
|
153
|
+
.scb-textfield {
|
|
154
|
+
padding: 4px 16px;
|
|
155
|
+
min-height: 56px;
|
|
156
|
+
border: 1px solid var(--md-sys-color-outline);
|
|
157
|
+
border-radius: 8px;
|
|
158
|
+
font-size: var(--md-sys-typescale-body-large-size, 16px);
|
|
159
|
+
font-family: var(--brand-font);
|
|
160
|
+
line-height: 24px;
|
|
161
|
+
width: 100%;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
}
|
|
164
|
+
md-icon + .scb-textfield {
|
|
165
|
+
padding-left: 48px; /* Extra padding for search icon */
|
|
166
|
+
}
|
|
167
|
+
.scb-textfield-icon {
|
|
168
|
+
position: absolute;
|
|
169
|
+
left: 12px;
|
|
170
|
+
top: 50%;
|
|
171
|
+
transform: translateY(-50%);
|
|
172
|
+
pointer-events: none;
|
|
173
|
+
font-size: 24px;
|
|
174
|
+
}
|
|
175
|
+
.scb-textfield:focus-visible {
|
|
176
|
+
/* Remove outline */
|
|
177
|
+
outline: none;
|
|
178
|
+
/* Add a thicker border inside */
|
|
179
|
+
border-color: var(--md-sys-color-primary);
|
|
180
|
+
box-shadow: inset 0 0 0 2px var(--md-sys-color-primary);
|
|
181
|
+
border: 1px solid var(--md-sys-color-primary);
|
|
182
|
+
}
|
|
183
|
+
.scb-textfield-wrapper {
|
|
184
|
+
position: relative;
|
|
185
|
+
width: 100%;
|
|
186
|
+
}
|
|
187
|
+
input::-webkit-search-cancel-button {
|
|
188
|
+
appearance: none;
|
|
189
|
+
height: 24px;
|
|
190
|
+
width: 24px;
|
|
191
|
+
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" stroke="black" stroke-width="2"/><line x1="15" y1="9" x2="9" y2="15" stroke="black" stroke-width="2"/><line x1="9" y1="9" x2="15" y2="15" stroke="black" stroke-width="2"/></svg>') no-repeat center center;
|
|
192
|
+
background-size: 22px 22px;
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
}
|
|
195
|
+
input::-webkit-search-cancel-button,
|
|
196
|
+
input::-webkit-search-decoration,
|
|
197
|
+
input::-webkit-search-results-button,
|
|
198
|
+
input::-webkit-search-results-decoration,
|
|
199
|
+
input::-webkit-clear-button {
|
|
200
|
+
filter: brightness(0) saturate(100%) invert(20%) sepia(18%) saturate(2674%) hue-rotate(196deg) brightness(91%) contrast(120%);
|
|
201
|
+
/* This filter closely matches #0f0865. */
|
|
202
|
+
}
|
|
203
|
+
.scb-textfield-error-icon {
|
|
204
|
+
position: absolute;
|
|
205
|
+
right: 12px;
|
|
206
|
+
top: 50%;
|
|
207
|
+
transform: translateY(-50%);
|
|
208
|
+
color: var(--md-sys-color-error);
|
|
209
|
+
font-size: 24px;
|
|
210
|
+
pointer-events: none;
|
|
211
|
+
}
|
|
212
|
+
.scb-textfield.has-error-icon {
|
|
213
|
+
padding-right: 44px; /* Adjust as needed for icon size and spacing */
|
|
214
|
+
}
|
|
215
|
+
`
|
|
216
|
+
];
|
|
217
|
+
s([
|
|
218
|
+
o({ type: String, reflect: !0 })
|
|
219
|
+
], r.prototype, "type", 2);
|
|
220
|
+
s([
|
|
221
|
+
o({ type: String })
|
|
222
|
+
], r.prototype, "label", 2);
|
|
223
|
+
s([
|
|
224
|
+
o({ type: String, attribute: "supporting-text" })
|
|
225
|
+
], r.prototype, "supportingText", 2);
|
|
226
|
+
s([
|
|
227
|
+
o({ type: String, attribute: "error-text" })
|
|
228
|
+
], r.prototype, "errorText", 2);
|
|
229
|
+
s([
|
|
230
|
+
o({ type: String, attribute: "leading-icon" })
|
|
231
|
+
], r.prototype, "leadingIcon", 2);
|
|
232
|
+
s([
|
|
233
|
+
o({ type: String })
|
|
234
|
+
], r.prototype, "name", 2);
|
|
235
|
+
s([
|
|
236
|
+
o({ type: String })
|
|
237
|
+
], r.prototype, "pattern", 2);
|
|
238
|
+
s([
|
|
239
|
+
o({ type: String, attribute: "value" })
|
|
240
|
+
], r.prototype, "value", 2);
|
|
241
|
+
s([
|
|
242
|
+
o({ type: String })
|
|
243
|
+
], r.prototype, "underLabel", 2);
|
|
244
|
+
s([
|
|
245
|
+
o({ type: Boolean, reflect: !0 })
|
|
246
|
+
], r.prototype, "error", 2);
|
|
247
|
+
s([
|
|
248
|
+
o({ type: Boolean, reflect: !0 })
|
|
249
|
+
], r.prototype, "disabled", 2);
|
|
250
|
+
s([
|
|
251
|
+
o({ type: Boolean, reflect: !0 })
|
|
252
|
+
], r.prototype, "required", 2);
|
|
253
|
+
r = s([
|
|
254
|
+
h("scb-textfield")
|
|
255
|
+
], r);
|
|
256
|
+
export {
|
|
257
|
+
r as ScbTextField2
|
|
258
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbTocItem extends LitElement {
|
|
4
|
+
expanded: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
supportingText: string;
|
|
7
|
+
itemHref: string;
|
|
8
|
+
divider: boolean;
|
|
9
|
+
private _unique;
|
|
10
|
+
static styles: import('lit').CSSResult[];
|
|
11
|
+
private _slotHasContent;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
15
|
+
private _onSlotChange;
|
|
16
|
+
private _updateTabbable;
|
|
17
|
+
private toggleAccordion;
|
|
18
|
+
private toggleBottom;
|
|
19
|
+
private _onKeyDown;
|
|
20
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { css as p, LitElement as h, html as l } from "lit";
|
|
2
|
+
import { property as d, customElement as b } from "lit/decorators.js";
|
|
3
|
+
import "../scb-icon-button/scb-icon-button.js";
|
|
4
|
+
import "../scb-divider/scb-divider.js";
|
|
5
|
+
var u = Object.defineProperty, m = Object.getOwnPropertyDescriptor, c = (t, o, s, e) => {
|
|
6
|
+
for (var i = e > 1 ? void 0 : e ? m(o, s) : o, n = t.length - 1, a; n >= 0; n--)
|
|
7
|
+
(a = t[n]) && (i = (e ? a(o, s, i) : a(i)) || i);
|
|
8
|
+
return e && i && u(o, s, i), i;
|
|
9
|
+
};
|
|
10
|
+
let r = class extends h {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.expanded = !1, this.label = "", this.supportingText = "", this.itemHref = "#", this.divider = !0, this._unique = crypto.randomUUID(), this._slotHasContent = !1, this._onSlotChange = () => {
|
|
13
|
+
const t = this.renderRoot.querySelector("slot");
|
|
14
|
+
this._slotHasContent = !!t && t.assignedNodes().length > 0, this.requestUpdate(), this._updateTabbable();
|
|
15
|
+
}, this.toggleAccordion = () => {
|
|
16
|
+
const t = this.closest("scb-toc");
|
|
17
|
+
t != null && t.hasAttribute("detached") || t.querySelectorAll("scb-toc-item").forEach((e) => {
|
|
18
|
+
e !== this && e.expanded && (e.expanded = !1, this.toggleBottom(e), e.dispatchEvent(new CustomEvent("expanded-changed", {
|
|
19
|
+
detail: { expanded: !1 },
|
|
20
|
+
bubbles: !0,
|
|
21
|
+
composed: !0
|
|
22
|
+
})));
|
|
23
|
+
});
|
|
24
|
+
const o = this.expanded;
|
|
25
|
+
this.expanded = !this.expanded, this.toggleBottom(this), o !== this.expanded && this.dispatchEvent(new CustomEvent("expanded-changed", {
|
|
26
|
+
detail: { expanded: this.expanded },
|
|
27
|
+
bubbles: !0,
|
|
28
|
+
composed: !0
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback(), this.addEventListener("slotchange", this._onSlotChange);
|
|
34
|
+
}
|
|
35
|
+
disconnectedCallback() {
|
|
36
|
+
super.disconnectedCallback(), this.removeEventListener("slotchange", this._onSlotChange);
|
|
37
|
+
}
|
|
38
|
+
updated(t) {
|
|
39
|
+
t.has("expanded") && this._updateTabbable();
|
|
40
|
+
}
|
|
41
|
+
_updateTabbable() {
|
|
42
|
+
if (typeof window > "u") return;
|
|
43
|
+
const t = this.renderRoot.querySelector("slot");
|
|
44
|
+
if (!t) return;
|
|
45
|
+
t.assignedElements({ flatten: !0 }).forEach((s) => {
|
|
46
|
+
var e;
|
|
47
|
+
s.matches("a,button,input,select,textarea,[tabindex]") && (this.expanded ? s.removeAttribute("tabindex") : s.setAttribute("tabindex", "-1")), (e = s.querySelectorAll) == null || e.call(s, "a,button,input,select,textarea,[tabindex]").forEach((i) => {
|
|
48
|
+
const n = i;
|
|
49
|
+
this.expanded ? n.removeAttribute("tabindex") : n.setAttribute("tabindex", "-1");
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Animerar max-height vid öppning/stängning för snygg transition
|
|
54
|
+
toggleBottom(t) {
|
|
55
|
+
const o = t.renderRoot.querySelector(".scb-toc-item-bottom");
|
|
56
|
+
o && (t.expanded ? (o.style.maxHeight = `${o.scrollHeight}px`, setTimeout(() => o.style.maxHeight = "unset", 160)) : (o.style.maxHeight = `${o.scrollHeight}px`, requestAnimationFrame(() => o.style.maxHeight = "0")));
|
|
57
|
+
}
|
|
58
|
+
/*
|
|
59
|
+
Tangentbordsnavigering:
|
|
60
|
+
Enter/Space togglar,
|
|
61
|
+
ArrowUp/Down flyttar fokus,
|
|
62
|
+
Home/End hoppar till första/sista item.
|
|
63
|
+
*/
|
|
64
|
+
_onKeyDown(t) {
|
|
65
|
+
const o = this.closest("scb-toc"), e = Array.from((o == null ? void 0 : o.querySelectorAll("scb-toc-item")) || []).map((a) => a.renderRoot.querySelector(".scb-toc-item")).filter((a) => !!a), i = t.currentTarget, n = e.indexOf(i);
|
|
66
|
+
switch (t.key) {
|
|
67
|
+
case "Enter":
|
|
68
|
+
case " ":
|
|
69
|
+
t.preventDefault(), this.toggleAccordion();
|
|
70
|
+
break;
|
|
71
|
+
case "ArrowDown":
|
|
72
|
+
t.preventDefault(), n < e.length - 1 && e[n + 1].focus();
|
|
73
|
+
break;
|
|
74
|
+
case "ArrowUp":
|
|
75
|
+
t.preventDefault(), n > 0 && e[n - 1].focus();
|
|
76
|
+
break;
|
|
77
|
+
case "Home":
|
|
78
|
+
t.preventDefault(), e.length && e[0].focus();
|
|
79
|
+
break;
|
|
80
|
+
case "End":
|
|
81
|
+
t.preventDefault(), e.length && e[e.length - 1].focus();
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
const t = `bottom-${this._unique}`;
|
|
87
|
+
return l`
|
|
88
|
+
<div
|
|
89
|
+
class="scb-toc-item"
|
|
90
|
+
role="listitem"
|
|
91
|
+
aria-expanded=${this.expanded}
|
|
92
|
+
aria-controls=${t}
|
|
93
|
+
>
|
|
94
|
+
<div class="scb-toc-item-top">
|
|
95
|
+
<div>
|
|
96
|
+
<a class="toc-item-label" href=${this.itemHref}>${this.label}</a>
|
|
97
|
+
<div class="supporting-text">${this.supportingText}</div>
|
|
98
|
+
</div>
|
|
99
|
+
${this._slotHasContent ? l`
|
|
100
|
+
<scb-icon-button
|
|
101
|
+
icon=${this.expanded ? "keyboard_arrow_up" : "keyboard_arrow_down"}
|
|
102
|
+
ariaLabel=${this.expanded ? "Collapse section" : "Expand section"}
|
|
103
|
+
@click=${this.toggleAccordion}
|
|
104
|
+
@keydown=${this._onKeyDown}
|
|
105
|
+
></scb-icon-button>
|
|
106
|
+
` : ""}
|
|
107
|
+
</div>
|
|
108
|
+
<div
|
|
109
|
+
id=${t}
|
|
110
|
+
class="scb-toc-item-bottom ${this.expanded ? "expanded" : ""}"
|
|
111
|
+
>
|
|
112
|
+
<slot @slotchange=${this._onSlotChange}></slot>
|
|
113
|
+
</div>
|
|
114
|
+
${this.divider ? l`<scb-divider></scb-divider>` : ""}
|
|
115
|
+
</div>
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
r.styles = [
|
|
120
|
+
p`
|
|
121
|
+
.scb-toc-item-top{
|
|
122
|
+
padding: 24px 8px;
|
|
123
|
+
display: flex;
|
|
124
|
+
gap: 16px;
|
|
125
|
+
flex-direction: row;
|
|
126
|
+
}
|
|
127
|
+
.toc-item-label {
|
|
128
|
+
display: block;
|
|
129
|
+
width: fit-content;
|
|
130
|
+
color: var(--md-sys-color-primary);
|
|
131
|
+
font-size: 18px;
|
|
132
|
+
font-weight: 600;
|
|
133
|
+
line-height: 26px;
|
|
134
|
+
letter-spacing: -0.3px;
|
|
135
|
+
text-decoration: underline;
|
|
136
|
+
text-decoration-thickness: 1px;
|
|
137
|
+
text-underline-offset: .1578em;
|
|
138
|
+
margin-bottom: 10px;
|
|
139
|
+
&:hover{
|
|
140
|
+
color: var(--md-sys-color-on-surface);
|
|
141
|
+
text-decoration-thickness: 2px;
|
|
142
|
+
}
|
|
143
|
+
&:focus{
|
|
144
|
+
color: var(--md-sys-color-on-surface);
|
|
145
|
+
outline-color: var(--md-sys-color-primary);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
scb-icon-button{
|
|
149
|
+
margin-left: auto;
|
|
150
|
+
}
|
|
151
|
+
scb-divider{
|
|
152
|
+
margin: 0 8px;
|
|
153
|
+
}
|
|
154
|
+
.scb-toc-item-bottom {
|
|
155
|
+
font-size: var(--md-sys-typescale-body-medium-size);
|
|
156
|
+
line-height: 27px;
|
|
157
|
+
letter-spacing: -0.3px;
|
|
158
|
+
}
|
|
159
|
+
.scb-toc-item-bottom {
|
|
160
|
+
padding: 0 16px 0 40px;
|
|
161
|
+
max-height: 0;
|
|
162
|
+
overflow: hidden;
|
|
163
|
+
transition: .15s cubic-bezier(.69,.16,.2,.98);
|
|
164
|
+
opacity: 0;
|
|
165
|
+
}
|
|
166
|
+
.scb-toc-item-bottom.expanded {
|
|
167
|
+
opacity: 1;
|
|
168
|
+
padding: 6px 16px 16px 40px;
|
|
169
|
+
max-height: 100%;
|
|
170
|
+
}
|
|
171
|
+
.scb-toc-item{
|
|
172
|
+
color: var(--md-sys-color-on-surface);
|
|
173
|
+
}
|
|
174
|
+
`
|
|
175
|
+
];
|
|
176
|
+
c([
|
|
177
|
+
d({ type: Boolean })
|
|
178
|
+
], r.prototype, "expanded", 2);
|
|
179
|
+
c([
|
|
180
|
+
d({ type: String, reflect: !0 })
|
|
181
|
+
], r.prototype, "label", 2);
|
|
182
|
+
c([
|
|
183
|
+
d({ type: String, attribute: "supporting-text" })
|
|
184
|
+
], r.prototype, "supportingText", 2);
|
|
185
|
+
c([
|
|
186
|
+
d({ type: String, attribute: "item-href" })
|
|
187
|
+
], r.prototype, "itemHref", 2);
|
|
188
|
+
c([
|
|
189
|
+
d({ type: Boolean, attribute: "divider" })
|
|
190
|
+
], r.prototype, "divider", 2);
|
|
191
|
+
r = c([
|
|
192
|
+
b("scb-toc-item")
|
|
193
|
+
], r);
|
|
194
|
+
export {
|
|
195
|
+
r as ScbTocItem
|
|
196
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { css as n, LitElement as i, html as p } from "lit";
|
|
2
|
+
import { customElement as v } from "lit/decorators.js";
|
|
3
|
+
import "./scb-toc-item.js";
|
|
4
|
+
var a = Object.getOwnPropertyDescriptor, f = (s, o, m, l) => {
|
|
5
|
+
for (var t = l > 1 ? void 0 : l ? a(o, m) : o, e = s.length - 1, c; e >= 0; e--)
|
|
6
|
+
(c = s[e]) && (t = c(t) || t);
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
let r = class extends i {
|
|
10
|
+
render() {
|
|
11
|
+
return p`
|
|
12
|
+
<div role="list">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
`;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
r.styles = [
|
|
19
|
+
n`
|
|
20
|
+
`
|
|
21
|
+
];
|
|
22
|
+
r = f([
|
|
23
|
+
v("scb-toc")
|
|
24
|
+
], r);
|
|
25
|
+
export {
|
|
26
|
+
r as ScbToc
|
|
27
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class ScbTooltip extends LitElement {
|
|
4
|
+
variant: 'plain' | 'rich';
|
|
5
|
+
arrow: boolean | null;
|
|
6
|
+
supportingtext: string;
|
|
7
|
+
label: string;
|
|
8
|
+
trigger: 'hover' | 'click' | 'hover-click';
|
|
9
|
+
position: 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
+
open: boolean;
|
|
11
|
+
delay: number;
|
|
12
|
+
offset: number;
|
|
13
|
+
static styles: import('lit').CSSResult[];
|
|
14
|
+
render(): TemplateResult;
|
|
15
|
+
private _hoverActive;
|
|
16
|
+
private _clickActive;
|
|
17
|
+
private _hideTimeout;
|
|
18
|
+
protected firstUpdated(): void;
|
|
19
|
+
private setVariant;
|
|
20
|
+
private setAnchorName;
|
|
21
|
+
private setDelay;
|
|
22
|
+
private setPosition;
|
|
23
|
+
private setDefaultPosition;
|
|
24
|
+
private setOffset;
|
|
25
|
+
private handleEventlistnerClick;
|
|
26
|
+
private handleEventlistnerHover;
|
|
27
|
+
private handleEventElement;
|
|
28
|
+
private addHidden;
|
|
29
|
+
private openTooltip;
|
|
30
|
+
private closeTooltip;
|
|
31
|
+
private adjustTooltipPosition;
|
|
32
|
+
}
|