@six-group/ui-library 3.0.0-beta.1.7 → 3.0.0-beta.1.8
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/{event-listeners-4a8d66d5.js → event-listeners-74715e62.js} +38 -38
- package/dist/cjs/{execution-control-3bc9c7c4.js → execution-control-46f388e0.js} +35 -35
- package/dist/cjs/{focus-visible-b08d956f.js → focus-visible-0b352c74.js} +40 -40
- package/dist/cjs/{form-control-9e4dffd1.js → form-control-866bbece.js} +25 -25
- package/dist/cjs/{modal-a9679ddf.js → modal-48d42228.js} +41 -41
- package/dist/cjs/{popover-e3781f5a.js → popover-1d2a037c.js} +95 -95
- package/dist/cjs/{scroll-5b8676ba.js → scroll-76e6f5d7.js} +57 -57
- package/dist/cjs/set-attributes_2.cjs.entry.js +57 -57
- package/dist/cjs/six-alert.cjs.entry.js +131 -131
- package/dist/cjs/six-avatar.cjs.entry.js +28 -28
- package/dist/cjs/six-badge.cjs.entry.js +26 -26
- package/dist/cjs/six-button.cjs.entry.js +97 -97
- package/dist/cjs/six-card.cjs.entry.js +8 -8
- package/dist/cjs/six-checkbox.cjs.entry.js +152 -152
- package/dist/cjs/six-datepicker.cjs.entry.js +1189 -1189
- package/dist/cjs/six-details.cjs.entry.js +139 -139
- package/dist/cjs/six-dialog.cjs.entry.js +152 -152
- package/dist/cjs/six-drawer.cjs.entry.js +174 -174
- package/dist/cjs/six-dropdown_3.cjs.entry.js +728 -728
- package/dist/cjs/six-error-page.cjs.entry.js +94 -94
- package/dist/cjs/six-file-list-item.cjs.entry.js +38 -38
- package/dist/cjs/six-file-list.cjs.entry.js +8 -8
- package/dist/cjs/six-file-upload.cjs.entry.js +96 -96
- package/dist/cjs/six-footer.cjs.entry.js +8 -8
- package/dist/cjs/six-form.cjs.entry.js +219 -219
- package/dist/cjs/six-group-label.cjs.entry.js +46 -46
- package/dist/cjs/six-header.cjs.entry.js +149 -149
- package/dist/cjs/six-icon-button.cjs.entry.js +33 -33
- package/dist/cjs/six-icon.cjs.entry.js +24 -24
- package/dist/cjs/six-input.cjs.entry.js +230 -230
- package/dist/cjs/six-item-picker.cjs.entry.js +361 -361
- package/dist/cjs/six-language-switcher.cjs.entry.js +52 -52
- package/dist/cjs/six-layout-grid.cjs.entry.js +19 -19
- package/dist/cjs/six-main-container.cjs.entry.js +11 -11
- package/dist/cjs/six-menu-divider.cjs.entry.js +8 -8
- package/dist/cjs/six-menu-label.cjs.entry.js +8 -8
- package/dist/cjs/six-picto.cjs.entry.js +15 -15
- package/dist/cjs/six-progress-bar.cjs.entry.js +17 -17
- package/dist/cjs/six-progress-ring.cjs.entry.js +31 -31
- package/dist/cjs/six-radio.cjs.entry.js +121 -121
- package/dist/cjs/six-range.cjs.entry.js +198 -198
- package/dist/cjs/six-root.cjs.entry.js +34 -34
- package/dist/cjs/six-search-field.cjs.entry.js +43 -43
- package/dist/cjs/six-select.cjs.entry.js +447 -447
- package/dist/cjs/six-sidebar-item-group.cjs.entry.js +42 -42
- package/dist/cjs/six-sidebar-item.cjs.entry.js +18 -18
- package/dist/cjs/six-sidebar.cjs.entry.js +171 -171
- package/dist/cjs/six-spinner.cjs.entry.js +16 -16
- package/dist/cjs/six-switch.cjs.entry.js +100 -100
- package/dist/cjs/six-tab-group.cjs.entry.js +226 -226
- package/dist/cjs/six-tab-panel.cjs.entry.js +17 -17
- package/dist/cjs/six-tab.cjs.entry.js +42 -42
- package/dist/cjs/six-table-cell_4.cjs.entry.js +70 -70
- package/dist/cjs/six-table.cjs.entry.js +145 -145
- package/dist/cjs/six-tag.cjs.entry.js +40 -40
- package/dist/cjs/six-textarea.cjs.entry.js +211 -211
- package/dist/cjs/six-tile.cjs.entry.js +89 -89
- package/dist/cjs/six-timepicker.cjs.entry.js +489 -489
- package/dist/cjs/{six-timepicker.types-c58cc88b.js → six-timepicker.types-c19ebff3.js} +43 -43
- package/dist/cjs/six-tooltip.cjs.entry.js +172 -172
- package/dist/cjs/{slot-8abe833c.js → slot-ad537f24.js} +42 -42
- package/dist/cjs/{types-65e5c95b.js → types-581e8ff0.js} +12 -12
- package/dist/cjs/{types-0c28e484.js → types-64878648.js} +12 -12
- package/dist/collection/components/six-alert/six-alert.js +366 -366
- package/dist/collection/components/six-avatar/six-avatar.js +131 -131
- package/dist/collection/components/six-badge/six-badge.js +101 -101
- package/dist/collection/components/six-button/six-button.js +466 -466
- package/dist/collection/components/six-card/six-card.js +21 -21
- package/dist/collection/components/six-checkbox/six-checkbox.js +550 -550
- package/dist/collection/components/six-datepicker/components/day-selection.js +13 -13
- package/dist/collection/components/six-datepicker/components/month-selection.js +12 -12
- package/dist/collection/components/six-datepicker/components/year-selection.js +10 -10
- package/dist/collection/components/six-datepicker/six-date-formats.js +23 -23
- package/dist/collection/components/six-datepicker/six-datepicker.js +1343 -1343
- package/dist/collection/components/six-datepicker/test/six-datepicker.test-helpers.js +16 -16
- package/dist/collection/components/six-details/six-details.js +432 -432
- package/dist/collection/components/six-dialog/six-dialog.js +401 -401
- package/dist/collection/components/six-drawer/six-drawer.js +458 -458
- package/dist/collection/components/six-dropdown/six-dropdown.js +939 -939
- package/dist/collection/components/six-error-page/six-error-page.js +199 -199
- package/dist/collection/components/six-file-list/six-file-list.js +20 -20
- package/dist/collection/components/six-file-list-item/six-file-list-item.js +203 -203
- package/dist/collection/components/six-file-upload/six-file-upload.js +272 -272
- package/dist/collection/components/six-footer/six-footer.js +21 -21
- package/dist/collection/components/six-form/six-form.js +408 -408
- package/dist/collection/components/six-group-label/six-group-label.js +166 -166
- package/dist/collection/components/six-header/six-header.js +420 -420
- package/dist/collection/components/six-icon/six-icon.js +77 -77
- package/dist/collection/components/six-icon-button/six-icon-button.js +142 -142
- package/dist/collection/components/six-input/six-input.js +1141 -1141
- package/dist/collection/components/six-item-picker/six-item-picker.js +688 -688
- package/dist/collection/components/six-item-picker/types.js +13 -13
- package/dist/collection/components/six-language-switcher/six-language-switcher.js +128 -128
- package/dist/collection/components/six-layout-grid/six-layout-grid.js +52 -52
- package/dist/collection/components/six-main-container/six-main-container.js +53 -53
- package/dist/collection/components/six-menu/six-menu.js +406 -406
- package/dist/collection/components/six-menu-divider/six-menu-divider.js +22 -22
- package/dist/collection/components/six-menu-item/six-menu-item.js +177 -177
- package/dist/collection/components/six-menu-label/six-menu-label.js +25 -25
- package/dist/collection/components/six-picto/six-picto.js +50 -50
- package/dist/collection/components/six-progress-bar/six-progress-bar.js +77 -77
- package/dist/collection/components/six-progress-ring/six-progress-ring.js +111 -111
- package/dist/collection/components/six-radio/six-radio.js +410 -410
- package/dist/collection/components/six-range/six-range.js +620 -620
- package/dist/collection/components/six-root/six-root.js +167 -167
- package/dist/collection/components/six-search-field/six-search-field.js +171 -171
- package/dist/collection/components/six-select/six-select.js +1105 -1105
- package/dist/collection/components/six-sidebar/six-sidebar.js +455 -455
- package/dist/collection/components/six-sidebar-item/six-sidebar-item.js +89 -89
- package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.js +158 -158
- package/dist/collection/components/six-spinner/six-spinner.js +55 -55
- package/dist/collection/components/six-stage-indicator/six-stage-indicator.js +46 -46
- package/dist/collection/components/six-switch/six-switch.js +393 -393
- package/dist/collection/components/six-tab/six-tab.js +198 -198
- package/dist/collection/components/six-tab-group/six-tab-group.js +362 -362
- package/dist/collection/components/six-tab-panel/six-tab-panel.js +75 -75
- package/dist/collection/components/six-table/six-table.js +209 -209
- package/dist/collection/components/six-table/test/helpers.js +13 -13
- package/dist/collection/components/six-table/types.js +8 -8
- package/dist/collection/components/six-table/util/filter-by.js +34 -34
- package/dist/collection/components/six-table/util/from-data.js +33 -33
- package/dist/collection/components/six-table/util/is.js +3 -3
- package/dist/collection/components/six-table/util/quick-filter-by.js +13 -13
- package/dist/collection/components/six-table/util/sort-by.js +25 -25
- package/dist/collection/components/six-table-cell/six-table-cell.js +21 -21
- package/dist/collection/components/six-table-header/six-table-header.js +21 -21
- package/dist/collection/components/six-table-header-cell/get-next-state.js +7 -7
- package/dist/collection/components/six-table-header-cell/icons.js +12 -12
- package/dist/collection/components/six-table-header-cell/six-table-header-cell.js +174 -174
- package/dist/collection/components/six-table-header-cell/types.js +13 -13
- package/dist/collection/components/six-table-header-cell/util/create-model.js +6 -6
- package/dist/collection/components/six-table-header-cell/util/get-next-state.js +7 -7
- package/dist/collection/components/six-table-row/six-table-row.js +21 -21
- package/dist/collection/components/six-tag/six-tag.js +157 -157
- package/dist/collection/components/six-textarea/six-textarea.js +912 -912
- package/dist/collection/components/six-tile/six-tile.js +315 -315
- package/dist/collection/components/six-timepicker/six-time-format.js +14 -14
- package/dist/collection/components/six-timepicker/six-timepicker.js +980 -980
- package/dist/collection/components/six-timepicker/six-timepicker.types.js +40 -40
- package/dist/collection/components/six-tooltip/six-tooltip.js +435 -435
- package/dist/collection/functional-components/form-control/form-control.js +28 -28
- package/dist/collection/index.js +1 -1
- package/dist/collection/testUtil/delay.js +3 -3
- package/dist/collection/utils/as-array.js +1 -1
- package/dist/collection/utils/date-util.js +712 -712
- package/dist/collection/utils/event-listeners.js +39 -39
- package/dist/collection/utils/execution-control.js +38 -38
- package/dist/collection/utils/focus-visible.js +41 -41
- package/dist/collection/utils/matchers.js +2 -2
- package/dist/collection/utils/modal.js +28 -28
- package/dist/collection/utils/offset.js +13 -13
- package/dist/collection/utils/popover.js +113 -113
- package/dist/collection/utils/scroll.js +47 -47
- package/dist/collection/utils/slot.js +59 -59
- package/dist/collection/utils/support.js +15 -15
- package/dist/collection/utils/tabbable.js +22 -22
- package/dist/collection/utils/testing.js +38 -38
- package/dist/collection/utils/time.util.js +74 -74
- package/dist/collection/utils/type-check.js +5 -5
- package/dist/collection/utils/types.js +1 -1
- package/dist/collection/wrappers/set-attributes/set-attributes.js +68 -68
- package/dist/components.json +1 -1
- package/dist/custom-elements/index.js +7595 -7595
- package/dist/esm/{event-listeners-1bef934e.js → event-listeners-570a24ea.js} +38 -38
- package/dist/esm/{execution-control-235f5126.js → execution-control-1a60d709.js} +35 -35
- package/dist/esm/{focus-visible-4b7946aa.js → focus-visible-97933ea9.js} +40 -40
- package/dist/esm/{form-control-17478ad2.js → form-control-24f446af.js} +25 -25
- package/dist/esm/{modal-e5709f6b.js → modal-5ebdc320.js} +41 -41
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/{popover-5a51f84d.js → popover-1c7a1139.js} +95 -95
- package/dist/esm/{scroll-99b214c2.js → scroll-180b53fd.js} +57 -57
- package/dist/esm/set-attributes_2.entry.js +57 -57
- package/dist/esm/six-alert.entry.js +131 -131
- package/dist/esm/six-avatar.entry.js +28 -28
- package/dist/esm/six-badge.entry.js +26 -26
- package/dist/esm/six-button.entry.js +97 -97
- package/dist/esm/six-card.entry.js +8 -8
- package/dist/esm/six-checkbox.entry.js +152 -152
- package/dist/esm/six-datepicker.entry.js +1189 -1189
- package/dist/esm/six-details.entry.js +139 -139
- package/dist/esm/six-dialog.entry.js +152 -152
- package/dist/esm/six-drawer.entry.js +174 -174
- package/dist/esm/six-dropdown_3.entry.js +728 -728
- package/dist/esm/six-error-page.entry.js +94 -94
- package/dist/esm/six-file-list-item.entry.js +38 -38
- package/dist/esm/six-file-list.entry.js +8 -8
- package/dist/esm/six-file-upload.entry.js +96 -96
- package/dist/esm/six-footer.entry.js +8 -8
- package/dist/esm/six-form.entry.js +219 -219
- package/dist/esm/six-group-label.entry.js +46 -46
- package/dist/esm/six-header.entry.js +149 -149
- package/dist/esm/six-icon-button.entry.js +33 -33
- package/dist/esm/six-icon.entry.js +24 -24
- package/dist/esm/six-input.entry.js +230 -230
- package/dist/esm/six-item-picker.entry.js +361 -361
- package/dist/esm/six-language-switcher.entry.js +52 -52
- package/dist/esm/six-layout-grid.entry.js +19 -19
- package/dist/esm/six-main-container.entry.js +11 -11
- package/dist/esm/six-menu-divider.entry.js +8 -8
- package/dist/esm/six-menu-label.entry.js +8 -8
- package/dist/esm/six-picto.entry.js +15 -15
- package/dist/esm/six-progress-bar.entry.js +17 -17
- package/dist/esm/six-progress-ring.entry.js +31 -31
- package/dist/esm/six-radio.entry.js +121 -121
- package/dist/esm/six-range.entry.js +198 -198
- package/dist/esm/six-root.entry.js +34 -34
- package/dist/esm/six-search-field.entry.js +43 -43
- package/dist/esm/six-select.entry.js +447 -447
- package/dist/esm/six-sidebar-item-group.entry.js +42 -42
- package/dist/esm/six-sidebar-item.entry.js +18 -18
- package/dist/esm/six-sidebar.entry.js +171 -171
- package/dist/esm/six-spinner.entry.js +16 -16
- package/dist/esm/six-switch.entry.js +100 -100
- package/dist/esm/six-tab-group.entry.js +226 -226
- package/dist/esm/six-tab-panel.entry.js +17 -17
- package/dist/esm/six-tab.entry.js +42 -42
- package/dist/esm/six-table-cell_4.entry.js +70 -70
- package/dist/esm/six-table.entry.js +145 -145
- package/dist/esm/six-tag.entry.js +40 -40
- package/dist/esm/six-textarea.entry.js +211 -211
- package/dist/esm/six-tile.entry.js +89 -89
- package/dist/esm/six-timepicker.entry.js +489 -489
- package/dist/esm/{six-timepicker.types-cd6bac03.js → six-timepicker.types-e161a447.js} +43 -43
- package/dist/esm/six-tooltip.entry.js +172 -172
- package/dist/esm/{slot-5253e199.js → slot-6f3984c7.js} +42 -42
- package/dist/esm/{types-a37c1695.js → types-4b10b413.js} +12 -12
- package/dist/esm/{types-33d15673.js → types-ed860f7c.js} +12 -12
- package/dist/types/components/six-alert/six-alert.d.ts +60 -60
- package/dist/types/components/six-avatar/six-avatar.d.ts +27 -27
- package/dist/types/components/six-badge/six-badge.d.ts +20 -20
- package/dist/types/components/six-button/six-button.d.ts +69 -69
- package/dist/types/components/six-card/six-card.d.ts +9 -9
- package/dist/types/components/six-checkbox/six-checkbox.d.ts +86 -86
- package/dist/types/components/six-datepicker/components/day-selection.d.ts +5 -5
- package/dist/types/components/six-datepicker/components/month-selection.d.ts +5 -5
- package/dist/types/components/six-datepicker/components/year-selection.d.ts +5 -5
- package/dist/types/components/six-datepicker/six-date-formats.d.ts +22 -22
- package/dist/types/components/six-datepicker/six-datepicker.d.ts +214 -214
- package/dist/types/components/six-datepicker/test/six-datepicker.test-helpers.d.ts +1 -1
- package/dist/types/components/six-details/six-details.d.ts +61 -61
- package/dist/types/components/six-dialog/six-dialog.d.ts +75 -75
- package/dist/types/components/six-drawer/six-drawer.d.ts +82 -82
- package/dist/types/components/six-dropdown/six-dropdown.d.ts +140 -140
- package/dist/types/components/six-error-page/six-error-page.d.ts +27 -27
- package/dist/types/components/six-file-list/six-file-list.d.ts +8 -8
- package/dist/types/components/six-file-list-item/six-file-list-item.d.ts +35 -35
- package/dist/types/components/six-file-upload/six-file-upload.d.ts +42 -42
- package/dist/types/components/six-footer/six-footer.d.ts +9 -9
- package/dist/types/components/six-form/six-form.d.ts +69 -69
- package/dist/types/components/six-group-label/six-group-label.d.ts +37 -37
- package/dist/types/components/six-header/six-header.d.ts +90 -90
- package/dist/types/components/six-icon/six-icon.d.ts +13 -13
- package/dist/types/components/six-icon-button/six-icon-button.d.ts +28 -28
- package/dist/types/components/six-input/six-input.d.ts +165 -165
- package/dist/types/components/six-item-picker/six-item-picker.d.ts +106 -106
- package/dist/types/components/six-item-picker/types.d.ts +11 -11
- package/dist/types/components/six-language-switcher/six-language-switcher.d.ts +25 -25
- package/dist/types/components/six-layout-grid/six-layout-grid.d.ts +14 -14
- package/dist/types/components/six-main-container/six-main-container.d.ts +16 -16
- package/dist/types/components/six-menu/six-menu.d.ts +81 -81
- package/dist/types/components/six-menu-divider/six-menu-divider.d.ts +11 -11
- package/dist/types/components/six-menu-item/six-menu-item.d.ts +36 -36
- package/dist/types/components/six-menu-label/six-menu-label.d.ts +13 -13
- package/dist/types/components/six-picto/six-picto.d.ts +14 -14
- package/dist/types/components/six-progress-bar/six-progress-bar.d.ts +19 -19
- package/dist/types/components/six-progress-ring/six-progress-ring.d.ts +24 -24
- package/dist/types/components/six-radio/six-radio.d.ts +66 -66
- package/dist/types/components/six-range/six-range.d.ts +101 -101
- package/dist/types/components/six-root/six-root.d.ts +34 -34
- package/dist/types/components/six-search-field/six-search-field.d.ts +32 -32
- package/dist/types/components/six-select/six-select.d.ts +163 -163
- package/dist/types/components/six-sidebar/six-sidebar.d.ts +55 -55
- package/dist/types/components/six-sidebar-item/six-sidebar-item.d.ts +15 -15
- package/dist/types/components/six-sidebar-item-group/six-sidebar-item-group.d.ts +26 -26
- package/dist/types/components/six-spinner/six-spinner.d.ts +15 -15
- package/dist/types/components/six-stage-indicator/six-stage-indicator.d.ts +6 -6
- package/dist/types/components/six-switch/six-switch.d.ts +62 -62
- package/dist/types/components/six-tab/six-tab.d.ts +35 -35
- package/dist/types/components/six-tab-group/six-tab-group.d.ts +62 -62
- package/dist/types/components/six-tab-panel/six-tab-panel.d.ts +19 -19
- package/dist/types/components/six-table/six-table.d.ts +30 -30
- package/dist/types/components/six-table/test/helpers.d.ts +2 -2
- package/dist/types/components/six-table/types.d.ts +33 -33
- package/dist/types/components/six-table/util/filter-by.d.ts +2 -2
- package/dist/types/components/six-table/util/from-data.d.ts +8 -8
- package/dist/types/components/six-table/util/is.d.ts +3 -3
- package/dist/types/components/six-table/util/quick-filter-by.d.ts +2 -2
- package/dist/types/components/six-table/util/sort-by.d.ts +2 -2
- package/dist/types/components/six-table-cell/six-table-cell.d.ts +9 -9
- package/dist/types/components/six-table-header/six-table-header.d.ts +9 -9
- package/dist/types/components/six-table-header-cell/get-next-state.d.ts +2 -2
- package/dist/types/components/six-table-header-cell/icons.d.ts +3 -3
- package/dist/types/components/six-table-header-cell/six-table-header-cell.d.ts +32 -32
- package/dist/types/components/six-table-header-cell/types.d.ts +11 -11
- package/dist/types/components/six-table-header-cell/util/create-model.d.ts +4 -4
- package/dist/types/components/six-table-header-cell/util/get-next-state.d.ts +3 -3
- package/dist/types/components/six-table-row/six-table-row.d.ts +9 -9
- package/dist/types/components/six-tag/six-tag.d.ts +30 -30
- package/dist/types/components/six-textarea/six-textarea.d.ts +134 -134
- package/dist/types/components/six-tile/six-tile.d.ts +40 -40
- package/dist/types/components/six-timepicker/six-time-format.d.ts +13 -13
- package/dist/types/components/six-timepicker/six-timepicker.d.ts +184 -184
- package/dist/types/components/six-timepicker/six-timepicker.types.d.ts +36 -36
- package/dist/types/components/six-tooltip/six-tooltip.d.ts +72 -72
- package/dist/types/functional-components/form-control/form-control.d.ts +34 -34
- package/dist/types/index.d.ts +1 -1
- package/dist/types/testUtil/delay.d.ts +1 -1
- package/dist/types/utils/as-array.d.ts +1 -1
- package/dist/types/utils/date-util.d.ts +194 -194
- package/dist/types/utils/event-listeners.d.ts +15 -15
- package/dist/types/utils/execution-control.d.ts +26 -26
- package/dist/types/utils/focus-visible.d.ts +6 -6
- package/dist/types/utils/matchers.d.ts +2 -2
- package/dist/types/utils/modal.d.ts +13 -13
- package/dist/types/utils/offset.d.ts +4 -4
- package/dist/types/utils/popover.d.ts +27 -27
- package/dist/types/utils/scroll.d.ts +3 -3
- package/dist/types/utils/slot.d.ts +9 -9
- package/dist/types/utils/support.d.ts +1 -1
- package/dist/types/utils/tabbable.d.ts +2 -2
- package/dist/types/utils/testing.d.ts +2 -2
- package/dist/types/utils/time.util.d.ts +10 -10
- package/dist/types/utils/type-check.d.ts +4 -4
- package/dist/types/utils/types.d.ts +4 -4
- package/dist/types/wrappers/set-attributes/set-attributes.d.ts +9 -9
- package/dist/ui-library/{p-a8c225f2.entry.js → p-007bc8e8.entry.js} +1 -1
- package/dist/ui-library/{p-f9c0cfb7.entry.js → p-044b784e.entry.js} +1 -1
- package/dist/ui-library/{p-c733dead.js → p-0786fa7c.js} +0 -0
- package/dist/ui-library/{p-12cc24c3.js → p-07d1e830.js} +0 -0
- package/dist/ui-library/{p-48ea4419.entry.js → p-09cb13fa.entry.js} +1 -1
- package/dist/ui-library/{p-e96dcf96.entry.js → p-0c596054.entry.js} +1 -1
- package/dist/ui-library/{p-a77a6442.entry.js → p-1b8dc7b7.entry.js} +1 -1
- package/dist/ui-library/{p-68d31736.js → p-25a3bf57.js} +0 -0
- package/dist/ui-library/{p-ebaea182.entry.js → p-281e8c2d.entry.js} +1 -1
- package/dist/ui-library/{p-9f2dc381.entry.js → p-2924f82f.entry.js} +1 -1
- package/dist/ui-library/{p-ea1fcff2.entry.js → p-2d7ed407.entry.js} +1 -1
- package/dist/ui-library/{p-89f68e76.entry.js → p-4162dcdd.entry.js} +1 -1
- package/dist/ui-library/{p-6f67f986.entry.js → p-4d3a4e93.entry.js} +1 -1
- package/dist/ui-library/{p-8bd0873f.entry.js → p-4ed023b8.entry.js} +1 -1
- package/dist/ui-library/{p-af3d757c.js → p-4f8394d7.js} +0 -0
- package/dist/ui-library/{p-1b92cc7a.entry.js → p-530ea6ec.entry.js} +1 -1
- package/dist/ui-library/{p-19543c96.entry.js → p-531ab886.entry.js} +1 -1
- package/dist/ui-library/{p-fdb455d7.entry.js → p-54c48654.entry.js} +1 -1
- package/dist/ui-library/{p-c948d3db.entry.js → p-55c64cbc.entry.js} +1 -1
- package/dist/ui-library/{p-1c9f0dc6.js → p-5f1c6a5f.js} +0 -0
- package/dist/ui-library/{p-60491176.entry.js → p-675a8243.entry.js} +1 -1
- package/dist/ui-library/{p-b9fb8455.entry.js → p-6d622ed0.entry.js} +1 -1
- package/dist/ui-library/{p-572e3690.js → p-75297ad7.js} +0 -0
- package/dist/ui-library/{p-2ff97cdf.entry.js → p-90b26447.entry.js} +1 -1
- package/dist/ui-library/{p-fcd2356c.entry.js → p-93945629.entry.js} +1 -1
- package/dist/ui-library/{p-7735d99f.js → p-9a860acc.js} +0 -0
- package/dist/ui-library/{p-4cc01afc.entry.js → p-aa37e45a.entry.js} +1 -1
- package/dist/ui-library/{p-191f958b.js → p-b1e66136.js} +0 -0
- package/dist/ui-library/{p-c09dc3a9.js → p-b4dfb7cf.js} +0 -0
- package/dist/ui-library/{p-968c5169.entry.js → p-c24292b3.entry.js} +1 -1
- package/dist/ui-library/{p-ed21cc57.entry.js → p-cd79de73.entry.js} +1 -1
- package/dist/ui-library/{p-34e6d8e8.js → p-d12c6092.js} +0 -0
- package/dist/ui-library/{p-f0e91e17.entry.js → p-d28ac80a.entry.js} +1 -1
- package/dist/ui-library/{p-5ead7b2f.entry.js → p-d837e5a8.entry.js} +1 -1
- package/dist/ui-library/{p-ec1ecc2a.entry.js → p-dd3cae68.entry.js} +1 -1
- package/dist/ui-library/{p-044c6bf9.js → p-eb8f05a9.js} +0 -0
- package/dist/ui-library/ui-library.esm.js +1 -1
- package/package.json +1 -1
|
@@ -1,939 +1,939 @@
|
|
|
1
|
-
import { Component, Element, Event, h, Method, Prop, State, Watch } from '@stencil/core';
|
|
2
|
-
import { scrollIntoView } from '../../utils/scroll';
|
|
3
|
-
import { getNearestTabbableElement } from '../../utils/tabbable';
|
|
4
|
-
import Popover from '../../utils/popover';
|
|
5
|
-
import { EventListeners } from '../../utils/event-listeners';
|
|
6
|
-
import { getSlotChildren } from '../../utils/slot';
|
|
7
|
-
import { debounce, DEFAULT_DEBOUNCE_FAST } from '../../utils/execution-control';
|
|
8
|
-
const isTagName = (name) => (el) => (el === null || el === void 0 ? void 0 : el.tagName.toLowerCase()) === name.toLowerCase();
|
|
9
|
-
const isSixMenu = isTagName('six-menu');
|
|
10
|
-
const isSixMenuItem = isTagName('six-menu-item');
|
|
11
|
-
let id = 0;
|
|
12
|
-
/**
|
|
13
|
-
* @since 1.0
|
|
14
|
-
* @status stable
|
|
15
|
-
*
|
|
16
|
-
* Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.
|
|
17
|
-
*
|
|
18
|
-
* @slot trigger - The dropdown's trigger, usually a `<six-button>` element.
|
|
19
|
-
* @slot - The dropdown's content.
|
|
20
|
-
*
|
|
21
|
-
* @part base - The component's base wrapper.
|
|
22
|
-
* @part trigger - The container that wraps the trigger.
|
|
23
|
-
* @part panel - The panel that gets shown when the dropdown is open.
|
|
24
|
-
*/
|
|
25
|
-
export class SixDropdown {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.componentId = `dropdown-${++id}`;
|
|
28
|
-
this.isVisible = false;
|
|
29
|
-
this.hasBeenInitialized = false;
|
|
30
|
-
/** Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods. */
|
|
31
|
-
this.open = false;
|
|
32
|
-
/**
|
|
33
|
-
* The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel
|
|
34
|
-
* inside of the viewport.
|
|
35
|
-
*/
|
|
36
|
-
this.placement = 'bottom-start';
|
|
37
|
-
/** Determines whether the dropdown should hide when a menu item is selected. */
|
|
38
|
-
this.closeOnSelect = true;
|
|
39
|
-
/** The distance in pixels from which to offset the panel away from its trigger. */
|
|
40
|
-
this.distance = 0;
|
|
41
|
-
/** The distance in pixels from which to offset the panel along its trigger. */
|
|
42
|
-
this.skidding = 0;
|
|
43
|
-
/**
|
|
44
|
-
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
45
|
-
* `overflow: auto|scroll`.
|
|
46
|
-
*/
|
|
47
|
-
this.hoist = false;
|
|
48
|
-
/**
|
|
49
|
-
* Set to true to allow auto filtering for entries in the dropdown.
|
|
50
|
-
* With this flag the dropdown will automatically filter itsel.
|
|
51
|
-
* If you need to coordinate the shown elements yourself,
|
|
52
|
-
* e.g. because you need to call an endpoint use asyncFilter instead
|
|
53
|
-
*/
|
|
54
|
-
this.filter = false;
|
|
55
|
-
/**
|
|
56
|
-
* Set to true to allow async filtering.
|
|
57
|
-
* When you enter something in the search field the component will only emit an event but not filter any elements itself.
|
|
58
|
-
* You can then simply listen to the 'six-async-filter-fired' event to manage the shown menu-items yourself
|
|
59
|
-
*/
|
|
60
|
-
this.asyncFilter = false;
|
|
61
|
-
/** The filter's placeholder text. */
|
|
62
|
-
this.filterPlaceholder = 'Filter...';
|
|
63
|
-
/** By default the search field will be focused when opening a dropdown with filtering enabled. */
|
|
64
|
-
this.autofocusFilter = true;
|
|
65
|
-
/** The debounce for the filter callbacks. */
|
|
66
|
-
this.filterDebounce = DEFAULT_DEBOUNCE_FAST;
|
|
67
|
-
/** The panel can be opend/closed by pressing the spacebar or the enter key. In some cases you might want to avoid this */
|
|
68
|
-
this.disableHideOnEnterAndSpace = false;
|
|
69
|
-
/** Set the options to be shown in the dropdown (alternative to setting the elements via html)*/
|
|
70
|
-
this.options = null;
|
|
71
|
-
/** Defines whether the menu list will be rendered virtually i.e. only the elements actually shown (and a couple around)
|
|
72
|
-
* are actually rendered in the DOM. If you use virtual scrolling pass the elements via prop instead of via slot. */
|
|
73
|
-
this.virtualScroll = false;
|
|
74
|
-
this.eventListeners = new EventListeners();
|
|
75
|
-
// internal representation of options, so we don't have to make options mutable
|
|
76
|
-
this._options = null;
|
|
77
|
-
this.getMenuItems = () => {
|
|
78
|
-
if (this._options !== null) {
|
|
79
|
-
return this._options.map((option) => h("six-menu-item", { value: option.value }, option.label));
|
|
80
|
-
}
|
|
81
|
-
const [panel] = getSlotChildren(this.panel);
|
|
82
|
-
// the menu-items can be in a slot e.g. in six-select or direct children of the panel
|
|
83
|
-
return getSlotChildren(panel) || Array.from(panel.querySelectorAll('six-menu-item'));
|
|
84
|
-
};
|
|
85
|
-
this.handleFilterInputChange = () => {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
const lowerCaseFilterTerm = ((_b = (_a = this.filterInputElement.value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.trim()) || '';
|
|
88
|
-
if (this._options) {
|
|
89
|
-
this.handleFilteringForAttributeItems(lowerCaseFilterTerm);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
this.handleFilteringForSlotItems(lowerCaseFilterTerm);
|
|
93
|
-
}
|
|
94
|
-
this.sixAutoFilterFired.emit({ filterValue: lowerCaseFilterTerm });
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
get hasFilterEnabled() {
|
|
98
|
-
return this.filter || this.asyncFilter;
|
|
99
|
-
}
|
|
100
|
-
get container() {
|
|
101
|
-
return this.containingElement || this.host;
|
|
102
|
-
}
|
|
103
|
-
handleOpenChange() {
|
|
104
|
-
this.open ? this.show() : this.hide();
|
|
105
|
-
this.updateAccessibleTrigger();
|
|
106
|
-
}
|
|
107
|
-
handlePopoverOptionsChange() {
|
|
108
|
-
this.popover.setOptions({
|
|
109
|
-
strategy: this.hoist ? 'fixed' : 'absolute',
|
|
110
|
-
placement: this.placement,
|
|
111
|
-
distance: this.distance,
|
|
112
|
-
skidding: this.skidding,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
handleOptionsChange() {
|
|
116
|
-
this._options = [...this.options];
|
|
117
|
-
}
|
|
118
|
-
connectedCallback() {
|
|
119
|
-
if (this.virtualScroll && this.options === null) {
|
|
120
|
-
console.error('Options must be defined when using virtual scrolling');
|
|
121
|
-
}
|
|
122
|
-
if (this.options !== null) {
|
|
123
|
-
this._options = [...this.options];
|
|
124
|
-
}
|
|
125
|
-
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
|
126
|
-
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
|
127
|
-
this.handleMenuItemActivate = this.handleMenuItemActivate.bind(this);
|
|
128
|
-
this.handlePanelSelect = this.handlePanelSelect.bind(this);
|
|
129
|
-
this.handleTriggerClick = this.handleTriggerClick.bind(this);
|
|
130
|
-
this.handleTriggerKeyDown = this.handleTriggerKeyDown.bind(this);
|
|
131
|
-
this.handleTriggerKeyUp = this.handleTriggerKeyUp.bind(this);
|
|
132
|
-
this.handleTriggerSlotChange = this.handleTriggerSlotChange.bind(this);
|
|
133
|
-
this.handleDropdownScroll = this.handleDropdownScroll.bind(this);
|
|
134
|
-
if (this.hasBeenInitialized && !this.popover) {
|
|
135
|
-
// there was a weird bug when using six-dropdown inside an ag-grid filter. When closing the ag-grid filter
|
|
136
|
-
// disconnectedCallback() is executed. However since componentDidLoad() will not be rerendered the popover was had
|
|
137
|
-
// no longer a connected transitionEnd callback to the dropdown. To fix this, we have this sanity check here,
|
|
138
|
-
// to re-initialize the popover in case the component has already been initialized but the popover is undefined.
|
|
139
|
-
this.initializePopover();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
componentDidLoad() {
|
|
143
|
-
this.hasBeenInitialized = true;
|
|
144
|
-
this.initializePopover();
|
|
145
|
-
// Show on init if open
|
|
146
|
-
if (this.open) {
|
|
147
|
-
void this.show();
|
|
148
|
-
}
|
|
149
|
-
if (this.filter) {
|
|
150
|
-
this.setupFiltering(this.handleFilterInputChange);
|
|
151
|
-
}
|
|
152
|
-
else if (this.asyncFilter) {
|
|
153
|
-
this.setupFiltering(() => this.sixAsyncFilterFired.emit({ filterValue: this.filterInputElement.value }));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
initializePopover() {
|
|
157
|
-
const onAfterHide = () => {
|
|
158
|
-
if (this.filter) {
|
|
159
|
-
this.filterInputElement.value = '';
|
|
160
|
-
if (this._options !== null) {
|
|
161
|
-
this._options = [...this.options];
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
const menuItems = this.getMenuItems();
|
|
165
|
-
menuItems.forEach((item) => (item.style.display = 'unset'));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
this.sixAfterHide.emit();
|
|
169
|
-
};
|
|
170
|
-
const onAfterShow = async () => {
|
|
171
|
-
if (this.hasFilterEnabled && this.autofocusFilter) {
|
|
172
|
-
// if dropdown filter is enabled we should autofocus the search field
|
|
173
|
-
await this.filterInputElement.setFocus();
|
|
174
|
-
}
|
|
175
|
-
this.sixAfterShow.emit();
|
|
176
|
-
};
|
|
177
|
-
const onTransitionEnd = () => {
|
|
178
|
-
if (!this.open) {
|
|
179
|
-
this.panel.scrollTop = 0;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
this.popover = new Popover(this.trigger, this.positioner, {
|
|
183
|
-
strategy: this.hoist ? 'fixed' : 'absolute',
|
|
184
|
-
placement: this.placement,
|
|
185
|
-
distance: this.distance,
|
|
186
|
-
skidding: this.skidding,
|
|
187
|
-
transitionElement: this.panel,
|
|
188
|
-
onAfterHide,
|
|
189
|
-
onAfterShow,
|
|
190
|
-
onTransitionEnd,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
setupFiltering(callback) {
|
|
194
|
-
this.eventListeners.add(this.filterInputElement, 'six-input-input', debounce(callback, this.filterDebounce));
|
|
195
|
-
}
|
|
196
|
-
handleFilteringForAttributeItems(lowerCaseFilterTerm) {
|
|
197
|
-
if (lowerCaseFilterTerm === '') {
|
|
198
|
-
this._options = [...this.options];
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
this._options = this.options.filter((option) => {
|
|
202
|
-
var _a, _b, _c, _d;
|
|
203
|
-
return (option.label && ((_b = (_a = String(option.label)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(lowerCaseFilterTerm))) ||
|
|
204
|
-
(option.value && ((_d = (_c = String(option.value)) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.includes(lowerCaseFilterTerm)));
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
handleFilteringForSlotItems(lowerCaseFilterTerm) {
|
|
208
|
-
const menuItems = this.getMenuItems();
|
|
209
|
-
menuItems.forEach((menuItem) => {
|
|
210
|
-
var _a, _b;
|
|
211
|
-
const lowerCaseMenuItemValue = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.value) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
212
|
-
const lowerCaseMenuText = (_b = menuItem === null || menuItem === void 0 ? void 0 : menuItem.innerText) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
213
|
-
// hide all elements which don't contain the entered substring
|
|
214
|
-
const elementContainsFilterTerm = (lowerCaseMenuItemValue === null || lowerCaseMenuItemValue === void 0 ? void 0 : lowerCaseMenuItemValue.includes(lowerCaseFilterTerm)) || (lowerCaseMenuText === null || lowerCaseMenuText === void 0 ? void 0 : lowerCaseMenuText.includes(lowerCaseFilterTerm));
|
|
215
|
-
menuItem.style.display = elementContainsFilterTerm ? 'unset' : 'none';
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
disconnectedCallback() {
|
|
219
|
-
this.eventListeners.removeAll();
|
|
220
|
-
void this.hide();
|
|
221
|
-
this.popover.destroy();
|
|
222
|
-
this.popover = null;
|
|
223
|
-
}
|
|
224
|
-
/** Shows the dropdown panel */
|
|
225
|
-
async show() {
|
|
226
|
-
// Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher
|
|
227
|
-
if (this.isVisible) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
const sixShow = this.sixShow.emit();
|
|
231
|
-
if (sixShow.defaultPrevented) {
|
|
232
|
-
this.open = false;
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
this.eventListeners.add(this.panel, 'six-menu-item-selected', this.handlePanelSelect);
|
|
236
|
-
this.eventListeners.add(document, 'keydown', this.handleDocumentKeyDown);
|
|
237
|
-
this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);
|
|
238
|
-
this.isVisible = true;
|
|
239
|
-
this.open = true;
|
|
240
|
-
this.popover.show();
|
|
241
|
-
}
|
|
242
|
-
/** Hides the dropdown panel */
|
|
243
|
-
async hide() {
|
|
244
|
-
// Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher
|
|
245
|
-
if (!this.isVisible) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
const sixHide = this.sixHide.emit();
|
|
249
|
-
if (sixHide.defaultPrevented) {
|
|
250
|
-
this.open = true;
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
this.eventListeners.remove(this.panel, 'six-menu-item-selected', this.handlePanelSelect);
|
|
254
|
-
this.eventListeners.remove(document, 'keydown', this.handleDocumentKeyDown);
|
|
255
|
-
this.eventListeners.remove(document, 'mousedown', this.handleDocumentMouseDown);
|
|
256
|
-
this.isVisible = false;
|
|
257
|
-
this.open = false;
|
|
258
|
-
this.popover.hide();
|
|
259
|
-
}
|
|
260
|
-
focusOnTrigger() {
|
|
261
|
-
const [trigger] = getSlotChildren(this.trigger);
|
|
262
|
-
if (trigger) {
|
|
263
|
-
if (typeof trigger.setFocus === 'function') {
|
|
264
|
-
trigger.setFocus();
|
|
265
|
-
}
|
|
266
|
-
else if (typeof trigger.focus === 'function') {
|
|
267
|
-
trigger.focus();
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
getMenu() {
|
|
272
|
-
const [menu] = getSlotChildren(this.panel).filter(isSixMenu);
|
|
273
|
-
return menu;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu
|
|
277
|
-
* is activated.
|
|
278
|
-
*/
|
|
279
|
-
async reposition() {
|
|
280
|
-
if (!this.open) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
this.popover.reposition();
|
|
284
|
-
}
|
|
285
|
-
handleDocumentKeyDown(event) {
|
|
286
|
-
// Close when escape is pressed
|
|
287
|
-
if (event.key === 'Escape') {
|
|
288
|
-
void this.hide();
|
|
289
|
-
this.focusOnTrigger();
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
if (this.filterInputElement === this.host.shadowRoot.activeElement) {
|
|
293
|
-
if (event.key === 'ArrowDown') {
|
|
294
|
-
const item = this.getMenuItems().find((item) => item.style.display !== 'none');
|
|
295
|
-
if (item) {
|
|
296
|
-
item.setFocus();
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
// Handle tabbing
|
|
301
|
-
if (event.key === 'Tab') {
|
|
302
|
-
// Tabbing within an open menu should close the dropdown and refocus the trigger
|
|
303
|
-
if (this.open && isSixMenuItem(document.activeElement)) {
|
|
304
|
-
event.preventDefault();
|
|
305
|
-
void this.hide();
|
|
306
|
-
this.focusOnTrigger();
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
// Tabbing outside of the containing element closes the panel
|
|
310
|
-
//
|
|
311
|
-
// If the dropdown is used within a shadow DOM, we need to obtain the activeElement within that shadowRoot,
|
|
312
|
-
// otherwise `document.activeElement` will only return the name of the parent shadow DOM element.
|
|
313
|
-
setTimeout(() => {
|
|
314
|
-
var _a;
|
|
315
|
-
const activeElement = this.container.getRootNode() instanceof ShadowRoot
|
|
316
|
-
? (_a = document.activeElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement
|
|
317
|
-
: document.activeElement;
|
|
318
|
-
if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest(this.container.tagName.toLowerCase())) !== this.container) {
|
|
319
|
-
void this.hide();
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
handleDocumentMouseDown(event) {
|
|
326
|
-
// Close when clicking outside of the containing element
|
|
327
|
-
const path = event.composedPath();
|
|
328
|
-
if (!path.includes(this.container)) {
|
|
329
|
-
void this.hide();
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
handleMenuItemActivate(event) {
|
|
334
|
-
const item = event.target;
|
|
335
|
-
scrollIntoView(item, this.panel);
|
|
336
|
-
}
|
|
337
|
-
handlePanelSelect(event) {
|
|
338
|
-
const target = event.target;
|
|
339
|
-
// Hide the dropdown when a menu item is selected
|
|
340
|
-
if (this.closeOnSelect && isSixMenu(target)) {
|
|
341
|
-
void this.hide();
|
|
342
|
-
this.focusOnTrigger();
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
handleTriggerClick() {
|
|
346
|
-
this.open ? this.hide() : this.show();
|
|
347
|
-
}
|
|
348
|
-
handleTriggerKeyDown(event) {
|
|
349
|
-
const menu = this.getMenu();
|
|
350
|
-
const menuItems = menu ? [...menu.querySelectorAll('six-menu-item')] : null;
|
|
351
|
-
const firstMenuItem = menuItems[0];
|
|
352
|
-
const lastMenuItem = menuItems[menuItems.length - 1];
|
|
353
|
-
// Close when escape or tab is pressed
|
|
354
|
-
if (event.key === 'Escape') {
|
|
355
|
-
this.focusOnTrigger();
|
|
356
|
-
void this.hide();
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
// When spacebar/enter is pressed, show the panel but don't focus on the menu. This let's the user press the same
|
|
360
|
-
// key again to hide the menu in case they don't want to make a selection.
|
|
361
|
-
if (!this.disableHideOnEnterAndSpace && [' ', 'Enter'].includes(event.key)) {
|
|
362
|
-
event.preventDefault();
|
|
363
|
-
this.open ? void this.hide() : void this.show();
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
// When up/down is pressed, we make the assumption that the user is familiar with the menu and plans to make a
|
|
367
|
-
// selection. Rather than toggle the panel, we focus on the menu (if one exists) and activate the first item for
|
|
368
|
-
// faster navigation.
|
|
369
|
-
if (['ArrowDown', 'ArrowUp'].includes(event.key)) {
|
|
370
|
-
event.preventDefault();
|
|
371
|
-
// Show the menu if it's not already open
|
|
372
|
-
if (!this.open) {
|
|
373
|
-
void this.show();
|
|
374
|
-
}
|
|
375
|
-
// Focus on a menu item
|
|
376
|
-
if (event.key === 'ArrowDown' && firstMenuItem) {
|
|
377
|
-
firstMenuItem.setFocus();
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
if (event.key === 'ArrowUp' && lastMenuItem) {
|
|
381
|
-
lastMenuItem.setFocus();
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
// Other keys bring focus to the menu and initiate type-to-select behavior
|
|
386
|
-
const ignoredKeys = ['Tab', 'Shift', 'Meta', 'Ctrl', 'Alt'];
|
|
387
|
-
if (this.open && menu && !ignoredKeys.includes(event.key)) {
|
|
388
|
-
void menu.typeToSelect(event.key);
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
handleTriggerKeyUp(event) {
|
|
393
|
-
// Prevent space from triggering a click event in Firefox
|
|
394
|
-
if (event.key === ' ') {
|
|
395
|
-
event.preventDefault();
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
handleTriggerSlotChange() {
|
|
399
|
-
this.updateAccessibleTrigger();
|
|
400
|
-
}
|
|
401
|
-
handleDropdownScroll() {
|
|
402
|
-
this.sixScroll.emit({
|
|
403
|
-
scrollHeight: this.panel.scrollHeight,
|
|
404
|
-
scrollTop: this.panel.scrollTop,
|
|
405
|
-
scrollbarHeight: this.panel.offsetHeight * (this.panel.offsetHeight / this.panel.scrollHeight),
|
|
406
|
-
scrollRatio: this.panel.scrollTop / (this.panel.scrollHeight - this.panel.clientHeight),
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
//
|
|
410
|
-
// Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and
|
|
411
|
-
// `aria-expanded`. These must be applied to the "accessible trigger" (the tabbable portion of the trigger element
|
|
412
|
-
// that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,
|
|
413
|
-
// a child of the slotted element, or an element in the slotted element's shadow root.
|
|
414
|
-
//
|
|
415
|
-
// For example, the accessible trigger of an <sl-button> is a <button> located inside its shadow root.
|
|
416
|
-
//
|
|
417
|
-
// To determine this, we assume the first tabbable element in the trigger slot is the "accessible trigger."
|
|
418
|
-
//
|
|
419
|
-
updateAccessibleTrigger() {
|
|
420
|
-
const [accessibleTrigger] = getSlotChildren(this.trigger).map(getNearestTabbableElement);
|
|
421
|
-
if (accessibleTrigger) {
|
|
422
|
-
accessibleTrigger.setAttribute('aria-haspopup', 'true');
|
|
423
|
-
accessibleTrigger.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
render() {
|
|
427
|
-
return (h("div", { part: "base", id: this.componentId, class: {
|
|
428
|
-
dropdown: true,
|
|
429
|
-
'dropdown--open': this.open,
|
|
430
|
-
} },
|
|
431
|
-
h("span", { part: "trigger", class: "dropdown__trigger", ref: (el) => (this.trigger = el), onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeyDown, onKeyUp: this.handleTriggerKeyUp },
|
|
432
|
-
h("slot", { name: "trigger", onSlotchange: this.handleTriggerSlotChange })),
|
|
433
|
-
h("div", { ref: (el) => (this.positioner = el), class: {
|
|
434
|
-
dropdown__positioner: true,
|
|
435
|
-
dropdown__positioner__filtered: (this.filter || this.asyncFilter) && !this.hoist,
|
|
436
|
-
} },
|
|
437
|
-
this.hasFilterEnabled && (h("six-input", { class: {
|
|
438
|
-
'filter-hidden': !this.open,
|
|
439
|
-
}, "aria-hidden": this.open ? 'false' : 'true', ref: (el) => (this.filterInputElement = el), placeholder: this.filterPlaceholder })),
|
|
440
|
-
h("div", { ref: (el) => (this.panel = el), part: "panel", class: "dropdown__panel", role: "menu", "aria-hidden": this.open ? 'false' : 'true', "aria-labelledby": this.componentId, onScroll: this.handleDropdownScroll },
|
|
441
|
-
h("slot", null),
|
|
442
|
-
this._options && (h("six-menu", { part: "menu", items: this._options, virtualScroll: this.virtualScroll }))))));
|
|
443
|
-
}
|
|
444
|
-
static get is() { return "six-dropdown"; }
|
|
445
|
-
static get encapsulation() { return "shadow"; }
|
|
446
|
-
static get originalStyleUrls() { return {
|
|
447
|
-
"$": ["six-dropdown.scss"]
|
|
448
|
-
}; }
|
|
449
|
-
static get styleUrls() { return {
|
|
450
|
-
"$": ["six-dropdown.css"]
|
|
451
|
-
}; }
|
|
452
|
-
static get properties() { return {
|
|
453
|
-
"open": {
|
|
454
|
-
"type": "boolean",
|
|
455
|
-
"mutable": true,
|
|
456
|
-
"complexType": {
|
|
457
|
-
"original": "boolean",
|
|
458
|
-
"resolved": "boolean",
|
|
459
|
-
"references": {}
|
|
460
|
-
},
|
|
461
|
-
"required": false,
|
|
462
|
-
"optional": false,
|
|
463
|
-
"docs": {
|
|
464
|
-
"tags": [],
|
|
465
|
-
"text": "Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods."
|
|
466
|
-
},
|
|
467
|
-
"attribute": "open",
|
|
468
|
-
"reflect": true,
|
|
469
|
-
"defaultValue": "false"
|
|
470
|
-
},
|
|
471
|
-
"placement": {
|
|
472
|
-
"type": "string",
|
|
473
|
-
"mutable": false,
|
|
474
|
-
"complexType": {
|
|
475
|
-
"original": "| 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end'",
|
|
476
|
-
"resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
477
|
-
"references": {}
|
|
478
|
-
},
|
|
479
|
-
"required": false,
|
|
480
|
-
"optional": false,
|
|
481
|
-
"docs": {
|
|
482
|
-
"tags": [],
|
|
483
|
-
"text": "The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel\ninside of the viewport."
|
|
484
|
-
},
|
|
485
|
-
"attribute": "placement",
|
|
486
|
-
"reflect": false,
|
|
487
|
-
"defaultValue": "'bottom-start'"
|
|
488
|
-
},
|
|
489
|
-
"closeOnSelect": {
|
|
490
|
-
"type": "boolean",
|
|
491
|
-
"mutable": false,
|
|
492
|
-
"complexType": {
|
|
493
|
-
"original": "boolean",
|
|
494
|
-
"resolved": "boolean",
|
|
495
|
-
"references": {}
|
|
496
|
-
},
|
|
497
|
-
"required": false,
|
|
498
|
-
"optional": false,
|
|
499
|
-
"docs": {
|
|
500
|
-
"tags": [],
|
|
501
|
-
"text": "Determines whether the dropdown should hide when a menu item is selected."
|
|
502
|
-
},
|
|
503
|
-
"attribute": "close-on-select",
|
|
504
|
-
"reflect": false,
|
|
505
|
-
"defaultValue": "true"
|
|
506
|
-
},
|
|
507
|
-
"distance": {
|
|
508
|
-
"type": "number",
|
|
509
|
-
"mutable": false,
|
|
510
|
-
"complexType": {
|
|
511
|
-
"original": "number",
|
|
512
|
-
"resolved": "number",
|
|
513
|
-
"references": {}
|
|
514
|
-
},
|
|
515
|
-
"required": false,
|
|
516
|
-
"optional": false,
|
|
517
|
-
"docs": {
|
|
518
|
-
"tags": [],
|
|
519
|
-
"text": "The distance in pixels from which to offset the panel away from its trigger."
|
|
520
|
-
},
|
|
521
|
-
"attribute": "distance",
|
|
522
|
-
"reflect": false,
|
|
523
|
-
"defaultValue": "0"
|
|
524
|
-
},
|
|
525
|
-
"skidding": {
|
|
526
|
-
"type": "number",
|
|
527
|
-
"mutable": false,
|
|
528
|
-
"complexType": {
|
|
529
|
-
"original": "number",
|
|
530
|
-
"resolved": "number",
|
|
531
|
-
"references": {}
|
|
532
|
-
},
|
|
533
|
-
"required": false,
|
|
534
|
-
"optional": false,
|
|
535
|
-
"docs": {
|
|
536
|
-
"tags": [],
|
|
537
|
-
"text": "The distance in pixels from which to offset the panel along its trigger."
|
|
538
|
-
},
|
|
539
|
-
"attribute": "skidding",
|
|
540
|
-
"reflect": false,
|
|
541
|
-
"defaultValue": "0"
|
|
542
|
-
},
|
|
543
|
-
"hoist": {
|
|
544
|
-
"type": "boolean",
|
|
545
|
-
"mutable": false,
|
|
546
|
-
"complexType": {
|
|
547
|
-
"original": "boolean",
|
|
548
|
-
"resolved": "boolean",
|
|
549
|
-
"references": {}
|
|
550
|
-
},
|
|
551
|
-
"required": false,
|
|
552
|
-
"optional": false,
|
|
553
|
-
"docs": {
|
|
554
|
-
"tags": [],
|
|
555
|
-
"text": "Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n`overflow: auto|scroll`."
|
|
556
|
-
},
|
|
557
|
-
"attribute": "hoist",
|
|
558
|
-
"reflect": false,
|
|
559
|
-
"defaultValue": "false"
|
|
560
|
-
},
|
|
561
|
-
"containingElement": {
|
|
562
|
-
"type": "unknown",
|
|
563
|
-
"mutable": false,
|
|
564
|
-
"complexType": {
|
|
565
|
-
"original": "HTMLElement",
|
|
566
|
-
"resolved": "HTMLElement",
|
|
567
|
-
"references": {
|
|
568
|
-
"HTMLElement": {
|
|
569
|
-
"location": "global"
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
"required": false,
|
|
574
|
-
"optional": false,
|
|
575
|
-
"docs": {
|
|
576
|
-
"tags": [],
|
|
577
|
-
"text": "The dropdown will close when the user interacts outside of this element (e.g. clicking)."
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
"filter": {
|
|
581
|
-
"type": "boolean",
|
|
582
|
-
"mutable": false,
|
|
583
|
-
"complexType": {
|
|
584
|
-
"original": "boolean",
|
|
585
|
-
"resolved": "boolean",
|
|
586
|
-
"references": {}
|
|
587
|
-
},
|
|
588
|
-
"required": false,
|
|
589
|
-
"optional": false,
|
|
590
|
-
"docs": {
|
|
591
|
-
"tags": [],
|
|
592
|
-
"text": "Set to true to allow auto filtering for entries in the dropdown.\nWith this flag the dropdown will automatically filter itsel.\nIf you need to coordinate the shown elements yourself,\ne.g. because you need to call an endpoint use asyncFilter instead"
|
|
593
|
-
},
|
|
594
|
-
"attribute": "filter",
|
|
595
|
-
"reflect": false,
|
|
596
|
-
"defaultValue": "false"
|
|
597
|
-
},
|
|
598
|
-
"asyncFilter": {
|
|
599
|
-
"type": "boolean",
|
|
600
|
-
"mutable": false,
|
|
601
|
-
"complexType": {
|
|
602
|
-
"original": "boolean",
|
|
603
|
-
"resolved": "boolean",
|
|
604
|
-
"references": {}
|
|
605
|
-
},
|
|
606
|
-
"required": false,
|
|
607
|
-
"optional": false,
|
|
608
|
-
"docs": {
|
|
609
|
-
"tags": [],
|
|
610
|
-
"text": "Set to true to allow async filtering.\nWhen you enter something in the search field the component will only emit an event but not filter any elements itself.\nYou can then simply listen to the 'six-async-filter-fired' event to manage the shown menu-items yourself"
|
|
611
|
-
},
|
|
612
|
-
"attribute": "async-filter",
|
|
613
|
-
"reflect": false,
|
|
614
|
-
"defaultValue": "false"
|
|
615
|
-
},
|
|
616
|
-
"filterPlaceholder": {
|
|
617
|
-
"type": "string",
|
|
618
|
-
"mutable": false,
|
|
619
|
-
"complexType": {
|
|
620
|
-
"original": "string",
|
|
621
|
-
"resolved": "string",
|
|
622
|
-
"references": {}
|
|
623
|
-
},
|
|
624
|
-
"required": false,
|
|
625
|
-
"optional": false,
|
|
626
|
-
"docs": {
|
|
627
|
-
"tags": [],
|
|
628
|
-
"text": "The filter's placeholder text."
|
|
629
|
-
},
|
|
630
|
-
"attribute": "filter-placeholder",
|
|
631
|
-
"reflect": false,
|
|
632
|
-
"defaultValue": "'Filter...'"
|
|
633
|
-
},
|
|
634
|
-
"autofocusFilter": {
|
|
635
|
-
"type": "boolean",
|
|
636
|
-
"mutable": false,
|
|
637
|
-
"complexType": {
|
|
638
|
-
"original": "boolean",
|
|
639
|
-
"resolved": "boolean",
|
|
640
|
-
"references": {}
|
|
641
|
-
},
|
|
642
|
-
"required": false,
|
|
643
|
-
"optional": false,
|
|
644
|
-
"docs": {
|
|
645
|
-
"tags": [],
|
|
646
|
-
"text": "By default the search field will be focused when opening a dropdown with filtering enabled."
|
|
647
|
-
},
|
|
648
|
-
"attribute": "autofocus-filter",
|
|
649
|
-
"reflect": false,
|
|
650
|
-
"defaultValue": "true"
|
|
651
|
-
},
|
|
652
|
-
"filterDebounce": {
|
|
653
|
-
"type": "number",
|
|
654
|
-
"mutable": false,
|
|
655
|
-
"complexType": {
|
|
656
|
-
"original": "number",
|
|
657
|
-
"resolved": "number",
|
|
658
|
-
"references": {}
|
|
659
|
-
},
|
|
660
|
-
"required": false,
|
|
661
|
-
"optional": false,
|
|
662
|
-
"docs": {
|
|
663
|
-
"tags": [],
|
|
664
|
-
"text": "The debounce for the filter callbacks."
|
|
665
|
-
},
|
|
666
|
-
"attribute": "filter-debounce",
|
|
667
|
-
"reflect": false,
|
|
668
|
-
"defaultValue": "DEFAULT_DEBOUNCE_FAST"
|
|
669
|
-
},
|
|
670
|
-
"disableHideOnEnterAndSpace": {
|
|
671
|
-
"type": "boolean",
|
|
672
|
-
"mutable": false,
|
|
673
|
-
"complexType": {
|
|
674
|
-
"original": "boolean",
|
|
675
|
-
"resolved": "boolean",
|
|
676
|
-
"references": {}
|
|
677
|
-
},
|
|
678
|
-
"required": false,
|
|
679
|
-
"optional": false,
|
|
680
|
-
"docs": {
|
|
681
|
-
"tags": [],
|
|
682
|
-
"text": "The panel can be opend/closed by pressing the spacebar or the enter key. In some cases you might want to avoid this"
|
|
683
|
-
},
|
|
684
|
-
"attribute": "disable-hide-on-enter-and-space",
|
|
685
|
-
"reflect": false,
|
|
686
|
-
"defaultValue": "false"
|
|
687
|
-
},
|
|
688
|
-
"options": {
|
|
689
|
-
"type": "unknown",
|
|
690
|
-
"mutable": false,
|
|
691
|
-
"complexType": {
|
|
692
|
-
"original": "SixMenuItemData[] | null",
|
|
693
|
-
"resolved": "SixMenuItemData[]",
|
|
694
|
-
"references": {
|
|
695
|
-
"SixMenuItemData": {
|
|
696
|
-
"location": "import",
|
|
697
|
-
"path": "../six-menu/six-menu"
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
},
|
|
701
|
-
"required": false,
|
|
702
|
-
"optional": false,
|
|
703
|
-
"docs": {
|
|
704
|
-
"tags": [],
|
|
705
|
-
"text": "Set the options to be shown in the dropdown (alternative to setting the elements via html)"
|
|
706
|
-
},
|
|
707
|
-
"defaultValue": "null"
|
|
708
|
-
},
|
|
709
|
-
"virtualScroll": {
|
|
710
|
-
"type": "boolean",
|
|
711
|
-
"mutable": false,
|
|
712
|
-
"complexType": {
|
|
713
|
-
"original": "boolean",
|
|
714
|
-
"resolved": "boolean",
|
|
715
|
-
"references": {}
|
|
716
|
-
},
|
|
717
|
-
"required": false,
|
|
718
|
-
"optional": false,
|
|
719
|
-
"docs": {
|
|
720
|
-
"tags": [],
|
|
721
|
-
"text": "Defines whether the menu list will be rendered virtually i.e. only the elements actually shown (and a couple around)\nare actually rendered in the DOM. If you use virtual scrolling pass the elements via prop instead of via slot."
|
|
722
|
-
},
|
|
723
|
-
"attribute": "virtual-scroll",
|
|
724
|
-
"reflect": false,
|
|
725
|
-
"defaultValue": "false"
|
|
726
|
-
}
|
|
727
|
-
}; }
|
|
728
|
-
static get states() { return {
|
|
729
|
-
"_options": {}
|
|
730
|
-
}; }
|
|
731
|
-
static get events() { return [{
|
|
732
|
-
"method": "sixShow",
|
|
733
|
-
"name": "six-dropdown-show",
|
|
734
|
-
"bubbles": true,
|
|
735
|
-
"cancelable": true,
|
|
736
|
-
"composed": true,
|
|
737
|
-
"docs": {
|
|
738
|
-
"tags": [],
|
|
739
|
-
"text": "Emitted when the dropdown opens. Calling `event.preventDefault()` will prevent it from being opened."
|
|
740
|
-
},
|
|
741
|
-
"complexType": {
|
|
742
|
-
"original": "EmptyPayload",
|
|
743
|
-
"resolved": "undefined",
|
|
744
|
-
"references": {
|
|
745
|
-
"EmptyPayload": {
|
|
746
|
-
"location": "import",
|
|
747
|
-
"path": "../../utils/types"
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}, {
|
|
752
|
-
"method": "sixAfterShow",
|
|
753
|
-
"name": "six-dropdown-after-show",
|
|
754
|
-
"bubbles": true,
|
|
755
|
-
"cancelable": true,
|
|
756
|
-
"composed": true,
|
|
757
|
-
"docs": {
|
|
758
|
-
"tags": [],
|
|
759
|
-
"text": "Emitted after the dropdown opens and all transitions are complete."
|
|
760
|
-
},
|
|
761
|
-
"complexType": {
|
|
762
|
-
"original": "EmptyPayload",
|
|
763
|
-
"resolved": "undefined",
|
|
764
|
-
"references": {
|
|
765
|
-
"EmptyPayload": {
|
|
766
|
-
"location": "import",
|
|
767
|
-
"path": "../../utils/types"
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
}, {
|
|
772
|
-
"method": "sixHide",
|
|
773
|
-
"name": "six-dropdown-hide",
|
|
774
|
-
"bubbles": true,
|
|
775
|
-
"cancelable": true,
|
|
776
|
-
"composed": true,
|
|
777
|
-
"docs": {
|
|
778
|
-
"tags": [],
|
|
779
|
-
"text": "Emitted when the dropdown closes. Calling `event.preventDefault()` will prevent it from being closed."
|
|
780
|
-
},
|
|
781
|
-
"complexType": {
|
|
782
|
-
"original": "EmptyPayload",
|
|
783
|
-
"resolved": "undefined",
|
|
784
|
-
"references": {
|
|
785
|
-
"EmptyPayload": {
|
|
786
|
-
"location": "import",
|
|
787
|
-
"path": "../../utils/types"
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}, {
|
|
792
|
-
"method": "sixAfterHide",
|
|
793
|
-
"name": "six-dropdown-after-hide",
|
|
794
|
-
"bubbles": true,
|
|
795
|
-
"cancelable": true,
|
|
796
|
-
"composed": true,
|
|
797
|
-
"docs": {
|
|
798
|
-
"tags": [],
|
|
799
|
-
"text": "Emitted after the dropdown closes and all transitions are complete."
|
|
800
|
-
},
|
|
801
|
-
"complexType": {
|
|
802
|
-
"original": "EmptyPayload",
|
|
803
|
-
"resolved": "undefined",
|
|
804
|
-
"references": {
|
|
805
|
-
"EmptyPayload": {
|
|
806
|
-
"location": "import",
|
|
807
|
-
"path": "../../utils/types"
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}, {
|
|
812
|
-
"method": "sixAutoFilterFired",
|
|
813
|
-
"name": "six-dropdown-auto-filter-fired",
|
|
814
|
-
"bubbles": true,
|
|
815
|
-
"cancelable": true,
|
|
816
|
-
"composed": true,
|
|
817
|
-
"docs": {
|
|
818
|
-
"tags": [],
|
|
819
|
-
"text": "Emitted when the auto filter is triggered"
|
|
820
|
-
},
|
|
821
|
-
"complexType": {
|
|
822
|
-
"original": "SixDropdownAutoFilterPayload",
|
|
823
|
-
"resolved": "SixDropdownAutoFilterPayload",
|
|
824
|
-
"references": {
|
|
825
|
-
"SixDropdownAutoFilterPayload": {
|
|
826
|
-
"location": "local"
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}, {
|
|
831
|
-
"method": "sixAsyncFilterFired",
|
|
832
|
-
"name": "six-async-filter-fired",
|
|
833
|
-
"bubbles": true,
|
|
834
|
-
"cancelable": true,
|
|
835
|
-
"composed": true,
|
|
836
|
-
"docs": {
|
|
837
|
-
"tags": [],
|
|
838
|
-
"text": "Emitted when the async filter is triggered"
|
|
839
|
-
},
|
|
840
|
-
"complexType": {
|
|
841
|
-
"original": "SixDropdownAsyncFilterPayload",
|
|
842
|
-
"resolved": "SixDropdownAsyncFilterPayload",
|
|
843
|
-
"references": {
|
|
844
|
-
"SixDropdownAsyncFilterPayload": {
|
|
845
|
-
"location": "local"
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}, {
|
|
850
|
-
"method": "sixScroll",
|
|
851
|
-
"name": "six-dropdown-scroll",
|
|
852
|
-
"bubbles": true,
|
|
853
|
-
"cancelable": true,
|
|
854
|
-
"composed": true,
|
|
855
|
-
"docs": {
|
|
856
|
-
"tags": [],
|
|
857
|
-
"text": "Emitted when the user scrolls inside dropdown panel."
|
|
858
|
-
},
|
|
859
|
-
"complexType": {
|
|
860
|
-
"original": "SixDropdownScrollPayload",
|
|
861
|
-
"resolved": "SixDropdownScrollPayload",
|
|
862
|
-
"references": {
|
|
863
|
-
"SixDropdownScrollPayload": {
|
|
864
|
-
"location": "local"
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
}]; }
|
|
869
|
-
static get methods() { return {
|
|
870
|
-
"show": {
|
|
871
|
-
"complexType": {
|
|
872
|
-
"signature": "() => Promise<void>",
|
|
873
|
-
"parameters": [],
|
|
874
|
-
"references": {
|
|
875
|
-
"Promise": {
|
|
876
|
-
"location": "global"
|
|
877
|
-
}
|
|
878
|
-
},
|
|
879
|
-
"return": "Promise<void>"
|
|
880
|
-
},
|
|
881
|
-
"docs": {
|
|
882
|
-
"text": "Shows the dropdown panel",
|
|
883
|
-
"tags": []
|
|
884
|
-
}
|
|
885
|
-
},
|
|
886
|
-
"hide": {
|
|
887
|
-
"complexType": {
|
|
888
|
-
"signature": "() => Promise<void>",
|
|
889
|
-
"parameters": [],
|
|
890
|
-
"references": {
|
|
891
|
-
"Promise": {
|
|
892
|
-
"location": "global"
|
|
893
|
-
}
|
|
894
|
-
},
|
|
895
|
-
"return": "Promise<void>"
|
|
896
|
-
},
|
|
897
|
-
"docs": {
|
|
898
|
-
"text": "Hides the dropdown panel",
|
|
899
|
-
"tags": []
|
|
900
|
-
}
|
|
901
|
-
},
|
|
902
|
-
"reposition": {
|
|
903
|
-
"complexType": {
|
|
904
|
-
"signature": "() => Promise<void>",
|
|
905
|
-
"parameters": [],
|
|
906
|
-
"references": {
|
|
907
|
-
"Promise": {
|
|
908
|
-
"location": "global"
|
|
909
|
-
}
|
|
910
|
-
},
|
|
911
|
-
"return": "Promise<void>"
|
|
912
|
-
},
|
|
913
|
-
"docs": {
|
|
914
|
-
"text": "Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu\nis activated.",
|
|
915
|
-
"tags": []
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
}; }
|
|
919
|
-
static get elementRef() { return "host"; }
|
|
920
|
-
static get watchers() { return [{
|
|
921
|
-
"propName": "open",
|
|
922
|
-
"methodName": "handleOpenChange"
|
|
923
|
-
}, {
|
|
924
|
-
"propName": "distance",
|
|
925
|
-
"methodName": "handlePopoverOptionsChange"
|
|
926
|
-
}, {
|
|
927
|
-
"propName": "hoist",
|
|
928
|
-
"methodName": "handlePopoverOptionsChange"
|
|
929
|
-
}, {
|
|
930
|
-
"propName": "placement",
|
|
931
|
-
"methodName": "handlePopoverOptionsChange"
|
|
932
|
-
}, {
|
|
933
|
-
"propName": "skidding",
|
|
934
|
-
"methodName": "handlePopoverOptionsChange"
|
|
935
|
-
}, {
|
|
936
|
-
"propName": "options",
|
|
937
|
-
"methodName": "handleOptionsChange"
|
|
938
|
-
}]; }
|
|
939
|
-
}
|
|
1
|
+
import { Component, Element, Event, h, Method, Prop, State, Watch } from '@stencil/core';
|
|
2
|
+
import { scrollIntoView } from '../../utils/scroll';
|
|
3
|
+
import { getNearestTabbableElement } from '../../utils/tabbable';
|
|
4
|
+
import Popover from '../../utils/popover';
|
|
5
|
+
import { EventListeners } from '../../utils/event-listeners';
|
|
6
|
+
import { getSlotChildren } from '../../utils/slot';
|
|
7
|
+
import { debounce, DEFAULT_DEBOUNCE_FAST } from '../../utils/execution-control';
|
|
8
|
+
const isTagName = (name) => (el) => (el === null || el === void 0 ? void 0 : el.tagName.toLowerCase()) === name.toLowerCase();
|
|
9
|
+
const isSixMenu = isTagName('six-menu');
|
|
10
|
+
const isSixMenuItem = isTagName('six-menu-item');
|
|
11
|
+
let id = 0;
|
|
12
|
+
/**
|
|
13
|
+
* @since 1.0
|
|
14
|
+
* @status stable
|
|
15
|
+
*
|
|
16
|
+
* Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.
|
|
17
|
+
*
|
|
18
|
+
* @slot trigger - The dropdown's trigger, usually a `<six-button>` element.
|
|
19
|
+
* @slot - The dropdown's content.
|
|
20
|
+
*
|
|
21
|
+
* @part base - The component's base wrapper.
|
|
22
|
+
* @part trigger - The container that wraps the trigger.
|
|
23
|
+
* @part panel - The panel that gets shown when the dropdown is open.
|
|
24
|
+
*/
|
|
25
|
+
export class SixDropdown {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.componentId = `dropdown-${++id}`;
|
|
28
|
+
this.isVisible = false;
|
|
29
|
+
this.hasBeenInitialized = false;
|
|
30
|
+
/** Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods. */
|
|
31
|
+
this.open = false;
|
|
32
|
+
/**
|
|
33
|
+
* The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel
|
|
34
|
+
* inside of the viewport.
|
|
35
|
+
*/
|
|
36
|
+
this.placement = 'bottom-start';
|
|
37
|
+
/** Determines whether the dropdown should hide when a menu item is selected. */
|
|
38
|
+
this.closeOnSelect = true;
|
|
39
|
+
/** The distance in pixels from which to offset the panel away from its trigger. */
|
|
40
|
+
this.distance = 0;
|
|
41
|
+
/** The distance in pixels from which to offset the panel along its trigger. */
|
|
42
|
+
this.skidding = 0;
|
|
43
|
+
/**
|
|
44
|
+
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
45
|
+
* `overflow: auto|scroll`.
|
|
46
|
+
*/
|
|
47
|
+
this.hoist = false;
|
|
48
|
+
/**
|
|
49
|
+
* Set to true to allow auto filtering for entries in the dropdown.
|
|
50
|
+
* With this flag the dropdown will automatically filter itsel.
|
|
51
|
+
* If you need to coordinate the shown elements yourself,
|
|
52
|
+
* e.g. because you need to call an endpoint use asyncFilter instead
|
|
53
|
+
*/
|
|
54
|
+
this.filter = false;
|
|
55
|
+
/**
|
|
56
|
+
* Set to true to allow async filtering.
|
|
57
|
+
* When you enter something in the search field the component will only emit an event but not filter any elements itself.
|
|
58
|
+
* You can then simply listen to the 'six-async-filter-fired' event to manage the shown menu-items yourself
|
|
59
|
+
*/
|
|
60
|
+
this.asyncFilter = false;
|
|
61
|
+
/** The filter's placeholder text. */
|
|
62
|
+
this.filterPlaceholder = 'Filter...';
|
|
63
|
+
/** By default the search field will be focused when opening a dropdown with filtering enabled. */
|
|
64
|
+
this.autofocusFilter = true;
|
|
65
|
+
/** The debounce for the filter callbacks. */
|
|
66
|
+
this.filterDebounce = DEFAULT_DEBOUNCE_FAST;
|
|
67
|
+
/** The panel can be opend/closed by pressing the spacebar or the enter key. In some cases you might want to avoid this */
|
|
68
|
+
this.disableHideOnEnterAndSpace = false;
|
|
69
|
+
/** Set the options to be shown in the dropdown (alternative to setting the elements via html)*/
|
|
70
|
+
this.options = null;
|
|
71
|
+
/** Defines whether the menu list will be rendered virtually i.e. only the elements actually shown (and a couple around)
|
|
72
|
+
* are actually rendered in the DOM. If you use virtual scrolling pass the elements via prop instead of via slot. */
|
|
73
|
+
this.virtualScroll = false;
|
|
74
|
+
this.eventListeners = new EventListeners();
|
|
75
|
+
// internal representation of options, so we don't have to make options mutable
|
|
76
|
+
this._options = null;
|
|
77
|
+
this.getMenuItems = () => {
|
|
78
|
+
if (this._options !== null) {
|
|
79
|
+
return this._options.map((option) => h("six-menu-item", { value: option.value }, option.label));
|
|
80
|
+
}
|
|
81
|
+
const [panel] = getSlotChildren(this.panel);
|
|
82
|
+
// the menu-items can be in a slot e.g. in six-select or direct children of the panel
|
|
83
|
+
return getSlotChildren(panel) || Array.from(panel.querySelectorAll('six-menu-item'));
|
|
84
|
+
};
|
|
85
|
+
this.handleFilterInputChange = () => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const lowerCaseFilterTerm = ((_b = (_a = this.filterInputElement.value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.trim()) || '';
|
|
88
|
+
if (this._options) {
|
|
89
|
+
this.handleFilteringForAttributeItems(lowerCaseFilterTerm);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.handleFilteringForSlotItems(lowerCaseFilterTerm);
|
|
93
|
+
}
|
|
94
|
+
this.sixAutoFilterFired.emit({ filterValue: lowerCaseFilterTerm });
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
get hasFilterEnabled() {
|
|
98
|
+
return this.filter || this.asyncFilter;
|
|
99
|
+
}
|
|
100
|
+
get container() {
|
|
101
|
+
return this.containingElement || this.host;
|
|
102
|
+
}
|
|
103
|
+
handleOpenChange() {
|
|
104
|
+
this.open ? this.show() : this.hide();
|
|
105
|
+
this.updateAccessibleTrigger();
|
|
106
|
+
}
|
|
107
|
+
handlePopoverOptionsChange() {
|
|
108
|
+
this.popover.setOptions({
|
|
109
|
+
strategy: this.hoist ? 'fixed' : 'absolute',
|
|
110
|
+
placement: this.placement,
|
|
111
|
+
distance: this.distance,
|
|
112
|
+
skidding: this.skidding,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
handleOptionsChange() {
|
|
116
|
+
this._options = [...this.options];
|
|
117
|
+
}
|
|
118
|
+
connectedCallback() {
|
|
119
|
+
if (this.virtualScroll && this.options === null) {
|
|
120
|
+
console.error('Options must be defined when using virtual scrolling');
|
|
121
|
+
}
|
|
122
|
+
if (this.options !== null) {
|
|
123
|
+
this._options = [...this.options];
|
|
124
|
+
}
|
|
125
|
+
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
|
126
|
+
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
|
127
|
+
this.handleMenuItemActivate = this.handleMenuItemActivate.bind(this);
|
|
128
|
+
this.handlePanelSelect = this.handlePanelSelect.bind(this);
|
|
129
|
+
this.handleTriggerClick = this.handleTriggerClick.bind(this);
|
|
130
|
+
this.handleTriggerKeyDown = this.handleTriggerKeyDown.bind(this);
|
|
131
|
+
this.handleTriggerKeyUp = this.handleTriggerKeyUp.bind(this);
|
|
132
|
+
this.handleTriggerSlotChange = this.handleTriggerSlotChange.bind(this);
|
|
133
|
+
this.handleDropdownScroll = this.handleDropdownScroll.bind(this);
|
|
134
|
+
if (this.hasBeenInitialized && !this.popover) {
|
|
135
|
+
// there was a weird bug when using six-dropdown inside an ag-grid filter. When closing the ag-grid filter
|
|
136
|
+
// disconnectedCallback() is executed. However since componentDidLoad() will not be rerendered the popover was had
|
|
137
|
+
// no longer a connected transitionEnd callback to the dropdown. To fix this, we have this sanity check here,
|
|
138
|
+
// to re-initialize the popover in case the component has already been initialized but the popover is undefined.
|
|
139
|
+
this.initializePopover();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
componentDidLoad() {
|
|
143
|
+
this.hasBeenInitialized = true;
|
|
144
|
+
this.initializePopover();
|
|
145
|
+
// Show on init if open
|
|
146
|
+
if (this.open) {
|
|
147
|
+
void this.show();
|
|
148
|
+
}
|
|
149
|
+
if (this.filter) {
|
|
150
|
+
this.setupFiltering(this.handleFilterInputChange);
|
|
151
|
+
}
|
|
152
|
+
else if (this.asyncFilter) {
|
|
153
|
+
this.setupFiltering(() => this.sixAsyncFilterFired.emit({ filterValue: this.filterInputElement.value }));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
initializePopover() {
|
|
157
|
+
const onAfterHide = () => {
|
|
158
|
+
if (this.filter) {
|
|
159
|
+
this.filterInputElement.value = '';
|
|
160
|
+
if (this._options !== null) {
|
|
161
|
+
this._options = [...this.options];
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const menuItems = this.getMenuItems();
|
|
165
|
+
menuItems.forEach((item) => (item.style.display = 'unset'));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
this.sixAfterHide.emit();
|
|
169
|
+
};
|
|
170
|
+
const onAfterShow = async () => {
|
|
171
|
+
if (this.hasFilterEnabled && this.autofocusFilter) {
|
|
172
|
+
// if dropdown filter is enabled we should autofocus the search field
|
|
173
|
+
await this.filterInputElement.setFocus();
|
|
174
|
+
}
|
|
175
|
+
this.sixAfterShow.emit();
|
|
176
|
+
};
|
|
177
|
+
const onTransitionEnd = () => {
|
|
178
|
+
if (!this.open) {
|
|
179
|
+
this.panel.scrollTop = 0;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
this.popover = new Popover(this.trigger, this.positioner, {
|
|
183
|
+
strategy: this.hoist ? 'fixed' : 'absolute',
|
|
184
|
+
placement: this.placement,
|
|
185
|
+
distance: this.distance,
|
|
186
|
+
skidding: this.skidding,
|
|
187
|
+
transitionElement: this.panel,
|
|
188
|
+
onAfterHide,
|
|
189
|
+
onAfterShow,
|
|
190
|
+
onTransitionEnd,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
setupFiltering(callback) {
|
|
194
|
+
this.eventListeners.add(this.filterInputElement, 'six-input-input', debounce(callback, this.filterDebounce));
|
|
195
|
+
}
|
|
196
|
+
handleFilteringForAttributeItems(lowerCaseFilterTerm) {
|
|
197
|
+
if (lowerCaseFilterTerm === '') {
|
|
198
|
+
this._options = [...this.options];
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
this._options = this.options.filter((option) => {
|
|
202
|
+
var _a, _b, _c, _d;
|
|
203
|
+
return (option.label && ((_b = (_a = String(option.label)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(lowerCaseFilterTerm))) ||
|
|
204
|
+
(option.value && ((_d = (_c = String(option.value)) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === null || _d === void 0 ? void 0 : _d.includes(lowerCaseFilterTerm)));
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
handleFilteringForSlotItems(lowerCaseFilterTerm) {
|
|
208
|
+
const menuItems = this.getMenuItems();
|
|
209
|
+
menuItems.forEach((menuItem) => {
|
|
210
|
+
var _a, _b;
|
|
211
|
+
const lowerCaseMenuItemValue = (_a = menuItem === null || menuItem === void 0 ? void 0 : menuItem.value) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
212
|
+
const lowerCaseMenuText = (_b = menuItem === null || menuItem === void 0 ? void 0 : menuItem.innerText) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
213
|
+
// hide all elements which don't contain the entered substring
|
|
214
|
+
const elementContainsFilterTerm = (lowerCaseMenuItemValue === null || lowerCaseMenuItemValue === void 0 ? void 0 : lowerCaseMenuItemValue.includes(lowerCaseFilterTerm)) || (lowerCaseMenuText === null || lowerCaseMenuText === void 0 ? void 0 : lowerCaseMenuText.includes(lowerCaseFilterTerm));
|
|
215
|
+
menuItem.style.display = elementContainsFilterTerm ? 'unset' : 'none';
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
disconnectedCallback() {
|
|
219
|
+
this.eventListeners.removeAll();
|
|
220
|
+
void this.hide();
|
|
221
|
+
this.popover.destroy();
|
|
222
|
+
this.popover = null;
|
|
223
|
+
}
|
|
224
|
+
/** Shows the dropdown panel */
|
|
225
|
+
async show() {
|
|
226
|
+
// Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher
|
|
227
|
+
if (this.isVisible) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const sixShow = this.sixShow.emit();
|
|
231
|
+
if (sixShow.defaultPrevented) {
|
|
232
|
+
this.open = false;
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
this.eventListeners.add(this.panel, 'six-menu-item-selected', this.handlePanelSelect);
|
|
236
|
+
this.eventListeners.add(document, 'keydown', this.handleDocumentKeyDown);
|
|
237
|
+
this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);
|
|
238
|
+
this.isVisible = true;
|
|
239
|
+
this.open = true;
|
|
240
|
+
this.popover.show();
|
|
241
|
+
}
|
|
242
|
+
/** Hides the dropdown panel */
|
|
243
|
+
async hide() {
|
|
244
|
+
// Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher
|
|
245
|
+
if (!this.isVisible) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const sixHide = this.sixHide.emit();
|
|
249
|
+
if (sixHide.defaultPrevented) {
|
|
250
|
+
this.open = true;
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this.eventListeners.remove(this.panel, 'six-menu-item-selected', this.handlePanelSelect);
|
|
254
|
+
this.eventListeners.remove(document, 'keydown', this.handleDocumentKeyDown);
|
|
255
|
+
this.eventListeners.remove(document, 'mousedown', this.handleDocumentMouseDown);
|
|
256
|
+
this.isVisible = false;
|
|
257
|
+
this.open = false;
|
|
258
|
+
this.popover.hide();
|
|
259
|
+
}
|
|
260
|
+
focusOnTrigger() {
|
|
261
|
+
const [trigger] = getSlotChildren(this.trigger);
|
|
262
|
+
if (trigger) {
|
|
263
|
+
if (typeof trigger.setFocus === 'function') {
|
|
264
|
+
trigger.setFocus();
|
|
265
|
+
}
|
|
266
|
+
else if (typeof trigger.focus === 'function') {
|
|
267
|
+
trigger.focus();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
getMenu() {
|
|
272
|
+
const [menu] = getSlotChildren(this.panel).filter(isSixMenu);
|
|
273
|
+
return menu;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu
|
|
277
|
+
* is activated.
|
|
278
|
+
*/
|
|
279
|
+
async reposition() {
|
|
280
|
+
if (!this.open) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
this.popover.reposition();
|
|
284
|
+
}
|
|
285
|
+
handleDocumentKeyDown(event) {
|
|
286
|
+
// Close when escape is pressed
|
|
287
|
+
if (event.key === 'Escape') {
|
|
288
|
+
void this.hide();
|
|
289
|
+
this.focusOnTrigger();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (this.filterInputElement === this.host.shadowRoot.activeElement) {
|
|
293
|
+
if (event.key === 'ArrowDown') {
|
|
294
|
+
const item = this.getMenuItems().find((item) => item.style.display !== 'none');
|
|
295
|
+
if (item) {
|
|
296
|
+
item.setFocus();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// Handle tabbing
|
|
301
|
+
if (event.key === 'Tab') {
|
|
302
|
+
// Tabbing within an open menu should close the dropdown and refocus the trigger
|
|
303
|
+
if (this.open && isSixMenuItem(document.activeElement)) {
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
void this.hide();
|
|
306
|
+
this.focusOnTrigger();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
// Tabbing outside of the containing element closes the panel
|
|
310
|
+
//
|
|
311
|
+
// If the dropdown is used within a shadow DOM, we need to obtain the activeElement within that shadowRoot,
|
|
312
|
+
// otherwise `document.activeElement` will only return the name of the parent shadow DOM element.
|
|
313
|
+
setTimeout(() => {
|
|
314
|
+
var _a;
|
|
315
|
+
const activeElement = this.container.getRootNode() instanceof ShadowRoot
|
|
316
|
+
? (_a = document.activeElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement
|
|
317
|
+
: document.activeElement;
|
|
318
|
+
if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest(this.container.tagName.toLowerCase())) !== this.container) {
|
|
319
|
+
void this.hide();
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
handleDocumentMouseDown(event) {
|
|
326
|
+
// Close when clicking outside of the containing element
|
|
327
|
+
const path = event.composedPath();
|
|
328
|
+
if (!path.includes(this.container)) {
|
|
329
|
+
void this.hide();
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
handleMenuItemActivate(event) {
|
|
334
|
+
const item = event.target;
|
|
335
|
+
scrollIntoView(item, this.panel);
|
|
336
|
+
}
|
|
337
|
+
handlePanelSelect(event) {
|
|
338
|
+
const target = event.target;
|
|
339
|
+
// Hide the dropdown when a menu item is selected
|
|
340
|
+
if (this.closeOnSelect && isSixMenu(target)) {
|
|
341
|
+
void this.hide();
|
|
342
|
+
this.focusOnTrigger();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
handleTriggerClick() {
|
|
346
|
+
this.open ? this.hide() : this.show();
|
|
347
|
+
}
|
|
348
|
+
handleTriggerKeyDown(event) {
|
|
349
|
+
const menu = this.getMenu();
|
|
350
|
+
const menuItems = menu ? [...menu.querySelectorAll('six-menu-item')] : null;
|
|
351
|
+
const firstMenuItem = menuItems[0];
|
|
352
|
+
const lastMenuItem = menuItems[menuItems.length - 1];
|
|
353
|
+
// Close when escape or tab is pressed
|
|
354
|
+
if (event.key === 'Escape') {
|
|
355
|
+
this.focusOnTrigger();
|
|
356
|
+
void this.hide();
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
// When spacebar/enter is pressed, show the panel but don't focus on the menu. This let's the user press the same
|
|
360
|
+
// key again to hide the menu in case they don't want to make a selection.
|
|
361
|
+
if (!this.disableHideOnEnterAndSpace && [' ', 'Enter'].includes(event.key)) {
|
|
362
|
+
event.preventDefault();
|
|
363
|
+
this.open ? void this.hide() : void this.show();
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
// When up/down is pressed, we make the assumption that the user is familiar with the menu and plans to make a
|
|
367
|
+
// selection. Rather than toggle the panel, we focus on the menu (if one exists) and activate the first item for
|
|
368
|
+
// faster navigation.
|
|
369
|
+
if (['ArrowDown', 'ArrowUp'].includes(event.key)) {
|
|
370
|
+
event.preventDefault();
|
|
371
|
+
// Show the menu if it's not already open
|
|
372
|
+
if (!this.open) {
|
|
373
|
+
void this.show();
|
|
374
|
+
}
|
|
375
|
+
// Focus on a menu item
|
|
376
|
+
if (event.key === 'ArrowDown' && firstMenuItem) {
|
|
377
|
+
firstMenuItem.setFocus();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (event.key === 'ArrowUp' && lastMenuItem) {
|
|
381
|
+
lastMenuItem.setFocus();
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
// Other keys bring focus to the menu and initiate type-to-select behavior
|
|
386
|
+
const ignoredKeys = ['Tab', 'Shift', 'Meta', 'Ctrl', 'Alt'];
|
|
387
|
+
if (this.open && menu && !ignoredKeys.includes(event.key)) {
|
|
388
|
+
void menu.typeToSelect(event.key);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
handleTriggerKeyUp(event) {
|
|
393
|
+
// Prevent space from triggering a click event in Firefox
|
|
394
|
+
if (event.key === ' ') {
|
|
395
|
+
event.preventDefault();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
handleTriggerSlotChange() {
|
|
399
|
+
this.updateAccessibleTrigger();
|
|
400
|
+
}
|
|
401
|
+
handleDropdownScroll() {
|
|
402
|
+
this.sixScroll.emit({
|
|
403
|
+
scrollHeight: this.panel.scrollHeight,
|
|
404
|
+
scrollTop: this.panel.scrollTop,
|
|
405
|
+
scrollbarHeight: this.panel.offsetHeight * (this.panel.offsetHeight / this.panel.scrollHeight),
|
|
406
|
+
scrollRatio: this.panel.scrollTop / (this.panel.scrollHeight - this.panel.clientHeight),
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
//
|
|
410
|
+
// Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and
|
|
411
|
+
// `aria-expanded`. These must be applied to the "accessible trigger" (the tabbable portion of the trigger element
|
|
412
|
+
// that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,
|
|
413
|
+
// a child of the slotted element, or an element in the slotted element's shadow root.
|
|
414
|
+
//
|
|
415
|
+
// For example, the accessible trigger of an <sl-button> is a <button> located inside its shadow root.
|
|
416
|
+
//
|
|
417
|
+
// To determine this, we assume the first tabbable element in the trigger slot is the "accessible trigger."
|
|
418
|
+
//
|
|
419
|
+
updateAccessibleTrigger() {
|
|
420
|
+
const [accessibleTrigger] = getSlotChildren(this.trigger).map(getNearestTabbableElement);
|
|
421
|
+
if (accessibleTrigger) {
|
|
422
|
+
accessibleTrigger.setAttribute('aria-haspopup', 'true');
|
|
423
|
+
accessibleTrigger.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
render() {
|
|
427
|
+
return (h("div", { part: "base", id: this.componentId, class: {
|
|
428
|
+
dropdown: true,
|
|
429
|
+
'dropdown--open': this.open,
|
|
430
|
+
} },
|
|
431
|
+
h("span", { part: "trigger", class: "dropdown__trigger", ref: (el) => (this.trigger = el), onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeyDown, onKeyUp: this.handleTriggerKeyUp },
|
|
432
|
+
h("slot", { name: "trigger", onSlotchange: this.handleTriggerSlotChange })),
|
|
433
|
+
h("div", { ref: (el) => (this.positioner = el), class: {
|
|
434
|
+
dropdown__positioner: true,
|
|
435
|
+
dropdown__positioner__filtered: (this.filter || this.asyncFilter) && !this.hoist,
|
|
436
|
+
} },
|
|
437
|
+
this.hasFilterEnabled && (h("six-input", { class: {
|
|
438
|
+
'filter-hidden': !this.open,
|
|
439
|
+
}, "aria-hidden": this.open ? 'false' : 'true', ref: (el) => (this.filterInputElement = el), placeholder: this.filterPlaceholder })),
|
|
440
|
+
h("div", { ref: (el) => (this.panel = el), part: "panel", class: "dropdown__panel", role: "menu", "aria-hidden": this.open ? 'false' : 'true', "aria-labelledby": this.componentId, onScroll: this.handleDropdownScroll },
|
|
441
|
+
h("slot", null),
|
|
442
|
+
this._options && (h("six-menu", { part: "menu", items: this._options, virtualScroll: this.virtualScroll }))))));
|
|
443
|
+
}
|
|
444
|
+
static get is() { return "six-dropdown"; }
|
|
445
|
+
static get encapsulation() { return "shadow"; }
|
|
446
|
+
static get originalStyleUrls() { return {
|
|
447
|
+
"$": ["six-dropdown.scss"]
|
|
448
|
+
}; }
|
|
449
|
+
static get styleUrls() { return {
|
|
450
|
+
"$": ["six-dropdown.css"]
|
|
451
|
+
}; }
|
|
452
|
+
static get properties() { return {
|
|
453
|
+
"open": {
|
|
454
|
+
"type": "boolean",
|
|
455
|
+
"mutable": true,
|
|
456
|
+
"complexType": {
|
|
457
|
+
"original": "boolean",
|
|
458
|
+
"resolved": "boolean",
|
|
459
|
+
"references": {}
|
|
460
|
+
},
|
|
461
|
+
"required": false,
|
|
462
|
+
"optional": false,
|
|
463
|
+
"docs": {
|
|
464
|
+
"tags": [],
|
|
465
|
+
"text": "Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods."
|
|
466
|
+
},
|
|
467
|
+
"attribute": "open",
|
|
468
|
+
"reflect": true,
|
|
469
|
+
"defaultValue": "false"
|
|
470
|
+
},
|
|
471
|
+
"placement": {
|
|
472
|
+
"type": "string",
|
|
473
|
+
"mutable": false,
|
|
474
|
+
"complexType": {
|
|
475
|
+
"original": "| 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end'",
|
|
476
|
+
"resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
477
|
+
"references": {}
|
|
478
|
+
},
|
|
479
|
+
"required": false,
|
|
480
|
+
"optional": false,
|
|
481
|
+
"docs": {
|
|
482
|
+
"tags": [],
|
|
483
|
+
"text": "The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel\ninside of the viewport."
|
|
484
|
+
},
|
|
485
|
+
"attribute": "placement",
|
|
486
|
+
"reflect": false,
|
|
487
|
+
"defaultValue": "'bottom-start'"
|
|
488
|
+
},
|
|
489
|
+
"closeOnSelect": {
|
|
490
|
+
"type": "boolean",
|
|
491
|
+
"mutable": false,
|
|
492
|
+
"complexType": {
|
|
493
|
+
"original": "boolean",
|
|
494
|
+
"resolved": "boolean",
|
|
495
|
+
"references": {}
|
|
496
|
+
},
|
|
497
|
+
"required": false,
|
|
498
|
+
"optional": false,
|
|
499
|
+
"docs": {
|
|
500
|
+
"tags": [],
|
|
501
|
+
"text": "Determines whether the dropdown should hide when a menu item is selected."
|
|
502
|
+
},
|
|
503
|
+
"attribute": "close-on-select",
|
|
504
|
+
"reflect": false,
|
|
505
|
+
"defaultValue": "true"
|
|
506
|
+
},
|
|
507
|
+
"distance": {
|
|
508
|
+
"type": "number",
|
|
509
|
+
"mutable": false,
|
|
510
|
+
"complexType": {
|
|
511
|
+
"original": "number",
|
|
512
|
+
"resolved": "number",
|
|
513
|
+
"references": {}
|
|
514
|
+
},
|
|
515
|
+
"required": false,
|
|
516
|
+
"optional": false,
|
|
517
|
+
"docs": {
|
|
518
|
+
"tags": [],
|
|
519
|
+
"text": "The distance in pixels from which to offset the panel away from its trigger."
|
|
520
|
+
},
|
|
521
|
+
"attribute": "distance",
|
|
522
|
+
"reflect": false,
|
|
523
|
+
"defaultValue": "0"
|
|
524
|
+
},
|
|
525
|
+
"skidding": {
|
|
526
|
+
"type": "number",
|
|
527
|
+
"mutable": false,
|
|
528
|
+
"complexType": {
|
|
529
|
+
"original": "number",
|
|
530
|
+
"resolved": "number",
|
|
531
|
+
"references": {}
|
|
532
|
+
},
|
|
533
|
+
"required": false,
|
|
534
|
+
"optional": false,
|
|
535
|
+
"docs": {
|
|
536
|
+
"tags": [],
|
|
537
|
+
"text": "The distance in pixels from which to offset the panel along its trigger."
|
|
538
|
+
},
|
|
539
|
+
"attribute": "skidding",
|
|
540
|
+
"reflect": false,
|
|
541
|
+
"defaultValue": "0"
|
|
542
|
+
},
|
|
543
|
+
"hoist": {
|
|
544
|
+
"type": "boolean",
|
|
545
|
+
"mutable": false,
|
|
546
|
+
"complexType": {
|
|
547
|
+
"original": "boolean",
|
|
548
|
+
"resolved": "boolean",
|
|
549
|
+
"references": {}
|
|
550
|
+
},
|
|
551
|
+
"required": false,
|
|
552
|
+
"optional": false,
|
|
553
|
+
"docs": {
|
|
554
|
+
"tags": [],
|
|
555
|
+
"text": "Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n`overflow: auto|scroll`."
|
|
556
|
+
},
|
|
557
|
+
"attribute": "hoist",
|
|
558
|
+
"reflect": false,
|
|
559
|
+
"defaultValue": "false"
|
|
560
|
+
},
|
|
561
|
+
"containingElement": {
|
|
562
|
+
"type": "unknown",
|
|
563
|
+
"mutable": false,
|
|
564
|
+
"complexType": {
|
|
565
|
+
"original": "HTMLElement",
|
|
566
|
+
"resolved": "HTMLElement",
|
|
567
|
+
"references": {
|
|
568
|
+
"HTMLElement": {
|
|
569
|
+
"location": "global"
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
"required": false,
|
|
574
|
+
"optional": false,
|
|
575
|
+
"docs": {
|
|
576
|
+
"tags": [],
|
|
577
|
+
"text": "The dropdown will close when the user interacts outside of this element (e.g. clicking)."
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
"filter": {
|
|
581
|
+
"type": "boolean",
|
|
582
|
+
"mutable": false,
|
|
583
|
+
"complexType": {
|
|
584
|
+
"original": "boolean",
|
|
585
|
+
"resolved": "boolean",
|
|
586
|
+
"references": {}
|
|
587
|
+
},
|
|
588
|
+
"required": false,
|
|
589
|
+
"optional": false,
|
|
590
|
+
"docs": {
|
|
591
|
+
"tags": [],
|
|
592
|
+
"text": "Set to true to allow auto filtering for entries in the dropdown.\nWith this flag the dropdown will automatically filter itsel.\nIf you need to coordinate the shown elements yourself,\ne.g. because you need to call an endpoint use asyncFilter instead"
|
|
593
|
+
},
|
|
594
|
+
"attribute": "filter",
|
|
595
|
+
"reflect": false,
|
|
596
|
+
"defaultValue": "false"
|
|
597
|
+
},
|
|
598
|
+
"asyncFilter": {
|
|
599
|
+
"type": "boolean",
|
|
600
|
+
"mutable": false,
|
|
601
|
+
"complexType": {
|
|
602
|
+
"original": "boolean",
|
|
603
|
+
"resolved": "boolean",
|
|
604
|
+
"references": {}
|
|
605
|
+
},
|
|
606
|
+
"required": false,
|
|
607
|
+
"optional": false,
|
|
608
|
+
"docs": {
|
|
609
|
+
"tags": [],
|
|
610
|
+
"text": "Set to true to allow async filtering.\nWhen you enter something in the search field the component will only emit an event but not filter any elements itself.\nYou can then simply listen to the 'six-async-filter-fired' event to manage the shown menu-items yourself"
|
|
611
|
+
},
|
|
612
|
+
"attribute": "async-filter",
|
|
613
|
+
"reflect": false,
|
|
614
|
+
"defaultValue": "false"
|
|
615
|
+
},
|
|
616
|
+
"filterPlaceholder": {
|
|
617
|
+
"type": "string",
|
|
618
|
+
"mutable": false,
|
|
619
|
+
"complexType": {
|
|
620
|
+
"original": "string",
|
|
621
|
+
"resolved": "string",
|
|
622
|
+
"references": {}
|
|
623
|
+
},
|
|
624
|
+
"required": false,
|
|
625
|
+
"optional": false,
|
|
626
|
+
"docs": {
|
|
627
|
+
"tags": [],
|
|
628
|
+
"text": "The filter's placeholder text."
|
|
629
|
+
},
|
|
630
|
+
"attribute": "filter-placeholder",
|
|
631
|
+
"reflect": false,
|
|
632
|
+
"defaultValue": "'Filter...'"
|
|
633
|
+
},
|
|
634
|
+
"autofocusFilter": {
|
|
635
|
+
"type": "boolean",
|
|
636
|
+
"mutable": false,
|
|
637
|
+
"complexType": {
|
|
638
|
+
"original": "boolean",
|
|
639
|
+
"resolved": "boolean",
|
|
640
|
+
"references": {}
|
|
641
|
+
},
|
|
642
|
+
"required": false,
|
|
643
|
+
"optional": false,
|
|
644
|
+
"docs": {
|
|
645
|
+
"tags": [],
|
|
646
|
+
"text": "By default the search field will be focused when opening a dropdown with filtering enabled."
|
|
647
|
+
},
|
|
648
|
+
"attribute": "autofocus-filter",
|
|
649
|
+
"reflect": false,
|
|
650
|
+
"defaultValue": "true"
|
|
651
|
+
},
|
|
652
|
+
"filterDebounce": {
|
|
653
|
+
"type": "number",
|
|
654
|
+
"mutable": false,
|
|
655
|
+
"complexType": {
|
|
656
|
+
"original": "number",
|
|
657
|
+
"resolved": "number",
|
|
658
|
+
"references": {}
|
|
659
|
+
},
|
|
660
|
+
"required": false,
|
|
661
|
+
"optional": false,
|
|
662
|
+
"docs": {
|
|
663
|
+
"tags": [],
|
|
664
|
+
"text": "The debounce for the filter callbacks."
|
|
665
|
+
},
|
|
666
|
+
"attribute": "filter-debounce",
|
|
667
|
+
"reflect": false,
|
|
668
|
+
"defaultValue": "DEFAULT_DEBOUNCE_FAST"
|
|
669
|
+
},
|
|
670
|
+
"disableHideOnEnterAndSpace": {
|
|
671
|
+
"type": "boolean",
|
|
672
|
+
"mutable": false,
|
|
673
|
+
"complexType": {
|
|
674
|
+
"original": "boolean",
|
|
675
|
+
"resolved": "boolean",
|
|
676
|
+
"references": {}
|
|
677
|
+
},
|
|
678
|
+
"required": false,
|
|
679
|
+
"optional": false,
|
|
680
|
+
"docs": {
|
|
681
|
+
"tags": [],
|
|
682
|
+
"text": "The panel can be opend/closed by pressing the spacebar or the enter key. In some cases you might want to avoid this"
|
|
683
|
+
},
|
|
684
|
+
"attribute": "disable-hide-on-enter-and-space",
|
|
685
|
+
"reflect": false,
|
|
686
|
+
"defaultValue": "false"
|
|
687
|
+
},
|
|
688
|
+
"options": {
|
|
689
|
+
"type": "unknown",
|
|
690
|
+
"mutable": false,
|
|
691
|
+
"complexType": {
|
|
692
|
+
"original": "SixMenuItemData[] | null",
|
|
693
|
+
"resolved": "SixMenuItemData[]",
|
|
694
|
+
"references": {
|
|
695
|
+
"SixMenuItemData": {
|
|
696
|
+
"location": "import",
|
|
697
|
+
"path": "../six-menu/six-menu"
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
"required": false,
|
|
702
|
+
"optional": false,
|
|
703
|
+
"docs": {
|
|
704
|
+
"tags": [],
|
|
705
|
+
"text": "Set the options to be shown in the dropdown (alternative to setting the elements via html)"
|
|
706
|
+
},
|
|
707
|
+
"defaultValue": "null"
|
|
708
|
+
},
|
|
709
|
+
"virtualScroll": {
|
|
710
|
+
"type": "boolean",
|
|
711
|
+
"mutable": false,
|
|
712
|
+
"complexType": {
|
|
713
|
+
"original": "boolean",
|
|
714
|
+
"resolved": "boolean",
|
|
715
|
+
"references": {}
|
|
716
|
+
},
|
|
717
|
+
"required": false,
|
|
718
|
+
"optional": false,
|
|
719
|
+
"docs": {
|
|
720
|
+
"tags": [],
|
|
721
|
+
"text": "Defines whether the menu list will be rendered virtually i.e. only the elements actually shown (and a couple around)\nare actually rendered in the DOM. If you use virtual scrolling pass the elements via prop instead of via slot."
|
|
722
|
+
},
|
|
723
|
+
"attribute": "virtual-scroll",
|
|
724
|
+
"reflect": false,
|
|
725
|
+
"defaultValue": "false"
|
|
726
|
+
}
|
|
727
|
+
}; }
|
|
728
|
+
static get states() { return {
|
|
729
|
+
"_options": {}
|
|
730
|
+
}; }
|
|
731
|
+
static get events() { return [{
|
|
732
|
+
"method": "sixShow",
|
|
733
|
+
"name": "six-dropdown-show",
|
|
734
|
+
"bubbles": true,
|
|
735
|
+
"cancelable": true,
|
|
736
|
+
"composed": true,
|
|
737
|
+
"docs": {
|
|
738
|
+
"tags": [],
|
|
739
|
+
"text": "Emitted when the dropdown opens. Calling `event.preventDefault()` will prevent it from being opened."
|
|
740
|
+
},
|
|
741
|
+
"complexType": {
|
|
742
|
+
"original": "EmptyPayload",
|
|
743
|
+
"resolved": "undefined",
|
|
744
|
+
"references": {
|
|
745
|
+
"EmptyPayload": {
|
|
746
|
+
"location": "import",
|
|
747
|
+
"path": "../../utils/types"
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}, {
|
|
752
|
+
"method": "sixAfterShow",
|
|
753
|
+
"name": "six-dropdown-after-show",
|
|
754
|
+
"bubbles": true,
|
|
755
|
+
"cancelable": true,
|
|
756
|
+
"composed": true,
|
|
757
|
+
"docs": {
|
|
758
|
+
"tags": [],
|
|
759
|
+
"text": "Emitted after the dropdown opens and all transitions are complete."
|
|
760
|
+
},
|
|
761
|
+
"complexType": {
|
|
762
|
+
"original": "EmptyPayload",
|
|
763
|
+
"resolved": "undefined",
|
|
764
|
+
"references": {
|
|
765
|
+
"EmptyPayload": {
|
|
766
|
+
"location": "import",
|
|
767
|
+
"path": "../../utils/types"
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}, {
|
|
772
|
+
"method": "sixHide",
|
|
773
|
+
"name": "six-dropdown-hide",
|
|
774
|
+
"bubbles": true,
|
|
775
|
+
"cancelable": true,
|
|
776
|
+
"composed": true,
|
|
777
|
+
"docs": {
|
|
778
|
+
"tags": [],
|
|
779
|
+
"text": "Emitted when the dropdown closes. Calling `event.preventDefault()` will prevent it from being closed."
|
|
780
|
+
},
|
|
781
|
+
"complexType": {
|
|
782
|
+
"original": "EmptyPayload",
|
|
783
|
+
"resolved": "undefined",
|
|
784
|
+
"references": {
|
|
785
|
+
"EmptyPayload": {
|
|
786
|
+
"location": "import",
|
|
787
|
+
"path": "../../utils/types"
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}, {
|
|
792
|
+
"method": "sixAfterHide",
|
|
793
|
+
"name": "six-dropdown-after-hide",
|
|
794
|
+
"bubbles": true,
|
|
795
|
+
"cancelable": true,
|
|
796
|
+
"composed": true,
|
|
797
|
+
"docs": {
|
|
798
|
+
"tags": [],
|
|
799
|
+
"text": "Emitted after the dropdown closes and all transitions are complete."
|
|
800
|
+
},
|
|
801
|
+
"complexType": {
|
|
802
|
+
"original": "EmptyPayload",
|
|
803
|
+
"resolved": "undefined",
|
|
804
|
+
"references": {
|
|
805
|
+
"EmptyPayload": {
|
|
806
|
+
"location": "import",
|
|
807
|
+
"path": "../../utils/types"
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}, {
|
|
812
|
+
"method": "sixAutoFilterFired",
|
|
813
|
+
"name": "six-dropdown-auto-filter-fired",
|
|
814
|
+
"bubbles": true,
|
|
815
|
+
"cancelable": true,
|
|
816
|
+
"composed": true,
|
|
817
|
+
"docs": {
|
|
818
|
+
"tags": [],
|
|
819
|
+
"text": "Emitted when the auto filter is triggered"
|
|
820
|
+
},
|
|
821
|
+
"complexType": {
|
|
822
|
+
"original": "SixDropdownAutoFilterPayload",
|
|
823
|
+
"resolved": "SixDropdownAutoFilterPayload",
|
|
824
|
+
"references": {
|
|
825
|
+
"SixDropdownAutoFilterPayload": {
|
|
826
|
+
"location": "local"
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}, {
|
|
831
|
+
"method": "sixAsyncFilterFired",
|
|
832
|
+
"name": "six-async-filter-fired",
|
|
833
|
+
"bubbles": true,
|
|
834
|
+
"cancelable": true,
|
|
835
|
+
"composed": true,
|
|
836
|
+
"docs": {
|
|
837
|
+
"tags": [],
|
|
838
|
+
"text": "Emitted when the async filter is triggered"
|
|
839
|
+
},
|
|
840
|
+
"complexType": {
|
|
841
|
+
"original": "SixDropdownAsyncFilterPayload",
|
|
842
|
+
"resolved": "SixDropdownAsyncFilterPayload",
|
|
843
|
+
"references": {
|
|
844
|
+
"SixDropdownAsyncFilterPayload": {
|
|
845
|
+
"location": "local"
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}, {
|
|
850
|
+
"method": "sixScroll",
|
|
851
|
+
"name": "six-dropdown-scroll",
|
|
852
|
+
"bubbles": true,
|
|
853
|
+
"cancelable": true,
|
|
854
|
+
"composed": true,
|
|
855
|
+
"docs": {
|
|
856
|
+
"tags": [],
|
|
857
|
+
"text": "Emitted when the user scrolls inside dropdown panel."
|
|
858
|
+
},
|
|
859
|
+
"complexType": {
|
|
860
|
+
"original": "SixDropdownScrollPayload",
|
|
861
|
+
"resolved": "SixDropdownScrollPayload",
|
|
862
|
+
"references": {
|
|
863
|
+
"SixDropdownScrollPayload": {
|
|
864
|
+
"location": "local"
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}]; }
|
|
869
|
+
static get methods() { return {
|
|
870
|
+
"show": {
|
|
871
|
+
"complexType": {
|
|
872
|
+
"signature": "() => Promise<void>",
|
|
873
|
+
"parameters": [],
|
|
874
|
+
"references": {
|
|
875
|
+
"Promise": {
|
|
876
|
+
"location": "global"
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
"return": "Promise<void>"
|
|
880
|
+
},
|
|
881
|
+
"docs": {
|
|
882
|
+
"text": "Shows the dropdown panel",
|
|
883
|
+
"tags": []
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
"hide": {
|
|
887
|
+
"complexType": {
|
|
888
|
+
"signature": "() => Promise<void>",
|
|
889
|
+
"parameters": [],
|
|
890
|
+
"references": {
|
|
891
|
+
"Promise": {
|
|
892
|
+
"location": "global"
|
|
893
|
+
}
|
|
894
|
+
},
|
|
895
|
+
"return": "Promise<void>"
|
|
896
|
+
},
|
|
897
|
+
"docs": {
|
|
898
|
+
"text": "Hides the dropdown panel",
|
|
899
|
+
"tags": []
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
"reposition": {
|
|
903
|
+
"complexType": {
|
|
904
|
+
"signature": "() => Promise<void>",
|
|
905
|
+
"parameters": [],
|
|
906
|
+
"references": {
|
|
907
|
+
"Promise": {
|
|
908
|
+
"location": "global"
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
"return": "Promise<void>"
|
|
912
|
+
},
|
|
913
|
+
"docs": {
|
|
914
|
+
"text": "Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu\nis activated.",
|
|
915
|
+
"tags": []
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}; }
|
|
919
|
+
static get elementRef() { return "host"; }
|
|
920
|
+
static get watchers() { return [{
|
|
921
|
+
"propName": "open",
|
|
922
|
+
"methodName": "handleOpenChange"
|
|
923
|
+
}, {
|
|
924
|
+
"propName": "distance",
|
|
925
|
+
"methodName": "handlePopoverOptionsChange"
|
|
926
|
+
}, {
|
|
927
|
+
"propName": "hoist",
|
|
928
|
+
"methodName": "handlePopoverOptionsChange"
|
|
929
|
+
}, {
|
|
930
|
+
"propName": "placement",
|
|
931
|
+
"methodName": "handlePopoverOptionsChange"
|
|
932
|
+
}, {
|
|
933
|
+
"propName": "skidding",
|
|
934
|
+
"methodName": "handlePopoverOptionsChange"
|
|
935
|
+
}, {
|
|
936
|
+
"propName": "options",
|
|
937
|
+
"methodName": "handleOptionsChange"
|
|
938
|
+
}]; }
|
|
939
|
+
}
|