@ukic/web-components 3.0.0-alpha.2 → 3.0.0-alpha.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/core.cjs.js +1 -1
- package/dist/cjs/{helpers-f1cf5156.js → helpers-69219f14.js} +24 -1
- package/dist/cjs/helpers-69219f14.js.map +1 -0
- package/dist/cjs/ic-accordion-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ic-alert.cjs.entry.js +2 -2
- package/dist/cjs/ic-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
- package/dist/cjs/ic-badge.cjs.entry.js +1 -1
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js +2 -2
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-card-vertical.cjs.entry.js +1 -1
- package/dist/cjs/ic-checkbox-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-checkbox.cjs.entry.js +3 -3
- package/dist/cjs/ic-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-chip.cjs.entry.js +1 -1
- package/dist/cjs/ic-data-row.cjs.entry.js +1 -1
- package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ic-divider.cjs.entry.js +1 -1
- package/dist/cjs/ic-empty-state.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer.cjs.entry.js +1 -1
- package/dist/cjs/ic-hero.cjs.entry.js +1 -1
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js +446 -164
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-input-label_2.cjs.entry.js +8 -6
- package/dist/cjs/ic-input-label_2.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-menu-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-menu-item.cjs.entry.js +2 -2
- package/dist/cjs/ic-menu-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-button.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
- package/dist/cjs/ic-page-header.cjs.entry.js +5 -5
- package/dist/cjs/ic-page-header.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-pagination-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-pagination.cjs.entry.js +1 -1
- package/dist/cjs/ic-popover-menu.cjs.entry.js +9 -9
- package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-radio-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-radio-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-radio-option.cjs.entry.js +27 -22
- package/dist/cjs/ic-radio-option.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js +2 -2
- package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-select.cjs.entry.js +147 -37
- package/dist/cjs/ic-select.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
- package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
- package/dist/cjs/ic-step.cjs.entry.js +1 -1
- package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
- package/dist/cjs/ic-switch.cjs.entry.js +7 -4
- package/dist/cjs/ic-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab.cjs.entry.js +1 -1
- package/dist/cjs/ic-text-field.cjs.entry.js +2 -2
- package/dist/cjs/ic-text-field.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-theme.cjs.entry.js +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +1 -1
- package/dist/cjs/ic-toggle-button.cjs.entry.js +1 -1
- package/dist/cjs/ic-top-navigation.cjs.entry.js +1 -1
- package/dist/cjs/ic-top-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-typography.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ic-alert/ic-alert.css +3 -1
- package/dist/collection/components/ic-alert/ic-alert.js +1 -1
- package/dist/collection/components/ic-alert/ic-alert.js.map +1 -1
- package/dist/collection/components/ic-checkbox/ic-checkbox.css +5 -0
- package/dist/collection/components/ic-checkbox/ic-checkbox.js +1 -1
- package/dist/collection/components/ic-checkbox/ic-checkbox.js.map +1 -1
- package/dist/collection/components/ic-checkbox-group/ic-checkbox-group.js +1 -1
- package/dist/collection/components/ic-checkbox-group/ic-checkbox-group.js.map +1 -1
- package/dist/collection/components/ic-input-label/ic-input-label.css +1 -0
- package/dist/collection/components/ic-input-label/ic-input-label.js +45 -4
- package/dist/collection/components/ic-input-label/ic-input-label.js.map +1 -1
- package/dist/collection/components/ic-input-label/test/basic/ic-input-label.spec.js +35 -49
- package/dist/collection/components/ic-input-label/test/basic/ic-input-label.spec.js.map +1 -1
- package/dist/collection/components/ic-loading-indicator/ic-loading-indicator.css +1 -0
- package/dist/collection/components/ic-menu/ic-menu.css +70 -10
- package/dist/collection/components/ic-menu/ic-menu.js +485 -192
- package/dist/collection/components/ic-menu/ic-menu.js.map +1 -1
- package/dist/collection/components/ic-menu/test/basic/ic-menu.spec.js +381 -33
- package/dist/collection/components/ic-menu/test/basic/ic-menu.spec.js.map +1 -1
- package/dist/collection/components/ic-menu-group/ic-menu-group.css +2 -2
- package/dist/collection/components/ic-menu-item/ic-menu-item.css +32 -28
- package/dist/collection/components/ic-navigation-group/ic-navigation-group.css +1 -1
- package/dist/collection/components/ic-page-header/ic-page-header.css +5 -2
- package/dist/collection/components/ic-page-header/ic-page-header.js +3 -3
- package/dist/collection/components/ic-page-header/ic-page-header.js.map +1 -1
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.css +5 -5
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.js +31 -7
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.js.map +1 -1
- package/dist/collection/components/ic-radio-group/ic-radio-group.js +1 -1
- package/dist/collection/components/ic-radio-group/ic-radio-group.js.map +1 -1
- package/dist/collection/components/ic-radio-group/test/basic/ic-radio-group.spec.js +2 -2
- package/dist/collection/components/ic-radio-group/test/basic/ic-radio-group.spec.js.map +1 -1
- package/dist/collection/components/ic-radio-option/ic-radio-option.css +1 -0
- package/dist/collection/components/ic-radio-option/ic-radio-option.js +26 -21
- package/dist/collection/components/ic-radio-option/ic-radio-option.js.map +1 -1
- package/dist/collection/components/ic-search-bar/ic-search-bar.css +1 -0
- package/dist/collection/components/ic-select/ic-select.css +36 -16
- package/dist/collection/components/ic-select/ic-select.js +191 -43
- package/dist/collection/components/ic-select/ic-select.js.map +1 -1
- package/dist/collection/components/ic-select/test/basic/ic-select.spec.js +160 -1
- package/dist/collection/components/ic-select/test/basic/ic-select.spec.js.map +1 -1
- package/dist/collection/components/ic-switch/ic-switch.css +27 -30
- package/dist/collection/components/ic-switch/ic-switch.js +29 -2
- package/dist/collection/components/ic-switch/ic-switch.js.map +1 -1
- package/dist/collection/components/ic-text-field/ic-text-field.css +1 -0
- package/dist/collection/components/ic-top-navigation/ic-top-navigation.js.map +1 -1
- package/dist/collection/utils/helpers.js +20 -0
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/types.js.map +1 -1
- package/dist/components/helpers.js +22 -1
- package/dist/components/helpers.js.map +1 -1
- package/dist/components/ic-alert.js +1 -1
- package/dist/components/ic-alert.js.map +1 -1
- package/dist/components/ic-checkbox-group.js +1 -1
- package/dist/components/ic-checkbox-group.js.map +1 -1
- package/dist/components/ic-checkbox.js +2 -2
- package/dist/components/ic-checkbox.js.map +1 -1
- package/dist/components/ic-input-label2.js +10 -6
- package/dist/components/ic-input-label2.js.map +1 -1
- package/dist/components/ic-loading-indicator2.js +1 -1
- package/dist/components/ic-loading-indicator2.js.map +1 -1
- package/dist/components/ic-menu-group.js +1 -1
- package/dist/components/ic-menu-group.js.map +1 -1
- package/dist/components/ic-menu-item2.js +1 -1
- package/dist/components/ic-menu-item2.js.map +1 -1
- package/dist/components/ic-menu2.js +450 -167
- package/dist/components/ic-menu2.js.map +1 -1
- package/dist/components/ic-navigation-group.js +2 -2
- package/dist/components/ic-navigation-group.js.map +1 -1
- package/dist/components/ic-navigation-item.js +1 -1
- package/dist/components/ic-navigation-menu2.js +1 -1
- package/dist/components/ic-page-header.js +4 -4
- package/dist/components/ic-page-header.js.map +1 -1
- package/dist/components/ic-pagination-item2.js +1 -1
- package/dist/components/ic-popover-menu.js +9 -8
- package/dist/components/ic-popover-menu.js.map +1 -1
- package/dist/components/ic-radio-group.js +1 -1
- package/dist/components/ic-radio-group.js.map +1 -1
- package/dist/components/ic-radio-option.js +27 -22
- package/dist/components/ic-radio-option.js.map +1 -1
- package/dist/components/ic-search-bar.js +2 -2
- package/dist/components/ic-search-bar.js.map +1 -1
- package/dist/components/ic-select.js +148 -37
- package/dist/components/ic-select.js.map +1 -1
- package/dist/components/ic-side-navigation.js +1 -1
- package/dist/components/ic-stepper.js +1 -1
- package/dist/components/ic-switch.js +7 -3
- package/dist/components/ic-switch.js.map +1 -1
- package/dist/components/ic-text-field2.js +2 -2
- package/dist/components/ic-text-field2.js.map +1 -1
- package/dist/components/ic-theme.js +1 -1
- package/dist/components/ic-toast.js +1 -1
- package/dist/components/ic-top-navigation.js +1 -1
- package/dist/components/ic-top-navigation.js.map +1 -1
- package/dist/core/core.css +580 -10
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-d2f89cb5.entry.js → p-0395442c.entry.js} +2 -2
- package/dist/core/{p-244d6dba.entry.js → p-0d233b0c.entry.js} +2 -2
- package/dist/core/{p-f38bce8d.entry.js → p-134def81.entry.js} +2 -2
- package/dist/core/p-134def81.entry.js.map +1 -0
- package/dist/core/p-14dfd8db.entry.js +2 -0
- package/dist/core/p-14dfd8db.entry.js.map +1 -0
- package/dist/core/p-1b116dd1.entry.js +2 -0
- package/dist/core/p-1b116dd1.entry.js.map +1 -0
- package/dist/core/p-21cc87c0.entry.js +2 -0
- package/dist/core/p-21cc87c0.entry.js.map +1 -0
- package/dist/core/p-2eae9b27.entry.js +2 -0
- package/dist/core/p-2eae9b27.entry.js.map +1 -0
- package/dist/core/p-3618ac34.entry.js +2 -0
- package/dist/core/p-3618ac34.entry.js.map +1 -0
- package/dist/core/{p-355acffa.entry.js → p-37dea10d.entry.js} +2 -2
- package/dist/core/{p-bf1f0ac7.entry.js → p-384d454d.entry.js} +2 -2
- package/dist/core/p-384d454d.entry.js.map +1 -0
- package/dist/core/p-3d417eff.entry.js +2 -0
- package/dist/core/p-3d417eff.entry.js.map +1 -0
- package/dist/core/p-3d9726a3.entry.js +2 -0
- package/dist/core/{p-408344d3.entry.js.map → p-3d9726a3.entry.js.map} +1 -1
- package/dist/core/{p-84526c3e.entry.js → p-43256b7c.entry.js} +2 -2
- package/dist/core/{p-93c23a35.entry.js → p-4a3b1f06.entry.js} +2 -2
- package/dist/core/{p-34db8aaf.entry.js → p-5cd016e1.entry.js} +2 -2
- package/dist/core/{p-d2f8e03f.entry.js → p-5ef8e106.entry.js} +2 -2
- package/dist/core/{p-0a808ec3.entry.js → p-690c5e80.entry.js} +2 -2
- package/dist/core/{p-43f9a711.entry.js → p-6d3e4bb1.entry.js} +2 -2
- package/dist/core/{p-4055f22c.entry.js → p-726673ee.entry.js} +2 -2
- package/dist/core/p-726673ee.entry.js.map +1 -0
- package/dist/core/{p-fa1b7a80.entry.js → p-72d30c8a.entry.js} +2 -2
- package/dist/core/{p-f30f3a3e.entry.js → p-76263187.entry.js} +2 -2
- package/dist/core/{p-c86d48b6.entry.js → p-7827b5cb.entry.js} +2 -2
- package/dist/core/p-79d0be03.entry.js +2 -0
- package/dist/core/p-79d0be03.entry.js.map +1 -0
- package/dist/core/{p-c06a3b97.entry.js → p-7b35de65.entry.js} +2 -2
- package/dist/core/{p-1684c8d4.entry.js → p-7fbf2d3e.entry.js} +2 -2
- package/dist/core/p-91cf9b2b.entry.js +2 -0
- package/dist/core/p-91cf9b2b.entry.js.map +1 -0
- package/dist/core/{p-1b573920.entry.js → p-922984cb.entry.js} +2 -2
- package/dist/core/{p-aab2c7aa.entry.js → p-95f603dd.entry.js} +2 -2
- package/dist/core/{p-e4b276b5.entry.js → p-97fb2bdf.entry.js} +2 -2
- package/dist/core/p-ac4b7329.entry.js +2 -0
- package/dist/core/p-ac4b7329.entry.js.map +1 -0
- package/dist/core/{p-e3ed9110.entry.js → p-acbd15ab.entry.js} +2 -2
- package/dist/core/{p-6d40baa9.entry.js → p-b17c94b7.entry.js} +2 -2
- package/dist/core/p-b78f8b8c.entry.js +2 -0
- package/dist/core/p-b78f8b8c.entry.js.map +1 -0
- package/dist/core/{p-312cacae.js → p-b7eb8ef9.js} +2 -2
- package/dist/core/p-b7eb8ef9.js.map +1 -0
- package/dist/core/{p-363d6e88.entry.js → p-b95a72a3.entry.js} +2 -2
- package/dist/core/{p-21e5dd29.entry.js → p-b997064c.entry.js} +2 -2
- package/dist/core/{p-4ff6d16f.entry.js → p-ba6ecc15.entry.js} +2 -2
- package/dist/core/{p-0d30ffab.entry.js → p-c0fc3d02.entry.js} +2 -2
- package/dist/core/p-c396bd4d.entry.js +2 -0
- package/dist/core/p-c396bd4d.entry.js.map +1 -0
- package/dist/core/{p-f828a6e1.entry.js → p-c9cf932c.entry.js} +2 -2
- package/dist/core/{p-aa0619ce.entry.js → p-cf7db84a.entry.js} +2 -2
- package/dist/core/{p-d58a10ec.entry.js → p-dd36bf1b.entry.js} +2 -2
- package/dist/core/p-e488de54.entry.js +2 -0
- package/dist/core/p-e488de54.entry.js.map +1 -0
- package/dist/core/{p-da14cd3c.entry.js → p-e4d1839e.entry.js} +2 -2
- package/dist/core/{p-0fb047e7.entry.js → p-eb3b4935.entry.js} +2 -2
- package/dist/core/{p-0fb047e7.entry.js.map → p-eb3b4935.entry.js.map} +1 -1
- package/dist/core/{p-60efd7fa.entry.js → p-ebafab37.entry.js} +2 -2
- package/dist/core/{p-82375dca.entry.js → p-ee6dd94c.entry.js} +2 -2
- package/dist/core/{p-9dba6823.entry.js → p-f0fc1bf0.entry.js} +2 -2
- package/dist/core/{p-49525194.entry.js → p-f24984c5.entry.js} +2 -2
- package/dist/core/p-f24984c5.entry.js.map +1 -0
- package/dist/core/{p-d8870804.entry.js → p-f5b2b26d.entry.js} +2 -2
- package/dist/core/p-f60dbd0e.entry.js +2 -0
- package/dist/core/p-f60dbd0e.entry.js.map +1 -0
- package/dist/core/{p-40e9e76a.entry.js → p-f71c00ce.entry.js} +2 -2
- package/dist/core/{p-cbcd4427.entry.js → p-ff4298b1.entry.js} +2 -2
- package/dist/esm/core.js +1 -1
- package/dist/esm/{helpers-1c9151ef.js → helpers-e8797e8d.js} +23 -2
- package/dist/esm/helpers-e8797e8d.js.map +1 -0
- package/dist/esm/ic-accordion-group.entry.js +1 -1
- package/dist/esm/ic-accordion.entry.js +1 -1
- package/dist/esm/ic-alert.entry.js +2 -2
- package/dist/esm/ic-alert.entry.js.map +1 -1
- package/dist/esm/ic-back-to-top.entry.js +1 -1
- package/dist/esm/ic-badge.entry.js +1 -1
- package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
- package/dist/esm/ic-breadcrumb.entry.js +1 -1
- package/dist/esm/ic-button_3.entry.js +2 -2
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-card-vertical.entry.js +1 -1
- package/dist/esm/ic-checkbox-group.entry.js +2 -2
- package/dist/esm/ic-checkbox-group.entry.js.map +1 -1
- package/dist/esm/ic-checkbox.entry.js +3 -3
- package/dist/esm/ic-checkbox.entry.js.map +1 -1
- package/dist/esm/ic-chip.entry.js +1 -1
- package/dist/esm/ic-data-row.entry.js +1 -1
- package/dist/esm/ic-dialog.entry.js +1 -1
- package/dist/esm/ic-divider.entry.js +1 -1
- package/dist/esm/ic-empty-state.entry.js +1 -1
- package/dist/esm/ic-footer-link-group.entry.js +1 -1
- package/dist/esm/ic-footer-link.entry.js +1 -1
- package/dist/esm/ic-footer.entry.js +1 -1
- package/dist/esm/ic-hero.entry.js +1 -1
- package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
- package/dist/esm/ic-input-component-container_3.entry.js +446 -164
- package/dist/esm/ic-input-component-container_3.entry.js.map +1 -1
- package/dist/esm/ic-input-label_2.entry.js +8 -6
- package/dist/esm/ic-input-label_2.entry.js.map +1 -1
- package/dist/esm/ic-link.entry.js +1 -1
- package/dist/esm/ic-menu-group.entry.js +2 -2
- package/dist/esm/ic-menu-group.entry.js.map +1 -1
- package/dist/esm/ic-menu-item.entry.js +2 -2
- package/dist/esm/ic-menu-item.entry.js.map +1 -1
- package/dist/esm/ic-navigation-button.entry.js +1 -1
- package/dist/esm/ic-navigation-group.entry.js +2 -2
- package/dist/esm/ic-navigation-group.entry.js.map +1 -1
- package/dist/esm/ic-navigation-item.entry.js +1 -1
- package/dist/esm/ic-navigation-menu.entry.js +1 -1
- package/dist/esm/ic-page-header.entry.js +5 -5
- package/dist/esm/ic-page-header.entry.js.map +1 -1
- package/dist/esm/ic-pagination-item.entry.js +1 -1
- package/dist/esm/ic-pagination.entry.js +1 -1
- package/dist/esm/ic-popover-menu.entry.js +9 -9
- package/dist/esm/ic-popover-menu.entry.js.map +1 -1
- package/dist/esm/ic-radio-group.entry.js +2 -2
- package/dist/esm/ic-radio-group.entry.js.map +1 -1
- package/dist/esm/ic-radio-option.entry.js +27 -22
- package/dist/esm/ic-radio-option.entry.js.map +1 -1
- package/dist/esm/ic-search-bar.entry.js +2 -2
- package/dist/esm/ic-search-bar.entry.js.map +1 -1
- package/dist/esm/ic-select.entry.js +147 -37
- package/dist/esm/ic-select.entry.js.map +1 -1
- package/dist/esm/ic-side-navigation.entry.js +1 -1
- package/dist/esm/ic-status-tag.entry.js +1 -1
- package/dist/esm/ic-step.entry.js +1 -1
- package/dist/esm/ic-stepper.entry.js +1 -1
- package/dist/esm/ic-switch.entry.js +7 -4
- package/dist/esm/ic-switch.entry.js.map +1 -1
- package/dist/esm/ic-tab-group.entry.js +1 -1
- package/dist/esm/ic-tab-panel.entry.js +1 -1
- package/dist/esm/ic-tab.entry.js +1 -1
- package/dist/esm/ic-text-field.entry.js +2 -2
- package/dist/esm/ic-text-field.entry.js.map +1 -1
- package/dist/esm/ic-theme.entry.js +1 -1
- package/dist/esm/ic-toast.entry.js +1 -1
- package/dist/esm/ic-toggle-button.entry.js +1 -1
- package/dist/esm/ic-top-navigation.entry.js +1 -1
- package/dist/esm/ic-top-navigation.entry.js.map +1 -1
- package/dist/esm/ic-typography.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-alert/ic-alert.d.ts +1 -1
- package/dist/types/components/ic-input-label/ic-input-label.d.ts +8 -0
- package/dist/types/components/ic-menu/ic-menu.d.ts +43 -15
- package/dist/types/components/ic-popover-menu/ic-popover-menu.d.ts +5 -0
- package/dist/types/components/ic-radio-option/ic-radio-option.d.ts +3 -2
- package/dist/types/components/ic-select/ic-select.d.ts +24 -10
- package/dist/types/components/ic-switch/ic-switch.d.ts +5 -1
- package/dist/types/components.d.ts +66 -20
- package/dist/types/utils/helpers.d.ts +7 -0
- package/dist/types/utils/types.d.ts +1 -1
- package/hydrate/index.js +685 -255
- package/package.json +2 -2
- package/vscode-data.json +49 -7
- package/dist/cjs/helpers-f1cf5156.js.map +0 -1
- package/dist/core/p-0c872824.entry.js +0 -2
- package/dist/core/p-0c872824.entry.js.map +0 -1
- package/dist/core/p-1f1758a9.entry.js +0 -2
- package/dist/core/p-1f1758a9.entry.js.map +0 -1
- package/dist/core/p-312cacae.js.map +0 -1
- package/dist/core/p-322edabc.entry.js +0 -2
- package/dist/core/p-322edabc.entry.js.map +0 -1
- package/dist/core/p-4055f22c.entry.js.map +0 -1
- package/dist/core/p-408344d3.entry.js +0 -2
- package/dist/core/p-4502d3c1.entry.js +0 -2
- package/dist/core/p-4502d3c1.entry.js.map +0 -1
- package/dist/core/p-49525194.entry.js.map +0 -1
- package/dist/core/p-5deb9730.entry.js +0 -2
- package/dist/core/p-5deb9730.entry.js.map +0 -1
- package/dist/core/p-6bd2e938.entry.js +0 -2
- package/dist/core/p-6bd2e938.entry.js.map +0 -1
- package/dist/core/p-7c89fc86.entry.js +0 -2
- package/dist/core/p-7c89fc86.entry.js.map +0 -1
- package/dist/core/p-af20322c.entry.js +0 -2
- package/dist/core/p-af20322c.entry.js.map +0 -1
- package/dist/core/p-bf1f0ac7.entry.js.map +0 -1
- package/dist/core/p-d1c9c32b.entry.js +0 -2
- package/dist/core/p-d1c9c32b.entry.js.map +0 -1
- package/dist/core/p-dc83a0e9.entry.js +0 -2
- package/dist/core/p-dc83a0e9.entry.js.map +0 -1
- package/dist/core/p-de3a5423.entry.js +0 -2
- package/dist/core/p-de3a5423.entry.js.map +0 -1
- package/dist/core/p-e53309b0.entry.js +0 -2
- package/dist/core/p-e53309b0.entry.js.map +0 -1
- package/dist/core/p-f38bce8d.entry.js.map +0 -1
- package/dist/core/p-fa587e6d.entry.js +0 -2
- package/dist/core/p-fa587e6d.entry.js.map +0 -1
- package/dist/esm/helpers-1c9151ef.js.map +0 -1
- /package/dist/core/{p-d2f89cb5.entry.js.map → p-0395442c.entry.js.map} +0 -0
- /package/dist/core/{p-244d6dba.entry.js.map → p-0d233b0c.entry.js.map} +0 -0
- /package/dist/core/{p-355acffa.entry.js.map → p-37dea10d.entry.js.map} +0 -0
- /package/dist/core/{p-84526c3e.entry.js.map → p-43256b7c.entry.js.map} +0 -0
- /package/dist/core/{p-93c23a35.entry.js.map → p-4a3b1f06.entry.js.map} +0 -0
- /package/dist/core/{p-34db8aaf.entry.js.map → p-5cd016e1.entry.js.map} +0 -0
- /package/dist/core/{p-d2f8e03f.entry.js.map → p-5ef8e106.entry.js.map} +0 -0
- /package/dist/core/{p-0a808ec3.entry.js.map → p-690c5e80.entry.js.map} +0 -0
- /package/dist/core/{p-43f9a711.entry.js.map → p-6d3e4bb1.entry.js.map} +0 -0
- /package/dist/core/{p-fa1b7a80.entry.js.map → p-72d30c8a.entry.js.map} +0 -0
- /package/dist/core/{p-f30f3a3e.entry.js.map → p-76263187.entry.js.map} +0 -0
- /package/dist/core/{p-c86d48b6.entry.js.map → p-7827b5cb.entry.js.map} +0 -0
- /package/dist/core/{p-c06a3b97.entry.js.map → p-7b35de65.entry.js.map} +0 -0
- /package/dist/core/{p-1684c8d4.entry.js.map → p-7fbf2d3e.entry.js.map} +0 -0
- /package/dist/core/{p-1b573920.entry.js.map → p-922984cb.entry.js.map} +0 -0
- /package/dist/core/{p-aab2c7aa.entry.js.map → p-95f603dd.entry.js.map} +0 -0
- /package/dist/core/{p-e4b276b5.entry.js.map → p-97fb2bdf.entry.js.map} +0 -0
- /package/dist/core/{p-e3ed9110.entry.js.map → p-acbd15ab.entry.js.map} +0 -0
- /package/dist/core/{p-6d40baa9.entry.js.map → p-b17c94b7.entry.js.map} +0 -0
- /package/dist/core/{p-363d6e88.entry.js.map → p-b95a72a3.entry.js.map} +0 -0
- /package/dist/core/{p-21e5dd29.entry.js.map → p-b997064c.entry.js.map} +0 -0
- /package/dist/core/{p-4ff6d16f.entry.js.map → p-ba6ecc15.entry.js.map} +0 -0
- /package/dist/core/{p-0d30ffab.entry.js.map → p-c0fc3d02.entry.js.map} +0 -0
- /package/dist/core/{p-f828a6e1.entry.js.map → p-c9cf932c.entry.js.map} +0 -0
- /package/dist/core/{p-aa0619ce.entry.js.map → p-cf7db84a.entry.js.map} +0 -0
- /package/dist/core/{p-d58a10ec.entry.js.map → p-dd36bf1b.entry.js.map} +0 -0
- /package/dist/core/{p-da14cd3c.entry.js.map → p-e4d1839e.entry.js.map} +0 -0
- /package/dist/core/{p-60efd7fa.entry.js.map → p-ebafab37.entry.js.map} +0 -0
- /package/dist/core/{p-82375dca.entry.js.map → p-ee6dd94c.entry.js.map} +0 -0
- /package/dist/core/{p-9dba6823.entry.js.map → p-f0fc1bf0.entry.js.map} +0 -0
- /package/dist/core/{p-d8870804.entry.js.map → p-f5b2b26d.entry.js.map} +0 -0
- /package/dist/core/{p-40e9e76a.entry.js.map → p-f71c00ce.entry.js.map} +0 -0
- /package/dist/core/{p-cbcd4427.entry.js.map → p-ff4298b1.entry.js.map} +0 -0
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { h, Host, Fragment, } from "@stencil/core";
|
|
2
2
|
import { createPopper } from "@popperjs/core";
|
|
3
3
|
import Check from "../../assets/check-icon.svg";
|
|
4
|
-
import { onComponentRequiredPropUndefined } from "../../utils/helpers";
|
|
4
|
+
import { getOptionsWithoutGroupTitlesCount, isMacDevice, onComponentRequiredPropUndefined, } from "../../utils/helpers";
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
6
|
export class Menu {
|
|
7
7
|
constructor() {
|
|
8
|
+
this.ACTIVE_DESCENDANT = "aria-activedescendant";
|
|
9
|
+
this.CLEAR_BUTTON_ID = "clear-button";
|
|
8
10
|
this.disabledOptionSelected = false;
|
|
9
11
|
this.hasPreviouslyBlurred = false;
|
|
10
12
|
this.hasTimedOut = false;
|
|
11
13
|
this.isLoading = false;
|
|
14
|
+
this.isMultiSelect = false;
|
|
12
15
|
this.isSearchBar = false;
|
|
13
16
|
this.isSearchableSelect = false;
|
|
14
|
-
|
|
15
|
-
this.
|
|
17
|
+
this.lastOptionSelected = null; // Index of last option selected
|
|
18
|
+
this.lastOptionFocused = null; // Index of last option focused
|
|
19
|
+
this.multiOptionClicked = null;
|
|
20
|
+
this.preventClickOpen = false; // Prevents menu re-opening immediately after it is closed on blur when clicking input.
|
|
21
|
+
this.preventMenuFocus = false; // (When multiple) ensures focus moves straight to select all button from menu.
|
|
22
|
+
this.shiftPressed = false;
|
|
16
23
|
this.ungroupedOptions = [];
|
|
17
24
|
this.handleClearListener = () => {
|
|
18
25
|
this.optionHighlighted = "";
|
|
@@ -23,9 +30,16 @@ export class Menu {
|
|
|
23
30
|
};
|
|
24
31
|
this.handleMenuChange = (open, focusInput) => {
|
|
25
32
|
this.menuStateChange.emit({ open, focusInput });
|
|
26
|
-
if (!open
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
if (!open) {
|
|
34
|
+
if (focusInput !== false) {
|
|
35
|
+
this.inputEl.focus();
|
|
36
|
+
this.preventClickOpen = false;
|
|
37
|
+
}
|
|
38
|
+
// Reset optionHighlighted so previously highlighted option doesn't get reselected when Enter pressed
|
|
39
|
+
if (this.isMultiSelect) {
|
|
40
|
+
this.optionHighlighted = undefined;
|
|
41
|
+
this.multiOptionClicked = null;
|
|
42
|
+
}
|
|
29
43
|
}
|
|
30
44
|
};
|
|
31
45
|
this.setNextOptionValue = (selectedOptionIndex) => {
|
|
@@ -60,24 +74,34 @@ export class Menu {
|
|
|
60
74
|
if (parent.tagName === "IC-SEARCH-BAR") {
|
|
61
75
|
this.isSearchBar = true;
|
|
62
76
|
}
|
|
63
|
-
else if (parent.tagName === "IC-SELECT"
|
|
64
|
-
parent.getAttribute("searchable") !== null &&
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
else if (parent.tagName === "IC-SELECT") {
|
|
78
|
+
if (parent.getAttribute("searchable") !== null &&
|
|
79
|
+
parent.getAttribute("searchable") !== undefined) {
|
|
80
|
+
this.isSearchableSelect = true;
|
|
81
|
+
}
|
|
82
|
+
else if (parent.getAttribute("multiple") !== null &&
|
|
83
|
+
parent.getAttribute("multiple") !== undefined) {
|
|
84
|
+
this.isMultiSelect = true;
|
|
85
|
+
}
|
|
67
86
|
}
|
|
68
87
|
};
|
|
88
|
+
// Open menu when up or down arrow keys are pressed
|
|
69
89
|
this.arrowBehaviour = (event) => {
|
|
70
90
|
event.preventDefault();
|
|
71
91
|
this.handleMenuChange(true);
|
|
72
92
|
};
|
|
73
|
-
this.
|
|
93
|
+
this.getMenuOptions = () => this.isSearchBar ? this.options : this.ungroupedOptions;
|
|
94
|
+
// Set option that is focused and so should show focus state
|
|
74
95
|
this.setHighlightedOption = (highlightedIndex) => {
|
|
75
|
-
const menuOptions = this.
|
|
96
|
+
const menuOptions = this.getMenuOptions();
|
|
76
97
|
menuOptions[highlightedIndex] &&
|
|
77
98
|
!menuOptions[highlightedIndex].timedOut &&
|
|
78
99
|
(this.optionHighlighted =
|
|
79
100
|
menuOptions[highlightedIndex][this.valueField] || undefined);
|
|
80
101
|
};
|
|
102
|
+
// Determines keyboard behaviour when selection is automatic
|
|
103
|
+
// (i.e. you don't have to press Enter select an option - just focus on it)
|
|
104
|
+
// and menu is closed
|
|
81
105
|
this.autoSetInputValueKeyboardOpen = (event) => {
|
|
82
106
|
const selectedOptionIndex = this.ungroupedOptions.findIndex((option) => option[this.valueField] === this.value);
|
|
83
107
|
this.keyboardNav = false;
|
|
@@ -94,147 +118,278 @@ export class Menu {
|
|
|
94
118
|
break;
|
|
95
119
|
case " ":
|
|
96
120
|
case "Enter":
|
|
97
|
-
if (event.target.id !==
|
|
121
|
+
if (event.target.id !== this.CLEAR_BUTTON_ID) {
|
|
98
122
|
this.handleMenuChange(true);
|
|
99
123
|
}
|
|
100
124
|
break;
|
|
101
125
|
}
|
|
102
126
|
};
|
|
103
|
-
this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
127
|
+
this.selectHighlightedOption = (options, highlightedOptionIndex) => {
|
|
128
|
+
if (!this.isLoading && !this.hasTimedOut) {
|
|
129
|
+
this.keyboardNav = true;
|
|
130
|
+
}
|
|
107
131
|
const isOpen = this.isSearchBar || this.isSearchableSelect || this.open;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
else {
|
|
119
|
-
this.setHighlightedOption(0);
|
|
120
|
-
this.menuOptionId.emit({
|
|
121
|
-
optionId: getOptionId(0),
|
|
122
|
-
});
|
|
132
|
+
if (isOpen) {
|
|
133
|
+
if (highlightedOptionIndex >= 0) {
|
|
134
|
+
if (options[highlightedOptionIndex] !== undefined) {
|
|
135
|
+
if (this.isSearchBar &&
|
|
136
|
+
options[highlightedOptionIndex].disabled === true) {
|
|
137
|
+
this.disabledOptionSelected = true;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
this.setInputValue(highlightedOptionIndex);
|
|
141
|
+
}
|
|
123
142
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.setInputValue(highlightedOptionIndex);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.handleMenuChange(true);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
// Check if option is selected based on the index of the option
|
|
153
|
+
this.isOptionSelected = (index) => {
|
|
154
|
+
const menuOptions = this.getMenuOptions();
|
|
155
|
+
return this.value
|
|
156
|
+
? this.value.includes(menuOptions[index][this.valueField])
|
|
157
|
+
: false;
|
|
158
|
+
};
|
|
159
|
+
// Deselect currently selected options when shift pressed, but keep certain options selected
|
|
160
|
+
this.deselectSelectedOptions = (optionsToKeepSelected) => {
|
|
161
|
+
const menuOptions = this.getMenuOptions();
|
|
162
|
+
if (this.value) {
|
|
163
|
+
const selectedOptionIndexes = this.value.map((value) => {
|
|
164
|
+
return menuOptions.findIndex((option) => option[this.valueField] === value);
|
|
165
|
+
});
|
|
166
|
+
// Call setInputValue (which toggles the selected state) on options that need to be deselected
|
|
167
|
+
selectedOptionIndexes.forEach((index) => !optionsToKeepSelected.includes(index) && this.setInputValue(index));
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
// Determines keyboard behaviour when selection is manual (i.e. when you have to press Enter to select an option)
|
|
171
|
+
this.manualSetInputValueKeyboardOpen = (event) => {
|
|
172
|
+
const menuOptions = this.getMenuOptions();
|
|
173
|
+
// For preventing focus disappearing on currently focused option when Shift / Cmd / Ctrl pressed
|
|
174
|
+
// (i.e. when user is likely in the middle of executing a keyboard combination to select options)
|
|
175
|
+
const isKeyboardCombination = event.shiftKey || event.metaKey || event.ctrlKey;
|
|
176
|
+
const highlightedOptionIndex = this.getOptionHighlightedIndex();
|
|
177
|
+
const clickedMultiOptionIndex = menuOptions.findIndex((option) => option[this.valueField] === this.multiOptionClicked);
|
|
178
|
+
const getOptionId = (index) => { var _a; return (_a = Array.from(this.host.querySelectorAll("li"))[index]) === null || _a === void 0 ? void 0 : _a.id; };
|
|
179
|
+
// Space press should be equivalent to Enter when multi-select
|
|
180
|
+
if (event.key === " " && this.isMultiSelect) {
|
|
181
|
+
this.handleOptionSelect(event, highlightedOptionIndex);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
switch (event.key) {
|
|
185
|
+
case "ArrowDown":
|
|
186
|
+
this.keyboardNav = true;
|
|
187
|
+
this.arrowBehaviour(event);
|
|
188
|
+
if (this.multiOptionClicked) {
|
|
189
|
+
// Set focus to option last clicked
|
|
190
|
+
// Prevents it resetting to the top of the menu when user switches to using keyboard
|
|
191
|
+
this.setHighlightedOption(clickedMultiOptionIndex);
|
|
192
|
+
this.multiOptionClicked = null;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.handleSingleShiftSelect(event, highlightedOptionIndex, menuOptions);
|
|
196
|
+
if (highlightedOptionIndex < menuOptions.length - 1) {
|
|
197
|
+
this.setHighlightedOption(highlightedOptionIndex + 1);
|
|
198
|
+
this.menuOptionId.emit({
|
|
199
|
+
optionId: getOptionId(highlightedOptionIndex + 1),
|
|
200
|
+
});
|
|
201
|
+
this.handleSingleShiftSelect(event, highlightedOptionIndex + 1, menuOptions);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
this.setHighlightedOption(0);
|
|
205
|
+
this.menuOptionId.emit({
|
|
206
|
+
optionId: getOptionId(0),
|
|
207
|
+
});
|
|
208
|
+
this.handleSingleShiftSelect(event, 0, menuOptions);
|
|
209
|
+
}
|
|
210
|
+
// Deselect currently selected options if arrow was pressed for first time after shift is held
|
|
211
|
+
if (this.isMultiSelect && this.shiftPressed) {
|
|
212
|
+
this.deselectSelectedOptions([
|
|
213
|
+
highlightedOptionIndex,
|
|
214
|
+
this.getOptionHighlightedIndex(),
|
|
215
|
+
]);
|
|
216
|
+
this.shiftPressed = false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
this.lastOptionFocused = this.getOptionHighlightedIndex();
|
|
220
|
+
this.preventIncorrectTabOrder = false;
|
|
221
|
+
this.focusFromSearchKeypress = false;
|
|
222
|
+
break;
|
|
223
|
+
case "ArrowUp":
|
|
224
|
+
this.keyboardNav = true;
|
|
225
|
+
this.arrowBehaviour(event);
|
|
226
|
+
if (this.multiOptionClicked) {
|
|
227
|
+
// Set focus to option last clicked
|
|
228
|
+
// Prevents it resetting to the bottom of the menu when user switches to using keyboard
|
|
229
|
+
this.setHighlightedOption(clickedMultiOptionIndex);
|
|
230
|
+
this.multiOptionClicked = null;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
this.handleSingleShiftSelect(event, highlightedOptionIndex, menuOptions);
|
|
234
|
+
if (highlightedOptionIndex <= 0 ||
|
|
235
|
+
highlightedOptionIndex > menuOptions.length + 1) {
|
|
236
|
+
this.setHighlightedOption(menuOptions.length - 1);
|
|
237
|
+
this.menuOptionId.emit({
|
|
238
|
+
optionId: getOptionId(menuOptions.length - 1),
|
|
239
|
+
});
|
|
240
|
+
this.handleSingleShiftSelect(event, menuOptions.length - 1, menuOptions);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
this.setHighlightedOption(highlightedOptionIndex - 1);
|
|
244
|
+
this.menuOptionId.emit({
|
|
245
|
+
optionId: getOptionId(highlightedOptionIndex - 1),
|
|
246
|
+
});
|
|
247
|
+
this.handleSingleShiftSelect(event, highlightedOptionIndex - 1, menuOptions);
|
|
248
|
+
}
|
|
249
|
+
// Deselect currently selected options if arrow was pressed for first time after shift is held
|
|
250
|
+
if (this.isMultiSelect && this.shiftPressed) {
|
|
251
|
+
this.deselectSelectedOptions([
|
|
252
|
+
highlightedOptionIndex,
|
|
253
|
+
this.getOptionHighlightedIndex(),
|
|
254
|
+
]);
|
|
255
|
+
this.shiftPressed = false;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
this.lastOptionFocused = this.getOptionHighlightedIndex();
|
|
259
|
+
this.preventIncorrectTabOrder = false;
|
|
260
|
+
this.focusFromSearchKeypress = false;
|
|
261
|
+
break;
|
|
262
|
+
case "Home": {
|
|
263
|
+
const startOptionIndex = 0;
|
|
264
|
+
this.keyboardNav = true;
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
this.arrowBehaviour(event);
|
|
267
|
+
this.setHighlightedOption(startOptionIndex);
|
|
133
268
|
this.menuOptionId.emit({
|
|
134
|
-
optionId: getOptionId(
|
|
269
|
+
optionId: getOptionId(startOptionIndex),
|
|
135
270
|
});
|
|
271
|
+
if (event.shiftKey && event.ctrlKey) {
|
|
272
|
+
this.handleMultipleShiftSelect(startOptionIndex);
|
|
273
|
+
}
|
|
274
|
+
this.lastOptionFocused = startOptionIndex;
|
|
275
|
+
this.lastOptionSelected = startOptionIndex;
|
|
276
|
+
break;
|
|
136
277
|
}
|
|
137
|
-
|
|
138
|
-
|
|
278
|
+
case "End": {
|
|
279
|
+
const endOptionIndex = menuOptions.length - 1;
|
|
280
|
+
this.keyboardNav = true;
|
|
281
|
+
event.preventDefault();
|
|
282
|
+
this.arrowBehaviour(event);
|
|
283
|
+
this.setHighlightedOption(endOptionIndex);
|
|
139
284
|
this.menuOptionId.emit({
|
|
140
|
-
optionId: getOptionId(
|
|
285
|
+
optionId: getOptionId(endOptionIndex),
|
|
141
286
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.keyboardNav = true;
|
|
148
|
-
event.preventDefault();
|
|
149
|
-
this.arrowBehaviour(event);
|
|
150
|
-
this.setHighlightedOption(0);
|
|
151
|
-
this.menuOptionId.emit({
|
|
152
|
-
optionId: getOptionId(0),
|
|
153
|
-
});
|
|
154
|
-
break;
|
|
155
|
-
case "End":
|
|
156
|
-
this.keyboardNav = true;
|
|
157
|
-
event.preventDefault();
|
|
158
|
-
this.arrowBehaviour(event);
|
|
159
|
-
this.setHighlightedOption(menuOptions.length - 1);
|
|
160
|
-
this.menuOptionId.emit({
|
|
161
|
-
optionId: getOptionId(menuOptions.length - 1),
|
|
162
|
-
});
|
|
163
|
-
break;
|
|
164
|
-
case " ":
|
|
165
|
-
this.keyboardNav = false;
|
|
166
|
-
if (this.isSearchBar || this.isSearchableSelect) {
|
|
287
|
+
if (event.shiftKey && event.ctrlKey) {
|
|
288
|
+
this.handleMultipleShiftSelect(endOptionIndex);
|
|
289
|
+
}
|
|
290
|
+
this.lastOptionFocused = endOptionIndex;
|
|
291
|
+
this.lastOptionSelected = endOptionIndex;
|
|
167
292
|
break;
|
|
168
293
|
}
|
|
169
|
-
|
|
170
|
-
if (
|
|
171
|
-
this.
|
|
294
|
+
case " ":
|
|
295
|
+
if (!isKeyboardCombination) {
|
|
296
|
+
this.keyboardNav = false;
|
|
172
297
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
298
|
+
if (this.isSearchBar || this.isSearchableSelect) {
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
if (event.target.id !== this.CLEAR_BUTTON_ID) {
|
|
303
|
+
this.handleMenuChange(true);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
case "Enter":
|
|
308
|
+
event.preventDefault();
|
|
309
|
+
if (!isKeyboardCombination) {
|
|
310
|
+
this.keyboardNav = false;
|
|
311
|
+
}
|
|
312
|
+
this.handleOptionSelect(event, highlightedOptionIndex);
|
|
313
|
+
break;
|
|
314
|
+
case "Escape":
|
|
315
|
+
if (this.open) {
|
|
316
|
+
event.stopImmediatePropagation();
|
|
317
|
+
}
|
|
318
|
+
this.handleMenuChange(false);
|
|
319
|
+
this.menuOptionId.emit({ optionId: undefined });
|
|
320
|
+
break;
|
|
321
|
+
case "a":
|
|
322
|
+
// Checks if Cmd (meta) key is pressed if Mac device (while excluding meta key on Windows)
|
|
323
|
+
// Otherwise, if a different OS, checks Ctrl key
|
|
324
|
+
if ((isMacDevice() && event.metaKey) ||
|
|
325
|
+
(!isMacDevice() && event.ctrlKey)) {
|
|
326
|
+
this.emitSelectAll();
|
|
327
|
+
this.lastOptionFocused = null;
|
|
328
|
+
this.lastOptionSelected = null;
|
|
329
|
+
}
|
|
330
|
+
break;
|
|
331
|
+
case "Shift":
|
|
332
|
+
case "Tab":
|
|
333
|
+
if (event.key === "Shift") {
|
|
334
|
+
this.shiftPressed = true;
|
|
335
|
+
}
|
|
336
|
+
if (this.isSearchBar) {
|
|
337
|
+
this.keyboardNav = true;
|
|
338
|
+
}
|
|
339
|
+
if (this.isMultiSelect) {
|
|
340
|
+
if (this.open && !event.shiftKey && this.selectAllButton) {
|
|
341
|
+
event.preventDefault();
|
|
342
|
+
this.selectAllButton.focus(); // Move focus to select all button instead of focused option
|
|
343
|
+
this.preventMenuFocus = true;
|
|
344
|
+
this.preventClickOpen = true;
|
|
345
|
+
this.optionHighlighted = undefined; // Stop any option focus states showing when focus moved to select all button
|
|
190
346
|
}
|
|
191
347
|
}
|
|
192
348
|
else {
|
|
193
|
-
this.
|
|
349
|
+
this.preventIncorrectTabOrder = true;
|
|
194
350
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
event.stopImmediatePropagation();
|
|
203
|
-
}
|
|
204
|
-
this.handleMenuChange(false);
|
|
205
|
-
this.menuOptionId.emit({ optionId: undefined });
|
|
206
|
-
break;
|
|
207
|
-
case "Shift":
|
|
208
|
-
case "Tab":
|
|
209
|
-
if (this.isSearchBar) {
|
|
210
|
-
this.keyboardNav = true;
|
|
211
|
-
}
|
|
212
|
-
this.preventIncorrectTabOrder = true;
|
|
213
|
-
break;
|
|
214
|
-
default:
|
|
215
|
-
this.keyboardNav = false;
|
|
216
|
-
this.focusOnSearchOrSelectInput(menuOptions, highlightedOptionIndex);
|
|
217
|
-
break;
|
|
351
|
+
break;
|
|
352
|
+
default:
|
|
353
|
+
if (!isKeyboardCombination) {
|
|
354
|
+
this.keyboardNav = false;
|
|
355
|
+
}
|
|
356
|
+
this.focusOnSearchOrSelectInput(menuOptions, highlightedOptionIndex);
|
|
357
|
+
}
|
|
218
358
|
}
|
|
219
359
|
};
|
|
220
360
|
this.setInputValue = (highlightedOptionIndex) => {
|
|
221
|
-
const menuOptions = this.
|
|
361
|
+
const menuOptions = this.getMenuOptions();
|
|
222
362
|
if (menuOptions[highlightedOptionIndex] !== undefined) {
|
|
223
363
|
this.menuOptionSelect.emit({
|
|
224
364
|
value: menuOptions[highlightedOptionIndex][this.valueField],
|
|
225
365
|
});
|
|
226
|
-
this.
|
|
227
|
-
|
|
366
|
+
if (this.closeOnSelect) {
|
|
367
|
+
this.optionHighlighted = undefined;
|
|
368
|
+
this.menuOptionId.emit({ optionId: undefined });
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (this.closeOnSelect) {
|
|
372
|
+
if (!this.hasTimedOut) {
|
|
373
|
+
this.handleMenuChange(false);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
this.parentEl.setFocus();
|
|
377
|
+
}
|
|
228
378
|
}
|
|
229
|
-
if (!this.hasTimedOut)
|
|
230
|
-
this.handleMenuChange(false);
|
|
231
|
-
else
|
|
232
|
-
this.parentEl.setFocus();
|
|
233
379
|
};
|
|
234
380
|
this.handleOptionClick = (event) => {
|
|
235
381
|
const { value, label } = event.target.dataset;
|
|
236
|
-
this.
|
|
237
|
-
|
|
382
|
+
if (this.isMultiSelect) {
|
|
383
|
+
const menuOptions = this.getMenuOptions();
|
|
384
|
+
const selectedOptionIndex = menuOptions.findIndex((option) => option.value === value);
|
|
385
|
+
this.handleOptionSelect(event, selectedOptionIndex, true);
|
|
386
|
+
this.multiOptionClicked = value;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
this.menuOptionSelect.emit({ value, label });
|
|
390
|
+
this.handleMenuChange(false);
|
|
391
|
+
}
|
|
392
|
+
this.optionHighlighted = undefined;
|
|
238
393
|
};
|
|
239
394
|
this.handleRetry = () => {
|
|
240
395
|
this.retryButtonClicked.emit({ value: this.value });
|
|
@@ -247,13 +402,23 @@ export class Menu {
|
|
|
247
402
|
};
|
|
248
403
|
this.handleBlur = (event) => {
|
|
249
404
|
if (event.relatedTarget !== this.inputEl) {
|
|
250
|
-
if (
|
|
405
|
+
if (event.relatedTarget === this.selectAllButton) {
|
|
406
|
+
this.menu.removeAttribute(this.ACTIVE_DESCENDANT);
|
|
407
|
+
}
|
|
408
|
+
if (!(this.menu.contains(event.relatedTarget) ||
|
|
409
|
+
event.relatedTarget === this.selectAllButton)) {
|
|
251
410
|
this.handleMenuChange(false, this.hasPreviouslyBlurred);
|
|
411
|
+
this.menu.removeAttribute(this.ACTIVE_DESCENDANT);
|
|
412
|
+
this.lastOptionFocused = null;
|
|
413
|
+
this.lastOptionSelected = null;
|
|
252
414
|
}
|
|
253
415
|
}
|
|
254
416
|
else {
|
|
255
417
|
this.handleMenuChange(false);
|
|
256
418
|
this.preventClickOpen = true;
|
|
419
|
+
this.menu.removeAttribute(this.ACTIVE_DESCENDANT);
|
|
420
|
+
this.lastOptionFocused = null;
|
|
421
|
+
this.lastOptionSelected = null;
|
|
257
422
|
}
|
|
258
423
|
if (!this.isSearchBar)
|
|
259
424
|
this.hasPreviouslyBlurred = !!event.relatedTarget;
|
|
@@ -266,12 +431,109 @@ export class Menu {
|
|
|
266
431
|
this.autoSetValueOnMenuKeyDown(event);
|
|
267
432
|
}
|
|
268
433
|
else if (this.activationType === "manual" && !this.isSearchBar) {
|
|
269
|
-
this.
|
|
434
|
+
this.manualSetInputValueKeyboardOpen(event);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
this.handleMenuKeyUp = (event) => {
|
|
438
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
439
|
+
this.preventClickOpen = false;
|
|
270
440
|
}
|
|
441
|
+
if (event.key === "Enter" && this.disabledOptionSelected) {
|
|
442
|
+
this.disabledOptionSelected = false;
|
|
443
|
+
event.stopImmediatePropagation();
|
|
444
|
+
}
|
|
445
|
+
if (event.key === "Shift") {
|
|
446
|
+
this.shiftPressed = false;
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
this.handleSelectAllClick = () => {
|
|
450
|
+
this.keyboardNav = false;
|
|
451
|
+
this.menu.focus();
|
|
452
|
+
this.emitSelectAll();
|
|
453
|
+
this.lastOptionFocused = null;
|
|
454
|
+
this.lastOptionSelected = null;
|
|
455
|
+
};
|
|
456
|
+
this.handleSelectAllBlur = (event) => {
|
|
457
|
+
this.host.classList.remove("ic-select-select-all-focused");
|
|
458
|
+
if (!this.menu.contains(event.relatedTarget)) {
|
|
459
|
+
this.handleMenuChange(false, false);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
this.handleSelectAllFocus = () => {
|
|
463
|
+
this.host.classList.add("ic-select-select-all-focused");
|
|
464
|
+
this.lastOptionFocused = null;
|
|
465
|
+
this.lastOptionSelected = null;
|
|
466
|
+
};
|
|
467
|
+
// Fix for Safari - select all button click was causing menu to close
|
|
468
|
+
this.handleSelectAllMouseDown = (event) => {
|
|
469
|
+
event.preventDefault();
|
|
470
|
+
};
|
|
471
|
+
// When shift key is being used to select contiguous options one by one on a multi-select
|
|
472
|
+
// I.e. holding shift and pressing up and down arrow keys
|
|
473
|
+
this.handleSingleShiftSelect = (event, optionToSelectIndex, options) => {
|
|
474
|
+
if (this.isMultiSelect &&
|
|
475
|
+
event.shiftKey &&
|
|
476
|
+
!this.isOptionSelected(optionToSelectIndex)) {
|
|
477
|
+
this.selectHighlightedOption(options, optionToSelectIndex);
|
|
478
|
+
this.lastOptionSelected = optionToSelectIndex;
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
// When shift key is being used to select multiple options at once on a multi-select
|
|
482
|
+
// I.e. holding shift when selecting another option
|
|
483
|
+
this.handleMultipleShiftSelect = (lastOptionInSelection, useFocusForSelection = false, firstOptionSelected = null) => {
|
|
484
|
+
this.shiftPressed = false;
|
|
485
|
+
const firstOptionInSelection = firstOptionSelected === null
|
|
486
|
+
? this.getFirstOptionInSelection(useFocusForSelection)
|
|
487
|
+
: firstOptionSelected;
|
|
488
|
+
if (firstOptionInSelection !== null) {
|
|
489
|
+
const optionsToSelect = [];
|
|
490
|
+
if (firstOptionInSelection < lastOptionInSelection) {
|
|
491
|
+
for (let i = firstOptionInSelection; i < lastOptionInSelection + 1; i++) {
|
|
492
|
+
optionsToSelect.push(i);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
for (let i = firstOptionInSelection; i > lastOptionInSelection - 1; i--) {
|
|
497
|
+
optionsToSelect.push(i);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
optionsToSelect.forEach((optionIndex) => !this.isOptionSelected(optionIndex) && this.setInputValue(optionIndex));
|
|
501
|
+
this.deselectSelectedOptions(optionsToSelect);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
this.handleOptionSelect = (event, optionIndex, useFocusForSelection = false) => {
|
|
505
|
+
const menuOptions = this.getMenuOptions();
|
|
506
|
+
const firstOptionInSelection = this.getFirstOptionInSelection(useFocusForSelection);
|
|
507
|
+
if (event.shiftKey && firstOptionInSelection !== null) {
|
|
508
|
+
this.handleMultipleShiftSelect(optionIndex, useFocusForSelection, firstOptionInSelection);
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
this.selectHighlightedOption(menuOptions, optionIndex);
|
|
512
|
+
}
|
|
513
|
+
this.lastOptionFocused = optionIndex;
|
|
514
|
+
this.lastOptionSelected = optionIndex;
|
|
515
|
+
};
|
|
516
|
+
this.getFirstOptionInSelection = (useFocusForSelection) => {
|
|
517
|
+
return useFocusForSelection && this.lastOptionFocused !== null
|
|
518
|
+
? this.lastOptionFocused
|
|
519
|
+
: this.lastOptionSelected !== null
|
|
520
|
+
? this.lastOptionSelected
|
|
521
|
+
: null;
|
|
522
|
+
};
|
|
523
|
+
this.emitSelectAll = () => {
|
|
524
|
+
var _a;
|
|
525
|
+
// Select all if there is either no value or not all options are selected
|
|
526
|
+
// 'true' means select all, 'false' means clear all
|
|
527
|
+
this.menuOptionSelectAll.emit({
|
|
528
|
+
select: !this.value || !(((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === this.ungroupedOptions.length),
|
|
529
|
+
});
|
|
271
530
|
};
|
|
272
531
|
this.emitMenuKeyPress = (isNavKey, key) => {
|
|
273
532
|
this.menuKeyPress.emit({ isNavKey: isNavKey, key: key });
|
|
274
533
|
};
|
|
534
|
+
// Determines keyboard behaviour when selection is automatic
|
|
535
|
+
// (i.e. you don't have to press Enter select an option - just focus on it)
|
|
536
|
+
// and menu is focused
|
|
275
537
|
this.autoSetValueOnMenuKeyDown = (event) => {
|
|
276
538
|
event.cancelBubble = true;
|
|
277
539
|
const selectedOptionIndex = this.ungroupedOptions.findIndex((option) => option[this.valueField] === this.value);
|
|
@@ -331,15 +593,6 @@ export class Menu {
|
|
|
331
593
|
}
|
|
332
594
|
this.emitMenuKeyPress(this.keyboardNav, event.key);
|
|
333
595
|
};
|
|
334
|
-
this.handleMenuKeyUp = (event) => {
|
|
335
|
-
if (event.key === "Tab" && event.shiftKey) {
|
|
336
|
-
this.preventClickOpen = false;
|
|
337
|
-
}
|
|
338
|
-
if (event.key === "Enter" && this.disabledOptionSelected) {
|
|
339
|
-
this.disabledOptionSelected = false;
|
|
340
|
-
event.stopImmediatePropagation();
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
596
|
this.getOptionId = (value) => {
|
|
344
597
|
return `${this.menuId}-${value}`;
|
|
345
598
|
};
|
|
@@ -365,6 +618,10 @@ export class Menu {
|
|
|
365
618
|
}
|
|
366
619
|
return sorted;
|
|
367
620
|
};
|
|
621
|
+
this.getOptionHighlightedIndex = () => {
|
|
622
|
+
const menuOptions = this.getMenuOptions();
|
|
623
|
+
return menuOptions.findIndex((option) => option[this.valueField] === this.optionHighlighted);
|
|
624
|
+
};
|
|
368
625
|
this.isManualMode = this.activationType === "manual";
|
|
369
626
|
this.scrollToSelected = (menu) => {
|
|
370
627
|
const selectedOption = this.selectOnEnter
|
|
@@ -376,9 +633,14 @@ export class Menu {
|
|
|
376
633
|
elTop < menu.scrollTop + menu.offsetHeight) {
|
|
377
634
|
menu.scrollTop = selectedOption.offsetTop;
|
|
378
635
|
}
|
|
636
|
+
// 'aria-activedescendant' affects screen reader focus
|
|
637
|
+
// https://www.w3.org/TR/2017/WD-wai-aria-practices-1.1-20170628/#kbd_focus_activedescendant
|
|
638
|
+
this.menu.setAttribute(this.ACTIVE_DESCENDANT, selectedOption.id);
|
|
379
639
|
selectedOption.focus();
|
|
380
640
|
}
|
|
381
641
|
};
|
|
642
|
+
// Set 'ungroupedOptions' variable and emit its value
|
|
643
|
+
// - this is all the options with disabled options and group titles removed
|
|
382
644
|
this.loadUngroupedOptions = () => {
|
|
383
645
|
if (this.options.length > 0 && this.options.map) {
|
|
384
646
|
this.options.map((option) => {
|
|
@@ -405,21 +667,24 @@ export class Menu {
|
|
|
405
667
|
this.handleTimeoutBlur = (ev) => {
|
|
406
668
|
this.timeoutBlur.emit({ ev });
|
|
407
669
|
};
|
|
408
|
-
this.optionContent = (option) => {
|
|
409
|
-
|
|
410
|
-
return (h(Fragment, null, option.loading && h("ic-loading-indicator", { size: "icon" }), h("div", { class: "option-text-container" }, h("div", { class: "option-label" }, option.icon && (h("div", { class: "option-icon", innerHTML: option.icon, "aria-hidden": "true" })), h("ic-typography", { variant: "body", "aria-hidden": "true" }, option[this.labelField])), option.description && (h("ic-typography", { id: `${this.getOptionId(option[this.valueField])}-description`, class: "option-description", variant: "caption", "aria-hidden": "true" }, h("p", null, option.description))), option.element && (h("div", { class: "option-element", innerHTML: option.element.component, "aria-hidden": "true" }))), !!option[this.valueField] &&
|
|
670
|
+
this.optionContent = (option, selected) => {
|
|
671
|
+
const showCheckIcon = !!option[this.valueField] &&
|
|
411
672
|
!!this.value &&
|
|
412
|
-
|
|
413
|
-
this.parentEl.tagName !== "IC-SEARCH-BAR"
|
|
673
|
+
selected &&
|
|
674
|
+
this.parentEl.tagName !== "IC-SEARCH-BAR";
|
|
675
|
+
return (h(Fragment, null, option.loading && h("ic-loading-indicator", { size: "icon" }), h("div", { class: {
|
|
676
|
+
"option-text-container": true,
|
|
677
|
+
"show-check-icon": showCheckIcon,
|
|
678
|
+
} }, h("div", { class: "option-label" }, option.icon && (h("div", { class: "option-icon", innerHTML: option.icon, "aria-hidden": "true" })), h("ic-typography", { variant: "body", "aria-hidden": "true" }, option[this.labelField])), option.description && (h("ic-typography", { id: `${this.getOptionId(option[this.valueField])}-description`, class: "option-description", variant: "caption", "aria-hidden": "true" }, h("p", null, option.description))), option.element && (h("div", { class: "option-element", innerHTML: option.element.component, "aria-hidden": "true" }))), showCheckIcon && h("span", { class: "check-icon", innerHTML: Check })));
|
|
414
679
|
};
|
|
415
|
-
this.displayOption = (option, index, parentOption) => {
|
|
416
|
-
const { open,
|
|
680
|
+
this.displayOption = (option, selected, index, parentOption) => {
|
|
681
|
+
const { open, keyboardNav, isManualMode, initialOptionsListRender, optionHighlighted, options, } = this;
|
|
417
682
|
return (h("li", { id: this.getOptionId(option[this.valueField]), class: {
|
|
418
683
|
option: true,
|
|
419
684
|
"focused-option": isManualMode
|
|
420
685
|
? (keyboardNav || initialOptionsListRender) &&
|
|
421
686
|
option[this.valueField] === optionHighlighted
|
|
422
|
-
: keyboardNav &&
|
|
687
|
+
: keyboardNav && selected,
|
|
423
688
|
"last-recommended-option": option.recommended &&
|
|
424
689
|
options[index + 1] &&
|
|
425
690
|
!options[index + 1].recommended,
|
|
@@ -427,20 +692,21 @@ export class Menu {
|
|
|
427
692
|
"loading-option": option.loading,
|
|
428
693
|
timeout: option.timedOut,
|
|
429
694
|
}, role: "option", tabindex: open &&
|
|
430
|
-
(option[this.valueField] ===
|
|
431
|
-
option[this.valueField] === optionHighlighted) &&
|
|
695
|
+
(selected || option[this.valueField] === optionHighlighted) &&
|
|
432
696
|
keyboardNav
|
|
433
697
|
? "0"
|
|
434
|
-
: "-1", "aria-label": this.getOptionAriaLabel(option, parentOption), "aria-selected":
|
|
698
|
+
: "-1", "aria-label": this.getOptionAriaLabel(option, parentOption), "aria-selected": selected ? "true" : "false", "aria-disabled": option.disabled ? "true" : "false", onClick: !option.timedOut && !option.loading && this.handleOptionClick, onBlur: this.handleBlur, onMouseDown: this.handleMouseDown, "data-value": option[this.valueField], "data-label": option[this.labelField] }, option.timedOut ? (h(Fragment, null, h("div", { class: "loading-error-info" }, h("svg", { class: "error-icon-svg", "aria-labelledby": "error-title", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#000000" }, h("title", { id: "error-title" }, "Error"), h("g", { id: "close-octagon" }, h("path", { id: "Vector", d: "M8.77 3L3.5 8.27V15.73L8.77 21H16.23L21.5 15.73V8.27L16.23 3M8.91 7L12.5 10.59L16.09 7L17.5 8.41L13.91 12L17.5 15.59L16.09 17L12.5 13.41L8.91 17L7.5 15.59L11.09 12L7.5 8.41" }))), h("ic-typography", { variant: "label" }, option[this.labelField])), h("ic-button", { size: "small", variant: "tertiary", onClick: this.handleRetry, onKeyDown: this.handleRetryKeyDown, onBlur: this.handleTimeoutBlur, id: "retry-button" }, "Retry"))) : (this.optionContent(option, selected))));
|
|
435
699
|
};
|
|
436
700
|
this.focusFromSearchKeypress = false;
|
|
437
701
|
this.initialOptionsListRender = false;
|
|
438
702
|
this.keyboardNav = false;
|
|
439
703
|
this.optionHighlighted = undefined;
|
|
440
704
|
this.preventIncorrectTabOrder = false;
|
|
705
|
+
this.menuOptions = undefined;
|
|
441
706
|
this.activationType = "automatic";
|
|
442
707
|
this.anchorEl = undefined;
|
|
443
708
|
this.autoFocusOnSelected = true;
|
|
709
|
+
this.closeOnSelect = true;
|
|
444
710
|
this.fullWidth = false;
|
|
445
711
|
this.inputEl = undefined;
|
|
446
712
|
this.inputLabel = undefined;
|
|
@@ -467,9 +733,6 @@ export class Menu {
|
|
|
467
733
|
this.ungroupedOptions = [];
|
|
468
734
|
this.loadUngroupedOptions();
|
|
469
735
|
}
|
|
470
|
-
watchValueHandler() {
|
|
471
|
-
this.menuValueChange.emit({ value: this.value });
|
|
472
|
-
}
|
|
473
736
|
connectedCallback() {
|
|
474
737
|
this.getParentEl(this.parentEl);
|
|
475
738
|
if (this.isSearchBar) {
|
|
@@ -508,7 +771,7 @@ export class Menu {
|
|
|
508
771
|
}
|
|
509
772
|
componentDidUpdate() {
|
|
510
773
|
const inputValueInOptions = this.options.some((option) => option[this.valueField] === this.value);
|
|
511
|
-
if (this.open && this.options.length !== 0) {
|
|
774
|
+
if (this.open && this.options.length !== 0 && !this.preventMenuFocus) {
|
|
512
775
|
if (this.value &&
|
|
513
776
|
this.keyboardNav &&
|
|
514
777
|
inputValueInOptions &&
|
|
@@ -516,8 +779,7 @@ export class Menu {
|
|
|
516
779
|
!this.isSearchableSelect) {
|
|
517
780
|
this.scrollToSelected(this.menu);
|
|
518
781
|
}
|
|
519
|
-
else if (this.
|
|
520
|
-
this.inputEl.tagName !== "INPUT") {
|
|
782
|
+
else if (this.selectOnEnter) {
|
|
521
783
|
this.menu.focus();
|
|
522
784
|
}
|
|
523
785
|
else if (!!this.optionHighlighted &&
|
|
@@ -525,13 +787,19 @@ export class Menu {
|
|
|
525
787
|
!this.preventIncorrectTabOrder) {
|
|
526
788
|
const highlightedEl = this.host.querySelector(`li[data-value="${this.optionHighlighted}"]`);
|
|
527
789
|
if (highlightedEl) {
|
|
790
|
+
this.menu.setAttribute(this.ACTIVE_DESCENDANT, highlightedEl.id);
|
|
528
791
|
highlightedEl.focus();
|
|
529
792
|
}
|
|
530
793
|
}
|
|
794
|
+
else if (this.inputEl.tagName !== "IC-TEXT-FIELD" &&
|
|
795
|
+
this.inputEl.tagName !== "INPUT") {
|
|
796
|
+
this.menu.focus();
|
|
797
|
+
}
|
|
531
798
|
}
|
|
532
799
|
if (this.open && !this.value && this.selectOnEnter) {
|
|
533
800
|
this.scrollToSelected(this.menu);
|
|
534
801
|
}
|
|
802
|
+
this.preventMenuFocus = false;
|
|
535
803
|
}
|
|
536
804
|
componentDidRender() {
|
|
537
805
|
if (this.open && !this.popperInstance && this.anchorEl) {
|
|
@@ -561,7 +829,7 @@ export class Menu {
|
|
|
561
829
|
this.autoSetInputValueKeyboardOpen(event);
|
|
562
830
|
}
|
|
563
831
|
else {
|
|
564
|
-
this.
|
|
832
|
+
this.manualSetInputValueKeyboardOpen(event);
|
|
565
833
|
}
|
|
566
834
|
}
|
|
567
835
|
/**
|
|
@@ -576,8 +844,9 @@ export class Menu {
|
|
|
576
844
|
* boundary behaviour so sticking with PopperJS.
|
|
577
845
|
*/
|
|
578
846
|
async initPopperJs(anchor) {
|
|
847
|
+
// Placements set to "-start" to accommodate for custom menu width - menu should always be aligned to the left
|
|
579
848
|
this.popperInstance = createPopper(anchor, this.host, {
|
|
580
|
-
placement: "bottom",
|
|
849
|
+
placement: "bottom-start",
|
|
581
850
|
modifiers: [
|
|
582
851
|
{
|
|
583
852
|
name: "offset",
|
|
@@ -588,7 +857,7 @@ export class Menu {
|
|
|
588
857
|
{
|
|
589
858
|
name: "flip",
|
|
590
859
|
options: {
|
|
591
|
-
fallbackPlacements: ["top"],
|
|
860
|
+
fallbackPlacements: ["top-start"],
|
|
592
861
|
rootBoundary: "viewport",
|
|
593
862
|
},
|
|
594
863
|
},
|
|
@@ -610,24 +879,38 @@ export class Menu {
|
|
|
610
879
|
}
|
|
611
880
|
render() {
|
|
612
881
|
const { inputLabel, options, menuId, value, fullWidth, hasTimedOut, isLoading, size, open, inputEl, keyboardNav, } = this;
|
|
882
|
+
const selectAllButtonText = `${(value === null || value === void 0 ? void 0 : value.length) === this.ungroupedOptions.length ? "Clear" : "Select"} all`;
|
|
883
|
+
const hasNoResults = this.host.classList.contains("no-results");
|
|
613
884
|
return (h(Host, { class: {
|
|
614
885
|
"ic-menu-full-width": fullWidth,
|
|
615
886
|
"ic-menu-no-focus": (inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) === "INPUT" || hasTimedOut || isLoading,
|
|
616
887
|
[`ic-menu-${size}`]: true,
|
|
617
|
-
"ic-menu-open": open,
|
|
618
|
-
|
|
888
|
+
"ic-menu-open": open && options.length !== 0,
|
|
889
|
+
"ic-menu-multiple": this.isMultiSelect,
|
|
890
|
+
} }, options.length !== 0 && (h("ul", { id: menuId, class: "menu", role: "listbox", "aria-label": `${inputLabel} pop-up`, "aria-multiselectable": this.isMultiSelect ? "true" : "false", tabindex: open && !keyboardNav && (inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) !== "INPUT" ? "0" : "-1", ref: (el) => (this.menu = el), onKeyDown: this.handleMenuKeyDown, onKeyUp: this.handleMenuKeyUp, onBlur: this.handleBlur }, this.getSortedOptions(options).map((option, index) => {
|
|
619
891
|
if (option.children) {
|
|
620
892
|
if (option.children.length > 0) {
|
|
621
|
-
return (h("div", null, h("ic-typography", { class: "option-group-title", role: "presentation", variant: "subtitle-small" }, h("p", null, option[this.labelField])), option.children.map((childOption) =>
|
|
893
|
+
return (h("div", null, h("ic-typography", { class: "option-group-title", role: "presentation", variant: "subtitle-small" }, h("p", null, option[this.labelField])), option.children.map((childOption) => childOption.label &&
|
|
894
|
+
this.displayOption(childOption, this.isMultiSelect
|
|
895
|
+
? value === null || value === void 0 ? void 0 : value.includes(childOption[this.valueField])
|
|
896
|
+
: childOption[this.valueField] === value, index, option))));
|
|
622
897
|
}
|
|
623
898
|
else {
|
|
624
899
|
return null;
|
|
625
900
|
}
|
|
626
901
|
}
|
|
627
902
|
else {
|
|
628
|
-
|
|
903
|
+
// Display option only if it has a label (rather than displaying an empty space)
|
|
904
|
+
return (option.label &&
|
|
905
|
+
this.displayOption(option, this.isMultiSelect
|
|
906
|
+
? value === null || value === void 0 ? void 0 : value.includes(option[this.valueField])
|
|
907
|
+
: option[this.valueField] === value, index));
|
|
629
908
|
}
|
|
630
|
-
})))
|
|
909
|
+
}))), options.length !== 0 &&
|
|
910
|
+
this.isMultiSelect &&
|
|
911
|
+
!isLoading &&
|
|
912
|
+
!hasTimedOut &&
|
|
913
|
+
!hasNoResults && (h("div", { class: "option-bar" }, h("ic-typography", null, h("p", null, `${value ? value.length : 0}/${getOptionsWithoutGroupTitlesCount(this.options)} selected`)), h("ic-button", { class: "select-all-button", "aria-label": `${selectAllButtonText} options for ${inputLabel}`, ref: (el) => (this.selectAllButton = el), variant: "tertiary", onClick: this.handleSelectAllClick, onMouseDown: this.handleSelectAllMouseDown, onBlur: this.handleSelectAllBlur, onFocus: this.handleSelectAllFocus, size: size === "small" ? "small" : "medium" }, selectAllButtonText)))));
|
|
631
914
|
}
|
|
632
915
|
static get is() { return "ic-menu"; }
|
|
633
916
|
static get encapsulation() { return "scoped"; }
|
|
@@ -708,6 +991,24 @@ export class Menu {
|
|
|
708
991
|
"reflect": false,
|
|
709
992
|
"defaultValue": "true"
|
|
710
993
|
},
|
|
994
|
+
"closeOnSelect": {
|
|
995
|
+
"type": "boolean",
|
|
996
|
+
"mutable": false,
|
|
997
|
+
"complexType": {
|
|
998
|
+
"original": "boolean",
|
|
999
|
+
"resolved": "boolean",
|
|
1000
|
+
"references": {}
|
|
1001
|
+
},
|
|
1002
|
+
"required": false,
|
|
1003
|
+
"optional": false,
|
|
1004
|
+
"docs": {
|
|
1005
|
+
"tags": [],
|
|
1006
|
+
"text": "If `true`, the menu will close when an option is selected."
|
|
1007
|
+
},
|
|
1008
|
+
"attribute": "close-on-select",
|
|
1009
|
+
"reflect": false,
|
|
1010
|
+
"defaultValue": "true"
|
|
1011
|
+
},
|
|
711
1012
|
"fullWidth": {
|
|
712
1013
|
"type": "boolean",
|
|
713
1014
|
"mutable": false,
|
|
@@ -901,7 +1202,7 @@ export class Menu {
|
|
|
901
1202
|
"optional": true,
|
|
902
1203
|
"docs": {
|
|
903
1204
|
"tags": [],
|
|
904
|
-
"text": "The size of the menu
|
|
1205
|
+
"text": "The size of the menu."
|
|
905
1206
|
},
|
|
906
1207
|
"attribute": "size",
|
|
907
1208
|
"reflect": false,
|
|
@@ -930,17 +1231,17 @@ export class Menu {
|
|
|
930
1231
|
},
|
|
931
1232
|
"value": {
|
|
932
1233
|
"type": "string",
|
|
933
|
-
"mutable":
|
|
1234
|
+
"mutable": false,
|
|
934
1235
|
"complexType": {
|
|
935
|
-
"original": "string",
|
|
936
|
-
"resolved": "string",
|
|
1236
|
+
"original": "string | string[]",
|
|
1237
|
+
"resolved": "string | string[]",
|
|
937
1238
|
"references": {}
|
|
938
1239
|
},
|
|
939
1240
|
"required": true,
|
|
940
1241
|
"optional": false,
|
|
941
1242
|
"docs": {
|
|
942
1243
|
"tags": [],
|
|
943
|
-
"text": "The value of the currently selected option."
|
|
1244
|
+
"text": "The value of the currently selected option - or array of values (if multiple options allowed)."
|
|
944
1245
|
},
|
|
945
1246
|
"attribute": "value",
|
|
946
1247
|
"reflect": false
|
|
@@ -971,7 +1272,8 @@ export class Menu {
|
|
|
971
1272
|
"initialOptionsListRender": {},
|
|
972
1273
|
"keyboardNav": {},
|
|
973
1274
|
"optionHighlighted": {},
|
|
974
|
-
"preventIncorrectTabOrder": {}
|
|
1275
|
+
"preventIncorrectTabOrder": {},
|
|
1276
|
+
"menuOptions": {}
|
|
975
1277
|
};
|
|
976
1278
|
}
|
|
977
1279
|
static get events() {
|
|
@@ -984,7 +1286,7 @@ export class Menu {
|
|
|
984
1286
|
"docs": {
|
|
985
1287
|
"tags": [{
|
|
986
1288
|
"name": "internal",
|
|
987
|
-
"text": "Emitted when key is pressed while menu is open"
|
|
1289
|
+
"text": "Emitted when key is pressed while menu is open."
|
|
988
1290
|
}],
|
|
989
1291
|
"text": ""
|
|
990
1292
|
},
|
|
@@ -1002,7 +1304,7 @@ export class Menu {
|
|
|
1002
1304
|
"docs": {
|
|
1003
1305
|
"tags": [{
|
|
1004
1306
|
"name": "internal",
|
|
1005
|
-
"text": "Emitted when an option has been highlighted"
|
|
1307
|
+
"text": "Emitted when an option has been highlighted."
|
|
1006
1308
|
}],
|
|
1007
1309
|
"text": ""
|
|
1008
1310
|
},
|
|
@@ -1042,50 +1344,44 @@ export class Menu {
|
|
|
1042
1344
|
}
|
|
1043
1345
|
}
|
|
1044
1346
|
}, {
|
|
1045
|
-
"method": "
|
|
1046
|
-
"name": "
|
|
1347
|
+
"method": "menuOptionSelectAll",
|
|
1348
|
+
"name": "menuOptionSelectAll",
|
|
1047
1349
|
"bubbles": true,
|
|
1048
1350
|
"cancelable": true,
|
|
1049
1351
|
"composed": true,
|
|
1050
1352
|
"docs": {
|
|
1051
1353
|
"tags": [{
|
|
1052
1354
|
"name": "internal",
|
|
1053
|
-
"text": "Emitted when
|
|
1355
|
+
"text": "Emitted when all options are selected or deselected."
|
|
1054
1356
|
}],
|
|
1055
1357
|
"text": ""
|
|
1056
1358
|
},
|
|
1057
1359
|
"complexType": {
|
|
1058
|
-
"original": "
|
|
1059
|
-
"resolved": "
|
|
1060
|
-
"references": {
|
|
1061
|
-
"IcMenuChangeEventDetail": {
|
|
1062
|
-
"location": "import",
|
|
1063
|
-
"path": "./ic-menu.types",
|
|
1064
|
-
"id": "src/components/ic-menu/ic-menu.types.ts::IcMenuChangeEventDetail"
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1360
|
+
"original": "{ select: boolean }",
|
|
1361
|
+
"resolved": "{ select: boolean; }",
|
|
1362
|
+
"references": {}
|
|
1067
1363
|
}
|
|
1068
1364
|
}, {
|
|
1069
|
-
"method": "
|
|
1070
|
-
"name": "
|
|
1365
|
+
"method": "menuStateChange",
|
|
1366
|
+
"name": "menuStateChange",
|
|
1071
1367
|
"bubbles": true,
|
|
1072
1368
|
"cancelable": true,
|
|
1073
1369
|
"composed": true,
|
|
1074
1370
|
"docs": {
|
|
1075
1371
|
"tags": [{
|
|
1076
1372
|
"name": "internal",
|
|
1077
|
-
"text": "Emitted when menu
|
|
1373
|
+
"text": "Emitted when state of menu changes (i.e. open or closed)."
|
|
1078
1374
|
}],
|
|
1079
1375
|
"text": ""
|
|
1080
1376
|
},
|
|
1081
1377
|
"complexType": {
|
|
1082
|
-
"original": "
|
|
1083
|
-
"resolved": "
|
|
1378
|
+
"original": "IcMenuChangeEventDetail",
|
|
1379
|
+
"resolved": "IcMenuChangeEventDetail",
|
|
1084
1380
|
"references": {
|
|
1085
|
-
"
|
|
1381
|
+
"IcMenuChangeEventDetail": {
|
|
1086
1382
|
"location": "import",
|
|
1087
|
-
"path": "
|
|
1088
|
-
"id": "src/
|
|
1383
|
+
"path": "./ic-menu.types",
|
|
1384
|
+
"id": "src/components/ic-menu/ic-menu.types.ts::IcMenuChangeEventDetail"
|
|
1089
1385
|
}
|
|
1090
1386
|
}
|
|
1091
1387
|
}
|
|
@@ -1098,7 +1394,7 @@ export class Menu {
|
|
|
1098
1394
|
"docs": {
|
|
1099
1395
|
"tags": [{
|
|
1100
1396
|
"name": "internal",
|
|
1101
|
-
"text": "Emitted when the retry button is clicked"
|
|
1397
|
+
"text": "Emitted when the retry button is clicked."
|
|
1102
1398
|
}],
|
|
1103
1399
|
"text": ""
|
|
1104
1400
|
},
|
|
@@ -1122,7 +1418,7 @@ export class Menu {
|
|
|
1122
1418
|
"docs": {
|
|
1123
1419
|
"tags": [{
|
|
1124
1420
|
"name": "internal",
|
|
1125
|
-
"text": "Emitted when the timeout menu loses focus"
|
|
1421
|
+
"text": "Emitted when the timeout menu loses focus."
|
|
1126
1422
|
}],
|
|
1127
1423
|
"text": ""
|
|
1128
1424
|
},
|
|
@@ -1270,9 +1566,6 @@ export class Menu {
|
|
|
1270
1566
|
}, {
|
|
1271
1567
|
"propName": "options",
|
|
1272
1568
|
"methodName": "watchOptionsHandler"
|
|
1273
|
-
}, {
|
|
1274
|
-
"propName": "value",
|
|
1275
|
-
"methodName": "watchValueHandler"
|
|
1276
1569
|
}];
|
|
1277
1570
|
}
|
|
1278
1571
|
}
|