@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
|
@@ -1,63 +1,603 @@
|
|
|
1
|
-
import { d as createRegisterFunction,
|
|
2
|
-
import { t as iconDefinition } from "./definition.js";
|
|
1
|
+
import { d as createRegisterFunction, t as VividElement, u as defineVividComponent } from "./vivid-element.js";
|
|
3
2
|
import { t as __decorate } from "./decorate.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//#region src/
|
|
3
|
+
import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js";
|
|
4
|
+
import { n as isListboxOption } from "./option.js";
|
|
5
|
+
import { n as isOptgroup } from "./optgroup.js";
|
|
6
|
+
import { t as extractOptions } from "./extractOptions.js";
|
|
7
|
+
import { attr, html, observable, slotted, when } from "@microsoft/fast-element";
|
|
8
|
+
import { keySpace, uniqueId } from "@microsoft/fast-web-utilities";
|
|
9
|
+
import scrollIntoView from "scroll-into-view-if-needed";
|
|
10
|
+
//#region src/shared/listbox/with-options-filter.ts
|
|
11
|
+
function applyFilter(allOptions, allElements, optionFilter, searchText) {
|
|
12
|
+
const newFilteredOptions = [];
|
|
13
|
+
for (const option of allOptions) {
|
|
14
|
+
option._vvdSearchText = searchText;
|
|
15
|
+
const matches = !searchText || optionFilter(option, searchText);
|
|
16
|
+
option._isNotMatching = !matches;
|
|
17
|
+
if (!option.hidden && !option.disabled && matches) newFilteredOptions.push(option);
|
|
18
|
+
}
|
|
19
|
+
for (const el of allElements) if (isOptgroup(el)) {
|
|
20
|
+
const hasVisibleOption = Array.from(el.children).some((child) => isListboxOption(child) && !child._isNotMatching && !child.hidden);
|
|
21
|
+
el.style.display = hasVisibleOption ? "" : "none";
|
|
22
|
+
}
|
|
23
|
+
return newFilteredOptions;
|
|
24
|
+
}
|
|
25
|
+
var WithOptionsFilter = (Base) => {
|
|
26
|
+
class WithOptionsElement extends Base {
|
|
27
|
+
constructor(..._args) {
|
|
28
|
+
super(..._args);
|
|
29
|
+
this.searchText = "";
|
|
30
|
+
this._filteredOptions = [];
|
|
31
|
+
}
|
|
32
|
+
/** @internal */
|
|
33
|
+
_slottedOptionsChanged() {
|
|
34
|
+
super._slottedOptionsChanged();
|
|
35
|
+
this._updateFilter();
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
searchTextChanged() {
|
|
39
|
+
this._updateFilter();
|
|
40
|
+
}
|
|
41
|
+
/** @internal */
|
|
42
|
+
optionFilterChanged() {
|
|
43
|
+
this._updateFilter();
|
|
44
|
+
}
|
|
45
|
+
/** @internal */
|
|
46
|
+
_updateFilter() {
|
|
47
|
+
this._filteredOptions = applyFilter(this._slottedOptions, this._slottedElements, this.optionFilter ?? ((option, searchText) => option.text.toLowerCase().includes(searchText.toLowerCase())), this.searchText);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
__decorate([attr({
|
|
51
|
+
attribute: "search-text",
|
|
52
|
+
mode: "fromView"
|
|
53
|
+
})], WithOptionsElement.prototype, "searchText", void 0);
|
|
54
|
+
__decorate([observable], WithOptionsElement.prototype, "optionFilter", void 0);
|
|
55
|
+
__decorate([observable], WithOptionsElement.prototype, "_filteredOptions", void 0);
|
|
56
|
+
return WithOptionsElement;
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/shared/listbox/with-options.ts
|
|
60
|
+
/** A mixin for elements that accept slotted options */
|
|
61
|
+
var WithOptions = (Base) => {
|
|
62
|
+
class WithOptionsElement extends Base {
|
|
63
|
+
constructor(..._args) {
|
|
64
|
+
super(..._args);
|
|
65
|
+
this._slottedElements = [];
|
|
66
|
+
this.#onOptgroupChange = () => {
|
|
67
|
+
this._slottedElementsChanged();
|
|
68
|
+
};
|
|
69
|
+
this._slottedOptions = [];
|
|
70
|
+
}
|
|
71
|
+
/** @internal */
|
|
72
|
+
_slottedElementsChanged() {
|
|
73
|
+
this._slottedOptions = extractOptions(this._slottedElements);
|
|
74
|
+
}
|
|
75
|
+
#onOptgroupChange;
|
|
76
|
+
connectedCallback() {
|
|
77
|
+
super.connectedCallback();
|
|
78
|
+
this.addEventListener("optgroup-change", this.#onOptgroupChange);
|
|
79
|
+
}
|
|
80
|
+
disconnectedCallback() {
|
|
81
|
+
super.disconnectedCallback();
|
|
82
|
+
this.removeEventListener("optgroup-change", this.#onOptgroupChange);
|
|
83
|
+
}
|
|
84
|
+
/** @internal */
|
|
85
|
+
_slottedOptionsChanged() {
|
|
86
|
+
for (const option of this._slottedOptions) if (!option.id) option.id = uniqueId("option-");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
__decorate([observable], WithOptionsElement.prototype, "_slottedElements", void 0);
|
|
90
|
+
__decorate([observable], WithOptionsElement.prototype, "_slottedOptions", void 0);
|
|
91
|
+
return WithOptionsElement;
|
|
92
|
+
};
|
|
93
|
+
var optionsTemplate = html`<slot
|
|
94
|
+
${slotted({
|
|
95
|
+
filter: ((n) => isListboxOption(n) || isOptgroup(n)),
|
|
96
|
+
flatten: true,
|
|
97
|
+
property: "_slottedElements"
|
|
98
|
+
})}
|
|
99
|
+
>
|
|
100
|
+
</slot>`;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/shared/listbox/selection.ts
|
|
103
|
+
var modifierKeys = (e) => {
|
|
104
|
+
const modKey = e.ctrlKey || e.metaKey;
|
|
105
|
+
return e.shiftKey && modKey ? "ShiftMod" : e.shiftKey ? "Shift" : modKey ? "Mod" : null;
|
|
106
|
+
};
|
|
107
|
+
var selectionForMove = (state, ctx, move, mods) => {
|
|
108
|
+
if (move.amount === "step" && mods === "Mod") return null;
|
|
109
|
+
if (ctx.selectionMode === "multiple") {
|
|
110
|
+
if (move.amount === "step" && mods === "Shift") return {
|
|
111
|
+
action: {
|
|
112
|
+
type: "extend-from-anchor",
|
|
113
|
+
anchorIndex: state.rangeAnchorIndex ?? state.activeIndex
|
|
114
|
+
},
|
|
115
|
+
replaceExisting: false
|
|
116
|
+
};
|
|
117
|
+
if (move.amount === "limit" && mods === "ShiftMod") return {
|
|
118
|
+
action: { type: "select-from-current" },
|
|
119
|
+
replaceExisting: false
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (ctx.selectionBehavior === "replace") return {
|
|
123
|
+
action: { type: "select" },
|
|
124
|
+
replaceExisting: true
|
|
125
|
+
};
|
|
126
|
+
return null;
|
|
127
|
+
};
|
|
128
|
+
/** How the selection should change when an option is triggered (by pressing Space or clicking) */
|
|
129
|
+
var selectionForTrigger = (ctx, mods) => {
|
|
130
|
+
if (mods === "Shift") return {
|
|
131
|
+
action: { type: "select-from-most-recent" },
|
|
132
|
+
replaceExisting: ctx.selectionBehavior === "replace"
|
|
133
|
+
};
|
|
134
|
+
if (mods === "Mod") return {
|
|
135
|
+
action: { type: "toggle" },
|
|
136
|
+
replaceExisting: false
|
|
137
|
+
};
|
|
138
|
+
if (ctx.selectionBehavior === "replace") return {
|
|
139
|
+
action: { type: "select" },
|
|
140
|
+
replaceExisting: true
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
action: { type: "toggle" },
|
|
144
|
+
replaceExisting: false
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
function addRange(baseValues, ctx, fromIdx, toIdx) {
|
|
148
|
+
const baseSet = new Set(baseValues);
|
|
149
|
+
const [from, to] = [fromIdx, toIdx].sort((a, b) => a - b);
|
|
150
|
+
const newValues = [...baseValues];
|
|
151
|
+
for (let i = from; i <= to; i++) {
|
|
152
|
+
const v = ctx.selectable.optionValue(i);
|
|
153
|
+
if (!baseSet.has(v)) newValues.push(v);
|
|
154
|
+
}
|
|
155
|
+
return newValues;
|
|
156
|
+
}
|
|
157
|
+
function updateAnchoredRange(baseValues, ctx, anchorIdx, targetIdx, prevTargetIdx) {
|
|
158
|
+
const baseSet = new Set(baseValues);
|
|
159
|
+
const [from, , to] = [
|
|
160
|
+
anchorIdx,
|
|
161
|
+
targetIdx,
|
|
162
|
+
prevTargetIdx
|
|
163
|
+
].sort((a, b) => a - b);
|
|
164
|
+
let newValues = [...baseValues];
|
|
165
|
+
for (let i = from; i <= to; i++) {
|
|
166
|
+
const v = ctx.selectable.optionValue(i);
|
|
167
|
+
if (i < anchorIdx && i < targetIdx || i > anchorIdx && i > targetIdx) {
|
|
168
|
+
if (baseSet.has(v)) newValues = newValues.filter((val) => val !== v);
|
|
169
|
+
} else if (!baseSet.has(v)) newValues.push(v);
|
|
170
|
+
}
|
|
171
|
+
return newValues;
|
|
172
|
+
}
|
|
173
|
+
function mostRecentlySelectedIndex(state, ctx) {
|
|
174
|
+
const values = state.values;
|
|
175
|
+
for (let i = values.length - 1; i >= 0; i--) {
|
|
176
|
+
const index = ctx.selectable.optionIndex(values[i]);
|
|
177
|
+
if (index !== null) return index;
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
function applyAction(state, ctx, command) {
|
|
182
|
+
const newState = (v) => {
|
|
183
|
+
return {
|
|
184
|
+
...state,
|
|
185
|
+
values: v.values ?? state.values,
|
|
186
|
+
activeIndex: v.activeIndex ?? state.activeIndex,
|
|
187
|
+
rangeAnchorIndex: v.rangeAnchorIndex ?? null
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
if (command.type !== "action") return newState({});
|
|
191
|
+
const prevValues = state.values;
|
|
192
|
+
const { targetIndex, selection } = command;
|
|
193
|
+
const enforceRestrictions = (newValues) => {
|
|
194
|
+
if (ctx.selectionMode === "single" && newValues.length > 1) return [newValues[newValues.length - 1]];
|
|
195
|
+
if (ctx.requiredSelection !== "none") {
|
|
196
|
+
if (newValues.length === 0) return prevValues;
|
|
197
|
+
if (ctx.requiredSelection === "selectable") {
|
|
198
|
+
if (!newValues.some((v) => ctx.selectable.optionIndex(v) !== null)) return prevValues;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return newValues;
|
|
202
|
+
};
|
|
203
|
+
const targetValue = ctx.selectable.optionValue(targetIndex);
|
|
204
|
+
const baseValues = selection?.replaceExisting ? [] : prevValues;
|
|
205
|
+
switch (selection?.action.type) {
|
|
206
|
+
case void 0: return newState({ activeIndex: targetIndex });
|
|
207
|
+
case "select": return newState({
|
|
208
|
+
activeIndex: targetIndex,
|
|
209
|
+
values: enforceRestrictions(prevValues.includes(targetValue) ? prevValues : [...baseValues, targetValue])
|
|
210
|
+
});
|
|
211
|
+
case "toggle": return newState({
|
|
212
|
+
activeIndex: targetIndex,
|
|
213
|
+
values: enforceRestrictions(prevValues.includes(targetValue) ? baseValues.filter((v) => v !== targetValue) : [...baseValues, targetValue])
|
|
214
|
+
});
|
|
215
|
+
case "select-from-current": return newState({
|
|
216
|
+
activeIndex: targetIndex,
|
|
217
|
+
values: enforceRestrictions(addRange(baseValues, ctx, state.activeIndex, targetIndex))
|
|
218
|
+
});
|
|
219
|
+
case "select-from-most-recent": return newState({
|
|
220
|
+
activeIndex: targetIndex,
|
|
221
|
+
values: enforceRestrictions(addRange(baseValues, ctx, mostRecentlySelectedIndex(state, ctx) ?? 0, targetIndex))
|
|
222
|
+
});
|
|
223
|
+
case "extend-from-anchor": return newState({
|
|
224
|
+
values: enforceRestrictions(updateAnchoredRange(baseValues, ctx, selection.action.anchorIndex, targetIndex, state.activeIndex)),
|
|
225
|
+
activeIndex: targetIndex,
|
|
226
|
+
rangeAnchorIndex: selection.action.anchorIndex
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/shared/listbox/typeahead.ts
|
|
232
|
+
var TypeaheadTimeout = 2e3;
|
|
233
|
+
function typeaheadFromKey(state, _ctx, key, now) {
|
|
234
|
+
const typeahead = state.typeahead && state.typeahead.lastInputMs > now - TypeaheadTimeout ? state.typeahead : null;
|
|
235
|
+
return key.length === 1 && !(key === keySpace && !typeahead) ? {
|
|
236
|
+
buffer: (typeahead?.buffer ?? "") + key,
|
|
237
|
+
lastInputMs: now
|
|
238
|
+
} : null;
|
|
239
|
+
}
|
|
240
|
+
function applyTypeahead(state, ctx, command) {
|
|
241
|
+
if (command.type !== "typeahead") return {
|
|
242
|
+
...state,
|
|
243
|
+
typeahead: null
|
|
244
|
+
};
|
|
245
|
+
const typeahead = command.typeahead;
|
|
246
|
+
for (let candidateIdx = (state.activeIndex + 1) % ctx.selectable.numOptions; candidateIdx !== state.activeIndex; candidateIdx = (candidateIdx + 1) % ctx.selectable.numOptions) if (ctx.selectable.optionText(candidateIdx).toLowerCase().startsWith(typeahead.buffer.toLowerCase())) return {
|
|
247
|
+
...applyAction(state, ctx, {
|
|
248
|
+
type: "action",
|
|
249
|
+
targetIndex: candidateIdx,
|
|
250
|
+
selection: command.selection
|
|
251
|
+
}),
|
|
252
|
+
typeahead
|
|
253
|
+
};
|
|
254
|
+
return {
|
|
255
|
+
...state,
|
|
256
|
+
typeahead
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/shared/listbox/options.ts
|
|
261
|
+
var optionsInterface = (options) => ({
|
|
262
|
+
numOptions: options.length,
|
|
263
|
+
optionValue: (index) => options[index].value,
|
|
264
|
+
optionText: (index) => options[index].text,
|
|
265
|
+
optionIndex: (value) => {
|
|
266
|
+
const index = options.findIndex((o) => o.value === value);
|
|
267
|
+
return index === -1 ? null : index;
|
|
268
|
+
},
|
|
269
|
+
isEq: (newOptions) => options === newOptions
|
|
270
|
+
});
|
|
271
|
+
function initialValues(ctx, allOptions, providedValues) {
|
|
272
|
+
const selectedValues = allOptions.filter((option) => option.selected || providedValues.includes(option.value)).map((o) => o.value);
|
|
273
|
+
const maxSelected = ctx.selectionMode === "single" ? 1 : Infinity;
|
|
274
|
+
return ensureRequiredSelection(ctx, selectedValues.slice(0, maxSelected), maxSelected);
|
|
275
|
+
}
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/shared/listbox/state.ts
|
|
278
|
+
function isUIState(state) {
|
|
279
|
+
return "activeIndex" in state;
|
|
280
|
+
}
|
|
281
|
+
function applyContextChange(state, newCtx, requestedValues) {
|
|
282
|
+
const validValues = requestedValues.filter((v) => newCtx.all.optionIndex(v) !== null);
|
|
283
|
+
const maxSelected = newCtx.selectionMode === "single" ? 1 : Infinity;
|
|
284
|
+
let values = validValues.slice(0, maxSelected);
|
|
285
|
+
values = ensureRequiredSelection(newCtx, values, maxSelected);
|
|
286
|
+
return {
|
|
287
|
+
...state,
|
|
288
|
+
values
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Applies the `requiredSelection` restriction to a set of values, selecting a selectable option if needed.
|
|
293
|
+
* @internal
|
|
294
|
+
*/
|
|
295
|
+
function ensureRequiredSelection(ctx, values, maxSelected) {
|
|
296
|
+
if (ctx.requiredSelection === "none" || ctx.selectable.numOptions === 0) return values;
|
|
297
|
+
if (values.length === 0) return [ctx.selectable.optionValue(0)];
|
|
298
|
+
if (ctx.requiredSelection === "selectable") {
|
|
299
|
+
if (!values.some((v) => ctx.selectable.optionIndex(v) !== null)) return maxSelected === 1 ? [ctx.selectable.optionValue(0)] : [...values, ctx.selectable.optionValue(0)];
|
|
300
|
+
}
|
|
301
|
+
return values;
|
|
302
|
+
}
|
|
303
|
+
function initialState(ctx, providedOptions, providedValues) {
|
|
304
|
+
const values = initialValues(ctx, providedOptions, providedValues);
|
|
305
|
+
if (ctx.selectable.numOptions === 0) return valuesOnlyState(values);
|
|
306
|
+
let activeIndex = 0;
|
|
307
|
+
for (const candidate of values) {
|
|
308
|
+
const index = ctx.selectable.optionIndex(candidate);
|
|
309
|
+
if (index !== null) {
|
|
310
|
+
activeIndex = index;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
values,
|
|
316
|
+
activeIndex,
|
|
317
|
+
typeahead: null,
|
|
318
|
+
rangeAnchorIndex: null
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function valuesOnlyState(values) {
|
|
322
|
+
return { values };
|
|
323
|
+
}
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/shared/listbox/move.ts
|
|
326
|
+
function moveFromKey(key) {
|
|
327
|
+
switch (key) {
|
|
328
|
+
case "Home": return {
|
|
329
|
+
direction: "backward",
|
|
330
|
+
amount: "limit"
|
|
331
|
+
};
|
|
332
|
+
case "End": return {
|
|
333
|
+
direction: "forward",
|
|
334
|
+
amount: "limit"
|
|
335
|
+
};
|
|
336
|
+
case "PageUp": return {
|
|
337
|
+
direction: "backward",
|
|
338
|
+
amount: "page"
|
|
339
|
+
};
|
|
340
|
+
case "PageDown": return {
|
|
341
|
+
direction: "forward",
|
|
342
|
+
amount: "page"
|
|
343
|
+
};
|
|
344
|
+
case "ArrowUp": return {
|
|
345
|
+
direction: "backward",
|
|
346
|
+
amount: "step"
|
|
347
|
+
};
|
|
348
|
+
case "ArrowDown": return {
|
|
349
|
+
direction: "forward",
|
|
350
|
+
amount: "step"
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
function moveIndex(index, numItems, pageSize, move) {
|
|
356
|
+
const limits = {
|
|
357
|
+
backward: 0,
|
|
358
|
+
forward: numItems - 1
|
|
359
|
+
};
|
|
360
|
+
const dirs = {
|
|
361
|
+
backward: -1,
|
|
362
|
+
forward: 1
|
|
363
|
+
};
|
|
364
|
+
const amounts = {
|
|
365
|
+
step: 1,
|
|
366
|
+
page: pageSize
|
|
367
|
+
};
|
|
368
|
+
switch (move.amount) {
|
|
369
|
+
case "limit": return limits[move.direction];
|
|
370
|
+
case "page":
|
|
371
|
+
case "step": return Math.min(limits.forward, Math.max(limits.backward, index + dirs[move.direction] * amounts[move.amount]));
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/shared/listbox/commands.ts
|
|
376
|
+
var PageSize = 10;
|
|
377
|
+
function commandFromKey(state, ctx, e, now) {
|
|
378
|
+
if (!isUIState(state)) return null;
|
|
379
|
+
const typeahead = typeaheadFromKey(state, ctx, e.key, now);
|
|
380
|
+
if (typeahead) return {
|
|
381
|
+
type: "typeahead",
|
|
382
|
+
typeahead,
|
|
383
|
+
selection: ctx.selectionBehavior === "replace" ? {
|
|
384
|
+
action: { type: "select" },
|
|
385
|
+
replaceExisting: true
|
|
386
|
+
} : null
|
|
387
|
+
};
|
|
388
|
+
const move = moveFromKey(e.key);
|
|
389
|
+
if (move) return {
|
|
390
|
+
type: "action",
|
|
391
|
+
targetIndex: moveIndex(state.activeIndex, ctx.selectable.numOptions, PageSize, move),
|
|
392
|
+
selection: selectionForMove(state, ctx, move, modifierKeys(e))
|
|
393
|
+
};
|
|
394
|
+
if (e.key === " ") return {
|
|
395
|
+
type: "action",
|
|
396
|
+
targetIndex: state.activeIndex,
|
|
397
|
+
selection: selectionForTrigger(ctx, modifierKeys(e))
|
|
398
|
+
};
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
function commandFromClick(_state, ctx, e, targetIndex) {
|
|
402
|
+
return {
|
|
403
|
+
type: "action",
|
|
404
|
+
targetIndex,
|
|
405
|
+
selection: selectionForTrigger(ctx, modifierKeys(e))
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function apply(state, context, command) {
|
|
409
|
+
state = applyTypeahead(state, context, command);
|
|
410
|
+
state = applyAction(state, context, command);
|
|
411
|
+
return state;
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/lib/listbox/listbox.ts
|
|
415
|
+
var deepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
12
416
|
/**
|
|
13
|
-
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a | <a> element }.
|
|
14
|
-
*
|
|
15
417
|
* @public
|
|
16
|
-
* @component
|
|
17
|
-
* @slot
|
|
18
|
-
* @slot
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @testQuery !current navCurrent false
|
|
23
|
-
* @testRef control shadow .control
|
|
418
|
+
* @component listbox
|
|
419
|
+
* @slot - Holds the available options.
|
|
420
|
+
* @slot no-matches - Message that appears when no options match the search query.
|
|
421
|
+
* @event {CustomEvent<undefined>} change - Fired when the selected options change.
|
|
422
|
+
* @vueModel modelValue value change `event.currentTarget.value`
|
|
423
|
+
* @vueModel values values change `event.currentTarget.values`
|
|
24
424
|
*/
|
|
25
|
-
var
|
|
425
|
+
var Listbox = class extends WithOptionsFilter(WithOptions(HostSemantics(VividElement))) {
|
|
26
426
|
constructor(..._args) {
|
|
27
427
|
super(..._args);
|
|
28
|
-
this.
|
|
428
|
+
this.selectionMode = "single";
|
|
429
|
+
this.selectionBehavior = "toggle";
|
|
430
|
+
this.requiredSelection = "none";
|
|
431
|
+
this._activeDescendantId = null;
|
|
432
|
+
this.values = [];
|
|
433
|
+
this._state = valuesOnlyState([]);
|
|
434
|
+
this._ctx = {
|
|
435
|
+
selectionMode: "single",
|
|
436
|
+
selectionBehavior: "toggle",
|
|
437
|
+
requiredSelection: "none",
|
|
438
|
+
selectable: optionsInterface([]),
|
|
439
|
+
all: optionsInterface([])
|
|
440
|
+
};
|
|
441
|
+
this._externalChangeQueued = false;
|
|
442
|
+
}
|
|
443
|
+
/** @internal */
|
|
444
|
+
selectionModeChanged() {
|
|
445
|
+
this._registerExternalChange();
|
|
446
|
+
}
|
|
447
|
+
/** @internal */
|
|
448
|
+
selectionBehaviorChanged() {
|
|
449
|
+
this._registerExternalChange();
|
|
450
|
+
}
|
|
451
|
+
/** @internal */
|
|
452
|
+
requiredSelectionChanged() {
|
|
453
|
+
this._registerExternalChange();
|
|
454
|
+
}
|
|
455
|
+
/** @internal */
|
|
456
|
+
_filteredOptionsChanged() {
|
|
457
|
+
this._registerExternalChange();
|
|
458
|
+
}
|
|
459
|
+
/** @internal */
|
|
460
|
+
valuesChanged() {
|
|
461
|
+
if (this._state && !deepEqual(this._state.values, this.values)) this._registerExternalChange();
|
|
462
|
+
}
|
|
463
|
+
/** The first selected option value, or `null` if no option is selected. In single-selection mode, this can be used as an alternative to `values`. */
|
|
464
|
+
get value() {
|
|
465
|
+
return this.values[0] ?? null;
|
|
466
|
+
}
|
|
467
|
+
set value(value) {
|
|
468
|
+
this.values = value === null ? [] : [value];
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Use a microtask to batch multiple synchronous changes. Otherwise, we may update the state based on half-applied changes.
|
|
472
|
+
* @internal
|
|
473
|
+
*/
|
|
474
|
+
_registerExternalChange() {
|
|
475
|
+
if (!this._externalChangeQueued) {
|
|
476
|
+
this._externalChangeQueued = true;
|
|
477
|
+
queueMicrotask(() => this._applyPendingExternalChanges());
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* React to external changes of props or options
|
|
482
|
+
* @internal
|
|
483
|
+
*/
|
|
484
|
+
_applyPendingExternalChanges() {
|
|
485
|
+
this._externalChangeQueued = false;
|
|
486
|
+
if (!this._ctx.all.isEq(this._slottedOptions) || !this._ctx.selectable.isEq(this._filteredOptions)) {
|
|
487
|
+
this._initializeState();
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
const newCtx = {
|
|
491
|
+
...this._ctx,
|
|
492
|
+
selectionMode: this.selectionMode,
|
|
493
|
+
selectionBehavior: this.selectionBehavior,
|
|
494
|
+
requiredSelection: this.requiredSelection
|
|
495
|
+
};
|
|
496
|
+
this._ctx = newCtx;
|
|
497
|
+
this._applyNewState(applyContextChange(this._state, newCtx, this.values));
|
|
498
|
+
}
|
|
499
|
+
/** @internal */
|
|
500
|
+
_initializeState() {
|
|
501
|
+
this._ctx = {
|
|
502
|
+
selectionMode: this.selectionMode,
|
|
503
|
+
selectionBehavior: this.selectionBehavior,
|
|
504
|
+
requiredSelection: this.requiredSelection,
|
|
505
|
+
selectable: optionsInterface(this._filteredOptions),
|
|
506
|
+
all: optionsInterface(this._slottedOptions)
|
|
507
|
+
};
|
|
508
|
+
if (!this._slottedOptions?.length) {
|
|
509
|
+
this._state = valuesOnlyState([]);
|
|
510
|
+
this._activeDescendantId = null;
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
this._applyNewState(initialState(this._ctx, this._slottedOptions, this.values));
|
|
514
|
+
}
|
|
515
|
+
/** @internal */
|
|
516
|
+
_applyNewState(toState) {
|
|
517
|
+
if (isUIState(toState)) {
|
|
518
|
+
const activeOption = this._filteredOptions[toState.activeIndex];
|
|
519
|
+
this._activeDescendantId = activeOption.id;
|
|
520
|
+
scrollIntoView(activeOption, {
|
|
521
|
+
block: "nearest",
|
|
522
|
+
scrollMode: "if-needed"
|
|
523
|
+
});
|
|
524
|
+
} else this._activeDescendantId = null;
|
|
525
|
+
const valuesChanged = !deepEqual(this.values, toState.values);
|
|
526
|
+
this._state = toState;
|
|
527
|
+
this.values = [...toState.values];
|
|
528
|
+
this._updateSlottedOptions();
|
|
529
|
+
if (valuesChanged) this.$emit("change", void 0, {
|
|
530
|
+
bubbles: false,
|
|
531
|
+
composed: false
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
/** @internal */
|
|
535
|
+
_updateSlottedOptions() {
|
|
536
|
+
for (const option of this._slottedOptions) {
|
|
537
|
+
option.selected = this.values.includes(option.value);
|
|
538
|
+
option._highlighted = Boolean(this._activeDescendantId && option.id === this._activeDescendantId);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
/** @internal */
|
|
542
|
+
_onKeydown(e) {
|
|
543
|
+
const command = commandFromKey(this._state, this._ctx, e, Date.now());
|
|
544
|
+
if (command) {
|
|
545
|
+
this._applyNewState(apply(this._state, this._ctx, command));
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
/** @internal */
|
|
551
|
+
_onClick(e) {
|
|
552
|
+
const clickedOnOption = e.target.closest(`[data-vvd-component=option]`);
|
|
553
|
+
const targetIndex = clickedOnOption ? this._filteredOptions.indexOf(clickedOnOption) : -1;
|
|
554
|
+
if (targetIndex === -1) return true;
|
|
555
|
+
const state = this._state;
|
|
556
|
+
this._applyNewState(apply(state, this._ctx, commandFromClick(state, this._ctx, e, targetIndex)));
|
|
557
|
+
return false;
|
|
29
558
|
}
|
|
30
559
|
};
|
|
31
|
-
__decorate([attr
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
560
|
+
__decorate([attr({
|
|
561
|
+
attribute: "selection-mode",
|
|
562
|
+
mode: "fromView"
|
|
563
|
+
})], Listbox.prototype, "selectionMode", void 0);
|
|
564
|
+
__decorate([attr({
|
|
565
|
+
attribute: "selection-behavior",
|
|
566
|
+
mode: "fromView"
|
|
567
|
+
})], Listbox.prototype, "selectionBehavior", void 0);
|
|
568
|
+
__decorate([attr({
|
|
569
|
+
attribute: "required-selection",
|
|
570
|
+
mode: "fromView"
|
|
571
|
+
})], Listbox.prototype, "requiredSelection", void 0);
|
|
572
|
+
__decorate([observable], Listbox.prototype, "_activeDescendantId", void 0);
|
|
573
|
+
__decorate([observable], Listbox.prototype, "values", void 0);
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/lib/listbox/listbox.scss?inline
|
|
576
|
+
var listbox_default = ":host{outline:none;flex-direction:column;gap:2px;display:flex}:host(:not(:focus-visible)){--_suppressable-focus-shadow:none;--_suppressable-focus-outline:none;--_suppressable-focus-outline-offset:0}";
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region src/lib/listbox/listbox.template.ts
|
|
579
|
+
var listboxTemplate = (_context) => {
|
|
580
|
+
return html`<template
|
|
581
|
+
tabindex="0"
|
|
582
|
+
${applyHostSemantics({
|
|
583
|
+
role: "listbox",
|
|
584
|
+
ariaMultiSelectable: (x) => x.selectionMode === "multiple" ? "true" : void 0
|
|
585
|
+
})}
|
|
586
|
+
aria-activedescendant="${(x) => x._activeDescendantId}"
|
|
587
|
+
@click="${(x, c) => x._onClick(c.event)}"
|
|
588
|
+
@keydown="${(x, c) => x._onKeydown(c.event)}"
|
|
589
|
+
>${optionsTemplate}${when((x) => x.searchText !== "" && x._filteredOptions.length === 0, html`<slot name="no-matches"></slot>`)}</template
|
|
590
|
+
>`;
|
|
48
591
|
};
|
|
49
592
|
//#endregion
|
|
50
|
-
//#region src/lib/
|
|
593
|
+
//#region src/lib/listbox/definition.ts
|
|
51
594
|
/** @internal */
|
|
52
|
-
var
|
|
53
|
-
styles: nav_item_default,
|
|
54
|
-
shadowOptions: { delegatesFocus: true }
|
|
55
|
-
});
|
|
595
|
+
var listboxDefinition = defineVividComponent("listbox", Listbox, listboxTemplate, [], { styles: listbox_default });
|
|
56
596
|
/**
|
|
57
|
-
* Registers the
|
|
597
|
+
* Registers the listbox elements with the design system.
|
|
58
598
|
*
|
|
59
599
|
* @param prefix - the prefix to use for the component name
|
|
60
600
|
*/
|
|
61
|
-
var
|
|
601
|
+
var registerListbox = createRegisterFunction(listboxDefinition);
|
|
62
602
|
//#endregion
|
|
63
|
-
export {
|
|
603
|
+
export { registerListbox as n, Listbox as r, listboxDefinition as t };
|