@zanichelli/delta_share 3.0.2 → 3.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/dist/wc/cjs/{breakpoints-a55736d0.js → breakpoints-e7c8838e.js} +3 -1
- package/dist/wc/cjs/delta_share.cjs.js +1 -1
- package/dist/wc/cjs/{icons-9d7fe21e.js → icons-5006d741.js} +30 -0
- package/dist/wc/cjs/index-0119322e.js +20 -0
- package/dist/wc/cjs/index-044ebc8a.js +67 -0
- package/dist/wc/cjs/index-05a1b9dc.js +70 -0
- package/dist/wc/cjs/index-18a2a552.js +49 -0
- package/dist/wc/cjs/index-47449986.js +41 -0
- package/dist/wc/cjs/index-4a04e2aa.js +21 -0
- package/dist/wc/cjs/index-51009bcf.js +29 -0
- package/dist/wc/cjs/index-6d0848b5.js +21 -0
- package/dist/wc/cjs/index-732ae62f.js +22 -0
- package/dist/wc/cjs/index-81603b4a.js +17 -0
- package/dist/wc/cjs/index-8da01bc6.js +34 -0
- package/dist/wc/cjs/index-9886a665.js +21 -0
- package/dist/wc/cjs/index-a9a1f262.js +79 -0
- package/dist/wc/cjs/{index-1112cdb1.js → index-c0af2262.js} +43 -9
- package/dist/wc/cjs/index-db42857f.js +17 -0
- package/dist/wc/cjs/index-f4792a6f.js +21 -0
- package/dist/wc/cjs/index-f824355b.js +17 -0
- package/dist/wc/cjs/license-activation_11.cjs.entry.js +940 -52
- package/dist/wc/cjs/loader.cjs.js +1 -1
- package/dist/wc/cjs/{utils-3ac19501.js → utils-8fd01df0.js} +13 -3
- package/dist/wc/cjs/{utils-2bfaab77.js → utils-f2cac0dc.js} +1 -1
- package/dist/wc/cjs/z-accordion.cjs.entry.js +67 -0
- package/dist/wc/cjs/z-anchor-navigation.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-app-header.cjs.entry.js +91 -39
- package/dist/wc/cjs/z-aria-alert.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-avatar.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-book-card.cjs.entry.js +111 -0
- package/dist/wc/cjs/z-breadcrumb.cjs.entry.js +232 -0
- package/dist/wc/cjs/z-button-sort.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-card.cjs.entry.js +5 -18
- package/dist/wc/cjs/z-carousel.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-chip.cjs.entry.js +10 -7
- package/dist/wc/cjs/z-combobox.cjs.entry.js +11 -9
- package/dist/wc/cjs/z-contextual-menu.cjs.entry.js +5 -5
- package/dist/wc/cjs/z-cover-hero.cjs.entry.js +24 -7
- package/dist/wc/cjs/z-date-picker.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-divider.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-file-upload.cjs.entry.js +4 -4
- package/dist/wc/cjs/z-file.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-info-reveal.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-list_3.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-menu-section.cjs.entry.js +11 -3
- package/dist/wc/cjs/z-menu.cjs.entry.js +26 -14
- package/dist/wc/cjs/z-messages-pocket.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-myz-card-alert.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-myz-card-dictionary.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-myz-card-footer.cjs.entry.js +14 -2
- package/dist/wc/cjs/z-myz-card-icon.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-myz-card-info.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-myz-card_4.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-myz-list-item.cjs.entry.js +4 -4
- package/dist/wc/cjs/z-navigation-tab-link.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-navigation-tab.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-navigation-tabs.cjs.entry.js +75 -3
- package/dist/wc/cjs/z-offcanvas_2.cjs.entry.js +281 -0
- package/dist/wc/cjs/z-otp.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-pagination.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-pocket_3.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-popover.cjs.entry.js +3 -2
- package/dist/wc/cjs/z-range-picker.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-section-title.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-select.cjs.entry.js +18 -10
- package/dist/wc/cjs/z-skip-to-content.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-slideshow.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-stepper-item.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-table-body.cjs.entry.js +3 -17
- package/dist/wc/cjs/z-table-cell.cjs.entry.js +4 -29
- package/dist/wc/cjs/z-table-deprecated.cjs.entry.js +91 -0
- package/dist/wc/cjs/z-table-empty-box.cjs.entry.js +3 -24
- package/dist/wc/cjs/z-table-expanded-row.cjs.entry.js +3 -12
- package/dist/wc/cjs/z-table-footer.cjs.entry.js +3 -16
- package/dist/wc/cjs/z-table-head.cjs.entry.js +3 -16
- package/dist/wc/cjs/z-table-header-row.cjs.entry.js +3 -15
- package/dist/wc/cjs/z-table-header.cjs.entry.js +6 -75
- package/dist/wc/cjs/z-table-row.cjs.entry.js +4 -36
- package/dist/wc/cjs/z-table-sticky-footer.cjs.entry.js +3 -12
- package/dist/wc/cjs/z-table.cjs.entry.js +36 -58
- package/dist/wc/cjs/z-tbody.cjs.entry.js +10 -0
- package/dist/wc/cjs/z-td.cjs.entry.js +11 -0
- package/dist/wc/cjs/z-tfoot.cjs.entry.js +10 -0
- package/dist/wc/cjs/z-th.cjs.entry.js +11 -0
- package/dist/wc/cjs/z-thead.cjs.entry.js +10 -0
- package/dist/wc/cjs/z-toast-notification-list.cjs.entry.js +1 -1
- package/dist/wc/cjs/z-toast-notification.cjs.entry.js +2 -2
- package/dist/wc/cjs/z-toggle-button.cjs.entry.js +4 -2
- package/dist/wc/cjs/z-toggle-switch.cjs.entry.js +3 -3
- package/dist/wc/cjs/z-tooltip.cjs.entry.js +10 -4
- package/dist/wc/cjs/z-tr.cjs.entry.js +15 -0
- package/dist/wc/collection/collection-manifest.json +10 -1
- package/dist/wc/collection/components/license-activation/license-activation.js +16 -25
- package/dist/wc/collection/components/license-activation-form/license-activation-form.css +11 -12
- package/dist/wc/collection/components/license-activation-form/license-activation-form.js +1 -1
- package/dist/wc/custom-elements/index.js +2415 -640
- package/dist/wc/delta_share/delta_share.esm.js +1 -1
- package/dist/wc/delta_share/p-057858cb.entry.js +1 -0
- package/dist/wc/delta_share/p-06aacfed.entry.js +1 -0
- package/dist/wc/delta_share/{p-42dd4f36.entry.js → p-06fa5b43.entry.js} +1 -1
- package/dist/wc/delta_share/p-09fe90e6.entry.js +1 -0
- package/dist/wc/delta_share/p-0acc73cd.entry.js +1 -0
- package/dist/wc/delta_share/{p-c51ebb01.entry.js → p-0fe7f1ad.entry.js} +1 -1
- package/dist/wc/delta_share/{p-99ffd017.entry.js → p-171202cb.js} +1 -1
- package/dist/wc/delta_share/p-1b8b3092.entry.js +1 -0
- package/dist/wc/delta_share/p-1c4015c7.entry.js +1 -0
- package/dist/wc/delta_share/p-27537f0b.js +1 -0
- package/dist/wc/delta_share/p-2d1b1197.entry.js +1 -0
- package/dist/wc/delta_share/{p-a2b564ef.entry.js → p-2e12c305.entry.js} +1 -1
- package/dist/wc/delta_share/{p-3fa29874.entry.js → p-2eed13ce.entry.js} +1 -1
- package/dist/wc/delta_share/p-30b524e2.entry.js +1 -0
- package/dist/wc/delta_share/{p-81ddcb87.entry.js → p-31922918.entry.js} +1 -1
- package/dist/wc/delta_share/p-3605faee.entry.js +1 -0
- package/dist/wc/delta_share/p-3b4879bc.js +1 -0
- package/dist/wc/delta_share/p-3b7aeb99.entry.js +1 -0
- package/dist/wc/delta_share/p-3de56f4a.entry.js +1 -0
- package/dist/wc/delta_share/{p-950aa417.entry.js → p-3e66faf7.entry.js} +1 -1
- package/dist/wc/delta_share/{p-57f2b8d8.entry.js → p-46e4fe9d.entry.js} +1 -1
- package/dist/wc/delta_share/p-4bcbac62.entry.js +1 -0
- package/dist/wc/delta_share/p-5588386c.entry.js +1 -0
- package/dist/wc/delta_share/p-55924409.entry.js +1 -0
- package/dist/wc/delta_share/p-589b8717.js +1 -0
- package/dist/wc/delta_share/p-5d29a5a7.entry.js +1 -0
- package/dist/wc/delta_share/p-5f021095.js +1 -0
- package/dist/wc/delta_share/{p-b38b27f2.entry.js → p-627de5ca.entry.js} +1 -1
- package/dist/wc/delta_share/p-63f5644d.js +1 -0
- package/dist/wc/delta_share/{p-8876b438.entry.js → p-6619cb5a.entry.js} +1 -1
- package/dist/wc/delta_share/p-6776c695.entry.js +1 -0
- package/dist/wc/delta_share/{p-9ad5616e.entry.js → p-699d0efb.entry.js} +1 -1
- package/dist/wc/delta_share/p-6d1c4af9.js +1 -0
- package/dist/wc/delta_share/p-6d888c61.js +1 -0
- package/dist/wc/delta_share/{p-2f289949.entry.js → p-71af40a8.entry.js} +1 -1
- package/dist/wc/delta_share/{p-8d532866.entry.js → p-74027654.js} +1 -1
- package/dist/wc/delta_share/{p-6d853df0.entry.js → p-75b9448a.entry.js} +1 -1
- package/dist/wc/delta_share/p-776a9611.entry.js +1 -0
- package/dist/wc/delta_share/p-78b1d100.js +1 -0
- package/dist/wc/delta_share/p-7966c7e6.entry.js +1 -0
- package/dist/wc/delta_share/p-7ae04b31.entry.js +1 -0
- package/dist/wc/delta_share/{p-963999a8.entry.js → p-81a1b7cc.entry.js} +1 -1
- package/dist/wc/delta_share/p-83156f0c.entry.js +1 -0
- package/dist/wc/delta_share/{p-8825d8e4.entry.js → p-858613c0.entry.js} +1 -1
- package/dist/wc/delta_share/p-8649f025.entry.js +1 -0
- package/dist/wc/delta_share/{p-c885d25c.entry.js → p-86683a1d.entry.js} +1 -1
- package/dist/wc/delta_share/{p-7546c464.entry.js → p-86dfdccc.js} +1 -1
- package/dist/wc/delta_share/{p-d8e80ee8.entry.js → p-8b3b862c.js} +1 -1
- package/dist/wc/delta_share/p-93504934.entry.js +1 -0
- package/dist/wc/delta_share/p-967acc0e.entry.js +1 -0
- package/dist/wc/delta_share/{p-c436e1af.entry.js → p-974d6235.entry.js} +1 -1
- package/dist/wc/delta_share/{p-3cf0c6a5.entry.js → p-9c3fcef2.entry.js} +1 -1
- package/dist/wc/delta_share/{p-cb16715b.entry.js → p-9cc6b2ff.entry.js} +1 -1
- package/dist/wc/delta_share/p-9d3e6cff.entry.js +1 -0
- package/dist/wc/delta_share/p-a54c1c69.entry.js +1 -0
- package/dist/wc/delta_share/p-a6252f41.entry.js +1 -0
- package/dist/wc/delta_share/{p-c31b160e.entry.js → p-a7afd1e8.entry.js} +1 -1
- package/dist/wc/delta_share/p-ade21d10.entry.js +1 -0
- package/dist/wc/delta_share/p-b0dc0f33.entry.js +1 -0
- package/dist/wc/delta_share/p-bcac4e8a.entry.js +1 -0
- package/dist/wc/delta_share/p-bd5862be.js +1 -0
- package/dist/wc/delta_share/{p-925fc6c3.entry.js → p-bdbd52af.entry.js} +1 -1
- package/dist/wc/delta_share/p-c16ef2ed.js +1 -0
- package/dist/wc/delta_share/{p-0bb97b61.js → p-c176a537.js} +1 -1
- package/dist/wc/delta_share/p-c86f3f18.entry.js +1 -0
- package/dist/wc/delta_share/{p-1009b417.entry.js → p-ca0ad68e.entry.js} +1 -1
- package/dist/wc/delta_share/p-ce9c796f.entry.js +1 -0
- package/dist/wc/delta_share/p-cf49d91e.entry.js +1 -0
- package/dist/wc/delta_share/p-cf520177.entry.js +1 -0
- package/dist/wc/delta_share/p-cfd5d8d9.entry.js +1 -0
- package/dist/wc/delta_share/{p-45dcece4.entry.js → p-d57e2650.entry.js} +1 -1
- package/dist/wc/delta_share/p-d736e782.js +1 -0
- package/dist/wc/delta_share/p-d8592d42.js +1 -0
- package/dist/wc/delta_share/p-d85af2d2.entry.js +1 -0
- package/dist/wc/delta_share/p-d91beeb4.js +1 -0
- package/dist/wc/delta_share/{p-6c54d53f.entry.js → p-db957062.entry.js} +1 -1
- package/dist/wc/delta_share/p-df19c0b3.entry.js +3 -0
- package/dist/wc/delta_share/p-df665c83.entry.js +1 -0
- package/dist/wc/delta_share/p-e27aa743.entry.js +1 -0
- package/dist/wc/delta_share/p-e47768ad.entry.js +1 -0
- package/dist/wc/delta_share/p-e533db54.entry.js +1 -0
- package/dist/wc/delta_share/{p-0aa553ea.entry.js → p-e849b3b3.entry.js} +1 -1
- package/dist/wc/delta_share/p-e9fa5c23.js +1 -0
- package/dist/wc/delta_share/p-ecb09670.js +1 -0
- package/dist/wc/delta_share/p-f366927f.entry.js +1 -0
- package/dist/wc/delta_share/{p-badf3f24.entry.js → p-f6bd0767.js} +1 -1
- package/dist/wc/delta_share/p-f8604cd3.entry.js +1 -0
- package/dist/wc/delta_share/p-fe94390e.entry.js +1 -0
- package/dist/wc/delta_share/{p-5e503d5f.entry.js → p-fff3f7a2.entry.js} +1 -1
- package/dist/wc/esm/breakpoints-3c3dbb8c.js +5 -0
- package/dist/wc/esm/delta_share.js +1 -1
- package/dist/wc/esm/{icons-7a34b033.js → icons-5cd8a05c.js} +30 -0
- package/dist/wc/esm/index-01c34720.js +77 -0
- package/dist/wc/esm/index-23578879.js +19 -0
- package/dist/wc/esm/index-2dfebd9d.js +15 -0
- package/dist/wc/esm/index-474bdeac.js +18 -0
- package/dist/wc/esm/index-4cbd9bd5.js +19 -0
- package/dist/wc/esm/index-5ee15750.js +68 -0
- package/dist/wc/esm/{index-4f1e2705.js → index-6b9f0af9.js} +44 -10
- package/dist/wc/esm/index-7ab3efeb.js +15 -0
- package/dist/wc/esm/index-8304b962.js +65 -0
- package/dist/wc/esm/index-8c51661a.js +19 -0
- package/dist/wc/esm/index-a4bf756b.js +19 -0
- package/dist/wc/esm/index-a4c6be93.js +39 -0
- package/dist/wc/esm/index-a9ad9a02.js +47 -0
- package/dist/wc/esm/index-be1fa551.js +32 -0
- package/dist/wc/esm/index-d0687862.js +27 -0
- package/dist/wc/esm/index-eb1fc2a8.js +15 -0
- package/dist/wc/esm/index-fcff2847.js +20 -0
- package/dist/wc/esm/license-activation_11.entry.js +940 -52
- package/dist/wc/esm/loader.js +1 -1
- package/dist/wc/esm/{utils-5a24a17b.js → utils-90d51f4b.js} +13 -4
- package/dist/wc/esm/{utils-711517a4.js → utils-e64576be.js} +1 -1
- package/dist/wc/esm/z-accordion.entry.js +63 -0
- package/dist/wc/esm/z-anchor-navigation.entry.js +1 -1
- package/dist/wc/esm/z-app-header.entry.js +91 -39
- package/dist/wc/esm/z-aria-alert.entry.js +1 -1
- package/dist/wc/esm/z-avatar.entry.js +1 -1
- package/dist/wc/esm/z-book-card.entry.js +107 -0
- package/dist/wc/esm/z-breadcrumb.entry.js +228 -0
- package/dist/wc/esm/z-button-sort.entry.js +2 -2
- package/dist/wc/esm/z-card.entry.js +6 -19
- package/dist/wc/esm/z-carousel.entry.js +2 -2
- package/dist/wc/esm/z-chip.entry.js +10 -7
- package/dist/wc/esm/z-combobox.entry.js +11 -9
- package/dist/wc/esm/z-contextual-menu.entry.js +5 -5
- package/dist/wc/esm/z-cover-hero.entry.js +24 -7
- package/dist/wc/esm/z-date-picker.entry.js +2 -2
- package/dist/wc/esm/z-divider.entry.js +1 -1
- package/dist/wc/esm/z-file-upload.entry.js +4 -4
- package/dist/wc/esm/z-file.entry.js +2 -2
- package/dist/wc/esm/z-info-reveal.entry.js +1 -1
- package/dist/wc/esm/z-list_3.entry.js +2 -2
- package/dist/wc/esm/z-menu-section.entry.js +11 -3
- package/dist/wc/esm/z-menu.entry.js +26 -14
- package/dist/wc/esm/z-messages-pocket.entry.js +1 -1
- package/dist/wc/esm/z-myz-card-alert.entry.js +1 -1
- package/dist/wc/esm/z-myz-card-dictionary.entry.js +1 -1
- package/dist/wc/esm/z-myz-card-footer.entry.js +15 -3
- package/dist/wc/esm/z-myz-card-icon.entry.js +1 -1
- package/dist/wc/esm/z-myz-card-info.entry.js +3 -3
- package/dist/wc/esm/z-myz-card_4.entry.js +3 -3
- package/dist/wc/esm/z-myz-list-item.entry.js +4 -4
- package/dist/wc/esm/z-navigation-tab-link.entry.js +3 -3
- package/dist/wc/esm/z-navigation-tab.entry.js +3 -3
- package/dist/wc/esm/z-navigation-tabs.entry.js +75 -3
- package/dist/wc/esm/z-offcanvas_2.entry.js +276 -0
- package/dist/wc/esm/z-otp.entry.js +1 -1
- package/dist/wc/esm/z-pagination.entry.js +1 -1
- package/dist/wc/esm/z-pocket_3.entry.js +3 -3
- package/dist/wc/esm/z-popover.entry.js +3 -2
- package/dist/wc/esm/z-range-picker.entry.js +2 -2
- package/dist/wc/esm/z-section-title.entry.js +2 -2
- package/dist/wc/esm/z-select.entry.js +18 -10
- package/dist/wc/esm/z-skip-to-content.entry.js +3 -3
- package/dist/wc/esm/z-slideshow.entry.js +3 -3
- package/dist/wc/esm/z-stepper-item.entry.js +1 -1
- package/dist/wc/esm/z-table-body.entry.js +2 -20
- package/dist/wc/esm/z-table-cell.entry.js +3 -32
- package/dist/wc/esm/z-table-deprecated.entry.js +87 -0
- package/dist/wc/esm/z-table-empty-box.entry.js +2 -27
- package/dist/wc/esm/z-table-expanded-row.entry.js +2 -15
- package/dist/wc/esm/z-table-footer.entry.js +2 -19
- package/dist/wc/esm/z-table-head.entry.js +2 -19
- package/dist/wc/esm/z-table-header-row.entry.js +2 -18
- package/dist/wc/esm/z-table-header.entry.js +5 -78
- package/dist/wc/esm/z-table-row.entry.js +3 -39
- package/dist/wc/esm/z-table-sticky-footer.entry.js +2 -15
- package/dist/wc/esm/z-table.entry.js +37 -59
- package/dist/wc/esm/z-tbody.entry.js +2 -0
- package/dist/wc/esm/z-td.entry.js +3 -0
- package/dist/wc/esm/z-tfoot.entry.js +2 -0
- package/dist/wc/esm/z-th.entry.js +3 -0
- package/dist/wc/esm/z-thead.entry.js +2 -0
- package/dist/wc/esm/z-toast-notification-list.entry.js +1 -1
- package/dist/wc/esm/z-toast-notification.entry.js +2 -2
- package/dist/wc/esm/z-toggle-button.entry.js +4 -2
- package/dist/wc/esm/z-toggle-switch.entry.js +3 -3
- package/dist/wc/esm/z-tooltip.entry.js +10 -4
- package/dist/wc/esm/z-tr.entry.js +7 -0
- package/dist/wc/types/components/license-activation/license-activation.d.ts +1 -1
- package/package.json +1 -1
- package/dist/wc/cjs/z-app-switcher.cjs.entry.js +0 -29
- package/dist/wc/cjs/z-offcanvas.cjs.entry.js +0 -70
- package/dist/wc/cjs/z-searchbar.cjs.entry.js +0 -235
- package/dist/wc/delta_share/p-0434c900.entry.js +0 -1
- package/dist/wc/delta_share/p-063881e2.entry.js +0 -1
- package/dist/wc/delta_share/p-11cc4828.entry.js +0 -3
- package/dist/wc/delta_share/p-1c2d7c30.entry.js +0 -1
- package/dist/wc/delta_share/p-1d2cb6f9.entry.js +0 -1
- package/dist/wc/delta_share/p-23905d08.entry.js +0 -1
- package/dist/wc/delta_share/p-29310a24.entry.js +0 -1
- package/dist/wc/delta_share/p-42e9c740.entry.js +0 -1
- package/dist/wc/delta_share/p-500ff0dd.entry.js +0 -1
- package/dist/wc/delta_share/p-51431ace.js +0 -1
- package/dist/wc/delta_share/p-5530ca81.entry.js +0 -1
- package/dist/wc/delta_share/p-5d88112c.entry.js +0 -1
- package/dist/wc/delta_share/p-61264c72.entry.js +0 -1
- package/dist/wc/delta_share/p-64decd7d.entry.js +0 -1
- package/dist/wc/delta_share/p-65be6de6.entry.js +0 -1
- package/dist/wc/delta_share/p-6cb8def6.entry.js +0 -1
- package/dist/wc/delta_share/p-702dd7b4.entry.js +0 -1
- package/dist/wc/delta_share/p-74b71f61.entry.js +0 -1
- package/dist/wc/delta_share/p-78d71789.js +0 -1
- package/dist/wc/delta_share/p-7ae0c21f.js +0 -1
- package/dist/wc/delta_share/p-8794c0c7.entry.js +0 -1
- package/dist/wc/delta_share/p-8cc7c2c7.entry.js +0 -1
- package/dist/wc/delta_share/p-8d91a5b7.entry.js +0 -1
- package/dist/wc/delta_share/p-90fdd23f.entry.js +0 -1
- package/dist/wc/delta_share/p-a150a778.entry.js +0 -1
- package/dist/wc/delta_share/p-afb5bfe5.entry.js +0 -1
- package/dist/wc/delta_share/p-b16fd965.entry.js +0 -1
- package/dist/wc/delta_share/p-c229c90e.entry.js +0 -1
- package/dist/wc/delta_share/p-c9df8e5d.entry.js +0 -1
- package/dist/wc/delta_share/p-cf58d833.js +0 -1
- package/dist/wc/delta_share/p-d69c3b08.entry.js +0 -1
- package/dist/wc/delta_share/p-ddab353c.entry.js +0 -1
- package/dist/wc/delta_share/p-ea6c67f2.entry.js +0 -1
- package/dist/wc/delta_share/p-fc49c455.entry.js +0 -1
- package/dist/wc/esm/breakpoints-e07f80e7.js +0 -4
- package/dist/wc/esm/z-app-switcher.entry.js +0 -25
- package/dist/wc/esm/z-offcanvas.entry.js +0 -66
- package/dist/wc/esm/z-searchbar.entry.js +0 -231
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { g as getRenderingRef, f as forceUpdate, r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-b3a91e19.js';
|
|
2
2
|
import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-9943807e.js';
|
|
3
|
-
import { B as ButtonVariant, a as ButtonType,
|
|
4
|
-
import { I as ICONS } from './icons-
|
|
5
|
-
import { r as randomId, b as boolean } from './utils-
|
|
6
|
-
import './breakpoints-
|
|
3
|
+
import { B as ButtonVariant, a as ButtonType, C as ControlSize, L as LabelPosition, I as InputType, K as KeyboardCode } from './index-6b9f0af9.js';
|
|
4
|
+
import { I as ICONS } from './icons-5cd8a05c.js';
|
|
5
|
+
import { r as randomId, b as boolean } from './utils-90d51f4b.js';
|
|
6
|
+
import './breakpoints-3c3dbb8c.js';
|
|
7
7
|
|
|
8
8
|
var DeviceEnum;
|
|
9
9
|
(function (DeviceEnum) {
|
|
@@ -65,10 +65,10 @@ const debounce = (fn, ms) => {
|
|
|
65
65
|
*
|
|
66
66
|
* Better leak in Edge than to be useless.
|
|
67
67
|
*/
|
|
68
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
68
|
+
const isConnected$1 = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
69
69
|
const cleanupElements = debounce((map) => {
|
|
70
70
|
for (let key of map.keys()) {
|
|
71
|
-
map.set(key, map.get(key).filter(isConnected));
|
|
71
|
+
map.set(key, map.get(key).filter(isConnected$1));
|
|
72
72
|
}
|
|
73
73
|
}, 2000);
|
|
74
74
|
const stencilSubscription = ({ on }) => {
|
|
@@ -1788,7 +1788,7 @@ const LicenseActivation = class {
|
|
|
1788
1788
|
const url = `${this.environment.API_V3_URL}/licenses/real`;
|
|
1789
1789
|
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationApiLoading: true });
|
|
1790
1790
|
const requestOpt = {
|
|
1791
|
-
credentials: "include"
|
|
1791
|
+
credentials: "include",
|
|
1792
1792
|
};
|
|
1793
1793
|
const sampleCodeError = state.cms["newdashboard.licenseActivation.error.sampleCodeMessage"];
|
|
1794
1794
|
// INFO: controllo che il codice inserito non sia quello di esempio
|
|
@@ -1846,19 +1846,23 @@ const LicenseActivation = class {
|
|
|
1846
1846
|
renderLicenseActivationModal() {
|
|
1847
1847
|
return (h("license-activation-modal", { id: `${this.host.id}-modal`, "modal-title": this.cms["newdashboard.licenseActivation.modalTitle"], onActivationModalClose: () => this.handleLicenseModalClose(), resetStore: this.resetStore }, this.renderLicenseActivationForm(LicenseActivationVariantEnum.modal)));
|
|
1848
1848
|
}
|
|
1849
|
-
retrieveTextsObject() {
|
|
1850
|
-
const { inputMessage, inputLabel, inputPlaceholder, buttonLabel,
|
|
1849
|
+
retrieveTextsObject(variant) {
|
|
1850
|
+
const { inputMessage, inputLabel, inputPlaceholder, buttonLabel, additionalDescription, buttonIcon, previewInputPlaceholder, previewButtonLabel, previewButtonIcon, previewButtonSize, } = this;
|
|
1851
1851
|
const { licenseActivationStatus } = this.licenseActivationState;
|
|
1852
|
+
let description = null, defaultInputMessage = null;
|
|
1853
|
+
if (variant === LicenseActivationVariantEnum.modal) {
|
|
1854
|
+
description = additionalDescription || this.cms["newdashboard.licenseActivation.additionalDescription"];
|
|
1855
|
+
}
|
|
1856
|
+
else {
|
|
1857
|
+
defaultInputMessage = this.cms["newdashboard.licenseActivation.inputHelperMessage"];
|
|
1858
|
+
}
|
|
1852
1859
|
return {
|
|
1853
1860
|
inputStatus: this.mapInputStatus(licenseActivationStatus),
|
|
1854
|
-
inputMessage: inputMessage ||
|
|
1855
|
-
this.cms["newdashboard.licenseActivation.inputHelperMessage"],
|
|
1861
|
+
inputMessage: inputMessage || defaultInputMessage,
|
|
1856
1862
|
placeholder: inputPlaceholder ||
|
|
1857
1863
|
this.cms["newdashboard.licenseActivation.inputPlaceholder"],
|
|
1858
1864
|
inputLabel: inputLabel || this.cms["newdashboard.licenseActivation.inputLabel"],
|
|
1859
|
-
buttonLabel:
|
|
1860
|
-
? buttonLabel || this.cms["newdashboard.licenseActivation.submitLabel"]
|
|
1861
|
-
: this.cms["newdashboard.onboarding.licenseActivation.submitLabel"],
|
|
1865
|
+
buttonLabel: buttonLabel || this.cms["newdashboard.onboarding.licenseActivation.submitLabel"],
|
|
1862
1866
|
buttonIcon,
|
|
1863
1867
|
previewInputPlaceholder,
|
|
1864
1868
|
previewButtonLabel,
|
|
@@ -1870,33 +1874,22 @@ const LicenseActivation = class {
|
|
|
1870
1874
|
infoBoxIcon: `${this.environment.URL_S3_IMAGES_FOLDER}bollinoSIAE.svg`,
|
|
1871
1875
|
infoBoxContent: this.cms["newdashboard.licenseActivation.infoBoxContent"],
|
|
1872
1876
|
supportLink: this.cms["newdashboard.licenseActivation.contactUs.url"],
|
|
1873
|
-
additionalDescription:
|
|
1874
|
-
additionalDescription,
|
|
1877
|
+
additionalDescription: description
|
|
1875
1878
|
};
|
|
1876
1879
|
}
|
|
1877
1880
|
renderLicenseActivationForm(variant) {
|
|
1878
1881
|
const { componentid } = this;
|
|
1879
1882
|
const { licenseActivationState: { licenseActivationMessage, licenseActivationCode, licenseActivationApiLoading, }, } = this;
|
|
1880
|
-
const textObject = this.retrieveTextsObject();
|
|
1883
|
+
const textObject = this.retrieveTextsObject(variant);
|
|
1881
1884
|
return (h("license-activation-form", { direction: "column", error: licenseActivationMessage, initialCode: licenseActivationCode, formTexts: textObject, requestLoading: !!licenseActivationApiLoading, enableButton: this.enableFormSubmitButton, formid: componentid, initialShowInfoBox: this.initialShowInfoBox, onFormInputChange: (e) => this.handleFormInputChange(e.detail.value), onSubmitButtonClick: (e) => this.handleSubmitButtonClick(e.detail.value), variant: variant, handleModalOpen: () => this.handleLicenseModalOpen(true) }));
|
|
1882
1885
|
}
|
|
1883
1886
|
renderMobileButton() {
|
|
1884
1887
|
return (h("z-button", { onClick: () => this.handleMobileButtonClick() }, this.cms["newdashboard.onboarding.licenseActivation.mobileSubmitLabel"]));
|
|
1885
1888
|
}
|
|
1886
1889
|
render() {
|
|
1887
|
-
|
|
1888
|
-
this.variant !== LicenseActivationVariantEnum.preview) {
|
|
1889
|
-
return (h(Host, null, this.forceModal
|
|
1890
|
-
? this.renderLicenseActivationModal()
|
|
1891
|
-
: this.renderMobileButton(), this.variant === LicenseActivationVariantEnum.box &&
|
|
1892
|
-
this.modalState === "open" &&
|
|
1893
|
-
this.renderLicenseActivationModal()));
|
|
1894
|
-
}
|
|
1895
|
-
return (h(Host, null, this.variant === LicenseActivationVariantEnum.box ||
|
|
1896
|
-
this.variant === LicenseActivationVariantEnum.preview
|
|
1890
|
+
return (h(Host, null, this.variant !== LicenseActivationVariantEnum.modal
|
|
1897
1891
|
? this.renderLicenseActivationBox(this.variant)
|
|
1898
|
-
: this.modalState === "open" && this.renderLicenseActivationModal(),
|
|
1899
|
-
this.variant === LicenseActivationVariantEnum.preview) &&
|
|
1892
|
+
: this.modalState === "open" && this.renderLicenseActivationModal(), this.variant !== LicenseActivationVariantEnum.modal &&
|
|
1900
1893
|
this.modalState === "open" &&
|
|
1901
1894
|
this.submitClicked &&
|
|
1902
1895
|
this.renderLicenseActivationModal()));
|
|
@@ -1933,7 +1926,7 @@ const LicenseActivationBox = class {
|
|
|
1933
1926
|
};
|
|
1934
1927
|
LicenseActivationBox.style = licenseActivationBoxCss;
|
|
1935
1928
|
|
|
1936
|
-
const licenseActivationFormCss = ".sc-license-activation-form-h{display:block
|
|
1929
|
+
const licenseActivationFormCss = ".sc-license-activation-form-h{display:block}.sc-license-activation-form-h>div.sc-license-activation-form>.body-3.sc-license-activation-form{display:block;margin-bottom:calc(var(--space-unit) * 4)}.sc-license-activation-form-h>div.sc-license-activation-form>z-button.sc-license-activation-form{padding:calc(var(--space-unit) * 2) 0;width:100%}.sc-license-activation-form-h>div.sc-license-activation-form>z-input.sc-license-activation-form{width:100%}.sc-license-activation-form-h>z-link.sc-license-activation-form{font-weight:bold}.sc-license-activation-form-h>div.sc-license-activation-form>z-info-box.sc-license-activation-form>div.sc-license-activation-form{display:flex}[variant=\"modal\"].sc-license-activation-form-h{padding:calc(var(--space-unit) * 2)}[variant=\"modal\"].sc-license-activation-form-h .error-section.sc-license-activation-form{display:flex;flex-direction:column;border-top:var(--border-size-small) solid var(--color-surface03);margin-top:calc(var(--space-unit) * 3);padding-top:calc(var(--space-unit) * 2)}[variant=\"modal\"].sc-license-activation-form-h .error-section.sc-license-activation-form>span.sc-license-activation-form{padding:calc(var(--space-unit) * 2) 0;display:block;color:var(--color-text01);fill:var(--color-text01);font-family:var(--dashboard-font);font-weight:var(--font-sb);font-size:14px;line-height:20px}[variant=\"preview\"].sc-license-activation-form-h{margin:0;padding:0}[variant=\"preview\"].sc-license-activation-form-h>div.sc-license-activation-form>z-button.sc-license-activation-form{margin:0;padding:0;width:initial}[variant=\"preview\"].sc-license-activation-form-h .license-input-container.sc-license-activation-form{width:100%;margin-right:calc(var(--space-unit) * 2)}.sc-license-activation-form-h .license-input-container.sc-license-activation-form>z-input.sc-license-activation-form{width:100%}@media only screen and (min-width: 768px){[variant=\"modal\"].sc-license-activation-form-h{padding:calc(var(--space-unit) * 3);width:396px}.sc-license-activation-form-h>div.sc-license-activation-form{display:flex;flex-direction:row}[variant=\"modal\"].sc-license-activation-form-h>div.sc-license-activation-form{flex-direction:column}.sc-license-activation-form-h>div.sc-license-activation-form>z-button.sc-license-activation-form{padding-top:calc(var(--space-unit) * 3);padding-left:calc(var(--space-unit) * 2);width:auto}[variant=\"preview\"].sc-license-activation-form-h>div.sc-license-activation-form>z-button.sc-license-activation-form{padding-top:0}[variant=\"modal\"].sc-license-activation-form-h>div.sc-license-activation-form>z-button.sc-license-activation-form{padding:calc(var(--space-unit) * 3) 0 calc(var(--space-unit) * 2);width:max-content}[variant=\"modal\"].sc-license-activation-form-h .error-section.sc-license-activation-form>z-button.sc-license-activation-form{width:max-content}}@media only screen and (min-width: 1152px){.sc-license-activation-form-h>div.sc-license-activation-form{flex-direction:row}}@media only screen and (min-width: 1366px){[variant=\"modal\"].sc-license-activation-form-h{padding:calc(var(--space-unit) * 4);width:477px}}";
|
|
1937
1930
|
|
|
1938
1931
|
const LicenseActivationForm = class {
|
|
1939
1932
|
constructor(hostRef) {
|
|
@@ -2016,7 +2009,7 @@ const LicenseActivationForm = class {
|
|
|
2016
2009
|
const { additionalDescription } = this.formTexts;
|
|
2017
2010
|
if (!additionalDescription)
|
|
2018
2011
|
return;
|
|
2019
|
-
return h("span", { class: "body-3"
|
|
2012
|
+
return h("span", { class: "body-3", innerHTML: manageMarkupContent(additionalDescription) });
|
|
2020
2013
|
}
|
|
2021
2014
|
renderInfoLink() {
|
|
2022
2015
|
const { linkLabel } = this.formTexts;
|
|
@@ -2121,7 +2114,7 @@ const ZButton = class {
|
|
|
2121
2114
|
/** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
|
|
2122
2115
|
this.variant = ButtonVariant.PRIMARY;
|
|
2123
2116
|
/** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
|
|
2124
|
-
this.size =
|
|
2117
|
+
this.size = ControlSize.BIG;
|
|
2125
2118
|
}
|
|
2126
2119
|
getAttributes() {
|
|
2127
2120
|
return {
|
|
@@ -2178,7 +2171,7 @@ const ZInfoBox = class {
|
|
|
2178
2171
|
};
|
|
2179
2172
|
ZInfoBox.style = stylesCss$4;
|
|
2180
2173
|
|
|
2181
|
-
const stylesCss$3 = ".sc-z-input-h{display:inline-block;width:inherit}input.sc-z-input::-ms-clear,input.sc-z-input::-ms-reveal{display:none}.sc-z-input-h input.sc-z-input::-ms-clear,.sc-z-input-h input.sc-z-input::-ms-reveal{display:none}input.sc-z-input,textarea.sc-z-input,.textarea-wrapper.sc-z-input{box-sizing:border-box;border:var(--border-size-small) solid var(--color-surface04);background:var(--color-input-field01);border-radius:var(--border-radius-small);color:var(--color-text01);fill:var(--color-icon02);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg);outline:none}.cursor-select.sc-z-input-h input.sc-z-input{cursor:pointer}.sc-z-input-h:not(.active-select) input.sc-z-input:focus:focus-visible,.textarea-wrapper.sc-z-input:focus-within{box-shadow:var(--shadow-focus-primary)}input.sc-z-input:focus:focus-visible,textarea.sc-z-input:focus:focus-visible{color:var(--color-primary02)}.active-select.sc-z-input-h input.sc-z-input{border:var(--border-size-small) solid var(--blue500)}.cursor-select.sc-z-input-h input.sc-z-input:focus:focus-visible{box-shadow:var(--shadow-focus-primary)}.sc-z-input-h input[readonly].sc-z-input:focus:focus-visible{box-shadow:none;pointer-events:none}.filled.sc-z-input{border-color:var(--color-surface05)}.input-success.sc-z-input{border-color:var(--color-success01);background:var(--color-success-inverse);fill:var(--color-success01)}.input-error.sc-z-input{border-color:var(--color-error01);background:var(--color-error-inverse);fill:var(--color-error01)}.input-warning.sc-z-input{border-color:var(--color-warning01);background:var(--color-warning-inverse);fill:var(--color-warning01)}input.sc-z-input:hover,.textarea-wrapper.sc-z-input:hover{outline:var(--border-size-medium) solid var(--color-surface04);outline-offset:-2px}.sc-z-input-h:not(.active-select) input[readonly].sc-z-input,.readonly.sc-z-input{border-color:var(--color-disabled01);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) .textarea-wrapper.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) z-icon.sc-z-input{border-color:var(--color-disabled01);box-shadow:none;color:var(--color-disabled02);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input:hover{border-width:var(--border-size-small)}input.sc-z-input::placeholder,textarea.sc-z-input::placeholder{color:var(--color-text05)}.sc-z-input::-webkit-textarea-placeholder{color:var(--color-text05)}.sc-z-input:-ms-textarea-placeholder{color:var(--color-text05)}.sc-z-input::placeholder{color:var(--color-text05)}label.input-label.sc-z-input{display:block;padding-bottom:var(--space-unit);color:var(--color-text02);font-family:var(--font-family-sans);font-size:var(--font-size-1);font-weight:var(--font-sb);text-align:left;text-transform:uppercase}[disabled].sc-z-input-h:not([disabled=\"false\"]) label.input-label.sc-z-input{color:var(--color-disabled02)}.text-wrapper.sc-z-input>div.sc-z-input{position:relative;z-index:1;fill:var(--color-icon02)}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{width:100%;height:calc(var(--space-unit) * 5.5);box-sizing:border-box;padding:0 calc(var(--space-unit) * 1.5);margin:0}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.sc-z-input,.text-wrapper.sc-z-input>div.sc-z-input>input.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 5.25)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 8)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input{position:absolute;z-index:2;top:50%;right:calc(var(--space-unit) * 1.5);display:flex;pointer-events:none;transform:translateY(-50%)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input{padding:0;border:0;background:none;color:inherit;font:inherit;pointer-events:initial}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input+button.icon-button.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.reset-icon.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.toggle-password-icon.sc-z-input{cursor:pointer}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.sc-z-input{--z-icon-width:18px;--z-icon-height:18px;display:block}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:hover,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:focus,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:active{background:var(--color-white) !important;background-clip:text !important;-webkit-transition-delay:99999s !important}.textarea-wrapper.sc-z-input{padding:calc(var(--space-unit) * 1.5);scrollbar-color:var(--color-primary01) transparent}textarea.sc-z-input::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-track{background-color:transparent}textarea.sc-z-input::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}textarea.sc-z-input{width:100%;min-height:132px;padding:0;border:none;margin:0;resize:none}.radio-wrapper.sc-z-input,.checkbox-wrapper.sc-z-input{position:relative;display:inline-flex;flex-direction:row;align-items:center;color:var(--color-text01);fill:var(--color-primary01);font-family:var(--font-family-sans)}.radio-wrapper.sc-z-input:hover,.checkbox-wrapper.sc-z-input:hover{color:var(--color-hover-primary);fill:currentcolor}.radio-wrapper.sc-z-input>input.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input{position:absolute;z-index:-1;opacity:0;pointer-events:none}.radio-wrapper.sc-z-input .radio-label.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{display:inline-flex;align-items:center;margin:0;color:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:1;text-transform:inherit}.radio-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.checkbox-label.sc-z-input{cursor:pointer}.radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{cursor:pointer;fill:inherit}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input{flex-direction:row}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input{flex-direction:row-reverse}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:var(--space-unit)}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:var(--space-unit)}.radio-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.checkbox-label.sc-z-input>z-icon.sc-z-input{border-radius:var(--border-radius-small);box-shadow:var(--shadow-focus-primary)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input{color:var(--color-disabled02)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input>z-icon.sc-z-input{cursor:default;fill:var(--color-disabled01)}";
|
|
2174
|
+
const stylesCss$3 = ".sc-z-input-h{display:inline-block;width:inherit}input.sc-z-input::-ms-clear,input.sc-z-input::-ms-reveal{display:none}.sc-z-input-h input.sc-z-input::-ms-clear,.sc-z-input-h input.sc-z-input::-ms-reveal{display:none}input.sc-z-input,textarea.sc-z-input,.textarea-wrapper.sc-z-input{box-sizing:border-box;border:var(--border-size-small) solid var(--color-surface04);background:var(--color-input-field01);border-radius:var(--border-radius-small);color:var(--color-text01);fill:var(--color-icon02);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg);outline:none}[size=\"small\"].sc-z-input-h input.sc-z-input,[size=\"small\"].sc-z-input-h textarea.sc-z-input,[size=\"small\"].sc-z-input-h .textarea-wrapper.sc-z-input,[size=\"x-small\"].sc-z-input-h input.sc-z-input,[size=\"x-small\"].sc-z-input-h textarea.sc-z-input,[size=\"x-small\"].sc-z-input-h .textarea-wrapper.sc-z-input{font-size:var(--font-size-2)}.cursor-select.sc-z-input-h input.sc-z-input{cursor:pointer}.sc-z-input-h:not(.active-select) input.sc-z-input:focus:focus-visible,.textarea-wrapper.sc-z-input:focus-within{box-shadow:var(--shadow-focus-primary)}input.sc-z-input:focus:focus-visible,textarea.sc-z-input:focus:focus-visible{color:var(--color-primary02)}.active-select.sc-z-input-h input.sc-z-input{border:var(--border-size-small) solid var(--blue500)}.cursor-select.sc-z-input-h input.sc-z-input:focus:focus-visible{box-shadow:var(--shadow-focus-primary)}.sc-z-input-h input[readonly].sc-z-input:focus:focus-visible{box-shadow:none}.filled.sc-z-input{border-color:var(--color-surface05)}.input-success.sc-z-input{border-color:var(--color-success01);background:var(--color-success-inverse);fill:var(--color-success01)}.input-error.sc-z-input{border-color:var(--color-error01);background:var(--color-error-inverse);fill:var(--color-error01)}.input-warning.sc-z-input{border-color:var(--color-warning01);background:var(--color-warning-inverse);fill:var(--color-warning01)}input.sc-z-input:hover,.textarea-wrapper.sc-z-input:hover{outline:var(--border-size-medium) solid var(--color-surface04);outline-offset:-2px}.sc-z-input-h:not(.active-select) input[readonly].sc-z-input,.readonly.sc-z-input{border-color:var(--color-disabled01);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) .textarea-wrapper.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) z-icon.sc-z-input{border-color:var(--color-disabled01);box-shadow:none;color:var(--color-disabled02);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input:hover{border-width:var(--border-size-small)}input.sc-z-input::placeholder,textarea.sc-z-input::placeholder{color:var(--color-text05)}.sc-z-input::-webkit-textarea-placeholder{color:var(--color-text05)}.sc-z-input:-ms-textarea-placeholder{color:var(--color-text05)}.sc-z-input::placeholder{color:var(--color-text05)}label.input-label.sc-z-input{display:block;padding-bottom:var(--space-unit);color:var(--color-text02);font-family:var(--font-family-sans);font-size:var(--font-size-1);font-weight:var(--font-sb);text-align:left;text-transform:uppercase}[disabled].sc-z-input-h:not([disabled=\"false\"]) label.input-label.sc-z-input{color:var(--color-disabled02)}.text-wrapper.sc-z-input>div.sc-z-input{position:relative;z-index:1;fill:var(--color-icon02)}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{width:100%;height:calc(var(--space-unit) * 5.5);box-sizing:border-box;padding:0 calc(var(--space-unit) * 1.5);margin:0}[size=\"small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4.5)}[size=\"x-small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.sc-z-input,.text-wrapper.sc-z-input>div.sc-z-input>input.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 5.25)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 8)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input{position:absolute;z-index:2;top:50%;right:calc(var(--space-unit) * 1.5);display:flex;pointer-events:none;transform:translateY(-50%)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input{padding:0;border:0;background:none;color:inherit;font:inherit;pointer-events:initial}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input+button.icon-button.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.hidden.sc-z-input{display:none}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.reset-icon.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.toggle-password-icon.sc-z-input{cursor:pointer}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.sc-z-input{--z-icon-width:18px;--z-icon-height:18px;display:block}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.small.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.x-small.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:hover,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:focus,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:active{background:var(--color-white) !important;background-clip:text !important;-webkit-transition-delay:99999s !important}.textarea-wrapper.sc-z-input{padding:calc(var(--space-unit) * 1.5);scrollbar-color:var(--color-primary01) transparent}textarea.sc-z-input::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-track{background-color:transparent}textarea.sc-z-input::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}textarea.sc-z-input{width:100%;min-height:132px;padding:0;border:none;margin:0;resize:none}.radio-wrapper.sc-z-input,.checkbox-wrapper.sc-z-input{position:relative;display:inline-flex;flex-direction:row;align-items:center;color:var(--color-text01);fill:var(--color-primary01);font-family:var(--font-family-sans)}.radio-wrapper.sc-z-input:hover,.checkbox-wrapper.sc-z-input:hover{color:var(--color-hover-primary);fill:currentcolor}.radio-wrapper.sc-z-input>input.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input{position:absolute;z-index:-1;opacity:0;pointer-events:none}.radio-wrapper.sc-z-input .radio-label.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{display:inline-flex;align-items:center;margin:0;color:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:1;text-transform:inherit}.radio-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.checkbox-label.sc-z-input{cursor:pointer}.radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{cursor:pointer;fill:inherit}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-2)}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:14px;--z-icon-height:14px}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-1)}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input{flex-direction:row}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input{flex-direction:row-reverse}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:var(--space-unit)}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:var(--space-unit)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:calc(var(--space-unit) * 0.5)}.radio-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.checkbox-label.sc-z-input>z-icon.sc-z-input{border-radius:var(--border-radius-small);box-shadow:var(--shadow-focus-primary)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input{color:var(--color-disabled02)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input>z-icon.sc-z-input{cursor:default;fill:var(--color-disabled01)}";
|
|
2182
2175
|
|
|
2183
2176
|
const ZInput = class {
|
|
2184
2177
|
constructor(hostRef) {
|
|
@@ -2205,6 +2198,8 @@ const ZInput = class {
|
|
|
2205
2198
|
this.labelPosition = LabelPosition.RIGHT;
|
|
2206
2199
|
/** render clear icon when typing (optional): available for text */
|
|
2207
2200
|
this.hasclearicon = true;
|
|
2201
|
+
/** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
|
|
2202
|
+
this.size = ControlSize.BIG;
|
|
2208
2203
|
this.isTyping = false;
|
|
2209
2204
|
this.passwordHidden = true;
|
|
2210
2205
|
this.typingtimeout = 300;
|
|
@@ -2324,7 +2319,7 @@ const ZInput = class {
|
|
|
2324
2319
|
if (this.hasclearicon && type != InputType.NUMBER) {
|
|
2325
2320
|
Object.assign(attr.class, { "has-clear-icon": true });
|
|
2326
2321
|
}
|
|
2327
|
-
return (h("div", { class: "text-wrapper" }, this.renderLabel(), h("div", null, h("input", Object.assign({ type: type === InputType.PASSWORD && !this.passwordHidden ? InputType.TEXT : type }, attr)), this.renderIcons()), this.renderMessage()));
|
|
2322
|
+
return (h("div", { class: "text-wrapper" }, this.renderLabel(), h("div", null, h("input", Object.assign({ type: type === InputType.PASSWORD && !this.passwordHidden ? InputType.TEXT : type }, attr, { ref: (el) => (this.inputRef = el) })), this.renderIcons()), this.renderMessage()));
|
|
2328
2323
|
}
|
|
2329
2324
|
renderLabel() {
|
|
2330
2325
|
if (!this.label) {
|
|
@@ -2342,22 +2337,26 @@ const ZInput = class {
|
|
|
2342
2337
|
if (!this.icon) {
|
|
2343
2338
|
return;
|
|
2344
2339
|
}
|
|
2345
|
-
return (h("button", { type: "button", class: "icon-button input-icon", tabIndex: -1 }, h("z-icon", { name: this.icon })));
|
|
2340
|
+
return (h("button", { type: "button", class: "icon-button input-icon", tabIndex: -1 }, h("z-icon", { name: this.icon, class: this.size })));
|
|
2346
2341
|
}
|
|
2347
2342
|
renderResetIcon() {
|
|
2343
|
+
let hidden = false;
|
|
2348
2344
|
if (!this.hasclearicon || !this.value || this.disabled || this.readonly || this.type == InputType.NUMBER) {
|
|
2349
|
-
|
|
2345
|
+
hidden = true;
|
|
2350
2346
|
}
|
|
2351
|
-
return (h("button", { type: "button", class:
|
|
2347
|
+
return (h("button", { type: "button", class: `icon-button reset-icon ${hidden ? "hidden" : ""}`, "aria-label": "cancella il contenuto dell'input", onClick: () => {
|
|
2348
|
+
this.inputRef.value = "";
|
|
2349
|
+
this.emitInputChange("");
|
|
2350
|
+
} }, h("z-icon", { name: "multiply", class: this.size })));
|
|
2352
2351
|
}
|
|
2353
2352
|
renderShowHidePassword() {
|
|
2354
|
-
return (h("button", { type: "button", class: "icon-button toggle-password-icon", disabled: this.disabled, "aria-label": this.passwordHidden ? "mostra password" : "nascondi password", onClick: () => (this.passwordHidden = !this.passwordHidden) }, h("z-icon", { name: this.passwordHidden ? "view-filled" : "view-off-filled" })));
|
|
2353
|
+
return (h("button", { type: "button", class: "icon-button toggle-password-icon", disabled: this.disabled, "aria-label": this.passwordHidden ? "mostra password" : "nascondi password", onClick: () => (this.passwordHidden = !this.passwordHidden) }, h("z-icon", { name: this.passwordHidden ? "view-filled" : "view-off-filled", class: this.size })));
|
|
2355
2354
|
}
|
|
2356
2355
|
renderMessage() {
|
|
2357
2356
|
if (boolean(this.message) === false) {
|
|
2358
2357
|
return;
|
|
2359
2358
|
}
|
|
2360
|
-
return (h("z-input-message", { message: boolean(this.message) === true ? undefined : this.message, status: this.status }));
|
|
2359
|
+
return (h("z-input-message", { message: boolean(this.message) === true ? undefined : this.message, status: this.status, class: this.size }));
|
|
2361
2360
|
}
|
|
2362
2361
|
/* END text/password/email/number */
|
|
2363
2362
|
/* START textarea */
|
|
@@ -2377,7 +2376,7 @@ const ZInput = class {
|
|
|
2377
2376
|
"checkbox-label": true,
|
|
2378
2377
|
"after": this.labelPosition === LabelPosition.RIGHT,
|
|
2379
2378
|
"before": this.labelPosition === LabelPosition.LEFT,
|
|
2380
|
-
} }, h("z-icon", { name: this.checked ? "checkbox-checked" : "checkbox", "aria-hidden": "true" }), this.label && h("span", { innerHTML: this.label }))));
|
|
2379
|
+
} }, h("z-icon", { name: this.checked ? "checkbox-checked" : "checkbox", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
|
|
2381
2380
|
}
|
|
2382
2381
|
/* END checkbox */
|
|
2383
2382
|
/* START radio */
|
|
@@ -2386,26 +2385,31 @@ const ZInput = class {
|
|
|
2386
2385
|
"radio-label": true,
|
|
2387
2386
|
"after": this.labelPosition === LabelPosition.RIGHT,
|
|
2388
2387
|
"before": this.labelPosition === LabelPosition.LEFT,
|
|
2389
|
-
} }, h("z-icon", { name: this.checked ? "radio-button-checked" : "radio-button", "aria-hidden": "true" }), this.label && h("span", { innerHTML: this.label }))));
|
|
2388
|
+
} }, h("z-icon", { name: this.checked ? "radio-button-checked" : "radio-button", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
|
|
2390
2389
|
}
|
|
2391
2390
|
/* END radio */
|
|
2392
2391
|
render() {
|
|
2392
|
+
let input;
|
|
2393
2393
|
switch (this.type) {
|
|
2394
2394
|
case InputType.TEXTAREA:
|
|
2395
|
-
|
|
2395
|
+
input = this.renderTextarea();
|
|
2396
|
+
break;
|
|
2396
2397
|
case InputType.CHECKBOX:
|
|
2397
|
-
|
|
2398
|
+
input = this.renderCheckbox();
|
|
2399
|
+
break;
|
|
2398
2400
|
case InputType.RADIO:
|
|
2399
|
-
|
|
2401
|
+
input = this.renderRadio();
|
|
2402
|
+
break;
|
|
2400
2403
|
default:
|
|
2401
|
-
|
|
2404
|
+
input = this.renderInputText(this.type);
|
|
2402
2405
|
}
|
|
2406
|
+
return h(Host, null, input);
|
|
2403
2407
|
}
|
|
2404
2408
|
get hostElement() { return getElement(this); }
|
|
2405
2409
|
};
|
|
2406
2410
|
ZInput.style = stylesCss$3;
|
|
2407
2411
|
|
|
2408
|
-
const stylesCss$2 = ":host{display:flex;min-height:calc(var(--space-unit) * 2.5);align-items:start;margin-top:var(--space-unit);color:var(--color-text05);fill:currentcolor;font-family:var(--font-family-sans);font-size:var(--font-size-2);letter-spacing:0.16px}:host([status=\"success\"]){color:var(--color-text-success)}:host([status=\"error\"]){color:var(--color-text-error)}:host([status=\"warning\"]){color:var(--color-warning02)}:host(:focus){outline:none}:host>z-icon{--z-icon-width:calc(var(--space-unit) * 2);--z-icon-height:calc(var(--space-unit) * 2);--z-icon-right-margin:var(--space-unit)}";
|
|
2412
|
+
const stylesCss$2 = ":host{display:flex;min-height:calc(var(--space-unit) * 2.5);align-items:start;margin-top:var(--space-unit);color:var(--color-text05);fill:currentcolor;font-family:var(--font-family-sans);font-size:var(--font-size-2);letter-spacing:0.16px}:host(.small),:host(.x-small){margin-top:calc(var(--space-unit) * 0.5);font-size:var(--font-size-1)}:host([status=\"success\"]){color:var(--color-text-success)}:host([status=\"error\"]){color:var(--color-text-error)}:host([status=\"warning\"]){color:var(--color-warning02)}:host(:focus){outline:none}:host>z-icon{--z-icon-width:calc(var(--space-unit) * 2);--z-icon-height:calc(var(--space-unit) * 2);--z-icon-right-margin:var(--space-unit);margin-top:calc(var(--space-unit) * 0.25)}:host(.small)>z-icon,:host(.x-small)>z-icon{--z-icon-width:14px;--z-icon-height:14px;--z-icon-right-margin:calc(var(--space-unit) * 0.5)}";
|
|
2409
2413
|
|
|
2410
2414
|
const ZInputMessage = class {
|
|
2411
2415
|
constructor(hostRef) {
|
|
@@ -2500,7 +2504,864 @@ const ZLink = class {
|
|
|
2500
2504
|
};
|
|
2501
2505
|
ZLink.style = stylesCss$1;
|
|
2502
2506
|
|
|
2503
|
-
|
|
2507
|
+
// nb. This is for IE10 and lower _only_.
|
|
2508
|
+
var supportCustomEvent = window.CustomEvent;
|
|
2509
|
+
if (!supportCustomEvent || typeof supportCustomEvent === 'object') {
|
|
2510
|
+
supportCustomEvent = function CustomEvent(event, x) {
|
|
2511
|
+
x = x || {};
|
|
2512
|
+
var ev = document.createEvent('CustomEvent');
|
|
2513
|
+
ev.initCustomEvent(event, !!x.bubbles, !!x.cancelable, x.detail || null);
|
|
2514
|
+
return ev;
|
|
2515
|
+
};
|
|
2516
|
+
supportCustomEvent.prototype = window.Event.prototype;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/**
|
|
2520
|
+
* Dispatches the passed event to both an "on<type>" handler as well as via the
|
|
2521
|
+
* normal dispatch operation. Does not bubble.
|
|
2522
|
+
*
|
|
2523
|
+
* @param {!EventTarget} target
|
|
2524
|
+
* @param {!Event} event
|
|
2525
|
+
* @return {boolean}
|
|
2526
|
+
*/
|
|
2527
|
+
function safeDispatchEvent(target, event) {
|
|
2528
|
+
var check = 'on' + event.type.toLowerCase();
|
|
2529
|
+
if (typeof target[check] === 'function') {
|
|
2530
|
+
target[check](event);
|
|
2531
|
+
}
|
|
2532
|
+
return target.dispatchEvent(event);
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
/**
|
|
2536
|
+
* @param {Element} el to check for stacking context
|
|
2537
|
+
* @return {boolean} whether this el or its parents creates a stacking context
|
|
2538
|
+
*/
|
|
2539
|
+
function createsStackingContext(el) {
|
|
2540
|
+
while (el && el !== document.body) {
|
|
2541
|
+
var s = window.getComputedStyle(el);
|
|
2542
|
+
var invalid = function(k, ok) {
|
|
2543
|
+
return !(s[k] === undefined || s[k] === ok);
|
|
2544
|
+
};
|
|
2545
|
+
|
|
2546
|
+
if (s.opacity < 1 ||
|
|
2547
|
+
invalid('zIndex', 'auto') ||
|
|
2548
|
+
invalid('transform', 'none') ||
|
|
2549
|
+
invalid('mixBlendMode', 'normal') ||
|
|
2550
|
+
invalid('filter', 'none') ||
|
|
2551
|
+
invalid('perspective', 'none') ||
|
|
2552
|
+
s['isolation'] === 'isolate' ||
|
|
2553
|
+
s.position === 'fixed' ||
|
|
2554
|
+
s.webkitOverflowScrolling === 'touch') {
|
|
2555
|
+
return true;
|
|
2556
|
+
}
|
|
2557
|
+
el = el.parentElement;
|
|
2558
|
+
}
|
|
2559
|
+
return false;
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
/**
|
|
2563
|
+
* Finds the nearest <dialog> from the passed element.
|
|
2564
|
+
*
|
|
2565
|
+
* @param {Element} el to search from
|
|
2566
|
+
* @return {HTMLDialogElement} dialog found
|
|
2567
|
+
*/
|
|
2568
|
+
function findNearestDialog(el) {
|
|
2569
|
+
while (el) {
|
|
2570
|
+
if (el.localName === 'dialog') {
|
|
2571
|
+
return /** @type {HTMLDialogElement} */ (el);
|
|
2572
|
+
}
|
|
2573
|
+
if (el.parentElement) {
|
|
2574
|
+
el = el.parentElement;
|
|
2575
|
+
} else if (el.parentNode) {
|
|
2576
|
+
el = el.parentNode.host;
|
|
2577
|
+
} else {
|
|
2578
|
+
el = null;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
return null;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* Blur the specified element, as long as it's not the HTML body element.
|
|
2586
|
+
* This works around an IE9/10 bug - blurring the body causes Windows to
|
|
2587
|
+
* blur the whole application.
|
|
2588
|
+
*
|
|
2589
|
+
* @param {Element} el to blur
|
|
2590
|
+
*/
|
|
2591
|
+
function safeBlur(el) {
|
|
2592
|
+
// Find the actual focused element when the active element is inside a shadow root
|
|
2593
|
+
while (el && el.shadowRoot && el.shadowRoot.activeElement) {
|
|
2594
|
+
el = el.shadowRoot.activeElement;
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
if (el && el.blur && el !== document.body) {
|
|
2598
|
+
el.blur();
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
/**
|
|
2603
|
+
* @param {!NodeList} nodeList to search
|
|
2604
|
+
* @param {Node} node to find
|
|
2605
|
+
* @return {boolean} whether node is inside nodeList
|
|
2606
|
+
*/
|
|
2607
|
+
function inNodeList(nodeList, node) {
|
|
2608
|
+
for (var i = 0; i < nodeList.length; ++i) {
|
|
2609
|
+
if (nodeList[i] === node) {
|
|
2610
|
+
return true;
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
return false;
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
/**
|
|
2617
|
+
* @param {HTMLFormElement} el to check
|
|
2618
|
+
* @return {boolean} whether this form has method="dialog"
|
|
2619
|
+
*/
|
|
2620
|
+
function isFormMethodDialog(el) {
|
|
2621
|
+
if (!el || !el.hasAttribute('method')) {
|
|
2622
|
+
return false;
|
|
2623
|
+
}
|
|
2624
|
+
return el.getAttribute('method').toLowerCase() === 'dialog';
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
/**
|
|
2628
|
+
* @param {!DocumentFragment|!Element} hostElement
|
|
2629
|
+
* @return {?Element}
|
|
2630
|
+
*/
|
|
2631
|
+
function findFocusableElementWithin(hostElement) {
|
|
2632
|
+
// Note that this is 'any focusable area'. This list is probably not exhaustive, but the
|
|
2633
|
+
// alternative involves stepping through and trying to focus everything.
|
|
2634
|
+
var opts = ['button', 'input', 'keygen', 'select', 'textarea'];
|
|
2635
|
+
var query = opts.map(function(el) {
|
|
2636
|
+
return el + ':not([disabled])';
|
|
2637
|
+
});
|
|
2638
|
+
// TODO(samthor): tabindex values that are not numeric are not focusable.
|
|
2639
|
+
query.push('[tabindex]:not([disabled]):not([tabindex=""])'); // tabindex != "", not disabled
|
|
2640
|
+
var target = hostElement.querySelector(query.join(', '));
|
|
2641
|
+
|
|
2642
|
+
if (!target && 'attachShadow' in Element.prototype) {
|
|
2643
|
+
// If we haven't found a focusable target, see if the host element contains an element
|
|
2644
|
+
// which has a shadowRoot.
|
|
2645
|
+
// Recursively search for the first focusable item in shadow roots.
|
|
2646
|
+
var elems = hostElement.querySelectorAll('*');
|
|
2647
|
+
for (var i = 0; i < elems.length; i++) {
|
|
2648
|
+
if (elems[i].tagName && elems[i].shadowRoot) {
|
|
2649
|
+
target = findFocusableElementWithin(elems[i].shadowRoot);
|
|
2650
|
+
if (target) {
|
|
2651
|
+
break;
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
return target;
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
/**
|
|
2660
|
+
* Determines if an element is attached to the DOM.
|
|
2661
|
+
* @param {Element} element to check
|
|
2662
|
+
* @return {boolean} whether the element is in DOM
|
|
2663
|
+
*/
|
|
2664
|
+
function isConnected(element) {
|
|
2665
|
+
return element.isConnected || document.body.contains(element);
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
/**
|
|
2669
|
+
* @param {!Event} event
|
|
2670
|
+
* @return {?Element}
|
|
2671
|
+
*/
|
|
2672
|
+
function findFormSubmitter(event) {
|
|
2673
|
+
if (event.submitter) {
|
|
2674
|
+
return event.submitter;
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
var form = event.target;
|
|
2678
|
+
if (!(form instanceof HTMLFormElement)) {
|
|
2679
|
+
return null;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
var submitter = dialogPolyfill.formSubmitter;
|
|
2683
|
+
if (!submitter) {
|
|
2684
|
+
var target = event.target;
|
|
2685
|
+
var root = ('getRootNode' in target && target.getRootNode() || document);
|
|
2686
|
+
submitter = root.activeElement;
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
if (!submitter || submitter.form !== form) {
|
|
2690
|
+
return null;
|
|
2691
|
+
}
|
|
2692
|
+
return submitter;
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2695
|
+
/**
|
|
2696
|
+
* @param {!Event} event
|
|
2697
|
+
*/
|
|
2698
|
+
function maybeHandleSubmit(event) {
|
|
2699
|
+
if (event.defaultPrevented) {
|
|
2700
|
+
return;
|
|
2701
|
+
}
|
|
2702
|
+
var form = /** @type {!HTMLFormElement} */ (event.target);
|
|
2703
|
+
|
|
2704
|
+
// We'd have a value if we clicked on an imagemap.
|
|
2705
|
+
var value = dialogPolyfill.imagemapUseValue;
|
|
2706
|
+
var submitter = findFormSubmitter(event);
|
|
2707
|
+
if (value === null && submitter) {
|
|
2708
|
+
value = submitter.value;
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
// There should always be a dialog as this handler is added specifically on them, but check just
|
|
2712
|
+
// in case.
|
|
2713
|
+
var dialog = findNearestDialog(form);
|
|
2714
|
+
if (!dialog) {
|
|
2715
|
+
return;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
// Prefer formmethod on the button.
|
|
2719
|
+
var formmethod = submitter && submitter.getAttribute('formmethod') || form.getAttribute('method');
|
|
2720
|
+
if (formmethod !== 'dialog') {
|
|
2721
|
+
return;
|
|
2722
|
+
}
|
|
2723
|
+
event.preventDefault();
|
|
2724
|
+
|
|
2725
|
+
if (value != null) {
|
|
2726
|
+
// nb. we explicitly check against null/undefined
|
|
2727
|
+
dialog.close(value);
|
|
2728
|
+
} else {
|
|
2729
|
+
dialog.close();
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
/**
|
|
2734
|
+
* @param {!HTMLDialogElement} dialog to upgrade
|
|
2735
|
+
* @constructor
|
|
2736
|
+
*/
|
|
2737
|
+
function dialogPolyfillInfo(dialog) {
|
|
2738
|
+
this.dialog_ = dialog;
|
|
2739
|
+
this.replacedStyleTop_ = false;
|
|
2740
|
+
this.openAsModal_ = false;
|
|
2741
|
+
|
|
2742
|
+
// Set a11y role. Browsers that support dialog implicitly know this already.
|
|
2743
|
+
if (!dialog.hasAttribute('role')) {
|
|
2744
|
+
dialog.setAttribute('role', 'dialog');
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
dialog.show = this.show.bind(this);
|
|
2748
|
+
dialog.showModal = this.showModal.bind(this);
|
|
2749
|
+
dialog.close = this.close.bind(this);
|
|
2750
|
+
|
|
2751
|
+
dialog.addEventListener('submit', maybeHandleSubmit, false);
|
|
2752
|
+
|
|
2753
|
+
if (!('returnValue' in dialog)) {
|
|
2754
|
+
dialog.returnValue = '';
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
if ('MutationObserver' in window) {
|
|
2758
|
+
var mo = new MutationObserver(this.maybeHideModal.bind(this));
|
|
2759
|
+
mo.observe(dialog, {attributes: true, attributeFilter: ['open']});
|
|
2760
|
+
} else {
|
|
2761
|
+
// IE10 and below support. Note that DOMNodeRemoved etc fire _before_ removal. They also
|
|
2762
|
+
// seem to fire even if the element was removed as part of a parent removal. Use the removed
|
|
2763
|
+
// events to force downgrade (useful if removed/immediately added).
|
|
2764
|
+
var removed = false;
|
|
2765
|
+
var cb = function() {
|
|
2766
|
+
removed ? this.downgradeModal() : this.maybeHideModal();
|
|
2767
|
+
removed = false;
|
|
2768
|
+
}.bind(this);
|
|
2769
|
+
var timeout;
|
|
2770
|
+
var delayModel = function(ev) {
|
|
2771
|
+
if (ev.target !== dialog) { return; } // not for a child element
|
|
2772
|
+
var cand = 'DOMNodeRemoved';
|
|
2773
|
+
removed |= (ev.type.substr(0, cand.length) === cand);
|
|
2774
|
+
window.clearTimeout(timeout);
|
|
2775
|
+
timeout = window.setTimeout(cb, 0);
|
|
2776
|
+
};
|
|
2777
|
+
['DOMAttrModified', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument'].forEach(function(name) {
|
|
2778
|
+
dialog.addEventListener(name, delayModel);
|
|
2779
|
+
});
|
|
2780
|
+
}
|
|
2781
|
+
// Note that the DOM is observed inside DialogManager while any dialog
|
|
2782
|
+
// is being displayed as a modal, to catch modal removal from the DOM.
|
|
2783
|
+
|
|
2784
|
+
Object.defineProperty(dialog, 'open', {
|
|
2785
|
+
set: this.setOpen.bind(this),
|
|
2786
|
+
get: dialog.hasAttribute.bind(dialog, 'open')
|
|
2787
|
+
});
|
|
2788
|
+
|
|
2789
|
+
this.backdrop_ = document.createElement('div');
|
|
2790
|
+
this.backdrop_.className = 'backdrop';
|
|
2791
|
+
this.backdrop_.addEventListener('mouseup' , this.backdropMouseEvent_.bind(this));
|
|
2792
|
+
this.backdrop_.addEventListener('mousedown', this.backdropMouseEvent_.bind(this));
|
|
2793
|
+
this.backdrop_.addEventListener('click' , this.backdropMouseEvent_.bind(this));
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
dialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ ({
|
|
2797
|
+
|
|
2798
|
+
get dialog() {
|
|
2799
|
+
return this.dialog_;
|
|
2800
|
+
},
|
|
2801
|
+
|
|
2802
|
+
/**
|
|
2803
|
+
* Maybe remove this dialog from the modal top layer. This is called when
|
|
2804
|
+
* a modal dialog may no longer be tenable, e.g., when the dialog is no
|
|
2805
|
+
* longer open or is no longer part of the DOM.
|
|
2806
|
+
*/
|
|
2807
|
+
maybeHideModal: function() {
|
|
2808
|
+
if (this.dialog_.hasAttribute('open') && isConnected(this.dialog_)) { return; }
|
|
2809
|
+
this.downgradeModal();
|
|
2810
|
+
},
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* Remove this dialog from the modal top layer, leaving it as a non-modal.
|
|
2814
|
+
*/
|
|
2815
|
+
downgradeModal: function() {
|
|
2816
|
+
if (!this.openAsModal_) { return; }
|
|
2817
|
+
this.openAsModal_ = false;
|
|
2818
|
+
this.dialog_.style.zIndex = '';
|
|
2819
|
+
|
|
2820
|
+
// This won't match the native <dialog> exactly because if the user set top on a centered
|
|
2821
|
+
// polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's
|
|
2822
|
+
// possible to polyfill this perfectly.
|
|
2823
|
+
if (this.replacedStyleTop_) {
|
|
2824
|
+
this.dialog_.style.top = '';
|
|
2825
|
+
this.replacedStyleTop_ = false;
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
// Clear the backdrop and remove from the manager.
|
|
2829
|
+
this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_);
|
|
2830
|
+
dialogPolyfill.dm.removeDialog(this);
|
|
2831
|
+
},
|
|
2832
|
+
|
|
2833
|
+
/**
|
|
2834
|
+
* @param {boolean} value whether to open or close this dialog
|
|
2835
|
+
*/
|
|
2836
|
+
setOpen: function(value) {
|
|
2837
|
+
if (value) {
|
|
2838
|
+
this.dialog_.hasAttribute('open') || this.dialog_.setAttribute('open', '');
|
|
2839
|
+
} else {
|
|
2840
|
+
this.dialog_.removeAttribute('open');
|
|
2841
|
+
this.maybeHideModal(); // nb. redundant with MutationObserver
|
|
2842
|
+
}
|
|
2843
|
+
},
|
|
2844
|
+
|
|
2845
|
+
/**
|
|
2846
|
+
* Handles mouse events ('mouseup', 'mousedown', 'click') on the fake .backdrop element, redirecting them as if
|
|
2847
|
+
* they were on the dialog itself.
|
|
2848
|
+
*
|
|
2849
|
+
* @param {!Event} e to redirect
|
|
2850
|
+
*/
|
|
2851
|
+
backdropMouseEvent_: function(e) {
|
|
2852
|
+
if (!this.dialog_.hasAttribute('tabindex')) {
|
|
2853
|
+
// Clicking on the backdrop should move the implicit cursor, even if dialog cannot be
|
|
2854
|
+
// focused. Create a fake thing to focus on. If the backdrop was _before_ the dialog, this
|
|
2855
|
+
// would not be needed - clicks would move the implicit cursor there.
|
|
2856
|
+
var fake = document.createElement('div');
|
|
2857
|
+
this.dialog_.insertBefore(fake, this.dialog_.firstChild);
|
|
2858
|
+
fake.tabIndex = -1;
|
|
2859
|
+
fake.focus();
|
|
2860
|
+
this.dialog_.removeChild(fake);
|
|
2861
|
+
} else {
|
|
2862
|
+
this.dialog_.focus();
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
var redirectedEvent = document.createEvent('MouseEvents');
|
|
2866
|
+
redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window,
|
|
2867
|
+
e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey,
|
|
2868
|
+
e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
|
|
2869
|
+
this.dialog_.dispatchEvent(redirectedEvent);
|
|
2870
|
+
e.stopPropagation();
|
|
2871
|
+
},
|
|
2872
|
+
|
|
2873
|
+
/**
|
|
2874
|
+
* Focuses on the first focusable element within the dialog. This will always blur the current
|
|
2875
|
+
* focus, even if nothing within the dialog is found.
|
|
2876
|
+
*/
|
|
2877
|
+
focus_: function() {
|
|
2878
|
+
// Find element with `autofocus` attribute, or fall back to the first form/tabindex control.
|
|
2879
|
+
var target = this.dialog_.querySelector('[autofocus]:not([disabled])');
|
|
2880
|
+
if (!target && this.dialog_.tabIndex >= 0) {
|
|
2881
|
+
target = this.dialog_;
|
|
2882
|
+
}
|
|
2883
|
+
if (!target) {
|
|
2884
|
+
target = findFocusableElementWithin(this.dialog_);
|
|
2885
|
+
}
|
|
2886
|
+
safeBlur(document.activeElement);
|
|
2887
|
+
target && target.focus();
|
|
2888
|
+
},
|
|
2889
|
+
|
|
2890
|
+
/**
|
|
2891
|
+
* Sets the zIndex for the backdrop and dialog.
|
|
2892
|
+
*
|
|
2893
|
+
* @param {number} dialogZ
|
|
2894
|
+
* @param {number} backdropZ
|
|
2895
|
+
*/
|
|
2896
|
+
updateZIndex: function(dialogZ, backdropZ) {
|
|
2897
|
+
if (dialogZ < backdropZ) {
|
|
2898
|
+
throw new Error('dialogZ should never be < backdropZ');
|
|
2899
|
+
}
|
|
2900
|
+
this.dialog_.style.zIndex = dialogZ;
|
|
2901
|
+
this.backdrop_.style.zIndex = backdropZ;
|
|
2902
|
+
},
|
|
2903
|
+
|
|
2904
|
+
/**
|
|
2905
|
+
* Shows the dialog. If the dialog is already open, this does nothing.
|
|
2906
|
+
*/
|
|
2907
|
+
show: function() {
|
|
2908
|
+
if (!this.dialog_.open) {
|
|
2909
|
+
this.setOpen(true);
|
|
2910
|
+
this.focus_();
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
|
|
2914
|
+
/**
|
|
2915
|
+
* Show this dialog modally.
|
|
2916
|
+
*/
|
|
2917
|
+
showModal: function() {
|
|
2918
|
+
if (this.dialog_.hasAttribute('open')) {
|
|
2919
|
+
throw new Error('Failed to execute \'showModal\' on dialog: The element is already open, and therefore cannot be opened modally.');
|
|
2920
|
+
}
|
|
2921
|
+
if (!isConnected(this.dialog_)) {
|
|
2922
|
+
throw new Error('Failed to execute \'showModal\' on dialog: The element is not in a Document.');
|
|
2923
|
+
}
|
|
2924
|
+
if (!dialogPolyfill.dm.pushDialog(this)) {
|
|
2925
|
+
throw new Error('Failed to execute \'showModal\' on dialog: There are too many open modal dialogs.');
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
if (createsStackingContext(this.dialog_.parentElement)) {
|
|
2929
|
+
console.warn('A dialog is being shown inside a stacking context. ' +
|
|
2930
|
+
'This may cause it to be unusable. For more information, see this link: ' +
|
|
2931
|
+
'https://github.com/GoogleChrome/dialog-polyfill/#stacking-context');
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
this.setOpen(true);
|
|
2935
|
+
this.openAsModal_ = true;
|
|
2936
|
+
|
|
2937
|
+
// Optionally center vertically, relative to the current viewport.
|
|
2938
|
+
if (dialogPolyfill.needsCentering(this.dialog_)) {
|
|
2939
|
+
dialogPolyfill.reposition(this.dialog_);
|
|
2940
|
+
this.replacedStyleTop_ = true;
|
|
2941
|
+
} else {
|
|
2942
|
+
this.replacedStyleTop_ = false;
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
// Insert backdrop.
|
|
2946
|
+
this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling);
|
|
2947
|
+
|
|
2948
|
+
// Focus on whatever inside the dialog.
|
|
2949
|
+
this.focus_();
|
|
2950
|
+
},
|
|
2951
|
+
|
|
2952
|
+
/**
|
|
2953
|
+
* Closes this HTMLDialogElement. This is optional vs clearing the open
|
|
2954
|
+
* attribute, however this fires a 'close' event.
|
|
2955
|
+
*
|
|
2956
|
+
* @param {string=} opt_returnValue to use as the returnValue
|
|
2957
|
+
*/
|
|
2958
|
+
close: function(opt_returnValue) {
|
|
2959
|
+
if (!this.dialog_.hasAttribute('open')) {
|
|
2960
|
+
throw new Error('Failed to execute \'close\' on dialog: The element does not have an \'open\' attribute, and therefore cannot be closed.');
|
|
2961
|
+
}
|
|
2962
|
+
this.setOpen(false);
|
|
2963
|
+
|
|
2964
|
+
// Leave returnValue untouched in case it was set directly on the element
|
|
2965
|
+
if (opt_returnValue !== undefined) {
|
|
2966
|
+
this.dialog_.returnValue = opt_returnValue;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
// Triggering "close" event for any attached listeners on the <dialog>.
|
|
2970
|
+
var closeEvent = new supportCustomEvent('close', {
|
|
2971
|
+
bubbles: false,
|
|
2972
|
+
cancelable: false
|
|
2973
|
+
});
|
|
2974
|
+
safeDispatchEvent(this.dialog_, closeEvent);
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
});
|
|
2978
|
+
|
|
2979
|
+
var dialogPolyfill = {};
|
|
2980
|
+
|
|
2981
|
+
dialogPolyfill.reposition = function(element) {
|
|
2982
|
+
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
|
2983
|
+
var topValue = scrollTop + (window.innerHeight - element.offsetHeight) / 2;
|
|
2984
|
+
element.style.top = Math.max(scrollTop, topValue) + 'px';
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2987
|
+
dialogPolyfill.isInlinePositionSetByStylesheet = function(element) {
|
|
2988
|
+
for (var i = 0; i < document.styleSheets.length; ++i) {
|
|
2989
|
+
var styleSheet = document.styleSheets[i];
|
|
2990
|
+
var cssRules = null;
|
|
2991
|
+
// Some browsers throw on cssRules.
|
|
2992
|
+
try {
|
|
2993
|
+
cssRules = styleSheet.cssRules;
|
|
2994
|
+
} catch (e) {}
|
|
2995
|
+
if (!cssRules) { continue; }
|
|
2996
|
+
for (var j = 0; j < cssRules.length; ++j) {
|
|
2997
|
+
var rule = cssRules[j];
|
|
2998
|
+
var selectedNodes = null;
|
|
2999
|
+
// Ignore errors on invalid selector texts.
|
|
3000
|
+
try {
|
|
3001
|
+
selectedNodes = document.querySelectorAll(rule.selectorText);
|
|
3002
|
+
} catch(e) {}
|
|
3003
|
+
if (!selectedNodes || !inNodeList(selectedNodes, element)) {
|
|
3004
|
+
continue;
|
|
3005
|
+
}
|
|
3006
|
+
var cssTop = rule.style.getPropertyValue('top');
|
|
3007
|
+
var cssBottom = rule.style.getPropertyValue('bottom');
|
|
3008
|
+
if ((cssTop && cssTop !== 'auto') || (cssBottom && cssBottom !== 'auto')) {
|
|
3009
|
+
return true;
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
return false;
|
|
3014
|
+
};
|
|
3015
|
+
|
|
3016
|
+
dialogPolyfill.needsCentering = function(dialog) {
|
|
3017
|
+
var computedStyle = window.getComputedStyle(dialog);
|
|
3018
|
+
if (computedStyle.position !== 'absolute') {
|
|
3019
|
+
return false;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
// We must determine whether the top/bottom specified value is non-auto. In
|
|
3023
|
+
// WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but
|
|
3024
|
+
// Firefox returns the used value. So we do this crazy thing instead: check
|
|
3025
|
+
// the inline style and then go through CSS rules.
|
|
3026
|
+
if ((dialog.style.top !== 'auto' && dialog.style.top !== '') ||
|
|
3027
|
+
(dialog.style.bottom !== 'auto' && dialog.style.bottom !== '')) {
|
|
3028
|
+
return false;
|
|
3029
|
+
}
|
|
3030
|
+
return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog);
|
|
3031
|
+
};
|
|
3032
|
+
|
|
3033
|
+
/**
|
|
3034
|
+
* @param {!Element} element to force upgrade
|
|
3035
|
+
*/
|
|
3036
|
+
dialogPolyfill.forceRegisterDialog = function(element) {
|
|
3037
|
+
if (window.HTMLDialogElement || element.showModal) {
|
|
3038
|
+
console.warn('This browser already supports <dialog>, the polyfill ' +
|
|
3039
|
+
'may not work correctly', element);
|
|
3040
|
+
}
|
|
3041
|
+
if (element.localName !== 'dialog') {
|
|
3042
|
+
throw new Error('Failed to register dialog: The element is not a dialog.');
|
|
3043
|
+
}
|
|
3044
|
+
new dialogPolyfillInfo(/** @type {!HTMLDialogElement} */ (element));
|
|
3045
|
+
};
|
|
3046
|
+
|
|
3047
|
+
/**
|
|
3048
|
+
* @param {!Element} element to upgrade, if necessary
|
|
3049
|
+
*/
|
|
3050
|
+
dialogPolyfill.registerDialog = function(element) {
|
|
3051
|
+
if (!element.showModal) {
|
|
3052
|
+
dialogPolyfill.forceRegisterDialog(element);
|
|
3053
|
+
}
|
|
3054
|
+
};
|
|
3055
|
+
|
|
3056
|
+
/**
|
|
3057
|
+
* @constructor
|
|
3058
|
+
*/
|
|
3059
|
+
dialogPolyfill.DialogManager = function() {
|
|
3060
|
+
/** @type {!Array<!dialogPolyfillInfo>} */
|
|
3061
|
+
this.pendingDialogStack = [];
|
|
3062
|
+
|
|
3063
|
+
var checkDOM = this.checkDOM_.bind(this);
|
|
3064
|
+
|
|
3065
|
+
// The overlay is used to simulate how a modal dialog blocks the document.
|
|
3066
|
+
// The blocking dialog is positioned on top of the overlay, and the rest of
|
|
3067
|
+
// the dialogs on the pending dialog stack are positioned below it. In the
|
|
3068
|
+
// actual implementation, the modal dialog stacking is controlled by the
|
|
3069
|
+
// top layer, where z-index has no effect.
|
|
3070
|
+
this.overlay = document.createElement('div');
|
|
3071
|
+
this.overlay.className = '_dialog_overlay';
|
|
3072
|
+
this.overlay.addEventListener('click', function(e) {
|
|
3073
|
+
this.forwardTab_ = undefined;
|
|
3074
|
+
e.stopPropagation();
|
|
3075
|
+
checkDOM([]); // sanity-check DOM
|
|
3076
|
+
}.bind(this));
|
|
3077
|
+
|
|
3078
|
+
this.handleKey_ = this.handleKey_.bind(this);
|
|
3079
|
+
this.handleFocus_ = this.handleFocus_.bind(this);
|
|
3080
|
+
|
|
3081
|
+
this.zIndexLow_ = 100000;
|
|
3082
|
+
this.zIndexHigh_ = 100000 + 150;
|
|
3083
|
+
|
|
3084
|
+
this.forwardTab_ = undefined;
|
|
3085
|
+
|
|
3086
|
+
if ('MutationObserver' in window) {
|
|
3087
|
+
this.mo_ = new MutationObserver(function(records) {
|
|
3088
|
+
var removed = [];
|
|
3089
|
+
records.forEach(function(rec) {
|
|
3090
|
+
for (var i = 0, c; c = rec.removedNodes[i]; ++i) {
|
|
3091
|
+
if (!(c instanceof Element)) {
|
|
3092
|
+
continue;
|
|
3093
|
+
} else if (c.localName === 'dialog') {
|
|
3094
|
+
removed.push(c);
|
|
3095
|
+
}
|
|
3096
|
+
removed = removed.concat(c.querySelectorAll('dialog'));
|
|
3097
|
+
}
|
|
3098
|
+
});
|
|
3099
|
+
removed.length && checkDOM(removed);
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
|
|
3104
|
+
/**
|
|
3105
|
+
* Called on the first modal dialog being shown. Adds the overlay and related
|
|
3106
|
+
* handlers.
|
|
3107
|
+
*/
|
|
3108
|
+
dialogPolyfill.DialogManager.prototype.blockDocument = function() {
|
|
3109
|
+
document.documentElement.addEventListener('focus', this.handleFocus_, true);
|
|
3110
|
+
document.addEventListener('keydown', this.handleKey_);
|
|
3111
|
+
this.mo_ && this.mo_.observe(document, {childList: true, subtree: true});
|
|
3112
|
+
};
|
|
3113
|
+
|
|
3114
|
+
/**
|
|
3115
|
+
* Called on the first modal dialog being removed, i.e., when no more modal
|
|
3116
|
+
* dialogs are visible.
|
|
3117
|
+
*/
|
|
3118
|
+
dialogPolyfill.DialogManager.prototype.unblockDocument = function() {
|
|
3119
|
+
document.documentElement.removeEventListener('focus', this.handleFocus_, true);
|
|
3120
|
+
document.removeEventListener('keydown', this.handleKey_);
|
|
3121
|
+
this.mo_ && this.mo_.disconnect();
|
|
3122
|
+
};
|
|
3123
|
+
|
|
3124
|
+
/**
|
|
3125
|
+
* Updates the stacking of all known dialogs.
|
|
3126
|
+
*/
|
|
3127
|
+
dialogPolyfill.DialogManager.prototype.updateStacking = function() {
|
|
3128
|
+
var zIndex = this.zIndexHigh_;
|
|
3129
|
+
|
|
3130
|
+
for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
|
|
3131
|
+
dpi.updateZIndex(--zIndex, --zIndex);
|
|
3132
|
+
if (i === 0) {
|
|
3133
|
+
this.overlay.style.zIndex = --zIndex;
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
// Make the overlay a sibling of the dialog itself.
|
|
3138
|
+
var last = this.pendingDialogStack[0];
|
|
3139
|
+
if (last) {
|
|
3140
|
+
var p = last.dialog.parentNode || document.body;
|
|
3141
|
+
p.appendChild(this.overlay);
|
|
3142
|
+
} else if (this.overlay.parentNode) {
|
|
3143
|
+
this.overlay.parentNode.removeChild(this.overlay);
|
|
3144
|
+
}
|
|
3145
|
+
};
|
|
3146
|
+
|
|
3147
|
+
/**
|
|
3148
|
+
* @param {Element} candidate to check if contained or is the top-most modal dialog
|
|
3149
|
+
* @return {boolean} whether candidate is contained in top dialog
|
|
3150
|
+
*/
|
|
3151
|
+
dialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function(candidate) {
|
|
3152
|
+
while (candidate = findNearestDialog(candidate)) {
|
|
3153
|
+
for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
|
|
3154
|
+
if (dpi.dialog === candidate) {
|
|
3155
|
+
return i === 0; // only valid if top-most
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
candidate = candidate.parentElement;
|
|
3159
|
+
}
|
|
3160
|
+
return false;
|
|
3161
|
+
};
|
|
3162
|
+
|
|
3163
|
+
dialogPolyfill.DialogManager.prototype.handleFocus_ = function(event) {
|
|
3164
|
+
var target = event.composedPath ? event.composedPath()[0] : event.target;
|
|
3165
|
+
|
|
3166
|
+
if (this.containedByTopDialog_(target)) { return; }
|
|
3167
|
+
|
|
3168
|
+
if (document.activeElement === document.documentElement) { return; }
|
|
3169
|
+
|
|
3170
|
+
event.preventDefault();
|
|
3171
|
+
event.stopPropagation();
|
|
3172
|
+
safeBlur(/** @type {Element} */ (target));
|
|
3173
|
+
|
|
3174
|
+
if (this.forwardTab_ === undefined) { return; } // move focus only from a tab key
|
|
3175
|
+
|
|
3176
|
+
var dpi = this.pendingDialogStack[0];
|
|
3177
|
+
var dialog = dpi.dialog;
|
|
3178
|
+
var position = dialog.compareDocumentPosition(target);
|
|
3179
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
3180
|
+
if (this.forwardTab_) {
|
|
3181
|
+
// forward
|
|
3182
|
+
dpi.focus_();
|
|
3183
|
+
} else if (target !== document.documentElement) {
|
|
3184
|
+
// backwards if we're not already focused on <html>
|
|
3185
|
+
document.documentElement.focus();
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
return false;
|
|
3190
|
+
};
|
|
3191
|
+
|
|
3192
|
+
dialogPolyfill.DialogManager.prototype.handleKey_ = function(event) {
|
|
3193
|
+
this.forwardTab_ = undefined;
|
|
3194
|
+
if (event.keyCode === 27) {
|
|
3195
|
+
event.preventDefault();
|
|
3196
|
+
event.stopPropagation();
|
|
3197
|
+
var cancelEvent = new supportCustomEvent('cancel', {
|
|
3198
|
+
bubbles: false,
|
|
3199
|
+
cancelable: true
|
|
3200
|
+
});
|
|
3201
|
+
var dpi = this.pendingDialogStack[0];
|
|
3202
|
+
if (dpi && safeDispatchEvent(dpi.dialog, cancelEvent)) {
|
|
3203
|
+
dpi.dialog.close();
|
|
3204
|
+
}
|
|
3205
|
+
} else if (event.keyCode === 9) {
|
|
3206
|
+
this.forwardTab_ = !event.shiftKey;
|
|
3207
|
+
}
|
|
3208
|
+
};
|
|
3209
|
+
|
|
3210
|
+
/**
|
|
3211
|
+
* Finds and downgrades any known modal dialogs that are no longer displayed. Dialogs that are
|
|
3212
|
+
* removed and immediately readded don't stay modal, they become normal.
|
|
3213
|
+
*
|
|
3214
|
+
* @param {!Array<!HTMLDialogElement>} removed that have definitely been removed
|
|
3215
|
+
*/
|
|
3216
|
+
dialogPolyfill.DialogManager.prototype.checkDOM_ = function(removed) {
|
|
3217
|
+
// This operates on a clone because it may cause it to change. Each change also calls
|
|
3218
|
+
// updateStacking, which only actually needs to happen once. But who removes many modal dialogs
|
|
3219
|
+
// at a time?!
|
|
3220
|
+
var clone = this.pendingDialogStack.slice();
|
|
3221
|
+
clone.forEach(function(dpi) {
|
|
3222
|
+
if (removed.indexOf(dpi.dialog) !== -1) {
|
|
3223
|
+
dpi.downgradeModal();
|
|
3224
|
+
} else {
|
|
3225
|
+
dpi.maybeHideModal();
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3228
|
+
};
|
|
3229
|
+
|
|
3230
|
+
/**
|
|
3231
|
+
* @param {!dialogPolyfillInfo} dpi
|
|
3232
|
+
* @return {boolean} whether the dialog was allowed
|
|
3233
|
+
*/
|
|
3234
|
+
dialogPolyfill.DialogManager.prototype.pushDialog = function(dpi) {
|
|
3235
|
+
var allowed = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;
|
|
3236
|
+
if (this.pendingDialogStack.length >= allowed) {
|
|
3237
|
+
return false;
|
|
3238
|
+
}
|
|
3239
|
+
if (this.pendingDialogStack.unshift(dpi) === 1) {
|
|
3240
|
+
this.blockDocument();
|
|
3241
|
+
}
|
|
3242
|
+
this.updateStacking();
|
|
3243
|
+
return true;
|
|
3244
|
+
};
|
|
3245
|
+
|
|
3246
|
+
/**
|
|
3247
|
+
* @param {!dialogPolyfillInfo} dpi
|
|
3248
|
+
*/
|
|
3249
|
+
dialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) {
|
|
3250
|
+
var index = this.pendingDialogStack.indexOf(dpi);
|
|
3251
|
+
if (index === -1) { return; }
|
|
3252
|
+
|
|
3253
|
+
this.pendingDialogStack.splice(index, 1);
|
|
3254
|
+
if (this.pendingDialogStack.length === 0) {
|
|
3255
|
+
this.unblockDocument();
|
|
3256
|
+
}
|
|
3257
|
+
this.updateStacking();
|
|
3258
|
+
};
|
|
3259
|
+
|
|
3260
|
+
dialogPolyfill.dm = new dialogPolyfill.DialogManager();
|
|
3261
|
+
dialogPolyfill.formSubmitter = null;
|
|
3262
|
+
dialogPolyfill.imagemapUseValue = null;
|
|
3263
|
+
|
|
3264
|
+
/**
|
|
3265
|
+
* Installs global handlers, such as click listers and native method overrides. These are needed
|
|
3266
|
+
* even if a no dialog is registered, as they deal with <form method="dialog">.
|
|
3267
|
+
*/
|
|
3268
|
+
if (window.HTMLDialogElement === undefined) {
|
|
3269
|
+
|
|
3270
|
+
/**
|
|
3271
|
+
* If HTMLFormElement translates method="DIALOG" into 'get', then replace the descriptor with
|
|
3272
|
+
* one that returns the correct value.
|
|
3273
|
+
*/
|
|
3274
|
+
var testForm = document.createElement('form');
|
|
3275
|
+
testForm.setAttribute('method', 'dialog');
|
|
3276
|
+
if (testForm.method !== 'dialog') {
|
|
3277
|
+
var methodDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, 'method');
|
|
3278
|
+
if (methodDescriptor) {
|
|
3279
|
+
// nb. Some older iOS and older PhantomJS fail to return the descriptor. Don't do anything
|
|
3280
|
+
// and don't bother to update the element.
|
|
3281
|
+
var realGet = methodDescriptor.get;
|
|
3282
|
+
methodDescriptor.get = function() {
|
|
3283
|
+
if (isFormMethodDialog(this)) {
|
|
3284
|
+
return 'dialog';
|
|
3285
|
+
}
|
|
3286
|
+
return realGet.call(this);
|
|
3287
|
+
};
|
|
3288
|
+
var realSet = methodDescriptor.set;
|
|
3289
|
+
/** @this {HTMLElement} */
|
|
3290
|
+
methodDescriptor.set = function(v) {
|
|
3291
|
+
if (typeof v === 'string' && v.toLowerCase() === 'dialog') {
|
|
3292
|
+
return this.setAttribute('method', v);
|
|
3293
|
+
}
|
|
3294
|
+
return realSet.call(this, v);
|
|
3295
|
+
};
|
|
3296
|
+
Object.defineProperty(HTMLFormElement.prototype, 'method', methodDescriptor);
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
/**
|
|
3301
|
+
* Global 'click' handler, to capture the <input type="submit"> or <button> element which has
|
|
3302
|
+
* submitted a <form method="dialog">. Needed as Safari and others don't report this inside
|
|
3303
|
+
* document.activeElement.
|
|
3304
|
+
*/
|
|
3305
|
+
document.addEventListener('click', function(ev) {
|
|
3306
|
+
dialogPolyfill.formSubmitter = null;
|
|
3307
|
+
dialogPolyfill.imagemapUseValue = null;
|
|
3308
|
+
if (ev.defaultPrevented) { return; } // e.g. a submit which prevents default submission
|
|
3309
|
+
|
|
3310
|
+
var target = /** @type {Element} */ (ev.target);
|
|
3311
|
+
if ('composedPath' in ev) {
|
|
3312
|
+
var path = ev.composedPath();
|
|
3313
|
+
target = path.shift() || target;
|
|
3314
|
+
}
|
|
3315
|
+
if (!target || !isFormMethodDialog(target.form)) { return; }
|
|
3316
|
+
|
|
3317
|
+
var valid = (target.type === 'submit' && ['button', 'input'].indexOf(target.localName) > -1);
|
|
3318
|
+
if (!valid) {
|
|
3319
|
+
if (!(target.localName === 'input' && target.type === 'image')) { return; }
|
|
3320
|
+
// this is a <input type="image">, which can submit forms
|
|
3321
|
+
dialogPolyfill.imagemapUseValue = ev.offsetX + ',' + ev.offsetY;
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
var dialog = findNearestDialog(target);
|
|
3325
|
+
if (!dialog) { return; }
|
|
3326
|
+
|
|
3327
|
+
dialogPolyfill.formSubmitter = target;
|
|
3328
|
+
|
|
3329
|
+
}, false);
|
|
3330
|
+
|
|
3331
|
+
/**
|
|
3332
|
+
* Global 'submit' handler. This handles submits of `method="dialog"` which are invalid, i.e.,
|
|
3333
|
+
* outside a dialog. They get prevented.
|
|
3334
|
+
*/
|
|
3335
|
+
document.addEventListener('submit', function(ev) {
|
|
3336
|
+
var form = ev.target;
|
|
3337
|
+
var dialog = findNearestDialog(form);
|
|
3338
|
+
if (dialog) {
|
|
3339
|
+
return; // ignore, handle there
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
var submitter = findFormSubmitter(ev);
|
|
3343
|
+
var formmethod = submitter && submitter.getAttribute('formmethod') || form.getAttribute('method');
|
|
3344
|
+
if (formmethod === 'dialog') {
|
|
3345
|
+
ev.preventDefault();
|
|
3346
|
+
}
|
|
3347
|
+
});
|
|
3348
|
+
|
|
3349
|
+
/**
|
|
3350
|
+
* Replace the native HTMLFormElement.submit() method, as it won't fire the
|
|
3351
|
+
* submit event and give us a chance to respond.
|
|
3352
|
+
*/
|
|
3353
|
+
var nativeFormSubmit = HTMLFormElement.prototype.submit;
|
|
3354
|
+
var replacementFormSubmit = function () {
|
|
3355
|
+
if (!isFormMethodDialog(this)) {
|
|
3356
|
+
return nativeFormSubmit.call(this);
|
|
3357
|
+
}
|
|
3358
|
+
var dialog = findNearestDialog(this);
|
|
3359
|
+
dialog && dialog.close();
|
|
3360
|
+
};
|
|
3361
|
+
HTMLFormElement.prototype.submit = replacementFormSubmit;
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3364
|
+
const stylesCss = ":host{font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>dialog{padding:0;border:none;margin:0}:host>dialog:modal{width:100%;max-width:100%;max-height:100%}:host>dialog::backdrop{display:none}:host>dialog+.backdrop{display:none}:host>dialog:not([open]){display:none}:host>dialog[open]{display:block}.modal-container{z-index:1010;display:flex;overflow:-moz-scrollbars-none;overflow:hidden;width:100%;height:100vh;flex-direction:column}.modal-container>header{padding:calc(var(--space-unit) * 2 - 2px) calc(var(--space-unit) * 2);background:var(--color-surface02)}.modal-container>header button{padding:0;border:none;margin:0;margin-left:auto;background:transparent;cursor:pointer}.modal-container>header z-icon{--z-icon-width:calc(var(--space-unit) * 2.5);--z-icon-height:calc(var(--space-unit) * 2.5);display:flex;fill:var(--color-icon01)}.modal-container>header>div{display:flex;width:100%;align-items:center;margin-right:calc(var(--space-unit) * 2)}.modal-container>header h1,.modal-container>header h2{padding:0;margin:0;color:var(--color-text01);font-weight:var(--font-rg)}.modal-container>header h1{font-size:var(--font-size-5);letter-spacing:0;line-height:1.4}.modal-container>header h2{font-size:var(--font-size-3);letter-spacing:0;line-height:1.5}.modal-container>header>div>h1 *:empty{display:none}.modal-container>header h1+h2{margin-top:calc(var(--space-unit) * 0.5)}.modal-container>.modal-content{overflow:auto;flex:1 auto;background:var(--color-surface01);overflow-x:hidden}.modal-container .modal-content::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}.modal-container .modal-content::-webkit-scrollbar-track{background-color:transparent}.modal-container .modal-content::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01)}.modal-container .modal-content::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}.modal-container .modal-content{scrollbar-color:var(--color-primary01) transparent}@media only screen and (min-width: 768px){.modal-background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:var(--gray900);opacity:0.7}.modal-container{position:fixed;top:calc(var(--space-unit) * 6);left:50%;width:auto;min-width:calc(var(--space-unit) * 40);height:auto;min-height:calc(var(--space-unit) * 40);max-height:calc(100vh - calc(var(--space-unit) * 6 * 2));border-radius:var(--border-radius);transform:translateX(-50%)}.modal-container>header z-icon{--z-icon-width:calc(var(--space-unit) * 3);--z-icon-height:calc(var(--space-unit) * 3)}}@media only screen and (min-width: 768px) and (max-width: 1151px){.modal-container>header{padding:calc(var(--space-unit) * 3 - 2px) calc(var(--space-unit) * 3)}}@media only screen and (min-width: 1152px){.modal-container>header{padding:calc(var(--space-unit) * 4 - 4px) calc(var(--space-unit) * 4)}.modal-container>header h1{font-size:var(--font-size-6);letter-spacing:0;line-height:1.33}.modal-container>header h2{font-size:var(--font-size-4);letter-spacing:0;line-height:1.5}.modal-container>header h1+h2{margin-top:0}}";
|
|
2504
3365
|
|
|
2505
3366
|
const FOCUSABLE_ELEMENTS_SELECTOR = ':is(button, input, select, textarea, [contenteditable=""], [contenteditable="true"], a[href], [tabindex], summary):not([disabled], [disabled=""], [tabindex="-1"], [aria-hidden="true"], [hidden])';
|
|
2506
3367
|
const ZModal = class {
|
|
@@ -2513,18 +3374,30 @@ const ZModal = class {
|
|
|
2513
3374
|
this.closeButtonLabel = "chiudi modale";
|
|
2514
3375
|
/** add role "alertdialog" to dialog (optional, default is false) */
|
|
2515
3376
|
this.alertdialog = false;
|
|
3377
|
+
/** if true, the modal is closable (optional, default is true) */
|
|
3378
|
+
this.closable = true;
|
|
2516
3379
|
}
|
|
2517
3380
|
emitModalClose() {
|
|
2518
|
-
|
|
3381
|
+
if (this.closable) {
|
|
3382
|
+
this.modalClose.emit({ modalid: this.modalid });
|
|
3383
|
+
}
|
|
2519
3384
|
}
|
|
2520
3385
|
emitModalHeaderActive() {
|
|
2521
3386
|
this.modalHeaderActive.emit({ modalid: this.modalid });
|
|
2522
3387
|
}
|
|
2523
3388
|
emitBackgroundClick() {
|
|
2524
|
-
|
|
3389
|
+
if (this.closable) {
|
|
3390
|
+
this.modalBackgroundClick.emit({ modalid: this.modalid });
|
|
3391
|
+
}
|
|
2525
3392
|
}
|
|
2526
3393
|
componentDidLoad() {
|
|
2527
|
-
|
|
3394
|
+
if (typeof HTMLDialogElement !== "function") {
|
|
3395
|
+
dialogPolyfill.registerDialog(this.dialog);
|
|
3396
|
+
this.dialog.setAttribute("open", "true");
|
|
3397
|
+
}
|
|
3398
|
+
else {
|
|
3399
|
+
this.open();
|
|
3400
|
+
}
|
|
2528
3401
|
}
|
|
2529
3402
|
/** open modal */
|
|
2530
3403
|
async open() {
|
|
@@ -2534,7 +3407,9 @@ const ZModal = class {
|
|
|
2534
3407
|
/** close modal */
|
|
2535
3408
|
async close() {
|
|
2536
3409
|
var _a;
|
|
2537
|
-
(
|
|
3410
|
+
if (this.closable) {
|
|
3411
|
+
(_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
|
|
3412
|
+
}
|
|
2538
3413
|
}
|
|
2539
3414
|
/**
|
|
2540
3415
|
* Get a list of focusable elements in the dialog.
|
|
@@ -2569,8 +3444,21 @@ const ZModal = class {
|
|
|
2569
3444
|
firstFocusableElement.focus();
|
|
2570
3445
|
}
|
|
2571
3446
|
}
|
|
3447
|
+
closeButtonSlot() {
|
|
3448
|
+
if (this.closable) {
|
|
3449
|
+
return (h("slot", { name: "modalCloseButton" }, h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, h("z-icon", { name: "multiply-circle-filled" }))));
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
handleEscape(e) {
|
|
3453
|
+
if (this.closable) {
|
|
3454
|
+
return;
|
|
3455
|
+
}
|
|
3456
|
+
e.preventDefault();
|
|
3457
|
+
}
|
|
2572
3458
|
render() {
|
|
2573
|
-
return (h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose()
|
|
3459
|
+
return (h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose(),
|
|
3460
|
+
// @ts-ignore
|
|
3461
|
+
onCancel: (e) => this.handleEscape(e) }, h("div", { class: "modal-container", id: this.modalid }, h("header", { onClick: this.emitModalHeaderActive.bind(this) }, h("div", null, this.modaltitle && h("h1", { id: "modal-title" }, this.modaltitle), this.closeButtonSlot()), this.modalsubtitle && h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), h("div", { class: "modal-content", id: "modal-content" }, h("slot", { name: "modalContent" }))), h("div", { class: "modal-background", "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
|
|
2574
3462
|
this.emitBackgroundClick();
|
|
2575
3463
|
this.close();
|
|
2576
3464
|
} })));
|