@swisspost/design-system-components 1.6.3 → 1.7.1
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/dist/cjs/{check-non-empty-ae713942.js → check-non-empty-eeaa8f77.js} +4 -4
- package/dist/cjs/check-non-empty-eeaa8f77.js.map +1 -0
- package/dist/cjs/index-8c288b1a.js +45 -0
- package/dist/cjs/index-8c288b1a.js.map +1 -0
- package/dist/cjs/{index-b619e205.js → index-c07c0cdb.js} +144 -65
- package/dist/cjs/index-c07c0cdb.js.map +1 -0
- package/dist/cjs/index.cjs.js +17 -12
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/package-989e0b36.js +7 -0
- package/dist/cjs/package-989e0b36.js.map +1 -0
- package/dist/cjs/post-accordion-bc0c6f31.js +87 -0
- package/dist/cjs/post-accordion-bc0c6f31.js.map +1 -0
- package/dist/cjs/post-accordion.cjs.entry.js +4 -80
- package/dist/cjs/post-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/post-alert-39ac30a4.js +101 -0
- package/dist/cjs/{post-alert-b46943e0.js.map → post-alert-39ac30a4.js.map} +1 -1
- package/dist/cjs/post-alert.cjs.entry.js +5 -6
- package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/{post-collapsible-04364cda.js → post-collapsible-85f8ace5.js} +69 -69
- package/dist/cjs/{post-collapsible-04364cda.js.map → post-collapsible-85f8ace5.js.map} +1 -1
- package/dist/cjs/post-collapsible.cjs.entry.js +4 -5
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +3 -3
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon-53e50c15.js +105 -0
- package/dist/cjs/post-icon-53e50c15.js.map +1 -0
- package/dist/cjs/post-icon.cjs.entry.js +5 -6
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/post-popover-5a75c1b2.js +118 -0
- package/dist/cjs/post-popover-5a75c1b2.js.map +1 -0
- package/dist/cjs/post-popover.cjs.entry.js +13 -0
- package/dist/cjs/post-popover.cjs.entry.js.map +1 -0
- package/dist/cjs/post-popovercontainer-84378594.js +1878 -0
- package/dist/cjs/post-popovercontainer-84378594.js.map +1 -0
- package/dist/cjs/post-popovercontainer.cjs.entry.js +13 -0
- package/dist/cjs/post-popovercontainer.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tab-header-02c6e31e.js +33 -0
- package/dist/cjs/{post-tab-header-805c0a52.js.map → post-tab-header-02c6e31e.js.map} +1 -1
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -4
- package/dist/cjs/post-tab-panel-3973b707.js +27 -0
- package/dist/cjs/{post-tab-panel-caa44a77.js.map → post-tab-panel-3973b707.js.map} +1 -1
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/post-tabs-7a4fead7.js +153 -0
- package/dist/cjs/post-tabs-7a4fead7.js.map +1 -0
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/{post-tooltip-32a9c549.js → post-tooltip-79a9c96d.js} +78 -1754
- package/dist/cjs/post-tooltip-79a9c96d.js.map +1 -0
- package/dist/cjs/post-tooltip.cjs.entry.js +3 -4
- package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
- package/dist/collection/animations/collapse.js +5 -5
- package/dist/collection/animations/collapse.js.map +1 -1
- package/dist/collection/collection-manifest.json +5 -3
- package/dist/collection/components/post-accordion/post-accordion.js +167 -166
- package/dist/collection/components/post-accordion/post-accordion.js.map +1 -1
- package/dist/collection/components/post-alert/post-alert.css +2 -2
- package/dist/collection/components/post-alert/post-alert.js +246 -246
- package/dist/collection/components/post-alert/post-alert.js.map +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +169 -168
- package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
- package/dist/collection/components/post-icon/post-icon.css +1 -1
- package/dist/collection/components/post-icon/post-icon.js +250 -250
- package/dist/collection/components/post-icon/post-icon.js.map +1 -1
- package/dist/collection/components/post-popover/post-popover.css +3 -0
- package/dist/collection/components/post-popover/post-popover.js +267 -0
- package/dist/collection/components/post-popover/post-popover.js.map +1 -0
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -0
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +288 -0
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js.map +1 -0
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +62 -62
- package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +50 -50
- package/dist/collection/components/post-tab-panel/post-tab-panel.js.map +1 -1
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +224 -223
- package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +192 -325
- package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
- package/dist/collection/index.js +3 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utils/is-motion-reduced.js +1 -1
- package/dist/collection/utils/is-motion-reduced.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-non-empty.js +3 -3
- package/dist/collection/utils/property-checkers/check-non-empty.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-one-of.js +2 -2
- package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-pattern.js +2 -2
- package/dist/collection/utils/property-checkers/check-pattern.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-type.js +10 -10
- package/dist/collection/utils/property-checkers/check-type.js.map +1 -1
- package/dist/collection/utils/property-checkers/empty-or.js +5 -5
- package/dist/collection/utils/property-checkers/empty-or.js.map +1 -1
- package/dist/components/check-non-empty.js +3 -3
- package/dist/components/check-non-empty.js.map +1 -1
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +22 -18
- package/dist/components/index2.js.map +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion.d.ts +2 -2
- package/dist/components/post-accordion.js +1 -101
- package/dist/components/post-accordion.js.map +1 -1
- package/dist/components/post-accordion2.js +105 -0
- package/dist/components/post-accordion2.js.map +1 -0
- package/dist/components/post-alert.d.ts +2 -2
- package/dist/components/post-alert2.js +119 -119
- package/dist/components/post-alert2.js.map +1 -1
- package/dist/components/post-collapsible.d.ts +2 -2
- package/dist/components/post-collapsible2.js +90 -90
- package/dist/components/post-collapsible2.js.map +1 -1
- package/dist/components/post-icon.d.ts +2 -2
- package/dist/components/post-icon2.js +118 -118
- package/dist/components/post-icon2.js.map +1 -1
- package/dist/components/post-popover.d.ts +11 -0
- package/dist/components/post-popover.js +8 -0
- package/dist/components/post-popover.js.map +1 -0
- package/dist/components/post-popover2.js +144 -0
- package/dist/components/post-popover2.js.map +1 -0
- package/dist/components/post-popovercontainer.d.ts +11 -0
- package/dist/components/post-popovercontainer.js +8 -0
- package/dist/components/post-popovercontainer.js.map +1 -0
- package/dist/components/post-popovercontainer2.js +1897 -0
- package/dist/components/post-popovercontainer2.js.map +1 -0
- package/dist/components/post-tab-header.d.ts +2 -2
- package/dist/components/post-tab-header2.js +38 -38
- package/dist/components/post-tab-header2.js.map +1 -1
- package/dist/components/post-tab-panel.d.ts +2 -2
- package/dist/components/post-tab-panel2.js +30 -30
- package/dist/components/post-tab-panel2.js.map +1 -1
- package/dist/components/post-tabs.d.ts +2 -2
- package/dist/components/post-tabs2.js +147 -147
- package/dist/components/post-tabs2.js.map +1 -1
- package/dist/components/post-tooltip.d.ts +2 -2
- package/dist/components/post-tooltip2.js +100 -1774
- package/dist/components/post-tooltip2.js.map +1 -1
- package/dist/docs.d.ts +1 -21
- package/dist/docs.json +604 -77
- package/dist/esm/check-non-empty-58bd6b17.js +11 -0
- package/dist/esm/{check-non-empty-09c39561.js.map → check-non-empty-58bd6b17.js.map} +1 -1
- package/dist/esm/index-1427953c.js +40 -0
- package/dist/esm/index-1427953c.js.map +1 -0
- package/dist/esm/{index-4eff5fc5.js → index-35998e08.js} +144 -65
- package/dist/esm/index-35998e08.js.map +1 -0
- package/dist/esm/index.js +14 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-e13ef9ad.js +5 -0
- package/dist/esm/package-e13ef9ad.js.map +1 -0
- package/dist/esm/post-accordion-8e96598a.js +85 -0
- package/dist/esm/post-accordion-8e96598a.js.map +1 -0
- package/dist/esm/post-accordion.entry.js +3 -83
- package/dist/esm/post-accordion.entry.js.map +1 -1
- package/dist/esm/post-alert-5e352303.js +99 -0
- package/dist/esm/{post-alert-e457e249.js.map → post-alert-5e352303.js.map} +1 -1
- package/dist/esm/post-alert.entry.js +5 -6
- package/dist/esm/post-alert.entry.js.map +1 -1
- package/dist/esm/{post-collapsible-c0a826b2.js → post-collapsible-3cc5dd87.js} +69 -69
- package/dist/esm/{post-collapsible-c0a826b2.js.map → post-collapsible-3cc5dd87.js.map} +1 -1
- package/dist/esm/post-collapsible.entry.js +4 -5
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +4 -4
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon-fdda3f99.js +103 -0
- package/dist/esm/post-icon-fdda3f99.js.map +1 -0
- package/dist/esm/post-icon.entry.js +5 -6
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/esm/post-popover-ff2c259f.js +116 -0
- package/dist/esm/post-popover-ff2c259f.js.map +1 -0
- package/dist/esm/post-popover.entry.js +5 -0
- package/dist/esm/post-popover.entry.js.map +1 -0
- package/dist/esm/post-popovercontainer-f4cd18cd.js +1876 -0
- package/dist/esm/post-popovercontainer-f4cd18cd.js.map +1 -0
- package/dist/esm/post-popovercontainer.entry.js +5 -0
- package/dist/esm/post-popovercontainer.entry.js.map +1 -0
- package/dist/esm/post-tab-header-486b267b.js +31 -0
- package/dist/esm/{post-tab-header-f0c355d6.js.map → post-tab-header-486b267b.js.map} +1 -1
- package/dist/esm/post-tab-header.entry.js +4 -4
- package/dist/esm/post-tab-panel-13940300.js +25 -0
- package/dist/esm/{post-tab-panel-46f02247.js.map → post-tab-panel-13940300.js.map} +1 -1
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/post-tabs-6f44ed1d.js +151 -0
- package/dist/esm/post-tabs-6f44ed1d.js.map +1 -0
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/{post-tooltip-fa7b4a0a.js → post-tooltip-1d99cd0c.js} +78 -1754
- package/dist/esm/post-tooltip-1d99cd0c.js.map +1 -0
- package/dist/esm/post-tooltip.entry.js +3 -4
- package/dist/esm/post-tooltip.entry.js.map +1 -1
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-169b8ef7.entry.js +2 -0
- package/dist/post-components/p-28be44d7.js +2 -0
- package/dist/post-components/{p-8b6fe20d.js.map → p-28be44d7.js.map} +1 -1
- package/dist/post-components/p-3ef3a1d2.js +2 -0
- package/dist/post-components/p-3ef3a1d2.js.map +1 -0
- package/dist/post-components/p-4b94c2a1.entry.js +2 -0
- package/dist/post-components/p-4cbb5212.entry.js +2 -0
- package/dist/post-components/p-51ae6f46.entry.js +2 -0
- package/dist/post-components/p-668bf58c.entry.js +2 -0
- package/dist/post-components/p-67d0a4fa.entry.js +2 -0
- package/dist/post-components/p-6b3a5063.entry.js +2 -0
- package/dist/post-components/{p-3604be27.js → p-6cdc82c6.js} +2 -2
- package/dist/post-components/p-723336f2.js +2 -0
- package/dist/post-components/{p-ca1e407c.js.map → p-723336f2.js.map} +1 -1
- package/dist/post-components/p-7d08e4f1.js +2 -0
- package/dist/post-components/p-7d08e4f1.js.map +1 -0
- package/dist/post-components/p-81591ad0.js +3 -0
- package/dist/post-components/p-81591ad0.js.map +1 -0
- package/dist/post-components/p-96f4ebc4.js +2 -0
- package/dist/post-components/p-96f4ebc4.js.map +1 -0
- package/dist/post-components/p-9b1b6e06.entry.js +2 -0
- package/dist/post-components/{p-9f71d450.js → p-a5a23448.js} +2 -2
- package/dist/post-components/p-aca6e9c1.js +2 -0
- package/dist/post-components/{p-fffce1d7.js.map → p-aca6e9c1.js.map} +1 -1
- package/dist/post-components/{p-b531475e.js → p-b095519d.js} +1 -1
- package/dist/post-components/p-bc27f061.js +9 -0
- package/dist/post-components/p-bc27f061.js.map +1 -0
- package/dist/post-components/p-bd1d0117.js +2 -0
- package/dist/post-components/p-bd1d0117.js.map +1 -0
- package/dist/post-components/p-d3ed113e.js +2 -0
- package/dist/post-components/p-d3ed113e.js.map +1 -0
- package/dist/post-components/p-d8365401.entry.js +2 -0
- package/dist/post-components/p-d8365401.entry.js.map +1 -0
- package/dist/post-components/p-e78d158d.entry.js +2 -0
- package/dist/post-components/p-e78d158d.entry.js.map +1 -0
- package/dist/post-components/{p-7b8797c6.entry.js → p-f695aab4.js} +2 -2
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/components/post-accordion/post-accordion.d.ts +26 -26
- package/dist/types/components/post-alert/post-alert.d.ts +45 -45
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +31 -31
- package/dist/types/components/post-icon/post-icon.d.ts +43 -43
- package/dist/types/components/post-popover/post-popover.d.ts +53 -0
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +62 -0
- package/dist/types/components/post-tab-header/post-tab-header.d.ts +9 -9
- package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +8 -8
- package/dist/types/components/post-tabs/post-tabs.d.ts +32 -32
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +35 -62
- package/dist/types/components.d.ts +115 -10
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/package.json +15 -13
- package/dist/cjs/check-non-empty-ae713942.js.map +0 -1
- package/dist/cjs/check-one-of-27ad3154.js +0 -10
- package/dist/cjs/check-one-of-27ad3154.js.map +0 -1
- package/dist/cjs/index-b38a23e0.js +0 -41
- package/dist/cjs/index-b38a23e0.js.map +0 -1
- package/dist/cjs/index-b619e205.js.map +0 -1
- package/dist/cjs/package-4e9ab85c.js +0 -7
- package/dist/cjs/package-4e9ab85c.js.map +0 -1
- package/dist/cjs/post-alert-b46943e0.js +0 -101
- package/dist/cjs/post-icon-5b36814e.js +0 -105
- package/dist/cjs/post-icon-5b36814e.js.map +0 -1
- package/dist/cjs/post-tab-header-805c0a52.js +0 -33
- package/dist/cjs/post-tab-panel-caa44a77.js +0 -27
- package/dist/cjs/post-tabs-29d4dc70.js +0 -153
- package/dist/cjs/post-tabs-29d4dc70.js.map +0 -1
- package/dist/cjs/post-tooltip-32a9c549.js.map +0 -1
- package/dist/components/check-one-of.js +0 -8
- package/dist/components/check-one-of.js.map +0 -1
- package/dist/esm/check-non-empty-09c39561.js +0 -11
- package/dist/esm/check-one-of-74750af9.js +0 -8
- package/dist/esm/check-one-of-74750af9.js.map +0 -1
- package/dist/esm/index-35921354.js +0 -36
- package/dist/esm/index-35921354.js.map +0 -1
- package/dist/esm/index-4eff5fc5.js.map +0 -1
- package/dist/esm/package-b9b10dd3.js +0 -5
- package/dist/esm/package-b9b10dd3.js.map +0 -1
- package/dist/esm/post-alert-e457e249.js +0 -99
- package/dist/esm/post-icon-b34da686.js +0 -103
- package/dist/esm/post-icon-b34da686.js.map +0 -1
- package/dist/esm/post-tab-header-f0c355d6.js +0 -31
- package/dist/esm/post-tab-panel-46f02247.js +0 -25
- package/dist/esm/post-tabs-5dd55290.js +0 -151
- package/dist/esm/post-tabs-5dd55290.js.map +0 -1
- package/dist/esm/post-tooltip-fa7b4a0a.js.map +0 -1
- package/dist/post-components/p-1339f8cd.js +0 -2
- package/dist/post-components/p-1339f8cd.js.map +0 -1
- package/dist/post-components/p-195b8c88.entry.js +0 -2
- package/dist/post-components/p-3225e008.entry.js +0 -2
- package/dist/post-components/p-61ffffa9.entry.js +0 -2
- package/dist/post-components/p-88262544.js +0 -2
- package/dist/post-components/p-8b6fe20d.js +0 -2
- package/dist/post-components/p-a7649277.js +0 -3
- package/dist/post-components/p-a7649277.js.map +0 -1
- package/dist/post-components/p-a7c78dea.entry.js +0 -2
- package/dist/post-components/p-b2c3ed97.entry.js +0 -2
- package/dist/post-components/p-ba9aba3a.entry.js +0 -2
- package/dist/post-components/p-bd293ff3.entry.js +0 -2
- package/dist/post-components/p-ca1e407c.js +0 -2
- package/dist/post-components/p-d407b1c3.js +0 -2
- package/dist/post-components/p-d407b1c3.js.map +0 -1
- package/dist/post-components/p-dfe29f7f.js +0 -2
- package/dist/post-components/p-dfe29f7f.js.map +0 -1
- package/dist/post-components/p-fd7015ae.js +0 -9
- package/dist/post-components/p-fd7015ae.js.map +0 -1
- package/dist/post-components/p-fffce1d7.js +0 -2
- /package/dist/post-components/{p-195b8c88.entry.js.map → p-169b8ef7.entry.js.map} +0 -0
- /package/dist/post-components/{p-3225e008.entry.js.map → p-4b94c2a1.entry.js.map} +0 -0
- /package/dist/post-components/{p-61ffffa9.entry.js.map → p-4cbb5212.entry.js.map} +0 -0
- /package/dist/post-components/{p-88262544.js.map → p-51ae6f46.entry.js.map} +0 -0
- /package/dist/post-components/{p-a7c78dea.entry.js.map → p-668bf58c.entry.js.map} +0 -0
- /package/dist/post-components/{p-b2c3ed97.entry.js.map → p-67d0a4fa.entry.js.map} +0 -0
- /package/dist/post-components/{p-ba9aba3a.entry.js.map → p-6b3a5063.entry.js.map} +0 -0
- /package/dist/post-components/{p-3604be27.js.map → p-6cdc82c6.js.map} +0 -0
- /package/dist/post-components/{p-bd293ff3.entry.js.map → p-9b1b6e06.entry.js.map} +0 -0
- /package/dist/post-components/{p-9f71d450.js.map → p-a5a23448.js.map} +0 -0
- /package/dist/post-components/{p-b531475e.js.map → p-b095519d.js.map} +0 -0
- /package/dist/post-components/{p-7b8797c6.entry.js.map → p-f695aab4.js.map} +0 -0
|
@@ -4,254 +4,254 @@ import { fadeOut } from "../../animations";
|
|
|
4
4
|
import { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from "../../utils";
|
|
5
5
|
import { ALERT_TYPES } from "./alert-types";
|
|
6
6
|
export class PostAlert {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
validateDismissible(isDismissible = this.dismissible) {
|
|
20
|
-
checkType(isDismissible, 'boolean', 'The post-alert "dismissible" prop should be a boolean.');
|
|
21
|
-
setTimeout(() => this.validateDismissLabel());
|
|
22
|
-
}
|
|
23
|
-
validateDismissLabel(dismissLabel = this.dismissLabel) {
|
|
24
|
-
if (this.dismissible) {
|
|
25
|
-
checkNonEmpty(dismissLabel, 'Dismissible post-alert\'s require a "dismiss-label" prop.');
|
|
7
|
+
constructor() {
|
|
8
|
+
this.alertId = crypto.randomUUID();
|
|
9
|
+
this.classes = undefined;
|
|
10
|
+
this.hasActions = undefined;
|
|
11
|
+
this.hasHeading = undefined;
|
|
12
|
+
this.onDismissButtonClick = () => this.dismiss();
|
|
13
|
+
this.dismissible = false;
|
|
14
|
+
this.dismissLabel = undefined;
|
|
15
|
+
this.fixed = false;
|
|
16
|
+
this.icon = undefined;
|
|
17
|
+
this.type = 'primary';
|
|
26
18
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
validateType(type = this.type) {
|
|
35
|
-
checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);
|
|
36
|
-
}
|
|
37
|
-
connectedCallback() {
|
|
38
|
-
this.validateDismissible();
|
|
39
|
-
this.validateFixed();
|
|
40
|
-
this.validateIcon();
|
|
41
|
-
this.validateType();
|
|
42
|
-
}
|
|
43
|
-
componentWillRender() {
|
|
44
|
-
var _a;
|
|
45
|
-
this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;
|
|
46
|
-
this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;
|
|
47
|
-
this.classes = `alert alert-${(_a = this.type) !== null && _a !== void 0 ? _a : 'primary'}`;
|
|
48
|
-
if (this.dismissible)
|
|
49
|
-
this.classes += ' alert-dismissible';
|
|
50
|
-
if (this.hasActions)
|
|
51
|
-
this.classes += ' alert-action';
|
|
52
|
-
if (this.fixed)
|
|
53
|
-
this.classes += ' alert-fixed-bottom';
|
|
54
|
-
if (this.icon === 'none')
|
|
55
|
-
this.classes += ' no-icon';
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Triggers alert dismissal programmatically (same as clicking on the close button (×)).
|
|
59
|
-
*/
|
|
60
|
-
async dismiss() {
|
|
61
|
-
const dismissal = fadeOut(this.host);
|
|
62
|
-
await dismissal.finished;
|
|
63
|
-
this.host.remove();
|
|
64
|
-
this.dismissed.emit();
|
|
65
|
-
}
|
|
66
|
-
render() {
|
|
67
|
-
const defaultAlertContent = [
|
|
68
|
-
this.hasHeading && (h("div", { key: `${this.alertId}-heading`, class: "alert-heading" }, h("slot", { name: "heading" }))),
|
|
69
|
-
h("slot", { key: `${this.alertId}-message` })
|
|
70
|
-
];
|
|
71
|
-
const actionAlertContent = [
|
|
72
|
-
h("div", { key: `${this.alertId}-content`, class: "alert-content" }, defaultAlertContent),
|
|
73
|
-
h("div", { key: `${this.alertId}-buttons`, class: "alert-buttons" }, h("slot", { name: "actions" })),
|
|
74
|
-
];
|
|
75
|
-
return (h(Host, { "data-version": version }, h("div", { role: "alert", class: this.classes }, this.dismissible && (h("button", { class: "btn-close", onClick: this.onDismissButtonClick }, h("span", { class: "visually-hidden" }, this.dismissLabel))), this.icon && this.icon !== 'none' && (h("post-icon", { key: `${this.alertId}-icon`, name: this.icon })), this.hasActions
|
|
76
|
-
? actionAlertContent
|
|
77
|
-
: defaultAlertContent)));
|
|
78
|
-
}
|
|
79
|
-
static get is() { return "post-alert"; }
|
|
80
|
-
static get encapsulation() { return "shadow"; }
|
|
81
|
-
static get originalStyleUrls() {
|
|
82
|
-
return {
|
|
83
|
-
"$": ["post-alert.scss"]
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
static get styleUrls() {
|
|
87
|
-
return {
|
|
88
|
-
"$": ["post-alert.css"]
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
static get properties() {
|
|
92
|
-
return {
|
|
93
|
-
"dismissible": {
|
|
94
|
-
"type": "boolean",
|
|
95
|
-
"mutable": false,
|
|
96
|
-
"complexType": {
|
|
97
|
-
"original": "boolean",
|
|
98
|
-
"resolved": "boolean",
|
|
99
|
-
"references": {}
|
|
100
|
-
},
|
|
101
|
-
"required": false,
|
|
102
|
-
"optional": false,
|
|
103
|
-
"docs": {
|
|
104
|
-
"tags": [],
|
|
105
|
-
"text": "If `true`, a close button (\u00D7) is displayed and the alert can be dismissed by the user."
|
|
106
|
-
},
|
|
107
|
-
"attribute": "dismissible",
|
|
108
|
-
"reflect": false,
|
|
109
|
-
"defaultValue": "false"
|
|
110
|
-
},
|
|
111
|
-
"dismissLabel": {
|
|
112
|
-
"type": "string",
|
|
113
|
-
"mutable": false,
|
|
114
|
-
"complexType": {
|
|
115
|
-
"original": "string",
|
|
116
|
-
"resolved": "string",
|
|
117
|
-
"references": {}
|
|
118
|
-
},
|
|
119
|
-
"required": false,
|
|
120
|
-
"optional": false,
|
|
121
|
-
"docs": {
|
|
122
|
-
"tags": [],
|
|
123
|
-
"text": "The label to use for the close button of a dismissible alert."
|
|
124
|
-
},
|
|
125
|
-
"attribute": "dismiss-label",
|
|
126
|
-
"reflect": false
|
|
127
|
-
},
|
|
128
|
-
"fixed": {
|
|
129
|
-
"type": "boolean",
|
|
130
|
-
"mutable": false,
|
|
131
|
-
"complexType": {
|
|
132
|
-
"original": "boolean",
|
|
133
|
-
"resolved": "boolean",
|
|
134
|
-
"references": {}
|
|
135
|
-
},
|
|
136
|
-
"required": false,
|
|
137
|
-
"optional": false,
|
|
138
|
-
"docs": {
|
|
139
|
-
"tags": [],
|
|
140
|
-
"text": "If `true`, the alert is positioned at the bottom of the window, from edge to edge."
|
|
141
|
-
},
|
|
142
|
-
"attribute": "fixed",
|
|
143
|
-
"reflect": false,
|
|
144
|
-
"defaultValue": "false"
|
|
145
|
-
},
|
|
146
|
-
"icon": {
|
|
147
|
-
"type": "string",
|
|
148
|
-
"mutable": false,
|
|
149
|
-
"complexType": {
|
|
150
|
-
"original": "string",
|
|
151
|
-
"resolved": "string",
|
|
152
|
-
"references": {}
|
|
153
|
-
},
|
|
154
|
-
"required": false,
|
|
155
|
-
"optional": false,
|
|
156
|
-
"docs": {
|
|
157
|
-
"tags": [],
|
|
158
|
-
"text": "The icon to display in the alert. By default, the icon depends on the alert type.\n\nIf `none`, no icon is displayed."
|
|
159
|
-
},
|
|
160
|
-
"attribute": "icon",
|
|
161
|
-
"reflect": false
|
|
162
|
-
},
|
|
163
|
-
"type": {
|
|
164
|
-
"type": "string",
|
|
165
|
-
"mutable": false,
|
|
166
|
-
"complexType": {
|
|
167
|
-
"original": "AlertType",
|
|
168
|
-
"resolved": "\"danger\" | \"gray\" | \"info\" | \"primary\" | \"success\" | \"warning\"",
|
|
169
|
-
"references": {
|
|
170
|
-
"AlertType": {
|
|
171
|
-
"location": "import",
|
|
172
|
-
"path": "./alert-types",
|
|
173
|
-
"id": "src/components/post-alert/alert-types.ts::AlertType"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
"required": false,
|
|
178
|
-
"optional": false,
|
|
179
|
-
"docs": {
|
|
180
|
-
"tags": [],
|
|
181
|
-
"text": "The type of the alert."
|
|
182
|
-
},
|
|
183
|
-
"attribute": "type",
|
|
184
|
-
"reflect": false,
|
|
185
|
-
"defaultValue": "'primary'"
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
static get states() {
|
|
190
|
-
return {
|
|
191
|
-
"alertId": {},
|
|
192
|
-
"classes": {},
|
|
193
|
-
"hasActions": {},
|
|
194
|
-
"hasHeading": {},
|
|
195
|
-
"onDismissButtonClick": {}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
static get events() {
|
|
199
|
-
return [{
|
|
200
|
-
"method": "dismissed",
|
|
201
|
-
"name": "dismissed",
|
|
202
|
-
"bubbles": true,
|
|
203
|
-
"cancelable": true,
|
|
204
|
-
"composed": true,
|
|
205
|
-
"docs": {
|
|
206
|
-
"tags": [],
|
|
207
|
-
"text": "An event emitted when the alert element is dismissed, after the transition.\nIt has no payload and only relevant for dismissible alerts."
|
|
208
|
-
},
|
|
209
|
-
"complexType": {
|
|
210
|
-
"original": "void",
|
|
211
|
-
"resolved": "void",
|
|
212
|
-
"references": {}
|
|
19
|
+
validateDismissible(isDismissible = this.dismissible) {
|
|
20
|
+
checkType(isDismissible, 'boolean', 'The post-alert "dismissible" prop should be a boolean.');
|
|
21
|
+
setTimeout(() => this.validateDismissLabel());
|
|
22
|
+
}
|
|
23
|
+
validateDismissLabel(dismissLabel = this.dismissLabel) {
|
|
24
|
+
if (this.dismissible) {
|
|
25
|
+
checkNonEmpty(dismissLabel, 'Dismissible post-alert\'s require a "dismiss-label" prop.');
|
|
213
26
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
"
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
27
|
+
}
|
|
28
|
+
validateFixed(isFixed = this.fixed) {
|
|
29
|
+
checkType(isFixed, 'boolean', 'The post-alert "fixed" prop should be a boolean.');
|
|
30
|
+
}
|
|
31
|
+
validateIcon(icon = this.icon) {
|
|
32
|
+
checkEmptyOrPattern(icon, /\d{4}|none/, 'The post-alert "icon" prop should be a 4-digits string.');
|
|
33
|
+
}
|
|
34
|
+
validateType(type = this.type) {
|
|
35
|
+
checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
this.validateDismissible();
|
|
39
|
+
this.validateFixed();
|
|
40
|
+
this.validateIcon();
|
|
41
|
+
this.validateType();
|
|
42
|
+
}
|
|
43
|
+
componentWillRender() {
|
|
44
|
+
var _a;
|
|
45
|
+
this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;
|
|
46
|
+
this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;
|
|
47
|
+
this.classes = `alert alert-${(_a = this.type) !== null && _a !== void 0 ? _a : 'primary'}`;
|
|
48
|
+
if (this.dismissible)
|
|
49
|
+
this.classes += ' alert-dismissible';
|
|
50
|
+
if (this.hasActions)
|
|
51
|
+
this.classes += ' alert-action';
|
|
52
|
+
if (this.fixed)
|
|
53
|
+
this.classes += ' alert-fixed-bottom';
|
|
54
|
+
if (this.icon === 'none')
|
|
55
|
+
this.classes += ' no-icon';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Triggers alert dismissal programmatically (same as clicking on the close button (×)).
|
|
59
|
+
*/
|
|
60
|
+
async dismiss() {
|
|
61
|
+
const dismissal = fadeOut(this.host);
|
|
62
|
+
await dismissal.finished;
|
|
63
|
+
this.host.remove();
|
|
64
|
+
this.dismissed.emit();
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const defaultAlertContent = [
|
|
68
|
+
this.hasHeading && (h("div", { key: `${this.alertId}-heading`, class: "alert-heading" }, h("slot", { name: "heading" }))),
|
|
69
|
+
h("slot", { key: `${this.alertId}-message` })
|
|
70
|
+
];
|
|
71
|
+
const actionAlertContent = [
|
|
72
|
+
h("div", { key: `${this.alertId}-content`, class: "alert-content" }, defaultAlertContent),
|
|
73
|
+
h("div", { key: `${this.alertId}-buttons`, class: "alert-buttons" }, h("slot", { name: "actions" })),
|
|
74
|
+
];
|
|
75
|
+
return (h(Host, { "data-version": version }, h("div", { role: "alert", class: this.classes }, this.dismissible && (h("button", { class: "btn-close", onClick: this.onDismissButtonClick }, h("span", { class: "visually-hidden" }, this.dismissLabel))), this.icon && this.icon !== 'none' && (h("post-icon", { key: `${this.alertId}-icon`, name: this.icon })), this.hasActions
|
|
76
|
+
? actionAlertContent
|
|
77
|
+
: defaultAlertContent)));
|
|
78
|
+
}
|
|
79
|
+
static get is() { return "post-alert"; }
|
|
80
|
+
static get encapsulation() { return "shadow"; }
|
|
81
|
+
static get originalStyleUrls() {
|
|
82
|
+
return {
|
|
83
|
+
"$": ["post-alert.scss"]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
static get styleUrls() {
|
|
87
|
+
return {
|
|
88
|
+
"$": ["post-alert.css"]
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static get properties() {
|
|
92
|
+
return {
|
|
93
|
+
"dismissible": {
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "boolean",
|
|
98
|
+
"resolved": "boolean",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": "If `true`, a close button (\u00D7) is displayed and the alert can be dismissed by the user."
|
|
106
|
+
},
|
|
107
|
+
"attribute": "dismissible",
|
|
108
|
+
"reflect": false,
|
|
109
|
+
"defaultValue": "false"
|
|
110
|
+
},
|
|
111
|
+
"dismissLabel": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "string",
|
|
116
|
+
"resolved": "string",
|
|
117
|
+
"references": {}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": false,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": "The label to use for the close button of a dismissible alert."
|
|
124
|
+
},
|
|
125
|
+
"attribute": "dismiss-label",
|
|
126
|
+
"reflect": false
|
|
127
|
+
},
|
|
128
|
+
"fixed": {
|
|
129
|
+
"type": "boolean",
|
|
130
|
+
"mutable": false,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "boolean",
|
|
133
|
+
"resolved": "boolean",
|
|
134
|
+
"references": {}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": false,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": "If `true`, the alert is positioned at the bottom of the window, from edge to edge."
|
|
141
|
+
},
|
|
142
|
+
"attribute": "fixed",
|
|
143
|
+
"reflect": false,
|
|
144
|
+
"defaultValue": "false"
|
|
145
|
+
},
|
|
146
|
+
"icon": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "string",
|
|
151
|
+
"resolved": "string",
|
|
152
|
+
"references": {}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": "The icon to display in the alert. By default, the icon depends on the alert type.\n\nIf `none`, no icon is displayed."
|
|
159
|
+
},
|
|
160
|
+
"attribute": "icon",
|
|
161
|
+
"reflect": false
|
|
162
|
+
},
|
|
163
|
+
"type": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "AlertType",
|
|
168
|
+
"resolved": "\"danger\" | \"gray\" | \"info\" | \"primary\" | \"success\" | \"warning\"",
|
|
169
|
+
"references": {
|
|
170
|
+
"AlertType": {
|
|
171
|
+
"location": "import",
|
|
172
|
+
"path": "./alert-types",
|
|
173
|
+
"id": "src/components/post-alert/alert-types.ts::AlertType"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "The type of the alert."
|
|
182
|
+
},
|
|
183
|
+
"attribute": "type",
|
|
184
|
+
"reflect": false,
|
|
185
|
+
"defaultValue": "'primary'"
|
|
226
186
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
static get states() {
|
|
190
|
+
return {
|
|
191
|
+
"alertId": {},
|
|
192
|
+
"classes": {},
|
|
193
|
+
"hasActions": {},
|
|
194
|
+
"hasHeading": {},
|
|
195
|
+
"onDismissButtonClick": {}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
static get events() {
|
|
199
|
+
return [{
|
|
200
|
+
"method": "dismissed",
|
|
201
|
+
"name": "dismissed",
|
|
202
|
+
"bubbles": true,
|
|
203
|
+
"cancelable": true,
|
|
204
|
+
"composed": true,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": "An event emitted when the alert element is dismissed, after the transition.\nIt has no payload and only relevant for dismissible alerts."
|
|
208
|
+
},
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "void",
|
|
211
|
+
"resolved": "void",
|
|
212
|
+
"references": {}
|
|
213
|
+
}
|
|
214
|
+
}];
|
|
215
|
+
}
|
|
216
|
+
static get methods() {
|
|
217
|
+
return {
|
|
218
|
+
"dismiss": {
|
|
219
|
+
"complexType": {
|
|
220
|
+
"signature": "() => Promise<void>",
|
|
221
|
+
"parameters": [],
|
|
222
|
+
"references": {
|
|
223
|
+
"Promise": {
|
|
224
|
+
"location": "global",
|
|
225
|
+
"id": "global::Promise"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"return": "Promise<void>"
|
|
229
|
+
},
|
|
230
|
+
"docs": {
|
|
231
|
+
"text": "Triggers alert dismissal programmatically (same as clicking on the close button (\u00D7)).",
|
|
232
|
+
"tags": []
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
static get elementRef() { return "host"; }
|
|
238
|
+
static get watchers() {
|
|
239
|
+
return [{
|
|
240
|
+
"propName": "dismissible",
|
|
241
|
+
"methodName": "validateDismissible"
|
|
242
|
+
}, {
|
|
243
|
+
"propName": "dismissLabel",
|
|
244
|
+
"methodName": "validateDismissLabel"
|
|
245
|
+
}, {
|
|
246
|
+
"propName": "fixed",
|
|
247
|
+
"methodName": "validateFixed"
|
|
248
|
+
}, {
|
|
249
|
+
"propName": "icon",
|
|
250
|
+
"methodName": "validateIcon"
|
|
251
|
+
}, {
|
|
252
|
+
"propName": "type",
|
|
253
|
+
"methodName": "validateType"
|
|
254
|
+
}];
|
|
255
|
+
}
|
|
256
256
|
}
|
|
257
257
|
//# sourceMappingURL=post-alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-alert.js","sourceRoot":"","sources":["../../../../src/components/post-alert/post-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,OAAO,EAAE,MA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gBAEA,IAAI,CAAC,UAAU;oBACd,CAAC,CAAC,kBAAkB;oBACpB,CAAC,CAAC,mBAAmB,CAEnB,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeOut } from '../../animations';\nimport { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from '../../utils';\nimport { ALERT_TYPES, AlertType } from './alert-types';\n\n@Component({\n tag: 'post-alert',\n styleUrl: 'post-alert.scss',\n shadow: true,\n})\nexport class PostAlert {\n @Element() host: HTMLPostAlertElement;\n\n @State() alertId = crypto.randomUUID();\n @State() classes: string;\n @State() hasActions: boolean;\n @State() hasHeading: boolean;\n @State() onDismissButtonClick = () => this.dismiss();\n\n /**\n * If `true`, a close button (×) is displayed and the alert can be dismissed by the user.\n */\n @Prop() readonly dismissible: boolean = false;\n\n @Watch('dismissible')\n validateDismissible(isDismissible = this.dismissible) {\n checkType(isDismissible, 'boolean', 'The post-alert \"dismissible\" prop should be a boolean.');\n setTimeout(() => this.validateDismissLabel());\n }\n\n /**\n * The label to use for the close button of a dismissible alert.\n */\n @Prop() readonly dismissLabel: string;\n\n @Watch('dismissLabel')\n validateDismissLabel(dismissLabel = this.dismissLabel) {\n if (this.dismissible) {\n checkNonEmpty(dismissLabel, 'Dismissible post-alert\\'s require a \"dismiss-label\" prop.');\n }\n }\n\n /**\n * If `true`, the alert is positioned at the bottom of the window, from edge to edge.\n */\n @Prop() readonly fixed: boolean = false;\n\n @Watch('fixed')\n validateFixed(isFixed = this.fixed) {\n checkType(isFixed, 'boolean', 'The post-alert \"fixed\" prop should be a boolean.');\n }\n\n /**\n * The icon to display in the alert. By default, the icon depends on the alert type.\n *\n * If `none`, no icon is displayed.\n */\n @Prop() readonly icon: string;\n\n @Watch('icon')\n validateIcon(icon = this.icon) {\n checkEmptyOrPattern(icon, /\\d{4}|none/, 'The post-alert \"icon\" prop should be a 4-digits string.');\n }\n\n /**\n * The type of the alert.\n */\n @Prop() readonly type: AlertType = 'primary';\n\n @Watch('type')\n validateType(type = this.type) {\n checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);\n }\n\n /**\n * An event emitted when the alert element is dismissed, after the transition.\n * It has no payload and only relevant for dismissible alerts.\n */\n @Event() dismissed: EventEmitter<void>;\n\n connectedCallback() {\n this.validateDismissible();\n this.validateFixed();\n this.validateIcon();\n this.validateType();\n }\n\n componentWillRender() {\n this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;\n this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;\n\n this.classes = `alert alert-${this.type ?? 'primary'}`;\n if (this.dismissible) this.classes += ' alert-dismissible';\n if (this.hasActions) this.classes += ' alert-action';\n if (this.fixed) this.classes += ' alert-fixed-bottom';\n if (this.icon === 'none') this.classes += ' no-icon';\n }\n\n /**\n * Triggers alert dismissal programmatically (same as clicking on the close button (×)).\n */\n @Method()\n async dismiss() {\n const dismissal = fadeOut(this.host);\n\n await dismissal.finished;\n\n this.host.remove();\n this.dismissed.emit();\n }\n\n render() {\n const defaultAlertContent = [\n this.hasHeading && (\n <div key={`${this.alertId}-heading`} class=\"alert-heading\">\n <slot name=\"heading\"/>\n </div>\n ),\n <slot key={`${this.alertId}-message`}/>\n ];\n\n const actionAlertContent = [\n <div key={`${this.alertId}-content`} class=\"alert-content\">\n {defaultAlertContent}\n </div>,\n <div key={`${this.alertId}-buttons`} class=\"alert-buttons\">\n <slot name=\"actions\"/>\n </div>,\n ];\n\n return (\n <Host data-version={version}>\n <div role=\"alert\" class={this.classes}>\n {this.dismissible && (\n <button class=\"btn-close\" onClick={this.onDismissButtonClick}>\n <span class=\"visually-hidden\">{this.dismissLabel}</span>\n </button>\n )}\n\n {this.icon && this.icon !== 'none' && (\n <post-icon key={`${this.alertId}-icon`} name={this.icon} />\n )}\n\n {this.hasActions\n ? actionAlertContent\n : defaultAlertContent\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
|