@vonage/vivid 4.16.2 → 4.18.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 +8857 -5894
- package/date-time-picker/index.cjs +5 -0
- package/date-time-picker/index.js +3 -0
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +1 -1
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.cjs +1 -1
- package/empty-state/index.js +1 -1
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -1
- package/file-picker/index.cjs +1 -1
- package/file-picker/index.js +1 -1
- package/header/index.cjs +1 -1
- package/header/index.js +1 -1
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -1
- package/index.cjs +198 -87
- package/index.js +66 -60
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/lib/accordion/definition.d.ts +2 -0
- package/lib/accordion-item/definition.d.ts +2 -0
- package/lib/action-group/action-group.d.ts +449 -3
- package/lib/action-group/definition.d.ts +2 -0
- package/lib/alert/definition.d.ts +2 -0
- package/lib/audio-player/definition.d.ts +2 -0
- package/lib/avatar/definition.d.ts +2 -0
- package/lib/badge/definition.d.ts +2 -0
- package/lib/banner/banner.d.ts +449 -3
- package/lib/banner/definition.d.ts +2 -0
- package/lib/breadcrumb/definition.d.ts +2 -0
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +449 -1
- package/lib/breadcrumb-item/definition.d.ts +2 -0
- package/lib/button/definition.d.ts +2 -0
- package/lib/calendar/calendar.d.ts +2 -0
- package/lib/calendar/definition.d.ts +2 -0
- package/lib/calendar-event/definition.d.ts +2 -0
- package/lib/card/definition.d.ts +2 -0
- package/lib/checkbox/checkbox.d.ts +449 -4
- package/lib/checkbox/definition.d.ts +2 -0
- package/lib/combobox/definition.d.ts +2 -0
- package/lib/components.d.ts +2 -0
- package/lib/data-grid/definition.d.ts +4 -0
- package/lib/date-picker/date-picker.d.ts +2182 -4
- package/lib/date-picker/date-picker.template.d.ts +2 -0
- package/lib/date-picker/definition.d.ts +2 -0
- package/lib/date-range-picker/date-range-picker.d.ts +1110 -4
- package/lib/date-range-picker/date-range-picker.template.d.ts +2 -0
- package/lib/date-range-picker/definition.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +2175 -0
- package/lib/date-time-picker/date-time-picker.template.d.ts +2 -0
- package/lib/date-time-picker/definition.d.ts +1 -0
- package/lib/date-time-picker/locale.d.ts +9 -0
- package/lib/dial-pad/definition.d.ts +2 -0
- package/lib/dialog/definition.d.ts +2 -0
- package/lib/dialog/dialog.d.ts +449 -2
- package/lib/divider/definition.d.ts +2 -0
- package/lib/divider/divider.d.ts +448 -1
- package/lib/empty-state/definition.d.ts +2 -0
- package/lib/enums.d.ts +6 -0
- package/lib/fab/definition.d.ts +2 -0
- package/lib/file-picker/definition.d.ts +2 -0
- package/lib/header/definition.d.ts +2 -0
- package/lib/icon/definition.d.ts +2 -0
- package/lib/layout/definition.d.ts +2 -0
- package/lib/menu/definition.d.ts +2 -0
- package/lib/menu/menu.d.ts +900 -5
- package/lib/menu-item/definition.d.ts +2 -0
- package/lib/nav/definition.d.ts +2 -0
- package/lib/nav-disclosure/definition.d.ts +2 -0
- package/lib/nav-disclosure/nav-disclosure.d.ts +449 -2
- package/lib/nav-item/definition.d.ts +2 -0
- package/lib/note/definition.d.ts +2 -0
- package/lib/number-field/definition.d.ts +2 -0
- package/lib/number-field/number-field.d.ts +450 -3
- package/lib/option/definition.d.ts +2 -0
- package/lib/option/option.d.ts +1 -11
- package/lib/pagination/definition.d.ts +2 -0
- package/lib/popup/definition.d.ts +0 -1
- package/lib/popup/popup.d.ts +25 -0
- package/lib/progress/definition.d.ts +2 -0
- package/lib/progress/progress.d.ts +449 -2
- package/lib/progress-ring/definition.d.ts +2 -0
- package/lib/progress-ring/progress-ring.d.ts +449 -2
- package/lib/radio/definition.d.ts +2 -0
- package/lib/radio-group/definition.d.ts +2 -0
- package/lib/range-slider/definition.d.ts +2 -0
- package/lib/rich-text-editor/definition.d.ts +2 -0
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +2 -0
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +8 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +16 -0
- package/lib/rich-text-editor/rich-text-editor.template.d.ts +4 -0
- package/lib/searchable-select/definition.d.ts +2 -0
- package/lib/select/definition.d.ts +2 -0
- package/lib/select/select.d.ts +1 -5
- package/lib/selectable-box/definition.d.ts +2 -0
- package/lib/selectable-box/selectable-box.d.ts +449 -2
- package/lib/side-drawer/definition.d.ts +2 -0
- package/lib/slider/definition.d.ts +2 -0
- package/lib/slider/slider.d.ts +449 -3
- package/lib/split-button/definition.d.ts +2 -0
- package/lib/split-button/split-button.d.ts +449 -3
- package/lib/switch/definition.d.ts +2 -0
- package/lib/switch/switch.d.ts +449 -2
- package/lib/tab/definition.d.ts +2 -0
- package/lib/tab-panel/definition.d.ts +2 -0
- package/lib/tabs/definition.d.ts +2 -0
- package/lib/tag/definition.d.ts +2 -0
- package/lib/tag-group/definition.d.ts +2 -0
- package/lib/tag-group/tag-group.d.ts +449 -2
- package/lib/text-anchor/text-anchor.d.ts +449 -1
- package/lib/text-area/definition.d.ts +2 -0
- package/lib/text-area/text-area.d.ts +450 -3
- package/lib/text-field/definition.d.ts +2 -0
- package/lib/text-field/text-field.d.ts +450 -7
- package/lib/time-picker/definition.d.ts +2 -0
- package/lib/time-picker/locale.d.ts +0 -2
- package/lib/time-picker/time-picker.d.ts +1053 -9
- package/lib/time-picker/time-picker.template.d.ts +2 -2
- package/lib/toggletip/definition.d.ts +2 -0
- package/lib/toggletip/toggletip.d.ts +454 -4
- package/lib/tooltip/definition.d.ts +2 -0
- package/lib/tooltip/tooltip.d.ts +454 -4
- package/lib/tree-item/definition.d.ts +2 -0
- package/lib/tree-view/definition.d.ts +2 -0
- package/lib/video-player/definition.d.ts +2 -0
- package/locales/de-DE.cjs +29 -5
- package/locales/de-DE.js +29 -5
- package/locales/en-GB.cjs +29 -5
- package/locales/en-GB.js +29 -5
- package/locales/en-US.cjs +29 -5
- package/locales/en-US.js +29 -5
- package/locales/ja-JP.cjs +29 -5
- package/locales/ja-JP.js +29 -5
- package/locales/zh-CN.cjs +29 -5
- package/locales/zh-CN.js +29 -5
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/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 +7 -2
- 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/rich-text-editor/index.cjs +5 -0
- package/rich-text-editor/index.js +3 -0
- 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/Reflector.cjs +71 -0
- package/shared/Reflector.js +69 -0
- package/shared/affix.cjs +2 -4
- package/shared/affix.js +3 -5
- package/shared/anchor.cjs +0 -10
- package/shared/anchor.js +0 -10
- package/shared/anchored.cjs +12 -9
- package/shared/anchored.js +13 -10
- package/shared/aria/delegates-aria.d.ts +454 -0
- package/shared/base-progress.js +1 -1
- package/shared/breadcrumb-item.cjs +2 -1
- package/shared/breadcrumb-item.js +2 -1
- package/shared/button.cjs +2 -13
- package/shared/button.js +2 -13
- package/shared/{presentationDate.cjs → calendar-picker.template.cjs} +681 -853
- package/shared/{presentationDate.js → calendar-picker.template.js} +673 -848
- package/shared/datetime/dateTimeStr.d.ts +6 -0
- package/shared/datetime/presentationDate.d.ts +4 -0
- package/shared/{date-picker/calendar → datetime}/presentationDateRange.d.ts +3 -3
- package/shared/datetime/presentationDateTime.d.ts +4 -0
- package/{lib/time-picker/time → shared/datetime}/time.d.ts +1 -0
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +2 -2
- package/shared/definition10.cjs +1 -0
- package/shared/definition10.js +2 -2
- package/shared/definition11.cjs +9 -12
- package/shared/definition11.js +10 -13
- package/shared/definition12.cjs +1 -1
- package/shared/definition12.js +2 -2
- package/shared/definition13.cjs +15 -2
- package/shared/definition13.js +16 -4
- package/shared/definition14.cjs +4 -3
- package/shared/definition14.js +5 -5
- package/shared/definition15.cjs +4 -11
- package/shared/definition15.js +5 -12
- package/shared/definition16.cjs +44 -48
- package/shared/definition16.js +32 -36
- package/shared/definition17.cjs +4 -1
- package/shared/definition17.js +3 -3
- package/shared/definition18.cjs +59 -94
- package/shared/definition18.js +58 -93
- package/shared/definition19.cjs +79 -43
- package/shared/definition19.js +60 -24
- package/shared/definition2.cjs +1 -0
- package/shared/definition2.js +2 -2
- package/shared/definition20.cjs +253 -219
- package/shared/definition20.js +254 -220
- package/shared/definition21.cjs +201 -286
- package/shared/definition21.js +199 -285
- package/shared/definition22.cjs +302 -31
- package/shared/definition22.js +301 -30
- package/shared/definition23.cjs +37 -57
- package/shared/definition23.js +36 -57
- package/shared/definition24.cjs +50 -69
- package/shared/definition24.js +49 -69
- package/shared/definition25.cjs +75 -2475
- package/shared/definition25.js +74 -2475
- package/shared/definition26.cjs +2480 -49
- package/shared/definition26.js +2480 -49
- package/shared/definition27.cjs +53 -271
- package/shared/definition27.js +52 -269
- package/shared/definition28.cjs +271 -47
- package/shared/definition28.js +269 -47
- package/shared/definition29.cjs +37 -772
- package/shared/definition29.js +36 -767
- package/shared/definition3.cjs +3 -9
- package/shared/definition3.js +4 -11
- package/shared/definition30.cjs +739 -56
- package/shared/definition30.js +733 -56
- package/shared/definition31.cjs +93 -21
- package/shared/definition31.js +92 -21
- package/shared/definition32.cjs +28 -9
- package/shared/definition32.js +27 -9
- package/shared/definition33.cjs +10 -51
- package/shared/definition33.js +9 -51
- package/shared/definition34.cjs +31 -412
- package/shared/definition34.js +31 -413
- package/shared/definition35.cjs +423 -53
- package/shared/definition35.js +424 -54
- package/shared/definition36.cjs +53 -215
- package/shared/definition36.js +53 -215
- package/shared/definition37.cjs +202 -72
- package/shared/definition37.js +201 -71
- package/shared/definition38.cjs +54 -48
- package/shared/definition38.js +53 -48
- package/shared/definition39.cjs +57 -262
- package/shared/definition39.js +56 -262
- package/shared/definition4.cjs +4 -3
- package/shared/definition4.js +5 -5
- package/shared/definition40.cjs +220 -148
- package/shared/definition40.js +220 -148
- package/shared/definition41.cjs +144 -568
- package/shared/definition41.js +144 -569
- package/shared/definition42.cjs +476 -967
- package/shared/definition42.js +477 -969
- package/shared/definition43.cjs +13508 -851
- package/shared/definition43.js +13508 -851
- package/shared/definition44.cjs +1111 -103
- package/shared/definition44.js +1112 -103
- package/shared/definition45.cjs +849 -80
- package/shared/definition45.js +849 -80
- package/shared/definition46.cjs +108 -464
- package/shared/definition46.js +107 -463
- package/shared/definition47.cjs +96 -118
- package/shared/definition47.js +95 -118
- package/shared/definition48.cjs +430 -82
- package/shared/definition48.js +430 -83
- package/shared/definition49.cjs +135 -15
- package/shared/definition49.js +134 -15
- package/shared/definition5.cjs +5 -4
- package/shared/definition5.js +6 -6
- package/shared/definition50.cjs +109 -85
- package/shared/definition50.js +108 -85
- package/shared/definition51.cjs +14 -519
- package/shared/definition51.js +13 -519
- package/shared/definition52.cjs +96 -23
- package/shared/definition52.js +95 -23
- package/shared/definition53.cjs +480 -99
- package/shared/definition53.js +479 -99
- package/shared/definition54.cjs +24 -296
- package/shared/definition54.js +23 -296
- package/shared/definition55.cjs +126 -69
- package/shared/definition55.js +125 -69
- package/shared/definition56.cjs +186 -775
- package/shared/definition56.js +187 -776
- package/shared/definition57.cjs +511 -107
- package/shared/definition57.js +511 -107
- package/shared/definition58.cjs +27 -128
- package/shared/definition58.js +27 -128
- package/shared/definition59.cjs +106 -162
- package/shared/definition59.js +105 -160
- package/shared/definition6.cjs +3 -2
- package/shared/definition6.js +4 -4
- package/shared/definition60.cjs +81 -252
- package/shared/definition60.js +80 -252
- package/shared/definition61.cjs +156 -70156
- package/shared/definition61.js +154 -70156
- package/shared/definition62.cjs +271 -29
- package/shared/definition62.js +270 -28
- package/shared/definition63.cjs +69236 -2018
- package/shared/definition63.js +69235 -2016
- package/shared/definition64.cjs +55 -0
- package/shared/definition64.js +51 -0
- package/shared/definition65.cjs +2195 -0
- package/shared/definition65.js +2190 -0
- package/shared/definition7.cjs +3 -2
- package/shared/definition7.js +4 -4
- package/shared/definition8.cjs +5 -10
- package/shared/definition8.js +6 -12
- package/shared/definition9.cjs +2 -2
- package/shared/definition9.js +3 -3
- package/shared/delegates-aria.cjs +69 -0
- package/shared/delegates-aria.js +67 -0
- package/shared/enums.cjs +8 -0
- package/shared/enums.js +8 -1
- package/shared/form-elements.cjs +8 -8
- package/shared/form-elements.js +9 -9
- package/shared/foundation/anchor/anchor.d.ts +0 -8
- package/shared/foundation/button/button.d.ts +449 -7
- package/shared/foundation/listbox/listbox.d.ts +0 -9
- package/shared/foundation/vivid-element/vivid-element.d.ts +1 -0
- package/shared/listbox.cjs +4 -30
- package/shared/listbox.js +4 -30
- package/shared/localization/Locale.d.ts +6 -2
- package/shared/option.cjs +1 -38
- package/shared/option.js +1 -38
- package/shared/patterns/anchored.d.ts +891 -10
- package/shared/patterns/trapped-focus.d.ts +2 -0
- package/shared/picker-field/locale.d.ts +4 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +558 -0
- package/shared/{date-picker/locale.d.ts → picker-field/mixins/calendar-picker.locale.d.ts} +1 -3
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +555 -0
- package/shared/picker-field/mixins/calendar-segments/calendarGrid.d.ts +17 -0
- package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/monthPickerGrid.d.ts +3 -3
- package/shared/picker-field/mixins/inline-time-picker/columns.d.ts +13 -0
- package/shared/picker-field/mixins/inline-time-picker/definition.d.ts +1 -0
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +15 -0
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.template.d.ts +5 -0
- package/{lib/time-picker/time/picker.d.ts → shared/picker-field/mixins/inline-time-picker/picker-option.d.ts} +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1110 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1626 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +518 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1053 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +1050 -0
- package/shared/picker-field/picker-field.d.ts +11 -0
- package/shared/picker-field/picker-field.form-associated.d.ts +11 -0
- package/shared/picker-field/picker-field.template.d.ts +7 -0
- package/shared/picker-field.template.cjs +315 -0
- package/shared/picker-field.template.js +310 -0
- package/shared/single-date-picker.cjs +46 -0
- package/shared/single-date-picker.js +44 -0
- package/shared/single-value-picker.cjs +77 -0
- package/shared/single-value-picker.js +75 -0
- package/shared/slider.template.cjs +6 -6
- package/shared/slider.template.js +6 -6
- package/shared/text-anchor.cjs +2 -1
- package/shared/text-anchor.js +2 -1
- package/shared/text-anchor.template.cjs +5 -7
- package/shared/text-anchor.template.js +5 -7
- package/shared/time-selection-picker.template.cjs +776 -0
- package/shared/time-selection-picker.template.js +767 -0
- package/shared/utils/mixins.d.ts +3 -0
- package/shared/vivid-element.cjs +3 -0
- package/shared/vivid-element.js +4 -1
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.cjs +1 -1
- package/text-anchor/index.js +2 -2
- 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 +21748 -1
- package/lib/time-picker/time-picker.form-associated.d.ts +0 -11
- package/shared/aria-global.cjs +0 -93
- package/shared/aria-global.js +0 -91
- package/shared/date-picker/calendar/calendarGrid.d.ts +0 -17
- package/shared/date-picker/calendar/presentationDate.d.ts +0 -4
- package/shared/date-picker/date-picker-base.d.ts +0 -21
- package/shared/date-picker/date-picker-base.form-associated.d.ts +0 -11
- package/shared/date-picker/date-picker-base.template.d.ts +0 -3
- package/shared/foundation/patterns/aria-global.d.ts +0 -21
- package/shared/foundation/patterns/index.d.ts +0 -1
- package/shared/text-field2.cjs +0 -575
- package/shared/text-field2.js +0 -572
- package/shared/trapped-focus.cjs +0 -29
- package/shared/trapped-focus.js +0 -27
- /package/shared/{date-picker/calendar → datetime}/dateRange.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/dateStr.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/month.d.ts +0 -0
- /package/{lib/time-picker/time → shared/datetime}/presentationTime.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/year.d.ts +0 -0
- /package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/segment.d.ts +0 -0
package/shared/definition30.cjs
CHANGED
|
@@ -1,13 +1,353 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const definition = require('./
|
|
3
|
+
const definition$1 = require('./definition65.cjs');
|
|
4
|
+
const definition = require('./definition28.cjs');
|
|
4
5
|
const vividElement = require('./vivid-element.cjs');
|
|
5
|
-
const
|
|
6
|
+
const keyCodes = require('./key-codes.cjs');
|
|
6
7
|
const affix = require('./affix.cjs');
|
|
8
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
9
|
+
const direction = require('./direction.cjs');
|
|
10
|
+
const anchored = require('./anchored.cjs');
|
|
11
|
+
const delegatesAria = require('./delegates-aria.cjs');
|
|
12
|
+
const dom = require('./dom.cjs');
|
|
13
|
+
const index = require('./index.cjs');
|
|
7
14
|
const ref = require('./ref.cjs');
|
|
8
15
|
const classNames = require('./class-names.cjs');
|
|
16
|
+
const slotted = require('./slotted.cjs');
|
|
17
|
+
const when = require('./when.cjs');
|
|
18
|
+
|
|
19
|
+
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)}";
|
|
9
20
|
|
|
10
|
-
const
|
|
21
|
+
const MenuItemRole = {
|
|
22
|
+
menuitem: "menuitem",
|
|
23
|
+
menuitemcheckbox: "menuitemcheckbox",
|
|
24
|
+
menuitemradio: "menuitemradio",
|
|
25
|
+
presentation: "presentation"
|
|
26
|
+
};
|
|
27
|
+
const roleForMenuItem = {
|
|
28
|
+
[MenuItemRole.menuitem]: "menuitem",
|
|
29
|
+
[MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
|
|
30
|
+
[MenuItemRole.menuitemradio]: "menuitemradio",
|
|
31
|
+
[MenuItemRole.presentation]: "presentation"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var __defProp$1 = Object.defineProperty;
|
|
35
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
36
|
+
var result = void 0 ;
|
|
37
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
38
|
+
if (decorator = decorators[i])
|
|
39
|
+
result = (decorator(target, key, result) ) || result;
|
|
40
|
+
if (result) __defProp$1(target, key, result);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
const _Menu = class _Menu extends anchored.Anchored(delegatesAria.DelegatesAria(vividElement.VividElement)) {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
this.expandedItem = null;
|
|
47
|
+
/**
|
|
48
|
+
* The index of the focusable element in the items array
|
|
49
|
+
* defaults to -1
|
|
50
|
+
*/
|
|
51
|
+
this.focusIndex = -1;
|
|
52
|
+
/**
|
|
53
|
+
* if focus is moving out of the menu, reset to a stable initial state
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
this.handleFocusOut = (e) => {
|
|
57
|
+
if (!this.contains(e.relatedTarget) && this.menuItems !== void 0 && this.menuItems.length) {
|
|
58
|
+
this.collapseExpandedItem();
|
|
59
|
+
const focusIndex = this.menuItems.findIndex(
|
|
60
|
+
this.isFocusableElement
|
|
61
|
+
);
|
|
62
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
63
|
+
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
64
|
+
this.focusIndex = focusIndex;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
this.handleItemFocus = (e) => {
|
|
68
|
+
const targetItem = e.target;
|
|
69
|
+
if (this.menuItems !== void 0 && targetItem !== this.menuItems[this.focusIndex]) {
|
|
70
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
71
|
+
this.focusIndex = this.menuItems.indexOf(targetItem);
|
|
72
|
+
targetItem.setAttribute("tabindex", "0");
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
this.handleExpandedChanged = (e) => {
|
|
76
|
+
const changedItem = e.target;
|
|
77
|
+
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
|
|
78
|
+
this.expandedItem = null;
|
|
79
|
+
}
|
|
80
|
+
if (changedItem.expanded) {
|
|
81
|
+
this.expandedItem = changedItem;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
this.removeItemListeners = () => {
|
|
85
|
+
if (this.menuItems !== void 0) {
|
|
86
|
+
this.menuItems.forEach((item) => {
|
|
87
|
+
item.removeEventListener("expanded-change", this.handleExpandedChanged);
|
|
88
|
+
item.removeEventListener(
|
|
89
|
+
"focus",
|
|
90
|
+
this.handleItemFocus
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
this.setItems = () => {
|
|
96
|
+
const newItems = this.domChildren();
|
|
97
|
+
this.removeItemListeners();
|
|
98
|
+
this.menuItems = newItems;
|
|
99
|
+
const menuItems = this.menuItems.filter(this.isMenuItemElement);
|
|
100
|
+
if (menuItems.length) {
|
|
101
|
+
this.focusIndex = 0;
|
|
102
|
+
}
|
|
103
|
+
menuItems.forEach((item, index) => {
|
|
104
|
+
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
105
|
+
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
106
|
+
item.addEventListener("focus", this.handleItemFocus);
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* check if the item is a menu item
|
|
111
|
+
*/
|
|
112
|
+
this.isMenuItemElement = (el) => {
|
|
113
|
+
return dom.isHTMLElement(el) && Object.prototype.hasOwnProperty.call(
|
|
114
|
+
_Menu.focusableElementRoles,
|
|
115
|
+
el.getAttribute("role")
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* check if the item is focusable
|
|
120
|
+
*/
|
|
121
|
+
this.isFocusableElement = (el) => {
|
|
122
|
+
return this.isMenuItemElement(el);
|
|
123
|
+
};
|
|
124
|
+
this.placement = "bottom";
|
|
125
|
+
this.autoDismiss = false;
|
|
126
|
+
this.positionStrategy = "fixed";
|
|
127
|
+
this.open = false;
|
|
128
|
+
this.#onAnchorClick = () => {
|
|
129
|
+
if (this.#triggerBehaviour === "off") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (this.#triggerBehaviour === "legacy" && this.open) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const newValue = !this.open;
|
|
136
|
+
vividElement.DOM.queueUpdate(() => this.open = newValue);
|
|
137
|
+
};
|
|
138
|
+
this._onFocusout = (e) => {
|
|
139
|
+
const focusTarget = e.relatedTarget;
|
|
140
|
+
const focusMovedAway = !this.contains(focusTarget) && !this._anchorEl?.contains(focusTarget);
|
|
141
|
+
if (this.autoDismiss && focusMovedAway) {
|
|
142
|
+
this.open = false;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
itemsChanged() {
|
|
150
|
+
if (this.$fastController.isConnected && this.menuItems !== void 0) {
|
|
151
|
+
this.setItems();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
static {
|
|
155
|
+
this.focusableElementRoles = roleForMenuItem;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
160
|
+
connectedCallback() {
|
|
161
|
+
super.connectedCallback();
|
|
162
|
+
vividElement.DOM.queueUpdate(() => {
|
|
163
|
+
this.setItems();
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
disconnectedCallback() {
|
|
170
|
+
super.disconnectedCallback();
|
|
171
|
+
this.removeItemListeners();
|
|
172
|
+
this.menuItems = void 0;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Moves focus into the menu. If there is a child with the `autofocus` attribute, it will be focused.
|
|
176
|
+
* Otherwise, the first focusable child will be focused.
|
|
177
|
+
*
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
focus() {
|
|
181
|
+
const autoFocusElement = this.querySelector(
|
|
182
|
+
'[autofocus]:not([slot="anchor"])'
|
|
183
|
+
);
|
|
184
|
+
if (autoFocusElement instanceof HTMLElement) {
|
|
185
|
+
autoFocusElement.focus();
|
|
186
|
+
} else {
|
|
187
|
+
this.setFocus(0, 1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Collapses any expanded Menu Items.
|
|
192
|
+
*
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
collapseExpandedItem() {
|
|
196
|
+
if (this.expandedItem !== null) {
|
|
197
|
+
this.expandedItem.expanded = false;
|
|
198
|
+
this.expandedItem = null;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
handleMenuKeyDown(e) {
|
|
205
|
+
if (e.defaultPrevented || this.menuItems === void 0) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
switch (e.key) {
|
|
209
|
+
case keyCodes.keyArrowDown:
|
|
210
|
+
this.setFocus(this.focusIndex + 1, 1);
|
|
211
|
+
return;
|
|
212
|
+
case keyCodes.keyArrowUp:
|
|
213
|
+
this.setFocus(this.focusIndex - 1, -1);
|
|
214
|
+
return;
|
|
215
|
+
case keyCodes.keyEnd:
|
|
216
|
+
this.setFocus(this.menuItems.length - 1, -1);
|
|
217
|
+
return;
|
|
218
|
+
case keyCodes.keyHome:
|
|
219
|
+
this.setFocus(0, 1);
|
|
220
|
+
return;
|
|
221
|
+
default:
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* get an array of valid DOM children
|
|
227
|
+
*/
|
|
228
|
+
domChildren() {
|
|
229
|
+
return Array.from(this.children).filter((child) => !child.hasAttribute("hidden")).filter((child) => !child.hasAttribute("slot"));
|
|
230
|
+
}
|
|
231
|
+
setFocus(focusIndex, adjustment) {
|
|
232
|
+
if (this.menuItems === void 0) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
|
|
236
|
+
const child = this.menuItems[focusIndex];
|
|
237
|
+
if (this.isFocusableElement(child)) {
|
|
238
|
+
if (this.focusIndex > -1 && this.menuItems.length >= this.focusIndex - 1) {
|
|
239
|
+
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
240
|
+
}
|
|
241
|
+
this.focusIndex = focusIndex;
|
|
242
|
+
child.setAttribute("tabindex", "0");
|
|
243
|
+
child.focus();
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
focusIndex += adjustment;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
get #triggerBehaviour() {
|
|
250
|
+
return this.trigger ?? "legacy";
|
|
251
|
+
}
|
|
252
|
+
openChanged(_, newValue) {
|
|
253
|
+
if (newValue) {
|
|
254
|
+
this._popupEl?.show().then(() => this.focus());
|
|
255
|
+
}
|
|
256
|
+
newValue ? this.$emit("open", void 0, { bubbles: false }) : this.$emit("close", void 0, { bubbles: false });
|
|
257
|
+
if (this._anchorEl) {
|
|
258
|
+
this.#updateAnchor(this._anchorEl);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* @internal
|
|
263
|
+
*/
|
|
264
|
+
_anchorElChanged(oldValue, newValue) {
|
|
265
|
+
if (oldValue) this.#cleanupAnchor(oldValue);
|
|
266
|
+
if (newValue) this.#setupAnchor(newValue);
|
|
267
|
+
}
|
|
268
|
+
#setupAnchor(a) {
|
|
269
|
+
a.addEventListener("click", this.#onAnchorClick, true);
|
|
270
|
+
a.addEventListener("focusout", this._onFocusout);
|
|
271
|
+
a.setAttribute("aria-haspopup", "menu");
|
|
272
|
+
this.#updateAnchor(a);
|
|
273
|
+
}
|
|
274
|
+
#updateAnchor(a) {
|
|
275
|
+
a.setAttribute("aria-expanded", this.open.toString());
|
|
276
|
+
}
|
|
277
|
+
#cleanupAnchor(a) {
|
|
278
|
+
a.removeEventListener("click", this.#onAnchorClick, true);
|
|
279
|
+
a.removeEventListener("focusout", this._onFocusout);
|
|
280
|
+
a.removeAttribute("aria-haspopup");
|
|
281
|
+
a.removeAttribute("aria-expanded");
|
|
282
|
+
}
|
|
283
|
+
#onAnchorClick;
|
|
284
|
+
/**
|
|
285
|
+
* @internal
|
|
286
|
+
*/
|
|
287
|
+
_onChange(e) {
|
|
288
|
+
if (this.menuItems === void 0) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const clickedOnNonCheckboxMenuItem = e.target instanceof HTMLElement && (e.target.role === "menuitem" || e.target.role === "menuitemradio");
|
|
292
|
+
if (this.#triggerBehaviour === "auto" && clickedOnNonCheckboxMenuItem) {
|
|
293
|
+
this.open = false;
|
|
294
|
+
}
|
|
295
|
+
const changedMenuItem = e.target;
|
|
296
|
+
const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
|
|
297
|
+
if (changeItemIndex === -1) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (changedMenuItem.role === "menuitemradio" && changedMenuItem.checked) {
|
|
301
|
+
for (let i = changeItemIndex - 1; i >= 0; --i) {
|
|
302
|
+
const item = this.menuItems[i];
|
|
303
|
+
const role = item.getAttribute("role");
|
|
304
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
305
|
+
item.checked = false;
|
|
306
|
+
}
|
|
307
|
+
if (role === "separator") {
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const maxIndex = this.menuItems.length - 1;
|
|
312
|
+
for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
|
|
313
|
+
const item = this.menuItems[i];
|
|
314
|
+
const role = item.getAttribute("role");
|
|
315
|
+
if (role === MenuItemRole.menuitemradio) {
|
|
316
|
+
item.checked = false;
|
|
317
|
+
}
|
|
318
|
+
if (role === "separator") {
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
__decorateClass$1([
|
|
327
|
+
vividElement.observable
|
|
328
|
+
], _Menu.prototype, "items");
|
|
329
|
+
__decorateClass$1([
|
|
330
|
+
vividElement.attr({ mode: "fromView" })
|
|
331
|
+
], _Menu.prototype, "placement");
|
|
332
|
+
__decorateClass$1([
|
|
333
|
+
vividElement.attr
|
|
334
|
+
], _Menu.prototype, "trigger");
|
|
335
|
+
__decorateClass$1([
|
|
336
|
+
vividElement.attr({ mode: "boolean", attribute: "auto-dismiss" })
|
|
337
|
+
], _Menu.prototype, "autoDismiss");
|
|
338
|
+
__decorateClass$1([
|
|
339
|
+
vividElement.attr({ mode: "fromView", attribute: "position-strategy" })
|
|
340
|
+
], _Menu.prototype, "positionStrategy");
|
|
341
|
+
__decorateClass$1([
|
|
342
|
+
vividElement.attr({ mode: "boolean" })
|
|
343
|
+
], _Menu.prototype, "open");
|
|
344
|
+
__decorateClass$1([
|
|
345
|
+
vividElement.observable
|
|
346
|
+
], _Menu.prototype, "headerSlottedContent");
|
|
347
|
+
__decorateClass$1([
|
|
348
|
+
vividElement.observable
|
|
349
|
+
], _Menu.prototype, "actionItemsSlottedContent");
|
|
350
|
+
let Menu = _Menu;
|
|
11
351
|
|
|
12
352
|
var __defProp = Object.defineProperty;
|
|
13
353
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -18,93 +358,436 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
18
358
|
if (result) __defProp(target, key, result);
|
|
19
359
|
return result;
|
|
20
360
|
};
|
|
21
|
-
|
|
361
|
+
var CheckAppearance = /* @__PURE__ */ ((CheckAppearance2) => {
|
|
362
|
+
CheckAppearance2["Normal"] = "normal";
|
|
363
|
+
CheckAppearance2["TickOnly"] = "tick-only";
|
|
364
|
+
return CheckAppearance2;
|
|
365
|
+
})(CheckAppearance || {});
|
|
366
|
+
class MenuItem extends vividElement.VividElement {
|
|
22
367
|
constructor() {
|
|
23
|
-
super(
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
this
|
|
27
|
-
|
|
28
|
-
|
|
368
|
+
super();
|
|
369
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
370
|
+
this.role = MenuItemRole.menuitem;
|
|
371
|
+
this.hasSubmenu = false;
|
|
372
|
+
this.currentDirection = direction.Direction.ltr;
|
|
373
|
+
/**
|
|
374
|
+
* @internal
|
|
375
|
+
*/
|
|
376
|
+
this.handleMenuItemClick = (e) => {
|
|
377
|
+
if (e.defaultPrevented || this.disabled) {
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
this.invoke();
|
|
381
|
+
return false;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* @internal
|
|
385
|
+
*/
|
|
386
|
+
this.handleMouseOver = (_) => {
|
|
387
|
+
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
this.expanded = true;
|
|
391
|
+
return false;
|
|
29
392
|
};
|
|
393
|
+
/**
|
|
394
|
+
* @internal
|
|
395
|
+
*/
|
|
396
|
+
this.handleMouseOut = (_) => {
|
|
397
|
+
if (!this.expanded || this.contains(document.activeElement)) {
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
this.expanded = false;
|
|
401
|
+
return false;
|
|
402
|
+
};
|
|
403
|
+
this.invoke = () => {
|
|
404
|
+
if (this.disabled) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
switch (this.role) {
|
|
408
|
+
case MenuItemRole.menuitemcheckbox:
|
|
409
|
+
this.checked = !this.checked;
|
|
410
|
+
break;
|
|
411
|
+
case MenuItemRole.menuitem:
|
|
412
|
+
this.updateSubmenu();
|
|
413
|
+
if (this.hasSubmenu) {
|
|
414
|
+
this.expanded = true;
|
|
415
|
+
} else {
|
|
416
|
+
this.$emit("change");
|
|
417
|
+
}
|
|
418
|
+
break;
|
|
419
|
+
case MenuItemRole.menuitemradio:
|
|
420
|
+
if (!this.checked) {
|
|
421
|
+
this.checked = true;
|
|
422
|
+
}
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
this.checkTrailing = false;
|
|
427
|
+
this.#submenuArray = [];
|
|
428
|
+
/**
|
|
429
|
+
* @internal
|
|
430
|
+
*/
|
|
431
|
+
this.handleMenuItemKeyDown = (e) => {
|
|
432
|
+
if (e.defaultPrevented) {
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
switch (e.key) {
|
|
436
|
+
case keyCodes.keyEnter:
|
|
437
|
+
case keyCodes.keySpace:
|
|
438
|
+
this.invoke();
|
|
439
|
+
if (!this.disabled) {
|
|
440
|
+
this.#emitSyntheticClick();
|
|
441
|
+
}
|
|
442
|
+
return false;
|
|
443
|
+
case keyCodes.keyArrowRight:
|
|
444
|
+
if (this.hasSubmenu) {
|
|
445
|
+
this.expanded = true;
|
|
446
|
+
this.#emitSyntheticClick();
|
|
447
|
+
}
|
|
448
|
+
return false;
|
|
449
|
+
case keyCodes.keyArrowLeft:
|
|
450
|
+
if (this.expanded) {
|
|
451
|
+
this.#emitSyntheticClick();
|
|
452
|
+
this.expanded = false;
|
|
453
|
+
this.focus();
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return true;
|
|
458
|
+
};
|
|
459
|
+
this.#syntheticClickEvents = /* @__PURE__ */ new WeakSet();
|
|
460
|
+
this.addEventListener("expanded-change", this.#expandedChange);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @internal
|
|
464
|
+
*/
|
|
465
|
+
expandedChanged() {
|
|
466
|
+
if (this.$fastController.isConnected) {
|
|
467
|
+
if (this.submenu === void 0) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
if (this.expanded === false) {
|
|
471
|
+
this.submenu.collapseExpandedItem();
|
|
472
|
+
} else {
|
|
473
|
+
this.currentDirection = direction.getDirection(this);
|
|
474
|
+
}
|
|
475
|
+
this.$emit("expanded-change", this, { bubbles: false });
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* @internal
|
|
480
|
+
*/
|
|
481
|
+
checkedChanged() {
|
|
482
|
+
if (this.$fastController.isConnected) {
|
|
483
|
+
this.$emit("change");
|
|
484
|
+
}
|
|
30
485
|
}
|
|
31
486
|
/**
|
|
32
487
|
* @internal
|
|
33
488
|
*/
|
|
34
489
|
connectedCallback() {
|
|
35
490
|
super.connectedCallback();
|
|
36
|
-
|
|
37
|
-
|
|
491
|
+
vividElement.DOM.queueUpdate(() => {
|
|
492
|
+
this.updateSubmenu();
|
|
493
|
+
});
|
|
494
|
+
this.observer = new MutationObserver(this.updateSubmenu);
|
|
38
495
|
}
|
|
39
496
|
/**
|
|
40
497
|
* @internal
|
|
41
498
|
*/
|
|
42
499
|
disconnectedCallback() {
|
|
43
500
|
super.disconnectedCallback();
|
|
44
|
-
this.
|
|
501
|
+
this.submenu = void 0;
|
|
502
|
+
if (this.observer !== void 0) {
|
|
503
|
+
this.observer.disconnect();
|
|
504
|
+
this.observer = void 0;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
#submenuArray;
|
|
508
|
+
/**
|
|
509
|
+
*
|
|
510
|
+
*
|
|
511
|
+
* @internal
|
|
512
|
+
*/
|
|
513
|
+
slottedSubmenuChanged(_oldValue, newValue) {
|
|
514
|
+
this.#submenuArray = newValue;
|
|
515
|
+
}
|
|
516
|
+
updateSubmenu() {
|
|
517
|
+
for (const submenu of this.#submenuArray) {
|
|
518
|
+
this.submenu = submenu;
|
|
519
|
+
this.submenu.anchor = this;
|
|
520
|
+
this.submenu.placement = "right-start";
|
|
521
|
+
this.submenu.collapseExpandedItem = () => this.#collapseExpandedItem();
|
|
522
|
+
}
|
|
523
|
+
this.hasSubmenu = this.submenu === void 0 ? false : true;
|
|
524
|
+
}
|
|
525
|
+
#collapseExpandedItem() {
|
|
526
|
+
this.expanded = false;
|
|
527
|
+
}
|
|
528
|
+
#expandedChange() {
|
|
529
|
+
if (this.hasSubmenu) {
|
|
530
|
+
this.submenu.open = this.expanded;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
#syntheticClickEvents;
|
|
534
|
+
/**
|
|
535
|
+
* @internal
|
|
536
|
+
*/
|
|
537
|
+
_isSyntheticClickEvent(event) {
|
|
538
|
+
return this.#syntheticClickEvents.has(event);
|
|
539
|
+
}
|
|
540
|
+
#emitSyntheticClick() {
|
|
541
|
+
const mouseEvent = new MouseEvent("click", {
|
|
542
|
+
bubbles: true,
|
|
543
|
+
composed: true
|
|
544
|
+
});
|
|
545
|
+
this.#syntheticClickEvents.add(mouseEvent);
|
|
546
|
+
this.dispatchEvent(mouseEvent);
|
|
45
547
|
}
|
|
46
|
-
#onToggle;
|
|
47
548
|
}
|
|
549
|
+
__decorateClass([
|
|
550
|
+
vividElement.attr({ mode: "boolean" })
|
|
551
|
+
], MenuItem.prototype, "disabled");
|
|
552
|
+
__decorateClass([
|
|
553
|
+
vividElement.attr({ mode: "boolean" })
|
|
554
|
+
], MenuItem.prototype, "expanded");
|
|
48
555
|
__decorateClass([
|
|
49
556
|
vividElement.attr
|
|
50
|
-
],
|
|
557
|
+
], MenuItem.prototype, "role");
|
|
558
|
+
__decorateClass([
|
|
559
|
+
vividElement.attr({ mode: "boolean" })
|
|
560
|
+
], MenuItem.prototype, "checked");
|
|
561
|
+
__decorateClass([
|
|
562
|
+
vividElement.observable
|
|
563
|
+
], MenuItem.prototype, "hasSubmenu");
|
|
564
|
+
__decorateClass([
|
|
565
|
+
vividElement.observable
|
|
566
|
+
], MenuItem.prototype, "currentDirection");
|
|
567
|
+
__decorateClass([
|
|
568
|
+
vividElement.observable
|
|
569
|
+
], MenuItem.prototype, "submenu");
|
|
51
570
|
__decorateClass([
|
|
52
571
|
vividElement.attr
|
|
53
|
-
],
|
|
572
|
+
], MenuItem.prototype, "text");
|
|
573
|
+
__decorateClass([
|
|
574
|
+
vividElement.attr({ attribute: "text-secondary" })
|
|
575
|
+
], MenuItem.prototype, "textSecondary");
|
|
54
576
|
__decorateClass([
|
|
55
577
|
vividElement.attr
|
|
56
|
-
],
|
|
578
|
+
], MenuItem.prototype, "connotation");
|
|
57
579
|
__decorateClass([
|
|
58
|
-
vividElement.attr({ mode: "boolean" })
|
|
59
|
-
],
|
|
580
|
+
vividElement.attr({ mode: "boolean", attribute: "check-trailing" })
|
|
581
|
+
], MenuItem.prototype, "checkTrailing");
|
|
582
|
+
__decorateClass([
|
|
583
|
+
vividElement.attr({ attribute: "check-appearance" })
|
|
584
|
+
], MenuItem.prototype, "checkedAppearance");
|
|
585
|
+
__decorateClass([
|
|
586
|
+
vividElement.observable
|
|
587
|
+
], MenuItem.prototype, "metaSlottedContent");
|
|
588
|
+
__decorateClass([
|
|
589
|
+
vividElement.observable
|
|
590
|
+
], MenuItem.prototype, "trailingMetaSlottedContent");
|
|
60
591
|
__decorateClass([
|
|
61
|
-
vividElement.
|
|
62
|
-
],
|
|
63
|
-
applyMixins.applyMixins(
|
|
592
|
+
vividElement.observable
|
|
593
|
+
], MenuItem.prototype, "slottedSubmenu");
|
|
594
|
+
applyMixins.applyMixins(MenuItem, affix.AffixIcon);
|
|
64
595
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
596
|
+
const getIndicatorIcon = (x) => {
|
|
597
|
+
if (x.checkedAppearance === CheckAppearance.TickOnly) {
|
|
598
|
+
return x.checked ? "check-line" : "";
|
|
599
|
+
}
|
|
600
|
+
const iconType = x.role === MenuItemRole.menuitemcheckbox ? "checkbox" : "radio";
|
|
601
|
+
const iconStatus = x.checked ? "checked" : "unchecked";
|
|
602
|
+
return `${iconType}-${iconStatus}-2-line`;
|
|
603
|
+
};
|
|
604
|
+
const getClasses$1 = ({
|
|
605
|
+
connotation,
|
|
606
|
+
disabled,
|
|
607
|
+
checked,
|
|
608
|
+
role,
|
|
609
|
+
text: text2,
|
|
610
|
+
textSecondary,
|
|
611
|
+
icon,
|
|
612
|
+
metaSlottedContent,
|
|
613
|
+
checkTrailing
|
|
614
|
+
}) => classNames.classNames(
|
|
615
|
+
"base",
|
|
616
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
617
|
+
["disabled", Boolean(disabled)],
|
|
618
|
+
["selected", role !== MenuItemRole.menuitem && Boolean(checked)],
|
|
619
|
+
[
|
|
620
|
+
"trailing",
|
|
621
|
+
role !== MenuItemRole.menuitem && (checkTrailing || Boolean(icon))
|
|
622
|
+
],
|
|
623
|
+
["item-checkbox", role === MenuItemRole.menuitemcheckbox],
|
|
624
|
+
["item-radio", role === MenuItemRole.menuitemradio],
|
|
625
|
+
["two-lines", Boolean(text2?.length) && Boolean(textSecondary?.length)],
|
|
626
|
+
["has-meta", Boolean(metaSlottedContent?.length)]
|
|
72
627
|
);
|
|
73
|
-
|
|
628
|
+
function handleClick(x, { event }) {
|
|
629
|
+
if (x._isSyntheticClickEvent(event)) {
|
|
630
|
+
return true;
|
|
631
|
+
}
|
|
632
|
+
x.handleMenuItemClick(event);
|
|
633
|
+
return x.role === MenuItemRole.presentation;
|
|
634
|
+
}
|
|
635
|
+
function checkIndicator(context) {
|
|
636
|
+
const iconTag = context.tagFor(definition.Icon);
|
|
637
|
+
return vividElement.html`${when.when(
|
|
638
|
+
(x) => x.role === MenuItemRole.menuitemcheckbox || x.role === MenuItemRole.menuitemradio,
|
|
639
|
+
vividElement.html`<span class="action"><${iconTag} class="icon" name="${(x) => getIndicatorIcon(x)}"></${iconTag}></span>`
|
|
640
|
+
)}`;
|
|
641
|
+
}
|
|
642
|
+
function text() {
|
|
643
|
+
return vividElement.html`${when.when(
|
|
644
|
+
(x) => x.text || x.textSecondary,
|
|
645
|
+
vividElement.html`<span class="text">
|
|
646
|
+
${when.when(
|
|
647
|
+
(x) => x.text,
|
|
648
|
+
vividElement.html`<span class="text-primary">${(x) => x.text}</span>`
|
|
649
|
+
)}
|
|
650
|
+
${when.when(
|
|
651
|
+
(x) => x.textSecondary,
|
|
652
|
+
vividElement.html`<span class="text-secondary">${(x) => x.textSecondary}</span>`
|
|
653
|
+
)}
|
|
654
|
+
</span>`
|
|
655
|
+
)}`;
|
|
656
|
+
}
|
|
657
|
+
const MenuItemTemplate = (context) => {
|
|
74
658
|
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
75
659
|
const iconTag = context.tagFor(definition.Icon);
|
|
76
|
-
return vividElement.html
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
aria-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
660
|
+
return vividElement.html`
|
|
661
|
+
<template
|
|
662
|
+
role="${(x) => x.role ? x.role : MenuItemRole.menuitem}"
|
|
663
|
+
aria-haspopup="${(x) => x.hasSubmenu ? "menu" : void 0}"
|
|
664
|
+
aria-checked="${(x) => x.role !== MenuItemRole.menuitem ? x.checked : void 0}"
|
|
665
|
+
aria-disabled="${(x) => x.disabled}"
|
|
666
|
+
aria-expanded="${(x) => x.expanded}"
|
|
667
|
+
@keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}"
|
|
668
|
+
@click="${handleClick}"
|
|
669
|
+
@mouseover="${(x, c) => x.handleMouseOver(c.event)}"
|
|
670
|
+
@mouseout="${(x, c) => x.handleMouseOut(c.event)}"
|
|
671
|
+
>
|
|
672
|
+
<div class="${getClasses$1}">
|
|
673
|
+
<slot name="meta" ${slotted.slotted("metaSlottedContent")}></slot>
|
|
674
|
+
${checkIndicator(context)}
|
|
675
|
+
${when.when(
|
|
676
|
+
(x) => x.icon,
|
|
677
|
+
vividElement.html`<span class="decorative"
|
|
678
|
+
>${(x) => affixIconTemplate(x.icon)}</span
|
|
679
|
+
>`
|
|
680
|
+
)}
|
|
681
|
+
${text()}
|
|
682
|
+
<slot
|
|
683
|
+
name="trailing-meta"
|
|
684
|
+
${slotted.slotted("trailingMetaSlottedContent")}
|
|
685
|
+
></slot>
|
|
686
|
+
${when.when(
|
|
687
|
+
(x) => x.hasSubmenu,
|
|
688
|
+
vividElement.html`<${iconTag} class="chevron" name="chevron-right-line"></${iconTag}>`
|
|
689
|
+
)}
|
|
690
|
+
</div>
|
|
691
|
+
<slot
|
|
692
|
+
name="submenu"
|
|
693
|
+
${slotted.slotted({
|
|
694
|
+
property: "slottedSubmenu",
|
|
695
|
+
filter: slotted.elements(context.tagForNonDependency(menuName))
|
|
696
|
+
})}
|
|
697
|
+
></slot>
|
|
698
|
+
</template>
|
|
93
699
|
`;
|
|
94
700
|
};
|
|
95
701
|
|
|
96
|
-
const
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
702
|
+
const menuItemDefinition = vividElement.defineVividComponent(
|
|
703
|
+
"menu-item",
|
|
704
|
+
MenuItem,
|
|
705
|
+
MenuItemTemplate,
|
|
100
706
|
[definition.iconDefinition],
|
|
101
707
|
{
|
|
102
|
-
styles
|
|
708
|
+
styles: styles$1
|
|
103
709
|
}
|
|
104
710
|
);
|
|
105
|
-
const
|
|
106
|
-
|
|
711
|
+
const registerMenuItem = vividElement.createRegisterFunction(menuItemDefinition);
|
|
712
|
+
|
|
713
|
+
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);min-inline-size:var(--menu-min-inline-size);padding-block:8px}@media not all and (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size, 300px)}}@media (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size)}}::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}";
|
|
714
|
+
|
|
715
|
+
const getClasses = ({
|
|
716
|
+
headerSlottedContent,
|
|
717
|
+
actionItemsSlottedContent,
|
|
718
|
+
items
|
|
719
|
+
}) => classNames.classNames(
|
|
720
|
+
"base",
|
|
721
|
+
["hide-header", !headerSlottedContent?.length],
|
|
722
|
+
["hide-actions", !actionItemsSlottedContent?.length],
|
|
723
|
+
["hide-body", items && !items.length]
|
|
724
|
+
);
|
|
725
|
+
function handleEscapeKey(menu, event) {
|
|
726
|
+
if (menu.open && index.handleEscapeKeyAndStopPropogation(event)) {
|
|
727
|
+
menu.open = false;
|
|
728
|
+
}
|
|
729
|
+
return true;
|
|
730
|
+
}
|
|
731
|
+
const MenuTemplate = (context) => {
|
|
732
|
+
const popupTag = context.tagFor(definition$1.Popup);
|
|
733
|
+
const anchorSlotTemplate = anchored.anchorSlotTemplateFactory();
|
|
734
|
+
function handlePopupEvents(x, e, state) {
|
|
735
|
+
e.stopPropagation();
|
|
736
|
+
x.open = state;
|
|
737
|
+
}
|
|
738
|
+
return vividElement.html`
|
|
739
|
+
<template role="presentation"
|
|
740
|
+
@change="${(x, c) => x._onChange(c.event)}"
|
|
741
|
+
@focusout="${(x, c) => x._onFocusout(c.event)}">
|
|
742
|
+
${anchorSlotTemplate}
|
|
743
|
+
<${popupTag}
|
|
744
|
+
${ref.ref("_popupEl")}
|
|
745
|
+
:placement=${(x) => x.placement}
|
|
746
|
+
:open=${(x) => x.open}
|
|
747
|
+
:anchor=${(x) => x._anchorEl}
|
|
748
|
+
:strategy="${(x) => x.positionStrategy}"
|
|
749
|
+
@keydown="${(x, c) => handleEscapeKey(x, c.event)}"
|
|
750
|
+
@vwc-popup:open="${(x, c) => handlePopupEvents(x, c.event, true)}"
|
|
751
|
+
@vwc-popup:close="${(x, c) => handlePopupEvents(x, c.event, false)}"
|
|
752
|
+
>
|
|
753
|
+
<div class="${getClasses}">
|
|
754
|
+
<div class="header">
|
|
755
|
+
<slot name="header" ${slotted.slotted("headerSlottedContent")}></slot>
|
|
756
|
+
</div>
|
|
757
|
+
<div
|
|
758
|
+
class="body"
|
|
759
|
+
role="menu"
|
|
760
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
761
|
+
@keydown="${(x, c) => x.handleMenuKeyDown(c.event)}"
|
|
762
|
+
@focusout="${(x, c) => x.handleFocusOut(c.event)}"
|
|
763
|
+
>
|
|
764
|
+
<slot ${slotted.slotted("items")}></slot>
|
|
765
|
+
</div>
|
|
766
|
+
<footer class="action-items"><slot name="action-items" ${slotted.slotted(
|
|
767
|
+
"actionItemsSlottedContent"
|
|
768
|
+
)}></slot></footer>
|
|
769
|
+
</div>
|
|
770
|
+
</${popupTag}>
|
|
771
|
+
</template>`;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
const menuName = "menu";
|
|
775
|
+
const menuDefinition = vividElement.defineVividComponent(
|
|
776
|
+
menuName,
|
|
777
|
+
Menu,
|
|
778
|
+
MenuTemplate,
|
|
779
|
+
[definition$1.popupDefinition, menuItemDefinition],
|
|
780
|
+
{
|
|
781
|
+
styles
|
|
782
|
+
}
|
|
107
783
|
);
|
|
784
|
+
const registerMenu = vividElement.createRegisterFunction(menuDefinition);
|
|
108
785
|
|
|
109
|
-
exports.
|
|
110
|
-
exports.
|
|
786
|
+
exports.Menu = Menu;
|
|
787
|
+
exports.MenuItem = MenuItem;
|
|
788
|
+
exports.MenuItemRole = MenuItemRole;
|
|
789
|
+
exports.menuDefinition = menuDefinition;
|
|
790
|
+
exports.menuItemDefinition = menuItemDefinition;
|
|
791
|
+
exports.menuName = menuName;
|
|
792
|
+
exports.registerMenu = registerMenu;
|
|
793
|
+
exports.registerMenuItem = registerMenuItem;
|