@phcdevworks/spectre-components 1.2.0 → 1.3.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/dist/{base-B_9DJkh2.d.cts → base-BRQ7QAAr.d.cts} +3 -0
- package/dist/{base-B_9DJkh2.d.ts → base-BRQ7QAAr.d.ts} +3 -0
- package/dist/button.cjs +53 -4
- package/dist/button.cjs.map +1 -1
- package/dist/button.d.cts +12 -15
- package/dist/button.d.ts +12 -15
- package/dist/button.js +54 -5
- package/dist/button.js.map +1 -1
- package/dist/checkbox.cjs +48 -2
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.d.cts +11 -14
- package/dist/checkbox.d.ts +11 -14
- package/dist/checkbox.js +48 -2
- package/dist/checkbox.js.map +1 -1
- package/dist/fieldset.cjs +31 -0
- package/dist/fieldset.cjs.map +1 -1
- package/dist/fieldset.d.cts +5 -2
- package/dist/fieldset.d.ts +5 -2
- package/dist/fieldset.js +31 -0
- package/dist/fieldset.js.map +1 -1
- package/dist/{form-9cZG1E9P.d.cts → form-yR_u97J-.d.cts} +1 -1
- package/dist/{form-9cZG1E9P.d.ts → form-yR_u97J-.d.ts} +1 -1
- package/dist/index.cjs +204 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +205 -27
- package/dist/index.js.map +1 -1
- package/dist/input.cjs +55 -7
- package/dist/input.cjs.map +1 -1
- package/dist/input.d.cts +16 -27
- package/dist/input.d.ts +16 -27
- package/dist/input.js +55 -7
- package/dist/input.js.map +1 -1
- package/dist/label.cjs +29 -0
- package/dist/label.cjs.map +1 -1
- package/dist/label.d.cts +4 -3
- package/dist/label.d.ts +4 -3
- package/dist/label.js +29 -0
- package/dist/label.js.map +1 -1
- package/dist/{projectable-CIfxi7dv.d.cts → projectable-Bx-IVk0w.d.cts} +1 -1
- package/dist/{projectable-Ksv9eoIr.d.ts → projectable-D6IDeKfr.d.ts} +1 -1
- package/dist/radio.cjs +50 -4
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.d.cts +11 -14
- package/dist/radio.d.ts +11 -14
- package/dist/radio.js +50 -4
- package/dist/radio.js.map +1 -1
- package/dist/select.cjs +51 -2
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +13 -16
- package/dist/select.d.ts +13 -16
- package/dist/select.js +51 -2
- package/dist/select.js.map +1 -1
- package/dist/textarea.cjs +55 -7
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.d.cts +15 -26
- package/dist/textarea.d.ts +15 -26
- package/dist/textarea.js +55 -7
- package/dist/textarea.js.map +1 -1
- package/package.json +15 -12
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getButtonClasses,
|
|
1
|
+
import { getButtonClasses, getInputLabelClasses, getInputClasses } from '@phcdevworks/spectre-ui';
|
|
2
2
|
import { LitElement, html, nothing } from 'lit';
|
|
3
3
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
4
|
import { live } from 'lit/directives/live.js';
|
|
@@ -54,6 +54,7 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
54
54
|
this._ariaLabelledBy = null;
|
|
55
55
|
this._ariaDescribedBy = null;
|
|
56
56
|
this._autocapitalize = "";
|
|
57
|
+
this._autofocus = false;
|
|
57
58
|
this._spellcheck = null;
|
|
58
59
|
this._title = "";
|
|
59
60
|
this._id = "";
|
|
@@ -138,6 +139,18 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
138
139
|
this._removeHostAttribute("id");
|
|
139
140
|
this.requestUpdate();
|
|
140
141
|
}
|
|
142
|
+
get autofocus() {
|
|
143
|
+
return this._autofocus;
|
|
144
|
+
}
|
|
145
|
+
set autofocus(value) {
|
|
146
|
+
const normalizedValue = !!value;
|
|
147
|
+
if (this._autofocus === normalizedValue) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this._autofocus = normalizedValue;
|
|
151
|
+
this._removeHostAttribute("autofocus");
|
|
152
|
+
this.requestUpdate();
|
|
153
|
+
}
|
|
141
154
|
// Spectre components intentionally render in light DOM so the global
|
|
142
155
|
// `@phcdevworks/spectre-ui` styling contract can apply directly.
|
|
143
156
|
createRenderRoot() {
|
|
@@ -149,6 +162,7 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
149
162
|
"id",
|
|
150
163
|
"title",
|
|
151
164
|
"autocapitalize",
|
|
165
|
+
"autofocus",
|
|
152
166
|
"spellcheck",
|
|
153
167
|
"aria-label",
|
|
154
168
|
"aria-labelledby",
|
|
@@ -169,6 +183,8 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
169
183
|
return this.title || null;
|
|
170
184
|
case "autocapitalize":
|
|
171
185
|
return this.autocapitalize || null;
|
|
186
|
+
case "autofocus":
|
|
187
|
+
return this.autofocus ? "" : null;
|
|
172
188
|
case "spellcheck":
|
|
173
189
|
return this._spellcheck !== null ? String(this._spellcheck) : null;
|
|
174
190
|
case "aria-label":
|
|
@@ -189,6 +205,8 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
189
205
|
return this.title !== "";
|
|
190
206
|
case "autocapitalize":
|
|
191
207
|
return this.autocapitalize !== "";
|
|
208
|
+
case "autofocus":
|
|
209
|
+
return this.autofocus;
|
|
192
210
|
case "spellcheck":
|
|
193
211
|
return this._spellcheck !== null;
|
|
194
212
|
case "aria-label":
|
|
@@ -212,6 +230,9 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
212
230
|
case "autocapitalize":
|
|
213
231
|
this.autocapitalize = value;
|
|
214
232
|
break;
|
|
233
|
+
case "autofocus":
|
|
234
|
+
this.autofocus = true;
|
|
235
|
+
break;
|
|
215
236
|
case "spellcheck":
|
|
216
237
|
this.spellcheck = value !== "false";
|
|
217
238
|
break;
|
|
@@ -239,6 +260,9 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
239
260
|
case "autocapitalize":
|
|
240
261
|
this.autocapitalize = "";
|
|
241
262
|
break;
|
|
263
|
+
case "autofocus":
|
|
264
|
+
this.autofocus = false;
|
|
265
|
+
break;
|
|
242
266
|
case "spellcheck":
|
|
243
267
|
this.spellcheck = null;
|
|
244
268
|
break;
|
|
@@ -356,7 +380,6 @@ var SpectreProjectableElement = class extends SpectreBaseElement {
|
|
|
356
380
|
var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
357
381
|
constructor() {
|
|
358
382
|
super(...arguments);
|
|
359
|
-
this.autofocus = false;
|
|
360
383
|
this.disabled = false;
|
|
361
384
|
this.fullWidth = false;
|
|
362
385
|
this.iconOnly = false;
|
|
@@ -380,6 +403,12 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
380
403
|
set title(value) {
|
|
381
404
|
super.title = value;
|
|
382
405
|
}
|
|
406
|
+
get autofocus() {
|
|
407
|
+
return super.autofocus;
|
|
408
|
+
}
|
|
409
|
+
set autofocus(value) {
|
|
410
|
+
super.autofocus = value;
|
|
411
|
+
}
|
|
383
412
|
getContentContainer() {
|
|
384
413
|
return this.querySelector("[data-sp-button-native]");
|
|
385
414
|
}
|
|
@@ -391,6 +420,21 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
391
420
|
return el.hasAttribute("data-sp-button-native") || el.hasAttribute("data-sp-button-loading-label") || el.hasAttribute("data-sp-button-label-fallback");
|
|
392
421
|
}
|
|
393
422
|
willUpdate(changedProperties) {
|
|
423
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
424
|
+
this.disabled = false;
|
|
425
|
+
}
|
|
426
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
427
|
+
this.fullWidth = false;
|
|
428
|
+
}
|
|
429
|
+
if (changedProperties.has("iconOnly") && this.iconOnly == null) {
|
|
430
|
+
this.iconOnly = false;
|
|
431
|
+
}
|
|
432
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
433
|
+
this.loading = false;
|
|
434
|
+
}
|
|
435
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
436
|
+
this.pill = false;
|
|
437
|
+
}
|
|
394
438
|
if (changedProperties.has("variant") && (this.variant == null || !isButtonVariant(this.variant))) {
|
|
395
439
|
this.variant = "primary";
|
|
396
440
|
}
|
|
@@ -435,12 +479,18 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
435
479
|
}
|
|
436
480
|
renderButtonContent() {
|
|
437
481
|
if (this.loading) {
|
|
438
|
-
return html`<span
|
|
482
|
+
return html`<span
|
|
483
|
+
class="${getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
484
|
+
data-sp-button-loading-label
|
|
485
|
+
>${this.loadingLabel}</span>`;
|
|
439
486
|
}
|
|
440
487
|
if (this.hasProjectedContent) {
|
|
441
488
|
return this.projectedContent;
|
|
442
489
|
}
|
|
443
|
-
return this.visibleLabelFallback ? html`<span
|
|
490
|
+
return this.visibleLabelFallback ? html`<span
|
|
491
|
+
class="${getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
492
|
+
data-sp-button-label-fallback
|
|
493
|
+
>${this.visibleLabelFallback}</span>` : nothing;
|
|
444
494
|
}
|
|
445
495
|
render() {
|
|
446
496
|
return html`<button
|
|
@@ -464,7 +514,6 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
464
514
|
}
|
|
465
515
|
};
|
|
466
516
|
SpectreButtonElement.properties = {
|
|
467
|
-
autofocus: { type: Boolean, reflect: true },
|
|
468
517
|
disabled: { type: Boolean, reflect: true },
|
|
469
518
|
form: { type: String },
|
|
470
519
|
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
@@ -490,7 +539,6 @@ function defineSpectreButton(tagName = "sp-button") {
|
|
|
490
539
|
var SpectreInputElement = class extends SpectreBaseElement {
|
|
491
540
|
constructor() {
|
|
492
541
|
super(...arguments);
|
|
493
|
-
this.autofocus = false;
|
|
494
542
|
this.disabled = false;
|
|
495
543
|
this.fullWidth = false;
|
|
496
544
|
this.invalid = false;
|
|
@@ -509,6 +557,12 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
509
557
|
set autocapitalize(value) {
|
|
510
558
|
super.autocapitalize = value;
|
|
511
559
|
}
|
|
560
|
+
get autofocus() {
|
|
561
|
+
return super.autofocus;
|
|
562
|
+
}
|
|
563
|
+
set autofocus(value) {
|
|
564
|
+
super.autofocus = value;
|
|
565
|
+
}
|
|
512
566
|
get id() {
|
|
513
567
|
return super.id;
|
|
514
568
|
}
|
|
@@ -528,6 +582,30 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
528
582
|
super.title = value;
|
|
529
583
|
}
|
|
530
584
|
willUpdate(changedProperties) {
|
|
585
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
586
|
+
this.disabled = false;
|
|
587
|
+
}
|
|
588
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
589
|
+
this.fullWidth = false;
|
|
590
|
+
}
|
|
591
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
592
|
+
this.invalid = false;
|
|
593
|
+
}
|
|
594
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
595
|
+
this.loading = false;
|
|
596
|
+
}
|
|
597
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
598
|
+
this.pill = false;
|
|
599
|
+
}
|
|
600
|
+
if (changedProperties.has("readonly") && this.readonly == null) {
|
|
601
|
+
this.readonly = false;
|
|
602
|
+
}
|
|
603
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
604
|
+
this.required = false;
|
|
605
|
+
}
|
|
606
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
607
|
+
this.success = false;
|
|
608
|
+
}
|
|
531
609
|
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
532
610
|
this.size = "md";
|
|
533
611
|
}
|
|
@@ -599,9 +677,7 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
599
677
|
name="${ifDefined(this.name || void 0)}"
|
|
600
678
|
pattern="${ifDefined(this.pattern || void 0)}"
|
|
601
679
|
placeholder="${ifDefined(this.placeholder || void 0)}"
|
|
602
|
-
spellcheck="${ifDefined(
|
|
603
|
-
this.spellcheck === void 0 ? void 0 : String(this.spellcheck)
|
|
604
|
-
)}"
|
|
680
|
+
spellcheck="${ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
605
681
|
step="${ifDefined(this.step || void 0)}"
|
|
606
682
|
title="${ifDefined(this.title || void 0)}"
|
|
607
683
|
type="${this.type}"
|
|
@@ -612,9 +688,7 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
612
688
|
}
|
|
613
689
|
};
|
|
614
690
|
SpectreInputElement.properties = {
|
|
615
|
-
autocapitalize: { type: String, reflect: true },
|
|
616
691
|
autocomplete: { type: String, reflect: true },
|
|
617
|
-
autofocus: { type: Boolean, reflect: true },
|
|
618
692
|
disabled: { type: Boolean, reflect: true },
|
|
619
693
|
enterkeyhint: { type: String, reflect: true },
|
|
620
694
|
form: { type: String },
|
|
@@ -634,7 +708,6 @@ SpectreInputElement.properties = {
|
|
|
634
708
|
readonly: { type: Boolean, reflect: true },
|
|
635
709
|
required: { type: Boolean, reflect: true },
|
|
636
710
|
size: { type: String, reflect: true },
|
|
637
|
-
spellcheck: { type: Boolean, reflect: true },
|
|
638
711
|
step: { type: String, reflect: true },
|
|
639
712
|
success: { type: Boolean, reflect: true },
|
|
640
713
|
type: { type: String, reflect: true },
|
|
@@ -652,7 +725,6 @@ var DEFAULT_ROWS = 2;
|
|
|
652
725
|
var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
653
726
|
constructor() {
|
|
654
727
|
super(...arguments);
|
|
655
|
-
this.autofocus = false;
|
|
656
728
|
this.disabled = false;
|
|
657
729
|
this.fullWidth = false;
|
|
658
730
|
this.invalid = false;
|
|
@@ -671,6 +743,12 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
671
743
|
set autocapitalize(value) {
|
|
672
744
|
super.autocapitalize = value;
|
|
673
745
|
}
|
|
746
|
+
get autofocus() {
|
|
747
|
+
return super.autofocus;
|
|
748
|
+
}
|
|
749
|
+
set autofocus(value) {
|
|
750
|
+
super.autofocus = value;
|
|
751
|
+
}
|
|
674
752
|
get id() {
|
|
675
753
|
return super.id;
|
|
676
754
|
}
|
|
@@ -690,6 +768,30 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
690
768
|
super.title = value;
|
|
691
769
|
}
|
|
692
770
|
willUpdate(changedProperties) {
|
|
771
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
772
|
+
this.disabled = false;
|
|
773
|
+
}
|
|
774
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
775
|
+
this.fullWidth = false;
|
|
776
|
+
}
|
|
777
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
778
|
+
this.invalid = false;
|
|
779
|
+
}
|
|
780
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
781
|
+
this.loading = false;
|
|
782
|
+
}
|
|
783
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
784
|
+
this.pill = false;
|
|
785
|
+
}
|
|
786
|
+
if (changedProperties.has("readonly") && this.readonly == null) {
|
|
787
|
+
this.readonly = false;
|
|
788
|
+
}
|
|
789
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
790
|
+
this.required = false;
|
|
791
|
+
}
|
|
792
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
793
|
+
this.success = false;
|
|
794
|
+
}
|
|
693
795
|
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
694
796
|
this.size = "md";
|
|
695
797
|
}
|
|
@@ -758,9 +860,7 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
758
860
|
name="${ifDefined(this.name || void 0)}"
|
|
759
861
|
placeholder="${ifDefined(this.placeholder || void 0)}"
|
|
760
862
|
rows="${this.rows}"
|
|
761
|
-
spellcheck="${ifDefined(
|
|
762
|
-
this.spellcheck === void 0 ? void 0 : String(this.spellcheck)
|
|
763
|
-
)}"
|
|
863
|
+
spellcheck="${ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
764
864
|
title="${ifDefined(this.title || void 0)}"
|
|
765
865
|
.value="${live(this.value)}"
|
|
766
866
|
@change="${this.handleChange}"
|
|
@@ -769,9 +869,7 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
769
869
|
}
|
|
770
870
|
};
|
|
771
871
|
SpectreTextareaElement.properties = {
|
|
772
|
-
autocapitalize: { type: String, reflect: true },
|
|
773
872
|
autocomplete: { type: String, reflect: true },
|
|
774
|
-
autofocus: { type: Boolean, reflect: true },
|
|
775
873
|
disabled: { type: Boolean, reflect: true },
|
|
776
874
|
enterkeyhint: { type: String, reflect: true },
|
|
777
875
|
form: { type: String },
|
|
@@ -788,7 +886,6 @@ SpectreTextareaElement.properties = {
|
|
|
788
886
|
required: { type: Boolean, reflect: true },
|
|
789
887
|
rows: { type: Number, reflect: true },
|
|
790
888
|
size: { type: String, reflect: true },
|
|
791
|
-
spellcheck: { type: Boolean, reflect: true },
|
|
792
889
|
success: { type: Boolean, reflect: true },
|
|
793
890
|
value: { type: String }
|
|
794
891
|
};
|
|
@@ -803,7 +900,6 @@ function defineSpectreTextarea(tagName = "sp-textarea") {
|
|
|
803
900
|
var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
804
901
|
constructor() {
|
|
805
902
|
super(...arguments);
|
|
806
|
-
this.autofocus = false;
|
|
807
903
|
this.disabled = false;
|
|
808
904
|
this.fullWidth = false;
|
|
809
905
|
this.invalid = false;
|
|
@@ -826,6 +922,12 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
826
922
|
set title(value) {
|
|
827
923
|
super.title = value;
|
|
828
924
|
}
|
|
925
|
+
get autofocus() {
|
|
926
|
+
return super.autofocus;
|
|
927
|
+
}
|
|
928
|
+
set autofocus(value) {
|
|
929
|
+
super.autofocus = value;
|
|
930
|
+
}
|
|
829
931
|
getContentContainer() {
|
|
830
932
|
return this.querySelector("[data-sp-select-native]");
|
|
831
933
|
}
|
|
@@ -837,6 +939,27 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
837
939
|
return el.hasAttribute("data-sp-select-native");
|
|
838
940
|
}
|
|
839
941
|
willUpdate(changedProperties) {
|
|
942
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
943
|
+
this.disabled = false;
|
|
944
|
+
}
|
|
945
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
946
|
+
this.fullWidth = false;
|
|
947
|
+
}
|
|
948
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
949
|
+
this.invalid = false;
|
|
950
|
+
}
|
|
951
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
952
|
+
this.loading = false;
|
|
953
|
+
}
|
|
954
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
955
|
+
this.pill = false;
|
|
956
|
+
}
|
|
957
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
958
|
+
this.required = false;
|
|
959
|
+
}
|
|
960
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
961
|
+
this.success = false;
|
|
962
|
+
}
|
|
840
963
|
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
841
964
|
this.size = "md";
|
|
842
965
|
}
|
|
@@ -920,7 +1043,6 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
920
1043
|
};
|
|
921
1044
|
SpectreSelectElement.properties = {
|
|
922
1045
|
autocomplete: { type: String, reflect: true },
|
|
923
|
-
autofocus: { type: Boolean, reflect: true },
|
|
924
1046
|
disabled: { type: Boolean, reflect: true },
|
|
925
1047
|
form: { type: String },
|
|
926
1048
|
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
@@ -944,7 +1066,6 @@ function defineSpectreSelect(tagName = "sp-select") {
|
|
|
944
1066
|
var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
945
1067
|
constructor() {
|
|
946
1068
|
super(...arguments);
|
|
947
|
-
this.autofocus = false;
|
|
948
1069
|
this.checked = false;
|
|
949
1070
|
this.disabled = false;
|
|
950
1071
|
this.invalid = false;
|
|
@@ -965,6 +1086,12 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
965
1086
|
set title(value) {
|
|
966
1087
|
super.title = value;
|
|
967
1088
|
}
|
|
1089
|
+
get autofocus() {
|
|
1090
|
+
return super.autofocus;
|
|
1091
|
+
}
|
|
1092
|
+
set autofocus(value) {
|
|
1093
|
+
super.autofocus = value;
|
|
1094
|
+
}
|
|
968
1095
|
getContentContainer() {
|
|
969
1096
|
return this.querySelector("[data-sp-checkbox-label]");
|
|
970
1097
|
}
|
|
@@ -976,6 +1103,24 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
976
1103
|
return el.hasAttribute("data-sp-checkbox-label") || el.hasAttribute("data-sp-checkbox-native") || el.hasAttribute("data-sp-checkbox-label-fallback") || el.hasAttribute("data-sp-checkbox-indicator");
|
|
977
1104
|
}
|
|
978
1105
|
willUpdate(changedProperties) {
|
|
1106
|
+
if (changedProperties.has("checked") && this.checked == null) {
|
|
1107
|
+
this.checked = false;
|
|
1108
|
+
}
|
|
1109
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1110
|
+
this.disabled = false;
|
|
1111
|
+
}
|
|
1112
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
1113
|
+
this.invalid = false;
|
|
1114
|
+
}
|
|
1115
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1116
|
+
this.loading = false;
|
|
1117
|
+
}
|
|
1118
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
1119
|
+
this.required = false;
|
|
1120
|
+
}
|
|
1121
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
1122
|
+
this.success = false;
|
|
1123
|
+
}
|
|
979
1124
|
if (changedProperties.has("value") && this.value == null) {
|
|
980
1125
|
this.value = "on";
|
|
981
1126
|
}
|
|
@@ -1036,7 +1181,6 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1036
1181
|
}
|
|
1037
1182
|
};
|
|
1038
1183
|
SpectreCheckboxElement.properties = {
|
|
1039
|
-
autofocus: { type: Boolean, reflect: true },
|
|
1040
1184
|
checked: { type: Boolean, reflect: true },
|
|
1041
1185
|
disabled: { type: Boolean, reflect: true },
|
|
1042
1186
|
form: { type: String },
|
|
@@ -1059,7 +1203,6 @@ function defineSpectreCheckbox(tagName = "sp-checkbox") {
|
|
|
1059
1203
|
var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
1060
1204
|
constructor() {
|
|
1061
1205
|
super(...arguments);
|
|
1062
|
-
this.autofocus = false;
|
|
1063
1206
|
this.checked = false;
|
|
1064
1207
|
this.disabled = false;
|
|
1065
1208
|
this.invalid = false;
|
|
@@ -1080,6 +1223,12 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1080
1223
|
set title(value) {
|
|
1081
1224
|
super.title = value;
|
|
1082
1225
|
}
|
|
1226
|
+
get autofocus() {
|
|
1227
|
+
return super.autofocus;
|
|
1228
|
+
}
|
|
1229
|
+
set autofocus(value) {
|
|
1230
|
+
super.autofocus = value;
|
|
1231
|
+
}
|
|
1083
1232
|
getContentContainer() {
|
|
1084
1233
|
return this.querySelector("[data-sp-radio-label]");
|
|
1085
1234
|
}
|
|
@@ -1091,6 +1240,24 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1091
1240
|
return el.hasAttribute("data-sp-radio-label") || el.hasAttribute("data-sp-radio-native") || el.hasAttribute("data-sp-radio-label-fallback") || el.hasAttribute("data-sp-radio-indicator");
|
|
1092
1241
|
}
|
|
1093
1242
|
willUpdate(changedProperties) {
|
|
1243
|
+
if (changedProperties.has("checked") && this.checked == null) {
|
|
1244
|
+
this.checked = false;
|
|
1245
|
+
}
|
|
1246
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1247
|
+
this.disabled = false;
|
|
1248
|
+
}
|
|
1249
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
1250
|
+
this.invalid = false;
|
|
1251
|
+
}
|
|
1252
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1253
|
+
this.loading = false;
|
|
1254
|
+
}
|
|
1255
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
1256
|
+
this.required = false;
|
|
1257
|
+
}
|
|
1258
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
1259
|
+
this.success = false;
|
|
1260
|
+
}
|
|
1094
1261
|
if (changedProperties.has("value") && this.value == null) {
|
|
1095
1262
|
this.value = "on";
|
|
1096
1263
|
}
|
|
@@ -1125,10 +1292,10 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1125
1292
|
}
|
|
1126
1293
|
const root = this.getRootNode();
|
|
1127
1294
|
const radios = root.querySelectorAll(
|
|
1128
|
-
|
|
1295
|
+
"sp-radio"
|
|
1129
1296
|
);
|
|
1130
1297
|
radios.forEach((radio) => {
|
|
1131
|
-
if (radio !== this && radio.checked) {
|
|
1298
|
+
if (radio !== this && radio.name === this.name && radio.checked) {
|
|
1132
1299
|
radio.checked = false;
|
|
1133
1300
|
}
|
|
1134
1301
|
});
|
|
@@ -1171,7 +1338,6 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1171
1338
|
}
|
|
1172
1339
|
};
|
|
1173
1340
|
SpectreRadioElement.properties = {
|
|
1174
|
-
autofocus: { type: Boolean, reflect: true },
|
|
1175
1341
|
checked: { type: Boolean, reflect: true },
|
|
1176
1342
|
disabled: { type: Boolean, reflect: true },
|
|
1177
1343
|
form: { type: String },
|
|
@@ -1196,6 +1362,11 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1196
1362
|
super(...arguments);
|
|
1197
1363
|
this.disabled = false;
|
|
1198
1364
|
}
|
|
1365
|
+
willUpdate(changedProperties) {
|
|
1366
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1367
|
+
this.disabled = false;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1199
1370
|
get isDisabled() {
|
|
1200
1371
|
return this.disabled ?? false;
|
|
1201
1372
|
}
|
|
@@ -1274,6 +1445,12 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1274
1445
|
set title(value) {
|
|
1275
1446
|
super.title = value;
|
|
1276
1447
|
}
|
|
1448
|
+
get autofocus() {
|
|
1449
|
+
return super.autofocus;
|
|
1450
|
+
}
|
|
1451
|
+
set autofocus(value) {
|
|
1452
|
+
super.autofocus = value;
|
|
1453
|
+
}
|
|
1277
1454
|
get visibleLegend() {
|
|
1278
1455
|
const trimmedLegend = this.legend?.trim();
|
|
1279
1456
|
return trimmedLegend ? trimmedLegend : void 0;
|
|
@@ -1318,6 +1495,7 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1318
1495
|
aria-invalid="${ifDefined(this.invalid ? "true" : void 0)}"
|
|
1319
1496
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1320
1497
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1498
|
+
?autofocus="${this.autofocus}"
|
|
1321
1499
|
data-sp-fieldset-native
|
|
1322
1500
|
?disabled="${this.isDisabled}"
|
|
1323
1501
|
form="${ifDefined(this.form || void 0)}"
|