@ebrains/react 0.0.1-alpha.0 → 0.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -48
- package/arrow-diagonal-black-8f0494c3.esm.js +3 -0
- package/arrow-right-9322ba8a.esm.js +5 -0
- package/bluesky-cc5edd2d.esm.js +14 -0
- package/chevron-down-6144c823.esm.js +12 -0
- package/chevron-left-ca6c66e1.esm.js +11 -0
- package/chevron-right-b88ed2d4.esm.js +5 -0
- package/chevron-up-c66bd477.esm.js +12 -0
- package/close-87fc0d63.esm.js +5 -0
- package/color-0ba8ed56.esm.js +423 -0
- package/color-primary-palette_6.entry.esm.js +756 -0
- package/copy-03b72cb6.esm.js +5 -0
- package/correct-use-of-colors.entry.esm.js +243 -0
- package/eds-accordion.entry.esm.js +132 -0
- package/eds-alert.entry.esm.js +102 -0
- package/eds-avatar_17.entry.esm.js +209 -0
- package/eds-card-desc_3.entry.esm.js +129 -0
- package/eds-card-generic.entry.esm.js +125 -0
- package/eds-card-project.entry.esm.js +92 -0
- package/eds-card-section.entry.esm.js +70 -0
- package/eds-card-tags.entry.esm.js +27 -0
- package/eds-card-tool.entry.esm.js +106 -0
- package/eds-card-wrapper.entry.esm.js +39 -0
- package/eds-code-block.entry.esm.js +2243 -0
- package/eds-components-section.entry.esm.js +146 -0
- package/eds-docs-palettes.entry.esm.js +29 -0
- package/eds-docs-tokens.entry.esm.js +45 -0
- package/eds-form.entry.esm.js +374 -0
- package/eds-frame.entry.esm.js +117 -0
- package/eds-icon-arrow-diagonal.entry.esm.js +21 -0
- package/eds-icon-arrow-right.entry.esm.js +21 -0
- package/eds-icon-bluesky.entry.esm.js +21 -0
- package/eds-icon-chevron-down.entry.esm.js +21 -0
- package/eds-icon-chevron-left.entry.esm.js +21 -0
- package/eds-icon-chevron-right.entry.esm.js +21 -0
- package/eds-icon-chevron-up.entry.esm.js +21 -0
- package/eds-icon-close.entry.esm.js +21 -0
- package/eds-icon-copy.entry.esm.js +21 -0
- package/eds-icon-eu.entry.esm.js +21 -0
- package/eds-icon-facebook.entry.esm.js +21 -0
- package/eds-icon-gitlab.entry.esm.js +21 -0
- package/eds-icon-linkedin.entry.esm.js +21 -0
- package/eds-icon-loader.entry.esm.js +21 -0
- package/eds-icon-mastodon.entry.esm.js +21 -0
- package/eds-icon-menu.entry.esm.js +21 -0
- package/eds-icon-more.entry.esm.js +21 -0
- package/eds-icon-search.entry.esm.js +21 -0
- package/eds-icon-success.entry.esm.js +21 -0
- package/eds-icon-twitter.entry.esm.js +21 -0
- package/eds-icon-user.entry.esm.js +21 -0
- package/eds-icon-youtube.entry.esm.js +21 -0
- package/eds-input_7.entry.esm.js +518 -0
- package/eds-login.entry.esm.js +76 -0
- package/eds-logo-variations.entry.esm.js +29 -0
- package/eds-matomo-notice.entry.esm.js +129 -0
- package/eds-modal.entry.esm.js +114 -0
- package/eds-navigator.entry.esm.js +72 -0
- package/eds-pagination_2.entry.esm.js +456 -0
- package/eds-progress-bar.entry.esm.js +36 -0
- package/eds-rating.entry.esm.js +71 -0
- package/eds-section-core_2.entry.esm.js +69 -0
- package/eds-svg-repository.entry.esm.js +325 -0
- package/eds-tab.entry.esm.js +41 -0
- package/eds-tabs-content.entry.esm.js +145 -0
- package/eds-tabs.entry.esm.js +155 -0
- package/eds-timeline.entry.esm.js +130 -0
- package/eds-tooltip.entry.esm.js +116 -0
- package/eds-trl.entry.esm.js +69 -0
- package/eu-9ddde93a.esm.js +30 -0
- package/facebook-9cb5c17f.esm.js +14 -0
- package/incorrect-use-of-colors.entry.esm.js +71 -0
- package/index-39c58238.esm.js +58 -0
- package/index.esm.js +3 -2668
- package/index.esm2.js +4791 -0
- package/keycloak-13893af6.esm.js +1594 -0
- package/linkedin-e8650abb.esm.js +28 -0
- package/loader-c9628637.esm.js +30 -0
- package/logo-color-7f1fd803.esm.js +115 -0
- package/logo-color-margins-ff8ce71b.esm.js +118 -0
- package/logo-space.entry.esm.js +32 -0
- package/logo-variations-horizontal_2.entry.esm.js +116 -0
- package/logo-white-no-bg-f382f86f.esm.js +1021 -0
- package/logo-wrong-usage.entry.esm.js +137 -0
- package/mastodon-3703ec61.esm.js +14 -0
- package/menu-340ea948.esm.js +11 -0
- package/mono-53f70232.esm.js +11 -0
- package/more-4449d549.esm.js +13 -0
- package/package.json +1 -1
- package/search-fbcd79c2.esm.js +12 -0
- package/src/components.d.ts +40 -0
- package/src/index.d.ts +1 -1
- package/src/react-component-lib/attachProps.d.ts +16 -0
- package/src/react-component-lib/case.d.ts +2 -0
- package/src/react-component-lib/createComponent.d.ts +10 -0
- package/src/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/src/react-component-lib/dev.d.ts +2 -0
- package/src/react-component-lib/index.d.ts +2 -0
- package/src/react-component-lib/interfaces.d.ts +29 -0
- package/src/react-component-lib/utils/attachProps.d.ts +16 -0
- package/src/react-component-lib/utils/case.d.ts +2 -0
- package/src/react-component-lib/utils/index.d.ts +10 -0
- package/success-443809da.esm.js +18 -0
- package/toastManager-d9eee791.esm.js +34 -0
- package/token-list_3.entry.esm.js +385 -0
- package/token-ratios.entry.esm.js +49 -0
- package/token-spacing.entry.esm.js +93 -0
- package/token-typography.entry.esm.js +264 -0
- package/twitter-ac21b505.esm.js +14 -0
- package/user-71ebdc15.esm.js +16 -0
- package/youtube-efbfbdc4.esm.js +14 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index.esm2.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react-dom';
|
|
5
|
+
|
|
6
|
+
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}}";
|
|
7
|
+
const EdsPaginationStyle0 = edsPaginationCss;
|
|
8
|
+
const EdsPagination = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.currentPage = undefined;
|
|
12
|
+
this.lastPage = undefined;
|
|
13
|
+
this.perPage = 10;
|
|
14
|
+
this.total = 0;
|
|
15
|
+
this.url = '';
|
|
16
|
+
this.mode = 'default';
|
|
17
|
+
this.prevLabel = 'Prev';
|
|
18
|
+
this.nextLabel = 'Next';
|
|
19
|
+
this.prevUrl = '';
|
|
20
|
+
this.nextUrl = '';
|
|
21
|
+
this.links = [];
|
|
22
|
+
}
|
|
23
|
+
/** Lifecycle hook to generate pagination links on component load */
|
|
24
|
+
componentWillLoad() {
|
|
25
|
+
if (this.mode === 'default') {
|
|
26
|
+
this.generateLinks();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
componentDidLoad() {
|
|
30
|
+
// Emit context for each eds-link element after the component is fully loaded
|
|
31
|
+
const links = this.hostEl.shadowRoot.querySelectorAll('eds-link');
|
|
32
|
+
if (links.length > 0) {
|
|
33
|
+
// Emit context for the first link
|
|
34
|
+
this.emitContext(links[0]);
|
|
35
|
+
// Emit context for the last link, if it's different from the first
|
|
36
|
+
if (links.length > 1) {
|
|
37
|
+
this.emitContext(links[links.length - 1]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Emits a custom event called `parentContext` for a given link element.
|
|
43
|
+
* This event provides context information about the breadcrumb component.
|
|
44
|
+
*
|
|
45
|
+
* @param linkElement - The link element to which the event will be dispatched.
|
|
46
|
+
*/
|
|
47
|
+
emitContext(linkElement) {
|
|
48
|
+
const event = new CustomEvent('parentContext', {
|
|
49
|
+
detail: {
|
|
50
|
+
componentName: this.hostEl.tagName.toLowerCase(),
|
|
51
|
+
identifier: null
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
linkElement.dispatchEvent(event);
|
|
55
|
+
}
|
|
56
|
+
onPageOrLastPageChange() {
|
|
57
|
+
if (this.mode === 'default') {
|
|
58
|
+
this.generateLinks();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks if the current page is the first page
|
|
63
|
+
* @returns {boolean} - true if current page is the first page
|
|
64
|
+
*/
|
|
65
|
+
isFirstPage() {
|
|
66
|
+
return this.currentPage === 1;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Checks if the current page is the last page
|
|
70
|
+
* @returns {boolean} - true if current page is the last page
|
|
71
|
+
*/
|
|
72
|
+
isLastPage() {
|
|
73
|
+
return this.currentPage === this.lastPage;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generates a pagination link object
|
|
77
|
+
* @param {number} page - Page number for the link
|
|
78
|
+
* @returns {Link} - Link object with page details
|
|
79
|
+
*/
|
|
80
|
+
generateLink(page) {
|
|
81
|
+
const urlHasQuery = this.url.includes('?');
|
|
82
|
+
return {
|
|
83
|
+
ariaLabel: `Page ${page}`,
|
|
84
|
+
url: `${this.url}${urlHasQuery ? '&' : '?'}page=${page}`,
|
|
85
|
+
label: page.toString(),
|
|
86
|
+
current: this.currentPage === page,
|
|
87
|
+
disabled: false
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Generates pagination links based on the last page and current page */
|
|
91
|
+
generateLinks() {
|
|
92
|
+
if (this.lastPage && this.lastPage > 5) {
|
|
93
|
+
this.links = this.getPaginationGenerator(this.currentPage || 1, this.lastPage).map(page => typeof page === 'number' ? this.generateLink(page) : page);
|
|
94
|
+
} else if (this.lastPage) {
|
|
95
|
+
this.links = Array.from({
|
|
96
|
+
length: this.lastPage
|
|
97
|
+
}).map((_, i) => this.generateLink(i + 1));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Creates a pagination range based on delta, current, and total pages
|
|
102
|
+
* @param {number} current - Current page number
|
|
103
|
+
* @param {number} total - Total number of pages
|
|
104
|
+
* @param {number} delta - Range of pages to display around the current page
|
|
105
|
+
* @returns {(number | string)[]} - Range of page numbers or ellipses
|
|
106
|
+
*/
|
|
107
|
+
getPaginationGenerator(current, total) {
|
|
108
|
+
const delta = 1; // Show one page before and one after the current page
|
|
109
|
+
const range = [];
|
|
110
|
+
if (total <= 5) {
|
|
111
|
+
// If total pages are 5 or less, show all pages
|
|
112
|
+
for (let i = 1; i <= total; i++) {
|
|
113
|
+
range.push(i);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
// Always show the first page
|
|
117
|
+
range.push(1);
|
|
118
|
+
// Add ellipsis if there’s a gap between the first page and the current range start
|
|
119
|
+
if (current - delta > 2) {
|
|
120
|
+
range.push('...');
|
|
121
|
+
}
|
|
122
|
+
// Determine range for pages around the current page
|
|
123
|
+
for (let i = Math.max(2, current - delta); i <= Math.min(total - 1, current + delta); i++) {
|
|
124
|
+
range.push(i);
|
|
125
|
+
}
|
|
126
|
+
// Add ellipsis if there’s a gap between the current range end and the last page
|
|
127
|
+
if (current + delta < total - 1) {
|
|
128
|
+
range.push('...');
|
|
129
|
+
}
|
|
130
|
+
// Always show the last page
|
|
131
|
+
range.push(total);
|
|
132
|
+
}
|
|
133
|
+
return range;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Formats the current page results information for display
|
|
137
|
+
* @returns {string} - Formatted page result information
|
|
138
|
+
*/
|
|
139
|
+
pageResults() {
|
|
140
|
+
if (this.total > 0) {
|
|
141
|
+
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}`;
|
|
142
|
+
}
|
|
143
|
+
return '';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Handles a page click event, updating the current page and dispatching an event
|
|
147
|
+
* @param {MouseEvent} event - Click event
|
|
148
|
+
* @param {number} newPage - New page number
|
|
149
|
+
*/
|
|
150
|
+
handlePageClick(event, newPage) {
|
|
151
|
+
if (this.mode === 'navigator') {
|
|
152
|
+
return; // No page clicking logic for navigator mode
|
|
153
|
+
}
|
|
154
|
+
event.preventDefault(); // Prevent default link navigation
|
|
155
|
+
if (newPage !== this.currentPage) {
|
|
156
|
+
this.links = this.links.map(link => typeof link === 'object' ? Object.assign(Object.assign({}, link), {
|
|
157
|
+
current: parseInt(link.label) === newPage
|
|
158
|
+
}) : link);
|
|
159
|
+
const pageChangeEvent = new CustomEvent('pageChange', {
|
|
160
|
+
detail: newPage,
|
|
161
|
+
bubbles: true,
|
|
162
|
+
composed: true
|
|
163
|
+
});
|
|
164
|
+
this.hostEl.dispatchEvent(pageChangeEvent);
|
|
165
|
+
this.currentPage = newPage;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
render() {
|
|
169
|
+
return h("div", {
|
|
170
|
+
key: '2385b59b0a8b2bbdc40bfc5032b846c0ec20065e'
|
|
171
|
+
}, this.total > 0 && this.mode === 'default' && h("p", {
|
|
172
|
+
key: '6aea281a4df247874f354469bbabae039424ad9e',
|
|
173
|
+
class: "f-ui-03 text-lightest mb-28 w-full text-center"
|
|
174
|
+
}, h("span", {
|
|
175
|
+
key: 'eeb5f0ea902505c3853a30d51026cef9d9785e48',
|
|
176
|
+
class: "sr-only"
|
|
177
|
+
}, "Results:"), this.pageResults()), this.mode === 'navigator' || this.lastPage && this.lastPage > 1 ? h("nav", {
|
|
178
|
+
"aria-label": "Pagination"
|
|
179
|
+
}, h("ul", {
|
|
180
|
+
class: "flex items-center justify-center gap-x-8"
|
|
181
|
+
}, h("li", {
|
|
182
|
+
class: "mr-auto"
|
|
183
|
+
}, h("eds-link", {
|
|
184
|
+
label: this.prevLabel,
|
|
185
|
+
url: this.mode === 'navigator' ? this.prevUrl || '#' // Use prevUrl if provided, otherwise disable with '#'
|
|
186
|
+
: this.isFirstPage() ? '#' : this.generateLink(this.currentPage - 1).url,
|
|
187
|
+
disabled: this.mode === 'navigator' ? !this.prevUrl // Disable if prevUrl is not provided
|
|
188
|
+
: this.isFirstPage(),
|
|
189
|
+
"aria-label": "Previous page",
|
|
190
|
+
icon: "chevron-left",
|
|
191
|
+
"icon-pos": "left",
|
|
192
|
+
size: "small",
|
|
193
|
+
"icon-small": "true",
|
|
194
|
+
intent: "strong",
|
|
195
|
+
"hide-label-on-small-screen": true,
|
|
196
|
+
class: "!p-8 lg:!pr-12",
|
|
197
|
+
onClick: event => {
|
|
198
|
+
if (this.mode === 'default') {
|
|
199
|
+
if (this.isFirstPage()) {
|
|
200
|
+
event.preventDefault(); // Prevent click if disabled
|
|
201
|
+
} else {
|
|
202
|
+
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
})), this.mode === 'default' && this.links.map((link, index) => h("li", {
|
|
207
|
+
key: index,
|
|
208
|
+
class: "f-ui-02 flex h-36 items-center justify-center"
|
|
209
|
+
}, typeof link === 'string' ? h("span", {
|
|
210
|
+
class: "flex items-center justify-center"
|
|
211
|
+
}, link) : h("eds-link", {
|
|
212
|
+
url: link.url,
|
|
213
|
+
"aria-label": link.ariaLabel,
|
|
214
|
+
label: link.label,
|
|
215
|
+
current: link.current,
|
|
216
|
+
size: "small",
|
|
217
|
+
class: "!p-8",
|
|
218
|
+
intent: link.current ? 'secondary' : 'ghost',
|
|
219
|
+
onClick: event => this.handlePageClick(event, parseInt(link.label))
|
|
220
|
+
}))), h("li", {
|
|
221
|
+
class: "ml-auto"
|
|
222
|
+
}, h("eds-link", {
|
|
223
|
+
label: this.nextLabel,
|
|
224
|
+
url: this.mode === 'navigator' ? this.nextUrl || '#' // Use nextUrl if provided, otherwise disable with '#'
|
|
225
|
+
: this.isLastPage() ? '#' : this.generateLink(this.currentPage + 1).url,
|
|
226
|
+
disabled: this.mode === 'navigator' ? !this.nextUrl // Disable if nextUrl is not provided
|
|
227
|
+
: this.isLastPage(),
|
|
228
|
+
"aria-label": "Next page",
|
|
229
|
+
size: "small",
|
|
230
|
+
"icon-small": "true",
|
|
231
|
+
icon: "chevron-right",
|
|
232
|
+
intent: "strong",
|
|
233
|
+
"hide-label-on-small-screen": true,
|
|
234
|
+
class: "!p-8 lg:!pl-12 flex items-center gap-1 py-4 transition-colors",
|
|
235
|
+
onClick: event => {
|
|
236
|
+
if (this.mode === 'default') {
|
|
237
|
+
if (this.isLastPage()) {
|
|
238
|
+
event.preventDefault(); // Prevent click if disabled
|
|
239
|
+
} else {
|
|
240
|
+
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
})))) : null);
|
|
245
|
+
}
|
|
246
|
+
get hostEl() {
|
|
247
|
+
return getElement(this);
|
|
248
|
+
}
|
|
249
|
+
static get watchers() {
|
|
250
|
+
return {
|
|
251
|
+
"currentPage": ["onPageOrLastPageChange"],
|
|
252
|
+
"lastPage": ["onPageOrLastPageChange"]
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
EdsPagination.style = EdsPaginationStyle0;
|
|
257
|
+
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}";
|
|
258
|
+
const EdsTableStyle0 = edsTableCss;
|
|
259
|
+
const EdsTable = class {
|
|
260
|
+
constructor(hostRef) {
|
|
261
|
+
registerInstance(this, hostRef);
|
|
262
|
+
this.data = null;
|
|
263
|
+
this.endpoint = null;
|
|
264
|
+
this.config = {};
|
|
265
|
+
this.rowsPerPage = 10;
|
|
266
|
+
this.paginationEnabled = true;
|
|
267
|
+
this.searchEnabled = false;
|
|
268
|
+
this.hostWidth = undefined;
|
|
269
|
+
this.columnSize = 'default';
|
|
270
|
+
this.tableData = [];
|
|
271
|
+
this.columns = [];
|
|
272
|
+
this.currentPage = 1;
|
|
273
|
+
this.parsedConfig = {};
|
|
274
|
+
this.totalRows = 0;
|
|
275
|
+
this.searchQuery = '';
|
|
276
|
+
}
|
|
277
|
+
handleDataChange() {
|
|
278
|
+
this.parseData();
|
|
279
|
+
}
|
|
280
|
+
handleConfigChange() {
|
|
281
|
+
this.parseConfig();
|
|
282
|
+
}
|
|
283
|
+
componentWillLoad() {
|
|
284
|
+
this.parseConfig();
|
|
285
|
+
this.data ? this.parseData() : this.endpoint && this.fetchData();
|
|
286
|
+
}
|
|
287
|
+
componentDidLoad() {
|
|
288
|
+
this.setupPaginationListener();
|
|
289
|
+
}
|
|
290
|
+
componentDidUpdate() {
|
|
291
|
+
this.setupPaginationListener();
|
|
292
|
+
}
|
|
293
|
+
parseData() {
|
|
294
|
+
try {
|
|
295
|
+
this.tableData = typeof this.data === 'string' ? JSON.parse(this.data) : this.data || [];
|
|
296
|
+
this.totalRows = this.tableData.length;
|
|
297
|
+
this.updateColumns();
|
|
298
|
+
this.currentPage = 1;
|
|
299
|
+
} catch (error) {
|
|
300
|
+
// eslint-disable-next-line
|
|
301
|
+
console.error('Failed to parse data:', error);
|
|
302
|
+
this.tableData = [];
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
parseConfig() {
|
|
306
|
+
try {
|
|
307
|
+
this.parsedConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
|
|
308
|
+
} catch (error) {
|
|
309
|
+
// eslint-disable-next-line
|
|
310
|
+
console.error('Failed to parse config:', error);
|
|
311
|
+
this.parsedConfig = {};
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async fetchData() {
|
|
315
|
+
try {
|
|
316
|
+
const response = await fetch(this.endpoint);
|
|
317
|
+
const data = await response.json();
|
|
318
|
+
this.data = data;
|
|
319
|
+
} catch (error) {
|
|
320
|
+
// eslint-disable-next-line
|
|
321
|
+
console.error('Failed to fetch data:', error);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
setupPaginationListener() {
|
|
325
|
+
if (!this.shouldEnablePagination()) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const paginationEl = this.hostEl.shadowRoot.querySelector('eds-pagination');
|
|
329
|
+
if (paginationEl && !paginationEl.hasAttribute('listener-attached')) {
|
|
330
|
+
paginationEl.addEventListener('pageChange', event => this.handlePageChange(event.detail));
|
|
331
|
+
paginationEl.setAttribute('listener-attached', 'true');
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
getFilteredRows() {
|
|
335
|
+
return this.tableData.filter(row => Object.values(row).some(value => value.toString().toLowerCase().includes(this.searchQuery.toLowerCase())));
|
|
336
|
+
}
|
|
337
|
+
getPaginatedRows() {
|
|
338
|
+
const filteredRows = this.getFilteredRows();
|
|
339
|
+
this.totalRows = filteredRows.length;
|
|
340
|
+
const start = (this.currentPage - 1) * this.rowsPerPage;
|
|
341
|
+
return filteredRows.slice(start, start + this.rowsPerPage);
|
|
342
|
+
}
|
|
343
|
+
handlePageChange(newPage) {
|
|
344
|
+
this.currentPage = newPage;
|
|
345
|
+
}
|
|
346
|
+
handleSearch(event) {
|
|
347
|
+
this.searchQuery = event.target.value;
|
|
348
|
+
this.currentPage = 1;
|
|
349
|
+
}
|
|
350
|
+
renderCell(value, column) {
|
|
351
|
+
var _a;
|
|
352
|
+
const format = (_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.format;
|
|
353
|
+
return format === 'uppercase' ? value === null || value === void 0 ? void 0 : value.toString().toUpperCase() : format === 'svg' ? h("div", {
|
|
354
|
+
innerHTML: value
|
|
355
|
+
}) : format === 'bold' ? h("strong", null, value) : format === 'code' ? h("code", null, value) : value;
|
|
356
|
+
}
|
|
357
|
+
shouldEnablePagination() {
|
|
358
|
+
return this.paginationEnabled && this.totalRows > this.rowsPerPage;
|
|
359
|
+
}
|
|
360
|
+
updateColumns() {
|
|
361
|
+
this.columns = this.tableData.length > 0 ? Object.keys(this.tableData[0]) : [];
|
|
362
|
+
}
|
|
363
|
+
getVisibleColumnsCount() {
|
|
364
|
+
return this.columns.filter(column => {
|
|
365
|
+
var _a;
|
|
366
|
+
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden);
|
|
367
|
+
}).length;
|
|
368
|
+
}
|
|
369
|
+
divisionFactor() {
|
|
370
|
+
let divisionFactor = 1;
|
|
371
|
+
if (this.columnSize === 'medium') {
|
|
372
|
+
divisionFactor = 2;
|
|
373
|
+
} else if (this.columnSize === 'large') {
|
|
374
|
+
divisionFactor = 4;
|
|
375
|
+
}
|
|
376
|
+
return divisionFactor;
|
|
377
|
+
}
|
|
378
|
+
render() {
|
|
379
|
+
// Get the paginated rows and calculate the last page.
|
|
380
|
+
const paginatedRows = this.getPaginatedRows();
|
|
381
|
+
const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
|
|
382
|
+
// Determine the number of visible columns (i.e., those not hidden via config)
|
|
383
|
+
const visibleColumnsCount = this.getVisibleColumnsCount();
|
|
384
|
+
/// Calculate container width based on the optional prop or parent's measured width.
|
|
385
|
+
const containerWidth = this.hostWidth && this.hostWidth.trim() !== '' ? Number(this.hostWidth) : this.hostEl.parentElement instanceof HTMLElement ? this.hostEl.parentElement.getBoundingClientRect().width : this.hostEl.getRootNode().host instanceof HTMLElement ? this.hostEl.getRootNode().host.getBoundingClientRect().width : 400;
|
|
386
|
+
//console.log('containerWidth:', containerWidth);
|
|
387
|
+
const columnWidth = visibleColumnsCount > 0 ? Math.floor(containerWidth / visibleColumnsCount * this.divisionFactor()) : 100;
|
|
388
|
+
console.log('columnWidth:', columnWidth);
|
|
389
|
+
return h("div", {
|
|
390
|
+
key: '178a33c07e6eae9d5edc170f842b6ef29ae21d9c'
|
|
391
|
+
}, this.searchEnabled && h("div", {
|
|
392
|
+
key: 'f1212a4e515a1db218df28b71367c6ffa42e3063'
|
|
393
|
+
}, h("eds-input-field", {
|
|
394
|
+
key: 1,
|
|
395
|
+
name: "search",
|
|
396
|
+
"aria-label": "Search",
|
|
397
|
+
type: "text",
|
|
398
|
+
placeholder: "Search...",
|
|
399
|
+
// @ts-ignore
|
|
400
|
+
onInput: event => this.handleSearch(event)
|
|
401
|
+
})), h("div", {
|
|
402
|
+
key: 'da6ac91e4b4d56780b044a3d35088e7722efe143',
|
|
403
|
+
class: "mt-20"
|
|
404
|
+
}, h("table", {
|
|
405
|
+
key: '3c5734d2370b31d2445ed4f043a80bf87c6d4bde',
|
|
406
|
+
class: "block overflow-x-auto mt-6 p-0"
|
|
407
|
+
}, h("thead", {
|
|
408
|
+
key: '3803a39b4c987ff39bf22e2567bd1bc3d513e1f4'
|
|
409
|
+
}, h("tr", {
|
|
410
|
+
key: 'a67fa7bdd48549c69cfa9721083a908ab036a559',
|
|
411
|
+
class: "m-0 p-0 border border-softer even:bg-inverse-softer"
|
|
412
|
+
}, this.columns.map(column => {
|
|
413
|
+
var _a;
|
|
414
|
+
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("th", {
|
|
415
|
+
class: "m-0 py-8 border border-softer f-ui-02 break-words",
|
|
416
|
+
style: {
|
|
417
|
+
minWidth: `${columnWidth}px`
|
|
418
|
+
}
|
|
419
|
+
}, column);
|
|
420
|
+
}))), h("tbody", {
|
|
421
|
+
key: '8e3f21bf2ee5b1bd84cfa93411ca2671f43ced45'
|
|
422
|
+
}, paginatedRows.map(row => h("tr", {
|
|
423
|
+
class: "m-0 p-0 border border-softer even:bg-inverse-softer"
|
|
424
|
+
}, this.columns.map(column => {
|
|
425
|
+
var _a;
|
|
426
|
+
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("td", {
|
|
427
|
+
class: "text-center border border-softer m-0 py-8 f-ui-2 break-words",
|
|
428
|
+
style: {
|
|
429
|
+
minWidth: `${columnWidth}px`
|
|
430
|
+
}
|
|
431
|
+
}, this.renderCell(row[column], column));
|
|
432
|
+
})))))), this.shouldEnablePagination() && h("div", {
|
|
433
|
+
key: '24931f257ef9ced394c1b5b1e589cacedd8035e6',
|
|
434
|
+
class: "mt-20"
|
|
435
|
+
}, h("eds-pagination", {
|
|
436
|
+
key: '996b26ae090ee4fe08cc821fb11362d94879ff72',
|
|
437
|
+
currentPage: this.currentPage,
|
|
438
|
+
lastPage: lastPage,
|
|
439
|
+
perPage: this.rowsPerPage,
|
|
440
|
+
total: this.totalRows,
|
|
441
|
+
mode: "default"
|
|
442
|
+
})));
|
|
443
|
+
}
|
|
444
|
+
get hostEl() {
|
|
445
|
+
return getElement(this);
|
|
446
|
+
}
|
|
447
|
+
static get watchers() {
|
|
448
|
+
return {
|
|
449
|
+
"data": ["handleDataChange", "parseData"],
|
|
450
|
+
"config": ["handleConfigChange"]
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
EdsTable.style = EdsTableStyle0;
|
|
455
|
+
|
|
456
|
+
export { EdsPagination as eds_pagination, EdsTable as eds_table };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { r as registerInstance, h } from './index.esm2.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react-dom';
|
|
5
|
+
|
|
6
|
+
const edsProgressBarCss = ".w-full{width:100%}.h-full{height:100%}.bg-default{background-color:var(--grey-200)}.rounded-lg{border-radius:16px}.h-24{height:1.5rem}.border{border-width:1px}.border-softer{border:2px solid rgba(0, 0, 0, .1 )}.overflow-hidden{overflow:hidden}.bg-accent{background-color:var(--green-500)}.bg-\\[\\#0034CB\\]{--tw-text-opacity:1;background-color:rgb(0 52 203 / var(--tw-text-opacity))}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.duration-300{transition-duration:300ms}.flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.text-default{color:var(--black)}.text-inverse{color:var(--white)}.f-body-02{font-family:var(--f-body-02-fontFamily);font-weight:var(--f-body-02-fontWeight);font-size:var(--f-body-02-fontSize);line-height:var(--f-body-02-lineHeight);letter-spacing:var(--f-body-02-letterSpacing)}";
|
|
7
|
+
const EdsProgressBarStyle0 = edsProgressBarCss;
|
|
8
|
+
const EdsProgressBar = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.value = 0;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Method to update the progress value externally.
|
|
15
|
+
* @param newValue The new progress value (0-100).
|
|
16
|
+
*/
|
|
17
|
+
async updateValue(newValue) {
|
|
18
|
+
this.value = Math.min(100, Math.max(0, newValue)); // Clamp value between 0 and 100
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
const progressValue = this.value;
|
|
22
|
+
return h("div", {
|
|
23
|
+
key: '3131f56034a9fd72ca51e448bc2bcc6281669b25',
|
|
24
|
+
class: "outer w-full bg-default rounded-lg h-24 border border-softer overflow-hidden"
|
|
25
|
+
}, h("div", {
|
|
26
|
+
key: 'f1665a254f8dbe1ccb9e512e5f2e7c1e5ab88c07',
|
|
27
|
+
class: `inner h-full rounded-lg bg-accent transition-all duration-300 flex items-center justify-center text-default f-body-02`,
|
|
28
|
+
style: {
|
|
29
|
+
width: `${progressValue}%`
|
|
30
|
+
}
|
|
31
|
+
}, progressValue, "%"));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
EdsProgressBar.style = EdsProgressBarStyle0;
|
|
35
|
+
|
|
36
|
+
export { EdsProgressBar as eds_progress_bar };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index.esm2.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react-dom';
|
|
5
|
+
|
|
6
|
+
const edsRatingCss = ":host{display:inline-block;font-size:2rem}.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)}.f-body-01{font-family:var(--f-body-01-fontFamily);font-weight:var(--f-body-01-fontWeight);font-size:var(--f-body-01-fontSize);line-height:var(--f-body-01-lineHeight);letter-spacing:var(--f-body-01-letterSpacing)}.f-body-02{font-family:var(--f-body-02-fontFamily);font-weight:var(--f-body-02-fontWeight);font-size:var(--f-body-02-fontSize);line-height:var(--f-body-02-lineHeight);letter-spacing:var(--f-body-02-letterSpacing)}.f-ui-04{font-family:var(--f-ui-04-fontFamily);font-weight:var(--f-ui-04-fontWeight);font-size:var(--f-ui-04-fontSize);line-height:var(--f-ui-04-lineHeight);letter-spacing:var(--f-ui-04-letterSpacing)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}";
|
|
7
|
+
const EdsRatingStyle0 = edsRatingCss;
|
|
8
|
+
const EdsRating = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.ratingChange = createEvent(this, "ratingChange", 7);
|
|
12
|
+
this.stars = 5;
|
|
13
|
+
this.label = 'Rate your experience';
|
|
14
|
+
this.textMapping = ['Very Poor', 'Poor', 'Average', 'Good', 'Excellent'];
|
|
15
|
+
this.selectedRating = 0;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parses the `links` prop into an array of link objects.
|
|
19
|
+
* Returns an empty array if parsing fails or if `links` is not a valid JSON string or object.
|
|
20
|
+
*
|
|
21
|
+
* @returns {any[]} Array of parsed link objects
|
|
22
|
+
*/
|
|
23
|
+
get parsedMappings() {
|
|
24
|
+
if (typeof this.textMapping === 'object') {
|
|
25
|
+
return this.textMapping;
|
|
26
|
+
} else if (typeof this.textMapping === 'string') {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(this.textMapping);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
// eslint-disable-next-line
|
|
31
|
+
console.error('Error parsing links prop:', e);
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handles the click event on a star.
|
|
39
|
+
* @param rating - The selected rating value.
|
|
40
|
+
*/
|
|
41
|
+
handleClick(rating) {
|
|
42
|
+
this.selectedRating = rating;
|
|
43
|
+
this.ratingChange.emit(rating);
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return h("div", {
|
|
47
|
+
key: '4ca6d5e0fb35d8ebce1acd5c1a7c6c857ba4f463',
|
|
48
|
+
class: "relative w-full flex flex-col"
|
|
49
|
+
}, h("span", {
|
|
50
|
+
key: '784b77f84098b8d88cd3872004b0208a4437c51b',
|
|
51
|
+
class: "f-body-01"
|
|
52
|
+
}, this.label), h("div", {
|
|
53
|
+
key: '6780db58d3c96046a99d383518cfe1db1e3f1c68',
|
|
54
|
+
class: "stars"
|
|
55
|
+
}, Array.from({
|
|
56
|
+
length: this.stars
|
|
57
|
+
}, (_, index) => h("span", {
|
|
58
|
+
class: {
|
|
59
|
+
star: true,
|
|
60
|
+
filled: index < this.selectedRating
|
|
61
|
+
},
|
|
62
|
+
onClick: () => this.handleClick(index + 1)
|
|
63
|
+
}, "\u2605"))), this.selectedRating > 0 && this.parsedMappings[this.selectedRating - 1] && h("span", {
|
|
64
|
+
key: 'ce0eec3c29cf27bff86e3307a29a2c39c2167087',
|
|
65
|
+
class: "f-ui-04 text-lighter"
|
|
66
|
+
}, this.parsedMappings[this.selectedRating - 1]));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
EdsRating.style = EdsRatingStyle0;
|
|
70
|
+
|
|
71
|
+
export { EdsRating as eds_rating };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { r as registerInstance, h } from './index.esm2.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react-dom';
|
|
5
|
+
|
|
6
|
+
const edsSectionCoreCss = "";
|
|
7
|
+
const EdsSectionCoreStyle0 = edsSectionCoreCss;
|
|
8
|
+
const EdsSectionCore = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.tag = 'section';
|
|
12
|
+
this.sectionTitle = '';
|
|
13
|
+
this.headingLevel = 'h2';
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
const TagType = this.tag; // Set dynamic tag type (div or section)
|
|
17
|
+
return h(TagType, {
|
|
18
|
+
key: '849c35d9cd587cf14b0d6bc6efd1310a85d447f2'
|
|
19
|
+
}, h("eds-section-heading", {
|
|
20
|
+
key: '7ed4486fcf6e7c653026869c9468be9471db1775',
|
|
21
|
+
headingLevel: this.headingLevel,
|
|
22
|
+
sectionTitle: this.sectionTitle
|
|
23
|
+
}), h("slot", {
|
|
24
|
+
key: '5d95ea6516ecaaab4e07a40b84cd20deb3d8d3b2'
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
EdsSectionCore.style = EdsSectionCoreStyle0;
|
|
29
|
+
const EdsSectionHeading = class {
|
|
30
|
+
constructor(hostRef) {
|
|
31
|
+
registerInstance(this, hostRef);
|
|
32
|
+
this.sectionTitle = undefined;
|
|
33
|
+
this.withContainer = true;
|
|
34
|
+
this.headingLevel = 'h2';
|
|
35
|
+
this.tag = 'div';
|
|
36
|
+
this.spacingLarge = false;
|
|
37
|
+
}
|
|
38
|
+
getHeadingClass() {
|
|
39
|
+
// Map heading levels to their respective classes
|
|
40
|
+
const headingClasses = {
|
|
41
|
+
h1: 'f-heading-01',
|
|
42
|
+
h2: 'f-heading-02',
|
|
43
|
+
h3: 'f-heading-03',
|
|
44
|
+
h4: 'f-heading-04',
|
|
45
|
+
h5: 'f-heading-05',
|
|
46
|
+
h6: 'f-heading-06'
|
|
47
|
+
};
|
|
48
|
+
// Return the class based on the heading level
|
|
49
|
+
return headingClasses[this.headingLevel];
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
const TagType = this.tag; // Dynamically set tag type for the container
|
|
53
|
+
const HeadingTag = this.headingLevel; // Dynamically set heading level
|
|
54
|
+
return h(TagType, {
|
|
55
|
+
key: '2c6466c0a02bf8598153c18eafb37affc3dac395',
|
|
56
|
+
class: {
|
|
57
|
+
'ui-section-header flex flex-wrap items-center justify-between gap-x-12 gap-y-8 pb-20': true,
|
|
58
|
+
container: this.withContainer,
|
|
59
|
+
'pt-48': this.spacingLarge,
|
|
60
|
+
'pt-28': !this.spacingLarge
|
|
61
|
+
}
|
|
62
|
+
}, h(HeadingTag, {
|
|
63
|
+
key: 'fc7f0f09e02e8c63697e46811c465792497126e0',
|
|
64
|
+
class: this.getHeadingClass()
|
|
65
|
+
}, this.sectionTitle));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { EdsSectionCore as eds_section_core, EdsSectionHeading as eds_section_heading };
|