@watermarkinsights/ripple 3.8.0-1 → 3.8.0-2
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/README.md +3 -3
- package/dist/cjs/{functions-f0693632.js → functions-edfdd03f.js} +509 -483
- package/dist/cjs/{global-6c69dece.js → global-ffd0392c.js} +65 -65
- package/dist/cjs/{http-service-494d81de.js → http-service-9e8c4dd5.js} +49 -49
- package/dist/cjs/{index-cd179539.js → index-0e7e3668.js} +96 -64
- package/dist/cjs/{interfaces-a3338581.js → interfaces-30a74c1f.js} +29 -29
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/priv-chart-popover.cjs.entry.js +79 -79
- package/dist/cjs/priv-datepicker.cjs.entry.js +674 -674
- package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
- package/dist/cjs/priv-navigator-item.cjs.entry.js +24 -24
- package/dist/cjs/ripple.cjs.js +4 -4
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +342 -342
- package/dist/cjs/wm-button.cjs.entry.js +238 -238
- package/dist/cjs/wm-chart-slice.cjs.entry.js +14 -14
- package/dist/cjs/wm-chart.cjs.entry.js +475 -475
- package/dist/cjs/wm-datepicker.cjs.entry.js +273 -273
- package/dist/cjs/wm-input.cjs.entry.js +136 -136
- package/dist/cjs/wm-modal-footer.cjs.entry.js +32 -32
- package/dist/cjs/wm-modal-header.cjs.entry.js +35 -35
- package/dist/cjs/wm-modal.cjs.entry.js +164 -164
- package/dist/cjs/wm-navigation-hamburger.cjs.entry.js +56 -0
- package/dist/cjs/wm-navigation-item.cjs.entry.js +31 -0
- package/dist/cjs/wm-navigation.cjs.entry.js +87 -0
- package/dist/cjs/wm-navigator.cjs.entry.js +269 -269
- package/dist/cjs/wm-network-uploader.cjs.entry.js +422 -422
- package/dist/cjs/wm-option_2.cjs.entry.js +497 -497
- package/dist/cjs/wm-pagination.cjs.entry.js +168 -168
- package/dist/cjs/wm-search.cjs.entry.js +233 -233
- package/dist/cjs/wm-snackbar.cjs.entry.js +172 -172
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +297 -297
- package/dist/cjs/wm-tag-input.cjs.entry.js +581 -581
- package/dist/cjs/wm-timepicker.cjs.entry.js +385 -385
- package/dist/cjs/wm-toggletip.cjs.entry.js +126 -126
- package/dist/cjs/wm-uploader.cjs.entry.js +348 -348
- package/dist/cjs/wm-wrapper.cjs.entry.js +13 -13
- package/dist/collection/collection-manifest.json +10 -2
- package/dist/collection/components/wm-action-menu/wm-action-menu.css +0 -1
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +460 -460
- package/dist/collection/components/wm-button/wm-button.css +1 -3
- package/dist/collection/components/wm-button/wm-button.js +503 -503
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.css +0 -1
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +232 -232
- package/dist/collection/components/wm-chart/wm-chart-slice.js +115 -115
- package/dist/collection/components/wm-chart/wm-chart.css +0 -1
- package/dist/collection/components/wm-chart/wm-chart.js +718 -718
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +3 -5
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1039 -1039
- package/dist/collection/components/wm-datepicker/wm-datepicker.css +1 -3
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +483 -483
- package/dist/collection/components/wm-input/wm-input.css +1 -3
- package/dist/collection/components/wm-input/wm-input.js +423 -423
- package/dist/collection/components/wm-menuitem/wm-menuitem.css +0 -1
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
- package/dist/collection/components/wm-modal/wm-modal-footer.css +0 -1
- package/dist/collection/components/wm-modal/wm-modal-footer.js +141 -141
- package/dist/collection/components/wm-modal/wm-modal-header.css +0 -1
- package/dist/collection/components/wm-modal/wm-modal-header.js +92 -92
- package/dist/collection/components/wm-modal/wm-modal.css +0 -1
- package/dist/collection/components/wm-modal/wm-modal.js +461 -461
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.css +86 -0
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +96 -0
- package/dist/collection/components/wm-navigation/wm-navigation-item.css +85 -0
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +101 -0
- package/dist/collection/components/wm-navigation/wm-navigation.css +117 -0
- package/dist/collection/components/wm-navigation/wm-navigation.js +142 -0
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.css +0 -1
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.css +0 -1
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
- package/dist/collection/components/wm-navigator/wm-navigator.css +0 -1
- package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
- package/dist/collection/components/wm-option/wm-option.css +2 -4
- package/dist/collection/components/wm-option/wm-option.js +422 -422
- package/dist/collection/components/wm-pagination/wm-pagination.css +0 -1
- package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
- package/dist/collection/components/wm-search/wm-search.css +0 -1
- package/dist/collection/components/wm-search/wm-search.js +480 -480
- package/dist/collection/components/wm-select/wm-select.css +2 -4
- package/dist/collection/components/wm-select/wm-select.js +720 -720
- package/dist/collection/components/wm-snackbar/wm-snackbar.css +2 -4
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +0 -1
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +216 -216
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +0 -1
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +330 -330
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.css +0 -1
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +2 -4
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +810 -810
- package/dist/collection/components/wm-timepicker/wm-timepicker.css +2 -4
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
- package/dist/collection/components/wm-toggletip/wm-toggletip.css +1 -3
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +1 -3
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +753 -753
- package/dist/collection/components/wm-uploader/wm-uploader.css +1 -3
- package/dist/collection/components/wm-uploader/wm-uploader.js +748 -748
- package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
- package/dist/collection/dev/scripts.js +20 -20
- package/dist/collection/global/__mocks__/functions.js +6 -6
- package/dist/collection/global/functions.js +445 -445
- package/dist/collection/global/global.js +72 -72
- package/dist/collection/global/interfaces.js +49 -49
- package/dist/collection/global/services/__mocks__/http-service.js +130 -130
- package/dist/collection/global/services/http-service.js +50 -50
- package/dist/collection/lang/lang.js +5 -5
- package/dist/collection/lang/missing.js +39 -39
- package/dist/collection/lang/piglatin.js +93 -93
- package/dist/esm/{functions-cbfc81d1.js → functions-6cd52dcf.js} +509 -483
- package/dist/esm/{global-738cd49c.js → global-51d6ea5f.js} +65 -65
- package/dist/esm/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +49 -49
- package/dist/esm/{index-66f8130e.js → index-cd8f9ae2.js} +96 -64
- package/dist/esm/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +29 -29
- package/dist/esm/loader.js +4 -4
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/priv-chart-popover.entry.js +79 -79
- package/dist/esm/priv-datepicker.entry.js +674 -674
- package/dist/esm/priv-navigator-button.entry.js +19 -19
- package/dist/esm/priv-navigator-item.entry.js +24 -24
- package/dist/esm/ripple.js +4 -4
- package/dist/esm/wm-action-menu_2.entry.js +342 -342
- package/dist/esm/wm-button.entry.js +238 -238
- package/dist/esm/wm-chart-slice.entry.js +14 -14
- package/dist/esm/wm-chart.entry.js +475 -475
- package/dist/esm/wm-datepicker.entry.js +273 -273
- package/dist/esm/wm-input.entry.js +136 -136
- package/dist/esm/wm-modal-footer.entry.js +32 -32
- package/dist/esm/wm-modal-header.entry.js +35 -35
- package/dist/esm/wm-modal.entry.js +164 -164
- package/dist/esm/wm-navigation-hamburger.entry.js +52 -0
- package/dist/esm/wm-navigation-item.entry.js +27 -0
- package/dist/esm/wm-navigation.entry.js +83 -0
- package/dist/esm/wm-navigator.entry.js +269 -269
- package/dist/esm/wm-network-uploader.entry.js +422 -422
- package/dist/esm/wm-option_2.entry.js +497 -497
- package/dist/esm/wm-pagination.entry.js +168 -168
- package/dist/esm/wm-search.entry.js +233 -233
- package/dist/esm/wm-snackbar.entry.js +172 -172
- package/dist/esm/wm-tab-item_3.entry.js +297 -297
- package/dist/esm/wm-tag-input.entry.js +581 -581
- package/dist/esm/wm-timepicker.entry.js +385 -385
- package/dist/esm/wm-toggletip.entry.js +126 -126
- package/dist/esm/wm-uploader.entry.js +348 -348
- package/dist/esm/wm-wrapper.entry.js +13 -13
- package/dist/esm-es5/functions-6cd52dcf.js +15 -0
- package/dist/esm-es5/{global-738cd49c.js → global-51d6ea5f.js} +1 -1
- package/dist/esm-es5/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +1 -1
- package/dist/esm-es5/index-cd8f9ae2.js +1 -0
- package/dist/esm-es5/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +0 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-button.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation-hamburger.entry.js +1 -0
- package/dist/esm-es5/wm-navigation-item.entry.js +1 -0
- package/dist/esm-es5/wm-navigation.entry.js +1 -0
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-wrapper.entry.js +1 -1
- package/dist/loader/index.d.ts +0 -1
- package/dist/ripple/p-05b44011.system.entry.js +1 -0
- package/dist/ripple/{p-8d97d1d5.system.entry.js → p-088e3c4c.system.entry.js} +1 -1
- package/dist/ripple/{p-f5df5903.system.js → p-08b7ec08.system.js} +0 -0
- package/dist/ripple/{p-b840acea.system.entry.js → p-15759528.system.entry.js} +1 -1
- package/dist/ripple/p-17fef956.entry.js +1 -0
- package/dist/ripple/{p-85d12cf2.system.entry.js → p-1d7049b5.system.entry.js} +1 -1
- package/dist/ripple/p-20856a2d.system.js +1 -0
- package/dist/ripple/p-2206c8d0.entry.js +1 -0
- package/dist/ripple/p-244877c8.entry.js +1 -0
- package/dist/ripple/{p-366a3db1.system.entry.js → p-284a9749.system.entry.js} +1 -1
- package/dist/ripple/p-2b526a98.entry.js +1 -0
- package/dist/ripple/p-2f63e022.system.entry.js +1 -0
- package/dist/ripple/p-313b6073.system.js +1 -0
- package/dist/ripple/p-323c8fbd.entry.js +1 -0
- package/dist/ripple/p-38062c39.js +1 -0
- package/dist/ripple/p-3ba3afca.entry.js +1 -0
- package/dist/ripple/{p-5ef0d011.system.entry.js → p-45ee5b9d.system.entry.js} +1 -1
- package/dist/ripple/p-48ab9e16.entry.js +1 -0
- package/dist/ripple/p-4999f5dc.entry.js +1 -0
- package/dist/ripple/p-4ab257fe.entry.js +1 -0
- package/dist/ripple/p-4c0de099.system.entry.js +1 -0
- package/dist/ripple/p-4c75587a.system.entry.js +1 -0
- package/dist/ripple/{p-6bc37009.system.entry.js → p-4ed98fb1.system.entry.js} +1 -1
- package/dist/ripple/{p-7bc744bf.system.entry.js → p-504579c2.system.entry.js} +1 -1
- package/dist/ripple/p-58a1e616.system.entry.js +1 -0
- package/dist/ripple/p-5fd47eac.entry.js +1 -0
- package/dist/ripple/p-664c3f62.entry.js +1 -0
- package/dist/ripple/p-6923b8f6.system.js +15 -0
- package/dist/ripple/p-6e5a35ae.system.entry.js +1 -0
- package/dist/ripple/p-741972e8.system.entry.js +1 -0
- package/dist/ripple/p-764fa608.entry.js +1 -0
- package/dist/ripple/p-77bd8d1b.entry.js +1 -0
- package/dist/ripple/p-7ff67db9.entry.js +1 -0
- package/dist/ripple/p-8139cdfe.system.js +1 -0
- package/dist/ripple/{p-11400c80.js → p-83028f2c.js} +1 -1
- package/dist/ripple/p-864b71bf.system.entry.js +1 -0
- package/dist/ripple/p-87b8fddf.entry.js +1 -0
- package/dist/ripple/{p-43f1298b.js → p-888bec42.js} +0 -0
- package/dist/ripple/p-8a0450fd.entry.js +1 -0
- package/dist/ripple/p-9173f673.entry.js +1 -0
- package/dist/ripple/{p-2d49a016.system.entry.js → p-9a9743f5.system.entry.js} +1 -1
- package/dist/ripple/p-9f442b49.system.entry.js +1 -0
- package/dist/ripple/p-a2c2f475.system.entry.js +1 -0
- package/dist/ripple/p-a3fcdd9f.entry.js +1 -0
- package/dist/ripple/{p-b3ce2033.system.entry.js → p-a5177480.system.entry.js} +1 -1
- package/dist/ripple/p-a588ae81.entry.js +1 -0
- package/dist/ripple/{p-fd8070fb.js → p-a6d6eae7.js} +0 -0
- package/dist/ripple/p-a8358b36.entry.js +1 -0
- package/dist/ripple/p-a88d46f9.system.entry.js +1 -0
- package/dist/ripple/p-a8dfec6d.system.entry.js +1 -0
- package/dist/ripple/{p-b2ccbff3.system.js → p-aedd95e6.system.js} +1 -1
- package/dist/ripple/p-b1d25dec.entry.js +1 -0
- package/dist/ripple/p-b542340c.system.entry.js +1 -0
- package/dist/ripple/{p-261ea633.system.entry.js → p-c19298a5.system.entry.js} +1 -1
- package/dist/ripple/p-c401898d.entry.js +1 -0
- package/dist/ripple/p-ce81ccb4.system.entry.js +1 -0
- package/dist/ripple/p-cfa8106a.system.entry.js +1 -0
- package/dist/ripple/p-dadb6c78.js +16 -0
- package/dist/ripple/p-db7f5d60.entry.js +1 -0
- package/dist/ripple/p-dff01b0a.system.entry.js +1 -0
- package/dist/ripple/{p-7a9aac92.system.entry.js → p-e758db14.system.entry.js} +1 -1
- package/dist/ripple/p-ecb6a2e0.entry.js +1 -0
- package/dist/ripple/p-ef344252.entry.js +1 -0
- package/dist/ripple/p-f0dfc5d7.entry.js +1 -0
- package/dist/ripple/{p-90aebfd6.system.entry.js → p-f2ba1a0f.system.entry.js} +1 -1
- package/dist/ripple/p-f92f2d83.entry.js +1 -0
- package/dist/ripple/p-fe0a25c1.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +48 -48
- package/dist/types/components/wm-button/wm-button.d.ts +44 -44
- package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +23 -23
- package/dist/types/components/wm-chart/wm-chart-slice.d.ts +11 -11
- package/dist/types/components/wm-chart/wm-chart.d.ts +82 -82
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +42 -42
- package/dist/types/components/wm-input/wm-input.d.ts +46 -46
- package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +15 -15
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +12 -12
- package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
- package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +13 -0
- package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +10 -0
- package/dist/types/components/wm-navigation/wm-navigation.d.ts +19 -0
- package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
- package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
- package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
- package/dist/types/components/wm-option/wm-option.d.ts +32 -32
- package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
- package/dist/types/components/wm-search/wm-search.d.ts +86 -86
- package/dist/types/components/wm-select/wm-select.d.ts +66 -66
- package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
- package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
- package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
- package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +92 -92
- package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +61 -61
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
- package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +80 -80
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
- package/dist/types/components.d.ts +74 -24
- package/dist/types/global/__mocks__/functions.d.ts +6 -6
- package/dist/types/global/functions.d.ts +40 -40
- package/dist/types/global/global.d.ts +1 -1
- package/dist/types/global/interfaces.d.ts +34 -34
- package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
- package/dist/types/global/services/http-service.d.ts +4 -4
- package/dist/types/lang/lang.d.ts +5 -5
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/package.json +47 -47
- package/dist/esm-es5/functions-cbfc81d1.js +0 -15
- package/dist/esm-es5/index-66f8130e.js +0 -1
- package/dist/ripple/p-0418abd7.system.js +0 -15
- package/dist/ripple/p-065e2ca1.entry.js +0 -1
- package/dist/ripple/p-06627dcf.entry.js +0 -1
- package/dist/ripple/p-08b2262e.system.entry.js +0 -1
- package/dist/ripple/p-09432004.system.entry.js +0 -1
- package/dist/ripple/p-0c58f50d.entry.js +0 -1
- package/dist/ripple/p-0d8bd4ee.entry.js +0 -1
- package/dist/ripple/p-111f705a.entry.js +0 -1
- package/dist/ripple/p-1d899a2d.system.entry.js +0 -1
- package/dist/ripple/p-252e91de.entry.js +0 -1
- package/dist/ripple/p-2cdfb4cc.entry.js +0 -1
- package/dist/ripple/p-2f91e2a6.entry.js +0 -1
- package/dist/ripple/p-39cba5b2.entry.js +0 -1
- package/dist/ripple/p-3e1dd662.entry.js +0 -1
- package/dist/ripple/p-3fb41fe3.system.entry.js +0 -1
- package/dist/ripple/p-5a528af7.entry.js +0 -1
- package/dist/ripple/p-5ad7afc0.entry.js +0 -1
- package/dist/ripple/p-5bd3aa5a.system.entry.js +0 -1
- package/dist/ripple/p-67fcdd5d.entry.js +0 -1
- package/dist/ripple/p-6b4374e3.system.entry.js +0 -1
- package/dist/ripple/p-8afdc986.entry.js +0 -1
- package/dist/ripple/p-8b0eb05e.entry.js +0 -1
- package/dist/ripple/p-8c4c086d.system.js +0 -1
- package/dist/ripple/p-8f05bc58.system.entry.js +0 -1
- package/dist/ripple/p-9276c5e4.entry.js +0 -1
- package/dist/ripple/p-92b6bc97.system.entry.js +0 -1
- package/dist/ripple/p-99548d58.system.js +0 -1
- package/dist/ripple/p-99db8501.entry.js +0 -1
- package/dist/ripple/p-9baa3039.js +0 -1
- package/dist/ripple/p-9d02957d.system.js +0 -1
- package/dist/ripple/p-ae4e95ce.system.entry.js +0 -1
- package/dist/ripple/p-b4e9a8e3.entry.js +0 -1
- package/dist/ripple/p-b5edcf38.js +0 -16
- package/dist/ripple/p-b626f3b9.system.entry.js +0 -1
- package/dist/ripple/p-c3a9a5da.system.entry.js +0 -1
- package/dist/ripple/p-c730ce74.entry.js +0 -1
- package/dist/ripple/p-d0643c9b.entry.js +0 -1
- package/dist/ripple/p-da78496a.entry.js +0 -1
- package/dist/ripple/p-dc196bc2.entry.js +0 -1
- package/dist/ripple/p-deae1a7a.entry.js +0 -1
- package/dist/ripple/p-e06b8ab3.system.entry.js +0 -1
- package/dist/ripple/p-e3bab713.entry.js +0 -1
- package/dist/ripple/p-eed76888.system.entry.js +0 -1
- package/dist/ripple/p-ff5ec153.entry.js +0 -1
|
@@ -3878,11 +3878,17 @@ function icuUnitToEcma(unit) {
|
|
|
3878
3878
|
return unit.replace(/^(.*?)-/, '');
|
|
3879
3879
|
}
|
|
3880
3880
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
3881
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
3881
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
3882
3882
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
3883
3883
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
3884
3884
|
function parseSignificantPrecision(str) {
|
|
3885
3885
|
var result = {};
|
|
3886
|
+
if (str[str.length - 1] === 'r') {
|
|
3887
|
+
result.roundingPriority = 'morePrecision';
|
|
3888
|
+
}
|
|
3889
|
+
else if (str[str.length - 1] === 's') {
|
|
3890
|
+
result.roundingPriority = 'lessPrecision';
|
|
3891
|
+
}
|
|
3886
3892
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {
|
|
3887
3893
|
// @@@ case
|
|
3888
3894
|
if (typeof g2 !== 'string') {
|
|
@@ -4109,8 +4115,13 @@ function parseNumberSkeleton(tokens) {
|
|
|
4109
4115
|
}
|
|
4110
4116
|
return '';
|
|
4111
4117
|
});
|
|
4112
|
-
|
|
4113
|
-
|
|
4118
|
+
var opt = token.options[0];
|
|
4119
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display
|
|
4120
|
+
if (opt === 'w') {
|
|
4121
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });
|
|
4122
|
+
}
|
|
4123
|
+
else if (opt) {
|
|
4124
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
4114
4125
|
}
|
|
4115
4126
|
continue;
|
|
4116
4127
|
}
|
|
@@ -4132,8 +4143,8 @@ function parseNumberSkeleton(tokens) {
|
|
|
4132
4143
|
}
|
|
4133
4144
|
|
|
4134
4145
|
var _a;
|
|
4135
|
-
var SPACE_SEPARATOR_START_REGEX = new RegExp("^"
|
|
4136
|
-
var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source
|
|
4146
|
+
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
4147
|
+
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
4137
4148
|
function createLocation(start, end) {
|
|
4138
4149
|
return { start: start, end: end };
|
|
4139
4150
|
}
|
|
@@ -4380,7 +4391,7 @@ var Parser = /** @class */ (function () {
|
|
|
4380
4391
|
return {
|
|
4381
4392
|
val: {
|
|
4382
4393
|
type: TYPE.literal,
|
|
4383
|
-
value: "<"
|
|
4394
|
+
value: "<".concat(tagName, "/>"),
|
|
4384
4395
|
location: createLocation(startPosition, this.clonePosition()),
|
|
4385
4396
|
},
|
|
4386
4397
|
err: null,
|
|
@@ -4985,7 +4996,7 @@ var Parser = /** @class */ (function () {
|
|
|
4985
4996
|
}
|
|
4986
4997
|
var code = codePointAt(this.message, offset);
|
|
4987
4998
|
if (code === undefined) {
|
|
4988
|
-
throw Error("Offset "
|
|
4999
|
+
throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
4989
5000
|
}
|
|
4990
5001
|
return code;
|
|
4991
5002
|
};
|
|
@@ -5053,7 +5064,7 @@ var Parser = /** @class */ (function () {
|
|
|
5053
5064
|
*/
|
|
5054
5065
|
Parser.prototype.bumpTo = function (targetOffset) {
|
|
5055
5066
|
if (this.offset() > targetOffset) {
|
|
5056
|
-
throw Error("targetOffset "
|
|
5067
|
+
throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
|
|
5057
5068
|
}
|
|
5058
5069
|
targetOffset = Math.min(targetOffset, this.message.length);
|
|
5059
5070
|
while (true) {
|
|
@@ -5062,7 +5073,7 @@ var Parser = /** @class */ (function () {
|
|
|
5062
5073
|
break;
|
|
5063
5074
|
}
|
|
5064
5075
|
if (offset > targetOffset) {
|
|
5065
|
-
throw Error("targetOffset "
|
|
5076
|
+
throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
|
|
5066
5077
|
}
|
|
5067
5078
|
this.bump();
|
|
5068
5079
|
if (this.isEOF()) {
|
|
@@ -5528,28 +5539,28 @@ var FormatError = /** @class */ (function (_super) {
|
|
|
5528
5539
|
return _this;
|
|
5529
5540
|
}
|
|
5530
5541
|
FormatError.prototype.toString = function () {
|
|
5531
|
-
return "[formatjs Error: "
|
|
5542
|
+
return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
|
|
5532
5543
|
};
|
|
5533
5544
|
return FormatError;
|
|
5534
5545
|
}(Error));
|
|
5535
5546
|
var InvalidValueError = /** @class */ (function (_super) {
|
|
5536
5547
|
__extends(InvalidValueError, _super);
|
|
5537
5548
|
function InvalidValueError(variableId, value, options, originalMessage) {
|
|
5538
|
-
return _super.call(this, "Invalid values for \""
|
|
5549
|
+
return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5539
5550
|
}
|
|
5540
5551
|
return InvalidValueError;
|
|
5541
5552
|
}(FormatError));
|
|
5542
5553
|
var InvalidValueTypeError = /** @class */ (function (_super) {
|
|
5543
5554
|
__extends(InvalidValueTypeError, _super);
|
|
5544
5555
|
function InvalidValueTypeError(value, type, originalMessage) {
|
|
5545
|
-
return _super.call(this, "Value for \""
|
|
5556
|
+
return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5546
5557
|
}
|
|
5547
5558
|
return InvalidValueTypeError;
|
|
5548
5559
|
}(FormatError));
|
|
5549
5560
|
var MissingValueError = /** @class */ (function (_super) {
|
|
5550
5561
|
__extends(MissingValueError, _super);
|
|
5551
5562
|
function MissingValueError(variableId, originalMessage) {
|
|
5552
|
-
return _super.call(this, "The intl string context variable \""
|
|
5563
|
+
return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
5553
5564
|
}
|
|
5554
5565
|
return MissingValueError;
|
|
5555
5566
|
}(FormatError));
|
|
@@ -5710,7 +5721,7 @@ originalMessage) {
|
|
|
5710
5721
|
continue;
|
|
5711
5722
|
}
|
|
5712
5723
|
if (isPluralElement(el)) {
|
|
5713
|
-
var opt = el.options["="
|
|
5724
|
+
var opt = el.options["=".concat(value)];
|
|
5714
5725
|
if (!opt) {
|
|
5715
5726
|
if (!Intl.PluralRules) {
|
|
5716
5727
|
throw new FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", ErrorCode.MISSING_INTL_API, originalMessage);
|
|
@@ -5781,7 +5792,7 @@ function createDefaultFormatters(cache) {
|
|
|
5781
5792
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5782
5793
|
args[_i] = arguments[_i];
|
|
5783
5794
|
}
|
|
5784
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5795
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5785
5796
|
}, {
|
|
5786
5797
|
cache: createFastMemoizeCache$1(cache.number),
|
|
5787
5798
|
strategy: strategies.variadic,
|
|
@@ -5792,7 +5803,7 @@ function createDefaultFormatters(cache) {
|
|
|
5792
5803
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5793
5804
|
args[_i] = arguments[_i];
|
|
5794
5805
|
}
|
|
5795
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5806
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5796
5807
|
}, {
|
|
5797
5808
|
cache: createFastMemoizeCache$1(cache.dateTime),
|
|
5798
5809
|
strategy: strategies.variadic,
|
|
@@ -5803,7 +5814,7 @@ function createDefaultFormatters(cache) {
|
|
|
5803
5814
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5804
5815
|
args[_i] = arguments[_i];
|
|
5805
5816
|
}
|
|
5806
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5817
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5807
5818
|
}, {
|
|
5808
5819
|
cache: createFastMemoizeCache$1(cache.pluralRules),
|
|
5809
5820
|
strategy: strategies.variadic,
|
|
@@ -5961,7 +5972,13 @@ var IntlErrorCode;
|
|
|
5961
5972
|
var IntlError = /** @class */ (function (_super) {
|
|
5962
5973
|
__extends(IntlError, _super);
|
|
5963
5974
|
function IntlError(code, message, exception) {
|
|
5964
|
-
var _this =
|
|
5975
|
+
var _this = this;
|
|
5976
|
+
var err = exception
|
|
5977
|
+
? exception instanceof Error
|
|
5978
|
+
? exception
|
|
5979
|
+
: new Error(String(exception))
|
|
5980
|
+
: undefined;
|
|
5981
|
+
_this = _super.call(this, "[@formatjs/intl Error ".concat(code, "] ").concat(message, " \n").concat(err ? "\n".concat(err.message, "\n").concat(err.stack) : '')) || this;
|
|
5965
5982
|
_this.code = code;
|
|
5966
5983
|
// @ts-ignore just so we don't need to declare dep on @types/node
|
|
5967
5984
|
if (typeof Error.captureStackTrace === 'function') {
|
|
@@ -5993,19 +6010,26 @@ var MissingDataError = /** @class */ (function (_super) {
|
|
|
5993
6010
|
}
|
|
5994
6011
|
return MissingDataError;
|
|
5995
6012
|
}(IntlError));
|
|
6013
|
+
var IntlFormatError = /** @class */ (function (_super) {
|
|
6014
|
+
__extends(IntlFormatError, _super);
|
|
6015
|
+
function IntlFormatError(message, locale, exception) {
|
|
6016
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, " \nLocale: ").concat(locale, "\n"), exception) || this;
|
|
6017
|
+
}
|
|
6018
|
+
return IntlFormatError;
|
|
6019
|
+
}(IntlError));
|
|
5996
6020
|
var MessageFormatError = /** @class */ (function (_super) {
|
|
5997
6021
|
__extends(MessageFormatError, _super);
|
|
5998
6022
|
function MessageFormatError(message, locale, descriptor, exception) {
|
|
5999
|
-
var _this = _super.call(this,
|
|
6023
|
+
var _this = _super.call(this, "".concat(message, " \nMessageID: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, "\nDefault Message: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage, "\nDescription: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.description, " \n"), locale, exception) || this;
|
|
6000
6024
|
_this.descriptor = descriptor;
|
|
6001
6025
|
return _this;
|
|
6002
6026
|
}
|
|
6003
6027
|
return MessageFormatError;
|
|
6004
|
-
}(
|
|
6028
|
+
}(IntlFormatError));
|
|
6005
6029
|
var MissingTranslationError = /** @class */ (function (_super) {
|
|
6006
6030
|
__extends(MissingTranslationError, _super);
|
|
6007
6031
|
function MissingTranslationError(descriptor, locale) {
|
|
6008
|
-
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \""
|
|
6032
|
+
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"".concat(descriptor.id, "\" for locale \"").concat(locale, "\", using ").concat(descriptor.defaultMessage ? 'default message' : 'id', " as fallback.")) || this;
|
|
6009
6033
|
_this.descriptor = descriptor;
|
|
6010
6034
|
return _this;
|
|
6011
6035
|
}
|
|
@@ -6032,6 +6056,7 @@ var DEFAULT_INTL_CONFIG = {
|
|
|
6032
6056
|
timeZone: undefined,
|
|
6033
6057
|
defaultLocale: 'en',
|
|
6034
6058
|
defaultFormats: {},
|
|
6059
|
+
fallbackOnEmptyString: true,
|
|
6035
6060
|
onError: defaultErrorHandler,
|
|
6036
6061
|
};
|
|
6037
6062
|
function createIntlCache() {
|
|
@@ -6074,7 +6099,7 @@ function createFormatters(cache) {
|
|
|
6074
6099
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6075
6100
|
args[_i] = arguments[_i];
|
|
6076
6101
|
}
|
|
6077
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6102
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6078
6103
|
}, {
|
|
6079
6104
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
6080
6105
|
strategy: strategies.variadic,
|
|
@@ -6085,7 +6110,7 @@ function createFormatters(cache) {
|
|
|
6085
6110
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6086
6111
|
args[_i] = arguments[_i];
|
|
6087
6112
|
}
|
|
6088
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6113
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6089
6114
|
}, {
|
|
6090
6115
|
cache: createFastMemoizeCache(cache.number),
|
|
6091
6116
|
strategy: strategies.variadic,
|
|
@@ -6096,7 +6121,7 @@ function createFormatters(cache) {
|
|
|
6096
6121
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6097
6122
|
args[_i] = arguments[_i];
|
|
6098
6123
|
}
|
|
6099
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6124
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6100
6125
|
}, {
|
|
6101
6126
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
6102
6127
|
strategy: strategies.variadic,
|
|
@@ -6119,7 +6144,7 @@ function createFormatters(cache) {
|
|
|
6119
6144
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6120
6145
|
args[_i] = arguments[_i];
|
|
6121
6146
|
}
|
|
6122
|
-
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args)))();
|
|
6147
|
+
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();
|
|
6123
6148
|
}, {
|
|
6124
6149
|
cache: createFastMemoizeCache(cache.relativeTime),
|
|
6125
6150
|
strategy: strategies.variadic,
|
|
@@ -6130,7 +6155,7 @@ function createFormatters(cache) {
|
|
|
6130
6155
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6131
6156
|
args[_i] = arguments[_i];
|
|
6132
6157
|
}
|
|
6133
|
-
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args)))();
|
|
6158
|
+
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();
|
|
6134
6159
|
}, {
|
|
6135
6160
|
cache: createFastMemoizeCache(cache.list),
|
|
6136
6161
|
strategy: strategies.variadic,
|
|
@@ -6140,7 +6165,7 @@ function createFormatters(cache) {
|
|
|
6140
6165
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6141
6166
|
args[_i] = arguments[_i];
|
|
6142
6167
|
}
|
|
6143
|
-
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args)))();
|
|
6168
|
+
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();
|
|
6144
6169
|
}, {
|
|
6145
6170
|
cache: createFastMemoizeCache(cache.displayNames),
|
|
6146
6171
|
strategy: strategies.variadic,
|
|
@@ -6156,7 +6181,7 @@ function getNamedFormat(formats, type, name, onError) {
|
|
|
6156
6181
|
if (format) {
|
|
6157
6182
|
return format;
|
|
6158
6183
|
}
|
|
6159
|
-
onError(new UnsupportedFormatterError("No "
|
|
6184
|
+
onError(new UnsupportedFormatterError("No ".concat(type, " format named: ").concat(name)));
|
|
6160
6185
|
}
|
|
6161
6186
|
|
|
6162
6187
|
/**
|
|
@@ -6191,7 +6216,7 @@ function deepMergeFormatsAndSetTimeZone(f1, timeZone) {
|
|
|
6191
6216
|
return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
|
|
6192
6217
|
}
|
|
6193
6218
|
function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
6194
|
-
var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
|
|
6219
|
+
var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, fallbackOnEmptyString = _a.fallbackOnEmptyString, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
|
|
6195
6220
|
if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }
|
|
6196
6221
|
var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
|
|
6197
6222
|
// `id` is a required field of a Message Descriptor.
|
|
@@ -6221,6 +6246,9 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6221
6246
|
formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
|
|
6222
6247
|
defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
|
|
6223
6248
|
if (!message) {
|
|
6249
|
+
if (fallbackOnEmptyString === false && message === '') {
|
|
6250
|
+
return message;
|
|
6251
|
+
}
|
|
6224
6252
|
if (!defaultMessage ||
|
|
6225
6253
|
(locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {
|
|
6226
6254
|
// This prevents warnings from littering the console in development
|
|
@@ -6234,7 +6262,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6234
6262
|
return formatter.format(values);
|
|
6235
6263
|
}
|
|
6236
6264
|
catch (e) {
|
|
6237
|
-
onError(new MessageFormatError("Error formatting default message for: \""
|
|
6265
|
+
onError(new MessageFormatError("Error formatting default message for: \"".concat(id, "\", rendering default message verbatim"), locale, messageDescriptor, e));
|
|
6238
6266
|
return typeof defaultMessage === 'string' ? defaultMessage : id;
|
|
6239
6267
|
}
|
|
6240
6268
|
}
|
|
@@ -6246,7 +6274,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6246
6274
|
return formatter.format(values);
|
|
6247
6275
|
}
|
|
6248
6276
|
catch (e) {
|
|
6249
|
-
onError(new MessageFormatError("Error formatting message: \""
|
|
6277
|
+
onError(new MessageFormatError("Error formatting message: \"".concat(id, "\", using ").concat(defaultMessage ? 'default message' : 'id', " as fallback."), locale, messageDescriptor, e));
|
|
6250
6278
|
}
|
|
6251
6279
|
if (defaultMessage) {
|
|
6252
6280
|
try {
|
|
@@ -6254,7 +6282,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6254
6282
|
return formatter.format(values);
|
|
6255
6283
|
}
|
|
6256
6284
|
catch (e) {
|
|
6257
|
-
onError(new MessageFormatError("Error formatting the default message for: \""
|
|
6285
|
+
onError(new MessageFormatError("Error formatting the default message for: \"".concat(id, "\", rendering message verbatim"), locale, messageDescriptor, e));
|
|
6258
6286
|
}
|
|
6259
6287
|
}
|
|
6260
6288
|
if (typeof message === 'string') {
|
|
@@ -6292,9 +6320,7 @@ function getFormatter$2(_a, type, getDateTimeFormat, options) {
|
|
|
6292
6320
|
if (options === void 0) { options = {}; }
|
|
6293
6321
|
var format = options.format;
|
|
6294
6322
|
var defaults = __assign(__assign({}, (timeZone && { timeZone: timeZone })), (format && getNamedFormat(formats, type, format, onError)));
|
|
6295
|
-
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS,
|
|
6296
|
-
// @ts-expect-error es2020 has a lot stuff from es2021 bleed in
|
|
6297
|
-
defaults);
|
|
6323
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);
|
|
6298
6324
|
if (type === 'time' &&
|
|
6299
6325
|
!filteredOptions.hour &&
|
|
6300
6326
|
!filteredOptions.minute &&
|
|
@@ -6411,7 +6437,7 @@ var LIST_FORMAT_OPTIONS = [
|
|
|
6411
6437
|
];
|
|
6412
6438
|
var now = Date.now();
|
|
6413
6439
|
function generateToken(i) {
|
|
6414
|
-
return now
|
|
6440
|
+
return "".concat(now, "_").concat(i, "_").concat(now);
|
|
6415
6441
|
}
|
|
6416
6442
|
function formatList(opts, getListFormat, values, options) {
|
|
6417
6443
|
if (options === void 0) { options = {}; }
|
|
@@ -6478,7 +6504,7 @@ function formatPlural(_a, getPluralRules, value, options) {
|
|
|
6478
6504
|
return getPluralRules(locale, filteredOptions).select(value);
|
|
6479
6505
|
}
|
|
6480
6506
|
catch (e) {
|
|
6481
|
-
onError(new
|
|
6507
|
+
onError(new IntlFormatError('Error formatting plural.', locale, e));
|
|
6482
6508
|
}
|
|
6483
6509
|
return 'other';
|
|
6484
6510
|
}
|
|
@@ -6505,7 +6531,7 @@ function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options)
|
|
|
6505
6531
|
return getFormatter$1(config, getRelativeTimeFormat, options).format(value, unit);
|
|
6506
6532
|
}
|
|
6507
6533
|
catch (e) {
|
|
6508
|
-
config.onError(new
|
|
6534
|
+
config.onError(new IntlFormatError('Error formatting relative time.', config.locale, e));
|
|
6509
6535
|
}
|
|
6510
6536
|
return String(value);
|
|
6511
6537
|
}
|
|
@@ -6585,7 +6611,7 @@ function createIntl(config, cache) {
|
|
|
6585
6611
|
var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
|
|
6586
6612
|
if (!locale) {
|
|
6587
6613
|
if (onError) {
|
|
6588
|
-
onError(new InvalidConfigError("\"locale\" was not configured, using \""
|
|
6614
|
+
onError(new InvalidConfigError("\"locale\" was not configured, using \"".concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details")));
|
|
6589
6615
|
}
|
|
6590
6616
|
// Since there's no registered locale data for `locale`, this will
|
|
6591
6617
|
// fallback to the `defaultLocale` to make sure things can render.
|
|
@@ -6595,458 +6621,458 @@ function createIntl(config, cache) {
|
|
|
6595
6621
|
resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
|
|
6596
6622
|
}
|
|
6597
6623
|
else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
|
|
6598
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6624
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.NumberFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
6599
6625
|
}
|
|
6600
6626
|
else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
|
|
6601
6627
|
onError) {
|
|
6602
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6628
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.DateTimeFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
6603
6629
|
}
|
|
6604
6630
|
verifyConfigMessages(resolvedConfig);
|
|
6605
6631
|
return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
|
|
6606
6632
|
}
|
|
6607
6633
|
|
|
6608
|
-
const DEFAULT_LANGUAGE = "en";
|
|
6609
|
-
function getBrowserLang() {
|
|
6610
|
-
const langAttr = document.documentElement.getAttribute("lang");
|
|
6611
|
-
if (!!langAttr) {
|
|
6612
|
-
return langAttr;
|
|
6613
|
-
}
|
|
6614
|
-
else if (window.navigator && window.navigator.language) {
|
|
6615
|
-
const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
|
|
6616
|
-
return lang.slice(0, 2);
|
|
6617
|
-
}
|
|
6618
|
-
else {
|
|
6619
|
-
return DEFAULT_LANGUAGE;
|
|
6620
|
-
}
|
|
6621
|
-
}
|
|
6622
|
-
// prevents memory leak
|
|
6623
|
-
const cache = createIntlCache();
|
|
6624
|
-
const locale = getBrowserLang();
|
|
6625
|
-
const intl = createIntl({
|
|
6626
|
-
locale: locale,
|
|
6627
|
-
defaultLocale: "en",
|
|
6628
|
-
messages: lang[locale] || en,
|
|
6629
|
-
}, cache);
|
|
6630
|
-
function generateId() {
|
|
6631
|
-
return "wmcl-" + Math.random().toString(36).substr(2, 10);
|
|
6632
|
-
}
|
|
6633
|
-
function debounce(fn, wait) {
|
|
6634
|
-
let timeout;
|
|
6635
|
-
return function () {
|
|
6636
|
-
const context = this;
|
|
6637
|
-
const functionCall = () => fn.apply(context, arguments);
|
|
6638
|
-
clearTimeout(timeout);
|
|
6639
|
-
timeout = setTimeout(functionCall, wait);
|
|
6640
|
-
};
|
|
6641
|
-
}
|
|
6642
|
-
function getTextDir() {
|
|
6643
|
-
const dir = document.querySelector("html").getAttribute("dir");
|
|
6644
|
-
return dir ? dir.toLowerCase() : "";
|
|
6645
|
-
}
|
|
6646
|
-
function getPosition(el) {
|
|
6647
|
-
const coords = el.getBoundingClientRect();
|
|
6648
|
-
let x = coords.x;
|
|
6649
|
-
let y = coords.y;
|
|
6650
|
-
// Edge doesn't have x and y
|
|
6651
|
-
if (!x) {
|
|
6652
|
-
if (getTextDir() === "rtl") {
|
|
6653
|
-
x = coords.right;
|
|
6654
|
-
}
|
|
6655
|
-
else {
|
|
6656
|
-
x = coords.left;
|
|
6657
|
-
}
|
|
6658
|
-
y = coords.top;
|
|
6659
|
-
}
|
|
6660
|
-
return { x, y };
|
|
6661
|
-
}
|
|
6662
|
-
function findParentWithScrollbar(el) {
|
|
6663
|
-
while (!!el) {
|
|
6664
|
-
if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
|
|
6665
|
-
return el;
|
|
6666
|
-
}
|
|
6667
|
-
el = el.parentElement;
|
|
6668
|
-
}
|
|
6669
|
-
}
|
|
6670
|
-
function findParentWithHiddenOverflow(el) {
|
|
6671
|
-
while (!!el) {
|
|
6672
|
-
if (window.getComputedStyle(el).overflowY !== "visible") {
|
|
6673
|
-
return el;
|
|
6674
|
-
}
|
|
6675
|
-
el = el.parentElement;
|
|
6676
|
-
}
|
|
6677
|
-
}
|
|
6678
|
-
function getClosableElementMeasurements(fixedEl, closableEl) {
|
|
6679
|
-
const parent = findParentWithHiddenOverflow(fixedEl);
|
|
6680
|
-
// if parent is not found, measurements are checked against the viewport
|
|
6681
|
-
return {
|
|
6682
|
-
closableElHeight: closableEl.clientHeight,
|
|
6683
|
-
closableElWidth: closableEl.clientWidth,
|
|
6684
|
-
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6685
|
-
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6686
|
-
spaceAbove: parent
|
|
6687
|
-
? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
|
|
6688
|
-
: fixedEl.getBoundingClientRect().top,
|
|
6689
|
-
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6690
|
-
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6691
|
-
spaceBelow: parent
|
|
6692
|
-
? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
|
|
6693
|
-
: document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
|
|
6694
|
-
spaceLeft: parent
|
|
6695
|
-
? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
|
|
6696
|
-
: fixedEl.getBoundingClientRect().left,
|
|
6697
|
-
spaceRight: parent
|
|
6698
|
-
? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
|
|
6699
|
-
: document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
|
|
6700
|
-
};
|
|
6701
|
-
}
|
|
6702
|
-
function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
|
|
6703
|
-
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6704
|
-
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6705
|
-
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6706
|
-
) {
|
|
6707
|
-
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6708
|
-
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6709
|
-
const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
|
|
6710
|
-
return openUp;
|
|
6711
|
-
}
|
|
6712
|
-
function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
|
|
6713
|
-
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6714
|
-
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6715
|
-
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6716
|
-
) {
|
|
6717
|
-
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6718
|
-
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6719
|
-
const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
|
|
6720
|
-
return openDown;
|
|
6721
|
-
}
|
|
6722
|
-
function shouldShiftRight(fixedEl, closableEl) {
|
|
6723
|
-
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6724
|
-
const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
|
|
6725
|
-
return needsSpaceLeft;
|
|
6726
|
-
}
|
|
6727
|
-
function shouldShiftLeft(fixedEl, closableEl) {
|
|
6728
|
-
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6729
|
-
const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
|
|
6730
|
-
return needsSpaceRight;
|
|
6731
|
-
}
|
|
6732
|
-
function adjustTooltipPosition(tPos, el, tooltipEl) {
|
|
6733
|
-
// position must be reset before measurements are taken in adjustTooltipPosition
|
|
6734
|
-
// otherwise text-wrapping from previous position makes width measurement inconsistent
|
|
6735
|
-
tooltipEl.style.top = "";
|
|
6736
|
-
tooltipEl.style.left = "";
|
|
6737
|
-
const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
|
|
6738
|
-
const tooltipWidth = tooltipEl.getBoundingClientRect().width;
|
|
6739
|
-
const tooltipHeight = tooltipEl.getBoundingClientRect().height;
|
|
6740
|
-
const enoughSpaceAbove = spaceAbove > tooltipHeight;
|
|
6741
|
-
const enoughSpaceBelow = spaceBelow > tooltipHeight;
|
|
6742
|
-
// a tooltip should never be closer than 24px to the edge of a screen
|
|
6743
|
-
const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
|
|
6744
|
-
const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
|
|
6745
|
-
const swapAbove = (position) => {
|
|
6746
|
-
return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
|
|
6747
|
-
};
|
|
6748
|
-
const swapBelow = (position) => {
|
|
6749
|
-
return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
|
|
6750
|
-
};
|
|
6751
|
-
const swapLeft = (position, centeredPosition) => {
|
|
6752
|
-
if (!enoughSpaceLeft && enoughSpaceRight) {
|
|
6753
|
-
position = position.replace("left", "right");
|
|
6754
|
-
}
|
|
6755
|
-
else if (!enoughSpaceLeft && !enoughSpaceRight) {
|
|
6756
|
-
position = centeredPosition;
|
|
6757
|
-
}
|
|
6758
|
-
return position;
|
|
6759
|
-
};
|
|
6760
|
-
const swapRight = (position, centeredPosition) => {
|
|
6761
|
-
if (!enoughSpaceRight && enoughSpaceLeft) {
|
|
6762
|
-
position = position.replace("right", "left");
|
|
6763
|
-
}
|
|
6764
|
-
else if (!enoughSpaceRight && !enoughSpaceLeft) {
|
|
6765
|
-
position = centeredPosition;
|
|
6766
|
-
}
|
|
6767
|
-
return position;
|
|
6768
|
-
};
|
|
6769
|
-
// horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
|
|
6770
|
-
switch (tPos) {
|
|
6771
|
-
case "left":
|
|
6772
|
-
tPos = swapLeft(tPos, "bottom");
|
|
6773
|
-
case "right":
|
|
6774
|
-
tPos = swapRight(tPos, "bottom");
|
|
6775
|
-
case "top-left":
|
|
6776
|
-
tPos = swapLeft(tPos, "top");
|
|
6777
|
-
tPos = swapAbove(tPos);
|
|
6778
|
-
case "top-right":
|
|
6779
|
-
tPos = swapRight(tPos, "top");
|
|
6780
|
-
tPos = swapAbove(tPos);
|
|
6781
|
-
case "bottom-left":
|
|
6782
|
-
tPos = swapLeft(tPos, "bottom");
|
|
6783
|
-
tPos = swapBelow(tPos);
|
|
6784
|
-
case "bottom-right":
|
|
6785
|
-
tPos = swapRight(tPos, "bottom");
|
|
6786
|
-
tPos = swapBelow(tPos);
|
|
6787
|
-
case "top":
|
|
6788
|
-
tPos = swapAbove(tPos);
|
|
6789
|
-
case "bottom":
|
|
6790
|
-
tPos = swapBelow(tPos);
|
|
6791
|
-
}
|
|
6792
|
-
return tPos;
|
|
6793
|
-
}
|
|
6794
|
-
function hasRoomRight(x, spaceNeeded) {
|
|
6795
|
-
let horizOffset = 0;
|
|
6796
|
-
// if (getTextDir() === "ltr") {
|
|
6797
|
-
if (x.type === "click") {
|
|
6798
|
-
// if it's a mouse event, deal with mouse coords
|
|
6799
|
-
horizOffset = x.clientX;
|
|
6800
|
-
// if it's a focus event, the offset is 0
|
|
6801
|
-
}
|
|
6802
|
-
else if (x.type === "focus") {
|
|
6803
|
-
horizOffset = 0;
|
|
6804
|
-
}
|
|
6805
|
-
else {
|
|
6806
|
-
// otherwise an element was passed, calculate how far it is from the edge of the window
|
|
6807
|
-
let el = x; // re-assignment is for clarity
|
|
6808
|
-
while (el) {
|
|
6809
|
-
if (el.tagName == "BODY") {
|
|
6810
|
-
// deal with browser quirks with body/window/document and page scroll
|
|
6811
|
-
var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
6812
|
-
horizOffset += el.offsetLeft - xScroll + el.clientLeft;
|
|
6813
|
-
}
|
|
6814
|
-
else {
|
|
6815
|
-
// for all other non-BODY elements
|
|
6816
|
-
horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
|
|
6817
|
-
}
|
|
6818
|
-
el = el.offsetParent;
|
|
6819
|
-
}
|
|
6820
|
-
// }
|
|
6821
|
-
}
|
|
6822
|
-
return window.innerWidth - horizOffset >= spaceNeeded;
|
|
6823
|
-
}
|
|
6824
|
-
function checkForActiveElInShadow(element) {
|
|
6825
|
-
while (element && element.shadowRoot) {
|
|
6826
|
-
element = element.shadowRoot.activeElement;
|
|
6827
|
-
}
|
|
6828
|
-
return element;
|
|
6829
|
-
}
|
|
6830
|
-
function checkForFocusableElInShadow(element) {
|
|
6831
|
-
const selectors = [
|
|
6832
|
-
"button",
|
|
6833
|
-
"a",
|
|
6834
|
-
"input",
|
|
6835
|
-
"select",
|
|
6836
|
-
"textarea",
|
|
6837
|
-
"wm-button",
|
|
6838
|
-
"wm-search",
|
|
6839
|
-
"wm-select",
|
|
6840
|
-
"wm-action-menu",
|
|
6841
|
-
"wm-tab-item",
|
|
6842
|
-
"wm-datepicker",
|
|
6843
|
-
];
|
|
6844
|
-
let focusableEl = element;
|
|
6845
|
-
selectors.forEach((selector) => {
|
|
6846
|
-
if (focusableEl && focusableEl.shadowRoot) {
|
|
6847
|
-
let elInShadow = focusableEl.shadowRoot.querySelector(selector);
|
|
6848
|
-
if (elInShadow) {
|
|
6849
|
-
if (selector.startsWith("wm-")) {
|
|
6850
|
-
focusableEl = checkForFocusableElInShadow(elInShadow);
|
|
6851
|
-
}
|
|
6852
|
-
else {
|
|
6853
|
-
focusableEl = elInShadow;
|
|
6854
|
-
}
|
|
6855
|
-
}
|
|
6856
|
-
}
|
|
6857
|
-
});
|
|
6858
|
-
return focusableEl;
|
|
6859
|
-
}
|
|
6860
|
-
function isFocusable(element) {
|
|
6861
|
-
if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
|
|
6862
|
-
return true;
|
|
6863
|
-
}
|
|
6864
|
-
if (element.disabled) {
|
|
6865
|
-
return false;
|
|
6866
|
-
}
|
|
6867
|
-
switch (element.nodeName) {
|
|
6868
|
-
case "A":
|
|
6869
|
-
return !!element.href && element.rel != "ignore";
|
|
6870
|
-
case "INPUT":
|
|
6871
|
-
return element.type != "hidden" && element.type != "file";
|
|
6872
|
-
case "BUTTON":
|
|
6873
|
-
case "SELECT":
|
|
6874
|
-
case "TEXTAREA":
|
|
6875
|
-
case "WM-BUTTON":
|
|
6876
|
-
case "WM-SELECT":
|
|
6877
|
-
case "WM-ACTION-MENU":
|
|
6878
|
-
case "WM-DATEPICKER":
|
|
6879
|
-
case "WM-TIMEPICKER":
|
|
6880
|
-
case "WM-INPUT":
|
|
6881
|
-
case "WM-TAG-INPUT":
|
|
6882
|
-
case "WM-TAB-ITEM":
|
|
6883
|
-
case "WM-SEARCH":
|
|
6884
|
-
return true;
|
|
6885
|
-
default:
|
|
6886
|
-
return false;
|
|
6887
|
-
}
|
|
6888
|
-
}
|
|
6889
|
-
function getFirstFocusableDescendant(element) {
|
|
6890
|
-
if (isFocusable(element)) {
|
|
6891
|
-
return checkForFocusableElInShadow(element);
|
|
6892
|
-
}
|
|
6893
|
-
else if (element.childNodes.length > 0) {
|
|
6894
|
-
element.childNodes.forEach((i) => {
|
|
6895
|
-
const childEl = getFirstFocusableDescendant(i);
|
|
6896
|
-
return childEl && checkForFocusableElInShadow(childEl);
|
|
6897
|
-
});
|
|
6898
|
-
}
|
|
6899
|
-
}
|
|
6900
|
-
function hasValidType(file, types) {
|
|
6901
|
-
const acceptedExtensions = types.split(" ");
|
|
6902
|
-
const parts = file.name && file.name.split(".");
|
|
6903
|
-
const ext = parts && parts.length > 1 && parts[parts.length - 1];
|
|
6904
|
-
return ext
|
|
6905
|
-
? acceptedExtensions.includes(ext.toLowerCase())
|
|
6906
|
-
: // fallback: if we couldn't obtain an extension,
|
|
6907
|
-
// validate based on MIME type...
|
|
6908
|
-
!!file.type
|
|
6909
|
-
? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
|
|
6910
|
-
: // ...and if that failed too, accept the file
|
|
6911
|
-
// as it's preferable to accept an invalid file
|
|
6912
|
-
// than refusing a valid one (back-end will take care of what slips through)
|
|
6913
|
-
true;
|
|
6914
|
-
}
|
|
6915
|
-
// takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
|
|
6916
|
-
function getAcceptedMimeTypesList(acceptedExtensions) {
|
|
6917
|
-
// this is just a list of common file types (regardless of whether they are/can be valid or not)
|
|
6918
|
-
// front end checks are just a convenience to users, independent of security.
|
|
6919
|
-
// it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
|
|
6920
|
-
const lookupTable = {
|
|
6921
|
-
aac: ["audio/aac"],
|
|
6922
|
-
abw: ["application/x-abiword"],
|
|
6923
|
-
arc: ["application/x-freearc"],
|
|
6924
|
-
avi: ["video/x-msvideo"],
|
|
6925
|
-
azw: ["application/vnd.amazon.ebook"],
|
|
6926
|
-
bin: ["application/octet-stream"],
|
|
6927
|
-
bmp: ["image/bmp"],
|
|
6928
|
-
bz: ["application/x-bzip"],
|
|
6929
|
-
bz2: ["application/x-bzip2"],
|
|
6930
|
-
csh: ["application/x-csh"],
|
|
6931
|
-
css: ["text/css"],
|
|
6932
|
-
csv: ["text/csv"],
|
|
6933
|
-
doc: ["application/msword"],
|
|
6934
|
-
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
6935
|
-
eot: ["application/vnd.ms-fontobject"],
|
|
6936
|
-
epub: ["application/epub+zip"],
|
|
6937
|
-
gz: ["application/gzip"],
|
|
6938
|
-
gif: ["image/gif"],
|
|
6939
|
-
htm: ["text/html"],
|
|
6940
|
-
html: ["text/html"],
|
|
6941
|
-
ico: ["image/vnd.microsoft.icon"],
|
|
6942
|
-
ics: ["text/calendar"],
|
|
6943
|
-
jar: ["application/java-archive"],
|
|
6944
|
-
jpeg: ["image/jpeg"],
|
|
6945
|
-
jpg: ["image/jpeg"],
|
|
6946
|
-
js: ["text/javascript"],
|
|
6947
|
-
json: ["application/json"],
|
|
6948
|
-
jsonld: ["application/ld+json"],
|
|
6949
|
-
log: ["text/plain"],
|
|
6950
|
-
mid: ["audio/x-midi"],
|
|
6951
|
-
midi: ["audio/x-midi"],
|
|
6952
|
-
mjs: ["text/javascript"],
|
|
6953
|
-
mp3: ["audio/mpeg"],
|
|
6954
|
-
mpeg: ["video/mpeg"],
|
|
6955
|
-
mpkg: ["application/vnd.apple.installer+xml"],
|
|
6956
|
-
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
6957
|
-
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
6958
|
-
odt: ["application/vnd.oasis.opendocument.text"],
|
|
6959
|
-
oga: ["audio/ogg"],
|
|
6960
|
-
ogv: ["video/ogg"],
|
|
6961
|
-
ogx: ["application/ogg"],
|
|
6962
|
-
opus: ["audio/opus"],
|
|
6963
|
-
otf: ["font/otf"],
|
|
6964
|
-
png: ["image/png"],
|
|
6965
|
-
pdf: ["application/pdf"],
|
|
6966
|
-
php: ["application/php"],
|
|
6967
|
-
ppt: ["application/vnd.ms-powerpoint"],
|
|
6968
|
-
pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
6969
|
-
rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
|
|
6970
|
-
rtf: ["application/rtf"],
|
|
6971
|
-
sh: ["application/x-sh"],
|
|
6972
|
-
svg: ["image/svg+xml"],
|
|
6973
|
-
swf: ["application/x-shockwave-flash"],
|
|
6974
|
-
tar: ["application/x-tar"],
|
|
6975
|
-
tif: ["image/tiff"],
|
|
6976
|
-
tiff: ["image/tiff"],
|
|
6977
|
-
ts: ["video/mp2t"],
|
|
6978
|
-
ttf: ["font/ttf"],
|
|
6979
|
-
txt: ["text/plain"],
|
|
6980
|
-
vsd: ["application/vnd.visio"],
|
|
6981
|
-
wav: ["audio/wav"],
|
|
6982
|
-
weba: ["audio/webm"],
|
|
6983
|
-
webm: ["video/webm"],
|
|
6984
|
-
webp: ["image/webp"],
|
|
6985
|
-
woff: ["font/woff"],
|
|
6986
|
-
woff2: ["font/woff2"],
|
|
6987
|
-
xhtml: ["application/xhtml+xml"],
|
|
6988
|
-
xls: ["application/vnd.ms-excel"],
|
|
6989
|
-
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
6990
|
-
xml: ["application/xml", "text/xml"],
|
|
6991
|
-
xul: ["application/vnd.mozilla.xul+xml"],
|
|
6992
|
-
zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
|
|
6993
|
-
"3gp": ["video/3gpp", "audio/3gpp"],
|
|
6994
|
-
"3g2": ["video/3gpp2", "audio/3gpp2"],
|
|
6995
|
-
"7z": ["application/x-7z-compressed"],
|
|
6996
|
-
};
|
|
6997
|
-
return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
|
|
6998
|
-
}
|
|
6999
|
-
function snakeCaseToCamelCase(str) {
|
|
7000
|
-
const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
|
|
7001
|
-
if (snakeCaseRegexp.test(str)) {
|
|
7002
|
-
let camelCase = "";
|
|
7003
|
-
let arr = str.split("_");
|
|
7004
|
-
arr.forEach((word, idx) => {
|
|
7005
|
-
camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
|
|
7006
|
-
});
|
|
7007
|
-
return camelCase;
|
|
7008
|
-
}
|
|
7009
|
-
else {
|
|
7010
|
-
return str;
|
|
7011
|
-
}
|
|
7012
|
-
}
|
|
7013
|
-
function getNewIndexToFocus(currentIndex, direction, listLength) {
|
|
7014
|
-
let newIndex = currentIndex;
|
|
7015
|
-
if (direction === "ArrowDown") {
|
|
7016
|
-
newIndex = (currentIndex + 1) % listLength;
|
|
7017
|
-
}
|
|
7018
|
-
if (direction === "ArrowUp") {
|
|
7019
|
-
newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
|
|
7020
|
-
}
|
|
7021
|
-
return newIndex;
|
|
7022
|
-
}
|
|
7023
|
-
function isRelatedTarget(ev, id) {
|
|
7024
|
-
// used for onBlur events to check the element that has been clicked
|
|
7025
|
-
const ids = id.split(" ");
|
|
7026
|
-
return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
|
|
7027
|
-
}
|
|
7028
|
-
/*
|
|
7029
|
-
* this is going to be needed to solve the extra tabbing on navigator
|
|
7030
|
-
* and for programmatic focus of tabs
|
|
7031
|
-
* Here's a draft, not bug proof, see:
|
|
7032
|
-
* https://stackoverflow.com/a/10730308/3741713
|
|
7033
|
-
|
|
7034
|
-
function getKeyboardFocusableElements(element = document) {
|
|
7035
|
-
const els = Array.from(element.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), wm-search, wm-timepicker, wm-tab-list, wm-tab-item, wm-button, wm-action-menu'));
|
|
7036
|
-
return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
|
|
7037
|
-
}
|
|
7038
|
-
|
|
7039
|
-
export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
|
|
7040
|
-
const els = getKeyboardFocusableElements();
|
|
7041
|
-
const current = els.indexOf(element);
|
|
7042
|
-
return els[current - 1] as HTMLElement;
|
|
7043
|
-
}
|
|
7044
|
-
|
|
7045
|
-
export function getNextKeyboardFocusableElement(element: HTMLElement) {
|
|
7046
|
-
const els = getKeyboardFocusableElements();
|
|
7047
|
-
const current = els.indexOf(element);
|
|
7048
|
-
return els[current + 1] as HTMLElement;
|
|
7049
|
-
}
|
|
6634
|
+
const DEFAULT_LANGUAGE = "en";
|
|
6635
|
+
function getBrowserLang() {
|
|
6636
|
+
const langAttr = document.documentElement.getAttribute("lang");
|
|
6637
|
+
if (!!langAttr) {
|
|
6638
|
+
return langAttr;
|
|
6639
|
+
}
|
|
6640
|
+
else if (window.navigator && window.navigator.language) {
|
|
6641
|
+
const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
|
|
6642
|
+
return lang.slice(0, 2);
|
|
6643
|
+
}
|
|
6644
|
+
else {
|
|
6645
|
+
return DEFAULT_LANGUAGE;
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
// prevents memory leak
|
|
6649
|
+
const cache = createIntlCache();
|
|
6650
|
+
const locale = getBrowserLang();
|
|
6651
|
+
const intl = createIntl({
|
|
6652
|
+
locale: locale,
|
|
6653
|
+
defaultLocale: "en",
|
|
6654
|
+
messages: lang[locale] || en,
|
|
6655
|
+
}, cache);
|
|
6656
|
+
function generateId() {
|
|
6657
|
+
return "wmcl-" + Math.random().toString(36).substr(2, 10);
|
|
6658
|
+
}
|
|
6659
|
+
function debounce(fn, wait) {
|
|
6660
|
+
let timeout;
|
|
6661
|
+
return function () {
|
|
6662
|
+
const context = this;
|
|
6663
|
+
const functionCall = () => fn.apply(context, arguments);
|
|
6664
|
+
clearTimeout(timeout);
|
|
6665
|
+
timeout = setTimeout(functionCall, wait);
|
|
6666
|
+
};
|
|
6667
|
+
}
|
|
6668
|
+
function getTextDir() {
|
|
6669
|
+
const dir = document.querySelector("html").getAttribute("dir");
|
|
6670
|
+
return dir ? dir.toLowerCase() : "";
|
|
6671
|
+
}
|
|
6672
|
+
function getPosition(el) {
|
|
6673
|
+
const coords = el.getBoundingClientRect();
|
|
6674
|
+
let x = coords.x;
|
|
6675
|
+
let y = coords.y;
|
|
6676
|
+
// Edge doesn't have x and y
|
|
6677
|
+
if (!x) {
|
|
6678
|
+
if (getTextDir() === "rtl") {
|
|
6679
|
+
x = coords.right;
|
|
6680
|
+
}
|
|
6681
|
+
else {
|
|
6682
|
+
x = coords.left;
|
|
6683
|
+
}
|
|
6684
|
+
y = coords.top;
|
|
6685
|
+
}
|
|
6686
|
+
return { x, y };
|
|
6687
|
+
}
|
|
6688
|
+
function findParentWithScrollbar(el) {
|
|
6689
|
+
while (!!el) {
|
|
6690
|
+
if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
|
|
6691
|
+
return el;
|
|
6692
|
+
}
|
|
6693
|
+
el = el.parentElement;
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
function findParentWithHiddenOverflow(el) {
|
|
6697
|
+
while (!!el) {
|
|
6698
|
+
if (window.getComputedStyle(el).overflowY !== "visible") {
|
|
6699
|
+
return el;
|
|
6700
|
+
}
|
|
6701
|
+
el = el.parentElement;
|
|
6702
|
+
}
|
|
6703
|
+
}
|
|
6704
|
+
function getClosableElementMeasurements(fixedEl, closableEl) {
|
|
6705
|
+
const parent = findParentWithHiddenOverflow(fixedEl);
|
|
6706
|
+
// if parent is not found, measurements are checked against the viewport
|
|
6707
|
+
return {
|
|
6708
|
+
closableElHeight: closableEl.clientHeight,
|
|
6709
|
+
closableElWidth: closableEl.clientWidth,
|
|
6710
|
+
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6711
|
+
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6712
|
+
spaceAbove: parent
|
|
6713
|
+
? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
|
|
6714
|
+
: fixedEl.getBoundingClientRect().top,
|
|
6715
|
+
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6716
|
+
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6717
|
+
spaceBelow: parent
|
|
6718
|
+
? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
|
|
6719
|
+
: document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
|
|
6720
|
+
spaceLeft: parent
|
|
6721
|
+
? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
|
|
6722
|
+
: fixedEl.getBoundingClientRect().left,
|
|
6723
|
+
spaceRight: parent
|
|
6724
|
+
? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
|
|
6725
|
+
: document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
|
|
6726
|
+
};
|
|
6727
|
+
}
|
|
6728
|
+
function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
|
|
6729
|
+
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6730
|
+
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6731
|
+
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6732
|
+
) {
|
|
6733
|
+
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6734
|
+
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6735
|
+
const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
|
|
6736
|
+
return openUp;
|
|
6737
|
+
}
|
|
6738
|
+
function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
|
|
6739
|
+
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6740
|
+
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6741
|
+
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6742
|
+
) {
|
|
6743
|
+
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6744
|
+
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6745
|
+
const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
|
|
6746
|
+
return openDown;
|
|
6747
|
+
}
|
|
6748
|
+
function shouldShiftRight(fixedEl, closableEl) {
|
|
6749
|
+
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6750
|
+
const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
|
|
6751
|
+
return needsSpaceLeft;
|
|
6752
|
+
}
|
|
6753
|
+
function shouldShiftLeft(fixedEl, closableEl) {
|
|
6754
|
+
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6755
|
+
const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
|
|
6756
|
+
return needsSpaceRight;
|
|
6757
|
+
}
|
|
6758
|
+
function adjustTooltipPosition(tPos, el, tooltipEl) {
|
|
6759
|
+
// position must be reset before measurements are taken in adjustTooltipPosition
|
|
6760
|
+
// otherwise text-wrapping from previous position makes width measurement inconsistent
|
|
6761
|
+
tooltipEl.style.top = "";
|
|
6762
|
+
tooltipEl.style.left = "";
|
|
6763
|
+
const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
|
|
6764
|
+
const tooltipWidth = tooltipEl.getBoundingClientRect().width;
|
|
6765
|
+
const tooltipHeight = tooltipEl.getBoundingClientRect().height;
|
|
6766
|
+
const enoughSpaceAbove = spaceAbove > tooltipHeight;
|
|
6767
|
+
const enoughSpaceBelow = spaceBelow > tooltipHeight;
|
|
6768
|
+
// a tooltip should never be closer than 24px to the edge of a screen
|
|
6769
|
+
const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
|
|
6770
|
+
const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
|
|
6771
|
+
const swapAbove = (position) => {
|
|
6772
|
+
return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
|
|
6773
|
+
};
|
|
6774
|
+
const swapBelow = (position) => {
|
|
6775
|
+
return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
|
|
6776
|
+
};
|
|
6777
|
+
const swapLeft = (position, centeredPosition) => {
|
|
6778
|
+
if (!enoughSpaceLeft && enoughSpaceRight) {
|
|
6779
|
+
position = position.replace("left", "right");
|
|
6780
|
+
}
|
|
6781
|
+
else if (!enoughSpaceLeft && !enoughSpaceRight) {
|
|
6782
|
+
position = centeredPosition;
|
|
6783
|
+
}
|
|
6784
|
+
return position;
|
|
6785
|
+
};
|
|
6786
|
+
const swapRight = (position, centeredPosition) => {
|
|
6787
|
+
if (!enoughSpaceRight && enoughSpaceLeft) {
|
|
6788
|
+
position = position.replace("right", "left");
|
|
6789
|
+
}
|
|
6790
|
+
else if (!enoughSpaceRight && !enoughSpaceLeft) {
|
|
6791
|
+
position = centeredPosition;
|
|
6792
|
+
}
|
|
6793
|
+
return position;
|
|
6794
|
+
};
|
|
6795
|
+
// horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
|
|
6796
|
+
switch (tPos) {
|
|
6797
|
+
case "left":
|
|
6798
|
+
tPos = swapLeft(tPos, "bottom");
|
|
6799
|
+
case "right":
|
|
6800
|
+
tPos = swapRight(tPos, "bottom");
|
|
6801
|
+
case "top-left":
|
|
6802
|
+
tPos = swapLeft(tPos, "top");
|
|
6803
|
+
tPos = swapAbove(tPos);
|
|
6804
|
+
case "top-right":
|
|
6805
|
+
tPos = swapRight(tPos, "top");
|
|
6806
|
+
tPos = swapAbove(tPos);
|
|
6807
|
+
case "bottom-left":
|
|
6808
|
+
tPos = swapLeft(tPos, "bottom");
|
|
6809
|
+
tPos = swapBelow(tPos);
|
|
6810
|
+
case "bottom-right":
|
|
6811
|
+
tPos = swapRight(tPos, "bottom");
|
|
6812
|
+
tPos = swapBelow(tPos);
|
|
6813
|
+
case "top":
|
|
6814
|
+
tPos = swapAbove(tPos);
|
|
6815
|
+
case "bottom":
|
|
6816
|
+
tPos = swapBelow(tPos);
|
|
6817
|
+
}
|
|
6818
|
+
return tPos;
|
|
6819
|
+
}
|
|
6820
|
+
function hasRoomRight(x, spaceNeeded) {
|
|
6821
|
+
let horizOffset = 0;
|
|
6822
|
+
// if (getTextDir() === "ltr") {
|
|
6823
|
+
if (x.type === "click") {
|
|
6824
|
+
// if it's a mouse event, deal with mouse coords
|
|
6825
|
+
horizOffset = x.clientX;
|
|
6826
|
+
// if it's a focus event, the offset is 0
|
|
6827
|
+
}
|
|
6828
|
+
else if (x.type === "focus") {
|
|
6829
|
+
horizOffset = 0;
|
|
6830
|
+
}
|
|
6831
|
+
else {
|
|
6832
|
+
// otherwise an element was passed, calculate how far it is from the edge of the window
|
|
6833
|
+
let el = x; // re-assignment is for clarity
|
|
6834
|
+
while (el) {
|
|
6835
|
+
if (el.tagName == "BODY") {
|
|
6836
|
+
// deal with browser quirks with body/window/document and page scroll
|
|
6837
|
+
var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
6838
|
+
horizOffset += el.offsetLeft - xScroll + el.clientLeft;
|
|
6839
|
+
}
|
|
6840
|
+
else {
|
|
6841
|
+
// for all other non-BODY elements
|
|
6842
|
+
horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
|
|
6843
|
+
}
|
|
6844
|
+
el = el.offsetParent;
|
|
6845
|
+
}
|
|
6846
|
+
// }
|
|
6847
|
+
}
|
|
6848
|
+
return window.innerWidth - horizOffset >= spaceNeeded;
|
|
6849
|
+
}
|
|
6850
|
+
function checkForActiveElInShadow(element) {
|
|
6851
|
+
while (element && element.shadowRoot) {
|
|
6852
|
+
element = element.shadowRoot.activeElement;
|
|
6853
|
+
}
|
|
6854
|
+
return element;
|
|
6855
|
+
}
|
|
6856
|
+
function checkForFocusableElInShadow(element) {
|
|
6857
|
+
const selectors = [
|
|
6858
|
+
"button",
|
|
6859
|
+
"a",
|
|
6860
|
+
"input",
|
|
6861
|
+
"select",
|
|
6862
|
+
"textarea",
|
|
6863
|
+
"wm-button",
|
|
6864
|
+
"wm-search",
|
|
6865
|
+
"wm-select",
|
|
6866
|
+
"wm-action-menu",
|
|
6867
|
+
"wm-tab-item",
|
|
6868
|
+
"wm-datepicker",
|
|
6869
|
+
];
|
|
6870
|
+
let focusableEl = element;
|
|
6871
|
+
selectors.forEach((selector) => {
|
|
6872
|
+
if (focusableEl && focusableEl.shadowRoot) {
|
|
6873
|
+
let elInShadow = focusableEl.shadowRoot.querySelector(selector);
|
|
6874
|
+
if (elInShadow) {
|
|
6875
|
+
if (selector.startsWith("wm-")) {
|
|
6876
|
+
focusableEl = checkForFocusableElInShadow(elInShadow);
|
|
6877
|
+
}
|
|
6878
|
+
else {
|
|
6879
|
+
focusableEl = elInShadow;
|
|
6880
|
+
}
|
|
6881
|
+
}
|
|
6882
|
+
}
|
|
6883
|
+
});
|
|
6884
|
+
return focusableEl;
|
|
6885
|
+
}
|
|
6886
|
+
function isFocusable(element) {
|
|
6887
|
+
if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
|
|
6888
|
+
return true;
|
|
6889
|
+
}
|
|
6890
|
+
if (element.disabled) {
|
|
6891
|
+
return false;
|
|
6892
|
+
}
|
|
6893
|
+
switch (element.nodeName) {
|
|
6894
|
+
case "A":
|
|
6895
|
+
return !!element.href && element.rel != "ignore";
|
|
6896
|
+
case "INPUT":
|
|
6897
|
+
return element.type != "hidden" && element.type != "file";
|
|
6898
|
+
case "BUTTON":
|
|
6899
|
+
case "SELECT":
|
|
6900
|
+
case "TEXTAREA":
|
|
6901
|
+
case "WM-BUTTON":
|
|
6902
|
+
case "WM-SELECT":
|
|
6903
|
+
case "WM-ACTION-MENU":
|
|
6904
|
+
case "WM-DATEPICKER":
|
|
6905
|
+
case "WM-TIMEPICKER":
|
|
6906
|
+
case "WM-INPUT":
|
|
6907
|
+
case "WM-TAG-INPUT":
|
|
6908
|
+
case "WM-TAB-ITEM":
|
|
6909
|
+
case "WM-SEARCH":
|
|
6910
|
+
return true;
|
|
6911
|
+
default:
|
|
6912
|
+
return false;
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
function getFirstFocusableDescendant(element) {
|
|
6916
|
+
if (isFocusable(element)) {
|
|
6917
|
+
return checkForFocusableElInShadow(element);
|
|
6918
|
+
}
|
|
6919
|
+
else if (element.childNodes.length > 0) {
|
|
6920
|
+
element.childNodes.forEach((i) => {
|
|
6921
|
+
const childEl = getFirstFocusableDescendant(i);
|
|
6922
|
+
return childEl && checkForFocusableElInShadow(childEl);
|
|
6923
|
+
});
|
|
6924
|
+
}
|
|
6925
|
+
}
|
|
6926
|
+
function hasValidType(file, types) {
|
|
6927
|
+
const acceptedExtensions = types.split(" ");
|
|
6928
|
+
const parts = file.name && file.name.split(".");
|
|
6929
|
+
const ext = parts && parts.length > 1 && parts[parts.length - 1];
|
|
6930
|
+
return ext
|
|
6931
|
+
? acceptedExtensions.includes(ext.toLowerCase())
|
|
6932
|
+
: // fallback: if we couldn't obtain an extension,
|
|
6933
|
+
// validate based on MIME type...
|
|
6934
|
+
!!file.type
|
|
6935
|
+
? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
|
|
6936
|
+
: // ...and if that failed too, accept the file
|
|
6937
|
+
// as it's preferable to accept an invalid file
|
|
6938
|
+
// than refusing a valid one (back-end will take care of what slips through)
|
|
6939
|
+
true;
|
|
6940
|
+
}
|
|
6941
|
+
// takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
|
|
6942
|
+
function getAcceptedMimeTypesList(acceptedExtensions) {
|
|
6943
|
+
// this is just a list of common file types (regardless of whether they are/can be valid or not)
|
|
6944
|
+
// front end checks are just a convenience to users, independent of security.
|
|
6945
|
+
// it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
|
|
6946
|
+
const lookupTable = {
|
|
6947
|
+
aac: ["audio/aac"],
|
|
6948
|
+
abw: ["application/x-abiword"],
|
|
6949
|
+
arc: ["application/x-freearc"],
|
|
6950
|
+
avi: ["video/x-msvideo"],
|
|
6951
|
+
azw: ["application/vnd.amazon.ebook"],
|
|
6952
|
+
bin: ["application/octet-stream"],
|
|
6953
|
+
bmp: ["image/bmp"],
|
|
6954
|
+
bz: ["application/x-bzip"],
|
|
6955
|
+
bz2: ["application/x-bzip2"],
|
|
6956
|
+
csh: ["application/x-csh"],
|
|
6957
|
+
css: ["text/css"],
|
|
6958
|
+
csv: ["text/csv"],
|
|
6959
|
+
doc: ["application/msword"],
|
|
6960
|
+
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
6961
|
+
eot: ["application/vnd.ms-fontobject"],
|
|
6962
|
+
epub: ["application/epub+zip"],
|
|
6963
|
+
gz: ["application/gzip"],
|
|
6964
|
+
gif: ["image/gif"],
|
|
6965
|
+
htm: ["text/html"],
|
|
6966
|
+
html: ["text/html"],
|
|
6967
|
+
ico: ["image/vnd.microsoft.icon"],
|
|
6968
|
+
ics: ["text/calendar"],
|
|
6969
|
+
jar: ["application/java-archive"],
|
|
6970
|
+
jpeg: ["image/jpeg"],
|
|
6971
|
+
jpg: ["image/jpeg"],
|
|
6972
|
+
js: ["text/javascript"],
|
|
6973
|
+
json: ["application/json"],
|
|
6974
|
+
jsonld: ["application/ld+json"],
|
|
6975
|
+
log: ["text/plain"],
|
|
6976
|
+
mid: ["audio/x-midi"],
|
|
6977
|
+
midi: ["audio/x-midi"],
|
|
6978
|
+
mjs: ["text/javascript"],
|
|
6979
|
+
mp3: ["audio/mpeg"],
|
|
6980
|
+
mpeg: ["video/mpeg"],
|
|
6981
|
+
mpkg: ["application/vnd.apple.installer+xml"],
|
|
6982
|
+
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
6983
|
+
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
6984
|
+
odt: ["application/vnd.oasis.opendocument.text"],
|
|
6985
|
+
oga: ["audio/ogg"],
|
|
6986
|
+
ogv: ["video/ogg"],
|
|
6987
|
+
ogx: ["application/ogg"],
|
|
6988
|
+
opus: ["audio/opus"],
|
|
6989
|
+
otf: ["font/otf"],
|
|
6990
|
+
png: ["image/png"],
|
|
6991
|
+
pdf: ["application/pdf"],
|
|
6992
|
+
php: ["application/php"],
|
|
6993
|
+
ppt: ["application/vnd.ms-powerpoint"],
|
|
6994
|
+
pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
6995
|
+
rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
|
|
6996
|
+
rtf: ["application/rtf"],
|
|
6997
|
+
sh: ["application/x-sh"],
|
|
6998
|
+
svg: ["image/svg+xml"],
|
|
6999
|
+
swf: ["application/x-shockwave-flash"],
|
|
7000
|
+
tar: ["application/x-tar"],
|
|
7001
|
+
tif: ["image/tiff"],
|
|
7002
|
+
tiff: ["image/tiff"],
|
|
7003
|
+
ts: ["video/mp2t"],
|
|
7004
|
+
ttf: ["font/ttf"],
|
|
7005
|
+
txt: ["text/plain"],
|
|
7006
|
+
vsd: ["application/vnd.visio"],
|
|
7007
|
+
wav: ["audio/wav"],
|
|
7008
|
+
weba: ["audio/webm"],
|
|
7009
|
+
webm: ["video/webm"],
|
|
7010
|
+
webp: ["image/webp"],
|
|
7011
|
+
woff: ["font/woff"],
|
|
7012
|
+
woff2: ["font/woff2"],
|
|
7013
|
+
xhtml: ["application/xhtml+xml"],
|
|
7014
|
+
xls: ["application/vnd.ms-excel"],
|
|
7015
|
+
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
7016
|
+
xml: ["application/xml", "text/xml"],
|
|
7017
|
+
xul: ["application/vnd.mozilla.xul+xml"],
|
|
7018
|
+
zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
|
|
7019
|
+
"3gp": ["video/3gpp", "audio/3gpp"],
|
|
7020
|
+
"3g2": ["video/3gpp2", "audio/3gpp2"],
|
|
7021
|
+
"7z": ["application/x-7z-compressed"],
|
|
7022
|
+
};
|
|
7023
|
+
return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
|
|
7024
|
+
}
|
|
7025
|
+
function snakeCaseToCamelCase(str) {
|
|
7026
|
+
const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
|
|
7027
|
+
if (snakeCaseRegexp.test(str)) {
|
|
7028
|
+
let camelCase = "";
|
|
7029
|
+
let arr = str.split("_");
|
|
7030
|
+
arr.forEach((word, idx) => {
|
|
7031
|
+
camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
|
|
7032
|
+
});
|
|
7033
|
+
return camelCase;
|
|
7034
|
+
}
|
|
7035
|
+
else {
|
|
7036
|
+
return str;
|
|
7037
|
+
}
|
|
7038
|
+
}
|
|
7039
|
+
function getNewIndexToFocus(currentIndex, direction, listLength) {
|
|
7040
|
+
let newIndex = currentIndex;
|
|
7041
|
+
if (direction === "ArrowDown") {
|
|
7042
|
+
newIndex = (currentIndex + 1) % listLength;
|
|
7043
|
+
}
|
|
7044
|
+
if (direction === "ArrowUp") {
|
|
7045
|
+
newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
|
|
7046
|
+
}
|
|
7047
|
+
return newIndex;
|
|
7048
|
+
}
|
|
7049
|
+
function isRelatedTarget(ev, id) {
|
|
7050
|
+
// used for onBlur events to check the element that has been clicked
|
|
7051
|
+
const ids = id.split(" ");
|
|
7052
|
+
return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
|
|
7053
|
+
}
|
|
7054
|
+
/*
|
|
7055
|
+
* this is going to be needed to solve the extra tabbing on navigator
|
|
7056
|
+
* and for programmatic focus of tabs
|
|
7057
|
+
* Here's a draft, not bug proof, see:
|
|
7058
|
+
* https://stackoverflow.com/a/10730308/3741713
|
|
7059
|
+
|
|
7060
|
+
function getKeyboardFocusableElements(element = document) {
|
|
7061
|
+
const els = Array.from(element.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), wm-search, wm-timepicker, wm-tab-list, wm-tab-item, wm-button, wm-action-menu'));
|
|
7062
|
+
return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
|
|
7063
|
+
}
|
|
7064
|
+
|
|
7065
|
+
export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
|
|
7066
|
+
const els = getKeyboardFocusableElements();
|
|
7067
|
+
const current = els.indexOf(element);
|
|
7068
|
+
return els[current - 1] as HTMLElement;
|
|
7069
|
+
}
|
|
7070
|
+
|
|
7071
|
+
export function getNextKeyboardFocusableElement(element: HTMLElement) {
|
|
7072
|
+
const els = getKeyboardFocusableElements();
|
|
7073
|
+
const current = els.indexOf(element);
|
|
7074
|
+
return els[current + 1] as HTMLElement;
|
|
7075
|
+
}
|
|
7050
7076
|
*/
|
|
7051
7077
|
|
|
7052
7078
|
export { adjustTooltipPosition as a, getPosition as b, checkForActiveElInShadow as c, debounce as d, isRelatedTarget as e, findParentWithScrollbar as f, generateId as g, checkForFocusableElInShadow as h, intl as i, getFirstFocusableDescendant as j, getNewIndexToFocus as k, shouldOpenUp as l, shouldOpenDown as m, shouldShiftRight as n, shouldShiftLeft as o, hasValidType as p, getTextDir as q, hasRoomRight as r, snakeCaseToCamelCase as s };
|