@vonage/vivid 4.13.0 → 4.14.0
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/custom-elements.json +4033 -2662
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +70 -136
- package/index.d.ts +0 -1
- package/index.js +60 -62
- package/lib/accordion/accordion.d.ts +2 -2
- package/lib/accordion/accordion.template.d.ts +1 -2
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/accordion-item/accordion-item.template.d.ts +2 -3
- package/lib/accordion-item/definition.d.ts +1 -1
- package/lib/action-group/action-group.d.ts +2 -2
- package/lib/action-group/action-group.template.d.ts +1 -3
- package/lib/action-group/definition.d.ts +1 -1
- package/lib/alert/alert.d.ts +2 -2
- package/lib/alert/alert.template.d.ts +2 -3
- package/lib/alert/definition.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +2 -2
- package/lib/audio-player/audio-player.template.d.ts +2 -3
- package/lib/audio-player/definition.d.ts +1 -3
- package/lib/avatar/avatar.d.ts +2 -2
- package/lib/avatar/avatar.template.d.ts +2 -3
- package/lib/avatar/definition.d.ts +1 -1
- package/lib/badge/badge.d.ts +2 -2
- package/lib/badge/badge.template.d.ts +2 -3
- package/lib/badge/definition.d.ts +1 -3
- package/lib/banner/banner.d.ts +2 -2
- package/lib/banner/banner.template.d.ts +2 -3
- package/lib/banner/definition.d.ts +1 -1
- package/lib/breadcrumb/breadcrumb.d.ts +2 -2
- package/lib/breadcrumb/breadcrumb.template.d.ts +3 -4
- package/lib/breadcrumb/definition.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
- package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +2 -3
- package/lib/breadcrumb-item/definition.d.ts +1 -1
- package/lib/button/button.d.ts +2 -2
- package/lib/button/button.template.d.ts +2 -4
- package/lib/button/definition.d.ts +1 -1
- package/lib/calendar/calendar.d.ts +2 -2
- package/lib/calendar/calendar.template.d.ts +1 -3
- package/lib/calendar/definition.d.ts +1 -1
- package/lib/calendar-event/calendar-event.d.ts +2 -2
- package/lib/calendar-event/calendar-event.template.d.ts +1 -3
- package/lib/calendar-event/definition.d.ts +1 -1
- package/lib/card/card.d.ts +2 -2
- package/lib/card/card.template.d.ts +2 -3
- package/lib/card/definition.d.ts +1 -1
- package/lib/checkbox/checkbox.form-associated.d.ts +3 -2
- package/lib/checkbox/checkbox.template.d.ts +2 -3
- package/lib/checkbox/definition.d.ts +1 -1
- package/lib/combobox/combobox.d.ts +17 -2
- package/lib/combobox/combobox.options.d.ts +7 -0
- package/lib/combobox/combobox.template.d.ts +2 -3
- package/lib/combobox/definition.d.ts +1 -2
- package/lib/data-grid/data-grid-cell.d.ts +16 -13
- package/lib/data-grid/data-grid-cell.template.d.ts +2 -3
- package/lib/data-grid/data-grid-row.d.ts +19 -2
- package/lib/data-grid/data-grid-row.template.d.ts +2 -2
- package/lib/data-grid/data-grid.d.ts +45 -4
- package/lib/data-grid/data-grid.template.d.ts +2 -2
- package/lib/data-grid/definition.d.ts +1 -6
- package/lib/date-picker/definition.d.ts +1 -3
- package/lib/date-range-picker/definition.d.ts +1 -3
- package/lib/dial-pad/definition.d.ts +1 -3
- package/lib/dial-pad/dial-pad.d.ts +2 -2
- package/lib/dial-pad/dial-pad.template.d.ts +2 -3
- package/lib/dialog/definition.d.ts +1 -1
- package/lib/dialog/dialog.d.ts +2 -2
- package/lib/dialog/dialog.template.d.ts +2 -3
- package/lib/divider/definition.d.ts +1 -1
- package/lib/divider/divider.d.ts +2 -2
- package/lib/divider/divider.template.d.ts +1 -3
- package/lib/elevation/definition.d.ts +1 -1
- package/lib/elevation/elevation.d.ts +2 -2
- package/lib/elevation/elevation.template.d.ts +1 -3
- package/lib/empty-state/definition.d.ts +1 -3
- package/lib/empty-state/empty-state.d.ts +2 -2
- package/lib/empty-state/empty-state.template.d.ts +2 -3
- package/lib/fab/definition.d.ts +1 -3
- package/lib/fab/fab.template.d.ts +2 -3
- package/lib/file-picker/definition.d.ts +1 -3
- package/lib/file-picker/file-picker.form-associated.d.ts +3 -2
- package/lib/file-picker/file-picker.template.d.ts +2 -3
- package/lib/header/definition.d.ts +1 -3
- package/lib/header/header.d.ts +2 -2
- package/lib/header/header.template.d.ts +2 -3
- package/lib/icon/definition.d.ts +1 -3
- package/lib/icon/icon.d.ts +2 -2
- package/lib/icon/icon.template.d.ts +1 -3
- package/lib/layout/definition.d.ts +1 -3
- package/lib/layout/layout.d.ts +2 -2
- package/lib/layout/layout.template.d.ts +1 -3
- package/lib/listbox/definition.d.ts +1 -3
- package/lib/listbox/listbox.template.d.ts +1 -3
- package/lib/menu/definition.d.ts +1 -11
- package/lib/menu/menu.d.ts +2 -2
- package/lib/menu/menu.template.d.ts +3 -3
- package/lib/menu-item/definition.d.ts +1 -3
- package/lib/menu-item/menu-item.d.ts +2 -2
- package/lib/menu-item/menu-item.template.d.ts +2 -3
- package/lib/nav/definition.d.ts +1 -3
- package/lib/nav/nav.d.ts +2 -2
- package/lib/nav/nav.template.d.ts +1 -3
- package/lib/nav-disclosure/definition.d.ts +1 -3
- package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
- package/lib/nav-disclosure/nav-disclosure.template.d.ts +2 -3
- package/lib/nav-item/definition.d.ts +1 -3
- package/lib/nav-item/nav-item.template.d.ts +2 -3
- package/lib/note/definition.d.ts +1 -3
- package/lib/note/note.d.ts +2 -2
- package/lib/note/note.template.d.ts +2 -3
- package/lib/number-field/definition.d.ts +1 -4
- package/lib/number-field/number-field.form-associated.d.ts +3 -2
- package/lib/number-field/number-field.template.d.ts +2 -3
- package/lib/option/definition.d.ts +1 -3
- package/lib/option/option.d.ts +3 -2
- package/lib/option/option.template.d.ts +2 -3
- package/lib/pagination/definition.d.ts +1 -3
- package/lib/pagination/pagination.d.ts +2 -2
- package/lib/pagination/pagination.template.d.ts +2 -3
- package/lib/popup/definition.d.ts +1 -3
- package/lib/popup/popup.template.d.ts +2 -3
- package/lib/progress/definition.d.ts +1 -3
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress/progress.template.d.ts +1 -4
- package/lib/progress-ring/definition.d.ts +1 -3
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/progress-ring/progress-ring.template.d.ts +1 -3
- package/lib/radio/definition.d.ts +1 -3
- package/lib/radio/radio.form-associated.d.ts +3 -2
- package/lib/radio/radio.template.d.ts +1 -3
- package/lib/radio-group/definition.d.ts +1 -11
- package/lib/radio-group/radio-group.d.ts +2 -2
- package/lib/radio-group/radio-group.template.d.ts +2 -3
- package/lib/range-slider/definition.d.ts +1 -3
- package/lib/range-slider/range-slider.form-associated.d.ts +3 -2
- package/lib/range-slider/range-slider.template.d.ts +2 -3
- package/lib/searchable-select/definition.d.ts +1 -4
- package/lib/searchable-select/option-tag.template.d.ts +2 -3
- package/lib/searchable-select/searchable-select.form-associated.d.ts +3 -2
- package/lib/searchable-select/searchable-select.template.d.ts +2 -3
- package/lib/select/definition.d.ts +1 -3
- package/lib/select/select.d.ts +14 -4
- package/lib/select/select.form-associated.d.ts +11 -0
- package/lib/select/select.template.d.ts +2 -3
- package/lib/selectable-box/definition.d.ts +1 -3
- package/lib/selectable-box/selectable-box.d.ts +2 -2
- package/lib/selectable-box/selectable-box.template.d.ts +2 -3
- package/lib/side-drawer/definition.d.ts +1 -3
- package/lib/side-drawer/side-drawer.d.ts +2 -2
- package/lib/side-drawer/side-drawer.template.d.ts +1 -3
- package/lib/slider/definition.d.ts +1 -3
- package/lib/slider/slider.form-associated.d.ts +3 -2
- package/lib/slider/slider.template.d.ts +3 -4
- package/lib/split-button/definition.d.ts +1 -1
- package/lib/split-button/split-button.d.ts +2 -2
- package/lib/split-button/split-button.template.d.ts +2 -3
- package/lib/switch/definition.d.ts +1 -3
- package/lib/switch/switch.form-associated.d.ts +3 -2
- package/lib/switch/switch.template.d.ts +1 -3
- package/lib/tab/definition.d.ts +1 -3
- package/lib/tab/tab.d.ts +2 -2
- package/lib/tab/tab.template.d.ts +2 -2
- package/lib/tab-panel/definition.d.ts +1 -3
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tab-panel/tab-panel.template.d.ts +1 -1
- package/lib/tabs/definition.d.ts +1 -3
- package/lib/tabs/tabs.d.ts +3 -2
- package/lib/tabs/tabs.template.d.ts +1 -1
- package/lib/tag/definition.d.ts +1 -4
- package/lib/tag/tag.d.ts +2 -2
- package/lib/tag/tag.template.d.ts +2 -3
- package/lib/tag-group/definition.d.ts +1 -3
- package/lib/tag-group/tag-group.d.ts +2 -2
- package/lib/tag-group/tag-group.template.d.ts +1 -3
- package/lib/text-anchor/definition.d.ts +1 -3
- package/lib/text-anchor/text-anchor.d.ts +4 -3
- package/lib/text-anchor/text-anchor.template.d.ts +2 -3
- package/lib/text-area/definition.d.ts +1 -3
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-area/{text-field.form-associated.d.ts → text-area.form-associated.d.ts} +3 -2
- package/lib/text-area/text-area.template.d.ts +2 -3
- package/lib/text-field/definition.d.ts +1 -3
- package/lib/text-field/text-field.form-associated.d.ts +3 -2
- package/lib/text-field/text-field.template.d.ts +2 -3
- package/lib/time-picker/definition.d.ts +1 -3
- package/lib/time-picker/time-picker.form-associated.d.ts +3 -2
- package/lib/time-picker/time-picker.template.d.ts +2 -2
- package/lib/toggletip/definition.d.ts +1 -3
- package/lib/toggletip/toggletip.d.ts +2 -2
- package/lib/toggletip/toggletip.template.d.ts +2 -3
- package/lib/tooltip/definition.d.ts +1 -3
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tooltip/tooltip.template.d.ts +2 -3
- package/lib/tree-item/definition.d.ts +1 -3
- package/lib/tree-item/tree-item.d.ts +11 -2
- package/lib/tree-item/tree-item.template.d.ts +3 -3
- package/lib/tree-view/definition.d.ts +1 -3
- package/lib/tree-view/tree-view.d.ts +16 -2
- package/lib/tree-view/tree-view.template.d.ts +1 -1
- package/lib/video-player/definition.d.ts +1 -3
- package/lib/video-player/video-player.d.ts +2 -2
- package/lib/video-player/video-player.template.d.ts +1 -3
- package/listbox/index.cjs +37 -39
- package/listbox/index.js +37 -39
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.cjs +1 -1
- package/note/index.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/affix.cjs +10 -10
- package/shared/affix.js +2 -2
- package/shared/anchor.cjs +59 -0
- package/shared/anchor.js +57 -0
- package/shared/anchored.cjs +6 -6
- package/shared/anchored.js +2 -2
- package/shared/apply-mixins.cjs +15 -17
- package/shared/apply-mixins.js +15 -17
- package/shared/apply-mixins2.cjs +25 -0
- package/shared/apply-mixins2.js +23 -0
- package/shared/applyMixinsWithObservables.cjs +4 -4
- package/shared/applyMixinsWithObservables.js +2 -2
- package/shared/aria-global.cjs +86 -67
- package/shared/aria-global.js +86 -67
- package/shared/aria-global2.cjs +68 -86
- package/shared/aria-global2.js +68 -86
- package/shared/base-progress.cjs +70 -63
- package/shared/base-progress.js +69 -62
- package/shared/breadcrumb-item.cjs +7 -58
- package/shared/breadcrumb-item.js +4 -55
- package/shared/button.cjs +178 -0
- package/shared/button.js +176 -0
- package/shared/calendar-event.cjs +10 -9
- package/shared/calendar-event.js +3 -2
- package/shared/children.cjs +2 -2
- package/shared/children.js +1 -1
- package/shared/date-picker/date-picker-base.form-associated.d.ts +3 -2
- package/shared/date-picker/date-picker-base.template.d.ts +2 -3
- package/shared/defineVividComponent.cjs +2612 -0
- package/shared/defineVividComponent.js +2592 -0
- package/shared/definition.cjs +26 -24
- package/shared/definition.js +17 -14
- package/shared/definition10.cjs +15 -12
- package/shared/definition10.js +15 -11
- package/shared/definition11.cjs +52 -248
- package/shared/definition11.js +24 -218
- package/shared/definition12.cjs +18 -14
- package/shared/definition12.js +17 -12
- package/shared/definition13.cjs +20 -19
- package/shared/definition13.js +11 -9
- package/shared/definition14.cjs +36 -38
- package/shared/definition14.js +16 -17
- package/shared/definition15.cjs +28 -26
- package/shared/definition15.js +17 -14
- package/shared/definition16.cjs +478 -611
- package/shared/definition16.js +471 -603
- package/shared/definition17.cjs +934 -1113
- package/shared/definition17.js +912 -1090
- package/shared/definition18.cjs +16 -20
- package/shared/definition18.js +19 -22
- package/shared/definition19.cjs +26 -30
- package/shared/definition19.js +21 -24
- package/shared/definition2.cjs +20 -22
- package/shared/definition2.js +21 -22
- package/shared/definition20.cjs +51 -52
- package/shared/definition20.js +35 -35
- package/shared/definition21.cjs +42 -45
- package/shared/definition21.js +18 -20
- package/shared/definition22.cjs +16 -13
- package/shared/definition22.js +15 -11
- package/shared/definition23.cjs +22 -20
- package/shared/definition23.js +15 -12
- package/shared/definition24.cjs +20 -172
- package/shared/definition24.js +17 -168
- package/shared/definition25.cjs +27 -28
- package/shared/definition25.js +19 -19
- package/shared/definition26.cjs +17 -14
- package/shared/definition26.js +15 -11
- package/shared/definition27.cjs +265 -12
- package/shared/definition27.js +262 -10
- package/shared/definition28.cjs +19 -16
- package/shared/definition28.js +15 -11
- package/shared/definition29.cjs +143 -68
- package/shared/definition29.js +102 -29
- package/shared/definition3.cjs +21 -16
- package/shared/definition3.js +17 -11
- package/shared/definition30.cjs +99 -76
- package/shared/definition30.js +98 -74
- package/shared/definition31.cjs +24 -97
- package/shared/definition31.js +25 -97
- package/shared/definition32.cjs +10 -25
- package/shared/definition32.js +9 -23
- package/shared/definition33.cjs +53 -14
- package/shared/definition33.js +52 -12
- package/shared/definition34.cjs +641 -34
- package/shared/definition34.js +638 -30
- package/shared/definition35.cjs +204 -596
- package/shared/definition35.js +198 -591
- package/shared/definition36.cjs +198 -233
- package/shared/definition36.js +193 -226
- package/shared/definition37.cjs +79 -206
- package/shared/definition37.js +75 -202
- package/shared/definition38.cjs +50 -56
- package/shared/definition38.js +48 -52
- package/shared/definition39.cjs +260 -56
- package/shared/definition39.js +259 -54
- package/shared/definition4.cjs +33 -35
- package/shared/definition4.js +20 -21
- package/shared/definition40.cjs +112 -229
- package/shared/definition40.js +109 -226
- package/shared/definition41.cjs +627 -36
- package/shared/definition41.js +626 -34
- package/shared/definition42.cjs +975 -487
- package/shared/definition42.js +972 -482
- package/shared/definition43.cjs +725 -932
- package/shared/definition43.js +713 -918
- package/shared/definition44.cjs +116 -734
- package/shared/definition44.js +114 -731
- package/shared/definition45.cjs +93 -116
- package/shared/definition45.js +93 -115
- package/shared/definition46.cjs +469 -89
- package/shared/definition46.js +466 -86
- package/shared/definition47.cjs +119 -470
- package/shared/definition47.js +116 -465
- package/shared/definition48.cjs +114 -120
- package/shared/definition48.js +112 -117
- package/shared/definition49.cjs +17 -134
- package/shared/definition49.js +16 -132
- package/shared/definition5.cjs +48 -49
- package/shared/definition5.js +19 -19
- package/shared/definition50.cjs +112 -15
- package/shared/definition50.js +110 -12
- package/shared/definition51.cjs +847 -84
- package/shared/definition51.js +843 -79
- package/shared/definition52.cjs +31 -873
- package/shared/definition52.js +29 -870
- package/shared/definition53.cjs +126 -28
- package/shared/definition53.js +124 -25
- package/shared/definition54.cjs +268 -107
- package/shared/definition54.js +262 -100
- package/shared/definition55.cjs +63 -278
- package/shared/definition55.js +61 -275
- package/shared/definition56.cjs +868 -76
- package/shared/definition56.js +867 -74
- package/shared/definition57.cjs +108 -826
- package/shared/definition57.js +106 -823
- package/shared/definition58.cjs +74 -100
- package/shared/definition58.js +70 -95
- package/shared/definition59.cjs +181 -106
- package/shared/definition59.js +175 -101
- package/shared/definition6.cjs +23 -21
- package/shared/definition6.js +15 -12
- package/shared/definition60.cjs +273 -70
- package/shared/definition60.js +273 -69
- package/shared/definition61.cjs +66157 -271
- package/shared/definition61.js +66156 -269
- package/shared/definition62.cjs +36 -66174
- package/shared/definition62.js +33 -66171
- package/shared/definition63.cjs +2154 -27
- package/shared/definition63.js +2151 -25
- package/shared/definition7.cjs +19 -15
- package/shared/definition7.js +14 -10
- package/shared/definition8.cjs +26 -27
- package/shared/definition8.js +17 -17
- package/shared/definition9.cjs +21 -21
- package/shared/definition9.js +18 -17
- package/shared/design-system/createRegisterFunction.d.ts +2 -0
- package/shared/design-system/defineVividComponent.d.ts +15 -0
- package/shared/{localization.js → direction.js} +11 -11
- package/shared/dom.cjs +0 -13
- package/shared/dom.js +1 -13
- package/shared/form-associated.cjs +422 -457
- package/shared/form-associated.js +422 -457
- package/shared/form-associated2.cjs +383 -0
- package/shared/form-associated2.js +381 -0
- package/shared/form-elements.cjs +15 -42
- package/shared/form-elements.js +2 -29
- package/shared/foundation/anchor/anchor.d.ts +1 -0
- package/shared/foundation/button/button.d.ts +3 -2
- package/shared/foundation/button/button.template.d.ts +2 -4
- package/shared/foundation/form-associated/form-associated.d.ts +51 -0
- package/shared/foundation/listbox/listbox.d.ts +22 -0
- package/shared/foundation/progress/base-progress.d.ts +9 -0
- package/shared/foundation/utilities/apply-mixins.d.ts +1 -0
- package/shared/foundation/vivid-element/vivid-element.d.ts +3 -0
- package/shared/foundation-element.cjs +1417 -0
- package/shared/foundation-element.js +1414 -0
- package/shared/index.cjs +7 -5097
- package/shared/index.js +7 -5079
- package/shared/key-codes.cjs +10 -0
- package/shared/key-codes.js +6 -1
- package/shared/key-codes2.cjs +50 -6
- package/shared/key-codes2.js +50 -4
- package/shared/listbox.cjs +428 -1195
- package/shared/listbox.js +412 -1176
- package/shared/listbox2.cjs +1268 -0
- package/shared/listbox2.js +1265 -0
- package/shared/localized.cjs +2 -2
- package/shared/localized.js +1 -1
- package/shared/numbers.cjs +12 -0
- package/shared/numbers.js +12 -1
- package/shared/patterns/affix.d.ts +2 -2
- package/shared/patterns/chevron.d.ts +2 -2
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/presentationDate.cjs +50 -49
- package/shared/presentationDate.js +7 -6
- package/shared/ref.cjs +2 -2
- package/shared/ref.js +1 -1
- package/shared/repeat.cjs +22 -22
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +5 -5
- package/shared/slider.template.js +2 -2
- package/shared/slotted.cjs +4 -4
- package/shared/slotted.js +1 -1
- package/shared/strings.cjs +0 -26
- package/shared/strings.js +1 -25
- package/shared/strings2.cjs +37 -0
- package/shared/strings2.js +33 -0
- package/shared/text-anchor.cjs +8 -89
- package/shared/text-anchor.js +5 -86
- package/shared/text-anchor.template.cjs +2 -2
- package/shared/text-anchor.template.js +1 -1
- package/shared/text-field2.cjs +29 -28
- package/shared/text-field2.js +6 -5
- package/shared/vivid-element.cjs +8 -0
- package/shared/vivid-element.js +6 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.cjs +10 -7
- package/text-anchor/index.js +10 -7
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +2846 -7860
- package/shared/definition64.cjs +0 -2175
- package/shared/definition64.js +0 -2170
- package/shared/design-system/index.d.ts +0 -3
- package/shared/icon.cjs +0 -261
- package/shared/icon.js +0 -258
- package/shared/index2.cjs +0 -11
- package/shared/index2.js +0 -9
- package/shared/radio.cjs +0 -126
- package/shared/radio.js +0 -124
- package/shared/select.options.cjs +0 -12
- package/shared/select.options.js +0 -10
- package/shared/start-end.cjs +0 -52
- package/shared/start-end.js +0 -50
- package/shared/tree-item.cjs +0 -154
- package/shared/tree-item.js +0 -151
- package/shared/{localization.cjs → direction.cjs} +9 -9
package/shared/definition43.js
CHANGED
|
@@ -1,1123 +1,918 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
1
|
+
import { P as Popup, p as popupDefinition } from './definition63.js';
|
|
2
|
+
import { i as iconDefinition } from './definition27.js';
|
|
3
|
+
import { L as ListboxOption, l as listboxOptionDefinition } from './definition35.js';
|
|
4
|
+
import { D as DOM, O as Observable, o as observable, a as attr, v as volatile, h as html, d as defineVividComponent, f as createRegisterFunction } from './defineVividComponent.js';
|
|
5
|
+
import { a as Listbox$1 } from './listbox2.js';
|
|
5
6
|
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
6
|
-
import {
|
|
7
|
-
import { F as FormAssociated } from './form-
|
|
8
|
-
import {
|
|
7
|
+
import { L as Listbox } from './listbox.js';
|
|
8
|
+
import { F as FormAssociated } from './form-associated2.js';
|
|
9
|
+
import { i as inRange } from './numbers.js';
|
|
10
|
+
import { u as uniqueId } from './strings.js';
|
|
11
|
+
import { a as keySpace, b as keyEscape, c as keyTab, d as keyEnd, e as keyArrowUp, f as keyArrowDown, g as keyHome, k as keyEnter } from './key-codes.js';
|
|
9
12
|
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './form-elements.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { w as when } from './when.js';
|
|
13
|
+
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
14
|
+
import { c as chevronTemplateFactory } from './definition11.js';
|
|
15
|
+
import { h as handleEscapeKeyAndStopPropogation } from './index.js';
|
|
14
16
|
import { r as ref } from './ref.js';
|
|
17
|
+
import { w as when } from './when.js';
|
|
15
18
|
import { s as slotted } from './slotted.js';
|
|
16
|
-
import { r as repeat } from './repeat.js';
|
|
17
19
|
import { c as classNames } from './class-names.js';
|
|
18
|
-
import { I as Icon } from './icon.js';
|
|
19
|
-
|
|
20
|
-
const styles = ".chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([aria-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{display:inline-block;inline-size:300px;--_low-ink-color: var(--vvd-color-neutral-600)}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.control-wrapper{display:flex;flex-direction:column;gap:4px}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.fieldset{--_connotation-color-primary: var(--vvd-searchable-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-searchable-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-searchable-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-searchable-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-searchable-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-searchable-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-searchable-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-searchable-select-accent-fierce, var(--vvd-color-neutral-700))}.fieldset{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.fieldset.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.fieldset:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.fieldset:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.fieldset:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.fieldset:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.fieldset:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.fieldset:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.fieldset{display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;padding-block:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s}.fieldset:focus-within{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}:host(:not([shape=pill])) .fieldset{border-radius:8px}:host([shape=pill]) .fieldset{border-radius:24px}.popup-wrapper{position:relative}.content-area{display:flex;overflow:hidden;flex:1;flex-direction:column;gap:8px;min-block-size:24px}.tag-row{display:flex;gap:8px;inline-size:100%}.tag-row.contains-only-input:not(:focus-within){display:contents}.tag-wrapper{overflow:hidden}.tag{max-inline-size:100%}input{box-sizing:border-box;flex:1;border:none;background:none;block-size:24px;font:var(--vvd-typography-base);max-inline-size:100%;min-inline-size:100px;outline:none}.contains-only-input input:not(:focus){position:absolute;block-size:0;inline-size:0;min-inline-size:0;opacity:0;pointer-events:none}.listbox{display:flex;flex-direction:column;padding:4px;gap:2px;max-block-size:var(--searchable-select-height, 408px);overflow-y:auto}.empty-message{display:flex;align-items:center;justify-content:center;color:var(--vvd-color-neutral-300);min-block-size:40px;text-align:center}::part(popup-base){inline-size:max-content;min-inline-size:100%}slot[name=icon]{font-size:20px}.visually-hidden{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}";
|
|
21
20
|
|
|
22
|
-
const
|
|
21
|
+
const styles = ".chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([aria-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{display:inline-flex;flex-direction:column;gap:4px;--_low-ink-color: var(--vvd-color-neutral-600);--focus-stroke-gap-color: transparent}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);contain:inline-size;font:var(--vvd-typography-base)}.control{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.control.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.control:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.control:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.control:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.control:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.control:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.control:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.control:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.control:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.control{--_connotation-color-primary: var(--vvd-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-select-accent-fierce, var(--vvd-color-neutral-700))}.control{border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline)}.control{--_select-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_select-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_select-padding-inline: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;transition:box-shadow .2s,background-color .2s}.control.size-condensed{--_select-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_select-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_select-padding-inline: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) }.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius: 8px}.control.shape-pill{--_select-control-border-radius: 24px}:host(:focus-visible) .control{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}.listbox{display:flex;max-height:var(--select-height, 408px);flex-direction:column;padding:4px;gap:2px;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));border-radius:8px}.selected-value{display:flex;overflow:hidden;flex-grow:1;align-items:center;column-gap:12px;white-space:nowrap}.selected-value .text{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis}.control.shows-placeholder .selected-value .text{color:var(--vvd-color-neutral-600)}.selected-value slot[name=icon]{flex:0 0 var(--_select-icon-size);font-size:var(--_select-icon-size);line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width, 100%)}:host([multiple]) ::part(popup-base){position:static}";
|
|
23
22
|
|
|
24
|
-
class
|
|
23
|
+
class _Select extends Listbox {
|
|
25
24
|
}
|
|
26
|
-
class
|
|
27
|
-
_SearchableSelect
|
|
28
|
-
) {
|
|
25
|
+
class FormAssociatedSelect extends FormAssociated(_Select) {
|
|
29
26
|
constructor() {
|
|
30
27
|
super(...arguments);
|
|
31
|
-
this.proxy = document.createElement("
|
|
28
|
+
this.proxy = document.createElement("select");
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
var __defProp
|
|
32
|
+
var __defProp = Object.defineProperty;
|
|
36
33
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
37
|
-
var
|
|
38
|
-
throw TypeError(msg);
|
|
39
|
-
};
|
|
40
|
-
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
34
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
41
35
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
42
36
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
43
37
|
if (decorator = decorators[i])
|
|
44
38
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
45
|
-
if (kind && result) __defProp
|
|
39
|
+
if (kind && result) __defProp(target, key, result);
|
|
46
40
|
return result;
|
|
47
41
|
};
|
|
48
|
-
|
|
49
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
50
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
51
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
52
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
53
|
-
var _SearchableSelect_instances, updateValuesThroughUserInteraction_fn, updateValuesWhileMaintainingOrder_fn, isValidValue_fn, _slottedOptionsChangeHandler, updateSelectedOnSlottedOptions_fn, handleOptionInteraction_fn, _clonedTagIcons, tagIconOfOption_fn, updateClonedTagIconOfOption_fn, _suppressFilter, updateFilteredOptions_fn, transitionHighlightedOptionTo_fn, selectHighlightedOption_fn, highlightFirstOption_fn, highlightLastOption_fn, highlightPrevPage_fn, highlightNextPage_fn, highlightPreviousOption_fn, highlightNextOption_fn, textForValue_fn, measureTagWidth_fn, updateTagLayout_fn, moveTagFocusTo_fn, nextTagIndexLeft_fn, nextTagIndexRight_fn, nextTagIndexForRemoved_fn, determineInitialValues_fn, updateFormValue_fn, _resizeObserver;
|
|
54
|
-
const TagGapPx = 8;
|
|
55
|
-
const InputMinWidthPx = 100;
|
|
56
|
-
const PageSize = 10;
|
|
57
|
-
const isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
|
|
58
|
-
let SearchableSelect = class extends FormAssociatedSearchableSelect {
|
|
42
|
+
let Select = class extends FormAssociatedSelect {
|
|
59
43
|
constructor() {
|
|
60
44
|
super(...arguments);
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
this.activeIndex = -1;
|
|
46
|
+
/**
|
|
47
|
+
* The start index when checking a range of options.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
this.rangeStartIndex = -1;
|
|
63
52
|
this.open = false;
|
|
64
|
-
this.multiple = false;
|
|
65
|
-
this.externalTags = false;
|
|
66
|
-
this.maxLines = null;
|
|
67
|
-
this.values = [];
|
|
68
|
-
this.initialValues = [];
|
|
69
|
-
this._inputValue = "";
|
|
70
|
-
// --- Slotted options ---
|
|
71
53
|
/**
|
|
54
|
+
* The unique id for the internal listbox element.
|
|
55
|
+
*
|
|
72
56
|
* @internal
|
|
73
57
|
*/
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} else if (!source.selected && this.values.includes(source.value)) {
|
|
80
|
-
this.values = this.values.filter((option) => option !== source.value);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
// --- Option tag icons ---
|
|
85
|
-
__privateAdd(this, _clonedTagIcons, /* @__PURE__ */ new Map());
|
|
86
|
-
this._filteredOptions = [];
|
|
87
|
-
this._filteredEnabledOptions = [];
|
|
88
|
-
__privateAdd(this, _suppressFilter, false);
|
|
89
|
-
this._highlightedOptionIndex = null;
|
|
90
|
-
this._numElidedTags = 0;
|
|
91
|
-
this._tagRows = [];
|
|
92
|
-
this._lastTagRow = [];
|
|
93
|
-
this.clearable = false;
|
|
94
|
-
this.setFormValue = (value, state) => {
|
|
95
|
-
if (isFormAssociatedTryingToSetFormValue(value)) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
super.setFormValue(value, state);
|
|
99
|
-
};
|
|
100
|
-
this._changeDescription = "";
|
|
101
|
-
// --- Core ---
|
|
102
|
-
__privateAdd(this, _resizeObserver, new ResizeObserver(() => {
|
|
103
|
-
__privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
|
|
104
|
-
}));
|
|
58
|
+
this.listboxId = uniqueId("listbox-");
|
|
59
|
+
this.maxHeight = 0;
|
|
60
|
+
this.fixedDropdown = false;
|
|
61
|
+
this.placeholderOption = null;
|
|
62
|
+
this._feedbackWrapper = null;
|
|
105
63
|
}
|
|
106
64
|
/**
|
|
65
|
+
* Returns the last checked option.
|
|
66
|
+
*
|
|
107
67
|
* @internal
|
|
108
68
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, null);
|
|
112
|
-
}
|
|
69
|
+
get activeOption() {
|
|
70
|
+
return this.options[this.activeIndex];
|
|
113
71
|
}
|
|
114
72
|
/**
|
|
73
|
+
* Returns the list of checked options.
|
|
74
|
+
*
|
|
115
75
|
* @internal
|
|
116
76
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (!this.multiple && this.values.length > 1) {
|
|
122
|
-
this.values = [this.values[0]];
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (this.values.some((value) => !__privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value))) {
|
|
126
|
-
this.values = this.values.filter((value) => __privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value));
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (!this.multiple) {
|
|
130
|
-
if (this.values.length) {
|
|
131
|
-
__privateSet(this, _suppressFilter, true);
|
|
132
|
-
this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
|
|
133
|
-
} else {
|
|
134
|
-
this._inputValue = "";
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
this.value = this.values.length ? this.values[0] : "";
|
|
138
|
-
__privateMethod(this, _SearchableSelect_instances, updateSelectedOnSlottedOptions_fn).call(this);
|
|
139
|
-
if (this.$fastController.isConnected) {
|
|
140
|
-
__privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
|
|
141
|
-
}
|
|
142
|
-
__privateMethod(this, _SearchableSelect_instances, updateFormValue_fn).call(this);
|
|
77
|
+
get checkedOptions() {
|
|
78
|
+
return this.options.filter((o) => o.checked);
|
|
143
79
|
}
|
|
144
80
|
/**
|
|
81
|
+
* Returns the index of the first selected option.
|
|
82
|
+
*
|
|
145
83
|
* @internal
|
|
146
84
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.values = this.initialValues;
|
|
150
|
-
this.dirtyValue = false;
|
|
151
|
-
}
|
|
85
|
+
get firstSelectedOptionIndex() {
|
|
86
|
+
return this.options.indexOf(this.firstSelectedOption);
|
|
152
87
|
}
|
|
153
88
|
/**
|
|
89
|
+
* Updates the `ariaActiveDescendant` property when the active index changes.
|
|
90
|
+
*
|
|
154
91
|
* @internal
|
|
155
92
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
93
|
+
activeIndexChanged(_, next) {
|
|
94
|
+
this.ariaActiveDescendant = this.options[next]?.id ?? "";
|
|
95
|
+
this.focusAndScrollOptionIntoView();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Toggles the checked state for the currently active option.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* Multiple-selection mode only.
|
|
102
|
+
*
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
checkActiveIndex() {
|
|
106
|
+
const activeItem = this.activeOption;
|
|
107
|
+
if (activeItem) {
|
|
108
|
+
activeItem.checked = true;
|
|
166
109
|
}
|
|
167
110
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Sets the active index to the first option and marks it as checked.
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* Multi-selection mode only.
|
|
116
|
+
*
|
|
117
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
118
|
+
*
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
checkFirstOption(preserveChecked) {
|
|
122
|
+
if (preserveChecked) {
|
|
123
|
+
if (this.rangeStartIndex === -1) {
|
|
124
|
+
this.rangeStartIndex = this.activeIndex + 1;
|
|
125
|
+
}
|
|
126
|
+
this.options.forEach((o, i) => {
|
|
127
|
+
o.checked = inRange(i, this.rangeStartIndex);
|
|
128
|
+
});
|
|
173
129
|
} else {
|
|
174
|
-
|
|
130
|
+
this.uncheckAllOptions();
|
|
175
131
|
}
|
|
132
|
+
this.activeIndex = 0;
|
|
133
|
+
this.checkActiveIndex();
|
|
176
134
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Decrements the active index and sets the matching option as checked.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* Multi-selection mode only.
|
|
140
|
+
*
|
|
141
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
142
|
+
*
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
checkLastOption(preserveChecked) {
|
|
146
|
+
if (preserveChecked) {
|
|
147
|
+
if (this.rangeStartIndex === -1) {
|
|
148
|
+
this.rangeStartIndex = this.activeIndex;
|
|
149
|
+
}
|
|
150
|
+
this.options.forEach((o, i) => {
|
|
151
|
+
o.checked = inRange(i, this.rangeStartIndex, this.options.length);
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
this.uncheckAllOptions();
|
|
155
|
+
}
|
|
156
|
+
this.activeIndex = this.options.length - 1;
|
|
157
|
+
this.checkActiveIndex();
|
|
187
158
|
}
|
|
188
159
|
/**
|
|
160
|
+
* Increments the active index and marks the matching option as checked.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* Multiple-selection mode only.
|
|
164
|
+
*
|
|
165
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
166
|
+
*
|
|
189
167
|
* @internal
|
|
190
168
|
*/
|
|
191
|
-
|
|
192
|
-
|
|
169
|
+
checkNextOption(preserveChecked) {
|
|
170
|
+
if (preserveChecked) {
|
|
171
|
+
if (this.rangeStartIndex === -1) {
|
|
172
|
+
this.rangeStartIndex = this.activeIndex;
|
|
173
|
+
}
|
|
174
|
+
this.options.forEach((o, i) => {
|
|
175
|
+
o.checked = inRange(i, this.rangeStartIndex, this.activeIndex + 1);
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
this.uncheckAllOptions();
|
|
179
|
+
}
|
|
180
|
+
this.activeIndex += this.activeIndex < this.options.length - 1 ? 1 : 0;
|
|
181
|
+
this.checkActiveIndex();
|
|
193
182
|
}
|
|
194
183
|
/**
|
|
184
|
+
* Decrements the active index and marks the matching option as checked.
|
|
185
|
+
*
|
|
186
|
+
* @remarks
|
|
187
|
+
* Multiple-selection mode only.
|
|
188
|
+
*
|
|
189
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
190
|
+
*
|
|
195
191
|
* @internal
|
|
196
192
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
193
|
+
checkPreviousOption(preserveChecked) {
|
|
194
|
+
if (preserveChecked) {
|
|
195
|
+
if (this.rangeStartIndex === -1) {
|
|
196
|
+
this.rangeStartIndex = this.activeIndex;
|
|
197
|
+
}
|
|
198
|
+
if (this.checkedOptions.length === 1) {
|
|
199
|
+
this.rangeStartIndex += 1;
|
|
200
|
+
}
|
|
201
|
+
this.options.forEach((o, i) => {
|
|
202
|
+
o.checked = inRange(i, this.activeIndex, this.rangeStartIndex);
|
|
203
|
+
});
|
|
204
|
+
} else {
|
|
205
|
+
this.uncheckAllOptions();
|
|
206
|
+
}
|
|
207
|
+
this.activeIndex -= this.activeIndex > 0 ? 1 : 0;
|
|
208
|
+
this.checkActiveIndex();
|
|
200
209
|
}
|
|
201
210
|
/**
|
|
202
211
|
* @internal
|
|
203
212
|
*/
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
__privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
|
|
207
|
-
this.open = true;
|
|
213
|
+
focusAndScrollOptionIntoView() {
|
|
214
|
+
super.focusAndScrollOptionIntoView(this.activeOption);
|
|
208
215
|
}
|
|
209
216
|
/**
|
|
217
|
+
* In multiple-selection mode:
|
|
218
|
+
* If any options are selected, the first selected option is checked when
|
|
219
|
+
* the listbox receives focus. If no options are selected, the first
|
|
220
|
+
* selectable option is checked.
|
|
221
|
+
*
|
|
210
222
|
* @internal
|
|
211
223
|
*/
|
|
212
|
-
|
|
213
|
-
this.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
|
|
224
|
+
focusinHandler(e) {
|
|
225
|
+
if (!this.multiple) {
|
|
226
|
+
return super.focusinHandler(e);
|
|
227
|
+
}
|
|
228
|
+
if (!this.shouldSkipFocus && e.target === e.currentTarget) {
|
|
229
|
+
this.uncheckAllOptions();
|
|
230
|
+
if (this.activeIndex === -1) {
|
|
231
|
+
this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
|
|
221
232
|
}
|
|
233
|
+
this.checkActiveIndex();
|
|
234
|
+
this.setSelectedOptions();
|
|
235
|
+
this.focusAndScrollOptionIntoView();
|
|
222
236
|
}
|
|
223
|
-
this.
|
|
237
|
+
this.shouldSkipFocus = false;
|
|
224
238
|
}
|
|
225
239
|
/**
|
|
226
|
-
*
|
|
240
|
+
* Sets an option as selected and gives it focus.
|
|
241
|
+
*
|
|
242
|
+
* @public
|
|
227
243
|
*/
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
|
|
244
|
+
setSelectedOptions() {
|
|
245
|
+
if (!this.multiple) {
|
|
246
|
+
super.setSelectedOptions();
|
|
247
|
+
return;
|
|
231
248
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return false;
|
|
236
|
-
case "Escape":
|
|
237
|
-
this.open = false;
|
|
238
|
-
break;
|
|
239
|
-
case "Home":
|
|
240
|
-
if (!this.open) {
|
|
241
|
-
this.open = true;
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
__privateMethod(this, _SearchableSelect_instances, highlightFirstOption_fn).call(this);
|
|
245
|
-
return false;
|
|
246
|
-
case "End":
|
|
247
|
-
if (!this.open) {
|
|
248
|
-
this.open = true;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
__privateMethod(this, _SearchableSelect_instances, highlightLastOption_fn).call(this);
|
|
252
|
-
return false;
|
|
253
|
-
case "PageUp":
|
|
254
|
-
if (!this.open) {
|
|
255
|
-
this.open = true;
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
__privateMethod(this, _SearchableSelect_instances, highlightPrevPage_fn).call(this);
|
|
259
|
-
return false;
|
|
260
|
-
case "PageDown":
|
|
261
|
-
if (!this.open) {
|
|
262
|
-
this.open = true;
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
__privateMethod(this, _SearchableSelect_instances, highlightNextPage_fn).call(this);
|
|
266
|
-
return false;
|
|
267
|
-
case "ArrowUp":
|
|
268
|
-
if (!this.open) {
|
|
269
|
-
this.open = true;
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
__privateMethod(this, _SearchableSelect_instances, highlightPreviousOption_fn).call(this);
|
|
273
|
-
return false;
|
|
274
|
-
case "ArrowDown":
|
|
275
|
-
if (!this.open) {
|
|
276
|
-
this.open = true;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
__privateMethod(this, _SearchableSelect_instances, highlightNextOption_fn).call(this);
|
|
280
|
-
return false;
|
|
281
|
-
case "ArrowLeft":
|
|
282
|
-
if (this.multiple && this._inputValue === "" && this.values.length && !this.externalTags) {
|
|
283
|
-
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, this.values.length));
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
return true;
|
|
287
|
-
case "Backspace":
|
|
288
|
-
if (this.multiple && this._inputValue === "" && this.values.length) {
|
|
289
|
-
this._onTagRemoved(this.values[this.values.length - 1]);
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
return true;
|
|
293
|
-
default:
|
|
294
|
-
if (!this.open) {
|
|
295
|
-
this.open = true;
|
|
296
|
-
}
|
|
297
|
-
return true;
|
|
249
|
+
if (this.$fastController.isConnected && this.options) {
|
|
250
|
+
this.selectedOptions = this.options.filter((o) => o.selected);
|
|
251
|
+
this.focusAndScrollOptionIntoView();
|
|
298
252
|
}
|
|
299
|
-
return true;
|
|
300
253
|
}
|
|
301
254
|
/**
|
|
255
|
+
* Toggles the selected state of the provided options. If any provided items
|
|
256
|
+
* are in an unselected state, all items are set to selected. If every
|
|
257
|
+
* provided item is selected, they are all unselected.
|
|
258
|
+
*
|
|
302
259
|
* @internal
|
|
303
260
|
*/
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
261
|
+
toggleSelectedForAllCheckedOptions() {
|
|
262
|
+
const enabledCheckedOptions = this.checkedOptions.filter(
|
|
263
|
+
(o) => !o.disabled
|
|
264
|
+
);
|
|
265
|
+
const force = !enabledCheckedOptions.every((o) => o.selected);
|
|
266
|
+
enabledCheckedOptions.forEach((o) => o.selected = force);
|
|
267
|
+
this.selectedIndex = this.options.indexOf(
|
|
268
|
+
enabledCheckedOptions[enabledCheckedOptions.length - 1]
|
|
307
269
|
);
|
|
308
|
-
|
|
270
|
+
this.setSelectedOptions();
|
|
271
|
+
this.updateValue(true);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @internal
|
|
275
|
+
*/
|
|
276
|
+
typeaheadBufferChanged(prev, next) {
|
|
277
|
+
if (!this.multiple) {
|
|
278
|
+
super.typeaheadBufferChanged(prev, next);
|
|
309
279
|
return;
|
|
310
280
|
}
|
|
311
|
-
this.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
if (newValue) {
|
|
319
|
-
for (const option of newValue) {
|
|
320
|
-
option._displayCheckmark = true;
|
|
321
|
-
const notifier = Observable.getNotifier(option);
|
|
322
|
-
notifier.subscribe(__privateGet(this, _slottedOptionsChangeHandler), "selected");
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
const values = [];
|
|
326
|
-
for (const option of this._slottedOptions) {
|
|
327
|
-
if (option.selected || option.value === this.value || this.values.includes(option.value)) {
|
|
328
|
-
values.push(option.value);
|
|
281
|
+
if (this.$fastController.isConnected) {
|
|
282
|
+
const typeaheadMatches = this.getTypeaheadMatches();
|
|
283
|
+
const activeIndex = this.options.indexOf(typeaheadMatches[0]);
|
|
284
|
+
if (activeIndex > -1) {
|
|
285
|
+
this.activeIndex = activeIndex;
|
|
286
|
+
this.uncheckAllOptions();
|
|
287
|
+
this.checkActiveIndex();
|
|
329
288
|
}
|
|
289
|
+
this.typeaheadExpired = false;
|
|
330
290
|
}
|
|
331
|
-
__privateMethod(this, _SearchableSelect_instances, updateValuesWhileMaintainingOrder_fn).call(this, values);
|
|
332
|
-
__privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
|
|
333
291
|
}
|
|
334
292
|
/**
|
|
293
|
+
* Unchecks all options.
|
|
294
|
+
*
|
|
295
|
+
* @remarks
|
|
296
|
+
* Multiple-selection mode only.
|
|
297
|
+
*
|
|
298
|
+
* @param preserveChecked - reset the rangeStartIndex
|
|
299
|
+
*
|
|
335
300
|
* @internal
|
|
336
301
|
*/
|
|
337
|
-
|
|
338
|
-
|
|
302
|
+
uncheckAllOptions(preserveChecked = false) {
|
|
303
|
+
this.options.forEach((o) => o.checked = false);
|
|
304
|
+
if (!preserveChecked) {
|
|
305
|
+
this.rangeStartIndex = -1;
|
|
306
|
+
}
|
|
339
307
|
}
|
|
340
|
-
// --- Tags ---
|
|
341
308
|
/**
|
|
309
|
+
* Sets focus and synchronizes ARIA attributes when the open property changes.
|
|
310
|
+
*
|
|
342
311
|
* @internal
|
|
343
312
|
*/
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
313
|
+
openChanged(prev, next) {
|
|
314
|
+
if (!this.collapsible) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (this.open) {
|
|
318
|
+
this.ariaControls = this.listboxId;
|
|
319
|
+
this.ariaExpanded = "true";
|
|
320
|
+
this.focusAndScrollOptionIntoView();
|
|
321
|
+
this.indexWhenOpened = this.selectedIndex;
|
|
322
|
+
DOM.queueUpdate(() => this.focus());
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const didClose = prev === true && next === false;
|
|
326
|
+
const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
|
|
327
|
+
if (didClose && selectionChangedWhileOpen) {
|
|
328
|
+
this.updateValue(true);
|
|
329
|
+
}
|
|
330
|
+
this.ariaControls = "";
|
|
331
|
+
this.ariaExpanded = "false";
|
|
332
|
+
}
|
|
333
|
+
get collapsible() {
|
|
334
|
+
return !this.multiple;
|
|
349
335
|
}
|
|
350
336
|
/**
|
|
337
|
+
* The value property.
|
|
338
|
+
*
|
|
339
|
+
* @public
|
|
340
|
+
*/
|
|
341
|
+
get value() {
|
|
342
|
+
Observable.track(this, "value");
|
|
343
|
+
return this._value;
|
|
344
|
+
}
|
|
345
|
+
set value(next) {
|
|
346
|
+
const prev = `${this._value}`;
|
|
347
|
+
if (this._options.length) {
|
|
348
|
+
const selectedIndex = this._options.findIndex((el) => el.value === next);
|
|
349
|
+
const prevSelectedValue = this._options[this.selectedIndex]?.value ?? null;
|
|
350
|
+
const nextSelectedValue = this._options[selectedIndex]?.value ?? null;
|
|
351
|
+
if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
|
|
352
|
+
next = "";
|
|
353
|
+
this.selectedIndex = selectedIndex;
|
|
354
|
+
}
|
|
355
|
+
next = this.firstSelectedOption?.value ?? next;
|
|
356
|
+
}
|
|
357
|
+
if (prev !== next) {
|
|
358
|
+
this._value = next;
|
|
359
|
+
super.valueChanged(prev, next);
|
|
360
|
+
Observable.notify(this, "value");
|
|
361
|
+
this.updateDisplayValue();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Sets the value and display value to match the first selected option.
|
|
366
|
+
*
|
|
367
|
+
* @param shouldEmit - if true, the input and change events will be emitted
|
|
368
|
+
*
|
|
351
369
|
* @internal
|
|
352
370
|
*/
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
371
|
+
updateValue(shouldEmit) {
|
|
372
|
+
if (this.$fastController.isConnected) {
|
|
373
|
+
this.value = this.firstSelectedOption?.value ?? "";
|
|
374
|
+
}
|
|
375
|
+
if (shouldEmit) {
|
|
376
|
+
this.$emit("input");
|
|
377
|
+
this.$emit("change", this, {
|
|
378
|
+
bubbles: true,
|
|
379
|
+
composed: void 0
|
|
380
|
+
});
|
|
381
|
+
}
|
|
358
382
|
}
|
|
359
383
|
/**
|
|
384
|
+
* Updates the proxy value when the selected index changes.
|
|
385
|
+
*
|
|
386
|
+
* @param prev - the previous selected index
|
|
387
|
+
* @param next - the next selected index
|
|
388
|
+
*
|
|
360
389
|
* @internal
|
|
361
390
|
*/
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
391
|
+
selectedIndexChanged(prev, next) {
|
|
392
|
+
super.selectedIndexChanged(prev, next);
|
|
393
|
+
this.updateValue();
|
|
365
394
|
}
|
|
366
395
|
/**
|
|
396
|
+
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
397
|
+
*
|
|
398
|
+
* @param prev - The previous disabled value
|
|
399
|
+
* @param next - The next disabled value
|
|
400
|
+
*
|
|
367
401
|
* @internal
|
|
368
402
|
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
case "Backspace":
|
|
373
|
-
case "Delete":
|
|
374
|
-
case "Enter":
|
|
375
|
-
case " ": {
|
|
376
|
-
this._onTagRemoved(this.values[tagIndex]);
|
|
377
|
-
DOM.processUpdates();
|
|
378
|
-
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexForRemoved_fn).call(this, tagIndex));
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
case "ArrowLeft":
|
|
382
|
-
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, tagIndex) ?? tagIndex);
|
|
383
|
-
break;
|
|
384
|
-
case "ArrowRight":
|
|
385
|
-
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, tagIndex));
|
|
386
|
-
break;
|
|
403
|
+
disabledChanged(prev, next) {
|
|
404
|
+
if (super.disabledChanged) {
|
|
405
|
+
super.disabledChanged(prev, next);
|
|
387
406
|
}
|
|
388
|
-
|
|
407
|
+
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
389
408
|
}
|
|
390
409
|
/**
|
|
410
|
+
* Handle opening and closing the listbox when the select is clicked.
|
|
411
|
+
*
|
|
412
|
+
* @param e - the mouse event
|
|
391
413
|
* @internal
|
|
392
414
|
*/
|
|
393
|
-
|
|
415
|
+
clickHandler(e) {
|
|
394
416
|
if (this.disabled) {
|
|
395
417
|
return;
|
|
396
418
|
}
|
|
397
|
-
const
|
|
419
|
+
const clickedOption = e.target.closest(
|
|
398
420
|
`option,[role=option]`
|
|
399
421
|
);
|
|
400
|
-
if (
|
|
401
|
-
|
|
422
|
+
if (clickedOption && clickedOption.disabled) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (this.multiple) {
|
|
426
|
+
this.uncheckAllOptions();
|
|
427
|
+
this.activeIndex = this.options.indexOf(clickedOption);
|
|
428
|
+
this.checkActiveIndex();
|
|
429
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
430
|
+
} else {
|
|
431
|
+
super.clickHandler(e);
|
|
432
|
+
}
|
|
433
|
+
if (this.collapsible) {
|
|
434
|
+
this.open = !this.open;
|
|
435
|
+
}
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Handles focus state when the element or its children lose focus.
|
|
440
|
+
*
|
|
441
|
+
* @param e - The focus event
|
|
442
|
+
* @internal
|
|
443
|
+
*/
|
|
444
|
+
focusoutHandler(e) {
|
|
445
|
+
if (this.multiple) {
|
|
446
|
+
this.uncheckAllOptions();
|
|
447
|
+
}
|
|
448
|
+
if (!this.open) {
|
|
449
|
+
return true;
|
|
450
|
+
}
|
|
451
|
+
const focusTarget = e.relatedTarget;
|
|
452
|
+
if (this.isSameNode(focusTarget)) {
|
|
453
|
+
this.focus();
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (!this.options.includes(focusTarget)) {
|
|
457
|
+
this.open = false;
|
|
458
|
+
if (this.indexWhenOpened !== this.selectedIndex) {
|
|
459
|
+
this.updateValue(true);
|
|
460
|
+
}
|
|
402
461
|
}
|
|
403
462
|
}
|
|
404
463
|
/**
|
|
464
|
+
* Updates the value when an option's value changes.
|
|
465
|
+
*
|
|
466
|
+
* @param source - the source object
|
|
467
|
+
* @param propertyName - the property to evaluate
|
|
468
|
+
*
|
|
405
469
|
* @internal
|
|
406
470
|
*/
|
|
407
|
-
|
|
408
|
-
|
|
471
|
+
handleChange(source, propertyName) {
|
|
472
|
+
super.handleChange(source, propertyName);
|
|
473
|
+
if (propertyName === "value") {
|
|
474
|
+
this.updateValue();
|
|
475
|
+
}
|
|
409
476
|
}
|
|
410
477
|
/**
|
|
478
|
+
* Prevents focus when a scrollbar is clicked.
|
|
479
|
+
*
|
|
480
|
+
* @param e - the mouse event object
|
|
481
|
+
*
|
|
411
482
|
* @internal
|
|
412
483
|
*/
|
|
413
|
-
|
|
414
|
-
|
|
484
|
+
mousedownHandler(e) {
|
|
485
|
+
if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) {
|
|
486
|
+
return super.mousedownHandler(e);
|
|
487
|
+
}
|
|
488
|
+
return this.collapsible;
|
|
489
|
+
}
|
|
490
|
+
multipleChanged(prev, next) {
|
|
491
|
+
super.multipleChanged(prev, next);
|
|
492
|
+
this.options.forEach((o) => {
|
|
493
|
+
o.checked = next ? false : void 0;
|
|
494
|
+
});
|
|
495
|
+
this.setSelectedOptions();
|
|
496
|
+
if (this.proxy) {
|
|
497
|
+
this.proxy.multiple = next;
|
|
498
|
+
}
|
|
415
499
|
}
|
|
416
500
|
/**
|
|
501
|
+
* Updates the selectedness of each option when the list of selected options changes.
|
|
502
|
+
*
|
|
503
|
+
* @param prev - the previous list of selected options
|
|
504
|
+
* @param next - the current list of selected options
|
|
505
|
+
*
|
|
417
506
|
* @internal
|
|
418
507
|
*/
|
|
419
|
-
|
|
420
|
-
super.
|
|
421
|
-
|
|
508
|
+
selectedOptionsChanged(prev, next) {
|
|
509
|
+
super.selectedOptionsChanged(prev, next);
|
|
510
|
+
this.options.forEach((o, i) => {
|
|
511
|
+
const proxyOption = this.proxy.options.item(i);
|
|
512
|
+
if (proxyOption) {
|
|
513
|
+
proxyOption.selected = o.selected;
|
|
514
|
+
}
|
|
515
|
+
});
|
|
422
516
|
}
|
|
423
517
|
/**
|
|
518
|
+
* Resets and fills the proxy to match the component's options.
|
|
519
|
+
*
|
|
424
520
|
* @internal
|
|
425
521
|
*/
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
522
|
+
setProxyOptions() {
|
|
523
|
+
if (this.proxy instanceof HTMLSelectElement && this.options) {
|
|
524
|
+
this.proxy.options.length = 0;
|
|
525
|
+
this.options.forEach((option) => {
|
|
526
|
+
const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
|
|
527
|
+
if (proxyOption) {
|
|
528
|
+
this.proxy.options.add(proxyOption);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
429
532
|
}
|
|
430
533
|
/**
|
|
534
|
+
* Handles keydown actions when the select is in multiple selection mode.
|
|
535
|
+
*
|
|
431
536
|
* @internal
|
|
432
537
|
*/
|
|
433
|
-
|
|
538
|
+
multipleKeydownHandler(e) {
|
|
434
539
|
if (this.disabled) {
|
|
435
540
|
return;
|
|
436
541
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
542
|
+
const { key, shiftKey } = e;
|
|
543
|
+
this.shouldSkipFocus = false;
|
|
544
|
+
switch (key) {
|
|
545
|
+
case keyHome: {
|
|
546
|
+
this.checkFirstOption(shiftKey);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
case keyArrowDown: {
|
|
550
|
+
this.checkNextOption(shiftKey);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
case keyArrowUp: {
|
|
554
|
+
this.checkPreviousOption(shiftKey);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
case keyEnd: {
|
|
558
|
+
this.checkLastOption(shiftKey);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
case keyTab: {
|
|
562
|
+
this.focusAndScrollOptionIntoView();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
case keyEscape: {
|
|
566
|
+
this.uncheckAllOptions();
|
|
567
|
+
this.checkActiveIndex();
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
case keySpace: {
|
|
571
|
+
e.preventDefault();
|
|
572
|
+
if (this.typeaheadExpired) {
|
|
573
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
default: {
|
|
578
|
+
if (key.length === 1) {
|
|
579
|
+
this.handleTypeAhead(`${key}`);
|
|
580
|
+
}
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
440
583
|
}
|
|
441
584
|
}
|
|
585
|
+
/**
|
|
586
|
+
* Handle keyboard interaction for the select.
|
|
587
|
+
*
|
|
588
|
+
* @param e - the keyboard event
|
|
589
|
+
* @internal
|
|
590
|
+
*/
|
|
591
|
+
keydownHandler(e) {
|
|
592
|
+
const selectedIndexBefore = this.selectedIndex;
|
|
593
|
+
if (this.multiple) {
|
|
594
|
+
this.multipleKeydownHandler(e);
|
|
595
|
+
} else {
|
|
596
|
+
super.keydownHandler(e);
|
|
597
|
+
}
|
|
598
|
+
const key = e.key;
|
|
599
|
+
switch (key) {
|
|
600
|
+
case keySpace: {
|
|
601
|
+
e.preventDefault();
|
|
602
|
+
if (this.collapsible && this.typeaheadExpired) {
|
|
603
|
+
this.open = !this.open;
|
|
604
|
+
}
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
case keyHome:
|
|
608
|
+
case keyEnd: {
|
|
609
|
+
e.preventDefault();
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
case keyEnter: {
|
|
613
|
+
e.preventDefault();
|
|
614
|
+
this.open = !this.open;
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
case keyEscape: {
|
|
618
|
+
if (this.collapsible && this.open) {
|
|
619
|
+
e.preventDefault();
|
|
620
|
+
this.open = false;
|
|
621
|
+
}
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
case keyTab: {
|
|
625
|
+
if (this.collapsible && this.open) {
|
|
626
|
+
e.preventDefault();
|
|
627
|
+
this.open = false;
|
|
628
|
+
}
|
|
629
|
+
return true;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) {
|
|
633
|
+
this.updateValue(true);
|
|
634
|
+
}
|
|
635
|
+
return !(e.key === keyArrowDown || e.key === keyArrowUp);
|
|
636
|
+
}
|
|
442
637
|
connectedCallback() {
|
|
443
638
|
super.connectedCallback();
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
__privateGet(this, _resizeObserver).observe(this._contentArea);
|
|
639
|
+
this.addEventListener("focusout", this.focusoutHandler);
|
|
640
|
+
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
448
641
|
}
|
|
449
642
|
disconnectedCallback() {
|
|
643
|
+
this.removeEventListener("focusout", this.focusoutHandler);
|
|
644
|
+
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
450
645
|
super.disconnectedCallback();
|
|
451
|
-
__privateGet(this, _resizeObserver).disconnect();
|
|
452
646
|
}
|
|
453
647
|
/**
|
|
648
|
+
*
|
|
454
649
|
* @internal
|
|
455
650
|
*/
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
};
|
|
460
|
-
_SearchableSelect_instances = new WeakSet();
|
|
461
|
-
updateValuesThroughUserInteraction_fn = function(newValues) {
|
|
462
|
-
this.values = newValues;
|
|
463
|
-
this.$emit("change", void 0, {
|
|
464
|
-
bubbles: false
|
|
465
|
-
});
|
|
466
|
-
this.$emit("input", void 0, {
|
|
467
|
-
bubbles: false
|
|
468
|
-
});
|
|
469
|
-
};
|
|
470
|
-
updateValuesWhileMaintainingOrder_fn = function(newValues) {
|
|
471
|
-
const oldSet = new Set(this.values);
|
|
472
|
-
const newSet = new Set(newValues);
|
|
473
|
-
this.values = [...this.values].filter((v) => newSet.has(v)).concat([...newValues].filter((v) => !oldSet.has(v)));
|
|
474
|
-
};
|
|
475
|
-
isValidValue_fn = function(value) {
|
|
476
|
-
return this._slottedOptions.some((option) => option.value === value);
|
|
477
|
-
};
|
|
478
|
-
_slottedOptionsChangeHandler = new WeakMap();
|
|
479
|
-
updateSelectedOnSlottedOptions_fn = function() {
|
|
480
|
-
for (const option of this._slottedOptions) {
|
|
481
|
-
option.selected = this.values.includes(option.value);
|
|
482
|
-
__privateMethod(this, _SearchableSelect_instances, updateClonedTagIconOfOption_fn).call(this, option);
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
handleOptionInteraction_fn = function(option) {
|
|
486
|
-
const value = option.value;
|
|
487
|
-
let newValues;
|
|
488
|
-
const isSelection = !this.values.includes(value);
|
|
489
|
-
if (this.multiple) {
|
|
490
|
-
if (isSelection) {
|
|
491
|
-
newValues = [...this.values, value];
|
|
492
|
-
} else {
|
|
493
|
-
newValues = this.values.filter((option2) => option2 !== value);
|
|
494
|
-
}
|
|
495
|
-
this._inputValue = "";
|
|
496
|
-
} else {
|
|
497
|
-
if (isSelection) {
|
|
498
|
-
newValues = [value];
|
|
499
|
-
this._inputValue = option.text;
|
|
500
|
-
} else {
|
|
501
|
-
newValues = [];
|
|
651
|
+
updateDisplayValue() {
|
|
652
|
+
if (this.collapsible) {
|
|
653
|
+
Observable.notify(this, "displayValue");
|
|
502
654
|
}
|
|
503
|
-
this.open = false;
|
|
504
655
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
_clonedTagIcons = new WeakMap();
|
|
509
|
-
tagIconOfOption_fn = function(option) {
|
|
510
|
-
return option.querySelector('[slot="tag-icon"]');
|
|
511
|
-
};
|
|
512
|
-
updateClonedTagIconOfOption_fn = function(option) {
|
|
513
|
-
if (option.selected && __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option)) {
|
|
514
|
-
let clone = __privateGet(this, _clonedTagIcons).get(option);
|
|
515
|
-
if (!clone) {
|
|
516
|
-
clone = __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option).cloneNode(true);
|
|
517
|
-
__privateGet(this, _clonedTagIcons).set(option, clone);
|
|
518
|
-
}
|
|
519
|
-
clone.slot = this._tagIconSlotName(option.value);
|
|
520
|
-
this.appendChild(clone);
|
|
521
|
-
} else {
|
|
522
|
-
const clone = __privateGet(this, _clonedTagIcons).get(option);
|
|
523
|
-
if (clone) {
|
|
524
|
-
clone.remove();
|
|
525
|
-
__privateGet(this, _clonedTagIcons).delete(option);
|
|
656
|
+
labelChanged() {
|
|
657
|
+
if (!this.ariaLabel) {
|
|
658
|
+
this.ariaLabel = this.label;
|
|
526
659
|
}
|
|
527
660
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
const newFilteredOptions = [];
|
|
532
|
-
for (const option of this._slottedOptions ?? []) {
|
|
533
|
-
if (__privateGet(this, _suppressFilter) || this._inputValue === "") {
|
|
534
|
-
option.hidden = false;
|
|
535
|
-
option._matchedRange = null;
|
|
536
|
-
} else {
|
|
537
|
-
const matchIndex = option.text.toLowerCase().indexOf(this._inputValue.toLowerCase());
|
|
538
|
-
const matchedRange = matchIndex === -1 ? null : { from: matchIndex, to: matchIndex + this._inputValue.length };
|
|
539
|
-
option.hidden = !matchedRange;
|
|
540
|
-
option._matchedRange = matchedRange;
|
|
541
|
-
}
|
|
542
|
-
if (!option.hidden) {
|
|
543
|
-
newFilteredOptions.push(option);
|
|
544
|
-
}
|
|
661
|
+
get displayValue() {
|
|
662
|
+
Observable.track(this, "displayValue");
|
|
663
|
+
return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
|
|
545
664
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
(option) => !option.disabled
|
|
550
|
-
);
|
|
551
|
-
};
|
|
552
|
-
transitionHighlightedOptionTo_fn = function(index) {
|
|
553
|
-
if (typeof this._highlightedOptionIndex === "number") {
|
|
554
|
-
this._filteredEnabledOptions[this._highlightedOptionIndex]._highlighted = false;
|
|
555
|
-
}
|
|
556
|
-
if (typeof index === "number") {
|
|
557
|
-
if (!this._filteredEnabledOptions.length) {
|
|
558
|
-
index = null;
|
|
559
|
-
} else {
|
|
560
|
-
index = Math.max(
|
|
561
|
-
0,
|
|
562
|
-
Math.min(this._filteredEnabledOptions.length - 1, index)
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
this._highlightedOptionIndex = index;
|
|
567
|
-
if (typeof this._highlightedOptionIndex === "number") {
|
|
568
|
-
const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
|
|
569
|
-
highlightedOption._highlighted = true;
|
|
570
|
-
scrollIntoView(highlightedOption, this._listbox, "nearest");
|
|
571
|
-
this._changeDescription = this.locale.searchableSelect.optionFocusedMessage(
|
|
572
|
-
highlightedOption.text,
|
|
573
|
-
this._highlightedOptionIndex + 1,
|
|
574
|
-
this._filteredEnabledOptions.length
|
|
665
|
+
setDefaultSelectedOption() {
|
|
666
|
+
const options = Array.from(this.children).filter(
|
|
667
|
+
Listbox$1.slottedOptionFilter
|
|
575
668
|
);
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
__privateMethod(this, _SearchableSelect_instances, handleOptionInteraction_fn).call(this, this._filteredEnabledOptions[this._highlightedOptionIndex]);
|
|
583
|
-
};
|
|
584
|
-
highlightFirstOption_fn = function() {
|
|
585
|
-
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, 0);
|
|
586
|
-
};
|
|
587
|
-
highlightLastOption_fn = function() {
|
|
588
|
-
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, this._filteredEnabledOptions.length - 1);
|
|
589
|
-
};
|
|
590
|
-
highlightPrevPage_fn = function() {
|
|
591
|
-
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - PageSize);
|
|
592
|
-
};
|
|
593
|
-
highlightNextPage_fn = function() {
|
|
594
|
-
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + PageSize);
|
|
595
|
-
};
|
|
596
|
-
highlightPreviousOption_fn = function() {
|
|
597
|
-
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - 1);
|
|
598
|
-
};
|
|
599
|
-
highlightNextOption_fn = function() {
|
|
600
|
-
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + 1);
|
|
601
|
-
};
|
|
602
|
-
textForValue_fn = function(value) {
|
|
603
|
-
const option = this._slottedOptions.find(
|
|
604
|
-
(option2) => option2.value === value
|
|
605
|
-
);
|
|
606
|
-
return option.text;
|
|
607
|
-
};
|
|
608
|
-
/**
|
|
609
|
-
* @internal
|
|
610
|
-
*/
|
|
611
|
-
measureTagWidth_fn = function(label, removable, hasIcon) {
|
|
612
|
-
const tag = document.createElement(this._optionTagTagName);
|
|
613
|
-
tag.label = label;
|
|
614
|
-
tag.removable = removable;
|
|
615
|
-
tag.style.cssText = "position: absolute; visibility: hidden;";
|
|
616
|
-
tag.hasIconPlaceholder = hasIcon;
|
|
617
|
-
this.shadowRoot.appendChild(tag);
|
|
618
|
-
const width = tag.getBoundingClientRect().width;
|
|
619
|
-
tag.remove();
|
|
620
|
-
return width;
|
|
621
|
-
};
|
|
622
|
-
updateTagLayout_fn = function() {
|
|
623
|
-
if (!this.multiple) {
|
|
624
|
-
this._numElidedTags = 0;
|
|
625
|
-
this._tagRows = [];
|
|
626
|
-
this._lastTagRow = [];
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
if (this.externalTags) {
|
|
630
|
-
this._numElidedTags = this.values.length;
|
|
631
|
-
this._tagRows = [];
|
|
632
|
-
this._lastTagRow = [];
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
const rowWidth = this._contentArea.getBoundingClientRect().width;
|
|
636
|
-
const rows = [[]];
|
|
637
|
-
let currentRowIndex = 0;
|
|
638
|
-
let currentRowWidth = InputMinWidthPx;
|
|
639
|
-
let i;
|
|
640
|
-
for (i = this.values.length - 1; i >= 0; i--) {
|
|
641
|
-
const isLastRow = this.maxLines && currentRowIndex === this.maxLines - 1;
|
|
642
|
-
const tagWidth = __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._tagLabelForValue(this.values[i]), true, __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, this.selectedOptions[i]) !== null);
|
|
643
|
-
const entry = {
|
|
644
|
-
value: this.values[i],
|
|
645
|
-
width: tagWidth
|
|
646
|
-
};
|
|
647
|
-
let elidedTagCounterWidth = 0;
|
|
648
|
-
if (isLastRow) {
|
|
649
|
-
const numElidedTags = i;
|
|
650
|
-
if (numElidedTags) {
|
|
651
|
-
elidedTagCounterWidth = TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, numElidedTags.toString(), false, false);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
const totalWidthNeeded = currentRowWidth + TagGapPx + tagWidth + elidedTagCounterWidth;
|
|
655
|
-
if (totalWidthNeeded > rowWidth) {
|
|
656
|
-
if (isLastRow) {
|
|
657
|
-
if (i === this.values.length - 1) {
|
|
658
|
-
rows[currentRowIndex].unshift(entry);
|
|
659
|
-
currentRowWidth += TagGapPx + tagWidth;
|
|
660
|
-
} else {
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
} else {
|
|
664
|
-
rows.push([]);
|
|
665
|
-
currentRowIndex++;
|
|
666
|
-
rows[currentRowIndex].unshift(entry);
|
|
667
|
-
currentRowWidth = tagWidth;
|
|
668
|
-
}
|
|
669
|
-
continue;
|
|
670
|
-
}
|
|
671
|
-
rows[currentRowIndex].unshift(entry);
|
|
672
|
-
currentRowWidth += TagGapPx + tagWidth;
|
|
673
|
-
}
|
|
674
|
-
this._numElidedTags = i + 1;
|
|
675
|
-
rows.reverse();
|
|
676
|
-
for (let i2 = 0; i2 < rows.length - 1; i2++) {
|
|
677
|
-
let lineWidth = rows[i2].map((e) => e.width).reduce((a, b) => a + b, 0) + (rows[i2].length - 1) * TagGapPx;
|
|
678
|
-
if (i2 === 0 && this._numElidedTags) {
|
|
679
|
-
lineWidth += TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._numElidedTags.toString(), false, false);
|
|
680
|
-
}
|
|
681
|
-
while (rows[i2 + 1].length && lineWidth + TagGapPx + rows[i2 + 1][0].width <= rowWidth) {
|
|
682
|
-
const nextTag = rows[i2 + 1].shift();
|
|
683
|
-
rows[i2].push(nextTag);
|
|
684
|
-
lineWidth += TagGapPx + nextTag.width;
|
|
669
|
+
const selectedIndex = options.findIndex(
|
|
670
|
+
(el) => el.hasAttribute("selected") || el.selected || el.value === this.value
|
|
671
|
+
);
|
|
672
|
+
if (selectedIndex === -1 && !this.placeholderOption) {
|
|
673
|
+
this.selectedIndex = 0;
|
|
674
|
+
return;
|
|
685
675
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
this._lastTagRow = rowValues.slice(-1)[0];
|
|
690
|
-
};
|
|
691
|
-
moveTagFocusTo_fn = function(index) {
|
|
692
|
-
if (index === null) {
|
|
693
|
-
this._input.focus();
|
|
694
|
-
} else {
|
|
695
|
-
this.shadowRoot.querySelector(`[data-index="${index}"]`)?.focus();
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
nextTagIndexLeft_fn = function(index) {
|
|
699
|
-
if (!this.values.length) {
|
|
700
|
-
return null;
|
|
701
|
-
}
|
|
702
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
703
|
-
if (!this._isTagDisabled(this.values[i])) {
|
|
704
|
-
return i;
|
|
676
|
+
if (selectedIndex !== -1 || this.placeholder !== "") {
|
|
677
|
+
this.selectedIndex = selectedIndex;
|
|
678
|
+
return;
|
|
705
679
|
}
|
|
706
680
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
681
|
+
/*
|
|
682
|
+
* @internal
|
|
683
|
+
*/
|
|
684
|
+
slottedOptionsChanged(prev, next) {
|
|
685
|
+
this.options.forEach((o) => {
|
|
686
|
+
const notifier = Observable.getNotifier(o);
|
|
687
|
+
notifier.unsubscribe(this, "value");
|
|
688
|
+
});
|
|
689
|
+
super.slottedOptionsChanged(prev, next);
|
|
690
|
+
this.options.forEach((o) => {
|
|
691
|
+
const notifier = Observable.getNotifier(o);
|
|
692
|
+
notifier.subscribe(this, "value");
|
|
693
|
+
});
|
|
694
|
+
this.setProxyOptions();
|
|
695
|
+
this.updateValue();
|
|
696
|
+
const scale = this.getAttribute("scale") || this.scale;
|
|
697
|
+
next.forEach((element) => {
|
|
698
|
+
if (scale) {
|
|
699
|
+
element.setAttribute("scale", scale);
|
|
700
|
+
element.scale = scale;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
this.proxy.value = this.value;
|
|
704
|
+
this.validate();
|
|
712
705
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
706
|
+
formResetCallback() {
|
|
707
|
+
this.setProxyOptions();
|
|
708
|
+
super.setDefaultSelectedOption();
|
|
709
|
+
if (this.selectedIndex === -1) {
|
|
710
|
+
this.selectedIndex = 0;
|
|
716
711
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
};
|
|
720
|
-
nextTagIndexForRemoved_fn = function(index) {
|
|
721
|
-
return __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, index - 1) ?? __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, index);
|
|
722
|
-
};
|
|
723
|
-
// --- Form handling ---
|
|
724
|
-
determineInitialValues_fn = function() {
|
|
725
|
-
return this.initialValues.length ? this.initialValues : this.initialValue ? [this.initialValue] : [];
|
|
726
|
-
};
|
|
727
|
-
updateFormValue_fn = function() {
|
|
728
|
-
if (!this.name) {
|
|
729
|
-
this.setFormValue(null);
|
|
730
|
-
} else {
|
|
731
|
-
const formData = new FormData();
|
|
732
|
-
for (const value of this.values) {
|
|
733
|
-
formData.append(this.name, value);
|
|
712
|
+
if (this.placeholder) {
|
|
713
|
+
this.selectedIndex = -1;
|
|
734
714
|
}
|
|
735
|
-
this.setFormValue(formData);
|
|
736
715
|
}
|
|
737
716
|
};
|
|
738
|
-
|
|
739
|
-
__decorateClass$1([
|
|
740
|
-
attr
|
|
741
|
-
], SearchableSelect.prototype, "appearance", 2);
|
|
742
|
-
__decorateClass$1([
|
|
743
|
-
attr
|
|
744
|
-
], SearchableSelect.prototype, "shape", 2);
|
|
745
|
-
__decorateClass$1([
|
|
746
|
-
attr({ mode: "boolean", attribute: "fixed-dropdown" })
|
|
747
|
-
], SearchableSelect.prototype, "fixedDropdown", 2);
|
|
748
|
-
__decorateClass$1([
|
|
749
|
-
attr
|
|
750
|
-
], SearchableSelect.prototype, "placeholder", 2);
|
|
751
|
-
__decorateClass$1([
|
|
752
|
-
attr({ mode: "boolean" })
|
|
753
|
-
], SearchableSelect.prototype, "open", 2);
|
|
754
|
-
__decorateClass$1([
|
|
755
|
-
attr({ mode: "boolean" })
|
|
756
|
-
], SearchableSelect.prototype, "multiple", 2);
|
|
757
|
-
__decorateClass$1([
|
|
758
|
-
attr({ attribute: "external-tags", mode: "boolean" })
|
|
759
|
-
], SearchableSelect.prototype, "externalTags", 2);
|
|
760
|
-
__decorateClass$1([
|
|
761
|
-
attr({ attribute: "max-lines", converter: nullableNumberConverter })
|
|
762
|
-
], SearchableSelect.prototype, "maxLines", 2);
|
|
763
|
-
__decorateClass$1([
|
|
764
|
-
observable
|
|
765
|
-
], SearchableSelect.prototype, "values", 2);
|
|
766
|
-
__decorateClass$1([
|
|
767
|
-
observable
|
|
768
|
-
], SearchableSelect.prototype, "initialValues", 2);
|
|
769
|
-
__decorateClass$1([
|
|
770
|
-
observable
|
|
771
|
-
], SearchableSelect.prototype, "_input", 2);
|
|
772
|
-
__decorateClass$1([
|
|
773
|
-
observable
|
|
774
|
-
], SearchableSelect.prototype, "_inputValue", 2);
|
|
775
|
-
__decorateClass$1([
|
|
776
|
-
observable
|
|
777
|
-
], SearchableSelect.prototype, "_slottedOptions", 2);
|
|
778
|
-
__decorateClass$1([
|
|
779
|
-
observable
|
|
780
|
-
], SearchableSelect.prototype, "_filteredOptions", 2);
|
|
781
|
-
__decorateClass$1([
|
|
782
|
-
observable
|
|
783
|
-
], SearchableSelect.prototype, "_filteredEnabledOptions", 2);
|
|
784
|
-
__decorateClass$1([
|
|
785
|
-
observable
|
|
786
|
-
], SearchableSelect.prototype, "_highlightedOptionIndex", 2);
|
|
787
|
-
__decorateClass$1([
|
|
717
|
+
__decorateClass([
|
|
788
718
|
observable
|
|
789
|
-
],
|
|
790
|
-
|
|
719
|
+
], Select.prototype, "activeIndex", 2);
|
|
720
|
+
// @ts-expect-error Type is incorrectly non-optional
|
|
721
|
+
__decorateClass([
|
|
722
|
+
attr({ mode: "boolean" })
|
|
723
|
+
], Select.prototype, "multiple", 2);
|
|
724
|
+
__decorateClass([
|
|
725
|
+
attr({ attribute: "open", mode: "boolean" })
|
|
726
|
+
], Select.prototype, "open", 2);
|
|
727
|
+
__decorateClass([
|
|
728
|
+
volatile
|
|
729
|
+
], Select.prototype, "collapsible", 1);
|
|
730
|
+
__decorateClass([
|
|
791
731
|
observable
|
|
792
|
-
],
|
|
793
|
-
__decorateClass
|
|
732
|
+
], Select.prototype, "control", 2);
|
|
733
|
+
__decorateClass([
|
|
794
734
|
observable
|
|
795
|
-
],
|
|
796
|
-
__decorateClass
|
|
735
|
+
], Select.prototype, "maxHeight", 2);
|
|
736
|
+
__decorateClass([
|
|
797
737
|
observable
|
|
798
|
-
],
|
|
799
|
-
__decorateClass
|
|
738
|
+
], Select.prototype, "_anchor", 2);
|
|
739
|
+
__decorateClass([
|
|
740
|
+
attr()
|
|
741
|
+
], Select.prototype, "scale", 2);
|
|
742
|
+
__decorateClass([
|
|
743
|
+
attr
|
|
744
|
+
], Select.prototype, "appearance", 2);
|
|
745
|
+
__decorateClass([
|
|
746
|
+
attr
|
|
747
|
+
], Select.prototype, "shape", 2);
|
|
748
|
+
__decorateClass([
|
|
749
|
+
attr({ mode: "boolean", attribute: "fixed-dropdown" })
|
|
750
|
+
], Select.prototype, "fixedDropdown", 2);
|
|
751
|
+
__decorateClass([
|
|
752
|
+
attr
|
|
753
|
+
], Select.prototype, "placeholder", 2);
|
|
754
|
+
__decorateClass([
|
|
800
755
|
observable
|
|
801
|
-
],
|
|
802
|
-
__decorateClass
|
|
803
|
-
attr({ mode: "boolean" })
|
|
804
|
-
], SearchableSelect.prototype, "clearable", 2);
|
|
805
|
-
__decorateClass$1([
|
|
756
|
+
], Select.prototype, "placeholderOption", 2);
|
|
757
|
+
__decorateClass([
|
|
806
758
|
observable
|
|
807
|
-
],
|
|
808
|
-
__decorateClass
|
|
759
|
+
], Select.prototype, "_feedbackWrapper", 2);
|
|
760
|
+
__decorateClass([
|
|
809
761
|
observable
|
|
810
|
-
],
|
|
811
|
-
|
|
762
|
+
], Select.prototype, "metaSlottedContent", 2);
|
|
763
|
+
Select = __decorateClass([
|
|
812
764
|
errorText,
|
|
813
765
|
formElements
|
|
814
|
-
],
|
|
766
|
+
], Select);
|
|
767
|
+
class DelegatesARIASelect {
|
|
768
|
+
}
|
|
769
|
+
// @ts-expect-error Type is incorrectly non-optional
|
|
770
|
+
__decorateClass([
|
|
771
|
+
observable
|
|
772
|
+
], DelegatesARIASelect.prototype, "ariaControls", 2);
|
|
815
773
|
applyMixinsWithObservables(
|
|
816
|
-
|
|
774
|
+
Select,
|
|
817
775
|
AffixIconWithTrailing,
|
|
818
776
|
FormElementHelperText,
|
|
819
777
|
FormElementSuccessText,
|
|
820
|
-
|
|
778
|
+
DelegatesARIASelect
|
|
821
779
|
);
|
|
822
780
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
__decorateClass([
|
|
846
|
-
attr
|
|
847
|
-
], OptionTag.prototype, "shape");
|
|
848
|
-
__decorateClass([
|
|
849
|
-
attr
|
|
850
|
-
], OptionTag.prototype, "label");
|
|
851
|
-
__decorateClass([
|
|
852
|
-
attr({ mode: "boolean" })
|
|
853
|
-
], OptionTag.prototype, "removable");
|
|
854
|
-
__decorateClass([
|
|
855
|
-
attr({ mode: "boolean" })
|
|
856
|
-
], OptionTag.prototype, "disabled");
|
|
857
|
-
__decorateClass([
|
|
858
|
-
observable
|
|
859
|
-
], OptionTag.prototype, "hasIconPlaceholder");
|
|
860
|
-
applyMixins(OptionTag, Localized);
|
|
861
|
-
|
|
862
|
-
const getStateClasses = (x) => classNames(
|
|
863
|
-
["disabled", x.disabled],
|
|
864
|
-
[`appearance-${x.appearance}`, Boolean(x.appearance)],
|
|
865
|
-
[`shape-${x.shape}`, Boolean(x.shape)],
|
|
866
|
-
["error", Boolean(x.errorValidationMessage)],
|
|
867
|
-
["success", !!x.successText]
|
|
781
|
+
const getStateClasses = ({
|
|
782
|
+
shape,
|
|
783
|
+
disabled,
|
|
784
|
+
appearance,
|
|
785
|
+
metaSlottedContent,
|
|
786
|
+
errorValidationMessage,
|
|
787
|
+
successText,
|
|
788
|
+
placeholder,
|
|
789
|
+
value,
|
|
790
|
+
scale
|
|
791
|
+
}) => classNames(
|
|
792
|
+
["disabled", disabled],
|
|
793
|
+
[`appearance-${appearance}`, Boolean(appearance)],
|
|
794
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
795
|
+
["has-meta", Boolean(metaSlottedContent?.length)],
|
|
796
|
+
["error", Boolean(errorValidationMessage)],
|
|
797
|
+
["success", !!successText],
|
|
798
|
+
["has-meta", Boolean(metaSlottedContent?.length)],
|
|
799
|
+
["shows-placeholder", Boolean(placeholder) && !value],
|
|
800
|
+
[`size-${scale}`, Boolean(scale)]
|
|
868
801
|
);
|
|
869
802
|
function renderLabel() {
|
|
870
|
-
return html`
|
|
871
|
-
|
|
872
|
-
|
|
803
|
+
return html` <label for="control" class="label" id="label">
|
|
804
|
+
${(x) => x.label}
|
|
805
|
+
</label>`;
|
|
873
806
|
}
|
|
874
|
-
|
|
875
|
-
const
|
|
807
|
+
function renderPlaceholder(context) {
|
|
808
|
+
const optionTag = context.tagFor(ListboxOption);
|
|
876
809
|
return html`
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
removable
|
|
883
|
-
:label="${(x, c) => getComponent(c)._tagLabelForValue(x)}"
|
|
884
|
-
:shape="${(_, c) => getComponent(c).shape}"
|
|
885
|
-
?disabled="${(x, c) => getComponent(c)._isTagDisabled(x)}"
|
|
886
|
-
@remove="${(x, c) => getComponent(c)._onTagRemoved(x)}"
|
|
887
|
-
@keydown="${(_, c) => getComponent(c)._onTagKeydown(c.event)}"
|
|
888
|
-
@mousedown="${() => false}">
|
|
889
|
-
<slot slot="icon" name="${(x, c) => getComponent(c)._tagIconSlotName(x)}"></slot>
|
|
890
|
-
</${optionTagTag}>
|
|
891
|
-
</div>
|
|
892
|
-
`;
|
|
893
|
-
};
|
|
894
|
-
const elidedTagTemplateFactory = (context, getComponent) => {
|
|
895
|
-
const optionTagTag = context.tagFor(OptionTag);
|
|
896
|
-
return html`
|
|
897
|
-
<${optionTagTag}
|
|
898
|
-
class="tag"
|
|
899
|
-
tabindex="-1"
|
|
900
|
-
:label="${(x, c) => getComponent(x, c)._numElidedTags.toString()}"
|
|
901
|
-
:shape="${(x, c) => getComponent(x, c).shape}"
|
|
902
|
-
?disabled="${(x, c) => getComponent(x, c).disabled}"
|
|
903
|
-
@mousedown="${() => false}">
|
|
904
|
-
</${optionTagTag}>
|
|
905
|
-
`;
|
|
906
|
-
};
|
|
907
|
-
function renderFieldset(context) {
|
|
908
|
-
const buttonTag = context.tagFor(Button$1);
|
|
810
|
+
<${optionTag} ${ref("placeholderOption")}
|
|
811
|
+
text="${(x) => x.placeholder}" hidden disabled>
|
|
812
|
+
</${optionTag}>`;
|
|
813
|
+
}
|
|
814
|
+
function selectValue(context) {
|
|
909
815
|
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
910
816
|
const chevronTemplate = chevronTemplateFactory(context);
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
context,
|
|
919
|
-
(_, c) => c.parent
|
|
920
|
-
);
|
|
921
|
-
return html`
|
|
922
|
-
<div
|
|
923
|
-
class="fieldset ${getStateClasses}"
|
|
924
|
-
@click="${(x, c) => x._onFieldsetClick(c.event)}"
|
|
925
|
-
${ref("_anchor")}
|
|
926
|
-
>
|
|
817
|
+
return html` <div
|
|
818
|
+
class="control ${getStateClasses}"
|
|
819
|
+
${ref("_anchor")}
|
|
820
|
+
id="control"
|
|
821
|
+
?disabled="${(x) => x.disabled}"
|
|
822
|
+
>
|
|
823
|
+
<div class="selected-value">
|
|
927
824
|
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
|
|
928
|
-
<
|
|
929
|
-
|
|
930
|
-
(x) => x._tagRows,
|
|
931
|
-
html`
|
|
932
|
-
<div class="tag-row">
|
|
933
|
-
${when(
|
|
934
|
-
(_, c) => c.isFirst && c.parent._numElidedTags,
|
|
935
|
-
nestedElidedTagTemplate
|
|
936
|
-
)}
|
|
937
|
-
${repeat((x) => x, nestedTagTemplate)}
|
|
938
|
-
</div>
|
|
939
|
-
`,
|
|
940
|
-
{ positioning: true }
|
|
941
|
-
)}
|
|
942
|
-
<div
|
|
943
|
-
class="tag-row ${(x) => classNames([
|
|
944
|
-
"contains-only-input",
|
|
945
|
-
x._tagRows.length > 0 && x._lastTagRow.length === 0
|
|
946
|
-
])}"
|
|
947
|
-
>
|
|
948
|
-
${when(
|
|
949
|
-
(x) => x._tagRows.length === 0 && x._numElidedTags,
|
|
950
|
-
elidedTagTemplate
|
|
951
|
-
)}
|
|
952
|
-
${repeat((x) => x._lastTagRow, tagTemplate)}
|
|
953
|
-
<input
|
|
954
|
-
id="control"
|
|
955
|
-
class="control"
|
|
956
|
-
autofocus
|
|
957
|
-
autocomplete="off"
|
|
958
|
-
aria-autocomplete="list"
|
|
959
|
-
aria-expanded="${(x) => x.open}"
|
|
960
|
-
aria-haspopup="listbox"
|
|
961
|
-
aria-controls="listbox"
|
|
962
|
-
placeholder="${(x) => x.multiple && x.values.length ? "" : x.placeholder}"
|
|
963
|
-
role="combobox"
|
|
964
|
-
type="text"
|
|
965
|
-
?disabled="${(x) => x.disabled}"
|
|
966
|
-
:value="${(x) => x._inputValue}"
|
|
967
|
-
@input="${(x, c) => x._onInputInput(c.event)}"
|
|
968
|
-
@focus="${(x, c) => x._onInputFocus(c.event)}"
|
|
969
|
-
@blur="${(x, c) => x._onInputBlur(c.event)}"
|
|
970
|
-
@keydown="${(x, c) => x._onInputKeydown(c.event)}"
|
|
971
|
-
${ref("_input")}
|
|
972
|
-
/>
|
|
973
|
-
</div>
|
|
974
|
-
</div>
|
|
975
|
-
<slot name="meta"></slot>
|
|
976
|
-
${when(
|
|
977
|
-
(x) => x._shouldShowClearButton,
|
|
978
|
-
html`<${buttonTag}
|
|
979
|
-
aria-label="${(x) => x.locale.searchableSelect.clearButtonLabel}"
|
|
980
|
-
@click="${(x) => x._onClearButtonClick()}"
|
|
981
|
-
@mousedown="${() => false}"
|
|
982
|
-
?disabled="${(x) => x.disabled}"
|
|
983
|
-
:shape="${(x) => x.shape}"
|
|
984
|
-
size="super-condensed"
|
|
985
|
-
icon="close-line"
|
|
986
|
-
appearance="ghost-light"
|
|
987
|
-
tabindex="-1"
|
|
988
|
-
></${buttonTag}>`
|
|
989
|
-
)}
|
|
990
|
-
${chevronTemplate}
|
|
825
|
+
<span class="text">${(x) => x.displayValue}</span>
|
|
826
|
+
<slot name="meta" ${slotted("metaSlottedContent")}></slot>
|
|
991
827
|
</div>
|
|
992
|
-
|
|
828
|
+
${chevronTemplate}
|
|
829
|
+
</div>`;
|
|
830
|
+
}
|
|
831
|
+
function setFixedDropdownVarWidth(x) {
|
|
832
|
+
return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
|
|
993
833
|
}
|
|
994
834
|
function renderControl(context) {
|
|
995
835
|
const popupTag = context.tagFor(Popup);
|
|
996
836
|
return html`
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
<div class="popup-wrapper">
|
|
1004
|
-
<${popupTag}
|
|
837
|
+
${when((x) => x.label, renderLabel())}
|
|
838
|
+
<div class="control-wrapper">
|
|
839
|
+
${when((x) => !x.multiple, selectValue(context))}
|
|
840
|
+
<${popupTag} class="popup"
|
|
841
|
+
style="${setFixedDropdownVarWidth}"
|
|
842
|
+
?open="${(x) => x.collapsible ? x.open : true}"
|
|
1005
843
|
:anchor="${(x) => x._anchor}"
|
|
1006
|
-
:open="${(x) => x.open}"
|
|
1007
|
-
class="popup"
|
|
1008
844
|
placement="bottom-start"
|
|
1009
|
-
strategy="${(x) => x.fixedDropdown ?
|
|
1010
|
-
<div
|
|
1011
|
-
|
|
845
|
+
strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
|
|
846
|
+
<div class="listbox"
|
|
847
|
+
id="${(x) => x.listboxId}"
|
|
1012
848
|
role="listbox"
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
${ref("
|
|
1016
|
-
|
|
1017
|
-
@mousedown="${() => false}"
|
|
1018
|
-
>
|
|
849
|
+
?disabled="${(x) => x.disabled}"
|
|
850
|
+
?hidden="${(x) => x.collapsible ? !x.open : false}"
|
|
851
|
+
${ref("listbox")}>
|
|
852
|
+
${when((x) => x.placeholder, renderPlaceholder(context))}
|
|
1019
853
|
<slot
|
|
1020
854
|
${slotted({
|
|
1021
|
-
filter: Listbox.slottedOptionFilter,
|
|
855
|
+
filter: Listbox$1.slottedOptionFilter,
|
|
1022
856
|
flatten: true,
|
|
1023
|
-
property: "
|
|
857
|
+
property: "slottedOptions"
|
|
1024
858
|
})}>
|
|
1025
859
|
</slot>
|
|
1026
|
-
|
|
1027
|
-
(x) => x._filteredOptions.length === 0,
|
|
1028
|
-
html`<div class="empty-message">
|
|
1029
|
-
${when(
|
|
1030
|
-
(x) => x._inputValue === "",
|
|
1031
|
-
html`<slot name="no-options">
|
|
1032
|
-
${(x) => x.locale.searchableSelect.noOptionsMessage}
|
|
1033
|
-
</slot>`
|
|
1034
|
-
)}
|
|
1035
|
-
${when(
|
|
1036
|
-
(x) => x._inputValue !== "",
|
|
1037
|
-
html`<slot name="no-matches">
|
|
1038
|
-
${(x) => x.locale.searchableSelect.noMatchesMessage}
|
|
1039
|
-
</slot>`
|
|
1040
|
-
)}
|
|
1041
|
-
</div>`
|
|
1042
|
-
)}
|
|
1043
|
-
</div>
|
|
860
|
+
</div>
|
|
1044
861
|
</${popupTag}>
|
|
1045
862
|
</div>
|
|
1046
|
-
|
|
1047
|
-
`;
|
|
863
|
+
`;
|
|
1048
864
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
865
|
+
function ifNotFromFeedback(handler) {
|
|
866
|
+
return (x, c) => {
|
|
867
|
+
if (!c.event.composedPath().includes(x._feedbackWrapper)) {
|
|
868
|
+
return handler(x, c.event);
|
|
869
|
+
}
|
|
870
|
+
return true;
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
const SelectTemplate = (context) => {
|
|
1051
874
|
return html`
|
|
1052
|
-
<template
|
|
1053
|
-
|
|
1054
|
-
|
|
875
|
+
<template
|
|
876
|
+
class="base"
|
|
877
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
878
|
+
aria-activedescendant="${(x) => x.ariaActiveDescendant}"
|
|
879
|
+
aria-controls="${(x) => x.ariaControls}"
|
|
880
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
881
|
+
aria-expanded="${(x) => x.ariaExpanded}"
|
|
882
|
+
aria-haspopup="${(x) => x.collapsible ? "listbox" : null}"
|
|
883
|
+
aria-multiselectable="${(x) => x.ariaMultiSelectable}"
|
|
884
|
+
role="combobox"
|
|
885
|
+
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
886
|
+
@click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
|
|
887
|
+
@focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
|
|
888
|
+
@focusout="${ifNotFromFeedback(
|
|
889
|
+
(x, e) => x.focusoutHandler(e)
|
|
890
|
+
)}"
|
|
891
|
+
@keydown="${ifNotFromFeedback((x, e) => {
|
|
892
|
+
x.open && handleEscapeKeyAndStopPropogation(e);
|
|
893
|
+
return x.keydownHandler(e);
|
|
894
|
+
})}"
|
|
895
|
+
@mousedown="${ifNotFromFeedback(
|
|
896
|
+
(x, e) => x.mousedownHandler(e)
|
|
897
|
+
)}"
|
|
898
|
+
>
|
|
899
|
+
${renderControl(context)}
|
|
900
|
+
<div class="feedback-wrapper" ${ref("_feedbackWrapper")}>
|
|
901
|
+
${getFeedbackTemplate(context)}
|
|
1055
902
|
</div>
|
|
1056
903
|
</template>
|
|
1057
904
|
`;
|
|
1058
905
|
};
|
|
1059
906
|
|
|
1060
|
-
const
|
|
1061
|
-
"
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
[
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
return html`
|
|
1068
|
-
<span
|
|
1069
|
-
class="remove-button"
|
|
1070
|
-
aria-label="${(x) => x.locale.searchableSelect.removeTagButtonLabel(x.label)}"
|
|
1071
|
-
role="button"
|
|
1072
|
-
tabindex="${(x) => x.disabled ? null : 0}"
|
|
1073
|
-
@click="${(x) => x._onClickRemove()}"
|
|
1074
|
-
>
|
|
1075
|
-
<${iconTag} name="close-line"></${iconTag}>
|
|
1076
|
-
</span>
|
|
1077
|
-
`;
|
|
1078
|
-
}
|
|
1079
|
-
const optionTagTemplate = (context) => {
|
|
1080
|
-
const iconTag = context.tagFor(Icon);
|
|
1081
|
-
return html`<span class="${getClasses}" aria-disabled="${(x) => x.disabled}">
|
|
1082
|
-
<slot name="icon" aria-hidden="true">
|
|
1083
|
-
${when(
|
|
1084
|
-
(x) => x.hasIconPlaceholder,
|
|
1085
|
-
html`<div class="icon-placeholder"></div>`
|
|
1086
|
-
)}
|
|
1087
|
-
</slot>
|
|
1088
|
-
${when(
|
|
1089
|
-
(x) => x.label,
|
|
1090
|
-
(x) => html`<span class="label">${x.label}</span>`
|
|
1091
|
-
)}
|
|
1092
|
-
${when((x) => x.removable, renderRemoveButton(iconTag))}
|
|
1093
|
-
</span>`;
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
const optionTagDefinition = OptionTag.compose({
|
|
1097
|
-
baseName: "option-tag",
|
|
1098
|
-
template: optionTagTemplate,
|
|
1099
|
-
styles: [optionTagStyles],
|
|
1100
|
-
shadowOptions: {
|
|
1101
|
-
delegatesFocus: true
|
|
1102
|
-
}
|
|
1103
|
-
});
|
|
1104
|
-
const searchableSelectDefinition = SearchableSelect.compose({
|
|
1105
|
-
baseName: "searchable-select",
|
|
1106
|
-
template: SearchableSelectTemplate,
|
|
1107
|
-
styles: [styles],
|
|
1108
|
-
shadowOptions: {
|
|
1109
|
-
delegatesFocus: true
|
|
907
|
+
const selectDefinition = defineVividComponent(
|
|
908
|
+
"select",
|
|
909
|
+
Select,
|
|
910
|
+
SelectTemplate,
|
|
911
|
+
[popupDefinition, iconDefinition, listboxOptionDefinition],
|
|
912
|
+
{
|
|
913
|
+
styles
|
|
1110
914
|
}
|
|
1111
|
-
});
|
|
1112
|
-
const searchableSelectRegistries = [
|
|
1113
|
-
...buttonRegistries,
|
|
1114
|
-
...popupRegistries,
|
|
1115
|
-
...iconRegistries,
|
|
1116
|
-
optionTagDefinition(),
|
|
1117
|
-
searchableSelectDefinition()
|
|
1118
|
-
];
|
|
1119
|
-
const registerSearchableSelect = registerFactory(
|
|
1120
|
-
searchableSelectRegistries
|
|
1121
915
|
);
|
|
916
|
+
const registerSelect = createRegisterFunction(selectDefinition);
|
|
1122
917
|
|
|
1123
|
-
export {
|
|
918
|
+
export { registerSelect as r, selectDefinition as s };
|