@phcdevworks/spectre-components 1.19.0 → 1.21.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 +770 -125
- package/dist/accordion-item.cjs +540 -0
- package/dist/accordion-item.cjs.map +1 -0
- package/dist/accordion-item.d.cts +59 -0
- package/dist/accordion-item.d.ts +59 -0
- package/dist/accordion-item.js +537 -0
- package/dist/accordion-item.js.map +1 -0
- package/dist/accordion.cjs +468 -0
- package/dist/accordion.cjs.map +1 -0
- package/dist/accordion.d.cts +38 -0
- package/dist/accordion.d.ts +38 -0
- package/dist/accordion.js +465 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.cjs +166 -65
- package/dist/alert.cjs.map +1 -1
- package/dist/alert.d.cts +41 -8
- package/dist/alert.d.ts +41 -8
- package/dist/alert.js +168 -67
- package/dist/alert.js.map +1 -1
- package/dist/avatar.cjs +27 -1
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.d.cts +19 -3
- package/dist/avatar.d.ts +19 -3
- package/dist/avatar.js +27 -1
- package/dist/avatar.js.map +1 -1
- package/dist/badge.cjs +83 -3
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.d.cts +51 -3
- package/dist/badge.d.ts +51 -3
- package/dist/badge.js +83 -3
- package/dist/badge.js.map +1 -1
- package/dist/breadcrumb.cjs +464 -0
- package/dist/breadcrumb.cjs.map +1 -0
- package/dist/breadcrumb.d.cts +32 -0
- package/dist/breadcrumb.d.ts +32 -0
- package/dist/breadcrumb.js +461 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button.cjs +32 -2
- package/dist/button.cjs.map +1 -1
- package/dist/button.d.cts +19 -3
- package/dist/button.d.ts +19 -3
- package/dist/button.js +32 -2
- package/dist/button.js.map +1 -1
- package/dist/card-bleed.cjs +458 -0
- package/dist/card-bleed.cjs.map +1 -0
- package/dist/card-bleed.d.cts +37 -0
- package/dist/card-bleed.d.ts +37 -0
- package/dist/card-bleed.js +455 -0
- package/dist/card-bleed.js.map +1 -0
- package/dist/card.cjs +61 -1
- package/dist/card.cjs.map +1 -1
- package/dist/card.d.cts +33 -4
- package/dist/card.d.ts +33 -4
- package/dist/card.js +60 -2
- package/dist/card.js.map +1 -1
- package/dist/carousel.cjs +655 -0
- package/dist/carousel.cjs.map +1 -0
- package/dist/carousel.d.cts +79 -0
- package/dist/carousel.d.ts +79 -0
- package/dist/carousel.js +652 -0
- package/dist/carousel.js.map +1 -0
- package/dist/checkbox.cjs +3 -1
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.js +3 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/choice-card.cjs +524 -0
- package/dist/choice-card.cjs.map +1 -0
- package/dist/choice-card.d.cts +81 -0
- package/dist/choice-card.d.ts +81 -0
- package/dist/choice-card.js +521 -0
- package/dist/choice-card.js.map +1 -0
- package/dist/container.cjs +23 -6
- package/dist/container.cjs.map +1 -1
- package/dist/container.d.cts +9 -3
- package/dist/container.d.ts +9 -3
- package/dist/container.js +23 -7
- package/dist/container.js.map +1 -1
- package/dist/datepicker.cjs +580 -0
- package/dist/datepicker.cjs.map +1 -0
- package/dist/datepicker.d.cts +78 -0
- package/dist/datepicker.d.ts +78 -0
- package/dist/datepicker.js +577 -0
- package/dist/datepicker.js.map +1 -0
- package/dist/dom-CX9bgbcQ.d.cts +3 -0
- package/dist/dom-CX9bgbcQ.d.ts +3 -0
- package/dist/dropdown.cjs +66 -3
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.d.cts +22 -2
- package/dist/dropdown.d.ts +22 -2
- package/dist/dropdown.js +67 -4
- package/dist/dropdown.js.map +1 -1
- package/dist/external-auth-button.cjs +494 -0
- package/dist/external-auth-button.cjs.map +1 -0
- package/dist/external-auth-button.d.cts +71 -0
- package/dist/external-auth-button.d.ts +71 -0
- package/dist/external-auth-button.js +491 -0
- package/dist/external-auth-button.js.map +1 -0
- package/dist/fieldset.cjs +3 -1
- package/dist/fieldset.cjs.map +1 -1
- package/dist/fieldset.js +3 -1
- package/dist/fieldset.js.map +1 -1
- package/dist/file-input.cjs +371 -0
- package/dist/file-input.cjs.map +1 -0
- package/dist/file-input.d.cts +96 -0
- package/dist/file-input.d.ts +96 -0
- package/dist/file-input.js +367 -0
- package/dist/file-input.js.map +1 -0
- package/dist/footer-chip.cjs +22 -2
- package/dist/footer-chip.cjs.map +1 -1
- package/dist/footer-chip.d.cts +12 -1
- package/dist/footer-chip.d.ts +12 -1
- package/dist/footer-chip.js +22 -2
- package/dist/footer-chip.js.map +1 -1
- package/dist/footer-link.cjs +19 -1
- package/dist/footer-link.cjs.map +1 -1
- package/dist/footer-link.d.cts +12 -1
- package/dist/footer-link.d.ts +12 -1
- package/dist/footer-link.js +19 -1
- package/dist/footer-link.js.map +1 -1
- package/dist/footer.cjs +62 -1
- package/dist/footer.cjs.map +1 -1
- package/dist/footer.d.cts +15 -0
- package/dist/footer.d.ts +15 -0
- package/dist/footer.js +63 -2
- package/dist/footer.js.map +1 -1
- package/dist/{form-TvtLcoW0.d.cts → form-CVO7mlDa.d.cts} +42 -9
- package/dist/{form-TvtLcoW0.d.ts → form-CVO7mlDa.d.ts} +42 -9
- package/dist/grid.cjs +35 -1
- package/dist/grid.cjs.map +1 -1
- package/dist/grid.d.cts +9 -3
- package/dist/grid.d.ts +9 -3
- package/dist/grid.js +35 -2
- package/dist/grid.js.map +1 -1
- package/dist/icon-box.cjs +27 -1
- package/dist/icon-box.cjs.map +1 -1
- package/dist/icon-box.d.cts +19 -3
- package/dist/icon-box.d.ts +19 -3
- package/dist/icon-box.js +27 -1
- package/dist/icon-box.js.map +1 -1
- package/dist/index.cjs +3849 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +3787 -112
- package/dist/index.js.map +1 -1
- package/dist/input-group.cjs +471 -0
- package/dist/input-group.cjs.map +1 -0
- package/dist/input-group.d.cts +31 -0
- package/dist/input-group.d.ts +31 -0
- package/dist/input-group.js +468 -0
- package/dist/input-group.js.map +1 -0
- package/dist/input.cjs +96 -4
- package/dist/input.cjs.map +1 -1
- package/dist/input.d.cts +45 -6
- package/dist/input.d.ts +45 -6
- package/dist/input.js +98 -6
- package/dist/input.js.map +1 -1
- package/dist/label.cjs +3 -1
- package/dist/label.cjs.map +1 -1
- package/dist/label.js +3 -1
- package/dist/label.js.map +1 -1
- package/dist/list-group-item.cjs +367 -0
- package/dist/list-group-item.cjs.map +1 -0
- package/dist/list-group-item.d.cts +73 -0
- package/dist/list-group-item.d.ts +73 -0
- package/dist/list-group-item.js +364 -0
- package/dist/list-group-item.js.map +1 -0
- package/dist/list-group.cjs +610 -0
- package/dist/list-group.cjs.map +1 -0
- package/dist/list-group.d.cts +58 -0
- package/dist/list-group.d.ts +58 -0
- package/dist/list-group.js +607 -0
- package/dist/list-group.js.map +1 -0
- package/dist/modal.cjs +70 -35
- package/dist/modal.cjs.map +1 -1
- package/dist/modal.d.cts +14 -2
- package/dist/modal.d.ts +14 -2
- package/dist/modal.js +70 -35
- package/dist/modal.js.map +1 -1
- package/dist/nav-item.cjs +107 -4
- package/dist/nav-item.cjs.map +1 -1
- package/dist/nav-item.d.cts +52 -2
- package/dist/nav-item.d.ts +52 -2
- package/dist/nav-item.js +108 -5
- package/dist/nav-item.js.map +1 -1
- package/dist/nav.cjs +57 -1
- package/dist/nav.cjs.map +1 -1
- package/dist/nav.d.cts +15 -1
- package/dist/nav.d.ts +15 -1
- package/dist/nav.js +58 -2
- package/dist/nav.js.map +1 -1
- package/dist/offcanvas.cjs +621 -0
- package/dist/offcanvas.cjs.map +1 -0
- package/dist/offcanvas.d.cts +61 -0
- package/dist/offcanvas.d.ts +61 -0
- package/dist/offcanvas.js +617 -0
- package/dist/offcanvas.js.map +1 -0
- package/dist/pagination.cjs +452 -0
- package/dist/pagination.cjs.map +1 -0
- package/dist/pagination.d.cts +69 -0
- package/dist/pagination.d.ts +69 -0
- package/dist/pagination.js +448 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.cjs +534 -0
- package/dist/popover.cjs.map +1 -0
- package/dist/popover.d.cts +59 -0
- package/dist/popover.d.ts +59 -0
- package/dist/popover.js +530 -0
- package/dist/popover.js.map +1 -0
- package/dist/pricing-card.cjs +153 -64
- package/dist/pricing-card.cjs.map +1 -1
- package/dist/pricing-card.d.cts +34 -6
- package/dist/pricing-card.d.ts +34 -6
- package/dist/pricing-card.js +154 -65
- package/dist/pricing-card.js.map +1 -1
- package/dist/progress.cjs +403 -0
- package/dist/progress.cjs.map +1 -0
- package/dist/progress.d.cts +70 -0
- package/dist/progress.d.ts +70 -0
- package/dist/progress.js +398 -0
- package/dist/progress.js.map +1 -0
- package/dist/prose.cjs +425 -0
- package/dist/prose.cjs.map +1 -0
- package/dist/prose.d.cts +21 -0
- package/dist/prose.d.ts +21 -0
- package/dist/prose.js +422 -0
- package/dist/prose.js.map +1 -0
- package/dist/radio.cjs +3 -1
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.js +3 -1
- package/dist/radio.js.map +1 -1
- package/dist/range.cjs +381 -0
- package/dist/range.cjs.map +1 -0
- package/dist/range.d.cts +76 -0
- package/dist/range.d.ts +76 -0
- package/dist/range.js +378 -0
- package/dist/range.js.map +1 -0
- package/dist/rating.cjs +33 -0
- package/dist/rating.cjs.map +1 -1
- package/dist/rating.d.cts +38 -3
- package/dist/rating.d.ts +38 -3
- package/dist/rating.js +33 -0
- package/dist/rating.js.map +1 -1
- package/dist/section.cjs +27 -3
- package/dist/section.cjs.map +1 -1
- package/dist/section.d.cts +16 -1
- package/dist/section.d.ts +16 -1
- package/dist/section.js +27 -4
- package/dist/section.js.map +1 -1
- package/dist/select.cjs +6 -1
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +7 -1
- package/dist/select.d.ts +7 -1
- package/dist/select.js +6 -1
- package/dist/select.js.map +1 -1
- package/dist/sidebar-link.cjs +19 -1
- package/dist/sidebar-link.cjs.map +1 -1
- package/dist/sidebar-link.d.cts +13 -2
- package/dist/sidebar-link.d.ts +13 -2
- package/dist/sidebar-link.js +19 -1
- package/dist/sidebar-link.js.map +1 -1
- package/dist/sidebar-toggle.cjs +3 -1
- package/dist/sidebar-toggle.cjs.map +1 -1
- package/dist/sidebar-toggle.js +3 -1
- package/dist/sidebar-toggle.js.map +1 -1
- package/dist/sidebar.cjs +33 -1
- package/dist/sidebar.cjs.map +1 -1
- package/dist/sidebar.d.cts +1 -0
- package/dist/sidebar.d.ts +1 -0
- package/dist/sidebar.js +34 -2
- package/dist/sidebar.js.map +1 -1
- package/dist/spinner.cjs +2 -1
- package/dist/spinner.cjs.map +1 -1
- package/dist/spinner.d.cts +2 -2
- package/dist/spinner.d.ts +2 -2
- package/dist/spinner.js +2 -1
- package/dist/spinner.js.map +1 -1
- package/dist/stack.cjs +4 -2
- package/dist/stack.cjs.map +1 -1
- package/dist/stack.d.cts +2 -2
- package/dist/stack.d.ts +2 -2
- package/dist/stack.js +4 -2
- package/dist/stack.js.map +1 -1
- package/dist/states-Bgzwu_XZ.d.cts +9 -0
- package/dist/states-Bgzwu_XZ.d.ts +9 -0
- package/dist/stepper.cjs +495 -0
- package/dist/stepper.cjs.map +1 -0
- package/dist/stepper.d.cts +40 -0
- package/dist/stepper.d.ts +40 -0
- package/dist/stepper.js +491 -0
- package/dist/stepper.js.map +1 -0
- package/dist/switch.cjs +492 -0
- package/dist/switch.cjs.map +1 -0
- package/dist/switch.d.cts +82 -0
- package/dist/switch.d.ts +82 -0
- package/dist/switch.js +488 -0
- package/dist/switch.js.map +1 -0
- package/dist/tab-panel.cjs +465 -0
- package/dist/tab-panel.cjs.map +1 -0
- package/dist/tab-panel.d.cts +48 -0
- package/dist/tab-panel.d.ts +48 -0
- package/dist/tab-panel.js +462 -0
- package/dist/tab-panel.js.map +1 -0
- package/dist/table.cjs +506 -0
- package/dist/table.cjs.map +1 -0
- package/dist/table.d.cts +54 -0
- package/dist/table.d.ts +54 -0
- package/dist/table.js +501 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.cjs +596 -0
- package/dist/tabs.cjs.map +1 -0
- package/dist/tabs.d.cts +65 -0
- package/dist/tabs.d.ts +65 -0
- package/dist/tabs.js +592 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tag.cjs +27 -1
- package/dist/tag.cjs.map +1 -1
- package/dist/tag.d.cts +19 -3
- package/dist/tag.d.ts +19 -3
- package/dist/tag.js +27 -1
- package/dist/tag.js.map +1 -1
- package/dist/testimonial.cjs +162 -64
- package/dist/testimonial.cjs.map +1 -1
- package/dist/testimonial.d.cts +36 -8
- package/dist/testimonial.d.ts +36 -8
- package/dist/testimonial.js +163 -65
- package/dist/testimonial.js.map +1 -1
- package/dist/text.cjs +65 -6
- package/dist/text.cjs.map +1 -1
- package/dist/text.d.cts +24 -3
- package/dist/text.d.ts +24 -3
- package/dist/text.js +64 -8
- package/dist/text.js.map +1 -1
- package/dist/textarea.cjs +3 -0
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.d.cts +7 -1
- package/dist/textarea.d.ts +7 -1
- package/dist/textarea.js +3 -0
- package/dist/textarea.js.map +1 -1
- package/dist/toast.cjs +34 -1
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.d.cts +15 -2
- package/dist/toast.d.ts +15 -2
- package/dist/toast.js +34 -1
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.cjs +32 -0
- package/dist/tooltip.cjs.map +1 -1
- package/dist/tooltip.d.cts +15 -2
- package/dist/tooltip.d.ts +15 -2
- package/dist/tooltip.js +32 -0
- package/dist/tooltip.js.map +1 -1
- package/package.json +130 -15
package/dist/alert.cjs
CHANGED
|
@@ -14,7 +14,8 @@ var spectreAlertVariants = [
|
|
|
14
14
|
"success",
|
|
15
15
|
"warning",
|
|
16
16
|
"danger",
|
|
17
|
-
"neutral"
|
|
17
|
+
"neutral",
|
|
18
|
+
"brand"
|
|
18
19
|
];
|
|
19
20
|
function isAlertVariant(value) {
|
|
20
21
|
return spectreAlertVariants.includes(value);
|
|
@@ -281,6 +282,28 @@ var SpectreBaseElement = class extends lit.LitElement {
|
|
|
281
282
|
}
|
|
282
283
|
};
|
|
283
284
|
SpectreBaseElement.properties = {};
|
|
285
|
+
var paths = {
|
|
286
|
+
check: lit.svg`<path d="M3 8.5l3 3 7-7" />`,
|
|
287
|
+
chevronDown: lit.svg`<path d="M4 6l4 4 4-4" />`,
|
|
288
|
+
chevronLeft: lit.svg`<path d="M10 4l-4 4 4 4" />`,
|
|
289
|
+
chevronRight: lit.svg`<path d="M6 4l4 4-4 4" />`,
|
|
290
|
+
close: lit.svg`<path d="M4 4l8 8M12 4l-8 8" />`
|
|
291
|
+
};
|
|
292
|
+
function renderIcon(name, sizeClass = "sp-icon-sm") {
|
|
293
|
+
return lit.html`<svg
|
|
294
|
+
aria-hidden="true"
|
|
295
|
+
class="${sizeClass}"
|
|
296
|
+
fill="none"
|
|
297
|
+
focusable="false"
|
|
298
|
+
stroke="currentColor"
|
|
299
|
+
stroke-linecap="round"
|
|
300
|
+
stroke-linejoin="round"
|
|
301
|
+
stroke-width="2"
|
|
302
|
+
viewBox="0 0 16 16"
|
|
303
|
+
>
|
|
304
|
+
${paths[name]}
|
|
305
|
+
</svg>`;
|
|
306
|
+
}
|
|
284
307
|
|
|
285
308
|
// src/utils/dom.ts
|
|
286
309
|
function hasMeaningfulContent(nodes) {
|
|
@@ -295,79 +318,135 @@ function hasMeaningfulContent(nodes) {
|
|
|
295
318
|
});
|
|
296
319
|
}
|
|
297
320
|
|
|
298
|
-
// src/utils/
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
321
|
+
// src/utils/projection.ts
|
|
322
|
+
function slotOf(node) {
|
|
323
|
+
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
324
|
+
return void 0;
|
|
325
|
+
}
|
|
326
|
+
return node.getAttribute("slot") ?? void 0;
|
|
327
|
+
}
|
|
328
|
+
var ProjectionController = class {
|
|
329
|
+
constructor(host, internalAttributes) {
|
|
330
|
+
this.host = host;
|
|
331
|
+
this.internalAttributes = internalAttributes;
|
|
332
|
+
this.projected = [];
|
|
333
|
+
host.addController(this);
|
|
303
334
|
}
|
|
304
|
-
|
|
305
|
-
|
|
335
|
+
hostConnected() {
|
|
336
|
+
this.sync();
|
|
337
|
+
this.observe();
|
|
306
338
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
this.
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
339
|
+
hostDisconnected() {
|
|
340
|
+
this.disconnect();
|
|
341
|
+
}
|
|
342
|
+
hostUpdate() {
|
|
343
|
+
this.sync();
|
|
344
|
+
this.disconnect();
|
|
345
|
+
}
|
|
346
|
+
hostUpdated() {
|
|
347
|
+
this.observe();
|
|
348
|
+
}
|
|
349
|
+
// Every projected node in authored order, regardless of slot.
|
|
350
|
+
all() {
|
|
351
|
+
return [...this.projected];
|
|
352
|
+
}
|
|
353
|
+
// Omitting `slot` returns the nodes without a slot attribute.
|
|
354
|
+
nodes(slot) {
|
|
355
|
+
return this.projected.filter((node) => slotOf(node) === slot);
|
|
356
|
+
}
|
|
357
|
+
elements(slot) {
|
|
358
|
+
return this.nodes(slot).filter(
|
|
359
|
+
(node) => node.nodeType === Node.ELEMENT_NODE
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
has(slot) {
|
|
363
|
+
return hasMeaningfulContent(this.nodes(slot));
|
|
364
|
+
}
|
|
365
|
+
isInternalNode(node) {
|
|
366
|
+
return node.nodeType === Node.ELEMENT_NODE && this.internalAttributes.some(
|
|
367
|
+
(name) => node.hasAttribute(name)
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
isProjectable(node) {
|
|
371
|
+
if (node.nodeType === Node.COMMENT_NODE || this.isInternalNode(node)) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
if (node.nodeType === Node.TEXT_NODE && this.hostHasRendered) {
|
|
375
|
+
return Boolean(node.textContent?.trim());
|
|
376
|
+
}
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
get hostHasRendered() {
|
|
380
|
+
return this.host.hasUpdated;
|
|
381
|
+
}
|
|
382
|
+
sync() {
|
|
383
|
+
const next = [
|
|
384
|
+
.../* @__PURE__ */ new Set([
|
|
385
|
+
...this.projected.filter((node) => this.host.contains(node)),
|
|
386
|
+
...Array.from(this.host.childNodes).filter(
|
|
387
|
+
(node) => this.isProjectable(node)
|
|
388
|
+
)
|
|
389
|
+
])
|
|
326
390
|
];
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
const hasChanged = nextProjectedContent.length !== this.projectedContent.length || nextProjectedContent.some((node, index) => node !== this.projectedContent[index]);
|
|
333
|
-
if (hasChanged) {
|
|
334
|
-
this.projectedContent = nextProjectedContent;
|
|
391
|
+
const changed = next.length !== this.projected.length || next.some((node, index) => node !== this.projected[index]);
|
|
392
|
+
if (changed) {
|
|
393
|
+
this.projected = next;
|
|
335
394
|
}
|
|
336
|
-
return
|
|
395
|
+
return changed;
|
|
337
396
|
}
|
|
338
|
-
|
|
339
|
-
if (this.
|
|
397
|
+
observe() {
|
|
398
|
+
if (this.observer || !this.host.isConnected) {
|
|
340
399
|
return;
|
|
341
400
|
}
|
|
342
|
-
this.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
(node) => this.isInternalNode(node) || this.contains(node)
|
|
346
|
-
) && [...mutation.addedNodes].every((node) => this.isInternalNode(node))
|
|
347
|
-
);
|
|
348
|
-
if (isInternalMovement) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
if (this.syncProjectedContent()) {
|
|
352
|
-
this.requestUpdate();
|
|
401
|
+
this.observer = new MutationObserver(() => {
|
|
402
|
+
if (this.sync()) {
|
|
403
|
+
this.host.requestUpdate();
|
|
353
404
|
}
|
|
354
405
|
});
|
|
355
|
-
this.
|
|
406
|
+
this.observer.observe(this.host, { childList: true });
|
|
356
407
|
}
|
|
357
|
-
|
|
358
|
-
this.
|
|
359
|
-
this.
|
|
408
|
+
disconnect() {
|
|
409
|
+
this.observer?.disconnect();
|
|
410
|
+
this.observer = void 0;
|
|
360
411
|
}
|
|
361
412
|
};
|
|
362
|
-
|
|
413
|
+
|
|
414
|
+
// src/utils/states.ts
|
|
415
|
+
var hoverFocusStateProperties = {
|
|
416
|
+
focused: { type: Boolean, reflect: true },
|
|
417
|
+
hovered: { type: Boolean, reflect: true }
|
|
418
|
+
};
|
|
419
|
+
var interactionStateProperties = {
|
|
420
|
+
...hoverFocusStateProperties,
|
|
421
|
+
active: { type: Boolean, reflect: true }
|
|
422
|
+
};
|
|
423
|
+
function hoverFocusStates(element) {
|
|
424
|
+
return {
|
|
425
|
+
focused: element.focused ?? false,
|
|
426
|
+
hovered: element.hovered ?? false
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function interactionStates(element) {
|
|
430
|
+
return { ...hoverFocusStates(element), active: element.active ?? false };
|
|
431
|
+
}
|
|
432
|
+
var SpectreAlertElement = class extends SpectreBaseElement {
|
|
363
433
|
constructor() {
|
|
364
434
|
super(...arguments);
|
|
435
|
+
this.interactive = false;
|
|
436
|
+
this.active = false;
|
|
437
|
+
this.focused = false;
|
|
438
|
+
this.hovered = false;
|
|
439
|
+
this.dismissLabel = "Dismiss";
|
|
365
440
|
this.dismissed = false;
|
|
441
|
+
this.dismissible = false;
|
|
366
442
|
this.disabled = false;
|
|
367
443
|
this.fullWidth = false;
|
|
368
444
|
this.loading = false;
|
|
369
445
|
this.size = "md";
|
|
370
446
|
this.variant = "info";
|
|
447
|
+
this.projection = new ProjectionController(this, [
|
|
448
|
+
"data-sp-alert-native"
|
|
449
|
+
]);
|
|
371
450
|
}
|
|
372
451
|
get id() {
|
|
373
452
|
return super.id;
|
|
@@ -381,20 +460,16 @@ var SpectreAlertElement = class extends SpectreProjectableElement {
|
|
|
381
460
|
set title(value) {
|
|
382
461
|
super.title = value;
|
|
383
462
|
}
|
|
384
|
-
getContentContainer() {
|
|
385
|
-
return this.querySelector("[data-sp-alert-native]");
|
|
386
|
-
}
|
|
387
|
-
isInternalNode(node) {
|
|
388
|
-
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
const el = node;
|
|
392
|
-
return el.hasAttribute("data-sp-alert-native");
|
|
393
|
-
}
|
|
394
463
|
willUpdate(changedProperties) {
|
|
464
|
+
if (changedProperties.has("dismissLabel") && !this.dismissLabel) {
|
|
465
|
+
this.dismissLabel = "Dismiss";
|
|
466
|
+
}
|
|
395
467
|
if (changedProperties.has("dismissed") && this.dismissed == null) {
|
|
396
468
|
this.dismissed = false;
|
|
397
469
|
}
|
|
470
|
+
if (changedProperties.has("dismissible") && this.dismissible == null) {
|
|
471
|
+
this.dismissible = false;
|
|
472
|
+
}
|
|
398
473
|
if (changedProperties.has("disabled") && this.disabled == null) {
|
|
399
474
|
this.disabled = false;
|
|
400
475
|
}
|
|
@@ -411,10 +486,20 @@ var SpectreAlertElement = class extends SpectreProjectableElement {
|
|
|
411
486
|
this.size = "md";
|
|
412
487
|
}
|
|
413
488
|
}
|
|
489
|
+
dismiss() {
|
|
490
|
+
if (this.dismissed) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
this.dismissed = true;
|
|
494
|
+
this.dispatchEvent(new CustomEvent("sp-dismiss", { bubbles: true }));
|
|
495
|
+
}
|
|
414
496
|
get alertClasses() {
|
|
415
497
|
return spectreUi.getAlertClasses({
|
|
498
|
+
interactive: this.interactive ?? false,
|
|
499
|
+
...interactionStates(this),
|
|
416
500
|
disabled: this.isDisabled,
|
|
417
501
|
dismissed: this.dismissed ?? false,
|
|
502
|
+
dismissible: this.dismissible ?? false,
|
|
418
503
|
fullWidth: this.fullWidth ?? false,
|
|
419
504
|
loading: this.loading ?? false,
|
|
420
505
|
size: this.size,
|
|
@@ -433,12 +518,28 @@ var SpectreAlertElement = class extends SpectreProjectableElement {
|
|
|
433
518
|
role="alert"
|
|
434
519
|
title="${ifDefined_js.ifDefined(this.title || void 0)}"
|
|
435
520
|
>
|
|
436
|
-
${this.
|
|
521
|
+
${this.projection.has("icon") ? lit.html`<span class="${spectreUi.getAlertIconClasses()}"
|
|
522
|
+
>${this.projection.nodes("icon")}</span
|
|
523
|
+
>` : lit.nothing}
|
|
524
|
+
${this.projection.has() ? this.projection.nodes() : lit.nothing}
|
|
525
|
+
${this.dismissible ? lit.html`<button
|
|
526
|
+
aria-label="${this.dismissLabel ?? "Dismiss"}"
|
|
527
|
+
class="${spectreUi.getAlertDismissClasses()}"
|
|
528
|
+
data-sp-alert-dismiss
|
|
529
|
+
type="button"
|
|
530
|
+
@click="${() => this.dismiss()}"
|
|
531
|
+
>
|
|
532
|
+
${renderIcon("close")}
|
|
533
|
+
</button>` : lit.nothing}
|
|
437
534
|
</div>`;
|
|
438
535
|
}
|
|
439
536
|
};
|
|
440
537
|
SpectreAlertElement.properties = {
|
|
538
|
+
interactive: { type: Boolean, reflect: true },
|
|
539
|
+
...interactionStateProperties,
|
|
540
|
+
dismissLabel: { attribute: "dismiss-label", type: String },
|
|
441
541
|
dismissed: { type: Boolean, reflect: true },
|
|
542
|
+
dismissible: { type: Boolean, reflect: true },
|
|
442
543
|
disabled: { type: Boolean, reflect: true },
|
|
443
544
|
fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
|
|
444
545
|
loading: { type: Boolean, reflect: true },
|
package/dist/alert.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/form.ts","../src/utils/base.ts","../src/utils/dom.ts","../src/utils/projectable.ts","../src/components/alert/sp-alert.ts"],"names":["LitElement","getAlertClasses","html","ifDefined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SAAS,mBAAmB,CAAA;AAClD,EAAA,OAAO,mBAAA;AACT","file":"alert.cjs","sourcesContent":["import {\n type ButtonSize,\n type ButtonVariant,\n type InputSize\n} from '@phcdevworks/spectre-ui'\n\nexport const spectreInputSizes = ['sm', 'md', 'lg'] as const\nexport type SpectreInputSize = (typeof spectreInputSizes)[number]\n\nexport function isInputSize(value: unknown): value is InputSize | ButtonSize {\n return (spectreInputSizes as readonly string[]).includes(value as string)\n}\n\nexport const spectreButtonVariants = [\n 'primary',\n 'secondary',\n 'ghost',\n 'danger',\n 'success',\n 'cta',\n 'accent',\n 'inverse'\n] as const\n\nexport type SpectreButtonVariant = (typeof spectreButtonVariants)[number]\n\nexport function isButtonVariant(value: unknown): value is ButtonVariant {\n return (spectreButtonVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreButtonTypes = ['button', 'submit', 'reset'] as const\n\nexport type SpectreButtonType = (typeof spectreButtonTypes)[number]\n\nexport function isButtonType(value: unknown): value is SpectreButtonType {\n return (spectreButtonTypes as readonly string[]).includes(value as string)\n}\n\nexport const spectreInputTypes = [\n 'text',\n 'email',\n 'password',\n 'search',\n 'tel',\n 'url',\n 'number',\n 'date',\n 'datetime-local',\n 'month',\n 'time',\n 'week'\n] as const\n\nexport type SpectreInputType = (typeof spectreInputTypes)[number]\n\nexport function isInputType(value: unknown): value is SpectreInputType {\n return (spectreInputTypes as readonly string[]).includes(value as string)\n}\n\nexport const spectreBadgeVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'neutral',\n 'info',\n 'ghost',\n 'outline',\n 'accent',\n 'cta',\n 'inverse'\n] as const\n\nexport type SpectreBadgeVariant = (typeof spectreBadgeVariants)[number]\n\nexport function isBadgeVariant(value: unknown): value is SpectreBadgeVariant {\n return (spectreBadgeVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreAlertVariants = [\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'neutral'\n] as const\n\nexport type SpectreAlertVariant = (typeof spectreAlertVariants)[number]\n\nexport function isAlertVariant(value: unknown): value is SpectreAlertVariant {\n return (spectreAlertVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreCardVariants = [\n 'elevated',\n 'flat',\n 'outline',\n 'ghost'\n] as const\n\nexport type SpectreCardVariant = (typeof spectreCardVariants)[number]\n\nexport function isCardVariant(value: unknown): value is SpectreCardVariant {\n return (spectreCardVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreCardPaddingSizes = ['sm', 'md', 'lg'] as const\n\nexport type SpectreCardPaddingSize = (typeof spectreCardPaddingSizes)[number]\n\nexport function isCardPaddingSize(\n value: unknown\n): value is SpectreCardPaddingSize {\n return (spectreCardPaddingSizes as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreIconBoxVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n 'ghost',\n 'accent',\n 'cta',\n 'outline'\n] as const\n\nexport type SpectreIconBoxVariant = (typeof spectreIconBoxVariants)[number]\n\nexport function isIconBoxVariant(\n value: unknown\n): value is SpectreIconBoxVariant {\n return (spectreIconBoxVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreTestimonialVariants = [\n 'elevated',\n 'flat',\n 'outline',\n 'ghost'\n] as const\n\nexport type SpectreTestimonialVariant =\n (typeof spectreTestimonialVariants)[number]\n\nexport function isTestimonialVariant(\n value: unknown\n): value is SpectreTestimonialVariant {\n return (spectreTestimonialVariants as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreSpinnerVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n 'accent',\n 'cta'\n] as const\n\nexport type SpectreSpinnerVariant = (typeof spectreSpinnerVariants)[number]\n\nexport function isSpinnerVariant(\n value: unknown\n): value is SpectreSpinnerVariant {\n return (spectreSpinnerVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreTagVariants = [\n 'default',\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n 'accent',\n 'cta',\n 'outline',\n 'ghost'\n] as const\n\nexport type SpectreTagVariant = (typeof spectreTagVariants)[number]\n\nexport function isTagVariant(value: unknown): value is SpectreTagVariant {\n return (spectreTagVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreAvatarSizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const\n\nexport type SpectreAvatarSize = (typeof spectreAvatarSizes)[number]\n\nexport function isAvatarSize(value: unknown): value is SpectreAvatarSize {\n return (spectreAvatarSizes as readonly string[]).includes(value as string)\n}\n\nexport const spectreAvatarShapes = ['circle', 'square'] as const\n\nexport type SpectreAvatarShape = (typeof spectreAvatarShapes)[number]\n\nexport function isAvatarShape(value: unknown): value is SpectreAvatarShape {\n return (spectreAvatarShapes as readonly string[]).includes(value as string)\n}\n\nexport const spectreContainerMaxWidths = ['prose'] as const\n\nexport type SpectreContainerMaxWidth =\n (typeof spectreContainerMaxWidths)[number]\n\nexport function isContainerMaxWidth(\n value: unknown\n): value is SpectreContainerMaxWidth {\n return (spectreContainerMaxWidths as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreGridColumns = [1, 2, 3, 4, 6, 12] as const\n\nexport type SpectreGridColumns = (typeof spectreGridColumns)[number]\n\nexport function isGridColumns(value: unknown): value is SpectreGridColumns {\n return (spectreGridColumns as readonly number[]).includes(value as number)\n}\n\nexport const spectreGridGaps = ['sm', 'md', 'lg'] as const\n\nexport type SpectreGridGap = (typeof spectreGridGaps)[number]\n\nexport function isGridGap(value: unknown): value is SpectreGridGap {\n return (spectreGridGaps as readonly string[]).includes(value as string)\n}\n\nexport const spectreGridAligns = [\n 'start',\n 'center',\n 'end',\n 'baseline',\n 'stretch'\n] as const\n\nexport type SpectreGridAlign = (typeof spectreGridAligns)[number]\n\nexport function isGridAlign(value: unknown): value is SpectreGridAlign {\n return (spectreGridAligns as readonly string[]).includes(value as string)\n}\n\nexport const spectreGridSpans = [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 'full'\n] as const\n\nexport type SpectreGridSpan = (typeof spectreGridSpans)[number]\n\nexport function isGridSpan(value: unknown): value is SpectreGridSpan {\n return (spectreGridSpans as readonly (number | string)[]).includes(\n value as number | string\n )\n}\n\nexport interface SpectreGridSpanOptions {\n base?: SpectreGridSpan\n md?: SpectreGridSpan\n lg?: SpectreGridSpan\n}\n\nexport function isGridSpanOptions(\n value: unknown\n): value is SpectreGridSpanOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridSpan(candidate.base)) &&\n (candidate.md === undefined || isGridSpan(candidate.md)) &&\n (candidate.lg === undefined || isGridSpan(candidate.lg))\n )\n}\n\nexport const spectreGridOffsets = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\n] as const\n\nexport type SpectreGridOffset = (typeof spectreGridOffsets)[number]\n\nexport function isGridOffset(value: unknown): value is SpectreGridOffset {\n return (spectreGridOffsets as readonly number[]).includes(value as number)\n}\n\nexport interface SpectreGridOffsetOptions {\n base?: SpectreGridOffset\n md?: SpectreGridOffset\n lg?: SpectreGridOffset\n}\n\nexport function isGridOffsetOptions(\n value: unknown\n): value is SpectreGridOffsetOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridOffset(candidate.base)) &&\n (candidate.md === undefined || isGridOffset(candidate.md)) &&\n (candidate.lg === undefined || isGridOffset(candidate.lg))\n )\n}\n\nexport const spectreGridOrders = [\n 'first',\n 'last',\n 'none',\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12\n] as const\n\nexport type SpectreGridOrder = (typeof spectreGridOrders)[number]\n\nexport function isGridOrder(value: unknown): value is SpectreGridOrder {\n return (spectreGridOrders as readonly (number | string)[]).includes(\n value as number | string\n )\n}\n\nexport interface SpectreGridOrderOptions {\n base?: SpectreGridOrder\n md?: SpectreGridOrder\n lg?: SpectreGridOrder\n}\n\nexport function isGridOrderOptions(\n value: unknown\n): value is SpectreGridOrderOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridOrder(candidate.base)) &&\n (candidate.md === undefined || isGridOrder(candidate.md)) &&\n (candidate.lg === undefined || isGridOrder(candidate.lg))\n )\n}\n\nexport const spectreGridLeadingWeights = [1.5, 1.6, 2, 2.5, 3] as const\n\nexport type SpectreGridLeadingWeight =\n (typeof spectreGridLeadingWeights)[number]\n\nexport function isGridLeadingWeight(\n value: unknown\n): value is SpectreGridLeadingWeight {\n return (spectreGridLeadingWeights as readonly number[]).includes(\n value as number\n )\n}\n\nexport interface SpectreGridLeadingWeightOptions {\n base?: SpectreGridLeadingWeight\n md?: SpectreGridLeadingWeight\n lg?: SpectreGridLeadingWeight\n}\n\nexport function isGridLeadingWeightOptions(\n value: unknown\n): value is SpectreGridLeadingWeightOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridLeadingWeight(candidate.base)) &&\n (candidate.md === undefined || isGridLeadingWeight(candidate.md)) &&\n (candidate.lg === undefined || isGridLeadingWeight(candidate.lg))\n )\n}\n\nexport interface SpectreGridLeadingTracksOptions {\n weight: SpectreGridLeadingWeight | SpectreGridLeadingWeightOptions\n}\n\nexport function isGridLeadingTracksOptions(\n value: unknown\n): value is SpectreGridLeadingTracksOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n isGridLeadingWeight(candidate.weight) ||\n isGridLeadingWeightOptions(candidate.weight)\n )\n}\n\nexport const spectreGridFixedTrackCounts = [1, 2, 3, 4] as const\n\nexport type SpectreGridFixedTrackCount =\n (typeof spectreGridFixedTrackCounts)[number]\n\nexport function isGridFixedTrackCount(\n value: unknown\n): value is SpectreGridFixedTrackCount {\n return (spectreGridFixedTrackCounts as readonly number[]).includes(\n value as number\n )\n}\n\nexport interface SpectreGridFixedTracksOptions {\n count: SpectreGridFixedTrackCount\n}\n\nexport function isGridFixedTracksOptions(\n value: unknown\n): value is SpectreGridFixedTracksOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return isGridFixedTrackCount(candidate.count)\n}\n\nexport const spectreGridTemplates = [\n 'edge-fluid-edge',\n 'label-fluid-fluid'\n] as const\n\nexport type SpectreGridTemplate = (typeof spectreGridTemplates)[number]\n\nexport function isGridTemplate(value: unknown): value is SpectreGridTemplate {\n return (spectreGridTemplates as readonly string[]).includes(value as string)\n}\n\nexport interface SpectreGridExplicitTemplateOptions {\n template: SpectreGridTemplate\n weight?: SpectreGridLeadingWeight\n}\n\nexport function isGridExplicitTemplateOptions(\n value: unknown\n): value is SpectreGridExplicitTemplateOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n isGridTemplate(candidate.template) &&\n (candidate.weight === undefined || isGridLeadingWeight(candidate.weight))\n )\n}\n\nexport const spectreStackDirections = ['vertical', 'horizontal'] as const\n\nexport type SpectreStackDirection = (typeof spectreStackDirections)[number]\n\nexport function isStackDirection(\n value: unknown\n): value is SpectreStackDirection {\n return (spectreStackDirections as readonly string[]).includes(value as string)\n}\n\nexport const spectreStackBases = ['sidebar'] as const\n\nexport type SpectreStackBasis = (typeof spectreStackBases)[number]\n\nexport function isStackBasis(value: unknown): value is SpectreStackBasis {\n return (spectreStackBases as readonly string[]).includes(value as string)\n}\n\nexport const spectreNavAligns = ['start', 'center', 'end'] as const\n\nexport type SpectreNavAlign = (typeof spectreNavAligns)[number]\n\nexport function isNavAlign(value: unknown): value is SpectreNavAlign {\n return (spectreNavAligns as readonly string[]).includes(value as string)\n}\n\nexport const spectreStackAligns = ['center', 'stretch'] as const\n\nexport type SpectreStackAlign = (typeof spectreStackAligns)[number]\n\nexport function isStackAlign(value: unknown): value is SpectreStackAlign {\n return (spectreStackAligns as readonly string[]).includes(value as string)\n}\n\nexport const spectreStackGaps = ['sm', 'md', 'lg'] as const\n\nexport type SpectreStackGap = (typeof spectreStackGaps)[number]\n\nexport function isStackGap(value: unknown): value is SpectreStackGap {\n return (spectreStackGaps as readonly string[]).includes(value as string)\n}\n\nexport const spectreDropdownPlacements = [\n 'bottom-start',\n 'bottom-end',\n 'top-start',\n 'top-end'\n] as const\n\nexport type SpectreDropdownPlacement =\n (typeof spectreDropdownPlacements)[number]\n\nexport function isDropdownPlacement(\n value: unknown\n): value is SpectreDropdownPlacement {\n return (spectreDropdownPlacements as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreToastVariants = [\n 'info',\n 'success',\n 'warning',\n 'danger'\n] as const\n\nexport type SpectreToastVariant = (typeof spectreToastVariants)[number]\n\nexport function isToastVariant(value: unknown): value is SpectreToastVariant {\n return (spectreToastVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreSidebarLinkLevels = ['parent', 'child'] as const\n\nexport type SpectreSidebarLinkLevel = (typeof spectreSidebarLinkLevels)[number]\n\nexport function isSidebarLinkLevel(\n value: unknown\n): value is SpectreSidebarLinkLevel {\n return (spectreSidebarLinkLevels as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreTooltipPlacements = [\n 'top',\n 'bottom',\n 'left',\n 'right'\n] as const\n\nexport type SpectreTooltipPlacement = (typeof spectreTooltipPlacements)[number]\n\nexport function isTooltipPlacement(\n value: unknown\n): value is SpectreTooltipPlacement {\n return (spectreTooltipPlacements as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreTextSizes = [\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl'\n] as const\n\nexport type SpectreTextSize = (typeof spectreTextSizes)[number]\n\nexport function isTextSize(value: unknown): value is SpectreTextSize {\n return (spectreTextSizes as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextVariants = [\n 'default',\n 'muted',\n 'subtle',\n 'meta',\n 'brand',\n 'onInverse',\n 'onInverseMuted'\n] as const\n\nexport type SpectreTextVariant = (typeof spectreTextVariants)[number]\n\nexport function isTextVariant(value: unknown): value is SpectreTextVariant {\n return (spectreTextVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextFamilies = ['sans', 'serif', 'mono'] as const\n\nexport type SpectreTextFamily = (typeof spectreTextFamilies)[number]\n\nexport function isTextFamily(value: unknown): value is SpectreTextFamily {\n return (spectreTextFamilies as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextLevels = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'p',\n 'span'\n] as const\n\nexport type SpectreTextLevel = (typeof spectreTextLevels)[number]\n\nexport function isTextLevel(value: unknown): value is SpectreTextLevel {\n return (spectreTextLevels as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextTransforms = [\n 'none',\n 'uppercase',\n 'lowercase',\n 'capitalize'\n] as const\n\nexport type SpectreTextTransform = (typeof spectreTextTransforms)[number]\n\nexport function isTextTransform(value: unknown): value is SpectreTextTransform {\n return (spectreTextTransforms as readonly string[]).includes(value as string)\n}\n\nexport function normalizeInt(\n value: unknown,\n fallback: number | undefined,\n min = 0\n): number | undefined {\n if (\n value == null ||\n typeof value !== 'number' ||\n !Number.isInteger(value) ||\n value < min\n ) {\n return fallback\n }\n return value\n}\n\nconst spectreUtilityClassPattern =\n /^sp-[a-z0-9]+(?:-[a-z0-9]+)*(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?(?:--[a-z0-9]+(?:-[a-z0-9]+)*)?$/\n\nexport function sanitizeUtilityClasses(\n value: string | null | undefined\n): string {\n if (!value) {\n return ''\n }\n return value\n .split(/\\s+/)\n .filter((token) => spectreUtilityClassPattern.test(token))\n .join(' ')\n}\n","import { LitElement, type PropertyDeclarations } from 'lit'\n\nexport class SpectreBaseElement extends LitElement {\n static properties: PropertyDeclarations = {}\n\n private _ariaLabel: string | null = null\n private _ariaLabelledBy: string | null = null\n private _ariaDescribedBy: string | null = null\n private _autocapitalize = ''\n private _autofocus = false\n private _spellcheck: boolean | null = null\n private _title = ''\n private _id = ''\n\n get ariaLabel(): string | null {\n return this._ariaLabel\n }\n\n set ariaLabel(value: string | null) {\n if (this._ariaLabel === value) {\n return\n }\n this._ariaLabel = value\n this._removeHostAttribute('aria-label')\n this.requestUpdate()\n }\n\n get ariaLabelledBy(): string | null {\n return this._ariaLabelledBy\n }\n\n set ariaLabelledBy(value: string | null) {\n if (this._ariaLabelledBy === value) {\n return\n }\n this._ariaLabelledBy = value\n this._removeHostAttribute('aria-labelledby')\n this.requestUpdate()\n }\n\n get ariaDescribedBy(): string | null {\n return this._ariaDescribedBy\n }\n\n set ariaDescribedBy(value: string | null) {\n if (this._ariaDescribedBy === value) {\n return\n }\n this._ariaDescribedBy = value\n this._removeHostAttribute('aria-describedby')\n this.requestUpdate()\n }\n\n override get autocapitalize(): string {\n return this._autocapitalize\n }\n\n override set autocapitalize(value: string | undefined | null) {\n const normalizedValue = value ?? ''\n if (this._autocapitalize === normalizedValue) {\n return\n }\n this._autocapitalize = normalizedValue\n this._removeHostAttribute('autocapitalize')\n this.requestUpdate()\n }\n\n override get spellcheck(): boolean {\n return this._spellcheck ?? super.spellcheck\n }\n\n override set spellcheck(value: boolean | undefined | null) {\n if (this._spellcheck === value) {\n return\n }\n this._spellcheck = value ?? null\n this._removeHostAttribute('spellcheck')\n this.requestUpdate()\n }\n\n override get title(): string {\n return this._title\n }\n\n override set title(value: string | undefined | null) {\n const normalizedValue = value ?? ''\n if (this._title === normalizedValue) {\n return\n }\n this._title = normalizedValue\n this._removeHostAttribute('title')\n this.requestUpdate()\n }\n\n override get id(): string {\n return this._id\n }\n\n override set id(value: string | undefined | null) {\n const normalizedValue = value ?? ''\n if (this._id === normalizedValue) {\n return\n }\n this._id = normalizedValue\n this._removeHostAttribute('id')\n this.requestUpdate()\n }\n\n override get autofocus(): boolean {\n return this._autofocus\n }\n\n override set autofocus(value: boolean | undefined | null) {\n const normalizedValue = !!value\n if (this._autofocus === normalizedValue) {\n return\n }\n this._autofocus = normalizedValue\n this._removeHostAttribute('autofocus')\n this.requestUpdate()\n }\n\n // Spectre components intentionally render in light DOM so the global\n // `@phcdevworks/spectre-ui` styling contract can apply directly.\n createRenderRoot(): this {\n return this\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n\n const proxiedAttributes = [\n 'id',\n 'title',\n 'autocapitalize',\n 'autofocus',\n 'spellcheck',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby'\n ]\n\n proxiedAttributes.forEach((attr) => {\n const value = super.getAttribute(attr)\n if (value !== null) {\n this.setAttribute(attr, value)\n }\n })\n }\n\n override getAttribute(qualifiedName: string): string | null {\n switch (qualifiedName) {\n case 'id':\n return this.id || null\n case 'title':\n return this.title || null\n case 'autocapitalize':\n return this.autocapitalize || null\n case 'autofocus':\n return this.autofocus ? '' : null\n case 'spellcheck':\n return this._spellcheck !== null ? String(this._spellcheck) : null\n case 'aria-label':\n return this.ariaLabel\n case 'aria-labelledby':\n return this.ariaLabelledBy\n case 'aria-describedby':\n return this.ariaDescribedBy\n default:\n return super.getAttribute(qualifiedName)\n }\n }\n\n override hasAttribute(qualifiedName: string): boolean {\n switch (qualifiedName) {\n case 'id':\n return this.id !== ''\n case 'title':\n return this.title !== ''\n case 'autocapitalize':\n return this.autocapitalize !== ''\n case 'autofocus':\n return this.autofocus\n case 'spellcheck':\n return this._spellcheck !== null\n case 'aria-label':\n return this.ariaLabel !== null\n case 'aria-labelledby':\n return this.ariaLabelledBy !== null\n case 'aria-describedby':\n return this.ariaDescribedBy !== null\n default:\n return super.hasAttribute(qualifiedName)\n }\n }\n\n override setAttribute(qualifiedName: string, value: string): void {\n switch (qualifiedName) {\n case 'id':\n this.id = value\n break\n case 'title':\n this.title = value\n break\n case 'autocapitalize':\n this.autocapitalize = value\n break\n case 'autofocus':\n this.autofocus = true\n break\n case 'spellcheck':\n this.spellcheck = value !== 'false'\n break\n case 'aria-label':\n this.ariaLabel = value\n break\n case 'aria-labelledby':\n this.ariaLabelledBy = value\n break\n case 'aria-describedby':\n this.ariaDescribedBy = value\n break\n default:\n super.setAttribute(qualifiedName, value)\n }\n }\n\n override removeAttribute(qualifiedName: string): void {\n switch (qualifiedName) {\n case 'id':\n this.id = ''\n break\n case 'title':\n this.title = ''\n break\n case 'autocapitalize':\n this.autocapitalize = ''\n break\n case 'autofocus':\n this.autofocus = false\n break\n case 'spellcheck':\n this.spellcheck = null\n break\n case 'aria-label':\n this.ariaLabel = null\n break\n case 'aria-labelledby':\n this.ariaLabelledBy = null\n break\n case 'aria-describedby':\n this.ariaDescribedBy = null\n break\n default:\n super.removeAttribute(qualifiedName)\n }\n }\n\n private _removeHostAttribute(name: string): void {\n const host = this as unknown as HTMLElement\n if (HTMLElement.prototype.hasAttribute.call(host, name)) {\n // Use the native removeAttribute to avoid our own overridden version\n // which would reset the internal state.\n HTMLElement.prototype.removeAttribute.call(host, name)\n }\n }\n\n protected get forwardedAriaLabel(): string | undefined {\n const value = this.ariaLabel?.trim()\n return value ? value : undefined\n }\n\n protected get forwardedAriaLabelledBy(): string | undefined {\n const value = this.ariaLabelledBy?.trim()\n return value ? value : undefined\n }\n\n protected get forwardedAriaDescribedBy(): string | undefined {\n const value = this.ariaDescribedBy?.trim()\n return value ? value : undefined\n }\n\n // Subclasses that expose `disabled`/`loading` properties get this disabled\n // calculation for free instead of redeclaring it per component.\n protected get isDisabled(): boolean {\n const self = this as unknown as { disabled?: boolean; loading?: boolean }\n return (self.disabled ?? false) || (self.loading ?? false)\n }\n\n // Subclasses get this for free instead of redeclaring it per component.\n protected get hasForwardedLabel(): boolean {\n return Boolean(this.forwardedAriaLabel || this.forwardedAriaLabelledBy)\n }\n}\n","export function hasMeaningfulContent(nodes: readonly Node[]): boolean {\n return nodes.some((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n return true;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent?.trim().length ?? 0) > 0;\n }\n\n return false;\n });\n}\n","import { SpectreBaseElement } from './base';\nimport { hasMeaningfulContent } from './dom';\n\nexport abstract class SpectreProjectableElement extends SpectreBaseElement {\n protected projectedContent: Node[] = [];\n private contentObserver?: MutationObserver | undefined;\n\n // Return the native container whose existing children are also treated as\n // projected content sources (e.g. the rendered <button>, <select>, <label>).\n protected abstract getContentContainer(): Element | null;\n\n // Return true if the node was rendered by this component and should not be\n // treated as external projected content.\n protected abstract isInternalNode(node: Node): boolean;\n\n protected get hasProjectedContent(): boolean {\n return hasMeaningfulContent(this.projectedContent);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.syncProjectedContent();\n this.startContentObserver();\n }\n\n override disconnectedCallback(): void {\n this.stopContentObserver();\n super.disconnectedCallback();\n }\n\n protected override update(changedProperties: Map<PropertyKey, unknown>): void {\n this.stopContentObserver();\n super.update(changedProperties);\n this.startContentObserver();\n }\n\n protected syncProjectedContent(): boolean {\n const nextProjectedContent: Node[] = [];\n const sourceNodes = [\n ...this.childNodes,\n ...(this.getContentContainer()?.childNodes ?? []),\n ];\n\n sourceNodes.forEach((node) => {\n if (!this.isInternalNode(node) && !nextProjectedContent.includes(node)) {\n nextProjectedContent.push(node);\n }\n });\n\n const hasChanged =\n nextProjectedContent.length !== this.projectedContent.length ||\n nextProjectedContent.some((node, index) => node !== this.projectedContent[index]);\n\n if (hasChanged) {\n this.projectedContent = nextProjectedContent;\n }\n\n return hasChanged;\n }\n\n private startContentObserver(): void {\n if (this.contentObserver) {\n return;\n }\n\n this.contentObserver = new MutationObserver((mutations) => {\n const isInternalMovement = mutations.every((mutation) =>\n [...mutation.removedNodes].every(\n (node) => this.isInternalNode(node) || this.contains(node),\n ) &&\n [...mutation.addedNodes].every((node) => this.isInternalNode(node)),\n );\n\n if (isInternalMovement) {\n return;\n }\n\n if (this.syncProjectedContent()) {\n this.requestUpdate();\n }\n });\n\n this.contentObserver.observe(this, { childList: true });\n }\n\n private stopContentObserver(): void {\n this.contentObserver?.disconnect();\n this.contentObserver = undefined;\n }\n}\n","import { html, nothing } from 'lit'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { SpectreProjectableElement } from '../../utils/projectable'\nimport {\n isAlertVariant,\n isInputSize,\n type SpectreAlertVariant,\n type SpectreInputSize\n} from '../../utils/form'\n\nimport {\n getAlertClasses,\n type AlertVariant,\n type AlertSize\n} from '@phcdevworks/spectre-ui'\n\nexport interface SpectreAlertProps {\n ariaLabel?: string | null\n ariaLabelledBy?: string | null\n ariaDescribedBy?: string | null\n dismissed?: boolean | undefined\n disabled?: boolean | undefined\n fullWidth?: boolean | undefined\n id?: string | null | undefined\n loading?: boolean | undefined\n size?: SpectreInputSize | undefined\n title?: string | null | undefined\n variant?: SpectreAlertVariant | undefined\n}\n\nexport class SpectreAlertElement\n extends SpectreProjectableElement\n implements SpectreAlertProps\n{\n static properties = {\n dismissed: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n fullWidth: { attribute: 'full-width', type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n size: { type: String, reflect: true },\n variant: { type: String, reflect: true }\n }\n\n dismissed: boolean | undefined = false\n disabled: boolean | undefined = false\n fullWidth: boolean | undefined = false\n loading: boolean | undefined = false\n size: SpectreInputSize | undefined = 'md'\n variant: SpectreAlertVariant | undefined = 'info'\n\n override get id(): string {\n return super.id\n }\n\n override set id(value: string | null | undefined) {\n super.id = value\n }\n\n override get title(): string {\n return super.title\n }\n\n override set title(value: string | null | undefined) {\n super.title = value\n }\n\n protected override getContentContainer(): Element | null {\n return this.querySelector('[data-sp-alert-native]')\n }\n\n protected override isInternalNode(node: Node): boolean {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return false\n }\n const el = node as Element\n return el.hasAttribute('data-sp-alert-native')\n }\n\n protected override willUpdate(\n changedProperties: Map<PropertyKey, unknown>\n ): void {\n if (changedProperties.has('dismissed') && this.dismissed == null) {\n this.dismissed = false\n }\n if (changedProperties.has('disabled') && this.disabled == null) {\n this.disabled = false\n }\n if (changedProperties.has('fullWidth') && this.fullWidth == null) {\n this.fullWidth = false\n }\n if (changedProperties.has('loading') && this.loading == null) {\n this.loading = false\n }\n if (\n changedProperties.has('variant') &&\n (this.variant == null || !isAlertVariant(this.variant))\n ) {\n this.variant = 'info'\n }\n if (\n changedProperties.has('size') &&\n (this.size == null || !isInputSize(this.size))\n ) {\n this.size = 'md'\n }\n }\n\n private get alertClasses(): string {\n return getAlertClasses({\n disabled: this.isDisabled,\n dismissed: this.dismissed ?? false,\n fullWidth: this.fullWidth ?? false,\n loading: this.loading ?? false,\n size: this.size as AlertSize,\n variant: this.variant as AlertVariant\n })\n }\n\n override render() {\n return html`<div\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n aria-describedby=\"${ifDefined(this.forwardedAriaDescribedBy)}\"\n aria-label=\"${ifDefined(this.forwardedAriaLabel)}\"\n aria-labelledby=\"${ifDefined(this.forwardedAriaLabelledBy)}\"\n class=\"${this.alertClasses}\"\n data-sp-alert-native\n id=\"${ifDefined(this.id || undefined)}\"\n role=\"alert\"\n title=\"${ifDefined(this.title || undefined)}\"\n >\n ${this.hasProjectedContent ? this.projectedContent : nothing}\n </div>`\n }\n}\n\nexport function defineSpectreAlert(\n tagName = 'sp-alert'\n): typeof SpectreAlertElement {\n const existingElement = customElements.get(tagName)\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreAlertElement\n }\n\n customElements.define(tagName, SpectreAlertElement)\n return SpectreAlertElement\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/form.ts","../src/utils/base.ts","../src/utils/icons.ts","../src/utils/dom.ts","../src/utils/projection.ts","../src/utils/states.ts","../src/components/alert/sp-alert.ts"],"names":["LitElement","svg","html","getAlertClasses","ifDefined","getAlertIconClasses","nothing","getAlertDismissClasses"],"mappings":";;;;;;;AAMO,IAAM,iBAAA,GAAoB,CA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,CAAA,GAEvBD,WACN;AAAA,UAAA,CAAA;AAAA,EAEJ;AACF;AAhJa,mBAAA,CAIJ,UAAA,GAAa;AAAA,EAClB,WAAA,EAAa,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EAC5C,GAAG,0BAAA;AAAA,EACH,YAAA,EAAc,EAAE,SAAA,EAAW,eAAA,EAAiB,MAAM,MAAA,EAAO;AAAA,EACzD,SAAA,EAAW,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EAC1C,WAAA,EAAa,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EAC5C,QAAA,EAAU,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACzC,WAAW,EAAE,SAAA,EAAW,cAAc,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACnE,OAAA,EAAS,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EACxC,IAAA,EAAM,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA,EAAK;AAAA,EACpC,OAAA,EAAS,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAS,IAAA;AACpC,CAAA;AAmIK,SAAS,kBAAA,CACd,UAAU,UAAA,EACkB;AAC5B,EAAA,MAAM,eAAA,GAAkB,cAAA,CAAe,GAAA,CAAI,OAAO,CAAA;AAElD,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA,OAAO,eAAA;AAAA,EACT;AAEA,EAAA,cAAA,CAAe,MAAA,CAAO,SAAS,mBAAmB,CAAA;AAClD,EAAA,OAAO,mBAAA;AACT","file":"alert.cjs","sourcesContent":["import {\n type ButtonSize,\n type ButtonVariant,\n type InputSize\n} from '@phcdevworks/spectre-ui'\n\nexport const spectreInputSizes = ['sm', 'md', 'lg'] as const\nexport type SpectreInputSize = (typeof spectreInputSizes)[number]\n\nexport function isInputSize(value: unknown): value is InputSize | ButtonSize {\n return (spectreInputSizes as readonly string[]).includes(value as string)\n}\n\nexport const spectreButtonVariants = [\n 'primary',\n 'secondary',\n 'ghost',\n 'danger',\n 'success',\n 'cta',\n 'accent',\n 'inverse',\n 'warning',\n 'link',\n 'light',\n 'dark'\n] as const\n\nexport type SpectreButtonVariant = (typeof spectreButtonVariants)[number]\n\nexport function isButtonVariant(value: unknown): value is ButtonVariant {\n return (spectreButtonVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreButtonTypes = ['button', 'submit', 'reset'] as const\n\nexport type SpectreButtonType = (typeof spectreButtonTypes)[number]\n\nexport function isButtonType(value: unknown): value is SpectreButtonType {\n return (spectreButtonTypes as readonly string[]).includes(value as string)\n}\n\nexport const spectreInputTypes = [\n 'text',\n 'email',\n 'password',\n 'search',\n 'tel',\n 'url',\n 'number',\n 'date',\n 'datetime-local',\n 'month',\n 'time',\n 'week'\n] as const\n\nexport type SpectreInputType = (typeof spectreInputTypes)[number]\n\nexport function isInputType(value: unknown): value is SpectreInputType {\n return (spectreInputTypes as readonly string[]).includes(value as string)\n}\n\nexport const spectreBadgeVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'neutral',\n 'info',\n 'ghost',\n 'outline',\n 'accent',\n 'cta',\n 'inverse',\n 'brand'\n] as const\n\nexport type SpectreBadgeVariant = (typeof spectreBadgeVariants)[number]\n\nexport function isBadgeVariant(value: unknown): value is SpectreBadgeVariant {\n return (spectreBadgeVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreAlertVariants = [\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'neutral',\n 'brand'\n] as const\n\nexport type SpectreAlertVariant = (typeof spectreAlertVariants)[number]\n\nexport function isAlertVariant(value: unknown): value is SpectreAlertVariant {\n return (spectreAlertVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreCardVariants = [\n 'elevated',\n 'flat',\n 'outline',\n 'ghost'\n] as const\n\nexport type SpectreCardVariant = (typeof spectreCardVariants)[number]\n\nexport function isCardVariant(value: unknown): value is SpectreCardVariant {\n return (spectreCardVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreCardPaddingSizes = ['sm', 'md', 'lg'] as const\n\nexport type SpectreCardPaddingSize = (typeof spectreCardPaddingSizes)[number]\n\nexport function isCardPaddingSize(\n value: unknown\n): value is SpectreCardPaddingSize {\n return (spectreCardPaddingSizes as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreAccentEdges = ['top', 'right', 'bottom', 'left'] as const\n\nexport type SpectreAccentEdge = (typeof spectreAccentEdges)[number]\n\nexport function isAccentEdge(value: unknown): value is SpectreAccentEdge {\n return (spectreAccentEdges as readonly string[]).includes(value as string)\n}\n\nexport const spectreAccentColors = [\n 'neutral',\n 'brand',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'cta'\n] as const\n\nexport type SpectreAccentColor = (typeof spectreAccentColors)[number]\n\nexport function isAccentColor(value: unknown): value is SpectreAccentColor {\n return (spectreAccentColors as readonly string[]).includes(value as string)\n}\n\nexport const spectreIconBoxVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n 'ghost',\n 'accent',\n 'cta',\n 'outline'\n] as const\n\nexport type SpectreIconBoxVariant = (typeof spectreIconBoxVariants)[number]\n\nexport function isIconBoxVariant(\n value: unknown\n): value is SpectreIconBoxVariant {\n return (spectreIconBoxVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreTestimonialVariants = [\n 'elevated',\n 'flat',\n 'outline',\n 'ghost'\n] as const\n\nexport type SpectreTestimonialVariant =\n (typeof spectreTestimonialVariants)[number]\n\nexport function isTestimonialVariant(\n value: unknown\n): value is SpectreTestimonialVariant {\n return (spectreTestimonialVariants as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreSpinnerVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n 'accent',\n 'cta',\n 'inverse'\n] as const\n\nexport type SpectreSpinnerVariant = (typeof spectreSpinnerVariants)[number]\n\nexport function isSpinnerVariant(\n value: unknown\n): value is SpectreSpinnerVariant {\n return (spectreSpinnerVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreTagVariants = [\n 'default',\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n 'accent',\n 'cta',\n 'outline',\n 'ghost'\n] as const\n\nexport type SpectreTagVariant = (typeof spectreTagVariants)[number]\n\nexport function isTagVariant(value: unknown): value is SpectreTagVariant {\n return (spectreTagVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreAvatarSizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const\n\nexport type SpectreAvatarSize = (typeof spectreAvatarSizes)[number]\n\nexport function isAvatarSize(value: unknown): value is SpectreAvatarSize {\n return (spectreAvatarSizes as readonly string[]).includes(value as string)\n}\n\nexport const spectreAvatarShapes = ['circle', 'square'] as const\n\nexport type SpectreAvatarShape = (typeof spectreAvatarShapes)[number]\n\nexport function isAvatarShape(value: unknown): value is SpectreAvatarShape {\n return (spectreAvatarShapes as readonly string[]).includes(value as string)\n}\n\nexport const spectreContainerMaxWidths = ['none', 'prose', 'wide'] as const\n\nexport type SpectreContainerMaxWidth =\n (typeof spectreContainerMaxWidths)[number]\n\nexport function isContainerMaxWidth(\n value: unknown\n): value is SpectreContainerMaxWidth {\n return (spectreContainerMaxWidths as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreGridColumns = [1, 2, 3, 4, 6, 12] as const\n\nexport type SpectreGridColumns = (typeof spectreGridColumns)[number]\n\nexport function isGridColumns(value: unknown): value is SpectreGridColumns {\n return (spectreGridColumns as readonly number[]).includes(value as number)\n}\n\nexport const spectreGridGaps = ['sm', 'md', 'lg'] as const\n\nexport type SpectreGridGap = (typeof spectreGridGaps)[number]\n\nexport function isGridGap(value: unknown): value is SpectreGridGap {\n return (spectreGridGaps as readonly string[]).includes(value as string)\n}\n\nexport const spectreGridAligns = [\n 'start',\n 'center',\n 'end',\n 'baseline',\n 'stretch'\n] as const\n\nexport type SpectreGridAlign = (typeof spectreGridAligns)[number]\n\nexport function isGridAlign(value: unknown): value is SpectreGridAlign {\n return (spectreGridAligns as readonly string[]).includes(value as string)\n}\n\nexport const spectreGridSpans = [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 'full'\n] as const\n\nexport type SpectreGridSpan = (typeof spectreGridSpans)[number]\n\nexport function isGridSpan(value: unknown): value is SpectreGridSpan {\n return (spectreGridSpans as readonly (number | string)[]).includes(\n value as number | string\n )\n}\n\nexport interface SpectreGridSpanOptions {\n base?: SpectreGridSpan\n md?: SpectreGridSpan\n lg?: SpectreGridSpan\n}\n\nexport function isGridSpanOptions(\n value: unknown\n): value is SpectreGridSpanOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridSpan(candidate.base)) &&\n (candidate.md === undefined || isGridSpan(candidate.md)) &&\n (candidate.lg === undefined || isGridSpan(candidate.lg))\n )\n}\n\nexport const spectreGridOffsets = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\n] as const\n\nexport type SpectreGridOffset = (typeof spectreGridOffsets)[number]\n\nexport function isGridOffset(value: unknown): value is SpectreGridOffset {\n return (spectreGridOffsets as readonly number[]).includes(value as number)\n}\n\nexport interface SpectreGridOffsetOptions {\n base?: SpectreGridOffset\n md?: SpectreGridOffset\n lg?: SpectreGridOffset\n}\n\nexport function isGridOffsetOptions(\n value: unknown\n): value is SpectreGridOffsetOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridOffset(candidate.base)) &&\n (candidate.md === undefined || isGridOffset(candidate.md)) &&\n (candidate.lg === undefined || isGridOffset(candidate.lg))\n )\n}\n\nexport const spectreGridOrders = [\n 'first',\n 'last',\n 'none',\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12\n] as const\n\nexport type SpectreGridOrder = (typeof spectreGridOrders)[number]\n\nexport function isGridOrder(value: unknown): value is SpectreGridOrder {\n return (spectreGridOrders as readonly (number | string)[]).includes(\n value as number | string\n )\n}\n\nexport interface SpectreGridOrderOptions {\n base?: SpectreGridOrder\n md?: SpectreGridOrder\n lg?: SpectreGridOrder\n}\n\nexport function isGridOrderOptions(\n value: unknown\n): value is SpectreGridOrderOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridOrder(candidate.base)) &&\n (candidate.md === undefined || isGridOrder(candidate.md)) &&\n (candidate.lg === undefined || isGridOrder(candidate.lg))\n )\n}\n\nexport const spectreGridLeadingWeights = [1.5, 1.6, 2, 2.5, 3] as const\n\nexport type SpectreGridLeadingWeight =\n (typeof spectreGridLeadingWeights)[number]\n\nexport function isGridLeadingWeight(\n value: unknown\n): value is SpectreGridLeadingWeight {\n return (spectreGridLeadingWeights as readonly number[]).includes(\n value as number\n )\n}\n\nexport interface SpectreGridLeadingWeightOptions {\n base?: SpectreGridLeadingWeight\n md?: SpectreGridLeadingWeight\n lg?: SpectreGridLeadingWeight\n}\n\nexport function isGridLeadingWeightOptions(\n value: unknown\n): value is SpectreGridLeadingWeightOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridLeadingWeight(candidate.base)) &&\n (candidate.md === undefined || isGridLeadingWeight(candidate.md)) &&\n (candidate.lg === undefined || isGridLeadingWeight(candidate.lg))\n )\n}\n\nexport interface SpectreGridLeadingTracksOptions {\n weight: SpectreGridLeadingWeight | SpectreGridLeadingWeightOptions\n}\n\nexport function isGridLeadingTracksOptions(\n value: unknown\n): value is SpectreGridLeadingTracksOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n isGridLeadingWeight(candidate.weight) ||\n isGridLeadingWeightOptions(candidate.weight)\n )\n}\n\nexport const spectreGridFixedTrackCounts = [1, 2, 3, 4] as const\n\nexport type SpectreGridFixedTrackCount =\n (typeof spectreGridFixedTrackCounts)[number]\n\nexport function isGridFixedTrackCount(\n value: unknown\n): value is SpectreGridFixedTrackCount {\n return (spectreGridFixedTrackCounts as readonly number[]).includes(\n value as number\n )\n}\n\nexport interface SpectreGridFixedTracksOptions {\n count: SpectreGridFixedTrackCount\n}\n\nexport function isGridFixedTracksOptions(\n value: unknown\n): value is SpectreGridFixedTracksOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return isGridFixedTrackCount(candidate.count)\n}\n\nexport const spectreGridTemplates = [\n 'edge-fluid-edge',\n 'label-fluid-fluid'\n] as const\n\nexport type SpectreGridTemplate = (typeof spectreGridTemplates)[number]\n\nexport function isGridTemplate(value: unknown): value is SpectreGridTemplate {\n return (spectreGridTemplates as readonly string[]).includes(value as string)\n}\n\nexport interface SpectreGridExplicitTemplateOptions {\n template: SpectreGridTemplate\n weight?: SpectreGridLeadingWeight\n}\n\nexport function isGridExplicitTemplateOptions(\n value: unknown\n): value is SpectreGridExplicitTemplateOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n isGridTemplate(candidate.template) &&\n (candidate.weight === undefined || isGridLeadingWeight(candidate.weight))\n )\n}\n\nexport const spectreStackDirections = ['vertical', 'horizontal'] as const\n\nexport type SpectreStackDirection = (typeof spectreStackDirections)[number]\n\nexport function isStackDirection(\n value: unknown\n): value is SpectreStackDirection {\n return (spectreStackDirections as readonly string[]).includes(value as string)\n}\n\nexport const spectreStackBases = ['none', 'sidebar'] as const\n\nexport type SpectreStackBasis = (typeof spectreStackBases)[number]\n\nexport function isStackBasis(value: unknown): value is SpectreStackBasis {\n return (spectreStackBases as readonly string[]).includes(value as string)\n}\n\nexport const spectreNavAligns = ['start', 'center', 'end'] as const\n\nexport type SpectreNavAlign = (typeof spectreNavAligns)[number]\n\nexport function isNavAlign(value: unknown): value is SpectreNavAlign {\n return (spectreNavAligns as readonly string[]).includes(value as string)\n}\n\nexport const spectreStackAligns = ['center', 'stretch'] as const\n\nexport type SpectreStackAlign = (typeof spectreStackAligns)[number]\n\nexport function isStackAlign(value: unknown): value is SpectreStackAlign {\n return (spectreStackAligns as readonly string[]).includes(value as string)\n}\n\nexport const spectreStackGaps = ['sm', 'md', 'lg'] as const\n\nexport type SpectreStackGap = (typeof spectreStackGaps)[number]\n\nexport function isStackGap(value: unknown): value is SpectreStackGap {\n return (spectreStackGaps as readonly string[]).includes(value as string)\n}\n\nexport const spectreDropdownPlacements = [\n 'bottom-start',\n 'bottom-end',\n 'top-start',\n 'top-end'\n] as const\n\nexport type SpectreDropdownPlacement =\n (typeof spectreDropdownPlacements)[number]\n\nexport function isDropdownPlacement(\n value: unknown\n): value is SpectreDropdownPlacement {\n return (spectreDropdownPlacements as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreToastVariants = [\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'neutral'\n] as const\n\nexport type SpectreToastVariant = (typeof spectreToastVariants)[number]\n\nexport function isToastVariant(value: unknown): value is SpectreToastVariant {\n return (spectreToastVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreSidebarLinkLevels = ['parent', 'child'] as const\n\nexport type SpectreSidebarLinkLevel = (typeof spectreSidebarLinkLevels)[number]\n\nexport function isSidebarLinkLevel(\n value: unknown\n): value is SpectreSidebarLinkLevel {\n return (spectreSidebarLinkLevels as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreTooltipPlacements = [\n 'top',\n 'bottom',\n 'left',\n 'right'\n] as const\n\nexport type SpectreTooltipPlacement = (typeof spectreTooltipPlacements)[number]\n\nexport function isTooltipPlacement(\n value: unknown\n): value is SpectreTooltipPlacement {\n return (spectreTooltipPlacements as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreTextSizes = [\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl'\n] as const\n\nexport type SpectreTextSize = (typeof spectreTextSizes)[number]\n\nexport function isTextSize(value: unknown): value is SpectreTextSize {\n return (spectreTextSizes as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextVariants = [\n 'default',\n 'muted',\n 'subtle',\n 'meta',\n 'brand',\n 'onInverse',\n 'onInverseMuted',\n 'onSurface',\n 'onSurfaceMuted',\n 'onSurfaceSubtle',\n 'onSurfaceMeta',\n 'onSurfaceBrand'\n] as const\n\nexport type SpectreTextVariant = (typeof spectreTextVariants)[number]\n\nexport function isTextVariant(value: unknown): value is SpectreTextVariant {\n return (spectreTextVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextFamilies = ['sans', 'serif', 'mono'] as const\n\nexport type SpectreTextFamily = (typeof spectreTextFamilies)[number]\n\nexport function isTextFamily(value: unknown): value is SpectreTextFamily {\n return (spectreTextFamilies as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextLevels = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'p',\n 'span'\n] as const\n\nexport type SpectreTextLevel = (typeof spectreTextLevels)[number]\n\nexport function isTextLevel(value: unknown): value is SpectreTextLevel {\n return (spectreTextLevels as readonly string[]).includes(value as string)\n}\n\nexport const spectreTextTransforms = [\n 'none',\n 'uppercase',\n 'lowercase',\n 'capitalize'\n] as const\n\nexport type SpectreTextTransform = (typeof spectreTextTransforms)[number]\n\nexport function isTextTransform(value: unknown): value is SpectreTextTransform {\n return (spectreTextTransforms as readonly string[]).includes(value as string)\n}\n\nexport const spectreTabsVariants = ['line', 'pill'] as const\n\nexport type SpectreTabsVariant = (typeof spectreTabsVariants)[number]\n\nexport function isTabsVariant(value: unknown): value is SpectreTabsVariant {\n return (spectreTabsVariants as readonly string[]).includes(value as string)\n}\n\nexport const spectreOffcanvasPlacements = [\n 'start',\n 'end',\n 'top',\n 'bottom'\n] as const\n\nexport type SpectreOffcanvasPlacement =\n (typeof spectreOffcanvasPlacements)[number]\n\nexport function isOffcanvasPlacement(\n value: unknown\n): value is SpectreOffcanvasPlacement {\n return (spectreOffcanvasPlacements as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreTableSizes = ['sm', 'md'] as const\n\nexport type SpectreTableSize = (typeof spectreTableSizes)[number]\n\nexport function isTableSize(value: unknown): value is SpectreTableSize {\n return (spectreTableSizes as readonly string[]).includes(value as string)\n}\n\nexport const spectreStepperOrientations = ['horizontal', 'vertical'] as const\n\nexport type SpectreStepperOrientation =\n (typeof spectreStepperOrientations)[number]\n\nexport function isStepperOrientation(\n value: unknown\n): value is SpectreStepperOrientation {\n return (spectreStepperOrientations as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreSpacingScale = ['sm', 'md', 'lg'] as const\n\nexport type SpectreSpacingStep = (typeof spectreSpacingScale)[number]\n\nexport function isSpacingStep(value: unknown): value is SpectreSpacingStep {\n return (spectreSpacingScale as readonly string[]).includes(value as string)\n}\n\nexport const spectreGridColStarts = [\n 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12\n] as const\n\nexport type SpectreGridColStart = (typeof spectreGridColStarts)[number]\n\nexport function isGridColStart(value: unknown): value is SpectreGridColStart {\n return (spectreGridColStarts as readonly number[]).includes(value as number)\n}\n\nexport interface SpectreGridColStartOptions {\n base?: SpectreGridColStart\n md?: SpectreGridColStart\n lg?: SpectreGridColStart\n}\n\nexport function isGridColStartOptions(\n value: unknown\n): value is SpectreGridColStartOptions {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const candidate = value as Record<string, unknown>\n return (\n (candidate.base === undefined || isGridColStart(candidate.base)) &&\n (candidate.md === undefined || isGridColStart(candidate.md)) &&\n (candidate.lg === undefined || isGridColStart(candidate.lg))\n )\n}\n\nexport const spectrePopoverPlacements = [\n 'top',\n 'bottom',\n 'left',\n 'right'\n] as const\n\nexport type SpectrePopoverPlacement = (typeof spectrePopoverPlacements)[number]\n\nexport function isPopoverPlacement(\n value: unknown\n): value is SpectrePopoverPlacement {\n return (spectrePopoverPlacements as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreProgressVariants = [\n 'brand',\n 'neutral',\n 'info',\n 'success',\n 'warning',\n 'danger'\n] as const\n\nexport type SpectreProgressVariant = (typeof spectreProgressVariants)[number]\n\nexport function isProgressVariant(\n value: unknown\n): value is SpectreProgressVariant {\n return (spectreProgressVariants as readonly string[]).includes(\n value as string\n )\n}\n\nexport const spectreTextPresets = ['heading', 'display', 'lead'] as const\n\nexport type SpectreTextPreset = (typeof spectreTextPresets)[number]\n\nexport function isTextPreset(value: unknown): value is SpectreTextPreset {\n return (spectreTextPresets as readonly string[]).includes(value as string)\n}\n\nexport const spectreHeadingLevels = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6'\n] as const\n\nexport type SpectreHeadingLevel = (typeof spectreHeadingLevels)[number]\n\nexport function isHeadingLevel(value: unknown): value is SpectreHeadingLevel {\n return (spectreHeadingLevels as readonly string[]).includes(value as string)\n}\n\nexport const spectreDisplayLevels = [1, 2, 3, 4, 5, 6] as const\n\nexport type SpectreDisplayLevel = (typeof spectreDisplayLevels)[number]\n\nexport function isDisplayLevel(value: unknown): value is SpectreDisplayLevel {\n return (spectreDisplayLevels as readonly number[]).includes(value as number)\n}\n\nexport const spectreTableRowVariants = [\n 'neutral',\n 'info',\n 'success',\n 'warning',\n 'danger'\n] as const\n\nexport type SpectreTableRowVariant = (typeof spectreTableRowVariants)[number]\n\nexport function isTableRowVariant(\n value: unknown\n): value is SpectreTableRowVariant {\n return (spectreTableRowVariants as readonly string[]).includes(\n value as string\n )\n}\n\nexport function normalizeInt(\n value: unknown,\n fallback: number | undefined,\n min = 0\n): number | undefined {\n if (\n value == null ||\n typeof value !== 'number' ||\n !Number.isInteger(value) ||\n value < min\n ) {\n return fallback\n }\n return value\n}\n\nconst spectreUtilityClassPattern =\n /^sp-[a-z0-9]+(?:-[a-z0-9]+)*(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?(?:--[a-z0-9]+(?:-[a-z0-9]+)*)?$/\n\nexport function sanitizeUtilityClasses(\n value: string | null | undefined\n): string {\n if (!value) {\n return ''\n }\n return value\n .split(/\\s+/)\n .filter((token) => spectreUtilityClassPattern.test(token))\n .join(' ')\n}\n","import { LitElement, type PropertyDeclarations } from 'lit'\n\nexport class SpectreBaseElement extends LitElement {\n static properties: PropertyDeclarations = {}\n\n private _ariaLabel: string | null = null\n private _ariaLabelledBy: string | null = null\n private _ariaDescribedBy: string | null = null\n private _autocapitalize = ''\n private _autofocus = false\n private _spellcheck: boolean | null = null\n private _title = ''\n private _id = ''\n\n get ariaLabel(): string | null {\n return this._ariaLabel\n }\n\n set ariaLabel(value: string | null) {\n if (this._ariaLabel === value) {\n return\n }\n this._ariaLabel = value\n this._removeHostAttribute('aria-label')\n this.requestUpdate()\n }\n\n get ariaLabelledBy(): string | null {\n return this._ariaLabelledBy\n }\n\n set ariaLabelledBy(value: string | null) {\n if (this._ariaLabelledBy === value) {\n return\n }\n this._ariaLabelledBy = value\n this._removeHostAttribute('aria-labelledby')\n this.requestUpdate()\n }\n\n get ariaDescribedBy(): string | null {\n return this._ariaDescribedBy\n }\n\n set ariaDescribedBy(value: string | null) {\n if (this._ariaDescribedBy === value) {\n return\n }\n this._ariaDescribedBy = value\n this._removeHostAttribute('aria-describedby')\n this.requestUpdate()\n }\n\n override get autocapitalize(): string {\n return this._autocapitalize\n }\n\n override set autocapitalize(value: string | undefined | null) {\n const normalizedValue = value ?? ''\n if (this._autocapitalize === normalizedValue) {\n return\n }\n this._autocapitalize = normalizedValue\n this._removeHostAttribute('autocapitalize')\n this.requestUpdate()\n }\n\n override get spellcheck(): boolean {\n return this._spellcheck ?? super.spellcheck\n }\n\n override set spellcheck(value: boolean | undefined | null) {\n if (this._spellcheck === value) {\n return\n }\n this._spellcheck = value ?? null\n this._removeHostAttribute('spellcheck')\n this.requestUpdate()\n }\n\n override get title(): string {\n return this._title\n }\n\n override set title(value: string | undefined | null) {\n const normalizedValue = value ?? ''\n if (this._title === normalizedValue) {\n return\n }\n this._title = normalizedValue\n this._removeHostAttribute('title')\n this.requestUpdate()\n }\n\n override get id(): string {\n return this._id\n }\n\n override set id(value: string | undefined | null) {\n const normalizedValue = value ?? ''\n if (this._id === normalizedValue) {\n return\n }\n this._id = normalizedValue\n this._removeHostAttribute('id')\n this.requestUpdate()\n }\n\n override get autofocus(): boolean {\n return this._autofocus\n }\n\n override set autofocus(value: boolean | undefined | null) {\n const normalizedValue = !!value\n if (this._autofocus === normalizedValue) {\n return\n }\n this._autofocus = normalizedValue\n this._removeHostAttribute('autofocus')\n this.requestUpdate()\n }\n\n // Spectre components intentionally render in light DOM so the global\n // `@phcdevworks/spectre-ui` styling contract can apply directly.\n createRenderRoot(): this {\n return this\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n\n const proxiedAttributes = [\n 'id',\n 'title',\n 'autocapitalize',\n 'autofocus',\n 'spellcheck',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby'\n ]\n\n proxiedAttributes.forEach((attr) => {\n const value = super.getAttribute(attr)\n if (value !== null) {\n this.setAttribute(attr, value)\n }\n })\n }\n\n override getAttribute(qualifiedName: string): string | null {\n switch (qualifiedName) {\n case 'id':\n return this.id || null\n case 'title':\n return this.title || null\n case 'autocapitalize':\n return this.autocapitalize || null\n case 'autofocus':\n return this.autofocus ? '' : null\n case 'spellcheck':\n return this._spellcheck !== null ? String(this._spellcheck) : null\n case 'aria-label':\n return this.ariaLabel\n case 'aria-labelledby':\n return this.ariaLabelledBy\n case 'aria-describedby':\n return this.ariaDescribedBy\n default:\n return super.getAttribute(qualifiedName)\n }\n }\n\n override hasAttribute(qualifiedName: string): boolean {\n switch (qualifiedName) {\n case 'id':\n return this.id !== ''\n case 'title':\n return this.title !== ''\n case 'autocapitalize':\n return this.autocapitalize !== ''\n case 'autofocus':\n return this.autofocus\n case 'spellcheck':\n return this._spellcheck !== null\n case 'aria-label':\n return this.ariaLabel !== null\n case 'aria-labelledby':\n return this.ariaLabelledBy !== null\n case 'aria-describedby':\n return this.ariaDescribedBy !== null\n default:\n return super.hasAttribute(qualifiedName)\n }\n }\n\n override setAttribute(qualifiedName: string, value: string): void {\n switch (qualifiedName) {\n case 'id':\n this.id = value\n break\n case 'title':\n this.title = value\n break\n case 'autocapitalize':\n this.autocapitalize = value\n break\n case 'autofocus':\n this.autofocus = true\n break\n case 'spellcheck':\n this.spellcheck = value !== 'false'\n break\n case 'aria-label':\n this.ariaLabel = value\n break\n case 'aria-labelledby':\n this.ariaLabelledBy = value\n break\n case 'aria-describedby':\n this.ariaDescribedBy = value\n break\n default:\n super.setAttribute(qualifiedName, value)\n }\n }\n\n override removeAttribute(qualifiedName: string): void {\n switch (qualifiedName) {\n case 'id':\n this.id = ''\n break\n case 'title':\n this.title = ''\n break\n case 'autocapitalize':\n this.autocapitalize = ''\n break\n case 'autofocus':\n this.autofocus = false\n break\n case 'spellcheck':\n this.spellcheck = null\n break\n case 'aria-label':\n this.ariaLabel = null\n break\n case 'aria-labelledby':\n this.ariaLabelledBy = null\n break\n case 'aria-describedby':\n this.ariaDescribedBy = null\n break\n default:\n super.removeAttribute(qualifiedName)\n }\n }\n\n private _removeHostAttribute(name: string): void {\n const host = this as unknown as HTMLElement\n if (HTMLElement.prototype.hasAttribute.call(host, name)) {\n // Use the native removeAttribute to avoid our own overridden version\n // which would reset the internal state.\n HTMLElement.prototype.removeAttribute.call(host, name)\n }\n }\n\n protected get forwardedAriaLabel(): string | undefined {\n const value = this.ariaLabel?.trim()\n return value ? value : undefined\n }\n\n protected get forwardedAriaLabelledBy(): string | undefined {\n const value = this.ariaLabelledBy?.trim()\n return value ? value : undefined\n }\n\n protected get forwardedAriaDescribedBy(): string | undefined {\n const value = this.ariaDescribedBy?.trim()\n return value ? value : undefined\n }\n\n // Subclasses that expose `disabled`/`loading` properties get this disabled\n // calculation for free instead of redeclaring it per component.\n protected get isDisabled(): boolean {\n const self = this as unknown as { disabled?: boolean; loading?: boolean }\n return (self.disabled ?? false) || (self.loading ?? false)\n }\n\n // Subclasses get this for free instead of redeclaring it per component.\n protected get hasForwardedLabel(): boolean {\n return Boolean(this.forwardedAriaLabel || this.forwardedAriaLabelledBy)\n }\n}\n","import { html, svg, type TemplateResult } from 'lit'\n\nconst paths = {\n check: svg`<path d=\"M3 8.5l3 3 7-7\" />`,\n chevronDown: svg`<path d=\"M4 6l4 4 4-4\" />`,\n chevronLeft: svg`<path d=\"M10 4l-4 4 4 4\" />`,\n chevronRight: svg`<path d=\"M6 4l4 4-4 4\" />`,\n close: svg`<path d=\"M4 4l8 8M12 4l-8 8\" />`\n}\n\nexport type SpectreIconName = keyof typeof paths\n\n// Decorative stroke icons; sizing comes from an `sp-icon-*` utility class.\nexport function renderIcon(\n name: SpectreIconName,\n sizeClass = 'sp-icon-sm'\n): TemplateResult {\n return html`<svg\n aria-hidden=\"true\"\n class=\"${sizeClass}\"\n fill=\"none\"\n focusable=\"false\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n viewBox=\"0 0 16 16\"\n >\n ${paths[name]}\n </svg>`\n}\n","export function hasMeaningfulContent(nodes: readonly Node[]): boolean {\n return nodes.some((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n return true\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent?.trim().length ?? 0) > 0\n }\n\n return false\n })\n}\n\nlet idCounter = 0\n\nexport function createUniqueId(prefix: string): string {\n idCounter += 1\n return `${prefix}-${idCounter}`\n}\n\n// Swaps the recipe classes this component previously applied to `element`\n// without touching classes the author set.\nexport function replaceClasses(\n element: Element,\n previous: string,\n next: string\n): void {\n const nextTokens = next.split(/\\s+/).filter(Boolean)\n previous\n .split(/\\s+/)\n .filter((token) => token && !nextTokens.includes(token))\n .forEach((token) => element.classList.remove(token))\n element.classList.add(...nextTokens)\n}\n\n// Parent/child component pairs identify each other through a global symbol\n// rather than `instanceof`, because every subpath entry bundles its own copy\n// of the child class.\nexport const spectreKindKey: unique symbol = Symbol.for(\n 'phcdevworks.spectre-components.kind'\n)\n\nexport function isSpectreKind<T extends Element>(\n node: Node,\n kind: string\n): node is T {\n return (node as { [spectreKindKey]?: string })[spectreKindKey] === kind\n}\n","import type { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { hasMeaningfulContent } from './dom'\n\ntype ProjectionHost = ReactiveControllerHost & HTMLElement\n\nfunction slotOf(node: Node): string | undefined {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return undefined\n }\n return (node as Element).getAttribute('slot') ?? undefined\n}\n\n// Tracks authored light-DOM nodes for components that project content into\n// more than one rendered container, partitioned by their `slot` attribute.\nexport class ProjectionController implements ReactiveController {\n private projected: Node[] = []\n private observer: MutationObserver | undefined\n\n constructor(\n private readonly host: ProjectionHost,\n private readonly internalAttributes: readonly string[]\n ) {\n host.addController(this)\n }\n\n hostConnected(): void {\n this.sync()\n this.observe()\n }\n\n hostDisconnected(): void {\n this.disconnect()\n }\n\n hostUpdate(): void {\n this.sync()\n this.disconnect()\n }\n\n hostUpdated(): void {\n this.observe()\n }\n\n // Every projected node in authored order, regardless of slot.\n all(): Node[] {\n return [...this.projected]\n }\n\n // Omitting `slot` returns the nodes without a slot attribute.\n nodes(slot?: string): Node[] {\n return this.projected.filter((node) => slotOf(node) === slot)\n }\n\n elements(slot?: string): Element[] {\n return this.nodes(slot).filter(\n (node): node is Element => node.nodeType === Node.ELEMENT_NODE\n )\n }\n\n has(slot?: string): boolean {\n return hasMeaningfulContent(this.nodes(slot))\n }\n\n private isInternalNode(node: Node): boolean {\n return (\n node.nodeType === Node.ELEMENT_NODE &&\n this.internalAttributes.some((name) =>\n (node as Element).hasAttribute(name)\n )\n )\n }\n\n private isProjectable(node: Node): boolean {\n if (node.nodeType === Node.COMMENT_NODE || this.isInternalNode(node)) {\n return false\n }\n // After the first render, whitespace between rendered siblings belongs to\n // the template, not the author.\n if (node.nodeType === Node.TEXT_NODE && this.hostHasRendered) {\n return Boolean(node.textContent?.trim())\n }\n return true\n }\n\n private get hostHasRendered(): boolean {\n return (this.host as unknown as { hasUpdated: boolean }).hasUpdated\n }\n\n private sync(): boolean {\n // Authored nodes already moved into rendered containers are retained;\n // re-reading those containers would also capture Lit's own nodes.\n const next = [\n ...new Set([\n ...this.projected.filter((node) => this.host.contains(node)),\n ...Array.from(this.host.childNodes).filter((node) =>\n this.isProjectable(node)\n )\n ])\n ]\n\n const changed =\n next.length !== this.projected.length ||\n next.some((node, index) => node !== this.projected[index])\n\n if (changed) {\n this.projected = next\n }\n return changed\n }\n\n private observe(): void {\n if (this.observer || !this.host.isConnected) {\n return\n }\n this.observer = new MutationObserver(() => {\n if (this.sync()) {\n this.host.requestUpdate()\n }\n })\n this.observer.observe(this.host, { childList: true })\n }\n\n private disconnect(): void {\n this.observer?.disconnect()\n this.observer = undefined\n }\n}\n","// Recipe-forced interaction states. Real interaction is styled by native\n// pseudo-classes; these force the look for documentation, previews, and\n// visual tests.\nexport const hoverFocusStateProperties = {\n focused: { type: Boolean, reflect: true },\n hovered: { type: Boolean, reflect: true }\n} as const\n\nexport const interactionStateProperties = {\n ...hoverFocusStateProperties,\n active: { type: Boolean, reflect: true }\n} as const\n\nexport interface SpectreHoverFocusStateProps {\n focused?: boolean | undefined\n hovered?: boolean | undefined\n}\n\nexport interface SpectreInteractionStateProps extends SpectreHoverFocusStateProps {\n active?: boolean | undefined\n}\n\nexport function hoverFocusStates(element: SpectreHoverFocusStateProps): {\n focused: boolean\n hovered: boolean\n} {\n return {\n focused: element.focused ?? false,\n hovered: element.hovered ?? false\n }\n}\n\nexport function interactionStates(element: SpectreInteractionStateProps): {\n active: boolean\n focused: boolean\n hovered: boolean\n} {\n return { ...hoverFocusStates(element), active: element.active ?? false }\n}\n","import { html, nothing } from 'lit'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { SpectreBaseElement } from '../../utils/base'\nimport {\n isAlertVariant,\n isInputSize,\n type SpectreAlertVariant,\n type SpectreInputSize\n} from '../../utils/form'\nimport { renderIcon } from '../../utils/icons'\nimport { ProjectionController } from '../../utils/projection'\n\nimport {\n interactionStateProperties,\n interactionStates,\n type SpectreInteractionStateProps\n} from '../../utils/states'\n\nimport {\n getAlertClasses,\n getAlertDismissClasses,\n getAlertIconClasses,\n type AlertVariant,\n type AlertSize\n} from '@phcdevworks/spectre-ui'\n\nexport interface SpectreAlertProps extends SpectreInteractionStateProps {\n interactive?: boolean | undefined\n ariaLabel?: string | null\n ariaLabelledBy?: string | null\n ariaDescribedBy?: string | null\n dismissLabel?: string | undefined\n dismissed?: boolean | undefined\n dismissible?: boolean | undefined\n disabled?: boolean | undefined\n fullWidth?: boolean | undefined\n id?: string | null | undefined\n loading?: boolean | undefined\n size?: SpectreInputSize | undefined\n title?: string | null | undefined\n variant?: SpectreAlertVariant | undefined\n}\n\nexport class SpectreAlertElement\n extends SpectreBaseElement\n implements SpectreAlertProps\n{\n static properties = {\n interactive: { type: Boolean, reflect: true },\n ...interactionStateProperties,\n dismissLabel: { attribute: 'dismiss-label', type: String },\n dismissed: { type: Boolean, reflect: true },\n dismissible: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n fullWidth: { attribute: 'full-width', type: Boolean, reflect: true },\n loading: { type: Boolean, reflect: true },\n size: { type: String, reflect: true },\n variant: { type: String, reflect: true }\n }\n\n interactive: boolean | undefined = false\n\n active: boolean | undefined = false\n focused: boolean | undefined = false\n hovered: boolean | undefined = false\n\n dismissLabel: string | undefined = 'Dismiss'\n dismissed: boolean | undefined = false\n dismissible: boolean | undefined = false\n disabled: boolean | undefined = false\n fullWidth: boolean | undefined = false\n loading: boolean | undefined = false\n size: SpectreInputSize | undefined = 'md'\n variant: SpectreAlertVariant | undefined = 'info'\n\n override get id(): string {\n return super.id\n }\n\n override set id(value: string | null | undefined) {\n super.id = value\n }\n\n override get title(): string {\n return super.title\n }\n\n override set title(value: string | null | undefined) {\n super.title = value\n }\n\n private readonly projection = new ProjectionController(this, [\n 'data-sp-alert-native'\n ])\n\n protected override willUpdate(\n changedProperties: Map<PropertyKey, unknown>\n ): void {\n if (changedProperties.has('dismissLabel') && !this.dismissLabel) {\n this.dismissLabel = 'Dismiss'\n }\n if (changedProperties.has('dismissed') && this.dismissed == null) {\n this.dismissed = false\n }\n if (changedProperties.has('dismissible') && this.dismissible == null) {\n this.dismissible = false\n }\n if (changedProperties.has('disabled') && this.disabled == null) {\n this.disabled = false\n }\n if (changedProperties.has('fullWidth') && this.fullWidth == null) {\n this.fullWidth = false\n }\n if (changedProperties.has('loading') && this.loading == null) {\n this.loading = false\n }\n if (\n changedProperties.has('variant') &&\n (this.variant == null || !isAlertVariant(this.variant))\n ) {\n this.variant = 'info'\n }\n if (\n changedProperties.has('size') &&\n (this.size == null || !isInputSize(this.size))\n ) {\n this.size = 'md'\n }\n }\n\n private dismiss(): void {\n if (this.dismissed) {\n return\n }\n this.dismissed = true\n this.dispatchEvent(new CustomEvent('sp-dismiss', { bubbles: true }))\n }\n\n private get alertClasses(): string {\n return getAlertClasses({\n interactive: this.interactive ?? false,\n ...interactionStates(this),\n disabled: this.isDisabled,\n dismissed: this.dismissed ?? false,\n dismissible: this.dismissible ?? false,\n fullWidth: this.fullWidth ?? false,\n loading: this.loading ?? false,\n size: this.size as AlertSize,\n variant: this.variant as AlertVariant\n })\n }\n\n override render() {\n return html`<div\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n aria-describedby=\"${ifDefined(this.forwardedAriaDescribedBy)}\"\n aria-label=\"${ifDefined(this.forwardedAriaLabel)}\"\n aria-labelledby=\"${ifDefined(this.forwardedAriaLabelledBy)}\"\n class=\"${this.alertClasses}\"\n data-sp-alert-native\n id=\"${ifDefined(this.id || undefined)}\"\n role=\"alert\"\n title=\"${ifDefined(this.title || undefined)}\"\n >\n ${\n this.projection.has('icon')\n ? html`<span class=\"${getAlertIconClasses()}\"\n >${this.projection.nodes('icon')}</span\n >`\n : nothing\n }\n ${this.projection.has() ? this.projection.nodes() : nothing}\n ${\n this.dismissible\n ? html`<button\n aria-label=\"${this.dismissLabel ?? 'Dismiss'}\"\n class=\"${getAlertDismissClasses()}\"\n data-sp-alert-dismiss\n type=\"button\"\n @click=\"${() => this.dismiss()}\"\n >\n ${renderIcon('close')}\n </button>`\n : nothing\n }\n </div>`\n }\n}\n\nexport function defineSpectreAlert(\n tagName = 'sp-alert'\n): typeof SpectreAlertElement {\n const existingElement = customElements.get(tagName)\n\n if (existingElement) {\n return existingElement as unknown as typeof SpectreAlertElement\n }\n\n customElements.define(tagName, SpectreAlertElement)\n return SpectreAlertElement\n}\n"]}
|