@phcdevworks/spectre-components 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -40
- package/dist/{base-DQtCQ-dP.d.cts → base-2rD8EmdC.d.cts} +15 -5
- package/dist/{base-DQtCQ-dP.d.ts → base-2rD8EmdC.d.ts} +15 -5
- package/dist/button.cjs +158 -58
- package/dist/button.cjs.map +1 -1
- package/dist/button.d.cts +22 -28
- package/dist/button.d.ts +22 -28
- package/dist/button.js +158 -58
- package/dist/button.js.map +1 -1
- package/dist/checkbox.cjs +164 -64
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.d.cts +18 -23
- package/dist/checkbox.d.ts +18 -23
- package/dist/checkbox.js +164 -64
- package/dist/checkbox.js.map +1 -1
- package/dist/fieldset.cjs +154 -55
- package/dist/fieldset.cjs.map +1 -1
- package/dist/fieldset.d.cts +13 -18
- package/dist/fieldset.d.ts +13 -18
- package/dist/fieldset.js +154 -55
- package/dist/fieldset.js.map +1 -1
- package/dist/index.cjs +324 -261
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +324 -261
- package/dist/index.js.map +1 -1
- package/dist/input.cjs +174 -72
- package/dist/input.cjs.map +1 -1
- package/dist/input.d.cts +33 -38
- package/dist/input.d.ts +33 -38
- package/dist/input.js +174 -72
- package/dist/input.js.map +1 -1
- package/dist/label.cjs +152 -56
- package/dist/label.cjs.map +1 -1
- package/dist/label.d.cts +8 -13
- package/dist/label.d.ts +8 -13
- package/dist/label.js +152 -56
- package/dist/label.js.map +1 -1
- package/dist/{projectable-DcnBRiko.d.cts → projectable-BzDQ4xp_.d.cts} +1 -1
- package/dist/{projectable-SzbPvXfM.d.ts → projectable-s3SgvjGX.d.ts} +1 -1
- package/dist/radio.cjs +164 -64
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.d.cts +18 -23
- package/dist/radio.d.ts +18 -23
- package/dist/radio.js +164 -64
- package/dist/radio.js.map +1 -1
- package/dist/select.cjs +161 -61
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +22 -27
- package/dist/select.d.ts +22 -27
- package/dist/select.js +161 -61
- package/dist/select.js.map +1 -1
- package/dist/textarea.cjs +172 -72
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.d.cts +27 -32
- package/dist/textarea.d.ts +27 -32
- package/dist/textarea.js +172 -72
- package/dist/textarea.js.map +1 -1
- package/package.json +9 -8
package/dist/index.cjs
CHANGED
|
@@ -9,22 +9,67 @@ var live_js = require('lit/directives/live.js');
|
|
|
9
9
|
var SpectreBaseElement = class extends lit.LitElement {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
12
|
+
this._ariaLabel = null;
|
|
13
|
+
this._ariaLabelledBy = null;
|
|
14
|
+
this._ariaDescribedBy = null;
|
|
15
|
+
this._title = "";
|
|
16
|
+
this._id = "";
|
|
17
|
+
}
|
|
18
|
+
get ariaLabel() {
|
|
19
|
+
return this._ariaLabel;
|
|
20
|
+
}
|
|
21
|
+
set ariaLabel(value) {
|
|
22
|
+
if (this._ariaLabel === value) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this._ariaLabel = value;
|
|
26
|
+
this._removeHostAttribute("aria-label");
|
|
27
|
+
this.requestUpdate();
|
|
28
|
+
}
|
|
29
|
+
get ariaLabelledBy() {
|
|
30
|
+
return this._ariaLabelledBy;
|
|
31
|
+
}
|
|
32
|
+
set ariaLabelledBy(value) {
|
|
33
|
+
if (this._ariaLabelledBy === value) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this._ariaLabelledBy = value;
|
|
37
|
+
this._removeHostAttribute("aria-labelledby");
|
|
38
|
+
this.requestUpdate();
|
|
39
|
+
}
|
|
40
|
+
get ariaDescribedBy() {
|
|
41
|
+
return this._ariaDescribedBy;
|
|
42
|
+
}
|
|
43
|
+
set ariaDescribedBy(value) {
|
|
44
|
+
if (this._ariaDescribedBy === value) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this._ariaDescribedBy = value;
|
|
48
|
+
this._removeHostAttribute("aria-describedby");
|
|
49
|
+
this.requestUpdate();
|
|
50
|
+
}
|
|
51
|
+
get title() {
|
|
52
|
+
return this._title;
|
|
53
|
+
}
|
|
54
|
+
set title(value) {
|
|
55
|
+
const normalizedValue = value ?? "";
|
|
56
|
+
if (this._title === normalizedValue) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this._title = normalizedValue;
|
|
60
|
+
this._removeHostAttribute("title");
|
|
61
|
+
this.requestUpdate();
|
|
15
62
|
}
|
|
16
63
|
get id() {
|
|
17
|
-
return this._id
|
|
64
|
+
return this._id;
|
|
18
65
|
}
|
|
19
66
|
set id(value) {
|
|
20
|
-
|
|
67
|
+
const normalizedValue = value ?? "";
|
|
68
|
+
if (this._id === normalizedValue) {
|
|
21
69
|
return;
|
|
22
70
|
}
|
|
23
|
-
this._id =
|
|
24
|
-
|
|
25
|
-
if (HTMLElement.prototype.hasAttribute.call(host, "id")) {
|
|
26
|
-
HTMLElement.prototype.removeAttribute.call(host, "id");
|
|
27
|
-
}
|
|
71
|
+
this._id = normalizedValue;
|
|
72
|
+
this._removeHostAttribute("id");
|
|
28
73
|
this.requestUpdate();
|
|
29
74
|
}
|
|
30
75
|
// Spectre components intentionally render in light DOM so the global
|
|
@@ -34,36 +79,99 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
34
79
|
}
|
|
35
80
|
connectedCallback() {
|
|
36
81
|
super.connectedCallback();
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
82
|
+
const proxiedAttributes = [
|
|
83
|
+
"id",
|
|
84
|
+
"title",
|
|
85
|
+
"aria-label",
|
|
86
|
+
"aria-labelledby",
|
|
87
|
+
"aria-describedby"
|
|
88
|
+
];
|
|
89
|
+
proxiedAttributes.forEach((attr) => {
|
|
90
|
+
const value = super.getAttribute(attr);
|
|
91
|
+
if (value !== null) {
|
|
92
|
+
this.setAttribute(attr, value);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
41
95
|
}
|
|
42
96
|
getAttribute(qualifiedName) {
|
|
43
|
-
|
|
44
|
-
|
|
97
|
+
switch (qualifiedName) {
|
|
98
|
+
case "id":
|
|
99
|
+
return this.id || null;
|
|
100
|
+
case "title":
|
|
101
|
+
return this.title || null;
|
|
102
|
+
case "aria-label":
|
|
103
|
+
return this.ariaLabel;
|
|
104
|
+
case "aria-labelledby":
|
|
105
|
+
return this.ariaLabelledBy;
|
|
106
|
+
case "aria-describedby":
|
|
107
|
+
return this.ariaDescribedBy;
|
|
108
|
+
default:
|
|
109
|
+
return super.getAttribute(qualifiedName);
|
|
45
110
|
}
|
|
46
|
-
return super.getAttribute(qualifiedName);
|
|
47
111
|
}
|
|
48
112
|
hasAttribute(qualifiedName) {
|
|
49
|
-
|
|
50
|
-
|
|
113
|
+
switch (qualifiedName) {
|
|
114
|
+
case "id":
|
|
115
|
+
return this.id !== "";
|
|
116
|
+
case "title":
|
|
117
|
+
return this.title !== "";
|
|
118
|
+
case "aria-label":
|
|
119
|
+
return this.ariaLabel !== null;
|
|
120
|
+
case "aria-labelledby":
|
|
121
|
+
return this.ariaLabelledBy !== null;
|
|
122
|
+
case "aria-describedby":
|
|
123
|
+
return this.ariaDescribedBy !== null;
|
|
124
|
+
default:
|
|
125
|
+
return super.hasAttribute(qualifiedName);
|
|
51
126
|
}
|
|
52
|
-
return super.hasAttribute(qualifiedName);
|
|
53
127
|
}
|
|
54
128
|
setAttribute(qualifiedName, value) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
129
|
+
switch (qualifiedName) {
|
|
130
|
+
case "id":
|
|
131
|
+
this.id = value;
|
|
132
|
+
break;
|
|
133
|
+
case "title":
|
|
134
|
+
this.title = value;
|
|
135
|
+
break;
|
|
136
|
+
case "aria-label":
|
|
137
|
+
this.ariaLabel = value;
|
|
138
|
+
break;
|
|
139
|
+
case "aria-labelledby":
|
|
140
|
+
this.ariaLabelledBy = value;
|
|
141
|
+
break;
|
|
142
|
+
case "aria-describedby":
|
|
143
|
+
this.ariaDescribedBy = value;
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
super.setAttribute(qualifiedName, value);
|
|
58
147
|
}
|
|
59
|
-
super.setAttribute(qualifiedName, value);
|
|
60
148
|
}
|
|
61
149
|
removeAttribute(qualifiedName) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
150
|
+
switch (qualifiedName) {
|
|
151
|
+
case "id":
|
|
152
|
+
this.id = "";
|
|
153
|
+
break;
|
|
154
|
+
case "title":
|
|
155
|
+
this.title = "";
|
|
156
|
+
break;
|
|
157
|
+
case "aria-label":
|
|
158
|
+
this.ariaLabel = null;
|
|
159
|
+
break;
|
|
160
|
+
case "aria-labelledby":
|
|
161
|
+
this.ariaLabelledBy = null;
|
|
162
|
+
break;
|
|
163
|
+
case "aria-describedby":
|
|
164
|
+
this.ariaDescribedBy = null;
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
super.removeAttribute(qualifiedName);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
_removeHostAttribute(name) {
|
|
171
|
+
const host = this;
|
|
172
|
+
if (HTMLElement.prototype.hasAttribute.call(host, name)) {
|
|
173
|
+
HTMLElement.prototype.removeAttribute.call(host, name);
|
|
65
174
|
}
|
|
66
|
-
super.removeAttribute(qualifiedName);
|
|
67
175
|
}
|
|
68
176
|
get forwardedAriaLabel() {
|
|
69
177
|
const value = this.ariaLabel?.trim();
|
|
@@ -78,11 +186,7 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
78
186
|
return value ? value : void 0;
|
|
79
187
|
}
|
|
80
188
|
};
|
|
81
|
-
SpectreBaseElement.properties = {
|
|
82
|
-
ariaLabel: { attribute: "aria-label", type: String },
|
|
83
|
-
ariaLabelledBy: { attribute: "aria-labelledby", type: String },
|
|
84
|
-
ariaDescribedBy: { attribute: "aria-describedby", type: String }
|
|
85
|
-
};
|
|
189
|
+
SpectreBaseElement.properties = {};
|
|
86
190
|
|
|
87
191
|
// src/utils/dom.ts
|
|
88
192
|
function hasMeaningfulContent(nodes) {
|
|
@@ -143,9 +247,9 @@ var SpectreProjectableElement = class extends SpectreBaseElement {
|
|
|
143
247
|
}
|
|
144
248
|
this.contentObserver = new MutationObserver((mutations) => {
|
|
145
249
|
const isInternalMovement = mutations.every(
|
|
146
|
-
(mutation) =>
|
|
250
|
+
(mutation) => [...mutation.removedNodes].every(
|
|
147
251
|
(node) => this.isInternalNode(node) || this.contains(node)
|
|
148
|
-
) &&
|
|
252
|
+
) && [...mutation.addedNodes].every((node) => this.isInternalNode(node))
|
|
149
253
|
);
|
|
150
254
|
if (isInternalMovement) {
|
|
151
255
|
return;
|
|
@@ -191,7 +295,6 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
191
295
|
this.loadingLabel = "Loading";
|
|
192
296
|
this.pill = false;
|
|
193
297
|
this.size = "md";
|
|
194
|
-
this.title = "";
|
|
195
298
|
this.type = "button";
|
|
196
299
|
this.variant = "primary";
|
|
197
300
|
this.value = "";
|
|
@@ -258,26 +361,24 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
258
361
|
return this.visibleLabelFallback ? lit.html`<span data-sp-button-label-fallback>${this.visibleLabelFallback}</span>` : lit.nothing;
|
|
259
362
|
}
|
|
260
363
|
render() {
|
|
261
|
-
return lit.html
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
</button>
|
|
280
|
-
`;
|
|
364
|
+
return lit.html`<button
|
|
365
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
366
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
367
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
368
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
369
|
+
?autofocus="${this.autofocus}"
|
|
370
|
+
class="${this.buttonClasses}"
|
|
371
|
+
data-sp-button-native
|
|
372
|
+
?disabled="${this.isDisabled}"
|
|
373
|
+
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
374
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
375
|
+
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
376
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
377
|
+
type="${this.type}"
|
|
378
|
+
value="${ifDefined_js.ifDefined(this.value || void 0)}"
|
|
379
|
+
>
|
|
380
|
+
${this.renderButtonContent()}
|
|
381
|
+
</button>`;
|
|
281
382
|
}
|
|
282
383
|
};
|
|
283
384
|
SpectreButtonElement.properties = {
|
|
@@ -291,10 +392,9 @@ SpectreButtonElement.properties = {
|
|
|
291
392
|
name: { type: String, reflect: true },
|
|
292
393
|
pill: { type: Boolean, reflect: true },
|
|
293
394
|
size: { type: String, reflect: true },
|
|
294
|
-
title: { type: String, reflect: true },
|
|
295
395
|
type: { type: String, reflect: true },
|
|
296
396
|
variant: { type: String, reflect: true },
|
|
297
|
-
value: { type: String
|
|
397
|
+
value: { type: String }
|
|
298
398
|
};
|
|
299
399
|
function defineSpectreButton(tagName = "sp-button") {
|
|
300
400
|
const existingElement = customElements.get(tagName);
|
|
@@ -325,6 +425,12 @@ var spectreInputTypes = [
|
|
|
325
425
|
function isInputType(value) {
|
|
326
426
|
return spectreInputTypes.includes(value);
|
|
327
427
|
}
|
|
428
|
+
function normalizeInt(value, fallback, min = 0) {
|
|
429
|
+
if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
|
|
430
|
+
return fallback;
|
|
431
|
+
}
|
|
432
|
+
return value;
|
|
433
|
+
}
|
|
328
434
|
var SpectreInputElement = class extends SpectreBaseElement {
|
|
329
435
|
constructor() {
|
|
330
436
|
super(...arguments);
|
|
@@ -338,7 +444,6 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
338
444
|
this.required = false;
|
|
339
445
|
this.size = "md";
|
|
340
446
|
this.success = false;
|
|
341
|
-
this.title = "";
|
|
342
447
|
this.type = "text";
|
|
343
448
|
this.value = "";
|
|
344
449
|
}
|
|
@@ -353,14 +458,10 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
353
458
|
this.value = "";
|
|
354
459
|
}
|
|
355
460
|
if (changedProperties.has("maxlength")) {
|
|
356
|
-
|
|
357
|
-
this.maxlength = void 0;
|
|
358
|
-
}
|
|
461
|
+
this.maxlength = normalizeInt(this.maxlength, void 0);
|
|
359
462
|
}
|
|
360
463
|
if (changedProperties.has("minlength")) {
|
|
361
|
-
|
|
362
|
-
this.minlength = void 0;
|
|
363
|
-
}
|
|
464
|
+
this.minlength = normalizeInt(this.minlength, void 0);
|
|
364
465
|
}
|
|
365
466
|
}
|
|
366
467
|
get inputClasses() {
|
|
@@ -392,37 +493,35 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
392
493
|
this.nativeInput?.blur();
|
|
393
494
|
}
|
|
394
495
|
render() {
|
|
395
|
-
return lit.html
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
/>
|
|
425
|
-
`;
|
|
496
|
+
return lit.html`<input
|
|
497
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
498
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
499
|
+
aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
|
|
500
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
501
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
502
|
+
autocomplete="${ifDefined_js.ifDefined(this.autocomplete || void 0)}"
|
|
503
|
+
?autofocus="${this.autofocus}"
|
|
504
|
+
class="${this.inputClasses}"
|
|
505
|
+
data-sp-input-native
|
|
506
|
+
?disabled="${this.isDisabled}"
|
|
507
|
+
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
508
|
+
?readonly="${this.readonly}"
|
|
509
|
+
?required="${this.required}"
|
|
510
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
511
|
+
inputmode="${ifDefined_js.ifDefined(this.inputmode || void 0)}"
|
|
512
|
+
max="${ifDefined_js.ifDefined(this.max || void 0)}"
|
|
513
|
+
maxlength="${ifDefined_js.ifDefined(this.maxlength)}"
|
|
514
|
+
min="${ifDefined_js.ifDefined(this.min || void 0)}"
|
|
515
|
+
minlength="${ifDefined_js.ifDefined(this.minlength)}"
|
|
516
|
+
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
517
|
+
placeholder="${ifDefined_js.ifDefined(this.placeholder || void 0)}"
|
|
518
|
+
step="${ifDefined_js.ifDefined(this.step || void 0)}"
|
|
519
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
520
|
+
type="${this.type}"
|
|
521
|
+
.value="${live_js.live(this.value)}"
|
|
522
|
+
@change="${this.handleChange}"
|
|
523
|
+
@input="${this.handleInput}"
|
|
524
|
+
/>`;
|
|
426
525
|
}
|
|
427
526
|
};
|
|
428
527
|
SpectreInputElement.properties = {
|
|
@@ -446,7 +545,6 @@ SpectreInputElement.properties = {
|
|
|
446
545
|
size: { type: String, reflect: true },
|
|
447
546
|
step: { type: String, reflect: true },
|
|
448
547
|
success: { type: Boolean, reflect: true },
|
|
449
|
-
title: { type: String, reflect: true },
|
|
450
548
|
type: { type: String, reflect: true },
|
|
451
549
|
value: { type: String }
|
|
452
550
|
};
|
|
@@ -473,7 +571,6 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
473
571
|
this.rows = DEFAULT_ROWS;
|
|
474
572
|
this.size = "md";
|
|
475
573
|
this.success = false;
|
|
476
|
-
this.title = "";
|
|
477
574
|
this.value = "";
|
|
478
575
|
}
|
|
479
576
|
willUpdate(changedProperties) {
|
|
@@ -481,22 +578,16 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
481
578
|
this.size = "md";
|
|
482
579
|
}
|
|
483
580
|
if (changedProperties.has("rows")) {
|
|
484
|
-
|
|
485
|
-
this.rows = DEFAULT_ROWS;
|
|
486
|
-
}
|
|
581
|
+
this.rows = normalizeInt(this.rows, DEFAULT_ROWS, 1);
|
|
487
582
|
}
|
|
488
583
|
if (changedProperties.has("value") && this.value == null) {
|
|
489
584
|
this.value = "";
|
|
490
585
|
}
|
|
491
586
|
if (changedProperties.has("maxlength")) {
|
|
492
|
-
|
|
493
|
-
this.maxlength = void 0;
|
|
494
|
-
}
|
|
587
|
+
this.maxlength = normalizeInt(this.maxlength, void 0);
|
|
495
588
|
}
|
|
496
589
|
if (changedProperties.has("minlength")) {
|
|
497
|
-
|
|
498
|
-
this.minlength = void 0;
|
|
499
|
-
}
|
|
590
|
+
this.minlength = normalizeInt(this.minlength, void 0);
|
|
500
591
|
}
|
|
501
592
|
}
|
|
502
593
|
get textareaClasses() {
|
|
@@ -528,34 +619,32 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
528
619
|
this.nativeTextarea?.blur();
|
|
529
620
|
}
|
|
530
621
|
render() {
|
|
531
|
-
return lit.html
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
></textarea>
|
|
558
|
-
`;
|
|
622
|
+
return lit.html`<textarea
|
|
623
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
624
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
625
|
+
aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
|
|
626
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
627
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
628
|
+
autocomplete="${ifDefined_js.ifDefined(this.autocomplete || void 0)}"
|
|
629
|
+
?autofocus="${this.autofocus}"
|
|
630
|
+
class="${this.textareaClasses}"
|
|
631
|
+
data-sp-textarea-native
|
|
632
|
+
?disabled="${this.isDisabled}"
|
|
633
|
+
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
634
|
+
inputmode="${ifDefined_js.ifDefined(this.inputmode || void 0)}"
|
|
635
|
+
?readonly="${this.readonly}"
|
|
636
|
+
?required="${this.required}"
|
|
637
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
638
|
+
maxlength="${ifDefined_js.ifDefined(this.maxlength)}"
|
|
639
|
+
minlength="${ifDefined_js.ifDefined(this.minlength)}"
|
|
640
|
+
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
641
|
+
placeholder="${ifDefined_js.ifDefined(this.placeholder || void 0)}"
|
|
642
|
+
rows="${this.rows}"
|
|
643
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
644
|
+
.value="${live_js.live(this.value)}"
|
|
645
|
+
@change="${this.handleChange}"
|
|
646
|
+
@input="${this.handleInput}"
|
|
647
|
+
></textarea>`;
|
|
559
648
|
}
|
|
560
649
|
};
|
|
561
650
|
SpectreTextareaElement.properties = {
|
|
@@ -577,7 +666,6 @@ SpectreTextareaElement.properties = {
|
|
|
577
666
|
rows: { type: Number },
|
|
578
667
|
size: { type: String, reflect: true },
|
|
579
668
|
success: { type: Boolean, reflect: true },
|
|
580
|
-
title: { type: String, reflect: true },
|
|
581
669
|
value: { type: String }
|
|
582
670
|
};
|
|
583
671
|
function defineSpectreTextarea(tagName = "sp-textarea") {
|
|
@@ -600,7 +688,6 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
600
688
|
this.required = false;
|
|
601
689
|
this.size = "md";
|
|
602
690
|
this.success = false;
|
|
603
|
-
this.title = "";
|
|
604
691
|
this.value = "";
|
|
605
692
|
}
|
|
606
693
|
getContentContainer() {
|
|
@@ -667,30 +754,28 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
667
754
|
this.getContentContainer()?.blur();
|
|
668
755
|
}
|
|
669
756
|
render() {
|
|
670
|
-
return lit.html
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
</select>
|
|
693
|
-
`;
|
|
757
|
+
return lit.html`<select
|
|
758
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
759
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
760
|
+
aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
|
|
761
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
762
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
763
|
+
autocomplete="${ifDefined_js.ifDefined(this.autocomplete || void 0)}"
|
|
764
|
+
?autofocus="${this.autofocus}"
|
|
765
|
+
class="${this.selectClasses}"
|
|
766
|
+
data-sp-select-native
|
|
767
|
+
?disabled="${this.isDisabled}"
|
|
768
|
+
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
769
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
770
|
+
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
771
|
+
?required="${this.required}"
|
|
772
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
773
|
+
.value="${live_js.live(this.value)}"
|
|
774
|
+
@change="${this.handleChange}"
|
|
775
|
+
@input="${this.handleInput}"
|
|
776
|
+
>
|
|
777
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
778
|
+
</select>`;
|
|
694
779
|
}
|
|
695
780
|
};
|
|
696
781
|
SpectreSelectElement.properties = {
|
|
@@ -706,7 +791,6 @@ SpectreSelectElement.properties = {
|
|
|
706
791
|
required: { type: Boolean, reflect: true },
|
|
707
792
|
size: { type: String, reflect: true },
|
|
708
793
|
success: { type: Boolean, reflect: true },
|
|
709
|
-
title: { type: String, reflect: true },
|
|
710
794
|
value: { type: String }
|
|
711
795
|
};
|
|
712
796
|
function defineSpectreSelect(tagName = "sp-select") {
|
|
@@ -727,7 +811,6 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
727
811
|
this.loading = false;
|
|
728
812
|
this.required = false;
|
|
729
813
|
this.success = false;
|
|
730
|
-
this.title = "";
|
|
731
814
|
this.value = "on";
|
|
732
815
|
}
|
|
733
816
|
getContentContainer() {
|
|
@@ -770,33 +853,31 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
770
853
|
this.nativeInput?.blur();
|
|
771
854
|
}
|
|
772
855
|
render() {
|
|
773
|
-
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? lit.html`<span class=
|
|
774
|
-
return lit.html
|
|
775
|
-
<
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
</label>
|
|
799
|
-
`;
|
|
856
|
+
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? lit.html`<span class="sp-label" data-sp-checkbox-label-fallback>${this.visibleLabelFallback}</span>` : lit.nothing;
|
|
857
|
+
return lit.html`<label data-sp-checkbox-label>
|
|
858
|
+
<input
|
|
859
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
860
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
861
|
+
aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
|
|
862
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
863
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
864
|
+
?autofocus="${this.autofocus}"
|
|
865
|
+
data-sp-checkbox-native
|
|
866
|
+
.checked="${live_js.live(this.checked)}"
|
|
867
|
+
?disabled="${this.isDisabled}"
|
|
868
|
+
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
869
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
870
|
+
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
871
|
+
?required="${this.required}"
|
|
872
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
873
|
+
type="checkbox"
|
|
874
|
+
value="${ifDefined_js.ifDefined(this.value)}"
|
|
875
|
+
@change="${this.handleChange}"
|
|
876
|
+
@input="${this.handleInput}"
|
|
877
|
+
/>
|
|
878
|
+
<span class="sp-checkbox-indicator" data-sp-checkbox-indicator></span>
|
|
879
|
+
${labelContent}
|
|
880
|
+
</label>`;
|
|
800
881
|
}
|
|
801
882
|
};
|
|
802
883
|
SpectreCheckboxElement.properties = {
|
|
@@ -810,7 +891,6 @@ SpectreCheckboxElement.properties = {
|
|
|
810
891
|
name: { type: String, reflect: true },
|
|
811
892
|
required: { type: Boolean, reflect: true },
|
|
812
893
|
success: { type: Boolean, reflect: true },
|
|
813
|
-
title: { type: String, reflect: true },
|
|
814
894
|
value: { type: String }
|
|
815
895
|
};
|
|
816
896
|
function defineSpectreCheckbox(tagName = "sp-checkbox") {
|
|
@@ -831,7 +911,6 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
831
911
|
this.loading = false;
|
|
832
912
|
this.required = false;
|
|
833
913
|
this.success = false;
|
|
834
|
-
this.title = "";
|
|
835
914
|
this.value = "on";
|
|
836
915
|
}
|
|
837
916
|
getContentContainer() {
|
|
@@ -874,33 +953,31 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
874
953
|
this.nativeInput?.blur();
|
|
875
954
|
}
|
|
876
955
|
render() {
|
|
877
|
-
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? lit.html`<span class=
|
|
878
|
-
return lit.html
|
|
879
|
-
<
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
</label>
|
|
903
|
-
`;
|
|
956
|
+
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? lit.html`<span class="sp-label" data-sp-radio-label-fallback>${this.visibleLabelFallback}</span>` : lit.nothing;
|
|
957
|
+
return lit.html`<label data-sp-radio-label>
|
|
958
|
+
<input
|
|
959
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
960
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
961
|
+
aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
|
|
962
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
963
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
964
|
+
?autofocus="${this.autofocus}"
|
|
965
|
+
data-sp-radio-native
|
|
966
|
+
.checked="${live_js.live(this.checked)}"
|
|
967
|
+
?disabled="${this.isDisabled}"
|
|
968
|
+
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
969
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
970
|
+
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
971
|
+
?required="${this.required}"
|
|
972
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
973
|
+
type="radio"
|
|
974
|
+
value="${ifDefined_js.ifDefined(this.value)}"
|
|
975
|
+
@change="${this.handleChange}"
|
|
976
|
+
@input="${this.handleInput}"
|
|
977
|
+
/>
|
|
978
|
+
<span class="sp-radio-indicator" data-sp-radio-indicator></span>
|
|
979
|
+
${labelContent}
|
|
980
|
+
</label>`;
|
|
904
981
|
}
|
|
905
982
|
};
|
|
906
983
|
SpectreRadioElement.properties = {
|
|
@@ -914,7 +991,6 @@ SpectreRadioElement.properties = {
|
|
|
914
991
|
name: { type: String, reflect: true },
|
|
915
992
|
required: { type: Boolean, reflect: true },
|
|
916
993
|
success: { type: Boolean, reflect: true },
|
|
917
|
-
title: { type: String, reflect: true },
|
|
918
994
|
value: { type: String }
|
|
919
995
|
};
|
|
920
996
|
function defineSpectreRadio(tagName = "sp-radio") {
|
|
@@ -926,10 +1002,6 @@ function defineSpectreRadio(tagName = "sp-radio") {
|
|
|
926
1002
|
return SpectreRadioElement;
|
|
927
1003
|
}
|
|
928
1004
|
var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
929
|
-
constructor() {
|
|
930
|
-
super(...arguments);
|
|
931
|
-
this.title = "";
|
|
932
|
-
}
|
|
933
1005
|
getContentContainer() {
|
|
934
1006
|
return this.querySelector("[data-sp-label-native]");
|
|
935
1007
|
}
|
|
@@ -947,26 +1019,22 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
947
1019
|
this.getContentContainer()?.blur();
|
|
948
1020
|
}
|
|
949
1021
|
render() {
|
|
950
|
-
return lit.html
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
963
|
-
</label>
|
|
964
|
-
`;
|
|
1022
|
+
return lit.html`<label
|
|
1023
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1024
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
1025
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1026
|
+
class="sp-label"
|
|
1027
|
+
data-sp-label-native
|
|
1028
|
+
for="${ifDefined_js.ifDefined(this.htmlFor || void 0)}"
|
|
1029
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1030
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1031
|
+
>
|
|
1032
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
1033
|
+
</label>`;
|
|
965
1034
|
}
|
|
966
1035
|
};
|
|
967
1036
|
SpectreLabelElement.properties = {
|
|
968
|
-
htmlFor: { attribute: "for", type: String, reflect: true }
|
|
969
|
-
title: { type: String, reflect: true }
|
|
1037
|
+
htmlFor: { attribute: "for", type: String, reflect: true }
|
|
970
1038
|
};
|
|
971
1039
|
function defineSpectreLabel(tagName = "sp-label") {
|
|
972
1040
|
const existingElement = customElements.get(tagName);
|
|
@@ -980,8 +1048,6 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
980
1048
|
constructor() {
|
|
981
1049
|
super(...arguments);
|
|
982
1050
|
this.disabled = false;
|
|
983
|
-
this.legend = "";
|
|
984
|
-
this.title = "";
|
|
985
1051
|
}
|
|
986
1052
|
getContentContainer() {
|
|
987
1053
|
return this.querySelector("[data-sp-fieldset-native]");
|
|
@@ -1000,30 +1066,27 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1000
1066
|
this.getContentContainer()?.blur();
|
|
1001
1067
|
}
|
|
1002
1068
|
render() {
|
|
1003
|
-
return lit.html
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
</fieldset>
|
|
1018
|
-
`;
|
|
1069
|
+
return lit.html`<fieldset
|
|
1070
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1071
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
1072
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1073
|
+
data-sp-fieldset-native
|
|
1074
|
+
?disabled="${this.disabled}"
|
|
1075
|
+
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
1076
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1077
|
+
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
1078
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1079
|
+
>
|
|
1080
|
+
${this.legend ? lit.html`<legend class="sp-label" data-sp-fieldset-legend>${this.legend}</legend>` : lit.nothing}
|
|
1081
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
1082
|
+
</fieldset>`;
|
|
1019
1083
|
}
|
|
1020
1084
|
};
|
|
1021
1085
|
SpectreFieldsetElement.properties = {
|
|
1022
1086
|
disabled: { type: Boolean, reflect: true },
|
|
1023
1087
|
form: { type: String },
|
|
1024
1088
|
legend: { type: String, reflect: true },
|
|
1025
|
-
name: { type: String, reflect: true }
|
|
1026
|
-
title: { type: String, reflect: true }
|
|
1089
|
+
name: { type: String, reflect: true }
|
|
1027
1090
|
};
|
|
1028
1091
|
function defineSpectreFieldset(tagName = "sp-fieldset") {
|
|
1029
1092
|
const existingElement = customElements.get(tagName);
|