@phcdevworks/spectre-components 1.3.0 → 1.5.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 +504 -202
- package/dist/alert.cjs +455 -0
- package/dist/alert.cjs.map +1 -0
- package/dist/alert.d.cts +68 -0
- package/dist/alert.d.ts +68 -0
- package/dist/alert.js +450 -0
- package/dist/alert.js.map +1 -0
- package/dist/avatar.cjs +454 -0
- package/dist/avatar.cjs.map +1 -0
- package/dist/avatar.d.cts +74 -0
- package/dist/avatar.d.ts +74 -0
- package/dist/avatar.js +449 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.cjs +454 -0
- package/dist/badge.cjs.map +1 -0
- package/dist/badge.d.cts +62 -0
- package/dist/badge.d.ts +62 -0
- package/dist/badge.js +449 -0
- package/dist/badge.js.map +1 -0
- package/dist/button.cjs.map +1 -1
- package/dist/button.d.cts +2 -2
- package/dist/button.d.ts +2 -2
- package/dist/button.js.map +1 -1
- package/dist/card.cjs +448 -0
- package/dist/card.cjs.map +1 -0
- package/dist/card.d.cts +68 -0
- package/dist/card.d.ts +68 -0
- package/dist/card.js +444 -0
- package/dist/card.js.map +1 -0
- package/dist/fieldset.cjs +14 -0
- package/dist/fieldset.cjs.map +1 -1
- package/dist/fieldset.d.cts +6 -0
- package/dist/fieldset.d.ts +6 -0
- package/dist/fieldset.js +14 -0
- package/dist/fieldset.js.map +1 -1
- package/dist/form-BumNzIay.d.cts +28 -0
- package/dist/form-BumNzIay.d.ts +28 -0
- package/dist/icon-box.cjs +466 -0
- package/dist/icon-box.cjs.map +1 -0
- package/dist/icon-box.d.cts +74 -0
- package/dist/icon-box.d.ts +74 -0
- package/dist/icon-box.js +461 -0
- package/dist/icon-box.js.map +1 -0
- package/dist/index.cjs +1123 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +1090 -2
- package/dist/index.js.map +1 -1
- package/dist/input.cjs.map +1 -1
- package/dist/input.d.cts +2 -2
- package/dist/input.d.ts +2 -2
- package/dist/input.js.map +1 -1
- package/dist/pricing-card.cjs +432 -0
- package/dist/pricing-card.cjs.map +1 -0
- package/dist/pricing-card.d.cts +60 -0
- package/dist/pricing-card.d.ts +60 -0
- package/dist/pricing-card.js +429 -0
- package/dist/pricing-card.js.map +1 -0
- package/dist/rating.cjs +377 -0
- package/dist/rating.cjs.map +1 -0
- package/dist/rating.d.cts +68 -0
- package/dist/rating.d.ts +68 -0
- package/dist/rating.js +373 -0
- package/dist/rating.js.map +1 -0
- package/dist/select.cjs +14 -0
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +7 -1
- package/dist/select.d.ts +7 -1
- package/dist/select.js +14 -0
- package/dist/select.js.map +1 -1
- package/dist/spinner.cjs +356 -0
- package/dist/spinner.cjs.map +1 -0
- package/dist/spinner.d.cts +52 -0
- package/dist/spinner.d.ts +52 -0
- package/dist/spinner.js +351 -0
- package/dist/spinner.js.map +1 -0
- package/dist/tag.cjs +473 -0
- package/dist/tag.cjs.map +1 -0
- package/dist/tag.d.cts +80 -0
- package/dist/tag.d.ts +80 -0
- package/dist/tag.js +468 -0
- package/dist/tag.js.map +1 -0
- package/dist/testimonial.cjs +444 -0
- package/dist/testimonial.cjs.map +1 -0
- package/dist/testimonial.d.cts +62 -0
- package/dist/testimonial.d.ts +62 -0
- package/dist/testimonial.js +440 -0
- package/dist/testimonial.js.map +1 -0
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.d.cts +1 -1
- package/dist/textarea.d.ts +1 -1
- package/dist/textarea.js.map +1 -1
- package/package.json +68 -13
- package/dist/form-yR_u97J-.d.cts +0 -10
- package/dist/form-yR_u97J-.d.ts +0 -10
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getButtonClasses, getInputLabelClasses, getInputClasses } from '@phcdevworks/spectre-ui';
|
|
1
|
+
import { getButtonClasses, getInputLabelClasses, getInputClasses, getBadgeClasses, getCardClasses, getIconBoxClasses, getRatingClasses, getRatingStarClasses, getRatingStarsClasses, getRatingTextClasses, getTestimonialClasses, getAlertClasses, getAvatarClasses, getSpinnerClasses, getTagClasses, getPricingCardClasses } 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,107 @@ 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 spectreAlertVariants = [
|
|
61
|
+
"info",
|
|
62
|
+
"success",
|
|
63
|
+
"warning",
|
|
64
|
+
"danger",
|
|
65
|
+
"neutral"
|
|
66
|
+
];
|
|
67
|
+
function isAlertVariant(value) {
|
|
68
|
+
return spectreAlertVariants.includes(value);
|
|
69
|
+
}
|
|
70
|
+
var spectreCardVariants = [
|
|
71
|
+
"elevated",
|
|
72
|
+
"flat",
|
|
73
|
+
"outline",
|
|
74
|
+
"ghost"
|
|
75
|
+
];
|
|
76
|
+
function isCardVariant(value) {
|
|
77
|
+
return spectreCardVariants.includes(value);
|
|
78
|
+
}
|
|
79
|
+
var spectreIconBoxVariants = [
|
|
80
|
+
"primary",
|
|
81
|
+
"secondary",
|
|
82
|
+
"success",
|
|
83
|
+
"warning",
|
|
84
|
+
"danger",
|
|
85
|
+
"info",
|
|
86
|
+
"neutral",
|
|
87
|
+
"ghost",
|
|
88
|
+
"accent",
|
|
89
|
+
"cta",
|
|
90
|
+
"outline"
|
|
91
|
+
];
|
|
92
|
+
function isIconBoxVariant(value) {
|
|
93
|
+
return spectreIconBoxVariants.includes(value);
|
|
94
|
+
}
|
|
95
|
+
var spectreTestimonialVariants = [
|
|
96
|
+
"elevated",
|
|
97
|
+
"flat",
|
|
98
|
+
"outline",
|
|
99
|
+
"ghost"
|
|
100
|
+
];
|
|
101
|
+
function isTestimonialVariant(value) {
|
|
102
|
+
return spectreTestimonialVariants.includes(
|
|
103
|
+
value
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
var spectreSpinnerVariants = [
|
|
107
|
+
"primary",
|
|
108
|
+
"secondary",
|
|
109
|
+
"success",
|
|
110
|
+
"warning",
|
|
111
|
+
"danger",
|
|
112
|
+
"info",
|
|
113
|
+
"neutral",
|
|
114
|
+
"accent",
|
|
115
|
+
"cta"
|
|
116
|
+
];
|
|
117
|
+
function isSpinnerVariant(value) {
|
|
118
|
+
return spectreSpinnerVariants.includes(value);
|
|
119
|
+
}
|
|
120
|
+
var spectreTagVariants = [
|
|
121
|
+
"default",
|
|
122
|
+
"primary",
|
|
123
|
+
"secondary",
|
|
124
|
+
"success",
|
|
125
|
+
"warning",
|
|
126
|
+
"danger",
|
|
127
|
+
"info",
|
|
128
|
+
"neutral",
|
|
129
|
+
"accent",
|
|
130
|
+
"cta",
|
|
131
|
+
"outline",
|
|
132
|
+
"ghost"
|
|
133
|
+
];
|
|
134
|
+
function isTagVariant(value) {
|
|
135
|
+
return spectreTagVariants.includes(value);
|
|
136
|
+
}
|
|
137
|
+
var spectreAvatarSizes = ["xs", "sm", "md", "lg", "xl"];
|
|
138
|
+
function isAvatarSize(value) {
|
|
139
|
+
return spectreAvatarSizes.includes(value);
|
|
140
|
+
}
|
|
141
|
+
var spectreAvatarShapes = ["circle", "square"];
|
|
142
|
+
function isAvatarShape(value) {
|
|
143
|
+
return spectreAvatarShapes.includes(value);
|
|
144
|
+
}
|
|
44
145
|
function normalizeInt(value, fallback, min = 0) {
|
|
45
146
|
if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
|
|
46
147
|
return fallback;
|
|
@@ -922,12 +1023,24 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
922
1023
|
set title(value) {
|
|
923
1024
|
super.title = value;
|
|
924
1025
|
}
|
|
1026
|
+
get autocapitalize() {
|
|
1027
|
+
return super.autocapitalize;
|
|
1028
|
+
}
|
|
1029
|
+
set autocapitalize(value) {
|
|
1030
|
+
super.autocapitalize = value;
|
|
1031
|
+
}
|
|
925
1032
|
get autofocus() {
|
|
926
1033
|
return super.autofocus;
|
|
927
1034
|
}
|
|
928
1035
|
set autofocus(value) {
|
|
929
1036
|
super.autofocus = value;
|
|
930
1037
|
}
|
|
1038
|
+
get spellcheck() {
|
|
1039
|
+
return super.spellcheck;
|
|
1040
|
+
}
|
|
1041
|
+
set spellcheck(value) {
|
|
1042
|
+
super.spellcheck = value;
|
|
1043
|
+
}
|
|
931
1044
|
getContentContainer() {
|
|
932
1045
|
return this.querySelector("[data-sp-select-native]");
|
|
933
1046
|
}
|
|
@@ -1023,6 +1136,7 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
1023
1136
|
aria-invalid="${ifDefined(this.invalid ? "true" : void 0)}"
|
|
1024
1137
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1025
1138
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1139
|
+
autocapitalize="${ifDefined(this.autocapitalize || void 0)}"
|
|
1026
1140
|
autocomplete="${ifDefined(this.autocomplete || void 0)}"
|
|
1027
1141
|
?autofocus="${this.autofocus}"
|
|
1028
1142
|
class="${this.selectClasses}"
|
|
@@ -1032,6 +1146,7 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
1032
1146
|
id="${ifDefined(this.id || void 0)}"
|
|
1033
1147
|
name="${ifDefined(this.name || void 0)}"
|
|
1034
1148
|
?required="${this.required}"
|
|
1149
|
+
spellcheck="${ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
1035
1150
|
title="${ifDefined(this.title || void 0)}"
|
|
1036
1151
|
.value="${live(this.value)}"
|
|
1037
1152
|
@change="${this.handleChange}"
|
|
@@ -1445,12 +1560,24 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1445
1560
|
set title(value) {
|
|
1446
1561
|
super.title = value;
|
|
1447
1562
|
}
|
|
1563
|
+
get autocapitalize() {
|
|
1564
|
+
return super.autocapitalize;
|
|
1565
|
+
}
|
|
1566
|
+
set autocapitalize(value) {
|
|
1567
|
+
super.autocapitalize = value;
|
|
1568
|
+
}
|
|
1448
1569
|
get autofocus() {
|
|
1449
1570
|
return super.autofocus;
|
|
1450
1571
|
}
|
|
1451
1572
|
set autofocus(value) {
|
|
1452
1573
|
super.autofocus = value;
|
|
1453
1574
|
}
|
|
1575
|
+
get spellcheck() {
|
|
1576
|
+
return super.spellcheck;
|
|
1577
|
+
}
|
|
1578
|
+
set spellcheck(value) {
|
|
1579
|
+
super.spellcheck = value;
|
|
1580
|
+
}
|
|
1454
1581
|
get visibleLegend() {
|
|
1455
1582
|
const trimmedLegend = this.legend?.trim();
|
|
1456
1583
|
return trimmedLegend ? trimmedLegend : void 0;
|
|
@@ -1495,12 +1622,14 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1495
1622
|
aria-invalid="${ifDefined(this.invalid ? "true" : void 0)}"
|
|
1496
1623
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1497
1624
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1625
|
+
autocapitalize="${ifDefined(this.autocapitalize || void 0)}"
|
|
1498
1626
|
?autofocus="${this.autofocus}"
|
|
1499
1627
|
data-sp-fieldset-native
|
|
1500
1628
|
?disabled="${this.isDisabled}"
|
|
1501
1629
|
form="${ifDefined(this.form || void 0)}"
|
|
1502
1630
|
id="${ifDefined(this.id || void 0)}"
|
|
1503
1631
|
name="${ifDefined(this.name || void 0)}"
|
|
1632
|
+
spellcheck="${ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
1504
1633
|
title="${ifDefined(this.title || void 0)}"
|
|
1505
1634
|
>
|
|
1506
1635
|
${this.visibleLegend ? html`<legend
|
|
@@ -1528,6 +1657,955 @@ function defineSpectreFieldset(tagName = "sp-fieldset") {
|
|
|
1528
1657
|
customElements.define(tagName, SpectreFieldsetElement);
|
|
1529
1658
|
return SpectreFieldsetElement;
|
|
1530
1659
|
}
|
|
1660
|
+
var SpectreBadgeElement = class extends SpectreProjectableElement {
|
|
1661
|
+
constructor() {
|
|
1662
|
+
super(...arguments);
|
|
1663
|
+
this.disabled = false;
|
|
1664
|
+
this.fullWidth = false;
|
|
1665
|
+
this.loading = false;
|
|
1666
|
+
this.size = "md";
|
|
1667
|
+
this.variant = "primary";
|
|
1668
|
+
}
|
|
1669
|
+
get id() {
|
|
1670
|
+
return super.id;
|
|
1671
|
+
}
|
|
1672
|
+
set id(value) {
|
|
1673
|
+
super.id = value;
|
|
1674
|
+
}
|
|
1675
|
+
get title() {
|
|
1676
|
+
return super.title;
|
|
1677
|
+
}
|
|
1678
|
+
set title(value) {
|
|
1679
|
+
super.title = value;
|
|
1680
|
+
}
|
|
1681
|
+
getContentContainer() {
|
|
1682
|
+
return this.querySelector("[data-sp-badge-native]");
|
|
1683
|
+
}
|
|
1684
|
+
isInternalNode(node) {
|
|
1685
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
1686
|
+
return false;
|
|
1687
|
+
}
|
|
1688
|
+
const el = node;
|
|
1689
|
+
return el.hasAttribute("data-sp-badge-native");
|
|
1690
|
+
}
|
|
1691
|
+
willUpdate(changedProperties) {
|
|
1692
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1693
|
+
this.disabled = false;
|
|
1694
|
+
}
|
|
1695
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
1696
|
+
this.fullWidth = false;
|
|
1697
|
+
}
|
|
1698
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1699
|
+
this.loading = false;
|
|
1700
|
+
}
|
|
1701
|
+
if (changedProperties.has("variant") && (this.variant == null || !isBadgeVariant(this.variant))) {
|
|
1702
|
+
this.variant = "primary";
|
|
1703
|
+
}
|
|
1704
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
1705
|
+
this.size = "md";
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
get badgeClasses() {
|
|
1709
|
+
return getBadgeClasses({
|
|
1710
|
+
disabled: this.isDisabled,
|
|
1711
|
+
fullWidth: this.fullWidth ?? false,
|
|
1712
|
+
loading: this.loading ?? false,
|
|
1713
|
+
size: this.size,
|
|
1714
|
+
variant: this.variant
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
get isDisabled() {
|
|
1718
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1719
|
+
}
|
|
1720
|
+
render() {
|
|
1721
|
+
return html`<span
|
|
1722
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1723
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1724
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1725
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1726
|
+
class="${this.badgeClasses}"
|
|
1727
|
+
data-sp-badge-native
|
|
1728
|
+
id="${ifDefined(this.id || void 0)}"
|
|
1729
|
+
title="${ifDefined(this.title || void 0)}"
|
|
1730
|
+
>
|
|
1731
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
1732
|
+
</span>`;
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
SpectreBadgeElement.properties = {
|
|
1736
|
+
disabled: { type: Boolean, reflect: true },
|
|
1737
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
1738
|
+
loading: { type: Boolean, reflect: true },
|
|
1739
|
+
size: { type: String, reflect: true },
|
|
1740
|
+
variant: { type: String, reflect: true }
|
|
1741
|
+
};
|
|
1742
|
+
function defineSpectreBadge(tagName = "sp-badge") {
|
|
1743
|
+
const existingElement = customElements.get(tagName);
|
|
1744
|
+
if (existingElement) {
|
|
1745
|
+
return existingElement;
|
|
1746
|
+
}
|
|
1747
|
+
customElements.define(tagName, SpectreBadgeElement);
|
|
1748
|
+
return SpectreBadgeElement;
|
|
1749
|
+
}
|
|
1750
|
+
var SpectreCardElement = class extends SpectreProjectableElement {
|
|
1751
|
+
constructor() {
|
|
1752
|
+
super(...arguments);
|
|
1753
|
+
this.disabled = false;
|
|
1754
|
+
this.fullHeight = false;
|
|
1755
|
+
this.interactive = false;
|
|
1756
|
+
this.loading = false;
|
|
1757
|
+
this.padded = true;
|
|
1758
|
+
this.variant = "elevated";
|
|
1759
|
+
}
|
|
1760
|
+
get id() {
|
|
1761
|
+
return super.id;
|
|
1762
|
+
}
|
|
1763
|
+
set id(value) {
|
|
1764
|
+
super.id = value;
|
|
1765
|
+
}
|
|
1766
|
+
get title() {
|
|
1767
|
+
return super.title;
|
|
1768
|
+
}
|
|
1769
|
+
set title(value) {
|
|
1770
|
+
super.title = value;
|
|
1771
|
+
}
|
|
1772
|
+
getContentContainer() {
|
|
1773
|
+
return this.querySelector("[data-sp-card-native]");
|
|
1774
|
+
}
|
|
1775
|
+
isInternalNode(node) {
|
|
1776
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
1777
|
+
return false;
|
|
1778
|
+
}
|
|
1779
|
+
const el = node;
|
|
1780
|
+
return el.hasAttribute("data-sp-card-native");
|
|
1781
|
+
}
|
|
1782
|
+
willUpdate(changedProperties) {
|
|
1783
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1784
|
+
this.disabled = false;
|
|
1785
|
+
}
|
|
1786
|
+
if (changedProperties.has("fullHeight") && this.fullHeight == null) {
|
|
1787
|
+
this.fullHeight = false;
|
|
1788
|
+
}
|
|
1789
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
1790
|
+
this.interactive = false;
|
|
1791
|
+
}
|
|
1792
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1793
|
+
this.loading = false;
|
|
1794
|
+
}
|
|
1795
|
+
if (changedProperties.has("padded") && this.padded == null) {
|
|
1796
|
+
this.padded = true;
|
|
1797
|
+
}
|
|
1798
|
+
if (changedProperties.has("variant") && (this.variant == null || !isCardVariant(this.variant))) {
|
|
1799
|
+
this.variant = "elevated";
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
get cardClasses() {
|
|
1803
|
+
return getCardClasses({
|
|
1804
|
+
disabled: this.isDisabled,
|
|
1805
|
+
fullHeight: this.fullHeight ?? false,
|
|
1806
|
+
interactive: this.interactive ?? false,
|
|
1807
|
+
loading: this.loading ?? false,
|
|
1808
|
+
padded: this.padded ?? true,
|
|
1809
|
+
variant: this.variant
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
get isDisabled() {
|
|
1813
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1814
|
+
}
|
|
1815
|
+
render() {
|
|
1816
|
+
return html`<div
|
|
1817
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1818
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1819
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1820
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1821
|
+
class="${this.cardClasses}"
|
|
1822
|
+
data-sp-card-native
|
|
1823
|
+
id="${ifDefined(this.id || void 0)}"
|
|
1824
|
+
title="${ifDefined(this.title || void 0)}"
|
|
1825
|
+
>
|
|
1826
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
1827
|
+
</div>`;
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
SpectreCardElement.properties = {
|
|
1831
|
+
disabled: { type: Boolean, reflect: true },
|
|
1832
|
+
fullHeight: { attribute: "full-height", type: Boolean, reflect: true },
|
|
1833
|
+
interactive: { type: Boolean, reflect: true },
|
|
1834
|
+
loading: { type: Boolean, reflect: true },
|
|
1835
|
+
padded: { type: Boolean, reflect: true },
|
|
1836
|
+
variant: { type: String, reflect: true }
|
|
1837
|
+
};
|
|
1838
|
+
function defineSpectreCard(tagName = "sp-card") {
|
|
1839
|
+
const existingElement = customElements.get(tagName);
|
|
1840
|
+
if (existingElement) {
|
|
1841
|
+
return existingElement;
|
|
1842
|
+
}
|
|
1843
|
+
customElements.define(tagName, SpectreCardElement);
|
|
1844
|
+
return SpectreCardElement;
|
|
1845
|
+
}
|
|
1846
|
+
var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
1847
|
+
constructor() {
|
|
1848
|
+
super(...arguments);
|
|
1849
|
+
this.disabled = false;
|
|
1850
|
+
this.fullWidth = false;
|
|
1851
|
+
this.interactive = false;
|
|
1852
|
+
this.loading = false;
|
|
1853
|
+
this.pill = false;
|
|
1854
|
+
this.size = "md";
|
|
1855
|
+
this.variant = "primary";
|
|
1856
|
+
}
|
|
1857
|
+
get id() {
|
|
1858
|
+
return super.id;
|
|
1859
|
+
}
|
|
1860
|
+
set id(value) {
|
|
1861
|
+
super.id = value;
|
|
1862
|
+
}
|
|
1863
|
+
get title() {
|
|
1864
|
+
return super.title;
|
|
1865
|
+
}
|
|
1866
|
+
set title(value) {
|
|
1867
|
+
super.title = value;
|
|
1868
|
+
}
|
|
1869
|
+
getContentContainer() {
|
|
1870
|
+
return this.querySelector("[data-sp-icon-box-native]");
|
|
1871
|
+
}
|
|
1872
|
+
isInternalNode(node) {
|
|
1873
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
1874
|
+
return false;
|
|
1875
|
+
}
|
|
1876
|
+
const el = node;
|
|
1877
|
+
return el.hasAttribute("data-sp-icon-box-native");
|
|
1878
|
+
}
|
|
1879
|
+
willUpdate(changedProperties) {
|
|
1880
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1881
|
+
this.disabled = false;
|
|
1882
|
+
}
|
|
1883
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
1884
|
+
this.fullWidth = false;
|
|
1885
|
+
}
|
|
1886
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
1887
|
+
this.interactive = false;
|
|
1888
|
+
}
|
|
1889
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1890
|
+
this.loading = false;
|
|
1891
|
+
}
|
|
1892
|
+
if (changedProperties.has("pill") && this.pill == null) {
|
|
1893
|
+
this.pill = false;
|
|
1894
|
+
}
|
|
1895
|
+
if (changedProperties.has("variant") && (this.variant == null || !isIconBoxVariant(this.variant))) {
|
|
1896
|
+
this.variant = "primary";
|
|
1897
|
+
}
|
|
1898
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
1899
|
+
this.size = "md";
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
get iconBoxClasses() {
|
|
1903
|
+
return getIconBoxClasses({
|
|
1904
|
+
disabled: this.isDisabled,
|
|
1905
|
+
fullWidth: this.fullWidth ?? false,
|
|
1906
|
+
interactive: this.interactive ?? false,
|
|
1907
|
+
loading: this.loading ?? false,
|
|
1908
|
+
pill: this.pill ?? false,
|
|
1909
|
+
size: this.size,
|
|
1910
|
+
variant: this.variant
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
get isDisabled() {
|
|
1914
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1915
|
+
}
|
|
1916
|
+
render() {
|
|
1917
|
+
return html`<div
|
|
1918
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1919
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1920
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1921
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1922
|
+
class="${this.iconBoxClasses}"
|
|
1923
|
+
data-sp-icon-box-native
|
|
1924
|
+
id="${ifDefined(this.id || void 0)}"
|
|
1925
|
+
title="${ifDefined(this.title || void 0)}"
|
|
1926
|
+
>
|
|
1927
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
1928
|
+
</div>`;
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
SpectreIconBoxElement.properties = {
|
|
1932
|
+
disabled: { type: Boolean, reflect: true },
|
|
1933
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
1934
|
+
interactive: { type: Boolean, reflect: true },
|
|
1935
|
+
loading: { type: Boolean, reflect: true },
|
|
1936
|
+
pill: { type: Boolean, reflect: true },
|
|
1937
|
+
size: { type: String, reflect: true },
|
|
1938
|
+
variant: { type: String, reflect: true }
|
|
1939
|
+
};
|
|
1940
|
+
function defineSpectreIconBox(tagName = "sp-icon-box") {
|
|
1941
|
+
const existingElement = customElements.get(tagName);
|
|
1942
|
+
if (existingElement) {
|
|
1943
|
+
return existingElement;
|
|
1944
|
+
}
|
|
1945
|
+
customElements.define(tagName, SpectreIconBoxElement);
|
|
1946
|
+
return SpectreIconBoxElement;
|
|
1947
|
+
}
|
|
1948
|
+
var SpectreRatingElement = class extends SpectreBaseElement {
|
|
1949
|
+
constructor() {
|
|
1950
|
+
super(...arguments);
|
|
1951
|
+
this.disabled = false;
|
|
1952
|
+
this.loading = false;
|
|
1953
|
+
this.max = 5;
|
|
1954
|
+
this.size = "md";
|
|
1955
|
+
this.value = 0;
|
|
1956
|
+
}
|
|
1957
|
+
get id() {
|
|
1958
|
+
return super.id;
|
|
1959
|
+
}
|
|
1960
|
+
set id(value) {
|
|
1961
|
+
super.id = value;
|
|
1962
|
+
}
|
|
1963
|
+
get title() {
|
|
1964
|
+
return super.title;
|
|
1965
|
+
}
|
|
1966
|
+
set title(value) {
|
|
1967
|
+
super.title = value;
|
|
1968
|
+
}
|
|
1969
|
+
willUpdate(changedProperties) {
|
|
1970
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1971
|
+
this.disabled = false;
|
|
1972
|
+
}
|
|
1973
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
1974
|
+
this.loading = false;
|
|
1975
|
+
}
|
|
1976
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
1977
|
+
this.size = "md";
|
|
1978
|
+
}
|
|
1979
|
+
if (changedProperties.has("max")) {
|
|
1980
|
+
this.max = normalizeInt(this.max, 5, 1) ?? 5;
|
|
1981
|
+
}
|
|
1982
|
+
if (changedProperties.has("value")) {
|
|
1983
|
+
const safeMax = this.max ?? 5;
|
|
1984
|
+
const normalized = normalizeInt(this.value, 0, 0);
|
|
1985
|
+
this.value = normalized == null ? 0 : Math.min(normalized, safeMax);
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
get ratingClasses() {
|
|
1989
|
+
return getRatingClasses({
|
|
1990
|
+
disabled: this.isDisabled,
|
|
1991
|
+
loading: this.loading ?? false,
|
|
1992
|
+
size: this.size
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
get isDisabled() {
|
|
1996
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1997
|
+
}
|
|
1998
|
+
get effectiveMax() {
|
|
1999
|
+
return this.max ?? 5;
|
|
2000
|
+
}
|
|
2001
|
+
get effectiveValue() {
|
|
2002
|
+
return this.value ?? 0;
|
|
2003
|
+
}
|
|
2004
|
+
get computedAriaLabel() {
|
|
2005
|
+
const base = this.forwardedAriaLabel;
|
|
2006
|
+
if (base) return base;
|
|
2007
|
+
return `Rating: ${this.effectiveValue} out of ${this.effectiveMax}`;
|
|
2008
|
+
}
|
|
2009
|
+
renderStars() {
|
|
2010
|
+
const stars = [];
|
|
2011
|
+
for (let i = 1; i <= this.effectiveMax; i++) {
|
|
2012
|
+
stars.push(html`<span class="${getRatingStarClasses(i <= this.effectiveValue)}"></span>`);
|
|
2013
|
+
}
|
|
2014
|
+
return stars;
|
|
2015
|
+
}
|
|
2016
|
+
render() {
|
|
2017
|
+
const trimmedLabel = this.label?.trim();
|
|
2018
|
+
return html`<div
|
|
2019
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2020
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2021
|
+
aria-label="${this.computedAriaLabel}"
|
|
2022
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2023
|
+
class="${this.ratingClasses}"
|
|
2024
|
+
data-sp-rating-native
|
|
2025
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2026
|
+
role="img"
|
|
2027
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2028
|
+
>
|
|
2029
|
+
<div class="${getRatingStarsClasses()}">${this.renderStars()}</div>
|
|
2030
|
+
${trimmedLabel ? html`<span class="${getRatingTextClasses({ disabled: this.isDisabled })}">${trimmedLabel}</span>` : nothing}
|
|
2031
|
+
</div>`;
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2034
|
+
SpectreRatingElement.properties = {
|
|
2035
|
+
disabled: { type: Boolean, reflect: true },
|
|
2036
|
+
label: { type: String, reflect: true },
|
|
2037
|
+
loading: { type: Boolean, reflect: true },
|
|
2038
|
+
max: { type: Number, reflect: true },
|
|
2039
|
+
size: { type: String, reflect: true },
|
|
2040
|
+
value: { type: Number, reflect: true }
|
|
2041
|
+
};
|
|
2042
|
+
function defineSpectreRating(tagName = "sp-rating") {
|
|
2043
|
+
const existingElement = customElements.get(tagName);
|
|
2044
|
+
if (existingElement) {
|
|
2045
|
+
return existingElement;
|
|
2046
|
+
}
|
|
2047
|
+
customElements.define(tagName, SpectreRatingElement);
|
|
2048
|
+
return SpectreRatingElement;
|
|
2049
|
+
}
|
|
2050
|
+
var SpectreTestimonialElement = class extends SpectreProjectableElement {
|
|
2051
|
+
constructor() {
|
|
2052
|
+
super(...arguments);
|
|
2053
|
+
this.disabled = false;
|
|
2054
|
+
this.fullHeight = false;
|
|
2055
|
+
this.interactive = false;
|
|
2056
|
+
this.loading = false;
|
|
2057
|
+
this.variant = "elevated";
|
|
2058
|
+
}
|
|
2059
|
+
get id() {
|
|
2060
|
+
return super.id;
|
|
2061
|
+
}
|
|
2062
|
+
set id(value) {
|
|
2063
|
+
super.id = value;
|
|
2064
|
+
}
|
|
2065
|
+
get title() {
|
|
2066
|
+
return super.title;
|
|
2067
|
+
}
|
|
2068
|
+
set title(value) {
|
|
2069
|
+
super.title = value;
|
|
2070
|
+
}
|
|
2071
|
+
getContentContainer() {
|
|
2072
|
+
return this.querySelector("[data-sp-testimonial-native]");
|
|
2073
|
+
}
|
|
2074
|
+
isInternalNode(node) {
|
|
2075
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2076
|
+
return false;
|
|
2077
|
+
}
|
|
2078
|
+
const el = node;
|
|
2079
|
+
return el.hasAttribute("data-sp-testimonial-native");
|
|
2080
|
+
}
|
|
2081
|
+
willUpdate(changedProperties) {
|
|
2082
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2083
|
+
this.disabled = false;
|
|
2084
|
+
}
|
|
2085
|
+
if (changedProperties.has("fullHeight") && this.fullHeight == null) {
|
|
2086
|
+
this.fullHeight = false;
|
|
2087
|
+
}
|
|
2088
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2089
|
+
this.interactive = false;
|
|
2090
|
+
}
|
|
2091
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2092
|
+
this.loading = false;
|
|
2093
|
+
}
|
|
2094
|
+
if (changedProperties.has("variant") && (this.variant == null || !isTestimonialVariant(this.variant))) {
|
|
2095
|
+
this.variant = "elevated";
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
get testimonialClasses() {
|
|
2099
|
+
return getTestimonialClasses({
|
|
2100
|
+
disabled: this.isDisabled,
|
|
2101
|
+
fullHeight: this.fullHeight ?? false,
|
|
2102
|
+
interactive: this.interactive ?? false,
|
|
2103
|
+
loading: this.loading ?? false,
|
|
2104
|
+
variant: this.variant
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
get isDisabled() {
|
|
2108
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2109
|
+
}
|
|
2110
|
+
render() {
|
|
2111
|
+
return html`<div
|
|
2112
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2113
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2114
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2115
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2116
|
+
class="${this.testimonialClasses}"
|
|
2117
|
+
data-sp-testimonial-native
|
|
2118
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2119
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2120
|
+
>
|
|
2121
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2122
|
+
</div>`;
|
|
2123
|
+
}
|
|
2124
|
+
};
|
|
2125
|
+
SpectreTestimonialElement.properties = {
|
|
2126
|
+
disabled: { type: Boolean, reflect: true },
|
|
2127
|
+
fullHeight: { attribute: "full-height", type: Boolean, reflect: true },
|
|
2128
|
+
interactive: { type: Boolean, reflect: true },
|
|
2129
|
+
loading: { type: Boolean, reflect: true },
|
|
2130
|
+
variant: { type: String, reflect: true }
|
|
2131
|
+
};
|
|
2132
|
+
function defineSpectreTestimonial(tagName = "sp-testimonial") {
|
|
2133
|
+
const existingElement = customElements.get(tagName);
|
|
2134
|
+
if (existingElement) {
|
|
2135
|
+
return existingElement;
|
|
2136
|
+
}
|
|
2137
|
+
customElements.define(tagName, SpectreTestimonialElement);
|
|
2138
|
+
return SpectreTestimonialElement;
|
|
2139
|
+
}
|
|
2140
|
+
var SpectreAlertElement = class extends SpectreProjectableElement {
|
|
2141
|
+
constructor() {
|
|
2142
|
+
super(...arguments);
|
|
2143
|
+
this.dismissed = false;
|
|
2144
|
+
this.disabled = false;
|
|
2145
|
+
this.fullWidth = false;
|
|
2146
|
+
this.loading = false;
|
|
2147
|
+
this.size = "md";
|
|
2148
|
+
this.variant = "info";
|
|
2149
|
+
}
|
|
2150
|
+
get id() {
|
|
2151
|
+
return super.id;
|
|
2152
|
+
}
|
|
2153
|
+
set id(value) {
|
|
2154
|
+
super.id = value;
|
|
2155
|
+
}
|
|
2156
|
+
get title() {
|
|
2157
|
+
return super.title;
|
|
2158
|
+
}
|
|
2159
|
+
set title(value) {
|
|
2160
|
+
super.title = value;
|
|
2161
|
+
}
|
|
2162
|
+
getContentContainer() {
|
|
2163
|
+
return this.querySelector("[data-sp-alert-native]");
|
|
2164
|
+
}
|
|
2165
|
+
isInternalNode(node) {
|
|
2166
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2167
|
+
return false;
|
|
2168
|
+
}
|
|
2169
|
+
const el = node;
|
|
2170
|
+
return el.hasAttribute("data-sp-alert-native");
|
|
2171
|
+
}
|
|
2172
|
+
willUpdate(changedProperties) {
|
|
2173
|
+
if (changedProperties.has("dismissed") && this.dismissed == null) {
|
|
2174
|
+
this.dismissed = false;
|
|
2175
|
+
}
|
|
2176
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2177
|
+
this.disabled = false;
|
|
2178
|
+
}
|
|
2179
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
2180
|
+
this.fullWidth = false;
|
|
2181
|
+
}
|
|
2182
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2183
|
+
this.loading = false;
|
|
2184
|
+
}
|
|
2185
|
+
if (changedProperties.has("variant") && (this.variant == null || !isAlertVariant(this.variant))) {
|
|
2186
|
+
this.variant = "info";
|
|
2187
|
+
}
|
|
2188
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
2189
|
+
this.size = "md";
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
get alertClasses() {
|
|
2193
|
+
return getAlertClasses({
|
|
2194
|
+
disabled: this.isDisabled,
|
|
2195
|
+
dismissed: this.dismissed ?? false,
|
|
2196
|
+
fullWidth: this.fullWidth ?? false,
|
|
2197
|
+
loading: this.loading ?? false,
|
|
2198
|
+
size: this.size,
|
|
2199
|
+
variant: this.variant
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
get isDisabled() {
|
|
2203
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2204
|
+
}
|
|
2205
|
+
render() {
|
|
2206
|
+
return html`<div
|
|
2207
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2208
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2209
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2210
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2211
|
+
class="${this.alertClasses}"
|
|
2212
|
+
data-sp-alert-native
|
|
2213
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2214
|
+
role="alert"
|
|
2215
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2216
|
+
>
|
|
2217
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2218
|
+
</div>`;
|
|
2219
|
+
}
|
|
2220
|
+
};
|
|
2221
|
+
SpectreAlertElement.properties = {
|
|
2222
|
+
dismissed: { type: Boolean, reflect: true },
|
|
2223
|
+
disabled: { type: Boolean, reflect: true },
|
|
2224
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
2225
|
+
loading: { type: Boolean, reflect: true },
|
|
2226
|
+
size: { type: String, reflect: true },
|
|
2227
|
+
variant: { type: String, reflect: true }
|
|
2228
|
+
};
|
|
2229
|
+
function defineSpectreAlert(tagName = "sp-alert") {
|
|
2230
|
+
const existingElement = customElements.get(tagName);
|
|
2231
|
+
if (existingElement) {
|
|
2232
|
+
return existingElement;
|
|
2233
|
+
}
|
|
2234
|
+
customElements.define(tagName, SpectreAlertElement);
|
|
2235
|
+
return SpectreAlertElement;
|
|
2236
|
+
}
|
|
2237
|
+
var SpectreAvatarElement = class extends SpectreProjectableElement {
|
|
2238
|
+
constructor() {
|
|
2239
|
+
super(...arguments);
|
|
2240
|
+
this.disabled = false;
|
|
2241
|
+
this.fullWidth = false;
|
|
2242
|
+
this.interactive = false;
|
|
2243
|
+
this.loading = false;
|
|
2244
|
+
this.placeholder = false;
|
|
2245
|
+
this.shape = "circle";
|
|
2246
|
+
this.size = "md";
|
|
2247
|
+
}
|
|
2248
|
+
get id() {
|
|
2249
|
+
return super.id;
|
|
2250
|
+
}
|
|
2251
|
+
set id(value) {
|
|
2252
|
+
super.id = value;
|
|
2253
|
+
}
|
|
2254
|
+
get title() {
|
|
2255
|
+
return super.title;
|
|
2256
|
+
}
|
|
2257
|
+
set title(value) {
|
|
2258
|
+
super.title = value;
|
|
2259
|
+
}
|
|
2260
|
+
getContentContainer() {
|
|
2261
|
+
return this.querySelector("[data-sp-avatar-native]");
|
|
2262
|
+
}
|
|
2263
|
+
isInternalNode(node) {
|
|
2264
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2265
|
+
return false;
|
|
2266
|
+
}
|
|
2267
|
+
const el = node;
|
|
2268
|
+
return el.hasAttribute("data-sp-avatar-native");
|
|
2269
|
+
}
|
|
2270
|
+
willUpdate(changedProperties) {
|
|
2271
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2272
|
+
this.disabled = false;
|
|
2273
|
+
}
|
|
2274
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
2275
|
+
this.fullWidth = false;
|
|
2276
|
+
}
|
|
2277
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2278
|
+
this.interactive = false;
|
|
2279
|
+
}
|
|
2280
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2281
|
+
this.loading = false;
|
|
2282
|
+
}
|
|
2283
|
+
if (changedProperties.has("placeholder") && this.placeholder == null) {
|
|
2284
|
+
this.placeholder = false;
|
|
2285
|
+
}
|
|
2286
|
+
if (changedProperties.has("shape") && (this.shape == null || !isAvatarShape(this.shape))) {
|
|
2287
|
+
this.shape = "circle";
|
|
2288
|
+
}
|
|
2289
|
+
if (changedProperties.has("size") && (this.size == null || !isAvatarSize(this.size))) {
|
|
2290
|
+
this.size = "md";
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
get avatarClasses() {
|
|
2294
|
+
return getAvatarClasses({
|
|
2295
|
+
disabled: this.isDisabled,
|
|
2296
|
+
fullWidth: this.fullWidth ?? false,
|
|
2297
|
+
interactive: this.interactive ?? false,
|
|
2298
|
+
loading: this.loading ?? false,
|
|
2299
|
+
placeholder: this.placeholder ?? false,
|
|
2300
|
+
shape: this.shape,
|
|
2301
|
+
size: this.size
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
get isDisabled() {
|
|
2305
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2306
|
+
}
|
|
2307
|
+
render() {
|
|
2308
|
+
return html`<div
|
|
2309
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2310
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2311
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2312
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2313
|
+
class="${this.avatarClasses}"
|
|
2314
|
+
data-sp-avatar-native
|
|
2315
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2316
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2317
|
+
>
|
|
2318
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2319
|
+
</div>`;
|
|
2320
|
+
}
|
|
2321
|
+
};
|
|
2322
|
+
SpectreAvatarElement.properties = {
|
|
2323
|
+
disabled: { type: Boolean, reflect: true },
|
|
2324
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
2325
|
+
interactive: { type: Boolean, reflect: true },
|
|
2326
|
+
loading: { type: Boolean, reflect: true },
|
|
2327
|
+
placeholder: { type: Boolean, reflect: true },
|
|
2328
|
+
shape: { type: String, reflect: true },
|
|
2329
|
+
size: { type: String, reflect: true }
|
|
2330
|
+
};
|
|
2331
|
+
function defineSpectreAvatar(tagName = "sp-avatar") {
|
|
2332
|
+
const existingElement = customElements.get(tagName);
|
|
2333
|
+
if (existingElement) {
|
|
2334
|
+
return existingElement;
|
|
2335
|
+
}
|
|
2336
|
+
customElements.define(tagName, SpectreAvatarElement);
|
|
2337
|
+
return SpectreAvatarElement;
|
|
2338
|
+
}
|
|
2339
|
+
var SpectreSpinnerElement = class extends SpectreBaseElement {
|
|
2340
|
+
constructor() {
|
|
2341
|
+
super(...arguments);
|
|
2342
|
+
this.disabled = false;
|
|
2343
|
+
this.loading = true;
|
|
2344
|
+
this.size = "md";
|
|
2345
|
+
}
|
|
2346
|
+
get id() {
|
|
2347
|
+
return super.id;
|
|
2348
|
+
}
|
|
2349
|
+
set id(value) {
|
|
2350
|
+
super.id = value;
|
|
2351
|
+
}
|
|
2352
|
+
get title() {
|
|
2353
|
+
return super.title;
|
|
2354
|
+
}
|
|
2355
|
+
set title(value) {
|
|
2356
|
+
super.title = value;
|
|
2357
|
+
}
|
|
2358
|
+
willUpdate(changedProperties) {
|
|
2359
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2360
|
+
this.disabled = false;
|
|
2361
|
+
}
|
|
2362
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2363
|
+
this.loading = true;
|
|
2364
|
+
}
|
|
2365
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
2366
|
+
this.size = "md";
|
|
2367
|
+
}
|
|
2368
|
+
if (changedProperties.has("variant") && this.variant != null && !isSpinnerVariant(this.variant)) {
|
|
2369
|
+
this.variant = void 0;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
get spinnerClasses() {
|
|
2373
|
+
return getSpinnerClasses({
|
|
2374
|
+
disabled: this.disabled ?? false,
|
|
2375
|
+
loading: this.loading ?? true,
|
|
2376
|
+
size: this.size,
|
|
2377
|
+
...this.variant != null ? { variant: this.variant } : {}
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
get computedAriaLabel() {
|
|
2381
|
+
return this.forwardedAriaLabel ?? "Loading";
|
|
2382
|
+
}
|
|
2383
|
+
render() {
|
|
2384
|
+
return html`<div
|
|
2385
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2386
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2387
|
+
aria-label="${this.computedAriaLabel}"
|
|
2388
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2389
|
+
class="${this.spinnerClasses}"
|
|
2390
|
+
data-sp-spinner-native
|
|
2391
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2392
|
+
role="status"
|
|
2393
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2394
|
+
></div>`;
|
|
2395
|
+
}
|
|
2396
|
+
};
|
|
2397
|
+
SpectreSpinnerElement.properties = {
|
|
2398
|
+
disabled: { type: Boolean, reflect: true },
|
|
2399
|
+
loading: { type: Boolean, reflect: true },
|
|
2400
|
+
size: { type: String, reflect: true },
|
|
2401
|
+
variant: { type: String, reflect: true }
|
|
2402
|
+
};
|
|
2403
|
+
function defineSpectreSpinner(tagName = "sp-spinner") {
|
|
2404
|
+
const existingElement = customElements.get(tagName);
|
|
2405
|
+
if (existingElement) {
|
|
2406
|
+
return existingElement;
|
|
2407
|
+
}
|
|
2408
|
+
customElements.define(tagName, SpectreSpinnerElement);
|
|
2409
|
+
return SpectreSpinnerElement;
|
|
2410
|
+
}
|
|
2411
|
+
var SpectreTagElement = class extends SpectreProjectableElement {
|
|
2412
|
+
constructor() {
|
|
2413
|
+
super(...arguments);
|
|
2414
|
+
this.dismissible = false;
|
|
2415
|
+
this.disabled = false;
|
|
2416
|
+
this.fullWidth = false;
|
|
2417
|
+
this.interactive = false;
|
|
2418
|
+
this.loading = false;
|
|
2419
|
+
this.selected = false;
|
|
2420
|
+
this.size = "md";
|
|
2421
|
+
this.variant = "default";
|
|
2422
|
+
}
|
|
2423
|
+
get id() {
|
|
2424
|
+
return super.id;
|
|
2425
|
+
}
|
|
2426
|
+
set id(value) {
|
|
2427
|
+
super.id = value;
|
|
2428
|
+
}
|
|
2429
|
+
get title() {
|
|
2430
|
+
return super.title;
|
|
2431
|
+
}
|
|
2432
|
+
set title(value) {
|
|
2433
|
+
super.title = value;
|
|
2434
|
+
}
|
|
2435
|
+
getContentContainer() {
|
|
2436
|
+
return this.querySelector("[data-sp-tag-native]");
|
|
2437
|
+
}
|
|
2438
|
+
isInternalNode(node) {
|
|
2439
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2440
|
+
return false;
|
|
2441
|
+
}
|
|
2442
|
+
const el = node;
|
|
2443
|
+
return el.hasAttribute("data-sp-tag-native");
|
|
2444
|
+
}
|
|
2445
|
+
willUpdate(changedProperties) {
|
|
2446
|
+
if (changedProperties.has("dismissible") && this.dismissible == null) {
|
|
2447
|
+
this.dismissible = false;
|
|
2448
|
+
}
|
|
2449
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2450
|
+
this.disabled = false;
|
|
2451
|
+
}
|
|
2452
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
2453
|
+
this.fullWidth = false;
|
|
2454
|
+
}
|
|
2455
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2456
|
+
this.interactive = false;
|
|
2457
|
+
}
|
|
2458
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2459
|
+
this.loading = false;
|
|
2460
|
+
}
|
|
2461
|
+
if (changedProperties.has("selected") && this.selected == null) {
|
|
2462
|
+
this.selected = false;
|
|
2463
|
+
}
|
|
2464
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
2465
|
+
this.size = "md";
|
|
2466
|
+
}
|
|
2467
|
+
if (changedProperties.has("variant") && (this.variant == null || !isTagVariant(this.variant))) {
|
|
2468
|
+
this.variant = "default";
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
get tagClasses() {
|
|
2472
|
+
return getTagClasses({
|
|
2473
|
+
disabled: this.isDisabled,
|
|
2474
|
+
dismissible: this.dismissible ?? false,
|
|
2475
|
+
fullWidth: this.fullWidth ?? false,
|
|
2476
|
+
interactive: this.interactive ?? false,
|
|
2477
|
+
loading: this.loading ?? false,
|
|
2478
|
+
selected: this.selected ?? false,
|
|
2479
|
+
size: this.size,
|
|
2480
|
+
variant: this.variant
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
get isDisabled() {
|
|
2484
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2485
|
+
}
|
|
2486
|
+
render() {
|
|
2487
|
+
return html`<span
|
|
2488
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2489
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2490
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2491
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2492
|
+
class="${this.tagClasses}"
|
|
2493
|
+
data-sp-tag-native
|
|
2494
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2495
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2496
|
+
>
|
|
2497
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2498
|
+
</span>`;
|
|
2499
|
+
}
|
|
2500
|
+
};
|
|
2501
|
+
SpectreTagElement.properties = {
|
|
2502
|
+
dismissible: { type: Boolean, reflect: true },
|
|
2503
|
+
disabled: { type: Boolean, reflect: true },
|
|
2504
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
2505
|
+
interactive: { type: Boolean, reflect: true },
|
|
2506
|
+
loading: { type: Boolean, reflect: true },
|
|
2507
|
+
selected: { type: Boolean, reflect: true },
|
|
2508
|
+
size: { type: String, reflect: true },
|
|
2509
|
+
variant: { type: String, reflect: true }
|
|
2510
|
+
};
|
|
2511
|
+
function defineSpectreTag(tagName = "sp-tag") {
|
|
2512
|
+
const existingElement = customElements.get(tagName);
|
|
2513
|
+
if (existingElement) {
|
|
2514
|
+
return existingElement;
|
|
2515
|
+
}
|
|
2516
|
+
customElements.define(tagName, SpectreTagElement);
|
|
2517
|
+
return SpectreTagElement;
|
|
2518
|
+
}
|
|
2519
|
+
var SpectrePricingCardElement = class extends SpectreProjectableElement {
|
|
2520
|
+
constructor() {
|
|
2521
|
+
super(...arguments);
|
|
2522
|
+
this.disabled = false;
|
|
2523
|
+
this.featured = false;
|
|
2524
|
+
this.fullHeight = false;
|
|
2525
|
+
this.interactive = false;
|
|
2526
|
+
this.loading = false;
|
|
2527
|
+
}
|
|
2528
|
+
get id() {
|
|
2529
|
+
return super.id;
|
|
2530
|
+
}
|
|
2531
|
+
set id(value) {
|
|
2532
|
+
super.id = value;
|
|
2533
|
+
}
|
|
2534
|
+
get title() {
|
|
2535
|
+
return super.title;
|
|
2536
|
+
}
|
|
2537
|
+
set title(value) {
|
|
2538
|
+
super.title = value;
|
|
2539
|
+
}
|
|
2540
|
+
getContentContainer() {
|
|
2541
|
+
return this.querySelector("[data-sp-pricing-card-native]");
|
|
2542
|
+
}
|
|
2543
|
+
isInternalNode(node) {
|
|
2544
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2545
|
+
return false;
|
|
2546
|
+
}
|
|
2547
|
+
const el = node;
|
|
2548
|
+
return el.hasAttribute("data-sp-pricing-card-native");
|
|
2549
|
+
}
|
|
2550
|
+
willUpdate(changedProperties) {
|
|
2551
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2552
|
+
this.disabled = false;
|
|
2553
|
+
}
|
|
2554
|
+
if (changedProperties.has("featured") && this.featured == null) {
|
|
2555
|
+
this.featured = false;
|
|
2556
|
+
}
|
|
2557
|
+
if (changedProperties.has("fullHeight") && this.fullHeight == null) {
|
|
2558
|
+
this.fullHeight = false;
|
|
2559
|
+
}
|
|
2560
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2561
|
+
this.interactive = false;
|
|
2562
|
+
}
|
|
2563
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2564
|
+
this.loading = false;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
get pricingCardClasses() {
|
|
2568
|
+
return getPricingCardClasses({
|
|
2569
|
+
disabled: this.isDisabled,
|
|
2570
|
+
featured: this.featured ?? false,
|
|
2571
|
+
fullHeight: this.fullHeight ?? false,
|
|
2572
|
+
interactive: this.interactive ?? false,
|
|
2573
|
+
loading: this.loading ?? false
|
|
2574
|
+
});
|
|
2575
|
+
}
|
|
2576
|
+
get isDisabled() {
|
|
2577
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2578
|
+
}
|
|
2579
|
+
render() {
|
|
2580
|
+
return html`<div
|
|
2581
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2582
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2583
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2584
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2585
|
+
class="${this.pricingCardClasses}"
|
|
2586
|
+
data-sp-pricing-card-native
|
|
2587
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2588
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2589
|
+
>
|
|
2590
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2591
|
+
</div>`;
|
|
2592
|
+
}
|
|
2593
|
+
};
|
|
2594
|
+
SpectrePricingCardElement.properties = {
|
|
2595
|
+
disabled: { type: Boolean, reflect: true },
|
|
2596
|
+
featured: { type: Boolean, reflect: true },
|
|
2597
|
+
fullHeight: { attribute: "full-height", type: Boolean, reflect: true },
|
|
2598
|
+
interactive: { type: Boolean, reflect: true },
|
|
2599
|
+
loading: { type: Boolean, reflect: true }
|
|
2600
|
+
};
|
|
2601
|
+
function defineSpectrePricingCard(tagName = "sp-pricing-card") {
|
|
2602
|
+
const existingElement = customElements.get(tagName);
|
|
2603
|
+
if (existingElement) {
|
|
2604
|
+
return existingElement;
|
|
2605
|
+
}
|
|
2606
|
+
customElements.define(tagName, SpectrePricingCardElement);
|
|
2607
|
+
return SpectrePricingCardElement;
|
|
2608
|
+
}
|
|
1531
2609
|
|
|
1532
2610
|
// src/index.ts
|
|
1533
2611
|
function defineSpectreComponents() {
|
|
@@ -1539,8 +2617,18 @@ function defineSpectreComponents() {
|
|
|
1539
2617
|
defineSpectreRadio();
|
|
1540
2618
|
defineSpectreLabel();
|
|
1541
2619
|
defineSpectreFieldset();
|
|
2620
|
+
defineSpectreBadge();
|
|
2621
|
+
defineSpectreCard();
|
|
2622
|
+
defineSpectreIconBox();
|
|
2623
|
+
defineSpectreRating();
|
|
2624
|
+
defineSpectreTestimonial();
|
|
2625
|
+
defineSpectreAlert();
|
|
2626
|
+
defineSpectreAvatar();
|
|
2627
|
+
defineSpectreSpinner();
|
|
2628
|
+
defineSpectreTag();
|
|
2629
|
+
defineSpectrePricingCard();
|
|
1542
2630
|
}
|
|
1543
2631
|
|
|
1544
|
-
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 };
|
|
2632
|
+
export { SpectreAlertElement, SpectreAvatarElement, SpectreBadgeElement, SpectreButtonElement, SpectreCardElement, SpectreCheckboxElement, SpectreFieldsetElement, SpectreIconBoxElement, SpectreInputElement, SpectreLabelElement, SpectrePricingCardElement, SpectreRadioElement, SpectreRatingElement, SpectreSelectElement, SpectreSpinnerElement, SpectreTagElement, SpectreTestimonialElement, SpectreTextareaElement, defineSpectreAlert, defineSpectreAvatar, defineSpectreBadge, defineSpectreButton, defineSpectreCard, defineSpectreCheckbox, defineSpectreComponents, defineSpectreFieldset, defineSpectreIconBox, defineSpectreInput, defineSpectreLabel, defineSpectrePricingCard, defineSpectreRadio, defineSpectreRating, defineSpectreSelect, defineSpectreSpinner, defineSpectreTag, defineSpectreTestimonial, defineSpectreTextarea, spectreInputSizes as spectreAlertSizes, spectreAlertVariants, spectreAvatarShapes, spectreAvatarSizes, spectreInputSizes as spectreBadgeSizes, spectreBadgeVariants, spectreInputSizes as spectreButtonSizes, spectreButtonTypes, spectreButtonVariants, spectreCardVariants, spectreInputSizes as spectreIconBoxSizes, spectreIconBoxVariants, spectreInputSizes, spectreInputTypes, spectreInputSizes as spectreRatingSizes, spectreInputSizes as spectreSpinnerSizes, spectreSpinnerVariants, spectreInputSizes as spectreTagSizes, spectreTagVariants, spectreTestimonialVariants };
|
|
1545
2633
|
//# sourceMappingURL=index.js.map
|
|
1546
2634
|
//# sourceMappingURL=index.js.map
|