@vonage/vivid 4.12.1 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +7489 -4858
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +70 -136
- package/index.d.ts +0 -1
- package/index.js +60 -62
- package/lib/accordion/accordion.d.ts +2 -2
- package/lib/accordion/accordion.template.d.ts +1 -2
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/accordion-item/accordion-item.template.d.ts +2 -3
- package/lib/accordion-item/definition.d.ts +1 -1
- package/lib/action-group/action-group.d.ts +2 -2
- package/lib/action-group/action-group.template.d.ts +1 -3
- package/lib/action-group/definition.d.ts +1 -1
- package/lib/alert/alert.d.ts +2 -2
- package/lib/alert/alert.template.d.ts +2 -3
- package/lib/alert/definition.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +2 -2
- package/lib/audio-player/audio-player.template.d.ts +2 -3
- package/lib/audio-player/definition.d.ts +1 -3
- package/lib/avatar/avatar.d.ts +2 -2
- package/lib/avatar/avatar.template.d.ts +2 -3
- package/lib/avatar/definition.d.ts +1 -1
- package/lib/badge/badge.d.ts +2 -2
- package/lib/badge/badge.template.d.ts +2 -3
- package/lib/badge/definition.d.ts +1 -3
- package/lib/banner/banner.d.ts +2 -2
- package/lib/banner/banner.template.d.ts +2 -3
- package/lib/banner/definition.d.ts +1 -1
- package/lib/breadcrumb/breadcrumb.d.ts +2 -2
- package/lib/breadcrumb/breadcrumb.template.d.ts +3 -4
- package/lib/breadcrumb/definition.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
- package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +2 -3
- package/lib/breadcrumb-item/definition.d.ts +1 -1
- package/lib/button/button.d.ts +2 -2
- package/lib/button/button.template.d.ts +2 -4
- package/lib/button/definition.d.ts +1 -1
- package/lib/calendar/calendar.d.ts +2 -2
- package/lib/calendar/calendar.template.d.ts +1 -3
- package/lib/calendar/definition.d.ts +1 -1
- package/lib/calendar-event/calendar-event.d.ts +2 -2
- package/lib/calendar-event/calendar-event.template.d.ts +1 -3
- package/lib/calendar-event/definition.d.ts +1 -1
- package/lib/card/card.d.ts +2 -2
- package/lib/card/card.template.d.ts +2 -3
- package/lib/card/definition.d.ts +1 -1
- package/lib/checkbox/checkbox.form-associated.d.ts +3 -2
- package/lib/checkbox/checkbox.template.d.ts +2 -3
- package/lib/checkbox/definition.d.ts +1 -1
- package/lib/combobox/combobox.d.ts +17 -2
- package/lib/combobox/combobox.options.d.ts +7 -0
- package/lib/combobox/combobox.template.d.ts +2 -3
- package/lib/combobox/definition.d.ts +1 -2
- package/lib/data-grid/data-grid-cell.d.ts +16 -13
- package/lib/data-grid/data-grid-cell.template.d.ts +2 -3
- package/lib/data-grid/data-grid-row.d.ts +19 -2
- package/lib/data-grid/data-grid-row.template.d.ts +2 -2
- package/lib/data-grid/data-grid.d.ts +45 -4
- package/lib/data-grid/data-grid.template.d.ts +2 -2
- package/lib/data-grid/definition.d.ts +1 -6
- package/lib/date-picker/definition.d.ts +1 -3
- package/lib/date-range-picker/definition.d.ts +1 -3
- package/lib/dial-pad/definition.d.ts +1 -3
- package/lib/dial-pad/dial-pad.d.ts +2 -2
- package/lib/dial-pad/dial-pad.template.d.ts +2 -3
- package/lib/dialog/definition.d.ts +1 -1
- package/lib/dialog/dialog.d.ts +2 -2
- package/lib/dialog/dialog.template.d.ts +2 -3
- package/lib/divider/definition.d.ts +1 -1
- package/lib/divider/divider.d.ts +2 -2
- package/lib/divider/divider.template.d.ts +1 -3
- package/lib/elevation/definition.d.ts +1 -1
- package/lib/elevation/elevation.d.ts +2 -2
- package/lib/elevation/elevation.template.d.ts +1 -3
- package/lib/empty-state/definition.d.ts +1 -3
- package/lib/empty-state/empty-state.d.ts +2 -2
- package/lib/empty-state/empty-state.template.d.ts +2 -3
- package/lib/fab/definition.d.ts +1 -3
- package/lib/fab/fab.template.d.ts +2 -3
- package/lib/file-picker/definition.d.ts +1 -3
- package/lib/file-picker/file-picker.d.ts +6 -0
- package/lib/file-picker/file-picker.form-associated.d.ts +3 -2
- package/lib/file-picker/file-picker.template.d.ts +2 -3
- package/lib/header/definition.d.ts +1 -3
- package/lib/header/header.d.ts +2 -2
- package/lib/header/header.template.d.ts +2 -3
- package/lib/icon/definition.d.ts +1 -3
- package/lib/icon/icon.d.ts +2 -2
- package/lib/icon/icon.template.d.ts +1 -3
- package/lib/layout/definition.d.ts +1 -3
- package/lib/layout/layout.d.ts +2 -2
- package/lib/layout/layout.template.d.ts +1 -3
- package/lib/listbox/definition.d.ts +1 -3
- package/lib/listbox/listbox.template.d.ts +1 -3
- package/lib/menu/definition.d.ts +1 -11
- package/lib/menu/menu.d.ts +16 -3
- package/lib/menu/menu.template.d.ts +3 -3
- package/lib/menu-item/definition.d.ts +1 -3
- package/lib/menu-item/menu-item.d.ts +10 -2
- package/lib/menu-item/menu-item.template.d.ts +2 -3
- package/lib/nav/definition.d.ts +1 -3
- package/lib/nav/nav.d.ts +2 -2
- package/lib/nav/nav.template.d.ts +1 -3
- package/lib/nav-disclosure/definition.d.ts +1 -3
- package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
- package/lib/nav-disclosure/nav-disclosure.template.d.ts +2 -3
- package/lib/nav-item/definition.d.ts +1 -3
- package/lib/nav-item/nav-item.template.d.ts +2 -3
- package/lib/note/definition.d.ts +1 -3
- package/lib/note/note.d.ts +2 -2
- package/lib/note/note.template.d.ts +2 -3
- package/lib/number-field/definition.d.ts +1 -4
- package/lib/number-field/number-field.form-associated.d.ts +3 -2
- package/lib/number-field/number-field.template.d.ts +2 -3
- package/lib/option/definition.d.ts +1 -3
- package/lib/option/option.d.ts +28 -7
- package/lib/option/option.template.d.ts +2 -3
- package/lib/pagination/definition.d.ts +1 -3
- package/lib/pagination/pagination.d.ts +2 -2
- package/lib/pagination/pagination.template.d.ts +2 -3
- package/lib/popup/definition.d.ts +1 -3
- package/lib/popup/popup.template.d.ts +2 -3
- package/lib/progress/definition.d.ts +1 -3
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress/progress.template.d.ts +1 -4
- package/lib/progress-ring/definition.d.ts +1 -3
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/progress-ring/progress-ring.template.d.ts +1 -3
- package/lib/radio/definition.d.ts +1 -3
- package/lib/radio/radio.form-associated.d.ts +3 -2
- package/lib/radio/radio.template.d.ts +1 -3
- package/lib/radio-group/definition.d.ts +1 -11
- package/lib/radio-group/radio-group.d.ts +2 -2
- package/lib/radio-group/radio-group.template.d.ts +2 -3
- package/lib/range-slider/definition.d.ts +1 -3
- package/lib/range-slider/range-slider.form-associated.d.ts +3 -2
- package/lib/range-slider/range-slider.template.d.ts +2 -3
- package/lib/searchable-select/definition.d.ts +1 -4
- package/lib/searchable-select/option-tag.template.d.ts +2 -3
- package/lib/searchable-select/searchable-select.form-associated.d.ts +3 -2
- package/lib/searchable-select/searchable-select.template.d.ts +2 -3
- package/lib/select/definition.d.ts +1 -3
- package/lib/select/select.d.ts +14 -4
- package/lib/select/select.form-associated.d.ts +11 -0
- package/lib/select/select.template.d.ts +2 -3
- package/lib/selectable-box/definition.d.ts +1 -3
- package/lib/selectable-box/selectable-box.d.ts +2 -2
- package/lib/selectable-box/selectable-box.template.d.ts +2 -3
- package/lib/side-drawer/definition.d.ts +1 -3
- package/lib/side-drawer/side-drawer.d.ts +2 -2
- package/lib/side-drawer/side-drawer.template.d.ts +1 -3
- package/lib/slider/definition.d.ts +1 -3
- package/lib/slider/slider.form-associated.d.ts +3 -2
- package/lib/slider/slider.template.d.ts +3 -4
- package/lib/split-button/definition.d.ts +1 -1
- package/lib/split-button/split-button.d.ts +2 -2
- package/lib/split-button/split-button.template.d.ts +2 -3
- package/lib/switch/definition.d.ts +1 -3
- package/lib/switch/switch.d.ts +5 -2
- package/lib/switch/switch.form-associated.d.ts +11 -0
- package/lib/switch/switch.template.d.ts +1 -3
- package/lib/tab/definition.d.ts +1 -3
- package/lib/tab/tab.d.ts +2 -2
- package/lib/tab/tab.template.d.ts +2 -2
- package/lib/tab-panel/definition.d.ts +1 -3
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tab-panel/tab-panel.template.d.ts +1 -1
- package/lib/tabs/definition.d.ts +1 -3
- package/lib/tabs/tabs.d.ts +6 -4
- package/lib/tabs/tabs.template.d.ts +1 -1
- package/lib/tag/definition.d.ts +1 -4
- package/lib/tag/tag.d.ts +2 -2
- package/lib/tag/tag.template.d.ts +2 -3
- package/lib/tag-group/definition.d.ts +1 -3
- package/lib/tag-group/tag-group.d.ts +2 -2
- package/lib/tag-group/tag-group.template.d.ts +1 -3
- package/lib/text-anchor/definition.d.ts +1 -3
- package/lib/text-anchor/text-anchor.d.ts +4 -3
- package/lib/text-anchor/text-anchor.template.d.ts +2 -3
- package/lib/text-area/definition.d.ts +1 -3
- package/lib/text-area/text-area.d.ts +25 -3
- package/lib/text-area/text-area.form-associated.d.ts +11 -0
- package/lib/text-area/text-area.template.d.ts +2 -3
- package/lib/text-field/definition.d.ts +1 -3
- package/lib/text-field/text-field.d.ts +28 -3
- package/lib/text-field/text-field.form-associated.d.ts +11 -0
- package/lib/text-field/text-field.template.d.ts +2 -3
- package/lib/time-picker/definition.d.ts +1 -3
- package/lib/time-picker/time-picker.form-associated.d.ts +3 -2
- package/lib/time-picker/time-picker.template.d.ts +2 -2
- package/lib/toggletip/definition.d.ts +1 -3
- package/lib/toggletip/toggletip.d.ts +2 -2
- package/lib/toggletip/toggletip.template.d.ts +2 -3
- package/lib/tooltip/definition.d.ts +1 -3
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tooltip/tooltip.template.d.ts +2 -3
- package/lib/tree-item/definition.d.ts +1 -3
- package/lib/tree-item/tree-item.d.ts +11 -2
- package/lib/tree-item/tree-item.template.d.ts +3 -3
- package/lib/tree-view/definition.d.ts +1 -3
- package/lib/tree-view/tree-view.d.ts +16 -2
- package/lib/tree-view/tree-view.template.d.ts +1 -1
- package/lib/video-player/definition.d.ts +1 -3
- package/lib/video-player/video-player.d.ts +2 -2
- package/lib/video-player/video-player.template.d.ts +1 -3
- package/listbox/index.cjs +37 -39
- package/listbox/index.js +37 -39
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.cjs +1 -1
- package/note/index.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/affix.cjs +10 -10
- package/shared/affix.js +2 -2
- package/shared/anchor.cjs +59 -0
- package/shared/anchor.js +57 -0
- package/shared/anchored.cjs +6 -6
- package/shared/anchored.js +2 -2
- package/shared/apply-mixins.cjs +15 -17
- package/shared/apply-mixins.js +15 -17
- package/shared/apply-mixins2.cjs +25 -0
- package/shared/apply-mixins2.js +23 -0
- package/shared/applyMixinsWithObservables.cjs +4 -4
- package/shared/applyMixinsWithObservables.js +2 -2
- package/shared/aria-global.cjs +86 -67
- package/shared/aria-global.js +86 -67
- package/shared/aria-global2.cjs +68 -86
- package/shared/aria-global2.js +68 -86
- package/shared/base-progress.cjs +70 -63
- package/shared/base-progress.js +69 -62
- package/shared/breadcrumb-item.cjs +7 -58
- package/shared/breadcrumb-item.js +4 -55
- package/shared/button.cjs +178 -0
- package/shared/button.js +176 -0
- package/shared/calendar-event.cjs +10 -9
- package/shared/calendar-event.js +3 -2
- package/shared/children.cjs +2 -2
- package/shared/children.js +1 -1
- package/shared/date-picker/date-picker-base.form-associated.d.ts +3 -2
- package/shared/date-picker/date-picker-base.template.d.ts +2 -3
- package/shared/defineVividComponent.cjs +2612 -0
- package/shared/defineVividComponent.js +2592 -0
- package/shared/definition.cjs +26 -24
- package/shared/definition.js +17 -14
- package/shared/definition10.cjs +15 -12
- package/shared/definition10.js +15 -11
- package/shared/definition11.cjs +53 -249
- package/shared/definition11.js +25 -219
- package/shared/definition12.cjs +18 -14
- package/shared/definition12.js +17 -12
- package/shared/definition13.cjs +20 -19
- package/shared/definition13.js +11 -9
- package/shared/definition14.cjs +36 -38
- package/shared/definition14.js +16 -17
- package/shared/definition15.cjs +28 -26
- package/shared/definition15.js +17 -14
- package/shared/definition16.cjs +478 -611
- package/shared/definition16.js +471 -603
- package/shared/definition17.cjs +934 -1113
- package/shared/definition17.js +913 -1091
- package/shared/definition18.cjs +16 -20
- package/shared/definition18.js +19 -22
- package/shared/definition19.cjs +26 -30
- package/shared/definition19.js +21 -24
- package/shared/definition2.cjs +20 -22
- package/shared/definition2.js +21 -22
- package/shared/definition20.cjs +53 -53
- package/shared/definition20.js +36 -35
- package/shared/definition21.cjs +43 -46
- package/shared/definition21.js +19 -21
- package/shared/definition22.cjs +16 -13
- package/shared/definition22.js +15 -11
- package/shared/definition23.cjs +22 -20
- package/shared/definition23.js +15 -12
- package/shared/definition24.cjs +20 -172
- package/shared/definition24.js +17 -168
- package/shared/definition25.cjs +48 -28
- package/shared/definition25.js +43 -22
- package/shared/definition26.cjs +17 -14
- package/shared/definition26.js +15 -11
- package/shared/definition27.cjs +265 -12
- package/shared/definition27.js +262 -10
- package/shared/definition28.cjs +19 -16
- package/shared/definition28.js +15 -11
- package/shared/definition29.cjs +478 -604
- package/shared/definition29.js +450 -578
- package/shared/definition3.cjs +21 -16
- package/shared/definition3.js +17 -11
- package/shared/definition30.cjs +100 -75
- package/shared/definition30.js +99 -73
- package/shared/definition31.cjs +24 -97
- package/shared/definition31.js +25 -97
- package/shared/definition32.cjs +10 -25
- package/shared/definition32.js +9 -23
- package/shared/definition33.cjs +53 -14
- package/shared/definition33.js +52 -12
- package/shared/definition34.cjs +641 -34
- package/shared/definition34.js +638 -30
- package/shared/definition35.cjs +205 -377
- package/shared/definition35.js +200 -373
- package/shared/definition36.cjs +204 -104
- package/shared/definition36.js +199 -97
- package/shared/definition37.cjs +79 -206
- package/shared/definition37.js +75 -202
- package/shared/definition38.cjs +50 -56
- package/shared/definition38.js +48 -52
- package/shared/definition39.cjs +260 -56
- package/shared/definition39.js +259 -54
- package/shared/definition4.cjs +33 -35
- package/shared/definition4.js +20 -21
- package/shared/definition40.cjs +112 -229
- package/shared/definition40.js +109 -226
- package/shared/definition41.cjs +627 -36
- package/shared/definition41.js +626 -34
- package/shared/definition42.cjs +975 -487
- package/shared/definition42.js +972 -482
- package/shared/definition43.cjs +725 -932
- package/shared/definition43.js +713 -918
- package/shared/definition44.cjs +116 -734
- package/shared/definition44.js +114 -731
- package/shared/definition45.cjs +93 -116
- package/shared/definition45.js +93 -115
- package/shared/definition46.cjs +469 -89
- package/shared/definition46.js +466 -86
- package/shared/definition47.cjs +119 -479
- package/shared/definition47.js +116 -474
- package/shared/definition48.cjs +114 -120
- package/shared/definition48.js +112 -117
- package/shared/definition49.cjs +18 -160
- package/shared/definition49.js +16 -157
- package/shared/definition5.cjs +48 -49
- package/shared/definition5.js +19 -19
- package/shared/definition50.cjs +112 -15
- package/shared/definition50.js +110 -12
- package/shared/definition51.cjs +847 -84
- package/shared/definition51.js +843 -79
- package/shared/definition52.cjs +31 -859
- package/shared/definition52.js +29 -856
- package/shared/definition53.cjs +126 -28
- package/shared/definition53.js +124 -25
- package/shared/definition54.cjs +268 -107
- package/shared/definition54.js +262 -100
- package/shared/definition55.cjs +63 -298
- package/shared/definition55.js +61 -295
- package/shared/definition56.cjs +799 -311
- package/shared/definition56.js +795 -306
- package/shared/definition57.cjs +108 -825
- package/shared/definition57.js +106 -822
- package/shared/definition58.cjs +74 -100
- package/shared/definition58.js +70 -95
- package/shared/definition59.cjs +181 -106
- package/shared/definition59.js +175 -101
- package/shared/definition6.cjs +23 -21
- package/shared/definition6.js +15 -12
- package/shared/definition60.cjs +273 -70
- package/shared/definition60.js +273 -69
- package/shared/definition61.cjs +66157 -271
- package/shared/definition61.js +66156 -269
- package/shared/definition62.cjs +36 -66174
- package/shared/definition62.js +33 -66171
- package/shared/definition63.cjs +2154 -27
- package/shared/definition63.js +2151 -25
- package/shared/definition7.cjs +19 -15
- package/shared/definition7.js +14 -10
- package/shared/definition8.cjs +26 -27
- package/shared/definition8.js +17 -17
- package/shared/definition9.cjs +21 -21
- package/shared/definition9.js +18 -17
- package/shared/design-system/createRegisterFunction.d.ts +2 -0
- package/shared/design-system/defineVividComponent.d.ts +15 -0
- package/shared/direction.cjs +10 -1
- package/shared/direction.js +10 -1
- package/shared/dom.cjs +0 -13
- package/shared/dom.js +1 -13
- package/shared/form-associated.cjs +422 -457
- package/shared/form-associated.js +422 -457
- package/shared/form-associated2.cjs +383 -0
- package/shared/form-associated2.js +381 -0
- package/shared/form-elements.cjs +15 -42
- package/shared/form-elements.js +2 -29
- package/shared/foundation/anchor/anchor.d.ts +1 -0
- package/shared/foundation/button/button.d.ts +3 -2
- package/shared/foundation/button/button.template.d.ts +2 -4
- package/shared/foundation/form-associated/form-associated.d.ts +51 -0
- package/shared/foundation/listbox/listbox.d.ts +22 -0
- package/shared/foundation/progress/base-progress.d.ts +9 -0
- package/shared/foundation/utilities/apply-mixins.d.ts +1 -0
- package/shared/foundation/vivid-element/vivid-element.d.ts +3 -0
- package/shared/foundation-element.cjs +1417 -0
- package/shared/foundation-element.js +1414 -0
- package/shared/index.cjs +7 -5097
- package/shared/index.js +7 -5079
- package/shared/key-codes.cjs +10 -0
- package/shared/key-codes.js +6 -1
- package/shared/key-codes2.cjs +50 -6
- package/shared/key-codes2.js +50 -4
- package/shared/listbox.cjs +409 -981
- package/shared/listbox.js +410 -979
- package/shared/listbox2.cjs +1268 -0
- package/shared/listbox2.js +1265 -0
- package/shared/localized.cjs +2 -2
- package/shared/localized.js +1 -1
- package/shared/numbers.cjs +12 -0
- package/shared/numbers.js +12 -1
- package/shared/patterns/affix.d.ts +2 -2
- package/shared/patterns/chevron.d.ts +2 -2
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/presentationDate.cjs +56 -55
- package/shared/presentationDate.js +8 -7
- package/shared/ref.cjs +2 -2
- package/shared/ref.js +1 -1
- package/shared/repeat.cjs +22 -22
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +5 -5
- package/shared/slider.template.js +2 -2
- package/shared/slotted.cjs +4 -4
- package/shared/slotted.js +1 -1
- package/shared/strings.cjs +0 -26
- package/shared/strings.js +1 -25
- package/shared/strings2.cjs +37 -0
- package/shared/strings2.js +33 -0
- package/shared/text-anchor.cjs +8 -89
- package/shared/text-anchor.js +5 -86
- package/shared/text-anchor.template.cjs +2 -2
- package/shared/text-anchor.template.js +1 -1
- package/shared/text-field2.cjs +539 -194
- package/shared/text-field2.js +539 -194
- package/shared/vivid-element.cjs +8 -0
- package/shared/vivid-element.js +6 -0
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +21 -1
- package/styles/core/theme.css +21 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.cjs +10 -7
- package/text-anchor/index.js +10 -7
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +2848 -7818
- package/shared/Reflector.cjs +0 -71
- package/shared/Reflector.js +0 -69
- package/shared/definition64.cjs +0 -2164
- package/shared/definition64.js +0 -2159
- package/shared/design-system/index.d.ts +0 -3
- package/shared/icon.cjs +0 -261
- package/shared/icon.js +0 -258
- package/shared/index2.cjs +0 -11
- package/shared/index2.js +0 -9
- package/shared/listbox-option.cjs +0 -204
- package/shared/listbox-option.js +0 -201
- package/shared/radio.cjs +0 -126
- package/shared/radio.js +0 -124
- package/shared/select.options.cjs +0 -12
- package/shared/select.options.js +0 -10
- package/shared/start-end.cjs +0 -52
- package/shared/start-end.js +0 -50
- package/shared/tree-item.cjs +0 -154
- package/shared/tree-item.js +0 -151
package/shared/definition29.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { P as Popup, p as popupDefinition } from './definition63.js';
|
|
2
|
+
import { I as Icon, i as iconDefinition } from './definition27.js';
|
|
3
|
+
import { D as DOM, o as observable, a as attr, h as html, d as defineVividComponent, f as createRegisterFunction } from './defineVividComponent.js';
|
|
4
|
+
import { g as keyHome, d as keyEnd, e as keyArrowUp, f as keyArrowDown, h as keyArrowLeft, i as keyArrowRight, a as keySpace, k as keyEnter } from './key-codes.js';
|
|
4
5
|
import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { V as VividElement } from './vivid-element.js';
|
|
7
|
+
import { a as applyMixins } from './apply-mixins2.js';
|
|
7
8
|
import { D as Direction, g as getDirection } from './direction.js';
|
|
8
|
-
import {
|
|
9
|
-
import { I as Icon } from './icon.js';
|
|
10
|
-
import { b as anchored } from './anchored.js';
|
|
9
|
+
import { a as anchored, b as anchorSlotTemplateFactory } from './anchored.js';
|
|
11
10
|
import { i as isHTMLElement } from './dom.js';
|
|
11
|
+
import { h as handleEscapeKeyAndStopPropogation } from './index.js';
|
|
12
|
+
import { r as ref } from './ref.js';
|
|
12
13
|
import { s as slotted, e as elements } from './slotted.js';
|
|
13
|
-
import { w as when } from './when.js';
|
|
14
14
|
import { c as classNames } from './class-names.js';
|
|
15
|
+
import { w as when } from './when.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Menu items roles.
|
|
@@ -40,536 +41,7 @@ const roleForMenuItem = {
|
|
|
40
41
|
[MenuItemRole$1.menuitemradio]: "menuitemradio",
|
|
41
42
|
};
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
* A Switch Custom HTML Element.
|
|
45
|
-
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
|
|
46
|
-
*
|
|
47
|
-
* @slot checked-indicator - The checked indicator
|
|
48
|
-
* @slot radio-indicator - The radio indicator
|
|
49
|
-
* @slot start - Content which can be provided before the menu item content
|
|
50
|
-
* @slot end - Content which can be provided after the menu item content
|
|
51
|
-
* @slot - The default slot for menu item content
|
|
52
|
-
* @slot expand-collapse-indicator - The expand/collapse indicator
|
|
53
|
-
* @slot submenu - Used to nest menu's within menu items
|
|
54
|
-
* @csspart input-container - The element representing the visual checked or radio indicator
|
|
55
|
-
* @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
|
|
56
|
-
* @csspart radio - The element wrapping the `menuitemradio` indicator
|
|
57
|
-
* @csspart content - The element wrapping the menu item content
|
|
58
|
-
* @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
|
|
59
|
-
* @csspart expand-collapse - The expand/collapse element
|
|
60
|
-
* @csspart submenu-region - The container for the submenu, used for positioning
|
|
61
|
-
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
62
|
-
* @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
let MenuItem$1 = class MenuItem extends FoundationElement {
|
|
67
|
-
constructor() {
|
|
68
|
-
super(...arguments);
|
|
69
|
-
/**
|
|
70
|
-
* The role of the element.
|
|
71
|
-
*
|
|
72
|
-
* @public
|
|
73
|
-
* @remarks
|
|
74
|
-
* HTML Attribute: role
|
|
75
|
-
*/
|
|
76
|
-
this.role = MenuItemRole$1.menuitem;
|
|
77
|
-
/**
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
this.hasSubmenu = false;
|
|
81
|
-
/**
|
|
82
|
-
* Track current direction to pass to the anchored region
|
|
83
|
-
*
|
|
84
|
-
* @internal
|
|
85
|
-
*/
|
|
86
|
-
this.currentDirection = Direction.ltr;
|
|
87
|
-
this.focusSubmenuOnLoad = false;
|
|
88
|
-
/**
|
|
89
|
-
* @internal
|
|
90
|
-
*/
|
|
91
|
-
this.handleMenuItemKeyDown = (e) => {
|
|
92
|
-
if (e.defaultPrevented) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
switch (e.key) {
|
|
96
|
-
case keyEnter:
|
|
97
|
-
case keySpace:
|
|
98
|
-
this.invoke();
|
|
99
|
-
return false;
|
|
100
|
-
case keyArrowRight:
|
|
101
|
-
//open/focus on submenu
|
|
102
|
-
this.expandAndFocus();
|
|
103
|
-
return false;
|
|
104
|
-
case keyArrowLeft:
|
|
105
|
-
//close submenu
|
|
106
|
-
if (this.expanded) {
|
|
107
|
-
this.expanded = false;
|
|
108
|
-
this.focus();
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return true;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* @internal
|
|
116
|
-
*/
|
|
117
|
-
this.handleMenuItemClick = (e) => {
|
|
118
|
-
if (e.defaultPrevented || this.disabled) {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
this.invoke();
|
|
122
|
-
return false;
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* @internal
|
|
126
|
-
*/
|
|
127
|
-
this.submenuLoaded = () => {
|
|
128
|
-
if (!this.focusSubmenuOnLoad) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
this.focusSubmenuOnLoad = false;
|
|
132
|
-
if (this.hasSubmenu) {
|
|
133
|
-
this.submenu.focus();
|
|
134
|
-
this.setAttribute("tabindex", "-1");
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
this.handleMouseOver = (e) => {
|
|
141
|
-
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
this.expanded = true;
|
|
145
|
-
return false;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* @internal
|
|
149
|
-
*/
|
|
150
|
-
this.handleMouseOut = (e) => {
|
|
151
|
-
if (!this.expanded || this.contains(document.activeElement)) {
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
this.expanded = false;
|
|
155
|
-
return false;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* @internal
|
|
159
|
-
*/
|
|
160
|
-
this.expandAndFocus = () => {
|
|
161
|
-
if (!this.hasSubmenu) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
this.focusSubmenuOnLoad = true;
|
|
165
|
-
this.expanded = true;
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* @internal
|
|
169
|
-
*/
|
|
170
|
-
this.invoke = () => {
|
|
171
|
-
if (this.disabled) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
switch (this.role) {
|
|
175
|
-
case MenuItemRole$1.menuitemcheckbox:
|
|
176
|
-
this.checked = !this.checked;
|
|
177
|
-
break;
|
|
178
|
-
case MenuItemRole$1.menuitem:
|
|
179
|
-
// update submenu
|
|
180
|
-
this.updateSubmenu();
|
|
181
|
-
if (this.hasSubmenu) {
|
|
182
|
-
this.expandAndFocus();
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
this.$emit("change");
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
case MenuItemRole$1.menuitemradio:
|
|
189
|
-
if (!this.checked) {
|
|
190
|
-
this.checked = true;
|
|
191
|
-
}
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* Gets the submenu element if any
|
|
197
|
-
*
|
|
198
|
-
* @internal
|
|
199
|
-
*/
|
|
200
|
-
this.updateSubmenu = () => {
|
|
201
|
-
this.submenu = this.domChildren().find((element) => {
|
|
202
|
-
return element.getAttribute("role") === "menu";
|
|
203
|
-
});
|
|
204
|
-
this.hasSubmenu = this.submenu === undefined ? false : true;
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
expandedChanged(oldValue) {
|
|
208
|
-
if (this.$fastController.isConnected) {
|
|
209
|
-
if (this.submenu === undefined) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (this.expanded === false) {
|
|
213
|
-
this.submenu.collapseExpandedItem();
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
this.currentDirection = getDirection(this);
|
|
217
|
-
}
|
|
218
|
-
this.$emit("expanded-change", this, { bubbles: false });
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
checkedChanged(oldValue, newValue) {
|
|
222
|
-
if (this.$fastController.isConnected) {
|
|
223
|
-
this.$emit("change");
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* @internal
|
|
228
|
-
*/
|
|
229
|
-
connectedCallback() {
|
|
230
|
-
super.connectedCallback();
|
|
231
|
-
DOM.queueUpdate(() => {
|
|
232
|
-
this.updateSubmenu();
|
|
233
|
-
});
|
|
234
|
-
if (!this.startColumnCount) {
|
|
235
|
-
this.startColumnCount = 1;
|
|
236
|
-
}
|
|
237
|
-
this.observer = new MutationObserver(this.updateSubmenu);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* @internal
|
|
241
|
-
*/
|
|
242
|
-
disconnectedCallback() {
|
|
243
|
-
super.disconnectedCallback();
|
|
244
|
-
this.submenu = undefined;
|
|
245
|
-
if (this.observer !== undefined) {
|
|
246
|
-
this.observer.disconnect();
|
|
247
|
-
this.observer = undefined;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* get an array of valid DOM children
|
|
252
|
-
*/
|
|
253
|
-
domChildren() {
|
|
254
|
-
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
__decorate([
|
|
258
|
-
attr({ mode: "boolean" })
|
|
259
|
-
], MenuItem$1.prototype, "disabled", void 0);
|
|
260
|
-
__decorate([
|
|
261
|
-
attr({ mode: "boolean" })
|
|
262
|
-
], MenuItem$1.prototype, "expanded", void 0);
|
|
263
|
-
__decorate([
|
|
264
|
-
observable
|
|
265
|
-
], MenuItem$1.prototype, "startColumnCount", void 0);
|
|
266
|
-
__decorate([
|
|
267
|
-
attr
|
|
268
|
-
], MenuItem$1.prototype, "role", void 0);
|
|
269
|
-
__decorate([
|
|
270
|
-
attr({ mode: "boolean" })
|
|
271
|
-
], MenuItem$1.prototype, "checked", void 0);
|
|
272
|
-
__decorate([
|
|
273
|
-
observable
|
|
274
|
-
], MenuItem$1.prototype, "submenuRegion", void 0);
|
|
275
|
-
__decorate([
|
|
276
|
-
observable
|
|
277
|
-
], MenuItem$1.prototype, "hasSubmenu", void 0);
|
|
278
|
-
__decorate([
|
|
279
|
-
observable
|
|
280
|
-
], MenuItem$1.prototype, "currentDirection", void 0);
|
|
281
|
-
__decorate([
|
|
282
|
-
observable
|
|
283
|
-
], MenuItem$1.prototype, "submenu", void 0);
|
|
284
|
-
applyMixins(MenuItem$1, StartEnd);
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* A Menu Custom HTML Element.
|
|
288
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#menu | ARIA menu }.
|
|
289
|
-
*
|
|
290
|
-
* @slot - The default slot for the menu items
|
|
291
|
-
*
|
|
292
|
-
* @public
|
|
293
|
-
*/
|
|
294
|
-
let Menu$1 = class Menu extends FoundationElement {
|
|
295
|
-
constructor() {
|
|
296
|
-
super(...arguments);
|
|
297
|
-
this.expandedItem = null;
|
|
298
|
-
/**
|
|
299
|
-
* The index of the focusable element in the items array
|
|
300
|
-
* defaults to -1
|
|
301
|
-
*/
|
|
302
|
-
this.focusIndex = -1;
|
|
303
|
-
/**
|
|
304
|
-
* @internal
|
|
305
|
-
*/
|
|
306
|
-
this.isNestedMenu = () => {
|
|
307
|
-
return (this.parentElement !== null &&
|
|
308
|
-
isHTMLElement(this.parentElement) &&
|
|
309
|
-
this.parentElement.getAttribute("role") === "menuitem");
|
|
310
|
-
};
|
|
311
|
-
/**
|
|
312
|
-
* if focus is moving out of the menu, reset to a stable initial state
|
|
313
|
-
* @internal
|
|
314
|
-
*/
|
|
315
|
-
this.handleFocusOut = (e) => {
|
|
316
|
-
if (!this.contains(e.relatedTarget) && this.menuItems !== undefined) {
|
|
317
|
-
this.collapseExpandedItem();
|
|
318
|
-
// find our first focusable element
|
|
319
|
-
const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
|
|
320
|
-
// set the current focus index's tabindex to -1
|
|
321
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
322
|
-
// set the first focusable element tabindex to 0
|
|
323
|
-
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
324
|
-
// set the focus index
|
|
325
|
-
this.focusIndex = focusIndex;
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
this.handleItemFocus = (e) => {
|
|
329
|
-
const targetItem = e.target;
|
|
330
|
-
if (this.menuItems !== undefined &&
|
|
331
|
-
targetItem !== this.menuItems[this.focusIndex]) {
|
|
332
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
333
|
-
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
334
|
-
targetItem.setAttribute("tabindex", "0");
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
this.handleExpandedChanged = (e) => {
|
|
338
|
-
if (e.defaultPrevented ||
|
|
339
|
-
e.target === null ||
|
|
340
|
-
this.menuItems === undefined ||
|
|
341
|
-
this.menuItems.indexOf(e.target) < 0) {
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
e.preventDefault();
|
|
345
|
-
const changedItem = e.target;
|
|
346
|
-
// closing an expanded item without opening another
|
|
347
|
-
if (this.expandedItem !== null &&
|
|
348
|
-
changedItem === this.expandedItem &&
|
|
349
|
-
changedItem.expanded === false) {
|
|
350
|
-
this.expandedItem = null;
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
if (changedItem.expanded) {
|
|
354
|
-
if (this.expandedItem !== null && this.expandedItem !== changedItem) {
|
|
355
|
-
this.expandedItem.expanded = false;
|
|
356
|
-
}
|
|
357
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
358
|
-
this.expandedItem = changedItem;
|
|
359
|
-
this.focusIndex = this.menuItems.indexOf(changedItem);
|
|
360
|
-
changedItem.setAttribute("tabindex", "0");
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
this.removeItemListeners = () => {
|
|
364
|
-
if (this.menuItems !== undefined) {
|
|
365
|
-
this.menuItems.forEach((item) => {
|
|
366
|
-
item.removeEventListener("expanded-change", this.handleExpandedChanged);
|
|
367
|
-
item.removeEventListener("focus", this.handleItemFocus);
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
this.setItems = () => {
|
|
372
|
-
const newItems = this.domChildren();
|
|
373
|
-
this.removeItemListeners();
|
|
374
|
-
this.menuItems = newItems;
|
|
375
|
-
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
376
|
-
// if our focus index is not -1 we have items
|
|
377
|
-
if (menuItems.length) {
|
|
378
|
-
this.focusIndex = 0;
|
|
379
|
-
}
|
|
380
|
-
function elementIndent(el) {
|
|
381
|
-
const role = el.getAttribute("role");
|
|
382
|
-
const startSlot = el.querySelector("[slot=start]");
|
|
383
|
-
if (role !== MenuItemRole$1.menuitem && startSlot === null) {
|
|
384
|
-
return 1;
|
|
385
|
-
}
|
|
386
|
-
else if (role === MenuItemRole$1.menuitem && startSlot !== null) {
|
|
387
|
-
return 1;
|
|
388
|
-
}
|
|
389
|
-
else if (role !== MenuItemRole$1.menuitem && startSlot !== null) {
|
|
390
|
-
return 2;
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
return 0;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
const indent = menuItems.reduce((accum, current) => {
|
|
397
|
-
const elementValue = elementIndent(current);
|
|
398
|
-
return accum > elementValue ? accum : elementValue;
|
|
399
|
-
}, 0);
|
|
400
|
-
menuItems.forEach((item, index) => {
|
|
401
|
-
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
402
|
-
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
403
|
-
item.addEventListener("focus", this.handleItemFocus);
|
|
404
|
-
if (item instanceof MenuItem$1 || "startColumnCount" in item) {
|
|
405
|
-
item.startColumnCount = indent;
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
};
|
|
409
|
-
/**
|
|
410
|
-
* handle change from child element
|
|
411
|
-
*/
|
|
412
|
-
this.changeHandler = (e) => {
|
|
413
|
-
if (this.menuItems === undefined) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const changedMenuItem = e.target;
|
|
417
|
-
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
418
|
-
if (changeItemIndex === -1) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
if (changedMenuItem.role === "menuitemradio" &&
|
|
422
|
-
changedMenuItem.checked === true) {
|
|
423
|
-
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
424
|
-
const item = this.menuItems[i];
|
|
425
|
-
const role = item.getAttribute("role");
|
|
426
|
-
if (role === MenuItemRole$1.menuitemradio) {
|
|
427
|
-
item.checked = false;
|
|
428
|
-
}
|
|
429
|
-
if (role === "separator") {
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
const maxIndex = this.menuItems.length - 1;
|
|
434
|
-
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
435
|
-
const item = this.menuItems[i];
|
|
436
|
-
const role = item.getAttribute("role");
|
|
437
|
-
if (role === MenuItemRole$1.menuitemradio) {
|
|
438
|
-
item.checked = false;
|
|
439
|
-
}
|
|
440
|
-
if (role === "separator") {
|
|
441
|
-
break;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
/**
|
|
447
|
-
* check if the item is a menu item
|
|
448
|
-
*/
|
|
449
|
-
this.isMenuItemElement = (el) => {
|
|
450
|
-
return (isHTMLElement(el) &&
|
|
451
|
-
Menu.focusableElementRoles.hasOwnProperty(el.getAttribute("role")));
|
|
452
|
-
};
|
|
453
|
-
/**
|
|
454
|
-
* check if the item is focusable
|
|
455
|
-
*/
|
|
456
|
-
this.isFocusableElement = (el) => {
|
|
457
|
-
return this.isMenuItemElement(el);
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
itemsChanged(oldValue, newValue) {
|
|
461
|
-
// only update children after the component is connected and
|
|
462
|
-
// the setItems has run on connectedCallback
|
|
463
|
-
// (menuItems is undefined until then)
|
|
464
|
-
if (this.$fastController.isConnected && this.menuItems !== undefined) {
|
|
465
|
-
this.setItems();
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* @internal
|
|
470
|
-
*/
|
|
471
|
-
connectedCallback() {
|
|
472
|
-
super.connectedCallback();
|
|
473
|
-
DOM.queueUpdate(() => {
|
|
474
|
-
// wait until children have had a chance to
|
|
475
|
-
// connect before setting/checking their props/attributes
|
|
476
|
-
this.setItems();
|
|
477
|
-
});
|
|
478
|
-
this.addEventListener("change", this.changeHandler);
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* @internal
|
|
482
|
-
*/
|
|
483
|
-
disconnectedCallback() {
|
|
484
|
-
super.disconnectedCallback();
|
|
485
|
-
this.removeItemListeners();
|
|
486
|
-
this.menuItems = undefined;
|
|
487
|
-
this.removeEventListener("change", this.changeHandler);
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* Focuses the first item in the menu.
|
|
491
|
-
*
|
|
492
|
-
* @public
|
|
493
|
-
*/
|
|
494
|
-
focus() {
|
|
495
|
-
this.setFocus(0, 1);
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* Collapses any expanded menu items.
|
|
499
|
-
*
|
|
500
|
-
* @public
|
|
501
|
-
*/
|
|
502
|
-
collapseExpandedItem() {
|
|
503
|
-
if (this.expandedItem !== null) {
|
|
504
|
-
this.expandedItem.expanded = false;
|
|
505
|
-
this.expandedItem = null;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* @internal
|
|
510
|
-
*/
|
|
511
|
-
handleMenuKeyDown(e) {
|
|
512
|
-
if (e.defaultPrevented || this.menuItems === undefined) {
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
switch (e.key) {
|
|
516
|
-
case keyArrowDown:
|
|
517
|
-
// go forward one index
|
|
518
|
-
this.setFocus(this.focusIndex + 1, 1);
|
|
519
|
-
return;
|
|
520
|
-
case keyArrowUp:
|
|
521
|
-
// go back one index
|
|
522
|
-
this.setFocus(this.focusIndex - 1, -1);
|
|
523
|
-
return;
|
|
524
|
-
case keyEnd:
|
|
525
|
-
// set focus on last item
|
|
526
|
-
this.setFocus(this.menuItems.length - 1, -1);
|
|
527
|
-
return;
|
|
528
|
-
case keyHome:
|
|
529
|
-
// set focus on first item
|
|
530
|
-
this.setFocus(0, 1);
|
|
531
|
-
return;
|
|
532
|
-
default:
|
|
533
|
-
// if we are not handling the event, do not prevent default
|
|
534
|
-
return true;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* get an array of valid DOM children
|
|
539
|
-
*/
|
|
540
|
-
domChildren() {
|
|
541
|
-
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
542
|
-
}
|
|
543
|
-
setFocus(focusIndex, adjustment) {
|
|
544
|
-
if (this.menuItems === undefined) {
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
|
|
548
|
-
const child = this.menuItems[focusIndex];
|
|
549
|
-
if (this.isFocusableElement(child)) {
|
|
550
|
-
// change the previous index to -1
|
|
551
|
-
if (this.focusIndex > -1 &&
|
|
552
|
-
this.menuItems.length >= this.focusIndex - 1) {
|
|
553
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
554
|
-
}
|
|
555
|
-
// update the focus index
|
|
556
|
-
this.focusIndex = focusIndex;
|
|
557
|
-
// update the tabindex of next focusable element
|
|
558
|
-
child.setAttribute("tabindex", "0");
|
|
559
|
-
// focus the element
|
|
560
|
-
child.focus();
|
|
561
|
-
break;
|
|
562
|
-
}
|
|
563
|
-
focusIndex += adjustment;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
Menu$1.focusableElementRoles = roleForMenuItem;
|
|
568
|
-
__decorate([
|
|
569
|
-
observable
|
|
570
|
-
], Menu$1.prototype, "items", void 0);
|
|
571
|
-
|
|
572
|
-
const styles = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-primary: var(--vvd-menu-item-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-menu-item-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-menu-item-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-menu-item-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-menu-item-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-menu-item-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-menu-item-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-menu-item-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-menu-item-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-menu-item-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-menu-item-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-menu-item-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-menu-item-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-menu-item-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-menu-item-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-menu-item-accent-dim, var(--vvd-color-neutral-200))}.base{display:flex;box-sizing:border-box;align-items:center;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);inline-size:100%}.base:not(.two-lines){gap:12px;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:8px;padding-inline:12px}.base.two-lines{padding:12px;gap:16px;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)) + 1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}:host(:not([role=presentation]):focus-visible) .base{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}.icon{flex-shrink:0;font-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2);line-height:1}.action,.decorative{display:flex;place-content:center}.action{color:var(--_appearance-color-text)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[aria-checked=true],[disabled])) .action{color:var(--vvd-color-neutral-500)}.base:not(.disabled) .decorative{color:var(--vvd-color-neutral-600)}.base.disabled .decorative{color:var(--vvd-color-neutral-200)}.base.has-meta .decorative{order:1}.chevron{order:3}.text{display:flex;overflow:hidden;flex-direction:column;gap:4px;margin-inline-end:auto}.text-primary,.text-secondary{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;font:var(--vvd-typography-base)}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp, 1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp, 1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}";
|
|
44
|
+
const styles$1 = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-primary: var(--vvd-menu-item-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-menu-item-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-menu-item-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-menu-item-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-menu-item-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-menu-item-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-menu-item-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-menu-item-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-menu-item-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-menu-item-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-menu-item-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-menu-item-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-menu-item-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-menu-item-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-menu-item-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-menu-item-accent-dim, var(--vvd-color-neutral-200))}.base{display:flex;box-sizing:border-box;align-items:center;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);inline-size:100%}.base:not(.two-lines){gap:12px;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:8px;padding-inline:12px}.base.two-lines{padding:12px;gap:16px;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)) + 1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}:host(:not([role=presentation]):focus-visible) .base{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}.icon{flex-shrink:0;font-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2);line-height:1}.action,.decorative{display:flex;place-content:center}.action{color:var(--_appearance-color-text)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[aria-checked=true],[disabled])) .action{color:var(--vvd-color-neutral-500)}.base:not(.disabled) .decorative{color:var(--vvd-color-neutral-600)}.base.disabled .decorative{color:var(--vvd-color-neutral-200)}.base.has-meta .decorative{order:1}.chevron{order:3}.text{display:flex;overflow:hidden;flex-direction:column;gap:4px;margin-inline-end:auto}.text-primary,.text-secondary{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;font:var(--vvd-typography-base)}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp, 1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp, 1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}";
|
|
573
45
|
|
|
574
46
|
var __defProp$1 = Object.defineProperty;
|
|
575
47
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -589,10 +61,88 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
589
61
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
590
62
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
591
63
|
var _Menu_instances, triggerBehaviour_get, setupAnchor_fn, updateAnchor_fn, cleanupAnchor_fn, _onAnchorClick;
|
|
592
|
-
let Menu = class extends
|
|
64
|
+
let Menu = class extends VividElement {
|
|
593
65
|
constructor() {
|
|
594
|
-
super();
|
|
66
|
+
super(...arguments);
|
|
595
67
|
__privateAdd(this, _Menu_instances);
|
|
68
|
+
this.expandedItem = null;
|
|
69
|
+
/**
|
|
70
|
+
* The index of the focusable element in the items array
|
|
71
|
+
* defaults to -1
|
|
72
|
+
*/
|
|
73
|
+
this.focusIndex = -1;
|
|
74
|
+
/**
|
|
75
|
+
* if focus is moving out of the menu, reset to a stable initial state
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
this.handleFocusOut = (e) => {
|
|
79
|
+
if (!this.contains(e.relatedTarget) && this.menuItems !== void 0 && this.menuItems.length) {
|
|
80
|
+
this.collapseExpandedItem();
|
|
81
|
+
const focusIndex = this.menuItems.findIndex(
|
|
82
|
+
this.isFocusableElement
|
|
83
|
+
);
|
|
84
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
85
|
+
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
86
|
+
this.focusIndex = focusIndex;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
this.handleItemFocus = (e) => {
|
|
90
|
+
const targetItem = e.target;
|
|
91
|
+
if (this.menuItems !== void 0 && targetItem !== this.menuItems[this.focusIndex]) {
|
|
92
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
93
|
+
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
94
|
+
targetItem.setAttribute("tabindex", "0");
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
this.handleExpandedChanged = (e) => {
|
|
98
|
+
const changedItem = e.target;
|
|
99
|
+
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
|
|
100
|
+
this.expandedItem = null;
|
|
101
|
+
}
|
|
102
|
+
if (changedItem.expanded) {
|
|
103
|
+
this.expandedItem = changedItem;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
this.removeItemListeners = () => {
|
|
107
|
+
if (this.menuItems !== void 0) {
|
|
108
|
+
this.menuItems.forEach((item) => {
|
|
109
|
+
item.removeEventListener("expanded-change", this.handleExpandedChanged);
|
|
110
|
+
item.removeEventListener(
|
|
111
|
+
"focus",
|
|
112
|
+
this.handleItemFocus
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
this.setItems = () => {
|
|
118
|
+
const newItems = this.domChildren();
|
|
119
|
+
this.removeItemListeners();
|
|
120
|
+
this.menuItems = newItems;
|
|
121
|
+
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
122
|
+
if (menuItems.length) {
|
|
123
|
+
this.focusIndex = 0;
|
|
124
|
+
}
|
|
125
|
+
menuItems.forEach((item, index) => {
|
|
126
|
+
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
127
|
+
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
128
|
+
item.addEventListener("focus", this.handleItemFocus);
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* check if the item is a menu item
|
|
133
|
+
*/
|
|
134
|
+
this.isMenuItemElement = (el) => {
|
|
135
|
+
return isHTMLElement(el) && Object.prototype.hasOwnProperty.call(
|
|
136
|
+
Menu.focusableElementRoles,
|
|
137
|
+
el.getAttribute("role")
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* check if the item is focusable
|
|
142
|
+
*/
|
|
143
|
+
this.isFocusableElement = (el) => {
|
|
144
|
+
return this.isMenuItemElement(el);
|
|
145
|
+
};
|
|
596
146
|
this.ariaLabel = null;
|
|
597
147
|
this.placement = "bottom";
|
|
598
148
|
this.autoDismiss = false;
|
|
@@ -615,24 +165,112 @@ let Menu = class extends Menu$1 {
|
|
|
615
165
|
this.open = false;
|
|
616
166
|
}
|
|
617
167
|
};
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* @internal
|
|
171
|
+
*/
|
|
172
|
+
itemsChanged() {
|
|
173
|
+
if (this.$fastController.isConnected && this.menuItems !== void 0) {
|
|
174
|
+
this.setItems();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
connectedCallback() {
|
|
181
|
+
super.connectedCallback();
|
|
182
|
+
DOM.queueUpdate(() => {
|
|
183
|
+
this.setItems();
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
disconnectedCallback() {
|
|
190
|
+
super.disconnectedCallback();
|
|
191
|
+
this.removeItemListeners();
|
|
192
|
+
this.menuItems = void 0;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Moves focus into the menu. If there is a child with the `autofocus` attribute, it will be focused.
|
|
196
|
+
* Otherwise, the first focusable child will be focused.
|
|
197
|
+
*
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
focus() {
|
|
201
|
+
const autoFocusElement = this.querySelector(
|
|
202
|
+
'[autofocus]:not([slot="anchor"])'
|
|
203
|
+
);
|
|
204
|
+
if (autoFocusElement instanceof HTMLElement) {
|
|
205
|
+
autoFocusElement.focus();
|
|
206
|
+
} else {
|
|
207
|
+
this.setFocus(0, 1);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Collapses any expanded Menu Items.
|
|
212
|
+
*
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
collapseExpandedItem() {
|
|
216
|
+
if (this.expandedItem !== null) {
|
|
217
|
+
this.expandedItem.expanded = false;
|
|
218
|
+
this.expandedItem = null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
handleMenuKeyDown(e) {
|
|
225
|
+
if (e.defaultPrevented || this.menuItems === void 0) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
switch (e.key) {
|
|
229
|
+
case keyArrowDown:
|
|
230
|
+
this.setFocus(this.focusIndex + 1, 1);
|
|
231
|
+
return;
|
|
232
|
+
case keyArrowUp:
|
|
233
|
+
this.setFocus(this.focusIndex - 1, -1);
|
|
234
|
+
return;
|
|
235
|
+
case keyEnd:
|
|
236
|
+
this.setFocus(this.menuItems.length - 1, -1);
|
|
625
237
|
return;
|
|
238
|
+
case keyHome:
|
|
239
|
+
this.setFocus(0, 1);
|
|
240
|
+
return;
|
|
241
|
+
default:
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* get an array of valid DOM children
|
|
247
|
+
*/
|
|
248
|
+
domChildren() {
|
|
249
|
+
return Array.from(this.children).filter((child) => !child.hasAttribute("hidden")).filter((child) => !child.hasAttribute("slot"));
|
|
250
|
+
}
|
|
251
|
+
setFocus(focusIndex, adjustment) {
|
|
252
|
+
if (this.menuItems === void 0) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
|
|
256
|
+
const child = this.menuItems[focusIndex];
|
|
257
|
+
if (this.isFocusableElement(child)) {
|
|
258
|
+
if (this.focusIndex > -1 && this.menuItems.length >= this.focusIndex - 1) {
|
|
259
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
260
|
+
}
|
|
261
|
+
this.focusIndex = focusIndex;
|
|
262
|
+
child.setAttribute("tabindex", "0");
|
|
263
|
+
child.focus();
|
|
264
|
+
break;
|
|
626
265
|
}
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
const privates = this;
|
|
630
|
-
const domChildren = privates.domChildren;
|
|
631
|
-
privates.domChildren = () => {
|
|
632
|
-
return domChildren.call(this).filter((child) => !child.hasAttribute("slot"));
|
|
633
|
-
};
|
|
266
|
+
focusIndex += adjustment;
|
|
267
|
+
}
|
|
634
268
|
}
|
|
635
269
|
openChanged(_, newValue) {
|
|
270
|
+
if (newValue) {
|
|
271
|
+
this._popupEl?.show();
|
|
272
|
+
this.focus();
|
|
273
|
+
}
|
|
636
274
|
newValue ? this.$emit("open", void 0, { bubbles: false }) : this.$emit("close", void 0, { bubbles: false });
|
|
637
275
|
if (this._anchorEl) {
|
|
638
276
|
__privateMethod(this, _Menu_instances, updateAnchor_fn).call(this, this._anchorEl);
|
|
@@ -653,6 +291,34 @@ let Menu = class extends Menu$1 {
|
|
|
653
291
|
if (__privateGet(this, _Menu_instances, triggerBehaviour_get) === "auto" && clickedOnNonCheckboxMenuItem) {
|
|
654
292
|
this.open = false;
|
|
655
293
|
}
|
|
294
|
+
const changedMenuItem = e.target;
|
|
295
|
+
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
296
|
+
if (changeItemIndex === -1) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (changedMenuItem.role === "menuitemradio" && changedMenuItem.checked) {
|
|
300
|
+
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
301
|
+
const item = this.menuItems[i];
|
|
302
|
+
const role = item.getAttribute("role");
|
|
303
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
304
|
+
item.checked = false;
|
|
305
|
+
}
|
|
306
|
+
if (role === "separator") {
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const maxIndex = this.menuItems.length - 1;
|
|
311
|
+
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
312
|
+
const item = this.menuItems[i];
|
|
313
|
+
const role = item.getAttribute("role");
|
|
314
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
315
|
+
item.checked = false;
|
|
316
|
+
}
|
|
317
|
+
if (role === "separator") {
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
656
322
|
return true;
|
|
657
323
|
}
|
|
658
324
|
};
|
|
@@ -676,6 +342,10 @@ cleanupAnchor_fn = function(a) {
|
|
|
676
342
|
a.removeAttribute("aria-expanded");
|
|
677
343
|
};
|
|
678
344
|
_onAnchorClick = new WeakMap();
|
|
345
|
+
Menu.focusableElementRoles = roleForMenuItem;
|
|
346
|
+
__decorateClass$1([
|
|
347
|
+
observable
|
|
348
|
+
], Menu.prototype, "items", 2);
|
|
679
349
|
__decorateClass$1([
|
|
680
350
|
attr({ attribute: "aria-label" })
|
|
681
351
|
], Menu.prototype, "ariaLabel", 2);
|
|
@@ -722,43 +392,146 @@ var CheckAppearance = /* @__PURE__ */ ((CheckAppearance2) => {
|
|
|
722
392
|
CheckAppearance2["TickOnly"] = "tick-only";
|
|
723
393
|
return CheckAppearance2;
|
|
724
394
|
})(CheckAppearance || {});
|
|
725
|
-
class MenuItem extends
|
|
395
|
+
class MenuItem extends VividElement {
|
|
726
396
|
constructor() {
|
|
727
397
|
super();
|
|
398
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
399
|
+
this.role = MenuItemRole.menuitem;
|
|
400
|
+
this.hasSubmenu = false;
|
|
401
|
+
this.currentDirection = Direction.ltr;
|
|
402
|
+
/**
|
|
403
|
+
* @internal
|
|
404
|
+
*/
|
|
405
|
+
this.handleMenuItemClick = (e) => {
|
|
406
|
+
if (e.defaultPrevented || this.disabled) {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
this.invoke();
|
|
410
|
+
return false;
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* @internal
|
|
414
|
+
*/
|
|
415
|
+
this.handleMouseOver = (_) => {
|
|
416
|
+
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
this.expanded = true;
|
|
420
|
+
return false;
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* @internal
|
|
424
|
+
*/
|
|
425
|
+
this.handleMouseOut = (_) => {
|
|
426
|
+
if (!this.expanded || this.contains(document.activeElement)) {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
this.expanded = false;
|
|
430
|
+
return false;
|
|
431
|
+
};
|
|
432
|
+
this.invoke = () => {
|
|
433
|
+
if (this.disabled) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
switch (this.role) {
|
|
437
|
+
case MenuItemRole.menuitemcheckbox:
|
|
438
|
+
this.checked = !this.checked;
|
|
439
|
+
break;
|
|
440
|
+
case MenuItemRole.menuitem:
|
|
441
|
+
this.updateSubmenu();
|
|
442
|
+
if (this.hasSubmenu) {
|
|
443
|
+
this.expanded = true;
|
|
444
|
+
} else {
|
|
445
|
+
this.$emit("change");
|
|
446
|
+
}
|
|
447
|
+
break;
|
|
448
|
+
case MenuItemRole.menuitemradio:
|
|
449
|
+
if (!this.checked) {
|
|
450
|
+
this.checked = true;
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
};
|
|
728
455
|
this.checkTrailing = false;
|
|
729
456
|
this.#submenuArray = [];
|
|
730
|
-
|
|
457
|
+
/**
|
|
458
|
+
* @internal
|
|
459
|
+
*/
|
|
460
|
+
this.handleMenuItemKeyDown = (e) => {
|
|
731
461
|
if (e.defaultPrevented) {
|
|
732
462
|
return false;
|
|
733
463
|
}
|
|
734
464
|
switch (e.key) {
|
|
735
|
-
case keyEnter
|
|
736
|
-
case keySpace
|
|
465
|
+
case keyEnter:
|
|
466
|
+
case keySpace:
|
|
737
467
|
this.invoke();
|
|
738
468
|
if (!this.disabled) {
|
|
739
469
|
this.#emitSyntheticClick();
|
|
740
470
|
}
|
|
741
471
|
return false;
|
|
742
|
-
case keyArrowRight
|
|
743
|
-
this.expandAndFocus();
|
|
472
|
+
case keyArrowRight:
|
|
744
473
|
if (this.hasSubmenu) {
|
|
474
|
+
this.expanded = true;
|
|
745
475
|
this.#emitSyntheticClick();
|
|
746
476
|
}
|
|
747
477
|
return false;
|
|
748
|
-
case keyArrowLeft
|
|
478
|
+
case keyArrowLeft:
|
|
749
479
|
if (this.expanded) {
|
|
480
|
+
this.#emitSyntheticClick();
|
|
750
481
|
this.expanded = false;
|
|
751
482
|
this.focus();
|
|
752
|
-
this.#emitSyntheticClick();
|
|
753
483
|
return false;
|
|
754
484
|
}
|
|
755
485
|
}
|
|
756
486
|
return true;
|
|
757
487
|
};
|
|
758
488
|
this.#syntheticClickEvents = /* @__PURE__ */ new WeakSet();
|
|
759
|
-
this.updateSubmenu = () => this.#updateSubmenu();
|
|
760
489
|
this.addEventListener("expanded-change", this.#expandedChange);
|
|
761
|
-
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* @internal
|
|
493
|
+
*/
|
|
494
|
+
expandedChanged() {
|
|
495
|
+
if (this.$fastController.isConnected) {
|
|
496
|
+
if (this.submenu === void 0) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (this.expanded === false) {
|
|
500
|
+
this.submenu.collapseExpandedItem();
|
|
501
|
+
} else {
|
|
502
|
+
this.currentDirection = getDirection(this);
|
|
503
|
+
}
|
|
504
|
+
this.$emit("expanded-change", this, { bubbles: false });
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @internal
|
|
509
|
+
*/
|
|
510
|
+
checkedChanged() {
|
|
511
|
+
if (this.$fastController.isConnected) {
|
|
512
|
+
this.$emit("change");
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* @internal
|
|
517
|
+
*/
|
|
518
|
+
connectedCallback() {
|
|
519
|
+
super.connectedCallback();
|
|
520
|
+
DOM.queueUpdate(() => {
|
|
521
|
+
this.updateSubmenu();
|
|
522
|
+
});
|
|
523
|
+
this.observer = new MutationObserver(this.updateSubmenu);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* @internal
|
|
527
|
+
*/
|
|
528
|
+
disconnectedCallback() {
|
|
529
|
+
super.disconnectedCallback();
|
|
530
|
+
this.submenu = void 0;
|
|
531
|
+
if (this.observer !== void 0) {
|
|
532
|
+
this.observer.disconnect();
|
|
533
|
+
this.observer = void 0;
|
|
534
|
+
}
|
|
762
535
|
}
|
|
763
536
|
#submenuArray;
|
|
764
537
|
/**
|
|
@@ -769,7 +542,7 @@ class MenuItem extends MenuItem$1 {
|
|
|
769
542
|
slottedSubmenuChanged(_oldValue, newValue) {
|
|
770
543
|
this.#submenuArray = newValue;
|
|
771
544
|
}
|
|
772
|
-
|
|
545
|
+
updateSubmenu() {
|
|
773
546
|
for (const submenu of this.#submenuArray) {
|
|
774
547
|
this.submenu = submenu;
|
|
775
548
|
this.submenu.anchor = this;
|
|
@@ -786,7 +559,6 @@ class MenuItem extends MenuItem$1 {
|
|
|
786
559
|
this.submenu.open = this.expanded;
|
|
787
560
|
}
|
|
788
561
|
}
|
|
789
|
-
#handleMenuItemKeyDown;
|
|
790
562
|
#syntheticClickEvents;
|
|
791
563
|
/**
|
|
792
564
|
* @internal
|
|
@@ -803,6 +575,30 @@ class MenuItem extends MenuItem$1 {
|
|
|
803
575
|
this.dispatchEvent(mouseEvent);
|
|
804
576
|
}
|
|
805
577
|
}
|
|
578
|
+
__decorateClass([
|
|
579
|
+
attr({ mode: "boolean" })
|
|
580
|
+
], MenuItem.prototype, "disabled");
|
|
581
|
+
__decorateClass([
|
|
582
|
+
attr({ mode: "boolean" })
|
|
583
|
+
], MenuItem.prototype, "expanded");
|
|
584
|
+
__decorateClass([
|
|
585
|
+
attr
|
|
586
|
+
], MenuItem.prototype, "role");
|
|
587
|
+
__decorateClass([
|
|
588
|
+
attr({ mode: "boolean" })
|
|
589
|
+
], MenuItem.prototype, "checked");
|
|
590
|
+
__decorateClass([
|
|
591
|
+
observable
|
|
592
|
+
], MenuItem.prototype, "submenuRegion");
|
|
593
|
+
__decorateClass([
|
|
594
|
+
observable
|
|
595
|
+
], MenuItem.prototype, "hasSubmenu");
|
|
596
|
+
__decorateClass([
|
|
597
|
+
observable
|
|
598
|
+
], MenuItem.prototype, "currentDirection");
|
|
599
|
+
__decorateClass([
|
|
600
|
+
observable
|
|
601
|
+
], MenuItem.prototype, "submenu");
|
|
806
602
|
__decorateClass([
|
|
807
603
|
attr
|
|
808
604
|
], MenuItem.prototype, "text");
|
|
@@ -837,7 +633,7 @@ const getIndicatorIcon = (x) => {
|
|
|
837
633
|
const iconStatus = x.checked ? "checked" : "unchecked";
|
|
838
634
|
return `${iconType}-${iconStatus}-2-line`;
|
|
839
635
|
};
|
|
840
|
-
const getClasses = ({
|
|
636
|
+
const getClasses$1 = ({
|
|
841
637
|
connotation,
|
|
842
638
|
disabled,
|
|
843
639
|
checked,
|
|
@@ -905,7 +701,7 @@ const MenuItemTemplate = (context) => {
|
|
|
905
701
|
@mouseover="${(x, c) => x.handleMouseOver(c.event)}"
|
|
906
702
|
@mouseout="${(x, c) => x.handleMouseOut(c.event)}"
|
|
907
703
|
>
|
|
908
|
-
<div class="${getClasses}">
|
|
704
|
+
<div class="${getClasses$1}">
|
|
909
705
|
<slot name="meta" ${slotted("metaSlottedContent")}></slot>
|
|
910
706
|
${checkIndicator(context)}
|
|
911
707
|
${when(
|
|
@@ -928,19 +724,95 @@ const MenuItemTemplate = (context) => {
|
|
|
928
724
|
name="submenu"
|
|
929
725
|
${slotted({
|
|
930
726
|
property: "slottedSubmenu",
|
|
931
|
-
filter: elements(context.
|
|
727
|
+
filter: elements(context.tagForNonDependency(menuName))
|
|
932
728
|
})}
|
|
933
729
|
></slot>
|
|
934
730
|
</template>
|
|
935
731
|
`;
|
|
936
732
|
};
|
|
937
733
|
|
|
938
|
-
const menuItemDefinition =
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
734
|
+
const menuItemDefinition = defineVividComponent(
|
|
735
|
+
"menu-item",
|
|
736
|
+
MenuItem,
|
|
737
|
+
MenuItemTemplate,
|
|
738
|
+
[iconDefinition],
|
|
739
|
+
{
|
|
740
|
+
styles: styles$1
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
const registerMenuItem = createRegisterFunction(menuItemDefinition);
|
|
744
|
+
|
|
745
|
+
const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.base{display:flex;overflow:hidden auto;box-sizing:border-box;flex-direction:column;gap:8px;inline-size:max-content;max-block-size:var(--menu-block-size, 408px);max-inline-size:var(--menu-max-inline-size);min-inline-size:var(--menu-min-inline-size);padding-block:8px}::slotted(a){color:var(--vvd-color-canvas-text);text-decoration:none}::slotted(a[role=menuitem]:focus-visible){box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;display:block}.header{padding-block-start:4px;padding-inline:12px}.hide-header .header{display:none}.body{display:flex;flex-direction:column;row-gap:1px}.hide-body .body{display:none}.action-items{display:flex;justify-content:flex-end;gap:8px;padding-block-end:4px;padding-inline:12px}.hide-actions .action-items{display:none}";
|
|
746
|
+
|
|
747
|
+
const getClasses = ({
|
|
748
|
+
headerSlottedContent,
|
|
749
|
+
actionItemsSlottedContent,
|
|
750
|
+
items
|
|
751
|
+
}) => classNames(
|
|
752
|
+
"base",
|
|
753
|
+
["hide-header", !headerSlottedContent?.length],
|
|
754
|
+
["hide-actions", !actionItemsSlottedContent?.length],
|
|
755
|
+
["hide-body", items && !items.length]
|
|
756
|
+
);
|
|
757
|
+
function handleEscapeKey(menu, event) {
|
|
758
|
+
if (menu.open && handleEscapeKeyAndStopPropogation(event)) {
|
|
759
|
+
menu.open = false;
|
|
760
|
+
}
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
const MenuTemplate = (context) => {
|
|
764
|
+
const popupTag = context.tagFor(Popup);
|
|
765
|
+
const anchorSlotTemplate = anchorSlotTemplateFactory();
|
|
766
|
+
function handlePopupEvents(x, e, state) {
|
|
767
|
+
e.stopPropagation();
|
|
768
|
+
x.open = state;
|
|
769
|
+
}
|
|
770
|
+
return html`
|
|
771
|
+
<template role="presentation"
|
|
772
|
+
@change="${(x, c) => x._onChange(c.event)}"
|
|
773
|
+
@focusout="${(x, c) => x._onFocusout(c.event)}">
|
|
774
|
+
${anchorSlotTemplate}
|
|
775
|
+
<${popupTag}
|
|
776
|
+
${ref("_popupEl")}
|
|
777
|
+
:placement=${(x) => x.placement}
|
|
778
|
+
:open=${(x) => x.open}
|
|
779
|
+
:anchor=${(x) => x._anchorEl}
|
|
780
|
+
:strategy="${(x) => x.positionStrategy}"
|
|
781
|
+
@keydown="${(x, c) => handleEscapeKey(x, c.event)}"
|
|
782
|
+
@vwc-popup:open="${(x, c) => handlePopupEvents(x, c.event, true)}"
|
|
783
|
+
@vwc-popup:close="${(x, c) => handlePopupEvents(x, c.event, false)}"
|
|
784
|
+
>
|
|
785
|
+
<div class="${getClasses}">
|
|
786
|
+
<div class="header">
|
|
787
|
+
<slot name="header" ${slotted("headerSlottedContent")}></slot>
|
|
788
|
+
</div>
|
|
789
|
+
<div
|
|
790
|
+
class="body"
|
|
791
|
+
role="menu"
|
|
792
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
793
|
+
@keydown="${(x, c) => x.handleMenuKeyDown(c.event)}"
|
|
794
|
+
@focusout="${(x, c) => x.handleFocusOut(c.event)}"
|
|
795
|
+
>
|
|
796
|
+
<slot ${slotted("items")}></slot>
|
|
797
|
+
</div>
|
|
798
|
+
<footer class="action-items"><slot name="action-items" ${slotted(
|
|
799
|
+
"actionItemsSlottedContent"
|
|
800
|
+
)}></slot></footer>
|
|
801
|
+
</div>
|
|
802
|
+
</${popupTag}>
|
|
803
|
+
</template>`;
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
const menuName = "menu";
|
|
807
|
+
const menuDefinition = defineVividComponent(
|
|
808
|
+
menuName,
|
|
809
|
+
Menu,
|
|
810
|
+
MenuTemplate,
|
|
811
|
+
[popupDefinition, menuItemDefinition],
|
|
812
|
+
{
|
|
813
|
+
styles
|
|
814
|
+
}
|
|
815
|
+
);
|
|
816
|
+
const registerMenu = createRegisterFunction(menuDefinition);
|
|
945
817
|
|
|
946
|
-
export { MenuItemRole as M,
|
|
818
|
+
export { MenuItemRole as M, menuName as a, menuDefinition as b, registerMenu as c, Menu as d, MenuItem as e, menuItemDefinition as m, registerMenuItem as r };
|