@ebrains/react 0.6.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.
- package/color-primary-palette_6.entry.esm.js +106 -106
- package/correct-use-of-colors.entry.esm.js +33 -33
- package/eds-accordion_17.entry.esm.js +196 -0
- package/eds-alert.entry.esm.js +14 -6
- package/eds-app-root.entry.esm.js +53 -0
- package/eds-breadcrumb.entry.esm.js +8 -16
- package/eds-card-desc_3.entry.esm.js +125 -0
- package/eds-card-generic.entry.esm.js +114 -0
- package/eds-card-project.entry.esm.js +10 -10
- package/eds-card-section.entry.esm.js +56 -0
- package/eds-card-tags.entry.esm.js +1 -1
- package/eds-card-tool.entry.esm.js +4 -4
- package/eds-card-wrapper.entry.esm.js +4 -4
- package/eds-code-block.entry.esm.js +7 -7
- package/eds-components-section.entry.esm.js +27 -24
- package/eds-cookies-preference.entry.esm.js +2 -2
- package/eds-docs-palettes.entry.esm.js +1 -1
- package/eds-docs-tokens.entry.esm.js +1 -1
- package/eds-feedback.entry.esm.js +82 -0
- package/eds-form.entry.esm.js +339 -276
- package/eds-frame.entry.esm.js +34 -33
- package/eds-icon-arrow-diagonal.entry.esm.js +3 -3
- package/eds-icon-arrow-right.entry.esm.js +1 -1
- package/eds-icon-bluesky.entry.esm.js +1 -1
- package/eds-icon-chevron-down.entry.esm.js +1 -1
- package/eds-icon-chevron-left.entry.esm.js +1 -1
- package/eds-icon-chevron-right.entry.esm.js +1 -1
- package/eds-icon-chevron-up.entry.esm.js +1 -1
- package/eds-icon-close.entry.esm.js +1 -1
- package/eds-icon-copy.entry.esm.js +1 -1
- package/eds-icon-eu.entry.esm.js +1 -1
- package/eds-icon-facebook.entry.esm.js +1 -1
- package/eds-icon-gitlab.entry.esm.js +1 -1
- package/eds-icon-linkedin.entry.esm.js +1 -1
- package/eds-icon-loader.entry.esm.js +1 -1
- package/eds-icon-mastodon.entry.esm.js +1 -1
- package/eds-icon-menu.entry.esm.js +1 -1
- package/eds-icon-more.entry.esm.js +1 -1
- package/eds-icon-search.entry.esm.js +1 -1
- package/eds-icon-star.entry.esm.js +21 -0
- package/eds-icon-success.entry.esm.js +1 -1
- package/eds-icon-thumbs-down.entry.esm.js +21 -0
- package/eds-icon-thumbs-up.entry.esm.js +21 -0
- package/eds-icon-twitter.entry.esm.js +1 -1
- package/eds-icon-user.entry.esm.js +1 -1
- package/eds-icon-youtube.entry.esm.js +1 -1
- package/eds-input_7.entry.esm.js +77 -37
- package/{keycloak-d502ec16.esm.js → eds-login_2.entry.esm.js} +172 -1
- package/eds-logo-variations.entry.esm.js +1 -1
- package/eds-modal.entry.esm.js +22 -9
- package/eds-pagination_2.entry.esm.js +49 -28
- package/eds-progress-bar.entry.esm.js +2 -2
- package/eds-rating.entry.esm.js +37 -37
- package/eds-section-core_2.entry.esm.js +6 -6
- package/eds-spinner.entry.esm.js +67 -0
- package/eds-svg-repository.entry.esm.js +18 -7
- package/eds-switch.entry.esm.js +5 -5
- package/eds-tabs.entry.esm.js +14 -26
- package/eds-timeline.entry.esm.js +9 -23
- package/eds-toast-manager.entry.esm.js +62 -0
- package/eds-toast.entry.esm.js +92 -0
- package/eds-tooltip.entry.esm.js +3 -3
- package/eds-trl.entry.esm.js +3 -3
- package/incorrect-use-of-colors.entry.esm.js +7 -7
- package/index.esm.js +1 -1
- package/index.esm2.js +47 -55
- package/logo-space.entry.esm.js +4 -4
- package/logo-variations-horizontal_2.entry.esm.js +26 -26
- package/logo-wrong-usage.entry.esm.js +37 -37
- package/package.json +1 -1
- package/sharedUtils-a550989c.esm.js +17 -0
- package/src/components.d.ts +4 -3
- package/star-0da9b5e9.esm.js +5 -0
- package/thumbs-down-a18fd049.esm.js +5 -0
- package/thumbs-up-c19a71bc.esm.js +6 -0
- package/token-list_3.entry.esm.js +5 -5
- package/token-ratios.entry.esm.js +3 -3
- package/token-spacing.entry.esm.js +26 -26
- package/token-typography.entry.esm.js +2 -2
- package/README.md +0 -7
- package/eds-accordion_13.entry.esm.js +0 -1064
- package/eds-block-break.entry.esm.js +0 -22
- package/eds-dropdown_2.entry.esm.js +0 -235
- package/eds-footer.entry.esm.js +0 -102
- package/eds-fullscreen-menu.entry.esm.js +0 -143
- package/eds-header.entry.esm.js +0 -130
- package/eds-link.entry.esm.js +0 -204
- package/eds-login.entry.esm.js +0 -97
- package/eds-logo.entry.esm.js +0 -87
- package/eds-navigator.entry.esm.js +0 -72
- package/eds-social-networks.entry.esm.js +0 -74
- package/eds-steps.entry.esm.js +0 -98
- package/eds-tab.entry.esm.js +0 -41
- package/eds-tabs-content.entry.esm.js +0 -145
- package/eds-user.entry.esm.js +0 -118
- package/eds-vertical-stepper.entry.esm.js +0 -81
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index.esm2.js';
|
|
2
|
+
import { t as toast } from './toastManager-d9eee791.esm.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import 'react-dom';
|
|
6
|
+
|
|
1
7
|
/*
|
|
2
8
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
|
3
9
|
* and other contributors as indicated by the @author tags.
|
|
@@ -1641,5 +1647,170 @@ async function checkServerAvailability(url) {
|
|
|
1641
1647
|
return false;
|
|
1642
1648
|
}
|
|
1643
1649
|
}
|
|
1650
|
+
const EdsLogin = class {
|
|
1651
|
+
constructor(hostRef) {
|
|
1652
|
+
registerInstance(this, hostRef);
|
|
1653
|
+
this.keycloak = createEvent(this, "keycloak", 7);
|
|
1654
|
+
this.auth = createEvent(this, "auth", 7);
|
|
1655
|
+
/**
|
|
1656
|
+
* Handles user login by invoking the Keycloak `login` function.
|
|
1657
|
+
* Only triggers login if the user is not already authenticated.
|
|
1658
|
+
*/
|
|
1659
|
+
this.handleLogin = async () => {
|
|
1660
|
+
if (!this.authenticated) {
|
|
1661
|
+
try {
|
|
1662
|
+
await login();
|
|
1663
|
+
} catch (error) {
|
|
1664
|
+
toast.show(error.message, 'error');
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
/**
|
|
1669
|
+
* Handles user logout by invoking the Keycloak `logout` function.
|
|
1670
|
+
* Resets the `authenticated` state to `false` after logout.
|
|
1671
|
+
*/
|
|
1672
|
+
this.handleLogout = async () => {
|
|
1673
|
+
try {
|
|
1674
|
+
await logout();
|
|
1675
|
+
} catch (error) {
|
|
1676
|
+
toast.show(error.message, 'error');
|
|
1677
|
+
}
|
|
1678
|
+
this.authenticated = false;
|
|
1679
|
+
this.user = null;
|
|
1680
|
+
};
|
|
1681
|
+
this.keycloakUrl = undefined;
|
|
1682
|
+
this.keycloakRealm = undefined;
|
|
1683
|
+
this.keycloakClientId = undefined;
|
|
1684
|
+
this.authenticated = false;
|
|
1685
|
+
this.user = null;
|
|
1686
|
+
this.serverAvailable = false;
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Lifecycle method that runs when the component is about to load.
|
|
1690
|
+
* It initializes authentication by calling the `initAuth` method.
|
|
1691
|
+
*/
|
|
1692
|
+
async componentWillLoad() {
|
|
1693
|
+
// Check if required props are provided (optional check)
|
|
1694
|
+
if (!this.keycloakUrl || !this.keycloakRealm || !this.keycloakClientId) {
|
|
1695
|
+
// eslint-disable-next-line
|
|
1696
|
+
console.error('Keycloak configuration props are missing.');
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
this.serverAvailable = await checkServerAvailability(`${this.keycloakUrl}/realms/${this.keycloakRealm}`);
|
|
1700
|
+
if (!this.serverAvailable) {
|
|
1701
|
+
toast.show('Keycloak server is unavailable.', 'error');
|
|
1702
|
+
return; // Do not proceed further
|
|
1703
|
+
}
|
|
1704
|
+
await this.initAuth();
|
|
1705
|
+
}
|
|
1706
|
+
/**
|
|
1707
|
+
* Initializes the Keycloak authentication by configuring Keycloak with the provided props.
|
|
1708
|
+
* Sets the `authenticated` state and `user` data if the user is authenticated.
|
|
1709
|
+
* Emits `authStatusChanged` event with the authentication status.
|
|
1710
|
+
*/
|
|
1711
|
+
async initAuth() {
|
|
1712
|
+
try {
|
|
1713
|
+
const res = await initKeycloak({
|
|
1714
|
+
url: this.keycloakUrl,
|
|
1715
|
+
realm: this.keycloakRealm,
|
|
1716
|
+
clientId: this.keycloakClientId
|
|
1717
|
+
}, true);
|
|
1718
|
+
this.keycloak.emit({
|
|
1719
|
+
init: res
|
|
1720
|
+
});
|
|
1721
|
+
if (isAuthenticated()) {
|
|
1722
|
+
this.user = getUser();
|
|
1723
|
+
this.authenticated = true;
|
|
1724
|
+
this.auth.emit({
|
|
1725
|
+
authenticated: this.authenticated,
|
|
1726
|
+
user: this.user
|
|
1727
|
+
}); // Emit auth status change
|
|
1728
|
+
}
|
|
1729
|
+
} catch (error) {
|
|
1730
|
+
toast.show(error.message, 'error');
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
render() {
|
|
1734
|
+
return h("div", {
|
|
1735
|
+
key: 'dace7b16af2f945e4981c9ef139f4c2ae94e130c',
|
|
1736
|
+
class: "block"
|
|
1737
|
+
}, !this.authenticated && h("eds-button", {
|
|
1738
|
+
key: 'a8d0bd545e8ae4a159b5977d50d05ae27dec7df3',
|
|
1739
|
+
label: "Login",
|
|
1740
|
+
intent: "primary",
|
|
1741
|
+
"extra-class": "text-default",
|
|
1742
|
+
"aria-label": "Login",
|
|
1743
|
+
triggerClick: this.handleLogin.bind(this)
|
|
1744
|
+
}));
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
const edsSplashScreenCss = ".splash-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:9999999;background-color:var(--grey-200);display:flex;flex-direction:column;align-items:center;justify-content:center}.logo-container{width:200px;height:200px;margin-bottom:1rem}.content-container{position:relative;width:5rem;height:5rem;display:flex;align-items:center;justify-content:center}";
|
|
1748
|
+
const EdsSplashScreenStyle0 = edsSplashScreenCss;
|
|
1749
|
+
const EdsSplashScreen = class {
|
|
1750
|
+
constructor(hostRef) {
|
|
1751
|
+
registerInstance(this, hostRef);
|
|
1752
|
+
this.splash = createEvent(this, "splash", 7);
|
|
1753
|
+
this.inverse = false;
|
|
1754
|
+
this.initPromise = undefined;
|
|
1755
|
+
this.isVisible = true;
|
|
1756
|
+
}
|
|
1757
|
+
componentWillLoad() {
|
|
1758
|
+
// If an initialization promise is provided, wait for it.
|
|
1759
|
+
if (this.initPromise) {
|
|
1760
|
+
this.initPromise.then(() => {
|
|
1761
|
+
// eslint-disable-next-line
|
|
1762
|
+
console.log('Promises resolved');
|
|
1763
|
+
this.hideSplash();
|
|
1764
|
+
}).catch(error => {
|
|
1765
|
+
// eslint-disable-next-line
|
|
1766
|
+
console.error('Initialization error:', error);
|
|
1767
|
+
this.splash.emit({
|
|
1768
|
+
type: 'error',
|
|
1769
|
+
message: error.message || 'Unknown error'
|
|
1770
|
+
});
|
|
1771
|
+
//this.hideSplash();
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
handleHideSplash() {
|
|
1776
|
+
this.hideSplash();
|
|
1777
|
+
}
|
|
1778
|
+
hideSplash() {
|
|
1779
|
+
this.isVisible = false;
|
|
1780
|
+
this.splash.emit({
|
|
1781
|
+
type: 'hidden',
|
|
1782
|
+
message: 'Splash screen hidden successfully'
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
render() {
|
|
1786
|
+
if (!this.isVisible) {
|
|
1787
|
+
return null;
|
|
1788
|
+
}
|
|
1789
|
+
return h(Host, null, h("div", {
|
|
1790
|
+
class: "splash-overlay",
|
|
1791
|
+
style: {
|
|
1792
|
+
background: this.inverse ? 'black' : 'var(--grey-200)'
|
|
1793
|
+
}
|
|
1794
|
+
}, h("div", {
|
|
1795
|
+
class: "logo-container"
|
|
1796
|
+
}, this.inverse ? h("eds-logo", {
|
|
1797
|
+
orientation: "vertical",
|
|
1798
|
+
type: "color-white"
|
|
1799
|
+
}) : h("eds-logo", {
|
|
1800
|
+
orientation: "vertical",
|
|
1801
|
+
type: "color"
|
|
1802
|
+
})), h("div", {
|
|
1803
|
+
class: "content-container"
|
|
1804
|
+
}, h("eds-spinner", {
|
|
1805
|
+
size: "1rem",
|
|
1806
|
+
thickness: "3px",
|
|
1807
|
+
"border-color": "var(--grey-400)",
|
|
1808
|
+
"bottom-color": "var(--grey-900)",
|
|
1809
|
+
background: "none",
|
|
1810
|
+
fullscreen: false
|
|
1811
|
+
}))));
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
EdsSplashScreen.style = EdsSplashScreenStyle0;
|
|
1644
1815
|
|
|
1645
|
-
export {
|
|
1816
|
+
export { EdsLogin as eds_login, EdsSplashScreen as eds_splash_screen };
|
package/eds-modal.entry.esm.js
CHANGED
|
@@ -73,6 +73,18 @@ const EdsModal = class {
|
|
|
73
73
|
async toggle() {
|
|
74
74
|
this.isOpen = !this.isOpen;
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Listens for global custom events to open the modal.
|
|
78
|
+
*/
|
|
79
|
+
handleGlobalOpen() {
|
|
80
|
+
this.open();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Listens for global custom events to close the modal.
|
|
84
|
+
*/
|
|
85
|
+
handleGlobalClose() {
|
|
86
|
+
this.close();
|
|
87
|
+
}
|
|
76
88
|
/**
|
|
77
89
|
* Closes the modal when the Escape key is pressed.
|
|
78
90
|
*/
|
|
@@ -85,39 +97,40 @@ const EdsModal = class {
|
|
|
85
97
|
// Generate a unique id for the title so we can reference it for aria-labelledby.
|
|
86
98
|
const titleId = `modal-title-${this.el.tagName.toLowerCase()}`;
|
|
87
99
|
return h("div", {
|
|
88
|
-
key: '
|
|
100
|
+
key: '456972d43bddeec93053c1518ca35dff028f0416',
|
|
101
|
+
id: "eds-modal",
|
|
89
102
|
class: `${this.isOpen ? 'block' : 'hidden'} fixed inset-0 z-50 flex`,
|
|
90
103
|
role: "dialog",
|
|
91
104
|
"aria-modal": "true",
|
|
92
105
|
"aria-labelledby": titleId
|
|
93
106
|
}, this.isOpen && h("div", {
|
|
94
|
-
key: '
|
|
107
|
+
key: 'f3b84d1086f70f7863691835fe8984a4ff091b8f',
|
|
95
108
|
class: "fixed inset-0 bg-dark bg-opacity-90" // Add backdrop-blur utility class here
|
|
96
109
|
,
|
|
97
110
|
|
|
98
111
|
onClick: () => this.close()
|
|
99
112
|
}), h("div", {
|
|
100
|
-
key: '
|
|
101
|
-
class: `max-w-full absolute px-20 py-20 bg-inverse rounded-lg shadow-lg z-10 ${this.getModalPositionClasses()} grow justify-center`
|
|
113
|
+
key: '5038d3564881f4580e63a1afd883affa0aee8750',
|
|
114
|
+
class: `container max-w-full absolute px-20 py-20 bg-inverse rounded-lg shadow-lg z-10 ${this.getModalPositionClasses()} grow justify-center`
|
|
102
115
|
}, h("div", {
|
|
103
|
-
key: '
|
|
116
|
+
key: '4ce4d6f11afc552579a35f23901bc79e2ae19274',
|
|
104
117
|
class: "flex justify-between items-center border-b-2 border-softer pb-8"
|
|
105
118
|
}, h("span", {
|
|
106
|
-
key: '
|
|
119
|
+
key: 'a9475d9cdcd4d3a1d68bce973f672621a30c53d4',
|
|
107
120
|
id: titleId,
|
|
108
121
|
class: `f-heading-04 text-lighter ${this.getTruncateClass()}`
|
|
109
122
|
}, this.title), h("eds-button", {
|
|
110
|
-
key: '
|
|
123
|
+
key: 'c1e32fb266333856de6f0e63757fca02778330a9',
|
|
111
124
|
intent: "tertiary",
|
|
112
125
|
icon: "close",
|
|
113
126
|
"aria-label": "Close modal",
|
|
114
127
|
onClick: () => this.close(),
|
|
115
128
|
"extra-class": "ml-8"
|
|
116
129
|
})), h("div", {
|
|
117
|
-
key: '
|
|
130
|
+
key: '58b1d9a3228516a1de31a81c6cd3a2696c65ce5f',
|
|
118
131
|
class: "pt-8"
|
|
119
132
|
}, h("slot", {
|
|
120
|
-
key: '
|
|
133
|
+
key: '0d81e88fcaa138bd746cc894543f264e4a3afb2f'
|
|
121
134
|
}))));
|
|
122
135
|
}
|
|
123
136
|
get el() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, g as getElement } from './index.esm2.js';
|
|
2
2
|
import { s as sendAnalytics } from './analytics-44b1416b.esm.js';
|
|
3
|
+
import { p as parseData } from './sharedUtils-a550989c.esm.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
import 'react/jsx-runtime';
|
|
5
6
|
import 'react-dom';
|
|
@@ -160,7 +161,7 @@ const EdsPagination = class {
|
|
|
160
161
|
this.links = this.links.map(link => typeof link === 'object' ? Object.assign(Object.assign({}, link), {
|
|
161
162
|
current: parseInt(link.label) === newPage
|
|
162
163
|
}) : link);
|
|
163
|
-
const pageChangeEvent = new CustomEvent('
|
|
164
|
+
const pageChangeEvent = new CustomEvent('page', {
|
|
164
165
|
detail: newPage,
|
|
165
166
|
bubbles: true,
|
|
166
167
|
composed: true
|
|
@@ -171,12 +172,12 @@ const EdsPagination = class {
|
|
|
171
172
|
}
|
|
172
173
|
render() {
|
|
173
174
|
return h("div", {
|
|
174
|
-
key: '
|
|
175
|
+
key: '4ebae5738982b21456e2852babeef2f5e2b4b1e0'
|
|
175
176
|
}, this.total > 0 && this.mode === 'default' && h("p", {
|
|
176
|
-
key: '
|
|
177
|
+
key: '9c18413928a471adb2b6964c78ea3339f251c81b',
|
|
177
178
|
class: "f-ui-03 text-lightest mb-28 w-full text-center"
|
|
178
179
|
}, h("span", {
|
|
179
|
-
key: '
|
|
180
|
+
key: '3d9d08eaaf7944ef1a6aba9b0912b7d9ebb58e28',
|
|
180
181
|
class: "sr-only"
|
|
181
182
|
}, "Results:"), this.pageResults()), this.mode === 'navigator' || this.lastPage && this.lastPage > 1 ? h("nav", {
|
|
182
183
|
"aria-label": "Pagination"
|
|
@@ -263,6 +264,9 @@ const EdsTableStyle0 = edsTableCss;
|
|
|
263
264
|
const EdsTable = class {
|
|
264
265
|
constructor(hostRef) {
|
|
265
266
|
registerInstance(this, hostRef);
|
|
267
|
+
this.handleResize = () => {
|
|
268
|
+
this.updateContainerWidth();
|
|
269
|
+
};
|
|
266
270
|
this.data = null;
|
|
267
271
|
this.endpoint = null;
|
|
268
272
|
this.config = {};
|
|
@@ -271,12 +275,13 @@ const EdsTable = class {
|
|
|
271
275
|
this.searchEnabled = false;
|
|
272
276
|
this.hostWidth = undefined;
|
|
273
277
|
this.columnSize = 'default';
|
|
274
|
-
this.
|
|
278
|
+
this.tbData = [];
|
|
275
279
|
this.columns = [];
|
|
276
280
|
this.currentPage = 1;
|
|
277
281
|
this.parsedConfig = {};
|
|
278
282
|
this.totalRows = 0;
|
|
279
283
|
this.searchQuery = '';
|
|
284
|
+
this.containerWidth = 0;
|
|
280
285
|
}
|
|
281
286
|
handleDataChange() {
|
|
282
287
|
this.parseData();
|
|
@@ -289,25 +294,42 @@ const EdsTable = class {
|
|
|
289
294
|
this.data ? this.parseData() : this.endpoint && this.fetchData();
|
|
290
295
|
}
|
|
291
296
|
componentDidLoad() {
|
|
297
|
+
this.updateContainerWidth();
|
|
298
|
+
window.addEventListener('resize', this.handleResize);
|
|
292
299
|
this.setupPaginationListener();
|
|
293
300
|
}
|
|
294
301
|
componentDidUpdate() {
|
|
295
302
|
this.setupPaginationListener();
|
|
296
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
|
+
}
|
|
297
317
|
parseData() {
|
|
298
318
|
try {
|
|
299
|
-
this.
|
|
300
|
-
this.
|
|
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;
|
|
301
322
|
this.updateColumns();
|
|
302
323
|
this.currentPage = 1;
|
|
303
324
|
} catch (error) {
|
|
304
325
|
// eslint-disable-next-line
|
|
305
326
|
console.error('Failed to parse data:', error);
|
|
306
|
-
this.
|
|
327
|
+
this.tbData = [];
|
|
307
328
|
}
|
|
308
329
|
}
|
|
309
330
|
parseConfig() {
|
|
310
331
|
try {
|
|
332
|
+
//this.parsedConfig = parseData(this.config);
|
|
311
333
|
this.parsedConfig = typeof this.config === 'string' ? JSON.parse(this.config) : this.config;
|
|
312
334
|
} catch (error) {
|
|
313
335
|
// eslint-disable-next-line
|
|
@@ -331,12 +353,12 @@ const EdsTable = class {
|
|
|
331
353
|
}
|
|
332
354
|
const paginationEl = this.hostEl.shadowRoot.querySelector('eds-pagination');
|
|
333
355
|
if (paginationEl && !paginationEl.hasAttribute('listener-attached')) {
|
|
334
|
-
paginationEl.addEventListener('
|
|
356
|
+
paginationEl.addEventListener('page', event => this.handlePageChange(event.detail));
|
|
335
357
|
paginationEl.setAttribute('listener-attached', 'true');
|
|
336
358
|
}
|
|
337
359
|
}
|
|
338
360
|
getFilteredRows() {
|
|
339
|
-
return this.
|
|
361
|
+
return this.tbData.filter(row => Object.values(row).some(value => value.toString().toLowerCase().includes(this.searchQuery.toLowerCase())));
|
|
340
362
|
}
|
|
341
363
|
getPaginatedRows() {
|
|
342
364
|
const filteredRows = this.getFilteredRows();
|
|
@@ -376,7 +398,7 @@ const EdsTable = class {
|
|
|
376
398
|
return this.paginationEnabled && this.totalRows > this.rowsPerPage;
|
|
377
399
|
}
|
|
378
400
|
updateColumns() {
|
|
379
|
-
this.columns = this.
|
|
401
|
+
this.columns = this.tbData.length > 0 ? Object.keys(this.tbData[0]) : [];
|
|
380
402
|
}
|
|
381
403
|
getVisibleColumnsCount() {
|
|
382
404
|
return this.columns.filter(column => {
|
|
@@ -394,18 +416,17 @@ const EdsTable = class {
|
|
|
394
416
|
return divisionFactor;
|
|
395
417
|
}
|
|
396
418
|
render() {
|
|
397
|
-
//
|
|
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;
|
|
398
424
|
const paginatedRows = this.getPaginatedRows();
|
|
399
425
|
const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
|
|
400
|
-
// Determine the number of visible columns (i.e., those not hidden via config)
|
|
401
|
-
const visibleColumnsCount = this.getVisibleColumnsCount();
|
|
402
|
-
/// Calculate container width based on the optional prop or parent's measured width.
|
|
403
|
-
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;
|
|
404
|
-
const columnWidth = visibleColumnsCount > 0 ? Math.floor(containerWidth / visibleColumnsCount * this.divisionFactor()) : 100;
|
|
405
426
|
return h("div", {
|
|
406
|
-
key: '
|
|
427
|
+
key: 'a9df6351c49bb17abebfaf3640c71a7c7d15cb61'
|
|
407
428
|
}, this.searchEnabled && h("div", {
|
|
408
|
-
key: '
|
|
429
|
+
key: 'feb5708050593e791835456e6d2244332cee6062'
|
|
409
430
|
}, h("eds-input-field", {
|
|
410
431
|
key: 1,
|
|
411
432
|
name: "search",
|
|
@@ -415,26 +436,26 @@ const EdsTable = class {
|
|
|
415
436
|
// @ts-ignore
|
|
416
437
|
onInput: event => this.handleSearch(event)
|
|
417
438
|
})), h("div", {
|
|
418
|
-
key: '
|
|
439
|
+
key: '88dcb3d9e984a77f54735fa352c811dbf4745838',
|
|
419
440
|
class: "mt-20"
|
|
420
441
|
}, h("table", {
|
|
421
|
-
key: '
|
|
442
|
+
key: '32ff7b76066a96bce51f885e8339c258fdecd0c6',
|
|
422
443
|
class: "block overflow-x-auto mt-6 p-0"
|
|
423
444
|
}, h("thead", {
|
|
424
|
-
key: '
|
|
445
|
+
key: '9f4bbf0725c618c8c2f8a3b90d6d2f2a7f9c0186'
|
|
425
446
|
}, h("tr", {
|
|
426
|
-
key: '
|
|
447
|
+
key: 'd8f24a31aad07b667ae9cc06257ddddf529f8e31',
|
|
427
448
|
class: "m-0 p-0 border border-softer even:bg-inverse-softer"
|
|
428
449
|
}, this.columns.map(column => {
|
|
429
450
|
var _a;
|
|
430
451
|
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("th", {
|
|
431
452
|
class: "m-0 py-8 border border-softer f-ui-02 break-words",
|
|
432
453
|
style: {
|
|
433
|
-
minWidth: `${columnWidth -
|
|
454
|
+
minWidth: `${columnWidth - 4}px`
|
|
434
455
|
}
|
|
435
456
|
}, column);
|
|
436
457
|
}))), h("tbody", {
|
|
437
|
-
key: '
|
|
458
|
+
key: '932e2f9cbd51d1115eef42f8b1acb7bb58ccdab7'
|
|
438
459
|
}, paginatedRows.map(row => h("tr", {
|
|
439
460
|
class: "m-0 p-0 border border-softer even:bg-inverse-softer"
|
|
440
461
|
}, this.columns.map(column => {
|
|
@@ -442,14 +463,14 @@ const EdsTable = class {
|
|
|
442
463
|
return !((_a = this.parsedConfig[column]) === null || _a === void 0 ? void 0 : _a.hidden) && h("td", {
|
|
443
464
|
class: "text-center border border-softer m-0 py-8 f-ui-2 break-words",
|
|
444
465
|
style: {
|
|
445
|
-
minWidth: `${columnWidth -
|
|
466
|
+
minWidth: `${columnWidth - 4}px`
|
|
446
467
|
}
|
|
447
468
|
}, this.renderCell(row[column], column));
|
|
448
469
|
})))))), this.shouldEnablePagination() && h("div", {
|
|
449
|
-
key: '
|
|
470
|
+
key: '6368d38cec298dc8efa1a790d6b0cb93357f0ae5',
|
|
450
471
|
class: "mt-20"
|
|
451
472
|
}, h("eds-pagination", {
|
|
452
|
-
key: '
|
|
473
|
+
key: '2183eb4a6861a0e42538706bd0c9fe10a1e5d8bd',
|
|
453
474
|
currentPage: this.currentPage,
|
|
454
475
|
lastPage: lastPage,
|
|
455
476
|
perPage: this.rowsPerPage,
|
|
@@ -20,7 +20,7 @@ const EdsProgressBar = class {
|
|
|
20
20
|
render() {
|
|
21
21
|
const progressValue = this.value;
|
|
22
22
|
return h("div", {
|
|
23
|
-
key: '
|
|
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: '
|
|
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}%`
|
package/eds-rating.entry.esm.js
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index.esm2.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index.esm2.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react-dom';
|
|
5
5
|
|
|
6
|
-
const edsRatingCss = ":host{display:inline-block
|
|
6
|
+
const edsRatingCss = ":host{display:inline-block}.block{display:block}.stars{display:flex;gap:0.25rem;cursor:pointer}.star{color:var(--star-empty-color, #ccc);transition:color 0.2s ease-in-out}.star.filled{color:var(--green-500);}.star:hover,.star.filled:hover{transform:scale(1.2)}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.mt-4{margin-top:0.25rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.my-4{margin-top:0.25rem;margin-bottom:0.25rem}.my-8{margin-top:0.5rem;margin-bottom:0.5rem}.my-16{margin-top:1rem;margin-bottom:1rem}.my-20{margin-top:1.25rem;margin-bottom:1.25rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.0625rem * var(--tw-space-x-reverse));margin-left:calc(0.0625rem * calc(1 - var(--tw-space-x-reverse)))}";
|
|
7
7
|
const EdsRatingStyle0 = edsRatingCss;
|
|
8
8
|
const EdsRating = class {
|
|
9
9
|
constructor(hostRef) {
|
|
10
10
|
registerInstance(this, hostRef);
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.textMapping = ['Very Poor', 'Poor', 'Average', 'Good', 'Excellent'];
|
|
11
|
+
this.rating = createEvent(this, "rating", 7);
|
|
12
|
+
this.ratingType = 'star';
|
|
13
|
+
this.ratingCount = 5;
|
|
15
14
|
this.selectedRating = 0;
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
17
|
+
* Lifecycle method that runs when the component has fully loaded.
|
|
18
|
+
* It emits a custom event for each `eds-button` element contained within the breadcrumb.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
componentDidLoad() {
|
|
21
|
+
const btns = this.el.shadowRoot.querySelectorAll('eds-button');
|
|
22
|
+
btns.forEach(btn => {
|
|
23
|
+
this.emitContext(btn);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Emits a custom event called `parentContext` for a given link element.
|
|
28
|
+
* This event provides context information about the breadcrumb component.
|
|
29
|
+
*
|
|
30
|
+
* @param btnElement - The link element to which the event will be dispatched.
|
|
31
|
+
*/
|
|
32
|
+
emitContext(btnElement) {
|
|
33
|
+
const event = new CustomEvent('parentContext', {
|
|
34
|
+
detail: {
|
|
35
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
36
|
+
identifier: this.selectedRating
|
|
29
37
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
38
|
+
});
|
|
39
|
+
btnElement.dispatchEvent(event);
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* Handles the click event on a star.
|
|
@@ -36,42 +44,34 @@ const EdsRating = class {
|
|
|
36
44
|
*/
|
|
37
45
|
handleClick(rating) {
|
|
38
46
|
this.selectedRating = rating;
|
|
39
|
-
this.
|
|
47
|
+
this.rating.emit(rating);
|
|
40
48
|
}
|
|
41
49
|
render() {
|
|
42
50
|
return h("div", {
|
|
43
|
-
key: '
|
|
44
|
-
class: "relative w-full flex flex-col"
|
|
45
|
-
}, h("span", {
|
|
46
|
-
key: 'f35cef9c3691aab73995e2ca6e2554cc19bae837',
|
|
47
|
-
class: "f-heading-05"
|
|
48
|
-
}, this.label), h("div", {
|
|
49
|
-
key: '37082eb4bbadf5c211c197f3f81501d0b0e61404',
|
|
51
|
+
key: '34344f12d4ca8a80fe7c96537d417c199421e139',
|
|
50
52
|
role: "radiogroup",
|
|
51
|
-
"
|
|
52
|
-
class: "stars flex space-x-2"
|
|
53
|
+
class: "stars flex space-x-1 my-8"
|
|
53
54
|
}, Array.from({
|
|
54
|
-
length: this.
|
|
55
|
+
length: this.ratingCount
|
|
55
56
|
}, (_, index) => {
|
|
56
57
|
const starRating = index + 1;
|
|
57
58
|
const isSelected = starRating <= this.selectedRating;
|
|
58
59
|
// Use the mapping text if available; otherwise, fall back to a generic label.
|
|
59
|
-
const mappingText = this.parsedMappings[starRating - 1] || `Rating ${starRating}`;
|
|
60
60
|
return h("eds-button", {
|
|
61
|
-
|
|
61
|
+
icon: this.ratingType,
|
|
62
62
|
role: "radio",
|
|
63
63
|
"aria-checked": isSelected ? 'true' : 'false',
|
|
64
|
-
"aria-label":
|
|
64
|
+
"aria-label": this.ratingType,
|
|
65
65
|
onClick: () => this.handleClick(starRating),
|
|
66
66
|
tabIndex: this.selectedRating === 0 && index === 0 ? 0 : isSelected ? 0 : -1,
|
|
67
67
|
intent: isSelected ? 'primary' : 'ghost',
|
|
68
|
-
size: "
|
|
68
|
+
size: "large",
|
|
69
69
|
"extra-class": "p-2" // Optional padding or styling for the star button
|
|
70
70
|
});
|
|
71
|
-
}))
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
get el() {
|
|
74
|
+
return getElement(this);
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
EdsRating.style = EdsRatingStyle0;
|
|
@@ -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: '
|
|
18
|
+
key: '81d5d6f6010c56bb217b32fa520fdaf96e1c7adc'
|
|
19
19
|
}, h("eds-section-heading", {
|
|
20
|
-
key: '
|
|
20
|
+
key: 'c47dda41c2f553ef87f432109ead4bd0debcd99c',
|
|
21
21
|
headingLevel: this.headingLevel,
|
|
22
22
|
sectionTitle: this.sectionTitle
|
|
23
23
|
}), h("slot", {
|
|
24
|
-
key: '
|
|
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: '
|
|
55
|
+
key: '6741f5bbede7d44109c5e60f92290d4b2eda4d42',
|
|
56
56
|
class: {
|
|
57
|
-
'ui-section-header flex flex-wrap items-center justify-between gap-x-12 gap-y-8
|
|
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: '
|
|
63
|
+
key: 'cc65df919db1dc1d5725116ce1ab473319185901',
|
|
64
64
|
class: this.getHeadingClass()
|
|
65
65
|
}, this.sectionTitle));
|
|
66
66
|
}
|