@oiz/stzh-components 3.3.0-beta1 → 3.3.0-beta4
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-c314a0a4.js → app-globals-add1c2c1.js} +2 -2
- package/dist/cjs/{app-globals-c314a0a4.js.map → app-globals-add1c2c1.js.map} +1 -1
- package/dist/cjs/index-92254d32.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-app-nav.cjs.entry.js +32 -0
- package/dist/cjs/stzh-app-nav.cjs.entry.js.map +1 -0
- package/dist/cjs/stzh-badge_3.cjs.entry.js +38 -17
- package/dist/cjs/stzh-badge_3.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-datepicker_3.cjs.entry.js +2 -0
- package/dist/cjs/stzh-datepicker_3.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-header.cjs.entry.js +57 -17
- package/dist/cjs/stzh-header.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-olmap.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-pagetitle.cjs.entry.js +1 -1
- package/dist/cjs/stzh-pagetitle.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-row.cjs.entry.js +1 -1
- package/dist/cjs/stzh-row.cjs.entry.js.map +1 -1
- package/dist/collection/assets/i18n/de.json +3 -0
- package/dist/collection/assets/i18n/en.json +3 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.css +247 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.e2e.js +16 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.e2e.js.map +1 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.js +79 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.js.map +1 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.localization.js +2 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.localization.js.map +1 -0
- package/dist/collection/components/stzh-app-nav/stzh-app-nav.stories.js +68 -0
- package/dist/collection/components/stzh-datepicker/stzh-datepicker.js +2 -0
- package/dist/collection/components/stzh-datepicker/stzh-datepicker.js.map +1 -1
- package/dist/collection/components/stzh-header/stzh-header.css +31 -2
- package/dist/collection/components/stzh-header/stzh-header.js +144 -21
- package/dist/collection/components/stzh-header/stzh-header.js.map +1 -1
- package/dist/collection/components/stzh-header/stzh-header.stories.js +72 -62
- package/dist/collection/components/stzh-icon/stzh-icon.js +38 -17
- package/dist/collection/components/stzh-icon/stzh-icon.js.map +1 -1
- package/dist/collection/components/stzh-olmap/stzh-olmap.js +1 -1
- package/dist/collection/components/stzh-olmap/stzh-olmap.js.map +1 -1
- package/dist/collection/components/stzh-pagetitle/stzh-pagetitle.css +0 -1
- package/dist/collection/components/stzh-row/stzh-row.css +184 -240
- 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-app-nav.d.ts +11 -0
- package/dist/components/stzh-app-nav.js +8 -0
- package/dist/components/stzh-app-nav.js.map +1 -0
- package/dist/components/stzh-app-nav2.js +64 -0
- package/dist/components/stzh-app-nav2.js.map +1 -0
- package/dist/components/stzh-datepicker2.js +2 -0
- package/dist/components/stzh-datepicker2.js.map +1 -1
- package/dist/components/stzh-header.js +84 -25
- package/dist/components/stzh-header.js.map +1 -1
- package/dist/components/stzh-icon2.js +38 -17
- package/dist/components/stzh-icon2.js.map +1 -1
- package/dist/components/stzh-olmap.js.map +1 -1
- package/dist/components/stzh-pagetitle.js +1 -1
- package/dist/components/stzh-pagetitle.js.map +1 -1
- package/dist/components/stzh-row.js +1 -1
- package/dist/components/stzh-row.js.map +1 -1
- package/dist/esm/{app-globals-b82e4e9d.js → app-globals-7f5414ca.js} +2 -2
- package/dist/esm/{app-globals-b82e4e9d.js.map → app-globals-7f5414ca.js.map} +1 -1
- package/dist/esm/index-e3050b18.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-app-nav.entry.js +28 -0
- package/dist/esm/stzh-app-nav.entry.js.map +1 -0
- package/dist/esm/stzh-badge_3.entry.js +38 -17
- package/dist/esm/stzh-badge_3.entry.js.map +1 -1
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-datepicker_3.entry.js +2 -0
- package/dist/esm/stzh-datepicker_3.entry.js.map +1 -1
- package/dist/esm/stzh-header.entry.js +57 -17
- package/dist/esm/stzh-header.entry.js.map +1 -1
- package/dist/esm/stzh-olmap.entry.js.map +1 -1
- package/dist/esm/stzh-pagetitle.entry.js +1 -1
- package/dist/esm/stzh-pagetitle.entry.js.map +1 -1
- package/dist/esm/stzh-row.entry.js +1 -1
- package/dist/esm/stzh-row.entry.js.map +1 -1
- package/dist/stzh-components/assets/i18n/de.json +3 -0
- package/dist/stzh-components/assets/i18n/en.json +3 -0
- package/dist/stzh-components/index.esm.js.map +1 -1
- package/dist/stzh-components/p-10dc377b.entry.js +2 -0
- package/dist/stzh-components/p-10dc377b.entry.js.map +1 -0
- package/dist/stzh-components/p-487b6e52.entry.js +2 -0
- package/dist/stzh-components/p-487b6e52.entry.js.map +1 -0
- package/dist/stzh-components/p-4f7f4362.entry.js +2 -0
- package/dist/stzh-components/p-4f7f4362.entry.js.map +1 -0
- package/dist/stzh-components/{p-d869745a.js → p-6009632f.js} +2 -2
- package/dist/stzh-components/p-6a1d65ce.entry.js +2 -0
- package/dist/stzh-components/p-6a1d65ce.entry.js.map +1 -0
- package/dist/stzh-components/p-b4f5d152.entry.js.map +1 -1
- package/dist/stzh-components/{p-c9265a65.entry.js → p-f0887c02.entry.js} +2 -2
- package/dist/stzh-components/p-f0887c02.entry.js.map +1 -0
- package/dist/stzh-components/p-f42f6787.entry.js +2 -0
- package/dist/stzh-components/p-f42f6787.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-app-nav/stzh-app-nav.d.ts +11 -0
- package/dist/types/components/stzh-app-nav/stzh-app-nav.localization.d.ts +4 -0
- package/dist/types/components/stzh-header/stzh-header.d.ts +18 -5
- package/dist/types/components/stzh-icon/stzh-icon.d.ts +3 -1
- package/dist/types/components/stzh-olmap/stzh-olmap.d.ts +1 -1
- package/dist/types/components.d.ts +75 -12
- package/dist/types/index.d.ts +10 -0
- package/dist/vscode-data.json +22 -6
- package/package.json +1 -1
- package/dist/stzh-components/p-6e29bc61.entry.js +0 -2
- package/dist/stzh-components/p-6e29bc61.entry.js.map +0 -1
- package/dist/stzh-components/p-b047262a.entry.js +0 -2
- package/dist/stzh-components/p-b047262a.entry.js.map +0 -1
- package/dist/stzh-components/p-b608bf1a.entry.js +0 -2
- package/dist/stzh-components/p-b608bf1a.entry.js.map +0 -1
- package/dist/stzh-components/p-b62c870a.entry.js +0 -2
- package/dist/stzh-components/p-b62c870a.entry.js.map +0 -1
- package/dist/stzh-components/p-c9265a65.entry.js.map +0 -1
- /package/dist/stzh-components/{p-d869745a.js.map → p-6009632f.js.map} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createComponentStory } from '../../utils/story-utils';
|
|
2
|
+
import { withActions } from '@storybook/addon-actions/decorator';
|
|
3
|
+
import readme from './readme.md?raw';
|
|
4
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
5
|
+
import { getFigmaLink } from '../../../figma';
|
|
6
|
+
|
|
7
|
+
const COMPONENT_NAME = 'stzh-app-nav';
|
|
8
|
+
const story = createComponentStory(COMPONENT_NAME);
|
|
9
|
+
|
|
10
|
+
const TEMPLATE = (args) => `
|
|
11
|
+
<stzh-app-nav .items=${JSON.stringify(args.items)}></stzh-app-nav>
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/AppNav',
|
|
16
|
+
component: COMPONENT_NAME,
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'full',
|
|
19
|
+
actions: {
|
|
20
|
+
handles: []
|
|
21
|
+
},
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component: readme
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
design: {
|
|
28
|
+
type: 'figma',
|
|
29
|
+
url: getFigmaLink('12288-148121'),
|
|
30
|
+
allowFullscreen: true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
decorators: [withActions, withDesign]
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const items = [
|
|
37
|
+
{
|
|
38
|
+
text: 'Dashboard',
|
|
39
|
+
href: '#',
|
|
40
|
+
active: true,
|
|
41
|
+
icon: 'home',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
text: 'Services',
|
|
45
|
+
href: '#',
|
|
46
|
+
a11yCurrent: 'page',
|
|
47
|
+
icon: 'bulleted-list',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
text: 'Mitteilungen',
|
|
51
|
+
href: '#',
|
|
52
|
+
badge: '3',
|
|
53
|
+
badgeType: 'error',
|
|
54
|
+
icon: 'mail',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
text: 'Einstellungen',
|
|
58
|
+
href: '#',
|
|
59
|
+
icon: 'filtering',
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export const Default = {
|
|
64
|
+
render: (args) => story(args, TEMPLATE),
|
|
65
|
+
args: {
|
|
66
|
+
items: items,
|
|
67
|
+
}
|
|
68
|
+
};
|
|
@@ -34,6 +34,8 @@ export class StzhDatepicker {
|
|
|
34
34
|
};
|
|
35
35
|
this.onCalendarChange = (event) => {
|
|
36
36
|
if (event.detail.component !== "stzh-calendar") {
|
|
37
|
+
// Do not emit stzhChange event from year/month dropdowns
|
|
38
|
+
event.stopPropagation();
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
41
|
this.value = event.detail.valueAsDate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stzh-datepicker.js","sourceRoot":"","sources":["../../../../src/components/stzh-datepicker/stzh-datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,CAAC,EACD,KAAK,EAEL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACP,MAAM,eAAe,CAAC;AASvB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;GAEG;AAMH,MAAM,OAAO,cAAc;;IAiLzB,6CAA6C;IAErC,gBAAW,GAAG,KAAK,IAAI,EAAE;MAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;IACjC,CAAC,CAAA;IAEO,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;OACpB;IACH,CAAC,CAAA;IAEO,mBAAc,GAAG,GAAG,EAAE;MAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;MAEzE,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,IAAI,UAAU,EAAE;QACzC,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAEhF,IAAI,IAAI,CAAC,KAAK,KAAK,aAAa,EAAE;UAChC,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC;SAC5B;aAAM;UACL,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAA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,CACF,CACO,CACJ,CAEX,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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 \"../../utils/date-adapter\"\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 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"]}
|
|
1
|
+
{"version":3,"file":"stzh-datepicker.js","sourceRoot":"","sources":["../../../../src/components/stzh-datepicker/stzh-datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,CAAC,EACD,KAAK,EAEL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACP,MAAM,eAAe,CAAC;AASvB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;GAEG;AAMH,MAAM,OAAO,cAAc;;IAiLzB,6CAA6C;IAErC,gBAAW,GAAG,KAAK,IAAI,EAAE;MAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;IACjC,CAAC,CAAA;IAEO,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;OACpB;IACH,CAAC,CAAA;IAEO,mBAAc,GAAG,GAAG,EAAE;MAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,W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,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAE,IAAI,CAAC,WAAW,GACd;cACf,WAAK,IAAI,EAAC,SAAS;gBACjB;kBACE,gEAAgE;kBAChE,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;gBAChB,WAAK,KAAK,EAAC,0BAA0B;kBACnC,YAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,CACF,CACO,CACJ,CAEX,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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 \"../../utils/date-adapter\"\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"]}
|
|
@@ -224,6 +224,7 @@
|
|
|
224
224
|
line-height: var(--stzh-font-milli-text-line-height);
|
|
225
225
|
letter-spacing: var(--stzh-font-curve---text-letter-spacing);
|
|
226
226
|
color: var(--stzh-color-grey90);
|
|
227
|
+
/* app-nav */
|
|
227
228
|
/* Search is filled */
|
|
228
229
|
/* Hide logo */
|
|
229
230
|
/* Fixed variant (as soon as header is passed) */
|
|
@@ -542,7 +543,7 @@
|
|
|
542
543
|
padding: 0;
|
|
543
544
|
position: absolute;
|
|
544
545
|
}
|
|
545
|
-
@media screen and (max-width:
|
|
546
|
+
@media screen and (max-width: 899px) {
|
|
546
547
|
.stzh-header__metanav-item-text.has-no-short-label {
|
|
547
548
|
border: 0;
|
|
548
549
|
clip: rect(0 0 0 0);
|
|
@@ -555,7 +556,7 @@
|
|
|
555
556
|
position: absolute;
|
|
556
557
|
}
|
|
557
558
|
}
|
|
558
|
-
@media screen and (max-width:
|
|
559
|
+
@media screen and (max-width: 899px) {
|
|
559
560
|
.stzh-header__metanav-item-text-label-long {
|
|
560
561
|
border: 0;
|
|
561
562
|
clip: rect(0 0 0 0);
|
|
@@ -568,7 +569,15 @@
|
|
|
568
569
|
position: absolute;
|
|
569
570
|
}
|
|
570
571
|
}
|
|
572
|
+
.stzh-header__metanav-item-text-label-short {
|
|
573
|
+
display: none;
|
|
574
|
+
}
|
|
571
575
|
@media screen and (min-width: 600px) {
|
|
576
|
+
.stzh-header__metanav-item-text-label-short {
|
|
577
|
+
display: flex;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
@media screen and (min-width: 900px) {
|
|
572
581
|
.stzh-header__metanav-item-text-label-short {
|
|
573
582
|
display: none;
|
|
574
583
|
}
|
|
@@ -1127,6 +1136,26 @@
|
|
|
1127
1136
|
font-weight: var(--stzh-font-weight-medium);
|
|
1128
1137
|
font-style: var(--stzh-font-style-medium);
|
|
1129
1138
|
}
|
|
1139
|
+
.stzh-header__app-nav {
|
|
1140
|
+
display: none;
|
|
1141
|
+
}
|
|
1142
|
+
@media screen and (min-width: 900px) {
|
|
1143
|
+
.stzh-header__app-nav {
|
|
1144
|
+
display: block;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
.stzh-header__app-nav-bottom {
|
|
1148
|
+
position: fixed;
|
|
1149
|
+
bottom: 0;
|
|
1150
|
+
left: 0;
|
|
1151
|
+
width: calc(100vw - var(--stzh-scrollbar-width));
|
|
1152
|
+
z-index: var(--stzh-z-index-header);
|
|
1153
|
+
}
|
|
1154
|
+
@media screen and (min-width: 900px) {
|
|
1155
|
+
.stzh-header__app-nav-bottom {
|
|
1156
|
+
display: none;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1130
1159
|
.stzh-header--is-search-filled .stzh-header__search-text {
|
|
1131
1160
|
border: 0;
|
|
1132
1161
|
clip: rect(0 0 0 0);
|
|
@@ -155,7 +155,10 @@ export class StzhHeader {
|
|
|
155
155
|
this.logoType = "default";
|
|
156
156
|
this.menuItems = [];
|
|
157
157
|
this.menuBackLabel = undefined;
|
|
158
|
-
this.
|
|
158
|
+
this.standardMetanavItems = [];
|
|
159
|
+
this.userSpecificMetanavItemsNotLoggedIn = [];
|
|
160
|
+
this.appNavItems = [];
|
|
161
|
+
this.userSpecificMetanavItemsEndpoint = undefined;
|
|
159
162
|
this.languageActive = undefined;
|
|
160
163
|
this.languages = [];
|
|
161
164
|
this.languagePreventUrlchange = false;
|
|
@@ -165,6 +168,7 @@ export class StzhHeader {
|
|
|
165
168
|
this.searchFieldName = "q";
|
|
166
169
|
this.searchValue = "";
|
|
167
170
|
this.sticky = "default";
|
|
171
|
+
this.loginErrorMessage = "";
|
|
168
172
|
this.logoAnalyticsId = undefined;
|
|
169
173
|
this.hideLogo = false;
|
|
170
174
|
this.headerHeight = undefined;
|
|
@@ -178,6 +182,8 @@ export class StzhHeader {
|
|
|
178
182
|
this.currentOpenMenuItem = null;
|
|
179
183
|
this.currentOpenMetanavItem = null;
|
|
180
184
|
this.currentOpenLanguage = false;
|
|
185
|
+
this.userSpecificMetanavItemsLoggedIn = [];
|
|
186
|
+
this.combinedMetanavItems = [];
|
|
181
187
|
}
|
|
182
188
|
handleKeydown(event) {
|
|
183
189
|
if (event.key === "Escape") {
|
|
@@ -300,14 +306,17 @@ export class StzhHeader {
|
|
|
300
306
|
}
|
|
301
307
|
this._menuItems = this._menuItems.map((menuItem, index) => (Object.assign({ id: `submenu-${index}` }, menuItem)));
|
|
302
308
|
}
|
|
303
|
-
|
|
309
|
+
standardMetanavItemsWatcher(newValue) {
|
|
304
310
|
if (typeof newValue === "string") {
|
|
305
|
-
this.
|
|
311
|
+
this._standardMetanavItems = JSON.parse(newValue);
|
|
306
312
|
}
|
|
307
313
|
else {
|
|
308
|
-
this.
|
|
314
|
+
this._standardMetanavItems = newValue;
|
|
309
315
|
}
|
|
310
|
-
this.
|
|
316
|
+
this._standardMetanavItems = this._standardMetanavItems.map((metanavItem, index) => (Object.assign({ id: `metanav-submenu-${index}` }, metanavItem)));
|
|
317
|
+
}
|
|
318
|
+
userSpecificMetanavItemsNotLoggedInWatcher(newValue) {
|
|
319
|
+
this._userSpecificMetanavItemsNotLoggedIn = newValue;
|
|
311
320
|
}
|
|
312
321
|
languagesWatcher(newValue) {
|
|
313
322
|
if (typeof newValue === "string") {
|
|
@@ -425,11 +434,34 @@ export class StzhHeader {
|
|
|
425
434
|
this.lastOpener = null;
|
|
426
435
|
});
|
|
427
436
|
}
|
|
437
|
+
async requestUserSpecificMetanavItems() {
|
|
438
|
+
if (!this.userSpecificMetanavItemsEndpoint) {
|
|
439
|
+
this.combinedMetanavItems = [...this._standardMetanavItems, ...this._userSpecificMetanavItemsNotLoggedIn];
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
try {
|
|
443
|
+
const response = await fetch(this.userSpecificMetanavItemsEndpoint);
|
|
444
|
+
this.userSpecificMetanavItemsLoggedIn = await response.json();
|
|
445
|
+
this.combinedMetanavItems = [...this._standardMetanavItems, ...this.userSpecificMetanavItemsLoggedIn];
|
|
446
|
+
}
|
|
447
|
+
catch (error) {
|
|
448
|
+
this.combinedMetanavItems = [...this._standardMetanavItems, ...this._userSpecificMetanavItemsNotLoggedIn]; // fallback to not logged in items
|
|
449
|
+
console.error('Error fetching data:', error);
|
|
450
|
+
if (this.loginErrorMessage) {
|
|
451
|
+
document.querySelector('stzh-toastbar')
|
|
452
|
+
.toast(this.loginErrorMessage, {
|
|
453
|
+
type: 'error',
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
428
458
|
async componentWillLoad() {
|
|
429
459
|
this.menuItemsWatcher(this.menuItems);
|
|
430
|
-
this.
|
|
460
|
+
this.standardMetanavItemsWatcher(this.standardMetanavItems);
|
|
431
461
|
this.languagesWatcher(this.languages);
|
|
432
462
|
this.searchValueWatcher(this.searchValue);
|
|
463
|
+
this.userSpecificMetanavItemsNotLoggedInWatcher(this.userSpecificMetanavItemsNotLoggedIn);
|
|
464
|
+
this.requestUserSpecificMetanavItems();
|
|
433
465
|
if (!this.localization) {
|
|
434
466
|
this.localization = await window.stzhComponents.utils.fetchTranslations(this.element, "header");
|
|
435
467
|
}
|
|
@@ -479,30 +511,36 @@ export class StzhHeader {
|
|
|
479
511
|
"stzh-header--hide-logo": this.hideLogo,
|
|
480
512
|
"stzh-header--has-empty-metabar-mobile": !metanavBeforeUsed &&
|
|
481
513
|
!metanavAfterUsed &&
|
|
482
|
-
this.
|
|
514
|
+
this._standardMetanavItems.filter((item) => item.stay || item.stayAndShowInMobileMenu).length === 0 &&
|
|
483
515
|
this._menuItems.length === 0 &&
|
|
484
|
-
(this._languages.length === 0 ||
|
|
516
|
+
(this._languages.length === 0 ||
|
|
517
|
+
(this._languages.length > 0 && !this.languageStay)) &&
|
|
485
518
|
!this.searchAction,
|
|
486
519
|
"stzh-header--has-empty-metabar": !metanavBeforeUsed &&
|
|
487
520
|
!metanavAfterUsed &&
|
|
488
|
-
this.
|
|
521
|
+
this._standardMetanavItems.length === 0 &&
|
|
489
522
|
this._menuItems.length === 0 &&
|
|
490
523
|
this._languages.length === 0 &&
|
|
491
524
|
!this.searchAction,
|
|
492
525
|
[`stzh-header--sticky-${this.sticky}`]: !!this.sticky,
|
|
493
526
|
};
|
|
494
|
-
const activeLanguage = this.languageActive ||
|
|
495
|
-
|
|
527
|
+
const activeLanguage = this.languageActive ||
|
|
528
|
+
window.stzhComponents.utils.getLocale(this.element);
|
|
529
|
+
const activeLanguageOption = ((_a = this._languages) === null || _a === void 0 ? void 0 : _a.find(({ value }) => value === activeLanguage)) ||
|
|
530
|
+
((_b = this._languages) === null || _b === void 0 ? void 0 : _b[0]) ||
|
|
531
|
+
null;
|
|
496
532
|
const renderMetanavItemButton = (item, additionalClasses, additionalAttributes) => {
|
|
497
533
|
var _a;
|
|
498
|
-
const Element = ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 || item.itemButton || !item.href
|
|
499
|
-
|
|
534
|
+
const Element = ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 || item.itemButton || !item.href
|
|
535
|
+
? "button"
|
|
536
|
+
: "a";
|
|
537
|
+
return (h(Element, Object.assign({}, additionalAttributes, { href: Element === "a" && item.href, target: Element === "a" && item.target, style: { order: item.cssOrder }, class: Object.assign({ "stzh-header__metanav-item": true, "is-heavy": item.important, "is-stay": item.stay || item.stayAndShowInMobileMenu }, (additionalClasses || {})) }), h("span", { class: {
|
|
500
538
|
"stzh-header__metanav-item-text": true,
|
|
501
539
|
"is-vhidden": item.labelHidden,
|
|
502
540
|
"has-no-short-label": !item.labelShort,
|
|
503
541
|
} }, h("span", { class: "stzh-header__metanav-item-text-label-long" }, item.label), h("span", { class: "stzh-header__metanav-item-text-label-short", "aria-hidden": "true" }, item.labelShort)), item.icon && (h("span", { class: "stzh-header__metanav-icon-wrapper" }, item.icon && (h("stzh-icon", { class: `stzh-header__metanav-icon ${item.iconOpen ? "is-close" : ""}`, name: item.icon })), item.iconOpen && h("stzh-icon", { class: "stzh-header__metanav-icon is-open", name: item.iconOpen }), (item.badge || item.badgeEmpty) && (h("stzh-badge", { class: "stzh-header__metanav-icon-badge", label: item.badge, type: typeof item.badgeType === "undefined" ? "error" : item.badgeType }))))));
|
|
504
542
|
};
|
|
505
|
-
return (h(Host, null, h("header", { class: classes }, h("div", { class: "stzh-header__header", style: { paddingTop: `${this.paddingTop}px` } }, h("div", { class: "stzh-header__inner" }, h("div", { class: "stzh-header__main", ref: el => (this.mainElement = el) }, h("div", { class: "stzh-header__logobar", ref: el => (this.logobarElement = el) }, h("div", { class: "stzh-header__logobar-logo" }, h("a", { href: this.href, class: "stzh-header__logo-link", "s-object-id": this.logoAnalyticsId || "Header Logo" }, h("slot", { name: "logo" }))), h("div", { class: "stzh-header__logobar-decoration" })), !this.hideMetabar && (h("div", { class: "stzh-header__metabar", ref: el => (this.metabarElement = el) }, h("div", { class: "stzh-header__metabar-inner" }, h("slot", { name: "menu-before" }), this._menuItems.length > 0 && (h("button", { id: this.menuId, class: `stzh-header__burger ${this.flyoutOpen && !this.flyoutOpenedByMetanavItem && "is-open"}`, onClick: this.handleBurgerClick }, h("stzh-icon", { class: "stzh-header__burger-icon is-close", name: "menu" }), h("stzh-icon", { class: "stzh-header__burger-icon is-open", name: "close" }), h("div", { class: "stzh-header__burger-text" }, this.localization.menuLabel))), this.searchAction && !hasSlot(this.element, "search") && (h("form", { class: "stzh-header__metabar-search", action: this.searchAction, role: "search" }, h("label", { class: "stzh-header__search" }, h("input", { id: this.searchId, ref: el => (this.searchInput = el), class: "stzh-header__search-input", type: "search", name: this.searchFieldName, onChange: this.handleSearchChange, onInput: this.handleSearchInput }), h("stzh-icon", { class: "stzh-header__search-icon", name: "search" }), h("div", { class: "stzh-header__search-text" }, this.localization.searchLabel)))), hasSlot(this.element, "search") && (h("stzh-button", { iconPosition: "left", onClick: this.handleSearchButtonClick, variant: "tertiary-plain", size: "small" }, h("stzh-icon", { slot: "icon", name: "search", class: this.flyoutSearchOpen ? "stzh-header__search-button--is-hidden" : "" }), h("stzh-icon", { slot: "icon", name: "close", class: this.flyoutSearchOpen ? "" : "stzh-header__search-button--is-hidden" }), this.localization.searchLabel)), h("slot", { name: "menu-after" }), h("div", { class: "stzh-header__metabar-nav", id: this.metanavId }, h("slot", { name: "metanav-before" }), this.
|
|
543
|
+
return (h(Host, null, h("header", { class: classes }, h("div", { class: "stzh-header__header", style: { paddingTop: `${this.paddingTop}px` } }, this.appNavItems.length > 0 && (h("div", { class: "stzh-header__app-nav-bottom" }, h("stzh-app-nav", { items: this.appNavItems }))), h("div", { class: "stzh-header__inner" }, h("div", { class: "stzh-header__main", ref: el => (this.mainElement = el) }, h("div", { class: "stzh-header__logobar", ref: el => (this.logobarElement = el) }, h("div", { class: "stzh-header__logobar-logo" }, h("a", { href: this.href, class: "stzh-header__logo-link", "s-object-id": this.logoAnalyticsId || "Header Logo" }, h("slot", { name: "logo" }))), h("div", { class: "stzh-header__logobar-decoration" })), !this.hideMetabar && (h("div", { class: "stzh-header__metabar", ref: el => (this.metabarElement = el) }, h("div", { class: "stzh-header__metabar-inner" }, h("slot", { name: "menu-before" }), this._menuItems.length > 0 && (h("button", { id: this.menuId, class: `stzh-header__burger ${this.flyoutOpen && !this.flyoutOpenedByMetanavItem && "is-open"}`, onClick: this.handleBurgerClick }, h("stzh-icon", { class: "stzh-header__burger-icon is-close", name: "menu" }), h("stzh-icon", { class: "stzh-header__burger-icon is-open", name: "close" }), h("div", { class: "stzh-header__burger-text" }, this.localization.menuLabel))), this.searchAction && !hasSlot(this.element, "search") && (h("form", { class: "stzh-header__metabar-search", action: this.searchAction, role: "search" }, h("label", { class: "stzh-header__search" }, h("input", { id: this.searchId, ref: el => (this.searchInput = el), class: "stzh-header__search-input", type: "search", name: this.searchFieldName, onChange: this.handleSearchChange, onInput: this.handleSearchInput }), h("stzh-icon", { class: "stzh-header__search-icon", name: "search" }), h("div", { class: "stzh-header__search-text" }, this.localization.searchLabel)))), hasSlot(this.element, "search") && (h("stzh-button", { iconPosition: "left", onClick: this.handleSearchButtonClick, variant: "tertiary-plain", size: "small" }, h("stzh-icon", { slot: "icon", name: "search", class: this.flyoutSearchOpen ? "stzh-header__search-button--is-hidden" : "" }), h("stzh-icon", { slot: "icon", name: "close", class: this.flyoutSearchOpen ? "" : "stzh-header__search-button--is-hidden" }), this.localization.searchLabel)), h("slot", { name: "menu-after" }), this.appNavItems.length > 0 && (h("div", { class: "stzh-header__app-nav" }, h("stzh-app-nav", { items: this.appNavItems }))), h("div", { class: "stzh-header__metabar-nav", id: this.metanavId }, h("slot", { name: "metanav-before" }), this.combinedMetanavItems.map((item) => {
|
|
506
544
|
var _a, _b;
|
|
507
545
|
return ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 || item.itemButton ? (h(Fragment, null, renderMetanavItemButton(item, {
|
|
508
546
|
"is-popover-mobile": true,
|
|
@@ -557,7 +595,8 @@ export class StzhHeader {
|
|
|
557
595
|
} }, ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (h("button", { "aria-expanded": item === this.currentOpenMenuItem ? "true" : "false", "aria-controls": item.id, class: "stzh-header__menu-item is-level-1 has-items", onClick: item === this.currentOpenMenuItem
|
|
558
596
|
? () => this.closeMenuItem()
|
|
559
597
|
: e => this.openMenuItem(e, item) }, item.label)) : (h("a", { href: item.href, onClick: (e) => this.handleMenuItemClick(e, item), class: "stzh-header__menu-item is-level-1" }, item.label)), ((_b = item.items) === null || _b === void 0 ? void 0 : _b.length) > 0 && (h("ul", { id: item.id, class: "stzh-header__menu-list is-level-2", onFocusout: this.handleMenuListFocusout }, h("li", { class: "stzh-header__menu-list-item is-backlink" }, h("button", { class: "stzh-header__menu-item is-level-2 is-backlink", onClick: () => this.closeMenuItem() }, h("stzh-icon", { name: "angle-left" }), h("span", null, this.menuBackLabel ? this.menuBackLabel : this.localization.menuBackLabel))), h("li", { class: "stzh-header__menu-list-item" }, h("a", { href: item.href, onClick: (e) => this.handleMenuItemClick(e, item), class: "stzh-header__menu-item is-level-2 is-main" }, item.label)), item.items.map(item => (h("li", { class: "stzh-header__menu-list-item" }, h("a", { href: item.href, onClick: (e) => this.handleMenuItemClick(e, item), class: "stzh-header__menu-item is-level-2" }, item.label))))))));
|
|
560
|
-
}))), (((_d = this.
|
|
598
|
+
}))), (((_d = this.combinedMetanavItems) === null || _d === void 0 ? void 0 : _d.length) > 0 ||
|
|
599
|
+
((_e = this._languages) === null || _e === void 0 ? void 0 : _e.length) > 0) && (h("div", { class: "stzh-header__menu-metanav" }, h("nav", { class: "stzh-header__menu-metanav-nav" }, h("ul", { class: "stzh-header__menu-metanav-list is-level-1" }, this.combinedMetanavItems.map((item) => {
|
|
561
600
|
var _a, _b, _c;
|
|
562
601
|
return (h("li", { class: {
|
|
563
602
|
"stzh-header__menu-metanav-list-item": true,
|
|
@@ -774,7 +813,7 @@ export class StzhHeader {
|
|
|
774
813
|
"attribute": "menu-back-label",
|
|
775
814
|
"reflect": false
|
|
776
815
|
},
|
|
777
|
-
"
|
|
816
|
+
"standardMetanavItems": {
|
|
778
817
|
"type": "string",
|
|
779
818
|
"mutable": false,
|
|
780
819
|
"complexType": {
|
|
@@ -792,12 +831,73 @@ export class StzhHeader {
|
|
|
792
831
|
"optional": false,
|
|
793
832
|
"docs": {
|
|
794
833
|
"tags": [],
|
|
795
|
-
"text": "
|
|
834
|
+
"text": "Generic meta navigation items"
|
|
796
835
|
},
|
|
797
|
-
"attribute": "metanav-items",
|
|
836
|
+
"attribute": "standard-metanav-items",
|
|
798
837
|
"reflect": false,
|
|
799
838
|
"defaultValue": "[]"
|
|
800
839
|
},
|
|
840
|
+
"userSpecificMetanavItemsNotLoggedIn": {
|
|
841
|
+
"type": "unknown",
|
|
842
|
+
"mutable": false,
|
|
843
|
+
"complexType": {
|
|
844
|
+
"original": "StzhHeaderMetanavItem[]",
|
|
845
|
+
"resolved": "StzhHeaderMetanavItem[]",
|
|
846
|
+
"references": {
|
|
847
|
+
"StzhHeaderMetanavItem": {
|
|
848
|
+
"location": "import",
|
|
849
|
+
"path": "../../index",
|
|
850
|
+
"id": "src/index.ts::StzhHeaderMetanavItem"
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
"required": false,
|
|
855
|
+
"optional": false,
|
|
856
|
+
"docs": {
|
|
857
|
+
"tags": [],
|
|
858
|
+
"text": "User specific meta navigation items when the user is not logged in or the api call failed"
|
|
859
|
+
},
|
|
860
|
+
"defaultValue": "[]"
|
|
861
|
+
},
|
|
862
|
+
"appNavItems": {
|
|
863
|
+
"type": "unknown",
|
|
864
|
+
"mutable": false,
|
|
865
|
+
"complexType": {
|
|
866
|
+
"original": "StzhAppNavItem[]",
|
|
867
|
+
"resolved": "StzhAppNavItem[]",
|
|
868
|
+
"references": {
|
|
869
|
+
"StzhAppNavItem": {
|
|
870
|
+
"location": "import",
|
|
871
|
+
"path": "../../index",
|
|
872
|
+
"id": "src/index.ts::StzhAppNavItem"
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
"required": false,
|
|
877
|
+
"optional": false,
|
|
878
|
+
"docs": {
|
|
879
|
+
"tags": [],
|
|
880
|
+
"text": "App-nav items"
|
|
881
|
+
},
|
|
882
|
+
"defaultValue": "[]"
|
|
883
|
+
},
|
|
884
|
+
"userSpecificMetanavItemsEndpoint": {
|
|
885
|
+
"type": "string",
|
|
886
|
+
"mutable": false,
|
|
887
|
+
"complexType": {
|
|
888
|
+
"original": "string",
|
|
889
|
+
"resolved": "string",
|
|
890
|
+
"references": {}
|
|
891
|
+
},
|
|
892
|
+
"required": false,
|
|
893
|
+
"optional": false,
|
|
894
|
+
"docs": {
|
|
895
|
+
"tags": [],
|
|
896
|
+
"text": "Endpoint for cart and user menu when logged in"
|
|
897
|
+
},
|
|
898
|
+
"attribute": "user-specific-metanav-items-endpoint",
|
|
899
|
+
"reflect": false
|
|
900
|
+
},
|
|
801
901
|
"languageActive": {
|
|
802
902
|
"type": "string",
|
|
803
903
|
"mutable": true,
|
|
@@ -964,6 +1064,24 @@ export class StzhHeader {
|
|
|
964
1064
|
"reflect": false,
|
|
965
1065
|
"defaultValue": "\"default\""
|
|
966
1066
|
},
|
|
1067
|
+
"loginErrorMessage": {
|
|
1068
|
+
"type": "string",
|
|
1069
|
+
"mutable": false,
|
|
1070
|
+
"complexType": {
|
|
1071
|
+
"original": "string",
|
|
1072
|
+
"resolved": "string",
|
|
1073
|
+
"references": {}
|
|
1074
|
+
},
|
|
1075
|
+
"required": false,
|
|
1076
|
+
"optional": false,
|
|
1077
|
+
"docs": {
|
|
1078
|
+
"tags": [],
|
|
1079
|
+
"text": "Is sent to stzh-toastbar when the fetch for the user specific data fails"
|
|
1080
|
+
},
|
|
1081
|
+
"attribute": "login-error-message",
|
|
1082
|
+
"reflect": false,
|
|
1083
|
+
"defaultValue": "\"\""
|
|
1084
|
+
},
|
|
967
1085
|
"logoAnalyticsId": {
|
|
968
1086
|
"type": "string",
|
|
969
1087
|
"mutable": false,
|
|
@@ -996,7 +1114,9 @@ export class StzhHeader {
|
|
|
996
1114
|
"fixedTransition": {},
|
|
997
1115
|
"currentOpenMenuItem": {},
|
|
998
1116
|
"currentOpenMetanavItem": {},
|
|
999
|
-
"currentOpenLanguage": {}
|
|
1117
|
+
"currentOpenLanguage": {},
|
|
1118
|
+
"userSpecificMetanavItemsLoggedIn": {},
|
|
1119
|
+
"combinedMetanavItems": {}
|
|
1000
1120
|
};
|
|
1001
1121
|
}
|
|
1002
1122
|
static get events() {
|
|
@@ -1200,8 +1320,11 @@ export class StzhHeader {
|
|
|
1200
1320
|
"propName": "menuItems",
|
|
1201
1321
|
"methodName": "menuItemsWatcher"
|
|
1202
1322
|
}, {
|
|
1203
|
-
"propName": "
|
|
1204
|
-
"methodName": "
|
|
1323
|
+
"propName": "standardMetanavItems",
|
|
1324
|
+
"methodName": "standardMetanavItemsWatcher"
|
|
1325
|
+
}, {
|
|
1326
|
+
"propName": "userSpecificMetanavItemsNotLoggedIn",
|
|
1327
|
+
"methodName": "userSpecificMetanavItemsNotLoggedInWatcher"
|
|
1205
1328
|
}, {
|
|
1206
1329
|
"propName": "languages",
|
|
1207
1330
|
"methodName": "languagesWatcher"
|