@oiz/stzh-components 3.6.0-beta4 → 3.6.0-beta6
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-f1bf0bed.js → app-globals-73b4e60e.js} +2 -2
- package/dist/cjs/{app-globals-f1bf0bed.js.map → app-globals-73b4e60e.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stzh-components.cjs.js +1 -1
- package/dist/cjs/stzh-dropdown.cjs.entry.js +8 -16
- package/dist/cjs/stzh-dropdown.cjs.entry.js.map +1 -1
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +8 -16
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-aa3fc1b5.js → p-5a04123b.js} +2 -2
- package/dist/components/{p-aa3fc1b5.js.map → p-5a04123b.js.map} +1 -1
- package/dist/components/{p-4508550a.js → p-7cc4b88f.js} +3 -3
- package/dist/components/{p-4508550a.js.map → p-7cc4b88f.js.map} +1 -1
- package/dist/components/{p-3f254548.js → p-a16a72e5.js} +9 -17
- package/dist/components/p-a16a72e5.js.map +1 -0
- package/dist/components/stzh-amount.js +1 -1
- package/dist/components/stzh-appointments.js +3 -3
- package/dist/components/stzh-calendar.js +1 -1
- package/dist/components/stzh-datatable.js +1 -1
- package/dist/components/stzh-datepicker.js +1 -1
- package/dist/components/stzh-dropdown.js +1 -1
- package/dist/components/stzh-monthyearpicker.js +1 -1
- package/dist/components/stzh-panorama.js +1 -1
- package/dist/components/stzh-poilist.js +1 -1
- package/dist/components/stzh-search.js +1 -1
- package/dist/components/stzh-timepicker.js +1 -1
- package/dist/esm/{app-globals-1b7d8e4f.js → app-globals-2ee3af6c.js} +2 -2
- package/dist/esm/{app-globals-1b7d8e4f.js.map → app-globals-2ee3af6c.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stzh-components.js +1 -1
- package/dist/esm/stzh-dropdown.entry.js +8 -16
- package/dist/esm/stzh-dropdown.entry.js.map +1 -1
- package/dist/stzh-components/{p-9b909077.js → p-03e6634b.js} +2 -2
- package/dist/stzh-components/{p-b6d653c5.entry.js → p-26c37e1c.entry.js} +2 -2
- package/dist/stzh-components/p-26c37e1c.entry.js.map +1 -0
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/package.json +3 -3
- package/dist/components/p-3f254548.js.map +0 -1
- package/dist/stzh-components/p-b6d653c5.entry.js.map +0 -1
- /package/dist/stzh-components/{p-9b909077.js.map → p-03e6634b.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment, d as Host } from './p-1983b50c.js';
|
|
2
|
-
import { a as printISODate, d as defineCustomElement$6 } from './p-
|
|
2
|
+
import { a as printISODate, d as defineCustomElement$6 } from './p-5a04123b.js';
|
|
3
3
|
import { h as hasSlot } from './p-79baf661.js';
|
|
4
4
|
import { d as defineCustomElement$8 } from './p-3b8bd05e.js';
|
|
5
5
|
import { d as defineCustomElement$7 } from './p-1ecb21d3.js';
|
|
6
|
-
import { d as defineCustomElement$5 } from './p-
|
|
6
|
+
import { d as defineCustomElement$5 } from './p-a16a72e5.js';
|
|
7
7
|
import { d as defineCustomElement$4 } from './p-479b06b2.js';
|
|
8
8
|
import { d as defineCustomElement$3 } from './p-d12caa3f.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './p-7c30c73c.js';
|
|
@@ -271,4 +271,4 @@ function defineCustomElement() {
|
|
|
271
271
|
|
|
272
272
|
export { StzhDatepicker as S, defineCustomElement as d };
|
|
273
273
|
|
|
274
|
-
//# sourceMappingURL=p-
|
|
274
|
+
//# sourceMappingURL=p-7cc4b88f.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-4508550a.js","mappings":";;;;;;;;;;;AAAA,MAAM,iBAAiB,GAAG,snEAAsnE,CAAC;AACjpE,6BAAe,iBA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SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,IAAI,CAAC,KAAK,IAEjB,uFAEE,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAE,IAAI,CAAC,WAAW,GACd,EACf,4DAAK,IAAI,EAAC,SAAS,IACjB;;gBAEE,KAAK,EAAE,IAAI,CAAC,aAAa,EACzB,KAAK,EAAC,sCAAsC,EAC5C,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAC3C,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAErB,EAChB,4DAAK,KAAK,EAAC,0BAA0B,IACnC,6DAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,CACF,CACO,CACJ,CAEX,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/stzh-datepicker/stzh-datepicker.scss?tag=stzh-datepicker&encapsulation=scoped","src/components/stzh-datepicker/stzh-datepicker.tsx"],"sourcesContent":[":host {\n --calendar-width: #{$calendarWidth};\n\n width: 100%;\n\n &[inline]:not([inline=\"false\"]) {\n width: var(--calendar-width);\n }\n}\n\n.stzh-datepicker {\n &__popover {\n --width: auto;\n }\n\n &__calendar {\n margin-left: auto;\n margin-right: auto;\n\n &.is-inline {\n width: 100%;\n margin-left: 0px;\n margin-right: 0px;\n }\n }\n\n &__actions {\n display: flex;\n width: var(--calendar-width);\n margin-left: auto;\n margin-right: auto;\n\n &.is-inline {\n width: 100%;\n margin-left: 0px;\n margin-right: 0px;\n }\n\n &:not(:empty) {\n padding-left: space('small');\n padding-right: space('small');\n }\n }\n\n /* Has action */\n\n &--has-action &__popover {\n --content-padding: 0 0 #{space('small')} 0;\n }\n}\n","import {\n Component,\n Prop,\n Host,\n Element,\n h,\n Event,\n EventEmitter,\n Method,\n Watch,\n Fragment,\n State,\n Listen\n} from \"@stencil/core\";\n\nimport {\n StzhCalendarChangeEvent,\n StzhDatepickerChangeEvent\n} from \"../../index\";\n\nimport { StzhCalendarDateDisabledPredicate } from \"../../index\";\n\nimport { printISODate } from \"../../utils/date-utils\"\nimport { StzhLocaleAdapter } from \"../../index\"\n\nimport { StzhDatepickerLocalizedText } from \"./stzh-datepicker.localization\";\nimport { hasSlot } from \"../../utils/utils\";\n\n/**\n * @slot action - Slot for action below calendar (stzh-link element)\n */\n@Component({\n tag: \"stzh-datepicker\",\n styleUrl: \"stzh-datepicker.scss\",\n scoped: true\n})\nexport class StzhDatepicker {\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @Prop() calendarMin: string = \"\"\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @Prop() calendarMax: string = \"\"\n\n /**\n * Controls which days are disabled and therefore disallowed.\n * For example, this can be used to disallow selection of weekends.\n */\n @Prop() calendarIsDateDisabled: StzhCalendarDateDisabledPredicate = () => false\n\n /** Name of the hidden date picker input. */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of the hidden date picker input. If a date can be parsed (via picker always), the value is in ISO format. Otherwise the value equals the manual input. */\n @Prop({ mutable: true }) value: string = \"\";\n @State() calendarValue: string = \"\";\n @State() inputValue: string = \"\";\n\n /** Default value (used by reset) */\n @Prop({ mutable: true }) defaultValue: string = \"\";\n\n /** Label for input field and popover */\n @Prop() label: string = \"\";\n\n /** Whether label is visually hidden. */\n @Prop() labelHidden: boolean = false;\n\n /** Whether the element is readonly or not */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\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 /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\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 /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Show calendar inline */\n @Prop({ reflect: true }) inline: boolean = false;\n\n /**\n * Date adapter visible date shown to the user, for custom parsing/formatting.\n * Must be object with a `parse` function which accepts a `string` and returns a `Date`,\n * and a `format` function which accepts a `Date` and returns a `string`.\n */\n @Prop() dateAdapter: StzhLocaleAdapter;\n\n /**\n * Date adapter for internal date passed to backend, for custom parsing/formatting.\n * Can be `\"iso\"` (default, date in ISO format) / `\"legacy\"` (date in `d.m.Y` format)\n * or `StzhLocaleAdapter` (must be object with a `parse` function which accepts a `string` and returns a `Date`,\n * and a `format` function which accepts a `Date` and returns a `string`.)\n */\n @Prop() internalDateAdapter: \"iso\" | \"legacy\" | StzhLocaleAdapter = \"iso\";\n private _internalDateAdapter: StzhLocaleAdapter;\n\n /** Translation strings. */\n @Prop() localization: StzhDatepickerLocalizedText;\n\n @State() buttonLabel: string;\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 @Watch(\"localization\")\n createDateFormatters() {\n if (this.localization) {\n this.dateFormatLong = new Intl.DateTimeFormat(this.localization.$locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n })\n }\n }\n\n /** Update calendar and input when value prop has changed */\n @Watch(\"value\")\n valueWatcher(newValue: string) {\n if (!this._internalDateAdapter) {\n return;\n }\n\n const date = this._internalDateAdapter.parse(newValue, \"dateInput\");\n\n this.calendarValue = printISODate(date);\n this.inputValue = this.dateAdapter.format(date, \"dateInput\");\n\n this.updateButtonAccessibleLabel();\n }\n\n @Watch(\"dateAdapter\")\n dateAdapterWatcher(newValue: StzhLocaleAdapter) {\n if (!newValue) {\n this.dateAdapter = window.stzhComponents.utils.createFormatParseAdapter(\n this.localization.$formats,\n this.localization.$globals\n );\n }\n }\n\n @Watch(\"internalDateAdapter\")\n internalDateAdapterWatcher(newValue: \"iso\" | \"legacy\" | StzhLocaleAdapter) {\n if (newValue === \"iso\" || !newValue) {\n this._internalDateAdapter = window.stzhComponents.utils.createFormatParseAdapter(\n this.localization.$formatsIso,\n this.localization.$globals\n );\n } else if (newValue === \"legacy\") {\n this._internalDateAdapter = window.stzhComponents.utils.createFormatParseAdapter(\n this.localization.$formatsLegacy,\n this.localization.$globals\n );\n } else {\n this._internalDateAdapter = newValue;\n }\n }\n\n /** Set value by a JS Date object */\n @Method()\n async setDate(date: Date) {\n this.value = this._internalDateAdapter.format(date, \"dateInput\");\n }\n\n /** Return internal popover element */\n @Method()\n async getPopover(): Promise<HTMLStzhPopoverElement> {\n return this.popover;\n }\n\n /** Datepicker change event */\n @Event() stzhChange: EventEmitter<StzhDatepickerChangeEvent>;\n\n @Element() element: HTMLStzhDatepickerElement;\n\n /**\n * To format dates exclusively for the benefit of screen readers.\n *\n * We prefer DateTimeFormat over date.toLocaleDateString, as the former has\n * better performance when formatting large number of dates. See:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#Performance\n */\n private dateFormatLong: Intl.DateTimeFormat\n\n private input: HTMLStzhInputElement;\n private popover: HTMLStzhPopoverElement;\n // private calendar: HTMLStzhCalendarElement;\n\n private handleReset = async () => {\n this.value = this.defaultValue;\n }\n\n private onRootFocus = () => {\n if (this.input) {\n this.input.focus();\n }\n }\n\n private onInputChanged = () => {\n const parsedDate = this.dateAdapter.parse(this.input.value, \"dateInput\");\n\n if (this.input.value === \"\" || parsedDate) {\n const formattedDate = this._internalDateAdapter.format(parsedDate, \"dateInput\");\n\n if (this.value !== formattedDate) {\n this.value = formattedDate;\n } else {\n this.valueWatcher(formattedDate);\n }\n\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: parsedDate,\n })\n }\n }\n\n private onCalendarChange = (event: CustomEvent<StzhCalendarChangeEvent>) => {\n if (event.detail.component !== \"stzh-calendar\") {\n // Do not emit stzhChange event from year/month dropdowns\n event.stopPropagation();\n return;\n }\n\n this.value = event.detail.valueAsDate\n && this._internalDateAdapter.format(event.detail.valueAsDate, \"dateInput\");\n\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: event.detail.valueAsDate,\n });\n\n if (this.popover) {\n this.popover.hide();\n }\n }\n\n private updateButtonAccessibleLabel() {\n if (!this.localization) {\n return;\n }\n\n try {\n const valueAsDate = this._internalDateAdapter.parse(this.value, \"dateInput\");\n this.buttonLabel = `${this.label}, ${this.localization.buttonLabel}, ${this.localization.selectedDateMessage} ${this.dateFormatLong.format(valueAsDate)}`;\n } catch (err) {\n this.buttonLabel = `${this.label}, ${this.localization.buttonLabel}`;\n }\n }\n\n connectedCallback() {\n this.createDateFormatters();\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, \"datepicker\");\n }\n\n this.dateAdapterWatcher(this.dateAdapter);\n this.internalDateAdapterWatcher(this.internalDateAdapter);\n this.valueWatcher(this.value);\n this.defaultValue = this.defaultValue || this.value;\n }\n\n render() {\n const actionUsed = hasSlot(this.element, 'action');\n\n const classes = {\n \"stzh-datepicker\": true,\n \"stzh-datepicker--inline\": this.inline,\n \"stzh-datepicker--has-action\": actionUsed\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n defaultValue={this.defaultValue}\n />\n\n {this.inline &&\n <Fragment>\n <stzh-calendar\n // ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n value={this.calendarValue}\n class=\"stzh-datepicker__calendar is-inline\"\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n ></stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </Fragment>\n }\n\n {!this.inline &&\n <stzh-input\n value={this.inputValue}\n label={this.label}\n labelHidden={this.labelHidden}\n ref={(el) => (this.input = el as HTMLStzhInputElement)}\n noAutocomplete\n onStzhChanged={this.onInputChanged}\n readonly={this.readonly}\n disabled={this.disabled}\n description={this.description}\n descriptionLong={this.descriptionLong}\n error={this.error}\n invalid={this.invalid}\n required={this.required}\n hideOptional={this.hideOptional}\n size={this.size}\n >\n <stzh-popover\n ref={(el) => (this.popover = el as HTMLStzhPopoverElement)}\n class=\"stzh-datepicker__popover\"\n slot=\"button-right\"\n placement=\"bottom-end\"\n label={this.label}\n >\n <stzh-button\n icon-only\n icon=\"calendar\"\n size={this.size}\n disabled={this.disabled}\n a11yLabel={this.buttonLabel}\n ></stzh-button>\n <div slot=\"content\">\n <stzh-calendar\n // ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n value={this.calendarValue}\n class=\"stzh-datepicker__calendar is-popover\"\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n >\n </stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n </stzh-popover>\n </stzh-input>\n }\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"p-7cc4b88f.js","mappings":";;;;;;;;;;;AAAA,MAAM,iBAAiB,GAAG,snEAAsnE,CAAC;AACjpE,6BAAe,iBAAiB;;MCmCnB,cAAc;;;;;;QAmLjB,gBAAW,GAAG;YACpB,IAAI,C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uFAEE,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAE,IAAI,CAAC,WAAW,GACd,EACf,4DAAK,IAAI,EAAC,SAAS,IACjB;;gBAEE,KAAK,EAAE,IAAI,CAAC,aAAa,EACzB,KAAK,EAAC,sCAAsC,EAC5C,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAC3C,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAErB,EAChB,4DAAK,KAAK,EAAC,0BAA0B,IACnC,6DAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,CACF,CACO,CACJ,CAEX,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/stzh-datepicker/stzh-datepicker.scss?tag=stzh-datepicker&encapsulation=scoped","src/components/stzh-datepicker/stzh-datepicker.tsx"],"sourcesContent":[":host {\n --calendar-width: #{$calendarWidth};\n\n width: 100%;\n\n &[inline]:not([inline=\"false\"]) {\n width: var(--calendar-width);\n }\n}\n\n.stzh-datepicker {\n &__popover {\n --width: auto;\n }\n\n &__calendar {\n margin-left: auto;\n margin-right: auto;\n\n &.is-inline {\n width: 100%;\n margin-left: 0px;\n margin-right: 0px;\n }\n }\n\n &__actions {\n display: flex;\n width: var(--calendar-width);\n margin-left: auto;\n margin-right: auto;\n\n &.is-inline {\n width: 100%;\n margin-left: 0px;\n margin-right: 0px;\n }\n\n &:not(:empty) {\n padding-left: space('small');\n padding-right: space('small');\n }\n }\n\n /* Has action */\n\n &--has-action &__popover {\n --content-padding: 0 0 #{space('small')} 0;\n }\n}\n","import {\n Component,\n Prop,\n Host,\n Element,\n h,\n Event,\n EventEmitter,\n Method,\n Watch,\n Fragment,\n State,\n Listen\n} from \"@stencil/core\";\n\nimport {\n StzhCalendarChangeEvent,\n StzhDatepickerChangeEvent\n} from \"../../index\";\n\nimport { StzhCalendarDateDisabledPredicate } from \"../../index\";\n\nimport { printISODate } from \"../../utils/date-utils\"\nimport { StzhLocaleAdapter } from \"../../index\"\n\nimport { StzhDatepickerLocalizedText } from \"./stzh-datepicker.localization\";\nimport { hasSlot } from \"../../utils/utils\";\n\n/**\n * @slot action - Slot for action below calendar (stzh-link element)\n */\n@Component({\n tag: \"stzh-datepicker\",\n styleUrl: \"stzh-datepicker.scss\",\n scoped: true\n})\nexport class StzhDatepicker {\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @Prop() calendarMin: string = \"\"\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @Prop() calendarMax: string = \"\"\n\n /**\n * Controls which days are disabled and therefore disallowed.\n * For example, this can be used to disallow selection of weekends.\n */\n @Prop() calendarIsDateDisabled: StzhCalendarDateDisabledPredicate = () => false\n\n /** Name of the hidden date picker input. */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of the hidden date picker input. If a date can be parsed (via picker always), the value is in ISO format. Otherwise the value equals the manual input. */\n @Prop({ mutable: true }) value: string = \"\";\n @State() calendarValue: string = \"\";\n @State() inputValue: string = \"\";\n\n /** Default value (used by reset) */\n @Prop({ mutable: true }) defaultValue: string = \"\";\n\n /** Label for input field and popover */\n @Prop() label: string = \"\";\n\n /** Whether label is visually hidden. */\n @Prop() labelHidden: boolean = false;\n\n /** Whether the element is readonly or not */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\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 /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\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 /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Show calendar inline */\n @Prop({ reflect: true }) inline: boolean = false;\n\n /**\n * Date adapter visible date shown to the user, for custom parsing/formatting.\n * Must be object with a `parse` function which accepts a `string` and returns a `Date`,\n * and a `format` function which accepts a `Date` and returns a `string`.\n */\n @Prop() dateAdapter: StzhLocaleAdapter;\n\n /**\n * Date adapter for internal date passed to backend, for custom parsing/formatting.\n * Can be `\"iso\"` (default, date in ISO format) / `\"legacy\"` (date in `d.m.Y` format)\n * or `StzhLocaleAdapter` (must be object with a `parse` function which accepts a `string` and returns a `Date`,\n * and a `format` function which accepts a `Date` and returns a `string`.)\n */\n @Prop() internalDateAdapter: \"iso\" | \"legacy\" | StzhLocaleAdapter = \"iso\";\n private _internalDateAdapter: StzhLocaleAdapter;\n\n /** Translation strings. */\n @Prop() localization: StzhDatepickerLocalizedText;\n\n @State() buttonLabel: string;\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 @Watch(\"localization\")\n createDateFormatters() {\n if (this.localization) {\n this.dateFormatLong = new Intl.DateTimeFormat(this.localization.$locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n })\n }\n }\n\n /** Update calendar and input when value prop has changed */\n @Watch(\"value\")\n valueWatcher(newValue: string) {\n if (!this._internalDateAdapter) {\n return;\n }\n\n const date = this._internalDateAdapter.parse(newValue, \"dateInput\");\n\n this.calendarValue = printISODate(date);\n this.inputValue = this.dateAdapter.format(date, \"dateInput\");\n\n this.updateButtonAccessibleLabel();\n }\n\n @Watch(\"dateAdapter\")\n dateAdapterWatcher(newValue: StzhLocaleAdapter) {\n if (!newValue) {\n this.dateAdapter = window.stzhComponents.utils.createFormatParseAdapter(\n this.localization.$formats,\n this.localization.$globals\n );\n }\n }\n\n @Watch(\"internalDateAdapter\")\n internalDateAdapterWatcher(newValue: \"iso\" | \"legacy\" | StzhLocaleAdapter) {\n if (newValue === \"iso\" || !newValue) {\n this._internalDateAdapter = window.stzhComponents.utils.createFormatParseAdapter(\n this.localization.$formatsIso,\n this.localization.$globals\n );\n } else if (newValue === \"legacy\") {\n this._internalDateAdapter = window.stzhComponents.utils.createFormatParseAdapter(\n this.localization.$formatsLegacy,\n this.localization.$globals\n );\n } else {\n this._internalDateAdapter = newValue;\n }\n }\n\n /** Set value by a JS Date object */\n @Method()\n async setDate(date: Date) {\n this.value = this._internalDateAdapter.format(date, \"dateInput\");\n }\n\n /** Return internal popover element */\n @Method()\n async getPopover(): Promise<HTMLStzhPopoverElement> {\n return this.popover;\n }\n\n /** Datepicker change event */\n @Event() stzhChange: EventEmitter<StzhDatepickerChangeEvent>;\n\n @Element() element: HTMLStzhDatepickerElement;\n\n /**\n * To format dates exclusively for the benefit of screen readers.\n *\n * We prefer DateTimeFormat over date.toLocaleDateString, as the former has\n * better performance when formatting large number of dates. See:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#Performance\n */\n private dateFormatLong: Intl.DateTimeFormat\n\n private input: HTMLStzhInputElement;\n private popover: HTMLStzhPopoverElement;\n // private calendar: HTMLStzhCalendarElement;\n\n private handleReset = async () => {\n this.value = this.defaultValue;\n }\n\n private onRootFocus = () => {\n if (this.input) {\n this.input.focus();\n }\n }\n\n private onInputChanged = () => {\n const parsedDate = this.dateAdapter.parse(this.input.value, \"dateInput\");\n\n if (this.input.value === \"\" || parsedDate) {\n const formattedDate = this._internalDateAdapter.format(parsedDate, \"dateInput\");\n\n if (this.value !== formattedDate) {\n this.value = formattedDate;\n } else {\n this.valueWatcher(formattedDate);\n }\n\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: parsedDate,\n })\n }\n }\n\n private onCalendarChange = (event: CustomEvent<StzhCalendarChangeEvent>) => {\n if (event.detail.component !== \"stzh-calendar\") {\n // Do not emit stzhChange event from year/month dropdowns\n event.stopPropagation();\n return;\n }\n\n this.value = event.detail.valueAsDate\n && this._internalDateAdapter.format(event.detail.valueAsDate, \"dateInput\");\n\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: event.detail.valueAsDate,\n });\n\n if (this.popover) {\n this.popover.hide();\n }\n }\n\n private updateButtonAccessibleLabel() {\n if (!this.localization) {\n return;\n }\n\n try {\n const valueAsDate = this._internalDateAdapter.parse(this.value, \"dateInput\");\n this.buttonLabel = `${this.label}, ${this.localization.buttonLabel}, ${this.localization.selectedDateMessage} ${this.dateFormatLong.format(valueAsDate)}`;\n } catch (err) {\n this.buttonLabel = `${this.label}, ${this.localization.buttonLabel}`;\n }\n }\n\n connectedCallback() {\n this.createDateFormatters();\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, \"datepicker\");\n }\n\n this.dateAdapterWatcher(this.dateAdapter);\n this.internalDateAdapterWatcher(this.internalDateAdapter);\n this.valueWatcher(this.value);\n this.defaultValue = this.defaultValue || this.value;\n }\n\n render() {\n const actionUsed = hasSlot(this.element, 'action');\n\n const classes = {\n \"stzh-datepicker\": true,\n \"stzh-datepicker--inline\": this.inline,\n \"stzh-datepicker--has-action\": actionUsed\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n defaultValue={this.defaultValue}\n />\n\n {this.inline &&\n <Fragment>\n <stzh-calendar\n // ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n value={this.calendarValue}\n class=\"stzh-datepicker__calendar is-inline\"\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n ></stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </Fragment>\n }\n\n {!this.inline &&\n <stzh-input\n value={this.inputValue}\n label={this.label}\n labelHidden={this.labelHidden}\n ref={(el) => (this.input = el as HTMLStzhInputElement)}\n noAutocomplete\n onStzhChanged={this.onInputChanged}\n readonly={this.readonly}\n disabled={this.disabled}\n description={this.description}\n descriptionLong={this.descriptionLong}\n error={this.error}\n invalid={this.invalid}\n required={this.required}\n hideOptional={this.hideOptional}\n size={this.size}\n >\n <stzh-popover\n ref={(el) => (this.popover = el as HTMLStzhPopoverElement)}\n class=\"stzh-datepicker__popover\"\n slot=\"button-right\"\n placement=\"bottom-end\"\n label={this.label}\n >\n <stzh-button\n icon-only\n icon=\"calendar\"\n size={this.size}\n disabled={this.disabled}\n a11yLabel={this.buttonLabel}\n ></stzh-button>\n <div slot=\"content\">\n <stzh-calendar\n // ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n value={this.calendarValue}\n class=\"stzh-datepicker__calendar is-popover\"\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n >\n </stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n </stzh-popover>\n </stzh-input>\n }\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -5384,17 +5384,9 @@ const StzhDropdown = /*@__PURE__*/ proxyCustomElement(class StzhDropdown extends
|
|
|
5384
5384
|
this.tomSelect = new TomSelect(this.select, tomSelectOptions);
|
|
5385
5385
|
if (!this.openOnFocus) {
|
|
5386
5386
|
// we still want to enable opening the dropdown by click
|
|
5387
|
-
this.tomSelect.control.addEventListener("click", (
|
|
5388
|
-
try {
|
|
5389
|
-
event.preventDefault(); // Ensure this works without error
|
|
5390
|
-
}
|
|
5391
|
-
catch (_a) {
|
|
5392
|
-
console.log('preventDefault failed');
|
|
5393
|
-
}
|
|
5387
|
+
this.tomSelect.control.addEventListener("click", () => {
|
|
5394
5388
|
this.tomSelect.open();
|
|
5395
|
-
}
|
|
5396
|
-
// passive false, otherwise angular wrapper will cause error
|
|
5397
|
-
{ passive: false });
|
|
5389
|
+
});
|
|
5398
5390
|
}
|
|
5399
5391
|
if (this.open) {
|
|
5400
5392
|
this.show();
|
|
@@ -5432,18 +5424,18 @@ const StzhDropdown = /*@__PURE__*/ proxyCustomElement(class StzhDropdown extends
|
|
|
5432
5424
|
[`stzh-dropdown--size-${this.size}`]: !!this.size,
|
|
5433
5425
|
[`stzh-dropdown--${this.variant}`]: !!this.variant,
|
|
5434
5426
|
};
|
|
5435
|
-
return (h(Host, { key: '
|
|
5427
|
+
return (h(Host, { key: 'a237d5e0c99e4f41d746f135341f24b1fdd0968c', "is-invalid": this.invalid || errorUsed, tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, h("div", { key: 'd0ee727761072eb1d42369a9e886f6270d3a6f1e', class: classes, ref: (el) => (this.rootElement = el) }, h("div", { key: 'a82ca4c8210e6b55b126d035428580305752b680', class: "stzh-dropdown__wrapper" }, h("label", { key: '19cdc52622a8aad6b0a9d2059528fe76b65054b9', id: `${this.dropdownId}-label`, class: {
|
|
5436
5428
|
"stzh-dropdown__label": true,
|
|
5437
5429
|
"no-label-truncate": this.noLabelTruncate,
|
|
5438
|
-
}, htmlFor: this.dropdownId }, this.label ? this.label : h("slot", { name: "label" }), !this.hideOptional && (h("span", { key: '
|
|
5430
|
+
}, htmlFor: this.dropdownId }, this.label ? this.label : h("slot", { name: "label" }), !this.hideOptional && (h("span", { key: '084d603e2449e1e54dcc65c34e6c0bf5d4e1cb9b', class: "stzh-dropdown__marker" }, h("span", { key: '404fd6c775eee2899fbfef267ca815f29c4888d0', class: "stzh-dropdown__marker-symbol", "aria-hidden": "true" }, this.required
|
|
5439
5431
|
? this.localization.$globals.requiredFieldMarker
|
|
5440
|
-
: this.localization.$globals.optionalFieldMarker), h("span", { key: '
|
|
5432
|
+
: this.localization.$globals.optionalFieldMarker), h("span", { key: '6fb3959ef5f006951c62373a3ce6b56b11ab78e1', class: "stzh-dropdown__marker-text" }, this.required
|
|
5441
5433
|
? this.localization.$globals.requiredFieldText
|
|
5442
|
-
: this.localization.$globals.optionalFieldText)))), h("div", { key: '
|
|
5434
|
+
: this.localization.$globals.optionalFieldText)))), h("div", { key: 'ab2feaf5d25d3bfa856264fe4498a004537bdb64', class: "stzh-dropdown__field-wrapper" }, h("select", { key: 'a37d0cae943a972ba3e1e1607de155b5d692f24a', id: this.dropdownId, class: "stzh-dropdown__select", ref: (el) => (this.select = el), multiple: this.multiple, name: this.name, disabled: this.disabled, "aria-labelledby": `${this.dropdownId}-label ${this.dropdownId}-not-loading ${this.dropdownId}-no-results ${this.hideOptional &&
|
|
5443
5435
|
this.required &&
|
|
5444
|
-
`${this.dropdownId}-required`} ${this.invalid && `${this.dropdownId}-invalid`} ${this.dropdownId}-description ${this.a11yDescribedby}` }, h("slot", { key: '
|
|
5436
|
+
`${this.dropdownId}-required`} ${this.invalid && `${this.dropdownId}-invalid`} ${this.dropdownId}-description ${this.a11yDescribedby}` }, h("slot", { key: 'd3f5740bd9e2ca6a102769f94b20f08f66cae76c' })), this.inline && this.label && (h("div", { key: '72777c20dd19fe770a7ab0c975dbc76ba6b95014', class: "stzh-dropdown__sizer" }, this.label)), h("div", { key: 'f8101baf3c1d75c3445ced080393d5e7074e9891', class: "stzh-dropdown__icon-angle-wrapper" }, this.iconAngle ? (h("stzh-icon", { name: this.iconAngle, class: "stzh-dropdown__icon-angle" })) : (h("slot", { name: "icon-angle" }))), h("div", { key: 'b45a81d2433276ec2083900f6159490056669bc9', class: "stzh-dropdown__icon-wrapper" }, this.icon ? (h("stzh-icon", { class: "stzh-dropdown__icon", name: this.icon })) : (h("slot", { name: "icon" }))), this.hideOptional && this.required && (h("div", { key: '04aa1871fc8c8ca9c7d72725b1718df9b60ba63d', id: `${this.dropdownId}-required`, class: "stzh-dropdown__vhidden" }, this.localization.$globals.requiredFieldText)), this.invalid && (h("div", { key: '9a762878b72636f0415e6fcb88690d1ac74eb7b2', id: `${this.dropdownId}-invalid`, class: "stzh-dropdown__vhidden" }, this.localization.$globals.invalidFieldText)))), h("div", { key: '5029c84378274f3697acddab45b8c37173038b49', class: "stzh-dropdown__dropdown-wrapper", ref: (el) => (this.dropdownWrapperElement = el) }), (((_b = this._error) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
|
|
5445
5437
|
this.description ||
|
|
5446
|
-
this.descriptionLong) && (h(StzhInputDescription, { key: '
|
|
5438
|
+
this.descriptionLong) && (h(StzhInputDescription, { key: '48306ec50f826801871ebefa7ca06405448b4d3f', classPrefix: "stzh-dropdown", id: `${this.dropdownId}-description`, error: this._error, description: this.description, descriptionLong: this.descriptionLong, descriptionLongTitle: this.descriptionLongTitle, descriptionLongUsed: descriptionLongUsed, moreInfoButtonLabel: this.localization.$globals.moreInfoButtonLabel })))));
|
|
5447
5439
|
}
|
|
5448
5440
|
get element() { return this; }
|
|
5449
5441
|
static get watchers() { return {
|
|
@@ -5554,4 +5546,4 @@ function defineCustomElement() {
|
|
|
5554
5546
|
|
|
5555
5547
|
export { StzhDropdown as S, defineCustomElement as d };
|
|
5556
5548
|
|
|
5557
|
-
//# sourceMappingURL=p-
|
|
5549
|
+
//# sourceMappingURL=p-a16a72e5.js.map
|