@vonage/vivid 5.17.0 → 5.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/accordion/definition.cjs +6 -6
- package/accordion/definition.js +1 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +2 -2
- package/accordion-item/definition.cjs +5 -5
- package/accordion-item/definition.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +2 -2
- package/alert/definition.cjs +5 -5
- package/alert/definition.js +1 -1
- package/alert/index.cjs +2 -2
- package/alert/index.js +6 -5
- package/audio-player/definition.cjs +5 -5
- package/audio-player/definition.js +1 -1
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +2 -1
- package/avatar/definition.cjs +5 -5
- package/avatar/definition.js +1 -1
- package/avatar/index.cjs +3 -3
- package/avatar/index.js +6 -5
- package/badge/definition.cjs +5 -5
- package/badge/definition.js +1 -1
- package/badge/index.cjs +1 -4
- package/badge/index.js +4 -20
- package/banner/definition.cjs +5 -5
- package/banner/definition.js +1 -1
- package/banner/index.cjs +2 -2
- package/banner/index.js +5 -4
- package/breadcrumb-item/definition.cjs +4 -4
- package/breadcrumb-item/definition.js +1 -1
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -0
- package/bundled/affix.cjs +1 -1
- package/bundled/affix.js +5 -5
- package/bundled/definition11.cjs +2 -2
- package/bundled/definition11.js +5 -5
- package/bundled/definition12.cjs +3 -3
- package/bundled/definition12.js +5 -5
- package/bundled/definition13.cjs +2 -2
- package/bundled/definition13.js +4 -4
- package/bundled/definition15.cjs +3 -3
- package/bundled/definition15.js +7 -7
- package/bundled/definition17.cjs +3 -3
- package/bundled/definition17.js +8 -8
- package/bundled/definition18.cjs +2 -2
- package/bundled/definition18.js +6 -6
- package/bundled/definition2.cjs +3 -14
- package/bundled/definition2.js +15 -48
- package/bundled/definition20.cjs +5 -5
- package/bundled/definition20.js +8 -8
- package/bundled/definition22.cjs +4 -39
- package/bundled/definition22.js +18 -70
- package/bundled/definition23.cjs +12 -0
- package/bundled/definition23.js +37 -0
- package/bundled/definition24.cjs +39 -0
- package/bundled/definition24.js +72 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +9 -6
- package/bundled/definition4.cjs +2 -2
- package/bundled/definition4.js +5 -5
- package/bundled/definition6.cjs +11 -11
- package/bundled/definition6.js +45 -29
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +1 -0
- package/bundled/mixins.cjs +4 -4
- package/bundled/mixins.js +7 -7
- package/bundled/numberConverter.cjs +12 -0
- package/bundled/numberConverter.js +38 -0
- package/bundled/picker-field.template.cjs +2 -1
- package/bundled/picker-field.template.js +2 -1
- package/bundled/utils.cjs +1 -0
- package/bundled/utils.js +1420 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/button/definition.cjs +5 -5
- package/button/definition.js +1 -1
- package/button/index.cjs +1 -1
- package/button/index.js +1 -1
- package/card/definition.cjs +5 -5
- package/card/definition.js +1 -1
- package/card/index.cjs +4 -4
- package/card/index.js +7 -6
- package/checkbox/definition.cjs +5 -5
- package/checkbox/definition.js +1 -1
- package/checkbox/index.cjs +1 -1
- package/checkbox/index.js +1 -1
- package/color-picker/definition.cjs +5 -5
- package/color-picker/definition.js +1 -1
- package/color-picker/index.cjs +7 -7
- package/color-picker/index.js +55 -54
- package/combobox/definition.cjs +5 -5
- package/combobox/definition.js +1 -1
- package/combobox/index.cjs +2 -2
- package/combobox/index.js +8 -7
- package/contextual-help/definition.cjs +5 -5
- package/contextual-help/definition.js +1 -1
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/country/definition.cjs +5 -5
- package/country/definition.js +1 -1
- package/country/index.cjs +1 -12
- package/country/index.js +4 -1216
- package/country-group/definition.cjs +6 -0
- package/country-group/definition.js +3 -0
- package/country-group/index.cjs +43 -0
- package/country-group/index.js +166 -0
- package/custom-elements.json +1112 -450
- package/data-grid/definition.cjs +9 -9
- package/data-grid/definition.js +2 -2
- package/data-grid/index.cjs +4 -4
- package/data-grid/index.js +47 -46
- package/date-picker/definition.cjs +5 -5
- package/date-picker/definition.js +2 -2
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +1 -1
- package/date-range-picker/definition.cjs +5 -5
- package/date-range-picker/definition.js +2 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +1 -1
- package/date-time-picker/definition.cjs +5 -5
- package/date-time-picker/definition.js +2 -2
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +1 -1
- package/dial-pad/definition.cjs +5 -5
- package/dial-pad/definition.js +2 -2
- package/dial-pad/index.cjs +4 -4
- package/dial-pad/index.js +9 -8
- package/dialog/definition.cjs +5 -5
- package/dialog/definition.js +2 -2
- package/dialog/index.cjs +4 -4
- package/dialog/index.js +12 -11
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/empty-state/definition.cjs +5 -5
- package/empty-state/definition.js +2 -2
- package/empty-state/index.cjs +2 -2
- package/empty-state/index.js +6 -5
- package/fab/definition.cjs +5 -5
- package/fab/definition.js +2 -2
- package/fab/index.cjs +2 -2
- package/fab/index.js +5 -4
- package/file-picker/definition.cjs +5 -5
- package/file-picker/definition.js +2 -2
- package/file-picker/index.cjs +6 -6
- package/file-picker/index.js +9 -8
- package/flag/definition.cjs +6 -0
- package/flag/definition.js +3 -0
- package/flag/index.cjs +10 -0
- package/flag/index.js +61 -0
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/icon/definition.cjs +1 -0
- package/icon/definition.js +1 -0
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -0
- package/index.cjs +183 -174
- package/index.js +48 -45
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/lib/button/button.d.ts +1 -0
- package/lib/components.d.ts +2 -0
- package/lib/country/countries-data.d.ts +1 -0
- package/lib/country/{country-code-to-flag-icon.d.ts → utils.d.ts} +0 -3
- package/lib/country-group/country-group.d.ts +829 -0
- package/lib/country-group/country-group.template.d.ts +3 -0
- package/lib/country-group/definition.d.ts +3 -0
- package/lib/country-group/index.d.ts +1 -0
- package/lib/country-group/locale.d.ts +3 -0
- package/lib/date-picker/date-picker.d.ts +4 -0
- package/lib/date-range-picker/date-range-picker.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +4 -0
- package/lib/flag/definition.d.ts +3 -0
- package/lib/flag/flag.d.ts +8 -0
- package/lib/flag/flag.template.d.ts +3 -0
- package/lib/flag/index.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -2
- package/lib/searchable-select/option-tag.d.ts +3 -1
- package/lib/searchable-select/searchable-select.d.ts +3 -1
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/time-picker/time-picker.d.ts +2 -0
- package/locales/de-DE.cjs +1 -0
- package/locales/de-DE.js +1 -0
- package/locales/en-GB.cjs +1 -0
- package/locales/en-GB.js +1 -0
- package/locales/en-US.cjs +1 -0
- package/locales/en-US.js +1 -0
- package/locales/ja-JP.cjs +1 -0
- package/locales/ja-JP.js +1 -0
- package/locales/zh-CN.cjs +1 -0
- package/locales/zh-CN.js +1 -0
- package/menu/definition.cjs +5 -5
- package/menu/definition.js +1 -1
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/definition.cjs +6 -6
- package/menu-item/definition.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav-disclosure/definition.cjs +5 -5
- package/nav-disclosure/definition.js +2 -2
- package/nav-disclosure/index.cjs +2 -2
- package/nav-disclosure/index.js +6 -5
- package/nav-item/definition.cjs +5 -5
- package/nav-item/definition.js +2 -2
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +5 -4
- package/note/definition.cjs +5 -5
- package/note/definition.js +2 -2
- package/note/index.cjs +2 -2
- package/note/index.js +5 -4
- package/number-field/definition.cjs +5 -5
- package/number-field/definition.js +2 -2
- package/number-field/index.cjs +2 -2
- package/number-field/index.js +6 -5
- package/option/definition.cjs +5 -5
- package/option/definition.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +4 -4
- package/pagination/definition.cjs +5 -5
- package/pagination/definition.js +2 -2
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popover/definition.cjs +5 -5
- package/popover/definition.js +2 -2
- package/popover/index.cjs +4 -4
- package/popover/index.js +7 -6
- package/popup/definition.cjs +4 -4
- package/popup/definition.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/definition.cjs +1 -1
- package/progress/definition.js +1 -1
- package/radio/definition.cjs +1 -1
- package/radio/definition.js +1 -1
- package/radio-group/definition.cjs +5 -5
- package/radio-group/definition.js +2 -2
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/definition.cjs +5 -5
- package/range-slider/definition.js +2 -2
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +22 -19
- package/rich-text-editor/definition.cjs +32 -32
- package/rich-text-editor/definition.js +2 -2
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +2 -2
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/searchable-select/definition.cjs +4 -4
- package/searchable-select/definition.js +2 -2
- package/searchable-select/index.cjs +6 -4
- package/searchable-select/index.js +76 -73
- package/select/definition.cjs +5 -5
- package/select/definition.js +2 -2
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/definition.cjs +5 -5
- package/selectable-box/definition.js +2 -2
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/icon/utils.d.ts +1 -0
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +1 -0
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -0
- package/shared/picker-field/picker-field.d.ts +2 -0
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +5 -5
- package/simple-color-picker/definition.js +2 -2
- package/simple-color-picker/index.cjs +2 -2
- package/simple-color-picker/index.js +6 -5
- package/slider/definition.cjs +5 -5
- package/slider/definition.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/definition.cjs +5 -5
- package/split-button/definition.js +2 -2
- package/split-button/index.cjs +2 -2
- package/split-button/index.js +7 -6
- package/status/definition.cjs +5 -5
- package/status/definition.js +2 -2
- package/status/index.cjs +2 -2
- package/status/index.js +5 -4
- package/switch/definition.cjs +5 -5
- package/switch/definition.js +2 -2
- package/switch/index.cjs +2 -2
- package/switch/index.js +6 -5
- package/tab/definition.cjs +5 -5
- package/tab/definition.js +2 -2
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/table/definition.cjs +17 -17
- package/table/definition.js +2 -2
- package/table/index.cjs +3 -3
- package/table/index.js +6 -5
- package/tabs/definition.cjs +6 -6
- package/tabs/definition.js +2 -2
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/definition.cjs +5 -5
- package/tag/definition.js +2 -2
- package/tag/index.cjs +4 -4
- package/tag/index.js +6 -5
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/text-area/definition.cjs +5 -5
- package/text-area/definition.js +2 -2
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/definition.cjs +5 -5
- package/text-field/definition.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/definition.cjs +4 -4
- package/time-picker/definition.js +2 -2
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +5 -5
- package/toggletip/definition.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +5 -5
- package/tooltip/definition.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/definition.cjs +5 -5
- package/tree-item/definition.js +2 -2
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/definition.cjs +5 -5
- package/tree-view/definition.js +2 -2
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/unbundled/definition11.cjs +6 -0
- package/unbundled/definition11.js +6 -0
- package/unbundled/definition14.cjs +1 -0
- package/unbundled/definition14.js +1 -0
- package/unbundled/definition2.cjs +5 -75
- package/unbundled/definition2.js +1 -71
- package/unbundled/definition28.cjs +1 -0
- package/unbundled/definition28.js +1 -0
- package/unbundled/definition31.cjs +2 -1189
- package/unbundled/definition31.js +1 -1188
- package/unbundled/definition32.cjs +207 -1835
- package/unbundled/definition32.js +203 -1807
- package/unbundled/definition33.cjs +83 -311
- package/unbundled/definition33.js +79 -235
- package/unbundled/definition34.cjs +1887 -25
- package/unbundled/definition34.js +1857 -24
- package/unbundled/definition35.cjs +315 -121
- package/unbundled/definition35.js +236 -114
- package/unbundled/definition36.cjs +25 -405
- package/unbundled/definition36.js +22 -397
- package/unbundled/definition37.cjs +47 -142
- package/unbundled/definition37.js +44 -139
- package/unbundled/definition38.cjs +345 -330
- package/unbundled/definition38.js +343 -328
- package/unbundled/definition39.cjs +183 -235
- package/unbundled/definition39.js +181 -233
- package/unbundled/definition40.cjs +377 -47
- package/unbundled/definition40.js +372 -42
- package/unbundled/definition41.cjs +256 -57
- package/unbundled/definition41.js +255 -56
- package/unbundled/definition42.cjs +45 -432
- package/unbundled/definition42.js +41 -428
- package/unbundled/definition43.cjs +63 -49
- package/unbundled/definition43.js +61 -47
- package/unbundled/definition44.cjs +438 -30
- package/unbundled/definition44.js +434 -25
- package/unbundled/definition45.cjs +46 -84
- package/unbundled/definition45.js +43 -81
- package/unbundled/definition46.cjs +29 -54
- package/unbundled/definition46.js +24 -50
- package/unbundled/definition47.cjs +93 -21
- package/unbundled/definition47.js +91 -16
- package/unbundled/definition48.cjs +49 -33
- package/unbundled/definition48.js +46 -30
- package/unbundled/definition49.cjs +22 -347
- package/unbundled/definition49.js +16 -344
- package/unbundled/definition50.cjs +34 -211
- package/unbundled/definition50.js +30 -207
- package/unbundled/definition51.cjs +282 -242
- package/unbundled/definition51.js +275 -235
- package/unbundled/definition52.cjs +211 -51
- package/unbundled/definition52.js +209 -48
- package/unbundled/definition53.cjs +275 -131
- package/unbundled/definition53.js +272 -127
- package/unbundled/definition54.cjs +50 -261
- package/unbundled/definition54.js +48 -260
- package/unbundled/definition55.cjs +126 -443
- package/unbundled/definition55.js +123 -441
- package/unbundled/definition56.cjs +234 -3596
- package/unbundled/definition56.js +229 -3428
- package/unbundled/definition57.cjs +407 -728
- package/unbundled/definition57.js +405 -726
- package/unbundled/definition58.cjs +3618 -106
- package/unbundled/definition58.js +3449 -100
- package/unbundled/definition59.cjs +624 -868
- package/unbundled/definition59.js +619 -863
- package/unbundled/definition60.cjs +106 -108
- package/unbundled/definition60.js +102 -104
- package/unbundled/definition61.cjs +1040 -71
- package/unbundled/definition61.js +1035 -65
- package/unbundled/definition62.cjs +105 -169
- package/unbundled/definition62.js +101 -165
- package/unbundled/definition63.cjs +70 -113
- package/unbundled/definition63.js +65 -109
- package/unbundled/definition64.cjs +181 -53
- package/unbundled/definition64.js +178 -50
- package/unbundled/definition65.cjs +109 -76
- package/unbundled/definition65.js +109 -75
- package/unbundled/definition66.cjs +58 -21
- package/unbundled/definition66.js +55 -15
- package/unbundled/definition67.cjs +81 -74
- package/unbundled/definition67.js +79 -73
- package/unbundled/definition68.cjs +19 -344
- package/unbundled/definition68.js +14 -335
- package/unbundled/definition69.cjs +88 -26
- package/unbundled/definition69.js +85 -22
- package/unbundled/definition7.cjs +18 -3
- package/unbundled/definition7.js +18 -3
- package/unbundled/definition70.cjs +330 -111
- package/unbundled/definition70.js +320 -108
- package/unbundled/definition71.cjs +26 -271
- package/unbundled/definition71.js +21 -267
- package/unbundled/definition72.cjs +134 -27
- package/unbundled/definition72.js +125 -25
- package/unbundled/definition73.cjs +245 -113
- package/unbundled/definition73.js +242 -104
- package/unbundled/definition74.cjs +28 -212
- package/unbundled/definition74.js +26 -202
- package/unbundled/definition75.cjs +117 -479
- package/unbundled/definition75.js +109 -475
- package/unbundled/definition76.cjs +232 -0
- package/unbundled/definition76.js +213 -0
- package/unbundled/definition77.cjs +533 -0
- package/unbundled/definition77.js +513 -0
- package/unbundled/numberConverter.cjs +91 -0
- package/unbundled/numberConverter.js +74 -0
- package/unbundled/picker-field.template.cjs +2 -0
- package/unbundled/picker-field.template.js +2 -0
- package/unbundled/utils.cjs +1439 -0
- package/unbundled/utils.js +1428 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/vivid.api.json +513 -0
- /package/{lib/icon/icon.placeholder.d.ts → shared/icon/icon-placeholder.d.ts} +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { o as defineVividComponent, s as createRegisterFunction
|
|
2
|
-
import {
|
|
1
|
+
import { o as defineVividComponent, s as createRegisterFunction } from "./vivid-element.js";
|
|
2
|
+
import { t as iconDefinition } from "./definition2.js";
|
|
3
3
|
import { t as __decorate } from "./decorate.js";
|
|
4
4
|
import { a as affixIconTemplateFactory, i as IconWrapper, n as AffixIconWithTrailing } from "./affix.js";
|
|
5
|
-
import { n as delegateAria, t as DelegatesAria } from "./delegates-aria.js";
|
|
6
|
-
import { r as ProgressRing, t as progressRingDefinition } from "./definition6.js";
|
|
7
5
|
import { n as FormAssociated } from "./form-associated.js";
|
|
8
6
|
import { t as FormElement } from "./form-element.js";
|
|
9
7
|
import { t as WithSuccessText } from "./with-success-text.js";
|
|
@@ -11,1053 +9,811 @@ import { t as WithErrorText } from "./with-error-text.js";
|
|
|
11
9
|
import { t as WithContextualHelp } from "./with-contextual-help.js";
|
|
12
10
|
import { t as Localized } from "./localized.js";
|
|
13
11
|
import { i as Button, r as chevronTemplateFactory, t as buttonDefinition } from "./definition7.js";
|
|
12
|
+
import { t as handleEscapeKeyAndStopPropogation } from "./dialog.js";
|
|
14
13
|
import { i as Popup, t as popupDefinition } from "./definition10.js";
|
|
15
|
-
import { t as
|
|
16
|
-
import { a as feedbackMessageDefinition,
|
|
17
|
-
import {
|
|
18
|
-
import { t as
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var searchable_select_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}.chevron{font:var(--vvd-typography-base-extended);flex-shrink:0;transition:transform .2s;display:flex;transform:rotate(0)}:host([data-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{--_low-ink-color:var(--vvd-color-neutral-600);inline-size:300px;display:inline-block}:host([disabled]){--_low-ink-color:var(--vvd-color-neutral-400);cursor:not-allowed}.control-wrapper{flex-direction:column;gap:4px;display:flex}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.selection-count{color:var(--_low-ink-color);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));--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-500)}.fieldset.appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.fieldset: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(--vvd-color-neutral-700)}.fieldset: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.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(--vvd-color-neutral-700)}.fieldset.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: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:disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.fieldset.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.disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.fieldset.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.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.fieldset.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.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:transparent}.fieldset.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.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-success-50);--_appearance-color-outline:transparent}.fieldset{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);justify-content:space-between;align-items:center;gap:8px;padding-block:8px;padding-inline:16px;transition:box-shadow .2s,background-color .2s;display:flex}@supports selector(:has(*)){.fieldset:not(.has-highlighted-option):has(input:focus){box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent}}@supports not selector(:has(*)){.fieldset:not(.has-highlighted-option):focus-within{box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - 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{flex-direction:column;flex:1;gap:8px;min-block-size:24px;display:flex;overflow:hidden}.tag-row{gap:8px;inline-size:100%;display:flex}.tag-row.contains-only-input:not(:focus-within){display:contents}.tag-wrapper{overflow:hidden}.tag{max-inline-size:100%}input{box-sizing:border-box;block-size:24px;font:var(--vvd-typography-base);background:0 0;border:none;outline:none;flex:1;min-inline-size:min(100px,40%);max-inline-size:100%}.contains-only-input input:not(:focus){opacity:0;pointer-events:none;block-size:0;inline-size:0;min-inline-size:0;position:absolute}.listbox{max-block-size:var(--searchable-select-height,408px);flex-direction:column;gap:2px;padding:4px;display:flex;overflow-y:auto}.empty-message{color:var(--vvd-color-neutral-300);font:var(--vvd-typography-base);text-align:center;justify-content:center;align-items:center;min-block-size:40px;display:flex}::part(popup-base){inline-size:max-content;min-inline-size:var(--_searchable-select-fixed-width,100%)}slot[name=icon]{font-size:20px}.visually-hidden{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}::slotted([data-vvd-component=option][data-highlighted]),[data-select-all][data-highlighted]{box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;border-radius:8px}.divider{margin-block:10px;margin-inline:12px}";
|
|
14
|
+
import { n as applyHostSemantics, t as HostSemantics } from "./host-semantics.js";
|
|
15
|
+
import { a as feedbackMessageDefinition, n as WithLightDOMFeedback } from "./mixins.js";
|
|
16
|
+
import { r as ListboxOption, t as listboxOptionDefinition } from "./definition29.js";
|
|
17
|
+
import { t as Listbox } from "./listbox.js";
|
|
18
|
+
import { Observable, Updates, attr, html, observable, ref, slotted, volatile, when } from "@microsoft/fast-element";
|
|
19
|
+
import { classNames, inRange, keyArrowDown, keyArrowUp, keyEnd, keyEnter, keyEscape, keyHome, keySpace, keyTab, uniqueId } from "@microsoft/fast-web-utilities";
|
|
20
|
+
//#region src/lib/select/select.scss?inline
|
|
21
|
+
var select_default = ".label-wrapper{align-items:center;gap:var(--label-wrapper-gap,4px);flex-direction:row;display:flex}.label-wrapper[hidden]{display:none}.label:not(slot),.label::slotted(label){flex:0 auto}.chevron{font:var(--vvd-typography-base-extended);flex-shrink:0;transition:transform .2s;display:flex;transform:rotate(0)}:host([data-expanded=true]) .chevron,:host([open]) .chevron{transform:rotate(180deg)}:host(:focus-visible){outline:none}:host{--_low-ink-color:var(--vvd-color-neutral-600);--focus-stroke-gap-color:transparent;flex-direction:column;gap:4px;display:inline-flex}:host([disabled]){--_low-ink-color:var(--vvd-color-neutral-400);cursor:not-allowed}.label{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.control{--_appearance-color-text:var(--vvd-color-canvas-text);--_appearance-color-fill:var(--vvd-color-canvas);--_appearance-color-outline:var(--vvd-color-neutral-500)}.control.appearance-ghost{--_appearance-color-text:var(--_connotation-color-firm);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}@media (hover:hover){.control: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(--vvd-color-neutral-700)}.control: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}}.control.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(--vvd-color-neutral-700)}.control.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}.control: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)}.control:disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.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)}.control.disabled.appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.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)}.control.readonly:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:var(--vvd-color-neutral-600);--_appearance-color-fill:transparent;--_appearance-color-outline:transparent}.control.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)}.control.error:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-alert-50);--_appearance-color-outline:transparent}.control.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)}.control.success:where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text:notSet;--_appearance-color-fill:var(--vvd-color-success-50);--_appearance-color-outline:transparent}.control{--_connotation-color-primary:var(--vvd-select-accent-primary,var(--vvd-color-canvas-text));--_connotation-color-primary-text:var(--vvd-select-accent-primary-text,var(--vvd-color-canvas));--_connotation-color-primary-increment:var(--vvd-select-accent-primary-increment,var(--vvd-color-neutral-800));--_connotation-color-intermediate:var(--vvd-select-accent-intermediate,var(--vvd-color-neutral-500));--_connotation-color-faint:var(--vvd-select-accent-faint,var(--vvd-color-neutral-50));--_connotation-color-soft:var(--vvd-select-accent-soft,var(--vvd-color-neutral-100));--_connotation-color-firm:var(--vvd-select-accent-firm,var(--vvd-color-canvas-text));--_connotation-color-fierce:var(--vvd-select-accent-fierce,var(--vvd-color-neutral-700));border-radius:var(--_select-control-border-radius);block-size:var(--_select-block-size);padding-inline:var(--_select-padding-inline);--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2)));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);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);justify-content:space-between;align-items:center;gap:8px;transition:box-shadow .2s,background-color .2s;display:flex}.control.size-condensed{--_select-icon-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2))) / 2.5);--_select-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 8));--_select-padding-inline:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 2)}.control.size-condensed:not(.shape-pill){--_select-control-border-radius:4px}.control-wrapper{position:relative}.control:not(.disabled){cursor:pointer}.control.disabled{pointer-events:none}.control:not(.shape-pill){--_select-control-border-radius:8px}.control.shape-pill{--_select-control-border-radius:24px}.listbox{max-height:var(--select-height,408px);flex-direction:column;gap:2px;padding:4px;display:flex;overflow-y:auto}:host([multiple]:focus-visible) .listbox{box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));border-radius:8px}.selected-value{white-space:nowrap;flex-grow:1;align-items:center;column-gap:12px;display:flex;overflow:hidden}.selected-value .text{text-overflow:ellipsis;max-inline-size:100%;overflow:hidden}.control.shows-placeholder .selected-value .text{color:var(--vvd-color-neutral-600)}.selected-value slot[name=icon]{flex:0 0 var(--_select-icon-size);font-size:var(--_select-icon-size);line-height:1}.control.has-meta .selected-value{padding-inline-end:8px}.feedback-wrapper{display:contents}::part(popup-base){inline-size:max-content;min-inline-size:var(--_select-fixed-width,100%)}:host([multiple]) ::part(popup-base){position:static}@supports selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant,:has(.clear-button:focus)){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}@supports not selector(:has(*)){:host(:focus-within) .control:not(.has-activedescendant){--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px))}}:host(:not([multiple]):focus-visible) ::slotted([data-vvd-component=option][current-selected]){box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));--focus-stroke-gap-color:transparent;border-radius:8px}:host([multiple]) .clear-button{margin-inline-start:auto}:host([multiple][clearable]) .label-wrapper{min-block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16))}";
|
|
24
22
|
//#endregion
|
|
25
|
-
//#region src/lib/
|
|
26
|
-
var option_tag_default = ".base.connotation-cta{--_connotation-color-contrast:var(--vvd-option-tag-cta-contrast,var(--vvd-color-cta-800))}.base:not(.connotation-cta){--_connotation-color-contrast:var(--vvd-option-tag-accent-contrast,var(--vvd-color-neutral-800))}.base{box-sizing:border-box;background-color:var(--fill-color);block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16));box-shadow:inset 0 0 0 1px var(--outline-color);color:var(--text-color);font:var(--vvd-typography-base-bold);user-select:none;vertical-align:middle;align-items:center;column-gap:8px;max-inline-size:100%;padding-inline:8px;display:inline-flex;position:relative}.base:not(.disabled){--text-color:var(--_connotation-color-contrast);--fill-color:var(--_connotation-color-soft);--outline-color:transparent}@supports (background-color:color-mix(in srgb, black 50%, white)){.base:not(.disabled){--fill-color:color-mix(in srgb, var(--_connotation-color-contrast), transparent 87.5%)}}.base.disabled{--text-color:var(--vvd-color-neutral-300);--fill-color:var(--vvd-color-neutral-200);--outline-color:transparent}@supports (background-color:color-mix(in srgb, black 50%, white)){.base.disabled{--fill-color:color-mix(in srgb, var(--vvd-color-neutral-800), transparent 87.5%)}}.base:not(.shape-pill){border-radius:4px}.base.shape-pill{border-radius:16px}.label{text-overflow:ellipsis;white-space:nowrap;max-inline-size:100%;overflow:hidden}slot[name=icon]{font-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 1.5);line-height:1}.icon-placeholder{inline-size:calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16)) / 1.5)}.remove-button{border-radius:inherit;cursor:pointer;outline:none;align-items:center;display:flex}.disabled .remove-button{pointer-events:none}.remove-button:focus-visible:before{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,var(--vvd-color-cta-500)), transparent 85%), inset 0 0 0 3px var(--focus-stroke-gap-color,currentColor);outline:1px solid var(--focus-stroke-color,var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset,0px));z-index:1;border-radius:inherit;content:\"\";pointer-events:none;display:block;position:absolute;inset:0}";
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/lib/searchable-select/searchable-select.ts
|
|
29
|
-
var TagGapPx = 8;
|
|
30
|
-
var InputMinWidthPx = 100;
|
|
31
|
-
var PageSize = 10;
|
|
32
|
-
var isFormAssociatedTryingToSetFormValue = (value) => typeof value === "string";
|
|
23
|
+
//#region src/lib/select/select.ts
|
|
33
24
|
/**
|
|
34
25
|
* @public
|
|
35
|
-
* @component
|
|
36
|
-
* @slot -
|
|
37
|
-
* @slot icon - The preferred way to add an icon to the control.
|
|
38
|
-
* @slot meta - Slot to add meta content to the control.
|
|
39
|
-
* @slot helper-text - Describes how to use the
|
|
40
|
-
* @
|
|
41
|
-
* @
|
|
42
|
-
* @slot loading-options - Message that appears there are no options to display and the component is in a loading state.
|
|
43
|
-
* @event {CustomEvent<undefined>} input - Fired when the selected options change
|
|
44
|
-
* @event {CustomEvent<undefined>} search-text-change - Fired when the search text changes
|
|
45
|
-
* @event {CustomEvent<undefined>} change - Fired when the selected options change
|
|
26
|
+
* @component select
|
|
27
|
+
* @slot - Default slot.
|
|
28
|
+
* @slot icon - The preferred way to add an icon to the select control.
|
|
29
|
+
* @slot meta - Slot to add meta content to the select control.
|
|
30
|
+
* @slot helper-text - Describes how to use the select. Alternative to the `helper-text` attribute.
|
|
31
|
+
* @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value updates
|
|
32
|
+
* @event {CustomEvent<HTMLElement>} change - Fires a custom 'change' event when the value updates
|
|
46
33
|
* @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
|
|
47
|
-
* @vueModel values values input,@lazy:change `event.currentTarget.values`
|
|
48
34
|
* @testAction selectOptionByValue selectOptionByValue
|
|
49
35
|
* @testAction selectOptionByText selectOptionByText
|
|
50
|
-
* @testQuery values values
|
|
51
|
-
* @testQuery selectedOptions selectedOptionsText
|
|
52
36
|
*/
|
|
53
|
-
var
|
|
37
|
+
var Select = class extends WithLightDOMFeedback(WithContextualHelp(WithErrorText(WithSuccessText(Localized(FormElement(HostSemantics(AffixIconWithTrailing(FormAssociated(Listbox))))))))) {
|
|
54
38
|
constructor(..._args) {
|
|
55
39
|
super(..._args);
|
|
56
|
-
this.
|
|
40
|
+
this.proxy = document.createElement("select");
|
|
41
|
+
this.activeIndex = -1;
|
|
42
|
+
this.rangeStartIndex = -1;
|
|
57
43
|
this.open = false;
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this._currentSearchText = null;
|
|
64
|
-
this._areOptionsInitialized = false;
|
|
65
|
-
this._filteredOptions = [];
|
|
66
|
-
this._filteredEnabledOptions = [];
|
|
67
|
-
this.loading = false;
|
|
68
|
-
this._highlightedOptionIndex = null;
|
|
69
|
-
this._numElidedTags = 0;
|
|
70
|
-
this._tagRows = [];
|
|
71
|
-
this._lastTagRow = [];
|
|
44
|
+
this.listboxId = uniqueId("listbox-");
|
|
45
|
+
this.maxHeight = 0;
|
|
46
|
+
this.fixedDropdown = false;
|
|
47
|
+
this._feedbackWrapper = null;
|
|
48
|
+
this._isResetting = false;
|
|
72
49
|
this.clearable = false;
|
|
73
|
-
this.
|
|
74
|
-
this._slottedDisabledOptions = [];
|
|
75
|
-
this.enableSelectAll = false;
|
|
76
|
-
this.proxy = document.createElement("input");
|
|
77
|
-
this.setFormValue = (value, state) => {
|
|
78
|
-
if (isFormAssociatedTryingToSetFormValue(value)) return;
|
|
79
|
-
super.setFormValue(value, state);
|
|
80
|
-
};
|
|
81
|
-
this._changeDescription = "";
|
|
50
|
+
this._isClearButtonFocused = false;
|
|
82
51
|
}
|
|
83
52
|
/**
|
|
53
|
+
* Returns the last checked option.
|
|
54
|
+
*
|
|
84
55
|
* @internal
|
|
85
56
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
57
|
+
get activeOption() {
|
|
58
|
+
return this.options[this.activeIndex];
|
|
88
59
|
}
|
|
89
60
|
/**
|
|
61
|
+
* Returns the list of checked options.
|
|
62
|
+
*
|
|
90
63
|
* @internal
|
|
91
64
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (!this.multiple && this.values.length > 1) {
|
|
95
|
-
this.values = [this.values[0]];
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (this.values.some((value) => !this.#isValidValue(value))) {
|
|
99
|
-
this.values = this.values.filter((value) => this.#isValidValue(value));
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this.value = this.values.length ? this.values[0] : "";
|
|
103
|
-
this.#updateSelectionLimit();
|
|
104
|
-
this.#updateSelectedOnSlottedOptions();
|
|
105
|
-
if (this.$fastController.isConnected) this.#updateTagLayout();
|
|
106
|
-
this.#updateFormValue();
|
|
107
|
-
}
|
|
108
|
-
#updateValuesThroughUserInteraction(newValues) {
|
|
109
|
-
this.values = newValues;
|
|
110
|
-
this.$emit("change", void 0, { bubbles: false });
|
|
111
|
-
this.$emit("input", void 0, { bubbles: false });
|
|
112
|
-
}
|
|
113
|
-
#updateValuesWhileMaintainingOrder(newValues) {
|
|
114
|
-
const oldSet = new Set(this.values);
|
|
115
|
-
const newSet = new Set(newValues);
|
|
116
|
-
this.values = [...this.values].filter((v) => newSet.has(v)).concat([...newValues].filter((v) => !oldSet.has(v)));
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
*/
|
|
121
|
-
initialValuesChanged() {
|
|
122
|
-
if (!this.dirtyValue) {
|
|
123
|
-
this.values = this.initialValues;
|
|
124
|
-
this.dirtyValue = false;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
#isValidValue(value) {
|
|
128
|
-
return this._slottedOptions.some((option) => option.value === value);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* @internal
|
|
132
|
-
*/
|
|
133
|
-
valueChanged(prev, next) {
|
|
134
|
-
super.valueChanged(prev, next);
|
|
135
|
-
if (!this._areOptionsInitialized) return;
|
|
136
|
-
const isValidValue = this._slottedOptions.some((option) => option.value === next);
|
|
137
|
-
if (this.values[0] !== next) this.values = isValidValue ? [next] : [];
|
|
138
|
-
}
|
|
139
|
-
get selectedIndex() {
|
|
140
|
-
if (this.values.length) return this._slottedOptions.findIndex((option) => option.value === this.values[0]);
|
|
141
|
-
else return -1;
|
|
142
|
-
}
|
|
143
|
-
set selectedIndex(index) {
|
|
144
|
-
this.value = this._slottedOptions[index]?.value ?? "";
|
|
145
|
-
}
|
|
146
|
-
get options() {
|
|
147
|
-
return [...this._slottedOptions];
|
|
148
|
-
}
|
|
149
|
-
get selectedOptions() {
|
|
150
|
-
return this._slottedOptions.filter((option) => this.values.includes(option.value));
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* @internal
|
|
154
|
-
*/
|
|
155
|
-
_currentSearchTextChanged() {
|
|
156
|
-
this.#updateFilteredOptions();
|
|
157
|
-
this.$emit("search-text-change", void 0, {
|
|
158
|
-
bubbles: false,
|
|
159
|
-
composed: false
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Read-only property containing the current search text.
|
|
164
|
-
*/
|
|
165
|
-
get searchText() {
|
|
166
|
-
return this._currentSearchText ?? "";
|
|
65
|
+
get checkedOptions() {
|
|
66
|
+
return this.options.filter((o) => o.checked);
|
|
167
67
|
}
|
|
168
68
|
/**
|
|
69
|
+
* Returns the index of the first selected option.
|
|
70
|
+
*
|
|
169
71
|
* @internal
|
|
170
72
|
*/
|
|
171
|
-
get
|
|
172
|
-
return this.
|
|
73
|
+
get firstSelectedOptionIndex() {
|
|
74
|
+
return this.options.indexOf(this.firstSelectedOption);
|
|
173
75
|
}
|
|
174
76
|
/**
|
|
77
|
+
* Updates the `ariaActiveDescendant` property when the active index changes.
|
|
78
|
+
*
|
|
175
79
|
* @internal
|
|
176
80
|
*/
|
|
177
|
-
|
|
178
|
-
this.
|
|
81
|
+
activeIndexChanged(_, next) {
|
|
82
|
+
this._activeDescendant = this.options[next]?.id ?? "";
|
|
83
|
+
this.focusAndScrollOptionIntoView();
|
|
179
84
|
}
|
|
180
85
|
/**
|
|
86
|
+
* Toggles the checked state for the currently active option.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* Multiple-selection mode only.
|
|
90
|
+
*
|
|
181
91
|
* @internal
|
|
182
92
|
*/
|
|
183
|
-
|
|
184
|
-
this
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
*
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
this
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
93
|
+
checkActiveIndex() {
|
|
94
|
+
const activeItem = this.activeOption;
|
|
95
|
+
/* v8 ignore else -- @preserve */
|
|
96
|
+
if (activeItem) activeItem.checked = true;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Sets the active index to the first option and marks it as checked.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* Multi-selection mode only.
|
|
103
|
+
*
|
|
104
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
105
|
+
*
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
checkFirstOption(preserveChecked) {
|
|
109
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
110
|
+
if (firstSelectableIndex === -1) return;
|
|
111
|
+
if (preserveChecked) {
|
|
112
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
113
|
+
this.options.forEach((o, i) => {
|
|
114
|
+
o.checked = inRange(i, firstSelectableIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
115
|
+
});
|
|
116
|
+
} else this.uncheckAllOptions();
|
|
117
|
+
this.activeIndex = firstSelectableIndex;
|
|
118
|
+
this.checkActiveIndex();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Decrements the active index and sets the matching option as checked.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* Multi-selection mode only.
|
|
125
|
+
*
|
|
126
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
checkLastOption(preserveChecked) {
|
|
131
|
+
const lastSelectableIndex = this.getPreviousSelectableIndex(this.length - 1);
|
|
132
|
+
if (lastSelectableIndex === -1) return;
|
|
133
|
+
if (preserveChecked) {
|
|
134
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
135
|
+
this.options.forEach((o, i) => {
|
|
136
|
+
o.checked = inRange(i, this.rangeStartIndex, lastSelectableIndex + 1) && !o.disabled;
|
|
137
|
+
});
|
|
138
|
+
} else this.uncheckAllOptions();
|
|
139
|
+
this.activeIndex = lastSelectableIndex;
|
|
140
|
+
this.checkActiveIndex();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Increments the active index and marks the matching option as checked.
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* Multiple-selection mode only.
|
|
147
|
+
*
|
|
148
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
149
|
+
*
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
checkNextOption(preserveChecked) {
|
|
153
|
+
const nextIndex = this.getNextSelectableIndex(this.activeIndex + 1);
|
|
154
|
+
if (nextIndex === -1) return;
|
|
155
|
+
if (preserveChecked) {
|
|
156
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
157
|
+
this.options.forEach((o, i) => {
|
|
158
|
+
o.checked = inRange(i, this.rangeStartIndex, nextIndex + 1) && !o.disabled;
|
|
159
|
+
});
|
|
160
|
+
} else this.uncheckAllOptions();
|
|
161
|
+
this.activeIndex = nextIndex;
|
|
162
|
+
this.checkActiveIndex();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Decrements the active index and marks the matching option as checked.
|
|
166
|
+
*
|
|
167
|
+
* @remarks
|
|
168
|
+
* Multiple-selection mode only.
|
|
169
|
+
*
|
|
170
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
171
|
+
*
|
|
172
|
+
* @internal
|
|
173
|
+
*/
|
|
174
|
+
checkPreviousOption(preserveChecked) {
|
|
175
|
+
const previousIndex = this.getPreviousSelectableIndex(this.activeIndex - 1);
|
|
176
|
+
if (previousIndex === -1) return;
|
|
177
|
+
if (preserveChecked) {
|
|
178
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
179
|
+
if (this.checkedOptions.length === 1) this.rangeStartIndex += 1;
|
|
180
|
+
this.options.forEach((o, i) => {
|
|
181
|
+
o.checked = inRange(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
182
|
+
});
|
|
183
|
+
} else this.uncheckAllOptions();
|
|
184
|
+
this.activeIndex = previousIndex;
|
|
185
|
+
this.checkActiveIndex();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
focusAndScrollOptionIntoView() {
|
|
191
|
+
super.focusAndScrollOptionIntoView(this.activeOption);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* In multiple-selection mode:
|
|
195
|
+
* If any options are selected, the first selected option is checked when
|
|
196
|
+
* the listbox receives focus. If no options are selected, the first
|
|
197
|
+
* selectable option is checked.
|
|
198
|
+
*
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
focusinHandler(e) {
|
|
202
|
+
if (!this.multiple) return super.focusinHandler(e);
|
|
203
|
+
/* v8 ignore else -- @preserve */
|
|
204
|
+
if (!this.shouldSkipFocus && e.target === e.currentTarget) {
|
|
205
|
+
this.uncheckAllOptions();
|
|
206
|
+
if (this.activeIndex === -1) this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
|
|
207
|
+
this.checkActiveIndex();
|
|
208
|
+
this.setSelectedOptions();
|
|
209
|
+
this.focusAndScrollOptionIntoView();
|
|
265
210
|
}
|
|
266
|
-
|
|
211
|
+
this.shouldSkipFocus = false;
|
|
267
212
|
}
|
|
268
213
|
/**
|
|
269
|
-
*
|
|
214
|
+
* Sets an option as selected and gives it focus.
|
|
215
|
+
*
|
|
216
|
+
* @public
|
|
270
217
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
if (oldValue) {
|
|
276
|
-
this._slottedDisabledOptions = [];
|
|
277
|
-
for (const option of oldValue) Observable.getNotifier(option).unsubscribe(this.#slottedOptionsChangeHandler, "selected");
|
|
218
|
+
setSelectedOptions() {
|
|
219
|
+
if (!this.multiple) {
|
|
220
|
+
super.setSelectedOptions();
|
|
221
|
+
return;
|
|
278
222
|
}
|
|
279
223
|
/* v8 ignore else -- @preserve */
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
const values = [];
|
|
285
|
-
for (const option of this._slottedOptions) {
|
|
286
|
-
if (option.selected || option.value === this.value || this.values.includes(option.value)) values.push(option.value);
|
|
287
|
-
if (option.disabled) this._slottedDisabledOptions.push(option);
|
|
288
|
-
}
|
|
289
|
-
this.#updateValuesWhileMaintainingOrder(values);
|
|
290
|
-
this.#updateFilteredOptions();
|
|
291
|
-
this.#updateSelectionLimit();
|
|
292
|
-
}
|
|
293
|
-
#slottedOptionsChangeHandler = { handleChange: (source, _) => {
|
|
294
|
-
if (source.selected && !this.values.includes(source.value)) this.values = [...this.values, source.value];
|
|
295
|
-
else if (!source.selected && this.values.includes(source.value)) this.values = this.values.filter((option) => option !== source.value);
|
|
296
|
-
} };
|
|
297
|
-
#updateSelectedOnSlottedOptions() {
|
|
298
|
-
for (const option of this._slottedOptions) {
|
|
299
|
-
option.selected = this.values.includes(option.value);
|
|
300
|
-
this.#updateClonedTagIconOfOption(option);
|
|
224
|
+
if (this.$fastController.isConnected && this.options) {
|
|
225
|
+
this.selectedOptions = this.options.filter((o) => o.selected);
|
|
226
|
+
this.focusAndScrollOptionIntoView();
|
|
301
227
|
}
|
|
302
228
|
}
|
|
303
|
-
#handleOptionInteraction(option) {
|
|
304
|
-
const value = option.value;
|
|
305
|
-
let newValues;
|
|
306
|
-
let shouldClearSearchText = false;
|
|
307
|
-
const isSelection = !this.values.includes(value);
|
|
308
|
-
if (this.multiple) {
|
|
309
|
-
if (isSelection) newValues = [...this.values, value];
|
|
310
|
-
else newValues = this.values.filter((option) => option !== value);
|
|
311
|
-
shouldClearSearchText = true;
|
|
312
|
-
} else {
|
|
313
|
-
if (isSelection) {
|
|
314
|
-
newValues = [value];
|
|
315
|
-
shouldClearSearchText = true;
|
|
316
|
-
} else newValues = [];
|
|
317
|
-
this.open = false;
|
|
318
|
-
}
|
|
319
|
-
this.#updateValuesThroughUserInteraction(newValues);
|
|
320
|
-
this._changeDescription = `${isSelection ? this.locale.searchableSelect.optionSelectedMessage(option._getAccessibleName()) : this.locale.searchableSelect.optionDeselectedMessage(option._getAccessibleName())} ${this.multiple && this.maxSelected && this.maxSelected >= 1 ? this.locale.searchableSelect.maxSelectedMessage(this.values.length, this.maxSelected) : ""}`;
|
|
321
|
-
if (shouldClearSearchText) this._currentSearchText = null;
|
|
322
|
-
}
|
|
323
|
-
#clonedTagIcons = /* @__PURE__ */ new Map();
|
|
324
|
-
#tagIconOfOption(option) {
|
|
325
|
-
return option.querySelector("[slot=\"tag-icon\"]");
|
|
326
|
-
}
|
|
327
229
|
/**
|
|
230
|
+
* Toggles the selected state of the provided options. If any provided items
|
|
231
|
+
* are in an unselected state, all items are set to selected. If every
|
|
232
|
+
* provided item is selected, they are all unselected.
|
|
233
|
+
*
|
|
328
234
|
* @internal
|
|
329
235
|
*/
|
|
330
|
-
|
|
331
|
-
|
|
236
|
+
toggleSelectedForAllCheckedOptions() {
|
|
237
|
+
const enabledCheckedOptions = this.checkedOptions.filter((o) => !o.disabled);
|
|
238
|
+
const force = !enabledCheckedOptions.every((o) => o.selected);
|
|
239
|
+
enabledCheckedOptions.forEach((o) => o.selected = force);
|
|
240
|
+
this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
|
|
241
|
+
this.setSelectedOptions();
|
|
242
|
+
this.updateValue(true);
|
|
332
243
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
this
|
|
244
|
+
/**
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
typeaheadBufferChanged(prev, next) {
|
|
248
|
+
if (!this.multiple) {
|
|
249
|
+
super.typeaheadBufferChanged(prev, next);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
/* v8 ignore if -- @preserve */
|
|
253
|
+
if (this.$fastController.isConnected) {
|
|
254
|
+
const typeaheadMatches = this.getTypeaheadMatches();
|
|
255
|
+
const activeIndex = this.options.indexOf(typeaheadMatches[0]);
|
|
256
|
+
if (activeIndex > -1) {
|
|
257
|
+
this.activeIndex = activeIndex;
|
|
258
|
+
this.uncheckAllOptions();
|
|
259
|
+
this.checkActiveIndex();
|
|
348
260
|
}
|
|
261
|
+
this.typeaheadExpired = false;
|
|
349
262
|
}
|
|
350
263
|
}
|
|
351
264
|
/**
|
|
265
|
+
* Unchecks all options.
|
|
266
|
+
*
|
|
267
|
+
* @remarks
|
|
268
|
+
* Multiple-selection mode only.
|
|
269
|
+
*
|
|
270
|
+
* @param preserveChecked - reset the rangeStartIndex
|
|
271
|
+
*
|
|
352
272
|
* @internal
|
|
353
273
|
*/
|
|
354
|
-
|
|
355
|
-
this
|
|
274
|
+
uncheckAllOptions(preserveChecked = false) {
|
|
275
|
+
this.options.forEach((o) => o.checked = false);
|
|
276
|
+
/* v8 ignore else -- @preserve */
|
|
277
|
+
if (!preserveChecked) this.rangeStartIndex = -1;
|
|
356
278
|
}
|
|
357
279
|
/**
|
|
280
|
+
* Sets focus when the open property changes.
|
|
281
|
+
*
|
|
358
282
|
* @internal
|
|
359
283
|
*/
|
|
360
|
-
|
|
361
|
-
this.
|
|
362
|
-
if (
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const optionFilter = this.optionFilter ?? ((option, searchText) => option.text.toLowerCase().includes(searchText.toLowerCase()));
|
|
367
|
-
for (const option of this._slottedOptions ?? []) {
|
|
368
|
-
option._vvdSearchText = this.searchText;
|
|
369
|
-
const matches = !this.searchText || optionFilter(option, this.searchText);
|
|
370
|
-
option._isNotMatching = !matches;
|
|
371
|
-
if (!option.hidden && matches) newFilteredOptions.push(option);
|
|
372
|
-
}
|
|
373
|
-
this.#transitionHighlightedOptionTo(null);
|
|
374
|
-
this._filteredOptions = newFilteredOptions;
|
|
375
|
-
const enabled = newFilteredOptions.filter((o) => !o.disabled);
|
|
376
|
-
if (this._selectAllOption) this._filteredEnabledOptions = [this._selectAllOption, ...enabled];
|
|
377
|
-
else this._filteredEnabledOptions = enabled;
|
|
378
|
-
}
|
|
379
|
-
#transitionHighlightedOptionTo(index) {
|
|
380
|
-
if (typeof this._highlightedOptionIndex === "number") {
|
|
381
|
-
const prevOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
|
|
382
|
-
prevOption._highlighted = false;
|
|
383
|
-
prevOption.removeAttribute("data-highlighted");
|
|
384
|
-
}
|
|
385
|
-
if (typeof index === "number") if (!this._filteredEnabledOptions.length) index = null;
|
|
386
|
-
else index = Math.max(0, Math.min(this._filteredEnabledOptions.length - 1, index));
|
|
387
|
-
this._highlightedOptionIndex = index;
|
|
388
|
-
if (typeof this._highlightedOptionIndex === "number") {
|
|
389
|
-
const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
|
|
390
|
-
highlightedOption._highlighted = true;
|
|
391
|
-
highlightedOption.setAttribute("data-highlighted", "");
|
|
392
|
-
scrollIntoView(highlightedOption, this._listbox, "nearest");
|
|
393
|
-
this._changeDescription = this.locale.searchableSelect.optionFocusedMessage(highlightedOption._getAccessibleName(), this._highlightedOptionIndex + 1, this._filteredEnabledOptions.length, highlightedOption.selected);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
#selectHighlightedOption() {
|
|
397
|
-
if (this._highlightedOptionIndex === null) return;
|
|
398
|
-
const highlightedOption = this._filteredEnabledOptions[this._highlightedOptionIndex];
|
|
399
|
-
if (highlightedOption.getAttribute("data-select-all") !== null) {
|
|
400
|
-
this._toggleSelectAll();
|
|
284
|
+
openChanged(prev, next) {
|
|
285
|
+
if (!this.collapsible) return;
|
|
286
|
+
if (this.open) {
|
|
287
|
+
this.focusAndScrollOptionIntoView();
|
|
288
|
+
this.indexWhenOpened = this.selectedIndex;
|
|
289
|
+
Updates.enqueue(() => this.focus());
|
|
401
290
|
return;
|
|
402
291
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.#transitionHighlightedOptionTo(0);
|
|
407
|
-
}
|
|
408
|
-
#highlightLastOption() {
|
|
409
|
-
this.#transitionHighlightedOptionTo(this._filteredEnabledOptions.length - 1);
|
|
410
|
-
}
|
|
411
|
-
#highlightPrevPage() {
|
|
412
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - PageSize);
|
|
413
|
-
}
|
|
414
|
-
#highlightNextPage() {
|
|
415
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? -1) + PageSize);
|
|
416
|
-
}
|
|
417
|
-
#highlightPreviousOption() {
|
|
418
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? this._filteredEnabledOptions.length) - 1);
|
|
419
|
-
}
|
|
420
|
-
#highlightNextOption() {
|
|
421
|
-
this.#transitionHighlightedOptionTo((this._highlightedOptionIndex ?? -1) + 1);
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* @internal
|
|
425
|
-
*/
|
|
426
|
-
_tagLabelForValue(value) {
|
|
427
|
-
return this._slottedOptions.find((option) => option.value === value).label;
|
|
292
|
+
const didClose = prev === true && next === false;
|
|
293
|
+
const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
|
|
294
|
+
if (didClose && selectionChangedWhileOpen) this.updateValue(true);
|
|
428
295
|
}
|
|
429
296
|
/**
|
|
297
|
+
* The component is collapsible when in single-selection mode.
|
|
298
|
+
*
|
|
430
299
|
* @internal
|
|
431
300
|
*/
|
|
432
|
-
|
|
433
|
-
return this.
|
|
301
|
+
get collapsible() {
|
|
302
|
+
return !this.multiple;
|
|
434
303
|
}
|
|
435
304
|
/**
|
|
436
305
|
* @internal
|
|
437
306
|
*/
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
307
|
+
valueChanged(prev, next) {
|
|
308
|
+
const nextSelectedIndex = this.options.findIndex((el) => el.value === next);
|
|
309
|
+
const validNextSelectedIndex = this._validSelectedIndex(nextSelectedIndex);
|
|
310
|
+
const nextValue = this.options[validNextSelectedIndex]?.value ?? "";
|
|
311
|
+
if (this.selectedIndex !== validNextSelectedIndex) this.selectedIndex = validNextSelectedIndex;
|
|
312
|
+
if (next !== nextValue) return;
|
|
313
|
+
super.valueChanged(prev, next);
|
|
314
|
+
this.updateDisplayValue();
|
|
444
315
|
}
|
|
445
316
|
/**
|
|
317
|
+
* Sets the value and display value to match the first selected option.
|
|
318
|
+
*
|
|
319
|
+
* @param shouldEmit - if true, the input and change events will be emitted
|
|
320
|
+
*
|
|
446
321
|
* @internal
|
|
447
322
|
*/
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
tag.remove();
|
|
457
|
-
return width;
|
|
458
|
-
}
|
|
459
|
-
#updateTagLayout() {
|
|
460
|
-
if (!this.multiple) {
|
|
461
|
-
this._numElidedTags = 0;
|
|
462
|
-
this._tagRows = [];
|
|
463
|
-
this._lastTagRow = [];
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
if (this.externalTags) {
|
|
467
|
-
this._numElidedTags = this.values.length;
|
|
468
|
-
this._tagRows = [];
|
|
469
|
-
this._lastTagRow = [];
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
const rowWidth = this._contentArea.getBoundingClientRect().width;
|
|
473
|
-
const rows = [[]];
|
|
474
|
-
let currentRowIndex = 0;
|
|
475
|
-
let currentRowWidth = InputMinWidthPx;
|
|
476
|
-
let i;
|
|
477
|
-
for (i = this.values.length - 1; i >= 0; i--) {
|
|
478
|
-
const isLastRow = this.maxLines && currentRowIndex === this.maxLines - 1;
|
|
479
|
-
const tagWidth = this.#measureTagWidth(this._tagLabelForValue(this.values[i]), true, this.#tagIconOfOption(this.selectedOptions[i]) !== null);
|
|
480
|
-
const entry = {
|
|
481
|
-
value: this.values[i],
|
|
482
|
-
width: tagWidth
|
|
483
|
-
};
|
|
484
|
-
let elidedTagCounterWidth = 0;
|
|
485
|
-
if (isLastRow) {
|
|
486
|
-
const numElidedTags = i;
|
|
487
|
-
if (numElidedTags) elidedTagCounterWidth = TagGapPx + this.#measureTagWidth(numElidedTags.toString(), false, false);
|
|
488
|
-
}
|
|
489
|
-
if (currentRowWidth + TagGapPx + tagWidth + elidedTagCounterWidth > rowWidth) {
|
|
490
|
-
if (isLastRow) if (i === this.values.length - 1) {
|
|
491
|
-
rows[currentRowIndex].unshift(entry);
|
|
492
|
-
currentRowWidth += TagGapPx + tagWidth;
|
|
493
|
-
} else break;
|
|
494
|
-
else {
|
|
495
|
-
rows.push([]);
|
|
496
|
-
currentRowIndex++;
|
|
497
|
-
rows[currentRowIndex].unshift(entry);
|
|
498
|
-
currentRowWidth = tagWidth;
|
|
499
|
-
}
|
|
500
|
-
continue;
|
|
501
|
-
}
|
|
502
|
-
rows[currentRowIndex].unshift(entry);
|
|
503
|
-
currentRowWidth += TagGapPx + tagWidth;
|
|
504
|
-
}
|
|
505
|
-
this._numElidedTags = i + 1;
|
|
506
|
-
rows.reverse();
|
|
507
|
-
for (let i = 0; i < rows.length - 1; i++) {
|
|
508
|
-
let lineWidth = rows[i].map((e) => e.width).reduce((a, b) => a + b, 0) + (rows[i].length - 1) * TagGapPx;
|
|
509
|
-
if (i === 0 && this._numElidedTags) lineWidth += TagGapPx + this.#measureTagWidth(this._numElidedTags.toString(), false, false);
|
|
510
|
-
while (rows[i + 1].length && lineWidth + TagGapPx + rows[i + 1][0].width <= rowWidth) {
|
|
511
|
-
const nextTag = rows[i + 1].shift();
|
|
512
|
-
rows[i].push(nextTag);
|
|
513
|
-
lineWidth += TagGapPx + nextTag.width;
|
|
514
|
-
}
|
|
323
|
+
updateValue(shouldEmit) {
|
|
324
|
+
if (this.$fastController.isConnected) this.value = this.firstSelectedOption?.value ?? "";
|
|
325
|
+
if (shouldEmit) {
|
|
326
|
+
this.$emit("input");
|
|
327
|
+
this.$emit("change", this, {
|
|
328
|
+
bubbles: true,
|
|
329
|
+
composed: void 0
|
|
330
|
+
});
|
|
515
331
|
}
|
|
516
|
-
const rowValues = rows.map((line) => line.map((entry) => entry.value));
|
|
517
|
-
this._tagRows = rowValues.slice(0, -1);
|
|
518
|
-
this._lastTagRow = rowValues.slice(-1)[0];
|
|
519
332
|
}
|
|
520
333
|
/**
|
|
334
|
+
* Updates the proxy value when the selected index changes.
|
|
335
|
+
*
|
|
336
|
+
* @param prev - the previous selected index
|
|
337
|
+
* @param next - the next selected index
|
|
338
|
+
*
|
|
521
339
|
* @internal
|
|
522
340
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
this
|
|
341
|
+
selectedIndexChanged(prev, next) {
|
|
342
|
+
super.selectedIndexChanged(prev, next);
|
|
343
|
+
this.updateValue();
|
|
526
344
|
}
|
|
527
345
|
/**
|
|
346
|
+
* Handle opening and closing the listbox when the select is clicked.
|
|
347
|
+
*
|
|
348
|
+
* @param e - the mouse event
|
|
528
349
|
* @internal
|
|
529
350
|
*/
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
case "ArrowLeft":
|
|
542
|
-
this.#moveTagFocusTo(this.#nextTagIndexLeft(tagIndex) ?? tagIndex);
|
|
543
|
-
break;
|
|
544
|
-
case "ArrowRight":
|
|
545
|
-
this.#moveTagFocusTo(this.#nextTagIndexRight(tagIndex));
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
351
|
+
clickHandler(e) {
|
|
352
|
+
if (this.disabled || this._isFromContextualHelp(e)) return;
|
|
353
|
+
const clickedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
|
|
354
|
+
if (clickedOption && clickedOption.disabled) return;
|
|
355
|
+
if (this.multiple) {
|
|
356
|
+
this.uncheckAllOptions();
|
|
357
|
+
this.activeIndex = this.options.indexOf(clickedOption);
|
|
358
|
+
this.checkActiveIndex();
|
|
359
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
360
|
+
} else super.clickHandler(e);
|
|
361
|
+
if (this.collapsible) this.open = !this.open;
|
|
548
362
|
return true;
|
|
549
363
|
}
|
|
550
|
-
#moveTagFocusTo(index) {
|
|
551
|
-
if (index === null) this._input.focus();
|
|
552
|
-
else this.shadowRoot.querySelector(`[data-index="${index}"]`)?.focus();
|
|
553
|
-
}
|
|
554
|
-
#nextTagIndexLeft(index) {
|
|
555
|
-
if (!this.values.length) return null;
|
|
556
|
-
for (let i = index - 1; i >= 0; i--) if (!this._isTagDisabled(this.values[i])) return i;
|
|
557
|
-
return null;
|
|
558
|
-
}
|
|
559
|
-
#nextTagIndexRight(index) {
|
|
560
|
-
if (!this.values.length) return null;
|
|
561
|
-
for (let i = index + 1; i < this.values.length; i++) if (!this._isTagDisabled(this.values[i])) return i;
|
|
562
|
-
return null;
|
|
563
|
-
}
|
|
564
|
-
#nextTagIndexForRemoved(index) {
|
|
565
|
-
return this.#nextTagIndexRight(index - 1) ?? this.#nextTagIndexLeft(index);
|
|
566
|
-
}
|
|
567
364
|
/**
|
|
365
|
+
* Handles focus state when the element or its children lose focus.
|
|
366
|
+
*
|
|
367
|
+
* @param e - The focus event
|
|
568
368
|
* @internal
|
|
569
369
|
*/
|
|
570
|
-
|
|
571
|
-
if (this.
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
370
|
+
focusoutHandler(e) {
|
|
371
|
+
if (this.multiple) this.uncheckAllOptions();
|
|
372
|
+
if (!this.open) return true;
|
|
373
|
+
const focusTarget = e.relatedTarget;
|
|
374
|
+
if (this.isSameNode(focusTarget)) {
|
|
375
|
+
this.focus();
|
|
575
376
|
return;
|
|
576
377
|
}
|
|
577
|
-
|
|
378
|
+
/* v8 ignore else -- @preserve */
|
|
379
|
+
if (!this.options.includes(focusTarget)) {
|
|
380
|
+
this.open = false;
|
|
381
|
+
if (this.indexWhenOpened !== this.selectedIndex) this.updateValue(true);
|
|
382
|
+
}
|
|
578
383
|
}
|
|
579
384
|
/**
|
|
385
|
+
* Updates the value when an option's value changes.
|
|
386
|
+
*
|
|
387
|
+
* @param source - the source object
|
|
388
|
+
* @param propertyName - the property to evaluate
|
|
389
|
+
*
|
|
580
390
|
* @internal
|
|
581
391
|
*/
|
|
582
|
-
|
|
583
|
-
|
|
392
|
+
handleChange(source, propertyName) {
|
|
393
|
+
super.handleChange(source, propertyName);
|
|
394
|
+
if (propertyName === "value") this.updateValue();
|
|
584
395
|
}
|
|
585
396
|
/**
|
|
397
|
+
* Prevents focus when a scrollbar is clicked.
|
|
398
|
+
*
|
|
399
|
+
* @param e - the mouse event object
|
|
400
|
+
*
|
|
586
401
|
* @internal
|
|
587
402
|
*/
|
|
588
|
-
|
|
589
|
-
|
|
403
|
+
mousedownHandler(e) {
|
|
404
|
+
if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) return super.mousedownHandler(e);
|
|
405
|
+
return this.collapsible;
|
|
590
406
|
}
|
|
591
407
|
/**
|
|
592
408
|
* @internal
|
|
593
409
|
*/
|
|
594
|
-
|
|
595
|
-
this
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (this.
|
|
601
|
-
const unselectedOptions = options.filter((option) => !this.selectedOptions.includes(option));
|
|
602
|
-
for (const option of unselectedOptions) option.disabled = true;
|
|
603
|
-
} else for (const option of options) option.disabled = false;
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* @internal
|
|
607
|
-
*/
|
|
608
|
-
get _hasSelectionCount() {
|
|
609
|
-
return this.multiple && this.maxSelected && this.maxSelected >= 1;
|
|
410
|
+
multipleChanged(_, next) {
|
|
411
|
+
this.options.forEach((o) => {
|
|
412
|
+
o.checked = next ? false : void 0;
|
|
413
|
+
});
|
|
414
|
+
this.setSelectedOptions();
|
|
415
|
+
/* v8 ignore if -- @preserve */
|
|
416
|
+
if (this.proxy) this.proxy.multiple = next;
|
|
610
417
|
}
|
|
611
418
|
/**
|
|
419
|
+
* Updates the selectedness of each option when the list of selected options changes.
|
|
420
|
+
*
|
|
421
|
+
* @param prev - the previous list of selected options
|
|
422
|
+
* @param next - the current list of selected options
|
|
423
|
+
*
|
|
612
424
|
* @internal
|
|
613
425
|
*/
|
|
614
|
-
|
|
615
|
-
|
|
426
|
+
selectedOptionsChanged(prev, next) {
|
|
427
|
+
super.selectedOptionsChanged(prev, next);
|
|
428
|
+
this.options.forEach((o, i) => {
|
|
429
|
+
const proxyOption = this.proxy.options.item(i);
|
|
430
|
+
if (proxyOption) proxyOption.selected = o.selected;
|
|
431
|
+
});
|
|
616
432
|
}
|
|
617
433
|
/**
|
|
434
|
+
* Resets and fills the proxy to match the component's options.
|
|
435
|
+
*
|
|
618
436
|
* @internal
|
|
619
437
|
*/
|
|
620
|
-
|
|
621
|
-
|
|
438
|
+
setProxyOptions() {
|
|
439
|
+
/* v8 ignore else -- @preserve */
|
|
440
|
+
if (this.proxy instanceof HTMLSelectElement && this.options) {
|
|
441
|
+
this.proxy.length = 0;
|
|
442
|
+
this.options.forEach((option) => {
|
|
443
|
+
const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
|
|
444
|
+
if (proxyOption) this.proxy.options.add(proxyOption);
|
|
445
|
+
});
|
|
446
|
+
}
|
|
622
447
|
}
|
|
623
448
|
/**
|
|
449
|
+
* Handles keydown actions when the select is in multiple selection mode.
|
|
450
|
+
*
|
|
624
451
|
* @internal
|
|
625
452
|
*/
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
453
|
+
multipleKeydownHandler(e) {
|
|
454
|
+
if (this.disabled) return;
|
|
455
|
+
const { key, shiftKey } = e;
|
|
456
|
+
this.shouldSkipFocus = false;
|
|
457
|
+
switch (key) {
|
|
458
|
+
case keyHome:
|
|
459
|
+
this.checkFirstOption(shiftKey);
|
|
460
|
+
return;
|
|
461
|
+
case keyArrowDown:
|
|
462
|
+
this.checkNextOption(shiftKey);
|
|
463
|
+
return;
|
|
464
|
+
case keyArrowUp:
|
|
465
|
+
this.checkPreviousOption(shiftKey);
|
|
466
|
+
return;
|
|
467
|
+
case keyEnd:
|
|
468
|
+
this.checkLastOption(shiftKey);
|
|
469
|
+
return;
|
|
470
|
+
case keyTab:
|
|
471
|
+
this.focusAndScrollOptionIntoView();
|
|
472
|
+
return;
|
|
473
|
+
case keyEscape:
|
|
474
|
+
this.uncheckAllOptions();
|
|
475
|
+
this.checkActiveIndex();
|
|
476
|
+
return;
|
|
477
|
+
case keySpace:
|
|
478
|
+
e.preventDefault();
|
|
479
|
+
/* v8 ignore else -- @preserve */
|
|
480
|
+
if (this.typeaheadExpired) {
|
|
481
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
default:
|
|
485
|
+
/* v8 ignore else -- @preserve */
|
|
486
|
+
if (key.length === 1) this.handleTypeAhead(`${key}`);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
633
489
|
}
|
|
634
490
|
/**
|
|
491
|
+
* Handle keyboard interaction for the select.
|
|
492
|
+
*
|
|
493
|
+
* @param e - the keyboard event
|
|
635
494
|
* @internal
|
|
636
495
|
*/
|
|
637
|
-
|
|
638
|
-
const
|
|
639
|
-
if (this.
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
496
|
+
keydownHandler(e) {
|
|
497
|
+
const selectedIndexBefore = this.selectedIndex;
|
|
498
|
+
if (this.multiple) this.multipleKeydownHandler(e);
|
|
499
|
+
else super.keydownHandler(e);
|
|
500
|
+
switch (e.key) {
|
|
501
|
+
case keySpace:
|
|
502
|
+
e.preventDefault();
|
|
503
|
+
if (this.collapsible && this.typeaheadExpired) this.open = !this.open;
|
|
504
|
+
break;
|
|
505
|
+
case keyHome:
|
|
506
|
+
case keyEnd:
|
|
507
|
+
e.preventDefault();
|
|
508
|
+
break;
|
|
509
|
+
case keyEnter:
|
|
510
|
+
e.preventDefault();
|
|
511
|
+
this.open = !this.open;
|
|
512
|
+
break;
|
|
513
|
+
case keyEscape:
|
|
514
|
+
if (this.collapsible && this.open) {
|
|
515
|
+
e.preventDefault();
|
|
516
|
+
this.open = false;
|
|
517
|
+
}
|
|
518
|
+
break;
|
|
519
|
+
case keyTab:
|
|
520
|
+
if (this.collapsible && this.open) {
|
|
521
|
+
e.preventDefault();
|
|
522
|
+
this.open = false;
|
|
523
|
+
}
|
|
524
|
+
return true;
|
|
644
525
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
526
|
+
if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) this.updateValue(true);
|
|
527
|
+
return !(e.key === keyArrowDown || e.key === keyArrowUp);
|
|
528
|
+
}
|
|
529
|
+
connectedCallback() {
|
|
530
|
+
super.connectedCallback();
|
|
531
|
+
this.addEventListener("focusout", this.focusoutHandler);
|
|
532
|
+
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
649
533
|
}
|
|
650
|
-
|
|
651
|
-
|
|
534
|
+
disconnectedCallback() {
|
|
535
|
+
this.removeEventListener("focusout", this.focusoutHandler);
|
|
536
|
+
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
537
|
+
super.disconnectedCallback();
|
|
652
538
|
}
|
|
653
539
|
/**
|
|
540
|
+
*
|
|
654
541
|
* @internal
|
|
655
542
|
*/
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
543
|
+
updateDisplayValue() {
|
|
544
|
+
if (this.collapsible) Observable.notify(this, "displayValue");
|
|
545
|
+
}
|
|
546
|
+
get displayValue() {
|
|
547
|
+
Observable.track(this, "displayValue");
|
|
548
|
+
return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
|
|
659
549
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
this.setFormValue(formData);
|
|
550
|
+
_newDefaultSelectedIndex(prev, next, currentSelectIndex) {
|
|
551
|
+
const defaultSelectedIndex = super._newDefaultSelectedIndex(prev, next, currentSelectIndex);
|
|
552
|
+
if (defaultSelectedIndex === null && currentSelectIndex === -1 && !this.placeholder) {
|
|
553
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
554
|
+
if (firstSelectableIndex !== -1) return firstSelectableIndex;
|
|
666
555
|
}
|
|
556
|
+
return defaultSelectedIndex;
|
|
557
|
+
}
|
|
558
|
+
_isDefaultSelected(option) {
|
|
559
|
+
return super._isDefaultSelected(option) || option.value === this.initialValue || !this._isResetting && option.value === this.value;
|
|
560
|
+
}
|
|
561
|
+
slottedOptionsChanged(prev, next) {
|
|
562
|
+
this.options.forEach((o) => {
|
|
563
|
+
Observable.getNotifier(o).unsubscribe(this, "value");
|
|
564
|
+
});
|
|
565
|
+
super.slottedOptionsChanged(prev, next);
|
|
566
|
+
this.options.forEach((o) => {
|
|
567
|
+
Observable.getNotifier(o).subscribe(this, "value");
|
|
568
|
+
});
|
|
569
|
+
this.setProxyOptions();
|
|
570
|
+
this.updateValue();
|
|
571
|
+
const scale = this.getAttribute("scale") || this.scale;
|
|
572
|
+
next.forEach((element) => {
|
|
573
|
+
if (scale) {
|
|
574
|
+
element.setAttribute("scale", scale);
|
|
575
|
+
element.scale = scale;
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
this.proxy.value = this.value;
|
|
579
|
+
this.validate();
|
|
667
580
|
}
|
|
668
|
-
/**
|
|
669
|
-
* @internal
|
|
670
|
-
*/
|
|
671
581
|
formResetCallback() {
|
|
672
|
-
|
|
673
|
-
this
|
|
582
|
+
this.setProxyOptions();
|
|
583
|
+
this._isResetting = true;
|
|
584
|
+
this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
|
|
585
|
+
this._isResetting = false;
|
|
674
586
|
}
|
|
675
|
-
#resizeObserver = new ResizeObserver(() => {
|
|
676
|
-
this.#updateTagLayout();
|
|
677
|
-
});
|
|
678
587
|
/**
|
|
679
588
|
* @internal
|
|
680
589
|
*/
|
|
681
|
-
|
|
682
|
-
if (this.
|
|
683
|
-
if (
|
|
684
|
-
|
|
685
|
-
this.open = true;
|
|
686
|
-
}
|
|
590
|
+
get _shouldShowClearButton() {
|
|
591
|
+
if (!this.clearable) return false;
|
|
592
|
+
if (this.multiple) return this.selectedOptions?.length > 0;
|
|
593
|
+
return this.value !== "";
|
|
687
594
|
}
|
|
688
595
|
/**
|
|
689
596
|
* @internal
|
|
690
597
|
*/
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
696
|
-
return true;
|
|
697
|
-
}
|
|
698
|
-
connectedCallback() {
|
|
699
|
-
super.connectedCallback();
|
|
700
|
-
if (!this.values.length) this.values = this.#determineInitialValues();
|
|
701
|
-
this.#resizeObserver.observe(this._contentArea);
|
|
702
|
-
}
|
|
703
|
-
disconnectedCallback() {
|
|
704
|
-
super.disconnectedCallback();
|
|
705
|
-
this.#resizeObserver.disconnect();
|
|
598
|
+
_onClearButtonFocus() {
|
|
599
|
+
this._isClearButtonFocused = true;
|
|
600
|
+
this.activeIndex = -1;
|
|
601
|
+
this.uncheckAllOptions();
|
|
706
602
|
}
|
|
707
603
|
/**
|
|
708
604
|
* @internal
|
|
709
605
|
*/
|
|
710
|
-
|
|
711
|
-
|
|
606
|
+
_onClearButtonBlur() {
|
|
607
|
+
this._isClearButtonFocused = false;
|
|
712
608
|
}
|
|
713
609
|
/**
|
|
714
610
|
* @internal
|
|
715
611
|
*/
|
|
716
|
-
|
|
717
|
-
this.
|
|
612
|
+
get _shouldShowLabelWrapper() {
|
|
613
|
+
return Boolean(this.label || this._hasContextualHelp || this.multiple && this._shouldShowClearButton);
|
|
718
614
|
}
|
|
719
615
|
/**
|
|
720
616
|
* @internal
|
|
721
617
|
*/
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
618
|
+
_onClearButtonClick() {
|
|
619
|
+
if (this.multiple) this.selectedOptions?.forEach((o) => {
|
|
620
|
+
/* v8 ignore else -- @preserve */
|
|
621
|
+
if (!o.disabled) o.selected = false;
|
|
622
|
+
});
|
|
623
|
+
else this.selectedIndex = -1;
|
|
624
|
+
this.updateValue(true);
|
|
729
625
|
}
|
|
730
626
|
};
|
|
731
|
-
__decorate([
|
|
732
|
-
__decorate([attr],
|
|
733
|
-
__decorate([attr({
|
|
734
|
-
mode: "boolean",
|
|
735
|
-
attribute: "fixed-dropdown"
|
|
736
|
-
})], SearchableSelect.prototype, "fixedDropdown", void 0);
|
|
737
|
-
__decorate([attr], SearchableSelect.prototype, "placeholder", void 0);
|
|
738
|
-
__decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "open", void 0);
|
|
739
|
-
__decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "multiple", void 0);
|
|
627
|
+
__decorate([observable], Select.prototype, "activeIndex", void 0);
|
|
628
|
+
__decorate([attr({ mode: "boolean" })], Select.prototype, "multiple", void 0);
|
|
740
629
|
__decorate([attr({
|
|
741
|
-
attribute: "
|
|
630
|
+
attribute: "open",
|
|
742
631
|
mode: "boolean"
|
|
743
|
-
})],
|
|
744
|
-
__decorate([
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
__decorate([
|
|
749
|
-
__decorate([
|
|
750
|
-
__decorate([
|
|
751
|
-
__decorate([observable], SearchableSelect.prototype, "_currentSearchText", void 0);
|
|
752
|
-
__decorate([observable], SearchableSelect.prototype, "_slottedOptions", void 0);
|
|
753
|
-
__decorate([observable], SearchableSelect.prototype, "optionFilter", void 0);
|
|
754
|
-
__decorate([observable], SearchableSelect.prototype, "_filteredOptions", void 0);
|
|
755
|
-
__decorate([observable], SearchableSelect.prototype, "_filteredEnabledOptions", void 0);
|
|
756
|
-
__decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "loading", void 0);
|
|
757
|
-
__decorate([observable], SearchableSelect.prototype, "_highlightedOptionIndex", void 0);
|
|
758
|
-
__decorate([observable], SearchableSelect.prototype, "_contentArea", void 0);
|
|
759
|
-
__decorate([observable], SearchableSelect.prototype, "_numElidedTags", void 0);
|
|
760
|
-
__decorate([observable], SearchableSelect.prototype, "_tagRows", void 0);
|
|
761
|
-
__decorate([observable], SearchableSelect.prototype, "_lastTagRow", void 0);
|
|
762
|
-
__decorate([observable], SearchableSelect.prototype, "_listbox", void 0);
|
|
763
|
-
__decorate([attr({ mode: "boolean" })], SearchableSelect.prototype, "clearable", void 0);
|
|
764
|
-
__decorate([attr({
|
|
765
|
-
attribute: "max-selected",
|
|
766
|
-
converter: nullableNumberConverter
|
|
767
|
-
})], SearchableSelect.prototype, "maxSelected", void 0);
|
|
768
|
-
__decorate([observable], SearchableSelect.prototype, "_slottedDisabledOptions", void 0);
|
|
632
|
+
})], Select.prototype, "open", void 0);
|
|
633
|
+
__decorate([volatile], Select.prototype, "collapsible", null);
|
|
634
|
+
__decorate([observable], Select.prototype, "control", void 0);
|
|
635
|
+
__decorate([observable], Select.prototype, "maxHeight", void 0);
|
|
636
|
+
__decorate([observable], Select.prototype, "_anchor", void 0);
|
|
637
|
+
__decorate([attr()], Select.prototype, "scale", void 0);
|
|
638
|
+
__decorate([attr], Select.prototype, "appearance", void 0);
|
|
639
|
+
__decorate([attr], Select.prototype, "shape", void 0);
|
|
769
640
|
__decorate([attr({
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
})],
|
|
773
|
-
__decorate([attr
|
|
774
|
-
__decorate([
|
|
775
|
-
__decorate([observable],
|
|
776
|
-
__decorate([
|
|
777
|
-
__decorate([observable],
|
|
778
|
-
//#endregion
|
|
779
|
-
//#region src/lib/searchable-select/option-tag.ts
|
|
780
|
-
var OptionTag = class extends Localized(VividElement) {
|
|
781
|
-
constructor(..._args) {
|
|
782
|
-
super(..._args);
|
|
783
|
-
this.removable = false;
|
|
784
|
-
this.disabled = false;
|
|
785
|
-
this.hasIconPlaceholder = false;
|
|
786
|
-
}
|
|
787
|
-
/** @internal */
|
|
788
|
-
_onClickRemove() {
|
|
789
|
-
this.$emit("remove", void 0, { bubbles: false });
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
__decorate([attr], OptionTag.prototype, "shape", void 0);
|
|
793
|
-
__decorate([observable], OptionTag.prototype, "connotation", void 0);
|
|
794
|
-
__decorate([attr], OptionTag.prototype, "label", void 0);
|
|
795
|
-
__decorate([attr({ mode: "boolean" })], OptionTag.prototype, "removable", void 0);
|
|
796
|
-
__decorate([attr({ mode: "boolean" })], OptionTag.prototype, "disabled", void 0);
|
|
797
|
-
__decorate([observable], OptionTag.prototype, "hasIconPlaceholder", void 0);
|
|
641
|
+
mode: "boolean",
|
|
642
|
+
attribute: "fixed-dropdown"
|
|
643
|
+
})], Select.prototype, "fixedDropdown", void 0);
|
|
644
|
+
__decorate([attr], Select.prototype, "placeholder", void 0);
|
|
645
|
+
__decorate([observable], Select.prototype, "_feedbackWrapper", void 0);
|
|
646
|
+
__decorate([observable], Select.prototype, "metaSlottedContent", void 0);
|
|
647
|
+
__decorate([attr({ mode: "boolean" })], Select.prototype, "clearable", void 0);
|
|
648
|
+
__decorate([observable], Select.prototype, "_isClearButtonFocused", void 0);
|
|
798
649
|
//#endregion
|
|
799
|
-
//#region src/lib/
|
|
800
|
-
var getStateClasses = (
|
|
650
|
+
//#region src/lib/select/select.template.ts
|
|
651
|
+
var getStateClasses = ({ shape, disabled, appearance, metaSlottedContent, errorValidationMessage, successText, placeholder, value, scale, _activeDescendant, open }) => classNames(["has-activedescendant", Boolean(_activeDescendant) && open], ["disabled", disabled], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ["has-meta", Boolean(metaSlottedContent?.length)], ["error", Boolean(errorValidationMessage)], ["success", !!successText], ["shows-placeholder", Boolean(placeholder) && !value], [`size-${scale}`, Boolean(scale)]);
|
|
801
652
|
function renderLabel() {
|
|
802
|
-
return html`
|
|
803
|
-
|
|
804
|
-
|
|
653
|
+
return html` <label
|
|
654
|
+
for="${(x) => x.multiple ? null : "control"}"
|
|
655
|
+
class="label"
|
|
656
|
+
id="label"
|
|
657
|
+
>
|
|
658
|
+
${(x) => x.label}
|
|
659
|
+
</label>`;
|
|
805
660
|
}
|
|
806
|
-
function
|
|
661
|
+
function renderPlaceholder(context) {
|
|
662
|
+
const optionTag = context.tagFor(ListboxOption);
|
|
807
663
|
return html`
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
class="selection-count"
|
|
811
|
-
aria-label="${(x) => x.locale.searchableSelect.maxSelectedMessage(x.values.length, x.maxSelected)}"
|
|
812
|
-
>(${(x) => `${x.values.length}/${x.maxSelected}`})</span
|
|
813
|
-
>
|
|
814
|
-
`;
|
|
664
|
+
<${optionTag} text="${(x) => x.placeholder}" hidden disabled>
|
|
665
|
+
</${optionTag}>`;
|
|
815
666
|
}
|
|
816
|
-
|
|
817
|
-
const optionTagTag = context.tagFor(OptionTag);
|
|
818
|
-
return html`
|
|
819
|
-
<div class="tag-wrapper">
|
|
820
|
-
<${optionTagTag}
|
|
821
|
-
class="tag"
|
|
822
|
-
tabindex="-1"
|
|
823
|
-
data-index="${(x, c) => getComponent(c).values.indexOf(x)}"
|
|
824
|
-
removable
|
|
825
|
-
:label="${(x, c) => getComponent(c)._tagLabelForValue(x)}"
|
|
826
|
-
:shape="${(_, c) => getComponent(c).shape}"
|
|
827
|
-
:connotation="${(x, c) => getComponent(c)._tagConnotationForValue(x)}"
|
|
828
|
-
?disabled="${(x, c) => getComponent(c)._isTagDisabled(x)}"
|
|
829
|
-
@remove="${(x, c) => getComponent(c)._onTagRemoved(x)}"
|
|
830
|
-
@keydown="${(_, c) => getComponent(c)._onTagKeydown(c.event)}"
|
|
831
|
-
@mousedown="${() => false}">
|
|
832
|
-
<slot slot="icon" name="${(x, c) => getComponent(c)._tagIconSlotName(x)}"></slot>
|
|
833
|
-
</${optionTagTag}>
|
|
834
|
-
</div>
|
|
835
|
-
`;
|
|
836
|
-
};
|
|
837
|
-
var elidedTagTemplateFactory = (context, getComponent) => {
|
|
838
|
-
const optionTagTag = context.tagFor(OptionTag);
|
|
839
|
-
return html`
|
|
840
|
-
<${optionTagTag}
|
|
841
|
-
class="tag"
|
|
842
|
-
tabindex="-1"
|
|
843
|
-
:label="${(x, c) => getComponent(x, c)._numElidedTags.toString()}"
|
|
844
|
-
:shape="${(x, c) => getComponent(x, c).shape}"
|
|
845
|
-
?disabled="${(x, c) => getComponent(x, c).disabled}"
|
|
846
|
-
@mousedown="${() => false}">
|
|
847
|
-
</${optionTagTag}>
|
|
848
|
-
`;
|
|
849
|
-
};
|
|
850
|
-
function renderFieldset(context) {
|
|
667
|
+
function renderClearButton(context) {
|
|
851
668
|
const buttonTag = context.tagFor(Button);
|
|
852
|
-
const progressRingTag = context.tagFor(ProgressRing);
|
|
853
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
854
|
-
const chevronTemplate = chevronTemplateFactory(context);
|
|
855
|
-
const tagTemplate = tagTemplateFactory(context, (c) => c.parent);
|
|
856
|
-
const nestedTagTemplate = tagTemplateFactory(context, (c) => c.parentContext.parent);
|
|
857
|
-
const elidedTagTemplate = elidedTagTemplateFactory(context, (x, _) => x);
|
|
858
|
-
const nestedElidedTagTemplate = elidedTagTemplateFactory(context, (_, c) => c.parent);
|
|
859
669
|
return html`
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
${
|
|
864
|
-
|
|
865
|
-
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
|
|
866
|
-
<div class="content-area" ${ref("_contentArea")}>
|
|
867
|
-
${repeat((x) => x._tagRows, html`
|
|
868
|
-
<div class="tag-row">
|
|
869
|
-
${when((_, c) => c.isFirst && c.parent._numElidedTags, nestedElidedTagTemplate)}
|
|
870
|
-
${repeat((x) => x, nestedTagTemplate)}
|
|
871
|
-
</div>
|
|
872
|
-
`, { positioning: true })}
|
|
873
|
-
<div
|
|
874
|
-
class="tag-row ${(x) => classNames(["contains-only-input", x._tagRows.length > 0 && x._lastTagRow.length === 0])}"
|
|
875
|
-
>
|
|
876
|
-
${when((x) => x._tagRows.length === 0 && x._numElidedTags, elidedTagTemplate)}
|
|
877
|
-
${repeat((x) => x._lastTagRow, tagTemplate)}
|
|
878
|
-
<input
|
|
879
|
-
id="control"
|
|
880
|
-
class="control"
|
|
881
|
-
autocomplete="off"
|
|
882
|
-
aria-controls="listbox"
|
|
883
|
-
aria-describedby="${(x) => x._feedbackDescribedBy} ${(x) => x.multiple && x.maxSelected && x.maxSelected >= 1 ? "selection-count" : null}"
|
|
884
|
-
${delegateAria({
|
|
885
|
-
role: "combobox",
|
|
886
|
-
ariaAutoComplete: "list",
|
|
887
|
-
ariaHasPopup: "listbox",
|
|
888
|
-
ariaExpanded: (x) => x.open
|
|
889
|
-
})}
|
|
890
|
-
placeholder="${(x) => x.multiple && x.values.length ? "" : x.placeholder}"
|
|
891
|
-
type="text"
|
|
892
|
-
?disabled="${(x) => x.disabled}"
|
|
893
|
-
:value="${(x) => x._inputValue}"
|
|
894
|
-
@input="${(x, c) => {
|
|
895
|
-
x._onInputInput(c.event);
|
|
670
|
+
<${buttonTag}
|
|
671
|
+
aria-label="${(x) => x.locale.select.clearButtonLabel}"
|
|
672
|
+
aria-hidden="${(x) => x._isClearButtonFocused ? "false" : "true"}"
|
|
673
|
+
@click="${(x, c) => {
|
|
674
|
+
x._onClearButtonClick();
|
|
896
675
|
c.event.stopPropagation();
|
|
897
676
|
}}"
|
|
898
|
-
|
|
677
|
+
@mousedown="${() => false}"
|
|
678
|
+
@keydown="${(x, c) => {
|
|
679
|
+
/* v8 ignore next -- @preserve */
|
|
680
|
+
if (c.event.key === "Tab") x._onClearButtonBlur();
|
|
899
681
|
c.event.stopPropagation();
|
|
682
|
+
return true;
|
|
900
683
|
}}"
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
:shape="${(x) => x.shape}"
|
|
915
|
-
size="super-condensed"
|
|
916
|
-
icon="close-line"
|
|
917
|
-
appearance="ghost-light"
|
|
918
|
-
tabindex="0"
|
|
919
|
-
></${buttonTag}>`)}
|
|
920
|
-
<div @mousedown="${() => false}" @click="${(x) => x._onChevronClick()}">
|
|
921
|
-
${when((x) => x.loading, html`<${progressRingTag} indeterminate size="-6" aria-hidden="true"></${progressRingTag}>`)}
|
|
922
|
-
${when((x) => !x.loading, chevronTemplate)}
|
|
923
|
-
</div>
|
|
924
|
-
</div>
|
|
684
|
+
@focusin="${(x, c) => {
|
|
685
|
+
c.event.stopPropagation();
|
|
686
|
+
x._onClearButtonFocus();
|
|
687
|
+
}}"
|
|
688
|
+
@focusout="${(x) => x._onClearButtonBlur()}"
|
|
689
|
+
?disabled="${(x) => x.disabled}"
|
|
690
|
+
:shape="${(x) => x.shape}"
|
|
691
|
+
size="super-condensed"
|
|
692
|
+
icon="close-line"
|
|
693
|
+
appearance="ghost-light"
|
|
694
|
+
class="clear-button"
|
|
695
|
+
tabindex="0"
|
|
696
|
+
></${buttonTag}>
|
|
925
697
|
`;
|
|
926
698
|
}
|
|
927
|
-
function
|
|
928
|
-
|
|
699
|
+
function selectValue(context) {
|
|
700
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
701
|
+
const chevronTemplate = chevronTemplateFactory(context);
|
|
702
|
+
return html` <div
|
|
703
|
+
class="control ${getStateClasses}"
|
|
704
|
+
${ref("_anchor")}
|
|
705
|
+
id="control"
|
|
706
|
+
?disabled="${(x) => x.disabled}"
|
|
707
|
+
>
|
|
708
|
+
<div class="selected-value">
|
|
709
|
+
${(x) => affixIconTemplate(x.icon, IconWrapper.Slot)}
|
|
710
|
+
<span class="text">${(x) => x.displayValue}</span>
|
|
711
|
+
<slot name="meta" ${slotted("metaSlottedContent")}></slot>
|
|
712
|
+
</div>
|
|
713
|
+
${when((x) => x._shouldShowClearButton, renderClearButton(context))}
|
|
714
|
+
${chevronTemplate}
|
|
715
|
+
</div>`;
|
|
929
716
|
}
|
|
930
|
-
function
|
|
931
|
-
|
|
932
|
-
const dividerTag = context.tagFor(Divider);
|
|
933
|
-
return html`
|
|
934
|
-
<${optionTag}
|
|
935
|
-
data-select-all
|
|
936
|
-
tabindex="-1"
|
|
937
|
-
:text="${(x) => x._selectAllLabel}"
|
|
938
|
-
:selected="${(x) => x._isAllSelected}"
|
|
939
|
-
:_displayCheckmark="${() => true}"
|
|
940
|
-
?disabled="${(x) => x._selectableOptions.length === 0}"
|
|
941
|
-
${ref("_selectAllOption")}>
|
|
942
|
-
</${optionTag}>
|
|
943
|
-
<${dividerTag} class="divider"></${dividerTag}>
|
|
944
|
-
`;
|
|
717
|
+
function setFixedDropdownVarWidth(x) {
|
|
718
|
+
return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
|
|
945
719
|
}
|
|
720
|
+
/**
|
|
721
|
+
* @param context - element definition context
|
|
722
|
+
*/
|
|
946
723
|
function renderControl(context) {
|
|
947
724
|
const popupTag = context.tagFor(Popup);
|
|
948
725
|
return html`
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
${(x) => x._changeDescription}
|
|
960
|
-
</span>
|
|
961
|
-
<div>
|
|
962
|
-
${renderFieldset(context)}
|
|
963
|
-
<div class="popup-wrapper">
|
|
964
|
-
<${popupTag}
|
|
726
|
+
<div class="label-wrapper" ?hidden=${(x) => !x._shouldShowLabelWrapper}>
|
|
727
|
+
${when((x) => x.label, renderLabel())}
|
|
728
|
+
${when((x) => x.multiple && x._shouldShowClearButton, renderClearButton(context))}
|
|
729
|
+
<slot name="contextual-help" ${slotted("_contextualHelpSlottedContent")}></slot>
|
|
730
|
+
</div>
|
|
731
|
+
<div class="control-wrapper">
|
|
732
|
+
${when((x) => !x.multiple, selectValue(context))}
|
|
733
|
+
<${popupTag} class="popup"
|
|
734
|
+
style="${setFixedDropdownVarWidth}"
|
|
735
|
+
?open="${(x) => x.collapsible ? x.open : true}"
|
|
965
736
|
:anchor="${(x) => x._anchor}"
|
|
966
|
-
:open="${(x) => x.open}"
|
|
967
|
-
class="popup"
|
|
968
737
|
placement="bottom-start"
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
class="listbox"
|
|
738
|
+
strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
|
|
739
|
+
<div class="listbox"
|
|
740
|
+
id="${(x) => x.listboxId}"
|
|
973
741
|
role="listbox"
|
|
974
742
|
aria-multiselectable="${(x) => x.multiple}"
|
|
975
|
-
aria-
|
|
976
|
-
${
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
${when((x) => x.
|
|
743
|
+
aria-label="${(x) => x.multiple && !x.label && x.ariaLabel ? x.ariaLabel : null}"
|
|
744
|
+
aria-labelledby="${(x) => x.multiple && x.label ? "label" : null}"
|
|
745
|
+
?disabled="${(x) => x.disabled}"
|
|
746
|
+
?hidden="${(x) => x.collapsible ? !x.open : false}"
|
|
747
|
+
${ref("listbox")}>
|
|
748
|
+
${when((x) => x.placeholder, renderPlaceholder(context))}
|
|
981
749
|
<slot
|
|
982
750
|
${slotted({
|
|
983
|
-
filter:
|
|
751
|
+
filter: Listbox.slottedOptionFilter,
|
|
984
752
|
flatten: true,
|
|
985
|
-
property: "
|
|
753
|
+
property: "slottedOptions"
|
|
986
754
|
})}>
|
|
987
755
|
</slot>
|
|
988
|
-
|
|
989
|
-
${when((x) => x.loading, html`<slot name="loading-options">
|
|
990
|
-
${(x) => x.locale.searchableSelect.loadingOptionsMessage}
|
|
991
|
-
</slot>`)}
|
|
992
|
-
${when((x) => !x.loading && x.searchText === "", html`<slot name="no-options">
|
|
993
|
-
${(x) => x.locale.searchableSelect.noOptionsMessage}
|
|
994
|
-
</slot>`)}
|
|
995
|
-
${when((x) => !x.loading && x.searchText !== "", html`<slot name="no-matches">
|
|
996
|
-
${(x) => x.locale.searchableSelect.noMatchesMessage}
|
|
997
|
-
</slot>`)}
|
|
998
|
-
</div>`)}
|
|
999
|
-
</div>
|
|
756
|
+
</div>
|
|
1000
757
|
</${popupTag}>
|
|
1001
758
|
</div>
|
|
1002
|
-
|
|
1003
|
-
|
|
759
|
+
`;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Ignore events that originate from feedback, e.g. a click on link
|
|
763
|
+
*/
|
|
764
|
+
function ifNotFromFeedback(handler) {
|
|
765
|
+
return (x, c) => {
|
|
766
|
+
if (!c.event.composedPath().includes(x._feedbackWrapper)) return handler(x, c.event);
|
|
767
|
+
return true;
|
|
768
|
+
};
|
|
1004
769
|
}
|
|
1005
|
-
var
|
|
1006
|
-
const optionTagName = context.tagFor(OptionTag, true);
|
|
770
|
+
var SelectTemplate = (context) => {
|
|
1007
771
|
return html`
|
|
1008
772
|
<template
|
|
1009
|
-
|
|
1010
|
-
|
|
773
|
+
${applyHostSemantics({
|
|
774
|
+
role: "combobox",
|
|
775
|
+
ariaLabel: (x) => x.ariaLabel ?? x.label,
|
|
776
|
+
ariaHasPopup: (x) => x.collapsible ? "listbox" : "false",
|
|
777
|
+
ariaExpanded: (x) => x.open,
|
|
778
|
+
ariaDisabled: (x) => x.disabled
|
|
779
|
+
})}
|
|
780
|
+
aria-controls="${(x) => x.listboxId}"
|
|
781
|
+
aria-activedescendant="${(x) => x.open ? x._activeDescendant : null}"
|
|
782
|
+
aria-describedby="${(x) => x._feedbackDescribedBy}"
|
|
783
|
+
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
784
|
+
@click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
|
|
785
|
+
@focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
|
|
786
|
+
@focusout="${ifNotFromFeedback((x, e) => x.focusoutHandler(e))}"
|
|
787
|
+
@keydown="${ifNotFromFeedback((x, e) => {
|
|
788
|
+
x.open && handleEscapeKeyAndStopPropogation(e);
|
|
789
|
+
return x.keydownHandler(e);
|
|
790
|
+
})}"
|
|
791
|
+
@mousedown="${ifNotFromFeedback((x, e) => x.mousedownHandler(e))}"
|
|
1011
792
|
>
|
|
1012
|
-
|
|
1013
|
-
|
|
793
|
+
${renderControl(context)}
|
|
794
|
+
<div class="feedback-wrapper" ${ref("_feedbackWrapper")}>
|
|
795
|
+
${(x) => x._getFeedbackTemplate(context)}
|
|
1014
796
|
</div>
|
|
1015
797
|
</template>
|
|
1016
798
|
`;
|
|
1017
799
|
};
|
|
1018
800
|
//#endregion
|
|
1019
|
-
//#region src/lib/
|
|
1020
|
-
var getClasses = ({ shape, connotation, disabled, removable }) => classNames("base", ["disabled", disabled], ["removable", removable], [`shape-${shape}`, Boolean(shape)], [`connotation-${connotation}`, Boolean(connotation)]);
|
|
1021
|
-
function renderRemoveButton(iconTag) {
|
|
1022
|
-
return html`
|
|
1023
|
-
<span
|
|
1024
|
-
class="remove-button"
|
|
1025
|
-
aria-label="${(x) => x.locale.searchableSelect.removeTagButtonLabel(x.label)}"
|
|
1026
|
-
role="button"
|
|
1027
|
-
tabindex="${(x) => x.disabled ? null : 0}"
|
|
1028
|
-
@click="${(x) => x._onClickRemove()}"
|
|
1029
|
-
>
|
|
1030
|
-
<${iconTag} name="close-line"></${iconTag}>
|
|
1031
|
-
</span>
|
|
1032
|
-
`;
|
|
1033
|
-
}
|
|
1034
|
-
var optionTagTemplate = (context) => {
|
|
1035
|
-
const iconTag = context.tagFor(Icon);
|
|
1036
|
-
return html`<span class="${getClasses}" aria-disabled="${(x) => x.disabled}">
|
|
1037
|
-
<slot name="icon" aria-hidden="true">
|
|
1038
|
-
${when((x) => x.hasIconPlaceholder, html`<div class="icon-placeholder"></div>`)}
|
|
1039
|
-
</slot>
|
|
1040
|
-
${when((x) => x.label, (x) => html`<span class="label">${x.label}</span>`)}
|
|
1041
|
-
${when((x) => x.removable, renderRemoveButton(iconTag))}
|
|
1042
|
-
</span>`;
|
|
1043
|
-
};
|
|
801
|
+
//#region src/lib/select/definition.ts
|
|
1044
802
|
/**
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
* @param prefix - the prefix to use for the component name
|
|
803
|
+
* @internal
|
|
1048
804
|
*/
|
|
1049
|
-
var
|
|
1050
|
-
buttonDefinition,
|
|
805
|
+
var selectDefinition = defineVividComponent("select", Select, SelectTemplate, [
|
|
1051
806
|
popupDefinition,
|
|
1052
807
|
iconDefinition,
|
|
1053
|
-
defineVividComponent("option-tag", OptionTag, optionTagTemplate, [iconDefinition], {
|
|
1054
|
-
styles: [option_tag_default],
|
|
1055
|
-
shadowOptions: { delegatesFocus: true }
|
|
1056
|
-
}),
|
|
1057
|
-
progressRingDefinition,
|
|
1058
|
-
feedbackMessageDefinition,
|
|
1059
808
|
listboxOptionDefinition,
|
|
1060
|
-
|
|
1061
|
-
|
|
809
|
+
buttonDefinition,
|
|
810
|
+
feedbackMessageDefinition
|
|
811
|
+
], { styles: select_default });
|
|
812
|
+
/**
|
|
813
|
+
* Registers the select elements with the design system.
|
|
814
|
+
*
|
|
815
|
+
* @param prefix - the prefix to use for the component name
|
|
816
|
+
*/
|
|
817
|
+
var registerSelect = createRegisterFunction(selectDefinition);
|
|
1062
818
|
//#endregion
|
|
1063
|
-
export {
|
|
819
|
+
export { selectDefinition as n, Select as r, registerSelect as t };
|