@ebrains/react 0.9.0-beta → 0.9.2-beta
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/.babelrc +12 -0
- package/LICENSE +21 -0
- package/README.md +5 -1
- package/package.json +2 -6
- package/project.json +10 -0
- package/rollup.config.js +43 -0
- package/src/components.ts +49 -0
- package/src/generated/components.ts +47 -0
- package/src/generated/react-component-lib/attachProps.ts +125 -0
- package/src/generated/react-component-lib/case.ts +7 -0
- package/src/generated/react-component-lib/createComponent.tsx +106 -0
- package/src/generated/react-component-lib/createOverlayComponent.tsx +142 -0
- package/src/generated/react-component-lib/dev.ts +14 -0
- package/src/generated/react-component-lib/index.tsx +50 -0
- package/src/generated/react-component-lib/interfaces.ts +34 -0
- package/src/generated/react-component-lib/utils/attachProps.ts +125 -0
- package/src/generated/react-component-lib/utils/case.ts +7 -0
- package/src/generated/react-component-lib/utils/dev.ts +14 -0
- package/src/generated/react-component-lib/utils/index.tsx +50 -0
- package/src/react-component-lib/attachProps.ts +125 -0
- package/src/react-component-lib/case.ts +7 -0
- package/src/react-component-lib/createComponent.tsx +106 -0
- package/src/react-component-lib/createOverlayComponent.tsx +142 -0
- package/src/react-component-lib/dev.ts +14 -0
- package/src/react-component-lib/index.tsx +50 -0
- package/src/react-component-lib/interfaces.ts +34 -0
- package/src/react-component-lib/utils/attachProps.ts +125 -0
- package/src/react-component-lib/utils/case.ts +7 -0
- package/src/react-component-lib/utils/index.tsx +50 -0
- package/tsconfig.json +17 -0
- package/tsconfig.lib.json +23 -0
- package/analytics-44b1416b.esm.js +0 -55
- package/arrow-diagonal-black-8f0494c3.esm.js +0 -3
- package/arrow-right-9322ba8a.esm.js +0 -5
- package/bluesky-cc5edd2d.esm.js +0 -14
- package/bookmark-c200037c.esm.js +0 -16
- package/chevron-down-6144c823.esm.js +0 -12
- package/chevron-left-ca6c66e1.esm.js +0 -11
- package/chevron-right-b88ed2d4.esm.js +0 -5
- package/chevron-up-c66bd477.esm.js +0 -12
- package/close-87fc0d63.esm.js +0 -5
- package/color-2554aad6.esm.js +0 -122
- package/color-primary-palette_6.entry.esm.js +0 -778
- package/components-section.entry.esm.js +0 -165
- package/copy-03b72cb6.esm.js +0 -5
- package/correct-use-of-colors.entry.esm.js +0 -243
- package/docs-palettes.entry.esm.js +0 -29
- package/docs-tokens.entry.esm.js +0 -45
- package/eds-accordion.entry.esm.js +0 -132
- package/eds-alert.entry.esm.js +0 -112
- package/eds-app-root.entry.esm.js +0 -53
- package/eds-avatar_24.entry.esm.js +0 -275
- package/eds-breadcrumb.entry.esm.js +0 -174
- package/eds-card-desc_3.entry.esm.js +0 -125
- package/eds-card-generic.entry.esm.js +0 -114
- package/eds-card-project.entry.esm.js +0 -93
- package/eds-card-section.entry.esm.js +0 -56
- package/eds-card-tags.entry.esm.js +0 -27
- package/eds-card-tool.entry.esm.js +0 -105
- package/eds-card-wrapper.entry.esm.js +0 -39
- package/eds-code-block.entry.esm.js +0 -2290
- package/eds-cookies-preference.entry.esm.js +0 -47
- package/eds-feedback.entry.esm.js +0 -82
- package/eds-frame.entry.esm.js +0 -112
- package/eds-icon-arrow-diagonal.entry.esm.js +0 -21
- package/eds-icon-arrow-right.entry.esm.js +0 -21
- package/eds-icon-bluesky.entry.esm.js +0 -21
- package/eds-icon-bookmark.entry.esm.js +0 -21
- package/eds-icon-chevron-down.entry.esm.js +0 -21
- package/eds-icon-chevron-left.entry.esm.js +0 -21
- package/eds-icon-chevron-right.entry.esm.js +0 -21
- package/eds-icon-chevron-up.entry.esm.js +0 -21
- package/eds-icon-close.entry.esm.js +0 -21
- package/eds-icon-copy.entry.esm.js +0 -21
- package/eds-icon-eu.entry.esm.js +0 -21
- package/eds-icon-external.entry.esm.js +0 -21
- package/eds-icon-facebook.entry.esm.js +0 -21
- package/eds-icon-gitlab.entry.esm.js +0 -21
- package/eds-icon-linkedin.entry.esm.js +0 -21
- package/eds-icon-loader.entry.esm.js +0 -21
- package/eds-icon-mastodon.entry.esm.js +0 -21
- package/eds-icon-menu.entry.esm.js +0 -21
- package/eds-icon-minus.entry.esm.js +0 -21
- package/eds-icon-more.entry.esm.js +0 -21
- package/eds-icon-paper.entry.esm.js +0 -21
- package/eds-icon-plus.entry.esm.js +0 -21
- package/eds-icon-portal.entry.esm.js +0 -21
- package/eds-icon-private.entry.esm.js +0 -21
- package/eds-icon-public.entry.esm.js +0 -21
- package/eds-icon-search.entry.esm.js +0 -21
- package/eds-icon-star.entry.esm.js +0 -21
- package/eds-icon-success.entry.esm.js +0 -21
- package/eds-icon-thumbs-down.entry.esm.js +0 -21
- package/eds-icon-thumbs-up.entry.esm.js +0 -21
- package/eds-icon-tutorial.entry.esm.js +0 -21
- package/eds-icon-twitter.entry.esm.js +0 -21
- package/eds-icon-unknown.entry.esm.js +0 -21
- package/eds-icon-updown.entry.esm.js +0 -21
- package/eds-icon-user.entry.esm.js +0 -21
- package/eds-icon-youtube.entry.esm.js +0 -21
- package/eds-login_2.entry.esm.js +0 -1828
- package/eds-matomo-notice.entry.esm.js +0 -162
- package/eds-modal.entry.esm.js +0 -142
- package/eds-pagination_2.entry.esm.js +0 -493
- package/eds-progress-bar.entry.esm.js +0 -41
- package/eds-rating.entry.esm.js +0 -79
- package/eds-section-core_2.entry.esm.js +0 -69
- package/eds-spinner.entry.esm.js +0 -67
- package/eds-switch.entry.esm.js +0 -58
- package/eds-tabs.entry.esm.js +0 -143
- package/eds-timeline.entry.esm.js +0 -117
- package/eds-toast-manager.entry.esm.js +0 -62
- package/eds-toast.entry.esm.js +0 -92
- package/eds-tooltip.entry.esm.js +0 -125
- package/eds-trl.entry.esm.js +0 -68
- package/eu-9ddde93a.esm.js +0 -30
- package/facebook-9cb5c17f.esm.js +0 -14
- package/incorrect-use-of-colors.entry.esm.js +0 -71
- package/index-39c58238.esm.js +0 -58
- package/index.esm.d.ts +0 -1
- package/index.esm.js +0 -4
- package/index.esm2.js +0 -4840
- package/linkedin-e8650abb.esm.js +0 -28
- package/loader-c9628637.esm.js +0 -30
- package/logo-color-7f1fd803.esm.js +0 -115
- package/logo-color-margins-ff8ce71b.esm.js +0 -118
- package/logo-space.entry.esm.js +0 -48
- package/logo-variations-horizontal_2.entry.esm.js +0 -123
- package/logo-variations-tabs.entry.esm.js +0 -29
- package/logo-white-no-bg-f382f86f.esm.js +0 -1021
- package/logo-wrong-usage.entry.esm.js +0 -101
- package/mastodon-3703ec61.esm.js +0 -14
- package/menu-340ea948.esm.js +0 -11
- package/minus-b30a7c71.esm.js +0 -11
- package/mono-53f70232.esm.js +0 -11
- package/more-4449d549.esm.js +0 -13
- package/paper-8e74ea31.esm.js +0 -15
- package/plus-89c07be2.esm.js +0 -12
- package/portal-d6c8ce56.esm.js +0 -18
- package/private-1c25ff8e.esm.js +0 -25
- package/public-d4d8c585.esm.js +0 -16
- package/search-fbcd79c2.esm.js +0 -12
- package/sharedUtils-a550989c.esm.js +0 -17
- package/src/components.d.ts +0 -41
- package/src/generated/components.d.ts +0 -38
- package/src/generated/react-component-lib/attachProps.d.ts +0 -16
- package/src/generated/react-component-lib/case.d.ts +0 -2
- package/src/generated/react-component-lib/createComponent.d.ts +0 -10
- package/src/generated/react-component-lib/createOverlayComponent.d.ts +0 -21
- package/src/generated/react-component-lib/dev.d.ts +0 -2
- package/src/generated/react-component-lib/interfaces.d.ts +0 -29
- package/src/generated/react-component-lib/utils/attachProps.d.ts +0 -16
- package/src/generated/react-component-lib/utils/case.d.ts +0 -2
- package/src/generated/react-component-lib/utils/dev.d.ts +0 -2
- package/src/generated/react-component-lib/utils/index.d.ts +0 -10
- package/src/react-component-lib/attachProps.d.ts +0 -16
- package/src/react-component-lib/case.d.ts +0 -2
- package/src/react-component-lib/createComponent.d.ts +0 -10
- package/src/react-component-lib/createOverlayComponent.d.ts +0 -21
- package/src/react-component-lib/dev.d.ts +0 -2
- package/src/react-component-lib/interfaces.d.ts +0 -29
- package/src/react-component-lib/utils/attachProps.d.ts +0 -16
- package/src/react-component-lib/utils/case.d.ts +0 -2
- package/src/react-component-lib/utils/index.d.ts +0 -10
- package/star-0da9b5e9.esm.js +0 -5
- package/success-443809da.esm.js +0 -18
- package/svg-repository.entry.esm.js +0 -337
- package/thumbs-down-a18fd049.esm.js +0 -5
- package/thumbs-up-c19a71bc.esm.js +0 -6
- package/toastManager-d9eee791.esm.js +0 -34
- package/token-list_3.entry.esm.js +0 -385
- package/token-ratios.entry.esm.js +0 -49
- package/token-typography.entry.esm.js +0 -267
- package/tutotial-150ee1fd.esm.js +0 -27
- package/twitter-ac21b505.esm.js +0 -14
- package/unknown-ed01a24c.esm.js +0 -22
- package/up-and-down-d747abee.esm.js +0 -12
- package/user-71ebdc15.esm.js +0 -16
- package/youtube-efbfbdc4.esm.js +0 -14
- /package/src/generated/react-component-lib/{index.d.ts → index.ts} +0 -0
- /package/src/{index.d.ts → index.ts} +0 -0
- /package/src/react-component-lib/{index.d.ts → index.ts} +0 -0
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index.esm2.js';
|
|
2
|
-
import { m as matomoOptIn, a as matomoOptOut } from './analytics-44b1416b.esm.js';
|
|
3
|
-
import 'react';
|
|
4
|
-
import 'react/jsx-runtime';
|
|
5
|
-
import 'react-dom';
|
|
6
|
-
|
|
7
|
-
const edsMatomoNoticeCss = ".fixed{position:fixed}.absolute{position:absolute}.w-full{width:100%}.bottom-0{bottom:0rem}.bottom-4{bottom:0.25rem}.p-4{padding:0.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.z-10{z-index:10}.z-\\[999999\\]{z-index:999999}.left-0{left:0rem}.left-1\\/2{left:50%}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.flex{display:flex}.gap-12{gap:0.75rem}.gap-20{gap:1.25rem}.gap-4{gap:0.25rem}@media (min-width: 750px){.md\\:left-1\\/2{left:50%}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}}";
|
|
8
|
-
const EdsMatomoNoticeStyle0 = edsMatomoNoticeCss;
|
|
9
|
-
const EdsMatomoNotice = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
registerInstance(this, hostRef);
|
|
12
|
-
this.consent = createEvent(this, "consent", 7);
|
|
13
|
-
this.title = 'Analytics Consent';
|
|
14
|
-
this.description = "We use anonymous analytics to improve our services. No data is collected unless you give your consent. If you don't wish to send data right now, you can always re-enable analytics later by clicking the Cookies Preference button in the footer. However, by opting in today, you're joining a community that shapes our product's future—all while keeping your data completely anonymous.";
|
|
15
|
-
this.optOutMessage = "You are already part of our community, and your anonymous data helps shape our product's future! Rest assured, your privacy is fully protected.";
|
|
16
|
-
this.forceShow = false;
|
|
17
|
-
this.showNotice = true;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Listens for global custom events to open the matomo-consent.
|
|
21
|
-
*/
|
|
22
|
-
toggleCookiesConsent() {
|
|
23
|
-
this.showNotice = !this.showNotice;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Checks if the consent cookie exists.
|
|
27
|
-
*/
|
|
28
|
-
hasCookieConsent() {
|
|
29
|
-
return !!document.cookie.split('; ').find(row => row.startsWith('mtm_consent='));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Checks if the user has opted out after has opted in.
|
|
33
|
-
*/
|
|
34
|
-
optedOut() {
|
|
35
|
-
return !!document.cookie.split('; ').find(row => row.startsWith('mtm_consent_removed'));
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Generate a unique storage key based on appId or the app's domain.
|
|
39
|
-
*/
|
|
40
|
-
getStorageKey() {
|
|
41
|
-
return `${window.location.host}-matomo-deferred`;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Check cookies and sessionStorage (unless forceShow is true) to decide if the notice should be shown.
|
|
45
|
-
*/
|
|
46
|
-
componentWillLoad() {
|
|
47
|
-
// If a decision has been made previously (opted in or out), don't show the notice.
|
|
48
|
-
const consentGiven = localStorage.getItem('matomo-consent-given');
|
|
49
|
-
if (consentGiven === 'out' || this.optedOut()) {
|
|
50
|
-
this.showNotice = false;
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (this.forceShow) {
|
|
54
|
-
// If forceShow is true, always show the notice
|
|
55
|
-
this.showNotice = true;
|
|
56
|
-
} else {
|
|
57
|
-
// If user has already consented, hide the notice
|
|
58
|
-
// eslint-disable-next-line
|
|
59
|
-
if (this.hasCookieConsent()) {
|
|
60
|
-
this.showNotice = false;
|
|
61
|
-
} else {
|
|
62
|
-
// Otherwise check if user deferred in this session
|
|
63
|
-
const sessionDeferred = sessionStorage.getItem(this.getStorageKey());
|
|
64
|
-
this.showNotice = !sessionDeferred;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
componentDidLoad() {
|
|
69
|
-
const btns = this.el.shadowRoot.querySelectorAll('eds-button');
|
|
70
|
-
btns.forEach(b => {
|
|
71
|
-
this.emitContext(b);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
emitContext(linkElement) {
|
|
75
|
-
const event = new CustomEvent('parentContext', {
|
|
76
|
-
detail: {
|
|
77
|
-
componentName: this.el.tagName.toLowerCase(),
|
|
78
|
-
identifier: null
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
linkElement.dispatchEvent(event);
|
|
82
|
-
}
|
|
83
|
-
optInAnalytics() {
|
|
84
|
-
matomoOptIn();
|
|
85
|
-
localStorage.removeItem('matomo-consent-given');
|
|
86
|
-
this.hideNotice();
|
|
87
|
-
this.consent.emit('in');
|
|
88
|
-
}
|
|
89
|
-
optOutAnalytics() {
|
|
90
|
-
matomoOptOut();
|
|
91
|
-
this.hideNotice();
|
|
92
|
-
this.consent.emit('out');
|
|
93
|
-
}
|
|
94
|
-
noThanks() {
|
|
95
|
-
localStorage.setItem('matomo-consent-given', 'out');
|
|
96
|
-
this.hideNotice();
|
|
97
|
-
}
|
|
98
|
-
deferDecision() {
|
|
99
|
-
sessionStorage.setItem(this.getStorageKey(), 'true');
|
|
100
|
-
this.hideNotice();
|
|
101
|
-
this.consent.emit('defer');
|
|
102
|
-
}
|
|
103
|
-
keepMeIn() {
|
|
104
|
-
this.hideNotice();
|
|
105
|
-
}
|
|
106
|
-
hideNotice() {
|
|
107
|
-
this.showNotice = false;
|
|
108
|
-
}
|
|
109
|
-
render() {
|
|
110
|
-
if (!this.showNotice) {
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
return h("div", {
|
|
114
|
-
class: "fixed bottom-0 p-8 z-[999999] grow md:left-1/2 md:-translate-x-1/2 md:-translate-y-1/2 justify-center"
|
|
115
|
-
}, h("eds-accordion", {
|
|
116
|
-
title: this.title,
|
|
117
|
-
description: this.hasCookieConsent() ? this.optOutMessage : this.description,
|
|
118
|
-
switchBg: true,
|
|
119
|
-
expanded: true
|
|
120
|
-
}, this.hasCookieConsent() ? h("div", {
|
|
121
|
-
class: "flex items-center gap-4"
|
|
122
|
-
}, this.optedOut() ? h("eds-button", {
|
|
123
|
-
intent: "primary",
|
|
124
|
-
label: "Opt me in again",
|
|
125
|
-
"aria-label": "Opt me in again",
|
|
126
|
-
onClick: () => this.optInAnalytics()
|
|
127
|
-
}) : h("eds-button", {
|
|
128
|
-
intent: "primary",
|
|
129
|
-
label: "Keep Me In",
|
|
130
|
-
"aria-label": "Keep Me In",
|
|
131
|
-
onClick: () => this.keepMeIn()
|
|
132
|
-
}), h("eds-button", {
|
|
133
|
-
intent: "ghostInverse",
|
|
134
|
-
label: "Opt-out",
|
|
135
|
-
"aria-label": "Opt-out from analytics",
|
|
136
|
-
onClick: () => this.optOutAnalytics()
|
|
137
|
-
})) : h("div", {
|
|
138
|
-
class: "flex items-center gap-4"
|
|
139
|
-
}, h("eds-button", {
|
|
140
|
-
intent: "primary",
|
|
141
|
-
label: "I agree",
|
|
142
|
-
"aria-label": "Opt-in for analytics",
|
|
143
|
-
onClick: () => this.optInAnalytics()
|
|
144
|
-
}), h("eds-button", {
|
|
145
|
-
intent: "ghost",
|
|
146
|
-
label: "No, thanks",
|
|
147
|
-
"aria-label": "Opt-out from analytics",
|
|
148
|
-
onClick: () => this.noThanks()
|
|
149
|
-
}), h("eds-button", {
|
|
150
|
-
intent: "ghost",
|
|
151
|
-
label: "Ask me later",
|
|
152
|
-
"aria-label": "Defer analytics decision",
|
|
153
|
-
onClick: () => this.deferDecision()
|
|
154
|
-
}))));
|
|
155
|
-
}
|
|
156
|
-
get el() {
|
|
157
|
-
return getElement(this);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
EdsMatomoNotice.style = EdsMatomoNoticeStyle0;
|
|
161
|
-
|
|
162
|
-
export { EdsMatomoNotice as eds_matomo_notice };
|
package/eds-modal.entry.esm.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
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 'react';
|
|
4
|
-
import 'react/jsx-runtime';
|
|
5
|
-
import 'react-dom';
|
|
6
|
-
|
|
7
|
-
const edsModalCss = ".block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.fixed{position:fixed}.inset-0{inset:0rem}.z-10{z-index:10}.z-50{z-index:50}.z-50{z-index:50}.z-9999999{z-index:9999999}.max-w-full{max-width:100%}.absolute{position:absolute}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-20{padding-top:1.25rem;padding-bottom:1.25rem}.bg-inverse{background-color:var(--white)}.bg-dark{background-color:var(--grey-300)}.rounded-lg{border-radius:16px}.shadow-lg{--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.left-1\\/2{left:50%}.left-20{left:1.25rem}.right-20{right:1.25rem}.top-1\\/2{top:50%}.top-20{top:1.25rem}.bottom-20{bottom:1.25rem}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.border-b-2{border-bottom-width:2px}.border-softer{border-color:rgba(0, 0, 0, .1)}.pb-8{padding-bottom:0.5rem}.f-heading-03{font-family:var(--f-heading-03-fontFamily);font-weight:var(--f-heading-03-fontWeight);font-size:var(--f-heading-03-fontSize);line-height:var(--f-heading-03-lineHeight);letter-spacing:var(--f-heading-03-letterSpacing)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-heading-05{font-family:var(--f-heading-05-fontFamily);font-weight:var(--f-heading-05-fontWeight);font-size:var(--f-heading-05-fontSize);line-height:var(--f-heading-05-lineHeight);letter-spacing:var(--f-heading-05-letterSpacing)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.ml-8{margin-left:0.5rem}.pt-8{padding-top:0.5rem}.bg-opacity-90{opacity:0.9}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4}@media (min-width: 750px){.md\\:left-1\\/2{left:50%}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:gap-y-12{row-gap:0.75rem}}";
|
|
8
|
-
const EdsModalStyle0 = edsModalCss;
|
|
9
|
-
const EdsModal = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
registerInstance(this, hostRef);
|
|
12
|
-
this.isOpen = false;
|
|
13
|
-
this.title = '';
|
|
14
|
-
this.truncate = true;
|
|
15
|
-
this.truncateLines = '1';
|
|
16
|
-
this.position = 'middle';
|
|
17
|
-
}
|
|
18
|
-
getTruncateClass() {
|
|
19
|
-
return this.truncate && this.truncateLines ? `line-clamp-${this.truncateLines}` : '';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Returns the Tailwind CSS classes to position the modal based on the `position` prop.
|
|
23
|
-
*
|
|
24
|
-
* @private
|
|
25
|
-
* @returns {string} The concatenated CSS classes for modal positioning.
|
|
26
|
-
*/
|
|
27
|
-
getModalPositionClasses() {
|
|
28
|
-
switch (this.position) {
|
|
29
|
-
case 'top':
|
|
30
|
-
return 'md:left-1/2 top-20 md:-translate-x-1/2';
|
|
31
|
-
case 'bottom':
|
|
32
|
-
return 'md:left-1/2 bottom-20 md:-translate-x-1/2';
|
|
33
|
-
case 'left':
|
|
34
|
-
return 'left-20 top-1/2 -translate-y-1/2';
|
|
35
|
-
case 'right':
|
|
36
|
-
return 'right-20 top-1/2 -translate-y-1/2';
|
|
37
|
-
case 'middle':
|
|
38
|
-
default:
|
|
39
|
-
return 'md:left-1/2 top-1/2 md:-translate-x-1/2 -translate-y-1/2';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Opens the modal.
|
|
44
|
-
*/
|
|
45
|
-
async open() {
|
|
46
|
-
var _a;
|
|
47
|
-
this.isOpen = true;
|
|
48
|
-
sendAnalytics({
|
|
49
|
-
category: 'ui-component',
|
|
50
|
-
parentContext: null,
|
|
51
|
-
tag: this.el.tagName.toLowerCase(),
|
|
52
|
-
name: ((_a = this.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
53
|
-
action: 'opened'
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Closes the modal.
|
|
58
|
-
*/
|
|
59
|
-
async close() {
|
|
60
|
-
var _a;
|
|
61
|
-
this.isOpen = false;
|
|
62
|
-
sendAnalytics({
|
|
63
|
-
category: 'ui-component',
|
|
64
|
-
parentContext: null,
|
|
65
|
-
tag: this.el.tagName.toLowerCase(),
|
|
66
|
-
name: ((_a = this.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
67
|
-
action: 'closed'
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Toggles the modal open or closed.
|
|
72
|
-
*/
|
|
73
|
-
async toggle() {
|
|
74
|
-
this.isOpen = !this.isOpen;
|
|
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
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Closes the modal when the Escape key is pressed.
|
|
90
|
-
*/
|
|
91
|
-
handleKeyDown(event) {
|
|
92
|
-
if (this.isOpen && event.key === 'Escape') {
|
|
93
|
-
this.close();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
render() {
|
|
97
|
-
// Generate a unique id for the title so we can reference it for aria-labelledby.
|
|
98
|
-
const titleId = `modal-title-${this.el.tagName.toLowerCase()}`;
|
|
99
|
-
return h("div", {
|
|
100
|
-
key: 'eb2b985e84912dabea52a9a62eb908087004c958',
|
|
101
|
-
id: "eds-modal",
|
|
102
|
-
class: `${this.isOpen ? 'block' : 'hidden'} fixed inset-0 z-9999999 flex`,
|
|
103
|
-
role: "dialog",
|
|
104
|
-
"aria-modal": "true",
|
|
105
|
-
"aria-labelledby": titleId
|
|
106
|
-
}, this.isOpen && h("div", {
|
|
107
|
-
key: 'ad47334539d1a8a8694f34ba1e90a38b7dce07ab',
|
|
108
|
-
class: "fixed inset-0 bg-dark bg-opacity-90" // Add backdrop-blur utility class here
|
|
109
|
-
,
|
|
110
|
-
|
|
111
|
-
onClick: () => this.close()
|
|
112
|
-
}), h("div", {
|
|
113
|
-
key: '69d449b6ec986b5cfd73e50cc060363236035915',
|
|
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
|
-
}, h("div", {
|
|
116
|
-
key: '17395806ef17a06b5465174055087178db9f5356',
|
|
117
|
-
class: "flex justify-between items-center border-b-2 border-softer pb-8"
|
|
118
|
-
}, h("span", {
|
|
119
|
-
key: 'daa5d63b73eab57b9b58ca06d0197f1a7002ca15',
|
|
120
|
-
id: titleId,
|
|
121
|
-
class: `f-heading-04 text-lighter ${this.getTruncateClass()}`
|
|
122
|
-
}, this.title), h("eds-button", {
|
|
123
|
-
key: '267ee7d1f10819c19af5eed6715465f2ba5f4831',
|
|
124
|
-
intent: "tertiary",
|
|
125
|
-
icon: "close",
|
|
126
|
-
"aria-label": "Close modal",
|
|
127
|
-
onClick: () => this.close(),
|
|
128
|
-
"extra-class": "ml-8"
|
|
129
|
-
})), h("div", {
|
|
130
|
-
key: 'fbd3351c851ab1089035117cca2b3ad769c26d18',
|
|
131
|
-
class: "pt-8"
|
|
132
|
-
}, h("slot", {
|
|
133
|
-
key: '9958a61e24320183bef12aef381791f11e421597'
|
|
134
|
-
}))));
|
|
135
|
-
}
|
|
136
|
-
get el() {
|
|
137
|
-
return getElement(this);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
EdsModal.style = EdsModalStyle0;
|
|
141
|
-
|
|
142
|
-
export { EdsModal as eds_modal };
|