@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/definition44.js
CHANGED
|
@@ -1,147 +1,1156 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { B as Button, c as chevronTemplateFactory, b as buttonDefinition } from './definition11.js';
|
|
2
|
+
import { P as Popup, p as popupDefinition } from './definition65.js';
|
|
3
|
+
import { I as Icon, i as iconDefinition } from './definition28.js';
|
|
4
|
+
import { V as VividElement, O as Observable, D as DOM, a as attr, n as nullableNumberConverter, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
|
|
5
|
+
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
6
|
+
import { s as scrollIntoView } from './scrollIntoView.js';
|
|
7
|
+
import { F as FormAssociated } from './form-associated.js';
|
|
8
|
+
import { A as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
|
|
9
|
+
import { L as Localized } from './localized.js';
|
|
10
|
+
import { F as FormElementSuccessText, a as FormElementHelperText, e as errorText, f as formElements, g as getFeedbackTemplate } from './form-elements.js';
|
|
11
|
+
import { L as Listbox } from './listbox.js';
|
|
12
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
6
13
|
import { w as when } from './when.js';
|
|
14
|
+
import { r as ref } from './ref.js';
|
|
15
|
+
import { s as slotted } from './slotted.js';
|
|
16
|
+
import { c as classNames } from './class-names.js';
|
|
17
|
+
import { r as repeat } from './repeat.js';
|
|
7
18
|
|
|
8
|
-
const styles = "
|
|
19
|
+
const styles = ".chevron{display:flex;flex-shrink:0;font:var(--vvd-typography-base-extended);transform:rotate(0);transition:transform .2s}:host([aria-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:not(.disabled) .chevron{cursor:pointer}.disabled .chevron{color:var(--_low-ink-color);cursor:not-allowed}:host(:focus-visible){outline:none}:host{display:inline-block;inline-size:300px;--_low-ink-color: var(--vvd-color-neutral-600)}:host([disabled]){--_low-ink-color: var(--vvd-color-neutral-400);cursor:not-allowed}.control-wrapper{display:flex;flex-direction:column;gap:4px}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.fieldset{--_connotation-color-primary: var(--vvd-searchable-select-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-searchable-select-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-searchable-select-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-searchable-select-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-faint: var(--vvd-searchable-select-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-searchable-select-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-searchable-select-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-searchable-select-accent-fierce, var(--vvd-color-neutral-700))}.fieldset{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.fieldset.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.fieldset:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.fieldset:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.fieldset:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.fieldset:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.fieldset:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.fieldset:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.fieldset:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.fieldset:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.fieldset{display:flex;align-items:center;justify-content:space-between;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);color:var(--_appearance-color-text);font:var(--vvd-typography-base);gap:8px;padding-block:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s}.fieldset:focus-within{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}:host(:not([shape=pill])) .fieldset{border-radius:8px}:host([shape=pill]) .fieldset{border-radius:24px}.popup-wrapper{position:relative}.content-area{display:flex;overflow:hidden;flex:1;flex-direction:column;gap:8px;min-block-size:24px}.tag-row{display:flex;gap:8px;inline-size:100%}.tag-row.contains-only-input:not(:focus-within){display:contents}.tag-wrapper{overflow:hidden}.tag{max-inline-size:100%}input{box-sizing:border-box;flex:1;border:none;background:none;block-size:24px;font:var(--vvd-typography-base);max-inline-size:100%;min-inline-size:100px;outline:none}.contains-only-input input:not(:focus){position:absolute;block-size:0;inline-size:0;min-inline-size:0;opacity:0;pointer-events:none}.listbox{display:flex;flex-direction:column;padding:4px;gap:2px;max-block-size:var(--searchable-select-height, 408px);overflow-y:auto}.empty-message{display:flex;align-items:center;justify-content:center;color:var(--vvd-color-neutral-300);min-block-size:40px;text-align:center}::part(popup-base){inline-size:max-content;min-inline-size:var(--_searchable-select-fixed-width, 100%)}slot[name=icon]{font-size:20px}.visually-hidden{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}";
|
|
9
20
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
const optionTagStyles = ".base{--_connotation-color-contrast: var(--vvd-option-tag-accent-contrast, var(--vvd-color-neutral-800))}.base{position:relative;display:inline-flex;box-sizing:border-box;align-items:center;background-color:var(--fill-color);block-size:calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)));box-shadow:inset 0 0 0 1px var(--outline-color);color:var(--text-color);column-gap:8px;font:var(--vvd-typography-base-bold);max-inline-size:100%;padding-inline:8px;user-select:none;vertical-align:middle}.base:not(.disabled){--text-color: var(--_connotation-color-contrast);--fill-color: color-mix( in srgb, var(--_connotation-color-contrast), transparent 87.5% );--outline-color: transparent}.base.disabled{--text-color: var(--vvd-color-neutral-300);--fill-color: color-mix( in srgb, var(--vvd-color-neutral-800), transparent 87.5% );--outline-color: transparent}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.label{overflow:hidden;max-inline-size:100%;text-overflow:ellipsis;white-space:nowrap}slot[name=icon]{font-size:calc(calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 1.5);line-height:1}.icon-placeholder{inline-size:calc(calc(1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2))) / 1.5)}.remove-button{display:flex;align-items:center;border-radius:inherit;cursor:pointer;outline:none}.disabled .remove-button{pointer-events:none}.remove-button:focus-visible:before{--focus-stroke-gap-color: transparent;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));position:absolute;z-index:1;display:block;border-radius:inherit;content:\"\";inset:0;pointer-events:none}";
|
|
22
|
+
|
|
23
|
+
class _SearchableSelect extends VividElement {
|
|
24
|
+
}
|
|
25
|
+
class FormAssociatedSearchableSelect extends FormAssociated(
|
|
26
|
+
_SearchableSelect
|
|
27
|
+
) {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.proxy = document.createElement("input");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var __defProp$1 = Object.defineProperty;
|
|
35
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
36
|
+
var __typeError = (msg) => {
|
|
37
|
+
throw TypeError(msg);
|
|
38
|
+
};
|
|
39
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
40
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
13
41
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
42
|
if (decorator = decorators[i])
|
|
15
|
-
result = (decorator(target, key, result) ) || result;
|
|
16
|
-
if (result) __defProp(target, key, result);
|
|
43
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
44
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
17
45
|
return result;
|
|
18
46
|
};
|
|
19
|
-
|
|
47
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
48
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
49
|
+
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);
|
|
50
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
51
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
52
|
+
var _SearchableSelect_instances, updateValuesThroughUserInteraction_fn, updateValuesWhileMaintainingOrder_fn, isValidValue_fn, _slottedOptionsChangeHandler, updateSelectedOnSlottedOptions_fn, handleOptionInteraction_fn, _clonedTagIcons, tagIconOfOption_fn, updateClonedTagIconOfOption_fn, _suppressFilter, updateFilteredOptions_fn, transitionHighlightedOptionTo_fn, selectHighlightedOption_fn, highlightFirstOption_fn, highlightLastOption_fn, highlightPrevPage_fn, highlightNextPage_fn, highlightPreviousOption_fn, highlightNextOption_fn, textForValue_fn, measureTagWidth_fn, updateTagLayout_fn, moveTagFocusTo_fn, nextTagIndexLeft_fn, nextTagIndexRight_fn, nextTagIndexForRemoved_fn, determineInitialValues_fn, updateFormValue_fn, _resizeObserver;
|
|
53
|
+
const TagGapPx = 8;
|
|
54
|
+
const InputMinWidthPx = 100;
|
|
55
|
+
const PageSize = 10;
|
|
56
|
+
const isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
|
|
57
|
+
let SearchableSelect = class extends FormAssociatedSearchableSelect {
|
|
20
58
|
constructor() {
|
|
21
59
|
super(...arguments);
|
|
22
|
-
this
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
60
|
+
__privateAdd(this, _SearchableSelect_instances);
|
|
61
|
+
this.fixedDropdown = false;
|
|
62
|
+
this.open = false;
|
|
63
|
+
this.multiple = false;
|
|
64
|
+
this.externalTags = false;
|
|
65
|
+
this.maxLines = null;
|
|
66
|
+
this.values = [];
|
|
67
|
+
this.initialValues = [];
|
|
68
|
+
this._inputValue = "";
|
|
69
|
+
// --- Slotted options ---
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
this._areOptionsInitialized = false;
|
|
74
|
+
__privateAdd(this, _slottedOptionsChangeHandler, {
|
|
75
|
+
handleChange: (source, _) => {
|
|
76
|
+
if (source.selected && !this.values.includes(source.value)) {
|
|
77
|
+
this.values = [...this.values, source.value];
|
|
78
|
+
} else if (!source.selected && this.values.includes(source.value)) {
|
|
79
|
+
this.values = this.values.filter((option) => option !== source.value);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// --- Option tag icons ---
|
|
84
|
+
__privateAdd(this, _clonedTagIcons, /* @__PURE__ */ new Map());
|
|
85
|
+
this._filteredOptions = [];
|
|
86
|
+
this._filteredEnabledOptions = [];
|
|
87
|
+
__privateAdd(this, _suppressFilter, false);
|
|
88
|
+
this._highlightedOptionIndex = null;
|
|
89
|
+
this._numElidedTags = 0;
|
|
90
|
+
this._tagRows = [];
|
|
91
|
+
this._lastTagRow = [];
|
|
92
|
+
this.clearable = false;
|
|
93
|
+
this.setFormValue = (value, state) => {
|
|
94
|
+
if (isFormAssociatedTryingToSetFormValue(value)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
super.setFormValue(value, state);
|
|
98
|
+
};
|
|
99
|
+
this._changeDescription = "";
|
|
100
|
+
// --- Core ---
|
|
101
|
+
__privateAdd(this, _resizeObserver, new ResizeObserver(() => {
|
|
102
|
+
__privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
openChanged() {
|
|
109
|
+
if (!this.open) {
|
|
110
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, null);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
valuesChanged() {
|
|
117
|
+
if (!this._areOptionsInitialized) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!this.multiple && this.values.length > 1) {
|
|
121
|
+
this.values = [this.values[0]];
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (this.values.some((value) => !__privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value))) {
|
|
125
|
+
this.values = this.values.filter((value) => __privateMethod(this, _SearchableSelect_instances, isValidValue_fn).call(this, value));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!this.multiple) {
|
|
129
|
+
if (this.values.length) {
|
|
130
|
+
__privateSet(this, _suppressFilter, true);
|
|
131
|
+
this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
|
|
132
|
+
} else {
|
|
133
|
+
this._inputValue = "";
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
this.value = this.values.length ? this.values[0] : "";
|
|
137
|
+
__privateMethod(this, _SearchableSelect_instances, updateSelectedOnSlottedOptions_fn).call(this);
|
|
138
|
+
if (this.$fastController.isConnected) {
|
|
139
|
+
__privateMethod(this, _SearchableSelect_instances, updateTagLayout_fn).call(this);
|
|
140
|
+
}
|
|
141
|
+
__privateMethod(this, _SearchableSelect_instances, updateFormValue_fn).call(this);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
initialValuesChanged() {
|
|
147
|
+
if (!this.dirtyValue) {
|
|
148
|
+
this.values = this.initialValues;
|
|
149
|
+
this.dirtyValue = false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
valueChanged(prev, next) {
|
|
156
|
+
super.valueChanged(prev, next);
|
|
157
|
+
if (!this._areOptionsInitialized) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const isValidValue = this._slottedOptions.some(
|
|
161
|
+
(option) => option.value === next
|
|
162
|
+
);
|
|
163
|
+
if (this.values[0] !== next) {
|
|
164
|
+
this.values = isValidValue ? [next] : [];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
get selectedIndex() {
|
|
168
|
+
if (this.values.length) {
|
|
169
|
+
return this._slottedOptions.findIndex(
|
|
170
|
+
(option) => option.value === this.values[0]
|
|
171
|
+
);
|
|
172
|
+
} else {
|
|
173
|
+
return -1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
set selectedIndex(index) {
|
|
177
|
+
this.value = this._slottedOptions[index]?.value ?? "";
|
|
178
|
+
}
|
|
179
|
+
get options() {
|
|
180
|
+
return [...this._slottedOptions];
|
|
181
|
+
}
|
|
182
|
+
get selectedOptions() {
|
|
183
|
+
return this._slottedOptions.filter(
|
|
184
|
+
(option) => this.values.includes(option.value)
|
|
185
|
+
);
|
|
27
186
|
}
|
|
28
187
|
/**
|
|
29
188
|
* @internal
|
|
30
189
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.checked = !this.checked;
|
|
34
|
-
if (this.clickableBox || this.clickable) this.$emit("change");
|
|
190
|
+
_inputValueChanged() {
|
|
191
|
+
__privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
|
|
35
192
|
}
|
|
36
193
|
/**
|
|
37
194
|
* @internal
|
|
38
195
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
196
|
+
_onInputInput(event) {
|
|
197
|
+
__privateSet(this, _suppressFilter, false);
|
|
198
|
+
this._inputValue = event.target.value;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @internal
|
|
202
|
+
*/
|
|
203
|
+
_onInputFocus(_) {
|
|
204
|
+
__privateSet(this, _suppressFilter, true);
|
|
205
|
+
__privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
|
|
206
|
+
this.open = true;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
211
|
+
_onInputBlur(_) {
|
|
212
|
+
this.open = false;
|
|
213
|
+
if (this.multiple) {
|
|
214
|
+
this._inputValue = "";
|
|
215
|
+
} else {
|
|
216
|
+
if (this.values.length === 0) {
|
|
217
|
+
this._inputValue = "";
|
|
218
|
+
} else {
|
|
219
|
+
this._inputValue = __privateMethod(this, _SearchableSelect_instances, textForValue_fn).call(this, this.values[0]);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this._changeDescription = "";
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
_onInputKeydown(e) {
|
|
228
|
+
if (e.ctrlKey || e.shiftKey) {
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
switch (e.key) {
|
|
232
|
+
case "Enter":
|
|
233
|
+
__privateMethod(this, _SearchableSelect_instances, selectHighlightedOption_fn).call(this);
|
|
234
|
+
return false;
|
|
235
|
+
case "Escape":
|
|
236
|
+
this.open = false;
|
|
237
|
+
break;
|
|
238
|
+
case "Home":
|
|
239
|
+
if (!this.open) {
|
|
240
|
+
this.open = true;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
__privateMethod(this, _SearchableSelect_instances, highlightFirstOption_fn).call(this);
|
|
244
|
+
return false;
|
|
245
|
+
case "End":
|
|
246
|
+
if (!this.open) {
|
|
247
|
+
this.open = true;
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
__privateMethod(this, _SearchableSelect_instances, highlightLastOption_fn).call(this);
|
|
251
|
+
return false;
|
|
252
|
+
case "PageUp":
|
|
253
|
+
if (!this.open) {
|
|
254
|
+
this.open = true;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
__privateMethod(this, _SearchableSelect_instances, highlightPrevPage_fn).call(this);
|
|
258
|
+
return false;
|
|
259
|
+
case "PageDown":
|
|
260
|
+
if (!this.open) {
|
|
261
|
+
this.open = true;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
__privateMethod(this, _SearchableSelect_instances, highlightNextPage_fn).call(this);
|
|
265
|
+
return false;
|
|
266
|
+
case "ArrowUp":
|
|
267
|
+
if (!this.open) {
|
|
268
|
+
this.open = true;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
__privateMethod(this, _SearchableSelect_instances, highlightPreviousOption_fn).call(this);
|
|
272
|
+
return false;
|
|
273
|
+
case "ArrowDown":
|
|
274
|
+
if (!this.open) {
|
|
275
|
+
this.open = true;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
__privateMethod(this, _SearchableSelect_instances, highlightNextOption_fn).call(this);
|
|
279
|
+
return false;
|
|
280
|
+
case "ArrowLeft":
|
|
281
|
+
if (this.multiple && this._inputValue === "" && this.values.length && !this.externalTags) {
|
|
282
|
+
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, this.values.length));
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
return true;
|
|
286
|
+
case "Backspace":
|
|
287
|
+
if (this.multiple && this._inputValue === "" && this.values.length) {
|
|
288
|
+
this._onTagRemoved(this.values[this.values.length - 1]);
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
return true;
|
|
292
|
+
default:
|
|
293
|
+
if (!this.open) {
|
|
294
|
+
this.open = true;
|
|
295
|
+
}
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
42
298
|
return true;
|
|
43
299
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
300
|
+
/**
|
|
301
|
+
* @internal
|
|
302
|
+
*/
|
|
303
|
+
_slottedOptionsChanged(oldValue, newValue) {
|
|
304
|
+
const hasSlottedOptions = Boolean(
|
|
305
|
+
this.querySelectorAll(`:not([slot])`).length
|
|
306
|
+
);
|
|
307
|
+
if (!newValue.length && hasSlottedOptions) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
this._areOptionsInitialized = true;
|
|
311
|
+
if (oldValue) {
|
|
312
|
+
for (const option of oldValue) {
|
|
313
|
+
const notifier = Observable.getNotifier(option);
|
|
314
|
+
notifier.unsubscribe(__privateGet(this, _slottedOptionsChangeHandler), "selected");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (newValue) {
|
|
318
|
+
for (const option of newValue) {
|
|
319
|
+
option._displayCheckmark = true;
|
|
320
|
+
const notifier = Observable.getNotifier(option);
|
|
321
|
+
notifier.subscribe(__privateGet(this, _slottedOptionsChangeHandler), "selected");
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const values = [];
|
|
325
|
+
for (const option of this._slottedOptions) {
|
|
326
|
+
if (option.selected || option.value === this.value || this.values.includes(option.value)) {
|
|
327
|
+
values.push(option.value);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
__privateMethod(this, _SearchableSelect_instances, updateValuesWhileMaintainingOrder_fn).call(this, values);
|
|
331
|
+
__privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @internal
|
|
335
|
+
*/
|
|
336
|
+
_tagIconSlotName(value) {
|
|
337
|
+
return `_tag-icon-${this.values.indexOf(value)}`;
|
|
338
|
+
}
|
|
339
|
+
// --- Tags ---
|
|
340
|
+
/**
|
|
341
|
+
* @internal
|
|
342
|
+
*/
|
|
343
|
+
_tagLabelForValue(value) {
|
|
344
|
+
const option = this._slottedOptions.find(
|
|
345
|
+
(option2) => option2.value === value
|
|
346
|
+
);
|
|
347
|
+
return option.label;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* @internal
|
|
351
|
+
*/
|
|
352
|
+
_isTagDisabled(value) {
|
|
353
|
+
const option = this._slottedOptions.find(
|
|
354
|
+
(option2) => option2.value === value
|
|
355
|
+
);
|
|
356
|
+
return this.disabled || option.disabled;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* @internal
|
|
360
|
+
*/
|
|
361
|
+
_onTagRemoved(value) {
|
|
362
|
+
__privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, this.values.filter((option) => option !== value));
|
|
363
|
+
__privateMethod(this, _SearchableSelect_instances, updateFilteredOptions_fn).call(this);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* @internal
|
|
367
|
+
*/
|
|
368
|
+
_onTagKeydown(event) {
|
|
369
|
+
const tagIndex = parseInt(event.target.dataset.index);
|
|
370
|
+
switch (event.key) {
|
|
371
|
+
case "Backspace":
|
|
372
|
+
case "Delete":
|
|
373
|
+
case "Enter":
|
|
374
|
+
case " ": {
|
|
375
|
+
this._onTagRemoved(this.values[tagIndex]);
|
|
376
|
+
DOM.processUpdates();
|
|
377
|
+
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexForRemoved_fn).call(this, tagIndex));
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
case "ArrowLeft":
|
|
381
|
+
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, tagIndex) ?? tagIndex);
|
|
382
|
+
break;
|
|
383
|
+
case "ArrowRight":
|
|
384
|
+
__privateMethod(this, _SearchableSelect_instances, moveTagFocusTo_fn).call(this, __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, tagIndex));
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* @internal
|
|
391
|
+
*/
|
|
392
|
+
_onListboxClick(e) {
|
|
393
|
+
if (this.disabled) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const capturedOption = e.target.closest(
|
|
397
|
+
`option,[role=option]`
|
|
398
|
+
);
|
|
399
|
+
if (capturedOption && !capturedOption.disabled) {
|
|
400
|
+
__privateMethod(this, _SearchableSelect_instances, handleOptionInteraction_fn).call(this, capturedOption);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* @internal
|
|
405
|
+
*/
|
|
406
|
+
get _shouldShowClearButton() {
|
|
407
|
+
return this.clearable && this.values.length > 0;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* @internal
|
|
411
|
+
*/
|
|
412
|
+
_onClearButtonClick() {
|
|
413
|
+
__privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, this.selectedOptions.filter((option) => option.disabled).map((option) => option.value));
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* @internal
|
|
417
|
+
*/
|
|
418
|
+
nameChanged(previous, next) {
|
|
419
|
+
super.nameChanged(previous, next);
|
|
420
|
+
__privateMethod(this, _SearchableSelect_instances, updateFormValue_fn).call(this);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* @internal
|
|
424
|
+
*/
|
|
425
|
+
formResetCallback() {
|
|
426
|
+
super.formResetCallback();
|
|
427
|
+
__privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, __privateMethod(this, _SearchableSelect_instances, determineInitialValues_fn).call(this));
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* @internal
|
|
431
|
+
*/
|
|
432
|
+
_onFieldsetClick(e) {
|
|
433
|
+
if (this.disabled) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (!e.defaultPrevented) {
|
|
437
|
+
this._input.focus();
|
|
438
|
+
this.open = true;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* @internal
|
|
443
|
+
*/
|
|
444
|
+
_onChevronClick() {
|
|
445
|
+
if (this.open) {
|
|
446
|
+
this.open = false;
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
return true;
|
|
450
|
+
}
|
|
451
|
+
connectedCallback() {
|
|
452
|
+
super.connectedCallback();
|
|
453
|
+
if (!this.values.length) {
|
|
454
|
+
this.values = __privateMethod(this, _SearchableSelect_instances, determineInitialValues_fn).call(this);
|
|
455
|
+
}
|
|
456
|
+
__privateGet(this, _resizeObserver).observe(this._contentArea);
|
|
457
|
+
}
|
|
458
|
+
disconnectedCallback() {
|
|
459
|
+
super.disconnectedCallback();
|
|
460
|
+
__privateGet(this, _resizeObserver).disconnect();
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @internal
|
|
464
|
+
*/
|
|
465
|
+
validate() {
|
|
466
|
+
super.validate(this._input ?? void 0);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* @internal
|
|
470
|
+
*/
|
|
471
|
+
focus(options) {
|
|
472
|
+
this._input?.focus(options);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
477
|
+
_onMouseDown(event) {
|
|
478
|
+
if (!event.defaultPrevented) {
|
|
479
|
+
this._input.focus();
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
return true;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
_SearchableSelect_instances = new WeakSet();
|
|
486
|
+
updateValuesThroughUserInteraction_fn = function(newValues) {
|
|
487
|
+
this.values = newValues;
|
|
488
|
+
this.$emit("change", void 0, {
|
|
489
|
+
bubbles: false
|
|
490
|
+
});
|
|
491
|
+
this.$emit("input", void 0, {
|
|
492
|
+
bubbles: false
|
|
493
|
+
});
|
|
494
|
+
};
|
|
495
|
+
updateValuesWhileMaintainingOrder_fn = function(newValues) {
|
|
496
|
+
const oldSet = new Set(this.values);
|
|
497
|
+
const newSet = new Set(newValues);
|
|
498
|
+
this.values = [...this.values].filter((v) => newSet.has(v)).concat([...newValues].filter((v) => !oldSet.has(v)));
|
|
499
|
+
};
|
|
500
|
+
isValidValue_fn = function(value) {
|
|
501
|
+
return this._slottedOptions.some((option) => option.value === value);
|
|
502
|
+
};
|
|
503
|
+
_slottedOptionsChangeHandler = new WeakMap();
|
|
504
|
+
updateSelectedOnSlottedOptions_fn = function() {
|
|
505
|
+
for (const option of this._slottedOptions) {
|
|
506
|
+
option.selected = this.values.includes(option.value);
|
|
507
|
+
__privateMethod(this, _SearchableSelect_instances, updateClonedTagIconOfOption_fn).call(this, option);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
handleOptionInteraction_fn = function(option) {
|
|
511
|
+
const value = option.value;
|
|
512
|
+
let newValues;
|
|
513
|
+
const isSelection = !this.values.includes(value);
|
|
514
|
+
if (this.multiple) {
|
|
515
|
+
if (isSelection) {
|
|
516
|
+
newValues = [...this.values, value];
|
|
517
|
+
} else {
|
|
518
|
+
newValues = this.values.filter((option2) => option2 !== value);
|
|
519
|
+
}
|
|
520
|
+
this._inputValue = "";
|
|
521
|
+
} else {
|
|
522
|
+
if (isSelection) {
|
|
523
|
+
newValues = [value];
|
|
524
|
+
this._inputValue = option.text;
|
|
525
|
+
} else {
|
|
526
|
+
newValues = [];
|
|
527
|
+
}
|
|
528
|
+
this.open = false;
|
|
529
|
+
}
|
|
530
|
+
this._changeDescription = isSelection ? this.locale.searchableSelect.optionSelectedMessage(option.text) : this.locale.searchableSelect.optionDeselectedMessage(option.text);
|
|
531
|
+
__privateMethod(this, _SearchableSelect_instances, updateValuesThroughUserInteraction_fn).call(this, newValues);
|
|
532
|
+
};
|
|
533
|
+
_clonedTagIcons = new WeakMap();
|
|
534
|
+
tagIconOfOption_fn = function(option) {
|
|
535
|
+
return option.querySelector('[slot="tag-icon"]');
|
|
536
|
+
};
|
|
537
|
+
updateClonedTagIconOfOption_fn = function(option) {
|
|
538
|
+
if (option.selected && __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option)) {
|
|
539
|
+
let clone = __privateGet(this, _clonedTagIcons).get(option);
|
|
540
|
+
if (!clone) {
|
|
541
|
+
clone = __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, option).cloneNode(true);
|
|
542
|
+
__privateGet(this, _clonedTagIcons).set(option, clone);
|
|
543
|
+
}
|
|
544
|
+
clone.slot = this._tagIconSlotName(option.value);
|
|
545
|
+
this.appendChild(clone);
|
|
546
|
+
} else {
|
|
547
|
+
const clone = __privateGet(this, _clonedTagIcons).get(option);
|
|
548
|
+
if (clone) {
|
|
549
|
+
clone.remove();
|
|
550
|
+
__privateGet(this, _clonedTagIcons).delete(option);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
_suppressFilter = new WeakMap();
|
|
555
|
+
updateFilteredOptions_fn = function() {
|
|
556
|
+
const newFilteredOptions = [];
|
|
557
|
+
for (const option of this._slottedOptions ?? []) {
|
|
558
|
+
if (__privateGet(this, _suppressFilter) || this._inputValue === "") {
|
|
559
|
+
option.hidden = false;
|
|
560
|
+
option._matchedRange = null;
|
|
561
|
+
} else {
|
|
562
|
+
const matchIndex = option.text.toLowerCase().indexOf(this._inputValue.toLowerCase());
|
|
563
|
+
const matchedRange = matchIndex === -1 ? null : { from: matchIndex, to: matchIndex + this._inputValue.length };
|
|
564
|
+
option.hidden = !matchedRange;
|
|
565
|
+
option._matchedRange = matchedRange;
|
|
566
|
+
}
|
|
567
|
+
if (!option.hidden) {
|
|
568
|
+
newFilteredOptions.push(option);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, null);
|
|
572
|
+
this._filteredOptions = newFilteredOptions;
|
|
573
|
+
this._filteredEnabledOptions = newFilteredOptions.filter(
|
|
574
|
+
(option) => !option.disabled
|
|
575
|
+
);
|
|
576
|
+
};
|
|
577
|
+
transitionHighlightedOptionTo_fn = function(index) {
|
|
578
|
+
if (typeof this._highlightedOptionIndex === "number") {
|
|
579
|
+
this._filteredEnabledOptions[this._highlightedOptionIndex]._highlighted = false;
|
|
580
|
+
}
|
|
581
|
+
if (typeof index === "number") {
|
|
582
|
+
if (!this._filteredEnabledOptions.length) {
|
|
583
|
+
index = null;
|
|
584
|
+
} else {
|
|
585
|
+
index = Math.max(
|
|
586
|
+
0,
|
|
587
|
+
Math.min(this._filteredEnabledOptions.length - 1, index)
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
this._highlightedOptionIndex = index;
|
|
592
|
+
if (typeof this._highlightedOptionIndex === "number") {
|
|
593
|
+
const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
|
|
594
|
+
highlightedOption._highlighted = true;
|
|
595
|
+
scrollIntoView(highlightedOption, this._listbox, "nearest");
|
|
596
|
+
this._changeDescription = this.locale.searchableSelect.optionFocusedMessage(
|
|
597
|
+
highlightedOption.text,
|
|
598
|
+
this._highlightedOptionIndex + 1,
|
|
599
|
+
this._filteredEnabledOptions.length
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
selectHighlightedOption_fn = function() {
|
|
604
|
+
if (this._highlightedOptionIndex === null) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
__privateMethod(this, _SearchableSelect_instances, handleOptionInteraction_fn).call(this, this._filteredEnabledOptions[this._highlightedOptionIndex]);
|
|
608
|
+
};
|
|
609
|
+
highlightFirstOption_fn = function() {
|
|
610
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, 0);
|
|
611
|
+
};
|
|
612
|
+
highlightLastOption_fn = function() {
|
|
613
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, this._filteredEnabledOptions.length - 1);
|
|
614
|
+
};
|
|
615
|
+
highlightPrevPage_fn = function() {
|
|
616
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - PageSize);
|
|
617
|
+
};
|
|
618
|
+
highlightNextPage_fn = function() {
|
|
619
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + PageSize);
|
|
620
|
+
};
|
|
621
|
+
highlightPreviousOption_fn = function() {
|
|
622
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - 1);
|
|
623
|
+
};
|
|
624
|
+
highlightNextOption_fn = function() {
|
|
625
|
+
__privateMethod(this, _SearchableSelect_instances, transitionHighlightedOptionTo_fn).call(this, (this._highlightedOptionIndex ?? -1) + 1);
|
|
626
|
+
};
|
|
627
|
+
textForValue_fn = function(value) {
|
|
628
|
+
const option = this._slottedOptions.find(
|
|
629
|
+
(option2) => option2.value === value
|
|
630
|
+
);
|
|
631
|
+
return option.text;
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* @internal
|
|
635
|
+
*/
|
|
636
|
+
measureTagWidth_fn = function(label, removable, hasIcon) {
|
|
637
|
+
const tag = document.createElement(this._optionTagTagName);
|
|
638
|
+
tag.label = label;
|
|
639
|
+
tag.removable = removable;
|
|
640
|
+
tag.style.cssText = "position: absolute; visibility: hidden;";
|
|
641
|
+
tag.hasIconPlaceholder = hasIcon;
|
|
642
|
+
this.shadowRoot.appendChild(tag);
|
|
643
|
+
const width = tag.getBoundingClientRect().width;
|
|
644
|
+
tag.remove();
|
|
645
|
+
return width;
|
|
646
|
+
};
|
|
647
|
+
updateTagLayout_fn = function() {
|
|
648
|
+
if (!this.multiple) {
|
|
649
|
+
this._numElidedTags = 0;
|
|
650
|
+
this._tagRows = [];
|
|
651
|
+
this._lastTagRow = [];
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
if (this.externalTags) {
|
|
655
|
+
this._numElidedTags = this.values.length;
|
|
656
|
+
this._tagRows = [];
|
|
657
|
+
this._lastTagRow = [];
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
const rowWidth = this._contentArea.getBoundingClientRect().width;
|
|
661
|
+
const rows = [[]];
|
|
662
|
+
let currentRowIndex = 0;
|
|
663
|
+
let currentRowWidth = InputMinWidthPx;
|
|
664
|
+
let i;
|
|
665
|
+
for (i = this.values.length - 1; i >= 0; i--) {
|
|
666
|
+
const isLastRow = this.maxLines && currentRowIndex === this.maxLines - 1;
|
|
667
|
+
const tagWidth = __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._tagLabelForValue(this.values[i]), true, __privateMethod(this, _SearchableSelect_instances, tagIconOfOption_fn).call(this, this.selectedOptions[i]) !== null);
|
|
668
|
+
const entry = {
|
|
669
|
+
value: this.values[i],
|
|
670
|
+
width: tagWidth
|
|
671
|
+
};
|
|
672
|
+
let elidedTagCounterWidth = 0;
|
|
673
|
+
if (isLastRow) {
|
|
674
|
+
const numElidedTags = i;
|
|
675
|
+
if (numElidedTags) {
|
|
676
|
+
elidedTagCounterWidth = TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, numElidedTags.toString(), false, false);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const totalWidthNeeded = currentRowWidth + TagGapPx + tagWidth + elidedTagCounterWidth;
|
|
680
|
+
if (totalWidthNeeded > rowWidth) {
|
|
681
|
+
if (isLastRow) {
|
|
682
|
+
if (i === this.values.length - 1) {
|
|
683
|
+
rows[currentRowIndex].unshift(entry);
|
|
684
|
+
currentRowWidth += TagGapPx + tagWidth;
|
|
685
|
+
} else {
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
} else {
|
|
689
|
+
rows.push([]);
|
|
690
|
+
currentRowIndex++;
|
|
691
|
+
rows[currentRowIndex].unshift(entry);
|
|
692
|
+
currentRowWidth = tagWidth;
|
|
693
|
+
}
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
rows[currentRowIndex].unshift(entry);
|
|
697
|
+
currentRowWidth += TagGapPx + tagWidth;
|
|
698
|
+
}
|
|
699
|
+
this._numElidedTags = i + 1;
|
|
700
|
+
rows.reverse();
|
|
701
|
+
for (let i2 = 0; i2 < rows.length - 1; i2++) {
|
|
702
|
+
let lineWidth = rows[i2].map((e) => e.width).reduce((a, b) => a + b, 0) + (rows[i2].length - 1) * TagGapPx;
|
|
703
|
+
if (i2 === 0 && this._numElidedTags) {
|
|
704
|
+
lineWidth += TagGapPx + __privateMethod(this, _SearchableSelect_instances, measureTagWidth_fn).call(this, this._numElidedTags.toString(), false, false);
|
|
705
|
+
}
|
|
706
|
+
while (rows[i2 + 1].length && lineWidth + TagGapPx + rows[i2 + 1][0].width <= rowWidth) {
|
|
707
|
+
const nextTag = rows[i2 + 1].shift();
|
|
708
|
+
rows[i2].push(nextTag);
|
|
709
|
+
lineWidth += TagGapPx + nextTag.width;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
const rowValues = rows.map((line) => line.map((entry) => entry.value));
|
|
713
|
+
this._tagRows = rowValues.slice(0, -1);
|
|
714
|
+
this._lastTagRow = rowValues.slice(-1)[0];
|
|
715
|
+
};
|
|
716
|
+
moveTagFocusTo_fn = function(index) {
|
|
717
|
+
if (index === null) {
|
|
718
|
+
this._input.focus();
|
|
719
|
+
} else {
|
|
720
|
+
this.shadowRoot.querySelector(`[data-index="${index}"]`)?.focus();
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
nextTagIndexLeft_fn = function(index) {
|
|
724
|
+
if (!this.values.length) {
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
728
|
+
if (!this._isTagDisabled(this.values[i])) {
|
|
729
|
+
return i;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
return null;
|
|
733
|
+
};
|
|
734
|
+
nextTagIndexRight_fn = function(index) {
|
|
735
|
+
if (!this.values.length) {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
for (let i = index + 1; i < this.values.length; i++) {
|
|
739
|
+
if (!this._isTagDisabled(this.values[i])) {
|
|
740
|
+
return i;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
return null;
|
|
744
|
+
};
|
|
745
|
+
nextTagIndexForRemoved_fn = function(index) {
|
|
746
|
+
return __privateMethod(this, _SearchableSelect_instances, nextTagIndexRight_fn).call(this, index - 1) ?? __privateMethod(this, _SearchableSelect_instances, nextTagIndexLeft_fn).call(this, index);
|
|
747
|
+
};
|
|
748
|
+
// --- Form handling ---
|
|
749
|
+
determineInitialValues_fn = function() {
|
|
750
|
+
return this.initialValues.length ? this.initialValues : this.initialValue ? [this.initialValue] : [];
|
|
751
|
+
};
|
|
752
|
+
updateFormValue_fn = function() {
|
|
753
|
+
if (!this.name) {
|
|
754
|
+
this.setFormValue(null);
|
|
755
|
+
} else {
|
|
756
|
+
const formData = new FormData();
|
|
757
|
+
for (const value of this.values) {
|
|
758
|
+
formData.append(this.name, value);
|
|
759
|
+
}
|
|
760
|
+
this.setFormValue(formData);
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
_resizeObserver = new WeakMap();
|
|
764
|
+
__decorateClass$1([
|
|
765
|
+
attr
|
|
766
|
+
], SearchableSelect.prototype, "appearance", 2);
|
|
767
|
+
__decorateClass$1([
|
|
768
|
+
attr
|
|
769
|
+
], SearchableSelect.prototype, "shape", 2);
|
|
770
|
+
__decorateClass$1([
|
|
771
|
+
attr({ mode: "boolean", attribute: "fixed-dropdown" })
|
|
772
|
+
], SearchableSelect.prototype, "fixedDropdown", 2);
|
|
773
|
+
__decorateClass$1([
|
|
774
|
+
attr
|
|
775
|
+
], SearchableSelect.prototype, "placeholder", 2);
|
|
776
|
+
__decorateClass$1([
|
|
49
777
|
attr({ mode: "boolean" })
|
|
50
|
-
],
|
|
51
|
-
__decorateClass([
|
|
778
|
+
], SearchableSelect.prototype, "open", 2);
|
|
779
|
+
__decorateClass$1([
|
|
52
780
|
attr({ mode: "boolean" })
|
|
53
|
-
],
|
|
781
|
+
], SearchableSelect.prototype, "multiple", 2);
|
|
782
|
+
__decorateClass$1([
|
|
783
|
+
attr({ attribute: "external-tags", mode: "boolean" })
|
|
784
|
+
], SearchableSelect.prototype, "externalTags", 2);
|
|
785
|
+
__decorateClass$1([
|
|
786
|
+
attr({ attribute: "max-lines", converter: nullableNumberConverter })
|
|
787
|
+
], SearchableSelect.prototype, "maxLines", 2);
|
|
788
|
+
__decorateClass$1([
|
|
789
|
+
observable
|
|
790
|
+
], SearchableSelect.prototype, "values", 2);
|
|
791
|
+
__decorateClass$1([
|
|
792
|
+
observable
|
|
793
|
+
], SearchableSelect.prototype, "initialValues", 2);
|
|
794
|
+
__decorateClass$1([
|
|
795
|
+
observable
|
|
796
|
+
], SearchableSelect.prototype, "_input", 2);
|
|
797
|
+
__decorateClass$1([
|
|
798
|
+
observable
|
|
799
|
+
], SearchableSelect.prototype, "_inputValue", 2);
|
|
800
|
+
__decorateClass$1([
|
|
801
|
+
observable
|
|
802
|
+
], SearchableSelect.prototype, "_slottedOptions", 2);
|
|
803
|
+
__decorateClass$1([
|
|
804
|
+
observable
|
|
805
|
+
], SearchableSelect.prototype, "_filteredOptions", 2);
|
|
806
|
+
__decorateClass$1([
|
|
807
|
+
observable
|
|
808
|
+
], SearchableSelect.prototype, "_filteredEnabledOptions", 2);
|
|
809
|
+
__decorateClass$1([
|
|
810
|
+
observable
|
|
811
|
+
], SearchableSelect.prototype, "_highlightedOptionIndex", 2);
|
|
812
|
+
__decorateClass$1([
|
|
813
|
+
observable
|
|
814
|
+
], SearchableSelect.prototype, "_contentArea", 2);
|
|
815
|
+
__decorateClass$1([
|
|
816
|
+
observable
|
|
817
|
+
], SearchableSelect.prototype, "_numElidedTags", 2);
|
|
818
|
+
__decorateClass$1([
|
|
819
|
+
observable
|
|
820
|
+
], SearchableSelect.prototype, "_tagRows", 2);
|
|
821
|
+
__decorateClass$1([
|
|
822
|
+
observable
|
|
823
|
+
], SearchableSelect.prototype, "_lastTagRow", 2);
|
|
824
|
+
__decorateClass$1([
|
|
825
|
+
observable
|
|
826
|
+
], SearchableSelect.prototype, "_listbox", 2);
|
|
827
|
+
__decorateClass$1([
|
|
828
|
+
attr({ mode: "boolean" })
|
|
829
|
+
], SearchableSelect.prototype, "clearable", 2);
|
|
830
|
+
__decorateClass$1([
|
|
831
|
+
observable
|
|
832
|
+
], SearchableSelect.prototype, "_changeDescription", 2);
|
|
833
|
+
__decorateClass$1([
|
|
834
|
+
observable
|
|
835
|
+
], SearchableSelect.prototype, "_anchor", 2);
|
|
836
|
+
SearchableSelect = __decorateClass$1([
|
|
837
|
+
errorText,
|
|
838
|
+
formElements
|
|
839
|
+
], SearchableSelect);
|
|
840
|
+
applyMixinsWithObservables(
|
|
841
|
+
SearchableSelect,
|
|
842
|
+
AffixIconWithTrailing,
|
|
843
|
+
FormElementHelperText,
|
|
844
|
+
FormElementSuccessText,
|
|
845
|
+
Localized
|
|
846
|
+
);
|
|
847
|
+
|
|
848
|
+
var __defProp = Object.defineProperty;
|
|
849
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
850
|
+
var result = void 0 ;
|
|
851
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
852
|
+
if (decorator = decorators[i])
|
|
853
|
+
result = (decorator(target, key, result) ) || result;
|
|
854
|
+
if (result) __defProp(target, key, result);
|
|
855
|
+
return result;
|
|
856
|
+
};
|
|
857
|
+
class OptionTag extends VividElement {
|
|
858
|
+
constructor() {
|
|
859
|
+
super(...arguments);
|
|
860
|
+
this.removable = false;
|
|
861
|
+
this.disabled = false;
|
|
862
|
+
this.hasIconPlaceholder = false;
|
|
863
|
+
}
|
|
864
|
+
_onClickRemove() {
|
|
865
|
+
this.$emit("remove", void 0, {
|
|
866
|
+
bubbles: false
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
}
|
|
54
870
|
__decorateClass([
|
|
55
|
-
attr
|
|
56
|
-
],
|
|
871
|
+
attr
|
|
872
|
+
], OptionTag.prototype, "shape");
|
|
57
873
|
__decorateClass([
|
|
58
874
|
attr
|
|
59
|
-
],
|
|
875
|
+
], OptionTag.prototype, "label");
|
|
60
876
|
__decorateClass([
|
|
61
|
-
attr({
|
|
62
|
-
],
|
|
877
|
+
attr({ mode: "boolean" })
|
|
878
|
+
], OptionTag.prototype, "removable");
|
|
63
879
|
__decorateClass([
|
|
64
880
|
attr({ mode: "boolean" })
|
|
65
|
-
],
|
|
881
|
+
], OptionTag.prototype, "disabled");
|
|
882
|
+
__decorateClass([
|
|
883
|
+
observable
|
|
884
|
+
], OptionTag.prototype, "hasIconPlaceholder");
|
|
885
|
+
applyMixins(OptionTag, Localized);
|
|
66
886
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}) => classNames(
|
|
74
|
-
"base",
|
|
75
|
-
[`connotation-${connotation}`, Boolean(connotation)],
|
|
76
|
-
["tight", tight],
|
|
77
|
-
["selected", checked],
|
|
78
|
-
["clickable", clickableBox || clickable],
|
|
79
|
-
["readonly", !clickableBox && !clickable]
|
|
887
|
+
const getStateClasses = (x) => classNames(
|
|
888
|
+
["disabled", x.disabled],
|
|
889
|
+
[`appearance-${x.appearance}`, Boolean(x.appearance)],
|
|
890
|
+
[`shape-${x.shape}`, Boolean(x.shape)],
|
|
891
|
+
["error", Boolean(x.errorValidationMessage)],
|
|
892
|
+
["success", !!x.successText]
|
|
80
893
|
);
|
|
81
|
-
function
|
|
82
|
-
|
|
894
|
+
function renderLabel() {
|
|
895
|
+
return html`
|
|
896
|
+
<label for="control" class="label" id="label"> ${(x) => x.label} </label>
|
|
897
|
+
`;
|
|
83
898
|
}
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
return html
|
|
87
|
-
|
|
899
|
+
const tagTemplateFactory = (context, getComponent) => {
|
|
900
|
+
const optionTagTag = context.tagFor(OptionTag);
|
|
901
|
+
return html`
|
|
902
|
+
<div class="tag-wrapper">
|
|
903
|
+
<${optionTagTag}
|
|
904
|
+
class="tag"
|
|
905
|
+
tabindex="-1"
|
|
906
|
+
data-index="${(x, c) => getComponent(c).values.indexOf(x)}"
|
|
907
|
+
removable
|
|
908
|
+
:label="${(x, c) => getComponent(c)._tagLabelForValue(x)}"
|
|
909
|
+
:shape="${(_, c) => getComponent(c).shape}"
|
|
910
|
+
?disabled="${(x, c) => getComponent(c)._isTagDisabled(x)}"
|
|
911
|
+
@remove="${(x, c) => getComponent(c)._onTagRemoved(x)}"
|
|
912
|
+
@keydown="${(_, c) => getComponent(c)._onTagKeydown(c.event)}"
|
|
913
|
+
@mousedown="${() => false}">
|
|
914
|
+
<slot slot="icon" name="${(x, c) => getComponent(c)._tagIconSlotName(x)}"></slot>
|
|
915
|
+
</${optionTagTag}>
|
|
916
|
+
</div>
|
|
917
|
+
`;
|
|
918
|
+
};
|
|
919
|
+
const elidedTagTemplateFactory = (context, getComponent) => {
|
|
920
|
+
const optionTagTag = context.tagFor(OptionTag);
|
|
921
|
+
return html`
|
|
922
|
+
<${optionTagTag}
|
|
923
|
+
class="tag"
|
|
924
|
+
tabindex="-1"
|
|
925
|
+
:label="${(x, c) => getComponent(x, c)._numElidedTags.toString()}"
|
|
926
|
+
:shape="${(x, c) => getComponent(x, c).shape}"
|
|
927
|
+
?disabled="${(x, c) => getComponent(x, c).disabled}"
|
|
928
|
+
@mousedown="${() => false}">
|
|
929
|
+
</${optionTagTag}>
|
|
930
|
+
`;
|
|
931
|
+
};
|
|
932
|
+
function renderFieldset(context) {
|
|
933
|
+
const buttonTag = context.tagFor(Button);
|
|
934
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
935
|
+
const chevronTemplate = chevronTemplateFactory(context);
|
|
936
|
+
const tagTemplate = tagTemplateFactory(context, (c) => c.parent);
|
|
937
|
+
const nestedTagTemplate = tagTemplateFactory(
|
|
938
|
+
context,
|
|
939
|
+
(c) => c.parentContext.parent
|
|
940
|
+
);
|
|
941
|
+
const elidedTagTemplate = elidedTagTemplateFactory(context, (x, _) => x);
|
|
942
|
+
const nestedElidedTagTemplate = elidedTagTemplateFactory(
|
|
943
|
+
context,
|
|
944
|
+
(_, c) => c.parent
|
|
945
|
+
);
|
|
946
|
+
return html`
|
|
947
|
+
<div
|
|
948
|
+
class="fieldset ${getStateClasses}"
|
|
949
|
+
@click="${(x, c) => x._onFieldsetClick(c.event)}"
|
|
950
|
+
${ref("_anchor")}
|
|
951
|
+
>
|
|
952
|
+
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
|
|
953
|
+
<div class="content-area" ${ref("_contentArea")}>
|
|
954
|
+
${repeat(
|
|
955
|
+
(x) => x._tagRows,
|
|
88
956
|
html`
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
957
|
+
<div class="tag-row">
|
|
958
|
+
${when(
|
|
959
|
+
(_, c) => c.isFirst && c.parent._numElidedTags,
|
|
960
|
+
nestedElidedTagTemplate
|
|
961
|
+
)}
|
|
962
|
+
${repeat((x) => x, nestedTagTemplate)}
|
|
963
|
+
</div>
|
|
964
|
+
`,
|
|
965
|
+
{ positioning: true }
|
|
966
|
+
)}
|
|
967
|
+
<div
|
|
968
|
+
class="tag-row ${(x) => classNames([
|
|
969
|
+
"contains-only-input",
|
|
970
|
+
x._tagRows.length > 0 && x._lastTagRow.length === 0
|
|
971
|
+
])}"
|
|
972
|
+
>
|
|
973
|
+
${when(
|
|
974
|
+
(x) => x._tagRows.length === 0 && x._numElidedTags,
|
|
975
|
+
elidedTagTemplate
|
|
976
|
+
)}
|
|
977
|
+
${repeat((x) => x._lastTagRow, tagTemplate)}
|
|
978
|
+
<input
|
|
979
|
+
id="control"
|
|
980
|
+
class="control"
|
|
981
|
+
autocomplete="off"
|
|
982
|
+
aria-autocomplete="list"
|
|
983
|
+
aria-expanded="${(x) => x.open}"
|
|
984
|
+
aria-haspopup="listbox"
|
|
985
|
+
aria-controls="listbox"
|
|
986
|
+
placeholder="${(x) => x.multiple && x.values.length ? "" : x.placeholder}"
|
|
987
|
+
role="combobox"
|
|
988
|
+
type="text"
|
|
989
|
+
?disabled="${(x) => x.disabled}"
|
|
990
|
+
:value="${(x) => x._inputValue}"
|
|
991
|
+
@input="${(x, c) => x._onInputInput(c.event)}"
|
|
992
|
+
@focus="${(x, c) => x._onInputFocus(c.event)}"
|
|
993
|
+
@blur="${(x, c) => x._onInputBlur(c.event)}"
|
|
994
|
+
@keydown="${(x, c) => x._onInputKeydown(c.event)}"
|
|
995
|
+
${ref("_input")}
|
|
996
|
+
/>
|
|
997
|
+
</div>
|
|
998
|
+
</div>
|
|
999
|
+
<slot name="meta"></slot>
|
|
1000
|
+
${when(
|
|
1001
|
+
(x) => x._shouldShowClearButton,
|
|
1002
|
+
html`<${buttonTag}
|
|
1003
|
+
aria-label="${(x) => x.locale.searchableSelect.clearButtonLabel}"
|
|
1004
|
+
@click="${(x) => x._onClearButtonClick()}"
|
|
1005
|
+
@mousedown="${() => false}"
|
|
1006
|
+
?disabled="${(x) => x.disabled}"
|
|
1007
|
+
:shape="${(x) => x.shape}"
|
|
1008
|
+
size="super-condensed"
|
|
1009
|
+
icon="close-line"
|
|
1010
|
+
appearance="ghost-light"
|
|
1011
|
+
tabindex="-1"
|
|
1012
|
+
></${buttonTag}>`
|
|
1013
|
+
)}
|
|
1014
|
+
<div @mousedown="${() => false}" @click="${(x) => x._onChevronClick()}">
|
|
1015
|
+
${chevronTemplate}
|
|
1016
|
+
</div>
|
|
1017
|
+
</div>
|
|
1018
|
+
`;
|
|
98
1019
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
html`
|
|
104
|
-
<${radioTag}
|
|
105
|
-
aria-label="${(x) => !x.clickableBox && !x.clickable && x.ariaLabel ? x.ariaLabel : null}"
|
|
106
|
-
@change="${(x) => handleControlChange(x)}"
|
|
107
|
-
class="control radio"
|
|
108
|
-
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
109
|
-
:checked="${(x) => x.checked}"
|
|
110
|
-
inert="${(x) => x.clickableBox || x.clickable ? true : null}"
|
|
111
|
-
></${radioTag}>`
|
|
112
|
-
)} `;
|
|
1020
|
+
function setFixedDropdownVarWidth(x) {
|
|
1021
|
+
return x.open && x.fixedDropdown ? `--_searchable-select-fixed-width: ${Math.round(
|
|
1022
|
+
x.getBoundingClientRect().width
|
|
1023
|
+
)}px` : null;
|
|
113
1024
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1025
|
+
function renderControl(context) {
|
|
1026
|
+
const popupTag = context.tagFor(Popup);
|
|
1027
|
+
return html`
|
|
1028
|
+
${when((x) => x.label, renderLabel())}
|
|
1029
|
+
<span aria-live="assertive" aria-relevant="text" class="visually-hidden">
|
|
1030
|
+
${(x) => x._changeDescription}
|
|
1031
|
+
</span>
|
|
1032
|
+
<div>
|
|
1033
|
+
${renderFieldset(context)}
|
|
1034
|
+
<div class="popup-wrapper">
|
|
1035
|
+
<${popupTag}
|
|
1036
|
+
:anchor="${(x) => x._anchor}"
|
|
1037
|
+
:open="${(x) => x.open}"
|
|
1038
|
+
class="popup"
|
|
1039
|
+
placement="bottom-start"
|
|
1040
|
+
style="${setFixedDropdownVarWidth}"
|
|
1041
|
+
strategy="${(x) => x.fixedDropdown ? "fixed" : "absolute"}">
|
|
1042
|
+
<div
|
|
1043
|
+
class="listbox"
|
|
1044
|
+
role="listbox"
|
|
1045
|
+
aria-multiselectable="${(x) => x.multiple}"
|
|
1046
|
+
aria-required="${(x) => x.required}"
|
|
1047
|
+
${ref("_listbox")}
|
|
1048
|
+
@click="${(x, c) => x._onListboxClick(c.event)}"
|
|
1049
|
+
@mousedown="${() => false}"
|
|
1050
|
+
>
|
|
1051
|
+
<slot
|
|
1052
|
+
${slotted({
|
|
1053
|
+
filter: Listbox.slottedOptionFilter,
|
|
1054
|
+
flatten: true,
|
|
1055
|
+
property: "_slottedOptions"
|
|
1056
|
+
})}>
|
|
1057
|
+
</slot>
|
|
1058
|
+
${when(
|
|
1059
|
+
(x) => x._filteredOptions.length === 0,
|
|
1060
|
+
html`<div class="empty-message">
|
|
1061
|
+
${when(
|
|
1062
|
+
(x) => x._inputValue === "",
|
|
1063
|
+
html`<slot name="no-options">
|
|
1064
|
+
${(x) => x.locale.searchableSelect.noOptionsMessage}
|
|
1065
|
+
</slot>`
|
|
1066
|
+
)}
|
|
1067
|
+
${when(
|
|
1068
|
+
(x) => x._inputValue !== "",
|
|
1069
|
+
html`<slot name="no-matches">
|
|
1070
|
+
${(x) => x.locale.searchableSelect.noMatchesMessage}
|
|
1071
|
+
</slot>`
|
|
1072
|
+
)}
|
|
1073
|
+
</div>`
|
|
1074
|
+
)}
|
|
1075
|
+
</div>
|
|
1076
|
+
</${popupTag}>
|
|
1077
|
+
</div>
|
|
127
1078
|
</div>
|
|
128
|
-
|
|
1079
|
+
`;
|
|
1080
|
+
}
|
|
1081
|
+
const SearchableSelectTemplate = (context) => {
|
|
1082
|
+
const optionTagTag = context.tagFor(OptionTag);
|
|
1083
|
+
return html`
|
|
1084
|
+
<template
|
|
1085
|
+
:_optionTagTagName="${() => optionTagTag}"
|
|
1086
|
+
@mousedown="${(x, c) => x._onMouseDown(c.event)}"
|
|
1087
|
+
>
|
|
1088
|
+
<div class="control-wrapper">
|
|
1089
|
+
${renderControl(context)} ${getFeedbackTemplate(context)}
|
|
1090
|
+
</div>
|
|
1091
|
+
</template>
|
|
1092
|
+
`;
|
|
129
1093
|
};
|
|
130
1094
|
|
|
131
|
-
const
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
[
|
|
1095
|
+
const getClasses = ({ shape, disabled, removable }) => classNames(
|
|
1096
|
+
"base",
|
|
1097
|
+
["disabled", disabled],
|
|
1098
|
+
["removable", removable],
|
|
1099
|
+
[`shape-${shape}`, Boolean(shape)]
|
|
1100
|
+
);
|
|
1101
|
+
function renderRemoveButton(iconTag) {
|
|
1102
|
+
return html`
|
|
1103
|
+
<span
|
|
1104
|
+
class="remove-button"
|
|
1105
|
+
aria-label="${(x) => x.locale.searchableSelect.removeTagButtonLabel(x.label)}"
|
|
1106
|
+
role="button"
|
|
1107
|
+
tabindex="${(x) => x.disabled ? null : 0}"
|
|
1108
|
+
@click="${(x) => x._onClickRemove()}"
|
|
1109
|
+
>
|
|
1110
|
+
<${iconTag} name="close-line"></${iconTag}>
|
|
1111
|
+
</span>
|
|
1112
|
+
`;
|
|
1113
|
+
}
|
|
1114
|
+
const optionTagTemplate = (context) => {
|
|
1115
|
+
const iconTag = context.tagFor(Icon);
|
|
1116
|
+
return html`<span class="${getClasses}" aria-disabled="${(x) => x.disabled}">
|
|
1117
|
+
<slot name="icon" aria-hidden="true">
|
|
1118
|
+
${when(
|
|
1119
|
+
(x) => x.hasIconPlaceholder,
|
|
1120
|
+
html`<div class="icon-placeholder"></div>`
|
|
1121
|
+
)}
|
|
1122
|
+
</slot>
|
|
1123
|
+
${when(
|
|
1124
|
+
(x) => x.label,
|
|
1125
|
+
(x) => html`<span class="label">${x.label}</span>`
|
|
1126
|
+
)}
|
|
1127
|
+
${when((x) => x.removable, renderRemoveButton(iconTag))}
|
|
1128
|
+
</span>`;
|
|
1129
|
+
};
|
|
1130
|
+
|
|
1131
|
+
const optionTagDefinition = defineVividComponent(
|
|
1132
|
+
"option-tag",
|
|
1133
|
+
OptionTag,
|
|
1134
|
+
optionTagTemplate,
|
|
1135
|
+
[iconDefinition],
|
|
136
1136
|
{
|
|
137
|
-
styles,
|
|
1137
|
+
styles: [optionTagStyles],
|
|
138
1138
|
shadowOptions: {
|
|
139
1139
|
delegatesFocus: true
|
|
140
1140
|
}
|
|
141
1141
|
}
|
|
142
1142
|
);
|
|
143
|
-
const
|
|
144
|
-
|
|
1143
|
+
const searchableSelectDefinition = defineVividComponent(
|
|
1144
|
+
"searchable-select",
|
|
1145
|
+
SearchableSelect,
|
|
1146
|
+
SearchableSelectTemplate,
|
|
1147
|
+
[buttonDefinition, popupDefinition, iconDefinition, optionTagDefinition],
|
|
1148
|
+
{
|
|
1149
|
+
styles
|
|
1150
|
+
}
|
|
1151
|
+
);
|
|
1152
|
+
const registerSearchableSelect = createRegisterFunction(
|
|
1153
|
+
searchableSelectDefinition
|
|
145
1154
|
);
|
|
146
1155
|
|
|
147
|
-
export {
|
|
1156
|
+
export { SearchableSelect as S, registerSearchableSelect as r };
|