@itcenteratunihelsinki/huds-lib 0.8.69 → 0.8.71
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/components/hy-dropdown.js +147 -46
- package/components/hy-dropdown.js.map +1 -1
- package/components/hy-footer-info.js +1 -1
- package/components/hy-footer-info.js.map +1 -1
- package/components/hy-footer-link-item2.js +2 -2
- package/components/hy-footer-link-item2.js.map +1 -1
- package/dist/cjs/huds-lib.cjs.js +1 -1
- package/dist/cjs/hy-breadcrumbs_15.cjs.entry.js +3 -3
- package/dist/cjs/hy-breadcrumbs_15.cjs.entry.js.map +1 -1
- package/dist/cjs/hy-dropdown.cjs.entry.js +226 -0
- package/dist/cjs/hy-dropdown.cjs.entry.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +5 -9
- package/dist/collection/components/footer/hy-footer-info/hy-footer-info.css +2 -2
- package/dist/collection/components/footer/hy-footer-link-item/hy-footer-link-item.css +8 -1
- package/dist/collection/components/footer/hy-footer-link-item/hy-footer-link-item.js +1 -1
- package/dist/collection/components/footer/hy-footer-link-item/hy-footer-link-item.js.map +1 -1
- package/dist/collection/components/hy-dropdown/hy-dropdown.css +48 -33
- package/dist/collection/components/hy-dropdown/hy-dropdown.js +232 -35
- package/dist/collection/components/hy-dropdown/hy-dropdown.js.map +1 -1
- package/dist/esm/huds-lib.js +1 -1
- package/dist/esm/hy-breadcrumbs_15.entry.js +3 -3
- package/dist/esm/hy-breadcrumbs_15.entry.js.map +1 -1
- package/dist/esm/hy-dropdown.entry.js +222 -0
- package/dist/esm/hy-dropdown.entry.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/huds-lib/huds-lib.esm.js +1 -1
- package/dist/huds-lib/huds-lib.esm.js.map +1 -1
- package/dist/huds-lib/hy-breadcrumbs_15.entry.js +1 -1
- package/dist/huds-lib/hy-breadcrumbs_15.entry.js.map +1 -1
- package/dist/huds-lib/hy-dropdown.entry.js +2 -0
- package/dist/huds-lib/hy-dropdown.entry.js.map +1 -0
- package/dist/types/components/hy-dropdown/hy-dropdown.d.ts +17 -3
- package/dist/types/components.d.ts +10 -36
- package/package.json +2 -2
- package/components/hy-dropdown-panel-item.d.ts +0 -11
- package/components/hy-dropdown-panel-item.js +0 -8
- package/components/hy-dropdown-panel-item.js.map +0 -1
- package/components/hy-dropdown-panel.d.ts +0 -11
- package/components/hy-dropdown-panel.js +0 -8
- package/components/hy-dropdown-panel.js.map +0 -1
- package/components/hy-dropdown.panel.item.js +0 -43
- package/components/hy-dropdown.panel.item.js.map +0 -1
- package/components/hy-dropdown.panel.js +0 -31
- package/components/hy-dropdown.panel.js.map +0 -1
- package/dist/cjs/hy-dropdown_3.cjs.entry.js +0 -141
- package/dist/cjs/hy-dropdown_3.cjs.entry.js.map +0 -1
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js +0 -87
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js.map +0 -1
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js +0 -32
- package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js.map +0 -1
- package/dist/esm/hy-dropdown_3.entry.js +0 -135
- package/dist/esm/hy-dropdown_3.entry.js.map +0 -1
- package/dist/huds-lib/hy-dropdown_3.entry.js +0 -2
- package/dist/huds-lib/hy-dropdown_3.entry.js.map +0 -1
- package/dist/types/components/hy-dropdown/hy-dropdown.panel.d.ts +0 -4
- package/dist/types/components/hy-dropdown/hy-dropdown.panel.item.d.ts +0 -7
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { j as jsonParserWorker } from './globalScript.js';
|
|
3
|
-
import { d as defineCustomElement$4 } from './hy-dropdown.panel.js';
|
|
4
|
-
import { d as defineCustomElement$3 } from './hy-dropdown.panel.item.js';
|
|
5
3
|
import { d as defineCustomElement$2 } from './icon.js';
|
|
6
4
|
|
|
7
|
-
const hyDropdownCss = ":root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}.hy-dropdown{display:inline-block;min-width:100%;position:relative}@media (min-width: 30rem){.hy-dropdown{min-width:48.3%}}@media (min-width: 75.0625rem){.hy-dropdown{min-width:23.03%}}.hy-dropdown label.hy-dropdown__button-label{font-size:1rem;line-height:20px;font-weight:700;display:block;font-family:var(--main-font-family);letter-spacing:-0.32px;margin-bottom:8px}.hy-dropdown--single .hy-dropdown__panel{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:330px;min-width:100%}.hy-dropdown__toggle{font-size:0.875rem;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--grayscale-white);border-radius:0;border:1px solid var(--grayscale-medium-dark);color:var(--link-blue);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--main-font-family);font-weight:600;min-height:40px;height:auto;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;letter-spacing:normal;padding:0 0 0 16px;text-align:left;max-width:280px;width:100%}@media (min-width: 30rem){.hy-dropdown__toggle{font-size:1rem;line-height:24px;min-height:44px}}@media (min-width: 75.0625rem){.hy-dropdown__toggle{min-height:48px}}.hy-dropdown__toggle:hover{border-color:var(--brand-main-light);cursor:pointer}.hy-dropdown__toggle:focus{border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}.hy-dropdown__toggle svg{pointer-events:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon{background-color:var(--brand-main-light);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.hy-dropdown__toggle.is-open .hy-dropdown__icon::before{display:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon svg{fill:var(--grayscale-white)}.hy-dropdown__icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;height:40px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:0 0 0 16px;position:relative;width:40px}.hy-dropdown__icon::before{border-left:0.5px solid var(--grayscale-medium-dark);content:\"\";display:inline-block;height:65%;left:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}@media (min-width: 30rem){.hy-dropdown__icon{height:44px;width:44px}}@media (min-width: 75.0625rem){.hy-dropdown__icon{height:48px;width:48px}}.hy-dropdown__icon svg{fill:var(--link-blue)}@media (min-width: 30rem){.hy-dropdown__icon svg{height:16px;width:16px}}.hy-dropdown__panel{background-color:var(--grayscale-white);-webkit-box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);list-style:none;margin:0;padding:6px;position:absolute;width:100%;z-index:11}.hy-dropdown__panel.is-hidden{display:none;visibility:hidden}.hy-dropdown__panel-item{
|
|
5
|
+
const hyDropdownCss = ":root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}.hy-dropdown{display:inline-block;min-width:100%;position:relative}@media (min-width: 30rem){.hy-dropdown{min-width:48.3%}}@media (min-width: 75.0625rem){.hy-dropdown{min-width:23.03%}}.hy-dropdown label.hy-dropdown__button-label{font-size:1rem;line-height:20px;font-weight:700;display:block;font-family:var(--main-font-family);letter-spacing:-0.32px;margin-bottom:8px}.hy-dropdown--single .hy-dropdown__panel{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:330px;min-width:100%}.hy-dropdown .hy-dropdown__hidden-input{display:none;height:0;font-size:0}.hy-dropdown__toggle{font-size:0.875rem;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--grayscale-white);border-radius:0;border:1px solid var(--grayscale-medium-dark);color:var(--link-blue);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--main-font-family);font-weight:600;min-height:40px;height:auto;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;letter-spacing:normal;padding:0 0 0 16px;text-align:left;max-width:280px;width:100%}@media (min-width: 30rem){.hy-dropdown__toggle{font-size:1rem;line-height:24px;min-height:44px}}@media (min-width: 75.0625rem){.hy-dropdown__toggle{min-height:48px}}.hy-dropdown__toggle:hover{border-color:var(--brand-main-light);cursor:pointer}.hy-dropdown__toggle:focus{border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}.hy-dropdown__toggle svg{pointer-events:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon{background-color:var(--brand-main-light);-webkit-transform:rotate(180deg);transform:rotate(180deg)}.hy-dropdown__toggle.is-open .hy-dropdown__icon::before{display:none}.hy-dropdown__toggle.is-open .hy-dropdown__icon svg{fill:var(--grayscale-white)}.hy-dropdown__icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;height:40px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:0 0 0 16px;position:relative;width:40px}.hy-dropdown__icon::before{border-left:0.5px solid var(--grayscale-medium-dark);content:\"\";display:inline-block;height:65%;left:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}@media (min-width: 30rem){.hy-dropdown__icon{height:44px;width:44px}}@media (min-width: 75.0625rem){.hy-dropdown__icon{height:48px;width:48px}}.hy-dropdown__icon svg{fill:var(--link-blue)}@media (min-width: 30rem){.hy-dropdown__icon svg{height:16px;width:16px}}.hy-dropdown__panel{background-color:var(--grayscale-white);-webkit-box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);box-shadow:0 10px 20px 0 rgba(0, 49, 70, 0.2);list-style:none;margin:0;padding:6px;position:absolute;width:100%;z-index:11}.hy-dropdown__panel.is-hidden{display:none;visibility:hidden}.hy-dropdown__panel-item{font-size:0.875rem;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--grayscale-white);border-radius:0;border:1px solid var(--grayscale-medium-dark);color:var(--link-blue);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--main-font-family);font-weight:600;min-height:40px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;letter-spacing:normal;position:relative;padding:0;text-align:left;width:100%}@media (min-width: 30rem){.hy-dropdown__panel-item{font-size:1rem;line-height:24px}}.hy-dropdown__panel-item:not(.is-last){margin-bottom:6px}.hy-dropdown__panel-item[aria-selected=true] .hy-dropdown__checkbox{border-color:var(--grayscale-black);border-style:solid inset solid solid;border-width:2px;color:var(--grayscale-black);outline:0;text-indent:-1px}.hy-dropdown__panel-item[aria-selected=true] .hy-dropdown__checkbox .hy-dropdown__label-icon{display:-webkit-inline-box !important;display:-ms-inline-flexbox !important;display:inline-flex !important;visibility:visible}.hy-dropdown__panel-item--focused{cursor:pointer;border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}.hy-dropdown__label-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:none !important;-ms-flex-negative:0;flex-shrink:0;height:40px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:relative;visibility:hidden;width:40px}.hy-dropdown__checkbox{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:40px;height:100%;margin:0;padding:0 16px;width:100%;z-index:10}.hy-dropdown__checkbox:hover{cursor:pointer;border-color:var(--brand-main-active)}.hy-dropdown__checkbox:focus-within{border-color:var(--brand-main-light);border-style:solid inset solid solid;border-width:2px;outline:0;text-indent:-1px}";
|
|
8
6
|
|
|
9
7
|
const HyDropdown$1 = /*@__PURE__*/ proxyCustomElement(class HyDropdown extends HTMLElement {
|
|
10
8
|
constructor() {
|
|
11
9
|
super();
|
|
12
10
|
this.__registerHost();
|
|
11
|
+
this.dropdownPanelToggled = createEvent(this, "dropdownPanelToggled", 7);
|
|
12
|
+
this.dropdropValueChange = createEvent(this, "dropdownValueChanged", 7);
|
|
13
|
+
this.dropdropMultiValueChange = createEvent(this, "dropdownMultiValueChanged", 7);
|
|
14
|
+
this.dropdownKeyPress = createEvent(this, "dropdownKeyPress", 7);
|
|
13
15
|
this.single = false;
|
|
14
16
|
this.dropdownLabel = null;
|
|
15
17
|
this.dropdownId = "dropdownToggle";
|
|
16
18
|
this.dropdownOptions = undefined;
|
|
17
19
|
this.defaultLabel = "All";
|
|
20
|
+
this.type = null;
|
|
18
21
|
this.defaultOption = null;
|
|
19
22
|
this.isPanelOpen = false;
|
|
20
23
|
this.isChecked = false;
|
|
21
24
|
this.currentSingle = [{ id: 0, label: this.defaultLabel, value: 0 }];
|
|
25
|
+
this.currentMulti = undefined;
|
|
26
|
+
this.focusedOptionIndex = 0;
|
|
22
27
|
}
|
|
23
28
|
async componentWillLoad() {
|
|
24
29
|
this._dropdownOptions = await jsonParserWorker(this.dropdownOptions);
|
|
@@ -49,59 +54,162 @@ const HyDropdown$1 = /*@__PURE__*/ proxyCustomElement(class HyDropdown extends H
|
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
|
-
|
|
53
|
-
this.isPanelOpen
|
|
54
|
-
}
|
|
55
|
-
handleClick(event) {
|
|
56
|
-
const dropdownToggleButtonElement = this.el.querySelector(`#${this.dropdownId}`);
|
|
57
|
-
const dropdownPanelElement = this.el.querySelector(".hy-dropdown__panel");
|
|
58
|
-
const dropdownPanelCheckboxElements = this.el.querySelectorAll(".hy-dropdown__checkbox");
|
|
59
|
-
const dropdownToggleButtonIconElement = this.el.querySelector(".hy-dropdown__icon");
|
|
60
|
-
const { target } = event;
|
|
61
|
-
const allowedElements = [
|
|
62
|
-
dropdownToggleButtonElement,
|
|
63
|
-
dropdownPanelElement,
|
|
64
|
-
dropdownToggleButtonIconElement,
|
|
65
|
-
...dropdownPanelCheckboxElements, // Spread ("copy") items to allowedElement array.
|
|
66
|
-
];
|
|
67
|
-
if (this.isPanelOpen && !allowedElements.includes(target)) {
|
|
57
|
+
panelListener(e) {
|
|
58
|
+
if (this.isPanelOpen && e.detail.dropdownId !== this.dropdownId) {
|
|
68
59
|
this.isPanelOpen = false;
|
|
69
60
|
}
|
|
61
|
+
}
|
|
62
|
+
handleMultiClick(event, option) {
|
|
70
63
|
event.stopPropagation();
|
|
64
|
+
const dropdownPanelCheckboxElements = this.el.getElementsByClassName("hy-dropdown__checkbox");
|
|
65
|
+
Array.from(dropdownPanelCheckboxElements).filter((i) => {
|
|
66
|
+
const item = i.closest("li");
|
|
67
|
+
if (item.dataset.id == option.id && !item.hasAttribute("aria-selected")) {
|
|
68
|
+
item.setAttribute("aria-selected", "true");
|
|
69
|
+
this.currentMulti =
|
|
70
|
+
this.currentMulti && this.currentMulti.length > 0 ? [...this.currentMulti, option] : [option];
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (item.dataset.id === option.id && item.hasAttribute("aria-selected")) {
|
|
74
|
+
item.removeAttribute("aria-selected");
|
|
75
|
+
if (this.currentMulti.length > 0) {
|
|
76
|
+
const index = this.currentMulti.indexOf(option);
|
|
77
|
+
this.currentMulti = this.currentMulti.splice(index, 1);
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
});
|
|
71
83
|
}
|
|
72
|
-
handleSingleClick(event) {
|
|
84
|
+
handleSingleClick(event, option) {
|
|
73
85
|
if (!this.single || !this.isPanelOpen)
|
|
74
86
|
return;
|
|
75
87
|
const dropdownPanelCheckboxElements = this.el.getElementsByClassName("hy-dropdown__checkbox");
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!item.checked) {
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
Array.from(dropdownPanelCheckboxElements).filter((i) => {
|
|
90
|
+
const item = i.closest("li");
|
|
91
|
+
if (item.dataset.id == option.id) {
|
|
92
|
+
if (item.hasAttribute("aria-selected")) {
|
|
93
|
+
item.removeAttribute("aria-selected");
|
|
83
94
|
this.currentSingle = [{ id: null, label: this.defaultLabel, value: null }];
|
|
84
95
|
return;
|
|
85
96
|
}
|
|
86
|
-
|
|
97
|
+
item.setAttribute("aria-selected", "true");
|
|
98
|
+
this.currentSingle = this._dropdownOptions.filter((o) => o.id == option.id);
|
|
87
99
|
return;
|
|
88
100
|
}
|
|
89
|
-
if (item.id !==
|
|
90
|
-
item.
|
|
101
|
+
if (item.dataset.id !== option.id && item.hasAttribute("aria-selected")) {
|
|
102
|
+
item.removeAttribute("aria-selected");
|
|
91
103
|
return;
|
|
92
104
|
}
|
|
93
105
|
return null;
|
|
94
106
|
});
|
|
107
|
+
}
|
|
108
|
+
handleKeyDown(event) {
|
|
95
109
|
event.stopPropagation();
|
|
110
|
+
switch (event.key) {
|
|
111
|
+
case "ArrowDown":
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
if (!this.isPanelOpen) {
|
|
114
|
+
this.handlePanelToggle(event);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.focusedOptionIndex = (this.focusedOptionIndex + 1) % this._dropdownOptions.length;
|
|
118
|
+
break;
|
|
119
|
+
case "ArrowUp":
|
|
120
|
+
this.focusedOptionIndex =
|
|
121
|
+
(this.focusedOptionIndex - 1 + this._dropdownOptions.length) % this._dropdownOptions.length;
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
break;
|
|
124
|
+
case "Enter":
|
|
125
|
+
case " ":
|
|
126
|
+
if (!this.isPanelOpen) {
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
this.handlePanelToggle(event);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (this.single) {
|
|
132
|
+
this.handleOptionSingleClick(event, this._dropdownOptions[this.focusedOptionIndex]);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.handleMultiOptionClick(event, this._dropdownOptions[this.focusedOptionIndex]);
|
|
136
|
+
}
|
|
137
|
+
const emitDetails = {
|
|
138
|
+
id: this.dropdownId,
|
|
139
|
+
type: this.type,
|
|
140
|
+
data: this._dropdownOptions[this.focusedOptionIndex],
|
|
141
|
+
};
|
|
142
|
+
this.dropdownKeyPress.emit(emitDetails);
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
break;
|
|
145
|
+
case "Escape":
|
|
146
|
+
case "Tab":
|
|
147
|
+
this.isPanelOpen = false;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
handlePanelToggle(e) {
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
this.isPanelOpen = !this.isPanelOpen;
|
|
154
|
+
const emitDetails = {
|
|
155
|
+
dropdownId: this.dropdownId,
|
|
156
|
+
panelOpen: this.isPanelOpen,
|
|
157
|
+
};
|
|
158
|
+
this.dropdownPanelToggled.emit(emitDetails);
|
|
159
|
+
}
|
|
160
|
+
handlePanelClickOutside(e) {
|
|
161
|
+
e.stopPropagation();
|
|
162
|
+
const dropdownToggleButtonElement = this.el.querySelector(`#${this.dropdownId}`);
|
|
163
|
+
const dropdownPanelElement = this.el.querySelector(".hy-dropdown__panel");
|
|
164
|
+
const dropdownPanelCheckboxElements = this.el.querySelectorAll(".hy-dropdown__panel-item");
|
|
165
|
+
const dropdownPanelCheckboxes = this.el.querySelectorAll(".hy-dropdown__checkbox");
|
|
166
|
+
const dropdownToggleButtonIconElement = this.el.querySelectorAll(".hy-dropdown__icon");
|
|
167
|
+
const { target } = e;
|
|
168
|
+
const allowedElements = [
|
|
169
|
+
this.el,
|
|
170
|
+
dropdownToggleButtonElement,
|
|
171
|
+
dropdownPanelElement,
|
|
172
|
+
...dropdownPanelCheckboxes,
|
|
173
|
+
dropdownToggleButtonIconElement,
|
|
174
|
+
...dropdownPanelCheckboxElements, // Spread ("copy") items to allowedElement array.
|
|
175
|
+
];
|
|
176
|
+
if (this.isPanelOpen && !allowedElements.includes(target)) {
|
|
177
|
+
this.isPanelOpen = false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
handleOptionSingleClick(event, option) {
|
|
181
|
+
event.stopPropagation();
|
|
182
|
+
this.handleSingleClick(event, option);
|
|
183
|
+
const emitDetails = {
|
|
184
|
+
id: this.dropdownId,
|
|
185
|
+
type: this.type,
|
|
186
|
+
data: option,
|
|
187
|
+
};
|
|
188
|
+
this.dropdropValueChange.emit(emitDetails);
|
|
189
|
+
}
|
|
190
|
+
handleMultiOptionClick(event, option) {
|
|
191
|
+
event.stopPropagation();
|
|
192
|
+
this.handleMultiClick(event, option);
|
|
193
|
+
const emitDetails = {
|
|
194
|
+
id: this.dropdownId,
|
|
195
|
+
type: this.type,
|
|
196
|
+
data: this.currentMulti,
|
|
197
|
+
};
|
|
198
|
+
this.dropdropMultiValueChange.emit(emitDetails);
|
|
199
|
+
}
|
|
200
|
+
handleOptionHover(index) {
|
|
201
|
+
this.focusedOptionIndex = index;
|
|
96
202
|
}
|
|
97
203
|
render() {
|
|
98
204
|
const { label: currentLabel, id: currentId, value: currentValue } = this.currentSingle[0];
|
|
99
205
|
const classAttributes = ["hy-dropdown", this.single ? "hy-dropdown--single" : ""].join(" ");
|
|
100
206
|
if (this.single) {
|
|
101
|
-
return (h(Host, { class: classAttributes }, this.dropdownLabel && (h("label", { class: "hy-dropdown__button-label", htmlFor: this.dropdownId }, this.dropdownLabel)), h("
|
|
207
|
+
return (h(Host, { class: classAttributes }, this.dropdownLabel && (h("label", { class: "hy-dropdown__button-label", htmlFor: this.dropdownId }, this.dropdownLabel)), h("div", { id: this.dropdownId, class: `hy-dropdown__toggle ${this.isPanelOpen ? "is-open" : ""}`, "aria-expanded": `${this.isPanelOpen || false}`, "aria-controls": "dropdownPanel", "aria-haspopup": "listbox", role: "combobox", onClick: (event) => this.handlePanelToggle(event), onKeyDown: (event) => this.handleKeyDown(event), "aria-label": this.dropdownLabel, "data-current-id": currentId, "data-current-value": currentValue, "data-value": currentId, tabIndex: 0 }, h("input", { "aria-hidden": "true", class: "hy-dropdown__hidden-input", type: "hidden", value: currentId }), currentLabel, h("hy-icon", { class: "hy-dropdown__icon", icon: "hy-icon-caret-down", size: 14, "aria-hidden": "true" })), h("ul", { "checkbox-checked": this.isChecked ? "true" : "false", id: "dropdownPanel", class: `hy-dropdown__panel ${!this.isPanelOpen ? "is-hidden" : ""}`, "aria-expanded": `${!this.isPanelOpen || false}`, role: "listbox", "aria-labelledby": "dropdownToggle" }, this._dropdownOptions.map(({ id, label, value }, index, items) => (h("li", { key: id, "data-id": `${id}`, role: "option", class: `hy-dropdown__panel-item ${this._dropdownOptions.length - 1 === index ? "is-last" : ""}
|
|
208
|
+
${this.focusedOptionIndex === index ? "hy-dropdown__panel-item--focused" : ""}`, onClick: (event) => this.handleOptionSingleClick(event, items[index]), onMouseEnter: () => this.handleOptionHover(index) }, h("span", { "data-id": `${id}`, class: "hy-dropdown__checkbox", "data-value": `${value}` }, label, h("hy-icon", { class: "hy-dropdown__label-icon", icon: "hy-icon-done", size: 14, "aria-hidden": "true" }))))))));
|
|
102
209
|
}
|
|
103
210
|
else {
|
|
104
|
-
return (h(Host, { class: classAttributes }, h("button", { id: this.dropdownId, class: `hy-dropdown__toggle ${this.isPanelOpen ? "is-open" : ""}`, "aria-expanded": `${this.isPanelOpen || false}`, "aria-controls": "dropdownPanel", onClick: () => this.handlePanelToggle(), "aria-label": this.dropdownLabel, type: "button" }, this.dropdownLabel && this.dropdownLabel, h("hy-icon", { class: "hy-dropdown__icon", icon: "hy-icon-caret-down", size: 14, "aria-hidden": "true" })), h("
|
|
211
|
+
return (h(Host, { class: classAttributes }, h("button", { id: this.dropdownId, class: `hy-dropdown__toggle ${this.isPanelOpen ? "is-open" : ""}`, "aria-expanded": `${this.isPanelOpen || false}`, "aria-controls": "dropdownPanel", "aria-haspopup": "listbox", role: "combobox", onClick: (event) => this.handlePanelToggle(event), "aria-label": this.dropdownLabel, type: "button" }, this.dropdownLabel && this.dropdownLabel, h("hy-icon", { class: "hy-dropdown__icon", icon: "hy-icon-caret-down", size: 14, "aria-hidden": "true" })), h("ul", { "checkbox-checked": this.isChecked ? "true" : "false", id: "dropdownPanel", class: `hy-dropdown__panel ${!this.isPanelOpen ? "is-hidden" : ""}`, "aria-expanded": `${!this.isPanelOpen || false}`, role: "listbox", "aria-labelledby": "dropdownToggle" }, this._dropdownOptions.map(({ id, label, value }, index, items) => (h("li", { key: id, "data-id": `${id}`, role: "option", class: `hy-dropdown__panel-item ${this._dropdownOptions.length - 1 === index ? "is-last" : ""}
|
|
212
|
+
${this.focusedOptionIndex === index ? "hy-dropdown__panel-item--focused" : ""}`, onClick: (event) => this.handleMultiOptionClick(event, items[index]), onMouseEnter: () => this.handleOptionHover(index) }, h("span", { "data-id": `${id}`, class: "hy-dropdown__checkbox", "data-value": `${value}` }, label, h("hy-icon", { class: "hy-dropdown__label-icon", icon: "hy-icon-done", size: 14, "aria-hidden": "true" }))))))));
|
|
105
213
|
}
|
|
106
214
|
}
|
|
107
215
|
get el() { return this; }
|
|
@@ -115,32 +223,25 @@ const HyDropdown$1 = /*@__PURE__*/ proxyCustomElement(class HyDropdown extends H
|
|
|
115
223
|
"dropdownId": [1, "dropdown-id"],
|
|
116
224
|
"dropdownOptions": [1, "dropdown-options"],
|
|
117
225
|
"defaultLabel": [1, "default-label"],
|
|
226
|
+
"type": [1],
|
|
118
227
|
"defaultOption": [1032, "default-option"],
|
|
119
228
|
"isPanelOpen": [32],
|
|
120
229
|
"isChecked": [32],
|
|
121
|
-
"currentSingle": [32]
|
|
122
|
-
|
|
230
|
+
"currentSingle": [32],
|
|
231
|
+
"currentMulti": [32],
|
|
232
|
+
"focusedOptionIndex": [32]
|
|
233
|
+
}, [[8, "dropdownPanelToggled", "panelListener"], [0, "keydown", "handleKeyDown"], [8, "click", "handlePanelClickOutside"]]]);
|
|
123
234
|
function defineCustomElement$1() {
|
|
124
235
|
if (typeof customElements === "undefined") {
|
|
125
236
|
return;
|
|
126
237
|
}
|
|
127
|
-
const components = ["hy-dropdown", "hy-
|
|
238
|
+
const components = ["hy-dropdown", "hy-icon"];
|
|
128
239
|
components.forEach(tagName => { switch (tagName) {
|
|
129
240
|
case "hy-dropdown":
|
|
130
241
|
if (!customElements.get(tagName)) {
|
|
131
242
|
customElements.define(tagName, HyDropdown$1);
|
|
132
243
|
}
|
|
133
244
|
break;
|
|
134
|
-
case "hy-dropdown-panel":
|
|
135
|
-
if (!customElements.get(tagName)) {
|
|
136
|
-
defineCustomElement$4();
|
|
137
|
-
}
|
|
138
|
-
break;
|
|
139
|
-
case "hy-dropdown-panel-item":
|
|
140
|
-
if (!customElements.get(tagName)) {
|
|
141
|
-
defineCustomElement$3();
|
|
142
|
-
}
|
|
143
|
-
break;
|
|
144
245
|
case "hy-icon":
|
|
145
246
|
if (!customElements.get(tagName)) {
|
|
146
247
|
defineCustomElement$2();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"hy-dropdown.js","mappings":";;;;;;AAAA,MAAM,aAAa,GAAG,4qLAA4qL;;MCoBrrLA,YAAU;;;;kBAGK,KAAK;yBACC,IAAI;sBACP,gBAAgB;;wBAEd,KAAK;yBACoB,IAAI;uBAC5B,KAAK;qBACP,KAAK;yBACM,CAAC,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;;EAEtF,MAAM,iBAAiB;IACrB,IAAI,CAAC,gBAAgB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;GACtE;EAED,mBAAmB;IACjB,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,wBAAwB,CAAQ,CAAC;IACxE,IAAI,K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hy-dropdown.tsx"],"sourcesContent":[".hy-dropdown {\n display: inline-block;\n min-width: 100%;\n position: relative;\n\n @include breakpoint($narrow) {\n min-width: 48.3%;\n }\n\n @include breakpoint($extrawide) {\n min-width: 23.03%;\n }\n\n label.hy-dropdown__button-label {\n @include font-size(16px, 20px);\n @include font-weight($bold);\n\n display: block;\n font-family: var(--main-font-family);\n letter-spacing: -0.32px;\n margin-bottom: 8px;\n }\n\n &--single {\n .hy-dropdown__panel {\n width: max-content;\n max-width: 330px;\n min-width: 100%;\n }\n }\n}\n\n.hy-dropdown__toggle {\n @include font-size(14px, 24px);\n align-items: center;\n background-color: var(--grayscale-white);\n border-radius: 0;\n border: 1px solid var(--grayscale-medium-dark);\n color: var(--link-blue);\n display: inline-flex;\n font-family: var(--main-font-family);\n font-weight: $semibold;\n min-height: 40px;\n height: auto;\n justify-content: space-between;\n letter-spacing: normal;\n padding: 0 0 0 16px;\n text-align: left;\n max-width: 280px;\n width: 100%;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n min-height: 44px;\n }\n\n @include breakpoint($extrawide) {\n min-height: 48px;\n }\n\n &:hover {\n border-color: var(--brand-main-light);\n cursor: pointer;\n }\n\n &:focus {\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n\n svg {\n pointer-events: none;\n }\n\n &.is-open {\n .hy-dropdown__icon {\n background-color: var(--brand-main-light);\n transform: rotate(180deg);\n\n &::before {\n display: none;\n }\n\n svg {\n fill: var(--grayscale-white);\n }\n }\n }\n}\n\n.hy-dropdown__icon {\n align-items: center;\n display: inline-flex;\n flex-shrink: 0;\n height: 40px;\n justify-content: center;\n margin: 0 0 0 16px;\n position: relative;\n width: 40px;\n\n &::before {\n //border-left: 1px dashed var(--grayscale-medium-dark);\n //Line weight 0,5 px; Line color #979797\n border-left: 0.5px solid var(--grayscale-medium-dark);\n content: \"\";\n display: inline-block;\n height: 65%;\n left: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n }\n\n @include breakpoint($narrow) {\n height: 44px;\n width: 44px;\n }\n\n @include breakpoint($extrawide) {\n height: 48px;\n width: 48px;\n }\n\n svg {\n fill: var(--link-blue);\n\n @include breakpoint($narrow) {\n height: 16px;\n width: 16px;\n }\n }\n}\n\n.hy-dropdown__panel {\n background-color: var(--grayscale-white);\n box-shadow: 0 10px 20px 0 rgba(0, 49, 70, 0.2);\n list-style: none;\n margin: 0;\n padding: 6px;\n position: absolute;\n width: 100%;\n z-index: 11;\n\n &.is-hidden {\n display: none;\n visibility: hidden;\n }\n}\n\n.hy-dropdown__panel-item {\n position: relative;\n\n &:not(.is-last) {\n margin-bottom: 6px;\n }\n}\n\n.hy-dropdown__label {\n @include font-size(14px, 24px);\n align-items: center;\n background-color: var(--grayscale-white);\n border-radius: 0;\n border: 1px solid var(--grayscale-medium-dark);\n color: var(--link-blue);\n display: inline-flex;\n font-family: var(--main-font-family);\n font-weight: $semibold;\n min-height: 40px;\n justify-content: space-between;\n letter-spacing: normal;\n padding: 0 16px;\n text-align: left;\n width: 100%;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n }\n}\n\n.hy-dropdown__label-icon {\n align-items: center;\n display: none !important;\n flex-shrink: 0;\n height: 40px;\n justify-content: center;\n position: relative;\n visibility: hidden;\n width: 40px;\n}\n\n.hy-dropdown__checkbox {\n height: 100%;\n margin: 0;\n opacity: 0;\n position: absolute;\n width: 100%;\n z-index: 10;\n\n &:checked {\n & + label {\n border-color: var(--grayscale-black);\n border-style: solid inset solid solid;\n border-width: 2px;\n color: var(--grayscale-black);\n outline: 0;\n text-indent: -1px; // Text stays in place.\n\n .hy-dropdown__label-icon {\n display: inline-flex !important;\n visibility: visible;\n }\n }\n }\n\n &:hover {\n cursor: pointer;\n\n & + label {\n border-color: var(--brand-main-light);\n }\n }\n\n &:focus {\n & + label {\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n }\n}\n","import {Component, Element, Host, h, State, Listen, Prop, Watch} from \"@stencil/core\";\nimport {jsonParserWorker} from \"../../global/globalScript\";\n\nexport interface IDropdownItem {\n id: string | number;\n label: string;\n value: string | number;\n}\n\nexport interface DefaultValue {\n id: string | number;\n label: string;\n value: string | number;\n}\n\n@Component({\n tag: \"hy-dropdown\",\n styleUrl: \"hy-dropdown.scss\",\n shadow: false,\n})\nexport class HyDropdown {\n private _dropdownOptions: IDropdownItem[];\n @Element() el: HTMLElement;\n @Prop() single: boolean = false;\n @Prop() dropdownLabel: string = null;\n @Prop() dropdownId: string = \"dropdownToggle\";\n @Prop() dropdownOptions: IDropdownItem[] | string;\n @Prop() defaultLabel: string = \"All\";\n @Prop({mutable: true}) defaultOption: string | number = null;\n @State() isPanelOpen: boolean = false;\n @State() isChecked: boolean = false;\n @State() currentSingle: DefaultValue[] = [{id: 0, label: this.defaultLabel, value: 0}];\n\n async componentWillLoad() {\n this._dropdownOptions = await jsonParserWorker(this.dropdownOptions);\n }\n\n componentWillUpdate() {\n const items = this.el.querySelectorAll(\".hy-dropdown__checkbox\") as any;\n if (items) {\n if ([...items].some((item) => item.checked == true)) {\n this.isChecked = true;\n } else {\n this.isChecked = false;\n }\n }\n }\n\n @Watch(\"defaultOption\")\n watchPropHandler(newValue: string | number, oldValue: string | number) {\n if (!this.single) return;\n\n if (newValue !== oldValue) {\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n\n Array.from(dropdownPanelCheckboxElements).filter((item) => {\n if (item.id == newValue) {\n item.checked = true;\n this.currentSingle = this._dropdownOptions.filter((option) => option.id == newValue) as any;\n return;\n }\n return null;\n });\n }\n }\n\n handlePanelToggle() {\n this.isPanelOpen = !this.isPanelOpen;\n }\n\n @Listen(\"click\", {target: \"window\"})\n handleClick(event) {\n const dropdownToggleButtonElement = this.el.querySelector(`#${this.dropdownId}`) as HTMLButtonElement;\n const dropdownPanelElement = this.el.querySelector(\".hy-dropdown__panel\") as HTMLElement;\n const dropdownPanelCheckboxElements = this.el.querySelectorAll(\".hy-dropdown__checkbox\");\n const dropdownToggleButtonIconElement = this.el.querySelector(\".hy-dropdown__icon\") as HTMLElement;\n\n const {target} = event;\n\n const allowedElements = [\n dropdownToggleButtonElement,\n dropdownPanelElement,\n dropdownToggleButtonIconElement,\n ...dropdownPanelCheckboxElements, // Spread (\"copy\") items to allowedElement array.\n ];\n\n if (this.isPanelOpen && !allowedElements.includes(target)) {\n this.isPanelOpen = false;\n }\n event.stopPropagation();\n }\n\n @Listen(\"click\", {capture: true})\n handleSingleClick(event) {\n if (!this.single || !this.isPanelOpen) return;\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n const allowedElements = [...dropdownPanelCheckboxElements];\n const {target} = event;\n if (!allowedElements.includes(target)) return;\n Array.from(dropdownPanelCheckboxElements).filter((item) => {\n if (item.id == target.id) {\n if (!item.checked) {\n this.currentSingle = [{id: null, label: this.defaultLabel, value: null}];\n return;\n }\n this.currentSingle = this._dropdownOptions.filter((option) => option.id == target.id) as any;\n return;\n }\n if (item.id !== target.id && item.checked) {\n item.checked = false;\n return;\n }\n return null;\n });\n\n event.stopPropagation();\n }\n\n render() {\n const {label: currentLabel, id: currentId, value: currentValue} = this.currentSingle[0];\n const classAttributes = [\"hy-dropdown\", this.single ? \"hy-dropdown--single\" : \"\"].join(\" \");\n\n if (this.single) {\n return (\n <Host class={classAttributes}>\n {this.dropdownLabel && (\n <label class=\"hy-dropdown__button-label\" htmlFor={this.dropdownId}>\n {this.dropdownLabel}\n </label>\n )}\n <button\n id={this.dropdownId}\n class={`hy-dropdown__toggle ${this.isPanelOpen ? \"is-open\" : \"\"}`}\n aria-expanded={`${this.isPanelOpen || false}`}\n aria-controls=\"dropdownPanel\"\n onClick={() => this.handlePanelToggle()}\n aria-label={this.dropdownLabel}\n data-current-id={currentId}\n data-current-value={currentValue}\n value={currentId}\n type=\"button\"\n >\n {currentLabel}\n <hy-icon class=\"hy-dropdown__icon\" icon={\"hy-icon-caret-down\"} size={14} aria-hidden=\"true\" />\n </button>\n <hy-dropdown-panel checkbox-checked={this.isChecked ? \"true\" : \"false\"} is-hidden={!this.isPanelOpen}>\n {this._dropdownOptions.map(({id, label, value}, index) => (\n <hy-dropdown-panel-item\n dropdown-item-id={id}\n dropdown-item-label={label}\n dropdown-item-value={value}\n is-last={this._dropdownOptions.length - 1 === index}\n />\n ))}\n </hy-dropdown-panel>\n </Host>\n );\n } else {\n return (\n <Host class={classAttributes}>\n <button\n id={this.dropdownId}\n class={`hy-dropdown__toggle ${this.isPanelOpen ? \"is-open\" : \"\"}`}\n aria-expanded={`${this.isPanelOpen || false}`}\n aria-controls=\"dropdownPanel\"\n onClick={() => this.handlePanelToggle()}\n aria-label={this.dropdownLabel}\n type=\"button\"\n >\n {this.dropdownLabel && this.dropdownLabel}\n <hy-icon class=\"hy-dropdown__icon\" icon={\"hy-icon-caret-down\"} size={14} aria-hidden=\"true\" />\n </button>\n <hy-dropdown-panel checkbox-checked={this.isChecked ? \"true\" : \"false\"} is-hidden={!this.isPanelOpen}>\n {this._dropdownOptions.map(({id, label, value}, index) => (\n <hy-dropdown-panel-item\n dropdown-item-id={id}\n dropdown-item-label={label}\n dropdown-item-value={value}\n is-last={this._dropdownOptions.length - 1 === index}\n />\n ))}\n </hy-dropdown-panel>\n </Host>\n );\n }\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"hy-dropdown.js","mappings":";;;;AAAA,MAAM,aAAa,GAAG,giMAAgiM;;MCoBziMA,YAAU;;;;;;;;kBAGK,KAAK;yBACC,IAAI;sBACP,gBAAgB;;wBAEd,KAAK;gBACb,IAAI;yBAC6B,IAAI;uBAC5B,KAAK;qBACP,KAAK;yBACM,CAAC,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,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AAC,IAAI,CAAC,WAAW,IAAI,KAAK,EAAE,EAC9C,IAAI,EAAC,SAAS,qBACE,gBAAgB,IAE/B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAC,EAAE,KAAK,EAAE,KAAK,MAC1D,UACE,GAAG,EAAE,EAAE,aACE,GAAG,EAAE,EAAE,EAChB,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,2BAA2B,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,KAAK,KAAK,GAAG,SAAS,GAAG,EAAE;oBACzF,IAAI,CAAC,kBAAkB,KAAK,KAAK,GAAG,kCAAkC,GAAG,EAAE,EAAE,EACjF,OAAO,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EACpE,YAAY,EAAE,MAAM,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAEjD,uBAAe,GAAG,EAAE,EAAE,EAAE,KAAK,EAAC,uBAAuB,gBAAa,GAAG,KAAK,EAAE,IACzE,KAAK,EACN,eAAS,KAAK,EAAC,yBAAyB,EAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,CACzF,CACJ,CACN,CAAC,CACC,CACA,EACP;KACH;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["HyDropdown"],"sources":["./src/components/hy-dropdown/hy-dropdown.scss?tag=hy-dropdown","./src/components/hy-dropdown/hy-dropdown.tsx"],"sourcesContent":[".hy-dropdown {\n display: inline-block;\n min-width: 100%;\n position: relative;\n\n @include breakpoint($narrow) {\n min-width: 48.3%;\n }\n\n @include breakpoint($extrawide) {\n min-width: 23.03%;\n }\n\n label.hy-dropdown__button-label {\n @include font-size(16px, 20px);\n @include font-weight($bold);\n\n display: block;\n font-family: var(--main-font-family);\n letter-spacing: -0.32px;\n margin-bottom: 8px;\n }\n\n &--single {\n .hy-dropdown__panel {\n width: max-content;\n max-width: 330px;\n min-width: 100%;\n }\n }\n\n .hy-dropdown__hidden-input {\n display: none;\n height: 0;\n font-size: 0;\n }\n}\n\n.hy-dropdown__toggle {\n @include font-size(14px, 24px);\n align-items: center;\n background-color: var(--grayscale-white);\n border-radius: 0;\n border: 1px solid var(--grayscale-medium-dark);\n color: var(--link-blue);\n display: inline-flex;\n font-family: var(--main-font-family);\n font-weight: $semibold;\n min-height: 40px;\n height: auto;\n justify-content: space-between;\n letter-spacing: normal;\n padding: 0 0 0 16px;\n text-align: left;\n max-width: 280px;\n width: 100%;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n min-height: 44px;\n }\n\n @include breakpoint($extrawide) {\n min-height: 48px;\n }\n\n &:hover {\n border-color: var(--brand-main-light);\n cursor: pointer;\n }\n\n &:focus {\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n\n svg {\n pointer-events: none;\n }\n\n &.is-open {\n .hy-dropdown__icon {\n background-color: var(--brand-main-light);\n transform: rotate(180deg);\n\n &::before {\n display: none;\n }\n\n svg {\n fill: var(--grayscale-white);\n }\n }\n }\n}\n\n.hy-dropdown__icon {\n align-items: center;\n display: inline-flex;\n flex-shrink: 0;\n height: 40px;\n justify-content: center;\n margin: 0 0 0 16px;\n position: relative;\n width: 40px;\n\n &::before {\n //border-left: 1px dashed var(--grayscale-medium-dark);\n //Line weight 0,5 px; Line color #979797\n border-left: 0.5px solid var(--grayscale-medium-dark);\n content: \"\";\n display: inline-block;\n height: 65%;\n left: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n }\n\n @include breakpoint($narrow) {\n height: 44px;\n width: 44px;\n }\n\n @include breakpoint($extrawide) {\n height: 48px;\n width: 48px;\n }\n\n svg {\n fill: var(--link-blue);\n\n @include breakpoint($narrow) {\n height: 16px;\n width: 16px;\n }\n }\n}\n\n.hy-dropdown__panel {\n background-color: var(--grayscale-white);\n box-shadow: 0 10px 20px 0 rgba(0, 49, 70, 0.2);\n list-style: none;\n margin: 0;\n padding: 6px;\n position: absolute;\n width: 100%;\n z-index: 11;\n\n &.is-hidden {\n display: none;\n visibility: hidden;\n }\n}\n\n.hy-dropdown__panel-item {\n @include font-size(14px, 24px);\n align-items: center;\n background-color: var(--grayscale-white);\n border-radius: 0;\n border: 1px solid var(--grayscale-medium-dark);\n color: var(--link-blue);\n display: inline-flex;\n font-family: var(--main-font-family);\n font-weight: $semibold;\n min-height: 40px;\n justify-content: space-between;\n letter-spacing: normal;\n position: relative;\n padding: 0;\n text-align: left;\n width: 100%;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n }\n\n &:not(.is-last) {\n margin-bottom: 6px;\n }\n\n &[aria-selected=\"true\"] .hy-dropdown__checkbox {\n border-color: var(--grayscale-black);\n border-style: solid inset solid solid;\n border-width: 2px;\n color: var(--grayscale-black);\n outline: 0;\n text-indent: -1px; // Text stays in place.\n\n .hy-dropdown__label-icon {\n display: inline-flex !important;\n visibility: visible;\n }\n }\n\n &--focused {\n cursor: pointer;\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n}\n\n.hy-dropdown__label-icon {\n align-items: center;\n display: none !important;\n flex-shrink: 0;\n height: 40px;\n justify-content: center;\n position: relative;\n visibility: hidden;\n width: 40px;\n}\n\n.hy-dropdown__checkbox {\n display: flex;\n align-items: center;\n min-height: 40px;\n height: 100%;\n margin: 0;\n padding: 0 16px;\n width: 100%;\n z-index: 10;\n\n &:hover {\n cursor: pointer;\n border-color: var(--brand-main-active);\n }\n\n &:focus-within {\n & {\n border-color: var(--brand-main-light);\n border-style: solid inset solid solid;\n border-width: 2px;\n outline: 0;\n text-indent: -1px; // Text stays in place.\n }\n }\n}\n","import {Component, Element, Host, Listen, Event, EventEmitter, h, State, Prop, Watch} from \"@stencil/core\";\nimport {jsonParserWorker} from \"../../global/globalScript\";\n\nexport interface IDropdownItem {\n id: string | number;\n label: string;\n value: string | number;\n}\n\nexport interface DefaultValue {\n id: string | number;\n label: string;\n value: string | number;\n}\n\n@Component({\n tag: \"hy-dropdown\",\n styleUrl: \"hy-dropdown.scss\",\n shadow: false,\n})\nexport class HyDropdown {\n private _dropdownOptions: IDropdownItem[];\n @Element() el: HTMLElement;\n @Prop() single: boolean = false;\n @Prop() dropdownLabel: string = null;\n @Prop() dropdownId: string = \"dropdownToggle\";\n @Prop() dropdownOptions: IDropdownItem[] | string;\n @Prop() defaultLabel: string = \"All\";\n @Prop() type: string = null;\n @Prop({mutable: true}) defaultOption: string | number = null;\n @State() isPanelOpen: boolean = false;\n @State() isChecked: boolean = false;\n @State() currentSingle: DefaultValue[] = [{id: 0, label: this.defaultLabel, value: 0}];\n @State() currentMulti: IDropdownItem[];\n\n @State() focusedOptionIndex: number = 0;\n\n @Event({\n eventName: `dropdownPanelToggled`,\n composed: true,\n bubbles: true,\n })\n dropdownPanelToggled: EventEmitter;\n\n @Event({\n eventName: `dropdownValueChanged`,\n composed: true,\n })\n dropdropValueChange: EventEmitter;\n\n @Event({\n eventName: `dropdownMultiValueChanged`,\n composed: true,\n })\n dropdropMultiValueChange: EventEmitter;\n\n @Event({\n eventName: `dropdownKeyPress`,\n composed: true,\n })\n dropdownKeyPress: EventEmitter;\n\n async componentWillLoad() {\n this._dropdownOptions = await jsonParserWorker(this.dropdownOptions);\n }\n\n componentWillUpdate() {\n const items = this.el.querySelectorAll(\".hy-dropdown__checkbox\") as any;\n if (items) {\n if ([...items].some((item) => item.checked == true)) {\n this.isChecked = true;\n } else {\n this.isChecked = false;\n }\n }\n }\n\n @Watch(\"defaultOption\")\n watchPropHandler(newValue: string | number, oldValue: string | number) {\n if (!this.single) return;\n\n if (newValue !== oldValue) {\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n\n Array.from(dropdownPanelCheckboxElements).filter((item) => {\n if (item.id == newValue) {\n item.checked = true;\n this.currentSingle = this._dropdownOptions.filter((option) => option.id == newValue) as any;\n return;\n }\n return null;\n });\n }\n }\n\n @Listen(\"dropdownPanelToggled\", {target: \"window\"})\n panelListener(e) {\n if (this.isPanelOpen && e.detail.dropdownId !== this.dropdownId) {\n this.isPanelOpen = false;\n }\n }\n\n private handleMultiClick(event, option) {\n event.stopPropagation();\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n Array.from(dropdownPanelCheckboxElements).filter((i) => {\n const item = i.closest(\"li\");\n if (item.dataset.id == option.id && !item.hasAttribute(\"aria-selected\")) {\n item.setAttribute(\"aria-selected\", \"true\");\n this.currentMulti =\n this.currentMulti && this.currentMulti.length > 0 ? [...this.currentMulti, option] : [option];\n return;\n }\n if (item.dataset.id === option.id && item.hasAttribute(\"aria-selected\")) {\n item.removeAttribute(\"aria-selected\");\n if (this.currentMulti.length > 0) {\n const index = this.currentMulti.indexOf(option);\n this.currentMulti = this.currentMulti.splice(index, 1);\n }\n return;\n }\n return null;\n });\n }\n\n private handleSingleClick(event, option) {\n if (!this.single || !this.isPanelOpen) return;\n const dropdownPanelCheckboxElements = this.el.getElementsByClassName(\"hy-dropdown__checkbox\") as HTMLCollectionOf<\n HTMLInputElement\n >;\n event.stopPropagation();\n\n Array.from(dropdownPanelCheckboxElements).filter((i) => {\n const item = i.closest(\"li\");\n if (item.dataset.id == option.id) {\n if (item.hasAttribute(\"aria-selected\")) {\n item.removeAttribute(\"aria-selected\");\n this.currentSingle = [{id: null, label: this.defaultLabel, value: null}];\n return;\n }\n item.setAttribute(\"aria-selected\", \"true\");\n this.currentSingle = this._dropdownOptions.filter((o) => o.id == option.id) as any;\n return;\n }\n if (item.dataset.id !== option.id && item.hasAttribute(\"aria-selected\")) {\n item.removeAttribute(\"aria-selected\");\n return;\n }\n return null;\n });\n }\n\n @Listen(\"keydown\", {capture: false})\n handleKeyDown(event: KeyboardEvent) {\n event.stopPropagation();\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n if (!this.isPanelOpen) {\n this.handlePanelToggle(event);\n return;\n }\n this.focusedOptionIndex = (this.focusedOptionIndex + 1) % this._dropdownOptions.length;\n break;\n case \"ArrowUp\":\n this.focusedOptionIndex =\n (this.focusedOptionIndex - 1 + this._dropdownOptions.length) % this._dropdownOptions.length;\n event.preventDefault();\n break;\n case \"Enter\":\n case \" \":\n if (!this.isPanelOpen) {\n event.preventDefault();\n this.handlePanelToggle(event);\n return;\n }\n if (this.single) {\n this.handleOptionSingleClick(event, this._dropdownOptions[this.focusedOptionIndex]);\n } else {\n this.handleMultiOptionClick(event, this._dropdownOptions[this.focusedOptionIndex]);\n }\n const emitDetails = {\n id: this.dropdownId,\n type: this.type,\n data: this._dropdownOptions[this.focusedOptionIndex],\n };\n this.dropdownKeyPress.emit(emitDetails);\n event.preventDefault();\n break;\n case \"Escape\":\n case \"Tab\":\n this.isPanelOpen = false;\n break;\n default:\n break;\n }\n }\n\n private handlePanelToggle(e) {\n e.stopPropagation();\n this.isPanelOpen = !this.isPanelOpen;\n\n const emitDetails = {\n dropdownId: this.dropdownId,\n panelOpen: this.isPanelOpen,\n };\n this.dropdownPanelToggled.emit(emitDetails);\n }\n\n @Listen(\"click\", {target: \"window\"})\n handlePanelClickOutside(e) {\n e.stopPropagation();\n const dropdownToggleButtonElement = this.el.querySelector(`#${this.dropdownId}`) as HTMLButtonElement;\n const dropdownPanelElement = this.el.querySelector(\".hy-dropdown__panel\") as HTMLElement;\n const dropdownPanelCheckboxElements = this.el.querySelectorAll(\".hy-dropdown__panel-item\");\n const dropdownPanelCheckboxes = this.el.querySelectorAll(\".hy-dropdown__checkbox\");\n const dropdownToggleButtonIconElement = this.el.querySelectorAll(\".hy-dropdown__icon\");\n\n const {target} = e;\n\n const allowedElements = [\n this.el,\n dropdownToggleButtonElement,\n dropdownPanelElement,\n ...dropdownPanelCheckboxes,\n dropdownToggleButtonIconElement,\n ...dropdownPanelCheckboxElements, // Spread (\"copy\") items to allowedElement array.\n ];\n\n if (this.isPanelOpen && !allowedElements.includes(target)) {\n this.isPanelOpen = false;\n }\n }\n\n private handleOptionSingleClick(event, option) {\n event.stopPropagation();\n this.handleSingleClick(event, option);\n const emitDetails = {\n id: this.dropdownId,\n type: this.type,\n data: option,\n };\n this.dropdropValueChange.emit(emitDetails);\n }\n\n private handleMultiOptionClick(event, option) {\n event.stopPropagation();\n this.handleMultiClick(event, option);\n const emitDetails = {\n id: this.dropdownId,\n type: this.type,\n data: this.currentMulti,\n };\n this.dropdropMultiValueChange.emit(emitDetails);\n }\n\n private handleOptionHover(index) {\n this.focusedOptionIndex = index;\n }\n\n render() {\n const {label: currentLabel, id: currentId, value: currentValue} = this.currentSingle[0];\n const classAttributes = [\"hy-dropdown\", this.single ? \"hy-dropdown--single\" : \"\"].join(\" \");\n if (this.single) {\n return (\n <Host class={classAttributes}>\n {this.dropdownLabel && (\n <label class=\"hy-dropdown__button-label\" htmlFor={this.dropdownId}>\n {this.dropdownLabel}\n </label>\n )}\n <div\n id={this.dropdownId}\n class={`hy-dropdown__toggle ${this.isPanelOpen ? \"is-open\" : \"\"}`}\n aria-expanded={`${this.isPanelOpen || false}`}\n aria-controls=\"dropdownPanel\"\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n onClick={(event) => this.handlePanelToggle(event)}\n onKeyDown={(event) => this.handleKeyDown(event)}\n aria-label={this.dropdownLabel}\n data-current-id={currentId}\n data-current-value={currentValue}\n data-value={currentId}\n tabIndex={0}\n >\n <input aria-hidden=\"true\" class=\"hy-dropdown__hidden-input\" type=\"hidden\" value={currentId}></input>\n {currentLabel}\n <hy-icon class=\"hy-dropdown__icon\" icon={\"hy-icon-caret-down\"} size={14} aria-hidden=\"true\" />\n </div>\n <ul\n checkbox-checked={this.isChecked ? \"true\" : \"false\"}\n id=\"dropdownPanel\"\n class={`hy-dropdown__panel ${!this.isPanelOpen ? \"is-hidden\" : \"\"}`}\n aria-expanded={`${!this.isPanelOpen || false}`}\n role=\"listbox\"\n aria-labelledby=\"dropdownToggle\"\n >\n {this._dropdownOptions.map(({id, label, value}, index, items) => (\n <li\n key={id}\n data-id={`${id}`}\n role=\"option\"\n class={`hy-dropdown__panel-item ${this._dropdownOptions.length - 1 === index ? \"is-last\" : \"\"}\n ${this.focusedOptionIndex === index ? \"hy-dropdown__panel-item--focused\" : \"\"}`}\n onClick={(event) => this.handleOptionSingleClick(event, items[index])}\n onMouseEnter={() => this.handleOptionHover(index)}\n >\n <span data-id={`${id}`} class=\"hy-dropdown__checkbox\" data-value={`${value}`}>\n {label}\n <hy-icon class=\"hy-dropdown__label-icon\" icon={\"hy-icon-done\"} size={14} aria-hidden=\"true\" />\n </span>\n </li>\n ))}\n </ul>\n </Host>\n );\n } else {\n return (\n <Host class={classAttributes}>\n <button\n id={this.dropdownId}\n class={`hy-dropdown__toggle ${this.isPanelOpen ? \"is-open\" : \"\"}`}\n aria-expanded={`${this.isPanelOpen || false}`}\n aria-controls=\"dropdownPanel\"\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n onClick={(event) => this.handlePanelToggle(event)}\n aria-label={this.dropdownLabel}\n type=\"button\"\n >\n {this.dropdownLabel && this.dropdownLabel}\n <hy-icon class=\"hy-dropdown__icon\" icon={\"hy-icon-caret-down\"} size={14} aria-hidden=\"true\" />\n </button>\n <ul\n checkbox-checked={this.isChecked ? \"true\" : \"false\"}\n id=\"dropdownPanel\"\n class={`hy-dropdown__panel ${!this.isPanelOpen ? \"is-hidden\" : \"\"}`}\n aria-expanded={`${!this.isPanelOpen || false}`}\n role=\"listbox\"\n aria-labelledby=\"dropdownToggle\"\n >\n {this._dropdownOptions.map(({id, label, value}, index, items) => (\n <li\n key={id}\n data-id={`${id}`}\n role=\"option\"\n class={`hy-dropdown__panel-item ${this._dropdownOptions.length - 1 === index ? \"is-last\" : \"\"}\n ${this.focusedOptionIndex === index ? \"hy-dropdown__panel-item--focused\" : \"\"}`}\n onClick={(event) => this.handleMultiOptionClick(event, items[index])}\n onMouseEnter={() => this.handleOptionHover(index)}\n >\n <span data-id={`${id}`} class=\"hy-dropdown__checkbox\" data-value={`${value}`}>\n {label}\n <hy-icon class=\"hy-dropdown__label-icon\" icon={\"hy-icon-done\"} size={14} aria-hidden=\"true\" />\n </span>\n </li>\n ))}\n </ul>\n </Host>\n );\n }\n }\n}\n"],"version":3}
|
|
@@ -11,7 +11,7 @@ import { d as defineCustomElement$4 } from './heading.js';
|
|
|
11
11
|
import { d as defineCustomElement$3 } from './icon.js';
|
|
12
12
|
import { d as defineCustomElement$2 } from './site-logo.js';
|
|
13
13
|
|
|
14
|
-
const hyFooterInfoCss = ":root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}:host{display:block}.hy-footer-info{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;max-height:auto;padding:0 16px 40px 16px;place-content:center space-between}@media (min-width: 30rem){.hy-footer-info{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin:0 auto;max-width:120.0625rem;padding:0 24px 32px 24px}}@media (min-width: 60rem){.hy-footer-info{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:0 32px 36px 32px}}@media (min-width: 75.0625rem){.hy-footer-info{padding:0 32px 40px 32px}}.hy-footer-info__content{margin-bottom:24px;width:100%}@media (min-width: 30rem){.hy-footer-info__content{margin-bottom:32px;width:100%}}@media (min-width: 60rem){.hy-footer-info__content{width:31.11%}}.hy-footer-info__content .hy-heading{padding-top:0 !important}.hy-footer-info__ingress{font-size:0.9375rem;line-height:20px;font-weight:400;letter-spacing:-0.09px;color:var(--grayscale-black);font-family:var(--main-font-family);padding-bottom:24px}@media (min-width: 60rem){.hy-footer-info__ingress{font-size:1rem;line-height:22px;letter-spacing:-0.1px;padding-bottom:16px}}@media (min-width: 1601px){.hy-footer-info__ingress{font-size:1.0625rem;line-height:26px}}@media (min-width: 75.0625rem){.hy-footer-info__ingress{padding-bottom:24px}}.hy-footer-info__ingress a{font-size:0.875rem;line-height:20px;color:var(--link-blue);font-family:var(--main-font-family);font-weight:600;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}@media (min-width: 30rem){.hy-footer-info__ingress a{font-size:1rem;line-height:24px;letter-spacing:-0.1px}}@media (min-width: 1601px){.hy-footer-info__ingress a{font-size:1.0625rem;line-height:26px}}.hy-footer-info__ingress a:hover{color:var(--brand-main)}.hy-footer-info__ingress a[target=_blank]:after{display:block;content:url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(4,121,165)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");margin-left:3px;-webkit-transform:rotate(315deg);transform:rotate(315deg)}.hy-footer-info__ingress a[target=_blank]:after:hover{content:url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='pink'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\")}.hy-footer-info__ingress a[target=_blank]:hover:after{content:url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(14,104,139)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\")}.hy-footer-info__links{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;max-height:auto;overflow:hidden;width:100%}@media (min-width: 30rem){.hy-footer-info__links{-ms-flex-line-pack:justify;align-content:space-between;max-height:555px;width:100%}}@media (min-width: 60rem){.hy-footer-info__links{max-height:
|
|
14
|
+
const hyFooterInfoCss = ":root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}:host{display:block}.hy-footer-info{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;max-height:auto;padding:0 16px 40px 16px;place-content:center space-between}@media (min-width: 30rem){.hy-footer-info{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin:0 auto;max-width:120.0625rem;padding:0 24px 32px 24px}}@media (min-width: 60rem){.hy-footer-info{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:0 32px 36px 32px}}@media (min-width: 75.0625rem){.hy-footer-info{padding:0 32px 40px 32px}}.hy-footer-info__content{margin-bottom:24px;width:100%}@media (min-width: 30rem){.hy-footer-info__content{margin-bottom:32px;width:100%}}@media (min-width: 60rem){.hy-footer-info__content{width:31.11%}}.hy-footer-info__content .hy-heading{padding-top:0 !important}.hy-footer-info__ingress{font-size:0.9375rem;line-height:20px;font-weight:400;letter-spacing:-0.09px;color:var(--grayscale-black);font-family:var(--main-font-family);padding-bottom:24px}@media (min-width: 60rem){.hy-footer-info__ingress{font-size:1rem;line-height:22px;letter-spacing:-0.1px;padding-bottom:16px}}@media (min-width: 1601px){.hy-footer-info__ingress{font-size:1.0625rem;line-height:26px}}@media (min-width: 75.0625rem){.hy-footer-info__ingress{padding-bottom:24px}}.hy-footer-info__ingress a{font-size:0.875rem;line-height:20px;color:var(--link-blue);font-family:var(--main-font-family);font-weight:600;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}@media (min-width: 30rem){.hy-footer-info__ingress a{font-size:1rem;line-height:24px;letter-spacing:-0.1px}}@media (min-width: 1601px){.hy-footer-info__ingress a{font-size:1.0625rem;line-height:26px}}.hy-footer-info__ingress a:hover{color:var(--brand-main)}.hy-footer-info__ingress a[target=_blank]:after{display:block;content:url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(4,121,165)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");margin-left:3px;-webkit-transform:rotate(315deg);transform:rotate(315deg)}.hy-footer-info__ingress a[target=_blank]:after:hover{content:url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='pink'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\")}.hy-footer-info__ingress a[target=_blank]:hover:after{content:url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(14,104,139)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\")}.hy-footer-info__links{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;max-height:auto;overflow:hidden;width:100%}@media (min-width: 30rem){.hy-footer-info__links{-ms-flex-line-pack:justify;align-content:space-between;max-height:555px;width:100%}}@media (min-width: 60rem){.hy-footer-info__links{max-height:555px;width:65.56%}}@media (min-width: 87.5rem){.hy-footer-info__links{max-height:530px}}@media (min-width: 30rem){.hy-footer-info__links.is-group:not(.luomus){-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;max-height:none}}.hy-footer-info .hy-accordion__content--inner-wrapper{width:100%}.hy-footer-info.luomus{background-color:var(--grayscale-black);color:var(--grayscale-white);padding-top:40px}.hy-footer-info.luomus .hy-footer-info__logo{font-size:1.125rem;line-height:16px;font-family:var(--main-font-family);font-weight:bold;letter-spacing:-0.9px}.hy-footer-info.luomus .hy-footer-info__logo .hy-site-logo__label{max-width:100%}.hy-footer-info.luomus .hy-footer-info__branding{padding:22px 0 62px}.hy-footer-info.luomus .hy-footer-info__branding a img{height:32px;width:148px}.hy-footer-info.luomus .luomus-footer-content{color:var(--grayscale-white);margin:8px 0}.hy-footer-info.luomus .luomus-footer-content__link{font-size:1.125rem;line-height:24px;font-weight:700;color:var(--grayscale-white);font-family:var(--main-font-family);font-style:normal;letter-spacing:-0.36px;text-decoration:none}.hy-footer-info.luomus .luomus-footer-content__description{font-size:1rem;line-height:22px;font-weight:400;color:var(--grayscale-white);font-family:var(--main-font-family);font-style:normal;letter-spacing:-0.1px;padding-bottom:32px}";
|
|
15
15
|
|
|
16
16
|
const HyFooterInfo$1 = /*@__PURE__*/ proxyCustomElement(class HyFooterInfo extends HTMLElement {
|
|
17
17
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-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EAAE,IAAI,CAAC,aAAa;OAC3B,IAEA,KAAK;MACJ,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI;QACb,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC;QACrD,QACE,8CACmB,IAAI,CAAC,aAAa,EACnC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,GAAG,EAAE,IAAI,CAAC,GAAG,iBACA,aAAa,eACf,IAAI,CAAC,QAAQ,EACxB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,GACF,EACvB;OACH,CAAC,CACA,CACP,CACI,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["HyFooterInfo"],"sources":["./src/components/footer/hy-footer-info/hy-footer-info.scss?tag=hy-footer-info","./src/components/footer/hy-footer-info/hy-footer-info.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hy-footer-info {\n display: flex;\n flex-direction: column;\n max-height: auto;\n padding: 0 16px 40px 16px;\n place-content: center space-between;\n\n @include breakpoint($narrow) {\n flex-direction: column;\n margin: 0 auto;\n max-width: $fullhd;\n padding: 0 24px 32px 24px;\n }\n\n @include breakpoint($wide) {\n flex-direction: row;\n padding: 0 32px 36px 32px;\n }\n\n @include breakpoint($extrawide) {\n padding: 0 32px 40px 32px;\n }\n\n &__content {\n margin-bottom: 24px;\n width: 100%;\n\n @include breakpoint($narrow) {\n margin-bottom: 32px;\n width: 100%;\n }\n\n @include breakpoint($wide) {\n width: 31.11%;\n }\n\n .hy-heading {\n padding-top: 0 !important;\n }\n }\n\n &__ingress {\n @include font-size(15px, 20px);\n @include font-weight($regular);\n letter-spacing: -0.09px;\n\n color: var(--grayscale-black);\n font-family: var(--main-font-family);\n padding-bottom: 24px;\n\n @include breakpoint($wide) {\n @include font-size(16px, 22px);\n letter-spacing: -0.1px;\n padding-bottom: 16px;\n }\n\n @include breakpoint($xlarge) {\n @include font-size(17px, 26px); // Paragraph Large size\n }\n\n @include breakpoint($extrawide) {\n padding-bottom: 24px;\n }\n\n a {\n @include font-size(14px, 20px); // Paragraph Small size\n color: var(--link-blue);\n font-family: var(--main-font-family);\n font-weight: 600;\n display: inline-flex;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n letter-spacing: -0.1px;\n }\n\n @include breakpoint($xlarge) {\n @include font-size(17px, 26px); // Paragraph Large size\n }\n\n &:hover {\n color: var(--brand-main);\n }\n }\n\n a[target=\"_blank\"]:after {\n display: block;\n content: url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(4,121,165)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");\n margin-left: 3px;\n transform: rotate(315deg);\n\n &:hover {\n content: url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='pink'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");\n }\n }\n\n a[target=\"_blank\"]:hover {\n &:after {\n content: url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(14,104,139)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");\n }\n }\n }\n\n &__links {\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n max-height: auto;\n overflow: hidden;\n width: 100%;\n\n @include breakpoint($narrow) {\n align-content: space-between;\n max-height: 555px;\n width: 100%;\n }\n @include breakpoint($wide) {\n max-height: 530px;\n width: 65.56%;\n }\n @include breakpoint($overwide) {\n max-height: 460px;\n }\n\n &.is-group:not(.luomus) {\n @include breakpoint($narrow) {\n flex-direction: row;\n max-height: none;\n }\n }\n }\n\n .hy-accordion__content--inner-wrapper {\n width: 100%;\n }\n}\n\n.hy-footer-info.luomus {\n background-color: var(--grayscale-black);\n color: var(--grayscale-white);\n padding-top: 40px;\n\n .hy-footer-info__logo {\n @include font-size(18px, 16px);\n font-family: var(--main-font-family);\n font-weight: bold;\n letter-spacing: -0.9px;\n\n .hy-site-logo__label {\n max-width: 100%;\n }\n }\n\n .hy-footer-info__branding {\n padding: 22px 0 62px;\n a {\n img {\n height: 32px;\n width: 148px;\n }\n }\n }\n\n .luomus-footer-content {\n color: var(--grayscale-white);\n margin: 8px 0;\n\n &__link {\n @include font-size(18px, 24px);\n @include font-weight($bold);\n\n color: var(--grayscale-white);\n font-family: var(--main-font-family);\n font-style: normal;\n letter-spacing: -0.36px;\n text-decoration: none;\n }\n\n &__description {\n @include font-size(16px, 22px);\n @include font-weight($regular);\n\n color: var(--grayscale-white);\n font-family: var(--main-font-family);\n font-style: normal;\n letter-spacing: -0.1px;\n padding-bottom: 32px;\n }\n }\n}\n","export interface FooterInfoLinks {\n label: string;\n url: string;\n isExternal: string;\n isActive?: boolean;\n mainlink?: boolean;\n items: Array<FooterInfoLinks>;\n}\n\nexport interface LuomusFooterContent {\n heading: string;\n url: string;\n content?: string;\n}\n\nimport {Component, ComponentInterface, Element, h, Host, Prop, State} from \"@stencil/core\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport {\n ColorVariant,\n CtaLinkButtonVariants,\n FooterLinkItemColor,\n FooterLinkVariants,\n FooterVariant,\n HeadingSectionVariants,\n HeadingVarians,\n} from \"../../../utils/utils\";\nimport {jsonParserWorker} from \"../../../global/globalScript\";\n\n@Component({\n tag: \"hy-footer-info\",\n styleUrl: \"hy-footer-info.scss\",\n shadow: false,\n})\nexport class HyFooterInfo implements ComponentInterface {\n @Element() el: HTMLElement;\n /**\n * Content area title.\n */\n @Prop() textTitle: string;\n /**\n * Content area text.\n */\n @Prop() textDescription: string;\n /**\n * Content area link button text.\n */\n @Prop() linkText: string;\n /**\n * Content area link button url.\n */\n @Prop() linkUrl: string;\n @Prop() linkIsExternal: boolean = false;\n @Prop() linkScLabel?: string;\n\n /**\n * Logo url\n */\n @Prop() logoUrl?: string;\n /**\n * Logo label\n */\n @Prop() logoLabel?: string;\n\n /**\n * Luomus group Logo url for footer\n */\n @Prop() groupLogoUrl?: string;\n\n @Prop() isGroup: boolean;\n @Prop() isLuomusGroup: boolean = false;\n @State() isMobile: boolean;\n\n private ro: ResizeObserver;\n private _dataFooterInfoLinks: FooterInfoLinks[];\n private _dataLuomusFooterContent: LuomusFooterContent[];\n /**\n * Data for links to be displayed.\n */\n @Prop() dataFooterInfoLinks: FooterInfoLinks[] | string;\n\n @Prop() luomusFooterContent: LuomusFooterContent[] | string;\n\n async componentWillLoad() {\n this._dataFooterInfoLinks = await jsonParserWorker(this.dataFooterInfoLinks);\n this._dataLuomusFooterContent = await jsonParserWorker(this.luomusFooterContent);\n }\n\n componentDidLoad() {\n this.ro = new ResizeObserver((entries) => {\n for (const entry of entries) {\n this.checkForMobile(entry.contentRect.width);\n }\n });\n this.ro.observe(document.body);\n }\n\n disconnectedCallback() {\n this.ro.disconnect();\n }\n\n checkForMobile(size: number) {\n this.isMobile = size <= 479 ? true : false;\n }\n\n render() {\n const links = this._dataFooterInfoLinks as Array<FooterInfoLinks>;\n const luomusFooterContentItems = this._dataLuomusFooterContent as Array<LuomusFooterContent>;\n\n const variant = this.isGroup ? FooterLinkVariants.group : FooterLinkVariants.campus;\n const section = this.isGroup ? HeadingSectionVariants.groupFooterInfo : HeadingSectionVariants.defaultFooterInfo;\n\n const footerLinkItemClass = this.isGroup ? \"group\" : \"campus\";\n\n const scLabel = this.linkScLabel && this.linkScLabel.length > 0 ? this.linkScLabel : this.linkText;\n const logoColor = ColorVariant.white;\n const linksColor = this.isLuomusGroup ? FooterLinkItemColor.white : FooterLinkItemColor.black;\n\n return (\n <Host\n class={{\n \"hy-footer-info\": true,\n luomus: this.isLuomusGroup,\n }}\n >\n <div\n class={{\n \"hy-footer-info__content\": true,\n \"is-group\": this.isGroup,\n }}\n >\n {!this.isLuomusGroup && (\n <hy-heading heading={HeadingVarians.h2} section={section}>\n {this.textTitle}\n </hy-heading>\n )}\n {this.isLuomusGroup && (\n <div class=\"hy-footer-info__logo\">\n <hy-site-logo\n type={FooterVariant.footer}\n isGroup={this.isGroup}\n color={logoColor}\n url={this.logoUrl}\n label={this.logoLabel}\n />\n </div>\n )}\n {this.isLuomusGroup && (\n <div class={\"hy-footer-info__branding\"}>\n <a href={this.groupLogoUrl}>\n <img src={this.groupLogoUrl} alt={\"Luomus logo\"} />\n </a>\n </div>\n )}\n {!this.isLuomusGroup && (\n <div\n class={{\n \"hy-footer-info__ingress\": true,\n \"is-group\": this.isGroup,\n }}\n innerHTML={this.textDescription}\n ></div>\n )}\n {!this.isLuomusGroup && this.linkUrl && (\n <hy-cta-button\n link-content={this.linkText}\n sc-label={scLabel}\n is-external={this.linkIsExternal}\n url={this.linkUrl}\n variant={CtaLinkButtonVariants.onWhiteBkgd}\n />\n )}\n {this.isLuomusGroup &&\n luomusFooterContentItems &&\n luomusFooterContentItems.map((item) => {\n return (\n <div class=\"luomus-footer-content\">\n <a href={item.url} class=\"luomus-footer-content__link\">\n {item.heading}\n </a>\n {item.content && <div class=\"luomus-footer-content__description\" innerHTML={item.content}></div>}\n </div>\n );\n })}\n </div>\n {this.isMobile && this.isGroup === false ? (\n <div\n class={{\n \"hy-footer-info__links\": true,\n \"is-group\": this.isGroup,\n luomus: this.isLuomusGroup,\n }}\n >\n <hy-accordion-container accordionid={\"test\"}>\n {links &&\n links.map((link) => {\n return (\n <hy-accordion-item accordiontitle={link.label}>\n <hy-footer-link-item\n class={footerLinkItemClass}\n variant={variant}\n color={linksColor}\n label={link.label}\n url={link.url}\n main-link={link.mainlink}\n items={link.items}\n isMobile={this.isMobile}\n ></hy-footer-link-item>\n </hy-accordion-item>\n );\n })}\n </hy-accordion-container>\n </div>\n ) : (\n <div\n class={{\n \"hy-footer-info__links\": true,\n \"is-group\": this.isGroup,\n luomus: this.isLuomusGroup,\n }}\n >\n {links &&\n links.map((link) => {\n const external_link = link.isExternal === \"external\";\n return (\n <hy-footer-link-item\n is-luomus-group={this.isLuomusGroup}\n class={footerLinkItemClass}\n variant={variant}\n color={linksColor}\n label={link.label}\n url={link.url}\n is-external={external_link}\n main-link={link.mainlink}\n items={link.items}\n isMobile={this.isMobile}\n ></hy-footer-link-item>\n );\n })}\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"hy-footer-info.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,6nMAA6nM;;MCiCxoMA,cAAY;;;;;;;;0BAkBW,KAAK;;;;;;yBAkBN,KAAK;;;;;EAatC,MAAM,iBAAiB;IACrB,IAAI,CAAC,oBAAoB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC7E,IAAI,CAAC,wBAAwB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;GAClF;EAED,gBAAgB;IACd,IAAI,CAAC,EAAE,GAAG,IAAI,cAAc,CAAC,CAAC,OAAO;MACnC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;QAC3B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;OAC9C;KACF,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,CAAC,OAAO,CAA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fo"],"sources":["./src/components/footer/hy-footer-info/hy-footer-info.scss?tag=hy-footer-info","./src/components/footer/hy-footer-info/hy-footer-info.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hy-footer-info {\n display: flex;\n flex-direction: column;\n max-height: auto;\n padding: 0 16px 40px 16px;\n place-content: center space-between;\n\n @include breakpoint($narrow) {\n flex-direction: column;\n margin: 0 auto;\n max-width: $fullhd;\n padding: 0 24px 32px 24px;\n }\n\n @include breakpoint($wide) {\n flex-direction: row;\n padding: 0 32px 36px 32px;\n }\n\n @include breakpoint($extrawide) {\n padding: 0 32px 40px 32px;\n }\n\n &__content {\n margin-bottom: 24px;\n width: 100%;\n\n @include breakpoint($narrow) {\n margin-bottom: 32px;\n width: 100%;\n }\n\n @include breakpoint($wide) {\n width: 31.11%;\n }\n\n .hy-heading {\n padding-top: 0 !important;\n }\n }\n\n &__ingress {\n @include font-size(15px, 20px);\n @include font-weight($regular);\n letter-spacing: -0.09px;\n\n color: var(--grayscale-black);\n font-family: var(--main-font-family);\n padding-bottom: 24px;\n\n @include breakpoint($wide) {\n @include font-size(16px, 22px);\n letter-spacing: -0.1px;\n padding-bottom: 16px;\n }\n\n @include breakpoint($xlarge) {\n @include font-size(17px, 26px); // Paragraph Large size\n }\n\n @include breakpoint($extrawide) {\n padding-bottom: 24px;\n }\n\n a {\n @include font-size(14px, 20px); // Paragraph Small size\n color: var(--link-blue);\n font-family: var(--main-font-family);\n font-weight: 600;\n display: inline-flex;\n\n @include breakpoint($narrow) {\n @include font-size(16px, 24px);\n letter-spacing: -0.1px;\n }\n\n @include breakpoint($xlarge) {\n @include font-size(17px, 26px); // Paragraph Large size\n }\n\n &:hover {\n color: var(--brand-main);\n }\n }\n\n a[target=\"_blank\"]:after {\n display: block;\n content: url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(4,121,165)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");\n margin-left: 3px;\n transform: rotate(315deg);\n\n &:hover {\n content: url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='pink'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");\n }\n }\n\n a[target=\"_blank\"]:hover {\n &:after {\n content: url(\"data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 30 29' fill='rgb(14,104,139)'> <polygon points='29.207 13.783 14.756 .717 14.055 0 11.402 3.118 10.732 3.835 19.665 11.974 0 11.974 0 17.026 19.756 17.026 11.494 24.447 10.823 25.071 11.402 25.882 13.476 28.189 14.055 29 30 14.594' /> </svg>\");\n }\n }\n }\n\n &__links {\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n max-height: auto;\n overflow: hidden;\n width: 100%;\n\n @include breakpoint($narrow) {\n align-content: space-between;\n max-height: 555px;\n width: 100%;\n }\n @include breakpoint($wide) {\n max-height: 555px;\n width: 65.56%;\n }\n @include breakpoint($overwide) {\n max-height: 530px;\n }\n\n &.is-group:not(.luomus) {\n @include breakpoint($narrow) {\n flex-direction: row;\n max-height: none;\n }\n }\n }\n\n .hy-accordion__content--inner-wrapper {\n width: 100%;\n }\n}\n\n.hy-footer-info.luomus {\n background-color: var(--grayscale-black);\n color: var(--grayscale-white);\n padding-top: 40px;\n\n .hy-footer-info__logo {\n @include font-size(18px, 16px);\n font-family: var(--main-font-family);\n font-weight: bold;\n letter-spacing: -0.9px;\n\n .hy-site-logo__label {\n max-width: 100%;\n }\n }\n\n .hy-footer-info__branding {\n padding: 22px 0 62px;\n a {\n img {\n height: 32px;\n width: 148px;\n }\n }\n }\n\n .luomus-footer-content {\n color: var(--grayscale-white);\n margin: 8px 0;\n\n &__link {\n @include font-size(18px, 24px);\n @include font-weight($bold);\n\n color: var(--grayscale-white);\n font-family: var(--main-font-family);\n font-style: normal;\n letter-spacing: -0.36px;\n text-decoration: none;\n }\n\n &__description {\n @include font-size(16px, 22px);\n @include font-weight($regular);\n\n color: var(--grayscale-white);\n font-family: var(--main-font-family);\n font-style: normal;\n letter-spacing: -0.1px;\n padding-bottom: 32px;\n }\n }\n}\n","export interface FooterInfoLinks {\n label: string;\n url: string;\n isExternal: string;\n isActive?: boolean;\n mainlink?: boolean;\n items: Array<FooterInfoLinks>;\n}\n\nexport interface LuomusFooterContent {\n heading: string;\n url: string;\n content?: string;\n}\n\nimport {Component, ComponentInterface, Element, h, Host, Prop, State} from \"@stencil/core\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport {\n ColorVariant,\n CtaLinkButtonVariants,\n FooterLinkItemColor,\n FooterLinkVariants,\n FooterVariant,\n HeadingSectionVariants,\n HeadingVarians,\n} from \"../../../utils/utils\";\nimport {jsonParserWorker} from \"../../../global/globalScript\";\n\n@Component({\n tag: \"hy-footer-info\",\n styleUrl: \"hy-footer-info.scss\",\n shadow: false,\n})\nexport class HyFooterInfo implements ComponentInterface {\n @Element() el: HTMLElement;\n /**\n * Content area title.\n */\n @Prop() textTitle: string;\n /**\n * Content area text.\n */\n @Prop() textDescription: string;\n /**\n * Content area link button text.\n */\n @Prop() linkText: string;\n /**\n * Content area link button url.\n */\n @Prop() linkUrl: string;\n @Prop() linkIsExternal: boolean = false;\n @Prop() linkScLabel?: string;\n\n /**\n * Logo url\n */\n @Prop() logoUrl?: string;\n /**\n * Logo label\n */\n @Prop() logoLabel?: string;\n\n /**\n * Luomus group Logo url for footer\n */\n @Prop() groupLogoUrl?: string;\n\n @Prop() isGroup: boolean;\n @Prop() isLuomusGroup: boolean = false;\n @State() isMobile: boolean;\n\n private ro: ResizeObserver;\n private _dataFooterInfoLinks: FooterInfoLinks[];\n private _dataLuomusFooterContent: LuomusFooterContent[];\n /**\n * Data for links to be displayed.\n */\n @Prop() dataFooterInfoLinks: FooterInfoLinks[] | string;\n\n @Prop() luomusFooterContent: LuomusFooterContent[] | string;\n\n async componentWillLoad() {\n this._dataFooterInfoLinks = await jsonParserWorker(this.dataFooterInfoLinks);\n this._dataLuomusFooterContent = await jsonParserWorker(this.luomusFooterContent);\n }\n\n componentDidLoad() {\n this.ro = new ResizeObserver((entries) => {\n for (const entry of entries) {\n this.checkForMobile(entry.contentRect.width);\n }\n });\n this.ro.observe(document.body);\n }\n\n disconnectedCallback() {\n this.ro.disconnect();\n }\n\n checkForMobile(size: number) {\n this.isMobile = size <= 479 ? true : false;\n }\n\n render() {\n const links = this._dataFooterInfoLinks as Array<FooterInfoLinks>;\n const luomusFooterContentItems = this._dataLuomusFooterContent as Array<LuomusFooterContent>;\n\n const variant = this.isGroup ? FooterLinkVariants.group : FooterLinkVariants.campus;\n const section = this.isGroup ? HeadingSectionVariants.groupFooterInfo : HeadingSectionVariants.defaultFooterInfo;\n\n const footerLinkItemClass = this.isGroup ? \"group\" : \"campus\";\n\n const scLabel = this.linkScLabel && this.linkScLabel.length > 0 ? this.linkScLabel : this.linkText;\n const logoColor = ColorVariant.white;\n const linksColor = this.isLuomusGroup ? FooterLinkItemColor.white : FooterLinkItemColor.black;\n\n return (\n <Host\n class={{\n \"hy-footer-info\": true,\n luomus: this.isLuomusGroup,\n }}\n >\n <div\n class={{\n \"hy-footer-info__content\": true,\n \"is-group\": this.isGroup,\n }}\n >\n {!this.isLuomusGroup && (\n <hy-heading heading={HeadingVarians.h2} section={section}>\n {this.textTitle}\n </hy-heading>\n )}\n {this.isLuomusGroup && (\n <div class=\"hy-footer-info__logo\">\n <hy-site-logo\n type={FooterVariant.footer}\n isGroup={this.isGroup}\n color={logoColor}\n url={this.logoUrl}\n label={this.logoLabel}\n />\n </div>\n )}\n {this.isLuomusGroup && (\n <div class={\"hy-footer-info__branding\"}>\n <a href={this.groupLogoUrl}>\n <img src={this.groupLogoUrl} alt={\"Luomus logo\"} />\n </a>\n </div>\n )}\n {!this.isLuomusGroup && (\n <div\n class={{\n \"hy-footer-info__ingress\": true,\n \"is-group\": this.isGroup,\n }}\n innerHTML={this.textDescription}\n ></div>\n )}\n {!this.isLuomusGroup && this.linkUrl && (\n <hy-cta-button\n link-content={this.linkText}\n sc-label={scLabel}\n is-external={this.linkIsExternal}\n url={this.linkUrl}\n variant={CtaLinkButtonVariants.onWhiteBkgd}\n />\n )}\n {this.isLuomusGroup &&\n luomusFooterContentItems &&\n luomusFooterContentItems.map((item) => {\n return (\n <div class=\"luomus-footer-content\">\n <a href={item.url} class=\"luomus-footer-content__link\">\n {item.heading}\n </a>\n {item.content && <div class=\"luomus-footer-content__description\" innerHTML={item.content}></div>}\n </div>\n );\n })}\n </div>\n {this.isMobile && this.isGroup === false ? (\n <div\n class={{\n \"hy-footer-info__links\": true,\n \"is-group\": this.isGroup,\n luomus: this.isLuomusGroup,\n }}\n >\n <hy-accordion-container accordionid={\"test\"}>\n {links &&\n links.map((link) => {\n return (\n <hy-accordion-item accordiontitle={link.label}>\n <hy-footer-link-item\n class={footerLinkItemClass}\n variant={variant}\n color={linksColor}\n label={link.label}\n url={link.url}\n main-link={link.mainlink}\n items={link.items}\n isMobile={this.isMobile}\n ></hy-footer-link-item>\n </hy-accordion-item>\n );\n })}\n </hy-accordion-container>\n </div>\n ) : (\n <div\n class={{\n \"hy-footer-info__links\": true,\n \"is-group\": this.isGroup,\n luomus: this.isLuomusGroup,\n }}\n >\n {links &&\n links.map((link) => {\n const external_link = link.isExternal === \"external\";\n return (\n <hy-footer-link-item\n is-luomus-group={this.isLuomusGroup}\n class={footerLinkItemClass}\n variant={variant}\n color={linksColor}\n label={link.label}\n url={link.url}\n is-external={external_link}\n main-link={link.mainlink}\n items={link.items}\n isMobile={this.isMobile}\n ></hy-footer-link-item>\n );\n })}\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -3,7 +3,7 @@ import { F as FooterLinkItemColor, g as FooterLinkVariants, H as HeadingVarians
|
|
|
3
3
|
import { d as defineCustomElement$2 } from './heading.js';
|
|
4
4
|
import { d as defineCustomElement$1 } from './icon.js';
|
|
5
5
|
|
|
6
|
-
const hyFooterLinkItemCss = ":root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}:host{display:block}hy-footer-link-item:not([main-link]){width:100%}@media (min-width: 48rem){hy-footer-link-item:not([main-link]){width:50%}}hy-footer-link-item[main-link]{-ms-hyphens:auto;hyphens:auto;min-width:200px;width:100%}@media (min-width: 30rem){hy-footer-link-item[main-link]{width:50%}}hy-footer-link-item.group[main-link]:not([is-luomus-group]){-ms-flex-preferred-size:100%;flex-basis:100%;margin-top:1rem}@media (min-width: 30rem){hy-footer-link-item.group[main-link]:not([is-luomus-group]){-ms-flex-preferred-size:50%;flex-basis:50%;margin:0}}.hy-footer-link-item--container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}@media (min-width: 48rem){.hy-footer-link-item--container{margin-bottom:1rem}}.hy-footer-link-item--container .hy-footer-link-item:last-child{margin-bottom:16px}.hy-footer-link-item{display:-webkit-box;display:-ms-flexbox;display:flex;font-family:var(--main-font-family);margin-left:0;margin-right:0;position:relative;text-decoration:none}@media (min-width: 30rem){.hy-footer-link-item{margin-left:0;margin-right:24px}}@media (min-width: 60rem){.hy-footer-link-item{margin-left:32px;margin-right:0}}@media (min-width: 1601px){.hy-footer-link-item{margin-left:48px}}.hy-footer-link-item__main{border:0;padding:0;margin-right:-32px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.hy-footer-link-item__main .hy-heading__container>h3.hy-heading{font-size:1rem;line-height:16px;letter-spacing:-0.45px;padding:1.5rem 0 1px 0 !important;text-transform:uppercase}@media (min-width: 30rem){.hy-footer-link-item__main .hy-heading__container>h3.hy-heading{letter-spacing:-0.44px}}.hy-footer-link-item__main .hy-heading__container>h3.hy-heading .hy-footer-link-item__link{color:var(--grayscale-white)
|
|
6
|
+
const hyFooterLinkItemCss = ":root{--brand-main:#0e688b;--brand-main-soft:#b1e7ff;--brand-main-bright:#48c5f8;--brand-main-light:#107eab;--brand-main-active:#005379;--brand-main-dark:#003146;--brand-main-nearly-black:#000222;--link-blue:#0479a4;--link-disabled:#767676;--grayscale-white:#fff;--grayscale-slightly-gray:#fefefe;--grayscale-light:#f8f8f8;--grayscale-medium:#d2d2d2;--grayscale-background-box:#f5f5f5;--grayscale-tabs-border:#e6e6e6;--grayscale-background-arrow:#dfdfdf;--grayscale-medium-dark:#979797;--grayscale-dark:#555555;--grayscale-dark-text:#222222;--grayscale-black:#000000;--additional-red-light:#e5053a;--additional-red-dark:#a31621;--additional-purple-light:#420039;--additional-yellow-light:#f9a21a;--additional-yellow:#c47f1b;--additional-skyblue:#48c5f8;--additional-orange:#d14600;--additional-green-light:#96ba3c;--additional-green-dark:#006400;--hover-gray:#eaeaea}*{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--gutter-mobile:16px;--gutter-narrow:24px;--gutter-medium:24px;--gutter-wide:24px;--gutter-extrawide:32px}:root{--breakpoint-extrawide:75.0625rem;--breakpoint-max-width:75.0625rem;--breakpoint-medium:48rem;--breakpoint-narrow:30rem;--breakpoint-wide:60rem}:host{display:block}hy-footer-link-item:not([main-link]){width:100%}@media (min-width: 48rem){hy-footer-link-item:not([main-link]){width:50%}}hy-footer-link-item[main-link]{-ms-hyphens:auto;hyphens:auto;min-width:200px;width:100%}@media (min-width: 30rem){hy-footer-link-item[main-link]{width:50%}}hy-footer-link-item.group[main-link]:not([is-luomus-group]){-ms-flex-preferred-size:100%;flex-basis:100%;margin-top:1rem}@media (min-width: 30rem){hy-footer-link-item.group[main-link]:not([is-luomus-group]){-ms-flex-preferred-size:50%;flex-basis:50%;margin:0}}.hy-footer-link-item--container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}@media (min-width: 48rem){.hy-footer-link-item--container{margin-bottom:1rem}}.hy-footer-link-item--container .hy-footer-link-item:last-child{margin-bottom:16px}.hy-footer-link-item{display:-webkit-box;display:-ms-flexbox;display:flex;font-family:var(--main-font-family);margin-left:0;margin-right:0;position:relative;text-decoration:none}@media (min-width: 30rem){.hy-footer-link-item{margin-left:0;margin-right:24px}}@media (min-width: 60rem){.hy-footer-link-item{margin-left:32px;margin-right:0}}@media (min-width: 1601px){.hy-footer-link-item{margin-left:48px}}.hy-footer-link-item__main{border:0;padding:0;margin-right:-32px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.hy-footer-link-item__main .hy-heading__container>h3.hy-heading{font-size:1rem;line-height:16px;letter-spacing:-0.45px;padding:1.5rem 0 1px 0 !important;text-transform:uppercase}@media (min-width: 30rem){.hy-footer-link-item__main .hy-heading__container>h3.hy-heading{letter-spacing:-0.44px}}.hy-footer-link-item__main .hy-heading__container>h3.hy-heading .hy-footer-link-item__link[data-color=white]{color:var(--grayscale-white)}.hy-footer-link-item__main .hy-heading__container>h3.hy-heading .hy-footer-link-item__link[data-color=black]{color:var(--grayscale-black)}.hy-footer-link-item__main .hy-heading__container>h3.hy-heading .hy-footer-link-item__link{font-family:var(--main-font-family);text-decoration:none;margin-bottom:8px}@media (min-width: 48rem){.hy-footer-link-item__main .hy-heading__container>h3.hy-heading .hy-footer-link-item__link{margin-bottom:12px}}.hy-footer-link-item__color-black{font-size:0.875rem;line-height:18px;font-weight:400;border-bottom:1px solid var(--grayscale-black);color:var(--grayscale-black);letter-spacing:-0.5px;padding:16px 20px 14px 0}.hy-footer-link-item__color-black .hy-footer-link-item__icon svg{fill:var(--brand-main-nearly-black);height:12px;margin-right:2px;width:12px}.hy-footer-link-item__color-black .hy-heading__container>h3.hy-headinga.hy-footer-link-item__link:hover{color:var(--brand-main) !important;text-decoration:underline}.hy-footer-link-item__color-black .hy-heading__container>h3.hy-headinga.hy-footer-link-item__link:hover svg{fill:var(--brand-main)}.hy-footer-link-item__color-white{font-size:0.9375rem;line-height:18px;font-weight:600;border-bottom:1px solid var(--grayscale-white);color:var(--grayscale-white);letter-spacing:-0.5px;padding:15px 20px 15px 0}.hy-footer-link-item__color-white:hover,.hy-footer-link-item__color-white:focus-within{text-decoration:underline}.hy-footer-link-item__color-white .hy-footer-link-item__icon svg{fill:var(--grayscale-white)}.hy-footer-link-item__color-white .hy-heading__container>h3.hy-heading .hy-footer-link-item__link:hover{color:var(--grayscale-medium) !important}.hy-footer-link-item__color-white .hy-heading__container>h3.hy-heading .hy-footer-link-item__link:hover svg{fill:var(--grayscale-medium)}.hy-footer-link-item__icon{position:absolute;right:0;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}";
|
|
7
7
|
|
|
8
8
|
const HyFooterLinkItem = /*@__PURE__*/ proxyCustomElement(class HyFooterLinkItem extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -49,7 +49,7 @@ const HyFooterLinkItem = /*@__PURE__*/ proxyCustomElement(class HyFooterLinkItem
|
|
|
49
49
|
})));
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
return (h("div", { class: containerClassAttributes }, h("hy-heading", { class: headingClassAttributes, heading: HeadingVarians.h3 }, this.url.length > 0 && (h("a", { class: "hy-footer-link-item__link", href: this.url, style: { color: this.color } }, this.label)), this.url.length == 0 && h("div", { class: "hy-footer-link-item__link" }, this.label)), this.items.map((item) => {
|
|
52
|
+
return (h("div", { class: containerClassAttributes }, h("hy-heading", { class: headingClassAttributes, heading: HeadingVarians.h3 }, this.url.length > 0 && (h("a", { class: "hy-footer-link-item__link", href: this.url, style: { color: this.color } }, this.label)), this.url.length == 0 && (h("div", { "data-color": this.color, class: "hy-footer-link-item__link" }, this.label))), this.items.map((item) => {
|
|
53
53
|
const target = item.isExternal === "external" ? "_blank" : "_self";
|
|
54
54
|
return (h("a", { class: linkClassAttributes, href: item.url, target: target, style: { color: this.color } }, item.label, h("hy-icon", { class: "hy-footer-link-item__icon", icon: "hy-icon-arrow-right", size: 16 })));
|
|
55
55
|
})));
|