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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/color-primary-palette_6.entry.esm.js +106 -106
  2. package/correct-use-of-colors.entry.esm.js +33 -33
  3. package/eds-accordion_17.entry.esm.js +196 -0
  4. package/eds-alert.entry.esm.js +14 -6
  5. package/eds-app-root.entry.esm.js +4 -4
  6. package/eds-breadcrumb.entry.esm.js +6 -3
  7. package/{eds-avatar_4.entry.esm.js → eds-card-desc_3.entry.esm.js} +6 -66
  8. package/eds-card-generic.entry.esm.js +1 -1
  9. package/eds-card-project.entry.esm.js +10 -10
  10. package/eds-card-tags.entry.esm.js +1 -1
  11. package/eds-card-tool.entry.esm.js +4 -4
  12. package/eds-card-wrapper.entry.esm.js +4 -4
  13. package/eds-code-block.entry.esm.js +7 -7
  14. package/eds-components-section.entry.esm.js +27 -24
  15. package/eds-cookies-preference.entry.esm.js +2 -2
  16. package/eds-docs-palettes.entry.esm.js +1 -1
  17. package/eds-docs-tokens.entry.esm.js +1 -1
  18. package/eds-feedback.entry.esm.js +5 -5
  19. package/eds-form.entry.esm.js +233 -170
  20. package/eds-frame.entry.esm.js +6 -6
  21. package/eds-icon-arrow-diagonal.entry.esm.js +3 -3
  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-star.entry.esm.js +1 -1
  40. package/eds-icon-success.entry.esm.js +1 -1
  41. package/eds-icon-thumbs-down.entry.esm.js +1 -1
  42. package/eds-icon-thumbs-up.entry.esm.js +1 -1
  43. package/eds-icon-twitter.entry.esm.js +1 -1
  44. package/eds-icon-user.entry.esm.js +1 -1
  45. package/eds-icon-youtube.entry.esm.js +1 -1
  46. package/eds-input_7.entry.esm.js +569 -0
  47. package/eds-login_2.entry.esm.js +2 -2
  48. package/eds-logo-variations.entry.esm.js +1 -1
  49. package/eds-modal.entry.esm.js +8 -8
  50. package/eds-pagination_2.entry.esm.js +493 -0
  51. package/eds-progress-bar.entry.esm.js +2 -2
  52. package/eds-rating.entry.esm.js +1 -1
  53. package/eds-section-core_2.entry.esm.js +6 -6
  54. package/eds-spinner.entry.esm.js +3 -3
  55. package/eds-svg-repository.entry.esm.js +11 -6
  56. package/eds-switch.entry.esm.js +5 -5
  57. package/eds-tabs.entry.esm.js +4 -4
  58. package/eds-timeline.entry.esm.js +7 -4
  59. package/eds-toast-manager.entry.esm.js +1 -1
  60. package/eds-tooltip.entry.esm.js +3 -3
  61. package/eds-trl.entry.esm.js +3 -3
  62. package/incorrect-use-of-colors.entry.esm.js +7 -7
  63. package/index.esm.js +1 -1
  64. package/index.esm2.js +15 -23
  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 +1 -3
  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/README.md +0 -7
  75. package/eds-accordion_22.entry.esm.js +0 -269
  76. package/eds-dropdown.entry.esm.js +0 -156
  77. package/eds-steps.entry.esm.js +0 -89
  78. package/eds-user.entry.esm.js +0 -95
  79. package/eds-vertical-stepper.entry.esm.js +0 -81
  80. package/formUtils-ac68474d.esm.js +0 -247
@@ -1732,10 +1732,10 @@ const EdsLogin = class {
1732
1732
  }
1733
1733
  render() {
1734
1734
  return h("div", {
1735
- key: '074566b791eeb9ea4a0558b4ed83a96e4b673356',
1735
+ key: 'dace7b16af2f945e4981c9ef139f4c2ae94e130c',
1736
1736
  class: "block"
1737
1737
  }, !this.authenticated && h("eds-button", {
1738
- key: '3a05ff97a90d73204eb77c5dad0d328294d72d3e',
1738
+ key: 'a8d0bd545e8ae4a159b5977d50d05ae27dec7df3',
1739
1739
  label: "Login",
1740
1740
  intent: "primary",
1741
1741
  "extra-class": "text-default",
@@ -20,7 +20,7 @@ const EdsLogoVariations = class {
20
20
  }
21
21
  render() {
22
22
  return h("div", {
23
- key: '0b23fee608fcbe7059fce155bd65a0c0a4d16e07',
23
+ key: '31bd93b3412b859adc59f6a4fe67018bf9c13336',
24
24
  class: "container"
25
25
  }, this.renderContent());
26
26
  }
@@ -97,40 +97,40 @@ const EdsModal = class {
97
97
  // Generate a unique id for the title so we can reference it for aria-labelledby.
98
98
  const titleId = `modal-title-${this.el.tagName.toLowerCase()}`;
99
99
  return h("div", {
100
- key: '980f396b79c32a36005b5f7813cc52b2e97457fa',
100
+ key: '456972d43bddeec93053c1518ca35dff028f0416',
101
101
  id: "eds-modal",
102
102
  class: `${this.isOpen ? 'block' : 'hidden'} fixed inset-0 z-50 flex`,
103
103
  role: "dialog",
104
104
  "aria-modal": "true",
105
105
  "aria-labelledby": titleId
106
106
  }, this.isOpen && h("div", {
107
- key: 'a2e4bb022c17c66266809f1a8dd706523a6ff07b',
107
+ key: 'f3b84d1086f70f7863691835fe8984a4ff091b8f',
108
108
  class: "fixed inset-0 bg-dark bg-opacity-90" // Add backdrop-blur utility class here
109
109
  ,
110
110
 
111
111
  onClick: () => this.close()
112
112
  }), h("div", {
113
- key: '53c0c2a9559a6a5116f88caa2a7d92810560521e',
113
+ key: '5038d3564881f4580e63a1afd883affa0aee8750',
114
114
  class: `container max-w-full absolute px-20 py-20 bg-inverse rounded-lg shadow-lg z-10 ${this.getModalPositionClasses()} grow justify-center`
115
115
  }, h("div", {
116
- key: '576b58f6bd78a969436c6a892f4dfec84a486cc4',
116
+ key: '4ce4d6f11afc552579a35f23901bc79e2ae19274',
117
117
  class: "flex justify-between items-center border-b-2 border-softer pb-8"
118
118
  }, h("span", {
119
- key: '63e682d4297a346426dc7559cf0d80e21cc51f4c',
119
+ key: 'a9475d9cdcd4d3a1d68bce973f672621a30c53d4',
120
120
  id: titleId,
121
121
  class: `f-heading-04 text-lighter ${this.getTruncateClass()}`
122
122
  }, this.title), h("eds-button", {
123
- key: 'eed35b30903d65694f2944431e7f387a8ef3f3e9',
123
+ key: 'c1e32fb266333856de6f0e63757fca02778330a9',
124
124
  intent: "tertiary",
125
125
  icon: "close",
126
126
  "aria-label": "Close modal",
127
127
  onClick: () => this.close(),
128
128
  "extra-class": "ml-8"
129
129
  })), h("div", {
130
- key: '6c6e673640ed2ef2ae6139ae1931a4b0a0db9aa9',
130
+ key: '58b1d9a3228516a1de31a81c6cd3a2696c65ce5f',
131
131
  class: "pt-8"
132
132
  }, h("slot", {
133
- key: 'eaaf2c17470681dc799b74f5eaebbe2496564c0e'
133
+ key: '0d81e88fcaa138bd746cc894543f264e4a3afb2f'
134
134
  }))));
135
135
  }
136
136
  get el() {
@@ -0,0 +1,493 @@
1
+ import { r as registerInstance, h, g as getElement } from './index.esm2.js';
2
+ import { s as sendAnalytics } from './analytics-44b1416b.esm.js';
3
+ import { p as parseData } from './sharedUtils-a550989c.esm.js';
4
+ import 'react';
5
+ import 'react/jsx-runtime';
6
+ import 'react-dom';
7
+
8
+ const edsPaginationCss = "ul,menu{list-style:none;margin:0;padding:0}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-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)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.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)}.text-lightest{color:var(--grey-500)}.mb-28{margin-bottom:1.75rem}.w-full{width:100%}.w-20{width:1.25rem}.h-20{height:1.25rem}.h-28{height:1.75rem}.h-32{height:2rem}.h-36{height:2.25rem}.text-center{text-align:center}.flex{display:flex}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-x-8{-moz-column-gap:0.5rem;column-gap:0.5rem}.mr-auto{margin-right:auto}.ml-auto{margin-left:auto}.\\!p-8{padding:0.5rem !important}.ml-4{margin-left:0.25rem}.mr-4{margin-right:0.25rem}.hidden{display:none}.gap-1{gap:0.0625rem}.py-4{padding-top:0.25rem;padding-bottom:0.25rem}.transition-colors{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}@media (min-width: 900px){.lg\\:\\!pr-12{padding-right:0.75rem !important}.lg\\:flex{display:flex}}";
9
+ const EdsPaginationStyle0 = edsPaginationCss;
10
+ const EdsPagination = class {
11
+ constructor(hostRef) {
12
+ registerInstance(this, hostRef);
13
+ this.currentPage = undefined;
14
+ this.lastPage = undefined;
15
+ this.perPage = 10;
16
+ this.total = 0;
17
+ this.url = '';
18
+ this.mode = 'default';
19
+ this.prevLabel = 'Prev';
20
+ this.nextLabel = 'Next';
21
+ this.prevUrl = '';
22
+ this.nextUrl = '';
23
+ this.links = [];
24
+ }
25
+ /** Lifecycle hook to generate pagination links on component load */
26
+ componentWillLoad() {
27
+ if (this.mode === 'default') {
28
+ this.generateLinks();
29
+ }
30
+ }
31
+ componentDidLoad() {
32
+ // Emit context for each eds-link element after the component is fully loaded
33
+ const links = this.hostEl.shadowRoot.querySelectorAll('eds-link');
34
+ links.forEach(lnk => {
35
+ this.emitContext(lnk);
36
+ });
37
+ /*if (links.length > 0) {
38
+ // Emit context for the first link
39
+ this.emitContext(links[0]);
40
+ // Emit context for the last link, if it's different from the first
41
+ if (links.length > 1) {
42
+ this.emitContext(links[links.length - 1]);
43
+ }
44
+ }*/
45
+ }
46
+ /**
47
+ * Emits a custom event called `parentContext` for a given link element.
48
+ * This event provides context information about the breadcrumb component.
49
+ *
50
+ * @param linkElement - The link element to which the event will be dispatched.
51
+ */
52
+ emitContext(linkElement) {
53
+ const event = new CustomEvent('parentContext', {
54
+ detail: {
55
+ componentName: this.hostEl.tagName.toLowerCase(),
56
+ identifier: null
57
+ }
58
+ });
59
+ linkElement.dispatchEvent(event);
60
+ }
61
+ onPageOrLastPageChange() {
62
+ if (this.mode === 'default') {
63
+ this.generateLinks();
64
+ }
65
+ }
66
+ /**
67
+ * Checks if the current page is the first page
68
+ * @returns {boolean} - true if current page is the first page
69
+ */
70
+ isFirstPage() {
71
+ return this.currentPage === 1;
72
+ }
73
+ /**
74
+ * Checks if the current page is the last page
75
+ * @returns {boolean} - true if current page is the last page
76
+ */
77
+ isLastPage() {
78
+ return this.currentPage === this.lastPage;
79
+ }
80
+ /**
81
+ * Generates a pagination link object
82
+ * @param {number} page - Page number for the link
83
+ * @returns {Link} - Link object with page details
84
+ */
85
+ generateLink(page) {
86
+ const urlHasQuery = this.url.includes('?');
87
+ return {
88
+ ariaLabel: `Page ${page}`,
89
+ url: `${this.url}${urlHasQuery ? '&' : '?'}page=${page}`,
90
+ label: page.toString(),
91
+ current: this.currentPage === page,
92
+ disabled: false
93
+ };
94
+ }
95
+ /** Generates pagination links based on the last page and current page */
96
+ generateLinks() {
97
+ if (this.lastPage && this.lastPage > 5) {
98
+ this.links = this.getPaginationGenerator(this.currentPage || 1, this.lastPage).map(page => typeof page === 'number' ? this.generateLink(page) : page);
99
+ } else if (this.lastPage) {
100
+ this.links = Array.from({
101
+ length: this.lastPage
102
+ }).map((_, i) => this.generateLink(i + 1));
103
+ }
104
+ }
105
+ /**
106
+ * Creates a pagination range based on delta, current, and total pages
107
+ * @param {number} current - Current page number
108
+ * @param {number} total - Total number of pages
109
+ * @param {number} delta - Range of pages to display around the current page
110
+ * @returns {(number | string)[]} - Range of page numbers or ellipses
111
+ */
112
+ getPaginationGenerator(current, total) {
113
+ const delta = 1; // Show one page before and one after the current page
114
+ const range = [];
115
+ if (total <= 5) {
116
+ // If total pages are 5 or less, show all pages
117
+ for (let i = 1; i <= total; i++) {
118
+ range.push(i);
119
+ }
120
+ } else {
121
+ // Always show the first page
122
+ range.push(1);
123
+ // Add ellipsis if there’s a gap between the first page and the current range start
124
+ if (current - delta > 2) {
125
+ range.push('...');
126
+ }
127
+ // Determine range for pages around the current page
128
+ for (let i = Math.max(2, current - delta); i <= Math.min(total - 1, current + delta); i++) {
129
+ range.push(i);
130
+ }
131
+ // Add ellipsis if there’s a gap between the current range end and the last page
132
+ if (current + delta < total - 1) {
133
+ range.push('...');
134
+ }
135
+ // Always show the last page
136
+ range.push(total);
137
+ }
138
+ return range;
139
+ }
140
+ /**
141
+ * Formats the current page results information for display
142
+ * @returns {string} - Formatted page result information
143
+ */
144
+ pageResults() {
145
+ if (this.total > 0) {
146
+ return this.total > this.perPage ? `${this.perPage * ((this.currentPage || 1) - 1) + 1} - ${this.perPage * (this.currentPage || 1) >= this.total ? this.total : this.perPage * (this.currentPage || 1)} of ${this.total}` : `${this.total}`;
147
+ }
148
+ return '';
149
+ }
150
+ /**
151
+ * Handles a page click event, updating the current page and dispatching an event
152
+ * @param {MouseEvent} event - Click event
153
+ * @param {number} newPage - New page number
154
+ */
155
+ handlePageClick(event, newPage) {
156
+ if (this.mode === 'navigator') {
157
+ return; // No page clicking logic for navigator mode
158
+ }
159
+ event.preventDefault(); // Prevent default link navigation
160
+ if (newPage !== this.currentPage) {
161
+ this.links = this.links.map(link => typeof link === 'object' ? Object.assign(Object.assign({}, link), {
162
+ current: parseInt(link.label) === newPage
163
+ }) : link);
164
+ const pageChangeEvent = new CustomEvent('page', {
165
+ detail: newPage,
166
+ bubbles: true,
167
+ composed: true
168
+ });
169
+ this.hostEl.dispatchEvent(pageChangeEvent);
170
+ this.currentPage = newPage;
171
+ }
172
+ }
173
+ render() {
174
+ return h("div", {
175
+ key: '4ebae5738982b21456e2852babeef2f5e2b4b1e0'
176
+ }, this.total > 0 && this.mode === 'default' && h("p", {
177
+ key: '9c18413928a471adb2b6964c78ea3339f251c81b',
178
+ class: "f-ui-03 text-lightest mb-28 w-full text-center"
179
+ }, h("span", {
180
+ key: '3d9d08eaaf7944ef1a6aba9b0912b7d9ebb58e28',
181
+ class: "sr-only"
182
+ }, "Results:"), this.pageResults()), this.mode === 'navigator' || this.lastPage && this.lastPage > 1 ? h("nav", {
183
+ "aria-label": "Pagination"
184
+ }, h("ul", {
185
+ class: "flex items-center justify-center gap-x-8"
186
+ }, h("li", {
187
+ class: "mr-auto"
188
+ }, h("eds-link", {
189
+ label: this.prevLabel,
190
+ url: this.mode === 'navigator' ? this.prevUrl || '#' // Use prevUrl if provided, otherwise disable with '#'
191
+ : this.isFirstPage() ? '#' : this.generateLink(this.currentPage - 1).url,
192
+ disabled: this.mode === 'navigator' ? !this.prevUrl // Disable if prevUrl is not provided
193
+ : this.isFirstPage(),
194
+ "aria-label": "Previous page",
195
+ icon: "chevron-left",
196
+ "icon-pos": "left",
197
+ size: "small",
198
+ "icon-small": "true",
199
+ intent: "strong",
200
+ "hide-label-on-small-screen": true,
201
+ class: "!p-8 lg:!pr-12",
202
+ onClick: event => {
203
+ if (this.mode === 'default') {
204
+ if (this.isFirstPage()) {
205
+ event.preventDefault(); // Prevent click if disabled
206
+ } else {
207
+ this.handlePageClick(event, (this.currentPage || 1) - 1);
208
+ }
209
+ }
210
+ }
211
+ })), this.mode === 'default' && this.links.map((link, index) => h("li", {
212
+ key: index,
213
+ class: "f-ui-02 flex h-36 items-center justify-center"
214
+ }, typeof link === 'string' ? h("span", {
215
+ class: "flex items-center justify-center"
216
+ }, link) : h("eds-link", {
217
+ url: link.url,
218
+ "aria-label": link.ariaLabel,
219
+ label: link.label,
220
+ current: link.current,
221
+ size: "small",
222
+ class: "!p-8",
223
+ intent: link.current ? 'secondary' : 'ghost',
224
+ onClick: event => this.handlePageClick(event, parseInt(link.label))
225
+ }))), h("li", {
226
+ class: "ml-auto"
227
+ }, h("eds-link", {
228
+ label: this.nextLabel,
229
+ url: this.mode === 'navigator' ? this.nextUrl || '#' // Use nextUrl if provided, otherwise disable with '#'
230
+ : this.isLastPage() ? '#' : this.generateLink(this.currentPage + 1).url,
231
+ disabled: this.mode === 'navigator' ? !this.nextUrl // Disable if nextUrl is not provided
232
+ : this.isLastPage(),
233
+ "aria-label": "Next page",
234
+ size: "small",
235
+ "icon-small": "true",
236
+ icon: "chevron-right",
237
+ intent: "strong",
238
+ "hide-label-on-small-screen": true,
239
+ class: "!p-8 lg:!pl-12 flex items-center gap-1 py-4 transition-colors",
240
+ onClick: event => {
241
+ if (this.mode === 'default') {
242
+ if (this.isLastPage()) {
243
+ event.preventDefault(); // Prevent click if disabled
244
+ } else {
245
+ this.handlePageClick(event, (this.currentPage || 1) + 1);
246
+ }
247
+ }
248
+ }
249
+ })))) : null);
250
+ }
251
+ get hostEl() {
252
+ return getElement(this);
253
+ }
254
+ static get watchers() {
255
+ return {
256
+ "currentPage": ["onPageOrLastPageChange"],
257
+ "lastPage": ["onPageOrLastPageChange"]
258
+ };
259
+ }
260
+ };
261
+ EdsPagination.style = EdsPaginationStyle0;
262
+ const edsTableCss = "table{text-indent:0;border-color:inherit;border-collapse:collapse;}.container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.pt-32{padding-top:2rem}.pt-40{padding-top:2.5rem}.pt-48{padding-top:3rem}.pb-28{padding-bottom:1.75rem}.pb-60{padding-bottom:3.75rem}.mt-20{margin-top:1.25rem}.mt-28{margin-top:1.75rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.overflow-x-auto{overflow-x:auto}.mt-6{margin-top:0.375rem}.p-0{padding:0rem}.m-0{margin:0rem}.border{border-width:1px}.border-softer{border:1px solid rgba(0, 0, 0, .1)}.even\\:bg-inverse-softer:nth-child(even){background-color:rgba(255, 255, 255, .15)}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-8{padding-top:0.5rem;padding-bottom:0.5rem}.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)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.text-center{text-align:center}.break-words{overflow-wrap:anywhere}";
263
+ const EdsTableStyle0 = edsTableCss;
264
+ const EdsTable = class {
265
+ constructor(hostRef) {
266
+ registerInstance(this, hostRef);
267
+ this.handleResize = () => {
268
+ this.updateContainerWidth();
269
+ };
270
+ this.data = null;
271
+ this.endpoint = null;
272
+ this.config = {};
273
+ this.rowsPerPage = 10;
274
+ this.paginationEnabled = true;
275
+ this.searchEnabled = false;
276
+ this.hostWidth = undefined;
277
+ this.columnSize = 'default';
278
+ this.tbData = [];
279
+ this.columns = [];
280
+ this.currentPage = 1;
281
+ this.parsedConfig = {};
282
+ this.totalRows = 0;
283
+ this.searchQuery = '';
284
+ this.containerWidth = 0;
285
+ }
286
+ handleDataChange() {
287
+ this.parseData();
288
+ }
289
+ handleConfigChange() {
290
+ this.parseConfig();
291
+ }
292
+ componentWillLoad() {
293
+ this.parseConfig();
294
+ this.data ? this.parseData() : this.endpoint && this.fetchData();
295
+ }
296
+ componentDidLoad() {
297
+ this.updateContainerWidth();
298
+ window.addEventListener('resize', this.handleResize);
299
+ this.setupPaginationListener();
300
+ }
301
+ componentDidUpdate() {
302
+ this.setupPaginationListener();
303
+ }
304
+ disconnectedCallback() {
305
+ window.removeEventListener('resize', this.handleResize);
306
+ }
307
+ updateContainerWidth() {
308
+ // Use hostWidth prop if provided; otherwise, measure parent element
309
+ if (this.hostWidth && this.hostWidth.trim() !== '') {
310
+ this.containerWidth = Number(this.hostWidth);
311
+ } else if (this.hostEl.parentElement instanceof HTMLElement) {
312
+ this.containerWidth = this.hostEl.parentElement.getBoundingClientRect().width;
313
+ } else {
314
+ this.containerWidth = 400;
315
+ }
316
+ }
317
+ parseData() {
318
+ try {
319
+ this.tbData = parseData(this.data);
320
+ //this.tbData = typeof this.data === 'string' ? JSON.parse(this.data) : this.data || [];
321
+ this.totalRows = this.tbData.length;
322
+ this.updateColumns();
323
+ this.currentPage = 1;
324
+ } catch (error) {
325
+ // eslint-disable-next-line
326
+ console.error('Failed to parse data:', error);
327
+ this.tbData = [];
328
+ }
329
+ }
330
+ parseConfig() {
331
+ try {
332
+ //this.parsedConfig = parseData(this.config);
333
+ this.parsedConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
334
+ } catch (error) {
335
+ // eslint-disable-next-line
336
+ console.error('Failed to parse config:', error);
337
+ this.parsedConfig = {};
338
+ }
339
+ }
340
+ async fetchData() {
341
+ try {
342
+ const response = await fetch(this.endpoint);
343
+ const data = await response.json();
344
+ this.data = data;
345
+ } catch (error) {
346
+ // eslint-disable-next-line
347
+ console.error('Failed to fetch data:', error);
348
+ }
349
+ }
350
+ setupPaginationListener() {
351
+ if (!this.shouldEnablePagination()) {
352
+ return;
353
+ }
354
+ const paginationEl = this.hostEl.shadowRoot.querySelector('eds-pagination');
355
+ if (paginationEl && !paginationEl.hasAttribute('listener-attached')) {
356
+ paginationEl.addEventListener('page', event => this.handlePageChange(event.detail));
357
+ paginationEl.setAttribute('listener-attached', 'true');
358
+ }
359
+ }
360
+ getFilteredRows() {
361
+ return this.tbData.filter(row => Object.values(row).some(value => value.toString().toLowerCase().includes(this.searchQuery.toLowerCase())));
362
+ }
363
+ getPaginatedRows() {
364
+ const filteredRows = this.getFilteredRows();
365
+ this.totalRows = filteredRows.length;
366
+ const start = (this.currentPage - 1) * this.rowsPerPage;
367
+ return filteredRows.slice(start, start + this.rowsPerPage);
368
+ }
369
+ handlePageChange(newPage) {
370
+ this.currentPage = newPage;
371
+ sendAnalytics({
372
+ category: 'ui-component',
373
+ parentContext: null,
374
+ tag: `${this.hostEl.tagName.toLowerCase()}/eds-pagination`,
375
+ name: `${newPage}` || '',
376
+ action: 'page'
377
+ });
378
+ }
379
+ handleSearch(event) {
380
+ this.searchQuery = event.target.value;
381
+ this.currentPage = 1;
382
+ /*sendAnalytics({
383
+ category: 'ui-component',
384
+ parentContext: null,
385
+ tag: `${this.hostEl.tagName.toLowerCase()}/eds-input-field/search`,
386
+ name: `${this.searchQuery}` || '',
387
+ action: 'page'
388
+ });*/
389
+ }
390
+ renderCell(value, column) {
391
+ var _a;
392
+ const format = (_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.format;
393
+ return format === 'uppercase' ? value === null || value === void 0 ? void 0 : value.toString().toUpperCase() : format === 'svg' ? h("div", {
394
+ innerHTML: value
395
+ }) : format === 'bold' ? h("strong", null, value) : format === 'code' ? h("code", null, value) : value;
396
+ }
397
+ shouldEnablePagination() {
398
+ return this.paginationEnabled && this.totalRows > this.rowsPerPage;
399
+ }
400
+ updateColumns() {
401
+ this.columns = this.tbData.length > 0 ? Object.keys(this.tbData[0]) : [];
402
+ }
403
+ getVisibleColumnsCount() {
404
+ return this.columns.filter(column => {
405
+ var _a;
406
+ return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden);
407
+ }).length;
408
+ }
409
+ divisionFactor() {
410
+ let divisionFactor = 1;
411
+ if (this.columnSize === 'medium') {
412
+ divisionFactor = 2;
413
+ } else if (this.columnSize === 'large') {
414
+ divisionFactor = 4;
415
+ }
416
+ return divisionFactor;
417
+ }
418
+ render() {
419
+ // Use containerWidth state that is updated on resize.
420
+ const currentContainerWidth = this.hostWidth && this.hostWidth.trim() !== '' ? Number(this.hostWidth) : this.containerWidth || 400;
421
+ // Calculate the number of visible columns and the column width.
422
+ const visibleColumnsCount = this.getVisibleColumnsCount();
423
+ const columnWidth = visibleColumnsCount > 0 ? Math.floor(currentContainerWidth / visibleColumnsCount * this.divisionFactor()) : 100;
424
+ const paginatedRows = this.getPaginatedRows();
425
+ const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
426
+ return h("div", {
427
+ key: 'a9df6351c49bb17abebfaf3640c71a7c7d15cb61'
428
+ }, this.searchEnabled && h("div", {
429
+ key: 'feb5708050593e791835456e6d2244332cee6062'
430
+ }, h("eds-input-field", {
431
+ key: 1,
432
+ name: "search",
433
+ "aria-label": "Search",
434
+ type: "text",
435
+ placeholder: "Search...",
436
+ // @ts-ignore
437
+ onInput: event => this.handleSearch(event)
438
+ })), h("div", {
439
+ key: '88dcb3d9e984a77f54735fa352c811dbf4745838',
440
+ class: "mt-20"
441
+ }, h("table", {
442
+ key: '32ff7b76066a96bce51f885e8339c258fdecd0c6',
443
+ class: "block overflow-x-auto mt-6 p-0"
444
+ }, h("thead", {
445
+ key: '9f4bbf0725c618c8c2f8a3b90d6d2f2a7f9c0186'
446
+ }, h("tr", {
447
+ key: 'd8f24a31aad07b667ae9cc06257ddddf529f8e31',
448
+ class: "m-0 p-0 border border-softer even:bg-inverse-softer"
449
+ }, this.columns.map(column => {
450
+ var _a;
451
+ return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("th", {
452
+ class: "m-0 py-8 border border-softer f-ui-02 break-words",
453
+ style: {
454
+ minWidth: `${columnWidth - 4}px`
455
+ }
456
+ }, column);
457
+ }))), h("tbody", {
458
+ key: '932e2f9cbd51d1115eef42f8b1acb7bb58ccdab7'
459
+ }, paginatedRows.map(row => h("tr", {
460
+ class: "m-0 p-0 border border-softer even:bg-inverse-softer"
461
+ }, this.columns.map(column => {
462
+ var _a;
463
+ return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("td", {
464
+ class: "text-center border border-softer m-0 py-8 f-ui-2 break-words",
465
+ style: {
466
+ minWidth: `${columnWidth - 4}px`
467
+ }
468
+ }, this.renderCell(row[column], column));
469
+ })))))), this.shouldEnablePagination() && h("div", {
470
+ key: '6368d38cec298dc8efa1a790d6b0cb93357f0ae5',
471
+ class: "mt-20"
472
+ }, h("eds-pagination", {
473
+ key: '2183eb4a6861a0e42538706bd0c9fe10a1e5d8bd',
474
+ currentPage: this.currentPage,
475
+ lastPage: lastPage,
476
+ perPage: this.rowsPerPage,
477
+ total: this.totalRows,
478
+ mode: "default"
479
+ })));
480
+ }
481
+ get hostEl() {
482
+ return getElement(this);
483
+ }
484
+ static get watchers() {
485
+ return {
486
+ "data": ["handleDataChange", "parseData"],
487
+ "config": ["handleConfigChange"]
488
+ };
489
+ }
490
+ };
491
+ EdsTable.style = EdsTableStyle0;
492
+
493
+ export { EdsPagination as eds_pagination, EdsTable as eds_table };
@@ -20,7 +20,7 @@ const EdsProgressBar = class {
20
20
  render() {
21
21
  const progressValue = this.value;
22
22
  return h("div", {
23
- key: '9a7fa42058034305b22818d464e7b633d7831d67',
23
+ key: '259c247cbf6269d1118b652c70cc45e6ea9192b5',
24
24
  role: "progressbar",
25
25
  "aria-valuemin": "0",
26
26
  "aria-valuemax": "100",
@@ -28,7 +28,7 @@ const EdsProgressBar = class {
28
28
  "aria-valuetext": `${progressValue}%`,
29
29
  class: "outer w-full bg-default rounded-lg h-24 border border-softer overflow-hidden"
30
30
  }, h("div", {
31
- key: '90b0ac9a538b575a30163c0dbbf437e1cfe8ce39',
31
+ key: 'e6141a6aa1eb8d1f9562028d95f6dfffc2777b11',
32
32
  class: `inner h-full rounded-lg bg-accent transition-all duration-300 flex items-center justify-center text-default f-body-02`,
33
33
  style: {
34
34
  width: `${progressValue}%`
@@ -48,7 +48,7 @@ const EdsRating = class {
48
48
  }
49
49
  render() {
50
50
  return h("div", {
51
- key: '2ab4f3dbc4cc3dd5272143e99c67b23086b03e18',
51
+ key: '34344f12d4ca8a80fe7c96537d417c199421e139',
52
52
  role: "radiogroup",
53
53
  class: "stars flex space-x-1 my-8"
54
54
  }, Array.from({
@@ -15,13 +15,13 @@ const EdsSectionCore = class {
15
15
  render() {
16
16
  const TagType = this.tag; // Set dynamic tag type (div or section)
17
17
  return h(TagType, {
18
- key: '39c4280156ca46b83538de499baa9b152360b1b4'
18
+ key: '81d5d6f6010c56bb217b32fa520fdaf96e1c7adc'
19
19
  }, h("eds-section-heading", {
20
- key: '34da742e606f0e9bb485faac8aba1519eccc8934',
20
+ key: 'c47dda41c2f553ef87f432109ead4bd0debcd99c',
21
21
  headingLevel: this.headingLevel,
22
22
  sectionTitle: this.sectionTitle
23
23
  }), h("slot", {
24
- key: '517b8ecc112565e8c6bb0bf85b02525deaa6f9df'
24
+ key: '9276798e2c581440c46ff9914809e87203a86b1b'
25
25
  }));
26
26
  }
27
27
  };
@@ -52,15 +52,15 @@ const EdsSectionHeading = class {
52
52
  const TagType = this.tag; // Dynamically set tag type for the container
53
53
  const HeadingTag = this.headingLevel; // Dynamically set heading level
54
54
  return h(TagType, {
55
- key: '766d3f317904f2d735b7b531cf6ad582f22084e3',
55
+ key: '6741f5bbede7d44109c5e60f92290d4b2eda4d42',
56
56
  class: {
57
- 'ui-section-header flex flex-wrap items-center justify-between gap-x-12 gap-y-8 pb-20': true,
57
+ 'ui-section-header flex flex-wrap items-center justify-between gap-x-12 gap-y-8': true,
58
58
  container: this.withContainer,
59
59
  'pt-48': this.spacingLarge,
60
60
  'pt-28': !this.spacingLarge
61
61
  }
62
62
  }, h(HeadingTag, {
63
- key: '41a9db3f627cf93f58d14cdebf3b991be6a6facf',
63
+ key: 'cc65df919db1dc1d5725116ce1ab473319185901',
64
64
  class: this.getHeadingClass()
65
65
  }, this.sectionTitle));
66
66
  }
@@ -50,13 +50,13 @@ const EdsSpinner = class {
50
50
  justifyContent: 'center'
51
51
  };
52
52
  return h(Host, {
53
- key: '1e1e4ea2734fff8a680e55ca5163e69d2000a55d'
53
+ key: '49a825afb039ee46b26609eea60109e0a060c104'
54
54
  }, h("div", {
55
- key: 'acf09f69d43404f317240c0d24e644ec0d046cd7',
55
+ key: '6445a4e7f1e7c553bdee660c42f1db0e011443f2',
56
56
  class: "spinner-overlay",
57
57
  style: overlayStyle
58
58
  }, h("span", {
59
- key: '3728629fdff738a0b753cd499dc26052b1e3cb7b',
59
+ key: '07feeb7736e6d306e2b7baf5d253b2ce96bb2c9e',
60
60
  class: "spinner",
61
61
  style: spinnerStyle
62
62
  })));