@ebrains/react 0.3.0-alpha.0 → 0.5.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.
- package/analytics-1cde8e4a.esm.js +47 -0
- package/color-2554aad6.esm.js +122 -0
- package/color-primary-palette_6.entry.esm.js +106 -106
- package/correct-use-of-colors.entry.esm.js +33 -33
- package/eds-accordion.entry.esm.js +24 -30
- package/eds-alert_17.entry.esm.js +187 -0
- package/{eds-card-desc_3.entry.esm.js → eds-avatar_4.entry.esm.js} +71 -7
- package/eds-card-generic.entry.esm.js +6 -7
- package/eds-card-project.entry.esm.js +12 -11
- package/eds-card-section.entry.esm.js +4 -4
- package/eds-card-tags.entry.esm.js +1 -1
- package/eds-card-tool.entry.esm.js +5 -6
- package/eds-card-wrapper.entry.esm.js +4 -4
- package/eds-code-block.entry.esm.js +56 -9
- package/eds-components-section.entry.esm.js +14 -2
- package/eds-docs-palettes.entry.esm.js +1 -1
- package/eds-docs-tokens.entry.esm.js +1 -1
- package/eds-dropdown_2.entry.esm.js +235 -0
- package/eds-form.entry.esm.js +59 -23
- package/eds-frame.entry.esm.js +4 -4
- package/eds-icon-arrow-diagonal.entry.esm.js +1 -1
- package/eds-icon-arrow-right.entry.esm.js +1 -1
- package/eds-icon-bluesky.entry.esm.js +1 -1
- package/eds-icon-chevron-down.entry.esm.js +1 -1
- package/eds-icon-chevron-left.entry.esm.js +1 -1
- package/eds-icon-chevron-right.entry.esm.js +1 -1
- package/eds-icon-chevron-up.entry.esm.js +1 -1
- package/eds-icon-close.entry.esm.js +1 -1
- package/eds-icon-copy.entry.esm.js +1 -1
- package/eds-icon-eu.entry.esm.js +1 -1
- package/eds-icon-facebook.entry.esm.js +1 -1
- package/eds-icon-gitlab.entry.esm.js +1 -1
- package/eds-icon-linkedin.entry.esm.js +1 -1
- package/eds-icon-loader.entry.esm.js +1 -1
- package/eds-icon-mastodon.entry.esm.js +1 -1
- package/eds-icon-menu.entry.esm.js +1 -1
- package/eds-icon-more.entry.esm.js +1 -1
- package/eds-icon-search.entry.esm.js +1 -1
- package/eds-icon-success.entry.esm.js +1 -1
- package/eds-icon-twitter.entry.esm.js +1 -1
- package/eds-icon-user.entry.esm.js +1 -1
- package/eds-icon-youtube.entry.esm.js +1 -1
- package/eds-input_7.entry.esm.js +39 -28
- package/eds-login.entry.esm.js +66 -45
- package/eds-logo-variations.entry.esm.js +1 -1
- package/eds-matomo-notice.entry.esm.js +1 -2
- package/eds-modal.entry.esm.js +57 -42
- package/eds-navigator.entry.esm.js +5 -5
- package/eds-pagination_2.entry.esm.js +35 -19
- package/eds-progress-bar.entry.esm.js +7 -2
- package/eds-section-core_2.entry.esm.js +5 -5
- package/eds-svg-repository.entry.esm.js +1 -1
- package/eds-tab.entry.esm.js +1 -1
- package/eds-tabs-content.entry.esm.js +5 -5
- package/eds-tabs.entry.esm.js +4 -4
- package/eds-timeline.entry.esm.js +6 -5
- package/eds-tooltip.entry.esm.js +12 -3
- package/eds-trl.entry.esm.js +9 -10
- package/eds-user.entry.esm.js +118 -0
- package/eds-vertical-stepper.entry.esm.js +81 -0
- package/incorrect-use-of-colors.entry.esm.js +7 -7
- package/index.esm.js +1 -1
- package/index.esm2.js +18 -13
- package/{keycloak-13893af6.esm.js → keycloak-d502ec16.esm.js} +219 -168
- package/logo-space.entry.esm.js +4 -4
- package/logo-variations-horizontal_2.entry.esm.js +26 -26
- package/logo-wrong-usage.entry.esm.js +37 -37
- package/package.json +1 -1
- package/src/components.d.ts +3 -1
- package/token-list_3.entry.esm.js +5 -5
- package/token-ratios.entry.esm.js +3 -3
- package/token-spacing.entry.esm.js +26 -26
- package/token-typography.entry.esm.js +2 -2
- package/color-0ba8ed56.esm.js +0 -423
- package/eds-alert.entry.esm.js +0 -102
- package/eds-avatar_17.entry.esm.js +0 -209
- package/eds-rating.entry.esm.js +0 -71
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index.esm2.js';
|
|
2
|
+
import { s as sendAnalytics } from './analytics-1cde8e4a.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: '4a80335b6a59b9653130ca75a6e42c04fce68f4f',
|
|
173
|
+
class: "min-w-[280px] p-8"
|
|
174
|
+
}, h("div", {
|
|
175
|
+
key: '9c97f6be46216587692d4852174cecfaacb70593',
|
|
176
|
+
class: "flex gap-x-16 pb-16 border-b-2 border-softer"
|
|
177
|
+
}, h("eds-avatar", {
|
|
178
|
+
key: 'c778f6bdfb21068ca7c2deff6e298f61af6dbc67',
|
|
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: '7f453546c9cc54597069abb3e4b50312fe7bf364',
|
|
187
|
+
class: "max-w-full"
|
|
188
|
+
}, ((_c = this.parsedUser) === null || _c === void 0 ? void 0 : _c.fullname) && h("p", {
|
|
189
|
+
key: '34e080ef159535820c09378701de0e6f4fd96009',
|
|
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: '2f85764e7d015dc3f3b22ca8a07126f8f57216ef',
|
|
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: '002dec51e979c29f2343f55e004449e4cee4075c',
|
|
196
|
+
class: "f-ui-03-light text-light mt-4"
|
|
197
|
+
}, this.parsedUser.email))), h("div", {
|
|
198
|
+
key: '740b78c504257fb755ba7ba04dd25f023d37ed33',
|
|
199
|
+
class: "text-default mt-16 flex w-full flex-col gap-y-8"
|
|
200
|
+
}, h("div", {
|
|
201
|
+
key: 'ac307937bdd3fc86cce502e5eeb3e922d931f418',
|
|
202
|
+
class: "border-softer mb-10 border-b-2 pb-16"
|
|
203
|
+
}, h("eds-link", {
|
|
204
|
+
key: 'bdd0f1ef62ac78ffb1b40ed6873475df360cec66',
|
|
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: 'd73016ad71f3b356b7fb7d0a2a84124eabb05da5',
|
|
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 };
|
package/eds-form.entry.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index.esm2.js';
|
|
2
2
|
import { t as toast } from './toastManager-d9eee791.esm.js';
|
|
3
|
+
import { s as sendAnalytics } from './analytics-1cde8e4a.esm.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
import 'react/jsx-runtime';
|
|
5
6
|
import 'react-dom';
|
|
@@ -51,13 +52,20 @@ const EdsForm = class {
|
|
|
51
52
|
this.hasError = Object.keys(newErrors).length > 0;
|
|
52
53
|
};
|
|
53
54
|
this.handleSubmit = async e => {
|
|
54
|
-
var _a;
|
|
55
|
+
var _a, _b, _c;
|
|
55
56
|
e.preventDefault();
|
|
56
57
|
if (this.isSubmitting) {
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
this.validateForm();
|
|
60
61
|
if (this.hasError) {
|
|
62
|
+
sendAnalytics({
|
|
63
|
+
category: 'ui-component',
|
|
64
|
+
parentContext: null,
|
|
65
|
+
tag: this.el.tagName.toLowerCase(),
|
|
66
|
+
name: `${(_a = this.submitBtnLabel) === null || _a === void 0 ? void 0 : _a.toLowerCase()}/error` || '',
|
|
67
|
+
action: 'click'
|
|
68
|
+
});
|
|
61
69
|
this.alertMessage = this.errorMessage;
|
|
62
70
|
return;
|
|
63
71
|
}
|
|
@@ -78,7 +86,7 @@ const EdsForm = class {
|
|
|
78
86
|
formData.set('form_url', window.location.href);
|
|
79
87
|
}
|
|
80
88
|
if (this.authUser) {
|
|
81
|
-
formData.set('form_user', (
|
|
89
|
+
formData.set('form_user', (_b = this.authUser) === null || _b === void 0 ? void 0 : _b.email);
|
|
82
90
|
}
|
|
83
91
|
/*const formDataObject = Object.fromEntries((formData as any).entries());
|
|
84
92
|
console.log(JSON.stringify(formDataObject));*/
|
|
@@ -105,6 +113,13 @@ const EdsForm = class {
|
|
|
105
113
|
//this.alertMessage = data.message || this.successMessage;
|
|
106
114
|
toast.show(data.message || this.successMessage, 'success');
|
|
107
115
|
this.formEl.reset();
|
|
116
|
+
sendAnalytics({
|
|
117
|
+
category: 'ui-component',
|
|
118
|
+
parentContext: null,
|
|
119
|
+
tag: this.el.tagName.toLowerCase(),
|
|
120
|
+
name: `${(_c = this.submitBtnLabel) === null || _c === void 0 ? void 0 : _c.toLowerCase()}/success` || '',
|
|
121
|
+
action: 'click'
|
|
122
|
+
});
|
|
108
123
|
} catch (err) {
|
|
109
124
|
this.hasError = true;
|
|
110
125
|
//when api is unreachable will trigger the error message
|
|
@@ -115,7 +130,6 @@ const EdsForm = class {
|
|
|
115
130
|
this.formSubmitting.emit(this.isSubmitting);
|
|
116
131
|
}
|
|
117
132
|
};
|
|
118
|
-
this.smallAlert = false;
|
|
119
133
|
this.setFormUrl = true;
|
|
120
134
|
this.submitBtn = true;
|
|
121
135
|
this.submitBtnLabel = 'Submit';
|
|
@@ -124,7 +138,7 @@ const EdsForm = class {
|
|
|
124
138
|
this.submitBtnHintMessage = 'To participate, please sign in using your EBRAINS account. If you do not have an account yet, you can easily create one on the EBRAINS portal.';
|
|
125
139
|
this.endpoint = undefined;
|
|
126
140
|
this.name = 'form';
|
|
127
|
-
this.fields =
|
|
141
|
+
this.fields = [];
|
|
128
142
|
this.values = {};
|
|
129
143
|
this.coupleAuth = false;
|
|
130
144
|
this.formSubmitted = false;
|
|
@@ -134,6 +148,7 @@ const EdsForm = class {
|
|
|
134
148
|
this.alertMessage = null;
|
|
135
149
|
this.isAuthenticated = false;
|
|
136
150
|
this.authUser = undefined;
|
|
151
|
+
this.parsedFields = [];
|
|
137
152
|
}
|
|
138
153
|
onAuthStatusChanged(event) {
|
|
139
154
|
var _a;
|
|
@@ -141,21 +156,22 @@ const EdsForm = class {
|
|
|
141
156
|
this.authUser = event.detail.user;
|
|
142
157
|
}
|
|
143
158
|
componentDidLoad() {
|
|
159
|
+
this.parseFields(this.fields);
|
|
144
160
|
// Emit context for each eds-link element after the component is fully loaded
|
|
145
|
-
const links = this.el.querySelectorAll('eds-button');
|
|
146
|
-
links.forEach(link => {
|
|
161
|
+
/*const links = this.el.querySelectorAll('eds-button');
|
|
162
|
+
links.forEach((link) => {
|
|
147
163
|
this.emitContext(link);
|
|
148
|
-
})
|
|
164
|
+
});*/
|
|
149
165
|
}
|
|
150
|
-
emitContext(linkElement) {
|
|
151
|
-
const event = new CustomEvent('parentContext', {
|
|
166
|
+
/*emitContext(linkElement: HTMLElement) {
|
|
167
|
+
const event = new CustomEvent<ParentContextDetail>('parentContext', {
|
|
152
168
|
detail: {
|
|
153
169
|
componentName: this.el.tagName.toLowerCase(),
|
|
154
170
|
identifier: null
|
|
155
171
|
}
|
|
156
172
|
});
|
|
157
|
-
|
|
158
|
-
}
|
|
173
|
+
linkElement.dispatchEvent(event);
|
|
174
|
+
}*/
|
|
159
175
|
// Visibility helper
|
|
160
176
|
isFieldVisible(field) {
|
|
161
177
|
if (!field.condition) {
|
|
@@ -222,7 +238,7 @@ const EdsForm = class {
|
|
|
222
238
|
validateForm() {
|
|
223
239
|
this.errors = {};
|
|
224
240
|
this.hasError = false;
|
|
225
|
-
this.
|
|
241
|
+
this.parsedFields.forEach(field => {
|
|
226
242
|
if (field.type !== 'hidden') {
|
|
227
243
|
if ((field.type === 'checkbox' || field.type === 'radio') && !field.options) {
|
|
228
244
|
// Single checkbox validation
|
|
@@ -300,23 +316,38 @@ const EdsForm = class {
|
|
|
300
316
|
});
|
|
301
317
|
return formData;
|
|
302
318
|
}
|
|
303
|
-
|
|
304
|
-
|
|
319
|
+
parseFields(newValue) {
|
|
320
|
+
try {
|
|
321
|
+
if (typeof newValue === 'string') {
|
|
322
|
+
this.parsedFields = JSON.parse(newValue);
|
|
323
|
+
} else if (Array.isArray(newValue)) {
|
|
324
|
+
this.parsedFields = newValue;
|
|
325
|
+
} else if (newValue && typeof newValue === 'object') {
|
|
326
|
+
// In case a single object is passed, wrap it in an array.
|
|
327
|
+
this.parsedFields = newValue;
|
|
328
|
+
} else {
|
|
329
|
+
this.parsedFields = [];
|
|
330
|
+
}
|
|
331
|
+
} catch (error) {
|
|
332
|
+
// eslint-disable-next-line
|
|
333
|
+
console.error('Error parsing fields prop:', error);
|
|
334
|
+
this.parsedFields = [];
|
|
335
|
+
}
|
|
305
336
|
}
|
|
306
337
|
render() {
|
|
307
|
-
const hiddenFields = this.
|
|
308
|
-
const otherFields = this.
|
|
338
|
+
const hiddenFields = this.parsedFields.filter(field => field.type === 'hidden');
|
|
339
|
+
const otherFields = this.parsedFields.filter(field => field.type !== 'hidden');
|
|
309
340
|
return h("form", {
|
|
310
|
-
key: '
|
|
341
|
+
key: '3d4ae34d48c0551f9de6dacb50ceee15b487b5de',
|
|
311
342
|
ref: el => this.formEl = el,
|
|
312
343
|
enctype: "multipart/form-data",
|
|
313
344
|
autocomplete: "on",
|
|
314
345
|
method: "post",
|
|
315
346
|
onSubmit: this.handleSubmit
|
|
316
347
|
}, h("div", {
|
|
317
|
-
key: '
|
|
348
|
+
key: '344c56dcba3de5a1b55255d794a78fb0f19d04b5'
|
|
318
349
|
}, h("slot", {
|
|
319
|
-
key: '
|
|
350
|
+
key: '3ca6d203458d67fa66840fac55f94d71acc2ee4d'
|
|
320
351
|
}), hiddenFields.map((field, index) => h("eds-input", {
|
|
321
352
|
key: index,
|
|
322
353
|
type: "hidden",
|
|
@@ -344,10 +375,10 @@ const EdsForm = class {
|
|
|
344
375
|
options: field.options
|
|
345
376
|
});
|
|
346
377
|
})), this.submitBtn && h("div", {
|
|
347
|
-
key: '
|
|
378
|
+
key: '22915285f3522f6d260e358eea964c59a9557a55',
|
|
348
379
|
class: "mt-20"
|
|
349
380
|
}, h("eds-button", {
|
|
350
|
-
key: '
|
|
381
|
+
key: '9e2191ba8cc49d7ac2a6588c0fa468214773c791',
|
|
351
382
|
intent: "primary",
|
|
352
383
|
label: this.submitBtnLabel,
|
|
353
384
|
disabled: this.isSubmitting || this.coupleAuth && !this.isAuthenticated,
|
|
@@ -356,10 +387,10 @@ const EdsForm = class {
|
|
|
356
387
|
}), this.coupleAuth && !this.isAuthenticated ? h("p", {
|
|
357
388
|
class: "f-ui-05 text-lighter mt-8 ml-8"
|
|
358
389
|
}, this.submitBtnHintMessage) : null), this.alertMessage && (this.formSubmitted || this.hasError) && h("div", {
|
|
359
|
-
key: '
|
|
390
|
+
key: '8045c3dff26286a6735157b82afd56ec9001ba14',
|
|
360
391
|
class: "mt-20"
|
|
361
392
|
}, h("eds-alert", {
|
|
362
|
-
key: '
|
|
393
|
+
key: 'dc8c8f74e8aada9023f110bb862afee1fb629601',
|
|
363
394
|
message: this.alertMessage,
|
|
364
395
|
intent: this.hasError ? 'error' : 'success',
|
|
365
396
|
direction: "horizontal"
|
|
@@ -368,6 +399,11 @@ const EdsForm = class {
|
|
|
368
399
|
get el() {
|
|
369
400
|
return getElement(this);
|
|
370
401
|
}
|
|
402
|
+
static get watchers() {
|
|
403
|
+
return {
|
|
404
|
+
"fields": ["parseFields"]
|
|
405
|
+
};
|
|
406
|
+
}
|
|
371
407
|
};
|
|
372
408
|
EdsForm.style = EdsFormStyle0;
|
|
373
409
|
|
package/eds-frame.entry.esm.js
CHANGED
|
@@ -79,13 +79,13 @@ const EdsFrame = class {
|
|
|
79
79
|
}
|
|
80
80
|
render() {
|
|
81
81
|
return h("div", {
|
|
82
|
-
key: '
|
|
82
|
+
key: '20786dd40414d29f98d496e29720bd78b9d7cf8e',
|
|
83
83
|
class: this.articleClasses()
|
|
84
84
|
}, h("div", {
|
|
85
|
-
key: '
|
|
85
|
+
key: '208612330c9d2872c68aeb310e164c8a915a51ef',
|
|
86
86
|
class: "effect-height flex items-center justify-between py-8 px-12"
|
|
87
87
|
}, h("span", {
|
|
88
|
-
key: '
|
|
88
|
+
key: 'ada2a40384ffaffadc8887580aa6184422008a68',
|
|
89
89
|
class: "f-ui-02"
|
|
90
90
|
}, this.frameLabel), !this.iframeError ? h("eds-link", {
|
|
91
91
|
label: this.urlLabel,
|
|
@@ -96,7 +96,7 @@ const EdsFrame = class {
|
|
|
96
96
|
disabled: false,
|
|
97
97
|
icon: "arrow-diagonal"
|
|
98
98
|
}) : null), h("div", {
|
|
99
|
-
key: '
|
|
99
|
+
key: '26a5ae1c81b60b05b6f4859ffa4dbd13bb2557f3',
|
|
100
100
|
class: "border-softer border-t-2"
|
|
101
101
|
}, this.iframeError ? h("div", {
|
|
102
102
|
class: "container ml-8 mr-8 mt-16"
|
package/eds-icon-eu.entry.esm.js
CHANGED