@ebrains/react 1.3.0 → 2.0.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 (78) hide show
  1. package/bin-37cad2f0.esm.js +3 -0
  2. package/color-primary-palette_6.entry.esm.js +106 -106
  3. package/components-section.entry.esm.js +1 -1
  4. package/correct-use-of-colors.entry.esm.js +33 -33
  5. package/docs-palettes.entry.esm.js +1 -1
  6. package/docs-tokens.entry.esm.js +1 -1
  7. package/draft-dd5dada2.esm.js +3 -0
  8. package/edit-1dc8d11b.esm.js +3 -0
  9. package/eds-accordion.entry.esm.js +11 -10
  10. package/eds-app-root.entry.esm.js +4 -4
  11. package/{eds-avatar_28.entry.esm.js → eds-avatar_26.entry.esm.js} +475 -586
  12. package/eds-card-generic.entry.esm.js +4 -5
  13. package/eds-card-project.entry.esm.js +10 -11
  14. package/eds-cookies-preference.entry.esm.js +2 -2
  15. package/eds-feedback.entry.esm.js +5 -5
  16. package/eds-footer.entry.esm.js +129 -0
  17. package/eds-frame.entry.esm.js +4 -4
  18. package/eds-fullscreen-menu.entry.esm.js +124 -0
  19. package/eds-icon-bin.entry.esm.js +21 -0
  20. package/eds-icon-bluesky.entry.esm.js +1 -1
  21. package/eds-icon-bookmark.entry.esm.js +1 -1
  22. package/eds-icon-close.entry.esm.js +1 -1
  23. package/eds-icon-copy.entry.esm.js +1 -1
  24. package/eds-icon-draft.entry.esm.js +21 -0
  25. package/eds-icon-edit.entry.esm.js +21 -0
  26. package/eds-icon-eu.entry.esm.js +1 -1
  27. package/eds-icon-external.entry.esm.js +1 -1
  28. package/eds-icon-facebook.entry.esm.js +1 -1
  29. package/eds-icon-gitlab.entry.esm.js +1 -1
  30. package/eds-icon-linkedin.entry.esm.js +1 -1
  31. package/eds-icon-loader.entry.esm.js +1 -1
  32. package/eds-icon-mastodon.entry.esm.js +1 -1
  33. package/eds-icon-menu.entry.esm.js +1 -1
  34. package/eds-icon-minus.entry.esm.js +1 -1
  35. package/eds-icon-more.entry.esm.js +1 -1
  36. package/eds-icon-paper.entry.esm.js +1 -1
  37. package/eds-icon-plus.entry.esm.js +1 -1
  38. package/eds-icon-portal.entry.esm.js +1 -1
  39. package/eds-icon-private.entry.esm.js +1 -1
  40. package/eds-icon-public.entry.esm.js +1 -1
  41. package/eds-icon-search.entry.esm.js +1 -1
  42. package/eds-icon-star.entry.esm.js +1 -1
  43. package/eds-icon-start.entry.esm.js +21 -0
  44. package/eds-icon-success.entry.esm.js +1 -1
  45. package/eds-icon-thumbs-down.entry.esm.js +1 -1
  46. package/eds-icon-thumbs-up.entry.esm.js +1 -1
  47. package/eds-icon-tutorial.entry.esm.js +1 -1
  48. package/eds-icon-twitter.entry.esm.js +1 -1
  49. package/eds-icon-unknown.entry.esm.js +1 -1
  50. package/eds-icon-updown.entry.esm.js +1 -1
  51. package/eds-icon-user.entry.esm.js +1 -1
  52. package/eds-icon-youtube.entry.esm.js +1 -1
  53. package/eds-modal.entry.esm.js +150 -0
  54. package/eds-progress-bar.entry.esm.js +4 -4
  55. package/eds-section-core_2.entry.esm.js +5 -5
  56. package/eds-social-networks.entry.esm.js +74 -0
  57. package/eds-spinner.entry.esm.js +51 -14
  58. package/eds-splash-screen.entry.esm.js +1 -4
  59. package/eds-switch.entry.esm.js +8 -6
  60. package/eds-timeline.entry.esm.js +4 -4
  61. package/eds-toast-manager.entry.esm.js +1 -1
  62. package/eds-tooltip.entry.esm.js +12 -6
  63. package/eds-trl.entry.esm.js +2 -2
  64. package/incorrect-use-of-colors.entry.esm.js +8 -8
  65. package/index.esm2.js +27 -9
  66. package/logo-space.entry.esm.js +9 -9
  67. package/logo-variations-horizontal_2.entry.esm.js +28 -28
  68. package/logo-variations-tabs.entry.esm.js +1 -1
  69. package/logo-wrong-usage.entry.esm.js +25 -25
  70. package/package.json +1 -1
  71. package/start-65126a4f.esm.js +3 -0
  72. package/svg-repository.entry.esm.js +11 -3
  73. package/token-list_3.entry.esm.js +5 -5
  74. package/token-ratios.entry.esm.js +3 -3
  75. package/token-spacing.entry.esm.js +26 -26
  76. package/token-typography.entry.esm.js +2 -2
  77. package/eds-rating.entry.esm.js +0 -79
  78. package/eds-toast.entry.esm.js +0 -93
@@ -37,6 +37,10 @@ import { p as privat } from './private-1c25ff8e.esm.js';
37
37
  import { p as pub } from './public-d4d8c585.esm.js';
38
38
  import { t as tutorial } from './tutotial-150ee1fd.esm.js';
39
39
  import { u as upDonw } from './up-and-down-d747abee.esm.js';
40
+ import { b as bin } from './bin-37cad2f0.esm.js';
41
+ import { s as start } from './start-65126a4f.esm.js';
42
+ import { d as draft } from './draft-dd5dada2.esm.js';
43
+ import { e as edit } from './edit-1dc8d11b.esm.js';
40
44
  import 'react';
41
45
  import 'react/jsx-runtime';
42
46
  import 'react-dom';
@@ -284,7 +288,11 @@ const svgs = /*#__PURE__*/Object.freeze({
284
288
  thumbsUp: thumbsUp,
285
289
  thumbsDown: thumbsDown,
286
290
  star: star,
287
- external: arrowExternal
291
+ external: arrowExternal,
292
+ bin: bin,
293
+ start: start,
294
+ draft: draft,
295
+ edit: edit
288
296
  });
289
297
  const svgRepositoryCss = ":host,.full-width{display:block;width:100%}";
290
298
  const SvgRepositoryStyle0 = svgRepositoryCss;
@@ -317,10 +325,10 @@ const SvgRepository = class {
317
325
  }
318
326
  };
319
327
  return h("div", {
320
- key: 'c8c6a714522ff3e122b58c4bb931af7f95d281fa',
328
+ key: '4f51504595167008271a6dce4d43c2988394fc8a',
321
329
  class: "full-width"
322
330
  }, h("eds-table", {
323
- key: 'f3251327f43c5b18f7677738f37b60ff0e604c3f',
331
+ key: '3cd08a72250aeb7f98fe1b68349bd7de6acb9079',
324
332
  "table-data": JSON.stringify(svgData),
325
333
  config: JSON.stringify(tableConfig),
326
334
  "rows-per-page": 10,
@@ -296,7 +296,7 @@ const TokenList = class {
296
296
  [this.show]: colors[this.show]
297
297
  } : colors;
298
298
  return h("section", {
299
- key: '0ba9dbb1b98cb398c2eb989391f6e978f9dc21ef',
299
+ key: '8fab4b610ad73943d9884c9b091f8ae0b85fec02',
300
300
  class: "w-full mt-28"
301
301
  }, Object.entries(sectionsToDisplay).map(([sectionName, sectionContent]) =>
302
302
  // Only render sections that exist in `colors`
@@ -317,10 +317,10 @@ const TokenRadii = class {
317
317
  }
318
318
  render() {
319
319
  return h("section", {
320
- key: '0b0ccb9adcfa77ea898828ddbb244e959f93e2e4',
320
+ key: '990ac7f9b888a50dfefb06d0999c845796e82db4',
321
321
  class: "w-full mt-28"
322
322
  }, h("ul", {
323
- key: '94f17ad36ec9fcc47b645e323c7e5a8f3e040dda',
323
+ key: '447642ed7c23039532564cf640994c1ac9a1d1de',
324
324
  class: "not-prose gap-y-8 md:gap-y-12 lg:gap-y-16"
325
325
  }, Object.entries(radii).map(([key, value]) => h("li", {
326
326
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
@@ -358,10 +358,10 @@ const TokenShadows = class {
358
358
  }
359
359
  render() {
360
360
  return h("section", {
361
- key: '18d2b4cdcc3b6d6ce8864a9c36e869be9b9e5cb4',
361
+ key: '481c1eed906cfd2ec0a071fde52bd284dc689583',
362
362
  class: "w-full mt-28"
363
363
  }, h("ul", {
364
- key: '63e646788009d3315d2f4e03f1a780811486d9a0',
364
+ key: 'bf3c4068320755df5df76fd40a5f533c2814e398',
365
365
  class: "not-prose gap-y-8 md:gap-y-12 lg:gap-y-16"
366
366
  }, Object.entries(shadowTokens).map(([category, tokens]) => Object.entries(tokens).map(([key, value]) => h("li", {
367
367
  class: "grid-col-span-12 md:grid-col-span-6 flex flex-col items-center mt-16"
@@ -17,15 +17,15 @@ const TokenRatios = class {
17
17
  }
18
18
  render() {
19
19
  return h("section", {
20
- key: '0fb029d34cba573e04e15030b3fdd1497ac9974e',
20
+ key: 'be577f9c398a29f5bd996a68d102017488f8ac17',
21
21
  class: "w-full"
22
22
  }, h("eds-section-core", {
23
- key: 'd6914b95ef74d590d58b0c90600fc44f5d9d6678',
23
+ key: '291b8f1692e0ba050c0871af65429db95733990c',
24
24
  tag: "div",
25
25
  "section-title": "Aspect Ratios",
26
26
  "heading-level": "h3"
27
27
  }, h("ul", {
28
- key: 'f08511f07380707795b810fd0f34c1acdc47d37d',
28
+ key: '2ac59025091444b8e14b5106d8909c54fa8227aa',
29
29
  class: "gap-y-8 md:gap-y-12 lg:gap-y-16"
30
30
  }, Object.entries(ratios).map(([key, value]) => h("li", {
31
31
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
@@ -9,82 +9,82 @@ const TokenSpacing = class {
9
9
  }
10
10
  render() {
11
11
  return h("div", {
12
- key: '144e643ff3f26d09b932b3bfa2086164134728c0',
12
+ key: 'ccc58496f0918a9da7f1d4412391613f3f568cc9',
13
13
  class: "w-full"
14
14
  }, h("ul", {
15
- key: 'fabddc807bcd5cefbfced6391117e9eb065ffff0',
15
+ key: 'e5a8d47319a9c994e7755d3576d71b634ab20063',
16
16
  class: "not-prose gap-y-8 md:gap-y-12 lg:gap-y-16"
17
17
  }, h("li", {
18
- key: 'cc0fba19927a1c3ad33008dc1087ee75e0c9fe2d',
18
+ key: '3d0a29e2c91d351ab116ce416e00c42590d035b3',
19
19
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
20
20
  }, h("div", {
21
- key: '328054d7cfe6a0678e9e592b91dba6a8524c2039',
21
+ key: 'd2d85017b45172a0b0b092de400d9151ef539ef8',
22
22
  class: "container p-8 item-center border-2 border-soft"
23
23
  }, h("div", {
24
- key: 'e50e3533e36feb7021cac8ac10cc9a05e7f24c0a',
24
+ key: '88de94aaba4d635cc525a67542b5d472cd896c5d',
25
25
  class: "spacing-sample m-16 bg-strong"
26
26
  }, h("span", {
27
- key: '87165037495881426a3c9848953e049ec7e96b7a',
27
+ key: 'b59a5fa9df2d4083fa06c9a258ec5ba5ccf60c0a',
28
28
  class: "f-body-01 text-inverse"
29
29
  }, "Margin: 1rem / m-16")))), h("li", {
30
- key: 'a6a98204655e53b6ef9ce9f2fd90b561c79c185d',
30
+ key: '70767120c9cd4be53f96f375fd329703a963b63a',
31
31
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
32
32
  }, h("div", {
33
- key: '385ae898ce1f1f96cbb236ded619a05d8326c304',
33
+ key: '855d6bacf1b1423485fbf4a6d57eaae41a7a1444',
34
34
  class: "container p-8 item-center border-2 border-soft"
35
35
  }, h("div", {
36
- key: '4e6c11ae90e22efa73fb6c9481ee2c1511365394',
36
+ key: '7857867bba76856db7530bacd73f142a2b503c51',
37
37
  class: "spacing-sample ml-64 bg-strong"
38
38
  }, h("span", {
39
- key: 'a13a1886b5019ca48a19d24ba03b3caa1c51bc3f',
39
+ key: '14b4241fc260b9d6b690dbd141098dc61a5eded9',
40
40
  class: "f-body-01 text-inverse"
41
41
  }, "Margin Left: 4rem / ml-64")))), h("li", {
42
- key: '7b2f325ced5281668e6ece98d56caf864b34c7e8',
42
+ key: 'fa5b994aab19f80b3fa26393844b0bed46ecfa64',
43
43
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
44
44
  }, h("div", {
45
- key: '3e1a69b9983bc993686426ec84dd70b4803538a6',
45
+ key: '3c600983badcd59dcf5735e9a4c42c87a306236b',
46
46
  class: "container p-8 item-center border-2 border-soft"
47
47
  }, h("div", {
48
- key: '66804ce21771e53210bc385ac8cefce4c554d188',
48
+ key: '77abcf6391bc3fe5f798a7837e12e9f3581213d0',
49
49
  class: "spacing-sample mt-32 bg-strong"
50
50
  }, h("span", {
51
- key: '91cee3a9cf00777f1d2b4cde4ce484fcddef52f5',
51
+ key: 'd4626346b81f99c4690853d00c097d523616db1f',
52
52
  class: "f-body-01 text-inverse"
53
53
  }, "Margin Top: 2rem / mt-32")))), h("li", {
54
- key: '9d9074db464e7ecc36977c69b0fdd053e8025dec',
54
+ key: '2ce80fc1b53afa0e157f4b185ae70f16779b9f3f',
55
55
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
56
56
  }, h("div", {
57
- key: 'e6a2d7d1ded9c92ca41d211dca3dcca9f03ad707',
57
+ key: '95f69eac2055d60ae42808fa09f4f6a68bdff4f6',
58
58
  class: "container p-8 item-center border-2 border-soft"
59
59
  }, h("div", {
60
- key: 'c87e88d711ec5298525f1d901958a035837b3db0',
60
+ key: 'e553f7c58b018cba77b7141be6142d3c7b34194a',
61
61
  class: "spacing-sample p-32 bg-strong"
62
62
  }, h("span", {
63
- key: '6276cb3c19a8fd1262c5002e682099f13d38b512',
63
+ key: '13450e5d8c07cbeb640e0b3aea1e526365f0f743',
64
64
  class: "f-body-01 text-inverse"
65
65
  }, "Padding: 2rem / p-32")))), h("li", {
66
- key: 'c8614add23a4802ccbb3086c74ac2871ad0a0340',
66
+ key: 'dce557ae08a4800fd5d98c91b5675d4839da622f',
67
67
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
68
68
  }, h("div", {
69
- key: '68b73e788596e32a696e012d08ec11cf479a5d45',
69
+ key: '9a134b12e3829b5529921ee24ba095231ea9a70f',
70
70
  class: "container p-8 item-center border-2 border-soft"
71
71
  }, h("div", {
72
- key: 'b057f25cdeda7c6cc3f0ce21e199d84d90bb0bfa',
72
+ key: '2f30c7339974f96fa881b43f8b7ec9a018c2f372',
73
73
  class: "spacing-sample pt-32 bg-strong"
74
74
  }, h("span", {
75
- key: 'a72e385bdaed3c6c8a06fb7951f6b326eb8f2e4f',
75
+ key: '663a2b9a903effbd5eb1988d6803934c41a26b93',
76
76
  class: "f-body-01 text-inverse"
77
77
  }, "Padding Top: 2rem / pt-32")))), h("li", {
78
- key: '11be77901177c2372b29076072dd7544f7371aa4',
78
+ key: '363143700c339ab934b466ef9f84f257be3adbbc',
79
79
  class: "grid-col-span-12 md:grid-col-span-4 flex flex-col items-center mt-16"
80
80
  }, h("div", {
81
- key: '5606d88389c6aaa16a9941fefe2bc34e881b22a3',
81
+ key: 'e72006b92c553dfb7c3df21cbbea3a7234cbf725',
82
82
  class: "container p-8 item-center border-2 border-soft"
83
83
  }, h("div", {
84
- key: '1341d44c62567c8b5078046644cda8ddcec59809',
84
+ key: '251e68c910ee1d0485d630fde091e6790183f4f9',
85
85
  class: "spacing-sample pl-32 bg-strong"
86
86
  }, h("span", {
87
- key: 'b9208571277fced609ea55a113a30dc7a424c2a8',
87
+ key: 'cf2f10404629bf2e7ab10d51b2917361cf93279b',
88
88
  class: "f-body-01 text-inverse"
89
89
  }, "Padding Left: 2rem / pl-32"))))));
90
90
  }
@@ -202,10 +202,10 @@ const TokenTypography = class {
202
202
  }
203
203
  render() {
204
204
  return h("section", {
205
- key: 'b831c9707b00d17768f585e2015de8a7289b11d2',
205
+ key: '62bc664d442830ac40bc6aae9a5dbd38f5d18f05',
206
206
  class: "w-full"
207
207
  }, h("ul", {
208
- key: '472e46f2c903597d24e8f24cf28b6f475c7d7a82',
208
+ key: 'e8a97077420f77631e75ec99e14b22fd77a36c11',
209
209
  class: "not-prose gap-y-8 md:gap-y-12 lg:gap-y-16"
210
210
  }, Object.entries(typography.typesets).filter(([typeKey]) => typeKey !== 'displays') // Exclude "displays"
211
211
  .flatMap(([typeKey, typeValues]) => Object.entries(typeValues).map(([size, style]) => h("li", {
@@ -1,79 +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 edsRatingCss = ":host{display:inline-block}.block{display:block}.stars{display:flex;gap:0.25rem;cursor:pointer}.star{color:var(--star-empty-color, #ccc);transition:color 0.2s ease-in-out}.star.filled{color:var(--green-500);}.star:hover,.star.filled:hover{transform:scale(1.2)}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.mt-4{margin-top:0.25rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.my-4{margin-top:0.25rem;margin-bottom:0.25rem}.my-8{margin-top:0.5rem;margin-bottom:0.5rem}.my-16{margin-top:1rem;margin-bottom:1rem}.my-20{margin-top:1.25rem;margin-bottom:1.25rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.0625rem * var(--tw-space-x-reverse));margin-left:calc(0.0625rem * calc(1 - var(--tw-space-x-reverse)))}";
7
- const EdsRatingStyle0 = edsRatingCss;
8
- const EdsRating = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.rating = createEvent(this, "rating", 7);
12
- this.ratingType = 'star';
13
- this.ratingCount = 5;
14
- this.selectedRating = 0;
15
- }
16
- /**
17
- * Lifecycle method that runs when the component has fully loaded.
18
- * It emits a custom event for each `eds-button` element contained within the breadcrumb.
19
- */
20
- componentDidLoad() {
21
- const btns = this.el.shadowRoot.querySelectorAll('eds-button');
22
- btns.forEach(btn => {
23
- this.emitContext(btn);
24
- });
25
- }
26
- /**
27
- * Emits a custom event called `parentContext` for a given link element.
28
- * This event provides context information about the breadcrumb component.
29
- *
30
- * @param btnElement - The link element to which the event will be dispatched.
31
- */
32
- emitContext(btnElement) {
33
- const event = new CustomEvent('parentContext', {
34
- detail: {
35
- componentName: this.el.tagName.toLowerCase(),
36
- identifier: this.selectedRating
37
- }
38
- });
39
- btnElement.dispatchEvent(event);
40
- }
41
- /**
42
- * Handles the click event on a star.
43
- * @param rating - The selected rating value.
44
- */
45
- handleClick(rating) {
46
- this.selectedRating = rating;
47
- this.rating.emit(rating);
48
- }
49
- render() {
50
- return h("div", {
51
- key: 'ece1af90e2dea3f69dfef822d7f4f55f76866cbd',
52
- role: "radiogroup",
53
- class: "stars flex space-x-1 my-8"
54
- }, Array.from({
55
- length: this.ratingCount
56
- }, (_, index) => {
57
- const starRating = index + 1;
58
- const isSelected = starRating <= this.selectedRating;
59
- // Use the mapping text if available; otherwise, fall back to a generic label.
60
- return h("eds-button", {
61
- icon: this.ratingType,
62
- role: "radio",
63
- "aria-checked": isSelected ? 'true' : 'false',
64
- "aria-label": this.ratingType,
65
- onClick: () => this.handleClick(starRating),
66
- tabIndex: this.selectedRating === 0 && index === 0 ? 0 : isSelected ? 0 : -1,
67
- intent: isSelected ? 'primary' : 'ghost',
68
- size: "large",
69
- "extra-class": "p-2" // Optional padding or styling for the star button
70
- });
71
- }));
72
- }
73
- get el() {
74
- return getElement(this);
75
- }
76
- };
77
- EdsRating.style = EdsRatingStyle0;
78
-
79
- export { EdsRating as eds_rating };
@@ -1,93 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index.esm2.js';
2
- import { c as cva } from './index-39c58238.esm.js';
3
- import 'react';
4
- import 'react/jsx-runtime';
5
- import 'react-dom';
6
-
7
- const edsToastCss = ".relative{position:relative}.right-4{right:0.25rem}.bottom-4{bottom:0.25rem}.w-auto{width:auto}.flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-4{gap:0.25rem}.f-ui-01{font-family:var(--f-ui-01-fontFamily);font-weight:var(--f-ui-01-fontWeight);font-size:var(--f-ui-01-fontSize);line-height:var(--f-ui-01-lineHeight);letter-spacing:var(--f-ui-01-letterSpacing)}.ml-8{margin-left:0.5rem}.p-12{padding:0.75rem}.rounded-lg{border-radius:16px}.shadow-md{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),\n 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),\n var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.bg-dark{background-color:var(--grey-300)}.bg-success{background-color:var(--green-200)}.bg-error{background-color:var(--red-200)}.bg-warning{background-color:var(--yellow-200)}.text-light{color:var(--grey-700)}.text-current{color:currentColor}.text-default{color:var(--black)}";
8
- const EdsToastStyle0 = edsToastCss;
9
- const toastStyles = cva(['relative right-4 bottom-4 w-auto p-12 rounded-lg shadow-md'], {
10
- variants: {
11
- intent: {
12
- default: 'bg-dark text-light',
13
- success: 'bg-success text-dark',
14
- error: 'bg-error text-light',
15
- warning: 'bg-warning text-dark'
16
- }
17
- },
18
- defaultVariants: {
19
- intent: 'default'
20
- }
21
- });
22
- const EdsToast = class {
23
- constructor(hostRef) {
24
- registerInstance(this, hostRef);
25
- /**
26
- * Dismisses the toast.
27
- */
28
- this.dismissToast = () => {
29
- this.visible = false;
30
- };
31
- this.message = undefined;
32
- this.intent = 'default';
33
- this.duration = undefined;
34
- this.visible = true;
35
- }
36
- componentDidLoad() {
37
- const btn = this.el.shadowRoot.querySelector('eds-button');
38
- this.emitContext(btn);
39
- }
40
- /**
41
- * Emits a custom event called `parentContext` for a given button element.
42
- * This event provides context information about the toast component.
43
- *
44
- * @param btnElement - The link element to which the event will be dispatched.
45
- */
46
- emitContext(btnElement) {
47
- const event = new CustomEvent('parentContext', {
48
- detail: {
49
- componentName: this.el.tagName.toLowerCase(),
50
- identifier: null
51
- }
52
- });
53
- btnElement.dispatchEvent(event);
54
- }
55
- connectedCallback() {
56
- if (this.duration && this.duration > 0) {
57
- this.dismissTimeout = setTimeout(this.dismissToast, this.duration);
58
- }
59
- }
60
- disconnectedCallback() {
61
- // Clear the timeout when the component is removed
62
- clearTimeout(this.dismissTimeout);
63
- }
64
- render() {
65
- if (!this.visible) {
66
- return null;
67
- }
68
- const classes = toastStyles({
69
- intent: this.intent
70
- });
71
- return h("div", {
72
- class: classes,
73
- role: "alert",
74
- "aria-live": "assertive"
75
- }, h("div", {
76
- class: "flex items-center justify-between gap-4"
77
- }, h("span", {
78
- class: "f-ui-01"
79
- }, this.message), h("eds-button", {
80
- intent: "tertiary",
81
- icon: "close",
82
- "aria-label": "Close Toast",
83
- onClick: () => this.dismissToast(),
84
- "extra-class": "ml-8"
85
- })));
86
- }
87
- get el() {
88
- return getElement(this);
89
- }
90
- };
91
- EdsToast.style = EdsToastStyle0;
92
-
93
- export { EdsToast as eds_toast };