@volverjs/ui-vue 0.0.10-beta.5 → 0.0.10-beta.51
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/LICENSE +1 -1
- package/README.md +148 -51
- package/auto-imports.d.ts +25 -12
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +28 -20
- package/dist/Volver.d.ts +11 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +192 -104
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +29 -10
- package/dist/components/VvAccordion/index.d.ts +8 -9
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +485 -206
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +61 -18
- package/dist/components/VvAccordionGroup/index.d.ts +16 -8
- package/dist/components/VvAction/VvAction.es.js +84 -33
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +61 -28
- package/dist/components/VvAction/index.d.ts +26 -10
- package/dist/components/VvAlert/VvAlert.es.js +350 -318
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +25 -17
- package/dist/components/VvAlert/index.d.ts +20 -11
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +388 -327
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +22 -17
- package/dist/components/VvAlertGroup/index.d.ts +10 -18
- package/dist/components/VvAvatar/VvAvatar.es.js +66 -28
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +13 -5
- package/dist/components/VvAvatar/index.d.ts +4 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +147 -74
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +17 -10
- package/dist/components/VvAvatarGroup/index.d.ts +6 -3
- package/dist/components/VvBadge/VvBadge.es.js +78 -34
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +13 -5
- package/dist/components/VvBadge/index.d.ts +4 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +294 -83
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +28 -8
- package/dist/components/VvBreadcrumb/index.d.ts +6 -10
- package/dist/components/VvButton/VvButton.es.js +510 -488
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +97 -45
- package/dist/components/VvButton/index.d.ts +52 -30
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +95 -45
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +35 -17
- package/dist/components/VvButtonGroup/index.d.ts +13 -4
- package/dist/components/VvCard/VvCard.es.js +87 -42
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +13 -5
- package/dist/components/VvCard/index.d.ts +4 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +177 -136
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +105 -35
- package/dist/components/VvCheckbox/index.d.ts +52 -19
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +408 -322
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +103 -34
- package/dist/components/VvCheckboxGroup/index.d.ts +45 -12
- package/dist/components/VvCombobox/VvCombobox.es.js +1963 -1639
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +260 -672
- package/dist/components/VvCombobox/index.d.ts +385 -135
- package/dist/components/VvDialog/VvDialog.es.js +177 -297
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +23 -7
- package/dist/components/VvDialog/index.d.ts +12 -0
- package/dist/components/VvDropdown/VvDropdown.es.js +172 -102
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +110 -315
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +77 -28
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +13 -1
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +13 -5
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +38 -10
- package/dist/components/VvDropdown/index.d.ts +52 -118
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +165 -60
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +337 -10
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +63 -20
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +188 -80
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +24 -102
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +4 -68
- package/dist/components/VvIcon/index.d.ts +33 -48
- package/dist/components/VvInputFile/VvInputFile.es.js +1777 -0
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -0
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +317 -0
- package/dist/components/VvInputFile/index.d.ts +193 -0
- package/dist/components/VvInputText/VvInputClearAction.d.ts +16 -10
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +20 -14
- package/dist/components/VvInputText/VvInputStepAction.d.ts +11 -7
- package/dist/components/VvInputText/VvInputText.es.js +1495 -548
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +216 -68
- package/dist/components/VvInputText/index.d.ts +101 -31
- package/dist/components/VvNav/VvNav.es.js +155 -75
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +32 -11
- package/dist/components/VvNav/VvNavItem.vue.d.ts +1 -1
- package/dist/components/VvNav/VvNavSeparator.vue.d.ts +1 -1
- package/dist/components/VvNav/index.d.ts +5 -2
- package/dist/components/VvNavItem/VvNavItem.es.js +100 -39
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +73 -27
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +13 -6
- package/dist/components/VvProgress/index.d.ts +4 -1
- package/dist/components/VvRadio/VvRadio.es.js +175 -135
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +103 -33
- package/dist/components/VvRadio/index.d.ts +50 -17
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +406 -321
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +103 -34
- package/dist/components/VvRadioGroup/index.d.ts +45 -12
- package/dist/components/VvSelect/VvSelect.es.js +677 -611
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +107 -199
- package/dist/components/VvSelect/index.d.ts +196 -16
- package/dist/components/VvTab/VvTab.es.js +230 -110
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +34 -12
- package/dist/components/VvTab/index.d.ts +6 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +278 -255
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +159 -54
- package/dist/components/VvTextarea/index.d.ts +69 -20
- package/dist/components/VvTooltip/VvTooltip.es.js +83 -30
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +16 -9
- package/dist/components/VvTooltip/index.d.ts +5 -2
- package/dist/components/common/HintSlot.d.ts +8 -9
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.es.js +4303 -2228
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlerInject.d.ts +4 -0
- package/dist/composables/alert/useAlert.d.ts +71 -6
- package/dist/composables/alert/{useProvideAlert.d.ts → useAlertProvide.d.ts} +1 -1
- package/dist/composables/dropdown/useDropdownContextmenu.d.ts +18 -0
- package/dist/composables/dropdown/useDropdownInject.d.ts +12 -0
- package/dist/composables/dropdown/{useProvideDropdown.d.ts → useDropdownProvide.d.ts} +6 -7
- package/dist/composables/dropdown/useDropdownVirtualElement.d.ts +17 -0
- package/dist/composables/group/useGroupStateInject.d.ts +9 -0
- package/dist/composables/group/useGroupStateProvide.d.ts +6 -0
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/index.es.js +178 -6
- package/dist/composables/index.umd.js +1 -1
- package/dist/composables/useBlurhash.d.ts +7 -0
- package/dist/composables/useComponentFocus.d.ts +2 -2
- package/dist/composables/useComponentIcon.d.ts +9 -8
- package/dist/composables/useOptions.d.ts +5 -5
- package/dist/composables/usePersistence.d.ts +3 -0
- package/dist/composables/useUniqueId.d.ts +2 -2
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +35 -33
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +247 -82
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.es.js +137 -31
- package/dist/directives/v-contextmenu.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +101 -39
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.d.ts +17 -17
- package/dist/icons.es.js +516 -516
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +74 -6
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +288 -198
- package/dist/resolvers/unplugin.d.ts +6 -1
- package/dist/resolvers/unplugin.es.js +87 -10
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Accordion/Accordion.settings.d.ts +2 -57
- package/dist/stories/AccordionGroup/AccordionGroup.settings.d.ts +2 -66
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -127
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +1304 -538
- package/dist/stories/Alert/Alert.settings.d.ts +2 -109
- package/dist/stories/AlertGroup/AlertGroup.settings.d.ts +2 -85
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
- package/dist/stories/AvatarGroup/AvatarGroup.settings.d.ts +2 -38
- package/dist/stories/Badge/Badge.settings.d.ts +2 -26
- package/dist/stories/Badge/Badge.test.d.ts +1 -1
- package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
- package/dist/stories/Breadcrumb/Breadcrumb.settings.d.ts +2 -18
- package/dist/stories/Breadcrumb/Breadcrumb.test.d.ts +1 -1
- package/dist/stories/Button/Button.settings.d.ts +2 -194
- package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +2 -40
- package/dist/stories/Card/Card.settings.d.ts +2 -63
- package/dist/stories/Checkbox/Checkbox.settings.d.ts +2 -132
- package/dist/stories/CheckboxGroup/CheckboxGroup.settings.d.ts +1 -141
- package/dist/stories/Combobox/Combobox.settings.d.ts +2 -609
- package/dist/stories/Combobox/Combobox.stories.d.ts +1 -0
- package/dist/stories/Combobox/ComboboxMultiple.stories.d.ts +1 -0
- package/dist/stories/Dialog/Dialog.settings.d.ts +2 -47
- package/dist/stories/Dialog/DialogModifiers.stories.d.ts +8 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +2 -205
- package/dist/stories/Icon/Icon.settings.d.ts +3 -68
- package/dist/stories/InputFile/InputFile.settings.d.ts +6 -0
- package/dist/stories/InputFile/InputFile.stories.d.ts +13 -0
- package/dist/stories/InputFile/InputFileDropArea.stories.d.ts +9 -0
- package/dist/stories/InputFile/InputFileIconPosition.stories.d.ts +8 -0
- package/dist/stories/InputFile/InputFileSlots.stories.d.ts +7 -0
- package/dist/stories/InputText/InputText.settings.d.ts +2 -438
- package/dist/stories/Nav/Nav.settings.d.ts +2 -10
- package/dist/stories/Progress/Progress.settings.d.ts +2 -27
- package/dist/stories/Radio/Radio.settings.d.ts +1 -110
- package/dist/stories/RadioGroup/RadioGroup.settings.d.ts +1 -141
- package/dist/stories/Select/Select.settings.d.ts +2 -246
- package/dist/stories/Select/Select.stories.d.ts +1 -0
- package/dist/stories/Tab/Tab.settings.d.ts +2 -15
- package/dist/stories/Textarea/Textarea.settings.d.ts +2 -287
- package/dist/stories/argTypes.d.ts +27 -866
- package/dist/test/expect.d.ts +1 -2
- package/dist/test/options.d.ts +1 -1
- package/dist/test/sleep.d.ts +1 -1
- package/dist/types/alert.d.ts +9 -7
- package/dist/types/blurhash.d.ts +12 -0
- package/dist/types/floating-ui.d.ts +1 -1
- package/dist/types/generic.d.ts +1 -2
- package/dist/types/group.d.ts +37 -15
- package/dist/types/index.d.ts +7 -0
- package/dist/types/input-file.d.ts +9 -0
- package/dist/types/nav.d.ts +2 -2
- package/dist/utils/DomUtilities.d.ts +1 -0
- package/dist/utils/ObjectUtilities.d.ts +8 -9
- package/dist/workers/blurhash.d.ts +1 -0
- package/package.json +238 -246
- package/src/Volver.ts +251 -246
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +163 -100
- package/src/components/VvAccordion/index.ts +65 -80
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +224 -106
- package/src/components/VvAccordionGroup/index.ts +42 -42
- package/src/components/VvAction/VvAction.vue +144 -130
- package/src/components/VvAlert/VvAlert.vue +72 -70
- package/src/components/VvAlert/index.ts +149 -147
- package/src/components/VvAlertGroup/VvAlertGroup.vue +57 -56
- package/src/components/VvAlertGroup/index.ts +102 -118
- package/src/components/VvAvatar/VvAvatar.vue +20 -14
- package/src/components/VvAvatar/index.ts +5 -5
- package/src/components/VvAvatarGroup/VvAvatarGroup.vue +58 -53
- package/src/components/VvAvatarGroup/index.ts +21 -21
- package/src/components/VvBadge/VvBadge.vue +15 -14
- package/src/components/VvBadge/index.ts +2 -2
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +50 -48
- package/src/components/VvBreadcrumb/index.ts +3 -9
- package/src/components/VvButton/VvButton.vue +163 -152
- package/src/components/VvButton/index.ts +104 -111
- package/src/components/VvButtonGroup/VvButtonGroup.vue +73 -65
- package/src/components/VvButtonGroup/index.ts +23 -22
- package/src/components/VvCard/VvCard.vue +30 -30
- package/src/components/VvCard/index.ts +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +186 -184
- package/src/components/VvCheckbox/index.ts +45 -45
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +88 -87
- package/src/components/VvCombobox/VvCombobox.vue +657 -619
- package/src/components/VvCombobox/index.ts +212 -168
- package/src/components/VvDialog/VvDialog.vue +139 -129
- package/src/components/VvDialog/index.ts +42 -36
- package/src/components/VvDropdown/VvDropdown.vue +466 -445
- package/src/components/VvDropdown/VvDropdownAction.vue +37 -39
- package/src/components/VvDropdown/VvDropdownItem.vue +30 -26
- package/src/components/VvDropdown/VvDropdownOptgroup.vue +13 -12
- package/src/components/VvDropdown/VvDropdownOption.vue +47 -64
- package/src/components/VvDropdown/index.ts +61 -27
- package/src/components/VvIcon/README.md +1 -1
- package/src/components/VvIcon/VvIcon.vue +133 -133
- package/src/components/VvIcon/index.ts +84 -97
- package/src/components/VvInputFile/VvInputFile.vue +413 -0
- package/src/components/VvInputFile/index.ts +143 -0
- package/src/components/VvInputText/VvInputClearAction.ts +51 -47
- package/src/components/VvInputText/VvInputPasswordAction.ts +66 -62
- package/src/components/VvInputText/VvInputStepAction.ts +43 -43
- package/src/components/VvInputText/VvInputText.vue +653 -516
- package/src/components/VvInputText/VvInputTextActions.ts +87 -87
- package/src/components/VvInputText/index.ts +201 -186
- package/src/components/VvNav/VvNav.vue +40 -36
- package/src/components/VvNav/VvNavItem.vue +12 -12
- package/src/components/VvNav/VvNavSeparator.vue +6 -6
- package/src/components/VvNav/index.ts +2 -2
- package/src/components/VvProgress/VvProgress.vue +27 -27
- package/src/components/VvProgress/index.ts +28 -28
- package/src/components/VvRadio/VvRadio.vue +115 -112
- package/src/components/VvRadio/index.ts +29 -29
- package/src/components/VvRadioGroup/VvRadioGroup.vue +91 -90
- package/src/components/VvSelect/VvSelect.vue +262 -241
- package/src/components/VvSelect/index.ts +88 -63
- package/src/components/VvTab/VvTab.vue +79 -69
- package/src/components/VvTab/index.ts +13 -13
- package/src/components/VvTextarea/VvTextarea.vue +218 -219
- package/src/components/VvTextarea/index.ts +35 -35
- package/src/components/VvTooltip/VvTooltip.vue +22 -16
- package/src/components/VvTooltip/index.ts +12 -12
- package/src/components/common/HintSlot.ts +151 -152
- package/src/components/index.ts +10 -0
- package/src/composables/alert/{useInjectAlert.ts → useAlerInject.ts} +1 -1
- package/src/composables/alert/useAlert.ts +76 -73
- package/src/composables/alert/{useProvideAlert.ts → useAlertProvide.ts} +12 -12
- package/src/composables/dropdown/useDropdownContextmenu.ts +22 -0
- package/src/composables/dropdown/{useInjectDropdown.ts → useDropdownInject.ts} +6 -6
- package/src/composables/dropdown/useDropdownProvide.ts +94 -0
- package/src/composables/dropdown/useDropdownVirtualElement.ts +53 -0
- package/src/composables/group/useGroupStateInject.ts +55 -0
- package/src/composables/group/useGroupStateProvide.ts +14 -0
- package/src/composables/index.ts +3 -0
- package/src/composables/useBlurhash.ts +68 -0
- package/src/composables/useComponentFocus.ts +9 -9
- package/src/composables/useComponentIcon.ts +36 -35
- package/src/composables/useDebouncedInput.ts +25 -25
- package/src/composables/useDefaults.ts +81 -80
- package/src/composables/useModifiers.ts +29 -29
- package/src/composables/useOptions.ts +51 -42
- package/src/composables/usePersistence.ts +74 -0
- package/src/composables/useTextCount.ts +46 -46
- package/src/composables/useUniqueId.ts +4 -4
- package/src/composables/useVolver.ts +1 -1
- package/src/constants.ts +98 -83
- package/src/directives/index.ts +3 -6
- package/src/directives/v-contextmenu.ts +26 -34
- package/src/directives/v-tooltip.ts +20 -11
- package/src/icons.ts +2 -2
- package/src/index.ts +6 -4
- package/src/props/index.ts +467 -383
- package/src/resolvers/unplugin.ts +154 -144
- package/src/shims.d.ts +4 -5
- package/src/stories/Accordion/Accordion.settings.ts +51 -50
- package/src/stories/Accordion/Accordion.stories.ts +21 -21
- package/src/stories/Accordion/Accordion.test.ts +56 -54
- package/src/stories/Accordion/AccordionSlots.stories.ts +13 -13
- package/src/stories/AccordionGroup/AccordionGroup.settings.ts +70 -67
- package/src/stories/AccordionGroup/AccordionGroup.stories.ts +41 -39
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +49 -45
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +36 -36
- package/src/stories/Alert/Alert.settings.ts +117 -116
- package/src/stories/Alert/Alert.stories.ts +30 -30
- package/src/stories/Alert/Alert.test.ts +78 -80
- package/src/stories/Alert/AlertModifiers.stories.ts +45 -45
- package/src/stories/Alert/AlertSlots.stories.ts +35 -35
- package/src/stories/AlertGroup/AlertGroup.settings.ts +107 -105
- package/src/stories/AlertGroup/AlertGroup.stories.ts +25 -25
- package/src/stories/AlertGroup/AlertGroup.test.ts +69 -71
- package/src/stories/AlertGroup/AlertGroupPosition.stories.ts +68 -68
- package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +23 -23
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +58 -58
- package/src/stories/Avatar/Avatar.settings.ts +29 -29
- package/src/stories/Avatar/Avatar.stories.ts +22 -22
- package/src/stories/Avatar/Avatar.test.ts +22 -24
- package/src/stories/Avatar/AvatarBadge.stories.ts +15 -15
- package/src/stories/Avatar/AvatarModifiers.stories.ts +60 -60
- package/src/stories/Avatar/AvatarSlots.stories.ts +17 -17
- package/src/stories/AvatarGroup/AvatarGroup.settings.ts +54 -53
- package/src/stories/AvatarGroup/AvatarGroup.stories.ts +17 -17
- package/src/stories/AvatarGroup/AvatarGroup.test.ts +24 -26
- package/src/stories/AvatarGroup/AvatarGroupModifiers.stories.ts +15 -15
- package/src/stories/AvatarGroup/AvatarGroupSlotDefault.stories.ts +17 -17
- package/src/stories/Badge/Badge.settings.ts +21 -20
- package/src/stories/Badge/Badge.stories.ts +24 -24
- package/src/stories/Badge/Badge.test.ts +8 -8
- package/src/stories/Badge/BadgeSlots.stories.ts +10 -10
- package/src/stories/Blurhash/BlurhashComposable.stories.ts +116 -0
- package/src/stories/Breadcrumb/Breadcrumb.settings.ts +35 -34
- package/src/stories/Breadcrumb/Breadcrumb.stories.ts +23 -23
- package/src/stories/Breadcrumb/Breadcrumb.test.ts +44 -43
- package/src/stories/Breadcrumb/BreadcrumbSlots.stories.ts +19 -19
- package/src/stories/Button/Button.settings.ts +147 -151
- package/src/stories/Button/Button.stories.ts +19 -19
- package/src/stories/Button/Button.test.ts +41 -42
- package/src/stories/Button/ButtonIcon.stories.ts +42 -42
- package/src/stories/Button/ButtonLink.stories.ts +24 -24
- package/src/stories/Button/ButtonLoading.stories.ts +22 -22
- package/src/stories/Button/ButtonModifiers.stories.ts +91 -91
- package/src/stories/Button/ButtonSlots.stories.ts +47 -47
- package/src/stories/Button/ButtonState.stories.ts +23 -23
- package/src/stories/Button/ButtonToggle.stories.ts +30 -30
- package/src/stories/ButtonGroup/ButtonGroup.settings.ts +33 -24
- package/src/stories/ButtonGroup/ButtonGroup.stories.ts +19 -19
- package/src/stories/ButtonGroup/ButtonGroup.test.ts +23 -26
- package/src/stories/ButtonGroup/ButtonGroupModifiers.stories.ts +20 -20
- package/src/stories/ButtonGroup/ButtonGroupSlots.stories.ts +17 -17
- package/src/stories/ButtonGroup/ButtonGroupToggle.stories.ts +22 -22
- package/src/stories/Card/Card.settings.ts +49 -48
- package/src/stories/Card/Card.stories.ts +22 -22
- package/src/stories/Card/Card.test.ts +14 -16
- package/src/stories/Card/CardSlots.stories.ts +42 -42
- package/src/stories/Checkbox/Checkbox.settings.ts +36 -35
- package/src/stories/Checkbox/Checkbox.stories.ts +57 -57
- package/src/stories/Checkbox/Checkbox.test.ts +63 -66
- package/src/stories/Checkbox/CheckboxBinary.stories.ts +18 -18
- package/src/stories/Checkbox/CheckboxSlots.stories.ts +15 -15
- package/src/stories/CheckboxGroup/CheckboxGroup.settings.ts +9 -9
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.ts +50 -50
- package/src/stories/CheckboxGroup/CheckboxGroup.test.ts +64 -68
- package/src/stories/CheckboxGroup/CheckboxGroupOptions.stories.ts +34 -34
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.ts +23 -23
- package/src/stories/Combobox/Combobox.settings.ts +408 -385
- package/src/stories/Combobox/Combobox.stories.ts +116 -107
- package/src/stories/Combobox/Combobox.test.ts +92 -92
- package/src/stories/Combobox/ComboboxIconPosition.stories.ts +25 -24
- package/src/stories/Combobox/ComboboxMultiple.stories.ts +32 -22
- package/src/stories/Combobox/ComboboxOptions.stories.ts +81 -84
- package/src/stories/Combobox/ComboboxSlots.stories.ts +55 -54
- package/src/stories/Dialog/Dialog.settings.ts +49 -40
- package/src/stories/Dialog/Dialog.stories.ts +28 -28
- package/src/stories/Dialog/Dialog.test.ts +49 -54
- package/src/stories/Dialog/DialogModifiers.stories.ts +42 -0
- package/src/stories/Dialog/DialogSlots.stories.ts +20 -20
- package/src/stories/Dropdown/Dropdown.settings.ts +62 -61
- package/src/stories/Dropdown/Dropdown.stories.ts +60 -60
- package/src/stories/Dropdown/Dropdown.test.ts +9 -13
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.ts +18 -19
- package/src/stories/Dropdown/DropdownMultilevel.stories.ts +19 -19
- package/src/stories/Dropdown/DropdownSlots.stories.ts +51 -51
- package/src/stories/Icon/Icon.settings.ts +66 -65
- package/src/stories/Icon/Icon.stories.ts +29 -30
- package/src/stories/Icon/IconsCollection.stories.ts +24 -24
- package/src/stories/InputFile/InputFile.settings.ts +37 -0
- package/src/stories/InputFile/InputFile.stories.ts +97 -0
- package/src/stories/InputFile/InputFileDropArea.stories.ts +56 -0
- package/src/stories/InputFile/InputFileIconPosition.stories.ts +43 -0
- package/src/stories/InputFile/InputFileSlots.stories.ts +33 -0
- package/src/stories/InputText/InputText.settings.ts +248 -246
- package/src/stories/InputText/InputText.stories.ts +68 -68
- package/src/stories/InputText/InputText.test.ts +119 -122
- package/src/stories/InputText/InputTextIconPosition.stories.ts +24 -24
- package/src/stories/InputText/InputTextLength.stories.ts +33 -33
- package/src/stories/InputText/InputTextMask.stories.ts +91 -91
- package/src/stories/InputText/InputTextMinMax.stories.ts +30 -30
- package/src/stories/InputText/InputTextSlots.stories.ts +20 -20
- package/src/stories/InputText/InputTextType.stories.ts +70 -70
- package/src/stories/Nav/Nav.settings.ts +27 -27
- package/src/stories/Nav/Nav.stories.ts +18 -18
- package/src/stories/Nav/Nav.test.ts +10 -12
- package/src/stories/Nav/NavModifiers.stories.ts +25 -25
- package/src/stories/Progress/Progress.settings.ts +24 -23
- package/src/stories/Progress/Progress.stories.ts +23 -23
- package/src/stories/Progress/Progress.test.ts +5 -5
- package/src/stories/Radio/Radio.settings.ts +9 -9
- package/src/stories/Radio/Radio.stories.ts +47 -47
- package/src/stories/Radio/Radio.test.ts +54 -57
- package/src/stories/Radio/RadioSlots.stories.ts +15 -15
- package/src/stories/RadioGroup/RadioGroup.settings.ts +9 -9
- package/src/stories/RadioGroup/RadioGroup.stories.ts +51 -52
- package/src/stories/RadioGroup/RadioGroup.test.ts +64 -68
- package/src/stories/RadioGroup/RadioGroupOptions.stories.ts +35 -35
- package/src/stories/RadioGroup/RadioGroupSlots.stories.ts +23 -23
- package/src/stories/Select/Select.settings.ts +72 -71
- package/src/stories/Select/Select.stories.ts +75 -66
- package/src/stories/Select/Select.test.ts +67 -70
- package/src/stories/Select/SelectIconPosition.stories.ts +27 -26
- package/src/stories/Select/SelectOptions.stories.ts +55 -55
- package/src/stories/Select/SelectSlots.stories.ts +21 -20
- package/src/stories/Tab/Tab.settings.ts +34 -34
- package/src/stories/Tab/Tab.stories.ts +16 -16
- package/src/stories/Tab/Tab.test.ts +17 -19
- package/src/stories/Textarea/Textarea.settings.ts +80 -78
- package/src/stories/Textarea/Textarea.stories.ts +63 -63
- package/src/stories/Textarea/Textarea.test.ts +70 -73
- package/src/stories/Textarea/TextareaLength.stories.ts +33 -33
- package/src/stories/Textarea/TextareaSlots.stories.ts +20 -20
- package/src/stories/Textarea/TextareatIconPosition.stories.ts +24 -24
- package/src/stories/Tooltip/Tooltip.settings.ts +16 -17
- package/src/stories/Tooltip/Tooltip.stories.ts +18 -18
- package/src/stories/Tooltip/Tooltip.test.ts +53 -54
- package/src/stories/Tooltip/TooltipDirective.stories.ts +37 -37
- package/src/stories/argTypes.ts +506 -505
- package/src/test/expect.ts +74 -79
- package/src/test/options.ts +17 -16
- package/src/test/sleep.ts +3 -2
- package/src/test/types.d.ts +12 -12
- package/src/types/alert.ts +21 -17
- package/src/types/blurhash.ts +21 -0
- package/src/types/floating-ui.ts +1 -1
- package/src/types/generic.ts +2 -3
- package/src/types/group.ts +35 -27
- package/src/types/index.ts +7 -0
- package/src/types/input-file.ts +10 -0
- package/src/types/nav.ts +13 -14
- package/src/utils/DomUtilities.ts +15 -0
- package/src/utils/ObjectUtilities.ts +192 -188
- package/src/workers/blurhash.ts +9 -0
- package/dist/composables/alert/useInjectAlert.d.ts +0 -9
- package/dist/composables/dropdown/useInjectDropdown.d.ts +0 -32
- package/dist/composables/group/useInjectedGroupState.d.ts +0 -10
- package/dist/composables/group/useProvideGroupState.d.ts +0 -6
- package/src/composables/dropdown/useProvideDropdown.ts +0 -94
- package/src/composables/group/useInjectedGroupState.ts +0 -51
- package/src/composables/group/useProvideGroupState.ts +0 -20
- /package/src/assets/icons/normal/{dulicate.svg → duplicate.svg} +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, isRef, defineComponent, h, unref, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString, inject, toRef, getCurrentInstance, ref, watch, createBlock, resolveDynamicComponent, mergeProps, withCtx, mergeDefaults, createCommentVNode, useId, useAttrs, useSlots, Fragment, provide, onMounted, nextTick, createVNode, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, vShow, renderList, vModelSelect, createSlots, withModifiers, vModelText } from "vue";
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
4
|
-
import {
|
|
5
|
-
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
|
|
4
|
+
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
|
|
6
5
|
import mitt from "mitt";
|
|
7
6
|
import { get } from "ts-dot-prop";
|
|
7
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
8
|
+
StorageType2["local"] = "local";
|
|
9
|
+
StorageType2["session"] = "session";
|
|
10
|
+
return StorageType2;
|
|
11
|
+
})(StorageType || {});
|
|
8
12
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
9
13
|
Strategy2["absolute"] = "absolute";
|
|
10
14
|
Strategy2["fixed"] = "fixed";
|
|
@@ -62,15 +66,10 @@ var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
|
|
|
62
66
|
DropdownItemRole2["presentation"] = "presentation";
|
|
63
67
|
return DropdownItemRole2;
|
|
64
68
|
})(DropdownItemRole || {});
|
|
65
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
66
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
67
|
-
AnchorTarget2["_self"] = "_self";
|
|
68
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
69
|
-
AnchorTarget2["_top"] = "_top";
|
|
70
|
-
return AnchorTarget2;
|
|
71
|
-
})(AnchorTarget || {});
|
|
72
69
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
73
|
-
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
70
|
+
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
71
|
+
"buttonGroup"
|
|
72
|
+
);
|
|
74
73
|
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
75
74
|
"dropdownTrigger"
|
|
76
75
|
);
|
|
@@ -80,6 +79,188 @@ const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for(
|
|
|
80
79
|
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
|
|
81
80
|
"dropdownAction"
|
|
82
81
|
);
|
|
82
|
+
function equals(obj1, obj2, field) {
|
|
83
|
+
return deepEquals(obj1, obj2);
|
|
84
|
+
}
|
|
85
|
+
function deepEquals(a, b) {
|
|
86
|
+
if (a === b)
|
|
87
|
+
return true;
|
|
88
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
89
|
+
const arrA = Array.isArray(a);
|
|
90
|
+
const arrB = Array.isArray(b);
|
|
91
|
+
let i, length, key;
|
|
92
|
+
if (arrA && arrB) {
|
|
93
|
+
length = a.length;
|
|
94
|
+
if (length !== b.length)
|
|
95
|
+
return false;
|
|
96
|
+
for (i = length; i-- !== 0; ) {
|
|
97
|
+
if (!deepEquals(a[i], b[i]))
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (arrA !== arrB)
|
|
103
|
+
return false;
|
|
104
|
+
const dateA = a instanceof Date;
|
|
105
|
+
const dateB = b instanceof Date;
|
|
106
|
+
if (dateA !== dateB)
|
|
107
|
+
return false;
|
|
108
|
+
if (dateA && dateB)
|
|
109
|
+
return a.getTime() === b.getTime();
|
|
110
|
+
const regexpA = a instanceof RegExp;
|
|
111
|
+
const regexpB = b instanceof RegExp;
|
|
112
|
+
if (regexpA !== regexpB)
|
|
113
|
+
return false;
|
|
114
|
+
if (regexpA && regexpB)
|
|
115
|
+
return a.toString() === b.toString();
|
|
116
|
+
const keys = Object.keys(a);
|
|
117
|
+
length = keys.length;
|
|
118
|
+
if (length !== Object.keys(b).length)
|
|
119
|
+
return false;
|
|
120
|
+
for (i = length; i-- !== 0; ) {
|
|
121
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
for (i = length; i-- !== 0; ) {
|
|
125
|
+
key = keys[i];
|
|
126
|
+
if (!deepEquals(a[key], b[key]))
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return Number.isNaN(a) && Number.isNaN(b);
|
|
132
|
+
}
|
|
133
|
+
function contains(value, list) {
|
|
134
|
+
if (value != null && list && list.length) {
|
|
135
|
+
for (const val of list) {
|
|
136
|
+
if (equals(value, val)) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
function isString(value) {
|
|
144
|
+
return typeof value === "string" || value instanceof String;
|
|
145
|
+
}
|
|
146
|
+
function joinLines(items) {
|
|
147
|
+
if (Array.isArray(items)) {
|
|
148
|
+
return items.filter((item) => isString(item)).join(" ");
|
|
149
|
+
}
|
|
150
|
+
return items;
|
|
151
|
+
}
|
|
152
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
153
|
+
const props = computed(() => {
|
|
154
|
+
if (isRef(propsOrRef)) {
|
|
155
|
+
return propsOrRef.value;
|
|
156
|
+
}
|
|
157
|
+
return propsOrRef;
|
|
158
|
+
});
|
|
159
|
+
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
160
|
+
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
161
|
+
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
162
|
+
const hintLabel = computed(() => props.value.hintLabel);
|
|
163
|
+
const hasLoadingLabelOrSlot = computed(
|
|
164
|
+
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
165
|
+
);
|
|
166
|
+
const hasInvalidLabelOrSlot = computed(
|
|
167
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
168
|
+
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
const hasValidLabelOrSlot = computed(
|
|
172
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
173
|
+
);
|
|
174
|
+
const hasHintLabelOrSlot = computed(
|
|
175
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
176
|
+
);
|
|
177
|
+
const isVisible = computed(
|
|
178
|
+
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
179
|
+
);
|
|
180
|
+
const hintSlotScope = computed(() => ({
|
|
181
|
+
modelValue: props.value.modelValue,
|
|
182
|
+
valid: props.value.valid,
|
|
183
|
+
invalid: props.value.invalid,
|
|
184
|
+
loading: props.value.loading
|
|
185
|
+
}));
|
|
186
|
+
const HintSlot = defineComponent({
|
|
187
|
+
name: "HintSlot",
|
|
188
|
+
props: {
|
|
189
|
+
tag: {
|
|
190
|
+
type: String,
|
|
191
|
+
default: "small"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
setup() {
|
|
195
|
+
return {
|
|
196
|
+
isVisible,
|
|
197
|
+
invalidLabel,
|
|
198
|
+
validLabel,
|
|
199
|
+
loadingLabel,
|
|
200
|
+
hintLabel,
|
|
201
|
+
hasInvalidLabelOrSlot,
|
|
202
|
+
hasValidLabelOrSlot,
|
|
203
|
+
hasLoadingLabelOrSlot,
|
|
204
|
+
hasHintLabelOrSlot
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
render() {
|
|
208
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
209
|
+
if (this.isVisible) {
|
|
210
|
+
let role;
|
|
211
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
212
|
+
role = "alert";
|
|
213
|
+
}
|
|
214
|
+
if (this.hasValidLabelOrSlot) {
|
|
215
|
+
role = "status";
|
|
216
|
+
}
|
|
217
|
+
if (this.hasLoadingLabelOrSlot) {
|
|
218
|
+
return h(
|
|
219
|
+
this.tag,
|
|
220
|
+
{
|
|
221
|
+
role
|
|
222
|
+
},
|
|
223
|
+
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
227
|
+
return h(
|
|
228
|
+
this.tag,
|
|
229
|
+
{
|
|
230
|
+
role
|
|
231
|
+
},
|
|
232
|
+
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
if (this.hasValidLabelOrSlot) {
|
|
236
|
+
return h(
|
|
237
|
+
this.tag,
|
|
238
|
+
{
|
|
239
|
+
role
|
|
240
|
+
},
|
|
241
|
+
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
return h(
|
|
245
|
+
this.tag,
|
|
246
|
+
{
|
|
247
|
+
role
|
|
248
|
+
},
|
|
249
|
+
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
return {
|
|
256
|
+
hasInvalidLabelOrSlot,
|
|
257
|
+
hasHintLabelOrSlot,
|
|
258
|
+
hasValidLabelOrSlot,
|
|
259
|
+
hasLoadingLabelOrSlot,
|
|
260
|
+
hintSlotScope,
|
|
261
|
+
HintSlot
|
|
262
|
+
};
|
|
263
|
+
}
|
|
83
264
|
const LinkProps = {
|
|
84
265
|
/**
|
|
85
266
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
@@ -95,10 +276,7 @@ const LinkProps = {
|
|
|
95
276
|
/**
|
|
96
277
|
* Anchor target
|
|
97
278
|
*/
|
|
98
|
-
target:
|
|
99
|
-
type: String,
|
|
100
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
101
|
-
},
|
|
279
|
+
target: String,
|
|
102
280
|
/**
|
|
103
281
|
* Anchor rel
|
|
104
282
|
*/
|
|
@@ -111,27 +289,33 @@ const ValidProps = {
|
|
|
111
289
|
/**
|
|
112
290
|
* Valid status
|
|
113
291
|
*/
|
|
114
|
-
valid: Boolean,
|
|
292
|
+
valid: { type: Boolean, default: false },
|
|
115
293
|
/**
|
|
116
294
|
* Valid label
|
|
117
295
|
*/
|
|
118
|
-
validLabel: [String, Array]
|
|
296
|
+
validLabel: { type: [String, Array], default: void 0 }
|
|
119
297
|
};
|
|
120
298
|
const InvalidProps = {
|
|
121
299
|
/**
|
|
122
300
|
* Invalid status
|
|
123
301
|
*/
|
|
124
|
-
invalid:
|
|
302
|
+
invalid: {
|
|
303
|
+
type: Boolean,
|
|
304
|
+
default: false
|
|
305
|
+
},
|
|
125
306
|
/**
|
|
126
307
|
* Invalid label
|
|
127
308
|
*/
|
|
128
|
-
invalidLabel: [String, Array]
|
|
309
|
+
invalidLabel: { type: [String, Array], default: void 0 }
|
|
129
310
|
};
|
|
130
311
|
const LoadingProps = {
|
|
131
312
|
/**
|
|
132
313
|
* Loading status
|
|
133
314
|
*/
|
|
134
|
-
loading:
|
|
315
|
+
loading: {
|
|
316
|
+
type: Boolean,
|
|
317
|
+
default: false
|
|
318
|
+
},
|
|
135
319
|
/**
|
|
136
320
|
* Loading label
|
|
137
321
|
*/
|
|
@@ -144,49 +328,82 @@ const DisabledProps = {
|
|
|
144
328
|
/**
|
|
145
329
|
* Whether the form control is disabled
|
|
146
330
|
*/
|
|
147
|
-
disabled:
|
|
331
|
+
disabled: {
|
|
332
|
+
type: Boolean,
|
|
333
|
+
default: false
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
const RequiredProps = {
|
|
337
|
+
/**
|
|
338
|
+
* Whether the form control is required
|
|
339
|
+
*/
|
|
340
|
+
required: {
|
|
341
|
+
type: Boolean,
|
|
342
|
+
default: false
|
|
343
|
+
}
|
|
148
344
|
};
|
|
149
345
|
const SelectedProps = {
|
|
150
346
|
/**
|
|
151
347
|
* Whether the item is selected
|
|
152
348
|
*/
|
|
153
|
-
selected:
|
|
349
|
+
selected: {
|
|
350
|
+
type: Boolean,
|
|
351
|
+
default: false
|
|
352
|
+
}
|
|
154
353
|
};
|
|
155
354
|
const ActiveProps = {
|
|
156
355
|
/**
|
|
157
356
|
* Whether the item is active
|
|
158
357
|
*/
|
|
159
|
-
active:
|
|
358
|
+
active: {
|
|
359
|
+
type: Boolean,
|
|
360
|
+
default: false
|
|
361
|
+
}
|
|
160
362
|
};
|
|
161
363
|
const CurrentProps = {
|
|
162
364
|
/**
|
|
163
365
|
* Whether the item is current
|
|
164
366
|
*/
|
|
165
|
-
current:
|
|
367
|
+
current: {
|
|
368
|
+
type: Boolean,
|
|
369
|
+
default: false
|
|
370
|
+
}
|
|
166
371
|
};
|
|
167
372
|
const PressedProps = {
|
|
168
373
|
/**
|
|
169
374
|
* Whether the item is pressed
|
|
170
375
|
*/
|
|
171
|
-
pressed:
|
|
376
|
+
pressed: {
|
|
377
|
+
type: Boolean,
|
|
378
|
+
default: false
|
|
379
|
+
}
|
|
172
380
|
};
|
|
173
381
|
const LabelProps = {
|
|
174
382
|
/**
|
|
175
383
|
* The item label
|
|
176
384
|
*/
|
|
177
|
-
label:
|
|
385
|
+
label: {
|
|
386
|
+
type: [String, Number],
|
|
387
|
+
default: void 0
|
|
388
|
+
}
|
|
178
389
|
};
|
|
179
390
|
const ReadonlyProps = {
|
|
180
391
|
/**
|
|
181
392
|
* The value is not editable
|
|
182
393
|
*/
|
|
183
|
-
readonly:
|
|
394
|
+
readonly: {
|
|
395
|
+
type: Boolean,
|
|
396
|
+
default: false
|
|
397
|
+
}
|
|
184
398
|
};
|
|
185
399
|
const ModifiersProps = {
|
|
186
400
|
/**
|
|
187
401
|
* Component BEM modifiers
|
|
188
402
|
*/
|
|
189
|
-
modifiers:
|
|
403
|
+
modifiers: {
|
|
404
|
+
type: [String, Array],
|
|
405
|
+
default: void 0
|
|
406
|
+
}
|
|
190
407
|
};
|
|
191
408
|
const HintProps = {
|
|
192
409
|
hintLabel: { type: String, default: "" }
|
|
@@ -217,7 +434,10 @@ const IconProps = {
|
|
|
217
434
|
* VvIcon name or props
|
|
218
435
|
* @see VVIcon
|
|
219
436
|
*/
|
|
220
|
-
icon: {
|
|
437
|
+
icon: {
|
|
438
|
+
type: [String, Object],
|
|
439
|
+
default: void 0
|
|
440
|
+
},
|
|
221
441
|
/**
|
|
222
442
|
* VvIcon position
|
|
223
443
|
*/
|
|
@@ -238,7 +458,10 @@ const FloatingLabelProps = {
|
|
|
238
458
|
/**
|
|
239
459
|
* If true the label will be floating
|
|
240
460
|
*/
|
|
241
|
-
floating:
|
|
461
|
+
floating: {
|
|
462
|
+
type: Boolean,
|
|
463
|
+
default: false
|
|
464
|
+
}
|
|
242
465
|
};
|
|
243
466
|
const UnselectableProps = {
|
|
244
467
|
/**
|
|
@@ -274,7 +497,8 @@ const DropdownProps = {
|
|
|
274
497
|
* Dropdown show / hide transition name
|
|
275
498
|
*/
|
|
276
499
|
transitionName: {
|
|
277
|
-
type: String
|
|
500
|
+
type: String,
|
|
501
|
+
default: void 0
|
|
278
502
|
},
|
|
279
503
|
/**
|
|
280
504
|
* Offset of the dropdown from the trigger
|
|
@@ -342,7 +566,8 @@ const DropdownProps = {
|
|
|
342
566
|
* Set dropdown width to the same as the trigger
|
|
343
567
|
*/
|
|
344
568
|
triggerWidth: {
|
|
345
|
-
type: Boolean
|
|
569
|
+
type: Boolean,
|
|
570
|
+
default: false
|
|
346
571
|
}
|
|
347
572
|
};
|
|
348
573
|
const IdNameProps = {
|
|
@@ -359,7 +584,10 @@ const AutofocusProps = {
|
|
|
359
584
|
* Global attribute autofocus
|
|
360
585
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
361
586
|
*/
|
|
362
|
-
autofocus:
|
|
587
|
+
autofocus: {
|
|
588
|
+
type: Boolean,
|
|
589
|
+
default: false
|
|
590
|
+
}
|
|
363
591
|
};
|
|
364
592
|
const AutocompleteProps = {
|
|
365
593
|
/**
|
|
@@ -389,254 +617,27 @@ const ActionProps = {
|
|
|
389
617
|
ariaLabel: {
|
|
390
618
|
type: String,
|
|
391
619
|
default: void 0
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
const VvComboboxEvents = [
|
|
395
|
-
"update:modelValue",
|
|
396
|
-
"change:search",
|
|
397
|
-
"focus",
|
|
398
|
-
"blur"
|
|
399
|
-
];
|
|
400
|
-
const VvComboboxProps = {
|
|
401
|
-
...IdNameProps,
|
|
402
|
-
...TabindexProps,
|
|
403
|
-
...ValidProps,
|
|
404
|
-
...InvalidProps,
|
|
405
|
-
...HintProps,
|
|
406
|
-
...LoadingProps,
|
|
407
|
-
...DisabledProps,
|
|
408
|
-
...ReadonlyProps,
|
|
409
|
-
...ModifiersProps,
|
|
410
|
-
...OptionsProps,
|
|
411
|
-
...IconProps,
|
|
412
|
-
...FloatingLabelProps,
|
|
413
|
-
...UnselectableProps,
|
|
414
|
-
...DropdownProps,
|
|
415
|
-
...LabelProps,
|
|
416
|
-
/**
|
|
417
|
-
* Dropdown show / hide transition name
|
|
418
|
-
*/
|
|
419
|
-
transitionName: {
|
|
420
|
-
type: String,
|
|
421
|
-
default: "vv-dropdown--mobile-fade-block"
|
|
422
620
|
},
|
|
423
621
|
/**
|
|
424
|
-
*
|
|
622
|
+
* Default tag for the action
|
|
425
623
|
*/
|
|
426
|
-
|
|
427
|
-
type:
|
|
428
|
-
default:
|
|
624
|
+
defaultTag: {
|
|
625
|
+
type: String,
|
|
626
|
+
default: ActionTag.button
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
({
|
|
630
|
+
storageType: {
|
|
631
|
+
type: String,
|
|
632
|
+
default: StorageType.local,
|
|
633
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
429
634
|
},
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
* Label for no options available
|
|
436
|
-
*/
|
|
437
|
-
noOptionsLabel: { type: String, default: "No options available" },
|
|
438
|
-
/**
|
|
439
|
-
* Label for selected option hint
|
|
440
|
-
*/
|
|
441
|
-
selectedHintLabel: { type: String, default: "Selected" },
|
|
442
|
-
/**
|
|
443
|
-
* Label for deselect action button
|
|
444
|
-
*/
|
|
445
|
-
deselectActionLabel: { type: String, default: "Deselect" },
|
|
446
|
-
/**
|
|
447
|
-
* Label for select option hint
|
|
448
|
-
*/
|
|
449
|
-
selectHintLabel: { type: String, default: "Press enter to select" },
|
|
450
|
-
/**
|
|
451
|
-
* Label for deselected option hint
|
|
452
|
-
*/
|
|
453
|
-
deselectHintLabel: { type: String, default: "Press enter to remove" },
|
|
454
|
-
/**
|
|
455
|
-
* Label close button
|
|
456
|
-
*/
|
|
457
|
-
closeLabel: { type: String, default: "Close" },
|
|
458
|
-
/**
|
|
459
|
-
* Select input placeholder
|
|
460
|
-
*/
|
|
461
|
-
placeholder: String,
|
|
462
|
-
/**
|
|
463
|
-
* Use input text to search on options
|
|
464
|
-
*/
|
|
465
|
-
searchable: Boolean,
|
|
466
|
-
/**
|
|
467
|
-
* Search function to filter options
|
|
468
|
-
*/
|
|
469
|
-
searchFunction: {
|
|
470
|
-
type: Function,
|
|
471
|
-
default: void 0
|
|
472
|
-
},
|
|
473
|
-
/**
|
|
474
|
-
* On searchable select is the input search placeholder
|
|
475
|
-
*/
|
|
476
|
-
searchPlaceholder: {
|
|
477
|
-
type: String,
|
|
478
|
-
default: "Search..."
|
|
479
|
-
},
|
|
480
|
-
/**
|
|
481
|
-
* The input search debounce time in ms
|
|
482
|
-
*/
|
|
483
|
-
debounceSearch: {
|
|
484
|
-
type: [Number, String],
|
|
485
|
-
default: 0
|
|
486
|
-
},
|
|
487
|
-
/**
|
|
488
|
-
* Manage modelValue as string[] or object[]
|
|
489
|
-
*/
|
|
490
|
-
multiple: Boolean,
|
|
491
|
-
/**
|
|
492
|
-
* The max number of selected values
|
|
493
|
-
*/
|
|
494
|
-
maxValues: [Number, String],
|
|
495
|
-
/**
|
|
496
|
-
* The select label separator visible to the user
|
|
497
|
-
*/
|
|
498
|
-
separator: { type: String, default: ", " },
|
|
499
|
-
/**
|
|
500
|
-
* Show native select
|
|
501
|
-
*/
|
|
502
|
-
native: Boolean,
|
|
503
|
-
/**
|
|
504
|
-
* Show badges
|
|
505
|
-
*/
|
|
506
|
-
badges: Boolean,
|
|
507
|
-
/**
|
|
508
|
-
* Badge modifiers
|
|
509
|
-
*/
|
|
510
|
-
badgeModifiers: {
|
|
511
|
-
type: [String, Array],
|
|
512
|
-
default: "action sm"
|
|
513
|
-
},
|
|
514
|
-
/**
|
|
515
|
-
* Set dropdown width to the same as the trigger
|
|
516
|
-
*/
|
|
517
|
-
triggerWidth: {
|
|
518
|
-
...DropdownProps.triggerWidth,
|
|
519
|
-
default: true
|
|
520
|
-
},
|
|
521
|
-
/**
|
|
522
|
-
* Dropdown modifiers
|
|
523
|
-
*/
|
|
524
|
-
dropdownModifiers: {
|
|
525
|
-
type: [String, Array],
|
|
526
|
-
default: "mobile"
|
|
527
|
-
},
|
|
528
|
-
/**
|
|
529
|
-
* Open dropdown on focus
|
|
530
|
-
*/
|
|
531
|
-
autoOpen: {
|
|
532
|
-
type: Boolean,
|
|
533
|
-
default: false
|
|
534
|
-
},
|
|
535
|
-
/**
|
|
536
|
-
* Keep open dropdown on single select
|
|
537
|
-
*/
|
|
538
|
-
keepOpen: {
|
|
539
|
-
type: Boolean,
|
|
540
|
-
default: false
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
const VvIconProps = {
|
|
544
|
-
/**
|
|
545
|
-
* Color
|
|
546
|
-
*/
|
|
547
|
-
color: String,
|
|
548
|
-
/**
|
|
549
|
-
* Width
|
|
550
|
-
*/
|
|
551
|
-
width: {
|
|
552
|
-
type: [String, Number]
|
|
553
|
-
},
|
|
554
|
-
/**
|
|
555
|
-
* Height
|
|
556
|
-
*/
|
|
557
|
-
height: {
|
|
558
|
-
type: [String, Number]
|
|
559
|
-
},
|
|
560
|
-
/**
|
|
561
|
-
* Icon name
|
|
562
|
-
* Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
|
|
563
|
-
* https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
564
|
-
*/
|
|
565
|
-
name: {
|
|
566
|
-
type: String,
|
|
567
|
-
required: true
|
|
568
|
-
},
|
|
569
|
-
/**
|
|
570
|
-
* By default 'vv'
|
|
571
|
-
* If custom collection is not added with "addCollection" DS class method, this prop could not be used
|
|
572
|
-
* Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
573
|
-
*/
|
|
574
|
-
provider: {
|
|
575
|
-
type: String
|
|
576
|
-
},
|
|
577
|
-
/**
|
|
578
|
-
* The name of icon set.
|
|
579
|
-
* Icon default options prefix: simple | normal | detailed
|
|
580
|
-
*/
|
|
581
|
-
prefix: {
|
|
582
|
-
type: String,
|
|
583
|
-
default: "normal"
|
|
584
|
-
},
|
|
585
|
-
/**
|
|
586
|
-
* Url remote SVG icon
|
|
587
|
-
*/
|
|
588
|
-
src: String,
|
|
589
|
-
/**
|
|
590
|
-
* Horizontal flip
|
|
591
|
-
*/
|
|
592
|
-
horizontalFlip: Boolean,
|
|
593
|
-
/**
|
|
594
|
-
* Vertical flip
|
|
595
|
-
*/
|
|
596
|
-
verticalFlip: Boolean,
|
|
597
|
-
/**
|
|
598
|
-
* String alternative to "horizontalFlip" and "verticalFlip".
|
|
599
|
-
* Example: https://docs.iconify.design/icon-components/vue/transform.html
|
|
600
|
-
*/
|
|
601
|
-
flip: String,
|
|
602
|
-
/**
|
|
603
|
-
* Icon render mode
|
|
604
|
-
* 'style' = 'bg' or 'mask', depending on icon content
|
|
605
|
-
* 'bg' = span with style using `background`
|
|
606
|
-
* 'mask' = span with style using `mask`
|
|
607
|
-
* 'svg' = svg
|
|
608
|
-
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
609
|
-
*/
|
|
610
|
-
mode: String,
|
|
611
|
-
/**
|
|
612
|
-
* Toggles inline or block mode
|
|
613
|
-
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
614
|
-
*/
|
|
615
|
-
inline: Boolean,
|
|
616
|
-
/**
|
|
617
|
-
* rotates icon
|
|
618
|
-
* Example https://docs.iconify.design/icon-components/vue/transform.html
|
|
619
|
-
*/
|
|
620
|
-
rotate: [Number, String],
|
|
621
|
-
/**
|
|
622
|
-
* A callback that is called when icon data has been loaded
|
|
623
|
-
*/
|
|
624
|
-
onLoad: Function,
|
|
625
|
-
/**
|
|
626
|
-
* SVG icon string
|
|
627
|
-
*/
|
|
628
|
-
svg: String,
|
|
629
|
-
/**
|
|
630
|
-
* Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
|
|
631
|
-
* @values string | string[]
|
|
632
|
-
*/
|
|
633
|
-
modifiers: {
|
|
634
|
-
type: [String, Array]
|
|
635
|
-
}
|
|
635
|
+
storageKey: String
|
|
636
|
+
});
|
|
637
|
+
const VvBadgeProps = {
|
|
638
|
+
...ModifiersProps,
|
|
639
|
+
value: [String, Number]
|
|
636
640
|
};
|
|
637
|
-
function useVolver() {
|
|
638
|
-
return inject(INJECTION_KEY_VOLVER);
|
|
639
|
-
}
|
|
640
641
|
function useModifiers(prefix, modifiers, others) {
|
|
641
642
|
return computed(() => {
|
|
642
643
|
const toReturn = {
|
|
@@ -661,107 +662,637 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
661
662
|
});
|
|
662
663
|
}
|
|
663
664
|
const __default__$9 = {
|
|
664
|
-
name: "
|
|
665
|
+
name: "VvBadge"
|
|
665
666
|
};
|
|
666
667
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
667
668
|
...__default__$9,
|
|
668
|
-
props:
|
|
669
|
+
props: VvBadgeProps,
|
|
669
670
|
setup(__props) {
|
|
670
671
|
const props = __props;
|
|
671
|
-
const hasRotate = computed(() => {
|
|
672
|
-
if (typeof props.rotate === "string") {
|
|
673
|
-
return parseFloat(props.rotate);
|
|
674
|
-
}
|
|
675
|
-
return props.rotate;
|
|
676
|
-
});
|
|
677
|
-
const show = ref(true);
|
|
678
|
-
const volver = useVolver();
|
|
679
672
|
const { modifiers } = toRefs(props);
|
|
680
|
-
const bemCssClasses = useModifiers("vv-
|
|
681
|
-
const provider = computed(() => {
|
|
682
|
-
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
683
|
-
});
|
|
684
|
-
const icon = computed(() => {
|
|
685
|
-
const name = props.name ?? "";
|
|
686
|
-
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
687
|
-
if (iconExists(iconName)) {
|
|
688
|
-
return iconName;
|
|
689
|
-
}
|
|
690
|
-
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
691
|
-
(iconsCollection2) => {
|
|
692
|
-
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
693
|
-
return iconExists(icon2);
|
|
694
|
-
}
|
|
695
|
-
);
|
|
696
|
-
if (iconsCollection) {
|
|
697
|
-
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
698
|
-
}
|
|
699
|
-
return name;
|
|
700
|
-
});
|
|
701
|
-
function getSvgContent(svg) {
|
|
702
|
-
let dom;
|
|
703
|
-
if (typeof window === "undefined") {
|
|
704
|
-
const { JSDOM } = require("jsdom");
|
|
705
|
-
dom = new JSDOM().window;
|
|
706
|
-
}
|
|
707
|
-
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
708
|
-
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
709
|
-
const svgEl = svgDomString.querySelector("svg");
|
|
710
|
-
return svgEl;
|
|
711
|
-
}
|
|
712
|
-
function addIconFromSvg(svg) {
|
|
713
|
-
const svgContentEl = getSvgContent(svg);
|
|
714
|
-
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
715
|
-
if (svgContentEl && svgContent) {
|
|
716
|
-
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
717
|
-
body: svgContent,
|
|
718
|
-
// Set height and width from svg content
|
|
719
|
-
height: svgContentEl.viewBox.baseVal.height,
|
|
720
|
-
width: svgContentEl.viewBox.baseVal.width
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
if (volver) {
|
|
725
|
-
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
726
|
-
show.value = false;
|
|
727
|
-
volver.fetchIcon(props.src).then((svg) => {
|
|
728
|
-
if (svg) {
|
|
729
|
-
addIconFromSvg(svg);
|
|
730
|
-
show.value = true;
|
|
731
|
-
}
|
|
732
|
-
}).catch((e) => {
|
|
733
|
-
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
if (props.svg) {
|
|
738
|
-
addIconFromSvg(props.svg);
|
|
739
|
-
}
|
|
673
|
+
const bemCssClasses = useModifiers("vv-badge", modifiers);
|
|
740
674
|
return (_ctx, _cache) => {
|
|
741
|
-
return
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
675
|
+
return openBlock(), createElementBlock(
|
|
676
|
+
"span",
|
|
677
|
+
{
|
|
678
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
679
|
+
},
|
|
680
|
+
[
|
|
681
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
682
|
+
createTextVNode(
|
|
683
|
+
toDisplayString(_ctx.value),
|
|
684
|
+
1
|
|
685
|
+
/* TEXT */
|
|
686
|
+
)
|
|
687
|
+
])
|
|
688
|
+
],
|
|
689
|
+
2
|
|
690
|
+
/* CLASS */
|
|
691
|
+
);
|
|
756
692
|
};
|
|
757
693
|
}
|
|
758
694
|
});
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
695
|
+
function useGroupStateInject(groupKey) {
|
|
696
|
+
const group = inject(groupKey, void 0);
|
|
697
|
+
const isInGroup = computed(() => group !== void 0);
|
|
698
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
699
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
700
|
+
if (groupPropValue) {
|
|
701
|
+
return computed({
|
|
702
|
+
get() {
|
|
703
|
+
return groupPropValue.value;
|
|
704
|
+
},
|
|
705
|
+
set(value) {
|
|
706
|
+
groupPropValue.value = value;
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
const propRef = toRef(props, propName);
|
|
711
|
+
return computed({
|
|
712
|
+
get() {
|
|
713
|
+
return propRef.value;
|
|
714
|
+
},
|
|
715
|
+
set(value) {
|
|
716
|
+
if (emit) {
|
|
717
|
+
emit(`update:${propName}`, value);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
return {
|
|
723
|
+
group,
|
|
724
|
+
isInGroup,
|
|
725
|
+
getGroupOrLocalRef
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
const VvButtonEvents = ["update:modelValue"];
|
|
729
|
+
const VvButtonProps = {
|
|
730
|
+
...ActionProps,
|
|
731
|
+
...IdProps,
|
|
732
|
+
...ModifiersProps,
|
|
733
|
+
...UnselectableProps,
|
|
734
|
+
...LoadingProps,
|
|
735
|
+
...IconProps,
|
|
736
|
+
/**
|
|
737
|
+
* Button icon position
|
|
738
|
+
*/
|
|
739
|
+
iconPosition: {
|
|
740
|
+
type: String,
|
|
741
|
+
default: Side.left,
|
|
742
|
+
validator: (value) => Object.values(Side).includes(value)
|
|
743
|
+
},
|
|
744
|
+
/**
|
|
745
|
+
* Loading icon
|
|
746
|
+
*/
|
|
747
|
+
loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
|
|
748
|
+
/**
|
|
749
|
+
* Enable button toggle
|
|
750
|
+
*/
|
|
751
|
+
toggle: {
|
|
752
|
+
type: Boolean,
|
|
753
|
+
default: false
|
|
754
|
+
},
|
|
755
|
+
/**
|
|
756
|
+
* Button toggle value
|
|
757
|
+
*/
|
|
758
|
+
value: {
|
|
759
|
+
type: [String, Number, Boolean],
|
|
760
|
+
default: void 0
|
|
761
|
+
},
|
|
762
|
+
/**
|
|
763
|
+
* Value associated with the unchecked state
|
|
764
|
+
*/
|
|
765
|
+
uncheckedValue: {
|
|
766
|
+
type: [String, Number, Boolean],
|
|
767
|
+
default: void 0
|
|
768
|
+
},
|
|
769
|
+
/**
|
|
770
|
+
* Button toggle model value
|
|
771
|
+
*/
|
|
772
|
+
modelValue: {
|
|
773
|
+
type: [String, Number, Boolean],
|
|
774
|
+
default: void 0
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
function useGroupProps(props, emit) {
|
|
778
|
+
const { group, isInGroup, getGroupOrLocalRef } = useGroupStateInject(INJECTION_KEY_BUTTON_GROUP);
|
|
779
|
+
const { id, iconPosition, icon, label, pressed } = toRefs(props);
|
|
780
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
781
|
+
const toggle = getGroupOrLocalRef("toggle", props);
|
|
782
|
+
const unselectable = getGroupOrLocalRef("unselectable", props);
|
|
783
|
+
const multiple = computed(() => (group == null ? void 0 : group.multiple.value) ?? false);
|
|
784
|
+
const modifiers = computed(() => {
|
|
785
|
+
let localModifiers = props.modifiers;
|
|
786
|
+
let groupModifiers = group == null ? void 0 : group.modifiers.value;
|
|
787
|
+
const toReturn = /* @__PURE__ */ new Set();
|
|
788
|
+
if (localModifiers) {
|
|
789
|
+
if (!Array.isArray(localModifiers)) {
|
|
790
|
+
localModifiers = localModifiers.split(" ");
|
|
791
|
+
}
|
|
792
|
+
localModifiers.forEach((modifier) => toReturn.add(modifier));
|
|
793
|
+
}
|
|
794
|
+
if (groupModifiers) {
|
|
795
|
+
if (!Array.isArray(groupModifiers)) {
|
|
796
|
+
groupModifiers = groupModifiers.split(" ");
|
|
797
|
+
}
|
|
798
|
+
groupModifiers.forEach((modifier) => toReturn.add(modifier));
|
|
799
|
+
}
|
|
800
|
+
return Array.from(toReturn);
|
|
801
|
+
});
|
|
802
|
+
const disabled = computed(
|
|
803
|
+
() => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
|
|
804
|
+
);
|
|
805
|
+
return {
|
|
806
|
+
// group props
|
|
807
|
+
group,
|
|
808
|
+
isInGroup,
|
|
809
|
+
modelValue,
|
|
810
|
+
toggle,
|
|
811
|
+
unselectable,
|
|
812
|
+
multiple,
|
|
813
|
+
modifiers,
|
|
814
|
+
disabled,
|
|
815
|
+
// local props
|
|
816
|
+
id,
|
|
817
|
+
pressed,
|
|
818
|
+
iconPosition,
|
|
819
|
+
icon,
|
|
820
|
+
label
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
824
|
+
const VvActionProps = ActionProps;
|
|
825
|
+
function useVolver() {
|
|
826
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
827
|
+
}
|
|
828
|
+
function useInjectedDropdownTrigger() {
|
|
829
|
+
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
830
|
+
}
|
|
831
|
+
function useInjectedDropdownItem() {
|
|
832
|
+
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
833
|
+
}
|
|
834
|
+
function useInjectedDropdownAction() {
|
|
835
|
+
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
836
|
+
}
|
|
837
|
+
const __default__$8 = {
|
|
838
|
+
name: "VvAction"
|
|
839
|
+
};
|
|
840
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
841
|
+
...__default__$8,
|
|
842
|
+
props: VvActionProps,
|
|
843
|
+
emits: VvActionEvents,
|
|
844
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
845
|
+
const props = __props;
|
|
846
|
+
const emit = __emit;
|
|
847
|
+
const instance = getCurrentInstance();
|
|
848
|
+
const volver = useVolver();
|
|
849
|
+
const element = ref(null);
|
|
850
|
+
__expose({ $el: element });
|
|
851
|
+
const {
|
|
852
|
+
reference: dropdownTriggerReference,
|
|
853
|
+
bus: dropdownEventBus,
|
|
854
|
+
aria: dropdownAria,
|
|
855
|
+
expanded: dropdownExpanded
|
|
856
|
+
} = useInjectedDropdownTrigger();
|
|
857
|
+
watch(
|
|
858
|
+
() => element.value,
|
|
859
|
+
(newValue) => {
|
|
860
|
+
if (dropdownTriggerReference) {
|
|
861
|
+
dropdownTriggerReference.value = newValue;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
);
|
|
865
|
+
const pressed = computed(() => {
|
|
866
|
+
return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
|
|
867
|
+
});
|
|
868
|
+
const { role } = useInjectedDropdownAction();
|
|
869
|
+
const hasTag = computed(() => {
|
|
870
|
+
switch (true) {
|
|
871
|
+
case props.disabled:
|
|
872
|
+
return ActionTag.button;
|
|
873
|
+
case props.to !== void 0:
|
|
874
|
+
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
875
|
+
case props.href !== void 0:
|
|
876
|
+
return ActionTag.a;
|
|
877
|
+
default:
|
|
878
|
+
return props.defaultTag;
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
const hasProps = computed(() => {
|
|
882
|
+
const toReturn = {
|
|
883
|
+
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
884
|
+
ariaPressed: pressed.value ? true : void 0,
|
|
885
|
+
ariaLabel: props.ariaLabel,
|
|
886
|
+
role: role == null ? void 0 : role.value
|
|
887
|
+
};
|
|
888
|
+
switch (hasTag.value) {
|
|
889
|
+
case ActionTag.a:
|
|
890
|
+
return {
|
|
891
|
+
...toReturn,
|
|
892
|
+
href: props.href,
|
|
893
|
+
target: props.target,
|
|
894
|
+
rel: props.rel
|
|
895
|
+
};
|
|
896
|
+
case ActionTag.routerLink:
|
|
897
|
+
case ActionTag.nuxtLink:
|
|
898
|
+
return {
|
|
899
|
+
...toReturn,
|
|
900
|
+
to: props.to,
|
|
901
|
+
target: props.target
|
|
902
|
+
};
|
|
903
|
+
case ActionTag.button:
|
|
904
|
+
return {
|
|
905
|
+
...toReturn,
|
|
906
|
+
type: props.type,
|
|
907
|
+
disabled: props.disabled
|
|
908
|
+
};
|
|
909
|
+
default:
|
|
910
|
+
return toReturn;
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
function onClick(e) {
|
|
914
|
+
var _a;
|
|
915
|
+
if (props.disabled) {
|
|
916
|
+
e.preventDefault();
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onClick) {
|
|
920
|
+
emit("click", e);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
924
|
+
}
|
|
925
|
+
function onMouseover(e) {
|
|
926
|
+
var _a;
|
|
927
|
+
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseover) {
|
|
928
|
+
emit("mouseover", e);
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
932
|
+
}
|
|
933
|
+
function onMouseleave(e) {
|
|
934
|
+
var _a;
|
|
935
|
+
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseleave) {
|
|
936
|
+
emit("mouseleave", e);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
940
|
+
}
|
|
941
|
+
return (_ctx, _cache) => {
|
|
942
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
943
|
+
ref_key: "element",
|
|
944
|
+
ref: element,
|
|
945
|
+
class: {
|
|
946
|
+
active: _ctx.active,
|
|
947
|
+
pressed: unref(pressed),
|
|
948
|
+
disabled: _ctx.disabled,
|
|
949
|
+
current: _ctx.current
|
|
950
|
+
},
|
|
951
|
+
onClickPassive: onClick,
|
|
952
|
+
onMouseoverPassive: onMouseover,
|
|
953
|
+
onMouseleavePassive: onMouseleave
|
|
954
|
+
}), {
|
|
955
|
+
default: withCtx(() => [
|
|
956
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
957
|
+
createTextVNode(
|
|
958
|
+
toDisplayString(_ctx.label),
|
|
959
|
+
1
|
|
960
|
+
/* TEXT */
|
|
961
|
+
)
|
|
962
|
+
])
|
|
963
|
+
]),
|
|
964
|
+
_: 3
|
|
965
|
+
/* FORWARDED */
|
|
966
|
+
}, 16, ["class"]);
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
const VvIconPropsDefaults = {
|
|
971
|
+
prefix: "normal"
|
|
972
|
+
/* normal */
|
|
973
|
+
};
|
|
974
|
+
const __default__$7 = {
|
|
975
|
+
name: "VvIcon"
|
|
976
|
+
};
|
|
977
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
978
|
+
...__default__$7,
|
|
979
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
980
|
+
name: {},
|
|
981
|
+
color: {},
|
|
982
|
+
width: {},
|
|
983
|
+
height: {},
|
|
984
|
+
provider: {},
|
|
985
|
+
prefix: {},
|
|
986
|
+
src: {},
|
|
987
|
+
horizontalFlip: { type: Boolean },
|
|
988
|
+
verticalFlip: { type: Boolean },
|
|
989
|
+
flip: {},
|
|
990
|
+
mode: {},
|
|
991
|
+
inline: { type: Boolean },
|
|
992
|
+
rotate: {},
|
|
993
|
+
onLoad: { type: Function },
|
|
994
|
+
svg: {},
|
|
995
|
+
modifiers: {}
|
|
996
|
+
}, VvIconPropsDefaults),
|
|
997
|
+
setup(__props) {
|
|
998
|
+
const props = __props;
|
|
999
|
+
const hasRotate = computed(() => {
|
|
1000
|
+
if (typeof props.rotate === "string") {
|
|
1001
|
+
return Number.parseFloat(props.rotate);
|
|
1002
|
+
}
|
|
1003
|
+
return props.rotate;
|
|
1004
|
+
});
|
|
1005
|
+
const show = ref(true);
|
|
1006
|
+
const volver = useVolver();
|
|
1007
|
+
const { modifiers } = toRefs(props);
|
|
1008
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
1009
|
+
const provider = computed(() => {
|
|
1010
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
1011
|
+
});
|
|
1012
|
+
const icon = computed(() => {
|
|
1013
|
+
const name = props.name ?? "";
|
|
1014
|
+
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
1015
|
+
if (iconExists(iconName)) {
|
|
1016
|
+
return iconName;
|
|
1017
|
+
}
|
|
1018
|
+
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
1019
|
+
(iconsCollection2) => {
|
|
1020
|
+
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
1021
|
+
return iconExists(icon2);
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
if (iconsCollection) {
|
|
1025
|
+
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
1026
|
+
}
|
|
1027
|
+
return name;
|
|
1028
|
+
});
|
|
1029
|
+
function getSvgContent(svg) {
|
|
1030
|
+
let dom;
|
|
1031
|
+
if (typeof window === "undefined") {
|
|
1032
|
+
const { JSDOM } = require("jsdom");
|
|
1033
|
+
dom = new JSDOM().window;
|
|
1034
|
+
}
|
|
1035
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
1036
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
1037
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
1038
|
+
return svgEl;
|
|
1039
|
+
}
|
|
1040
|
+
function addIconFromSvg(svg) {
|
|
1041
|
+
const svgContentEl = getSvgContent(svg);
|
|
1042
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
1043
|
+
if (svgContentEl && svgContent) {
|
|
1044
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
1045
|
+
body: svgContent,
|
|
1046
|
+
// Set height and width from svg content
|
|
1047
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
1048
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
if (volver) {
|
|
1053
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
1054
|
+
show.value = false;
|
|
1055
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
1056
|
+
if (svg) {
|
|
1057
|
+
addIconFromSvg(svg);
|
|
1058
|
+
show.value = true;
|
|
1059
|
+
}
|
|
1060
|
+
}).catch((e) => {
|
|
1061
|
+
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
if (props.svg) {
|
|
1066
|
+
addIconFromSvg(props.svg);
|
|
1067
|
+
}
|
|
1068
|
+
return (_ctx, _cache) => {
|
|
1069
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
1070
|
+
key: 0,
|
|
1071
|
+
class: unref(bemCssClasses)
|
|
1072
|
+
}, {
|
|
1073
|
+
inline: _ctx.inline,
|
|
1074
|
+
width: _ctx.width,
|
|
1075
|
+
height: _ctx.height,
|
|
1076
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
1077
|
+
verticalFlip: _ctx.verticalFlip,
|
|
1078
|
+
flip: _ctx.flip,
|
|
1079
|
+
rotate: unref(hasRotate),
|
|
1080
|
+
color: _ctx.color,
|
|
1081
|
+
onLoad: _ctx.onLoad,
|
|
1082
|
+
icon: unref(icon)
|
|
1083
|
+
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
function useUniqueId(id) {
|
|
1088
|
+
return computed(() => String((id == null ? void 0 : id.value) || useId()));
|
|
1089
|
+
}
|
|
1090
|
+
function useComponentIcon(icon, iconPosition) {
|
|
1091
|
+
const hasIcon = computed(() => {
|
|
1092
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
1093
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
1094
|
+
}
|
|
1095
|
+
return icon == null ? void 0 : icon.value;
|
|
1096
|
+
});
|
|
1097
|
+
const hasIconBefore = computed(
|
|
1098
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
1099
|
+
);
|
|
1100
|
+
const hasIconAfter = computed(
|
|
1101
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
1102
|
+
);
|
|
1103
|
+
const hasIconLeft = computed(
|
|
1104
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
1105
|
+
);
|
|
1106
|
+
const hasIconRight = computed(
|
|
1107
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
1108
|
+
);
|
|
1109
|
+
const hasIconTop = computed(
|
|
1110
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
1111
|
+
);
|
|
1112
|
+
const hasIconBottom = computed(
|
|
1113
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
1114
|
+
);
|
|
1115
|
+
return {
|
|
1116
|
+
hasIcon,
|
|
1117
|
+
hasIconLeft,
|
|
1118
|
+
hasIconRight,
|
|
1119
|
+
hasIconTop,
|
|
1120
|
+
hasIconBottom,
|
|
1121
|
+
hasIconBefore,
|
|
1122
|
+
hasIconAfter
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
const _hoisted_1$5 = {
|
|
1126
|
+
key: 1,
|
|
1127
|
+
class: "vv-button__label"
|
|
1128
|
+
};
|
|
1129
|
+
const _hoisted_2$2 = {
|
|
1130
|
+
key: 1,
|
|
1131
|
+
class: "vv-button__label"
|
|
1132
|
+
};
|
|
1133
|
+
const __default__$6 = {
|
|
1134
|
+
name: "VvButton",
|
|
1135
|
+
inheritAttrs: false
|
|
1136
|
+
};
|
|
1137
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1138
|
+
...__default__$6,
|
|
1139
|
+
props: VvButtonProps,
|
|
1140
|
+
emits: VvButtonEvents,
|
|
1141
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1142
|
+
const props = __props;
|
|
1143
|
+
const emit = __emit;
|
|
1144
|
+
const attrs = useAttrs();
|
|
1145
|
+
const slots = useSlots();
|
|
1146
|
+
const {
|
|
1147
|
+
id,
|
|
1148
|
+
modifiers,
|
|
1149
|
+
iconPosition,
|
|
1150
|
+
icon,
|
|
1151
|
+
label,
|
|
1152
|
+
modelValue,
|
|
1153
|
+
disabled,
|
|
1154
|
+
toggle,
|
|
1155
|
+
unselectable
|
|
1156
|
+
} = useGroupProps(props, emit);
|
|
1157
|
+
const hasId = useUniqueId(id);
|
|
1158
|
+
const name = computed(() => (attrs == null ? void 0 : attrs.name) || hasId.value);
|
|
1159
|
+
const element = ref(null);
|
|
1160
|
+
const $el = computed(() => {
|
|
1161
|
+
var _a;
|
|
1162
|
+
return (_a = element.value) == null ? void 0 : _a.$el;
|
|
1163
|
+
});
|
|
1164
|
+
__expose({ $el });
|
|
1165
|
+
const pressed = computed(() => {
|
|
1166
|
+
if (!toggle.value) {
|
|
1167
|
+
return props.pressed;
|
|
1168
|
+
}
|
|
1169
|
+
if (Array.isArray(modelValue.value)) {
|
|
1170
|
+
return contains(name.value, modelValue.value);
|
|
1171
|
+
}
|
|
1172
|
+
return equals(name.value, modelValue.value);
|
|
1173
|
+
});
|
|
1174
|
+
const bemCssClasses = useModifiers(
|
|
1175
|
+
"vv-button",
|
|
1176
|
+
modifiers,
|
|
1177
|
+
computed(() => ({
|
|
1178
|
+
"reverse": [Side.right, Side.bottom].includes(
|
|
1179
|
+
iconPosition.value
|
|
1180
|
+
),
|
|
1181
|
+
"column": [Side.top, Side.bottom].includes(
|
|
1182
|
+
iconPosition.value
|
|
1183
|
+
),
|
|
1184
|
+
"icon-only": Boolean(
|
|
1185
|
+
(icon == null ? void 0 : icon.value) && !(label == null ? void 0 : label.value) && !slots.default
|
|
1186
|
+
)
|
|
1187
|
+
}))
|
|
1188
|
+
);
|
|
1189
|
+
const { hasIcon } = useComponentIcon(icon);
|
|
1190
|
+
const toggleValue = computed(() => {
|
|
1191
|
+
return props.value !== void 0 ? props.value : name.value;
|
|
1192
|
+
});
|
|
1193
|
+
const hasListeners = computed(() => {
|
|
1194
|
+
if (!toggle.value) {
|
|
1195
|
+
return void 0;
|
|
1196
|
+
}
|
|
1197
|
+
return {
|
|
1198
|
+
onClick
|
|
1199
|
+
};
|
|
1200
|
+
});
|
|
1201
|
+
function onClick() {
|
|
1202
|
+
if (toggle.value) {
|
|
1203
|
+
if (Array.isArray(modelValue.value)) {
|
|
1204
|
+
if (contains(toggleValue.value, modelValue.value)) {
|
|
1205
|
+
if (unselectable.value) {
|
|
1206
|
+
modelValue.value = modelValue.value.filter(
|
|
1207
|
+
(n) => n !== toggleValue.value
|
|
1208
|
+
);
|
|
1209
|
+
}
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
modelValue.value.push(toggleValue.value);
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
if (toggleValue.value === modelValue.value && unselectable.value) {
|
|
1216
|
+
modelValue.value = props.uncheckedValue;
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
modelValue.value = toggleValue.value;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
return (_ctx, _cache) => {
|
|
1223
|
+
return openBlock(), createBlock(_sfc_main$8, mergeProps({
|
|
1224
|
+
...unref(attrs),
|
|
1225
|
+
...unref(hasListeners),
|
|
1226
|
+
disabled: unref(disabled),
|
|
1227
|
+
pressed: unref(pressed),
|
|
1228
|
+
active: _ctx.active,
|
|
1229
|
+
type: _ctx.type,
|
|
1230
|
+
to: _ctx.to,
|
|
1231
|
+
href: _ctx.href,
|
|
1232
|
+
target: _ctx.target,
|
|
1233
|
+
rel: _ctx.rel,
|
|
1234
|
+
ariaLabel: _ctx.ariaLabel
|
|
1235
|
+
}, {
|
|
1236
|
+
id: unref(hasId),
|
|
1237
|
+
ref_key: "element",
|
|
1238
|
+
ref: element,
|
|
1239
|
+
class: unref(bemCssClasses)
|
|
1240
|
+
}), {
|
|
1241
|
+
default: withCtx(() => [
|
|
1242
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1243
|
+
_ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
1244
|
+
_ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$7, {
|
|
1245
|
+
key: 0,
|
|
1246
|
+
class: "vv-button__loading-icon",
|
|
1247
|
+
name: _ctx.loadingIcon
|
|
1248
|
+
}, null, 8, ["name"])) : createCommentVNode("v-if", true),
|
|
1249
|
+
_ctx.loadingLabel ? (openBlock(), createElementBlock(
|
|
1250
|
+
"span",
|
|
1251
|
+
_hoisted_1$5,
|
|
1252
|
+
toDisplayString(_ctx.loadingLabel),
|
|
1253
|
+
1
|
|
1254
|
+
/* TEXT */
|
|
1255
|
+
)) : createCommentVNode("v-if", true)
|
|
1256
|
+
]) : (openBlock(), createElementBlock(
|
|
1257
|
+
Fragment,
|
|
1258
|
+
{ key: 1 },
|
|
1259
|
+
[
|
|
1260
|
+
renderSlot(_ctx.$slots, "before"),
|
|
1261
|
+
unref(hasIcon) ? (openBlock(), createBlock(
|
|
1262
|
+
_sfc_main$7,
|
|
1263
|
+
mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-button__icon" }),
|
|
1264
|
+
null,
|
|
1265
|
+
16
|
|
1266
|
+
/* FULL_PROPS */
|
|
1267
|
+
)) : createCommentVNode("v-if", true),
|
|
1268
|
+
unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2$2, [
|
|
1269
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
1270
|
+
createTextVNode(
|
|
1271
|
+
toDisplayString(unref(label)),
|
|
1272
|
+
1
|
|
1273
|
+
/* TEXT */
|
|
1274
|
+
)
|
|
1275
|
+
])
|
|
1276
|
+
])) : createCommentVNode("v-if", true),
|
|
1277
|
+
renderSlot(_ctx.$slots, "after")
|
|
1278
|
+
],
|
|
1279
|
+
64
|
|
1280
|
+
/* STABLE_FRAGMENT */
|
|
1281
|
+
))
|
|
1282
|
+
])
|
|
1283
|
+
]),
|
|
1284
|
+
_: 3
|
|
1285
|
+
/* FORWARDED */
|
|
1286
|
+
}, 16, ["id", "class"]);
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
const VvDropdownProps = {
|
|
1291
|
+
...IdProps,
|
|
1292
|
+
...DropdownProps,
|
|
1293
|
+
...ModifiersProps,
|
|
1294
|
+
/**
|
|
1295
|
+
* Show / hide dropdown programmatically
|
|
765
1296
|
*/
|
|
766
1297
|
modelValue: {
|
|
767
1298
|
type: Boolean,
|
|
@@ -783,8 +1314,32 @@ const VvDropdownProps = {
|
|
|
783
1314
|
validator: (value) => Object.values(DropdownRole).includes(value)
|
|
784
1315
|
}
|
|
785
1316
|
};
|
|
786
|
-
const
|
|
787
|
-
|
|
1317
|
+
const VvDropdownItemProps = {
|
|
1318
|
+
focusOnHover: {
|
|
1319
|
+
type: Boolean,
|
|
1320
|
+
default: false
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
const VvDropdownOptionProps = {
|
|
1324
|
+
...DisabledProps,
|
|
1325
|
+
...SelectedProps,
|
|
1326
|
+
...UnselectableProps,
|
|
1327
|
+
...ModifiersProps,
|
|
1328
|
+
deselectHintLabel: {
|
|
1329
|
+
type: String
|
|
1330
|
+
},
|
|
1331
|
+
selectHintLabel: {
|
|
1332
|
+
type: String
|
|
1333
|
+
},
|
|
1334
|
+
selectedHintLabel: {
|
|
1335
|
+
type: String
|
|
1336
|
+
},
|
|
1337
|
+
focusOnHover: {
|
|
1338
|
+
type: Boolean,
|
|
1339
|
+
default: false
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
function useDropdownProvideTrigger({
|
|
788
1343
|
reference,
|
|
789
1344
|
id,
|
|
790
1345
|
expanded,
|
|
@@ -812,20 +1367,20 @@ function useProvideDropdownTrigger({
|
|
|
812
1367
|
component
|
|
813
1368
|
};
|
|
814
1369
|
}
|
|
815
|
-
function
|
|
1370
|
+
function useDropdownProvideItem({
|
|
816
1371
|
role,
|
|
817
|
-
|
|
1372
|
+
...others
|
|
818
1373
|
}) {
|
|
819
1374
|
const itemRole = computed(
|
|
820
1375
|
() => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
|
|
821
1376
|
);
|
|
822
1377
|
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
823
1378
|
role: itemRole,
|
|
824
|
-
|
|
1379
|
+
...others
|
|
825
1380
|
});
|
|
826
1381
|
return { itemRole };
|
|
827
1382
|
}
|
|
828
|
-
function
|
|
1383
|
+
function useDropdownProvideAction({
|
|
829
1384
|
expanded
|
|
830
1385
|
}) {
|
|
831
1386
|
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
@@ -833,16 +1388,18 @@ function useProvideDropdownAction({
|
|
|
833
1388
|
expanded
|
|
834
1389
|
});
|
|
835
1390
|
}
|
|
836
|
-
const _hoisted_1$
|
|
837
|
-
const __default__$
|
|
1391
|
+
const _hoisted_1$4 = ["id", "tabindex", "role", "aria-labelledby"];
|
|
1392
|
+
const __default__$5 = {
|
|
838
1393
|
name: "VvDropdown",
|
|
839
1394
|
inheritAttrs: false
|
|
840
1395
|
};
|
|
841
|
-
const _sfc_main$
|
|
842
|
-
...__default__$
|
|
1396
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1397
|
+
...__default__$5,
|
|
843
1398
|
props: VvDropdownProps,
|
|
844
1399
|
emits: [
|
|
845
1400
|
"update:modelValue",
|
|
1401
|
+
"beforeEnter",
|
|
1402
|
+
"afterLeave",
|
|
846
1403
|
"beforeExpand",
|
|
847
1404
|
"beforeCollapse",
|
|
848
1405
|
"afterExpand",
|
|
@@ -850,23 +1407,24 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
850
1407
|
"before-enter",
|
|
851
1408
|
"after-leave",
|
|
852
1409
|
"enter",
|
|
853
|
-
"
|
|
854
|
-
"
|
|
855
|
-
"
|
|
1410
|
+
"afterEnter",
|
|
1411
|
+
"enterCancelled",
|
|
1412
|
+
"beforeLeave",
|
|
856
1413
|
"leave",
|
|
857
|
-
"
|
|
1414
|
+
"leaveCancelled"
|
|
858
1415
|
],
|
|
859
|
-
setup(__props, { expose: __expose, emit }) {
|
|
1416
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
860
1417
|
const props = __props;
|
|
1418
|
+
const emit = __emit;
|
|
861
1419
|
const { id } = toRefs(props);
|
|
862
1420
|
const hasId = useUniqueId(id);
|
|
863
1421
|
const attrs = useAttrs();
|
|
864
1422
|
const maxWidth = ref("auto");
|
|
865
1423
|
const maxHeight = ref("auto");
|
|
866
|
-
const localReferenceEl = ref(
|
|
1424
|
+
const localReferenceEl = ref();
|
|
867
1425
|
const floatingEl = ref();
|
|
868
|
-
const arrowEl = ref(
|
|
869
|
-
const listEl = ref(
|
|
1426
|
+
const arrowEl = ref();
|
|
1427
|
+
const listEl = ref();
|
|
870
1428
|
const referenceEl = computed({
|
|
871
1429
|
get: () => props.reference ?? localReferenceEl.value,
|
|
872
1430
|
set: (newValue) => {
|
|
@@ -1012,18 +1570,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1012
1570
|
modelValue.value = newValue;
|
|
1013
1571
|
}
|
|
1014
1572
|
});
|
|
1015
|
-
|
|
1573
|
+
function show() {
|
|
1016
1574
|
expanded.value = true;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1575
|
+
}
|
|
1576
|
+
function hide() {
|
|
1019
1577
|
expanded.value = false;
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1578
|
+
}
|
|
1579
|
+
function toggle() {
|
|
1022
1580
|
expanded.value = !expanded.value;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1581
|
+
}
|
|
1582
|
+
function init(el) {
|
|
1025
1583
|
referenceEl.value = el;
|
|
1026
|
-
}
|
|
1584
|
+
}
|
|
1027
1585
|
__expose({
|
|
1028
1586
|
toggle,
|
|
1029
1587
|
show,
|
|
@@ -1063,7 +1621,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1063
1621
|
"aria-haspopup": true,
|
|
1064
1622
|
"aria-expanded": expanded.value
|
|
1065
1623
|
}));
|
|
1066
|
-
const { component: VvDropdownTriggerProvider, bus } =
|
|
1624
|
+
const { component: VvDropdownTriggerProvider, bus } = useDropdownProvideTrigger({
|
|
1067
1625
|
reference: referenceEl,
|
|
1068
1626
|
id: hasId,
|
|
1069
1627
|
expanded,
|
|
@@ -1071,7 +1629,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1071
1629
|
});
|
|
1072
1630
|
bus.on("click", toggle);
|
|
1073
1631
|
const { role, modifiers } = toRefs(props);
|
|
1074
|
-
const { itemRole } = useProvideDropdownItem({ role, expanded });
|
|
1075
1632
|
const bemCssClasses = useModifiers(
|
|
1076
1633
|
"vv-dropdown",
|
|
1077
1634
|
modifiers,
|
|
@@ -1092,7 +1649,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1092
1649
|
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
1093
1650
|
);
|
|
1094
1651
|
}
|
|
1095
|
-
|
|
1652
|
+
function focusNext() {
|
|
1096
1653
|
nextTick(() => {
|
|
1097
1654
|
if (focused.value) {
|
|
1098
1655
|
const focusableElements = getKeyboardFocusableElements(
|
|
@@ -1115,8 +1672,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1115
1672
|
}
|
|
1116
1673
|
}
|
|
1117
1674
|
});
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1675
|
+
}
|
|
1676
|
+
function focusPrev() {
|
|
1120
1677
|
nextTick(() => {
|
|
1121
1678
|
if (focused.value) {
|
|
1122
1679
|
const focusableElements = getKeyboardFocusableElements(
|
|
@@ -1139,7 +1696,14 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1139
1696
|
}
|
|
1140
1697
|
}
|
|
1141
1698
|
});
|
|
1142
|
-
}
|
|
1699
|
+
}
|
|
1700
|
+
const hovered = useElementHover(floatingEl);
|
|
1701
|
+
const { itemRole } = useDropdownProvideItem({
|
|
1702
|
+
role,
|
|
1703
|
+
expanded,
|
|
1704
|
+
focused,
|
|
1705
|
+
hovered
|
|
1706
|
+
});
|
|
1143
1707
|
onKeyStroke("Escape", (e) => {
|
|
1144
1708
|
if (expanded.value) {
|
|
1145
1709
|
e.preventDefault();
|
|
@@ -1167,137 +1731,168 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1167
1731
|
const dropdownTransitionHandlers = {
|
|
1168
1732
|
"before-enter": () => {
|
|
1169
1733
|
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
1170
|
-
emit("
|
|
1734
|
+
emit("beforeEnter");
|
|
1171
1735
|
},
|
|
1172
1736
|
"after-leave": () => {
|
|
1173
1737
|
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
1174
|
-
emit("
|
|
1738
|
+
emit("afterLeave");
|
|
1175
1739
|
},
|
|
1176
|
-
enter: () => {
|
|
1740
|
+
"enter": () => {
|
|
1177
1741
|
emit("enter");
|
|
1178
1742
|
},
|
|
1179
1743
|
"after-enter": () => {
|
|
1180
|
-
emit("
|
|
1744
|
+
emit("afterEnter");
|
|
1181
1745
|
},
|
|
1182
1746
|
"enter-cancelled": () => {
|
|
1183
|
-
emit("
|
|
1747
|
+
emit("enterCancelled");
|
|
1184
1748
|
},
|
|
1185
1749
|
"before-leave": () => {
|
|
1186
|
-
emit("
|
|
1750
|
+
emit("beforeLeave");
|
|
1187
1751
|
},
|
|
1188
|
-
leave: () => {
|
|
1752
|
+
"leave": () => {
|
|
1189
1753
|
emit("leave");
|
|
1190
1754
|
},
|
|
1191
1755
|
"leave-cancelled": () => {
|
|
1192
|
-
emit("
|
|
1756
|
+
emit("leaveCancelled");
|
|
1193
1757
|
}
|
|
1194
1758
|
};
|
|
1195
1759
|
return (_ctx, _cache) => {
|
|
1196
|
-
return openBlock(), createElementBlock(
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1760
|
+
return openBlock(), createElementBlock(
|
|
1761
|
+
Fragment,
|
|
1762
|
+
null,
|
|
1763
|
+
[
|
|
1764
|
+
createVNode(unref(VvDropdownTriggerProvider), null, {
|
|
1765
|
+
default: withCtx(() => [
|
|
1766
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
|
|
1767
|
+
]),
|
|
1768
|
+
_: 3
|
|
1769
|
+
/* FORWARDED */
|
|
1770
|
+
}),
|
|
1771
|
+
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers), { persisted: "" }), {
|
|
1772
|
+
default: withCtx(() => [
|
|
1773
|
+
withDirectives(createElementVNode(
|
|
1774
|
+
"div",
|
|
1775
|
+
{
|
|
1776
|
+
ref_key: "floatingEl",
|
|
1777
|
+
ref: floatingEl,
|
|
1778
|
+
style: normalizeStyle(unref(dropdownPlacement)),
|
|
1779
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
1780
|
+
},
|
|
1781
|
+
[
|
|
1782
|
+
props.arrow ? (openBlock(), createElementBlock(
|
|
1783
|
+
"div",
|
|
1784
|
+
{
|
|
1785
|
+
key: 0,
|
|
1786
|
+
ref_key: "arrowEl",
|
|
1787
|
+
ref: arrowEl,
|
|
1788
|
+
style: normalizeStyle(unref(arrowPlacement)),
|
|
1789
|
+
class: "vv-dropdown__arrow"
|
|
1790
|
+
},
|
|
1791
|
+
null,
|
|
1792
|
+
4
|
|
1793
|
+
/* STYLE */
|
|
1794
|
+
)) : createCommentVNode("v-if", true),
|
|
1795
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
|
|
1796
|
+
createElementVNode("div", mergeProps(unref(attrs), {
|
|
1797
|
+
id: unref(hasId),
|
|
1798
|
+
ref_key: "listEl",
|
|
1799
|
+
ref: listEl,
|
|
1800
|
+
tabindex: !unref(expanded) ? -1 : void 0,
|
|
1801
|
+
role: unref(role),
|
|
1802
|
+
"aria-labelledby": unref(hasAriaLabelledby),
|
|
1803
|
+
class: "vv-dropdown__list"
|
|
1804
|
+
}), [
|
|
1805
|
+
renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
|
|
1806
|
+
role: unref(itemRole)
|
|
1807
|
+
})))
|
|
1808
|
+
], 16, _hoisted_1$4),
|
|
1809
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
|
|
1810
|
+
],
|
|
1811
|
+
6
|
|
1812
|
+
/* CLASS, STYLE */
|
|
1813
|
+
), [
|
|
1814
|
+
[vShow, unref(expanded)]
|
|
1815
|
+
])
|
|
1816
|
+
]),
|
|
1817
|
+
_: 3
|
|
1818
|
+
/* FORWARDED */
|
|
1819
|
+
}, 16, ["name"])
|
|
1820
|
+
],
|
|
1821
|
+
64
|
|
1822
|
+
/* STABLE_FRAGMENT */
|
|
1823
|
+
);
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1827
|
+
const _hoisted_1$3 = {
|
|
1828
|
+
class: "vv-dropdown-optgroup",
|
|
1829
|
+
role: "presentation",
|
|
1830
|
+
tabindex: "-1"
|
|
1831
|
+
};
|
|
1832
|
+
const __default__$4 = {
|
|
1833
|
+
name: "VvDropdownOptgroup"
|
|
1834
|
+
};
|
|
1835
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1836
|
+
...__default__$4,
|
|
1837
|
+
props: {
|
|
1838
|
+
...LabelProps
|
|
1839
|
+
},
|
|
1840
|
+
setup(__props) {
|
|
1841
|
+
const props = __props;
|
|
1842
|
+
return (_ctx, _cache) => {
|
|
1843
|
+
return openBlock(), createElementBlock(
|
|
1844
|
+
"li",
|
|
1845
|
+
_hoisted_1$3,
|
|
1846
|
+
toDisplayString(props.label),
|
|
1847
|
+
1
|
|
1848
|
+
/* TEXT */
|
|
1849
|
+
);
|
|
1240
1850
|
};
|
|
1241
1851
|
}
|
|
1242
1852
|
});
|
|
1243
|
-
|
|
1244
|
-
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
1245
|
-
}
|
|
1246
|
-
function useInjectedDropdownItem() {
|
|
1247
|
-
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
1248
|
-
}
|
|
1249
|
-
function useInjectedDropdownAction() {
|
|
1250
|
-
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
1251
|
-
}
|
|
1252
|
-
const __default__$7 = {
|
|
1853
|
+
const __default__$3 = {
|
|
1253
1854
|
name: "VvDropdownItem"
|
|
1254
1855
|
};
|
|
1255
|
-
const _sfc_main$
|
|
1256
|
-
...__default__$
|
|
1856
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1857
|
+
...__default__$3,
|
|
1858
|
+
props: VvDropdownItemProps,
|
|
1257
1859
|
setup(__props) {
|
|
1860
|
+
const props = __props;
|
|
1258
1861
|
const { role, expanded } = useInjectedDropdownItem();
|
|
1259
1862
|
const element = ref(null);
|
|
1260
|
-
|
|
1863
|
+
useDropdownProvideAction({ expanded });
|
|
1261
1864
|
const hovered = useElementHover(element);
|
|
1262
1865
|
const { focused } = useFocus(element);
|
|
1263
1866
|
const { focused: focusedWithin } = useFocusWithin(element);
|
|
1264
1867
|
watch(hovered, (newValue) => {
|
|
1265
|
-
if (newValue) {
|
|
1868
|
+
if (newValue && props.focusOnHover) {
|
|
1266
1869
|
focused.value = true;
|
|
1267
1870
|
}
|
|
1268
1871
|
});
|
|
1269
1872
|
return (_ctx, _cache) => {
|
|
1270
|
-
return openBlock(), createElementBlock(
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1873
|
+
return openBlock(), createElementBlock(
|
|
1874
|
+
"div",
|
|
1875
|
+
mergeProps({ role: unref(role) }, {
|
|
1876
|
+
ref_key: "element",
|
|
1877
|
+
ref: element,
|
|
1878
|
+
class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
|
|
1879
|
+
}),
|
|
1880
|
+
[
|
|
1881
|
+
renderSlot(_ctx.$slots, "default")
|
|
1882
|
+
],
|
|
1883
|
+
16
|
|
1884
|
+
/* FULL_PROPS */
|
|
1885
|
+
);
|
|
1277
1886
|
};
|
|
1278
1887
|
}
|
|
1279
1888
|
});
|
|
1280
|
-
const _hoisted_1$
|
|
1281
|
-
const __default__$
|
|
1889
|
+
const _hoisted_1$2 = ["title"];
|
|
1890
|
+
const __default__$2 = {
|
|
1282
1891
|
name: "VvDropdownOption"
|
|
1283
1892
|
};
|
|
1284
|
-
const _sfc_main$
|
|
1285
|
-
...__default__$
|
|
1286
|
-
props:
|
|
1287
|
-
...DisabledProps,
|
|
1288
|
-
...SelectedProps,
|
|
1289
|
-
...UnselectableProps,
|
|
1290
|
-
...ModifiersProps,
|
|
1291
|
-
deselectHintLabel: {
|
|
1292
|
-
type: String
|
|
1293
|
-
},
|
|
1294
|
-
selectHintLabel: {
|
|
1295
|
-
type: String
|
|
1296
|
-
},
|
|
1297
|
-
selectedHintLabel: {
|
|
1298
|
-
type: String
|
|
1299
|
-
}
|
|
1300
|
-
},
|
|
1893
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1894
|
+
...__default__$2,
|
|
1895
|
+
props: VvDropdownOptionProps,
|
|
1301
1896
|
setup(__props) {
|
|
1302
1897
|
const props = __props;
|
|
1303
1898
|
const { modifiers } = toRefs(props);
|
|
@@ -1316,274 +1911,38 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1316
1911
|
}
|
|
1317
1912
|
if (!props.disabled) {
|
|
1318
1913
|
return props.selectHintLabel;
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
"aria-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
};
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
};
|
|
1352
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1353
|
-
...__default__$5,
|
|
1354
|
-
props: {
|
|
1355
|
-
...LabelProps
|
|
1356
|
-
},
|
|
1357
|
-
setup(__props) {
|
|
1358
|
-
const props = __props;
|
|
1359
|
-
return (_ctx, _cache) => {
|
|
1360
|
-
return openBlock(), createElementBlock("li", _hoisted_1$3, toDisplayString(props.label), 1);
|
|
1361
|
-
};
|
|
1362
|
-
}
|
|
1363
|
-
});
|
|
1364
|
-
function equals(obj1, obj2, field) {
|
|
1365
|
-
if (field) {
|
|
1366
|
-
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
1367
|
-
}
|
|
1368
|
-
return deepEquals(obj1, obj2);
|
|
1369
|
-
}
|
|
1370
|
-
function deepEquals(a, b) {
|
|
1371
|
-
if (a === b)
|
|
1372
|
-
return true;
|
|
1373
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
1374
|
-
const arrA = Array.isArray(a);
|
|
1375
|
-
const arrB = Array.isArray(b);
|
|
1376
|
-
let i, length, key;
|
|
1377
|
-
if (arrA && arrB) {
|
|
1378
|
-
length = a.length;
|
|
1379
|
-
if (length != b.length)
|
|
1380
|
-
return false;
|
|
1381
|
-
for (i = length; i-- !== 0; )
|
|
1382
|
-
if (!deepEquals(a[i], b[i]))
|
|
1383
|
-
return false;
|
|
1384
|
-
return true;
|
|
1385
|
-
}
|
|
1386
|
-
if (arrA != arrB)
|
|
1387
|
-
return false;
|
|
1388
|
-
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
1389
|
-
if (dateA != dateB)
|
|
1390
|
-
return false;
|
|
1391
|
-
if (dateA && dateB)
|
|
1392
|
-
return a.getTime() == b.getTime();
|
|
1393
|
-
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
1394
|
-
if (regexpA != regexpB)
|
|
1395
|
-
return false;
|
|
1396
|
-
if (regexpA && regexpB)
|
|
1397
|
-
return a.toString() == b.toString();
|
|
1398
|
-
const keys = Object.keys(a);
|
|
1399
|
-
length = keys.length;
|
|
1400
|
-
if (length !== Object.keys(b).length)
|
|
1401
|
-
return false;
|
|
1402
|
-
for (i = length; i-- !== 0; )
|
|
1403
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
1404
|
-
return false;
|
|
1405
|
-
for (i = length; i-- !== 0; ) {
|
|
1406
|
-
key = keys[i];
|
|
1407
|
-
if (!deepEquals(a[key], b[key]))
|
|
1408
|
-
return false;
|
|
1409
|
-
}
|
|
1410
|
-
return true;
|
|
1411
|
-
}
|
|
1412
|
-
return a !== a && b !== b;
|
|
1413
|
-
}
|
|
1414
|
-
function resolveFieldData(data, field) {
|
|
1415
|
-
if (data && Object.keys(data).length && field) {
|
|
1416
|
-
if (field.indexOf(".") === -1) {
|
|
1417
|
-
return data[field];
|
|
1418
|
-
} else {
|
|
1419
|
-
const fields = field.split(".");
|
|
1420
|
-
let value = data;
|
|
1421
|
-
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
1422
|
-
if (data == null) {
|
|
1423
|
-
return null;
|
|
1424
|
-
}
|
|
1425
|
-
value = value[fields[i]];
|
|
1426
|
-
}
|
|
1427
|
-
return value;
|
|
1428
|
-
}
|
|
1429
|
-
} else {
|
|
1430
|
-
return null;
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
function findIndexInList(value, list) {
|
|
1434
|
-
let index = -1;
|
|
1435
|
-
if (list) {
|
|
1436
|
-
for (let i = 0; i < list.length; i++) {
|
|
1437
|
-
if (equals(list[i], value)) {
|
|
1438
|
-
index = i;
|
|
1439
|
-
break;
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
return index;
|
|
1444
|
-
}
|
|
1445
|
-
function contains(value, list) {
|
|
1446
|
-
if (value != null && list && list.length) {
|
|
1447
|
-
for (const val of list) {
|
|
1448
|
-
if (equals(value, val)) {
|
|
1449
|
-
return true;
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
return false;
|
|
1454
|
-
}
|
|
1455
|
-
function isEmpty(value) {
|
|
1456
|
-
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
1457
|
-
}
|
|
1458
|
-
function removeFromList(value, list) {
|
|
1459
|
-
const indexElToRemove = findIndexInList(value, list);
|
|
1460
|
-
if (indexElToRemove > -1) {
|
|
1461
|
-
return list.filter((el, elIndex) => elIndex !== indexElToRemove);
|
|
1462
|
-
} else {
|
|
1463
|
-
return list;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
function isString(value) {
|
|
1467
|
-
return typeof value === "string" || value instanceof String;
|
|
1468
|
-
}
|
|
1469
|
-
function joinLines(items) {
|
|
1470
|
-
if (Array.isArray(items)) {
|
|
1471
|
-
return items.filter((item) => isString(item)).join(" ");
|
|
1472
|
-
}
|
|
1473
|
-
return items;
|
|
1474
|
-
}
|
|
1475
|
-
function HintSlotFactory(propsOrRef, slots) {
|
|
1476
|
-
const props = computed(() => {
|
|
1477
|
-
if (isRef(propsOrRef)) {
|
|
1478
|
-
return propsOrRef.value;
|
|
1479
|
-
}
|
|
1480
|
-
return propsOrRef;
|
|
1481
|
-
});
|
|
1482
|
-
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
1483
|
-
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
1484
|
-
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
1485
|
-
const hintLabel = computed(() => props.value.hintLabel);
|
|
1486
|
-
const hasLoadingLabelOrSlot = computed(
|
|
1487
|
-
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
1488
|
-
);
|
|
1489
|
-
const hasInvalidLabelOrSlot = computed(
|
|
1490
|
-
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
1491
|
-
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
1492
|
-
)
|
|
1493
|
-
);
|
|
1494
|
-
const hasValidLabelOrSlot = computed(
|
|
1495
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
1496
|
-
);
|
|
1497
|
-
const hasHintLabelOrSlot = computed(
|
|
1498
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
1499
|
-
);
|
|
1500
|
-
const isVisible = computed(
|
|
1501
|
-
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
1502
|
-
);
|
|
1503
|
-
const hintSlotScope = computed(() => ({
|
|
1504
|
-
modelValue: props.value.modelValue,
|
|
1505
|
-
valid: props.value.valid,
|
|
1506
|
-
invalid: props.value.invalid,
|
|
1507
|
-
loading: props.value.loading
|
|
1508
|
-
}));
|
|
1509
|
-
const HintSlot = defineComponent({
|
|
1510
|
-
name: "HintSlot",
|
|
1511
|
-
props: {
|
|
1512
|
-
tag: {
|
|
1513
|
-
type: String,
|
|
1514
|
-
default: "small"
|
|
1515
|
-
}
|
|
1516
|
-
},
|
|
1517
|
-
setup() {
|
|
1518
|
-
return {
|
|
1519
|
-
isVisible,
|
|
1520
|
-
invalidLabel,
|
|
1521
|
-
validLabel,
|
|
1522
|
-
loadingLabel,
|
|
1523
|
-
hintLabel,
|
|
1524
|
-
hasInvalidLabelOrSlot,
|
|
1525
|
-
hasValidLabelOrSlot,
|
|
1526
|
-
hasLoadingLabelOrSlot,
|
|
1527
|
-
hasHintLabelOrSlot
|
|
1528
|
-
};
|
|
1529
|
-
},
|
|
1530
|
-
render() {
|
|
1531
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1532
|
-
if (this.isVisible) {
|
|
1533
|
-
let role;
|
|
1534
|
-
if (this.hasInvalidLabelOrSlot) {
|
|
1535
|
-
role = "alert";
|
|
1536
|
-
}
|
|
1537
|
-
if (this.hasValidLabelOrSlot) {
|
|
1538
|
-
role = "status";
|
|
1539
|
-
}
|
|
1540
|
-
if (this.hasLoadingLabelOrSlot) {
|
|
1541
|
-
return h(
|
|
1542
|
-
this.tag,
|
|
1543
|
-
{
|
|
1544
|
-
role
|
|
1545
|
-
},
|
|
1546
|
-
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
1547
|
-
);
|
|
1548
|
-
}
|
|
1549
|
-
if (this.hasInvalidLabelOrSlot) {
|
|
1550
|
-
return h(
|
|
1551
|
-
this.tag,
|
|
1552
|
-
{
|
|
1553
|
-
role
|
|
1554
|
-
},
|
|
1555
|
-
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
1556
|
-
);
|
|
1557
|
-
}
|
|
1558
|
-
if (this.hasValidLabelOrSlot) {
|
|
1559
|
-
return h(
|
|
1560
|
-
this.tag,
|
|
1561
|
-
{
|
|
1562
|
-
role
|
|
1563
|
-
},
|
|
1564
|
-
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
1565
|
-
);
|
|
1566
|
-
}
|
|
1567
|
-
return h(
|
|
1568
|
-
this.tag,
|
|
1569
|
-
{
|
|
1570
|
-
role
|
|
1571
|
-
},
|
|
1572
|
-
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
1573
|
-
);
|
|
1574
|
-
}
|
|
1575
|
-
return null;
|
|
1576
|
-
}
|
|
1577
|
-
});
|
|
1578
|
-
return {
|
|
1579
|
-
hasInvalidLabelOrSlot,
|
|
1580
|
-
hasHintLabelOrSlot,
|
|
1581
|
-
hasValidLabelOrSlot,
|
|
1582
|
-
hasLoadingLabelOrSlot,
|
|
1583
|
-
hintSlotScope,
|
|
1584
|
-
HintSlot
|
|
1585
|
-
};
|
|
1586
|
-
}
|
|
1914
|
+
}
|
|
1915
|
+
return "";
|
|
1916
|
+
});
|
|
1917
|
+
return (_ctx, _cache) => {
|
|
1918
|
+
return openBlock(), createBlock(_sfc_main$3, {
|
|
1919
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
1920
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
1921
|
+
"aria-selected": _ctx.selected,
|
|
1922
|
+
"aria-disabled": _ctx.disabled,
|
|
1923
|
+
"focus-on-hover": _ctx.focusOnHover
|
|
1924
|
+
}, {
|
|
1925
|
+
default: withCtx(() => [
|
|
1926
|
+
renderSlot(_ctx.$slots, "default"),
|
|
1927
|
+
createElementVNode("span", {
|
|
1928
|
+
class: "vv-dropdown-option__hint",
|
|
1929
|
+
title: unref(hintLabel)
|
|
1930
|
+
}, [
|
|
1931
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
|
|
1932
|
+
createTextVNode(
|
|
1933
|
+
toDisplayString(unref(hintLabel)),
|
|
1934
|
+
1
|
|
1935
|
+
/* TEXT */
|
|
1936
|
+
)
|
|
1937
|
+
])
|
|
1938
|
+
], 8, _hoisted_1$2)
|
|
1939
|
+
]),
|
|
1940
|
+
_: 3
|
|
1941
|
+
/* FORWARDED */
|
|
1942
|
+
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1587
1946
|
const VvSelectProps = {
|
|
1588
1947
|
...IdNameProps,
|
|
1589
1948
|
...AutofocusProps,
|
|
@@ -1627,12 +1986,28 @@ const VvSelectProps = {
|
|
|
1627
1986
|
type: [String, Number, Boolean, Object, Array],
|
|
1628
1987
|
default: void 0
|
|
1629
1988
|
},
|
|
1989
|
+
/**
|
|
1990
|
+
* Select first option automatically
|
|
1991
|
+
*/
|
|
1992
|
+
autoselectFirst: {
|
|
1993
|
+
type: Boolean,
|
|
1994
|
+
default: false
|
|
1995
|
+
},
|
|
1630
1996
|
/**
|
|
1631
1997
|
* Select placeholder
|
|
1632
1998
|
*/
|
|
1633
1999
|
placeholder: String
|
|
1634
2000
|
};
|
|
1635
|
-
|
|
2001
|
+
function useVvSelectProps() {
|
|
2002
|
+
return {
|
|
2003
|
+
...VvSelectProps,
|
|
2004
|
+
options: {
|
|
2005
|
+
...VvSelectProps.options,
|
|
2006
|
+
type: Array,
|
|
2007
|
+
default: () => []
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
1636
2011
|
function useDefaults(componentName, propsDefinition, props) {
|
|
1637
2012
|
const volver = useVolver();
|
|
1638
2013
|
const volverComponentDefaults = computed(() => {
|
|
@@ -1695,64 +2070,45 @@ function useComponentFocus(inputTemplateRef, emit) {
|
|
|
1695
2070
|
focused
|
|
1696
2071
|
};
|
|
1697
2072
|
}
|
|
1698
|
-
function useComponentIcon(icon, iconPosition) {
|
|
1699
|
-
const hasIconBefore = computed(
|
|
1700
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
|
|
1701
|
-
);
|
|
1702
|
-
const hasIconAfter = computed(
|
|
1703
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
|
|
1704
|
-
);
|
|
1705
|
-
const hasIconLeft = computed(
|
|
1706
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
|
|
1707
|
-
);
|
|
1708
|
-
const hasIconRight = computed(
|
|
1709
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
|
|
1710
|
-
);
|
|
1711
|
-
const hasIconTop = computed(
|
|
1712
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
|
|
1713
|
-
);
|
|
1714
|
-
const hasIconBottom = computed(
|
|
1715
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
|
|
1716
|
-
);
|
|
1717
|
-
const hasIcon = computed(() => {
|
|
1718
|
-
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
1719
|
-
return { name: icon == null ? void 0 : icon.value };
|
|
1720
|
-
}
|
|
1721
|
-
return icon == null ? void 0 : icon.value;
|
|
1722
|
-
});
|
|
1723
|
-
return {
|
|
1724
|
-
hasIcon,
|
|
1725
|
-
hasIconLeft,
|
|
1726
|
-
hasIconRight,
|
|
1727
|
-
hasIconTop,
|
|
1728
|
-
hasIconBottom,
|
|
1729
|
-
hasIconBefore,
|
|
1730
|
-
hasIconAfter
|
|
1731
|
-
};
|
|
1732
|
-
}
|
|
1733
2073
|
function useOptions(props) {
|
|
1734
2074
|
const { options, labelKey, valueKey, disabledKey } = toRefs(props);
|
|
1735
2075
|
const getOptionLabel = (option) => {
|
|
1736
|
-
if (typeof option
|
|
2076
|
+
if (typeof option === "string") {
|
|
1737
2077
|
return option;
|
|
2078
|
+
}
|
|
2079
|
+
if (typeof labelKey.value === "function") {
|
|
2080
|
+
return labelKey.value(option);
|
|
2081
|
+
}
|
|
1738
2082
|
return String(
|
|
1739
|
-
|
|
2083
|
+
labelKey.value ? get(option, labelKey.value) : option
|
|
1740
2084
|
);
|
|
1741
2085
|
};
|
|
1742
2086
|
const getOptionValue = (option) => {
|
|
1743
|
-
if (typeof option
|
|
2087
|
+
if (typeof option === "string") {
|
|
1744
2088
|
return option;
|
|
1745
|
-
|
|
2089
|
+
}
|
|
2090
|
+
if (typeof valueKey.value === "function") {
|
|
2091
|
+
return valueKey.value(option);
|
|
2092
|
+
}
|
|
2093
|
+
return valueKey.value ? get(option, valueKey.value) : option;
|
|
1746
2094
|
};
|
|
1747
2095
|
const isOptionDisabled = (option) => {
|
|
1748
|
-
if (typeof option
|
|
2096
|
+
if (typeof option === "string") {
|
|
1749
2097
|
return false;
|
|
1750
|
-
|
|
2098
|
+
}
|
|
2099
|
+
if (typeof disabledKey.value === "function") {
|
|
2100
|
+
return disabledKey.value(option);
|
|
2101
|
+
}
|
|
2102
|
+
return disabledKey.value ? get(option, disabledKey.value) : false;
|
|
1751
2103
|
};
|
|
1752
2104
|
const getOptionGrouped = (option) => {
|
|
1753
|
-
if (typeof option
|
|
2105
|
+
if (typeof option == "string") {
|
|
1754
2106
|
return [];
|
|
1755
|
-
|
|
2107
|
+
}
|
|
2108
|
+
if (typeof option === "object" && option && "options" in option) {
|
|
2109
|
+
return option.options;
|
|
2110
|
+
}
|
|
2111
|
+
return [];
|
|
1756
2112
|
};
|
|
1757
2113
|
return {
|
|
1758
2114
|
options,
|
|
@@ -1762,8 +2118,8 @@ function useOptions(props) {
|
|
|
1762
2118
|
getOptionGrouped
|
|
1763
2119
|
};
|
|
1764
2120
|
}
|
|
1765
|
-
const _hoisted_1$
|
|
1766
|
-
const _hoisted_2$
|
|
2121
|
+
const _hoisted_1$1 = ["for"];
|
|
2122
|
+
const _hoisted_2$1 = { class: "vv-select__wrapper" };
|
|
1767
2123
|
const _hoisted_3$1 = {
|
|
1768
2124
|
key: 0,
|
|
1769
2125
|
class: "vv-select__input-before"
|
|
@@ -1778,28 +2134,38 @@ const _hoisted_10 = {
|
|
|
1778
2134
|
key: 1,
|
|
1779
2135
|
class: "vv-select__input-after"
|
|
1780
2136
|
};
|
|
1781
|
-
const __default__$
|
|
2137
|
+
const __default__$1 = {
|
|
1782
2138
|
name: "VvSelect"
|
|
1783
2139
|
};
|
|
1784
|
-
const _sfc_main$
|
|
1785
|
-
...__default__$
|
|
1786
|
-
props:
|
|
1787
|
-
emits:
|
|
1788
|
-
setup(__props, { emit }) {
|
|
2140
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2141
|
+
...__default__$1,
|
|
2142
|
+
props: useVvSelectProps(),
|
|
2143
|
+
emits: ["update:modelValue", "focus", "blur"],
|
|
2144
|
+
setup(__props, { emit: __emit }) {
|
|
1789
2145
|
const props = __props;
|
|
2146
|
+
const emit = __emit;
|
|
1790
2147
|
const slots = useSlots();
|
|
2148
|
+
const VvSelectProps2 = useVvSelectProps();
|
|
1791
2149
|
const propsDefaults = useDefaults(
|
|
1792
2150
|
"VvSelect",
|
|
1793
|
-
|
|
2151
|
+
VvSelectProps2,
|
|
1794
2152
|
props
|
|
1795
2153
|
);
|
|
1796
|
-
const
|
|
2154
|
+
const selectEl = ref();
|
|
1797
2155
|
const {
|
|
1798
2156
|
HintSlot,
|
|
1799
2157
|
hasHintLabelOrSlot,
|
|
1800
2158
|
hasInvalidLabelOrSlot,
|
|
1801
2159
|
hintSlotScope
|
|
1802
2160
|
} = HintSlotFactory(propsDefaults, slots);
|
|
2161
|
+
const { focused } = useComponentFocus(selectEl, emit);
|
|
2162
|
+
function isGroup(option) {
|
|
2163
|
+
var _a;
|
|
2164
|
+
if (typeof option === "string") {
|
|
2165
|
+
return false;
|
|
2166
|
+
}
|
|
2167
|
+
return (_a = option.options) == null ? void 0 : _a.length;
|
|
2168
|
+
}
|
|
1803
2169
|
const {
|
|
1804
2170
|
id,
|
|
1805
2171
|
modifiers,
|
|
@@ -1815,22 +2181,38 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1815
2181
|
} = toRefs(props);
|
|
1816
2182
|
const hasId = useUniqueId(id);
|
|
1817
2183
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
1818
|
-
const
|
|
1819
|
-
const
|
|
2184
|
+
const isDisabledOrReadonly = computed(() => props.disabled || props.readonly);
|
|
2185
|
+
const hasTabindex = computed(() => {
|
|
2186
|
+
return isDisabledOrReadonly.value ? -1 : props.tabindex;
|
|
2187
|
+
});
|
|
2188
|
+
const localModelValue = computed({
|
|
2189
|
+
get: () => {
|
|
2190
|
+
return props.modelValue;
|
|
2191
|
+
},
|
|
2192
|
+
set: (newValue) => {
|
|
2193
|
+
if (Array.isArray(newValue)) {
|
|
2194
|
+
newValue = newValue.filter((item) => item !== void 0);
|
|
2195
|
+
if (newValue.length === 0 && !props.unselectable && selectEl.value) {
|
|
2196
|
+
selectEl.value.value = String(props.modelValue);
|
|
2197
|
+
return;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
emit("update:modelValue", newValue);
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2203
|
+
const isDirty = computed(() => {
|
|
2204
|
+
if (Array.isArray(localModelValue.value)) {
|
|
2205
|
+
return localModelValue.value.length > 0;
|
|
2206
|
+
}
|
|
2207
|
+
return localModelValue.value !== void 0 && localModelValue.value !== null;
|
|
2208
|
+
});
|
|
2209
|
+
const isVisible = useElementVisibility(selectEl);
|
|
1820
2210
|
watch(isVisible, (newValue) => {
|
|
1821
2211
|
if (newValue && props.autofocus) {
|
|
1822
2212
|
focused.value = true;
|
|
1823
2213
|
}
|
|
1824
2214
|
});
|
|
1825
|
-
const {
|
|
1826
|
-
icon,
|
|
1827
|
-
iconPosition
|
|
1828
|
-
);
|
|
1829
|
-
const isDirty = computed(() => !isEmpty(props.modelValue));
|
|
1830
|
-
const isDisabled = computed(() => props.disabled || props.readonly);
|
|
1831
|
-
const hasTabindex = computed(() => {
|
|
1832
|
-
return isDisabled.value ? -1 : props.tabindex;
|
|
1833
|
-
});
|
|
2215
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
|
|
1834
2216
|
const isInvalid = computed(() => {
|
|
1835
2217
|
if (props.invalid === true) {
|
|
1836
2218
|
return true;
|
|
@@ -1844,571 +2226,362 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1844
2226
|
"vv-select",
|
|
1845
2227
|
modifiers,
|
|
1846
2228
|
computed(() => ({
|
|
1847
|
-
valid: valid.value,
|
|
1848
|
-
invalid: invalid.value,
|
|
1849
|
-
loading: loading.value,
|
|
1850
|
-
disabled: disabled.value,
|
|
1851
|
-
readonly: readonly.value,
|
|
1852
|
-
"icon-before": hasIconBefore.value,
|
|
1853
|
-
"icon-after": hasIconAfter.value,
|
|
1854
|
-
dirty: isDirty.value,
|
|
1855
|
-
focus: focused.value,
|
|
1856
|
-
floating: floating.value,
|
|
1857
|
-
multiple: multiple.value
|
|
2229
|
+
"valid": valid.value,
|
|
2230
|
+
"invalid": invalid.value,
|
|
2231
|
+
"loading": loading.value,
|
|
2232
|
+
"disabled": disabled.value,
|
|
2233
|
+
"readonly": readonly.value,
|
|
2234
|
+
"icon-before": hasIconBefore.value !== void 0,
|
|
2235
|
+
"icon-after": hasIconAfter.value !== void 0,
|
|
2236
|
+
"dirty": isDirty.value,
|
|
2237
|
+
"focus": focused.value,
|
|
2238
|
+
"floating": floating.value,
|
|
2239
|
+
"multiple": multiple.value
|
|
1858
2240
|
}))
|
|
1859
2241
|
);
|
|
1860
|
-
const hasAttrs = computed(() => {
|
|
1861
|
-
return {
|
|
1862
|
-
name: props.name,
|
|
1863
|
-
tabindex: hasTabindex.value,
|
|
1864
|
-
disabled: isDisabled.value,
|
|
1865
|
-
required: props.required,
|
|
1866
|
-
size: props.size,
|
|
1867
|
-
autocomplete: props.autocomplete,
|
|
1868
|
-
multiple: props.multiple,
|
|
1869
|
-
"aria-invalid": isInvalid.value,
|
|
1870
|
-
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
1871
|
-
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
1872
|
-
};
|
|
1873
|
-
});
|
|
1874
|
-
const slotProps = computed(() => ({
|
|
1875
|
-
valid: props.valid,
|
|
1876
|
-
invalid: props.invalid,
|
|
1877
|
-
modelValue: props.modelValue
|
|
1878
|
-
}));
|
|
1879
2242
|
const {
|
|
1880
2243
|
getOptionLabel,
|
|
1881
2244
|
getOptionValue,
|
|
1882
2245
|
isOptionDisabled,
|
|
1883
2246
|
getOptionGrouped
|
|
1884
2247
|
} = useOptions(props);
|
|
1885
|
-
const localModelValue = computed({
|
|
1886
|
-
get: () => {
|
|
1887
|
-
return props.modelValue;
|
|
1888
|
-
},
|
|
1889
|
-
set: (newValue) => {
|
|
1890
|
-
if (Array.isArray(newValue)) {
|
|
1891
|
-
newValue = newValue.filter((item) => item !== void 0);
|
|
1892
|
-
}
|
|
1893
|
-
emit("update:modelValue", newValue);
|
|
1894
|
-
}
|
|
1895
|
-
});
|
|
1896
|
-
const isGroup = (option) => {
|
|
1897
|
-
if (typeof option === "string")
|
|
1898
|
-
return false;
|
|
1899
|
-
return option && option.options && option.options.length > 0;
|
|
1900
|
-
};
|
|
1901
|
-
return (_ctx, _cache) => {
|
|
1902
|
-
return openBlock(), createElementBlock("div", {
|
|
1903
|
-
class: normalizeClass(unref(bemCssClasses))
|
|
1904
|
-
}, [
|
|
1905
|
-
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
1906
|
-
key: 0,
|
|
1907
|
-
for: unref(hasId)
|
|
1908
|
-
}, toDisplayString(_ctx.label), 9, _hoisted_1$2)) : createCommentVNode("", true),
|
|
1909
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
1910
|
-
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
1911
|
-
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1912
|
-
])) : createCommentVNode("", true),
|
|
1913
|
-
createElementVNode("div", _hoisted_4$1, [
|
|
1914
|
-
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$9, mergeProps({
|
|
1915
|
-
key: 0,
|
|
1916
|
-
class: "vv-select__icon"
|
|
1917
|
-
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
1918
|
-
withDirectives(createElementVNode("select", mergeProps({
|
|
1919
|
-
id: unref(hasId),
|
|
1920
|
-
ref_key: "select",
|
|
1921
|
-
ref: select,
|
|
1922
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
1923
|
-
}, unref(hasAttrs)), [
|
|
1924
|
-
_ctx.placeholder ? (openBlock(), createElementBlock("option", {
|
|
1925
|
-
key: 0,
|
|
1926
|
-
value: void 0,
|
|
1927
|
-
disabled: !_ctx.unselectable,
|
|
1928
|
-
hidden: !_ctx.unselectable
|
|
1929
|
-
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("", true),
|
|
1930
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
|
|
1931
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
1932
|
-
!isGroup(option) ? (openBlock(), createElementBlock("option", {
|
|
1933
|
-
key: index,
|
|
1934
|
-
disabled: unref(isOptionDisabled)(option),
|
|
1935
|
-
value: unref(getOptionValue)(option)
|
|
1936
|
-
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
|
|
1937
|
-
key: `group-${index}`,
|
|
1938
|
-
disabled: unref(isOptionDisabled)(option),
|
|
1939
|
-
label: unref(getOptionLabel)(option)
|
|
1940
|
-
}, [
|
|
1941
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(option), (item, i) => {
|
|
1942
|
-
return openBlock(), createElementBlock("option", {
|
|
1943
|
-
key: `group-${index}-item-${i}`,
|
|
1944
|
-
disabled: unref(isOptionDisabled)(item),
|
|
1945
|
-
value: unref(getOptionValue)(item)
|
|
1946
|
-
}, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
|
|
1947
|
-
}), 128))
|
|
1948
|
-
], 8, _hoisted_8$1))
|
|
1949
|
-
], 64);
|
|
1950
|
-
}), 256))
|
|
1951
|
-
], 16, _hoisted_5$1), [
|
|
1952
|
-
[vModelSelect, unref(localModelValue)]
|
|
1953
|
-
]),
|
|
1954
|
-
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$9, mergeProps({
|
|
1955
|
-
key: 1,
|
|
1956
|
-
class: "vv-select__icon vv-select__icon-after"
|
|
1957
|
-
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
|
|
1958
|
-
]),
|
|
1959
|
-
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
1960
|
-
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1961
|
-
])) : createCommentVNode("", true)
|
|
1962
|
-
]),
|
|
1963
|
-
createVNode(unref(HintSlot), {
|
|
1964
|
-
id: unref(hasHintId),
|
|
1965
|
-
class: "vv-select__hint"
|
|
1966
|
-
}, createSlots({ _: 2 }, [
|
|
1967
|
-
_ctx.$slots.hint ? {
|
|
1968
|
-
name: "hint",
|
|
1969
|
-
fn: withCtx(() => [
|
|
1970
|
-
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1971
|
-
]),
|
|
1972
|
-
key: "0"
|
|
1973
|
-
} : void 0,
|
|
1974
|
-
_ctx.$slots.loading ? {
|
|
1975
|
-
name: "loading",
|
|
1976
|
-
fn: withCtx(() => [
|
|
1977
|
-
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1978
|
-
]),
|
|
1979
|
-
key: "1"
|
|
1980
|
-
} : void 0,
|
|
1981
|
-
_ctx.$slots.valid ? {
|
|
1982
|
-
name: "valid",
|
|
1983
|
-
fn: withCtx(() => [
|
|
1984
|
-
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1985
|
-
]),
|
|
1986
|
-
key: "2"
|
|
1987
|
-
} : void 0,
|
|
1988
|
-
_ctx.$slots.invalid ? {
|
|
1989
|
-
name: "invalid",
|
|
1990
|
-
fn: withCtx(() => [
|
|
1991
|
-
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1992
|
-
]),
|
|
1993
|
-
key: "3"
|
|
1994
|
-
} : void 0
|
|
1995
|
-
]), 1032, ["id"])
|
|
1996
|
-
], 2);
|
|
1997
|
-
};
|
|
1998
|
-
}
|
|
1999
|
-
});
|
|
2000
|
-
const VvBadgeProps = {
|
|
2001
|
-
...ModifiersProps,
|
|
2002
|
-
value: [String, Number]
|
|
2003
|
-
};
|
|
2004
|
-
const __default__$3 = {
|
|
2005
|
-
name: "VvBadge"
|
|
2006
|
-
};
|
|
2007
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2008
|
-
...__default__$3,
|
|
2009
|
-
props: VvBadgeProps,
|
|
2010
|
-
setup(__props) {
|
|
2011
|
-
const props = __props;
|
|
2012
|
-
const { modifiers } = toRefs(props);
|
|
2013
|
-
const bemCssClasses = useModifiers("vv-badge", modifiers);
|
|
2014
|
-
return (_ctx, _cache) => {
|
|
2015
|
-
return openBlock(), createElementBlock("span", {
|
|
2016
|
-
class: normalizeClass(unref(bemCssClasses)),
|
|
2017
|
-
role: "status"
|
|
2018
|
-
}, [
|
|
2019
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
2020
|
-
createTextVNode(toDisplayString(_ctx.value), 1)
|
|
2021
|
-
])
|
|
2022
|
-
], 2);
|
|
2023
|
-
};
|
|
2024
|
-
}
|
|
2025
|
-
});
|
|
2026
|
-
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
2027
|
-
const VvActionProps = ActionProps;
|
|
2028
|
-
const __default__$2 = {
|
|
2029
|
-
name: "VvAction"
|
|
2030
|
-
};
|
|
2031
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2032
|
-
...__default__$2,
|
|
2033
|
-
props: VvActionProps,
|
|
2034
|
-
emits: VvActionEvents,
|
|
2035
|
-
setup(__props, { expose: __expose, emit }) {
|
|
2036
|
-
const props = __props;
|
|
2037
|
-
const volver = useVolver();
|
|
2038
|
-
const element = ref(null);
|
|
2039
|
-
__expose({ $el: element });
|
|
2040
|
-
const {
|
|
2041
|
-
reference: dropdownTriggerReference,
|
|
2042
|
-
bus: dropdownEventBus,
|
|
2043
|
-
aria: dropdownAria,
|
|
2044
|
-
expanded: dropdownExpanded
|
|
2045
|
-
} = useInjectedDropdownTrigger();
|
|
2046
2248
|
watch(
|
|
2047
|
-
() =>
|
|
2249
|
+
() => props.options,
|
|
2048
2250
|
(newValue) => {
|
|
2049
|
-
if (
|
|
2050
|
-
|
|
2251
|
+
if ((newValue == null ? void 0 : newValue.length) && props.autoselectFirst && !isDirty.value) {
|
|
2252
|
+
const firstOptionValue = getOptionValue(newValue[0]);
|
|
2253
|
+
localModelValue.value = props.multiple ? [firstOptionValue] : firstOptionValue;
|
|
2051
2254
|
}
|
|
2052
|
-
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
}
|
|
2069
|
-
});
|
|
2070
|
-
const hasProps = computed(() => {
|
|
2071
|
-
const toReturn = {
|
|
2072
|
-
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
2073
|
-
ariaPressed: pressed.value ? true : void 0,
|
|
2074
|
-
ariaLabel: props.ariaLabel,
|
|
2075
|
-
role: role == null ? void 0 : role.value
|
|
2076
|
-
};
|
|
2077
|
-
switch (hasTag.value) {
|
|
2078
|
-
case ActionTag.a:
|
|
2079
|
-
return {
|
|
2080
|
-
...toReturn,
|
|
2081
|
-
href: props.href,
|
|
2082
|
-
target: props.target,
|
|
2083
|
-
rel: props.rel
|
|
2084
|
-
};
|
|
2085
|
-
case ActionTag.routerLink:
|
|
2086
|
-
case ActionTag.nuxtLink:
|
|
2087
|
-
return {
|
|
2088
|
-
...toReturn,
|
|
2089
|
-
to: props.to,
|
|
2090
|
-
target: props.target
|
|
2091
|
-
};
|
|
2092
|
-
default:
|
|
2093
|
-
return {
|
|
2094
|
-
...toReturn,
|
|
2095
|
-
type: props.type,
|
|
2096
|
-
disabled: props.disabled
|
|
2097
|
-
};
|
|
2098
|
-
}
|
|
2255
|
+
},
|
|
2256
|
+
{ immediate: true }
|
|
2257
|
+
);
|
|
2258
|
+
const hasAttrs = computed(() => {
|
|
2259
|
+
return {
|
|
2260
|
+
"name": props.name,
|
|
2261
|
+
"tabindex": hasTabindex.value,
|
|
2262
|
+
"disabled": isDisabledOrReadonly.value,
|
|
2263
|
+
"required": props.required,
|
|
2264
|
+
"size": props.size,
|
|
2265
|
+
"autocomplete": props.autocomplete,
|
|
2266
|
+
"multiple": props.multiple,
|
|
2267
|
+
"aria-invalid": isInvalid.value,
|
|
2268
|
+
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
2269
|
+
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
2270
|
+
};
|
|
2099
2271
|
});
|
|
2100
|
-
const
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
2106
|
-
emit("click", e);
|
|
2107
|
-
};
|
|
2108
|
-
const onMouseover = (e) => {
|
|
2109
|
-
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
2110
|
-
emit("mouseover", e);
|
|
2111
|
-
};
|
|
2112
|
-
const onMouseleave = (e) => {
|
|
2113
|
-
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
2114
|
-
emit("mouseleave", e);
|
|
2115
|
-
};
|
|
2272
|
+
const slotProps = computed(() => ({
|
|
2273
|
+
valid: props.valid,
|
|
2274
|
+
invalid: props.invalid,
|
|
2275
|
+
modelValue: props.modelValue
|
|
2276
|
+
}));
|
|
2116
2277
|
return (_ctx, _cache) => {
|
|
2117
|
-
return openBlock(),
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
active: _ctx.active,
|
|
2122
|
-
pressed: unref(pressed),
|
|
2123
|
-
disabled: _ctx.disabled,
|
|
2124
|
-
current: _ctx.current
|
|
2278
|
+
return openBlock(), createElementBlock(
|
|
2279
|
+
"div",
|
|
2280
|
+
{
|
|
2281
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
2125
2282
|
},
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2283
|
+
[
|
|
2284
|
+
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
2285
|
+
key: 0,
|
|
2286
|
+
for: unref(hasId)
|
|
2287
|
+
}, toDisplayString(_ctx.label), 9, _hoisted_1$1)) : createCommentVNode("v-if", true),
|
|
2288
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
2289
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
2290
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2291
|
+
])) : createCommentVNode("v-if", true),
|
|
2292
|
+
createElementVNode("div", _hoisted_4$1, [
|
|
2293
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2294
|
+
_sfc_main$7,
|
|
2295
|
+
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
|
|
2296
|
+
null,
|
|
2297
|
+
16
|
|
2298
|
+
/* FULL_PROPS */
|
|
2299
|
+
)) : createCommentVNode("v-if", true),
|
|
2300
|
+
withDirectives(createElementVNode("select", mergeProps({
|
|
2301
|
+
id: unref(hasId),
|
|
2302
|
+
ref_key: "selectEl",
|
|
2303
|
+
ref: selectEl
|
|
2304
|
+
}, unref(hasAttrs), {
|
|
2305
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
2306
|
+
}), [
|
|
2307
|
+
_ctx.placeholder ? (openBlock(), createElementBlock("option", {
|
|
2308
|
+
key: 0,
|
|
2309
|
+
value: void 0,
|
|
2310
|
+
disabled: !_ctx.unselectable,
|
|
2311
|
+
hidden: !_ctx.unselectable
|
|
2312
|
+
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("v-if", true),
|
|
2313
|
+
(openBlock(true), createElementBlock(
|
|
2314
|
+
Fragment,
|
|
2315
|
+
null,
|
|
2316
|
+
renderList(_ctx.options, (option, index) => {
|
|
2317
|
+
return openBlock(), createElementBlock(
|
|
2318
|
+
Fragment,
|
|
2319
|
+
null,
|
|
2320
|
+
[
|
|
2321
|
+
!isGroup(option) ? (openBlock(), createElementBlock("option", {
|
|
2322
|
+
key: index,
|
|
2323
|
+
disabled: unref(isOptionDisabled)(option),
|
|
2324
|
+
value: unref(getOptionValue)(option)
|
|
2325
|
+
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
|
|
2326
|
+
key: `group-${index}`,
|
|
2327
|
+
disabled: unref(isOptionDisabled)(option),
|
|
2328
|
+
label: unref(getOptionLabel)(option)
|
|
2329
|
+
}, [
|
|
2330
|
+
(openBlock(true), createElementBlock(
|
|
2331
|
+
Fragment,
|
|
2332
|
+
null,
|
|
2333
|
+
renderList(unref(getOptionGrouped)(option), (item, i) => {
|
|
2334
|
+
return openBlock(), createElementBlock("option", {
|
|
2335
|
+
key: `group-${index}-item-${i}`,
|
|
2336
|
+
disabled: unref(isOptionDisabled)(item),
|
|
2337
|
+
value: unref(getOptionValue)(item)
|
|
2338
|
+
}, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
|
|
2339
|
+
}),
|
|
2340
|
+
128
|
|
2341
|
+
/* KEYED_FRAGMENT */
|
|
2342
|
+
))
|
|
2343
|
+
], 8, _hoisted_8$1))
|
|
2344
|
+
],
|
|
2345
|
+
64
|
|
2346
|
+
/* STABLE_FRAGMENT */
|
|
2347
|
+
);
|
|
2348
|
+
}),
|
|
2349
|
+
256
|
|
2350
|
+
/* UNKEYED_FRAGMENT */
|
|
2351
|
+
))
|
|
2352
|
+
], 16, _hoisted_5$1), [
|
|
2353
|
+
[vModelSelect, unref(localModelValue)]
|
|
2354
|
+
]),
|
|
2355
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
2356
|
+
_sfc_main$7,
|
|
2357
|
+
mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
|
|
2358
|
+
null,
|
|
2359
|
+
16
|
|
2360
|
+
/* FULL_PROPS */
|
|
2361
|
+
)) : createCommentVNode("v-if", true)
|
|
2362
|
+
]),
|
|
2363
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
2364
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2365
|
+
])) : createCommentVNode("v-if", true)
|
|
2366
|
+
]),
|
|
2367
|
+
createVNode(unref(HintSlot), {
|
|
2368
|
+
id: unref(hasHintId),
|
|
2369
|
+
class: "vv-select__hint"
|
|
2370
|
+
}, createSlots({
|
|
2371
|
+
_: 2
|
|
2372
|
+
/* DYNAMIC */
|
|
2373
|
+
}, [
|
|
2374
|
+
_ctx.$slots.hint ? {
|
|
2375
|
+
name: "hint",
|
|
2376
|
+
fn: withCtx(() => [
|
|
2377
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2378
|
+
]),
|
|
2379
|
+
key: "0"
|
|
2380
|
+
} : void 0,
|
|
2381
|
+
_ctx.$slots.loading ? {
|
|
2382
|
+
name: "loading",
|
|
2383
|
+
fn: withCtx(() => [
|
|
2384
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2385
|
+
]),
|
|
2386
|
+
key: "1"
|
|
2387
|
+
} : void 0,
|
|
2388
|
+
_ctx.$slots.valid ? {
|
|
2389
|
+
name: "valid",
|
|
2390
|
+
fn: withCtx(() => [
|
|
2391
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2392
|
+
]),
|
|
2393
|
+
key: "2"
|
|
2394
|
+
} : void 0,
|
|
2395
|
+
_ctx.$slots.invalid ? {
|
|
2396
|
+
name: "invalid",
|
|
2397
|
+
fn: withCtx(() => [
|
|
2398
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2399
|
+
]),
|
|
2400
|
+
key: "3"
|
|
2401
|
+
} : void 0
|
|
2402
|
+
]), 1032, ["id"])
|
|
2403
|
+
],
|
|
2404
|
+
2
|
|
2405
|
+
/* CLASS */
|
|
2406
|
+
);
|
|
2137
2407
|
};
|
|
2138
2408
|
}
|
|
2139
2409
|
});
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
return computed({
|
|
2147
|
-
get() {
|
|
2148
|
-
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
2149
|
-
},
|
|
2150
|
-
set(value) {
|
|
2151
|
-
groupPropValue.value = value;
|
|
2152
|
-
}
|
|
2153
|
-
});
|
|
2154
|
-
}
|
|
2155
|
-
const propRef = toRef(props, propName);
|
|
2156
|
-
return computed({
|
|
2157
|
-
get() {
|
|
2158
|
-
return propRef.value;
|
|
2159
|
-
},
|
|
2160
|
-
set(value) {
|
|
2161
|
-
if (emit)
|
|
2162
|
-
emit(`update:${propName}`, value);
|
|
2163
|
-
}
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
return {
|
|
2167
|
-
group,
|
|
2168
|
-
isInGroup,
|
|
2169
|
-
getGroupOrLocalRef
|
|
2170
|
-
};
|
|
2171
|
-
}
|
|
2172
|
-
const VvButtonEvents = ["update:modelValue"];
|
|
2173
|
-
const VvButtonProps = {
|
|
2174
|
-
...ActionProps,
|
|
2175
|
-
...IdProps,
|
|
2176
|
-
...ModifiersProps,
|
|
2177
|
-
...UnselectableProps,
|
|
2410
|
+
const VvComboboxProps = {
|
|
2411
|
+
...IdNameProps,
|
|
2412
|
+
...TabindexProps,
|
|
2413
|
+
...ValidProps,
|
|
2414
|
+
...InvalidProps,
|
|
2415
|
+
...HintProps,
|
|
2178
2416
|
...LoadingProps,
|
|
2417
|
+
...DisabledProps,
|
|
2418
|
+
...ReadonlyProps,
|
|
2419
|
+
...ModifiersProps,
|
|
2420
|
+
...OptionsProps,
|
|
2421
|
+
...IconProps,
|
|
2422
|
+
...FloatingLabelProps,
|
|
2423
|
+
...DropdownProps,
|
|
2424
|
+
...LabelProps,
|
|
2425
|
+
...RequiredProps,
|
|
2426
|
+
/**
|
|
2427
|
+
* Dropdown show / hide transition name
|
|
2428
|
+
*/
|
|
2429
|
+
transitionName: {
|
|
2430
|
+
type: String,
|
|
2431
|
+
default: "vv-dropdown--mobile-fade-block"
|
|
2432
|
+
},
|
|
2433
|
+
/**
|
|
2434
|
+
* modelValue can be a string, number, boolean, object or array of string, number, boolean, object
|
|
2435
|
+
*/
|
|
2436
|
+
modelValue: {
|
|
2437
|
+
type: [String, Number, Boolean, Object, Array],
|
|
2438
|
+
default: void 0
|
|
2439
|
+
},
|
|
2179
2440
|
/**
|
|
2180
|
-
*
|
|
2441
|
+
* Label for no search results
|
|
2181
2442
|
*/
|
|
2182
|
-
|
|
2443
|
+
noResultsLabel: { type: String, default: "No results" },
|
|
2183
2444
|
/**
|
|
2184
|
-
*
|
|
2445
|
+
* Label for no options available
|
|
2185
2446
|
*/
|
|
2186
|
-
|
|
2447
|
+
noOptionsLabel: { type: String, default: "No options available" },
|
|
2448
|
+
/**
|
|
2449
|
+
* Label for selected option hint
|
|
2450
|
+
*/
|
|
2451
|
+
selectedHintLabel: { type: String, default: "Selected" },
|
|
2452
|
+
/**
|
|
2453
|
+
* Label for deselect action button
|
|
2454
|
+
*/
|
|
2455
|
+
deselectActionLabel: { type: String, default: "Deselect" },
|
|
2456
|
+
/**
|
|
2457
|
+
* Label for select option hint
|
|
2458
|
+
*/
|
|
2459
|
+
selectHintLabel: { type: String, default: "Press enter to select" },
|
|
2460
|
+
/**
|
|
2461
|
+
* Label for deselected option hint
|
|
2462
|
+
*/
|
|
2463
|
+
deselectHintLabel: { type: String, default: "Press enter to remove" },
|
|
2464
|
+
/**
|
|
2465
|
+
* Label close button
|
|
2466
|
+
*/
|
|
2467
|
+
closeLabel: { type: String, default: "Close" },
|
|
2468
|
+
/**
|
|
2469
|
+
* Select input placeholder
|
|
2470
|
+
*/
|
|
2471
|
+
placeholder: String,
|
|
2472
|
+
/**
|
|
2473
|
+
* Use input text to search on options
|
|
2474
|
+
*/
|
|
2475
|
+
searchable: Boolean,
|
|
2476
|
+
/**
|
|
2477
|
+
* Search function to filter options
|
|
2478
|
+
*/
|
|
2479
|
+
searchFunction: {
|
|
2480
|
+
type: Function,
|
|
2481
|
+
default: void 0
|
|
2482
|
+
},
|
|
2483
|
+
/**
|
|
2484
|
+
* On searchable select is the input search placeholder
|
|
2485
|
+
*/
|
|
2486
|
+
searchPlaceholder: {
|
|
2187
2487
|
type: String,
|
|
2188
|
-
default:
|
|
2189
|
-
validator: (value) => Object.values(Side).includes(value)
|
|
2488
|
+
default: "Search..."
|
|
2190
2489
|
},
|
|
2191
2490
|
/**
|
|
2192
|
-
*
|
|
2491
|
+
* The input search debounce time in ms
|
|
2193
2492
|
*/
|
|
2194
|
-
|
|
2493
|
+
debounceSearch: {
|
|
2494
|
+
type: [Number, String],
|
|
2495
|
+
default: 0
|
|
2496
|
+
},
|
|
2195
2497
|
/**
|
|
2196
|
-
*
|
|
2498
|
+
* Manage modelValue as string[] or object[]
|
|
2197
2499
|
*/
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2500
|
+
multiple: Boolean,
|
|
2501
|
+
/**
|
|
2502
|
+
* The min number of selected values
|
|
2503
|
+
*/
|
|
2504
|
+
minValues: {
|
|
2505
|
+
type: [Number, String],
|
|
2506
|
+
default: 0
|
|
2201
2507
|
},
|
|
2202
2508
|
/**
|
|
2203
|
-
*
|
|
2509
|
+
* The max number of selected values
|
|
2204
2510
|
*/
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2511
|
+
maxValues: [Number, String],
|
|
2512
|
+
/**
|
|
2513
|
+
* If true the input will be unselectable
|
|
2514
|
+
* @deprecated use minValues instead
|
|
2515
|
+
*/
|
|
2516
|
+
unselectable: { type: Boolean, default: true },
|
|
2517
|
+
/**
|
|
2518
|
+
* The select label separator visible to the user
|
|
2519
|
+
*/
|
|
2520
|
+
separator: { type: String, default: ", " },
|
|
2521
|
+
/**
|
|
2522
|
+
* Show native select
|
|
2523
|
+
*/
|
|
2524
|
+
native: Boolean,
|
|
2525
|
+
/**
|
|
2526
|
+
* Show badges
|
|
2527
|
+
*/
|
|
2528
|
+
badges: Boolean,
|
|
2529
|
+
/**
|
|
2530
|
+
* Badge modifiers
|
|
2531
|
+
*/
|
|
2532
|
+
badgeModifiers: {
|
|
2533
|
+
type: [String, Array],
|
|
2534
|
+
default: "action sm"
|
|
2208
2535
|
},
|
|
2209
2536
|
/**
|
|
2210
|
-
*
|
|
2537
|
+
* Set dropdown width to the same as the trigger
|
|
2211
2538
|
*/
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
default:
|
|
2539
|
+
triggerWidth: {
|
|
2540
|
+
...DropdownProps.triggerWidth,
|
|
2541
|
+
default: true
|
|
2215
2542
|
},
|
|
2216
2543
|
/**
|
|
2217
|
-
*
|
|
2544
|
+
* Dropdown modifiers
|
|
2218
2545
|
*/
|
|
2219
|
-
|
|
2220
|
-
type: [String,
|
|
2221
|
-
default:
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
groupModifiers = groupModifiers.split(" ");
|
|
2247
|
-
}
|
|
2248
|
-
groupModifiers.forEach((modifier) => toReturn.add(modifier));
|
|
2249
|
-
}
|
|
2250
|
-
return Array.from(toReturn);
|
|
2251
|
-
});
|
|
2252
|
-
const disabled = computed(
|
|
2253
|
-
() => {
|
|
2254
|
-
var _a;
|
|
2255
|
-
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
2256
|
-
}
|
|
2257
|
-
);
|
|
2546
|
+
dropdownModifiers: {
|
|
2547
|
+
type: [String, Array],
|
|
2548
|
+
default: "mobile"
|
|
2549
|
+
},
|
|
2550
|
+
/**
|
|
2551
|
+
* Open dropdown on focus
|
|
2552
|
+
*/
|
|
2553
|
+
autoOpen: {
|
|
2554
|
+
type: Boolean,
|
|
2555
|
+
default: false
|
|
2556
|
+
},
|
|
2557
|
+
/**
|
|
2558
|
+
* Select first option automatically
|
|
2559
|
+
*/
|
|
2560
|
+
autoselectFirst: {
|
|
2561
|
+
type: Boolean,
|
|
2562
|
+
default: false
|
|
2563
|
+
},
|
|
2564
|
+
/**
|
|
2565
|
+
* Keep open dropdown on single select
|
|
2566
|
+
*/
|
|
2567
|
+
keepOpen: {
|
|
2568
|
+
type: Boolean,
|
|
2569
|
+
default: false
|
|
2570
|
+
}
|
|
2571
|
+
};
|
|
2572
|
+
function useVvComboboxProps() {
|
|
2258
2573
|
return {
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
// local props
|
|
2269
|
-
id,
|
|
2270
|
-
pressed,
|
|
2271
|
-
iconPosition,
|
|
2272
|
-
icon,
|
|
2273
|
-
label
|
|
2574
|
+
...VvComboboxProps,
|
|
2575
|
+
options: {
|
|
2576
|
+
...VvComboboxProps.options,
|
|
2577
|
+
type: Array
|
|
2578
|
+
},
|
|
2579
|
+
searchFunction: {
|
|
2580
|
+
...VvComboboxProps.searchFunction,
|
|
2581
|
+
type: Function
|
|
2582
|
+
}
|
|
2274
2583
|
};
|
|
2275
2584
|
}
|
|
2276
|
-
const _hoisted_1$1 = {
|
|
2277
|
-
key: 1,
|
|
2278
|
-
class: "vv-button__label"
|
|
2279
|
-
};
|
|
2280
|
-
const _hoisted_2$1 = {
|
|
2281
|
-
key: 1,
|
|
2282
|
-
class: "vv-button__label"
|
|
2283
|
-
};
|
|
2284
|
-
const __default__$1 = {
|
|
2285
|
-
name: "VvButton"
|
|
2286
|
-
};
|
|
2287
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2288
|
-
...__default__$1,
|
|
2289
|
-
props: VvButtonProps,
|
|
2290
|
-
emits: VvButtonEvents,
|
|
2291
|
-
setup(__props, { expose: __expose, emit }) {
|
|
2292
|
-
const props = __props;
|
|
2293
|
-
const attrs = useAttrs();
|
|
2294
|
-
const slots = useSlots();
|
|
2295
|
-
const {
|
|
2296
|
-
id,
|
|
2297
|
-
modifiers,
|
|
2298
|
-
iconPosition,
|
|
2299
|
-
icon,
|
|
2300
|
-
label,
|
|
2301
|
-
modelValue,
|
|
2302
|
-
disabled,
|
|
2303
|
-
toggle,
|
|
2304
|
-
unselectable
|
|
2305
|
-
} = useGroupProps(props, emit);
|
|
2306
|
-
const hasId = useUniqueId(id);
|
|
2307
|
-
const name = computed(() => (attrs == null ? void 0 : attrs.name) || hasId.value);
|
|
2308
|
-
const element = ref(null);
|
|
2309
|
-
const $el = computed(() => {
|
|
2310
|
-
var _a;
|
|
2311
|
-
return (_a = element.value) == null ? void 0 : _a.$el;
|
|
2312
|
-
});
|
|
2313
|
-
__expose({ $el });
|
|
2314
|
-
const pressed = computed(() => {
|
|
2315
|
-
if (!toggle.value) {
|
|
2316
|
-
return props.pressed;
|
|
2317
|
-
}
|
|
2318
|
-
if (Array.isArray(modelValue.value)) {
|
|
2319
|
-
return contains(name.value, modelValue.value);
|
|
2320
|
-
}
|
|
2321
|
-
return equals(name.value, modelValue.value);
|
|
2322
|
-
});
|
|
2323
|
-
const bemCssClasses = useModifiers(
|
|
2324
|
-
"vv-button",
|
|
2325
|
-
modifiers,
|
|
2326
|
-
computed(() => ({
|
|
2327
|
-
reverse: [Side.right, Side.bottom].includes(
|
|
2328
|
-
iconPosition.value
|
|
2329
|
-
),
|
|
2330
|
-
column: [Side.top, Side.bottom].includes(
|
|
2331
|
-
iconPosition.value
|
|
2332
|
-
),
|
|
2333
|
-
"icon-only": Boolean(
|
|
2334
|
-
(icon == null ? void 0 : icon.value) && !(label == null ? void 0 : label.value) && !slots.default
|
|
2335
|
-
)
|
|
2336
|
-
}))
|
|
2337
|
-
);
|
|
2338
|
-
const hasIconProps = computed(
|
|
2339
|
-
() => typeof (icon == null ? void 0 : icon.value) === "string" ? { name: icon == null ? void 0 : icon.value } : icon == null ? void 0 : icon.value
|
|
2340
|
-
);
|
|
2341
|
-
const toggleValue = computed(() => {
|
|
2342
|
-
return props.value !== void 0 ? props.value : name.value;
|
|
2343
|
-
});
|
|
2344
|
-
const onClick = () => {
|
|
2345
|
-
if (toggle.value) {
|
|
2346
|
-
if (Array.isArray(modelValue.value)) {
|
|
2347
|
-
if (contains(toggleValue.value, modelValue.value)) {
|
|
2348
|
-
if (unselectable.value) {
|
|
2349
|
-
modelValue.value = modelValue.value.filter(
|
|
2350
|
-
(n) => n !== toggleValue.value
|
|
2351
|
-
);
|
|
2352
|
-
}
|
|
2353
|
-
return;
|
|
2354
|
-
}
|
|
2355
|
-
modelValue.value.push(toggleValue.value);
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
if (toggleValue.value === modelValue.value && unselectable.value) {
|
|
2359
|
-
modelValue.value = props.uncheckedValue;
|
|
2360
|
-
return;
|
|
2361
|
-
}
|
|
2362
|
-
modelValue.value = toggleValue.value;
|
|
2363
|
-
}
|
|
2364
|
-
};
|
|
2365
|
-
return (_ctx, _cache) => {
|
|
2366
|
-
return openBlock(), createBlock(_sfc_main$2, mergeProps({
|
|
2367
|
-
disabled: unref(disabled),
|
|
2368
|
-
pressed: unref(pressed),
|
|
2369
|
-
active: _ctx.active,
|
|
2370
|
-
type: _ctx.type,
|
|
2371
|
-
to: _ctx.to,
|
|
2372
|
-
href: _ctx.href,
|
|
2373
|
-
target: _ctx.target,
|
|
2374
|
-
rel: _ctx.rel,
|
|
2375
|
-
ariaLabel: _ctx.ariaLabel
|
|
2376
|
-
}, {
|
|
2377
|
-
id: unref(hasId),
|
|
2378
|
-
ref_key: "element",
|
|
2379
|
-
ref: element,
|
|
2380
|
-
class: unref(bemCssClasses),
|
|
2381
|
-
onClick
|
|
2382
|
-
}), {
|
|
2383
|
-
default: withCtx(() => [
|
|
2384
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
2385
|
-
_ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
2386
|
-
_ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$9, {
|
|
2387
|
-
key: 0,
|
|
2388
|
-
class: "vv-button__loading-icon",
|
|
2389
|
-
name: _ctx.loadingIcon
|
|
2390
|
-
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
2391
|
-
_ctx.loadingLabel ? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString(_ctx.loadingLabel), 1)) : createCommentVNode("", true)
|
|
2392
|
-
]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2393
|
-
renderSlot(_ctx.$slots, "before"),
|
|
2394
|
-
unref(icon) ? (openBlock(), createBlock(_sfc_main$9, mergeProps({
|
|
2395
|
-
key: 0,
|
|
2396
|
-
class: "vv-button__icon"
|
|
2397
|
-
}, unref(hasIconProps)), null, 16)) : createCommentVNode("", true),
|
|
2398
|
-
unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2$1, [
|
|
2399
|
-
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
2400
|
-
createTextVNode(toDisplayString(unref(label)), 1)
|
|
2401
|
-
])
|
|
2402
|
-
])) : createCommentVNode("", true),
|
|
2403
|
-
renderSlot(_ctx.$slots, "after")
|
|
2404
|
-
], 64))
|
|
2405
|
-
])
|
|
2406
|
-
]),
|
|
2407
|
-
_: 3
|
|
2408
|
-
}, 16, ["id", "class"]);
|
|
2409
|
-
};
|
|
2410
|
-
}
|
|
2411
|
-
});
|
|
2412
2585
|
const _hoisted_1 = ["id"];
|
|
2413
2586
|
const _hoisted_2 = ["id", "for"];
|
|
2414
2587
|
const _hoisted_3 = ["id", "aria-controls", "placeholder"];
|
|
@@ -2417,7 +2590,7 @@ const _hoisted_4 = {
|
|
|
2417
2590
|
class: "vv-select__input-before"
|
|
2418
2591
|
};
|
|
2419
2592
|
const _hoisted_5 = { class: "vv-select__inner" };
|
|
2420
|
-
const _hoisted_6 = ["aria-expanded", "aria-labelledby", "aria-describedby", "aria-errormessage", "tabindex"];
|
|
2593
|
+
const _hoisted_6 = ["aria-controls", "aria-expanded", "aria-labelledby", "aria-describedby", "aria-errormessage", "tabindex"];
|
|
2421
2594
|
const _hoisted_7 = {
|
|
2422
2595
|
key: 0,
|
|
2423
2596
|
class: "vv-select__value"
|
|
@@ -2430,39 +2603,36 @@ const _hoisted_9 = {
|
|
|
2430
2603
|
const __default__ = {
|
|
2431
2604
|
name: "VvCombobox",
|
|
2432
2605
|
components: {
|
|
2433
|
-
VvDropdown: _sfc_main$
|
|
2434
|
-
VvDropdownOption: _sfc_main$
|
|
2435
|
-
VvDropdownOptgroup: _sfc_main$
|
|
2436
|
-
VvButton: _sfc_main$
|
|
2606
|
+
VvDropdown: _sfc_main$5,
|
|
2607
|
+
VvDropdownOption: _sfc_main$2,
|
|
2608
|
+
VvDropdownOptgroup: _sfc_main$4,
|
|
2609
|
+
VvButton: _sfc_main$6
|
|
2437
2610
|
}
|
|
2438
2611
|
};
|
|
2439
2612
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2440
2613
|
...__default__,
|
|
2441
|
-
props:
|
|
2442
|
-
emits:
|
|
2443
|
-
setup(__props, { emit }) {
|
|
2614
|
+
props: useVvComboboxProps(),
|
|
2615
|
+
emits: ["update:modelValue", "update:search", "change:search", "focus", "blur"],
|
|
2616
|
+
setup(__props, { emit: __emit }) {
|
|
2444
2617
|
const props = __props;
|
|
2618
|
+
const emit = __emit;
|
|
2445
2619
|
const slots = useSlots();
|
|
2620
|
+
const VvComboboxProps2 = useVvComboboxProps();
|
|
2446
2621
|
const propsDefaults = useDefaults(
|
|
2447
2622
|
"VvCombobox",
|
|
2448
|
-
|
|
2623
|
+
VvComboboxProps2,
|
|
2449
2624
|
props
|
|
2450
2625
|
);
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
return option.options && option.options.length > 0;
|
|
2456
|
-
};
|
|
2626
|
+
const inputEl = ref(null);
|
|
2627
|
+
const inputSearchEl = ref(null);
|
|
2628
|
+
const wrapperEl = ref(null);
|
|
2629
|
+
const dropdownEl = ref();
|
|
2457
2630
|
const {
|
|
2458
2631
|
HintSlot,
|
|
2459
2632
|
hasHintLabelOrSlot,
|
|
2460
2633
|
hasInvalidLabelOrSlot,
|
|
2461
2634
|
hintSlotScope
|
|
2462
2635
|
} = HintSlotFactory(propsDefaults, slots);
|
|
2463
|
-
const inputEl = ref(null);
|
|
2464
|
-
const inputSearchEl = ref(null);
|
|
2465
|
-
const wrapperEl = ref(null);
|
|
2466
2636
|
const { focused } = useComponentFocus(inputEl, emit);
|
|
2467
2637
|
const { focused: focusedWithin } = useFocusWithin(wrapperEl);
|
|
2468
2638
|
watch(focused, (newValue) => {
|
|
@@ -2487,27 +2657,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2487
2657
|
searchText,
|
|
2488
2658
|
computed(() => Number(props.debounceSearch))
|
|
2489
2659
|
);
|
|
2490
|
-
watch(
|
|
2491
|
-
debouncedSearchText
|
|
2492
|
-
|
|
2493
|
-
);
|
|
2660
|
+
watch(debouncedSearchText, () => {
|
|
2661
|
+
emit("update:search", debouncedSearchText.value);
|
|
2662
|
+
emit("change:search", debouncedSearchText.value);
|
|
2663
|
+
});
|
|
2494
2664
|
const expanded = ref(false);
|
|
2495
|
-
|
|
2496
|
-
if (
|
|
2665
|
+
function toggleExpanded() {
|
|
2666
|
+
if (isDisabledOrReadonly.value)
|
|
2497
2667
|
return;
|
|
2498
2668
|
expanded.value = !expanded.value;
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
if (
|
|
2669
|
+
}
|
|
2670
|
+
function expand() {
|
|
2671
|
+
if (isDisabledOrReadonly.value || expanded.value)
|
|
2502
2672
|
return;
|
|
2503
2673
|
expanded.value = true;
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
if (
|
|
2674
|
+
}
|
|
2675
|
+
function collapse() {
|
|
2676
|
+
if (isDisabledOrReadonly.value || !expanded.value)
|
|
2507
2677
|
return;
|
|
2508
2678
|
expanded.value = false;
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2679
|
+
}
|
|
2680
|
+
function onAfterExpand() {
|
|
2511
2681
|
if (propsDefaults.value.searchable) {
|
|
2512
2682
|
if (inputSearchEl.value) {
|
|
2513
2683
|
inputSearchEl.value.focus({
|
|
@@ -2515,18 +2685,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2515
2685
|
});
|
|
2516
2686
|
}
|
|
2517
2687
|
}
|
|
2518
|
-
}
|
|
2519
|
-
|
|
2688
|
+
}
|
|
2689
|
+
function onAfterCollapse() {
|
|
2520
2690
|
if (propsDefaults.value.searchable) {
|
|
2521
2691
|
searchText.value = "";
|
|
2522
2692
|
}
|
|
2523
|
-
}
|
|
2693
|
+
}
|
|
2694
|
+
function isGroup(option) {
|
|
2695
|
+
var _a;
|
|
2696
|
+
if (typeof option === "string") {
|
|
2697
|
+
return false;
|
|
2698
|
+
}
|
|
2699
|
+
return (_a = option.options) == null ? void 0 : _a.length;
|
|
2700
|
+
}
|
|
2524
2701
|
const {
|
|
2525
2702
|
id,
|
|
2526
2703
|
icon,
|
|
2527
2704
|
iconPosition,
|
|
2528
2705
|
modifiers,
|
|
2529
2706
|
disabled,
|
|
2707
|
+
required,
|
|
2530
2708
|
readonly,
|
|
2531
2709
|
loading,
|
|
2532
2710
|
valid,
|
|
@@ -2538,32 +2716,69 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2538
2716
|
const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
|
|
2539
2717
|
const hasSearchId = computed(() => `${hasId.value}-search`);
|
|
2540
2718
|
const hasLabelId = computed(() => `${hasId.value}-label`);
|
|
2541
|
-
const
|
|
2542
|
-
const isLoading = computed(() => localLoading.value || loading.value);
|
|
2543
|
-
const dropdownEl = ref();
|
|
2544
|
-
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
2545
|
-
icon,
|
|
2546
|
-
iconPosition
|
|
2547
|
-
);
|
|
2548
|
-
const isDirty = computed(() => !isEmpty(props.modelValue));
|
|
2719
|
+
const isDisabledOrReadonly = computed(() => props.disabled || props.readonly);
|
|
2549
2720
|
const hasTabindex = computed(() => {
|
|
2550
|
-
return
|
|
2721
|
+
return isDisabledOrReadonly.value ? -1 : props.tabindex;
|
|
2722
|
+
});
|
|
2723
|
+
const localModelValue = computed({
|
|
2724
|
+
get: () => {
|
|
2725
|
+
if (Array.isArray(props.modelValue)) {
|
|
2726
|
+
return props.modelValue;
|
|
2727
|
+
}
|
|
2728
|
+
return props.modelValue !== void 0 && props.modelValue !== null ? [props.modelValue] : [];
|
|
2729
|
+
},
|
|
2730
|
+
set: (value) => {
|
|
2731
|
+
emit("update:modelValue", props.multiple || Array.isArray(props.modelValue) ? value : value.pop());
|
|
2732
|
+
}
|
|
2733
|
+
});
|
|
2734
|
+
const sizeOfModelValue = computed(() => localModelValue.value.length);
|
|
2735
|
+
const isDirty = computed(() => sizeOfModelValue.value > 0);
|
|
2736
|
+
const hasMaxValues = computed(() => {
|
|
2737
|
+
if (!props.multiple) {
|
|
2738
|
+
return 1;
|
|
2739
|
+
}
|
|
2740
|
+
if (props.maxValues === void 0) {
|
|
2741
|
+
return Infinity;
|
|
2742
|
+
}
|
|
2743
|
+
return Number(props.maxValues);
|
|
2744
|
+
});
|
|
2745
|
+
const isUnselectable = computed(() => {
|
|
2746
|
+
if (isDisabledOrReadonly.value) {
|
|
2747
|
+
return false;
|
|
2748
|
+
}
|
|
2749
|
+
if (!props.unselectable) {
|
|
2750
|
+
return false;
|
|
2751
|
+
}
|
|
2752
|
+
return Number(props.minValues) === 0 || sizeOfModelValue.value > Number(props.minValues);
|
|
2753
|
+
});
|
|
2754
|
+
const isSelectable = computed(() => {
|
|
2755
|
+
if (isDisabledOrReadonly.value) {
|
|
2756
|
+
return false;
|
|
2757
|
+
}
|
|
2758
|
+
if (!props.multiple) {
|
|
2759
|
+
return true;
|
|
2760
|
+
}
|
|
2761
|
+
return sizeOfModelValue.value < hasMaxValues.value;
|
|
2551
2762
|
});
|
|
2763
|
+
const localLoading = ref(false);
|
|
2764
|
+
const isLoading = computed(() => localLoading.value || loading.value);
|
|
2765
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
|
|
2552
2766
|
const bemCssClasses = useModifiers(
|
|
2553
2767
|
"vv-select",
|
|
2554
2768
|
modifiers,
|
|
2555
2769
|
computed(() => ({
|
|
2556
|
-
disabled: disabled.value,
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
"
|
|
2560
|
-
"icon-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2770
|
+
"disabled": disabled.value,
|
|
2771
|
+
"required": required.value,
|
|
2772
|
+
"loading": isLoading.value,
|
|
2773
|
+
"readonly": readonly.value,
|
|
2774
|
+
"icon-before": hasIconBefore.value !== void 0,
|
|
2775
|
+
"icon-after": hasIconAfter.value !== void 0,
|
|
2776
|
+
"valid": valid.value,
|
|
2777
|
+
"invalid": invalid.value,
|
|
2778
|
+
"dirty": isDirty.value,
|
|
2779
|
+
"focus": focused.value || focusedWithin.value || expanded.value,
|
|
2780
|
+
"floating": floating.value,
|
|
2781
|
+
"badges": props.badges
|
|
2567
2782
|
}))
|
|
2568
2783
|
);
|
|
2569
2784
|
const {
|
|
@@ -2572,6 +2787,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2572
2787
|
getOptionGrouped,
|
|
2573
2788
|
isOptionDisabled
|
|
2574
2789
|
} = useOptions(props);
|
|
2790
|
+
function isOptionDisabledOrNotSelectable(option) {
|
|
2791
|
+
return isOptionDisabled(option) || !isSelectable.value && !isOptionSelected(option);
|
|
2792
|
+
}
|
|
2575
2793
|
const filteredOptions = computedAsync(async () => {
|
|
2576
2794
|
var _a;
|
|
2577
2795
|
if (propsDefaults.value.searchFunction) {
|
|
@@ -2590,10 +2808,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2590
2808
|
});
|
|
2591
2809
|
});
|
|
2592
2810
|
function isOptionSelected(option) {
|
|
2593
|
-
|
|
2594
|
-
|
|
2811
|
+
const optionValue = getOptionValue(option);
|
|
2812
|
+
if (typeof optionValue === "object") {
|
|
2813
|
+
return localModelValue.value.some((item) => {
|
|
2814
|
+
if (typeof item === "object") {
|
|
2815
|
+
return JSON.stringify(item) === JSON.stringify(optionValue);
|
|
2816
|
+
}
|
|
2817
|
+
return false;
|
|
2818
|
+
});
|
|
2595
2819
|
}
|
|
2596
|
-
return
|
|
2820
|
+
return localModelValue.value.includes(optionValue);
|
|
2597
2821
|
}
|
|
2598
2822
|
const selectedOptions = computed(() => {
|
|
2599
2823
|
const options = props.options.reduce(
|
|
@@ -2612,44 +2836,38 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2612
2836
|
const hasValue = computed(() => {
|
|
2613
2837
|
return selectedOptions.value.map((option) => getOptionLabel(option)).join(props.separator);
|
|
2614
2838
|
});
|
|
2615
|
-
|
|
2839
|
+
function onClickInput() {
|
|
2616
2840
|
props.autoOpen ? expand() : toggleExpanded();
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
if (props.multiple) {
|
|
2626
|
-
if (Array.isArray(props.modelValue)) {
|
|
2627
|
-
const maxValues = Number(props.maxValues);
|
|
2628
|
-
if (props.maxValues !== void 0 && maxValues >= 0 && ((_a = props.modelValue) == null ? void 0 : _a.length) >= maxValues) {
|
|
2629
|
-
if (!contains(value, props.modelValue)) {
|
|
2630
|
-
return;
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
toReturn = contains(value, props.modelValue) ? removeFromList(value, props.modelValue) : [...props.modelValue, value];
|
|
2634
|
-
} else {
|
|
2635
|
-
toReturn = [value];
|
|
2636
|
-
}
|
|
2637
|
-
} else {
|
|
2638
|
-
if (!props.keepOpen) {
|
|
2639
|
-
collapse();
|
|
2640
|
-
}
|
|
2641
|
-
if (Array.isArray(props.modelValue)) {
|
|
2642
|
-
if (props.unselectable && props.modelValue.includes(value)) {
|
|
2643
|
-
toReturn = [];
|
|
2644
|
-
} else {
|
|
2645
|
-
toReturn = [value];
|
|
2841
|
+
}
|
|
2842
|
+
function onInput(option) {
|
|
2843
|
+
const isSelected = isOptionSelected(option);
|
|
2844
|
+
const optionValue = getOptionValue(option);
|
|
2845
|
+
if (isSelected && isUnselectable.value) {
|
|
2846
|
+
localModelValue.value = localModelValue.value.filter((item) => {
|
|
2847
|
+
if (typeof optionValue === "object" && typeof item === "object") {
|
|
2848
|
+
return JSON.stringify(item) !== JSON.stringify(optionValue);
|
|
2646
2849
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2850
|
+
return item !== optionValue;
|
|
2851
|
+
});
|
|
2852
|
+
} else if (!isSelected && isSelectable.value) {
|
|
2853
|
+
if (!props.multiple) {
|
|
2854
|
+
localModelValue.value = [];
|
|
2649
2855
|
}
|
|
2856
|
+
localModelValue.value = [...localModelValue.value, optionValue];
|
|
2650
2857
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2858
|
+
if (!props.multiple && !props.keepOpen) {
|
|
2859
|
+
collapse();
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
watch(
|
|
2863
|
+
() => props.options,
|
|
2864
|
+
(newValue) => {
|
|
2865
|
+
if ((newValue == null ? void 0 : newValue.length) && props.autoselectFirst && !isDirty.value) {
|
|
2866
|
+
onInput(newValue[0]);
|
|
2867
|
+
}
|
|
2868
|
+
},
|
|
2869
|
+
{ immediate: true }
|
|
2870
|
+
);
|
|
2653
2871
|
const selectProps = computed(() => ({
|
|
2654
2872
|
id: hasId.value,
|
|
2655
2873
|
name: props.name,
|
|
@@ -2670,7 +2888,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2670
2888
|
icon: propsDefaults.value.icon,
|
|
2671
2889
|
iconPosition: propsDefaults.value.iconPosition,
|
|
2672
2890
|
floating: propsDefaults.value.floating,
|
|
2673
|
-
unselectable:
|
|
2891
|
+
unselectable: isUnselectable.value,
|
|
2892
|
+
autoselectFirst: propsDefaults.value.autoselectFirst,
|
|
2674
2893
|
multiple: propsDefaults.value.multiple,
|
|
2675
2894
|
label: propsDefaults.value.label,
|
|
2676
2895
|
placeholder: propsDefaults.value.placeholder,
|
|
@@ -2720,208 +2939,307 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2720
2939
|
key: 0,
|
|
2721
2940
|
id: unref(hasLabelId),
|
|
2722
2941
|
for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
|
|
2723
|
-
}, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("", true),
|
|
2724
|
-
createElementVNode(
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
"
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
unref(
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
disabled: unref(isOptionDisabled)(item)
|
|
2827
|
-
})), () => [
|
|
2828
|
-
createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
|
|
2829
|
-
])
|
|
2830
|
-
]),
|
|
2831
|
-
_: 2
|
|
2832
|
-
}, 1040, ["onClickPassive"]);
|
|
2833
|
-
}), 128))
|
|
2834
|
-
], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
|
|
2835
|
-
selected: isOptionSelected(option),
|
|
2836
|
-
disabled: unref(isOptionDisabled)(option),
|
|
2837
|
-
unselectable: _ctx.unselectable,
|
|
2838
|
-
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
2839
|
-
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
2840
|
-
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
2841
|
-
}, {
|
|
2842
|
-
class: "vv-dropdown-option",
|
|
2843
|
-
onClickPassive: ($event) => onInput(option)
|
|
2844
|
-
}), {
|
|
2845
|
-
default: withCtx(() => [
|
|
2846
|
-
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
2847
|
-
option,
|
|
2848
|
-
selectedOptions: unref(selectedOptions),
|
|
2849
|
-
selected: isOptionSelected(option),
|
|
2850
|
-
disabled: unref(isOptionDisabled)(option)
|
|
2851
|
-
})), () => [
|
|
2852
|
-
createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
|
|
2853
|
-
])
|
|
2854
|
-
]),
|
|
2855
|
-
_: 2
|
|
2856
|
-
}, 1040, ["onClickPassive"]))
|
|
2857
|
-
], 64);
|
|
2858
|
-
}), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
|
|
2859
|
-
key: 1,
|
|
2860
|
-
modifiers: "inert"
|
|
2861
|
-
}, {
|
|
2862
|
-
default: withCtx(() => [
|
|
2863
|
-
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
2864
|
-
createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
|
|
2865
|
-
])
|
|
2866
|
-
]),
|
|
2867
|
-
_: 3
|
|
2868
|
-
})) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$6, {
|
|
2869
|
-
key: 2,
|
|
2870
|
-
modifiers: "inert"
|
|
2871
|
-
}, {
|
|
2872
|
-
default: withCtx(() => [
|
|
2873
|
-
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
2874
|
-
createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
|
|
2942
|
+
}, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
2943
|
+
createElementVNode(
|
|
2944
|
+
"div",
|
|
2945
|
+
{
|
|
2946
|
+
ref_key: "wrapperEl",
|
|
2947
|
+
ref: wrapperEl,
|
|
2948
|
+
class: "vv-select__wrapper"
|
|
2949
|
+
},
|
|
2950
|
+
[
|
|
2951
|
+
createVNode(_sfc_main$5, mergeProps({
|
|
2952
|
+
ref_key: "dropdownEl",
|
|
2953
|
+
ref: dropdownEl,
|
|
2954
|
+
modelValue: unref(expanded),
|
|
2955
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(expanded) ? expanded.value = $event : null)
|
|
2956
|
+
}, unref(dropdownProps), {
|
|
2957
|
+
role: unref(DropdownRole).listbox,
|
|
2958
|
+
onAfterExpand,
|
|
2959
|
+
onAfterCollapse
|
|
2960
|
+
}), createSlots({
|
|
2961
|
+
default: withCtx(({ aria }) => [
|
|
2962
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
2963
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2964
|
+
])) : createCommentVNode("v-if", true),
|
|
2965
|
+
createElementVNode("div", _hoisted_5, [
|
|
2966
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2967
|
+
_sfc_main$7,
|
|
2968
|
+
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
|
|
2969
|
+
null,
|
|
2970
|
+
16
|
|
2971
|
+
/* FULL_PROPS */
|
|
2972
|
+
)) : createCommentVNode("v-if", true),
|
|
2973
|
+
createElementVNode("div", mergeProps({
|
|
2974
|
+
ref_key: "inputEl",
|
|
2975
|
+
ref: inputEl
|
|
2976
|
+
}, aria, {
|
|
2977
|
+
class: "vv-select__input",
|
|
2978
|
+
role: "combobox",
|
|
2979
|
+
"aria-controls": unref(hasDropdownId),
|
|
2980
|
+
"aria-expanded": unref(expanded),
|
|
2981
|
+
"aria-labelledby": unref(hasLabelId),
|
|
2982
|
+
"aria-describedby": unref(hasHintLabelOrSlot) ? unref(hasHintId) : void 0,
|
|
2983
|
+
"aria-errormessage": unref(hasInvalidLabelOrSlot) ? unref(hasHintId) : void 0,
|
|
2984
|
+
tabindex: unref(hasTabindex),
|
|
2985
|
+
onClickPassive: onClickInput
|
|
2986
|
+
}), [
|
|
2987
|
+
renderSlot(_ctx.$slots, "value", normalizeProps(guardReactiveProps({ selectedOptions: unref(selectedOptions), onInput })), () => [
|
|
2988
|
+
unref(hasValue) ? (openBlock(), createElementBlock(
|
|
2989
|
+
Fragment,
|
|
2990
|
+
{ key: 0 },
|
|
2991
|
+
[
|
|
2992
|
+
!_ctx.badges ? (openBlock(), createElementBlock(
|
|
2993
|
+
"div",
|
|
2994
|
+
_hoisted_7,
|
|
2995
|
+
toDisplayString(unref(hasValue)),
|
|
2996
|
+
1
|
|
2997
|
+
/* TEXT */
|
|
2998
|
+
)) : (openBlock(true), createElementBlock(
|
|
2999
|
+
Fragment,
|
|
3000
|
+
{ key: 1 },
|
|
3001
|
+
renderList(unref(selectedOptions), (option, index) => {
|
|
3002
|
+
return openBlock(), createBlock(_sfc_main$9, {
|
|
3003
|
+
key: index,
|
|
3004
|
+
modifiers: _ctx.badgeModifiers,
|
|
3005
|
+
class: "vv-select__badge"
|
|
3006
|
+
}, {
|
|
3007
|
+
default: withCtx(() => [
|
|
3008
|
+
createTextVNode(
|
|
3009
|
+
toDisplayString(unref(getOptionLabel)(option)) + " ",
|
|
3010
|
+
1
|
|
3011
|
+
/* TEXT */
|
|
3012
|
+
),
|
|
3013
|
+
unref(isUnselectable) ? (openBlock(), createElementBlock("button", {
|
|
3014
|
+
key: 0,
|
|
3015
|
+
"aria-label": unref(propsDefaults).deselectActionLabel,
|
|
3016
|
+
type: "button",
|
|
3017
|
+
onClick: withModifiers(($event) => onInput(option), ["stop"])
|
|
3018
|
+
}, [
|
|
3019
|
+
createVNode(_sfc_main$7, { name: "close" })
|
|
3020
|
+
], 8, _hoisted_8)) : createCommentVNode("v-if", true)
|
|
3021
|
+
]),
|
|
3022
|
+
_: 2
|
|
3023
|
+
/* DYNAMIC */
|
|
3024
|
+
}, 1032, ["modifiers"]);
|
|
3025
|
+
}),
|
|
3026
|
+
128
|
|
3027
|
+
/* KEYED_FRAGMENT */
|
|
3028
|
+
))
|
|
3029
|
+
],
|
|
3030
|
+
64
|
|
3031
|
+
/* STABLE_FRAGMENT */
|
|
3032
|
+
)) : (openBlock(), createElementBlock(
|
|
3033
|
+
Fragment,
|
|
3034
|
+
{ key: 1 },
|
|
3035
|
+
[
|
|
3036
|
+
createTextVNode(
|
|
3037
|
+
toDisplayString(_ctx.placeholder),
|
|
3038
|
+
1
|
|
3039
|
+
/* TEXT */
|
|
3040
|
+
)
|
|
3041
|
+
],
|
|
3042
|
+
64
|
|
3043
|
+
/* STABLE_FRAGMENT */
|
|
3044
|
+
))
|
|
2875
3045
|
])
|
|
2876
|
-
]),
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
3046
|
+
], 16, _hoisted_6),
|
|
3047
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
3048
|
+
_sfc_main$7,
|
|
3049
|
+
mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
|
|
3050
|
+
null,
|
|
3051
|
+
16
|
|
3052
|
+
/* FULL_PROPS */
|
|
3053
|
+
)) : createCommentVNode("v-if", true)
|
|
3054
|
+
]),
|
|
3055
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
3056
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3057
|
+
])) : createCommentVNode("v-if", true)
|
|
3058
|
+
]),
|
|
3059
|
+
items: withCtx(() => {
|
|
2883
3060
|
var _a;
|
|
2884
3061
|
return [
|
|
2885
|
-
((_a = unref(
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
3062
|
+
!unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(
|
|
3063
|
+
Fragment,
|
|
3064
|
+
{ key: 0 },
|
|
3065
|
+
renderList(unref(filteredOptions), (option, index) => {
|
|
3066
|
+
return openBlock(), createElementBlock(
|
|
3067
|
+
Fragment,
|
|
3068
|
+
{ key: index },
|
|
3069
|
+
[
|
|
3070
|
+
isGroup(option) ? (openBlock(), createElementBlock(
|
|
3071
|
+
Fragment,
|
|
3072
|
+
{ key: 0 },
|
|
3073
|
+
[
|
|
3074
|
+
createVNode(_sfc_main$4, {
|
|
3075
|
+
label: unref(getOptionLabel)(option)
|
|
3076
|
+
}, null, 8, ["label"]),
|
|
3077
|
+
(openBlock(true), createElementBlock(
|
|
3078
|
+
Fragment,
|
|
3079
|
+
null,
|
|
3080
|
+
renderList(unref(getOptionGrouped)(
|
|
3081
|
+
option
|
|
3082
|
+
), (item, i) => {
|
|
3083
|
+
return openBlock(), createBlock(_sfc_main$2, mergeProps({ ref_for: true }, {
|
|
3084
|
+
selected: isOptionSelected(item),
|
|
3085
|
+
disabled: isOptionDisabledOrNotSelectable(item),
|
|
3086
|
+
unselectable: unref(isUnselectable),
|
|
3087
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3088
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3089
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3090
|
+
}, {
|
|
3091
|
+
key: i,
|
|
3092
|
+
class: "vv-dropdown-option",
|
|
3093
|
+
"focus-on-hover": "",
|
|
3094
|
+
onClickPassive: ($event) => onInput(item)
|
|
3095
|
+
}), {
|
|
3096
|
+
default: withCtx(() => [
|
|
3097
|
+
renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, {
|
|
3098
|
+
option,
|
|
3099
|
+
selectedOptions: unref(selectedOptions),
|
|
3100
|
+
selected: isOptionSelected(item),
|
|
3101
|
+
disabled: isOptionDisabledOrNotSelectable(item)
|
|
3102
|
+
}), () => [
|
|
3103
|
+
createTextVNode(
|
|
3104
|
+
toDisplayString(unref(getOptionLabel)(item)),
|
|
3105
|
+
1
|
|
3106
|
+
/* TEXT */
|
|
3107
|
+
)
|
|
3108
|
+
])
|
|
3109
|
+
]),
|
|
3110
|
+
_: 2
|
|
3111
|
+
/* DYNAMIC */
|
|
3112
|
+
}, 1040, ["onClickPassive"]);
|
|
3113
|
+
}),
|
|
3114
|
+
128
|
|
3115
|
+
/* KEYED_FRAGMENT */
|
|
3116
|
+
))
|
|
3117
|
+
],
|
|
3118
|
+
64
|
|
3119
|
+
/* STABLE_FRAGMENT */
|
|
3120
|
+
)) : (openBlock(), createBlock(_sfc_main$2, mergeProps({
|
|
3121
|
+
key: 1,
|
|
3122
|
+
ref_for: true
|
|
3123
|
+
}, {
|
|
3124
|
+
selected: isOptionSelected(option),
|
|
3125
|
+
disabled: isOptionDisabledOrNotSelectable(option),
|
|
3126
|
+
unselectable: unref(isUnselectable),
|
|
3127
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3128
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3129
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3130
|
+
}, {
|
|
3131
|
+
class: "vv-dropdown-option",
|
|
3132
|
+
"focus-on-hover": "",
|
|
3133
|
+
onClickPassive: ($event) => onInput(option)
|
|
3134
|
+
}), {
|
|
3135
|
+
default: withCtx(() => [
|
|
3136
|
+
renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, {
|
|
3137
|
+
option,
|
|
3138
|
+
selectedOptions: unref(selectedOptions),
|
|
3139
|
+
selected: isOptionSelected(option),
|
|
3140
|
+
disabled: isOptionDisabledOrNotSelectable(option)
|
|
3141
|
+
}), () => [
|
|
3142
|
+
createTextVNode(
|
|
3143
|
+
toDisplayString(unref(getOptionLabel)(option)),
|
|
3144
|
+
1
|
|
3145
|
+
/* TEXT */
|
|
3146
|
+
)
|
|
3147
|
+
])
|
|
3148
|
+
]),
|
|
3149
|
+
_: 2
|
|
3150
|
+
/* DYNAMIC */
|
|
3151
|
+
}, 1040, ["onClickPassive"]))
|
|
3152
|
+
],
|
|
3153
|
+
64
|
|
3154
|
+
/* STABLE_FRAGMENT */
|
|
3155
|
+
);
|
|
3156
|
+
}),
|
|
3157
|
+
128
|
|
3158
|
+
/* KEYED_FRAGMENT */
|
|
3159
|
+
)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$2, {
|
|
3160
|
+
key: 1,
|
|
3161
|
+
modifiers: "inert"
|
|
3162
|
+
}, {
|
|
3163
|
+
default: withCtx(() => [
|
|
3164
|
+
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
3165
|
+
createTextVNode(
|
|
3166
|
+
toDisplayString(unref(propsDefaults).noOptionsLabel),
|
|
3167
|
+
1
|
|
3168
|
+
/* TEXT */
|
|
3169
|
+
)
|
|
3170
|
+
])
|
|
3171
|
+
]),
|
|
3172
|
+
_: 3
|
|
3173
|
+
/* FORWARDED */
|
|
3174
|
+
})) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$2, {
|
|
3175
|
+
key: 2,
|
|
3176
|
+
modifiers: "inert"
|
|
3177
|
+
}, {
|
|
3178
|
+
default: withCtx(() => [
|
|
3179
|
+
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
3180
|
+
createTextVNode(
|
|
3181
|
+
toDisplayString(unref(propsDefaults).noResultsLabel),
|
|
3182
|
+
1
|
|
3183
|
+
/* TEXT */
|
|
3184
|
+
)
|
|
3185
|
+
])
|
|
3186
|
+
]),
|
|
3187
|
+
_: 3
|
|
3188
|
+
/* FORWARDED */
|
|
3189
|
+
})) : createCommentVNode("v-if", true)
|
|
2891
3190
|
];
|
|
2892
|
-
})
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchText) ? searchText.value = $event : null),
|
|
2906
|
-
"aria-autocomplete": "list",
|
|
2907
|
-
"aria-controls": unref(hasDropdownId),
|
|
2908
|
-
autocomplete: "off",
|
|
2909
|
-
spellcheck: "false",
|
|
2910
|
-
type: "search",
|
|
2911
|
-
class: "vv-dropdown__search",
|
|
2912
|
-
placeholder: unref(propsDefaults).searchPlaceholder
|
|
2913
|
-
}, null, 8, _hoisted_3)), [
|
|
2914
|
-
[vModelText, unref(searchText)]
|
|
2915
|
-
]) : createCommentVNode("", true)
|
|
3191
|
+
}),
|
|
3192
|
+
after: withCtx(() => [
|
|
3193
|
+
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
3194
|
+
var _a;
|
|
3195
|
+
return [
|
|
3196
|
+
((_a = unref(dropdownEl)) == null ? void 0 : _a.customPosition) ? (openBlock(), createBlock(_sfc_main$6, {
|
|
3197
|
+
key: 0,
|
|
3198
|
+
label: unref(propsDefaults).closeLabel,
|
|
3199
|
+
modifiers: "secondary",
|
|
3200
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(dropdownEl).hide())
|
|
3201
|
+
}, null, 8, ["label"])) : createCommentVNode("v-if", true)
|
|
3202
|
+
];
|
|
3203
|
+
})
|
|
2916
3204
|
]),
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
3205
|
+
_: 2
|
|
3206
|
+
/* DYNAMIC */
|
|
3207
|
+
}, [
|
|
3208
|
+
unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
|
|
3209
|
+
name: "before",
|
|
3210
|
+
fn: withCtx(() => [
|
|
3211
|
+
renderSlot(_ctx.$slots, "dropdown::before"),
|
|
3212
|
+
unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3213
|
+
key: 0,
|
|
3214
|
+
id: unref(hasSearchId),
|
|
3215
|
+
ref_key: "inputSearchEl",
|
|
3216
|
+
ref: inputSearchEl,
|
|
3217
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchText) ? searchText.value = $event : null),
|
|
3218
|
+
"aria-autocomplete": "list",
|
|
3219
|
+
"aria-controls": unref(hasDropdownId),
|
|
3220
|
+
autocomplete: "off",
|
|
3221
|
+
spellcheck: "false",
|
|
3222
|
+
type: "search",
|
|
3223
|
+
class: "vv-dropdown__search",
|
|
3224
|
+
placeholder: unref(propsDefaults).searchPlaceholder
|
|
3225
|
+
}, null, 8, _hoisted_3)), [
|
|
3226
|
+
[vModelText, unref(searchText)]
|
|
3227
|
+
]) : createCommentVNode("v-if", true)
|
|
3228
|
+
]),
|
|
3229
|
+
key: "0"
|
|
3230
|
+
} : void 0
|
|
3231
|
+
]), 1040, ["modelValue", "role"])
|
|
3232
|
+
],
|
|
3233
|
+
512
|
|
3234
|
+
/* NEED_PATCH */
|
|
3235
|
+
),
|
|
2921
3236
|
createVNode(unref(HintSlot), {
|
|
2922
3237
|
id: unref(hasHintId),
|
|
2923
3238
|
class: "vv-select__hint"
|
|
2924
|
-
}, createSlots({
|
|
3239
|
+
}, createSlots({
|
|
3240
|
+
_: 2
|
|
3241
|
+
/* DYNAMIC */
|
|
3242
|
+
}, [
|
|
2925
3243
|
_ctx.$slots.hint ? {
|
|
2926
3244
|
name: "hint",
|
|
2927
3245
|
fn: withCtx(() => [
|
|
@@ -2951,9 +3269,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2951
3269
|
key: "3"
|
|
2952
3270
|
} : void 0
|
|
2953
3271
|
]), 1032, ["id"])
|
|
2954
|
-
], 10, _hoisted_1)) : (openBlock(), createBlock(
|
|
2955
|
-
|
|
2956
|
-
|
|
3272
|
+
], 10, _hoisted_1)) : (openBlock(), createBlock(
|
|
3273
|
+
_sfc_main$1,
|
|
3274
|
+
mergeProps({ key: 1 }, unref(selectProps), {
|
|
3275
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => emit("update:modelValue", $event))
|
|
3276
|
+
}),
|
|
3277
|
+
null,
|
|
3278
|
+
16
|
|
3279
|
+
/* FULL_PROPS */
|
|
3280
|
+
));
|
|
2957
3281
|
};
|
|
2958
3282
|
}
|
|
2959
3283
|
});
|