@ebrains/components 0.3.0-alpha.0 → 0.4.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/dist/cjs/{color-3ffe3072.js → color-88793e49.js} +2 -2
- package/dist/cjs/components.cjs.js +1 -1
- package/dist/cjs/eds-accordion_33.cjs.entry.js +2670 -0
- package/dist/cjs/eds-card-project.cjs.entry.js +1 -1
- package/dist/cjs/eds-card-section.cjs.entry.js +3 -3
- package/dist/cjs/eds-card-tags.cjs.entry.js +1 -1
- package/dist/cjs/eds-card-tool.cjs.entry.js +1 -1
- package/dist/cjs/eds-card-wrapper.cjs.entry.js +1 -1
- package/dist/cjs/eds-code-block.cjs.entry.js +48 -1
- package/dist/cjs/eds-matomo-notice.cjs.entry.js +1 -1
- package/dist/cjs/eds-pagination_2.cjs.entry.js +33 -15
- package/dist/cjs/eds-rating.cjs.entry.js +5 -7
- package/dist/cjs/eds-tabs-content.cjs.entry.js +1 -1
- package/dist/cjs/eds-tabs.cjs.entry.js +1 -1
- package/dist/cjs/eds-timeline.cjs.entry.js +3 -2
- package/dist/cjs/eds-tooltip.cjs.entry.js +11 -1
- package/dist/cjs/eds-trl.cjs.entry.js +7 -8
- package/dist/cjs/index-f08e4f5c.js +2 -34
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/eds-accordion/eds-accordion.js +11 -20
- package/dist/collection/components/eds-alert/eds-alert.js +5 -7
- package/dist/collection/components/eds-alert/eds-alert.stories.js +4 -4
- package/dist/collection/components/eds-avatar/eds-avatar.js +1 -1
- package/dist/collection/components/eds-avatar/eds-avatar.stories.js +24 -22
- package/dist/collection/components/eds-block-break/eds-block-break.js +1 -1
- package/dist/collection/components/eds-breadcrump/eds-breadcrump.js +2 -1
- package/dist/collection/components/eds-button/eds-button.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.js +9 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-tags/eds-card-tags.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-title/eds-card-title.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-wrapper/eds-card-wrapper.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-generic/eds-card-generic.js +14 -8
- package/dist/collection/components/eds-cards/eds-card-generic/eds-card-generic.stories.js +1 -1
- package/dist/collection/components/eds-code-block/eds-code-block.js +57 -2
- package/dist/collection/components/eds-code-block/eds-code-block.stories.js +78 -0
- package/dist/collection/components/eds-dropdown/eds-dropdown.js +11 -21
- package/dist/collection/components/eds-form/eds-form.js +41 -31
- package/dist/collection/components/eds-form/eds-form.stories.js +0 -3
- package/dist/collection/components/eds-frame/eds-frame.stories.js +19 -18
- package/dist/collection/components/eds-input-elements/eds-input-select/eds-input-select.js +4 -1
- package/dist/collection/components/eds-link/eds-link.js +3 -4
- package/dist/collection/components/eds-modal/eds-modal.css +16 -0
- package/dist/collection/components/eds-modal/eds-modal.js +71 -29
- package/dist/collection/components/eds-modal/eds-modal.stories.js +34 -18
- package/dist/collection/components/eds-pagination/eds-pagination.js +13 -9
- package/dist/collection/components/eds-rating/eds-rating.js +8 -10
- package/dist/collection/components/eds-section/eds-section-core/eds-section-core.stories.js +12 -11
- package/dist/collection/components/eds-table/eds-table.js +20 -7
- package/dist/collection/components/eds-timeline/eds-timeline.js +3 -2
- package/dist/collection/components/eds-toast/eds-toast.js +21 -0
- package/dist/collection/components/eds-tooltip/eds-tooltip.js +10 -1
- package/dist/collection/components/eds-trl/eds-trl.js +7 -8
- package/dist/collection/shared-ui/eds-card-section/eds-card-section.js +7 -6
- package/dist/collection/shared-ui/eds-card-section/eds-card-section.stories.js +8 -39
- package/dist/components/analytics.js +2 -2
- package/dist/components/components.css +12 -0
- package/dist/components/components.esm.js +1 -1
- package/dist/components/eds-accordion2.js +12 -20
- package/dist/components/eds-alert2.js +5 -7
- package/dist/components/eds-avatar2.js +1 -1
- package/dist/components/eds-block-break2.js +1 -1
- package/dist/components/eds-breadcrumb.js +2 -1
- package/dist/components/eds-button2.js +1 -1
- package/dist/components/eds-card-desc2.js +1 -1
- package/dist/components/eds-card-generic2.js +3 -3
- package/dist/components/eds-card-section.js +3 -3
- package/dist/components/eds-card-tags.js +1 -1
- package/dist/components/eds-card-title2.js +1 -1
- package/dist/components/eds-card-wrapper.js +1 -1
- package/dist/components/eds-code-block2.js +48 -1
- package/dist/components/eds-dropdown2.js +12 -21
- package/dist/components/eds-form.js +37 -12
- package/dist/components/eds-input-select2.js +1 -1
- package/dist/components/eds-link2.js +3 -4
- package/dist/components/eds-modal.js +56 -30
- package/dist/components/eds-pagination2.js +13 -9
- package/dist/components/eds-rating.js +6 -8
- package/dist/components/eds-table2.js +20 -6
- package/dist/components/eds-timeline.js +3 -2
- package/dist/components/eds-toast2.js +21 -0
- package/dist/components/eds-tooltip.js +11 -1
- package/dist/components/eds-trl.js +7 -8
- package/dist/components/p-2dda1ec4.entry.js +1 -0
- package/dist/components/{p-d9788b54.entry.js → p-35ec730b.entry.js} +1 -1
- package/dist/components/{p-e6bfbf51.entry.js → p-5398d652.entry.js} +2 -2
- package/dist/components/{p-e20ed2c7.entry.js → p-610db2b2.entry.js} +1 -1
- package/dist/components/p-832dc95a.entry.js +1 -0
- package/dist/components/p-855aa1a3.entry.js +1 -0
- package/dist/components/{p-52ac3456.entry.js → p-8ddc67a1.entry.js} +1 -1
- package/dist/components/p-ab32b3fc.entry.js +1 -0
- package/dist/components/p-b04eff31.entry.js +1 -0
- package/dist/components/p-b86a4985.js +1 -0
- package/dist/components/{p-2e8459ef.entry.js → p-ba6bafef.entry.js} +1 -1
- package/dist/components/{p-6fc62452.entry.js → p-c3b294a0.entry.js} +1 -1
- package/dist/components/p-c6038449.entry.js +1 -0
- package/dist/components/p-c72c8fb0.entry.js +1 -0
- package/dist/components/p-dd6daa96.entry.js +1 -0
- package/dist/components/{p-73bd0c97.entry.js → p-df94285c.entry.js} +1 -1
- package/dist/esm/{color-0ba8ed56.js → color-bb472c37.js} +2 -2
- package/dist/esm/components.js +1 -1
- package/dist/esm/eds-accordion_33.entry.js +2634 -0
- package/dist/esm/eds-card-project.entry.js +1 -1
- package/dist/esm/eds-card-section.entry.js +3 -3
- package/dist/esm/eds-card-tags.entry.js +1 -1
- package/dist/esm/eds-card-tool.entry.js +1 -1
- package/dist/esm/eds-card-wrapper.entry.js +1 -1
- package/dist/esm/eds-code-block.entry.js +49 -2
- package/dist/esm/eds-matomo-notice.entry.js +1 -1
- package/dist/esm/eds-pagination_2.entry.js +33 -15
- package/dist/esm/eds-rating.entry.js +5 -7
- package/dist/esm/eds-tabs-content.entry.js +1 -1
- package/dist/esm/eds-tabs.entry.js +1 -1
- package/dist/esm/eds-timeline.entry.js +3 -2
- package/dist/esm/eds-tooltip.entry.js +11 -1
- package/dist/esm/eds-trl.entry.js +7 -8
- package/dist/esm/index-e96badea.js +2 -34
- package/dist/esm/loader.js +1 -1
- package/dist/hydrate/index.js +560 -427
- package/dist/hydrate/index.mjs +560 -427
- package/dist/types/components/eds-accordion/eds-accordion.d.ts +5 -12
- package/dist/types/components/eds-avatar/eds-avatar.stories.d.ts +0 -18
- package/dist/types/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.d.ts +8 -0
- package/dist/types/components/eds-cards/eds-card-generic/eds-card-generic.d.ts +6 -2
- package/dist/types/components/eds-code-block/eds-code-block.d.ts +43 -3
- package/dist/types/components/eds-code-block/eds-code-block.stories.d.ts +54 -0
- package/dist/types/components/eds-dropdown/eds-dropdown.d.ts +0 -7
- package/dist/types/components/eds-form/eds-form.d.ts +3 -6
- package/dist/types/components/eds-form/eds-form.stories.d.ts +0 -5
- package/dist/types/components/eds-frame/eds-frame.stories.d.ts +0 -2
- package/dist/types/components/eds-input-elements/eds-input-select/eds-input-select.d.ts +3 -0
- package/dist/types/components/eds-link/eds-link.d.ts +1 -1
- package/dist/types/components/eds-modal/eds-modal.d.ts +18 -3
- package/dist/types/components/eds-modal/eds-modal.stories.d.ts +9 -0
- package/dist/types/components/eds-rating/eds-rating.d.ts +4 -6
- package/dist/types/components/eds-section/eds-section-core/eds-section-core.stories.d.ts +0 -1
- package/dist/types/components/eds-table/eds-table.d.ts +5 -5
- package/dist/types/components/eds-toast/eds-toast.d.ts +9 -0
- package/dist/types/components.d.ts +66 -84
- package/dist/types/shared-ui/eds-card-section/eds-card-section.d.ts +1 -6
- package/dist/types/shared-ui/eds-card-section/eds-card-section.stories.d.ts +42 -21
- package/package.json +1 -1
- package/dist/cjs/eds-accordion.cjs.entry.js +0 -93
- package/dist/cjs/eds-alert.cjs.entry.js +0 -96
- package/dist/cjs/eds-avatar_17.cjs.entry.js +0 -1454
- package/dist/cjs/eds-card-desc_3.cjs.entry.js +0 -117
- package/dist/cjs/eds-card-generic.cjs.entry.js +0 -105
- package/dist/cjs/eds-form.cjs.entry.js +0 -322
- package/dist/cjs/eds-frame.cjs.entry.js +0 -91
- package/dist/cjs/eds-input_7.cjs.entry.js +0 -316
- package/dist/cjs/eds-modal.cjs.entry.js +0 -86
- package/dist/components/p-02e2a62f.entry.js +0 -1
- package/dist/components/p-32f282a9.entry.js +0 -1
- package/dist/components/p-3617841d.entry.js +0 -1
- package/dist/components/p-373673ca.js +0 -1
- package/dist/components/p-3ff76976.entry.js +0 -1
- package/dist/components/p-42b4ecff.entry.js +0 -1
- package/dist/components/p-54c75346.entry.js +0 -1
- package/dist/components/p-5afb626c.entry.js +0 -1
- package/dist/components/p-5d7af761.entry.js +0 -1
- package/dist/components/p-7215789a.entry.js +0 -1
- package/dist/components/p-79887c2c.entry.js +0 -1
- package/dist/components/p-84957b6d.entry.js +0 -1
- package/dist/components/p-96c4deda.entry.js +0 -1
- package/dist/components/p-be6c80da.entry.js +0 -1
- package/dist/components/p-d1f6a722.entry.js +0 -1
- package/dist/components/p-d7a92efb.entry.js +0 -1
- package/dist/components/p-fd27e56c.entry.js +0 -1
- package/dist/esm/eds-accordion.entry.js +0 -89
- package/dist/esm/eds-alert.entry.js +0 -92
- package/dist/esm/eds-avatar_17.entry.js +0 -1434
- package/dist/esm/eds-card-desc_3.entry.js +0 -111
- package/dist/esm/eds-card-generic.entry.js +0 -101
- package/dist/esm/eds-form.entry.js +0 -318
- package/dist/esm/eds-frame.entry.js +0 -87
- package/dist/esm/eds-input_7.entry.js +0 -306
- package/dist/esm/eds-modal.entry.js +0 -82
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
"components/eds-cards/eds-card-generic/eds-card-generic.js",
|
|
3
4
|
"components/eds-accordion/eds-accordion.js",
|
|
4
5
|
"components/eds-alert/eds-alert.js",
|
|
5
6
|
"components/eds-avatar/eds-avatar.js",
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
"components/eds-cards/eds-card-composer/eds-card-tags/eds-card-tags.js",
|
|
11
12
|
"components/eds-cards/eds-card-composer/eds-card-title/eds-card-title.js",
|
|
12
13
|
"components/eds-cards/eds-card-composer/eds-card-wrapper/eds-card-wrapper.js",
|
|
13
|
-
"components/eds-cards/eds-card-generic/eds-card-generic.js",
|
|
14
14
|
"components/eds-cards/eds-card-project/eds-card-project.js",
|
|
15
15
|
"components/eds-cards/eds-card-tool/eds-card-tool.js",
|
|
16
16
|
"components/eds-code-block/eds-code-block.js",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sendAnalytics } from "../../../../../../../packages/utils/src/index";
|
|
1
2
|
import { h } from "@stencil/core";
|
|
2
3
|
/**
|
|
3
4
|
* `EdsAccordion` is a flexible, interactive component for expanding and collapsing content sections.
|
|
@@ -25,9 +26,17 @@ export class EdsAccordion {
|
|
|
25
26
|
* Toggles the `isExpanded` state and emits the `accordionChange` event.
|
|
26
27
|
*/
|
|
27
28
|
this.handleClick = () => {
|
|
29
|
+
var _a;
|
|
28
30
|
this.isExpanded = !this.isExpanded;
|
|
29
31
|
this.accordionChange.emit(this.isExpanded);
|
|
30
32
|
this.setPanelHeight();
|
|
33
|
+
sendAnalytics({
|
|
34
|
+
category: 'ui-component',
|
|
35
|
+
parentContext: null,
|
|
36
|
+
tag: this.el.tagName.toLowerCase(),
|
|
37
|
+
name: ((_a = this.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
38
|
+
action: this.isExpanded ? 'expanded' : 'collapsed'
|
|
39
|
+
});
|
|
31
40
|
};
|
|
32
41
|
/**
|
|
33
42
|
* Calculates and sets the panel height based on the content height
|
|
@@ -58,26 +67,8 @@ export class EdsAccordion {
|
|
|
58
67
|
*/
|
|
59
68
|
componentDidLoad() {
|
|
60
69
|
this.setPanelHeight();
|
|
61
|
-
// Emit context for each eds-link element after the component is fully loaded
|
|
62
|
-
const btn = this.el.shadowRoot.querySelector('eds-button');
|
|
63
|
-
this.emitContext(btn);
|
|
64
70
|
window.addEventListener('resize', this.setPanelHeight);
|
|
65
71
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Emits a custom event called `parentContext` for a given link element.
|
|
68
|
-
* This event provides context information about the breadcrumb component.
|
|
69
|
-
*
|
|
70
|
-
* @param linkElement - The link element to which the event will be dispatched.
|
|
71
|
-
*/
|
|
72
|
-
emitContext(linkElement) {
|
|
73
|
-
const event = new CustomEvent('parentContext', {
|
|
74
|
-
detail: {
|
|
75
|
-
componentName: this.el.tagName.toLowerCase(),
|
|
76
|
-
identifier: null
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
linkElement.dispatchEvent(event);
|
|
80
|
-
}
|
|
81
72
|
/**
|
|
82
73
|
* Lifecycle method that cleans up the resize event listener when the component is removed.
|
|
83
74
|
*/
|
|
@@ -90,10 +81,10 @@ export class EdsAccordion {
|
|
|
90
81
|
*/
|
|
91
82
|
render() {
|
|
92
83
|
const minHeightContentClass = this.minHeightContent ? 'min-h-56' : '';
|
|
93
|
-
return (h("div", { key: '
|
|
84
|
+
return (h("div", { key: '14811b7517511999f97dc8d486f6c1138d89538b', ref: (el) => (this.wrapperRef = el), class: `container flex effect-color border-softer relative grid overflow-hidden rounded-lg border-2 p-16
|
|
94
85
|
${this.switchBg && this.isExpanded ? 'bg-inverse' : 'bg-default'}
|
|
95
86
|
${this.switchBg ? 'hover:bg-inverse' : ''}
|
|
96
|
-
${minHeightContentClass}` }, h("h3", { key: '
|
|
87
|
+
${minHeightContentClass}` }, h("h3", { key: 'a55ab98b74555ab2ff470d824106d3ff2e9b7fec', class: "mr-auto f-heading-06 text-left absolute inset-x-16 top-16 line-clamp-1" }, this.title), h("div", { key: 'b3a76425eed4d05404a51d8991070a12cd1609a1', class: "ml-auto" }, h("eds-button", { key: '06ddefe21175e4bc28ef4477f5fd552689e1cd31', id: "accordionId", intent: "tertiary", "aria-expanded": this.isExpanded || this.shortContent, "aria-controls": "accordionId", class: `effect-color flex w-full items-center justify-between rounded-md outline-none focus:outline-none`, onClick: this.handleClick, icon: "chevron-down" })), h("div", { key: '7330f2824689a61e82c42f00f79e12d4148df2f9', class: `w-full` }, this.description ? (h("span", { class: `text-light ${!this.isExpanded && this.clampText ? 'line-clamp-1' : ''}` }, this.description)) : null, h("section", { key: '533e8014f43ed6d50424f02bfb793456187badd9', id: "sectionId", "aria-hidden": !this.isExpanded, class: `z-1 effect-height relative h-0 w-full ${!this.isExpanded && this.clampText ? 'overflow-hidden' : ''}`, style: { height: this.isExpanded ? 'auto' : '0' } }, h("div", { key: '02a0fa8a79942cd2bc760eb62da9cb910252b6cd', ref: (el) => (this.childContentRef = el), class: `accordion-content effect-color pt-20`, "aria-hidden": !this.isExpanded }, h("span", { key: '33edc6bc83eb4eaa49ae5482841ae642a60ffde8', class: `${!this.isExpanded && this.clampText ? 'line-clamp-2' : ''}` }, h("slot", { key: 'bbbc3fa2b8fc5be7f55d6a45f0f37dc569706ac8' })))))));
|
|
97
88
|
}
|
|
98
89
|
static get is() { return "eds-accordion"; }
|
|
99
90
|
static get encapsulation() { return "shadow"; }
|
|
@@ -70,10 +70,8 @@ export class EdsAlert {
|
|
|
70
70
|
}
|
|
71
71
|
componentDidLoad() {
|
|
72
72
|
// Query all 'eds-link' elements, including those inside shadow DOM
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
this.emitContext(link);
|
|
76
|
-
});
|
|
73
|
+
const lnk = this.el.shadowRoot.querySelector('eds-link');
|
|
74
|
+
this.emitContext(lnk);
|
|
77
75
|
}
|
|
78
76
|
emitContext(linkElement) {
|
|
79
77
|
const event = new CustomEvent('parentContext', {
|
|
@@ -85,12 +83,12 @@ export class EdsAlert {
|
|
|
85
83
|
linkElement.dispatchEvent(event);
|
|
86
84
|
}
|
|
87
85
|
render() {
|
|
88
|
-
return (h("div", { key: '
|
|
86
|
+
return (h("div", { key: '089491004acd618827ef139a7c2ef486726cea9d', class: alertStyles({
|
|
89
87
|
intent: this.intent,
|
|
90
88
|
direction: this.direction,
|
|
91
89
|
withBtn: this.withBtn
|
|
92
|
-
}), role: "alert" }, h("p", { key: '
|
|
93
|
-
(this.pressableUrl ? (h("eds-link", { class: "eds-alert-link", label: this.pressableLabel, url: this.pressableUrl, intent: "secondary" })) : null)));
|
|
90
|
+
}), role: "alert" }, h("p", { key: '9a54555621b492f65b38ecd3cbb44660bf516e51', class: "f-ui-01 py-8" }, this.message), this.withBtn &&
|
|
91
|
+
(this.pressableUrl ? (h("eds-link", { class: "eds-alert-link", label: this.pressableLabel, url: this.pressableUrl, intent: "secondary", external: true })) : null)));
|
|
94
92
|
}
|
|
95
93
|
static get is() { return "eds-alert"; }
|
|
96
94
|
static get encapsulation() { return "shadow"; }
|
|
@@ -29,8 +29,8 @@ export default {
|
|
|
29
29
|
message: 'This is an alert message.',
|
|
30
30
|
intent: 'default',
|
|
31
31
|
direction: 'horizontal',
|
|
32
|
-
pressableLabel: '',
|
|
33
|
-
pressableUrl: ''
|
|
32
|
+
pressableLabel: 'Click Me',
|
|
33
|
+
pressableUrl: 'https://example.com'
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
export const Default = {
|
|
@@ -46,7 +46,7 @@ export const Default = {
|
|
|
46
46
|
message: 'This is an alert message.',
|
|
47
47
|
intent: 'default',
|
|
48
48
|
direction: 'horizontal',
|
|
49
|
-
pressableLabel: '',
|
|
50
|
-
pressableUrl: ''
|
|
49
|
+
pressableLabel: 'Click Me',
|
|
50
|
+
pressableUrl: 'https://example.com'
|
|
51
51
|
}
|
|
52
52
|
};
|
|
@@ -68,7 +68,7 @@ export class EdsAvatar {
|
|
|
68
68
|
* @returns {JSX.Element} The rendered avatar component.
|
|
69
69
|
*/
|
|
70
70
|
render() {
|
|
71
|
-
return (h("div", { key: '
|
|
71
|
+
return (h("div", { key: '3ba716296c615d31ce7f3f41fd57e732adc530bf', class: this.containerClasses }, this.picture ? (h("eds-img", { src: this.picture, width: 54, height: 54, sizes: "120px", alt: `${this.firstName} ${this.lastName}`, lazyload: true, withBg: true })) : (h("abbr", { title: this.computedInitials || `${this.firstName} ${this.lastName}`, class: "!no-underline f-ui-01" }, this.computedInitials))));
|
|
72
72
|
}
|
|
73
73
|
static get is() { return "eds-avatar"; }
|
|
74
74
|
static get encapsulation() { return "shadow"; }
|
|
@@ -33,33 +33,35 @@ export const Default = {
|
|
|
33
33
|
rounded: false
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
export const WithPicture = {
|
|
37
|
-
|
|
38
|
-
<eds-avatar
|
|
39
|
-
first-name="${args.firstName}"
|
|
40
|
-
last-name="${args.lastName}"
|
|
36
|
+
/*export const WithPicture = {
|
|
37
|
+
render: (args) => `
|
|
38
|
+
<eds-avatar
|
|
39
|
+
first-name="${args.firstName}"
|
|
40
|
+
last-name="${args.lastName}"
|
|
41
41
|
picture="${args.picture}"
|
|
42
42
|
rounded=${args.rounded}
|
|
43
43
|
></eds-avatar>`,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
args: {
|
|
45
|
+
firstName: 'Jane',
|
|
46
|
+
lastName: 'Doe',
|
|
47
|
+
picture:
|
|
48
|
+
'https://files.ebrains.eu/img/686e0edc-f3be-4d79-aa02-373c32c08d65/ebrains-logo-high-resolution.png?fit=max&q=80&fm=webp&crop=879%2C879%2C597%2C0&w=200',
|
|
49
|
+
rounded: true
|
|
50
|
+
}
|
|
50
51
|
};
|
|
52
|
+
|
|
51
53
|
export const BackgroundColorVariant = {
|
|
52
|
-
|
|
53
|
-
<eds-avatar
|
|
54
|
-
first-name="${args.firstName}"
|
|
55
|
-
last-name="${args.lastName}"
|
|
54
|
+
render: (args) => `
|
|
55
|
+
<eds-avatar
|
|
56
|
+
first-name="${args.firstName}"
|
|
57
|
+
last-name="${args.lastName}"
|
|
56
58
|
color="${args.color}"
|
|
57
59
|
rounded=${args.rounded}
|
|
58
60
|
></eds-avatar>`,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
61
|
+
args: {
|
|
62
|
+
firstName: 'Bob',
|
|
63
|
+
lastName: 'Brown',
|
|
64
|
+
color: 'grey',
|
|
65
|
+
rounded: true
|
|
66
|
+
}
|
|
67
|
+
};*/
|
|
@@ -12,7 +12,7 @@ export class EdsBlockBreak {
|
|
|
12
12
|
this.extraClass = '';
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return h("hr", { key: '
|
|
15
|
+
return h("hr", { key: '58ffdece778da8f323dd130908254690b3f6c8d3', class: `border-softer my-20 inline-block w-full border-t-2 ${this.extraClass}` });
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "eds-block-break"; }
|
|
18
18
|
static get encapsulation() { return "shadow"; }
|
|
@@ -47,6 +47,7 @@ export class EdsBreadcrumb {
|
|
|
47
47
|
this.parsedItems = Array.isArray(parsed) ? parsed : [];
|
|
48
48
|
}
|
|
49
49
|
catch (e) {
|
|
50
|
+
// eslint-disable-next-line
|
|
50
51
|
console.error('Error parsing breadcrumb items:', e);
|
|
51
52
|
this.parsedItems = [];
|
|
52
53
|
}
|
|
@@ -142,7 +143,7 @@ export class EdsBreadcrumb {
|
|
|
142
143
|
*/
|
|
143
144
|
render() {
|
|
144
145
|
const itemsToRender = this.getTruncatedItems();
|
|
145
|
-
return (h("nav", { key: '
|
|
146
|
+
return (h("nav", { key: 'd66dd18fe856e4a8d82e47117d2de0288a9e3c56', "aria-label": "Breadcrumb" }, h("ol", { key: 'b3a218032b312cb5973c1ca59ab7bedcfc07d676', class: "flex items-center space-x-2" }, itemsToRender.map((item, index) => {
|
|
146
147
|
const isLast = index === itemsToRender.length - 1;
|
|
147
148
|
return (h("li", { class: "flex items-center" }, !item.isHidden ? (h("eds-link", { label: item.label, url: item.url, intent: this.intent, current: isLast, "aria-label": item.label, size: "small", "icon-small": "false" })) : (h("span", { class: "truncate px-2 ", "aria-hidden": "true" }, "...")), !isLast && !item.isHidden && (h("eds-icon-wrapper", { icon: "chevron-right", class: "w-20 h-20" }))));
|
|
148
149
|
}))));
|
|
@@ -226,7 +226,7 @@ export class EdsButton {
|
|
|
226
226
|
show: !this.loading
|
|
227
227
|
});
|
|
228
228
|
const ElementType = this.elementType;
|
|
229
|
-
return (h(ElementType, { key: '
|
|
229
|
+
return (h(ElementType, { key: 'e571ed0d3e2f4aa262259afea7d44d19b5685be7', "aria-label": this.label || this.ariaLabel || undefined, "aria-disabled": this.elementType === 'button' ? this.disabled : undefined, disabled: this.elementType === 'button' ? this.disabled : undefined, class: `${classes || ''} ${this.extraClass || ''}`, onClick: (event) => this.handleClick(event) }, this.label && h("span", { key: '8928bd512c6fb592ed8d2d25ad46213a5a7f4bf5', class: this.loading ? 'opacity-0' : '' }, this.label), this.loading && (h("span", { key: '8fdb5947ef65c60e5cc47f04d8fbe2f8485aa6bf', class: "absolute inset-0 flex items-center justify-center" }, h("span", { key: '5a6cf5d4f2debc279066cb49fa30da7b66f5532b', class: "loader", style: {
|
|
230
230
|
border: `3px solid ${this.intent === 'secondary' ? 'rgba(255, 255, 255, .3)' : 'rgba(0, 0, 0, .3)'}`,
|
|
231
231
|
borderBottomColor: this.intent === 'secondary' ? '#fff' : '#000'
|
|
232
232
|
} }))), this.icon ? h("eds-icon-wrapper", { class: iconClasses, icon: this.icon }) : null));
|
package/dist/collection/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* `eds-card-desc` is a simple component that renders a card description.
|
|
4
|
+
*
|
|
5
|
+
* It displays a block of text with optional truncation applied using a CSS line clamp.
|
|
6
|
+
* You can customize the description styling via the `descClass` property and control
|
|
7
|
+
* whether or not the text is truncated and to how many lines.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
2
10
|
export class EdsCardDesc {
|
|
3
11
|
constructor() {
|
|
4
12
|
this.description = undefined;
|
|
@@ -10,7 +18,7 @@ export class EdsCardDesc {
|
|
|
10
18
|
return this.truncate && this.truncateLines ? `line-clamp-${this.truncateLines}` : '';
|
|
11
19
|
}
|
|
12
20
|
render() {
|
|
13
|
-
return (h("p", { key: '
|
|
21
|
+
return (h("p", { key: 'ca38bcc0895d5a0c87fda782ef455e45c4b53263', class: `text-light ${this.descClass}` }, h("span", { key: '3108eec08a760b1db7ce1a7be05b68749f8f930b', class: this.getTruncateClass() }, this.description)));
|
|
14
22
|
}
|
|
15
23
|
static get is() { return "eds-card-desc"; }
|
|
16
24
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/eds-cards/eds-card-composer/eds-card-tags/eds-card-tags.js
CHANGED
|
@@ -8,7 +8,7 @@ export class EdsCardTags {
|
|
|
8
8
|
this.tags = [];
|
|
9
9
|
}
|
|
10
10
|
render() {
|
|
11
|
-
return (h("div", { key: '
|
|
11
|
+
return (h("div", { key: '60a129de62d45736eba0884cc24c9738f3a0f55c', class: "flex flex-wrap gap-y-4" }, this.tags.map((tag, index) => (h("eds-tag", { key: index, intent: this.accent ? 'accent' : 'default', label: tag })))));
|
|
12
12
|
}
|
|
13
13
|
static get is() { return "eds-card-tags"; }
|
|
14
14
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/eds-cards/eds-card-composer/eds-card-title/eds-card-title.js
CHANGED
|
@@ -43,7 +43,7 @@ export class EdsCardTitle {
|
|
|
43
43
|
render() {
|
|
44
44
|
//const Tag = this.getTag();
|
|
45
45
|
const Heading = this.headingLevel;
|
|
46
|
-
return (h(Heading, { key: '
|
|
46
|
+
return (h(Heading, { key: 'a654161b2c53e944eaefb21be7189a5e0acb06cf', class: this.getTitleClass() }, h("a", { key: '868fd911c1a8c366d726e886bfc7827487013e27', class: "break-words after:absolute after:inset-0 after:z-10 after:content-[''] focus:outline-none", href: this.url, target: this.externalLink ? '_blank' : undefined, rel: this.externalLink ? 'noopener noreferrer' : undefined }, this.cardTitle)));
|
|
47
47
|
}
|
|
48
48
|
static get is() { return "eds-card-title"; }
|
|
49
49
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/eds-cards/eds-card-composer/eds-card-wrapper/eds-card-wrapper.js
CHANGED
|
@@ -21,7 +21,7 @@ export class EdsCardWrapper {
|
|
|
21
21
|
this.withHover ? 'effect-shadow hover:shadow-hover cursor-pointer' : '',
|
|
22
22
|
'border-softer effect-focus-within relative flex grow flex-col rounded-lg border-2 p-16'
|
|
23
23
|
].join(' ');
|
|
24
|
-
return (h("article", { key: '
|
|
24
|
+
return (h("article", { key: '7c12b1d147f061e189b5dda5d517ec4eae0c3691', class: articleClasses }, h("slot", { key: 'f506bad73ed38ae36931f88f7d7c5f5d94705e4f' }), this.hasSlot('footer') && (h("div", { key: '783f480be269e4a2f61aa8d4396e757fe41bfcc6', class: "mt-auto" }, h("slot", { key: 'f07ddaa2d930518a5c8ac82efab3cb0dd6647bdd', name: "footer" })))));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "eds-card-wrapper"; }
|
|
27
27
|
static get properties() {
|
|
@@ -22,7 +22,7 @@ export class EdsCardGeneric {
|
|
|
22
22
|
this.avatar = undefined;
|
|
23
23
|
this.shortAbbreviation = undefined;
|
|
24
24
|
this.headingLevel = 'h3';
|
|
25
|
-
this.tags =
|
|
25
|
+
this.tags = [];
|
|
26
26
|
this.tiny = false;
|
|
27
27
|
this.bg = true;
|
|
28
28
|
this.withHover = true;
|
|
@@ -98,7 +98,7 @@ export class EdsCardGeneric {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
render() {
|
|
101
|
-
return (h("article", { key: '
|
|
101
|
+
return (h("article", { key: '5b498abfc65206fe89c9e54e673a81e1b6ed37d5', class: this.articleClasses(), onClick: () => this.handleClick() }, h("eds-card-title", { key: '61a0c6076957e39ab2a059c8587fc2e716e470bc', "heading-level": this.headingLevel, titleClass: this.image ? 'f-ui-01' : undefined, "card-title": this.cardTitle, url: this.url, hierarchy: this.hierarchy }), this.description && (h("eds-card-desc", { key: '6df3c08512acf60e22001867ab5691aa19f67961', class: "mt-8", "truncate-lines": "3", description: this.description })), this.parsedImage ? (h("eds-img", Object.assign({ class: "mt-8" }, this.parsedImage))) : this.avatar || this.shortAbbreviation ? (h("eds-avatar", { class: "order-first mb-12", picture: this.avatar, initials: this.shortAbbreviation })) : null, h("div", { key: '712193c8afac6744e2512d8b760daf2c850987b9', class: "flex flex-wrap gap-y-4" }, this.parsedTags.map((tag, index) => (h("eds-tag", { key: index, intent: tag.style, label: tag.label })))), ' '));
|
|
102
102
|
}
|
|
103
103
|
static get is() { return "eds-card-generic"; }
|
|
104
104
|
static get encapsulation() { return "shadow"; }
|
|
@@ -235,22 +235,28 @@ export class EdsCardGeneric {
|
|
|
235
235
|
"defaultValue": "'h3'"
|
|
236
236
|
},
|
|
237
237
|
"tags": {
|
|
238
|
-
"type": "
|
|
238
|
+
"type": "string",
|
|
239
239
|
"mutable": false,
|
|
240
240
|
"complexType": {
|
|
241
|
-
"original": "
|
|
242
|
-
"resolved": "
|
|
243
|
-
"references": {
|
|
241
|
+
"original": "string | Tag[]",
|
|
242
|
+
"resolved": "Tag[] | string",
|
|
243
|
+
"references": {
|
|
244
|
+
"Tag": {
|
|
245
|
+
"location": "local",
|
|
246
|
+
"path": "/Users/nigeor/Documents/Projects/EBRAINS/ebrains-ui-ecosystem/packages/components/src/components/eds-cards/eds-card-generic/eds-card-generic.tsx",
|
|
247
|
+
"id": "../../../packages/components/src/components/eds-cards/eds-card-generic/eds-card-generic.tsx::Tag"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
244
250
|
},
|
|
245
251
|
"required": false,
|
|
246
252
|
"optional": false,
|
|
247
253
|
"docs": {
|
|
248
254
|
"tags": [],
|
|
249
|
-
"text": "
|
|
255
|
+
"text": "Tags related to the card content."
|
|
250
256
|
},
|
|
251
257
|
"attribute": "tags",
|
|
252
258
|
"reflect": false,
|
|
253
|
-
"defaultValue": "
|
|
259
|
+
"defaultValue": "[]"
|
|
254
260
|
},
|
|
255
261
|
"tiny": {
|
|
256
262
|
"type": "boolean",
|
|
@@ -5,18 +5,72 @@ import "prismjs/components/prism-bash"; // Add support for Bash/Shell
|
|
|
5
5
|
import "prismjs/components/prism-yaml"; // Add YAML support
|
|
6
6
|
//import 'prismjs/components/prism-html';
|
|
7
7
|
import "prismjs/components/prism-css";
|
|
8
|
+
//import { sendAnalytics } from '@ebrains/utils';
|
|
9
|
+
/**
|
|
10
|
+
* A component that displays a code block with syntax highlighting.
|
|
11
|
+
*
|
|
12
|
+
* Uses Prism.js for syntax highlighting. Supports multiple languages such as JavaScript, HTML, CSS,
|
|
13
|
+
* Python, Bash/Shell, and YAML.
|
|
14
|
+
*
|
|
15
|
+
* */
|
|
8
16
|
export class EdsCodeBlock {
|
|
9
17
|
constructor() {
|
|
10
18
|
this.code = undefined;
|
|
11
19
|
this.language = undefined;
|
|
12
20
|
this.copied = false;
|
|
13
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Copies the current code content to the clipboard and sets a temporary copied state.
|
|
24
|
+
*
|
|
25
|
+
* @private
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
14
28
|
copyToClipboard() {
|
|
15
29
|
navigator.clipboard.writeText(this.code).then(() => {
|
|
16
30
|
this.copied = true;
|
|
31
|
+
/*const analyticsName = this.createHumanFriendlyAnalyticsName(this.code, this.language);
|
|
32
|
+
sendAnalytics({
|
|
33
|
+
category: 'ui-component',
|
|
34
|
+
parentContext: null,
|
|
35
|
+
tag: this.el.tagName.toLowerCase(),
|
|
36
|
+
name: analyticsName || '',
|
|
37
|
+
action: 'copy'
|
|
38
|
+
});*/
|
|
17
39
|
setTimeout(() => (this.copied = false), 2000);
|
|
18
40
|
});
|
|
19
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Utility function that creates a human-friendly analytics name based on the code and language.
|
|
44
|
+
* It uses:
|
|
45
|
+
* - The language (in uppercase)
|
|
46
|
+
* - The number of non-empty lines in the code
|
|
47
|
+
* - The first non-empty line of code (truncated to 30 characters, if needed)
|
|
48
|
+
*
|
|
49
|
+
* returns A descriptive analytics name.
|
|
50
|
+
*/
|
|
51
|
+
/*private createHumanFriendlyAnalyticsName(code: string, language: string): string {
|
|
52
|
+
// Count non-empty lines
|
|
53
|
+
const lines = code.split('\n').filter(line => line.trim() !== '').length;
|
|
54
|
+
|
|
55
|
+
// Find the first non-empty line and trim it
|
|
56
|
+
let firstNonEmptyLine = code.split('\n').find(line => line.trim() !== '');
|
|
57
|
+
firstNonEmptyLine = firstNonEmptyLine ? firstNonEmptyLine.trim() : '';
|
|
58
|
+
|
|
59
|
+
// Truncate the snippet if it’s too long
|
|
60
|
+
if (firstNonEmptyLine.length > 30) {
|
|
61
|
+
firstNonEmptyLine = firstNonEmptyLine.substring(0, 30) + '...';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return `CodeBlock:${language.toLowerCase()}|${lines}-line(s)|${firstNonEmptyLine.toLowerCase()}`;
|
|
65
|
+
}*/
|
|
66
|
+
/**
|
|
67
|
+
* Returns the syntax-highlighted HTML for the code.
|
|
68
|
+
* If the provided language is supported by Prism, this method returns the highlighted code.
|
|
69
|
+
* Otherwise, it logs a warning and returns the raw code.
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
* @returns {string} The highlighted HTML string for the code block.
|
|
73
|
+
*/
|
|
20
74
|
getHighlightedCode() {
|
|
21
75
|
if (this.language && Prism.languages[this.language]) {
|
|
22
76
|
return Prism.highlight(this.code, Prism.languages[this.language], this.language);
|
|
@@ -26,7 +80,7 @@ export class EdsCodeBlock {
|
|
|
26
80
|
return this.code; // Fallback if language is not provided or unsupported
|
|
27
81
|
}
|
|
28
82
|
render() {
|
|
29
|
-
return (h("div", { key: '
|
|
83
|
+
return (h("div", { key: '00eba9265ee17605f699d1e5606013b68e900b29', class: "relative bg-stronger rounded-sm" }, h("div", { key: '1192584f04de5ff74e91c88597a3360b92053456', class: "text-inverse flex justify-between items-center p-8" }, this.language ? (h("span", { class: "f-ui-03" }, this.language.toUpperCase())) : (h("pre", { class: "bg-stronger pl-8", role: "region", "aria-label": "Code block without language" }, h("code", { innerHTML: this.getHighlightedCode() }))), h("span", { key: '3666b6529a16a8cc64f448527db4ddee08f977a3', "aria-hidden": "true", class: "w-20 h-20 mt-8" }, h("eds-icon-wrapper", { key: 'f222d95a2e548429f6c4de96a7646e3cef1f360f', icon: this.copied ? 'success' : 'copy', onClick: () => this.copyToClipboard() })), h("span", { key: '8c539deda773909c01a41eb04ee51380c0a9c4bb', class: "sr-only" }, "Copy Code")), this.language && (h("pre", { key: '99541dedb32c543da5e780ffee4460333fbb3724', class: `language-${this.language} bg-stronger pl-8 pb-8`, role: "region", "aria-label": `Code block in ${this.language}` }, h("code", { key: '4e6ae6fcfae3de8c1fe5ad9d22309e0c8bee0c2c', innerHTML: this.getHighlightedCode() })))));
|
|
30
84
|
}
|
|
31
85
|
static get is() { return "eds-code-block"; }
|
|
32
86
|
static get encapsulation() { return "shadow"; }
|
|
@@ -54,7 +108,7 @@ export class EdsCodeBlock {
|
|
|
54
108
|
"optional": false,
|
|
55
109
|
"docs": {
|
|
56
110
|
"tags": [],
|
|
57
|
-
"text": "The code content to display"
|
|
111
|
+
"text": "The code content to display."
|
|
58
112
|
},
|
|
59
113
|
"attribute": "code",
|
|
60
114
|
"reflect": false
|
|
@@ -83,4 +137,5 @@ export class EdsCodeBlock {
|
|
|
83
137
|
"copied": {}
|
|
84
138
|
};
|
|
85
139
|
}
|
|
140
|
+
static get elementRef() { return "el"; }
|
|
86
141
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Components/CodeBlock',
|
|
3
|
+
component: 'eds-code-block',
|
|
4
|
+
argTypes: {
|
|
5
|
+
code: {
|
|
6
|
+
control: 'text',
|
|
7
|
+
description: 'The code content to display in the code block.'
|
|
8
|
+
},
|
|
9
|
+
language: {
|
|
10
|
+
control: 'text',
|
|
11
|
+
description: 'The language type for syntax highlighting (e.g., "javascript", "python", "bash", "yaml").'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
code: "const greeting = 'Hello, world!';\nconsole.log(greeting);",
|
|
16
|
+
language: 'javascript'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const Default = {
|
|
20
|
+
render: (args) => `
|
|
21
|
+
<eds-code-block
|
|
22
|
+
code="${args.code}"
|
|
23
|
+
language="${args.language}"
|
|
24
|
+
></eds-code-block>
|
|
25
|
+
`,
|
|
26
|
+
args: {
|
|
27
|
+
code: "const greeting = 'Hello, world!';\nconsole.log(greeting);",
|
|
28
|
+
language: 'javascript'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export const PythonExample = {
|
|
32
|
+
render: (args) => `
|
|
33
|
+
<eds-code-block
|
|
34
|
+
code="${args.code}"
|
|
35
|
+
language="${args.language}"
|
|
36
|
+
></eds-code-block>
|
|
37
|
+
`,
|
|
38
|
+
args: {
|
|
39
|
+
code: "def hello_world():\n print('Hello, world!')",
|
|
40
|
+
language: 'python'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export const BashExample = {
|
|
44
|
+
render: (args) => `
|
|
45
|
+
<eds-code-block
|
|
46
|
+
code="${args.code}"
|
|
47
|
+
language="${args.language}"
|
|
48
|
+
></eds-code-block>
|
|
49
|
+
`,
|
|
50
|
+
args: {
|
|
51
|
+
code: '#!/bin/bash\necho "Hello, world!"',
|
|
52
|
+
language: 'bash'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export const YamlExample = {
|
|
56
|
+
render: (args) => `
|
|
57
|
+
<eds-code-block
|
|
58
|
+
code="${args.code}"
|
|
59
|
+
language="${args.language}"
|
|
60
|
+
></eds-code-block>
|
|
61
|
+
`,
|
|
62
|
+
args: {
|
|
63
|
+
code: 'greeting: "Hello, world!"',
|
|
64
|
+
language: 'yaml'
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export const UnsupportedLanguage = {
|
|
68
|
+
render: (args) => `
|
|
69
|
+
<eds-code-block
|
|
70
|
+
code="${args.code}"
|
|
71
|
+
language="${args.language}"
|
|
72
|
+
></eds-code-block>
|
|
73
|
+
`,
|
|
74
|
+
args: {
|
|
75
|
+
code: 'This is a code block with an unsupported language. It will render without syntax highlighting.',
|
|
76
|
+
language: 'unknown'
|
|
77
|
+
}
|
|
78
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sendAnalytics } from "../../../../../../../packages/utils/src/index";
|
|
1
2
|
import { h } from "@stencil/core";
|
|
2
3
|
/**
|
|
3
4
|
* `EdsDropdown` is a versatile dropdown component that provides a list of items
|
|
@@ -19,6 +20,7 @@ export class EdsDropdown {
|
|
|
19
20
|
* Toggles the visibility of the dropdown and manages focus.
|
|
20
21
|
*/
|
|
21
22
|
this.handleClick = () => {
|
|
23
|
+
var _a;
|
|
22
24
|
this.isOpen = !this.isOpen;
|
|
23
25
|
if (this.isOpen) {
|
|
24
26
|
this.focusIndex = 0;
|
|
@@ -27,6 +29,13 @@ export class EdsDropdown {
|
|
|
27
29
|
else {
|
|
28
30
|
this.closeDropdown();
|
|
29
31
|
}
|
|
32
|
+
sendAnalytics({
|
|
33
|
+
category: 'ui-component',
|
|
34
|
+
parentContext: null,
|
|
35
|
+
tag: this.host.tagName.toLowerCase(),
|
|
36
|
+
name: ((_a = this.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
37
|
+
action: this.isOpen ? 'expanded' : 'collapsed'
|
|
38
|
+
});
|
|
30
39
|
};
|
|
31
40
|
this.icon = 'chevron-down';
|
|
32
41
|
this.label = undefined;
|
|
@@ -93,39 +102,20 @@ export class EdsDropdown {
|
|
|
93
102
|
componentDidLoad() {
|
|
94
103
|
var _a;
|
|
95
104
|
this.focusableItems = Array.from(((_a = this.dropdownContent) === null || _a === void 0 ? void 0 : _a.querySelectorAll('a, button')) || []);
|
|
96
|
-
const btns = this.host.shadowRoot.querySelectorAll('eds-button');
|
|
97
|
-
btns.forEach((btn) => {
|
|
98
|
-
this.emitContext(btn);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Emits a custom event called `parentContext` for a given button element.
|
|
103
|
-
* Provides context information about the dropdown component.
|
|
104
|
-
*
|
|
105
|
-
* @param linkElement - The button element to which the event will be dispatched.
|
|
106
|
-
*/
|
|
107
|
-
emitContext(linkElement) {
|
|
108
|
-
const event = new CustomEvent('parentContext', {
|
|
109
|
-
detail: {
|
|
110
|
-
componentName: this.host.tagName.toLowerCase(),
|
|
111
|
-
identifier: null
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
linkElement.dispatchEvent(event);
|
|
115
105
|
}
|
|
116
106
|
/**
|
|
117
107
|
* Renders the dropdown component and displays its content when open.
|
|
118
108
|
* @returns {JSX.Element} The rendered dropdown component.
|
|
119
109
|
*/
|
|
120
110
|
render() {
|
|
121
|
-
return (h("div", { key: '
|
|
111
|
+
return (h("div", { key: '809cb733330db434f94f854ed4d1ee375f598297', class: "z-focus relative", ref: (el) => (this.dropdownContent = el) }, h("eds-button", { key: 'c80f2930b335708a2a01d06b565673597bd8d926', label: this.label, "aria-label": this.ariaLabel, icon: this.icon, intent: this.intent, onClick: this.handleClick, "aria-expanded": this.isOpen.toString(), "aria-haspopup": "menu" }), h("nav", { key: '7b3ccb2ab29474a4795d5491960e0713aefcd624', class: {
|
|
122
112
|
'shadow-small bg-inverse border-softest z-10 z-on-top absolute top-full mt-4 flex flex-col gap-y-4 border-2 p-8': true,
|
|
123
113
|
'left-4': this.dropdownPos === 'left' && this.dropdownOffset,
|
|
124
114
|
'left-0': this.dropdownPos === 'left' && !this.dropdownOffset,
|
|
125
115
|
'right-4': this.dropdownPos === 'right' && this.dropdownOffset,
|
|
126
116
|
'right-0': this.dropdownPos === 'right' && !this.dropdownOffset,
|
|
127
117
|
'rounded-lg': this.rounded
|
|
128
|
-
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, h("slot", { key: '
|
|
118
|
+
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, h("slot", { key: 'c514c5dca893708fd1660a61cfeb1607229bbff5' }))));
|
|
129
119
|
}
|
|
130
120
|
static get is() { return "eds-dropdown"; }
|
|
131
121
|
static get encapsulation() { return "shadow"; }
|