@watermarkinsights/ripple 3.12.0 → 3.13.0-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-44ae2eee.js → chartFunctions-b5f0319b.js} +420 -420
- package/dist/cjs/{functions-1a67b971.js → functions-3c5e979d.js} +1900 -479
- package/dist/cjs/{global-122fc638.js → global-23355ac3.js} +60 -60
- package/dist/cjs/{http-service-494d81de.js → http-service-9e8c4dd5.js} +49 -49
- package/dist/cjs/{index-acad7ab3.js → index-df6a3611.js} +4 -1
- 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 +658 -658
- 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 +336 -336
- package/dist/cjs/wm-button.cjs.entry.js +239 -231
- package/dist/cjs/wm-chart-slice.cjs.entry.js +14 -14
- package/dist/cjs/wm-chart.cjs.entry.js +111 -111
- package/dist/cjs/wm-datepicker.cjs.entry.js +266 -266
- package/dist/cjs/wm-input.cjs.entry.js +135 -135
- package/dist/cjs/wm-modal-footer.cjs.entry.js +34 -34
- package/dist/cjs/wm-modal-header.cjs.entry.js +37 -37
- package/dist/cjs/wm-modal.cjs.entry.js +164 -164
- package/dist/cjs/wm-navigation_3.cjs.entry.js +228 -228
- package/dist/cjs/wm-navigator.cjs.entry.js +269 -269
- package/dist/cjs/wm-network-uploader.cjs.entry.js +453 -453
- package/dist/cjs/wm-option_2.cjs.entry.js +485 -485
- package/dist/cjs/wm-pagination.cjs.entry.js +168 -168
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +130 -130
- package/dist/cjs/wm-search.cjs.entry.js +233 -233
- package/dist/cjs/wm-snackbar.cjs.entry.js +171 -171
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +297 -297
- package/dist/cjs/wm-tag-input.cjs.entry.js +580 -580
- package/dist/cjs/wm-timepicker.cjs.entry.js +384 -384
- package/dist/cjs/wm-toggletip.cjs.entry.js +125 -125
- package/dist/cjs/wm-uploader.cjs.entry.js +635 -635
- package/dist/cjs/wm-wrapper.cjs.entry.js +13 -13
- package/dist/collection/collection-manifest.json +1 -1
- 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 +328 -328
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +195 -195
- 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 +448 -448
- package/dist/collection/components/wm-button/wm-button.css +1 -0
- package/dist/collection/components/wm-button/wm-button.js +500 -494
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1024 -1024
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +471 -471
- 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 +136 -136
- package/dist/collection/components/wm-modal/wm-modal-header.js +87 -87
- package/dist/collection/components/wm-modal/wm-modal.js +461 -461
- 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 -218
- 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.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.js +718 -718
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
- 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.js +810 -810
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
- 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 +1079 -1079
- 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 -421
- package/dist/collection/global/functions.js +445 -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-8fa800a6.js → chartFunctions-89470707.js} +420 -420
- package/dist/esm/{functions-61c7bb1f.js → functions-78aea827.js} +1900 -479
- package/dist/esm/{global-5902ef31.js → global-2c09bb9a.js} +60 -60
- package/dist/esm/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +49 -49
- package/dist/esm/{index-7603f98e.js → index-17c79cc6.js} +4 -1
- 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 +658 -658
- 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 +336 -336
- package/dist/esm/wm-button.entry.js +239 -231
- package/dist/esm/wm-chart-slice.entry.js +14 -14
- package/dist/esm/wm-chart.entry.js +111 -111
- package/dist/esm/wm-datepicker.entry.js +266 -266
- package/dist/esm/wm-input.entry.js +135 -135
- package/dist/esm/wm-modal-footer.entry.js +34 -34
- package/dist/esm/wm-modal-header.entry.js +37 -37
- package/dist/esm/wm-modal.entry.js +164 -164
- package/dist/esm/wm-navigation_3.entry.js +228 -228
- package/dist/esm/wm-navigator.entry.js +269 -269
- package/dist/esm/wm-network-uploader.entry.js +453 -453
- package/dist/esm/wm-option_2.entry.js +485 -485
- package/dist/esm/wm-pagination.entry.js +168 -168
- package/dist/esm/wm-progress-indicator_3.entry.js +130 -130
- package/dist/esm/wm-search.entry.js +233 -233
- package/dist/esm/wm-snackbar.entry.js +171 -171
- package/dist/esm/wm-tab-item_3.entry.js +297 -297
- package/dist/esm/wm-tag-input.entry.js +580 -580
- package/dist/esm/wm-timepicker.entry.js +384 -384
- package/dist/esm/wm-toggletip.entry.js +125 -125
- package/dist/esm/wm-uploader.entry.js +635 -635
- package/dist/esm/wm-wrapper.entry.js +13 -13
- package/dist/esm-es5/{chartFunctions-8fa800a6.js → chartFunctions-89470707.js} +1 -1
- package/dist/esm-es5/functions-78aea827.js +1 -0
- package/dist/esm-es5/global-2c09bb9a.js +1 -0
- package/dist/esm-es5/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +0 -0
- package/dist/esm-es5/{index-7603f98e.js → index-17c79cc6.js} +1 -1
- 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/ripple/{p-9f12284b.system.entry.js → p-00c9f26c.system.entry.js} +1 -1
- package/dist/ripple/{p-d81a4e7c.system.entry.js → p-01fb2a55.system.entry.js} +1 -1
- package/dist/ripple/{p-212aac05.system.entry.js → p-07870c6b.system.entry.js} +1 -1
- package/dist/ripple/{p-f5df5903.system.js → p-08b7ec08.system.js} +0 -0
- package/dist/ripple/p-08e5f351.entry.js +1 -0
- package/dist/ripple/p-09043ef5.js +1 -0
- package/dist/ripple/p-0bd1815c.system.entry.js +1 -0
- package/dist/ripple/{p-fdc4a599.system.entry.js → p-1a64cbce.system.entry.js} +1 -1
- package/dist/ripple/p-1ca113d7.entry.js +1 -0
- package/dist/ripple/p-22283507.system.js +1 -0
- package/dist/ripple/p-262c75ff.entry.js +1 -0
- package/dist/ripple/{p-90ed3268.system.entry.js → p-27253ed2.system.entry.js} +1 -1
- package/dist/ripple/p-2ceec421.entry.js +1 -0
- package/dist/ripple/p-2e5cb321.entry.js +1 -0
- package/dist/ripple/{p-eee347b4.system.entry.js → p-31364104.system.entry.js} +1 -1
- package/dist/ripple/{p-9d02957d.system.js → p-313b6073.system.js} +0 -0
- package/dist/ripple/p-3e451dd0.entry.js +1 -0
- package/dist/ripple/{p-eacd33cc.system.entry.js → p-4439bdd1.system.entry.js} +1 -1
- package/dist/ripple/{p-ac2485a6.system.entry.js → p-474e6695.system.entry.js} +1 -1
- package/dist/ripple/p-539e9bfa.entry.js +1 -0
- package/dist/ripple/p-55c27bcc.entry.js +1 -0
- package/dist/ripple/p-57c94258.entry.js +1 -0
- package/dist/ripple/{p-1242752c.system.entry.js → p-58fc7a8d.system.entry.js} +1 -1
- package/dist/ripple/{p-1df2adee.system.entry.js → p-59678b70.system.entry.js} +1 -1
- package/dist/ripple/{p-5471864e.system.entry.js → p-5aa7b31c.system.entry.js} +1 -1
- package/dist/ripple/p-5bec3eeb.entry.js +1 -0
- package/dist/ripple/{p-e180001c.system.entry.js → p-65363da5.system.entry.js} +1 -1
- package/dist/ripple/p-6855af44.entry.js +1 -0
- package/dist/ripple/{p-28bf6a2e.system.js → p-68c7d04d.system.js} +1 -1
- package/dist/ripple/p-6a87da11.js +1 -0
- package/dist/ripple/{p-a0c3ef16.system.js → p-726b9452.system.js} +1 -1
- package/dist/ripple/p-82370ff7.entry.js +1 -0
- package/dist/ripple/p-82e24061.entry.js +1 -0
- package/dist/ripple/{p-398b2486.system.entry.js → p-84960032.system.entry.js} +1 -1
- package/dist/ripple/{p-43f1298b.js → p-888bec42.js} +0 -0
- package/dist/ripple/{p-487f7419.system.entry.js → p-8ad4f5ec.system.entry.js} +1 -1
- package/dist/ripple/p-93f6326d.system.js +1 -0
- package/dist/ripple/p-962f51ff.entry.js +1 -0
- package/dist/ripple/p-97c5c2ed.entry.js +1 -0
- package/dist/ripple/p-9fc092f2.entry.js +1 -0
- package/dist/ripple/p-a4b21d7b.entry.js +1 -0
- package/dist/ripple/{p-c873b490.system.entry.js → p-a5ae5ebb.system.entry.js} +1 -1
- package/dist/ripple/{p-75ef731b.system.entry.js → p-a65c09e8.system.entry.js} +1 -1
- package/dist/ripple/{p-ca2fbd1b.system.js → p-a695c1b5.system.js} +1 -1
- package/dist/ripple/{p-fd8070fb.js → p-a6d6eae7.js} +0 -0
- package/dist/ripple/{p-8aa9f811.js → p-a9ae4fa8.js} +1 -1
- package/dist/ripple/{p-73d66b0a.system.entry.js → p-abb0514c.system.entry.js} +1 -1
- package/dist/ripple/p-ad13a695.entry.js +1 -0
- package/dist/ripple/p-b0536ddb.entry.js +1 -0
- package/dist/ripple/p-b9f445c0.entry.js +1 -0
- package/dist/ripple/p-ba91d8ad.system.entry.js +1 -0
- package/dist/ripple/{p-42aa51fe.system.entry.js → p-babcd2c8.system.entry.js} +1 -1
- package/dist/ripple/{p-3f1d8211.system.entry.js → p-bcfd74b3.system.entry.js} +1 -1
- package/dist/ripple/p-c2abdcba.js +1 -0
- package/dist/ripple/{p-d3ed8b65.system.entry.js → p-c5ac8d9d.system.entry.js} +1 -1
- package/dist/ripple/p-cfe5b40f.entry.js +1 -0
- package/dist/ripple/p-d2d91a99.entry.js +1 -0
- package/dist/ripple/{p-44035b02.system.entry.js → p-d41727ae.system.entry.js} +1 -1
- package/dist/ripple/{p-ae6cfbca.system.entry.js → p-db44eb6f.system.entry.js} +1 -1
- package/dist/ripple/p-e18870d9.entry.js +1 -0
- package/dist/ripple/{p-3e6498ea.system.entry.js → p-e46174bc.system.entry.js} +1 -1
- package/dist/ripple/p-e6dee50b.entry.js +1 -0
- package/dist/ripple/p-ebd67c13.entry.js +1 -0
- package/dist/ripple/{p-68155230.system.entry.js → p-f048e76f.system.entry.js} +1 -1
- package/dist/ripple/{p-3b3e847c.system.entry.js → p-f17076c4.system.entry.js} +1 -1
- package/dist/ripple/p-f2c0d110.entry.js +1 -0
- package/dist/ripple/p-f74ccdea.entry.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 -27
- 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 -36
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +27 -27
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +17 -17
- 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 +47 -47
- 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 +14 -14
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +11 -11
- 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 -28
- 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 +119 -119
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
- package/dist/types/components.d.ts +29 -29
- 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/package.json +47 -47
- package/dist/esm-es5/functions-61c7bb1f.js +0 -15
- package/dist/esm-es5/global-5902ef31.js +0 -1
- package/dist/ripple/p-00fa3d4b.entry.js +0 -1
- package/dist/ripple/p-0f33461d.entry.js +0 -1
- package/dist/ripple/p-15b1c11b.js +0 -16
- package/dist/ripple/p-1b058a44.entry.js +0 -1
- package/dist/ripple/p-2077203e.system.js +0 -1
- package/dist/ripple/p-30745db6.entry.js +0 -1
- package/dist/ripple/p-358bde27.entry.js +0 -1
- package/dist/ripple/p-35cfcf9f.entry.js +0 -1
- package/dist/ripple/p-379b125b.entry.js +0 -1
- package/dist/ripple/p-49bf0b81.js +0 -1
- package/dist/ripple/p-4d59fe86.entry.js +0 -1
- package/dist/ripple/p-520b0f54.entry.js +0 -1
- package/dist/ripple/p-584fef7f.system.entry.js +0 -1
- package/dist/ripple/p-5e041c35.entry.js +0 -1
- package/dist/ripple/p-72eb5064.system.entry.js +0 -1
- package/dist/ripple/p-76ca7498.system.js +0 -15
- package/dist/ripple/p-7fae0cc2.entry.js +0 -1
- package/dist/ripple/p-8caae464.entry.js +0 -1
- package/dist/ripple/p-8d347cd5.entry.js +0 -1
- package/dist/ripple/p-92226595.entry.js +0 -1
- package/dist/ripple/p-9fe64cec.entry.js +0 -1
- package/dist/ripple/p-a82d37d8.entry.js +0 -1
- package/dist/ripple/p-a9e0ce88.entry.js +0 -1
- package/dist/ripple/p-b3c71506.js +0 -1
- package/dist/ripple/p-ba168596.entry.js +0 -1
- package/dist/ripple/p-cd4fda75.entry.js +0 -1
- package/dist/ripple/p-d3603def.entry.js +0 -1
- package/dist/ripple/p-e49b9a96.entry.js +0 -1
- package/dist/ripple/p-e748e22b.entry.js +0 -1
- package/dist/ripple/p-e75e75e0.entry.js +0 -1
- package/dist/ripple/p-ed657559.entry.js +0 -1
- package/dist/ripple/p-f0656464.entry.js +0 -1
- package/dist/ripple/p-f12a510f.entry.js +0 -1
- package/dist/ripple/p-f36b74bf.entry.js +0 -1
|
@@ -2,498 +2,498 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const functions = require('./functions-
|
|
5
|
+
const index = require('./index-df6a3611.js');
|
|
6
|
+
const functions = require('./functions-3c5e979d.js');
|
|
7
7
|
|
|
8
8
|
const wmOptionCss = ":host(:not(:last-child)),wm-option:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host,wm-option{display:block;cursor:pointer;position:relative;padding:1.25rem;background:#fff;font-family:inherit;list-style:none;color:#4a4a4a;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host:focus,:host.focus,wm-option:focus,wm-option.focus{outline:none;background:#f4f4f4}:host.icon,wm-option.icon{color:#575195}.checkbox:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f131\";display:inline;margin-right:0.25rem;color:#575195}:host([aria-selected=true]),wm-option[aria-selected=true]{background:rgba(46, 27, 70, 0.05);font-weight:500}:host([aria-selected=true]) .checkbox:before,wm-option[aria-selected=true] .checkbox:before{content:\"\\f132\"}:host([aria-disabled=true]),wm-option[aria-disabled=true]{font-style:italic;color:#6b6b6b;cursor:default}:host([aria-disabled=true]) .checkbox:before,wm-option[aria-disabled=true] .checkbox:before{color:#6b6b6b}:host(.multi-option),wm-option.multi-option{background:unset}:host(.hassubinfo),wm-option.hassubinfo{display:-ms-flexbox;display:flex}:host(.hassubinfo) .option-wrapper,wm-option.hassubinfo .option-wrapper{-ms-flex:1;flex:1}:host(.hassubinfo) .subinfo,wm-option.hassubinfo .subinfo{-ms-flex:none;flex:none}.subinfo{font-style:italic}.option-wrapper{display:inline-block}::slotted{font-family:inherit}::slotted(i){font-size:0.875rem}::slotted(i):before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;margin-right:0.625rem;pointer-events:none}:host(:focus),wm-option:focus{outline:none;background:#f4f4f4}:host(:hover){background:#f4f4f4;outline:none}";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.wmOptionSelected = index.createEvent(this, "wmOptionSelected", 7);
|
|
14
|
-
this.wmKeyUpPressed = index.createEvent(this, "wmKeyUpPressed", 7);
|
|
15
|
-
this.wmKeyDownPressed = index.createEvent(this, "wmKeyDownPressed", 7);
|
|
16
|
-
this.wmEscKeyPressed = index.createEvent(this, "wmEscKeyPressed", 7);
|
|
17
|
-
this.wmHomeKeyPressed = index.createEvent(this, "wmHomeKeyPressed", 7);
|
|
18
|
-
this.wmEndKeyPressed = index.createEvent(this, "wmEndKeyPressed", 7);
|
|
19
|
-
this.wmTabKeyPressed = index.createEvent(this, "wmTabKeyPressed", 7);
|
|
20
|
-
this.wmEnterKeyPressed = index.createEvent(this, "wmEnterKeyPressed", 7);
|
|
21
|
-
this.wmLetterPressed = index.createEvent(this, "wmLetterPressed", 7);
|
|
22
|
-
this.wmOptionBlurred = index.createEvent(this, "wmOptionBlurred", 7);
|
|
23
|
-
this.subinfo = undefined;
|
|
24
|
-
this.disabled = false;
|
|
25
|
-
this.selected = false;
|
|
26
|
-
this.focused = false;
|
|
27
|
-
}
|
|
28
|
-
get isMultiChild() {
|
|
29
|
-
var _a;
|
|
30
|
-
return (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.multiple;
|
|
31
|
-
}
|
|
32
|
-
handleKeydown(ev) {
|
|
33
|
-
switch (ev.key) {
|
|
34
|
-
case "ArrowUp":
|
|
35
|
-
ev.preventDefault();
|
|
36
|
-
this.wmKeyUpPressed.emit();
|
|
37
|
-
break;
|
|
38
|
-
case "ArrowDown":
|
|
39
|
-
ev.preventDefault();
|
|
40
|
-
this.wmKeyDownPressed.emit(this.el);
|
|
41
|
-
break;
|
|
42
|
-
case "Enter":
|
|
43
|
-
ev.preventDefault();
|
|
44
|
-
if (!this.disabled) {
|
|
45
|
-
this.el.click();
|
|
46
|
-
this.wmEnterKeyPressed.emit(this.el);
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
case " ":
|
|
50
|
-
ev.preventDefault();
|
|
51
|
-
this.el.click();
|
|
52
|
-
break;
|
|
53
|
-
case "Escape":
|
|
54
|
-
ev.preventDefault();
|
|
55
|
-
ev.stopPropagation(); // for instance if select is in a modal, esc should close the select but not the modal
|
|
56
|
-
this.wmEscKeyPressed.emit();
|
|
57
|
-
break;
|
|
58
|
-
case "Home":
|
|
59
|
-
ev.preventDefault();
|
|
60
|
-
this.wmHomeKeyPressed.emit();
|
|
61
|
-
break;
|
|
62
|
-
case "End":
|
|
63
|
-
ev.preventDefault();
|
|
64
|
-
this.wmEndKeyPressed.emit();
|
|
65
|
-
break;
|
|
66
|
-
case "Tab":
|
|
67
|
-
this.wmTabKeyPressed.emit();
|
|
68
|
-
break;
|
|
69
|
-
default:
|
|
70
|
-
this.wmLetterPressed.emit(ev.key);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
handleSelection() {
|
|
74
|
-
if (!this.disabled) {
|
|
75
|
-
this.wmOptionSelected.emit();
|
|
76
|
-
// the parent wm-select is in charge of the actual selection
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
handleBlur(ev) {
|
|
80
|
-
this.wmOptionBlurred.emit({ relatedTarget: ev.relatedTarget });
|
|
81
|
-
}
|
|
82
|
-
syncAriaSelected() {
|
|
83
|
-
// this function only keeps the aria-selected attr in sync with the selected prop
|
|
84
|
-
// all the logic for selecting / deselecting happens in the parent wm-select
|
|
85
|
-
this.selected ? this.el.setAttribute("aria-selected", "true") : this.el.removeAttribute("aria-selected");
|
|
86
|
-
}
|
|
87
|
-
syncAriaDisabled() {
|
|
88
|
-
this.disabled ? this.el.setAttribute("aria-disabled", "true") : this.el.removeAttribute("aria-disabled");
|
|
89
|
-
}
|
|
90
|
-
focusHandler(newValue) {
|
|
91
|
-
if (newValue)
|
|
92
|
-
this.el.focus();
|
|
93
|
-
}
|
|
94
|
-
updateDisabledOnClick() {
|
|
95
|
-
if (this.disabled && this.el.onclick) {
|
|
96
|
-
this.onClickFunc = this.el.onclick;
|
|
97
|
-
this.el.onclick = null;
|
|
98
|
-
}
|
|
99
|
-
else if (!this.disabled && this.onClickFunc) {
|
|
100
|
-
this.el.onclick = this.onClickFunc;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
componentWillLoad() {
|
|
104
|
-
this.syncAriaSelected();
|
|
105
|
-
this.syncAriaDisabled();
|
|
106
|
-
this.updateDisabledOnClick();
|
|
107
|
-
}
|
|
108
|
-
render() {
|
|
109
|
-
return (index.h(index.Host, { role: "option", tabindex: this.focused ? 0 : -1, class: `${this.subinfo ? "hassubinfo" : ""} ${this.isMultiChild ? "multi-option" : ""}` }, index.h("div", { class: `option-wrapper ${this.isMultiChild ? "checkbox" : ""}` }, index.h("slot", null)), index.h("div", { class: "subinfo" }, this.subinfo)));
|
|
110
|
-
}
|
|
111
|
-
get el() { return index.getElement(this); }
|
|
112
|
-
static get watchers() { return {
|
|
113
|
-
"selected": ["syncAriaSelected"],
|
|
114
|
-
"disabled": ["syncAriaDisabled", "updateDisabledOnClick"],
|
|
115
|
-
"focused": ["focusHandler"]
|
|
116
|
-
}; }
|
|
117
|
-
};
|
|
10
|
+
const Option = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.wmOptionSelected = index.createEvent(this, "wmOptionSelected", 7);
|
|
14
|
+
this.wmKeyUpPressed = index.createEvent(this, "wmKeyUpPressed", 7);
|
|
15
|
+
this.wmKeyDownPressed = index.createEvent(this, "wmKeyDownPressed", 7);
|
|
16
|
+
this.wmEscKeyPressed = index.createEvent(this, "wmEscKeyPressed", 7);
|
|
17
|
+
this.wmHomeKeyPressed = index.createEvent(this, "wmHomeKeyPressed", 7);
|
|
18
|
+
this.wmEndKeyPressed = index.createEvent(this, "wmEndKeyPressed", 7);
|
|
19
|
+
this.wmTabKeyPressed = index.createEvent(this, "wmTabKeyPressed", 7);
|
|
20
|
+
this.wmEnterKeyPressed = index.createEvent(this, "wmEnterKeyPressed", 7);
|
|
21
|
+
this.wmLetterPressed = index.createEvent(this, "wmLetterPressed", 7);
|
|
22
|
+
this.wmOptionBlurred = index.createEvent(this, "wmOptionBlurred", 7);
|
|
23
|
+
this.subinfo = undefined;
|
|
24
|
+
this.disabled = false;
|
|
25
|
+
this.selected = false;
|
|
26
|
+
this.focused = false;
|
|
27
|
+
}
|
|
28
|
+
get isMultiChild() {
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.multiple;
|
|
31
|
+
}
|
|
32
|
+
handleKeydown(ev) {
|
|
33
|
+
switch (ev.key) {
|
|
34
|
+
case "ArrowUp":
|
|
35
|
+
ev.preventDefault();
|
|
36
|
+
this.wmKeyUpPressed.emit();
|
|
37
|
+
break;
|
|
38
|
+
case "ArrowDown":
|
|
39
|
+
ev.preventDefault();
|
|
40
|
+
this.wmKeyDownPressed.emit(this.el);
|
|
41
|
+
break;
|
|
42
|
+
case "Enter":
|
|
43
|
+
ev.preventDefault();
|
|
44
|
+
if (!this.disabled) {
|
|
45
|
+
this.el.click();
|
|
46
|
+
this.wmEnterKeyPressed.emit(this.el);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case " ":
|
|
50
|
+
ev.preventDefault();
|
|
51
|
+
this.el.click();
|
|
52
|
+
break;
|
|
53
|
+
case "Escape":
|
|
54
|
+
ev.preventDefault();
|
|
55
|
+
ev.stopPropagation(); // for instance if select is in a modal, esc should close the select but not the modal
|
|
56
|
+
this.wmEscKeyPressed.emit();
|
|
57
|
+
break;
|
|
58
|
+
case "Home":
|
|
59
|
+
ev.preventDefault();
|
|
60
|
+
this.wmHomeKeyPressed.emit();
|
|
61
|
+
break;
|
|
62
|
+
case "End":
|
|
63
|
+
ev.preventDefault();
|
|
64
|
+
this.wmEndKeyPressed.emit();
|
|
65
|
+
break;
|
|
66
|
+
case "Tab":
|
|
67
|
+
this.wmTabKeyPressed.emit();
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
this.wmLetterPressed.emit(ev.key);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
handleSelection() {
|
|
74
|
+
if (!this.disabled) {
|
|
75
|
+
this.wmOptionSelected.emit();
|
|
76
|
+
// the parent wm-select is in charge of the actual selection
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
handleBlur(ev) {
|
|
80
|
+
this.wmOptionBlurred.emit({ relatedTarget: ev.relatedTarget });
|
|
81
|
+
}
|
|
82
|
+
syncAriaSelected() {
|
|
83
|
+
// this function only keeps the aria-selected attr in sync with the selected prop
|
|
84
|
+
// all the logic for selecting / deselecting happens in the parent wm-select
|
|
85
|
+
this.selected ? this.el.setAttribute("aria-selected", "true") : this.el.removeAttribute("aria-selected");
|
|
86
|
+
}
|
|
87
|
+
syncAriaDisabled() {
|
|
88
|
+
this.disabled ? this.el.setAttribute("aria-disabled", "true") : this.el.removeAttribute("aria-disabled");
|
|
89
|
+
}
|
|
90
|
+
focusHandler(newValue) {
|
|
91
|
+
if (newValue)
|
|
92
|
+
this.el.focus();
|
|
93
|
+
}
|
|
94
|
+
updateDisabledOnClick() {
|
|
95
|
+
if (this.disabled && this.el.onclick) {
|
|
96
|
+
this.onClickFunc = this.el.onclick;
|
|
97
|
+
this.el.onclick = null;
|
|
98
|
+
}
|
|
99
|
+
else if (!this.disabled && this.onClickFunc) {
|
|
100
|
+
this.el.onclick = this.onClickFunc;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
componentWillLoad() {
|
|
104
|
+
this.syncAriaSelected();
|
|
105
|
+
this.syncAriaDisabled();
|
|
106
|
+
this.updateDisabledOnClick();
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
return (index.h(index.Host, { role: "option", tabindex: this.focused ? 0 : -1, class: `${this.subinfo ? "hassubinfo" : ""} ${this.isMultiChild ? "multi-option" : ""}` }, index.h("div", { class: `option-wrapper ${this.isMultiChild ? "checkbox" : ""}` }, index.h("slot", null)), index.h("div", { class: "subinfo" }, this.subinfo)));
|
|
110
|
+
}
|
|
111
|
+
get el() { return index.getElement(this); }
|
|
112
|
+
static get watchers() { return {
|
|
113
|
+
"selected": ["syncAriaSelected"],
|
|
114
|
+
"disabled": ["syncAriaDisabled", "updateDisabledOnClick"],
|
|
115
|
+
"focused": ["focusHandler"]
|
|
116
|
+
}; }
|
|
117
|
+
};
|
|
118
118
|
Option.style = wmOptionCss;
|
|
119
119
|
|
|
120
120
|
const wmSelectCss = ":host{position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}.wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}.wrapper .label .required{color:#c0392b}.wrapper.label-left{-ms-flex-direction:row;flex-direction:row}.wrapper.label-left .label-wrapper{line-height:2.5rem}.wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}.wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}.wrapper.invalid .label{color:#c0392b}.wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f026\";margin-left:0.3125rem}[dir=RTL] .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}.wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}.wrapper .dropdown{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:#575195;min-width:8.75rem}.wrapper .dropdown .displayedoption{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-wrap:nowrap;flex-wrap:nowrap;background:transparent;width:100%;border:solid 1px rgba(35, 35, 35, 0.6);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:#575195;font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .dropdown .displayedoption{height:2.75rem}}.wrapper .dropdown .displayedoption:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f140\";position:absolute;right:0.5625rem;pointer-events:none}.wrapper .dropdown .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:transparent;text-decoration:none}.wrapper .dropdown .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .dropdown .displayedoption:focus{outline:none}.wrapper .dropdown .displayedoption::-moz-focus-inner{border:0}.wrapper .dropdown .displayedoption.user-is-tabbing:focus{-webkit-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;-moz-box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e;box-shadow:0 2px 2px 0 rgba(244, 243, 246, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 4px 3px #61279e}.wrapper .dropdown .displayedoption.user-is-tabbing:focus::-moz-focus-inner{border:0}.wrapper .dropdown .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.wrapper .dropdown .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.wrapper .dropdown .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .dropdown .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.wrapper .dropdown .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .dropdown>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .dropdown>.options{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:0;right:0;background:#fff;z-index:100;width:100%;font-size:0.875rem}.wrapper .dropdown>.options.upwards{top:unset;bottom:calc(100% - 2.5rem);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}.wrapper .dropdown>.options.hidden{visibility:hidden}.wrapper .dropdown>.options.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .dropdown .displayedoption{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}.wrapper .error-message{color:#c0392b;font-size:0.875rem;margin-top:0.25rem;margin-bottom:0.25rem;display:block;top:100%;left:0;font-style:italic}.rtl>.options{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.options .option{padding-left:3rem;padding-right:1.25rem}.rtl>.displayedoption{padding:0 0.9375rem 0 1.875rem;text-align:right}.rtl>.displayedoption:before{right:auto;left:0.5625rem}";
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
constructor(hostRef) {
|
|
124
|
-
index.registerInstance(this, hostRef);
|
|
125
|
-
this.wmSelectDidLoad = index.createEvent(this, "wmSelectDidLoad", 7);
|
|
126
|
-
this.wmSelectBlurred = index.createEvent(this, "wmSelectBlurred", 7);
|
|
127
|
-
this.wmComponentBlurred = index.createEvent(this, "wmComponentBlurred", 7);
|
|
128
|
-
this.disabled = false;
|
|
129
|
-
this.invalid = false;
|
|
130
|
-
this.labelPosition = "top";
|
|
131
|
-
this.requiredField = false;
|
|
132
|
-
this.errorMessage = "";
|
|
133
|
-
this.multiple = false;
|
|
134
|
-
this.placeholder = functions.intl.formatMessage({
|
|
135
|
-
id: "select.multiPlaceholder",
|
|
136
|
-
defaultMessage: "Make a selection",
|
|
137
|
-
description: "Placeholder text. Use imperative",
|
|
138
|
-
});
|
|
139
|
-
this.allSelectedMessage = functions.intl.formatMessage({
|
|
140
|
-
id: "select.allSelected",
|
|
141
|
-
defaultMessage: "All selected",
|
|
142
|
-
description: "Text displayed when all options are selected",
|
|
143
|
-
});
|
|
144
|
-
this.requiredMessage = functions.intl.formatMessage({
|
|
145
|
-
id: "global.requiredField",
|
|
146
|
-
defaultMessage: "required field",
|
|
147
|
-
});
|
|
148
|
-
this.isTabbing = false;
|
|
149
|
-
this.isExpanded = false;
|
|
150
|
-
this.keysSoFar = "";
|
|
151
|
-
this.searchIndex = 0;
|
|
152
|
-
this.keyClear = null;
|
|
153
|
-
this.openUp = false;
|
|
154
|
-
// for multiselect button text
|
|
155
|
-
this.overflowCount = 0;
|
|
156
|
-
this.displayedItems = [];
|
|
157
|
-
this.allSelected = false;
|
|
158
|
-
}
|
|
159
|
-
get childItems() {
|
|
160
|
-
return Array.from(this.el.querySelectorAll("wm-option"));
|
|
161
|
-
}
|
|
162
|
-
get selectedItems() {
|
|
163
|
-
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
164
|
-
}
|
|
165
|
-
toggleTabbingOn() {
|
|
166
|
-
this.isTabbing = true;
|
|
167
|
-
}
|
|
168
|
-
toggleTabbingOff() {
|
|
169
|
-
this.isTabbing = false;
|
|
170
|
-
}
|
|
171
|
-
handleOptionSelection(ev) {
|
|
172
|
-
if (!this.multiple) {
|
|
173
|
-
// ensure only one option is selected at a time
|
|
174
|
-
this.childItems
|
|
175
|
-
// remove selected on any other option
|
|
176
|
-
.filter((option) => option != ev.target && !!option.selected)
|
|
177
|
-
.map((option) => (option.selected = false));
|
|
178
|
-
}
|
|
179
|
-
this.focusItem(ev.target);
|
|
180
|
-
this.selectItem(ev.target);
|
|
181
|
-
if (!this.multiple) {
|
|
182
|
-
this.close();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
handleChildEnter() {
|
|
186
|
-
// only occurs for multiselects. handle the click, then close
|
|
187
|
-
this.close();
|
|
188
|
-
}
|
|
189
|
-
handleChildUp(ev) {
|
|
190
|
-
this.moveUp(ev.target);
|
|
191
|
-
}
|
|
192
|
-
handleChildDown(ev) {
|
|
193
|
-
this.moveDown(ev.target);
|
|
194
|
-
}
|
|
195
|
-
moveToFirstItem() {
|
|
196
|
-
this.focusItem(this.childItems[0]);
|
|
197
|
-
}
|
|
198
|
-
moveToLastItem() {
|
|
199
|
-
this.focusItem(this.childItems[this.childItems.length - 1]);
|
|
200
|
-
}
|
|
201
|
-
handleTabKey() {
|
|
202
|
-
this.close(false);
|
|
203
|
-
}
|
|
204
|
-
closePopupOnEscape() {
|
|
205
|
-
this.close();
|
|
206
|
-
}
|
|
207
|
-
handleOptionBlur(ev) {
|
|
208
|
-
const toElOrChild = ev.detail.relatedTarget === this.el || this.el.contains(ev.detail.relatedTarget);
|
|
209
|
-
// if the Option is blurred to something other than the component emit a blur event with the appropriate relatedTarget
|
|
210
|
-
// keeps our component's blur events accurate, and closes when focusing browser address bar
|
|
211
|
-
if (!toElOrChild) {
|
|
212
|
-
const event = new CustomEvent("blur");
|
|
213
|
-
// @ts-ignore
|
|
214
|
-
event.relatedTarget = ev.detail.relatedTarget;
|
|
215
|
-
this.el.dispatchEvent(event);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
handleClick(ev) {
|
|
219
|
-
const isElOrChild = ev.target === this.el || this.el.contains(ev.target);
|
|
220
|
-
if (!isElOrChild && this.isExpanded) {
|
|
221
|
-
this.close();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
handleButtonBlur(ev) {
|
|
225
|
-
const toElOrChild = ev.relatedTarget === this.el || this.el.contains(ev.relatedTarget);
|
|
226
|
-
if (toElOrChild) {
|
|
227
|
-
// do not emit a blur event when opening the dropdown and focusing the Options
|
|
228
|
-
ev.stopPropagation();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
handleKey(ev) {
|
|
232
|
-
switch (ev.key) {
|
|
233
|
-
case "ArrowDown":
|
|
234
|
-
if (this.isExpanded === false) {
|
|
235
|
-
ev.preventDefault();
|
|
236
|
-
this.open("next");
|
|
237
|
-
}
|
|
238
|
-
break;
|
|
239
|
-
case "ArrowUp":
|
|
240
|
-
if (this.isExpanded === false) {
|
|
241
|
-
ev.preventDefault();
|
|
242
|
-
this.open("previous");
|
|
243
|
-
}
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
componentWillLoad() {
|
|
248
|
-
if (!this.label) {
|
|
249
|
-
console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
|
|
250
|
-
}
|
|
251
|
-
this.el.focus = function () {
|
|
252
|
-
if (!this.disabled) {
|
|
253
|
-
this.shadowRoot.querySelector("button").focus();
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
this.uid = this.el.id ? this.el.id : functions.generateId();
|
|
257
|
-
if (document.body.classList.contains("wmcl-user-is-tabbing")) {
|
|
258
|
-
this.toggleTabbingOn();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
componentDidLoad() {
|
|
262
|
-
this.wmSelectDidLoad.emit();
|
|
263
|
-
if (!this.childItems.length) {
|
|
264
|
-
throw new Error("wm-select should have wm-option elements as children.");
|
|
265
|
-
}
|
|
266
|
-
if (this.multiple && this.childItems.filter((x) => x.subinfo).length > 0) {
|
|
267
|
-
throw new Error("wm-select with the multiple prop cannot have subinfo options");
|
|
268
|
-
}
|
|
269
|
-
if (this.multiple && !this.placeholder) {
|
|
270
|
-
throw new Error("wm-select with the multiple prop needs to also use the placeholder prop.");
|
|
271
|
-
}
|
|
272
|
-
// set initial selections / button text
|
|
273
|
-
if (this.selectedItems.length > 0) {
|
|
274
|
-
this.selectedItems.forEach((x) => this.displayedItems.push(x));
|
|
275
|
-
this.setButtonText();
|
|
276
|
-
// single Select only, pre-select if no default option from dev
|
|
277
|
-
}
|
|
278
|
-
else if (!this.multiple) {
|
|
279
|
-
this.selectItem(this.childItems[0]);
|
|
280
|
-
}
|
|
281
|
-
this.optionsEl.classList.add("hidden");
|
|
282
|
-
index.forceUpdate(this.el);
|
|
283
|
-
// Dev can overwrite the max-height rule set in the Sass file
|
|
284
|
-
if (this.maxHeight) {
|
|
285
|
-
this.optionsEl.style.maxHeight = this.maxHeight;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
moveUp(el) {
|
|
289
|
-
const prevEl = el.previousElementSibling;
|
|
290
|
-
if (prevEl) {
|
|
291
|
-
// scroll option to top of dropdown if partially obscured / out of view
|
|
292
|
-
if (prevEl.getBoundingClientRect().top < this.optionsEl.getBoundingClientRect().top) {
|
|
293
|
-
this.optionsEl.scrollTop =
|
|
294
|
-
prevEl.getBoundingClientRect().top - this.optionsEl.getBoundingClientRect().top + this.optionsEl.scrollTop;
|
|
295
|
-
}
|
|
296
|
-
this.focusItem(prevEl);
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
this.focusItem(this.childItems[this.childItems.length - 1]);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
moveDown(el) {
|
|
303
|
-
const nextEl = el.nextElementSibling;
|
|
304
|
-
if (nextEl && nextEl.tagName !== "INPUT") {
|
|
305
|
-
// scroll option to bottom of dropdown if partially obscured / out of view
|
|
306
|
-
if (nextEl.getBoundingClientRect().bottom > this.optionsEl.getBoundingClientRect().bottom) {
|
|
307
|
-
this.optionsEl.scrollTop =
|
|
308
|
-
nextEl.getBoundingClientRect().bottom -
|
|
309
|
-
this.optionsEl.getBoundingClientRect().top +
|
|
310
|
-
this.optionsEl.scrollTop -
|
|
311
|
-
this.optionsEl.offsetHeight;
|
|
312
|
-
}
|
|
313
|
-
this.focusItem(nextEl);
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
this.focusItem(this.childItems[0]);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
open(itemToSelect) {
|
|
320
|
-
if (!this.disabled) {
|
|
321
|
-
const elHeight = this.el.clientHeight;
|
|
322
|
-
const buttonHeight = this.buttonEl.clientHeight;
|
|
323
|
-
this.openUp = functions.shouldOpenUp(this.el, this.optionsEl,
|
|
324
|
-
// when opening up, dropdown covers both label and button
|
|
325
|
-
elHeight,
|
|
326
|
-
// when opening down, dropdown covers only the button
|
|
327
|
-
buttonHeight);
|
|
328
|
-
this.isExpanded = true;
|
|
329
|
-
this.optionsEl.classList.remove("hidden");
|
|
330
|
-
window.requestAnimationFrame(() => {
|
|
331
|
-
if (this.selectedItems.length > 0) {
|
|
332
|
-
if (itemToSelect === "next") {
|
|
333
|
-
this.moveDown(this.selectedItems[this.selectedItems.length - 1]);
|
|
334
|
-
}
|
|
335
|
-
else if (itemToSelect === "previous") {
|
|
336
|
-
this.moveUp(this.selectedItems[0]);
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
this.focusItem(this.selectedItems[0]);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
this.focusItem(this.childItems[0]);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
close(returnFocus = true) {
|
|
349
|
-
this.isExpanded = false;
|
|
350
|
-
this.childItems.map((i) => (i.focused = false));
|
|
351
|
-
window.setTimeout(() => {
|
|
352
|
-
this.optionsEl.classList.add("hidden");
|
|
353
|
-
// Returns focus to button after popup closes (no need if user is tabbing)
|
|
354
|
-
// Delay is necessary for screenreader to get new expanded state before focus
|
|
355
|
-
// window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
|
|
356
|
-
// also UX wise, it makes sense for the button to only be focused after the animation is complete
|
|
357
|
-
if (returnFocus) {
|
|
358
|
-
this.el.focus();
|
|
359
|
-
}
|
|
360
|
-
}, 150);
|
|
361
|
-
}
|
|
362
|
-
focusItem(item) {
|
|
363
|
-
this.childItems.forEach((i) => (i.focused = i === item));
|
|
364
|
-
}
|
|
365
|
-
selectItem(item) {
|
|
366
|
-
if (this.multiple) {
|
|
367
|
-
item.selected = !item.selected;
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
this.childItems.forEach((i) => (i.selected = i === item));
|
|
371
|
-
}
|
|
372
|
-
this.setButtonText();
|
|
373
|
-
}
|
|
374
|
-
findAndFocusItem(ev) {
|
|
375
|
-
const character = ev.detail.toUpperCase();
|
|
376
|
-
if (!this.keysSoFar) {
|
|
377
|
-
for (var i = 0; i < this.childItems.length; i++) {
|
|
378
|
-
if (this.childItems[i].focused) {
|
|
379
|
-
this.searchIndex = i;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
this.keysSoFar += character;
|
|
384
|
-
this.clearKeysSoFarAfterDelay();
|
|
385
|
-
var nextMatch = this.findMatchInRange(this.childItems, this.searchIndex + 1, this.childItems.length);
|
|
386
|
-
if (!nextMatch) {
|
|
387
|
-
nextMatch = this.findMatchInRange(this.childItems, 0, this.searchIndex);
|
|
388
|
-
}
|
|
389
|
-
if (nextMatch) {
|
|
390
|
-
this.focusItem(nextMatch);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
clearKeysSoFarAfterDelay() {
|
|
394
|
-
if (this.keyClear) {
|
|
395
|
-
window.clearTimeout(this.keyClear);
|
|
396
|
-
this.keyClear = null;
|
|
397
|
-
}
|
|
398
|
-
this.keyClear = window.setTimeout(function () {
|
|
399
|
-
this.keysSoFar = "";
|
|
400
|
-
this.keyClear = null;
|
|
401
|
-
}.bind(this), 500);
|
|
402
|
-
}
|
|
403
|
-
findMatchInRange(list, startIndex, endIndex) {
|
|
404
|
-
// Find the first item starting with the keysSoFar substring, searching in
|
|
405
|
-
// the specified range of items
|
|
406
|
-
for (var n = startIndex; n < endIndex; n++) {
|
|
407
|
-
var label = list[n].textContent;
|
|
408
|
-
if (label && label.toUpperCase().indexOf(this.keysSoFar) === 0) {
|
|
409
|
-
return list[n];
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
return null;
|
|
413
|
-
}
|
|
414
|
-
exposeErrors() {
|
|
415
|
-
// When the error changes, a new id is set for the error container and the button's aria-describedby attribute is updated accordingly. This is to make sure the screen reader announces teh updated errors in Firefox. See this longstanding bug: https://bugzilla.mozilla.org/show_bug.cgi?id=493683
|
|
416
|
-
const newId = functions.generateId();
|
|
417
|
-
this.errorContainer.id = `wm-errors-${newId}`;
|
|
418
|
-
this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
|
|
419
|
-
}
|
|
420
|
-
renderErrorContainer() {
|
|
421
|
-
return (index.h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
|
|
422
|
-
}
|
|
423
|
-
handleComponentBlur(ev) {
|
|
424
|
-
// Do not close or emit custom blur event when blurring to an element inside (wm-option)
|
|
425
|
-
if (!this.el.contains(ev.relatedTarget)) {
|
|
426
|
-
this.close(false);
|
|
427
|
-
this.wmSelectBlurred.emit();
|
|
428
|
-
this.wmComponentBlurred.emit(); // deprecated
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
setButtonText() {
|
|
432
|
-
this.displayedItems = this.childItems.filter((x) => x.selected);
|
|
433
|
-
this.allSelected = this.displayedItems.length === this.childItems.length;
|
|
434
|
-
// handle overflow + counter for multiselect
|
|
435
|
-
if (this.multiple) {
|
|
436
|
-
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
437
|
-
const overflowCounterWidth = 38;
|
|
438
|
-
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
439
|
-
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
440
|
-
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
441
|
-
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
442
|
-
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
443
|
-
let optionsWidths = this.displayedItems.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
|
|
444
|
-
let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
|
|
445
|
-
this.overflowCount = 0;
|
|
446
|
-
while (optionsTotalWidth > availableSpace && this.displayedItems.length > 1) {
|
|
447
|
-
this.overflowCount++;
|
|
448
|
-
optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
|
|
449
|
-
optionsWidths.pop();
|
|
450
|
-
this.displayedItems.pop();
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
renderButtonText() {
|
|
455
|
-
if (this.multiple && this.displayedItems.length < 1) {
|
|
456
|
-
return index.h("span", null, this.placeholder);
|
|
457
|
-
}
|
|
458
|
-
else if (this.multiple && this.allSelected && this.overflowCount > 0) {
|
|
459
|
-
return this.allSelectedMessage;
|
|
460
|
-
}
|
|
461
|
-
else {
|
|
462
|
-
return this.displayedItems.map((x, idx) => (index.h("span", null, idx > 0 ? ", " : "", x.textContent)));
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
renderSubinfo() {
|
|
466
|
-
// multiselects cannot have subinfo for options
|
|
467
|
-
if (!this.multiple && this.selectedItems.length > 0 && this.selectedItems[0].subinfo) {
|
|
468
|
-
return index.h("span", { class: "subinfo" }, this.selectedItems[0].subinfo);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
renderOverflowCount() {
|
|
472
|
-
if (this.overflowCount > 0 && !this.allSelected) {
|
|
473
|
-
return (index.h("span", null, index.h("span", { class: "overflow-counter" }, "+", this.overflowCount)));
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
render() {
|
|
477
|
-
const buttonProps = {
|
|
478
|
-
id: `selectbtn-${this.uid}`,
|
|
479
|
-
["disabled"]: this.disabled,
|
|
480
|
-
["aria-controls"]: `list-${this.uid}`,
|
|
481
|
-
["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
|
|
482
|
-
["aria-describedby"]: "wm-errors",
|
|
483
|
-
["aria-expanded"]: this.isExpanded ? "true" : "false",
|
|
484
|
-
onClick: () => (this.isExpanded ? this.close() : this.open()),
|
|
485
|
-
};
|
|
486
|
-
return (index.h(index.Host, { onBlur: (ev) => this.handleComponentBlur(ev) }, index.h("div", { class: `wrapper ${functions.getTextDir()} label-${this.labelPosition} ${this.invalid || this.errorMessage ? "invalid" : ""}` }, index.h("div", { class: "label-wrapper" }, index.h("label", { class: "label", id: `label-${this.uid}`, htmlFor: `selectbtn-${this.uid}` }, this.label,
|
|
487
|
-
// we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
|
|
488
|
-
this.requiredField ? (index.h("span", { class: "required" }, index.h("span", { class: "sr-only" }, this.requiredMessage), index.h("span", { "aria-hidden": "true" }, "*"))) : (""))), index.h("div", { class: "dropdown" }, index.h("button", Object.assign({}, buttonProps, { class: `displayedoption ${this.isTabbing ? "user-is-tabbing" : ""}`, ref: (el) => (this.buttonEl = el), onBlur: (ev) => this.handleButtonBlur(ev) }), index.h("span", { class: this.selectedItems.length > 0 && this.selectedItems.filter((x) => x.subinfo).length > 0
|
|
489
|
-
? "overflowcontrol hassubinfo"
|
|
490
|
-
: "overflowcontrol" }, index.h("span", { class: "button-text" }, this.renderButtonText()), this.renderSubinfo()), this.renderOverflowCount()), index.h("div", { class: `options ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, id: `list-${this.uid}`, tabindex: -1, role: "listbox", "aria-multiselectable": this.multiple ? "true" : null, "aria-labelledby": `label-${this.uid}`, ref: (el) => (this.optionsEl = el) }, index.h("slot", null)), this.renderErrorContainer()))));
|
|
491
|
-
}
|
|
492
|
-
get el() { return index.getElement(this); }
|
|
493
|
-
static get watchers() { return {
|
|
494
|
-
"errorMessage": ["exposeErrors"]
|
|
495
|
-
}; }
|
|
496
|
-
};
|
|
122
|
+
const Select = class {
|
|
123
|
+
constructor(hostRef) {
|
|
124
|
+
index.registerInstance(this, hostRef);
|
|
125
|
+
this.wmSelectDidLoad = index.createEvent(this, "wmSelectDidLoad", 7);
|
|
126
|
+
this.wmSelectBlurred = index.createEvent(this, "wmSelectBlurred", 7);
|
|
127
|
+
this.wmComponentBlurred = index.createEvent(this, "wmComponentBlurred", 7);
|
|
128
|
+
this.disabled = false;
|
|
129
|
+
this.invalid = false;
|
|
130
|
+
this.labelPosition = "top";
|
|
131
|
+
this.requiredField = false;
|
|
132
|
+
this.errorMessage = "";
|
|
133
|
+
this.multiple = false;
|
|
134
|
+
this.placeholder = functions.intl.formatMessage({
|
|
135
|
+
id: "select.multiPlaceholder",
|
|
136
|
+
defaultMessage: "Make a selection",
|
|
137
|
+
description: "Placeholder text. Use imperative",
|
|
138
|
+
});
|
|
139
|
+
this.allSelectedMessage = functions.intl.formatMessage({
|
|
140
|
+
id: "select.allSelected",
|
|
141
|
+
defaultMessage: "All selected",
|
|
142
|
+
description: "Text displayed when all options are selected",
|
|
143
|
+
});
|
|
144
|
+
this.requiredMessage = functions.intl.formatMessage({
|
|
145
|
+
id: "global.requiredField",
|
|
146
|
+
defaultMessage: "required field",
|
|
147
|
+
});
|
|
148
|
+
this.isTabbing = false;
|
|
149
|
+
this.isExpanded = false;
|
|
150
|
+
this.keysSoFar = "";
|
|
151
|
+
this.searchIndex = 0;
|
|
152
|
+
this.keyClear = null;
|
|
153
|
+
this.openUp = false;
|
|
154
|
+
// for multiselect button text
|
|
155
|
+
this.overflowCount = 0;
|
|
156
|
+
this.displayedItems = [];
|
|
157
|
+
this.allSelected = false;
|
|
158
|
+
}
|
|
159
|
+
get childItems() {
|
|
160
|
+
return Array.from(this.el.querySelectorAll("wm-option"));
|
|
161
|
+
}
|
|
162
|
+
get selectedItems() {
|
|
163
|
+
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
164
|
+
}
|
|
165
|
+
toggleTabbingOn() {
|
|
166
|
+
this.isTabbing = true;
|
|
167
|
+
}
|
|
168
|
+
toggleTabbingOff() {
|
|
169
|
+
this.isTabbing = false;
|
|
170
|
+
}
|
|
171
|
+
handleOptionSelection(ev) {
|
|
172
|
+
if (!this.multiple) {
|
|
173
|
+
// ensure only one option is selected at a time
|
|
174
|
+
this.childItems
|
|
175
|
+
// remove selected on any other option
|
|
176
|
+
.filter((option) => option != ev.target && !!option.selected)
|
|
177
|
+
.map((option) => (option.selected = false));
|
|
178
|
+
}
|
|
179
|
+
this.focusItem(ev.target);
|
|
180
|
+
this.selectItem(ev.target);
|
|
181
|
+
if (!this.multiple) {
|
|
182
|
+
this.close();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
handleChildEnter() {
|
|
186
|
+
// only occurs for multiselects. handle the click, then close
|
|
187
|
+
this.close();
|
|
188
|
+
}
|
|
189
|
+
handleChildUp(ev) {
|
|
190
|
+
this.moveUp(ev.target);
|
|
191
|
+
}
|
|
192
|
+
handleChildDown(ev) {
|
|
193
|
+
this.moveDown(ev.target);
|
|
194
|
+
}
|
|
195
|
+
moveToFirstItem() {
|
|
196
|
+
this.focusItem(this.childItems[0]);
|
|
197
|
+
}
|
|
198
|
+
moveToLastItem() {
|
|
199
|
+
this.focusItem(this.childItems[this.childItems.length - 1]);
|
|
200
|
+
}
|
|
201
|
+
handleTabKey() {
|
|
202
|
+
this.close(false);
|
|
203
|
+
}
|
|
204
|
+
closePopupOnEscape() {
|
|
205
|
+
this.close();
|
|
206
|
+
}
|
|
207
|
+
handleOptionBlur(ev) {
|
|
208
|
+
const toElOrChild = ev.detail.relatedTarget === this.el || this.el.contains(ev.detail.relatedTarget);
|
|
209
|
+
// if the Option is blurred to something other than the component emit a blur event with the appropriate relatedTarget
|
|
210
|
+
// keeps our component's blur events accurate, and closes when focusing browser address bar
|
|
211
|
+
if (!toElOrChild) {
|
|
212
|
+
const event = new CustomEvent("blur");
|
|
213
|
+
// @ts-ignore
|
|
214
|
+
event.relatedTarget = ev.detail.relatedTarget;
|
|
215
|
+
this.el.dispatchEvent(event);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
handleClick(ev) {
|
|
219
|
+
const isElOrChild = ev.target === this.el || this.el.contains(ev.target);
|
|
220
|
+
if (!isElOrChild && this.isExpanded) {
|
|
221
|
+
this.close();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
handleButtonBlur(ev) {
|
|
225
|
+
const toElOrChild = ev.relatedTarget === this.el || this.el.contains(ev.relatedTarget);
|
|
226
|
+
if (toElOrChild) {
|
|
227
|
+
// do not emit a blur event when opening the dropdown and focusing the Options
|
|
228
|
+
ev.stopPropagation();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
handleKey(ev) {
|
|
232
|
+
switch (ev.key) {
|
|
233
|
+
case "ArrowDown":
|
|
234
|
+
if (this.isExpanded === false) {
|
|
235
|
+
ev.preventDefault();
|
|
236
|
+
this.open("next");
|
|
237
|
+
}
|
|
238
|
+
break;
|
|
239
|
+
case "ArrowUp":
|
|
240
|
+
if (this.isExpanded === false) {
|
|
241
|
+
ev.preventDefault();
|
|
242
|
+
this.open("previous");
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
componentWillLoad() {
|
|
248
|
+
if (!this.label) {
|
|
249
|
+
console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
|
|
250
|
+
}
|
|
251
|
+
this.el.focus = function () {
|
|
252
|
+
if (!this.disabled) {
|
|
253
|
+
this.shadowRoot.querySelector("button").focus();
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
this.uid = this.el.id ? this.el.id : functions.generateId();
|
|
257
|
+
if (document.body.classList.contains("wmcl-user-is-tabbing")) {
|
|
258
|
+
this.toggleTabbingOn();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
componentDidLoad() {
|
|
262
|
+
this.wmSelectDidLoad.emit();
|
|
263
|
+
if (!this.childItems.length) {
|
|
264
|
+
throw new Error("wm-select should have wm-option elements as children.");
|
|
265
|
+
}
|
|
266
|
+
if (this.multiple && this.childItems.filter((x) => x.subinfo).length > 0) {
|
|
267
|
+
throw new Error("wm-select with the multiple prop cannot have subinfo options");
|
|
268
|
+
}
|
|
269
|
+
if (this.multiple && !this.placeholder) {
|
|
270
|
+
throw new Error("wm-select with the multiple prop needs to also use the placeholder prop.");
|
|
271
|
+
}
|
|
272
|
+
// set initial selections / button text
|
|
273
|
+
if (this.selectedItems.length > 0) {
|
|
274
|
+
this.selectedItems.forEach((x) => this.displayedItems.push(x));
|
|
275
|
+
this.setButtonText();
|
|
276
|
+
// single Select only, pre-select if no default option from dev
|
|
277
|
+
}
|
|
278
|
+
else if (!this.multiple) {
|
|
279
|
+
this.selectItem(this.childItems[0]);
|
|
280
|
+
}
|
|
281
|
+
this.optionsEl.classList.add("hidden");
|
|
282
|
+
index.forceUpdate(this.el);
|
|
283
|
+
// Dev can overwrite the max-height rule set in the Sass file
|
|
284
|
+
if (this.maxHeight) {
|
|
285
|
+
this.optionsEl.style.maxHeight = this.maxHeight;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
moveUp(el) {
|
|
289
|
+
const prevEl = el.previousElementSibling;
|
|
290
|
+
if (prevEl) {
|
|
291
|
+
// scroll option to top of dropdown if partially obscured / out of view
|
|
292
|
+
if (prevEl.getBoundingClientRect().top < this.optionsEl.getBoundingClientRect().top) {
|
|
293
|
+
this.optionsEl.scrollTop =
|
|
294
|
+
prevEl.getBoundingClientRect().top - this.optionsEl.getBoundingClientRect().top + this.optionsEl.scrollTop;
|
|
295
|
+
}
|
|
296
|
+
this.focusItem(prevEl);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
this.focusItem(this.childItems[this.childItems.length - 1]);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
moveDown(el) {
|
|
303
|
+
const nextEl = el.nextElementSibling;
|
|
304
|
+
if (nextEl && nextEl.tagName !== "INPUT") {
|
|
305
|
+
// scroll option to bottom of dropdown if partially obscured / out of view
|
|
306
|
+
if (nextEl.getBoundingClientRect().bottom > this.optionsEl.getBoundingClientRect().bottom) {
|
|
307
|
+
this.optionsEl.scrollTop =
|
|
308
|
+
nextEl.getBoundingClientRect().bottom -
|
|
309
|
+
this.optionsEl.getBoundingClientRect().top +
|
|
310
|
+
this.optionsEl.scrollTop -
|
|
311
|
+
this.optionsEl.offsetHeight;
|
|
312
|
+
}
|
|
313
|
+
this.focusItem(nextEl);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
this.focusItem(this.childItems[0]);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
open(itemToSelect) {
|
|
320
|
+
if (!this.disabled) {
|
|
321
|
+
const elHeight = this.el.clientHeight;
|
|
322
|
+
const buttonHeight = this.buttonEl.clientHeight;
|
|
323
|
+
this.openUp = functions.shouldOpenUp(this.el, this.optionsEl,
|
|
324
|
+
// when opening up, dropdown covers both label and button
|
|
325
|
+
elHeight,
|
|
326
|
+
// when opening down, dropdown covers only the button
|
|
327
|
+
buttonHeight);
|
|
328
|
+
this.isExpanded = true;
|
|
329
|
+
this.optionsEl.classList.remove("hidden");
|
|
330
|
+
window.requestAnimationFrame(() => {
|
|
331
|
+
if (this.selectedItems.length > 0) {
|
|
332
|
+
if (itemToSelect === "next") {
|
|
333
|
+
this.moveDown(this.selectedItems[this.selectedItems.length - 1]);
|
|
334
|
+
}
|
|
335
|
+
else if (itemToSelect === "previous") {
|
|
336
|
+
this.moveUp(this.selectedItems[0]);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
this.focusItem(this.selectedItems[0]);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
this.focusItem(this.childItems[0]);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
close(returnFocus = true) {
|
|
349
|
+
this.isExpanded = false;
|
|
350
|
+
this.childItems.map((i) => (i.focused = false));
|
|
351
|
+
window.setTimeout(() => {
|
|
352
|
+
this.optionsEl.classList.add("hidden");
|
|
353
|
+
// Returns focus to button after popup closes (no need if user is tabbing)
|
|
354
|
+
// Delay is necessary for screenreader to get new expanded state before focus
|
|
355
|
+
// window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
|
|
356
|
+
// also UX wise, it makes sense for the button to only be focused after the animation is complete
|
|
357
|
+
if (returnFocus) {
|
|
358
|
+
this.el.focus();
|
|
359
|
+
}
|
|
360
|
+
}, 150);
|
|
361
|
+
}
|
|
362
|
+
focusItem(item) {
|
|
363
|
+
this.childItems.forEach((i) => (i.focused = i === item));
|
|
364
|
+
}
|
|
365
|
+
selectItem(item) {
|
|
366
|
+
if (this.multiple) {
|
|
367
|
+
item.selected = !item.selected;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
this.childItems.forEach((i) => (i.selected = i === item));
|
|
371
|
+
}
|
|
372
|
+
this.setButtonText();
|
|
373
|
+
}
|
|
374
|
+
findAndFocusItem(ev) {
|
|
375
|
+
const character = ev.detail.toUpperCase();
|
|
376
|
+
if (!this.keysSoFar) {
|
|
377
|
+
for (var i = 0; i < this.childItems.length; i++) {
|
|
378
|
+
if (this.childItems[i].focused) {
|
|
379
|
+
this.searchIndex = i;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
this.keysSoFar += character;
|
|
384
|
+
this.clearKeysSoFarAfterDelay();
|
|
385
|
+
var nextMatch = this.findMatchInRange(this.childItems, this.searchIndex + 1, this.childItems.length);
|
|
386
|
+
if (!nextMatch) {
|
|
387
|
+
nextMatch = this.findMatchInRange(this.childItems, 0, this.searchIndex);
|
|
388
|
+
}
|
|
389
|
+
if (nextMatch) {
|
|
390
|
+
this.focusItem(nextMatch);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
clearKeysSoFarAfterDelay() {
|
|
394
|
+
if (this.keyClear) {
|
|
395
|
+
window.clearTimeout(this.keyClear);
|
|
396
|
+
this.keyClear = null;
|
|
397
|
+
}
|
|
398
|
+
this.keyClear = window.setTimeout(function () {
|
|
399
|
+
this.keysSoFar = "";
|
|
400
|
+
this.keyClear = null;
|
|
401
|
+
}.bind(this), 500);
|
|
402
|
+
}
|
|
403
|
+
findMatchInRange(list, startIndex, endIndex) {
|
|
404
|
+
// Find the first item starting with the keysSoFar substring, searching in
|
|
405
|
+
// the specified range of items
|
|
406
|
+
for (var n = startIndex; n < endIndex; n++) {
|
|
407
|
+
var label = list[n].textContent;
|
|
408
|
+
if (label && label.toUpperCase().indexOf(this.keysSoFar) === 0) {
|
|
409
|
+
return list[n];
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
exposeErrors() {
|
|
415
|
+
// When the error changes, a new id is set for the error container and the button's aria-describedby attribute is updated accordingly. This is to make sure the screen reader announces teh updated errors in Firefox. See this longstanding bug: https://bugzilla.mozilla.org/show_bug.cgi?id=493683
|
|
416
|
+
const newId = functions.generateId();
|
|
417
|
+
this.errorContainer.id = `wm-errors-${newId}`;
|
|
418
|
+
this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
|
|
419
|
+
}
|
|
420
|
+
renderErrorContainer() {
|
|
421
|
+
return (index.h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
|
|
422
|
+
}
|
|
423
|
+
handleComponentBlur(ev) {
|
|
424
|
+
// Do not close or emit custom blur event when blurring to an element inside (wm-option)
|
|
425
|
+
if (!this.el.contains(ev.relatedTarget)) {
|
|
426
|
+
this.close(false);
|
|
427
|
+
this.wmSelectBlurred.emit();
|
|
428
|
+
this.wmComponentBlurred.emit(); // deprecated
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
setButtonText() {
|
|
432
|
+
this.displayedItems = this.childItems.filter((x) => x.selected);
|
|
433
|
+
this.allSelected = this.displayedItems.length === this.childItems.length;
|
|
434
|
+
// handle overflow + counter for multiselect
|
|
435
|
+
if (this.multiple) {
|
|
436
|
+
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
437
|
+
const overflowCounterWidth = 38;
|
|
438
|
+
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
439
|
+
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
440
|
+
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
441
|
+
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
442
|
+
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
443
|
+
let optionsWidths = this.displayedItems.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
|
|
444
|
+
let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
|
|
445
|
+
this.overflowCount = 0;
|
|
446
|
+
while (optionsTotalWidth > availableSpace && this.displayedItems.length > 1) {
|
|
447
|
+
this.overflowCount++;
|
|
448
|
+
optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
|
|
449
|
+
optionsWidths.pop();
|
|
450
|
+
this.displayedItems.pop();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
renderButtonText() {
|
|
455
|
+
if (this.multiple && this.displayedItems.length < 1) {
|
|
456
|
+
return index.h("span", null, this.placeholder);
|
|
457
|
+
}
|
|
458
|
+
else if (this.multiple && this.allSelected && this.overflowCount > 0) {
|
|
459
|
+
return this.allSelectedMessage;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
return this.displayedItems.map((x, idx) => (index.h("span", null, idx > 0 ? ", " : "", x.textContent)));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
renderSubinfo() {
|
|
466
|
+
// multiselects cannot have subinfo for options
|
|
467
|
+
if (!this.multiple && this.selectedItems.length > 0 && this.selectedItems[0].subinfo) {
|
|
468
|
+
return index.h("span", { class: "subinfo" }, this.selectedItems[0].subinfo);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
renderOverflowCount() {
|
|
472
|
+
if (this.overflowCount > 0 && !this.allSelected) {
|
|
473
|
+
return (index.h("span", null, index.h("span", { class: "overflow-counter" }, "+", this.overflowCount)));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
render() {
|
|
477
|
+
const buttonProps = {
|
|
478
|
+
id: `selectbtn-${this.uid}`,
|
|
479
|
+
["disabled"]: this.disabled,
|
|
480
|
+
["aria-controls"]: `list-${this.uid}`,
|
|
481
|
+
["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
|
|
482
|
+
["aria-describedby"]: "wm-errors",
|
|
483
|
+
["aria-expanded"]: this.isExpanded ? "true" : "false",
|
|
484
|
+
onClick: () => (this.isExpanded ? this.close() : this.open()),
|
|
485
|
+
};
|
|
486
|
+
return (index.h(index.Host, { onBlur: (ev) => this.handleComponentBlur(ev) }, index.h("div", { class: `wrapper ${functions.getTextDir()} label-${this.labelPosition} ${this.invalid || this.errorMessage ? "invalid" : ""}` }, index.h("div", { class: "label-wrapper" }, index.h("label", { class: "label", id: `label-${this.uid}`, htmlFor: `selectbtn-${this.uid}` }, this.label,
|
|
487
|
+
// we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
|
|
488
|
+
this.requiredField ? (index.h("span", { class: "required" }, index.h("span", { class: "sr-only" }, this.requiredMessage), index.h("span", { "aria-hidden": "true" }, "*"))) : (""))), index.h("div", { class: "dropdown" }, index.h("button", Object.assign({}, buttonProps, { class: `displayedoption ${this.isTabbing ? "user-is-tabbing" : ""}`, ref: (el) => (this.buttonEl = el), onBlur: (ev) => this.handleButtonBlur(ev) }), index.h("span", { class: this.selectedItems.length > 0 && this.selectedItems.filter((x) => x.subinfo).length > 0
|
|
489
|
+
? "overflowcontrol hassubinfo"
|
|
490
|
+
: "overflowcontrol" }, index.h("span", { class: "button-text" }, this.renderButtonText()), this.renderSubinfo()), this.renderOverflowCount()), index.h("div", { class: `options ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, id: `list-${this.uid}`, tabindex: -1, role: "listbox", "aria-multiselectable": this.multiple ? "true" : null, "aria-labelledby": `label-${this.uid}`, ref: (el) => (this.optionsEl = el) }, index.h("slot", null)), this.renderErrorContainer()))));
|
|
491
|
+
}
|
|
492
|
+
get el() { return index.getElement(this); }
|
|
493
|
+
static get watchers() { return {
|
|
494
|
+
"errorMessage": ["exposeErrors"]
|
|
495
|
+
}; }
|
|
496
|
+
};
|
|
497
497
|
Select.style = wmSelectCss;
|
|
498
498
|
|
|
499
499
|
exports.wm_option = Option;
|