@watermarkinsights/ripple 3.13.0-8 → 3.13.0-9
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-0ea0888f.js → chartFunctions-34fdd3ce.js} +420 -420
- package/dist/cjs/{functions-8d3ceccd.js → functions-120449cf.js} +450 -1894
- package/dist/cjs/{global-f9c0ddfb.js → global-1d1d0ab3.js} +62 -62
- package/dist/cjs/{http-service-9e8c4dd5.js → http-service-494d81de.js} +49 -49
- package/dist/cjs/{index-df6a3611.js → index-acad7ab3.js} +1 -4
- package/dist/cjs/{interfaces-30a74c1f.js → interfaces-a3338581.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 +242 -242
- 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 +455 -455
- package/dist/cjs/wm-option_2.cjs.entry.js +710 -487
- 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 +632 -632
- 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.js +504 -504
- 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.css +12 -0
- package/dist/collection/components/wm-option/wm-option.js +419 -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 +76 -23
- package/dist/collection/components/wm-select/wm-select.js +978 -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 +787 -787
- package/dist/collection/components/wm-uploader/wm-uploader.js +1077 -1077
- 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 +15 -6
- package/dist/collection/global/chartFunctions.js +421 -421
- package/dist/collection/global/functions.js +441 -441
- package/dist/collection/global/global.js +69 -69
- 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-6f90586d.js → chartFunctions-20f05eb5.js} +420 -420
- package/dist/esm/{functions-11c0c4e2.js → functions-036af8dc.js} +450 -1894
- package/dist/esm/{global-ad52c4ef.js → global-590c515d.js} +62 -62
- package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
- package/dist/esm/{index-17c79cc6.js → index-7603f98e.js} +1 -4
- package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.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 +242 -242
- 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 +455 -455
- package/dist/esm/wm-option_2.entry.js +710 -487
- 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 +632 -632
- package/dist/esm/wm-wrapper.entry.js +13 -13
- package/dist/esm-es5/{chartFunctions-6f90586d.js → chartFunctions-20f05eb5.js} +1 -1
- package/dist/esm-es5/functions-036af8dc.js +15 -0
- package/dist/esm-es5/{global-ad52c4ef.js → global-590c515d.js} +1 -1
- package/dist/esm-es5/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +0 -0
- package/dist/esm-es5/{index-17c79cc6.js → index-7603f98e.js} +1 -1
- package/dist/esm-es5/{interfaces-61c6305b.js → interfaces-2b97fab2.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-b5b7c71f.system.js → p-04d8b674.system.js} +1 -1
- package/dist/ripple/{p-c49ef079.system.entry.js → p-04e44b30.system.entry.js} +1 -1
- package/dist/ripple/{p-2af0b657.system.entry.js → p-0556279c.system.entry.js} +1 -1
- package/dist/ripple/{p-07ebdcd4.system.entry.js → p-06adbeb9.system.entry.js} +1 -1
- package/dist/ripple/{p-fe4c1194.system.entry.js → p-0e9ccc6f.system.entry.js} +1 -1
- package/dist/ripple/p-17ceb8c1.entry.js +1 -0
- package/dist/ripple/p-1887286e.entry.js +1 -0
- package/dist/ripple/{p-06012eb7.system.entry.js → p-1ccd994d.system.entry.js} +1 -1
- package/dist/ripple/p-1d795f42.entry.js +1 -0
- package/dist/ripple/{p-59678b70.system.entry.js → p-1df2adee.system.entry.js} +1 -1
- package/dist/ripple/p-2996bfe6.entry.js +1 -0
- package/dist/ripple/p-2f860b24.entry.js +1 -0
- package/dist/ripple/{p-3c925290.js → p-3489b502.js} +1 -1
- package/dist/ripple/p-358bde27.entry.js +1 -0
- package/dist/ripple/p-3680b55d.entry.js +1 -0
- package/dist/ripple/{p-4b56c51b.system.js → p-3745c620.system.js} +1 -1
- package/dist/ripple/p-3a1d6fc4.entry.js +1 -0
- package/dist/ripple/{p-f17076c4.system.entry.js → p-3b3e847c.system.entry.js} +1 -1
- package/dist/ripple/p-42337590.entry.js +1 -0
- package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
- package/dist/ripple/{p-d927de70.system.entry.js → p-49fd7ede.system.entry.js} +1 -1
- package/dist/ripple/p-4d59fe86.entry.js +1 -0
- package/dist/ripple/{p-490dafa4.js → p-4ecd3430.js} +1 -1
- package/dist/ripple/{p-8b54c589.system.entry.js → p-62eac2d6.system.entry.js} +1 -1
- package/dist/ripple/p-6aa6a818.entry.js +1 -0
- package/dist/ripple/{p-3e875e87.system.entry.js → p-6bf5cbf4.system.entry.js} +1 -1
- package/dist/ripple/{p-08fc668c.system.entry.js → p-7173b0a7.system.entry.js} +1 -1
- package/dist/ripple/p-726c979a.system.js +15 -0
- package/dist/ripple/{p-4439bdd1.system.entry.js → p-752da0fb.system.entry.js} +1 -1
- package/dist/ripple/p-7ae1a630.entry.js +1 -0
- package/dist/ripple/p-7ecbf258.entry.js +1 -0
- package/dist/ripple/{p-910b6dd5.system.entry.js → p-7ef6a7cf.system.entry.js} +1 -1
- package/dist/ripple/p-7fae0cc2.entry.js +1 -0
- package/dist/ripple/{p-b793bc6f.system.entry.js → p-8612829b.system.entry.js} +1 -1
- package/dist/ripple/{p-c4c21c82.system.entry.js → p-895f5ec5.system.entry.js} +1 -1
- package/dist/ripple/p-8de546e8.entry.js +1 -0
- package/dist/ripple/{p-27253ed2.system.entry.js → p-90ed3268.system.entry.js} +1 -1
- package/dist/ripple/p-93dee724.entry.js +1 -0
- package/dist/ripple/p-97c2b06f.entry.js +1 -0
- package/dist/ripple/{p-84d0d2ff.system.entry.js → p-995ba16f.system.entry.js} +1 -1
- package/dist/ripple/p-9c92c93f.entry.js +1 -0
- package/dist/ripple/{p-313b6073.system.js → p-9d02957d.system.js} +0 -0
- package/dist/ripple/p-9e09d7a1.entry.js +1 -0
- package/dist/ripple/p-a04ba6c8.entry.js +1 -0
- package/dist/ripple/{p-726b9452.system.js → p-a0c3ef16.system.js} +1 -1
- package/dist/ripple/p-a9e0ce88.entry.js +1 -0
- package/dist/ripple/{p-db44eb6f.system.entry.js → p-ae6cfbca.system.entry.js} +1 -1
- package/dist/ripple/{p-7cb0035a.system.entry.js → p-af3ce4fc.system.entry.js} +1 -1
- package/dist/ripple/p-b3c71506.js +1 -0
- package/dist/ripple/{p-b9b5d979.system.entry.js → p-bbcafbd6.system.entry.js} +1 -1
- package/dist/ripple/{p-6ffdab0d.system.entry.js → p-c1443a0e.system.entry.js} +1 -1
- package/dist/ripple/{p-ffc34819.system.entry.js → p-ca383a43.system.entry.js} +1 -1
- package/dist/ripple/{p-890c71aa.system.js → p-cc247ee1.system.js} +1 -1
- package/dist/ripple/{p-57a718f0.system.entry.js → p-cd3d74d1.system.entry.js} +1 -1
- package/dist/ripple/p-d1ac96e1.system.entry.js +1 -0
- package/dist/ripple/{p-b4837126.system.entry.js → p-d48c56c7.system.entry.js} +1 -1
- package/dist/ripple/p-de3367ee.js +16 -0
- package/dist/ripple/p-e083fca6.entry.js +1 -0
- package/dist/ripple/{p-f0d3ceb1.system.entry.js → p-e4439bc3.system.entry.js} +1 -1
- package/dist/ripple/p-e524d462.entry.js +1 -0
- package/dist/ripple/p-e8d39f68.entry.js +1 -0
- package/dist/ripple/p-ed91be1a.entry.js +1 -0
- package/dist/ripple/{p-dc7e5609.system.entry.js → p-f23b3986.system.entry.js} +1 -1
- package/dist/ripple/{p-08b7ec08.system.js → p-f5df5903.system.js} +0 -0
- package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
- package/dist/ripple/p-fda61e7e.entry.js +1 -0
- package/dist/ripple/p-fe952112.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 +35 -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 +93 -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 -25
- package/dist/types/global/__mocks__/functions.d.ts +7 -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-11c0c4e2.js +0 -1
- package/dist/ripple/p-0e22a3a4.entry.js +0 -1
- package/dist/ripple/p-10f47f2e.system.entry.js +0 -1
- package/dist/ripple/p-262c75ff.entry.js +0 -1
- package/dist/ripple/p-2e5cb321.entry.js +0 -1
- package/dist/ripple/p-3d09c9d7.entry.js +0 -1
- package/dist/ripple/p-4073ac6a.entry.js +0 -1
- package/dist/ripple/p-410687ea.entry.js +0 -1
- package/dist/ripple/p-42dbd978.entry.js +0 -1
- package/dist/ripple/p-4afa52d4.entry.js +0 -1
- package/dist/ripple/p-4f3f7b2b.entry.js +0 -1
- package/dist/ripple/p-5018f8ae.entry.js +0 -1
- package/dist/ripple/p-57c94258.entry.js +0 -1
- package/dist/ripple/p-626d5017.entry.js +0 -1
- package/dist/ripple/p-70d0e993.js +0 -1
- package/dist/ripple/p-80a00759.entry.js +0 -1
- package/dist/ripple/p-80b62707.entry.js +0 -1
- package/dist/ripple/p-8a2cabf2.entry.js +0 -1
- package/dist/ripple/p-962f51ff.entry.js +0 -1
- package/dist/ripple/p-97683ddc.entry.js +0 -1
- package/dist/ripple/p-9c60325b.entry.js +0 -1
- package/dist/ripple/p-b0536ddb.entry.js +0 -1
- package/dist/ripple/p-c2abdcba.js +0 -1
- package/dist/ripple/p-c656fcf1.entry.js +0 -1
- package/dist/ripple/p-c7d51833.entry.js +0 -1
- package/dist/ripple/p-caef11cc.entry.js +0 -1
- package/dist/ripple/p-cb357a84.entry.js +0 -1
- package/dist/ripple/p-d2a11410.entry.js +0 -1
- package/dist/ripple/p-db899686.system.js +0 -1
- package/dist/ripple/p-dfa80ed1.entry.js +0 -1
- package/dist/ripple/p-e012273a.entry.js +0 -1
- package/dist/ripple/p-e4cb8aad.entry.js +0 -1
|
@@ -1,718 +1,978 @@
|
|
|
1
|
-
import { h, Component, Element, Event, Listen, Prop, State, Watch, Host } from "@stencil/core";
|
|
2
|
-
import { forceUpdate } from "@stencil/core";
|
|
3
|
-
import { generateId, getTextDir, shouldOpenUp, intl } from "../../global/functions";
|
|
4
|
-
export class Select {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.disabled = false;
|
|
7
|
-
this.invalid = false;
|
|
8
|
-
this.labelPosition = "top";
|
|
9
|
-
this.requiredField = false;
|
|
10
|
-
this.errorMessage = "";
|
|
11
|
-
this.multiple = false;
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
"
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
"
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
"
|
|
503
|
-
"
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
"
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
"
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
"
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
"
|
|
545
|
-
"
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
"
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
"
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
"
|
|
568
|
-
"
|
|
569
|
-
"
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
"
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
"
|
|
618
|
-
"
|
|
619
|
-
|
|
620
|
-
"
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
"
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
"
|
|
636
|
-
"
|
|
637
|
-
"
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
"
|
|
642
|
-
"
|
|
643
|
-
"
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
"
|
|
647
|
-
"
|
|
648
|
-
"
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
"
|
|
654
|
-
"
|
|
655
|
-
"
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
"
|
|
660
|
-
"
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
"
|
|
665
|
-
"
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
"
|
|
671
|
-
"
|
|
672
|
-
"
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
"
|
|
677
|
-
"
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
"
|
|
681
|
-
|
|
682
|
-
"
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
"
|
|
689
|
-
"
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
"
|
|
695
|
-
"
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
"
|
|
699
|
-
|
|
700
|
-
"
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
"
|
|
707
|
-
"
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
"
|
|
713
|
-
"
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
"
|
|
717
|
-
|
|
718
|
-
|
|
1
|
+
import { h, Component, Element, Event, Listen, Prop, State, Watch, Host } from "@stencil/core";
|
|
2
|
+
import { forceUpdate } from "@stencil/core";
|
|
3
|
+
import { generateId, getTextDir, shouldOpenUp, intl, debounce } from "../../global/functions";
|
|
4
|
+
export class Select {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.disabled = false;
|
|
7
|
+
this.invalid = false;
|
|
8
|
+
this.labelPosition = "top";
|
|
9
|
+
this.requiredField = false;
|
|
10
|
+
this.errorMessage = "";
|
|
11
|
+
this.multiple = false;
|
|
12
|
+
this.search = false;
|
|
13
|
+
this.placeholder = intl.formatMessage({
|
|
14
|
+
id: "select.multiPlaceholder",
|
|
15
|
+
defaultMessage: "Make a selection",
|
|
16
|
+
description: "Placeholder text. Use imperative",
|
|
17
|
+
});
|
|
18
|
+
this.searchPlaceholder = intl.formatMessage({
|
|
19
|
+
id: "select.searchPlaceholder",
|
|
20
|
+
defaultMessage: "Search",
|
|
21
|
+
description: "Placeholder text. Use imperative",
|
|
22
|
+
});
|
|
23
|
+
this.allSelectedMessage = intl.formatMessage({
|
|
24
|
+
id: "select.allSelected",
|
|
25
|
+
defaultMessage: "All selected",
|
|
26
|
+
description: "Text displayed when all options are selected",
|
|
27
|
+
});
|
|
28
|
+
this.requiredMessage = intl.formatMessage({
|
|
29
|
+
id: "global.requiredField",
|
|
30
|
+
defaultMessage: "required field",
|
|
31
|
+
});
|
|
32
|
+
this.isTabbing = false;
|
|
33
|
+
this.isExpanded = false;
|
|
34
|
+
this.announcement = "";
|
|
35
|
+
this.keysSoFar = "";
|
|
36
|
+
this.searchIndex = 0;
|
|
37
|
+
this.keyClear = null;
|
|
38
|
+
this.openUp = false;
|
|
39
|
+
//////////////////////////////////////
|
|
40
|
+
//////////////////////////////////////
|
|
41
|
+
// for multiselect button text
|
|
42
|
+
this.overflowCount = 0;
|
|
43
|
+
this.displayedOptions = [];
|
|
44
|
+
this.debouncedSearch = debounce(() => {
|
|
45
|
+
this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
|
|
46
|
+
if (this.filteredOptions.length) {
|
|
47
|
+
this.announce(this.resultsFoundMessage);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.announce(this.noResultsFoundMessage);
|
|
51
|
+
}
|
|
52
|
+
}, 150);
|
|
53
|
+
}
|
|
54
|
+
get childOptions() {
|
|
55
|
+
return Array.from(this.el.querySelectorAll("wm-option"));
|
|
56
|
+
}
|
|
57
|
+
get duplicateOptions() {
|
|
58
|
+
return Array.from(this.el.shadowRoot.querySelectorAll("wm-option"));
|
|
59
|
+
}
|
|
60
|
+
get allOptionEls() {
|
|
61
|
+
// this includes both slotted wm-options and internally created wm-options
|
|
62
|
+
return this.duplicateOptions.concat(this.childOptions);
|
|
63
|
+
}
|
|
64
|
+
get visibleOptionEls() {
|
|
65
|
+
return this.allOptionEls.filter((option) => !option.classList.contains("hidden") && !option.classList.contains("filtered-out"));
|
|
66
|
+
}
|
|
67
|
+
//////////////////////////////////////
|
|
68
|
+
// for search variants
|
|
69
|
+
get searchTerm() {
|
|
70
|
+
return this.searchFieldEl ? this.searchFieldEl.value : "";
|
|
71
|
+
}
|
|
72
|
+
get filteredOptions() {
|
|
73
|
+
return this.childOptions.filter((option) => { var _a; return (_a = option.textContent) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.searchTerm); });
|
|
74
|
+
}
|
|
75
|
+
get selectedOptions() {
|
|
76
|
+
return Array.from(this.el.querySelectorAll("wm-option")).filter((x) => x.selected);
|
|
77
|
+
}
|
|
78
|
+
get allSelected() {
|
|
79
|
+
return this.childOptions.filter((option) => option.selected).length === this.childOptions.length;
|
|
80
|
+
}
|
|
81
|
+
//////////////////////////////////////
|
|
82
|
+
get resultsFoundMessage() {
|
|
83
|
+
return intl.formatMessage({
|
|
84
|
+
id: "select.searchResultsFound",
|
|
85
|
+
defaultMessage: "{numResults, plural, one {1 option found} other {# options found}}",
|
|
86
|
+
description: "The message read by the screen reader, indicating how many results a search returned",
|
|
87
|
+
}, { numResults: this.filteredOptions.length });
|
|
88
|
+
}
|
|
89
|
+
get noResultsFoundMessage() {
|
|
90
|
+
return intl.formatMessage({
|
|
91
|
+
id: "select.noSearchResults",
|
|
92
|
+
defaultMessage: "No results found. Please try your search again.",
|
|
93
|
+
description: "The message displayed when no options pass the search filter",
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
toggleTabbingOn() {
|
|
97
|
+
this.isTabbing = true;
|
|
98
|
+
}
|
|
99
|
+
toggleTabbingOff() {
|
|
100
|
+
this.isTabbing = false;
|
|
101
|
+
}
|
|
102
|
+
handleOptionSelection(ev) {
|
|
103
|
+
if (!this.multiple) {
|
|
104
|
+
// ensure only one option is selected at a time, unselect all other options
|
|
105
|
+
this.childOptions.forEach((option) => (option.selected = option === ev.detail));
|
|
106
|
+
}
|
|
107
|
+
this.focusOption(ev.detail);
|
|
108
|
+
this.selectOption(ev.detail);
|
|
109
|
+
if (!this.multiple) {
|
|
110
|
+
this.close();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
handleChildEnter() {
|
|
114
|
+
// only occurs for multiselects. handle the click, then close
|
|
115
|
+
this.close();
|
|
116
|
+
}
|
|
117
|
+
handleChildUp(ev) {
|
|
118
|
+
this.moveUp(ev.detail);
|
|
119
|
+
}
|
|
120
|
+
handleChildDown(ev) {
|
|
121
|
+
this.moveDown(ev.detail);
|
|
122
|
+
}
|
|
123
|
+
moveToFirstOption() {
|
|
124
|
+
this.focusOption(this.visibleOptionEls[0]);
|
|
125
|
+
}
|
|
126
|
+
moveToLastOption() {
|
|
127
|
+
this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
|
|
128
|
+
}
|
|
129
|
+
closePopupOnEscape() {
|
|
130
|
+
this.close();
|
|
131
|
+
}
|
|
132
|
+
handleOptionBlur(ev) {
|
|
133
|
+
// if the Option is blurred to something other than the component emit a blur event with the appropriate relatedTarget
|
|
134
|
+
// keeps our component's blur events accurate, and closes when focusing browser address bar
|
|
135
|
+
if (!this.isElOrChild(ev.detail.relatedTarget)) {
|
|
136
|
+
const event = new CustomEvent("blur");
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
event.relatedTarget = ev.detail.relatedTarget;
|
|
139
|
+
this.el.dispatchEvent(event);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
handleClick(ev) {
|
|
143
|
+
if (!this.isElOrChild(ev.target)) {
|
|
144
|
+
this.close();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
handleButtonBlur(ev) {
|
|
148
|
+
if (this.isElOrChild(ev.relatedTarget)) {
|
|
149
|
+
// do not emit a blur event when opening the dropdown and focusing the Options
|
|
150
|
+
ev.stopPropagation();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
handleSearchFieldBlur(ev) {
|
|
154
|
+
this.searchFieldWrapperEl.classList.remove("focus");
|
|
155
|
+
if (this.isElOrChild(ev.relatedTarget)) {
|
|
156
|
+
// do not emit a blur event when moving from searchfield to options
|
|
157
|
+
ev.stopPropagation();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
handleKey(ev) {
|
|
161
|
+
switch (ev.key) {
|
|
162
|
+
case "ArrowDown":
|
|
163
|
+
if (this.isExpanded === false) {
|
|
164
|
+
ev.preventDefault();
|
|
165
|
+
this.open("next");
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
case "ArrowUp":
|
|
169
|
+
if (this.isExpanded === false) {
|
|
170
|
+
ev.preventDefault();
|
|
171
|
+
this.open("previous");
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
componentWillLoad() {
|
|
177
|
+
if (!this.label) {
|
|
178
|
+
console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).");
|
|
179
|
+
}
|
|
180
|
+
this.el.focus = function () {
|
|
181
|
+
if (!this.disabled) {
|
|
182
|
+
this.shadowRoot.querySelector("button").focus();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
this.uid = this.el.id ? this.el.id : generateId();
|
|
186
|
+
if (document.body.classList.contains("wmcl-user-is-tabbing")) {
|
|
187
|
+
this.toggleTabbingOn();
|
|
188
|
+
}
|
|
189
|
+
// set initial selections
|
|
190
|
+
if (this.selectedOptions.length > 0) {
|
|
191
|
+
this.selectedOptions.forEach((x) => {
|
|
192
|
+
this.displayedOptions.push(x);
|
|
193
|
+
});
|
|
194
|
+
// single Select only, pre-select if no default option from dev
|
|
195
|
+
}
|
|
196
|
+
else if (!this.multiple) {
|
|
197
|
+
this.selectOption(this.allOptionEls[0]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
componentDidLoad() {
|
|
201
|
+
this.wmSelectDidLoad.emit();
|
|
202
|
+
if (this.multiple && this.allOptionEls.filter((x) => x.subinfo).length > 0) {
|
|
203
|
+
throw new Error("wm-select with the multiple prop cannot have subinfo options");
|
|
204
|
+
}
|
|
205
|
+
if (this.multiple && !this.placeholder) {
|
|
206
|
+
throw new Error("wm-select with the multiple prop needs to also use the placeholder prop.");
|
|
207
|
+
}
|
|
208
|
+
this.dropdownEl.classList.add("hidden");
|
|
209
|
+
forceUpdate(this.el);
|
|
210
|
+
// Dev can overwrite the max-height rule set in the Sass file
|
|
211
|
+
if (this.maxHeight) {
|
|
212
|
+
this.dropdownEl.style.maxHeight = this.maxHeight;
|
|
213
|
+
}
|
|
214
|
+
const mutationObserver = new MutationObserver(() => this.handleSelectedMutation());
|
|
215
|
+
mutationObserver.observe(this.el, {
|
|
216
|
+
attributes: true,
|
|
217
|
+
attributeFilter: ["selected"],
|
|
218
|
+
subtree: true,
|
|
219
|
+
});
|
|
220
|
+
if (this.multiple) {
|
|
221
|
+
this.updateOptionVisibility();
|
|
222
|
+
}
|
|
223
|
+
this.setButtonText();
|
|
224
|
+
}
|
|
225
|
+
componentWillUpdate() {
|
|
226
|
+
if (this.multiple) {
|
|
227
|
+
// find last visible duplicate option and apply .last class
|
|
228
|
+
const visibleDuplicateOptions = this.visibleOptionEls.filter((option) => option.classList.contains("duplicate"));
|
|
229
|
+
visibleDuplicateOptions.forEach((option, idx) => {
|
|
230
|
+
if (idx === visibleDuplicateOptions.length - 1) {
|
|
231
|
+
option.classList.add("last");
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
option.classList.remove("last");
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
handleSelectedMutation() {
|
|
240
|
+
// dispatch change event after selected options change
|
|
241
|
+
// mutation observer prevents emitting event when an already selected option is selected again
|
|
242
|
+
const event = new CustomEvent("change");
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
this.el.dispatchEvent(event);
|
|
245
|
+
}
|
|
246
|
+
moveUp(el) {
|
|
247
|
+
const prevEl = this.visibleOptionEls[this.visibleOptionEls.indexOf(el) - 1];
|
|
248
|
+
if (prevEl) {
|
|
249
|
+
// scroll option to top of dropdown if partially obscured / out of view
|
|
250
|
+
if (prevEl.getBoundingClientRect().top < this.dropdownEl.getBoundingClientRect().top) {
|
|
251
|
+
this.scrollOptionToTop(prevEl);
|
|
252
|
+
}
|
|
253
|
+
this.focusOption(prevEl);
|
|
254
|
+
}
|
|
255
|
+
else if (this.search) {
|
|
256
|
+
// if top of list and search variant, focus search field
|
|
257
|
+
this.searchFieldEl.focus();
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
// if top of list, focus last element
|
|
261
|
+
this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
moveDown(el) {
|
|
265
|
+
const nextEl = this.visibleOptionEls[this.visibleOptionEls.indexOf(el) + 1];
|
|
266
|
+
if (nextEl) {
|
|
267
|
+
// scroll option to bottom of dropdown if partially obscured / out of view
|
|
268
|
+
if (nextEl.getBoundingClientRect().bottom > this.dropdownEl.getBoundingClientRect().bottom) {
|
|
269
|
+
this.scrollOptionToBottom(nextEl);
|
|
270
|
+
}
|
|
271
|
+
this.focusOption(nextEl);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
// if end of list, focus first option in all variants
|
|
275
|
+
this.focusOption(this.visibleOptionEls[0]);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
scrollOptionToTop(option) {
|
|
279
|
+
this.dropdownEl.scrollTop =
|
|
280
|
+
option.getBoundingClientRect().top - this.dropdownEl.getBoundingClientRect().top + this.dropdownEl.scrollTop;
|
|
281
|
+
}
|
|
282
|
+
scrollOptionToBottom(option) {
|
|
283
|
+
this.dropdownEl.scrollTop =
|
|
284
|
+
option.getBoundingClientRect().bottom -
|
|
285
|
+
this.dropdownEl.getBoundingClientRect().top +
|
|
286
|
+
this.dropdownEl.scrollTop -
|
|
287
|
+
this.dropdownEl.offsetHeight;
|
|
288
|
+
}
|
|
289
|
+
open(optionToSelect) {
|
|
290
|
+
if (!this.disabled) {
|
|
291
|
+
const elHeight = this.el.clientHeight;
|
|
292
|
+
const buttonHeight = this.buttonEl.clientHeight;
|
|
293
|
+
this.openUp = shouldOpenUp(this.el, this.dropdownEl,
|
|
294
|
+
// when opening up, dropdown covers both label and button
|
|
295
|
+
elHeight,
|
|
296
|
+
// when opening down, dropdown covers only the button
|
|
297
|
+
buttonHeight);
|
|
298
|
+
this.isExpanded = true;
|
|
299
|
+
this.dropdownEl.classList.remove("hidden");
|
|
300
|
+
window.requestAnimationFrame(() => {
|
|
301
|
+
switch (optionToSelect) {
|
|
302
|
+
case "next":
|
|
303
|
+
// search variant focuses search field
|
|
304
|
+
// all others focus option "after" last selected option (this can be the first option)
|
|
305
|
+
if (this.search) {
|
|
306
|
+
this.searchFieldEl.focus();
|
|
307
|
+
this.dropdownEl.scrollTop = 0;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
this.moveDown(this.visibleOptionEls.filter((x) => x.selected).slice(-1)[0]);
|
|
311
|
+
}
|
|
312
|
+
break;
|
|
313
|
+
case "previous":
|
|
314
|
+
// search variant focuses last option
|
|
315
|
+
// all others focus option "above" first selected option (this can be the last option)
|
|
316
|
+
if (this.search) {
|
|
317
|
+
this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
this.moveUp(this.visibleOptionEls.filter((x) => x.selected)[0]);
|
|
321
|
+
}
|
|
322
|
+
break;
|
|
323
|
+
default:
|
|
324
|
+
// search variant focuses search field
|
|
325
|
+
// all others focus the selected option
|
|
326
|
+
// if no option is selected (empty multiselect), focuses first option
|
|
327
|
+
if (this.search) {
|
|
328
|
+
this.searchFieldEl.focus();
|
|
329
|
+
this.dropdownEl.scrollTop = 0;
|
|
330
|
+
}
|
|
331
|
+
else if (this.selectedOptions.length > 0) {
|
|
332
|
+
this.focusOption(this.visibleOptionEls.filter((x) => x.selected)[0]);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
this.focusOption(this.visibleOptionEls[0]);
|
|
336
|
+
}
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
close(returnFocus = true) {
|
|
343
|
+
if (this.isExpanded) {
|
|
344
|
+
this.isExpanded = false;
|
|
345
|
+
this.allOptionEls.map((i) => (i.focused = false));
|
|
346
|
+
window.setTimeout(() => {
|
|
347
|
+
this.dropdownEl.classList.add("hidden");
|
|
348
|
+
if (this.multiple) {
|
|
349
|
+
this.updateOptionVisibility();
|
|
350
|
+
}
|
|
351
|
+
// clear search field, reset filtered / bolded state of wm-options
|
|
352
|
+
if (this.search) {
|
|
353
|
+
this.searchFieldEl.value = "";
|
|
354
|
+
this.wmSelectSearchChanged.emit({ searchTerm: this.searchTerm });
|
|
355
|
+
}
|
|
356
|
+
// Returns focus to button after popup closes (no need if user is tabbing)
|
|
357
|
+
// Delay is necessary for screenreader to get new expanded state before focus
|
|
358
|
+
// window.requestAnimationFrame is probably enough, but since we are already using setTimeout it may as well be here
|
|
359
|
+
// also UX wise, it makes sense for the button to only be focused after the animation is complete
|
|
360
|
+
if (returnFocus) {
|
|
361
|
+
this.el.focus();
|
|
362
|
+
}
|
|
363
|
+
}, 150);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
updateOptionVisibility() {
|
|
367
|
+
// this runs for search multiselects, where selected options are rendered at the top of the dropdown list
|
|
368
|
+
// slotted wm-options are hidden if selected, and duplicate wm-options are made visible if selected
|
|
369
|
+
this.childOptions.forEach((option, idx) => {
|
|
370
|
+
const duplicateOption = this.duplicateOptions[idx];
|
|
371
|
+
if (option.selected) {
|
|
372
|
+
option.classList.add("hidden");
|
|
373
|
+
duplicateOption.classList.remove("hidden");
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
option.classList.remove("hidden");
|
|
377
|
+
duplicateOption.classList.add("hidden");
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
focusOption(option) {
|
|
382
|
+
this.allOptionEls.forEach((i) => (i.focused = i === option));
|
|
383
|
+
option.focus();
|
|
384
|
+
}
|
|
385
|
+
selectOption(option) {
|
|
386
|
+
// this function does not necessarily change an options selected property to true
|
|
387
|
+
// in cases of multiselect, it toggles the selected property
|
|
388
|
+
if (option.classList.contains("duplicate")) {
|
|
389
|
+
// if clicking on a duplicate option, toggle selected property of real one, then rerender
|
|
390
|
+
const correspondingOption = this.findCorrespondingOption(option);
|
|
391
|
+
correspondingOption.selected = !correspondingOption.selected;
|
|
392
|
+
forceUpdate(this.el);
|
|
393
|
+
}
|
|
394
|
+
else if (this.multiple) {
|
|
395
|
+
option.selected = !option.selected;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
this.allOptionEls.forEach((x) => (x.selected = x === option));
|
|
399
|
+
}
|
|
400
|
+
this.setButtonText();
|
|
401
|
+
}
|
|
402
|
+
findAndFocusOption(ev) {
|
|
403
|
+
const character = ev.detail.toUpperCase();
|
|
404
|
+
if (!this.keysSoFar) {
|
|
405
|
+
for (var i = 0; i < this.allOptionEls.length; i++) {
|
|
406
|
+
if (this.allOptionEls[i].focused) {
|
|
407
|
+
this.searchIndex = i;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
this.keysSoFar += character;
|
|
412
|
+
this.clearKeysSoFarAfterDelay();
|
|
413
|
+
var nextMatch = this.findMatchInRange(this.allOptionEls, this.searchIndex + 1, this.allOptionEls.length);
|
|
414
|
+
if (!nextMatch) {
|
|
415
|
+
nextMatch = this.findMatchInRange(this.allOptionEls, 0, this.searchIndex);
|
|
416
|
+
}
|
|
417
|
+
if (nextMatch) {
|
|
418
|
+
this.focusOption(nextMatch);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
clearKeysSoFarAfterDelay() {
|
|
422
|
+
if (this.keyClear) {
|
|
423
|
+
window.clearTimeout(this.keyClear);
|
|
424
|
+
this.keyClear = null;
|
|
425
|
+
}
|
|
426
|
+
this.keyClear = window.setTimeout(function () {
|
|
427
|
+
this.keysSoFar = "";
|
|
428
|
+
this.keyClear = null;
|
|
429
|
+
}.bind(this), 500);
|
|
430
|
+
}
|
|
431
|
+
findMatchInRange(list, startIndex, endIndex) {
|
|
432
|
+
// Find the first option starting with the keysSoFar substring, searching in
|
|
433
|
+
// the specified range of options
|
|
434
|
+
for (var n = startIndex; n < endIndex; n++) {
|
|
435
|
+
var label = list[n].textContent;
|
|
436
|
+
if (label && label.toUpperCase().indexOf(this.keysSoFar) === 0) {
|
|
437
|
+
return list[n];
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
findCorrespondingOption(el) {
|
|
443
|
+
// if duplicate, returns the child wm-option
|
|
444
|
+
// if child wm-option, returns duplicate
|
|
445
|
+
const isDuplicate = el.classList.contains("duplicate");
|
|
446
|
+
return isDuplicate
|
|
447
|
+
? this.childOptions[this.duplicateOptions.indexOf(el)]
|
|
448
|
+
: this.duplicateOptions[this.childOptions.indexOf(el)];
|
|
449
|
+
}
|
|
450
|
+
isElOrChild(el) {
|
|
451
|
+
var _a;
|
|
452
|
+
// determines whether or not the element is the component, a child of the component, or exists within the component's shadowroot
|
|
453
|
+
return el === this.el || this.el.contains(el) || ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(el));
|
|
454
|
+
}
|
|
455
|
+
exposeErrors() {
|
|
456
|
+
// 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
|
|
457
|
+
const newId = generateId();
|
|
458
|
+
this.errorContainer.id = `wm-errors-${newId}`;
|
|
459
|
+
this.buttonEl.setAttribute("aria-describedby", `wm-errors-${newId}`);
|
|
460
|
+
}
|
|
461
|
+
renderErrorContainer() {
|
|
462
|
+
return (h("div", { id: "wm-errors", class: this.errorMessage ? "error-message" : "", ref: (el) => (this.errorContainer = el), "aria-live": "assertive", "aria-atomic": "true" }, this.errorMessage));
|
|
463
|
+
}
|
|
464
|
+
handleComponentBlur(ev) {
|
|
465
|
+
// Do not close or emit custom blur event when blurring to an element inside (wm-option)
|
|
466
|
+
if (!this.el.contains(ev.relatedTarget)) {
|
|
467
|
+
this.close(false);
|
|
468
|
+
this.wmSelectBlurred.emit();
|
|
469
|
+
this.wmComponentBlurred.emit(); // deprecated
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
handleSearchFieldKeyDown(ev) {
|
|
473
|
+
switch (ev.key) {
|
|
474
|
+
case "ArrowDown":
|
|
475
|
+
ev.preventDefault();
|
|
476
|
+
if (this.visibleOptionEls.length) {
|
|
477
|
+
this.focusOption(this.visibleOptionEls[0]);
|
|
478
|
+
}
|
|
479
|
+
break;
|
|
480
|
+
case "ArrowUp":
|
|
481
|
+
ev.preventDefault();
|
|
482
|
+
if (this.visibleOptionEls.length) {
|
|
483
|
+
this.focusOption(this.visibleOptionEls[this.visibleOptionEls.length - 1]);
|
|
484
|
+
}
|
|
485
|
+
break;
|
|
486
|
+
case "Escape":
|
|
487
|
+
ev.preventDefault();
|
|
488
|
+
this.close();
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
setButtonText() {
|
|
493
|
+
this.displayedOptions = this.childOptions
|
|
494
|
+
.filter((x) => x.selected)
|
|
495
|
+
.map((y) => (!y.classList.contains("hidden") ? y : this.findCorrespondingOption(y)));
|
|
496
|
+
// handle overflow + counter for multiselect
|
|
497
|
+
if (this.multiple) {
|
|
498
|
+
// this is a fixed measurement accounting for the max width of a 3 character overflow counter
|
|
499
|
+
const overflowCounterWidth = 38;
|
|
500
|
+
const computedStyle = window.getComputedStyle(this.buttonEl);
|
|
501
|
+
// there seems to be no quick way to get an elements width without padding, except for subtracting padding manually
|
|
502
|
+
const paddingLeft = parseInt(computedStyle.getPropertyValue("padding-left").slice(0, -2));
|
|
503
|
+
const paddingRight = parseInt(computedStyle.getPropertyValue("padding-right").slice(0, -2));
|
|
504
|
+
const availableSpace = this.buttonEl.clientWidth - paddingLeft - paddingRight - overflowCounterWidth;
|
|
505
|
+
let optionsWidths = this.displayedOptions.map((x) => x.shadowRoot.querySelector(".option-wrapper").clientWidth);
|
|
506
|
+
let optionsTotalWidth = optionsWidths.reduce((acc, x) => acc + x, 0);
|
|
507
|
+
this.overflowCount = 0;
|
|
508
|
+
while (optionsTotalWidth > availableSpace && this.displayedOptions.length > 1) {
|
|
509
|
+
this.overflowCount++;
|
|
510
|
+
optionsTotalWidth -= optionsWidths[optionsWidths.length - 1];
|
|
511
|
+
optionsWidths.pop();
|
|
512
|
+
this.displayedOptions.pop();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
announce(message) {
|
|
517
|
+
// \u00A0 is a non-breaking space character, which causes the message to be read as a new one
|
|
518
|
+
if (this.liveRegionEl.textContent === message) {
|
|
519
|
+
message += "\u00A0";
|
|
520
|
+
}
|
|
521
|
+
this.announcement = message;
|
|
522
|
+
}
|
|
523
|
+
renderButtonText() {
|
|
524
|
+
if (this.multiple && this.displayedOptions.length < 1) {
|
|
525
|
+
return h("span", null, this.placeholder);
|
|
526
|
+
}
|
|
527
|
+
else if (this.multiple && this.allSelected && this.overflowCount > 0) {
|
|
528
|
+
return this.allSelectedMessage;
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
return this.displayedOptions.map((x, idx) => (h("span", null,
|
|
532
|
+
idx > 0 ? ", " : "",
|
|
533
|
+
x.textContent)));
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
renderSubinfo() {
|
|
537
|
+
// multiselects cannot have subinfo for options
|
|
538
|
+
if (!this.multiple && this.selectedOptions.length > 0 && this.selectedOptions[0].subinfo) {
|
|
539
|
+
return h("span", { class: "subinfo" }, this.selectedOptions[0].subinfo);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
renderOverflowCount() {
|
|
543
|
+
if (this.overflowCount > 0 && !this.allSelected) {
|
|
544
|
+
return (h("span", null,
|
|
545
|
+
h("span", { class: "overflow-counter" },
|
|
546
|
+
"+",
|
|
547
|
+
this.overflowCount)));
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
renderSearchField() {
|
|
551
|
+
return (h("div", { class: "search" },
|
|
552
|
+
h("div", { class: "searchfield-wrapper", ref: (el) => (this.searchFieldWrapperEl = el) },
|
|
553
|
+
h("div", { class: "icon" }),
|
|
554
|
+
h("input", { ref: (el) => (this.searchFieldEl = el), class: "searchfield", role: "combobox", "aria-controls": `list-${this.uid}`, "aria-expanded": this.isExpanded ? "true" : "false", onKeyDown: (ev) => this.handleSearchFieldKeyDown(ev), onFocus: () => this.searchFieldWrapperEl.classList.add("focus"), onBlur: (ev) => this.handleSearchFieldBlur(ev), onInput: () => this.debouncedSearch(), placeholder: this.searchPlaceholder }))));
|
|
555
|
+
}
|
|
556
|
+
renderSearchFailedMessage() {
|
|
557
|
+
return h("div", { class: "search-results-message" }, this.noResultsFoundMessage);
|
|
558
|
+
}
|
|
559
|
+
renderDuplicateOptions() {
|
|
560
|
+
return Array.from(this.el.children).map((option) => {
|
|
561
|
+
return (h("wm-option", { class: "duplicate", selected: option.selected }, option.textContent));
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
render() {
|
|
565
|
+
const buttonProps = {
|
|
566
|
+
id: `selectbtn-${this.uid}`,
|
|
567
|
+
["disabled"]: this.disabled,
|
|
568
|
+
["aria-controls"]: `list-${this.uid}`,
|
|
569
|
+
["aria-labelledby"]: `label-${this.uid} selectbtn-${this.uid}`,
|
|
570
|
+
["aria-describedby"]: "wm-errors",
|
|
571
|
+
["aria-expanded"]: this.isExpanded ? "true" : "false",
|
|
572
|
+
onClick: () => (this.isExpanded ? this.close() : this.open()),
|
|
573
|
+
};
|
|
574
|
+
return (h(Host, { onBlur: (ev) => this.handleComponentBlur(ev) },
|
|
575
|
+
h("div", { class: `wrapper ${getTextDir()} label-${this.labelPosition} ${this.invalid || this.errorMessage ? "invalid" : ""}` },
|
|
576
|
+
h("div", { class: "label-wrapper" },
|
|
577
|
+
h("label", { class: "label", id: `label-${this.uid}`, htmlFor: `selectbtn-${this.uid}` },
|
|
578
|
+
this.label,
|
|
579
|
+
// we can't use aria-required or required attributes because it's invalid on the elements we're using (button controlling a listbox)
|
|
580
|
+
this.requiredField ? (h("span", { class: "required" },
|
|
581
|
+
h("span", { class: "sr-only" }, this.requiredMessage),
|
|
582
|
+
h("span", { "aria-hidden": "true" }, "*"))) : (""))),
|
|
583
|
+
h("div", { class: "button-wrapper" },
|
|
584
|
+
h("button", Object.assign({}, buttonProps, { class: `displayedoption ${this.isTabbing ? "user-is-tabbing" : ""}`, ref: (el) => (this.buttonEl = el), onBlur: (ev) => this.handleButtonBlur(ev), onFocus: () => this.close() }),
|
|
585
|
+
h("span", { class: this.selectedOptions.length > 0 && this.selectedOptions.filter((x) => x.subinfo).length > 0
|
|
586
|
+
? "overflowcontrol hassubinfo"
|
|
587
|
+
: "overflowcontrol" },
|
|
588
|
+
h("span", { class: "button-text" }, this.renderButtonText()),
|
|
589
|
+
this.renderSubinfo()),
|
|
590
|
+
this.renderOverflowCount()),
|
|
591
|
+
h("div", { class: `dropdown ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, ref: (el) => (this.dropdownEl = el) },
|
|
592
|
+
this.search && this.renderSearchField(),
|
|
593
|
+
h("div", { id: `list-${this.uid}`, tabindex: -1, role: "listbox", "aria-multiselectable": this.multiple ? "true" : null, "aria-labelledby": `label-${this.uid}` },
|
|
594
|
+
this.search && this.filteredOptions.length === 0 && this.renderSearchFailedMessage(),
|
|
595
|
+
this.multiple && this.renderDuplicateOptions(),
|
|
596
|
+
h("slot", null))),
|
|
597
|
+
this.renderErrorContainer(),
|
|
598
|
+
h("div", { "aria-live": "polite", class: "sr-only", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
|
|
599
|
+
}
|
|
600
|
+
static get is() { return "wm-select"; }
|
|
601
|
+
static get encapsulation() { return "shadow"; }
|
|
602
|
+
static get originalStyleUrls() { return {
|
|
603
|
+
"$": ["wm-select.scss"]
|
|
604
|
+
}; }
|
|
605
|
+
static get styleUrls() { return {
|
|
606
|
+
"$": ["wm-select.css"]
|
|
607
|
+
}; }
|
|
608
|
+
static get properties() { return {
|
|
609
|
+
"disabled": {
|
|
610
|
+
"type": "boolean",
|
|
611
|
+
"mutable": false,
|
|
612
|
+
"complexType": {
|
|
613
|
+
"original": "boolean",
|
|
614
|
+
"resolved": "boolean",
|
|
615
|
+
"references": {}
|
|
616
|
+
},
|
|
617
|
+
"required": false,
|
|
618
|
+
"optional": false,
|
|
619
|
+
"docs": {
|
|
620
|
+
"tags": [],
|
|
621
|
+
"text": ""
|
|
622
|
+
},
|
|
623
|
+
"attribute": "disabled",
|
|
624
|
+
"reflect": true,
|
|
625
|
+
"defaultValue": "false"
|
|
626
|
+
},
|
|
627
|
+
"invalid": {
|
|
628
|
+
"type": "boolean",
|
|
629
|
+
"mutable": true,
|
|
630
|
+
"complexType": {
|
|
631
|
+
"original": "boolean",
|
|
632
|
+
"resolved": "boolean",
|
|
633
|
+
"references": {}
|
|
634
|
+
},
|
|
635
|
+
"required": false,
|
|
636
|
+
"optional": false,
|
|
637
|
+
"docs": {
|
|
638
|
+
"tags": [],
|
|
639
|
+
"text": ""
|
|
640
|
+
},
|
|
641
|
+
"attribute": "invalid",
|
|
642
|
+
"reflect": false,
|
|
643
|
+
"defaultValue": "false"
|
|
644
|
+
},
|
|
645
|
+
"maxHeight": {
|
|
646
|
+
"type": "string",
|
|
647
|
+
"mutable": false,
|
|
648
|
+
"complexType": {
|
|
649
|
+
"original": "string",
|
|
650
|
+
"resolved": "string | undefined",
|
|
651
|
+
"references": {}
|
|
652
|
+
},
|
|
653
|
+
"required": false,
|
|
654
|
+
"optional": true,
|
|
655
|
+
"docs": {
|
|
656
|
+
"tags": [],
|
|
657
|
+
"text": ""
|
|
658
|
+
},
|
|
659
|
+
"attribute": "max-height",
|
|
660
|
+
"reflect": false
|
|
661
|
+
},
|
|
662
|
+
"label": {
|
|
663
|
+
"type": "string",
|
|
664
|
+
"mutable": true,
|
|
665
|
+
"complexType": {
|
|
666
|
+
"original": "string",
|
|
667
|
+
"resolved": "string | undefined",
|
|
668
|
+
"references": {}
|
|
669
|
+
},
|
|
670
|
+
"required": false,
|
|
671
|
+
"optional": true,
|
|
672
|
+
"docs": {
|
|
673
|
+
"tags": [],
|
|
674
|
+
"text": ""
|
|
675
|
+
},
|
|
676
|
+
"attribute": "label",
|
|
677
|
+
"reflect": false
|
|
678
|
+
},
|
|
679
|
+
"labelPosition": {
|
|
680
|
+
"type": "string",
|
|
681
|
+
"mutable": false,
|
|
682
|
+
"complexType": {
|
|
683
|
+
"original": "\"top\" | \"left\" | \"none\"",
|
|
684
|
+
"resolved": "\"left\" | \"none\" | \"top\"",
|
|
685
|
+
"references": {}
|
|
686
|
+
},
|
|
687
|
+
"required": false,
|
|
688
|
+
"optional": false,
|
|
689
|
+
"docs": {
|
|
690
|
+
"tags": [],
|
|
691
|
+
"text": ""
|
|
692
|
+
},
|
|
693
|
+
"attribute": "label-position",
|
|
694
|
+
"reflect": false,
|
|
695
|
+
"defaultValue": "\"top\""
|
|
696
|
+
},
|
|
697
|
+
"requiredField": {
|
|
698
|
+
"type": "boolean",
|
|
699
|
+
"mutable": false,
|
|
700
|
+
"complexType": {
|
|
701
|
+
"original": "boolean",
|
|
702
|
+
"resolved": "boolean",
|
|
703
|
+
"references": {}
|
|
704
|
+
},
|
|
705
|
+
"required": false,
|
|
706
|
+
"optional": false,
|
|
707
|
+
"docs": {
|
|
708
|
+
"tags": [],
|
|
709
|
+
"text": ""
|
|
710
|
+
},
|
|
711
|
+
"attribute": "required-field",
|
|
712
|
+
"reflect": false,
|
|
713
|
+
"defaultValue": "false"
|
|
714
|
+
},
|
|
715
|
+
"errorMessage": {
|
|
716
|
+
"type": "string",
|
|
717
|
+
"mutable": true,
|
|
718
|
+
"complexType": {
|
|
719
|
+
"original": "string",
|
|
720
|
+
"resolved": "string",
|
|
721
|
+
"references": {}
|
|
722
|
+
},
|
|
723
|
+
"required": false,
|
|
724
|
+
"optional": false,
|
|
725
|
+
"docs": {
|
|
726
|
+
"tags": [],
|
|
727
|
+
"text": ""
|
|
728
|
+
},
|
|
729
|
+
"attribute": "error-message",
|
|
730
|
+
"reflect": false,
|
|
731
|
+
"defaultValue": "\"\""
|
|
732
|
+
},
|
|
733
|
+
"multiple": {
|
|
734
|
+
"type": "boolean",
|
|
735
|
+
"mutable": false,
|
|
736
|
+
"complexType": {
|
|
737
|
+
"original": "boolean",
|
|
738
|
+
"resolved": "boolean",
|
|
739
|
+
"references": {}
|
|
740
|
+
},
|
|
741
|
+
"required": false,
|
|
742
|
+
"optional": false,
|
|
743
|
+
"docs": {
|
|
744
|
+
"tags": [],
|
|
745
|
+
"text": ""
|
|
746
|
+
},
|
|
747
|
+
"attribute": "multiple",
|
|
748
|
+
"reflect": false,
|
|
749
|
+
"defaultValue": "false"
|
|
750
|
+
},
|
|
751
|
+
"search": {
|
|
752
|
+
"type": "boolean",
|
|
753
|
+
"mutable": false,
|
|
754
|
+
"complexType": {
|
|
755
|
+
"original": "boolean",
|
|
756
|
+
"resolved": "boolean",
|
|
757
|
+
"references": {}
|
|
758
|
+
},
|
|
759
|
+
"required": false,
|
|
760
|
+
"optional": false,
|
|
761
|
+
"docs": {
|
|
762
|
+
"tags": [],
|
|
763
|
+
"text": ""
|
|
764
|
+
},
|
|
765
|
+
"attribute": "search",
|
|
766
|
+
"reflect": false,
|
|
767
|
+
"defaultValue": "false"
|
|
768
|
+
},
|
|
769
|
+
"placeholder": {
|
|
770
|
+
"type": "string",
|
|
771
|
+
"mutable": false,
|
|
772
|
+
"complexType": {
|
|
773
|
+
"original": "string",
|
|
774
|
+
"resolved": "string",
|
|
775
|
+
"references": {}
|
|
776
|
+
},
|
|
777
|
+
"required": false,
|
|
778
|
+
"optional": false,
|
|
779
|
+
"docs": {
|
|
780
|
+
"tags": [],
|
|
781
|
+
"text": ""
|
|
782
|
+
},
|
|
783
|
+
"attribute": "placeholder",
|
|
784
|
+
"reflect": false,
|
|
785
|
+
"defaultValue": "intl.formatMessage({\r\n id: \"select.multiPlaceholder\",\r\n defaultMessage: \"Make a selection\",\r\n description: \"Placeholder text. Use imperative\",\r\n })"
|
|
786
|
+
},
|
|
787
|
+
"searchPlaceholder": {
|
|
788
|
+
"type": "string",
|
|
789
|
+
"mutable": false,
|
|
790
|
+
"complexType": {
|
|
791
|
+
"original": "string",
|
|
792
|
+
"resolved": "string",
|
|
793
|
+
"references": {}
|
|
794
|
+
},
|
|
795
|
+
"required": false,
|
|
796
|
+
"optional": false,
|
|
797
|
+
"docs": {
|
|
798
|
+
"tags": [],
|
|
799
|
+
"text": ""
|
|
800
|
+
},
|
|
801
|
+
"attribute": "search-placeholder",
|
|
802
|
+
"reflect": false,
|
|
803
|
+
"defaultValue": "intl.formatMessage({\r\n id: \"select.searchPlaceholder\",\r\n defaultMessage: \"Search\",\r\n description: \"Placeholder text. Use imperative\",\r\n })"
|
|
804
|
+
},
|
|
805
|
+
"allSelectedMessage": {
|
|
806
|
+
"type": "string",
|
|
807
|
+
"mutable": false,
|
|
808
|
+
"complexType": {
|
|
809
|
+
"original": "string",
|
|
810
|
+
"resolved": "string",
|
|
811
|
+
"references": {}
|
|
812
|
+
},
|
|
813
|
+
"required": false,
|
|
814
|
+
"optional": false,
|
|
815
|
+
"docs": {
|
|
816
|
+
"tags": [],
|
|
817
|
+
"text": ""
|
|
818
|
+
},
|
|
819
|
+
"attribute": "all-selected-message",
|
|
820
|
+
"reflect": false,
|
|
821
|
+
"defaultValue": "intl.formatMessage({\r\n id: \"select.allSelected\",\r\n defaultMessage: \"All selected\",\r\n description: \"Text displayed when all options are selected\",\r\n })"
|
|
822
|
+
}
|
|
823
|
+
}; }
|
|
824
|
+
static get states() { return {
|
|
825
|
+
"isTabbing": {},
|
|
826
|
+
"isExpanded": {},
|
|
827
|
+
"announcement": {}
|
|
828
|
+
}; }
|
|
829
|
+
static get events() { return [{
|
|
830
|
+
"method": "wmSelectDidLoad",
|
|
831
|
+
"name": "wmSelectDidLoad",
|
|
832
|
+
"bubbles": true,
|
|
833
|
+
"cancelable": true,
|
|
834
|
+
"composed": true,
|
|
835
|
+
"docs": {
|
|
836
|
+
"tags": [],
|
|
837
|
+
"text": ""
|
|
838
|
+
},
|
|
839
|
+
"complexType": {
|
|
840
|
+
"original": "void",
|
|
841
|
+
"resolved": "void",
|
|
842
|
+
"references": {}
|
|
843
|
+
}
|
|
844
|
+
}, {
|
|
845
|
+
"method": "wmSelectBlurred",
|
|
846
|
+
"name": "wmSelectBlurred",
|
|
847
|
+
"bubbles": true,
|
|
848
|
+
"cancelable": true,
|
|
849
|
+
"composed": true,
|
|
850
|
+
"docs": {
|
|
851
|
+
"tags": [],
|
|
852
|
+
"text": ""
|
|
853
|
+
},
|
|
854
|
+
"complexType": {
|
|
855
|
+
"original": "void",
|
|
856
|
+
"resolved": "void",
|
|
857
|
+
"references": {}
|
|
858
|
+
}
|
|
859
|
+
}, {
|
|
860
|
+
"method": "wmComponentBlurred",
|
|
861
|
+
"name": "wmComponentBlurred",
|
|
862
|
+
"bubbles": true,
|
|
863
|
+
"cancelable": true,
|
|
864
|
+
"composed": true,
|
|
865
|
+
"docs": {
|
|
866
|
+
"tags": [],
|
|
867
|
+
"text": ""
|
|
868
|
+
},
|
|
869
|
+
"complexType": {
|
|
870
|
+
"original": "void",
|
|
871
|
+
"resolved": "void",
|
|
872
|
+
"references": {}
|
|
873
|
+
}
|
|
874
|
+
}, {
|
|
875
|
+
"method": "wmSelectSearchChanged",
|
|
876
|
+
"name": "wmSelectSearchChanged",
|
|
877
|
+
"bubbles": true,
|
|
878
|
+
"cancelable": true,
|
|
879
|
+
"composed": true,
|
|
880
|
+
"docs": {
|
|
881
|
+
"tags": [],
|
|
882
|
+
"text": ""
|
|
883
|
+
},
|
|
884
|
+
"complexType": {
|
|
885
|
+
"original": "Object",
|
|
886
|
+
"resolved": "Object",
|
|
887
|
+
"references": {
|
|
888
|
+
"Object": {
|
|
889
|
+
"location": "global"
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}]; }
|
|
894
|
+
static get elementRef() { return "el"; }
|
|
895
|
+
static get watchers() { return [{
|
|
896
|
+
"propName": "errorMessage",
|
|
897
|
+
"methodName": "exposeErrors"
|
|
898
|
+
}]; }
|
|
899
|
+
static get listeners() { return [{
|
|
900
|
+
"name": "wmUserIsTabbing",
|
|
901
|
+
"method": "toggleTabbingOn",
|
|
902
|
+
"target": "window",
|
|
903
|
+
"capture": false,
|
|
904
|
+
"passive": false
|
|
905
|
+
}, {
|
|
906
|
+
"name": "wmUserIsNotTabbing",
|
|
907
|
+
"method": "toggleTabbingOff",
|
|
908
|
+
"target": "window",
|
|
909
|
+
"capture": false,
|
|
910
|
+
"passive": false
|
|
911
|
+
}, {
|
|
912
|
+
"name": "wmOptionSelected",
|
|
913
|
+
"method": "handleOptionSelection",
|
|
914
|
+
"target": undefined,
|
|
915
|
+
"capture": false,
|
|
916
|
+
"passive": false
|
|
917
|
+
}, {
|
|
918
|
+
"name": "wmEnterKeyPressed",
|
|
919
|
+
"method": "handleChildEnter",
|
|
920
|
+
"target": undefined,
|
|
921
|
+
"capture": false,
|
|
922
|
+
"passive": false
|
|
923
|
+
}, {
|
|
924
|
+
"name": "wmKeyUpPressed",
|
|
925
|
+
"method": "handleChildUp",
|
|
926
|
+
"target": undefined,
|
|
927
|
+
"capture": false,
|
|
928
|
+
"passive": false
|
|
929
|
+
}, {
|
|
930
|
+
"name": "wmKeyDownPressed",
|
|
931
|
+
"method": "handleChildDown",
|
|
932
|
+
"target": undefined,
|
|
933
|
+
"capture": false,
|
|
934
|
+
"passive": false
|
|
935
|
+
}, {
|
|
936
|
+
"name": "wmHomeKeyPressed",
|
|
937
|
+
"method": "moveToFirstOption",
|
|
938
|
+
"target": undefined,
|
|
939
|
+
"capture": false,
|
|
940
|
+
"passive": false
|
|
941
|
+
}, {
|
|
942
|
+
"name": "wmEndKeyPressed",
|
|
943
|
+
"method": "moveToLastOption",
|
|
944
|
+
"target": undefined,
|
|
945
|
+
"capture": false,
|
|
946
|
+
"passive": false
|
|
947
|
+
}, {
|
|
948
|
+
"name": "wmEscKeyPressed",
|
|
949
|
+
"method": "closePopupOnEscape",
|
|
950
|
+
"target": undefined,
|
|
951
|
+
"capture": false,
|
|
952
|
+
"passive": false
|
|
953
|
+
}, {
|
|
954
|
+
"name": "wmOptionBlurred",
|
|
955
|
+
"method": "handleOptionBlur",
|
|
956
|
+
"target": undefined,
|
|
957
|
+
"capture": false,
|
|
958
|
+
"passive": false
|
|
959
|
+
}, {
|
|
960
|
+
"name": "click",
|
|
961
|
+
"method": "handleClick",
|
|
962
|
+
"target": "document",
|
|
963
|
+
"capture": true,
|
|
964
|
+
"passive": false
|
|
965
|
+
}, {
|
|
966
|
+
"name": "keydown",
|
|
967
|
+
"method": "handleKey",
|
|
968
|
+
"target": undefined,
|
|
969
|
+
"capture": false,
|
|
970
|
+
"passive": false
|
|
971
|
+
}, {
|
|
972
|
+
"name": "wmLetterPressed",
|
|
973
|
+
"method": "findAndFocusOption",
|
|
974
|
+
"target": undefined,
|
|
975
|
+
"capture": false,
|
|
976
|
+
"passive": false
|
|
977
|
+
}]; }
|
|
978
|
+
}
|