@zanichelli/albe-web-components 4.0.4 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/dist/cjs/{index-6b6a3299.js → index-0e75c8cc.js} +16 -45
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/utils-155eec04.js +2706 -0
- package/dist/cjs/{utils-8cc414c9.js → utils-97262bbd.js} +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-app-switcher_9.cjs.entry.js +736 -0
- package/dist/cjs/z-aria-alert.cjs.entry.js +1 -1
- package/dist/cjs/z-avatar.cjs.entry.js +1 -1
- package/dist/cjs/z-button-deprecated.cjs.entry.js +1 -1
- package/dist/cjs/z-button.cjs.entry.js +44 -0
- package/dist/cjs/z-card.cjs.entry.js +69 -0
- package/dist/cjs/z-carousel.cjs.entry.js +24 -0
- package/dist/cjs/z-chip.cjs.entry.js +2 -2
- package/dist/cjs/z-combobox.cjs.entry.js +2 -2
- package/dist/cjs/z-contextual-menu.cjs.entry.js +18 -7
- package/dist/cjs/z-cookiebar.cjs.entry.js +1 -1
- package/dist/cjs/z-date-picker.cjs.entry.js +10 -2701
- package/dist/cjs/z-file-upload.cjs.entry.js +2 -2
- package/dist/cjs/z-file.cjs.entry.js +10 -9
- package/dist/cjs/z-footer.cjs.entry.js +1 -1
- package/dist/cjs/z-ghost-loading.cjs.entry.js +19 -0
- package/dist/cjs/z-input-deprecated.cjs.entry.js +2 -2
- package/dist/cjs/z-input-label_2.cjs.entry.js +2 -2
- package/dist/cjs/z-list-group.cjs.entry.js +1 -1
- package/dist/cjs/z-list_2.cjs.entry.js +1 -1
- package/dist/cjs/z-menu-dropdown_2.cjs.entry.js +2 -2
- package/dist/cjs/z-messages-pocket.cjs.entry.js +1 -1
- package/dist/cjs/z-modal-login.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-alert.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-dictionary.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-footer.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-info.cjs.entry.js +4 -4
- package/dist/cjs/z-myz-card_4.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-list-item.cjs.entry.js +2 -2
- package/dist/cjs/z-myz-topbar.cjs.entry.js +1 -1
- package/dist/cjs/z-navigation-tab-link.cjs.entry.js +1 -1
- package/dist/cjs/z-navigation-tab.cjs.entry.js +1 -1
- package/dist/cjs/z-navigation-tabs.cjs.entry.js +1 -1
- package/dist/cjs/z-offcanvas.cjs.entry.js +63 -0
- package/dist/cjs/z-otp.cjs.entry.js +1 -1
- package/dist/cjs/z-pagination-bar.cjs.entry.js +2 -2
- package/dist/cjs/z-pocket_3.cjs.entry.js +2 -2
- package/dist/cjs/z-popover-deprecated.cjs.entry.js +338 -0
- package/dist/cjs/z-popover.cjs.entry.js +304 -97
- package/dist/cjs/z-section-title.cjs.entry.js +1 -1
- package/dist/cjs/z-skip-to-content.cjs.entry.js +2 -2
- package/dist/cjs/z-slideshow.cjs.entry.js +2 -2
- package/dist/cjs/z-status-tag.cjs.entry.js +1 -1
- package/dist/cjs/z-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/z-table-header.cjs.entry.js +8 -11
- package/dist/cjs/z-table-row.cjs.entry.js +1 -1
- package/dist/cjs/z-table.cjs.entry.js +1 -1
- package/dist/cjs/z-toast-notification-list.cjs.entry.js +1 -1
- package/dist/cjs/z-toast-notification.cjs.entry.js +1 -1
- package/dist/cjs/z-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/z-tooltip-deprecated.cjs.entry.js +274 -0
- package/dist/cjs/z-tooltip.cjs.entry.js +8 -251
- package/dist/collection/beans/index.js +16 -45
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/{z-date-picker → date-picker}/styles.css +69 -17
- package/dist/collection/components/date-picker/utils.js +76 -0
- package/dist/collection/components/{z-date-picker → date-picker/z-date-picker}/index.js +13 -84
- package/dist/collection/components/date-picker/z-range-picker/index.js +483 -0
- package/dist/collection/components/file-upload/z-file/index.js +13 -13
- package/dist/collection/components/file-upload/z-file/styles.css +2 -2
- package/dist/collection/components/inputs/z-input/styles.css +2 -0
- package/dist/collection/components/notification/z-tooltip/index.js +45 -298
- package/dist/collection/components/notification/z-tooltip/styles.css +8 -120
- package/dist/collection/components/z-contextual-menu/index.js +26 -16
- package/dist/collection/components/z-contextual-menu/styles.css +16 -5
- package/dist/collection/components/z-popover/index.js +381 -166
- package/dist/collection/components/z-popover/styles.css +91 -180
- package/dist/collection/components/z-table/z-table-header/index.js +10 -16
- package/dist/collection/components/z-table/z-table-header/styles.css +7 -1
- package/dist/collection/deprecated/z-popover-deprecated/index.js +489 -0
- package/dist/collection/deprecated/z-popover-deprecated/styles.css +134 -0
- package/dist/collection/deprecated/z-tooltip-deprecated/index.js +379 -0
- package/dist/collection/deprecated/z-tooltip-deprecated/styles.css +128 -0
- package/dist/collection/snowflakes/myz/card/z-myz-card-info/index.js +2 -2
- package/dist/collection/snowflakes/myz/card/z-myz-card-info/styles.css +1 -1
- package/dist/esm/{index-46ca649a.js → index-c1ce8cab.js} +17 -46
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-5d5963ef.js → utils-99c70c57.js} +2 -2
- package/dist/esm/utils-fa9f38ec.js +2701 -0
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-switcher_9.entry.js +724 -0
- package/dist/esm/z-aria-alert.entry.js +1 -1
- package/dist/esm/z-avatar.entry.js +1 -1
- package/dist/esm/z-button-deprecated.entry.js +1 -1
- package/dist/esm/z-button.entry.js +40 -0
- package/dist/esm/z-card.entry.js +65 -0
- package/dist/esm/z-carousel.entry.js +20 -0
- package/dist/esm/z-chip.entry.js +2 -2
- package/dist/esm/z-combobox.entry.js +2 -2
- package/dist/esm/z-contextual-menu.entry.js +19 -8
- package/dist/esm/z-cookiebar.entry.js +1 -1
- package/dist/esm/z-date-picker.entry.js +9 -2700
- package/dist/esm/z-file-upload.entry.js +2 -2
- package/dist/esm/z-file.entry.js +10 -9
- package/dist/esm/z-footer.entry.js +1 -1
- package/dist/esm/z-ghost-loading.entry.js +15 -0
- package/dist/esm/z-input-deprecated.entry.js +2 -2
- package/dist/esm/z-input-label_2.entry.js +2 -2
- package/dist/esm/z-list-group.entry.js +1 -1
- package/dist/esm/z-list_2.entry.js +1 -1
- package/dist/esm/z-menu-dropdown_2.entry.js +2 -2
- package/dist/esm/z-messages-pocket.entry.js +1 -1
- package/dist/esm/z-modal-login.entry.js +1 -1
- package/dist/esm/z-myz-card-alert.entry.js +1 -1
- package/dist/esm/z-myz-card-dictionary.entry.js +1 -1
- package/dist/esm/z-myz-card-footer.entry.js +1 -1
- package/dist/esm/z-myz-card-info.entry.js +4 -4
- package/dist/esm/z-myz-card_4.entry.js +1 -1
- package/dist/esm/z-myz-list-item.entry.js +2 -2
- package/dist/esm/z-myz-topbar.entry.js +1 -1
- package/dist/esm/z-navigation-tab-link.entry.js +1 -1
- package/dist/esm/z-navigation-tab.entry.js +1 -1
- package/dist/esm/z-navigation-tabs.entry.js +1 -1
- package/dist/esm/z-offcanvas.entry.js +59 -0
- package/dist/esm/z-otp.entry.js +1 -1
- package/dist/esm/z-pagination-bar.entry.js +2 -2
- package/dist/esm/z-pocket_3.entry.js +2 -2
- package/dist/esm/z-popover-deprecated.entry.js +334 -0
- package/dist/esm/z-popover.entry.js +305 -98
- package/dist/esm/z-section-title.entry.js +1 -1
- package/dist/esm/z-skip-to-content.entry.js +2 -2
- package/dist/esm/z-slideshow.entry.js +2 -2
- package/dist/esm/z-status-tag.entry.js +1 -1
- package/dist/esm/z-table-cell.entry.js +1 -1
- package/dist/esm/z-table-header.entry.js +8 -11
- package/dist/esm/z-table-row.entry.js +1 -1
- package/dist/esm/z-table.entry.js +1 -1
- package/dist/esm/z-toast-notification-list.entry.js +1 -1
- package/dist/esm/z-toast-notification.entry.js +1 -1
- package/dist/esm/z-toggle-switch.entry.js +2 -2
- package/dist/esm/z-tooltip-deprecated.entry.js +270 -0
- package/dist/esm/z-tooltip.entry.js +9 -252
- package/dist/types/beans/index.d.ts +7 -33
- package/dist/types/components/date-picker/utils.d.ts +3 -0
- package/dist/types/components/{z-date-picker → date-picker/z-date-picker}/index.d.ts +3 -8
- package/dist/types/components/date-picker/z-range-picker/index.d.ts +43 -0
- package/dist/types/components/file-upload/z-file/index.d.ts +3 -3
- package/dist/types/components/notification/z-tooltip/index.d.ts +14 -29
- package/dist/types/components/z-contextual-menu/index.d.ts +8 -4
- package/dist/types/components/z-popover/index.d.ts +57 -28
- package/dist/types/components/z-table/z-table-header/index.d.ts +2 -1
- package/dist/types/components.d.ts +210 -35
- package/dist/types/deprecated/z-popover-deprecated/index.d.ts +57 -0
- package/dist/types/deprecated/z-tooltip-deprecated/index.d.ts +41 -0
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/{p-4af112a7.entry.js → p-053846df.entry.js} +1 -1
- package/dist/web-components-library/{p-e2102da3.entry.js → p-0f6edb58.entry.js} +1 -1
- package/dist/web-components-library/p-10be0462.entry.js +1 -0
- package/dist/web-components-library/{p-b15efba3.entry.js → p-15fa8ca4.entry.js} +1 -1
- package/dist/web-components-library/{p-02ea7e49.entry.js → p-1a76a57d.entry.js} +1 -1
- package/{www/build/p-1f73a6d8.entry.js → dist/web-components-library/p-1b1717c9.entry.js} +1 -1
- package/{www/build/p-3edbd35c.entry.js → dist/web-components-library/p-1d5aa37b.entry.js} +1 -1
- package/dist/web-components-library/{p-9074e1a5.entry.js → p-1eb357e8.entry.js} +1 -1
- package/dist/web-components-library/{p-57d1acdc.entry.js → p-28e4abc4.entry.js} +1 -1
- package/dist/web-components-library/p-41f33f7b.entry.js +1 -0
- package/dist/web-components-library/{p-d33fea26.entry.js → p-46aecb12.entry.js} +1 -1
- package/dist/web-components-library/{p-63ccb013.entry.js → p-4be52491.entry.js} +1 -1
- package/{www/build/p-55ddbfe9.entry.js → dist/web-components-library/p-4d6f2f01.entry.js} +1 -1
- package/dist/web-components-library/p-514719d2.entry.js +1 -0
- package/dist/web-components-library/p-53dade4b.entry.js +16 -0
- package/{www/build/p-df4e963b.entry.js → dist/web-components-library/p-55f09348.entry.js} +1 -1
- package/dist/web-components-library/p-5789bbe7.entry.js +1 -0
- package/dist/web-components-library/{p-de25c7f0.entry.js → p-5dcbba4e.entry.js} +1 -1
- package/dist/web-components-library/{p-9f9e4266.entry.js → p-659fc25e.entry.js} +1 -1
- package/dist/web-components-library/{p-8fbc2ce9.entry.js → p-6bbd53ec.entry.js} +1 -1
- package/dist/web-components-library/{p-5be162d5.entry.js → p-6c52ed1b.entry.js} +1 -1
- package/dist/web-components-library/p-78df5dbf.entry.js +1 -0
- package/dist/web-components-library/{p-b9da171f.js → p-7f1cc90f.js} +1 -1
- package/dist/web-components-library/{p-0f17db30.entry.js → p-805af37b.entry.js} +1 -1
- package/dist/web-components-library/p-870dabdc.entry.js +1 -0
- package/dist/web-components-library/{p-43329b81.entry.js → p-897f9491.entry.js} +1 -1
- package/dist/web-components-library/{p-3c111c2a.entry.js → p-8ce4b2c4.entry.js} +1 -1
- package/dist/web-components-library/p-8cf3798f.entry.js +1 -0
- package/dist/web-components-library/p-8ddbbe24.entry.js +1 -0
- package/{www/build/p-dffdf60a.entry.js → dist/web-components-library/p-91ec5eb4.entry.js} +1 -1
- package/dist/web-components-library/{p-292bc0c4.entry.js → p-92895bce.entry.js} +1 -1
- package/dist/web-components-library/p-970bd07c.entry.js +1 -0
- package/dist/web-components-library/{p-6c6b4e80.entry.js → p-990b8236.entry.js} +1 -1
- package/dist/web-components-library/{p-51cdabeb.entry.js → p-99a562cb.entry.js} +1 -1
- package/dist/web-components-library/p-b359a3b4.entry.js +1 -0
- package/dist/web-components-library/p-b6cd034b.js +1 -0
- package/dist/web-components-library/{p-edb8d2ab.entry.js → p-b9cc2dfc.entry.js} +1 -1
- package/dist/web-components-library/p-bfc78a89.entry.js +1 -0
- package/dist/web-components-library/{p-d995d9dc.entry.js → p-c042e745.entry.js} +1 -1
- package/dist/web-components-library/{p-ccdebe3f.entry.js → p-c8383456.entry.js} +1 -1
- package/dist/web-components-library/{p-0e256fdc.entry.js → p-caa21a6f.entry.js} +1 -1
- package/{www/build/p-bfe5693d.entry.js → dist/web-components-library/p-cd88cead.entry.js} +1 -1
- package/dist/web-components-library/p-d04f3cb6.entry.js +1 -0
- package/{www/build/p-9a5ee6c2.entry.js → dist/web-components-library/p-d6361790.entry.js} +1 -1
- package/dist/web-components-library/{p-69ef6ddc.entry.js → p-dd0efdbf.entry.js} +1 -1
- package/dist/web-components-library/p-e007cd0b.entry.js +1 -0
- package/dist/web-components-library/{p-0a0aee35.entry.js → p-e74b3fd9.entry.js} +1 -1
- package/{www/build/p-d97a2db9.entry.js → dist/web-components-library/p-eca4cb15.entry.js} +1 -1
- package/dist/web-components-library/p-ed1cd6b1.js +1 -0
- package/dist/web-components-library/p-f26251dd.entry.js +1 -0
- package/dist/web-components-library/p-f61fd81e.entry.js +1 -0
- package/dist/web-components-library/{p-1727c1c8.entry.js → p-f78d6123.entry.js} +1 -1
- package/dist/web-components-library/p-fbfaa699.entry.js +1 -0
- package/dist/web-components-library/{p-ba29bc12.entry.js → p-fdd91263.entry.js} +1 -1
- package/dist/web-components-library/{p-fe927bf4.entry.js → p-ff4a0f6f.entry.js} +1 -1
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +5 -2
- package/react/components.js.map +1 -1
- package/www/build/index.esm.js +1 -1
- package/www/build/{p-4af112a7.entry.js → p-053846df.entry.js} +1 -1
- package/www/build/{p-e2102da3.entry.js → p-0f6edb58.entry.js} +1 -1
- package/www/build/p-10be0462.entry.js +1 -0
- package/www/build/{p-b15efba3.entry.js → p-15fa8ca4.entry.js} +1 -1
- package/www/build/{p-02ea7e49.entry.js → p-1a76a57d.entry.js} +1 -1
- package/{dist/web-components-library/p-1f73a6d8.entry.js → www/build/p-1b1717c9.entry.js} +1 -1
- package/{dist/web-components-library/p-3edbd35c.entry.js → www/build/p-1d5aa37b.entry.js} +1 -1
- package/www/build/{p-9074e1a5.entry.js → p-1eb357e8.entry.js} +1 -1
- package/www/build/{p-57d1acdc.entry.js → p-28e4abc4.entry.js} +1 -1
- package/www/build/p-41f33f7b.entry.js +1 -0
- package/www/build/{p-d33fea26.entry.js → p-46aecb12.entry.js} +1 -1
- package/www/build/{p-63ccb013.entry.js → p-4be52491.entry.js} +1 -1
- package/{dist/web-components-library/p-55ddbfe9.entry.js → www/build/p-4d6f2f01.entry.js} +1 -1
- package/www/build/p-514719d2.entry.js +1 -0
- package/www/build/p-53dade4b.entry.js +16 -0
- package/{dist/web-components-library/p-df4e963b.entry.js → www/build/p-55f09348.entry.js} +1 -1
- package/www/build/p-5789bbe7.entry.js +1 -0
- package/www/build/{p-de25c7f0.entry.js → p-5dcbba4e.entry.js} +1 -1
- package/www/build/{p-9f9e4266.entry.js → p-659fc25e.entry.js} +1 -1
- package/www/build/{p-8fbc2ce9.entry.js → p-6bbd53ec.entry.js} +1 -1
- package/www/build/{p-5be162d5.entry.js → p-6c52ed1b.entry.js} +1 -1
- package/www/build/p-78df5dbf.entry.js +1 -0
- package/www/build/{p-b9da171f.js → p-7f1cc90f.js} +1 -1
- package/www/build/{p-0f17db30.entry.js → p-805af37b.entry.js} +1 -1
- package/www/build/p-870dabdc.entry.js +1 -0
- package/www/build/{p-43329b81.entry.js → p-897f9491.entry.js} +1 -1
- package/www/build/{p-3c111c2a.entry.js → p-8ce4b2c4.entry.js} +1 -1
- package/www/build/p-8cf3798f.entry.js +1 -0
- package/www/build/p-8ddbbe24.entry.js +1 -0
- package/{dist/web-components-library/p-dffdf60a.entry.js → www/build/p-91ec5eb4.entry.js} +1 -1
- package/www/build/{p-292bc0c4.entry.js → p-92895bce.entry.js} +1 -1
- package/www/build/p-970bd07c.entry.js +1 -0
- package/www/build/p-975e9d42.js +129 -0
- package/www/build/{p-6c6b4e80.entry.js → p-990b8236.entry.js} +1 -1
- package/www/build/{p-51cdabeb.entry.js → p-99a562cb.entry.js} +1 -1
- package/www/build/p-b359a3b4.entry.js +1 -0
- package/www/build/p-b6cd034b.js +1 -0
- package/www/build/{p-edb8d2ab.entry.js → p-b9cc2dfc.entry.js} +1 -1
- package/www/build/p-bfc78a89.entry.js +1 -0
- package/www/build/{p-d995d9dc.entry.js → p-c042e745.entry.js} +1 -1
- package/www/build/{p-ccdebe3f.entry.js → p-c8383456.entry.js} +1 -1
- package/www/build/{p-0e256fdc.entry.js → p-caa21a6f.entry.js} +1 -1
- package/{dist/web-components-library/p-bfe5693d.entry.js → www/build/p-cd88cead.entry.js} +1 -1
- package/www/build/p-d04f3cb6.entry.js +1 -0
- package/{dist/web-components-library/p-9a5ee6c2.entry.js → www/build/p-d6361790.entry.js} +1 -1
- package/www/build/{p-69ef6ddc.entry.js → p-dd0efdbf.entry.js} +1 -1
- package/www/build/p-e007cd0b.entry.js +1 -0
- package/www/build/{p-0a0aee35.entry.js → p-e74b3fd9.entry.js} +1 -1
- package/{dist/web-components-library/p-d97a2db9.entry.js → www/build/p-eca4cb15.entry.js} +1 -1
- package/www/build/p-ed1cd6b1.js +1 -0
- package/www/build/p-f26251dd.entry.js +1 -0
- package/www/build/p-f61fd81e.entry.js +1 -0
- package/www/build/{p-1727c1c8.entry.js → p-f78d6123.entry.js} +1 -1
- package/www/build/p-fbfaa699.entry.js +1 -0
- package/www/build/p-fcff1237.css +812 -0
- package/www/build/{p-ba29bc12.entry.js → p-fdd91263.entry.js} +1 -1
- package/www/build/{p-fe927bf4.entry.js → p-ff4a0f6f.entry.js} +1 -1
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +6 -70
- package/dist/cjs/z-app-switcher_11.cjs.entry.js +0 -377
- package/dist/cjs/z-input_2.cjs.entry.js +0 -228
- package/dist/esm/z-app-switcher_11.entry.js +0 -363
- package/dist/esm/z-input_2.entry.js +0 -223
- package/dist/web-components-library/p-0d29d851.entry.js +0 -1
- package/dist/web-components-library/p-0e408871.entry.js +0 -1
- package/dist/web-components-library/p-0ef6c549.entry.js +0 -1
- package/dist/web-components-library/p-20d62443.entry.js +0 -1
- package/dist/web-components-library/p-562e2d52.entry.js +0 -1
- package/dist/web-components-library/p-5eacbfc7.entry.js +0 -1
- package/dist/web-components-library/p-6218514a.entry.js +0 -1
- package/dist/web-components-library/p-71accd8e.entry.js +0 -1
- package/dist/web-components-library/p-7c6d4440.entry.js +0 -1
- package/dist/web-components-library/p-9f5d707a.js +0 -1
- package/dist/web-components-library/p-a8875b97.entry.js +0 -16
- package/dist/web-components-library/p-e2431b92.entry.js +0 -1
- package/www/build/p-0d29d851.entry.js +0 -1
- package/www/build/p-0e408871.entry.js +0 -1
- package/www/build/p-0ef6c549.entry.js +0 -1
- package/www/build/p-20d62443.entry.js +0 -1
- package/www/build/p-562e2d52.entry.js +0 -1
- package/www/build/p-5eacbfc7.entry.js +0 -1
- package/www/build/p-6218514a.entry.js +0 -1
- package/www/build/p-71accd8e.entry.js +0 -1
- package/www/build/p-7614383b.js +0 -1
- package/www/build/p-7c6d4440.entry.js +0 -1
- package/www/build/p-88b56b6e.css +0 -1
- package/www/build/p-9f5d707a.js +0 -1
- package/www/build/p-a8875b97.entry.js +0 -16
- package/www/build/p-e2431b92.entry.js +0 -1
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { Component, Prop, h, Watch, Listen, Element, State, Event, } from "@stencil/core";
|
|
2
|
+
import { PopoverPositions, KeyboardKeys } from "../../beans";
|
|
3
|
+
import { getElementTree } from "../../utils/utils";
|
|
4
|
+
const documentElement = document.documentElement;
|
|
5
|
+
function getParentElement(element) {
|
|
6
|
+
if (element.parentNode.host) {
|
|
7
|
+
return element.parentNode.host;
|
|
8
|
+
}
|
|
9
|
+
return element.parentNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Find the closest scrollable parent of a node.
|
|
13
|
+
*
|
|
14
|
+
* @param {Element} element The node
|
|
15
|
+
*/
|
|
16
|
+
function findScrollableParent(element) {
|
|
17
|
+
let parent = getParentElement(element);
|
|
18
|
+
while (parent && parent !== documentElement) {
|
|
19
|
+
const { overflow, overflowX, overflowY } = window.getComputedStyle(parent);
|
|
20
|
+
if (overflow === "hidden" ||
|
|
21
|
+
overflowY === "hidden" ||
|
|
22
|
+
overflowX === "hidden") {
|
|
23
|
+
return parent;
|
|
24
|
+
}
|
|
25
|
+
if ((parent.scrollHeight > parent.clientHeight &&
|
|
26
|
+
overflow !== "visible" &&
|
|
27
|
+
overflowY !== "visible") ||
|
|
28
|
+
(parent.scrollWidth > parent.clientWidth &&
|
|
29
|
+
overflow !== "visible" &&
|
|
30
|
+
overflowX !== "visible")) {
|
|
31
|
+
return parent;
|
|
32
|
+
}
|
|
33
|
+
parent = getParentElement(parent);
|
|
34
|
+
}
|
|
35
|
+
return documentElement;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Calculate computed offset.
|
|
39
|
+
* It includes matrix transformations.
|
|
40
|
+
* @param element The target element.
|
|
41
|
+
* @param targetParentOffset The relative offset parent.
|
|
42
|
+
* @return A client rect object.
|
|
43
|
+
*/
|
|
44
|
+
function computeOffset(element, targetParentOffset) {
|
|
45
|
+
const rect = element.getBoundingClientRect();
|
|
46
|
+
const width = rect.width;
|
|
47
|
+
const height = rect.height;
|
|
48
|
+
let top = 0;
|
|
49
|
+
let left = 0;
|
|
50
|
+
let offsetParent = element;
|
|
51
|
+
while (offsetParent && offsetParent != targetParentOffset) {
|
|
52
|
+
left += offsetParent.offsetLeft;
|
|
53
|
+
// document.body sometimes has offsetTop == 0 but still has an
|
|
54
|
+
// offset because of children margins!
|
|
55
|
+
if (offsetParent === document.body) {
|
|
56
|
+
top += offsetParent.getBoundingClientRect().top + window.scrollY;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
top += offsetParent.offsetTop;
|
|
60
|
+
}
|
|
61
|
+
if (window.DOMMatrix) {
|
|
62
|
+
const style = window.getComputedStyle(offsetParent);
|
|
63
|
+
const transform = style.transform || style.webkitTransform;
|
|
64
|
+
const domMatrix = new DOMMatrix(transform);
|
|
65
|
+
if (domMatrix) {
|
|
66
|
+
left += domMatrix.m41;
|
|
67
|
+
if (offsetParent !== document.body) {
|
|
68
|
+
top += domMatrix.m42;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!offsetParent.offsetParent) {
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
offsetParent = offsetParent.offsetParent;
|
|
76
|
+
}
|
|
77
|
+
let parentWidth;
|
|
78
|
+
let parentHeight;
|
|
79
|
+
if (offsetParent === document.body) {
|
|
80
|
+
parentWidth = window.innerWidth;
|
|
81
|
+
parentHeight = window.innerHeight;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
parentWidth = offsetParent.offsetWidth;
|
|
85
|
+
parentHeight = offsetParent.offsetHeight;
|
|
86
|
+
}
|
|
87
|
+
const right = parentWidth - left - rect.width;
|
|
88
|
+
const bottom = parentHeight - top - rect.height;
|
|
89
|
+
return { top, right, bottom, left, width, height };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Popover component.
|
|
93
|
+
*
|
|
94
|
+
* @cssprop --z-popover-theme--surface - background color of the popover.
|
|
95
|
+
* @cssprop --z-popover-theme--text - foreground color of the popover.
|
|
96
|
+
* @cssprop --z-popover-shadow - shadow of the popover.
|
|
97
|
+
*/
|
|
98
|
+
export class ZPopoverDeprecated {
|
|
99
|
+
constructor() {
|
|
100
|
+
/** Popover position. */
|
|
101
|
+
this.position = PopoverPositions.AUTO;
|
|
102
|
+
/**
|
|
103
|
+
* The open state of the popover.
|
|
104
|
+
*/
|
|
105
|
+
this.open = false;
|
|
106
|
+
/**
|
|
107
|
+
* Whether to show popover's arrow.
|
|
108
|
+
*/
|
|
109
|
+
this.showArrow = false;
|
|
110
|
+
/**
|
|
111
|
+
* Whether center the popup on the main side - according to "position".
|
|
112
|
+
*/
|
|
113
|
+
this.center = false;
|
|
114
|
+
}
|
|
115
|
+
closePopoverWithKeyboard(e) {
|
|
116
|
+
if (e.key === KeyboardKeys.ESC) {
|
|
117
|
+
this.open = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
handleOutsideClick(e) {
|
|
121
|
+
const tree = getElementTree(e.target);
|
|
122
|
+
const parent = tree.find((elem) => elem.nodeName.toLowerCase() === "z-popover");
|
|
123
|
+
if (!parent) {
|
|
124
|
+
this.open = false;
|
|
125
|
+
this.positionChange.emit({ position: this.currentPosition });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
validatePosition(newValue) {
|
|
129
|
+
if (newValue &&
|
|
130
|
+
Object.values(PopoverPositions).every((position) => newValue !== position)) {
|
|
131
|
+
this.position = PopoverPositions.AUTO;
|
|
132
|
+
}
|
|
133
|
+
this.currentPosition = this.position;
|
|
134
|
+
this.positionChange.emit({ position: this.currentPosition });
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Setup popover behaviors on opening.
|
|
138
|
+
*/
|
|
139
|
+
onOpen() {
|
|
140
|
+
cancelAnimationFrame(this.animationFrameRequestId);
|
|
141
|
+
if (this.open) {
|
|
142
|
+
const setPosition = () => {
|
|
143
|
+
if (this.open) {
|
|
144
|
+
this.setPosition();
|
|
145
|
+
this.animationFrameRequestId = requestAnimationFrame(setPosition);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
setPosition();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const style = this.host.style;
|
|
152
|
+
style.removeProperty("top");
|
|
153
|
+
style.removeProperty("right");
|
|
154
|
+
style.removeProperty("bottom");
|
|
155
|
+
style.removeProperty("left");
|
|
156
|
+
style.removeProperty("max-width");
|
|
157
|
+
style.removeProperty("max-height");
|
|
158
|
+
this.currentPosition = undefined;
|
|
159
|
+
}
|
|
160
|
+
this.openChange.emit({ open: this.open });
|
|
161
|
+
}
|
|
162
|
+
disconnectedCallback() {
|
|
163
|
+
cancelAnimationFrame(this.animationFrameRequestId);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Set the position of the popover.
|
|
167
|
+
*/
|
|
168
|
+
setPosition() {
|
|
169
|
+
let element;
|
|
170
|
+
if (typeof this.bindTo === "string") {
|
|
171
|
+
element = this.host.ownerDocument.querySelector(this.bindTo);
|
|
172
|
+
}
|
|
173
|
+
else if (this.bindTo) {
|
|
174
|
+
element = this.bindTo;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
element = this.host.parentElement;
|
|
178
|
+
}
|
|
179
|
+
if (!element) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const scrollContainer = findScrollableParent(element);
|
|
183
|
+
const scrollingBoundingRect = scrollContainer.getBoundingClientRect();
|
|
184
|
+
const offsetContainer = this.host.offsetParent;
|
|
185
|
+
const relativeBoundingRect = offsetContainer
|
|
186
|
+
? computeOffset(offsetContainer, scrollContainer)
|
|
187
|
+
: { top: 0, right: 0, bottom: 0, left: 0 };
|
|
188
|
+
const boundingRect = computeOffset(element, scrollContainer);
|
|
189
|
+
const top = boundingRect.top - scrollContainer.scrollTop;
|
|
190
|
+
const bottom = scrollingBoundingRect.height -
|
|
191
|
+
(boundingRect.top + boundingRect.height) +
|
|
192
|
+
scrollContainer.scrollTop;
|
|
193
|
+
const left = boundingRect.left - scrollContainer.scrollLeft;
|
|
194
|
+
const right = scrollingBoundingRect.width -
|
|
195
|
+
(boundingRect.left + boundingRect.width) +
|
|
196
|
+
scrollContainer.scrollLeft;
|
|
197
|
+
const overflowBottom = Math.max(0, scrollingBoundingRect.top +
|
|
198
|
+
scrollingBoundingRect.height -
|
|
199
|
+
window.innerHeight);
|
|
200
|
+
const overflowRight = Math.max(0, scrollingBoundingRect.left +
|
|
201
|
+
scrollingBoundingRect.width -
|
|
202
|
+
window.innerWidth);
|
|
203
|
+
const availableTop = Math.min(top, top + scrollingBoundingRect.top);
|
|
204
|
+
const availableBottom = Math.min(bottom, bottom - overflowBottom);
|
|
205
|
+
const availableLeft = Math.min(left, left + scrollingBoundingRect.left);
|
|
206
|
+
const availableRight = Math.min(right, right - overflowRight);
|
|
207
|
+
const availableHeight = availableTop + availableBottom + boundingRect.height;
|
|
208
|
+
const availableWidth = availableLeft + availableRight + boundingRect.width;
|
|
209
|
+
let position = this.currentPosition;
|
|
210
|
+
const positions = [];
|
|
211
|
+
if (this.position === PopoverPositions.AUTO) {
|
|
212
|
+
/**
|
|
213
|
+
* The `AUTO` position tries to place the popover in the 'safest' area,
|
|
214
|
+
* where there's more space available.
|
|
215
|
+
*/
|
|
216
|
+
if (availableLeft / availableWidth > 0.6) {
|
|
217
|
+
positions.push(PopoverPositions.LEFT);
|
|
218
|
+
}
|
|
219
|
+
else if (availableLeft / availableWidth < 0.4) {
|
|
220
|
+
positions.push(PopoverPositions.RIGHT);
|
|
221
|
+
}
|
|
222
|
+
if (availableTop / availableHeight > 0.9) {
|
|
223
|
+
positions.unshift(PopoverPositions.TOP);
|
|
224
|
+
}
|
|
225
|
+
else if (availableTop / availableHeight > 0.6) {
|
|
226
|
+
positions.push(PopoverPositions.TOP);
|
|
227
|
+
}
|
|
228
|
+
else if (availableTop / availableHeight < 0.1) {
|
|
229
|
+
positions.unshift(PopoverPositions.BOTTOM);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
positions.push(PopoverPositions.BOTTOM);
|
|
233
|
+
}
|
|
234
|
+
position = positions.join("_");
|
|
235
|
+
}
|
|
236
|
+
const style = this.host.style;
|
|
237
|
+
style.position = "absolute";
|
|
238
|
+
const offsetTop = boundingRect.top - relativeBoundingRect.top;
|
|
239
|
+
const offsetRight = boundingRect.right - relativeBoundingRect.right;
|
|
240
|
+
const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;
|
|
241
|
+
const offsetLeft = boundingRect.left - relativeBoundingRect.left;
|
|
242
|
+
const offsetModifier = this.center ? 0.5 : 0;
|
|
243
|
+
const sizeModifier = this.center ? 0.5 : 0;
|
|
244
|
+
if (position === PopoverPositions.TOP ||
|
|
245
|
+
position === PopoverPositions.TOP_RIGHT) {
|
|
246
|
+
style.top = "auto";
|
|
247
|
+
style.right = "auto";
|
|
248
|
+
style.bottom = `${offsetBottom + boundingRect.height}px`;
|
|
249
|
+
style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
|
|
250
|
+
style.maxHeight = `${availableTop}px`;
|
|
251
|
+
if (position === PopoverPositions.TOP_RIGHT) {
|
|
252
|
+
style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
else if (position === PopoverPositions.TOP_LEFT) {
|
|
256
|
+
style.top = "auto";
|
|
257
|
+
style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
|
|
258
|
+
style.bottom = `${offsetBottom + boundingRect.height}px`;
|
|
259
|
+
style.left = "auto";
|
|
260
|
+
style.maxWidth = `${availableLeft}px`;
|
|
261
|
+
style.maxHeight = `${availableTop}px`;
|
|
262
|
+
}
|
|
263
|
+
else if (position === PopoverPositions.BOTTOM ||
|
|
264
|
+
position === PopoverPositions.BOTTOM_RIGHT) {
|
|
265
|
+
style.top = `${offsetTop + boundingRect.height}px`;
|
|
266
|
+
style.right = "auto";
|
|
267
|
+
style.bottom = "auto";
|
|
268
|
+
style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
|
|
269
|
+
style.maxHeight = `${availableBottom}px`;
|
|
270
|
+
if (position === PopoverPositions.BOTTOM_RIGHT) {
|
|
271
|
+
style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
else if (position === PopoverPositions.BOTTOM_LEFT) {
|
|
275
|
+
style.top = `${offsetTop + boundingRect.height}px`;
|
|
276
|
+
style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
|
|
277
|
+
style.bottom = "auto";
|
|
278
|
+
style.left = "auto";
|
|
279
|
+
style.maxWidth = `${availableLeft}px`;
|
|
280
|
+
style.maxHeight = `${availableBottom}px`;
|
|
281
|
+
}
|
|
282
|
+
else if (position === PopoverPositions.RIGHT ||
|
|
283
|
+
position === PopoverPositions.RIGHT_BOTTOM) {
|
|
284
|
+
style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
|
|
285
|
+
style.right = "auto";
|
|
286
|
+
style.bottom = "auto";
|
|
287
|
+
style.left = `${offsetLeft + boundingRect.width}px`;
|
|
288
|
+
style.maxWidth = `${availableRight}px`;
|
|
289
|
+
style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
|
|
290
|
+
}
|
|
291
|
+
else if (position === PopoverPositions.RIGHT_TOP) {
|
|
292
|
+
style.top = "auto";
|
|
293
|
+
style.right = "auto";
|
|
294
|
+
style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
|
|
295
|
+
style.left = `${offsetLeft + boundingRect.width}px`;
|
|
296
|
+
style.maxWidth = `${availableRight}px`;
|
|
297
|
+
style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
|
|
298
|
+
}
|
|
299
|
+
else if (position === PopoverPositions.LEFT ||
|
|
300
|
+
position === PopoverPositions.LEFT_BOTTOM) {
|
|
301
|
+
style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
|
|
302
|
+
style.right = `${offsetRight + boundingRect.width}px`;
|
|
303
|
+
style.bottom = "auto";
|
|
304
|
+
style.left = "auto";
|
|
305
|
+
style.maxWidth = `${availableLeft}px`;
|
|
306
|
+
style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
|
|
307
|
+
}
|
|
308
|
+
else if (position === PopoverPositions.LEFT_TOP) {
|
|
309
|
+
style.top = "auto";
|
|
310
|
+
style.right = `${offsetRight + boundingRect.width}px`;
|
|
311
|
+
style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
|
|
312
|
+
style.left = "auto";
|
|
313
|
+
style.maxWidth = `${availableLeft}px`;
|
|
314
|
+
style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
|
|
315
|
+
}
|
|
316
|
+
this.currentPosition = position || this.position;
|
|
317
|
+
this.host.setAttribute('current-position', this.currentPosition);
|
|
318
|
+
}
|
|
319
|
+
componentWillLoad() {
|
|
320
|
+
this.validatePosition(this.position);
|
|
321
|
+
this.onOpen();
|
|
322
|
+
}
|
|
323
|
+
render() {
|
|
324
|
+
return h("slot", null);
|
|
325
|
+
}
|
|
326
|
+
static get is() { return "z-popover-deprecated"; }
|
|
327
|
+
static get encapsulation() { return "shadow"; }
|
|
328
|
+
static get originalStyleUrls() { return {
|
|
329
|
+
"$": ["styles.css"]
|
|
330
|
+
}; }
|
|
331
|
+
static get styleUrls() { return {
|
|
332
|
+
"$": ["styles.css"]
|
|
333
|
+
}; }
|
|
334
|
+
static get properties() { return {
|
|
335
|
+
"position": {
|
|
336
|
+
"type": "string",
|
|
337
|
+
"mutable": true,
|
|
338
|
+
"complexType": {
|
|
339
|
+
"original": "PopoverPositions",
|
|
340
|
+
"resolved": "PopoverPositions.AUTO | PopoverPositions.BOTTOM | PopoverPositions.BOTTOM_LEFT | PopoverPositions.BOTTOM_RIGHT | PopoverPositions.LEFT | PopoverPositions.LEFT_BOTTOM | PopoverPositions.LEFT_TOP | PopoverPositions.RIGHT | PopoverPositions.RIGHT_BOTTOM | PopoverPositions.RIGHT_TOP | PopoverPositions.TOP | PopoverPositions.TOP_LEFT | PopoverPositions.TOP_RIGHT",
|
|
341
|
+
"references": {
|
|
342
|
+
"PopoverPositions": {
|
|
343
|
+
"location": "import",
|
|
344
|
+
"path": "../../beans"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"required": false,
|
|
349
|
+
"optional": false,
|
|
350
|
+
"docs": {
|
|
351
|
+
"tags": [],
|
|
352
|
+
"text": "Popover position."
|
|
353
|
+
},
|
|
354
|
+
"attribute": "position",
|
|
355
|
+
"reflect": true,
|
|
356
|
+
"defaultValue": "PopoverPositions.AUTO"
|
|
357
|
+
},
|
|
358
|
+
"open": {
|
|
359
|
+
"type": "boolean",
|
|
360
|
+
"mutable": true,
|
|
361
|
+
"complexType": {
|
|
362
|
+
"original": "boolean",
|
|
363
|
+
"resolved": "boolean",
|
|
364
|
+
"references": {}
|
|
365
|
+
},
|
|
366
|
+
"required": false,
|
|
367
|
+
"optional": false,
|
|
368
|
+
"docs": {
|
|
369
|
+
"tags": [],
|
|
370
|
+
"text": "The open state of the popover."
|
|
371
|
+
},
|
|
372
|
+
"attribute": "open",
|
|
373
|
+
"reflect": true,
|
|
374
|
+
"defaultValue": "false"
|
|
375
|
+
},
|
|
376
|
+
"bindTo": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"mutable": false,
|
|
379
|
+
"complexType": {
|
|
380
|
+
"original": "string | HTMLElement",
|
|
381
|
+
"resolved": "HTMLElement | string",
|
|
382
|
+
"references": {
|
|
383
|
+
"HTMLElement": {
|
|
384
|
+
"location": "global"
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"required": false,
|
|
389
|
+
"optional": true,
|
|
390
|
+
"docs": {
|
|
391
|
+
"tags": [],
|
|
392
|
+
"text": "The selector or the element bound with the popover."
|
|
393
|
+
},
|
|
394
|
+
"attribute": "bind-to",
|
|
395
|
+
"reflect": false
|
|
396
|
+
},
|
|
397
|
+
"showArrow": {
|
|
398
|
+
"type": "boolean",
|
|
399
|
+
"mutable": false,
|
|
400
|
+
"complexType": {
|
|
401
|
+
"original": "boolean",
|
|
402
|
+
"resolved": "boolean",
|
|
403
|
+
"references": {}
|
|
404
|
+
},
|
|
405
|
+
"required": false,
|
|
406
|
+
"optional": false,
|
|
407
|
+
"docs": {
|
|
408
|
+
"tags": [],
|
|
409
|
+
"text": "Whether to show popover's arrow."
|
|
410
|
+
},
|
|
411
|
+
"attribute": "show-arrow",
|
|
412
|
+
"reflect": true,
|
|
413
|
+
"defaultValue": "false"
|
|
414
|
+
},
|
|
415
|
+
"center": {
|
|
416
|
+
"type": "boolean",
|
|
417
|
+
"mutable": false,
|
|
418
|
+
"complexType": {
|
|
419
|
+
"original": "boolean",
|
|
420
|
+
"resolved": "boolean",
|
|
421
|
+
"references": {}
|
|
422
|
+
},
|
|
423
|
+
"required": false,
|
|
424
|
+
"optional": false,
|
|
425
|
+
"docs": {
|
|
426
|
+
"tags": [],
|
|
427
|
+
"text": "Whether center the popup on the main side - according to \"position\"."
|
|
428
|
+
},
|
|
429
|
+
"attribute": "center",
|
|
430
|
+
"reflect": true,
|
|
431
|
+
"defaultValue": "false"
|
|
432
|
+
}
|
|
433
|
+
}; }
|
|
434
|
+
static get states() { return {
|
|
435
|
+
"currentPosition": {}
|
|
436
|
+
}; }
|
|
437
|
+
static get events() { return [{
|
|
438
|
+
"method": "positionChange",
|
|
439
|
+
"name": "positionChange",
|
|
440
|
+
"bubbles": true,
|
|
441
|
+
"cancelable": true,
|
|
442
|
+
"composed": true,
|
|
443
|
+
"docs": {
|
|
444
|
+
"tags": [],
|
|
445
|
+
"text": "Position change event."
|
|
446
|
+
},
|
|
447
|
+
"complexType": {
|
|
448
|
+
"original": "any",
|
|
449
|
+
"resolved": "any",
|
|
450
|
+
"references": {}
|
|
451
|
+
}
|
|
452
|
+
}, {
|
|
453
|
+
"method": "openChange",
|
|
454
|
+
"name": "openChange",
|
|
455
|
+
"bubbles": true,
|
|
456
|
+
"cancelable": true,
|
|
457
|
+
"composed": true,
|
|
458
|
+
"docs": {
|
|
459
|
+
"tags": [],
|
|
460
|
+
"text": "Open change event."
|
|
461
|
+
},
|
|
462
|
+
"complexType": {
|
|
463
|
+
"original": "any",
|
|
464
|
+
"resolved": "any",
|
|
465
|
+
"references": {}
|
|
466
|
+
}
|
|
467
|
+
}]; }
|
|
468
|
+
static get elementRef() { return "host"; }
|
|
469
|
+
static get watchers() { return [{
|
|
470
|
+
"propName": "position",
|
|
471
|
+
"methodName": "validatePosition"
|
|
472
|
+
}, {
|
|
473
|
+
"propName": "open",
|
|
474
|
+
"methodName": "onOpen"
|
|
475
|
+
}]; }
|
|
476
|
+
static get listeners() { return [{
|
|
477
|
+
"name": "keyup",
|
|
478
|
+
"method": "closePopoverWithKeyboard",
|
|
479
|
+
"target": "window",
|
|
480
|
+
"capture": false,
|
|
481
|
+
"passive": false
|
|
482
|
+
}, {
|
|
483
|
+
"name": "click",
|
|
484
|
+
"method": "handleOutsideClick",
|
|
485
|
+
"target": "body",
|
|
486
|
+
"capture": true,
|
|
487
|
+
"passive": false
|
|
488
|
+
}]; }
|
|
489
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--z-popover-theme--surface: var(--color-surface01);
|
|
3
|
+
--z-popover-theme--text: var(--color-text01);
|
|
4
|
+
--z-popover-padding: var(--space-unit);
|
|
5
|
+
--z-popover-shadow-filter: drop-shadow(0 1px 2px var(--shadow-color-base));
|
|
6
|
+
--arrow-size: 6px;
|
|
7
|
+
--edge-offset: calc(-1 * (var(--arrow-size) + calc(var(--space-unit) * 2)));
|
|
8
|
+
|
|
9
|
+
position: relative;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
padding: var(--z-popover-padding);
|
|
14
|
+
min-width: calc(var(--space-unit) * 8);
|
|
15
|
+
min-height: calc(var(--space-unit) * 4);
|
|
16
|
+
color: var(--z-popover-theme--text);
|
|
17
|
+
fill: currentColor;
|
|
18
|
+
font-family: var(--font-family-sans);
|
|
19
|
+
text-align: center;
|
|
20
|
+
border-radius: var(--border-radius-small);
|
|
21
|
+
background: var(--z-popover-theme--surface);
|
|
22
|
+
filter: var(--z-popover-shadow-filter);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host(:not([open])),
|
|
26
|
+
:host([open="false"]) {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([center][current-position='top']),
|
|
31
|
+
:host([center][current-position='bottom']) {
|
|
32
|
+
transform: translateX(-50%);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([center][current-position='right']),
|
|
36
|
+
:host([center][current-position='left']) {
|
|
37
|
+
transform: translateY(-50%);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Arrow style */
|
|
41
|
+
|
|
42
|
+
:host([current-position])::before {
|
|
43
|
+
--arrow-edge-offset: calc(100% - var(--arrow-size) - var(--space-unit));
|
|
44
|
+
--arrow-center-x-offset: calc(50% - calc(var(--arrow-size) / 2));
|
|
45
|
+
--arrow-center-y-offset: calc(100% - calc(var(--arrow-size) / 2));
|
|
46
|
+
|
|
47
|
+
display: block;
|
|
48
|
+
content: '';
|
|
49
|
+
position: absolute;
|
|
50
|
+
width: var(--arrow-size);
|
|
51
|
+
height: var(--arrow-size);
|
|
52
|
+
background: var(--z-popover-theme--surface);
|
|
53
|
+
transform: rotate(45deg);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host([show-arrow=false])::before,
|
|
57
|
+
:host(:not([show-arrow]))::before {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([current-position^='top'])::before {
|
|
62
|
+
top: var(--arrow-center-y-offset);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([current-position^='bottom'])::before {
|
|
66
|
+
bottom: var(--arrow-center-y-offset);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:host([current-position='top'])::before,
|
|
70
|
+
:host([current-position='bottom'])::before {
|
|
71
|
+
left: var(--arrow-center-x-offset);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:host([current-position='right'])::before,
|
|
75
|
+
:host([current-position='left'])::before {
|
|
76
|
+
top: var(--arrow-center-x-offset);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([current-position='right'])::before {
|
|
80
|
+
right: var(--arrow-center-y-offset);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([current-position='left'])::before {
|
|
84
|
+
left: var(--arrow-center-y-offset);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([current-position='top_right'])::before,
|
|
88
|
+
:host([current-position='bottom_right'])::before {
|
|
89
|
+
right: calc(var(--arrow-edge-offset) + var(--arrow-size));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host([current-position='top_right']:not([center]))::before,
|
|
93
|
+
:host([current-position='bottom_right']:not([center]))::before,
|
|
94
|
+
:host([current-position='top_right'][center="false"])::before,
|
|
95
|
+
:host([current-position='bottom_right'][center="false"])::before {
|
|
96
|
+
right: calc(var(--arrow-edge-offset) - var(--arrow-size) + 1px);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([current-position='top_left'])::before,
|
|
100
|
+
:host([current-position='bottom_left'])::before {
|
|
101
|
+
left: calc(var(--arrow-edge-offset) + var(--arrow-size));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:host([current-position='top_left']:not([center]))::before,
|
|
105
|
+
:host([current-position='bottom_left']:not([center]))::before,
|
|
106
|
+
:host([current-position='top_left'][center="false"])::before,
|
|
107
|
+
:host([current-position='bottom_left'][center="false"])::before {
|
|
108
|
+
left: calc(var(--arrow-edge-offset) - var(--arrow-size) + 1px);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
:host([current-position='right_top'])::before,
|
|
112
|
+
:host([current-position='left_top'])::before {
|
|
113
|
+
bottom: var(--arrow-size);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([current-position='right_top'])::before,
|
|
117
|
+
:host([current-position='right_bottom'])::before {
|
|
118
|
+
right: var(--arrow-center-y-offset);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([current-position='left_top'])::before,
|
|
122
|
+
:host([current-position='left_bottom'])::before {
|
|
123
|
+
left: var(--arrow-center-y-offset);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:host([current-position='right_bottom'])::before,
|
|
127
|
+
:host([current-position='left_bottom'])::before {
|
|
128
|
+
top: var(--arrow-size);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
::slotted(*) {
|
|
132
|
+
flex: 1 auto;
|
|
133
|
+
overflow: auto;
|
|
134
|
+
}
|