@swisspost/design-system-components 1.5.1 → 1.6.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 +13 -0
- package/dist/cjs/check-non-empty-ae713942.js.map +1 -0
- package/dist/cjs/{check-one-of-4c2e8b2e.js → check-one-of-27ad3154.js} +1 -1
- package/dist/cjs/check-one-of-27ad3154.js.map +1 -0
- package/dist/cjs/constants-238701d3.js +7 -0
- package/dist/cjs/constants-238701d3.js.map +1 -0
- package/dist/cjs/fade-35a3633a.js +12 -0
- package/dist/cjs/fade-35a3633a.js.map +1 -0
- package/dist/cjs/index-b38a23e0.js +41 -0
- package/dist/cjs/index-b38a23e0.js.map +1 -0
- package/dist/cjs/{index-12cc37c9.js → index-b619e205.js} +245 -41
- package/dist/cjs/index-b619e205.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -12
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/package-bd70f73c.js +7 -0
- package/dist/cjs/package-bd70f73c.js.map +1 -0
- package/dist/cjs/post-accordion.cjs.entry.js +89 -0
- package/dist/cjs/post-accordion.cjs.entry.js.map +1 -0
- package/dist/cjs/post-alert.cjs.entry.js +10 -10
- package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/post-collapsible.cjs.entry.js +49 -80
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +3 -6
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon.cjs.entry.js +7 -7
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-header.cjs.entry.js +5 -4
- package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/post-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
- package/dist/collection/animations/collapse.js +13 -0
- package/dist/collection/animations/collapse.js.map +1 -0
- package/dist/collection/animations/fade.js +4 -4
- package/dist/collection/animations/fade.js.map +1 -1
- package/dist/collection/collection-manifest.json +10 -9
- package/dist/collection/components/post-accordion/post-accordion.css +1 -0
- package/dist/collection/components/post-accordion/post-accordion.js +178 -0
- package/dist/collection/components/post-accordion/post-accordion.js.map +1 -0
- package/dist/collection/components/post-alert/post-alert.css +1 -1
- package/dist/collection/components/post-alert/post-alert.js +9 -7
- package/dist/collection/components/post-alert/post-alert.js.map +1 -1
- package/dist/collection/components/post-collapsible/heading-levels.js +2 -0
- package/dist/collection/components/post-collapsible/heading-levels.js.map +1 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +1 -29
- package/dist/collection/components/post-collapsible/post-collapsible.js +65 -63
- package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
- package/dist/collection/components/post-icon/post-icon.js +5 -4
- package/dist/collection/components/post-icon/post-icon.js.map +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +5 -4
- 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 +2 -2
- package/dist/collection/components/post-tabs/post-tabs.js +11 -7
- package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +22 -15
- package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
- package/dist/collection/utils/index.js +1 -3
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/collection/utils/is-motion-reduced.js +4 -0
- package/dist/collection/utils/is-motion-reduced.js.map +1 -0
- package/dist/collection/utils/property-checkers/check-non-empty.js +1 -1
- package/dist/collection/utils/property-checkers/empty-or.js +1 -1
- package/dist/collection/utils/property-checkers/index.js +4 -4
- package/dist/components/check-non-empty.js +2 -2
- package/dist/components/check-non-empty.js.map +1 -1
- package/dist/components/check-one-of.js.map +1 -1
- package/dist/components/constants.js +5 -0
- package/dist/components/constants.js.map +1 -0
- package/dist/components/fade.js +4 -4
- package/dist/components/fade.js.map +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +36 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion.d.ts +11 -0
- package/dist/components/post-accordion.js +108 -0
- package/dist/components/post-accordion.js.map +1 -0
- package/dist/components/post-alert.js +9 -3
- package/dist/components/post-alert.js.map +1 -1
- package/dist/components/post-collapsible.js +51 -84
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-icon2.js +11 -21
- package/dist/components/post-icon2.js.map +1 -1
- package/dist/components/post-tab-header.js +3 -1
- package/dist/components/post-tab-header.js.map +1 -1
- package/dist/components/post-tab-panel.js.map +1 -1
- package/dist/components/post-tabs.js.map +1 -1
- package/dist/components/post-tooltip.js +2 -0
- package/dist/components/post-tooltip.js.map +1 -1
- package/dist/docs.d.ts +334 -235
- package/dist/docs.json +458 -14
- package/dist/esm/check-non-empty-09c39561.js +11 -0
- package/dist/esm/check-non-empty-09c39561.js.map +1 -0
- package/dist/esm/{check-one-of-ded5e15e.js → check-one-of-74750af9.js} +1 -1
- package/dist/esm/check-one-of-74750af9.js.map +1 -0
- package/dist/esm/constants-8d548297.js +5 -0
- package/dist/esm/constants-8d548297.js.map +1 -0
- package/dist/esm/fade-7fd71785.js +9 -0
- package/dist/esm/fade-7fd71785.js.map +1 -0
- package/dist/esm/index-35921354.js +36 -0
- package/dist/esm/index-35921354.js.map +1 -0
- package/dist/esm/{index-5611074b.js → index-4eff5fc5.js} +245 -41
- package/dist/esm/index-4eff5fc5.js.map +1 -0
- package/dist/esm/loader.js +4 -13
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/package-f3f12016.js +5 -0
- package/dist/esm/package-f3f12016.js.map +1 -0
- package/dist/esm/post-accordion.entry.js +85 -0
- package/dist/esm/post-accordion.entry.js.map +1 -0
- package/dist/esm/post-alert.entry.js +8 -8
- package/dist/esm/post-alert.entry.js.map +1 -1
- package/dist/esm/post-collapsible.entry.js +49 -80
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +4 -7
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon.entry.js +6 -6
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/esm/post-tab-header.entry.js +5 -4
- package/dist/esm/post-tab-header.entry.js.map +1 -1
- package/dist/esm/post-tab-panel.entry.js +2 -2
- package/dist/esm/post-tab-panel.entry.js.map +1 -1
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/post-tabs.entry.js.map +1 -1
- package/dist/esm/post-tooltip.entry.js +3 -3
- package/dist/esm/post-tooltip.entry.js.map +1 -1
- package/dist/post-components/p-08d942a0.entry.js +2 -0
- package/dist/post-components/p-08d942a0.entry.js.map +1 -0
- package/dist/post-components/{p-7240ae7b.entry.js → p-10c47e0a.entry.js} +2 -2
- package/dist/post-components/p-10c47e0a.entry.js.map +1 -0
- package/dist/post-components/{p-bcc705f1.js → p-1339f8cd.js} +1 -1
- package/dist/post-components/p-1339f8cd.js.map +1 -0
- package/dist/post-components/{p-e5306504.js → p-2737eaf5.js} +1 -1
- package/dist/post-components/p-2737eaf5.js.map +1 -0
- package/dist/post-components/{p-123bb6fb.entry.js → p-2755ba2e.entry.js} +2 -2
- package/dist/post-components/p-2755ba2e.entry.js.map +1 -0
- package/dist/post-components/p-440193f4.js +2 -0
- package/dist/post-components/p-440193f4.js.map +1 -0
- package/dist/post-components/p-4aae941f.js +2 -0
- package/dist/post-components/p-6a0a1ce4.entry.js +2 -0
- package/dist/post-components/p-6a0a1ce4.entry.js.map +1 -0
- package/dist/post-components/p-7d91397a.entry.js +2 -0
- package/dist/post-components/p-7d91397a.entry.js.map +1 -0
- package/dist/post-components/p-871ade93.entry.js +2 -0
- package/dist/post-components/p-871ade93.entry.js.map +1 -0
- package/dist/post-components/p-a18e1d1c.entry.js +2 -0
- package/dist/post-components/p-a18e1d1c.entry.js.map +1 -0
- package/dist/post-components/p-a7649277.js +3 -0
- package/dist/post-components/p-a7649277.js.map +1 -0
- package/dist/post-components/{p-8c386036.entry.js → p-b4b7e30c.entry.js} +2 -2
- package/dist/post-components/p-b4b7e30c.entry.js.map +1 -0
- package/dist/post-components/p-b531475e.js +2 -0
- package/dist/post-components/p-b531475e.js.map +1 -0
- package/dist/post-components/p-dfe29f7f.js +2 -0
- package/dist/post-components/p-dfe29f7f.js.map +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/animations/collapse.d.ts +2 -0
- package/dist/types/components/post-accordion/post-accordion.d.ts +28 -0
- package/dist/types/components/post-alert/post-alert.d.ts +1 -1
- package/dist/types/components/post-collapsible/heading-levels.d.ts +2 -0
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +16 -12
- package/dist/types/components.d.ts +79 -3
- package/dist/types/stencil-public-runtime.d.ts +38 -5
- package/dist/types/utils/index.d.ts +1 -3
- package/dist/types/utils/is-motion-reduced.d.ts +1 -0
- package/loader/index.d.ts +1 -1
- package/package.json +5 -5
- package/dist/cjs/check-non-empty-35b4d0b5.js +0 -14
- package/dist/cjs/check-non-empty-35b4d0b5.js.map +0 -1
- package/dist/cjs/check-one-of-4c2e8b2e.js.map +0 -1
- package/dist/cjs/check-type-508a21a5.js +0 -18
- package/dist/cjs/check-type-508a21a5.js.map +0 -1
- package/dist/cjs/fade-8c6d4fa7.js +0 -12
- package/dist/cjs/fade-8c6d4fa7.js.map +0 -1
- package/dist/cjs/index-12cc37c9.js.map +0 -1
- package/dist/cjs/index-f8f6f146.js +0 -28
- package/dist/cjs/index-f8f6f146.js.map +0 -1
- package/dist/cjs/package-112e1698.js +0 -7
- package/dist/cjs/package-112e1698.js.map +0 -1
- package/dist/collection/utils/get-element-height.js +0 -12
- package/dist/collection/utils/get-element-height.js.map +0 -1
- package/dist/collection/utils/on-transition-end.js +0 -15
- package/dist/collection/utils/on-transition-end.js.map +0 -1
- package/dist/collection/utils/should-reduce-motion.js +0 -4
- package/dist/collection/utils/should-reduce-motion.js.map +0 -1
- package/dist/components/check-type.js +0 -16
- package/dist/components/check-type.js.map +0 -1
- package/dist/esm/check-non-empty-554bdf88.js +0 -11
- package/dist/esm/check-non-empty-554bdf88.js.map +0 -1
- package/dist/esm/check-one-of-ded5e15e.js.map +0 -1
- package/dist/esm/check-type-18ebb4e7.js +0 -16
- package/dist/esm/check-type-18ebb4e7.js.map +0 -1
- package/dist/esm/fade-671f1489.js +0 -9
- package/dist/esm/fade-671f1489.js.map +0 -1
- package/dist/esm/index-5611074b.js.map +0 -1
- package/dist/esm/index-7f723686.js +0 -24
- package/dist/esm/index-7f723686.js.map +0 -1
- package/dist/esm/package-331628f1.js +0 -5
- package/dist/esm/package-331628f1.js.map +0 -1
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/post-components/p-0d37fe44.entry.js +0 -2
- package/dist/post-components/p-0d37fe44.entry.js.map +0 -1
- package/dist/post-components/p-123bb6fb.entry.js.map +0 -1
- package/dist/post-components/p-15fc087f.js +0 -2
- package/dist/post-components/p-15fc087f.js.map +0 -1
- package/dist/post-components/p-65a9d1c2.entry.js +0 -2
- package/dist/post-components/p-65a9d1c2.entry.js.map +0 -1
- package/dist/post-components/p-7240ae7b.entry.js.map +0 -1
- package/dist/post-components/p-75a7b352.js +0 -2
- package/dist/post-components/p-75a7b352.js.map +0 -1
- package/dist/post-components/p-8c386036.entry.js.map +0 -1
- package/dist/post-components/p-97a064da.entry.js +0 -2
- package/dist/post-components/p-97a064da.entry.js.map +0 -1
- package/dist/post-components/p-bcc705f1.js.map +0 -1
- package/dist/post-components/p-c8efe0ae.js +0 -2
- package/dist/post-components/p-c8efe0ae.js.map +0 -1
- package/dist/post-components/p-ccae1c68.entry.js +0 -2
- package/dist/post-components/p-ccae1c68.entry.js.map +0 -1
- package/dist/post-components/p-d94db268.js +0 -3
- package/dist/post-components/p-d94db268.js.map +0 -1
- package/dist/post-components/p-e5306504.js.map +0 -1
- package/dist/post-components/p-eb3ff4dc.js +0 -2
- package/dist/types/utils/get-element-height.d.ts +0 -3
- package/dist/types/utils/on-transition-end.d.ts +0 -1
- package/dist/types/utils/should-reduce-motion.d.ts +0 -1
- /package/dist/post-components/{p-eb3ff4dc.js.map → p-4aae941f.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-tooltip.js","sourceRoot":"","sources":["../../../../src/components/post-tooltip/post-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EACL,KAAK,EACL,UAAU,EACV,eAAe,EACf,IAAI,EACJ,MAAM,EACN,MAAM,EAEN,KAAK,GACN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,0FAA0F;AAC1F,OAAO,2BAA2B,CAAC;AAEnC,wCAAwC;AACxC,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAC;AAE5D,MAAM,QAAQ,GAAG;EACf,GAAG,EAAE,QAAQ;EACb,KAAK,EAAE,MAAM;EACb,MAAM,EAAE,KAAK;EACb,IAAI,EAAE,OAAO;CACd,CAAC;AAaF,MAAM,OAAO,WAAW;EA2BtB,uBAAuB,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n inline,\n offset,\n Placement,\n shift,\n} from '@floating-ui/dom';\nimport isFocusable from 'ally.js/esm/is/focusable';\n\n// Polyfill for popovers, can be removed when https://caniuse.com/?search=popover is green\nimport '@oddbird/popover-polyfill';\n\n// Patch for long press on touch devices\nimport 'long-press-event';\n\nimport { version } from '../../../package.json';\nimport { checkOneOf } from '../../utils';\nimport { BACKGROUND_COLOR, BackgroundColor } from './types';\n\nconst SIDE_MAP = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n};\n\ninterface PopoverElement {\n showPopover: () => void;\n hidePopover: () => void;\n togglePopover: (force?: boolean) => boolean;\n}\n\n@Component({\n tag: 'post-tooltip',\n styleUrl: 'post-tooltip.scss',\n shadow: true,\n})\nexport class PostTooltip {\n private tooltipRef: HTMLDivElement & PopoverElement;\n private arrowRef: HTMLElement;\n private clearAutoUpdate: () => void;\n private readonly localShowTooltip: (e: Event) => Promise<void>;\n private readonly localHideTooltip: () => Promise<void>;\n private readonly localToggleTooltip: () => Promise<void>;\n private eventTarget: Element;\n\n @Element() host: HTMLPostTooltipElement;\n\n @State() tooltipClasses: string;\n\n /**\n * Defines the background color of the tooltip.\n * Choose the one that provides the best contrast in your scenario.\n */\n @Prop() readonly backgroundColor?: BackgroundColor = 'primary';\n\n /**\n * Defines the placement of the tooltip according to the floating-ui options available at https://floating-ui.com/docs/computePosition#placement.\n * Tooltips are automatically flipped to the opposite side if there is not enough available space and are shifted\n * towards the viewport if they would overlap edge boundaries.\n */\n @Prop() readonly placement?: Placement = 'top';\n\n @Watch('backgroundColor')\n validateBackgroundColor(newValue = this.backgroundColor) {\n checkOneOf(\n newValue,\n BACKGROUND_COLOR,\n `The post-tooltip \"background-color\" prop should contain one of those values: ${BACKGROUND_COLOR.join(\n ', ',\n )}`,\n );\n\n if (newValue === 'yellow') {\n this.tooltipClasses = 'bg-yellow';\n } else {\n this.tooltipClasses = 'bg-primary';\n }\n }\n\n constructor() {\n // Create local versions of event handlers for de-registration\n // https://stackoverflow.com/questions/33859113/javascript-removeeventlistener-not-working-inside-a-class\n this.localShowTooltip = e => this.show(e.target as HTMLElement);\n this.localHideTooltip = this.hide.bind(this);\n this.localToggleTooltip = this.toggle.bind(this);\n }\n\n componentWillLoad() {\n this.validateBackgroundColor();\n\n // Append tooltip host to the end of the body to get around overflow: hidden restrictions\n // for browsers that don't support popover yet\n document.body.appendChild(this.host);\n }\n\n connectedCallback() {\n if (!this.host.id) {\n throw new Error(\n 'No id set: <post-tooltip> must have an id, linking it to it\\'s target element using the data-tooltip-target attribute.',\n );\n }\n\n if (!this.triggers) {\n throw new Error(\n `No trigger found for <post-tooltip id=\"${this.host.id}\">, please add the 'data-tooltip-target=\"${this.host.id}\" attribute to the trigger element.`,\n );\n }\n\n // Patch popovertargetaction=\"interest\" until it's implemented\n // https://github.com/openui/open-ui/issues/767#issuecomment-1654177227\n this.triggers.forEach(trigger => this.patchPopoverTargetActionInterest(trigger));\n }\n\n /**\n * Remove a bunch of event listeners if the tooltip gets removed from the DOM\n */\n disconnectedCallback() {\n this.triggers.forEach(trigger => {\n trigger.removeEventListener('mouseenter', this.localShowTooltip);\n trigger.removeEventListener('mouseleave', this.localHideTooltip);\n trigger.removeEventListener('focus', this.localShowTooltip);\n trigger.removeEventListener('blur', this.localHideTooltip);\n trigger.removeEventListener('long-press', this.localShowTooltip);\n });\n if (this.tooltipRef)\n this.tooltipRef.removeEventListener('beforetoggle', this.localToggleTooltip);\n if (typeof this.clearAutoUpdate === 'function') this.clearAutoUpdate();\n }\n\n componentDidLoad() {\n // Has the benefit of rendering the tooltip without the popover attribute which\n // causes the tooltip to show up on the page if it's not linked to a target. This makes\n // the error obvious.\n if (!this.host.id || !this.triggers) return false;\n\n this.tooltipRef.setAttribute('popover', '');\n this.tooltipRef.addEventListener('beforetoggle', this.handleToggle.bind(this));\n }\n\n /**\n * Programmatically display the tooltip\n * @param target An element with [data-tooltip-target=\"id\"] where the tooltip should be shown\n */\n @Method()\n async show(target: HTMLElement) {\n this.eventTarget = target;\n this.tooltipRef.showPopover();\n }\n\n /**\n * Programmatically hide this tooltip\n */\n @Method()\n async hide() {\n this.eventTarget = null;\n this.tooltipRef.hidePopover();\n }\n\n /**\n * Toggle tooltip display\n * @param target An element with [data-tooltip-target=\"id\"] where the tooltip should be shown\n * @param force Pass true to always show or false to always hide\n */\n @Method()\n async toggle(target: HTMLElement, force?: boolean) {\n this.eventTarget = target;\n this.tooltipRef.togglePopover(force);\n }\n\n private get triggers() {\n return document.querySelectorAll(`[data-tooltip-target=\"${this.host.id}\"]`);\n }\n\n private patchPopoverTargetActionInterest(trigger: Element) {\n trigger.addEventListener('mouseenter', this.localShowTooltip);\n trigger.addEventListener('mouseleave', this.localHideTooltip);\n trigger.addEventListener('focus', this.localShowTooltip);\n trigger.addEventListener('blur', this.localHideTooltip);\n trigger.addEventListener('long-press', this.localShowTooltip);\n\n // Patch missing aria-describedby attribute on the trigger without overriding existing values\n const describedBy = trigger.getAttribute('aria-describedby');\n if (!describedBy?.includes(this.host.id)) {\n const newDescribedBy = describedBy ? `${describedBy} ${this.host.id}` : this.host.id;\n trigger.setAttribute('aria-describedby', newDescribedBy);\n }\n\n // Patch missing focus ability on the trigger element\n if (!isFocusable(trigger)) {\n trigger.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Start or stop auto updates based on tooltip events.\n * Tooltips can be closed or opened with other methods than class members,\n * therefore listening to the toggle event is safer for cleaning up.\n * @param e ToggleEvent\n */\n private handleToggle(e: ToggleEvent) {\n const isOpen = e.newState === 'open';\n if (isOpen) {\n this.startAutoupdates();\n } else {\n if (typeof this.clearAutoUpdate === 'function') this.clearAutoUpdate();\n }\n }\n\n /**\n * Start listening for DOM updates, scroll events etc. that have\n * an influence on tooltip positioning\n */\n private startAutoupdates() {\n this.clearAutoUpdate = autoUpdate(\n this.eventTarget,\n this.tooltipRef,\n this.positionTooltip.bind(this),\n );\n }\n\n // Tooltip and arrow positioning with floating-ui\n // Docs: https://floating-ui.com/docs/computePosition\n private async positionTooltip() {\n const {\n x,\n y,\n middlewareData,\n placement: currentPlacement,\n } = await computePosition(this.eventTarget, this.tooltipRef, {\n placement: this.placement || 'top',\n middleware: [\n flip(),\n inline(),\n shift({ padding: 8 }),\n offset(12), // 4px outside of element to account for focus outline + ~arrow size\n arrow({ element: this.arrowRef, padding: 8 }),\n ],\n });\n\n // Tooltip\n this.tooltipRef.style.left = `${x}px`;\n this.tooltipRef.style.top = `${y}px`;\n\n // Arrow\n // Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js\n const side = currentPlacement.split('-')[0];\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n const staticSide = SIDE_MAP[side];\n\n Object.assign(this.arrowRef.style, {\n top: arrowY ? `${arrowY}px` : '',\n left: arrowX ? `${arrowX}px` : '',\n [staticSide]: `${-this.arrowRef.offsetWidth / 2}px`,\n });\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div\n role=\"tooltip\"\n tabindex=\"-1\"\n class={this.tooltipClasses}\n ref={(el: HTMLDivElement & PopoverElement) => (this.tooltipRef = el)}\n >\n <span\n class=\"arrow\"\n ref={el => {\n this.arrowRef = el;\n }}\n ></span>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"post-tooltip.js","sourceRoot":"","sources":["../../../../src/components/post-tooltip/post-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EACL,KAAK,EACL,UAAU,EACV,eAAe,EACf,IAA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,GAAG,CAAC,IAAI;KACpD,CAAC,CAAC;EACL,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,oBAAe,OAAO;MACzB,WACE,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,IAAI,EACb,KAAK,EAAE,IAAI,CAAC,cAAc,EAC1B,GAAG,EAAE,CAAC,EAAmC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAEpE,YACE,KAAK,EAAC,OAAO,EACb,GAAG,EAAE,EAAE,CAAC,EAAE;YACR,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;UACrB,CAAC,GACK;QACR,eAAa,CACT,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n inline,\n offset,\n Placement,\n shift,\n} from '@floating-ui/dom';\nimport isFocusable from 'ally.js/esm/is/focusable';\n\n// Polyfill for popovers, can be removed when https://caniuse.com/?search=popover is green\nimport '@oddbird/popover-polyfill';\n\n// Patch for long press on touch devices\nimport 'long-press-event';\n\nimport { version } from '../../../package.json';\nimport { checkOneOf } from '../../utils';\nimport { BACKGROUND_COLOR, BackgroundColor } from './types';\n\nconst SIDE_MAP = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n};\n\ninterface PopoverElement {\n showPopover: () => void;\n hidePopover: () => void;\n togglePopover: (force?: boolean) => boolean;\n}\n\n@Component({\n tag: 'post-tooltip',\n styleUrl: 'post-tooltip.scss',\n shadow: true,\n})\nexport class PostTooltip {\n private tooltipRef: HTMLDivElement & PopoverElement;\n private arrowRef: HTMLElement;\n private clearAutoUpdate: () => void;\n private readonly localShowTooltip: (e: Event) => Promise<void>;\n private readonly localHideTooltip: () => Promise<void>;\n private readonly localToggleTooltip: () => Promise<void>;\n private eventTarget: Element;\n\n @Element() host: HTMLPostTooltipElement;\n\n @State() tooltipClasses: string;\n\n /**\n * Defines the background color of the tooltip.\n * Choose the one that provides the best contrast in your scenario.\n */\n @Prop() readonly backgroundColor?: BackgroundColor = 'primary';\n\n /**\n * Defines the placement of the tooltip according to the floating-ui options available at https://floating-ui.com/docs/computePosition#placement.\n * Tooltips are automatically flipped to the opposite side if there is not enough available space and are shifted\n * towards the viewport if they would overlap edge boundaries.\n */\n @Prop() readonly placement?: Placement = 'top';\n\n @Watch('backgroundColor')\n validateBackgroundColor(newValue = this.backgroundColor) {\n checkOneOf(\n newValue,\n BACKGROUND_COLOR,\n `The post-tooltip \"background-color\" prop should contain one of those values: ${BACKGROUND_COLOR.join(\n ', ',\n )}`,\n );\n\n if (newValue === 'yellow') {\n this.tooltipClasses = 'bg-yellow';\n } else {\n this.tooltipClasses = 'bg-primary';\n }\n }\n\n constructor() {\n // Create local versions of event handlers for de-registration\n // https://stackoverflow.com/questions/33859113/javascript-removeeventlistener-not-working-inside-a-class\n this.localShowTooltip = e => this.show(e.target as HTMLElement);\n this.localHideTooltip = this.hide.bind(this);\n this.localToggleTooltip = this.toggle.bind(this);\n }\n\n componentWillLoad() {\n this.validateBackgroundColor();\n\n // Append tooltip host to the end of the body to get around overflow: hidden restrictions\n // for browsers that don't support popover yet\n document.body.appendChild(this.host);\n }\n\n connectedCallback() {\n if (!this.host.id) {\n throw new Error(\n 'No id set: <post-tooltip> must have an id, linking it to it\\'s target element using the data-tooltip-target attribute.',\n );\n }\n\n if (!this.triggers) {\n throw new Error(\n `No trigger found for <post-tooltip id=\"${this.host.id}\">, please add the 'data-tooltip-target=\"${this.host.id}\" attribute to the trigger element.`,\n );\n }\n\n // Patch popovertargetaction=\"interest\" until it's implemented\n // https://github.com/openui/open-ui/issues/767#issuecomment-1654177227\n this.triggers.forEach(trigger => this.patchPopoverTargetActionInterest(trigger));\n }\n\n /**\n * Remove a bunch of event listeners if the tooltip gets removed from the DOM\n */\n disconnectedCallback() {\n this.triggers.forEach(trigger => {\n trigger.removeEventListener('mouseenter', this.localShowTooltip);\n trigger.removeEventListener('mouseleave', this.localHideTooltip);\n trigger.removeEventListener('focus', this.localShowTooltip);\n trigger.removeEventListener('blur', this.localHideTooltip);\n trigger.removeEventListener('long-press', this.localShowTooltip);\n });\n if (this.tooltipRef)\n this.tooltipRef.removeEventListener('beforetoggle', this.localToggleTooltip);\n if (typeof this.clearAutoUpdate === 'function') this.clearAutoUpdate();\n }\n\n componentDidLoad() {\n // Has the benefit of rendering the tooltip without the popover attribute which\n // causes the tooltip to show up on the page if it's not linked to a target. This makes\n // the error obvious.\n if (!this.host.id || !this.triggers) return false;\n\n this.tooltipRef.setAttribute('popover', '');\n this.tooltipRef.addEventListener('beforetoggle', this.handleToggle.bind(this));\n }\n\n /**\n * Programmatically display the tooltip\n * @param target An element with [data-tooltip-target=\"id\"] where the tooltip should be shown\n */\n @Method()\n async show(target: HTMLElement) {\n this.eventTarget = target;\n this.tooltipRef.showPopover();\n }\n\n /**\n * Programmatically hide this tooltip\n */\n @Method()\n async hide() {\n this.eventTarget = null;\n this.tooltipRef.hidePopover();\n }\n\n /**\n * Toggle tooltip display\n * @param target An element with [data-tooltip-target=\"id\"] where the tooltip should be shown\n * @param force Pass true to always show or false to always hide\n */\n @Method()\n async toggle(target: HTMLElement, force?: boolean) {\n this.eventTarget = target;\n this.tooltipRef.togglePopover(force);\n }\n\n private get triggers() {\n return document.querySelectorAll(`[data-tooltip-target=\"${this.host.id}\"]`);\n }\n\n private patchPopoverTargetActionInterest(trigger: Element) {\n trigger.addEventListener('mouseenter', this.localShowTooltip);\n trigger.addEventListener('mouseleave', this.localHideTooltip);\n trigger.addEventListener('focus', this.localShowTooltip);\n trigger.addEventListener('blur', this.localHideTooltip);\n trigger.addEventListener('long-press', this.localShowTooltip);\n\n // Patch missing aria-describedby attribute on the trigger without overriding existing values\n const describedBy = trigger.getAttribute('aria-describedby');\n if (!describedBy?.includes(this.host.id)) {\n const newDescribedBy = describedBy ? `${describedBy} ${this.host.id}` : this.host.id;\n trigger.setAttribute('aria-describedby', newDescribedBy);\n }\n\n // Patch missing focus ability on the trigger element\n if (!isFocusable(trigger)) {\n trigger.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Start or stop auto updates based on tooltip events.\n * Tooltips can be closed or opened with other methods than class members,\n * therefore listening to the toggle event is safer for cleaning up.\n * @param e ToggleEvent\n */\n private handleToggle(e: ToggleEvent) {\n const isOpen = e.newState === 'open';\n if (isOpen) {\n this.startAutoupdates();\n } else {\n if (typeof this.clearAutoUpdate === 'function') this.clearAutoUpdate();\n }\n }\n\n /**\n * Start listening for DOM updates, scroll events etc. that have\n * an influence on tooltip positioning\n */\n private startAutoupdates() {\n this.clearAutoUpdate = autoUpdate(\n this.eventTarget,\n this.tooltipRef,\n this.positionTooltip.bind(this),\n );\n }\n\n // Tooltip and arrow positioning with floating-ui\n // Docs: https://floating-ui.com/docs/computePosition\n private async positionTooltip() {\n const {\n x,\n y,\n middlewareData,\n placement: currentPlacement,\n } = await computePosition(this.eventTarget, this.tooltipRef, {\n placement: this.placement || 'top',\n middleware: [\n flip(),\n inline(),\n shift({ padding: 8 }),\n offset(12), // 4px outside of element to account for focus outline + ~arrow size\n arrow({ element: this.arrowRef, padding: 8 }),\n ],\n });\n\n // Tooltip\n this.tooltipRef.style.left = `${x}px`;\n this.tooltipRef.style.top = `${y}px`;\n\n // Arrow\n // Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js\n const side = currentPlacement.split('-')[0];\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n const staticSide = SIDE_MAP[side];\n\n Object.assign(this.arrowRef.style, {\n top: arrowY ? `${arrowY}px` : '',\n left: arrowX ? `${arrowX}px` : '',\n [staticSide]: `${-this.arrowRef.offsetWidth / 2}px`,\n });\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div\n role=\"tooltip\"\n tabindex=\"-1\"\n class={this.tooltipClasses}\n ref={(el: HTMLDivElement & PopoverElement) => (this.tooltipRef = el)}\n >\n <span\n class=\"arrow\"\n ref={el => {\n this.arrowRef = el;\n }}\n ></span>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './property-checkers';\nexport * from './is-motion-reduced';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-motion-reduced.js","sourceRoot":"","sources":["../../../src/utils/is-motion-reduced.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;EAC7B,OAAO,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC","sourcesContent":["export function isMotionReduced(): boolean {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { emptyOr } from
|
|
2
|
-
import { checkOneOf } from
|
|
3
|
-
import { checkPattern } from
|
|
4
|
-
import { checkType } from
|
|
1
|
+
import { emptyOr } from "./empty-or";
|
|
2
|
+
import { checkOneOf } from "./check-one-of";
|
|
3
|
+
import { checkPattern } from "./check-pattern";
|
|
4
|
+
import { checkType } from "./check-type";
|
|
5
5
|
export const checkEmptyOrOneOf = emptyOr(checkOneOf);
|
|
6
6
|
export const checkEmptyOrPattern = emptyOr(checkPattern);
|
|
7
7
|
export const checkEmptyOrType = emptyOr(checkType);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { E as EMPTY_VALUES } from './constants.js';
|
|
2
2
|
|
|
3
3
|
function checkNonEmpty(value, error) {
|
|
4
4
|
if (EMPTY_VALUES.some(v => v === value)) {
|
|
@@ -6,6 +6,6 @@ function checkNonEmpty(value, error) {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { checkNonEmpty as c };
|
|
10
10
|
|
|
11
11
|
//# sourceMappingURL=check-non-empty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"check-non-empty.js","mappings":"
|
|
1
|
+
{"file":"check-non-empty.js","mappings":";;SAEgB,aAAa,CAAC,KAAc,EAAE,KAAa;EACzD,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE;IACvC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACxB;AACH;;;;","names":[],"sources":["src/utils/property-checkers/check-non-empty.ts"],"sourcesContent":["import { EMPTY_VALUES } from './constants';\n\nexport function checkNonEmpty(value: unknown, error: string) {\n if (EMPTY_VALUES.some(v => v === value)) {\n throw new Error(error);\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"check-one-of.js","mappings":"SAAgB,UAAU,CAAI,KAAQ,EAAE,cAA4B,EAAE,KAAa;EACjF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D;;;;","names":[],"sources":["
|
|
1
|
+
{"file":"check-one-of.js","mappings":"SAAgB,UAAU,CAAI,KAAQ,EAAE,cAA4B,EAAE,KAAa;EACjF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D;;;;","names":[],"sources":["src/utils/property-checkers/check-one-of.ts"],"sourcesContent":["export function checkOneOf<T>(value: T, possibleValues: readonly T[], error: string) {\n if (!possibleValues.includes(value)) throw new Error(error);\n}\n"],"version":3}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"constants.js","mappings":"MAAa,YAAY,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE;;;;","names":[],"sources":["src/utils/property-checkers/constants.ts"],"sourcesContent":["export const EMPTY_VALUES = [undefined, null, ''];\n"],"version":3}
|
package/dist/components/fade.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fadeDuration = 200;
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const fadeIn = (el) => el.animate([
|
|
5
|
-
const fadeOut = (el) => el.animate([
|
|
2
|
+
const fadedOutKeyframe = { opacity: '0' };
|
|
3
|
+
const fadedInKeyframe = { opacity: '1' };
|
|
4
|
+
const fadeIn = (el) => el.animate([fadedOutKeyframe, fadedInKeyframe], { duration: fadeDuration });
|
|
5
|
+
const fadeOut = (el) => el.animate([fadedInKeyframe, fadedOutKeyframe], { duration: fadeDuration });
|
|
6
6
|
|
|
7
7
|
export { fadeIn as a, fadeOut as f };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"fade.js","mappings":"AAAA,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,gBAAgB,
|
|
1
|
+
{"file":"fade.js","mappings":"AAAA,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,gBAAgB,GAAa,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;AAClD,MAAM,eAAe,GAAa,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;MAEpC,MAAM,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC1D,CAAE,gBAAgB,EAAE,eAAe,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAC1B;MAEW,OAAO,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC3D,CAAE,eAAe,EAAE,gBAAgB,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE;;;;","names":[],"sources":["src/animations/fade.ts"],"sourcesContent":["const fadeDuration = 200;\nconst fadedOutKeyframe: Keyframe = {opacity: '0'};\nconst fadedInKeyframe: Keyframe = {opacity: '1'};\n\nexport const fadeIn = (el: Element): Animation => el.animate(\n [ fadedOutKeyframe, fadedInKeyframe ],\n { duration: fadeDuration }\n);\n\nexport const fadeOut = (el: Element): Animation => el.animate(\n [ fadedInKeyframe, fadedOutKeyframe ],\n { duration: fadeDuration }\n);\n"],"version":3}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the base path to where the assets can be found. Use "setAssetPath(path)"
|
|
3
|
+
* if the path needs to be customized.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getAssetPath: (path: string) => string;
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* Used to manually set the base path where assets can be found.
|
|
3
9
|
* If the script is used as "module", it's recommended to use "import.meta.url",
|
package/dist/components/index.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { E as EMPTY_VALUES } from './constants.js';
|
|
2
|
+
import { c as checkOneOf } from './check-one-of.js';
|
|
3
|
+
|
|
4
|
+
function emptyOr(check) {
|
|
5
|
+
return (...args) => {
|
|
6
|
+
const value = args[0];
|
|
7
|
+
if (!EMPTY_VALUES.some(v => v === value))
|
|
8
|
+
check(...args);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function checkPattern(value, pattern, errorMessage) {
|
|
13
|
+
if (typeof value !== 'string' || !pattern.test(value))
|
|
14
|
+
throw new Error(errorMessage);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function checkType(value, type, error) {
|
|
18
|
+
const typeIsArray = type === 'array';
|
|
19
|
+
const valueIsArray = Array.isArray(value);
|
|
20
|
+
if (typeIsArray || valueIsArray) {
|
|
21
|
+
if (valueIsArray !== typeIsArray)
|
|
22
|
+
throw new Error(error);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
if (typeof value !== type)
|
|
26
|
+
throw new Error(error);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const checkEmptyOrOneOf = emptyOr(checkOneOf);
|
|
31
|
+
const checkEmptyOrPattern = emptyOr(checkPattern);
|
|
32
|
+
const checkEmptyOrType = emptyOr(checkType);
|
|
33
|
+
|
|
34
|
+
export { checkEmptyOrPattern as a, checkEmptyOrOneOf as b, checkType as c, checkEmptyOrType as d };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=index2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"index2.js","mappings":";;;SAEgB,OAAO,CAAsB,KAA2B;EACtE,OAAO,CAAC,GAAG,IAAO;IAChB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC;MAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;GAC1D,CAAC;AACJ;;SCPgB,YAAY,CAAC,KAAc,EAAE,OAAe,EAAE,YAAoB;EAChF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACvF;;SCMgB,SAAS,CAAC,KAAc,EAAE,IAAkB,EAAE,KAAa;EACzE,MAAM,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;EACrC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;EAE1C,IAAI,WAAW,IAAI,YAAY,EAAE;IAC/B,IAAI,YAAY,KAAK,WAAW;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GAC1D;OAAM;IACL,IAAI,OAAO,KAAK,KAAK,IAAI;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACnD;AACH;;MCZa,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE;MACxC,mBAAmB,GAAG,OAAO,CAAC,YAAY,EAAE;MAC5C,gBAAgB,GAAG,OAAO,CAAC,SAAS;;;;","names":[],"sources":["src/utils/property-checkers/empty-or.ts","src/utils/property-checkers/check-pattern.ts","src/utils/property-checkers/check-type.ts","src/utils/property-checkers/index.ts"],"sourcesContent":["import { EMPTY_VALUES } from './constants';\n\nexport function emptyOr<T extends unknown[]>(check: (...args: T) => void) {\n return (...args: T) => {\n const value = args[0];\n if (!EMPTY_VALUES.some(v => v === value)) check(...args);\n };\n}\n","export function checkPattern(value: unknown, pattern: RegExp, errorMessage: string) {\n if (typeof value !== 'string' || !pattern.test(value)) throw new Error(errorMessage);\n}\n","export type PropertyType =\n | 'boolean'\n | 'number'\n | 'string'\n | 'array'\n | 'object'\n | 'function';\n\nexport function checkType(value: unknown, type: PropertyType, error: string) {\n const typeIsArray = type === 'array';\n const valueIsArray = Array.isArray(value);\n\n if (typeIsArray || valueIsArray) {\n if (valueIsArray !== typeIsArray) throw new Error(error);\n } else {\n if (typeof value !== type) throw new Error(error);\n }\n}\n","import { emptyOr } from './empty-or';\nimport { checkOneOf } from './check-one-of';\nimport { checkPattern } from './check-pattern';\nimport { checkType } from './check-type';\n\nexport const checkEmptyOrOneOf = emptyOr(checkOneOf);\nexport const checkEmptyOrPattern = emptyOr(checkPattern);\nexport const checkEmptyOrType = emptyOr(checkType);\n\nexport * from './check-non-empty';\nexport * from './check-one-of';\nexport * from './check-pattern';\nexport * from './check-type';\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface PostAccordion extends Components.PostAccordion, HTMLElement {}
|
|
4
|
+
export const PostAccordion: {
|
|
5
|
+
prototype: PostAccordion;
|
|
6
|
+
new (): PostAccordion;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { v as version } from './package.js';
|
|
3
|
+
|
|
4
|
+
const postAccordionCss = ":host{display:block}";
|
|
5
|
+
|
|
6
|
+
const PostAccordion$1 = /*@__PURE__*/ proxyCustomElement(class PostAccordion extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.expandedCollapsibles = new Set();
|
|
12
|
+
this.multiple = false;
|
|
13
|
+
}
|
|
14
|
+
componentWillLoad() {
|
|
15
|
+
this.registerCollapsibles();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Toggles the `post-collapsible` children with the given id.
|
|
19
|
+
*/
|
|
20
|
+
async toggle(id) {
|
|
21
|
+
const collapsibleToToggle = this.collapsibles
|
|
22
|
+
.find(collapsible => collapsible.id === id);
|
|
23
|
+
if (!collapsibleToToggle)
|
|
24
|
+
throw new Error(`No post-collapsible found with id #${id}.`);
|
|
25
|
+
await collapsibleToToggle.toggle();
|
|
26
|
+
}
|
|
27
|
+
collapseChangeHandler(event) {
|
|
28
|
+
const toggledCollapsible = event.target;
|
|
29
|
+
const isClosing = this.expandedCollapsibles.has(toggledCollapsible);
|
|
30
|
+
if (isClosing) {
|
|
31
|
+
this.expandedCollapsibles.delete(toggledCollapsible);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.expandedCollapsibles.add(toggledCollapsible);
|
|
35
|
+
}
|
|
36
|
+
if (this.multiple || isClosing)
|
|
37
|
+
return;
|
|
38
|
+
// close other open collapsible elements to have only one opened at a time
|
|
39
|
+
Array.from(this.expandedCollapsibles.values())
|
|
40
|
+
.filter(collapsible => collapsible !== toggledCollapsible)
|
|
41
|
+
.forEach(collapsible => {
|
|
42
|
+
void collapsible.toggle(false);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Expands all `post-collapsible` children.
|
|
47
|
+
*
|
|
48
|
+
* If `close-others` is `true` and all items are closed, it will open the first one.
|
|
49
|
+
* Otherwise, it will keep the opened one.
|
|
50
|
+
*/
|
|
51
|
+
async expandAll() {
|
|
52
|
+
if (this.multiple) {
|
|
53
|
+
await Promise.all(this.collapsibles.map(collapsible => collapsible.toggle(true)));
|
|
54
|
+
}
|
|
55
|
+
else if (!this.expandedCollapsibles.size) {
|
|
56
|
+
await this.collapsibles[0].toggle(true);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Collapses all `post-collapsible` children.
|
|
61
|
+
*/
|
|
62
|
+
async collapseAll() {
|
|
63
|
+
await Promise.all(this.collapsibles.map(collapsible => collapsible.toggle(false)));
|
|
64
|
+
}
|
|
65
|
+
registerCollapsibles() {
|
|
66
|
+
this.collapsibles = Array.from(this.host.querySelectorAll('post-collapsible'));
|
|
67
|
+
this.collapsibles
|
|
68
|
+
.filter(collapsible => {
|
|
69
|
+
return !collapsible.collapsed || this.expandedCollapsibles.has(collapsible);
|
|
70
|
+
}).forEach((collapsible, index) => {
|
|
71
|
+
if (!this.multiple && index !== 0) {
|
|
72
|
+
collapsible.setAttribute('collapsed', '');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.expandedCollapsibles.add(collapsible);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
return (h(Host, { "data-version": version }, h("div", { class: "accordion" }, h("slot", { onSlotchange: () => this.registerCollapsibles() }))));
|
|
80
|
+
}
|
|
81
|
+
get host() { return this; }
|
|
82
|
+
static get style() { return postAccordionCss; }
|
|
83
|
+
}, [1, "post-accordion", {
|
|
84
|
+
"multiple": [4],
|
|
85
|
+
"toggle": [64],
|
|
86
|
+
"expandAll": [64],
|
|
87
|
+
"collapseAll": [64]
|
|
88
|
+
}, [[0, "collapseChange", "collapseChangeHandler"]]]);
|
|
89
|
+
function defineCustomElement$1() {
|
|
90
|
+
if (typeof customElements === "undefined") {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const components = ["post-accordion"];
|
|
94
|
+
components.forEach(tagName => { switch (tagName) {
|
|
95
|
+
case "post-accordion":
|
|
96
|
+
if (!customElements.get(tagName)) {
|
|
97
|
+
customElements.define(tagName, PostAccordion$1);
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
} });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const PostAccordion = PostAccordion$1;
|
|
104
|
+
const defineCustomElement = defineCustomElement$1;
|
|
105
|
+
|
|
106
|
+
export { PostAccordion, defineCustomElement };
|
|
107
|
+
|
|
108
|
+
//# sourceMappingURL=post-accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"post-accordion.js","mappings":";;;AAAA,MAAM,gBAAgB,GAAG,sBAAsB;;MCQlCA,eAAa;;;;;IAEhB,yBAAoB,GAAG,IAAI,GAAG,EAA8B,CAAC;oBAOhC,KAAK;;EAE1C,iBAAiB;IACf,IAAI,CAAC,oBAAoB,EAAE,CAAC;GAC7B;;;;EAMD,MAAM,MAAM,CAAC,EAAU;IACrB,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY;OAC1C,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAE9C,IAAI,CAAC,mBAAmB;MAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;IAEvF,MAAM,mBAAmB,CAAC,MAAM,EAAE,CAAC;GACpC;EAGD,qBAAqB,CAAC,KAAkB;IACtC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAoC,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d,MAAM,CAAC,WAAW;MACjB,OAAO,CAAC,WAAW,CAAC,SAAS,IAAI,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;KAC7E,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK;MAC5B,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,CAAC,EAAE;QACjC,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC1C,OAAO;OACR;MAED,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;KAC5C,CAAC,CAAC;GACN;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WAAK,KAAK,EAAC,WAAW,IACpB,YAAM,YAAY,EAAE,MAAM,IAAI,CAAC,oBAAoB,EAAE,GAAG,CACpD,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostAccordion"],"sources":["src/components/post-accordion/post-accordion.scss?tag=post-accordion&encapsulation=shadow","src/components/post-accordion/post-accordion.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Element, h, Host, Listen, Method, Prop } from '@stencil/core';\nimport { version } from '../../../package.json';\n\n@Component({\n tag: 'post-accordion',\n styleUrl: 'post-accordion.scss',\n shadow: true,\n})\nexport class PostAccordion {\n private collapsibles: HTMLPostCollapsibleElement[];\n private expandedCollapsibles = new Set<HTMLPostCollapsibleElement>();\n\n @Element() host: HTMLPostAccordionElement;\n\n /**\n * If `true`, multiple `post-collapsible` can be open at the same time.\n */\n @Prop() readonly multiple: boolean = false;\n\n componentWillLoad() {\n this.registerCollapsibles();\n }\n\n /**\n * Toggles the `post-collapsible` children with the given id.\n */\n @Method()\n async toggle(id: string) {\n const collapsibleToToggle = this.collapsibles\n .find(collapsible => collapsible.id === id);\n\n if (!collapsibleToToggle) throw new Error(`No post-collapsible found with id #${id}.`);\n\n await collapsibleToToggle.toggle();\n }\n\n @Listen('collapseChange')\n collapseChangeHandler(event: CustomEvent) {\n const toggledCollapsible = event.target as HTMLPostCollapsibleElement;\n const isClosing = this.expandedCollapsibles.has(toggledCollapsible);\n\n if (isClosing) {\n this.expandedCollapsibles.delete(toggledCollapsible);\n } else {\n this.expandedCollapsibles.add(toggledCollapsible);\n }\n\n if (this.multiple || isClosing) return;\n\n // close other open collapsible elements to have only one opened at a time\n Array.from(this.expandedCollapsibles.values())\n .filter(collapsible => collapsible !== toggledCollapsible)\n .forEach(collapsible => {\n void collapsible.toggle(false);\n });\n }\n\n /**\n * Expands all `post-collapsible` children.\n *\n * If `close-others` is `true` and all items are closed, it will open the first one.\n * Otherwise, it will keep the opened one.\n */\n @Method()\n async expandAll() {\n if (this.multiple) {\n await Promise.all(\n this.collapsibles.map(collapsible => collapsible.toggle(true))\n );\n } else if (!this.expandedCollapsibles.size) {\n await this.collapsibles[0].toggle(true);\n }\n }\n\n /**\n * Collapses all `post-collapsible` children.\n */\n @Method()\n async collapseAll() {\n await Promise.all(\n this.collapsibles.map(collapsible => collapsible.toggle(false))\n );\n }\n\n private registerCollapsibles() {\n this.collapsibles = Array.from(\n this.host.querySelectorAll('post-collapsible')\n );\n\n this.collapsibles\n .filter(collapsible => {\n return !collapsible.collapsed || this.expandedCollapsibles.has(collapsible);\n }).forEach((collapsible, index) => {\n if (!this.multiple && index !== 0) {\n collapsible.setAttribute('collapsed', '');\n return;\n }\n\n this.expandedCollapsibles.add(collapsible);\n });\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div class=\"accordion\">\n <slot onSlotchange={() => this.registerCollapsibles()}/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { v as version } from './package.js';
|
|
3
3
|
import { f as fadeOut } from './fade.js';
|
|
4
|
-
import { c as
|
|
5
|
-
import {
|
|
4
|
+
import { c as checkType, a as checkEmptyOrPattern, b as checkEmptyOrOneOf } from './index2.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './post-icon2.js';
|
|
6
6
|
import { c as checkNonEmpty } from './check-non-empty.js';
|
|
7
7
|
|
|
8
8
|
const ALERT_TYPES = ['primary', 'success', 'danger', 'warning', 'info', 'gray'];
|
|
9
9
|
|
|
10
|
-
const postAlertCss = "/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */.alert-primary,.alert-success,.alert-danger,.alert-warning,.alert-info,.alert-gray,.alert-notification,.alert-error{background-color:rgb(var(--post-bg-rgb)) !important;color:var(--post-contrast-color) !important}.alert-success,.alert-warning,.alert-info,.alert-gray{--post-contrast-color:#000;--post-contrast-color-inverted:#fff;--post-gray-10:hsl(0, 0%, 90%);--post-gray-20:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-60:hsl(0, 0%, 40%);--post-gray-80:hsl(0, 0%, 20%);--post-yellow:#fc0;--post-light:#faf9f8;--post-gray:#f4f3f1;--post-dark:hsl(0, 0%, 20%);--post-primary:hsl(0, 0%, 20%);--post-white:#fff;--post-black:#000;--post-success:#2c911c;--post-info:#cce4ee;--post-warning:#f49e00;--post-danger:#a51728;--post-nightblue:#004976;--post-nightblue-bright:#0076a8;--post-petrol:#006d68;--post-petrol-bright:#00968f;--post-coral:#9e2a2f;--post-coral-bright:#e03c31;--post-olive:#716135;--post-olive-bright:#aa9d2e;--post-purple:#80276c;--post-purple-bright:#c5299b;--post-aubergine:#523178;--post-aubergine-bright:#7566a0;--post-contrast-color-rgb:0, 0, 0;--post-contrast-color-inverted-rgb:255, 255, 255;--post-gray-10-rgb:230, 230, 230;--post-gray-20-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-60-rgb:102, 102, 102;--post-gray-80-rgb:51, 51, 51;--post-yellow-rgb:255, 204, 0;--post-light-rgb:250, 249, 248;--post-gray-rgb:244, 243, 241;--post-dark-rgb:51, 51, 51;--post-primary-rgb:51, 51, 51;--post-white-rgb:255, 255, 255;--post-black-rgb:0, 0, 0;--post-success-rgb:44, 145, 28;--post-info-rgb:204, 228, 238;--post-warning-rgb:244, 158, 0;--post-danger-rgb:165, 23, 40;--post-nightblue-rgb:0, 73, 118;--post-nightblue-bright-rgb:0, 118, 168;--post-petrol-rgb:0, 109, 104;--post-petrol-bright-rgb:0, 150, 143;--post-coral-rgb:158, 42, 47;--post-coral-bright-rgb:224, 60, 49;--post-olive-rgb:113, 97, 53;--post-olive-bright-rgb:170, 157, 46;--post-purple-rgb:128, 39, 108;--post-purple-bright-rgb:197, 41, 155;--post-aubergine-rgb:82, 49, 120;--post-aubergine-bright-rgb:117, 102, 160}.alert-primary,.alert-danger,.alert-notification,.alert-error{--post-contrast-color:#fff;--post-contrast-color-inverted:#000;--post-dark:#faf9f8;--post-light:hsl(0, 0%, 20%);--post-gray-80:hsl(0, 0%, 90%);--post-gray-60:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-20:hsl(0, 0%, 40%);--post-gray-10:hsl(0, 0%, 20%);--post-contrast-color-rgb:255, 255, 255;--post-contrast-color-inverted-rgb:0, 0, 0;--post-dark-rgb:250, 249, 248;--post-light-rgb:51, 51, 51;--post-gray-80-rgb:230, 230, 230;--post-gray-60-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-20-rgb:102, 102, 102;--post-gray-10-rgb:51, 51, 51}.alert{position:relative;box-sizing:border-box;min-height:5rem;box-shadow:0 2px 4px 0 rgba(0,0,0,.2);border-radius:4px;padding:1rem 1.25rem;padding-inline-start:5.5rem;margin-block-end:1rem;font-size:1rem;font-weight:300}.alert.no-icon{min-height:3.5rem;padding-inline-start:1.25rem}.alert[class^=pi-],.alert[class*=\" pi-\"]{background-size:3rem;background-position:1.25rem 1rem;background-repeat:no-repeat}.alert[class^=pi-].no-icon,.alert[class*=\" pi-\"].no-icon{background-image:none}.alert::before{content:\"\";display:block}.alert::before,.alert>post-icon{position:absolute;height:3rem;width:3rem;left:1.25rem;top:1rem}.alert.no-icon::before,.alert[class^=pi-]::before,.alert[class*=\" pi-\"]::before{content:unset}.alert.no-icon>post-icon,.alert[class^=pi-]>post-icon,.alert[class*=\" pi-\"]>post-icon{display:none}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.alert{filter:none !important;background-color:rgba(0,0,0,0) !important;border:2px solid WindowText}}.alert:not(.alert-action){display:flex;flex-direction:column;justify-content:center;gap:.25rem}.alert:not(.alert-action) a{font-weight:400}.alert:not(.alert-action) hr{margin-block:.5rem .75rem !important}.alert:not(.alert-action)>:only-child,.alert:not(.alert-action)>post-icon:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert:not(.alert-action)>*{margin:0}.alert-heading{font-size:1.0625rem;font-weight:700}.alert-dismissible{pointer-events:auto;position:relative;padding-inline-end:4rem}.alert-dismissible>.btn-close{position:absolute;inset-block-start:1rem;inset-inline-end:1.25rem}.alert-dismissible>.btn-close:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert-action{display:flex;flex-direction:row;align-items:center;gap:1.25rem}.alert-action>.alert-content{flex:1 1 auto;display:flex;flex-direction:column;justify-content:center;gap:.25rem}.alert-action>.alert-content a{font-weight:400}.alert-action>.alert-content hr{margin-block:.5rem .75rem !important}.alert-action>.alert-content>:only-child,.alert-action>.alert-content>post-icon:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert-action>.alert-content>*{margin:0}.alert-action>.alert-buttons{flex:0 0 auto;display:flex;align-items:center;gap:.5rem}@media (min-width: 780px){.alert-action.alert-dismissible>.btn-close{inset-block-start:calc(50% - 0.75rem)}}@media (max-width: 779.98px){.alert-action{flex-direction:column;align-items:stretch;padding-inline:1.25rem}.alert-action>.alert-content{padding-inline-start:4.25rem;padding-inline-end:2.75rem}.alert-action>.alert-buttons{display:flex}.alert-action>.alert-buttons>.btn{flex:1 0 0;width:100%}.alert-action>.alert-buttons>.btn:first-child{margin-inline-start:0}}.alert-fixed-bottom{position:fixed;inset-block-end:0;inset-inline-start:0;inset-inline-end:0;margin-bottom:0;border-radius:0;z-index:1030}@media (min-width: 1441px){.alert-fixed-bottom{padding-inline-end:calc((100% - 1440px) / 2 + 120px + 1.25rem);padding-inline-start:calc(\n (100% - 1440px) / 2 + 120px + 1.25rem + 3rem + 1.25rem\n );background-position-x:calc((100% - 1440px) / 2 + 120px + 1.25rem + 1.5rem)}.alert-fixed-bottom::before{left:calc((100% - 1440px) / 2 + 120px + 1.25rem)}.alert-fixed-bottom.no-icon{padding-inline-start:calc((100% - 1440px) / 2 + 120px + 1.25rem)}.alert-fixed-bottom.alert-dismissible{padding-inline-end:calc(\n (100% - 1440px) / 2 + 120px + 1.25rem + 1.25rem + 1.5rem\n )}.alert-fixed-bottom.alert-dismissible>.btn-close{inset-inline-end:calc((100% - 1440px) / 2 + 120px + 1.25rem)}}.alert-primary{--post-bg-rgb:51, 51, 51}.alert-primary:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-primary>post-icon{background-color:#333}.alert-success{--post-bg-rgb:44, 145, 28}.alert-success:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m12.667 24.533-7.6-7.6 1.867-1.867 5.733 5.733 12.4-12.4 1.867 1.867z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m12.667 24.533-7.6-7.6 1.867-1.867 5.733 5.733 12.4-12.4 1.867 1.867z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-success>post-icon{background-color:#2c911c}.alert-danger{--post-bg-rgb:165, 23, 40}.alert-danger:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-danger>post-icon{background-color:#a51728}.alert-warning{--post-bg-rgb:244, 158, 0}.alert-warning:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-warning>post-icon{background-color:#f49e00}.alert-info{--post-bg-rgb:204, 228, 238}.alert-info:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M17.333 25.333v-16h-4.667V12h2v13.333h-2V28h6.667v-2.667zM14.667 4h2.667v2.667h-2.667V4z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M17.333 25.333v-16h-4.667V12h2v13.333h-2V28h6.667v-2.667zM14.667 4h2.667v2.667h-2.667V4z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-info>post-icon{background-color:#cce4ee}.alert-gray{--post-bg-rgb:244, 243, 241}.alert-gray:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.241 5.241 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.241 5.241 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27zM16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.325 6.325 0 0 0-.325 1.997 6.598 6.598 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667zM11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0c0-.735.599-1.333 1.334-1.333s1.333.598 1.333 1.333-.598 1.334-1.333 1.334-1.334-.598-1.334-1.334zm13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333zm-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335zm7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0zm-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM28.93 18.548a13.19 13.19 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266zm-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.647 11.647 0 0 0 2.359-.888.668.668 0 0 1 .896.294zM4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.798 11.798 0 0 0 4 15.92z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.241 5.241 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.241 5.241 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27zM16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.325 6.325 0 0 0-.325 1.997 6.598 6.598 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667zM11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0c0-.735.599-1.333 1.334-1.333s1.333.598 1.333 1.333-.598 1.334-1.333 1.334-1.334-.598-1.334-1.334zm13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333zm-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335zm7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0zm-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM28.93 18.548a13.19 13.19 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266zm-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.647 11.647 0 0 0 2.359-.888.668.668 0 0 1 .896.294zM4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.798 11.798 0 0 0 4 15.92z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-gray>post-icon{background-color:#f4f3f1}.alert-notification{--post-bg-rgb:51, 51, 51}.alert-notification:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-notification>post-icon{background-color:#333}.alert-error{--post-bg-rgb:165, 23, 40}.alert-error:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-error>post-icon{background-color:#a51728}.btn-close{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;user-select:none;appearance:button;outline:none;outline-offset:2px;border-radius:4px;color:var(--post-gray-80);transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms}.btn-close:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color)}.btn-close::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor;content:\"\";display:block;height:1.5rem;width:1.5rem}.btn-close:focus,.btn-close:not(:disabled):hover,.pretend-hover.btn-close{color:var(--post-contrast-color)}.btn-close:disabled{color:var(--post-gray-40)}.btn-close-white{color:#e6e6e6}.btn-close-white:focus,.btn-close-white:not(:disabled):hover,.btn-close-white.pretend-hover{color:#fff}.btn-close-white:disabled{color:#999}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}:host ::slotted(*){margin:0 !important}.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.visually-hidden:not(caption){position:absolute !important}.alert-heading>::slotted(h1){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h2){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h3){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h4){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h5){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h6){font-size:inherit !important;font-weight:inherit !important}";
|
|
10
|
+
const postAlertCss = "/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */.alert-primary,.alert-success,.alert-danger,.alert-warning,.alert-info,.alert-gray,.alert-notification,.alert-error{background-color:rgb(var(--post-bg-rgb)) !important;color:var(--post-contrast-color) !important}.alert-success,.alert-warning,.alert-info,.alert-gray{--post-contrast-color:#000;--post-contrast-color-inverted:#fff;--post-gray-10:hsl(0, 0%, 90%);--post-gray-20:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-60:hsl(0, 0%, 40%);--post-gray-80:hsl(0, 0%, 20%);--post-yellow:#fc0;--post-light:#faf9f8;--post-gray:#f4f3f1;--post-dark:hsl(0, 0%, 20%);--post-primary:hsl(0, 0%, 20%);--post-white:#fff;--post-black:#000;--post-success:#2c911c;--post-info:#cce4ee;--post-warning:#f49e00;--post-danger:#a51728;--post-nightblue:#004976;--post-nightblue-bright:#0076a8;--post-petrol:#006d68;--post-petrol-bright:#00968f;--post-coral:#9e2a2f;--post-coral-bright:#e03c31;--post-olive:#716135;--post-olive-bright:#aa9d2e;--post-purple:#80276c;--post-purple-bright:#c5299b;--post-aubergine:#523178;--post-aubergine-bright:#7566a0;--post-contrast-color-rgb:0, 0, 0;--post-contrast-color-inverted-rgb:255, 255, 255;--post-gray-10-rgb:230, 230, 230;--post-gray-20-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-60-rgb:102, 102, 102;--post-gray-80-rgb:51, 51, 51;--post-yellow-rgb:255, 204, 0;--post-light-rgb:250, 249, 248;--post-gray-rgb:244, 243, 241;--post-dark-rgb:51, 51, 51;--post-primary-rgb:51, 51, 51;--post-white-rgb:255, 255, 255;--post-black-rgb:0, 0, 0;--post-success-rgb:44, 145, 28;--post-info-rgb:204, 228, 238;--post-warning-rgb:244, 158, 0;--post-danger-rgb:165, 23, 40;--post-nightblue-rgb:0, 73, 118;--post-nightblue-bright-rgb:0, 118, 168;--post-petrol-rgb:0, 109, 104;--post-petrol-bright-rgb:0, 150, 143;--post-coral-rgb:158, 42, 47;--post-coral-bright-rgb:224, 60, 49;--post-olive-rgb:113, 97, 53;--post-olive-bright-rgb:170, 157, 46;--post-purple-rgb:128, 39, 108;--post-purple-bright-rgb:197, 41, 155;--post-aubergine-rgb:82, 49, 120;--post-aubergine-bright-rgb:117, 102, 160}.alert-primary,.alert-danger,.alert-notification,.alert-error{--post-contrast-color:#fff;--post-contrast-color-inverted:#000;--post-dark:#faf9f8;--post-light:hsl(0, 0%, 20%);--post-gray-80:hsl(0, 0%, 90%);--post-gray-60:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-20:hsl(0, 0%, 40%);--post-gray-10:hsl(0, 0%, 20%);--post-contrast-color-rgb:255, 255, 255;--post-contrast-color-inverted-rgb:0, 0, 0;--post-dark-rgb:250, 249, 248;--post-light-rgb:51, 51, 51;--post-gray-80-rgb:230, 230, 230;--post-gray-60-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-20-rgb:102, 102, 102;--post-gray-10-rgb:51, 51, 51}.alert{position:relative;box-sizing:border-box;min-height:5rem;box-shadow:0 2px 4px 0 rgba(0,0,0,.2);border-radius:4px;padding:1rem 1.25rem;padding-inline-start:5.5rem;margin-block-end:1rem;font-size:1rem;font-weight:300}.alert.no-icon{min-height:3.5rem;padding-inline-start:1.25rem}.alert[class^=pi-],.alert[class*=\" pi-\"]{background-size:3rem;background-position:1.25rem 1rem;background-repeat:no-repeat}.alert[class^=pi-].no-icon,.alert[class*=\" pi-\"].no-icon{background-image:none}.alert::before{content:\"\";display:block}.alert::before,.alert>post-icon{position:absolute;height:3rem;width:3rem;left:1.25rem;top:1rem}.alert.no-icon::before,.alert[class^=pi-]::before,.alert[class*=\" pi-\"]::before{content:unset}.alert.no-icon>post-icon,.alert[class^=pi-]>post-icon,.alert[class*=\" pi-\"]>post-icon{display:none}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.alert{filter:none !important;background-color:rgba(0,0,0,0) !important;border:2px solid WindowText}}.alert:not(.alert-action){display:flex;flex-direction:column;justify-content:center;gap:.25rem}.alert:not(.alert-action) a{font-weight:400}.alert:not(.alert-action) hr{margin-block:.5rem .75rem !important}.alert:not(.alert-action)>:only-child,.alert:not(.alert-action)>post-icon:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert:not(.alert-action)>*{margin:0}.alert-heading{font-size:1.0625rem;font-weight:700}.alert-dismissible{pointer-events:auto;position:relative;padding-inline-end:4rem}.alert-dismissible>.btn-close{position:absolute;inset-block-start:1rem;inset-inline-end:1.25rem}.alert-dismissible>.btn-close:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert-action{display:flex;flex-direction:row;align-items:center;gap:1.25rem}.alert-action>.alert-content{flex:1 1 auto;display:flex;flex-direction:column;justify-content:center;gap:.25rem}.alert-action>.alert-content a{font-weight:400}.alert-action>.alert-content hr{margin-block:.5rem .75rem !important}.alert-action>.alert-content>:only-child,.alert-action>.alert-content>post-icon:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert-action>.alert-content>*{margin:0}.alert-action>.alert-buttons{flex:0 0 auto;display:flex;align-items:center;gap:.5rem}@media (min-width: 780px){.alert-action.alert-dismissible>.btn-close{inset-block-start:calc(50% - 0.75rem)}}@media (max-width: 779.98px){.alert-action{flex-direction:column;align-items:stretch;padding-inline:1.25rem}.alert-action>.alert-content{padding-inline-start:4.25rem;padding-inline-end:2.75rem}.alert-action>.alert-buttons{display:flex}.alert-action>.alert-buttons>.btn{flex:1 0 0;width:100%}.alert-action>.alert-buttons>.btn:first-child{margin-inline-start:0}}.alert-fixed-bottom{position:fixed;inset-block-end:0;inset-inline-start:0;inset-inline-end:0;margin-bottom:0;border-radius:0;z-index:1030}@media (min-width: 1441px){.alert-fixed-bottom{padding-inline-end:calc((100% - 1440px) / 2 + 120px + 1.25rem);padding-inline-start:calc(\n (100% - 1440px) / 2 + 120px + 1.25rem + 3rem + 1.25rem\n );background-position-x:calc((100% - 1440px) / 2 + 120px + 1.25rem + 1.5rem)}.alert-fixed-bottom::before{left:calc((100% - 1440px) / 2 + 120px + 1.25rem)}.alert-fixed-bottom.no-icon{padding-inline-start:calc((100% - 1440px) / 2 + 120px + 1.25rem)}.alert-fixed-bottom.alert-dismissible{padding-inline-end:calc(\n (100% - 1440px) / 2 + 120px + 1.25rem + 1.25rem + 1.5rem\n )}.alert-fixed-bottom.alert-dismissible>.btn-close{inset-inline-end:calc((100% - 1440px) / 2 + 120px + 1.25rem)}}.alert-primary{--post-bg-rgb:51, 51, 51}.alert-primary:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-primary>post-icon{background-color:#333}.alert-success{--post-bg-rgb:44, 145, 28}.alert-success:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m12.667 24.533-7.6-7.6 1.867-1.867 5.733 5.733 12.4-12.4 1.867 1.867z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m12.667 24.533-7.6-7.6 1.867-1.867 5.733 5.733 12.4-12.4 1.867 1.867z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-success>post-icon{background-color:#2c911c}.alert-danger{--post-bg-rgb:165, 23, 40}.alert-danger:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-danger>post-icon{background-color:#a51728}.alert-warning{--post-bg-rgb:244, 158, 0}.alert-warning:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-warning>post-icon{background-color:#f49e00}.alert-info{--post-bg-rgb:204, 228, 238}.alert-info:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M17.333 25.333v-16h-4.667V12h2v13.333h-2V28h6.667v-2.667zM14.667 4h2.667v2.667h-2.667V4z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M17.333 25.333v-16h-4.667V12h2v13.333h-2V28h6.667v-2.667zM14.667 4h2.667v2.667h-2.667V4z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-info>post-icon{background-color:#cce4ee}.alert-gray{--post-bg-rgb:244, 243, 241}.alert-gray:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.241 5.241 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.241 5.241 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27zM16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.325 6.325 0 0 0-.325 1.997 6.598 6.598 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667zM11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0c0-.735.599-1.333 1.334-1.333s1.333.598 1.333 1.333-.598 1.334-1.333 1.334-1.334-.598-1.334-1.334zm13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333zm-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335zm7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0zm-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM28.93 18.548a13.19 13.19 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266zm-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.647 11.647 0 0 0 2.359-.888.668.668 0 0 1 .896.294zM4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.798 11.798 0 0 0 4 15.92z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.241 5.241 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.241 5.241 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27zM16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.325 6.325 0 0 0-.325 1.997 6.598 6.598 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667zM11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0c0-.735.599-1.333 1.334-1.333s1.333.598 1.333 1.333-.598 1.334-1.333 1.334-1.334-.598-1.334-1.334zm13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333zm-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335zm7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0zm-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM28.93 18.548a13.19 13.19 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266zm-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.647 11.647 0 0 0 2.359-.888.668.668 0 0 1 .896.294zM4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.798 11.798 0 0 0 4 15.92z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-gray>post-icon{background-color:#f4f3f1}.alert-notification{--post-bg-rgb:51, 51, 51}.alert-notification:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-notification>post-icon{background-color:#333}.alert-error{--post-bg-rgb:165, 23, 40}.alert-error:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-error>post-icon{background-color:#a51728}.btn-close{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;-webkit-appearance:button;appearance:button;outline:none;outline-offset:2px;border-radius:4px;color:var(--post-gray-80);transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms}.btn-close:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color)}.btn-close::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor;content:\"\";display:block;height:1.5rem;width:1.5rem}.btn-close:focus,.btn-close:not(:disabled):hover,.pretend-hover.btn-close{color:var(--post-contrast-color)}.btn-close:disabled{color:var(--post-gray-40)}.btn-close-white{color:#e6e6e6}.btn-close-white:focus,.btn-close-white:not(:disabled):hover,.btn-close-white.pretend-hover{color:#fff}.btn-close-white:disabled{color:#999}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}:host ::slotted(*){margin:0 !important}.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.visually-hidden:not(caption){position:absolute !important}.alert-heading>::slotted(h1){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h2){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h3){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h4){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h5){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h6){font-size:inherit !important;font-weight:inherit !important}";
|
|
11
11
|
|
|
12
12
|
const PostAlert$1 = /*@__PURE__*/ proxyCustomElement(class PostAlert extends HTMLElement {
|
|
13
13
|
constructor() {
|
|
@@ -107,6 +107,12 @@ const PostAlert$1 = /*@__PURE__*/ proxyCustomElement(class PostAlert extends HTM
|
|
|
107
107
|
"hasHeading": [32],
|
|
108
108
|
"onDismissButtonClick": [32],
|
|
109
109
|
"dismiss": [64]
|
|
110
|
+
}, undefined, {
|
|
111
|
+
"dismissible": ["validateDismissible"],
|
|
112
|
+
"dismissLabel": ["validateDismissLabel"],
|
|
113
|
+
"fixed": ["validateFixed"],
|
|
114
|
+
"icon": ["validateIcon"],
|
|
115
|
+
"type": ["validateType"]
|
|
110
116
|
}]);
|
|
111
117
|
function defineCustomElement$1() {
|
|
112
118
|
if (typeof customElements === "undefined") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"post-alert.js","mappings":";;;;;;;AAAO,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,Q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AAK,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,UAAU,EAAE,KAAK,EAAC,eAAe,IACvD,mBAAmB,CAChB;MACN,WAAK,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,UAAU,EAAE,KAAK,EAAC,eAAe,IACxD,YAAM,IAAI,EAAC,SAAS,GAAE,CAClB;KACP,CAAC;IAEF,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,OAAO,IAClC,IAAI,CAAC,WAAW,KACf,cAAQ,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,IAC1D,YAAM,KAAK,EAAC,iBAAiB,IAAE,IAAI,CAAC,YAAY,CAAQ,CACjD,CACV,EAEA,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,KAChC,iBAAW,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CAC5D,EAEA,IAAI,CAAC,UAAU;QACZ,kBAAkB;QAClB,mBAAmB,CAEnB,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostAlert"],"sources":["src/components/post-alert/alert-types.ts","src/components/post-alert/post-alert.scss?tag=post-alert&encapsulation=shadow","src/components/post-alert/post-alert.tsx"],"sourcesContent":["export const ALERT_TYPES = ['primary', 'success', 'danger', 'warning', 'info', 'gray'] as const;\n\nexport type AlertType = typeof ALERT_TYPES[number];\n","@use '@swisspost/design-system-styles/components/alert';\n@use '@swisspost/design-system-styles/components/close';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n\n ::slotted(*) {\n margin: 0 !important;\n }\n}\n\n.visually-hidden {\n @include post.visually-hidden();\n}\n\n@for $i from 1 through 6 {\n .alert-heading > ::slotted(h#{$i}) {\n font-size: inherit !important;\n font-weight: inherit !important;\n }\n}\n","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"],"version":3}
|