@phcdevworks/spectre-components 1.4.0 → 1.6.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 +280 -22
- package/dist/alert.cjs +462 -0
- package/dist/alert.cjs.map +1 -0
- package/dist/alert.d.cts +67 -0
- package/dist/alert.d.ts +67 -0
- package/dist/alert.js +457 -0
- package/dist/alert.js.map +1 -0
- package/dist/avatar.cjs +462 -0
- package/dist/avatar.cjs.map +1 -0
- package/dist/avatar.d.cts +73 -0
- package/dist/avatar.d.ts +73 -0
- package/dist/avatar.js +457 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.cjs +13 -1
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.d.cts +4 -4
- package/dist/badge.d.ts +4 -4
- package/dist/badge.js +13 -1
- package/dist/badge.js.map +1 -1
- package/dist/{base-BRQ7QAAr.d.cts → base-D0s95V2v.d.cts} +2 -0
- package/dist/{base-BRQ7QAAr.d.ts → base-D0s95V2v.d.ts} +2 -0
- package/dist/button.cjs +14 -5
- package/dist/button.cjs.map +1 -1
- package/dist/button.d.cts +4 -5
- package/dist/button.d.ts +4 -5
- package/dist/button.js +14 -5
- package/dist/button.js.map +1 -1
- package/dist/card.cjs +19 -2
- package/dist/card.cjs.map +1 -1
- package/dist/card.d.cts +4 -4
- package/dist/card.d.ts +4 -4
- package/dist/card.js +19 -2
- package/dist/card.js.map +1 -1
- package/dist/checkbox.cjs +16 -5
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.d.cts +2 -3
- package/dist/checkbox.d.ts +2 -3
- package/dist/checkbox.js +17 -6
- package/dist/checkbox.js.map +1 -1
- package/dist/container.cjs +421 -0
- package/dist/container.cjs.map +1 -0
- package/dist/container.d.cts +37 -0
- package/dist/container.d.ts +37 -0
- package/dist/container.js +417 -0
- package/dist/container.js.map +1 -0
- package/dist/fieldset.cjs +16 -7
- package/dist/fieldset.cjs.map +1 -1
- package/dist/fieldset.d.cts +2 -3
- package/dist/fieldset.d.ts +2 -3
- package/dist/fieldset.js +18 -9
- package/dist/fieldset.js.map +1 -1
- package/dist/form-8KZeQRgr.d.cts +40 -0
- package/dist/form-8KZeQRgr.d.ts +40 -0
- package/dist/grid.cjs +437 -0
- package/dist/grid.cjs.map +1 -0
- package/dist/grid.d.cts +42 -0
- package/dist/grid.d.ts +42 -0
- package/dist/grid.js +432 -0
- package/dist/grid.js.map +1 -0
- package/dist/icon-box.cjs +13 -1
- package/dist/icon-box.cjs.map +1 -1
- package/dist/icon-box.d.cts +4 -4
- package/dist/icon-box.d.ts +4 -4
- package/dist/icon-box.js +13 -1
- package/dist/icon-box.js.map +1 -1
- package/dist/index.cjs +916 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +886 -49
- package/dist/index.js.map +1 -1
- package/dist/input.cjs +10 -3
- package/dist/input.cjs.map +1 -1
- package/dist/input.d.cts +3 -4
- package/dist/input.d.ts +3 -4
- package/dist/input.js +10 -3
- package/dist/input.js.map +1 -1
- package/dist/label.cjs +17 -2
- package/dist/label.cjs.map +1 -1
- package/dist/label.d.cts +9 -3
- package/dist/label.d.ts +9 -3
- package/dist/label.js +18 -3
- package/dist/label.js.map +1 -1
- package/dist/pricing-card.cjs +440 -0
- package/dist/pricing-card.cjs.map +1 -0
- package/dist/pricing-card.d.cts +59 -0
- package/dist/pricing-card.d.ts +59 -0
- package/dist/pricing-card.js +437 -0
- package/dist/pricing-card.js.map +1 -0
- package/dist/{projectable-D6IDeKfr.d.ts → projectable-D9YCo9NY.d.ts} +1 -1
- package/dist/{projectable-Bx-IVk0w.d.cts → projectable-DLOn6eaW.d.cts} +1 -1
- package/dist/radio.cjs +16 -5
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.d.cts +2 -3
- package/dist/radio.d.ts +2 -3
- package/dist/radio.js +17 -6
- package/dist/radio.js.map +1 -1
- package/dist/rating.cjs +21 -3
- package/dist/rating.cjs.map +1 -1
- package/dist/rating.d.cts +3 -3
- package/dist/rating.d.ts +3 -3
- package/dist/rating.js +21 -3
- package/dist/rating.js.map +1 -1
- package/dist/section.cjs +400 -0
- package/dist/section.cjs.map +1 -0
- package/dist/section.d.cts +25 -0
- package/dist/section.d.ts +25 -0
- package/dist/section.js +397 -0
- package/dist/section.js.map +1 -0
- package/dist/select.cjs +14 -5
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +3 -4
- package/dist/select.d.ts +3 -4
- package/dist/select.js +15 -6
- package/dist/select.js.map +1 -1
- package/dist/spinner.cjs +366 -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 +361 -0
- package/dist/spinner.js.map +1 -0
- package/dist/stack.cjs +443 -0
- package/dist/stack.cjs.map +1 -0
- package/dist/stack.d.cts +48 -0
- package/dist/stack.d.ts +48 -0
- package/dist/stack.js +437 -0
- package/dist/stack.js.map +1 -0
- package/dist/tag.cjs +481 -0
- package/dist/tag.cjs.map +1 -0
- package/dist/tag.d.cts +79 -0
- package/dist/tag.d.ts +79 -0
- package/dist/tag.js +476 -0
- package/dist/tag.js.map +1 -0
- package/dist/testimonial.cjs +22 -3
- package/dist/testimonial.cjs.map +1 -1
- package/dist/testimonial.d.cts +4 -4
- package/dist/testimonial.d.ts +4 -4
- package/dist/testimonial.js +22 -3
- package/dist/testimonial.js.map +1 -1
- package/dist/textarea.cjs +14 -5
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.d.cts +2 -3
- package/dist/textarea.d.ts +2 -3
- package/dist/textarea.js +15 -6
- package/dist/textarea.js.map +1 -1
- package/package.json +70 -17
- 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, getTextareaClasses, getSelectClasses, getCheckboxClasses, getRadioClasses, getLabelClasses, getFieldsetLegendClasses, getFieldsetClasses, getBadgeClasses, getCardClasses, getIconBoxClasses, getRatingClasses, getRatingStarClasses, getRatingStarsClasses, getRatingTextClasses, getTestimonialClasses, getAlertClasses, getAvatarClasses, getSpinnerClasses, getTagClasses, getPricingCardClasses, getContainerClasses, getGridClasses, getStackClasses, getSectionClasses } 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,83 @@ 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);
|
|
144
|
+
}
|
|
145
|
+
var spectreContainerMaxWidths = ["prose"];
|
|
146
|
+
function isContainerMaxWidth(value) {
|
|
147
|
+
return spectreContainerMaxWidths.includes(
|
|
148
|
+
value
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
var spectreGridColumns = [1, 2, 3, 4, 6, 12];
|
|
152
|
+
function isGridColumns(value) {
|
|
153
|
+
return spectreGridColumns.includes(value);
|
|
154
|
+
}
|
|
155
|
+
var spectreGridGaps = ["sm", "md", "lg"];
|
|
156
|
+
function isGridGap(value) {
|
|
157
|
+
return spectreGridGaps.includes(value);
|
|
158
|
+
}
|
|
159
|
+
var spectreStackDirections = ["vertical", "horizontal"];
|
|
160
|
+
function isStackDirection(value) {
|
|
161
|
+
return spectreStackDirections.includes(
|
|
162
|
+
value
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
var spectreStackBases = ["sidebar"];
|
|
166
|
+
function isStackBasis(value) {
|
|
167
|
+
return spectreStackBases.includes(value);
|
|
168
|
+
}
|
|
169
|
+
var spectreStackAligns = ["center", "stretch"];
|
|
170
|
+
function isStackAlign(value) {
|
|
171
|
+
return spectreStackAligns.includes(value);
|
|
83
172
|
}
|
|
84
173
|
function normalizeInt(value, fallback, min = 0) {
|
|
85
174
|
if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
|
|
@@ -337,6 +426,16 @@ var SpectreBaseElement = class extends LitElement {
|
|
|
337
426
|
const value = this.ariaDescribedBy?.trim();
|
|
338
427
|
return value ? value : void 0;
|
|
339
428
|
}
|
|
429
|
+
// Subclasses that expose `disabled`/`loading` properties get this disabled
|
|
430
|
+
// calculation for free instead of redeclaring it per component.
|
|
431
|
+
get isDisabled() {
|
|
432
|
+
const self = this;
|
|
433
|
+
return (self.disabled ?? false) || (self.loading ?? false);
|
|
434
|
+
}
|
|
435
|
+
// Subclasses get this for free instead of redeclaring it per component.
|
|
436
|
+
get hasForwardedLabel() {
|
|
437
|
+
return Boolean(this.forwardedAriaLabel || this.forwardedAriaLabelledBy);
|
|
438
|
+
}
|
|
340
439
|
};
|
|
341
440
|
SpectreBaseElement.properties = {};
|
|
342
441
|
|
|
@@ -504,9 +603,6 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
504
603
|
variant: this.variant
|
|
505
604
|
});
|
|
506
605
|
}
|
|
507
|
-
get isDisabled() {
|
|
508
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
509
|
-
}
|
|
510
606
|
get visibleLabelFallback() {
|
|
511
607
|
const trimmedLabel = this.label?.trim();
|
|
512
608
|
return trimmedLabel ? trimmedLabel : void 0;
|
|
@@ -522,7 +618,8 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
522
618
|
return html`<span
|
|
523
619
|
class="${getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
524
620
|
data-sp-button-loading-label
|
|
525
|
-
|
|
621
|
+
>${this.loadingLabel}</span
|
|
622
|
+
>`;
|
|
526
623
|
}
|
|
527
624
|
if (this.hasProjectedContent) {
|
|
528
625
|
return this.projectedContent;
|
|
@@ -530,7 +627,8 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
530
627
|
return this.visibleLabelFallback ? html`<span
|
|
531
628
|
class="${getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
532
629
|
data-sp-button-label-fallback
|
|
533
|
-
|
|
630
|
+
>${this.visibleLabelFallback}</span
|
|
631
|
+
>` : nothing;
|
|
534
632
|
}
|
|
535
633
|
render() {
|
|
536
634
|
return html`<button
|
|
@@ -670,9 +768,6 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
670
768
|
state: this.isDisabled ? this.disabled ? "disabled" : "loading" : this.invalid ? "error" : this.success ? "success" : "default"
|
|
671
769
|
});
|
|
672
770
|
}
|
|
673
|
-
get isDisabled() {
|
|
674
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
675
|
-
}
|
|
676
771
|
get nativeInput() {
|
|
677
772
|
return this.querySelector("[data-sp-input-native]");
|
|
678
773
|
}
|
|
@@ -849,16 +944,15 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
849
944
|
}
|
|
850
945
|
}
|
|
851
946
|
get textareaClasses() {
|
|
852
|
-
return
|
|
947
|
+
return getTextareaClasses({
|
|
853
948
|
fullWidth: this.fullWidth ?? false,
|
|
854
949
|
pill: this.pill ?? false,
|
|
855
950
|
size: this.size,
|
|
856
|
-
|
|
951
|
+
disabled: this.disabled ?? false,
|
|
952
|
+
loading: this.loading ?? false,
|
|
953
|
+
state: this.invalid ? "invalid" : this.success ? "success" : "default"
|
|
857
954
|
});
|
|
858
955
|
}
|
|
859
|
-
get isDisabled() {
|
|
860
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
861
|
-
}
|
|
862
956
|
get nativeTextarea() {
|
|
863
957
|
return this.querySelector("[data-sp-textarea-native]");
|
|
864
958
|
}
|
|
@@ -1044,16 +1138,15 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
1044
1138
|
}
|
|
1045
1139
|
}
|
|
1046
1140
|
get selectClasses() {
|
|
1047
|
-
return
|
|
1141
|
+
return getSelectClasses({
|
|
1048
1142
|
fullWidth: this.fullWidth ?? false,
|
|
1049
1143
|
pill: this.pill ?? false,
|
|
1050
1144
|
size: this.size,
|
|
1051
|
-
|
|
1145
|
+
disabled: this.disabled ?? false,
|
|
1146
|
+
loading: this.loading ?? false,
|
|
1147
|
+
state: this.invalid ? "invalid" : this.success ? "success" : "default"
|
|
1052
1148
|
});
|
|
1053
1149
|
}
|
|
1054
|
-
get isDisabled() {
|
|
1055
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1056
|
-
}
|
|
1057
1150
|
handleInput(event) {
|
|
1058
1151
|
const select = event.currentTarget;
|
|
1059
1152
|
this.value = select.value;
|
|
@@ -1182,9 +1275,6 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1182
1275
|
get nativeInput() {
|
|
1183
1276
|
return this.querySelector("[data-sp-checkbox-native]");
|
|
1184
1277
|
}
|
|
1185
|
-
get isDisabled() {
|
|
1186
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1187
|
-
}
|
|
1188
1278
|
get visibleLabelFallback() {
|
|
1189
1279
|
const trimmedLabel = this.label?.trim();
|
|
1190
1280
|
return trimmedLabel ? trimmedLabel : void 0;
|
|
@@ -1207,7 +1297,8 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1207
1297
|
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? html`<span
|
|
1208
1298
|
class="${getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
1209
1299
|
data-sp-checkbox-label-fallback
|
|
1210
|
-
|
|
1300
|
+
>${this.visibleLabelFallback}</span
|
|
1301
|
+
>` : nothing;
|
|
1211
1302
|
return html`<label data-sp-checkbox-label>
|
|
1212
1303
|
<input
|
|
1213
1304
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -1229,7 +1320,10 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1229
1320
|
@change="${this.handleChange}"
|
|
1230
1321
|
@input="${this.handleInput}"
|
|
1231
1322
|
/>
|
|
1232
|
-
<span
|
|
1323
|
+
<span
|
|
1324
|
+
class="${getCheckboxClasses({ checked: this.checked ?? false, disabled: this.isDisabled })}"
|
|
1325
|
+
data-sp-checkbox-indicator
|
|
1326
|
+
></span>
|
|
1233
1327
|
${labelContent}
|
|
1234
1328
|
</label>`;
|
|
1235
1329
|
}
|
|
@@ -1319,9 +1413,6 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1319
1413
|
get nativeInput() {
|
|
1320
1414
|
return this.querySelector("[data-sp-radio-native]");
|
|
1321
1415
|
}
|
|
1322
|
-
get isDisabled() {
|
|
1323
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1324
|
-
}
|
|
1325
1416
|
get visibleLabelFallback() {
|
|
1326
1417
|
const trimmedLabel = this.label?.trim();
|
|
1327
1418
|
return trimmedLabel ? trimmedLabel : void 0;
|
|
@@ -1364,7 +1455,8 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1364
1455
|
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? html`<span
|
|
1365
1456
|
class="${getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
1366
1457
|
data-sp-radio-label-fallback
|
|
1367
|
-
|
|
1458
|
+
>${this.visibleLabelFallback}</span
|
|
1459
|
+
>` : nothing;
|
|
1368
1460
|
return html`<label data-sp-radio-label>
|
|
1369
1461
|
<input
|
|
1370
1462
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -1386,7 +1478,10 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1386
1478
|
@change="${this.handleChange}"
|
|
1387
1479
|
@input="${this.handleInput}"
|
|
1388
1480
|
/>
|
|
1389
|
-
<span
|
|
1481
|
+
<span
|
|
1482
|
+
class="${getRadioClasses({ checked: this.checked ?? false, disabled: this.isDisabled })}"
|
|
1483
|
+
data-sp-radio-indicator
|
|
1484
|
+
></span>
|
|
1390
1485
|
${labelContent}
|
|
1391
1486
|
</label>`;
|
|
1392
1487
|
}
|
|
@@ -1415,11 +1510,15 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1415
1510
|
constructor() {
|
|
1416
1511
|
super(...arguments);
|
|
1417
1512
|
this.disabled = false;
|
|
1513
|
+
this.required = false;
|
|
1418
1514
|
}
|
|
1419
1515
|
willUpdate(changedProperties) {
|
|
1420
1516
|
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1421
1517
|
this.disabled = false;
|
|
1422
1518
|
}
|
|
1519
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
1520
|
+
this.required = false;
|
|
1521
|
+
}
|
|
1423
1522
|
}
|
|
1424
1523
|
get isDisabled() {
|
|
1425
1524
|
return this.disabled ?? false;
|
|
@@ -1457,7 +1556,7 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1457
1556
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1458
1557
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1459
1558
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1460
|
-
class="${
|
|
1559
|
+
class="${getLabelClasses({ disabled: this.isDisabled, required: this.required ?? false })}"
|
|
1461
1560
|
data-sp-label-native
|
|
1462
1561
|
for="${ifDefined(this.htmlFor || void 0)}"
|
|
1463
1562
|
id="${ifDefined(this.id || void 0)}"
|
|
@@ -1469,7 +1568,8 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1469
1568
|
};
|
|
1470
1569
|
SpectreLabelElement.properties = {
|
|
1471
1570
|
disabled: { type: Boolean, reflect: true },
|
|
1472
|
-
htmlFor: { attribute: "for", type: String, reflect: true }
|
|
1571
|
+
htmlFor: { attribute: "for", type: String, reflect: true },
|
|
1572
|
+
required: { type: Boolean, reflect: true }
|
|
1473
1573
|
};
|
|
1474
1574
|
function defineSpectreLabel(tagName = "sp-label") {
|
|
1475
1575
|
const existingElement = customElements.get(tagName);
|
|
@@ -1521,9 +1621,6 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1521
1621
|
const trimmedLegend = this.legend?.trim();
|
|
1522
1622
|
return trimmedLegend ? trimmedLegend : void 0;
|
|
1523
1623
|
}
|
|
1524
|
-
get isDisabled() {
|
|
1525
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1526
|
-
}
|
|
1527
1624
|
getContentContainer() {
|
|
1528
1625
|
return this.querySelector("[data-sp-fieldset-native]");
|
|
1529
1626
|
}
|
|
@@ -1555,6 +1652,10 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1555
1652
|
this.getContentContainer()?.blur();
|
|
1556
1653
|
}
|
|
1557
1654
|
render() {
|
|
1655
|
+
const legendClasses = getFieldsetLegendClasses();
|
|
1656
|
+
const legendContent = this.visibleLegend ? html`<legend class="${legendClasses}" data-sp-fieldset-legend>
|
|
1657
|
+
${this.visibleLegend}
|
|
1658
|
+
</legend>` : nothing;
|
|
1558
1659
|
return html`<fieldset
|
|
1559
1660
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
1560
1661
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
@@ -1563,6 +1664,7 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1563
1664
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1564
1665
|
autocapitalize="${ifDefined(this.autocapitalize || void 0)}"
|
|
1565
1666
|
?autofocus="${this.autofocus}"
|
|
1667
|
+
class="${getFieldsetClasses({ disabled: this.isDisabled })}"
|
|
1566
1668
|
data-sp-fieldset-native
|
|
1567
1669
|
?disabled="${this.isDisabled}"
|
|
1568
1670
|
form="${ifDefined(this.form || void 0)}"
|
|
@@ -1571,10 +1673,7 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1571
1673
|
spellcheck="${ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
1572
1674
|
title="${ifDefined(this.title || void 0)}"
|
|
1573
1675
|
>
|
|
1574
|
-
${
|
|
1575
|
-
class="${getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
1576
|
-
data-sp-fieldset-legend
|
|
1577
|
-
>${this.visibleLegend}</legend>` : nothing}
|
|
1676
|
+
${legendContent}
|
|
1578
1677
|
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
1579
1678
|
</fieldset>`;
|
|
1580
1679
|
}
|
|
@@ -1646,7 +1745,7 @@ var SpectreBadgeElement = class extends SpectreProjectableElement {
|
|
|
1646
1745
|
}
|
|
1647
1746
|
get badgeClasses() {
|
|
1648
1747
|
return getBadgeClasses({
|
|
1649
|
-
disabled: this.
|
|
1748
|
+
disabled: this.isDisabled,
|
|
1650
1749
|
fullWidth: this.fullWidth ?? false,
|
|
1651
1750
|
loading: this.loading ?? false,
|
|
1652
1751
|
size: this.size,
|
|
@@ -1655,12 +1754,14 @@ var SpectreBadgeElement = class extends SpectreProjectableElement {
|
|
|
1655
1754
|
}
|
|
1656
1755
|
render() {
|
|
1657
1756
|
return html`<span
|
|
1757
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1658
1758
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1659
1759
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1660
1760
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1661
1761
|
class="${this.badgeClasses}"
|
|
1662
1762
|
data-sp-badge-native
|
|
1663
1763
|
id="${ifDefined(this.id || void 0)}"
|
|
1764
|
+
role="${ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
1664
1765
|
title="${ifDefined(this.title || void 0)}"
|
|
1665
1766
|
>
|
|
1666
1767
|
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
@@ -1736,7 +1837,7 @@ var SpectreCardElement = class extends SpectreProjectableElement {
|
|
|
1736
1837
|
}
|
|
1737
1838
|
get cardClasses() {
|
|
1738
1839
|
return getCardClasses({
|
|
1739
|
-
disabled: this.
|
|
1840
|
+
disabled: this.isDisabled,
|
|
1740
1841
|
fullHeight: this.fullHeight ?? false,
|
|
1741
1842
|
interactive: this.interactive ?? false,
|
|
1742
1843
|
loading: this.loading ?? false,
|
|
@@ -1746,12 +1847,14 @@ var SpectreCardElement = class extends SpectreProjectableElement {
|
|
|
1746
1847
|
}
|
|
1747
1848
|
render() {
|
|
1748
1849
|
return html`<div
|
|
1850
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1749
1851
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1750
1852
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1751
1853
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1752
1854
|
class="${this.cardClasses}"
|
|
1753
1855
|
data-sp-card-native
|
|
1754
1856
|
id="${ifDefined(this.id || void 0)}"
|
|
1857
|
+
role="${ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
1755
1858
|
title="${ifDefined(this.title || void 0)}"
|
|
1756
1859
|
>
|
|
1757
1860
|
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
@@ -1832,7 +1935,7 @@ var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
|
1832
1935
|
}
|
|
1833
1936
|
get iconBoxClasses() {
|
|
1834
1937
|
return getIconBoxClasses({
|
|
1835
|
-
disabled: this.
|
|
1938
|
+
disabled: this.isDisabled,
|
|
1836
1939
|
fullWidth: this.fullWidth ?? false,
|
|
1837
1940
|
interactive: this.interactive ?? false,
|
|
1838
1941
|
loading: this.loading ?? false,
|
|
@@ -1843,12 +1946,14 @@ var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
|
1843
1946
|
}
|
|
1844
1947
|
render() {
|
|
1845
1948
|
return html`<div
|
|
1949
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1846
1950
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1847
1951
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
1848
1952
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1849
1953
|
class="${this.iconBoxClasses}"
|
|
1850
1954
|
data-sp-icon-box-native
|
|
1851
1955
|
id="${ifDefined(this.id || void 0)}"
|
|
1956
|
+
role="${ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
1852
1957
|
title="${ifDefined(this.title || void 0)}"
|
|
1853
1958
|
>
|
|
1854
1959
|
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
@@ -1914,7 +2019,7 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
1914
2019
|
}
|
|
1915
2020
|
get ratingClasses() {
|
|
1916
2021
|
return getRatingClasses({
|
|
1917
|
-
disabled: this.
|
|
2022
|
+
disabled: this.isDisabled,
|
|
1918
2023
|
loading: this.loading ?? false,
|
|
1919
2024
|
size: this.size
|
|
1920
2025
|
});
|
|
@@ -1933,13 +2038,18 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
1933
2038
|
renderStars() {
|
|
1934
2039
|
const stars = [];
|
|
1935
2040
|
for (let i = 1; i <= this.effectiveMax; i++) {
|
|
1936
|
-
stars.push(
|
|
2041
|
+
stars.push(
|
|
2042
|
+
html`<span
|
|
2043
|
+
class="${getRatingStarClasses(i <= this.effectiveValue)}"
|
|
2044
|
+
></span>`
|
|
2045
|
+
);
|
|
1937
2046
|
}
|
|
1938
2047
|
return stars;
|
|
1939
2048
|
}
|
|
1940
2049
|
render() {
|
|
1941
2050
|
const trimmedLabel = this.label?.trim();
|
|
1942
2051
|
return html`<div
|
|
2052
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
1943
2053
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1944
2054
|
aria-label="${this.computedAriaLabel}"
|
|
1945
2055
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
@@ -1950,7 +2060,10 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
1950
2060
|
title="${ifDefined(this.title || void 0)}"
|
|
1951
2061
|
>
|
|
1952
2062
|
<div class="${getRatingStarsClasses()}">${this.renderStars()}</div>
|
|
1953
|
-
${trimmedLabel ? html`<span
|
|
2063
|
+
${trimmedLabel ? html`<span
|
|
2064
|
+
class="${getRatingTextClasses({ disabled: this.isDisabled })}"
|
|
2065
|
+
>${trimmedLabel}</span
|
|
2066
|
+
>` : nothing}
|
|
1954
2067
|
</div>`;
|
|
1955
2068
|
}
|
|
1956
2069
|
};
|
|
@@ -2020,7 +2133,7 @@ var SpectreTestimonialElement = class extends SpectreProjectableElement {
|
|
|
2020
2133
|
}
|
|
2021
2134
|
get testimonialClasses() {
|
|
2022
2135
|
return getTestimonialClasses({
|
|
2023
|
-
disabled: this.
|
|
2136
|
+
disabled: this.isDisabled,
|
|
2024
2137
|
fullHeight: this.fullHeight ?? false,
|
|
2025
2138
|
interactive: this.interactive ?? false,
|
|
2026
2139
|
loading: this.loading ?? false,
|
|
@@ -2029,12 +2142,14 @@ var SpectreTestimonialElement = class extends SpectreProjectableElement {
|
|
|
2029
2142
|
}
|
|
2030
2143
|
render() {
|
|
2031
2144
|
return html`<div
|
|
2145
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2032
2146
|
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2033
2147
|
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2034
2148
|
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2035
2149
|
class="${this.testimonialClasses}"
|
|
2036
2150
|
data-sp-testimonial-native
|
|
2037
2151
|
id="${ifDefined(this.id || void 0)}"
|
|
2152
|
+
role="${ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2038
2153
|
title="${ifDefined(this.title || void 0)}"
|
|
2039
2154
|
>
|
|
2040
2155
|
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
@@ -2056,6 +2171,719 @@ function defineSpectreTestimonial(tagName = "sp-testimonial") {
|
|
|
2056
2171
|
customElements.define(tagName, SpectreTestimonialElement);
|
|
2057
2172
|
return SpectreTestimonialElement;
|
|
2058
2173
|
}
|
|
2174
|
+
var SpectreAlertElement = class extends SpectreProjectableElement {
|
|
2175
|
+
constructor() {
|
|
2176
|
+
super(...arguments);
|
|
2177
|
+
this.dismissed = false;
|
|
2178
|
+
this.disabled = false;
|
|
2179
|
+
this.fullWidth = false;
|
|
2180
|
+
this.loading = false;
|
|
2181
|
+
this.size = "md";
|
|
2182
|
+
this.variant = "info";
|
|
2183
|
+
}
|
|
2184
|
+
get id() {
|
|
2185
|
+
return super.id;
|
|
2186
|
+
}
|
|
2187
|
+
set id(value) {
|
|
2188
|
+
super.id = value;
|
|
2189
|
+
}
|
|
2190
|
+
get title() {
|
|
2191
|
+
return super.title;
|
|
2192
|
+
}
|
|
2193
|
+
set title(value) {
|
|
2194
|
+
super.title = value;
|
|
2195
|
+
}
|
|
2196
|
+
getContentContainer() {
|
|
2197
|
+
return this.querySelector("[data-sp-alert-native]");
|
|
2198
|
+
}
|
|
2199
|
+
isInternalNode(node) {
|
|
2200
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2201
|
+
return false;
|
|
2202
|
+
}
|
|
2203
|
+
const el = node;
|
|
2204
|
+
return el.hasAttribute("data-sp-alert-native");
|
|
2205
|
+
}
|
|
2206
|
+
willUpdate(changedProperties) {
|
|
2207
|
+
if (changedProperties.has("dismissed") && this.dismissed == null) {
|
|
2208
|
+
this.dismissed = false;
|
|
2209
|
+
}
|
|
2210
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2211
|
+
this.disabled = false;
|
|
2212
|
+
}
|
|
2213
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
2214
|
+
this.fullWidth = false;
|
|
2215
|
+
}
|
|
2216
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2217
|
+
this.loading = false;
|
|
2218
|
+
}
|
|
2219
|
+
if (changedProperties.has("variant") && (this.variant == null || !isAlertVariant(this.variant))) {
|
|
2220
|
+
this.variant = "info";
|
|
2221
|
+
}
|
|
2222
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
2223
|
+
this.size = "md";
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
get alertClasses() {
|
|
2227
|
+
return getAlertClasses({
|
|
2228
|
+
disabled: this.isDisabled,
|
|
2229
|
+
dismissed: this.dismissed ?? false,
|
|
2230
|
+
fullWidth: this.fullWidth ?? false,
|
|
2231
|
+
loading: this.loading ?? false,
|
|
2232
|
+
size: this.size,
|
|
2233
|
+
variant: this.variant
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
render() {
|
|
2237
|
+
return html`<div
|
|
2238
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2239
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2240
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2241
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2242
|
+
class="${this.alertClasses}"
|
|
2243
|
+
data-sp-alert-native
|
|
2244
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2245
|
+
role="alert"
|
|
2246
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2247
|
+
>
|
|
2248
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2249
|
+
</div>`;
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
SpectreAlertElement.properties = {
|
|
2253
|
+
dismissed: { type: Boolean, reflect: true },
|
|
2254
|
+
disabled: { type: Boolean, reflect: true },
|
|
2255
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
2256
|
+
loading: { type: Boolean, reflect: true },
|
|
2257
|
+
size: { type: String, reflect: true },
|
|
2258
|
+
variant: { type: String, reflect: true }
|
|
2259
|
+
};
|
|
2260
|
+
function defineSpectreAlert(tagName = "sp-alert") {
|
|
2261
|
+
const existingElement = customElements.get(tagName);
|
|
2262
|
+
if (existingElement) {
|
|
2263
|
+
return existingElement;
|
|
2264
|
+
}
|
|
2265
|
+
customElements.define(tagName, SpectreAlertElement);
|
|
2266
|
+
return SpectreAlertElement;
|
|
2267
|
+
}
|
|
2268
|
+
var SpectreAvatarElement = class extends SpectreProjectableElement {
|
|
2269
|
+
constructor() {
|
|
2270
|
+
super(...arguments);
|
|
2271
|
+
this.disabled = false;
|
|
2272
|
+
this.fullWidth = false;
|
|
2273
|
+
this.interactive = false;
|
|
2274
|
+
this.loading = false;
|
|
2275
|
+
this.placeholder = false;
|
|
2276
|
+
this.shape = "circle";
|
|
2277
|
+
this.size = "md";
|
|
2278
|
+
}
|
|
2279
|
+
get id() {
|
|
2280
|
+
return super.id;
|
|
2281
|
+
}
|
|
2282
|
+
set id(value) {
|
|
2283
|
+
super.id = value;
|
|
2284
|
+
}
|
|
2285
|
+
get title() {
|
|
2286
|
+
return super.title;
|
|
2287
|
+
}
|
|
2288
|
+
set title(value) {
|
|
2289
|
+
super.title = value;
|
|
2290
|
+
}
|
|
2291
|
+
getContentContainer() {
|
|
2292
|
+
return this.querySelector("[data-sp-avatar-native]");
|
|
2293
|
+
}
|
|
2294
|
+
isInternalNode(node) {
|
|
2295
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2296
|
+
return false;
|
|
2297
|
+
}
|
|
2298
|
+
const el = node;
|
|
2299
|
+
return el.hasAttribute("data-sp-avatar-native");
|
|
2300
|
+
}
|
|
2301
|
+
willUpdate(changedProperties) {
|
|
2302
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2303
|
+
this.disabled = false;
|
|
2304
|
+
}
|
|
2305
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
2306
|
+
this.fullWidth = false;
|
|
2307
|
+
}
|
|
2308
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2309
|
+
this.interactive = false;
|
|
2310
|
+
}
|
|
2311
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2312
|
+
this.loading = false;
|
|
2313
|
+
}
|
|
2314
|
+
if (changedProperties.has("placeholder") && this.placeholder == null) {
|
|
2315
|
+
this.placeholder = false;
|
|
2316
|
+
}
|
|
2317
|
+
if (changedProperties.has("shape") && (this.shape == null || !isAvatarShape(this.shape))) {
|
|
2318
|
+
this.shape = "circle";
|
|
2319
|
+
}
|
|
2320
|
+
if (changedProperties.has("size") && (this.size == null || !isAvatarSize(this.size))) {
|
|
2321
|
+
this.size = "md";
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
get avatarClasses() {
|
|
2325
|
+
return getAvatarClasses({
|
|
2326
|
+
disabled: this.isDisabled,
|
|
2327
|
+
fullWidth: this.fullWidth ?? false,
|
|
2328
|
+
interactive: this.interactive ?? false,
|
|
2329
|
+
loading: this.loading ?? false,
|
|
2330
|
+
placeholder: this.placeholder ?? false,
|
|
2331
|
+
shape: this.shape,
|
|
2332
|
+
size: this.size
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
render() {
|
|
2336
|
+
return html`<div
|
|
2337
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2338
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2339
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2340
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2341
|
+
class="${this.avatarClasses}"
|
|
2342
|
+
data-sp-avatar-native
|
|
2343
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2344
|
+
role="${ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2345
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2346
|
+
>
|
|
2347
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2348
|
+
</div>`;
|
|
2349
|
+
}
|
|
2350
|
+
};
|
|
2351
|
+
SpectreAvatarElement.properties = {
|
|
2352
|
+
disabled: { type: Boolean, reflect: true },
|
|
2353
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
2354
|
+
interactive: { type: Boolean, reflect: true },
|
|
2355
|
+
loading: { type: Boolean, reflect: true },
|
|
2356
|
+
placeholder: { type: Boolean, reflect: true },
|
|
2357
|
+
shape: { type: String, reflect: true },
|
|
2358
|
+
size: { type: String, reflect: true }
|
|
2359
|
+
};
|
|
2360
|
+
function defineSpectreAvatar(tagName = "sp-avatar") {
|
|
2361
|
+
const existingElement = customElements.get(tagName);
|
|
2362
|
+
if (existingElement) {
|
|
2363
|
+
return existingElement;
|
|
2364
|
+
}
|
|
2365
|
+
customElements.define(tagName, SpectreAvatarElement);
|
|
2366
|
+
return SpectreAvatarElement;
|
|
2367
|
+
}
|
|
2368
|
+
var SpectreSpinnerElement = class extends SpectreBaseElement {
|
|
2369
|
+
constructor() {
|
|
2370
|
+
super(...arguments);
|
|
2371
|
+
this.disabled = false;
|
|
2372
|
+
this.loading = true;
|
|
2373
|
+
this.size = "md";
|
|
2374
|
+
}
|
|
2375
|
+
get id() {
|
|
2376
|
+
return super.id;
|
|
2377
|
+
}
|
|
2378
|
+
set id(value) {
|
|
2379
|
+
super.id = value;
|
|
2380
|
+
}
|
|
2381
|
+
get title() {
|
|
2382
|
+
return super.title;
|
|
2383
|
+
}
|
|
2384
|
+
set title(value) {
|
|
2385
|
+
super.title = value;
|
|
2386
|
+
}
|
|
2387
|
+
willUpdate(changedProperties) {
|
|
2388
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2389
|
+
this.disabled = false;
|
|
2390
|
+
}
|
|
2391
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2392
|
+
this.loading = true;
|
|
2393
|
+
}
|
|
2394
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
2395
|
+
this.size = "md";
|
|
2396
|
+
}
|
|
2397
|
+
if (changedProperties.has("variant") && this.variant != null && !isSpinnerVariant(this.variant)) {
|
|
2398
|
+
this.variant = void 0;
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
get spinnerClasses() {
|
|
2402
|
+
return getSpinnerClasses({
|
|
2403
|
+
disabled: this.disabled ?? false,
|
|
2404
|
+
loading: this.loading ?? true,
|
|
2405
|
+
size: this.size,
|
|
2406
|
+
...this.variant != null ? { variant: this.variant } : {}
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
get computedAriaLabel() {
|
|
2410
|
+
return this.forwardedAriaLabel ?? "Loading";
|
|
2411
|
+
}
|
|
2412
|
+
render() {
|
|
2413
|
+
return html`<div
|
|
2414
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2415
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2416
|
+
aria-label="${this.computedAriaLabel}"
|
|
2417
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2418
|
+
class="${this.spinnerClasses}"
|
|
2419
|
+
data-sp-spinner-native
|
|
2420
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2421
|
+
role="status"
|
|
2422
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2423
|
+
></div>`;
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
SpectreSpinnerElement.properties = {
|
|
2427
|
+
disabled: { type: Boolean, reflect: true },
|
|
2428
|
+
loading: { type: Boolean, reflect: true },
|
|
2429
|
+
size: { type: String, reflect: true },
|
|
2430
|
+
variant: { type: String, reflect: true }
|
|
2431
|
+
};
|
|
2432
|
+
function defineSpectreSpinner(tagName = "sp-spinner") {
|
|
2433
|
+
const existingElement = customElements.get(tagName);
|
|
2434
|
+
if (existingElement) {
|
|
2435
|
+
return existingElement;
|
|
2436
|
+
}
|
|
2437
|
+
customElements.define(tagName, SpectreSpinnerElement);
|
|
2438
|
+
return SpectreSpinnerElement;
|
|
2439
|
+
}
|
|
2440
|
+
var SpectreTagElement = class extends SpectreProjectableElement {
|
|
2441
|
+
constructor() {
|
|
2442
|
+
super(...arguments);
|
|
2443
|
+
this.dismissible = false;
|
|
2444
|
+
this.disabled = false;
|
|
2445
|
+
this.fullWidth = false;
|
|
2446
|
+
this.interactive = false;
|
|
2447
|
+
this.loading = false;
|
|
2448
|
+
this.selected = false;
|
|
2449
|
+
this.size = "md";
|
|
2450
|
+
this.variant = "default";
|
|
2451
|
+
}
|
|
2452
|
+
get id() {
|
|
2453
|
+
return super.id;
|
|
2454
|
+
}
|
|
2455
|
+
set id(value) {
|
|
2456
|
+
super.id = value;
|
|
2457
|
+
}
|
|
2458
|
+
get title() {
|
|
2459
|
+
return super.title;
|
|
2460
|
+
}
|
|
2461
|
+
set title(value) {
|
|
2462
|
+
super.title = value;
|
|
2463
|
+
}
|
|
2464
|
+
getContentContainer() {
|
|
2465
|
+
return this.querySelector("[data-sp-tag-native]");
|
|
2466
|
+
}
|
|
2467
|
+
isInternalNode(node) {
|
|
2468
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2469
|
+
return false;
|
|
2470
|
+
}
|
|
2471
|
+
const el = node;
|
|
2472
|
+
return el.hasAttribute("data-sp-tag-native");
|
|
2473
|
+
}
|
|
2474
|
+
willUpdate(changedProperties) {
|
|
2475
|
+
if (changedProperties.has("dismissible") && this.dismissible == null) {
|
|
2476
|
+
this.dismissible = false;
|
|
2477
|
+
}
|
|
2478
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2479
|
+
this.disabled = false;
|
|
2480
|
+
}
|
|
2481
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
2482
|
+
this.fullWidth = false;
|
|
2483
|
+
}
|
|
2484
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2485
|
+
this.interactive = false;
|
|
2486
|
+
}
|
|
2487
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2488
|
+
this.loading = false;
|
|
2489
|
+
}
|
|
2490
|
+
if (changedProperties.has("selected") && this.selected == null) {
|
|
2491
|
+
this.selected = false;
|
|
2492
|
+
}
|
|
2493
|
+
if (changedProperties.has("size") && (this.size == null || !isInputSize(this.size))) {
|
|
2494
|
+
this.size = "md";
|
|
2495
|
+
}
|
|
2496
|
+
if (changedProperties.has("variant") && (this.variant == null || !isTagVariant(this.variant))) {
|
|
2497
|
+
this.variant = "default";
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
get tagClasses() {
|
|
2501
|
+
return getTagClasses({
|
|
2502
|
+
disabled: this.isDisabled,
|
|
2503
|
+
dismissible: this.dismissible ?? false,
|
|
2504
|
+
fullWidth: this.fullWidth ?? false,
|
|
2505
|
+
interactive: this.interactive ?? false,
|
|
2506
|
+
loading: this.loading ?? false,
|
|
2507
|
+
selected: this.selected ?? false,
|
|
2508
|
+
size: this.size,
|
|
2509
|
+
variant: this.variant
|
|
2510
|
+
});
|
|
2511
|
+
}
|
|
2512
|
+
render() {
|
|
2513
|
+
return html`<span
|
|
2514
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2515
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2516
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2517
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2518
|
+
class="${this.tagClasses}"
|
|
2519
|
+
data-sp-tag-native
|
|
2520
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2521
|
+
role="${ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2522
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2523
|
+
>
|
|
2524
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2525
|
+
</span>`;
|
|
2526
|
+
}
|
|
2527
|
+
};
|
|
2528
|
+
SpectreTagElement.properties = {
|
|
2529
|
+
dismissible: { type: Boolean, reflect: true },
|
|
2530
|
+
disabled: { type: Boolean, reflect: true },
|
|
2531
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
2532
|
+
interactive: { type: Boolean, reflect: true },
|
|
2533
|
+
loading: { type: Boolean, reflect: true },
|
|
2534
|
+
selected: { type: Boolean, reflect: true },
|
|
2535
|
+
size: { type: String, reflect: true },
|
|
2536
|
+
variant: { type: String, reflect: true }
|
|
2537
|
+
};
|
|
2538
|
+
function defineSpectreTag(tagName = "sp-tag") {
|
|
2539
|
+
const existingElement = customElements.get(tagName);
|
|
2540
|
+
if (existingElement) {
|
|
2541
|
+
return existingElement;
|
|
2542
|
+
}
|
|
2543
|
+
customElements.define(tagName, SpectreTagElement);
|
|
2544
|
+
return SpectreTagElement;
|
|
2545
|
+
}
|
|
2546
|
+
var SpectrePricingCardElement = class extends SpectreProjectableElement {
|
|
2547
|
+
constructor() {
|
|
2548
|
+
super(...arguments);
|
|
2549
|
+
this.disabled = false;
|
|
2550
|
+
this.featured = false;
|
|
2551
|
+
this.fullHeight = false;
|
|
2552
|
+
this.interactive = false;
|
|
2553
|
+
this.loading = false;
|
|
2554
|
+
}
|
|
2555
|
+
get id() {
|
|
2556
|
+
return super.id;
|
|
2557
|
+
}
|
|
2558
|
+
set id(value) {
|
|
2559
|
+
super.id = value;
|
|
2560
|
+
}
|
|
2561
|
+
get title() {
|
|
2562
|
+
return super.title;
|
|
2563
|
+
}
|
|
2564
|
+
set title(value) {
|
|
2565
|
+
super.title = value;
|
|
2566
|
+
}
|
|
2567
|
+
getContentContainer() {
|
|
2568
|
+
return this.querySelector("[data-sp-pricing-card-native]");
|
|
2569
|
+
}
|
|
2570
|
+
isInternalNode(node) {
|
|
2571
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2572
|
+
return false;
|
|
2573
|
+
}
|
|
2574
|
+
const el = node;
|
|
2575
|
+
return el.hasAttribute("data-sp-pricing-card-native");
|
|
2576
|
+
}
|
|
2577
|
+
willUpdate(changedProperties) {
|
|
2578
|
+
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
2579
|
+
this.disabled = false;
|
|
2580
|
+
}
|
|
2581
|
+
if (changedProperties.has("featured") && this.featured == null) {
|
|
2582
|
+
this.featured = false;
|
|
2583
|
+
}
|
|
2584
|
+
if (changedProperties.has("fullHeight") && this.fullHeight == null) {
|
|
2585
|
+
this.fullHeight = false;
|
|
2586
|
+
}
|
|
2587
|
+
if (changedProperties.has("interactive") && this.interactive == null) {
|
|
2588
|
+
this.interactive = false;
|
|
2589
|
+
}
|
|
2590
|
+
if (changedProperties.has("loading") && this.loading == null) {
|
|
2591
|
+
this.loading = false;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
get pricingCardClasses() {
|
|
2595
|
+
return getPricingCardClasses({
|
|
2596
|
+
disabled: this.isDisabled,
|
|
2597
|
+
featured: this.featured ?? false,
|
|
2598
|
+
fullHeight: this.fullHeight ?? false,
|
|
2599
|
+
interactive: this.interactive ?? false,
|
|
2600
|
+
loading: this.loading ?? false
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
render() {
|
|
2604
|
+
return html`<div
|
|
2605
|
+
aria-busy="${this.loading ? "true" : "false"}"
|
|
2606
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2607
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2608
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2609
|
+
class="${this.pricingCardClasses}"
|
|
2610
|
+
data-sp-pricing-card-native
|
|
2611
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2612
|
+
role="${ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2613
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2614
|
+
>
|
|
2615
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2616
|
+
</div>`;
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
SpectrePricingCardElement.properties = {
|
|
2620
|
+
disabled: { type: Boolean, reflect: true },
|
|
2621
|
+
featured: { type: Boolean, reflect: true },
|
|
2622
|
+
fullHeight: { attribute: "full-height", type: Boolean, reflect: true },
|
|
2623
|
+
interactive: { type: Boolean, reflect: true },
|
|
2624
|
+
loading: { type: Boolean, reflect: true }
|
|
2625
|
+
};
|
|
2626
|
+
function defineSpectrePricingCard(tagName = "sp-pricing-card") {
|
|
2627
|
+
const existingElement = customElements.get(tagName);
|
|
2628
|
+
if (existingElement) {
|
|
2629
|
+
return existingElement;
|
|
2630
|
+
}
|
|
2631
|
+
customElements.define(tagName, SpectrePricingCardElement);
|
|
2632
|
+
return SpectrePricingCardElement;
|
|
2633
|
+
}
|
|
2634
|
+
var SpectreContainerElement = class extends SpectreProjectableElement {
|
|
2635
|
+
constructor() {
|
|
2636
|
+
super(...arguments);
|
|
2637
|
+
this.maxWidth = void 0;
|
|
2638
|
+
}
|
|
2639
|
+
get id() {
|
|
2640
|
+
return super.id;
|
|
2641
|
+
}
|
|
2642
|
+
set id(value) {
|
|
2643
|
+
super.id = value;
|
|
2644
|
+
}
|
|
2645
|
+
get title() {
|
|
2646
|
+
return super.title;
|
|
2647
|
+
}
|
|
2648
|
+
set title(value) {
|
|
2649
|
+
super.title = value;
|
|
2650
|
+
}
|
|
2651
|
+
getContentContainer() {
|
|
2652
|
+
return this.querySelector("[data-sp-container-native]");
|
|
2653
|
+
}
|
|
2654
|
+
isInternalNode(node) {
|
|
2655
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2656
|
+
return false;
|
|
2657
|
+
}
|
|
2658
|
+
const el = node;
|
|
2659
|
+
return el.hasAttribute("data-sp-container-native");
|
|
2660
|
+
}
|
|
2661
|
+
willUpdate(changedProperties) {
|
|
2662
|
+
if (changedProperties.has("maxWidth") && this.maxWidth != null && !isContainerMaxWidth(this.maxWidth)) {
|
|
2663
|
+
this.maxWidth = void 0;
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
get containerClasses() {
|
|
2667
|
+
return getContainerClasses(
|
|
2668
|
+
this.maxWidth != null ? { maxWidth: this.maxWidth } : {}
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2671
|
+
render() {
|
|
2672
|
+
return html`<div
|
|
2673
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2674
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2675
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2676
|
+
class="${this.containerClasses}"
|
|
2677
|
+
data-sp-container-native
|
|
2678
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2679
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2680
|
+
>
|
|
2681
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2682
|
+
</div>`;
|
|
2683
|
+
}
|
|
2684
|
+
};
|
|
2685
|
+
SpectreContainerElement.properties = {
|
|
2686
|
+
maxWidth: { attribute: "max-width", type: String, reflect: true }
|
|
2687
|
+
};
|
|
2688
|
+
function defineSpectreContainer(tagName = "sp-container") {
|
|
2689
|
+
const existingElement = customElements.get(tagName);
|
|
2690
|
+
if (existingElement) {
|
|
2691
|
+
return existingElement;
|
|
2692
|
+
}
|
|
2693
|
+
customElements.define(tagName, SpectreContainerElement);
|
|
2694
|
+
return SpectreContainerElement;
|
|
2695
|
+
}
|
|
2696
|
+
var SpectreGridElement = class extends SpectreProjectableElement {
|
|
2697
|
+
constructor() {
|
|
2698
|
+
super(...arguments);
|
|
2699
|
+
this.columns = 1;
|
|
2700
|
+
this.gap = "md";
|
|
2701
|
+
}
|
|
2702
|
+
get id() {
|
|
2703
|
+
return super.id;
|
|
2704
|
+
}
|
|
2705
|
+
set id(value) {
|
|
2706
|
+
super.id = value;
|
|
2707
|
+
}
|
|
2708
|
+
get title() {
|
|
2709
|
+
return super.title;
|
|
2710
|
+
}
|
|
2711
|
+
set title(value) {
|
|
2712
|
+
super.title = value;
|
|
2713
|
+
}
|
|
2714
|
+
getContentContainer() {
|
|
2715
|
+
return this.querySelector("[data-sp-grid-native]");
|
|
2716
|
+
}
|
|
2717
|
+
isInternalNode(node) {
|
|
2718
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2719
|
+
return false;
|
|
2720
|
+
}
|
|
2721
|
+
const el = node;
|
|
2722
|
+
return el.hasAttribute("data-sp-grid-native");
|
|
2723
|
+
}
|
|
2724
|
+
willUpdate(changedProperties) {
|
|
2725
|
+
if (changedProperties.has("columns")) {
|
|
2726
|
+
const normalized = normalizeInt(this.columns, void 0, 1);
|
|
2727
|
+
this.columns = normalized != null && isGridColumns(normalized) ? normalized : 1;
|
|
2728
|
+
}
|
|
2729
|
+
if (changedProperties.has("gap") && (this.gap == null || !isGridGap(this.gap))) {
|
|
2730
|
+
this.gap = "md";
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
get gridClasses() {
|
|
2734
|
+
return getGridClasses({
|
|
2735
|
+
columns: this.columns,
|
|
2736
|
+
gap: this.gap
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
render() {
|
|
2740
|
+
return html`<div
|
|
2741
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2742
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2743
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2744
|
+
class="${this.gridClasses}"
|
|
2745
|
+
data-sp-grid-native
|
|
2746
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2747
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2748
|
+
>
|
|
2749
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2750
|
+
</div>`;
|
|
2751
|
+
}
|
|
2752
|
+
};
|
|
2753
|
+
SpectreGridElement.properties = {
|
|
2754
|
+
columns: { type: Number, reflect: true },
|
|
2755
|
+
gap: { type: String, reflect: true }
|
|
2756
|
+
};
|
|
2757
|
+
function defineSpectreGrid(tagName = "sp-grid") {
|
|
2758
|
+
const existingElement = customElements.get(tagName);
|
|
2759
|
+
if (existingElement) {
|
|
2760
|
+
return existingElement;
|
|
2761
|
+
}
|
|
2762
|
+
customElements.define(tagName, SpectreGridElement);
|
|
2763
|
+
return SpectreGridElement;
|
|
2764
|
+
}
|
|
2765
|
+
var SpectreSectionElement = class extends SpectreProjectableElement {
|
|
2766
|
+
get id() {
|
|
2767
|
+
return super.id;
|
|
2768
|
+
}
|
|
2769
|
+
set id(value) {
|
|
2770
|
+
super.id = value;
|
|
2771
|
+
}
|
|
2772
|
+
get title() {
|
|
2773
|
+
return super.title;
|
|
2774
|
+
}
|
|
2775
|
+
set title(value) {
|
|
2776
|
+
super.title = value;
|
|
2777
|
+
}
|
|
2778
|
+
getContentContainer() {
|
|
2779
|
+
return this.querySelector("[data-sp-section-native]");
|
|
2780
|
+
}
|
|
2781
|
+
isInternalNode(node) {
|
|
2782
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2783
|
+
return false;
|
|
2784
|
+
}
|
|
2785
|
+
const el = node;
|
|
2786
|
+
return el.hasAttribute("data-sp-section-native");
|
|
2787
|
+
}
|
|
2788
|
+
get sectionClasses() {
|
|
2789
|
+
return getSectionClasses({});
|
|
2790
|
+
}
|
|
2791
|
+
render() {
|
|
2792
|
+
return html`<section
|
|
2793
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2794
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2795
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2796
|
+
class="${this.sectionClasses}"
|
|
2797
|
+
data-sp-section-native
|
|
2798
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2799
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2800
|
+
>
|
|
2801
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2802
|
+
</section>`;
|
|
2803
|
+
}
|
|
2804
|
+
};
|
|
2805
|
+
function defineSpectreSection(tagName = "sp-section") {
|
|
2806
|
+
const existingElement = customElements.get(tagName);
|
|
2807
|
+
if (existingElement) {
|
|
2808
|
+
return existingElement;
|
|
2809
|
+
}
|
|
2810
|
+
customElements.define(tagName, SpectreSectionElement);
|
|
2811
|
+
return SpectreSectionElement;
|
|
2812
|
+
}
|
|
2813
|
+
var SpectreStackElement = class extends SpectreProjectableElement {
|
|
2814
|
+
constructor() {
|
|
2815
|
+
super(...arguments);
|
|
2816
|
+
this.align = "center";
|
|
2817
|
+
this.basis = void 0;
|
|
2818
|
+
this.direction = "vertical";
|
|
2819
|
+
}
|
|
2820
|
+
get id() {
|
|
2821
|
+
return super.id;
|
|
2822
|
+
}
|
|
2823
|
+
set id(value) {
|
|
2824
|
+
super.id = value;
|
|
2825
|
+
}
|
|
2826
|
+
get title() {
|
|
2827
|
+
return super.title;
|
|
2828
|
+
}
|
|
2829
|
+
set title(value) {
|
|
2830
|
+
super.title = value;
|
|
2831
|
+
}
|
|
2832
|
+
getContentContainer() {
|
|
2833
|
+
return this.querySelector("[data-sp-stack-native]");
|
|
2834
|
+
}
|
|
2835
|
+
isInternalNode(node) {
|
|
2836
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2837
|
+
return false;
|
|
2838
|
+
}
|
|
2839
|
+
const el = node;
|
|
2840
|
+
return el.hasAttribute("data-sp-stack-native");
|
|
2841
|
+
}
|
|
2842
|
+
willUpdate(changedProperties) {
|
|
2843
|
+
if (changedProperties.has("direction") && (this.direction == null || !isStackDirection(this.direction))) {
|
|
2844
|
+
this.direction = "vertical";
|
|
2845
|
+
}
|
|
2846
|
+
if (changedProperties.has("basis") && this.basis != null && !isStackBasis(this.basis)) {
|
|
2847
|
+
this.basis = void 0;
|
|
2848
|
+
}
|
|
2849
|
+
if (changedProperties.has("align") && (this.align == null || !isStackAlign(this.align))) {
|
|
2850
|
+
this.align = "center";
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
get stackClasses() {
|
|
2854
|
+
return getStackClasses({
|
|
2855
|
+
align: this.align,
|
|
2856
|
+
direction: this.direction,
|
|
2857
|
+
...this.basis != null ? { basis: this.basis } : {}
|
|
2858
|
+
});
|
|
2859
|
+
}
|
|
2860
|
+
render() {
|
|
2861
|
+
return html`<div
|
|
2862
|
+
aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2863
|
+
aria-label="${ifDefined(this.forwardedAriaLabel)}"
|
|
2864
|
+
aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2865
|
+
class="${this.stackClasses}"
|
|
2866
|
+
data-sp-stack-native
|
|
2867
|
+
id="${ifDefined(this.id || void 0)}"
|
|
2868
|
+
title="${ifDefined(this.title || void 0)}"
|
|
2869
|
+
>
|
|
2870
|
+
${this.hasProjectedContent ? this.projectedContent : nothing}
|
|
2871
|
+
</div>`;
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
SpectreStackElement.properties = {
|
|
2875
|
+
align: { type: String, reflect: true },
|
|
2876
|
+
basis: { type: String, reflect: true },
|
|
2877
|
+
direction: { type: String, reflect: true }
|
|
2878
|
+
};
|
|
2879
|
+
function defineSpectreStack(tagName = "sp-stack") {
|
|
2880
|
+
const existingElement = customElements.get(tagName);
|
|
2881
|
+
if (existingElement) {
|
|
2882
|
+
return existingElement;
|
|
2883
|
+
}
|
|
2884
|
+
customElements.define(tagName, SpectreStackElement);
|
|
2885
|
+
return SpectreStackElement;
|
|
2886
|
+
}
|
|
2059
2887
|
|
|
2060
2888
|
// src/index.ts
|
|
2061
2889
|
function defineSpectreComponents() {
|
|
@@ -2072,8 +2900,17 @@ function defineSpectreComponents() {
|
|
|
2072
2900
|
defineSpectreIconBox();
|
|
2073
2901
|
defineSpectreRating();
|
|
2074
2902
|
defineSpectreTestimonial();
|
|
2903
|
+
defineSpectreAlert();
|
|
2904
|
+
defineSpectreAvatar();
|
|
2905
|
+
defineSpectreSpinner();
|
|
2906
|
+
defineSpectreTag();
|
|
2907
|
+
defineSpectrePricingCard();
|
|
2908
|
+
defineSpectreContainer();
|
|
2909
|
+
defineSpectreGrid();
|
|
2910
|
+
defineSpectreSection();
|
|
2911
|
+
defineSpectreStack();
|
|
2075
2912
|
}
|
|
2076
2913
|
|
|
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 };
|
|
2914
|
+
export { SpectreAlertElement, SpectreAvatarElement, SpectreBadgeElement, SpectreButtonElement, SpectreCardElement, SpectreCheckboxElement, SpectreContainerElement, SpectreFieldsetElement, SpectreGridElement, SpectreIconBoxElement, SpectreInputElement, SpectreLabelElement, SpectrePricingCardElement, SpectreRadioElement, SpectreRatingElement, SpectreSectionElement, SpectreSelectElement, SpectreSpinnerElement, SpectreStackElement, SpectreTagElement, SpectreTestimonialElement, SpectreTextareaElement, defineSpectreAlert, defineSpectreAvatar, defineSpectreBadge, defineSpectreButton, defineSpectreCard, defineSpectreCheckbox, defineSpectreComponents, defineSpectreContainer, defineSpectreFieldset, defineSpectreGrid, defineSpectreIconBox, defineSpectreInput, defineSpectreLabel, defineSpectrePricingCard, defineSpectreRadio, defineSpectreRating, defineSpectreSection, defineSpectreSelect, defineSpectreSpinner, defineSpectreStack, defineSpectreTag, defineSpectreTestimonial, defineSpectreTextarea, spectreInputSizes as spectreAlertSizes, spectreAlertVariants, spectreAvatarShapes, spectreAvatarSizes, spectreInputSizes as spectreBadgeSizes, spectreBadgeVariants, spectreInputSizes as spectreButtonSizes, spectreButtonTypes, spectreButtonVariants, spectreCardVariants, spectreContainerMaxWidths, spectreGridColumns, spectreGridGaps, spectreInputSizes as spectreIconBoxSizes, spectreIconBoxVariants, spectreInputSizes, spectreInputTypes, spectreInputSizes as spectreRatingSizes, spectreInputSizes as spectreSpinnerSizes, spectreSpinnerVariants, spectreStackAligns, spectreStackBases, spectreStackDirections, spectreInputSizes as spectreTagSizes, spectreTagVariants, spectreTestimonialVariants };
|
|
2078
2915
|
//# sourceMappingURL=index.js.map
|
|
2079
2916
|
//# sourceMappingURL=index.js.map
|