@ebrains/react 1.0.0 → 1.2.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/components-section.entry.esm.js +1 -1
- package/eds-accordion.entry.esm.js +9 -9
- package/eds-alert.entry.esm.js +2 -2
- package/{eds-avatar_34.entry.esm.js → eds-avatar_28.entry.esm.js} +694 -775
- package/eds-breadcrumb.entry.esm.js +179 -0
- package/eds-card-desc_2.entry.esm.js +85 -0
- package/eds-card-generic.entry.esm.js +114 -0
- package/eds-card-project.entry.esm.js +10 -10
- package/eds-card-tags.entry.esm.js +1 -1
- package/eds-card-tool.entry.esm.js +4 -4
- package/eds-code-block.entry.esm.js +7 -7
- package/eds-gauge.entry.esm.js +78 -0
- package/eds-icon-arrow-diagonal.entry.esm.js +1 -1
- package/eds-icon-arrow-right.entry.esm.js +1 -1
- 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-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-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-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-youtube.entry.esm.js +1 -1
- package/eds-pie.entry.esm.js +131 -0
- package/eds-progress-bar.entry.esm.js +4 -4
- package/eds-rating.entry.esm.js +1 -1
- package/eds-section-core_2.entry.esm.js +5 -5
- package/eds-spinner.entry.esm.js +3 -3
- package/eds-switch.entry.esm.js +5 -5
- package/eds-tooltip.entry.esm.js +41 -0
- package/index.esm2.js +23 -5
- package/package.json +1 -1
- package/token-spacing.entry.esm.js +93 -0
- package/eds-pagination_2.entry.esm.js +0 -493
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index.esm2.js';
|
|
2
|
+
import { p as parseData } from './sharedUtils-a550989c.esm.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import 'react-dom';
|
|
6
|
+
|
|
7
|
+
const edsBreadcrumbCss = "blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}.hidden{display:none}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.125rem * var(--tw-space-x-reverse));margin-left:calc(0.125rem * calc(1 - var(--tw-space-x-reverse)))}.px-2{padding-left:0.125rem;padding-right:0.125rem}.w-20{width:1.25rem}.w-28{width:1.75rem}.w-32{width:2rem}.w-44{width:2.75rem}.h-20{height:1.25rem}.h-24{height:1.5rem}.h-28{height:1.75rem}.h-32{height:2rem}@media (min-width: 750px){.md\\:block{display:block}}";
|
|
8
|
+
const EdsBreadcrumbStyle0 = edsBreadcrumbCss;
|
|
9
|
+
const EdsBreadcrumb = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
/**
|
|
13
|
+
* Updates the maximum number of visible items and tracks if the screen is small.
|
|
14
|
+
*/
|
|
15
|
+
this.updateScreenSize = () => {
|
|
16
|
+
const width = window.innerWidth;
|
|
17
|
+
if (width < 769) {
|
|
18
|
+
this.maxVisibleItems = 3;
|
|
19
|
+
} else if (width <= 1024) {
|
|
20
|
+
this.maxVisibleItems = 3;
|
|
21
|
+
} else if (width <= 1280) {
|
|
22
|
+
this.maxVisibleItems = 3;
|
|
23
|
+
} else if (width <= 2200) {
|
|
24
|
+
this.maxVisibleItems = 4;
|
|
25
|
+
} else {
|
|
26
|
+
this.maxVisibleItems = 6;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
this.items = [];
|
|
30
|
+
this.intent = 'ghost';
|
|
31
|
+
this.parsedItems = [];
|
|
32
|
+
this.isSmallScreen = false;
|
|
33
|
+
this.maxVisibleItems = 6;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Watches for changes to the `items` prop and parses it.
|
|
37
|
+
*/
|
|
38
|
+
parseItems(newValue) {
|
|
39
|
+
this.parsedItems = parseData(newValue);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Lifecycle method that runs when the component is about to be loaded.
|
|
43
|
+
* It parses the initial `items` prop value.
|
|
44
|
+
*/
|
|
45
|
+
componentWillLoad() {
|
|
46
|
+
this.parseItems(this.items);
|
|
47
|
+
this.updateScreenSize();
|
|
48
|
+
window.addEventListener('resize', this.updateScreenSize);
|
|
49
|
+
}
|
|
50
|
+
disconnectedCallback() {
|
|
51
|
+
window.removeEventListener('resize', this.updateScreenSize);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Lifecycle method that runs when the component has fully loaded.
|
|
55
|
+
* It emits a custom event for each `eds-link` element contained within the breadcrumb.
|
|
56
|
+
*/
|
|
57
|
+
componentDidLoad() {
|
|
58
|
+
var _a;
|
|
59
|
+
const links = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('eds-link');
|
|
60
|
+
links === null || links === void 0 ? void 0 : links.forEach(link => {
|
|
61
|
+
this.emitContext(link);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Emits a custom event called `parentContext` for a given link element.
|
|
66
|
+
* This event provides context information about the breadcrumb component.
|
|
67
|
+
*
|
|
68
|
+
* @param linkElement - The link element to which the event will be dispatched.
|
|
69
|
+
*/
|
|
70
|
+
emitContext(linkElement) {
|
|
71
|
+
const event = new CustomEvent('parentContext', {
|
|
72
|
+
detail: {
|
|
73
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
74
|
+
identifier: null
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
linkElement.dispatchEvent(event);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns breadcrumb items with potential truncation if there are too many.
|
|
81
|
+
* It inserts an ellipsis item where necessary.
|
|
82
|
+
*/
|
|
83
|
+
getTruncatedItems() {
|
|
84
|
+
const totalItems = this.parsedItems.length;
|
|
85
|
+
const ellipsis = {
|
|
86
|
+
label: '...',
|
|
87
|
+
url: '',
|
|
88
|
+
isHidden: true
|
|
89
|
+
};
|
|
90
|
+
if (totalItems > this.maxVisibleItems) {
|
|
91
|
+
const firstItem = this.parsedItems[0];
|
|
92
|
+
const lastItems = this.parsedItems.slice(-2);
|
|
93
|
+
if (this.maxVisibleItems === 3) {
|
|
94
|
+
return [firstItem, ellipsis, ...lastItems];
|
|
95
|
+
} else if (this.maxVisibleItems === 4) {
|
|
96
|
+
const middleItem = this.parsedItems[Math.floor(totalItems / 2)];
|
|
97
|
+
return [firstItem, middleItem, ellipsis, ...lastItems];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return this.parsedItems;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Helper to determine the display label and full label.
|
|
104
|
+
* If the label is longer than 15 characters and the item is not the current (last) item,
|
|
105
|
+
* we display a truncated version but use the full label for aria attributes.
|
|
106
|
+
*/
|
|
107
|
+
getLabels(item, isCurrent) {
|
|
108
|
+
if (!isCurrent && item.label.length > 15) {
|
|
109
|
+
return {
|
|
110
|
+
displayLabel: `${item.label.slice(0, 15)}...`,
|
|
111
|
+
fullLabel: item.label
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
displayLabel: item.label,
|
|
116
|
+
fullLabel: item.label
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Render method for the breadcrumb component.
|
|
121
|
+
* It creates a navigation element with an ordered list of breadcrumb links.
|
|
122
|
+
* The last link is marked as the current page.
|
|
123
|
+
*/
|
|
124
|
+
render() {
|
|
125
|
+
const itemsToRender = this.getTruncatedItems();
|
|
126
|
+
return h("nav", {
|
|
127
|
+
key: 'db769320b42e627fffd71676c1e0551646f1de70',
|
|
128
|
+
"aria-label": "Breadcrumb"
|
|
129
|
+
}, h("ol", {
|
|
130
|
+
key: '6cef8ed43cabcee73cb4ad4fb26f809d0690c0ec',
|
|
131
|
+
class: "flex items-center space-x-2"
|
|
132
|
+
}, itemsToRender.map((item, index) => {
|
|
133
|
+
const isLast = index === itemsToRender.length - 1;
|
|
134
|
+
return h("li", {
|
|
135
|
+
class: "flex items-center"
|
|
136
|
+
}, !item.isHidden ? (() => {
|
|
137
|
+
const {
|
|
138
|
+
fullLabel
|
|
139
|
+
} = this.getLabels(item, isLast);
|
|
140
|
+
const linkIntent = isLast ? this.intent === 'strong' ? 'weak' : this.intent === 'weak' ? 'strong' : this.intent : this.intent;
|
|
141
|
+
return h("eds-link", Object.assign({
|
|
142
|
+
label: fullLabel,
|
|
143
|
+
url: item.url,
|
|
144
|
+
intent: linkIntent,
|
|
145
|
+
disabled: isLast,
|
|
146
|
+
current: isLast,
|
|
147
|
+
"aria-label": fullLabel,
|
|
148
|
+
size: "small",
|
|
149
|
+
"icon-small": "false"
|
|
150
|
+
}, isLast ? {
|
|
151
|
+
'aria-current': 'page'
|
|
152
|
+
} : {}));
|
|
153
|
+
})() : h("eds-link", {
|
|
154
|
+
label: "...",
|
|
155
|
+
url: "#",
|
|
156
|
+
intent: "strong",
|
|
157
|
+
current: false,
|
|
158
|
+
"aria-label": "...",
|
|
159
|
+
size: "small",
|
|
160
|
+
"icon-small": "false",
|
|
161
|
+
icon: "chevron-right"
|
|
162
|
+
}), !isLast && !item.isHidden && h("eds-icon-wrapper", {
|
|
163
|
+
icon: "chevron-right",
|
|
164
|
+
class: "w-20 h-20"
|
|
165
|
+
}));
|
|
166
|
+
})));
|
|
167
|
+
}
|
|
168
|
+
get el() {
|
|
169
|
+
return getElement(this);
|
|
170
|
+
}
|
|
171
|
+
static get watchers() {
|
|
172
|
+
return {
|
|
173
|
+
"items": ["parseItems"]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
EdsBreadcrumb.style = EdsBreadcrumbStyle0;
|
|
178
|
+
|
|
179
|
+
export { EdsBreadcrumb as eds_breadcrumb };
|
|
@@ -0,0 +1,85 @@
|
|
|
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 edsCardDescCss = ".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)}.text-light{color:var(--grey-700)}.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}";
|
|
7
|
+
const EdsCardDescStyle0 = edsCardDescCss;
|
|
8
|
+
const EdsCardDesc = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.description = undefined;
|
|
12
|
+
this.truncate = true;
|
|
13
|
+
this.truncateLines = '3';
|
|
14
|
+
}
|
|
15
|
+
getTruncateClass() {
|
|
16
|
+
return this.truncate && this.truncateLines ? `line-clamp-${this.truncateLines}` : '';
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return h("p", {
|
|
20
|
+
key: '2421ea469339e3d56fc5c0ebbec213eeb1a2a9cf',
|
|
21
|
+
class: "text-light f-ui-03-light"
|
|
22
|
+
}, h("span", {
|
|
23
|
+
key: 'd024adda16a85bf2913803c06eb05af3b4af6bb9',
|
|
24
|
+
class: this.getTruncateClass()
|
|
25
|
+
}, this.description));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
EdsCardDesc.style = EdsCardDescStyle0;
|
|
29
|
+
const edsCardTitleCss = "a{all:unset;display:inline;color:inherit;text-decoration:none;cursor:pointer}h1,h2,h3,h4,h5,h6{margin:0}.f-heading-01{font-family:var(--f-heading-01-fontFamily);font-weight:var(--f-heading-01-fontWeight);font-size:var(--f-heading-01-fontSize);line-height:var(--f-heading-01-lineHeight);letter-spacing:var(--f-heading-01-letterSpacing)}.f-heading-02{font-family:var(--f-heading-02-fontFamily);font-weight:var(--f-heading-02-fontWeight);font-size:var(--f-heading-02-fontSize);line-height:var(--f-heading-02-lineHeight);letter-spacing:var(--f-heading-02-letterSpacing)}.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)}.f-heading-06{font-family:var(--f-heading-06-fontFamily);font-weight:var(--f-heading-06-fontWeight);font-size:var(--f-heading-06-fontSize);line-height:var(--f-heading-06-lineHeight);letter-spacing:var(--f-heading-06-letterSpacing)}.break-words{overflow-wrap:break-word}.after\\:absolute::after{position:absolute}.after\\:inset-0::after{inset:0rem}.after\\:z-10::after{z-index:10}.after\\:content-\\[\\'\\'\\]::after{--tw-content:'';content:var(--tw-content)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}";
|
|
30
|
+
const EdsCardTitleStyle0 = edsCardTitleCss;
|
|
31
|
+
const EdsCardTitle = class {
|
|
32
|
+
constructor(hostRef) {
|
|
33
|
+
registerInstance(this, hostRef);
|
|
34
|
+
this.url = undefined;
|
|
35
|
+
this.titleClass = undefined;
|
|
36
|
+
this.headingLevel = 'h3';
|
|
37
|
+
this.externalLink = false;
|
|
38
|
+
this.cardTitle = undefined;
|
|
39
|
+
this.hierarchy = true;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Dynamically generate the title class based on the heading level.
|
|
43
|
+
*/
|
|
44
|
+
getTitleClass() {
|
|
45
|
+
const levelMap = this.hierarchy ? {
|
|
46
|
+
h1: '05',
|
|
47
|
+
h2: '05',
|
|
48
|
+
h3: '05',
|
|
49
|
+
h4: '05',
|
|
50
|
+
h5: '05',
|
|
51
|
+
h6: '06'
|
|
52
|
+
} : {
|
|
53
|
+
h1: '01',
|
|
54
|
+
h2: '02',
|
|
55
|
+
h3: '03',
|
|
56
|
+
h4: '04',
|
|
57
|
+
h5: '05',
|
|
58
|
+
h6: '06'
|
|
59
|
+
};
|
|
60
|
+
return `f-heading-${levelMap[this.headingLevel]}`;
|
|
61
|
+
}
|
|
62
|
+
/*private getTag() {
|
|
63
|
+
if (this.url) {
|
|
64
|
+
return 'a';
|
|
65
|
+
}
|
|
66
|
+
return 'span';
|
|
67
|
+
}*/
|
|
68
|
+
render() {
|
|
69
|
+
//const Tag = this.getTag();
|
|
70
|
+
const Heading = this.headingLevel;
|
|
71
|
+
return h(Heading, {
|
|
72
|
+
key: '494d8b7ea90ccb93cf0395374951e90c89a59d3a',
|
|
73
|
+
class: this.getTitleClass()
|
|
74
|
+
}, h("a", {
|
|
75
|
+
key: 'ab739472fd796767cd6e7ab4f4c09bcf24ec200a',
|
|
76
|
+
class: "break-words after:absolute after:inset-0 after:z-10 after:content-[''] focus:outline-none",
|
|
77
|
+
href: this.url,
|
|
78
|
+
target: this.externalLink ? '_blank' : undefined,
|
|
79
|
+
rel: this.externalLink ? 'noopener noreferrer' : undefined
|
|
80
|
+
}, this.cardTitle));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
EdsCardTitle.style = EdsCardTitleStyle0;
|
|
84
|
+
|
|
85
|
+
export { EdsCardDesc as eds_card_desc, EdsCardTitle as eds_card_title };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index.esm2.js';
|
|
2
|
+
import { p as parseData } from './sharedUtils-a550989c.esm.js';
|
|
3
|
+
import { s as sendAnalytics } from './analytics-d99780e3.esm.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'react-dom';
|
|
7
|
+
|
|
8
|
+
const edsCardGenericCss = ".h-auto{height:auto}.h-full{height:100%}.\\!min-h-20{min-height:1.25rem !important}.min-h-120{min-height:120px}.min-h-156{min-height:156px}.bg-default{background-color:var(--grey-200)}.bg-inverse{background-color:var(--white)}.effect-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.hover\\:shadow-hover:hover{--tw-shadow:0px 0px 16px rgba(0, 0, 0, 0.2);--tw-shadow-colored:0px 0px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.cursor-pointer{cursor:pointer}.border-soft{border-color:rgba(0, 0, 0, .15)}.border-softer{border:2px solid rgba(0, 0, 0, .1)}.effect-focus-within{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.effect-focus-within:focus-within{outline-style:solid}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grow{flex-grow:1}.flex-col{flex-direction:column}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-12{padding:0.75rem}.p-16{padding:1rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.gap-x-1{-moz-column-gap:0.0625rem;column-gap:0.0625rem}.gap-y-4{row-gap:0.25rem}.order-first{order:-9999}.mb-10{margin-bottom:0.625rem}.mb-12{margin-bottom:0.75rem}.mx-auto{margin-left:auto;margin-right:auto}.block{display:block}";
|
|
9
|
+
const EdsCardGenericStyle0 = edsCardGenericCss;
|
|
10
|
+
const EdsCardGeneric = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
registerInstance(this, hostRef);
|
|
13
|
+
this.parentContext = null; // Accepts the entire event detail or null
|
|
14
|
+
this.cardTitle = undefined;
|
|
15
|
+
this.url = undefined;
|
|
16
|
+
this.description = undefined;
|
|
17
|
+
this.image = undefined;
|
|
18
|
+
this.avatar = undefined;
|
|
19
|
+
this.shortAbbreviation = undefined;
|
|
20
|
+
this.headingLevel = 'h3';
|
|
21
|
+
this.tags = [];
|
|
22
|
+
this.tiny = false;
|
|
23
|
+
this.bg = true;
|
|
24
|
+
this.withHover = true;
|
|
25
|
+
this.hierarchy = true;
|
|
26
|
+
this.parsedImage = null;
|
|
27
|
+
}
|
|
28
|
+
componentWillLoad() {
|
|
29
|
+
if (this.image) {
|
|
30
|
+
try {
|
|
31
|
+
if (typeof this.image === 'object') {
|
|
32
|
+
// If image is already an object, assign it directly
|
|
33
|
+
this.parsedImage = this.image;
|
|
34
|
+
} else if (typeof this.image === 'string') {
|
|
35
|
+
// If image is a string, try to parse it
|
|
36
|
+
this.parsedImage = JSON.parse(this.image);
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
// eslint-disable-next-line
|
|
40
|
+
console.error('Error parsing image prop:', error);
|
|
41
|
+
this.parsedImage = {}; // Assign a fallback empty object in case of an error
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
handleParentContext(event) {
|
|
46
|
+
if (event.target !== this.el) {
|
|
47
|
+
// Ignore the event if it's not targeted at this specific instance
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
//console.log(event.detail);
|
|
51
|
+
this.parentContext = event.detail;
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parses the `tags` prop into an array of link objects.
|
|
56
|
+
* Returns an empty array if parsing fails or if `tags` is not a valid JSON string or object.
|
|
57
|
+
*
|
|
58
|
+
* @returns {any[]} Array of parsed link objects
|
|
59
|
+
*/
|
|
60
|
+
get parsedTags() {
|
|
61
|
+
return parseData(this.tags);
|
|
62
|
+
}
|
|
63
|
+
articleClasses() {
|
|
64
|
+
return [this.description ? this.tiny ? 'min-h-120' : 'min-h-156' : 'h-auto', this.bg ? 'bg-inverse' : 'bg-default', this.withHover ? 'effect-shadow hover:shadow-hover cursor-pointer' : '', 'border-softer effect-focus-within relative flex grow flex-col rounded-lg border-2 p-16'].join(' ');
|
|
65
|
+
}
|
|
66
|
+
handleClick() {
|
|
67
|
+
var _a;
|
|
68
|
+
sendAnalytics({
|
|
69
|
+
category: 'ui-component',
|
|
70
|
+
parentContext: this.parentContext,
|
|
71
|
+
tag: this.el.tagName.toLowerCase(),
|
|
72
|
+
name: ((_a = this.cardTitle) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
73
|
+
action: 'click'
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
return h("article", {
|
|
78
|
+
key: '440a448c841370838c0c66610bd1266b46f66541',
|
|
79
|
+
class: this.articleClasses(),
|
|
80
|
+
onClick: () => this.handleClick()
|
|
81
|
+
}, h("eds-card-title", {
|
|
82
|
+
key: '292d93a9a993c6dcbfd276097a21d3984b1794c4',
|
|
83
|
+
"heading-level": this.headingLevel,
|
|
84
|
+
titleClass: this.image ? 'f-ui-01' : undefined,
|
|
85
|
+
"card-title": this.cardTitle,
|
|
86
|
+
url: this.url,
|
|
87
|
+
hierarchy: this.hierarchy
|
|
88
|
+
}), this.description && h("eds-card-desc", {
|
|
89
|
+
key: '4b304cc3c65a42b3b1bcbebd9968c45e79cdabf7',
|
|
90
|
+
class: "mt-8",
|
|
91
|
+
"truncate-lines": "3",
|
|
92
|
+
description: this.description
|
|
93
|
+
}), this.parsedImage ? h("eds-img", Object.assign({
|
|
94
|
+
class: "mt-8 block mx-auto"
|
|
95
|
+
}, this.parsedImage)) : this.avatar || this.shortAbbreviation ? h("eds-avatar", {
|
|
96
|
+
class: "order-first mb-12",
|
|
97
|
+
picture: this.avatar,
|
|
98
|
+
initials: this.shortAbbreviation
|
|
99
|
+
}) : null, h("div", {
|
|
100
|
+
key: '40388913b1abb9308f42469956342efdbb48d508',
|
|
101
|
+
class: "flex flex-wrap gap-y-4 gap-x-1"
|
|
102
|
+
}, this.parsedTags.map((tag, index) => h("eds-tag", {
|
|
103
|
+
key: index,
|
|
104
|
+
intent: tag.style,
|
|
105
|
+
label: tag.label
|
|
106
|
+
}))), ' ');
|
|
107
|
+
}
|
|
108
|
+
get el() {
|
|
109
|
+
return getElement(this);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
EdsCardGeneric.style = EdsCardGenericStyle0;
|
|
113
|
+
|
|
114
|
+
export { EdsCardGeneric as eds_card_generic };
|
|
@@ -167,38 +167,38 @@ const EdsCardProject = class {
|
|
|
167
167
|
}) : 'bg-default', this.bgOnHover && this.color ? 'effect-background bg-default focus-within:bg-transparent hover:bg-transparent' : 'effect-background hover:bg-default', this.vertical ? 'flex-col gap-y-16' : 'flex-col gap-x-16 gap-y-12 lg:flex-row'].join(' ');
|
|
168
168
|
const imageClasses = this.vertical ? '' : 'max-w-120 @md:max-w-192 order-first w-full lg:order-last';
|
|
169
169
|
return h("article", {
|
|
170
|
-
key: '
|
|
170
|
+
key: '8b4707ad7689824c50db3112b5844e28beb31533',
|
|
171
171
|
class: cardClasses,
|
|
172
172
|
onClick: event => this.handleClick(event)
|
|
173
173
|
}, h("div", {
|
|
174
|
-
key: '
|
|
174
|
+
key: '5cb7673378ab23826202b34034247145b7289bda',
|
|
175
175
|
class: `flex grow flex-col ${this.vertical ? 'min-h-156' : ''}`
|
|
176
176
|
}, h("div", {
|
|
177
|
-
key: '
|
|
177
|
+
key: '8111b523840c8b363bbb422c1f314ce07057ea92',
|
|
178
178
|
class: "lg:max-w-[720px]"
|
|
179
179
|
}, h("eds-card-title", {
|
|
180
|
-
key: '
|
|
180
|
+
key: 'a326e1384873edb9bfc86c33e3abeb95064cc8db',
|
|
181
181
|
"heading-level": this.headingLevel,
|
|
182
182
|
titleClass: this.image ? 'f-ui-01' : undefined,
|
|
183
183
|
"card-title": this.titleProject,
|
|
184
184
|
url: this.url
|
|
185
185
|
}), this.editorialTitle && h("span", {
|
|
186
|
-
key: '
|
|
186
|
+
key: '5e2de62642363533a950f3e923e3f4dfc64c56c1',
|
|
187
187
|
class: `block ${this.vertical ? 'f-ui-02' : 'mt-4 f-heading-06'}`
|
|
188
188
|
}, this.editorialTitle)), this.categoryTitle && h("div", {
|
|
189
|
-
key: '
|
|
189
|
+
key: '424fed86ec4e714dc5f3644d85e5670d8be56d7f',
|
|
190
190
|
class: "mt-auto flex items-center gap-x-12 pt-12"
|
|
191
191
|
}, ((_a = this.categoryTitle) === null || _a === void 0 ? void 0 : _a.length) && h("eds-tag", {
|
|
192
|
-
key: '
|
|
192
|
+
key: 'b6961cc23835a9b3d1abae47e1c4224a29255164',
|
|
193
193
|
label: this.categoryTitle
|
|
194
194
|
}))), this.parsedImage && h("div", {
|
|
195
|
-
key: '
|
|
195
|
+
key: '69564e0c65f6422a6ccc3957a8080e7e494461bb',
|
|
196
196
|
class: imageClasses
|
|
197
197
|
}, h("div", {
|
|
198
|
-
key: '
|
|
198
|
+
key: 'e47a21a5356459936b6f528a3aba50240851fcf2',
|
|
199
199
|
class: "aspect-1x1 w-full"
|
|
200
200
|
}, h("eds-img", Object.assign({
|
|
201
|
-
key: '
|
|
201
|
+
key: 'f64af6387cdef28619aa8a0465d4a50ec3a95007',
|
|
202
202
|
sizes: this.vertical ? this.parsedImage.sizes || '' : '192px'
|
|
203
203
|
}, this.parsedImage)))));
|
|
204
204
|
}
|
|
@@ -13,7 +13,7 @@ const EdsCardTags = class {
|
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
15
|
return h("div", {
|
|
16
|
-
key: '
|
|
16
|
+
key: '5da9fcbc472476a7b438451e563586643a818bc0',
|
|
17
17
|
class: "flex flex-wrap gap-y-4"
|
|
18
18
|
}, this.tags.map((tag, index) => h("eds-tag", {
|
|
19
19
|
key: index,
|
|
@@ -62,11 +62,11 @@ const EdsCardTool = class {
|
|
|
62
62
|
}
|
|
63
63
|
render() {
|
|
64
64
|
return h("article", {
|
|
65
|
-
key: '
|
|
65
|
+
key: '465a4593a4d28c5bfcef7325be7674b6301bc275',
|
|
66
66
|
class: `${this.el.tagName.toLowerCase()} ${this.articleClasses()}`,
|
|
67
67
|
onClick: () => this.handleClick()
|
|
68
68
|
}, h("eds-card-title", {
|
|
69
|
-
key: '
|
|
69
|
+
key: '5d6c13f582bd89f03d95aa9027b83d8d4c4184ca',
|
|
70
70
|
"heading-level": this.headingLevel,
|
|
71
71
|
titleClass: this.image ? 'f-ui-01' : undefined,
|
|
72
72
|
"card-title": this.cardTitle,
|
|
@@ -74,7 +74,7 @@ const EdsCardTool = class {
|
|
|
74
74
|
"external-link": this.external,
|
|
75
75
|
hierarchy: this.hierarchy
|
|
76
76
|
}), this.description && h("eds-card-desc", {
|
|
77
|
-
key: '
|
|
77
|
+
key: '4872956b7d97e222abd8e429c73a7e97fe1f7a06',
|
|
78
78
|
class: "mt-8",
|
|
79
79
|
"truncate-lines": "3",
|
|
80
80
|
description: this.description
|
|
@@ -88,7 +88,7 @@ const EdsCardTool = class {
|
|
|
88
88
|
picture: this.avatar,
|
|
89
89
|
initials: this.shortAbbreviation
|
|
90
90
|
}) : null, h("div", {
|
|
91
|
-
key: '
|
|
91
|
+
key: '10c20ab24e836c06ba2da070cbcf21cf11537e17',
|
|
92
92
|
class: "flex flex-wrap gap-y-4"
|
|
93
93
|
}, this.parsedTags.map((tag, index) => h("eds-tag", {
|
|
94
94
|
key: index,
|
|
@@ -2247,10 +2247,10 @@ const EdsCodeBlock = class {
|
|
|
2247
2247
|
}
|
|
2248
2248
|
render() {
|
|
2249
2249
|
return h("div", {
|
|
2250
|
-
key: '
|
|
2250
|
+
key: '7550f1c5e29a9be39614404d51dfec9a7aa194a9',
|
|
2251
2251
|
class: "relative bg-stronger rounded-sm"
|
|
2252
2252
|
}, h("div", {
|
|
2253
|
-
key: '
|
|
2253
|
+
key: '8e654051ec6105e051af723e056b4151afc4305c',
|
|
2254
2254
|
class: "text-inverse flex justify-between items-center p-8"
|
|
2255
2255
|
}, this.language ? h("span", {
|
|
2256
2256
|
class: "f-ui-03"
|
|
@@ -2261,23 +2261,23 @@ const EdsCodeBlock = class {
|
|
|
2261
2261
|
}, h("code", {
|
|
2262
2262
|
innerHTML: this.getHighlightedCode()
|
|
2263
2263
|
})), h("span", {
|
|
2264
|
-
key: '
|
|
2264
|
+
key: '1f558301727adb451524850b352844d7658f33a8',
|
|
2265
2265
|
"aria-hidden": "true",
|
|
2266
2266
|
class: "w-20 h-20 mt-8"
|
|
2267
2267
|
}, h("eds-icon-wrapper", {
|
|
2268
|
-
key: '
|
|
2268
|
+
key: '7def1f38f949c32d6138d88a0a7edf9655852491',
|
|
2269
2269
|
icon: this.copied ? 'success' : 'copy',
|
|
2270
2270
|
onClick: () => this.copyToClipboard()
|
|
2271
2271
|
})), h("span", {
|
|
2272
|
-
key: '
|
|
2272
|
+
key: '9eabcd54f3bcdc1c4627a7ca7e22fd38e9755ca6',
|
|
2273
2273
|
class: "sr-only"
|
|
2274
2274
|
}, "Copy Code")), this.language && h("pre", {
|
|
2275
|
-
key: '
|
|
2275
|
+
key: 'd15dce4b1692bf1956e1b3cb3586dde4d9561f1b',
|
|
2276
2276
|
class: `language-${this.language} bg-stronger pl-8 pb-8`,
|
|
2277
2277
|
role: "region",
|
|
2278
2278
|
"aria-label": `Code block in ${this.language}`
|
|
2279
2279
|
}, h("code", {
|
|
2280
|
-
key: '
|
|
2280
|
+
key: 'ad7eb7b40aaab69b6bc929c632ce4736fe3c39a5',
|
|
2281
2281
|
innerHTML: this.getHighlightedCode()
|
|
2282
2282
|
})));
|
|
2283
2283
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 edsGaugeCss = ".relative{position:relative}.absolute{position:absolute}.inline-block{display:inline-block}.rounded-full{border-radius:9999px}.overflow-hidden{overflow:hidden}.bg-inverse{background-color:var(--white)}.bg-current{background-color:currentColor}.bg-dark{background-color:var(--grey-300)}.bg-darker{background-color:var(--grey-400)}.bg-default{background-color:var(--grey-200)}.bg-strong{background-color:var(--grey-700)}.bg-strongest{background-color:var(--black)}.inset-0{inset:0rem}.flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.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)}.text-default{color:var(--black)}";
|
|
7
|
+
const EdsGaugeStyle0 = edsGaugeCss;
|
|
8
|
+
const BACKGROUND_VARIANTS = {
|
|
9
|
+
default: '#f2f2f2',
|
|
10
|
+
dark: '#d8d8d8',
|
|
11
|
+
strong: '#666666',
|
|
12
|
+
black: '#000000'
|
|
13
|
+
};
|
|
14
|
+
const EdsGauge = class {
|
|
15
|
+
constructor(hostRef) {
|
|
16
|
+
registerInstance(this, hostRef);
|
|
17
|
+
this.size = 100;
|
|
18
|
+
this.valueMin = 0;
|
|
19
|
+
this.valueMax = 100;
|
|
20
|
+
this.value = 60;
|
|
21
|
+
this.thickness = 0.1;
|
|
22
|
+
this.variant = 'default';
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
// Clamp thickness to [0,1]
|
|
26
|
+
const thicknessClamped = Math.min(Math.max(this.thickness, 0.1), 0.2);
|
|
27
|
+
// Normalize value within [valueMin, valueMax]
|
|
28
|
+
const clamped = Math.min(Math.max(this.value, this.valueMin), this.valueMax);
|
|
29
|
+
const range = this.valueMax - this.valueMin || 1;
|
|
30
|
+
const ratio = (clamped - this.valueMin) / range;
|
|
31
|
+
// Use the smaller of width/height as diameter
|
|
32
|
+
const diameter = this.size;
|
|
33
|
+
const angle = ratio * 360;
|
|
34
|
+
const ringThickness = thicknessClamped * diameter;
|
|
35
|
+
const innerDiameter = diameter - ringThickness * 2;
|
|
36
|
+
const fontSize = diameter * 0.2;
|
|
37
|
+
// Determine background color for empty portion
|
|
38
|
+
const emptyColor = BACKGROUND_VARIANTS[this.variant] || BACKGROUND_VARIANTS.default;
|
|
39
|
+
const containerStyle = {
|
|
40
|
+
width: `${diameter}px`,
|
|
41
|
+
height: `${diameter}px`,
|
|
42
|
+
background: `conic-gradient(#00e766 0deg ${angle}deg, ${emptyColor} ${angle}deg 360deg)`
|
|
43
|
+
};
|
|
44
|
+
const maskStyle = {
|
|
45
|
+
width: `${innerDiameter}px`,
|
|
46
|
+
height: `${innerDiameter}px`,
|
|
47
|
+
top: `${ringThickness}px`,
|
|
48
|
+
left: `${ringThickness}px`
|
|
49
|
+
};
|
|
50
|
+
const textStyle = {
|
|
51
|
+
fontSize: `${fontSize}px`
|
|
52
|
+
};
|
|
53
|
+
return h("div", {
|
|
54
|
+
key: '2918e034b24749fd1fcad84f4a8614043c6a9ea2',
|
|
55
|
+
role: "progressbar",
|
|
56
|
+
"aria-valuemin": this.valueMin,
|
|
57
|
+
"aria-valuemax": this.valueMax,
|
|
58
|
+
"aria-valuenow": clamped,
|
|
59
|
+
"aria-label": `Gauge value: ${clamped} of ${this.valueMax}`,
|
|
60
|
+
class: "relative inline-block rounded-full overflow-hidden",
|
|
61
|
+
style: containerStyle
|
|
62
|
+
}, h("div", {
|
|
63
|
+
key: 'a24d393bfcdbd45019f7a560c4af0330c720af0c',
|
|
64
|
+
class: "absolute bg-inverse rounded-full",
|
|
65
|
+
style: maskStyle
|
|
66
|
+
}), h("div", {
|
|
67
|
+
key: '712fc9211b6e90afdf7063a4e6a6af74ec88dfdd',
|
|
68
|
+
class: "absolute inset-0 flex items-center justify-center"
|
|
69
|
+
}, h("span", {
|
|
70
|
+
key: '88d3ffc3fea9ff77247b4ecbb4af3a6ac39c1cb4',
|
|
71
|
+
class: "f-body-01 text-default",
|
|
72
|
+
style: textStyle
|
|
73
|
+
}, clamped)));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
EdsGauge.style = EdsGaugeStyle0;
|
|
77
|
+
|
|
78
|
+
export { EdsGauge as eds_gauge };
|