@ebrains/react 1.4.0 → 2.1.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/bin-37cad2f0.esm.js +3 -0
- package/clone-dab56639.esm.js +3 -0
- package/color-primary-palette_6.entry.esm.js +106 -106
- package/components-section.entry.esm.js +1 -1
- package/correct-use-of-colors.entry.esm.js +33 -33
- package/docs-palettes.entry.esm.js +1 -1
- package/docs-tokens.entry.esm.js +1 -1
- package/draft-dd5dada2.esm.js +3 -0
- package/edit-3893a517.esm.js +3 -0
- package/eds-accordion_33.entry.esm.js +1123 -0
- package/eds-app-root.entry.esm.js +4 -4
- package/eds-card-desc_2.entry.esm.js +4 -4
- package/eds-card-generic.entry.esm.js +4 -5
- package/eds-card-project.entry.esm.js +10 -11
- package/eds-card-tags.entry.esm.js +1 -1
- package/eds-card-tool.entry.esm.js +4 -4
- package/eds-cookies-preference.entry.esm.js +2 -2
- package/eds-feedback.entry.esm.js +5 -5
- package/eds-footer.entry.esm.js +135 -0
- package/eds-frame.entry.esm.js +4 -4
- package/eds-fullscreen-menu.entry.esm.js +124 -0
- package/eds-gauge.entry.esm.js +4 -4
- package/eds-icon-arrow-diagonal.entry.esm.js +1 -1
- package/eds-icon-arrow-right.entry.esm.js +1 -1
- package/eds-icon-bin.entry.esm.js +21 -0
- package/eds-icon-bluesky.entry.esm.js +1 -1
- package/eds-icon-bookmark.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-clone.entry.esm.js +21 -0
- package/eds-icon-close.entry.esm.js +1 -1
- package/eds-icon-copy.entry.esm.js +1 -1
- package/eds-icon-draft.entry.esm.js +21 -0
- package/eds-icon-edit.entry.esm.js +21 -0
- package/eds-icon-eu.entry.esm.js +1 -1
- package/eds-icon-external.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-minus.entry.esm.js +1 -1
- package/eds-icon-more.entry.esm.js +1 -1
- package/eds-icon-paper.entry.esm.js +1 -1
- package/eds-icon-plus.entry.esm.js +1 -1
- package/eds-icon-portal.entry.esm.js +1 -1
- package/eds-icon-private.entry.esm.js +1 -1
- package/eds-icon-public.entry.esm.js +1 -1
- package/eds-icon-search.entry.esm.js +1 -1
- package/eds-icon-star.entry.esm.js +1 -1
- package/eds-icon-start.entry.esm.js +21 -0
- package/eds-icon-success.entry.esm.js +1 -1
- package/eds-icon-thumbs-down.entry.esm.js +1 -1
- package/eds-icon-thumbs-up.entry.esm.js +1 -1
- package/eds-icon-tutorial.entry.esm.js +1 -1
- package/eds-icon-twitter.entry.esm.js +1 -1
- package/eds-icon-unknown.entry.esm.js +1 -1
- package/eds-icon-updown.entry.esm.js +1 -1
- package/eds-icon-user.entry.esm.js +1 -1
- package/eds-icon-view.entry.esm.js +21 -0
- package/eds-icon-youtube.entry.esm.js +1 -1
- package/eds-modal.entry.esm.js +150 -0
- package/eds-progress-bar.entry.esm.js +4 -4
- package/eds-section-core_2.entry.esm.js +5 -5
- package/eds-social-networks.entry.esm.js +74 -0
- package/eds-spinner.entry.esm.js +51 -14
- package/eds-splash-screen.entry.esm.js +1 -4
- package/eds-timeline.entry.esm.js +4 -4
- package/eds-toast-manager.entry.esm.js +1 -1
- package/eds-tooltip.entry.esm.js +12 -6
- package/eds-trl.entry.esm.js +2 -2
- package/incorrect-use-of-colors.entry.esm.js +8 -8
- package/index.esm.js +1 -1
- package/index.esm2.js +37 -26
- package/logo-space.entry.esm.js +9 -9
- package/logo-variations-horizontal_2.entry.esm.js +28 -28
- package/logo-variations-tabs.entry.esm.js +1 -1
- package/logo-wrong-usage.entry.esm.js +25 -25
- package/package.json +1 -1
- package/src/components.d.ts +1 -0
- package/start-65126a4f.esm.js +3 -0
- package/svg-repository.entry.esm.js +15 -3
- 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/view-e900f2d4.esm.js +3 -0
- package/eds-accordion.entry.esm.js +0 -132
- package/eds-alert.entry.esm.js +0 -112
- package/eds-avatar_29.entry.esm.js +0 -3660
- package/eds-breadcrumb.entry.esm.js +0 -179
- package/eds-code-block.entry.esm.js +0 -2290
- package/eds-matomo-notice.entry.esm.js +0 -159
- package/eds-rating.entry.esm.js +0 -79
- package/eds-switch.entry.esm.js +0 -68
|
@@ -1,159 +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-d99780e3.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.heading = '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(`${window.location.host}-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(`${window.location.host}-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
|
-
matomoOptOut();
|
|
96
|
-
localStorage.setItem(`${window.location.host}-matomo-consent-given`, 'out');
|
|
97
|
-
this.hideNotice();
|
|
98
|
-
this.consent.emit('out');
|
|
99
|
-
}
|
|
100
|
-
/*private deferDecision() {
|
|
101
|
-
sessionStorage.setItem(this.getStorageKey(), 'true');
|
|
102
|
-
this.hideNotice();
|
|
103
|
-
this.consent.emit('defer');
|
|
104
|
-
}*/
|
|
105
|
-
keepMeIn() {
|
|
106
|
-
this.hideNotice();
|
|
107
|
-
}
|
|
108
|
-
hideNotice() {
|
|
109
|
-
this.showNotice = false;
|
|
110
|
-
}
|
|
111
|
-
render() {
|
|
112
|
-
if (!this.showNotice) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
return h("div", {
|
|
116
|
-
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"
|
|
117
|
-
}, h("eds-accordion", {
|
|
118
|
-
title: this.heading,
|
|
119
|
-
description: this.hasCookieConsent() ? this.optOutMessage : this.description,
|
|
120
|
-
switchBg: true,
|
|
121
|
-
expanded: true
|
|
122
|
-
}, this.hasCookieConsent() ? h("div", {
|
|
123
|
-
class: "flex items-center gap-4"
|
|
124
|
-
}, this.optedOut() ? h("eds-button", {
|
|
125
|
-
intent: "primary",
|
|
126
|
-
label: "Opt me in again",
|
|
127
|
-
"aria-label": "Opt me in again",
|
|
128
|
-
onClick: () => this.optInAnalytics()
|
|
129
|
-
}) : h("eds-button", {
|
|
130
|
-
intent: "primary",
|
|
131
|
-
label: "Keep Me In",
|
|
132
|
-
"aria-label": "Keep Me In",
|
|
133
|
-
onClick: () => this.keepMeIn()
|
|
134
|
-
}), h("eds-button", {
|
|
135
|
-
intent: "ghostInverse",
|
|
136
|
-
label: "Opt-out",
|
|
137
|
-
"aria-label": "Opt-out from analytics",
|
|
138
|
-
onClick: () => this.optOutAnalytics()
|
|
139
|
-
})) : h("div", {
|
|
140
|
-
class: "flex items-center gap-4"
|
|
141
|
-
}, h("eds-button", {
|
|
142
|
-
intent: "primary",
|
|
143
|
-
label: "I agree",
|
|
144
|
-
"aria-label": "Opt-in for analytics",
|
|
145
|
-
onClick: () => this.optInAnalytics()
|
|
146
|
-
}), h("eds-button", {
|
|
147
|
-
intent: "ghost",
|
|
148
|
-
label: "No, thanks",
|
|
149
|
-
"aria-label": "Opt-out from analytics",
|
|
150
|
-
onClick: () => this.noThanks()
|
|
151
|
-
}))));
|
|
152
|
-
}
|
|
153
|
-
get el() {
|
|
154
|
-
return getElement(this);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
EdsMatomoNotice.style = EdsMatomoNoticeStyle0;
|
|
158
|
-
|
|
159
|
-
export { EdsMatomoNotice as eds_matomo_notice };
|
package/eds-rating.entry.esm.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index.esm2.js';
|
|
2
|
-
import 'react';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
import 'react-dom';
|
|
5
|
-
|
|
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
|
-
const EdsRatingStyle0 = edsRatingCss;
|
|
8
|
-
const EdsRating = class {
|
|
9
|
-
constructor(hostRef) {
|
|
10
|
-
registerInstance(this, hostRef);
|
|
11
|
-
this.rating = createEvent(this, "rating", 7);
|
|
12
|
-
this.ratingType = 'star';
|
|
13
|
-
this.ratingCount = 5;
|
|
14
|
-
this.selectedRating = 0;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
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
|
-
*/
|
|
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
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
btnElement.dispatchEvent(event);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Handles the click event on a star.
|
|
43
|
-
* @param rating - The selected rating value.
|
|
44
|
-
*/
|
|
45
|
-
handleClick(rating) {
|
|
46
|
-
this.selectedRating = rating;
|
|
47
|
-
this.rating.emit(rating);
|
|
48
|
-
}
|
|
49
|
-
render() {
|
|
50
|
-
return h("div", {
|
|
51
|
-
key: 'ece1af90e2dea3f69dfef822d7f4f55f76866cbd',
|
|
52
|
-
role: "radiogroup",
|
|
53
|
-
class: "stars flex space-x-1 my-8"
|
|
54
|
-
}, Array.from({
|
|
55
|
-
length: this.ratingCount
|
|
56
|
-
}, (_, index) => {
|
|
57
|
-
const starRating = index + 1;
|
|
58
|
-
const isSelected = starRating <= this.selectedRating;
|
|
59
|
-
// Use the mapping text if available; otherwise, fall back to a generic label.
|
|
60
|
-
return h("eds-button", {
|
|
61
|
-
icon: this.ratingType,
|
|
62
|
-
role: "radio",
|
|
63
|
-
"aria-checked": isSelected ? 'true' : 'false',
|
|
64
|
-
"aria-label": this.ratingType,
|
|
65
|
-
onClick: () => this.handleClick(starRating),
|
|
66
|
-
tabIndex: this.selectedRating === 0 && index === 0 ? 0 : isSelected ? 0 : -1,
|
|
67
|
-
intent: isSelected ? 'primary' : 'ghost',
|
|
68
|
-
size: "large",
|
|
69
|
-
"extra-class": "p-2" // Optional padding or styling for the star button
|
|
70
|
-
});
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
get el() {
|
|
74
|
-
return getElement(this);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
EdsRating.style = EdsRatingStyle0;
|
|
78
|
-
|
|
79
|
-
export { EdsRating as eds_rating };
|
package/eds-switch.entry.esm.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index.esm2.js';
|
|
2
|
-
import { s as sendAnalytics } from './analytics-d99780e3.esm.js';
|
|
3
|
-
import 'react';
|
|
4
|
-
import 'react/jsx-runtime';
|
|
5
|
-
import 'react-dom';
|
|
6
|
-
|
|
7
|
-
const edsSwitchCss = ":host{display:inline-block}.switch-container{display:inline-flex;align-items:center}.switch-label{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)}button.switch{position:relative;display:inline-flex;align-items:center;width:50px;height:26px;border:none;border-radius:13px;background-color:#ccc;padding:0;cursor:pointer;transition:background-color 0.2s}button.switch:focus{outline:none;box-shadow:0 0 0 2px #007aff}button.switch.switch--checked{background-color:var(--green-500)}button.switch.switch--disabled{opacity:0.6;cursor:not-allowed}.switch-handle{position:absolute;width:22px;height:22px;border-radius:50%;background-color:#fff;top:2px;left:2px;transition:transform 0.2s}button.switch.switch--checked .switch-handle{transform:translateX(24px)}.ml-8{margin-left:0.5rem}.mr-8{margin-right:0.5rem}";
|
|
8
|
-
const EdsSwitchStyle0 = edsSwitchCss;
|
|
9
|
-
const EdsSwitch = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
registerInstance(this, hostRef);
|
|
12
|
-
this.uiswitch = createEvent(this, "uiswitch", 7);
|
|
13
|
-
this.toggleSwitch = () => {
|
|
14
|
-
if (this.disabled) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
this.checked = !this.checked;
|
|
18
|
-
this.uiswitch.emit(this.checked);
|
|
19
|
-
sendAnalytics({
|
|
20
|
-
category: 'ui-component',
|
|
21
|
-
tag: this.el.tagName.toLowerCase(),
|
|
22
|
-
name: this.checked ? this.labelOn : this.labelOff || '',
|
|
23
|
-
action: 'checked'
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
this.checked = false;
|
|
27
|
-
this.disabled = false;
|
|
28
|
-
this.labelOn = '';
|
|
29
|
-
this.labelOff = '';
|
|
30
|
-
}
|
|
31
|
-
render() {
|
|
32
|
-
// Compute an accessible name based on state.
|
|
33
|
-
const accessibleLabel = this.labelOn || this.labelOff ? this.checked ? this.labelOn : this.labelOff : 'Toggle switch';
|
|
34
|
-
return h("div", {
|
|
35
|
-
key: 'f2c3cd27a317b64ac05b5b2841f87827ff9f18fc',
|
|
36
|
-
class: "switch-container"
|
|
37
|
-
}, this.labelOff && h("span", {
|
|
38
|
-
key: '08e47e239c5a6de0440b731589fd5f365919df24',
|
|
39
|
-
class: "switch-label switch-label--off mr-8"
|
|
40
|
-
}, this.labelOff), h("button", {
|
|
41
|
-
key: 'd731fa56f93b67daaeaac22c1080a7171360525c',
|
|
42
|
-
type: "button",
|
|
43
|
-
role: "switch",
|
|
44
|
-
"aria-checked": this.checked ? 'true' : 'false',
|
|
45
|
-
"aria-disabled": this.disabled ? 'true' : 'false',
|
|
46
|
-
"aria-label": accessibleLabel,
|
|
47
|
-
class: {
|
|
48
|
-
switch: true,
|
|
49
|
-
'switch--checked': this.checked,
|
|
50
|
-
'switch--disabled': this.disabled
|
|
51
|
-
},
|
|
52
|
-
onClick: this.toggleSwitch,
|
|
53
|
-
disabled: this.disabled
|
|
54
|
-
}, h("span", {
|
|
55
|
-
key: '8bbe2bd4c2050dbda4723615b4eb0fa2936d35d8',
|
|
56
|
-
class: "switch-handle"
|
|
57
|
-
})), this.labelOn && h("span", {
|
|
58
|
-
key: '73991400f5a8e0e6c6d1c09196639add3e98c71f',
|
|
59
|
-
class: "switch-label switch-label--on ml-8"
|
|
60
|
-
}, this.labelOn));
|
|
61
|
-
}
|
|
62
|
-
get el() {
|
|
63
|
-
return getElement(this);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
EdsSwitch.style = EdsSwitchStyle0;
|
|
67
|
-
|
|
68
|
-
export { EdsSwitch as eds_switch };
|