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