@phcdevworks/spectre-components 1.2.0 → 1.4.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 +359 -199
- package/dist/badge.cjs +450 -0
- package/dist/badge.cjs.map +1 -0
- package/dist/badge.d.cts +61 -0
- package/dist/badge.d.ts +61 -0
- package/dist/badge.js +445 -0
- package/dist/badge.js.map +1 -0
- 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/card.cjs +439 -0
- package/dist/card.cjs.map +1 -0
- package/dist/card.d.cts +67 -0
- package/dist/card.d.ts +67 -0
- package/dist/card.js +435 -0
- package/dist/card.js.map +1 -0
- 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 +45 -0
- package/dist/fieldset.cjs.map +1 -1
- package/dist/fieldset.d.cts +11 -2
- package/dist/fieldset.d.ts +11 -2
- package/dist/fieldset.js +45 -0
- package/dist/fieldset.js.map +1 -1
- package/dist/form-Dg6kuOS7.d.cts +18 -0
- package/dist/form-Dg6kuOS7.d.ts +18 -0
- package/dist/icon-box.cjs +462 -0
- package/dist/icon-box.cjs.map +1 -0
- package/dist/icon-box.d.cts +73 -0
- package/dist/icon-box.d.ts +73 -0
- package/dist/icon-box.js +457 -0
- package/dist/icon-box.js.map +1 -0
- package/dist/index.cjs +754 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +739 -28
- 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/rating.cjs +373 -0
- package/dist/rating.cjs.map +1 -0
- package/dist/rating.d.cts +67 -0
- package/dist/rating.d.ts +67 -0
- package/dist/rating.js +369 -0
- package/dist/rating.js.map +1 -0
- package/dist/select.cjs +65 -2
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +19 -16
- package/dist/select.d.ts +19 -16
- package/dist/select.js +65 -2
- package/dist/select.js.map +1 -1
- package/dist/testimonial.cjs +433 -0
- package/dist/testimonial.cjs.map +1 -0
- package/dist/testimonial.d.cts +61 -0
- package/dist/testimonial.d.ts +61 -0
- package/dist/testimonial.js +429 -0
- package/dist/testimonial.js.map +1 -0
- 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 +45 -15
- package/dist/form-9cZG1E9P.d.cts +0 -10
- package/dist/form-9cZG1E9P.d.ts +0 -10
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,46 @@ var spectreInputTypes = [
|
|
|
43
43
|
function isInputType(value) {
|
|
44
44
|
return spectreInputTypes.includes(value);
|
|
45
45
|
}
|
|
46
|
+
var spectreBadgeVariants = [
|
|
47
|
+
"primary",
|
|
48
|
+
"secondary",
|
|
49
|
+
"success",
|
|
50
|
+
"warning",
|
|
51
|
+
"danger",
|
|
52
|
+
"neutral",
|
|
53
|
+
"info",
|
|
54
|
+
"ghost",
|
|
55
|
+
"outline",
|
|
56
|
+
"accent",
|
|
57
|
+
"cta"
|
|
58
|
+
];
|
|
59
|
+
function isBadgeVariant(value) {
|
|
60
|
+
return spectreBadgeVariants.includes(value);
|
|
61
|
+
}
|
|
62
|
+
var spectreCardVariants = ["elevated", "flat", "outline", "ghost"];
|
|
63
|
+
function isCardVariant(value) {
|
|
64
|
+
return spectreCardVariants.includes(value);
|
|
65
|
+
}
|
|
66
|
+
var spectreIconBoxVariants = [
|
|
67
|
+
"primary",
|
|
68
|
+
"secondary",
|
|
69
|
+
"success",
|
|
70
|
+
"warning",
|
|
71
|
+
"danger",
|
|
72
|
+
"info",
|
|
73
|
+
"neutral",
|
|
74
|
+
"ghost",
|
|
75
|
+
"accent",
|
|
76
|
+
"cta",
|
|
77
|
+
"outline"
|
|
78
|
+
];
|
|
79
|
+
function isIconBoxVariant(value) {
|
|
80
|
+
return spectreIconBoxVariants.includes(value);
|
|
81
|
+
}
|
|
82
|
+
var spectreTestimonialVariants = ["elevated", "flat", "outline", "ghost"];
|
|
83
|
+
function isTestimonialVariant(value) {
|
|
84
|
+
return spectreTestimonialVariants.includes(value);
|
|
85
|
+
}
|
|
46
86
|
function normalizeInt(value, fallback, min = 0) {
|
|
47
87
|
if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
|
|
48
88
|
return fallback;
|
|
@@ -56,6 +96,7 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
56
96
|
this._ariaLabelledBy = null;
|
|
57
97
|
this._ariaDescribedBy = null;
|
|
58
98
|
this._autocapitalize = "";
|
|
99
|
+
this._autofocus = false;
|
|
59
100
|
this._spellcheck = null;
|
|
60
101
|
this._title = "";
|
|
61
102
|
this._id = "";
|
|
@@ -140,6 +181,18 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
140
181
|
this._removeHostAttribute("id");
|
|
141
182
|
this.requestUpdate();
|
|
142
183
|
}
|
|
184
|
+
get autofocus() {
|
|
185
|
+
return this._autofocus;
|
|
186
|
+
}
|
|
187
|
+
set autofocus(value) {
|
|
188
|
+
const normalizedValue = !!value;
|
|
189
|
+
if (this._autofocus === normalizedValue) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this._autofocus = normalizedValue;
|
|
193
|
+
this._removeHostAttribute("autofocus");
|
|
194
|
+
this.requestUpdate();
|
|
195
|
+
}
|
|
143
196
|
// Spectre components intentionally render in light DOM so the global
|
|
144
197
|
// `@phcdevworks/spectre-ui` styling contract can apply directly.
|
|
145
198
|
createRenderRoot() {
|
|
@@ -151,6 +204,7 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
151
204
|
"id",
|
|
152
205
|
"title",
|
|
153
206
|
"autocapitalize",
|
|
207
|
+
"autofocus",
|
|
154
208
|
"spellcheck",
|
|
155
209
|
"aria-label",
|
|
156
210
|
"aria-labelledby",
|
|
@@ -171,6 +225,8 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
171
225
|
return this.title || null;
|
|
172
226
|
case "autocapitalize":
|
|
173
227
|
return this.autocapitalize || null;
|
|
228
|
+
case "autofocus":
|
|
229
|
+
return this.autofocus ? "" : null;
|
|
174
230
|
case "spellcheck":
|
|
175
231
|
return this._spellcheck !== null ? String(this._spellcheck) : null;
|
|
176
232
|
case "aria-label":
|
|
@@ -191,6 +247,8 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
191
247
|
return this.title !== "";
|
|
192
248
|
case "autocapitalize":
|
|
193
249
|
return this.autocapitalize !== "";
|
|
250
|
+
case "autofocus":
|
|
251
|
+
return this.autofocus;
|
|
194
252
|
case "spellcheck":
|
|
195
253
|
return this._spellcheck !== null;
|
|
196
254
|
case "aria-label":
|
|
@@ -214,6 +272,9 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
214
272
|
case "autocapitalize":
|
|
215
273
|
this.autocapitalize = value;
|
|
216
274
|
break;
|
|
275
|
+
case "autofocus":
|
|
276
|
+
this.autofocus = true;
|
|
277
|
+
break;
|
|
217
278
|
case "spellcheck":
|
|
218
279
|
this.spellcheck = value !== "false";
|
|
219
280
|
break;
|
|
@@ -241,6 +302,9 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
241
302
|
case "autocapitalize":
|
|
242
303
|
this.autocapitalize = "";
|
|
243
304
|
break;
|
|
305
|
+
case "autofocus":
|
|
306
|
+
this.autofocus = false;
|
|
307
|
+
break;
|
|
244
308
|
case "spellcheck":
|
|
245
309
|
this.spellcheck = null;
|
|
246
310
|
break;
|
|
@@ -358,7 +422,6 @@ var SpectreProjectableElement = class extends SpectreBaseElement {
|
|
|
358
422
|
var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
359
423
|
constructor() {
|
|
360
424
|
super(...arguments);
|
|
361
|
-
this.autofocus = false;
|
|
362
425
|
this.disabled = false;
|
|
363
426
|
this.fullWidth = false;
|
|
364
427
|
this.iconOnly = false;
|
|
@@ -382,6 +445,12 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
382
445
|
set title(value) {
|
|
383
446
|
super.title = value;
|
|
384
447
|
}
|
|
448
|
+
get autofocus() {
|
|
449
|
+
return super.autofocus;
|
|
450
|
+
}
|
|
451
|
+
set autofocus(value) {
|
|
452
|
+
super.autofocus = value;
|
|
453
|
+
}
|
|
385
454
|
getContentContainer() {
|
|
386
455
|
return this.querySelector("[data-sp-button-native]");
|
|
387
456
|
}
|
|
@@ -393,6 +462,21 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
393
462
|
return el.hasAttribute("data-sp-button-native") || el.hasAttribute("data-sp-button-loading-label") || el.hasAttribute("data-sp-button-label-fallback");
|
|
394
463
|
}
|
|
395
464
|
willUpdate(changedProperties) {
|
|
465
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
466
|
+
this.disabled = false;
|
|
467
|
+
}
|
|
468
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
469
|
+
this.fullWidth = false;
|
|
470
|
+
}
|
|
471
|
+
if (changedProperties.has("iconOnly") && this.iconOnly == null) {
|
|
472
|
+
this.iconOnly = false;
|
|
473
|
+
}
|
|
474
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
475
|
+
this.loading = false;
|
|
476
|
+
}
|
|
477
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
478
|
+
this.pill = false;
|
|
479
|
+
}
|
|
396
480
|
if (changedProperties.has("variant") && (this.variant == null || !isButtonVariant(this.variant))) {
|
|
397
481
|
this.variant = "primary";
|
|
398
482
|
}
|
|
@@ -437,12 +521,18 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
437
521
|
}
|
|
438
522
|
renderButtonContent() {
|
|
439
523
|
if (this.loading) {
|
|
440
|
-
return lit.html`<span
|
|
524
|
+
return lit.html`<span
|
|
525
|
+
class="${spectreUi.getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
526
|
+
data-sp-button-loading-label
|
|
527
|
+
>${this.loadingLabel}</span>`;
|
|
441
528
|
}
|
|
442
529
|
if (this.hasProjectedContent) {
|
|
443
530
|
return this.projectedContent;
|
|
444
531
|
}
|
|
445
|
-
return this.visibleLabelFallback ? lit.html`<span
|
|
532
|
+
return this.visibleLabelFallback ? lit.html`<span
|
|
533
|
+
class="${spectreUi.getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
534
|
+
data-sp-button-label-fallback
|
|
535
|
+
>${this.visibleLabelFallback}</span>` : lit.nothing;
|
|
446
536
|
}
|
|
447
537
|
render() {
|
|
448
538
|
return lit.html`<button
|
|
@@ -466,7 +556,6 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
466
556
|
}
|
|
467
557
|
};
|
|
468
558
|
SpectreButtonElement.properties = {
|
|
469
|
-
autofocus: { type: Boolean, reflect: true },
|
|
470
559
|
disabled: { type: Boolean, reflect: true },
|
|
471
560
|
form: { type: String },
|
|
472
561
|
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
@@ -492,7 +581,6 @@ function defineSpectreButton(tagName = "sp-button") {
|
|
|
492
581
|
var SpectreInputElement = class extends SpectreBaseElement {
|
|
493
582
|
constructor() {
|
|
494
583
|
super(...arguments);
|
|
495
|
-
this.autofocus = false;
|
|
496
584
|
this.disabled = false;
|
|
497
585
|
this.fullWidth = false;
|
|
498
586
|
this.invalid = false;
|
|
@@ -511,6 +599,12 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
511
599
|
set autocapitalize(value) {
|
|
512
600
|
super.autocapitalize = value;
|
|
513
601
|
}
|
|
602
|
+
get autofocus() {
|
|
603
|
+
return super.autofocus;
|
|
604
|
+
}
|
|
605
|
+
set autofocus(value) {
|
|
606
|
+
super.autofocus = value;
|
|
607
|
+
}
|
|
514
608
|
get id() {
|
|
515
609
|
return super.id;
|
|
516
610
|
}
|
|
@@ -530,6 +624,30 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
530
624
|
super.title = value;
|
|
531
625
|
}
|
|
532
626
|
willUpdate(changedProperties) {
|
|
627
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
628
|
+
this.disabled = false;
|
|
629
|
+
}
|
|
630
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
631
|
+
this.fullWidth = false;
|
|
632
|
+
}
|
|
633
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
634
|
+
this.invalid = false;
|
|
635
|
+
}
|
|
636
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
637
|
+
this.loading = false;
|
|
638
|
+
}
|
|
639
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
640
|
+
this.pill = false;
|
|
641
|
+
}
|
|
642
|
+
if (changedProperties.has("readonly") && this.readonly == null) {
|
|
643
|
+
this.readonly = false;
|
|
644
|
+
}
|
|
645
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
646
|
+
this.required = false;
|
|
647
|
+
}
|
|
648
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
649
|
+
this.success = false;
|
|
650
|
+
}
|
|
533
651
|
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
534
652
|
this.size = "md";
|
|
535
653
|
}
|
|
@@ -601,9 +719,7 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
601
719
|
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
602
720
|
pattern="${ifDefined_js.ifDefined(this.pattern || void 0)}"
|
|
603
721
|
placeholder="${ifDefined_js.ifDefined(this.placeholder || void 0)}"
|
|
604
|
-
spellcheck="${ifDefined_js.ifDefined(
|
|
605
|
-
this.spellcheck === void 0 ? void 0 : String(this.spellcheck)
|
|
606
|
-
)}"
|
|
722
|
+
spellcheck="${ifDefined_js.ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
607
723
|
step="${ifDefined_js.ifDefined(this.step || void 0)}"
|
|
608
724
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
609
725
|
type="${this.type}"
|
|
@@ -614,9 +730,7 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
614
730
|
}
|
|
615
731
|
};
|
|
616
732
|
SpectreInputElement.properties = {
|
|
617
|
-
autocapitalize: { type: String, reflect: true },
|
|
618
733
|
autocomplete: { type: String, reflect: true },
|
|
619
|
-
autofocus: { type: Boolean, reflect: true },
|
|
620
734
|
disabled: { type: Boolean, reflect: true },
|
|
621
735
|
enterkeyhint: { type: String, reflect: true },
|
|
622
736
|
form: { type: String },
|
|
@@ -636,7 +750,6 @@ SpectreInputElement.properties = {
|
|
|
636
750
|
readonly: { type: Boolean, reflect: true },
|
|
637
751
|
required: { type: Boolean, reflect: true },
|
|
638
752
|
size: { type: String, reflect: true },
|
|
639
|
-
spellcheck: { type: Boolean, reflect: true },
|
|
640
753
|
step: { type: String, reflect: true },
|
|
641
754
|
success: { type: Boolean, reflect: true },
|
|
642
755
|
type: { type: String, reflect: true },
|
|
@@ -654,7 +767,6 @@ var DEFAULT_ROWS = 2;
|
|
|
654
767
|
var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
655
768
|
constructor() {
|
|
656
769
|
super(...arguments);
|
|
657
|
-
this.autofocus = false;
|
|
658
770
|
this.disabled = false;
|
|
659
771
|
this.fullWidth = false;
|
|
660
772
|
this.invalid = false;
|
|
@@ -673,6 +785,12 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
673
785
|
set autocapitalize(value) {
|
|
674
786
|
super.autocapitalize = value;
|
|
675
787
|
}
|
|
788
|
+
get autofocus() {
|
|
789
|
+
return super.autofocus;
|
|
790
|
+
}
|
|
791
|
+
set autofocus(value) {
|
|
792
|
+
super.autofocus = value;
|
|
793
|
+
}
|
|
676
794
|
get id() {
|
|
677
795
|
return super.id;
|
|
678
796
|
}
|
|
@@ -692,6 +810,30 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
692
810
|
super.title = value;
|
|
693
811
|
}
|
|
694
812
|
willUpdate(changedProperties) {
|
|
813
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
814
|
+
this.disabled = false;
|
|
815
|
+
}
|
|
816
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
817
|
+
this.fullWidth = false;
|
|
818
|
+
}
|
|
819
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
820
|
+
this.invalid = false;
|
|
821
|
+
}
|
|
822
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
823
|
+
this.loading = false;
|
|
824
|
+
}
|
|
825
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
826
|
+
this.pill = false;
|
|
827
|
+
}
|
|
828
|
+
if (changedProperties.has("readonly") && this.readonly == null) {
|
|
829
|
+
this.readonly = false;
|
|
830
|
+
}
|
|
831
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
832
|
+
this.required = false;
|
|
833
|
+
}
|
|
834
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
835
|
+
this.success = false;
|
|
836
|
+
}
|
|
695
837
|
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
696
838
|
this.size = "md";
|
|
697
839
|
}
|
|
@@ -760,9 +902,7 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
760
902
|
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
761
903
|
placeholder="${ifDefined_js.ifDefined(this.placeholder || void 0)}"
|
|
762
904
|
rows="${this.rows}"
|
|
763
|
-
spellcheck="${ifDefined_js.ifDefined(
|
|
764
|
-
this.spellcheck === void 0 ? void 0 : String(this.spellcheck)
|
|
765
|
-
)}"
|
|
905
|
+
spellcheck="${ifDefined_js.ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
766
906
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
767
907
|
.value="${live_js.live(this.value)}"
|
|
768
908
|
@change="${this.handleChange}"
|
|
@@ -771,9 +911,7 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
771
911
|
}
|
|
772
912
|
};
|
|
773
913
|
SpectreTextareaElement.properties = {
|
|
774
|
-
autocapitalize: { type: String, reflect: true },
|
|
775
914
|
autocomplete: { type: String, reflect: true },
|
|
776
|
-
autofocus: { type: Boolean, reflect: true },
|
|
777
915
|
disabled: { type: Boolean, reflect: true },
|
|
778
916
|
enterkeyhint: { type: String, reflect: true },
|
|
779
917
|
form: { type: String },
|
|
@@ -790,7 +928,6 @@ SpectreTextareaElement.properties = {
|
|
|
790
928
|
required: { type: Boolean, reflect: true },
|
|
791
929
|
rows: { type: Number, reflect: true },
|
|
792
930
|
size: { type: String, reflect: true },
|
|
793
|
-
spellcheck: { type: Boolean, reflect: true },
|
|
794
931
|
success: { type: Boolean, reflect: true },
|
|
795
932
|
value: { type: String }
|
|
796
933
|
};
|
|
@@ -805,7 +942,6 @@ function defineSpectreTextarea(tagName = "sp-textarea") {
|
|
|
805
942
|
var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
806
943
|
constructor() {
|
|
807
944
|
super(...arguments);
|
|
808
|
-
this.autofocus = false;
|
|
809
945
|
this.disabled = false;
|
|
810
946
|
this.fullWidth = false;
|
|
811
947
|
this.invalid = false;
|
|
@@ -828,6 +964,24 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
828
964
|
set title(value) {
|
|
829
965
|
super.title = value;
|
|
830
966
|
}
|
|
967
|
+
get autocapitalize() {
|
|
968
|
+
return super.autocapitalize;
|
|
969
|
+
}
|
|
970
|
+
set autocapitalize(value) {
|
|
971
|
+
super.autocapitalize = value;
|
|
972
|
+
}
|
|
973
|
+
get autofocus() {
|
|
974
|
+
return super.autofocus;
|
|
975
|
+
}
|
|
976
|
+
set autofocus(value) {
|
|
977
|
+
super.autofocus = value;
|
|
978
|
+
}
|
|
979
|
+
get spellcheck() {
|
|
980
|
+
return super.spellcheck;
|
|
981
|
+
}
|
|
982
|
+
set spellcheck(value) {
|
|
983
|
+
super.spellcheck = value;
|
|
984
|
+
}
|
|
831
985
|
getContentContainer() {
|
|
832
986
|
return this.querySelector("[data-sp-select-native]");
|
|
833
987
|
}
|
|
@@ -839,6 +993,27 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
839
993
|
return el.hasAttribute("data-sp-select-native");
|
|
840
994
|
}
|
|
841
995
|
willUpdate(changedProperties) {
|
|
996
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
997
|
+
this.disabled = false;
|
|
998
|
+
}
|
|
999
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
1000
|
+
this.fullWidth = false;
|
|
1001
|
+
}
|
|
1002
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
1003
|
+
this.invalid = false;
|
|
1004
|
+
}
|
|
1005
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1006
|
+
this.loading = false;
|
|
1007
|
+
}
|
|
1008
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
1009
|
+
this.pill = false;
|
|
1010
|
+
}
|
|
1011
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
1012
|
+
this.required = false;
|
|
1013
|
+
}
|
|
1014
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
1015
|
+
this.success = false;
|
|
1016
|
+
}
|
|
842
1017
|
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
843
1018
|
this.size = "md";
|
|
844
1019
|
}
|
|
@@ -902,6 +1077,7 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
902
1077
|
aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
|
|
903
1078
|
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
904
1079
|
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1080
|
+
autocapitalize="${ifDefined_js.ifDefined(this.autocapitalize || void 0)}"
|
|
905
1081
|
autocomplete="${ifDefined_js.ifDefined(this.autocomplete || void 0)}"
|
|
906
1082
|
?autofocus="${this.autofocus}"
|
|
907
1083
|
class="${this.selectClasses}"
|
|
@@ -911,6 +1087,7 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
911
1087
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
912
1088
|
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
913
1089
|
?required="${this.required}"
|
|
1090
|
+
spellcheck="${ifDefined_js.ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
914
1091
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
915
1092
|
.value="${live_js.live(this.value)}"
|
|
916
1093
|
@change="${this.handleChange}"
|
|
@@ -922,7 +1099,6 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
922
1099
|
};
|
|
923
1100
|
SpectreSelectElement.properties = {
|
|
924
1101
|
autocomplete: { type: String, reflect: true },
|
|
925
|
-
autofocus: { type: Boolean, reflect: true },
|
|
926
1102
|
disabled: { type: Boolean, reflect: true },
|
|
927
1103
|
form: { type: String },
|
|
928
1104
|
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
@@ -946,7 +1122,6 @@ function defineSpectreSelect(tagName = "sp-select") {
|
|
|
946
1122
|
var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
947
1123
|
constructor() {
|
|
948
1124
|
super(...arguments);
|
|
949
|
-
this.autofocus = false;
|
|
950
1125
|
this.checked = false;
|
|
951
1126
|
this.disabled = false;
|
|
952
1127
|
this.invalid = false;
|
|
@@ -967,6 +1142,12 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
967
1142
|
set title(value) {
|
|
968
1143
|
super.title = value;
|
|
969
1144
|
}
|
|
1145
|
+
get autofocus() {
|
|
1146
|
+
return super.autofocus;
|
|
1147
|
+
}
|
|
1148
|
+
set autofocus(value) {
|
|
1149
|
+
super.autofocus = value;
|
|
1150
|
+
}
|
|
970
1151
|
getContentContainer() {
|
|
971
1152
|
return this.querySelector("[data-sp-checkbox-label]");
|
|
972
1153
|
}
|
|
@@ -978,6 +1159,24 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
978
1159
|
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");
|
|
979
1160
|
}
|
|
980
1161
|
willUpdate(changedProperties) {
|
|
1162
|
+
if (changedProperties.has("checked") && this.checked == null) {
|
|
1163
|
+
this.checked = false;
|
|
1164
|
+
}
|
|
1165
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1166
|
+
this.disabled = false;
|
|
1167
|
+
}
|
|
1168
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
1169
|
+
this.invalid = false;
|
|
1170
|
+
}
|
|
1171
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1172
|
+
this.loading = false;
|
|
1173
|
+
}
|
|
1174
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
1175
|
+
this.required = false;
|
|
1176
|
+
}
|
|
1177
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
1178
|
+
this.success = false;
|
|
1179
|
+
}
|
|
981
1180
|
if (changedProperties.has("value") && this.value == null) {
|
|
982
1181
|
this.value = "on";
|
|
983
1182
|
}
|
|
@@ -1038,7 +1237,6 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1038
1237
|
}
|
|
1039
1238
|
};
|
|
1040
1239
|
SpectreCheckboxElement.properties = {
|
|
1041
|
-
autofocus: { type: Boolean, reflect: true },
|
|
1042
1240
|
checked: { type: Boolean, reflect: true },
|
|
1043
1241
|
disabled: { type: Boolean, reflect: true },
|
|
1044
1242
|
form: { type: String },
|
|
@@ -1061,7 +1259,6 @@ function defineSpectreCheckbox(tagName = "sp-checkbox") {
|
|
|
1061
1259
|
var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
1062
1260
|
constructor() {
|
|
1063
1261
|
super(...arguments);
|
|
1064
|
-
this.autofocus = false;
|
|
1065
1262
|
this.checked = false;
|
|
1066
1263
|
this.disabled = false;
|
|
1067
1264
|
this.invalid = false;
|
|
@@ -1082,6 +1279,12 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1082
1279
|
set title(value) {
|
|
1083
1280
|
super.title = value;
|
|
1084
1281
|
}
|
|
1282
|
+
get autofocus() {
|
|
1283
|
+
return super.autofocus;
|
|
1284
|
+
}
|
|
1285
|
+
set autofocus(value) {
|
|
1286
|
+
super.autofocus = value;
|
|
1287
|
+
}
|
|
1085
1288
|
getContentContainer() {
|
|
1086
1289
|
return this.querySelector("[data-sp-radio-label]");
|
|
1087
1290
|
}
|
|
@@ -1093,6 +1296,24 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1093
1296
|
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");
|
|
1094
1297
|
}
|
|
1095
1298
|
willUpdate(changedProperties) {
|
|
1299
|
+
if (changedProperties.has("checked") && this.checked == null) {
|
|
1300
|
+
this.checked = false;
|
|
1301
|
+
}
|
|
1302
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1303
|
+
this.disabled = false;
|
|
1304
|
+
}
|
|
1305
|
+
if (changedProperties.has("invalid") && this.invalid == null) {
|
|
1306
|
+
this.invalid = false;
|
|
1307
|
+
}
|
|
1308
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1309
|
+
this.loading = false;
|
|
1310
|
+
}
|
|
1311
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
1312
|
+
this.required = false;
|
|
1313
|
+
}
|
|
1314
|
+
if (changedProperties.has("success") && this.success == null) {
|
|
1315
|
+
this.success = false;
|
|
1316
|
+
}
|
|
1096
1317
|
if (changedProperties.has("value") && this.value == null) {
|
|
1097
1318
|
this.value = "on";
|
|
1098
1319
|
}
|
|
@@ -1127,10 +1348,10 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1127
1348
|
}
|
|
1128
1349
|
const root = this.getRootNode();
|
|
1129
1350
|
const radios = root.querySelectorAll(
|
|
1130
|
-
|
|
1351
|
+
"sp-radio"
|
|
1131
1352
|
);
|
|
1132
1353
|
radios.forEach((radio) => {
|
|
1133
|
-
if (radio !== this && radio.checked) {
|
|
1354
|
+
if (radio !== this && radio.name === this.name && radio.checked) {
|
|
1134
1355
|
radio.checked = false;
|
|
1135
1356
|
}
|
|
1136
1357
|
});
|
|
@@ -1173,7 +1394,6 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1173
1394
|
}
|
|
1174
1395
|
};
|
|
1175
1396
|
SpectreRadioElement.properties = {
|
|
1176
|
-
autofocus: { type: Boolean, reflect: true },
|
|
1177
1397
|
checked: { type: Boolean, reflect: true },
|
|
1178
1398
|
disabled: { type: Boolean, reflect: true },
|
|
1179
1399
|
form: { type: String },
|
|
@@ -1198,6 +1418,11 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1198
1418
|
super(...arguments);
|
|
1199
1419
|
this.disabled = false;
|
|
1200
1420
|
}
|
|
1421
|
+
willUpdate(changedProperties) {
|
|
1422
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1423
|
+
this.disabled = false;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1201
1426
|
get isDisabled() {
|
|
1202
1427
|
return this.disabled ?? false;
|
|
1203
1428
|
}
|
|
@@ -1276,6 +1501,24 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1276
1501
|
set title(value) {
|
|
1277
1502
|
super.title = value;
|
|
1278
1503
|
}
|
|
1504
|
+
get autocapitalize() {
|
|
1505
|
+
return super.autocapitalize;
|
|
1506
|
+
}
|
|
1507
|
+
set autocapitalize(value) {
|
|
1508
|
+
super.autocapitalize = value;
|
|
1509
|
+
}
|
|
1510
|
+
get autofocus() {
|
|
1511
|
+
return super.autofocus;
|
|
1512
|
+
}
|
|
1513
|
+
set autofocus(value) {
|
|
1514
|
+
super.autofocus = value;
|
|
1515
|
+
}
|
|
1516
|
+
get spellcheck() {
|
|
1517
|
+
return super.spellcheck;
|
|
1518
|
+
}
|
|
1519
|
+
set spellcheck(value) {
|
|
1520
|
+
super.spellcheck = value;
|
|
1521
|
+
}
|
|
1279
1522
|
get visibleLegend() {
|
|
1280
1523
|
const trimmedLegend = this.legend?.trim();
|
|
1281
1524
|
return trimmedLegend ? trimmedLegend : void 0;
|
|
@@ -1320,11 +1563,14 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1320
1563
|
aria-invalid="${ifDefined_js.ifDefined(this.invalid ? "true" : void 0)}"
|
|
1321
1564
|
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
1322
1565
|
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1566
|
+
autocapitalize="${ifDefined_js.ifDefined(this.autocapitalize || void 0)}"
|
|
1567
|
+
?autofocus="${this.autofocus}"
|
|
1323
1568
|
data-sp-fieldset-native
|
|
1324
1569
|
?disabled="${this.isDisabled}"
|
|
1325
1570
|
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
1326
1571
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1327
1572
|
name="${ifDefined_js.ifDefined(this.name || void 0)}"
|
|
1573
|
+
spellcheck="${ifDefined_js.ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
1328
1574
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1329
1575
|
>
|
|
1330
1576
|
${this.visibleLegend ? lit.html`<legend
|
|
@@ -1352,6 +1598,466 @@ function defineSpectreFieldset(tagName = "sp-fieldset") {
|
|
|
1352
1598
|
customElements.define(tagName, SpectreFieldsetElement);
|
|
1353
1599
|
return SpectreFieldsetElement;
|
|
1354
1600
|
}
|
|
1601
|
+
var SpectreBadgeElement = class extends SpectreProjectableElement {
|
|
1602
|
+
constructor() {
|
|
1603
|
+
super(...arguments);
|
|
1604
|
+
this.disabled = false;
|
|
1605
|
+
this.fullWidth = false;
|
|
1606
|
+
this.loading = false;
|
|
1607
|
+
this.size = "md";
|
|
1608
|
+
this.variant = "primary";
|
|
1609
|
+
}
|
|
1610
|
+
get id() {
|
|
1611
|
+
return super.id;
|
|
1612
|
+
}
|
|
1613
|
+
set id(value) {
|
|
1614
|
+
super.id = value;
|
|
1615
|
+
}
|
|
1616
|
+
get title() {
|
|
1617
|
+
return super.title;
|
|
1618
|
+
}
|
|
1619
|
+
set title(value) {
|
|
1620
|
+
super.title = value;
|
|
1621
|
+
}
|
|
1622
|
+
getContentContainer() {
|
|
1623
|
+
return this.querySelector("[data-sp-badge-native]");
|
|
1624
|
+
}
|
|
1625
|
+
isInternalNode(node) {
|
|
1626
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
1627
|
+
return false;
|
|
1628
|
+
}
|
|
1629
|
+
const el = node;
|
|
1630
|
+
return el.hasAttribute("data-sp-badge-native");
|
|
1631
|
+
}
|
|
1632
|
+
willUpdate(changedProperties) {
|
|
1633
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1634
|
+
this.disabled = false;
|
|
1635
|
+
}
|
|
1636
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
1637
|
+
this.fullWidth = false;
|
|
1638
|
+
}
|
|
1639
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1640
|
+
this.loading = false;
|
|
1641
|
+
}
|
|
1642
|
+
if (changedProperties.has("variant") && (this.variant == null || !isBadgeVariant(this.variant))) {
|
|
1643
|
+
this.variant = "primary";
|
|
1644
|
+
}
|
|
1645
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
1646
|
+
this.size = "md";
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
get badgeClasses() {
|
|
1650
|
+
return spectreUi.getBadgeClasses({
|
|
1651
|
+
disabled: this.disabled ?? false,
|
|
1652
|
+
fullWidth: this.fullWidth ?? false,
|
|
1653
|
+
loading: this.loading ?? false,
|
|
1654
|
+
size: this.size,
|
|
1655
|
+
variant: this.variant
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
render() {
|
|
1659
|
+
return lit.html`<span
|
|
1660
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1661
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
1662
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1663
|
+
class="${this.badgeClasses}"
|
|
1664
|
+
data-sp-badge-native
|
|
1665
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1666
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1667
|
+
>
|
|
1668
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
1669
|
+
</span>`;
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
SpectreBadgeElement.properties = {
|
|
1673
|
+
disabled: { type: Boolean, reflect: true },
|
|
1674
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
1675
|
+
loading: { type: Boolean, reflect: true },
|
|
1676
|
+
size: { type: String, reflect: true },
|
|
1677
|
+
variant: { type: String, reflect: true }
|
|
1678
|
+
};
|
|
1679
|
+
function defineSpectreBadge(tagName = "sp-badge") {
|
|
1680
|
+
const existingElement = customElements.get(tagName);
|
|
1681
|
+
if (existingElement) {
|
|
1682
|
+
return existingElement;
|
|
1683
|
+
}
|
|
1684
|
+
customElements.define(tagName, SpectreBadgeElement);
|
|
1685
|
+
return SpectreBadgeElement;
|
|
1686
|
+
}
|
|
1687
|
+
var SpectreCardElement = class extends SpectreProjectableElement {
|
|
1688
|
+
constructor() {
|
|
1689
|
+
super(...arguments);
|
|
1690
|
+
this.disabled = false;
|
|
1691
|
+
this.fullHeight = false;
|
|
1692
|
+
this.interactive = false;
|
|
1693
|
+
this.loading = false;
|
|
1694
|
+
this.padded = true;
|
|
1695
|
+
this.variant = "elevated";
|
|
1696
|
+
}
|
|
1697
|
+
get id() {
|
|
1698
|
+
return super.id;
|
|
1699
|
+
}
|
|
1700
|
+
set id(value) {
|
|
1701
|
+
super.id = value;
|
|
1702
|
+
}
|
|
1703
|
+
get title() {
|
|
1704
|
+
return super.title;
|
|
1705
|
+
}
|
|
1706
|
+
set title(value) {
|
|
1707
|
+
super.title = value;
|
|
1708
|
+
}
|
|
1709
|
+
getContentContainer() {
|
|
1710
|
+
return this.querySelector("[data-sp-card-native]");
|
|
1711
|
+
}
|
|
1712
|
+
isInternalNode(node) {
|
|
1713
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
1714
|
+
return false;
|
|
1715
|
+
}
|
|
1716
|
+
const el = node;
|
|
1717
|
+
return el.hasAttribute("data-sp-card-native");
|
|
1718
|
+
}
|
|
1719
|
+
willUpdate(changedProperties) {
|
|
1720
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1721
|
+
this.disabled = false;
|
|
1722
|
+
}
|
|
1723
|
+
if (changedProperties.has("fullHeight") && this.fullHeight == null) {
|
|
1724
|
+
this.fullHeight = false;
|
|
1725
|
+
}
|
|
1726
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
1727
|
+
this.interactive = false;
|
|
1728
|
+
}
|
|
1729
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1730
|
+
this.loading = false;
|
|
1731
|
+
}
|
|
1732
|
+
if (changedProperties.has("padded") && this.padded == null) {
|
|
1733
|
+
this.padded = true;
|
|
1734
|
+
}
|
|
1735
|
+
if (changedProperties.has("variant") && (this.variant == null || !isCardVariant(this.variant))) {
|
|
1736
|
+
this.variant = "elevated";
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
get cardClasses() {
|
|
1740
|
+
return spectreUi.getCardClasses({
|
|
1741
|
+
disabled: this.disabled ?? false,
|
|
1742
|
+
fullHeight: this.fullHeight ?? false,
|
|
1743
|
+
interactive: this.interactive ?? false,
|
|
1744
|
+
loading: this.loading ?? false,
|
|
1745
|
+
padded: this.padded ?? true,
|
|
1746
|
+
variant: this.variant
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
render() {
|
|
1750
|
+
return lit.html`<div
|
|
1751
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1752
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
1753
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1754
|
+
class="${this.cardClasses}"
|
|
1755
|
+
data-sp-card-native
|
|
1756
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1757
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1758
|
+
>
|
|
1759
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
1760
|
+
</div>`;
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
SpectreCardElement.properties = {
|
|
1764
|
+
disabled: { type: Boolean, reflect: true },
|
|
1765
|
+
fullHeight: { attribute: "full-height", type: Boolean, reflect: true },
|
|
1766
|
+
interactive: { type: Boolean, reflect: true },
|
|
1767
|
+
loading: { type: Boolean, reflect: true },
|
|
1768
|
+
padded: { type: Boolean, reflect: true },
|
|
1769
|
+
variant: { type: String, reflect: true }
|
|
1770
|
+
};
|
|
1771
|
+
function defineSpectreCard(tagName = "sp-card") {
|
|
1772
|
+
const existingElement = customElements.get(tagName);
|
|
1773
|
+
if (existingElement) {
|
|
1774
|
+
return existingElement;
|
|
1775
|
+
}
|
|
1776
|
+
customElements.define(tagName, SpectreCardElement);
|
|
1777
|
+
return SpectreCardElement;
|
|
1778
|
+
}
|
|
1779
|
+
var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
1780
|
+
constructor() {
|
|
1781
|
+
super(...arguments);
|
|
1782
|
+
this.disabled = false;
|
|
1783
|
+
this.fullWidth = false;
|
|
1784
|
+
this.interactive = false;
|
|
1785
|
+
this.loading = false;
|
|
1786
|
+
this.pill = false;
|
|
1787
|
+
this.size = "md";
|
|
1788
|
+
this.variant = "primary";
|
|
1789
|
+
}
|
|
1790
|
+
get id() {
|
|
1791
|
+
return super.id;
|
|
1792
|
+
}
|
|
1793
|
+
set id(value) {
|
|
1794
|
+
super.id = value;
|
|
1795
|
+
}
|
|
1796
|
+
get title() {
|
|
1797
|
+
return super.title;
|
|
1798
|
+
}
|
|
1799
|
+
set title(value) {
|
|
1800
|
+
super.title = value;
|
|
1801
|
+
}
|
|
1802
|
+
getContentContainer() {
|
|
1803
|
+
return this.querySelector("[data-sp-icon-box-native]");
|
|
1804
|
+
}
|
|
1805
|
+
isInternalNode(node) {
|
|
1806
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
1807
|
+
return false;
|
|
1808
|
+
}
|
|
1809
|
+
const el = node;
|
|
1810
|
+
return el.hasAttribute("data-sp-icon-box-native");
|
|
1811
|
+
}
|
|
1812
|
+
willUpdate(changedProperties) {
|
|
1813
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1814
|
+
this.disabled = false;
|
|
1815
|
+
}
|
|
1816
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
1817
|
+
this.fullWidth = false;
|
|
1818
|
+
}
|
|
1819
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
1820
|
+
this.interactive = false;
|
|
1821
|
+
}
|
|
1822
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1823
|
+
this.loading = false;
|
|
1824
|
+
}
|
|
1825
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
1826
|
+
this.pill = false;
|
|
1827
|
+
}
|
|
1828
|
+
if (changedProperties.has("variant") && (this.variant == null || !isIconBoxVariant(this.variant))) {
|
|
1829
|
+
this.variant = "primary";
|
|
1830
|
+
}
|
|
1831
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
1832
|
+
this.size = "md";
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
get iconBoxClasses() {
|
|
1836
|
+
return spectreUi.getIconBoxClasses({
|
|
1837
|
+
disabled: this.disabled ?? false,
|
|
1838
|
+
fullWidth: this.fullWidth ?? false,
|
|
1839
|
+
interactive: this.interactive ?? false,
|
|
1840
|
+
loading: this.loading ?? false,
|
|
1841
|
+
pill: this.pill ?? false,
|
|
1842
|
+
size: this.size,
|
|
1843
|
+
variant: this.variant
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
render() {
|
|
1847
|
+
return lit.html`<div
|
|
1848
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1849
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
1850
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1851
|
+
class="${this.iconBoxClasses}"
|
|
1852
|
+
data-sp-icon-box-native
|
|
1853
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1854
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1855
|
+
>
|
|
1856
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
1857
|
+
</div>`;
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
SpectreIconBoxElement.properties = {
|
|
1861
|
+
disabled: { type: Boolean, reflect: true },
|
|
1862
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
1863
|
+
interactive: { type: Boolean, reflect: true },
|
|
1864
|
+
loading: { type: Boolean, reflect: true },
|
|
1865
|
+
pill: { type: Boolean, reflect: true },
|
|
1866
|
+
size: { type: String, reflect: true },
|
|
1867
|
+
variant: { type: String, reflect: true }
|
|
1868
|
+
};
|
|
1869
|
+
function defineSpectreIconBox(tagName = "sp-icon-box") {
|
|
1870
|
+
const existingElement = customElements.get(tagName);
|
|
1871
|
+
if (existingElement) {
|
|
1872
|
+
return existingElement;
|
|
1873
|
+
}
|
|
1874
|
+
customElements.define(tagName, SpectreIconBoxElement);
|
|
1875
|
+
return SpectreIconBoxElement;
|
|
1876
|
+
}
|
|
1877
|
+
var SpectreRatingElement = class extends SpectreBaseElement {
|
|
1878
|
+
constructor() {
|
|
1879
|
+
super(...arguments);
|
|
1880
|
+
this.disabled = false;
|
|
1881
|
+
this.loading = false;
|
|
1882
|
+
this.max = 5;
|
|
1883
|
+
this.size = "md";
|
|
1884
|
+
this.value = 0;
|
|
1885
|
+
}
|
|
1886
|
+
get id() {
|
|
1887
|
+
return super.id;
|
|
1888
|
+
}
|
|
1889
|
+
set id(value) {
|
|
1890
|
+
super.id = value;
|
|
1891
|
+
}
|
|
1892
|
+
get title() {
|
|
1893
|
+
return super.title;
|
|
1894
|
+
}
|
|
1895
|
+
set title(value) {
|
|
1896
|
+
super.title = value;
|
|
1897
|
+
}
|
|
1898
|
+
willUpdate(changedProperties) {
|
|
1899
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1900
|
+
this.disabled = false;
|
|
1901
|
+
}
|
|
1902
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1903
|
+
this.loading = false;
|
|
1904
|
+
}
|
|
1905
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
1906
|
+
this.size = "md";
|
|
1907
|
+
}
|
|
1908
|
+
if (changedProperties.has("max")) {
|
|
1909
|
+
this.max = normalizeInt(this.max, 5, 1) ?? 5;
|
|
1910
|
+
}
|
|
1911
|
+
if (changedProperties.has("value")) {
|
|
1912
|
+
const safeMax = this.max ?? 5;
|
|
1913
|
+
const normalized = normalizeInt(this.value, 0, 0);
|
|
1914
|
+
this.value = normalized == null ? 0 : Math.min(normalized, safeMax);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
get ratingClasses() {
|
|
1918
|
+
return spectreUi.getRatingClasses({
|
|
1919
|
+
disabled: this.disabled ?? false,
|
|
1920
|
+
loading: this.loading ?? false,
|
|
1921
|
+
size: this.size
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
get effectiveMax() {
|
|
1925
|
+
return this.max ?? 5;
|
|
1926
|
+
}
|
|
1927
|
+
get effectiveValue() {
|
|
1928
|
+
return this.value ?? 0;
|
|
1929
|
+
}
|
|
1930
|
+
get computedAriaLabel() {
|
|
1931
|
+
const base = this.forwardedAriaLabel;
|
|
1932
|
+
if (base) return base;
|
|
1933
|
+
return `Rating: ${this.effectiveValue} out of ${this.effectiveMax}`;
|
|
1934
|
+
}
|
|
1935
|
+
renderStars() {
|
|
1936
|
+
const stars = [];
|
|
1937
|
+
for (let i = 1; i <= this.effectiveMax; i++) {
|
|
1938
|
+
stars.push(lit.html`<span class="${spectreUi.getRatingStarClasses(i <= this.effectiveValue)}"></span>`);
|
|
1939
|
+
}
|
|
1940
|
+
return stars;
|
|
1941
|
+
}
|
|
1942
|
+
render() {
|
|
1943
|
+
const trimmedLabel = this.label?.trim();
|
|
1944
|
+
return lit.html`<div
|
|
1945
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1946
|
+
aria-label="${this.computedAriaLabel}"
|
|
1947
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1948
|
+
class="${this.ratingClasses}"
|
|
1949
|
+
data-sp-rating-native
|
|
1950
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1951
|
+
role="img"
|
|
1952
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1953
|
+
>
|
|
1954
|
+
<div class="${spectreUi.getRatingStarsClasses()}">${this.renderStars()}</div>
|
|
1955
|
+
${trimmedLabel ? lit.html`<span class="${spectreUi.getRatingTextClasses({ disabled: this.disabled ?? false })}">${trimmedLabel}</span>` : lit.nothing}
|
|
1956
|
+
</div>`;
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
SpectreRatingElement.properties = {
|
|
1960
|
+
disabled: { type: Boolean, reflect: true },
|
|
1961
|
+
label: { type: String, reflect: true },
|
|
1962
|
+
loading: { type: Boolean, reflect: true },
|
|
1963
|
+
max: { type: Number, reflect: true },
|
|
1964
|
+
size: { type: String, reflect: true },
|
|
1965
|
+
value: { type: Number, reflect: true }
|
|
1966
|
+
};
|
|
1967
|
+
function defineSpectreRating(tagName = "sp-rating") {
|
|
1968
|
+
const existingElement = customElements.get(tagName);
|
|
1969
|
+
if (existingElement) {
|
|
1970
|
+
return existingElement;
|
|
1971
|
+
}
|
|
1972
|
+
customElements.define(tagName, SpectreRatingElement);
|
|
1973
|
+
return SpectreRatingElement;
|
|
1974
|
+
}
|
|
1975
|
+
var SpectreTestimonialElement = class extends SpectreProjectableElement {
|
|
1976
|
+
constructor() {
|
|
1977
|
+
super(...arguments);
|
|
1978
|
+
this.disabled = false;
|
|
1979
|
+
this.fullHeight = false;
|
|
1980
|
+
this.interactive = false;
|
|
1981
|
+
this.loading = false;
|
|
1982
|
+
this.variant = "elevated";
|
|
1983
|
+
}
|
|
1984
|
+
get id() {
|
|
1985
|
+
return super.id;
|
|
1986
|
+
}
|
|
1987
|
+
set id(value) {
|
|
1988
|
+
super.id = value;
|
|
1989
|
+
}
|
|
1990
|
+
get title() {
|
|
1991
|
+
return super.title;
|
|
1992
|
+
}
|
|
1993
|
+
set title(value) {
|
|
1994
|
+
super.title = value;
|
|
1995
|
+
}
|
|
1996
|
+
getContentContainer() {
|
|
1997
|
+
return this.querySelector("[data-sp-testimonial-native]");
|
|
1998
|
+
}
|
|
1999
|
+
isInternalNode(node) {
|
|
2000
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2001
|
+
return false;
|
|
2002
|
+
}
|
|
2003
|
+
const el = node;
|
|
2004
|
+
return el.hasAttribute("data-sp-testimonial-native");
|
|
2005
|
+
}
|
|
2006
|
+
willUpdate(changedProperties) {
|
|
2007
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2008
|
+
this.disabled = false;
|
|
2009
|
+
}
|
|
2010
|
+
if (changedProperties.has("fullHeight") && this.fullHeight == null) {
|
|
2011
|
+
this.fullHeight = false;
|
|
2012
|
+
}
|
|
2013
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2014
|
+
this.interactive = false;
|
|
2015
|
+
}
|
|
2016
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2017
|
+
this.loading = false;
|
|
2018
|
+
}
|
|
2019
|
+
if (changedProperties.has("variant") && (this.variant == null || !isTestimonialVariant(this.variant))) {
|
|
2020
|
+
this.variant = "elevated";
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
get testimonialClasses() {
|
|
2024
|
+
return spectreUi.getTestimonialClasses({
|
|
2025
|
+
disabled: this.disabled ?? false,
|
|
2026
|
+
fullHeight: this.fullHeight ?? false,
|
|
2027
|
+
interactive: this.interactive ?? false,
|
|
2028
|
+
loading: this.loading ?? false,
|
|
2029
|
+
variant: this.variant
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
render() {
|
|
2033
|
+
return lit.html`<div
|
|
2034
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2035
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
2036
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2037
|
+
class="${this.testimonialClasses}"
|
|
2038
|
+
data-sp-testimonial-native
|
|
2039
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2040
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2041
|
+
>
|
|
2042
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
2043
|
+
</div>`;
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
SpectreTestimonialElement.properties = {
|
|
2047
|
+
disabled: { type: Boolean, reflect: true },
|
|
2048
|
+
fullHeight: { attribute: "full-height", type: Boolean, reflect: true },
|
|
2049
|
+
interactive: { type: Boolean, reflect: true },
|
|
2050
|
+
loading: { type: Boolean, reflect: true },
|
|
2051
|
+
variant: { type: String, reflect: true }
|
|
2052
|
+
};
|
|
2053
|
+
function defineSpectreTestimonial(tagName = "sp-testimonial") {
|
|
2054
|
+
const existingElement = customElements.get(tagName);
|
|
2055
|
+
if (existingElement) {
|
|
2056
|
+
return existingElement;
|
|
2057
|
+
}
|
|
2058
|
+
customElements.define(tagName, SpectreTestimonialElement);
|
|
2059
|
+
return SpectreTestimonialElement;
|
|
2060
|
+
}
|
|
1355
2061
|
|
|
1356
2062
|
// src/index.ts
|
|
1357
2063
|
function defineSpectreComponents() {
|
|
@@ -1363,29 +2069,51 @@ function defineSpectreComponents() {
|
|
|
1363
2069
|
defineSpectreRadio();
|
|
1364
2070
|
defineSpectreLabel();
|
|
1365
2071
|
defineSpectreFieldset();
|
|
2072
|
+
defineSpectreBadge();
|
|
2073
|
+
defineSpectreCard();
|
|
2074
|
+
defineSpectreIconBox();
|
|
2075
|
+
defineSpectreRating();
|
|
2076
|
+
defineSpectreTestimonial();
|
|
1366
2077
|
}
|
|
1367
2078
|
|
|
2079
|
+
exports.SpectreBadgeElement = SpectreBadgeElement;
|
|
1368
2080
|
exports.SpectreButtonElement = SpectreButtonElement;
|
|
2081
|
+
exports.SpectreCardElement = SpectreCardElement;
|
|
1369
2082
|
exports.SpectreCheckboxElement = SpectreCheckboxElement;
|
|
1370
2083
|
exports.SpectreFieldsetElement = SpectreFieldsetElement;
|
|
2084
|
+
exports.SpectreIconBoxElement = SpectreIconBoxElement;
|
|
1371
2085
|
exports.SpectreInputElement = SpectreInputElement;
|
|
1372
2086
|
exports.SpectreLabelElement = SpectreLabelElement;
|
|
1373
2087
|
exports.SpectreRadioElement = SpectreRadioElement;
|
|
2088
|
+
exports.SpectreRatingElement = SpectreRatingElement;
|
|
1374
2089
|
exports.SpectreSelectElement = SpectreSelectElement;
|
|
2090
|
+
exports.SpectreTestimonialElement = SpectreTestimonialElement;
|
|
1375
2091
|
exports.SpectreTextareaElement = SpectreTextareaElement;
|
|
2092
|
+
exports.defineSpectreBadge = defineSpectreBadge;
|
|
1376
2093
|
exports.defineSpectreButton = defineSpectreButton;
|
|
2094
|
+
exports.defineSpectreCard = defineSpectreCard;
|
|
1377
2095
|
exports.defineSpectreCheckbox = defineSpectreCheckbox;
|
|
1378
2096
|
exports.defineSpectreComponents = defineSpectreComponents;
|
|
1379
2097
|
exports.defineSpectreFieldset = defineSpectreFieldset;
|
|
2098
|
+
exports.defineSpectreIconBox = defineSpectreIconBox;
|
|
1380
2099
|
exports.defineSpectreInput = defineSpectreInput;
|
|
1381
2100
|
exports.defineSpectreLabel = defineSpectreLabel;
|
|
1382
2101
|
exports.defineSpectreRadio = defineSpectreRadio;
|
|
2102
|
+
exports.defineSpectreRating = defineSpectreRating;
|
|
1383
2103
|
exports.defineSpectreSelect = defineSpectreSelect;
|
|
2104
|
+
exports.defineSpectreTestimonial = defineSpectreTestimonial;
|
|
1384
2105
|
exports.defineSpectreTextarea = defineSpectreTextarea;
|
|
2106
|
+
exports.spectreBadgeSizes = spectreInputSizes;
|
|
2107
|
+
exports.spectreBadgeVariants = spectreBadgeVariants;
|
|
1385
2108
|
exports.spectreButtonSizes = spectreInputSizes;
|
|
1386
2109
|
exports.spectreButtonTypes = spectreButtonTypes;
|
|
1387
2110
|
exports.spectreButtonVariants = spectreButtonVariants;
|
|
2111
|
+
exports.spectreCardVariants = spectreCardVariants;
|
|
2112
|
+
exports.spectreIconBoxSizes = spectreInputSizes;
|
|
2113
|
+
exports.spectreIconBoxVariants = spectreIconBoxVariants;
|
|
1388
2114
|
exports.spectreInputSizes = spectreInputSizes;
|
|
1389
2115
|
exports.spectreInputTypes = spectreInputTypes;
|
|
2116
|
+
exports.spectreRatingSizes = spectreInputSizes;
|
|
2117
|
+
exports.spectreTestimonialVariants = spectreTestimonialVariants;
|
|
1390
2118
|
//# sourceMappingURL=index.cjs.map
|
|
1391
2119
|
//# sourceMappingURL=index.cjs.map
|