@watermarkinsights/ripple 5.6.0-2 → 5.6.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chartFunctions-800ea87d.js → chartFunctions-fb38580b.js} +10 -7
- package/dist/cjs/{functions-c6e27c75.js → functions-a70fcff7.js} +7 -104
- package/dist/{esm/app-globals-bbc3f842.js → cjs/global-85a3a126.js} +2 -7
- package/dist/cjs/index-e86c28b6.js +2653 -0
- package/dist/cjs/{intl-9f836d29.js → intl-4a3a3a94.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/priv-calendar.cjs.entry.js +5 -6
- package/dist/cjs/priv-chart-popover.cjs.entry.js +5 -6
- package/dist/cjs/priv-navigator-button.cjs.entry.js +3 -4
- package/dist/cjs/priv-navigator-item.cjs.entry.js +3 -4
- package/dist/cjs/priv-option-list.cjs.entry.js +4 -5
- package/dist/cjs/ripple.cjs.js +11 -12
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +6 -8
- package/dist/cjs/wm-button.cjs.entry.js +4 -5
- package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart.cjs.entry.js +9 -12
- package/dist/cjs/wm-date-range.cjs.entry.js +8 -9
- package/dist/cjs/wm-datepicker.cjs.entry.js +8 -9
- package/dist/cjs/wm-file-list.cjs.entry.js +3 -4
- package/dist/cjs/wm-file.cjs.entry.js +4 -5
- package/dist/cjs/wm-input.cjs.entry.js +5 -6
- package/dist/cjs/wm-line-chart.cjs.entry.js +14 -15
- package/dist/cjs/wm-modal-footer.cjs.entry.js +3 -4
- package/dist/cjs/wm-modal-header.cjs.entry.js +5 -6
- package/dist/cjs/wm-modal.cjs.entry.js +5 -6
- package/dist/cjs/wm-navigation_3.cjs.entry.js +10 -13
- package/dist/cjs/wm-navigator.cjs.entry.js +3 -4
- package/dist/cjs/wm-nested-select.cjs.entry.js +7 -8
- package/dist/cjs/wm-optgroup.cjs.entry.js +4 -5
- package/dist/cjs/wm-option_2.cjs.entry.js +8 -10
- package/dist/cjs/wm-pagination.cjs.entry.js +4 -5
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +8 -10
- package/dist/cjs/wm-search.cjs.entry.js +6 -7
- package/dist/cjs/wm-snackbar.cjs.entry.js +6 -7
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +8 -11
- package/dist/cjs/wm-tag-input.cjs.entry.js +7 -8
- package/dist/cjs/wm-tag-option.cjs.entry.js +2 -2
- package/dist/cjs/wm-textarea.cjs.entry.js +5 -6
- package/dist/cjs/wm-timepicker.cjs.entry.js +5 -6
- package/dist/cjs/wm-toggletip.cjs.entry.js +5 -6
- package/dist/cjs/wm-uploader.cjs.entry.js +6 -7
- package/dist/cjs/wm-wrapper.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/charts/chartFunctions.js +3 -3
- package/dist/collection/components/charts/chartFunctions.spec.js +16 -0
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.e2e.js +81 -0
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +2 -2
- package/dist/collection/components/charts/screenshots.e2e.js +96 -0
- package/dist/collection/components/charts/wm-chart/wm-chart.css +13 -8
- package/dist/collection/components/charts/wm-chart/wm-chart.e2e.js +213 -0
- package/dist/collection/components/charts/wm-chart/wm-chart.js +3 -5
- package/dist/collection/components/charts/wm-chart/wm-chart.spec.js +37 -0
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.e2e.js +176 -0
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +9 -9
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.spec.js +163 -0
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.css +13 -8
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +1 -1
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.e2e.js +69 -0
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +1 -1
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.spec.js +79 -0
- package/dist/collection/components/datepickers/priv-calendar/priv-calendar.js +2 -2
- package/dist/collection/components/datepickers/priv-calendar/priv-calendar.spec.js +89 -0
- package/dist/collection/components/datepickers/wm-date-range.e2e.js +443 -0
- package/dist/collection/components/datepickers/wm-date-range.js +13 -17
- package/dist/collection/components/datepickers/wm-date-range.spec.js +22 -0
- package/dist/collection/components/datepickers/wm-datepicker.e2e.js +382 -0
- package/dist/collection/components/datepickers/wm-datepicker.js +13 -17
- package/dist/collection/components/datepickers/wm-datepicker.spec.js +21 -0
- package/dist/collection/components/selects/priv-option-list/priv-option-list.js +7 -10
- package/dist/collection/components/selects/wm-nested-select/wm-nested-select.js +3 -3
- package/dist/collection/components/selects/wm-optgroup/wm-optgroup.js +2 -2
- package/dist/collection/components/selects/wm-select/wm-select.e2e.js +521 -0
- package/dist/collection/components/selects/wm-select/wm-select.js +2 -2
- package/dist/collection/components/selects/wm-select/wm-select.spec.js +271 -0
- package/dist/collection/components/wm-action-menu/wm-action-menu.e2e.js +200 -0
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +1 -1
- package/dist/collection/components/wm-action-menu/wm-action-menu.spec.js +48 -0
- package/dist/collection/components/wm-button/wm-button.e2e.js +55 -0
- package/dist/collection/components/wm-button/wm-button.js +1 -1
- package/dist/collection/components/wm-button/wm-button.spec.js +74 -0
- package/dist/collection/components/wm-file/wm-file.js +1 -1
- package/dist/collection/components/wm-file/wm-file.spec.js +194 -0
- package/dist/collection/components/wm-file-list/wm-file-list.js +1 -1
- package/dist/collection/components/wm-file-list/wm-file-list.spec.js +69 -0
- package/dist/collection/components/wm-input/wm-input.e2e.js +32 -0
- package/dist/collection/components/wm-input/wm-input.js +1 -1
- package/dist/collection/components/wm-input/wm-input.spec.js +173 -0
- package/dist/collection/components/wm-menuitem/wm-menuitem.e2e.js +23 -0
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +1 -1
- package/dist/collection/components/wm-menuitem/wm-menuitem.spec.js +54 -0
- package/dist/collection/components/wm-modal/wm-modal-footer.js +1 -1
- package/dist/collection/components/wm-modal/wm-modal-footer.spec.js +11 -0
- package/dist/collection/components/wm-modal/wm-modal-header.js +1 -1
- package/dist/collection/components/wm-modal/wm-modal-header.spec.js +8 -0
- package/dist/collection/components/wm-modal/wm-modal.e2e.js +104 -0
- package/dist/collection/components/wm-modal/wm-modal.js +2 -2
- package/dist/collection/components/wm-modal/wm-modal.spec.js +30 -0
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +1 -1
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +1 -1
- package/dist/collection/components/wm-navigation/wm-navigation.e2e.js +102 -0
- package/dist/collection/components/wm-navigation/wm-navigation.js +2 -2
- package/dist/collection/components/wm-navigation/wm-navigation.spec.js +91 -0
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.e2e.js +50 -0
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +1 -1
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +1 -1
- package/dist/collection/components/wm-navigator/wm-navigator.e2e.js +209 -0
- package/dist/collection/components/wm-navigator/wm-navigator.spec.js +177 -0
- package/dist/collection/components/wm-option/wm-option.e2e.js +22 -0
- package/dist/collection/components/wm-option/wm-option.js +1 -1
- package/dist/collection/components/wm-option/wm-option.spec.js +63 -0
- package/dist/collection/components/wm-pagination/wm-pagination.e2e.js +312 -0
- package/dist/collection/components/wm-pagination/wm-pagination.js +1 -1
- package/dist/collection/components/wm-search/wm-search.e2e.js +76 -0
- package/dist/collection/components/wm-search/wm-search.js +4 -5
- package/dist/collection/components/wm-search/wm-search.spec.js +71 -0
- package/dist/collection/components/wm-snackbar/wm-snackbar.e2e.js +112 -0
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +2 -2
- package/dist/collection/components/wm-snackbar/wm-snackbar.spec.js +9 -0
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +1 -1
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +1 -1
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +1 -1
- package/dist/collection/components/wm-tabs/wm-tabs.e2e.js +91 -0
- package/dist/collection/components/wm-tabs/wm-tabs.spec.js +12 -0
- package/dist/collection/components/wm-tag-input/wm-tag-input.e2e.js +204 -0
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +3 -3
- package/dist/collection/components/wm-tag-input/wm-tag-input.spec.js +195 -0
- package/dist/collection/components/wm-textarea/wm-textarea.e2e.js +41 -0
- package/dist/collection/components/wm-textarea/wm-textarea.js +1 -1
- package/dist/collection/components/wm-textarea/wm-textarea.spec.js +79 -0
- package/dist/collection/components/wm-timepicker/wm-timepicker.e2e.js +163 -0
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +8 -11
- package/dist/collection/components/wm-timepicker/wm-timepicker.spec.js +147 -0
- package/dist/collection/components/wm-toggletip/wm-toggletip.e2e.js +69 -0
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +2 -2
- package/dist/collection/components/wm-toggletip/wm-toggletip.spec.js +21 -0
- package/dist/collection/components/wm-uploader/wm-uploader.e2e.js +70 -0
- package/dist/collection/components/wm-uploader/wm-uploader.js +2 -2
- package/dist/collection/components/wm-uploader/wm-uploader.spec.js +234 -0
- package/dist/collection/global/functions.spec.js +126 -0
- package/dist/collection/lang/lang.spec.js +20 -0
- package/dist/esm/{chartFunctions-7e5619f6.js → chartFunctions-c07590f5.js} +10 -7
- package/dist/esm/{functions-046fc5a3.js → functions-dea8b0f6.js} +8 -105
- package/dist/{cjs/app-globals-2eb5411e.js → esm/global-fc303bc4.js} +1 -10
- package/dist/esm/index-558b5a82.js +2622 -0
- package/dist/esm/{intl-0822738a.js → intl-417d8b33.js} +1 -1
- package/dist/esm/loader.js +4 -5
- package/dist/esm/priv-calendar.entry.js +5 -6
- package/dist/esm/priv-chart-popover.entry.js +5 -6
- package/dist/esm/priv-navigator-button.entry.js +3 -4
- package/dist/esm/priv-navigator-item.entry.js +3 -4
- package/dist/esm/priv-option-list.entry.js +4 -5
- package/dist/esm/ripple.js +12 -13
- package/dist/esm/wm-action-menu_2.entry.js +6 -8
- package/dist/esm/wm-button.entry.js +4 -5
- package/dist/esm/wm-chart-slice.entry.js +1 -1
- package/dist/esm/wm-chart.entry.js +9 -12
- package/dist/esm/wm-date-range.entry.js +8 -9
- package/dist/esm/wm-datepicker.entry.js +8 -9
- package/dist/esm/wm-file-list.entry.js +3 -4
- package/dist/esm/wm-file.entry.js +4 -5
- package/dist/esm/wm-input.entry.js +5 -6
- package/dist/esm/wm-line-chart.entry.js +14 -15
- package/dist/esm/wm-modal-footer.entry.js +3 -4
- package/dist/esm/wm-modal-header.entry.js +5 -6
- package/dist/esm/wm-modal.entry.js +5 -6
- package/dist/esm/wm-navigation_3.entry.js +10 -13
- package/dist/esm/wm-navigator.entry.js +3 -4
- package/dist/esm/wm-nested-select.entry.js +7 -8
- package/dist/esm/wm-optgroup.entry.js +4 -5
- package/dist/esm/wm-option_2.entry.js +8 -10
- package/dist/esm/wm-pagination.entry.js +4 -5
- package/dist/esm/wm-progress-indicator_3.entry.js +8 -10
- package/dist/esm/wm-search.entry.js +6 -7
- package/dist/esm/wm-snackbar.entry.js +6 -7
- package/dist/esm/wm-tab-item_3.entry.js +8 -11
- package/dist/esm/wm-tag-input.entry.js +7 -8
- package/dist/esm/wm-tag-option.entry.js +2 -2
- package/dist/esm/wm-textarea.entry.js +5 -6
- package/dist/esm/wm-timepicker.entry.js +5 -6
- package/dist/esm/wm-toggletip.entry.js +5 -6
- package/dist/esm/wm-uploader.entry.js +6 -7
- package/dist/esm/wm-wrapper.entry.js +1 -1
- package/dist/esm-es5/{chartFunctions-7e5619f6.js → chartFunctions-c07590f5.js} +1 -1
- package/dist/esm-es5/functions-dea8b0f6.js +1 -0
- package/dist/esm-es5/global-fc303bc4.js +1 -0
- package/dist/esm-es5/index-558b5a82.js +1 -0
- package/dist/esm-es5/{intl-0822738a.js → intl-417d8b33.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-calendar.entry.js +1 -1
- package/dist/esm-es5/priv-chart-popover.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/priv-option-list.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-date-range.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file-list.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-line-chart.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-nested-select.entry.js +1 -1
- package/dist/esm-es5/wm-optgroup.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-tag-option.entry.js +1 -1
- package/dist/esm-es5/wm-textarea.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-wrapper.entry.js +1 -1
- package/dist/loader/cdn.js +2 -1
- package/dist/loader/index.cjs.js +2 -1
- package/dist/loader/index.d.ts +0 -3
- package/dist/loader/index.es2017.js +2 -1
- package/dist/loader/index.js +2 -1
- package/dist/ripple/p-021ff5fa.system.entry.js +1 -0
- package/dist/ripple/{p-1a474fb3.entry.js → p-0289e88d.entry.js} +1 -1
- package/dist/ripple/p-03a28fd8.entry.js +1 -0
- package/dist/ripple/p-10fffb96.entry.js +1 -0
- package/dist/ripple/p-182f1286.system.entry.js +1 -0
- package/dist/ripple/{p-fb3cfb8b.entry.js → p-1ae47d48.entry.js} +1 -1
- package/dist/ripple/p-1aead401.entry.js +1 -0
- package/dist/ripple/p-230cd6ec.system.entry.js +1 -0
- package/dist/ripple/p-24ba754f.entry.js +1 -0
- package/dist/ripple/p-24c56217.system.entry.js +1 -0
- package/dist/ripple/p-294b38ca.system.entry.js +1 -0
- package/dist/ripple/p-2c7bb996.system.entry.js +1 -0
- package/dist/ripple/p-2ed54dbc.entry.js +1 -0
- package/dist/ripple/p-2f899c05.system.entry.js +1 -0
- package/dist/ripple/p-311923b2.system.entry.js +1 -0
- package/dist/ripple/{p-823d7b4e.system.entry.js → p-32bf3f5b.system.entry.js} +1 -1
- package/dist/ripple/p-350223f1.entry.js +1 -0
- package/dist/ripple/p-3568472c.entry.js +1 -0
- package/dist/ripple/p-37687638.system.entry.js +1 -0
- package/dist/ripple/{p-e2c9204d.system.entry.js → p-37f39cd9.system.entry.js} +1 -1
- package/dist/ripple/p-3bdac9a4.entry.js +1 -0
- package/dist/ripple/{p-13b1d775.entry.js → p-48e09589.entry.js} +1 -1
- package/dist/ripple/{p-7135f074.system.entry.js → p-4df006b1.system.entry.js} +1 -1
- package/dist/ripple/p-4e1065d1.system.entry.js +1 -0
- package/dist/ripple/{p-18d3ad51.entry.js → p-503702ef.entry.js} +1 -1
- package/dist/ripple/{p-06792553.system.entry.js → p-5052c9dd.system.entry.js} +1 -1
- package/dist/ripple/p-568c595f.js +2 -0
- package/dist/ripple/p-588d678d.entry.js +1 -0
- package/dist/ripple/p-5b9babd9.system.entry.js +1 -0
- package/dist/ripple/p-61a19aa5.entry.js +1 -0
- package/dist/ripple/p-62744f66.entry.js +1 -0
- package/dist/ripple/{p-043901ab.system.entry.js → p-65d26233.system.entry.js} +1 -1
- package/dist/ripple/p-667fed4f.system.js +1 -0
- package/dist/ripple/p-6a6bfac8.entry.js +1 -0
- package/dist/ripple/{p-c171f37b.entry.js → p-6dd5fd2e.entry.js} +1 -1
- package/dist/ripple/p-71ed7e56.system.entry.js +1 -0
- package/dist/ripple/p-87d0933f.system.entry.js +1 -0
- package/dist/ripple/{p-cd0cc88d.entry.js → p-88ebddd7.entry.js} +1 -1
- package/dist/ripple/p-8c02e3a3.entry.js +1 -0
- package/dist/ripple/{p-05f0f2e9.entry.js → p-8c7d5cd9.entry.js} +1 -1
- package/dist/ripple/p-902a54c5.entry.js +1 -0
- package/dist/ripple/{p-e562e32d.system.entry.js → p-91b21054.system.entry.js} +1 -1
- package/dist/ripple/p-94db7841.entry.js +1 -0
- package/dist/ripple/p-9e9c9d20.entry.js +1 -0
- package/dist/ripple/p-a20333e9.entry.js +1 -0
- package/dist/ripple/p-ab8d78cc.system.js +2 -0
- package/dist/ripple/{p-1123b0fd.entry.js → p-ace05e0b.entry.js} +1 -1
- package/dist/ripple/p-ade3d9a9.entry.js +1 -0
- package/dist/ripple/p-b0a02b42.system.entry.js +1 -0
- package/dist/ripple/p-b8963e4d.system.entry.js +1 -0
- package/dist/ripple/{p-c2fc7204.system.entry.js → p-b918e97a.system.entry.js} +1 -1
- package/dist/ripple/p-b99f6b96.js +1 -0
- package/dist/ripple/p-b9f650c7.system.js +1 -0
- package/dist/ripple/p-bb884a44.js +1 -0
- package/dist/ripple/p-c10f3273.entry.js +1 -0
- package/dist/ripple/{p-98bf2ccb.system.js → p-c28863e7.system.js} +1 -1
- package/dist/ripple/p-c4df2809.entry.js +1 -0
- package/dist/ripple/p-c4ec5884.system.entry.js +1 -0
- package/dist/ripple/p-c51398ba.entry.js +1 -0
- package/dist/ripple/p-c7dfcc99.system.entry.js +1 -0
- package/dist/ripple/p-c885c7f9.entry.js +1 -0
- package/dist/ripple/p-c93275bd.system.entry.js +1 -0
- package/dist/ripple/p-c9543950.system.entry.js +1 -0
- package/dist/ripple/p-c999c1f7.system.entry.js +1 -0
- package/dist/ripple/{p-772c4fd2.system.entry.js → p-cb690d83.system.entry.js} +1 -1
- package/dist/ripple/{p-b6df0519.system.js → p-cd7cef47.system.js} +1 -1
- package/dist/ripple/{p-28169294.js → p-d32bf479.js} +1 -1
- package/dist/ripple/{p-ac47e6f5.system.entry.js → p-d52545c7.system.entry.js} +1 -1
- package/dist/ripple/p-d9122935.system.entry.js +1 -0
- package/dist/ripple/p-daf03315.entry.js +1 -0
- package/dist/ripple/p-de283385.system.js +1 -0
- package/dist/ripple/p-de35505c.entry.js +1 -0
- package/dist/ripple/p-e004b92b.system.entry.js +1 -0
- package/dist/ripple/p-e26a6bd0.entry.js +1 -0
- package/dist/ripple/p-e42eeb59.system.entry.js +1 -0
- package/dist/ripple/{p-58a073f2.js → p-e8c12272.js} +1 -1
- package/dist/ripple/p-e9395ac5.entry.js +1 -0
- package/dist/ripple/p-eeebc2c7.entry.js +1 -0
- package/dist/ripple/p-f69a16d4.system.entry.js +1 -0
- package/dist/ripple/p-f8c6fa96.system.entry.js +1 -0
- package/dist/ripple/{p-e25e8ed7.system.entry.js → p-fb3d5a64.system.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/stencil-public-runtime.d.ts +10 -3
- package/package.json +1 -1
- package/dist/cjs/index-788526f5.js +0 -1863
- package/dist/esm/index-130e07bb.js +0 -1832
- package/dist/esm-es5/app-globals-bbc3f842.js +0 -1
- package/dist/esm-es5/functions-046fc5a3.js +0 -1
- package/dist/esm-es5/index-130e07bb.js +0 -1
- package/dist/ripple/p-0b7a64cd.system.entry.js +0 -1
- package/dist/ripple/p-0db47768.system.entry.js +0 -1
- package/dist/ripple/p-140d2dad.system.entry.js +0 -1
- package/dist/ripple/p-1727c66e.entry.js +0 -1
- package/dist/ripple/p-179e4aee.entry.js +0 -1
- package/dist/ripple/p-1ed0a315.system.entry.js +0 -1
- package/dist/ripple/p-200298b3.entry.js +0 -1
- package/dist/ripple/p-22704516.system.entry.js +0 -1
- package/dist/ripple/p-28a88d69.entry.js +0 -1
- package/dist/ripple/p-28a89430.entry.js +0 -1
- package/dist/ripple/p-29388a85.entry.js +0 -1
- package/dist/ripple/p-2952dc73.entry.js +0 -1
- package/dist/ripple/p-2ec551cc.entry.js +0 -1
- package/dist/ripple/p-30aa965a.entry.js +0 -1
- package/dist/ripple/p-341d27c6.system.entry.js +0 -1
- package/dist/ripple/p-354a97f2.entry.js +0 -1
- package/dist/ripple/p-35f78ec6.system.entry.js +0 -1
- package/dist/ripple/p-381d004e.system.entry.js +0 -1
- package/dist/ripple/p-39de670a.entry.js +0 -1
- package/dist/ripple/p-3ad563c4.system.entry.js +0 -1
- package/dist/ripple/p-3ea3db64.system.entry.js +0 -1
- package/dist/ripple/p-42925871.entry.js +0 -1
- package/dist/ripple/p-46f449d2.system.js +0 -1
- package/dist/ripple/p-540f74b1.system.entry.js +0 -1
- package/dist/ripple/p-61666258.entry.js +0 -1
- package/dist/ripple/p-64449b64.entry.js +0 -1
- package/dist/ripple/p-68fc8da3.system.entry.js +0 -1
- package/dist/ripple/p-6e95e98c.system.js +0 -1
- package/dist/ripple/p-71ddeb97.system.js +0 -1
- package/dist/ripple/p-7b5be38a.js +0 -1
- package/dist/ripple/p-833c05ca.entry.js +0 -1
- package/dist/ripple/p-8789b4c9.js +0 -1
- package/dist/ripple/p-8dd54304.system.entry.js +0 -1
- package/dist/ripple/p-9420679d.entry.js +0 -1
- package/dist/ripple/p-96697a65.system.entry.js +0 -1
- package/dist/ripple/p-974ca7a4.system.entry.js +0 -1
- package/dist/ripple/p-97e62c9d.system.entry.js +0 -1
- package/dist/ripple/p-b116fb2d.entry.js +0 -1
- package/dist/ripple/p-bb28c2c7.system.entry.js +0 -1
- package/dist/ripple/p-c9dc5cfa.entry.js +0 -1
- package/dist/ripple/p-ca6bbd68.system.entry.js +0 -1
- package/dist/ripple/p-cb85c4a7.entry.js +0 -1
- package/dist/ripple/p-cc5b07b1.system.entry.js +0 -1
- package/dist/ripple/p-cef8a45b.system.js +0 -2
- package/dist/ripple/p-d6502e2e.entry.js +0 -1
- package/dist/ripple/p-d78dad3d.entry.js +0 -1
- package/dist/ripple/p-d7b7c350.entry.js +0 -1
- package/dist/ripple/p-d9da0502.js +0 -2
- package/dist/ripple/p-dde32280.entry.js +0 -1
- package/dist/ripple/p-dfaa6a61.system.entry.js +0 -1
- package/dist/ripple/p-e2de8541.system.entry.js +0 -1
- package/dist/ripple/p-ea407923.entry.js +0 -1
- package/dist/ripple/p-ea9c152f.entry.js +0 -1
- package/dist/ripple/p-f02dce0f.system.entry.js +0 -1
- package/dist/ripple/p-f38622dc.system.entry.js +0 -1
- package/dist/ripple/p-f8c7adab.system.entry.js +0 -1
- package/dist/ripple/p-fdb4cf9e.system.entry.js +0 -1
- package/dist/ripple/p-feb80dd1.entry.js +0 -1
- package/dist/ripple/p-ff0e05e4.entry.js +0 -1
- package/dist/types/components/selects/priv-option-list/priv-option-list.d.ts +0 -68
- package/dist/types/components/selects/wm-nested-select/wm-nested-select.d.ts +0 -55
- package/dist/types/components/selects/wm-optgroup/wm-optgroup.d.ts +0 -16
- package/dist/types/components/wm-option/wm-option.d.ts +0 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,i,e,r){function n(t){return t instanceof e?t:new e((function(i){i(t)}))}return new(e||(e=Promise))((function(e,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r["throw"](t))}catch(t){o(t)}}function l(t){t.done?e(t.value):n(t.value).then(a,s)}l((r=r.apply(t,i||[])).next())}))};var __generator=this&&this.__generator||function(t,i){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(i){return l([t,i])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(e=0)),e)try{if(r=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(o=e.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){e.label=s[1];break}if(s[0]===6&&e.label<o[1]){e.label=o[1];o=s;break}if(o&&e.label<o[2]){e.label=o[2];e.ops.push(s);break}if(o[2])e.ops.pop();e.trys.pop();continue}s=i.call(t,e)}catch(t){s=[6,t];n=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-130e07bb.js";import{d as debounce,F as transposeMatrix,x as csvToArray,G as wrapAround,H as getSmallestSkipInterval,I as calcPercentageInRange}from"./functions-046fc5a3.js";import{n as abbrNumber,o as getInterval}from"./chartFunctions-7e5619f6.js";import{l as lineChartMessages,c as chartMessages,g as globalMessages}from"./intl-0822738a.js";var wmLineChartCss=':host{--wmcolor-linechart-currentposition:var(--wmcolor-lavender);--wmcolor-linechart-delta-text-negative:var(--wmcolor-text-negative);--wmcolor-linechart-delta-text-positive:var(--wmcolor-text-positive);--wmcolor-linechart-gridline:var(--wmcolor-chart-gridline);--wmcolor-linechart-highlight-background:var(--wmcolor-interactive-background-highlight);--wmcolor-linechart-popover-background:var(--wmcolor-chart-popover-background);display:block;height:500px;width:100%;font-size:14px;overflow-y:visible;overflow-x:auto}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:562px;width:100%;height:100%;outline:none}:host .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;position:relative;color:var(--iconColor);-webkit-transform:var(--translation, unset);transform:var(--translation, unset)}:host .icon: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:var(--icon);padding:0 3px;z-index:1}:host .icon:after{color:white;position:absolute;left:3px;-webkit-transform:scale(180%);transform:scale(180%);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:var(--icon);z-index:0}:host .legend{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px 16px;margin-top:4px;margin-bottom:16px}:host .legend .legend-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:default;font-weight:600}:host .legend .legend-label.faded{opacity:0.3}:host .legend .legend-label .icon{margin-right:4px}:host .legend .visibility-toggle{margin-left:4px}:host .chart-wrapper{position:relative;-ms-flex-positive:1;flex-grow:1;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:1fr auto auto;margin-right:16px}:host .chart-label{font-size:14px;font-weight:600}:host .chart-label.--y-axis{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:var(--labelWidth);align-self:center;margin-right:16px;grid-area:1/1/2/2;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}:host .chart-label.--x-axis{margin-top:16px;text-align:center;grid-area:3/3/4/4}:host .y-intervals{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;grid-area:1/2/2/3;margin-right:4px}:host .y-intervals .y-interval{text-align:right}:host .x-intervals{display:grid;grid-template-columns:var(--columns);grid-area:2/3/3/4;line-height:1;margin-top:4px}:host .x-intervals .x-interval{text-align:center}:host .x-intervals .x-interval:first-child{text-align:left}:host .x-intervals .x-interval:last-child{text-align:right}:host .x-intervals .x-interval.hidden{visibility:hidden}:host .plot-area{position:relative;grid-area:1/3/2/4;background-image:linear-gradient(90deg, var(--wmcolor-linechart-gridline) 1px, transparent 1px);border-bottom:1px solid var(--wmcolor-linechart-gridline);background-size:var(--backgroundSize)}:host .plot-area.right-border{border-right:1px solid var(--wmcolor-linechart-gridline)}:host .line{position:absolute;width:100%;height:100%}:host .line .icon{position:absolute;-webkit-transform:var(--translation);transform:var(--translation);left:var(--xPosition);top:var(--yPosition);z-index:1}:host .line .icon:focus{z-index:2;outline:none}:host .line .icon:focus:before{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0;border-radius:3px}:host .line .line-svg{height:100%;width:100%}:host .line.faded{opacity:0.3}:host .line.focused{z-index:1}:host .line.hidden{visibility:hidden}:host .hover-area-wrapper{position:absolute;width:100%;height:100%;top:0;left:0;display:grid;grid-template-rows:1fr;grid-template-columns:var(--columns)}:host .hover-indicator{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;height:100%;width:2px;border:1px solid var(--wmcolor-linechart-currentposition);-webkit-transform:translateX(-50%);transform:translateX(-50%);left:var(--xPosition);grid-column:3/4;grid-row:1/2;pointer-events:none}:host .popover{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;background-color:var(--wmcolor-linechart-popover-background);position:absolute;top:var(--topPosition, 0);left:var(--leftPosition, unset);right:var(--rightPosition, unset);padding:16px;border-radius:5px;-webkit-box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);-webkit-transform:translateY(-50%);transform:translateY(-50%);line-height:1;z-index:3;grid-column:3/4;grid-row:1/2;pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box}:host .popover .title{font-size:16px;font-weight:600}:host .popover .comparison-title{font-style:italic;margin-top:4px}:host .popover .unit{font-size:12px;font-weight:600}:host .popover .unit.--x{margin-left:4px}:host .popover .popover-table{margin-top:16px}:host .popover .popover-table .popover-row{line-height:1}:host .popover .popover-table .popover-row:not(:last-child) td{padding-bottom:8px}:host .popover .popover-table .popover-row .row-label{font-weight:600;padding-right:16px;overflow-wrap:anywhere}:host .popover .popover-table .popover-row .row-label .icon{margin-right:4px}:host .popover .popover-table .popover-row .row-value,:host .popover .popover-table .popover-row .delta{text-align:right;white-space:nowrap}:host .popover .popover-table .popover-row .delta{padding-left:12px;font-weight:600}:host .popover .popover-table .popover-row .delta.--positive{color:var(--wmcolor-linechart-delta-text-positive)}:host .popover .popover-table .popover-row .delta.--negative{color:var(--wmcolor-linechart-delta-text-negative)}:host .highlight{position:absolute;height:100%;background-color:color-mix(in srgb, var(--wmcolor-linechart-highlight-background) 60%, transparent);left:var(--startPercentage);right:var(--endPercentage)}: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}';var WmLineChartStyle0=wmLineChartCss;var LineChart=function(){function t(t){var i=this;registerInstance(this,t);this.minTickWidth=120;this.popoverData=[];this.focusedDataPoint=[0,0];this.dataPointMatrix=[];this.xIntervals=[];this.displayedXIntervals=[];this.yIntervals=[];this.lineStyles=[{color:"#8b86ca",icon:"f536"},{color:"#2e1b46",icon:"f12f"},{color:"#0089e4",icon:"f763"},{color:"#088000",icon:"f4ce"},{color:"#ea8500",icon:"f70a"},{color:"#d54f41",icon:"f536"},{color:"#146ca9",icon:"f6ff"}];this.debouncedResize=debounce((function(){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(t){this.displayedXIntervals=this.determineDisplayedXIntervals();return[2]}))}))}),100);this.label=undefined;this.description="";this.xAxisLabel=undefined;this.yAxisLabel=undefined;this.lineData=undefined;this.units="null,null";this.labelWidth="120px";this.highlightQualifier="highlighted";this.highlightStart=undefined;this.highlightEnd=undefined;this.visibilityToggles=false;this.showDeltas=false;this.yRange=undefined;this.parsedLineData={};this.popoverIndex=-1;this.focusedLine=-1;this.hiddenLines=[];this.isTabbing=false;this.intervalSkip=0;this.announcement=""}t.prototype.parseData=function(){var t=this;this.parsedLineData=JSON.parse(this.lineData);this.yIntervals=this.calcYIntervals().reverse();this.xIntervals=Object.keys(Object.values(this.parsedLineData)[0]);this.displayedXIntervals=this.determineDisplayedXIntervals();this.dataPointMatrix=Object.entries(this.parsedLineData).map((function(i){return t.buildLineDataPointDetails(i[0],i[1])}));this.popoverData=transposeMatrix(this.dataPointMatrix)};t.prototype.handleIntervalSkip=function(){this.parseData()};Object.defineProperty(t.prototype,"hasPartialInterval",{get:function(){return this.intervalSkip>0&&this.xIntervals.length%2===0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"parsedUnits",{get:function(){return csvToArray(this.units).map((function(t){return t==="null"?null:t}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"visibilityToggleEls",{get:function(){return this.legendEl.querySelectorAll("wm-button")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lineEls",{get:function(){return this.plotAreaEl.querySelectorAll(".line")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"firstVisibleLineIdx",{get:function(){var t=0;while(this.hiddenLines.includes(t)){t++}return t<this.dataPointMatrix.length?t:-1},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"pointEls",{get:function(){return this.plotAreaEl.querySelectorAll(".point")},enumerable:false,configurable:true});t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.componentWillLoad=function(){this.parseData()};t.prototype.componentDidLoad=function(){var t=this;var i=new ResizeObserver((function(){return t.debouncedResize()}));i.observe(this.el)};t.prototype.handleVisibilityToggleKeydown=function(t,i){switch(t.key){case"Tab":if(!t.shiftKey&&this.firstVisibleLineIdx!==-1){t.preventDefault();this.announce(this.lineFocusMessage(this.firstVisibleLineIdx));this.focusDataPoint(this.firstVisibleLineIdx,0)}break;case"ArrowUp":case"ArrowLeft":t.preventDefault();var e=wrapAround(i,-1,this.dataPointMatrix.length-1);this.visibilityToggleEls[e].focus();break;case"ArrowDown":case"ArrowRight":t.preventDefault();var r=wrapAround(i,1,this.dataPointMatrix.length-1);this.visibilityToggleEls[r].focus();break}};t.prototype.handleDataPointKeydown=function(t){var i=this.focusedDataPoint,e=i[0],r=i[1];var n=this.lineEls[e].querySelectorAll(".point").length;var o=this.dataPointMatrix.length;switch(t.key){case"Tab":if(t.shiftKey&&this.visibilityToggles){t.preventDefault();this.visibilityToggleEls[0].focus()}break;case"ArrowUp":t.preventDefault();var a=e;do{a=wrapAround(a,-1,o-1)}while(this.hiddenLines.includes(a));this.announce(this.lineFocusMessage(a));this.focusDataPoint(a,r);break;case"ArrowDown":t.preventDefault();var s=e;do{s=wrapAround(s,1,o-1)}while(this.hiddenLines.includes(s));this.announce(this.lineFocusMessage(s));this.focusDataPoint(s,r);break;case"ArrowLeft":t.preventDefault();var l=wrapAround(r,-1,n-1);this.focusDataPoint(e,l);break;case"ArrowRight":t.preventDefault();var h=wrapAround(r,1,n-1);this.focusDataPoint(e,h);break}};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.lineFocusMessage=function(t){var i=this.dataPointMatrix[t][0].lineLabel;var e=this.dataPointMatrix[t].filter((function(t){return t.yValue!==null})).length;return"".concat(i,", line ").concat(t+1," of ").concat(this.dataPointMatrix.length," with ").concat(e," data points")};t.prototype.focusDataPoint=function(t,i){var e=this.lineEls[t];var r=e.querySelectorAll(".point")[i];this.pointEls.forEach((function(t){return t.tabIndex=-1}));r.tabIndex=0;r.focus();this.focusedDataPoint=[t,i]};t.prototype.focusDataPointByEl=function(t){var i=parseInt(t.dataset.lineidx);var e=Array.from(t.parentElement.querySelectorAll(".point")).indexOf(t);this.pointEls.forEach((function(t){return t.tabIndex=-1}));t.tabIndex=0;t.focus();this.focusedDataPoint=[i,e]};t.prototype.calcYIntervals=function(){var t=[];if(this.yRange){t=csvToArray(this.yRange).map((function(t){return parseInt(t)}))}else{var i=[];var e=Object.values(this.parsedLineData).flat();e.forEach((function(t){return i.push.apply(i,Object.values(t))}));var r=i.filter((function(t){return t!==null}));var n=Math.min.apply(Math,r);var o=Math.max.apply(Math,r);var a=getInterval(o-n,4);var s=a;while(n%a!==0&&s>0){n--;s--}a=getInterval(o-n,4);var l=n;while(l<=o+a){t.push(l);l+=a}}return t};t.prototype.determineDisplayedXIntervals=function(){var t=this.plotAreaEl&&this.plotAreaEl.clientWidth>0?Math.round(this.plotAreaEl.clientWidth/this.minTickWidth):this.xIntervals.length;var i=getSmallestSkipInterval(this.xIntervals,t),e=i.skipInterval,r=i.skippedList;this.intervalSkip=e;return r};t.prototype.buildLineDataPointDetails=function(t,i){var e=this;var r=[];var n=Object.entries(i);var o;n.forEach((function(i,a){var s=i[0],l=i[1];var h=100/(n.length-1)*a;var c=l===null?null:100-calcPercentageInRange(l,e.yIntervals[e.yIntervals.length-1],e.yIntervals[0]);if(a===0){h+=e.plotAreaEl&&e.plotAreaEl.clientWidth>0?8/e.plotAreaEl.clientWidth*100:1}if(s===e.highlightStart&&!o){o=true}r.push({lineLabel:t,xValue:s,yValue:l,xPositionPercent:h,yPositionPercent:c,highlighted:o});if(s===e.highlightEnd&&o){o=false}}));return r};t.prototype.toggleLineVisibility=function(t){if(this.hiddenLines.includes(t)){this.hiddenLines=this.hiddenLines.filter((function(i){return i!==t}))}else{this.hiddenLines.push(t)}forceUpdate(this.el)};t.prototype.resetDataPointFocus=function(){this.popoverIndex=-1;this.pointEls.forEach((function(t){return t.tabIndex=-1}));if(this.firstVisibleLineIdx!==-1){var t=this.lineEls[this.firstVisibleLineIdx];var i=t.querySelectorAll(".point")[0];i.tabIndex=0;this.focusedDataPoint=[this.firstVisibleLineIdx,0]}};t.prototype.calcDelta=function(t,i){var e;if(t.yValue===null||i.yValue===null){e=lineChartMessages.noData}else if(t.yValue==i.yValue){e="0%"}else if(i.yValue==0){e="-"}else{var r=(t.yValue-i.yValue)/i.yValue*100;var n=Math.round(r*100)/100;e="".concat(n>0?"+":"").concat(n,"%")}return e};t.prototype.renderLegend=function(){var t=this;var i=Object.keys(this.parsedLineData);return h("div",{ref:function(i){return t.legendEl=i},class:"legend"},i.map((function(i,e){var r=t.hiddenLines.includes(e);var n=t.focusedLine!==-1&&t.focusedLine!==e;return h("div",{id:"legend-label-".concat(e),class:"legend-label ".concat(n?"faded":""),onMouseEnter:function(){return t.focusedLine=r?-1:e},onMouseLeave:function(){return t.focusedLine=-1}},t.renderIcon(e),i,t.visibilityToggles&&t.renderVisibilityToggle(i,e,r))})))};t.prototype.renderVisibilityToggle=function(t,i,e){var r=this;return h("wm-button",{id:"visibility-button-".concat(i),class:"visibility-toggle","label-for-identical-buttons":"".concat(i===0?"Toggle line visibility list with ".concat(this.dataPointMatrix.length," items"):""," ").concat(e?globalMessages.show:globalMessages.hide," ").concat(t," toggle ").concat(e?"pressed":""),"button-type":"navigational",tooltip:e?globalMessages.show:globalMessages.hide,tooltipPosition:"bottom",icon:e?"f209":"f208",onClick:function(){return r.toggleLineVisibility(i)},onKeyDown:function(t){return r.handleVisibilityToggleKeydown(t,i)},onFocus:function(){return r.popoverIndex=-1}})};t.prototype.renderIcon=function(t){var i=this.lineStyles[t],e=i.color,r=i.icon;var n={"--iconColor":e,"--icon":'"\\'.concat(r,'"'),"--translation":t===5?"rotate(180deg)":"unset"};return h("span",{class:"icon",style:n})};t.prototype.renderXIntervals=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"x-intervals",style:i},this.xIntervals.map((function(i){return h("span",{class:"x-interval ".concat(t.displayedXIntervals.includes(i)?"":"hidden")},i)})))};t.prototype.renderYIntervals=function(){var t=this;return h("div",{ref:function(i){return t.yIntervalsEl=i},class:"y-intervals"},this.yIntervals.map((function(t){return h("span",{class:"y-interval"},abbrNumber(t))})))};t.prototype.renderData=function(){var t=this;return this.dataPointMatrix.map((function(i,e){var r=t.focusedLine===e?"focused":"faded";var n=t.hiddenLines.includes(e);return h("div",{class:"line ".concat(t.focusedLine!==-1?r:""," ").concat(n?"hidden":"")},t.renderLines(e),t.renderPoints(e))}))};t.prototype.renderPoints=function(t){var i=this;var e=this.dataPointMatrix[t];return h("div",{class:"line-icons"},e.map((function(r,n){var o=r.lineLabel,a=r.xValue,s=r.yValue,l=r.xPositionPercent,c=r.yPositionPercent,u=r.highlighted;if(s!==null){var f=i.lineStyles[t],p=f.color,v=f.icon;var d=t===0&&n===0?0:undefined;var g={"--icon":'"\\'.concat(v,'"'),"--iconColor":p,"--xPosition":l+"%","--yPosition":c+"%","--translation":t===5?"translate(-50%, -50%) rotate(180deg)":"translate(-50%, -50%)"};var b="".concat(o," ").concat(u?i.highlightQualifier:""," ").concat(i.xAxisLabel," ").concat(a+(i.parsedUnits[0]?i.parsedUnits[0]:""),", ").concat(i.yAxisLabel,": ").concat(s+(i.parsedUnits[1]?i.parsedUnits[1]:""));if(i.showDeltas&&n>0){var x=e[n-1];var m=lineChartMessages.getChangeSince(x.xValue);b+=", ".concat(m," ").concat(i.calcDelta(r,x))}return h("span",{id:"".concat(o,"-").concat(n),role:"img","aria-label":b,tabIndex:d,class:"point icon",style:g,"data-lineidx":t,"data-xvalue":a,onKeyDown:function(t){return i.handleDataPointKeydown(t)},onFocus:function(){return i.popoverIndex=n},onClick:function(t){return i.focusDataPointByEl(t.target)},onMouseEnter:function(){return i.popoverIndex=n}})}})))};t.prototype.renderLines=function(t){var i=this;var e=this.dataPointMatrix[t];return h("svg",{class:"line-svg"},e.map((function(r,n){var o=r.yValue!==null&&n!==e.length-1&&e[n+1].yValue!==null;if(o){var a=i.lineStyles[t].color;var s=r.xPositionPercent,l=r.yPositionPercent;var c=e[n+1],u=c.xPositionPercent,f=c.yPositionPercent;return h("line",{x1:s+"%",y1:l+"%",x2:u+"%",y2:f+"%",stroke:a,"stroke-width":"2px"})}})))};t.prototype.renderHoverAreas=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"hover-area-wrapper",style:i,onMouseLeave:function(){return t.popoverIndex=-1}},this.xIntervals.map((function(i,e){return h("div",{onMouseEnter:function(){return t.popoverIndex=e}})})))};t.prototype.renderPopover=function(){var t=this;var i=this.popoverData&&this.popoverData[this.popoverIndex]&&this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));if(!i){return""}var e=this.popoverData[this.popoverIndex];var r=e[0].xPositionPercent;var n=e.map((function(t){return t.yPositionPercent})).filter((function(t){return t!==null}));var o=n.reduce((function(t,i){return t+i}),0)/n.length;var a=this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));var s=this.el.getBoundingClientRect();var l=a.getBoundingClientRect();var c=s.right-l.right;var u=l.left-s.left;var f=c>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var p=u>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var v=8/this.plotAreaEl.clientWidth*100;var d={"--leftPosition":f?r+v+"%":"unset","--rightPosition":p?100-r+v+"%":"unset","--topPosition":o+"%",transform:"translateY(-50%)"};if(!p&&!f){var g="0px - ".concat(this.labelWidth," - 20px - ").concat(this.yIntervalsEl.clientWidth+"px"," + ").concat(this.el.scrollLeft+"px"," + 2px");d={"--leftPosition":"0%","--topPosition":"0%",maxWidth:Math.min(this.el.clientWidth-2,400)+"px",transform:"translateX(calc(".concat(g,"))")}}return h("div",{ref:function(i){return t.popoverEl=i},class:"popover",style:d},h("div",{class:"title"},e[0].xValue,this.parsedUnits[0]&&h("span",{class:"unit --x"},"(",this.parsedUnits[0],")")),this.showDeltas&&this.popoverIndex>0&&h("div",{class:"comparison-title"},lineChartMessages.getChangeSince(this.popoverData[this.popoverIndex-1][0].xValue)),this.renderPopoverTable())};t.prototype.renderPopoverTable=function(){var t=this;var i=this.popoverData[this.popoverIndex];return h("table",{class:"popover-table"},i.map((function(i,e){if(!t.hiddenLines.includes(e)){var r=i.lineLabel,n=i.yValue;var o=t.popoverIndex>0?t.popoverData[t.popoverIndex-1][e]:null;var a=n!==null?(new Intl.NumberFormat).format(n):null;return h("tr",{class:"popover-row"},h("td",null,t.renderIcon(e)),h("td",{class:"row-label"},r),h("td",{class:"row-value"},n===null?lineChartMessages.noData:a,n!==null&&t.parsedUnits[1]&&h("span",{class:"unit --y"},t.parsedUnits[1])),t.showDeltas&&o&&t.renderDeltas(i,o))}})))};t.prototype.renderDeltas=function(t,i){var e=this.calcDelta(t,i);var r=e.toString()[0]=="+"||e=="-"?"positive":e.toString()[0]=="-"?"negative":"";return i&&h("td",{class:"delta --".concat(r)},e)};t.prototype.renderHoverIndicator=function(){var t=this.dataPointMatrix.length>0&&this.dataPointMatrix[0][this.popoverIndex];if(!t){return""}var i=this.dataPointMatrix[0][this.popoverIndex].xPositionPercent;var e={"--xPosition":i+"%"};return h("div",{class:"hover-indicator",style:e})};t.prototype.renderHighlight=function(){var t=this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightStart)].xPositionPercent;var i=this.highlightEnd?100-this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightEnd)].xPositionPercent:0;var e={"--startPercentage":t+"%","--endPercentage":i+"%"};return h("div",{class:"highlight",style:e})};t.prototype.render=function(){var t=this;return h(Host,{key:"9817eea8765cce513a0848cd222a6409c8f1f912",onBlur:function(){return t.resetDataPointFocus()},onMouseLeave:function(){return t.popoverIndex=-1}},h("div",{key:"60de41437bb425483be4b5a24fc2468c8e8f8d4e",class:"component-wrapper",role:"application","aria-roledescription":chartMessages.interactiveChart,"aria-label":this.label,"aria-describedby":"chart-description"},this.renderLegend(),h("div",{key:"2029ed03f09b8c133ee430f7b1d70c9dded326f3",class:"chart-wrapper"},h("div",{key:"4e9123177b8c02cf1fef010d370b2b1a23b2015c",class:"chart-label --y-axis",style:{"--labelWidth":this.labelWidth}},this.yAxisLabel,this.parsedUnits[1]&&" (".concat(this.parsedUnits[1],")")),this.renderYIntervals(),h("div",{key:"3cbe51169818095cd830e7b8099d3a10980e3cf2",ref:function(i){return t.plotAreaEl=i},class:"plot-area ".concat(this.hasPartialInterval?"":"right-border"),style:{"--backgroundSize":"".concat(this.dataPointMatrix[0][this.xIntervals.indexOf(this.displayedXIntervals[1])].xPositionPercent,"%")}},this.highlightStart&&this.renderHighlight(),this.renderData(),this.renderHoverAreas()),this.popoverIndex!==-1&&this.renderHoverIndicator(),this.popoverIndex!==-1&&this.renderPopover(),this.renderXIntervals(),h("div",{key:"dad130dfb9063769dd36316cb060c90a8f1c8cb8",class:"chart-label --x-axis"},this.xAxisLabel,this.parsedUnits[0]&&" (".concat(this.parsedUnits[0],")"))),h("div",{key:"bb4ffc7fbae6ab63e6f3e16c1d7e8a98c382e243",id:"chart-description",class:"sr-only"},"".concat(lineChartMessages.instructions," ").concat(this.description)),h("div",{key:"de40d0eecd0db387912b45fb2b4576b37e3876aa",ref:function(i){return t.liveRegionEl=i},"aria-live":"polite",class:"sr-only"},this.announcement)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{lineData:["parseData"],intervalSkip:["handleIntervalSkip"]}},enumerable:false,configurable:true});return t}();LineChart.style=WmLineChartStyle0;export{LineChart as wm_line_chart};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,i,e,r){function n(t){return t instanceof e?t:new e((function(i){i(t)}))}return new(e||(e=Promise))((function(e,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r["throw"](t))}catch(t){o(t)}}function l(t){t.done?e(t.value):n(t.value).then(a,s)}l((r=r.apply(t,i||[])).next())}))};var __generator=this&&this.__generator||function(t,i){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(i){return l([t,i])}}function l(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(e=0)),e)try{if(r=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(o=e.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){e.label=s[1];break}if(s[0]===6&&e.label<o[1]){e.label=o[1];o=s;break}if(o&&e.label<o[2]){e.label=o[2];e.ops.push(s);break}if(o[2])e.ops.pop();e.trys.pop();continue}s=i.call(t,e)}catch(t){s=[6,t];n=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,H as Host,g as getElement}from"./index-558b5a82.js";import{d as debounce,F as transposeMatrix,x as csvToArray,G as wrapAround,H as getSmallestSkipInterval,I as calcPercentageInRange}from"./functions-dea8b0f6.js";import{n as abbrNumber,o as getInterval}from"./chartFunctions-c07590f5.js";import{l as lineChartMessages,c as chartMessages,g as globalMessages}from"./intl-417d8b33.js";var wmLineChartCss=':host{--wmcolor-linechart-currentposition:var(--wmcolor-lavender);--wmcolor-linechart-delta-text-negative:var(--wmcolor-text-negative);--wmcolor-linechart-delta-text-positive:var(--wmcolor-text-positive);--wmcolor-linechart-gridline:var(--wmcolor-chart-gridline);--wmcolor-linechart-highlight-background:var(--wmcolor-interactive-background-highlight);--wmcolor-linechart-popover-background:var(--wmcolor-chart-popover-background);display:block;height:500px;width:100%;font-size:14px;overflow-y:visible;overflow-x:auto}:host .component-wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:562px;width:100%;height:100%;outline:none}:host .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;position:relative;color:var(--iconColor);-webkit-transform:var(--translation, unset);transform:var(--translation, unset)}:host .icon: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:var(--icon);padding:0 3px;z-index:1}:host .icon:after{color:white;position:absolute;left:3px;-webkit-transform:scale(180%);transform:scale(180%);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:var(--icon);z-index:0}:host .legend{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px 16px;margin-top:4px;margin-bottom:16px}:host .legend .legend-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:default;font-weight:600}:host .legend .legend-label.faded{opacity:0.3}:host .legend .legend-label .icon{margin-right:4px}:host .legend .visibility-toggle{margin-left:4px}:host .chart-wrapper{position:relative;-ms-flex-positive:1;flex-grow:1;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:1fr auto auto;margin-right:16px}:host .chart-label{font-size:14px;font-weight:600}:host .chart-label.--y-axis{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:var(--labelWidth);align-self:center;margin-right:16px;grid-area:1/1/2/2;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}:host .chart-label.--x-axis{margin-top:16px;text-align:center;grid-area:3/3/4/4}:host .y-intervals{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;grid-area:1/2/2/3;margin-right:4px}:host .y-intervals .y-interval{text-align:right}:host .x-intervals{display:grid;grid-template-columns:var(--columns);grid-area:2/3/3/4;line-height:1;margin-top:4px}:host .x-intervals .x-interval{text-align:center}:host .x-intervals .x-interval:first-child{text-align:left}:host .x-intervals .x-interval:last-child{text-align:right}:host .x-intervals .x-interval.hidden{visibility:hidden}:host .plot-area{position:relative;grid-area:1/3/2/4;background-image:linear-gradient(90deg, var(--wmcolor-linechart-gridline) 1px, transparent 1px);border-bottom:1px solid var(--wmcolor-linechart-gridline);background-size:var(--backgroundSize)}:host .plot-area.right-border{border-right:1px solid var(--wmcolor-linechart-gridline)}:host .line{position:absolute;width:100%;height:100%}:host .line .icon{position:absolute;-webkit-transform:var(--translation);transform:var(--translation);left:var(--xPosition);top:var(--yPosition);z-index:1}:host .line .icon:focus{z-index:2;outline:none}:host .line .icon:focus:before{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0;border-radius:3px}:host .line .line-svg{height:100%;width:100%}:host .line.faded{opacity:0.3}:host .line.focused{z-index:1}:host .line.hidden{visibility:hidden}:host .hover-area-wrapper{position:absolute;width:100%;height:100%;top:0;left:0;display:grid;grid-template-rows:1fr;grid-template-columns:var(--columns)}:host .hover-indicator{-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;height:100%;width:2px;border:1px solid var(--wmcolor-linechart-currentposition);-webkit-transform:translateX(-50%);transform:translateX(-50%);left:var(--xPosition);grid-column:3/4;grid-row:1/2;pointer-events:none}:host .popover{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;background-color:var(--wmcolor-linechart-popover-background);position:absolute;top:var(--topPosition, 0);left:var(--leftPosition, unset);right:var(--rightPosition, unset);padding:16px;border-radius:5px;-webkit-box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);box-shadow:0px 2px 10px 0px rgba(0, 0, 0, 0.09);-webkit-transform:translateY(-50%);transform:translateY(-50%);line-height:1;z-index:3;grid-column:3/4;grid-row:1/2;pointer-events:none;-webkit-box-sizing:border-box;box-sizing:border-box}:host .popover .title{font-size:16px;font-weight:600}:host .popover .comparison-title{font-style:italic;margin-top:4px}:host .popover .unit{font-size:12px;font-weight:600}:host .popover .unit.--x{margin-left:4px}:host .popover .popover-table{margin-top:16px}:host .popover .popover-table .popover-row{line-height:1}:host .popover .popover-table .popover-row:not(:last-child) td{padding-bottom:8px}:host .popover .popover-table .popover-row .row-label{font-weight:600;padding-right:16px;overflow-wrap:anywhere}:host .popover .popover-table .popover-row .row-label .icon{margin-right:4px}:host .popover .popover-table .popover-row .row-value,:host .popover .popover-table .popover-row .delta{text-align:right;white-space:nowrap}:host .popover .popover-table .popover-row .delta{padding-left:12px;font-weight:600}:host .popover .popover-table .popover-row .delta.--positive{color:var(--wmcolor-linechart-delta-text-positive)}:host .popover .popover-table .popover-row .delta.--negative{color:var(--wmcolor-linechart-delta-text-negative)}:host .highlight{position:absolute;height:100%;background-color:color-mix(in srgb, var(--wmcolor-linechart-highlight-background) 60%, transparent);left:var(--startPercentage);right:var(--endPercentage)}: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}';var LineChart=function(){function t(t){var i=this;registerInstance(this,t);this.minTickWidth=120;this.popoverData=[];this.focusedDataPoint=[0,0];this.dataPointMatrix=[];this.xIntervals=[];this.displayedXIntervals=[];this.yIntervals=[];this.lineStyles=[{color:"#8b86ca",icon:"f536"},{color:"#2e1b46",icon:"f12f"},{color:"#0089e4",icon:"f763"},{color:"#088000",icon:"f4ce"},{color:"#ea8500",icon:"f70a"},{color:"#d54f41",icon:"f536"},{color:"#146ca9",icon:"f6ff"}];this.debouncedResize=debounce((function(){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(t){this.displayedXIntervals=this.determineDisplayedXIntervals();return[2]}))}))}),100);this.label=undefined;this.description="";this.xAxisLabel=undefined;this.yAxisLabel=undefined;this.lineData=undefined;this.units="null,null";this.labelWidth="120px";this.highlightQualifier="highlighted";this.highlightStart=undefined;this.highlightEnd=undefined;this.visibilityToggles=false;this.showDeltas=false;this.yRange=undefined;this.parsedLineData={};this.popoverIndex=-1;this.focusedLine=-1;this.hiddenLines=[];this.isTabbing=false;this.intervalSkip=0;this.announcement=""}t.prototype.parseData=function(){var t=this;this.parsedLineData=JSON.parse(this.lineData);this.yIntervals=this.calcYIntervals().reverse();this.xIntervals=Object.keys(Object.values(this.parsedLineData)[0]);this.displayedXIntervals=this.determineDisplayedXIntervals();this.dataPointMatrix=Object.entries(this.parsedLineData).map((function(i){return t.buildLineDataPointDetails(i[0],i[1])}));this.popoverData=transposeMatrix(this.dataPointMatrix)};t.prototype.handleIntervalSkip=function(){this.parseData()};Object.defineProperty(t.prototype,"hasPartialInterval",{get:function(){return this.intervalSkip>0&&this.xIntervals.length%2===0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"parsedUnits",{get:function(){return csvToArray(this.units).map((function(t){return t==="null"?null:t}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"visibilityToggleEls",{get:function(){return this.legendEl.querySelectorAll("wm-button")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lineEls",{get:function(){return this.plotAreaEl.querySelectorAll(".line")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"firstVisibleLineIdx",{get:function(){var t=0;while(this.hiddenLines.includes(t)){t++}return t<this.dataPointMatrix.length?t:-1},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"pointEls",{get:function(){return this.plotAreaEl.querySelectorAll(".point")},enumerable:false,configurable:true});t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.componentWillLoad=function(){this.parseData()};t.prototype.componentDidLoad=function(){var t=this;var i=new ResizeObserver((function(){return t.debouncedResize()}));i.observe(this.el)};t.prototype.handleVisibilityToggleKeydown=function(t,i){switch(t.key){case"Tab":if(!t.shiftKey&&this.firstVisibleLineIdx!==-1){t.preventDefault();this.announce(this.lineFocusMessage(this.firstVisibleLineIdx));this.focusDataPoint(this.firstVisibleLineIdx,0)}break;case"ArrowUp":case"ArrowLeft":t.preventDefault();var e=wrapAround(i,-1,this.dataPointMatrix.length-1);this.visibilityToggleEls[e].focus();break;case"ArrowDown":case"ArrowRight":t.preventDefault();var r=wrapAround(i,1,this.dataPointMatrix.length-1);this.visibilityToggleEls[r].focus();break}};t.prototype.handleDataPointKeydown=function(t){var i=this.focusedDataPoint,e=i[0],r=i[1];var n=this.lineEls[e].querySelectorAll(".point").length;var o=this.dataPointMatrix.length;switch(t.key){case"Tab":if(t.shiftKey&&this.visibilityToggles){t.preventDefault();this.visibilityToggleEls[0].focus()}break;case"ArrowUp":t.preventDefault();var a=e;do{a=wrapAround(a,-1,o-1)}while(this.hiddenLines.includes(a));this.announce(this.lineFocusMessage(a));this.focusDataPoint(a,r);break;case"ArrowDown":t.preventDefault();var s=e;do{s=wrapAround(s,1,o-1)}while(this.hiddenLines.includes(s));this.announce(this.lineFocusMessage(s));this.focusDataPoint(s,r);break;case"ArrowLeft":t.preventDefault();var l=wrapAround(r,-1,n-1);this.focusDataPoint(e,l);break;case"ArrowRight":t.preventDefault();var h=wrapAround(r,1,n-1);this.focusDataPoint(e,h);break}};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.lineFocusMessage=function(t){var i=this.dataPointMatrix[t][0].lineLabel;var e=this.dataPointMatrix[t].filter((function(t){return t.yValue!==null})).length;return"".concat(i,", line ").concat(t+1," of ").concat(this.dataPointMatrix.length," with ").concat(e," data points")};t.prototype.focusDataPoint=function(t,i){var e=this.lineEls[t];var r=e.querySelectorAll(".point")[i];this.pointEls.forEach((function(t){return t.tabIndex=-1}));r.tabIndex=0;r.focus();this.focusedDataPoint=[t,i]};t.prototype.focusDataPointByEl=function(t){var i=parseInt(t.dataset.lineidx);var e=Array.from(t.parentElement.querySelectorAll(".point")).indexOf(t);this.pointEls.forEach((function(t){return t.tabIndex=-1}));t.tabIndex=0;t.focus();this.focusedDataPoint=[i,e]};t.prototype.calcYIntervals=function(){var t=[];if(this.yRange){t=csvToArray(this.yRange).map((function(t){return parseInt(t)}))}else{var i=[];var e=Object.values(this.parsedLineData).flat();e.forEach((function(t){return i.push.apply(i,Object.values(t))}));var r=i.filter((function(t){return t!==null}));var n=Math.min.apply(Math,r);var o=Math.max.apply(Math,r);var a=getInterval(o-n,4);var s=a;while(n%a!==0&&s>0){n--;s--}a=getInterval(o-n,4);var l=n;while(l<=o+a){t.push(l);l+=a}}return t};t.prototype.determineDisplayedXIntervals=function(){var t=this.plotAreaEl&&this.plotAreaEl.clientWidth>0?Math.round(this.plotAreaEl.clientWidth/this.minTickWidth):this.xIntervals.length;var i=getSmallestSkipInterval(this.xIntervals,t),e=i.skipInterval,r=i.skippedList;this.intervalSkip=e;return r};t.prototype.buildLineDataPointDetails=function(t,i){var e=this;var r=[];var n=Object.entries(i);var o;n.forEach((function(i,a){var s=i[0],l=i[1];var h=100/(n.length-1)*a;var c=l===null?null:100-calcPercentageInRange(l,e.yIntervals[e.yIntervals.length-1],e.yIntervals[0]);if(a===0){h+=e.plotAreaEl&&e.plotAreaEl.clientWidth>0?8/e.plotAreaEl.clientWidth*100:1}if(s===e.highlightStart&&!o){o=true}r.push({lineLabel:t,xValue:s,yValue:l,xPositionPercent:h,yPositionPercent:c,highlighted:o});if(s===e.highlightEnd&&o){o=false}}));return r};t.prototype.toggleLineVisibility=function(t){if(this.hiddenLines.includes(t)){this.hiddenLines=this.hiddenLines.filter((function(i){return i!==t}))}else{this.hiddenLines.push(t)}forceUpdate(this.el)};t.prototype.resetDataPointFocus=function(){this.popoverIndex=-1;this.pointEls.forEach((function(t){return t.tabIndex=-1}));if(this.firstVisibleLineIdx!==-1){var t=this.lineEls[this.firstVisibleLineIdx];var i=t.querySelectorAll(".point")[0];i.tabIndex=0;this.focusedDataPoint=[this.firstVisibleLineIdx,0]}};t.prototype.calcDelta=function(t,i){var e;if(t.yValue===null||i.yValue===null){e=lineChartMessages.noData}else if(t.yValue==i.yValue){e="0%"}else if(i.yValue==0){e="-"}else{var r=(t.yValue-i.yValue)/i.yValue*100;var n=Math.round(r*100)/100;e="".concat(n>0?"+":"").concat(n,"%")}return e};t.prototype.renderLegend=function(){var t=this;var i=Object.keys(this.parsedLineData);return h("div",{ref:function(i){return t.legendEl=i},class:"legend"},i.map((function(i,e){var r=t.hiddenLines.includes(e);var n=t.focusedLine!==-1&&t.focusedLine!==e;return h("div",{id:"legend-label-".concat(e),class:"legend-label ".concat(n?"faded":""),onMouseEnter:function(){return t.focusedLine=r?-1:e},onMouseLeave:function(){return t.focusedLine=-1}},t.renderIcon(e),i,t.visibilityToggles&&t.renderVisibilityToggle(i,e,r))})))};t.prototype.renderVisibilityToggle=function(t,i,e){var r=this;return h("wm-button",{id:"visibility-button-".concat(i),class:"visibility-toggle","label-for-identical-buttons":"".concat(i===0?"Toggle line visibility list with ".concat(this.dataPointMatrix.length," items"):""," ").concat(e?globalMessages.show:globalMessages.hide," ").concat(t," toggle ").concat(e?"pressed":""),"button-type":"navigational",tooltip:e?globalMessages.show:globalMessages.hide,tooltipPosition:"bottom",icon:e?"f209":"f208",onClick:function(){return r.toggleLineVisibility(i)},onKeyDown:function(t){return r.handleVisibilityToggleKeydown(t,i)},onFocus:function(){return r.popoverIndex=-1}})};t.prototype.renderIcon=function(t){var i=this.lineStyles[t],e=i.color,r=i.icon;var n={"--iconColor":e,"--icon":'"\\'.concat(r,'"'),"--translation":t===5?"rotate(180deg)":"unset"};return h("span",{class:"icon",style:n})};t.prototype.renderXIntervals=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"x-intervals",style:i},this.xIntervals.map((function(i){return h("span",{class:"x-interval ".concat(t.displayedXIntervals.includes(i)?"":"hidden")},i)})))};t.prototype.renderYIntervals=function(){var t=this;return h("div",{ref:function(i){return t.yIntervalsEl=i},class:"y-intervals"},this.yIntervals.map((function(t){return h("span",{class:"y-interval"},abbrNumber(t))})))};t.prototype.renderData=function(){var t=this;return this.dataPointMatrix.map((function(i,e){var r=t.focusedLine===e?"focused":"faded";var n=t.hiddenLines.includes(e);return h("div",{class:"line ".concat(t.focusedLine!==-1?r:""," ").concat(n?"hidden":"")},t.renderLines(e),t.renderPoints(e))}))};t.prototype.renderPoints=function(t){var i=this;var e=this.dataPointMatrix[t];return h("div",{class:"line-icons"},e.map((function(r,n){var o=r.lineLabel,a=r.xValue,s=r.yValue,l=r.xPositionPercent,c=r.yPositionPercent,u=r.highlighted;if(s!==null){var p=i.lineStyles[t],f=p.color,v=p.icon;var d=t===0&&n===0?0:undefined;var g={"--icon":'"\\'.concat(v,'"'),"--iconColor":f,"--xPosition":l+"%","--yPosition":c+"%","--translation":t===5?"translate(-50%, -50%) rotate(180deg)":"translate(-50%, -50%)"};var b="".concat(o," ").concat(u?i.highlightQualifier:""," ").concat(i.xAxisLabel," ").concat(a+(i.parsedUnits[0]?i.parsedUnits[0]:""),", ").concat(i.yAxisLabel,": ").concat(s+(i.parsedUnits[1]?i.parsedUnits[1]:""));if(i.showDeltas&&n>0){var x=e[n-1];var m=lineChartMessages.getChangeSince(x.xValue);b+=", ".concat(m," ").concat(i.calcDelta(r,x))}return h("span",{id:"".concat(o,"-").concat(n),role:"img","aria-label":b,tabIndex:d,class:"point icon",style:g,"data-lineidx":t,"data-xvalue":a,onKeyDown:function(t){return i.handleDataPointKeydown(t)},onFocus:function(){return i.popoverIndex=n},onClick:function(t){return i.focusDataPointByEl(t.target)},onMouseEnter:function(){return i.popoverIndex=n}})}})))};t.prototype.renderLines=function(t){var i=this;var e=this.dataPointMatrix[t];return h("svg",{class:"line-svg"},e.map((function(r,n){var o=r.yValue!==null&&n!==e.length-1&&e[n+1].yValue!==null;if(o){var a=i.lineStyles[t].color;var s=r.xPositionPercent,l=r.yPositionPercent;var c=e[n+1],u=c.xPositionPercent,p=c.yPositionPercent;return h("line",{x1:s+"%",y1:l+"%",x2:u+"%",y2:p+"%",stroke:a,"stroke-width":"2px"})}})))};t.prototype.renderHoverAreas=function(){var t=this;var i={"--columns":".5fr repeat(".concat(this.xIntervals.length-2,", 1fr) .5fr")};return h("div",{class:"hover-area-wrapper",style:i,onMouseLeave:function(){return t.popoverIndex=-1}},this.xIntervals.map((function(i,e){return h("div",{onMouseEnter:function(){return t.popoverIndex=e}})})))};t.prototype.renderPopover=function(){var t=this;var i=this.popoverData&&this.popoverData[this.popoverIndex]&&this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));if(!i){return""}var e=this.popoverData[this.popoverIndex];var r=e[0].xPositionPercent;var n=e.map((function(t){return t.yPositionPercent})).filter((function(t){return t!==null}));var o=n.reduce((function(t,i){return t+i}),0)/n.length;var a=this.plotAreaEl.querySelector('.point[data-xvalue="'.concat(this.dataPointMatrix[0][this.popoverIndex].xValue,'"]'));var s=this.el.getBoundingClientRect();var l=a.getBoundingClientRect();var c=s.right-l.right;var u=l.left-s.left;var p=c>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var f=u>=(this.popoverEl?Math.min(this.popoverEl.clientWidth,400):400);var v=8/this.plotAreaEl.clientWidth*100;var d={"--leftPosition":p?r+v+"%":"unset","--rightPosition":f?100-r+v+"%":"unset","--topPosition":o+"%",transform:"translateY(-50%)"};if(!f&&!p){var g="0px - ".concat(this.labelWidth," - 20px - ").concat(this.yIntervalsEl.clientWidth+"px"," + ").concat(this.el.scrollLeft+"px"," + 2px");d={"--leftPosition":"0%","--topPosition":"0%",maxWidth:Math.min(this.el.clientWidth-2,400)+"px",transform:"translateX(calc(".concat(g,"))")}}return h("div",{ref:function(i){return t.popoverEl=i},class:"popover",style:d},h("div",{class:"title"},e[0].xValue,this.parsedUnits[0]&&h("span",{class:"unit --x"},"(",this.parsedUnits[0],")")),this.showDeltas&&this.popoverIndex>0&&h("div",{class:"comparison-title"},lineChartMessages.getChangeSince(this.popoverData[this.popoverIndex-1][0].xValue)),this.renderPopoverTable())};t.prototype.renderPopoverTable=function(){var t=this;var i=this.popoverData[this.popoverIndex];return h("table",{class:"popover-table"},i.map((function(i,e){if(!t.hiddenLines.includes(e)){var r=i.lineLabel,n=i.yValue;var o=t.popoverIndex>0?t.popoverData[t.popoverIndex-1][e]:null;var a=n!==null?(new Intl.NumberFormat).format(n):null;return h("tr",{class:"popover-row"},h("td",null,t.renderIcon(e)),h("td",{class:"row-label"},r),h("td",{class:"row-value"},n===null?lineChartMessages.noData:a,n!==null&&t.parsedUnits[1]&&h("span",{class:"unit --y"},t.parsedUnits[1])),t.showDeltas&&o&&t.renderDeltas(i,o))}})))};t.prototype.renderDeltas=function(t,i){var e=this.calcDelta(t,i);var r=e.toString()[0]=="+"||e=="-"?"positive":e.toString()[0]=="-"?"negative":"";return i&&h("td",{class:"delta --".concat(r)},e)};t.prototype.renderHoverIndicator=function(){var t=this.dataPointMatrix.length>0&&this.dataPointMatrix[0][this.popoverIndex];if(!t){return""}var i=this.dataPointMatrix[0][this.popoverIndex].xPositionPercent;var e={"--xPosition":i+"%"};return h("div",{class:"hover-indicator",style:e})};t.prototype.renderHighlight=function(){var t=this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightStart)].xPositionPercent;var i=this.highlightEnd?100-this.dataPointMatrix[0][this.xIntervals.indexOf(this.highlightEnd)].xPositionPercent:0;var e={"--startPercentage":t+"%","--endPercentage":i+"%"};return h("div",{class:"highlight",style:e})};t.prototype.render=function(){var t=this;return h(Host,{onBlur:function(){return t.resetDataPointFocus()},onMouseLeave:function(){return t.popoverIndex=-1}},h("div",{class:"component-wrapper",role:"application","aria-roledescription":chartMessages.interactiveChart,"aria-label":this.label,"aria-describedby":"chart-description"},this.renderLegend(),h("div",{class:"chart-wrapper"},h("div",{class:"chart-label --y-axis",style:{"--labelWidth":this.labelWidth}},this.yAxisLabel,this.parsedUnits[1]&&" (".concat(this.parsedUnits[1],")")),this.renderYIntervals(),h("div",{ref:function(i){return t.plotAreaEl=i},class:"plot-area ".concat(this.hasPartialInterval?"":"right-border"),style:{"--backgroundSize":"".concat(this.dataPointMatrix[0][this.xIntervals.indexOf(this.displayedXIntervals[1])].xPositionPercent,"%")}},this.highlightStart&&this.renderHighlight(),this.renderData(),this.renderHoverAreas()),this.popoverIndex!==-1&&this.renderHoverIndicator(),this.popoverIndex!==-1&&this.renderPopover(),this.renderXIntervals(),h("div",{class:"chart-label --x-axis"},this.xAxisLabel,this.parsedUnits[0]&&" (".concat(this.parsedUnits[0],")"))),h("div",{id:"chart-description",class:"sr-only"},"".concat(lineChartMessages.instructions," ").concat(this.description)),h("div",{ref:function(i){return t.liveRegionEl=i},"aria-live":"polite",class:"sr-only"},this.announcement)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{lineData:["parseData"],intervalSkip:["handleIntervalSkip"]}},enumerable:false,configurable:true});return t}();LineChart.style=wmLineChartCss;export{LineChart as wm_line_chart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h,g as getElement}from"./index-
|
|
1
|
+
import{r as registerInstance,h,g as getElement}from"./index-558b5a82.js";var wmModalFooterCss="wm-modal-footer{display:block;-webkit-border-radius:0px 0px 5px 5px;-moz-border-radius:0px 0px 5px 5px;-ms-border-radius:0px 0px 5px 5px;border-radius:0px 0px 5px 5px}wm-modal-footer .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper.footer-text{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}}wm-modal-footer .wm-wrapper wm-button+wm-button{margin-left:1rem}wm-modal-footer .wm-wrapper .wm-info{font-size:0.875rem;font-style:italic}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper .wm-info{padding-bottom:0.625rem}}wm-modal-footer .wm-wrapper .wm-info:focus{outline:none}";var ModalFooter=function(){function e(e){registerInstance(this,e);this.secondaryText="";this.primaryText="";this.infoText="";this.primaryActionDisabled=false;this.deleteStyle=false}e.prototype.componentWillLoad=function(){var e=this;var t=this.el.closest("wm-modal");this.uid=t.uid;t.addEventListener("focusLastElement",(function(){e.lastElement.focus()}))};e.prototype.emitParentPrimaryEvent=function(){var e=this.el.closest("wm-modal");if(e){e.emitPrimaryEvent()}};e.prototype.emitParentSecondaryEvent=function(){var e=this.el.closest("wm-modal");if(e){e.emitSecondaryEvent()}};e.prototype.render=function(){var e=this;return h("div",{class:"wm-wrapper ".concat(this.infoText?" footer-text":"")},h("div",{class:"wm-info","aria-live":"polite"},this.infoText),h("div",{class:"wm-button-collection"},this.secondaryText&&h("wm-button",{onClick:function(){return e.emitParentSecondaryEvent()},id:"wm-secondary-".concat(this.uid),ref:function(t){return e.primaryActionDisabled?e.lastElement=t:undefined}},this.secondaryText),h("wm-button",{"button-type":this.deleteStyle?"secondary":"primary","permanently-delete":this.deleteStyle,onClick:function(){return e.emitParentPrimaryEvent()},disabled:this.primaryActionDisabled,id:"wm-primary-".concat(this.uid),ref:function(t){return!e.primaryActionDisabled?e.lastElement=t:undefined}},this.primaryText)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();ModalFooter.style=wmModalFooterCss;export{ModalFooter as wm_modal_footer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,h,H as Host,g as getElement}from"./index-
|
|
1
|
+
import{r as registerInstance,h,H as Host,g as getElement}from"./index-558b5a82.js";import{g as globalMessages}from"./intl-417d8b33.js";import"./functions-dea8b0f6.js";var wmModalHeaderCss="wm-modal-header{display:block;-webkit-border-radius:5px 5px 0 0px;-moz-border-radius:5px 5px 0 0px;-ms-border-radius:5px 5px 0 0px;border-radius:5px 5px 0 0px}wm-modal-header .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}wm-modal-header .wm-wrapper .title{margin:0;font-weight:600;font-size:1.125rem;color:var(--wmcolor-modal-heading);line-height:normal}wm-modal-header .wm-wrapper .title .subtitle{display:block;font-size:0.875rem;font-weight:normal}wm-modal-header .wm-wrapper .title:focus{outline:none}";var ModalHeader=function(){function e(e){registerInstance(this,e);this.heading="";this.subheading=""}e.prototype.componentWillLoad=function(){var e=this;var t=this.el.closest("wm-modal");this.uid=t.uid;t.addEventListener("focusFirstElement",(function(){e.closeButtonEl.focus()}))};e.prototype.emitParentCloseEvent=function(){var e=this.el.closest("wm-modal");e.emitCloseEvent()};e.prototype.render=function(){var e=this;return h(Host,null,h("div",{class:"wm-wrapper"},h("div",null,h("h2",{class:"title",id:"wm-modal-heading-text-".concat(this.uid)},this.heading,h("span",{class:"subtitle"},this.subheading))),h("wm-button",{"button-type":"navigational",icon:"f156",tooltip:globalMessages.close,"tooltip-position":"left",id:"wm-modal-close-".concat(this.uid),ref:function(t){return e.closeButtonEl=t},onClick:function(){return e.emitParentCloseEvent()}})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();ModalHeader.style=wmModalHeaderCss;export{ModalHeader as wm_modal_header};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,o,e,n){function i(t){return t instanceof e?t:new e((function(o){o(t)}))}return new(e||(e=Promise))((function(e,r){function a(t){try{s(n.next(t))}catch(t){r(t)}}function d(t){try{s(n["throw"](t))}catch(t){r(t)}}function s(t){t.done?e(t.value):i(t.value).then(a,d)}s((n=n.apply(t,o||[])).next())}))};var __generator=this&&this.__generator||function(t,o){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,a;return a={next:d(0),throw:d(1),return:d(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function d(t){return function(o){return s([t,o])}}function s(d){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,d[0]&&(e=0)),e)try{if(n=1,i&&(r=d[0]&2?i["return"]:d[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,d[1])).done)return r;if(i=0,r)d=[d[0]&2,r.value];switch(d[0]){case 0:case 1:r=d;break;case 4:e.label++;return{value:d[1],done:false};case 5:e.label++;i=d[1];d=[0];continue;case 7:d=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(d[0]===6||d[0]===2)){e=0;continue}if(d[0]===3&&(!r||d[1]>r[0]&&d[1]<r[3])){e.label=d[1];break}if(d[0]===6&&e.label<r[1]){e.label=r[1];r=d;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(d);break}if(r[2])e.ops.pop();e.trys.pop();continue}d=o.call(t,e)}catch(t){d=[6,t];i=0}finally{n=r=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,o,e,n){function i(t){return t instanceof e?t:new e((function(o){o(t)}))}return new(e||(e=Promise))((function(e,r){function a(t){try{s(n.next(t))}catch(t){r(t)}}function d(t){try{s(n["throw"](t))}catch(t){r(t)}}function s(t){t.done?e(t.value):i(t.value).then(a,d)}s((n=n.apply(t,o||[])).next())}))};var __generator=this&&this.__generator||function(t,o){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,a;return a={next:d(0),throw:d(1),return:d(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function d(t){return function(o){return s([t,o])}}function s(d){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,d[0]&&(e=0)),e)try{if(n=1,i&&(r=d[0]&2?i["return"]:d[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,d[1])).done)return r;if(i=0,r)d=[d[0]&2,r.value];switch(d[0]){case 0:case 1:r=d;break;case 4:e.label++;return{value:d[1],done:false};case 5:e.label++;i=d[1];d=[0];continue;case 7:d=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(d[0]===6||d[0]===2)){e=0;continue}if(d[0]===3&&(!r||d[1]>r[0]&&d[1]<r[3])){e.label=d[1];break}if(d[0]===6&&e.label<r[1]){e.label=r[1];r=d;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(d);break}if(r[2])e.ops.pop();e.trys.pop();continue}d=o.call(t,e)}catch(t){d=[6,t];i=0}finally{n=r=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-558b5a82.js";import{g as generateId}from"./functions-dea8b0f6.js";var wmModalCss="wm-modal{--wmcolor-modal-background:var(--wmcolor-background);--wmcolor-modal-border:var(--wmcolor-border);--wmcolor-modal-heading:var(--wmcolor-text);--wmcolor-modal-overlay:var(--wmcolor-overlay)}wm-modal *{-webkit-box-sizing:border-box;box-sizing:border-box}wm-modal dialog{color:inherit;padding:0;width:80vw;max-width:750px;max-height:80vh;-webkit-border-radius:5px 5px 5px 5px;-moz-border-radius:5px 5px 5px 5px;-ms-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px;border:none;background:var(--wmcolor-modal-background)}wm-modal dialog>:not(wm-modal-header):not(wm-modal-footer){max-height:calc(80vh - 166px)}wm-modal dialog::-webkit-backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog::-ms-backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog::backdrop{background:rgba(25, 25, 25, 0.4)}wm-modal dialog[open]{-webkit-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);-moz-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14)}wm-modal dialog.wm-modal>wm-modal-header{border-bottom:1px solid var(--wmcolor-modal-border)}wm-modal dialog.wm-modal>wm-modal-footer{border-top:1px solid var(--wmcolor-modal-border)}@media only screen and (max-width: 768px){wm-modal dialog.wm-modal{height:100%;max-height:none;max-width:none;width:100vw}wm-modal dialog.wm-modal>*{max-width:none;width:100vw}wm-modal dialog.wm-modal>*:not(wm-modal-header):not(wm-modal-footer){max-height:none;height:calc(100vh - 166px)}}wm-modal dialog.wm-dialog>:not(wm-modal-header):not(wm-modal-footer):not(.wm-tooltip){padding:0 1.875rem 1.25rem 1.875rem;font-size:0.875rem;border:none}wm-modal wm-modal-header,wm-modal wm-modal-footer{padding:1.25rem 1.875rem;width:100%}wm-modal .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;top:0;left:0}";var Modal=function(){function t(t){registerInstance(this,t);this.focusLastElement=createEvent(this,"focusLastElement",3);this.focusFirstElement=createEvent(this,"focusFirstElement",3);this.wmModalCloseTriggered=createEvent(this,"wmModalCloseTriggered",3);this.wmModalPrimaryTriggered=createEvent(this,"wmModalPrimaryTriggered",7);this.wmModalSecondaryTriggered=createEvent(this,"wmModalSecondaryTriggered",7);this.open=false;this.elementToFocus="";this.modalType="modal";this.uid=undefined;this.returnFocusEl=undefined}Object.defineProperty(t.prototype,"closeButtonEl",{get:function(){return this.el.querySelector("#wm-modal-close-".concat(this.uid))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"focusOnOpenEl",{get:function(){var t=null;if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){t=this.el.querySelector("#wm-".concat(this.elementToFocus,"-").concat(this.uid))}else if(this.elementToFocus){t=this.el.querySelector("#"+this.elementToFocus);!t&&console.warn("Ripple Component Library: The modal component couldn't find an element matching the id you passed for 'elementToFocus' (".concat(this.elementToFocus,"). It will fall back to the default and focus the close button when the modal opens."))}return t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"hasBrowserPopoverSupport",{get:function(){var t=document.getElementById("wm-tooltip");return t?!!t.showPopover:false},enumerable:false,configurable:true});t.prototype.toggleModal=function(){this.open?this.showModal():this.hideModal()};t.prototype.handleDialogClose=function(){if(this.open){this.wmModalCloseTriggered.emit()}this.open=false};t.prototype.showModal=function(){this.returnFocusEl=document.activeElement;this.setAriaDescribedbyOnModal();document.body.style.overflow="hidden";this.dialogEl.showModal();if(this.focusOnOpenEl){this.focusOnOpenEl.focus()}};t.prototype.hideModal=function(){var t=this;document.body.style.overflow="visible";this.dialogEl.close();setTimeout((function(){if(t.returnFocusEl&&document.activeElement===document.body){if(t.returnFocusEl.tagName==="WM-MENUITEM"){t.returnFocusEl=t.returnFocusEl.parentElement}t.returnFocusEl.focus()}}),20)};t.prototype.componentWillLoad=function(){var t=this;if(this.elementToFocus==="primary"||this.elementToFocus==="secondary"){if(!this.el.id){console.error("For accessibility purposes you need to set the modal content wrapper's id to 'content-[id of wm-modal].")}}this.el.focus=function(){if(t.focusOnOpenEl){t.focusOnOpenEl.focus()}else{t.closeButtonEl.focus()}};this.uid=this.el.id?this.el.id:generateId()};t.prototype.componentDidLoad=function(){var t=this;if(this.open){this.showModal()}this.dialogEl.addEventListener("close",(function(){return t.handleDialogClose()}))};t.prototype.emitCloseEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalCloseTriggered.emit();return[2]}))}))};t.prototype.emitPrimaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalPrimaryTriggered.emit();return[2]}))}))};t.prototype.emitSecondaryEvent=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmModalSecondaryTriggered.emit();return[2]}))}))};t.prototype.handleKeyDown=function(t){if(t.key=="Escape"){t.stopPropagation()}};t.prototype.setAriaDescribedbyOnModal=function(){var t=document.getElementById("content-".concat(this.uid));if(!t){console.warn("Ripple Component Library: The element containing the body of the modal must include an id in the format 'content-[id of modal]' for accessibility purposes.")}else{this.el.setAttribute("aria-describedby","wm-modal-heading-text-".concat(this.uid," content-").concat(this.uid))}};t.prototype.render=function(){var t=this;return h("dialog",{class:"".concat("wm-"+this.modalType),ref:function(o){return t.dialogEl=o},onKeyDown:function(o){return t.handleKeyDown(o)}},h("div",{class:"tabtrap sr-only",tabindex:"0",onFocus:function(o){var e=o.relatedTarget&&o.relatedTarget==t.closeButtonEl;e?t.focusLastElement.emit():t.focusFirstElement.emit()}}),!this.hasBrowserPopoverSupport&&h("div",{class:"wm-tooltip"}),h("slot",null),h("div",{class:"tabtrap sr-only",tabindex:"0",onFocus:function(){t.focusFirstElement.emit()}}))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{open:["toggleModal"]}},enumerable:false,configurable:true});return t}();Modal.style=wmModalCss;export{Modal as wm_modal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-130e07bb.js";import{i as intl,A as throttle,h as hideTooltip,s as showTooltip}from"./functions-046fc5a3.js";import{g as globalMessages}from"./intl-0822738a.js";var wmNavigationCss=":host{--wmcolor-navigation-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-background-selected:var(--wmcolor-interactive-background-selected);--wmcolor-navigation-background:var(--wmcolor-background);--wmcolor-navigation-border-selected:var(--wmcolor-interactive);--wmcolor-navigation-focus:var(--wmcolor-interactive-focus);--wmcolor-navigation-icon-selected:var(--wmcolor-interactive);--wmcolor-navigation-icon:var(--wmcolor-icon);--wmcolor-navigation-text-selected:var(--wmcolor-interactive);z-index:10}:host([aria-expanded=true]){z-index:5000}.tray{-webkit-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);-moz-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:7.5625rem;background-color:var(--wmcolor-navigation-background);overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;font-size:0.875rem;height:100%}.navlist{margin:0;padding:0}.toggle-wrapper{display:none}@media screen and (max-width: 1023px){.tray{-ms-transition:transform 0.33s ease;-webkit-transition:transform 0.33s ease;-moz-transition:transform 0.33s ease;-webkit-transition:-webkit-transform 0.33s ease;transition:-webkit-transform 0.33s ease;transition:transform 0.33s ease;transition:transform 0.33s ease, -webkit-transform 0.33s ease;position:fixed;top:0;bottom:0;left:0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.tray ul{visibility:hidden}.tray .toggle-wrapper{display:inline-block;min-height:5rem;width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host([aria-expanded=true]) .tray{-webkit-transform:translateX(0);transform:translateX(0)}:host([aria-expanded=true]) .tray ul{visibility:visible}.overlay{width:100vw;height:100vh;max-width:none;max-height:none;position:fixed !important;top:0;bottom:0;left:0;right:0;-webkit-transform:translate(0%, 0%);transform:translate(0%, 0%);background-color:rgba(25, 25, 25, 0.4);-ms-transition:opacity 0.5s ease-out;-webkit-transition:opacity 0.5s ease-out;-moz-transition:opacity 0.5s ease-out;transition:opacity 0.5s ease-out}}";var WmNavigationStyle0=wmNavigationCss;var Navigation=function(){function e(e){var t=this;registerInstance(this,e);this.wmNavigationStateChanged=createEvent(this,"wmNavigationStateChanged",7);this.mainNavigationMessage=intl.formatMessage({id:"navigation.mainNavigation",defaultMessage:"Main",description:"Label describing the site navigation, for screen reader users"});this.throttledRerender=throttle((function(){return forceUpdate(t.el)}),50);this.open=false}Object.defineProperty(e.prototype,"isCollapsible",{get:function(){return window.innerWidth<1024},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ariaExpanded",{get:function(){return this.isCollapsible?this.open.toString():undefined},enumerable:false,configurable:true});e.prototype.closeOnEscape=function(e){if(e.key==="Escape"){this.open=false}};e.prototype.handleWindowResize=function(){this.throttledRerender()};e.prototype.handleHamburgerClicked=function(){this.open=!this.open};e.prototype.handleClickOnItem=function(){this.open=false};e.prototype.handleStateChange=function(){if(this.isCollapsible){this.wmNavigationStateChanged.emit();this.open?this.expand():this.collapse()}};e.prototype.componentWillLoad=function(){var e=this;this.el.focus=function(){var t=e.open?e.el.shadowRoot.querySelector(".toggle"):document.querySelector("wm-navigation-hamburger");var i=e.el.querySelector("wm-navigation-item");e.isCollapsible?t.focus():i.focus()};if(this.isCollapsible&&this.open){this.wmNavigationStateChanged.emit();this.expand()}};e.prototype.redirectFocusFromBody=function(e){if(document.activeElement.tagName==="BODY"&&!e.relatedTarget){this.el.focus()}};e.prototype.expand=function(){var e=this;document.body.tabIndex=0;document.body.addEventListener("focus",this.redirectFocusFromBody.bind(this),true);setTimeout((function(){return e.toggleEl.focus()}),250)};e.prototype.collapse=function(){document.body.tabIndex=-1;document.body.removeEventListener("focus",this.redirectFocusFromBody.bind(this));var e=document.querySelector("wm-navigation-hamburger");if(e)e.focus()};e.prototype.focusLastItem=function(){var e=this.el.querySelectorAll("wm-navigation-item");var t=Array.from(e).pop();t.focus()};e.prototype.renderOverlay=function(){var e=this;return h("div",{class:"overlay",onClick:function(){e.open=false}})};e.prototype.render=function(){var e=this;return h(Host,{key:"a801b62b17dec1f3a0d87c4aa63d40bdc6f8df31",role:"navigation","aria-expanded":this.ariaExpanded,"aria-label":this.mainNavigationMessage},this.open?this.renderOverlay():"",this.isCollapsible&&h("div",{key:"76559f97777c8f329a6b3709ddef23d6e883242d",class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return e.focusLastItem()}}),h("div",{key:"985dc05ba299a0cc003f0e744d86d69840be451a",class:"tray"},h("div",{key:"bfdae051a241a58b7bc97a9cf8eb3515c0bba590",class:"toggle-wrapper"},h("wm-button",{key:"3fad817d4c16dc82618987a426d1f2dde1136e8d",ref:function(t){return e.toggleEl=t},class:"toggle","button-type":"navigational",icon:this.open?"f156":"f35c","icon-size":"2rem",tooltip:this.open?globalMessages.close:globalMessages.open,"tooltip-position":"right",tabIndex:this.open?undefined:-1,onClick:function(){e.open=!e.open}})),h("ul",{key:"6383b6f7da04d79798b86632926ecd63e6e41130",class:"navlist"},h("slot",{key:"83c0ffa4d2f9b6a1fa151fa4a7dbffc59971f816"}))),this.isCollapsible&&h("div",{key:"37eb48310423c3e6e42dde13bb0a920c3a9044c2",class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return e.toggleEl.focus()}}))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{open:["handleStateChange"]}},enumerable:false,configurable:true});return e}();Navigation.style=WmNavigationStyle0;var wmNavigationHamburgerCss='button{--wmcolor-navigation-hamburger-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-hamburger-icon:var(--wmcolor-interactive);display:none;width:100%;height:100%;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);background-color:transparent;outline:none;padding:0}button:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0}button:hover{background-color:var(--wmcolor-navigation-hamburger-background-hover)}.icon: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:"\\f35c";font-size:1.5rem;color:var(--wmcolor-navigation-hamburger-icon)}@media screen and (max-width: 1023px){:host{width:3.75rem;height:3.75rem}button{display:initial}}';var WmNavigationHamburgerStyle0=wmNavigationHamburgerCss;var NavigationHamburger=function(){function e(e){registerInstance(this,e);this.wmNavigationHamburgerClicked=createEvent(this,"wmNavigationHamburgerClicked",7);this.showNavMessage=intl.formatMessage({id:"navigation.showNavigation",defaultMessage:"Show navigation",description:"For user interface element opening a navigation menu"});this.navId=undefined;this.isTabbing=false;this.open=false}e.prototype.toggleTabbingOn=function(){this.isTabbing=true};e.prototype.toggleTabbingOff=function(){this.isTabbing=false};e.prototype.handleNavigationStateChanged=function(e){this.open=e.target.open};e.prototype.componentWillLoad=function(){if(document.body.classList.contains("wmcl-user-is-tabbing")){this.toggleTabbingOn()}if(!this.navId){console.error("wm-navigation-hamburger: nav-id is a required prop")}};e.prototype.handleClick=function(){hideTooltip();this.wmNavigationHamburgerClicked.emit()};e.prototype.render=function(){var e=this;return h(Host,{key:"5d7b3360de5a2c0e5915ba5dc713b49d5f99493b",class:"hamburger ".concat(this.open?"nav-open":"nav-closed")},h("button",{key:"f716f66f0de7859321f5e1b67089819fbecb230b","aria-expanded":this.open,"aria-label":this.showNavMessage,onMouseEnter:function(){return showTooltip("right",e.el,e.showNavMessage)},onMouseLeave:function(){return hideTooltip()},onFocus:function(){return e.isTabbing&&showTooltip("right",e.el,e.showNavMessage)},onBlur:function(){return hideTooltip()},onClick:function(){return e.handleClick()}},h("span",{key:"814ccc6a2e194be8da24fd8669c0c55a4c5ccc7e",class:"icon"})))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();NavigationHamburger.style=WmNavigationHamburgerStyle0;var wmNavigationItemCss='.link{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;color:inherit;text-decoration:none;min-height:4.5rem;text-align:center;padding:1.25rem 0.5rem;font-weight:500;outline:none;position:relative;background:var(--wmcolor-navigation-background)}.link:hover{background-color:var(--wmcolor-navigation-background-hover)}.link .icon{font-size:1.375rem;color:var(--wmcolor-navigation-icon)}.link .text{font-size:0.875rem}.link:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:-3px}.link.active{background-color:var(--wmcolor-navigation-background-selected)}.link.active:before{content:"";background-color:var(--wmcolor-navigation-border-selected);position:absolute;height:100%;width:5px;left:0}.link.active .text{color:var(--wmcolor-navigation-text-selected)}.link.active .icon{color:var(--wmcolor-navigation-icon-selected)}';var WmNavigationItemStyle0=wmNavigationItemCss;var NavigationItem=function(){function e(e){registerInstance(this,e);this.wmNavigationItemClicked=createEvent(this,"wmNavigationItemClicked",7);this.href=undefined;this.text=undefined;this.active=undefined}e.prototype.render=function(){var e=this;return h(Host,{key:"da4dc9523bca84cdd02f7e5d47e513c426ed90fd",role:"listitem"},h("a",{key:"4e51a03f17100c397a827be7c089cc1c28d40f6c",class:"link ".concat(this.active?"active":""),href:this.href,onClick:function(){return e.wmNavigationItemClicked.emit()}},h("div",{key:"c01fb24078960839c06728eb92e8bc087750a477",class:"icon","aria-hidden":"true"},h("slot",{key:"0434248e936a12b3c224dac32df1dcf259d7bfc8"})),h("div",{key:"a340b8ec4e8bb07fa7877f33e447895a7a890f98",class:"text"},this.text)))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();NavigationItem.style=WmNavigationItemStyle0;export{Navigation as wm_navigation,NavigationHamburger as wm_navigation_hamburger,NavigationItem as wm_navigation_item};
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-558b5a82.js";import{i as intl,A as throttle,h as hideTooltip,s as showTooltip}from"./functions-dea8b0f6.js";import{g as globalMessages}from"./intl-417d8b33.js";var wmNavigationCss=":host{--wmcolor-navigation-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-background-selected:var(--wmcolor-interactive-background-selected);--wmcolor-navigation-background:var(--wmcolor-background);--wmcolor-navigation-border-selected:var(--wmcolor-interactive);--wmcolor-navigation-focus:var(--wmcolor-interactive-focus);--wmcolor-navigation-icon-selected:var(--wmcolor-interactive);--wmcolor-navigation-icon:var(--wmcolor-icon);--wmcolor-navigation-text-selected:var(--wmcolor-interactive);z-index:10}:host([aria-expanded=true]){z-index:5000}.tray{-webkit-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);-moz-box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);box-shadow:0 0 14px 0 rgba(0, 0, 0, 0.14);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:7.5625rem;background-color:var(--wmcolor-navigation-background);overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;font-size:0.875rem;height:100%}.navlist{margin:0;padding:0}.toggle-wrapper{display:none}@media screen and (max-width: 1023px){.tray{-ms-transition:transform 0.33s ease;-webkit-transition:transform 0.33s ease;-moz-transition:transform 0.33s ease;-webkit-transition:-webkit-transform 0.33s ease;transition:-webkit-transform 0.33s ease;transition:transform 0.33s ease;transition:transform 0.33s ease, -webkit-transform 0.33s ease;position:fixed;top:0;bottom:0;left:0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.tray ul{visibility:hidden}.tray .toggle-wrapper{display:inline-block;min-height:5rem;width:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}:host([aria-expanded=true]) .tray{-webkit-transform:translateX(0);transform:translateX(0)}:host([aria-expanded=true]) .tray ul{visibility:visible}.overlay{width:100vw;height:100vh;max-width:none;max-height:none;position:fixed !important;top:0;bottom:0;left:0;right:0;-webkit-transform:translate(0%, 0%);transform:translate(0%, 0%);background-color:rgba(25, 25, 25, 0.4);-ms-transition:opacity 0.5s ease-out;-webkit-transition:opacity 0.5s ease-out;-moz-transition:opacity 0.5s ease-out;transition:opacity 0.5s ease-out}}";var Navigation=function(){function t(t){var i=this;registerInstance(this,t);this.wmNavigationStateChanged=createEvent(this,"wmNavigationStateChanged",7);this.mainNavigationMessage=intl.formatMessage({id:"navigation.mainNavigation",defaultMessage:"Main",description:"Label describing the site navigation, for screen reader users"});this.throttledRerender=throttle((function(){return forceUpdate(i.el)}),50);this.open=false}Object.defineProperty(t.prototype,"isCollapsible",{get:function(){return window.innerWidth<1024},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"ariaExpanded",{get:function(){return this.isCollapsible?this.open.toString():undefined},enumerable:false,configurable:true});t.prototype.closeOnEscape=function(t){if(t.key==="Escape"){this.open=false}};t.prototype.handleWindowResize=function(){this.throttledRerender()};t.prototype.handleHamburgerClicked=function(){this.open=!this.open};t.prototype.handleClickOnItem=function(){this.open=false};t.prototype.handleStateChange=function(){if(this.isCollapsible){this.wmNavigationStateChanged.emit();this.open?this.expand():this.collapse()}};t.prototype.componentWillLoad=function(){var t=this;this.el.focus=function(){var i=t.open?t.el.shadowRoot.querySelector(".toggle"):document.querySelector("wm-navigation-hamburger");var e=t.el.querySelector("wm-navigation-item");t.isCollapsible?i.focus():e.focus()};if(this.isCollapsible&&this.open){this.wmNavigationStateChanged.emit();this.expand()}};t.prototype.redirectFocusFromBody=function(t){if(document.activeElement.tagName==="BODY"&&!t.relatedTarget){this.el.focus()}};t.prototype.expand=function(){var t=this;document.body.tabIndex=0;document.body.addEventListener("focus",this.redirectFocusFromBody.bind(this),true);setTimeout((function(){return t.toggleEl.focus()}),250)};t.prototype.collapse=function(){document.body.tabIndex=-1;document.body.removeEventListener("focus",this.redirectFocusFromBody.bind(this));var t=document.querySelector("wm-navigation-hamburger");if(t)t.focus()};t.prototype.focusLastItem=function(){var t=this.el.querySelectorAll("wm-navigation-item");var i=Array.from(t).pop();i.focus()};t.prototype.renderOverlay=function(){var t=this;return h("div",{class:"overlay",onClick:function(){t.open=false}})};t.prototype.render=function(){var t=this;return h(Host,{role:"navigation","aria-expanded":this.ariaExpanded,"aria-label":this.mainNavigationMessage},this.open?this.renderOverlay():"",this.isCollapsible&&h("div",{class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return t.focusLastItem()}}),h("div",{class:"tray"},h("div",{class:"toggle-wrapper"},h("wm-button",{ref:function(i){return t.toggleEl=i},class:"toggle","button-type":"navigational",icon:this.open?"f156":"f35c","icon-size":"2rem",tooltip:this.open?globalMessages.close:globalMessages.open,"tooltip-position":"right",tabIndex:this.open?undefined:-1,onClick:function(){t.open=!t.open}})),h("ul",{class:"navlist"},h("slot",null))),this.isCollapsible&&h("div",{class:"trapfocus",tabindex:this.open?0:undefined,onFocus:function(){return t.toggleEl.focus()}}))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{open:["handleStateChange"]}},enumerable:false,configurable:true});return t}();Navigation.style=wmNavigationCss;var wmNavigationHamburgerCss='button{--wmcolor-navigation-hamburger-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigation-hamburger-icon:var(--wmcolor-interactive);display:none;width:100%;height:100%;border:none;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1);background-color:transparent;outline:none;padding:0}button:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:0}button:hover{background-color:var(--wmcolor-navigation-hamburger-background-hover)}.icon: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:"\\f35c";font-size:1.5rem;color:var(--wmcolor-navigation-hamburger-icon)}@media screen and (max-width: 1023px){:host{width:3.75rem;height:3.75rem}button{display:initial}}';var NavigationHamburger=function(){function t(t){registerInstance(this,t);this.wmNavigationHamburgerClicked=createEvent(this,"wmNavigationHamburgerClicked",7);this.showNavMessage=intl.formatMessage({id:"navigation.showNavigation",defaultMessage:"Show navigation",description:"For user interface element opening a navigation menu"});this.navId=undefined;this.isTabbing=false;this.open=false}t.prototype.toggleTabbingOn=function(){this.isTabbing=true};t.prototype.toggleTabbingOff=function(){this.isTabbing=false};t.prototype.handleNavigationStateChanged=function(t){this.open=t.target.open};t.prototype.componentWillLoad=function(){if(document.body.classList.contains("wmcl-user-is-tabbing")){this.toggleTabbingOn()}if(!this.navId){console.error("wm-navigation-hamburger: nav-id is a required prop")}};t.prototype.handleClick=function(){hideTooltip();this.wmNavigationHamburgerClicked.emit()};t.prototype.render=function(){var t=this;return h(Host,{class:"hamburger ".concat(this.open?"nav-open":"nav-closed")},h("button",{"aria-expanded":this.open,"aria-label":this.showNavMessage,onMouseEnter:function(){return showTooltip("right",t.el,t.showNavMessage)},onMouseLeave:function(){return hideTooltip()},onFocus:function(){return t.isTabbing&&showTooltip("right",t.el,t.showNavMessage)},onBlur:function(){return hideTooltip()},onClick:function(){return t.handleClick()}},h("span",{class:"icon"})))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();NavigationHamburger.style=wmNavigationHamburgerCss;var wmNavigationItemCss='.link{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;color:inherit;text-decoration:none;min-height:4.5rem;text-align:center;padding:1.25rem 0.5rem;font-weight:500;outline:none;position:relative;background:var(--wmcolor-navigation-background)}.link:hover{background-color:var(--wmcolor-navigation-background-hover)}.link .icon{font-size:1.375rem;color:var(--wmcolor-navigation-icon)}.link .text{font-size:0.875rem}.link:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:-3px}.link.active{background-color:var(--wmcolor-navigation-background-selected)}.link.active:before{content:"";background-color:var(--wmcolor-navigation-border-selected);position:absolute;height:100%;width:5px;left:0}.link.active .text{color:var(--wmcolor-navigation-text-selected)}.link.active .icon{color:var(--wmcolor-navigation-icon-selected)}';var NavigationItem=function(){function t(t){registerInstance(this,t);this.wmNavigationItemClicked=createEvent(this,"wmNavigationItemClicked",7);this.href=undefined;this.text=undefined;this.active=undefined}t.prototype.render=function(){var t=this;return h(Host,{role:"listitem"},h("a",{class:"link ".concat(this.active?"active":""),href:this.href,onClick:function(){return t.wmNavigationItemClicked.emit()}},h("div",{class:"icon","aria-hidden":"true"},h("slot",null)),h("div",{class:"text"},this.text)))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();NavigationItem.style=wmNavigationItemCss;export{Navigation as wm_navigation,NavigationHamburger as wm_navigation_hamburger,NavigationItem as wm_navigation_item};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,r,e,i){function a(t){return t instanceof e?t:new e((function(r){r(t)}))}return new(e||(e=Promise))((function(e,n){function o(t){try{c(i.next(t))}catch(t){n(t)}}function s(t){try{c(i["throw"](t))}catch(t){n(t)}}function c(t){t.done?e(t.value):a(t.value).then(o,s)}c((i=i.apply(t,r||[])).next())}))};var __generator=this&&this.__generator||function(t,r){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,a,n,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(r){return c([t,r])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(e=0)),e)try{if(i=1,a&&(n=s[0]&2?a["return"]:s[0]?a["throw"]||((n=a["return"])&&n.call(a),0):a.next)&&!(n=n.call(a,s[1])).done)return n;if(a=0,n)s=[s[0]&2,n.value];switch(s[0]){case 0:case 1:n=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;a=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(n=e.trys,n=n.length>0&&n[n.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!n||s[1]>n[0]&&s[1]<n[3])){e.label=s[1];break}if(s[0]===6&&e.label<n[1]){e.label=n[1];n=s;break}if(n&&e.label<n[2]){e.label=n[2];e.ops.push(s);break}if(n[2])e.ops.pop();e.trys.pop();continue}s=r.call(t,e)}catch(t){s=[6,t];a=0}finally{i=n=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-130e07bb.js";import{a as getWmMode}from"./interfaces-cc5b177f.js";import{n as snakeCaseToCamelCase,o as getNewIndexToFocus,i as intl}from"./functions-046fc5a3.js";var getRequest=function(t){return __awaiter(void 0,void 0,void 0,(function(){var r;return __generator(this,(function(e){switch(e.label){case 0:return[4,fetch(t)];case 1:r=e.sent();if(!(!!r&&!!r.ok))return[3,3];return[4,r.json()];case 2:return[2,e.sent()];case 3:throw new Error(r.statusText)}}))}))};var wmNavigatorCss=":host{--wmcolor-navigator-background:var(--wmcolor-background);--wmcolor-navigator-header-background:var(--wmcolor-brand-dark);--wmcolor-navigator-header-text:var(--wmcolor-text-ondark);--wmcolor-navigator-item-background-selected:var(--wmcolor-interactive-background-selected);--wmcolor-navigator-item-background-focus:var(--wmcolor-interactive-background-focus);--wmcolor-navigator-item-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigator-item-background:var(--wmcolor-background);--wmcolor-navigator-item-border:var(--wmcolor-border);--wmcolor-navigator-item-text:var(--wmcolor-text);--wmcolor-navigator-user-background:var(--wmcolor-background-readonly);min-width:0;position:relative;display:inline-block}:host .wrapper{overflow:auto;font-size:1.125rem;min-width:13.125rem;width:auto;max-height:80vh;text-align:left;position:absolute;z-index:50;top:100%;right:20px;left:auto;background:var(--wmcolor-navigator-background);letter-spacing:normal;-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-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper .user{background:var(--wmcolor-navigator-user-background);padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper .user p{margin:0}:host .wrapper .user p:first-child{font-weight:700;text-transform:capitalize}:host .wrapper h2{background:var(--wmcolor-navigator-header-background);color:var(--wmcolor-navigator-header-text);font-weight:700;margin:0;padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper [role=listbox]{list-style:none;margin:0;padding-left:0}:host .wrapper.hide{-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0)}:host .wrapper.right{right:auto;left:20px}:host img{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:left center;transform-origin:left center;display:block}:host .logout{text-align:center;text-transform:capitalize}priv-navigator-item:focus{outline:none}";var WmNavigatorStyle0=wmNavigatorCss;var Navigator=function(){function t(t){registerInstance(this,t);this.wmNavigatorLogout=createEvent(this,"wmNavigatorLogout",7);this.retrievedInfo=!this.loadFromUserinfo;this.parsedProducts=[];this.openRight=false;this.userName=undefined;this.email=undefined;this.authType=1;this.connectionName=undefined;this.logoutUrl=undefined;this.products=undefined;this.loadFromUserinfo=false;this.isOpen=false;this.itemIndexToFocus=0}t.prototype.isSafeUrl=function(t){var r=false;var e=["digitalmeasures\\.com","evalkit\\.info","evaluationkit\\.com","evaluationkit\\.info","lat_ams\\.com","livetext\\.com","smartcatalogiq\\.com","smartcatalogiq\\.net","smartcatalogiq\\.us","taskstream\\.com","vialivetext\\.com","watermarkinsights\\.com"];e.forEach((function(e){var i="^https://(.*.)?".concat(e,"(/.*)?$");if(!!t&&t.match(i)){r=true}}));return r};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!this.userName){console.error("wm-navigator: user-name is a required property.")}return[4,this.parseData()];case 1:t.sent();this.setFocusIndex();return[2]}}))}))};t.prototype.parseData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){switch(r.label){case 0:if(!!!this.loadFromUserinfo)return[3,2];return[4,getRequest("/platform/navigator/userinfo").then((function(r){t.email=r.email;t.currentProductId=r.current_product_id;t.parsedProducts=t.productKeysToCamelCase(r.products);t.logoutUrl=t.logoutUrl?t.logoutUrl:r.logout_url;t.connectionName=t.connectionName?t.connectionName:r.connection_name;if(!!t.email&&!!t.currentProductId){t.retrievedInfo=true}})).catch((function(t){console.error(t)}))];case 1:r.sent();return[3,3];case 2:this.currentProductId=getWmMode(this.el);if(!!this.products){if(typeof this.products==="string"){this.parsedProducts=JSON.parse(this.products)}else{this.parsedProducts=this.products}this.parsedProducts=this.productKeysToCamelCase(this.parsedProducts)}r.label=3;case 3:this.parsedProducts.sort((function(t,r){return t.name<r.name?-1:1}));return[2]}}))}))};t.prototype.productKeysToCamelCase=function(t){t=t.map((function(t){var r=Object.keys(t);var e={};r.forEach((function(r){e[snakeCaseToCamelCase(r)]=t[r]}));return e}));return t};t.prototype.setFocusIndex=function(){if(this.parsedProducts.length>1){var t=this.getProduct(this.currentProductId);if(t){this.itemIndexToFocus=this.parsedProducts.indexOf(t)}}};t.prototype.handleKeys=function(t){switch(t.key){case"Escape":t.preventDefault();this.closeMenu();break;case"ArrowDown":case"ArrowUp":t.preventDefault();if(!this.isOpen){this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,t.key,this.navigatorItems.length);this.openMenu()}break}};t.prototype.handleKeydown=function(t){var r=t.detail.key;var e=t.detail.navItem;switch(r){case"Tab":this.closeMenu(false);break;case"Enter":case" ":e.click();break;case"ArrowDown":case"ArrowUp":var i=this.itemIndexToFocus;this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,r,this.navigatorItems.length);this.focusItem();this.unfocusItem(i);break}};t.prototype.handleClick=function(t){var r=t.target===this.el||this.el.contains(t.target);if(!r&&this.isOpen){this.closeMenu(false)}};t.prototype.handleButtonClick=function(){this.isOpen?this.closeMenu():this.openMenu()};t.prototype.openMenu=function(){if(this.wrapperEl){var t=this.wrapperEl.clientWidth;var r=this.el.getBoundingClientRect().left;var e=document.documentElement.clientWidth-this.el.getBoundingClientRect().right;this.openRight=t>r&&e>r}this.isOpen=true;this.focusItem()};t.prototype.closeMenu=function(t){var r=this;if(t===void 0){t=true}this.isOpen=false;window.requestAnimationFrame((function(){r.unfocusItem(r.itemIndexToFocus);r.setFocusIndex();if(t){r.buttonFocusHandler()}}))};t.prototype.focusItem=function(){var t=this.navigatorItems[this.itemIndexToFocus];t.tabIndex=0;t.focused=true;window.setTimeout((function(){return t.focus()}),250)};t.prototype.unfocusItem=function(t){var r=this.navigatorItems[t];r.tabIndex=-1;r.focused=false};t.prototype.buttonFocusHandler=function(){var t=this.el.shadowRoot.querySelector("priv-navigator-button");var r=t.shadowRoot.querySelector("button");r.focus()};t.prototype.renderUserInfo=function(){return h("div",{class:"user",id:"wm-nav-user","aria-label":intl.formatMessage({id:"navigator.userinfoLabel",defaultMessage:"for {name}, email {email}"},{name:this.userName,email:this.email})},h("p",null,this.userName),h("p",null,this.email))};t.prototype.setAltText=function(){if(this.parsedProducts.length>1){return intl.formatMessage({id:"navigator.userinfoAndProductNavigator",defaultMessage:"User information and product navigator"})}else{return intl.formatMessage({id:"navigator.userinfo",defaultMessage:"User information"})}};t.prototype.renderHeading=function(){return h("h2",null,intl.formatMessage({id:"navigator.watermarkApps",defaultMessage:"Watermark Apps",description:"Applications made by Watermark Insights"}))};t.prototype.renderList=function(){return h("ul",{role:"listbox","aria-label":"".concat(intl.formatMessage({id:"navigator.WatermarkAppNavigation",defaultMessage:"Watermark App Navigation",description:"list of applications by Watermark Insights"})),"aria-describedby":"wm-nav-user"},this.parsedProducts.length>1&&this.renderProductOptions(),this.renderLogoutOption())};t.prototype.renderProductOptions=function(){var t=this;return this.parsedProducts.map((function(r){var e,i,a,n;e=r.name;i=r.iconUrl;n=t.setProductOnClick(r.id);if(!!e&&!!i){a=t.currentProductId===r.id;return h("priv-navigator-item",{selected:a,id:r.id,onClick:function(){a?t.closeMenu():n()},role:"option","aria-label":e,"aria-selected":a?"true":"false"},h("img",{src:i,alt:e}))}}))};t.prototype.setProductOnClick=function(t){var r=this.getProduct(t);if(this.currentProductId===t){return function(){}}else if(r){if(!!this.loadFromUserinfo||this.authType===2){var e=r.linkUrl;if(this.isSafeUrl(e)){return function(){return window.location.href=e}}else{console.error('"'.concat(e,'" is not a safe url'));return}}else if(this.authType===3){var i=this.connectionName?"/?connection_name=".concat(this.connectionName):"";var a=r.samlLinkUrl;if(this.isSafeUrl(a)){return function(){return window.location.href=a+i}}else{console.error('"'.concat(a,'" is not a safe url'));return}}}};t.prototype.renderLogoutOption=function(){return h("priv-navigator-item",{class:"logout",selected:!(this.parsedProducts.length>1),id:"nav-logout",onClick:this.setLogoutOnclick(),role:"option","aria-selected":"false"},h("span",{class:"logout"},intl.formatMessage({id:"navigator.logout",defaultMessage:"Log Out"})))};t.prototype.setLogoutOnclick=function(){var t=this;return function(){t.wmNavigatorLogout.emit();var r=t.logoutUrl;if(t.isSafeUrl(r)){window.location.href=r}else{console.error('"'.concat(r,'" is not a safe url'))}}};Object.defineProperty(t.prototype,"navigatorItems",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll("priv-navigator-item"))},enumerable:false,configurable:true});t.prototype.getProduct=function(t){return this.parsedProducts.find((function(r){return r.id===t}))};t.prototype.render=function(){var t=this;return this.retrievedInfo?h(Host,null,h("priv-navigator-button",{expanded:this.isOpen,altText:this.setAltText()}),h("div",{class:"wrapper ".concat(this.isOpen?"":"hide"," ").concat(this.openRight?"right":""),ref:function(r){return t.wrapperEl=r}},this.renderUserInfo(),this.parsedProducts.length>1&&this.renderHeading(),this.renderList())):""};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{products:["parseData"]}},enumerable:false,configurable:true});return t}();Navigator.style=WmNavigatorStyle0;export{Navigator as wm_navigator};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,r,e,i){function n(t){return t instanceof e?t:new e((function(r){r(t)}))}return new(e||(e=Promise))((function(e,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function s(t){try{c(i["throw"](t))}catch(t){a(t)}}function c(t){t.done?e(t.value):n(t.value).then(o,s)}c((i=i.apply(t,r||[])).next())}))};var __generator=this&&this.__generator||function(t,r){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(r){return c([t,r])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(e=0)),e)try{if(i=1,n&&(a=s[0]&2?n["return"]:s[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;if(n=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){e.label=s[1];break}if(s[0]===6&&e.label<a[1]){e.label=a[1];a=s;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(s);break}if(a[2])e.ops.pop();e.trys.pop();continue}s=r.call(t,e)}catch(t){s=[6,t];n=0}finally{i=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-558b5a82.js";import{a as getWmMode}from"./interfaces-cc5b177f.js";import{n as snakeCaseToCamelCase,o as getNewIndexToFocus,i as intl}from"./functions-dea8b0f6.js";var getRequest=function(t){return __awaiter(void 0,void 0,void 0,(function(){var r;return __generator(this,(function(e){switch(e.label){case 0:return[4,fetch(t)];case 1:r=e.sent();if(!(!!r&&!!r.ok))return[3,3];return[4,r.json()];case 2:return[2,e.sent()];case 3:throw new Error(r.statusText)}}))}))};var wmNavigatorCss=":host{--wmcolor-navigator-background:var(--wmcolor-background);--wmcolor-navigator-header-background:var(--wmcolor-brand-dark);--wmcolor-navigator-header-text:var(--wmcolor-text-ondark);--wmcolor-navigator-item-background-selected:var(--wmcolor-interactive-background-selected);--wmcolor-navigator-item-background-focus:var(--wmcolor-interactive-background-focus);--wmcolor-navigator-item-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-navigator-item-background:var(--wmcolor-background);--wmcolor-navigator-item-border:var(--wmcolor-border);--wmcolor-navigator-item-text:var(--wmcolor-text);--wmcolor-navigator-user-background:var(--wmcolor-background-readonly);min-width:0;position:relative;display:inline-block}:host .wrapper{overflow:auto;font-size:1.125rem;min-width:13.125rem;width:auto;max-height:80vh;text-align:left;position:absolute;z-index:50;top:100%;right:20px;left:auto;background:var(--wmcolor-navigator-background);letter-spacing:normal;-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-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .wrapper .user{background:var(--wmcolor-navigator-user-background);padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper .user p{margin:0}:host .wrapper .user p:first-child{font-weight:700;text-transform:capitalize}:host .wrapper h2{background:var(--wmcolor-navigator-header-background);color:var(--wmcolor-navigator-header-text);font-weight:700;margin:0;padding:0.625rem 1.25rem;font-size:0.875rem}:host .wrapper [role=listbox]{list-style:none;margin:0;padding-left:0}:host .wrapper.hide{-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0)}:host .wrapper.right{right:auto;left:20px}:host img{-webkit-transform:scale(0.8);transform:scale(0.8);-webkit-transform-origin:left center;transform-origin:left center;display:block}:host .logout{text-align:center;text-transform:capitalize}priv-navigator-item:focus{outline:none}";var Navigator=function(){function t(t){registerInstance(this,t);this.wmNavigatorLogout=createEvent(this,"wmNavigatorLogout",7);this.retrievedInfo=!this.loadFromUserinfo;this.parsedProducts=[];this.openRight=false;this.userName=undefined;this.email=undefined;this.authType=1;this.connectionName=undefined;this.logoutUrl=undefined;this.products=undefined;this.loadFromUserinfo=false;this.isOpen=false;this.itemIndexToFocus=0}t.prototype.isSafeUrl=function(t){var r=false;var e=["digitalmeasures\\.com","evalkit\\.info","evaluationkit\\.com","evaluationkit\\.info","lat_ams\\.com","livetext\\.com","smartcatalogiq\\.com","smartcatalogiq\\.net","smartcatalogiq\\.us","taskstream\\.com","vialivetext\\.com","watermarkinsights\\.com"];e.forEach((function(e){var i="^https://(.*.)?".concat(e,"(/.*)?$");if(!!t&&t.match(i)){r=true}}));return r};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!this.userName){console.error("wm-navigator: user-name is a required property.")}return[4,this.parseData()];case 1:t.sent();this.setFocusIndex();return[2]}}))}))};t.prototype.parseData=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){switch(r.label){case 0:if(!!!this.loadFromUserinfo)return[3,2];return[4,getRequest("/platform/navigator/userinfo").then((function(r){t.email=r.email;t.currentProductId=r.current_product_id;t.parsedProducts=t.productKeysToCamelCase(r.products);t.logoutUrl=t.logoutUrl?t.logoutUrl:r.logout_url;t.connectionName=t.connectionName?t.connectionName:r.connection_name;if(!!t.email&&!!t.currentProductId){t.retrievedInfo=true}})).catch((function(t){console.error(t)}))];case 1:r.sent();return[3,3];case 2:this.currentProductId=getWmMode(this.el);if(!!this.products){if(typeof this.products==="string"){this.parsedProducts=JSON.parse(this.products)}else{this.parsedProducts=this.products}this.parsedProducts=this.productKeysToCamelCase(this.parsedProducts)}r.label=3;case 3:this.parsedProducts.sort((function(t,r){return t.name<r.name?-1:1}));return[2]}}))}))};t.prototype.productKeysToCamelCase=function(t){t=t.map((function(t){var r=Object.keys(t);var e={};r.forEach((function(r){e[snakeCaseToCamelCase(r)]=t[r]}));return e}));return t};t.prototype.setFocusIndex=function(){if(this.parsedProducts.length>1){var t=this.getProduct(this.currentProductId);if(t){this.itemIndexToFocus=this.parsedProducts.indexOf(t)}}};t.prototype.handleKeys=function(t){switch(t.key){case"Escape":t.preventDefault();this.closeMenu();break;case"ArrowDown":case"ArrowUp":t.preventDefault();if(!this.isOpen){this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,t.key,this.navigatorItems.length);this.openMenu()}break}};t.prototype.handleKeydown=function(t){var r=t.detail.key;var e=t.detail.navItem;switch(r){case"Tab":this.closeMenu(false);break;case"Enter":case" ":e.click();break;case"ArrowDown":case"ArrowUp":var i=this.itemIndexToFocus;this.itemIndexToFocus=getNewIndexToFocus(this.itemIndexToFocus,r,this.navigatorItems.length);this.focusItem();this.unfocusItem(i);break}};t.prototype.handleClick=function(t){var r=t.target===this.el||this.el.contains(t.target);if(!r&&this.isOpen){this.closeMenu(false)}};t.prototype.handleButtonClick=function(){this.isOpen?this.closeMenu():this.openMenu()};t.prototype.openMenu=function(){if(this.wrapperEl){var t=this.wrapperEl.clientWidth;var r=this.el.getBoundingClientRect().left;var e=document.documentElement.clientWidth-this.el.getBoundingClientRect().right;this.openRight=t>r&&e>r}this.isOpen=true;this.focusItem()};t.prototype.closeMenu=function(t){var r=this;if(t===void 0){t=true}this.isOpen=false;window.requestAnimationFrame((function(){r.unfocusItem(r.itemIndexToFocus);r.setFocusIndex();if(t){r.buttonFocusHandler()}}))};t.prototype.focusItem=function(){var t=this.navigatorItems[this.itemIndexToFocus];t.tabIndex=0;t.focused=true;window.setTimeout((function(){return t.focus()}),250)};t.prototype.unfocusItem=function(t){var r=this.navigatorItems[t];r.tabIndex=-1;r.focused=false};t.prototype.buttonFocusHandler=function(){var t=this.el.shadowRoot.querySelector("priv-navigator-button");var r=t.shadowRoot.querySelector("button");r.focus()};t.prototype.renderUserInfo=function(){return h("div",{class:"user",id:"wm-nav-user","aria-label":intl.formatMessage({id:"navigator.userinfoLabel",defaultMessage:"for {name}, email {email}"},{name:this.userName,email:this.email})},h("p",null,this.userName),h("p",null,this.email))};t.prototype.setAltText=function(){if(this.parsedProducts.length>1){return intl.formatMessage({id:"navigator.userinfoAndProductNavigator",defaultMessage:"User information and product navigator"})}else{return intl.formatMessage({id:"navigator.userinfo",defaultMessage:"User information"})}};t.prototype.renderHeading=function(){return h("h2",null,intl.formatMessage({id:"navigator.watermarkApps",defaultMessage:"Watermark Apps",description:"Applications made by Watermark Insights"}))};t.prototype.renderList=function(){return h("ul",{role:"listbox","aria-label":"".concat(intl.formatMessage({id:"navigator.WatermarkAppNavigation",defaultMessage:"Watermark App Navigation",description:"list of applications by Watermark Insights"})),"aria-describedby":"wm-nav-user"},this.parsedProducts.length>1&&this.renderProductOptions(),this.renderLogoutOption())};t.prototype.renderProductOptions=function(){var t=this;return this.parsedProducts.map((function(r){var e,i,n,a;e=r.name;i=r.iconUrl;a=t.setProductOnClick(r.id);if(!!e&&!!i){n=t.currentProductId===r.id;return h("priv-navigator-item",{selected:n,id:r.id,onClick:function(){n?t.closeMenu():a()},role:"option","aria-label":e,"aria-selected":n?"true":"false"},h("img",{src:i,alt:e}))}}))};t.prototype.setProductOnClick=function(t){var r=this.getProduct(t);if(this.currentProductId===t){return function(){}}else if(r){if(!!this.loadFromUserinfo||this.authType===2){var e=r.linkUrl;if(this.isSafeUrl(e)){return function(){return window.location.href=e}}else{console.error('"'.concat(e,'" is not a safe url'));return}}else if(this.authType===3){var i=this.connectionName?"/?connection_name=".concat(this.connectionName):"";var n=r.samlLinkUrl;if(this.isSafeUrl(n)){return function(){return window.location.href=n+i}}else{console.error('"'.concat(n,'" is not a safe url'));return}}}};t.prototype.renderLogoutOption=function(){return h("priv-navigator-item",{class:"logout",selected:!(this.parsedProducts.length>1),id:"nav-logout",onClick:this.setLogoutOnclick(),role:"option","aria-selected":"false"},h("span",{class:"logout"},intl.formatMessage({id:"navigator.logout",defaultMessage:"Log Out"})))};t.prototype.setLogoutOnclick=function(){var t=this;return function(){t.wmNavigatorLogout.emit();var r=t.logoutUrl;if(t.isSafeUrl(r)){window.location.href=r}else{console.error('"'.concat(r,'" is not a safe url'))}}};Object.defineProperty(t.prototype,"navigatorItems",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll("priv-navigator-item"))},enumerable:false,configurable:true});t.prototype.getProduct=function(t){return this.parsedProducts.find((function(r){return r.id===t}))};t.prototype.render=function(){var t=this;return this.retrievedInfo?h(Host,null,h("priv-navigator-button",{expanded:this.isOpen,altText:this.setAltText()}),h("div",{class:"wrapper ".concat(this.isOpen?"":"hide"," ").concat(this.openRight?"right":""),ref:function(r){return t.wrapperEl=r}},this.renderUserInfo(),this.parsedProducts.length>1&&this.renderHeading(),this.renderList())):""};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{products:["parseData"]}},enumerable:false,configurable:true});return t}();Navigator.style=wmNavigatorCss;export{Navigator as wm_navigator};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,f as forceUpdate,h,H as Host,g as getElement}from"./index-130e07bb.js";import{i as intl,t as toBool,z as isElOrChild,y as getTextDir}from"./functions-046fc5a3.js";import{g as globalMessages}from"./intl-0822738a.js";var wmNestedSelectCss=':host{--wmcolor-select-background:var(--wmcolor-background);--wmcolor-select-border:var(--wmcolor-input-border);--wmcolor-select-option-background-disabled:var(--wmcolor-option-background-disabled);--wmcolor-select-option-background-focus:var(--wmcolor-option-background-focus);--wmcolor-select-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-select-option-background-selected:var(--wmcolor-option-background-selected);--wmcolor-select-option-background:var(--wmcolor-option-background);--wmcolor-select-option-border:var(--wmcolor-option-border);--wmcolor-select-option-text-disabled:var(--wmcolor-option-text-disabled);--wmcolor-select-option-text:var(--wmcolor-option-text);--wmcolor-select-search-border:var(--wmcolor-input-border);--wmcolor-select-search-icon:var(--wmcolor-icon-accent);--wmcolor-select-searchresults-text:var(--wmcolor-text);--wmcolor-select-selectall-background:var(--wmcolor-select-option-background);--wmcolor-select-selectall-border:var(--wmcolor-select-option-border);--wmcolor-select-selectall-text:var(--wmcolor-interactive);--wmcolor-select-text:var(--wmcolor-interactive);position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit}.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:var(--wmcolor-text-required)}.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:var(--wmcolor-text-error)}.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}.button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:var(--wmcolor-select-text);min-width:8.75rem}.button-wrapper .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:var(--wmcolor-select-background);width:100%;border:solid 1px;border-color:var(--wmcolor-select-border);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:var(--wmcolor-select-text);font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.button-wrapper .displayedoption{height:2.75rem}}.button-wrapper .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;font-size:1.12rem}.button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:var(--wmcolor-select-background);text-decoration:none}.button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.button-wrapper .displayedoption:focus{outline:none}.button-wrapper .displayedoption::-moz-focus-inner{border:0}.button-wrapper .displayedoption:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:2px}.button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}.wrapper .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-bottom:0.25rem;top:100%;left:0}.wrapper .error-message:not(:empty){margin-top:0.25rem}.dropdown{overflow-x:hidden;overflow-y:auto;-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-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;transform:scale(1, 0);-webkit-overflow-scrolling:touch;-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;transition: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:40;right:0;background:var(--wmcolor-select-option-background);z-index:100;width:100%;font-size:0.875rem}.dropdown.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}.dropdown.hidden{visibility:hidden}.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.menu{width:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.menu.hidden{position:absolute}.menu .menuitem{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;cursor:pointer;position:relative;padding:1.25rem;background:var(--wmcolor-select-option-background);font-family:inherit;list-style:none;color:var(--wmcolor-select-option-text);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;font-weight:600}.menu .menuitem:not(:last-child){border-bottom:2px solid;border-color:var(--wmcolor-select-option-border)}.menu :focus{outline:none;background:var(--wmcolor-interactive-background-focus)}.menu :hover{background:var(--wmcolor-select-option-background-hover);outline:none}.group-btn: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:"\\f142";position:absolute;right:1.25rem;pointer-events:none;font-size:1.12rem}.selection-count{margin-right:20px;font-weight:400;font-style:italic}.option-list-wrapper{background:white;width:100%;-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transition:-webkit-transform 0.2s cubic-bezier(0.04, 0, 0.2, 1);transition:-webkit-transform 0.2s cubic-bezier(0.04, 0, 0.2, 1);transition:transform 0.2s cubic-bezier(0.04, 0, 0.2, 1);transition:transform 0.2s cubic-bezier(0.04, 0, 0.2, 1), -webkit-transform 0.2s cubic-bezier(0.04, 0, 0.2, 1)}.option-list-wrapper.visible{-webkit-transform:translateX(0%);transform:translateX(0%)}.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}';var WmNestedSelectStyle0=wmNestedSelectCss;var NestedSelect=function(){function e(e){registerInstance(this,e);this.wmNestedSelectBlurred=createEvent(this,"wmNestedSelectBlurred",7);this.overflowCount=0;this.displayedOptions=[];this.clearSelectionMessage=this.multiple?intl.formatMessage({id:"select.multiClearSelection",defaultMessage:"Clear all Selections",description:"Button text to clear selection. Use imperative"}):intl.formatMessage({id:"select.singleClearSelection",defaultMessage:"Clear Selection",description:"Button text to clear selection. Use imperative"});this.disabled=false;this.maxHeight=undefined;this.label=undefined;this.labelPosition="top";this.requiredField=false;this.errorMessage=undefined;this.multiple=false;this.search=false;this.selectAll=false;this.placeholder=this.multiple?intl.formatMessage({id:"select.multiPlaceholder",defaultMessage:"Make a selection",description:"Placeholder text for multiple select. Use imperative"}):intl.formatMessage({id:"select.singlePlaceholder",defaultMessage:"Select an Option",description:"Placeholder text for single select. Use imperative"});this.searchPlaceholder=intl.formatMessage({id:"select.searchPlaceholder",defaultMessage:"Search",description:"Placeholder text. Use imperative"});this.allSelectedMessage=intl.formatMessage({id:"select.allSelected",defaultMessage:"All selected",description:"Text displayed when all options are selected"});this.isExpanded=false;this.optgroupExpanded=false}Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"optgroupEls",{get:function(){return Array.from(this.el.querySelectorAll("wm-optgroup"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"menuitemEls",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll(".menuitem"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"allSelected",{get:function(){return this.childOptions.every((function(e){return e.selected}))},enumerable:false,configurable:true});e.prototype.componentWillLoad=function(){var e=this;var t=new MutationObserver((function(t){return t.forEach((function(t){return e.handleChildChange(t)}))}));t.observe(this.el,{childList:true,attributes:true,subtree:true,attributeFilter:["selected"]})};e.prototype.componentDidLoad=function(){if(this.maxHeight){this.dropdownEl.style.maxHeight=this.maxHeight}};e.prototype.handleChildChange=function(e){this.setButtonText();forceUpdate(this.el)};e.prototype.setButtonText=function(){this.displayedOptions=this.childOptions.filter((function(e){return e.selected}));if(this.multiple){var e=38;var t=window.getComputedStyle(this.buttonEl);var o=parseInt(t.getPropertyValue("padding-left").slice(0,-2));var r=parseInt(t.getPropertyValue("padding-right").slice(0,-2));var i=this.buttonEl.clientWidth-o-r-e;var n=this.displayedOptions.map((function(e){return e.shadowRoot.querySelector(".option-text").clientWidth}));var s=n.reduce((function(e,t){return e+t}),0);this.overflowCount=0;while(s>i&&this.displayedOptions.length>1){this.overflowCount++;s-=n[n.length-1];n.pop();this.displayedOptions.pop()}}};e.prototype.countOptgroupSelected=function(e){var t=Array.from(e.querySelectorAll("wm-option")).filter((function(e){return e.selected}));return t.length};e.prototype.handleOptionSelection=function(){if(!this.multiple){this.close()}};e.prototype.handleChildEnter=function(){this.close()};e.prototype.closePopupOnEscape=function(){this.close()};e.prototype.handleOptionKeyLeft=function(e){var t=e.detail.parentElement;t.isExpanded=false;this.focusFirstMenuitem()};e.prototype.close=function(e){var t=this;if(e===void 0){e=true}if(this.isExpanded){this.isExpanded=false;this.optgroupEls.forEach((function(e){return e.isExpanded=false}));window.setTimeout((function(){t.dropdownEl.classList.remove("open");if(e){t.buttonEl.focus()}}),150)}};e.prototype.open=function(){var e=this;this.isExpanded=true;this.dropdownEl.classList.add("open");window.requestAnimationFrame((function(){e.focusFirstMenuitem()}))};e.prototype.focusFirstMenuitem=function(){if(this.menuitemEls.length>0){this.menuitemEls[0].focus()}};e.prototype.moveDown=function(e){var t=this.menuitemEls.indexOf(e);if(t==this.menuitemEls.length-1){this.menuitemEls[0].focus()}else{this.menuitemEls[t+1].focus()}};e.prototype.moveUp=function(e){var t=this.menuitemEls.indexOf(e);if(t==0){this.menuitemEls[this.menuitemEls.length-1].focus()}else{this.menuitemEls[t-1].focus()}};e.prototype.handleButtonBlur=function(e){if(isElOrChild(this.el,e.relatedTarget)){e.stopPropagation()}};e.prototype.handleClick=function(e){if(!isElOrChild(this.el,e.target)){this.close()}};e.prototype.handleMenuitemKeydown=function(e){switch(e.key){case"ArrowDown":e.preventDefault();this.moveDown(e.target);break;case"ArrowUp":e.preventDefault();this.moveUp(e.target);break;case"ArrowRight":if(e.target.classList.contains("group-btn")){e.preventDefault();e.target.click()}break;case"Escape":e.preventDefault();this.close();break}};e.prototype.handleComponentBlur=function(e){if(!this.el.contains(e.relatedTarget)){this.close(false);this.wmNestedSelectBlurred.emit()}};e.prototype.handleOptgroupExpanded=function(){this.optgroupExpanded=true};e.prototype.handleOptgroupHidden=function(){this.optgroupExpanded=false};e.prototype.renderButtonText=function(){if(this.displayedOptions.length<1){return h("span",null,this.placeholder)}else if(this.multiple&&this.allSelected&&this.overflowCount>0){return this.allSelectedMessage}else{return this.displayedOptions.map((function(e,t){return h("span",null,t>0?", ":"",e.textContent)}))}};e.prototype.renderOverflowCount=function(){if(this.overflowCount>0){return h("span",null,h("span",{class:"overflow-counter"},"+",this.overflowCount))}};e.prototype.handleClearSelection=function(){this.optgroupEls.forEach((function(e){return e.emitDeselection()}))};e.prototype.renderClearSelectionButton=function(){var e=this;var t=this.childOptions.some((function(e){return e.selected}));if(t){return h("button",{class:"menuitem",onClick:function(){return e.handleClearSelection()},tabindex:-1,onKeyDown:function(t){return e.handleMenuitemKeydown(t)}},this.clearSelectionMessage)}};e.prototype.renderSelectionCount=function(e){var t=this.countOptgroupSelected(e);if(t){var o=intl.formatMessage({id:"select.optgroupSelectionCount",defaultMessage:"{numSelected, plural, one {Item} other {#}} Selected",description:"Text indicating number of selected in a group."},{numSelected:t});return h("div",{class:"selection-count"},h("span",null,o))}};e.prototype.render=function(){var e;var t=this;var o=(e={id:"selectbtn"},e["disabled"]=this.isDisabled,e["aria-controls"]="list",e["aria-labelledby"]="label selectbtn",e["aria-describedby"]="error",e["aria-expanded"]=this.isExpanded?"true":"false",e.onClick=function(){t.isExpanded?t.close():t.open()},e);return h(Host,{key:"8771f6abb8cc9ed2657d0f6ec31b837352cdb4d0",onBlur:function(e){return t.handleComponentBlur(e)}},h("div",{key:"fb64f235e8ce911df58f04a426cf4149c9ea818e",class:"wrapper ".concat(getTextDir()," label-").concat(this.labelPosition," ").concat(this.errorMessage?"invalid":"")},h("div",{key:"86a40eefed2fe8b0113d2887dcca0453ac6a984a",class:"label-wrapper"},h("label",{key:"296a84604f95f4446d06f1618879786a89e98902",class:"label",id:"label",htmlFor:"selectbtn"},this.label,this.requiredField?h("span",{class:"required"},h("span",{class:"sr-only"},globalMessages.requiredField),h("span",{"aria-hidden":"true"},"*")):"")),h("div",{key:"212227342d050b279d589ea2c3dde05019ab166f",class:"button-wrapper"},h("button",Object.assign({key:"f239aa90bdd30c10cdfdc8a355899b02c8c4ea94"},o,{class:"displayedoption",ref:function(e){return t.buttonEl=e},onBlur:function(e){return t.handleButtonBlur(e)},onFocus:function(){return t.close()}}),h("span",{key:"f73375b774c2d940cf5afae37225ffaf4255486e",class:"overflowcontrol"},h("span",{key:"a9ae2f27508a9c69feeeea0345f825394c06c918",class:"button-text"},this.renderButtonText())),this.renderOverflowCount()),h("div",{key:"714a38674ca3011e57e25ade678f7d7b4203f5f2",class:"dropdown",ref:function(e){return t.dropdownEl=e}},h("div",{key:"532dd17d04d7fbee57b53ed3f911e785321f6edf",class:"menu ".concat(this.optgroupExpanded?"hidden":"")},this.renderClearSelectionButton(),this.optgroupEls.map((function(e){return h("button",{class:"menuitem group-btn",role:"menuitem",tabindex:-1,onClick:function(){e.isExpanded=!e.isExpanded;forceUpdate(t.el)},onKeyDown:function(e){return t.handleMenuitemKeydown(e)}},h("span",null,e.label),t.renderSelectionCount(e))}))),h("div",{key:"9f65293fb3514808a7afc99f9ccf7be3c76854fb",class:"option-list-wrapper ".concat(this.optgroupExpanded?"visible":"")},h("slot",{key:"ff01236e84136b637fe4dc6bbf4075ff655f661d"}))),h("div",{key:"49a965130ab5e5ebadc94b0661dbb97000f3621d",id:"error",class:this.errorMessage?"error-message":""},this.errorMessage))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();NestedSelect.style=WmNestedSelectStyle0;export{NestedSelect as wm_nested_select};
|
|
1
|
+
import{r as registerInstance,c as createEvent,f as forceUpdate,h,H as Host,g as getElement}from"./index-558b5a82.js";import{i as intl,t as toBool,z as isElOrChild,y as getTextDir}from"./functions-dea8b0f6.js";import{g as globalMessages}from"./intl-417d8b33.js";var wmNestedSelectCss=':host{--wmcolor-select-background:var(--wmcolor-background);--wmcolor-select-border:var(--wmcolor-input-border);--wmcolor-select-option-background-disabled:var(--wmcolor-option-background-disabled);--wmcolor-select-option-background-focus:var(--wmcolor-option-background-focus);--wmcolor-select-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-select-option-background-selected:var(--wmcolor-option-background-selected);--wmcolor-select-option-background:var(--wmcolor-option-background);--wmcolor-select-option-border:var(--wmcolor-option-border);--wmcolor-select-option-text-disabled:var(--wmcolor-option-text-disabled);--wmcolor-select-option-text:var(--wmcolor-option-text);--wmcolor-select-search-border:var(--wmcolor-input-border);--wmcolor-select-search-icon:var(--wmcolor-icon-accent);--wmcolor-select-searchresults-text:var(--wmcolor-text);--wmcolor-select-selectall-background:var(--wmcolor-select-option-background);--wmcolor-select-selectall-border:var(--wmcolor-select-option-border);--wmcolor-select-selectall-text:var(--wmcolor-interactive);--wmcolor-select-text:var(--wmcolor-interactive);position:relative;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit}.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:var(--wmcolor-text-required)}.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:var(--wmcolor-text-error)}.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}.button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:var(--wmcolor-select-text);min-width:8.75rem}.button-wrapper .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:var(--wmcolor-select-background);width:100%;border:solid 1px;border-color:var(--wmcolor-select-border);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:var(--wmcolor-select-text);font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.button-wrapper .displayedoption{height:2.75rem}}.button-wrapper .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;font-size:1.12rem}.button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:var(--wmcolor-select-background);text-decoration:none}.button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.button-wrapper .displayedoption:focus{outline:none}.button-wrapper .displayedoption::-moz-focus-inner{border:0}.button-wrapper .displayedoption:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:2px}.button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}.wrapper .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-bottom:0.25rem;top:100%;left:0}.wrapper .error-message:not(:empty){margin-top:0.25rem}.dropdown{overflow-x:hidden;overflow-y:auto;-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-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;transform:scale(1, 0);-webkit-overflow-scrolling:touch;-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;transition: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:40;right:0;background:var(--wmcolor-select-option-background);z-index:100;width:100%;font-size:0.875rem}.dropdown.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}.dropdown.hidden{visibility:hidden}.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.menu{width:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.menu.hidden{position:absolute}.menu .menuitem{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;cursor:pointer;position:relative;padding:1.25rem;background:var(--wmcolor-select-option-background);font-family:inherit;list-style:none;color:var(--wmcolor-select-option-text);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;font-weight:600}.menu .menuitem:not(:last-child){border-bottom:2px solid;border-color:var(--wmcolor-select-option-border)}.menu :focus{outline:none;background:var(--wmcolor-interactive-background-focus)}.menu :hover{background:var(--wmcolor-select-option-background-hover);outline:none}.group-btn: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:"\\f142";position:absolute;right:1.25rem;pointer-events:none;font-size:1.12rem}.selection-count{margin-right:20px;font-weight:400;font-style:italic}.option-list-wrapper{background:white;width:100%;-webkit-transform:translateX(100%);transform:translateX(100%);-webkit-transition:-webkit-transform 0.2s cubic-bezier(0.04, 0, 0.2, 1);transition:-webkit-transform 0.2s cubic-bezier(0.04, 0, 0.2, 1);transition:transform 0.2s cubic-bezier(0.04, 0, 0.2, 1);transition:transform 0.2s cubic-bezier(0.04, 0, 0.2, 1), -webkit-transform 0.2s cubic-bezier(0.04, 0, 0.2, 1)}.option-list-wrapper.visible{-webkit-transform:translateX(0%);transform:translateX(0%)}.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}';var NestedSelect=function(){function e(e){registerInstance(this,e);this.wmNestedSelectBlurred=createEvent(this,"wmNestedSelectBlurred",7);this.overflowCount=0;this.displayedOptions=[];this.clearSelectionMessage=this.multiple?intl.formatMessage({id:"select.multiClearSelection",defaultMessage:"Clear all Selections",description:"Button text to clear selection. Use imperative"}):intl.formatMessage({id:"select.singleClearSelection",defaultMessage:"Clear Selection",description:"Button text to clear selection. Use imperative"});this.disabled=false;this.maxHeight=undefined;this.label=undefined;this.labelPosition="top";this.requiredField=false;this.errorMessage=undefined;this.multiple=false;this.search=false;this.selectAll=false;this.placeholder=this.multiple?intl.formatMessage({id:"select.multiPlaceholder",defaultMessage:"Make a selection",description:"Placeholder text for multiple select. Use imperative"}):intl.formatMessage({id:"select.singlePlaceholder",defaultMessage:"Select an Option",description:"Placeholder text for single select. Use imperative"});this.searchPlaceholder=intl.formatMessage({id:"select.searchPlaceholder",defaultMessage:"Search",description:"Placeholder text. Use imperative"});this.allSelectedMessage=intl.formatMessage({id:"select.allSelected",defaultMessage:"All selected",description:"Text displayed when all options are selected"});this.isExpanded=false;this.optgroupExpanded=false}Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"optgroupEls",{get:function(){return Array.from(this.el.querySelectorAll("wm-optgroup"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"menuitemEls",{get:function(){return Array.from(this.el.shadowRoot.querySelectorAll(".menuitem"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"allSelected",{get:function(){return this.childOptions.every((function(e){return e.selected}))},enumerable:false,configurable:true});e.prototype.componentWillLoad=function(){var e=this;var t=new MutationObserver((function(t){return t.forEach((function(t){return e.handleChildChange(t)}))}));t.observe(this.el,{childList:true,attributes:true,subtree:true,attributeFilter:["selected"]})};e.prototype.componentDidLoad=function(){if(this.maxHeight){this.dropdownEl.style.maxHeight=this.maxHeight}};e.prototype.handleChildChange=function(e){this.setButtonText();forceUpdate(this.el)};e.prototype.setButtonText=function(){this.displayedOptions=this.childOptions.filter((function(e){return e.selected}));if(this.multiple){var e=38;var t=window.getComputedStyle(this.buttonEl);var o=parseInt(t.getPropertyValue("padding-left").slice(0,-2));var r=parseInt(t.getPropertyValue("padding-right").slice(0,-2));var i=this.buttonEl.clientWidth-o-r-e;var n=this.displayedOptions.map((function(e){return e.shadowRoot.querySelector(".option-text").clientWidth}));var s=n.reduce((function(e,t){return e+t}),0);this.overflowCount=0;while(s>i&&this.displayedOptions.length>1){this.overflowCount++;s-=n[n.length-1];n.pop();this.displayedOptions.pop()}}};e.prototype.countOptgroupSelected=function(e){var t=Array.from(e.querySelectorAll("wm-option")).filter((function(e){return e.selected}));return t.length};e.prototype.handleOptionSelection=function(){if(!this.multiple){this.close()}};e.prototype.handleChildEnter=function(){this.close()};e.prototype.closePopupOnEscape=function(){this.close()};e.prototype.handleOptionKeyLeft=function(e){var t=e.detail.parentElement;t.isExpanded=false;this.focusFirstMenuitem()};e.prototype.close=function(e){var t=this;if(e===void 0){e=true}if(this.isExpanded){this.isExpanded=false;this.optgroupEls.forEach((function(e){return e.isExpanded=false}));window.setTimeout((function(){t.dropdownEl.classList.remove("open");if(e){t.buttonEl.focus()}}),150)}};e.prototype.open=function(){var e=this;this.isExpanded=true;this.dropdownEl.classList.add("open");window.requestAnimationFrame((function(){e.focusFirstMenuitem()}))};e.prototype.focusFirstMenuitem=function(){if(this.menuitemEls.length>0){this.menuitemEls[0].focus()}};e.prototype.moveDown=function(e){var t=this.menuitemEls.indexOf(e);if(t==this.menuitemEls.length-1){this.menuitemEls[0].focus()}else{this.menuitemEls[t+1].focus()}};e.prototype.moveUp=function(e){var t=this.menuitemEls.indexOf(e);if(t==0){this.menuitemEls[this.menuitemEls.length-1].focus()}else{this.menuitemEls[t-1].focus()}};e.prototype.handleButtonBlur=function(e){if(isElOrChild(this.el,e.relatedTarget)){e.stopPropagation()}};e.prototype.handleClick=function(e){if(!isElOrChild(this.el,e.target)){this.close()}};e.prototype.handleMenuitemKeydown=function(e){switch(e.key){case"ArrowDown":e.preventDefault();this.moveDown(e.target);break;case"ArrowUp":e.preventDefault();this.moveUp(e.target);break;case"ArrowRight":if(e.target.classList.contains("group-btn")){e.preventDefault();e.target.click()}break;case"Escape":e.preventDefault();this.close();break}};e.prototype.handleComponentBlur=function(e){if(!this.el.contains(e.relatedTarget)){this.close(false);this.wmNestedSelectBlurred.emit()}};e.prototype.handleOptgroupExpanded=function(){this.optgroupExpanded=true};e.prototype.handleOptgroupHidden=function(){this.optgroupExpanded=false};e.prototype.renderButtonText=function(){if(this.displayedOptions.length<1){return h("span",null,this.placeholder)}else if(this.multiple&&this.allSelected&&this.overflowCount>0){return this.allSelectedMessage}else{return this.displayedOptions.map((function(e,t){return h("span",null,t>0?", ":"",e.textContent)}))}};e.prototype.renderOverflowCount=function(){if(this.overflowCount>0){return h("span",null,h("span",{class:"overflow-counter"},"+",this.overflowCount))}};e.prototype.handleClearSelection=function(){this.optgroupEls.forEach((function(e){return e.emitDeselection()}))};e.prototype.renderClearSelectionButton=function(){var e=this;var t=this.childOptions.some((function(e){return e.selected}));if(t){return h("button",{class:"menuitem",onClick:function(){return e.handleClearSelection()},tabindex:-1,onKeyDown:function(t){return e.handleMenuitemKeydown(t)}},this.clearSelectionMessage)}};e.prototype.renderSelectionCount=function(e){var t=this.countOptgroupSelected(e);if(t){var o=intl.formatMessage({id:"select.optgroupSelectionCount",defaultMessage:"{numSelected, plural, one {Item} other {#}} Selected",description:"Text indicating number of selected in a group."},{numSelected:t});return h("div",{class:"selection-count"},h("span",null,o))}};e.prototype.render=function(){var e;var t=this;var o=(e={id:"selectbtn"},e["disabled"]=this.isDisabled,e["aria-controls"]="list",e["aria-labelledby"]="label selectbtn",e["aria-describedby"]="error",e["aria-expanded"]=this.isExpanded?"true":"false",e.onClick=function(){t.isExpanded?t.close():t.open()},e);return h(Host,{onBlur:function(e){return t.handleComponentBlur(e)}},h("div",{class:"wrapper ".concat(getTextDir()," label-").concat(this.labelPosition," ").concat(this.errorMessage?"invalid":"")},h("div",{class:"label-wrapper"},h("label",{class:"label",id:"label",htmlFor:"selectbtn"},this.label,this.requiredField?h("span",{class:"required"},h("span",{class:"sr-only"},globalMessages.requiredField),h("span",{"aria-hidden":"true"},"*")):"")),h("div",{class:"button-wrapper"},h("button",Object.assign({},o,{class:"displayedoption",ref:function(e){return t.buttonEl=e},onBlur:function(e){return t.handleButtonBlur(e)},onFocus:function(){return t.close()}}),h("span",{class:"overflowcontrol"},h("span",{class:"button-text"},this.renderButtonText())),this.renderOverflowCount()),h("div",{class:"dropdown",ref:function(e){return t.dropdownEl=e}},h("div",{class:"menu ".concat(this.optgroupExpanded?"hidden":"")},this.renderClearSelectionButton(),this.optgroupEls.map((function(e){return h("button",{class:"menuitem group-btn",role:"menuitem",tabindex:-1,onClick:function(){e.isExpanded=!e.isExpanded;forceUpdate(t.el)},onKeyDown:function(e){return t.handleMenuitemKeydown(e)}},h("span",null,e.label),t.renderSelectionCount(e))}))),h("div",{class:"option-list-wrapper ".concat(this.optgroupExpanded?"visible":"")},h("slot",null))),h("div",{id:"error",class:this.errorMessage?"error-message":""},this.errorMessage))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();NestedSelect.style=wmNestedSelectCss;export{NestedSelect as wm_nested_select};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,n,
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,n,i){function r(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i["throw"](t))}catch(t){o(t)}}function u(t){t.done?n(t.value):r(t.value).then(s,a)}u((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return u([t,e])}}function u(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(i=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;r=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(t){a=[6,t];r=0}finally{i=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-558b5a82.js";var wmOptgroupCss=':host{width:100%;display:none}: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}:host(.visible){display:unset}.return-btn{cursor:pointer;padding:1.25rem;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-weight:600;font-size:0.875rem;border-bottom:1px solid #4a4a4a}.return-btn: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:"\\f141";pointer-events:none;font-size:1.12rem}.return-btn:hover{background:var(--wmcolor-select-option-background-hover);outline:none}';var Optgroup=function(){function t(t){registerInstance(this,t);this.wmOptgroupAllSelected=createEvent(this,"wmOptgroupAllSelected",7);this.wmOptgroupAllDeselected=createEvent(this,"wmOptgroupAllDeselected",7);this.optgroupExpanded=createEvent(this,"optgroupExpanded",7);this.optgroupHidden=createEvent(this,"optgroupHidden",7);this.label=undefined;this.isExpanded=false;this.multiple=false}Object.defineProperty(t.prototype,"parentNestedSelect",{get:function(){return this.el.parentElement},enumerable:false,configurable:true});t.prototype.isExpandedChanged=function(){var t=this;if(this.isExpanded){this.optgroupExpanded.emit();window.setTimeout((function(){t.optionListEl.handleInitialFocus()}),250)}else{this.optgroupHidden.emit()}};t.prototype.emitDeselection=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.wmOptgroupAllDeselected.emit();return[2]}))}))};t.prototype.render=function(){var t=this;return h(Host,{class:"".concat(this.isExpanded?"visible":"")},h("div",{class:"return-btn",onClick:function(){t.isExpanded=false}},this.label),h("div",{class:"list-wrapper"},h("priv-option-list",{ref:function(e){return t.optionListEl=e},multiple:this.parentNestedSelect.multiple,search:this.parentNestedSelect.search,searchPlaceholder:this.parentNestedSelect.searchPlaceholder,selectAll:this.parentNestedSelect.selectAll,onOptionListAllSelected:function(){return t.wmOptgroupAllSelected.emit()},onOptionListAllDeselected:function(){return t.wmOptgroupAllDeselected.emit()}},h("slot",null))))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{isExpanded:["isExpandedChanged"]}},enumerable:false,configurable:true});return t}();Optgroup.style=wmOptgroupCss;export{Optgroup as wm_optgroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-130e07bb.js";import{i as intl,t as toBool,z as isElOrChild,a as handleDisabledAttribute,k as shouldOpenUp,y as getTextDir}from"./functions-046fc5a3.js";import{g as globalMessages}from"./intl-0822738a.js";var wmOptionCss=':host(:not(:last-child)){border-bottom:2px solid;border-color:var(--wmcolor-select-option-border)}:host{display:block;cursor:pointer;position:relative;padding:1.25rem;background:var(--wmcolor-select-option-background);font-family:inherit;list-style:none;color:var(--wmcolor-select-option-text);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host:focus,:host.focus{outline:none;background:var(--wmcolor-select-option-background-focus)}:host.icon{color:var(--wmcolor-interactive)}: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}.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-block;margin-right:0.25rem;color:var(--wmcolor-interactive)}:host([aria-selected=true]){background:var(--wmcolor-select-option-background-selected);font-weight:500}:host([aria-selected=true]) .checkbox:before{content:"\\f132"}:host([aria-disabled=true]){color:var(--wmcolor-select-option-text-disabled);background:var(--wmcolor-select-option-background-disabled);cursor:default}:host([aria-disabled=true]) .checkbox:before{color:var(--wmcolor-select-option-text-disabled)}:host([aria-disabled=true]) .subinfo{color:var(--wmcolor-select-option-text-disabled)}:host(.multi-option){background:unset}:host(.clone.last){border-bottom:12px solid;border-color:var(--wmcolor-select-option-border)}:host(.hassubinfo){display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;gap:16px}:host(.hidden),:host(.filtered-out){display:none}.subinfo{font-style:italic}.option-wrapper{display:-ms-flexbox;display:flex}.option-text{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){outline:none;background:var(--wmcolor-select-option-background-hover)}:host(:hover){background:var(--wmcolor-select-option-background-hover);outline:none}';var WmOptionStyle0=wmOptionCss;var Option=function(){function e(e){registerInstance(this,e);this.wmOptionSelected=createEvent(this,"wmOptionSelected",7);this.wmOptionDeselected=createEvent(this,"wmOptionDeselected",7);this.intCloneClicked=createEvent(this,"intCloneClicked",7);this.wmKeyUpPressed=createEvent(this,"wmKeyUpPressed",7);this.wmKeyDownPressed=createEvent(this,"wmKeyDownPressed",7);this.wmKeyLeftPressed=createEvent(this,"wmKeyLeftPressed",7);this.wmEscKeyPressed=createEvent(this,"wmEscKeyPressed",7);this.wmHomeKeyPressed=createEvent(this,"wmHomeKeyPressed",7);this.wmEndKeyPressed=createEvent(this,"wmEndKeyPressed",7);this.wmEnterKeyPressed=createEvent(this,"wmEnterKeyPressed",7);this.wmLetterPressed=createEvent(this,"wmLetterPressed",7);this.wmOptionBlurred=createEvent(this,"wmOptionBlurred",7);this.value=undefined;this.subinfo=undefined;this.disabled=false;this.selected=false;this.focused=false;this.searchTerm=""}Object.defineProperty(e.prototype,"hostClasses",{get:function(){var e=[];if(this.subinfo){e.push("hassubinfo")}if(this.parentOptionList.multiple){e.push("multi-option")}if(!this.el.textContent.toLowerCase().includes(this.searchTerm)){e.push("filtered-out")}return e.join(" ")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"parentOptionList",{get:function(){if(this.el.classList.contains("clone")){return this.el.closest("priv-option-list")}else{return this.el.assignedSlot.closest("priv-option-list")}},enumerable:false,configurable:true});e.prototype.handleKeydown=function(e){switch(e.key){case"ArrowUp":e.preventDefault();this.wmKeyUpPressed.emit(this.el);break;case"ArrowDown":e.preventDefault();this.wmKeyDownPressed.emit(this.el);break;case"Enter":e.preventDefault();if(!this.disabled){this.el.click();this.wmEnterKeyPressed.emit(this.el)}break;case"Escape":e.preventDefault();e.stopPropagation();this.wmEscKeyPressed.emit();break;case"Home":e.preventDefault();this.wmHomeKeyPressed.emit();break;case"End":e.preventDefault();this.wmEndKeyPressed.emit();break;case"ArrowLeft":e.preventDefault();this.wmKeyLeftPressed.emit(this.el);break;default:if(e.key.length===1){e.preventDefault();this.wmLetterPressed.emit({letter:e.key,optionEl:this.el})}}};e.prototype.handleSelection=function(){if(!this.disabled){if(this.el.classList.contains("clone")){this.intCloneClicked.emit(this.el)}else{if(this.parentOptionList.multiple){this.selected?this.wmOptionDeselected.emit(this.el):this.wmOptionSelected.emit(this.el)}else{this.wmOptionSelected.emit(this.el)}}}};e.prototype.handleBlur=function(e){this.wmOptionBlurred.emit({relatedTarget:e.relatedTarget})};e.prototype.syncAriaSelected=function(){this.selected?this.el.setAttribute("aria-selected","true"):this.el.setAttribute("aria-selected","false")};e.prototype.syncAriaDisabled=function(){this.disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")};e.prototype.updateDisabledOnClick=function(){if(this.disabled&&this.el.onclick){this.onClickFunc=this.el.onclick;this.el.onclick=null}else if(!this.disabled&&this.onClickFunc){this.el.onclick=this.onClickFunc}};e.prototype.handleSearch=function(e){this.searchTerm=e.detail.searchTerm.toLowerCase();if(this.searchTerm&&this.el.textContent.toLowerCase().includes(this.searchTerm)){var t=this.el.textContent.toLowerCase().indexOf(this.searchTerm);var o=this.el.textContent.slice(0,t);var r=this.el.textContent.slice(t,t+this.searchTerm.length);var i=this.el.textContent.slice(t+this.searchTerm.length);var n=document.createElement("span");n.textContent=o;var s=document.createElement("strong");s.textContent=r;var a=document.createElement("span");a.textContent=i;this.textEl.innerHTML="";this.textEl.appendChild(n);this.textEl.appendChild(s);this.textEl.appendChild(a)}else{this.textEl.textContent=this.el.textContent}};e.prototype.componentWillLoad=function(){var e=this;this.syncAriaSelected();this.syncAriaDisabled();this.updateDisabledOnClick();this.parentOptionList.addEventListener("optionListSearchChanged",(function(t){return e.handleSearch(t)}))};e.prototype.render=function(){var e=this;return h(Host,{key:"94c3cd2783b9675927ad05aa6c4c1f387f95ef18",role:"option",tabindex:this.focused?0:-1,class:this.hostClasses},h("div",{key:"d3be5bbb8f5bf1f4e7f87bc5e735f78ce197fc62",class:"option-wrapper ".concat(this.parentOptionList.multiple?"checkbox":"")},h("span",{key:"871aa9bd93c515c765cd80713098ada62c48ee73",class:"option-text","aria-hidden":"true",ref:function(t){return e.textEl=t}},this.el.textContent),h("span",{key:"bdb7e37c1febf0b7dd0919f5a8991b6bdd6ad050",class:"sr-only"},this.el.textContent)),h("div",{key:"2fdcbca45d8e3540a24ba7f45d895bae07ee0c18",class:"subinfo"},this.subinfo))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{selected:["syncAriaSelected"],disabled:["syncAriaDisabled","updateDisabledOnClick"]}},enumerable:false,configurable:true});return e}();Option.style=WmOptionStyle0;var wmSelectCss=':host{--wmcolor-select-background:var(--wmcolor-background);--wmcolor-select-border:var(--wmcolor-input-border);--wmcolor-select-option-background-disabled:var(--wmcolor-option-background-disabled);--wmcolor-select-option-background-focus:var(--wmcolor-option-background-focus);--wmcolor-select-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-select-option-background-selected:var(--wmcolor-option-background-selected);--wmcolor-select-option-background:var(--wmcolor-option-background);--wmcolor-select-option-border:var(--wmcolor-option-border);--wmcolor-select-option-text-disabled:var(--wmcolor-option-text-disabled);--wmcolor-select-option-text:var(--wmcolor-option-text);--wmcolor-select-search-border:var(--wmcolor-input-border);--wmcolor-select-search-icon:var(--wmcolor-icon-accent);--wmcolor-select-searchresults-text:var(--wmcolor-text);--wmcolor-select-selectall-background:var(--wmcolor-select-option-background);--wmcolor-select-selectall-border:var(--wmcolor-select-option-border);--wmcolor-select-selectall-text:var(--wmcolor-interactive);--wmcolor-select-text:var(--wmcolor-interactive);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:var(--wmcolor-text-required)}.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:var(--wmcolor-text-error)}.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 .button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:var(--wmcolor-select-text);min-width:8.75rem}.wrapper .button-wrapper .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:var(--wmcolor-select-background);width:100%;border:solid 1px;border-color:var(--wmcolor-select-border);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:var(--wmcolor-select-text);font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .button-wrapper .displayedoption{height:2.75rem}}.wrapper .button-wrapper .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;font-size:1.12rem}.wrapper .button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:var(--wmcolor-select-background);text-decoration:none}.wrapper .button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .button-wrapper .displayedoption:focus{outline:none}.wrapper .button-wrapper .displayedoption::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:2px}.wrapper .button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.wrapper .button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .button-wrapper>.dropdown{-webkit-overflow-scrolling:touch;-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:var(--wmcolor-select-option-background);z-index:100;width:100%;font-size:0.875rem}.wrapper .button-wrapper>.dropdown.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 .button-wrapper>.dropdown.hidden{visibility:hidden}.wrapper .button-wrapper>.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}.wrapper .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-bottom:0.25rem;top:100%;left:0}.wrapper .error-message:not(:empty){margin-top:0.25rem}.options-wrapper{max-height:12.5rem;overflow:auto}.rtl>.dropdown{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.dropdown .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}';var WmSelectStyle0=wmSelectCss;var Select=function(){function e(e){registerInstance(this,e);this.wmSelectDidLoad=createEvent(this,"wmSelectDidLoad",7);this.wmSelectBlurred=createEvent(this,"wmSelectBlurred",7);this.wmSelectAllSelected=createEvent(this,"wmSelectAllSelected",7);this.wmSelectAllDeselected=createEvent(this,"wmSelectAllDeselected",7);this.openUp=false;this.overflowCount=0;this.displayedOptions=[];this.disabled=false;this.maxHeight=undefined;this.label=undefined;this.labelPosition="top";this.requiredField=false;this.errorMessage=undefined;this.multiple=false;this.search=false;this.selectAll=false;this.placeholder=intl.formatMessage({id:"select.multiPlaceholder",defaultMessage:"Make a selection",description:"Placeholder text. Use imperative"});this.searchPlaceholder=intl.formatMessage({id:"select.searchPlaceholder",defaultMessage:"Search",description:"Placeholder text. Use imperative"});this.allSelectedMessage=intl.formatMessage({id:"select.allSelected",defaultMessage:"All selected",description:"Text displayed when all options are selected"});this.isExpanded=false;this.announcement=""}Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"selectedOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option")).filter((function(e){return e.selected}))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"allSelected",{get:function(){return this.childOptions.every((function(e){return e.selected}))},enumerable:false,configurable:true});e.prototype.handleOptionSelection=function(){if(!this.multiple){this.close()}};e.prototype.handleChildEnter=function(){this.close()};e.prototype.closePopupOnEscape=function(){this.close()};e.prototype.handleOptionBlur=function(e){if(!isElOrChild(this.el,e.detail.relatedTarget)){var t=new CustomEvent("blur");t.relatedTarget=e.detail.relatedTarget;this.el.dispatchEvent(t)}};e.prototype.handleClick=function(e){if(!isElOrChild(this.el,e.target)){this.close()}};e.prototype.handleButtonBlur=function(e){if(isElOrChild(this.el,e.relatedTarget)){e.stopPropagation()}};e.prototype.handleKey=function(e){switch(e.key){case"ArrowDown":if(this.isExpanded===false){e.preventDefault();this.open("next")}break;case"ArrowUp":if(this.isExpanded===false){e.preventDefault();this.open("previous")}break}};e.prototype.componentWillLoad=function(){var e=this;if(!this.label){console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).")}if(!this.multiple&&this.selectedOptions.length===0){console.error("wm-select should have one initial option selected")}handleDisabledAttribute(this.el,this.isDisabled);var t=new MutationObserver((function(t){return t.forEach((function(t){return e.handleChildChange(t)}))}));t.observe(this.el,{childList:true,attributes:true,subtree:true,attributeFilter:["selected"]})};e.prototype.handleChildChange=function(e){this.setButtonText();forceUpdate(this.el);this.optionListEl.handleChildChange(e)};e.prototype.componentDidLoad=function(){this.wmSelectDidLoad.emit();this.dropdownEl.classList.add("hidden");forceUpdate(this.el);if(this.maxHeight){this.dropdownEl.style.maxHeight=this.maxHeight}this.setButtonText()};e.prototype.open=function(e){var t=this;if(!this.isDisabled){var o=this.el.clientHeight;var r=this.buttonEl.clientHeight;this.openUp=shouldOpenUp(this.el,this.dropdownEl.clientHeight,o,r);this.isExpanded=true;this.dropdownEl.classList.remove("hidden");window.requestAnimationFrame((function(){t.optionListEl.handleInitialFocus(e)}))}};e.prototype.close=function(e){var t=this;if(e===void 0){e=true}if(this.isExpanded){this.isExpanded=false;this.optionListEl.unfocusAll();window.setTimeout((function(){t.dropdownEl.classList.add("hidden");if(t.optionListEl.multiple){t.optionListEl.updateOptionVisibility()}if(t.search){t.optionListEl.clearSearch()}if(e){t.buttonEl.focus()}}),150)}};e.prototype.announceError=function(){var e=this;if(this.errorMessage){setTimeout((function(){return e.announce(e.errorMessage)}),100)}};e.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};e.prototype.handleComponentBlur=function(e){if(!this.el.contains(e.relatedTarget)){this.close(false);this.wmSelectBlurred.emit()}};e.prototype.setButtonText=function(){this.displayedOptions=this.childOptions.filter((function(e){return e.selected}));if(this.multiple){var e=38;var t=window.getComputedStyle(this.buttonEl);var o=parseInt(t.getPropertyValue("padding-left").slice(0,-2));var r=parseInt(t.getPropertyValue("padding-right").slice(0,-2));var i=this.buttonEl.clientWidth-o-r-e;var n=this.displayedOptions.map((function(e){return e.shadowRoot.querySelector(".option-text").clientWidth}));var s=n.reduce((function(e,t){return e+t}),0);this.overflowCount=0;while(s>i&&this.displayedOptions.length>1){this.overflowCount++;s-=n[n.length-1];n.pop();this.displayedOptions.pop()}}};e.prototype.announce=function(e){if(this.liveRegionEl.textContent===e){e+=" "}this.announcement=e};e.prototype.renderButtonText=function(){if(this.multiple&&this.displayedOptions.length<1){return h("span",null,this.placeholder)}else if(this.multiple&&this.allSelected&&this.overflowCount>0){return this.allSelectedMessage}else{return this.displayedOptions.map((function(e,t){return h("span",null,t>0?", ":"",e.textContent)}))}};e.prototype.renderOverflowCount=function(){if(this.overflowCount>0&&!this.allSelected){return h("span",null,h("span",{class:"overflow-counter"},"+",this.overflowCount))}};e.prototype.render=function(){var e;var t=this;var o=!this.multiple&&this.selectedOptions.length>0&&this.selectedOptions[0].subinfo;var r=(e={id:"selectbtn"},e["disabled"]=this.isDisabled,e["aria-controls"]="list",e["aria-labelledby"]="label selectbtn",e["aria-describedby"]="error",e["aria-expanded"]=this.isExpanded?"true":"false",e.onClick=function(){return t.isExpanded?t.close():t.open()},e);return h(Host,{key:"6727670440a80bf148be78994a4267330cf31041",onBlur:function(e){return t.handleComponentBlur(e)}},h("div",{key:"89e88dc3eebb8bb4f05e7c97f4af145ea3b54833",class:"wrapper ".concat(getTextDir()," label-").concat(this.labelPosition," ").concat(this.errorMessage?"invalid":"")},h("div",{key:"4787f0142908caca775c018f77ad46bdd6a67f3f",class:"label-wrapper"},h("label",{key:"cd87e40ecf3ea2b5f992e58fedd355ffdc9f874e",class:"label",id:"label",htmlFor:"selectbtn"},this.label,this.requiredField?h("span",{class:"required"},h("span",{class:"sr-only"},globalMessages.requiredField),h("span",{"aria-hidden":"true"},"*")):"")),h("div",{key:"df831930e77365c19757b84c0763a25cba2f84de",class:"button-wrapper"},h("button",Object.assign({key:"aa97c1799c33eddc280daa3ca15cb081e50fa6fb"},r,{class:"displayedoption",ref:function(e){return t.buttonEl=e},onBlur:function(e){return t.handleButtonBlur(e)},onFocus:function(){return t.close()}}),h("span",{key:"d65f25aa5c016de5274f97dd74e21de8a2fd186e",class:"overflowcontrol ".concat(o?"hassubinfo":"")},h("span",{key:"357bbce813cc3fb53e7aadfd77e74876702bca79",class:"button-text"},this.renderButtonText()),o&&h("span",{key:"56c9af814adffc763ae57d9372df278ec3b39514",class:"subinfo"},this.selectedOptions[0].subinfo)),this.renderOverflowCount()),h("div",{key:"74851e76320c572355e331322ee7b6e0a597168e",class:"dropdown ".concat(this.isExpanded?"open":""," ").concat(this.openUp?"upwards":""),ref:function(e){return t.dropdownEl=e}},h("priv-option-list",{key:"1a8867c17c997f93c392b2e434062c5e26e1e36a",ref:function(e){return t.optionListEl=e},multiple:this.multiple,search:this.search,selectAll:this.selectAll,searchPlaceholder:this.searchPlaceholder,onOptionListCloseRequested:function(){return t.close()},onOptionListAllSelected:function(){return t.wmSelectAllSelected.emit()},onOptionListAllDeselected:function(){return t.wmSelectAllDeselected.emit()}},h("slot",{key:"7b7ff193b01aac95bf3d2a8412633bf8331a398d"}))),h("div",{key:"f7bb2724484488a25c3ca85a6634f1ea4ec00ba9",id:"error",class:this.errorMessage?"error-message":""},this.errorMessage),h("div",{key:"6170e8ac8a2c63e842cc35057b2da31ec6206f4e",id:"announcement","aria-live":"polite","aria-atomic":"true",class:"sr-only",ref:function(e){return t.liveRegionEl=e}},this.announcement))))};Object.defineProperty(e,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{errorMessage:["announceError"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return e}();Select.style=WmSelectStyle0;export{Option as wm_option,Select as wm_select};
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement,f as forceUpdate}from"./index-558b5a82.js";import{i as intl,t as toBool,z as isElOrChild,a as handleDisabledAttribute,k as shouldOpenUp,y as getTextDir}from"./functions-dea8b0f6.js";import{g as globalMessages}from"./intl-417d8b33.js";var wmOptionCss=':host(:not(:last-child)){border-bottom:2px solid;border-color:var(--wmcolor-select-option-border)}:host{display:block;cursor:pointer;position:relative;padding:1.25rem;background:var(--wmcolor-select-option-background);font-family:inherit;list-style:none;color:var(--wmcolor-select-option-text);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host:focus,:host.focus{outline:none;background:var(--wmcolor-select-option-background-focus)}:host.icon{color:var(--wmcolor-interactive)}: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}.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-block;margin-right:0.25rem;color:var(--wmcolor-interactive)}:host([aria-selected=true]){background:var(--wmcolor-select-option-background-selected);font-weight:500}:host([aria-selected=true]) .checkbox:before{content:"\\f132"}:host([aria-disabled=true]){color:var(--wmcolor-select-option-text-disabled);background:var(--wmcolor-select-option-background-disabled);cursor:default}:host([aria-disabled=true]) .checkbox:before{color:var(--wmcolor-select-option-text-disabled)}:host([aria-disabled=true]) .subinfo{color:var(--wmcolor-select-option-text-disabled)}:host(.multi-option){background:unset}:host(.clone.last){border-bottom:12px solid;border-color:var(--wmcolor-select-option-border)}:host(.hassubinfo){display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;gap:16px}:host(.hidden),:host(.filtered-out){display:none}.subinfo{font-style:italic}.option-wrapper{display:-ms-flexbox;display:flex}.option-text{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){outline:none;background:var(--wmcolor-select-option-background-hover)}:host(:hover){background:var(--wmcolor-select-option-background-hover);outline:none}';var Option=function(){function t(t){registerInstance(this,t);this.wmOptionSelected=createEvent(this,"wmOptionSelected",7);this.wmOptionDeselected=createEvent(this,"wmOptionDeselected",7);this.intCloneClicked=createEvent(this,"intCloneClicked",7);this.wmKeyUpPressed=createEvent(this,"wmKeyUpPressed",7);this.wmKeyDownPressed=createEvent(this,"wmKeyDownPressed",7);this.wmKeyLeftPressed=createEvent(this,"wmKeyLeftPressed",7);this.wmEscKeyPressed=createEvent(this,"wmEscKeyPressed",7);this.wmHomeKeyPressed=createEvent(this,"wmHomeKeyPressed",7);this.wmEndKeyPressed=createEvent(this,"wmEndKeyPressed",7);this.wmEnterKeyPressed=createEvent(this,"wmEnterKeyPressed",7);this.wmLetterPressed=createEvent(this,"wmLetterPressed",7);this.wmOptionBlurred=createEvent(this,"wmOptionBlurred",7);this.value=undefined;this.subinfo=undefined;this.disabled=false;this.selected=false;this.focused=false;this.searchTerm=""}Object.defineProperty(t.prototype,"hostClasses",{get:function(){var t=[];if(this.subinfo){t.push("hassubinfo")}if(this.parentOptionList.multiple){t.push("multi-option")}if(!this.el.textContent.toLowerCase().includes(this.searchTerm)){t.push("filtered-out")}return t.join(" ")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"parentOptionList",{get:function(){if(this.el.classList.contains("clone")){return this.el.closest("priv-option-list")}else{return this.el.assignedSlot.closest("priv-option-list")}},enumerable:false,configurable:true});t.prototype.handleKeydown=function(t){switch(t.key){case"ArrowUp":t.preventDefault();this.wmKeyUpPressed.emit(this.el);break;case"ArrowDown":t.preventDefault();this.wmKeyDownPressed.emit(this.el);break;case"Enter":t.preventDefault();if(!this.disabled){this.el.click();this.wmEnterKeyPressed.emit(this.el)}break;case"Escape":t.preventDefault();t.stopPropagation();this.wmEscKeyPressed.emit();break;case"Home":t.preventDefault();this.wmHomeKeyPressed.emit();break;case"End":t.preventDefault();this.wmEndKeyPressed.emit();break;case"ArrowLeft":t.preventDefault();this.wmKeyLeftPressed.emit(this.el);break;default:if(t.key.length===1){t.preventDefault();this.wmLetterPressed.emit({letter:t.key,optionEl:this.el})}}};t.prototype.handleSelection=function(){if(!this.disabled){if(this.el.classList.contains("clone")){this.intCloneClicked.emit(this.el)}else{if(this.parentOptionList.multiple){this.selected?this.wmOptionDeselected.emit(this.el):this.wmOptionSelected.emit(this.el)}else{this.wmOptionSelected.emit(this.el)}}}};t.prototype.handleBlur=function(t){this.wmOptionBlurred.emit({relatedTarget:t.relatedTarget})};t.prototype.syncAriaSelected=function(){this.selected?this.el.setAttribute("aria-selected","true"):this.el.setAttribute("aria-selected","false")};t.prototype.syncAriaDisabled=function(){this.disabled?this.el.setAttribute("aria-disabled","true"):this.el.removeAttribute("aria-disabled")};t.prototype.updateDisabledOnClick=function(){if(this.disabled&&this.el.onclick){this.onClickFunc=this.el.onclick;this.el.onclick=null}else if(!this.disabled&&this.onClickFunc){this.el.onclick=this.onClickFunc}};t.prototype.handleSearch=function(t){this.searchTerm=t.detail.searchTerm.toLowerCase();if(this.searchTerm&&this.el.textContent.toLowerCase().includes(this.searchTerm)){var e=this.el.textContent.toLowerCase().indexOf(this.searchTerm);var o=this.el.textContent.slice(0,e);var r=this.el.textContent.slice(e,e+this.searchTerm.length);var i=this.el.textContent.slice(e+this.searchTerm.length);var n=document.createElement("span");n.textContent=o;var s=document.createElement("strong");s.textContent=r;var a=document.createElement("span");a.textContent=i;this.textEl.innerHTML="";this.textEl.appendChild(n);this.textEl.appendChild(s);this.textEl.appendChild(a)}else{this.textEl.textContent=this.el.textContent}};t.prototype.componentWillLoad=function(){var t=this;this.syncAriaSelected();this.syncAriaDisabled();this.updateDisabledOnClick();this.parentOptionList.addEventListener("optionListSearchChanged",(function(e){return t.handleSearch(e)}))};t.prototype.render=function(){var t=this;return h(Host,{role:"option",tabindex:this.focused?0:-1,class:this.hostClasses},h("div",{class:"option-wrapper ".concat(this.parentOptionList.multiple?"checkbox":"")},h("span",{class:"option-text","aria-hidden":"true",ref:function(e){return t.textEl=e}},this.el.textContent),h("span",{class:"sr-only"},this.el.textContent)),h("div",{class:"subinfo"},this.subinfo))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{selected:["syncAriaSelected"],disabled:["syncAriaDisabled","updateDisabledOnClick"]}},enumerable:false,configurable:true});return t}();Option.style=wmOptionCss;var wmSelectCss=':host{--wmcolor-select-background:var(--wmcolor-background);--wmcolor-select-border:var(--wmcolor-input-border);--wmcolor-select-option-background-disabled:var(--wmcolor-option-background-disabled);--wmcolor-select-option-background-focus:var(--wmcolor-option-background-focus);--wmcolor-select-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-select-option-background-selected:var(--wmcolor-option-background-selected);--wmcolor-select-option-background:var(--wmcolor-option-background);--wmcolor-select-option-border:var(--wmcolor-option-border);--wmcolor-select-option-text-disabled:var(--wmcolor-option-text-disabled);--wmcolor-select-option-text:var(--wmcolor-option-text);--wmcolor-select-search-border:var(--wmcolor-input-border);--wmcolor-select-search-icon:var(--wmcolor-icon-accent);--wmcolor-select-searchresults-text:var(--wmcolor-text);--wmcolor-select-selectall-background:var(--wmcolor-select-option-background);--wmcolor-select-selectall-border:var(--wmcolor-select-option-border);--wmcolor-select-selectall-text:var(--wmcolor-interactive);--wmcolor-select-text:var(--wmcolor-interactive);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:var(--wmcolor-text-required)}.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:var(--wmcolor-text-error)}.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 .button-wrapper{position:relative;-ms-flex:1;flex:1;font-size:1.125rem;color:var(--wmcolor-select-text);min-width:8.75rem}.wrapper .button-wrapper .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:var(--wmcolor-select-background);width:100%;border:solid 1px;border-color:var(--wmcolor-select-border);padding:0 1.875rem 0 0.9375rem;cursor:pointer;height:2.5rem;line-height:normal;font-family:inherit;color:var(--wmcolor-select-text);font-weight:400;font-size:0.875rem;text-transform:none;text-align:left}@media only screen and (max-width: 768px){.wrapper .button-wrapper .displayedoption{height:2.75rem}}.wrapper .button-wrapper .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;font-size:1.12rem}.wrapper .button-wrapper .displayedoption:hover:not(:disabled):not(.-disabled):not(.-raised){background:var(--wmcolor-select-background);text-decoration:none}.wrapper .button-wrapper .displayedoption:active{-ms-transform:scale(1, 1) !important;-webkit-transform:scale(1, 1) !important;transform:scale(1, 1) !important}.wrapper .button-wrapper .displayedoption:focus{outline:none}.wrapper .button-wrapper .displayedoption::-moz-focus-inner{border:0}.wrapper .button-wrapper .displayedoption:focus-visible{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:2px}.wrapper .button-wrapper .displayedoption .overflowcontrol{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-flex:1;flex:1}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo{display:-ms-flexbox;display:flex}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .button-text{-ms-flex:1;flex:1;text-overflow:ellipsis;overflow:hidden;min-width:0}.wrapper .button-wrapper .displayedoption .overflowcontrol.hassubinfo .subinfo{-ms-flex:none;flex:none;font-style:italic}.wrapper .button-wrapper .displayedoption .overflow-counter{font-weight:bold;margin-left:0.5rem}.wrapper .button-wrapper>.displayedoption[disabled]{color:#6b6b6b;border-color:#8a8a8a;background:#f0f0f0;cursor:default}.wrapper .button-wrapper>.dropdown{-webkit-overflow-scrolling:touch;-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:var(--wmcolor-select-option-background);z-index:100;width:100%;font-size:0.875rem}.wrapper .button-wrapper>.dropdown.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 .button-wrapper>.dropdown.hidden{visibility:hidden}.wrapper .button-wrapper>.dropdown.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}.wrapper.invalid .button-wrapper .displayedoption{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}.wrapper .error-message{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-bottom:0.25rem;top:100%;left:0}.wrapper .error-message:not(:empty){margin-top:0.25rem}.options-wrapper{max-height:12.5rem;overflow:auto}.rtl>.dropdown{-ms-transform-origin:left top;-webkit-transform-origin:left top;-moz-transform-origin:left top;transform-origin:left top;left:0;right:auto}.rtl>.dropdown .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}';var Select=function(){function t(t){registerInstance(this,t);this.wmSelectDidLoad=createEvent(this,"wmSelectDidLoad",7);this.wmSelectBlurred=createEvent(this,"wmSelectBlurred",7);this.wmSelectAllSelected=createEvent(this,"wmSelectAllSelected",7);this.wmSelectAllDeselected=createEvent(this,"wmSelectAllDeselected",7);this.openUp=false;this.overflowCount=0;this.displayedOptions=[];this.disabled=false;this.maxHeight=undefined;this.label=undefined;this.labelPosition="top";this.requiredField=false;this.errorMessage=undefined;this.multiple=false;this.search=false;this.selectAll=false;this.placeholder=intl.formatMessage({id:"select.multiPlaceholder",defaultMessage:"Make a selection",description:"Placeholder text. Use imperative"});this.searchPlaceholder=intl.formatMessage({id:"select.searchPlaceholder",defaultMessage:"Search",description:"Placeholder text. Use imperative"});this.allSelectedMessage=intl.formatMessage({id:"select.allSelected",defaultMessage:"All selected",description:"Text displayed when all options are selected"});this.isExpanded=false;this.announcement=""}Object.defineProperty(t.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option"))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isDisabled",{get:function(){return toBool(this.disabled)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"selectedOptions",{get:function(){return Array.from(this.el.querySelectorAll("wm-option")).filter((function(t){return t.selected}))},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"allSelected",{get:function(){return this.childOptions.every((function(t){return t.selected}))},enumerable:false,configurable:true});t.prototype.handleOptionSelection=function(){if(!this.multiple){this.close()}};t.prototype.handleChildEnter=function(){this.close()};t.prototype.closePopupOnEscape=function(){this.close()};t.prototype.handleOptionBlur=function(t){if(!isElOrChild(this.el,t.detail.relatedTarget)){var e=new CustomEvent("blur");e.relatedTarget=t.detail.relatedTarget;this.el.dispatchEvent(e)}};t.prototype.handleClick=function(t){if(!isElOrChild(this.el,t.target)){this.close()}};t.prototype.handleButtonBlur=function(t){if(isElOrChild(this.el,t.relatedTarget)){t.stopPropagation()}};t.prototype.handleKey=function(t){switch(t.key){case"ArrowDown":if(this.isExpanded===false){t.preventDefault();this.open("next")}break;case"ArrowUp":if(this.isExpanded===false){t.preventDefault();this.open("previous")}break}};t.prototype.componentWillLoad=function(){var t=this;if(!this.label){console.error("For accessibility purposes, this component requires a label (even if `label-position` is set to `none`).")}if(!this.multiple&&this.selectedOptions.length===0){console.error("wm-select should have one initial option selected")}handleDisabledAttribute(this.el,this.isDisabled);var e=new MutationObserver((function(e){return e.forEach((function(e){return t.handleChildChange(e)}))}));e.observe(this.el,{childList:true,attributes:true,subtree:true,attributeFilter:["selected"]})};t.prototype.handleChildChange=function(t){this.setButtonText();forceUpdate(this.el);this.optionListEl.handleChildChange(t)};t.prototype.componentDidLoad=function(){this.wmSelectDidLoad.emit();this.dropdownEl.classList.add("hidden");forceUpdate(this.el);if(this.maxHeight){this.dropdownEl.style.maxHeight=this.maxHeight}this.setButtonText()};t.prototype.open=function(t){var e=this;if(!this.isDisabled){var o=this.el.clientHeight;var r=this.buttonEl.clientHeight;this.openUp=shouldOpenUp(this.el,this.dropdownEl.clientHeight,o,r);this.isExpanded=true;this.dropdownEl.classList.remove("hidden");window.requestAnimationFrame((function(){e.optionListEl.handleInitialFocus(t)}))}};t.prototype.close=function(t){var e=this;if(t===void 0){t=true}if(this.isExpanded){this.isExpanded=false;this.optionListEl.unfocusAll();window.setTimeout((function(){e.dropdownEl.classList.add("hidden");if(e.optionListEl.multiple){e.optionListEl.updateOptionVisibility()}if(e.search){e.optionListEl.clearSearch()}if(t){e.buttonEl.focus()}}),150)}};t.prototype.announceError=function(){var t=this;if(this.errorMessage){setTimeout((function(){return t.announce(t.errorMessage)}),100)}};t.prototype.handleDisabledChange=function(){handleDisabledAttribute(this.el,this.isDisabled)};t.prototype.handleComponentBlur=function(t){if(!this.el.contains(t.relatedTarget)){this.close(false);this.wmSelectBlurred.emit()}};t.prototype.setButtonText=function(){this.displayedOptions=this.childOptions.filter((function(t){return t.selected}));if(this.multiple){var t=38;var e=window.getComputedStyle(this.buttonEl);var o=parseInt(e.getPropertyValue("padding-left").slice(0,-2));var r=parseInt(e.getPropertyValue("padding-right").slice(0,-2));var i=this.buttonEl.clientWidth-o-r-t;var n=this.displayedOptions.map((function(t){return t.shadowRoot.querySelector(".option-text").clientWidth}));var s=n.reduce((function(t,e){return t+e}),0);this.overflowCount=0;while(s>i&&this.displayedOptions.length>1){this.overflowCount++;s-=n[n.length-1];n.pop();this.displayedOptions.pop()}}};t.prototype.announce=function(t){if(this.liveRegionEl.textContent===t){t+=" "}this.announcement=t};t.prototype.renderButtonText=function(){if(this.multiple&&this.displayedOptions.length<1){return h("span",null,this.placeholder)}else if(this.multiple&&this.allSelected&&this.overflowCount>0){return this.allSelectedMessage}else{return this.displayedOptions.map((function(t,e){return h("span",null,e>0?", ":"",t.textContent)}))}};t.prototype.renderOverflowCount=function(){if(this.overflowCount>0&&!this.allSelected){return h("span",null,h("span",{class:"overflow-counter"},"+",this.overflowCount))}};t.prototype.render=function(){var t;var e=this;var o=!this.multiple&&this.selectedOptions.length>0&&this.selectedOptions[0].subinfo;var r=(t={id:"selectbtn"},t["disabled"]=this.isDisabled,t["aria-controls"]="list",t["aria-labelledby"]="label selectbtn",t["aria-describedby"]="error",t["aria-expanded"]=this.isExpanded?"true":"false",t.onClick=function(){return e.isExpanded?e.close():e.open()},t);return h(Host,{onBlur:function(t){return e.handleComponentBlur(t)}},h("div",{class:"wrapper ".concat(getTextDir()," label-").concat(this.labelPosition," ").concat(this.errorMessage?"invalid":"")},h("div",{class:"label-wrapper"},h("label",{class:"label",id:"label",htmlFor:"selectbtn"},this.label,this.requiredField?h("span",{class:"required"},h("span",{class:"sr-only"},globalMessages.requiredField),h("span",{"aria-hidden":"true"},"*")):"")),h("div",{class:"button-wrapper"},h("button",Object.assign({},r,{class:"displayedoption",ref:function(t){return e.buttonEl=t},onBlur:function(t){return e.handleButtonBlur(t)},onFocus:function(){return e.close()}}),h("span",{class:"overflowcontrol ".concat(o?"hassubinfo":"")},h("span",{class:"button-text"},this.renderButtonText()),o&&h("span",{class:"subinfo"},this.selectedOptions[0].subinfo)),this.renderOverflowCount()),h("div",{class:"dropdown ".concat(this.isExpanded?"open":""," ").concat(this.openUp?"upwards":""),ref:function(t){return e.dropdownEl=t}},h("priv-option-list",{ref:function(t){return e.optionListEl=t},multiple:this.multiple,search:this.search,selectAll:this.selectAll,searchPlaceholder:this.searchPlaceholder,onOptionListCloseRequested:function(){return e.close()},onOptionListAllSelected:function(){return e.wmSelectAllSelected.emit()},onOptionListAllDeselected:function(){return e.wmSelectAllDeselected.emit()}},h("slot",null))),h("div",{id:"error",class:this.errorMessage?"error-message":""},this.errorMessage),h("div",{id:"announcement","aria-live":"polite","aria-atomic":"true",class:"sr-only",ref:function(t){return e.liveRegionEl=t}},this.announcement))))};Object.defineProperty(t,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{errorMessage:["announceError"],disabled:["handleDisabledChange"]}},enumerable:false,configurable:true});return t}();Select.style=wmSelectCss;export{Option as wm_option,Select as wm_select};
|