scb-wc-test 0.1.99 → 0.1.101
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/all.js +76 -0
- package/index.d.ts +2 -0
- package/index.js +52 -48
- package/mvc/components/all.js +2 -0
- package/mvc/components/scb-app-bar/scb-app-bar.js +1 -1
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +1 -1
- package/mvc/components/scb-dialog/scb-dialog.js +1 -1
- package/mvc/components/scb-drawer/scb-drawer-item.js +2 -2
- package/mvc/components/scb-fact-card/scb-fact-card.js +1 -1
- package/mvc/components/scb-header/scb-header.js +1 -1
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +1 -1
- package/mvc/components/scb-icon-button/scb-icon-button.js +30 -41
- package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
- package/mvc/components/scb-pagination/scb-pagination.js +1 -1
- package/mvc/components/scb-select/scb-select-option.js +33 -0
- package/mvc/components/scb-select/scb-select.js +144 -0
- package/mvc/components/scb-snackbar/scb-snackbar.js +2 -2
- package/mvc/components/scb-toc/scb-toc-item.js +1 -1
- package/mvc/components/scb-toc/scb-toc.js +1 -1
- package/mvc/components/scb-viz/scb-viz.js +1 -1
- package/mvc/scb-wc-test.css +1 -1
- package/package.json +340 -307
- package/scb-calendar-card/scb-calendar-card.js +1 -1
- package/scb-icon-button/scb-icon-button.d.ts +23 -8
- package/scb-icon-button/scb-icon-button.js +106 -133
- package/scb-select/scb-select-option.d.ts +14 -0
- package/scb-select/scb-select-option.js +72 -0
- package/scb-select/scb-select.d.ts +32 -0
- package/scb-select/scb-select.js +258 -0
- package/scb-wc-test.bundle.js +837 -673
- package/scb-wc-test.css +1 -1
|
@@ -182,7 +182,7 @@ i.styles = m`
|
|
|
182
182
|
justify-content: center;
|
|
183
183
|
align-items: center;
|
|
184
184
|
gap: var(--spacing-spacing-2, 4px);
|
|
185
|
-
border-radius: var(--
|
|
185
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
186
186
|
background: var(--md-sys-color-surface-dim, #f9f8ef);
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
import { LitElement, TemplateResult, PropertyValues } from 'lit';
|
|
2
|
+
type IconVariant = 'filled' | 'outlined' | 'filled-tonal' | 'standard';
|
|
2
3
|
export declare class ScbIconButton extends LitElement {
|
|
3
|
-
|
|
4
|
-
tooltip: string;
|
|
5
|
-
variant: 'filled' | 'outlined' | 'filled-tonal' | 'standard';
|
|
4
|
+
/** Visuell ikon. */
|
|
6
5
|
icon: string;
|
|
6
|
+
/** Tooltiptext. Används som native title. */
|
|
7
|
+
tooltip: string;
|
|
8
|
+
/** Tillgänglighetslabel. Speglas till md-icon-button. */
|
|
9
|
+
ariaLabel: string;
|
|
10
|
+
/** Variant enligt Material. */
|
|
11
|
+
variant: IconVariant;
|
|
12
|
+
/** Toggle-läge. */
|
|
7
13
|
toggle: boolean;
|
|
14
|
+
/** Om komponenten är vald i toggle-läge. */
|
|
8
15
|
selected: boolean;
|
|
16
|
+
/** Ikon i otoggla(t) läge. */
|
|
9
17
|
toggleofficon: string;
|
|
18
|
+
/** Ikon i togglat läge. */
|
|
10
19
|
toggleonicon: string;
|
|
20
|
+
/** Inaktiverad. */
|
|
11
21
|
disabled: boolean;
|
|
12
22
|
private __loadedVariants;
|
|
13
23
|
private __iconLoaded;
|
|
14
|
-
private
|
|
15
|
-
private __ariaObserver?;
|
|
24
|
+
private __lastMdHost;
|
|
16
25
|
protected firstUpdated(): Promise<void>;
|
|
17
26
|
protected updated(changed: PropertyValues): void;
|
|
18
27
|
disconnectedCallback(): void;
|
|
19
28
|
private __ensureDepsLoaded;
|
|
29
|
+
/** Hitta md-* host i shadow DOM. */
|
|
20
30
|
private __getMdHost;
|
|
21
|
-
|
|
22
|
-
private __stripNativeTitles;
|
|
23
|
-
private __syncAria;
|
|
31
|
+
/** Synka selected från md-* upp till wrappern och emit change. */
|
|
24
32
|
private __onInnerChange;
|
|
33
|
+
/** Koppla change-event från md-* samt spegla selected. */
|
|
25
34
|
private __attachChangeListener;
|
|
35
|
+
/**
|
|
36
|
+
* Synkar native title och aria-* mellan host och md-*. */
|
|
37
|
+
private __syncTitleAndAria;
|
|
26
38
|
static styles: import('lit').CSSResult;
|
|
39
|
+
private __renderToggleIcons;
|
|
40
|
+
private __renderSingleIcon;
|
|
27
41
|
private __renderMd;
|
|
28
42
|
render(): TemplateResult;
|
|
29
43
|
}
|
|
@@ -32,3 +46,4 @@ declare global {
|
|
|
32
46
|
'scb-icon-button': ScbIconButton;
|
|
33
47
|
}
|
|
34
48
|
}
|
|
49
|
+
export {};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as h, LitElement as u, html as o } from "lit";
|
|
2
|
+
import { property as a, customElement as _ } from "lit/decorators.js";
|
|
3
3
|
import "@material/web/icon/icon.js";
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return r && n && g(e, i, n), n;
|
|
4
|
+
var b = Object.defineProperty, p = Object.getOwnPropertyDescriptor, n = (t, e, l, r) => {
|
|
5
|
+
for (var s = r > 1 ? void 0 : r ? p(e, l) : e, d = t.length - 1, c; d >= 0; d--)
|
|
6
|
+
(c = t[d]) && (s = (r ? c(e, l, s) : c(s)) || s);
|
|
7
|
+
return r && s && b(e, l, s), s;
|
|
9
8
|
};
|
|
10
|
-
let
|
|
9
|
+
let i = class extends u {
|
|
11
10
|
constructor() {
|
|
12
|
-
super(...arguments), this.
|
|
11
|
+
super(...arguments), this.icon = "home", this.tooltip = "", this.ariaLabel = "", this.variant = "standard", this.toggle = !1, this.selected = !1, this.toggleofficon = "add", this.toggleonicon = "remove", this.disabled = !1, this.__loadedVariants = /* @__PURE__ */ new Set(), this.__iconLoaded = !1, this.__lastMdHost = null, this.__onInnerChange = () => {
|
|
13
12
|
const t = this.__getMdHost(), e = !!(t != null && t.selected);
|
|
14
13
|
this.toggle && (this.selected = e), this.dispatchEvent(
|
|
15
14
|
new CustomEvent("change", {
|
|
@@ -21,18 +20,24 @@ let o = class extends m {
|
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
22
|
async firstUpdated() {
|
|
24
|
-
await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.
|
|
23
|
+
await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.__syncTitleAndAria();
|
|
25
24
|
}
|
|
26
25
|
updated(t) {
|
|
27
|
-
super.updated(t), t.has("variant")
|
|
28
|
-
()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
if (super.updated(t), t.has("variant")) {
|
|
27
|
+
this.__ensureDepsLoaded().then(() => {
|
|
28
|
+
queueMicrotask(() => {
|
|
29
|
+
this.__attachChangeListener(), this.__syncTitleAndAria();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
(t.has("toggle") || t.has("icon") || t.has("toggleofficon") || t.has("toggleonicon") || t.has("selected") || t.has("disabled") || t.has("tooltip") || t.has("ariaLabel")) && queueMicrotask(() => {
|
|
35
|
+
this.__attachChangeListener(), this.__syncTitleAndAria();
|
|
36
|
+
});
|
|
32
37
|
}
|
|
33
38
|
disconnectedCallback() {
|
|
34
|
-
var t, e
|
|
35
|
-
|
|
39
|
+
var t, e;
|
|
40
|
+
(e = (t = this.__lastMdHost) == null ? void 0 : t.removeEventListener) == null || e.call(t, "change", this.__onInnerChange), this.__lastMdHost = null, super.disconnectedCallback();
|
|
36
41
|
}
|
|
37
42
|
async __ensureDepsLoaded() {
|
|
38
43
|
if (!this.__loadedVariants.has(this.variant)) {
|
|
@@ -54,172 +59,140 @@ let o = class extends m {
|
|
|
54
59
|
}
|
|
55
60
|
this.__iconLoaded || (await import("@material/web/icon/icon.js"), this.__iconLoaded = !0);
|
|
56
61
|
}
|
|
57
|
-
|
|
62
|
+
/** Hitta md-* host i shadow DOM. */
|
|
58
63
|
__getMdHost() {
|
|
59
|
-
|
|
64
|
+
return this.renderRoot.querySelector(
|
|
60
65
|
"md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
|
|
61
66
|
);
|
|
62
|
-
if (t) return t;
|
|
63
|
-
const e = this.renderRoot.querySelector("scb-tooltip");
|
|
64
|
-
if (e) {
|
|
65
|
-
const i = e.querySelector(
|
|
66
|
-
"md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
|
|
67
|
-
);
|
|
68
|
-
if (i) return i;
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
__getInnerButton(t) {
|
|
73
|
-
const e = t == null ? void 0 : t.shadowRoot;
|
|
74
|
-
return e ? e.querySelector("button") || e.querySelector('[role="button"]') : null;
|
|
75
67
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
t.removeAttribute("title");
|
|
80
|
-
const e = this.__getInnerButton(t);
|
|
81
|
-
e == null || e.removeAttribute("title");
|
|
82
|
-
const i = t.shadowRoot;
|
|
83
|
-
i && i.querySelectorAll("[title]").forEach((r) => r.removeAttribute("title"));
|
|
84
|
-
}
|
|
85
|
-
__syncAria() {
|
|
86
|
-
var u;
|
|
68
|
+
/** Koppla change-event från md-* samt spegla selected. */
|
|
69
|
+
__attachChangeListener() {
|
|
70
|
+
var e, l;
|
|
87
71
|
const t = this.__getMdHost();
|
|
88
|
-
|
|
89
|
-
const e = this.__getInnerButton(t), i = (this.ariaLabel || this.getAttribute("aria-label") || "").trim() || this.icon.trim(), r = this.getAttribute("aria-controls"), n = this.getAttribute("aria-expanded");
|
|
90
|
-
e && (i ? e.setAttribute("aria-label", i) : e.removeAttribute("aria-label"), r !== null ? e.setAttribute("aria-controls", r) : e.removeAttribute("aria-controls"), n !== null ? e.setAttribute("aria-expanded", n) : e.removeAttribute("aria-expanded"), e.removeAttribute("title")), t.removeAttribute("aria-label"), t.removeAttribute("aria-controls"), t.removeAttribute("aria-expanded"), t.removeAttribute("title"), this.hasAttribute("aria-label") && this.removeAttribute("aria-label"), this.hasAttribute("aria-controls") && this.removeAttribute("aria-controls"), this.hasAttribute("aria-expanded") && this.removeAttribute("aria-expanded"), this.__stripNativeTitles(t), (u = this.__ariaObserver) == null || u.disconnect(), this.__ariaObserver = new MutationObserver(() => {
|
|
91
|
-
const a = this.__getMdHost(), c = this.__getInnerButton(a);
|
|
92
|
-
if (!a || !c) return;
|
|
93
|
-
const b = (this.ariaLabel || this.getAttribute("aria-label") || "").trim() || this.icon.trim(), h = this.getAttribute("aria-controls"), _ = this.getAttribute("aria-expanded");
|
|
94
|
-
b ? c.setAttribute("aria-label", b) : c.removeAttribute("aria-label"), h !== null ? c.setAttribute("aria-controls", h) : c.removeAttribute("aria-controls"), _ !== null ? c.setAttribute("aria-expanded", _) : c.removeAttribute("aria-expanded"), this.__stripNativeTitles(a), a.removeAttribute("aria-label"), a.removeAttribute("aria-controls"), a.removeAttribute("aria-expanded"), a.removeAttribute("title"), this.hasAttribute("aria-label") && this.removeAttribute("aria-label"), this.hasAttribute("aria-controls") && this.removeAttribute("aria-controls"), this.hasAttribute("aria-expanded") && this.removeAttribute("aria-expanded");
|
|
95
|
-
}), this.__ariaObserver.observe(this, {
|
|
96
|
-
attributes: !0,
|
|
97
|
-
attributeFilter: ["aria-label", "aria-controls", "aria-expanded"]
|
|
98
|
-
});
|
|
72
|
+
t && t !== this.__lastMdHost && ((l = (e = this.__lastMdHost) == null ? void 0 : e.removeEventListener) == null || l.call(e, "change", this.__onInnerChange), t.addEventListener("change", this.__onInnerChange), this.__lastMdHost = t), this.toggle && t && "selected" in t && (t.selected = this.selected);
|
|
99
73
|
}
|
|
100
|
-
|
|
101
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Synkar native title och aria-* mellan host och md-*. */
|
|
76
|
+
__syncTitleAndAria() {
|
|
102
77
|
const t = this.__getMdHost();
|
|
103
|
-
|
|
78
|
+
if (!t) return;
|
|
79
|
+
const e = (this.tooltip || this.getAttribute("title") || "").trim(), l = (this.ariaLabel || this.getAttribute("aria-label") || "").trim(), r = this.getAttribute("aria-controls"), s = this.getAttribute("aria-expanded");
|
|
80
|
+
this.tooltip && this.setAttribute("title", e);
|
|
81
|
+
const d = l || e || this.icon.trim() || void 0;
|
|
82
|
+
d ? t.setAttribute("aria-label", d) : t.removeAttribute("aria-label"), e ? t.setAttribute("title", e) : t.removeAttribute("title"), r !== null ? t.setAttribute("aria-controls", r) : t.removeAttribute("aria-controls"), s !== null ? t.setAttribute("aria-expanded", s) : t.removeAttribute("aria-expanded");
|
|
104
83
|
}
|
|
105
|
-
|
|
106
|
-
|
|
84
|
+
__renderToggleIcons() {
|
|
85
|
+
return o`
|
|
107
86
|
<md-icon aria-hidden="true">${this.toggleofficon}</md-icon>
|
|
108
87
|
<md-icon slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
|
|
109
|
-
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
__renderSingleIcon() {
|
|
91
|
+
return o`<md-icon aria-hidden="true">${this.icon}</md-icon>`;
|
|
92
|
+
}
|
|
93
|
+
__renderMd() {
|
|
94
|
+
const t = this.toggle ? this.__renderToggleIcons() : this.__renderSingleIcon();
|
|
110
95
|
if (this.toggle)
|
|
111
96
|
switch (this.variant) {
|
|
112
97
|
case "filled":
|
|
113
|
-
return
|
|
98
|
+
return o`
|
|
114
99
|
<md-filled-icon-button
|
|
115
|
-
?scb-tooltip-button=${e}
|
|
116
100
|
toggle
|
|
117
101
|
?selected=${this.selected}
|
|
118
102
|
?disabled=${this.disabled}
|
|
119
|
-
|
|
103
|
+
>
|
|
104
|
+
${t}
|
|
105
|
+
</md-filled-icon-button>
|
|
120
106
|
`;
|
|
121
107
|
case "outlined":
|
|
122
|
-
return
|
|
108
|
+
return o`
|
|
123
109
|
<md-outlined-icon-button
|
|
124
|
-
?scb-tooltip-button=${e}
|
|
125
110
|
toggle
|
|
126
111
|
?selected=${this.selected}
|
|
127
112
|
?disabled=${this.disabled}
|
|
128
|
-
|
|
113
|
+
>
|
|
114
|
+
${t}
|
|
115
|
+
</md-outlined-icon-button>
|
|
129
116
|
`;
|
|
130
117
|
case "filled-tonal":
|
|
131
|
-
return
|
|
118
|
+
return o`
|
|
132
119
|
<md-filled-tonal-icon-button
|
|
133
|
-
?scb-tooltip-button=${e}
|
|
134
120
|
toggle
|
|
135
121
|
?selected=${this.selected}
|
|
136
122
|
?disabled=${this.disabled}
|
|
137
|
-
|
|
123
|
+
>
|
|
124
|
+
${t}
|
|
125
|
+
</md-filled-tonal-icon-button>
|
|
138
126
|
`;
|
|
139
127
|
default:
|
|
140
|
-
return
|
|
141
|
-
<md-icon-button
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
?selected=${this.selected}
|
|
145
|
-
?disabled=${this.disabled}
|
|
146
|
-
>${i}</md-icon-button>
|
|
128
|
+
return o`
|
|
129
|
+
<md-icon-button toggle ?selected=${this.selected} ?disabled=${this.disabled}>
|
|
130
|
+
${t}
|
|
131
|
+
</md-icon-button>
|
|
147
132
|
`;
|
|
148
133
|
}
|
|
149
134
|
switch (this.variant) {
|
|
150
135
|
case "filled":
|
|
151
|
-
return
|
|
152
|
-
<md-filled-icon-button ?
|
|
153
|
-
${
|
|
136
|
+
return o`
|
|
137
|
+
<md-filled-icon-button ?disabled=${this.disabled}>
|
|
138
|
+
${t}
|
|
154
139
|
</md-filled-icon-button>
|
|
155
140
|
`;
|
|
156
141
|
case "outlined":
|
|
157
|
-
return
|
|
158
|
-
<md-outlined-icon-button ?
|
|
159
|
-
${
|
|
142
|
+
return o`
|
|
143
|
+
<md-outlined-icon-button ?disabled=${this.disabled}>
|
|
144
|
+
${t}
|
|
160
145
|
</md-outlined-icon-button>
|
|
161
146
|
`;
|
|
162
147
|
case "filled-tonal":
|
|
163
|
-
return
|
|
164
|
-
<md-filled-tonal-icon-button ?
|
|
165
|
-
${
|
|
148
|
+
return o`
|
|
149
|
+
<md-filled-tonal-icon-button ?disabled=${this.disabled}>
|
|
150
|
+
${t}
|
|
166
151
|
</md-filled-tonal-icon-button>
|
|
167
152
|
`;
|
|
168
153
|
default:
|
|
169
|
-
return
|
|
170
|
-
<md-icon-button ?
|
|
171
|
-
${
|
|
154
|
+
return o`
|
|
155
|
+
<md-icon-button ?disabled=${this.disabled}>
|
|
156
|
+
${t}
|
|
172
157
|
</md-icon-button>
|
|
173
158
|
`;
|
|
174
159
|
}
|
|
175
160
|
}
|
|
176
161
|
render() {
|
|
177
|
-
|
|
178
|
-
return t ? s`
|
|
179
|
-
<scb-tooltip
|
|
180
|
-
variant="plain"
|
|
181
|
-
position="top"
|
|
182
|
-
trigger="hover"
|
|
183
|
-
.delay=${0.12}
|
|
184
|
-
.arrow=${!0}
|
|
185
|
-
supporting-text=${t}
|
|
186
|
-
>
|
|
187
|
-
${this.__renderMd(!0)}
|
|
188
|
-
</scb-tooltip>
|
|
189
|
-
` : this.__renderMd(!1);
|
|
162
|
+
return this.__renderMd();
|
|
190
163
|
}
|
|
191
164
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
],
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
],
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
],
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
],
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
],
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
],
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
],
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
],
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
],
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
],
|
|
165
|
+
i.styles = h``;
|
|
166
|
+
n([
|
|
167
|
+
a({ type: String })
|
|
168
|
+
], i.prototype, "icon", 2);
|
|
169
|
+
n([
|
|
170
|
+
a({ type: String })
|
|
171
|
+
], i.prototype, "tooltip", 2);
|
|
172
|
+
n([
|
|
173
|
+
a({ type: String, attribute: "aria-label" })
|
|
174
|
+
], i.prototype, "ariaLabel", 2);
|
|
175
|
+
n([
|
|
176
|
+
a({ type: String })
|
|
177
|
+
], i.prototype, "variant", 2);
|
|
178
|
+
n([
|
|
179
|
+
a({ type: Boolean, reflect: !0 })
|
|
180
|
+
], i.prototype, "toggle", 2);
|
|
181
|
+
n([
|
|
182
|
+
a({ type: Boolean, reflect: !0 })
|
|
183
|
+
], i.prototype, "selected", 2);
|
|
184
|
+
n([
|
|
185
|
+
a({ type: String })
|
|
186
|
+
], i.prototype, "toggleofficon", 2);
|
|
187
|
+
n([
|
|
188
|
+
a({ type: String })
|
|
189
|
+
], i.prototype, "toggleonicon", 2);
|
|
190
|
+
n([
|
|
191
|
+
a({ type: Boolean, reflect: !0 })
|
|
192
|
+
], i.prototype, "disabled", 2);
|
|
193
|
+
i = n([
|
|
194
|
+
_("scb-icon-button")
|
|
195
|
+
], i);
|
|
223
196
|
export {
|
|
224
|
-
|
|
197
|
+
i as ScbIconButton
|
|
225
198
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Option-element för scb-select.
|
|
4
|
+
* @slot - Texten som visas i optionen
|
|
5
|
+
*/
|
|
6
|
+
export declare class ScbSelectOption extends LitElement {
|
|
7
|
+
value: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
showCheckbox: boolean;
|
|
10
|
+
checked: boolean;
|
|
11
|
+
showRadio: boolean;
|
|
12
|
+
static styles: import('lit').CSSResult;
|
|
13
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { css as h, LitElement as p, html as d } from "lit";
|
|
2
|
+
import { property as s, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import "@material/web/icon/icon.js";
|
|
4
|
+
import "@material/web/ripple/ripple.js";
|
|
5
|
+
import "@material/web/focus/md-focus-ring.js";
|
|
6
|
+
var y = Object.defineProperty, u = Object.getOwnPropertyDescriptor, t = (n, i, r, c) => {
|
|
7
|
+
for (var o = c > 1 ? void 0 : c ? u(i, r) : i, a = n.length - 1, l; a >= 0; a--)
|
|
8
|
+
(l = n[a]) && (o = (c ? l(i, r, o) : l(o)) || o);
|
|
9
|
+
return c && o && y(i, r, o), o;
|
|
10
|
+
};
|
|
11
|
+
let e = class extends p {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.value = "", this.disabled = !1, this.showCheckbox = !1, this.checked = !1, this.showRadio = !1;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return d`
|
|
17
|
+
<div tabindex="0" class="item ${this.checked ? "checked" : ""}" value=${this.value} ?disabled=${this.disabled}>
|
|
18
|
+
<md-ripple></md-ripple>
|
|
19
|
+
${this.showCheckbox ? d`<md-icon class="${this.checked ? "checkbox-checked" : ""}">${this.checked ? "check_box" : "check_box_outline_blank"}</md-icon>` : null}
|
|
20
|
+
${this.showRadio ? d`<md-icon class="${this.checked ? "radio-checked" : ""}">${this.checked ? "radio_button_checked" : "radio_button_unchecked"}</md-icon>` : null}
|
|
21
|
+
<slot></slot>
|
|
22
|
+
<md-focus-ring inward></md-focus-ring>
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
e.styles = h`
|
|
28
|
+
.item {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
padding: var(--spacing-3) var(--spacing-5);
|
|
32
|
+
gap: var(--spacing-4);
|
|
33
|
+
min-height: 40px;
|
|
34
|
+
position: relative;
|
|
35
|
+
font-size: var(--md-sys-typescale-body-large-size);
|
|
36
|
+
line-height: var(--md-sys-typescale-body-large-line-height);
|
|
37
|
+
letter-spacing: var(--md-sys-typescale-body-large-tracking);
|
|
38
|
+
}
|
|
39
|
+
.item:focus-within {
|
|
40
|
+
outline: none;
|
|
41
|
+
}
|
|
42
|
+
md-focus-ring {
|
|
43
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
44
|
+
}
|
|
45
|
+
.item.checked {
|
|
46
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
47
|
+
}
|
|
48
|
+
md-icon.radio-checked{
|
|
49
|
+
color: var(--md-sys-color-primary);
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
t([
|
|
53
|
+
s({ type: String })
|
|
54
|
+
], e.prototype, "value", 2);
|
|
55
|
+
t([
|
|
56
|
+
s({ type: Boolean, reflect: !0 })
|
|
57
|
+
], e.prototype, "disabled", 2);
|
|
58
|
+
t([
|
|
59
|
+
s({ type: Boolean })
|
|
60
|
+
], e.prototype, "showCheckbox", 2);
|
|
61
|
+
t([
|
|
62
|
+
s({ type: Boolean })
|
|
63
|
+
], e.prototype, "checked", 2);
|
|
64
|
+
t([
|
|
65
|
+
s({ type: Boolean })
|
|
66
|
+
], e.prototype, "showRadio", 2);
|
|
67
|
+
e = t([
|
|
68
|
+
m("scb-select-option")
|
|
69
|
+
], e);
|
|
70
|
+
export {
|
|
71
|
+
e as ScbSelectOption
|
|
72
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Select-komponent med slot för scb-select-option.
|
|
4
|
+
* @slot - Alternativ (scb-select-option)
|
|
5
|
+
*/
|
|
6
|
+
export declare class ScbSelect extends LitElement {
|
|
7
|
+
focusedIndex: number;
|
|
8
|
+
variant: 'single-select' | 'multi-select';
|
|
9
|
+
value: string;
|
|
10
|
+
values: string[];
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
open: boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
name: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
supportingText: string;
|
|
17
|
+
withRadiobuttons: boolean;
|
|
18
|
+
static styles: import('lit').CSSResult;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
disconnectedCallback(): void;
|
|
21
|
+
private _onDocumentClick;
|
|
22
|
+
private _toggleOpen;
|
|
23
|
+
private _selectOption;
|
|
24
|
+
private _onSlotClick;
|
|
25
|
+
private _getSelectedLabel;
|
|
26
|
+
firstUpdated(): void;
|
|
27
|
+
updated(): void;
|
|
28
|
+
private _updateOptionsChecked;
|
|
29
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
30
|
+
private _onKeyDown;
|
|
31
|
+
private _onOptionKeyDown;
|
|
32
|
+
}
|