@rededor/cura 1.2.0 → 1.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/{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-modal.cjs.entry.js +50 -0
- package/dist/cjs/cura-modal.cjs.entry.js.map +1 -0
- 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 +2 -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-modal/cura-modal.css +211 -0
- package/dist/collection/components/cura-modal/cura-modal.js +134 -0
- package/dist/collection/components/cura-modal/cura-modal.js.map +1 -0
- package/dist/collection/components/cura-modal/cura-modal.stories.js +85 -0
- package/dist/collection/components/cura-modal/cura-modal.stories.js.map +1 -0
- 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-modal.d.ts +11 -0
- package/dist/components/cura-modal.js +84 -0
- package/dist/components/cura-modal.js.map +1 -0
- 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 +35 -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-0308cf6b.entry.js +2 -0
- package/dist/cura/p-0308cf6b.entry.js.map +1 -0
- package/dist/cura/{p-c6508bd7.entry.js → p-075b02de.entry.js} +2 -2
- package/dist/cura/{p-fd083399.entry.js → p-0e28f1c8.entry.js} +2 -2
- package/dist/cura/{p-e5023e34.entry.js → p-1f53580a.entry.js} +2 -2
- package/dist/cura/p-3536c96b.entry.js +2 -0
- package/dist/cura/p-3536c96b.entry.js.map +1 -0
- package/dist/cura/p-5bb8302c.entry.js +2 -0
- package/dist/cura/p-5bb8302c.entry.js.map +1 -0
- package/dist/cura/p-7090d4a7.entry.js +2 -0
- package/dist/cura/p-7090d4a7.entry.js.map +1 -0
- package/dist/cura/p-71a2dcef.entry.js +2 -0
- package/dist/cura/p-71a2dcef.entry.js.map +1 -0
- 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-9a7e3f48.entry.js +2 -0
- package/dist/cura/p-9a7e3f48.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-907b3d12.entry.js → p-bfb5e9e1.entry.js} +2 -2
- package/dist/cura/{p-fdce91a7.entry.js → p-d635501a.entry.js} +2 -2
- package/dist/cura/{p-44e3325a.entry.js → p-dbd9eab3.entry.js} +2 -2
- package/dist/cura/{p-8f3db0fe.entry.js → p-e5b0dd74.entry.js} +2 -2
- package/dist/cura/p-ebed83d1.entry.js +2 -0
- package/dist/cura/{p-fcbf4311.entry.js → p-ed839f1e.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/cura/{p-b2d5db22.entry.js → p-eea093b2.entry.js} +2 -2
- package/dist/cura/p-f375a612.entry.js +2 -0
- package/dist/cura/p-f375a612.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-modal.entry.js +46 -0
- package/dist/esm/cura-modal.entry.js.map +1 -0
- 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-modal/cura-modal.d.ts +28 -0
- package/dist/types/components/cura-modal/cura-modal.stories.d.ts +70 -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 +131 -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-075b02de.entry.js.map} +0 -0
- /package/dist/cura/{p-fd083399.entry.js.map → p-0e28f1c8.entry.js.map} +0 -0
- /package/dist/cura/{p-e5023e34.entry.js.map → p-1f53580a.entry.js.map} +0 -0
- /package/dist/cura/{p-41c3d47d.entry.js.map → p-81c66f2b.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-907b3d12.entry.js.map → p-bfb5e9e1.entry.js.map} +0 -0
- /package/dist/cura/{p-fdce91a7.entry.js.map → p-d635501a.entry.js.map} +0 -0
- /package/dist/cura/{p-44e3325a.entry.js.map → p-dbd9eab3.entry.js.map} +0 -0
- /package/dist/cura/{p-8f3db0fe.entry.js.map → p-e5b0dd74.entry.js.map} +0 -0
- /package/dist/cura/{p-4e14c01c.entry.js.map → p-ebed83d1.entry.js.map} +0 -0
- /package/dist/cura/{p-fcbf4311.entry.js.map → p-ed839f1e.entry.js.map} +0 -0
- /package/dist/cura/{p-b2d5db22.entry.js.map → p-eea093b2.entry.js.map} +0 -0
|
@@ -14,7 +14,7 @@ export class CuraPageTemplate {
|
|
|
14
14
|
return classes;
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
|
-
return (h(Host, { key: '
|
|
17
|
+
return (h(Host, { key: 'd79c3d22ccbd93d8a56c700e3016507d18720464' }, h("div", { key: 'a717f44d6b5df9f00ffe61fff816721705748040', style: this.styles, class: "grid-template" }, h("div", { key: '7a3d585d4213799b32e2043327442b21833fd4fc', id: "sub-header" }, h("slot", { key: 'dbab9738fe221a426642e5d63e88130e1f351591', name: 'sub-header' })), h("div", { key: '39f2878cac260b70b8e53b57b6b9b5b07f658251', id: "header" }, h("slot", { key: '511af91f30dfcfde3ced7bce4c341a2802c88db8', name: 'header' })), h("div", { key: 'ed8d1b1e0d5ffca939c525ee8320da7f2afde95d', id: "pre-content" }, h("slot", { key: 'dd8c722ddd113f49965a6397625980aace8b78e8', name: 'pre-content' })), h("div", { key: '64a5767bbc858f18e44a3339b6bb567b3e5a8c0d', id: "content-container", class: this.getClasses() }, h("div", { key: '919e9d54e10f1469264f193545e80b680b63c801', id: "sidebar-left" }, h("slot", { key: '8ddeb7358bd9f6d0e08b1e3f323219b8980eec9c', name: 'sidebar-left' })), h("div", { key: '48e3860c1674658c386124c80a35b85bdb085e3e', id: "content" }, h("slot", { key: '8bc21a187897a5e9cd2e922285364a02425cefa6', name: "content" }), h("slot", { key: '587d13eed3fedcbf9e33dc4084cb2554ba70125d' })), h("div", { key: '7f620fd04b4cf4a051954dca8a95293c2a7c1d9a', id: "sidebar-right" }, h("slot", { key: '3499275e67a00fcaab4f044535dbeb19c1040569', name: 'sidebar-right' }))), h("div", { key: '59b9e4a5fe541f2ad6dac53a40588482b33e0cad', id: "post-body" }, h("slot", { key: '7493b3b330cabf263990a149c1b526501260de95', name: 'post-body' })), h("div", { key: '4a35c95f7ad04f04bb8673babc06d243e1b8f931', id: "footer" }, h("slot", { key: 'f69ffbd9c9cabe72e1ee4f147f7a1448311a7f0c', name: 'footer' })), h("div", { key: 'd53b60b2d9170797e7dc12b3179c24b7f76ac41d', id: "sub-footer" }, h("slot", { key: '75dcebb2f223ed1d0b1181ea3773fbb6bf096e33', name: 'sub-footer' })))));
|
|
18
18
|
}
|
|
19
19
|
static get is() { return "cura-page-template"; }
|
|
20
20
|
static get encapsulation() { return "shadow"; }
|
|
@@ -21,7 +21,7 @@ export class CuraToast {
|
|
|
21
21
|
this.setStyle();
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: '467952f8386d659d44090163f3e14c0231dfcafd' }, h("div", { key: 'f510e12d309c79842d30cc24409b61433a6fe58e', class: this.getClasses(), style: this.styles }, h("cura-icon", { key: 'acd2a9d52ad91565c7bd36bc205753bdfe6e3e59', class: "default-icon", name: this.getNameIcon(), size: 16, color: `${this.type}-dark` }), h("div", { key: 'dced39ca17901673360dacbf27764b1387eff20d', class: "content" }, h("cura-heading", { key: '6ac55c8ae757f654c808b72b4f44b54dc822107c', level: 4, size: "xsmall", color: `${this.type}-dark`, weight: "bold", "margin-block": "0" }, this.label), h("cura-paragraph", { key: 'e8e83b891e0b7e02901999f1622a183afc94c28e', color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, h("slot", { key: '080891767b1b552520d7d3ed59002a9478eb0288' })), h("slot", { key: '0a43f99bbaf2e4cdd2fd7dc1d5a0431602b76361', name: "actions" })), this.closeButton && h("cura-icon", { key: '1ec27e6d6d44b82ed26a59cb6ba967858b4c8809', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.loader && !!this.autoCloseDelay && h("cura-loader-bar", { key: '6457bb003e4706d3f60b85aa3faa3e0b6b276869', color: `${this.type}-base`, progress: this.progress }))));
|
|
25
25
|
}
|
|
26
26
|
componentDidLoad() {
|
|
27
27
|
this.openContainer();
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* Breakpoints variables */
|
|
2
|
+
/**
|
|
3
|
+
* Responsive media for mobile (small) only.
|
|
4
|
+
* Use: @include mobile-only() { ... }
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Responsive media for medium only.
|
|
8
|
+
* Use: @include medium-only() { ... }
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Responsive media for large only.
|
|
12
|
+
* Use: @include large-only() { ... }
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Responsive media for xlarge only.
|
|
16
|
+
* Use: @include xlarge-only() { ... }
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Responsive media for medium to large.
|
|
20
|
+
* Use: @include medium-large() { ... }
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Responsive media for large and up.
|
|
24
|
+
* Use: @include large-up() { ... }
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Global Shadow Level Definitions.
|
|
28
|
+
* Required CSS Properties with respective opacities:
|
|
29
|
+
* --neutral-black,
|
|
30
|
+
* --neutral-purewhite,
|
|
31
|
+
* --accent-base
|
|
32
|
+
* --primary-base
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Shadow Level base definitions.
|
|
36
|
+
* Required CSS Properties: --neutral-purewhite opacity: 0.2
|
|
37
|
+
* Use: @include shadow-level1(){ ... }
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Shadow Level base definitions.
|
|
41
|
+
* Required CSS Properties: --neutral-black opacity: 0.16
|
|
42
|
+
* Use: @include shadow-level2(--neutral-black-shadow){ ... }
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Shadow Level base definitions.
|
|
46
|
+
* Required CSS Properties: --neutral-black opacity: 0.16
|
|
47
|
+
* Use: @include shadow-level3(--neutral-black-shadow){ ... }
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Shadow Level base definitions.
|
|
51
|
+
* Required CSS Properties: --neutral-black opacity: 0.12
|
|
52
|
+
* Use: @include shadow-level4(){ ... }
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* Shadow Level base definitions.
|
|
56
|
+
* Required CSS Properties: --neutral-black opacity: 0.8
|
|
57
|
+
* Use: @include shadow-level5(){ ... }
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Shadow Level base definitions.
|
|
61
|
+
* Required CSS Properties: --accent-base opacity: 0.2
|
|
62
|
+
* Use: @include shadow-level5-accent(){ ... }
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Shadow Level base definitions.
|
|
66
|
+
* Required CSS Properties: --primary-base opacity: 0.16
|
|
67
|
+
* Use: @include shadow-level3-primary(){ ... }
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* Global Spacing Definitions.
|
|
71
|
+
* Required CSS Properties:
|
|
72
|
+
* --base-spacing
|
|
73
|
+
*/
|
|
74
|
+
/* None: 0px */
|
|
75
|
+
/* Tiny default: 4px */
|
|
76
|
+
/* Mini default: 8px */
|
|
77
|
+
/* XXXS default: 12px */
|
|
78
|
+
/* XXS default: 16px */
|
|
79
|
+
/* XS default: 20px */
|
|
80
|
+
/* S default: 20px */
|
|
81
|
+
/* M default: 32px */
|
|
82
|
+
/* L default: 40px */
|
|
83
|
+
/* XL default: 48px */
|
|
84
|
+
/* XXL default: 64px */
|
|
85
|
+
/* XXXL default: 72px */
|
|
86
|
+
/* Huge default: 96px */
|
|
87
|
+
:host {
|
|
88
|
+
position: absolute;
|
|
89
|
+
z-index: 99999;
|
|
90
|
+
display: block;
|
|
91
|
+
width: fit-content;
|
|
92
|
+
height: fit-content;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
}
|
|
95
|
+
@media (max-width: 768px) {
|
|
96
|
+
:host {
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
:host .container {
|
|
101
|
+
display: flex;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
max-width: var(--max-width);
|
|
104
|
+
height: auto;
|
|
105
|
+
padding: calc(var(--base-spacing) * 2px);
|
|
106
|
+
border: 1px solid var(--neutral-light);
|
|
107
|
+
border-radius: calc(var(--base-spacing) * 1px);
|
|
108
|
+
background-color: var(--neutral-purewhite);
|
|
109
|
+
box-shadow: 0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));
|
|
110
|
+
}
|
|
111
|
+
@media (max-width: 768px) {
|
|
112
|
+
:host .container {
|
|
113
|
+
max-width: 90%;
|
|
114
|
+
height: fit-content;
|
|
115
|
+
padding: calc(var(--base-spacing) * 4px) calc(var(--base-spacing) * 4px) 0 calc(var(--base-spacing) * 4px);
|
|
116
|
+
margin: 0 auto;
|
|
117
|
+
border: 2px solid;
|
|
118
|
+
border-radius: calc(var(--base-spacing) * 3px) calc(var(--base-spacing) * 3px) 0 0;
|
|
119
|
+
border-color: var(--neutral-light) var(--neutral-light) transparent var(--neutral-light);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
:host .container::after {
|
|
123
|
+
content: "";
|
|
124
|
+
position: absolute;
|
|
125
|
+
z-index: 99999;
|
|
126
|
+
width: calc(var(--base-spacing) * 2.5px);
|
|
127
|
+
height: calc(var(--base-spacing) * 2.5px);
|
|
128
|
+
border: 1px solid;
|
|
129
|
+
border-radius: 2px;
|
|
130
|
+
background-color: var(--neutral-purewhite);
|
|
131
|
+
left: var(--arrow-left);
|
|
132
|
+
top: var(--arrow-top);
|
|
133
|
+
border-color: var(--arrow-border-color);
|
|
134
|
+
transform: var(--arrow-translate) rotate(45deg);
|
|
135
|
+
}
|
|
136
|
+
@media (max-width: 768px) {
|
|
137
|
+
:host .container::after {
|
|
138
|
+
display: none;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
:host .container .content {
|
|
142
|
+
flex: 1 1 0;
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
gap: calc(var(--base-spacing) * 1px);
|
|
146
|
+
}
|
|
147
|
+
@media (max-width: 768px) {
|
|
148
|
+
:host .container .content {
|
|
149
|
+
padding-bottom: calc(var(--base-spacing) * 4px);
|
|
150
|
+
border-bottom: 1px dashed var(--neutral-light);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
:host .container .close-icon {
|
|
154
|
+
margin-left: calc(var(--base-spacing) * 3px);
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
157
|
+
:host .container .close-button {
|
|
158
|
+
padding: calc(var(--base-spacing) * 2px) 0;
|
|
159
|
+
}
|
|
@@ -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: '732345360f527ffc69743818657643616b2ee611', role: "tooltip", id: this.elementId }, h("div", { key: '166aa0dd54c933f8b3b8ecc5c5c76824ef180d71', class: "container", style: this.styles }, h("div", { key: '7b54ec53f3b454979c45415ddcd164a71a9ab2b0', class: "content" }, h("cura-heading", { key: '71bf328ed2f9e5d704e6d06989a4bef6d7c4993d', level: 4, size: "xsmall", color: "neutral-black", weight: "bold", "margin-block": "0" }, this.label), h("cura-paragraph", { key: 'a427a4b9df7bfae50300c9947db9df825a2f7da0', color: "neutral-dark", "spot-color": "secondary-darker", size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, h("slot", { key: '65875debf5bd3eec9f3070ab96cf644460897c3b' }))), this.closeButton && !this.isMobile && h("cura-icon", { key: 'dac8229dc0f348b45ea3af9392c2001f638a0efb', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.isMobile && h("cura-button-transparent", { key: '6c90921145206d47ab84eaee972a08b9dcad7cf0', 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,WAAM,GAAG,EAAE,CAAC;QAuQZ,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;yBAvRkB,EAAE;2BACA,IAAI;qBACV,GAAG;wBACA,OAAO;wBACmK,KAAK;;2BAE3J,KAAK;wBAExB,KAAK;;IASzB,cAAc;QACZ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACvC,CAAC;IAGD,c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AE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;YAED,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,GAAG,GAAG,WAAW,CAAC,GAAG,GAAG,WAAW,CAAC,MAAM,GAAG,yBAAyB,CAAC;gBACvE,kBAAkB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;gBAEzC,IAAI,GAAG,GAAG,WAAW,CAAC,MAAM,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC;oBAC3D,GAAG,GAAG,WAAW,CAAC,GAAG,GAAG,WAAW,CAAC,MAAM,GAAG,yBAAyB,CAAC;oBACvE,kBAAkB,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"]}
|