@phcdevworks/spectre-components 1.5.0 → 1.7.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 +291 -2
- package/dist/alert.cjs +10 -3
- package/dist/alert.cjs.map +1 -1
- package/dist/alert.d.cts +4 -5
- package/dist/alert.d.ts +4 -5
- package/dist/alert.js +10 -3
- package/dist/alert.js.map +1 -1
- package/dist/avatar.cjs +11 -3
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.d.cts +4 -5
- package/dist/avatar.d.ts +4 -5
- package/dist/avatar.js +11 -3
- package/dist/avatar.js.map +1 -1
- package/dist/badge.cjs +11 -3
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.d.cts +4 -5
- package/dist/badge.d.ts +4 -5
- package/dist/badge.js +11 -3
- 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 +11 -3
- package/dist/card.cjs.map +1 -1
- package/dist/card.d.cts +4 -5
- package/dist/card.d.ts +4 -5
- package/dist/card.js +11 -3
- 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/dropdown.cjs +486 -0
- package/dist/dropdown.cjs.map +1 -0
- package/dist/dropdown.d.cts +69 -0
- package/dist/dropdown.d.ts +69 -0
- package/dist/dropdown.js +482 -0
- package/dist/dropdown.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-DgzRhNmg.d.cts +46 -0
- package/dist/form-DgzRhNmg.d.ts +46 -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 +11 -3
- package/dist/icon-box.cjs.map +1 -1
- package/dist/icon-box.d.cts +4 -5
- package/dist/icon-box.d.ts +4 -5
- package/dist/icon-box.js +11 -3
- package/dist/icon-box.js.map +1 -1
- package/dist/index.cjs +1286 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +1259 -68
- 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/modal.cjs +519 -0
- package/dist/modal.cjs.map +1 -0
- package/dist/modal.d.cts +52 -0
- package/dist/modal.d.ts +52 -0
- package/dist/modal.js +516 -0
- package/dist/modal.js.map +1 -0
- package/dist/nav.cjs +424 -0
- package/dist/nav.cjs.map +1 -0
- package/dist/nav.d.cts +45 -0
- package/dist/nav.d.ts +45 -0
- package/dist/nav.js +421 -0
- package/dist/nav.js.map +1 -0
- package/dist/pricing-card.cjs +11 -3
- package/dist/pricing-card.cjs.map +1 -1
- package/dist/pricing-card.d.cts +2 -3
- package/dist/pricing-card.d.ts +2 -3
- package/dist/pricing-card.js +11 -3
- package/dist/pricing-card.js.map +1 -1
- 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 +19 -5
- package/dist/rating.cjs.map +1 -1
- package/dist/rating.d.cts +3 -4
- package/dist/rating.d.ts +3 -4
- package/dist/rating.js +19 -5
- 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/sidebar.cjs +481 -0
- package/dist/sidebar.cjs.map +1 -0
- package/dist/sidebar.d.cts +50 -0
- package/dist/sidebar.d.ts +50 -0
- package/dist/sidebar.js +478 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/spinner.cjs +10 -0
- package/dist/spinner.cjs.map +1 -1
- package/dist/spinner.d.cts +3 -3
- package/dist/spinner.d.ts +3 -3
- package/dist/spinner.js +10 -0
- package/dist/spinner.js.map +1 -1
- 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 +11 -3
- package/dist/tag.cjs.map +1 -1
- package/dist/tag.d.cts +4 -5
- package/dist/tag.d.ts +4 -5
- package/dist/tag.js +11 -3
- package/dist/tag.js.map +1 -1
- package/dist/testimonial.cjs +11 -3
- package/dist/testimonial.cjs.map +1 -1
- package/dist/testimonial.d.cts +4 -5
- package/dist/testimonial.d.ts +4 -5
- package/dist/testimonial.js +11 -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/dist/toast.cjs +475 -0
- package/dist/toast.cjs.map +1 -0
- package/dist/toast.d.cts +68 -0
- package/dist/toast.d.ts +68 -0
- package/dist/toast.js +471 -0
- package/dist/toast.js.map +1 -0
- package/dist/tooltip.cjs +444 -0
- package/dist/tooltip.cjs.map +1 -0
- package/dist/tooltip.d.cts +50 -0
- package/dist/tooltip.d.ts +50 -0
- package/dist/tooltip.js +440 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +71 -16
- package/dist/form-BumNzIay.d.cts +0 -28
- package/dist/form-BumNzIay.d.ts +0 -28
package/dist/index.cjs
CHANGED
|
@@ -144,6 +144,65 @@ var spectreAvatarShapes = ["circle", "square"];
|
|
|
144
144
|
function isAvatarShape(value) {
|
|
145
145
|
return spectreAvatarShapes.includes(value);
|
|
146
146
|
}
|
|
147
|
+
var spectreContainerMaxWidths = ["prose"];
|
|
148
|
+
function isContainerMaxWidth(value) {
|
|
149
|
+
return spectreContainerMaxWidths.includes(
|
|
150
|
+
value
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
var spectreGridColumns = [1, 2, 3, 4, 6, 12];
|
|
154
|
+
function isGridColumns(value) {
|
|
155
|
+
return spectreGridColumns.includes(value);
|
|
156
|
+
}
|
|
157
|
+
var spectreGridGaps = ["sm", "md", "lg"];
|
|
158
|
+
function isGridGap(value) {
|
|
159
|
+
return spectreGridGaps.includes(value);
|
|
160
|
+
}
|
|
161
|
+
var spectreStackDirections = ["vertical", "horizontal"];
|
|
162
|
+
function isStackDirection(value) {
|
|
163
|
+
return spectreStackDirections.includes(
|
|
164
|
+
value
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
var spectreStackBases = ["sidebar"];
|
|
168
|
+
function isStackBasis(value) {
|
|
169
|
+
return spectreStackBases.includes(value);
|
|
170
|
+
}
|
|
171
|
+
var spectreStackAligns = ["center", "stretch"];
|
|
172
|
+
function isStackAlign(value) {
|
|
173
|
+
return spectreStackAligns.includes(value);
|
|
174
|
+
}
|
|
175
|
+
var spectreDropdownPlacements = [
|
|
176
|
+
"bottom-start",
|
|
177
|
+
"bottom-end",
|
|
178
|
+
"top-start",
|
|
179
|
+
"top-end"
|
|
180
|
+
];
|
|
181
|
+
function isDropdownPlacement(value) {
|
|
182
|
+
return spectreDropdownPlacements.includes(
|
|
183
|
+
value
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
var spectreToastVariants = [
|
|
187
|
+
"info",
|
|
188
|
+
"success",
|
|
189
|
+
"warning",
|
|
190
|
+
"danger"
|
|
191
|
+
];
|
|
192
|
+
function isToastVariant(value) {
|
|
193
|
+
return spectreToastVariants.includes(value);
|
|
194
|
+
}
|
|
195
|
+
var spectreTooltipPlacements = [
|
|
196
|
+
"top",
|
|
197
|
+
"bottom",
|
|
198
|
+
"left",
|
|
199
|
+
"right"
|
|
200
|
+
];
|
|
201
|
+
function isTooltipPlacement(value) {
|
|
202
|
+
return spectreTooltipPlacements.includes(
|
|
203
|
+
value
|
|
204
|
+
);
|
|
205
|
+
}
|
|
147
206
|
function normalizeInt(value, fallback, min = 0) {
|
|
148
207
|
if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
|
|
149
208
|
return fallback;
|
|
@@ -400,6 +459,16 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
400
459
|
const value = this.ariaDescribedBy?.trim();
|
|
401
460
|
return value ? value : void 0;
|
|
402
461
|
}
|
|
462
|
+
// Subclasses that expose `disabled`/`loading` properties get this disabled
|
|
463
|
+
// calculation for free instead of redeclaring it per component.
|
|
464
|
+
get isDisabled() {
|
|
465
|
+
const self = this;
|
|
466
|
+
return (self.disabled ?? false) || (self.loading ?? false);
|
|
467
|
+
}
|
|
468
|
+
// Subclasses get this for free instead of redeclaring it per component.
|
|
469
|
+
get hasForwardedLabel() {
|
|
470
|
+
return Boolean(this.forwardedAriaLabel || this.forwardedAriaLabelledBy);
|
|
471
|
+
}
|
|
403
472
|
};
|
|
404
473
|
SpectreBaseElement.properties = {};
|
|
405
474
|
|
|
@@ -567,9 +636,6 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
567
636
|
variant: this.variant
|
|
568
637
|
});
|
|
569
638
|
}
|
|
570
|
-
get isDisabled() {
|
|
571
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
572
|
-
}
|
|
573
639
|
get visibleLabelFallback() {
|
|
574
640
|
const trimmedLabel = this.label?.trim();
|
|
575
641
|
return trimmedLabel ? trimmedLabel : void 0;
|
|
@@ -585,7 +651,8 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
585
651
|
return lit.html`<span
|
|
586
652
|
class="${spectreUi.getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
587
653
|
data-sp-button-loading-label
|
|
588
|
-
|
|
654
|
+
>${this.loadingLabel}</span
|
|
655
|
+
>`;
|
|
589
656
|
}
|
|
590
657
|
if (this.hasProjectedContent) {
|
|
591
658
|
return this.projectedContent;
|
|
@@ -593,7 +660,8 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
|
|
|
593
660
|
return this.visibleLabelFallback ? lit.html`<span
|
|
594
661
|
class="${spectreUi.getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
595
662
|
data-sp-button-label-fallback
|
|
596
|
-
|
|
663
|
+
>${this.visibleLabelFallback}</span
|
|
664
|
+
>` : lit.nothing;
|
|
597
665
|
}
|
|
598
666
|
render() {
|
|
599
667
|
return lit.html`<button
|
|
@@ -733,9 +801,6 @@ var SpectreInputElement = class extends SpectreBaseElement {
|
|
|
733
801
|
state: this.isDisabled ? this.disabled ? "disabled" : "loading" : this.invalid ? "error" : this.success ? "success" : "default"
|
|
734
802
|
});
|
|
735
803
|
}
|
|
736
|
-
get isDisabled() {
|
|
737
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
738
|
-
}
|
|
739
804
|
get nativeInput() {
|
|
740
805
|
return this.querySelector("[data-sp-input-native]");
|
|
741
806
|
}
|
|
@@ -912,16 +977,15 @@ var SpectreTextareaElement = class extends SpectreBaseElement {
|
|
|
912
977
|
}
|
|
913
978
|
}
|
|
914
979
|
get textareaClasses() {
|
|
915
|
-
return spectreUi.
|
|
980
|
+
return spectreUi.getTextareaClasses({
|
|
916
981
|
fullWidth: this.fullWidth ?? false,
|
|
917
982
|
pill: this.pill ?? false,
|
|
918
983
|
size: this.size,
|
|
919
|
-
|
|
984
|
+
disabled: this.disabled ?? false,
|
|
985
|
+
loading: this.loading ?? false,
|
|
986
|
+
state: this.invalid ? "invalid" : this.success ? "success" : "default"
|
|
920
987
|
});
|
|
921
988
|
}
|
|
922
|
-
get isDisabled() {
|
|
923
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
924
|
-
}
|
|
925
989
|
get nativeTextarea() {
|
|
926
990
|
return this.querySelector("[data-sp-textarea-native]");
|
|
927
991
|
}
|
|
@@ -1107,16 +1171,15 @@ var SpectreSelectElement = class extends SpectreProjectableElement {
|
|
|
1107
1171
|
}
|
|
1108
1172
|
}
|
|
1109
1173
|
get selectClasses() {
|
|
1110
|
-
return spectreUi.
|
|
1174
|
+
return spectreUi.getSelectClasses({
|
|
1111
1175
|
fullWidth: this.fullWidth ?? false,
|
|
1112
1176
|
pill: this.pill ?? false,
|
|
1113
1177
|
size: this.size,
|
|
1114
|
-
|
|
1178
|
+
disabled: this.disabled ?? false,
|
|
1179
|
+
loading: this.loading ?? false,
|
|
1180
|
+
state: this.invalid ? "invalid" : this.success ? "success" : "default"
|
|
1115
1181
|
});
|
|
1116
1182
|
}
|
|
1117
|
-
get isDisabled() {
|
|
1118
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1119
|
-
}
|
|
1120
1183
|
handleInput(event) {
|
|
1121
1184
|
const select = event.currentTarget;
|
|
1122
1185
|
this.value = select.value;
|
|
@@ -1245,9 +1308,6 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1245
1308
|
get nativeInput() {
|
|
1246
1309
|
return this.querySelector("[data-sp-checkbox-native]");
|
|
1247
1310
|
}
|
|
1248
|
-
get isDisabled() {
|
|
1249
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1250
|
-
}
|
|
1251
1311
|
get visibleLabelFallback() {
|
|
1252
1312
|
const trimmedLabel = this.label?.trim();
|
|
1253
1313
|
return trimmedLabel ? trimmedLabel : void 0;
|
|
@@ -1270,7 +1330,8 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1270
1330
|
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? lit.html`<span
|
|
1271
1331
|
class="${spectreUi.getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
1272
1332
|
data-sp-checkbox-label-fallback
|
|
1273
|
-
|
|
1333
|
+
>${this.visibleLabelFallback}</span
|
|
1334
|
+
>` : lit.nothing;
|
|
1274
1335
|
return lit.html`<label data-sp-checkbox-label>
|
|
1275
1336
|
<input
|
|
1276
1337
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -1292,7 +1353,10 @@ var SpectreCheckboxElement = class extends SpectreProjectableElement {
|
|
|
1292
1353
|
@change="${this.handleChange}"
|
|
1293
1354
|
@input="${this.handleInput}"
|
|
1294
1355
|
/>
|
|
1295
|
-
<span
|
|
1356
|
+
<span
|
|
1357
|
+
class="${spectreUi.getCheckboxClasses({ checked: this.checked ?? false, disabled: this.isDisabled })}"
|
|
1358
|
+
data-sp-checkbox-indicator
|
|
1359
|
+
></span>
|
|
1296
1360
|
${labelContent}
|
|
1297
1361
|
</label>`;
|
|
1298
1362
|
}
|
|
@@ -1382,9 +1446,6 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1382
1446
|
get nativeInput() {
|
|
1383
1447
|
return this.querySelector("[data-sp-radio-native]");
|
|
1384
1448
|
}
|
|
1385
|
-
get isDisabled() {
|
|
1386
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1387
|
-
}
|
|
1388
1449
|
get visibleLabelFallback() {
|
|
1389
1450
|
const trimmedLabel = this.label?.trim();
|
|
1390
1451
|
return trimmedLabel ? trimmedLabel : void 0;
|
|
@@ -1427,7 +1488,8 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1427
1488
|
const labelContent = this.hasProjectedContent ? this.projectedContent : this.visibleLabelFallback ? lit.html`<span
|
|
1428
1489
|
class="${spectreUi.getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
1429
1490
|
data-sp-radio-label-fallback
|
|
1430
|
-
|
|
1491
|
+
>${this.visibleLabelFallback}</span
|
|
1492
|
+
>` : lit.nothing;
|
|
1431
1493
|
return lit.html`<label data-sp-radio-label>
|
|
1432
1494
|
<input
|
|
1433
1495
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -1449,7 +1511,10 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
|
|
|
1449
1511
|
@change="${this.handleChange}"
|
|
1450
1512
|
@input="${this.handleInput}"
|
|
1451
1513
|
/>
|
|
1452
|
-
<span
|
|
1514
|
+
<span
|
|
1515
|
+
class="${spectreUi.getRadioClasses({ checked: this.checked ?? false, disabled: this.isDisabled })}"
|
|
1516
|
+
data-sp-radio-indicator
|
|
1517
|
+
></span>
|
|
1453
1518
|
${labelContent}
|
|
1454
1519
|
</label>`;
|
|
1455
1520
|
}
|
|
@@ -1478,11 +1543,15 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1478
1543
|
constructor() {
|
|
1479
1544
|
super(...arguments);
|
|
1480
1545
|
this.disabled = false;
|
|
1546
|
+
this.required = false;
|
|
1481
1547
|
}
|
|
1482
1548
|
willUpdate(changedProperties) {
|
|
1483
1549
|
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
1484
1550
|
this.disabled = false;
|
|
1485
1551
|
}
|
|
1552
|
+
if (changedProperties.has("required") && this.required == null) {
|
|
1553
|
+
this.required = false;
|
|
1554
|
+
}
|
|
1486
1555
|
}
|
|
1487
1556
|
get isDisabled() {
|
|
1488
1557
|
return this.disabled ?? false;
|
|
@@ -1520,7 +1589,7 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1520
1589
|
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
1521
1590
|
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
1522
1591
|
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1523
|
-
class="${spectreUi.
|
|
1592
|
+
class="${spectreUi.getLabelClasses({ disabled: this.isDisabled, required: this.required ?? false })}"
|
|
1524
1593
|
data-sp-label-native
|
|
1525
1594
|
for="${ifDefined_js.ifDefined(this.htmlFor || void 0)}"
|
|
1526
1595
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
@@ -1532,7 +1601,8 @@ var SpectreLabelElement = class extends SpectreProjectableElement {
|
|
|
1532
1601
|
};
|
|
1533
1602
|
SpectreLabelElement.properties = {
|
|
1534
1603
|
disabled: { type: Boolean, reflect: true },
|
|
1535
|
-
htmlFor: { attribute: "for", type: String, reflect: true }
|
|
1604
|
+
htmlFor: { attribute: "for", type: String, reflect: true },
|
|
1605
|
+
required: { type: Boolean, reflect: true }
|
|
1536
1606
|
};
|
|
1537
1607
|
function defineSpectreLabel(tagName = "sp-label") {
|
|
1538
1608
|
const existingElement = customElements.get(tagName);
|
|
@@ -1584,9 +1654,6 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1584
1654
|
const trimmedLegend = this.legend?.trim();
|
|
1585
1655
|
return trimmedLegend ? trimmedLegend : void 0;
|
|
1586
1656
|
}
|
|
1587
|
-
get isDisabled() {
|
|
1588
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1589
|
-
}
|
|
1590
1657
|
getContentContainer() {
|
|
1591
1658
|
return this.querySelector("[data-sp-fieldset-native]");
|
|
1592
1659
|
}
|
|
@@ -1618,6 +1685,10 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1618
1685
|
this.getContentContainer()?.blur();
|
|
1619
1686
|
}
|
|
1620
1687
|
render() {
|
|
1688
|
+
const legendClasses = spectreUi.getFieldsetLegendClasses();
|
|
1689
|
+
const legendContent = this.visibleLegend ? lit.html`<legend class="${legendClasses}" data-sp-fieldset-legend>
|
|
1690
|
+
${this.visibleLegend}
|
|
1691
|
+
</legend>` : lit.nothing;
|
|
1621
1692
|
return lit.html`<fieldset
|
|
1622
1693
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
1623
1694
|
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
@@ -1626,6 +1697,7 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1626
1697
|
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
1627
1698
|
autocapitalize="${ifDefined_js.ifDefined(this.autocapitalize || void 0)}"
|
|
1628
1699
|
?autofocus="${this.autofocus}"
|
|
1700
|
+
class="${spectreUi.getFieldsetClasses({ disabled: this.isDisabled })}"
|
|
1629
1701
|
data-sp-fieldset-native
|
|
1630
1702
|
?disabled="${this.isDisabled}"
|
|
1631
1703
|
form="${ifDefined_js.ifDefined(this.form || void 0)}"
|
|
@@ -1634,10 +1706,7 @@ var SpectreFieldsetElement = class extends SpectreProjectableElement {
|
|
|
1634
1706
|
spellcheck="${ifDefined_js.ifDefined(this.getAttribute("spellcheck") ?? void 0)}"
|
|
1635
1707
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1636
1708
|
>
|
|
1637
|
-
${
|
|
1638
|
-
class="${spectreUi.getInputLabelClasses({ disabled: this.isDisabled })}"
|
|
1639
|
-
data-sp-fieldset-legend
|
|
1640
|
-
>${this.visibleLegend}</legend>` : lit.nothing}
|
|
1709
|
+
${legendContent}
|
|
1641
1710
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
1642
1711
|
</fieldset>`;
|
|
1643
1712
|
}
|
|
@@ -1716,9 +1785,6 @@ var SpectreBadgeElement = class extends SpectreProjectableElement {
|
|
|
1716
1785
|
variant: this.variant
|
|
1717
1786
|
});
|
|
1718
1787
|
}
|
|
1719
|
-
get isDisabled() {
|
|
1720
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1721
|
-
}
|
|
1722
1788
|
render() {
|
|
1723
1789
|
return lit.html`<span
|
|
1724
1790
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -1728,6 +1794,7 @@ var SpectreBadgeElement = class extends SpectreProjectableElement {
|
|
|
1728
1794
|
class="${this.badgeClasses}"
|
|
1729
1795
|
data-sp-badge-native
|
|
1730
1796
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1797
|
+
role="${ifDefined_js.ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
1731
1798
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1732
1799
|
>
|
|
1733
1800
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
@@ -1811,9 +1878,6 @@ var SpectreCardElement = class extends SpectreProjectableElement {
|
|
|
1811
1878
|
variant: this.variant
|
|
1812
1879
|
});
|
|
1813
1880
|
}
|
|
1814
|
-
get isDisabled() {
|
|
1815
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1816
|
-
}
|
|
1817
1881
|
render() {
|
|
1818
1882
|
return lit.html`<div
|
|
1819
1883
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -1823,6 +1887,7 @@ var SpectreCardElement = class extends SpectreProjectableElement {
|
|
|
1823
1887
|
class="${this.cardClasses}"
|
|
1824
1888
|
data-sp-card-native
|
|
1825
1889
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1890
|
+
role="${ifDefined_js.ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
1826
1891
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1827
1892
|
>
|
|
1828
1893
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
@@ -1912,9 +1977,6 @@ var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
|
1912
1977
|
variant: this.variant
|
|
1913
1978
|
});
|
|
1914
1979
|
}
|
|
1915
|
-
get isDisabled() {
|
|
1916
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1917
|
-
}
|
|
1918
1980
|
render() {
|
|
1919
1981
|
return lit.html`<div
|
|
1920
1982
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -1924,6 +1986,7 @@ var SpectreIconBoxElement = class extends SpectreProjectableElement {
|
|
|
1924
1986
|
class="${this.iconBoxClasses}"
|
|
1925
1987
|
data-sp-icon-box-native
|
|
1926
1988
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
1989
|
+
role="${ifDefined_js.ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
1927
1990
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
1928
1991
|
>
|
|
1929
1992
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
@@ -1994,9 +2057,6 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
1994
2057
|
size: this.size
|
|
1995
2058
|
});
|
|
1996
2059
|
}
|
|
1997
|
-
get isDisabled() {
|
|
1998
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
1999
|
-
}
|
|
2000
2060
|
get effectiveMax() {
|
|
2001
2061
|
return this.max ?? 5;
|
|
2002
2062
|
}
|
|
@@ -2011,7 +2071,11 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
2011
2071
|
renderStars() {
|
|
2012
2072
|
const stars = [];
|
|
2013
2073
|
for (let i = 1; i <= this.effectiveMax; i++) {
|
|
2014
|
-
stars.push(
|
|
2074
|
+
stars.push(
|
|
2075
|
+
lit.html`<span
|
|
2076
|
+
class="${spectreUi.getRatingStarClasses(i <= this.effectiveValue)}"
|
|
2077
|
+
></span>`
|
|
2078
|
+
);
|
|
2015
2079
|
}
|
|
2016
2080
|
return stars;
|
|
2017
2081
|
}
|
|
@@ -2029,7 +2093,10 @@ var SpectreRatingElement = class extends SpectreBaseElement {
|
|
|
2029
2093
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2030
2094
|
>
|
|
2031
2095
|
<div class="${spectreUi.getRatingStarsClasses()}">${this.renderStars()}</div>
|
|
2032
|
-
${trimmedLabel ? lit.html`<span
|
|
2096
|
+
${trimmedLabel ? lit.html`<span
|
|
2097
|
+
class="${spectreUi.getRatingTextClasses({ disabled: this.isDisabled })}"
|
|
2098
|
+
>${trimmedLabel}</span
|
|
2099
|
+
>` : lit.nothing}
|
|
2033
2100
|
</div>`;
|
|
2034
2101
|
}
|
|
2035
2102
|
};
|
|
@@ -2106,9 +2173,6 @@ var SpectreTestimonialElement = class extends SpectreProjectableElement {
|
|
|
2106
2173
|
variant: this.variant
|
|
2107
2174
|
});
|
|
2108
2175
|
}
|
|
2109
|
-
get isDisabled() {
|
|
2110
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2111
|
-
}
|
|
2112
2176
|
render() {
|
|
2113
2177
|
return lit.html`<div
|
|
2114
2178
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -2118,6 +2182,7 @@ var SpectreTestimonialElement = class extends SpectreProjectableElement {
|
|
|
2118
2182
|
class="${this.testimonialClasses}"
|
|
2119
2183
|
data-sp-testimonial-native
|
|
2120
2184
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2185
|
+
role="${ifDefined_js.ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2121
2186
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2122
2187
|
>
|
|
2123
2188
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
@@ -2201,9 +2266,6 @@ var SpectreAlertElement = class extends SpectreProjectableElement {
|
|
|
2201
2266
|
variant: this.variant
|
|
2202
2267
|
});
|
|
2203
2268
|
}
|
|
2204
|
-
get isDisabled() {
|
|
2205
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2206
|
-
}
|
|
2207
2269
|
render() {
|
|
2208
2270
|
return lit.html`<div
|
|
2209
2271
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -2303,9 +2365,6 @@ var SpectreAvatarElement = class extends SpectreProjectableElement {
|
|
|
2303
2365
|
size: this.size
|
|
2304
2366
|
});
|
|
2305
2367
|
}
|
|
2306
|
-
get isDisabled() {
|
|
2307
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2308
|
-
}
|
|
2309
2368
|
render() {
|
|
2310
2369
|
return lit.html`<div
|
|
2311
2370
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -2315,6 +2374,7 @@ var SpectreAvatarElement = class extends SpectreProjectableElement {
|
|
|
2315
2374
|
class="${this.avatarClasses}"
|
|
2316
2375
|
data-sp-avatar-native
|
|
2317
2376
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2377
|
+
role="${ifDefined_js.ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2318
2378
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2319
2379
|
>
|
|
2320
2380
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
@@ -2482,9 +2542,6 @@ var SpectreTagElement = class extends SpectreProjectableElement {
|
|
|
2482
2542
|
variant: this.variant
|
|
2483
2543
|
});
|
|
2484
2544
|
}
|
|
2485
|
-
get isDisabled() {
|
|
2486
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2487
|
-
}
|
|
2488
2545
|
render() {
|
|
2489
2546
|
return lit.html`<span
|
|
2490
2547
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -2494,6 +2551,7 @@ var SpectreTagElement = class extends SpectreProjectableElement {
|
|
|
2494
2551
|
class="${this.tagClasses}"
|
|
2495
2552
|
data-sp-tag-native
|
|
2496
2553
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2554
|
+
role="${ifDefined_js.ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2497
2555
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2498
2556
|
>
|
|
2499
2557
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
@@ -2575,9 +2633,6 @@ var SpectrePricingCardElement = class extends SpectreProjectableElement {
|
|
|
2575
2633
|
loading: this.loading ?? false
|
|
2576
2634
|
});
|
|
2577
2635
|
}
|
|
2578
|
-
get isDisabled() {
|
|
2579
|
-
return (this.disabled ?? false) || (this.loading ?? false);
|
|
2580
|
-
}
|
|
2581
2636
|
render() {
|
|
2582
2637
|
return lit.html`<div
|
|
2583
2638
|
aria-busy="${this.loading ? "true" : "false"}"
|
|
@@ -2587,6 +2642,7 @@ var SpectrePricingCardElement = class extends SpectreProjectableElement {
|
|
|
2587
2642
|
class="${this.pricingCardClasses}"
|
|
2588
2643
|
data-sp-pricing-card-native
|
|
2589
2644
|
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2645
|
+
role="${ifDefined_js.ifDefined(this.hasForwardedLabel ? "group" : void 0)}"
|
|
2590
2646
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2591
2647
|
>
|
|
2592
2648
|
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
@@ -2608,6 +2664,1131 @@ function defineSpectrePricingCard(tagName = "sp-pricing-card") {
|
|
|
2608
2664
|
customElements.define(tagName, SpectrePricingCardElement);
|
|
2609
2665
|
return SpectrePricingCardElement;
|
|
2610
2666
|
}
|
|
2667
|
+
var SpectreContainerElement = class extends SpectreProjectableElement {
|
|
2668
|
+
constructor() {
|
|
2669
|
+
super(...arguments);
|
|
2670
|
+
this.maxWidth = void 0;
|
|
2671
|
+
}
|
|
2672
|
+
get id() {
|
|
2673
|
+
return super.id;
|
|
2674
|
+
}
|
|
2675
|
+
set id(value) {
|
|
2676
|
+
super.id = value;
|
|
2677
|
+
}
|
|
2678
|
+
get title() {
|
|
2679
|
+
return super.title;
|
|
2680
|
+
}
|
|
2681
|
+
set title(value) {
|
|
2682
|
+
super.title = value;
|
|
2683
|
+
}
|
|
2684
|
+
getContentContainer() {
|
|
2685
|
+
return this.querySelector("[data-sp-container-native]");
|
|
2686
|
+
}
|
|
2687
|
+
isInternalNode(node) {
|
|
2688
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2689
|
+
return false;
|
|
2690
|
+
}
|
|
2691
|
+
const el = node;
|
|
2692
|
+
return el.hasAttribute("data-sp-container-native");
|
|
2693
|
+
}
|
|
2694
|
+
willUpdate(changedProperties) {
|
|
2695
|
+
if (changedProperties.has("maxWidth") && this.maxWidth != null && !isContainerMaxWidth(this.maxWidth)) {
|
|
2696
|
+
this.maxWidth = void 0;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
get containerClasses() {
|
|
2700
|
+
return spectreUi.getContainerClasses(
|
|
2701
|
+
this.maxWidth != null ? { maxWidth: this.maxWidth } : {}
|
|
2702
|
+
);
|
|
2703
|
+
}
|
|
2704
|
+
render() {
|
|
2705
|
+
return lit.html`<div
|
|
2706
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2707
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
2708
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2709
|
+
class="${this.containerClasses}"
|
|
2710
|
+
data-sp-container-native
|
|
2711
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2712
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2713
|
+
>
|
|
2714
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
2715
|
+
</div>`;
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
SpectreContainerElement.properties = {
|
|
2719
|
+
maxWidth: { attribute: "max-width", type: String, reflect: true }
|
|
2720
|
+
};
|
|
2721
|
+
function defineSpectreContainer(tagName = "sp-container") {
|
|
2722
|
+
const existingElement = customElements.get(tagName);
|
|
2723
|
+
if (existingElement) {
|
|
2724
|
+
return existingElement;
|
|
2725
|
+
}
|
|
2726
|
+
customElements.define(tagName, SpectreContainerElement);
|
|
2727
|
+
return SpectreContainerElement;
|
|
2728
|
+
}
|
|
2729
|
+
var SpectreGridElement = class extends SpectreProjectableElement {
|
|
2730
|
+
constructor() {
|
|
2731
|
+
super(...arguments);
|
|
2732
|
+
this.columns = 1;
|
|
2733
|
+
this.gap = "md";
|
|
2734
|
+
}
|
|
2735
|
+
get id() {
|
|
2736
|
+
return super.id;
|
|
2737
|
+
}
|
|
2738
|
+
set id(value) {
|
|
2739
|
+
super.id = value;
|
|
2740
|
+
}
|
|
2741
|
+
get title() {
|
|
2742
|
+
return super.title;
|
|
2743
|
+
}
|
|
2744
|
+
set title(value) {
|
|
2745
|
+
super.title = value;
|
|
2746
|
+
}
|
|
2747
|
+
getContentContainer() {
|
|
2748
|
+
return this.querySelector("[data-sp-grid-native]");
|
|
2749
|
+
}
|
|
2750
|
+
isInternalNode(node) {
|
|
2751
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2752
|
+
return false;
|
|
2753
|
+
}
|
|
2754
|
+
const el = node;
|
|
2755
|
+
return el.hasAttribute("data-sp-grid-native");
|
|
2756
|
+
}
|
|
2757
|
+
willUpdate(changedProperties) {
|
|
2758
|
+
if (changedProperties.has("columns")) {
|
|
2759
|
+
const normalized = normalizeInt(this.columns, void 0, 1);
|
|
2760
|
+
this.columns = normalized != null && isGridColumns(normalized) ? normalized : 1;
|
|
2761
|
+
}
|
|
2762
|
+
if (changedProperties.has("gap") && (this.gap == null || !isGridGap(this.gap))) {
|
|
2763
|
+
this.gap = "md";
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
get gridClasses() {
|
|
2767
|
+
return spectreUi.getGridClasses({
|
|
2768
|
+
columns: this.columns,
|
|
2769
|
+
gap: this.gap
|
|
2770
|
+
});
|
|
2771
|
+
}
|
|
2772
|
+
render() {
|
|
2773
|
+
return lit.html`<div
|
|
2774
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2775
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
2776
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2777
|
+
class="${this.gridClasses}"
|
|
2778
|
+
data-sp-grid-native
|
|
2779
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2780
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2781
|
+
>
|
|
2782
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
2783
|
+
</div>`;
|
|
2784
|
+
}
|
|
2785
|
+
};
|
|
2786
|
+
SpectreGridElement.properties = {
|
|
2787
|
+
columns: { type: Number, reflect: true },
|
|
2788
|
+
gap: { type: String, reflect: true }
|
|
2789
|
+
};
|
|
2790
|
+
function defineSpectreGrid(tagName = "sp-grid") {
|
|
2791
|
+
const existingElement = customElements.get(tagName);
|
|
2792
|
+
if (existingElement) {
|
|
2793
|
+
return existingElement;
|
|
2794
|
+
}
|
|
2795
|
+
customElements.define(tagName, SpectreGridElement);
|
|
2796
|
+
return SpectreGridElement;
|
|
2797
|
+
}
|
|
2798
|
+
var SpectreSectionElement = class extends SpectreProjectableElement {
|
|
2799
|
+
get id() {
|
|
2800
|
+
return super.id;
|
|
2801
|
+
}
|
|
2802
|
+
set id(value) {
|
|
2803
|
+
super.id = value;
|
|
2804
|
+
}
|
|
2805
|
+
get title() {
|
|
2806
|
+
return super.title;
|
|
2807
|
+
}
|
|
2808
|
+
set title(value) {
|
|
2809
|
+
super.title = value;
|
|
2810
|
+
}
|
|
2811
|
+
getContentContainer() {
|
|
2812
|
+
return this.querySelector("[data-sp-section-native]");
|
|
2813
|
+
}
|
|
2814
|
+
isInternalNode(node) {
|
|
2815
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2816
|
+
return false;
|
|
2817
|
+
}
|
|
2818
|
+
const el = node;
|
|
2819
|
+
return el.hasAttribute("data-sp-section-native");
|
|
2820
|
+
}
|
|
2821
|
+
get sectionClasses() {
|
|
2822
|
+
return spectreUi.getSectionClasses({});
|
|
2823
|
+
}
|
|
2824
|
+
render() {
|
|
2825
|
+
return lit.html`<section
|
|
2826
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2827
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
2828
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2829
|
+
class="${this.sectionClasses}"
|
|
2830
|
+
data-sp-section-native
|
|
2831
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2832
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2833
|
+
>
|
|
2834
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
2835
|
+
</section>`;
|
|
2836
|
+
}
|
|
2837
|
+
};
|
|
2838
|
+
function defineSpectreSection(tagName = "sp-section") {
|
|
2839
|
+
const existingElement = customElements.get(tagName);
|
|
2840
|
+
if (existingElement) {
|
|
2841
|
+
return existingElement;
|
|
2842
|
+
}
|
|
2843
|
+
customElements.define(tagName, SpectreSectionElement);
|
|
2844
|
+
return SpectreSectionElement;
|
|
2845
|
+
}
|
|
2846
|
+
var SpectreStackElement = class extends SpectreProjectableElement {
|
|
2847
|
+
constructor() {
|
|
2848
|
+
super(...arguments);
|
|
2849
|
+
this.align = "center";
|
|
2850
|
+
this.basis = void 0;
|
|
2851
|
+
this.direction = "vertical";
|
|
2852
|
+
}
|
|
2853
|
+
get id() {
|
|
2854
|
+
return super.id;
|
|
2855
|
+
}
|
|
2856
|
+
set id(value) {
|
|
2857
|
+
super.id = value;
|
|
2858
|
+
}
|
|
2859
|
+
get title() {
|
|
2860
|
+
return super.title;
|
|
2861
|
+
}
|
|
2862
|
+
set title(value) {
|
|
2863
|
+
super.title = value;
|
|
2864
|
+
}
|
|
2865
|
+
getContentContainer() {
|
|
2866
|
+
return this.querySelector("[data-sp-stack-native]");
|
|
2867
|
+
}
|
|
2868
|
+
isInternalNode(node) {
|
|
2869
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2870
|
+
return false;
|
|
2871
|
+
}
|
|
2872
|
+
const el = node;
|
|
2873
|
+
return el.hasAttribute("data-sp-stack-native");
|
|
2874
|
+
}
|
|
2875
|
+
willUpdate(changedProperties) {
|
|
2876
|
+
if (changedProperties.has("direction") && (this.direction == null || !isStackDirection(this.direction))) {
|
|
2877
|
+
this.direction = "vertical";
|
|
2878
|
+
}
|
|
2879
|
+
if (changedProperties.has("basis") && this.basis != null && !isStackBasis(this.basis)) {
|
|
2880
|
+
this.basis = void 0;
|
|
2881
|
+
}
|
|
2882
|
+
if (changedProperties.has("align") && (this.align == null || !isStackAlign(this.align))) {
|
|
2883
|
+
this.align = "center";
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
get stackClasses() {
|
|
2887
|
+
return spectreUi.getStackClasses({
|
|
2888
|
+
align: this.align,
|
|
2889
|
+
direction: this.direction,
|
|
2890
|
+
...this.basis != null ? { basis: this.basis } : {}
|
|
2891
|
+
});
|
|
2892
|
+
}
|
|
2893
|
+
render() {
|
|
2894
|
+
return lit.html`<div
|
|
2895
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
2896
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
2897
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
2898
|
+
class="${this.stackClasses}"
|
|
2899
|
+
data-sp-stack-native
|
|
2900
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
2901
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
2902
|
+
>
|
|
2903
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
2904
|
+
</div>`;
|
|
2905
|
+
}
|
|
2906
|
+
};
|
|
2907
|
+
SpectreStackElement.properties = {
|
|
2908
|
+
align: { type: String, reflect: true },
|
|
2909
|
+
basis: { type: String, reflect: true },
|
|
2910
|
+
direction: { type: String, reflect: true }
|
|
2911
|
+
};
|
|
2912
|
+
function defineSpectreStack(tagName = "sp-stack") {
|
|
2913
|
+
const existingElement = customElements.get(tagName);
|
|
2914
|
+
if (existingElement) {
|
|
2915
|
+
return existingElement;
|
|
2916
|
+
}
|
|
2917
|
+
customElements.define(tagName, SpectreStackElement);
|
|
2918
|
+
return SpectreStackElement;
|
|
2919
|
+
}
|
|
2920
|
+
var SpectreDropdownElement = class extends SpectreBaseElement {
|
|
2921
|
+
constructor() {
|
|
2922
|
+
super(...arguments);
|
|
2923
|
+
this.fullWidth = false;
|
|
2924
|
+
this.open = false;
|
|
2925
|
+
this.placement = "bottom-start";
|
|
2926
|
+
this.triggerLabel = "Toggle menu";
|
|
2927
|
+
this.triggerContent = [];
|
|
2928
|
+
this.menuContent = [];
|
|
2929
|
+
this.handleDocumentClick = (event) => {
|
|
2930
|
+
if (!this.open) {
|
|
2931
|
+
return;
|
|
2932
|
+
}
|
|
2933
|
+
if (!event.composedPath().includes(this)) {
|
|
2934
|
+
this.close();
|
|
2935
|
+
}
|
|
2936
|
+
};
|
|
2937
|
+
this.handleDocumentKeydown = (event) => {
|
|
2938
|
+
if (event.key === "Escape" && this.open) {
|
|
2939
|
+
this.close();
|
|
2940
|
+
this.triggerElement?.focus();
|
|
2941
|
+
}
|
|
2942
|
+
};
|
|
2943
|
+
}
|
|
2944
|
+
get id() {
|
|
2945
|
+
return super.id;
|
|
2946
|
+
}
|
|
2947
|
+
set id(value) {
|
|
2948
|
+
super.id = value;
|
|
2949
|
+
}
|
|
2950
|
+
get title() {
|
|
2951
|
+
return super.title;
|
|
2952
|
+
}
|
|
2953
|
+
set title(value) {
|
|
2954
|
+
super.title = value;
|
|
2955
|
+
}
|
|
2956
|
+
isInternalNode(node) {
|
|
2957
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
2958
|
+
return false;
|
|
2959
|
+
}
|
|
2960
|
+
const el = node;
|
|
2961
|
+
return el.hasAttribute("data-sp-dropdown-menu") || el.hasAttribute("data-sp-dropdown-trigger");
|
|
2962
|
+
}
|
|
2963
|
+
syncProjectedContent() {
|
|
2964
|
+
const nextTriggerContent = [];
|
|
2965
|
+
const nextMenuContent = [];
|
|
2966
|
+
this.childNodes.forEach((node) => {
|
|
2967
|
+
if (this.isInternalNode(node)) {
|
|
2968
|
+
return;
|
|
2969
|
+
}
|
|
2970
|
+
const isTriggerSlot = node.nodeType === Node.ELEMENT_NODE && node.getAttribute("slot") === "trigger";
|
|
2971
|
+
if (isTriggerSlot) {
|
|
2972
|
+
nextTriggerContent.push(node);
|
|
2973
|
+
} else {
|
|
2974
|
+
nextMenuContent.push(node);
|
|
2975
|
+
}
|
|
2976
|
+
});
|
|
2977
|
+
const changed = nextTriggerContent.length !== this.triggerContent.length || nextTriggerContent.some((n, i) => n !== this.triggerContent[i]) || nextMenuContent.length !== this.menuContent.length || nextMenuContent.some((n, i) => n !== this.menuContent[i]);
|
|
2978
|
+
if (changed) {
|
|
2979
|
+
this.triggerContent = nextTriggerContent;
|
|
2980
|
+
this.menuContent = nextMenuContent;
|
|
2981
|
+
}
|
|
2982
|
+
return changed;
|
|
2983
|
+
}
|
|
2984
|
+
get hasTriggerContent() {
|
|
2985
|
+
return hasMeaningfulContent(this.triggerContent);
|
|
2986
|
+
}
|
|
2987
|
+
get hasMenuContent() {
|
|
2988
|
+
return hasMeaningfulContent(this.menuContent);
|
|
2989
|
+
}
|
|
2990
|
+
connectedCallback() {
|
|
2991
|
+
super.connectedCallback();
|
|
2992
|
+
this.syncProjectedContent();
|
|
2993
|
+
this.startContentObserver();
|
|
2994
|
+
document.addEventListener("click", this.handleDocumentClick);
|
|
2995
|
+
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
2996
|
+
}
|
|
2997
|
+
disconnectedCallback() {
|
|
2998
|
+
this.stopContentObserver();
|
|
2999
|
+
document.removeEventListener("click", this.handleDocumentClick);
|
|
3000
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
3001
|
+
super.disconnectedCallback();
|
|
3002
|
+
}
|
|
3003
|
+
update(changedProperties) {
|
|
3004
|
+
this.stopContentObserver();
|
|
3005
|
+
super.update(changedProperties);
|
|
3006
|
+
this.startContentObserver();
|
|
3007
|
+
}
|
|
3008
|
+
startContentObserver() {
|
|
3009
|
+
if (this.contentObserver) {
|
|
3010
|
+
return;
|
|
3011
|
+
}
|
|
3012
|
+
this.contentObserver = new MutationObserver(() => {
|
|
3013
|
+
if (this.syncProjectedContent()) {
|
|
3014
|
+
this.requestUpdate();
|
|
3015
|
+
}
|
|
3016
|
+
});
|
|
3017
|
+
this.contentObserver.observe(this, { childList: true });
|
|
3018
|
+
}
|
|
3019
|
+
stopContentObserver() {
|
|
3020
|
+
this.contentObserver?.disconnect();
|
|
3021
|
+
this.contentObserver = void 0;
|
|
3022
|
+
}
|
|
3023
|
+
willUpdate(changedProperties) {
|
|
3024
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
3025
|
+
this.fullWidth = false;
|
|
3026
|
+
}
|
|
3027
|
+
if (changedProperties.has("open") && this.open == null) {
|
|
3028
|
+
this.open = false;
|
|
3029
|
+
}
|
|
3030
|
+
if (changedProperties.has("placement") && (this.placement == null || !isDropdownPlacement(this.placement))) {
|
|
3031
|
+
this.placement = "bottom-start";
|
|
3032
|
+
}
|
|
3033
|
+
if (changedProperties.has("triggerLabel") && !this.triggerLabel) {
|
|
3034
|
+
this.triggerLabel = "Toggle menu";
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
get triggerElement() {
|
|
3038
|
+
return this.querySelector("[data-sp-dropdown-trigger]");
|
|
3039
|
+
}
|
|
3040
|
+
toggle() {
|
|
3041
|
+
if (this.open) {
|
|
3042
|
+
this.close();
|
|
3043
|
+
} else {
|
|
3044
|
+
this.openMenu();
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
openMenu() {
|
|
3048
|
+
if (this.open) {
|
|
3049
|
+
return;
|
|
3050
|
+
}
|
|
3051
|
+
this.open = true;
|
|
3052
|
+
this.dispatchEvent(new CustomEvent("sp-open", { bubbles: true }));
|
|
3053
|
+
}
|
|
3054
|
+
close() {
|
|
3055
|
+
if (!this.open) {
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
3058
|
+
this.open = false;
|
|
3059
|
+
this.dispatchEvent(new CustomEvent("sp-close", { bubbles: true }));
|
|
3060
|
+
}
|
|
3061
|
+
get dropdownClasses() {
|
|
3062
|
+
return spectreUi.getDropdownClasses({ fullWidth: this.fullWidth ?? false });
|
|
3063
|
+
}
|
|
3064
|
+
get menuClasses() {
|
|
3065
|
+
return spectreUi.getDropdownMenuClasses({
|
|
3066
|
+
open: this.open ?? false,
|
|
3067
|
+
placement: this.placement
|
|
3068
|
+
});
|
|
3069
|
+
}
|
|
3070
|
+
render() {
|
|
3071
|
+
return lit.html`<div
|
|
3072
|
+
class="${this.dropdownClasses}"
|
|
3073
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
3074
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
3075
|
+
>
|
|
3076
|
+
<button
|
|
3077
|
+
aria-expanded="${this.open ? "true" : "false"}"
|
|
3078
|
+
aria-haspopup="true"
|
|
3079
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel ?? this.triggerLabel)}"
|
|
3080
|
+
class="sp-dropdown__trigger"
|
|
3081
|
+
data-sp-dropdown-trigger
|
|
3082
|
+
type="button"
|
|
3083
|
+
@click="${() => this.toggle()}"
|
|
3084
|
+
>
|
|
3085
|
+
${this.hasTriggerContent ? this.triggerContent : this.triggerLabel}
|
|
3086
|
+
</button>
|
|
3087
|
+
<div class="${this.menuClasses}" data-sp-dropdown-menu>
|
|
3088
|
+
${this.hasMenuContent ? this.menuContent : lit.nothing}
|
|
3089
|
+
</div>
|
|
3090
|
+
</div>`;
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
SpectreDropdownElement.properties = {
|
|
3094
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
3095
|
+
open: { type: Boolean, reflect: true },
|
|
3096
|
+
placement: { type: String, reflect: true },
|
|
3097
|
+
triggerLabel: { attribute: "trigger-label", type: String }
|
|
3098
|
+
};
|
|
3099
|
+
function defineSpectreDropdown(tagName = "sp-dropdown") {
|
|
3100
|
+
const existingElement = customElements.get(tagName);
|
|
3101
|
+
if (existingElement) {
|
|
3102
|
+
return existingElement;
|
|
3103
|
+
}
|
|
3104
|
+
customElements.define(tagName, SpectreDropdownElement);
|
|
3105
|
+
return SpectreDropdownElement;
|
|
3106
|
+
}
|
|
3107
|
+
var FOCUSABLE_SELECTOR = [
|
|
3108
|
+
"a[href]",
|
|
3109
|
+
"button:not([disabled])",
|
|
3110
|
+
"input:not([disabled])",
|
|
3111
|
+
"select:not([disabled])",
|
|
3112
|
+
"textarea:not([disabled])",
|
|
3113
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
3114
|
+
].join(",");
|
|
3115
|
+
var SpectreModalElement = class extends SpectreProjectableElement {
|
|
3116
|
+
constructor() {
|
|
3117
|
+
super(...arguments);
|
|
3118
|
+
this.fullWidth = false;
|
|
3119
|
+
this.open = false;
|
|
3120
|
+
this.previouslyFocusedElement = null;
|
|
3121
|
+
this.handleDocumentKeydown = (event) => {
|
|
3122
|
+
if (!this.open) {
|
|
3123
|
+
return;
|
|
3124
|
+
}
|
|
3125
|
+
if (event.key === "Escape") {
|
|
3126
|
+
this.close();
|
|
3127
|
+
return;
|
|
3128
|
+
}
|
|
3129
|
+
if (event.key === "Tab") {
|
|
3130
|
+
this.trapFocus(event);
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
}
|
|
3134
|
+
get id() {
|
|
3135
|
+
return super.id;
|
|
3136
|
+
}
|
|
3137
|
+
set id(value) {
|
|
3138
|
+
super.id = value;
|
|
3139
|
+
}
|
|
3140
|
+
get title() {
|
|
3141
|
+
return super.title;
|
|
3142
|
+
}
|
|
3143
|
+
set title(value) {
|
|
3144
|
+
super.title = value;
|
|
3145
|
+
}
|
|
3146
|
+
getContentContainer() {
|
|
3147
|
+
return this.querySelector("[data-sp-modal-native]");
|
|
3148
|
+
}
|
|
3149
|
+
isInternalNode(node) {
|
|
3150
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
3151
|
+
return false;
|
|
3152
|
+
}
|
|
3153
|
+
const el = node;
|
|
3154
|
+
return el.hasAttribute("data-sp-modal-native") || el.hasAttribute("data-sp-modal-overlay");
|
|
3155
|
+
}
|
|
3156
|
+
willUpdate(changedProperties) {
|
|
3157
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
3158
|
+
this.fullWidth = false;
|
|
3159
|
+
}
|
|
3160
|
+
if (changedProperties.has("open") && this.open == null) {
|
|
3161
|
+
this.open = false;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
updated(changedProperties) {
|
|
3165
|
+
super.updated(changedProperties);
|
|
3166
|
+
if (!changedProperties.has("open")) {
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
if (this.open) {
|
|
3170
|
+
this.previouslyFocusedElement = document.activeElement;
|
|
3171
|
+
this.focusFirstElement();
|
|
3172
|
+
} else if (this.previouslyFocusedElement) {
|
|
3173
|
+
this.previouslyFocusedElement.focus();
|
|
3174
|
+
this.previouslyFocusedElement = null;
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
connectedCallback() {
|
|
3178
|
+
super.connectedCallback();
|
|
3179
|
+
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
3180
|
+
}
|
|
3181
|
+
disconnectedCallback() {
|
|
3182
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
3183
|
+
super.disconnectedCallback();
|
|
3184
|
+
}
|
|
3185
|
+
get modalElement() {
|
|
3186
|
+
return this.querySelector("[data-sp-modal-native]");
|
|
3187
|
+
}
|
|
3188
|
+
get focusableElements() {
|
|
3189
|
+
const modal = this.modalElement;
|
|
3190
|
+
if (!modal) {
|
|
3191
|
+
return [];
|
|
3192
|
+
}
|
|
3193
|
+
return Array.from(modal.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
3194
|
+
}
|
|
3195
|
+
focusFirstElement() {
|
|
3196
|
+
const [first] = this.focusableElements;
|
|
3197
|
+
(first ?? this.modalElement)?.focus();
|
|
3198
|
+
}
|
|
3199
|
+
trapFocus(event) {
|
|
3200
|
+
const focusable = this.focusableElements;
|
|
3201
|
+
if (focusable.length === 0) {
|
|
3202
|
+
event.preventDefault();
|
|
3203
|
+
return;
|
|
3204
|
+
}
|
|
3205
|
+
const first = focusable[0];
|
|
3206
|
+
const last = focusable[focusable.length - 1];
|
|
3207
|
+
const active = document.activeElement;
|
|
3208
|
+
if (event.shiftKey && active === first) {
|
|
3209
|
+
event.preventDefault();
|
|
3210
|
+
last?.focus();
|
|
3211
|
+
} else if (!event.shiftKey && active === last) {
|
|
3212
|
+
event.preventDefault();
|
|
3213
|
+
first?.focus();
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
close() {
|
|
3217
|
+
if (!this.open) {
|
|
3218
|
+
return;
|
|
3219
|
+
}
|
|
3220
|
+
this.open = false;
|
|
3221
|
+
this.dispatchEvent(new CustomEvent("sp-close", { bubbles: true }));
|
|
3222
|
+
}
|
|
3223
|
+
get overlayClasses() {
|
|
3224
|
+
return spectreUi.getModalOverlayClasses({ open: this.open ?? false });
|
|
3225
|
+
}
|
|
3226
|
+
get modalClasses() {
|
|
3227
|
+
return spectreUi.getModalClasses({
|
|
3228
|
+
open: this.open ?? false,
|
|
3229
|
+
fullWidth: this.fullWidth ?? false
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
render() {
|
|
3233
|
+
const isHidden = !this.open;
|
|
3234
|
+
return lit.html`<div
|
|
3235
|
+
aria-hidden="${ifDefined_js.ifDefined(isHidden ? "true" : void 0)}"
|
|
3236
|
+
class="${this.overlayClasses}"
|
|
3237
|
+
data-sp-modal-overlay
|
|
3238
|
+
@click="${(event) => {
|
|
3239
|
+
if (event.target === event.currentTarget) {
|
|
3240
|
+
this.close();
|
|
3241
|
+
}
|
|
3242
|
+
}}"
|
|
3243
|
+
>
|
|
3244
|
+
<div
|
|
3245
|
+
aria-describedby="${ifDefined_js.ifDefined(this.forwardedAriaDescribedBy)}"
|
|
3246
|
+
aria-hidden="${ifDefined_js.ifDefined(isHidden ? "true" : void 0)}"
|
|
3247
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
3248
|
+
aria-labelledby="${ifDefined_js.ifDefined(this.forwardedAriaLabelledBy)}"
|
|
3249
|
+
aria-modal="true"
|
|
3250
|
+
class="${this.modalClasses}"
|
|
3251
|
+
data-sp-modal-native
|
|
3252
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
3253
|
+
role="dialog"
|
|
3254
|
+
tabindex="-1"
|
|
3255
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
3256
|
+
>
|
|
3257
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
3258
|
+
</div>
|
|
3259
|
+
</div>`;
|
|
3260
|
+
}
|
|
3261
|
+
};
|
|
3262
|
+
SpectreModalElement.properties = {
|
|
3263
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
3264
|
+
open: { type: Boolean, reflect: true }
|
|
3265
|
+
};
|
|
3266
|
+
function defineSpectreModal(tagName = "sp-modal") {
|
|
3267
|
+
const existingElement = customElements.get(tagName);
|
|
3268
|
+
if (existingElement) {
|
|
3269
|
+
return existingElement;
|
|
3270
|
+
}
|
|
3271
|
+
customElements.define(tagName, SpectreModalElement);
|
|
3272
|
+
return SpectreModalElement;
|
|
3273
|
+
}
|
|
3274
|
+
var SpectreNavElement = class extends SpectreProjectableElement {
|
|
3275
|
+
constructor() {
|
|
3276
|
+
super(...arguments);
|
|
3277
|
+
this.bordered = false;
|
|
3278
|
+
this.fullWidth = false;
|
|
3279
|
+
this.sticky = false;
|
|
3280
|
+
}
|
|
3281
|
+
get id() {
|
|
3282
|
+
return super.id;
|
|
3283
|
+
}
|
|
3284
|
+
set id(value) {
|
|
3285
|
+
super.id = value;
|
|
3286
|
+
}
|
|
3287
|
+
get title() {
|
|
3288
|
+
return super.title;
|
|
3289
|
+
}
|
|
3290
|
+
set title(value) {
|
|
3291
|
+
super.title = value;
|
|
3292
|
+
}
|
|
3293
|
+
getContentContainer() {
|
|
3294
|
+
return this.querySelector("[data-sp-nav-native]");
|
|
3295
|
+
}
|
|
3296
|
+
isInternalNode(node) {
|
|
3297
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
3298
|
+
return false;
|
|
3299
|
+
}
|
|
3300
|
+
const el = node;
|
|
3301
|
+
return el.hasAttribute("data-sp-nav-native");
|
|
3302
|
+
}
|
|
3303
|
+
willUpdate(changedProperties) {
|
|
3304
|
+
if (changedProperties.has("bordered") && this.bordered == null) {
|
|
3305
|
+
this.bordered = false;
|
|
3306
|
+
}
|
|
3307
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
3308
|
+
this.fullWidth = false;
|
|
3309
|
+
}
|
|
3310
|
+
if (changedProperties.has("sticky") && this.sticky == null) {
|
|
3311
|
+
this.sticky = false;
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
get navClasses() {
|
|
3315
|
+
return spectreUi.getNavClasses({
|
|
3316
|
+
bordered: this.bordered ?? false,
|
|
3317
|
+
fullWidth: this.fullWidth ?? false,
|
|
3318
|
+
sticky: this.sticky ?? false
|
|
3319
|
+
});
|
|
3320
|
+
}
|
|
3321
|
+
render() {
|
|
3322
|
+
return lit.html`<nav
|
|
3323
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
3324
|
+
class="${this.navClasses}"
|
|
3325
|
+
data-sp-nav-native
|
|
3326
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
3327
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
3328
|
+
>
|
|
3329
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
3330
|
+
</nav>`;
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3333
|
+
SpectreNavElement.properties = {
|
|
3334
|
+
bordered: { type: Boolean, reflect: true },
|
|
3335
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
3336
|
+
sticky: { type: Boolean, reflect: true }
|
|
3337
|
+
};
|
|
3338
|
+
function defineSpectreNav(tagName = "sp-nav") {
|
|
3339
|
+
const existingElement = customElements.get(tagName);
|
|
3340
|
+
if (existingElement) {
|
|
3341
|
+
return existingElement;
|
|
3342
|
+
}
|
|
3343
|
+
customElements.define(tagName, SpectreNavElement);
|
|
3344
|
+
return SpectreNavElement;
|
|
3345
|
+
}
|
|
3346
|
+
var SpectreSidebarElement = class extends SpectreProjectableElement {
|
|
3347
|
+
constructor() {
|
|
3348
|
+
super(...arguments);
|
|
3349
|
+
this.bordered = false;
|
|
3350
|
+
this.open = false;
|
|
3351
|
+
this.toggleLabel = "Toggle sidebar";
|
|
3352
|
+
this.handleDocumentKeydown = (event) => {
|
|
3353
|
+
if (event.key === "Escape" && this.open) {
|
|
3354
|
+
this.close();
|
|
3355
|
+
}
|
|
3356
|
+
};
|
|
3357
|
+
}
|
|
3358
|
+
get id() {
|
|
3359
|
+
return super.id;
|
|
3360
|
+
}
|
|
3361
|
+
set id(value) {
|
|
3362
|
+
super.id = value;
|
|
3363
|
+
}
|
|
3364
|
+
get title() {
|
|
3365
|
+
return super.title;
|
|
3366
|
+
}
|
|
3367
|
+
set title(value) {
|
|
3368
|
+
super.title = value;
|
|
3369
|
+
}
|
|
3370
|
+
getContentContainer() {
|
|
3371
|
+
return this.querySelector("[data-sp-sidebar-native]");
|
|
3372
|
+
}
|
|
3373
|
+
isInternalNode(node) {
|
|
3374
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
3375
|
+
return false;
|
|
3376
|
+
}
|
|
3377
|
+
const el = node;
|
|
3378
|
+
return el.hasAttribute("data-sp-sidebar-native") || el.hasAttribute("data-sp-sidebar-toggle") || el.hasAttribute("data-sp-sidebar-backdrop");
|
|
3379
|
+
}
|
|
3380
|
+
willUpdate(changedProperties) {
|
|
3381
|
+
if (changedProperties.has("bordered") && this.bordered == null) {
|
|
3382
|
+
this.bordered = false;
|
|
3383
|
+
}
|
|
3384
|
+
if (changedProperties.has("open") && this.open == null) {
|
|
3385
|
+
this.open = false;
|
|
3386
|
+
}
|
|
3387
|
+
if (changedProperties.has("toggleLabel") && !this.toggleLabel) {
|
|
3388
|
+
this.toggleLabel = "Toggle sidebar";
|
|
3389
|
+
}
|
|
3390
|
+
if (changedProperties.has("open")) {
|
|
3391
|
+
HTMLElement.prototype.setAttribute.call(
|
|
3392
|
+
this,
|
|
3393
|
+
"data-sidebar-open",
|
|
3394
|
+
this.open ? "true" : "false"
|
|
3395
|
+
);
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
connectedCallback() {
|
|
3399
|
+
super.connectedCallback();
|
|
3400
|
+
HTMLElement.prototype.setAttribute.call(
|
|
3401
|
+
this,
|
|
3402
|
+
"data-sidebar-open",
|
|
3403
|
+
this.open ? "true" : "false"
|
|
3404
|
+
);
|
|
3405
|
+
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
3406
|
+
}
|
|
3407
|
+
disconnectedCallback() {
|
|
3408
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
3409
|
+
super.disconnectedCallback();
|
|
3410
|
+
}
|
|
3411
|
+
toggle() {
|
|
3412
|
+
if (this.open) {
|
|
3413
|
+
this.close();
|
|
3414
|
+
} else {
|
|
3415
|
+
this.openSidebar();
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
openSidebar() {
|
|
3419
|
+
if (this.open) {
|
|
3420
|
+
return;
|
|
3421
|
+
}
|
|
3422
|
+
this.open = true;
|
|
3423
|
+
this.dispatchEvent(new CustomEvent("sp-open", { bubbles: true }));
|
|
3424
|
+
}
|
|
3425
|
+
close() {
|
|
3426
|
+
if (!this.open) {
|
|
3427
|
+
return;
|
|
3428
|
+
}
|
|
3429
|
+
this.open = false;
|
|
3430
|
+
this.dispatchEvent(new CustomEvent("sp-close", { bubbles: true }));
|
|
3431
|
+
}
|
|
3432
|
+
get sidebarClasses() {
|
|
3433
|
+
return spectreUi.getSidebarClasses({ bordered: this.bordered ?? false });
|
|
3434
|
+
}
|
|
3435
|
+
render() {
|
|
3436
|
+
return lit.html`<button
|
|
3437
|
+
aria-expanded="${this.open ? "true" : "false"}"
|
|
3438
|
+
aria-label="${ifDefined_js.ifDefined(this.toggleLabel)}"
|
|
3439
|
+
class="${spectreUi.getSidebarToggleClasses()}"
|
|
3440
|
+
data-sp-sidebar-toggle
|
|
3441
|
+
type="button"
|
|
3442
|
+
@click="${() => this.toggle()}"
|
|
3443
|
+
>
|
|
3444
|
+
☰
|
|
3445
|
+
</button>
|
|
3446
|
+
<div
|
|
3447
|
+
class="${spectreUi.getSidebarBackdropClasses()}"
|
|
3448
|
+
data-sp-sidebar-backdrop
|
|
3449
|
+
@click="${() => this.close()}"
|
|
3450
|
+
></div>
|
|
3451
|
+
<aside
|
|
3452
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
3453
|
+
class="${this.sidebarClasses}"
|
|
3454
|
+
data-sp-sidebar-native
|
|
3455
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
3456
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
3457
|
+
>
|
|
3458
|
+
${this.hasProjectedContent ? this.projectedContent : lit.nothing}
|
|
3459
|
+
</aside>`;
|
|
3460
|
+
}
|
|
3461
|
+
};
|
|
3462
|
+
SpectreSidebarElement.properties = {
|
|
3463
|
+
bordered: { type: Boolean, reflect: true },
|
|
3464
|
+
open: { type: Boolean, reflect: false },
|
|
3465
|
+
toggleLabel: { attribute: "toggle-label", type: String }
|
|
3466
|
+
};
|
|
3467
|
+
function defineSpectreSidebar(tagName = "sp-sidebar") {
|
|
3468
|
+
const existingElement = customElements.get(tagName);
|
|
3469
|
+
if (existingElement) {
|
|
3470
|
+
return existingElement;
|
|
3471
|
+
}
|
|
3472
|
+
customElements.define(tagName, SpectreSidebarElement);
|
|
3473
|
+
return SpectreSidebarElement;
|
|
3474
|
+
}
|
|
3475
|
+
var SpectreToastElement = class extends SpectreBaseElement {
|
|
3476
|
+
constructor() {
|
|
3477
|
+
super(...arguments);
|
|
3478
|
+
this.dismissed = false;
|
|
3479
|
+
this.fullWidth = false;
|
|
3480
|
+
this.variant = "info";
|
|
3481
|
+
this.iconContent = [];
|
|
3482
|
+
this.bodyContent = [];
|
|
3483
|
+
}
|
|
3484
|
+
get id() {
|
|
3485
|
+
return super.id;
|
|
3486
|
+
}
|
|
3487
|
+
set id(value) {
|
|
3488
|
+
super.id = value;
|
|
3489
|
+
}
|
|
3490
|
+
get title() {
|
|
3491
|
+
return super.title;
|
|
3492
|
+
}
|
|
3493
|
+
set title(value) {
|
|
3494
|
+
super.title = value;
|
|
3495
|
+
}
|
|
3496
|
+
isInternalNode(node) {
|
|
3497
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
3498
|
+
return false;
|
|
3499
|
+
}
|
|
3500
|
+
const el = node;
|
|
3501
|
+
return el.hasAttribute("data-sp-toast-native") || el.hasAttribute("data-sp-toast-icon");
|
|
3502
|
+
}
|
|
3503
|
+
syncProjectedContent() {
|
|
3504
|
+
const nextIconContent = [];
|
|
3505
|
+
const nextBodyContent = [];
|
|
3506
|
+
this.childNodes.forEach((node) => {
|
|
3507
|
+
if (this.isInternalNode(node)) {
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
const isIconSlot = node.nodeType === Node.ELEMENT_NODE && node.getAttribute("slot") === "icon";
|
|
3511
|
+
if (isIconSlot) {
|
|
3512
|
+
nextIconContent.push(node);
|
|
3513
|
+
} else {
|
|
3514
|
+
nextBodyContent.push(node);
|
|
3515
|
+
}
|
|
3516
|
+
});
|
|
3517
|
+
const changed = nextIconContent.length !== this.iconContent.length || nextIconContent.some((n, i) => n !== this.iconContent[i]) || nextBodyContent.length !== this.bodyContent.length || nextBodyContent.some((n, i) => n !== this.bodyContent[i]);
|
|
3518
|
+
if (changed) {
|
|
3519
|
+
this.iconContent = nextIconContent;
|
|
3520
|
+
this.bodyContent = nextBodyContent;
|
|
3521
|
+
}
|
|
3522
|
+
return changed;
|
|
3523
|
+
}
|
|
3524
|
+
get hasIconContent() {
|
|
3525
|
+
return hasMeaningfulContent(this.iconContent);
|
|
3526
|
+
}
|
|
3527
|
+
get hasBodyContent() {
|
|
3528
|
+
return hasMeaningfulContent(this.bodyContent);
|
|
3529
|
+
}
|
|
3530
|
+
connectedCallback() {
|
|
3531
|
+
super.connectedCallback();
|
|
3532
|
+
this.syncProjectedContent();
|
|
3533
|
+
this.startContentObserver();
|
|
3534
|
+
}
|
|
3535
|
+
disconnectedCallback() {
|
|
3536
|
+
this.stopContentObserver();
|
|
3537
|
+
this.clearAutoDismissTimer();
|
|
3538
|
+
super.disconnectedCallback();
|
|
3539
|
+
}
|
|
3540
|
+
update(changedProperties) {
|
|
3541
|
+
this.stopContentObserver();
|
|
3542
|
+
super.update(changedProperties);
|
|
3543
|
+
this.startContentObserver();
|
|
3544
|
+
}
|
|
3545
|
+
startContentObserver() {
|
|
3546
|
+
if (this.contentObserver) {
|
|
3547
|
+
return;
|
|
3548
|
+
}
|
|
3549
|
+
this.contentObserver = new MutationObserver(() => {
|
|
3550
|
+
if (this.syncProjectedContent()) {
|
|
3551
|
+
this.requestUpdate();
|
|
3552
|
+
}
|
|
3553
|
+
});
|
|
3554
|
+
this.contentObserver.observe(this, { childList: true });
|
|
3555
|
+
}
|
|
3556
|
+
stopContentObserver() {
|
|
3557
|
+
this.contentObserver?.disconnect();
|
|
3558
|
+
this.contentObserver = void 0;
|
|
3559
|
+
}
|
|
3560
|
+
willUpdate(changedProperties) {
|
|
3561
|
+
if (changedProperties.has("dismissed") && this.dismissed == null) {
|
|
3562
|
+
this.dismissed = false;
|
|
3563
|
+
}
|
|
3564
|
+
if (changedProperties.has("fullWidth") && this.fullWidth == null) {
|
|
3565
|
+
this.fullWidth = false;
|
|
3566
|
+
}
|
|
3567
|
+
if (changedProperties.has("variant") && (this.variant == null || !isToastVariant(this.variant))) {
|
|
3568
|
+
this.variant = "info";
|
|
3569
|
+
}
|
|
3570
|
+
if (changedProperties.has("autoDismiss")) {
|
|
3571
|
+
this.autoDismiss = normalizeInt(this.autoDismiss, void 0, 0);
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
updated(changedProperties) {
|
|
3575
|
+
super.updated(changedProperties);
|
|
3576
|
+
if (changedProperties.has("dismissed") || changedProperties.has("autoDismiss")) {
|
|
3577
|
+
this.clearAutoDismissTimer();
|
|
3578
|
+
if (!this.dismissed && this.autoDismiss) {
|
|
3579
|
+
this.autoDismissTimer = setTimeout(() => {
|
|
3580
|
+
this.dismiss();
|
|
3581
|
+
}, this.autoDismiss);
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
clearAutoDismissTimer() {
|
|
3586
|
+
if (this.autoDismissTimer) {
|
|
3587
|
+
clearTimeout(this.autoDismissTimer);
|
|
3588
|
+
this.autoDismissTimer = void 0;
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
show() {
|
|
3592
|
+
if (!this.dismissed) {
|
|
3593
|
+
return;
|
|
3594
|
+
}
|
|
3595
|
+
this.dismissed = false;
|
|
3596
|
+
this.dispatchEvent(new CustomEvent("sp-show", { bubbles: true }));
|
|
3597
|
+
}
|
|
3598
|
+
dismiss() {
|
|
3599
|
+
if (this.dismissed) {
|
|
3600
|
+
return;
|
|
3601
|
+
}
|
|
3602
|
+
this.dismissed = true;
|
|
3603
|
+
this.dispatchEvent(new CustomEvent("sp-dismiss", { bubbles: true }));
|
|
3604
|
+
}
|
|
3605
|
+
get toastClasses() {
|
|
3606
|
+
return spectreUi.getToastClasses({
|
|
3607
|
+
variant: this.variant,
|
|
3608
|
+
dismissed: this.dismissed ?? false,
|
|
3609
|
+
fullWidth: this.fullWidth ?? false
|
|
3610
|
+
});
|
|
3611
|
+
}
|
|
3612
|
+
get iconClasses() {
|
|
3613
|
+
return spectreUi.getToastIconClasses({ variant: this.variant });
|
|
3614
|
+
}
|
|
3615
|
+
render() {
|
|
3616
|
+
return lit.html`<div
|
|
3617
|
+
aria-atomic="true"
|
|
3618
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
3619
|
+
aria-live="polite"
|
|
3620
|
+
class="${this.toastClasses}"
|
|
3621
|
+
data-sp-toast-native
|
|
3622
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
3623
|
+
role="status"
|
|
3624
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
3625
|
+
>
|
|
3626
|
+
${this.hasIconContent ? lit.html`<div class="${this.iconClasses}" data-sp-toast-icon>
|
|
3627
|
+
${this.iconContent}
|
|
3628
|
+
</div>` : lit.nothing}
|
|
3629
|
+
${this.hasBodyContent ? this.bodyContent : lit.nothing}
|
|
3630
|
+
</div>`;
|
|
3631
|
+
}
|
|
3632
|
+
};
|
|
3633
|
+
SpectreToastElement.properties = {
|
|
3634
|
+
autoDismiss: { attribute: "auto-dismiss", type: Number },
|
|
3635
|
+
dismissed: { type: Boolean, reflect: true },
|
|
3636
|
+
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
3637
|
+
variant: { type: String, reflect: true }
|
|
3638
|
+
};
|
|
3639
|
+
function defineSpectreToast(tagName = "sp-toast") {
|
|
3640
|
+
const existingElement = customElements.get(tagName);
|
|
3641
|
+
if (existingElement) {
|
|
3642
|
+
return existingElement;
|
|
3643
|
+
}
|
|
3644
|
+
customElements.define(tagName, SpectreToastElement);
|
|
3645
|
+
return SpectreToastElement;
|
|
3646
|
+
}
|
|
3647
|
+
var SpectreTooltipElement = class extends SpectreBaseElement {
|
|
3648
|
+
constructor() {
|
|
3649
|
+
super(...arguments);
|
|
3650
|
+
this.placement = "top";
|
|
3651
|
+
this.visible = false;
|
|
3652
|
+
this.triggerContent = [];
|
|
3653
|
+
this.tooltipContent = [];
|
|
3654
|
+
}
|
|
3655
|
+
get id() {
|
|
3656
|
+
return super.id;
|
|
3657
|
+
}
|
|
3658
|
+
set id(value) {
|
|
3659
|
+
super.id = value;
|
|
3660
|
+
}
|
|
3661
|
+
get title() {
|
|
3662
|
+
return super.title;
|
|
3663
|
+
}
|
|
3664
|
+
set title(value) {
|
|
3665
|
+
super.title = value;
|
|
3666
|
+
}
|
|
3667
|
+
isInternalNode(node) {
|
|
3668
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
3669
|
+
return false;
|
|
3670
|
+
}
|
|
3671
|
+
const el = node;
|
|
3672
|
+
return el.hasAttribute("data-sp-tooltip-native") || el.hasAttribute("data-sp-tooltip-trigger");
|
|
3673
|
+
}
|
|
3674
|
+
syncProjectedContent() {
|
|
3675
|
+
const nextTooltipContent = [];
|
|
3676
|
+
const nextTriggerContent = [];
|
|
3677
|
+
this.childNodes.forEach((node) => {
|
|
3678
|
+
if (this.isInternalNode(node)) {
|
|
3679
|
+
return;
|
|
3680
|
+
}
|
|
3681
|
+
const isTooltipSlot = node.nodeType === Node.ELEMENT_NODE && node.getAttribute("slot") === "tooltip";
|
|
3682
|
+
if (isTooltipSlot) {
|
|
3683
|
+
nextTooltipContent.push(node);
|
|
3684
|
+
} else {
|
|
3685
|
+
nextTriggerContent.push(node);
|
|
3686
|
+
}
|
|
3687
|
+
});
|
|
3688
|
+
const changed = nextTooltipContent.length !== this.tooltipContent.length || nextTooltipContent.some((n, i) => n !== this.tooltipContent[i]) || nextTriggerContent.length !== this.triggerContent.length || nextTriggerContent.some((n, i) => n !== this.triggerContent[i]);
|
|
3689
|
+
if (changed) {
|
|
3690
|
+
this.tooltipContent = nextTooltipContent;
|
|
3691
|
+
this.triggerContent = nextTriggerContent;
|
|
3692
|
+
}
|
|
3693
|
+
return changed;
|
|
3694
|
+
}
|
|
3695
|
+
get hasTooltipContent() {
|
|
3696
|
+
return hasMeaningfulContent(this.tooltipContent);
|
|
3697
|
+
}
|
|
3698
|
+
connectedCallback() {
|
|
3699
|
+
var _a, _b;
|
|
3700
|
+
super.connectedCallback();
|
|
3701
|
+
this.syncProjectedContent();
|
|
3702
|
+
this.startContentObserver();
|
|
3703
|
+
(_a = this.style).position || (_a.position = "relative");
|
|
3704
|
+
(_b = this.style).display || (_b.display = "inline-block");
|
|
3705
|
+
}
|
|
3706
|
+
disconnectedCallback() {
|
|
3707
|
+
this.stopContentObserver();
|
|
3708
|
+
super.disconnectedCallback();
|
|
3709
|
+
}
|
|
3710
|
+
update(changedProperties) {
|
|
3711
|
+
this.stopContentObserver();
|
|
3712
|
+
super.update(changedProperties);
|
|
3713
|
+
this.startContentObserver();
|
|
3714
|
+
}
|
|
3715
|
+
startContentObserver() {
|
|
3716
|
+
if (this.contentObserver) {
|
|
3717
|
+
return;
|
|
3718
|
+
}
|
|
3719
|
+
this.contentObserver = new MutationObserver(() => {
|
|
3720
|
+
if (this.syncProjectedContent()) {
|
|
3721
|
+
this.requestUpdate();
|
|
3722
|
+
}
|
|
3723
|
+
});
|
|
3724
|
+
this.contentObserver.observe(this, { childList: true });
|
|
3725
|
+
}
|
|
3726
|
+
stopContentObserver() {
|
|
3727
|
+
this.contentObserver?.disconnect();
|
|
3728
|
+
this.contentObserver = void 0;
|
|
3729
|
+
}
|
|
3730
|
+
willUpdate(changedProperties) {
|
|
3731
|
+
if (changedProperties.has("placement") && (this.placement == null || !isTooltipPlacement(this.placement))) {
|
|
3732
|
+
this.placement = "top";
|
|
3733
|
+
}
|
|
3734
|
+
if (changedProperties.has("visible") && this.visible == null) {
|
|
3735
|
+
this.visible = false;
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
show() {
|
|
3739
|
+
if (this.visible) {
|
|
3740
|
+
return;
|
|
3741
|
+
}
|
|
3742
|
+
this.visible = true;
|
|
3743
|
+
this.dispatchEvent(new CustomEvent("sp-show", { bubbles: true }));
|
|
3744
|
+
}
|
|
3745
|
+
hide() {
|
|
3746
|
+
if (!this.visible) {
|
|
3747
|
+
return;
|
|
3748
|
+
}
|
|
3749
|
+
this.visible = false;
|
|
3750
|
+
this.dispatchEvent(new CustomEvent("sp-hide", { bubbles: true }));
|
|
3751
|
+
}
|
|
3752
|
+
get tooltipClasses() {
|
|
3753
|
+
return spectreUi.getTooltipClasses({
|
|
3754
|
+
placement: this.placement,
|
|
3755
|
+
visible: this.visible ?? false
|
|
3756
|
+
});
|
|
3757
|
+
}
|
|
3758
|
+
render() {
|
|
3759
|
+
return lit.html`<span
|
|
3760
|
+
data-sp-tooltip-trigger
|
|
3761
|
+
@focusin="${() => this.show()}"
|
|
3762
|
+
@focusout="${() => this.hide()}"
|
|
3763
|
+
@mouseenter="${() => this.show()}"
|
|
3764
|
+
@mouseleave="${() => this.hide()}"
|
|
3765
|
+
>
|
|
3766
|
+
${this.triggerContent}
|
|
3767
|
+
</span>
|
|
3768
|
+
<span
|
|
3769
|
+
aria-label="${ifDefined_js.ifDefined(this.forwardedAriaLabel)}"
|
|
3770
|
+
class="${this.tooltipClasses}"
|
|
3771
|
+
data-sp-tooltip-native
|
|
3772
|
+
id="${ifDefined_js.ifDefined(this.id || void 0)}"
|
|
3773
|
+
role="tooltip"
|
|
3774
|
+
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
3775
|
+
>
|
|
3776
|
+
${this.hasTooltipContent ? this.tooltipContent : lit.nothing}
|
|
3777
|
+
</span>`;
|
|
3778
|
+
}
|
|
3779
|
+
};
|
|
3780
|
+
SpectreTooltipElement.properties = {
|
|
3781
|
+
placement: { type: String, reflect: true },
|
|
3782
|
+
visible: { type: Boolean, reflect: true }
|
|
3783
|
+
};
|
|
3784
|
+
function defineSpectreTooltip(tagName = "sp-tooltip") {
|
|
3785
|
+
const existingElement = customElements.get(tagName);
|
|
3786
|
+
if (existingElement) {
|
|
3787
|
+
return existingElement;
|
|
3788
|
+
}
|
|
3789
|
+
customElements.define(tagName, SpectreTooltipElement);
|
|
3790
|
+
return SpectreTooltipElement;
|
|
3791
|
+
}
|
|
2611
3792
|
|
|
2612
3793
|
// src/index.ts
|
|
2613
3794
|
function defineSpectreComponents() {
|
|
@@ -2629,6 +3810,16 @@ function defineSpectreComponents() {
|
|
|
2629
3810
|
defineSpectreSpinner();
|
|
2630
3811
|
defineSpectreTag();
|
|
2631
3812
|
defineSpectrePricingCard();
|
|
3813
|
+
defineSpectreContainer();
|
|
3814
|
+
defineSpectreGrid();
|
|
3815
|
+
defineSpectreSection();
|
|
3816
|
+
defineSpectreStack();
|
|
3817
|
+
defineSpectreDropdown();
|
|
3818
|
+
defineSpectreModal();
|
|
3819
|
+
defineSpectreNav();
|
|
3820
|
+
defineSpectreSidebar();
|
|
3821
|
+
defineSpectreToast();
|
|
3822
|
+
defineSpectreTooltip();
|
|
2632
3823
|
}
|
|
2633
3824
|
|
|
2634
3825
|
exports.SpectreAlertElement = SpectreAlertElement;
|
|
@@ -2637,18 +3828,28 @@ exports.SpectreBadgeElement = SpectreBadgeElement;
|
|
|
2637
3828
|
exports.SpectreButtonElement = SpectreButtonElement;
|
|
2638
3829
|
exports.SpectreCardElement = SpectreCardElement;
|
|
2639
3830
|
exports.SpectreCheckboxElement = SpectreCheckboxElement;
|
|
3831
|
+
exports.SpectreContainerElement = SpectreContainerElement;
|
|
3832
|
+
exports.SpectreDropdownElement = SpectreDropdownElement;
|
|
2640
3833
|
exports.SpectreFieldsetElement = SpectreFieldsetElement;
|
|
3834
|
+
exports.SpectreGridElement = SpectreGridElement;
|
|
2641
3835
|
exports.SpectreIconBoxElement = SpectreIconBoxElement;
|
|
2642
3836
|
exports.SpectreInputElement = SpectreInputElement;
|
|
2643
3837
|
exports.SpectreLabelElement = SpectreLabelElement;
|
|
3838
|
+
exports.SpectreModalElement = SpectreModalElement;
|
|
3839
|
+
exports.SpectreNavElement = SpectreNavElement;
|
|
2644
3840
|
exports.SpectrePricingCardElement = SpectrePricingCardElement;
|
|
2645
3841
|
exports.SpectreRadioElement = SpectreRadioElement;
|
|
2646
3842
|
exports.SpectreRatingElement = SpectreRatingElement;
|
|
3843
|
+
exports.SpectreSectionElement = SpectreSectionElement;
|
|
2647
3844
|
exports.SpectreSelectElement = SpectreSelectElement;
|
|
3845
|
+
exports.SpectreSidebarElement = SpectreSidebarElement;
|
|
2648
3846
|
exports.SpectreSpinnerElement = SpectreSpinnerElement;
|
|
3847
|
+
exports.SpectreStackElement = SpectreStackElement;
|
|
2649
3848
|
exports.SpectreTagElement = SpectreTagElement;
|
|
2650
3849
|
exports.SpectreTestimonialElement = SpectreTestimonialElement;
|
|
2651
3850
|
exports.SpectreTextareaElement = SpectreTextareaElement;
|
|
3851
|
+
exports.SpectreToastElement = SpectreToastElement;
|
|
3852
|
+
exports.SpectreTooltipElement = SpectreTooltipElement;
|
|
2652
3853
|
exports.defineSpectreAlert = defineSpectreAlert;
|
|
2653
3854
|
exports.defineSpectreAvatar = defineSpectreAvatar;
|
|
2654
3855
|
exports.defineSpectreBadge = defineSpectreBadge;
|
|
@@ -2656,18 +3857,28 @@ exports.defineSpectreButton = defineSpectreButton;
|
|
|
2656
3857
|
exports.defineSpectreCard = defineSpectreCard;
|
|
2657
3858
|
exports.defineSpectreCheckbox = defineSpectreCheckbox;
|
|
2658
3859
|
exports.defineSpectreComponents = defineSpectreComponents;
|
|
3860
|
+
exports.defineSpectreContainer = defineSpectreContainer;
|
|
3861
|
+
exports.defineSpectreDropdown = defineSpectreDropdown;
|
|
2659
3862
|
exports.defineSpectreFieldset = defineSpectreFieldset;
|
|
3863
|
+
exports.defineSpectreGrid = defineSpectreGrid;
|
|
2660
3864
|
exports.defineSpectreIconBox = defineSpectreIconBox;
|
|
2661
3865
|
exports.defineSpectreInput = defineSpectreInput;
|
|
2662
3866
|
exports.defineSpectreLabel = defineSpectreLabel;
|
|
3867
|
+
exports.defineSpectreModal = defineSpectreModal;
|
|
3868
|
+
exports.defineSpectreNav = defineSpectreNav;
|
|
2663
3869
|
exports.defineSpectrePricingCard = defineSpectrePricingCard;
|
|
2664
3870
|
exports.defineSpectreRadio = defineSpectreRadio;
|
|
2665
3871
|
exports.defineSpectreRating = defineSpectreRating;
|
|
3872
|
+
exports.defineSpectreSection = defineSpectreSection;
|
|
2666
3873
|
exports.defineSpectreSelect = defineSpectreSelect;
|
|
3874
|
+
exports.defineSpectreSidebar = defineSpectreSidebar;
|
|
2667
3875
|
exports.defineSpectreSpinner = defineSpectreSpinner;
|
|
3876
|
+
exports.defineSpectreStack = defineSpectreStack;
|
|
2668
3877
|
exports.defineSpectreTag = defineSpectreTag;
|
|
2669
3878
|
exports.defineSpectreTestimonial = defineSpectreTestimonial;
|
|
2670
3879
|
exports.defineSpectreTextarea = defineSpectreTextarea;
|
|
3880
|
+
exports.defineSpectreToast = defineSpectreToast;
|
|
3881
|
+
exports.defineSpectreTooltip = defineSpectreTooltip;
|
|
2671
3882
|
exports.spectreAlertSizes = spectreInputSizes;
|
|
2672
3883
|
exports.spectreAlertVariants = spectreAlertVariants;
|
|
2673
3884
|
exports.spectreAvatarShapes = spectreAvatarShapes;
|
|
@@ -2678,6 +3889,10 @@ exports.spectreButtonSizes = spectreInputSizes;
|
|
|
2678
3889
|
exports.spectreButtonTypes = spectreButtonTypes;
|
|
2679
3890
|
exports.spectreButtonVariants = spectreButtonVariants;
|
|
2680
3891
|
exports.spectreCardVariants = spectreCardVariants;
|
|
3892
|
+
exports.spectreContainerMaxWidths = spectreContainerMaxWidths;
|
|
3893
|
+
exports.spectreDropdownPlacements = spectreDropdownPlacements;
|
|
3894
|
+
exports.spectreGridColumns = spectreGridColumns;
|
|
3895
|
+
exports.spectreGridGaps = spectreGridGaps;
|
|
2681
3896
|
exports.spectreIconBoxSizes = spectreInputSizes;
|
|
2682
3897
|
exports.spectreIconBoxVariants = spectreIconBoxVariants;
|
|
2683
3898
|
exports.spectreInputSizes = spectreInputSizes;
|
|
@@ -2685,8 +3900,13 @@ exports.spectreInputTypes = spectreInputTypes;
|
|
|
2685
3900
|
exports.spectreRatingSizes = spectreInputSizes;
|
|
2686
3901
|
exports.spectreSpinnerSizes = spectreInputSizes;
|
|
2687
3902
|
exports.spectreSpinnerVariants = spectreSpinnerVariants;
|
|
3903
|
+
exports.spectreStackAligns = spectreStackAligns;
|
|
3904
|
+
exports.spectreStackBases = spectreStackBases;
|
|
3905
|
+
exports.spectreStackDirections = spectreStackDirections;
|
|
2688
3906
|
exports.spectreTagSizes = spectreInputSizes;
|
|
2689
3907
|
exports.spectreTagVariants = spectreTagVariants;
|
|
2690
3908
|
exports.spectreTestimonialVariants = spectreTestimonialVariants;
|
|
3909
|
+
exports.spectreToastVariants = spectreToastVariants;
|
|
3910
|
+
exports.spectreTooltipPlacements = spectreTooltipPlacements;
|
|
2691
3911
|
//# sourceMappingURL=index.cjs.map
|
|
2692
3912
|
//# sourceMappingURL=index.cjs.map
|