@phcdevworks/spectre-components 1.4.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 +164 -22
- 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 +5 -1
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.d.cts +3 -2
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +5 -1
- package/dist/badge.js.map +1 -1
- 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 +11 -2
- package/dist/card.cjs.map +1 -1
- package/dist/card.d.cts +3 -2
- package/dist/card.d.ts +3 -2
- package/dist/card.js +11 -2
- package/dist/card.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 +5 -1
- package/dist/icon-box.cjs.map +1 -1
- package/dist/icon-box.d.cts +3 -2
- package/dist/icon-box.d.ts +3 -2
- package/dist/icon-box.js +5 -1
- package/dist/icon-box.js.map +1 -1
- package/dist/index.cjs +582 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +566 -11
- 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 +6 -2
- package/dist/rating.cjs.map +1 -1
- package/dist/rating.d.cts +3 -2
- package/dist/rating.d.ts +3 -2
- package/dist/rating.js +6 -2
- package/dist/rating.js.map +1 -1
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +1 -1
- package/dist/select.d.ts +1 -1
- 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 +14 -3
- package/dist/testimonial.cjs.map +1 -1
- package/dist/testimonial.d.cts +3 -2
- package/dist/testimonial.d.ts +3 -2
- package/dist/testimonial.js +14 -3
- package/dist/testimonial.js.map +1 -1
- 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 +36 -8
- package/dist/form-Dg6kuOS7.d.cts +0 -18
- package/dist/form-Dg6kuOS7.d.ts +0 -18
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getButtonClasses, getInputLabelClasses, getInputClasses, getBadgeClasses, getCardClasses, getIconBoxClasses, getRatingClasses, getRatingStarClasses, getRatingStarsClasses, getRatingTextClasses, getTestimonialClasses } 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';
|
|
@@ -57,7 +57,22 @@ var spectreBadgeVariants = [
|
|
|
57
57
|
function isBadgeVariant(value) {
|
|
58
58
|
return spectreBadgeVariants.includes(value);
|
|
59
59
|
}
|
|
60
|
-
var
|
|
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
|
+
];
|
|
61
76
|
function isCardVariant(value) {
|
|
62
77
|
return spectreCardVariants.includes(value);
|
|
63
78
|
}
|
|
@@ -77,9 +92,55 @@ var spectreIconBoxVariants = [
|
|
|
77
92
|
function isIconBoxVariant(value) {
|
|
78
93
|
return spectreIconBoxVariants.includes(value);
|
|
79
94
|
}
|
|
80
|
-
var spectreTestimonialVariants = [
|
|
95
|
+
var spectreTestimonialVariants = [
|
|
96
|
+
"elevated",
|
|
97
|
+
"flat",
|
|
98
|
+
"outline",
|
|
99
|
+
"ghost"
|
|
100
|
+
];
|
|
81
101
|
function isTestimonialVariant(value) {
|
|
82
|
-
return spectreTestimonialVariants.includes(
|
|
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);
|
|
83
144
|
}
|
|
84
145
|
function normalizeInt(value, fallback, min = 0) {
|
|
85
146
|
if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
|
|
@@ -1646,15 +1707,19 @@ var SpectreBadgeElement = class extends SpectreProjectableElement {
|
|
|
1646
1707
|
}
|
|
1647
1708
|
get badgeClasses() {
|
|
1648
1709
|
return getBadgeClasses({
|
|
1649
|
-
disabled: this.
|
|
1710
|
+
disabled: this.isDisabled,
|
|
1650
1711
|
fullWidth: this.fullWidth ?? false,
|
|
1651
1712
|
loading: this.loading ?? false,
|
|
1652
1713
|
size: this.size,
|
|
1653
1714
|
variant: this.variant
|
|
1654
1715
|
});
|
|
1655
1716
|
}
|
|
1717
|
+
get isDisabled() {
|
|
1718
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1719
|
+
}
|
|
1656
1720
|
render() {
|
|
1657
1721
|
return html`<span
|
|
1722
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1658
1723
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1659
1724
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1660
1725
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
@@ -1736,7 +1801,7 @@ var SpectreCardElement = class extends SpectreProjectableElement {
|
|
|
1736
1801
|
}
|
|
1737
1802
|
get cardClasses() {
|
|
1738
1803
|
return getCardClasses({
|
|
1739
|
-
disabled: this.
|
|
1804
|
+
disabled: this.isDisabled,
|
|
1740
1805
|
fullHeight: this.fullHeight ?? false,
|
|
1741
1806
|
interactive: this.interactive ?? false,
|
|
1742
1807
|
loading: this.loading ?? false,
|
|
@@ -1744,8 +1809,12 @@ var SpectreCardElement = class extends SpectreProjectableElement {
|
|
|
1744
1809
|
variant: this.variant
|
|
1745
1810
|
});
|
|
1746
1811
|
}
|
|
1812
|
+
get isDisabled() {
|
|
1813
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1814
|
+
}
|
|
1747
1815
|
render() {
|
|
1748
1816
|
return html`<div
|
|
1817
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1749
1818
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1750
1819
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1751
1820
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
@@ -1832,7 +1901,7 @@ var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
|
1832
1901
|
}
|
|
1833
1902
|
get iconBoxClasses() {
|
|
1834
1903
|
return getIconBoxClasses({
|
|
1835
|
-
disabled: this.
|
|
1904
|
+
disabled: this.isDisabled,
|
|
1836
1905
|
fullWidth: this.fullWidth ?? false,
|
|
1837
1906
|
interactive: this.interactive ?? false,
|
|
1838
1907
|
loading: this.loading ?? false,
|
|
@@ -1841,8 +1910,12 @@ var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
|
1841
1910
|
variant: this.variant
|
|
1842
1911
|
});
|
|
1843
1912
|
}
|
|
1913
|
+
get isDisabled() {
|
|
1914
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1915
|
+
}
|
|
1844
1916
|
render() {
|
|
1845
1917
|
return html`<div
|
|
1918
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1846
1919
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1847
1920
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1848
1921
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
@@ -1914,11 +1987,14 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
1914
1987
|
}
|
|
1915
1988
|
get ratingClasses() {
|
|
1916
1989
|
return getRatingClasses({
|
|
1917
|
-
disabled: this.
|
|
1990
|
+
disabled: this.isDisabled,
|
|
1918
1991
|
loading: this.loading ?? false,
|
|
1919
1992
|
size: this.size
|
|
1920
1993
|
});
|
|
1921
1994
|
}
|
|
1995
|
+
get isDisabled() {
|
|
1996
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1997
|
+
}
|
|
1922
1998
|
get effectiveMax() {
|
|
1923
1999
|
return this.max ?? 5;
|
|
1924
2000
|
}
|
|
@@ -1940,6 +2016,7 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
1940
2016
|
render() {
|
|
1941
2017
|
const trimmedLabel = this.label?.trim();
|
|
1942
2018
|
return html`<div
|
|
2019
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1943
2020
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1944
2021
|
aria-label="${this.computedAriaLabel}"
|
|
1945
2022
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
@@ -1950,7 +2027,7 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
1950
2027
|
title="${ifDefined(this.title || void 0)}"
|
|
1951
2028
|
>
|
|
1952
2029
|
<div class="${getRatingStarsClasses()}">${this.renderStars()}</div>
|
|
1953
|
-
${trimmedLabel ? html`<span class="${getRatingTextClasses({ disabled: this.
|
|
2030
|
+
${trimmedLabel ? html`<span class="${getRatingTextClasses({ disabled: this.isDisabled })}">${trimmedLabel}</span>` : nothing}
|
|
1954
2031
|
</div>`;
|
|
1955
2032
|
}
|
|
1956
2033
|
};
|
|
@@ -2020,15 +2097,19 @@ var SpectreTestimonialElement = class extends SpectreProjectableElement {
|
|
|
2020
2097
|
}
|
|
2021
2098
|
get testimonialClasses() {
|
|
2022
2099
|
return getTestimonialClasses({
|
|
2023
|
-
disabled: this.
|
|
2100
|
+
disabled: this.isDisabled,
|
|
2024
2101
|
fullHeight: this.fullHeight ?? false,
|
|
2025
2102
|
interactive: this.interactive ?? false,
|
|
2026
2103
|
loading: this.loading ?? false,
|
|
2027
2104
|
variant: this.variant
|
|
2028
2105
|
});
|
|
2029
2106
|
}
|
|
2107
|
+
get isDisabled() {
|
|
2108
|
+
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2109
|
+
}
|
|
2030
2110
|
render() {
|
|
2031
2111
|
return html`<div
|
|
2112
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2032
2113
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2033
2114
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2034
2115
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
@@ -2056,6 +2137,475 @@ function defineSpectreTestimonial(tagName = "sp-testimonial") {
|
|
|
2056
2137
|
customElements.define(tagName, SpectreTestimonialElement);
|
|
2057
2138
|
return SpectreTestimonialElement;
|
|
2058
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
|
+
}
|
|
2059
2609
|
|
|
2060
2610
|
// src/index.ts
|
|
2061
2611
|
function defineSpectreComponents() {
|
|
@@ -2072,8 +2622,13 @@ function defineSpectreComponents() {
|
|
|
2072
2622
|
defineSpectreIconBox();
|
|
2073
2623
|
defineSpectreRating();
|
|
2074
2624
|
defineSpectreTestimonial();
|
|
2625
|
+
defineSpectreAlert();
|
|
2626
|
+
defineSpectreAvatar();
|
|
2627
|
+
defineSpectreSpinner();
|
|
2628
|
+
defineSpectreTag();
|
|
2629
|
+
defineSpectrePricingCard();
|
|
2075
2630
|
}
|
|
2076
2631
|
|
|
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 };
|
|
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 };
|
|
2078
2633
|
//# sourceMappingURL=index.js.map
|
|
2079
2634
|
//# sourceMappingURL=index.js.map
|