@rededor/cura 1.2.0 → 1.3.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/{app-globals-4d07f363.js → app-globals-f33ceef8.js} +32 -1
- package/dist/cjs/app-globals-f33ceef8.js.map +1 -0
- package/dist/cjs/cura-accordion_12.cjs.entry.js +39 -38
- package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-alert.cjs.entry.js +3 -2
- package/dist/cjs/cura-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-avatar.cjs.entry.js +1 -1
- package/dist/cjs/cura-badge-distance.cjs.entry.js +1 -1
- package/dist/cjs/cura-badge-number.cjs.entry.js +2 -2
- package/dist/cjs/cura-badge-number.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-outline.cjs.entry.js +1 -1
- package/dist/cjs/cura-button-select.cjs.entry.js +17 -9
- package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-transparent.cjs.entry.js +1 -1
- package/dist/cjs/cura-calendar.cjs.entry.js +2 -2
- package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-card.cjs.entry.js +1 -1
- package/dist/cjs/cura-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/cura-display.cjs.entry.js +1 -1
- package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +1 -1
- package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +2 -2
- package/dist/cjs/cura-dropdown-search.cjs.entry.js +21 -11
- package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js +3 -3
- package/dist/cjs/cura-input-date.cjs.entry.js +45 -45
- package/dist/cjs/cura-input-date.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-loader-bar.cjs.entry.js +1 -1
- package/dist/cjs/cura-radio.cjs.entry.js +1 -1
- package/dist/cjs/cura-switch.cjs.entry.js +1 -1
- package/dist/cjs/cura-toast.cjs.entry.js +1 -1
- package/dist/cjs/cura-tooltip.cjs.entry.js +232 -0
- package/dist/cjs/cura-tooltip.cjs.entry.js.map +1 -0
- package/dist/cjs/cura.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/api/theme-presets/theme-presets.js +2 -0
- package/dist/collection/api/theme-presets/theme-presets.js.map +1 -1
- package/dist/collection/api/theme-presets/theme-richet.js +32 -0
- package/dist/collection/api/theme-presets/theme-richet.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.css +0 -6
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.js +41 -43
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.js.map +1 -1
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +54 -36
- package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js.map +1 -1
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.css +61 -60
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js +41 -23
- package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js.map +1 -1
- package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.js +1 -1
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.css +0 -2
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js +1 -1
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js.map +1 -1
- package/dist/collection/components/buttons/cura-button/cura-button.js +1 -1
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +36 -2
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +39 -11
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js +18 -7
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +1 -1
- package/dist/collection/components/cura-alert/cura-alert.css +25 -11
- package/dist/collection/components/cura-alert/cura-alert.js +2 -1
- package/dist/collection/components/cura-alert/cura-alert.js.map +1 -1
- package/dist/collection/components/cura-avatar/cura-avatar.js +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.css +1 -0
- package/dist/collection/components/cura-calendar/cura-calendar.js +1 -1
- package/dist/collection/components/cura-card/cura-card.js +1 -1
- package/dist/collection/components/cura-icon/cura-icon.js +1 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +3 -3
- package/dist/collection/components/cura-page-template/cura-page-template.js +1 -1
- package/dist/collection/components/cura-toast/cura-toast.js +1 -1
- package/dist/collection/components/cura-tooltip/cura-tooltip.css +159 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.js +397 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.js.map +1 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.stories.js +137 -0
- package/dist/collection/components/cura-tooltip/cura-tooltip.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +2 -2
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +20 -10
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
- package/dist/collection/components/forms/cura-input-date/cura-input-date.css +15 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js +69 -68
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js.map +1 -1
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js +29 -10
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
- package/dist/collection/components/forms/cura-label/cura-label.js +1 -1
- package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.js +3 -3
- package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
- package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js +1 -1
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +1 -1
- package/dist/collection/components/text/cura-display/cura-display.js +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.css +5 -1
- package/dist/collection/components/text/cura-heading/cura-heading.js +7 -6
- package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
- package/dist/components/cura-accordion-item.js +19 -12
- package/dist/components/cura-accordion-item.js.map +1 -1
- package/dist/components/cura-accordion.js +14 -15
- package/dist/components/cura-accordion.js.map +1 -1
- package/dist/components/cura-alert.js +3 -2
- package/dist/components/cura-alert.js.map +1 -1
- package/dist/components/cura-avatar.js +1 -1
- package/dist/components/cura-badge-distance.js +1 -1
- package/dist/components/cura-badge-number2.js +2 -2
- package/dist/components/cura-badge-number2.js.map +1 -1
- package/dist/components/cura-button-outline.js +1 -1
- package/dist/components/cura-button-select.js +18 -9
- package/dist/components/cura-button-select.js.map +1 -1
- package/dist/components/cura-button-transparent2.js +1 -1
- package/dist/components/cura-button.js +1 -1
- package/dist/components/cura-calendar2.js +2 -2
- package/dist/components/cura-calendar2.js.map +1 -1
- package/dist/components/cura-card.js +1 -1
- package/dist/components/cura-checkbox.js +1 -1
- package/dist/components/cura-display.js +1 -1
- package/dist/components/cura-dropdown-search-option-title.js +1 -1
- package/dist/components/cura-dropdown-search-option.js +2 -2
- package/dist/components/cura-dropdown-search.js +21 -11
- package/dist/components/cura-dropdown-search.js.map +1 -1
- package/dist/components/cura-heading2.js +8 -7
- package/dist/components/cura-heading2.js.map +1 -1
- package/dist/components/cura-icon2.js +1 -1
- package/dist/components/cura-icons-view.js +3 -3
- package/dist/components/cura-input-date.js +54 -57
- package/dist/components/cura-input-date.js.map +1 -1
- package/dist/components/cura-label2.js +1 -1
- package/dist/components/cura-loader-bar2.js +1 -1
- package/dist/components/cura-loader-circle2.js +1 -1
- package/dist/components/cura-page-template.js +1 -1
- package/dist/components/cura-paragraph2.js +1 -1
- package/dist/components/cura-radio.js +1 -1
- package/dist/components/cura-select-option2.js +1 -1
- package/dist/components/cura-select2.js +3 -3
- package/dist/components/cura-switch.js +1 -1
- package/dist/components/cura-toast.js +1 -1
- package/dist/components/cura-tooltip.d.ts +11 -0
- package/dist/components/cura-tooltip.js +291 -0
- package/dist/components/cura-tooltip.js.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.esm.js.map +1 -1
- package/dist/cura/{p-116a1cd6.entry.js → p-01e301d4.entry.js} +2 -2
- package/dist/cura/{p-c6508bd7.entry.js → p-022b22b6.entry.js} +2 -2
- package/dist/cura/p-0308cf6b.entry.js +2 -0
- package/dist/cura/p-0308cf6b.entry.js.map +1 -0
- package/dist/cura/p-22e921d9.entry.js +2 -0
- package/dist/cura/p-22e921d9.entry.js.map +1 -0
- package/dist/cura/p-2b9eadc7.entry.js +2 -0
- package/dist/cura/p-2b9eadc7.entry.js.map +1 -0
- package/dist/cura/{p-b2d5db22.entry.js → p-2c0f5497.entry.js} +2 -2
- package/dist/cura/p-5bb8302c.entry.js +2 -0
- package/dist/cura/p-5bb8302c.entry.js.map +1 -0
- package/dist/cura/{p-fcbf4311.entry.js → p-639c1b67.entry.js} +2 -2
- package/dist/cura/{p-2956f120.entry.js → p-7853ab16.entry.js} +2 -2
- package/dist/cura/{p-2956f120.entry.js.map → p-7853ab16.entry.js.map} +1 -1
- package/dist/cura/{p-41c3d47d.entry.js → p-81c66f2b.entry.js} +2 -2
- package/dist/cura/p-82b99090.js +2 -0
- package/dist/cura/p-82b99090.js.map +1 -0
- package/dist/cura/p-93525d68.entry.js +2 -0
- package/dist/cura/p-93525d68.entry.js.map +1 -0
- package/dist/cura/p-9991f7db.entry.js +2 -0
- package/dist/cura/p-9e3d26fe.entry.js +2 -0
- package/dist/cura/p-9e3d26fe.entry.js.map +1 -0
- package/dist/cura/{p-dcd2e5bb.entry.js → p-a7ecea4a.entry.js} +2 -2
- package/dist/cura/{p-33772510.entry.js → p-b0451cb3.entry.js} +2 -2
- package/dist/cura/{p-8f3db0fe.entry.js → p-b883e098.entry.js} +2 -2
- package/dist/cura/{p-907b3d12.entry.js → p-bfb5e9e1.entry.js} +2 -2
- package/dist/cura/{p-e5023e34.entry.js → p-c444e692.entry.js} +2 -2
- package/dist/cura/{p-fdce91a7.entry.js → p-d635501a.entry.js} +2 -2
- package/dist/cura/{p-fd083399.entry.js → p-df851816.entry.js} +2 -2
- package/dist/cura/{p-44e3325a.entry.js → p-e3d3bc3d.entry.js} +2 -2
- package/dist/cura/p-eda28278.entry.js +2 -0
- package/dist/cura/p-eda28278.entry.js.map +1 -0
- package/dist/esm/{app-globals-6ca7103d.js → app-globals-e54ee4c3.js} +32 -1
- package/dist/esm/app-globals-e54ee4c3.js.map +1 -0
- package/dist/esm/cura-accordion_12.entry.js +39 -38
- package/dist/esm/cura-accordion_12.entry.js.map +1 -1
- package/dist/esm/cura-alert.entry.js +3 -2
- package/dist/esm/cura-alert.entry.js.map +1 -1
- package/dist/esm/cura-avatar.entry.js +1 -1
- package/dist/esm/cura-badge-distance.entry.js +1 -1
- package/dist/esm/cura-badge-number.entry.js +2 -2
- package/dist/esm/cura-badge-number.entry.js.map +1 -1
- package/dist/esm/cura-button-outline.entry.js +1 -1
- package/dist/esm/cura-button-select.entry.js +17 -9
- package/dist/esm/cura-button-select.entry.js.map +1 -1
- package/dist/esm/cura-button-transparent.entry.js +1 -1
- package/dist/esm/cura-calendar.entry.js +2 -2
- package/dist/esm/cura-calendar.entry.js.map +1 -1
- package/dist/esm/cura-card.entry.js +1 -1
- package/dist/esm/cura-checkbox.entry.js +1 -1
- package/dist/esm/cura-display.entry.js +1 -1
- package/dist/esm/cura-dropdown-search-option-title.entry.js +1 -1
- package/dist/esm/cura-dropdown-search-option.entry.js +2 -2
- package/dist/esm/cura-dropdown-search.entry.js +21 -11
- package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
- package/dist/esm/cura-icons-view.entry.js +3 -3
- package/dist/esm/cura-input-date.entry.js +45 -45
- package/dist/esm/cura-input-date.entry.js.map +1 -1
- package/dist/esm/cura-loader-bar.entry.js +1 -1
- package/dist/esm/cura-radio.entry.js +1 -1
- package/dist/esm/cura-switch.entry.js +1 -1
- package/dist/esm/cura-toast.entry.js +1 -1
- package/dist/esm/cura-tooltip.entry.js +228 -0
- package/dist/esm/cura-tooltip.entry.js.map +1 -0
- package/dist/esm/cura.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/types/api/theme-presets/theme-presets.d.ts +43 -0
- package/dist/types/api/theme-presets/theme-richet.d.ts +43 -0
- package/dist/types/components/accordion/cura-accordion/cura-accordion.d.ts +7 -3
- package/dist/types/components/accordion/cura-accordion/cura-accordion.stories.d.ts +38 -16
- package/dist/types/components/accordion/cura-accordion-item/cura-accordion-item.d.ts +8 -3
- package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +2 -0
- package/dist/types/components/buttons/cura-button-select/cura-button-select.stories.d.ts +14 -0
- package/dist/types/components/cura-tooltip/cura-tooltip.d.ts +25 -0
- package/dist/types/components/cura-tooltip/cura-tooltip.stories.d.ts +119 -0
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +1 -0
- package/dist/types/components/forms/cura-input-date/cura-input-date.d.ts +19 -19
- package/dist/types/components/text/cura-heading/cura-heading.d.ts +1 -0
- package/dist/types/components.d.ts +75 -10
- package/package.json +2 -2
- package/dist/cjs/app-globals-4d07f363.js.map +0 -1
- package/dist/cura/p-0b7a7306.js +0 -2
- package/dist/cura/p-0b7a7306.js.map +0 -1
- package/dist/cura/p-2d267d23.entry.js +0 -2
- package/dist/cura/p-2d267d23.entry.js.map +0 -1
- package/dist/cura/p-4e14c01c.entry.js +0 -2
- package/dist/cura/p-b43b69f3.entry.js +0 -2
- package/dist/cura/p-b43b69f3.entry.js.map +0 -1
- package/dist/cura/p-be10b681.entry.js +0 -2
- package/dist/cura/p-be10b681.entry.js.map +0 -1
- package/dist/cura/p-cda24a1e.entry.js +0 -2
- package/dist/cura/p-cda24a1e.entry.js.map +0 -1
- package/dist/cura/p-e8bc6381.entry.js +0 -2
- package/dist/cura/p-e8bc6381.entry.js.map +0 -1
- package/dist/cura/p-ed97cf3c.entry.js +0 -2
- package/dist/cura/p-ed97cf3c.entry.js.map +0 -1
- package/dist/esm/app-globals-6ca7103d.js.map +0 -1
- /package/dist/cura/{p-116a1cd6.entry.js.map → p-01e301d4.entry.js.map} +0 -0
- /package/dist/cura/{p-c6508bd7.entry.js.map → p-022b22b6.entry.js.map} +0 -0
- /package/dist/cura/{p-b2d5db22.entry.js.map → p-2c0f5497.entry.js.map} +0 -0
- /package/dist/cura/{p-fcbf4311.entry.js.map → p-639c1b67.entry.js.map} +0 -0
- /package/dist/cura/{p-41c3d47d.entry.js.map → p-81c66f2b.entry.js.map} +0 -0
- /package/dist/cura/{p-4e14c01c.entry.js.map → p-9991f7db.entry.js.map} +0 -0
- /package/dist/cura/{p-dcd2e5bb.entry.js.map → p-a7ecea4a.entry.js.map} +0 -0
- /package/dist/cura/{p-33772510.entry.js.map → p-b0451cb3.entry.js.map} +0 -0
- /package/dist/cura/{p-8f3db0fe.entry.js.map → p-b883e098.entry.js.map} +0 -0
- /package/dist/cura/{p-907b3d12.entry.js.map → p-bfb5e9e1.entry.js.map} +0 -0
- /package/dist/cura/{p-e5023e34.entry.js.map → p-c444e692.entry.js.map} +0 -0
- /package/dist/cura/{p-fdce91a7.entry.js.map → p-d635501a.entry.js.map} +0 -0
- /package/dist/cura/{p-fd083399.entry.js.map → p-df851816.entry.js.map} +0 -0
- /package/dist/cura/{p-44e3325a.entry.js.map → p-e3d3bc3d.entry.js.map} +0 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
const BREAKPOINT_SMALL_MAX = 768;
|
|
3
|
+
export class CuraTooltip {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.styles = {};
|
|
6
|
+
this.handleClose = () => {
|
|
7
|
+
this.closeContainer();
|
|
8
|
+
};
|
|
9
|
+
this.elementId = '';
|
|
10
|
+
this.interactive = true;
|
|
11
|
+
this.delay = 250;
|
|
12
|
+
this.maxWidth = '280px';
|
|
13
|
+
this.position = 'top';
|
|
14
|
+
this.label = undefined;
|
|
15
|
+
this.closeButton = false;
|
|
16
|
+
this.isMobile = false;
|
|
17
|
+
}
|
|
18
|
+
onWindowResize() {
|
|
19
|
+
this.setPosition(this.targetElement);
|
|
20
|
+
}
|
|
21
|
+
onWindowScroll() {
|
|
22
|
+
this.setPosition(this.targetElement);
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
this.setStyle();
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return (h(Host, { key: '228558663e00355ca59429d70a129e4b0e426dc1', role: "tooltip", id: this.elementId }, h("div", { key: 'd8fa27a56dd894a4cfb335fc9de348402590aa93', class: "container", style: this.styles }, h("div", { key: '974114d04252a106deb2174bfe8ecf204e689d26', class: "content" }, h("cura-heading", { key: '14be9154283064e48d2435bc4bb6af6469b18e04', level: 4, size: "xsmall", color: "neutral-black", weight: "bold", "margin-block": "0" }, this.label), h("cura-paragraph", { key: 'db64a96112781640be945502b995dc07392977bd', color: "neutral-dark", "spot-color": "secondary-darker", size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, h("slot", { key: 'b3a9a3f7a5f227ddc92ac9498c3aee93f9196f77' }))), this.closeButton && !this.isMobile && h("cura-icon", { key: '66c113fe2c3b4c67b1b9e98408b8ca1736d4eb86', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.isMobile && h("cura-button-transparent", { key: '059b4e579bebc92b5082d98ce8ae3cce9f4da95d', class: "close-button", size: "small", type: "button", color: "error", "icon-name": "close", "icon-position": "right", onClick: this.handleClose }, "OK, entendi."))));
|
|
29
|
+
}
|
|
30
|
+
componentDidLoad() {
|
|
31
|
+
this.targetElement = document.querySelector(`[aria-labelledby="${this.elementId}"]`);
|
|
32
|
+
if (!this.interactive) {
|
|
33
|
+
this.host.style.visibility = 'visible';
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.host.style.visibility = 'hidden';
|
|
37
|
+
let openTimeoutID = null;
|
|
38
|
+
let closeTimeoutID = null;
|
|
39
|
+
this.targetElement.addEventListener('mouseenter', () => {
|
|
40
|
+
clearTimeout(closeTimeoutID);
|
|
41
|
+
openTimeoutID = setTimeout(() => {
|
|
42
|
+
this.host.style.visibility = 'visible';
|
|
43
|
+
}, typeof this.delay === 'number' && this.delay > 250 ? this.delay : 250);
|
|
44
|
+
});
|
|
45
|
+
this.targetElement.addEventListener('mouseleave', () => {
|
|
46
|
+
clearTimeout(openTimeoutID);
|
|
47
|
+
closeTimeoutID = setTimeout(() => {
|
|
48
|
+
this.handleClose();
|
|
49
|
+
}, typeof this.delay === 'number' && this.delay > 250 ? this.delay : 250);
|
|
50
|
+
});
|
|
51
|
+
this.host.addEventListener('mouseenter', () => {
|
|
52
|
+
if (window.getComputedStyle(this.host).visibility === 'visible') {
|
|
53
|
+
clearTimeout(closeTimeoutID);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
this.host.addEventListener('mouseleave', () => {
|
|
57
|
+
clearTimeout(openTimeoutID);
|
|
58
|
+
this.handleClose();
|
|
59
|
+
});
|
|
60
|
+
this.targetElement.addEventListener('click', () => {
|
|
61
|
+
if (window.getComputedStyle(this.host).visibility === 'hidden') {
|
|
62
|
+
openTimeoutID = setTimeout(() => {
|
|
63
|
+
this.host.style.visibility = 'visible';
|
|
64
|
+
}, typeof this.delay === 'number' && this.delay > 250 ? this.delay : 250);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
clearTimeout(openTimeoutID);
|
|
68
|
+
this.handleClose();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
document.addEventListener('click', (event) => {
|
|
72
|
+
if (!this.targetElement.contains(event.target) && !this.host.contains(event.target)) {
|
|
73
|
+
clearTimeout(openTimeoutID);
|
|
74
|
+
this.handleClose();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
this.setPosition(this.targetElement);
|
|
80
|
+
}, 100);
|
|
81
|
+
}
|
|
82
|
+
setStyle() {
|
|
83
|
+
this.styles = Object.assign(Object.assign({}, this.styles), { '--max-width': this.maxWidth, '--base-spacing': window.CuraAPI.theme.spacing.getSpacing(), '--neutral-purewhite': window.CuraAPI.theme.colors.getColor(`neutral-purewhite`), '--neutral-light': window.CuraAPI.theme.colors.getColor(`neutral-light`), '--neutral-black-shadow': window.CuraAPI.theme.colors.getColor(`neutral-black`, 0.16) });
|
|
84
|
+
}
|
|
85
|
+
getClasses() {
|
|
86
|
+
const [firstPosition, secondPosition] = this.position.split('-');
|
|
87
|
+
const classes = {};
|
|
88
|
+
classes['container'] = true;
|
|
89
|
+
if (firstPosition) {
|
|
90
|
+
classes[firstPosition] = true;
|
|
91
|
+
}
|
|
92
|
+
if (secondPosition) {
|
|
93
|
+
classes[secondPosition] = true;
|
|
94
|
+
}
|
|
95
|
+
return classes;
|
|
96
|
+
}
|
|
97
|
+
setPosition(element) {
|
|
98
|
+
const windowWidth = window.innerWidth;
|
|
99
|
+
const windowHeight = window.innerHeight;
|
|
100
|
+
const container = this.host.shadowRoot.querySelector('.container');
|
|
101
|
+
this.isMobile = windowWidth <= BREAKPOINT_SMALL_MAX;
|
|
102
|
+
this.host.style.position = this.isMobile ? 'fixed' : 'absolute';
|
|
103
|
+
this.host.style.bottom = this.isMobile ? '0' : 'unset';
|
|
104
|
+
container.style.flexDirection = this.isMobile ? 'column' : 'row';
|
|
105
|
+
if (this.isMobile) {
|
|
106
|
+
this.host.style.left = 'unset';
|
|
107
|
+
this.host.style.top = 'unset';
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const elementRect = {
|
|
111
|
+
top: element.offsetTop,
|
|
112
|
+
left: element.offsetLeft,
|
|
113
|
+
width: element.offsetWidth,
|
|
114
|
+
height: element.offsetHeight
|
|
115
|
+
};
|
|
116
|
+
const tooltipRect = this.host.getBoundingClientRect();
|
|
117
|
+
const SCREEN_LIMIT = 10;
|
|
118
|
+
const SPACE_TO_ELEMENT = 10;
|
|
119
|
+
const ARROW_HORIZONTAL_ADJUSTMENT = (elementRect.width * 0.5) + 18;
|
|
120
|
+
const ARROW_VERTICAL_ADJUSTMENT = (elementRect.height * 0.5) + 18;
|
|
121
|
+
const BORDER_COLOR = this.styles['--neutral-light'];
|
|
122
|
+
let left = 0;
|
|
123
|
+
let top = 0;
|
|
124
|
+
const positions = Object.keys(this.getClasses()).filter((p) => ['top', 'left', 'bottom', 'right', 'start', 'end'].includes(p));
|
|
125
|
+
const setArrowProperties = ({ arrowTop = '', arrowLeft = '', translate = '', borderColor = '' }) => {
|
|
126
|
+
if (arrowLeft)
|
|
127
|
+
this.host.style.setProperty('--arrow-left', arrowLeft);
|
|
128
|
+
if (arrowTop)
|
|
129
|
+
this.host.style.setProperty('--arrow-top', arrowTop);
|
|
130
|
+
if (translate)
|
|
131
|
+
this.host.style.setProperty('--arrow-translate', translate);
|
|
132
|
+
if (borderColor)
|
|
133
|
+
this.host.style.setProperty('--arrow-border-color', borderColor);
|
|
134
|
+
};
|
|
135
|
+
//Posicionamento vertical
|
|
136
|
+
if (positions.includes('top') || positions.includes('bottom')) {
|
|
137
|
+
setArrowProperties({ arrowLeft: '50%', translate: 'translateX(-50%)' });
|
|
138
|
+
if (positions.includes('top')) {
|
|
139
|
+
top = elementRect.top - tooltipRect.height - SPACE_TO_ELEMENT;
|
|
140
|
+
setArrowProperties({ arrowTop: 'calc(100% - 6px)', borderColor: `transparent ${BORDER_COLOR} ${BORDER_COLOR} transparent` });
|
|
141
|
+
if (top < SCREEN_LIMIT) {
|
|
142
|
+
top = elementRect.top + elementRect.height + SPACE_TO_ELEMENT;
|
|
143
|
+
setArrowProperties({ arrowTop: '-6px', borderColor: `${BORDER_COLOR} transparent transparent ${BORDER_COLOR}` });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (positions.includes('bottom')) {
|
|
147
|
+
top = elementRect.top + elementRect.height + SPACE_TO_ELEMENT;
|
|
148
|
+
setArrowProperties({ arrowTop: '-6px', borderColor: `${BORDER_COLOR} transparent transparent ${BORDER_COLOR}` });
|
|
149
|
+
if (top + tooltipRect.height > windowHeight - SCREEN_LIMIT) {
|
|
150
|
+
top = elementRect.top - tooltipRect.height - SPACE_TO_ELEMENT;
|
|
151
|
+
setArrowProperties({ arrowTop: 'calc(100% - 6px)', borderColor: `transparent ${BORDER_COLOR} ${BORDER_COLOR} transparent` });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
left = elementRect.left + (elementRect.width - tooltipRect.width) / 2;
|
|
155
|
+
if (positions.includes('start')) {
|
|
156
|
+
left = elementRect.left - tooltipRect.width + ARROW_HORIZONTAL_ADJUSTMENT;
|
|
157
|
+
setArrowProperties({ arrowLeft: 'calc(100% - 18px)' });
|
|
158
|
+
if (left < SCREEN_LIMIT) {
|
|
159
|
+
left = elementRect.left + elementRect.width - ARROW_HORIZONTAL_ADJUSTMENT;
|
|
160
|
+
setArrowProperties({ arrowLeft: '18px' });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (positions.includes('end')) {
|
|
164
|
+
left = elementRect.left + elementRect.width - ARROW_HORIZONTAL_ADJUSTMENT;
|
|
165
|
+
setArrowProperties({ arrowLeft: '18px' });
|
|
166
|
+
if (left + tooltipRect.width > windowWidth - SCREEN_LIMIT) {
|
|
167
|
+
left = elementRect.left - tooltipRect.width + ARROW_HORIZONTAL_ADJUSTMENT;
|
|
168
|
+
setArrowProperties({ arrowLeft: 'calc(100% - 18px)' });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//Posicionamento horizontal
|
|
173
|
+
if (positions.includes('right') || positions.includes('left')) {
|
|
174
|
+
setArrowProperties({ arrowTop: '50%', translate: 'translateY(-50%)' });
|
|
175
|
+
if (positions.includes('right')) {
|
|
176
|
+
left = elementRect.left + elementRect.width + SPACE_TO_ELEMENT;
|
|
177
|
+
setArrowProperties({ arrowLeft: '-6px', borderColor: `transparent transparent ${BORDER_COLOR} ${BORDER_COLOR}` });
|
|
178
|
+
if (left + tooltipRect.width > windowWidth - SCREEN_LIMIT) {
|
|
179
|
+
left = elementRect.left - tooltipRect.width - SPACE_TO_ELEMENT;
|
|
180
|
+
setArrowProperties({ arrowLeft: 'calc(100% - 6px)', borderColor: `${BORDER_COLOR} ${BORDER_COLOR} transparent transparent` });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (positions.includes('left')) {
|
|
184
|
+
left = elementRect.left - tooltipRect.width - SPACE_TO_ELEMENT;
|
|
185
|
+
setArrowProperties({ arrowLeft: 'calc(100% - 6px)', borderColor: `${BORDER_COLOR} ${BORDER_COLOR} transparent transparent` });
|
|
186
|
+
if (left < SCREEN_LIMIT) {
|
|
187
|
+
left = elementRect.left + elementRect.width + SPACE_TO_ELEMENT;
|
|
188
|
+
setArrowProperties({ arrowLeft: '-6px', borderColor: `transparent transparent ${BORDER_COLOR} ${BORDER_COLOR}` });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
top = elementRect.top + (elementRect.height - tooltipRect.height) / 2;
|
|
192
|
+
if (positions.includes('start')) {
|
|
193
|
+
top = elementRect.top - tooltipRect.height + ARROW_VERTICAL_ADJUSTMENT;
|
|
194
|
+
setArrowProperties({ arrowTop: 'calc(100% - 18px)' });
|
|
195
|
+
if (top < SCREEN_LIMIT) {
|
|
196
|
+
top = elementRect.top + elementRect.height - ARROW_VERTICAL_ADJUSTMENT;
|
|
197
|
+
setArrowProperties({ arrowTop: '18px' });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (positions.includes('end')) {
|
|
201
|
+
top = elementRect.top + elementRect.height - ARROW_VERTICAL_ADJUSTMENT;
|
|
202
|
+
setArrowProperties({ arrowTop: '18px' });
|
|
203
|
+
if (top + tooltipRect.height > windowHeight - SCREEN_LIMIT) {
|
|
204
|
+
top = elementRect.top - tooltipRect.height + ARROW_VERTICAL_ADJUSTMENT;
|
|
205
|
+
setArrowProperties({ arrowTop: 'calc(100% - 18px)' });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
this.host.style.left = `${left}px`;
|
|
210
|
+
this.host.style.top = `${top}px`;
|
|
211
|
+
}
|
|
212
|
+
closeContainer() {
|
|
213
|
+
this.host.style.visibility = 'hidden';
|
|
214
|
+
this.tooltipClosed.emit();
|
|
215
|
+
}
|
|
216
|
+
static get is() { return "cura-tooltip"; }
|
|
217
|
+
static get encapsulation() { return "shadow"; }
|
|
218
|
+
static get originalStyleUrls() {
|
|
219
|
+
return {
|
|
220
|
+
"$": ["cura-tooltip.scss"]
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
static get styleUrls() {
|
|
224
|
+
return {
|
|
225
|
+
"$": ["cura-tooltip.css"]
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
static get properties() {
|
|
229
|
+
return {
|
|
230
|
+
"elementId": {
|
|
231
|
+
"type": "string",
|
|
232
|
+
"mutable": false,
|
|
233
|
+
"complexType": {
|
|
234
|
+
"original": "string",
|
|
235
|
+
"resolved": "string",
|
|
236
|
+
"references": {}
|
|
237
|
+
},
|
|
238
|
+
"required": false,
|
|
239
|
+
"optional": false,
|
|
240
|
+
"docs": {
|
|
241
|
+
"tags": [],
|
|
242
|
+
"text": ""
|
|
243
|
+
},
|
|
244
|
+
"attribute": "element-id",
|
|
245
|
+
"reflect": false,
|
|
246
|
+
"defaultValue": "''"
|
|
247
|
+
},
|
|
248
|
+
"interactive": {
|
|
249
|
+
"type": "boolean",
|
|
250
|
+
"mutable": false,
|
|
251
|
+
"complexType": {
|
|
252
|
+
"original": "boolean",
|
|
253
|
+
"resolved": "boolean",
|
|
254
|
+
"references": {}
|
|
255
|
+
},
|
|
256
|
+
"required": false,
|
|
257
|
+
"optional": false,
|
|
258
|
+
"docs": {
|
|
259
|
+
"tags": [],
|
|
260
|
+
"text": ""
|
|
261
|
+
},
|
|
262
|
+
"attribute": "interactive",
|
|
263
|
+
"reflect": false,
|
|
264
|
+
"defaultValue": "true"
|
|
265
|
+
},
|
|
266
|
+
"delay": {
|
|
267
|
+
"type": "number",
|
|
268
|
+
"mutable": false,
|
|
269
|
+
"complexType": {
|
|
270
|
+
"original": "number",
|
|
271
|
+
"resolved": "number",
|
|
272
|
+
"references": {}
|
|
273
|
+
},
|
|
274
|
+
"required": false,
|
|
275
|
+
"optional": false,
|
|
276
|
+
"docs": {
|
|
277
|
+
"tags": [],
|
|
278
|
+
"text": ""
|
|
279
|
+
},
|
|
280
|
+
"attribute": "delay",
|
|
281
|
+
"reflect": false,
|
|
282
|
+
"defaultValue": "250"
|
|
283
|
+
},
|
|
284
|
+
"maxWidth": {
|
|
285
|
+
"type": "string",
|
|
286
|
+
"mutable": false,
|
|
287
|
+
"complexType": {
|
|
288
|
+
"original": "string",
|
|
289
|
+
"resolved": "string",
|
|
290
|
+
"references": {}
|
|
291
|
+
},
|
|
292
|
+
"required": false,
|
|
293
|
+
"optional": false,
|
|
294
|
+
"docs": {
|
|
295
|
+
"tags": [],
|
|
296
|
+
"text": ""
|
|
297
|
+
},
|
|
298
|
+
"attribute": "max-width",
|
|
299
|
+
"reflect": false,
|
|
300
|
+
"defaultValue": "'280px'"
|
|
301
|
+
},
|
|
302
|
+
"position": {
|
|
303
|
+
"type": "string",
|
|
304
|
+
"mutable": false,
|
|
305
|
+
"complexType": {
|
|
306
|
+
"original": "'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end'",
|
|
307
|
+
"resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
308
|
+
"references": {}
|
|
309
|
+
},
|
|
310
|
+
"required": false,
|
|
311
|
+
"optional": false,
|
|
312
|
+
"docs": {
|
|
313
|
+
"tags": [],
|
|
314
|
+
"text": ""
|
|
315
|
+
},
|
|
316
|
+
"attribute": "position",
|
|
317
|
+
"reflect": true,
|
|
318
|
+
"defaultValue": "'top'"
|
|
319
|
+
},
|
|
320
|
+
"label": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"mutable": false,
|
|
323
|
+
"complexType": {
|
|
324
|
+
"original": "string",
|
|
325
|
+
"resolved": "string",
|
|
326
|
+
"references": {}
|
|
327
|
+
},
|
|
328
|
+
"required": false,
|
|
329
|
+
"optional": false,
|
|
330
|
+
"docs": {
|
|
331
|
+
"tags": [],
|
|
332
|
+
"text": ""
|
|
333
|
+
},
|
|
334
|
+
"attribute": "label",
|
|
335
|
+
"reflect": true
|
|
336
|
+
},
|
|
337
|
+
"closeButton": {
|
|
338
|
+
"type": "boolean",
|
|
339
|
+
"mutable": false,
|
|
340
|
+
"complexType": {
|
|
341
|
+
"original": "boolean",
|
|
342
|
+
"resolved": "boolean",
|
|
343
|
+
"references": {}
|
|
344
|
+
},
|
|
345
|
+
"required": false,
|
|
346
|
+
"optional": false,
|
|
347
|
+
"docs": {
|
|
348
|
+
"tags": [],
|
|
349
|
+
"text": ""
|
|
350
|
+
},
|
|
351
|
+
"attribute": "close-button",
|
|
352
|
+
"reflect": true,
|
|
353
|
+
"defaultValue": "false"
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
static get states() {
|
|
358
|
+
return {
|
|
359
|
+
"isMobile": {}
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
static get events() {
|
|
363
|
+
return [{
|
|
364
|
+
"method": "tooltipClosed",
|
|
365
|
+
"name": "tooltipClosed",
|
|
366
|
+
"bubbles": true,
|
|
367
|
+
"cancelable": true,
|
|
368
|
+
"composed": true,
|
|
369
|
+
"docs": {
|
|
370
|
+
"tags": [],
|
|
371
|
+
"text": ""
|
|
372
|
+
},
|
|
373
|
+
"complexType": {
|
|
374
|
+
"original": "void",
|
|
375
|
+
"resolved": "void",
|
|
376
|
+
"references": {}
|
|
377
|
+
}
|
|
378
|
+
}];
|
|
379
|
+
}
|
|
380
|
+
static get elementRef() { return "host"; }
|
|
381
|
+
static get listeners() {
|
|
382
|
+
return [{
|
|
383
|
+
"name": "resize",
|
|
384
|
+
"method": "onWindowResize",
|
|
385
|
+
"target": "window",
|
|
386
|
+
"capture": false,
|
|
387
|
+
"passive": true
|
|
388
|
+
}, {
|
|
389
|
+
"name": "scroll",
|
|
390
|
+
"method": "onWindowScroll",
|
|
391
|
+
"target": "window",
|
|
392
|
+
"capture": false,
|
|
393
|
+
"passive": true
|
|
394
|
+
}];
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
//# sourceMappingURL=cura-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-tooltip.js","sourceRoot":"","sources":["../../../src/components/cura-tooltip/cura-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtG,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAOjC,MAAM,OAAO,WAAW;;QAiBtB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKF","sourcesContent":["import { Component, Element, EventEmitter, Host, Prop, State, h, Event, Listen } from '@stencil/core';\n\nconst BREAKPOINT_SMALL_MAX = 768;\n\n@Component({\n tag: 'cura-tooltip',\n styleUrl: 'cura-tooltip.scss',\n shadow: true,\n})\nexport class CuraTooltip {\n @Element() host: HTMLElement;\n\n @Prop() elementId = '';\n @Prop() interactive = true;\n @Prop() delay = 250;\n @Prop() maxWidth = '280px';\n @Prop({ reflect: true }) position: 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end' = 'top';\n @Prop({ reflect: true }) label: string;\n @Prop({ reflect: true }) closeButton = false;\n\n @State() isMobile = false;\n\n @Event({ eventName: 'tooltipClosed' }) tooltipClosed: EventEmitter<void>;\n\n targetElement: HTMLElement;\n\n styles = {};\n\n @Listen('resize', { target: 'window' })\n onWindowResize() {\n this.setPosition(this.targetElement);\n }\n\n @Listen('scroll', { target: 'window' })\n onWindowScroll() {\n this.setPosition(this.targetElement);\n }\n\n connectedCallback() {\n this.setStyle();\n }\n\n render() {\n return (\n <Host role=\"tooltip\" id={this.elementId}>\n <div class=\"container\" style={this.styles}>\n <div class=\"content\">\n <cura-heading level={4} size=\"xsmall\" color=\"neutral-black\" weight=\"bold\" margin-block=\"0\">\n {this.label}\n </cura-heading>\n <cura-paragraph color=\"neutral-dark\" spot-color=\"secondary-darker\" size=\"xsmall\" marginBlock=\"0\" lineHeight=\"133.33%\">\n <slot></slot>\n </cura-paragraph>\n </div>\n {this.closeButton && !this.isMobile && <cura-icon class=\"close-icon\" name=\"close\" size={16} color=\"error-dark\" onClick={this.handleClose}></cura-icon>}\n {this.isMobile && <cura-button-transparent class=\"close-button\" size=\"small\" type=\"button\" color=\"error\" icon-name=\"close\" icon-position=\"right\" onClick={this.handleClose}>OK, entendi.</cura-button-transparent>}\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.targetElement = document.querySelector(`[aria-labelledby=\"${this.elementId}\"]`) as HTMLElement;\n\n if (!this.interactive) {\n this.host.style.visibility = 'visible';\n } else {\n this.host.style.visibility = 'hidden';\n\n let openTimeoutID = null;\n let closeTimeoutID = null;\n\n this.targetElement.addEventListener('mouseenter', () => {\n clearTimeout(closeTimeoutID);\n openTimeoutID = setTimeout(() => {\n this.host.style.visibility = 'visible';\n }, typeof this.delay === 'number' && this.delay > 250 ? this.delay : 250);\n });\n \n this.targetElement.addEventListener('mouseleave', () => {\n clearTimeout(openTimeoutID);\n closeTimeoutID = setTimeout(() => {\n this.handleClose();\n }, typeof this.delay === 'number' && this.delay > 250 ? this.delay : 250);\n });\n\n this.host.addEventListener('mouseenter', () => {\n if (window.getComputedStyle(this.host).visibility === 'visible') {\n clearTimeout(closeTimeoutID);\n }\n });\n\n this.host.addEventListener('mouseleave', () => {\n clearTimeout(openTimeoutID);\n this.handleClose();\n });\n\n this.targetElement.addEventListener('click', () => {\n if (window.getComputedStyle(this.host).visibility === 'hidden') {\n openTimeoutID = setTimeout(() => {\n this.host.style.visibility = 'visible';\n }, typeof this.delay === 'number' && this.delay > 250 ? this.delay : 250);\n } else {\n clearTimeout(openTimeoutID);\n this.handleClose();\n }\n });\n \n document.addEventListener('click', (event: MouseEvent) => {\n if(!this.targetElement.contains(event.target as HTMLElement) && !this.host.contains(event.target as HTMLElement)) {\n clearTimeout(openTimeoutID);\n this.handleClose();\n }\n });\n }\n\n setTimeout(() => {\n this.setPosition(this.targetElement);\n }, 100);\n }\n\n setStyle() {\n this.styles = {\n ...this.styles,\n '--max-width': this.maxWidth,\n '--base-spacing': window.CuraAPI.theme.spacing.getSpacing(),\n '--neutral-purewhite': window.CuraAPI.theme.colors.getColor(`neutral-purewhite`),\n '--neutral-light': window.CuraAPI.theme.colors.getColor(`neutral-light`),\n '--neutral-black-shadow': window.CuraAPI.theme.colors.getColor(`neutral-black`, 0.16),\n }\n }\n\n getClasses() {\n const [firstPosition, secondPosition] = this.position.split('-');\n const classes = {};\n\n classes['container'] = true;\n if (firstPosition) { classes[firstPosition] = true; }\n if (secondPosition) { classes[secondPosition] = true; }\n\n return classes;\n }\n\n setPosition(element: HTMLElement) {\n const windowWidth = window.innerWidth;\n const windowHeight = window.innerHeight;\n const container = this.host.shadowRoot.querySelector('.container') as HTMLElement;\n\n this.isMobile = windowWidth <= BREAKPOINT_SMALL_MAX;\n\n this.host.style.position = this.isMobile ? 'fixed' : 'absolute';\n this.host.style.bottom = this.isMobile ? '0' : 'unset';\n container.style.flexDirection = this.isMobile ? 'column' : 'row';\n\n if (this.isMobile) {\n this.host.style.left = 'unset';\n this.host.style.top = 'unset';\n return;\n }\n\n const elementRect = { \n top: element.offsetTop, \n left: element.offsetLeft, \n width: element.offsetWidth, \n height: element.offsetHeight\n };\n const tooltipRect = this.host.getBoundingClientRect();\n\n const SCREEN_LIMIT = 10;\n const SPACE_TO_ELEMENT = 10;\n const ARROW_HORIZONTAL_ADJUSTMENT = (elementRect.width * 0.5) + 18;\n const ARROW_VERTICAL_ADJUSTMENT = (elementRect.height * 0.5) + 18;\n const BORDER_COLOR = this.styles['--neutral-light'];\n\n let left = 0;\n let top = 0;\n\n const positions = Object.keys(this.getClasses()).filter((p) => ['top', 'left', 'bottom', 'right', 'start', 'end'].includes(p));\n\n const setArrowProperties = ({ arrowTop = '', arrowLeft = '', translate = '', borderColor = '' }) => {\n if (arrowLeft) this.host.style.setProperty('--arrow-left', arrowLeft);\n if (arrowTop) this.host.style.setProperty('--arrow-top', arrowTop);\n if (translate) this.host.style.setProperty('--arrow-translate', translate);\n if (borderColor) this.host.style.setProperty('--arrow-border-color', borderColor);\n };\n\n //Posicionamento vertical\n if (positions.includes('top') || positions.includes('bottom')) {\n setArrowProperties({ arrowLeft: '50%', translate: 'translateX(-50%)' });\n\n if (positions.includes('top')) {\n top = elementRect.top - tooltipRect.height - SPACE_TO_ELEMENT;\n setArrowProperties({ arrowTop: 'calc(100% - 6px)', borderColor: `transparent ${BORDER_COLOR} ${BORDER_COLOR} transparent` });\n\n if (top < SCREEN_LIMIT) {\n top = elementRect.top + elementRect.height + SPACE_TO_ELEMENT;\n setArrowProperties({ arrowTop: '-6px', borderColor: `${BORDER_COLOR} transparent transparent ${BORDER_COLOR}` });\n }\n }\n\n if (positions.includes('bottom')) {\n top = elementRect.top + elementRect.height + SPACE_TO_ELEMENT;\n setArrowProperties({ arrowTop: '-6px', borderColor: `${BORDER_COLOR} transparent transparent ${BORDER_COLOR}` });\n\n if (top + tooltipRect.height > windowHeight - SCREEN_LIMIT) {\n top = elementRect.top - tooltipRect.height - SPACE_TO_ELEMENT;\n setArrowProperties({ arrowTop: 'calc(100% - 6px)', borderColor: `transparent ${BORDER_COLOR} ${BORDER_COLOR} transparent` });\n }\n }\n\n left = elementRect.left + (elementRect.width - tooltipRect.width)/2;\n \n if (positions.includes('start')) {\n left = elementRect.left - tooltipRect.width + ARROW_HORIZONTAL_ADJUSTMENT;\n setArrowProperties({ arrowLeft: 'calc(100% - 18px)' });\n\n if (left < SCREEN_LIMIT) {\n left = elementRect.left + elementRect.width - ARROW_HORIZONTAL_ADJUSTMENT;\n setArrowProperties({ arrowLeft: '18px' });\n }\n }\n\n if (positions.includes('end')) {\n left = elementRect.left + elementRect.width - ARROW_HORIZONTAL_ADJUSTMENT;\n setArrowProperties({ arrowLeft: '18px' });\n\n if (left + tooltipRect.width > windowWidth - SCREEN_LIMIT) {\n left = elementRect.left - tooltipRect.width + ARROW_HORIZONTAL_ADJUSTMENT;\n setArrowProperties({ arrowLeft: 'calc(100% - 18px)' });\n }\n }\n }\n\n //Posicionamento horizontal\n if (positions.includes('right') || positions.includes('left')) {\n setArrowProperties({ arrowTop: '50%', translate: 'translateY(-50%)' });\n\n if (positions.includes('right')) {\n left = elementRect.left + elementRect.width + SPACE_TO_ELEMENT;\n setArrowProperties({ arrowLeft: '-6px', borderColor: `transparent transparent ${BORDER_COLOR} ${BORDER_COLOR}` });\n\n if (left + tooltipRect.width > windowWidth - SCREEN_LIMIT) {\n left = elementRect.left - tooltipRect.width - SPACE_TO_ELEMENT;\n setArrowProperties({ arrowLeft: 'calc(100% - 6px)', borderColor: `${BORDER_COLOR} ${BORDER_COLOR} transparent transparent` });\n }\n }\n\n if (positions.includes('left')) {\n left = elementRect.left - tooltipRect.width - SPACE_TO_ELEMENT;\n setArrowProperties({ arrowLeft: 'calc(100% - 6px)', borderColor: `${BORDER_COLOR} ${BORDER_COLOR} transparent transparent` });\n \n if (left < SCREEN_LIMIT) {\n left = elementRect.left + elementRect.width + SPACE_TO_ELEMENT;\n setArrowProperties({ arrowLeft: '-6px', borderColor: `transparent transparent ${BORDER_COLOR} ${BORDER_COLOR}` });\n }\n }\n \n top = elementRect.top + (elementRect.height - tooltipRect.height)/2;\n\n if (positions.includes('start')) {\n top = elementRect.top - tooltipRect.height + ARROW_VERTICAL_ADJUSTMENT;\n setArrowProperties({ arrowTop: 'calc(100% - 18px)' });\n\n if (top < SCREEN_LIMIT) {\n top = elementRect.top + elementRect.height - ARROW_VERTICAL_ADJUSTMENT;\n setArrowProperties({ arrowTop: '18px' });\n }\n }\n\n if (positions.includes('end')) {\n top = elementRect.top + elementRect.height - ARROW_VERTICAL_ADJUSTMENT;\n setArrowProperties({ arrowTop: '18px' });\n\n if (top + tooltipRect.height > windowHeight - SCREEN_LIMIT) {\n top = elementRect.top - tooltipRect.height + ARROW_VERTICAL_ADJUSTMENT;\n setArrowProperties({ arrowTop: 'calc(100% - 18px)' });\n }\n }\n }\n\n this.host.style.left = `${left}px`;\n this.host.style.top = `${top}px`;\n }\n\n closeContainer() {\n this.host.style.visibility = 'hidden';\n this.tooltipClosed.emit();\n }\n\n handleClose = () => {\n this.closeContainer();\n };\n}\n"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
const renderCuraTooltip = (args) => {
|
|
14
|
+
return `<div style="width: 100%; height: 250px; display: flex; justify-content: center; align-items: center;">
|
|
15
|
+
${args.targetElement}
|
|
16
|
+
<cura-tooltip
|
|
17
|
+
${args.targetElementId ? `element-id="${args.targetElementId}"` : ''}
|
|
18
|
+
${args.interactive === true ? '' : `interactive="${args.interactive}"`}
|
|
19
|
+
${args.label ? `label="${args.label}"` : ''}
|
|
20
|
+
${args.delay > 250 ? `delay="${args.delay}"` : ''}
|
|
21
|
+
${args.maxWidth !== '280px' ? `max-width="${args.maxWidth}"` : ''}
|
|
22
|
+
${args.position && args.position !== 'top' ? `position="${args.position}"` : ''}
|
|
23
|
+
${args.closeButton === true ? `close-button="${args.closeButton}"` : ''}>
|
|
24
|
+
${args.content}
|
|
25
|
+
</cura-tooltip>
|
|
26
|
+
</div>`;
|
|
27
|
+
};
|
|
28
|
+
export default {
|
|
29
|
+
title: 'Componentes/Feedback/Tooltip',
|
|
30
|
+
tags: ['autodocs'],
|
|
31
|
+
render: (_a) => {
|
|
32
|
+
var args = __rest(_a, []);
|
|
33
|
+
return renderCuraTooltip(args);
|
|
34
|
+
},
|
|
35
|
+
argTypes: {
|
|
36
|
+
targetElementId: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'Aria-labelledby do elemento alvo',
|
|
39
|
+
table: {
|
|
40
|
+
category: 'Properties',
|
|
41
|
+
},
|
|
42
|
+
name: 'elementId',
|
|
43
|
+
},
|
|
44
|
+
interactive: {
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
description: 'Ativa a interatividade do tooltip',
|
|
47
|
+
table: {
|
|
48
|
+
category: 'Properties',
|
|
49
|
+
},
|
|
50
|
+
name: 'interactive',
|
|
51
|
+
},
|
|
52
|
+
delay: {
|
|
53
|
+
control: 'number',
|
|
54
|
+
description: 'Define a quantidade de tempo, em milisegundos, necessário para a abertura do tooltip.',
|
|
55
|
+
table: {
|
|
56
|
+
category: 'Properties',
|
|
57
|
+
defaultValue: { summary: 250 },
|
|
58
|
+
},
|
|
59
|
+
name: 'delay',
|
|
60
|
+
},
|
|
61
|
+
maxWidth: {
|
|
62
|
+
control: 'text',
|
|
63
|
+
description: 'Define a largura máxima do componente',
|
|
64
|
+
table: {
|
|
65
|
+
category: 'Properties',
|
|
66
|
+
defaultValue: { summary: '280px' },
|
|
67
|
+
},
|
|
68
|
+
name: 'maxWidth',
|
|
69
|
+
},
|
|
70
|
+
label: {
|
|
71
|
+
control: 'text',
|
|
72
|
+
description: 'Título do tooltip.',
|
|
73
|
+
table: {
|
|
74
|
+
category: 'Properties',
|
|
75
|
+
},
|
|
76
|
+
name: 'label',
|
|
77
|
+
},
|
|
78
|
+
position: {
|
|
79
|
+
control: { type: 'select' },
|
|
80
|
+
options: ['', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-start', 'bottom', 'bottom-end', 'left-start', 'left', 'left-end'],
|
|
81
|
+
description: 'Posição do Tooltip em relação ao conteúdo',
|
|
82
|
+
table: {
|
|
83
|
+
category: 'Properties',
|
|
84
|
+
defaultValue: { summary: 'top' },
|
|
85
|
+
},
|
|
86
|
+
name: 'position',
|
|
87
|
+
},
|
|
88
|
+
closeButton: {
|
|
89
|
+
control: 'boolean',
|
|
90
|
+
description: 'Define se o alerta pode ser fechado.',
|
|
91
|
+
table: {
|
|
92
|
+
category: 'Properties',
|
|
93
|
+
defaultValue: { summary: false },
|
|
94
|
+
},
|
|
95
|
+
name: 'close-button'
|
|
96
|
+
},
|
|
97
|
+
targetElement: {
|
|
98
|
+
control: 'text',
|
|
99
|
+
description: 'Elemento que vai receber o tooltip',
|
|
100
|
+
table: {
|
|
101
|
+
category: 'Slot',
|
|
102
|
+
},
|
|
103
|
+
name: '',
|
|
104
|
+
},
|
|
105
|
+
content: {
|
|
106
|
+
control: 'text',
|
|
107
|
+
description: 'Conteúdo do tooltip. É projetado automaticamente dentro do slot.',
|
|
108
|
+
defaultValue: '',
|
|
109
|
+
table: {
|
|
110
|
+
category: 'Slot',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
closeEvent: {
|
|
114
|
+
control: 'text',
|
|
115
|
+
description: 'Evento customizado (via listener) disparado quando o componente é fechado.',
|
|
116
|
+
name: 'tooltipClosed',
|
|
117
|
+
table: {
|
|
118
|
+
category: 'Events',
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
export const Tooltip = {
|
|
124
|
+
args: {
|
|
125
|
+
targetElement: '<cura-button size="small" aria-labelledby="notification">Tooltip</cura-button>',
|
|
126
|
+
targetElementId: 'notification',
|
|
127
|
+
interactive: true,
|
|
128
|
+
delay: 250,
|
|
129
|
+
maxWidth: '280px',
|
|
130
|
+
label: 'Título do tooltip',
|
|
131
|
+
position: 'top',
|
|
132
|
+
closeButton: false,
|
|
133
|
+
content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit <a href="#">Link</a>.`
|
|
134
|
+
},
|
|
135
|
+
closeEvent: '-',
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=cura-tooltip.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cura-tooltip.stories.js","sourceRoot":"","sources":["../../../src/components/cura-tooltip/cura-tooltip.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,iBAAiB,GAAG,C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AO,EAAE,KAAK,EAAE;aACjC;YACD,IAAI,EAAE,cAAc;SACrB;QACD,aAAa,EAAE;YAChB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,oCAAoC;YACjD,KAAK,EAAE;gBACL,QAAQ,EAAE,MAAM;aACjB;YACD,IAAI,EAAE,EAAE;SACN;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,kEAAkE;YAC/E,YAAY,EAAE,EAAE;YAChB,KAAK,EAAE;gBACL,QAAQ,EAAE,MAAM;aACjB;SACF;QACD,UAAU,EAAE;YACV,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,4EAA4E;YACzF,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE;gBACL,QAAQ,EAAE,QAAQ;aACnB;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE;QACJ,aAAa,EAAE,gFAAgF;QAC/F,eAAe,EAAE,cAAc;QAC/B,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,mBAAmB;QAC5B,QAAQ,EAAE,KAAK;QACb,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,+EAA+E;KACzF;IACD,UAAU,EAAE,GAAG;CAChB,CAAC","sourcesContent":["const renderCuraTooltip = (args: any) => {\n return `<div style=\"width: 100%; height: 250px; display: flex; justify-content: center; align-items: center;\">\n ${args.targetElement}\n <cura-tooltip\n ${args.targetElementId ? `element-id=\"${args.targetElementId}\"` : ''}\n ${args.interactive === true ? '' : `interactive=\"${args.interactive}\"`}\n ${args.label ? `label=\"${args.label}\"` : ''}\n ${args.delay > 250 ? `delay=\"${args.delay}\"` : ''}\n ${args.maxWidth !== '280px' ? `max-width=\"${args.maxWidth}\"` : ''}\n ${args.position && args.position !== 'top' ? `position=\"${args.position}\"` : ''}\n ${args.closeButton === true ? `close-button=\"${args.closeButton}\"` : ''}>\n\t\t${args.content}\n </cura-tooltip>\n </div>`;\n}\n\nexport default {\n title: 'Componentes/Feedback/Tooltip',\n tags: ['autodocs'],\n render: ({ ...args }) => {\n return renderCuraTooltip(args);\n },\n argTypes: {\n targetElementId: {\n\t\t\tcontrol: 'text',\n\t\t\tdescription: 'Aria-labelledby do elemento alvo',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Properties',\n\t\t\t},\n\t\t\tname: 'elementId',\n },\n interactive: {\n\t\t\tcontrol: 'boolean',\n\t\t\tdescription: 'Ativa a interatividade do tooltip',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Properties',\n\t\t\t},\n\t\t\tname: 'interactive',\n },\n delay: {\n\t\t\tcontrol: 'number',\n\t\t\tdescription: 'Define a quantidade de tempo, em milisegundos, necessário para a abertura do tooltip.',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Properties',\n defaultValue: { summary: 250 },\n\t\t\t},\n\t\t\tname: 'delay',\n },\n maxWidth: {\n\t\t\tcontrol: 'text',\n\t\t\tdescription: 'Define a largura máxima do componente',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Properties',\n defaultValue: { summary: '280px' },\n\t\t\t},\n\t\t\tname: 'maxWidth',\n },\n label: {\n\t\t\tcontrol: 'text',\n\t\t\tdescription: 'Título do tooltip.',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Properties',\n\t\t\t},\n\t\t\tname: 'label',\n },\n\t\tposition: {\n\t\t\tcontrol: { type: 'select' },\n\t\t\toptions: ['', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-start', 'bottom', 'bottom-end', 'left-start', 'left', 'left-end'],\n\t\t\tdescription: 'Posição do Tooltip em relação ao conteúdo',\n\t\t\ttable: {\n\t\t\t\tcategory: 'Properties',\n\t\t\t\tdefaultValue: { summary: 'top' },\n\t\t\t},\n\t\t\tname: 'position',\n\t\t},\n closeButton: {\n control: 'boolean',\n description: 'Define se o alerta pode ser fechado.',\n table: {\n category: 'Properties',\n defaultValue: { summary: false },\n },\n name: 'close-button'\n },\n targetElement: {\n\t\t\tcontrol: 'text',\n\t\t\tdescription: 'Elemento que vai receber o tooltip',\n\t\t\ttable: {\n\t\t\t\t\tcategory: 'Slot',\n\t\t\t},\n\t\t\tname: '',\n },\n content: {\n control: 'text',\n description: 'Conteúdo do tooltip. É projetado automaticamente dentro do slot.',\n defaultValue: '',\n table: {\n category: 'Slot',\n },\n },\n closeEvent: {\n control: 'text',\n description: 'Evento customizado (via listener) disparado quando o componente é fechado.',\n name: 'tooltipClosed',\n table: {\n category: 'Events',\n },\n }\n },\n};\n\nexport const Tooltip = {\n args: {\n targetElement: '<cura-button size=\"small\" aria-labelledby=\"notification\">Tooltip</cura-button>',\n targetElementId: 'notification',\n interactive: true,\n delay: 250,\n maxWidth: '280px',\n label: 'Título do tooltip',\n\t\tposition: 'top',\n closeButton: false,\n content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit <a href=\"#\">Link</a>.`\n },\n closeEvent: '-',\n};\n"]}
|
|
@@ -147,7 +147,7 @@ export class CuraCheckbox {
|
|
|
147
147
|
return h("cura-icon", { class: "icon", name: iconName, size: iconSize, color: iconColor });
|
|
148
148
|
}
|
|
149
149
|
render() {
|
|
150
|
-
return (h(Host, { key: '
|
|
150
|
+
return (h(Host, { key: '00334ec058edf0849cf30c65d2f9e2e2e051de96' }, h("div", { key: 'd7c7857afa27a033f0642369717eb3be406f9f27', class: this.getClasses(), style: this.styles, onClick: this.handleClick }, h("div", { key: 'aed0ec8155b2a5c0e3000b416afd6c5455c55f0e', class: "info" }, h("div", { key: 'd90166401c6946c508d2cace62976c2e7374689f', class: "label-wrapper" }, h("cura-label", { key: '7c0c5cc650db37f09127050333f49c5f4b4c7dc6', class: "label", weight: 'bold', size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && h("cura-paragraph", { key: '3c1cd2dcad221f4d93bde959ca33273270f0fe45', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), h("cura-label", { key: '3fd01d993596f36da00b3acfeef02f2a28340eae', color: this.assignColor('message'), size: "xsmall", class: "message" }, h("slot", { key: '2c106bd163a1b330a18061c0e99eb21c911d7da9' }))), h("div", { key: '2286927b31856a224049693295caa9e037695749', class: 'checkbox', tabIndex: this.ontabindex }, h("input", { key: '9bb8a436f1500d046a9b57972307cf5feff183d3', type: "checkbox", name: this.name, value: this.value, disabled: this.disabled, required: this.required, checked: this.checked, indeterminate: this.indeterminate }), this.getIcon()))));
|
|
151
151
|
}
|
|
152
152
|
static get is() { return "cura-checkbox"; }
|
|
153
153
|
static get encapsulation() { return "shadow"; }
|
|
@@ -36,12 +36,12 @@ export class CuraDropdownSearchOption {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
|
-
return (h(Host, { key: '
|
|
39
|
+
return (h(Host, { key: 'a084adaf6f89be71c8d5dc141705e7a71af353bb', slot: "dropdown-search-option" }, h("div", { key: '58ac361d8f16fdab8ef07d3be3f9c12a8c4b85ef', style: this.styles, class: {
|
|
40
40
|
"option-container": true,
|
|
41
41
|
hovered: this.selectable ? this.hovered : false,
|
|
42
42
|
selected: this.selected,
|
|
43
43
|
disabled: !this.selectable
|
|
44
|
-
} }, h("div", { key: '
|
|
44
|
+
} }, h("div", { key: '0a7f959582b45df5c30fbbd225fccfc93aa937f4', class: "content-container" }, h("div", { key: '74b8a9626430847bf9dfb32d5188303427d2fd28', class: "option-info", onClick: (e) => this.handleOptionClick(e) }, h("slot", { key: '1dba6e28939841569f290c9fb18d3b7595bac06a', name: "image" }), h("cura-heading", { key: 'f7722edfd7ab87f7d9bacf475d988a1e80af41ef', size: "xsmall", lineHeight: "16px", marginBlock: "0px", weight: "bold", color: "neutral-black" }, h("slot", { key: 'db0385e5e3d2c450ba9a96d75e7913d2fe913d98' }))), h("slot", { key: '734b467cfce5ce114b06a10e3a153723da7ad41d', name: "action" })))));
|
|
45
45
|
}
|
|
46
46
|
static get is() { return "cura-dropdown-search-option"; }
|
|
47
47
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
export class CuraDropdownSearchOptionTitle {
|
|
3
3
|
render() {
|
|
4
|
-
return (h(Host, { key: '
|
|
4
|
+
return (h(Host, { key: 'e4929a8c5c1c1f11b3e51dc088b2dd506e1bdfa0', slot: "dropdown-search-option" }, h("cura-label", { key: '5bb5406c11a39a6a587737cf99eb1d2deb2ea0da', color: "neutral-dark", size: "xsmall", lineHeight: "16px", marginBlock: "0" }, h("slot", { key: 'c781e560b512d5362370e9855551b3e088ffbec1' }))));
|
|
5
5
|
}
|
|
6
6
|
static get is() { return "cura-dropdown-search-option-title"; }
|
|
7
7
|
static get encapsulation() { return "shadow"; }
|