@ebrains/react 0.6.0-alpha.0 → 0.8.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/color-primary-palette_6.entry.esm.js +106 -106
  2. package/correct-use-of-colors.entry.esm.js +33 -33
  3. package/eds-accordion_17.entry.esm.js +196 -0
  4. package/eds-alert.entry.esm.js +14 -6
  5. package/eds-app-root.entry.esm.js +53 -0
  6. package/eds-breadcrumb.entry.esm.js +8 -16
  7. package/eds-card-desc_3.entry.esm.js +125 -0
  8. package/eds-card-generic.entry.esm.js +114 -0
  9. package/eds-card-project.entry.esm.js +10 -10
  10. package/eds-card-section.entry.esm.js +56 -0
  11. package/eds-card-tags.entry.esm.js +1 -1
  12. package/eds-card-tool.entry.esm.js +4 -4
  13. package/eds-card-wrapper.entry.esm.js +4 -4
  14. package/eds-code-block.entry.esm.js +7 -7
  15. package/eds-components-section.entry.esm.js +27 -24
  16. package/eds-cookies-preference.entry.esm.js +2 -2
  17. package/eds-docs-palettes.entry.esm.js +1 -1
  18. package/eds-docs-tokens.entry.esm.js +1 -1
  19. package/eds-feedback.entry.esm.js +82 -0
  20. package/eds-form.entry.esm.js +339 -276
  21. package/eds-frame.entry.esm.js +34 -33
  22. package/eds-icon-arrow-diagonal.entry.esm.js +3 -3
  23. package/eds-icon-arrow-right.entry.esm.js +1 -1
  24. package/eds-icon-bluesky.entry.esm.js +1 -1
  25. package/eds-icon-chevron-down.entry.esm.js +1 -1
  26. package/eds-icon-chevron-left.entry.esm.js +1 -1
  27. package/eds-icon-chevron-right.entry.esm.js +1 -1
  28. package/eds-icon-chevron-up.entry.esm.js +1 -1
  29. package/eds-icon-close.entry.esm.js +1 -1
  30. package/eds-icon-copy.entry.esm.js +1 -1
  31. package/eds-icon-eu.entry.esm.js +1 -1
  32. package/eds-icon-facebook.entry.esm.js +1 -1
  33. package/eds-icon-gitlab.entry.esm.js +1 -1
  34. package/eds-icon-linkedin.entry.esm.js +1 -1
  35. package/eds-icon-loader.entry.esm.js +1 -1
  36. package/eds-icon-mastodon.entry.esm.js +1 -1
  37. package/eds-icon-menu.entry.esm.js +1 -1
  38. package/eds-icon-more.entry.esm.js +1 -1
  39. package/eds-icon-search.entry.esm.js +1 -1
  40. package/eds-icon-star.entry.esm.js +21 -0
  41. package/eds-icon-success.entry.esm.js +1 -1
  42. package/eds-icon-thumbs-down.entry.esm.js +21 -0
  43. package/eds-icon-thumbs-up.entry.esm.js +21 -0
  44. package/eds-icon-twitter.entry.esm.js +1 -1
  45. package/eds-icon-user.entry.esm.js +1 -1
  46. package/eds-icon-youtube.entry.esm.js +1 -1
  47. package/eds-input_7.entry.esm.js +77 -37
  48. package/{keycloak-d502ec16.esm.js → eds-login_2.entry.esm.js} +172 -1
  49. package/eds-logo-variations.entry.esm.js +1 -1
  50. package/eds-modal.entry.esm.js +22 -9
  51. package/eds-pagination_2.entry.esm.js +49 -28
  52. package/eds-progress-bar.entry.esm.js +2 -2
  53. package/eds-rating.entry.esm.js +37 -37
  54. package/eds-section-core_2.entry.esm.js +6 -6
  55. package/eds-spinner.entry.esm.js +67 -0
  56. package/eds-svg-repository.entry.esm.js +18 -7
  57. package/eds-switch.entry.esm.js +5 -5
  58. package/eds-tabs.entry.esm.js +14 -26
  59. package/eds-timeline.entry.esm.js +9 -23
  60. package/eds-toast-manager.entry.esm.js +62 -0
  61. package/eds-toast.entry.esm.js +92 -0
  62. package/eds-tooltip.entry.esm.js +3 -3
  63. package/eds-trl.entry.esm.js +3 -3
  64. package/incorrect-use-of-colors.entry.esm.js +7 -7
  65. package/index.esm.js +1 -1
  66. package/index.esm2.js +47 -55
  67. package/logo-space.entry.esm.js +4 -4
  68. package/logo-variations-horizontal_2.entry.esm.js +26 -26
  69. package/logo-wrong-usage.entry.esm.js +37 -37
  70. package/package.json +1 -1
  71. package/sharedUtils-a550989c.esm.js +17 -0
  72. package/src/components.d.ts +4 -3
  73. package/star-0da9b5e9.esm.js +5 -0
  74. package/thumbs-down-a18fd049.esm.js +5 -0
  75. package/thumbs-up-c19a71bc.esm.js +6 -0
  76. package/token-list_3.entry.esm.js +5 -5
  77. package/token-ratios.entry.esm.js +3 -3
  78. package/token-spacing.entry.esm.js +26 -26
  79. package/token-typography.entry.esm.js +2 -2
  80. package/README.md +0 -7
  81. package/eds-accordion_13.entry.esm.js +0 -1064
  82. package/eds-block-break.entry.esm.js +0 -22
  83. package/eds-dropdown_2.entry.esm.js +0 -235
  84. package/eds-footer.entry.esm.js +0 -102
  85. package/eds-fullscreen-menu.entry.esm.js +0 -143
  86. package/eds-header.entry.esm.js +0 -130
  87. package/eds-link.entry.esm.js +0 -204
  88. package/eds-login.entry.esm.js +0 -97
  89. package/eds-logo.entry.esm.js +0 -87
  90. package/eds-navigator.entry.esm.js +0 -72
  91. package/eds-social-networks.entry.esm.js +0 -74
  92. package/eds-steps.entry.esm.js +0 -98
  93. package/eds-tab.entry.esm.js +0 -41
  94. package/eds-tabs-content.entry.esm.js +0 -145
  95. package/eds-user.entry.esm.js +0 -118
  96. package/eds-vertical-stepper.entry.esm.js +0 -81
@@ -1,22 +0,0 @@
1
- import { r as registerInstance, h } from './index.esm2.js';
2
- import 'react';
3
- import 'react/jsx-runtime';
4
- import 'react-dom';
5
-
6
- const edsBlockBreakCss = ".border-soft{border-color:rgba(0, 0, 0, .15)}.border-softer{border-color:rgba(0, 0, 0, .1)}.border-softest{border-color:rgba(0, 0, 0, .05)}.my-16{margin-top:1rem;margin-bottom:1rem}.my-20{margin-top:1.25rem;margin-bottom:1.25rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.w-full{width:100%}.border-t-2{border-top-width:2px}";
7
- const EdsBlockBreakStyle0 = edsBlockBreakCss;
8
- const EdsBlockBreak = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.extraClass = '';
12
- }
13
- render() {
14
- return h("hr", {
15
- key: '8cb39dda5d7f909b459390fe7e3f86dfd147ba98',
16
- class: `border-softer my-20 inline-block w-full border-t-2 ${this.extraClass}`
17
- });
18
- }
19
- };
20
- EdsBlockBreak.style = EdsBlockBreakStyle0;
21
-
22
- export { EdsBlockBreak as eds_block_break };
@@ -1,235 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index.esm2.js';
2
- import { s as sendAnalytics } from './analytics-44b1416b.esm.js';
3
- import 'react';
4
- import 'react/jsx-runtime';
5
- import 'react-dom';
6
-
7
- const edsDropdownCss = ".z-focus{z-index:99}.relative{position:relative}.shadow-small{--tw-shadow:0px 1.5px 2px rgba(0, 0, 0, 0.1);--tw-shadow-colored:0px 1.5px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.bg-inverse{background-color:var(--white)}.border-softest{border:2px solid rgba(0, 0, 0, .05)}.z-10{z-index:10}.z-on-top{z-index:99999}.absolute{position:absolute}.top-full{top:100%}.mt-4{margin-top:0.25rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.gap-y-4{row-gap:0.25rem}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-8{padding:0.5rem}.left-0{left:0rem}.left-1\\/2{left:50%}.left-4{left:0.25rem}.left-\\[4px\\]{left:4px}.right-0{right:0rem}.right-4{right:0.25rem}.right-8{right:0.5rem}";
8
- const EdsDropdownStyle0 = edsDropdownCss;
9
- const EdsDropdown = class {
10
- constructor(hostRef) {
11
- registerInstance(this, hostRef);
12
- this.focusableItems = [];
13
- /**
14
- * Toggles the visibility of the dropdown and manages focus.
15
- */
16
- this.handleClick = () => {
17
- var _a;
18
- this.isOpen = !this.isOpen;
19
- if (this.isOpen) {
20
- this.focusIndex = 0;
21
- this.focusItem();
22
- } else {
23
- this.closeDropdown();
24
- }
25
- sendAnalytics({
26
- category: 'ui-component',
27
- parentContext: null,
28
- tag: this.host.tagName.toLowerCase(),
29
- name: ((_a = this.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
30
- action: this.isOpen ? 'expanded' : 'collapsed'
31
- });
32
- };
33
- this.icon = 'chevron-down';
34
- this.label = undefined;
35
- this.rounded = false;
36
- this.ariaLabel = 'Open dropdown';
37
- this.asNav = true;
38
- this.dropdownPos = 'left';
39
- this.dropdownOffset = true;
40
- this.intent = 'tertiary';
41
- this.isOpen = false;
42
- this.focusIndex = -1;
43
- }
44
- /**
45
- * Closes the dropdown when a click occurs outside of it.
46
- * @param {Event} e - The click event.
47
- */
48
- handleWindowClick(e) {
49
- if (!this.host.contains(e.target)) {
50
- this.closeDropdown();
51
- }
52
- }
53
- /**
54
- * Handles keyboard navigation and accessibility within the dropdown.
55
- * @param {KeyboardEvent} event - The keyboard event.
56
- */
57
- handleKeyDown(event) {
58
- if (this.isOpen) {
59
- const key = event.key;
60
- switch (key) {
61
- case 'Tab':
62
- this.closeDropdown();
63
- break;
64
- case 'ArrowUp':
65
- event.preventDefault();
66
- this.focusIndex = (this.focusIndex - 1 + this.focusableItems.length) % this.focusableItems.length;
67
- this.focusItem();
68
- break;
69
- case 'ArrowDown':
70
- event.preventDefault();
71
- this.focusIndex = (this.focusIndex + 1) % this.focusableItems.length;
72
- this.focusItem();
73
- break;
74
- }
75
- }
76
- }
77
- /**
78
- * Closes the dropdown and resets focus.
79
- */
80
- closeDropdown() {
81
- this.isOpen = false;
82
- this.focusIndex = -1;
83
- }
84
- /**
85
- * Sets focus on the currently selected item in the dropdown.
86
- */
87
- focusItem() {
88
- var _a;
89
- (_a = this.focusableItems[this.focusIndex]) === null || _a === void 0 ? void 0 : _a.focus();
90
- }
91
- /**
92
- * Lifecycle method that runs after the component has been added to the DOM.
93
- * Initializes focusable items within the dropdown.
94
- */
95
- componentDidLoad() {
96
- var _a;
97
- this.focusableItems = Array.from(((_a = this.dropdownContent) === null || _a === void 0 ? void 0 : _a.querySelectorAll('a, button')) || []);
98
- }
99
- /**
100
- * Renders the dropdown component and displays its content when open.
101
- * @returns {JSX.Element} The rendered dropdown component.
102
- */
103
- render() {
104
- return h("div", {
105
- key: '84f4cea78ea1c40c7897a356fe03ac83922fccb8',
106
- class: "z-focus relative",
107
- ref: el => this.dropdownContent = el
108
- }, h("eds-button", {
109
- key: '99dc51632dc82830054502a2d6d77d9fcefe9337',
110
- label: this.label,
111
- "aria-label": this.ariaLabel,
112
- icon: this.icon,
113
- intent: this.intent,
114
- onClick: this.handleClick,
115
- "aria-expanded": this.isOpen.toString(),
116
- "aria-haspopup": "menu"
117
- }), h("nav", {
118
- key: 'a63613a7ecf709fd1d22d77da4b2d286905fef3e',
119
- role: "menu",
120
- class: {
121
- 'shadow-small bg-inverse border-softest z-10 z-on-top absolute top-full mt-4 flex flex-col gap-y-4 border-2 p-8': true,
122
- 'left-4': this.dropdownPos === 'left' && this.dropdownOffset,
123
- 'left-0': this.dropdownPos === 'left' && !this.dropdownOffset,
124
- 'right-4': this.dropdownPos === 'right' && this.dropdownOffset,
125
- 'right-0': this.dropdownPos === 'right' && !this.dropdownOffset,
126
- 'rounded-lg': this.rounded
127
- },
128
- style: {
129
- display: this.isOpen ? 'block' : 'none'
130
- },
131
- "aria-label": "Dropdown",
132
- "aria-hidden": !this.isOpen
133
- }, h("slot", {
134
- key: 'dda70b865ed03dc7ad36a32934587bbcb0a16c1b'
135
- })));
136
- }
137
- get host() {
138
- return getElement(this);
139
- }
140
- };
141
- EdsDropdown.style = EdsDropdownStyle0;
142
- const EdsUserModal = class {
143
- constructor(hostRef) {
144
- registerInstance(this, hostRef);
145
- this.user = undefined;
146
- this.links = undefined;
147
- this.onLogout = undefined;
148
- this.parsedUser = {};
149
- this.parsedLinks = [];
150
- }
151
- parseUserProp(newValue) {
152
- this.parsedUser = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
153
- }
154
- parseLinksProp(newValue) {
155
- this.parsedLinks = typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
156
- }
157
- componentWillLoad() {
158
- this.parseUserProp(this.user);
159
- this.parseLinksProp(this.links);
160
- }
161
- get initials() {
162
- var _a, _b, _c, _d, _e, _f, _g;
163
- const initials = `${((_b = (_a = this.parsedUser) === null || _a === void 0 ? void 0 : _a.firstname) === null || _b === void 0 ? void 0 : _b.charAt(0)) || ''}${((_d = (_c = this.parsedUser) === null || _c === void 0 ? void 0 : _c.lastname) === null || _d === void 0 ? void 0 : _d.charAt(0)) || ''}`.toUpperCase();
164
- return initials || ((_g = (_f = (_e = this.parsedUser) === null || _e === void 0 ? void 0 : _e.fullname) === null || _f === void 0 ? void 0 : _f.charAt(0)) === null || _g === void 0 ? void 0 : _g.toUpperCase()) || '';
165
- }
166
- get hasLogout() {
167
- return typeof this.onLogout === 'function';
168
- }
169
- render() {
170
- var _a, _b, _c, _d, _e;
171
- return h("div", {
172
- key: '866e4e08b5a5330d341845c7cd68f18845732bb6',
173
- class: "min-w-[280px] p-8"
174
- }, h("div", {
175
- key: 'c3c0c56a0ba0bb035efbc474dacc69454f2f9831',
176
- class: "flex gap-x-16 pb-16 border-b-2 border-softer"
177
- }, h("eds-avatar", {
178
- key: '053e545eb7b8f66b9b9463f77ac89083b2bc87a4',
179
- "first-name": (_a = this.parsedUser) === null || _a === void 0 ? void 0 : _a.firstname,
180
- "last-name": (_b = this.parsedUser) === null || _b === void 0 ? void 0 : _b.lastname,
181
- initials: this.initials,
182
- color: "grey",
183
- rounded: true,
184
- "initials-strong": true
185
- }), h("div", {
186
- key: 'c2d3a51f5aa92dda20058b51aaab3405a85dfbc0',
187
- class: "max-w-full"
188
- }, ((_c = this.parsedUser) === null || _c === void 0 ? void 0 : _c.fullname) && h("p", {
189
- key: 'fcc11680037eb282316cfde3988beb7550a51059',
190
- class: "f-ui-01 text-default w-full text-ellipsis"
191
- }, this.parsedUser.fullname), ((_d = this.parsedUser) === null || _d === void 0 ? void 0 : _d.username) && h("p", {
192
- key: '2f6aac63baecb3da750f3eb9a09f8793120d8977',
193
- class: "f-ui-03-light text-light mt-4"
194
- }, this.parsedUser.username), ((_e = this.parsedUser) === null || _e === void 0 ? void 0 : _e.email) && h("p", {
195
- key: '04f3cf2dab10351bc52c94f53c6e9b75d3d34fe7',
196
- class: "f-ui-03-light text-light mt-4"
197
- }, this.parsedUser.email))), h("div", {
198
- key: 'b5bb3171c338891669251b8cde0cdbc810562065',
199
- class: "text-default mt-16 flex w-full flex-col gap-y-8"
200
- }, h("div", {
201
- key: '7020f1d94ad9ed10d8b1e1fce88837c70ef310b8',
202
- class: "border-softer mb-10 border-b-2 pb-16"
203
- }, h("eds-link", {
204
- key: '26946fa26bd53953e99f2f61b4d9f47e60f5dc6f',
205
- label: "My EBRAINS",
206
- "aria-label": "My EBRAINS",
207
- url: "https://www.ebrains.eu/dashboard",
208
- intent: "primary",
209
- "extra-class": "w-full",
210
- external: true
211
- })), h("eds-link", {
212
- key: 1,
213
- label: "Account Settings",
214
- url: "https://iam.ebrains.eu/auth/realms/hbp/account/",
215
- intent: "secondary",
216
- icon: "arrow-diagonal",
217
- external: true,
218
- "extra-class": "w-full"
219
- }), this.hasLogout && h("eds-link", {
220
- key: 'e53f2b7588fea91fd16c0effe81609e1ded97304',
221
- label: "Sign out",
222
- intent: "tertiary",
223
- "extra-class": "w-full justify-center",
224
- onClick: () => this.onLogout && this.onLogout()
225
- })));
226
- }
227
- static get watchers() {
228
- return {
229
- "user": ["parseUserProp"],
230
- "links": ["parseLinksProp"]
231
- };
232
- }
233
- };
234
-
235
- export { EdsDropdown as eds_dropdown, EdsUserModal as eds_user_modal };
@@ -1,102 +0,0 @@
1
- import { r as registerInstance, h } from './index.esm2.js';
2
- import 'react';
3
- import 'react/jsx-runtime';
4
- import 'react-dom';
5
-
6
- const edsFooterCss = "";
7
- const EdsFooterStyle0 = edsFooterCss;
8
- const EdsFooter = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- /**
12
- * Scrolls the page smoothly back to the top.
13
- * Called when the "Back to top" button is clicked.
14
- * @private
15
- */
16
- this.backToTop = () => {
17
- window.scrollTo({
18
- top: 0,
19
- behavior: 'smooth'
20
- });
21
- };
22
- this.extraClass = '';
23
- this.social = false;
24
- this.enableScrollTop = false;
25
- this.fundedBy = 'EBRAINS is funded by the Horizon Europe Framework Programme.';
26
- this.rightsReserved = `${new Date().getFullYear()} EBRAINS. All rights reserved.`;
27
- this.showMatomoNotice = false;
28
- }
29
- /**
30
- * Renders the footer component with optional sections and elements,
31
- * including social network links, a Horizon Europe funding acknowledgment, and
32
- * legal links such as "Cookies Preferences" and copyright information.
33
- *
34
- * @returns {JSX.Element} The rendered JSX for the footer component.
35
- */
36
- render() {
37
- return h("footer", {
38
- key: '9a7256325386a5072e9f1e391d838bb38458d99f',
39
- class: `${this.extraClass} pb-banner`
40
- }, this.social ? h("div", {
41
- class: "border-softest border-t-2 pt-20 pb-28 md:pt-28"
42
- }, h("div", {
43
- class: "container pb-20 xl:pb-40 "
44
- }, h("div", {
45
- class: "grid-layout"
46
- }, h("div", {
47
- class: "grid-col-span-12 lg:grid-col-span-5"
48
- }, h("eds-social-networks", {
49
- class: "mt-28"
50
- })), h("nav", {
51
- "aria-label": "Secondary nav",
52
- class: "grid-col-span-12 lg:grid-col-span-6 lg:grid-col-start-7 grid-layout mt-28 gap-y-12 lg:mt-0"
53
- })))) : null, h("div", {
54
- key: '747d4708e90c13fe9e5aa234eaba182df100fca9',
55
- class: `border-softest ${this.social ? 'border-t-2' : ''} pt-20 pb-28 md:pt-28`
56
- }, h("div", {
57
- key: '3fecf340c536bb64aa98fd04c26c5b47d146630b',
58
- class: "container flex flex-wrap items-center gap-20 lg:flex-nowrap"
59
- }, h("div", {
60
- key: '6b7f167ac50c6aef9c76e56634a7228585c211db',
61
- class: "flex items-center gap-x-12"
62
- }, h("a", {
63
- key: '8e496d31c4b883a867b5f2c6a5fab8a60899470a',
64
- target: "_blank",
65
- rel: "noopener noreferrer",
66
- class: "effect-focus focus-visible:rounded-xs flex w-[54px] ml-0",
67
- href: "https://research-and-innovation.ec.europa.eu/funding/funding-opportunities/funding-programmes-and-open-calls/horizon-2020_en",
68
- "aria-label": "Learn about Horizon 2020 funding"
69
- }, h("eds-img", {
70
- key: 'b3cdfc2cc428951d58fe5ae4f1fe1992fbded7f7',
71
- width: 54,
72
- height: 41,
73
- src: "https://www.ebrains.eu/flags/4x3/eu.svg",
74
- alt: "European Union Flag"
75
- }))), h("div", {
76
- key: '8c3a9f55f07b44ad633b11a1d4faa8396a5ae30a',
77
- class: "order-last w-full lg:order-none lg:w-auto"
78
- }, h("div", {
79
- key: 'c268c107f6be692756d15a8f096e1a86df7bb62a',
80
- class: "f-ui-04 text-light"
81
- }, h("p", {
82
- key: '528014cafcd1b498efa01482934b54c44dd03bd6'
83
- }, this.fundedBy), h("div", {
84
- key: 'ee5baffcf8f801b7480c8158b30777329699f57f',
85
- class: "mt-4 flex flex-wrap gap-12 lg:flex-nowrap inline-block"
86
- }, h("span", {
87
- key: '79e600b799480904f47261be78262f344ada967b',
88
- class: "effect-focus !no-underline decoration-2 underline-offset-4 hover:!underline"
89
- }, "\u00A9 ", this.rightsReserved)))), h("div", {
90
- key: '6bde5399c1044e0d85b71c9fab7e3e4c8b93e224',
91
- class: "ml-auto pl-12"
92
- }, this.enableScrollTop ? h("eds-button", {
93
- "aria-label": "Back to top",
94
- intent: "ghostInverse",
95
- icon: "chevron-up",
96
- onClick: this.backToTop
97
- }) : null))));
98
- }
99
- };
100
- EdsFooter.style = EdsFooterStyle0;
101
-
102
- export { EdsFooter as eds_footer };
@@ -1,143 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index.esm2.js';
2
- import 'react';
3
- import 'react/jsx-runtime';
4
- import 'react-dom';
5
-
6
- const edsFullscreenMenuCss = "";
7
- const EdsFullscreenMenuStyle0 = edsFullscreenMenuCss;
8
- const EdsFullscreenMenu = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.menuClose = createEvent(this, "menuClose", 7);
12
- this.links = undefined;
13
- this.menuLinks = undefined;
14
- this.homeUrl = '/';
15
- this.inverseHeader = false;
16
- this.isMenuOpen = false;
17
- }
18
- /**
19
- * Listens for the toggleMenu event to open or close the menu.
20
- * This event is emitted by the eds-header component.
21
- */
22
- handleToggleMenu(event) {
23
- this.isMenuOpen = event.detail; // Set isMenuOpen based on the event payload
24
- }
25
- /** Opens the menu */
26
- openMenu() {
27
- this.isMenuOpen = true;
28
- }
29
- /** Closes the menu */
30
- closeMenu() {
31
- this.isMenuOpen = false;
32
- this.menuClose.emit();
33
- }
34
- // Lifecycle method to add the resize event listener when component loads
35
- componentDidLoad() {
36
- window.addEventListener('resize', this.handleResize.bind(this));
37
- }
38
- // Lifecycle method to remove the resize event listener when component unloads
39
- disconnectedCallback() {
40
- window.removeEventListener('resize', this.handleResize.bind(this));
41
- }
42
- // Function to close the menu if screen width is larger than a defined breakpoint (1024px)
43
- handleResize() {
44
- if (window.innerWidth >= 1024) {
45
- this.isMenuOpen = false;
46
- }
47
- }
48
- /**
49
- * Parses the `links` prop into an array of link objects.
50
- * Returns an empty array if parsing fails or if `links` is not a valid JSON string or object.
51
- *
52
- * @returns {any[]} Array of parsed link objects
53
- */
54
- get parsedLinks() {
55
- if (typeof this.links === 'object') {
56
- return this.links;
57
- } else if (typeof this.links === 'string') {
58
- try {
59
- return JSON.parse(this.links);
60
- } catch (e) {
61
- // eslint-disable-next-line
62
- console.error('Error parsing links prop:', e);
63
- return [];
64
- }
65
- }
66
- return [];
67
- }
68
- /**
69
- * Parses the `menuLinks` prop into an array of link objects.
70
- * Returns an empty array if parsing fails or if `menuLinks` is not a valid JSON string or object.
71
- *
72
- * @returns {any[]} Array of parsed menu link objects
73
- */
74
- get parsedMenuLinks() {
75
- if (typeof this.menuLinks === 'object') {
76
- return this.menuLinks;
77
- } else if (typeof this.menuLinks === 'string') {
78
- try {
79
- return JSON.parse(this.menuLinks);
80
- } catch (e) {
81
- // eslint-disable-next-line
82
- console.error('Error parsing menuLinks prop:', e);
83
- return [];
84
- }
85
- }
86
- return [];
87
- }
88
- render() {
89
- return this.isMenuOpen ? h("div", {
90
- class: "eds-full-screen bg-default fixed inset-0 z-[999999] overflow-y-scroll"
91
- }, h("div", {
92
- class: "flex min-h-full flex-col"
93
- }, h("div", {
94
- class: `bg-default w-full sticky top-0 ${this.inverseHeader ? 'bg-strongest' : 'bg-default'}`
95
- }, h("div", {
96
- class: "mx-auto flex items-center justify-between"
97
- }, h("div", {
98
- class: "mr-auto w-[200px] h-[85px]"
99
- }, h("eds-logo", {
100
- type: this.inverseHeader ? 'color-white' : 'color',
101
- href: this.homeUrl
102
- })), h("div", {
103
- class: "px-16"
104
- }, h("eds-button", {
105
- "aria-label": "Close menu",
106
- intent: "ghostInverse",
107
- icon: "close",
108
- onClick: () => this.closeMenu()
109
- })))), h("div", {
110
- class: "py-16 px-16"
111
- }, h("nav", {
112
- class: "mt-28 flex flex-col gap-y-8"
113
- }, this.parsedLinks.map((link, index) => h("eds-link", {
114
- label: link.label,
115
- key: index,
116
- url: link.url,
117
- intent: "tertiary",
118
- size: "large",
119
- class: "effect-color effect-focus rounded-xs f-heading-02 hover:text-lighter w-fit",
120
- onClick: () => this.closeMenu(),
121
- icon: "arrow-right"
122
- }))), h("eds-block-break", null), h("nav", {
123
- class: "mt-28 flex flex-col gap-y-8"
124
- }, this.parsedMenuLinks.map((link, index) => h("eds-link", {
125
- label: link.label,
126
- key: index,
127
- url: link.url,
128
- intent: "tertiary",
129
- size: "large",
130
- class: "effect-color effect-focus rounded-xs f-heading-02 hover:text-lighter w-fit",
131
- onClick: () => this.closeMenu(),
132
- icon: "chevron-right"
133
- })))), h("div", {
134
- class: "mt-auto"
135
- }, h("eds-footer", {
136
- social: true,
137
- "extra-class": "bg-darker"
138
- })))) : null;
139
- }
140
- };
141
- EdsFullscreenMenu.style = EdsFullscreenMenuStyle0;
142
-
143
- export { EdsFullscreenMenu as eds_fullscreen_menu };
@@ -1,130 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index.esm2.js';
2
- import 'react';
3
- import 'react/jsx-runtime';
4
- import 'react-dom';
5
-
6
- const edsHeaderCss = "";
7
- const EdsHeaderStyle0 = edsHeaderCss;
8
- const EdsHeader = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.toggleMenu = createEvent(this, "toggleMenu", 7);
12
- this.homeUrl = '/';
13
- this.links = undefined;
14
- this.inverseHeader = false;
15
- this.menuEnabled = false;
16
- this.isMenuOpen = false;
17
- this.isUserMenuOpen = false;
18
- this.isAuthenticated = false;
19
- }
20
- onAuthStatusChanged(event) {
21
- var _a;
22
- this.isAuthenticated = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.authenticated;
23
- }
24
- /**
25
- * Lifecycle method that runs when the component has fully loaded.
26
- * It emits a custom event for each `eds-link` element contained within the breadcrumb.
27
- */
28
- componentDidLoad() {
29
- // Emit context for each eds-link element after the component is fully loaded
30
- const links = this.hostEl.querySelectorAll('eds-link');
31
- links.forEach(link => {
32
- this.emitContext(link);
33
- });
34
- }
35
- /**
36
- * Emits a custom event called `parentContext` for a given link element.
37
- * This event provides context information about the breadcrumb component.
38
- *
39
- * @param linkElement - The link element to which the event will be dispatched.
40
- */
41
- emitContext(linkElement) {
42
- const event = new CustomEvent('parentContext', {
43
- detail: {
44
- componentName: this.hostEl.tagName.toLowerCase(),
45
- identifier: null
46
- }
47
- });
48
- linkElement.dispatchEvent(event);
49
- }
50
- /** Emits an event to open or close the menu */
51
- handleToggleMenu() {
52
- this.toggleMenu.emit(!this.isMenuOpen);
53
- }
54
- /**
55
- * Toggles the visibility of the user menu.
56
- * Opens the user menu if closed, and closes it if open.
57
- */
58
- toggleUserMenu() {
59
- this.isUserMenuOpen = !this.isUserMenuOpen;
60
- }
61
- /**
62
- * Parses the `links` prop into an array of link objects.
63
- * Returns an empty array if parsing fails or if `links` is not a valid JSON string or object.
64
- *
65
- * @returns {any[]} Array of parsed link objects
66
- */
67
- get parsedLinks() {
68
- // If it's already an array, return it immediately.
69
- if (Array.isArray(this.links)) {
70
- return this.links;
71
- }
72
- if (typeof this.links === 'object') {
73
- return this.links;
74
- } else if (typeof this.links === 'string') {
75
- try {
76
- return JSON.parse(this.links);
77
- } catch (e) {
78
- // eslint-disable-next-line
79
- console.error('Error parsing links prop:', e);
80
- return [];
81
- }
82
- }
83
- return [];
84
- }
85
- render() {
86
- return h("header", {
87
- key: '8447435914bd3cdf61ce03f2a6bc646fd6b39b01',
88
- class: `flex items-center justify-between relative z-10
89
- ${this.inverseHeader ? 'text-inverse bg-strongest' : 'text-default bg-dark'}`
90
- }, h("div", {
91
- key: '2a7a525d9ec5f86437212ab5b6c60c901e1f69a8',
92
- class: "mr-auto w-[200px] h-[85px]"
93
- }, h("eds-logo", {
94
- key: '29381ef7d9f600690a373a09be30b2dea6d5b936',
95
- type: this.inverseHeader ? 'color-white' : 'color',
96
- href: this.homeUrl
97
- })), this.parsedLinks && h("nav", {
98
- key: '8085c6dfa6dadce3d7eefb45505e9c9404fd422d',
99
- class: "absolute left-1/2 top-1/2 grow -translate-x-1/2 -translate-y-1/2 justify-center hidden md:flex"
100
- }, h("ul", {
101
- key: 'cb8442be1efc058dc46c283c85e50c58dd627f3e',
102
- class: "flex gap-x-2"
103
- }, this.parsedLinks.map(link => h("eds-link", {
104
- label: link.label,
105
- "aria-label": link.label,
106
- url: link.url,
107
- intent: "ghost",
108
- size: "small",
109
- icon: link.icon,
110
- external: link.external,
111
- "extra-class": "after:effect-opacity aria-current-page:bg-darker whitespace-nowrap !text-current after:!border-transparent after:opacity-0 hover:after:!border-transparent hover:after:opacity-100"
112
- })))), h("slot", {
113
- key: '5d39561f4f43641640cc3f5d01edd35ebde794e3'
114
- }), this.menuEnabled ? h("div", {
115
- class: "md:hidden flex overflow-hidden px-16"
116
- }, h("eds-button", {
117
- "aria-label": "Menu",
118
- intent: "ghostInverse",
119
- icon: "menu",
120
- size: "small",
121
- onClick: () => this.handleToggleMenu()
122
- })) : null);
123
- }
124
- get hostEl() {
125
- return getElement(this);
126
- }
127
- };
128
- EdsHeader.style = EdsHeaderStyle0;
129
-
130
- export { EdsHeader as eds_header };