@vonage/vivid 5.23.1 → 5.25.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/README.md +1 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/audio-player/index.cjs +2 -2
- package/audio-player/index.js +3 -3
- package/avatar/index.cjs +10 -10
- package/avatar/index.js +4 -3
- package/badge/index.cjs +1 -1
- package/badge/index.js +1 -1
- package/breadcrumb-item/index.cjs +9 -5
- package/breadcrumb-item/index.js +11 -6
- package/bundled/affix.cjs +1 -1
- package/bundled/affix.js +1 -1
- package/bundled/definition10.cjs +2 -1
- package/bundled/definition10.js +3 -2
- package/bundled/definition11.cjs +4 -4
- package/bundled/definition11.js +4 -3
- package/bundled/definition12.cjs +1 -1
- package/bundled/definition12.js +1 -0
- package/bundled/definition15.cjs +8 -7
- package/bundled/definition15.js +27 -24
- package/bundled/definition17.cjs +7 -7
- package/bundled/definition17.js +22 -109
- package/bundled/definition18.cjs +12 -83
- package/bundled/definition18.js +20 -426
- package/bundled/definition19.cjs +87 -7
- package/bundled/definition19.js +433 -16
- package/bundled/definition20.cjs +7 -37
- package/bundled/definition20.js +17 -172
- package/bundled/definition21.cjs +35 -27
- package/bundled/definition21.js +155 -154
- package/bundled/definition22.cjs +29 -6
- package/bundled/definition22.js +172 -20
- package/bundled/definition23.cjs +6 -12
- package/bundled/definition23.js +17 -32
- package/bundled/definition24.cjs +12 -39
- package/bundled/definition24.js +33 -67
- package/bundled/definition25.cjs +44 -0
- package/bundled/definition25.js +81 -0
- package/bundled/definition3.cjs +5 -5
- package/bundled/definition3.js +10 -40
- package/bundled/definition4.cjs +6 -6
- package/bundled/definition4.js +4 -3
- package/bundled/definition6.cjs +11 -11
- package/bundled/definition6.js +4 -3
- package/bundled/definition9.cjs +12 -6
- package/bundled/definition9.js +66 -43
- package/bundled/extractOptions.cjs +1 -0
- package/bundled/extractOptions.js +11 -0
- package/bundled/icon.cjs +1 -0
- package/bundled/icon.js +34 -0
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +28 -12
- package/bundled/mixins.cjs +8 -8
- package/bundled/mixins.js +4 -3
- package/bundled/optgroup.cjs +1 -0
- package/bundled/optgroup.js +27 -0
- package/bundled/option.cjs +1 -0
- package/bundled/option.js +93 -0
- package/bundled/render-in-light-dom.cjs +1 -1
- package/bundled/render-in-light-dom.js +16 -19
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +9 -1
- package/card/index.cjs +22 -22
- package/card/index.js +4 -3
- package/color-picker/index.cjs +18 -18
- package/color-picker/index.js +4 -3
- package/combobox/definition.cjs +1 -1
- package/combobox/definition.js +1 -1
- package/combobox/index.cjs +7 -7
- package/combobox/index.js +31 -21
- package/country/definition.cjs +1 -1
- package/country/definition.js +1 -1
- package/country/index.cjs +1 -1
- package/country/index.js +1 -1
- package/country-group/definition.cjs +1 -1
- package/country-group/definition.js +1 -1
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +2 -2
- package/custom-elements.json +8438 -7866
- package/data-grid/definition.cjs +1 -1
- package/data-grid/definition.js +1 -1
- package/data-grid/index.cjs +26 -26
- package/data-grid/index.js +9 -8
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +1 -1
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +1 -1
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +1 -1
- package/dial-pad/definition.cjs +1 -1
- package/dial-pad/definition.js +1 -1
- package/dial-pad/index.cjs +7 -7
- package/dial-pad/index.js +124 -54
- package/dialog/definition.cjs +1 -1
- package/dialog/definition.js +1 -1
- package/dialog/index.cjs +14 -14
- package/dialog/index.js +4 -3
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/empty-state/definition.cjs +1 -1
- package/empty-state/definition.js +1 -1
- package/empty-state/index.cjs +3 -3
- package/empty-state/index.js +4 -3
- package/fab/definition.cjs +1 -1
- package/fab/definition.js +1 -1
- package/file-picker/definition.cjs +1 -1
- package/file-picker/definition.js +1 -1
- package/file-picker/index.cjs +7 -7
- package/file-picker/index.js +4 -3
- package/flag/definition.cjs +1 -1
- package/flag/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/header/index.cjs +3 -3
- package/header/index.js +3 -3
- package/icon/definition.cjs +2 -1
- package/icon/definition.js +2 -1
- package/index.cjs +209 -198
- package/index.js +59 -54
- package/kbd-key/definition.cjs +1 -1
- package/kbd-key/definition.js +1 -1
- package/kbd-shortcut/definition.cjs +1 -1
- package/kbd-shortcut/definition.js +1 -1
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/lib/accordion-item/accordion-item.d.ts +3 -1
- package/lib/action-group/action-group.d.ts +1 -1
- package/lib/alert/alert.d.ts +2 -2
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/avatar/avatar.d.ts +1 -1
- package/lib/badge/badge.d.ts +1 -1
- package/lib/banner/banner.d.ts +3 -3
- package/lib/breadcrumb/breadcrumb.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/button/button.d.ts +3 -3
- package/lib/calendar-event/calendar-event.d.ts +1 -1
- package/lib/card/card.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +6 -6
- package/lib/color-picker/color-picker.d.ts +7 -7
- package/lib/combobox/combobox.d.ts +8 -8
- package/lib/components.d.ts +2 -0
- package/lib/country-group/country-group.d.ts +2 -2
- package/lib/data-grid/data-grid-cell.d.ts +4 -3
- package/lib/data-grid/data-grid-row.d.ts +3 -2
- package/lib/data-grid/data-grid.options.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +8 -8
- package/lib/date-range-picker/date-range-picker.d.ts +4 -4
- package/lib/date-time-picker/date-time-picker.d.ts +8 -8
- package/lib/dial-pad/dial-pad.d.ts +2 -2
- package/lib/dialog/dialog.d.ts +2 -2
- package/lib/divider/divider.d.ts +1 -1
- package/lib/fab/fab.d.ts +1 -1
- package/lib/file-picker/file-picker.d.ts +7 -7
- package/lib/header/header.d.ts +1 -1
- package/lib/listbox/definition.d.ts +3 -0
- package/lib/listbox/index.d.ts +1 -0
- package/lib/listbox/listbox.d.ts +1302 -0
- package/lib/listbox/listbox.template.d.ts +3 -0
- package/lib/listbox/variations.browser-spec.d.ts +1 -0
- package/lib/menu/menu.d.ts +2 -3
- package/lib/menu-item/menu-item.d.ts +3 -3
- package/lib/nav/nav.d.ts +1 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
- package/lib/nav-item/nav-item.d.ts +2 -2
- package/lib/note/note.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +9 -10
- package/lib/optgroup/definition.d.ts +3 -0
- package/lib/optgroup/index.d.ts +1 -0
- package/lib/optgroup/optgroup.d.ts +430 -0
- package/lib/optgroup/optgroup.template.d.ts +2 -0
- package/lib/optgroup/variations.browser-spec.d.ts +1 -0
- package/lib/option/option.d.ts +2 -2
- package/lib/pagination/pagination.d.ts +1 -1
- package/lib/popover/popover.d.ts +2 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/radio/radio.d.ts +3 -3
- package/lib/radio-group/radio-group.d.ts +1 -1
- package/lib/range-slider/range-slider.d.ts +3 -3
- package/lib/rich-text-editor/rich-text-editor.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/base.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/default-textblock.d.ts +2 -2
- package/lib/searchable-select/option-tag.d.ts +1 -1
- package/lib/searchable-select/searchable-select.d.ts +47 -47
- package/lib/select/select.d.ts +9 -9
- package/lib/selectable-box/selectable-box.d.ts +1 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -2
- package/lib/slider/slider.d.ts +3 -3
- package/lib/split-button/split-button.d.ts +3 -3
- package/lib/status/status.d.ts +1 -1
- package/lib/switch/switch.d.ts +2 -2
- package/lib/tab/tab.d.ts +3 -3
- package/lib/tab-panel/tab-panel.d.ts +1 -1
- package/lib/table/table-cell.d.ts +1 -1
- package/lib/table/table-header-cell.d.ts +1 -1
- package/lib/table/table-row.d.ts +1 -1
- package/lib/table/table-sorting-button.d.ts +1 -1
- package/lib/tag/tag.d.ts +3 -3
- package/lib/tag-group/tag-group.d.ts +1 -1
- package/lib/tag-name-map.d.ts +3 -1
- package/lib/text-area/text-area.d.ts +8 -8
- package/lib/text-field/text-field.d.ts +10 -9
- package/lib/time-picker/time-picker.d.ts +4 -4
- package/lib/toggletip/toggletip.d.ts +3 -2
- package/lib/tooltip/tooltip.d.ts +3 -2
- package/lib/tree-item/tree-item.d.ts +2 -2
- package/lib/tree-view/tree-view.d.ts +1 -1
- package/lib/video-player/video-player.d.ts +1 -1
- package/listbox/definition.cjs +5 -0
- package/listbox/definition.js +2 -0
- package/listbox/index.cjs +11 -0
- package/listbox/index.js +540 -0
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav-disclosure/definition.cjs +1 -1
- package/nav-disclosure/definition.js +1 -1
- package/nav-disclosure/index.cjs +4 -4
- package/nav-disclosure/index.js +4 -3
- package/nav-item/definition.cjs +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.cjs +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.cjs +1 -1
- package/number-field/definition.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/optgroup/definition.cjs +6 -0
- package/optgroup/definition.js +3 -0
- package/optgroup/index.cjs +1 -0
- package/optgroup/index.js +4 -0
- package/option/definition.cjs +2 -1
- package/option/definition.js +2 -1
- package/package.json +9 -8
- package/pagination/definition.cjs +1 -1
- package/pagination/definition.js +1 -1
- package/platform-switch/definition.cjs +1 -1
- package/platform-switch/definition.js +1 -1
- package/popover/definition.cjs +1 -1
- package/popover/definition.js +1 -1
- package/popover/index.cjs +5 -5
- package/popover/index.js +4 -3
- package/progress/definition.cjs +1 -1
- package/progress/definition.js +1 -1
- package/radio/definition.cjs +1 -1
- package/radio/definition.js +1 -1
- package/radio-group/definition.cjs +1 -1
- package/radio-group/definition.js +1 -1
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +1 -1
- package/rich-text-editor/definition.js +1 -1
- package/rich-text-editor/index.cjs +13 -13
- package/rich-text-editor/index.js +26 -23
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/searchable-select/definition.cjs +1 -1
- package/searchable-select/definition.js +1 -1
- package/searchable-select/index.cjs +23 -23
- package/searchable-select/index.js +67 -49
- package/select/definition.cjs +1 -1
- package/select/definition.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/shared/aria/delegates-aria.d.ts +1 -1
- package/shared/aria/host-semantics.d.ts +1 -1
- package/shared/color-picker/base-color-picker.d.ts +1 -1
- package/shared/feedback/feedback-message.d.ts +1 -1
- package/shared/feedback/mixins.d.ts +2 -2
- package/shared/foundation/button/button.d.ts +2 -2
- package/shared/foundation/form-associated/form-associated.d.ts +2 -2
- package/shared/foundation/listbox/extractOptions.d.ts +2 -0
- package/shared/foundation/listbox/listbox.d.ts +2 -0
- package/shared/listbox/commands.d.ts +17 -0
- package/shared/listbox/move.d.ts +6 -0
- package/shared/listbox/options.d.ts +12 -0
- package/shared/listbox/selection.d.ts +28 -0
- package/shared/listbox/state.d.ts +26 -0
- package/shared/listbox/typeahead.d.ts +8 -0
- package/shared/listbox/with-options-filter.d.ts +440 -0
- package/shared/listbox/with-options.d.ts +862 -0
- package/shared/patterns/affix.d.ts +2 -2
- package/shared/patterns/anchored.d.ts +2 -2
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/form-elements/form-element.d.ts +1 -1
- package/shared/patterns/form-elements/with-contextual-help.d.ts +1 -1
- package/shared/patterns/form-elements/with-error-text.d.ts +1 -1
- package/shared/patterns/form-elements/with-success-text.d.ts +1 -1
- package/shared/patterns/kbd-shortcut.d.ts +1 -1
- package/shared/patterns/linkable.d.ts +1 -1
- package/shared/patterns/localized.d.ts +2 -2
- package/shared/patterns/trapped-focus.d.ts +1 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +2 -2
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-date-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-value-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +4 -4
- package/shared/picker-field/picker-field.d.ts +7 -7
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +1 -1
- package/simple-color-picker/definition.js +1 -1
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +4 -3
- package/split-button/definition.cjs +1 -1
- package/split-button/definition.js +1 -1
- package/split-button/index.cjs +1 -0
- package/split-button/index.js +1 -0
- package/status/definition.cjs +1 -1
- package/status/definition.js +1 -1
- package/switch/definition.cjs +1 -1
- package/switch/definition.js +1 -1
- package/switch/index.cjs +6 -5
- package/switch/index.js +16 -14
- package/tab/definition.cjs +1 -1
- package/tab/definition.js +1 -1
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/table/definition.cjs +1 -1
- package/table/definition.js +1 -1
- package/table/index.cjs +13 -13
- package/table/index.js +4 -3
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +1 -1
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag/index.cjs +11 -11
- package/tag/index.js +4 -3
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/text-area/definition.cjs +1 -1
- package/text-area/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/affix.cjs +2 -2
- package/unbundled/affix.js +1 -1
- package/unbundled/base-progress.cjs +1 -1
- package/unbundled/base-progress.js +1 -1
- package/unbundled/button.cjs +2 -2
- package/unbundled/button.js +2 -2
- package/unbundled/definition.cjs +2 -65
- package/unbundled/definition.js +4 -61
- package/unbundled/definition11.cjs +4 -3
- package/unbundled/definition11.js +3 -2
- package/unbundled/definition12.cjs +3 -2
- package/unbundled/definition12.js +3 -2
- package/unbundled/definition13.cjs +1 -1
- package/unbundled/definition13.js +1 -1
- package/unbundled/definition14.cjs +2 -1
- package/unbundled/definition14.js +2 -1
- package/unbundled/definition17.cjs +9 -4
- package/unbundled/definition17.js +9 -4
- package/unbundled/definition2.cjs +14 -3
- package/unbundled/definition2.js +15 -4
- package/unbundled/definition21.cjs +2 -1
- package/unbundled/definition21.js +2 -1
- package/unbundled/definition23.cjs +3 -1
- package/unbundled/definition23.js +4 -2
- package/unbundled/definition24.cjs +6 -4
- package/unbundled/definition24.js +6 -4
- package/unbundled/definition25.cjs +2 -1
- package/unbundled/definition25.js +2 -1
- package/unbundled/definition26.cjs +7 -4
- package/unbundled/definition26.js +7 -4
- package/unbundled/definition27.cjs +39 -5
- package/unbundled/definition27.js +40 -6
- package/unbundled/definition28.cjs +4 -3
- package/unbundled/definition28.js +4 -3
- package/unbundled/definition29.cjs +5 -168
- package/unbundled/definition29.js +11 -162
- package/unbundled/definition30.cjs +26 -506
- package/unbundled/definition30.js +24 -498
- package/unbundled/definition31.cjs +503 -39
- package/unbundled/definition31.js +501 -37
- package/unbundled/definition32.cjs +39 -239
- package/unbundled/definition32.js +36 -236
- package/unbundled/definition33.cjs +236 -74
- package/unbundled/definition33.js +233 -71
- package/unbundled/definition34.cjs +74 -1968
- package/unbundled/definition34.js +70 -1940
- package/unbundled/definition35.cjs +1993 -26
- package/unbundled/definition35.js +1965 -27
- package/unbundled/definition36.cjs +26 -111
- package/unbundled/definition36.js +23 -103
- package/unbundled/definition37.cjs +53 -294
- package/unbundled/definition37.js +50 -291
- package/unbundled/definition38.cjs +282 -132
- package/unbundled/definition38.js +279 -129
- package/unbundled/definition39.cjs +165 -339
- package/unbundled/definition39.js +163 -337
- package/unbundled/definition40.cjs +395 -227
- package/unbundled/definition40.js +393 -225
- package/unbundled/definition41.cjs +269 -47
- package/unbundled/definition41.js +264 -42
- package/unbundled/definition42.cjs +48 -67
- package/unbundled/definition42.js +45 -64
- package/unbundled/definition43.cjs +56 -383
- package/unbundled/definition43.js +55 -382
- package/unbundled/definition44.cjs +387 -44
- package/unbundled/definition44.js +383 -40
- package/unbundled/definition45.cjs +53 -45
- package/unbundled/definition45.js +49 -41
- package/unbundled/definition46.cjs +40 -164
- package/unbundled/definition46.js +36 -160
- package/unbundled/definition47.cjs +171 -31
- package/unbundled/definition47.js +168 -22
- package/unbundled/definition48.cjs +30 -89
- package/unbundled/definition48.js +22 -87
- package/unbundled/definition49.cjs +589 -48
- package/unbundled/definition49.js +587 -47
- package/unbundled/definition50.cjs +90 -21
- package/unbundled/definition50.js +88 -16
- package/unbundled/definition51.cjs +47 -32
- package/unbundled/definition51.js +44 -29
- package/unbundled/definition52.cjs +22 -323
- package/unbundled/definition52.js +16 -320
- package/unbundled/definition53.cjs +33 -212
- package/unbundled/definition53.js +29 -208
- package/unbundled/definition54.cjs +318 -41
- package/unbundled/definition54.js +314 -37
- package/unbundled/definition55.cjs +199 -253
- package/unbundled/definition55.js +193 -247
- package/unbundled/definition56.cjs +45 -53
- package/unbundled/definition56.js +42 -49
- package/unbundled/definition57.cjs +255 -133
- package/unbundled/definition57.js +253 -128
- package/unbundled/definition58.cjs +49 -245
- package/unbundled/definition58.js +47 -244
- package/unbundled/definition59.cjs +127 -444
- package/unbundled/definition59.js +124 -444
- package/unbundled/definition6.cjs +2 -1
- package/unbundled/definition6.js +2 -1
- package/unbundled/definition60.cjs +230 -3746
- package/unbundled/definition60.js +223 -3576
- package/unbundled/definition61.cjs +427 -739
- package/unbundled/definition61.js +425 -737
- package/unbundled/definition62.cjs +3762 -103
- package/unbundled/definition62.js +3593 -97
- package/unbundled/definition63.cjs +678 -886
- package/unbundled/definition63.js +672 -877
- package/unbundled/definition64.cjs +104 -108
- package/unbundled/definition64.js +100 -104
- package/unbundled/definition65.cjs +999 -65
- package/unbundled/definition65.js +995 -58
- package/unbundled/definition66.cjs +105 -155
- package/unbundled/definition66.js +101 -151
- package/unbundled/definition67.cjs +71 -121
- package/unbundled/definition67.js +63 -119
- package/unbundled/definition68.cjs +162 -51
- package/unbundled/definition68.js +158 -47
- package/unbundled/definition69.cjs +117 -75
- package/unbundled/definition69.js +116 -71
- package/unbundled/definition70.cjs +59 -21
- package/unbundled/definition70.js +56 -15
- package/unbundled/definition71.cjs +80 -75
- package/unbundled/definition71.js +76 -74
- package/unbundled/definition72.cjs +20 -305
- package/unbundled/definition72.js +14 -230
- package/unbundled/definition73.cjs +75 -315
- package/unbundled/definition73.js +74 -307
- package/unbundled/definition74.cjs +308 -30
- package/unbundled/definition74.js +231 -24
- package/unbundled/definition75.cjs +314 -109
- package/unbundled/definition75.js +304 -106
- package/unbundled/definition76.cjs +26 -250
- package/unbundled/definition76.js +21 -246
- package/unbundled/definition77.cjs +133 -27
- package/unbundled/definition77.js +124 -25
- package/unbundled/definition78.cjs +230 -116
- package/unbundled/definition78.js +227 -107
- package/unbundled/definition79.cjs +28 -203
- package/unbundled/definition79.js +26 -193
- package/unbundled/definition80.cjs +126 -477
- package/unbundled/definition80.js +118 -473
- package/unbundled/definition81.cjs +221 -0
- package/unbundled/definition81.js +202 -0
- package/unbundled/definition82.cjs +517 -0
- package/unbundled/definition82.js +497 -0
- package/unbundled/extractOptions.cjs +21 -0
- package/unbundled/extractOptions.js +16 -0
- package/unbundled/icon.cjs +67 -0
- package/unbundled/icon.js +61 -0
- package/unbundled/linkable.cjs +1 -1
- package/unbundled/linkable.js +1 -1
- package/unbundled/listbox.cjs +29 -7
- package/unbundled/listbox.js +29 -7
- package/unbundled/mixins.cjs +2 -1
- package/unbundled/mixins.js +2 -1
- package/unbundled/optgroup.cjs +66 -0
- package/unbundled/optgroup.js +54 -0
- package/unbundled/option.cjs +176 -0
- package/unbundled/option.js +164 -0
- package/unbundled/time-selection-picker.template.cjs +1 -1
- package/unbundled/time-selection-picker.template.js +1 -1
- package/unbundled/vivid-element.cjs +10 -1
- package/unbundled/vivid-element.js +10 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/vivid.api.json +568 -231
|
@@ -3,1020 +3,812 @@ const require_vivid_element = require("./vivid-element.cjs");
|
|
|
3
3
|
const require_definition = require("./definition.cjs");
|
|
4
4
|
const require_decorate = require("./decorate.cjs");
|
|
5
5
|
const require_affix = require("./affix.cjs");
|
|
6
|
-
const require_delegates_aria = require("./delegates-aria.cjs");
|
|
7
|
-
const require_definition$1 = require("./definition5.cjs");
|
|
8
6
|
const require_form_associated = require("./form-associated.cjs");
|
|
9
7
|
const require_localized = require("./localized.cjs");
|
|
10
|
-
const require_definition$
|
|
11
|
-
const
|
|
12
|
-
const
|
|
8
|
+
const require_definition$1 = require("./definition6.cjs");
|
|
9
|
+
const require_dialog = require("./dialog.cjs");
|
|
10
|
+
const require_definition$2 = require("./definition9.cjs");
|
|
11
|
+
const require_host_semantics = require("./host-semantics.cjs");
|
|
13
12
|
const require_mixins = require("./mixins.cjs");
|
|
14
13
|
const require_form_element = require("./form-element.cjs");
|
|
15
14
|
const require_with_error_text = require("./with-error-text.cjs");
|
|
16
15
|
const require_with_success_text = require("./with-success-text.cjs");
|
|
17
16
|
const require_with_contextual_help = require("./with-contextual-help.cjs");
|
|
18
|
-
const
|
|
19
|
-
const require_definition$
|
|
20
|
-
const
|
|
17
|
+
const require_option = require("./option.cjs");
|
|
18
|
+
const require_definition$3 = require("./definition29.cjs");
|
|
19
|
+
const require_definition$4 = require("./definition30.cjs");
|
|
20
|
+
const require_listbox = require("./listbox.cjs");
|
|
21
21
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
22
22
|
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
23
|
-
//#region src/lib/
|
|
24
|
-
var
|
|
23
|
+
//#region src/lib/select/select.scss?inline
|
|
24
|
+
var select_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}.chevron{font:var(--vvd-typography-base-extended);flex-shrink:0;display:flex;transform:rotate(0)}@media (prefers-reduced-motion:no-preference){.chevron{transition:transform .2s}}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{--_low-ink-color:var(--vvd-color-neutral-600);--focus-stroke-gap-color:transparent;flex-direction:column;gap:4px;display:inline-flex}:host([disabled]){--_low-ink-color:var(--vvd-color-neutral-600);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);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(--vvd-color-neutral-500)}.control.appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.control: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(--vvd-color-neutral-700)}.control: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.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(--vvd-color-neutral-700)}.control.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:disabled{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.control:disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.disabled{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:var(--vvd-color-neutral-100);--_appearance-color-outline:var(--vvd-color-neutral-300)}.control.disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.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.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.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.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notset;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:transparent}.control.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.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));border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline);--_select-icon-size:calc(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(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);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);justify-content:space-between;align-items:center;gap:8px;transition:box-shadow .2s,background-color .2s;display:flex}.control.size-condensed{--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2)}.control.size-condensed:not(.shape-pill){--_select-control-border-radius:4px}.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}.listbox{max-height:var(--select-height,408px);flex-direction:column;gap:2px;padding:4px;display:flex;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:8px}.selected-value{white-space:nowrap;flex-grow:1;align-items:center;column-gap:12px;display:flex;overflow:hidden}.selected-value .text{text-overflow:ellipsis;max-inline-size:100%;overflow:hidden}.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}@supports selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant,:has(.clear-button:focus)){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}:host(:not(:focus-visible)){--_suppressable-focus-shadow:none;--_suppressable-focus-outline:none;--_suppressable-focus-outline-offset:0}:host([multiple]) .clear-button{margin-inline-start:auto}:host([multiple][clearable]) .label-wrapper{min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16))}";
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region src/lib/
|
|
27
|
-
var option_tag_default = ":host{display:block}.base.connotation-cta{--_connotation-color-contrast:var(--vvd-option-tag-cta-contrast,var(--vvd-color-cta-800))}.base:not(.connotation-cta){--_connotation-color-contrast:var(--vvd-option-tag-accent-contrast,var(--vvd-color-neutral-800))}.base{--_option-tag-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16));box-sizing:border-box;background-color:var(--fill-color);block-size:var(--_option-tag-block-size);box-shadow:inset 0 0 0 1px var(--outline-color);color:var(--text-color);font:var(--vvd-typography-base-bold);user-select:none;align-items:center;column-gap:8px;max-inline-size:100%;padding-inline:8px;display:flex;position:relative}.base.size-condensed{--_option-tag-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 20));padding-inline:4px}.base:not(.disabled){--text-color:var(--_connotation-color-contrast);--fill-color:var(--_connotation-color-soft);--outline-color:transparent}@supports (background-color:color-mix(in srgb, black 50%, white)){.base:not(.disabled){--fill-color:color-mix(in sRGB, var(--_connotation-color-contrast), transparent 87.5%)}}.base.disabled{--text-color:var(--vvd-color-neutral-300);--fill-color:var(--vvd-color-neutral-200);--outline-color:transparent}@supports (background-color:color-mix(in srgb, black 50%, white)){.base.disabled{--fill-color:color-mix(in sRGB, var(--vvd-color-neutral-800), transparent 87.5%)}}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.label{text-overflow:ellipsis;white-space:nowrap;max-inline-size:100%;overflow:hidden}slot[name=icon]{font-size:calc(var(--_option-tag-block-size) / 1.5);line-height:1}.icon-placeholder{inline-size:calc(var(--_option-tag-block-size) / 1.5)}.remove-button{border-radius:inherit;cursor:pointer;outline:none;align-items:center;display:flex}.disabled .remove-button{pointer-events:none}.remove-button:focus-visible:before{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in sRGB, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));z-index:1;border-radius:inherit;content:\"\";pointer-events:none;display:block;position:absolute;inset:0}";
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/lib/searchable-select/searchable-select.ts
|
|
30
|
-
var TagGapPx = 8;
|
|
31
|
-
var InputMinWidthPx = 100;
|
|
32
|
-
var PageSize = 10;
|
|
33
|
-
var isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
|
|
26
|
+
//#region src/lib/select/select.ts
|
|
34
27
|
/**
|
|
35
28
|
* @public
|
|
36
|
-
* @component
|
|
37
|
-
* @slot -
|
|
38
|
-
* @slot icon - The preferred way to add an icon to the control.
|
|
39
|
-
* @slot meta - Slot to add meta content to the control.
|
|
40
|
-
* @slot helper-text - Describes how to use the
|
|
41
|
-
* @
|
|
42
|
-
* @
|
|
43
|
-
* @slot loading-options - Message that appears there are no options to display and the component is in a loading state.
|
|
44
|
-
* @event {CustomEvent<undefined>} input - Fired when the selected options change
|
|
45
|
-
* @event {CustomEvent<undefined>} search-text-change - Fired when the search text changes
|
|
46
|
-
* @event {CustomEvent<undefined>} change - Fired when the selected options change
|
|
29
|
+
* @component select
|
|
30
|
+
* @slot - Default slot.
|
|
31
|
+
* @slot icon - The preferred way to add an icon to the select control.
|
|
32
|
+
* @slot meta - Slot to add meta content to the select control.
|
|
33
|
+
* @slot helper-text - Describes how to use the select. Alternative to the `helper-text` attribute.
|
|
34
|
+
* @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value updates
|
|
35
|
+
* @event {CustomEvent<HTMLElement>} change - Fires a custom 'change' event when the value updates
|
|
47
36
|
* @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
|
|
48
|
-
* @vueModel values values input,@lazy:change `event.currentTarget.values`
|
|
49
37
|
* @testAction selectOptionByValue selectOptionByValue
|
|
50
38
|
* @testAction selectOptionByText selectOptionByText
|
|
51
|
-
* @testQuery values values
|
|
52
|
-
* @testQuery selectedOptions selectedOptionsText
|
|
53
39
|
*/
|
|
54
|
-
var
|
|
40
|
+
var Select = class extends require_mixins.WithLightDOMFeedback(require_with_contextual_help.WithContextualHelp(require_with_error_text.WithErrorText(require_with_success_text.WithSuccessText(require_localized.Localized(require_form_element.FormElement(require_host_semantics.HostSemantics(require_affix.AffixIconWithTrailing(require_form_associated.FormAssociated(require_listbox.Listbox))))))))) {
|
|
55
41
|
constructor(..._args) {
|
|
56
42
|
super(..._args);
|
|
57
|
-
this.
|
|
43
|
+
this.proxy = document.createElement("select");
|
|
44
|
+
this.activeIndex = -1;
|
|
45
|
+
this.rangeStartIndex = -1;
|
|
58
46
|
this.open = false;
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this._currentSearchText = null;
|
|
65
|
-
this._areOptionsInitialized = false;
|
|
66
|
-
this.#slottedOptionsChangeHandler = { handleChange: (source, _) => {
|
|
67
|
-
if (source.selected && !this.values.includes(source.value)) this.values = [...this.values, source.value];
|
|
68
|
-
else if (!source.selected && this.values.includes(source.value)) this.values = this.values.filter((option) => option !== source.value);
|
|
69
|
-
} };
|
|
70
|
-
this.#clonedTagIcons = /* @__PURE__ */ new Map();
|
|
71
|
-
this._filteredOptions = [];
|
|
72
|
-
this._filteredEnabledOptions = [];
|
|
73
|
-
this.loading = false;
|
|
74
|
-
this._highlightedOptionIndex = null;
|
|
75
|
-
this._numElidedTags = 0;
|
|
76
|
-
this._tagRows = [];
|
|
77
|
-
this._lastTagRow = [];
|
|
47
|
+
this.listboxId = (0, _microsoft_fast_web_utilities.uniqueId)("listbox-");
|
|
48
|
+
this.maxHeight = 0;
|
|
49
|
+
this.fixedDropdown = false;
|
|
50
|
+
this._feedbackWrapper = null;
|
|
51
|
+
this._isResetting = false;
|
|
78
52
|
this.clearable = false;
|
|
79
|
-
this.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
53
|
+
this._isClearButtonFocused = false;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns the last checked option.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
get activeOption() {
|
|
61
|
+
return this.options[this.activeIndex];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the list of checked options.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
get checkedOptions() {
|
|
69
|
+
return this.options.filter((o) => o.checked);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns the index of the first selected option.
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
get firstSelectedOptionIndex() {
|
|
77
|
+
return this.options.indexOf(this.firstSelectedOption);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Updates the `ariaActiveDescendant` property when the active index changes.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
activeIndexChanged(_, next) {
|
|
85
|
+
this._activeDescendant = this.options[next]?.id ?? "";
|
|
86
|
+
this.focusAndScrollOptionIntoView();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Toggles the checked state for the currently active option.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Multiple-selection mode only.
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
checkActiveIndex() {
|
|
97
|
+
const activeItem = this.activeOption;
|
|
98
|
+
/* v8 ignore else -- @preserve */
|
|
99
|
+
if (activeItem) activeItem.checked = true;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Sets the active index to the first option and marks it as checked.
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* Multi-selection mode only.
|
|
106
|
+
*
|
|
107
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
checkFirstOption(preserveChecked) {
|
|
112
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
113
|
+
if (firstSelectableIndex === -1) return;
|
|
114
|
+
if (preserveChecked) {
|
|
115
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
116
|
+
this.options.forEach((o, i) => {
|
|
117
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, firstSelectableIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
118
|
+
});
|
|
119
|
+
} else this.uncheckAllOptions();
|
|
120
|
+
this.activeIndex = firstSelectableIndex;
|
|
121
|
+
this.checkActiveIndex();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Decrements the active index and sets the matching option as checked.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* Multi-selection mode only.
|
|
128
|
+
*
|
|
129
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
130
|
+
*
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
checkLastOption(preserveChecked) {
|
|
134
|
+
const lastSelectableIndex = this.getPreviousSelectableIndex(this.length - 1);
|
|
135
|
+
if (lastSelectableIndex === -1) return;
|
|
136
|
+
if (preserveChecked) {
|
|
137
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
138
|
+
this.options.forEach((o, i) => {
|
|
139
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, this.rangeStartIndex, lastSelectableIndex + 1) && !o.disabled;
|
|
140
|
+
});
|
|
141
|
+
} else this.uncheckAllOptions();
|
|
142
|
+
this.activeIndex = lastSelectableIndex;
|
|
143
|
+
this.checkActiveIndex();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Increments the active index and marks the matching option as checked.
|
|
147
|
+
*
|
|
148
|
+
* @remarks
|
|
149
|
+
* Multiple-selection mode only.
|
|
150
|
+
*
|
|
151
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
152
|
+
*
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
checkNextOption(preserveChecked) {
|
|
156
|
+
const nextIndex = this.getNextSelectableIndex(this.activeIndex + 1);
|
|
157
|
+
if (nextIndex === -1) return;
|
|
158
|
+
if (preserveChecked) {
|
|
159
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
160
|
+
this.options.forEach((o, i) => {
|
|
161
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, this.rangeStartIndex, nextIndex + 1) && !o.disabled;
|
|
162
|
+
});
|
|
163
|
+
} else this.uncheckAllOptions();
|
|
164
|
+
this.activeIndex = nextIndex;
|
|
165
|
+
this.checkActiveIndex();
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Decrements the active index and marks the matching option as checked.
|
|
169
|
+
*
|
|
170
|
+
* @remarks
|
|
171
|
+
* Multiple-selection mode only.
|
|
172
|
+
*
|
|
173
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
174
|
+
*
|
|
175
|
+
* @internal
|
|
176
|
+
*/
|
|
177
|
+
checkPreviousOption(preserveChecked) {
|
|
178
|
+
const previousIndex = this.getPreviousSelectableIndex(this.activeIndex - 1);
|
|
179
|
+
if (previousIndex === -1) return;
|
|
180
|
+
if (preserveChecked) {
|
|
181
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
182
|
+
if (this.checkedOptions.length === 1) this.rangeStartIndex += 1;
|
|
183
|
+
this.options.forEach((o, i) => {
|
|
184
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
185
|
+
});
|
|
186
|
+
} else this.uncheckAllOptions();
|
|
187
|
+
this.activeIndex = previousIndex;
|
|
188
|
+
this.checkActiveIndex();
|
|
189
|
+
}
|
|
190
|
+
/** @internal */
|
|
191
|
+
focusAndScrollOptionIntoView() {
|
|
192
|
+
super.focusAndScrollOptionIntoView(this.activeOption);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* In multiple-selection mode:
|
|
196
|
+
* If any options are selected, the first selected option is checked when
|
|
197
|
+
* the listbox receives focus. If no options are selected, the first
|
|
198
|
+
* selectable option is checked.
|
|
199
|
+
*
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
focusinHandler(e) {
|
|
203
|
+
if (!this.multiple) {
|
|
204
|
+
super.focusinHandler(e);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
/* v8 ignore else -- @preserve */
|
|
208
|
+
if (!this.shouldSkipFocus && e.target === e.currentTarget) {
|
|
209
|
+
this.uncheckAllOptions();
|
|
210
|
+
if (this.activeIndex === -1) this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
|
|
211
|
+
this.checkActiveIndex();
|
|
212
|
+
this.setSelectedOptions();
|
|
213
|
+
this.focusAndScrollOptionIntoView();
|
|
214
|
+
}
|
|
215
|
+
this.shouldSkipFocus = false;
|
|
95
216
|
}
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
if (!this.
|
|
99
|
-
|
|
100
|
-
this.values = [this.values[0]];
|
|
217
|
+
/** Sets an option as selected and gives it focus. */
|
|
218
|
+
setSelectedOptions() {
|
|
219
|
+
if (!this.multiple) {
|
|
220
|
+
super.setSelectedOptions();
|
|
101
221
|
return;
|
|
102
222
|
}
|
|
103
|
-
|
|
104
|
-
|
|
223
|
+
/* v8 ignore else -- @preserve */
|
|
224
|
+
if (this.$fastController.isConnected && this.options) {
|
|
225
|
+
this.selectedOptions = this.options.filter((o) => o.selected);
|
|
226
|
+
this.focusAndScrollOptionIntoView();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Toggles the selected state of the provided options. If any provided items
|
|
231
|
+
* are in an unselected state, all items are set to selected. If every
|
|
232
|
+
* provided item is selected, they are all unselected.
|
|
233
|
+
*
|
|
234
|
+
* @internal
|
|
235
|
+
*/
|
|
236
|
+
toggleSelectedForAllCheckedOptions() {
|
|
237
|
+
const enabledCheckedOptions = this.checkedOptions.filter((o) => !o.disabled);
|
|
238
|
+
const force = !enabledCheckedOptions.every((o) => o.selected);
|
|
239
|
+
enabledCheckedOptions.forEach((o) => o.selected = force);
|
|
240
|
+
this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
|
|
241
|
+
this.setSelectedOptions();
|
|
242
|
+
this.updateValue(true);
|
|
243
|
+
}
|
|
244
|
+
/** @internal */
|
|
245
|
+
typeaheadBufferChanged(prev, next) {
|
|
246
|
+
if (!this.multiple) {
|
|
247
|
+
super.typeaheadBufferChanged(prev, next);
|
|
105
248
|
return;
|
|
106
249
|
}
|
|
107
|
-
|
|
108
|
-
this
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
#updateValuesWhileMaintainingOrder(newValues) {
|
|
119
|
-
const oldSet = new Set(this.values);
|
|
120
|
-
const newSet = new Set(newValues);
|
|
121
|
-
this.values = [...this.values].filter((v) => newSet.has(v)).concat([...newValues].filter((v) => !oldSet.has(v)));
|
|
250
|
+
/* v8 ignore if -- @preserve */
|
|
251
|
+
if (this.$fastController.isConnected) {
|
|
252
|
+
const typeaheadMatches = this.getTypeaheadMatches();
|
|
253
|
+
const activeIndex = this.options.indexOf(typeaheadMatches[0]);
|
|
254
|
+
if (activeIndex > -1) {
|
|
255
|
+
this.activeIndex = activeIndex;
|
|
256
|
+
this.uncheckAllOptions();
|
|
257
|
+
this.checkActiveIndex();
|
|
258
|
+
}
|
|
259
|
+
this.typeaheadExpired = false;
|
|
260
|
+
}
|
|
122
261
|
}
|
|
123
|
-
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
262
|
+
/**
|
|
263
|
+
* Unchecks all options.
|
|
264
|
+
*
|
|
265
|
+
* @remarks
|
|
266
|
+
* Multiple-selection mode only.
|
|
267
|
+
*
|
|
268
|
+
* @param preserveChecked - reset the rangeStartIndex
|
|
269
|
+
*
|
|
270
|
+
* @internal
|
|
271
|
+
*/
|
|
272
|
+
uncheckAllOptions(preserveChecked = false) {
|
|
273
|
+
this.options.forEach((o) => o.checked = false);
|
|
274
|
+
/* v8 ignore else -- @preserve */
|
|
275
|
+
if (!preserveChecked) this.rangeStartIndex = -1;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Sets focus when the open property changes.
|
|
279
|
+
*
|
|
280
|
+
* @internal
|
|
281
|
+
*/
|
|
282
|
+
openChanged(prev, next) {
|
|
283
|
+
if (!this.collapsible) return;
|
|
284
|
+
if (this.open) {
|
|
285
|
+
this.focusAndScrollOptionIntoView();
|
|
286
|
+
this.indexWhenOpened = this.selectedIndex;
|
|
287
|
+
_microsoft_fast_element.Updates.enqueue(() => this.focus());
|
|
288
|
+
return;
|
|
128
289
|
}
|
|
290
|
+
const didClose = prev && !next;
|
|
291
|
+
const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
|
|
292
|
+
if (didClose && selectionChangedWhileOpen) this.updateValue(true);
|
|
129
293
|
}
|
|
130
|
-
|
|
131
|
-
|
|
294
|
+
/**
|
|
295
|
+
* The component is collapsible when in single-selection mode.
|
|
296
|
+
*
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
get collapsible() {
|
|
300
|
+
return !this.multiple;
|
|
132
301
|
}
|
|
133
302
|
/** @internal */
|
|
134
303
|
valueChanged(prev, next) {
|
|
304
|
+
const nextSelectedIndex = this.options.findIndex((el) => el.value === next);
|
|
305
|
+
const validNextSelectedIndex = this._validSelectedIndex(nextSelectedIndex);
|
|
306
|
+
const nextValue = this.options[validNextSelectedIndex]?.value ?? "";
|
|
307
|
+
if (this.selectedIndex !== validNextSelectedIndex) this.selectedIndex = validNextSelectedIndex;
|
|
308
|
+
if (next !== nextValue) return;
|
|
135
309
|
super.valueChanged(prev, next);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/** @internal */
|
|
154
|
-
_currentSearchTextChanged() {
|
|
155
|
-
this.#updateFilteredOptions();
|
|
156
|
-
this.$emit("search-text-change", void 0, {
|
|
157
|
-
bubbles: false,
|
|
158
|
-
composed: false
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/** Read-only property containing the current search text. */
|
|
162
|
-
get searchText() {
|
|
163
|
-
return this._currentSearchText ?? "";
|
|
164
|
-
}
|
|
165
|
-
/** @internal */
|
|
166
|
-
get _inputValue() {
|
|
167
|
-
return this._currentSearchText ?? (!this.multiple && this.value !== "" ? this.#textForValue(this.value) ?? "" : "");
|
|
168
|
-
}
|
|
169
|
-
/** @internal */
|
|
170
|
-
_onInputInput(event) {
|
|
171
|
-
this._currentSearchText = event.target.value;
|
|
172
|
-
}
|
|
173
|
-
/** @internal */
|
|
174
|
-
_onInputFocus(_) {
|
|
175
|
-
this.#updateFilteredOptions();
|
|
176
|
-
}
|
|
177
|
-
/** @internal */
|
|
178
|
-
_onInputBlur(_) {
|
|
179
|
-
this.open = false;
|
|
180
|
-
this._currentSearchText = null;
|
|
181
|
-
this._changeDescription = "";
|
|
182
|
-
}
|
|
183
|
-
/** @internal */
|
|
184
|
-
_onInputKeydown(e) {
|
|
185
|
-
if (e.ctrlKey || e.shiftKey) return true;
|
|
186
|
-
switch (e.key) {
|
|
187
|
-
case "Enter":
|
|
188
|
-
this.#selectHighlightedOption();
|
|
189
|
-
if (this._inputValue === "") this.open = !this.open;
|
|
190
|
-
return false;
|
|
191
|
-
case "Escape":
|
|
192
|
-
this.open = false;
|
|
193
|
-
break;
|
|
194
|
-
case "Home":
|
|
195
|
-
if (!this.open) {
|
|
196
|
-
this.open = true;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
this.#highlightFirstOption();
|
|
200
|
-
return false;
|
|
201
|
-
case "End":
|
|
202
|
-
if (!this.open) {
|
|
203
|
-
this.open = true;
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
this.#highlightLastOption();
|
|
207
|
-
return false;
|
|
208
|
-
case "PageUp":
|
|
209
|
-
if (!this.open) {
|
|
210
|
-
this.open = true;
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
this.#highlightPrevPage();
|
|
214
|
-
return false;
|
|
215
|
-
case "PageDown":
|
|
216
|
-
if (!this.open) {
|
|
217
|
-
this.open = true;
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
this.#highlightNextPage();
|
|
221
|
-
return false;
|
|
222
|
-
case "ArrowUp":
|
|
223
|
-
if (!this.open) {
|
|
224
|
-
this.open = true;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
this.#highlightPreviousOption();
|
|
228
|
-
return false;
|
|
229
|
-
case "ArrowDown":
|
|
230
|
-
if (!this.open) {
|
|
231
|
-
this.open = true;
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
this.#highlightNextOption();
|
|
235
|
-
return false;
|
|
236
|
-
case "ArrowLeft":
|
|
237
|
-
if (this.multiple && this._inputValue === "" && this.values.length && !this.externalTags) {
|
|
238
|
-
this.#moveTagFocusTo(this.#nextTagIndexLeft(this.values.length));
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
return true;
|
|
242
|
-
case "Backspace":
|
|
243
|
-
if (this.multiple && this._inputValue === "" && this.values.length) {
|
|
244
|
-
this._onTagRemoved(this.values[this.values.length - 1]);
|
|
245
|
-
return false;
|
|
246
|
-
}
|
|
247
|
-
return true;
|
|
248
|
-
default:
|
|
249
|
-
/* v8 ignore next -- @preserve */
|
|
250
|
-
if (!this.open) this.open = true;
|
|
251
|
-
return true;
|
|
310
|
+
this.updateDisplayValue();
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Sets the value and display value to match the first selected option.
|
|
314
|
+
*
|
|
315
|
+
* @param shouldEmit - if true, the input and change events will be emitted
|
|
316
|
+
*
|
|
317
|
+
* @internal
|
|
318
|
+
*/
|
|
319
|
+
updateValue(shouldEmit) {
|
|
320
|
+
if (this.$fastController.isConnected) this.value = this.firstSelectedOption?.value ?? "";
|
|
321
|
+
if (shouldEmit) {
|
|
322
|
+
this.$emit("input");
|
|
323
|
+
this.$emit("change", this, {
|
|
324
|
+
bubbles: true,
|
|
325
|
+
composed: void 0
|
|
326
|
+
});
|
|
252
327
|
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Updates the proxy value when the selected index changes.
|
|
331
|
+
*
|
|
332
|
+
* @param prev - the previous selected index
|
|
333
|
+
* @param next - the next selected index
|
|
334
|
+
*
|
|
335
|
+
* @internal
|
|
336
|
+
*/
|
|
337
|
+
selectedIndexChanged(prev, next) {
|
|
338
|
+
super.selectedIndexChanged(prev, next);
|
|
339
|
+
this.updateValue();
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Handle opening and closing the listbox when the select is clicked.
|
|
343
|
+
*
|
|
344
|
+
* @param e - the mouse event
|
|
345
|
+
* @internal
|
|
346
|
+
*/
|
|
347
|
+
clickHandler(e) {
|
|
348
|
+
if (this.disabled || this._isFromContextualHelp(e)) return;
|
|
349
|
+
const clickedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
|
|
350
|
+
if (clickedOption && clickedOption.disabled) return;
|
|
351
|
+
if (this.multiple) {
|
|
352
|
+
this.uncheckAllOptions();
|
|
353
|
+
this.activeIndex = this.options.indexOf(clickedOption);
|
|
354
|
+
this.checkActiveIndex();
|
|
355
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
356
|
+
} else super.clickHandler(e);
|
|
357
|
+
if (this.collapsible) this.open = !this.open;
|
|
253
358
|
return true;
|
|
254
359
|
}
|
|
255
|
-
/**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Handles focus state when the element or its children lose focus.
|
|
362
|
+
*
|
|
363
|
+
* @param e - The focus event
|
|
364
|
+
* @internal
|
|
365
|
+
*/
|
|
366
|
+
focusoutHandler(e) {
|
|
367
|
+
if (this.multiple) this.uncheckAllOptions();
|
|
368
|
+
if (!this.open) return true;
|
|
369
|
+
const focusTarget = e.relatedTarget;
|
|
370
|
+
if (this.isSameNode(focusTarget)) {
|
|
371
|
+
this.focus();
|
|
372
|
+
return;
|
|
263
373
|
}
|
|
264
374
|
/* v8 ignore else -- @preserve */
|
|
265
|
-
if (
|
|
266
|
-
option._displayCheckmark = true;
|
|
267
|
-
_microsoft_fast_element.Observable.getNotifier(option).subscribe(this.#slottedOptionsChangeHandler, "selected");
|
|
268
|
-
}
|
|
269
|
-
const values = [];
|
|
270
|
-
for (const option of this._slottedOptions) {
|
|
271
|
-
if (option.selected || option.value === this.value || this.values.includes(option.value)) values.push(option.value);
|
|
272
|
-
if (option.disabled) this._slottedDisabledOptions.push(option);
|
|
273
|
-
}
|
|
274
|
-
this.#updateValuesWhileMaintainingOrder(values);
|
|
275
|
-
this.#updateFilteredOptions();
|
|
276
|
-
this.#updateSelectionLimit();
|
|
277
|
-
}
|
|
278
|
-
#slottedOptionsChangeHandler;
|
|
279
|
-
#updateSelectedOnSlottedOptions() {
|
|
280
|
-
for (const option of this._slottedOptions) {
|
|
281
|
-
option.selected = this.values.includes(option.value);
|
|
282
|
-
this.#updateClonedTagIconOfOption(option);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
#handleOptionInteraction(option) {
|
|
286
|
-
const value = option.value;
|
|
287
|
-
let newValues;
|
|
288
|
-
let shouldClearSearchText = false;
|
|
289
|
-
const isSelection = !this.values.includes(value);
|
|
290
|
-
if (this.multiple) {
|
|
291
|
-
if (isSelection) newValues = [...this.values, value];
|
|
292
|
-
else newValues = this.values.filter((option) => option !== value);
|
|
293
|
-
shouldClearSearchText = true;
|
|
294
|
-
} else {
|
|
295
|
-
if (isSelection) {
|
|
296
|
-
newValues = [value];
|
|
297
|
-
shouldClearSearchText = true;
|
|
298
|
-
} else newValues = [];
|
|
375
|
+
if (!this.options.includes(focusTarget)) {
|
|
299
376
|
this.open = false;
|
|
377
|
+
if (this.indexWhenOpened !== this.selectedIndex) this.updateValue(true);
|
|
300
378
|
}
|
|
301
|
-
this.#updateValuesThroughUserInteraction(newValues);
|
|
302
|
-
const optionMessage = isSelection ? this.locale.searchableSelect.optionSelectedMessage(option._getAccessibleName()) : this.locale.searchableSelect.optionDeselectedMessage(option._getAccessibleName());
|
|
303
|
-
const maxSelectedMessage = this.multiple && this.maxSelected && this.maxSelected >= 1 ? this.locale.searchableSelect.maxSelectedMessage(this.values.length, this.maxSelected) : "";
|
|
304
|
-
this._changeDescription = `${optionMessage} ${maxSelectedMessage}`;
|
|
305
|
-
if (shouldClearSearchText) this._currentSearchText = null;
|
|
306
|
-
}
|
|
307
|
-
#clonedTagIcons;
|
|
308
|
-
#tagIconOfOption(option) {
|
|
309
|
-
return option.querySelector("[slot=\"tag-icon\"]");
|
|
310
|
-
}
|
|
311
|
-
/** @internal */
|
|
312
|
-
_tagIconSlotName(value) {
|
|
313
|
-
return `_tag-icon-${this.values.indexOf(value)}`;
|
|
314
|
-
}
|
|
315
|
-
#updateClonedTagIconOfOption(option) {
|
|
316
|
-
if (option.selected && this.#tagIconOfOption(option)) {
|
|
317
|
-
let clone = this.#clonedTagIcons.get(option);
|
|
318
|
-
/* v8 ignore else -- @preserve */
|
|
319
|
-
if (!clone) {
|
|
320
|
-
clone = this.#tagIconOfOption(option).cloneNode(true);
|
|
321
|
-
this.#clonedTagIcons.set(option, clone);
|
|
322
|
-
}
|
|
323
|
-
clone.slot = this._tagIconSlotName(option.value);
|
|
324
|
-
this.appendChild(clone);
|
|
325
|
-
} else {
|
|
326
|
-
const clone = this.#clonedTagIcons.get(option);
|
|
327
|
-
if (clone) {
|
|
328
|
-
clone.remove();
|
|
329
|
-
this.#clonedTagIcons.delete(option);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
/** @internal */
|
|
334
|
-
optionFilterChanged() {
|
|
335
|
-
this.#updateFilteredOptions();
|
|
336
379
|
}
|
|
337
|
-
/**
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
this.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
380
|
+
/**
|
|
381
|
+
* Updates the value when an option's value changes.
|
|
382
|
+
*
|
|
383
|
+
* @param source - the source object
|
|
384
|
+
* @param propertyName - the property to evaluate
|
|
385
|
+
*
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
handleChange(source, propertyName) {
|
|
389
|
+
super.handleChange(source, propertyName);
|
|
390
|
+
if (propertyName === "value") this.updateValue();
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Prevents focus when a scrollbar is clicked.
|
|
394
|
+
*
|
|
395
|
+
* @param e - the mouse event object
|
|
396
|
+
*
|
|
397
|
+
* @internal
|
|
398
|
+
*/
|
|
399
|
+
mousedownHandler(e) {
|
|
400
|
+
if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) return super.mousedownHandler(e);
|
|
401
|
+
return this.collapsible;
|
|
402
|
+
}
|
|
403
|
+
/** @internal */
|
|
404
|
+
multipleChanged(_, next) {
|
|
405
|
+
this.options.forEach((o) => {
|
|
406
|
+
o.checked = next ? false : void 0;
|
|
407
|
+
});
|
|
408
|
+
this.setSelectedOptions();
|
|
409
|
+
/* v8 ignore if -- @preserve */
|
|
410
|
+
if (this.proxy) this.proxy.multiple = next;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Updates the selectedness of each option when the list of selected options changes.
|
|
414
|
+
*
|
|
415
|
+
* @param prev - the previous list of selected options
|
|
416
|
+
* @param next - the current list of selected options
|
|
417
|
+
*
|
|
418
|
+
* @internal
|
|
419
|
+
*/
|
|
420
|
+
selectedOptionsChanged(prev, next) {
|
|
421
|
+
super.selectedOptionsChanged(prev, next);
|
|
422
|
+
this.options.forEach((o, i) => {
|
|
423
|
+
const proxyOption = this.proxy.options.item(i);
|
|
424
|
+
if (proxyOption) proxyOption.selected = o.selected;
|
|
425
|
+
});
|
|
373
426
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
427
|
+
/**
|
|
428
|
+
* Resets and fills the proxy to match the component's options.
|
|
429
|
+
*
|
|
430
|
+
* @internal
|
|
431
|
+
*/
|
|
432
|
+
setProxyOptions() {
|
|
433
|
+
/* v8 ignore else -- @preserve */
|
|
434
|
+
if (this.proxy instanceof HTMLSelectElement && this.options) {
|
|
435
|
+
this.proxy.length = 0;
|
|
436
|
+
this.options.forEach((option) => {
|
|
437
|
+
const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
|
|
438
|
+
if (proxyOption) this.proxy.options.add(proxyOption);
|
|
439
|
+
});
|
|
380
440
|
}
|
|
381
|
-
this.#handleOptionInteraction(highlightedOption);
|
|
382
|
-
}
|
|
383
|
-
#highlightFirstOption() {
|
|
384
|
-
this.#transitionHighlightedOptionTo(0);
|
|
385
|
-
}
|
|
386
|
-
#highlightLastOption() {
|
|
387
|
-
this.#transitionHighlightedOptionTo(this._filteredEnabledOptions.length - 1);
|
|
388
|
-
}
|
|
389
|
-
#highlightPrevPage() {
|
|
390
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - PageSize);
|
|
391
|
-
}
|
|
392
|
-
#highlightNextPage() {
|
|
393
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? -1) + PageSize);
|
|
394
|
-
}
|
|
395
|
-
#highlightPreviousOption() {
|
|
396
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - 1);
|
|
397
|
-
}
|
|
398
|
-
#highlightNextOption() {
|
|
399
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? -1) + 1);
|
|
400
|
-
}
|
|
401
|
-
/** @internal */
|
|
402
|
-
_tagLabelForValue(value) {
|
|
403
|
-
return this._slottedOptions.find((option) => option.value === value).label;
|
|
404
|
-
}
|
|
405
|
-
/** @internal */
|
|
406
|
-
_tagConnotationForValue(value) {
|
|
407
|
-
return this._slottedOptions.find((option) => option.value === value).tagConnotation;
|
|
408
|
-
}
|
|
409
|
-
/** @internal */
|
|
410
|
-
_isTagDisabled(value) {
|
|
411
|
-
const option = this._slottedOptions.find((option) => option.value === value);
|
|
412
|
-
return this.disabled || option.disabled;
|
|
413
|
-
}
|
|
414
|
-
#textForValue(value) {
|
|
415
|
-
return (this._slottedOptions?.find((option) => option.value === value))?.label;
|
|
416
441
|
}
|
|
417
|
-
/**
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
width: tagWidth
|
|
453
|
-
};
|
|
454
|
-
let elidedTagCounterWidth = 0;
|
|
455
|
-
if (isLastRow) {
|
|
456
|
-
const numElidedTags = i;
|
|
457
|
-
if (numElidedTags) elidedTagCounterWidth = TagGapPx + this.#measureTagWidth(numElidedTags.toString(), false, false);
|
|
458
|
-
}
|
|
459
|
-
if (currentRowWidth + TagGapPx + tagWidth + elidedTagCounterWidth > rowWidth) {
|
|
460
|
-
if (isLastRow) if (i === this.values.length - 1) {
|
|
461
|
-
rows[currentRowIndex].unshift(entry);
|
|
462
|
-
currentRowWidth += TagGapPx + tagWidth;
|
|
463
|
-
} else break;
|
|
464
|
-
else {
|
|
465
|
-
rows.push([]);
|
|
466
|
-
currentRowIndex++;
|
|
467
|
-
rows[currentRowIndex].unshift(entry);
|
|
468
|
-
currentRowWidth = tagWidth;
|
|
442
|
+
/**
|
|
443
|
+
* Handles keydown actions when the select is in multiple selection mode.
|
|
444
|
+
*
|
|
445
|
+
* @internal
|
|
446
|
+
*/
|
|
447
|
+
multipleKeydownHandler(e) {
|
|
448
|
+
if (this.disabled) return;
|
|
449
|
+
const { key, shiftKey } = e;
|
|
450
|
+
this.shouldSkipFocus = false;
|
|
451
|
+
switch (key) {
|
|
452
|
+
case _microsoft_fast_web_utilities.keyHome:
|
|
453
|
+
this.checkFirstOption(shiftKey);
|
|
454
|
+
return;
|
|
455
|
+
case _microsoft_fast_web_utilities.keyArrowDown:
|
|
456
|
+
this.checkNextOption(shiftKey);
|
|
457
|
+
return;
|
|
458
|
+
case _microsoft_fast_web_utilities.keyArrowUp:
|
|
459
|
+
this.checkPreviousOption(shiftKey);
|
|
460
|
+
return;
|
|
461
|
+
case _microsoft_fast_web_utilities.keyEnd:
|
|
462
|
+
this.checkLastOption(shiftKey);
|
|
463
|
+
return;
|
|
464
|
+
case _microsoft_fast_web_utilities.keyTab:
|
|
465
|
+
this.focusAndScrollOptionIntoView();
|
|
466
|
+
return;
|
|
467
|
+
case _microsoft_fast_web_utilities.keyEscape:
|
|
468
|
+
this.uncheckAllOptions();
|
|
469
|
+
this.checkActiveIndex();
|
|
470
|
+
return;
|
|
471
|
+
case _microsoft_fast_web_utilities.keySpace:
|
|
472
|
+
e.preventDefault();
|
|
473
|
+
/* v8 ignore else -- @preserve */
|
|
474
|
+
if (this.typeaheadExpired) {
|
|
475
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
476
|
+
return;
|
|
469
477
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
this._numElidedTags = i + 1;
|
|
476
|
-
rows.reverse();
|
|
477
|
-
for (let i = 0; i < rows.length - 1; i++) {
|
|
478
|
-
let lineWidth = rows[i].map((e) => e.width).reduce((a, b) => a + b, 0) + (rows[i].length - 1) * TagGapPx;
|
|
479
|
-
if (i === 0 && this._numElidedTags) lineWidth += TagGapPx + this.#measureTagWidth(this._numElidedTags.toString(), false, false);
|
|
480
|
-
while (rows[i + 1].length && lineWidth + TagGapPx + rows[i + 1][0].width <= rowWidth) {
|
|
481
|
-
const nextTag = rows[i + 1].shift();
|
|
482
|
-
rows[i].push(nextTag);
|
|
483
|
-
lineWidth += TagGapPx + nextTag.width;
|
|
484
|
-
}
|
|
478
|
+
default:
|
|
479
|
+
/* v8 ignore else -- @preserve */
|
|
480
|
+
if (key.length === 1) this.handleTypeAhead(key);
|
|
481
|
+
return;
|
|
485
482
|
}
|
|
486
|
-
const rowValues = rows.map((line) => line.map((entry) => entry.value));
|
|
487
|
-
this._tagRows = rowValues.slice(0, -1);
|
|
488
|
-
this._lastTagRow = rowValues.slice(-1)[0];
|
|
489
|
-
}
|
|
490
|
-
/** @internal */
|
|
491
|
-
_onTagRemoved(value) {
|
|
492
|
-
this.#updateValuesThroughUserInteraction(this.values.filter((option) => option !== value));
|
|
493
|
-
this.#updateFilteredOptions();
|
|
494
483
|
}
|
|
495
|
-
/**
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
484
|
+
/**
|
|
485
|
+
* Handle keyboard interaction for the select.
|
|
486
|
+
*
|
|
487
|
+
* @param e - the keyboard event
|
|
488
|
+
* @internal
|
|
489
|
+
*/
|
|
490
|
+
keydownHandler(e) {
|
|
491
|
+
const selectedIndexBefore = this.selectedIndex;
|
|
492
|
+
if (this.multiple) this.multipleKeydownHandler(e);
|
|
493
|
+
else super.keydownHandler(e);
|
|
494
|
+
switch (e.key) {
|
|
495
|
+
case _microsoft_fast_web_utilities.keySpace:
|
|
496
|
+
e.preventDefault();
|
|
497
|
+
if (this.collapsible && this.typeaheadExpired) this.open = !this.open;
|
|
506
498
|
break;
|
|
507
|
-
case
|
|
508
|
-
|
|
499
|
+
case _microsoft_fast_web_utilities.keyHome:
|
|
500
|
+
case _microsoft_fast_web_utilities.keyEnd:
|
|
501
|
+
e.preventDefault();
|
|
509
502
|
break;
|
|
510
|
-
case
|
|
511
|
-
|
|
503
|
+
case _microsoft_fast_web_utilities.keyEnter:
|
|
504
|
+
e.preventDefault();
|
|
505
|
+
this.open = !this.open;
|
|
512
506
|
break;
|
|
507
|
+
case _microsoft_fast_web_utilities.keyEscape:
|
|
508
|
+
if (this.collapsible && this.open) {
|
|
509
|
+
e.preventDefault();
|
|
510
|
+
this.open = false;
|
|
511
|
+
}
|
|
512
|
+
break;
|
|
513
|
+
case _microsoft_fast_web_utilities.keyTab:
|
|
514
|
+
if (this.collapsible && this.open) {
|
|
515
|
+
e.preventDefault();
|
|
516
|
+
this.open = false;
|
|
517
|
+
}
|
|
518
|
+
return true;
|
|
513
519
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
#moveTagFocusTo(index) {
|
|
517
|
-
if (index === null) this._input.focus();
|
|
518
|
-
else this.shadowRoot.querySelector(`[data-index="${index}"]`)?.focus();
|
|
519
|
-
}
|
|
520
|
-
#nextTagIndexLeft(index) {
|
|
521
|
-
if (!this.values.length) return null;
|
|
522
|
-
for (let i = index - 1; i >= 0; i--) if (!this._isTagDisabled(this.values[i])) return i;
|
|
523
|
-
return null;
|
|
524
|
-
}
|
|
525
|
-
#nextTagIndexRight(index) {
|
|
526
|
-
if (!this.values.length) return null;
|
|
527
|
-
for (let i = index + 1; i < this.values.length; i++) if (!this._isTagDisabled(this.values[i])) return i;
|
|
528
|
-
return null;
|
|
529
|
-
}
|
|
530
|
-
#nextTagIndexForRemoved(index) {
|
|
531
|
-
return this.#nextTagIndexRight(index - 1) ?? this.#nextTagIndexLeft(index);
|
|
532
|
-
}
|
|
533
|
-
/** @internal */
|
|
534
|
-
_onListboxClick(e) {
|
|
535
|
-
if (this.disabled) return;
|
|
536
|
-
const capturedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
|
|
537
|
-
if (capturedOption?.getAttribute("data-select-all") !== null) {
|
|
538
|
-
this._toggleSelectAll();
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
if (capturedOption && !capturedOption.disabled) this.#handleOptionInteraction(capturedOption);
|
|
542
|
-
}
|
|
543
|
-
/** @internal */
|
|
544
|
-
get _shouldShowClearButton() {
|
|
545
|
-
return this.clearable && this.values.length > 0;
|
|
546
|
-
}
|
|
547
|
-
/** @internal */
|
|
548
|
-
_onClearButtonClick() {
|
|
549
|
-
this.#updateValuesThroughUserInteraction(this.selectedOptions.filter((option) => option.disabled).map((option) => option.value));
|
|
550
|
-
}
|
|
551
|
-
/** @internal */
|
|
552
|
-
maxSelectedChanged() {
|
|
553
|
-
this.#updateSelectionLimit();
|
|
554
|
-
}
|
|
555
|
-
#updateSelectionLimit() {
|
|
556
|
-
if (!this.multiple || !this._slottedOptions || typeof this.maxSelected !== "number" || this.maxSelected <= 0) return;
|
|
557
|
-
const options = this._slottedOptions.filter((option) => !this._slottedDisabledOptions.includes(option));
|
|
558
|
-
if (this.values.length >= this.maxSelected) {
|
|
559
|
-
const unselectedOptions = options.filter((option) => !this.selectedOptions.includes(option));
|
|
560
|
-
for (const option of unselectedOptions) option.disabled = true;
|
|
561
|
-
} else for (const option of options) option.disabled = false;
|
|
520
|
+
if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) this.updateValue(true);
|
|
521
|
+
return !(e.key === _microsoft_fast_web_utilities.keyArrowDown || e.key === _microsoft_fast_web_utilities.keyArrowUp);
|
|
562
522
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
523
|
+
connectedCallback() {
|
|
524
|
+
super.connectedCallback();
|
|
525
|
+
this.addEventListener("focusout", this.focusoutHandler);
|
|
526
|
+
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
566
527
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
528
|
+
disconnectedCallback() {
|
|
529
|
+
this.removeEventListener("focusout", this.focusoutHandler);
|
|
530
|
+
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
531
|
+
super.disconnectedCallback();
|
|
570
532
|
}
|
|
571
533
|
/** @internal */
|
|
572
|
-
|
|
573
|
-
|
|
534
|
+
updateDisplayValue() {
|
|
535
|
+
if (this.collapsible) _microsoft_fast_element.Observable.notify(this, "displayValue");
|
|
574
536
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
if (!this.multiple || !this._slottedOptions) return false;
|
|
579
|
-
const selectable = this._selectableOptions;
|
|
580
|
-
if (selectable.length === 0) return false;
|
|
581
|
-
const selected = new Set(selectedValues);
|
|
582
|
-
return selectable.every((o) => selected.has(o.value));
|
|
537
|
+
get displayValue() {
|
|
538
|
+
_microsoft_fast_element.Observable.track(this, "displayValue");
|
|
539
|
+
return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
|
|
583
540
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
this.#updateValuesThroughUserInteraction(updatedValues);
|
|
590
|
-
this._changeDescription = this.locale.searchableSelect.deselectedAllMessage;
|
|
591
|
-
return;
|
|
541
|
+
_newDefaultSelectedIndex(prev, next, currentSelectIndex) {
|
|
542
|
+
const defaultSelectedIndex = super._newDefaultSelectedIndex(prev, next, currentSelectIndex);
|
|
543
|
+
if (defaultSelectedIndex === null && currentSelectIndex === -1 && !this.placeholder) {
|
|
544
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
545
|
+
if (firstSelectableIndex !== -1) return firstSelectableIndex;
|
|
592
546
|
}
|
|
593
|
-
|
|
594
|
-
const updatedValues = [...this.values, ...missingValues];
|
|
595
|
-
this.#updateValuesThroughUserInteraction(updatedValues);
|
|
596
|
-
this._changeDescription = this.locale.searchableSelect.selectedAllMessage;
|
|
547
|
+
return defaultSelectedIndex;
|
|
597
548
|
}
|
|
598
|
-
|
|
599
|
-
return
|
|
549
|
+
_isDefaultSelected(option) {
|
|
550
|
+
return super._isDefaultSelected(option) || option.value === this.initialValue || !this._isResetting && option.value === this.value;
|
|
600
551
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
552
|
+
slottedOptionsChanged(prev, next) {
|
|
553
|
+
this.options.forEach((o) => {
|
|
554
|
+
_microsoft_fast_element.Observable.getNotifier(o).unsubscribe(this, "value");
|
|
555
|
+
});
|
|
556
|
+
super.slottedOptionsChanged(prev, next);
|
|
557
|
+
this.options.forEach((o) => {
|
|
558
|
+
_microsoft_fast_element.Observable.getNotifier(o).subscribe(this, "value");
|
|
559
|
+
});
|
|
560
|
+
this.setProxyOptions();
|
|
561
|
+
this.updateValue();
|
|
562
|
+
const scale = this.getAttribute("scale") || this.scale;
|
|
563
|
+
next.forEach((element) => {
|
|
564
|
+
if (scale) {
|
|
565
|
+
element.setAttribute("scale", scale);
|
|
566
|
+
element.scale = scale;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
this.proxy.value = this.value;
|
|
570
|
+
this.validate();
|
|
613
571
|
}
|
|
614
|
-
/** @internal */
|
|
615
572
|
formResetCallback() {
|
|
616
|
-
|
|
617
|
-
this
|
|
573
|
+
this.setProxyOptions();
|
|
574
|
+
this._isResetting = true;
|
|
575
|
+
this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
|
|
576
|
+
this._isResetting = false;
|
|
618
577
|
}
|
|
619
|
-
#resizeObserver;
|
|
620
578
|
/** @internal */
|
|
621
|
-
|
|
622
|
-
if (this.
|
|
623
|
-
if (
|
|
624
|
-
|
|
625
|
-
this.open = true;
|
|
626
|
-
}
|
|
579
|
+
get _shouldShowClearButton() {
|
|
580
|
+
if (!this.clearable) return false;
|
|
581
|
+
if (this.multiple) return this.selectedOptions?.length > 0;
|
|
582
|
+
return this.value !== "";
|
|
627
583
|
}
|
|
628
584
|
/** @internal */
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
return true;
|
|
635
|
-
}
|
|
636
|
-
connectedCallback() {
|
|
637
|
-
super.connectedCallback();
|
|
638
|
-
if (!this.values.length) this.values = this.#determineInitialValues();
|
|
639
|
-
this.#resizeObserver.observe(this._contentArea);
|
|
640
|
-
}
|
|
641
|
-
disconnectedCallback() {
|
|
642
|
-
super.disconnectedCallback();
|
|
643
|
-
this.#resizeObserver.disconnect();
|
|
585
|
+
_onClearButtonFocus() {
|
|
586
|
+
this._isClearButtonFocused = true;
|
|
587
|
+
this.activeIndex = -1;
|
|
588
|
+
this.uncheckAllOptions();
|
|
644
589
|
}
|
|
645
590
|
/** @internal */
|
|
646
|
-
|
|
647
|
-
|
|
591
|
+
_onClearButtonBlur() {
|
|
592
|
+
this._isClearButtonFocused = false;
|
|
648
593
|
}
|
|
649
594
|
/** @internal */
|
|
650
|
-
|
|
651
|
-
this.
|
|
595
|
+
get _shouldShowLabelWrapper() {
|
|
596
|
+
return Boolean(this.label || this._hasContextualHelp || this.multiple && this._shouldShowClearButton);
|
|
652
597
|
}
|
|
653
598
|
/** @internal */
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
599
|
+
_onClearButtonClick() {
|
|
600
|
+
if (this.multiple) this.selectedOptions.forEach((o) => {
|
|
601
|
+
/* v8 ignore else -- @preserve */
|
|
602
|
+
if (!o.disabled) o.selected = false;
|
|
603
|
+
});
|
|
604
|
+
else this.selectedIndex = -1;
|
|
605
|
+
this.updateValue(true);
|
|
661
606
|
}
|
|
662
607
|
};
|
|
663
|
-
require_decorate.__decorate([_microsoft_fast_element.
|
|
664
|
-
require_decorate.__decorate([_microsoft_fast_element.attr],
|
|
665
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)()], SearchableSelect.prototype, "scale", void 0);
|
|
608
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "activeIndex", void 0);
|
|
609
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], Select.prototype, "multiple", void 0);
|
|
666
610
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
667
|
-
|
|
668
|
-
attribute: "fixed-dropdown"
|
|
669
|
-
})], SearchableSelect.prototype, "fixedDropdown", void 0);
|
|
670
|
-
require_decorate.__decorate([_microsoft_fast_element.attr], SearchableSelect.prototype, "placeholder", void 0);
|
|
671
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], SearchableSelect.prototype, "open", void 0);
|
|
672
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], SearchableSelect.prototype, "multiple", void 0);
|
|
673
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
674
|
-
attribute: "external-tags",
|
|
611
|
+
attribute: "open",
|
|
675
612
|
mode: "boolean"
|
|
676
|
-
})],
|
|
677
|
-
require_decorate.__decorate([
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
require_decorate.__decorate([_microsoft_fast_element.
|
|
682
|
-
require_decorate.__decorate([_microsoft_fast_element.
|
|
683
|
-
require_decorate.__decorate([_microsoft_fast_element.
|
|
684
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_currentSearchText", void 0);
|
|
685
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_slottedOptions", void 0);
|
|
686
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "optionFilter", void 0);
|
|
687
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_filteredOptions", void 0);
|
|
688
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_filteredEnabledOptions", void 0);
|
|
689
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], SearchableSelect.prototype, "loading", void 0);
|
|
690
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_highlightedOptionIndex", void 0);
|
|
691
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_contentArea", void 0);
|
|
692
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_numElidedTags", void 0);
|
|
693
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_tagRows", void 0);
|
|
694
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_lastTagRow", void 0);
|
|
695
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_listbox", void 0);
|
|
696
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], SearchableSelect.prototype, "clearable", void 0);
|
|
613
|
+
})], Select.prototype, "open", void 0);
|
|
614
|
+
require_decorate.__decorate([_microsoft_fast_element.volatile], Select.prototype, "collapsible", null);
|
|
615
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "control", void 0);
|
|
616
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "maxHeight", void 0);
|
|
617
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "_anchor", void 0);
|
|
618
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)()], Select.prototype, "scale", void 0);
|
|
619
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Select.prototype, "appearance", void 0);
|
|
620
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Select.prototype, "shape", void 0);
|
|
697
621
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
})],
|
|
701
|
-
require_decorate.__decorate([_microsoft_fast_element.
|
|
702
|
-
require_decorate.__decorate([
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "select-all-text" })], SearchableSelect.prototype, "selectAllText", void 0);
|
|
707
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "deselect-all-text" })], SearchableSelect.prototype, "deselectAllText", void 0);
|
|
708
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_selectAllOption", void 0);
|
|
709
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_changeDescription", void 0);
|
|
710
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], SearchableSelect.prototype, "_anchor", void 0);
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region src/lib/searchable-select/option-tag.ts
|
|
713
|
-
var OptionTag = class extends require_localized.Localized(require_vivid_element.VividElement) {
|
|
714
|
-
constructor(..._args) {
|
|
715
|
-
super(..._args);
|
|
716
|
-
this.removable = false;
|
|
717
|
-
this.disabled = false;
|
|
718
|
-
this.hasIconPlaceholder = false;
|
|
719
|
-
}
|
|
720
|
-
/** @internal */
|
|
721
|
-
_onClickRemove() {
|
|
722
|
-
this.$emit("remove", void 0, { bubbles: false });
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
require_decorate.__decorate([_microsoft_fast_element.attr], OptionTag.prototype, "shape", void 0);
|
|
726
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], OptionTag.prototype, "connotation", void 0);
|
|
727
|
-
require_decorate.__decorate([_microsoft_fast_element.attr], OptionTag.prototype, "label", void 0);
|
|
728
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], OptionTag.prototype, "removable", void 0);
|
|
729
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], OptionTag.prototype, "disabled", void 0);
|
|
730
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], OptionTag.prototype, "hasIconPlaceholder", void 0);
|
|
731
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)()], OptionTag.prototype, "scale", void 0);
|
|
622
|
+
mode: "boolean",
|
|
623
|
+
attribute: "fixed-dropdown"
|
|
624
|
+
})], Select.prototype, "fixedDropdown", void 0);
|
|
625
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Select.prototype, "placeholder", void 0);
|
|
626
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "_feedbackWrapper", void 0);
|
|
627
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "metaSlottedContent", void 0);
|
|
628
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], Select.prototype, "clearable", void 0);
|
|
629
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "_isClearButtonFocused", void 0);
|
|
732
630
|
//#endregion
|
|
733
|
-
//#region src/lib/
|
|
631
|
+
//#region src/lib/select/select.template.ts
|
|
734
632
|
function renderLabel() {
|
|
735
|
-
return _microsoft_fast_element.html`
|
|
736
|
-
|
|
737
|
-
|
|
633
|
+
return _microsoft_fast_element.html` <label
|
|
634
|
+
for="${(x) => x.multiple ? null : "control"}"
|
|
635
|
+
class="label"
|
|
636
|
+
id="label"
|
|
637
|
+
>
|
|
638
|
+
${(x) => x.label}
|
|
639
|
+
</label>`;
|
|
738
640
|
}
|
|
739
|
-
function
|
|
641
|
+
function renderPlaceholder(context) {
|
|
642
|
+
const optionTag = context.tagFor(require_option.ListboxOption);
|
|
740
643
|
return _microsoft_fast_element.html`
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
class="selection-count"
|
|
744
|
-
aria-label="${(x) => x.locale.searchableSelect.maxSelectedMessage(x.values.length, x.maxSelected)}"
|
|
745
|
-
>(${(x) => `${x.values.length}/${x.maxSelected}`})</span
|
|
746
|
-
>
|
|
747
|
-
`;
|
|
644
|
+
<${optionTag} text="${(x) => x.placeholder}" hidden disabled>
|
|
645
|
+
</${optionTag}>`;
|
|
748
646
|
}
|
|
749
|
-
|
|
750
|
-
const
|
|
751
|
-
return _microsoft_fast_element.html`
|
|
752
|
-
<div class="tag-wrapper">
|
|
753
|
-
<${optionTagTag}
|
|
754
|
-
class="tag"
|
|
755
|
-
tabindex="-1"
|
|
756
|
-
data-index="${(x, c) => getComponent(c).values.indexOf(x)}"
|
|
757
|
-
removable
|
|
758
|
-
:label="${(x, c) => getComponent(c)._tagLabelForValue(x)}"
|
|
759
|
-
:shape="${(_, c) => getComponent(c).shape}"
|
|
760
|
-
:connotation="${(x, c) => getComponent(c)._tagConnotationForValue(x)}"
|
|
761
|
-
:scale="${(_, c) => getComponent(c).scale}"
|
|
762
|
-
?disabled="${(x, c) => getComponent(c)._isTagDisabled(x)}"
|
|
763
|
-
@remove="${(x, c) => getComponent(c)._onTagRemoved(x)}"
|
|
764
|
-
@keydown="${(_, c) => getComponent(c)._onTagKeydown(c.event)}"
|
|
765
|
-
@mousedown="${() => false}">
|
|
766
|
-
<slot slot="icon" name="${(x, c) => getComponent(c)._tagIconSlotName(x)}"></slot>
|
|
767
|
-
</${optionTagTag}>
|
|
768
|
-
</div>
|
|
769
|
-
`;
|
|
770
|
-
};
|
|
771
|
-
var elidedTagTemplateFactory = (context, getComponent) => {
|
|
772
|
-
const optionTagTag = context.tagFor(OptionTag);
|
|
773
|
-
return _microsoft_fast_element.html`
|
|
774
|
-
<${optionTagTag}
|
|
775
|
-
class="tag"
|
|
776
|
-
tabindex="-1"
|
|
777
|
-
:label="${(x, c) => getComponent(x, c)._numElidedTags.toString()}"
|
|
778
|
-
:shape="${(x, c) => getComponent(x, c).shape}"
|
|
779
|
-
:scale="${(x, c) => getComponent(x, c).scale}"
|
|
780
|
-
?disabled="${(x, c) => getComponent(x, c).disabled}"
|
|
781
|
-
@mousedown="${() => false}">
|
|
782
|
-
</${optionTagTag}>
|
|
783
|
-
`;
|
|
784
|
-
};
|
|
785
|
-
function renderFieldset(context) {
|
|
786
|
-
const buttonTag = context.tagFor(require_definition$2.Button);
|
|
787
|
-
const progressRingTag = context.tagFor(require_definition$1.ProgressRing);
|
|
788
|
-
const affixIconTemplate = require_affix.affixIconTemplateFactory(context);
|
|
789
|
-
const chevronTemplate = require_definition$2.chevronTemplateFactory(context);
|
|
790
|
-
const tagTemplate = tagTemplateFactory(context, (c) => c.parent);
|
|
791
|
-
const nestedTagTemplate = tagTemplateFactory(context, (c) => c.parentContext.parent);
|
|
792
|
-
const elidedTagTemplate = elidedTagTemplateFactory(context, (x, _) => x);
|
|
793
|
-
const nestedElidedTagTemplate = elidedTagTemplateFactory(context, (_, c) => c.parent);
|
|
647
|
+
function renderClearButton(context) {
|
|
648
|
+
const buttonTag = context.tagFor(require_definition$1.Button);
|
|
794
649
|
return _microsoft_fast_element.html`
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
${(
|
|
799
|
-
|
|
800
|
-
${(x) => affixIconTemplate(x.icon, require_affix.IconWrapper.Slot)}
|
|
801
|
-
<div class="content-area" ${(0, _microsoft_fast_element.ref)("_contentArea")}>
|
|
802
|
-
${(0, _microsoft_fast_element.repeat)((x) => x._tagRows, _microsoft_fast_element.html`
|
|
803
|
-
<div class="tag-row">
|
|
804
|
-
${(0, _microsoft_fast_element.when)((_, c) => c.isFirst && c.parent._numElidedTags, nestedElidedTagTemplate)}
|
|
805
|
-
${(0, _microsoft_fast_element.repeat)((x) => x, nestedTagTemplate)}
|
|
806
|
-
</div>
|
|
807
|
-
`, { positioning: true })}
|
|
808
|
-
<div
|
|
809
|
-
class="tag-row ${(x) => (0, _microsoft_fast_web_utilities.classNames)(["contains-only-input", x._tagRows.length > 0 && x._lastTagRow.length === 0])}"
|
|
810
|
-
>
|
|
811
|
-
${(0, _microsoft_fast_element.when)((x) => x._tagRows.length === 0 && x._numElidedTags, elidedTagTemplate)}
|
|
812
|
-
${(0, _microsoft_fast_element.repeat)((x) => x._lastTagRow, tagTemplate)}
|
|
813
|
-
<input
|
|
814
|
-
id="control"
|
|
815
|
-
class="control"
|
|
816
|
-
autocomplete="off"
|
|
817
|
-
${require_delegates_aria.delegateAria({
|
|
818
|
-
role: "combobox",
|
|
819
|
-
ariaAutoComplete: "list",
|
|
820
|
-
ariaHasPopup: "listbox",
|
|
821
|
-
ariaExpanded: (x) => x.open,
|
|
822
|
-
ariaControls: "listbox",
|
|
823
|
-
ariaDescribedBy: (x) => `${x._feedbackDescribedBy} ${x.multiple && x.maxSelected && x.maxSelected >= 1 ? "selection-count" : null}`
|
|
824
|
-
})}
|
|
825
|
-
placeholder="${(x) => x.multiple && x.values.length ? "" : x.placeholder}"
|
|
826
|
-
type="text"
|
|
827
|
-
?disabled="${(x) => x.disabled}"
|
|
828
|
-
:value="${(x) => x._inputValue}"
|
|
829
|
-
@input="${(x, c) => {
|
|
830
|
-
x._onInputInput(c.event);
|
|
650
|
+
<${buttonTag}
|
|
651
|
+
aria-label="${(x) => x.locale.select.clearButtonLabel}"
|
|
652
|
+
aria-hidden="${(x) => x._isClearButtonFocused ? "false" : "true"}"
|
|
653
|
+
@click="${(x, c) => {
|
|
654
|
+
x._onClearButtonClick();
|
|
831
655
|
c.event.stopPropagation();
|
|
832
656
|
}}"
|
|
833
|
-
|
|
657
|
+
@mousedown="${() => false}"
|
|
658
|
+
@keydown="${(x, c) => {
|
|
659
|
+
/* v8 ignore next -- @preserve */
|
|
660
|
+
if (c.event.key === "Tab") x._onClearButtonBlur();
|
|
834
661
|
c.event.stopPropagation();
|
|
662
|
+
return true;
|
|
835
663
|
}}"
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
:shape="${(x) => x.shape}"
|
|
850
|
-
size="super-condensed"
|
|
851
|
-
icon="close-line"
|
|
852
|
-
appearance="ghost-light"
|
|
853
|
-
tabindex="0"
|
|
854
|
-
></${buttonTag}>`)}
|
|
855
|
-
<div @mousedown="${() => false}" @click="${(x) => x._onChevronClick()}">
|
|
856
|
-
${(0, _microsoft_fast_element.when)((x) => x.loading, _microsoft_fast_element.html`<${progressRingTag} indeterminate size="-6" aria-hidden="true"></${progressRingTag}>`)}
|
|
857
|
-
${(0, _microsoft_fast_element.when)((x) => !x.loading, chevronTemplate)}
|
|
858
|
-
</div>
|
|
859
|
-
</div>
|
|
664
|
+
@focusin="${(x, c) => {
|
|
665
|
+
c.event.stopPropagation();
|
|
666
|
+
x._onClearButtonFocus();
|
|
667
|
+
}}"
|
|
668
|
+
@focusout="${(x) => x._onClearButtonBlur()}"
|
|
669
|
+
?disabled="${(x) => x.disabled}"
|
|
670
|
+
:shape="${(x) => x.shape}"
|
|
671
|
+
size="super-condensed"
|
|
672
|
+
icon="close-line"
|
|
673
|
+
appearance="ghost-light"
|
|
674
|
+
class="clear-button"
|
|
675
|
+
tabindex="0"
|
|
676
|
+
></${buttonTag}>
|
|
860
677
|
`;
|
|
861
678
|
}
|
|
862
|
-
function
|
|
863
|
-
|
|
679
|
+
function selectValue(context) {
|
|
680
|
+
const affixIconTemplate = require_affix.affixIconTemplateFactory(context);
|
|
681
|
+
const chevronTemplate = require_definition$1.chevronTemplateFactory(context);
|
|
682
|
+
return _microsoft_fast_element.html` <div
|
|
683
|
+
class="control ${(x) => (0, _microsoft_fast_web_utilities.classNames)(["has-activedescendant", Boolean(x._activeDescendant) && x.open], ["disabled", x.disabled], [`appearance-${x.appearance}`, Boolean(x.appearance)], [`shape-${x.shape}`, Boolean(x.shape)], ["has-meta", Boolean(x.metaSlottedContent?.length)], ["error", Boolean(x.errorValidationMessage)], ["success", !!x.successText], ["shows-placeholder", Boolean(x.placeholder) && !x.value], [`size-${x.scale}`, Boolean(x.scale)])}"
|
|
684
|
+
${(0, _microsoft_fast_element.ref)("_anchor")}
|
|
685
|
+
id="control"
|
|
686
|
+
?disabled="${(x) => x.disabled}"
|
|
687
|
+
>
|
|
688
|
+
<div class="selected-value">
|
|
689
|
+
${(x) => affixIconTemplate(x.icon, require_affix.IconWrapper.Slot)}
|
|
690
|
+
<span class="text">${(x) => x.displayValue}</span>
|
|
691
|
+
<slot name="meta" ${(0, _microsoft_fast_element.slotted)("metaSlottedContent")}></slot>
|
|
692
|
+
</div>
|
|
693
|
+
${(0, _microsoft_fast_element.when)((x) => x._shouldShowClearButton, renderClearButton(context))}
|
|
694
|
+
${chevronTemplate}
|
|
695
|
+
</div>`;
|
|
864
696
|
}
|
|
865
|
-
function
|
|
866
|
-
|
|
867
|
-
const dividerTag = context.tagFor(require_divider.Divider);
|
|
868
|
-
return _microsoft_fast_element.html`
|
|
869
|
-
<${optionTag}
|
|
870
|
-
data-select-all
|
|
871
|
-
tabindex="-1"
|
|
872
|
-
:text="${(x) => x._selectAllLabel}"
|
|
873
|
-
:selected="${(x) => x._isAllSelected}"
|
|
874
|
-
:_displayCheckmark="${() => true}"
|
|
875
|
-
?disabled="${(x) => x._selectableOptions.length === 0}"
|
|
876
|
-
${(0, _microsoft_fast_element.ref)("_selectAllOption")}>
|
|
877
|
-
</${optionTag}>
|
|
878
|
-
<${dividerTag} class="divider"></${dividerTag}>
|
|
879
|
-
`;
|
|
697
|
+
function setFixedDropdownVarWidth(x) {
|
|
698
|
+
return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
|
|
880
699
|
}
|
|
700
|
+
/** @param context - element definition context */
|
|
881
701
|
function renderControl(context) {
|
|
882
|
-
const popupTag = context.tagFor(require_definition$
|
|
702
|
+
const popupTag = context.tagFor(require_definition$2.Popup);
|
|
883
703
|
return _microsoft_fast_element.html`
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
${(x) => x._changeDescription}
|
|
895
|
-
</span>
|
|
896
|
-
<div>
|
|
897
|
-
${renderFieldset(context)}
|
|
898
|
-
<div class="popup-wrapper">
|
|
899
|
-
<${popupTag}
|
|
704
|
+
<div class="label-wrapper" ?hidden=${(x) => !x._shouldShowLabelWrapper}>
|
|
705
|
+
${(0, _microsoft_fast_element.when)((x) => x.label, renderLabel())}
|
|
706
|
+
${(0, _microsoft_fast_element.when)((x) => x.multiple && x._shouldShowClearButton, renderClearButton(context))}
|
|
707
|
+
<slot name="contextual-help" ${(0, _microsoft_fast_element.slotted)("_contextualHelpSlottedContent")}></slot>
|
|
708
|
+
</div>
|
|
709
|
+
<div class="control-wrapper">
|
|
710
|
+
${(0, _microsoft_fast_element.when)((x) => !x.multiple, selectValue(context))}
|
|
711
|
+
<${popupTag} class="popup"
|
|
712
|
+
style="${setFixedDropdownVarWidth}"
|
|
713
|
+
?open="${(x) => x.collapsible ? x.open : true}"
|
|
900
714
|
:anchor="${(x) => x._anchor}"
|
|
901
|
-
:open="${(x) => x.open}"
|
|
902
|
-
class="popup"
|
|
903
715
|
placement="bottom-start"
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
class="listbox"
|
|
716
|
+
strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
|
|
717
|
+
<div class="listbox"
|
|
718
|
+
id="${(x) => x.listboxId}"
|
|
908
719
|
role="listbox"
|
|
909
720
|
aria-multiselectable="${(x) => x.multiple}"
|
|
910
|
-
aria-
|
|
911
|
-
${(
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
${(0, _microsoft_fast_element.when)((x) => x.
|
|
721
|
+
aria-label="${(x) => x.multiple && !x.label && x.ariaLabel ? x.ariaLabel : null}"
|
|
722
|
+
aria-labelledby="${(x) => x.multiple && x.label ? "label" : null}"
|
|
723
|
+
?disabled="${(x) => x.disabled}"
|
|
724
|
+
?hidden="${(x) => x.collapsible ? !x.open : false}"
|
|
725
|
+
${(0, _microsoft_fast_element.ref)("listbox")}>
|
|
726
|
+
${(0, _microsoft_fast_element.when)((x) => x.placeholder, renderPlaceholder(context))}
|
|
916
727
|
<slot
|
|
917
728
|
${(0, _microsoft_fast_element.slotted)({
|
|
918
|
-
filter:
|
|
729
|
+
filter: require_listbox.Listbox.slottedOptionFilter,
|
|
919
730
|
flatten: true,
|
|
920
|
-
property: "
|
|
731
|
+
property: "slottedOptions"
|
|
921
732
|
})}>
|
|
922
733
|
</slot>
|
|
923
|
-
|
|
924
|
-
${(0, _microsoft_fast_element.when)((x) => x.loading, _microsoft_fast_element.html`<slot name="loading-options">
|
|
925
|
-
${(x) => x.locale.searchableSelect.loadingOptionsMessage}
|
|
926
|
-
</slot>`)}
|
|
927
|
-
${(0, _microsoft_fast_element.when)((x) => !x.loading && x.searchText === "", _microsoft_fast_element.html`<slot name="no-options">
|
|
928
|
-
${(x) => x.locale.searchableSelect.noOptionsMessage}
|
|
929
|
-
</slot>`)}
|
|
930
|
-
${(0, _microsoft_fast_element.when)((x) => !x.loading && x.searchText !== "", _microsoft_fast_element.html`<slot name="no-matches">
|
|
931
|
-
${(x) => x.locale.searchableSelect.noMatchesMessage}
|
|
932
|
-
</slot>`)}
|
|
933
|
-
</div>`)}
|
|
934
|
-
</div>
|
|
734
|
+
</div>
|
|
935
735
|
</${popupTag}>
|
|
936
736
|
</div>
|
|
937
|
-
|
|
938
|
-
|
|
737
|
+
`;
|
|
738
|
+
}
|
|
739
|
+
/** Ignore events that originate from feedback, e.g. a click on link */
|
|
740
|
+
function ifNotFromFeedback(handler) {
|
|
741
|
+
return (x, c) => {
|
|
742
|
+
if (!c.event.composedPath().includes(x._feedbackWrapper)) {
|
|
743
|
+
handler(x, c.event);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
return true;
|
|
747
|
+
};
|
|
939
748
|
}
|
|
940
|
-
var
|
|
941
|
-
const optionTagName = context.tagFor(OptionTag, true);
|
|
749
|
+
var SelectTemplate = (context) => {
|
|
942
750
|
return _microsoft_fast_element.html`
|
|
943
751
|
<template
|
|
944
|
-
|
|
945
|
-
|
|
752
|
+
${require_host_semantics.applyHostSemantics({
|
|
753
|
+
role: "combobox",
|
|
754
|
+
ariaLabel: (x) => x.ariaLabel ?? x.label,
|
|
755
|
+
ariaHasPopup: (x) => x.collapsible ? "listbox" : "false",
|
|
756
|
+
ariaExpanded: (x) => x.open,
|
|
757
|
+
ariaDisabled: (x) => x.disabled
|
|
758
|
+
})}
|
|
759
|
+
aria-controls="${(x) => x.listboxId}"
|
|
760
|
+
aria-activedescendant="${(x) => x.open ? x._activeDescendant : null}"
|
|
761
|
+
aria-describedby="${(x) => x._feedbackDescribedBy}"
|
|
762
|
+
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
763
|
+
@click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
|
|
764
|
+
@focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
|
|
765
|
+
@focusout="${ifNotFromFeedback((x, e) => x.focusoutHandler(e))}"
|
|
766
|
+
@keydown="${ifNotFromFeedback((x, e) => {
|
|
767
|
+
if (x.open) require_dialog.handleEscapeKeyAndStopPropogation(e);
|
|
768
|
+
return x.keydownHandler(e);
|
|
769
|
+
})}"
|
|
770
|
+
@mousedown="${ifNotFromFeedback((x, e) => x.mousedownHandler(e))}"
|
|
946
771
|
>
|
|
947
|
-
|
|
948
|
-
|
|
772
|
+
${renderControl(context)}
|
|
773
|
+
<div class="feedback-wrapper" ${(0, _microsoft_fast_element.ref)("_feedbackWrapper")}>
|
|
774
|
+
${(x) => x._getFeedbackTemplate(context)}
|
|
949
775
|
</div>
|
|
950
776
|
</template>
|
|
951
777
|
`;
|
|
952
778
|
};
|
|
953
779
|
//#endregion
|
|
954
|
-
//#region src/lib/
|
|
955
|
-
function renderRemoveButton(iconTag) {
|
|
956
|
-
return _microsoft_fast_element.html`
|
|
957
|
-
<span
|
|
958
|
-
class="remove-button"
|
|
959
|
-
aria-label="${(x) => x.locale.searchableSelect.removeTagButtonLabel(x.label)}"
|
|
960
|
-
role="button"
|
|
961
|
-
tabindex="${(x) => x.disabled ? null : 0}"
|
|
962
|
-
@click="${(x) => x._onClickRemove()}"
|
|
963
|
-
>
|
|
964
|
-
<${iconTag} name="close-line"></${iconTag}>
|
|
965
|
-
</span>
|
|
966
|
-
`;
|
|
967
|
-
}
|
|
968
|
-
var optionTagTemplate = (context) => {
|
|
969
|
-
const iconTag = context.tagFor(require_definition.Icon);
|
|
970
|
-
return _microsoft_fast_element.html`<span
|
|
971
|
-
class="${(x) => (0, _microsoft_fast_web_utilities.classNames)("base", ["disabled", x.disabled], ["removable", x.removable], [`shape-${x.shape}`, Boolean(x.shape)], [`connotation-${x.connotation}`, Boolean(x.connotation)], [`size-${x.scale}`, Boolean(x.scale)])}"
|
|
972
|
-
aria-disabled="${(x) => x.disabled}"
|
|
973
|
-
>
|
|
974
|
-
<slot name="icon" aria-hidden="true">
|
|
975
|
-
${(0, _microsoft_fast_element.when)((x) => x.hasIconPlaceholder, _microsoft_fast_element.html`<div class="icon-placeholder"></div>`)}
|
|
976
|
-
</slot>
|
|
977
|
-
${(0, _microsoft_fast_element.when)((x) => x.label, (x) => _microsoft_fast_element.html`<span class="label">${x.label}</span>`)}
|
|
978
|
-
${(0, _microsoft_fast_element.when)((x) => x.removable, renderRemoveButton(iconTag))}
|
|
979
|
-
</span>`;
|
|
980
|
-
};
|
|
981
|
-
//#endregion
|
|
982
|
-
//#region src/lib/searchable-select/definition.ts
|
|
983
|
-
var optionTagDefinition = require_vivid_element.defineVividComponent("option-tag", OptionTag, optionTagTemplate, [require_definition.iconDefinition], {
|
|
984
|
-
styles: [option_tag_default],
|
|
985
|
-
shadowOptions: { delegatesFocus: true }
|
|
986
|
-
});
|
|
780
|
+
//#region src/lib/select/definition.ts
|
|
987
781
|
/** @internal */
|
|
988
|
-
var
|
|
989
|
-
require_definition$2.
|
|
990
|
-
require_definition$3.popupDefinition,
|
|
782
|
+
var selectDefinition = require_vivid_element.defineVividComponent("select", Select, SelectTemplate, [
|
|
783
|
+
require_definition$2.popupDefinition,
|
|
991
784
|
require_definition.iconDefinition,
|
|
992
|
-
|
|
993
|
-
require_definition$
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
], { styles: searchable_select_default });
|
|
785
|
+
require_definition$3.listboxOptionDefinition,
|
|
786
|
+
require_definition$4.optgroupDefinition,
|
|
787
|
+
require_definition$1.buttonDefinition,
|
|
788
|
+
require_mixins.feedbackMessageDefinition
|
|
789
|
+
], { styles: select_default });
|
|
998
790
|
/**
|
|
999
|
-
* Registers the
|
|
791
|
+
* Registers the select elements with the design system.
|
|
1000
792
|
*
|
|
1001
793
|
* @param prefix - the prefix to use for the component name
|
|
1002
794
|
*/
|
|
1003
|
-
var
|
|
795
|
+
var registerSelect = require_vivid_element.createRegisterFunction(selectDefinition);
|
|
1004
796
|
//#endregion
|
|
1005
|
-
Object.defineProperty(exports, "
|
|
797
|
+
Object.defineProperty(exports, "Select", {
|
|
1006
798
|
enumerable: true,
|
|
1007
799
|
get: function() {
|
|
1008
|
-
return
|
|
800
|
+
return Select;
|
|
1009
801
|
}
|
|
1010
802
|
});
|
|
1011
|
-
Object.defineProperty(exports, "
|
|
803
|
+
Object.defineProperty(exports, "registerSelect", {
|
|
1012
804
|
enumerable: true,
|
|
1013
805
|
get: function() {
|
|
1014
|
-
return
|
|
806
|
+
return registerSelect;
|
|
1015
807
|
}
|
|
1016
808
|
});
|
|
1017
|
-
Object.defineProperty(exports, "
|
|
809
|
+
Object.defineProperty(exports, "selectDefinition", {
|
|
1018
810
|
enumerable: true,
|
|
1019
811
|
get: function() {
|
|
1020
|
-
return
|
|
812
|
+
return selectDefinition;
|
|
1021
813
|
}
|
|
1022
814
|
});
|