@phcdevworks/spectre-components 1.18.0 → 1.20.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 +102 -78
- package/dist/alert.cjs.map +1 -1
- package/dist/alert.d.cts +2 -2
- package/dist/alert.d.ts +2 -2
- package/dist/alert.js.map +1 -1
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.d.cts +2 -2
- package/dist/avatar.d.ts +2 -2
- package/dist/avatar.js.map +1 -1
- package/dist/badge.cjs +48 -1
- package/dist/badge.cjs.map +1 -1
- package/dist/badge.d.cts +22 -2
- package/dist/badge.d.ts +22 -2
- package/dist/badge.js +48 -1
- package/dist/badge.js.map +1 -1
- package/dist/button.cjs.map +1 -1
- package/dist/button.d.cts +2 -2
- package/dist/button.d.ts +2 -2
- package/dist/button.js.map +1 -1
- package/dist/card.cjs +34 -0
- package/dist/card.cjs.map +1 -1
- package/dist/card.d.cts +16 -3
- package/dist/card.d.ts +16 -3
- package/dist/card.js +33 -1
- package/dist/card.js.map +1 -1
- package/dist/container.cjs.map +1 -1
- package/dist/container.d.cts +2 -2
- package/dist/container.d.ts +2 -2
- package/dist/container.js.map +1 -1
- package/dist/dropdown.cjs +53 -6
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.d.cts +21 -2
- package/dist/dropdown.d.ts +21 -2
- package/dist/dropdown.js +53 -6
- package/dist/dropdown.js.map +1 -1
- package/dist/footer.cjs +32 -0
- package/dist/footer.cjs.map +1 -1
- package/dist/footer.d.cts +14 -0
- package/dist/footer.d.ts +14 -0
- package/dist/footer.js +32 -0
- package/dist/footer.js.map +1 -1
- package/dist/{form-TvtLcoW0.d.cts → form-DpPtizpY.d.cts} +5 -1
- package/dist/{form-TvtLcoW0.d.ts → form-DpPtizpY.d.ts} +5 -1
- package/dist/grid.cjs.map +1 -1
- package/dist/grid.d.cts +2 -2
- package/dist/grid.d.ts +2 -2
- package/dist/grid.js.map +1 -1
- package/dist/icon-box.cjs.map +1 -1
- package/dist/icon-box.d.cts +2 -2
- package/dist/icon-box.d.ts +2 -2
- package/dist/icon-box.js.map +1 -1
- package/dist/index.cjs +220 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +219 -12
- package/dist/index.js.map +1 -1
- package/dist/input.cjs.map +1 -1
- package/dist/input.d.cts +2 -2
- package/dist/input.d.ts +2 -2
- package/dist/input.js.map +1 -1
- package/dist/modal.cjs +32 -0
- package/dist/modal.cjs.map +1 -1
- package/dist/modal.d.cts +14 -0
- package/dist/modal.d.ts +14 -0
- package/dist/modal.js +32 -0
- package/dist/modal.js.map +1 -1
- package/dist/nav-item.cjs.map +1 -1
- package/dist/nav-item.d.cts +1 -1
- package/dist/nav-item.d.ts +1 -1
- package/dist/nav-item.js.map +1 -1
- package/dist/nav.cjs +32 -0
- package/dist/nav.cjs.map +1 -1
- package/dist/nav.d.cts +14 -1
- package/dist/nav.d.ts +14 -1
- package/dist/nav.js +32 -0
- package/dist/nav.js.map +1 -1
- package/dist/pricing-card.cjs +32 -0
- package/dist/pricing-card.cjs.map +1 -1
- package/dist/pricing-card.d.cts +14 -0
- package/dist/pricing-card.d.ts +14 -0
- package/dist/pricing-card.js +32 -0
- package/dist/pricing-card.js.map +1 -1
- package/dist/radio.cjs +3 -2
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.js +3 -2
- package/dist/radio.js.map +1 -1
- package/dist/rating.cjs.map +1 -1
- package/dist/rating.d.cts +2 -2
- package/dist/rating.d.ts +2 -2
- package/dist/rating.js.map +1 -1
- package/dist/section.cjs.map +1 -1
- package/dist/section.js.map +1 -1
- package/dist/select.cjs.map +1 -1
- package/dist/select.d.cts +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js.map +1 -1
- package/dist/sidebar-link.cjs.map +1 -1
- package/dist/sidebar-link.d.cts +1 -1
- package/dist/sidebar-link.d.ts +1 -1
- package/dist/sidebar-link.js.map +1 -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.map +1 -1
- 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.map +1 -1
- package/dist/tag.cjs.map +1 -1
- package/dist/tag.d.cts +2 -2
- package/dist/tag.d.ts +2 -2
- package/dist/tag.js.map +1 -1
- package/dist/testimonial.cjs +32 -0
- package/dist/testimonial.cjs.map +1 -1
- package/dist/testimonial.d.cts +15 -2
- package/dist/testimonial.d.ts +15 -2
- package/dist/testimonial.js +32 -0
- package/dist/testimonial.js.map +1 -1
- package/dist/text.cjs.map +1 -1
- package/dist/text.d.cts +2 -2
- package/dist/text.d.ts +2 -2
- package/dist/text.js.map +1 -1
- package/dist/textarea.cjs.map +1 -1
- package/dist/textarea.d.cts +1 -1
- package/dist/textarea.d.ts +1 -1
- package/dist/textarea.js.map +1 -1
- package/dist/toast.cjs +32 -0
- 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 +32 -0
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.cjs +41 -2
- 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 +41 -2
- package/dist/tooltip.js.map +1 -1
- package/package.json +22 -18
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @phcdevworks/spectre-components
|
|
2
2
|
|
|
3
|
-
`@phcdevworks/spectre-components` is the
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
`@phcdevworks/spectre-components` is the web-component layer of the Spectre
|
|
4
|
+
system. It provides accessible, framework-independent interface components
|
|
5
|
+
built on Spectre's shared design contracts.
|
|
6
6
|
|
|
7
7
|
Maintained by [PHCDevworks](https://go.phcdev.co). It draws on Spectre's token
|
|
8
8
|
and styling contracts to ship drop-in UI primitives, so applications that need
|
|
@@ -16,7 +16,7 @@ consume Spectre without a framework-specific adapter.
|
|
|
16
16
|
| Project team | `project-design` |
|
|
17
17
|
| Repository role | Spectre L3a Lit web component layer |
|
|
18
18
|
| Package/artifact | `@phcdevworks/spectre-components` |
|
|
19
|
-
| Current version/status | 1.
|
|
19
|
+
| Current version/status | 1.20.0 |
|
|
20
20
|
|
|
21
21
|
## Standard Workflow
|
|
22
22
|
|
|
@@ -582,14 +582,17 @@ Renders a `<span>` display primitive backed by the Spectre badge recipe.
|
|
|
582
582
|
|
|
583
583
|
**Attributes**
|
|
584
584
|
|
|
585
|
-
| Attribute | Type
|
|
586
|
-
| ------------------------- |
|
|
587
|
-
| `variant` | `primary \| secondary \| ghost \| danger \| success \| warning \| info \| accent \| cta \| neutral \| outline \| inverse` | `primary` | Visual style
|
|
588
|
-
| `size` | `sm \| md \| lg`
|
|
589
|
-
| `
|
|
590
|
-
| `
|
|
591
|
-
| `
|
|
592
|
-
| `
|
|
585
|
+
| Attribute | Type | Default | Description |
|
|
586
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
587
|
+
| `variant` | `primary \| secondary \| ghost \| danger \| success \| warning \| info \| accent \| cta \| neutral \| outline \| inverse` | `primary` | Visual style |
|
|
588
|
+
| `size` | `sm \| md \| lg` | `md` | Badge size |
|
|
589
|
+
| `accent-rail` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail. Distinct from `variant: 'accent'`, an unrelated single-tone fill |
|
|
590
|
+
| `accent-rail-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent-rail` is set |
|
|
591
|
+
| `disabled` | boolean | `false` | Disabled visual state |
|
|
592
|
+
| `loading` | boolean | `false` | Busy visual state |
|
|
593
|
+
| `full-width` | boolean | `false` | Spans full container width |
|
|
594
|
+
| `inner-class` | string | — | Spectre utility classes applied to the native `<span>` |
|
|
595
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native `<span>` |
|
|
593
596
|
|
|
594
597
|
**Content projection** — children become the badge content.
|
|
595
598
|
|
|
@@ -603,16 +606,18 @@ Renders a `<div>` container backed by the Spectre card recipe.
|
|
|
603
606
|
|
|
604
607
|
**Attributes**
|
|
605
608
|
|
|
606
|
-
| Attribute | Type
|
|
607
|
-
| ------------------------- |
|
|
608
|
-
| `variant` | `elevated \| flat \| outline \| ghost`
|
|
609
|
-
| `padded` | `boolean \| 'sm' \| 'md' \| 'lg'`
|
|
610
|
-
| `
|
|
611
|
-
| `
|
|
612
|
-
| `
|
|
613
|
-
| `
|
|
614
|
-
| `
|
|
615
|
-
| `
|
|
609
|
+
| Attribute | Type | Default | Description |
|
|
610
|
+
| ------------------------- | ----------------------------------------------------------------- | ---------- | ------------------------------------------------------------- |
|
|
611
|
+
| `variant` | `elevated \| flat \| outline \| ghost` | `elevated` | Visual style |
|
|
612
|
+
| `padded` | `boolean \| 'sm' \| 'md' \| 'lg'` | `true` | Card padding step; `false` opts out, `true`/`"md"` is default |
|
|
613
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
614
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
615
|
+
| `full-height` | boolean | `false` | Spans full container height |
|
|
616
|
+
| `interactive` | boolean | `false` | Applies interactive styling |
|
|
617
|
+
| `disabled` | boolean | `false` | Disabled visual state |
|
|
618
|
+
| `loading` | boolean | `false` | Busy visual state |
|
|
619
|
+
| `inner-class` | string | — | Spectre utility classes applied to the native `<div>` |
|
|
620
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
|
|
616
621
|
|
|
617
622
|
**Content projection** — children become the card content.
|
|
618
623
|
|
|
@@ -673,14 +678,16 @@ recipe.
|
|
|
673
678
|
|
|
674
679
|
**Attributes**
|
|
675
680
|
|
|
676
|
-
| Attribute | Type
|
|
677
|
-
| ------------------------- |
|
|
678
|
-
| `variant` | `elevated \| flat \| outline \| ghost`
|
|
679
|
-
| `
|
|
680
|
-
| `
|
|
681
|
-
| `
|
|
682
|
-
| `
|
|
683
|
-
| `
|
|
681
|
+
| Attribute | Type | Default | Description |
|
|
682
|
+
| ------------------------- | ----------------------------------------------------------------- | ---------- | ------------------------------------------------------ |
|
|
683
|
+
| `variant` | `elevated \| flat \| outline \| ghost` | `elevated` | Visual style |
|
|
684
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
685
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
686
|
+
| `full-height` | boolean | `false` | Spans full container height |
|
|
687
|
+
| `interactive` | boolean | `false` | Applies interactive styling |
|
|
688
|
+
| `disabled` | boolean | `false` | Disabled visual state |
|
|
689
|
+
| `loading` | boolean | `false` | Busy visual state |
|
|
690
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
|
|
684
691
|
|
|
685
692
|
**Content projection** — children become the testimonial content.
|
|
686
693
|
|
|
@@ -796,14 +803,16 @@ recipe.
|
|
|
796
803
|
|
|
797
804
|
**Attributes**
|
|
798
805
|
|
|
799
|
-
| Attribute | Type
|
|
800
|
-
| ------------------------- |
|
|
801
|
-
| `featured` | boolean
|
|
802
|
-
| `
|
|
803
|
-
| `
|
|
804
|
-
| `
|
|
805
|
-
| `
|
|
806
|
-
| `
|
|
806
|
+
| Attribute | Type | Default | Description |
|
|
807
|
+
| ------------------------- | ----------------------------------------------------------------- | ------- | ------------------------------------------------------ |
|
|
808
|
+
| `featured` | boolean | `false` | Highlights the card as featured |
|
|
809
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
810
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
811
|
+
| `interactive` | boolean | `false` | Applies interactive styling |
|
|
812
|
+
| `disabled` | boolean | `false` | Disabled visual state |
|
|
813
|
+
| `loading` | boolean | `false` | Busy visual state |
|
|
814
|
+
| `full-height` | boolean | `false` | Spans full container height |
|
|
815
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
|
|
807
816
|
|
|
808
817
|
**Content projection** — children become the pricing card content (heading,
|
|
809
818
|
price, feature list, call-to-action, etc.).
|
|
@@ -941,12 +950,14 @@ Renders a `<footer>` backed by the Spectre footer recipe.
|
|
|
941
950
|
|
|
942
951
|
**Attributes**
|
|
943
952
|
|
|
944
|
-
| Attribute | Type
|
|
945
|
-
| ------------------------- |
|
|
946
|
-
| `bordered` | boolean
|
|
947
|
-
| `
|
|
948
|
-
| `
|
|
949
|
-
| `
|
|
953
|
+
| Attribute | Type | Default | Description |
|
|
954
|
+
| ------------------------- | ----------------------------------------------------------------- | ------- | -------------------------------------------------------- |
|
|
955
|
+
| `bordered` | boolean | `false` | Adds a top border |
|
|
956
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
957
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
958
|
+
| `full-width` | boolean | `false` | Spans full container width |
|
|
959
|
+
| `inner-class` | string | — | Spectre utility classes applied to the native `<footer>` |
|
|
960
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native `<footer>` |
|
|
950
961
|
|
|
951
962
|
**Content projection** — children become the footer content (links, legal text,
|
|
952
963
|
etc.).
|
|
@@ -1007,14 +1018,16 @@ Renders a `<nav>` backed by the Spectre nav recipe.
|
|
|
1007
1018
|
|
|
1008
1019
|
**Attributes**
|
|
1009
1020
|
|
|
1010
|
-
| Attribute | Type
|
|
1011
|
-
| ------------------------- |
|
|
1012
|
-
| `bordered` | boolean
|
|
1013
|
-
| `
|
|
1014
|
-
| `
|
|
1015
|
-
| `
|
|
1016
|
-
| `
|
|
1017
|
-
| `
|
|
1021
|
+
| Attribute | Type | Default | Description |
|
|
1022
|
+
| ------------------------- | ----------------------------------------------------------------- | ------- | ------------------------------------------------------ |
|
|
1023
|
+
| `bordered` | boolean | `false` | Adds a bottom border |
|
|
1024
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
1025
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
1026
|
+
| `sticky` | boolean | `false` | Sticks the nav to the viewport |
|
|
1027
|
+
| `full-width` | boolean | `false` | Spans full container width |
|
|
1028
|
+
| `align` | `start \| center \| end` | — | Horizontal alignment of nav content within the bar |
|
|
1029
|
+
| `inner-class` | string | — | Spectre utility classes applied to the native `<nav>` |
|
|
1030
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native `<nav>` |
|
|
1018
1031
|
|
|
1019
1032
|
**Content projection** — children become the nav content (links, brand mark,
|
|
1020
1033
|
etc.).
|
|
@@ -1184,14 +1197,17 @@ recipes.
|
|
|
1184
1197
|
|
|
1185
1198
|
**Attributes**
|
|
1186
1199
|
|
|
1187
|
-
| Attribute | Type
|
|
1188
|
-
| ------------------------- |
|
|
1189
|
-
| `open` | boolean
|
|
1190
|
-
| `placement` | `bottom-start \| bottom-end \| top-start \| top-end`
|
|
1191
|
-
| `
|
|
1192
|
-
| `
|
|
1193
|
-
| `
|
|
1194
|
-
| `
|
|
1200
|
+
| Attribute | Type | Default | Description |
|
|
1201
|
+
| ------------------------- | ----------------------------------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------- |
|
|
1202
|
+
| `open` | boolean | `false` | Open/closed menu state |
|
|
1203
|
+
| `placement` | `bottom-start \| bottom-end \| top-start \| top-end` | `bottom-start` | Menu position relative to trigger |
|
|
1204
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail on the menu; omitted renders no rail |
|
|
1205
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
1206
|
+
| `full-width` | boolean | `false` | Spans full container width |
|
|
1207
|
+
| `mega` | boolean | `false` | Anchors the menu to the nearest positioned ancestor instead of the trigger, spanning its full width |
|
|
1208
|
+
| `viewport` | boolean | `false` | Breaks the menu out to the full browser viewport width; takes precedence over `mega` if both are set |
|
|
1209
|
+
| `trigger-label` | string | `Toggle menu` | Visible/accessible trigger text when no `slot="trigger"` content is projected |
|
|
1210
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the trigger button |
|
|
1195
1211
|
|
|
1196
1212
|
**Content projection** — an element with `slot="trigger"` becomes the trigger
|
|
1197
1213
|
button content; all other children become the menu content.
|
|
@@ -1213,11 +1229,13 @@ Renders a full-screen overlay and dialog, backed by the Spectre modal recipes.
|
|
|
1213
1229
|
|
|
1214
1230
|
**Attributes**
|
|
1215
1231
|
|
|
1216
|
-
| Attribute | Type
|
|
1217
|
-
| ------------------------- |
|
|
1218
|
-
| `open` | boolean
|
|
1219
|
-
| `
|
|
1220
|
-
| `
|
|
1232
|
+
| Attribute | Type | Default | Description |
|
|
1233
|
+
| ------------------------- | ----------------------------------------------------------------- | ------- | ------------------------------------------------------ |
|
|
1234
|
+
| `open` | boolean | `false` | Open/closed dialog state |
|
|
1235
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
1236
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
1237
|
+
| `full-width` | boolean | `false` | Spans full container width |
|
|
1238
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native dialog element |
|
|
1221
1239
|
|
|
1222
1240
|
**Content projection** — children become the dialog content.
|
|
1223
1241
|
|
|
@@ -1239,13 +1257,15 @@ recipes, with an imperative show/dismiss API.
|
|
|
1239
1257
|
|
|
1240
1258
|
**Attributes**
|
|
1241
1259
|
|
|
1242
|
-
| Attribute | Type
|
|
1243
|
-
| ------------------------- |
|
|
1244
|
-
| `variant` | `info \| success \| warning \| danger`
|
|
1245
|
-
| `
|
|
1246
|
-
| `
|
|
1247
|
-
| `
|
|
1248
|
-
| `
|
|
1260
|
+
| Attribute | Type | Default | Description |
|
|
1261
|
+
| ------------------------- | ----------------------------------------------------------------- | ------- | ------------------------------------------------------ |
|
|
1262
|
+
| `variant` | `info \| success \| warning \| danger` | `info` | Visual style |
|
|
1263
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
1264
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
1265
|
+
| `dismissed` | boolean | `false` | Dismissed visual state |
|
|
1266
|
+
| `full-width` | boolean | `false` | Spans full container width |
|
|
1267
|
+
| `auto-dismiss` | number | — | Milliseconds before auto-dismissing |
|
|
1268
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
|
|
1249
1269
|
|
|
1250
1270
|
**Content projection** — an element with `slot="icon"` becomes the toast icon;
|
|
1251
1271
|
all other children become the toast body content.
|
|
@@ -1270,11 +1290,13 @@ tooltip recipe.
|
|
|
1270
1290
|
|
|
1271
1291
|
**Attributes**
|
|
1272
1292
|
|
|
1273
|
-
| Attribute | Type
|
|
1274
|
-
| ------------------------- |
|
|
1275
|
-
| `placement` | `top \| bottom \| left \| right`
|
|
1276
|
-
| `
|
|
1277
|
-
| `
|
|
1293
|
+
| Attribute | Type | Default | Description |
|
|
1294
|
+
| ------------------------- | ----------------------------------------------------------------- | ------- | ------------------------------------------------------ |
|
|
1295
|
+
| `placement` | `top \| bottom \| left \| right` | `top` | Tooltip position relative to trigger |
|
|
1296
|
+
| `accent` | `top \| right \| bottom \| left` | — | Optional decorative edge-rail; omitted renders no rail |
|
|
1297
|
+
| `accent-color` | `neutral \| brand \| info \| success \| warning \| danger \| cta` | `brand` | Accent rail color; only applied when `accent` is set |
|
|
1298
|
+
| `visible` | boolean | `false` | Visible/hidden tooltip state |
|
|
1299
|
+
| `id` / `title` / `aria-*` | string | — | Forwarded to the tooltip body |
|
|
1278
1300
|
|
|
1279
1301
|
**Content projection** — an element with `slot="tooltip"` becomes the tooltip
|
|
1280
1302
|
body; all other children become the trigger content.
|
|
@@ -1460,8 +1482,10 @@ Requires Node.js `^22.13.0 || >=24.0.0` and npm `12.0.2`.
|
|
|
1460
1482
|
| `npm run check` | Full validation (lint → typecheck → test → build → export, contract, invariant, and ecosystem checks) |
|
|
1461
1483
|
| `npm run build` | Compile ESM + CJS with declarations into `dist/` |
|
|
1462
1484
|
| `npm test` | Run Vitest suite under happy-dom |
|
|
1485
|
+
| `npm run test:browser` | Run native browser behavior regressions (also run in CI) |
|
|
1486
|
+
| `npm run test:visual` | Run opt-in screenshot regressions |
|
|
1463
1487
|
| `npm run lint` | ESLint |
|
|
1464
|
-
| `npm run check:exports` | Verify
|
|
1488
|
+
| `npm run check:exports` | Verify packed ESM/CommonJS entry points and declaration targets |
|
|
1465
1489
|
| `npm run check:contract` | Verify built exports match `components.contract.json` |
|
|
1466
1490
|
| `npm run check:invariants` | Verify light-DOM and no-hardcoded-visual invariants |
|
|
1467
1491
|
| `npm run check:ecosystem` | Validate `spectre.manifest.json` |
|
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","nothing"],"mappings":";;;;;;;AAMO,IAAM,iBAAA,GAAoB,CAAC,IAAA,EAAM,IAAA,EAAM,IAAI;AAG3C,SAAS,YAAY,KAAA,EAAiD;AAC3E,EAAA,OAAQ,iBAAA,CAAwC,SAAS,KAAe,CAAA;AAC1E;AAqEO,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AK,uBAAuB,CAAC,CAAA;AAAA,aAAA,EACjD,KAAK,YAAY,CAAA;AAAA;AAAA,UAAA,EAEpBA,sBAAA,CAAU,IAAA,CAAK,EAAA,IAAM,MAAS,CAAC,CAAA;AAAA;AAAA,aAAA,EAE5BA,sBAAA,CAAU,IAAA,CAAK,KAAA,IAAS,MAAS,CAAC,CAAA;AAAA;AAAA,MAAA,EAEzC,IAAA,CAAK,mBAAA,GAAsB,IAAA,CAAK,gBAAA,GAAmBC,WAAO;AAAA,UAAA,CAAA;AAAA,EAEhE;AACF;AAvGa,mBAAA,CAIJ,UAAA,GAAa;AAAA,EAClB,SAAA,EAAW,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EAC1C,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;AA8FK,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] 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/dom.ts","../src/utils/projectable.ts","../src/components/alert/sp-alert.ts"],"names":["LitElement","getAlertClasses","html","ifDefined","nothing"],"mappings":";;;;;;;AAMO,IAAM,iBAAA,GAAoB,CAAC,IAAA,EAAM,IAAA,EAAM,IAAI;AAG3C,SAAS,YAAY,KAAA,EAAiD;AAC3E,EAAA,OAAQ,iBAAA,CAAwC,SAAS,KAAe,CAAA;AAC1E;AAqEO,IAAM,oBAAA,GAAuB;AAAA,EAClC,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF;A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CAAK,EAAA,IAAM,MAAS,CAAC,CAAA;AAAA;AAAA,aAAA,EAE5BA,sBAAA,CAAU,IAAA,CAAK,KAAA,IAAS,MAAS,CAAC,CAAA;AAAA;AAAA,MAAA,EAEzC,IAAA,CAAK,mBAAA,GAAsB,IAAA,CAAK,gBAAA,GAAmBC,WAAO;AAAA,UAAA,CAAA;AAAA,EAEhE;AACF;AAvGa,mBAAA,CAIJ,UAAA,GAAa;AAAA,EAClB,SAAA,EAAW,EAAE,IAAA,EAAM,OAAA,EAAS,SAAS,IAAA,EAAK;AAAA,EAC1C,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;AA8FK,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] 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 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] 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"]}
|
package/dist/alert.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SpectreInputSize, a as SpectreAlertVariant } from './form-
|
|
2
|
-
export {
|
|
1
|
+
import { S as SpectreInputSize, a as SpectreAlertVariant } from './form-DpPtizpY.cjs';
|
|
2
|
+
export { D as spectreAlertSizes, E as spectreAlertVariants } from './form-DpPtizpY.cjs';
|
|
3
3
|
import * as lit_html from 'lit-html';
|
|
4
4
|
import { S as SpectreProjectableElement } from './projectable-DLOn6eaW.cjs';
|
|
5
5
|
import './base-D0s95V2v.cjs';
|
package/dist/alert.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SpectreInputSize, a as SpectreAlertVariant } from './form-
|
|
2
|
-
export {
|
|
1
|
+
import { S as SpectreInputSize, a as SpectreAlertVariant } from './form-DpPtizpY.js';
|
|
2
|
+
export { D as spectreAlertSizes, E as spectreAlertVariants } from './form-DpPtizpY.js';
|
|
3
3
|
import * as lit_html from 'lit-html';
|
|
4
4
|
import { S as SpectreProjectableElement } from './projectable-D9YCo9NY.js';
|
|
5
5
|
import './base-D0s95V2v.js';
|