@politiet/sheriff-web-components 0.6.4 → 0.6.5
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/dist/sheriff-web-components.js +3626 -0
- package/package.json +1 -1
|
@@ -0,0 +1,3626 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const t$3 = globalThis, e$7 = t$3.ShadowRoot && (void 0 === t$3.ShadyCSS || t$3.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$1 = Symbol(), o$5 = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let n$3 = class n {
|
|
8
|
+
constructor(t2, e2, o2) {
|
|
9
|
+
if (this._$cssResult$ = true, o2 !== s$1) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
|
+
this.cssText = t2, this.t = e2;
|
|
11
|
+
}
|
|
12
|
+
get styleSheet() {
|
|
13
|
+
let t2 = this.o;
|
|
14
|
+
const s2 = this.t;
|
|
15
|
+
if (e$7 && void 0 === t2) {
|
|
16
|
+
const e2 = void 0 !== s2 && 1 === s2.length;
|
|
17
|
+
e2 && (t2 = o$5.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$5.set(s2, t2));
|
|
18
|
+
}
|
|
19
|
+
return t2;
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return this.cssText;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const r$5 = (t2) => new n$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$1), i$4 = (t2, ...e2) => {
|
|
26
|
+
const o2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, o3) => e3 + ((t3) => {
|
|
27
|
+
if (true === t3._$cssResult$) return t3.cssText;
|
|
28
|
+
if ("number" == typeof t3) return t3;
|
|
29
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
|
+
})(s2) + t2[o3 + 1], t2[0]);
|
|
31
|
+
return new n$3(o2, t2, s$1);
|
|
32
|
+
}, S$1 = (s2, o2) => {
|
|
33
|
+
if (e$7) s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
|
|
34
|
+
else for (const e2 of o2) {
|
|
35
|
+
const o3 = document.createElement("style"), n3 = t$3.litNonce;
|
|
36
|
+
void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
|
|
37
|
+
}
|
|
38
|
+
}, c$2 = e$7 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
|
|
39
|
+
let e2 = "";
|
|
40
|
+
for (const s2 of t3.cssRules) e2 += s2.cssText;
|
|
41
|
+
return r$5(e2);
|
|
42
|
+
})(t2) : t2;
|
|
43
|
+
/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2017 Google LLC
|
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
+
*/
|
|
48
|
+
const { is: i$3, defineProperty: e$6, getOwnPropertyDescriptor: r$4, getOwnPropertyNames: h$1, getOwnPropertySymbols: o$4, getPrototypeOf: n$2 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
|
|
49
|
+
switch (s2) {
|
|
50
|
+
case Boolean:
|
|
51
|
+
t2 = t2 ? l$1 : null;
|
|
52
|
+
break;
|
|
53
|
+
case Object:
|
|
54
|
+
case Array:
|
|
55
|
+
t2 = null == t2 ? t2 : JSON.stringify(t2);
|
|
56
|
+
}
|
|
57
|
+
return t2;
|
|
58
|
+
}, fromAttribute(t2, s2) {
|
|
59
|
+
let i2 = t2;
|
|
60
|
+
switch (s2) {
|
|
61
|
+
case Boolean:
|
|
62
|
+
i2 = null !== t2;
|
|
63
|
+
break;
|
|
64
|
+
case Number:
|
|
65
|
+
i2 = null === t2 ? null : Number(t2);
|
|
66
|
+
break;
|
|
67
|
+
case Object:
|
|
68
|
+
case Array:
|
|
69
|
+
try {
|
|
70
|
+
i2 = JSON.parse(t2);
|
|
71
|
+
} catch (t3) {
|
|
72
|
+
i2 = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return i2;
|
|
76
|
+
} }, f$1 = (t2, s2) => !i$3(t2, s2), y$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 };
|
|
77
|
+
Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
78
|
+
class b extends HTMLElement {
|
|
79
|
+
static addInitializer(t2) {
|
|
80
|
+
this._$Ei(), (this.l ??= []).push(t2);
|
|
81
|
+
}
|
|
82
|
+
static get observedAttributes() {
|
|
83
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
|
+
}
|
|
85
|
+
static createProperty(t2, s2 = y$1) {
|
|
86
|
+
if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t2, s2), !s2.noAccessor) {
|
|
87
|
+
const i2 = Symbol(), r3 = this.getPropertyDescriptor(t2, i2, s2);
|
|
88
|
+
void 0 !== r3 && e$6(this.prototype, t2, r3);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
static getPropertyDescriptor(t2, s2, i2) {
|
|
92
|
+
const { get: e2, set: h2 } = r$4(this.prototype, t2) ?? { get() {
|
|
93
|
+
return this[s2];
|
|
94
|
+
}, set(t3) {
|
|
95
|
+
this[s2] = t3;
|
|
96
|
+
} };
|
|
97
|
+
return { get() {
|
|
98
|
+
return e2?.call(this);
|
|
99
|
+
}, set(s3) {
|
|
100
|
+
const r3 = e2?.call(this);
|
|
101
|
+
h2.call(this, s3), this.requestUpdate(t2, r3, i2);
|
|
102
|
+
}, configurable: true, enumerable: true };
|
|
103
|
+
}
|
|
104
|
+
static getPropertyOptions(t2) {
|
|
105
|
+
return this.elementProperties.get(t2) ?? y$1;
|
|
106
|
+
}
|
|
107
|
+
static _$Ei() {
|
|
108
|
+
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
109
|
+
const t2 = n$2(this);
|
|
110
|
+
t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
|
|
111
|
+
}
|
|
112
|
+
static finalize() {
|
|
113
|
+
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
114
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
115
|
+
const t3 = this.properties, s2 = [...h$1(t3), ...o$4(t3)];
|
|
116
|
+
for (const i2 of s2) this.createProperty(i2, t3[i2]);
|
|
117
|
+
}
|
|
118
|
+
const t2 = this[Symbol.metadata];
|
|
119
|
+
if (null !== t2) {
|
|
120
|
+
const s2 = litPropertyMetadata.get(t2);
|
|
121
|
+
if (void 0 !== s2) for (const [t3, i2] of s2) this.elementProperties.set(t3, i2);
|
|
122
|
+
}
|
|
123
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const [t3, s2] of this.elementProperties) {
|
|
125
|
+
const i2 = this._$Eu(t3, s2);
|
|
126
|
+
void 0 !== i2 && this._$Eh.set(i2, t3);
|
|
127
|
+
}
|
|
128
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
129
|
+
}
|
|
130
|
+
static finalizeStyles(s2) {
|
|
131
|
+
const i2 = [];
|
|
132
|
+
if (Array.isArray(s2)) {
|
|
133
|
+
const e2 = new Set(s2.flat(1 / 0).reverse());
|
|
134
|
+
for (const s3 of e2) i2.unshift(c$2(s3));
|
|
135
|
+
} else void 0 !== s2 && i2.push(c$2(s2));
|
|
136
|
+
return i2;
|
|
137
|
+
}
|
|
138
|
+
static _$Eu(t2, s2) {
|
|
139
|
+
const i2 = s2.attribute;
|
|
140
|
+
return false === i2 ? void 0 : "string" == typeof i2 ? i2 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
|
|
141
|
+
}
|
|
142
|
+
constructor() {
|
|
143
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
144
|
+
}
|
|
145
|
+
_$Ev() {
|
|
146
|
+
this._$ES = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t2) => t2(this));
|
|
147
|
+
}
|
|
148
|
+
addController(t2) {
|
|
149
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(t2), void 0 !== this.renderRoot && this.isConnected && t2.hostConnected?.();
|
|
150
|
+
}
|
|
151
|
+
removeController(t2) {
|
|
152
|
+
this._$EO?.delete(t2);
|
|
153
|
+
}
|
|
154
|
+
_$E_() {
|
|
155
|
+
const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
|
|
156
|
+
for (const i2 of s2.keys()) this.hasOwnProperty(i2) && (t2.set(i2, this[i2]), delete this[i2]);
|
|
157
|
+
t2.size > 0 && (this._$Ep = t2);
|
|
158
|
+
}
|
|
159
|
+
createRenderRoot() {
|
|
160
|
+
const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
161
|
+
return S$1(t2, this.constructor.elementStyles), t2;
|
|
162
|
+
}
|
|
163
|
+
connectedCallback() {
|
|
164
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t2) => t2.hostConnected?.());
|
|
165
|
+
}
|
|
166
|
+
enableUpdating(t2) {
|
|
167
|
+
}
|
|
168
|
+
disconnectedCallback() {
|
|
169
|
+
this._$EO?.forEach((t2) => t2.hostDisconnected?.());
|
|
170
|
+
}
|
|
171
|
+
attributeChangedCallback(t2, s2, i2) {
|
|
172
|
+
this._$AK(t2, i2);
|
|
173
|
+
}
|
|
174
|
+
_$EC(t2, s2) {
|
|
175
|
+
const i2 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i2);
|
|
176
|
+
if (void 0 !== e2 && true === i2.reflect) {
|
|
177
|
+
const r3 = (void 0 !== i2.converter?.toAttribute ? i2.converter : u$1).toAttribute(s2, i2.type);
|
|
178
|
+
this._$Em = t2, null == r3 ? this.removeAttribute(e2) : this.setAttribute(e2, r3), this._$Em = null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
_$AK(t2, s2) {
|
|
182
|
+
const i2 = this.constructor, e2 = i2._$Eh.get(t2);
|
|
183
|
+
if (void 0 !== e2 && this._$Em !== e2) {
|
|
184
|
+
const t3 = i2.getPropertyOptions(e2), r3 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== t3.converter?.fromAttribute ? t3.converter : u$1;
|
|
185
|
+
this._$Em = e2, this[e2] = r3.fromAttribute(s2, t3.type), this._$Em = null;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
requestUpdate(t2, s2, i2) {
|
|
189
|
+
if (void 0 !== t2) {
|
|
190
|
+
if (i2 ??= this.constructor.getPropertyOptions(t2), !(i2.hasChanged ?? f$1)(this[t2], s2)) return;
|
|
191
|
+
this.P(t2, s2, i2);
|
|
192
|
+
}
|
|
193
|
+
false === this.isUpdatePending && (this._$ES = this._$ET());
|
|
194
|
+
}
|
|
195
|
+
P(t2, s2, i2) {
|
|
196
|
+
this._$AL.has(t2) || this._$AL.set(t2, s2), true === i2.reflect && this._$Em !== t2 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t2);
|
|
197
|
+
}
|
|
198
|
+
async _$ET() {
|
|
199
|
+
this.isUpdatePending = true;
|
|
200
|
+
try {
|
|
201
|
+
await this._$ES;
|
|
202
|
+
} catch (t3) {
|
|
203
|
+
Promise.reject(t3);
|
|
204
|
+
}
|
|
205
|
+
const t2 = this.scheduleUpdate();
|
|
206
|
+
return null != t2 && await t2, !this.isUpdatePending;
|
|
207
|
+
}
|
|
208
|
+
scheduleUpdate() {
|
|
209
|
+
return this.performUpdate();
|
|
210
|
+
}
|
|
211
|
+
performUpdate() {
|
|
212
|
+
if (!this.isUpdatePending) return;
|
|
213
|
+
if (!this.hasUpdated) {
|
|
214
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
215
|
+
for (const [t4, s3] of this._$Ep) this[t4] = s3;
|
|
216
|
+
this._$Ep = void 0;
|
|
217
|
+
}
|
|
218
|
+
const t3 = this.constructor.elementProperties;
|
|
219
|
+
if (t3.size > 0) for (const [s3, i2] of t3) true !== i2.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.P(s3, this[s3], i2);
|
|
220
|
+
}
|
|
221
|
+
let t2 = false;
|
|
222
|
+
const s2 = this._$AL;
|
|
223
|
+
try {
|
|
224
|
+
t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), this._$EO?.forEach((t3) => t3.hostUpdate?.()), this.update(s2)) : this._$EU();
|
|
225
|
+
} catch (s3) {
|
|
226
|
+
throw t2 = false, this._$EU(), s3;
|
|
227
|
+
}
|
|
228
|
+
t2 && this._$AE(s2);
|
|
229
|
+
}
|
|
230
|
+
willUpdate(t2) {
|
|
231
|
+
}
|
|
232
|
+
_$AE(t2) {
|
|
233
|
+
this._$EO?.forEach((t3) => t3.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
|
|
234
|
+
}
|
|
235
|
+
_$EU() {
|
|
236
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
237
|
+
}
|
|
238
|
+
get updateComplete() {
|
|
239
|
+
return this.getUpdateComplete();
|
|
240
|
+
}
|
|
241
|
+
getUpdateComplete() {
|
|
242
|
+
return this._$ES;
|
|
243
|
+
}
|
|
244
|
+
shouldUpdate(t2) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
update(t2) {
|
|
248
|
+
this._$Ej &&= this._$Ej.forEach((t3) => this._$EC(t3, this[t3])), this._$EU();
|
|
249
|
+
}
|
|
250
|
+
updated(t2) {
|
|
251
|
+
}
|
|
252
|
+
firstUpdated(t2) {
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d$1("elementProperties")] = /* @__PURE__ */ new Map(), b[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: b }), (a$1.reactiveElementVersions ??= []).push("2.0.4");
|
|
256
|
+
/**
|
|
257
|
+
* @license
|
|
258
|
+
* Copyright 2017 Google LLC
|
|
259
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
260
|
+
*/
|
|
261
|
+
const t$2 = globalThis, i$2 = t$2.trustedTypes, s = i$2 ? i$2.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$5 = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$3 = "?" + h, n$1 = `<${o$3}>`, r$3 = document, l = () => r$3.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof t2?.[Symbol.iterator], d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
262
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = y(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$3.createTreeWalker(r$3, 129);
|
|
263
|
+
function P(t2, i2) {
|
|
264
|
+
if (!a(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
265
|
+
return void 0 !== s ? s.createHTML(i2) : i2;
|
|
266
|
+
}
|
|
267
|
+
const V = (t2, i2) => {
|
|
268
|
+
const s2 = t2.length - 1, o2 = [];
|
|
269
|
+
let r3, l2 = 2 === i2 ? "<svg>" : 3 === i2 ? "<math>" : "", c2 = f;
|
|
270
|
+
for (let i3 = 0; i3 < s2; i3++) {
|
|
271
|
+
const s3 = t2[i3];
|
|
272
|
+
let a2, u2, d2 = -1, y2 = 0;
|
|
273
|
+
for (; y2 < s3.length && (c2.lastIndex = y2, u2 = c2.exec(s3), null !== u2); ) y2 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r3 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r3 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r3 = void 0);
|
|
274
|
+
const x2 = c2 === m && t2[i3 + 1].startsWith("/>") ? " " : "";
|
|
275
|
+
l2 += c2 === f ? s3 + n$1 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$5 + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i3 : x2);
|
|
276
|
+
}
|
|
277
|
+
return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i2 ? "</svg>" : 3 === i2 ? "</math>" : "")), o2];
|
|
278
|
+
};
|
|
279
|
+
class N {
|
|
280
|
+
constructor({ strings: t2, _$litType$: s2 }, n3) {
|
|
281
|
+
let r3;
|
|
282
|
+
this.parts = [];
|
|
283
|
+
let c2 = 0, a2 = 0;
|
|
284
|
+
const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2);
|
|
285
|
+
if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
|
|
286
|
+
const t3 = this.el.content.firstChild;
|
|
287
|
+
t3.replaceWith(...t3.childNodes);
|
|
288
|
+
}
|
|
289
|
+
for (; null !== (r3 = C.nextNode()) && d2.length < u2; ) {
|
|
290
|
+
if (1 === r3.nodeType) {
|
|
291
|
+
if (r3.hasAttributes()) for (const t3 of r3.getAttributeNames()) if (t3.endsWith(e$5)) {
|
|
292
|
+
const i2 = v2[a2++], s3 = r3.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i2);
|
|
293
|
+
d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r3.removeAttribute(t3);
|
|
294
|
+
} else t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r3.removeAttribute(t3));
|
|
295
|
+
if ($.test(r3.tagName)) {
|
|
296
|
+
const t3 = r3.textContent.split(h), s3 = t3.length - 1;
|
|
297
|
+
if (s3 > 0) {
|
|
298
|
+
r3.textContent = i$2 ? i$2.emptyScript : "";
|
|
299
|
+
for (let i2 = 0; i2 < s3; i2++) r3.append(t3[i2], l()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
|
|
300
|
+
r3.append(t3[s3], l());
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
} else if (8 === r3.nodeType) if (r3.data === o$3) d2.push({ type: 2, index: c2 });
|
|
304
|
+
else {
|
|
305
|
+
let t3 = -1;
|
|
306
|
+
for (; -1 !== (t3 = r3.data.indexOf(h, t3 + 1)); ) d2.push({ type: 7, index: c2 }), t3 += h.length - 1;
|
|
307
|
+
}
|
|
308
|
+
c2++;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
static createElement(t2, i2) {
|
|
312
|
+
const s2 = r$3.createElement("template");
|
|
313
|
+
return s2.innerHTML = t2, s2;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function S(t2, i2, s2 = t2, e2) {
|
|
317
|
+
if (i2 === T) return i2;
|
|
318
|
+
let h2 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
|
|
319
|
+
const o2 = c(i2) ? void 0 : i2._$litDirective$;
|
|
320
|
+
return h2?.constructor !== o2 && (h2?._$AO?.(false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ??= [])[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i2 = S(t2, h2._$AS(t2, i2.values), h2, e2)), i2;
|
|
321
|
+
}
|
|
322
|
+
class M {
|
|
323
|
+
constructor(t2, i2) {
|
|
324
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i2;
|
|
325
|
+
}
|
|
326
|
+
get parentNode() {
|
|
327
|
+
return this._$AM.parentNode;
|
|
328
|
+
}
|
|
329
|
+
get _$AU() {
|
|
330
|
+
return this._$AM._$AU;
|
|
331
|
+
}
|
|
332
|
+
u(t2) {
|
|
333
|
+
const { el: { content: i2 }, parts: s2 } = this._$AD, e2 = (t2?.creationScope ?? r$3).importNode(i2, true);
|
|
334
|
+
C.currentNode = e2;
|
|
335
|
+
let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
|
|
336
|
+
for (; void 0 !== l2; ) {
|
|
337
|
+
if (o2 === l2.index) {
|
|
338
|
+
let i3;
|
|
339
|
+
2 === l2.type ? i3 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i3 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i3 = new z(h2, this, t2)), this._$AV.push(i3), l2 = s2[++n3];
|
|
340
|
+
}
|
|
341
|
+
o2 !== l2?.index && (h2 = C.nextNode(), o2++);
|
|
342
|
+
}
|
|
343
|
+
return C.currentNode = r$3, e2;
|
|
344
|
+
}
|
|
345
|
+
p(t2) {
|
|
346
|
+
let i2 = 0;
|
|
347
|
+
for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i2), i2 += s2.strings.length - 2) : s2._$AI(t2[i2])), i2++;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
class R {
|
|
351
|
+
get _$AU() {
|
|
352
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
353
|
+
}
|
|
354
|
+
constructor(t2, i2, s2, e2) {
|
|
355
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
|
|
356
|
+
}
|
|
357
|
+
get parentNode() {
|
|
358
|
+
let t2 = this._$AA.parentNode;
|
|
359
|
+
const i2 = this._$AM;
|
|
360
|
+
return void 0 !== i2 && 11 === t2?.nodeType && (t2 = i2.parentNode), t2;
|
|
361
|
+
}
|
|
362
|
+
get startNode() {
|
|
363
|
+
return this._$AA;
|
|
364
|
+
}
|
|
365
|
+
get endNode() {
|
|
366
|
+
return this._$AB;
|
|
367
|
+
}
|
|
368
|
+
_$AI(t2, i2 = this) {
|
|
369
|
+
t2 = S(this, t2, i2), c(t2) ? t2 === E || null == t2 || "" === t2 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t2 !== this._$AH && t2 !== T && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u(t2) ? this.k(t2) : this._(t2);
|
|
370
|
+
}
|
|
371
|
+
O(t2) {
|
|
372
|
+
return this._$AA.parentNode.insertBefore(t2, this._$AB);
|
|
373
|
+
}
|
|
374
|
+
T(t2) {
|
|
375
|
+
this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
|
|
376
|
+
}
|
|
377
|
+
_(t2) {
|
|
378
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r$3.createTextNode(t2)), this._$AH = t2;
|
|
379
|
+
}
|
|
380
|
+
$(t2) {
|
|
381
|
+
const { values: i2, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N.createElement(P(s2.h, s2.h[0]), this.options)), s2);
|
|
382
|
+
if (this._$AH?._$AD === e2) this._$AH.p(i2);
|
|
383
|
+
else {
|
|
384
|
+
const t3 = new M(e2, this), s3 = t3.u(this.options);
|
|
385
|
+
t3.p(i2), this.T(s3), this._$AH = t3;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
_$AC(t2) {
|
|
389
|
+
let i2 = A.get(t2.strings);
|
|
390
|
+
return void 0 === i2 && A.set(t2.strings, i2 = new N(t2)), i2;
|
|
391
|
+
}
|
|
392
|
+
k(t2) {
|
|
393
|
+
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
394
|
+
const i2 = this._$AH;
|
|
395
|
+
let s2, e2 = 0;
|
|
396
|
+
for (const h2 of t2) e2 === i2.length ? i2.push(s2 = new R(this.O(l()), this.O(l()), this, this.options)) : s2 = i2[e2], s2._$AI(h2), e2++;
|
|
397
|
+
e2 < i2.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i2.length = e2);
|
|
398
|
+
}
|
|
399
|
+
_$AR(t2 = this._$AA.nextSibling, i2) {
|
|
400
|
+
for (this._$AP?.(false, true, i2); t2 && t2 !== this._$AB; ) {
|
|
401
|
+
const i3 = t2.nextSibling;
|
|
402
|
+
t2.remove(), t2 = i3;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
setConnected(t2) {
|
|
406
|
+
void 0 === this._$AM && (this._$Cv = t2, this._$AP?.(t2));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
class k {
|
|
410
|
+
get tagName() {
|
|
411
|
+
return this.element.tagName;
|
|
412
|
+
}
|
|
413
|
+
get _$AU() {
|
|
414
|
+
return this._$AM._$AU;
|
|
415
|
+
}
|
|
416
|
+
constructor(t2, i2, s2, e2, h2) {
|
|
417
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t2, this.name = i2, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E;
|
|
418
|
+
}
|
|
419
|
+
_$AI(t2, i2 = this, s2, e2) {
|
|
420
|
+
const h2 = this.strings;
|
|
421
|
+
let o2 = false;
|
|
422
|
+
if (void 0 === h2) t2 = S(this, t2, i2, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== T, o2 && (this._$AH = t2);
|
|
423
|
+
else {
|
|
424
|
+
const e3 = t2;
|
|
425
|
+
let n3, r3;
|
|
426
|
+
for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r3 = S(this, e3[s2 + n3], i2, n3), r3 === T && (r3 = this._$AH[n3]), o2 ||= !c(r3) || r3 !== this._$AH[n3], r3 === E ? t2 = E : t2 !== E && (t2 += (r3 ?? "") + h2[n3 + 1]), this._$AH[n3] = r3;
|
|
427
|
+
}
|
|
428
|
+
o2 && !e2 && this.j(t2);
|
|
429
|
+
}
|
|
430
|
+
j(t2) {
|
|
431
|
+
t2 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
class H extends k {
|
|
435
|
+
constructor() {
|
|
436
|
+
super(...arguments), this.type = 3;
|
|
437
|
+
}
|
|
438
|
+
j(t2) {
|
|
439
|
+
this.element[this.name] = t2 === E ? void 0 : t2;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
class I extends k {
|
|
443
|
+
constructor() {
|
|
444
|
+
super(...arguments), this.type = 4;
|
|
445
|
+
}
|
|
446
|
+
j(t2) {
|
|
447
|
+
this.element.toggleAttribute(this.name, !!t2 && t2 !== E);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
class L extends k {
|
|
451
|
+
constructor(t2, i2, s2, e2, h2) {
|
|
452
|
+
super(t2, i2, s2, e2, h2), this.type = 5;
|
|
453
|
+
}
|
|
454
|
+
_$AI(t2, i2 = this) {
|
|
455
|
+
if ((t2 = S(this, t2, i2, 0) ?? E) === T) return;
|
|
456
|
+
const s2 = this._$AH, e2 = t2 === E && s2 !== E || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E && (s2 === E || e2);
|
|
457
|
+
e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
|
|
458
|
+
}
|
|
459
|
+
handleEvent(t2) {
|
|
460
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t2) : this._$AH.handleEvent(t2);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
class z {
|
|
464
|
+
constructor(t2, i2, s2) {
|
|
465
|
+
this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s2;
|
|
466
|
+
}
|
|
467
|
+
get _$AU() {
|
|
468
|
+
return this._$AM._$AU;
|
|
469
|
+
}
|
|
470
|
+
_$AI(t2) {
|
|
471
|
+
S(this, t2);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const j = t$2.litHtmlPolyfillSupport;
|
|
475
|
+
j?.(N, R), (t$2.litHtmlVersions ??= []).push("3.2.1");
|
|
476
|
+
const B = (t2, i2, s2) => {
|
|
477
|
+
const e2 = s2?.renderBefore ?? i2;
|
|
478
|
+
let h2 = e2._$litPart$;
|
|
479
|
+
if (void 0 === h2) {
|
|
480
|
+
const t3 = s2?.renderBefore ?? null;
|
|
481
|
+
e2._$litPart$ = h2 = new R(i2.insertBefore(l(), t3), t3, void 0, s2 ?? {});
|
|
482
|
+
}
|
|
483
|
+
return h2._$AI(t2), h2;
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* @license
|
|
487
|
+
* Copyright 2017 Google LLC
|
|
488
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
489
|
+
*/
|
|
490
|
+
let r$2 = class r extends b {
|
|
491
|
+
constructor() {
|
|
492
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
493
|
+
}
|
|
494
|
+
createRenderRoot() {
|
|
495
|
+
const t2 = super.createRenderRoot();
|
|
496
|
+
return this.renderOptions.renderBefore ??= t2.firstChild, t2;
|
|
497
|
+
}
|
|
498
|
+
update(t2) {
|
|
499
|
+
const s2 = this.render();
|
|
500
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = B(s2, this.renderRoot, this.renderOptions);
|
|
501
|
+
}
|
|
502
|
+
connectedCallback() {
|
|
503
|
+
super.connectedCallback(), this._$Do?.setConnected(true);
|
|
504
|
+
}
|
|
505
|
+
disconnectedCallback() {
|
|
506
|
+
super.disconnectedCallback(), this._$Do?.setConnected(false);
|
|
507
|
+
}
|
|
508
|
+
render() {
|
|
509
|
+
return T;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
r$2._$litElement$ = true, r$2["finalized"] = true, globalThis.litElementHydrateSupport?.({ LitElement: r$2 });
|
|
513
|
+
const i$1 = globalThis.litElementPolyfillSupport;
|
|
514
|
+
i$1?.({ LitElement: r$2 });
|
|
515
|
+
(globalThis.litElementVersions ??= []).push("4.1.1");
|
|
516
|
+
/**
|
|
517
|
+
* @license
|
|
518
|
+
* Copyright 2017 Google LLC
|
|
519
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
520
|
+
*/
|
|
521
|
+
const t$1 = (t2) => (e2, o2) => {
|
|
522
|
+
void 0 !== o2 ? o2.addInitializer(() => {
|
|
523
|
+
customElements.define(t2, e2);
|
|
524
|
+
}) : customElements.define(t2, e2);
|
|
525
|
+
};
|
|
526
|
+
/**
|
|
527
|
+
* @license
|
|
528
|
+
* Copyright 2017 Google LLC
|
|
529
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
530
|
+
*/
|
|
531
|
+
const o$2 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$1 = (t2 = o$2, e2, r3) => {
|
|
532
|
+
const { kind: n3, metadata: i2 } = r3;
|
|
533
|
+
let s2 = globalThis.litPropertyMetadata.get(i2);
|
|
534
|
+
if (void 0 === s2 && globalThis.litPropertyMetadata.set(i2, s2 = /* @__PURE__ */ new Map()), s2.set(r3.name, t2), "accessor" === n3) {
|
|
535
|
+
const { name: o2 } = r3;
|
|
536
|
+
return { set(r4) {
|
|
537
|
+
const n4 = e2.get.call(this);
|
|
538
|
+
e2.set.call(this, r4), this.requestUpdate(o2, n4, t2);
|
|
539
|
+
}, init(e3) {
|
|
540
|
+
return void 0 !== e3 && this.P(o2, void 0, t2), e3;
|
|
541
|
+
} };
|
|
542
|
+
}
|
|
543
|
+
if ("setter" === n3) {
|
|
544
|
+
const { name: o2 } = r3;
|
|
545
|
+
return function(r4) {
|
|
546
|
+
const n4 = this[o2];
|
|
547
|
+
e2.call(this, r4), this.requestUpdate(o2, n4, t2);
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
throw Error("Unsupported decorator location: " + n3);
|
|
551
|
+
};
|
|
552
|
+
function n2(t2) {
|
|
553
|
+
return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
|
|
554
|
+
const r3 = e3.hasOwnProperty(o3);
|
|
555
|
+
return e3.constructor.createProperty(o3, r3 ? { ...t3, wrapped: true } : t3), r3 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
|
|
556
|
+
})(t2, e2, o2);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* @license
|
|
560
|
+
* Copyright 2017 Google LLC
|
|
561
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
562
|
+
*/
|
|
563
|
+
function r2(r3) {
|
|
564
|
+
return n2({ ...r3, state: true, attribute: false });
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* @license
|
|
568
|
+
* Copyright 2017 Google LLC
|
|
569
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
570
|
+
*/
|
|
571
|
+
const e$4 = (e2, t2, c2) => (c2.configurable = true, c2.enumerable = true, Reflect.decorate && "object" != typeof t2 && Object.defineProperty(e2, t2, c2), c2);
|
|
572
|
+
/**
|
|
573
|
+
* @license
|
|
574
|
+
* Copyright 2017 Google LLC
|
|
575
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
576
|
+
*/
|
|
577
|
+
function e$3(e2, r3) {
|
|
578
|
+
return (n3, s2, i2) => {
|
|
579
|
+
const o2 = (t2) => t2.renderRoot?.querySelector(e2) ?? null;
|
|
580
|
+
return e$4(n3, s2, { get() {
|
|
581
|
+
return o2(this);
|
|
582
|
+
} });
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* @license
|
|
587
|
+
* Copyright 2017 Google LLC
|
|
588
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
589
|
+
*/
|
|
590
|
+
const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e$2 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
|
|
591
|
+
class i {
|
|
592
|
+
constructor(t2) {
|
|
593
|
+
}
|
|
594
|
+
get _$AU() {
|
|
595
|
+
return this._$AM._$AU;
|
|
596
|
+
}
|
|
597
|
+
_$AT(t2, e2, i2) {
|
|
598
|
+
this._$Ct = t2, this._$AM = e2, this._$Ci = i2;
|
|
599
|
+
}
|
|
600
|
+
_$AS(t2, e2) {
|
|
601
|
+
return this.update(t2, e2);
|
|
602
|
+
}
|
|
603
|
+
update(t2, e2) {
|
|
604
|
+
return this.render(...e2);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* @license
|
|
609
|
+
* Copyright 2018 Google LLC
|
|
610
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
611
|
+
*/
|
|
612
|
+
const e$1 = e$2(class extends i {
|
|
613
|
+
constructor(t$12) {
|
|
614
|
+
if (super(t$12), t$12.type !== t.ATTRIBUTE || "class" !== t$12.name || t$12.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
615
|
+
}
|
|
616
|
+
render(t2) {
|
|
617
|
+
return " " + Object.keys(t2).filter((s2) => t2[s2]).join(" ") + " ";
|
|
618
|
+
}
|
|
619
|
+
update(s2, [i2]) {
|
|
620
|
+
if (void 0 === this.st) {
|
|
621
|
+
this.st = /* @__PURE__ */ new Set(), void 0 !== s2.strings && (this.nt = new Set(s2.strings.join(" ").split(/\s/).filter((t2) => "" !== t2)));
|
|
622
|
+
for (const t2 in i2) i2[t2] && !this.nt?.has(t2) && this.st.add(t2);
|
|
623
|
+
return this.render(i2);
|
|
624
|
+
}
|
|
625
|
+
const r3 = s2.element.classList;
|
|
626
|
+
for (const t2 of this.st) t2 in i2 || (r3.remove(t2), this.st.delete(t2));
|
|
627
|
+
for (const t2 in i2) {
|
|
628
|
+
const s3 = !!i2[t2];
|
|
629
|
+
s3 === this.st.has(t2) || this.nt?.has(t2) || (s3 ? (r3.add(t2), this.st.add(t2)) : (r3.remove(t2), this.st.delete(t2)));
|
|
630
|
+
}
|
|
631
|
+
return T;
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
/**
|
|
635
|
+
* @license
|
|
636
|
+
* Copyright 2018 Google LLC
|
|
637
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
638
|
+
*/
|
|
639
|
+
const o$1 = (o2) => o2 ?? E;
|
|
640
|
+
const styles$h = i$4`
|
|
641
|
+
:host {
|
|
642
|
+
--_color-semantic-surface-critical-hover: #b32a23;
|
|
643
|
+
display: inline-block;
|
|
644
|
+
box-sizing: border-box;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.sds-button {
|
|
648
|
+
align-items: center;
|
|
649
|
+
display: inline-flex;
|
|
650
|
+
gap: var(--sds-spacing-3, 8px);
|
|
651
|
+
justify-content: center;
|
|
652
|
+
padding: var(--sds-spacing-3) var(--sds-spacing-4);
|
|
653
|
+
|
|
654
|
+
background-color: var(--sds-color-semantic-surface-action-default);
|
|
655
|
+
border: 2px solid var(--sds-color-semantic-border-action);
|
|
656
|
+
border-radius: var(--sds-radius-4);
|
|
657
|
+
cursor: pointer;
|
|
658
|
+
|
|
659
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
660
|
+
font-family: var(--sds-typography-font-family);
|
|
661
|
+
font-size: 1rem;
|
|
662
|
+
font-weight: 500;
|
|
663
|
+
line-height: 1.5;
|
|
664
|
+
text-align: center;
|
|
665
|
+
|
|
666
|
+
&:hover {
|
|
667
|
+
background-color: var(--sds-color-semantic-surface-action-hover);
|
|
668
|
+
border: 2px solid var(--sds-color-semantic-surface-action-hover);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
&:active {
|
|
672
|
+
background-color: var(--sds-color-semantic-surface-action-active);
|
|
673
|
+
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
674
|
+
outline: 0;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
&:disabled {
|
|
678
|
+
background-color: var(--sds-color-semantic-surface-disabled);
|
|
679
|
+
border: 2px solid var(--sds-color-semantic-surface-disabled);
|
|
680
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
681
|
+
cursor: not-allowed;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
.sds-button:focus,
|
|
686
|
+
:host(:focus) .give-focus {
|
|
687
|
+
background-color: var(--sds-color-semantic-surface-action-default);
|
|
688
|
+
outline: 2px solid var(--sds-color-semantic-surface-action-default);
|
|
689
|
+
outline-offset: 1px;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.sds-button--secondary {
|
|
693
|
+
background-color: var(--sds-color-semantic-surface-action-inverted);
|
|
694
|
+
border: 2px solid var(--sds-color-semantic-border-action);
|
|
695
|
+
color: var(--sds-color-semantic-text-default);
|
|
696
|
+
|
|
697
|
+
&:focus {
|
|
698
|
+
background-color: var(--sds-color-semantic-surface-action-inverted);
|
|
699
|
+
border: 2px solid var(--sds-color-semantic-border-action);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
&:hover {
|
|
703
|
+
background-color: var(--sds-color-semantic-surface-action-subtle);
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
&:active {
|
|
707
|
+
background-color: var(--sds-color-semantic-surface-action-active);
|
|
708
|
+
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
709
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
710
|
+
outline: 0;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
&:disabled {
|
|
714
|
+
border: 2px solid var(--sds-color-semantic-border-disabled);
|
|
715
|
+
background: var(--sds-color-semantic-surface-action-inverted);
|
|
716
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.sds-button--tertiary {
|
|
721
|
+
background-color: transparent;
|
|
722
|
+
border: 2px solid transparent;
|
|
723
|
+
color: var(--sds-color-semantic-text-action-default);
|
|
724
|
+
|
|
725
|
+
&:focus {
|
|
726
|
+
background-color: transparent;
|
|
727
|
+
border: 2px solid transparent;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
&:hover {
|
|
731
|
+
background-color: var(--sds-color-semantic-surface-action-subtle);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
&:active {
|
|
735
|
+
background-color: var(--sds-color-semantic-surface-action-active);
|
|
736
|
+
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
737
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
738
|
+
outline: 0;
|
|
739
|
+
position: relative;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
&:disabled {
|
|
743
|
+
border: 2px solid transparent;
|
|
744
|
+
background: transparent;
|
|
745
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
.sds-button--critical {
|
|
750
|
+
background-color: var(--sds-color-semantic-surface-critical-xtreme);
|
|
751
|
+
border: 2px solid var(--sds-color-semantic-border-critical);
|
|
752
|
+
color: var(--sds-color-semantic-text-on-critical);
|
|
753
|
+
|
|
754
|
+
&:focus {
|
|
755
|
+
background-color: var(--sds-color-semantic-surface-critical-xtreme);
|
|
756
|
+
border: 2px solid var(--sds-color-semantic-border-critical);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
&:hover {
|
|
760
|
+
background-color: var(--_color-semantic-surface-critical-hover);
|
|
761
|
+
border: 2px solid var(--_color-semantic-surface-critical-hover);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
&:active {
|
|
765
|
+
background-color: var(--sds-color-semantic-surface-action-active);
|
|
766
|
+
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
&:disabled {
|
|
770
|
+
background-color: var(--sds-color-semantic-surface-disabled);
|
|
771
|
+
border: 2px solid var(--sds-color-semantic-surface-disabled);
|
|
772
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.sds-button--medium {
|
|
777
|
+
padding: var(--sds-spacing-1) var(--sds-spacing-3);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
.sds-button--small {
|
|
781
|
+
font-size: 0.875rem;
|
|
782
|
+
padding: 0 var(--sds-spacing-3);
|
|
783
|
+
}
|
|
784
|
+
`;
|
|
785
|
+
var __defProp$h = Object.defineProperty;
|
|
786
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
787
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
788
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
789
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
790
|
+
if (decorator = decorators[i2])
|
|
791
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
792
|
+
if (kind && result) __defProp$h(target, key, result);
|
|
793
|
+
return result;
|
|
794
|
+
};
|
|
795
|
+
let SDSButton = class extends r$2 {
|
|
796
|
+
constructor() {
|
|
797
|
+
super();
|
|
798
|
+
this.type = "button";
|
|
799
|
+
this.variant = "primary";
|
|
800
|
+
this.size = "large";
|
|
801
|
+
this.disabled = false;
|
|
802
|
+
this.value = "";
|
|
803
|
+
this._handleClick = (event) => {
|
|
804
|
+
event.preventDefault();
|
|
805
|
+
event.stopImmediatePropagation();
|
|
806
|
+
if (!this.disabled) {
|
|
807
|
+
switch (this.type) {
|
|
808
|
+
case "submit": {
|
|
809
|
+
const submitEvent = new CustomEvent("submit", {
|
|
810
|
+
bubbles: true,
|
|
811
|
+
composed: true,
|
|
812
|
+
cancelable: true
|
|
813
|
+
});
|
|
814
|
+
const shouldSubmit = this.dispatchEvent(submitEvent);
|
|
815
|
+
if (shouldSubmit) {
|
|
816
|
+
if (this.form) {
|
|
817
|
+
const root = this.getRootNode();
|
|
818
|
+
const formElement = root.querySelector(`form#${this.form}`);
|
|
819
|
+
formElement?.submit();
|
|
820
|
+
} else if (this.internals.form) {
|
|
821
|
+
this.internals.form.submit();
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
break;
|
|
825
|
+
}
|
|
826
|
+
case "reset": {
|
|
827
|
+
const resetEvent = new CustomEvent("reset", {
|
|
828
|
+
bubbles: true,
|
|
829
|
+
composed: true,
|
|
830
|
+
cancelable: true
|
|
831
|
+
});
|
|
832
|
+
const shouldReset = this.dispatchEvent(resetEvent);
|
|
833
|
+
if (shouldReset) {
|
|
834
|
+
if (this.form) {
|
|
835
|
+
const root = this.getRootNode();
|
|
836
|
+
const formElement = root.querySelector(`form#${this.form}`);
|
|
837
|
+
formElement?.reset();
|
|
838
|
+
} else if (this.internals.form) {
|
|
839
|
+
this.internals.form.reset();
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
default:
|
|
845
|
+
this.dispatchEvent(
|
|
846
|
+
new CustomEvent("click", {
|
|
847
|
+
bubbles: true,
|
|
848
|
+
composed: true
|
|
849
|
+
})
|
|
850
|
+
);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
this.internals = this.attachInternals();
|
|
855
|
+
this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
856
|
+
}
|
|
857
|
+
focus() {
|
|
858
|
+
if (!this.disabled) this.shadowRoot?.querySelector("button")?.focus();
|
|
859
|
+
}
|
|
860
|
+
blur() {
|
|
861
|
+
if (!this.disabled) this.shadowRoot?.querySelector("button")?.blur();
|
|
862
|
+
}
|
|
863
|
+
click() {
|
|
864
|
+
if (!this.disabled) this.shadowRoot?.querySelector("button")?.click();
|
|
865
|
+
}
|
|
866
|
+
render() {
|
|
867
|
+
const buttonClasses = {
|
|
868
|
+
"sds-button": true,
|
|
869
|
+
"sds-button--secondary": this.variant === "secondary",
|
|
870
|
+
"sds-button--tertiary": this.variant === "tertiary",
|
|
871
|
+
"sds-button--critical": this.variant === "critical",
|
|
872
|
+
"sds-button--medium": this.size === "medium",
|
|
873
|
+
"sds-button--small": this.size === "small"
|
|
874
|
+
};
|
|
875
|
+
return x`
|
|
876
|
+
<button
|
|
877
|
+
id="control"
|
|
878
|
+
form="${o$1(this.form)}"
|
|
879
|
+
class="${e$1(buttonClasses)}"
|
|
880
|
+
type="${this.type}"
|
|
881
|
+
name="${o$1(this.name)}"
|
|
882
|
+
value="${o$1(this.value)}"
|
|
883
|
+
?disabled="${this.disabled}"
|
|
884
|
+
@click="${this._handleClick}"
|
|
885
|
+
>
|
|
886
|
+
<slot name="before"></slot>
|
|
887
|
+
<slot></slot>
|
|
888
|
+
<slot name="after"></slot>
|
|
889
|
+
</button>
|
|
890
|
+
`;
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
SDSButton.styles = [styles$h];
|
|
894
|
+
SDSButton.formAssociated = true;
|
|
895
|
+
__decorateClass$h([
|
|
896
|
+
n2({ type: String, reflect: true })
|
|
897
|
+
], SDSButton.prototype, "type", 2);
|
|
898
|
+
__decorateClass$h([
|
|
899
|
+
n2({ type: String, reflect: true })
|
|
900
|
+
], SDSButton.prototype, "variant", 2);
|
|
901
|
+
__decorateClass$h([
|
|
902
|
+
n2({ type: String, reflect: true })
|
|
903
|
+
], SDSButton.prototype, "size", 2);
|
|
904
|
+
__decorateClass$h([
|
|
905
|
+
n2({ type: Boolean, reflect: true })
|
|
906
|
+
], SDSButton.prototype, "disabled", 2);
|
|
907
|
+
__decorateClass$h([
|
|
908
|
+
n2({ type: String, reflect: true })
|
|
909
|
+
], SDSButton.prototype, "name", 2);
|
|
910
|
+
__decorateClass$h([
|
|
911
|
+
n2({ type: String, reflect: true })
|
|
912
|
+
], SDSButton.prototype, "value", 2);
|
|
913
|
+
__decorateClass$h([
|
|
914
|
+
n2({ type: String, reflect: true })
|
|
915
|
+
], SDSButton.prototype, "form", 2);
|
|
916
|
+
SDSButton = __decorateClass$h([
|
|
917
|
+
t$1("sds-button")
|
|
918
|
+
], SDSButton);
|
|
919
|
+
const styles$g = i$4`
|
|
920
|
+
:host {
|
|
921
|
+
flex: 0 0 auto;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.sds-checkbox__label {
|
|
925
|
+
align-items: flex-start;
|
|
926
|
+
cursor: pointer;
|
|
927
|
+
color: var(--sds-color-semantic-text-default);
|
|
928
|
+
display: inline-flex;
|
|
929
|
+
font-family: var(--sds-typography-font-family);
|
|
930
|
+
font-size: 1rem;
|
|
931
|
+
font-weight: 400;
|
|
932
|
+
gap: var(--sds-spacing-3);
|
|
933
|
+
line-height: 1.25;
|
|
934
|
+
|
|
935
|
+
&:has(:disabled) {
|
|
936
|
+
cursor: default;
|
|
937
|
+
pointer-events: none;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
.sds-checkbox__input {
|
|
942
|
+
appearance: none;
|
|
943
|
+
background-color: transparent;
|
|
944
|
+
color: currentColor;
|
|
945
|
+
cursor: pointer;
|
|
946
|
+
width: 24px;
|
|
947
|
+
height: 24px;
|
|
948
|
+
border: 1px solid var(--sds-color-semantic-border-default);
|
|
949
|
+
border-radius: var(--sds-radius-2);
|
|
950
|
+
margin: 0;
|
|
951
|
+
/*transition:
|
|
952
|
+
background-color 0.3s ease,
|
|
953
|
+
box-shadow 0.3s ease;*/
|
|
954
|
+
|
|
955
|
+
&:checked {
|
|
956
|
+
background-color: var(--sds-color-semantic-surface-action-selected);
|
|
957
|
+
border-color: var(--sds-color-semantic-surface-action-selected);
|
|
958
|
+
|
|
959
|
+
&::after {
|
|
960
|
+
content: '';
|
|
961
|
+
position: absolute;
|
|
962
|
+
width: 24px;
|
|
963
|
+
height: 24px;
|
|
964
|
+
background-color: white;
|
|
965
|
+
transform-origin: bottom left;
|
|
966
|
+
clip-path: path(
|
|
967
|
+
'M9.54998 18L3.84998 12.3L5.27498 10.875L9.54998 15.15L18.725 5.97501L20.15 7.40001L9.54998 18Z'
|
|
968
|
+
);
|
|
969
|
+
transform: translate(-1px, -1px);
|
|
970
|
+
/*transition:
|
|
971
|
+
background-color 0.3s ease,
|
|
972
|
+
box-shadow 0.3s ease;*/
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
&:hover {
|
|
977
|
+
border-width: 2px;
|
|
978
|
+
|
|
979
|
+
&:checked {
|
|
980
|
+
&::after {
|
|
981
|
+
transform: translate(-2px, -2px);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
&:focus {
|
|
987
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
988
|
+
outline-offset: 2px;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
&.sds-checkbox__input--error {
|
|
992
|
+
border: 2px solid var(--sds-color-semantic-surface-critical-xtreme);
|
|
993
|
+
|
|
994
|
+
&:checked {
|
|
995
|
+
// TODO: Decide if checked checkbox with error should be fully red
|
|
996
|
+
//background-color: var(--sds-color-semantic-border-critical);
|
|
997
|
+
|
|
998
|
+
&::after {
|
|
999
|
+
transform: translate(-2px, -2px);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
&:disabled {
|
|
1005
|
+
border: 2px solid var(--sds-color-semantic-border-disabled);
|
|
1006
|
+
|
|
1007
|
+
&:checked {
|
|
1008
|
+
background-color: var(--sds-color-semantic-border-disabled);
|
|
1009
|
+
|
|
1010
|
+
&::after {
|
|
1011
|
+
transform: translate(-2px, -2px);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
& + .sds-checkbox__text {
|
|
1016
|
+
color: var(--sds-color-semantic-border-disabled);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
.sds-checkbox__text {
|
|
1022
|
+
display: inline-block;
|
|
1023
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1024
|
+
padding-top: 2px;
|
|
1025
|
+
}
|
|
1026
|
+
`;
|
|
1027
|
+
var __defProp$g = Object.defineProperty;
|
|
1028
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
1029
|
+
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
1030
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
1031
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1032
|
+
if (decorator = decorators[i2])
|
|
1033
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1034
|
+
if (kind && result) __defProp$g(target, key, result);
|
|
1035
|
+
return result;
|
|
1036
|
+
};
|
|
1037
|
+
let SDSCheckbox = class extends r$2 {
|
|
1038
|
+
constructor() {
|
|
1039
|
+
super();
|
|
1040
|
+
this.checked = false;
|
|
1041
|
+
this.disabled = false;
|
|
1042
|
+
this.error = false;
|
|
1043
|
+
this._handleChange = (event) => {
|
|
1044
|
+
event.stopImmediatePropagation();
|
|
1045
|
+
if (!this.disabled) {
|
|
1046
|
+
const elem = event.target;
|
|
1047
|
+
this.checked = elem.checked;
|
|
1048
|
+
this.dispatchEvent(
|
|
1049
|
+
new CustomEvent("change", {
|
|
1050
|
+
detail: { checked: this.checked, value: elem.value },
|
|
1051
|
+
bubbles: true,
|
|
1052
|
+
composed: true
|
|
1053
|
+
})
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
this._handleFocus = (event) => {
|
|
1058
|
+
event.stopImmediatePropagation();
|
|
1059
|
+
this.dispatchEvent(
|
|
1060
|
+
new CustomEvent("focus", {
|
|
1061
|
+
detail: { checked: this.checked },
|
|
1062
|
+
bubbles: true,
|
|
1063
|
+
composed: true
|
|
1064
|
+
})
|
|
1065
|
+
);
|
|
1066
|
+
};
|
|
1067
|
+
this._handleBlur = (event) => {
|
|
1068
|
+
event.stopImmediatePropagation();
|
|
1069
|
+
this.dispatchEvent(
|
|
1070
|
+
new CustomEvent("blur", {
|
|
1071
|
+
detail: { checked: this.checked },
|
|
1072
|
+
bubbles: true,
|
|
1073
|
+
composed: true
|
|
1074
|
+
})
|
|
1075
|
+
);
|
|
1076
|
+
};
|
|
1077
|
+
this.internals = this.attachInternals();
|
|
1078
|
+
this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
1079
|
+
}
|
|
1080
|
+
focus() {
|
|
1081
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.focus();
|
|
1082
|
+
}
|
|
1083
|
+
blur() {
|
|
1084
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.blur();
|
|
1085
|
+
}
|
|
1086
|
+
click() {
|
|
1087
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.click();
|
|
1088
|
+
}
|
|
1089
|
+
render() {
|
|
1090
|
+
const checkboxClasses = {
|
|
1091
|
+
"sds-checkbox": true,
|
|
1092
|
+
"sds-checkbox--error": Boolean(this.error)
|
|
1093
|
+
};
|
|
1094
|
+
const inputClasses = {
|
|
1095
|
+
"sds-checkbox__input": true,
|
|
1096
|
+
"sds-checkbox__input--error": Boolean(this.error)
|
|
1097
|
+
};
|
|
1098
|
+
return x`
|
|
1099
|
+
<div class="${e$1(checkboxClasses)}">
|
|
1100
|
+
<label class="sds-checkbox__label">
|
|
1101
|
+
<input
|
|
1102
|
+
type="checkbox"
|
|
1103
|
+
name="${o$1(this.name)}"
|
|
1104
|
+
value="${o$1(this.value)}"
|
|
1105
|
+
?checked="${this.checked}"
|
|
1106
|
+
?disabled="${this.disabled}"
|
|
1107
|
+
@change="${this._handleChange}"
|
|
1108
|
+
@focus="${this._handleFocus}"
|
|
1109
|
+
@blur="${this._handleBlur}"
|
|
1110
|
+
class="${e$1(inputClasses)}"
|
|
1111
|
+
/>
|
|
1112
|
+
${this.label ? x`<span class="sds-checkbox__text">${this.label}</span>` : E}
|
|
1113
|
+
</label>
|
|
1114
|
+
</div>
|
|
1115
|
+
`;
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
SDSCheckbox.styles = [styles$g];
|
|
1119
|
+
SDSCheckbox.formAssociated = true;
|
|
1120
|
+
__decorateClass$g([
|
|
1121
|
+
n2({ type: String, reflect: true })
|
|
1122
|
+
], SDSCheckbox.prototype, "name", 2);
|
|
1123
|
+
__decorateClass$g([
|
|
1124
|
+
n2({ type: String, reflect: true })
|
|
1125
|
+
], SDSCheckbox.prototype, "label", 2);
|
|
1126
|
+
__decorateClass$g([
|
|
1127
|
+
n2({ type: String })
|
|
1128
|
+
], SDSCheckbox.prototype, "value", 2);
|
|
1129
|
+
__decorateClass$g([
|
|
1130
|
+
n2({ type: Boolean, reflect: true })
|
|
1131
|
+
], SDSCheckbox.prototype, "checked", 2);
|
|
1132
|
+
__decorateClass$g([
|
|
1133
|
+
n2({ type: Boolean, reflect: true })
|
|
1134
|
+
], SDSCheckbox.prototype, "disabled", 2);
|
|
1135
|
+
__decorateClass$g([
|
|
1136
|
+
n2({ type: Boolean, reflect: true })
|
|
1137
|
+
], SDSCheckbox.prototype, "error", 2);
|
|
1138
|
+
SDSCheckbox = __decorateClass$g([
|
|
1139
|
+
t$1("sds-checkbox")
|
|
1140
|
+
], SDSCheckbox);
|
|
1141
|
+
const styles$f = i$4`
|
|
1142
|
+
:host {
|
|
1143
|
+
display: block;
|
|
1144
|
+
contain: layout style;
|
|
1145
|
+
box-sizing: border-box;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
.sds-checkbox-group {
|
|
1149
|
+
border: 0;
|
|
1150
|
+
font-family: var(--sds-typography-font-family);
|
|
1151
|
+
margin: 0;
|
|
1152
|
+
padding: 0;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
.sds-checkbox-group__legend {
|
|
1156
|
+
color: var(--sds-color-semantic-text-default);
|
|
1157
|
+
font-size: 1rem;
|
|
1158
|
+
font-weight: 700;
|
|
1159
|
+
line-height: 1.5;
|
|
1160
|
+
margin: 0 0 var(--sds-spacing-2) 0;
|
|
1161
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1162
|
+
padding: 0;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
.sds-checkbox-group__help-text {
|
|
1166
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
1167
|
+
font-size: 1rem;
|
|
1168
|
+
font-weight: 400;
|
|
1169
|
+
line-height: 1.25rem;
|
|
1170
|
+
margin: 0;
|
|
1171
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
.sds-checkbox-group__checkboxes {
|
|
1175
|
+
display: flex;
|
|
1176
|
+
flex-direction: column;
|
|
1177
|
+
gap: var(--sds-spacing-5);
|
|
1178
|
+
margin-top: var(--sds-spacing-3);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
.sds-checkbox-group__error-message {
|
|
1182
|
+
margin: var(--sds-spacing-5) 0 0;
|
|
1183
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1184
|
+
align-items: flex-start;
|
|
1185
|
+
color: var(--sds-color-semantic-text-default);
|
|
1186
|
+
display: flex;
|
|
1187
|
+
line-height: 1.5rem;
|
|
1188
|
+
gap: var(--sds-spacing-2);
|
|
1189
|
+
}
|
|
1190
|
+
`;
|
|
1191
|
+
/**
|
|
1192
|
+
* @license
|
|
1193
|
+
* Copyright 2017 Google LLC
|
|
1194
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1195
|
+
*/
|
|
1196
|
+
class e extends i {
|
|
1197
|
+
constructor(i2) {
|
|
1198
|
+
if (super(i2), this.it = E, i2.type !== t.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
1199
|
+
}
|
|
1200
|
+
render(r3) {
|
|
1201
|
+
if (r3 === E || null == r3) return this._t = void 0, this.it = r3;
|
|
1202
|
+
if (r3 === T) return r3;
|
|
1203
|
+
if ("string" != typeof r3) throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
1204
|
+
if (r3 === this.it) return this._t;
|
|
1205
|
+
this.it = r3;
|
|
1206
|
+
const s2 = [r3];
|
|
1207
|
+
return s2.raw = s2, this._t = { _$litType$: this.constructor.resultType, strings: s2, values: [] };
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
e.directiveName = "unsafeHTML", e.resultType = 1;
|
|
1211
|
+
const o = e$2(e);
|
|
1212
|
+
const loadIcon = async (name) => await import(`@politiet/sheriff-icons/dist/${name}.js`).then(({ default: svg }) => svg);
|
|
1213
|
+
class SDSIconLoader {
|
|
1214
|
+
constructor() {
|
|
1215
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
1216
|
+
this.resolver = loadIcon;
|
|
1217
|
+
}
|
|
1218
|
+
resolve(name, onResolved) {
|
|
1219
|
+
const cached = this.cache.get(name);
|
|
1220
|
+
if (cached != null) {
|
|
1221
|
+
onResolved(cached);
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
const fetchIcon = this.resolver(name).catch((error) => {
|
|
1225
|
+
console.error(`Failed to fetch icon '${name}':`, error);
|
|
1226
|
+
return "";
|
|
1227
|
+
}).then((svg) => {
|
|
1228
|
+
this.cache.set(name, svg);
|
|
1229
|
+
return svg;
|
|
1230
|
+
});
|
|
1231
|
+
void fetchIcon.then(onResolved);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
const styles$e = i$4`
|
|
1235
|
+
:host {
|
|
1236
|
+
--icon-size: var(--sds-icon-size-m);
|
|
1237
|
+
display: inline-block;
|
|
1238
|
+
block-size: var(--icon-size);
|
|
1239
|
+
inline-size: var(--icon-size);
|
|
1240
|
+
min-inline-size: var(--icon-size);
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
:host([size='s']) {
|
|
1244
|
+
--icon-size: var(--sds-icon-size-s);
|
|
1245
|
+
}
|
|
1246
|
+
`;
|
|
1247
|
+
var __defProp$f = Object.defineProperty;
|
|
1248
|
+
var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
|
|
1249
|
+
var __decorateClass$f = (decorators, target, key, kind) => {
|
|
1250
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
|
|
1251
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1252
|
+
if (decorator = decorators[i2])
|
|
1253
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1254
|
+
if (kind && result) __defProp$f(target, key, result);
|
|
1255
|
+
return result;
|
|
1256
|
+
};
|
|
1257
|
+
let SDSIcon = class extends r$2 {
|
|
1258
|
+
constructor() {
|
|
1259
|
+
super(...arguments);
|
|
1260
|
+
this.name = "";
|
|
1261
|
+
this.size = "m";
|
|
1262
|
+
this.color = "";
|
|
1263
|
+
this.label = "";
|
|
1264
|
+
this.svg = "";
|
|
1265
|
+
}
|
|
1266
|
+
static registerResolver(resolver) {
|
|
1267
|
+
this.iconLoader.resolver = resolver;
|
|
1268
|
+
}
|
|
1269
|
+
async fetchIcon() {
|
|
1270
|
+
if (!this.name) {
|
|
1271
|
+
this.svg = "";
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
try {
|
|
1275
|
+
const svg = await new Promise((resolve) => {
|
|
1276
|
+
SDSIcon.iconLoader.resolve(this.name, resolve);
|
|
1277
|
+
});
|
|
1278
|
+
this.svg = svg;
|
|
1279
|
+
} catch (error) {
|
|
1280
|
+
console.error(`Failed to fetch SVG for icon '${this.name}':`, error);
|
|
1281
|
+
this.svg = "";
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
updated(changedProperties) {
|
|
1285
|
+
super.updated(changedProperties);
|
|
1286
|
+
if (changedProperties.has("name") && this.name) {
|
|
1287
|
+
void this.fetchIcon();
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
render() {
|
|
1291
|
+
return x`<div
|
|
1292
|
+
class="sds-icon"
|
|
1293
|
+
role="${o$1(this.label ? "img" : void 0)}"
|
|
1294
|
+
style="${o$1(this.color ? `color:${this.color}` : void 0)}"
|
|
1295
|
+
aria-label="${o$1(this.label)}"
|
|
1296
|
+
>
|
|
1297
|
+
${this.name ? x`<slot aria-hidden="true">${o(this.svg)}</slot>` : x`<slot aria-hidden="true"></slot>`}
|
|
1298
|
+
</div>`;
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
SDSIcon.styles = [styles$e];
|
|
1302
|
+
SDSIcon.iconLoader = new SDSIconLoader();
|
|
1303
|
+
__decorateClass$f([
|
|
1304
|
+
n2({ type: String, reflect: true })
|
|
1305
|
+
], SDSIcon.prototype, "name", 2);
|
|
1306
|
+
__decorateClass$f([
|
|
1307
|
+
n2({ type: String, reflect: true })
|
|
1308
|
+
], SDSIcon.prototype, "size", 2);
|
|
1309
|
+
__decorateClass$f([
|
|
1310
|
+
n2({ type: String, reflect: true })
|
|
1311
|
+
], SDSIcon.prototype, "color", 2);
|
|
1312
|
+
__decorateClass$f([
|
|
1313
|
+
n2({ type: String, reflect: true })
|
|
1314
|
+
], SDSIcon.prototype, "label", 2);
|
|
1315
|
+
__decorateClass$f([
|
|
1316
|
+
r2()
|
|
1317
|
+
], SDSIcon.prototype, "svg", 2);
|
|
1318
|
+
SDSIcon = __decorateClass$f([
|
|
1319
|
+
t$1("sds-icon")
|
|
1320
|
+
], SDSIcon);
|
|
1321
|
+
var __defProp$e = Object.defineProperty;
|
|
1322
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
1323
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
1324
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
1325
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1326
|
+
if (decorator = decorators[i2])
|
|
1327
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1328
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
1329
|
+
return result;
|
|
1330
|
+
};
|
|
1331
|
+
let SDSCheckboxGroup = class extends r$2 {
|
|
1332
|
+
constructor() {
|
|
1333
|
+
super(...arguments);
|
|
1334
|
+
this.selectedValues = [];
|
|
1335
|
+
this._handleCheckboxChange = (event) => {
|
|
1336
|
+
const checkbox = event.target;
|
|
1337
|
+
const value = checkbox.value;
|
|
1338
|
+
const isChecked = checkbox.checked;
|
|
1339
|
+
this.selectedValues = isChecked ? [...this.selectedValues, value] : this.selectedValues.filter((v2) => v2 !== value);
|
|
1340
|
+
this.dispatchEvent(
|
|
1341
|
+
new CustomEvent("change", {
|
|
1342
|
+
detail: { selectedValues: this.selectedValues },
|
|
1343
|
+
bubbles: true,
|
|
1344
|
+
composed: true
|
|
1345
|
+
})
|
|
1346
|
+
);
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
render() {
|
|
1350
|
+
const groupClasses = {
|
|
1351
|
+
"sds-checkbox-group": true,
|
|
1352
|
+
"sds-checkbox-group--error": Boolean(this.errorMessage)
|
|
1353
|
+
};
|
|
1354
|
+
return x`
|
|
1355
|
+
<fieldset class="${e$1(groupClasses)}">
|
|
1356
|
+
${this.legend ? x`<legend class="sds-checkbox-group__legend">${this.legend}</legend>` : E}
|
|
1357
|
+
${this.helpText ? x`<p class="sds-checkbox-group__help-text">${this.helpText}</p>` : E}
|
|
1358
|
+
<div class="sds-checkbox-group__checkboxes">
|
|
1359
|
+
<slot @change=${this._handleCheckboxChange}></slot>
|
|
1360
|
+
</div>
|
|
1361
|
+
${this.errorMessage ? x`<p class="sds-checkbox-group__error-message">
|
|
1362
|
+
<sds-icon
|
|
1363
|
+
name="warning-material-filled"
|
|
1364
|
+
size="m"
|
|
1365
|
+
color="var(--sds-color-semantic-icon-critical)"
|
|
1366
|
+
></sds-icon>
|
|
1367
|
+
${this.errorMessage}
|
|
1368
|
+
</p>` : E}
|
|
1369
|
+
</fieldset>
|
|
1370
|
+
`;
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
SDSCheckboxGroup.styles = [styles$f];
|
|
1374
|
+
__decorateClass$e([
|
|
1375
|
+
n2({ type: String, reflect: true })
|
|
1376
|
+
], SDSCheckboxGroup.prototype, "legend", 2);
|
|
1377
|
+
__decorateClass$e([
|
|
1378
|
+
n2({ type: String, attribute: "help-text", reflect: true })
|
|
1379
|
+
], SDSCheckboxGroup.prototype, "helpText", 2);
|
|
1380
|
+
__decorateClass$e([
|
|
1381
|
+
n2({ type: String, attribute: "error-message", reflect: true })
|
|
1382
|
+
], SDSCheckboxGroup.prototype, "errorMessage", 2);
|
|
1383
|
+
__decorateClass$e([
|
|
1384
|
+
r2()
|
|
1385
|
+
], SDSCheckboxGroup.prototype, "selectedValues", 2);
|
|
1386
|
+
SDSCheckboxGroup = __decorateClass$e([
|
|
1387
|
+
t$1("sds-checkbox-group")
|
|
1388
|
+
], SDSCheckboxGroup);
|
|
1389
|
+
const styles$d = i$4`
|
|
1390
|
+
.sds-chip {
|
|
1391
|
+
align-items: center;
|
|
1392
|
+
display: inline-flex;
|
|
1393
|
+
gap: var(--sds-spacing-3);
|
|
1394
|
+
justify-content: center;
|
|
1395
|
+
padding: 6px var(--sds-spacing-4);
|
|
1396
|
+
|
|
1397
|
+
background-color: var(--sds-color-semantic-surface-action-inverted);
|
|
1398
|
+
border: 2px solid var(--sds-color-semantic-border-action);
|
|
1399
|
+
border-radius: 2rem;
|
|
1400
|
+
|
|
1401
|
+
font-family: var(--sds-typography-font-family);
|
|
1402
|
+
font-size: 1rem;
|
|
1403
|
+
font-weight: 400;
|
|
1404
|
+
line-height: 1.25;
|
|
1405
|
+
text-align: center;
|
|
1406
|
+
|
|
1407
|
+
user-select: none;
|
|
1408
|
+
cursor: pointer;
|
|
1409
|
+
|
|
1410
|
+
&:has(input[type='checkbox']:checked) {
|
|
1411
|
+
background-color: var(--sds-color-semantic-surface-action-default);
|
|
1412
|
+
border-color: var(--sds-color-semantic-surface-action-default);
|
|
1413
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
&:has(
|
|
1417
|
+
input[type='checkbox'][disabled],
|
|
1418
|
+
input[type='checkbox']:checked[disabled]
|
|
1419
|
+
) {
|
|
1420
|
+
background-color: var(--sds-color-semantic-surface-disabled);
|
|
1421
|
+
border: 2px solid var(--sds-color-semantic-surface-disabled);
|
|
1422
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
1423
|
+
cursor: not-allowed;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
&:hover {
|
|
1427
|
+
background-color: var(--sds-color-semantic-surface-action-hover);
|
|
1428
|
+
border-color: var(--sds-color-semantic-surface-action-hover);
|
|
1429
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
&:active {
|
|
1433
|
+
background-color: var(--sds-color-semantic-surface-action-active);
|
|
1434
|
+
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
&:focus-within,
|
|
1438
|
+
&:focus {
|
|
1439
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
1440
|
+
outline-offset: 2px;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
&.sds-chip--small {
|
|
1444
|
+
font-size: 0.875rem;
|
|
1445
|
+
line-height: 1.125rem;
|
|
1446
|
+
padding: var(--sds-spacing-1) var(--sds-spacing-3);
|
|
1447
|
+
gap: var(--sds-spacing-2);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
& input[type='checkbox'] {
|
|
1451
|
+
position: absolute;
|
|
1452
|
+
width: 1px;
|
|
1453
|
+
height: 1px;
|
|
1454
|
+
padding: 0;
|
|
1455
|
+
margin: -1px;
|
|
1456
|
+
overflow: hidden;
|
|
1457
|
+
clip-path: inset(50%);
|
|
1458
|
+
border: 0;
|
|
1459
|
+
white-space: nowrap;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
`;
|
|
1463
|
+
var __defProp$d = Object.defineProperty;
|
|
1464
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
1465
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
1466
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
1467
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1468
|
+
if (decorator = decorators[i2])
|
|
1469
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1470
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
1471
|
+
return result;
|
|
1472
|
+
};
|
|
1473
|
+
let SDSChip = class extends r$2 {
|
|
1474
|
+
constructor() {
|
|
1475
|
+
super(...arguments);
|
|
1476
|
+
this.variant = "selectable";
|
|
1477
|
+
this.size = "large";
|
|
1478
|
+
this.checked = false;
|
|
1479
|
+
this.disabled = false;
|
|
1480
|
+
this._toggle = (event) => {
|
|
1481
|
+
event.preventDefault();
|
|
1482
|
+
event.stopImmediatePropagation();
|
|
1483
|
+
this.checked = !this.checked;
|
|
1484
|
+
this.dispatchEvent(
|
|
1485
|
+
new CustomEvent("change", {
|
|
1486
|
+
detail: { value: this.value, isChecked: this.checked },
|
|
1487
|
+
bubbles: true,
|
|
1488
|
+
composed: true
|
|
1489
|
+
})
|
|
1490
|
+
);
|
|
1491
|
+
};
|
|
1492
|
+
this._remove = () => {
|
|
1493
|
+
this.dispatchEvent(
|
|
1494
|
+
new CustomEvent("sds-remove", {
|
|
1495
|
+
bubbles: true,
|
|
1496
|
+
composed: true
|
|
1497
|
+
})
|
|
1498
|
+
);
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
focus() {
|
|
1502
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.focus();
|
|
1503
|
+
}
|
|
1504
|
+
blur() {
|
|
1505
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.blur();
|
|
1506
|
+
}
|
|
1507
|
+
click() {
|
|
1508
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.click();
|
|
1509
|
+
}
|
|
1510
|
+
render() {
|
|
1511
|
+
const chipClasses = {
|
|
1512
|
+
"sds-chip": true,
|
|
1513
|
+
"sds-chip--small": this.size === "small"
|
|
1514
|
+
};
|
|
1515
|
+
if (this.variant === "removable") {
|
|
1516
|
+
return x`<button class="${e$1(chipClasses)}" @click=${this._remove}>
|
|
1517
|
+
<slot></slot>
|
|
1518
|
+
<sds-icon name="close-material-outlined" size="s"></sds-icon>
|
|
1519
|
+
</button>`;
|
|
1520
|
+
}
|
|
1521
|
+
return x`<label class="${e$1(chipClasses)}" @click="${this._toggle}">
|
|
1522
|
+
<input
|
|
1523
|
+
type="checkbox"
|
|
1524
|
+
name="${o$1(this.name)}"
|
|
1525
|
+
value="${o$1(this.value)}"
|
|
1526
|
+
?checked="${this.checked}"
|
|
1527
|
+
?disabled="${this.disabled}"
|
|
1528
|
+
/>
|
|
1529
|
+
<slot></slot>
|
|
1530
|
+
</label>`;
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
SDSChip.styles = [styles$d];
|
|
1534
|
+
__decorateClass$d([
|
|
1535
|
+
n2({ type: String, reflect: true })
|
|
1536
|
+
], SDSChip.prototype, "variant", 2);
|
|
1537
|
+
__decorateClass$d([
|
|
1538
|
+
n2({ type: String, reflect: true })
|
|
1539
|
+
], SDSChip.prototype, "size", 2);
|
|
1540
|
+
__decorateClass$d([
|
|
1541
|
+
n2({ type: Boolean, reflect: true })
|
|
1542
|
+
], SDSChip.prototype, "checked", 2);
|
|
1543
|
+
__decorateClass$d([
|
|
1544
|
+
n2({ type: String, reflect: true })
|
|
1545
|
+
], SDSChip.prototype, "name", 2);
|
|
1546
|
+
__decorateClass$d([
|
|
1547
|
+
n2({ type: String })
|
|
1548
|
+
], SDSChip.prototype, "value", 2);
|
|
1549
|
+
__decorateClass$d([
|
|
1550
|
+
n2({ type: Boolean, reflect: true })
|
|
1551
|
+
], SDSChip.prototype, "disabled", 2);
|
|
1552
|
+
SDSChip = __decorateClass$d([
|
|
1553
|
+
t$1("sds-chip")
|
|
1554
|
+
], SDSChip);
|
|
1555
|
+
const styles$c = i$4`
|
|
1556
|
+
:host {
|
|
1557
|
+
display: block;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.sds-detail {
|
|
1561
|
+
font-family: var(--sds-typography-font-family);
|
|
1562
|
+
font-size: 0.75rem;
|
|
1563
|
+
line-height: 1.333;
|
|
1564
|
+
color: var(--sds-color-semantic-text-default);
|
|
1565
|
+
margin: 0;
|
|
1566
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1567
|
+
padding: 0;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
.sds-detail--text {
|
|
1571
|
+
font-weight: 400;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
.sds-detail--label {
|
|
1575
|
+
font-weight: 500;
|
|
1576
|
+
}
|
|
1577
|
+
`;
|
|
1578
|
+
var __defProp$c = Object.defineProperty;
|
|
1579
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
1580
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
1581
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
1582
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1583
|
+
if (decorator = decorators[i2])
|
|
1584
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1585
|
+
if (kind && result) __defProp$c(target, key, result);
|
|
1586
|
+
return result;
|
|
1587
|
+
};
|
|
1588
|
+
let SDSDetail = class extends r$2 {
|
|
1589
|
+
constructor() {
|
|
1590
|
+
super(...arguments);
|
|
1591
|
+
this.variation = "text";
|
|
1592
|
+
}
|
|
1593
|
+
render() {
|
|
1594
|
+
const styleClasses = {
|
|
1595
|
+
"sds-detail": true,
|
|
1596
|
+
"sds-detail--text": this.variation === "text",
|
|
1597
|
+
"sds-detail--label": this.variation === "label"
|
|
1598
|
+
};
|
|
1599
|
+
const classes = e$1(styleClasses);
|
|
1600
|
+
return x`<p class=${classes}><slot></slot></p>`;
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
SDSDetail.styles = [styles$c];
|
|
1604
|
+
__decorateClass$c([
|
|
1605
|
+
n2({ type: String })
|
|
1606
|
+
], SDSDetail.prototype, "variation", 2);
|
|
1607
|
+
SDSDetail = __decorateClass$c([
|
|
1608
|
+
t$1("sds-detail")
|
|
1609
|
+
], SDSDetail);
|
|
1610
|
+
const styles$b = i$4`
|
|
1611
|
+
:host {
|
|
1612
|
+
--_heading-text-align: left;
|
|
1613
|
+
display: inline-block;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
h1,
|
|
1617
|
+
h2,
|
|
1618
|
+
h3,
|
|
1619
|
+
h4,
|
|
1620
|
+
h5,
|
|
1621
|
+
h6,
|
|
1622
|
+
.sds-heading {
|
|
1623
|
+
font-family: var(--sds-typography-font-family);
|
|
1624
|
+
color: var(--sds-color-semantic-text-default);
|
|
1625
|
+
display: inline-block;
|
|
1626
|
+
margin: 0;
|
|
1627
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1628
|
+
padding: 0;
|
|
1629
|
+
text-align: var(--_heading-text-align);
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
h1,
|
|
1633
|
+
.sds-heading--xl {
|
|
1634
|
+
font-size: 2rem;
|
|
1635
|
+
font-weight: 700;
|
|
1636
|
+
line-height: 1.24;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
@media (min-width: 640px) {
|
|
1640
|
+
h1,
|
|
1641
|
+
.sds-heading--xl {
|
|
1642
|
+
font-size: 2.5rem;
|
|
1643
|
+
font-weight: 700;
|
|
1644
|
+
line-height: 1.4;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
h2,
|
|
1649
|
+
.sds-heading--l {
|
|
1650
|
+
font-size: 1.5rem;
|
|
1651
|
+
font-weight: 500;
|
|
1652
|
+
line-height: 1.333;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
@media (min-width: 640px) {
|
|
1656
|
+
h2,
|
|
1657
|
+
.sds-heading--l {
|
|
1658
|
+
font-size: 2rem;
|
|
1659
|
+
font-weight: 700;
|
|
1660
|
+
line-height: 1.24;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
h3,
|
|
1665
|
+
.sds-heading--m {
|
|
1666
|
+
font-size: 1.25rem;
|
|
1667
|
+
font-weight: 500;
|
|
1668
|
+
line-height: 1.4;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
@media (min-width: 640px) {
|
|
1672
|
+
h3,
|
|
1673
|
+
.sds-heading--m {
|
|
1674
|
+
font-size: 1.5rem;
|
|
1675
|
+
font-weight: 500;
|
|
1676
|
+
line-height: 1.333;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
h4,
|
|
1681
|
+
.sds-heading--s {
|
|
1682
|
+
font-size: 1.125rem;
|
|
1683
|
+
font-weight: 500;
|
|
1684
|
+
line-height: 1.333;
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
@media (min-width: 640px) {
|
|
1688
|
+
h4,
|
|
1689
|
+
.sds-heading--s {
|
|
1690
|
+
font-size: 1.25rem;
|
|
1691
|
+
font-weight: 500;
|
|
1692
|
+
line-height: 1.4;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
h5,
|
|
1697
|
+
h6,
|
|
1698
|
+
.sds-heading--xs {
|
|
1699
|
+
font-size: 1.063rem;
|
|
1700
|
+
line-height: 1.3529;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
@media (min-width: 640px) {
|
|
1704
|
+
h5,
|
|
1705
|
+
h6,
|
|
1706
|
+
.sds-heading--xs {
|
|
1707
|
+
font-size: 1.125rem;
|
|
1708
|
+
font-weight: 500;
|
|
1709
|
+
line-height: 1.333;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
`;
|
|
1713
|
+
var __defProp$b = Object.defineProperty;
|
|
1714
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
1715
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
1716
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
1717
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1718
|
+
if (decorator = decorators[i2])
|
|
1719
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1720
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
1721
|
+
return result;
|
|
1722
|
+
};
|
|
1723
|
+
let SDSHeading = class extends r$2 {
|
|
1724
|
+
constructor() {
|
|
1725
|
+
super(...arguments);
|
|
1726
|
+
this.level = "h1";
|
|
1727
|
+
}
|
|
1728
|
+
render() {
|
|
1729
|
+
const headingClasses = {
|
|
1730
|
+
"sds-heading": true,
|
|
1731
|
+
"sds-heading--xl": this.as === "xl",
|
|
1732
|
+
"sds-heading--l": this.as === "l",
|
|
1733
|
+
"sds-heading--m": this.as === "m",
|
|
1734
|
+
"sds-heading--s": this.as === "s",
|
|
1735
|
+
"sds-heading--xs": this.as === "xs"
|
|
1736
|
+
};
|
|
1737
|
+
const classes = e$1(headingClasses);
|
|
1738
|
+
switch (this.level.toLowerCase()) {
|
|
1739
|
+
case "h1":
|
|
1740
|
+
return x`<h1 class=${classes}><slot></slot></h1>`;
|
|
1741
|
+
case "h2":
|
|
1742
|
+
return x`<h2 class=${classes}><slot></slot></h2>`;
|
|
1743
|
+
case "h3":
|
|
1744
|
+
return x`<h3 class=${classes}><slot></slot></h3>`;
|
|
1745
|
+
case "h4":
|
|
1746
|
+
return x`<h4 class=${classes}><slot></slot></h4>`;
|
|
1747
|
+
case "h5":
|
|
1748
|
+
return x`<h5 class=${classes}><slot></slot></h5>`;
|
|
1749
|
+
case "h6":
|
|
1750
|
+
return x`<h6 class=${classes}><slot></slot></h6>`;
|
|
1751
|
+
default:
|
|
1752
|
+
return x`<h1 class=${classes}><slot></slot></h1>`;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
SDSHeading.styles = [styles$b];
|
|
1757
|
+
__decorateClass$b([
|
|
1758
|
+
n2({ type: String })
|
|
1759
|
+
], SDSHeading.prototype, "level", 2);
|
|
1760
|
+
__decorateClass$b([
|
|
1761
|
+
n2({ type: String })
|
|
1762
|
+
], SDSHeading.prototype, "as", 2);
|
|
1763
|
+
SDSHeading = __decorateClass$b([
|
|
1764
|
+
t$1("sds-heading")
|
|
1765
|
+
], SDSHeading);
|
|
1766
|
+
const styles$a = i$4`
|
|
1767
|
+
:host {
|
|
1768
|
+
display: block;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
.sds-label {
|
|
1772
|
+
font-family: var(--sds-typography-font-family);
|
|
1773
|
+
font-weight: 500;
|
|
1774
|
+
color: var(--sds-color-semantic-text-default);
|
|
1775
|
+
margin: 0;
|
|
1776
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1777
|
+
padding: 0;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
.sds-label--l {
|
|
1781
|
+
font-size: 1.125rem;
|
|
1782
|
+
line-height: 1.333;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
.sds-label--m {
|
|
1786
|
+
font-size: 1rem;
|
|
1787
|
+
line-height: 1.5;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
.sds-label--s {
|
|
1791
|
+
font-size: 0.875rem;
|
|
1792
|
+
line-height: 1.428;
|
|
1793
|
+
}
|
|
1794
|
+
`;
|
|
1795
|
+
var __defProp$a = Object.defineProperty;
|
|
1796
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
1797
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
1798
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
1799
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1800
|
+
if (decorator = decorators[i2])
|
|
1801
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1802
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
1803
|
+
return result;
|
|
1804
|
+
};
|
|
1805
|
+
let SDSLabel = class extends r$2 {
|
|
1806
|
+
constructor() {
|
|
1807
|
+
super(...arguments);
|
|
1808
|
+
this.size = "l";
|
|
1809
|
+
}
|
|
1810
|
+
render() {
|
|
1811
|
+
const styleClasses = {
|
|
1812
|
+
"sds-label": true,
|
|
1813
|
+
"sds-label--l": this.size === "l",
|
|
1814
|
+
"sds-label--m": this.size === "m",
|
|
1815
|
+
"sds-label--s": this.size === "s"
|
|
1816
|
+
};
|
|
1817
|
+
const classes = e$1(styleClasses);
|
|
1818
|
+
return x`<label for="${o$1(this.for)}" class=${classes}><slot></slot></label>`;
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
SDSLabel.styles = [styles$a];
|
|
1822
|
+
__decorateClass$a([
|
|
1823
|
+
n2({ type: String })
|
|
1824
|
+
], SDSLabel.prototype, "size", 2);
|
|
1825
|
+
__decorateClass$a([
|
|
1826
|
+
n2({ type: String })
|
|
1827
|
+
], SDSLabel.prototype, "for", 2);
|
|
1828
|
+
SDSLabel = __decorateClass$a([
|
|
1829
|
+
t$1("sds-label")
|
|
1830
|
+
], SDSLabel);
|
|
1831
|
+
const styles$9 = i$4`
|
|
1832
|
+
:host {
|
|
1833
|
+
display: inline;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
:host([display-type='block']) {
|
|
1837
|
+
display: block;
|
|
1838
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1839
|
+
|
|
1840
|
+
.sds-link {
|
|
1841
|
+
display: block;
|
|
1842
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
:host([display-type='inline-block']) {
|
|
1847
|
+
display: inline-block;
|
|
1848
|
+
|
|
1849
|
+
.sds-link {
|
|
1850
|
+
display: inline-block;
|
|
1851
|
+
max-width: var(--sds-typography-max-line-width);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
:host([display-type='inline']) {
|
|
1856
|
+
display: inline;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
.sds-link {
|
|
1860
|
+
color: var(--sds-color-semantic-text-default);
|
|
1861
|
+
display: inline;
|
|
1862
|
+
font-family: var(--sds-typography-font-family);
|
|
1863
|
+
font-weight: 400;
|
|
1864
|
+
line-height: 1.333;
|
|
1865
|
+
margin: 0;
|
|
1866
|
+
padding: 0;
|
|
1867
|
+
|
|
1868
|
+
&:link,
|
|
1869
|
+
&:visited {
|
|
1870
|
+
color: var(--sds-color-semantic-text-action-default);
|
|
1871
|
+
text-decoration: underline;
|
|
1872
|
+
text-decoration-thickness: 1px;
|
|
1873
|
+
text-underline-offset: 2px;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
&:active {
|
|
1877
|
+
color: var(--sds-color-semantic-text-action-active);
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
&:hover {
|
|
1881
|
+
color: var(--sds-color-semantic-text-action-hover);
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
&:focus {
|
|
1885
|
+
border-radius: 4px;
|
|
1886
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
1887
|
+
outline-offset: 2px;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
.sds-link--l {
|
|
1892
|
+
font-size: 1.125rem;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
.sds-link--m {
|
|
1896
|
+
font-size: 1rem;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
.sds-link--s {
|
|
1900
|
+
font-size: 0.875rem;
|
|
1901
|
+
}
|
|
1902
|
+
`;
|
|
1903
|
+
var __defProp$9 = Object.defineProperty;
|
|
1904
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
1905
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
1906
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
1907
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1908
|
+
if (decorator = decorators[i2])
|
|
1909
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1910
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
1911
|
+
return result;
|
|
1912
|
+
};
|
|
1913
|
+
let SDSLink = class extends r$2 {
|
|
1914
|
+
constructor() {
|
|
1915
|
+
super(...arguments);
|
|
1916
|
+
this.size = "m";
|
|
1917
|
+
}
|
|
1918
|
+
render() {
|
|
1919
|
+
const styleClasses = {
|
|
1920
|
+
"sds-link": true,
|
|
1921
|
+
"sds-link--l": this.size === "l",
|
|
1922
|
+
"sds-link--m": this.size === "m",
|
|
1923
|
+
"sds-link--s": this.size === "s"
|
|
1924
|
+
};
|
|
1925
|
+
const classes = e$1(styleClasses);
|
|
1926
|
+
return x`<a href="${o$1(this.href)}" target="${o$1(this.target)}" class=${classes}
|
|
1927
|
+
><slot></slot
|
|
1928
|
+
></a>`;
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
SDSLink.styles = [styles$9];
|
|
1932
|
+
__decorateClass$9([
|
|
1933
|
+
n2({ type: String })
|
|
1934
|
+
], SDSLink.prototype, "href", 2);
|
|
1935
|
+
__decorateClass$9([
|
|
1936
|
+
n2({ type: String })
|
|
1937
|
+
], SDSLink.prototype, "size", 2);
|
|
1938
|
+
__decorateClass$9([
|
|
1939
|
+
n2({ type: String })
|
|
1940
|
+
], SDSLink.prototype, "target", 2);
|
|
1941
|
+
SDSLink = __decorateClass$9([
|
|
1942
|
+
t$1("sds-link")
|
|
1943
|
+
], SDSLink);
|
|
1944
|
+
const styles$8 = i$4`
|
|
1945
|
+
:host {
|
|
1946
|
+
line-height: 0;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
.sds-loader {
|
|
1950
|
+
width: 24px;
|
|
1951
|
+
height: 24px;
|
|
1952
|
+
border: 3px solid currentColor;
|
|
1953
|
+
border-bottom-color: transparent;
|
|
1954
|
+
border-radius: 50%;
|
|
1955
|
+
display: inline-block;
|
|
1956
|
+
box-sizing: border-box;
|
|
1957
|
+
animation: rotation 1s linear infinite;
|
|
1958
|
+
|
|
1959
|
+
&.sds-loader--medium {
|
|
1960
|
+
width: 18px;
|
|
1961
|
+
height: 18px;
|
|
1962
|
+
border-width: 2px;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
&.sds-loader--small {
|
|
1966
|
+
width: 14px;
|
|
1967
|
+
height: 14px;
|
|
1968
|
+
border-width: 2px;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
@keyframes rotation {
|
|
1973
|
+
0% {
|
|
1974
|
+
transform: rotate(0deg);
|
|
1975
|
+
}
|
|
1976
|
+
100% {
|
|
1977
|
+
transform: rotate(360deg);
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
`;
|
|
1981
|
+
var __defProp$8 = Object.defineProperty;
|
|
1982
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
1983
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
1984
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
1985
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1986
|
+
if (decorator = decorators[i2])
|
|
1987
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1988
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
1989
|
+
return result;
|
|
1990
|
+
};
|
|
1991
|
+
let SDSLoader = class extends r$2 {
|
|
1992
|
+
constructor() {
|
|
1993
|
+
super(...arguments);
|
|
1994
|
+
this.size = "large";
|
|
1995
|
+
this.color = "currentColor";
|
|
1996
|
+
}
|
|
1997
|
+
render() {
|
|
1998
|
+
const loaderClasses = {
|
|
1999
|
+
"sds-loader": true,
|
|
2000
|
+
"sds-loader--medium": this.size === "medium",
|
|
2001
|
+
"sds-loader--small": this.size === "small"
|
|
2002
|
+
};
|
|
2003
|
+
return x`<span class="${e$1(loaderClasses)}" style="${`color:${this.color}`}"></span>`;
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
SDSLoader.styles = [styles$8];
|
|
2007
|
+
__decorateClass$8([
|
|
2008
|
+
n2({ type: String, reflect: true })
|
|
2009
|
+
], SDSLoader.prototype, "size", 2);
|
|
2010
|
+
__decorateClass$8([
|
|
2011
|
+
n2({ type: String, reflect: true })
|
|
2012
|
+
], SDSLoader.prototype, "color", 2);
|
|
2013
|
+
SDSLoader = __decorateClass$8([
|
|
2014
|
+
t$1("sds-loader")
|
|
2015
|
+
], SDSLoader);
|
|
2016
|
+
const styles$7 = i$4`
|
|
2017
|
+
.sds-nav-card {
|
|
2018
|
+
color: var(--sds-color-semantic-text-default);
|
|
2019
|
+
background-color: var(
|
|
2020
|
+
--sds-color-global-lightblue-100
|
|
2021
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
2022
|
+
|
|
2023
|
+
font-size: var(--sds-typography-base-font-size);
|
|
2024
|
+
line-height: var(--sds-typography-base-line-height);
|
|
2025
|
+
font-weight: var(--sds-typography-base-font-weight);
|
|
2026
|
+
font-family: var(--sds-typography-font-family);
|
|
2027
|
+
|
|
2028
|
+
display: flex;
|
|
2029
|
+
min-height: 10.25rem;
|
|
2030
|
+
height: 100%;
|
|
2031
|
+
width: 100%;
|
|
2032
|
+
max-width: 50rem;
|
|
2033
|
+
|
|
2034
|
+
box-sizing: border-box;
|
|
2035
|
+
padding: var(--sds-spacing-7) var(--sds-spacing-9) var(--sds-spacing-8);
|
|
2036
|
+
gap: var(--sds-spacing-5);
|
|
2037
|
+
text-align: left;
|
|
2038
|
+
|
|
2039
|
+
border-radius: var(--sds-radius-card);
|
|
2040
|
+
border: 1px solid transparent;
|
|
2041
|
+
|
|
2042
|
+
cursor: pointer;
|
|
2043
|
+
|
|
2044
|
+
& p {
|
|
2045
|
+
padding: 0;
|
|
2046
|
+
margin: 0;
|
|
2047
|
+
hyphens: auto;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
&:link {
|
|
2051
|
+
text-decoration: none;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
&:hover {
|
|
2055
|
+
background-color: var(
|
|
2056
|
+
--sds-color-global-lightblue-300
|
|
2057
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
2058
|
+
|
|
2059
|
+
.sds-nav-card__heading {
|
|
2060
|
+
text-decoration: none;
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
&:active,
|
|
2065
|
+
&:focus:active {
|
|
2066
|
+
background-color: var(--sds-color-semantic-surface-action-selected);
|
|
2067
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
2068
|
+
|
|
2069
|
+
.sds-nav-card__heading {
|
|
2070
|
+
text-decoration: underline;
|
|
2071
|
+
text-decoration-thickness: 0.075rem;
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
::slotted(*) {
|
|
2075
|
+
stroke: var(--sds-color-semantic-icon-on-action);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
&:focus {
|
|
2080
|
+
border: 1px solid var(--sds-color-semantic-border-focus);
|
|
2081
|
+
background: var(
|
|
2082
|
+
--sds-color-global-lightblue-100
|
|
2083
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
&:disabled {
|
|
2087
|
+
background-color: var(--sds-color-semantic-surface-disabled);
|
|
2088
|
+
pointer-events: none;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.sds-nav-card--hasIcon {
|
|
2093
|
+
padding: var(--sds-spacing-7) var(--sds-spacing-7) var(--sds-spacing-8);
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
.sds-nav-card__content {
|
|
2097
|
+
display: flex;
|
|
2098
|
+
flex-direction: column;
|
|
2099
|
+
width: 100%;
|
|
2100
|
+
gap: var(--sds-spacing-3);
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
.sds-nav-card__text {
|
|
2104
|
+
display: -webkit-box;
|
|
2105
|
+
-webkit-line-clamp: 3;
|
|
2106
|
+
-webkit-box-orient: vertical;
|
|
2107
|
+
overflow: hidden;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
::slotted(*) {
|
|
2111
|
+
height: 4.5rem;
|
|
2112
|
+
min-width: 4.5rem;
|
|
2113
|
+
width: 4.5rem;
|
|
2114
|
+
align-self: center;
|
|
2115
|
+
stroke: var(
|
|
2116
|
+
--sds-color-global-black
|
|
2117
|
+
); // TODO: Global variable used, should be replaced by a more spesific one
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
.sds-nav-card__heading {
|
|
2121
|
+
font-weight: 700;
|
|
2122
|
+
font-size: 1.5rem;
|
|
2123
|
+
margin: 0;
|
|
2124
|
+
text-decoration: underline;
|
|
2125
|
+
text-decoration-thickness: 0.075rem;
|
|
2126
|
+
text-underline-offset: 0.146rem;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
.sds-nav-card--medium {
|
|
2130
|
+
min-height: 7rem;
|
|
2131
|
+
|
|
2132
|
+
.sds-nav-card__text {
|
|
2133
|
+
display: -webkit-box;
|
|
2134
|
+
display: flex;
|
|
2135
|
+
|
|
2136
|
+
-webkit-line-clamp: 1;
|
|
2137
|
+
-webkit-box-orient: vertical;
|
|
2138
|
+
|
|
2139
|
+
overflow: hidden;
|
|
2140
|
+
text-overflow: ellipsis;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
::slotted(*) {
|
|
2144
|
+
height: 3rem;
|
|
2145
|
+
min-width: 3rem;
|
|
2146
|
+
width: 3rem;
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
.sds-nav-card--small {
|
|
2151
|
+
min-height: 4.5rem;
|
|
2152
|
+
padding: var(--sds-spacing-5) var(--sds-spacing-8) var(--sds-spacing-6);
|
|
2153
|
+
|
|
2154
|
+
.sds-nav-card--hasIcon {
|
|
2155
|
+
padding: var(--sds-spacing-5) var(--sds-spacing-7)
|
|
2156
|
+
var(--sds-spacing-6);
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
.sds-nav-card__content {
|
|
2160
|
+
gap: 0;
|
|
2161
|
+
align-self: center;
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
::slotted(*) {
|
|
2165
|
+
height: 2.5rem;
|
|
2166
|
+
min-width: 2.5rem;
|
|
2167
|
+
width: 2.5rem;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
`;
|
|
2171
|
+
var __defProp$7 = Object.defineProperty;
|
|
2172
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
2173
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
2174
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
2175
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
2176
|
+
if (decorator = decorators[i2])
|
|
2177
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2178
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
2179
|
+
return result;
|
|
2180
|
+
};
|
|
2181
|
+
let SDSNavCard = class extends r$2 {
|
|
2182
|
+
constructor() {
|
|
2183
|
+
super(...arguments);
|
|
2184
|
+
this.size = "large";
|
|
2185
|
+
this.level = "h2";
|
|
2186
|
+
this.hasIcon = false;
|
|
2187
|
+
}
|
|
2188
|
+
firstUpdated() {
|
|
2189
|
+
this._checkSlotContent();
|
|
2190
|
+
}
|
|
2191
|
+
_handleSlotChange() {
|
|
2192
|
+
this._checkSlotContent();
|
|
2193
|
+
}
|
|
2194
|
+
_filterToMeaningfulNodes(nodes) {
|
|
2195
|
+
return nodes.filter((node) => {
|
|
2196
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
2197
|
+
const textContent = node.textContent;
|
|
2198
|
+
return textContent !== null && textContent.trim().length > 0;
|
|
2199
|
+
}
|
|
2200
|
+
return true;
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
_checkSlotContent() {
|
|
2204
|
+
const assignedNodes = this.iconSlot.assignedNodes({ flatten: true });
|
|
2205
|
+
const meaningfulNodes = this._filterToMeaningfulNodes(assignedNodes);
|
|
2206
|
+
this.hasIcon = meaningfulNodes.length !== 0;
|
|
2207
|
+
}
|
|
2208
|
+
_renderHeading() {
|
|
2209
|
+
const headingClass = "sds-nav-card__heading";
|
|
2210
|
+
switch (this.level) {
|
|
2211
|
+
case "h2":
|
|
2212
|
+
return x`<h2 class="${headingClass}">${this.heading}</h2>`;
|
|
2213
|
+
case "h3":
|
|
2214
|
+
return x`<h3 class="${headingClass}">${this.heading}</h3>`;
|
|
2215
|
+
case "h4":
|
|
2216
|
+
return x`<h4 class="${headingClass}">${this.heading}</h4>`;
|
|
2217
|
+
case "h5":
|
|
2218
|
+
return x`<h5 class="${headingClass}">${this.heading}</h5>`;
|
|
2219
|
+
case "h6":
|
|
2220
|
+
return x`<h6 class="${headingClass}">${this.heading}</h6>`;
|
|
2221
|
+
default:
|
|
2222
|
+
return x`<h2 class="${headingClass}">${this.heading}</h2>`;
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
render() {
|
|
2226
|
+
const navCardClasses = {
|
|
2227
|
+
"sds-nav-card": true,
|
|
2228
|
+
"sds-nav-card--hasIcon": this.hasIcon,
|
|
2229
|
+
"sds-nav-card--small": this.size === "small",
|
|
2230
|
+
"sds-nav-card--medium": this.size === "medium",
|
|
2231
|
+
"sds-nav-card--large": this.size === "large"
|
|
2232
|
+
};
|
|
2233
|
+
return x`
|
|
2234
|
+
<a class="${e$1(navCardClasses)}" href="${this.link}">
|
|
2235
|
+
<slot name="before" @slotchange=${this._handleSlotChange}></slot>
|
|
2236
|
+
<div class="sds-nav-card__content">
|
|
2237
|
+
${this._renderHeading()}
|
|
2238
|
+
<slot></slot>
|
|
2239
|
+
</div>
|
|
2240
|
+
</a>
|
|
2241
|
+
`;
|
|
2242
|
+
}
|
|
2243
|
+
};
|
|
2244
|
+
SDSNavCard.styles = [styles$7];
|
|
2245
|
+
__decorateClass$7([
|
|
2246
|
+
n2({ type: String, reflect: true })
|
|
2247
|
+
], SDSNavCard.prototype, "size", 2);
|
|
2248
|
+
__decorateClass$7([
|
|
2249
|
+
n2({ type: String, reflect: true })
|
|
2250
|
+
], SDSNavCard.prototype, "heading", 2);
|
|
2251
|
+
__decorateClass$7([
|
|
2252
|
+
n2({ type: String, reflect: true })
|
|
2253
|
+
], SDSNavCard.prototype, "level", 2);
|
|
2254
|
+
__decorateClass$7([
|
|
2255
|
+
n2({ type: String, reflect: true })
|
|
2256
|
+
], SDSNavCard.prototype, "link", 2);
|
|
2257
|
+
__decorateClass$7([
|
|
2258
|
+
r2()
|
|
2259
|
+
], SDSNavCard.prototype, "hasIcon", 2);
|
|
2260
|
+
__decorateClass$7([
|
|
2261
|
+
e$3("slot")
|
|
2262
|
+
], SDSNavCard.prototype, "iconSlot", 2);
|
|
2263
|
+
SDSNavCard = __decorateClass$7([
|
|
2264
|
+
t$1("sds-nav-card")
|
|
2265
|
+
], SDSNavCard);
|
|
2266
|
+
const styles$6 = i$4`
|
|
2267
|
+
:host {
|
|
2268
|
+
display: block;
|
|
2269
|
+
box-sizing: border-box;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
.sds-notification {
|
|
2273
|
+
font-family: var(--sds-typography-font-family);
|
|
2274
|
+
font-size: 1rem;
|
|
2275
|
+
font-weight: 400;
|
|
2276
|
+
line-height: 1.25;
|
|
2277
|
+
|
|
2278
|
+
display: flex;
|
|
2279
|
+
gap: 0.5rem;
|
|
2280
|
+
|
|
2281
|
+
background-color: var(--sds-color-semantic-surface-info-subtle);
|
|
2282
|
+
border: 1px solid var(--sds-color-semantic-surface-info-xtreme);
|
|
2283
|
+
color: var(--sds-color-semantic-text-default);
|
|
2284
|
+
|
|
2285
|
+
text-align: left;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
.sds-notification--success {
|
|
2289
|
+
background-color: var(--sds-color-semantic-surface-ok-subtle);
|
|
2290
|
+
border-color: var(--sds-color-semantic-surface-ok-xtreme);
|
|
2291
|
+
|
|
2292
|
+
.sds-notification__type {
|
|
2293
|
+
background-color: var(--sds-color-semantic-surface-ok-xtreme);
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
.sds-notification--attention {
|
|
2298
|
+
background-color: var(--sds-color-semantic-surface-attention-subtle);
|
|
2299
|
+
border-color: var(--sds-color-semantic-surface-attention-xtreme);
|
|
2300
|
+
|
|
2301
|
+
.sds-notification__type {
|
|
2302
|
+
background-color: var(--sds-color-semantic-surface-attention-xtreme);
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
.sds-notification--warning {
|
|
2307
|
+
background-color: var(--sds-color-semantic-surface-warning-subtle);
|
|
2308
|
+
border-color: var(--sds-color-semantic-surface-warning-xtreme);
|
|
2309
|
+
|
|
2310
|
+
.sds-notification__type {
|
|
2311
|
+
background-color: var(--sds-color-semantic-surface-warning-xtreme);
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
.sds-notification__icon::before {
|
|
2315
|
+
width: 4px;
|
|
2316
|
+
height: 14px;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
.sds-notification--critical {
|
|
2321
|
+
background-color: var(--sds-color-semantic-surface-critical-subtle);
|
|
2322
|
+
border-color: var(--sds-color-semantic-surface-critical-xtreme);
|
|
2323
|
+
|
|
2324
|
+
.sds-notification__type {
|
|
2325
|
+
background-color: var(--sds-color-semantic-surface-critical-xtreme);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
.sds-notification__icon::before {
|
|
2329
|
+
width: 10px;
|
|
2330
|
+
height: 10px;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
.sds-notification__type {
|
|
2335
|
+
background-color: var(--sds-color-semantic-surface-info-xtreme);
|
|
2336
|
+
color: white;
|
|
2337
|
+
padding: 1rem 0.5rem;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
.sds-notification__content {
|
|
2341
|
+
display: flex;
|
|
2342
|
+
flex: 1;
|
|
2343
|
+
gap: 1rem;
|
|
2344
|
+
padding: 1rem 0.5rem;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
.sds-notification__content-text {
|
|
2348
|
+
flex: 1;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
::slotted([slot='title']),
|
|
2352
|
+
::slotted(:is(h1, h2, h3, h4, h5, h6)) {
|
|
2353
|
+
color: var(--sds-color-semantic-text-default) !important;
|
|
2354
|
+
font-size: 1rem !important;
|
|
2355
|
+
font-style: normal !important;
|
|
2356
|
+
font-weight: 700 !important;
|
|
2357
|
+
line-height: 1.5 !important;
|
|
2358
|
+
margin: 0 !important;
|
|
2359
|
+
max-width: var(--sds-typography-max-line-width) !important;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
::slotted([slot='message']),
|
|
2363
|
+
::slotted(:is(p)) {
|
|
2364
|
+
color: var(--sds-color-semantic-text-default) !important;
|
|
2365
|
+
font-size: 1rem !important;
|
|
2366
|
+
font-style: normal !important;
|
|
2367
|
+
font-weight: 400 !important;
|
|
2368
|
+
line-height: 1.5 !important;
|
|
2369
|
+
margin: 0 !important;
|
|
2370
|
+
max-width: var(--sds-typography-max-line-width) !important;
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
.sds-notification__icon {
|
|
2374
|
+
display: block;
|
|
2375
|
+
position: relative;
|
|
2376
|
+
z-index: 1;
|
|
2377
|
+
|
|
2378
|
+
&::before {
|
|
2379
|
+
content: '';
|
|
2380
|
+
display: block;
|
|
2381
|
+
width: 14px;
|
|
2382
|
+
height: 14px;
|
|
2383
|
+
background-color: black;
|
|
2384
|
+
position: absolute;
|
|
2385
|
+
top: 50%;
|
|
2386
|
+
left: 50%;
|
|
2387
|
+
transform: translate(-50%, -50%);
|
|
2388
|
+
z-index: -1;
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
.sds-notification__remove-btn {
|
|
2393
|
+
border: 0;
|
|
2394
|
+
border-radius: var(--sds-radius-4);
|
|
2395
|
+
background: transparent;
|
|
2396
|
+
cursor: pointer;
|
|
2397
|
+
flex: 0 1 auto;
|
|
2398
|
+
padding: 0;
|
|
2399
|
+
width: 24px;
|
|
2400
|
+
height: 24px;
|
|
2401
|
+
|
|
2402
|
+
display: flex;
|
|
2403
|
+
align-items: center;
|
|
2404
|
+
justify-content: center;
|
|
2405
|
+
|
|
2406
|
+
&:focus {
|
|
2407
|
+
outline: 2px solid var(--sds-color-semantic-surface-action-default);
|
|
2408
|
+
outline-offset: 1px;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
&:hover {
|
|
2412
|
+
background-color: var(--sds-color-semantic-surface-action-subtle);
|
|
2413
|
+
border: 2px solid var(--sds-color-semantic-surface-action-hover);
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
&:active {
|
|
2417
|
+
background-color: var(--sds-color-semantic-surface-action-active);
|
|
2418
|
+
border: 2px solid var(--sds-color-semantic-surface-action-active);
|
|
2419
|
+
color: var(--sds-color-semantic-text-on-action);
|
|
2420
|
+
outline: 0;
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
`;
|
|
2424
|
+
var __defProp$6 = Object.defineProperty;
|
|
2425
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
2426
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
2427
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
2428
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
2429
|
+
if (decorator = decorators[i2])
|
|
2430
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2431
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
2432
|
+
return result;
|
|
2433
|
+
};
|
|
2434
|
+
const notificationIcons = {
|
|
2435
|
+
info: "info-material-filled",
|
|
2436
|
+
success: "check_circle-material-filled",
|
|
2437
|
+
attention: "error-material-filled",
|
|
2438
|
+
warning: "warning-material-filled",
|
|
2439
|
+
critical: "dangerous-material-filled"
|
|
2440
|
+
};
|
|
2441
|
+
let SDSNotification = class extends r$2 {
|
|
2442
|
+
constructor() {
|
|
2443
|
+
super(...arguments);
|
|
2444
|
+
this.variant = "info";
|
|
2445
|
+
this._remove = () => {
|
|
2446
|
+
this.dispatchEvent(
|
|
2447
|
+
new CustomEvent("sds-remove", {
|
|
2448
|
+
bubbles: true,
|
|
2449
|
+
composed: true
|
|
2450
|
+
})
|
|
2451
|
+
);
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2454
|
+
render() {
|
|
2455
|
+
const notificationClasses = {
|
|
2456
|
+
"sds-notification": true,
|
|
2457
|
+
[`sds-notification--${this.variant}`]: true
|
|
2458
|
+
};
|
|
2459
|
+
return x`<div class="${e$1(notificationClasses)}">
|
|
2460
|
+
<div class="sds-notification__type">
|
|
2461
|
+
<sds-icon class="sds-notification__icon" name="${notificationIcons[this.variant]}" size="m"></sds-icon>
|
|
2462
|
+
</div>
|
|
2463
|
+
<div class="sds-notification__content">
|
|
2464
|
+
<div class="sds-notification__content-text">
|
|
2465
|
+
<slot name="title"></slot>
|
|
2466
|
+
<slot name="message"></slot>
|
|
2467
|
+
</div>
|
|
2468
|
+
${this.removableLabel ? x`<button
|
|
2469
|
+
class="sds-notification__remove-btn"
|
|
2470
|
+
@click=${this._remove}
|
|
2471
|
+
aria-label="${this.removableLabel}"
|
|
2472
|
+
>
|
|
2473
|
+
<sds-icon name="close-material-outlined" size="s"></sds-icon>
|
|
2474
|
+
</button>` : E}
|
|
2475
|
+
</div>
|
|
2476
|
+
</div>`;
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
SDSNotification.styles = [styles$6];
|
|
2480
|
+
__decorateClass$6([
|
|
2481
|
+
n2({ type: String, reflect: true })
|
|
2482
|
+
], SDSNotification.prototype, "variant", 2);
|
|
2483
|
+
__decorateClass$6([
|
|
2484
|
+
n2({ type: String, attribute: "removable-label", reflect: true })
|
|
2485
|
+
], SDSNotification.prototype, "removableLabel", 2);
|
|
2486
|
+
SDSNotification = __decorateClass$6([
|
|
2487
|
+
t$1("sds-notification")
|
|
2488
|
+
], SDSNotification);
|
|
2489
|
+
const styles$5 = i$4`
|
|
2490
|
+
:host {
|
|
2491
|
+
display: block;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
.sds-paragraph {
|
|
2495
|
+
font-family: var(--sds-typography-font-family);
|
|
2496
|
+
font-weight: 400;
|
|
2497
|
+
color: var(--sds-color-semantic-text-default);
|
|
2498
|
+
margin: 0;
|
|
2499
|
+
max-width: var(--sds-typography-max-line-width);
|
|
2500
|
+
padding: 0;
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
.sds-paragraph--xl {
|
|
2504
|
+
font-size: 1.25rem;
|
|
2505
|
+
line-height: 1.4;
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
.sds-paragraph--l {
|
|
2509
|
+
font-size: 1.125rem;
|
|
2510
|
+
line-height: 1.333;
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
.sds-paragraph--m {
|
|
2514
|
+
font-size: 1rem;
|
|
2515
|
+
line-height: 1.5;
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
@media (max-width: 640px) {
|
|
2519
|
+
.sds-paragraph--m {
|
|
2520
|
+
line-height: 1.375;
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
`;
|
|
2524
|
+
var __defProp$5 = Object.defineProperty;
|
|
2525
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
2526
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
2527
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
2528
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
2529
|
+
if (decorator = decorators[i2])
|
|
2530
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2531
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
2532
|
+
return result;
|
|
2533
|
+
};
|
|
2534
|
+
let SDSParagraph = class extends r$2 {
|
|
2535
|
+
constructor() {
|
|
2536
|
+
super(...arguments);
|
|
2537
|
+
this.size = "xl";
|
|
2538
|
+
}
|
|
2539
|
+
render() {
|
|
2540
|
+
const styleClasses = {
|
|
2541
|
+
"sds-paragraph": true,
|
|
2542
|
+
"sds-paragraph--xl": this.size === "xl",
|
|
2543
|
+
"sds-paragraph--l": this.size === "l",
|
|
2544
|
+
"sds-paragraph--m": this.size === "m"
|
|
2545
|
+
};
|
|
2546
|
+
const classes = e$1(styleClasses);
|
|
2547
|
+
return x`<p class=${classes}><slot></slot></p>`;
|
|
2548
|
+
}
|
|
2549
|
+
};
|
|
2550
|
+
SDSParagraph.styles = [styles$5];
|
|
2551
|
+
__decorateClass$5([
|
|
2552
|
+
n2({ type: String })
|
|
2553
|
+
], SDSParagraph.prototype, "size", 2);
|
|
2554
|
+
SDSParagraph = __decorateClass$5([
|
|
2555
|
+
t$1("sds-paragraph")
|
|
2556
|
+
], SDSParagraph);
|
|
2557
|
+
const styles$4 = i$4`
|
|
2558
|
+
:host {
|
|
2559
|
+
flex: 0 0 auto;
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
.sds-radio__label {
|
|
2563
|
+
align-items: flex-start;
|
|
2564
|
+
cursor: pointer;
|
|
2565
|
+
color: var(--sds-color-semantic-text-default);
|
|
2566
|
+
display: inline-flex;
|
|
2567
|
+
font-family: var(--sds-typography-font-family);
|
|
2568
|
+
font-size: 1rem;
|
|
2569
|
+
font-weight: 400;
|
|
2570
|
+
gap: var(--sds-spacing-3);
|
|
2571
|
+
line-height: 1.25;
|
|
2572
|
+
|
|
2573
|
+
&:has(:disabled) {
|
|
2574
|
+
cursor: default;
|
|
2575
|
+
pointer-events: none;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
.sds-radio__input {
|
|
2580
|
+
appearance: none;
|
|
2581
|
+
background-color: transparent;
|
|
2582
|
+
color: currentColor;
|
|
2583
|
+
cursor: pointer;
|
|
2584
|
+
width: 24px;
|
|
2585
|
+
height: 24px;
|
|
2586
|
+
border: 2px solid var(--sds-color-semantic-border-default);
|
|
2587
|
+
border-radius: 50%;
|
|
2588
|
+
margin: 0;
|
|
2589
|
+
position: relative;
|
|
2590
|
+
|
|
2591
|
+
&:checked {
|
|
2592
|
+
background-color: white;
|
|
2593
|
+
border-color: var(--sds-color-semantic-surface-action-selected);
|
|
2594
|
+
border-width: 3px;
|
|
2595
|
+
|
|
2596
|
+
&::after {
|
|
2597
|
+
content: '';
|
|
2598
|
+
position: absolute;
|
|
2599
|
+
top: 50%;
|
|
2600
|
+
left: 50%;
|
|
2601
|
+
width: 12px;
|
|
2602
|
+
height: 12px;
|
|
2603
|
+
background-color: var(--sds-color-semantic-icon-action-default);
|
|
2604
|
+
border-radius: 50%;
|
|
2605
|
+
transform: translate(-50%, -50%);
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
&:hover {
|
|
2610
|
+
border-width: 3px;
|
|
2611
|
+
|
|
2612
|
+
&:checked {
|
|
2613
|
+
&::after {
|
|
2614
|
+
width: 12px;
|
|
2615
|
+
height: 12px;
|
|
2616
|
+
transform: translate(-50%, -50%);
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
&:focus {
|
|
2622
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
2623
|
+
outline-offset: 1px;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
&.sds-radio__input--error {
|
|
2627
|
+
border: 2px solid var(--sds-color-semantic-surface-critical-xtreme);
|
|
2628
|
+
|
|
2629
|
+
&:checked {
|
|
2630
|
+
&::after {
|
|
2631
|
+
width: 12px;
|
|
2632
|
+
height: 12px;
|
|
2633
|
+
transform: translate(-50%, -50%);
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
&:disabled {
|
|
2639
|
+
border: 2px solid var(--sds-color-semantic-border-disabled);
|
|
2640
|
+
|
|
2641
|
+
&:checked {
|
|
2642
|
+
border-width: 3px;
|
|
2643
|
+
background-color: white;
|
|
2644
|
+
|
|
2645
|
+
&::after {
|
|
2646
|
+
background-color: var(--sds-color-semantic-border-disabled);
|
|
2647
|
+
width: 12px;
|
|
2648
|
+
height: 12px;
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
& + .sds-radio__text {
|
|
2653
|
+
color: var(--sds-color-semantic-border-disabled);
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
.sds-radio__text {
|
|
2659
|
+
display: inline-block;
|
|
2660
|
+
max-width: var(--sds-typography-max-line-width);
|
|
2661
|
+
padding-top: 2px;
|
|
2662
|
+
}
|
|
2663
|
+
`;
|
|
2664
|
+
var __defProp$4 = Object.defineProperty;
|
|
2665
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
2666
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
2667
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
2668
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
2669
|
+
if (decorator = decorators[i2])
|
|
2670
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2671
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
2672
|
+
return result;
|
|
2673
|
+
};
|
|
2674
|
+
let SDSRadio = class extends r$2 {
|
|
2675
|
+
constructor() {
|
|
2676
|
+
super();
|
|
2677
|
+
this.disabled = false;
|
|
2678
|
+
this.required = false;
|
|
2679
|
+
this.label = "";
|
|
2680
|
+
this.hideLabel = false;
|
|
2681
|
+
this.checked = false;
|
|
2682
|
+
this.error = false;
|
|
2683
|
+
this._initialChecked = false;
|
|
2684
|
+
this._handleKeydown = (event) => {
|
|
2685
|
+
if (!this.name || this.disabled) return;
|
|
2686
|
+
const root = this.getRootNode();
|
|
2687
|
+
const radios = Array.from(root.querySelectorAll(`sds-radio[name="${this.name}"]`));
|
|
2688
|
+
const currentIndex = radios.indexOf(this);
|
|
2689
|
+
if (currentIndex === -1) return;
|
|
2690
|
+
let targetIndex = null;
|
|
2691
|
+
switch (event.key) {
|
|
2692
|
+
case "ArrowUp":
|
|
2693
|
+
case "ArrowLeft":
|
|
2694
|
+
targetIndex = currentIndex > 0 ? currentIndex - 1 : radios.length - 1;
|
|
2695
|
+
break;
|
|
2696
|
+
case "ArrowDown":
|
|
2697
|
+
case "ArrowRight":
|
|
2698
|
+
targetIndex = currentIndex < radios.length - 1 ? currentIndex + 1 : 0;
|
|
2699
|
+
break;
|
|
2700
|
+
default:
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2703
|
+
const targetRadio = radios[targetIndex];
|
|
2704
|
+
targetRadio?.focus();
|
|
2705
|
+
event.preventDefault();
|
|
2706
|
+
};
|
|
2707
|
+
this._handleChange = (event) => {
|
|
2708
|
+
if (!this.disabled) {
|
|
2709
|
+
const elem = event.target;
|
|
2710
|
+
this.checked = elem.checked;
|
|
2711
|
+
this._validate();
|
|
2712
|
+
this.dispatchEvent(
|
|
2713
|
+
new CustomEvent("change", {
|
|
2714
|
+
detail: { checked: this.checked, value: this.value },
|
|
2715
|
+
bubbles: true,
|
|
2716
|
+
composed: true
|
|
2717
|
+
})
|
|
2718
|
+
);
|
|
2719
|
+
}
|
|
2720
|
+
};
|
|
2721
|
+
this._handleFocus = (event) => {
|
|
2722
|
+
event.stopImmediatePropagation();
|
|
2723
|
+
this.dispatchEvent(new CustomEvent("focus", { bubbles: true, composed: true }));
|
|
2724
|
+
};
|
|
2725
|
+
this._handleBlur = (event) => {
|
|
2726
|
+
event.stopImmediatePropagation();
|
|
2727
|
+
this.dispatchEvent(new CustomEvent("blur", { bubbles: true, composed: true }));
|
|
2728
|
+
};
|
|
2729
|
+
this.internals = this.attachInternals();
|
|
2730
|
+
this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
2731
|
+
}
|
|
2732
|
+
connectedCallback() {
|
|
2733
|
+
super.connectedCallback();
|
|
2734
|
+
this.internals.role = "radio";
|
|
2735
|
+
if (!this._initialChecked) {
|
|
2736
|
+
this._initialChecked = this.checked;
|
|
2737
|
+
}
|
|
2738
|
+
this._validate();
|
|
2739
|
+
this.addEventListener("keydown", this._handleKeydown);
|
|
2740
|
+
}
|
|
2741
|
+
disconnectedCallback() {
|
|
2742
|
+
super.disconnectedCallback();
|
|
2743
|
+
this.removeEventListener("keydown", this._handleKeydown);
|
|
2744
|
+
}
|
|
2745
|
+
formResetCallback() {
|
|
2746
|
+
this.checked = this._initialChecked;
|
|
2747
|
+
this.control.checked = this._initialChecked;
|
|
2748
|
+
this.internals.setFormValue(this.checked ? this.value ?? null : null);
|
|
2749
|
+
this._validate();
|
|
2750
|
+
}
|
|
2751
|
+
_validate() {
|
|
2752
|
+
if (this.required && !this.checked) {
|
|
2753
|
+
this.setCustomValidity("This field is required.");
|
|
2754
|
+
} else {
|
|
2755
|
+
this.setCustomValidity("");
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
updated(changedProperties) {
|
|
2759
|
+
super.updated?.(changedProperties);
|
|
2760
|
+
if (changedProperties.has("checked")) {
|
|
2761
|
+
this._validate();
|
|
2762
|
+
if (this.checked) {
|
|
2763
|
+
this._uncheckSiblings();
|
|
2764
|
+
this.internals.setFormValue(this.value ?? null);
|
|
2765
|
+
} else {
|
|
2766
|
+
this.internals.setFormValue(null);
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
if (changedProperties.has("required") && this.control) {
|
|
2770
|
+
this.control.required = this.required;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
_uncheckSiblings() {
|
|
2774
|
+
if (!this.name) return;
|
|
2775
|
+
const root = this.getRootNode();
|
|
2776
|
+
const radios = root.querySelectorAll(`sds-radio[name="${this.name}"]`);
|
|
2777
|
+
radios.forEach((radio) => {
|
|
2778
|
+
if (radio !== this) {
|
|
2779
|
+
radio.checked = false;
|
|
2780
|
+
radio.internals.setFormValue(null);
|
|
2781
|
+
const input = radio.shadowRoot?.querySelector("#control");
|
|
2782
|
+
if (input) {
|
|
2783
|
+
input.checked = false;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
get form() {
|
|
2789
|
+
return this.internals.form;
|
|
2790
|
+
}
|
|
2791
|
+
get type() {
|
|
2792
|
+
return this.localName;
|
|
2793
|
+
}
|
|
2794
|
+
get validity() {
|
|
2795
|
+
return this.internals.validity;
|
|
2796
|
+
}
|
|
2797
|
+
get validationMessage() {
|
|
2798
|
+
return this.internals.validationMessage;
|
|
2799
|
+
}
|
|
2800
|
+
get willValidate() {
|
|
2801
|
+
return this.internals.willValidate;
|
|
2802
|
+
}
|
|
2803
|
+
checkValidity() {
|
|
2804
|
+
return this.internals.checkValidity();
|
|
2805
|
+
}
|
|
2806
|
+
reportValidity() {
|
|
2807
|
+
return this.internals.reportValidity();
|
|
2808
|
+
}
|
|
2809
|
+
setCustomValidity(message) {
|
|
2810
|
+
this.internals.setValidity({ customError: !!message }, message);
|
|
2811
|
+
}
|
|
2812
|
+
formDisabledCallback(disabled) {
|
|
2813
|
+
this.disabled = disabled;
|
|
2814
|
+
if (this.control) this.control.disabled = disabled;
|
|
2815
|
+
}
|
|
2816
|
+
focus() {
|
|
2817
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.focus();
|
|
2818
|
+
}
|
|
2819
|
+
blur() {
|
|
2820
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.blur();
|
|
2821
|
+
}
|
|
2822
|
+
click() {
|
|
2823
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.click();
|
|
2824
|
+
}
|
|
2825
|
+
render() {
|
|
2826
|
+
const radioClasses = {
|
|
2827
|
+
"sds-radio": true,
|
|
2828
|
+
"sds-radio--error": Boolean(this.error)
|
|
2829
|
+
};
|
|
2830
|
+
const inputClasses = {
|
|
2831
|
+
"sds-radio__input": true,
|
|
2832
|
+
"sds-radio__input--error": Boolean(this.error)
|
|
2833
|
+
};
|
|
2834
|
+
return x`
|
|
2835
|
+
<div class="${e$1(radioClasses)}">
|
|
2836
|
+
<label class="sds-radio__label">
|
|
2837
|
+
<input
|
|
2838
|
+
id="control"
|
|
2839
|
+
type="radio"
|
|
2840
|
+
name="${o$1(this.name)}"
|
|
2841
|
+
value="${o$1(this.value)}"
|
|
2842
|
+
?checked="${this.checked}"
|
|
2843
|
+
?disabled="${this.disabled}"
|
|
2844
|
+
@change="${this._handleChange}"
|
|
2845
|
+
@focus="${this._handleFocus}"
|
|
2846
|
+
@blur="${this._handleBlur}"
|
|
2847
|
+
class="${e$1(inputClasses)}"
|
|
2848
|
+
/>
|
|
2849
|
+
${this.label ? x`<span class="sds-radio__text">${this.label}</span>` : E}
|
|
2850
|
+
</label>
|
|
2851
|
+
</div>
|
|
2852
|
+
`;
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
SDSRadio.styles = [styles$4];
|
|
2856
|
+
SDSRadio.formAssociated = true;
|
|
2857
|
+
__decorateClass$4([
|
|
2858
|
+
n2({ type: Boolean, reflect: true })
|
|
2859
|
+
], SDSRadio.prototype, "disabled", 2);
|
|
2860
|
+
__decorateClass$4([
|
|
2861
|
+
n2({ type: Boolean, reflect: true })
|
|
2862
|
+
], SDSRadio.prototype, "required", 2);
|
|
2863
|
+
__decorateClass$4([
|
|
2864
|
+
n2({ type: String, reflect: true })
|
|
2865
|
+
], SDSRadio.prototype, "label", 2);
|
|
2866
|
+
__decorateClass$4([
|
|
2867
|
+
n2({ type: Boolean, reflect: true, attribute: "hide-label" })
|
|
2868
|
+
], SDSRadio.prototype, "hideLabel", 2);
|
|
2869
|
+
__decorateClass$4([
|
|
2870
|
+
n2({ type: String, reflect: true })
|
|
2871
|
+
], SDSRadio.prototype, "name", 2);
|
|
2872
|
+
__decorateClass$4([
|
|
2873
|
+
n2({ type: String })
|
|
2874
|
+
], SDSRadio.prototype, "value", 2);
|
|
2875
|
+
__decorateClass$4([
|
|
2876
|
+
n2({ type: Boolean, reflect: true })
|
|
2877
|
+
], SDSRadio.prototype, "checked", 2);
|
|
2878
|
+
__decorateClass$4([
|
|
2879
|
+
n2({ type: Boolean, reflect: true })
|
|
2880
|
+
], SDSRadio.prototype, "error", 2);
|
|
2881
|
+
__decorateClass$4([
|
|
2882
|
+
e$3("#control")
|
|
2883
|
+
], SDSRadio.prototype, "control", 2);
|
|
2884
|
+
SDSRadio = __decorateClass$4([
|
|
2885
|
+
t$1("sds-radio")
|
|
2886
|
+
], SDSRadio);
|
|
2887
|
+
const styles$3 = i$4`
|
|
2888
|
+
.sds-radio-group {
|
|
2889
|
+
border: 0;
|
|
2890
|
+
margin: 0;
|
|
2891
|
+
padding: 0;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
.sds-radio-group__legend {
|
|
2895
|
+
color: var(--sds-color-semantic-text-default);
|
|
2896
|
+
font-family: var(--sds-typography-font-family);
|
|
2897
|
+
font-size: 1rem;
|
|
2898
|
+
font-weight: 600;
|
|
2899
|
+
line-height: 1.5;
|
|
2900
|
+
margin: 0 0 var(--sds-spacing-2) 0;
|
|
2901
|
+
max-width: var(--sds-typography-max-line-width);
|
|
2902
|
+
padding: 0;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
.sds-radio-group__help-text {
|
|
2906
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
2907
|
+
font-family: var(--sds-typography-font-family);
|
|
2908
|
+
font-size: 1rem;
|
|
2909
|
+
font-weight: 400;
|
|
2910
|
+
line-height: 1.25rem;
|
|
2911
|
+
margin: 0;
|
|
2912
|
+
max-width: var(--sds-typography-max-line-width);
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
.sds-radio-group__radios {
|
|
2916
|
+
display: flex;
|
|
2917
|
+
flex-direction: column;
|
|
2918
|
+
gap: var(--sds-spacing-5);
|
|
2919
|
+
margin-top: var(--sds-spacing-3);
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
.sds-radio-group__error-message {
|
|
2923
|
+
margin: var(--sds-spacing-5) 0 0;
|
|
2924
|
+
max-width: var(--sds-typography-max-line-width);
|
|
2925
|
+
align-items: flex-start;
|
|
2926
|
+
color: var(--sds-color-semantic-text-default);
|
|
2927
|
+
display: flex;
|
|
2928
|
+
line-height: 1.5rem;
|
|
2929
|
+
gap: var(--sds-spacing-2);
|
|
2930
|
+
}
|
|
2931
|
+
`;
|
|
2932
|
+
var __defProp$3 = Object.defineProperty;
|
|
2933
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
2934
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
2935
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
2936
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
2937
|
+
if (decorator = decorators[i2])
|
|
2938
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2939
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
2940
|
+
return result;
|
|
2941
|
+
};
|
|
2942
|
+
let SDSRadioGroup = class extends r$2 {
|
|
2943
|
+
constructor() {
|
|
2944
|
+
super(...arguments);
|
|
2945
|
+
this.selectedValue = null;
|
|
2946
|
+
this._handleRadioChange = (event) => {
|
|
2947
|
+
const target = event.composedPath().find((el) => el instanceof HTMLElement && el.tagName === "SDS-RADIO");
|
|
2948
|
+
if (target) {
|
|
2949
|
+
this.selectedValue = target.getAttribute("value") || null;
|
|
2950
|
+
this.dispatchEvent(
|
|
2951
|
+
new CustomEvent("change", {
|
|
2952
|
+
detail: { selectedValue: this.selectedValue },
|
|
2953
|
+
bubbles: true,
|
|
2954
|
+
composed: true
|
|
2955
|
+
})
|
|
2956
|
+
);
|
|
2957
|
+
}
|
|
2958
|
+
};
|
|
2959
|
+
}
|
|
2960
|
+
render() {
|
|
2961
|
+
return x`
|
|
2962
|
+
<fieldset class="sds-radio-group">
|
|
2963
|
+
${this.legend ? x`<legend class="sds-radio-group__legend">${this.legend}</legend>` : E}
|
|
2964
|
+
${this.helpText ? x`<p class="sds-radio-group__help-text">${this.helpText}</p>` : E}
|
|
2965
|
+
<div class="sds-radio-group__radios" @change=${this._handleRadioChange}>
|
|
2966
|
+
<slot></slot>
|
|
2967
|
+
</div>
|
|
2968
|
+
${this.errorMessage ? x`<p class="sds-radio-group__error-message">
|
|
2969
|
+
<sds-icon
|
|
2970
|
+
name="warning-material-filled"
|
|
2971
|
+
size="m"
|
|
2972
|
+
color="var(--sds-color-semantic-icon-critical)"
|
|
2973
|
+
></sds-icon>
|
|
2974
|
+
${this.errorMessage}
|
|
2975
|
+
</p>` : E}
|
|
2976
|
+
</fieldset>
|
|
2977
|
+
`;
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
SDSRadioGroup.styles = [styles$3];
|
|
2981
|
+
__decorateClass$3([
|
|
2982
|
+
n2({ type: String })
|
|
2983
|
+
], SDSRadioGroup.prototype, "legend", 2);
|
|
2984
|
+
__decorateClass$3([
|
|
2985
|
+
n2({ type: String, attribute: "help-text" })
|
|
2986
|
+
], SDSRadioGroup.prototype, "helpText", 2);
|
|
2987
|
+
__decorateClass$3([
|
|
2988
|
+
n2({ type: String, attribute: "error-message" })
|
|
2989
|
+
], SDSRadioGroup.prototype, "errorMessage", 2);
|
|
2990
|
+
__decorateClass$3([
|
|
2991
|
+
r2()
|
|
2992
|
+
], SDSRadioGroup.prototype, "selectedValue", 2);
|
|
2993
|
+
SDSRadioGroup = __decorateClass$3([
|
|
2994
|
+
t$1("sds-radio-group")
|
|
2995
|
+
], SDSRadioGroup);
|
|
2996
|
+
const styles$2 = i$4`
|
|
2997
|
+
:host {
|
|
2998
|
+
display: inline-flex;
|
|
2999
|
+
contain: layout style;
|
|
3000
|
+
box-sizing: border-box;
|
|
3001
|
+
align-items: center;
|
|
3002
|
+
justify-content: space-between;
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
:host([hidden]) {
|
|
3006
|
+
display: none;
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
:host(:disabled),
|
|
3010
|
+
:host(:disabled) * {
|
|
3011
|
+
pointer-events: none;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
:host(:disabled) .sds-switch__input:checked::before {
|
|
3015
|
+
content: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23C4C6C7' viewBox='0 0 24 24'><path d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'></path></svg>");
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
:host(:disabled) .sds-switch__input:not(:checked)::before {
|
|
3019
|
+
display: none;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
:host(:disabled) .sds-switch__label {
|
|
3023
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
.sds-switch {
|
|
3027
|
+
--_switch-motion-duration: 200ms;
|
|
3028
|
+
--_switch-height: 32px;
|
|
3029
|
+
--_switch-width: 60px;
|
|
3030
|
+
--_switch-padding: 8px;
|
|
3031
|
+
--_switch-icon-size: calc(var(--_switch-height) - (2 * var(--_switch-padding)));
|
|
3032
|
+
|
|
3033
|
+
display: flex;
|
|
3034
|
+
gap: 0.5rem;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
.sds-switch--small {
|
|
3038
|
+
--_switch-height: 24px;
|
|
3039
|
+
--_switch-width: 48px;
|
|
3040
|
+
--_switch-padding: 6px;
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
.sds-switch:has(.sds-switch__input:checked) {
|
|
3044
|
+
--_switch-padding: 6px;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
.sds-switch--small:has(.sds-switch__input:checked) {
|
|
3048
|
+
--_switch-padding: 4px;
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
.sds-switch__label {
|
|
3052
|
+
display: flex;
|
|
3053
|
+
align-items: center;
|
|
3054
|
+
cursor: pointer;
|
|
3055
|
+
user-select: none;
|
|
3056
|
+
color: var(--sds-color-semantic-text-default);
|
|
3057
|
+
font-family: var(--sds-typography-font-family);
|
|
3058
|
+
font-size: 1rem;
|
|
3059
|
+
font-weight: 400;
|
|
3060
|
+
line-height: 1.25;
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3063
|
+
.sds-switch__label--hidden:not(:focus):not(:active):not(:focus-within) {
|
|
3064
|
+
clip-path: inset(50%);
|
|
3065
|
+
height: 1px;
|
|
3066
|
+
overflow: hidden;
|
|
3067
|
+
position: absolute;
|
|
3068
|
+
white-space: nowrap;
|
|
3069
|
+
width: 1px;
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
.sds-switch__input {
|
|
3073
|
+
--_switch-icon-position: var(--_switch-padding);
|
|
3074
|
+
|
|
3075
|
+
appearance: none;
|
|
3076
|
+
cursor: pointer;
|
|
3077
|
+
user-select: none;
|
|
3078
|
+
|
|
3079
|
+
inline-size: var(--_switch-width);
|
|
3080
|
+
block-size: var(--_switch-height);
|
|
3081
|
+
margin: 0;
|
|
3082
|
+
|
|
3083
|
+
flex-shrink: 0;
|
|
3084
|
+
display: grid;
|
|
3085
|
+
align-items: center;
|
|
3086
|
+
grid: [track] 1fr / [track] 1fr;
|
|
3087
|
+
|
|
3088
|
+
transition: background-color var(--_switch-motion-duration);
|
|
3089
|
+
border-radius: 1rem;
|
|
3090
|
+
background-color: var(--sds-color-global-gray-300);
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
.sds-switch__input::before {
|
|
3094
|
+
content: '';
|
|
3095
|
+
grid-area: track;
|
|
3096
|
+
inline-size: var(--_switch-icon-size);
|
|
3097
|
+
block-size: var(--_switch-icon-size);
|
|
3098
|
+
|
|
3099
|
+
background-color: var(--sds-color-semantic-border-default);
|
|
3100
|
+
transition: transform var(--_switch-motion-duration);
|
|
3101
|
+
border-radius: 50%;
|
|
3102
|
+
transform: translateX(var(--_switch-icon-position));
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
.sds-switch__input:focus-visible {
|
|
3106
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
3107
|
+
outline-offset: 2px;
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
.sds-switch__input:checked {
|
|
3111
|
+
--_switch-icon-position: calc(var(--_switch-width) - var(--_switch-icon-size) - var(--_switch-padding));
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
.sds-switch__input:checked::before {
|
|
3115
|
+
content: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' fill='%230072ce' viewBox='0 0 24 24'><path d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'></path></svg>");
|
|
3116
|
+
background-color: var(--sds-color-semantic-surface-default);
|
|
3117
|
+
}
|
|
3118
|
+
`;
|
|
3119
|
+
var __defProp$2 = Object.defineProperty;
|
|
3120
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
3121
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
3122
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
3123
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
3124
|
+
if (decorator = decorators[i2])
|
|
3125
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3126
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
3127
|
+
return result;
|
|
3128
|
+
};
|
|
3129
|
+
let SDSSwitch = class extends r$2 {
|
|
3130
|
+
constructor() {
|
|
3131
|
+
super();
|
|
3132
|
+
this.disabled = false;
|
|
3133
|
+
this.label = "";
|
|
3134
|
+
this.hideLabel = false;
|
|
3135
|
+
this.value = "";
|
|
3136
|
+
this.reverse = false;
|
|
3137
|
+
this.checked = false;
|
|
3138
|
+
this.size = "l";
|
|
3139
|
+
this._initialChecked = false;
|
|
3140
|
+
this._handleChange = (event) => {
|
|
3141
|
+
event.stopImmediatePropagation();
|
|
3142
|
+
if (!this.disabled) {
|
|
3143
|
+
const elem = event.target;
|
|
3144
|
+
this.checked = elem.checked;
|
|
3145
|
+
this.dispatchEvent(
|
|
3146
|
+
new CustomEvent("change", {
|
|
3147
|
+
detail: { checked: this.checked, value: this.value },
|
|
3148
|
+
bubbles: true,
|
|
3149
|
+
composed: true
|
|
3150
|
+
})
|
|
3151
|
+
);
|
|
3152
|
+
}
|
|
3153
|
+
};
|
|
3154
|
+
this._handleFocus = (event) => {
|
|
3155
|
+
event.stopImmediatePropagation();
|
|
3156
|
+
if (!this.disabled) {
|
|
3157
|
+
this.dispatchEvent(
|
|
3158
|
+
new CustomEvent("focus", {
|
|
3159
|
+
detail: { checked: this.checked, value: this.value },
|
|
3160
|
+
bubbles: true,
|
|
3161
|
+
composed: true
|
|
3162
|
+
})
|
|
3163
|
+
);
|
|
3164
|
+
}
|
|
3165
|
+
};
|
|
3166
|
+
this._handleBlur = (event) => {
|
|
3167
|
+
event.stopImmediatePropagation();
|
|
3168
|
+
if (!this.disabled) {
|
|
3169
|
+
this.dispatchEvent(
|
|
3170
|
+
new CustomEvent("blur", {
|
|
3171
|
+
detail: { checked: this.checked, value: this.value },
|
|
3172
|
+
bubbles: true,
|
|
3173
|
+
composed: true
|
|
3174
|
+
})
|
|
3175
|
+
);
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
this.internals = this.attachInternals();
|
|
3179
|
+
this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
3180
|
+
}
|
|
3181
|
+
connectedCallback() {
|
|
3182
|
+
super.connectedCallback();
|
|
3183
|
+
if (!this._initialChecked) {
|
|
3184
|
+
this._initialChecked = this.checked;
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
updated(changedProperties) {
|
|
3188
|
+
if (changedProperties.has("checked")) {
|
|
3189
|
+
this.control.checked = this.checked;
|
|
3190
|
+
this.internals.setFormValue(this.checked ? this.value : null);
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
formResetCallback() {
|
|
3194
|
+
this.checked = this._initialChecked;
|
|
3195
|
+
this.control.checked = this._initialChecked;
|
|
3196
|
+
this.internals.setFormValue(this._initialChecked ? this.value : null);
|
|
3197
|
+
}
|
|
3198
|
+
formStateRestoreCallback(state) {
|
|
3199
|
+
this.checked = state;
|
|
3200
|
+
}
|
|
3201
|
+
render() {
|
|
3202
|
+
const switchClasses = {
|
|
3203
|
+
"sds-switch": true,
|
|
3204
|
+
"sds-switch--small": this.size === "s"
|
|
3205
|
+
};
|
|
3206
|
+
const labelClasses = {
|
|
3207
|
+
"sds-switch__label": true,
|
|
3208
|
+
"sds-switch__label--hidden": this.hideLabel
|
|
3209
|
+
};
|
|
3210
|
+
const inputTemplate = x`<input
|
|
3211
|
+
class="sds-switch__input"
|
|
3212
|
+
id="control"
|
|
3213
|
+
type="checkbox"
|
|
3214
|
+
role="switch"
|
|
3215
|
+
?checked="${this.checked}"
|
|
3216
|
+
value="${o$1(this.value)}"
|
|
3217
|
+
name="${o$1(this.name)}"
|
|
3218
|
+
@change="${this._handleChange}"
|
|
3219
|
+
@focus="${this._handleFocus}"
|
|
3220
|
+
@blur="${this._handleBlur}"
|
|
3221
|
+
/>`;
|
|
3222
|
+
const labelTemplate = x`<label class="${e$1(labelClasses)}" for="control">${this.label}</label>`;
|
|
3223
|
+
return x`<div class="${e$1(switchClasses)}">
|
|
3224
|
+
${this.reverse ? [labelTemplate, inputTemplate] : [inputTemplate, labelTemplate]}
|
|
3225
|
+
</div>`;
|
|
3226
|
+
}
|
|
3227
|
+
};
|
|
3228
|
+
SDSSwitch.styles = [styles$2];
|
|
3229
|
+
SDSSwitch.formAssociated = true;
|
|
3230
|
+
__decorateClass$2([
|
|
3231
|
+
n2({ type: Boolean, reflect: true })
|
|
3232
|
+
], SDSSwitch.prototype, "disabled", 2);
|
|
3233
|
+
__decorateClass$2([
|
|
3234
|
+
n2({ type: String, reflect: true })
|
|
3235
|
+
], SDSSwitch.prototype, "label", 2);
|
|
3236
|
+
__decorateClass$2([
|
|
3237
|
+
n2({ type: Boolean, reflect: true, attribute: "hide-label" })
|
|
3238
|
+
], SDSSwitch.prototype, "hideLabel", 2);
|
|
3239
|
+
__decorateClass$2([
|
|
3240
|
+
n2({ type: String, reflect: false })
|
|
3241
|
+
], SDSSwitch.prototype, "name", 2);
|
|
3242
|
+
__decorateClass$2([
|
|
3243
|
+
n2({ type: String, reflect: false })
|
|
3244
|
+
], SDSSwitch.prototype, "value", 2);
|
|
3245
|
+
__decorateClass$2([
|
|
3246
|
+
n2({ type: Boolean, reflect: true })
|
|
3247
|
+
], SDSSwitch.prototype, "reverse", 2);
|
|
3248
|
+
__decorateClass$2([
|
|
3249
|
+
n2({ type: Boolean, reflect: true })
|
|
3250
|
+
], SDSSwitch.prototype, "checked", 2);
|
|
3251
|
+
__decorateClass$2([
|
|
3252
|
+
n2({ type: String, reflect: true })
|
|
3253
|
+
], SDSSwitch.prototype, "size", 2);
|
|
3254
|
+
__decorateClass$2([
|
|
3255
|
+
e$3("#control")
|
|
3256
|
+
], SDSSwitch.prototype, "control", 2);
|
|
3257
|
+
SDSSwitch = __decorateClass$2([
|
|
3258
|
+
t$1("sds-switch")
|
|
3259
|
+
], SDSSwitch);
|
|
3260
|
+
const styles$1 = i$4`
|
|
3261
|
+
:host {
|
|
3262
|
+
display: block;
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
.sds-text {
|
|
3266
|
+
font-family: var(--sds-typography-font-family);
|
|
3267
|
+
font-weight: 400;
|
|
3268
|
+
color: var(--sds-color-semantic-text-default);
|
|
3269
|
+
margin: 0;
|
|
3270
|
+
max-width: var(--sds-typography-max-line-width);
|
|
3271
|
+
padding: 0;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
.sds-text--l {
|
|
3275
|
+
font-size: 1.125rem;
|
|
3276
|
+
line-height: 1.222;
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
.sds-text--m {
|
|
3280
|
+
font-size: 1rem;
|
|
3281
|
+
line-height: 1.25;
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
.sds-text--s {
|
|
3285
|
+
font-size: 0.875rem;
|
|
3286
|
+
line-height: 1.285;
|
|
3287
|
+
}
|
|
3288
|
+
`;
|
|
3289
|
+
var __defProp$1 = Object.defineProperty;
|
|
3290
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
3291
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
3292
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
3293
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
3294
|
+
if (decorator = decorators[i2])
|
|
3295
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3296
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
3297
|
+
return result;
|
|
3298
|
+
};
|
|
3299
|
+
let SDSText = class extends r$2 {
|
|
3300
|
+
constructor() {
|
|
3301
|
+
super(...arguments);
|
|
3302
|
+
this.size = "l";
|
|
3303
|
+
}
|
|
3304
|
+
render() {
|
|
3305
|
+
const styleClasses = {
|
|
3306
|
+
"sds-text": true,
|
|
3307
|
+
"sds-text--l": this.size === "l",
|
|
3308
|
+
"sds-text--m": this.size === "m",
|
|
3309
|
+
"sds-text--s": this.size === "s"
|
|
3310
|
+
};
|
|
3311
|
+
const classes = e$1(styleClasses);
|
|
3312
|
+
return x`<p class=${classes}><slot></slot></p>`;
|
|
3313
|
+
}
|
|
3314
|
+
};
|
|
3315
|
+
SDSText.styles = [styles$1];
|
|
3316
|
+
__decorateClass$1([
|
|
3317
|
+
n2({ type: String })
|
|
3318
|
+
], SDSText.prototype, "size", 2);
|
|
3319
|
+
SDSText = __decorateClass$1([
|
|
3320
|
+
t$1("sds-text")
|
|
3321
|
+
], SDSText);
|
|
3322
|
+
const styles = i$4`
|
|
3323
|
+
:host {
|
|
3324
|
+
all: unset;
|
|
3325
|
+
display: block;
|
|
3326
|
+
text-align: start;
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
.sds-textfield {
|
|
3330
|
+
display: flex;
|
|
3331
|
+
flex-direction: column;
|
|
3332
|
+
gap: 0.25rem;
|
|
3333
|
+
font-family: var(--sds-typography-font-family);
|
|
3334
|
+
|
|
3335
|
+
.sds-textfield__input-container {
|
|
3336
|
+
max-width: var(--sds-typography-max-line-width);
|
|
3337
|
+
position: relative;
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
.sds-textfield__input {
|
|
3341
|
+
box-sizing: border-box;
|
|
3342
|
+
color: var(--sds-color-semantic-text-default);
|
|
3343
|
+
padding: 0.75rem 1rem;
|
|
3344
|
+
line-height: 1.25rem;
|
|
3345
|
+
font-size: 1rem;
|
|
3346
|
+
justify-content: flex-end;
|
|
3347
|
+
border-radius: var(--sds-radius-4);
|
|
3348
|
+
border: 1px solid var(--sds-color-semantic-border-default);
|
|
3349
|
+
background: var(--sds-color-semantic-surface-default);
|
|
3350
|
+
max-width: var(--sds-typography-max-line-width);
|
|
3351
|
+
width: 100%;
|
|
3352
|
+
|
|
3353
|
+
&:hover {
|
|
3354
|
+
border-color: var(--sds-color-semantic-border-strong);
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
&:focus {
|
|
3358
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
3359
|
+
outline-offset: 1px;
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
&:active {
|
|
3363
|
+
border-color: var(--sds-color-semantic-border-action);
|
|
3364
|
+
outline: none;
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
.sds-textfield__label {
|
|
3369
|
+
color: var(--sds-color-semantic-text-default);
|
|
3370
|
+
display: block;
|
|
3371
|
+
font-size: 1rem;
|
|
3372
|
+
font-weight: 500;
|
|
3373
|
+
line-height: 1.5rem;
|
|
3374
|
+
max-width: var(--sds-typography-max-line-width);
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
.sds-textfield__help-text {
|
|
3378
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
3379
|
+
font-size: 1rem;
|
|
3380
|
+
font-weight: 400;
|
|
3381
|
+
line-height: 1.25rem;
|
|
3382
|
+
margin: 0;
|
|
3383
|
+
max-width: var(--sds-typography-max-line-width);
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
.sds-textfield__error-message {
|
|
3387
|
+
margin: 0;
|
|
3388
|
+
max-width: var(--sds-typography-max-line-width);
|
|
3389
|
+
align-items: flex-start;
|
|
3390
|
+
color: var(--sds-color-semantic-text-default);
|
|
3391
|
+
display: flex;
|
|
3392
|
+
line-height: 1.5rem;
|
|
3393
|
+
gap: 0.25rem;
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
.sds-textfield--error {
|
|
3398
|
+
color: var(--sds-color-semantic-text-default);
|
|
3399
|
+
line-height: 1.5rem;
|
|
3400
|
+
|
|
3401
|
+
.sds-textfield__input,
|
|
3402
|
+
.sds-textfield__input:hover {
|
|
3403
|
+
border-color: var(--sds-color-semantic-border-critical);
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
|
|
3407
|
+
.sds-textfield--disabled {
|
|
3408
|
+
pointer-events: none;
|
|
3409
|
+
|
|
3410
|
+
.sds-textfield__label,
|
|
3411
|
+
.sds-textfield__help-text,
|
|
3412
|
+
.sds-textfield__error-message,
|
|
3413
|
+
.sds-textfield__input {
|
|
3414
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
.sds-textfield__input {
|
|
3418
|
+
border: 1px solid var(--sds-color-semantic-border-disabled);
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
.sds-textfield--has-icon {
|
|
3423
|
+
.sds-textfield__input {
|
|
3424
|
+
padding-right: 3.5rem;
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
::slotted([slot='after']) {
|
|
3429
|
+
position: absolute;
|
|
3430
|
+
top: 50%;
|
|
3431
|
+
right: 1rem;
|
|
3432
|
+
transform: translateY(-50%);
|
|
3433
|
+
pointer-events: none;
|
|
3434
|
+
}
|
|
3435
|
+
`;
|
|
3436
|
+
var __defProp = Object.defineProperty;
|
|
3437
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3438
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
3439
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
3440
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
3441
|
+
if (decorator = decorators[i2])
|
|
3442
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3443
|
+
if (kind && result) __defProp(target, key, result);
|
|
3444
|
+
return result;
|
|
3445
|
+
};
|
|
3446
|
+
let SDSTextField = class extends r$2 {
|
|
3447
|
+
constructor() {
|
|
3448
|
+
super(...arguments);
|
|
3449
|
+
this.type = "text";
|
|
3450
|
+
this.disabled = false;
|
|
3451
|
+
this.readOnly = false;
|
|
3452
|
+
this.autocomplete = false;
|
|
3453
|
+
this.hasIcon = false;
|
|
3454
|
+
this.handleSlotChange = (e2) => {
|
|
3455
|
+
const slot = e2.target;
|
|
3456
|
+
this.hasIcon = slot.assignedNodes({ flatten: true }).length > 0;
|
|
3457
|
+
};
|
|
3458
|
+
this._handleInput = (event) => {
|
|
3459
|
+
event.stopImmediatePropagation();
|
|
3460
|
+
if (!this.disabled) {
|
|
3461
|
+
this.dispatchEvent(
|
|
3462
|
+
new CustomEvent("input", {
|
|
3463
|
+
detail: { value: event.target.value },
|
|
3464
|
+
bubbles: true,
|
|
3465
|
+
composed: true
|
|
3466
|
+
})
|
|
3467
|
+
);
|
|
3468
|
+
}
|
|
3469
|
+
};
|
|
3470
|
+
this._handleChange = (event) => {
|
|
3471
|
+
event.stopImmediatePropagation();
|
|
3472
|
+
if (!this.disabled) {
|
|
3473
|
+
this.dispatchEvent(
|
|
3474
|
+
new CustomEvent("change", {
|
|
3475
|
+
detail: { value: event.target.value },
|
|
3476
|
+
bubbles: true,
|
|
3477
|
+
composed: true
|
|
3478
|
+
})
|
|
3479
|
+
);
|
|
3480
|
+
}
|
|
3481
|
+
};
|
|
3482
|
+
this._handleSelect = (event) => {
|
|
3483
|
+
event.stopImmediatePropagation();
|
|
3484
|
+
if (!this.disabled) {
|
|
3485
|
+
const target = event.target;
|
|
3486
|
+
const selectedText = target.value.substring(target.selectionStart ?? 0, target.selectionEnd ?? 0);
|
|
3487
|
+
this.dispatchEvent(
|
|
3488
|
+
new CustomEvent("select", {
|
|
3489
|
+
detail: { selectedText },
|
|
3490
|
+
bubbles: true,
|
|
3491
|
+
composed: true
|
|
3492
|
+
})
|
|
3493
|
+
);
|
|
3494
|
+
}
|
|
3495
|
+
};
|
|
3496
|
+
this._handleFocus = (event) => {
|
|
3497
|
+
event.stopImmediatePropagation();
|
|
3498
|
+
this.dispatchEvent(
|
|
3499
|
+
new CustomEvent("focus", {
|
|
3500
|
+
detail: { value: event.target.value },
|
|
3501
|
+
bubbles: true,
|
|
3502
|
+
composed: true
|
|
3503
|
+
})
|
|
3504
|
+
);
|
|
3505
|
+
};
|
|
3506
|
+
this._handleBlur = (event) => {
|
|
3507
|
+
event.stopImmediatePropagation();
|
|
3508
|
+
this.dispatchEvent(
|
|
3509
|
+
new CustomEvent("blur", {
|
|
3510
|
+
detail: { value: event.target.value },
|
|
3511
|
+
bubbles: true,
|
|
3512
|
+
composed: true
|
|
3513
|
+
})
|
|
3514
|
+
);
|
|
3515
|
+
};
|
|
3516
|
+
}
|
|
3517
|
+
select() {
|
|
3518
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.select();
|
|
3519
|
+
}
|
|
3520
|
+
focus() {
|
|
3521
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.focus();
|
|
3522
|
+
}
|
|
3523
|
+
blur() {
|
|
3524
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.blur();
|
|
3525
|
+
}
|
|
3526
|
+
click() {
|
|
3527
|
+
if (!this.disabled) this.shadowRoot?.querySelector("input")?.click();
|
|
3528
|
+
}
|
|
3529
|
+
render() {
|
|
3530
|
+
const textfieldClasses = {
|
|
3531
|
+
"sds-textfield": true,
|
|
3532
|
+
"sds-textfield--error": Boolean(this.errorMessage),
|
|
3533
|
+
"sds-textfield--disabled": Boolean(this.disabled),
|
|
3534
|
+
"sds-textfield--readonly": Boolean(this.readOnly),
|
|
3535
|
+
"sds-textfield--has-icon": this.hasIcon
|
|
3536
|
+
};
|
|
3537
|
+
return x` <div class="${e$1(textfieldClasses)}">
|
|
3538
|
+
${this.label ? x`<label for="sds-textfield" class="sds-textfield__label">${this.label}</label>` : E}
|
|
3539
|
+
${this.helpText ? x`<p class="sds-textfield__help-text">${this.helpText}</p>` : E}
|
|
3540
|
+
<div class="sds-textfield__input-container">
|
|
3541
|
+
<input
|
|
3542
|
+
class="sds-textfield__input"
|
|
3543
|
+
type="${this.type}"
|
|
3544
|
+
id="sds-textfield"
|
|
3545
|
+
?disabled="${this.disabled}"
|
|
3546
|
+
?readonly="${this.readOnly}"
|
|
3547
|
+
placeholder="${o$1(this.placeholder)}"
|
|
3548
|
+
value="${o$1(this.value)}"
|
|
3549
|
+
name="${o$1(this.name)}"
|
|
3550
|
+
autocomplete="${this.autocomplete ? "on" : "off"}"
|
|
3551
|
+
@input="${this._handleInput}"
|
|
3552
|
+
@change="${this._handleChange}"
|
|
3553
|
+
@select="${this._handleSelect}"
|
|
3554
|
+
@focus="${this._handleFocus}"
|
|
3555
|
+
@blur="${this._handleBlur}"
|
|
3556
|
+
/>
|
|
3557
|
+
<slot name="after" @slotchange="${this.handleSlotChange}" aria-hidden="true"></slot>
|
|
3558
|
+
</div>
|
|
3559
|
+
${this.errorMessage ? x`<p class="sds-textfield__error-message">
|
|
3560
|
+
<sds-icon
|
|
3561
|
+
name="warning-material-filled"
|
|
3562
|
+
size="m"
|
|
3563
|
+
color="${!this.disabled ? `var(--sds-color-semantic-icon-critical)` : `var(--sds-color-semantic-icon-disabled)`}"
|
|
3564
|
+
></sds-icon
|
|
3565
|
+
>${this.errorMessage}
|
|
3566
|
+
</p>` : E}
|
|
3567
|
+
</div>`;
|
|
3568
|
+
}
|
|
3569
|
+
};
|
|
3570
|
+
SDSTextField.styles = [styles];
|
|
3571
|
+
__decorateClass([
|
|
3572
|
+
n2({ type: String })
|
|
3573
|
+
], SDSTextField.prototype, "type", 2);
|
|
3574
|
+
__decorateClass([
|
|
3575
|
+
n2({ type: String })
|
|
3576
|
+
], SDSTextField.prototype, "value", 2);
|
|
3577
|
+
__decorateClass([
|
|
3578
|
+
n2({ type: String })
|
|
3579
|
+
], SDSTextField.prototype, "name", 2);
|
|
3580
|
+
__decorateClass([
|
|
3581
|
+
n2({ type: String })
|
|
3582
|
+
], SDSTextField.prototype, "label", 2);
|
|
3583
|
+
__decorateClass([
|
|
3584
|
+
n2({ type: String })
|
|
3585
|
+
], SDSTextField.prototype, "placeholder", 2);
|
|
3586
|
+
__decorateClass([
|
|
3587
|
+
n2({ type: String, attribute: "help-text" })
|
|
3588
|
+
], SDSTextField.prototype, "helpText", 2);
|
|
3589
|
+
__decorateClass([
|
|
3590
|
+
n2({ type: String, attribute: "error-message" })
|
|
3591
|
+
], SDSTextField.prototype, "errorMessage", 2);
|
|
3592
|
+
__decorateClass([
|
|
3593
|
+
n2({ type: Boolean })
|
|
3594
|
+
], SDSTextField.prototype, "disabled", 2);
|
|
3595
|
+
__decorateClass([
|
|
3596
|
+
n2({ type: Boolean, attribute: "readonly" })
|
|
3597
|
+
], SDSTextField.prototype, "readOnly", 2);
|
|
3598
|
+
__decorateClass([
|
|
3599
|
+
n2({ type: Boolean })
|
|
3600
|
+
], SDSTextField.prototype, "autocomplete", 2);
|
|
3601
|
+
__decorateClass([
|
|
3602
|
+
r2()
|
|
3603
|
+
], SDSTextField.prototype, "hasIcon", 2);
|
|
3604
|
+
SDSTextField = __decorateClass([
|
|
3605
|
+
t$1("sds-textfield")
|
|
3606
|
+
], SDSTextField);
|
|
3607
|
+
export {
|
|
3608
|
+
SDSButton,
|
|
3609
|
+
SDSCheckbox,
|
|
3610
|
+
SDSCheckboxGroup,
|
|
3611
|
+
SDSChip,
|
|
3612
|
+
SDSDetail,
|
|
3613
|
+
SDSHeading,
|
|
3614
|
+
SDSIcon,
|
|
3615
|
+
SDSLabel,
|
|
3616
|
+
SDSLink,
|
|
3617
|
+
SDSLoader,
|
|
3618
|
+
SDSNavCard,
|
|
3619
|
+
SDSNotification,
|
|
3620
|
+
SDSParagraph,
|
|
3621
|
+
SDSRadio,
|
|
3622
|
+
SDSRadioGroup,
|
|
3623
|
+
SDSSwitch,
|
|
3624
|
+
SDSText,
|
|
3625
|
+
SDSTextField
|
|
3626
|
+
};
|