@oiz/stzh-components 3.3.0-beta6 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-2cd4f46b.js → app-globals-333c7ab2.js} +2 -2
- package/dist/cjs/{app-globals-2cd4f46b.js.map → app-globals-333c7ab2.js.map} +1 -1
- package/dist/cjs/index-92254d32.js +6 -10
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-appointments.cjs.entry.js +19 -2
- package/dist/cjs/stzh-appointments.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-datepicker_3.cjs.entry.js +1 -1
- package/dist/cjs/stzh-datepicker_3.cjs.entry.js.map +1 -1
- package/dist/cjs/{stzh-dialog.cjs.entry.js → stzh-dialog_2.cjs.entry.js} +141 -1
- package/dist/cjs/stzh-dialog_2.cjs.entry.js.map +1 -0
- package/dist/cjs/stzh-header.cjs.entry.js +6 -6
- package/dist/cjs/stzh-header.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-saptcha.cjs.entry.js +9 -1
- package/dist/cjs/stzh-saptcha.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-upload.cjs.entry.js +25 -14
- package/dist/cjs/stzh-upload.cjs.entry.js.map +1 -1
- package/dist/collection/assets/i18n/de.json +6 -4
- package/dist/collection/assets/i18n/en.json +6 -4
- package/dist/collection/components/stzh-header/stzh-header.css +1 -1
- package/dist/collection/components/stzh-header/stzh-header.js +5 -5
- package/dist/collection/components/stzh-header/stzh-header.js.map +1 -1
- package/dist/collection/components/stzh-header/stzh-header.stories.js +0 -2
- package/dist/collection/components/stzh-radiogroup/stzh-radiogroup.css +6 -0
- package/dist/collection/components/stzh-radiogroup/stzh-radiogroup.stories.js +10 -0
- package/dist/collection/components/stzh-saptcha/stzh-saptcha.js +16 -1
- package/dist/collection/components/stzh-saptcha/stzh-saptcha.js.map +1 -1
- package/dist/collection/components/stzh-saptcha/stzh-saptcha.stories.js +2 -1
- package/dist/collection/components/stzh-upload/stzh-upload.js +26 -15
- package/dist/collection/components/stzh-upload/stzh-upload.js.map +1 -1
- package/dist/collection/components/stzh-upload/stzh-upload.localization.js.map +1 -1
- package/dist/collection/components/stzh-upload/stzh-upload.stories.js +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/components/stzh-appointments.js +18 -1
- package/dist/components/stzh-appointments.js.map +1 -1
- package/dist/components/stzh-header.js +6 -6
- package/dist/components/stzh-header.js.map +1 -1
- package/dist/components/stzh-radiogroup2.js +1 -1
- package/dist/components/stzh-radiogroup2.js.map +1 -1
- package/dist/components/stzh-saptcha.js +12 -2
- package/dist/components/stzh-saptcha.js.map +1 -1
- package/dist/components/stzh-toastbar.js +1 -185
- package/dist/components/stzh-toastbar.js.map +1 -1
- package/dist/{esm/stzh-toastbar.entry.js → components/stzh-toastbar2.js} +56 -11
- package/dist/components/stzh-toastbar2.js.map +1 -0
- package/dist/components/stzh-upload.js +53 -30
- package/dist/components/stzh-upload.js.map +1 -1
- package/dist/esm/{app-globals-0aad39a2.js → app-globals-cff24d08.js} +2 -2
- package/dist/esm/{app-globals-0aad39a2.js.map → app-globals-cff24d08.js.map} +1 -1
- package/dist/esm/index-e3050b18.js +6 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-appointments.entry.js +18 -1
- package/dist/esm/stzh-appointments.entry.js.map +1 -1
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-datepicker_3.entry.js +1 -1
- package/dist/esm/stzh-datepicker_3.entry.js.map +1 -1
- package/dist/esm/{stzh-dialog.entry.js → stzh-dialog_2.entry.js} +141 -2
- package/dist/esm/stzh-dialog_2.entry.js.map +1 -0
- package/dist/esm/stzh-header.entry.js +6 -6
- package/dist/esm/stzh-header.entry.js.map +1 -1
- package/dist/esm/stzh-saptcha.entry.js +9 -1
- package/dist/esm/stzh-saptcha.entry.js.map +1 -1
- package/dist/esm/stzh-upload.entry.js +25 -14
- package/dist/esm/stzh-upload.entry.js.map +1 -1
- package/dist/stzh-components/assets/i18n/de.json +6 -4
- package/dist/stzh-components/assets/i18n/en.json +6 -4
- package/dist/stzh-components/index.esm.js.map +1 -1
- package/dist/stzh-components/{p-487b6e52.entry.js → p-35bf0d6a.entry.js} +2 -2
- package/dist/stzh-components/{p-487b6e52.entry.js.map → p-35bf0d6a.entry.js.map} +1 -1
- package/dist/stzh-components/p-37a50532.entry.js +2 -0
- package/dist/stzh-components/p-37a50532.entry.js.map +1 -0
- package/dist/stzh-components/{p-9d050177.entry.js → p-50c32fd1.entry.js} +2 -2
- package/dist/stzh-components/p-50c32fd1.entry.js.map +1 -0
- package/dist/stzh-components/p-5d9912f3.entry.js +2 -0
- package/dist/stzh-components/p-5d9912f3.entry.js.map +1 -0
- package/dist/stzh-components/p-cf4727ad.entry.js +2 -0
- package/dist/stzh-components/p-cf4727ad.entry.js.map +1 -0
- package/dist/stzh-components/p-e45e3147.js +2 -0
- package/dist/stzh-components/{p-49fcbbfb.js.map → p-e45e3147.js.map} +1 -1
- package/dist/stzh-components/p-f63a00c1.entry.js +2 -0
- package/dist/stzh-components/p-f63a00c1.entry.js.map +1 -0
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/dist/stzh-components/stzh-components.esm.js.map +1 -1
- package/dist/types/components/stzh-saptcha/stzh-saptcha.d.ts +4 -0
- package/dist/types/components/stzh-upload/stzh-upload.d.ts +1 -0
- package/dist/types/components/stzh-upload/stzh-upload.localization.d.ts +2 -0
- package/dist/types/index.d.ts +5 -5
- package/package.json +1 -1
- package/dist/cjs/stzh-dialog.cjs.entry.js.map +0 -1
- package/dist/cjs/stzh-toastbar.cjs.entry.js +0 -148
- package/dist/cjs/stzh-toastbar.cjs.entry.js.map +0 -1
- package/dist/cjs/translation-utils-18767769.js +0 -23
- package/dist/cjs/translation-utils-18767769.js.map +0 -1
- package/dist/components/translation-utils.js +0 -21
- package/dist/components/translation-utils.js.map +0 -1
- package/dist/esm/stzh-dialog.entry.js.map +0 -1
- package/dist/esm/stzh-toastbar.entry.js.map +0 -1
- package/dist/esm/translation-utils-ffb7823c.js +0 -21
- package/dist/esm/translation-utils-ffb7823c.js.map +0 -1
- package/dist/stzh-components/p-16581003.entry.js +0 -2
- package/dist/stzh-components/p-16581003.entry.js.map +0 -1
- package/dist/stzh-components/p-24feb79f.entry.js +0 -2
- package/dist/stzh-components/p-24feb79f.entry.js.map +0 -1
- package/dist/stzh-components/p-287f518f.entry.js +0 -2
- package/dist/stzh-components/p-287f518f.entry.js.map +0 -1
- package/dist/stzh-components/p-41529de9.js +0 -2
- package/dist/stzh-components/p-41529de9.js.map +0 -1
- package/dist/stzh-components/p-49fcbbfb.js +0 -2
- package/dist/stzh-components/p-9d050177.entry.js.map +0 -1
- package/dist/stzh-components/p-acd03caf.entry.js +0 -2
- package/dist/stzh-components/p-acd03caf.entry.js.map +0 -1
- package/dist/stzh-components/p-bb4dea97.entry.js +0 -2
- package/dist/stzh-components/p-bb4dea97.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"stzh-radiogroup2.js","mappings":";;;;;;;AAAA,MAAM,iBAAiB,GAAG,2pJAA2pJ;;ACUrrJ,MAAM,cAAc,GAAG,gDAAgD,CAAC;AAExE,IAAI,iBAAiB,GAAG,CAAC,CAAC;MAcb,cAAc;;;;IAoDjB,6BAAwB,GAAa,EAAE,CAAC;IA4GxC,gBAAW,GAAG;MACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;KAChC,CAAC;IAEM,SAAI,GAAG;;MAEb,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC;MAExE,IAAI,CAAC,oBAA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C,YAAY,CAAC,QAAQ,CAAC,mBAAmB,GACnE,CACH,CACQ,CACN,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/stzh-radiogroup/stzh-radiogroup.scss?tag=stzh-radiogroup&encapsulation=scoped","src/components/stzh-radiogroup/stzh-radiogroup.tsx"],"sourcesContent":[":host {\n &[disabled]:not([disabled=\"false\"]) {\n --description-color: #{$formDisabledColor};\n }\n}\n\n.stzh-radiogroup {\n @include input-description;\n margin: 0;\n padding: 0;\n border: none;\n\n &__fields {\n display: flex;\n align-items: flex-start;\n flex-direction: column;\n gap: space('medium');\n }\n\n &__legend {\n @include font('heavy');\n @include fontSize('micro');\n color: $headingColor;\n padding: 0;\n margin-bottom: space('xsmall');\n }\n\n &__marker {\n @include fontSize('nano');\n margin-left: calc(-0.25em + #{space('xsmall')});\n }\n\n &--hide-legend &__legend {\n @include visuallyhidden;\n }\n\n &--direction-horizontal &__fields {\n flex-wrap: wrap;\n flex-direction: row;\n row-gap: space('medium');\n column-gap: space('xxlarge');\n }\n}\n","import { Component, Element, h, Host, Listen, Prop, Watch } from \"@stencil/core\";\n\nimport { StzhRadioChangeEvent } from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { camelCase } from \"../../utils/string-utils\";\nimport { StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nimport { StzhInputDescription } from \"../stzh-input/stzh-input-description\";\n\nconst SELECTOR_RADIO = \"stzh-radio, stzh-button[type=radio], stzh-card\";\n\nlet radiogroupCounter = 0;\n\n/**\n * @slot - Slot for `stzh-radio`, `stzh-button[type=\"radio\"]` or `stzh-card` elements\n * @slot description - Slot for description\n * @slot description-long - Slot for long description (in popover)\n * @slot description-long-title - Slot for long description title (in popover) / instead of descriptionLongTitle or description property\n * @slot error - Slot for error\n */\n@Component({\n tag: \"stzh-radiogroup\",\n styleUrl: \"stzh-radiogroup.scss\",\n scoped: true,\n})\nexport class StzhRadiogroup {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** The name of the input radio elements, will define the radio group. If you have more than one radio group on a page, every group needs to have its own unique name */\n @Prop({ reflect: true }) name: string;\n\n /** The legend */\n @Prop() legend: string;\n\n /** Hide legend to show only for screenreaders */\n @Prop({ reflect: true }) hideLegend: boolean = false;\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Hide `(optional)` label (or use `required` inside form to hide it) */\n @Prop({ reflect: true }) hideOptional: boolean = false;\n\n /** Select a radio by value */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** Default value (used by reset) */\n @Prop({ mutable: true }) defaultValue: string = \"\";\n\n /** Direction */\n @Prop({ reflect: true }) direction: \"vertical\" | \"horizontal\" = \"vertical\";\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** Long description title appearing in a popover (use description-long-title slot as or description property alternative) */\n @Prop() descriptionLongTitle: string;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n private _error: string[];\n\n /** Current checked radio element (readonly) */\n @Prop() checkedRadio: HTMLStzhRadioElement | null = null;\n\n /** Prevent updating certain properties of radio elements (possible values inside array: disabled, invalid, required, hide-marker) */\n @Prop() preventUpdateProperties: string[] | string = [];\n private _preventUpdateProperties: string[] = [];\n\n /** Host element */\n @Element() element: HTMLElement;\n\n @Watch(\"name\")\n watchName(newValue: string) {\n this.updateRadiosProperty(\"name\", newValue);\n }\n\n @Watch(\"disabled\")\n watchDisabled(newValue: boolean) {\n this.updateRadiosProperty(\"disabled\", newValue);\n }\n\n @Watch(\"required\")\n watchRequired(newValue: boolean) {\n this.updateRadiosProperty(\"required\", newValue);\n }\n\n @Watch(\"value\")\n watchValue(newValue: string) {\n this.updateCheckedRadioByValue(newValue);\n }\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else if (newValue) {\n this._error = newValue;\n } else {\n this._error = [];\n }\n }\n\n @Watch(\"preventUpdateProperties\")\n preventUpdatePropertiesWatcher(newValue: string[] | string) {\n if (typeof newValue === \"string\") {\n this._preventUpdateProperties = JSON.parse(newValue);\n } else {\n this._preventUpdateProperties = newValue;\n }\n }\n\n @Listen(\"reset\", { target: \"document\" })\n resetListener(event: Event) {\n if ((event.target as HTMLElement).contains(this.element)) {\n requestAnimationFrame(() => {\n this.handleReset();\n });\n }\n }\n\n @Listen(\"stzhChange\")\n onChange(event: CustomEvent<StzhRadioChangeEvent>) {\n this.value = event.detail.value;\n }\n\n /** Radio elements */\n private radios: HTMLStzhRadioElement[];\n private radiogroupId: string;\n private observer: MutationObserver;\n\n private updateRadiosProperty(prop: string, value: any) {\n this.radios.forEach((radio: HTMLStzhRadioElement) => {\n if (prop === \"disabled\") {\n // Only set the disabled if the radio is not already disabled\n if (!radio.disabled) {\n radio.disabled = value;\n }\n } else if (prop === \"name\" || this._preventUpdateProperties.indexOf(prop) === -1) {\n radio[camelCase(prop)] = value;\n }\n });\n }\n\n private get errorUsed(): boolean {\n return hasSlot(this.element, \"error\") || this._error?.length > 0;\n }\n\n private updateCheckedRadioByValue(value: string) {\n this.checkedRadio = this.radios.find(radio => radio.value === value);\n\n if (this.checkedRadio) {\n this.checkedRadio.checked = true;\n }\n\n this.uncheckRadios();\n }\n\n private uncheckRadios() {\n // make sure that no other radios are checked than the current one or no one\n this.radios.forEach((radio: HTMLStzhRadioElement) => {\n if (!this.checkedRadio || radio !== this.checkedRadio) {\n radio.checked = false;\n }\n });\n }\n\n private handleReset = async () => {\n this.value = this.defaultValue;\n };\n\n private init = () => {\n // update radios\n this.radios = Array.from(this.element.querySelectorAll(SELECTOR_RADIO));\n\n this.updateRadiosProperty(\"hide-optional\", true);\n this.updateRadiosProperty(\"a11y-describedby\", `${this.radiogroupId}-description`);\n this.updateRadiosProperty(\"invalid\", this.invalid || this.errorUsed);\n\n this.watchValue(this.value);\n this.watchName(this.name);\n this.watchDisabled(this.disabled);\n this.watchRequired(this.required);\n };\n\n componentDidLoad() {\n this.defaultValue = this.defaultValue ? this.defaultValue : this.value;\n }\n\n async componentWillLoad() {\n this.radiogroupId = `stzh-radiogroup-${radiogroupCounter++}`;\n this.errorWatcher(this.error);\n this.preventUpdatePropertiesWatcher(this.preventUpdateProperties);\n\n if (!this.localization) {\n this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, \"radiogroup\");\n }\n }\n\n componentShouldUpdate(_newValue, _oldValue, prop: string) {\n return prop !== \"checkedRadio\";\n }\n\n componentDidRender() {\n this.init();\n }\n\n connectedCallback() {\n if (!this.value) {\n this.radios = Array.from(this.element.querySelectorAll(SELECTOR_RADIO));\n\n // try to find a checkbox that might has checked set to true\n const checkedRadio = this.radios.find(radio => radio.checked);\n\n if (checkedRadio) {\n this.value = checkedRadio.value;\n }\n }\n\n this.observer = new MutationObserver(this.init);\n this.observer.observe(this.element, {\n childList: true,\n subtree: true,\n });\n }\n\n disconnectedCallback() {\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n render() {\n const descriptionUsed = hasSlot(this.element, \"description\") || !!this.description;\n const descriptionLongUsed = hasSlot(this.element, \"description-long\") || !!this.descriptionLong;\n\n const classes = {\n \"stzh-radiogroup\": true,\n \"stzh-radiogroup--has-description\": descriptionUsed,\n \"stzh-radiogroup--has-description-long\": descriptionLongUsed,\n \"stzh-radiogroup--has-error\": this.errorUsed,\n \"stzh-radiogroup--is-required\": this.required,\n \"stzh-radiogroup--is-disabled\": this.disabled,\n \"stzh-radiogroup--is-invalid\": this.invalid || this.errorUsed,\n \"stzh-radiogroup--hide-legend\": this.hideLegend,\n [`stzh-radiogroup--direction-${this.direction}`]: !!this.direction,\n };\n\n return (\n <Host is-invalid={this.invalid || this.errorUsed}>\n <fieldset class={classes}>\n {this.legend && (\n <legend class=\"stzh-radiogroup__legend\">\n {this.legend}\n {!this.hideOptional && (\n <span class=\"stzh-radiogroup__marker\">\n <span class=\"stzh-radiogroup__marker-symbol\" aria-hidden=\"true\">\n {this.required\n ? this.localization.$globals.requiredFieldMarker\n : this.localization.$globals.optionalFieldMarker}\n </span>\n <span class=\"stzh-radiogroup__marker-text\">\n {this.required\n ? this.localization.$globals.requiredFieldText\n : this.localization.$globals.optionalFieldText}\n </span>\n </span>\n )}\n </legend>\n )}\n <div class=\"stzh-radiogroup__fields\">\n <slot></slot>\n </div>\n {(this._error?.length > 0 || this.description) && (\n <StzhInputDescription\n classPrefix=\"stzh-radiogroup\"\n id={`${this.radiogroupId}-description`}\n error={this._error}\n description={this.description}\n descriptionLong={this.descriptionLong}\n descriptionLongTitle={this.descriptionLongTitle}\n descriptionLongUsed={descriptionLongUsed}\n moreInfoButtonLabel={this.localization.$globals.moreInfoButtonLabel}\n />\n )}\n </fieldset>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"stzh-radiogroup2.js","mappings":";;;;;;;AAAA,MAAM,iBAAiB,GAAG,8+JAA8+J;;ACUxgK,MAAM,cAAc,GAAG,gDAAgD,CAAC;AAExE,IAAI,iBAAiB,GAAG,CAAC,CAAC;MAcb,cAAc;;;;IAoDjB,6BAAwB,GAAa,EAAE,CAAC;IA4GxC,gBAAW,GAAG;MACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;KAChC,CAAC;IAEM,SAAI,GAAG;;MAEb,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC;MAExE,IAAI,CAAC,oBAAoB,CAAC,eAAe,EAAE,IAAI,CAAC,CA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GACnE,CACH,CACQ,CACN,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/stzh-radiogroup/stzh-radiogroup.scss?tag=stzh-radiogroup&encapsulation=scoped","src/components/stzh-radiogroup/stzh-radiogroup.tsx"],"sourcesContent":[":host {\n &[disabled]:not([disabled=\"false\"]) {\n --description-color: #{$formDisabledColor};\n }\n}\n\n.stzh-radiogroup {\n @include input-description;\n margin: 0;\n padding: 0;\n border: none;\n\n &__fields {\n display: flex;\n align-items: flex-start;\n flex-direction: column;\n gap: space('medium');\n }\n\n &__legend {\n @include font('heavy');\n @include fontSize('micro');\n color: $headingColor;\n padding: 0;\n margin-bottom: space('xsmall');\n }\n\n &__marker {\n @include fontSize('nano');\n margin-left: calc(-0.25em + #{space('xsmall')});\n }\n\n &--hide-legend &__legend {\n @include visuallyhidden;\n }\n\n &--is-invalid &__legend,\n &--has-error &__legend {\n color: $colorError60;\n }\n\n &--is-disabled &__legend {\n color: $colorGrey60;\n }\n\n &--direction-horizontal &__fields {\n flex-wrap: wrap;\n flex-direction: row;\n row-gap: space('medium');\n column-gap: space('xxlarge');\n }\n}\n","import { Component, Element, h, Host, Listen, Prop, Watch } from \"@stencil/core\";\n\nimport { StzhRadioChangeEvent } from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { camelCase } from \"../../utils/string-utils\";\nimport { StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nimport { StzhInputDescription } from \"../stzh-input/stzh-input-description\";\n\nconst SELECTOR_RADIO = \"stzh-radio, stzh-button[type=radio], stzh-card\";\n\nlet radiogroupCounter = 0;\n\n/**\n * @slot - Slot for `stzh-radio`, `stzh-button[type=\"radio\"]` or `stzh-card` elements\n * @slot description - Slot for description\n * @slot description-long - Slot for long description (in popover)\n * @slot description-long-title - Slot for long description title (in popover) / instead of descriptionLongTitle or description property\n * @slot error - Slot for error\n */\n@Component({\n tag: \"stzh-radiogroup\",\n styleUrl: \"stzh-radiogroup.scss\",\n scoped: true,\n})\nexport class StzhRadiogroup {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** The name of the input radio elements, will define the radio group. If you have more than one radio group on a page, every group needs to have its own unique name */\n @Prop({ reflect: true }) name: string;\n\n /** The legend */\n @Prop() legend: string;\n\n /** Hide legend to show only for screenreaders */\n @Prop({ reflect: true }) hideLegend: boolean = false;\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Hide `(optional)` label (or use `required` inside form to hide it) */\n @Prop({ reflect: true }) hideOptional: boolean = false;\n\n /** Select a radio by value */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** Default value (used by reset) */\n @Prop({ mutable: true }) defaultValue: string = \"\";\n\n /** Direction */\n @Prop({ reflect: true }) direction: \"vertical\" | \"horizontal\" = \"vertical\";\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** Long description title appearing in a popover (use description-long-title slot as or description property alternative) */\n @Prop() descriptionLongTitle: string;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n private _error: string[];\n\n /** Current checked radio element (readonly) */\n @Prop() checkedRadio: HTMLStzhRadioElement | null = null;\n\n /** Prevent updating certain properties of radio elements (possible values inside array: disabled, invalid, required, hide-marker) */\n @Prop() preventUpdateProperties: string[] | string = [];\n private _preventUpdateProperties: string[] = [];\n\n /** Host element */\n @Element() element: HTMLElement;\n\n @Watch(\"name\")\n watchName(newValue: string) {\n this.updateRadiosProperty(\"name\", newValue);\n }\n\n @Watch(\"disabled\")\n watchDisabled(newValue: boolean) {\n this.updateRadiosProperty(\"disabled\", newValue);\n }\n\n @Watch(\"required\")\n watchRequired(newValue: boolean) {\n this.updateRadiosProperty(\"required\", newValue);\n }\n\n @Watch(\"value\")\n watchValue(newValue: string) {\n this.updateCheckedRadioByValue(newValue);\n }\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else if (newValue) {\n this._error = newValue;\n } else {\n this._error = [];\n }\n }\n\n @Watch(\"preventUpdateProperties\")\n preventUpdatePropertiesWatcher(newValue: string[] | string) {\n if (typeof newValue === \"string\") {\n this._preventUpdateProperties = JSON.parse(newValue);\n } else {\n this._preventUpdateProperties = newValue;\n }\n }\n\n @Listen(\"reset\", { target: \"document\" })\n resetListener(event: Event) {\n if ((event.target as HTMLElement).contains(this.element)) {\n requestAnimationFrame(() => {\n this.handleReset();\n });\n }\n }\n\n @Listen(\"stzhChange\")\n onChange(event: CustomEvent<StzhRadioChangeEvent>) {\n this.value = event.detail.value;\n }\n\n /** Radio elements */\n private radios: HTMLStzhRadioElement[];\n private radiogroupId: string;\n private observer: MutationObserver;\n\n private updateRadiosProperty(prop: string, value: any) {\n this.radios.forEach((radio: HTMLStzhRadioElement) => {\n if (prop === \"disabled\") {\n // Only set the disabled if the radio is not already disabled\n if (!radio.disabled) {\n radio.disabled = value;\n }\n } else if (prop === \"name\" || this._preventUpdateProperties.indexOf(prop) === -1) {\n radio[camelCase(prop)] = value;\n }\n });\n }\n\n private get errorUsed(): boolean {\n return hasSlot(this.element, \"error\") || this._error?.length > 0;\n }\n\n private updateCheckedRadioByValue(value: string) {\n this.checkedRadio = this.radios.find(radio => radio.value === value);\n\n if (this.checkedRadio) {\n this.checkedRadio.checked = true;\n }\n\n this.uncheckRadios();\n }\n\n private uncheckRadios() {\n // make sure that no other radios are checked than the current one or no one\n this.radios.forEach((radio: HTMLStzhRadioElement) => {\n if (!this.checkedRadio || radio !== this.checkedRadio) {\n radio.checked = false;\n }\n });\n }\n\n private handleReset = async () => {\n this.value = this.defaultValue;\n };\n\n private init = () => {\n // update radios\n this.radios = Array.from(this.element.querySelectorAll(SELECTOR_RADIO));\n\n this.updateRadiosProperty(\"hide-optional\", true);\n this.updateRadiosProperty(\"a11y-describedby\", `${this.radiogroupId}-description`);\n this.updateRadiosProperty(\"invalid\", this.invalid || this.errorUsed);\n\n this.watchValue(this.value);\n this.watchName(this.name);\n this.watchDisabled(this.disabled);\n this.watchRequired(this.required);\n };\n\n componentDidLoad() {\n this.defaultValue = this.defaultValue ? this.defaultValue : this.value;\n }\n\n async componentWillLoad() {\n this.radiogroupId = `stzh-radiogroup-${radiogroupCounter++}`;\n this.errorWatcher(this.error);\n this.preventUpdatePropertiesWatcher(this.preventUpdateProperties);\n\n if (!this.localization) {\n this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, \"radiogroup\");\n }\n }\n\n componentShouldUpdate(_newValue, _oldValue, prop: string) {\n return prop !== \"checkedRadio\";\n }\n\n componentDidRender() {\n this.init();\n }\n\n connectedCallback() {\n if (!this.value) {\n this.radios = Array.from(this.element.querySelectorAll(SELECTOR_RADIO));\n\n // try to find a checkbox that might has checked set to true\n const checkedRadio = this.radios.find(radio => radio.checked);\n\n if (checkedRadio) {\n this.value = checkedRadio.value;\n }\n }\n\n this.observer = new MutationObserver(this.init);\n this.observer.observe(this.element, {\n childList: true,\n subtree: true,\n });\n }\n\n disconnectedCallback() {\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n render() {\n const descriptionUsed = hasSlot(this.element, \"description\") || !!this.description;\n const descriptionLongUsed = hasSlot(this.element, \"description-long\") || !!this.descriptionLong;\n\n const classes = {\n \"stzh-radiogroup\": true,\n \"stzh-radiogroup--has-description\": descriptionUsed,\n \"stzh-radiogroup--has-description-long\": descriptionLongUsed,\n \"stzh-radiogroup--has-error\": this.errorUsed,\n \"stzh-radiogroup--is-required\": this.required,\n \"stzh-radiogroup--is-disabled\": this.disabled,\n \"stzh-radiogroup--is-invalid\": this.invalid || this.errorUsed,\n \"stzh-radiogroup--hide-legend\": this.hideLegend,\n [`stzh-radiogroup--direction-${this.direction}`]: !!this.direction,\n };\n\n return (\n <Host is-invalid={this.invalid || this.errorUsed}>\n <fieldset class={classes}>\n {this.legend && (\n <legend class=\"stzh-radiogroup__legend\">\n {this.legend}\n {!this.hideOptional && (\n <span class=\"stzh-radiogroup__marker\">\n <span class=\"stzh-radiogroup__marker-symbol\" aria-hidden=\"true\">\n {this.required\n ? this.localization.$globals.requiredFieldMarker\n : this.localization.$globals.optionalFieldMarker}\n </span>\n <span class=\"stzh-radiogroup__marker-text\">\n {this.required\n ? this.localization.$globals.requiredFieldText\n : this.localization.$globals.optionalFieldText}\n </span>\n </span>\n )}\n </legend>\n )}\n <div class=\"stzh-radiogroup__fields\">\n <slot></slot>\n </div>\n {(this._error?.length > 0 || this.description) && (\n <StzhInputDescription\n classPrefix=\"stzh-radiogroup\"\n id={`${this.radiogroupId}-description`}\n error={this._error}\n description={this.description}\n descriptionLong={this.descriptionLong}\n descriptionLongTitle={this.descriptionLongTitle}\n descriptionLongUsed={descriptionLongUsed}\n moreInfoButtonLabel={this.localization.$globals.moreInfoButtonLabel}\n />\n )}\n </fieldset>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -21,6 +21,10 @@ const StzhSaptcha$1 = /*@__PURE__*/ proxyCustomElement(class StzhSaptcha extends
|
|
|
21
21
|
this.error = undefined;
|
|
22
22
|
this.invalid = false;
|
|
23
23
|
this.disabled = false;
|
|
24
|
+
this.inputValue = "";
|
|
25
|
+
}
|
|
26
|
+
valueWatcher(newValue) {
|
|
27
|
+
this.inputValue = newValue;
|
|
24
28
|
}
|
|
25
29
|
numbersWatcher(newValue) {
|
|
26
30
|
if (typeof newValue === "string") {
|
|
@@ -51,6 +55,9 @@ const StzhSaptcha$1 = /*@__PURE__*/ proxyCustomElement(class StzhSaptcha extends
|
|
|
51
55
|
this._error = [];
|
|
52
56
|
}
|
|
53
57
|
}
|
|
58
|
+
componentDidLoad() {
|
|
59
|
+
this.inputValue = this.value;
|
|
60
|
+
}
|
|
54
61
|
async componentWillLoad() {
|
|
55
62
|
this.saptchaId = `stzh-saptcha-${saptchaCounter++}`;
|
|
56
63
|
this.numbersWatcher(this.numbers);
|
|
@@ -66,10 +73,11 @@ const StzhSaptcha$1 = /*@__PURE__*/ proxyCustomElement(class StzhSaptcha extends
|
|
|
66
73
|
return (h(Host, { "is-invalid": this.invalid || this._error.length > 0 }, h("div", { class: classes }, h("div", { class: "stzh-saptcha__box" }, h("div", { class: "stzh-saptcha__info", id: `${this.saptchaId}-info` }, this.localization.info, " ", this.localization.question), h("div", { class: "stzh-saptcha__answer", id: `${this.saptchaId}-answer` }, this._numbers.map((number, index) => h("span", { class: "stzh-saptcha__number" }, number, index < this._numbers.length - 1 &&
|
|
67
74
|
(index === this._numbers.length - 2
|
|
68
75
|
? this.localization.answerOr
|
|
69
|
-
: ", ")))), h("stzh-input", { class: "stzh-saptcha__input", label: this.localization.answer, name: this.name, invalid: this.invalid, error: this.error, disabled: this.disabled, value: this.
|
|
76
|
+
: ", ")))), h("stzh-input", { class: "stzh-saptcha__input", label: this.localization.answer, name: this.name, invalid: this.invalid, error: this.error, disabled: this.disabled, value: this.inputValue, required: true, a11yDescribedby: `${this.saptchaId}-info ${this.saptchaId}-answer` })))));
|
|
70
77
|
}
|
|
71
78
|
get element() { return this; }
|
|
72
79
|
static get watchers() { return {
|
|
80
|
+
"value": ["valueWatcher"],
|
|
73
81
|
"numbers": ["numbersWatcher"],
|
|
74
82
|
"error": ["errorWatcher"]
|
|
75
83
|
}; }
|
|
@@ -81,8 +89,10 @@ const StzhSaptcha$1 = /*@__PURE__*/ proxyCustomElement(class StzhSaptcha extends
|
|
|
81
89
|
"name": [513],
|
|
82
90
|
"error": [1],
|
|
83
91
|
"invalid": [516],
|
|
84
|
-
"disabled": [516]
|
|
92
|
+
"disabled": [516],
|
|
93
|
+
"inputValue": [32]
|
|
85
94
|
}, undefined,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ACN,kBACE,KAAK,EAAC,qBAAqB,EAC3B,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAC/B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAE,IAAI,CAAC,UAAU,EACtB,QAAQ,QACR,eAAe,EAAE,GAAG,IAAI,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,SAAS,GACtD,CACV,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["StzhSaptcha"],"sources":["src/components/stzh-saptcha/stzh-saptcha.scss?tag=stzh-saptcha&encapsulation=scoped","src/components/stzh-saptcha/stzh-saptcha.tsx"],"sourcesContent":["/**\n * @prop --color: Color of section\n * @prop --background-color: Background color of section\n */\n\n:host {\n --color: #{$colorBlack};\n --background-color: #{$colorGrey10};\n}\n\n.stzh-saptcha {\n &__box {\n @include spaceCurve('padding-top', 'regular');\n @include spaceCurve('padding-bottom', 'medium');\n padding-left: space('medium');\n padding-right: space('medium');\n color: var(--color);\n background-color: var(--background-color);\n\n @include mq($from: medium) {\n padding-left: space('large');\n padding-right: space('large');\n }\n }\n\n &__info {\n @include fontSize('milli');\n }\n\n &__answer {\n @include fontSize('regular');\n color: $colorPrimary;\n margin-top: space('xsmall');\n }\n\n &__input {\n margin-top: space('medium');\n }\n}\n","import {\n Component,\n Host,\n h,\n Element,\n Prop,\n Watch,\n State\n} from \"@stencil/core\";\n\nimport { StzhSaptchaLocalizedText } from './stzh-saptcha.localization';\n\nlet saptchaCounter = 0;\n\n/**\n * @slot - Slot for content\n */\n@Component({\n tag: \"stzh-saptcha\",\n styleUrl: \"stzh-saptcha.scss\",\n scoped: true\n})\nexport class StzhSaptcha {\n /** Translation strings */\n @Prop() localization: StzhSaptchaLocalizedText;\n\n /** Numbers shown to user for selection */\n @Prop() numbers: number[] | string = [];\n private _numbers: number[] = [];\n\n /** The value of the input element */\n @Prop() value: string = \"\";\n\n /** Name of input */\n @Prop({ reflect: true }) name: string = \"saptcha\";\n\n /** One or multiple error message */\n @Prop() error: string | string[];\n private _error: string[];\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Mutable input state updated by the value prop */\n @State() inputValue: string = \"\";\n\n @Element() element: HTMLStzhSaptchaElement;\n\n @Watch('value')\n valueWatcher(newValue: string) {\n this.inputValue = newValue;\n }\n\n @Watch(\"numbers\")\n numbersWatcher(newValue: number[] | string) {\n if (typeof newValue === \"string\") {\n this._numbers = JSON.parse(newValue);\n } else {\n this._numbers = newValue;\n }\n }\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else if (newValue) {\n this._error = newValue;\n } else {\n this._error = [];\n }\n }\n\n private saptchaId: string;\n\n componentDidLoad() {\n this.inputValue = this.value;\n }\n\n async componentWillLoad() {\n this.saptchaId = `stzh-saptcha-${saptchaCounter++}`;\n\n this.numbersWatcher(this.numbers);\n this.errorWatcher(this.error);\n\n if (!this.localization) {\n this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, 'saptcha');\n }\n }\n\n render() {\n const classes = {\n \"stzh-saptcha\": true\n };\n\n return (\n <Host is-invalid={this.invalid || this._error.length > 0}>\n <div class={classes}>\n <div class=\"stzh-saptcha__box\">\n <div class=\"stzh-saptcha__info\" id={`${this.saptchaId}-info`}>\n {this.localization.info} {this.localization.question}\n </div>\n <div class=\"stzh-saptcha__answer\" id={`${this.saptchaId}-answer`}>\n {this._numbers.map((number, index) =>\n <span class=\"stzh-saptcha__number\">\n {number}\n {index < this._numbers.length - 1 &&\n (index === this._numbers.length - 2\n ? this.localization.answerOr\n : \", \")\n }\n </span>\n )}\n </div>\n <stzh-input\n class=\"stzh-saptcha__input\"\n label={this.localization.answer}\n name={this.name}\n invalid={this.invalid}\n error={this.error}\n disabled={this.disabled}\n value={this.inputValue}\n required\n a11yDescribedby={`${this.saptchaId}-info ${this.saptchaId}-answer`}\n ></stzh-input>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,188 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { j as js_cookie } from './js.cookie.js';
|
|
3
|
-
import { d as defineCustomElement$5 } from './stzh-badge2.js';
|
|
4
|
-
import { d as defineCustomElement$4 } from './stzh-button2.js';
|
|
5
|
-
import { d as defineCustomElement$3 } from './stzh-icon2.js';
|
|
6
|
-
import { d as defineCustomElement$2 } from './stzh-toast2.js';
|
|
7
|
-
|
|
8
|
-
const stzhToastbarCss = ":host{font-family:var(--stzh-font-family-medium);font-weight:var(--stzh-font-weight-medium);font-style:var(--stzh-font-style-medium);color:var(--stzh-base-color);box-sizing:border-box;display:block;}:host[hidden]{display:none}:host::-moz-selection{color:var(--stzh-selection-color);background-color:var(--stzh-selection-background-color)}:host::selection{color:var(--stzh-selection-color);background-color:var(--stzh-selection-background-color)}:host *,:host *::before,:host *::after{box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness);-webkit-text-decoration-skip-ink:var(--stzh-link-text-decoration-skip-ink);text-decoration-skip-ink:var(--stzh-link-text-decoration-skip-ink)}:host .has-focus{outline:var(--stzh-flyingfocus-color) solid 0.125rem;outline-offset:0.125rem}:host .stzh-fylingfocus-focused{outline-style:none !important}:host .stzh-fylingfocus-focused::-moz-focus-inner{border:0 !important}:host{bottom:var(--stzh-space-medium);z-index:var(--stzh-z-index-overlay);position:fixed;pointer-events:none;left:1.25rem;right:1.25rem;bottom:calc( var(--stzh-pagetitle-disturber-stuck-height, 0px) + var(--stzh-sticky-cta-stuck-bottom-height, 0px) )}@media screen and (min-width: 600px){:host{bottom:var(--stzh-space-large)}}@media screen and (min-width: 900px){:host{bottom:var(--stzh-space-xlarge)}}@media screen and (min-width: 1260px){:host{bottom:var(--stzh-space-xxlarge)}}@media screen and (min-width: 600px){:host{left:2rem;right:auto;max-width:26.8125rem}}@media screen and (min-width: 900px){:host{left:2.5rem;max-width:27.5rem}}@media screen and (min-width: 1260px){:host{left:4rem;max-width:30.3125rem}}@media screen and (min-width: 1600px){:host{left:calc((100vw - 84.25rem - var(--stzh-scrollbar-width, 0px)) / 2);max-width:34.625rem}}:host ::slotted(*:not([hidden]):not([slot])){margin-bottom:var(--stzh-space-small)}.stzh-toastbar{display:flex;flex-direction:column;justify-content:flex-end}@media screen and (min-width: 600px){.stzh-toastbar{align-items:flex-start}}";
|
|
9
|
-
|
|
10
|
-
const KEY_PREFIX_CLOSED = "stzh-components-toastbar-closed";
|
|
11
|
-
const StzhToastbar$1 = /*@__PURE__*/ proxyCustomElement(class StzhToastbar extends HTMLElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
this.__registerHost();
|
|
15
|
-
this.__attachShadow();
|
|
16
|
-
this._initialToasts = [];
|
|
17
|
-
this.handleSlotchange = () => {
|
|
18
|
-
this.toastsAppended();
|
|
19
|
-
this.hideOverflowingItems();
|
|
20
|
-
};
|
|
21
|
-
this.hideAfter = 30;
|
|
22
|
-
this.max = 5;
|
|
23
|
-
this.initialToasts = [];
|
|
24
|
-
}
|
|
25
|
-
/** Create new toast. */
|
|
26
|
-
async toast(label, { type, link } = { type: "info" }) {
|
|
27
|
-
const toast = document.createElement("stzh-toast");
|
|
28
|
-
toast.hidden = true;
|
|
29
|
-
toast.label = label;
|
|
30
|
-
toast.role = "alert";
|
|
31
|
-
toast.type = type || "info";
|
|
32
|
-
toast.initialOpenAnimation = true;
|
|
33
|
-
if (link) {
|
|
34
|
-
link.slot = "link";
|
|
35
|
-
link.size = "small";
|
|
36
|
-
toast.appendChild(link);
|
|
37
|
-
}
|
|
38
|
-
this.element.appendChild(toast);
|
|
39
|
-
return toast;
|
|
40
|
-
}
|
|
41
|
-
initialToastsWatcher(newValue) {
|
|
42
|
-
if (typeof newValue === "string") {
|
|
43
|
-
this._initialToasts = JSON.parse(newValue);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this._initialToasts = newValue;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
toastAppended(toast) {
|
|
50
|
-
if (toast.getAttribute('data-stzh-toastbar-managed')) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
toast.setAttribute('data-stzh-toastbar-managed', '');
|
|
54
|
-
toast.addEventListener("stzhClosed", () => {
|
|
55
|
-
toast.remove();
|
|
56
|
-
});
|
|
57
|
-
if (toast.type !== "error") {
|
|
58
|
-
let timeoutStarted = new Date().getTime();
|
|
59
|
-
let restTime = this.hideAfter * 1000;
|
|
60
|
-
let currentTimeout = window.setTimeout(() => {
|
|
61
|
-
toast.hide();
|
|
62
|
-
}, restTime);
|
|
63
|
-
toast.addEventListener("pointerenter", () => {
|
|
64
|
-
if (currentTimeout) {
|
|
65
|
-
window.clearTimeout(currentTimeout);
|
|
66
|
-
const timePassed = new Date().getTime() - timeoutStarted;
|
|
67
|
-
restTime = restTime - timePassed;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
toast.addEventListener("pointerleave", () => {
|
|
71
|
-
timeoutStarted = new Date().getTime();
|
|
72
|
-
currentTimeout = window.setTimeout(() => {
|
|
73
|
-
toast.hide();
|
|
74
|
-
}, restTime);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
toastsAppended() {
|
|
79
|
-
var _a;
|
|
80
|
-
const host = ((_a = this.element.getRootNode()) === null || _a === void 0 ? void 0 : _a.host) || this.element;
|
|
81
|
-
Array.from(host.children).forEach((toast) => {
|
|
82
|
-
this.toastAppended(toast);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
hideOverflowingItems() {
|
|
86
|
-
var _a;
|
|
87
|
-
const host = ((_a = this.element.getRootNode()) === null || _a === void 0 ? void 0 : _a.host) || this.element;
|
|
88
|
-
const childCount = host.children.length;
|
|
89
|
-
Array.from(host.children)
|
|
90
|
-
.splice(0, childCount - this.max)
|
|
91
|
-
.forEach((toast) => {
|
|
92
|
-
toast.hide();
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
componentWillLoad() {
|
|
96
|
-
this.initialToastsWatcher(this.initialToasts);
|
|
97
|
-
}
|
|
98
|
-
componentDidLoad() {
|
|
99
|
-
this._initialToasts.forEach(async (data) => {
|
|
100
|
-
if (data.cookie) {
|
|
101
|
-
const alreadyClosedBefore = js_cookie.get(`${KEY_PREFIX_CLOSED}-${data.cookie}`);
|
|
102
|
-
if (alreadyClosedBefore) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
let link = data.link;
|
|
107
|
-
if (!(link instanceof HTMLElement)) {
|
|
108
|
-
const generatedLink = document.createElement("stzh-button");
|
|
109
|
-
generatedLink.slot = "link";
|
|
110
|
-
generatedLink.size = "small";
|
|
111
|
-
Object.assign(generatedLink, data.link);
|
|
112
|
-
link = generatedLink;
|
|
113
|
-
}
|
|
114
|
-
const toast = await this.toast(data.label, {
|
|
115
|
-
type: data.type,
|
|
116
|
-
link: link
|
|
117
|
-
});
|
|
118
|
-
if (data.cookie) {
|
|
119
|
-
let cookieExpires = 365;
|
|
120
|
-
if (data.cookieExpires === 0) {
|
|
121
|
-
cookieExpires = null;
|
|
122
|
-
}
|
|
123
|
-
else if (data.cookieExpires) {
|
|
124
|
-
cookieExpires = data.cookieExpires;
|
|
125
|
-
}
|
|
126
|
-
toast.addEventListener("stzhClosed", () => {
|
|
127
|
-
js_cookie.set(`${KEY_PREFIX_CLOSED}-${data.cookie}`, '1', {
|
|
128
|
-
expires: cookieExpires
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
render() {
|
|
135
|
-
const classes = {
|
|
136
|
-
"stzh-toastbar": true,
|
|
137
|
-
};
|
|
138
|
-
return (h(Host, null, h("div", { class: classes }, h("slot", { onSlotchange: this.handleSlotchange }))));
|
|
139
|
-
}
|
|
140
|
-
get element() { return this; }
|
|
141
|
-
static get watchers() { return {
|
|
142
|
-
"initialToasts": ["initialToastsWatcher"]
|
|
143
|
-
}; }
|
|
144
|
-
static get style() { return stzhToastbarCss; }
|
|
145
|
-
}, [1, "stzh-toastbar", {
|
|
146
|
-
"hideAfter": [2, "hide-after"],
|
|
147
|
-
"max": [2],
|
|
148
|
-
"initialToasts": [1, "initial-toasts"],
|
|
149
|
-
"toast": [64]
|
|
150
|
-
}, undefined, {
|
|
151
|
-
"initialToasts": ["initialToastsWatcher"]
|
|
152
|
-
}]);
|
|
153
|
-
function defineCustomElement$1() {
|
|
154
|
-
if (typeof customElements === "undefined") {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const components = ["stzh-toastbar", "stzh-badge", "stzh-button", "stzh-icon", "stzh-toast"];
|
|
158
|
-
components.forEach(tagName => { switch (tagName) {
|
|
159
|
-
case "stzh-toastbar":
|
|
160
|
-
if (!customElements.get(tagName)) {
|
|
161
|
-
customElements.define(tagName, StzhToastbar$1);
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
|
-
case "stzh-badge":
|
|
165
|
-
if (!customElements.get(tagName)) {
|
|
166
|
-
defineCustomElement$5();
|
|
167
|
-
}
|
|
168
|
-
break;
|
|
169
|
-
case "stzh-button":
|
|
170
|
-
if (!customElements.get(tagName)) {
|
|
171
|
-
defineCustomElement$4();
|
|
172
|
-
}
|
|
173
|
-
break;
|
|
174
|
-
case "stzh-icon":
|
|
175
|
-
if (!customElements.get(tagName)) {
|
|
176
|
-
defineCustomElement$3();
|
|
177
|
-
}
|
|
178
|
-
break;
|
|
179
|
-
case "stzh-toast":
|
|
180
|
-
if (!customElements.get(tagName)) {
|
|
181
|
-
defineCustomElement$2();
|
|
182
|
-
}
|
|
183
|
-
break;
|
|
184
|
-
} });
|
|
185
|
-
}
|
|
1
|
+
import { S as StzhToastbar$1, d as defineCustomElement$1 } from './stzh-toastbar2.js';
|
|
186
2
|
|
|
187
3
|
const StzhToastbar = StzhToastbar$1;
|
|
188
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"stzh-toastbar.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,0iEAA0iE;;ACiBlkE,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;MAU/CA,cAAY;;;;;IAuBf,mBAAc,GAA+B,EAAE,CAAC;IA0FhD,qBAAgB,GAAG;MACzB,IAAI,CAAC,cAAc,EAAE,CAAC;MACtB,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAC7B,CAAA;qBA/G2B,EAAE;eAMR,CAAC;yBAWsC,EAAE;;;EAO/D,MAAM,KAAK,CACT,KAAa,EACb,EAAE,IAAI,EAAE,IAAI,KAA6D,EAAE,IAAI,EAAE,MAAM,EAAE;IAEzF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACnD,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;IACrB,KAAK,CAAC,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;IAC5B,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAElC,IAAI,IAAI,EAAE;MACR,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;MACnB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;MACpB,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;KACzB;IAED,IAAI,CAAC,OAAO,CAAC,WAAW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,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAC5D,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC;QAC5B,aAAa,CAAC,IAAI,GAAG,OAAO,CAAC;QAE7B,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,GAAG,aAAa,CAAC;OACtB;MAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE;QACzC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAA6B;OACpC,CAAC,CAAA;MAEF,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,IAAI,aAAa,GAAG,GAAG,CAAC;QAExB,IAAI,IAAI,CAAC,aAAa,KAAK,CAAC,EAAE;UAC5B,aAAa,GAAG,IAAI,CAAC;SACtB;aAAM,IAAI,IAAI,CAAC,aAAa,EAAE;UAC7B,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;SACpC;QAED,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE;UACnCA,SAAM,CAAC,GAAG,CAAC,GAAG,iBAAiB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE;YACrD,OAAO,EAAE,aAAa;WACvB,CAAC,CAAC;SACJ,CAAC,CAAC;OACJ;KACF,CAAC,CAAA;GACH;EAED,MAAM;IACJ,MAAM,OAAO,GAAG;MACd,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,QACE,EAAC,IAAI,QACH,WAAK,KAAK,EAAE,OAAO,IACjB,YAAM,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAS,CAC9C,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["StzhToastbar","Cookie"],"sources":["src/components/stzh-toastbar/stzh-toastbar.scss?tag=stzh-toastbar&encapsulation=shadow","src/components/stzh-toastbar/stzh-toastbar.tsx"],"sourcesContent":[":host {\n @include spaceCurve('bottom', 'regular');\n z-index: $zIndexOverlay;\n position: fixed;\n pointer-events: none;\n left: $containerMargin;\n right: $containerMargin;\n bottom: calc(\n var(--stzh-pagetitle-disturber-stuck-height, 0px)\n + var(--stzh-sticky-cta-stuck-bottom-height, 0px)\n );\n\n @include mq($from: small) {\n left: $containerMarginSmall;\n right: auto;\n max-width: 429px;\n }\n\n @include mq($from: medium) {\n left: $containerMarginMedium;\n max-width: 440px;\n }\n\n @include mq($from: large) {\n left: $containerMarginLarge;\n max-width: 485px;\n }\n\n @include mq($from: ultra) {\n left: calc((100vw - #{$containerMaxWidth} - var(--stzh-scrollbar-width, 0px)) / 2);\n max-width: 554px;\n }\n\n ::slotted(*:not([hidden]):not([slot])) {\n margin-bottom: space('small');\n }\n}\n\n.stzh-toastbar {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n\n @include mq($from: small) {\n align-items: flex-start;\n }\n}\n","import {\n Component,\n Host,\n h,\n Element,\n Prop,\n Method,\n Watch,\n} from \"@stencil/core\";\n\nimport {\n StzhToastbarInitialToast,\n StzhToastType,\n} from \"../../index\";\n\nimport Cookie from \"js-cookie\";\n\nconst KEY_PREFIX_CLOSED = \"stzh-components-toastbar-closed\";\n\n/**\n * @slot - Slot for stzh-toast elements\n */\n@Component({\n tag: \"stzh-toastbar\",\n styleUrl: \"stzh-toastbar.scss\",\n shadow: true\n})\nexport class StzhToastbar {\n /**\n * Time after toasts are hidden (in seconds).\n * Toasts with type `error` will stay, until the user closes them manually.\n */\n @Prop() hideAfter: number = 30;\n\n /**\n * Maximum of toasts allowed to be shown.\n * If more are created, oldest will be hidden, even if timeout not ended yet or toast type is `error`.\n */\n @Prop() max: number = 5;\n\n /**\n * Initial toasts.\n *\n * Array of objects that at least includes `label` and optionally `type`, `link` (object with `href` and `label`) `cookie` and `cookieExpires`:\n * `[{\"label\": \"Lorem ipsum\", \"link\": { \"label\": \"More info\", \"href\": \"https://example.com\" }, \"cookie\": \"cookie-banner\", \"cookieExpires\": 365 }]`\n *\n * If `cookie` exists in an object, it will check for that cookie name first (prefixed with `stzh-components-toastbar-closed-`) and only show if cookie doesn't exist.\n * `cookieExpires` sets the cookie lifetime (default 365 days, set 0 for session cookie).\n */\n @Prop() initialToasts: StzhToastbarInitialToast[] | string = [];\n private _initialToasts: StzhToastbarInitialToast[] = [];\n\n @Element() element: HTMLStzhToastbarElement;\n\n /** Create new toast. */\n @Method()\n async toast(\n label: string,\n { type, link }: { type?: StzhToastType, link?: HTMLStzhButtonElement } = { type: \"info\" }\n ): Promise<HTMLStzhToastElement> {\n const toast = document.createElement(\"stzh-toast\");\n toast.hidden = true;\n toast.label = label;\n toast.role = \"alert\";\n toast.type = type || \"info\";\n toast.initialOpenAnimation = true;\n\n if (link) {\n link.slot = \"link\";\n link.size = \"small\";\n toast.appendChild(link);\n }\n\n this.element.appendChild(toast);\n\n return toast;\n }\n\n @Watch(\"initialToasts\")\n initialToastsWatcher(newValue: any[] | string) {\n if (typeof newValue === \"string\") {\n this._initialToasts = JSON.parse(newValue);\n } else {\n this._initialToasts = newValue;\n }\n }\n\n private toastAppended(toast: HTMLStzhToastElement) {\n if (toast.getAttribute('data-stzh-toastbar-managed')) {\n return;\n }\n\n toast.setAttribute('data-stzh-toastbar-managed', '');\n\n toast.addEventListener(\"stzhClosed\", () => {\n toast.remove();\n });\n\n if (toast.type !== \"error\") {\n let timeoutStarted = new Date().getTime();\n let restTime = this.hideAfter * 1000;\n let currentTimeout = window.setTimeout(() => {\n toast.hide();\n }, restTime);\n\n toast.addEventListener(\"pointerenter\", () => {\n if (currentTimeout) {\n window.clearTimeout(currentTimeout);\n const timePassed = new Date().getTime() - timeoutStarted;\n restTime = restTime - timePassed;\n }\n });\n\n toast.addEventListener(\"pointerleave\", () => {\n timeoutStarted = new Date().getTime();\n currentTimeout = window.setTimeout(() => {\n toast.hide();\n }, restTime);\n });\n }\n }\n\n private toastsAppended() {\n const host = (this.element.getRootNode() as ShadowRoot)?.host || this.element;\n Array.from(host.children).forEach((toast: HTMLStzhToastElement) => {\n this.toastAppended(toast);\n });\n }\n\n private hideOverflowingItems() {\n const host = (this.element.getRootNode() as ShadowRoot)?.host || this.element;\n const childCount = host.children.length;\n\n Array.from(host.children)\n .splice(0, childCount - this.max)\n .forEach((toast: HTMLStzhToastElement) => {\n toast.hide();\n });\n }\n\n private handleSlotchange = () => {\n this.toastsAppended();\n this.hideOverflowingItems();\n }\n\n componentWillLoad() {\n this.initialToastsWatcher(this.initialToasts);\n }\n\n componentDidLoad() {\n this._initialToasts.forEach(async (data) => {\n if (data.cookie) {\n const alreadyClosedBefore = Cookie.get(`${KEY_PREFIX_CLOSED}-${data.cookie}`);\n\n if (alreadyClosedBefore) {\n return;\n }\n }\n\n let link = data.link;\n\n if (!(link instanceof HTMLElement)) {\n const generatedLink = document.createElement(\"stzh-button\");\n generatedLink.slot = \"link\";\n generatedLink.size = \"small\";\n\n Object.assign(generatedLink, data.link);\n link = generatedLink;\n }\n\n const toast = await this.toast(data.label, {\n type: data.type,\n link: link as HTMLStzhButtonElement\n })\n\n if (data.cookie) {\n let cookieExpires = 365;\n\n if (data.cookieExpires === 0) {\n cookieExpires = null;\n } else if (data.cookieExpires) {\n cookieExpires = data.cookieExpires;\n }\n\n toast.addEventListener(\"stzhClosed\", () => {\n Cookie.set(`${KEY_PREFIX_CLOSED}-${data.cookie}`, '1', {\n expires: cookieExpires\n });\n });\n }\n })\n }\n\n render() {\n const classes = {\n \"stzh-toastbar\": true,\n };\n\n return (\n <Host>\n <div class={classes}>\n <slot onSlotchange={this.handleSlotchange}></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"stzh-toastbar.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { j as js_cookie } from './js.cookie
|
|
3
|
-
import './
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { j as js_cookie } from './js.cookie.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './stzh-badge2.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './stzh-button2.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './stzh-icon2.js';
|
|
6
|
+
import { d as defineCustomElement$1 } from './stzh-toast2.js';
|
|
4
7
|
|
|
5
8
|
const stzhToastbarCss = ":host{font-family:var(--stzh-font-family-medium);font-weight:var(--stzh-font-weight-medium);font-style:var(--stzh-font-style-medium);color:var(--stzh-base-color);box-sizing:border-box;display:block;}:host[hidden]{display:none}:host::-moz-selection{color:var(--stzh-selection-color);background-color:var(--stzh-selection-background-color)}:host::selection{color:var(--stzh-selection-color);background-color:var(--stzh-selection-background-color)}:host *,:host *::before,:host *::after{box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness);-webkit-text-decoration-skip-ink:var(--stzh-link-text-decoration-skip-ink);text-decoration-skip-ink:var(--stzh-link-text-decoration-skip-ink)}:host .has-focus{outline:var(--stzh-flyingfocus-color) solid 0.125rem;outline-offset:0.125rem}:host .stzh-fylingfocus-focused{outline-style:none !important}:host .stzh-fylingfocus-focused::-moz-focus-inner{border:0 !important}:host{bottom:var(--stzh-space-medium);z-index:var(--stzh-z-index-overlay);position:fixed;pointer-events:none;left:1.25rem;right:1.25rem;bottom:calc( var(--stzh-pagetitle-disturber-stuck-height, 0px) + var(--stzh-sticky-cta-stuck-bottom-height, 0px) )}@media screen and (min-width: 600px){:host{bottom:var(--stzh-space-large)}}@media screen and (min-width: 900px){:host{bottom:var(--stzh-space-xlarge)}}@media screen and (min-width: 1260px){:host{bottom:var(--stzh-space-xxlarge)}}@media screen and (min-width: 600px){:host{left:2rem;right:auto;max-width:26.8125rem}}@media screen and (min-width: 900px){:host{left:2.5rem;max-width:27.5rem}}@media screen and (min-width: 1260px){:host{left:4rem;max-width:30.3125rem}}@media screen and (min-width: 1600px){:host{left:calc((100vw - 84.25rem - var(--stzh-scrollbar-width, 0px)) / 2);max-width:34.625rem}}:host ::slotted(*:not([hidden]):not([slot])){margin-bottom:var(--stzh-space-small)}.stzh-toastbar{display:flex;flex-direction:column;justify-content:flex-end}@media screen and (min-width: 600px){.stzh-toastbar{align-items:flex-start}}";
|
|
6
9
|
|
|
7
10
|
const KEY_PREFIX_CLOSED = "stzh-components-toastbar-closed";
|
|
8
|
-
const StzhToastbar = class {
|
|
9
|
-
constructor(
|
|
10
|
-
|
|
11
|
+
const StzhToastbar = /*@__PURE__*/ proxyCustomElement(class StzhToastbar extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
this.__attachShadow();
|
|
11
16
|
this._initialToasts = [];
|
|
12
17
|
this.handleSlotchange = () => {
|
|
13
18
|
this.toastsAppended();
|
|
@@ -132,13 +137,53 @@ const StzhToastbar = class {
|
|
|
132
137
|
};
|
|
133
138
|
return (h(Host, null, h("div", { class: classes }, h("slot", { onSlotchange: this.handleSlotchange }))));
|
|
134
139
|
}
|
|
135
|
-
get element() { return
|
|
140
|
+
get element() { return this; }
|
|
136
141
|
static get watchers() { return {
|
|
137
142
|
"initialToasts": ["initialToastsWatcher"]
|
|
138
143
|
}; }
|
|
139
|
-
}
|
|
140
|
-
|
|
144
|
+
static get style() { return stzhToastbarCss; }
|
|
145
|
+
}, [1, "stzh-toastbar", {
|
|
146
|
+
"hideAfter": [2, "hide-after"],
|
|
147
|
+
"max": [2],
|
|
148
|
+
"initialToasts": [1, "initial-toasts"],
|
|
149
|
+
"toast": [64]
|
|
150
|
+
}, undefined, {
|
|
151
|
+
"initialToasts": ["initialToastsWatcher"]
|
|
152
|
+
}]);
|
|
153
|
+
function defineCustomElement() {
|
|
154
|
+
if (typeof customElements === "undefined") {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const components = ["stzh-toastbar", "stzh-badge", "stzh-button", "stzh-icon", "stzh-toast"];
|
|
158
|
+
components.forEach(tagName => { switch (tagName) {
|
|
159
|
+
case "stzh-toastbar":
|
|
160
|
+
if (!customElements.get(tagName)) {
|
|
161
|
+
customElements.define(tagName, StzhToastbar);
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
case "stzh-badge":
|
|
165
|
+
if (!customElements.get(tagName)) {
|
|
166
|
+
defineCustomElement$4();
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case "stzh-button":
|
|
170
|
+
if (!customElements.get(tagName)) {
|
|
171
|
+
defineCustomElement$3();
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
case "stzh-icon":
|
|
175
|
+
if (!customElements.get(tagName)) {
|
|
176
|
+
defineCustomElement$2();
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case "stzh-toast":
|
|
180
|
+
if (!customElements.get(tagName)) {
|
|
181
|
+
defineCustomElement$1();
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
} });
|
|
185
|
+
}
|
|
141
186
|
|
|
142
|
-
export { StzhToastbar as
|
|
187
|
+
export { StzhToastbar as S, defineCustomElement as d };
|
|
143
188
|
|
|
144
|
-
//# sourceMappingURL=stzh-
|
|
189
|
+
//# sourceMappingURL=stzh-toastbar2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"stzh-toastbar2.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,0iEAA0iE;;ACiBlkE,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;MAU/C,YAAY;;;;;IAuBf,mBAAc,GAA+B,EAAE,CAAC;IA0FhD,qBAAgB,GAAG;MACzB,IAAI,CAAC,cAAc,EAAE,CAAC;MACtB,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAC7B,CAAA;qBA/G2B,EAAE;eAMR,CAAC;yBAWsC,EAAE;;;EAO/D,MAAM,KAAK,CACT,KA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gBAAgB,CAAC,YAAY,EAAE;UACnCA,SAAM,CAAC,GAAG,CAAC,GAAG,iBAAiB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE;YACrD,OAAO,EAAE,aAAa;WACvB,CAAC,CAAC;SACJ,CAAC,CAAC;OACJ;KACF,CAAC,CAAA;GACH;EAED,MAAM;IACJ,MAAM,OAAO,GAAG;MACd,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,QACE,EAAC,IAAI,QACH,WAAK,KAAK,EAAE,OAAO,IACjB,YAAM,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAS,CAC9C,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Cookie"],"sources":["src/components/stzh-toastbar/stzh-toastbar.scss?tag=stzh-toastbar&encapsulation=shadow","src/components/stzh-toastbar/stzh-toastbar.tsx"],"sourcesContent":[":host {\n @include spaceCurve('bottom', 'regular');\n z-index: $zIndexOverlay;\n position: fixed;\n pointer-events: none;\n left: $containerMargin;\n right: $containerMargin;\n bottom: calc(\n var(--stzh-pagetitle-disturber-stuck-height, 0px)\n + var(--stzh-sticky-cta-stuck-bottom-height, 0px)\n );\n\n @include mq($from: small) {\n left: $containerMarginSmall;\n right: auto;\n max-width: 429px;\n }\n\n @include mq($from: medium) {\n left: $containerMarginMedium;\n max-width: 440px;\n }\n\n @include mq($from: large) {\n left: $containerMarginLarge;\n max-width: 485px;\n }\n\n @include mq($from: ultra) {\n left: calc((100vw - #{$containerMaxWidth} - var(--stzh-scrollbar-width, 0px)) / 2);\n max-width: 554px;\n }\n\n ::slotted(*:not([hidden]):not([slot])) {\n margin-bottom: space('small');\n }\n}\n\n.stzh-toastbar {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n\n @include mq($from: small) {\n align-items: flex-start;\n }\n}\n","import {\n Component,\n Host,\n h,\n Element,\n Prop,\n Method,\n Watch,\n} from \"@stencil/core\";\n\nimport {\n StzhToastbarInitialToast,\n StzhToastType,\n} from \"../../index\";\n\nimport Cookie from \"js-cookie\";\n\nconst KEY_PREFIX_CLOSED = \"stzh-components-toastbar-closed\";\n\n/**\n * @slot - Slot for stzh-toast elements\n */\n@Component({\n tag: \"stzh-toastbar\",\n styleUrl: \"stzh-toastbar.scss\",\n shadow: true\n})\nexport class StzhToastbar {\n /**\n * Time after toasts are hidden (in seconds).\n * Toasts with type `error` will stay, until the user closes them manually.\n */\n @Prop() hideAfter: number = 30;\n\n /**\n * Maximum of toasts allowed to be shown.\n * If more are created, oldest will be hidden, even if timeout not ended yet or toast type is `error`.\n */\n @Prop() max: number = 5;\n\n /**\n * Initial toasts.\n *\n * Array of objects that at least includes `label` and optionally `type`, `link` (object with `href` and `label`) `cookie` and `cookieExpires`:\n * `[{\"label\": \"Lorem ipsum\", \"link\": { \"label\": \"More info\", \"href\": \"https://example.com\" }, \"cookie\": \"cookie-banner\", \"cookieExpires\": 365 }]`\n *\n * If `cookie` exists in an object, it will check for that cookie name first (prefixed with `stzh-components-toastbar-closed-`) and only show if cookie doesn't exist.\n * `cookieExpires` sets the cookie lifetime (default 365 days, set 0 for session cookie).\n */\n @Prop() initialToasts: StzhToastbarInitialToast[] | string = [];\n private _initialToasts: StzhToastbarInitialToast[] = [];\n\n @Element() element: HTMLStzhToastbarElement;\n\n /** Create new toast. */\n @Method()\n async toast(\n label: string,\n { type, link }: { type?: StzhToastType, link?: HTMLStzhButtonElement } = { type: \"info\" }\n ): Promise<HTMLStzhToastElement> {\n const toast = document.createElement(\"stzh-toast\");\n toast.hidden = true;\n toast.label = label;\n toast.role = \"alert\";\n toast.type = type || \"info\";\n toast.initialOpenAnimation = true;\n\n if (link) {\n link.slot = \"link\";\n link.size = \"small\";\n toast.appendChild(link);\n }\n\n this.element.appendChild(toast);\n\n return toast;\n }\n\n @Watch(\"initialToasts\")\n initialToastsWatcher(newValue: any[] | string) {\n if (typeof newValue === \"string\") {\n this._initialToasts = JSON.parse(newValue);\n } else {\n this._initialToasts = newValue;\n }\n }\n\n private toastAppended(toast: HTMLStzhToastElement) {\n if (toast.getAttribute('data-stzh-toastbar-managed')) {\n return;\n }\n\n toast.setAttribute('data-stzh-toastbar-managed', '');\n\n toast.addEventListener(\"stzhClosed\", () => {\n toast.remove();\n });\n\n if (toast.type !== \"error\") {\n let timeoutStarted = new Date().getTime();\n let restTime = this.hideAfter * 1000;\n let currentTimeout = window.setTimeout(() => {\n toast.hide();\n }, restTime);\n\n toast.addEventListener(\"pointerenter\", () => {\n if (currentTimeout) {\n window.clearTimeout(currentTimeout);\n const timePassed = new Date().getTime() - timeoutStarted;\n restTime = restTime - timePassed;\n }\n });\n\n toast.addEventListener(\"pointerleave\", () => {\n timeoutStarted = new Date().getTime();\n currentTimeout = window.setTimeout(() => {\n toast.hide();\n }, restTime);\n });\n }\n }\n\n private toastsAppended() {\n const host = (this.element.getRootNode() as ShadowRoot)?.host || this.element;\n Array.from(host.children).forEach((toast: HTMLStzhToastElement) => {\n this.toastAppended(toast);\n });\n }\n\n private hideOverflowingItems() {\n const host = (this.element.getRootNode() as ShadowRoot)?.host || this.element;\n const childCount = host.children.length;\n\n Array.from(host.children)\n .splice(0, childCount - this.max)\n .forEach((toast: HTMLStzhToastElement) => {\n toast.hide();\n });\n }\n\n private handleSlotchange = () => {\n this.toastsAppended();\n this.hideOverflowingItems();\n }\n\n componentWillLoad() {\n this.initialToastsWatcher(this.initialToasts);\n }\n\n componentDidLoad() {\n this._initialToasts.forEach(async (data) => {\n if (data.cookie) {\n const alreadyClosedBefore = Cookie.get(`${KEY_PREFIX_CLOSED}-${data.cookie}`);\n\n if (alreadyClosedBefore) {\n return;\n }\n }\n\n let link = data.link;\n\n if (!(link instanceof HTMLElement)) {\n const generatedLink = document.createElement(\"stzh-button\");\n generatedLink.slot = \"link\";\n generatedLink.size = \"small\";\n\n Object.assign(generatedLink, data.link);\n link = generatedLink;\n }\n\n const toast = await this.toast(data.label, {\n type: data.type,\n link: link as HTMLStzhButtonElement\n })\n\n if (data.cookie) {\n let cookieExpires = 365;\n\n if (data.cookieExpires === 0) {\n cookieExpires = null;\n } else if (data.cookieExpires) {\n cookieExpires = data.cookieExpires;\n }\n\n toast.addEventListener(\"stzhClosed\", () => {\n Cookie.set(`${KEY_PREFIX_CLOSED}-${data.cookie}`, '1', {\n expires: cookieExpires\n });\n });\n }\n })\n }\n\n render() {\n const classes = {\n \"stzh-toastbar\": true,\n };\n\n return (\n <Host>\n <div class={classes}>\n <slot onSlotchange={this.handleSlotchange}></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|