@ebrains/components 0.3.0-alpha.0 → 0.4.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 (177) hide show
  1. package/dist/cjs/{color-3ffe3072.js → color-88793e49.js} +2 -2
  2. package/dist/cjs/components.cjs.js +1 -1
  3. package/dist/cjs/eds-accordion_33.cjs.entry.js +2670 -0
  4. package/dist/cjs/eds-card-project.cjs.entry.js +1 -1
  5. package/dist/cjs/eds-card-section.cjs.entry.js +3 -3
  6. package/dist/cjs/eds-card-tags.cjs.entry.js +1 -1
  7. package/dist/cjs/eds-card-tool.cjs.entry.js +1 -1
  8. package/dist/cjs/eds-card-wrapper.cjs.entry.js +1 -1
  9. package/dist/cjs/eds-code-block.cjs.entry.js +48 -1
  10. package/dist/cjs/eds-matomo-notice.cjs.entry.js +1 -1
  11. package/dist/cjs/eds-pagination_2.cjs.entry.js +33 -15
  12. package/dist/cjs/eds-rating.cjs.entry.js +5 -7
  13. package/dist/cjs/eds-tabs-content.cjs.entry.js +1 -1
  14. package/dist/cjs/eds-tabs.cjs.entry.js +1 -1
  15. package/dist/cjs/eds-timeline.cjs.entry.js +3 -2
  16. package/dist/cjs/eds-tooltip.cjs.entry.js +11 -1
  17. package/dist/cjs/eds-trl.cjs.entry.js +7 -8
  18. package/dist/cjs/index-f08e4f5c.js +2 -34
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/collection/collection-manifest.json +1 -1
  21. package/dist/collection/components/eds-accordion/eds-accordion.js +11 -20
  22. package/dist/collection/components/eds-alert/eds-alert.js +5 -7
  23. package/dist/collection/components/eds-alert/eds-alert.stories.js +4 -4
  24. package/dist/collection/components/eds-avatar/eds-avatar.js +1 -1
  25. package/dist/collection/components/eds-avatar/eds-avatar.stories.js +24 -22
  26. package/dist/collection/components/eds-block-break/eds-block-break.js +1 -1
  27. package/dist/collection/components/eds-breadcrump/eds-breadcrump.js +2 -1
  28. package/dist/collection/components/eds-button/eds-button.js +1 -1
  29. package/dist/collection/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.js +9 -1
  30. package/dist/collection/components/eds-cards/eds-card-composer/eds-card-tags/eds-card-tags.js +1 -1
  31. package/dist/collection/components/eds-cards/eds-card-composer/eds-card-title/eds-card-title.js +1 -1
  32. package/dist/collection/components/eds-cards/eds-card-composer/eds-card-wrapper/eds-card-wrapper.js +1 -1
  33. package/dist/collection/components/eds-cards/eds-card-generic/eds-card-generic.js +14 -8
  34. package/dist/collection/components/eds-cards/eds-card-generic/eds-card-generic.stories.js +1 -1
  35. package/dist/collection/components/eds-code-block/eds-code-block.js +57 -2
  36. package/dist/collection/components/eds-code-block/eds-code-block.stories.js +78 -0
  37. package/dist/collection/components/eds-dropdown/eds-dropdown.js +11 -21
  38. package/dist/collection/components/eds-form/eds-form.js +41 -31
  39. package/dist/collection/components/eds-form/eds-form.stories.js +0 -3
  40. package/dist/collection/components/eds-frame/eds-frame.stories.js +19 -18
  41. package/dist/collection/components/eds-input-elements/eds-input-select/eds-input-select.js +4 -1
  42. package/dist/collection/components/eds-link/eds-link.js +3 -4
  43. package/dist/collection/components/eds-modal/eds-modal.css +16 -0
  44. package/dist/collection/components/eds-modal/eds-modal.js +71 -29
  45. package/dist/collection/components/eds-modal/eds-modal.stories.js +34 -18
  46. package/dist/collection/components/eds-pagination/eds-pagination.js +13 -9
  47. package/dist/collection/components/eds-rating/eds-rating.js +8 -10
  48. package/dist/collection/components/eds-section/eds-section-core/eds-section-core.stories.js +12 -11
  49. package/dist/collection/components/eds-table/eds-table.js +20 -7
  50. package/dist/collection/components/eds-timeline/eds-timeline.js +3 -2
  51. package/dist/collection/components/eds-toast/eds-toast.js +21 -0
  52. package/dist/collection/components/eds-tooltip/eds-tooltip.js +10 -1
  53. package/dist/collection/components/eds-trl/eds-trl.js +7 -8
  54. package/dist/collection/shared-ui/eds-card-section/eds-card-section.js +7 -6
  55. package/dist/collection/shared-ui/eds-card-section/eds-card-section.stories.js +8 -39
  56. package/dist/components/analytics.js +2 -2
  57. package/dist/components/components.css +12 -0
  58. package/dist/components/components.esm.js +1 -1
  59. package/dist/components/eds-accordion2.js +12 -20
  60. package/dist/components/eds-alert2.js +5 -7
  61. package/dist/components/eds-avatar2.js +1 -1
  62. package/dist/components/eds-block-break2.js +1 -1
  63. package/dist/components/eds-breadcrumb.js +2 -1
  64. package/dist/components/eds-button2.js +1 -1
  65. package/dist/components/eds-card-desc2.js +1 -1
  66. package/dist/components/eds-card-generic2.js +3 -3
  67. package/dist/components/eds-card-section.js +3 -3
  68. package/dist/components/eds-card-tags.js +1 -1
  69. package/dist/components/eds-card-title2.js +1 -1
  70. package/dist/components/eds-card-wrapper.js +1 -1
  71. package/dist/components/eds-code-block2.js +48 -1
  72. package/dist/components/eds-dropdown2.js +12 -21
  73. package/dist/components/eds-form.js +37 -12
  74. package/dist/components/eds-input-select2.js +1 -1
  75. package/dist/components/eds-link2.js +3 -4
  76. package/dist/components/eds-modal.js +56 -30
  77. package/dist/components/eds-pagination2.js +13 -9
  78. package/dist/components/eds-rating.js +6 -8
  79. package/dist/components/eds-table2.js +20 -6
  80. package/dist/components/eds-timeline.js +3 -2
  81. package/dist/components/eds-toast2.js +21 -0
  82. package/dist/components/eds-tooltip.js +11 -1
  83. package/dist/components/eds-trl.js +7 -8
  84. package/dist/components/p-2dda1ec4.entry.js +1 -0
  85. package/dist/components/{p-d9788b54.entry.js → p-35ec730b.entry.js} +1 -1
  86. package/dist/components/{p-e6bfbf51.entry.js → p-5398d652.entry.js} +2 -2
  87. package/dist/components/{p-e20ed2c7.entry.js → p-610db2b2.entry.js} +1 -1
  88. package/dist/components/p-832dc95a.entry.js +1 -0
  89. package/dist/components/p-855aa1a3.entry.js +1 -0
  90. package/dist/components/{p-52ac3456.entry.js → p-8ddc67a1.entry.js} +1 -1
  91. package/dist/components/p-ab32b3fc.entry.js +1 -0
  92. package/dist/components/p-b04eff31.entry.js +1 -0
  93. package/dist/components/p-b86a4985.js +1 -0
  94. package/dist/components/{p-2e8459ef.entry.js → p-ba6bafef.entry.js} +1 -1
  95. package/dist/components/{p-6fc62452.entry.js → p-c3b294a0.entry.js} +1 -1
  96. package/dist/components/p-c6038449.entry.js +1 -0
  97. package/dist/components/p-c72c8fb0.entry.js +1 -0
  98. package/dist/components/p-dd6daa96.entry.js +1 -0
  99. package/dist/components/{p-73bd0c97.entry.js → p-df94285c.entry.js} +1 -1
  100. package/dist/esm/{color-0ba8ed56.js → color-bb472c37.js} +2 -2
  101. package/dist/esm/components.js +1 -1
  102. package/dist/esm/eds-accordion_33.entry.js +2634 -0
  103. package/dist/esm/eds-card-project.entry.js +1 -1
  104. package/dist/esm/eds-card-section.entry.js +3 -3
  105. package/dist/esm/eds-card-tags.entry.js +1 -1
  106. package/dist/esm/eds-card-tool.entry.js +1 -1
  107. package/dist/esm/eds-card-wrapper.entry.js +1 -1
  108. package/dist/esm/eds-code-block.entry.js +49 -2
  109. package/dist/esm/eds-matomo-notice.entry.js +1 -1
  110. package/dist/esm/eds-pagination_2.entry.js +33 -15
  111. package/dist/esm/eds-rating.entry.js +5 -7
  112. package/dist/esm/eds-tabs-content.entry.js +1 -1
  113. package/dist/esm/eds-tabs.entry.js +1 -1
  114. package/dist/esm/eds-timeline.entry.js +3 -2
  115. package/dist/esm/eds-tooltip.entry.js +11 -1
  116. package/dist/esm/eds-trl.entry.js +7 -8
  117. package/dist/esm/index-e96badea.js +2 -34
  118. package/dist/esm/loader.js +1 -1
  119. package/dist/hydrate/index.js +560 -427
  120. package/dist/hydrate/index.mjs +560 -427
  121. package/dist/types/components/eds-accordion/eds-accordion.d.ts +5 -12
  122. package/dist/types/components/eds-avatar/eds-avatar.stories.d.ts +0 -18
  123. package/dist/types/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.d.ts +8 -0
  124. package/dist/types/components/eds-cards/eds-card-generic/eds-card-generic.d.ts +6 -2
  125. package/dist/types/components/eds-code-block/eds-code-block.d.ts +43 -3
  126. package/dist/types/components/eds-code-block/eds-code-block.stories.d.ts +54 -0
  127. package/dist/types/components/eds-dropdown/eds-dropdown.d.ts +0 -7
  128. package/dist/types/components/eds-form/eds-form.d.ts +3 -6
  129. package/dist/types/components/eds-form/eds-form.stories.d.ts +0 -5
  130. package/dist/types/components/eds-frame/eds-frame.stories.d.ts +0 -2
  131. package/dist/types/components/eds-input-elements/eds-input-select/eds-input-select.d.ts +3 -0
  132. package/dist/types/components/eds-link/eds-link.d.ts +1 -1
  133. package/dist/types/components/eds-modal/eds-modal.d.ts +18 -3
  134. package/dist/types/components/eds-modal/eds-modal.stories.d.ts +9 -0
  135. package/dist/types/components/eds-rating/eds-rating.d.ts +4 -6
  136. package/dist/types/components/eds-section/eds-section-core/eds-section-core.stories.d.ts +0 -1
  137. package/dist/types/components/eds-table/eds-table.d.ts +5 -5
  138. package/dist/types/components/eds-toast/eds-toast.d.ts +9 -0
  139. package/dist/types/components.d.ts +66 -84
  140. package/dist/types/shared-ui/eds-card-section/eds-card-section.d.ts +1 -6
  141. package/dist/types/shared-ui/eds-card-section/eds-card-section.stories.d.ts +42 -21
  142. package/package.json +1 -1
  143. package/dist/cjs/eds-accordion.cjs.entry.js +0 -93
  144. package/dist/cjs/eds-alert.cjs.entry.js +0 -96
  145. package/dist/cjs/eds-avatar_17.cjs.entry.js +0 -1454
  146. package/dist/cjs/eds-card-desc_3.cjs.entry.js +0 -117
  147. package/dist/cjs/eds-card-generic.cjs.entry.js +0 -105
  148. package/dist/cjs/eds-form.cjs.entry.js +0 -322
  149. package/dist/cjs/eds-frame.cjs.entry.js +0 -91
  150. package/dist/cjs/eds-input_7.cjs.entry.js +0 -316
  151. package/dist/cjs/eds-modal.cjs.entry.js +0 -86
  152. package/dist/components/p-02e2a62f.entry.js +0 -1
  153. package/dist/components/p-32f282a9.entry.js +0 -1
  154. package/dist/components/p-3617841d.entry.js +0 -1
  155. package/dist/components/p-373673ca.js +0 -1
  156. package/dist/components/p-3ff76976.entry.js +0 -1
  157. package/dist/components/p-42b4ecff.entry.js +0 -1
  158. package/dist/components/p-54c75346.entry.js +0 -1
  159. package/dist/components/p-5afb626c.entry.js +0 -1
  160. package/dist/components/p-5d7af761.entry.js +0 -1
  161. package/dist/components/p-7215789a.entry.js +0 -1
  162. package/dist/components/p-79887c2c.entry.js +0 -1
  163. package/dist/components/p-84957b6d.entry.js +0 -1
  164. package/dist/components/p-96c4deda.entry.js +0 -1
  165. package/dist/components/p-be6c80da.entry.js +0 -1
  166. package/dist/components/p-d1f6a722.entry.js +0 -1
  167. package/dist/components/p-d7a92efb.entry.js +0 -1
  168. package/dist/components/p-fd27e56c.entry.js +0 -1
  169. package/dist/esm/eds-accordion.entry.js +0 -89
  170. package/dist/esm/eds-alert.entry.js +0 -92
  171. package/dist/esm/eds-avatar_17.entry.js +0 -1434
  172. package/dist/esm/eds-card-desc_3.entry.js +0 -111
  173. package/dist/esm/eds-card-generic.entry.js +0 -101
  174. package/dist/esm/eds-form.entry.js +0 -318
  175. package/dist/esm/eds-frame.entry.js +0 -87
  176. package/dist/esm/eds-input_7.entry.js +0 -306
  177. package/dist/esm/eds-modal.entry.js +0 -82
@@ -1,111 +0,0 @@
1
- import { r as registerInstance, h } from './index-e96badea.js';
2
- import { c as cva } from './index-39c58238.js';
3
-
4
- const edsCardDescCss = ".f-ui-02-light{font-family:var(--f-ui-02-light-fontFamily);font-weight:var(--f-ui-02-light-fontWeight);font-size:var(--f-ui-02-light-fontSize);line-height:var(--f-ui-02-light-lineHeight);letter-spacing:var(--f-ui-02-light-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.text-light{color:var(--grey-700)}.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}";
5
- const EdsCardDescStyle0 = edsCardDescCss;
6
-
7
- const EdsCardDesc = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.description = undefined;
11
- this.descClass = 'f-ui-03-light';
12
- this.truncate = true;
13
- this.truncateLines = '3';
14
- }
15
- getTruncateClass() {
16
- return this.truncate && this.truncateLines ? `line-clamp-${this.truncateLines}` : '';
17
- }
18
- render() {
19
- return (h("p", { key: '017c115ebff999c74cff1eaeb5c63f97e0f6554d', class: `text-light ${this.descClass}` }, h("span", { key: 'f87b9b3d593e417ef351882f426d24c0b206ccab', class: this.getTruncateClass() }, this.description)));
20
- }
21
- };
22
- EdsCardDesc.style = EdsCardDescStyle0;
23
-
24
- const edsCardTitleCss = "a{all:unset;display:inline;color:inherit;text-decoration:none;cursor:pointer}h1,h2,h3,h4,h5,h6{margin:0}.f-heading-01{font-family:var(--f-heading-01-fontFamily);font-weight:var(--f-heading-01-fontWeight);font-size:var(--f-heading-01-fontSize);line-height:var(--f-heading-01-lineHeight);letter-spacing:var(--f-heading-01-letterSpacing)}.f-heading-02{font-family:var(--f-heading-02-fontFamily);font-weight:var(--f-heading-02-fontWeight);font-size:var(--f-heading-02-fontSize);line-height:var(--f-heading-02-lineHeight);letter-spacing:var(--f-heading-02-letterSpacing)}.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)}.f-heading-06{font-family:var(--f-heading-06-fontFamily);font-weight:var(--f-heading-06-fontWeight);font-size:var(--f-heading-06-fontSize);line-height:var(--f-heading-06-lineHeight);letter-spacing:var(--f-heading-06-letterSpacing)}.break-words{overflow-wrap:break-word}.after\\:absolute::after{position:absolute}.after\\:inset-0::after{inset:0rem}.after\\:z-10::after{z-index:10}.after\\:content-\\[\\'\\'\\]::after{--tw-content:'';content:var(--tw-content)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}";
25
- const EdsCardTitleStyle0 = edsCardTitleCss;
26
-
27
- const EdsCardTitle = class {
28
- constructor(hostRef) {
29
- registerInstance(this, hostRef);
30
- this.url = undefined;
31
- this.titleClass = undefined;
32
- this.headingLevel = 'h3';
33
- this.externalLink = false;
34
- this.cardTitle = undefined;
35
- this.hierarchy = true;
36
- }
37
- /**
38
- * Dynamically generate the title class based on the heading level.
39
- */
40
- getTitleClass() {
41
- const levelMap = this.hierarchy
42
- ? {
43
- h1: '05',
44
- h2: '05',
45
- h3: '05',
46
- h4: '05',
47
- h5: '05',
48
- h6: '06'
49
- }
50
- : {
51
- h1: '01',
52
- h2: '02',
53
- h3: '03',
54
- h4: '04',
55
- h5: '05',
56
- h6: '06'
57
- };
58
- return `f-heading-${levelMap[this.headingLevel]}`;
59
- }
60
- /*private getTag() {
61
- if (this.url) {
62
- return 'a';
63
- }
64
- return 'span';
65
- }*/
66
- render() {
67
- //const Tag = this.getTag();
68
- const Heading = this.headingLevel;
69
- return (h(Heading, { key: '8aee3bcb0e04508dd21a03ea0f695e040f37c767', class: this.getTitleClass() }, h("a", { key: 'c5fa27fe86037ed6b039c156aecdf1acc9c7c8bc', class: "break-words after:absolute after:inset-0 after:z-10 after:content-[''] focus:outline-none", href: this.url, target: this.externalLink ? '_blank' : undefined, rel: this.externalLink ? 'noopener noreferrer' : undefined }, this.cardTitle)));
70
- }
71
- };
72
- EdsCardTitle.style = EdsCardTitleStyle0;
73
-
74
- const edsTagCss = ".f-ui-05{font-family:var(--f-ui-05-fontFamily);font-weight:var(--f-ui-05-fontWeight);font-size:var(--f-ui-05-fontSize);line-height:var(--f-ui-05-lineHeight);letter-spacing:var(--f-ui-05-letterSpacing)}.py-1{padding-top:0.0625rem;padding-bottom:0.0625rem}.px-4{padding-left:0.25rem;padding-right:0.25rem}.border-2{border-width:2px}.rounded-pill{border-radius:100px}.border-default{border:2px solid var(--black)}.text-inverse{color:var(--white)}.bg-strongest{background-color:var(--black)}.text-\\[\\#0034CB\\]{--tw-text-opacity:1;color:rgb(0 52 203 / var(--tw-text-opacity))}.border-\\[\\#0034CB\\]{--tw-border-opacity:1;border:2px solid rgb(0 52 203 / var(--tw-border-opacity))}.text-light{color:var(--grey-700)}.bg-strongest-soft{background-color:rgba(0, 0, 0, .05)}.border-transparent{border-color:var(--transparent)}.border-inverse{border-color:var(--white)}.bg-inverse{background-color:var(--white)}.text-lighter{color:var(--grey-600)}";
75
- const EdsTagStyle0 = edsTagCss;
76
-
77
- // Define the CVA for the tag styles
78
- const tagStyles = cva(['f-ui-05 py-1 px-4 border-2 rounded-pill'], // Base classes
79
- {
80
- variants: {
81
- intent: {
82
- default: 'border-default',
83
- strong: 'text-inverse bg-strongest border-default',
84
- accent: 'text-[#0034CB] border-[#0034CB]',
85
- weak: 'text-light bg-strongest-soft border-transparent',
86
- inverse: 'border-inverse text-inverse',
87
- 'inverse-strong': 'bg-inverse border-inverse text-lighter'
88
- }
89
- },
90
- defaultVariants: {
91
- intent: 'default'
92
- }
93
- });
94
- const EdsTag = class {
95
- constructor(hostRef) {
96
- registerInstance(this, hostRef);
97
- this.label = undefined;
98
- this.intent = 'default';
99
- }
100
- /**
101
- * Render the component.
102
- * @returns The rendered HTML for the tag component with the applied styles and label.
103
- */
104
- render() {
105
- const classes = tagStyles({ intent: this.intent });
106
- return h("span", { key: '546bd7eb2c78760edc12cd7bb3ede5f6ab9099f3', class: classes }, this.label);
107
- }
108
- };
109
- EdsTag.style = EdsTagStyle0;
110
-
111
- export { EdsCardDesc as eds_card_desc, EdsCardTitle as eds_card_title, EdsTag as eds_tag };
@@ -1,101 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index-e96badea.js';
2
- import { s as sendAnalytics } from './color-0ba8ed56.js';
3
- import './index-39c58238.js';
4
-
5
- const edsCardGenericCss = ".h-auto{height:auto}.h-full{height:100%}.\\!min-h-20{min-height:1.25rem !important}.min-h-120{min-height:120px}.min-h-156{min-height:156px}.bg-default{background-color:var(--grey-200)}.bg-inverse{background-color:var(--white)}.effect-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.hover\\:shadow-hover:hover{--tw-shadow:0px 0px 16px rgba(0, 0, 0, 0.2);--tw-shadow-colored:0px 0px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.cursor-pointer{cursor:pointer}.border-soft{border-color:rgba(0, 0, 0, .15 )}.border-softer{border:2px solid rgba(0, 0, 0, .1 )}.effect-focus-within{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.effect-focus-within:focus-within{outline-style:solid}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grow{flex-grow:1}.flex-col{flex-direction:column}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-12{padding:0.75rem}.p-16{padding:1rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.gap-y-4{row-gap:0.25rem}.order-first{order:-9999}.mb-10{margin-bottom:0.625rem}.mb-12{margin-bottom:0.75rem}";
6
- const EdsCardGenericStyle0 = edsCardGenericCss;
7
-
8
- const EdsCardGeneric = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.parentContext = null; // Accepts the entire event detail or null
12
- this.cardTitle = undefined;
13
- this.url = undefined;
14
- this.description = undefined;
15
- this.image = undefined;
16
- this.avatar = undefined;
17
- this.shortAbbreviation = undefined;
18
- this.headingLevel = 'h3';
19
- this.tags = '';
20
- this.tiny = false;
21
- this.bg = true;
22
- this.withHover = true;
23
- this.hierarchy = true;
24
- this.parsedImage = null;
25
- }
26
- componentWillLoad() {
27
- if (this.image) {
28
- try {
29
- if (typeof this.image === 'object') {
30
- // If image is already an object, assign it directly
31
- this.parsedImage = this.image;
32
- }
33
- else if (typeof this.image === 'string') {
34
- // If image is a string, try to parse it
35
- this.parsedImage = JSON.parse(this.image);
36
- }
37
- }
38
- catch (error) {
39
- // eslint-disable-next-line
40
- console.error('Error parsing image prop:', error);
41
- this.parsedImage = {}; // Assign a fallback empty object in case of an error
42
- }
43
- }
44
- }
45
- handleParentContext(event) {
46
- if (event.target !== this.el) {
47
- // Ignore the event if it's not targeted at this specific instance
48
- return;
49
- }
50
- //console.log(event.detail);
51
- this.parentContext = event.detail;
52
- event.stopPropagation();
53
- }
54
- /**
55
- * Parses the `tags` prop into an array of link objects.
56
- * Returns an empty array if parsing fails or if `tags` is not a valid JSON string or object.
57
- *
58
- * @returns {any[]} Array of parsed link objects
59
- */
60
- get parsedTags() {
61
- if (typeof this.tags === 'object') {
62
- return this.tags;
63
- }
64
- else if (typeof this.tags === 'string') {
65
- try {
66
- return JSON.parse(this.tags);
67
- }
68
- catch (e) {
69
- // eslint-disable-next-line
70
- console.error('Error parsing tags prop:', e);
71
- return [];
72
- }
73
- }
74
- return [];
75
- }
76
- articleClasses() {
77
- return [
78
- this.description ? (this.tiny ? 'min-h-120' : 'min-h-156') : 'h-auto',
79
- this.bg ? 'bg-inverse' : 'bg-default',
80
- this.withHover ? 'effect-shadow hover:shadow-hover cursor-pointer' : '',
81
- 'border-softer effect-focus-within relative flex grow flex-col rounded-lg border-2 p-16'
82
- ].join(' ');
83
- }
84
- handleClick() {
85
- var _a;
86
- sendAnalytics({
87
- category: 'ui-component',
88
- parentContext: this.parentContext,
89
- tag: this.el.tagName.toLowerCase(),
90
- name: ((_a = this.cardTitle) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
91
- action: 'click'
92
- });
93
- }
94
- render() {
95
- return (h("article", { key: '17d1f00f232a4436756fa3846684bbae8c716036', class: this.articleClasses(), onClick: () => this.handleClick() }, h("eds-card-title", { key: 'd99ee1716c4e308a3ea446f0f7cedfaeac30f2ed', "heading-level": this.headingLevel, titleClass: this.image ? 'f-ui-01' : undefined, "card-title": this.cardTitle, url: this.url, hierarchy: this.hierarchy }), this.description && (h("eds-card-desc", { key: 'c5bdc76e68a8d660609630aa8184ec3a9508ab61', class: "mt-8", "truncate-lines": "3", description: this.description })), this.parsedImage ? (h("eds-img", Object.assign({ class: "mt-8" }, this.parsedImage))) : this.avatar || this.shortAbbreviation ? (h("eds-avatar", { class: "order-first mb-12", picture: this.avatar, initials: this.shortAbbreviation })) : null, h("div", { key: 'fa993e3c60d357eb0d9a63e612bdd2bf026e7a85', class: "flex flex-wrap gap-y-4" }, this.parsedTags.map((tag, index) => (h("eds-tag", { key: index, intent: tag.style, label: tag.label })))), ' '));
96
- }
97
- get el() { return getElement(this); }
98
- };
99
- EdsCardGeneric.style = EdsCardGenericStyle0;
100
-
101
- export { EdsCardGeneric as eds_card_generic };