@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.cjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const definition$1 = require('./definition63.cjs');
|
|
4
4
|
const definition = require('./definition27.cjs');
|
|
5
|
-
const
|
|
5
|
+
const defineVividComponent = require('./defineVividComponent.cjs');
|
|
6
|
+
const keyCodes = require('./key-codes.cjs');
|
|
6
7
|
const affix = require('./affix.cjs');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
8
|
+
const vividElement = require('./vivid-element.cjs');
|
|
9
|
+
const applyMixins = require('./apply-mixins2.cjs');
|
|
9
10
|
const direction = require('./direction.cjs');
|
|
10
|
-
const keyCodes = require('./key-codes2.cjs');
|
|
11
|
-
const icon = require('./icon.cjs');
|
|
12
11
|
const anchored = require('./anchored.cjs');
|
|
13
12
|
const dom = require('./dom.cjs');
|
|
13
|
+
const index = require('./index.cjs');
|
|
14
|
+
const ref = require('./ref.cjs');
|
|
14
15
|
const slotted = require('./slotted.cjs');
|
|
15
|
-
const when = require('./when.cjs');
|
|
16
16
|
const classNames = require('./class-names.cjs');
|
|
17
|
+
const when = require('./when.cjs');
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Menu items roles.
|
|
@@ -42,536 +43,7 @@ const roleForMenuItem = {
|
|
|
42
43
|
[MenuItemRole$1.menuitemradio]: "menuitemradio",
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
* A Switch Custom HTML Element.
|
|
47
|
-
* 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 }.
|
|
48
|
-
*
|
|
49
|
-
* @slot checked-indicator - The checked indicator
|
|
50
|
-
* @slot radio-indicator - The radio indicator
|
|
51
|
-
* @slot start - Content which can be provided before the menu item content
|
|
52
|
-
* @slot end - Content which can be provided after the menu item content
|
|
53
|
-
* @slot - The default slot for menu item content
|
|
54
|
-
* @slot expand-collapse-indicator - The expand/collapse indicator
|
|
55
|
-
* @slot submenu - Used to nest menu's within menu items
|
|
56
|
-
* @csspart input-container - The element representing the visual checked or radio indicator
|
|
57
|
-
* @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
|
|
58
|
-
* @csspart radio - The element wrapping the `menuitemradio` indicator
|
|
59
|
-
* @csspart content - The element wrapping the menu item content
|
|
60
|
-
* @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
|
|
61
|
-
* @csspart expand-collapse - The expand/collapse element
|
|
62
|
-
* @csspart submenu-region - The container for the submenu, used for positioning
|
|
63
|
-
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
64
|
-
* @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
|
|
65
|
-
*
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
let MenuItem$1 = class MenuItem extends index.FoundationElement {
|
|
69
|
-
constructor() {
|
|
70
|
-
super(...arguments);
|
|
71
|
-
/**
|
|
72
|
-
* The role of the element.
|
|
73
|
-
*
|
|
74
|
-
* @public
|
|
75
|
-
* @remarks
|
|
76
|
-
* HTML Attribute: role
|
|
77
|
-
*/
|
|
78
|
-
this.role = MenuItemRole$1.menuitem;
|
|
79
|
-
/**
|
|
80
|
-
* @internal
|
|
81
|
-
*/
|
|
82
|
-
this.hasSubmenu = false;
|
|
83
|
-
/**
|
|
84
|
-
* Track current direction to pass to the anchored region
|
|
85
|
-
*
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
this.currentDirection = direction.Direction.ltr;
|
|
89
|
-
this.focusSubmenuOnLoad = false;
|
|
90
|
-
/**
|
|
91
|
-
* @internal
|
|
92
|
-
*/
|
|
93
|
-
this.handleMenuItemKeyDown = (e) => {
|
|
94
|
-
if (e.defaultPrevented) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
switch (e.key) {
|
|
98
|
-
case keyCodes.keyEnter:
|
|
99
|
-
case keyCodes.keySpace:
|
|
100
|
-
this.invoke();
|
|
101
|
-
return false;
|
|
102
|
-
case keyCodes.keyArrowRight:
|
|
103
|
-
//open/focus on submenu
|
|
104
|
-
this.expandAndFocus();
|
|
105
|
-
return false;
|
|
106
|
-
case keyCodes.keyArrowLeft:
|
|
107
|
-
//close submenu
|
|
108
|
-
if (this.expanded) {
|
|
109
|
-
this.expanded = false;
|
|
110
|
-
this.focus();
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return true;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
119
|
-
this.handleMenuItemClick = (e) => {
|
|
120
|
-
if (e.defaultPrevented || this.disabled) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
this.invoke();
|
|
124
|
-
return false;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* @internal
|
|
128
|
-
*/
|
|
129
|
-
this.submenuLoaded = () => {
|
|
130
|
-
if (!this.focusSubmenuOnLoad) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
this.focusSubmenuOnLoad = false;
|
|
134
|
-
if (this.hasSubmenu) {
|
|
135
|
-
this.submenu.focus();
|
|
136
|
-
this.setAttribute("tabindex", "-1");
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* @internal
|
|
141
|
-
*/
|
|
142
|
-
this.handleMouseOver = (e) => {
|
|
143
|
-
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
this.expanded = true;
|
|
147
|
-
return false;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* @internal
|
|
151
|
-
*/
|
|
152
|
-
this.handleMouseOut = (e) => {
|
|
153
|
-
if (!this.expanded || this.contains(document.activeElement)) {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
this.expanded = false;
|
|
157
|
-
return false;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* @internal
|
|
161
|
-
*/
|
|
162
|
-
this.expandAndFocus = () => {
|
|
163
|
-
if (!this.hasSubmenu) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
this.focusSubmenuOnLoad = true;
|
|
167
|
-
this.expanded = true;
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* @internal
|
|
171
|
-
*/
|
|
172
|
-
this.invoke = () => {
|
|
173
|
-
if (this.disabled) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
switch (this.role) {
|
|
177
|
-
case MenuItemRole$1.menuitemcheckbox:
|
|
178
|
-
this.checked = !this.checked;
|
|
179
|
-
break;
|
|
180
|
-
case MenuItemRole$1.menuitem:
|
|
181
|
-
// update submenu
|
|
182
|
-
this.updateSubmenu();
|
|
183
|
-
if (this.hasSubmenu) {
|
|
184
|
-
this.expandAndFocus();
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
this.$emit("change");
|
|
188
|
-
}
|
|
189
|
-
break;
|
|
190
|
-
case MenuItemRole$1.menuitemradio:
|
|
191
|
-
if (!this.checked) {
|
|
192
|
-
this.checked = true;
|
|
193
|
-
}
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* Gets the submenu element if any
|
|
199
|
-
*
|
|
200
|
-
* @internal
|
|
201
|
-
*/
|
|
202
|
-
this.updateSubmenu = () => {
|
|
203
|
-
this.submenu = this.domChildren().find((element) => {
|
|
204
|
-
return element.getAttribute("role") === "menu";
|
|
205
|
-
});
|
|
206
|
-
this.hasSubmenu = this.submenu === undefined ? false : true;
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
expandedChanged(oldValue) {
|
|
210
|
-
if (this.$fastController.isConnected) {
|
|
211
|
-
if (this.submenu === undefined) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (this.expanded === false) {
|
|
215
|
-
this.submenu.collapseExpandedItem();
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
this.currentDirection = direction.getDirection(this);
|
|
219
|
-
}
|
|
220
|
-
this.$emit("expanded-change", this, { bubbles: false });
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
checkedChanged(oldValue, newValue) {
|
|
224
|
-
if (this.$fastController.isConnected) {
|
|
225
|
-
this.$emit("change");
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* @internal
|
|
230
|
-
*/
|
|
231
|
-
connectedCallback() {
|
|
232
|
-
super.connectedCallback();
|
|
233
|
-
index.DOM.queueUpdate(() => {
|
|
234
|
-
this.updateSubmenu();
|
|
235
|
-
});
|
|
236
|
-
if (!this.startColumnCount) {
|
|
237
|
-
this.startColumnCount = 1;
|
|
238
|
-
}
|
|
239
|
-
this.observer = new MutationObserver(this.updateSubmenu);
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* @internal
|
|
243
|
-
*/
|
|
244
|
-
disconnectedCallback() {
|
|
245
|
-
super.disconnectedCallback();
|
|
246
|
-
this.submenu = undefined;
|
|
247
|
-
if (this.observer !== undefined) {
|
|
248
|
-
this.observer.disconnect();
|
|
249
|
-
this.observer = undefined;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* get an array of valid DOM children
|
|
254
|
-
*/
|
|
255
|
-
domChildren() {
|
|
256
|
-
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
index.__decorate([
|
|
260
|
-
index.attr({ mode: "boolean" })
|
|
261
|
-
], MenuItem$1.prototype, "disabled", void 0);
|
|
262
|
-
index.__decorate([
|
|
263
|
-
index.attr({ mode: "boolean" })
|
|
264
|
-
], MenuItem$1.prototype, "expanded", void 0);
|
|
265
|
-
index.__decorate([
|
|
266
|
-
index.observable
|
|
267
|
-
], MenuItem$1.prototype, "startColumnCount", void 0);
|
|
268
|
-
index.__decorate([
|
|
269
|
-
index.attr
|
|
270
|
-
], MenuItem$1.prototype, "role", void 0);
|
|
271
|
-
index.__decorate([
|
|
272
|
-
index.attr({ mode: "boolean" })
|
|
273
|
-
], MenuItem$1.prototype, "checked", void 0);
|
|
274
|
-
index.__decorate([
|
|
275
|
-
index.observable
|
|
276
|
-
], MenuItem$1.prototype, "submenuRegion", void 0);
|
|
277
|
-
index.__decorate([
|
|
278
|
-
index.observable
|
|
279
|
-
], MenuItem$1.prototype, "hasSubmenu", void 0);
|
|
280
|
-
index.__decorate([
|
|
281
|
-
index.observable
|
|
282
|
-
], MenuItem$1.prototype, "currentDirection", void 0);
|
|
283
|
-
index.__decorate([
|
|
284
|
-
index.observable
|
|
285
|
-
], MenuItem$1.prototype, "submenu", void 0);
|
|
286
|
-
applyMixins.applyMixins(MenuItem$1, startEnd.StartEnd);
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* A Menu Custom HTML Element.
|
|
290
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#menu | ARIA menu }.
|
|
291
|
-
*
|
|
292
|
-
* @slot - The default slot for the menu items
|
|
293
|
-
*
|
|
294
|
-
* @public
|
|
295
|
-
*/
|
|
296
|
-
let Menu$1 = class Menu extends index.FoundationElement {
|
|
297
|
-
constructor() {
|
|
298
|
-
super(...arguments);
|
|
299
|
-
this.expandedItem = null;
|
|
300
|
-
/**
|
|
301
|
-
* The index of the focusable element in the items array
|
|
302
|
-
* defaults to -1
|
|
303
|
-
*/
|
|
304
|
-
this.focusIndex = -1;
|
|
305
|
-
/**
|
|
306
|
-
* @internal
|
|
307
|
-
*/
|
|
308
|
-
this.isNestedMenu = () => {
|
|
309
|
-
return (this.parentElement !== null &&
|
|
310
|
-
dom.isHTMLElement(this.parentElement) &&
|
|
311
|
-
this.parentElement.getAttribute("role") === "menuitem");
|
|
312
|
-
};
|
|
313
|
-
/**
|
|
314
|
-
* if focus is moving out of the menu, reset to a stable initial state
|
|
315
|
-
* @internal
|
|
316
|
-
*/
|
|
317
|
-
this.handleFocusOut = (e) => {
|
|
318
|
-
if (!this.contains(e.relatedTarget) && this.menuItems !== undefined) {
|
|
319
|
-
this.collapseExpandedItem();
|
|
320
|
-
// find our first focusable element
|
|
321
|
-
const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
|
|
322
|
-
// set the current focus index's tabindex to -1
|
|
323
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
324
|
-
// set the first focusable element tabindex to 0
|
|
325
|
-
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
326
|
-
// set the focus index
|
|
327
|
-
this.focusIndex = focusIndex;
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
this.handleItemFocus = (e) => {
|
|
331
|
-
const targetItem = e.target;
|
|
332
|
-
if (this.menuItems !== undefined &&
|
|
333
|
-
targetItem !== this.menuItems[this.focusIndex]) {
|
|
334
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
335
|
-
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
336
|
-
targetItem.setAttribute("tabindex", "0");
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
this.handleExpandedChanged = (e) => {
|
|
340
|
-
if (e.defaultPrevented ||
|
|
341
|
-
e.target === null ||
|
|
342
|
-
this.menuItems === undefined ||
|
|
343
|
-
this.menuItems.indexOf(e.target) < 0) {
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
e.preventDefault();
|
|
347
|
-
const changedItem = e.target;
|
|
348
|
-
// closing an expanded item without opening another
|
|
349
|
-
if (this.expandedItem !== null &&
|
|
350
|
-
changedItem === this.expandedItem &&
|
|
351
|
-
changedItem.expanded === false) {
|
|
352
|
-
this.expandedItem = null;
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
if (changedItem.expanded) {
|
|
356
|
-
if (this.expandedItem !== null && this.expandedItem !== changedItem) {
|
|
357
|
-
this.expandedItem.expanded = false;
|
|
358
|
-
}
|
|
359
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
360
|
-
this.expandedItem = changedItem;
|
|
361
|
-
this.focusIndex = this.menuItems.indexOf(changedItem);
|
|
362
|
-
changedItem.setAttribute("tabindex", "0");
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
this.removeItemListeners = () => {
|
|
366
|
-
if (this.menuItems !== undefined) {
|
|
367
|
-
this.menuItems.forEach((item) => {
|
|
368
|
-
item.removeEventListener("expanded-change", this.handleExpandedChanged);
|
|
369
|
-
item.removeEventListener("focus", this.handleItemFocus);
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
this.setItems = () => {
|
|
374
|
-
const newItems = this.domChildren();
|
|
375
|
-
this.removeItemListeners();
|
|
376
|
-
this.menuItems = newItems;
|
|
377
|
-
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
378
|
-
// if our focus index is not -1 we have items
|
|
379
|
-
if (menuItems.length) {
|
|
380
|
-
this.focusIndex = 0;
|
|
381
|
-
}
|
|
382
|
-
function elementIndent(el) {
|
|
383
|
-
const role = el.getAttribute("role");
|
|
384
|
-
const startSlot = el.querySelector("[slot=start]");
|
|
385
|
-
if (role !== MenuItemRole$1.menuitem && startSlot === null) {
|
|
386
|
-
return 1;
|
|
387
|
-
}
|
|
388
|
-
else if (role === MenuItemRole$1.menuitem && startSlot !== null) {
|
|
389
|
-
return 1;
|
|
390
|
-
}
|
|
391
|
-
else if (role !== MenuItemRole$1.menuitem && startSlot !== null) {
|
|
392
|
-
return 2;
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
return 0;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
const indent = menuItems.reduce((accum, current) => {
|
|
399
|
-
const elementValue = elementIndent(current);
|
|
400
|
-
return accum > elementValue ? accum : elementValue;
|
|
401
|
-
}, 0);
|
|
402
|
-
menuItems.forEach((item, index) => {
|
|
403
|
-
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
404
|
-
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
405
|
-
item.addEventListener("focus", this.handleItemFocus);
|
|
406
|
-
if (item instanceof MenuItem$1 || "startColumnCount" in item) {
|
|
407
|
-
item.startColumnCount = indent;
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
};
|
|
411
|
-
/**
|
|
412
|
-
* handle change from child element
|
|
413
|
-
*/
|
|
414
|
-
this.changeHandler = (e) => {
|
|
415
|
-
if (this.menuItems === undefined) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
const changedMenuItem = e.target;
|
|
419
|
-
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
420
|
-
if (changeItemIndex === -1) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
if (changedMenuItem.role === "menuitemradio" &&
|
|
424
|
-
changedMenuItem.checked === true) {
|
|
425
|
-
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
426
|
-
const item = this.menuItems[i];
|
|
427
|
-
const role = item.getAttribute("role");
|
|
428
|
-
if (role === MenuItemRole$1.menuitemradio) {
|
|
429
|
-
item.checked = false;
|
|
430
|
-
}
|
|
431
|
-
if (role === "separator") {
|
|
432
|
-
break;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
const maxIndex = this.menuItems.length - 1;
|
|
436
|
-
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
437
|
-
const item = this.menuItems[i];
|
|
438
|
-
const role = item.getAttribute("role");
|
|
439
|
-
if (role === MenuItemRole$1.menuitemradio) {
|
|
440
|
-
item.checked = false;
|
|
441
|
-
}
|
|
442
|
-
if (role === "separator") {
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
/**
|
|
449
|
-
* check if the item is a menu item
|
|
450
|
-
*/
|
|
451
|
-
this.isMenuItemElement = (el) => {
|
|
452
|
-
return (dom.isHTMLElement(el) &&
|
|
453
|
-
Menu.focusableElementRoles.hasOwnProperty(el.getAttribute("role")));
|
|
454
|
-
};
|
|
455
|
-
/**
|
|
456
|
-
* check if the item is focusable
|
|
457
|
-
*/
|
|
458
|
-
this.isFocusableElement = (el) => {
|
|
459
|
-
return this.isMenuItemElement(el);
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
itemsChanged(oldValue, newValue) {
|
|
463
|
-
// only update children after the component is connected and
|
|
464
|
-
// the setItems has run on connectedCallback
|
|
465
|
-
// (menuItems is undefined until then)
|
|
466
|
-
if (this.$fastController.isConnected && this.menuItems !== undefined) {
|
|
467
|
-
this.setItems();
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* @internal
|
|
472
|
-
*/
|
|
473
|
-
connectedCallback() {
|
|
474
|
-
super.connectedCallback();
|
|
475
|
-
index.DOM.queueUpdate(() => {
|
|
476
|
-
// wait until children have had a chance to
|
|
477
|
-
// connect before setting/checking their props/attributes
|
|
478
|
-
this.setItems();
|
|
479
|
-
});
|
|
480
|
-
this.addEventListener("change", this.changeHandler);
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* @internal
|
|
484
|
-
*/
|
|
485
|
-
disconnectedCallback() {
|
|
486
|
-
super.disconnectedCallback();
|
|
487
|
-
this.removeItemListeners();
|
|
488
|
-
this.menuItems = undefined;
|
|
489
|
-
this.removeEventListener("change", this.changeHandler);
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Focuses the first item in the menu.
|
|
493
|
-
*
|
|
494
|
-
* @public
|
|
495
|
-
*/
|
|
496
|
-
focus() {
|
|
497
|
-
this.setFocus(0, 1);
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Collapses any expanded menu items.
|
|
501
|
-
*
|
|
502
|
-
* @public
|
|
503
|
-
*/
|
|
504
|
-
collapseExpandedItem() {
|
|
505
|
-
if (this.expandedItem !== null) {
|
|
506
|
-
this.expandedItem.expanded = false;
|
|
507
|
-
this.expandedItem = null;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* @internal
|
|
512
|
-
*/
|
|
513
|
-
handleMenuKeyDown(e) {
|
|
514
|
-
if (e.defaultPrevented || this.menuItems === undefined) {
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
switch (e.key) {
|
|
518
|
-
case keyCodes.keyArrowDown:
|
|
519
|
-
// go forward one index
|
|
520
|
-
this.setFocus(this.focusIndex + 1, 1);
|
|
521
|
-
return;
|
|
522
|
-
case keyCodes.keyArrowUp:
|
|
523
|
-
// go back one index
|
|
524
|
-
this.setFocus(this.focusIndex - 1, -1);
|
|
525
|
-
return;
|
|
526
|
-
case keyCodes.keyEnd:
|
|
527
|
-
// set focus on last item
|
|
528
|
-
this.setFocus(this.menuItems.length - 1, -1);
|
|
529
|
-
return;
|
|
530
|
-
case keyCodes.keyHome:
|
|
531
|
-
// set focus on first item
|
|
532
|
-
this.setFocus(0, 1);
|
|
533
|
-
return;
|
|
534
|
-
default:
|
|
535
|
-
// if we are not handling the event, do not prevent default
|
|
536
|
-
return true;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* get an array of valid DOM children
|
|
541
|
-
*/
|
|
542
|
-
domChildren() {
|
|
543
|
-
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
544
|
-
}
|
|
545
|
-
setFocus(focusIndex, adjustment) {
|
|
546
|
-
if (this.menuItems === undefined) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
|
|
550
|
-
const child = this.menuItems[focusIndex];
|
|
551
|
-
if (this.isFocusableElement(child)) {
|
|
552
|
-
// change the previous index to -1
|
|
553
|
-
if (this.focusIndex > -1 &&
|
|
554
|
-
this.menuItems.length >= this.focusIndex - 1) {
|
|
555
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
556
|
-
}
|
|
557
|
-
// update the focus index
|
|
558
|
-
this.focusIndex = focusIndex;
|
|
559
|
-
// update the tabindex of next focusable element
|
|
560
|
-
child.setAttribute("tabindex", "0");
|
|
561
|
-
// focus the element
|
|
562
|
-
child.focus();
|
|
563
|
-
break;
|
|
564
|
-
}
|
|
565
|
-
focusIndex += adjustment;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
};
|
|
569
|
-
Menu$1.focusableElementRoles = roleForMenuItem;
|
|
570
|
-
index.__decorate([
|
|
571
|
-
index.observable
|
|
572
|
-
], Menu$1.prototype, "items", void 0);
|
|
573
|
-
|
|
574
|
-
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)}";
|
|
46
|
+
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)}";
|
|
575
47
|
|
|
576
48
|
var __defProp$1 = Object.defineProperty;
|
|
577
49
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -591,10 +63,88 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
591
63
|
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);
|
|
592
64
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
593
65
|
var _Menu_instances, triggerBehaviour_get, setupAnchor_fn, updateAnchor_fn, cleanupAnchor_fn, _onAnchorClick;
|
|
594
|
-
exports.Menu = class Menu extends
|
|
66
|
+
exports.Menu = class Menu extends vividElement.VividElement {
|
|
595
67
|
constructor() {
|
|
596
|
-
super();
|
|
68
|
+
super(...arguments);
|
|
597
69
|
__privateAdd(this, _Menu_instances);
|
|
70
|
+
this.expandedItem = null;
|
|
71
|
+
/**
|
|
72
|
+
* The index of the focusable element in the items array
|
|
73
|
+
* defaults to -1
|
|
74
|
+
*/
|
|
75
|
+
this.focusIndex = -1;
|
|
76
|
+
/**
|
|
77
|
+
* if focus is moving out of the menu, reset to a stable initial state
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
this.handleFocusOut = (e) => {
|
|
81
|
+
if (!this.contains(e.relatedTarget) && this.menuItems !== void 0 && this.menuItems.length) {
|
|
82
|
+
this.collapseExpandedItem();
|
|
83
|
+
const focusIndex = this.menuItems.findIndex(
|
|
84
|
+
this.isFocusableElement
|
|
85
|
+
);
|
|
86
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
87
|
+
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
88
|
+
this.focusIndex = focusIndex;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.handleItemFocus = (e) => {
|
|
92
|
+
const targetItem = e.target;
|
|
93
|
+
if (this.menuItems !== void 0 && targetItem !== this.menuItems[this.focusIndex]) {
|
|
94
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
95
|
+
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
96
|
+
targetItem.setAttribute("tabindex", "0");
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
this.handleExpandedChanged = (e) => {
|
|
100
|
+
const changedItem = e.target;
|
|
101
|
+
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
|
|
102
|
+
this.expandedItem = null;
|
|
103
|
+
}
|
|
104
|
+
if (changedItem.expanded) {
|
|
105
|
+
this.expandedItem = changedItem;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
this.removeItemListeners = () => {
|
|
109
|
+
if (this.menuItems !== void 0) {
|
|
110
|
+
this.menuItems.forEach((item) => {
|
|
111
|
+
item.removeEventListener("expanded-change", this.handleExpandedChanged);
|
|
112
|
+
item.removeEventListener(
|
|
113
|
+
"focus",
|
|
114
|
+
this.handleItemFocus
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
this.setItems = () => {
|
|
120
|
+
const newItems = this.domChildren();
|
|
121
|
+
this.removeItemListeners();
|
|
122
|
+
this.menuItems = newItems;
|
|
123
|
+
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
124
|
+
if (menuItems.length) {
|
|
125
|
+
this.focusIndex = 0;
|
|
126
|
+
}
|
|
127
|
+
menuItems.forEach((item, index) => {
|
|
128
|
+
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
129
|
+
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
130
|
+
item.addEventListener("focus", this.handleItemFocus);
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* check if the item is a menu item
|
|
135
|
+
*/
|
|
136
|
+
this.isMenuItemElement = (el) => {
|
|
137
|
+
return dom.isHTMLElement(el) && Object.prototype.hasOwnProperty.call(
|
|
138
|
+
exports.Menu.focusableElementRoles,
|
|
139
|
+
el.getAttribute("role")
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* check if the item is focusable
|
|
144
|
+
*/
|
|
145
|
+
this.isFocusableElement = (el) => {
|
|
146
|
+
return this.isMenuItemElement(el);
|
|
147
|
+
};
|
|
598
148
|
this.ariaLabel = null;
|
|
599
149
|
this.placement = "bottom";
|
|
600
150
|
this.autoDismiss = false;
|
|
@@ -608,7 +158,7 @@ exports.Menu = class Menu extends Menu$1 {
|
|
|
608
158
|
return;
|
|
609
159
|
}
|
|
610
160
|
const newValue = !this.open;
|
|
611
|
-
|
|
161
|
+
defineVividComponent.DOM.queueUpdate(() => this.open = newValue);
|
|
612
162
|
});
|
|
613
163
|
this._onFocusout = (e) => {
|
|
614
164
|
const focusTarget = e.relatedTarget;
|
|
@@ -617,24 +167,112 @@ exports.Menu = class Menu extends Menu$1 {
|
|
|
617
167
|
this.open = false;
|
|
618
168
|
}
|
|
619
169
|
};
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* @internal
|
|
173
|
+
*/
|
|
174
|
+
itemsChanged() {
|
|
175
|
+
if (this.$fastController.isConnected && this.menuItems !== void 0) {
|
|
176
|
+
this.setItems();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* @internal
|
|
181
|
+
*/
|
|
182
|
+
connectedCallback() {
|
|
183
|
+
super.connectedCallback();
|
|
184
|
+
defineVividComponent.DOM.queueUpdate(() => {
|
|
185
|
+
this.setItems();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
disconnectedCallback() {
|
|
192
|
+
super.disconnectedCallback();
|
|
193
|
+
this.removeItemListeners();
|
|
194
|
+
this.menuItems = void 0;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Moves focus into the menu. If there is a child with the `autofocus` attribute, it will be focused.
|
|
198
|
+
* Otherwise, the first focusable child will be focused.
|
|
199
|
+
*
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
focus() {
|
|
203
|
+
const autoFocusElement = this.querySelector(
|
|
204
|
+
'[autofocus]:not([slot="anchor"])'
|
|
205
|
+
);
|
|
206
|
+
if (autoFocusElement instanceof HTMLElement) {
|
|
207
|
+
autoFocusElement.focus();
|
|
208
|
+
} else {
|
|
209
|
+
this.setFocus(0, 1);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Collapses any expanded Menu Items.
|
|
214
|
+
*
|
|
215
|
+
* @public
|
|
216
|
+
*/
|
|
217
|
+
collapseExpandedItem() {
|
|
218
|
+
if (this.expandedItem !== null) {
|
|
219
|
+
this.expandedItem.expanded = false;
|
|
220
|
+
this.expandedItem = null;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* @internal
|
|
225
|
+
*/
|
|
226
|
+
handleMenuKeyDown(e) {
|
|
227
|
+
if (e.defaultPrevented || this.menuItems === void 0) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
switch (e.key) {
|
|
231
|
+
case keyCodes.keyArrowDown:
|
|
232
|
+
this.setFocus(this.focusIndex + 1, 1);
|
|
233
|
+
return;
|
|
234
|
+
case keyCodes.keyArrowUp:
|
|
235
|
+
this.setFocus(this.focusIndex - 1, -1);
|
|
236
|
+
return;
|
|
237
|
+
case keyCodes.keyEnd:
|
|
238
|
+
this.setFocus(this.menuItems.length - 1, -1);
|
|
239
|
+
return;
|
|
240
|
+
case keyCodes.keyHome:
|
|
241
|
+
this.setFocus(0, 1);
|
|
627
242
|
return;
|
|
243
|
+
default:
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* get an array of valid DOM children
|
|
249
|
+
*/
|
|
250
|
+
domChildren() {
|
|
251
|
+
return Array.from(this.children).filter((child) => !child.hasAttribute("hidden")).filter((child) => !child.hasAttribute("slot"));
|
|
252
|
+
}
|
|
253
|
+
setFocus(focusIndex, adjustment) {
|
|
254
|
+
if (this.menuItems === void 0) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
|
|
258
|
+
const child = this.menuItems[focusIndex];
|
|
259
|
+
if (this.isFocusableElement(child)) {
|
|
260
|
+
if (this.focusIndex > -1 && this.menuItems.length >= this.focusIndex - 1) {
|
|
261
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
262
|
+
}
|
|
263
|
+
this.focusIndex = focusIndex;
|
|
264
|
+
child.setAttribute("tabindex", "0");
|
|
265
|
+
child.focus();
|
|
266
|
+
break;
|
|
628
267
|
}
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
const privates = this;
|
|
632
|
-
const domChildren = privates.domChildren;
|
|
633
|
-
privates.domChildren = () => {
|
|
634
|
-
return domChildren.call(this).filter((child) => !child.hasAttribute("slot"));
|
|
635
|
-
};
|
|
268
|
+
focusIndex += adjustment;
|
|
269
|
+
}
|
|
636
270
|
}
|
|
637
271
|
openChanged(_, newValue) {
|
|
272
|
+
if (newValue) {
|
|
273
|
+
this._popupEl?.show();
|
|
274
|
+
this.focus();
|
|
275
|
+
}
|
|
638
276
|
newValue ? this.$emit("open", void 0, { bubbles: false }) : this.$emit("close", void 0, { bubbles: false });
|
|
639
277
|
if (this._anchorEl) {
|
|
640
278
|
__privateMethod(this, _Menu_instances, updateAnchor_fn).call(this, this._anchorEl);
|
|
@@ -655,6 +293,34 @@ exports.Menu = class Menu extends Menu$1 {
|
|
|
655
293
|
if (__privateGet(this, _Menu_instances, triggerBehaviour_get) === "auto" && clickedOnNonCheckboxMenuItem) {
|
|
656
294
|
this.open = false;
|
|
657
295
|
}
|
|
296
|
+
const changedMenuItem = e.target;
|
|
297
|
+
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
298
|
+
if (changeItemIndex === -1) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (changedMenuItem.role === "menuitemradio" && changedMenuItem.checked) {
|
|
302
|
+
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
303
|
+
const item = this.menuItems[i];
|
|
304
|
+
const role = item.getAttribute("role");
|
|
305
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
306
|
+
item.checked = false;
|
|
307
|
+
}
|
|
308
|
+
if (role === "separator") {
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const maxIndex = this.menuItems.length - 1;
|
|
313
|
+
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
314
|
+
const item = this.menuItems[i];
|
|
315
|
+
const role = item.getAttribute("role");
|
|
316
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
317
|
+
item.checked = false;
|
|
318
|
+
}
|
|
319
|
+
if (role === "separator") {
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
658
324
|
return true;
|
|
659
325
|
}
|
|
660
326
|
};
|
|
@@ -678,29 +344,33 @@ cleanupAnchor_fn = function(a) {
|
|
|
678
344
|
a.removeAttribute("aria-expanded");
|
|
679
345
|
};
|
|
680
346
|
_onAnchorClick = new WeakMap();
|
|
347
|
+
exports.Menu.focusableElementRoles = roleForMenuItem;
|
|
348
|
+
__decorateClass$1([
|
|
349
|
+
defineVividComponent.observable
|
|
350
|
+
], exports.Menu.prototype, "items", 2);
|
|
681
351
|
__decorateClass$1([
|
|
682
|
-
|
|
352
|
+
defineVividComponent.attr({ attribute: "aria-label" })
|
|
683
353
|
], exports.Menu.prototype, "ariaLabel", 2);
|
|
684
354
|
__decorateClass$1([
|
|
685
|
-
|
|
355
|
+
defineVividComponent.attr({ mode: "fromView" })
|
|
686
356
|
], exports.Menu.prototype, "placement", 2);
|
|
687
357
|
__decorateClass$1([
|
|
688
|
-
|
|
358
|
+
defineVividComponent.attr
|
|
689
359
|
], exports.Menu.prototype, "trigger", 2);
|
|
690
360
|
__decorateClass$1([
|
|
691
|
-
|
|
361
|
+
defineVividComponent.attr({ mode: "boolean", attribute: "auto-dismiss" })
|
|
692
362
|
], exports.Menu.prototype, "autoDismiss", 2);
|
|
693
363
|
__decorateClass$1([
|
|
694
|
-
|
|
364
|
+
defineVividComponent.attr({ mode: "fromView", attribute: "position-strategy" })
|
|
695
365
|
], exports.Menu.prototype, "positionStrategy", 2);
|
|
696
366
|
__decorateClass$1([
|
|
697
|
-
|
|
367
|
+
defineVividComponent.attr({ mode: "boolean" })
|
|
698
368
|
], exports.Menu.prototype, "open", 2);
|
|
699
369
|
__decorateClass$1([
|
|
700
|
-
|
|
370
|
+
defineVividComponent.observable
|
|
701
371
|
], exports.Menu.prototype, "headerSlottedContent", 2);
|
|
702
372
|
__decorateClass$1([
|
|
703
|
-
|
|
373
|
+
defineVividComponent.observable
|
|
704
374
|
], exports.Menu.prototype, "actionItemsSlottedContent", 2);
|
|
705
375
|
exports.Menu = __decorateClass$1([
|
|
706
376
|
anchored.anchored
|
|
@@ -724,43 +394,146 @@ var CheckAppearance = /* @__PURE__ */ ((CheckAppearance2) => {
|
|
|
724
394
|
CheckAppearance2["TickOnly"] = "tick-only";
|
|
725
395
|
return CheckAppearance2;
|
|
726
396
|
})(CheckAppearance || {});
|
|
727
|
-
class MenuItem extends
|
|
397
|
+
class MenuItem extends vividElement.VividElement {
|
|
728
398
|
constructor() {
|
|
729
399
|
super();
|
|
400
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
401
|
+
this.role = MenuItemRole.menuitem;
|
|
402
|
+
this.hasSubmenu = false;
|
|
403
|
+
this.currentDirection = direction.Direction.ltr;
|
|
404
|
+
/**
|
|
405
|
+
* @internal
|
|
406
|
+
*/
|
|
407
|
+
this.handleMenuItemClick = (e) => {
|
|
408
|
+
if (e.defaultPrevented || this.disabled) {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
this.invoke();
|
|
412
|
+
return false;
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* @internal
|
|
416
|
+
*/
|
|
417
|
+
this.handleMouseOver = (_) => {
|
|
418
|
+
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
this.expanded = true;
|
|
422
|
+
return false;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
this.handleMouseOut = (_) => {
|
|
428
|
+
if (!this.expanded || this.contains(document.activeElement)) {
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
this.expanded = false;
|
|
432
|
+
return false;
|
|
433
|
+
};
|
|
434
|
+
this.invoke = () => {
|
|
435
|
+
if (this.disabled) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
switch (this.role) {
|
|
439
|
+
case MenuItemRole.menuitemcheckbox:
|
|
440
|
+
this.checked = !this.checked;
|
|
441
|
+
break;
|
|
442
|
+
case MenuItemRole.menuitem:
|
|
443
|
+
this.updateSubmenu();
|
|
444
|
+
if (this.hasSubmenu) {
|
|
445
|
+
this.expanded = true;
|
|
446
|
+
} else {
|
|
447
|
+
this.$emit("change");
|
|
448
|
+
}
|
|
449
|
+
break;
|
|
450
|
+
case MenuItemRole.menuitemradio:
|
|
451
|
+
if (!this.checked) {
|
|
452
|
+
this.checked = true;
|
|
453
|
+
}
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
};
|
|
730
457
|
this.checkTrailing = false;
|
|
731
458
|
this.#submenuArray = [];
|
|
732
|
-
|
|
459
|
+
/**
|
|
460
|
+
* @internal
|
|
461
|
+
*/
|
|
462
|
+
this.handleMenuItemKeyDown = (e) => {
|
|
733
463
|
if (e.defaultPrevented) {
|
|
734
464
|
return false;
|
|
735
465
|
}
|
|
736
466
|
switch (e.key) {
|
|
737
|
-
case keyCodes
|
|
738
|
-
case keyCodes
|
|
467
|
+
case keyCodes.keyEnter:
|
|
468
|
+
case keyCodes.keySpace:
|
|
739
469
|
this.invoke();
|
|
740
470
|
if (!this.disabled) {
|
|
741
471
|
this.#emitSyntheticClick();
|
|
742
472
|
}
|
|
743
473
|
return false;
|
|
744
|
-
case keyCodes
|
|
745
|
-
this.expandAndFocus();
|
|
474
|
+
case keyCodes.keyArrowRight:
|
|
746
475
|
if (this.hasSubmenu) {
|
|
476
|
+
this.expanded = true;
|
|
747
477
|
this.#emitSyntheticClick();
|
|
748
478
|
}
|
|
749
479
|
return false;
|
|
750
|
-
case keyCodes
|
|
480
|
+
case keyCodes.keyArrowLeft:
|
|
751
481
|
if (this.expanded) {
|
|
482
|
+
this.#emitSyntheticClick();
|
|
752
483
|
this.expanded = false;
|
|
753
484
|
this.focus();
|
|
754
|
-
this.#emitSyntheticClick();
|
|
755
485
|
return false;
|
|
756
486
|
}
|
|
757
487
|
}
|
|
758
488
|
return true;
|
|
759
489
|
};
|
|
760
490
|
this.#syntheticClickEvents = /* @__PURE__ */ new WeakSet();
|
|
761
|
-
this.updateSubmenu = () => this.#updateSubmenu();
|
|
762
491
|
this.addEventListener("expanded-change", this.#expandedChange);
|
|
763
|
-
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* @internal
|
|
495
|
+
*/
|
|
496
|
+
expandedChanged() {
|
|
497
|
+
if (this.$fastController.isConnected) {
|
|
498
|
+
if (this.submenu === void 0) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (this.expanded === false) {
|
|
502
|
+
this.submenu.collapseExpandedItem();
|
|
503
|
+
} else {
|
|
504
|
+
this.currentDirection = direction.getDirection(this);
|
|
505
|
+
}
|
|
506
|
+
this.$emit("expanded-change", this, { bubbles: false });
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* @internal
|
|
511
|
+
*/
|
|
512
|
+
checkedChanged() {
|
|
513
|
+
if (this.$fastController.isConnected) {
|
|
514
|
+
this.$emit("change");
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* @internal
|
|
519
|
+
*/
|
|
520
|
+
connectedCallback() {
|
|
521
|
+
super.connectedCallback();
|
|
522
|
+
defineVividComponent.DOM.queueUpdate(() => {
|
|
523
|
+
this.updateSubmenu();
|
|
524
|
+
});
|
|
525
|
+
this.observer = new MutationObserver(this.updateSubmenu);
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* @internal
|
|
529
|
+
*/
|
|
530
|
+
disconnectedCallback() {
|
|
531
|
+
super.disconnectedCallback();
|
|
532
|
+
this.submenu = void 0;
|
|
533
|
+
if (this.observer !== void 0) {
|
|
534
|
+
this.observer.disconnect();
|
|
535
|
+
this.observer = void 0;
|
|
536
|
+
}
|
|
764
537
|
}
|
|
765
538
|
#submenuArray;
|
|
766
539
|
/**
|
|
@@ -771,7 +544,7 @@ class MenuItem extends MenuItem$1 {
|
|
|
771
544
|
slottedSubmenuChanged(_oldValue, newValue) {
|
|
772
545
|
this.#submenuArray = newValue;
|
|
773
546
|
}
|
|
774
|
-
|
|
547
|
+
updateSubmenu() {
|
|
775
548
|
for (const submenu of this.#submenuArray) {
|
|
776
549
|
this.submenu = submenu;
|
|
777
550
|
this.submenu.anchor = this;
|
|
@@ -788,7 +561,6 @@ class MenuItem extends MenuItem$1 {
|
|
|
788
561
|
this.submenu.open = this.expanded;
|
|
789
562
|
}
|
|
790
563
|
}
|
|
791
|
-
#handleMenuItemKeyDown;
|
|
792
564
|
#syntheticClickEvents;
|
|
793
565
|
/**
|
|
794
566
|
* @internal
|
|
@@ -806,28 +578,52 @@ class MenuItem extends MenuItem$1 {
|
|
|
806
578
|
}
|
|
807
579
|
}
|
|
808
580
|
__decorateClass([
|
|
809
|
-
|
|
581
|
+
defineVividComponent.attr({ mode: "boolean" })
|
|
582
|
+
], MenuItem.prototype, "disabled");
|
|
583
|
+
__decorateClass([
|
|
584
|
+
defineVividComponent.attr({ mode: "boolean" })
|
|
585
|
+
], MenuItem.prototype, "expanded");
|
|
586
|
+
__decorateClass([
|
|
587
|
+
defineVividComponent.attr
|
|
588
|
+
], MenuItem.prototype, "role");
|
|
589
|
+
__decorateClass([
|
|
590
|
+
defineVividComponent.attr({ mode: "boolean" })
|
|
591
|
+
], MenuItem.prototype, "checked");
|
|
592
|
+
__decorateClass([
|
|
593
|
+
defineVividComponent.observable
|
|
594
|
+
], MenuItem.prototype, "submenuRegion");
|
|
595
|
+
__decorateClass([
|
|
596
|
+
defineVividComponent.observable
|
|
597
|
+
], MenuItem.prototype, "hasSubmenu");
|
|
598
|
+
__decorateClass([
|
|
599
|
+
defineVividComponent.observable
|
|
600
|
+
], MenuItem.prototype, "currentDirection");
|
|
601
|
+
__decorateClass([
|
|
602
|
+
defineVividComponent.observable
|
|
603
|
+
], MenuItem.prototype, "submenu");
|
|
604
|
+
__decorateClass([
|
|
605
|
+
defineVividComponent.attr
|
|
810
606
|
], MenuItem.prototype, "text");
|
|
811
607
|
__decorateClass([
|
|
812
|
-
|
|
608
|
+
defineVividComponent.attr({ attribute: "text-secondary" })
|
|
813
609
|
], MenuItem.prototype, "textSecondary");
|
|
814
610
|
__decorateClass([
|
|
815
|
-
|
|
611
|
+
defineVividComponent.attr
|
|
816
612
|
], MenuItem.prototype, "connotation");
|
|
817
613
|
__decorateClass([
|
|
818
|
-
|
|
614
|
+
defineVividComponent.attr({ mode: "boolean", attribute: "check-trailing" })
|
|
819
615
|
], MenuItem.prototype, "checkTrailing");
|
|
820
616
|
__decorateClass([
|
|
821
|
-
|
|
617
|
+
defineVividComponent.attr({ attribute: "check-appearance" })
|
|
822
618
|
], MenuItem.prototype, "checkedAppearance");
|
|
823
619
|
__decorateClass([
|
|
824
|
-
|
|
620
|
+
defineVividComponent.observable
|
|
825
621
|
], MenuItem.prototype, "metaSlottedContent");
|
|
826
622
|
__decorateClass([
|
|
827
|
-
|
|
623
|
+
defineVividComponent.observable
|
|
828
624
|
], MenuItem.prototype, "trailingMetaSlottedContent");
|
|
829
625
|
__decorateClass([
|
|
830
|
-
|
|
626
|
+
defineVividComponent.observable
|
|
831
627
|
], MenuItem.prototype, "slottedSubmenu");
|
|
832
628
|
applyMixins.applyMixins(MenuItem, affix.AffixIcon);
|
|
833
629
|
|
|
@@ -839,7 +635,7 @@ const getIndicatorIcon = (x) => {
|
|
|
839
635
|
const iconStatus = x.checked ? "checked" : "unchecked";
|
|
840
636
|
return `${iconType}-${iconStatus}-2-line`;
|
|
841
637
|
};
|
|
842
|
-
const getClasses = ({
|
|
638
|
+
const getClasses$1 = ({
|
|
843
639
|
connotation,
|
|
844
640
|
disabled,
|
|
845
641
|
checked,
|
|
@@ -871,31 +667,31 @@ function handleClick(x, { event }) {
|
|
|
871
667
|
return x.role === MenuItemRole.presentation;
|
|
872
668
|
}
|
|
873
669
|
function checkIndicator(context) {
|
|
874
|
-
const iconTag = context.tagFor(
|
|
875
|
-
return
|
|
670
|
+
const iconTag = context.tagFor(definition.Icon);
|
|
671
|
+
return defineVividComponent.html`${when.when(
|
|
876
672
|
(x) => x.role === MenuItemRole.menuitemcheckbox || x.role === MenuItemRole.menuitemradio,
|
|
877
|
-
|
|
673
|
+
defineVividComponent.html`<span class="action"><${iconTag} class="icon" name="${(x) => getIndicatorIcon(x)}"></${iconTag}></span>`
|
|
878
674
|
)}`;
|
|
879
675
|
}
|
|
880
676
|
function text() {
|
|
881
|
-
return
|
|
677
|
+
return defineVividComponent.html`${when.when(
|
|
882
678
|
(x) => x.text || x.textSecondary,
|
|
883
|
-
|
|
679
|
+
defineVividComponent.html`<span class="text">
|
|
884
680
|
${when.when(
|
|
885
681
|
(x) => x.text,
|
|
886
|
-
|
|
682
|
+
defineVividComponent.html`<span class="text-primary">${(x) => x.text}</span>`
|
|
887
683
|
)}
|
|
888
684
|
${when.when(
|
|
889
685
|
(x) => x.textSecondary,
|
|
890
|
-
|
|
686
|
+
defineVividComponent.html`<span class="text-secondary">${(x) => x.textSecondary}</span>`
|
|
891
687
|
)}
|
|
892
688
|
</span>`
|
|
893
689
|
)}`;
|
|
894
690
|
}
|
|
895
691
|
const MenuItemTemplate = (context) => {
|
|
896
692
|
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
897
|
-
const iconTag = context.tagFor(
|
|
898
|
-
return
|
|
693
|
+
const iconTag = context.tagFor(definition.Icon);
|
|
694
|
+
return defineVividComponent.html`
|
|
899
695
|
<template
|
|
900
696
|
role="${(x) => x.role ? x.role : MenuItemRole.menuitem}"
|
|
901
697
|
aria-haspopup="${(x) => x.hasSubmenu ? "menu" : void 0}"
|
|
@@ -907,12 +703,12 @@ const MenuItemTemplate = (context) => {
|
|
|
907
703
|
@mouseover="${(x, c) => x.handleMouseOver(c.event)}"
|
|
908
704
|
@mouseout="${(x, c) => x.handleMouseOut(c.event)}"
|
|
909
705
|
>
|
|
910
|
-
<div class="${getClasses}">
|
|
706
|
+
<div class="${getClasses$1}">
|
|
911
707
|
<slot name="meta" ${slotted.slotted("metaSlottedContent")}></slot>
|
|
912
708
|
${checkIndicator(context)}
|
|
913
709
|
${when.when(
|
|
914
710
|
(x) => x.icon,
|
|
915
|
-
|
|
711
|
+
defineVividComponent.html`<span class="decorative"
|
|
916
712
|
>${(x) => affixIconTemplate(x.icon)}</span
|
|
917
713
|
>`
|
|
918
714
|
)}
|
|
@@ -923,30 +719,108 @@ const MenuItemTemplate = (context) => {
|
|
|
923
719
|
></slot>
|
|
924
720
|
${when.when(
|
|
925
721
|
(x) => x.hasSubmenu,
|
|
926
|
-
|
|
722
|
+
defineVividComponent.html`<${iconTag} class="chevron" name="chevron-right-line"></${iconTag}>`
|
|
927
723
|
)}
|
|
928
724
|
</div>
|
|
929
725
|
<slot
|
|
930
726
|
name="submenu"
|
|
931
727
|
${slotted.slotted({
|
|
932
728
|
property: "slottedSubmenu",
|
|
933
|
-
filter: slotted.elements(context.
|
|
729
|
+
filter: slotted.elements(context.tagForNonDependency(menuName))
|
|
934
730
|
})}
|
|
935
731
|
></slot>
|
|
936
732
|
</template>
|
|
937
733
|
`;
|
|
938
734
|
};
|
|
939
735
|
|
|
940
|
-
const menuItemDefinition =
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
736
|
+
const menuItemDefinition = defineVividComponent.defineVividComponent(
|
|
737
|
+
"menu-item",
|
|
738
|
+
MenuItem,
|
|
739
|
+
MenuItemTemplate,
|
|
740
|
+
[definition.iconDefinition],
|
|
741
|
+
{
|
|
742
|
+
styles: styles$1
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
const registerMenuItem = defineVividComponent.createRegisterFunction(menuItemDefinition);
|
|
746
|
+
|
|
747
|
+
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}";
|
|
748
|
+
|
|
749
|
+
const getClasses = ({
|
|
750
|
+
headerSlottedContent,
|
|
751
|
+
actionItemsSlottedContent,
|
|
752
|
+
items
|
|
753
|
+
}) => classNames.classNames(
|
|
754
|
+
"base",
|
|
755
|
+
["hide-header", !headerSlottedContent?.length],
|
|
756
|
+
["hide-actions", !actionItemsSlottedContent?.length],
|
|
757
|
+
["hide-body", items && !items.length]
|
|
758
|
+
);
|
|
759
|
+
function handleEscapeKey(menu, event) {
|
|
760
|
+
if (menu.open && index.handleEscapeKeyAndStopPropogation(event)) {
|
|
761
|
+
menu.open = false;
|
|
762
|
+
}
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
const MenuTemplate = (context) => {
|
|
766
|
+
const popupTag = context.tagFor(definition$1.Popup);
|
|
767
|
+
const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
|
|
768
|
+
function handlePopupEvents(x, e, state) {
|
|
769
|
+
e.stopPropagation();
|
|
770
|
+
x.open = state;
|
|
771
|
+
}
|
|
772
|
+
return defineVividComponent.html`
|
|
773
|
+
<template role="presentation"
|
|
774
|
+
@change="${(x, c) => x._onChange(c.event)}"
|
|
775
|
+
@focusout="${(x, c) => x._onFocusout(c.event)}">
|
|
776
|
+
${anchorSlotTemplate}
|
|
777
|
+
<${popupTag}
|
|
778
|
+
${ref.ref("_popupEl")}
|
|
779
|
+
:placement=${(x) => x.placement}
|
|
780
|
+
:open=${(x) => x.open}
|
|
781
|
+
:anchor=${(x) => x._anchorEl}
|
|
782
|
+
:strategy="${(x) => x.positionStrategy}"
|
|
783
|
+
@keydown="${(x, c) => handleEscapeKey(x, c.event)}"
|
|
784
|
+
@vwc-popup:open="${(x, c) => handlePopupEvents(x, c.event, true)}"
|
|
785
|
+
@vwc-popup:close="${(x, c) => handlePopupEvents(x, c.event, false)}"
|
|
786
|
+
>
|
|
787
|
+
<div class="${getClasses}">
|
|
788
|
+
<div class="header">
|
|
789
|
+
<slot name="header" ${slotted.slotted("headerSlottedContent")}></slot>
|
|
790
|
+
</div>
|
|
791
|
+
<div
|
|
792
|
+
class="body"
|
|
793
|
+
role="menu"
|
|
794
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
795
|
+
@keydown="${(x, c) => x.handleMenuKeyDown(c.event)}"
|
|
796
|
+
@focusout="${(x, c) => x.handleFocusOut(c.event)}"
|
|
797
|
+
>
|
|
798
|
+
<slot ${slotted.slotted("items")}></slot>
|
|
799
|
+
</div>
|
|
800
|
+
<footer class="action-items"><slot name="action-items" ${slotted.slotted(
|
|
801
|
+
"actionItemsSlottedContent"
|
|
802
|
+
)}></slot></footer>
|
|
803
|
+
</div>
|
|
804
|
+
</${popupTag}>
|
|
805
|
+
</template>`;
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
const menuName = "menu";
|
|
809
|
+
const menuDefinition = defineVividComponent.defineVividComponent(
|
|
810
|
+
menuName,
|
|
811
|
+
exports.Menu,
|
|
812
|
+
MenuTemplate,
|
|
813
|
+
[definition$1.popupDefinition, menuItemDefinition],
|
|
814
|
+
{
|
|
815
|
+
styles
|
|
816
|
+
}
|
|
817
|
+
);
|
|
818
|
+
const registerMenu = defineVividComponent.createRegisterFunction(menuDefinition);
|
|
947
819
|
|
|
948
820
|
exports.MenuItem = MenuItem;
|
|
949
821
|
exports.MenuItemRole = MenuItemRole;
|
|
822
|
+
exports.menuDefinition = menuDefinition;
|
|
950
823
|
exports.menuItemDefinition = menuItemDefinition;
|
|
951
|
-
exports.
|
|
824
|
+
exports.menuName = menuName;
|
|
825
|
+
exports.registerMenu = registerMenu;
|
|
952
826
|
exports.registerMenuItem = registerMenuItem;
|