@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.
Files changed (77) hide show
  1. package/analytics-1cde8e4a.esm.js +47 -0
  2. package/color-2554aad6.esm.js +122 -0
  3. package/color-primary-palette_6.entry.esm.js +106 -106
  4. package/correct-use-of-colors.entry.esm.js +33 -33
  5. package/eds-accordion.entry.esm.js +24 -30
  6. package/eds-alert_17.entry.esm.js +187 -0
  7. package/{eds-card-desc_3.entry.esm.js → eds-avatar_4.entry.esm.js} +71 -7
  8. package/eds-card-generic.entry.esm.js +6 -7
  9. package/eds-card-project.entry.esm.js +12 -11
  10. package/eds-card-section.entry.esm.js +4 -4
  11. package/eds-card-tags.entry.esm.js +1 -1
  12. package/eds-card-tool.entry.esm.js +5 -6
  13. package/eds-card-wrapper.entry.esm.js +4 -4
  14. package/eds-code-block.entry.esm.js +56 -9
  15. package/eds-components-section.entry.esm.js +14 -2
  16. package/eds-docs-palettes.entry.esm.js +1 -1
  17. package/eds-docs-tokens.entry.esm.js +1 -1
  18. package/eds-dropdown_2.entry.esm.js +235 -0
  19. package/eds-form.entry.esm.js +59 -23
  20. package/eds-frame.entry.esm.js +4 -4
  21. package/eds-icon-arrow-diagonal.entry.esm.js +1 -1
  22. package/eds-icon-arrow-right.entry.esm.js +1 -1
  23. package/eds-icon-bluesky.entry.esm.js +1 -1
  24. package/eds-icon-chevron-down.entry.esm.js +1 -1
  25. package/eds-icon-chevron-left.entry.esm.js +1 -1
  26. package/eds-icon-chevron-right.entry.esm.js +1 -1
  27. package/eds-icon-chevron-up.entry.esm.js +1 -1
  28. package/eds-icon-close.entry.esm.js +1 -1
  29. package/eds-icon-copy.entry.esm.js +1 -1
  30. package/eds-icon-eu.entry.esm.js +1 -1
  31. package/eds-icon-facebook.entry.esm.js +1 -1
  32. package/eds-icon-gitlab.entry.esm.js +1 -1
  33. package/eds-icon-linkedin.entry.esm.js +1 -1
  34. package/eds-icon-loader.entry.esm.js +1 -1
  35. package/eds-icon-mastodon.entry.esm.js +1 -1
  36. package/eds-icon-menu.entry.esm.js +1 -1
  37. package/eds-icon-more.entry.esm.js +1 -1
  38. package/eds-icon-search.entry.esm.js +1 -1
  39. package/eds-icon-success.entry.esm.js +1 -1
  40. package/eds-icon-twitter.entry.esm.js +1 -1
  41. package/eds-icon-user.entry.esm.js +1 -1
  42. package/eds-icon-youtube.entry.esm.js +1 -1
  43. package/eds-input_7.entry.esm.js +39 -28
  44. package/eds-login.entry.esm.js +66 -45
  45. package/eds-logo-variations.entry.esm.js +1 -1
  46. package/eds-matomo-notice.entry.esm.js +1 -2
  47. package/eds-modal.entry.esm.js +57 -42
  48. package/eds-navigator.entry.esm.js +5 -5
  49. package/eds-pagination_2.entry.esm.js +35 -19
  50. package/eds-progress-bar.entry.esm.js +7 -2
  51. package/eds-section-core_2.entry.esm.js +5 -5
  52. package/eds-svg-repository.entry.esm.js +1 -1
  53. package/eds-tab.entry.esm.js +1 -1
  54. package/eds-tabs-content.entry.esm.js +5 -5
  55. package/eds-tabs.entry.esm.js +4 -4
  56. package/eds-timeline.entry.esm.js +6 -5
  57. package/eds-tooltip.entry.esm.js +12 -3
  58. package/eds-trl.entry.esm.js +9 -10
  59. package/eds-user.entry.esm.js +118 -0
  60. package/eds-vertical-stepper.entry.esm.js +81 -0
  61. package/incorrect-use-of-colors.entry.esm.js +7 -7
  62. package/index.esm.js +1 -1
  63. package/index.esm2.js +18 -13
  64. package/{keycloak-13893af6.esm.js → keycloak-d502ec16.esm.js} +219 -168
  65. package/logo-space.entry.esm.js +4 -4
  66. package/logo-variations-horizontal_2.entry.esm.js +26 -26
  67. package/logo-wrong-usage.entry.esm.js +37 -37
  68. package/package.json +1 -1
  69. package/src/components.d.ts +3 -1
  70. package/token-list_3.entry.esm.js +5 -5
  71. package/token-ratios.entry.esm.js +3 -3
  72. package/token-spacing.entry.esm.js +26 -26
  73. package/token-typography.entry.esm.js +2 -2
  74. package/color-0ba8ed56.esm.js +0 -423
  75. package/eds-alert.entry.esm.js +0 -102
  76. package/eds-avatar_17.entry.esm.js +0 -209
  77. package/eds-rating.entry.esm.js +0 -71
@@ -11,7 +11,7 @@ const EdsIconYoutube = class {
11
11
  }
12
12
  render() {
13
13
  return h("span", {
14
- key: 'ecd12a21c5797f93f7d8abe67803b27862967b2f',
14
+ key: '4eba69bfec926b7a3490feee15b5947a8ab8a7b9',
15
15
  class: this.class,
16
16
  innerHTML: youtube
17
17
  });
@@ -52,7 +52,7 @@ const EdsInput = class {
52
52
  const withIcon = !!this.icon;
53
53
  const describedBy = this.hasMessage || this.error ? `${this.name}-error` : '';
54
54
  return h("div", {
55
- key: 'aed6c5b0bc70ed712c74041b1bafce771c0da2d3',
55
+ key: 'e67c7566fe5a1574d6ff0fff61178b163c5881f9',
56
56
  class: "relative flex items-center"
57
57
  }, this.type === 'textarea' ? h("textarea", {
58
58
  id: this.inputId || this.name,
@@ -102,10 +102,10 @@ const EdsInput = class {
102
102
  onInput: this.handleInput,
103
103
  onChange: this.handleInput
104
104
  }), this.maxLength && this.type === 'textarea' && h("span", {
105
- key: '2a95bcd05820c60e428c9e5de3cc2c3fc6ceb3db',
105
+ key: '35bc563715e65073898259d12b4ef2c467b14439',
106
106
  class: `input-counter f-ui-05 absolute bottom-8 right-8 ${this.maxLengthReached ? 'input-counter-error' : ''}`
107
107
  }, this.maxLength), this.icon && h("eds-icon-wrapper", {
108
- key: 'd20b1b17f45c77e1e7ad63ca5cb12db777074601',
108
+ key: '54cab667a1b8b1bb906c2359cdbd2fb23171ba8b',
109
109
  class: `absolute top-1/2 left-[4px] -translate-y-1/2 ${this.disabled ? 'text-lightest' : 'text-lightest'}`,
110
110
  icon: this.icon
111
111
  }));
@@ -174,7 +174,7 @@ const EdsInputField = class {
174
174
  checked: this.checked
175
175
  };
176
176
  return h("div", {
177
- key: 'e1e4c68a8ca48b9526217b1c1eeaecbf3c73a652',
177
+ key: '6c2e228bc3940212ad4df6ed99bdd69b99342afb',
178
178
  class: "space-y-8"
179
179
  }, this.type === 'checkbox' || this.type === 'radio' ? this.parsedOptions.length > 0 ? h("fieldset", {
180
180
  class: "space-y-4 mt-8"
@@ -185,6 +185,7 @@ const EdsInputField = class {
185
185
  label: this.label,
186
186
  required: this.required
187
187
  }), this.hint && h("p", {
188
+ id: `${this.name}-hint`,
188
189
  class: "f-ui-05 text-lighter mt-8 ml-8"
189
190
  }, this.hint)), this.parsedOptions.map(option => h("div", {
190
191
  class: "flex items-center gap-x-2",
@@ -209,6 +210,7 @@ const EdsInputField = class {
209
210
  disabled: this.disabled,
210
211
  required: this.required
211
212
  }), this.hint && h("p", {
213
+ id: `${this.name}-hint`,
212
214
  class: "f-ui-05 text-lighter mt-8 ml-8"
213
215
  }, this.hint)), this.type === 'select' ? h("eds-input-select", Object.assign({}, inputOpts, {
214
216
  options: this.parsedOptions
@@ -231,7 +233,8 @@ const EdsInputField = class {
231
233
  name: "range-slider"
232
234
  });
233
235
  })() : h("eds-input", Object.assign({}, inputOpts))), h("eds-input-footer", {
234
- key: '7c283d5b193f179cdefbb011862358e3c92685c5',
236
+ key: '16f2dd9061fc779b081c973e25d1bf9fb26fcf8b',
237
+ id: `${this.name}-footer`,
235
238
  name: this.name,
236
239
  message: this.message,
237
240
  "error-message": this.errorMessage,
@@ -252,26 +255,26 @@ const EdsInputFooter = class {
252
255
  }
253
256
  render() {
254
257
  return h("div", {
255
- key: '9ce8da179446c0302754f1285b3733d928da042f',
258
+ key: 'c088f6c9bf4c3ca1efce1a1ff41ece8d4f8a6756',
256
259
  class: "space-y-4"
257
260
  }, this.error && this.errorMessage && h("div", {
258
- key: 'aab7e8ded78e48864b2245603c3987a6ec3f3959',
261
+ key: '7404a329f2b5da7f9444f986178c5e4dbbe838ad',
259
262
  id: `error_${this.name}`,
260
263
  class: "text-error flex items-center"
261
264
  }, h("eds-icon-wrapper", {
262
- key: '152a06328c6cbb40f0d52310ac3ce761de21a26c',
265
+ key: '8f9d83b1d8dda824cac17d9c2ce3cb6cc5a58945',
263
266
  icon: "warning"
264
267
  }), h("p", {
265
- key: '658825aa4649ad83a150a0dc92d37f1b078de4c3',
268
+ key: 'f223076bc18088e264b4888d18bb9673f803d875',
266
269
  class: "f-ui-04 ml-4",
267
270
  innerHTML: this.errorMessage
268
271
  })), this.message && h("p", {
269
- key: '378ae9ef876e087f66302547958af4543262a441',
272
+ key: '40bdbc35ba4985802177d7f9b2c44f893e4cb40c',
270
273
  id: `desc_${this.name}`,
271
274
  class: "f-ui-05 text-lighter",
272
275
  innerHTML: this.message
273
276
  }), this.link && h("a", {
274
- key: 'cd396f03bdbd12a47544a44de17cfce35b8d206a',
277
+ key: 'e6297a49f63ce2ab14bac8df0186fb42fab4416d',
275
278
  href: this.link.url,
276
279
  class: "f-ui-05 effect-color hover:text-lighter underline underline-offset-4"
277
280
  }, this.link.label));
@@ -287,16 +290,16 @@ const EdsInputLabel = class {
287
290
  }
288
291
  render() {
289
292
  return h("label", {
290
- key: 'd83f8267317c2d5ef500460e938b166c0e6517b1',
293
+ key: '38be7206acfad300657a99218c3138e91069d710',
291
294
  htmlFor: this.name,
292
295
  class: `input-label ${this.disabled ? 'text-lighter' : ''}`
293
296
  }, this.label, this.required && h("span", {
294
- key: '85ad9e44af342c191d8aa7aeb7e4c6288c544d6d'
297
+ key: '1e80610f66d51a1c46918086bb5b5153c0e35a3c'
295
298
  }, h("span", {
296
- key: 'b350ee023f80bc9d5f24ef2fac9f74b2461d27b9',
299
+ key: '83d15d62c0539f1847746b4a2b9c9971b4852da8',
297
300
  "aria-hidden": "true"
298
301
  }, "*"), h("span", {
299
- key: 'af55a83d8998ac70817cb2f7cebfb74f276a6387',
302
+ key: '3f45f5a436c41cf7e55570a2abe8844c8daa7525',
300
303
  class: "sr-only"
301
304
  }, "required")));
302
305
  }
@@ -327,10 +330,10 @@ const EdsInputRange = class {
327
330
  }
328
331
  render() {
329
332
  return h("div", {
330
- key: '8927f714cae6dd2237202190eade7b31cc7adc03',
333
+ key: '6a70b857cfbeb152e6f099b6dfc91cc9fec5bf11',
331
334
  class: "relative flex flex-col items-start space-y-2"
332
335
  }, h("input", {
333
- key: '1b3ba13453992c84e00d3b3261a9d2008f45634f',
336
+ key: 'da4c0158b1d33804404f4373b3c55c53b5b2f53b',
334
337
  id: this.inputId || this.name,
335
338
  name: this.name,
336
339
  min: this.min,
@@ -344,7 +347,7 @@ const EdsInputRange = class {
344
347
  //aria-describedby={describedBy}
345
348
  onInput: this.onInput
346
349
  }), h("p", {
347
- key: 'e04c275e51710ae09eec1603911446e1e65bf648',
350
+ key: '66bc2e755e4eb38015e32441599a9f9bade7c679',
348
351
  id: `desc_${this.name}`,
349
352
  class: "block f-ui-05 text-lighter"
350
353
  }, "Current value: ", this.sliderVal));
@@ -381,14 +384,14 @@ const EdsInputSearch = class {
381
384
  }
382
385
  render() {
383
386
  return h("div", {
384
- key: '4a6a629fcaefa3ec3bbfb577e1a1f85e8d4f0ee0',
387
+ key: 'df7ee546beed6eedfba5a19e0fdf349d9aaece90',
385
388
  class: "relative flex items-center"
386
389
  }, h("eds-icon-wrapper", {
387
- key: '7cb203fabdf6f1160d95d7ca125f0ca33affd1c6',
390
+ key: '4663fdd0a9ba4eace47dc90f9c7f50fc2e6f7925',
388
391
  icon: "search",
389
392
  class: "absolute top-1/2 left-[4px] -translate-y-1/2 text-lightest"
390
393
  }), h("input", {
391
- key: 'fe32c40b6e438526b8ef6a74783a6455fb91a467',
394
+ key: 'e3e72f3dea068cbab3d398de36dd09e4a7f1ce93',
392
395
  id: this.inputId || this.name,
393
396
  name: this.name,
394
397
  placeholder: this.placeholder,
@@ -435,6 +438,7 @@ const EdsInputSelect = class {
435
438
  this.loading = false;
436
439
  this.dynamicValueKey = 'value';
437
440
  this.dynamicLabelKey = 'label';
441
+ this.hasFetched = false;
438
442
  }
439
443
  componentWillLoad() {
440
444
  this.loadOptions();
@@ -451,6 +455,9 @@ const EdsInputSelect = class {
451
455
  async loadOptions() {
452
456
  // If the first option contains an "endpoint" key, assume dynamic fetch mode.
453
457
  if (this.options && this.options.length > 0 && this.options[0].endpoint) {
458
+ if (this.hasFetched) {
459
+ return;
460
+ }
454
461
  const config = this.options[0];
455
462
  const endpoint = config.endpoint;
456
463
  this.dynamicValueKey = config.value || 'value';
@@ -464,6 +471,7 @@ const EdsInputSelect = class {
464
471
  const data = await response.json();
465
472
  // Assume the API returns an array of objects.
466
473
  this.dynamicOptions = data;
474
+ this.hasFetched = true;
467
475
  } catch (error) {
468
476
  //console.error('Error fetching dynamic options:', error);
469
477
  toast.show(`<eds-input-select> Error fetching dynamic options ${error}`, 'error');
@@ -477,12 +485,15 @@ const EdsInputSelect = class {
477
485
  this.dynamicLabelKey = this.labelKey;
478
486
  }
479
487
  }
488
+ getValueByPath(obj, path) {
489
+ return path.split('.').reduce((acc, part) => acc && acc[part], obj);
490
+ }
480
491
  render() {
481
492
  return h("div", {
482
- key: '0b45eaae992171cd9795f7bf01883b0f3efbcc13',
493
+ key: 'c1469a270fa5e775ac4d17f1c7e259d02477d7a2',
483
494
  class: "relative"
484
495
  }, h("select", {
485
- key: '0ee8bccb24f7bd65e9347c0b79905154db39dca7',
496
+ key: '3aab6ec60d386e51ce27c1cfc26059132d96957f',
486
497
  id: this.inputId || this.name,
487
498
  name: this.name,
488
499
  class: `input invalid:text-lightest pr-32 ${this.error ? 'input-error' : ''}`,
@@ -492,18 +503,18 @@ const EdsInputSelect = class {
492
503
  required: this.required,
493
504
  onChange: this.handleChange
494
505
  }, h("option", {
495
- key: 'b1b53dcf8dd3155e8dba28327f05b4725a013435',
506
+ key: 'ee3aa20ed1b99bddd7bafa3aac43f3c06db07b8f',
496
507
  value: "",
497
508
  disabled: true,
498
509
  hidden: true
499
510
  }, this.loading ? 'Loading options...' : `Please select ${this.name}`), this.dynamicOptions.map((option, index) => h("option", {
500
511
  key: index,
501
- value: option[this.dynamicValueKey]
502
- }, option[this.dynamicLabelKey]))), h("span", {
503
- key: '3f652e7ed7570b602565af3f0e3c5c91506e4089',
512
+ value: this.getValueByPath(option, this.dynamicValueKey)
513
+ }, this.getValueByPath(option, this.dynamicLabelKey)))), h("span", {
514
+ key: '7e70051ac49efd053f00521b51ad19e88cf5cdb7',
504
515
  class: `bg-dark rounded-xs absolute top-1/2 right-[6px] flex h-28 w-28 -translate-y-1/2 items-center justify-center ${this.disabled || this.loading ? 'text-lightest bg-transparent' : ''}`
505
516
  }, h("eds-icon-wrapper", {
506
- key: '2237727060af6286c346f749d2e8e3f7f86c7c70',
517
+ key: '2ef2d0d744216a1f931ac0bfe1058f54c9af4402',
507
518
  class: "w-20 h-20",
508
519
  icon: "chevron-right"
509
520
  })));
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index.esm2.js';
2
- import { a as logout, i as initKeycloak, b as isAuthenticated, g as getUser, l as login } from './keycloak-13893af6.esm.js';
2
+ import { l as login, a as logout, i as initKeycloak, b as isAuthenticated, g as getUser } from './keycloak-d502ec16.esm.js';
3
+ import { t as toast } from './toastManager-d9eee791.esm.js';
3
4
  import 'react';
4
5
  import 'react/jsx-runtime';
5
6
  import 'react-dom';
@@ -8,68 +9,88 @@ const EdsLogin = class {
8
9
  constructor(hostRef) {
9
10
  registerInstance(this, hostRef);
10
11
  this.authStatusChanged = createEvent(this, "authStatusChanged", 7);
11
- // Method to handle user logout
12
- this.handleLogout = () => {
13
- logout();
14
- this.authenticated = false; // Reset authentication state after logout
12
+ /**
13
+ * Handles user login by invoking the Keycloak `login` function.
14
+ * Only triggers login if the user is not already authenticated.
15
+ */
16
+ this.handleLogin = async () => {
17
+ if (!this.authenticated) {
18
+ try {
19
+ await login();
20
+ toast.show('You are authenticated', 'success');
21
+ } catch (error) {
22
+ toast.show(error.message, 'error');
23
+ }
24
+ }
25
+ };
26
+ /**
27
+ * Handles user logout by invoking the Keycloak `logout` function.
28
+ * Resets the `authenticated` state to `false` after logout.
29
+ */
30
+ this.handleLogout = async () => {
31
+ try {
32
+ await logout();
33
+ } catch (error) {
34
+ toast.show(error.message, 'error');
35
+ }
36
+ this.authenticated = false;
37
+ this.user = null;
15
38
  };
16
- this.keycloakUrl = '';
17
- this.keycloakRealm = '';
18
- this.keycloakClientId = '';
39
+ this.keycloakUrl = undefined;
40
+ this.keycloakRealm = undefined;
41
+ this.keycloakClientId = undefined;
19
42
  this.authenticated = false;
20
43
  this.user = null;
21
44
  }
22
- // Lifecycle method to check authentication status before the component loads
45
+ /**
46
+ * Lifecycle method that runs when the component is about to load.
47
+ * It initializes authentication by calling the `initAuth` method.
48
+ */
23
49
  async componentWillLoad() {
24
- await this.checkAuthentication();
50
+ // Check if required props are provided (optional check)
51
+ if (!this.keycloakUrl || !this.keycloakRealm || !this.keycloakClientId) {
52
+ // eslint-disable-next-line
53
+ console.error('Keycloak configuration props are missing.');
54
+ return;
55
+ }
56
+ await this.initAuth();
25
57
  }
26
- // Method to initialize Keycloak and check if the user is authenticated
27
- async checkAuthentication() {
58
+ /**
59
+ * Initializes the Keycloak authentication by configuring Keycloak with the provided props.
60
+ * Sets the `authenticated` state and `user` data if the user is authenticated.
61
+ * Emits `authStatusChanged` event with the authentication status.
62
+ */
63
+ async initAuth() {
28
64
  try {
29
- const keycloakConfig = {
65
+ await initKeycloak({
30
66
  url: this.keycloakUrl,
31
67
  realm: this.keycloakRealm,
32
68
  clientId: this.keycloakClientId
33
- };
34
- await initKeycloak(keycloakConfig);
35
- // eslint-disable-next-line
36
- // Set authentication state and fetch user data if authenticated
37
- this.authenticated = isAuthenticated();
38
- if (this.authenticated) {
69
+ }, true);
70
+ if (isAuthenticated()) {
39
71
  this.user = getUser();
40
- }
41
- this.authStatusChanged.emit({
42
- authenticated: this.authenticated,
43
- user: this.user
44
- }); // Emit auth status change
45
- } catch (error) {
46
- // eslint-disable-next-line
47
- console.error('Keycloak initialization or login check failed:', error);
48
- }
49
- }
50
- // Method to handle user login
51
- async handleLogin() {
52
- try {
53
- if (!this.authenticated) {
54
- login(); // Start the Keycloak login process
72
+ this.authenticated = true;
73
+ this.authStatusChanged.emit({
74
+ authenticated: this.authenticated,
75
+ user: this.user
76
+ }); // Emit auth status change
55
77
  }
56
78
  } catch (error) {
57
- // eslint-disable-next-line
58
- console.error('Login failed:', error);
79
+ toast.show(error.message, 'error');
59
80
  }
60
81
  }
61
- getBtnLabel() {
62
- return this.authenticated ? 'Logout' : 'Login';
63
- }
64
82
  render() {
65
- return h("eds-button", {
66
- key: '35f298ecf951d5b1087f988262ae7d312c5e2d38',
67
- label: this.getBtnLabel(),
83
+ return h("div", {
84
+ key: 'cd30a135920ae77959330a43a8544bb9c231986e',
85
+ class: "block"
86
+ }, !this.authenticated && h("eds-button", {
87
+ key: '98fa63c46b063a67c215ff9160c6dfbfee2265f7',
88
+ label: "Login",
68
89
  intent: "primary",
69
90
  "extra-class": "text-default",
70
- "aria-label": this.getBtnLabel(),
71
- triggerClick: this.authenticated ? this.handleLogout : this.handleLogin.bind(this)
72
- });
91
+ "aria-label": "Login",
92
+ triggerClick: this.handleLogin.bind(this)
93
+ }));
73
94
  }
74
95
  };
75
96
 
@@ -20,7 +20,7 @@ const EdsLogoVariations = class {
20
20
  }
21
21
  render() {
22
22
  return h("div", {
23
- key: '9d6ce0e75030d6e636aab423181b0ce999f6f1b0',
23
+ key: '0494cbb3e7b4902e91a0c78c691bc3405b9f11cc',
24
24
  class: "container"
25
25
  }, this.renderContent());
26
26
  }
@@ -1,10 +1,9 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index.esm2.js';
2
2
  import { t as toast } from './toastManager-d9eee791.esm.js';
3
- import { m as matomoOptIn } from './color-0ba8ed56.esm.js';
3
+ import { m as matomoOptIn } from './analytics-1cde8e4a.esm.js';
4
4
  import 'react';
5
5
  import 'react/jsx-runtime';
6
6
  import 'react-dom';
7
- import './index-39c58238.esm.js';
8
7
 
9
8
  const edsMatomoNoticeCss = ".fixed{position:fixed}.absolute{position:absolute}.w-full{width:100%}.bottom-0{bottom:0rem}.bottom-4{bottom:0.25rem}.p-4{padding:0.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.z-10{z-index:10}.left-0{left:0rem}.left-1\\/2{left:50%}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.flex{display:flex}.gap-12{gap:0.75rem}.gap-20{gap:1.25rem}.gap-4{gap:0.25rem}@media (min-width: 750px){.md\\:left-1\\/2{left:50%}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}}";
10
9
  const EdsMatomoNoticeStyle0 = edsMatomoNoticeCss;
@@ -1,9 +1,10 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index.esm2.js';
2
+ import { s as sendAnalytics } from './analytics-1cde8e4a.esm.js';
2
3
  import 'react';
3
4
  import 'react/jsx-runtime';
4
5
  import 'react-dom';
5
6
 
6
- const edsModalCss = ".block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.fixed{position:fixed}.inset-0{inset:0rem}.z-10{z-index:10}.z-50{z-index:50}.max-w-full{max-width:100%}.absolute{position:absolute}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-20{padding-top:1.25rem;padding-bottom:1.25rem}.bg-inverse{background-color:var(--white)}.bg-dark{background-color:var(--grey-300)}.rounded-lg{border-radius:16px}.shadow-lg{--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.left-1\\/2{left:50%}.top-1\\/2{top:50%}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.border-b-2{border-bottom-width:2px}.border-softer{border-color:rgba(0, 0, 0, .1)}.pb-8{padding-bottom:0.5rem}.f-heading-03{font-family:var(--f-heading-03-fontFamily);font-weight:var(--f-heading-03-fontWeight);font-size:var(--f-heading-03-fontSize);line-height:var(--f-heading-03-lineHeight);letter-spacing:var(--f-heading-03-letterSpacing)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-heading-05{font-family:var(--f-heading-05-fontFamily);font-weight:var(--f-heading-05-fontWeight);font-size:var(--f-heading-05-fontSize);line-height:var(--f-heading-05-lineHeight);letter-spacing:var(--f-heading-05-letterSpacing)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.ml-8{margin-left:0.5rem}.pt-8{padding-top:0.5rem}.bg-opacity-90{opacity:0.9}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4}";
7
+ const edsModalCss = ".block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.fixed{position:fixed}.inset-0{inset:0rem}.z-10{z-index:10}.z-50{z-index:50}.max-w-full{max-width:100%}.absolute{position:absolute}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-20{padding-top:1.25rem;padding-bottom:1.25rem}.bg-inverse{background-color:var(--white)}.bg-dark{background-color:var(--grey-300)}.rounded-lg{border-radius:16px}.shadow-lg{--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.left-1\\/2{left:50%}.left-20{left:1.25rem}.right-20{right:1.25rem}.top-1\\/2{top:50%}.top-20{top:1.25rem}.bottom-20{bottom:1.25rem}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.border-b-2{border-bottom-width:2px}.border-softer{border-color:rgba(0, 0, 0, .1)}.pb-8{padding-bottom:0.5rem}.f-heading-03{font-family:var(--f-heading-03-fontFamily);font-weight:var(--f-heading-03-fontWeight);font-size:var(--f-heading-03-fontSize);line-height:var(--f-heading-03-lineHeight);letter-spacing:var(--f-heading-03-letterSpacing)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-heading-05{font-family:var(--f-heading-05-fontFamily);font-weight:var(--f-heading-05-fontWeight);font-size:var(--f-heading-05-fontSize);line-height:var(--f-heading-05-lineHeight);letter-spacing:var(--f-heading-05-letterSpacing)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.ml-8{margin-left:0.5rem}.pt-8{padding-top:0.5rem}.bg-opacity-90{opacity:0.9}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4}";
7
8
  const EdsModalStyle0 = edsModalCss;
8
9
  const EdsModal = class {
9
10
  constructor(hostRef) {
@@ -12,33 +13,59 @@ const EdsModal = class {
12
13
  this.title = '';
13
14
  this.truncate = true;
14
15
  this.truncateLines = '1';
16
+ this.position = 'middle';
15
17
  }
16
18
  getTruncateClass() {
17
19
  return this.truncate && this.truncateLines ? `line-clamp-${this.truncateLines}` : '';
18
20
  }
21
+ /**
22
+ * Returns the Tailwind CSS classes to position the modal based on the `position` prop.
23
+ *
24
+ * @private
25
+ * @returns {string} The concatenated CSS classes for modal positioning.
26
+ */
27
+ getModalPositionClasses() {
28
+ switch (this.position) {
29
+ case 'top':
30
+ return 'left-1/2 top-20 -translate-x-1/2';
31
+ case 'bottom':
32
+ return 'left-1/2 bottom-20 -translate-x-1/2';
33
+ case 'left':
34
+ return 'left-20 top-1/2 -translate-y-1/2';
35
+ case 'right':
36
+ return 'right-20 top-1/2 -translate-y-1/2';
37
+ case 'middle':
38
+ default:
39
+ return 'left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2';
40
+ }
41
+ }
19
42
  /**
20
43
  * Opens the modal.
21
44
  */
22
45
  async open() {
46
+ var _a;
23
47
  this.isOpen = true;
24
- /*sendAnalytics({
48
+ sendAnalytics({
25
49
  category: 'ui-component',
50
+ parentContext: null,
26
51
  tag: this.el.tagName.toLowerCase(),
27
- name: this.title,
28
- action: 'show'
29
- });*/
52
+ name: ((_a = this.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
53
+ action: 'opened'
54
+ });
30
55
  }
31
56
  /**
32
57
  * Closes the modal.
33
58
  */
34
59
  async close() {
60
+ var _a;
35
61
  this.isOpen = false;
36
- /*sendAnalytics({
62
+ sendAnalytics({
37
63
  category: 'ui-component',
64
+ parentContext: null,
38
65
  tag: this.el.tagName.toLowerCase(),
39
- name: this.title,
40
- action: 'hide'
41
- });*/
66
+ name: ((_a = this.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
67
+ action: 'closed'
68
+ });
42
69
  }
43
70
  /**
44
71
  * Toggles the modal open or closed.
@@ -47,62 +74,50 @@ const EdsModal = class {
47
74
  this.isOpen = !this.isOpen;
48
75
  }
49
76
  /**
50
- * Lifecycle method that runs when the component has fully loaded.
51
- * It emits a custom event for each `eds-button` element contained within the breadcrumb.
77
+ * Closes the modal when the Escape key is pressed.
52
78
  */
53
- componentDidLoad() {
54
- // Emit context for each eds-link element after the component is fully loaded
55
- const btns = this.el.shadowRoot.querySelectorAll('eds-button');
56
- btns.forEach(btn => {
57
- this.emitContext(btn);
58
- });
59
- }
60
- /**
61
- * Emits a custom event called `parentContext` for a given button element.
62
- * This event provides context information about the eds-modal component.
63
- *
64
- * @param btnElement - The link element to which the event will be dispatched.
65
- */
66
- emitContext(btnElement) {
67
- const event = new CustomEvent('parentContext', {
68
- detail: {
69
- componentName: this.el.tagName.toLowerCase(),
70
- identifier: null
71
- }
72
- });
73
- btnElement.dispatchEvent(event);
79
+ handleKeyDown(event) {
80
+ if (this.isOpen && event.key === 'Escape') {
81
+ this.close();
82
+ }
74
83
  }
75
84
  render() {
85
+ // Generate a unique id for the title so we can reference it for aria-labelledby.
86
+ const titleId = `modal-title-${this.el.tagName.toLowerCase()}`;
76
87
  return h("div", {
77
- key: '00816ecb900bd9b68b31fdf6e48bef0223f9e10a',
78
- class: `${this.isOpen ? 'block' : 'hidden'} fixed inset-0 z-50 flex`
88
+ key: 'cd976fb0cd0c0663279dcd4dbd5823e26b6c32f7',
89
+ class: `${this.isOpen ? 'block' : 'hidden'} fixed inset-0 z-50 flex`,
90
+ role: "dialog",
91
+ "aria-modal": "true",
92
+ "aria-labelledby": titleId
79
93
  }, this.isOpen && h("div", {
80
- key: '570fa8625f9ad4b1ea82633f11e2b289ab01b853',
94
+ key: '40a2febed5d0ec15d5370183c97cfd05abd72007',
81
95
  class: "fixed inset-0 bg-dark bg-opacity-90" // Add backdrop-blur utility class here
82
96
  ,
83
97
 
84
98
  onClick: () => this.close()
85
99
  }), h("div", {
86
- key: 'ff658c763e3fbc98123f13483076399966b10515',
87
- class: "max-w-full absolute px-20 py-20 bg-inverse rounded-lg shadow-lg z-10 left-1/2 top-1/2 grow -translate-x-1/2 -translate-y-1/2 justify-center "
100
+ key: '50f2c23d80a2007aca4d0a8911816141e43b71ee',
101
+ class: `max-w-full absolute px-20 py-20 bg-inverse rounded-lg shadow-lg z-10 ${this.getModalPositionClasses()} grow justify-center`
88
102
  }, h("div", {
89
- key: 'd8b72acd90cc59ab1f82384aee4e311319f75aa9',
103
+ key: 'e1cba5879bc488a99b896c48c8a780336b2195e7',
90
104
  class: "flex justify-between items-center border-b-2 border-softer pb-8"
91
105
  }, h("span", {
92
- key: 'ee61fc505c5a3eb93541d3762d37f28a5a788bae',
106
+ key: '8f018e3d2890346d23e7dcb115676051048bcacb',
107
+ id: titleId,
93
108
  class: `f-heading-04 text-lighter ${this.getTruncateClass()}`
94
109
  }, this.title), h("eds-button", {
95
- key: '3832772417d05a162eb5f2c4d0733f0ee845ed1c',
110
+ key: '4ae4013dd45573648817ac95ee4370ed615aa6a0',
96
111
  intent: "tertiary",
97
112
  icon: "close",
98
113
  "aria-label": "Close modal",
99
114
  onClick: () => this.close(),
100
115
  "extra-class": "ml-8"
101
116
  })), h("div", {
102
- key: 'f71b38be8284a37d0d198df0a9858c64202b3d91',
117
+ key: 'ac4e3d8f273d04ad02e0123c23b36b89bfc89db2',
103
118
  class: "pt-8"
104
119
  }, h("slot", {
105
- key: '1f80948334e5b4e9fc00a3bf01c6fc402d8220c3'
120
+ key: '60917e9f750bfd7948e580acc817cffe6424608a'
106
121
  }))));
107
122
  }
108
123
  get el() {
@@ -35,10 +35,10 @@ const EdsNavigator = class {
35
35
  }
36
36
  render() {
37
37
  return h("ul", {
38
- key: '1ab60197bbc9ee86d77134138744dce39df2aaa7',
38
+ key: '712287e683436cc98c2d6ef195501add1929522e',
39
39
  class: "flex lg:flex grow items-center justify-center gap-x-8"
40
40
  }, this.prevLabel && h("eds-link", {
41
- key: 'b29fd121d33c1e919d24a5d460d8d6864f1ff9db',
41
+ key: '4fda36ce37897284d7062f88133f147831d96a6f',
42
42
  label: this.prevLabel,
43
43
  url: this.prevUrl || undefined,
44
44
  disabled: !this.prevUrl,
@@ -47,10 +47,10 @@ const EdsNavigator = class {
47
47
  intent: this.linkIntent,
48
48
  class: "mr-auto !p-8 lg:!pr-12"
49
49
  }, h("eds-icon-wrapper", {
50
- key: '64620ccfaf2e006a6414bcd7e874a352b9d2d56b',
50
+ key: '9bfa6bbbdc68641f65bec49f207d96f075b9a5b0',
51
51
  icon: "chevron-left"
52
52
  }), this.prevLabel), this.nextLabel && h("eds-link", {
53
- key: 'ae6425f0f01c8f5bcbdae27d9bea9dc3a5b09d3b',
53
+ key: '6ee8ebee011a2c30a74645b072c7c37929d0a55f',
54
54
  label: this.nextLabel,
55
55
  url: this.nextUrl || undefined,
56
56
  disabled: !this.nextUrl,
@@ -59,7 +59,7 @@ const EdsNavigator = class {
59
59
  intent: this.linkIntent,
60
60
  class: "ml-auto !p-8 lg:!pl-12"
61
61
  }, this.nextLabel, h("eds-icon-wrapper", {
62
- key: 'd286fc26f17ee6cf6828990e98df7865fbbfd352',
62
+ key: '44ebd4dcce0e367df7d9035bb445e49fde35e913',
63
63
  icon: "chevron-right",
64
64
  class: "w-20 h-20"
65
65
  })));