@watermarkinsights/ripple 3.10.0-0 → 3.10.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/README.md +3 -3
- package/dist/cjs/{chartFunctions-05b9dcc7.js → chartFunctions-829efa13.js} +420 -417
- package/dist/cjs/{functions-71c85bae.js → functions-3b1b7c26.js} +542 -512
- package/dist/cjs/{global-f98992f4.js → global-68b6a831.js} +60 -60
- package/dist/cjs/{http-service-494d81de.js → http-service-9e8c4dd5.js} +49 -49
- package/dist/cjs/{index-98c6524c.js → index-df6a3611.js} +100 -65
- 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 +87 -87
- package/dist/cjs/priv-datepicker.cjs.entry.js +659 -659
- 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 +228 -228
- package/dist/cjs/wm-chart-slice.cjs.entry.js +14 -14
- package/dist/cjs/wm-chart.cjs.entry.js +117 -116
- package/dist/cjs/wm-datepicker.cjs.entry.js +267 -267
- 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_3.cjs.entry.js +229 -222
- package/dist/cjs/wm-navigator.cjs.entry.js +269 -269
- package/dist/cjs/wm-network-uploader.cjs.entry.js +454 -454
- package/dist/cjs/wm-option_2.cjs.entry.js +487 -487
- package/dist/cjs/wm-pagination.cjs.entry.js +168 -168
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +136 -135
- 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 +298 -298
- 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 +380 -380
- package/dist/cjs/wm-wrapper.cjs.entry.js +13 -13
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +258 -258
- package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +115 -115
- package/dist/collection/components/charts/wm-chart/wm-chart.js +334 -332
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +201 -199
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +88 -88
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +111 -111
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +460 -460
- package/dist/collection/components/wm-button/wm-button.css +1 -2
- package/dist/collection/components/wm-button/wm-button.js +491 -491
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +3 -4
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1024 -1024
- package/dist/collection/components/wm-datepicker/wm-datepicker.css +1 -2
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +471 -471
- package/dist/collection/components/wm-input/wm-input.css +1 -2
- package/dist/collection/components/wm-input/wm-input.js +423 -423
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
- package/dist/collection/components/wm-modal/wm-modal-footer.js +141 -141
- package/dist/collection/components/wm-modal/wm-modal-header.js +92 -92
- package/dist/collection/components/wm-modal/wm-modal.js +461 -461
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.css +1 -2
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +162 -162
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +121 -121
- package/dist/collection/components/wm-navigation/wm-navigation.js +218 -211
- 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.js +114 -114
- package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
- package/dist/collection/components/wm-option/wm-option.css +2 -3
- package/dist/collection/components/wm-option/wm-option.js +414 -414
- package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
- package/dist/collection/components/wm-search/wm-search.js +480 -480
- package/dist/collection/components/wm-select/wm-select.css +2 -3
- package/dist/collection/components/wm-select/wm-select.js +718 -718
- package/dist/collection/components/wm-snackbar/wm-snackbar.css +2 -3
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +2 -2
- 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.js +330 -330
- 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 -3
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +810 -810
- package/dist/collection/components/wm-timepicker/wm-timepicker.css +2 -3
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
- package/dist/collection/components/wm-toggletip/wm-toggletip.css +1 -2
- 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 -2
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +785 -785
- package/dist/collection/components/wm-uploader/wm-uploader.css +1 -2
- package/dist/collection/components/wm-uploader/wm-uploader.js +780 -780
- 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/chartFunctions.js +421 -418
- package/dist/collection/global/functions.js +468 -468
- package/dist/collection/global/global.js +67 -67
- 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 +43 -43
- package/dist/collection/lang/piglatin.js +93 -93
- package/dist/esm/{chartFunctions-b24ba065.js → chartFunctions-1ea300b2.js} +420 -417
- package/dist/esm/{functions-117d1a51.js → functions-124ec8e6.js} +542 -512
- package/dist/esm/{global-6a9c8257.js → global-482afd31.js} +60 -60
- package/dist/esm/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +49 -49
- package/dist/esm/{index-d649a861.js → index-17c79cc6.js} +100 -65
- 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 +87 -87
- package/dist/esm/priv-datepicker.entry.js +659 -659
- 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 +228 -228
- package/dist/esm/wm-chart-slice.entry.js +14 -14
- package/dist/esm/wm-chart.entry.js +117 -116
- package/dist/esm/wm-datepicker.entry.js +267 -267
- 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_3.entry.js +229 -222
- package/dist/esm/wm-navigator.entry.js +269 -269
- package/dist/esm/wm-network-uploader.entry.js +454 -454
- package/dist/esm/wm-option_2.entry.js +487 -487
- package/dist/esm/wm-pagination.entry.js +168 -168
- package/dist/esm/wm-progress-indicator_3.entry.js +136 -135
- 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 +298 -298
- 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 +380 -380
- package/dist/esm/wm-wrapper.entry.js +13 -13
- package/dist/esm-es5/chartFunctions-1ea300b2.js +1 -0
- package/dist/esm-es5/functions-124ec8e6.js +15 -0
- package/dist/esm-es5/global-482afd31.js +1 -0
- package/dist/esm-es5/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +1 -1
- package/dist/esm-es5/index-17c79cc6.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_3.entry.js +1 -1
- 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-progress-indicator_3.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-f5df5903.system.js → p-08b7ec08.system.js} +0 -0
- package/dist/ripple/p-09f954eb.system.js +1 -0
- package/dist/ripple/p-0c7c9b89.entry.js +1 -0
- package/dist/ripple/{p-ddf157c8.system.entry.js → p-14eab45c.system.entry.js} +1 -1
- package/dist/ripple/{p-0ebed4b8.system.entry.js → p-1acaa65d.system.entry.js} +1 -1
- package/dist/ripple/p-1ace795c.system.entry.js +1 -0
- package/dist/ripple/p-1edf9946.system.entry.js +1 -0
- package/dist/ripple/p-1f35a8f1.js +16 -0
- package/dist/ripple/{p-6cf47163.entry.js → p-1fe3ad2b.entry.js} +1 -1
- package/dist/ripple/p-259f7450.system.entry.js +1 -0
- package/dist/ripple/{p-6c295beb.entry.js → p-262c75ff.entry.js} +1 -1
- package/dist/ripple/{p-099df7b7.system.entry.js → p-27253ed2.system.entry.js} +1 -1
- package/dist/ripple/p-28b051a3.system.entry.js +1 -0
- package/dist/ripple/p-2a66f447.entry.js +1 -0
- package/dist/ripple/p-313b6073.system.js +1 -0
- package/dist/ripple/{p-efe7728e.entry.js → p-37553d4e.entry.js} +1 -1
- package/dist/ripple/{p-570fb53b.entry.js → p-3a940fd1.entry.js} +1 -1
- package/dist/ripple/p-426b392a.entry.js +1 -0
- package/dist/ripple/p-557dd7f5.system.entry.js +1 -0
- package/dist/ripple/{p-2b6246d9.entry.js → p-57c94258.entry.js} +1 -1
- package/dist/ripple/{p-bfc1ab2e.system.entry.js → p-59678b70.system.entry.js} +1 -1
- package/dist/ripple/{p-7c2b1682.entry.js → p-5b213951.entry.js} +1 -1
- package/dist/ripple/p-5f4686a3.system.js +15 -0
- package/dist/ripple/p-68361541.entry.js +1 -0
- package/dist/ripple/p-6bf64cc9.system.entry.js +1 -0
- package/dist/ripple/p-726b9452.system.js +1 -0
- package/dist/ripple/{p-4f581ab3.entry.js → p-76e184fb.entry.js} +1 -1
- package/dist/ripple/p-77415d3b.entry.js +1 -0
- package/dist/ripple/p-7c2a8479.entry.js +1 -0
- package/dist/ripple/p-7ec83929.entry.js +1 -0
- package/dist/ripple/p-84a3d723.entry.js +1 -0
- package/dist/ripple/{p-269fa39c.system.entry.js → p-87a7ab75.system.entry.js} +1 -1
- package/dist/ripple/p-87c13bc7.js +1 -0
- package/dist/ripple/{p-43f1298b.js → p-888bec42.js} +0 -0
- package/dist/ripple/{p-1e7fc028.entry.js → p-962f51ff.entry.js} +1 -1
- package/dist/ripple/{p-e7a7d732.entry.js → p-96898754.entry.js} +1 -1
- package/dist/ripple/p-96b8d112.system.entry.js +1 -0
- package/dist/ripple/p-9a52566b.system.entry.js +1 -0
- package/dist/ripple/p-9a5281d9.system.js +1 -0
- package/dist/ripple/p-9bbdf766.entry.js +1 -0
- package/dist/ripple/{p-ffb97b6d.system.entry.js → p-9d3b13d8.system.entry.js} +1 -1
- package/dist/ripple/{p-03d6014a.system.entry.js → p-9debb1cd.system.entry.js} +1 -1
- package/dist/ripple/p-a0635779.entry.js +1 -0
- package/dist/ripple/p-a37fe057.system.entry.js +1 -0
- package/dist/ripple/{p-fd8070fb.js → p-a6d6eae7.js} +0 -0
- package/dist/ripple/{p-22759dd5.entry.js → p-aeda3309.entry.js} +1 -1
- package/dist/ripple/{p-6c751341.entry.js → p-b0536ddb.entry.js} +1 -1
- package/dist/ripple/{p-a5a47a23.entry.js → p-b5df33e3.entry.js} +1 -1
- package/dist/ripple/{p-57f2feb0.entry.js → p-bd5d5a76.entry.js} +1 -1
- package/dist/ripple/p-beb10404.system.entry.js +1 -0
- package/dist/ripple/{p-e8e2228d.system.entry.js → p-c02c7a93.system.entry.js} +1 -1
- package/dist/ripple/p-c2abdcba.js +1 -0
- package/dist/ripple/{p-210039cc.system.entry.js → p-c332f020.system.entry.js} +1 -1
- package/dist/ripple/p-caaae868.entry.js +1 -0
- package/dist/ripple/{p-25b81952.entry.js → p-ccf1547c.entry.js} +1 -1
- package/dist/ripple/p-d3438746.system.js +1 -0
- package/dist/ripple/{p-64e8fb6e.system.entry.js → p-d8544aaa.system.entry.js} +1 -1
- package/dist/ripple/p-daa4d5b2.system.entry.js +1 -0
- package/dist/ripple/{p-a1511315.system.entry.js → p-db44eb6f.system.entry.js} +1 -1
- package/dist/ripple/p-de192292.system.entry.js +1 -0
- package/dist/ripple/p-e8006085.system.entry.js +1 -0
- package/dist/ripple/{p-2b63995f.system.entry.js → p-f17076c4.system.entry.js} +1 -1
- package/dist/ripple/p-f1a93fa1.system.entry.js +1 -0
- package/dist/ripple/p-fc7bf66e.entry.js +1 -0
- package/dist/ripple/p-fd8883a5.entry.js +1 -0
- package/dist/ripple/p-fd9b3760.system.entry.js +1 -0
- package/dist/ripple/p-fe281d40.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -0
- package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
- package/dist/types/components/charts/wm-chart/wm-chart.d.ts +36 -35
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +27 -0
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +17 -0
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +48 -48
- package/dist/types/components/wm-button/wm-button.d.ts +43 -43
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +41 -41
- 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 +21 -21
- package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
- package/dist/types/components/wm-navigation/wm-navigation.d.ts +28 -30
- 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 +24 -24
- package/dist/types/global/__mocks__/functions.d.ts +6 -6
- package/dist/types/global/chartFunctions.d.ts +29 -29
- package/dist/types/global/functions.d.ts +42 -42
- package/dist/types/global/global.d.ts +1 -1
- package/dist/types/global/interfaces.d.ts +44 -44
- 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/chartFunctions-b24ba065.js +0 -1
- package/dist/esm-es5/functions-117d1a51.js +0 -15
- package/dist/esm-es5/global-6a9c8257.js +0 -1
- package/dist/esm-es5/index-d649a861.js +0 -1
- package/dist/ripple/p-0cffec65.entry.js +0 -1
- package/dist/ripple/p-13e2891c.system.js +0 -1
- package/dist/ripple/p-18261104.system.entry.js +0 -1
- package/dist/ripple/p-1b1e006a.entry.js +0 -1
- package/dist/ripple/p-26c9f5af.entry.js +0 -1
- package/dist/ripple/p-276ed011.js +0 -16
- package/dist/ripple/p-2c8a26f2.js +0 -1
- package/dist/ripple/p-38bb7f05.system.entry.js +0 -1
- package/dist/ripple/p-50be3b44.js +0 -1
- package/dist/ripple/p-5176b826.system.js +0 -15
- package/dist/ripple/p-5627e44d.entry.js +0 -1
- package/dist/ripple/p-5d6cc9da.system.js +0 -1
- package/dist/ripple/p-5e164260.system.entry.js +0 -1
- package/dist/ripple/p-6f59ed45.js +0 -1
- package/dist/ripple/p-772576d7.system.entry.js +0 -1
- package/dist/ripple/p-7779bfbe.system.entry.js +0 -1
- package/dist/ripple/p-81ddf5a0.entry.js +0 -1
- package/dist/ripple/p-83d22032.system.entry.js +0 -1
- package/dist/ripple/p-846e9391.entry.js +0 -1
- package/dist/ripple/p-8a96b188.system.entry.js +0 -1
- package/dist/ripple/p-8cf7ce7e.system.entry.js +0 -1
- package/dist/ripple/p-969af068.system.entry.js +0 -1
- package/dist/ripple/p-9a4aca88.system.entry.js +0 -1
- package/dist/ripple/p-9aa6cd9f.entry.js +0 -1
- package/dist/ripple/p-9c20bc1f.system.entry.js +0 -1
- package/dist/ripple/p-9d02957d.system.js +0 -1
- package/dist/ripple/p-9d49f21e.entry.js +0 -1
- package/dist/ripple/p-9d8c246d.system.entry.js +0 -1
- package/dist/ripple/p-9df8a520.entry.js +0 -1
- package/dist/ripple/p-a1a2efca.system.entry.js +0 -1
- package/dist/ripple/p-a224d536.system.js +0 -1
- package/dist/ripple/p-b16373b9.system.entry.js +0 -1
- package/dist/ripple/p-b547bcf2.entry.js +0 -1
- package/dist/ripple/p-c8bb4b2b.entry.js +0 -1
- package/dist/ripple/p-d09fb6b5.entry.js +0 -1
- package/dist/ripple/p-e1b076be.entry.js +0 -1
- package/dist/ripple/p-ebae8cae.system.entry.js +0 -1
- package/dist/ripple/p-f54c4b0e.system.js +0 -1
|
@@ -3952,11 +3952,17 @@ function icuUnitToEcma(unit) {
|
|
|
3952
3952
|
return unit.replace(/^(.*?)-/, '');
|
|
3953
3953
|
}
|
|
3954
3954
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
3955
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
3955
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
3956
3956
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
3957
3957
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
3958
3958
|
function parseSignificantPrecision(str) {
|
|
3959
3959
|
var result = {};
|
|
3960
|
+
if (str[str.length - 1] === 'r') {
|
|
3961
|
+
result.roundingPriority = 'morePrecision';
|
|
3962
|
+
}
|
|
3963
|
+
else if (str[str.length - 1] === 's') {
|
|
3964
|
+
result.roundingPriority = 'lessPrecision';
|
|
3965
|
+
}
|
|
3960
3966
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {
|
|
3961
3967
|
// @@@ case
|
|
3962
3968
|
if (typeof g2 !== 'string') {
|
|
@@ -4183,8 +4189,13 @@ function parseNumberSkeleton(tokens) {
|
|
|
4183
4189
|
}
|
|
4184
4190
|
return '';
|
|
4185
4191
|
});
|
|
4186
|
-
|
|
4187
|
-
|
|
4192
|
+
var opt = token.options[0];
|
|
4193
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display
|
|
4194
|
+
if (opt === 'w') {
|
|
4195
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });
|
|
4196
|
+
}
|
|
4197
|
+
else if (opt) {
|
|
4198
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
4188
4199
|
}
|
|
4189
4200
|
continue;
|
|
4190
4201
|
}
|
|
@@ -4206,8 +4217,8 @@ function parseNumberSkeleton(tokens) {
|
|
|
4206
4217
|
}
|
|
4207
4218
|
|
|
4208
4219
|
var _a;
|
|
4209
|
-
var SPACE_SEPARATOR_START_REGEX = new RegExp("^"
|
|
4210
|
-
var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source
|
|
4220
|
+
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
4221
|
+
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
4211
4222
|
function createLocation(start, end) {
|
|
4212
4223
|
return { start: start, end: end };
|
|
4213
4224
|
}
|
|
@@ -4454,7 +4465,7 @@ var Parser = /** @class */ (function () {
|
|
|
4454
4465
|
return {
|
|
4455
4466
|
val: {
|
|
4456
4467
|
type: TYPE.literal,
|
|
4457
|
-
value: "<"
|
|
4468
|
+
value: "<".concat(tagName, "/>"),
|
|
4458
4469
|
location: createLocation(startPosition, this.clonePosition()),
|
|
4459
4470
|
},
|
|
4460
4471
|
err: null,
|
|
@@ -5059,7 +5070,7 @@ var Parser = /** @class */ (function () {
|
|
|
5059
5070
|
}
|
|
5060
5071
|
var code = codePointAt(this.message, offset);
|
|
5061
5072
|
if (code === undefined) {
|
|
5062
|
-
throw Error("Offset "
|
|
5073
|
+
throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
5063
5074
|
}
|
|
5064
5075
|
return code;
|
|
5065
5076
|
};
|
|
@@ -5127,7 +5138,7 @@ var Parser = /** @class */ (function () {
|
|
|
5127
5138
|
*/
|
|
5128
5139
|
Parser.prototype.bumpTo = function (targetOffset) {
|
|
5129
5140
|
if (this.offset() > targetOffset) {
|
|
5130
|
-
throw Error("targetOffset "
|
|
5141
|
+
throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
|
|
5131
5142
|
}
|
|
5132
5143
|
targetOffset = Math.min(targetOffset, this.message.length);
|
|
5133
5144
|
while (true) {
|
|
@@ -5136,7 +5147,7 @@ var Parser = /** @class */ (function () {
|
|
|
5136
5147
|
break;
|
|
5137
5148
|
}
|
|
5138
5149
|
if (offset > targetOffset) {
|
|
5139
|
-
throw Error("targetOffset "
|
|
5150
|
+
throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
|
|
5140
5151
|
}
|
|
5141
5152
|
this.bump();
|
|
5142
5153
|
if (this.isEOF()) {
|
|
@@ -5602,28 +5613,28 @@ var FormatError = /** @class */ (function (_super) {
|
|
|
5602
5613
|
return _this;
|
|
5603
5614
|
}
|
|
5604
5615
|
FormatError.prototype.toString = function () {
|
|
5605
|
-
return "[formatjs Error: "
|
|
5616
|
+
return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
|
|
5606
5617
|
};
|
|
5607
5618
|
return FormatError;
|
|
5608
5619
|
}(Error));
|
|
5609
5620
|
var InvalidValueError = /** @class */ (function (_super) {
|
|
5610
5621
|
__extends(InvalidValueError, _super);
|
|
5611
5622
|
function InvalidValueError(variableId, value, options, originalMessage) {
|
|
5612
|
-
return _super.call(this, "Invalid values for \""
|
|
5623
|
+
return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5613
5624
|
}
|
|
5614
5625
|
return InvalidValueError;
|
|
5615
5626
|
}(FormatError));
|
|
5616
5627
|
var InvalidValueTypeError = /** @class */ (function (_super) {
|
|
5617
5628
|
__extends(InvalidValueTypeError, _super);
|
|
5618
5629
|
function InvalidValueTypeError(value, type, originalMessage) {
|
|
5619
|
-
return _super.call(this, "Value for \""
|
|
5630
|
+
return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5620
5631
|
}
|
|
5621
5632
|
return InvalidValueTypeError;
|
|
5622
5633
|
}(FormatError));
|
|
5623
5634
|
var MissingValueError = /** @class */ (function (_super) {
|
|
5624
5635
|
__extends(MissingValueError, _super);
|
|
5625
5636
|
function MissingValueError(variableId, originalMessage) {
|
|
5626
|
-
return _super.call(this, "The intl string context variable \""
|
|
5637
|
+
return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
5627
5638
|
}
|
|
5628
5639
|
return MissingValueError;
|
|
5629
5640
|
}(FormatError));
|
|
@@ -5729,7 +5740,7 @@ originalMessage) {
|
|
|
5729
5740
|
? formats.time[el.style]
|
|
5730
5741
|
: isDateTimeSkeleton(el.style)
|
|
5731
5742
|
? el.style.parsedOptions
|
|
5732
|
-
:
|
|
5743
|
+
: formats.time.medium;
|
|
5733
5744
|
result.push({
|
|
5734
5745
|
type: PART_TYPE.literal,
|
|
5735
5746
|
value: formatters
|
|
@@ -5784,7 +5795,7 @@ originalMessage) {
|
|
|
5784
5795
|
continue;
|
|
5785
5796
|
}
|
|
5786
5797
|
if (isPluralElement(el)) {
|
|
5787
|
-
var opt = el.options["="
|
|
5798
|
+
var opt = el.options["=".concat(value)];
|
|
5788
5799
|
if (!opt) {
|
|
5789
5800
|
if (!Intl.PluralRules) {
|
|
5790
5801
|
throw new FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", ErrorCode.MISSING_INTL_API, originalMessage);
|
|
@@ -5855,7 +5866,7 @@ function createDefaultFormatters(cache) {
|
|
|
5855
5866
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5856
5867
|
args[_i] = arguments[_i];
|
|
5857
5868
|
}
|
|
5858
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5869
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5859
5870
|
}, {
|
|
5860
5871
|
cache: createFastMemoizeCache$1(cache.number),
|
|
5861
5872
|
strategy: strategies.variadic,
|
|
@@ -5866,7 +5877,7 @@ function createDefaultFormatters(cache) {
|
|
|
5866
5877
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5867
5878
|
args[_i] = arguments[_i];
|
|
5868
5879
|
}
|
|
5869
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5880
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5870
5881
|
}, {
|
|
5871
5882
|
cache: createFastMemoizeCache$1(cache.dateTime),
|
|
5872
5883
|
strategy: strategies.variadic,
|
|
@@ -5877,7 +5888,7 @@ function createDefaultFormatters(cache) {
|
|
|
5877
5888
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5878
5889
|
args[_i] = arguments[_i];
|
|
5879
5890
|
}
|
|
5880
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5891
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5881
5892
|
}, {
|
|
5882
5893
|
cache: createFastMemoizeCache$1(cache.pluralRules),
|
|
5883
5894
|
strategy: strategies.variadic,
|
|
@@ -6035,7 +6046,13 @@ var IntlErrorCode;
|
|
|
6035
6046
|
var IntlError = /** @class */ (function (_super) {
|
|
6036
6047
|
__extends(IntlError, _super);
|
|
6037
6048
|
function IntlError(code, message, exception) {
|
|
6038
|
-
var _this =
|
|
6049
|
+
var _this = this;
|
|
6050
|
+
var err = exception
|
|
6051
|
+
? exception instanceof Error
|
|
6052
|
+
? exception
|
|
6053
|
+
: new Error(String(exception))
|
|
6054
|
+
: undefined;
|
|
6055
|
+
_this = _super.call(this, "[@formatjs/intl Error ".concat(code, "] ").concat(message, " \n").concat(err ? "\n".concat(err.message, "\n").concat(err.stack) : '')) || this;
|
|
6039
6056
|
_this.code = code;
|
|
6040
6057
|
// @ts-ignore just so we don't need to declare dep on @types/node
|
|
6041
6058
|
if (typeof Error.captureStackTrace === 'function') {
|
|
@@ -6067,28 +6084,35 @@ var MissingDataError = /** @class */ (function (_super) {
|
|
|
6067
6084
|
}
|
|
6068
6085
|
return MissingDataError;
|
|
6069
6086
|
}(IntlError));
|
|
6087
|
+
var IntlFormatError = /** @class */ (function (_super) {
|
|
6088
|
+
__extends(IntlFormatError, _super);
|
|
6089
|
+
function IntlFormatError(message, locale, exception) {
|
|
6090
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, " \nLocale: ").concat(locale, "\n"), exception) || this;
|
|
6091
|
+
}
|
|
6092
|
+
return IntlFormatError;
|
|
6093
|
+
}(IntlError));
|
|
6070
6094
|
var MessageFormatError = /** @class */ (function (_super) {
|
|
6071
6095
|
__extends(MessageFormatError, _super);
|
|
6072
6096
|
function MessageFormatError(message, locale, descriptor, exception) {
|
|
6073
|
-
var _this = _super.call(this,
|
|
6097
|
+
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;
|
|
6074
6098
|
_this.descriptor = descriptor;
|
|
6075
6099
|
return _this;
|
|
6076
6100
|
}
|
|
6077
6101
|
return MessageFormatError;
|
|
6078
|
-
}(
|
|
6102
|
+
}(IntlFormatError));
|
|
6079
6103
|
var MissingTranslationError = /** @class */ (function (_super) {
|
|
6080
6104
|
__extends(MissingTranslationError, _super);
|
|
6081
6105
|
function MissingTranslationError(descriptor, locale) {
|
|
6082
|
-
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \""
|
|
6106
|
+
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;
|
|
6083
6107
|
_this.descriptor = descriptor;
|
|
6084
6108
|
return _this;
|
|
6085
6109
|
}
|
|
6086
6110
|
return MissingTranslationError;
|
|
6087
6111
|
}(IntlError));
|
|
6088
6112
|
|
|
6089
|
-
function filterProps(props,
|
|
6113
|
+
function filterProps(props, allowlist, defaults) {
|
|
6090
6114
|
if (defaults === void 0) { defaults = {}; }
|
|
6091
|
-
return
|
|
6115
|
+
return allowlist.reduce(function (filtered, name) {
|
|
6092
6116
|
if (name in props) {
|
|
6093
6117
|
filtered[name] = props[name];
|
|
6094
6118
|
}
|
|
@@ -6100,13 +6124,17 @@ function filterProps(props, whitelist, defaults) {
|
|
|
6100
6124
|
}
|
|
6101
6125
|
var defaultErrorHandler = function (error) {
|
|
6102
6126
|
};
|
|
6127
|
+
var defaultWarnHandler = function (warning) {
|
|
6128
|
+
};
|
|
6103
6129
|
var DEFAULT_INTL_CONFIG = {
|
|
6104
6130
|
formats: {},
|
|
6105
6131
|
messages: {},
|
|
6106
6132
|
timeZone: undefined,
|
|
6107
6133
|
defaultLocale: 'en',
|
|
6108
6134
|
defaultFormats: {},
|
|
6135
|
+
fallbackOnEmptyString: true,
|
|
6109
6136
|
onError: defaultErrorHandler,
|
|
6137
|
+
onWarn: defaultWarnHandler,
|
|
6110
6138
|
};
|
|
6111
6139
|
function createIntlCache() {
|
|
6112
6140
|
return {
|
|
@@ -6148,7 +6176,7 @@ function createFormatters(cache) {
|
|
|
6148
6176
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6149
6177
|
args[_i] = arguments[_i];
|
|
6150
6178
|
}
|
|
6151
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6179
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6152
6180
|
}, {
|
|
6153
6181
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
6154
6182
|
strategy: strategies.variadic,
|
|
@@ -6159,7 +6187,7 @@ function createFormatters(cache) {
|
|
|
6159
6187
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6160
6188
|
args[_i] = arguments[_i];
|
|
6161
6189
|
}
|
|
6162
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6190
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6163
6191
|
}, {
|
|
6164
6192
|
cache: createFastMemoizeCache(cache.number),
|
|
6165
6193
|
strategy: strategies.variadic,
|
|
@@ -6170,7 +6198,7 @@ function createFormatters(cache) {
|
|
|
6170
6198
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6171
6199
|
args[_i] = arguments[_i];
|
|
6172
6200
|
}
|
|
6173
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6201
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6174
6202
|
}, {
|
|
6175
6203
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
6176
6204
|
strategy: strategies.variadic,
|
|
@@ -6193,7 +6221,7 @@ function createFormatters(cache) {
|
|
|
6193
6221
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6194
6222
|
args[_i] = arguments[_i];
|
|
6195
6223
|
}
|
|
6196
|
-
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args)))();
|
|
6224
|
+
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();
|
|
6197
6225
|
}, {
|
|
6198
6226
|
cache: createFastMemoizeCache(cache.relativeTime),
|
|
6199
6227
|
strategy: strategies.variadic,
|
|
@@ -6204,7 +6232,7 @@ function createFormatters(cache) {
|
|
|
6204
6232
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6205
6233
|
args[_i] = arguments[_i];
|
|
6206
6234
|
}
|
|
6207
|
-
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args)))();
|
|
6235
|
+
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();
|
|
6208
6236
|
}, {
|
|
6209
6237
|
cache: createFastMemoizeCache(cache.list),
|
|
6210
6238
|
strategy: strategies.variadic,
|
|
@@ -6214,7 +6242,7 @@ function createFormatters(cache) {
|
|
|
6214
6242
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6215
6243
|
args[_i] = arguments[_i];
|
|
6216
6244
|
}
|
|
6217
|
-
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args)))();
|
|
6245
|
+
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();
|
|
6218
6246
|
}, {
|
|
6219
6247
|
cache: createFastMemoizeCache(cache.displayNames),
|
|
6220
6248
|
strategy: strategies.variadic,
|
|
@@ -6230,7 +6258,7 @@ function getNamedFormat(formats, type, name, onError) {
|
|
|
6230
6258
|
if (format) {
|
|
6231
6259
|
return format;
|
|
6232
6260
|
}
|
|
6233
|
-
onError(new UnsupportedFormatterError("No "
|
|
6261
|
+
onError(new UnsupportedFormatterError("No ".concat(type, " format named: ").concat(name)));
|
|
6234
6262
|
}
|
|
6235
6263
|
|
|
6236
6264
|
/**
|
|
@@ -6265,7 +6293,7 @@ function deepMergeFormatsAndSetTimeZone(f1, timeZone) {
|
|
|
6265
6293
|
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)) });
|
|
6266
6294
|
}
|
|
6267
6295
|
function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
6268
|
-
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;
|
|
6296
|
+
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;
|
|
6269
6297
|
if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }
|
|
6270
6298
|
var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
|
|
6271
6299
|
// `id` is a required field of a Message Descriptor.
|
|
@@ -6295,6 +6323,9 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6295
6323
|
formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
|
|
6296
6324
|
defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
|
|
6297
6325
|
if (!message) {
|
|
6326
|
+
if (fallbackOnEmptyString === false && message === '') {
|
|
6327
|
+
return message;
|
|
6328
|
+
}
|
|
6298
6329
|
if (!defaultMessage ||
|
|
6299
6330
|
(locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {
|
|
6300
6331
|
// This prevents warnings from littering the console in development
|
|
@@ -6308,7 +6339,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6308
6339
|
return formatter.format(values);
|
|
6309
6340
|
}
|
|
6310
6341
|
catch (e) {
|
|
6311
|
-
onError(new MessageFormatError("Error formatting default message for: \""
|
|
6342
|
+
onError(new MessageFormatError("Error formatting default message for: \"".concat(id, "\", rendering default message verbatim"), locale, messageDescriptor, e));
|
|
6312
6343
|
return typeof defaultMessage === 'string' ? defaultMessage : id;
|
|
6313
6344
|
}
|
|
6314
6345
|
}
|
|
@@ -6320,7 +6351,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6320
6351
|
return formatter.format(values);
|
|
6321
6352
|
}
|
|
6322
6353
|
catch (e) {
|
|
6323
|
-
onError(new MessageFormatError("Error formatting message: \""
|
|
6354
|
+
onError(new MessageFormatError("Error formatting message: \"".concat(id, "\", using ").concat(defaultMessage ? 'default message' : 'id', " as fallback."), locale, messageDescriptor, e));
|
|
6324
6355
|
}
|
|
6325
6356
|
if (defaultMessage) {
|
|
6326
6357
|
try {
|
|
@@ -6328,7 +6359,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6328
6359
|
return formatter.format(values);
|
|
6329
6360
|
}
|
|
6330
6361
|
catch (e) {
|
|
6331
|
-
onError(new MessageFormatError("Error formatting the default message for: \""
|
|
6362
|
+
onError(new MessageFormatError("Error formatting the default message for: \"".concat(id, "\", rendering message verbatim"), locale, messageDescriptor, e));
|
|
6332
6363
|
}
|
|
6333
6364
|
}
|
|
6334
6365
|
if (typeof message === 'string') {
|
|
@@ -6366,9 +6397,7 @@ function getFormatter$2(_a, type, getDateTimeFormat, options) {
|
|
|
6366
6397
|
if (options === void 0) { options = {}; }
|
|
6367
6398
|
var format = options.format;
|
|
6368
6399
|
var defaults = __assign(__assign({}, (timeZone && { timeZone: timeZone })), (format && getNamedFormat(formats, type, format, onError)));
|
|
6369
|
-
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS,
|
|
6370
|
-
// @ts-expect-error es2020 has a lot stuff from es2021 bleed in
|
|
6371
|
-
defaults);
|
|
6400
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);
|
|
6372
6401
|
if (type === 'time' &&
|
|
6373
6402
|
!filteredOptions.hour &&
|
|
6374
6403
|
!filteredOptions.minute &&
|
|
@@ -6485,7 +6514,7 @@ var LIST_FORMAT_OPTIONS = [
|
|
|
6485
6514
|
];
|
|
6486
6515
|
var now = Date.now();
|
|
6487
6516
|
function generateToken(i) {
|
|
6488
|
-
return now
|
|
6517
|
+
return "".concat(now, "_").concat(i, "_").concat(now);
|
|
6489
6518
|
}
|
|
6490
6519
|
function formatList(opts, getListFormat, values, options) {
|
|
6491
6520
|
if (options === void 0) { options = {}; }
|
|
@@ -6552,7 +6581,7 @@ function formatPlural(_a, getPluralRules, value, options) {
|
|
|
6552
6581
|
return getPluralRules(locale, filteredOptions).select(value);
|
|
6553
6582
|
}
|
|
6554
6583
|
catch (e) {
|
|
6555
|
-
onError(new
|
|
6584
|
+
onError(new IntlFormatError('Error formatting plural.', locale, e));
|
|
6556
6585
|
}
|
|
6557
6586
|
return 'other';
|
|
6558
6587
|
}
|
|
@@ -6579,7 +6608,7 @@ function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options)
|
|
|
6579
6608
|
return getFormatter$1(config, getRelativeTimeFormat, options).format(value, unit);
|
|
6580
6609
|
}
|
|
6581
6610
|
catch (e) {
|
|
6582
|
-
config.onError(new
|
|
6611
|
+
config.onError(new IntlFormatError('Error formatting relative time.', config.locale, e));
|
|
6583
6612
|
}
|
|
6584
6613
|
return String(value);
|
|
6585
6614
|
}
|
|
@@ -6643,9 +6672,10 @@ function messagesContainString(messages) {
|
|
|
6643
6672
|
return typeof firstMessage === 'string';
|
|
6644
6673
|
}
|
|
6645
6674
|
function verifyConfigMessages(config) {
|
|
6646
|
-
if (config.
|
|
6675
|
+
if (config.onWarn &&
|
|
6676
|
+
config.defaultRichTextElements &&
|
|
6647
6677
|
messagesContainString(config.messages || {})) {
|
|
6648
|
-
|
|
6678
|
+
config.onWarn("[@formatjs/intl] \"defaultRichTextElements\" was specified but \"message\" was not pre-compiled. \nPlease consider using \"@formatjs/cli\" to pre-compile your messages for performance.\nFor more details see https://formatjs.io/docs/getting-started/message-distribution");
|
|
6649
6679
|
}
|
|
6650
6680
|
}
|
|
6651
6681
|
/**
|
|
@@ -6659,7 +6689,7 @@ function createIntl(config, cache) {
|
|
|
6659
6689
|
var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
|
|
6660
6690
|
if (!locale) {
|
|
6661
6691
|
if (onError) {
|
|
6662
|
-
onError(new InvalidConfigError("\"locale\" was not configured, using \""
|
|
6692
|
+
onError(new InvalidConfigError("\"locale\" was not configured, using \"".concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details")));
|
|
6663
6693
|
}
|
|
6664
6694
|
// Since there's no registered locale data for `locale`, this will
|
|
6665
6695
|
// fallback to the `defaultLocale` to make sure things can render.
|
|
@@ -6669,481 +6699,481 @@ function createIntl(config, cache) {
|
|
|
6669
6699
|
resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
|
|
6670
6700
|
}
|
|
6671
6701
|
else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
|
|
6672
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6702
|
+
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")));
|
|
6673
6703
|
}
|
|
6674
6704
|
else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
|
|
6675
6705
|
onError) {
|
|
6676
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6706
|
+
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")));
|
|
6677
6707
|
}
|
|
6678
6708
|
verifyConfigMessages(resolvedConfig);
|
|
6679
|
-
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) });
|
|
6709
|
+
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), $t: 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) });
|
|
6680
6710
|
}
|
|
6681
6711
|
|
|
6682
|
-
const DEFAULT_LANGUAGE = "en";
|
|
6683
|
-
function getBrowserLang() {
|
|
6684
|
-
const langAttr = document.documentElement.getAttribute("lang");
|
|
6685
|
-
if (!!langAttr) {
|
|
6686
|
-
return langAttr;
|
|
6687
|
-
}
|
|
6688
|
-
else if (window.navigator && window.navigator.language) {
|
|
6689
|
-
const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
|
|
6690
|
-
return lang.slice(0, 2);
|
|
6691
|
-
}
|
|
6692
|
-
else {
|
|
6693
|
-
return DEFAULT_LANGUAGE;
|
|
6694
|
-
}
|
|
6695
|
-
}
|
|
6696
|
-
// prevents memory leak
|
|
6697
|
-
const cache = createIntlCache();
|
|
6698
|
-
const locale = getBrowserLang();
|
|
6699
|
-
const intl = createIntl({
|
|
6700
|
-
locale: locale,
|
|
6701
|
-
defaultLocale: "en",
|
|
6702
|
-
messages: lang[locale] || en,
|
|
6703
|
-
}, cache);
|
|
6704
|
-
function generateId() {
|
|
6705
|
-
return "wmcl-" + Math.random().toString(36).substr(2, 10);
|
|
6706
|
-
}
|
|
6707
|
-
// limits how many times a function fires
|
|
6708
|
-
// use when the function should run periodically, but not too often (e.g. window resize)
|
|
6709
|
-
function throttle(fn, wait) {
|
|
6710
|
-
let timeout;
|
|
6711
|
-
let shouldWait = false;
|
|
6712
|
-
return function () {
|
|
6713
|
-
const context = this;
|
|
6714
|
-
if (!shouldWait) {
|
|
6715
|
-
fn.apply(context, arguments);
|
|
6716
|
-
shouldWait = true;
|
|
6717
|
-
clearTimeout(timeout);
|
|
6718
|
-
timeout = setTimeout(function () {
|
|
6719
|
-
shouldWait = false;
|
|
6720
|
-
}, wait);
|
|
6721
|
-
}
|
|
6722
|
-
};
|
|
6723
|
-
}
|
|
6724
|
-
// waits until it hasn't been called for [timeout] ms.
|
|
6725
|
-
// use when the function should run only after something (event) is done firing
|
|
6726
|
-
function debounce(fn, wait) {
|
|
6727
|
-
let timeout;
|
|
6728
|
-
return function () {
|
|
6729
|
-
const context = this;
|
|
6730
|
-
const functionCall = () => fn.apply(context, arguments);
|
|
6731
|
-
clearTimeout(timeout);
|
|
6732
|
-
timeout = setTimeout(functionCall, wait);
|
|
6733
|
-
};
|
|
6734
|
-
}
|
|
6735
|
-
function getTextDir() {
|
|
6736
|
-
const dir = document.querySelector("html").getAttribute("dir");
|
|
6737
|
-
return dir ? dir.toLowerCase() : "";
|
|
6738
|
-
}
|
|
6739
|
-
function getPosition(el) {
|
|
6740
|
-
const coords = el.getBoundingClientRect();
|
|
6741
|
-
let x = coords.x;
|
|
6742
|
-
let y = coords.y;
|
|
6743
|
-
// Edge doesn't have x and y
|
|
6744
|
-
if (!x) {
|
|
6745
|
-
if (getTextDir() === "rtl") {
|
|
6746
|
-
x = coords.right;
|
|
6747
|
-
}
|
|
6748
|
-
else {
|
|
6749
|
-
x = coords.left;
|
|
6750
|
-
}
|
|
6751
|
-
y = coords.top;
|
|
6752
|
-
}
|
|
6753
|
-
return { x, y };
|
|
6754
|
-
}
|
|
6755
|
-
function findParentWithScrollbar(el) {
|
|
6756
|
-
while (!!el) {
|
|
6757
|
-
if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
|
|
6758
|
-
return el;
|
|
6759
|
-
}
|
|
6760
|
-
el = el.parentElement;
|
|
6761
|
-
}
|
|
6762
|
-
}
|
|
6763
|
-
function findParentWithHiddenOverflow(el) {
|
|
6764
|
-
while (!!el) {
|
|
6765
|
-
if (window.getComputedStyle(el).overflowY !== "visible") {
|
|
6766
|
-
return el;
|
|
6767
|
-
}
|
|
6768
|
-
el = el.parentElement;
|
|
6769
|
-
}
|
|
6770
|
-
}
|
|
6771
|
-
function getClosableElementMeasurements(fixedEl, closableEl) {
|
|
6772
|
-
const parent = findParentWithHiddenOverflow(fixedEl);
|
|
6773
|
-
// if parent is not found, measurements are checked against the viewport
|
|
6774
|
-
return {
|
|
6775
|
-
closableElHeight: closableEl.clientHeight,
|
|
6776
|
-
closableElWidth: closableEl.clientWidth,
|
|
6777
|
-
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6778
|
-
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6779
|
-
spaceAbove: parent
|
|
6780
|
-
? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
|
|
6781
|
-
: fixedEl.getBoundingClientRect().top,
|
|
6782
|
-
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6783
|
-
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6784
|
-
spaceBelow: parent
|
|
6785
|
-
? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
|
|
6786
|
-
: document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
|
|
6787
|
-
spaceLeft: parent
|
|
6788
|
-
? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
|
|
6789
|
-
: fixedEl.getBoundingClientRect().left,
|
|
6790
|
-
spaceRight: parent
|
|
6791
|
-
? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
|
|
6792
|
-
: document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
|
|
6793
|
-
};
|
|
6794
|
-
}
|
|
6795
|
-
function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
|
|
6796
|
-
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6797
|
-
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6798
|
-
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6799
|
-
) {
|
|
6800
|
-
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6801
|
-
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6802
|
-
const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
|
|
6803
|
-
return openUp;
|
|
6804
|
-
}
|
|
6805
|
-
function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
|
|
6806
|
-
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6807
|
-
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6808
|
-
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6809
|
-
) {
|
|
6810
|
-
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6811
|
-
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6812
|
-
const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
|
|
6813
|
-
return openDown;
|
|
6814
|
-
}
|
|
6815
|
-
function shouldShiftRight(fixedEl, closableEl) {
|
|
6816
|
-
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6817
|
-
const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
|
|
6818
|
-
return needsSpaceLeft;
|
|
6819
|
-
}
|
|
6820
|
-
function shouldShiftLeft(fixedEl, closableEl) {
|
|
6821
|
-
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6822
|
-
const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
|
|
6823
|
-
return needsSpaceRight;
|
|
6824
|
-
}
|
|
6825
|
-
function adjustTooltipPosition(tPos, el, tooltipEl) {
|
|
6826
|
-
// position must be reset before measurements are taken in adjustTooltipPosition
|
|
6827
|
-
// otherwise text-wrapping from previous position makes width measurement inconsistent
|
|
6828
|
-
tooltipEl.style.top = "";
|
|
6829
|
-
tooltipEl.style.left = "";
|
|
6830
|
-
const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
|
|
6831
|
-
const tooltipWidth = tooltipEl.getBoundingClientRect().width;
|
|
6832
|
-
const tooltipHeight = tooltipEl.getBoundingClientRect().height;
|
|
6833
|
-
const enoughSpaceAbove = spaceAbove > tooltipHeight;
|
|
6834
|
-
const enoughSpaceBelow = spaceBelow > tooltipHeight;
|
|
6835
|
-
// a tooltip should never be closer than 24px to the edge of a screen
|
|
6836
|
-
const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
|
|
6837
|
-
const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
|
|
6838
|
-
const swapAbove = (position) => {
|
|
6839
|
-
return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
|
|
6840
|
-
};
|
|
6841
|
-
const swapBelow = (position) => {
|
|
6842
|
-
return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
|
|
6843
|
-
};
|
|
6844
|
-
const swapLeft = (position, centeredPosition) => {
|
|
6845
|
-
if (!enoughSpaceLeft && enoughSpaceRight) {
|
|
6846
|
-
position = position.replace("left", "right");
|
|
6847
|
-
}
|
|
6848
|
-
else if (!enoughSpaceLeft && !enoughSpaceRight) {
|
|
6849
|
-
position = centeredPosition;
|
|
6850
|
-
}
|
|
6851
|
-
return position;
|
|
6852
|
-
};
|
|
6853
|
-
const swapRight = (position, centeredPosition) => {
|
|
6854
|
-
if (!enoughSpaceRight && enoughSpaceLeft) {
|
|
6855
|
-
position = position.replace("right", "left");
|
|
6856
|
-
}
|
|
6857
|
-
else if (!enoughSpaceRight && !enoughSpaceLeft) {
|
|
6858
|
-
position = centeredPosition;
|
|
6859
|
-
}
|
|
6860
|
-
return position;
|
|
6861
|
-
};
|
|
6862
|
-
// horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
|
|
6863
|
-
switch (tPos) {
|
|
6864
|
-
case "left":
|
|
6865
|
-
tPos = swapLeft(tPos, "bottom");
|
|
6866
|
-
case "right":
|
|
6867
|
-
tPos = swapRight(tPos, "bottom");
|
|
6868
|
-
case "top-left":
|
|
6869
|
-
tPos = swapLeft(tPos, "top");
|
|
6870
|
-
tPos = swapAbove(tPos);
|
|
6871
|
-
case "top-right":
|
|
6872
|
-
tPos = swapRight(tPos, "top");
|
|
6873
|
-
tPos = swapAbove(tPos);
|
|
6874
|
-
case "bottom-left":
|
|
6875
|
-
tPos = swapLeft(tPos, "bottom");
|
|
6876
|
-
tPos = swapBelow(tPos);
|
|
6877
|
-
case "bottom-right":
|
|
6878
|
-
tPos = swapRight(tPos, "bottom");
|
|
6879
|
-
tPos = swapBelow(tPos);
|
|
6880
|
-
case "top":
|
|
6881
|
-
tPos = swapAbove(tPos);
|
|
6882
|
-
case "bottom":
|
|
6883
|
-
tPos = swapBelow(tPos);
|
|
6884
|
-
}
|
|
6885
|
-
return tPos;
|
|
6886
|
-
}
|
|
6887
|
-
function hasRoomRight(x, spaceNeeded) {
|
|
6888
|
-
let horizOffset = 0;
|
|
6889
|
-
// if (getTextDir() === "ltr") {
|
|
6890
|
-
if (x.type === "click") {
|
|
6891
|
-
// if it's a mouse event, deal with mouse coords
|
|
6892
|
-
horizOffset = x.clientX;
|
|
6893
|
-
// if it's a focus event, the offset is 0
|
|
6894
|
-
}
|
|
6895
|
-
else if (x.type === "focus") {
|
|
6896
|
-
horizOffset = 0;
|
|
6897
|
-
}
|
|
6898
|
-
else {
|
|
6899
|
-
// otherwise an element was passed, calculate how far it is from the edge of the window
|
|
6900
|
-
let el = x; // re-assignment is for clarity
|
|
6901
|
-
while (el) {
|
|
6902
|
-
if (el.tagName == "BODY") {
|
|
6903
|
-
// deal with browser quirks with body/window/document and page scroll
|
|
6904
|
-
var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
6905
|
-
horizOffset += el.offsetLeft - xScroll + el.clientLeft;
|
|
6906
|
-
}
|
|
6907
|
-
else {
|
|
6908
|
-
// for all other non-BODY elements
|
|
6909
|
-
horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
|
|
6910
|
-
}
|
|
6911
|
-
el = el.offsetParent;
|
|
6912
|
-
}
|
|
6913
|
-
// }
|
|
6914
|
-
}
|
|
6915
|
-
return window.innerWidth - horizOffset >= spaceNeeded;
|
|
6916
|
-
}
|
|
6917
|
-
function checkForActiveElInShadow(element) {
|
|
6918
|
-
while (element && element.shadowRoot) {
|
|
6919
|
-
element = element.shadowRoot.activeElement;
|
|
6920
|
-
}
|
|
6921
|
-
return element;
|
|
6922
|
-
}
|
|
6923
|
-
function checkForFocusableElInShadow(element) {
|
|
6924
|
-
const selectors = [
|
|
6925
|
-
"button",
|
|
6926
|
-
"a",
|
|
6927
|
-
"input",
|
|
6928
|
-
"select",
|
|
6929
|
-
"textarea",
|
|
6930
|
-
"wm-button",
|
|
6931
|
-
"wm-search",
|
|
6932
|
-
"wm-select",
|
|
6933
|
-
"wm-action-menu",
|
|
6934
|
-
"wm-tab-item",
|
|
6935
|
-
"wm-datepicker",
|
|
6936
|
-
];
|
|
6937
|
-
let focusableEl = element;
|
|
6938
|
-
selectors.forEach((selector) => {
|
|
6939
|
-
if (focusableEl && focusableEl.shadowRoot) {
|
|
6940
|
-
let elInShadow = focusableEl.shadowRoot.querySelector(selector);
|
|
6941
|
-
if (elInShadow) {
|
|
6942
|
-
if (selector.startsWith("wm-")) {
|
|
6943
|
-
focusableEl = checkForFocusableElInShadow(elInShadow);
|
|
6944
|
-
}
|
|
6945
|
-
else {
|
|
6946
|
-
focusableEl = elInShadow;
|
|
6947
|
-
}
|
|
6948
|
-
}
|
|
6949
|
-
}
|
|
6950
|
-
});
|
|
6951
|
-
return focusableEl;
|
|
6952
|
-
}
|
|
6953
|
-
function isFocusable(element) {
|
|
6954
|
-
if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
|
|
6955
|
-
return true;
|
|
6956
|
-
}
|
|
6957
|
-
if (element.disabled) {
|
|
6958
|
-
return false;
|
|
6959
|
-
}
|
|
6960
|
-
switch (element.nodeName) {
|
|
6961
|
-
case "A":
|
|
6962
|
-
return !!element.href && element.rel != "ignore";
|
|
6963
|
-
case "INPUT":
|
|
6964
|
-
return element.type != "hidden" && element.type != "file";
|
|
6965
|
-
case "BUTTON":
|
|
6966
|
-
case "SELECT":
|
|
6967
|
-
case "TEXTAREA":
|
|
6968
|
-
case "WM-BUTTON":
|
|
6969
|
-
case "WM-SELECT":
|
|
6970
|
-
case "WM-ACTION-MENU":
|
|
6971
|
-
case "WM-DATEPICKER":
|
|
6972
|
-
case "WM-TIMEPICKER":
|
|
6973
|
-
case "WM-INPUT":
|
|
6974
|
-
case "WM-TAG-INPUT":
|
|
6975
|
-
case "WM-TAB-ITEM":
|
|
6976
|
-
case "WM-SEARCH":
|
|
6977
|
-
return true;
|
|
6978
|
-
default:
|
|
6979
|
-
return false;
|
|
6980
|
-
}
|
|
6981
|
-
}
|
|
6982
|
-
function getFirstFocusableDescendant(element) {
|
|
6983
|
-
if (isFocusable(element)) {
|
|
6984
|
-
return checkForFocusableElInShadow(element);
|
|
6985
|
-
}
|
|
6986
|
-
else if (element.childNodes.length > 0) {
|
|
6987
|
-
element.childNodes.forEach((i) => {
|
|
6988
|
-
const childEl = getFirstFocusableDescendant(i);
|
|
6989
|
-
return childEl && checkForFocusableElInShadow(childEl);
|
|
6990
|
-
});
|
|
6991
|
-
}
|
|
6992
|
-
}
|
|
6993
|
-
function hasValidType(file, types) {
|
|
6994
|
-
const acceptedExtensions = types.split(" ");
|
|
6995
|
-
const parts = file.name && file.name.split(".");
|
|
6996
|
-
const ext = parts && parts.length > 1 && parts[parts.length - 1];
|
|
6997
|
-
return ext
|
|
6998
|
-
? acceptedExtensions.includes(ext.toLowerCase())
|
|
6999
|
-
: // fallback: if we couldn't obtain an extension,
|
|
7000
|
-
// validate based on MIME type...
|
|
7001
|
-
!!file.type
|
|
7002
|
-
? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
|
|
7003
|
-
: // ...and if that failed too, accept the file
|
|
7004
|
-
// as it's preferable to accept an invalid file
|
|
7005
|
-
// than refusing a valid one (back-end will take care of what slips through)
|
|
7006
|
-
true;
|
|
7007
|
-
}
|
|
7008
|
-
// takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
|
|
7009
|
-
function getAcceptedMimeTypesList(acceptedExtensions) {
|
|
7010
|
-
// this is just a list of common file types (regardless of whether they are/can be valid or not)
|
|
7011
|
-
// front end checks are just a convenience to users, independent of security.
|
|
7012
|
-
// it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
|
|
7013
|
-
const lookupTable = {
|
|
7014
|
-
aac: ["audio/aac"],
|
|
7015
|
-
abw: ["application/x-abiword"],
|
|
7016
|
-
arc: ["application/x-freearc"],
|
|
7017
|
-
avi: ["video/x-msvideo"],
|
|
7018
|
-
azw: ["application/vnd.amazon.ebook"],
|
|
7019
|
-
bin: ["application/octet-stream"],
|
|
7020
|
-
bmp: ["image/bmp"],
|
|
7021
|
-
bz: ["application/x-bzip"],
|
|
7022
|
-
bz2: ["application/x-bzip2"],
|
|
7023
|
-
csh: ["application/x-csh"],
|
|
7024
|
-
css: ["text/css"],
|
|
7025
|
-
csv: ["text/csv"],
|
|
7026
|
-
doc: ["application/msword"],
|
|
7027
|
-
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
7028
|
-
eot: ["application/vnd.ms-fontobject"],
|
|
7029
|
-
epub: ["application/epub+zip"],
|
|
7030
|
-
gz: ["application/gzip"],
|
|
7031
|
-
gif: ["image/gif"],
|
|
7032
|
-
htm: ["text/html"],
|
|
7033
|
-
html: ["text/html"],
|
|
7034
|
-
ico: ["image/vnd.microsoft.icon"],
|
|
7035
|
-
ics: ["text/calendar"],
|
|
7036
|
-
jar: ["application/java-archive"],
|
|
7037
|
-
jpeg: ["image/jpeg"],
|
|
7038
|
-
jpg: ["image/jpeg"],
|
|
7039
|
-
js: ["text/javascript"],
|
|
7040
|
-
json: ["application/json"],
|
|
7041
|
-
jsonld: ["application/ld+json"],
|
|
7042
|
-
log: ["text/plain"],
|
|
7043
|
-
mid: ["audio/x-midi"],
|
|
7044
|
-
midi: ["audio/x-midi"],
|
|
7045
|
-
mjs: ["text/javascript"],
|
|
7046
|
-
mp3: ["audio/mpeg"],
|
|
7047
|
-
mpeg: ["video/mpeg"],
|
|
7048
|
-
mpkg: ["application/vnd.apple.installer+xml"],
|
|
7049
|
-
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
7050
|
-
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
7051
|
-
odt: ["application/vnd.oasis.opendocument.text"],
|
|
7052
|
-
oga: ["audio/ogg"],
|
|
7053
|
-
ogv: ["video/ogg"],
|
|
7054
|
-
ogx: ["application/ogg"],
|
|
7055
|
-
opus: ["audio/opus"],
|
|
7056
|
-
otf: ["font/otf"],
|
|
7057
|
-
png: ["image/png"],
|
|
7058
|
-
pdf: ["application/pdf"],
|
|
7059
|
-
php: ["application/php"],
|
|
7060
|
-
ppt: ["application/vnd.ms-powerpoint"],
|
|
7061
|
-
pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
7062
|
-
rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
|
|
7063
|
-
rtf: ["application/rtf"],
|
|
7064
|
-
sh: ["application/x-sh"],
|
|
7065
|
-
svg: ["image/svg+xml"],
|
|
7066
|
-
swf: ["application/x-shockwave-flash"],
|
|
7067
|
-
tar: ["application/x-tar"],
|
|
7068
|
-
tif: ["image/tiff"],
|
|
7069
|
-
tiff: ["image/tiff"],
|
|
7070
|
-
ts: ["video/mp2t"],
|
|
7071
|
-
ttf: ["font/ttf"],
|
|
7072
|
-
txt: ["text/plain"],
|
|
7073
|
-
vsd: ["application/vnd.visio"],
|
|
7074
|
-
wav: ["audio/wav"],
|
|
7075
|
-
weba: ["audio/webm"],
|
|
7076
|
-
webm: ["video/webm"],
|
|
7077
|
-
webp: ["image/webp"],
|
|
7078
|
-
woff: ["font/woff"],
|
|
7079
|
-
woff2: ["font/woff2"],
|
|
7080
|
-
xhtml: ["application/xhtml+xml"],
|
|
7081
|
-
xls: ["application/vnd.ms-excel"],
|
|
7082
|
-
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
7083
|
-
xml: ["application/xml", "text/xml"],
|
|
7084
|
-
xul: ["application/vnd.mozilla.xul+xml"],
|
|
7085
|
-
zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
|
|
7086
|
-
"3gp": ["video/3gpp", "audio/3gpp"],
|
|
7087
|
-
"3g2": ["video/3gpp2", "audio/3gpp2"],
|
|
7088
|
-
"7z": ["application/x-7z-compressed"],
|
|
7089
|
-
};
|
|
7090
|
-
return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
|
|
7091
|
-
}
|
|
7092
|
-
function snakeCaseToCamelCase(str) {
|
|
7093
|
-
const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
|
|
7094
|
-
if (snakeCaseRegexp.test(str)) {
|
|
7095
|
-
let camelCase = "";
|
|
7096
|
-
let arr = str.split("_");
|
|
7097
|
-
arr.forEach((word, idx) => {
|
|
7098
|
-
camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
|
|
7099
|
-
});
|
|
7100
|
-
return camelCase;
|
|
7101
|
-
}
|
|
7102
|
-
else {
|
|
7103
|
-
return str;
|
|
7104
|
-
}
|
|
7105
|
-
}
|
|
7106
|
-
function getNewIndexToFocus(currentIndex, direction, listLength) {
|
|
7107
|
-
let newIndex = currentIndex;
|
|
7108
|
-
if (direction === "ArrowDown") {
|
|
7109
|
-
newIndex = (currentIndex + 1) % listLength;
|
|
7110
|
-
}
|
|
7111
|
-
if (direction === "ArrowUp") {
|
|
7112
|
-
newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
|
|
7113
|
-
}
|
|
7114
|
-
return newIndex;
|
|
7115
|
-
}
|
|
7116
|
-
function isRelatedTarget(ev, id) {
|
|
7117
|
-
// used for onBlur events to check the element that has been clicked
|
|
7118
|
-
const ids = id.split(" ");
|
|
7119
|
-
return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
|
|
7120
|
-
}
|
|
7121
|
-
function toBool(val) {
|
|
7122
|
-
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
7123
|
-
return val == "false" ? false : !!val;
|
|
7124
|
-
}
|
|
7125
|
-
/*
|
|
7126
|
-
* this is going to be needed to solve the extra tabbing on navigator
|
|
7127
|
-
* and for programmatic focus of tabs
|
|
7128
|
-
* Here's a draft, not bug proof, see:
|
|
7129
|
-
* https://stackoverflow.com/a/10730308/3741713
|
|
7130
|
-
|
|
7131
|
-
function getKeyboardFocusableElements(element = document) {
|
|
7132
|
-
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'));
|
|
7133
|
-
return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
|
|
7134
|
-
}
|
|
7135
|
-
|
|
7136
|
-
export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
|
|
7137
|
-
const els = getKeyboardFocusableElements();
|
|
7138
|
-
const current = els.indexOf(element);
|
|
7139
|
-
return els[current - 1] as HTMLElement;
|
|
7140
|
-
}
|
|
7141
|
-
|
|
7142
|
-
export function getNextKeyboardFocusableElement(element: HTMLElement) {
|
|
7143
|
-
const els = getKeyboardFocusableElements();
|
|
7144
|
-
const current = els.indexOf(element);
|
|
7145
|
-
return els[current + 1] as HTMLElement;
|
|
7146
|
-
}
|
|
6712
|
+
const DEFAULT_LANGUAGE = "en";
|
|
6713
|
+
function getBrowserLang() {
|
|
6714
|
+
const langAttr = document.documentElement.getAttribute("lang");
|
|
6715
|
+
if (!!langAttr) {
|
|
6716
|
+
return langAttr;
|
|
6717
|
+
}
|
|
6718
|
+
else if (window.navigator && window.navigator.language) {
|
|
6719
|
+
const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
|
|
6720
|
+
return lang.slice(0, 2);
|
|
6721
|
+
}
|
|
6722
|
+
else {
|
|
6723
|
+
return DEFAULT_LANGUAGE;
|
|
6724
|
+
}
|
|
6725
|
+
}
|
|
6726
|
+
// prevents memory leak
|
|
6727
|
+
const cache = createIntlCache();
|
|
6728
|
+
const locale = getBrowserLang();
|
|
6729
|
+
const intl = createIntl({
|
|
6730
|
+
locale: locale,
|
|
6731
|
+
defaultLocale: "en",
|
|
6732
|
+
messages: lang[locale] || en,
|
|
6733
|
+
}, cache);
|
|
6734
|
+
function generateId() {
|
|
6735
|
+
return "wmcl-" + Math.random().toString(36).substr(2, 10);
|
|
6736
|
+
}
|
|
6737
|
+
// limits how many times a function fires
|
|
6738
|
+
// use when the function should run periodically, but not too often (e.g. window resize)
|
|
6739
|
+
function throttle(fn, wait) {
|
|
6740
|
+
let timeout;
|
|
6741
|
+
let shouldWait = false;
|
|
6742
|
+
return function () {
|
|
6743
|
+
const context = this;
|
|
6744
|
+
if (!shouldWait) {
|
|
6745
|
+
fn.apply(context, arguments);
|
|
6746
|
+
shouldWait = true;
|
|
6747
|
+
clearTimeout(timeout);
|
|
6748
|
+
timeout = setTimeout(function () {
|
|
6749
|
+
shouldWait = false;
|
|
6750
|
+
}, wait);
|
|
6751
|
+
}
|
|
6752
|
+
};
|
|
6753
|
+
}
|
|
6754
|
+
// waits until it hasn't been called for [timeout] ms.
|
|
6755
|
+
// use when the function should run only after something (event) is done firing
|
|
6756
|
+
function debounce(fn, wait) {
|
|
6757
|
+
let timeout;
|
|
6758
|
+
return function () {
|
|
6759
|
+
const context = this;
|
|
6760
|
+
const functionCall = () => fn.apply(context, arguments);
|
|
6761
|
+
clearTimeout(timeout);
|
|
6762
|
+
timeout = setTimeout(functionCall, wait);
|
|
6763
|
+
};
|
|
6764
|
+
}
|
|
6765
|
+
function getTextDir() {
|
|
6766
|
+
const dir = document.querySelector("html").getAttribute("dir");
|
|
6767
|
+
return dir ? dir.toLowerCase() : "";
|
|
6768
|
+
}
|
|
6769
|
+
function getPosition(el) {
|
|
6770
|
+
const coords = el.getBoundingClientRect();
|
|
6771
|
+
let x = coords.x;
|
|
6772
|
+
let y = coords.y;
|
|
6773
|
+
// Edge doesn't have x and y
|
|
6774
|
+
if (!x) {
|
|
6775
|
+
if (getTextDir() === "rtl") {
|
|
6776
|
+
x = coords.right;
|
|
6777
|
+
}
|
|
6778
|
+
else {
|
|
6779
|
+
x = coords.left;
|
|
6780
|
+
}
|
|
6781
|
+
y = coords.top;
|
|
6782
|
+
}
|
|
6783
|
+
return { x, y };
|
|
6784
|
+
}
|
|
6785
|
+
function findParentWithScrollbar(el) {
|
|
6786
|
+
while (!!el) {
|
|
6787
|
+
if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
|
|
6788
|
+
return el;
|
|
6789
|
+
}
|
|
6790
|
+
el = el.parentElement;
|
|
6791
|
+
}
|
|
6792
|
+
}
|
|
6793
|
+
function findParentWithHiddenOverflow(el) {
|
|
6794
|
+
while (!!el) {
|
|
6795
|
+
if (window.getComputedStyle(el).overflowY !== "visible") {
|
|
6796
|
+
return el;
|
|
6797
|
+
}
|
|
6798
|
+
el = el.parentElement;
|
|
6799
|
+
}
|
|
6800
|
+
}
|
|
6801
|
+
function getClosableElementMeasurements(fixedEl, closableEl) {
|
|
6802
|
+
const parent = findParentWithHiddenOverflow(fixedEl);
|
|
6803
|
+
// if parent is not found, measurements are checked against the viewport
|
|
6804
|
+
return {
|
|
6805
|
+
closableElHeight: closableEl.clientHeight,
|
|
6806
|
+
closableElWidth: closableEl.clientWidth,
|
|
6807
|
+
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6808
|
+
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6809
|
+
spaceAbove: parent
|
|
6810
|
+
? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
|
|
6811
|
+
: fixedEl.getBoundingClientRect().top,
|
|
6812
|
+
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6813
|
+
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6814
|
+
spaceBelow: parent
|
|
6815
|
+
? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
|
|
6816
|
+
: document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
|
|
6817
|
+
spaceLeft: parent
|
|
6818
|
+
? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
|
|
6819
|
+
: fixedEl.getBoundingClientRect().left,
|
|
6820
|
+
spaceRight: parent
|
|
6821
|
+
? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
|
|
6822
|
+
: document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
|
|
6823
|
+
};
|
|
6824
|
+
}
|
|
6825
|
+
function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
|
|
6826
|
+
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6827
|
+
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6828
|
+
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6829
|
+
) {
|
|
6830
|
+
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6831
|
+
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6832
|
+
const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
|
|
6833
|
+
return openUp;
|
|
6834
|
+
}
|
|
6835
|
+
function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
|
|
6836
|
+
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6837
|
+
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6838
|
+
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6839
|
+
) {
|
|
6840
|
+
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6841
|
+
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6842
|
+
const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
|
|
6843
|
+
return openDown;
|
|
6844
|
+
}
|
|
6845
|
+
function shouldShiftRight(fixedEl, closableEl) {
|
|
6846
|
+
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6847
|
+
const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
|
|
6848
|
+
return needsSpaceLeft;
|
|
6849
|
+
}
|
|
6850
|
+
function shouldShiftLeft(fixedEl, closableEl) {
|
|
6851
|
+
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6852
|
+
const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
|
|
6853
|
+
return needsSpaceRight;
|
|
6854
|
+
}
|
|
6855
|
+
function adjustTooltipPosition(tPos, el, tooltipEl) {
|
|
6856
|
+
// position must be reset before measurements are taken in adjustTooltipPosition
|
|
6857
|
+
// otherwise text-wrapping from previous position makes width measurement inconsistent
|
|
6858
|
+
tooltipEl.style.top = "";
|
|
6859
|
+
tooltipEl.style.left = "";
|
|
6860
|
+
const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
|
|
6861
|
+
const tooltipWidth = tooltipEl.getBoundingClientRect().width;
|
|
6862
|
+
const tooltipHeight = tooltipEl.getBoundingClientRect().height;
|
|
6863
|
+
const enoughSpaceAbove = spaceAbove > tooltipHeight;
|
|
6864
|
+
const enoughSpaceBelow = spaceBelow > tooltipHeight;
|
|
6865
|
+
// a tooltip should never be closer than 24px to the edge of a screen
|
|
6866
|
+
const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
|
|
6867
|
+
const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
|
|
6868
|
+
const swapAbove = (position) => {
|
|
6869
|
+
return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
|
|
6870
|
+
};
|
|
6871
|
+
const swapBelow = (position) => {
|
|
6872
|
+
return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
|
|
6873
|
+
};
|
|
6874
|
+
const swapLeft = (position, centeredPosition) => {
|
|
6875
|
+
if (!enoughSpaceLeft && enoughSpaceRight) {
|
|
6876
|
+
position = position.replace("left", "right");
|
|
6877
|
+
}
|
|
6878
|
+
else if (!enoughSpaceLeft && !enoughSpaceRight) {
|
|
6879
|
+
position = centeredPosition;
|
|
6880
|
+
}
|
|
6881
|
+
return position;
|
|
6882
|
+
};
|
|
6883
|
+
const swapRight = (position, centeredPosition) => {
|
|
6884
|
+
if (!enoughSpaceRight && enoughSpaceLeft) {
|
|
6885
|
+
position = position.replace("right", "left");
|
|
6886
|
+
}
|
|
6887
|
+
else if (!enoughSpaceRight && !enoughSpaceLeft) {
|
|
6888
|
+
position = centeredPosition;
|
|
6889
|
+
}
|
|
6890
|
+
return position;
|
|
6891
|
+
};
|
|
6892
|
+
// horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
|
|
6893
|
+
switch (tPos) {
|
|
6894
|
+
case "left":
|
|
6895
|
+
tPos = swapLeft(tPos, "bottom");
|
|
6896
|
+
case "right":
|
|
6897
|
+
tPos = swapRight(tPos, "bottom");
|
|
6898
|
+
case "top-left":
|
|
6899
|
+
tPos = swapLeft(tPos, "top");
|
|
6900
|
+
tPos = swapAbove(tPos);
|
|
6901
|
+
case "top-right":
|
|
6902
|
+
tPos = swapRight(tPos, "top");
|
|
6903
|
+
tPos = swapAbove(tPos);
|
|
6904
|
+
case "bottom-left":
|
|
6905
|
+
tPos = swapLeft(tPos, "bottom");
|
|
6906
|
+
tPos = swapBelow(tPos);
|
|
6907
|
+
case "bottom-right":
|
|
6908
|
+
tPos = swapRight(tPos, "bottom");
|
|
6909
|
+
tPos = swapBelow(tPos);
|
|
6910
|
+
case "top":
|
|
6911
|
+
tPos = swapAbove(tPos);
|
|
6912
|
+
case "bottom":
|
|
6913
|
+
tPos = swapBelow(tPos);
|
|
6914
|
+
}
|
|
6915
|
+
return tPos;
|
|
6916
|
+
}
|
|
6917
|
+
function hasRoomRight(x, spaceNeeded) {
|
|
6918
|
+
let horizOffset = 0;
|
|
6919
|
+
// if (getTextDir() === "ltr") {
|
|
6920
|
+
if (x.type === "click") {
|
|
6921
|
+
// if it's a mouse event, deal with mouse coords
|
|
6922
|
+
horizOffset = x.clientX;
|
|
6923
|
+
// if it's a focus event, the offset is 0
|
|
6924
|
+
}
|
|
6925
|
+
else if (x.type === "focus") {
|
|
6926
|
+
horizOffset = 0;
|
|
6927
|
+
}
|
|
6928
|
+
else {
|
|
6929
|
+
// otherwise an element was passed, calculate how far it is from the edge of the window
|
|
6930
|
+
let el = x; // re-assignment is for clarity
|
|
6931
|
+
while (el) {
|
|
6932
|
+
if (el.tagName == "BODY") {
|
|
6933
|
+
// deal with browser quirks with body/window/document and page scroll
|
|
6934
|
+
var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
6935
|
+
horizOffset += el.offsetLeft - xScroll + el.clientLeft;
|
|
6936
|
+
}
|
|
6937
|
+
else {
|
|
6938
|
+
// for all other non-BODY elements
|
|
6939
|
+
horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
|
|
6940
|
+
}
|
|
6941
|
+
el = el.offsetParent;
|
|
6942
|
+
}
|
|
6943
|
+
// }
|
|
6944
|
+
}
|
|
6945
|
+
return window.innerWidth - horizOffset >= spaceNeeded;
|
|
6946
|
+
}
|
|
6947
|
+
function checkForActiveElInShadow(element) {
|
|
6948
|
+
while (element && element.shadowRoot) {
|
|
6949
|
+
element = element.shadowRoot.activeElement;
|
|
6950
|
+
}
|
|
6951
|
+
return element;
|
|
6952
|
+
}
|
|
6953
|
+
function checkForFocusableElInShadow(element) {
|
|
6954
|
+
const selectors = [
|
|
6955
|
+
"button",
|
|
6956
|
+
"a",
|
|
6957
|
+
"input",
|
|
6958
|
+
"select",
|
|
6959
|
+
"textarea",
|
|
6960
|
+
"wm-button",
|
|
6961
|
+
"wm-search",
|
|
6962
|
+
"wm-select",
|
|
6963
|
+
"wm-action-menu",
|
|
6964
|
+
"wm-tab-item",
|
|
6965
|
+
"wm-datepicker",
|
|
6966
|
+
];
|
|
6967
|
+
let focusableEl = element;
|
|
6968
|
+
selectors.forEach((selector) => {
|
|
6969
|
+
if (focusableEl && focusableEl.shadowRoot) {
|
|
6970
|
+
let elInShadow = focusableEl.shadowRoot.querySelector(selector);
|
|
6971
|
+
if (elInShadow) {
|
|
6972
|
+
if (selector.startsWith("wm-")) {
|
|
6973
|
+
focusableEl = checkForFocusableElInShadow(elInShadow);
|
|
6974
|
+
}
|
|
6975
|
+
else {
|
|
6976
|
+
focusableEl = elInShadow;
|
|
6977
|
+
}
|
|
6978
|
+
}
|
|
6979
|
+
}
|
|
6980
|
+
});
|
|
6981
|
+
return focusableEl;
|
|
6982
|
+
}
|
|
6983
|
+
function isFocusable(element) {
|
|
6984
|
+
if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
|
|
6985
|
+
return true;
|
|
6986
|
+
}
|
|
6987
|
+
if (element.disabled) {
|
|
6988
|
+
return false;
|
|
6989
|
+
}
|
|
6990
|
+
switch (element.nodeName) {
|
|
6991
|
+
case "A":
|
|
6992
|
+
return !!element.href && element.rel != "ignore";
|
|
6993
|
+
case "INPUT":
|
|
6994
|
+
return element.type != "hidden" && element.type != "file";
|
|
6995
|
+
case "BUTTON":
|
|
6996
|
+
case "SELECT":
|
|
6997
|
+
case "TEXTAREA":
|
|
6998
|
+
case "WM-BUTTON":
|
|
6999
|
+
case "WM-SELECT":
|
|
7000
|
+
case "WM-ACTION-MENU":
|
|
7001
|
+
case "WM-DATEPICKER":
|
|
7002
|
+
case "WM-TIMEPICKER":
|
|
7003
|
+
case "WM-INPUT":
|
|
7004
|
+
case "WM-TAG-INPUT":
|
|
7005
|
+
case "WM-TAB-ITEM":
|
|
7006
|
+
case "WM-SEARCH":
|
|
7007
|
+
return true;
|
|
7008
|
+
default:
|
|
7009
|
+
return false;
|
|
7010
|
+
}
|
|
7011
|
+
}
|
|
7012
|
+
function getFirstFocusableDescendant(element) {
|
|
7013
|
+
if (isFocusable(element)) {
|
|
7014
|
+
return checkForFocusableElInShadow(element);
|
|
7015
|
+
}
|
|
7016
|
+
else if (element.childNodes.length > 0) {
|
|
7017
|
+
element.childNodes.forEach((i) => {
|
|
7018
|
+
const childEl = getFirstFocusableDescendant(i);
|
|
7019
|
+
return childEl && checkForFocusableElInShadow(childEl);
|
|
7020
|
+
});
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
function hasValidType(file, types) {
|
|
7024
|
+
const acceptedExtensions = types.split(" ");
|
|
7025
|
+
const parts = file.name && file.name.split(".");
|
|
7026
|
+
const ext = parts && parts.length > 1 && parts[parts.length - 1];
|
|
7027
|
+
return ext
|
|
7028
|
+
? acceptedExtensions.includes(ext.toLowerCase())
|
|
7029
|
+
: // fallback: if we couldn't obtain an extension,
|
|
7030
|
+
// validate based on MIME type...
|
|
7031
|
+
!!file.type
|
|
7032
|
+
? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
|
|
7033
|
+
: // ...and if that failed too, accept the file
|
|
7034
|
+
// as it's preferable to accept an invalid file
|
|
7035
|
+
// than refusing a valid one (back-end will take care of what slips through)
|
|
7036
|
+
true;
|
|
7037
|
+
}
|
|
7038
|
+
// takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
|
|
7039
|
+
function getAcceptedMimeTypesList(acceptedExtensions) {
|
|
7040
|
+
// this is just a list of common file types (regardless of whether they are/can be valid or not)
|
|
7041
|
+
// front end checks are just a convenience to users, independent of security.
|
|
7042
|
+
// it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
|
|
7043
|
+
const lookupTable = {
|
|
7044
|
+
aac: ["audio/aac"],
|
|
7045
|
+
abw: ["application/x-abiword"],
|
|
7046
|
+
arc: ["application/x-freearc"],
|
|
7047
|
+
avi: ["video/x-msvideo"],
|
|
7048
|
+
azw: ["application/vnd.amazon.ebook"],
|
|
7049
|
+
bin: ["application/octet-stream"],
|
|
7050
|
+
bmp: ["image/bmp"],
|
|
7051
|
+
bz: ["application/x-bzip"],
|
|
7052
|
+
bz2: ["application/x-bzip2"],
|
|
7053
|
+
csh: ["application/x-csh"],
|
|
7054
|
+
css: ["text/css"],
|
|
7055
|
+
csv: ["text/csv"],
|
|
7056
|
+
doc: ["application/msword"],
|
|
7057
|
+
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
7058
|
+
eot: ["application/vnd.ms-fontobject"],
|
|
7059
|
+
epub: ["application/epub+zip"],
|
|
7060
|
+
gz: ["application/gzip"],
|
|
7061
|
+
gif: ["image/gif"],
|
|
7062
|
+
htm: ["text/html"],
|
|
7063
|
+
html: ["text/html"],
|
|
7064
|
+
ico: ["image/vnd.microsoft.icon"],
|
|
7065
|
+
ics: ["text/calendar"],
|
|
7066
|
+
jar: ["application/java-archive"],
|
|
7067
|
+
jpeg: ["image/jpeg"],
|
|
7068
|
+
jpg: ["image/jpeg"],
|
|
7069
|
+
js: ["text/javascript"],
|
|
7070
|
+
json: ["application/json"],
|
|
7071
|
+
jsonld: ["application/ld+json"],
|
|
7072
|
+
log: ["text/plain"],
|
|
7073
|
+
mid: ["audio/x-midi"],
|
|
7074
|
+
midi: ["audio/x-midi"],
|
|
7075
|
+
mjs: ["text/javascript"],
|
|
7076
|
+
mp3: ["audio/mpeg"],
|
|
7077
|
+
mpeg: ["video/mpeg"],
|
|
7078
|
+
mpkg: ["application/vnd.apple.installer+xml"],
|
|
7079
|
+
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
7080
|
+
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
7081
|
+
odt: ["application/vnd.oasis.opendocument.text"],
|
|
7082
|
+
oga: ["audio/ogg"],
|
|
7083
|
+
ogv: ["video/ogg"],
|
|
7084
|
+
ogx: ["application/ogg"],
|
|
7085
|
+
opus: ["audio/opus"],
|
|
7086
|
+
otf: ["font/otf"],
|
|
7087
|
+
png: ["image/png"],
|
|
7088
|
+
pdf: ["application/pdf"],
|
|
7089
|
+
php: ["application/php"],
|
|
7090
|
+
ppt: ["application/vnd.ms-powerpoint"],
|
|
7091
|
+
pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
7092
|
+
rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
|
|
7093
|
+
rtf: ["application/rtf"],
|
|
7094
|
+
sh: ["application/x-sh"],
|
|
7095
|
+
svg: ["image/svg+xml"],
|
|
7096
|
+
swf: ["application/x-shockwave-flash"],
|
|
7097
|
+
tar: ["application/x-tar"],
|
|
7098
|
+
tif: ["image/tiff"],
|
|
7099
|
+
tiff: ["image/tiff"],
|
|
7100
|
+
ts: ["video/mp2t"],
|
|
7101
|
+
ttf: ["font/ttf"],
|
|
7102
|
+
txt: ["text/plain"],
|
|
7103
|
+
vsd: ["application/vnd.visio"],
|
|
7104
|
+
wav: ["audio/wav"],
|
|
7105
|
+
weba: ["audio/webm"],
|
|
7106
|
+
webm: ["video/webm"],
|
|
7107
|
+
webp: ["image/webp"],
|
|
7108
|
+
woff: ["font/woff"],
|
|
7109
|
+
woff2: ["font/woff2"],
|
|
7110
|
+
xhtml: ["application/xhtml+xml"],
|
|
7111
|
+
xls: ["application/vnd.ms-excel"],
|
|
7112
|
+
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
7113
|
+
xml: ["application/xml", "text/xml"],
|
|
7114
|
+
xul: ["application/vnd.mozilla.xul+xml"],
|
|
7115
|
+
zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
|
|
7116
|
+
"3gp": ["video/3gpp", "audio/3gpp"],
|
|
7117
|
+
"3g2": ["video/3gpp2", "audio/3gpp2"],
|
|
7118
|
+
"7z": ["application/x-7z-compressed"],
|
|
7119
|
+
};
|
|
7120
|
+
return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
|
|
7121
|
+
}
|
|
7122
|
+
function snakeCaseToCamelCase(str) {
|
|
7123
|
+
const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
|
|
7124
|
+
if (snakeCaseRegexp.test(str)) {
|
|
7125
|
+
let camelCase = "";
|
|
7126
|
+
let arr = str.split("_");
|
|
7127
|
+
arr.forEach((word, idx) => {
|
|
7128
|
+
camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
|
|
7129
|
+
});
|
|
7130
|
+
return camelCase;
|
|
7131
|
+
}
|
|
7132
|
+
else {
|
|
7133
|
+
return str;
|
|
7134
|
+
}
|
|
7135
|
+
}
|
|
7136
|
+
function getNewIndexToFocus(currentIndex, direction, listLength) {
|
|
7137
|
+
let newIndex = currentIndex;
|
|
7138
|
+
if (direction === "ArrowDown") {
|
|
7139
|
+
newIndex = (currentIndex + 1) % listLength;
|
|
7140
|
+
}
|
|
7141
|
+
if (direction === "ArrowUp") {
|
|
7142
|
+
newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
|
|
7143
|
+
}
|
|
7144
|
+
return newIndex;
|
|
7145
|
+
}
|
|
7146
|
+
function isRelatedTarget(ev, id) {
|
|
7147
|
+
// used for onBlur events to check the element that has been clicked
|
|
7148
|
+
const ids = id.split(" ");
|
|
7149
|
+
return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
|
|
7150
|
+
}
|
|
7151
|
+
function toBool(val) {
|
|
7152
|
+
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
7153
|
+
return val == "false" ? false : !!val;
|
|
7154
|
+
}
|
|
7155
|
+
/*
|
|
7156
|
+
* this is going to be needed to solve the extra tabbing on navigator
|
|
7157
|
+
* and for programmatic focus of tabs
|
|
7158
|
+
* Here's a draft, not bug proof, see:
|
|
7159
|
+
* https://stackoverflow.com/a/10730308/3741713
|
|
7160
|
+
|
|
7161
|
+
function getKeyboardFocusableElements(element = document) {
|
|
7162
|
+
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'));
|
|
7163
|
+
return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
|
|
7164
|
+
}
|
|
7165
|
+
|
|
7166
|
+
export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
|
|
7167
|
+
const els = getKeyboardFocusableElements();
|
|
7168
|
+
const current = els.indexOf(element);
|
|
7169
|
+
return els[current - 1] as HTMLElement;
|
|
7170
|
+
}
|
|
7171
|
+
|
|
7172
|
+
export function getNextKeyboardFocusableElement(element: HTMLElement) {
|
|
7173
|
+
const els = getKeyboardFocusableElements();
|
|
7174
|
+
const current = els.indexOf(element);
|
|
7175
|
+
return els[current + 1] as HTMLElement;
|
|
7176
|
+
}
|
|
7147
7177
|
*/
|
|
7148
7178
|
|
|
7149
7179
|
exports.adjustTooltipPosition = adjustTooltipPosition;
|