@vonage/vivid 5.23.1 → 5.24.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/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/audio-player/index.cjs +2 -2
- package/audio-player/index.js +3 -3
- package/badge/index.cjs +1 -1
- package/badge/index.js +1 -1
- package/bundled/definition15.cjs +8 -7
- package/bundled/definition15.js +26 -24
- package/bundled/definition17.cjs +2 -2
- package/bundled/definition17.js +2 -2
- package/bundled/definition18.cjs +12 -83
- package/bundled/definition18.js +35 -419
- package/bundled/definition19.cjs +87 -7
- package/bundled/definition19.js +432 -16
- package/bundled/definition20.cjs +7 -37
- package/bundled/definition20.js +17 -172
- package/bundled/definition21.cjs +35 -27
- package/bundled/definition21.js +154 -154
- package/bundled/definition22.cjs +29 -6
- package/bundled/definition22.js +172 -20
- package/bundled/definition23.cjs +6 -12
- package/bundled/definition23.js +17 -32
- package/bundled/definition24.cjs +12 -39
- package/bundled/definition24.js +32 -67
- package/bundled/definition25.cjs +44 -0
- package/bundled/definition25.js +77 -0
- package/bundled/extractOptions.cjs +1 -0
- package/bundled/extractOptions.js +11 -0
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +24 -11
- package/bundled/render-in-light-dom.cjs +1 -1
- package/bundled/render-in-light-dom.js +16 -19
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +9 -1
- package/combobox/definition.cjs +1 -1
- package/combobox/definition.js +1 -1
- package/combobox/index.cjs +7 -7
- package/combobox/index.js +29 -21
- package/country/definition.cjs +1 -1
- package/country/definition.js +1 -1
- package/country/index.cjs +1 -1
- package/country/index.js +1 -1
- package/country-group/definition.cjs +1 -1
- package/country-group/definition.js +1 -1
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +2 -2
- package/custom-elements.json +3102 -2842
- package/data-grid/definition.cjs +1 -1
- package/data-grid/definition.js +1 -1
- package/data-grid/index.cjs +4 -4
- package/data-grid/index.js +5 -5
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +1 -1
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +1 -1
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +1 -1
- package/dial-pad/definition.cjs +1 -1
- package/dial-pad/definition.js +1 -1
- package/dial-pad/index.cjs +24 -24
- package/dial-pad/index.js +120 -51
- package/dialog/definition.cjs +1 -1
- package/dialog/definition.js +1 -1
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/empty-state/definition.cjs +1 -1
- package/empty-state/definition.js +1 -1
- package/fab/definition.cjs +1 -1
- package/fab/definition.js +1 -1
- package/file-picker/definition.cjs +1 -1
- package/file-picker/definition.js +1 -1
- package/flag/definition.cjs +1 -1
- package/flag/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/header/index.cjs +3 -3
- package/header/index.js +3 -3
- package/index.cjs +200 -196
- package/index.js +53 -52
- package/kbd-key/definition.cjs +1 -1
- package/kbd-key/definition.js +1 -1
- package/kbd-shortcut/definition.cjs +1 -1
- package/kbd-shortcut/definition.js +1 -1
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -1
- package/lib/action-group/action-group.d.ts +1 -1
- package/lib/alert/alert.d.ts +2 -2
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/avatar/avatar.d.ts +1 -1
- package/lib/badge/badge.d.ts +1 -1
- package/lib/banner/banner.d.ts +3 -3
- package/lib/breadcrumb/breadcrumb.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/button/button.d.ts +3 -3
- package/lib/calendar-event/calendar-event.d.ts +1 -1
- package/lib/card/card.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +6 -6
- package/lib/color-picker/color-picker.d.ts +7 -7
- package/lib/combobox/combobox.d.ts +7 -7
- package/lib/components.d.ts +1 -0
- package/lib/country-group/country-group.d.ts +2 -2
- package/lib/data-grid/data-grid-cell.d.ts +4 -3
- package/lib/data-grid/data-grid-row.d.ts +3 -2
- package/lib/data-grid/data-grid.options.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +8 -8
- package/lib/date-range-picker/date-range-picker.d.ts +4 -4
- package/lib/date-time-picker/date-time-picker.d.ts +8 -8
- package/lib/dial-pad/dial-pad.d.ts +2 -1
- package/lib/dialog/dialog.d.ts +2 -2
- package/lib/divider/divider.d.ts +1 -1
- package/lib/fab/fab.d.ts +1 -1
- package/lib/file-picker/file-picker.d.ts +7 -7
- package/lib/header/header.d.ts +1 -1
- package/lib/menu/menu.d.ts +2 -2
- package/lib/menu-item/menu-item.d.ts +3 -3
- package/lib/nav/nav.d.ts +1 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
- package/lib/nav-item/nav-item.d.ts +2 -2
- package/lib/note/note.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +9 -9
- package/lib/optgroup/definition.d.ts +3 -0
- package/lib/optgroup/index.d.ts +1 -0
- package/lib/optgroup/optgroup.d.ts +430 -0
- package/lib/optgroup/optgroup.template.d.ts +2 -0
- package/lib/optgroup/variations.browser-spec.d.ts +1 -0
- package/lib/option/option.d.ts +2 -2
- package/lib/pagination/pagination.d.ts +1 -1
- package/lib/popover/popover.d.ts +2 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/radio/radio.d.ts +3 -3
- package/lib/radio-group/radio-group.d.ts +1 -1
- package/lib/range-slider/range-slider.d.ts +3 -3
- package/lib/rich-text-editor/rich-text-editor.d.ts +1 -1
- package/lib/searchable-select/option-tag.d.ts +1 -1
- package/lib/searchable-select/searchable-select.d.ts +47 -47
- package/lib/select/select.d.ts +9 -9
- package/lib/selectable-box/selectable-box.d.ts +1 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -2
- package/lib/slider/slider.d.ts +3 -3
- package/lib/split-button/split-button.d.ts +3 -3
- package/lib/status/status.d.ts +1 -1
- package/lib/switch/switch.d.ts +2 -2
- package/lib/tab/tab.d.ts +3 -3
- package/lib/tab-panel/tab-panel.d.ts +1 -1
- package/lib/table/table-cell.d.ts +1 -1
- package/lib/table/table-header-cell.d.ts +1 -1
- package/lib/table/table-row.d.ts +1 -1
- package/lib/table/table-sorting-button.d.ts +1 -1
- package/lib/tag/tag.d.ts +3 -3
- package/lib/tag-group/tag-group.d.ts +1 -1
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-area/text-area.d.ts +8 -8
- package/lib/text-field/text-field.d.ts +9 -9
- package/lib/time-picker/time-picker.d.ts +4 -4
- package/lib/toggletip/toggletip.d.ts +2 -2
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tree-item/tree-item.d.ts +2 -2
- package/lib/tree-view/tree-view.d.ts +1 -1
- package/lib/video-player/video-player.d.ts +1 -1
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav-disclosure/definition.cjs +1 -1
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.cjs +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.cjs +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.cjs +1 -1
- package/number-field/definition.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/optgroup/definition.cjs +5 -0
- package/optgroup/definition.js +2 -0
- package/optgroup/index.cjs +1 -0
- package/optgroup/index.js +4 -0
- package/package.json +6 -6
- package/pagination/definition.cjs +1 -1
- package/pagination/definition.js +1 -1
- package/platform-switch/definition.cjs +1 -1
- package/platform-switch/definition.js +1 -1
- package/popover/definition.cjs +1 -1
- package/popover/definition.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 +1 -1
- package/radio-group/definition.js +1 -1
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +1 -1
- package/rich-text-editor/definition.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +4 -4
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/searchable-select/definition.cjs +1 -1
- package/searchable-select/definition.js +1 -1
- package/searchable-select/index.cjs +19 -19
- package/searchable-select/index.js +60 -45
- package/select/definition.cjs +1 -1
- package/select/definition.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/shared/aria/delegates-aria.d.ts +1 -1
- package/shared/aria/host-semantics.d.ts +1 -1
- package/shared/color-picker/base-color-picker.d.ts +1 -1
- package/shared/feedback/feedback-message.d.ts +1 -1
- package/shared/feedback/mixins.d.ts +2 -2
- package/shared/foundation/button/button.d.ts +2 -2
- package/shared/foundation/form-associated/form-associated.d.ts +2 -2
- package/shared/foundation/listbox/extractOptions.d.ts +2 -0
- package/shared/foundation/listbox/listbox.d.ts +2 -0
- package/shared/patterns/affix.d.ts +2 -2
- package/shared/patterns/anchored.d.ts +2 -2
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/form-elements/form-element.d.ts +1 -1
- package/shared/patterns/form-elements/with-contextual-help.d.ts +1 -1
- package/shared/patterns/form-elements/with-error-text.d.ts +1 -1
- package/shared/patterns/form-elements/with-success-text.d.ts +1 -1
- package/shared/patterns/kbd-shortcut.d.ts +1 -1
- package/shared/patterns/linkable.d.ts +1 -1
- package/shared/patterns/localized.d.ts +2 -2
- package/shared/patterns/trapped-focus.d.ts +1 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +2 -2
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-date-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-value-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +4 -4
- package/shared/picker-field/picker-field.d.ts +7 -7
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +1 -1
- package/simple-color-picker/definition.js +1 -1
- package/split-button/definition.cjs +1 -1
- package/split-button/definition.js +1 -1
- package/split-button/index.cjs +1 -0
- package/split-button/index.js +1 -0
- package/status/definition.cjs +1 -1
- package/status/definition.js +1 -1
- package/switch/definition.cjs +1 -1
- package/switch/definition.js +1 -1
- package/switch/index.cjs +6 -5
- package/switch/index.js +16 -14
- package/tab/definition.cjs +1 -1
- package/tab/definition.js +1 -1
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/table/definition.cjs +1 -1
- package/table/definition.js +1 -1
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +1 -1
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/text-area/definition.cjs +1 -1
- package/text-area/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/definition13.cjs +1 -1
- package/unbundled/definition13.js +1 -1
- package/unbundled/definition2.cjs +9 -3
- package/unbundled/definition2.js +9 -3
- package/unbundled/definition23.cjs +1 -0
- package/unbundled/definition23.js +2 -1
- package/unbundled/definition29.cjs +2 -2
- package/unbundled/definition29.js +2 -2
- package/unbundled/definition30.cjs +65 -484
- package/unbundled/definition30.js +57 -482
- package/unbundled/definition31.cjs +501 -39
- package/unbundled/definition31.js +499 -37
- package/unbundled/definition32.cjs +38 -239
- package/unbundled/definition32.js +35 -236
- package/unbundled/definition33.cjs +236 -74
- package/unbundled/definition33.js +233 -71
- package/unbundled/definition34.cjs +74 -1968
- package/unbundled/definition34.js +70 -1940
- package/unbundled/definition35.cjs +1992 -26
- package/unbundled/definition35.js +1964 -27
- package/unbundled/definition36.cjs +26 -111
- package/unbundled/definition36.js +23 -103
- package/unbundled/definition37.cjs +53 -294
- package/unbundled/definition37.js +50 -291
- package/unbundled/definition38.cjs +282 -132
- package/unbundled/definition38.js +279 -129
- package/unbundled/definition39.cjs +165 -339
- package/unbundled/definition39.js +163 -337
- package/unbundled/definition40.cjs +394 -228
- package/unbundled/definition40.js +391 -225
- package/unbundled/definition41.cjs +263 -46
- package/unbundled/definition41.js +258 -41
- package/unbundled/definition42.cjs +47 -67
- package/unbundled/definition42.js +45 -65
- package/unbundled/definition43.cjs +56 -383
- package/unbundled/definition43.js +55 -382
- package/unbundled/definition44.cjs +386 -44
- package/unbundled/definition44.js +382 -40
- package/unbundled/definition45.cjs +53 -45
- package/unbundled/definition45.js +49 -41
- package/unbundled/definition46.cjs +40 -164
- package/unbundled/definition46.js +36 -160
- package/unbundled/definition47.cjs +171 -31
- package/unbundled/definition47.js +168 -22
- package/unbundled/definition48.cjs +30 -89
- package/unbundled/definition48.js +22 -87
- package/unbundled/definition49.cjs +70 -33
- package/unbundled/definition49.js +67 -30
- package/unbundled/definition50.cjs +54 -23
- package/unbundled/definition50.js +52 -18
- package/unbundled/definition51.cjs +23 -39
- package/unbundled/definition51.js +17 -36
- package/unbundled/definition52.cjs +29 -314
- package/unbundled/definition52.js +27 -312
- package/unbundled/definition53.cjs +301 -195
- package/unbundled/definition53.js +297 -191
- package/unbundled/definition54.cjs +210 -40
- package/unbundled/definition54.js +206 -36
- package/unbundled/definition55.cjs +42 -266
- package/unbundled/definition55.js +38 -262
- package/unbundled/definition56.cjs +266 -50
- package/unbundled/definition56.js +263 -46
- package/unbundled/definition57.cjs +48 -146
- package/unbundled/definition57.js +47 -143
- package/unbundled/definition58.cjs +127 -225
- package/unbundled/definition58.js +122 -223
- package/unbundled/definition59.cjs +199 -418
- package/unbundled/definition59.js +196 -415
- package/unbundled/definition60.cjs +441 -3738
- package/unbundled/definition60.js +431 -3565
- package/unbundled/definition61.cjs +3712 -728
- package/unbundled/definition61.js +3538 -717
- package/unbundled/definition62.cjs +769 -97
- package/unbundled/definition62.js +766 -94
- package/unbundled/definition63.cjs +100 -981
- package/unbundled/definition63.js +98 -976
- package/unbundled/definition64.cjs +988 -93
- package/unbundled/definition64.js +982 -90
- package/unbundled/definition65.cjs +109 -73
- package/unbundled/definition65.js +105 -63
- package/unbundled/definition66.cjs +69 -155
- package/unbundled/definition66.js +60 -152
- package/unbundled/definition67.cjs +154 -118
- package/unbundled/definition67.js +151 -115
- package/unbundled/definition68.cjs +124 -49
- package/unbundled/definition68.js +120 -45
- package/unbundled/definition69.cjs +51 -84
- package/unbundled/definition69.js +50 -80
- package/unbundled/definition70.cjs +91 -19
- package/unbundled/definition70.js +86 -14
- package/unbundled/definition71.cjs +20 -87
- package/unbundled/definition71.js +14 -84
- package/unbundled/definition72.cjs +76 -294
- package/unbundled/definition72.js +71 -217
- package/unbundled/definition73.cjs +288 -311
- package/unbundled/definition73.js +218 -306
- package/unbundled/definition74.cjs +326 -26
- package/unbundled/definition74.js +317 -23
- package/unbundled/definition75.cjs +27 -122
- package/unbundled/definition75.js +22 -118
- package/unbundled/definition76.cjs +103 -232
- package/unbundled/definition76.js +99 -228
- package/unbundled/definition77.cjs +259 -26
- package/unbundled/definition77.js +249 -23
- package/unbundled/definition78.cjs +29 -148
- package/unbundled/definition78.js +27 -133
- package/unbundled/definition79.cjs +117 -173
- package/unbundled/definition79.js +108 -169
- package/unbundled/definition80.cjs +181 -477
- package/unbundled/definition80.js +176 -471
- package/unbundled/definition81.cjs +517 -0
- package/unbundled/definition81.js +497 -0
- package/unbundled/extractOptions.cjs +21 -0
- package/unbundled/extractOptions.js +16 -0
- package/unbundled/listbox.cjs +23 -6
- package/unbundled/listbox.js +23 -6
- package/unbundled/vivid-element.cjs +10 -1
- package/unbundled/vivid-element.js +10 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/vivid.api.json +194 -0
|
@@ -1,141 +1,813 @@
|
|
|
1
1
|
require("./chunk.cjs");
|
|
2
2
|
const require_vivid_element = require("./vivid-element.cjs");
|
|
3
|
+
const require_definition = require("./definition.cjs");
|
|
3
4
|
const require_decorate = require("./decorate.cjs");
|
|
4
|
-
const
|
|
5
|
+
const require_affix = require("./affix.cjs");
|
|
6
|
+
const require_form_associated = require("./form-associated.cjs");
|
|
7
|
+
const require_localized = require("./localized.cjs");
|
|
8
|
+
const require_definition$1 = require("./definition6.cjs");
|
|
9
|
+
const require_dialog = require("./dialog.cjs");
|
|
10
|
+
const require_definition$2 = require("./definition9.cjs");
|
|
11
|
+
const require_host_semantics = require("./host-semantics.cjs");
|
|
12
|
+
const require_mixins = require("./mixins.cjs");
|
|
13
|
+
const require_form_element = require("./form-element.cjs");
|
|
14
|
+
const require_with_error_text = require("./with-error-text.cjs");
|
|
15
|
+
const require_with_success_text = require("./with-success-text.cjs");
|
|
16
|
+
const require_with_contextual_help = require("./with-contextual-help.cjs");
|
|
17
|
+
const require_definition$3 = require("./definition29.cjs");
|
|
18
|
+
const require_definition$4 = require("./definition30.cjs");
|
|
19
|
+
const require_listbox = require("./listbox.cjs");
|
|
5
20
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
6
|
-
let
|
|
7
|
-
//#region src/lib/
|
|
8
|
-
var
|
|
21
|
+
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
22
|
+
//#region src/lib/select/select.scss?inline
|
|
23
|
+
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;display:flex;transform:rotate(0)}@media (prefers-reduced-motion:no-preference){.chevron{transition:transform .2s}}: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-600);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-600);--_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-600);--_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([multiple]),:host(:not(:focus-visible)){--_suppressable-focus-shadow:none;--_suppressable-focus-outline:none;--_suppressable-focus-outline-offset:0}: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))}";
|
|
9
24
|
//#endregion
|
|
10
|
-
//#region src/lib/
|
|
25
|
+
//#region src/lib/select/select.ts
|
|
11
26
|
/**
|
|
12
27
|
* @public
|
|
13
|
-
* @component
|
|
14
|
-
* @
|
|
28
|
+
* @component select
|
|
29
|
+
* @slot - Default slot.
|
|
30
|
+
* @slot icon - The preferred way to add an icon to the select control.
|
|
31
|
+
* @slot meta - Slot to add meta content to the select control.
|
|
32
|
+
* @slot helper-text - Describes how to use the select. Alternative to the `helper-text` attribute.
|
|
33
|
+
* @event {CustomEvent<undefined>} input - Fires a custom 'input' event when the value updates
|
|
34
|
+
* @event {CustomEvent<HTMLElement>} change - Fires a custom 'change' event when the value updates
|
|
35
|
+
* @vueModel modelValue value input,@lazy:change `event.currentTarget.value`
|
|
36
|
+
* @testAction selectOptionByValue selectOptionByValue
|
|
37
|
+
* @testAction selectOptionByText selectOptionByText
|
|
15
38
|
*/
|
|
16
|
-
var
|
|
39
|
+
var Select = class extends require_mixins.WithLightDOMFeedback(require_with_contextual_help.WithContextualHelp(require_with_error_text.WithErrorText(require_with_success_text.WithSuccessText(require_localized.Localized(require_form_element.FormElement(require_host_semantics.HostSemantics(require_affix.AffixIconWithTrailing(require_form_associated.FormAssociated(require_listbox.Listbox))))))))) {
|
|
17
40
|
constructor(..._args) {
|
|
18
41
|
super(..._args);
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
42
|
+
this.proxy = document.createElement("select");
|
|
43
|
+
this.activeIndex = -1;
|
|
44
|
+
this.rangeStartIndex = -1;
|
|
45
|
+
this.open = false;
|
|
46
|
+
this.listboxId = (0, _microsoft_fast_web_utilities.uniqueId)("listbox-");
|
|
47
|
+
this.maxHeight = 0;
|
|
48
|
+
this.fixedDropdown = false;
|
|
49
|
+
this._feedbackWrapper = null;
|
|
50
|
+
this._isResetting = false;
|
|
51
|
+
this.clearable = false;
|
|
52
|
+
this._isClearButtonFocused = false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns the last checked option.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
get activeOption() {
|
|
60
|
+
return this.options[this.activeIndex];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns the list of checked options.
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
get checkedOptions() {
|
|
68
|
+
return this.options.filter((o) => o.checked);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns the index of the first selected option.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
get firstSelectedOptionIndex() {
|
|
76
|
+
return this.options.indexOf(this.firstSelectedOption);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Updates the `ariaActiveDescendant` property when the active index changes.
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
activeIndexChanged(_, next) {
|
|
84
|
+
this._activeDescendant = this.options[next]?.id ?? "";
|
|
85
|
+
this.focusAndScrollOptionIntoView();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Toggles the checked state for the currently active option.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* Multiple-selection mode only.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
checkActiveIndex() {
|
|
96
|
+
const activeItem = this.activeOption;
|
|
97
|
+
/* v8 ignore else -- @preserve */
|
|
98
|
+
if (activeItem) activeItem.checked = true;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Sets the active index to the first option and marks it as checked.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* Multi-selection mode only.
|
|
105
|
+
*
|
|
106
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
checkFirstOption(preserveChecked) {
|
|
111
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
112
|
+
if (firstSelectableIndex === -1) return;
|
|
113
|
+
if (preserveChecked) {
|
|
114
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
115
|
+
this.options.forEach((o, i) => {
|
|
116
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, firstSelectableIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
117
|
+
});
|
|
118
|
+
} else this.uncheckAllOptions();
|
|
119
|
+
this.activeIndex = firstSelectableIndex;
|
|
120
|
+
this.checkActiveIndex();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Decrements the active index and sets the matching option as checked.
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
* Multi-selection mode only.
|
|
127
|
+
*
|
|
128
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
checkLastOption(preserveChecked) {
|
|
133
|
+
const lastSelectableIndex = this.getPreviousSelectableIndex(this.length - 1);
|
|
134
|
+
if (lastSelectableIndex === -1) return;
|
|
135
|
+
if (preserveChecked) {
|
|
136
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
137
|
+
this.options.forEach((o, i) => {
|
|
138
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, this.rangeStartIndex, lastSelectableIndex + 1) && !o.disabled;
|
|
139
|
+
});
|
|
140
|
+
} else this.uncheckAllOptions();
|
|
141
|
+
this.activeIndex = lastSelectableIndex;
|
|
142
|
+
this.checkActiveIndex();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Increments the active index and marks the matching option as checked.
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* Multiple-selection mode only.
|
|
149
|
+
*
|
|
150
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
151
|
+
*
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
checkNextOption(preserveChecked) {
|
|
155
|
+
const nextIndex = this.getNextSelectableIndex(this.activeIndex + 1);
|
|
156
|
+
if (nextIndex === -1) return;
|
|
157
|
+
if (preserveChecked) {
|
|
158
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
159
|
+
this.options.forEach((o, i) => {
|
|
160
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, this.rangeStartIndex, nextIndex + 1) && !o.disabled;
|
|
161
|
+
});
|
|
162
|
+
} else this.uncheckAllOptions();
|
|
163
|
+
this.activeIndex = nextIndex;
|
|
164
|
+
this.checkActiveIndex();
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Decrements the active index and marks the matching option as checked.
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* Multiple-selection mode only.
|
|
171
|
+
*
|
|
172
|
+
* @param preserveChecked - mark all options unchecked before changing the active index
|
|
173
|
+
*
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
checkPreviousOption(preserveChecked) {
|
|
177
|
+
const previousIndex = this.getPreviousSelectableIndex(this.activeIndex - 1);
|
|
178
|
+
if (previousIndex === -1) return;
|
|
179
|
+
if (preserveChecked) {
|
|
180
|
+
if (this.rangeStartIndex === -1) this.rangeStartIndex = this.activeIndex;
|
|
181
|
+
if (this.checkedOptions.length === 1) this.rangeStartIndex += 1;
|
|
182
|
+
this.options.forEach((o, i) => {
|
|
183
|
+
o.checked = (0, _microsoft_fast_web_utilities.inRange)(i, previousIndex, this.rangeStartIndex + 1) && !o.disabled;
|
|
184
|
+
});
|
|
185
|
+
} else this.uncheckAllOptions();
|
|
186
|
+
this.activeIndex = previousIndex;
|
|
187
|
+
this.checkActiveIndex();
|
|
23
188
|
}
|
|
24
189
|
/** @internal */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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) {
|
|
203
|
+
super.focusinHandler(e);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
/* v8 ignore else -- @preserve */
|
|
207
|
+
if (!this.shouldSkipFocus && e.target === e.currentTarget) {
|
|
208
|
+
this.uncheckAllOptions();
|
|
209
|
+
if (this.activeIndex === -1) this.activeIndex = this.firstSelectedOptionIndex !== -1 ? this.firstSelectedOptionIndex : 0;
|
|
210
|
+
this.checkActiveIndex();
|
|
211
|
+
this.setSelectedOptions();
|
|
212
|
+
this.focusAndScrollOptionIntoView();
|
|
213
|
+
}
|
|
214
|
+
this.shouldSkipFocus = false;
|
|
215
|
+
}
|
|
216
|
+
/** Sets an option as selected and gives it focus. */
|
|
217
|
+
setSelectedOptions() {
|
|
218
|
+
if (!this.multiple) {
|
|
219
|
+
super.setSelectedOptions();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
/* v8 ignore else -- @preserve */
|
|
223
|
+
if (this.$fastController.isConnected && this.options) {
|
|
224
|
+
this.selectedOptions = this.options.filter((o) => o.selected);
|
|
225
|
+
this.focusAndScrollOptionIntoView();
|
|
39
226
|
}
|
|
40
227
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return
|
|
228
|
+
/**
|
|
229
|
+
* Toggles the selected state of the provided options. If any provided items
|
|
230
|
+
* are in an unselected state, all items are set to selected. If every
|
|
231
|
+
* provided item is selected, they are all unselected.
|
|
232
|
+
*
|
|
233
|
+
* @internal
|
|
234
|
+
*/
|
|
235
|
+
toggleSelectedForAllCheckedOptions() {
|
|
236
|
+
const enabledCheckedOptions = this.checkedOptions.filter((o) => !o.disabled);
|
|
237
|
+
const force = !enabledCheckedOptions.every((o) => o.selected);
|
|
238
|
+
enabledCheckedOptions.forEach((o) => o.selected = force);
|
|
239
|
+
this.selectedIndex = this.options.indexOf(enabledCheckedOptions[enabledCheckedOptions.length - 1]);
|
|
240
|
+
this.setSelectedOptions();
|
|
241
|
+
this.updateValue(true);
|
|
242
|
+
}
|
|
243
|
+
/** @internal */
|
|
244
|
+
typeaheadBufferChanged(prev, next) {
|
|
245
|
+
if (!this.multiple) {
|
|
246
|
+
super.typeaheadBufferChanged(prev, next);
|
|
247
|
+
return;
|
|
61
248
|
}
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.
|
|
72
|
-
require_slottable_request.dispatchSlottableRequest(this, "child", slotName, { view: rteView });
|
|
73
|
-
} else {
|
|
74
|
-
const { dom, contentDom = dom } = customResult;
|
|
75
|
-
const nestedView = document.createElement(this.tagName);
|
|
76
|
-
nestedView.view = rteView.children;
|
|
77
|
-
contentDom.appendChild(nestedView);
|
|
78
|
-
dom.setAttribute("slot", slotName);
|
|
79
|
-
this.appendChild(dom);
|
|
80
|
-
this._slottedChildren.add(dom);
|
|
249
|
+
/* v8 ignore if -- @preserve */
|
|
250
|
+
if (this.$fastController.isConnected) {
|
|
251
|
+
const typeaheadMatches = this.getTypeaheadMatches();
|
|
252
|
+
const activeIndex = this.options.indexOf(typeaheadMatches[0]);
|
|
253
|
+
if (activeIndex > -1) {
|
|
254
|
+
this.activeIndex = activeIndex;
|
|
255
|
+
this.uncheckAllOptions();
|
|
256
|
+
this.checkActiveIndex();
|
|
257
|
+
}
|
|
258
|
+
this.typeaheadExpired = false;
|
|
81
259
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Unchecks all options.
|
|
263
|
+
*
|
|
264
|
+
* @remarks
|
|
265
|
+
* Multiple-selection mode only.
|
|
266
|
+
*
|
|
267
|
+
* @param preserveChecked - reset the rangeStartIndex
|
|
268
|
+
*
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
uncheckAllOptions(preserveChecked = false) {
|
|
272
|
+
this.options.forEach((o) => o.checked = false);
|
|
273
|
+
/* v8 ignore else -- @preserve */
|
|
274
|
+
if (!preserveChecked) this.rangeStartIndex = -1;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Sets focus when the open property changes.
|
|
278
|
+
*
|
|
279
|
+
* @internal
|
|
280
|
+
*/
|
|
281
|
+
openChanged(prev, next) {
|
|
282
|
+
if (!this.collapsible) return;
|
|
283
|
+
if (this.open) {
|
|
284
|
+
this.focusAndScrollOptionIntoView();
|
|
285
|
+
this.indexWhenOpened = this.selectedIndex;
|
|
286
|
+
_microsoft_fast_element.Updates.enqueue(() => this.focus());
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const didClose = prev && !next;
|
|
290
|
+
const selectionChangedWhileOpen = this.indexWhenOpened !== this.selectedIndex;
|
|
291
|
+
if (didClose && selectionChangedWhileOpen) this.updateValue(true);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The component is collapsible when in single-selection mode.
|
|
295
|
+
*
|
|
296
|
+
* @internal
|
|
297
|
+
*/
|
|
298
|
+
get collapsible() {
|
|
299
|
+
return !this.multiple;
|
|
300
|
+
}
|
|
301
|
+
/** @internal */
|
|
302
|
+
valueChanged(prev, next) {
|
|
303
|
+
const nextSelectedIndex = this.options.findIndex((el) => el.value === next);
|
|
304
|
+
const validNextSelectedIndex = this._validSelectedIndex(nextSelectedIndex);
|
|
305
|
+
const nextValue = this.options[validNextSelectedIndex]?.value ?? "";
|
|
306
|
+
if (this.selectedIndex !== validNextSelectedIndex) this.selectedIndex = validNextSelectedIndex;
|
|
307
|
+
if (next !== nextValue) return;
|
|
308
|
+
super.valueChanged(prev, next);
|
|
309
|
+
this.updateDisplayValue();
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Sets the value and display value to match the first selected option.
|
|
313
|
+
*
|
|
314
|
+
* @param shouldEmit - if true, the input and change events will be emitted
|
|
315
|
+
*
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
318
|
+
updateValue(shouldEmit) {
|
|
319
|
+
if (this.$fastController.isConnected) this.value = this.firstSelectedOption?.value ?? "";
|
|
320
|
+
if (shouldEmit) {
|
|
321
|
+
this.$emit("input");
|
|
322
|
+
this.$emit("change", this, {
|
|
323
|
+
bubbles: true,
|
|
324
|
+
composed: void 0
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Updates the proxy value when the selected index changes.
|
|
330
|
+
*
|
|
331
|
+
* @param prev - the previous selected index
|
|
332
|
+
* @param next - the next selected index
|
|
333
|
+
*
|
|
334
|
+
* @internal
|
|
335
|
+
*/
|
|
336
|
+
selectedIndexChanged(prev, next) {
|
|
337
|
+
super.selectedIndexChanged(prev, next);
|
|
338
|
+
this.updateValue();
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Handle opening and closing the listbox when the select is clicked.
|
|
342
|
+
*
|
|
343
|
+
* @param e - the mouse event
|
|
344
|
+
* @internal
|
|
345
|
+
*/
|
|
346
|
+
clickHandler(e) {
|
|
347
|
+
if (this.disabled || this._isFromContextualHelp(e)) return;
|
|
348
|
+
const clickedOption = e.target.closest(`option,[role=option],[data-vvd-component=option]`);
|
|
349
|
+
if (clickedOption && clickedOption.disabled) return;
|
|
350
|
+
if (this.multiple) {
|
|
351
|
+
this.uncheckAllOptions();
|
|
352
|
+
this.activeIndex = this.options.indexOf(clickedOption);
|
|
353
|
+
this.checkActiveIndex();
|
|
354
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
355
|
+
} else super.clickHandler(e);
|
|
356
|
+
if (this.collapsible) this.open = !this.open;
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Handles focus state when the element or its children lose focus.
|
|
361
|
+
*
|
|
362
|
+
* @param e - The focus event
|
|
363
|
+
* @internal
|
|
364
|
+
*/
|
|
365
|
+
focusoutHandler(e) {
|
|
366
|
+
if (this.multiple) this.uncheckAllOptions();
|
|
367
|
+
if (!this.open) return true;
|
|
368
|
+
const focusTarget = e.relatedTarget;
|
|
369
|
+
if (this.isSameNode(focusTarget)) {
|
|
370
|
+
this.focus();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
/* v8 ignore else -- @preserve */
|
|
374
|
+
if (!this.options.includes(focusTarget)) {
|
|
375
|
+
this.open = false;
|
|
376
|
+
if (this.indexWhenOpened !== this.selectedIndex) this.updateValue(true);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Updates the value when an option's value changes.
|
|
381
|
+
*
|
|
382
|
+
* @param source - the source object
|
|
383
|
+
* @param propertyName - the property to evaluate
|
|
384
|
+
*
|
|
385
|
+
* @internal
|
|
386
|
+
*/
|
|
387
|
+
handleChange(source, propertyName) {
|
|
388
|
+
super.handleChange(source, propertyName);
|
|
389
|
+
if (propertyName === "value") this.updateValue();
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Prevents focus when a scrollbar is clicked.
|
|
393
|
+
*
|
|
394
|
+
* @param e - the mouse event object
|
|
395
|
+
*
|
|
396
|
+
* @internal
|
|
397
|
+
*/
|
|
398
|
+
mousedownHandler(e) {
|
|
399
|
+
if (e.offsetX >= 0 && e.offsetX <= this.listbox.scrollWidth) return super.mousedownHandler(e);
|
|
400
|
+
return this.collapsible;
|
|
94
401
|
}
|
|
95
402
|
/** @internal */
|
|
403
|
+
multipleChanged(_, next) {
|
|
404
|
+
this.options.forEach((o) => {
|
|
405
|
+
o.checked = next ? false : void 0;
|
|
406
|
+
});
|
|
407
|
+
this.setSelectedOptions();
|
|
408
|
+
/* v8 ignore if -- @preserve */
|
|
409
|
+
if (this.proxy) this.proxy.multiple = next;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Updates the selectedness of each option when the list of selected options changes.
|
|
413
|
+
*
|
|
414
|
+
* @param prev - the previous list of selected options
|
|
415
|
+
* @param next - the current list of selected options
|
|
416
|
+
*
|
|
417
|
+
* @internal
|
|
418
|
+
*/
|
|
419
|
+
selectedOptionsChanged(prev, next) {
|
|
420
|
+
super.selectedOptionsChanged(prev, next);
|
|
421
|
+
this.options.forEach((o, i) => {
|
|
422
|
+
const proxyOption = this.proxy.options.item(i);
|
|
423
|
+
if (proxyOption) proxyOption.selected = o.selected;
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Resets and fills the proxy to match the component's options.
|
|
428
|
+
*
|
|
429
|
+
* @internal
|
|
430
|
+
*/
|
|
431
|
+
setProxyOptions() {
|
|
432
|
+
/* v8 ignore else -- @preserve */
|
|
433
|
+
if (this.proxy instanceof HTMLSelectElement && this.options) {
|
|
434
|
+
this.proxy.length = 0;
|
|
435
|
+
this.options.forEach((option) => {
|
|
436
|
+
const proxyOption = option.proxy || (option instanceof HTMLOptionElement ? option.cloneNode() : null);
|
|
437
|
+
if (proxyOption) this.proxy.options.add(proxyOption);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Handles keydown actions when the select is in multiple selection mode.
|
|
443
|
+
*
|
|
444
|
+
* @internal
|
|
445
|
+
*/
|
|
446
|
+
multipleKeydownHandler(e) {
|
|
447
|
+
if (this.disabled) return;
|
|
448
|
+
const { key, shiftKey } = e;
|
|
449
|
+
this.shouldSkipFocus = false;
|
|
450
|
+
switch (key) {
|
|
451
|
+
case _microsoft_fast_web_utilities.keyHome:
|
|
452
|
+
this.checkFirstOption(shiftKey);
|
|
453
|
+
return;
|
|
454
|
+
case _microsoft_fast_web_utilities.keyArrowDown:
|
|
455
|
+
this.checkNextOption(shiftKey);
|
|
456
|
+
return;
|
|
457
|
+
case _microsoft_fast_web_utilities.keyArrowUp:
|
|
458
|
+
this.checkPreviousOption(shiftKey);
|
|
459
|
+
return;
|
|
460
|
+
case _microsoft_fast_web_utilities.keyEnd:
|
|
461
|
+
this.checkLastOption(shiftKey);
|
|
462
|
+
return;
|
|
463
|
+
case _microsoft_fast_web_utilities.keyTab:
|
|
464
|
+
this.focusAndScrollOptionIntoView();
|
|
465
|
+
return;
|
|
466
|
+
case _microsoft_fast_web_utilities.keyEscape:
|
|
467
|
+
this.uncheckAllOptions();
|
|
468
|
+
this.checkActiveIndex();
|
|
469
|
+
return;
|
|
470
|
+
case _microsoft_fast_web_utilities.keySpace:
|
|
471
|
+
e.preventDefault();
|
|
472
|
+
/* v8 ignore else -- @preserve */
|
|
473
|
+
if (this.typeaheadExpired) {
|
|
474
|
+
this.toggleSelectedForAllCheckedOptions();
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
default:
|
|
478
|
+
/* v8 ignore else -- @preserve */
|
|
479
|
+
if (key.length === 1) this.handleTypeAhead(key);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Handle keyboard interaction for the select.
|
|
485
|
+
*
|
|
486
|
+
* @param e - the keyboard event
|
|
487
|
+
* @internal
|
|
488
|
+
*/
|
|
489
|
+
keydownHandler(e) {
|
|
490
|
+
const selectedIndexBefore = this.selectedIndex;
|
|
491
|
+
if (this.multiple) this.multipleKeydownHandler(e);
|
|
492
|
+
else super.keydownHandler(e);
|
|
493
|
+
switch (e.key) {
|
|
494
|
+
case _microsoft_fast_web_utilities.keySpace:
|
|
495
|
+
e.preventDefault();
|
|
496
|
+
if (this.collapsible && this.typeaheadExpired) this.open = !this.open;
|
|
497
|
+
break;
|
|
498
|
+
case _microsoft_fast_web_utilities.keyHome:
|
|
499
|
+
case _microsoft_fast_web_utilities.keyEnd:
|
|
500
|
+
e.preventDefault();
|
|
501
|
+
break;
|
|
502
|
+
case _microsoft_fast_web_utilities.keyEnter:
|
|
503
|
+
e.preventDefault();
|
|
504
|
+
this.open = !this.open;
|
|
505
|
+
break;
|
|
506
|
+
case _microsoft_fast_web_utilities.keyEscape:
|
|
507
|
+
if (this.collapsible && this.open) {
|
|
508
|
+
e.preventDefault();
|
|
509
|
+
this.open = false;
|
|
510
|
+
}
|
|
511
|
+
break;
|
|
512
|
+
case _microsoft_fast_web_utilities.keyTab:
|
|
513
|
+
if (this.collapsible && this.open) {
|
|
514
|
+
e.preventDefault();
|
|
515
|
+
this.open = false;
|
|
516
|
+
}
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
if (this.collapsible && !this.open && this.selectedIndex !== selectedIndexBefore) this.updateValue(true);
|
|
520
|
+
return !(e.key === _microsoft_fast_web_utilities.keyArrowDown || e.key === _microsoft_fast_web_utilities.keyArrowUp);
|
|
521
|
+
}
|
|
96
522
|
connectedCallback() {
|
|
97
523
|
super.connectedCallback();
|
|
98
|
-
this.
|
|
524
|
+
this.addEventListener("focusout", this.focusoutHandler);
|
|
525
|
+
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
99
526
|
}
|
|
100
|
-
/** @internal */
|
|
101
527
|
disconnectedCallback() {
|
|
528
|
+
this.removeEventListener("focusout", this.focusoutHandler);
|
|
529
|
+
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
102
530
|
super.disconnectedCallback();
|
|
103
|
-
|
|
104
|
-
|
|
531
|
+
}
|
|
532
|
+
/** @internal */
|
|
533
|
+
updateDisplayValue() {
|
|
534
|
+
if (this.collapsible) _microsoft_fast_element.Observable.notify(this, "displayValue");
|
|
535
|
+
}
|
|
536
|
+
get displayValue() {
|
|
537
|
+
_microsoft_fast_element.Observable.track(this, "displayValue");
|
|
538
|
+
return this.firstSelectedOption?.getAttribute("label") ?? this.firstSelectedOption?.text ?? this.placeholder ?? "";
|
|
539
|
+
}
|
|
540
|
+
_newDefaultSelectedIndex(prev, next, currentSelectIndex) {
|
|
541
|
+
const defaultSelectedIndex = super._newDefaultSelectedIndex(prev, next, currentSelectIndex);
|
|
542
|
+
if (defaultSelectedIndex === null && currentSelectIndex === -1 && !this.placeholder) {
|
|
543
|
+
const firstSelectableIndex = this.getNextSelectableIndex(0);
|
|
544
|
+
if (firstSelectableIndex !== -1) return firstSelectableIndex;
|
|
545
|
+
}
|
|
546
|
+
return defaultSelectedIndex;
|
|
547
|
+
}
|
|
548
|
+
_isDefaultSelected(option) {
|
|
549
|
+
return super._isDefaultSelected(option) || option.value === this.initialValue || !this._isResetting && option.value === this.value;
|
|
550
|
+
}
|
|
551
|
+
slottedOptionsChanged(prev, next) {
|
|
552
|
+
this.options.forEach((o) => {
|
|
553
|
+
_microsoft_fast_element.Observable.getNotifier(o).unsubscribe(this, "value");
|
|
554
|
+
});
|
|
555
|
+
super.slottedOptionsChanged(prev, next);
|
|
556
|
+
this.options.forEach((o) => {
|
|
557
|
+
_microsoft_fast_element.Observable.getNotifier(o).subscribe(this, "value");
|
|
558
|
+
});
|
|
559
|
+
this.setProxyOptions();
|
|
560
|
+
this.updateValue();
|
|
561
|
+
const scale = this.getAttribute("scale") || this.scale;
|
|
562
|
+
next.forEach((element) => {
|
|
563
|
+
if (scale) {
|
|
564
|
+
element.setAttribute("scale", scale);
|
|
565
|
+
element.scale = scale;
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
this.proxy.value = this.value;
|
|
569
|
+
this.validate();
|
|
570
|
+
}
|
|
571
|
+
formResetCallback() {
|
|
572
|
+
this.setProxyOptions();
|
|
573
|
+
this._isResetting = true;
|
|
574
|
+
this.selectedIndex = this._newDefaultSelectedIndex([], this.options, -1) ?? -1;
|
|
575
|
+
this._isResetting = false;
|
|
576
|
+
}
|
|
577
|
+
/** @internal */
|
|
578
|
+
get _shouldShowClearButton() {
|
|
579
|
+
if (!this.clearable) return false;
|
|
580
|
+
if (this.multiple) return this.selectedOptions?.length > 0;
|
|
581
|
+
return this.value !== "";
|
|
582
|
+
}
|
|
583
|
+
/** @internal */
|
|
584
|
+
_onClearButtonFocus() {
|
|
585
|
+
this._isClearButtonFocused = true;
|
|
586
|
+
this.activeIndex = -1;
|
|
587
|
+
this.uncheckAllOptions();
|
|
588
|
+
}
|
|
589
|
+
/** @internal */
|
|
590
|
+
_onClearButtonBlur() {
|
|
591
|
+
this._isClearButtonFocused = false;
|
|
592
|
+
}
|
|
593
|
+
/** @internal */
|
|
594
|
+
get _shouldShowLabelWrapper() {
|
|
595
|
+
return Boolean(this.label || this._hasContextualHelp || this.multiple && this._shouldShowClearButton);
|
|
596
|
+
}
|
|
597
|
+
/** @internal */
|
|
598
|
+
_onClearButtonClick() {
|
|
599
|
+
if (this.multiple) this.selectedOptions.forEach((o) => {
|
|
600
|
+
/* v8 ignore else -- @preserve */
|
|
601
|
+
if (!o.disabled) o.selected = false;
|
|
602
|
+
});
|
|
603
|
+
else this.selectedIndex = -1;
|
|
604
|
+
this.updateValue(true);
|
|
105
605
|
}
|
|
106
606
|
};
|
|
107
|
-
require_decorate.__decorate([_microsoft_fast_element.observable],
|
|
607
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "activeIndex", void 0);
|
|
608
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], Select.prototype, "multiple", void 0);
|
|
609
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
610
|
+
attribute: "open",
|
|
611
|
+
mode: "boolean"
|
|
612
|
+
})], Select.prototype, "open", void 0);
|
|
613
|
+
require_decorate.__decorate([_microsoft_fast_element.volatile], Select.prototype, "collapsible", null);
|
|
614
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "control", void 0);
|
|
615
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "maxHeight", void 0);
|
|
616
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "_anchor", void 0);
|
|
617
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)()], Select.prototype, "scale", void 0);
|
|
618
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Select.prototype, "appearance", void 0);
|
|
619
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Select.prototype, "shape", void 0);
|
|
620
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
621
|
+
mode: "boolean",
|
|
622
|
+
attribute: "fixed-dropdown"
|
|
623
|
+
})], Select.prototype, "fixedDropdown", void 0);
|
|
624
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Select.prototype, "placeholder", void 0);
|
|
625
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "_feedbackWrapper", void 0);
|
|
626
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "metaSlottedContent", void 0);
|
|
627
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], Select.prototype, "clearable", void 0);
|
|
628
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], Select.prototype, "_isClearButtonFocused", void 0);
|
|
108
629
|
//#endregion
|
|
109
|
-
//#region src/lib/
|
|
110
|
-
|
|
630
|
+
//#region src/lib/select/select.template.ts
|
|
631
|
+
function renderLabel() {
|
|
632
|
+
return _microsoft_fast_element.html` <label
|
|
633
|
+
for="${(x) => x.multiple ? null : "control"}"
|
|
634
|
+
class="label"
|
|
635
|
+
id="label"
|
|
636
|
+
>
|
|
637
|
+
${(x) => x.label}
|
|
638
|
+
</label>`;
|
|
639
|
+
}
|
|
640
|
+
function renderPlaceholder(context) {
|
|
641
|
+
const optionTag = context.tagFor(require_definition$3.ListboxOption);
|
|
642
|
+
return _microsoft_fast_element.html`
|
|
643
|
+
<${optionTag} text="${(x) => x.placeholder}" hidden disabled>
|
|
644
|
+
</${optionTag}>`;
|
|
645
|
+
}
|
|
646
|
+
function renderClearButton(context) {
|
|
647
|
+
const buttonTag = context.tagFor(require_definition$1.Button);
|
|
648
|
+
return _microsoft_fast_element.html`
|
|
649
|
+
<${buttonTag}
|
|
650
|
+
aria-label="${(x) => x.locale.select.clearButtonLabel}"
|
|
651
|
+
aria-hidden="${(x) => x._isClearButtonFocused ? "false" : "true"}"
|
|
652
|
+
@click="${(x, c) => {
|
|
653
|
+
x._onClearButtonClick();
|
|
654
|
+
c.event.stopPropagation();
|
|
655
|
+
}}"
|
|
656
|
+
@mousedown="${() => false}"
|
|
657
|
+
@keydown="${(x, c) => {
|
|
658
|
+
/* v8 ignore next -- @preserve */
|
|
659
|
+
if (c.event.key === "Tab") x._onClearButtonBlur();
|
|
660
|
+
c.event.stopPropagation();
|
|
661
|
+
return true;
|
|
662
|
+
}}"
|
|
663
|
+
@focusin="${(x, c) => {
|
|
664
|
+
c.event.stopPropagation();
|
|
665
|
+
x._onClearButtonFocus();
|
|
666
|
+
}}"
|
|
667
|
+
@focusout="${(x) => x._onClearButtonBlur()}"
|
|
668
|
+
?disabled="${(x) => x.disabled}"
|
|
669
|
+
:shape="${(x) => x.shape}"
|
|
670
|
+
size="super-condensed"
|
|
671
|
+
icon="close-line"
|
|
672
|
+
appearance="ghost-light"
|
|
673
|
+
class="clear-button"
|
|
674
|
+
tabindex="0"
|
|
675
|
+
></${buttonTag}>
|
|
676
|
+
`;
|
|
677
|
+
}
|
|
678
|
+
function selectValue(context) {
|
|
679
|
+
const affixIconTemplate = require_affix.affixIconTemplateFactory(context);
|
|
680
|
+
const chevronTemplate = require_definition$1.chevronTemplateFactory(context);
|
|
681
|
+
return _microsoft_fast_element.html` <div
|
|
682
|
+
class="control ${(x) => (0, _microsoft_fast_web_utilities.classNames)(["has-activedescendant", Boolean(x._activeDescendant) && x.open], ["disabled", x.disabled], [`appearance-${x.appearance}`, Boolean(x.appearance)], [`shape-${x.shape}`, Boolean(x.shape)], ["has-meta", Boolean(x.metaSlottedContent?.length)], ["error", Boolean(x.errorValidationMessage)], ["success", !!x.successText], ["shows-placeholder", Boolean(x.placeholder) && !x.value], [`size-${x.scale}`, Boolean(x.scale)])}"
|
|
683
|
+
${(0, _microsoft_fast_element.ref)("_anchor")}
|
|
684
|
+
id="control"
|
|
685
|
+
?disabled="${(x) => x.disabled}"
|
|
686
|
+
>
|
|
687
|
+
<div class="selected-value">
|
|
688
|
+
${(x) => affixIconTemplate(x.icon, require_affix.IconWrapper.Slot)}
|
|
689
|
+
<span class="text">${(x) => x.displayValue}</span>
|
|
690
|
+
<slot name="meta" ${(0, _microsoft_fast_element.slotted)("metaSlottedContent")}></slot>
|
|
691
|
+
</div>
|
|
692
|
+
${(0, _microsoft_fast_element.when)((x) => x._shouldShowClearButton, renderClearButton(context))}
|
|
693
|
+
${chevronTemplate}
|
|
694
|
+
</div>`;
|
|
695
|
+
}
|
|
696
|
+
function setFixedDropdownVarWidth(x) {
|
|
697
|
+
return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
|
|
698
|
+
}
|
|
699
|
+
/** @param context - element definition context */
|
|
700
|
+
function renderControl(context) {
|
|
701
|
+
const popupTag = context.tagFor(require_definition$2.Popup);
|
|
702
|
+
return _microsoft_fast_element.html`
|
|
703
|
+
<div class="label-wrapper" ?hidden=${(x) => !x._shouldShowLabelWrapper}>
|
|
704
|
+
${(0, _microsoft_fast_element.when)((x) => x.label, renderLabel())}
|
|
705
|
+
${(0, _microsoft_fast_element.when)((x) => x.multiple && x._shouldShowClearButton, renderClearButton(context))}
|
|
706
|
+
<slot name="contextual-help" ${(0, _microsoft_fast_element.slotted)("_contextualHelpSlottedContent")}></slot>
|
|
707
|
+
</div>
|
|
708
|
+
<div class="control-wrapper">
|
|
709
|
+
${(0, _microsoft_fast_element.when)((x) => !x.multiple, selectValue(context))}
|
|
710
|
+
<${popupTag} class="popup"
|
|
711
|
+
style="${setFixedDropdownVarWidth}"
|
|
712
|
+
?open="${(x) => x.collapsible ? x.open : true}"
|
|
713
|
+
:anchor="${(x) => x._anchor}"
|
|
714
|
+
placement="bottom-start"
|
|
715
|
+
strategy="${(x) => x.fixedDropdown ? null : "absolute"}">
|
|
716
|
+
<div class="listbox"
|
|
717
|
+
id="${(x) => x.listboxId}"
|
|
718
|
+
role="listbox"
|
|
719
|
+
aria-multiselectable="${(x) => x.multiple}"
|
|
720
|
+
aria-label="${(x) => x.multiple && !x.label && x.ariaLabel ? x.ariaLabel : null}"
|
|
721
|
+
aria-labelledby="${(x) => x.multiple && x.label ? "label" : null}"
|
|
722
|
+
?disabled="${(x) => x.disabled}"
|
|
723
|
+
?hidden="${(x) => x.collapsible ? !x.open : false}"
|
|
724
|
+
${(0, _microsoft_fast_element.ref)("listbox")}>
|
|
725
|
+
${(0, _microsoft_fast_element.when)((x) => x.placeholder, renderPlaceholder(context))}
|
|
726
|
+
<slot
|
|
727
|
+
${(0, _microsoft_fast_element.slotted)({
|
|
728
|
+
filter: require_listbox.Listbox.slottedOptionFilter,
|
|
729
|
+
flatten: true,
|
|
730
|
+
property: "slottedOptions"
|
|
731
|
+
})}>
|
|
732
|
+
</slot>
|
|
733
|
+
</div>
|
|
734
|
+
</${popupTag}>
|
|
735
|
+
</div>
|
|
736
|
+
`;
|
|
737
|
+
}
|
|
738
|
+
/** Ignore events that originate from feedback, e.g. a click on link */
|
|
739
|
+
function ifNotFromFeedback(handler) {
|
|
740
|
+
return (x, c) => {
|
|
741
|
+
if (!c.event.composedPath().includes(x._feedbackWrapper)) {
|
|
742
|
+
handler(x, c.event);
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
return true;
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
var SelectTemplate = (context) => {
|
|
749
|
+
return _microsoft_fast_element.html`
|
|
750
|
+
<template
|
|
751
|
+
${require_host_semantics.applyHostSemantics({
|
|
752
|
+
role: "combobox",
|
|
753
|
+
ariaLabel: (x) => x.ariaLabel ?? x.label,
|
|
754
|
+
ariaHasPopup: (x) => x.collapsible ? "listbox" : "false",
|
|
755
|
+
ariaExpanded: (x) => x.open,
|
|
756
|
+
ariaDisabled: (x) => x.disabled
|
|
757
|
+
})}
|
|
758
|
+
aria-controls="${(x) => x.listboxId}"
|
|
759
|
+
aria-activedescendant="${(x) => x.open ? x._activeDescendant : null}"
|
|
760
|
+
aria-describedby="${(x) => x._feedbackDescribedBy}"
|
|
761
|
+
tabindex="${(x) => !x.disabled ? "0" : null}"
|
|
762
|
+
@click="${ifNotFromFeedback((x, e) => x.clickHandler(e))}"
|
|
763
|
+
@focusin="${ifNotFromFeedback((x, e) => x.focusinHandler(e))}"
|
|
764
|
+
@focusout="${ifNotFromFeedback((x, e) => x.focusoutHandler(e))}"
|
|
765
|
+
@keydown="${ifNotFromFeedback((x, e) => {
|
|
766
|
+
if (x.open) require_dialog.handleEscapeKeyAndStopPropogation(e);
|
|
767
|
+
return x.keydownHandler(e);
|
|
768
|
+
})}"
|
|
769
|
+
@mousedown="${ifNotFromFeedback((x, e) => x.mousedownHandler(e))}"
|
|
770
|
+
>
|
|
771
|
+
${renderControl(context)}
|
|
772
|
+
<div class="feedback-wrapper" ${(0, _microsoft_fast_element.ref)("_feedbackWrapper")}>
|
|
773
|
+
${(x) => x._getFeedbackTemplate(context)}
|
|
774
|
+
</div>
|
|
775
|
+
</template>
|
|
776
|
+
`;
|
|
777
|
+
};
|
|
111
778
|
//#endregion
|
|
112
|
-
//#region src/lib/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
779
|
+
//#region src/lib/select/definition.ts
|
|
780
|
+
/** @internal */
|
|
781
|
+
var selectDefinition = require_vivid_element.defineVividComponent("select", Select, SelectTemplate, [
|
|
782
|
+
require_definition$2.popupDefinition,
|
|
783
|
+
require_definition.iconDefinition,
|
|
784
|
+
require_definition$3.listboxOptionDefinition,
|
|
785
|
+
require_definition$4.optgroupDefinition,
|
|
786
|
+
require_definition$1.buttonDefinition,
|
|
787
|
+
require_mixins.feedbackMessageDefinition
|
|
788
|
+
], { styles: select_default });
|
|
117
789
|
/**
|
|
118
|
-
* Registers the
|
|
790
|
+
* Registers the select elements with the design system.
|
|
119
791
|
*
|
|
120
792
|
* @param prefix - the prefix to use for the component name
|
|
121
793
|
*/
|
|
122
|
-
var
|
|
794
|
+
var registerSelect = require_vivid_element.createRegisterFunction(selectDefinition);
|
|
123
795
|
//#endregion
|
|
124
|
-
Object.defineProperty(exports, "
|
|
796
|
+
Object.defineProperty(exports, "Select", {
|
|
125
797
|
enumerable: true,
|
|
126
798
|
get: function() {
|
|
127
|
-
return
|
|
799
|
+
return Select;
|
|
128
800
|
}
|
|
129
801
|
});
|
|
130
|
-
Object.defineProperty(exports, "
|
|
802
|
+
Object.defineProperty(exports, "registerSelect", {
|
|
131
803
|
enumerable: true,
|
|
132
804
|
get: function() {
|
|
133
|
-
return
|
|
805
|
+
return registerSelect;
|
|
134
806
|
}
|
|
135
807
|
});
|
|
136
|
-
Object.defineProperty(exports, "
|
|
808
|
+
Object.defineProperty(exports, "selectDefinition", {
|
|
137
809
|
enumerable: true,
|
|
138
810
|
get: function() {
|
|
139
|
-
return
|
|
811
|
+
return selectDefinition;
|
|
140
812
|
}
|
|
141
813
|
});
|