@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,1105 +1,1105 @@
|
|
|
1
|
-
import { Component, Element, Event, h, Method, Prop, State, Watch } from '@stencil/core';
|
|
2
|
-
import { getTextContent, hasSlot } from '../../utils/slot';
|
|
3
|
-
import FormControl from '../../functional-components/form-control/form-control';
|
|
4
|
-
import { EventListeners } from '../../utils/event-listeners';
|
|
5
|
-
import { debounce, DEFAULT_DEBOUNCE_FAST } from '../../utils/execution-control';
|
|
6
|
-
let id = 0;
|
|
7
|
-
/**
|
|
8
|
-
* @since 1.0
|
|
9
|
-
* @status stable
|
|
10
|
-
*
|
|
11
|
-
* Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.
|
|
12
|
-
*
|
|
13
|
-
* @slot - The select's options in the form of menu items.
|
|
14
|
-
* @slot label - The select's label. Alternatively, you can use the label prop.
|
|
15
|
-
* @slot help-text - Help text that describes how to use the select.
|
|
16
|
-
* @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.
|
|
17
|
-
*
|
|
18
|
-
* @part base - The component's base wrapper.
|
|
19
|
-
* @part clear-button - The input's clear button, exported from six-input.
|
|
20
|
-
* @part form-control - The form control that wraps the label, input, and help text.
|
|
21
|
-
* @part help-text - The select's help text.
|
|
22
|
-
* @part icon - The select's icon.
|
|
23
|
-
* @part label - The select's label.
|
|
24
|
-
* @part menu - The select menu, a six-menu element.
|
|
25
|
-
* @part tag - The multiselect option, a six-tag element.
|
|
26
|
-
* @part tags - The container in which multiselect options are rendered.
|
|
27
|
-
*/
|
|
28
|
-
export class SixSelect {
|
|
29
|
-
constructor() {
|
|
30
|
-
this.inputId = `select-${++id}`;
|
|
31
|
-
this.labelId = `select-label-${id}`;
|
|
32
|
-
this.helpTextId = `select-help-text-${id}`;
|
|
33
|
-
this.errorTextId = `select-error-text-${id}`;
|
|
34
|
-
this.customErrorText = '';
|
|
35
|
-
this.customValidation = false;
|
|
36
|
-
this.eventListeners = new EventListeners();
|
|
37
|
-
this.hasFocus = false;
|
|
38
|
-
this.hasHelpTextSlot = false;
|
|
39
|
-
this.hasErrorTextSlot = false;
|
|
40
|
-
this.hasLabelSlot = false;
|
|
41
|
-
this.isOpen = false;
|
|
42
|
-
this.displayLabel = '';
|
|
43
|
-
this.displayTags = [];
|
|
44
|
-
/** Set to true to enable multiselect. */
|
|
45
|
-
this.multiple = false;
|
|
46
|
-
/**
|
|
47
|
-
* The maximum number of tags to show when `multiple` is true. After the maximum, "+n" will be shown to indicate the
|
|
48
|
-
* number of additional items that are selected. Set to -1 to remove the limit.
|
|
49
|
-
*/
|
|
50
|
-
this.maxTagsVisible = 3;
|
|
51
|
-
/** Set to true to disable the select control. */
|
|
52
|
-
this.disabled = false;
|
|
53
|
-
/** The select's name. */
|
|
54
|
-
this.name = '';
|
|
55
|
-
/** The select's placeholder text. */
|
|
56
|
-
this.placeholder = '';
|
|
57
|
-
/** The debounce for the filter callbacks. */
|
|
58
|
-
this.filterDebounce = DEFAULT_DEBOUNCE_FAST;
|
|
59
|
-
/** The select's size. */
|
|
60
|
-
this.size = 'medium';
|
|
61
|
-
/**
|
|
62
|
-
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
63
|
-
* `overflow: auto|scroll`.
|
|
64
|
-
*/
|
|
65
|
-
this.hoist = false;
|
|
66
|
-
/** The value of the control. This will be a string or an array depending on `multiple`. */
|
|
67
|
-
this.value = '';
|
|
68
|
-
/** Set to true to draw a pill-style select with rounded edges. */
|
|
69
|
-
this.pill = false;
|
|
70
|
-
/** The select's label. Alternatively, you can use the label slot. */
|
|
71
|
-
this.label = '';
|
|
72
|
-
/** The select's help text. Alternatively, you can use the help-text slot. */
|
|
73
|
-
this.helpText = '';
|
|
74
|
-
/** The select's error text. Alternatively, you can use the error-text slot. */
|
|
75
|
-
this.errorText = '';
|
|
76
|
-
/** The select's required attribute. */
|
|
77
|
-
this.required = false;
|
|
78
|
-
/** Set to true to add a clear button when the select is populated. */
|
|
79
|
-
this.clearable = false;
|
|
80
|
-
/** This will be true when the control is in an invalid state. Validity is determined by the `required` prop. */
|
|
81
|
-
this.invalid = false;
|
|
82
|
-
/** Set to render as line */
|
|
83
|
-
this.line = false;
|
|
84
|
-
/** Set to display the error text on blur and not when typing */
|
|
85
|
-
this.errorOnBlur = false;
|
|
86
|
-
/** Set to true to allow filtering for entries in the dropdown */
|
|
87
|
-
this.filter = false;
|
|
88
|
-
/**
|
|
89
|
-
* Set to true to allow async filtering.
|
|
90
|
-
* When you enter something in the search field the component will only emit an event but not filter any elements itself.
|
|
91
|
-
* You can then simply listen to the 'six-async-filter-fired' event to manage the shown menu-items yourself
|
|
92
|
-
*/
|
|
93
|
-
this.asyncFilter = false;
|
|
94
|
-
/**
|
|
95
|
-
* Set to true to turn the six-select into an autocomplete.
|
|
96
|
-
*/
|
|
97
|
-
this.autocomplete = false;
|
|
98
|
-
/** The debounce for when the input changes for autocompletes should be emitted */
|
|
99
|
-
this.inputDebounce = DEFAULT_DEBOUNCE_FAST;
|
|
100
|
-
/** Set the options to be shown in the dropdown (alternative to setting the elements via html) */
|
|
101
|
-
this.options = null;
|
|
102
|
-
/** Defines whether the menu list will be rendered virtually i.e. only the elements actually shown (and a couple around)
|
|
103
|
-
* are actually rendered in the DOM. If you use virtual scrolling pass the elements via prop instead of via slot. */
|
|
104
|
-
this.virtualScroll = false;
|
|
105
|
-
/** The default value the select will be reverted to when reset is executed */
|
|
106
|
-
this.defaultValue = null;
|
|
107
|
-
}
|
|
108
|
-
handleDisabledChange() {
|
|
109
|
-
if (this.disabled && this.isOpen) {
|
|
110
|
-
this.dropdown.hide();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
handleLabelChange() {
|
|
114
|
-
this.handleSlotChange();
|
|
115
|
-
}
|
|
116
|
-
handleMultipleChange() {
|
|
117
|
-
// Cast to array | string based on `this.multiple`
|
|
118
|
-
const value = this.getValueAsArray();
|
|
119
|
-
this.value = this.multiple ? value : value[0] || '';
|
|
120
|
-
this.syncItemsFromValue();
|
|
121
|
-
}
|
|
122
|
-
handleValueChange() {
|
|
123
|
-
this.syncItemsFromValue();
|
|
124
|
-
if (this.input) {
|
|
125
|
-
this.sixChange.emit({ value: this.value, isSelected: true });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
connectedCallback() {
|
|
129
|
-
if (this.virtualScroll && this.options === null) {
|
|
130
|
-
console.error('Options must be defined when using virtual scrolling');
|
|
131
|
-
}
|
|
132
|
-
this.handleBlur = this.handleBlur.bind(this);
|
|
133
|
-
this.handleFocus = this.handleFocus.bind(this);
|
|
134
|
-
this.handleClearClick = this.handleClearClick.bind(this);
|
|
135
|
-
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
136
|
-
this.handleSelectAll = this.handleSelectAll.bind(this);
|
|
137
|
-
this.handleLabelClick = this.handleLabelClick.bind(this);
|
|
138
|
-
this.handleMenuHide = this.handleMenuHide.bind(this);
|
|
139
|
-
this.handleMenuShow = this.handleMenuShow.bind(this);
|
|
140
|
-
this.handleMenuSelect = this.handleMenuSelect.bind(this);
|
|
141
|
-
this.handleSlotChange = this.handleSlotChange.bind(this);
|
|
142
|
-
this.handleInvalid = this.handleInvalid.bind(this);
|
|
143
|
-
this.handleTagInteraction = this.handleTagInteraction.bind(this);
|
|
144
|
-
this.host.shadowRoot.addEventListener('slotchange', this.handleSlotChange);
|
|
145
|
-
}
|
|
146
|
-
componentWillLoad() {
|
|
147
|
-
this.handleSlotChange();
|
|
148
|
-
if (this.multiple && this.value) {
|
|
149
|
-
this.value = this.getValueAsArray();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
componentDidLoad() {
|
|
153
|
-
this.resizeObserver = new ResizeObserver(() => this.resizeMenu());
|
|
154
|
-
// We need to do an initial sync after the component has rendered, so this will suppress the re-render warning
|
|
155
|
-
requestAnimationFrame(() => this.syncItemsFromValue());
|
|
156
|
-
this.eventListeners.add(this.input, 'invalid', async (event) => {
|
|
157
|
-
if (this.customValidation || (!this.hasErrorTextSlot && !this.errorText && !this.customErrorText)) {
|
|
158
|
-
this.customErrorText = await this.input.getValidationMessage();
|
|
159
|
-
}
|
|
160
|
-
event.preventDefault();
|
|
161
|
-
});
|
|
162
|
-
this.eventListeners.add(this.input, 'six-input-input', debounce((event) => {
|
|
163
|
-
const enteredValue = this.input.value;
|
|
164
|
-
this.clearValues();
|
|
165
|
-
this.sixChange.emit({ value: enteredValue, isSelected: false });
|
|
166
|
-
event.stopPropagation();
|
|
167
|
-
}, this.inputDebounce));
|
|
168
|
-
this.input.value = this.hasSelection() ? this.displayLabel : '';
|
|
169
|
-
}
|
|
170
|
-
disconnectedCallback() {
|
|
171
|
-
this.host.shadowRoot.removeEventListener('slotchange', this.handleSlotChange);
|
|
172
|
-
this.eventListeners.removeAll();
|
|
173
|
-
}
|
|
174
|
-
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
175
|
-
async reportValidity() {
|
|
176
|
-
return this.input.reportValidity();
|
|
177
|
-
}
|
|
178
|
-
/** Checks for validity. */
|
|
179
|
-
async checkValidity() {
|
|
180
|
-
return this.input.isValid();
|
|
181
|
-
}
|
|
182
|
-
/** Sets a custom validation message. If `message` is not empty, the field will be considered invalid. */
|
|
183
|
-
async setCustomValidity(message) {
|
|
184
|
-
this.customErrorText = '';
|
|
185
|
-
this.customValidation = message !== '';
|
|
186
|
-
this.input.setCustomValidity(message);
|
|
187
|
-
this.invalid = !this.input.checkValidity();
|
|
188
|
-
}
|
|
189
|
-
/** Resets the formcontrol */
|
|
190
|
-
async reset() {
|
|
191
|
-
this.value = this.defaultValue;
|
|
192
|
-
this.customErrorText = '';
|
|
193
|
-
this.customValidation = false;
|
|
194
|
-
this.input.setCustomValidity('');
|
|
195
|
-
this.invalid = false;
|
|
196
|
-
}
|
|
197
|
-
getItemLabel(item) {
|
|
198
|
-
const slot = item.shadowRoot.querySelector('slot:not([name])');
|
|
199
|
-
if (slot) {
|
|
200
|
-
return getTextContent(slot);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
// bugfix/COMSLI-203-six-select-value-is-not-updated-if-the-slot-is-changed
|
|
204
|
-
return item.textContent;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
getItems() {
|
|
208
|
-
if (this.options !== null) {
|
|
209
|
-
return this.options.map((option) => h("six-menu-item", { value: option.value }, option.label));
|
|
210
|
-
}
|
|
211
|
-
return [...this.host.querySelectorAll('six-menu-item')];
|
|
212
|
-
}
|
|
213
|
-
hasMenuItems() {
|
|
214
|
-
return this.getItems().length > 0;
|
|
215
|
-
}
|
|
216
|
-
getValueAsArray() {
|
|
217
|
-
const values = Array.isArray(this.value) ? this.value : [this.value];
|
|
218
|
-
// enforce that the values are converted to 'string' before the value is compared
|
|
219
|
-
return values.map(String);
|
|
220
|
-
}
|
|
221
|
-
handleBlur() {
|
|
222
|
-
this.hasFocus = false;
|
|
223
|
-
this.sixBlur.emit();
|
|
224
|
-
}
|
|
225
|
-
handleFocus() {
|
|
226
|
-
this.hasFocus = true;
|
|
227
|
-
this.sixFocus.emit();
|
|
228
|
-
}
|
|
229
|
-
handleInvalid() {
|
|
230
|
-
this.invalid = true;
|
|
231
|
-
}
|
|
232
|
-
handleClearClick(event) {
|
|
233
|
-
event.stopPropagation();
|
|
234
|
-
this.clearValues();
|
|
235
|
-
}
|
|
236
|
-
clearValues() {
|
|
237
|
-
var _a;
|
|
238
|
-
this.value = (_a = this.defaultValue) !== null && _a !== void 0 ? _a : (this.multiple ? [] : '');
|
|
239
|
-
this.syncItemsFromValue();
|
|
240
|
-
}
|
|
241
|
-
handleSelectAll(event) {
|
|
242
|
-
const nonFilteredItems = this.getItems().filter((item) => item.style.display !== 'none');
|
|
243
|
-
const keyName = event.key;
|
|
244
|
-
const keyCode = event.code;
|
|
245
|
-
if (keyName === 'Control') {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
if (this.isOpen && this.multiple && keyCode === 'KeyA' && event.ctrlKey) {
|
|
249
|
-
event.preventDefault();
|
|
250
|
-
const hasDeselectedOptions = nonFilteredItems.some((opt) => !opt.disabled && !opt.checked);
|
|
251
|
-
nonFilteredItems
|
|
252
|
-
.filter((option) => !option.disabled)
|
|
253
|
-
.forEach((option) => (option.checked = hasDeselectedOptions));
|
|
254
|
-
const checkedItems = nonFilteredItems.filter((option) => option.checked).map((option) => option.value);
|
|
255
|
-
this.value = hasDeselectedOptions ? checkedItems : [];
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
handleKeyDown(event) {
|
|
259
|
-
const target = event.target;
|
|
260
|
-
const items = this.getItems();
|
|
261
|
-
const firstItem = items[0];
|
|
262
|
-
const lastItem = items[items.length - 1];
|
|
263
|
-
// Ignore key presses on tags
|
|
264
|
-
if (target.tagName.toLowerCase() === 'six-tag') {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
// Tabbing out of the control closes it
|
|
268
|
-
if (event.key === 'Tab') {
|
|
269
|
-
if (this.isOpen) {
|
|
270
|
-
this.dropdown.hide();
|
|
271
|
-
}
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
// Up/down opens the menu
|
|
275
|
-
if (['ArrowDown', 'ArrowUp'].includes(event.key)) {
|
|
276
|
-
event.preventDefault();
|
|
277
|
-
// Show the menu if it's not already open
|
|
278
|
-
if (!this.isOpen) {
|
|
279
|
-
this.dropdown.show();
|
|
280
|
-
}
|
|
281
|
-
// Focus on a menu item
|
|
282
|
-
if (event.key === 'ArrowDown' && firstItem) {
|
|
283
|
-
firstItem.setFocus();
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
if (event.key === 'ArrowUp' && lastItem) {
|
|
287
|
-
lastItem.setFocus();
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
// All other keys open the menu and initiate type to select
|
|
292
|
-
if (!this.isOpen) {
|
|
293
|
-
event.stopPropagation();
|
|
294
|
-
event.preventDefault();
|
|
295
|
-
this.dropdown.show();
|
|
296
|
-
this.menu.typeToSelect(event.key);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
handleLabelClick() {
|
|
300
|
-
this.box.focus();
|
|
301
|
-
}
|
|
302
|
-
handleMenuSelect(event) {
|
|
303
|
-
const item = event.detail.item;
|
|
304
|
-
const getValue = () => {
|
|
305
|
-
if (this.multiple) {
|
|
306
|
-
return this.value.includes(item.value)
|
|
307
|
-
? this.value.filter((v) => v !== item.value)
|
|
308
|
-
: [...this.value, item.value];
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
return item.value;
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
this.value = getValue();
|
|
315
|
-
this.syncItemsFromValue();
|
|
316
|
-
}
|
|
317
|
-
handleMenuShow(event) {
|
|
318
|
-
if (this.disabled) {
|
|
319
|
-
event.preventDefault();
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
this.resizeMenu();
|
|
323
|
-
this.resizeObserver.observe(this.host);
|
|
324
|
-
this.isOpen = true;
|
|
325
|
-
}
|
|
326
|
-
handleMenuHide() {
|
|
327
|
-
this.resizeObserver.unobserve(this.host);
|
|
328
|
-
this.isOpen = false;
|
|
329
|
-
}
|
|
330
|
-
handleSlotChange() {
|
|
331
|
-
this.hasHelpTextSlot = hasSlot(this.host, 'help-text');
|
|
332
|
-
this.hasErrorTextSlot = hasSlot(this.host, 'error-text');
|
|
333
|
-
this.hasLabelSlot = hasSlot(this.host, 'label');
|
|
334
|
-
this.syncItemsFromValue();
|
|
335
|
-
}
|
|
336
|
-
handleTagInteraction(event) {
|
|
337
|
-
// Don't toggle the menu when a tag's clear button is activated
|
|
338
|
-
const path = event.composedPath();
|
|
339
|
-
const clearButton = path.find((el) => {
|
|
340
|
-
if (el instanceof HTMLElement) {
|
|
341
|
-
const element = el;
|
|
342
|
-
return element.classList.contains('tag__clear');
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
if (clearButton) {
|
|
346
|
-
event.stopPropagation();
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
resizeMenu() {
|
|
350
|
-
this.menu.style.minWidth = `${this.box.clientWidth}px`;
|
|
351
|
-
if (this.dropdown) {
|
|
352
|
-
this.dropdown.reposition();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
syncItemsFromValue() {
|
|
356
|
-
const items = this.getItems();
|
|
357
|
-
const value = this.getValueAsArray();
|
|
358
|
-
// Sync checked states
|
|
359
|
-
items.forEach((item) => (item.checked = value.includes(item.value)));
|
|
360
|
-
// Sync display label
|
|
361
|
-
if (this.multiple) {
|
|
362
|
-
const checkedItems = [];
|
|
363
|
-
value.forEach((val) => items.map((item) => (item.value === val ? checkedItems.push(item) : null)));
|
|
364
|
-
this.displayTags = checkedItems.map((item) => {
|
|
365
|
-
return (h("six-tag", { exportparts: "base:tag", type: "primary", size: this.size, pill: this.pill, clearable: true, onClick: this.handleTagInteraction, onKeyDown: this.handleTagInteraction, "onSix-tag-clear": (event) => {
|
|
366
|
-
event.stopPropagation();
|
|
367
|
-
if (!this.disabled) {
|
|
368
|
-
item.checked = false;
|
|
369
|
-
this.syncValueFromItems();
|
|
370
|
-
}
|
|
371
|
-
} }, this.getItemLabel(item)));
|
|
372
|
-
});
|
|
373
|
-
if (this.maxTagsVisible > 0 && this.displayTags.length > this.maxTagsVisible) {
|
|
374
|
-
const total = this.displayTags.length;
|
|
375
|
-
this.displayLabel = '';
|
|
376
|
-
this.displayTags = this.displayTags.slice(0, this.maxTagsVisible);
|
|
377
|
-
this.displayTags.push(h("six-tag", { exportparts: "base:tag", type: "info", size: this.size },
|
|
378
|
-
"+",
|
|
379
|
-
total - this.maxTagsVisible));
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
this.displayLabel = this.extractLabelForSelectedItem(value, items);
|
|
384
|
-
this.displayTags = [];
|
|
385
|
-
}
|
|
386
|
-
const hasSelection = this.hasSelection();
|
|
387
|
-
if (hasSelection) {
|
|
388
|
-
this.touched = true;
|
|
389
|
-
}
|
|
390
|
-
if (this.input && this.touched) {
|
|
391
|
-
if (!this.autocomplete) {
|
|
392
|
-
this.input.value = hasSelection ? this.displayLabel : '';
|
|
393
|
-
}
|
|
394
|
-
else if (hasSelection) {
|
|
395
|
-
this.input.value = Array.isArray(this.value) ? this.value.join(',') : this.value;
|
|
396
|
-
}
|
|
397
|
-
this.invalid = !this.input.checkValidity();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
extractLabelForSelectedItem(value, items) {
|
|
401
|
-
if (value.length === 0 || (value.length === 1 && value[0] === '')) {
|
|
402
|
-
return '';
|
|
403
|
-
}
|
|
404
|
-
if (this.options !== null) {
|
|
405
|
-
const selectedOption = this.options.find((item) => item.value === value[0]);
|
|
406
|
-
return (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) || '';
|
|
407
|
-
}
|
|
408
|
-
const checkedItem = items.find((item) => item.value === value[0]);
|
|
409
|
-
return checkedItem ? this.getItemLabel(checkedItem) : '';
|
|
410
|
-
}
|
|
411
|
-
syncValueFromItems() {
|
|
412
|
-
const items = this.getItems();
|
|
413
|
-
const checkedItems = items.filter((item) => item.checked);
|
|
414
|
-
const checkedValues = checkedItems.map((item) => item.value);
|
|
415
|
-
this.value = this.multiple
|
|
416
|
-
? this.getValueAsArray().filter((val) => checkedValues.includes(val))
|
|
417
|
-
: checkedValues.length > 0
|
|
418
|
-
? checkedValues[0]
|
|
419
|
-
: '';
|
|
420
|
-
}
|
|
421
|
-
displayError() {
|
|
422
|
-
return this.invalid && (!this.errorOnBlur || (!this.hasFocus && !this.isOpen));
|
|
423
|
-
}
|
|
424
|
-
render() {
|
|
425
|
-
var _a;
|
|
426
|
-
const hasSelection = this.hasSelection();
|
|
427
|
-
return (h(FormControl, { inputId: this.inputId, label: this.label, labelId: this.labelId, hasLabelSlot: this.hasLabelSlot, helpTextId: this.helpTextId, helpText: this.helpText, hasHelpTextSlot: this.hasHelpTextSlot, errorTextId: this.errorTextId, errorText: this.customErrorText ? this.customErrorText : this.errorText, hasErrorTextSlot: this.hasErrorTextSlot, size: this.size, onLabelClick: this.handleLabelClick, disabled: this.disabled, required: this.required, displayError: this.displayError() },
|
|
428
|
-
h("six-dropdown", { part: "base", ref: (el) => (this.dropdown = el), hoist: this.hoist, closeOnSelect: !this.multiple, containingElement: this.host, disableHideOnEnterAndSpace: this.autocomplete, class: {
|
|
429
|
-
select: true,
|
|
430
|
-
'select--open': this.isOpen,
|
|
431
|
-
'select--empty': ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === 0,
|
|
432
|
-
'select--focused': this.hasFocus,
|
|
433
|
-
'select--clearable': this.clearable,
|
|
434
|
-
'select--disabled': this.disabled,
|
|
435
|
-
'select--multiple': this.multiple,
|
|
436
|
-
'select--has-tags': this.multiple && hasSelection,
|
|
437
|
-
'select--placeholder-visible': this.displayLabel === '',
|
|
438
|
-
'select--small': this.size === 'small',
|
|
439
|
-
'select--medium': this.size === 'medium',
|
|
440
|
-
'select--large': this.size === 'large',
|
|
441
|
-
'select--pill': this.pill,
|
|
442
|
-
'select--invalid': this.invalid,
|
|
443
|
-
}, onKeyDown: this.handleSelectAll, "onSix-dropdown-show": this.handleMenuShow, "onSix-dropdown-hide": this.handleMenuHide, filterPlaceholder: this.filterPlaceholder, filterDebounce: this.filterDebounce, filter: this.filter, asyncFilter: this.asyncFilter },
|
|
444
|
-
h("div", { slot: "trigger", ref: (el) => (this.box = el), id: this.inputId, class: {
|
|
445
|
-
select__box: true,
|
|
446
|
-
'select__box--line': this.line,
|
|
447
|
-
'select__box--autocomplete': this.autocomplete,
|
|
448
|
-
}, role: "combobox", "aria-labelledby": this.labelId, "aria-describedby": this.helpTextId, "aria-haspopup": "true", "aria-expanded": this.isOpen ? 'true' : 'false', tabIndex: this.disabled ? -1 : 0, onBlur: this.handleBlur, onFocus: this.handleFocus, onKeyDown: this.handleKeyDown },
|
|
449
|
-
h("span", { class: "select__label" }, this.displayTags.length ? (h("span", { part: "tags", class: "select__tags" }, this.displayTags)) : (this.displayLabel || this.placeholder)),
|
|
450
|
-
this.clearable && hasSelection && (h("six-icon-button", { exportparts: "base:clear-button", class: "select__clear", name: "clear", size: "small", onClick: this.handleClearClick, tabindex: "-1" })),
|
|
451
|
-
this.hasMenuItems() && (h("span", { part: "icon", class: "select__icon" },
|
|
452
|
-
h("six-icon", { size: "medium" }, "expand_more"))),
|
|
453
|
-
h("six-input", { ref: (el) => (this.input = el), class: {
|
|
454
|
-
select__input: true,
|
|
455
|
-
'select__hidden-select': !this.autocomplete,
|
|
456
|
-
}, "aria-hidden": "true", required: this.required, onInvalid: this.handleInvalid, onFocus: this.handleFocus, clearable: this.clearable, placeholder: this.placeholder, pill: this.pill, disabled: this.disabled, size: this.size, tabIndex: -1 })),
|
|
457
|
-
h("six-menu", { ref: (el) => (this.menu = el), part: "menu", class: {
|
|
458
|
-
select__menu: true,
|
|
459
|
-
'select__menu--filtered': this.filter || this.asyncFilter,
|
|
460
|
-
'select__menu--hidden': !this.hasMenuItems(),
|
|
461
|
-
}, "onSix-menu-item-selected": this.handleMenuSelect, items: this.options, virtualScroll: this.virtualScroll, "remove-box-shadow": true },
|
|
462
|
-
h("slot", { onSlotchange: this.handleSlotChange })))));
|
|
463
|
-
}
|
|
464
|
-
hasSelection() {
|
|
465
|
-
return this.multiple ? this.value.length > 0 : this.value !== '';
|
|
466
|
-
}
|
|
467
|
-
static get is() { return "six-select"; }
|
|
468
|
-
static get encapsulation() { return "shadow"; }
|
|
469
|
-
static get originalStyleUrls() { return {
|
|
470
|
-
"$": ["six-select.scss"]
|
|
471
|
-
}; }
|
|
472
|
-
static get styleUrls() { return {
|
|
473
|
-
"$": ["six-select.css"]
|
|
474
|
-
}; }
|
|
475
|
-
static get properties() { return {
|
|
476
|
-
"multiple": {
|
|
477
|
-
"type": "boolean",
|
|
478
|
-
"mutable": false,
|
|
479
|
-
"complexType": {
|
|
480
|
-
"original": "boolean",
|
|
481
|
-
"resolved": "boolean",
|
|
482
|
-
"references": {}
|
|
483
|
-
},
|
|
484
|
-
"required": false,
|
|
485
|
-
"optional": false,
|
|
486
|
-
"docs": {
|
|
487
|
-
"tags": [],
|
|
488
|
-
"text": "Set to true to enable multiselect."
|
|
489
|
-
},
|
|
490
|
-
"attribute": "multiple",
|
|
491
|
-
"reflect": false,
|
|
492
|
-
"defaultValue": "false"
|
|
493
|
-
},
|
|
494
|
-
"maxTagsVisible": {
|
|
495
|
-
"type": "number",
|
|
496
|
-
"mutable": false,
|
|
497
|
-
"complexType": {
|
|
498
|
-
"original": "number",
|
|
499
|
-
"resolved": "number",
|
|
500
|
-
"references": {}
|
|
501
|
-
},
|
|
502
|
-
"required": false,
|
|
503
|
-
"optional": false,
|
|
504
|
-
"docs": {
|
|
505
|
-
"tags": [],
|
|
506
|
-
"text": "The maximum number of tags to show when `multiple` is true. After the maximum, \"+n\" will be shown to indicate the\nnumber of additional items that are selected. Set to -1 to remove the limit."
|
|
507
|
-
},
|
|
508
|
-
"attribute": "max-tags-visible",
|
|
509
|
-
"reflect": false,
|
|
510
|
-
"defaultValue": "3"
|
|
511
|
-
},
|
|
512
|
-
"disabled": {
|
|
513
|
-
"type": "boolean",
|
|
514
|
-
"mutable": false,
|
|
515
|
-
"complexType": {
|
|
516
|
-
"original": "boolean",
|
|
517
|
-
"resolved": "boolean",
|
|
518
|
-
"references": {}
|
|
519
|
-
},
|
|
520
|
-
"required": false,
|
|
521
|
-
"optional": false,
|
|
522
|
-
"docs": {
|
|
523
|
-
"tags": [],
|
|
524
|
-
"text": "Set to true to disable the select control."
|
|
525
|
-
},
|
|
526
|
-
"attribute": "disabled",
|
|
527
|
-
"reflect": false,
|
|
528
|
-
"defaultValue": "false"
|
|
529
|
-
},
|
|
530
|
-
"name": {
|
|
531
|
-
"type": "string",
|
|
532
|
-
"mutable": false,
|
|
533
|
-
"complexType": {
|
|
534
|
-
"original": "string",
|
|
535
|
-
"resolved": "string",
|
|
536
|
-
"references": {}
|
|
537
|
-
},
|
|
538
|
-
"required": false,
|
|
539
|
-
"optional": false,
|
|
540
|
-
"docs": {
|
|
541
|
-
"tags": [],
|
|
542
|
-
"text": "The select's name."
|
|
543
|
-
},
|
|
544
|
-
"attribute": "name",
|
|
545
|
-
"reflect": false,
|
|
546
|
-
"defaultValue": "''"
|
|
547
|
-
},
|
|
548
|
-
"placeholder": {
|
|
549
|
-
"type": "string",
|
|
550
|
-
"mutable": false,
|
|
551
|
-
"complexType": {
|
|
552
|
-
"original": "string",
|
|
553
|
-
"resolved": "string",
|
|
554
|
-
"references": {}
|
|
555
|
-
},
|
|
556
|
-
"required": false,
|
|
557
|
-
"optional": false,
|
|
558
|
-
"docs": {
|
|
559
|
-
"tags": [],
|
|
560
|
-
"text": "The select's placeholder text."
|
|
561
|
-
},
|
|
562
|
-
"attribute": "placeholder",
|
|
563
|
-
"reflect": false,
|
|
564
|
-
"defaultValue": "''"
|
|
565
|
-
},
|
|
566
|
-
"filterPlaceholder": {
|
|
567
|
-
"type": "string",
|
|
568
|
-
"mutable": false,
|
|
569
|
-
"complexType": {
|
|
570
|
-
"original": "string",
|
|
571
|
-
"resolved": "string",
|
|
572
|
-
"references": {}
|
|
573
|
-
},
|
|
574
|
-
"required": false,
|
|
575
|
-
"optional": false,
|
|
576
|
-
"docs": {
|
|
577
|
-
"tags": [],
|
|
578
|
-
"text": "The filter's placeholder text."
|
|
579
|
-
},
|
|
580
|
-
"attribute": "filter-placeholder",
|
|
581
|
-
"reflect": false
|
|
582
|
-
},
|
|
583
|
-
"filterDebounce": {
|
|
584
|
-
"type": "number",
|
|
585
|
-
"mutable": false,
|
|
586
|
-
"complexType": {
|
|
587
|
-
"original": "number",
|
|
588
|
-
"resolved": "number",
|
|
589
|
-
"references": {}
|
|
590
|
-
},
|
|
591
|
-
"required": false,
|
|
592
|
-
"optional": false,
|
|
593
|
-
"docs": {
|
|
594
|
-
"tags": [],
|
|
595
|
-
"text": "The debounce for the filter callbacks."
|
|
596
|
-
},
|
|
597
|
-
"attribute": "filter-debounce",
|
|
598
|
-
"reflect": false,
|
|
599
|
-
"defaultValue": "DEFAULT_DEBOUNCE_FAST"
|
|
600
|
-
},
|
|
601
|
-
"size": {
|
|
602
|
-
"type": "string",
|
|
603
|
-
"mutable": false,
|
|
604
|
-
"complexType": {
|
|
605
|
-
"original": "'small' | 'medium' | 'large'",
|
|
606
|
-
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
607
|
-
"references": {}
|
|
608
|
-
},
|
|
609
|
-
"required": false,
|
|
610
|
-
"optional": false,
|
|
611
|
-
"docs": {
|
|
612
|
-
"tags": [],
|
|
613
|
-
"text": "The select's size."
|
|
614
|
-
},
|
|
615
|
-
"attribute": "size",
|
|
616
|
-
"reflect": false,
|
|
617
|
-
"defaultValue": "'medium'"
|
|
618
|
-
},
|
|
619
|
-
"hoist": {
|
|
620
|
-
"type": "boolean",
|
|
621
|
-
"mutable": false,
|
|
622
|
-
"complexType": {
|
|
623
|
-
"original": "boolean",
|
|
624
|
-
"resolved": "boolean",
|
|
625
|
-
"references": {}
|
|
626
|
-
},
|
|
627
|
-
"required": false,
|
|
628
|
-
"optional": false,
|
|
629
|
-
"docs": {
|
|
630
|
-
"tags": [],
|
|
631
|
-
"text": "Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n`overflow: auto|scroll`."
|
|
632
|
-
},
|
|
633
|
-
"attribute": "hoist",
|
|
634
|
-
"reflect": false,
|
|
635
|
-
"defaultValue": "false"
|
|
636
|
-
},
|
|
637
|
-
"value": {
|
|
638
|
-
"type": "string",
|
|
639
|
-
"mutable": true,
|
|
640
|
-
"complexType": {
|
|
641
|
-
"original": "string | string[]",
|
|
642
|
-
"resolved": "string | string[]",
|
|
643
|
-
"references": {}
|
|
644
|
-
},
|
|
645
|
-
"required": false,
|
|
646
|
-
"optional": false,
|
|
647
|
-
"docs": {
|
|
648
|
-
"tags": [],
|
|
649
|
-
"text": "The value of the control. This will be a string or an array depending on `multiple`."
|
|
650
|
-
},
|
|
651
|
-
"attribute": "value",
|
|
652
|
-
"reflect": false,
|
|
653
|
-
"defaultValue": "''"
|
|
654
|
-
},
|
|
655
|
-
"pill": {
|
|
656
|
-
"type": "boolean",
|
|
657
|
-
"mutable": false,
|
|
658
|
-
"complexType": {
|
|
659
|
-
"original": "boolean",
|
|
660
|
-
"resolved": "boolean",
|
|
661
|
-
"references": {}
|
|
662
|
-
},
|
|
663
|
-
"required": false,
|
|
664
|
-
"optional": false,
|
|
665
|
-
"docs": {
|
|
666
|
-
"tags": [],
|
|
667
|
-
"text": "Set to true to draw a pill-style select with rounded edges."
|
|
668
|
-
},
|
|
669
|
-
"attribute": "pill",
|
|
670
|
-
"reflect": false,
|
|
671
|
-
"defaultValue": "false"
|
|
672
|
-
},
|
|
673
|
-
"label": {
|
|
674
|
-
"type": "string",
|
|
675
|
-
"mutable": false,
|
|
676
|
-
"complexType": {
|
|
677
|
-
"original": "string",
|
|
678
|
-
"resolved": "string",
|
|
679
|
-
"references": {}
|
|
680
|
-
},
|
|
681
|
-
"required": false,
|
|
682
|
-
"optional": false,
|
|
683
|
-
"docs": {
|
|
684
|
-
"tags": [],
|
|
685
|
-
"text": "The select's label. Alternatively, you can use the label slot."
|
|
686
|
-
},
|
|
687
|
-
"attribute": "label",
|
|
688
|
-
"reflect": false,
|
|
689
|
-
"defaultValue": "''"
|
|
690
|
-
},
|
|
691
|
-
"helpText": {
|
|
692
|
-
"type": "string",
|
|
693
|
-
"mutable": false,
|
|
694
|
-
"complexType": {
|
|
695
|
-
"original": "string",
|
|
696
|
-
"resolved": "string",
|
|
697
|
-
"references": {}
|
|
698
|
-
},
|
|
699
|
-
"required": false,
|
|
700
|
-
"optional": false,
|
|
701
|
-
"docs": {
|
|
702
|
-
"tags": [],
|
|
703
|
-
"text": "The select's help text. Alternatively, you can use the help-text slot."
|
|
704
|
-
},
|
|
705
|
-
"attribute": "help-text",
|
|
706
|
-
"reflect": false,
|
|
707
|
-
"defaultValue": "''"
|
|
708
|
-
},
|
|
709
|
-
"errorText": {
|
|
710
|
-
"type": "string",
|
|
711
|
-
"mutable": false,
|
|
712
|
-
"complexType": {
|
|
713
|
-
"original": "string",
|
|
714
|
-
"resolved": "string",
|
|
715
|
-
"references": {}
|
|
716
|
-
},
|
|
717
|
-
"required": false,
|
|
718
|
-
"optional": false,
|
|
719
|
-
"docs": {
|
|
720
|
-
"tags": [],
|
|
721
|
-
"text": "The select's error text. Alternatively, you can use the error-text slot."
|
|
722
|
-
},
|
|
723
|
-
"attribute": "error-text",
|
|
724
|
-
"reflect": false,
|
|
725
|
-
"defaultValue": "''"
|
|
726
|
-
},
|
|
727
|
-
"required": {
|
|
728
|
-
"type": "boolean",
|
|
729
|
-
"mutable": false,
|
|
730
|
-
"complexType": {
|
|
731
|
-
"original": "boolean",
|
|
732
|
-
"resolved": "boolean",
|
|
733
|
-
"references": {}
|
|
734
|
-
},
|
|
735
|
-
"required": false,
|
|
736
|
-
"optional": false,
|
|
737
|
-
"docs": {
|
|
738
|
-
"tags": [],
|
|
739
|
-
"text": "The select's required attribute."
|
|
740
|
-
},
|
|
741
|
-
"attribute": "required",
|
|
742
|
-
"reflect": false,
|
|
743
|
-
"defaultValue": "false"
|
|
744
|
-
},
|
|
745
|
-
"clearable": {
|
|
746
|
-
"type": "boolean",
|
|
747
|
-
"mutable": false,
|
|
748
|
-
"complexType": {
|
|
749
|
-
"original": "boolean",
|
|
750
|
-
"resolved": "boolean",
|
|
751
|
-
"references": {}
|
|
752
|
-
},
|
|
753
|
-
"required": false,
|
|
754
|
-
"optional": false,
|
|
755
|
-
"docs": {
|
|
756
|
-
"tags": [],
|
|
757
|
-
"text": "Set to true to add a clear button when the select is populated."
|
|
758
|
-
},
|
|
759
|
-
"attribute": "clearable",
|
|
760
|
-
"reflect": false,
|
|
761
|
-
"defaultValue": "false"
|
|
762
|
-
},
|
|
763
|
-
"invalid": {
|
|
764
|
-
"type": "boolean",
|
|
765
|
-
"mutable": true,
|
|
766
|
-
"complexType": {
|
|
767
|
-
"original": "boolean",
|
|
768
|
-
"resolved": "boolean",
|
|
769
|
-
"references": {}
|
|
770
|
-
},
|
|
771
|
-
"required": false,
|
|
772
|
-
"optional": false,
|
|
773
|
-
"docs": {
|
|
774
|
-
"tags": [],
|
|
775
|
-
"text": "This will be true when the control is in an invalid state. Validity is determined by the `required` prop."
|
|
776
|
-
},
|
|
777
|
-
"attribute": "invalid",
|
|
778
|
-
"reflect": false,
|
|
779
|
-
"defaultValue": "false"
|
|
780
|
-
},
|
|
781
|
-
"line": {
|
|
782
|
-
"type": "boolean",
|
|
783
|
-
"mutable": false,
|
|
784
|
-
"complexType": {
|
|
785
|
-
"original": "boolean",
|
|
786
|
-
"resolved": "boolean",
|
|
787
|
-
"references": {}
|
|
788
|
-
},
|
|
789
|
-
"required": false,
|
|
790
|
-
"optional": false,
|
|
791
|
-
"docs": {
|
|
792
|
-
"tags": [],
|
|
793
|
-
"text": "Set to render as line"
|
|
794
|
-
},
|
|
795
|
-
"attribute": "line",
|
|
796
|
-
"reflect": false,
|
|
797
|
-
"defaultValue": "false"
|
|
798
|
-
},
|
|
799
|
-
"errorOnBlur": {
|
|
800
|
-
"type": "boolean",
|
|
801
|
-
"mutable": false,
|
|
802
|
-
"complexType": {
|
|
803
|
-
"original": "boolean",
|
|
804
|
-
"resolved": "boolean",
|
|
805
|
-
"references": {}
|
|
806
|
-
},
|
|
807
|
-
"required": false,
|
|
808
|
-
"optional": false,
|
|
809
|
-
"docs": {
|
|
810
|
-
"tags": [],
|
|
811
|
-
"text": "Set to display the error text on blur and not when typing"
|
|
812
|
-
},
|
|
813
|
-
"attribute": "error-on-blur",
|
|
814
|
-
"reflect": false,
|
|
815
|
-
"defaultValue": "false"
|
|
816
|
-
},
|
|
817
|
-
"filter": {
|
|
818
|
-
"type": "boolean",
|
|
819
|
-
"mutable": false,
|
|
820
|
-
"complexType": {
|
|
821
|
-
"original": "boolean",
|
|
822
|
-
"resolved": "boolean",
|
|
823
|
-
"references": {}
|
|
824
|
-
},
|
|
825
|
-
"required": false,
|
|
826
|
-
"optional": false,
|
|
827
|
-
"docs": {
|
|
828
|
-
"tags": [],
|
|
829
|
-
"text": "Set to true to allow filtering for entries in the dropdown"
|
|
830
|
-
},
|
|
831
|
-
"attribute": "filter",
|
|
832
|
-
"reflect": false,
|
|
833
|
-
"defaultValue": "false"
|
|
834
|
-
},
|
|
835
|
-
"asyncFilter": {
|
|
836
|
-
"type": "boolean",
|
|
837
|
-
"mutable": false,
|
|
838
|
-
"complexType": {
|
|
839
|
-
"original": "boolean",
|
|
840
|
-
"resolved": "boolean",
|
|
841
|
-
"references": {}
|
|
842
|
-
},
|
|
843
|
-
"required": false,
|
|
844
|
-
"optional": false,
|
|
845
|
-
"docs": {
|
|
846
|
-
"tags": [],
|
|
847
|
-
"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"
|
|
848
|
-
},
|
|
849
|
-
"attribute": "async-filter",
|
|
850
|
-
"reflect": false,
|
|
851
|
-
"defaultValue": "false"
|
|
852
|
-
},
|
|
853
|
-
"autocomplete": {
|
|
854
|
-
"type": "boolean",
|
|
855
|
-
"mutable": false,
|
|
856
|
-
"complexType": {
|
|
857
|
-
"original": "boolean",
|
|
858
|
-
"resolved": "boolean",
|
|
859
|
-
"references": {}
|
|
860
|
-
},
|
|
861
|
-
"required": false,
|
|
862
|
-
"optional": false,
|
|
863
|
-
"docs": {
|
|
864
|
-
"tags": [],
|
|
865
|
-
"text": "Set to true to turn the six-select into an autocomplete."
|
|
866
|
-
},
|
|
867
|
-
"attribute": "autocomplete",
|
|
868
|
-
"reflect": false,
|
|
869
|
-
"defaultValue": "false"
|
|
870
|
-
},
|
|
871
|
-
"inputDebounce": {
|
|
872
|
-
"type": "number",
|
|
873
|
-
"mutable": false,
|
|
874
|
-
"complexType": {
|
|
875
|
-
"original": "number",
|
|
876
|
-
"resolved": "number",
|
|
877
|
-
"references": {}
|
|
878
|
-
},
|
|
879
|
-
"required": false,
|
|
880
|
-
"optional": false,
|
|
881
|
-
"docs": {
|
|
882
|
-
"tags": [],
|
|
883
|
-
"text": "The debounce for when the input changes for autocompletes should be emitted"
|
|
884
|
-
},
|
|
885
|
-
"attribute": "input-debounce",
|
|
886
|
-
"reflect": false,
|
|
887
|
-
"defaultValue": "DEFAULT_DEBOUNCE_FAST"
|
|
888
|
-
},
|
|
889
|
-
"options": {
|
|
890
|
-
"type": "unknown",
|
|
891
|
-
"mutable": false,
|
|
892
|
-
"complexType": {
|
|
893
|
-
"original": "SixMenuItemData[] | null",
|
|
894
|
-
"resolved": "SixMenuItemData[]",
|
|
895
|
-
"references": {
|
|
896
|
-
"SixMenuItemData": {
|
|
897
|
-
"location": "import",
|
|
898
|
-
"path": "../six-menu/six-menu"
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
},
|
|
902
|
-
"required": false,
|
|
903
|
-
"optional": false,
|
|
904
|
-
"docs": {
|
|
905
|
-
"tags": [],
|
|
906
|
-
"text": "Set the options to be shown in the dropdown (alternative to setting the elements via html)"
|
|
907
|
-
},
|
|
908
|
-
"defaultValue": "null"
|
|
909
|
-
},
|
|
910
|
-
"virtualScroll": {
|
|
911
|
-
"type": "boolean",
|
|
912
|
-
"mutable": false,
|
|
913
|
-
"complexType": {
|
|
914
|
-
"original": "boolean",
|
|
915
|
-
"resolved": "boolean",
|
|
916
|
-
"references": {}
|
|
917
|
-
},
|
|
918
|
-
"required": false,
|
|
919
|
-
"optional": false,
|
|
920
|
-
"docs": {
|
|
921
|
-
"tags": [],
|
|
922
|
-
"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."
|
|
923
|
-
},
|
|
924
|
-
"attribute": "virtual-scroll",
|
|
925
|
-
"reflect": false,
|
|
926
|
-
"defaultValue": "false"
|
|
927
|
-
},
|
|
928
|
-
"defaultValue": {
|
|
929
|
-
"type": "string",
|
|
930
|
-
"mutable": false,
|
|
931
|
-
"complexType": {
|
|
932
|
-
"original": "string | string[]",
|
|
933
|
-
"resolved": "string | string[]",
|
|
934
|
-
"references": {}
|
|
935
|
-
},
|
|
936
|
-
"required": false,
|
|
937
|
-
"optional": false,
|
|
938
|
-
"docs": {
|
|
939
|
-
"tags": [],
|
|
940
|
-
"text": "The default value the select will be reverted to when reset is executed"
|
|
941
|
-
},
|
|
942
|
-
"attribute": "default-value",
|
|
943
|
-
"reflect": false,
|
|
944
|
-
"defaultValue": "null"
|
|
945
|
-
}
|
|
946
|
-
}; }
|
|
947
|
-
static get states() { return {
|
|
948
|
-
"hasFocus": {},
|
|
949
|
-
"hasHelpTextSlot": {},
|
|
950
|
-
"hasErrorTextSlot": {},
|
|
951
|
-
"hasLabelSlot": {},
|
|
952
|
-
"isOpen": {},
|
|
953
|
-
"displayLabel": {},
|
|
954
|
-
"displayTags": {}
|
|
955
|
-
}; }
|
|
956
|
-
static get events() { return [{
|
|
957
|
-
"method": "sixChange",
|
|
958
|
-
"name": "six-select-change",
|
|
959
|
-
"bubbles": true,
|
|
960
|
-
"cancelable": true,
|
|
961
|
-
"composed": true,
|
|
962
|
-
"docs": {
|
|
963
|
-
"tags": [],
|
|
964
|
-
"text": "Emitted when the control's value changes."
|
|
965
|
-
},
|
|
966
|
-
"complexType": {
|
|
967
|
-
"original": "SixSelectChangePayload",
|
|
968
|
-
"resolved": "SixSelectChangePayload",
|
|
969
|
-
"references": {
|
|
970
|
-
"SixSelectChangePayload": {
|
|
971
|
-
"location": "local"
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
}, {
|
|
976
|
-
"method": "sixFocus",
|
|
977
|
-
"name": "six-select-focus",
|
|
978
|
-
"bubbles": true,
|
|
979
|
-
"cancelable": true,
|
|
980
|
-
"composed": true,
|
|
981
|
-
"docs": {
|
|
982
|
-
"tags": [],
|
|
983
|
-
"text": "Emitted when the control gains focus."
|
|
984
|
-
},
|
|
985
|
-
"complexType": {
|
|
986
|
-
"original": "EmptyPayload",
|
|
987
|
-
"resolved": "undefined",
|
|
988
|
-
"references": {
|
|
989
|
-
"EmptyPayload": {
|
|
990
|
-
"location": "import",
|
|
991
|
-
"path": "../../utils/types"
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
}, {
|
|
996
|
-
"method": "sixBlur",
|
|
997
|
-
"name": "six-select-blur",
|
|
998
|
-
"bubbles": true,
|
|
999
|
-
"cancelable": true,
|
|
1000
|
-
"composed": true,
|
|
1001
|
-
"docs": {
|
|
1002
|
-
"tags": [],
|
|
1003
|
-
"text": "Emitted when the control loses focus."
|
|
1004
|
-
},
|
|
1005
|
-
"complexType": {
|
|
1006
|
-
"original": "EmptyPayload",
|
|
1007
|
-
"resolved": "undefined",
|
|
1008
|
-
"references": {
|
|
1009
|
-
"EmptyPayload": {
|
|
1010
|
-
"location": "import",
|
|
1011
|
-
"path": "../../utils/types"
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}]; }
|
|
1016
|
-
static get methods() { return {
|
|
1017
|
-
"reportValidity": {
|
|
1018
|
-
"complexType": {
|
|
1019
|
-
"signature": "() => Promise<boolean>",
|
|
1020
|
-
"parameters": [],
|
|
1021
|
-
"references": {
|
|
1022
|
-
"Promise": {
|
|
1023
|
-
"location": "global"
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
"return": "Promise<boolean>"
|
|
1027
|
-
},
|
|
1028
|
-
"docs": {
|
|
1029
|
-
"text": "Checks for validity and shows the browser's validation message if the control is invalid.",
|
|
1030
|
-
"tags": []
|
|
1031
|
-
}
|
|
1032
|
-
},
|
|
1033
|
-
"checkValidity": {
|
|
1034
|
-
"complexType": {
|
|
1035
|
-
"signature": "() => Promise<boolean>",
|
|
1036
|
-
"parameters": [],
|
|
1037
|
-
"references": {
|
|
1038
|
-
"Promise": {
|
|
1039
|
-
"location": "global"
|
|
1040
|
-
}
|
|
1041
|
-
},
|
|
1042
|
-
"return": "Promise<boolean>"
|
|
1043
|
-
},
|
|
1044
|
-
"docs": {
|
|
1045
|
-
"text": "Checks for validity.",
|
|
1046
|
-
"tags": []
|
|
1047
|
-
}
|
|
1048
|
-
},
|
|
1049
|
-
"setCustomValidity": {
|
|
1050
|
-
"complexType": {
|
|
1051
|
-
"signature": "(message: string) => Promise<void>",
|
|
1052
|
-
"parameters": [{
|
|
1053
|
-
"tags": [],
|
|
1054
|
-
"text": ""
|
|
1055
|
-
}],
|
|
1056
|
-
"references": {
|
|
1057
|
-
"Promise": {
|
|
1058
|
-
"location": "global"
|
|
1059
|
-
}
|
|
1060
|
-
},
|
|
1061
|
-
"return": "Promise<void>"
|
|
1062
|
-
},
|
|
1063
|
-
"docs": {
|
|
1064
|
-
"text": "Sets a custom validation message. If `message` is not empty, the field will be considered invalid.",
|
|
1065
|
-
"tags": []
|
|
1066
|
-
}
|
|
1067
|
-
},
|
|
1068
|
-
"reset": {
|
|
1069
|
-
"complexType": {
|
|
1070
|
-
"signature": "() => Promise<void>",
|
|
1071
|
-
"parameters": [],
|
|
1072
|
-
"references": {
|
|
1073
|
-
"Promise": {
|
|
1074
|
-
"location": "global"
|
|
1075
|
-
}
|
|
1076
|
-
},
|
|
1077
|
-
"return": "Promise<void>"
|
|
1078
|
-
},
|
|
1079
|
-
"docs": {
|
|
1080
|
-
"text": "Resets the formcontrol",
|
|
1081
|
-
"tags": []
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
}; }
|
|
1085
|
-
static get elementRef() { return "host"; }
|
|
1086
|
-
static get watchers() { return [{
|
|
1087
|
-
"propName": "disabled",
|
|
1088
|
-
"methodName": "handleDisabledChange"
|
|
1089
|
-
}, {
|
|
1090
|
-
"propName": "helpText",
|
|
1091
|
-
"methodName": "handleLabelChange"
|
|
1092
|
-
}, {
|
|
1093
|
-
"propName": "errorText",
|
|
1094
|
-
"methodName": "handleLabelChange"
|
|
1095
|
-
}, {
|
|
1096
|
-
"propName": "label",
|
|
1097
|
-
"methodName": "handleLabelChange"
|
|
1098
|
-
}, {
|
|
1099
|
-
"propName": "multiple",
|
|
1100
|
-
"methodName": "handleMultipleChange"
|
|
1101
|
-
}, {
|
|
1102
|
-
"propName": "value",
|
|
1103
|
-
"methodName": "handleValueChange"
|
|
1104
|
-
}]; }
|
|
1105
|
-
}
|
|
1
|
+
import { Component, Element, Event, h, Method, Prop, State, Watch } from '@stencil/core';
|
|
2
|
+
import { getTextContent, hasSlot } from '../../utils/slot';
|
|
3
|
+
import FormControl from '../../functional-components/form-control/form-control';
|
|
4
|
+
import { EventListeners } from '../../utils/event-listeners';
|
|
5
|
+
import { debounce, DEFAULT_DEBOUNCE_FAST } from '../../utils/execution-control';
|
|
6
|
+
let id = 0;
|
|
7
|
+
/**
|
|
8
|
+
* @since 1.0
|
|
9
|
+
* @status stable
|
|
10
|
+
*
|
|
11
|
+
* Forked from https://github.com/shoelace-style/shoelace version v2.0.0-beta27.
|
|
12
|
+
*
|
|
13
|
+
* @slot - The select's options in the form of menu items.
|
|
14
|
+
* @slot label - The select's label. Alternatively, you can use the label prop.
|
|
15
|
+
* @slot help-text - Help text that describes how to use the select.
|
|
16
|
+
* @slot error-text - Error text that is shown for validation errors. Alternatively, you can use the error-text prop.
|
|
17
|
+
*
|
|
18
|
+
* @part base - The component's base wrapper.
|
|
19
|
+
* @part clear-button - The input's clear button, exported from six-input.
|
|
20
|
+
* @part form-control - The form control that wraps the label, input, and help text.
|
|
21
|
+
* @part help-text - The select's help text.
|
|
22
|
+
* @part icon - The select's icon.
|
|
23
|
+
* @part label - The select's label.
|
|
24
|
+
* @part menu - The select menu, a six-menu element.
|
|
25
|
+
* @part tag - The multiselect option, a six-tag element.
|
|
26
|
+
* @part tags - The container in which multiselect options are rendered.
|
|
27
|
+
*/
|
|
28
|
+
export class SixSelect {
|
|
29
|
+
constructor() {
|
|
30
|
+
this.inputId = `select-${++id}`;
|
|
31
|
+
this.labelId = `select-label-${id}`;
|
|
32
|
+
this.helpTextId = `select-help-text-${id}`;
|
|
33
|
+
this.errorTextId = `select-error-text-${id}`;
|
|
34
|
+
this.customErrorText = '';
|
|
35
|
+
this.customValidation = false;
|
|
36
|
+
this.eventListeners = new EventListeners();
|
|
37
|
+
this.hasFocus = false;
|
|
38
|
+
this.hasHelpTextSlot = false;
|
|
39
|
+
this.hasErrorTextSlot = false;
|
|
40
|
+
this.hasLabelSlot = false;
|
|
41
|
+
this.isOpen = false;
|
|
42
|
+
this.displayLabel = '';
|
|
43
|
+
this.displayTags = [];
|
|
44
|
+
/** Set to true to enable multiselect. */
|
|
45
|
+
this.multiple = false;
|
|
46
|
+
/**
|
|
47
|
+
* The maximum number of tags to show when `multiple` is true. After the maximum, "+n" will be shown to indicate the
|
|
48
|
+
* number of additional items that are selected. Set to -1 to remove the limit.
|
|
49
|
+
*/
|
|
50
|
+
this.maxTagsVisible = 3;
|
|
51
|
+
/** Set to true to disable the select control. */
|
|
52
|
+
this.disabled = false;
|
|
53
|
+
/** The select's name. */
|
|
54
|
+
this.name = '';
|
|
55
|
+
/** The select's placeholder text. */
|
|
56
|
+
this.placeholder = '';
|
|
57
|
+
/** The debounce for the filter callbacks. */
|
|
58
|
+
this.filterDebounce = DEFAULT_DEBOUNCE_FAST;
|
|
59
|
+
/** The select's size. */
|
|
60
|
+
this.size = 'medium';
|
|
61
|
+
/**
|
|
62
|
+
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
63
|
+
* `overflow: auto|scroll`.
|
|
64
|
+
*/
|
|
65
|
+
this.hoist = false;
|
|
66
|
+
/** The value of the control. This will be a string or an array depending on `multiple`. */
|
|
67
|
+
this.value = '';
|
|
68
|
+
/** Set to true to draw a pill-style select with rounded edges. */
|
|
69
|
+
this.pill = false;
|
|
70
|
+
/** The select's label. Alternatively, you can use the label slot. */
|
|
71
|
+
this.label = '';
|
|
72
|
+
/** The select's help text. Alternatively, you can use the help-text slot. */
|
|
73
|
+
this.helpText = '';
|
|
74
|
+
/** The select's error text. Alternatively, you can use the error-text slot. */
|
|
75
|
+
this.errorText = '';
|
|
76
|
+
/** The select's required attribute. */
|
|
77
|
+
this.required = false;
|
|
78
|
+
/** Set to true to add a clear button when the select is populated. */
|
|
79
|
+
this.clearable = false;
|
|
80
|
+
/** This will be true when the control is in an invalid state. Validity is determined by the `required` prop. */
|
|
81
|
+
this.invalid = false;
|
|
82
|
+
/** Set to render as line */
|
|
83
|
+
this.line = false;
|
|
84
|
+
/** Set to display the error text on blur and not when typing */
|
|
85
|
+
this.errorOnBlur = false;
|
|
86
|
+
/** Set to true to allow filtering for entries in the dropdown */
|
|
87
|
+
this.filter = false;
|
|
88
|
+
/**
|
|
89
|
+
* Set to true to allow async filtering.
|
|
90
|
+
* When you enter something in the search field the component will only emit an event but not filter any elements itself.
|
|
91
|
+
* You can then simply listen to the 'six-async-filter-fired' event to manage the shown menu-items yourself
|
|
92
|
+
*/
|
|
93
|
+
this.asyncFilter = false;
|
|
94
|
+
/**
|
|
95
|
+
* Set to true to turn the six-select into an autocomplete.
|
|
96
|
+
*/
|
|
97
|
+
this.autocomplete = false;
|
|
98
|
+
/** The debounce for when the input changes for autocompletes should be emitted */
|
|
99
|
+
this.inputDebounce = DEFAULT_DEBOUNCE_FAST;
|
|
100
|
+
/** Set the options to be shown in the dropdown (alternative to setting the elements via html) */
|
|
101
|
+
this.options = null;
|
|
102
|
+
/** Defines whether the menu list will be rendered virtually i.e. only the elements actually shown (and a couple around)
|
|
103
|
+
* are actually rendered in the DOM. If you use virtual scrolling pass the elements via prop instead of via slot. */
|
|
104
|
+
this.virtualScroll = false;
|
|
105
|
+
/** The default value the select will be reverted to when reset is executed */
|
|
106
|
+
this.defaultValue = null;
|
|
107
|
+
}
|
|
108
|
+
handleDisabledChange() {
|
|
109
|
+
if (this.disabled && this.isOpen) {
|
|
110
|
+
this.dropdown.hide();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
handleLabelChange() {
|
|
114
|
+
this.handleSlotChange();
|
|
115
|
+
}
|
|
116
|
+
handleMultipleChange() {
|
|
117
|
+
// Cast to array | string based on `this.multiple`
|
|
118
|
+
const value = this.getValueAsArray();
|
|
119
|
+
this.value = this.multiple ? value : value[0] || '';
|
|
120
|
+
this.syncItemsFromValue();
|
|
121
|
+
}
|
|
122
|
+
handleValueChange() {
|
|
123
|
+
this.syncItemsFromValue();
|
|
124
|
+
if (this.input) {
|
|
125
|
+
this.sixChange.emit({ value: this.value, isSelected: true });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
connectedCallback() {
|
|
129
|
+
if (this.virtualScroll && this.options === null) {
|
|
130
|
+
console.error('Options must be defined when using virtual scrolling');
|
|
131
|
+
}
|
|
132
|
+
this.handleBlur = this.handleBlur.bind(this);
|
|
133
|
+
this.handleFocus = this.handleFocus.bind(this);
|
|
134
|
+
this.handleClearClick = this.handleClearClick.bind(this);
|
|
135
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
136
|
+
this.handleSelectAll = this.handleSelectAll.bind(this);
|
|
137
|
+
this.handleLabelClick = this.handleLabelClick.bind(this);
|
|
138
|
+
this.handleMenuHide = this.handleMenuHide.bind(this);
|
|
139
|
+
this.handleMenuShow = this.handleMenuShow.bind(this);
|
|
140
|
+
this.handleMenuSelect = this.handleMenuSelect.bind(this);
|
|
141
|
+
this.handleSlotChange = this.handleSlotChange.bind(this);
|
|
142
|
+
this.handleInvalid = this.handleInvalid.bind(this);
|
|
143
|
+
this.handleTagInteraction = this.handleTagInteraction.bind(this);
|
|
144
|
+
this.host.shadowRoot.addEventListener('slotchange', this.handleSlotChange);
|
|
145
|
+
}
|
|
146
|
+
componentWillLoad() {
|
|
147
|
+
this.handleSlotChange();
|
|
148
|
+
if (this.multiple && this.value) {
|
|
149
|
+
this.value = this.getValueAsArray();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
componentDidLoad() {
|
|
153
|
+
this.resizeObserver = new ResizeObserver(() => this.resizeMenu());
|
|
154
|
+
// We need to do an initial sync after the component has rendered, so this will suppress the re-render warning
|
|
155
|
+
requestAnimationFrame(() => this.syncItemsFromValue());
|
|
156
|
+
this.eventListeners.add(this.input, 'invalid', async (event) => {
|
|
157
|
+
if (this.customValidation || (!this.hasErrorTextSlot && !this.errorText && !this.customErrorText)) {
|
|
158
|
+
this.customErrorText = await this.input.getValidationMessage();
|
|
159
|
+
}
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
});
|
|
162
|
+
this.eventListeners.add(this.input, 'six-input-input', debounce((event) => {
|
|
163
|
+
const enteredValue = this.input.value;
|
|
164
|
+
this.clearValues();
|
|
165
|
+
this.sixChange.emit({ value: enteredValue, isSelected: false });
|
|
166
|
+
event.stopPropagation();
|
|
167
|
+
}, this.inputDebounce));
|
|
168
|
+
this.input.value = this.hasSelection() ? this.displayLabel : '';
|
|
169
|
+
}
|
|
170
|
+
disconnectedCallback() {
|
|
171
|
+
this.host.shadowRoot.removeEventListener('slotchange', this.handleSlotChange);
|
|
172
|
+
this.eventListeners.removeAll();
|
|
173
|
+
}
|
|
174
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
175
|
+
async reportValidity() {
|
|
176
|
+
return this.input.reportValidity();
|
|
177
|
+
}
|
|
178
|
+
/** Checks for validity. */
|
|
179
|
+
async checkValidity() {
|
|
180
|
+
return this.input.isValid();
|
|
181
|
+
}
|
|
182
|
+
/** Sets a custom validation message. If `message` is not empty, the field will be considered invalid. */
|
|
183
|
+
async setCustomValidity(message) {
|
|
184
|
+
this.customErrorText = '';
|
|
185
|
+
this.customValidation = message !== '';
|
|
186
|
+
this.input.setCustomValidity(message);
|
|
187
|
+
this.invalid = !this.input.checkValidity();
|
|
188
|
+
}
|
|
189
|
+
/** Resets the formcontrol */
|
|
190
|
+
async reset() {
|
|
191
|
+
this.value = this.defaultValue;
|
|
192
|
+
this.customErrorText = '';
|
|
193
|
+
this.customValidation = false;
|
|
194
|
+
this.input.setCustomValidity('');
|
|
195
|
+
this.invalid = false;
|
|
196
|
+
}
|
|
197
|
+
getItemLabel(item) {
|
|
198
|
+
const slot = item.shadowRoot.querySelector('slot:not([name])');
|
|
199
|
+
if (slot) {
|
|
200
|
+
return getTextContent(slot);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
// bugfix/COMSLI-203-six-select-value-is-not-updated-if-the-slot-is-changed
|
|
204
|
+
return item.textContent;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
getItems() {
|
|
208
|
+
if (this.options !== null) {
|
|
209
|
+
return this.options.map((option) => h("six-menu-item", { value: option.value }, option.label));
|
|
210
|
+
}
|
|
211
|
+
return [...this.host.querySelectorAll('six-menu-item')];
|
|
212
|
+
}
|
|
213
|
+
hasMenuItems() {
|
|
214
|
+
return this.getItems().length > 0;
|
|
215
|
+
}
|
|
216
|
+
getValueAsArray() {
|
|
217
|
+
const values = Array.isArray(this.value) ? this.value : [this.value];
|
|
218
|
+
// enforce that the values are converted to 'string' before the value is compared
|
|
219
|
+
return values.map(String);
|
|
220
|
+
}
|
|
221
|
+
handleBlur() {
|
|
222
|
+
this.hasFocus = false;
|
|
223
|
+
this.sixBlur.emit();
|
|
224
|
+
}
|
|
225
|
+
handleFocus() {
|
|
226
|
+
this.hasFocus = true;
|
|
227
|
+
this.sixFocus.emit();
|
|
228
|
+
}
|
|
229
|
+
handleInvalid() {
|
|
230
|
+
this.invalid = true;
|
|
231
|
+
}
|
|
232
|
+
handleClearClick(event) {
|
|
233
|
+
event.stopPropagation();
|
|
234
|
+
this.clearValues();
|
|
235
|
+
}
|
|
236
|
+
clearValues() {
|
|
237
|
+
var _a;
|
|
238
|
+
this.value = (_a = this.defaultValue) !== null && _a !== void 0 ? _a : (this.multiple ? [] : '');
|
|
239
|
+
this.syncItemsFromValue();
|
|
240
|
+
}
|
|
241
|
+
handleSelectAll(event) {
|
|
242
|
+
const nonFilteredItems = this.getItems().filter((item) => item.style.display !== 'none');
|
|
243
|
+
const keyName = event.key;
|
|
244
|
+
const keyCode = event.code;
|
|
245
|
+
if (keyName === 'Control') {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (this.isOpen && this.multiple && keyCode === 'KeyA' && event.ctrlKey) {
|
|
249
|
+
event.preventDefault();
|
|
250
|
+
const hasDeselectedOptions = nonFilteredItems.some((opt) => !opt.disabled && !opt.checked);
|
|
251
|
+
nonFilteredItems
|
|
252
|
+
.filter((option) => !option.disabled)
|
|
253
|
+
.forEach((option) => (option.checked = hasDeselectedOptions));
|
|
254
|
+
const checkedItems = nonFilteredItems.filter((option) => option.checked).map((option) => option.value);
|
|
255
|
+
this.value = hasDeselectedOptions ? checkedItems : [];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
handleKeyDown(event) {
|
|
259
|
+
const target = event.target;
|
|
260
|
+
const items = this.getItems();
|
|
261
|
+
const firstItem = items[0];
|
|
262
|
+
const lastItem = items[items.length - 1];
|
|
263
|
+
// Ignore key presses on tags
|
|
264
|
+
if (target.tagName.toLowerCase() === 'six-tag') {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
// Tabbing out of the control closes it
|
|
268
|
+
if (event.key === 'Tab') {
|
|
269
|
+
if (this.isOpen) {
|
|
270
|
+
this.dropdown.hide();
|
|
271
|
+
}
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
// Up/down opens the menu
|
|
275
|
+
if (['ArrowDown', 'ArrowUp'].includes(event.key)) {
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
// Show the menu if it's not already open
|
|
278
|
+
if (!this.isOpen) {
|
|
279
|
+
this.dropdown.show();
|
|
280
|
+
}
|
|
281
|
+
// Focus on a menu item
|
|
282
|
+
if (event.key === 'ArrowDown' && firstItem) {
|
|
283
|
+
firstItem.setFocus();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (event.key === 'ArrowUp' && lastItem) {
|
|
287
|
+
lastItem.setFocus();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// All other keys open the menu and initiate type to select
|
|
292
|
+
if (!this.isOpen) {
|
|
293
|
+
event.stopPropagation();
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
this.dropdown.show();
|
|
296
|
+
this.menu.typeToSelect(event.key);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
handleLabelClick() {
|
|
300
|
+
this.box.focus();
|
|
301
|
+
}
|
|
302
|
+
handleMenuSelect(event) {
|
|
303
|
+
const item = event.detail.item;
|
|
304
|
+
const getValue = () => {
|
|
305
|
+
if (this.multiple) {
|
|
306
|
+
return this.value.includes(item.value)
|
|
307
|
+
? this.value.filter((v) => v !== item.value)
|
|
308
|
+
: [...this.value, item.value];
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
return item.value;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
this.value = getValue();
|
|
315
|
+
this.syncItemsFromValue();
|
|
316
|
+
}
|
|
317
|
+
handleMenuShow(event) {
|
|
318
|
+
if (this.disabled) {
|
|
319
|
+
event.preventDefault();
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
this.resizeMenu();
|
|
323
|
+
this.resizeObserver.observe(this.host);
|
|
324
|
+
this.isOpen = true;
|
|
325
|
+
}
|
|
326
|
+
handleMenuHide() {
|
|
327
|
+
this.resizeObserver.unobserve(this.host);
|
|
328
|
+
this.isOpen = false;
|
|
329
|
+
}
|
|
330
|
+
handleSlotChange() {
|
|
331
|
+
this.hasHelpTextSlot = hasSlot(this.host, 'help-text');
|
|
332
|
+
this.hasErrorTextSlot = hasSlot(this.host, 'error-text');
|
|
333
|
+
this.hasLabelSlot = hasSlot(this.host, 'label');
|
|
334
|
+
this.syncItemsFromValue();
|
|
335
|
+
}
|
|
336
|
+
handleTagInteraction(event) {
|
|
337
|
+
// Don't toggle the menu when a tag's clear button is activated
|
|
338
|
+
const path = event.composedPath();
|
|
339
|
+
const clearButton = path.find((el) => {
|
|
340
|
+
if (el instanceof HTMLElement) {
|
|
341
|
+
const element = el;
|
|
342
|
+
return element.classList.contains('tag__clear');
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
if (clearButton) {
|
|
346
|
+
event.stopPropagation();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
resizeMenu() {
|
|
350
|
+
this.menu.style.minWidth = `${this.box.clientWidth}px`;
|
|
351
|
+
if (this.dropdown) {
|
|
352
|
+
this.dropdown.reposition();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
syncItemsFromValue() {
|
|
356
|
+
const items = this.getItems();
|
|
357
|
+
const value = this.getValueAsArray();
|
|
358
|
+
// Sync checked states
|
|
359
|
+
items.forEach((item) => (item.checked = value.includes(item.value)));
|
|
360
|
+
// Sync display label
|
|
361
|
+
if (this.multiple) {
|
|
362
|
+
const checkedItems = [];
|
|
363
|
+
value.forEach((val) => items.map((item) => (item.value === val ? checkedItems.push(item) : null)));
|
|
364
|
+
this.displayTags = checkedItems.map((item) => {
|
|
365
|
+
return (h("six-tag", { exportparts: "base:tag", type: "primary", size: this.size, pill: this.pill, clearable: true, onClick: this.handleTagInteraction, onKeyDown: this.handleTagInteraction, "onSix-tag-clear": (event) => {
|
|
366
|
+
event.stopPropagation();
|
|
367
|
+
if (!this.disabled) {
|
|
368
|
+
item.checked = false;
|
|
369
|
+
this.syncValueFromItems();
|
|
370
|
+
}
|
|
371
|
+
} }, this.getItemLabel(item)));
|
|
372
|
+
});
|
|
373
|
+
if (this.maxTagsVisible > 0 && this.displayTags.length > this.maxTagsVisible) {
|
|
374
|
+
const total = this.displayTags.length;
|
|
375
|
+
this.displayLabel = '';
|
|
376
|
+
this.displayTags = this.displayTags.slice(0, this.maxTagsVisible);
|
|
377
|
+
this.displayTags.push(h("six-tag", { exportparts: "base:tag", type: "info", size: this.size },
|
|
378
|
+
"+",
|
|
379
|
+
total - this.maxTagsVisible));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
this.displayLabel = this.extractLabelForSelectedItem(value, items);
|
|
384
|
+
this.displayTags = [];
|
|
385
|
+
}
|
|
386
|
+
const hasSelection = this.hasSelection();
|
|
387
|
+
if (hasSelection) {
|
|
388
|
+
this.touched = true;
|
|
389
|
+
}
|
|
390
|
+
if (this.input && this.touched) {
|
|
391
|
+
if (!this.autocomplete) {
|
|
392
|
+
this.input.value = hasSelection ? this.displayLabel : '';
|
|
393
|
+
}
|
|
394
|
+
else if (hasSelection) {
|
|
395
|
+
this.input.value = Array.isArray(this.value) ? this.value.join(',') : this.value;
|
|
396
|
+
}
|
|
397
|
+
this.invalid = !this.input.checkValidity();
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
extractLabelForSelectedItem(value, items) {
|
|
401
|
+
if (value.length === 0 || (value.length === 1 && value[0] === '')) {
|
|
402
|
+
return '';
|
|
403
|
+
}
|
|
404
|
+
if (this.options !== null) {
|
|
405
|
+
const selectedOption = this.options.find((item) => item.value === value[0]);
|
|
406
|
+
return (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) || '';
|
|
407
|
+
}
|
|
408
|
+
const checkedItem = items.find((item) => item.value === value[0]);
|
|
409
|
+
return checkedItem ? this.getItemLabel(checkedItem) : '';
|
|
410
|
+
}
|
|
411
|
+
syncValueFromItems() {
|
|
412
|
+
const items = this.getItems();
|
|
413
|
+
const checkedItems = items.filter((item) => item.checked);
|
|
414
|
+
const checkedValues = checkedItems.map((item) => item.value);
|
|
415
|
+
this.value = this.multiple
|
|
416
|
+
? this.getValueAsArray().filter((val) => checkedValues.includes(val))
|
|
417
|
+
: checkedValues.length > 0
|
|
418
|
+
? checkedValues[0]
|
|
419
|
+
: '';
|
|
420
|
+
}
|
|
421
|
+
displayError() {
|
|
422
|
+
return this.invalid && (!this.errorOnBlur || (!this.hasFocus && !this.isOpen));
|
|
423
|
+
}
|
|
424
|
+
render() {
|
|
425
|
+
var _a;
|
|
426
|
+
const hasSelection = this.hasSelection();
|
|
427
|
+
return (h(FormControl, { inputId: this.inputId, label: this.label, labelId: this.labelId, hasLabelSlot: this.hasLabelSlot, helpTextId: this.helpTextId, helpText: this.helpText, hasHelpTextSlot: this.hasHelpTextSlot, errorTextId: this.errorTextId, errorText: this.customErrorText ? this.customErrorText : this.errorText, hasErrorTextSlot: this.hasErrorTextSlot, size: this.size, onLabelClick: this.handleLabelClick, disabled: this.disabled, required: this.required, displayError: this.displayError() },
|
|
428
|
+
h("six-dropdown", { part: "base", ref: (el) => (this.dropdown = el), hoist: this.hoist, closeOnSelect: !this.multiple, containingElement: this.host, disableHideOnEnterAndSpace: this.autocomplete, class: {
|
|
429
|
+
select: true,
|
|
430
|
+
'select--open': this.isOpen,
|
|
431
|
+
'select--empty': ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === 0,
|
|
432
|
+
'select--focused': this.hasFocus,
|
|
433
|
+
'select--clearable': this.clearable,
|
|
434
|
+
'select--disabled': this.disabled,
|
|
435
|
+
'select--multiple': this.multiple,
|
|
436
|
+
'select--has-tags': this.multiple && hasSelection,
|
|
437
|
+
'select--placeholder-visible': this.displayLabel === '',
|
|
438
|
+
'select--small': this.size === 'small',
|
|
439
|
+
'select--medium': this.size === 'medium',
|
|
440
|
+
'select--large': this.size === 'large',
|
|
441
|
+
'select--pill': this.pill,
|
|
442
|
+
'select--invalid': this.invalid,
|
|
443
|
+
}, onKeyDown: this.handleSelectAll, "onSix-dropdown-show": this.handleMenuShow, "onSix-dropdown-hide": this.handleMenuHide, filterPlaceholder: this.filterPlaceholder, filterDebounce: this.filterDebounce, filter: this.filter, asyncFilter: this.asyncFilter },
|
|
444
|
+
h("div", { slot: "trigger", ref: (el) => (this.box = el), id: this.inputId, class: {
|
|
445
|
+
select__box: true,
|
|
446
|
+
'select__box--line': this.line,
|
|
447
|
+
'select__box--autocomplete': this.autocomplete,
|
|
448
|
+
}, role: "combobox", "aria-labelledby": this.labelId, "aria-describedby": this.helpTextId, "aria-haspopup": "true", "aria-expanded": this.isOpen ? 'true' : 'false', tabIndex: this.disabled ? -1 : 0, onBlur: this.handleBlur, onFocus: this.handleFocus, onKeyDown: this.handleKeyDown },
|
|
449
|
+
h("span", { class: "select__label" }, this.displayTags.length ? (h("span", { part: "tags", class: "select__tags" }, this.displayTags)) : (this.displayLabel || this.placeholder)),
|
|
450
|
+
this.clearable && hasSelection && (h("six-icon-button", { exportparts: "base:clear-button", class: "select__clear", name: "clear", size: "small", onClick: this.handleClearClick, tabindex: "-1" })),
|
|
451
|
+
this.hasMenuItems() && (h("span", { part: "icon", class: "select__icon" },
|
|
452
|
+
h("six-icon", { size: "medium" }, "expand_more"))),
|
|
453
|
+
h("six-input", { ref: (el) => (this.input = el), class: {
|
|
454
|
+
select__input: true,
|
|
455
|
+
'select__hidden-select': !this.autocomplete,
|
|
456
|
+
}, "aria-hidden": "true", required: this.required, onInvalid: this.handleInvalid, onFocus: this.handleFocus, clearable: this.clearable, placeholder: this.placeholder, pill: this.pill, disabled: this.disabled, size: this.size, tabIndex: -1 })),
|
|
457
|
+
h("six-menu", { ref: (el) => (this.menu = el), part: "menu", class: {
|
|
458
|
+
select__menu: true,
|
|
459
|
+
'select__menu--filtered': this.filter || this.asyncFilter,
|
|
460
|
+
'select__menu--hidden': !this.hasMenuItems(),
|
|
461
|
+
}, "onSix-menu-item-selected": this.handleMenuSelect, items: this.options, virtualScroll: this.virtualScroll, "remove-box-shadow": true },
|
|
462
|
+
h("slot", { onSlotchange: this.handleSlotChange })))));
|
|
463
|
+
}
|
|
464
|
+
hasSelection() {
|
|
465
|
+
return this.multiple ? this.value.length > 0 : this.value !== '';
|
|
466
|
+
}
|
|
467
|
+
static get is() { return "six-select"; }
|
|
468
|
+
static get encapsulation() { return "shadow"; }
|
|
469
|
+
static get originalStyleUrls() { return {
|
|
470
|
+
"$": ["six-select.scss"]
|
|
471
|
+
}; }
|
|
472
|
+
static get styleUrls() { return {
|
|
473
|
+
"$": ["six-select.css"]
|
|
474
|
+
}; }
|
|
475
|
+
static get properties() { return {
|
|
476
|
+
"multiple": {
|
|
477
|
+
"type": "boolean",
|
|
478
|
+
"mutable": false,
|
|
479
|
+
"complexType": {
|
|
480
|
+
"original": "boolean",
|
|
481
|
+
"resolved": "boolean",
|
|
482
|
+
"references": {}
|
|
483
|
+
},
|
|
484
|
+
"required": false,
|
|
485
|
+
"optional": false,
|
|
486
|
+
"docs": {
|
|
487
|
+
"tags": [],
|
|
488
|
+
"text": "Set to true to enable multiselect."
|
|
489
|
+
},
|
|
490
|
+
"attribute": "multiple",
|
|
491
|
+
"reflect": false,
|
|
492
|
+
"defaultValue": "false"
|
|
493
|
+
},
|
|
494
|
+
"maxTagsVisible": {
|
|
495
|
+
"type": "number",
|
|
496
|
+
"mutable": false,
|
|
497
|
+
"complexType": {
|
|
498
|
+
"original": "number",
|
|
499
|
+
"resolved": "number",
|
|
500
|
+
"references": {}
|
|
501
|
+
},
|
|
502
|
+
"required": false,
|
|
503
|
+
"optional": false,
|
|
504
|
+
"docs": {
|
|
505
|
+
"tags": [],
|
|
506
|
+
"text": "The maximum number of tags to show when `multiple` is true. After the maximum, \"+n\" will be shown to indicate the\nnumber of additional items that are selected. Set to -1 to remove the limit."
|
|
507
|
+
},
|
|
508
|
+
"attribute": "max-tags-visible",
|
|
509
|
+
"reflect": false,
|
|
510
|
+
"defaultValue": "3"
|
|
511
|
+
},
|
|
512
|
+
"disabled": {
|
|
513
|
+
"type": "boolean",
|
|
514
|
+
"mutable": false,
|
|
515
|
+
"complexType": {
|
|
516
|
+
"original": "boolean",
|
|
517
|
+
"resolved": "boolean",
|
|
518
|
+
"references": {}
|
|
519
|
+
},
|
|
520
|
+
"required": false,
|
|
521
|
+
"optional": false,
|
|
522
|
+
"docs": {
|
|
523
|
+
"tags": [],
|
|
524
|
+
"text": "Set to true to disable the select control."
|
|
525
|
+
},
|
|
526
|
+
"attribute": "disabled",
|
|
527
|
+
"reflect": false,
|
|
528
|
+
"defaultValue": "false"
|
|
529
|
+
},
|
|
530
|
+
"name": {
|
|
531
|
+
"type": "string",
|
|
532
|
+
"mutable": false,
|
|
533
|
+
"complexType": {
|
|
534
|
+
"original": "string",
|
|
535
|
+
"resolved": "string",
|
|
536
|
+
"references": {}
|
|
537
|
+
},
|
|
538
|
+
"required": false,
|
|
539
|
+
"optional": false,
|
|
540
|
+
"docs": {
|
|
541
|
+
"tags": [],
|
|
542
|
+
"text": "The select's name."
|
|
543
|
+
},
|
|
544
|
+
"attribute": "name",
|
|
545
|
+
"reflect": false,
|
|
546
|
+
"defaultValue": "''"
|
|
547
|
+
},
|
|
548
|
+
"placeholder": {
|
|
549
|
+
"type": "string",
|
|
550
|
+
"mutable": false,
|
|
551
|
+
"complexType": {
|
|
552
|
+
"original": "string",
|
|
553
|
+
"resolved": "string",
|
|
554
|
+
"references": {}
|
|
555
|
+
},
|
|
556
|
+
"required": false,
|
|
557
|
+
"optional": false,
|
|
558
|
+
"docs": {
|
|
559
|
+
"tags": [],
|
|
560
|
+
"text": "The select's placeholder text."
|
|
561
|
+
},
|
|
562
|
+
"attribute": "placeholder",
|
|
563
|
+
"reflect": false,
|
|
564
|
+
"defaultValue": "''"
|
|
565
|
+
},
|
|
566
|
+
"filterPlaceholder": {
|
|
567
|
+
"type": "string",
|
|
568
|
+
"mutable": false,
|
|
569
|
+
"complexType": {
|
|
570
|
+
"original": "string",
|
|
571
|
+
"resolved": "string",
|
|
572
|
+
"references": {}
|
|
573
|
+
},
|
|
574
|
+
"required": false,
|
|
575
|
+
"optional": false,
|
|
576
|
+
"docs": {
|
|
577
|
+
"tags": [],
|
|
578
|
+
"text": "The filter's placeholder text."
|
|
579
|
+
},
|
|
580
|
+
"attribute": "filter-placeholder",
|
|
581
|
+
"reflect": false
|
|
582
|
+
},
|
|
583
|
+
"filterDebounce": {
|
|
584
|
+
"type": "number",
|
|
585
|
+
"mutable": false,
|
|
586
|
+
"complexType": {
|
|
587
|
+
"original": "number",
|
|
588
|
+
"resolved": "number",
|
|
589
|
+
"references": {}
|
|
590
|
+
},
|
|
591
|
+
"required": false,
|
|
592
|
+
"optional": false,
|
|
593
|
+
"docs": {
|
|
594
|
+
"tags": [],
|
|
595
|
+
"text": "The debounce for the filter callbacks."
|
|
596
|
+
},
|
|
597
|
+
"attribute": "filter-debounce",
|
|
598
|
+
"reflect": false,
|
|
599
|
+
"defaultValue": "DEFAULT_DEBOUNCE_FAST"
|
|
600
|
+
},
|
|
601
|
+
"size": {
|
|
602
|
+
"type": "string",
|
|
603
|
+
"mutable": false,
|
|
604
|
+
"complexType": {
|
|
605
|
+
"original": "'small' | 'medium' | 'large'",
|
|
606
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
607
|
+
"references": {}
|
|
608
|
+
},
|
|
609
|
+
"required": false,
|
|
610
|
+
"optional": false,
|
|
611
|
+
"docs": {
|
|
612
|
+
"tags": [],
|
|
613
|
+
"text": "The select's size."
|
|
614
|
+
},
|
|
615
|
+
"attribute": "size",
|
|
616
|
+
"reflect": false,
|
|
617
|
+
"defaultValue": "'medium'"
|
|
618
|
+
},
|
|
619
|
+
"hoist": {
|
|
620
|
+
"type": "boolean",
|
|
621
|
+
"mutable": false,
|
|
622
|
+
"complexType": {
|
|
623
|
+
"original": "boolean",
|
|
624
|
+
"resolved": "boolean",
|
|
625
|
+
"references": {}
|
|
626
|
+
},
|
|
627
|
+
"required": false,
|
|
628
|
+
"optional": false,
|
|
629
|
+
"docs": {
|
|
630
|
+
"tags": [],
|
|
631
|
+
"text": "Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n`overflow: auto|scroll`."
|
|
632
|
+
},
|
|
633
|
+
"attribute": "hoist",
|
|
634
|
+
"reflect": false,
|
|
635
|
+
"defaultValue": "false"
|
|
636
|
+
},
|
|
637
|
+
"value": {
|
|
638
|
+
"type": "string",
|
|
639
|
+
"mutable": true,
|
|
640
|
+
"complexType": {
|
|
641
|
+
"original": "string | string[]",
|
|
642
|
+
"resolved": "string | string[]",
|
|
643
|
+
"references": {}
|
|
644
|
+
},
|
|
645
|
+
"required": false,
|
|
646
|
+
"optional": false,
|
|
647
|
+
"docs": {
|
|
648
|
+
"tags": [],
|
|
649
|
+
"text": "The value of the control. This will be a string or an array depending on `multiple`."
|
|
650
|
+
},
|
|
651
|
+
"attribute": "value",
|
|
652
|
+
"reflect": false,
|
|
653
|
+
"defaultValue": "''"
|
|
654
|
+
},
|
|
655
|
+
"pill": {
|
|
656
|
+
"type": "boolean",
|
|
657
|
+
"mutable": false,
|
|
658
|
+
"complexType": {
|
|
659
|
+
"original": "boolean",
|
|
660
|
+
"resolved": "boolean",
|
|
661
|
+
"references": {}
|
|
662
|
+
},
|
|
663
|
+
"required": false,
|
|
664
|
+
"optional": false,
|
|
665
|
+
"docs": {
|
|
666
|
+
"tags": [],
|
|
667
|
+
"text": "Set to true to draw a pill-style select with rounded edges."
|
|
668
|
+
},
|
|
669
|
+
"attribute": "pill",
|
|
670
|
+
"reflect": false,
|
|
671
|
+
"defaultValue": "false"
|
|
672
|
+
},
|
|
673
|
+
"label": {
|
|
674
|
+
"type": "string",
|
|
675
|
+
"mutable": false,
|
|
676
|
+
"complexType": {
|
|
677
|
+
"original": "string",
|
|
678
|
+
"resolved": "string",
|
|
679
|
+
"references": {}
|
|
680
|
+
},
|
|
681
|
+
"required": false,
|
|
682
|
+
"optional": false,
|
|
683
|
+
"docs": {
|
|
684
|
+
"tags": [],
|
|
685
|
+
"text": "The select's label. Alternatively, you can use the label slot."
|
|
686
|
+
},
|
|
687
|
+
"attribute": "label",
|
|
688
|
+
"reflect": false,
|
|
689
|
+
"defaultValue": "''"
|
|
690
|
+
},
|
|
691
|
+
"helpText": {
|
|
692
|
+
"type": "string",
|
|
693
|
+
"mutable": false,
|
|
694
|
+
"complexType": {
|
|
695
|
+
"original": "string",
|
|
696
|
+
"resolved": "string",
|
|
697
|
+
"references": {}
|
|
698
|
+
},
|
|
699
|
+
"required": false,
|
|
700
|
+
"optional": false,
|
|
701
|
+
"docs": {
|
|
702
|
+
"tags": [],
|
|
703
|
+
"text": "The select's help text. Alternatively, you can use the help-text slot."
|
|
704
|
+
},
|
|
705
|
+
"attribute": "help-text",
|
|
706
|
+
"reflect": false,
|
|
707
|
+
"defaultValue": "''"
|
|
708
|
+
},
|
|
709
|
+
"errorText": {
|
|
710
|
+
"type": "string",
|
|
711
|
+
"mutable": false,
|
|
712
|
+
"complexType": {
|
|
713
|
+
"original": "string",
|
|
714
|
+
"resolved": "string",
|
|
715
|
+
"references": {}
|
|
716
|
+
},
|
|
717
|
+
"required": false,
|
|
718
|
+
"optional": false,
|
|
719
|
+
"docs": {
|
|
720
|
+
"tags": [],
|
|
721
|
+
"text": "The select's error text. Alternatively, you can use the error-text slot."
|
|
722
|
+
},
|
|
723
|
+
"attribute": "error-text",
|
|
724
|
+
"reflect": false,
|
|
725
|
+
"defaultValue": "''"
|
|
726
|
+
},
|
|
727
|
+
"required": {
|
|
728
|
+
"type": "boolean",
|
|
729
|
+
"mutable": false,
|
|
730
|
+
"complexType": {
|
|
731
|
+
"original": "boolean",
|
|
732
|
+
"resolved": "boolean",
|
|
733
|
+
"references": {}
|
|
734
|
+
},
|
|
735
|
+
"required": false,
|
|
736
|
+
"optional": false,
|
|
737
|
+
"docs": {
|
|
738
|
+
"tags": [],
|
|
739
|
+
"text": "The select's required attribute."
|
|
740
|
+
},
|
|
741
|
+
"attribute": "required",
|
|
742
|
+
"reflect": false,
|
|
743
|
+
"defaultValue": "false"
|
|
744
|
+
},
|
|
745
|
+
"clearable": {
|
|
746
|
+
"type": "boolean",
|
|
747
|
+
"mutable": false,
|
|
748
|
+
"complexType": {
|
|
749
|
+
"original": "boolean",
|
|
750
|
+
"resolved": "boolean",
|
|
751
|
+
"references": {}
|
|
752
|
+
},
|
|
753
|
+
"required": false,
|
|
754
|
+
"optional": false,
|
|
755
|
+
"docs": {
|
|
756
|
+
"tags": [],
|
|
757
|
+
"text": "Set to true to add a clear button when the select is populated."
|
|
758
|
+
},
|
|
759
|
+
"attribute": "clearable",
|
|
760
|
+
"reflect": false,
|
|
761
|
+
"defaultValue": "false"
|
|
762
|
+
},
|
|
763
|
+
"invalid": {
|
|
764
|
+
"type": "boolean",
|
|
765
|
+
"mutable": true,
|
|
766
|
+
"complexType": {
|
|
767
|
+
"original": "boolean",
|
|
768
|
+
"resolved": "boolean",
|
|
769
|
+
"references": {}
|
|
770
|
+
},
|
|
771
|
+
"required": false,
|
|
772
|
+
"optional": false,
|
|
773
|
+
"docs": {
|
|
774
|
+
"tags": [],
|
|
775
|
+
"text": "This will be true when the control is in an invalid state. Validity is determined by the `required` prop."
|
|
776
|
+
},
|
|
777
|
+
"attribute": "invalid",
|
|
778
|
+
"reflect": false,
|
|
779
|
+
"defaultValue": "false"
|
|
780
|
+
},
|
|
781
|
+
"line": {
|
|
782
|
+
"type": "boolean",
|
|
783
|
+
"mutable": false,
|
|
784
|
+
"complexType": {
|
|
785
|
+
"original": "boolean",
|
|
786
|
+
"resolved": "boolean",
|
|
787
|
+
"references": {}
|
|
788
|
+
},
|
|
789
|
+
"required": false,
|
|
790
|
+
"optional": false,
|
|
791
|
+
"docs": {
|
|
792
|
+
"tags": [],
|
|
793
|
+
"text": "Set to render as line"
|
|
794
|
+
},
|
|
795
|
+
"attribute": "line",
|
|
796
|
+
"reflect": false,
|
|
797
|
+
"defaultValue": "false"
|
|
798
|
+
},
|
|
799
|
+
"errorOnBlur": {
|
|
800
|
+
"type": "boolean",
|
|
801
|
+
"mutable": false,
|
|
802
|
+
"complexType": {
|
|
803
|
+
"original": "boolean",
|
|
804
|
+
"resolved": "boolean",
|
|
805
|
+
"references": {}
|
|
806
|
+
},
|
|
807
|
+
"required": false,
|
|
808
|
+
"optional": false,
|
|
809
|
+
"docs": {
|
|
810
|
+
"tags": [],
|
|
811
|
+
"text": "Set to display the error text on blur and not when typing"
|
|
812
|
+
},
|
|
813
|
+
"attribute": "error-on-blur",
|
|
814
|
+
"reflect": false,
|
|
815
|
+
"defaultValue": "false"
|
|
816
|
+
},
|
|
817
|
+
"filter": {
|
|
818
|
+
"type": "boolean",
|
|
819
|
+
"mutable": false,
|
|
820
|
+
"complexType": {
|
|
821
|
+
"original": "boolean",
|
|
822
|
+
"resolved": "boolean",
|
|
823
|
+
"references": {}
|
|
824
|
+
},
|
|
825
|
+
"required": false,
|
|
826
|
+
"optional": false,
|
|
827
|
+
"docs": {
|
|
828
|
+
"tags": [],
|
|
829
|
+
"text": "Set to true to allow filtering for entries in the dropdown"
|
|
830
|
+
},
|
|
831
|
+
"attribute": "filter",
|
|
832
|
+
"reflect": false,
|
|
833
|
+
"defaultValue": "false"
|
|
834
|
+
},
|
|
835
|
+
"asyncFilter": {
|
|
836
|
+
"type": "boolean",
|
|
837
|
+
"mutable": false,
|
|
838
|
+
"complexType": {
|
|
839
|
+
"original": "boolean",
|
|
840
|
+
"resolved": "boolean",
|
|
841
|
+
"references": {}
|
|
842
|
+
},
|
|
843
|
+
"required": false,
|
|
844
|
+
"optional": false,
|
|
845
|
+
"docs": {
|
|
846
|
+
"tags": [],
|
|
847
|
+
"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"
|
|
848
|
+
},
|
|
849
|
+
"attribute": "async-filter",
|
|
850
|
+
"reflect": false,
|
|
851
|
+
"defaultValue": "false"
|
|
852
|
+
},
|
|
853
|
+
"autocomplete": {
|
|
854
|
+
"type": "boolean",
|
|
855
|
+
"mutable": false,
|
|
856
|
+
"complexType": {
|
|
857
|
+
"original": "boolean",
|
|
858
|
+
"resolved": "boolean",
|
|
859
|
+
"references": {}
|
|
860
|
+
},
|
|
861
|
+
"required": false,
|
|
862
|
+
"optional": false,
|
|
863
|
+
"docs": {
|
|
864
|
+
"tags": [],
|
|
865
|
+
"text": "Set to true to turn the six-select into an autocomplete."
|
|
866
|
+
},
|
|
867
|
+
"attribute": "autocomplete",
|
|
868
|
+
"reflect": false,
|
|
869
|
+
"defaultValue": "false"
|
|
870
|
+
},
|
|
871
|
+
"inputDebounce": {
|
|
872
|
+
"type": "number",
|
|
873
|
+
"mutable": false,
|
|
874
|
+
"complexType": {
|
|
875
|
+
"original": "number",
|
|
876
|
+
"resolved": "number",
|
|
877
|
+
"references": {}
|
|
878
|
+
},
|
|
879
|
+
"required": false,
|
|
880
|
+
"optional": false,
|
|
881
|
+
"docs": {
|
|
882
|
+
"tags": [],
|
|
883
|
+
"text": "The debounce for when the input changes for autocompletes should be emitted"
|
|
884
|
+
},
|
|
885
|
+
"attribute": "input-debounce",
|
|
886
|
+
"reflect": false,
|
|
887
|
+
"defaultValue": "DEFAULT_DEBOUNCE_FAST"
|
|
888
|
+
},
|
|
889
|
+
"options": {
|
|
890
|
+
"type": "unknown",
|
|
891
|
+
"mutable": false,
|
|
892
|
+
"complexType": {
|
|
893
|
+
"original": "SixMenuItemData[] | null",
|
|
894
|
+
"resolved": "SixMenuItemData[]",
|
|
895
|
+
"references": {
|
|
896
|
+
"SixMenuItemData": {
|
|
897
|
+
"location": "import",
|
|
898
|
+
"path": "../six-menu/six-menu"
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
"required": false,
|
|
903
|
+
"optional": false,
|
|
904
|
+
"docs": {
|
|
905
|
+
"tags": [],
|
|
906
|
+
"text": "Set the options to be shown in the dropdown (alternative to setting the elements via html)"
|
|
907
|
+
},
|
|
908
|
+
"defaultValue": "null"
|
|
909
|
+
},
|
|
910
|
+
"virtualScroll": {
|
|
911
|
+
"type": "boolean",
|
|
912
|
+
"mutable": false,
|
|
913
|
+
"complexType": {
|
|
914
|
+
"original": "boolean",
|
|
915
|
+
"resolved": "boolean",
|
|
916
|
+
"references": {}
|
|
917
|
+
},
|
|
918
|
+
"required": false,
|
|
919
|
+
"optional": false,
|
|
920
|
+
"docs": {
|
|
921
|
+
"tags": [],
|
|
922
|
+
"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."
|
|
923
|
+
},
|
|
924
|
+
"attribute": "virtual-scroll",
|
|
925
|
+
"reflect": false,
|
|
926
|
+
"defaultValue": "false"
|
|
927
|
+
},
|
|
928
|
+
"defaultValue": {
|
|
929
|
+
"type": "string",
|
|
930
|
+
"mutable": false,
|
|
931
|
+
"complexType": {
|
|
932
|
+
"original": "string | string[]",
|
|
933
|
+
"resolved": "string | string[]",
|
|
934
|
+
"references": {}
|
|
935
|
+
},
|
|
936
|
+
"required": false,
|
|
937
|
+
"optional": false,
|
|
938
|
+
"docs": {
|
|
939
|
+
"tags": [],
|
|
940
|
+
"text": "The default value the select will be reverted to when reset is executed"
|
|
941
|
+
},
|
|
942
|
+
"attribute": "default-value",
|
|
943
|
+
"reflect": false,
|
|
944
|
+
"defaultValue": "null"
|
|
945
|
+
}
|
|
946
|
+
}; }
|
|
947
|
+
static get states() { return {
|
|
948
|
+
"hasFocus": {},
|
|
949
|
+
"hasHelpTextSlot": {},
|
|
950
|
+
"hasErrorTextSlot": {},
|
|
951
|
+
"hasLabelSlot": {},
|
|
952
|
+
"isOpen": {},
|
|
953
|
+
"displayLabel": {},
|
|
954
|
+
"displayTags": {}
|
|
955
|
+
}; }
|
|
956
|
+
static get events() { return [{
|
|
957
|
+
"method": "sixChange",
|
|
958
|
+
"name": "six-select-change",
|
|
959
|
+
"bubbles": true,
|
|
960
|
+
"cancelable": true,
|
|
961
|
+
"composed": true,
|
|
962
|
+
"docs": {
|
|
963
|
+
"tags": [],
|
|
964
|
+
"text": "Emitted when the control's value changes."
|
|
965
|
+
},
|
|
966
|
+
"complexType": {
|
|
967
|
+
"original": "SixSelectChangePayload",
|
|
968
|
+
"resolved": "SixSelectChangePayload",
|
|
969
|
+
"references": {
|
|
970
|
+
"SixSelectChangePayload": {
|
|
971
|
+
"location": "local"
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}, {
|
|
976
|
+
"method": "sixFocus",
|
|
977
|
+
"name": "six-select-focus",
|
|
978
|
+
"bubbles": true,
|
|
979
|
+
"cancelable": true,
|
|
980
|
+
"composed": true,
|
|
981
|
+
"docs": {
|
|
982
|
+
"tags": [],
|
|
983
|
+
"text": "Emitted when the control gains focus."
|
|
984
|
+
},
|
|
985
|
+
"complexType": {
|
|
986
|
+
"original": "EmptyPayload",
|
|
987
|
+
"resolved": "undefined",
|
|
988
|
+
"references": {
|
|
989
|
+
"EmptyPayload": {
|
|
990
|
+
"location": "import",
|
|
991
|
+
"path": "../../utils/types"
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}, {
|
|
996
|
+
"method": "sixBlur",
|
|
997
|
+
"name": "six-select-blur",
|
|
998
|
+
"bubbles": true,
|
|
999
|
+
"cancelable": true,
|
|
1000
|
+
"composed": true,
|
|
1001
|
+
"docs": {
|
|
1002
|
+
"tags": [],
|
|
1003
|
+
"text": "Emitted when the control loses focus."
|
|
1004
|
+
},
|
|
1005
|
+
"complexType": {
|
|
1006
|
+
"original": "EmptyPayload",
|
|
1007
|
+
"resolved": "undefined",
|
|
1008
|
+
"references": {
|
|
1009
|
+
"EmptyPayload": {
|
|
1010
|
+
"location": "import",
|
|
1011
|
+
"path": "../../utils/types"
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}]; }
|
|
1016
|
+
static get methods() { return {
|
|
1017
|
+
"reportValidity": {
|
|
1018
|
+
"complexType": {
|
|
1019
|
+
"signature": "() => Promise<boolean>",
|
|
1020
|
+
"parameters": [],
|
|
1021
|
+
"references": {
|
|
1022
|
+
"Promise": {
|
|
1023
|
+
"location": "global"
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
"return": "Promise<boolean>"
|
|
1027
|
+
},
|
|
1028
|
+
"docs": {
|
|
1029
|
+
"text": "Checks for validity and shows the browser's validation message if the control is invalid.",
|
|
1030
|
+
"tags": []
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
"checkValidity": {
|
|
1034
|
+
"complexType": {
|
|
1035
|
+
"signature": "() => Promise<boolean>",
|
|
1036
|
+
"parameters": [],
|
|
1037
|
+
"references": {
|
|
1038
|
+
"Promise": {
|
|
1039
|
+
"location": "global"
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
"return": "Promise<boolean>"
|
|
1043
|
+
},
|
|
1044
|
+
"docs": {
|
|
1045
|
+
"text": "Checks for validity.",
|
|
1046
|
+
"tags": []
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
"setCustomValidity": {
|
|
1050
|
+
"complexType": {
|
|
1051
|
+
"signature": "(message: string) => Promise<void>",
|
|
1052
|
+
"parameters": [{
|
|
1053
|
+
"tags": [],
|
|
1054
|
+
"text": ""
|
|
1055
|
+
}],
|
|
1056
|
+
"references": {
|
|
1057
|
+
"Promise": {
|
|
1058
|
+
"location": "global"
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
"return": "Promise<void>"
|
|
1062
|
+
},
|
|
1063
|
+
"docs": {
|
|
1064
|
+
"text": "Sets a custom validation message. If `message` is not empty, the field will be considered invalid.",
|
|
1065
|
+
"tags": []
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
"reset": {
|
|
1069
|
+
"complexType": {
|
|
1070
|
+
"signature": "() => Promise<void>",
|
|
1071
|
+
"parameters": [],
|
|
1072
|
+
"references": {
|
|
1073
|
+
"Promise": {
|
|
1074
|
+
"location": "global"
|
|
1075
|
+
}
|
|
1076
|
+
},
|
|
1077
|
+
"return": "Promise<void>"
|
|
1078
|
+
},
|
|
1079
|
+
"docs": {
|
|
1080
|
+
"text": "Resets the formcontrol",
|
|
1081
|
+
"tags": []
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}; }
|
|
1085
|
+
static get elementRef() { return "host"; }
|
|
1086
|
+
static get watchers() { return [{
|
|
1087
|
+
"propName": "disabled",
|
|
1088
|
+
"methodName": "handleDisabledChange"
|
|
1089
|
+
}, {
|
|
1090
|
+
"propName": "helpText",
|
|
1091
|
+
"methodName": "handleLabelChange"
|
|
1092
|
+
}, {
|
|
1093
|
+
"propName": "errorText",
|
|
1094
|
+
"methodName": "handleLabelChange"
|
|
1095
|
+
}, {
|
|
1096
|
+
"propName": "label",
|
|
1097
|
+
"methodName": "handleLabelChange"
|
|
1098
|
+
}, {
|
|
1099
|
+
"propName": "multiple",
|
|
1100
|
+
"methodName": "handleMultipleChange"
|
|
1101
|
+
}, {
|
|
1102
|
+
"propName": "value",
|
|
1103
|
+
"methodName": "handleValueChange"
|
|
1104
|
+
}]; }
|
|
1105
|
+
}
|