@volverjs/ui-vue 0.0.10-beta.5 → 0.0.10-beta.50
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 +2304 -1992
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +258 -672
- package/dist/components/VvCombobox/index.d.ts +377 -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 +1491 -551
- 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 +606 -597
- 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 +4086 -2029
- 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 +277 -193
- 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 +655 -619
- package/src/components/VvCombobox/index.ts +210 -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 +652 -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 +461 -384
- 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,8 +1,9 @@
|
|
|
1
|
-
import { unref, computed, isRef, defineComponent, h,
|
|
1
|
+
import { unref, computed, isRef, defineComponent, h, useId, provide, Fragment, ref, toRefs, useAttrs, onMounted, watch, nextTick, openBlock, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, mergeProps, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, createCommentVNode, vShow, inject, createBlock, createTextVNode, toDisplayString, mergeDefaults, useSlots, withModifiers, createSlots, renderList } from "vue";
|
|
2
2
|
import { useIMask } from "vue-imask";
|
|
3
|
+
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
4
|
+
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useStorage, useElementVisibility } from "@vueuse/core";
|
|
5
|
+
import mitt from "mitt";
|
|
3
6
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
4
|
-
import { uid } from "uid";
|
|
5
|
-
import { useFocus, useElementVisibility } from "@vueuse/core";
|
|
6
7
|
function isEmpty(value) {
|
|
7
8
|
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));
|
|
8
9
|
}
|
|
@@ -127,100 +128,11 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
127
128
|
HintSlot
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Width
|
|
137
|
-
*/
|
|
138
|
-
width: {
|
|
139
|
-
type: [String, Number]
|
|
140
|
-
},
|
|
141
|
-
/**
|
|
142
|
-
* Height
|
|
143
|
-
*/
|
|
144
|
-
height: {
|
|
145
|
-
type: [String, Number]
|
|
146
|
-
},
|
|
147
|
-
/**
|
|
148
|
-
* Icon name
|
|
149
|
-
* Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
|
|
150
|
-
* https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
151
|
-
*/
|
|
152
|
-
name: {
|
|
153
|
-
type: String,
|
|
154
|
-
required: true
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* By default 'vv'
|
|
158
|
-
* If custom collection is not added with "addCollection" DS class method, this prop could not be used
|
|
159
|
-
* Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
160
|
-
*/
|
|
161
|
-
provider: {
|
|
162
|
-
type: String
|
|
163
|
-
},
|
|
164
|
-
/**
|
|
165
|
-
* The name of icon set.
|
|
166
|
-
* Icon default options prefix: simple | normal | detailed
|
|
167
|
-
*/
|
|
168
|
-
prefix: {
|
|
169
|
-
type: String,
|
|
170
|
-
default: "normal"
|
|
171
|
-
},
|
|
172
|
-
/**
|
|
173
|
-
* Url remote SVG icon
|
|
174
|
-
*/
|
|
175
|
-
src: String,
|
|
176
|
-
/**
|
|
177
|
-
* Horizontal flip
|
|
178
|
-
*/
|
|
179
|
-
horizontalFlip: Boolean,
|
|
180
|
-
/**
|
|
181
|
-
* Vertical flip
|
|
182
|
-
*/
|
|
183
|
-
verticalFlip: Boolean,
|
|
184
|
-
/**
|
|
185
|
-
* String alternative to "horizontalFlip" and "verticalFlip".
|
|
186
|
-
* Example: https://docs.iconify.design/icon-components/vue/transform.html
|
|
187
|
-
*/
|
|
188
|
-
flip: String,
|
|
189
|
-
/**
|
|
190
|
-
* Icon render mode
|
|
191
|
-
* 'style' = 'bg' or 'mask', depending on icon content
|
|
192
|
-
* 'bg' = span with style using `background`
|
|
193
|
-
* 'mask' = span with style using `mask`
|
|
194
|
-
* 'svg' = svg
|
|
195
|
-
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
196
|
-
*/
|
|
197
|
-
mode: String,
|
|
198
|
-
/**
|
|
199
|
-
* Toggles inline or block mode
|
|
200
|
-
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
201
|
-
*/
|
|
202
|
-
inline: Boolean,
|
|
203
|
-
/**
|
|
204
|
-
* rotates icon
|
|
205
|
-
* Example https://docs.iconify.design/icon-components/vue/transform.html
|
|
206
|
-
*/
|
|
207
|
-
rotate: [Number, String],
|
|
208
|
-
/**
|
|
209
|
-
* A callback that is called when icon data has been loaded
|
|
210
|
-
*/
|
|
211
|
-
onLoad: Function,
|
|
212
|
-
/**
|
|
213
|
-
* SVG icon string
|
|
214
|
-
*/
|
|
215
|
-
svg: String,
|
|
216
|
-
/**
|
|
217
|
-
* Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
|
|
218
|
-
* @values string | string[]
|
|
219
|
-
*/
|
|
220
|
-
modifiers: {
|
|
221
|
-
type: [String, Array]
|
|
222
|
-
}
|
|
223
|
-
};
|
|
131
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
132
|
+
StorageType2["local"] = "local";
|
|
133
|
+
StorageType2["session"] = "session";
|
|
134
|
+
return StorageType2;
|
|
135
|
+
})(StorageType || {});
|
|
224
136
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
225
137
|
Strategy2["absolute"] = "absolute";
|
|
226
138
|
Strategy2["fixed"] = "fixed";
|
|
@@ -255,136 +167,39 @@ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
|
255
167
|
ButtonType2["reset"] = "reset";
|
|
256
168
|
return ButtonType2;
|
|
257
169
|
})(ButtonType || {});
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return
|
|
264
|
-
})(
|
|
170
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
171
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
172
|
+
ActionTag2["routerLink"] = "router-link";
|
|
173
|
+
ActionTag2["a"] = "a";
|
|
174
|
+
ActionTag2["button"] = "button";
|
|
175
|
+
return ActionTag2;
|
|
176
|
+
})(ActionTag || {});
|
|
177
|
+
var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
|
|
178
|
+
ActionRoles2["button"] = "button";
|
|
179
|
+
ActionRoles2["link"] = "link";
|
|
180
|
+
ActionRoles2["menuitem"] = "menuitem";
|
|
181
|
+
return ActionRoles2;
|
|
182
|
+
})(ActionRoles || {});
|
|
183
|
+
var DropdownRole = /* @__PURE__ */ ((DropdownRole2) => {
|
|
184
|
+
DropdownRole2["listbox"] = "listbox";
|
|
185
|
+
DropdownRole2["menu"] = "menu";
|
|
186
|
+
return DropdownRole2;
|
|
187
|
+
})(DropdownRole || {});
|
|
188
|
+
var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
|
|
189
|
+
DropdownItemRole2["option"] = "option";
|
|
190
|
+
DropdownItemRole2["presentation"] = "presentation";
|
|
191
|
+
return DropdownItemRole2;
|
|
192
|
+
})(DropdownItemRole || {});
|
|
265
193
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
if (modifiersArray) {
|
|
276
|
-
if (Array.isArray(modifiersArray)) {
|
|
277
|
-
modifiersArray.forEach((modifier) => {
|
|
278
|
-
if (modifier) {
|
|
279
|
-
toReturn[`${prefix}--${modifier}`] = true;
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
if (others) {
|
|
285
|
-
Object.keys(others.value).forEach((key) => {
|
|
286
|
-
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
return toReturn;
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
const __default__$1 = {
|
|
293
|
-
name: "VvIcon"
|
|
294
|
-
};
|
|
295
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
296
|
-
...__default__$1,
|
|
297
|
-
props: VvIconProps,
|
|
298
|
-
setup(__props) {
|
|
299
|
-
const props = __props;
|
|
300
|
-
const hasRotate = computed(() => {
|
|
301
|
-
if (typeof props.rotate === "string") {
|
|
302
|
-
return parseFloat(props.rotate);
|
|
303
|
-
}
|
|
304
|
-
return props.rotate;
|
|
305
|
-
});
|
|
306
|
-
const show = ref(true);
|
|
307
|
-
const volver = useVolver();
|
|
308
|
-
const { modifiers } = toRefs(props);
|
|
309
|
-
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
310
|
-
const provider = computed(() => {
|
|
311
|
-
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
312
|
-
});
|
|
313
|
-
const icon = computed(() => {
|
|
314
|
-
const name = props.name ?? "";
|
|
315
|
-
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
316
|
-
if (iconExists(iconName)) {
|
|
317
|
-
return iconName;
|
|
318
|
-
}
|
|
319
|
-
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
320
|
-
(iconsCollection2) => {
|
|
321
|
-
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
322
|
-
return iconExists(icon2);
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
if (iconsCollection) {
|
|
326
|
-
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
327
|
-
}
|
|
328
|
-
return name;
|
|
329
|
-
});
|
|
330
|
-
function getSvgContent(svg) {
|
|
331
|
-
let dom;
|
|
332
|
-
if (typeof window === "undefined") {
|
|
333
|
-
const { JSDOM } = require("jsdom");
|
|
334
|
-
dom = new JSDOM().window;
|
|
335
|
-
}
|
|
336
|
-
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
337
|
-
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
338
|
-
const svgEl = svgDomString.querySelector("svg");
|
|
339
|
-
return svgEl;
|
|
340
|
-
}
|
|
341
|
-
function addIconFromSvg(svg) {
|
|
342
|
-
const svgContentEl = getSvgContent(svg);
|
|
343
|
-
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
344
|
-
if (svgContentEl && svgContent) {
|
|
345
|
-
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
346
|
-
body: svgContent,
|
|
347
|
-
// Set height and width from svg content
|
|
348
|
-
height: svgContentEl.viewBox.baseVal.height,
|
|
349
|
-
width: svgContentEl.viewBox.baseVal.width
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
if (volver) {
|
|
354
|
-
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
355
|
-
show.value = false;
|
|
356
|
-
volver.fetchIcon(props.src).then((svg) => {
|
|
357
|
-
if (svg) {
|
|
358
|
-
addIconFromSvg(svg);
|
|
359
|
-
show.value = true;
|
|
360
|
-
}
|
|
361
|
-
}).catch((e) => {
|
|
362
|
-
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
if (props.svg) {
|
|
367
|
-
addIconFromSvg(props.svg);
|
|
368
|
-
}
|
|
369
|
-
return (_ctx, _cache) => {
|
|
370
|
-
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
371
|
-
key: 0,
|
|
372
|
-
class: unref(bemCssClasses)
|
|
373
|
-
}, {
|
|
374
|
-
inline: _ctx.inline,
|
|
375
|
-
width: _ctx.width,
|
|
376
|
-
height: _ctx.height,
|
|
377
|
-
horizontalFlip: _ctx.horizontalFlip,
|
|
378
|
-
verticalFlip: _ctx.verticalFlip,
|
|
379
|
-
flip: _ctx.flip,
|
|
380
|
-
rotate: unref(hasRotate),
|
|
381
|
-
color: _ctx.color,
|
|
382
|
-
onLoad: _ctx.onLoad,
|
|
383
|
-
icon: unref(icon)
|
|
384
|
-
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
});
|
|
194
|
+
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
195
|
+
"dropdownTrigger"
|
|
196
|
+
);
|
|
197
|
+
const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for(
|
|
198
|
+
"dropdownItem"
|
|
199
|
+
);
|
|
200
|
+
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
|
|
201
|
+
"dropdownAction"
|
|
202
|
+
);
|
|
388
203
|
const LinkProps = {
|
|
389
204
|
/**
|
|
390
205
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
@@ -400,10 +215,7 @@ const LinkProps = {
|
|
|
400
215
|
/**
|
|
401
216
|
* Anchor target
|
|
402
217
|
*/
|
|
403
|
-
target:
|
|
404
|
-
type: String,
|
|
405
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
406
|
-
},
|
|
218
|
+
target: String,
|
|
407
219
|
/**
|
|
408
220
|
* Anchor rel
|
|
409
221
|
*/
|
|
@@ -416,27 +228,33 @@ const ValidProps = {
|
|
|
416
228
|
/**
|
|
417
229
|
* Valid status
|
|
418
230
|
*/
|
|
419
|
-
valid: Boolean,
|
|
231
|
+
valid: { type: Boolean, default: false },
|
|
420
232
|
/**
|
|
421
233
|
* Valid label
|
|
422
234
|
*/
|
|
423
|
-
validLabel: [String, Array]
|
|
235
|
+
validLabel: { type: [String, Array], default: void 0 }
|
|
424
236
|
};
|
|
425
237
|
const InvalidProps = {
|
|
426
238
|
/**
|
|
427
239
|
* Invalid status
|
|
428
240
|
*/
|
|
429
|
-
invalid:
|
|
241
|
+
invalid: {
|
|
242
|
+
type: Boolean,
|
|
243
|
+
default: false
|
|
244
|
+
},
|
|
430
245
|
/**
|
|
431
246
|
* Invalid label
|
|
432
247
|
*/
|
|
433
|
-
invalidLabel: [String, Array]
|
|
248
|
+
invalidLabel: { type: [String, Array], default: void 0 }
|
|
434
249
|
};
|
|
435
250
|
const LoadingProps = {
|
|
436
251
|
/**
|
|
437
252
|
* Loading status
|
|
438
253
|
*/
|
|
439
|
-
loading:
|
|
254
|
+
loading: {
|
|
255
|
+
type: Boolean,
|
|
256
|
+
default: false
|
|
257
|
+
},
|
|
440
258
|
/**
|
|
441
259
|
* Loading label
|
|
442
260
|
*/
|
|
@@ -449,43 +267,73 @@ const DisabledProps = {
|
|
|
449
267
|
/**
|
|
450
268
|
* Whether the form control is disabled
|
|
451
269
|
*/
|
|
452
|
-
disabled:
|
|
270
|
+
disabled: {
|
|
271
|
+
type: Boolean,
|
|
272
|
+
default: false
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
const SelectedProps = {
|
|
276
|
+
/**
|
|
277
|
+
* Whether the item is selected
|
|
278
|
+
*/
|
|
279
|
+
selected: {
|
|
280
|
+
type: Boolean,
|
|
281
|
+
default: false
|
|
282
|
+
}
|
|
453
283
|
};
|
|
454
284
|
const ActiveProps = {
|
|
455
285
|
/**
|
|
456
286
|
* Whether the item is active
|
|
457
287
|
*/
|
|
458
|
-
active:
|
|
288
|
+
active: {
|
|
289
|
+
type: Boolean,
|
|
290
|
+
default: false
|
|
291
|
+
}
|
|
459
292
|
};
|
|
460
293
|
const CurrentProps = {
|
|
461
294
|
/**
|
|
462
295
|
* Whether the item is current
|
|
463
296
|
*/
|
|
464
|
-
current:
|
|
297
|
+
current: {
|
|
298
|
+
type: Boolean,
|
|
299
|
+
default: false
|
|
300
|
+
}
|
|
465
301
|
};
|
|
466
302
|
const PressedProps = {
|
|
467
303
|
/**
|
|
468
304
|
* Whether the item is pressed
|
|
469
305
|
*/
|
|
470
|
-
pressed:
|
|
306
|
+
pressed: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
default: false
|
|
309
|
+
}
|
|
471
310
|
};
|
|
472
311
|
const LabelProps = {
|
|
473
312
|
/**
|
|
474
313
|
* The item label
|
|
475
314
|
*/
|
|
476
|
-
label:
|
|
315
|
+
label: {
|
|
316
|
+
type: [String, Number],
|
|
317
|
+
default: void 0
|
|
318
|
+
}
|
|
477
319
|
};
|
|
478
320
|
const ReadonlyProps = {
|
|
479
321
|
/**
|
|
480
322
|
* The value is not editable
|
|
481
323
|
*/
|
|
482
|
-
readonly:
|
|
324
|
+
readonly: {
|
|
325
|
+
type: Boolean,
|
|
326
|
+
default: false
|
|
327
|
+
}
|
|
483
328
|
};
|
|
484
329
|
const ModifiersProps = {
|
|
485
330
|
/**
|
|
486
331
|
* Component BEM modifiers
|
|
487
332
|
*/
|
|
488
|
-
modifiers:
|
|
333
|
+
modifiers: {
|
|
334
|
+
type: [String, Array],
|
|
335
|
+
default: void 0
|
|
336
|
+
}
|
|
489
337
|
};
|
|
490
338
|
const HintProps = {
|
|
491
339
|
hintLabel: { type: String, default: "" }
|
|
@@ -504,14 +352,20 @@ const DebounceProps = {
|
|
|
504
352
|
/**
|
|
505
353
|
* Milliseconds to wait before emitting the input event
|
|
506
354
|
*/
|
|
507
|
-
debounce:
|
|
355
|
+
debounce: {
|
|
356
|
+
type: [Number, String],
|
|
357
|
+
default: void 0
|
|
358
|
+
}
|
|
508
359
|
};
|
|
509
360
|
const IconProps = {
|
|
510
361
|
/**
|
|
511
362
|
* VvIcon name or props
|
|
512
363
|
* @see VVIcon
|
|
513
364
|
*/
|
|
514
|
-
icon: {
|
|
365
|
+
icon: {
|
|
366
|
+
type: [String, Object],
|
|
367
|
+
default: void 0
|
|
368
|
+
},
|
|
515
369
|
/**
|
|
516
370
|
* VvIcon position
|
|
517
371
|
*/
|
|
@@ -532,7 +386,16 @@ const FloatingLabelProps = {
|
|
|
532
386
|
/**
|
|
533
387
|
* If true the label will be floating
|
|
534
388
|
*/
|
|
535
|
-
floating:
|
|
389
|
+
floating: {
|
|
390
|
+
type: Boolean,
|
|
391
|
+
default: false
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
const UnselectableProps = {
|
|
395
|
+
/**
|
|
396
|
+
* If true the input will be unselectable
|
|
397
|
+
*/
|
|
398
|
+
unselectable: { type: Boolean, default: true }
|
|
536
399
|
};
|
|
537
400
|
const IdProps = {
|
|
538
401
|
/**
|
|
@@ -541,7 +404,7 @@ const IdProps = {
|
|
|
541
404
|
*/
|
|
542
405
|
id: [String, Number]
|
|
543
406
|
};
|
|
544
|
-
|
|
407
|
+
const DropdownProps = {
|
|
545
408
|
/**
|
|
546
409
|
* Dropdown placement
|
|
547
410
|
*/
|
|
@@ -562,7 +425,8 @@ const IdProps = {
|
|
|
562
425
|
* Dropdown show / hide transition name
|
|
563
426
|
*/
|
|
564
427
|
transitionName: {
|
|
565
|
-
type: String
|
|
428
|
+
type: String,
|
|
429
|
+
default: void 0
|
|
566
430
|
},
|
|
567
431
|
/**
|
|
568
432
|
* Offset of the dropdown from the trigger
|
|
@@ -630,9 +494,10 @@ const IdProps = {
|
|
|
630
494
|
* Set dropdown width to the same as the trigger
|
|
631
495
|
*/
|
|
632
496
|
triggerWidth: {
|
|
633
|
-
type: Boolean
|
|
497
|
+
type: Boolean,
|
|
498
|
+
default: false
|
|
634
499
|
}
|
|
635
|
-
}
|
|
500
|
+
};
|
|
636
501
|
const IdNameProps = {
|
|
637
502
|
...IdProps,
|
|
638
503
|
/**
|
|
@@ -647,7 +512,10 @@ const AutofocusProps = {
|
|
|
647
512
|
* Global attribute autofocus
|
|
648
513
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
649
514
|
*/
|
|
650
|
-
autofocus:
|
|
515
|
+
autofocus: {
|
|
516
|
+
type: Boolean,
|
|
517
|
+
default: false
|
|
518
|
+
}
|
|
651
519
|
};
|
|
652
520
|
const AutocompleteProps = {
|
|
653
521
|
/**
|
|
@@ -679,28 +547,34 @@ const InputTextareaProps = {
|
|
|
679
547
|
* Available for input types: text, search, url, tel, email, password
|
|
680
548
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
681
549
|
*/
|
|
682
|
-
minlength: [String, Number],
|
|
550
|
+
minlength: { type: [String, Number], default: void 0 },
|
|
683
551
|
/**
|
|
684
552
|
* Input / Textarea maxlength
|
|
685
553
|
* Maximum length (number of characters) of value
|
|
686
554
|
* Available for input types: text, search, url, tel, email, password
|
|
687
555
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
688
556
|
*/
|
|
689
|
-
maxlength: [String, Number],
|
|
557
|
+
maxlength: { type: [String, Number], default: void 0 },
|
|
690
558
|
/**
|
|
691
559
|
* Input / Textarea placeholder
|
|
692
560
|
* Text that appears in the form control when it has no value set
|
|
693
561
|
* Available for input types: text, search, url, tel, email, password, number
|
|
694
562
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
|
|
695
563
|
*/
|
|
696
|
-
placeholder:
|
|
564
|
+
placeholder: {
|
|
565
|
+
type: String,
|
|
566
|
+
default: void 0
|
|
567
|
+
},
|
|
697
568
|
/**
|
|
698
569
|
* Input / Textarea required
|
|
699
570
|
* A value is required or must be check for the form to be submittable
|
|
700
571
|
* Available for all input types except color
|
|
701
572
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
|
|
702
573
|
*/
|
|
703
|
-
required:
|
|
574
|
+
required: {
|
|
575
|
+
type: Boolean,
|
|
576
|
+
default: false
|
|
577
|
+
}
|
|
704
578
|
};
|
|
705
579
|
({
|
|
706
580
|
...DisabledProps,
|
|
@@ -723,41 +597,839 @@ const InputTextareaProps = {
|
|
|
723
597
|
ariaLabel: {
|
|
724
598
|
type: String,
|
|
725
599
|
default: void 0
|
|
600
|
+
},
|
|
601
|
+
/**
|
|
602
|
+
* Default tag for the action
|
|
603
|
+
*/
|
|
604
|
+
defaultTag: {
|
|
605
|
+
type: String,
|
|
606
|
+
default: ActionTag.button
|
|
726
607
|
}
|
|
727
608
|
});
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
COLOR: "color",
|
|
736
|
-
SEARCH: "search",
|
|
737
|
-
DATE: "date",
|
|
738
|
-
TIME: "time",
|
|
739
|
-
DATETIME_LOCAL: "datetime-local",
|
|
740
|
-
MONTH: "month",
|
|
741
|
-
WEEK: "week"
|
|
742
|
-
};
|
|
743
|
-
const TYPES_ICON = {
|
|
744
|
-
PASSWORD_SHOW: "eye-on",
|
|
745
|
-
PASSWORD_HIDE: "eye-off",
|
|
746
|
-
DATE: "calendar",
|
|
747
|
-
TIME: "time",
|
|
748
|
-
COLOR: "color",
|
|
749
|
-
SEARCH: "close"
|
|
609
|
+
const StorageProps = {
|
|
610
|
+
storageType: {
|
|
611
|
+
type: String,
|
|
612
|
+
default: StorageType.local,
|
|
613
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
614
|
+
},
|
|
615
|
+
storageKey: String
|
|
750
616
|
};
|
|
751
|
-
const
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
617
|
+
const VvDropdownProps = {
|
|
618
|
+
...IdProps,
|
|
619
|
+
...DropdownProps,
|
|
620
|
+
...ModifiersProps,
|
|
621
|
+
/**
|
|
622
|
+
* Show / hide dropdown programmatically
|
|
623
|
+
*/
|
|
624
|
+
modelValue: {
|
|
625
|
+
type: Boolean,
|
|
626
|
+
default: void 0
|
|
627
|
+
},
|
|
628
|
+
/**
|
|
629
|
+
* Dropdown trigger element
|
|
630
|
+
*/
|
|
631
|
+
reference: {
|
|
632
|
+
type: Object,
|
|
633
|
+
default: null
|
|
634
|
+
},
|
|
635
|
+
/**
|
|
636
|
+
* Dropdown role
|
|
637
|
+
*/
|
|
638
|
+
role: {
|
|
639
|
+
type: String,
|
|
640
|
+
default: DropdownRole.menu,
|
|
641
|
+
validator: (value) => Object.values(DropdownRole).includes(value)
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const VvDropdownItemProps = {
|
|
645
|
+
focusOnHover: {
|
|
646
|
+
type: Boolean,
|
|
647
|
+
default: false
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const VvDropdownOptionProps = {
|
|
651
|
+
...DisabledProps,
|
|
652
|
+
...SelectedProps,
|
|
653
|
+
...UnselectableProps,
|
|
654
|
+
...ModifiersProps,
|
|
655
|
+
deselectHintLabel: {
|
|
656
|
+
type: String
|
|
657
|
+
},
|
|
658
|
+
selectHintLabel: {
|
|
659
|
+
type: String
|
|
660
|
+
},
|
|
661
|
+
selectedHintLabel: {
|
|
662
|
+
type: String
|
|
663
|
+
},
|
|
664
|
+
focusOnHover: {
|
|
665
|
+
type: Boolean,
|
|
666
|
+
default: false
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
function useUniqueId(id) {
|
|
670
|
+
return computed(() => String((id == null ? void 0 : id.value) || useId()));
|
|
671
|
+
}
|
|
672
|
+
function useDropdownProvideTrigger({
|
|
673
|
+
reference,
|
|
674
|
+
id,
|
|
675
|
+
expanded,
|
|
676
|
+
aria
|
|
677
|
+
}) {
|
|
678
|
+
const bus = mitt();
|
|
679
|
+
const component = defineComponent({
|
|
680
|
+
name: "VvDropdownTriggerProvider",
|
|
681
|
+
setup() {
|
|
682
|
+
provide(INJECTION_KEY_DROPDOWN_TRIGGER, {
|
|
683
|
+
reference,
|
|
684
|
+
id,
|
|
685
|
+
expanded,
|
|
686
|
+
aria,
|
|
687
|
+
bus
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
render() {
|
|
691
|
+
var _a, _b;
|
|
692
|
+
return h(Fragment, {}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
return {
|
|
696
|
+
bus,
|
|
697
|
+
component
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function useDropdownProvideItem({
|
|
701
|
+
role,
|
|
702
|
+
...others
|
|
703
|
+
}) {
|
|
704
|
+
const itemRole = computed(
|
|
705
|
+
() => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
|
|
706
|
+
);
|
|
707
|
+
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
708
|
+
role: itemRole,
|
|
709
|
+
...others
|
|
710
|
+
});
|
|
711
|
+
return { itemRole };
|
|
712
|
+
}
|
|
713
|
+
function useDropdownProvideAction({
|
|
714
|
+
expanded
|
|
715
|
+
}) {
|
|
716
|
+
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
717
|
+
role: ref(ActionRoles.menuitem),
|
|
718
|
+
expanded
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
function useModifiers(prefix, modifiers, others) {
|
|
722
|
+
return computed(() => {
|
|
723
|
+
const toReturn = {
|
|
724
|
+
[prefix]: true
|
|
725
|
+
};
|
|
726
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
727
|
+
if (modifiersArray) {
|
|
728
|
+
if (Array.isArray(modifiersArray)) {
|
|
729
|
+
modifiersArray.forEach((modifier) => {
|
|
730
|
+
if (modifier) {
|
|
731
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
if (others) {
|
|
737
|
+
Object.keys(others.value).forEach((key) => {
|
|
738
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
return toReturn;
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
const _hoisted_1$2 = ["id", "tabindex", "role", "aria-labelledby"];
|
|
745
|
+
const __default__$4 = {
|
|
746
|
+
name: "VvDropdown",
|
|
747
|
+
inheritAttrs: false
|
|
748
|
+
};
|
|
749
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
750
|
+
...__default__$4,
|
|
751
|
+
props: VvDropdownProps,
|
|
752
|
+
emits: [
|
|
753
|
+
"update:modelValue",
|
|
754
|
+
"beforeEnter",
|
|
755
|
+
"afterLeave",
|
|
756
|
+
"beforeExpand",
|
|
757
|
+
"beforeCollapse",
|
|
758
|
+
"afterExpand",
|
|
759
|
+
"afterCollapse",
|
|
760
|
+
"before-enter",
|
|
761
|
+
"after-leave",
|
|
762
|
+
"enter",
|
|
763
|
+
"afterEnter",
|
|
764
|
+
"enterCancelled",
|
|
765
|
+
"beforeLeave",
|
|
766
|
+
"leave",
|
|
767
|
+
"leaveCancelled"
|
|
768
|
+
],
|
|
769
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
770
|
+
const props = __props;
|
|
771
|
+
const emit = __emit;
|
|
772
|
+
const { id } = toRefs(props);
|
|
773
|
+
const hasId = useUniqueId(id);
|
|
774
|
+
const attrs = useAttrs();
|
|
775
|
+
const maxWidth = ref("auto");
|
|
776
|
+
const maxHeight = ref("auto");
|
|
777
|
+
const localReferenceEl = ref();
|
|
778
|
+
const floatingEl = ref();
|
|
779
|
+
const arrowEl = ref();
|
|
780
|
+
const listEl = ref();
|
|
781
|
+
const referenceEl = computed({
|
|
782
|
+
get: () => props.reference ?? localReferenceEl.value,
|
|
783
|
+
set: (newValue) => {
|
|
784
|
+
localReferenceEl.value = newValue;
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
const hasCustomPosition = ref(false);
|
|
788
|
+
onMounted(() => {
|
|
789
|
+
useMutationObserver(
|
|
790
|
+
floatingEl.value,
|
|
791
|
+
() => {
|
|
792
|
+
var _a;
|
|
793
|
+
hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
attributeFilter: ["style"],
|
|
797
|
+
window
|
|
798
|
+
}
|
|
799
|
+
);
|
|
800
|
+
});
|
|
801
|
+
const middleware = computed(() => {
|
|
802
|
+
const toReturn = [];
|
|
803
|
+
if (props.autoPlacement) {
|
|
804
|
+
if (typeof props.autoPlacement === "boolean") {
|
|
805
|
+
toReturn.push(autoPlacement());
|
|
806
|
+
} else {
|
|
807
|
+
toReturn.push(
|
|
808
|
+
autoPlacement(props.autoPlacement)
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
} else if (props.flip) {
|
|
812
|
+
if (typeof props.flip === "boolean") {
|
|
813
|
+
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
814
|
+
} else {
|
|
815
|
+
toReturn.push(flip(props.flip));
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
if (props.shift) {
|
|
819
|
+
if (typeof props.shift === "boolean") {
|
|
820
|
+
toReturn.push(shift());
|
|
821
|
+
} else {
|
|
822
|
+
toReturn.push(shift(props.shift));
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (props.size) {
|
|
826
|
+
const apply = ({
|
|
827
|
+
availableWidth,
|
|
828
|
+
availableHeight
|
|
829
|
+
}) => {
|
|
830
|
+
maxWidth.value = `${availableWidth}px`;
|
|
831
|
+
maxHeight.value = `${availableHeight}px`;
|
|
832
|
+
};
|
|
833
|
+
if (typeof props.size === "boolean") {
|
|
834
|
+
toReturn.push(
|
|
835
|
+
size({
|
|
836
|
+
apply
|
|
837
|
+
})
|
|
838
|
+
);
|
|
839
|
+
} else {
|
|
840
|
+
toReturn.push(
|
|
841
|
+
size({
|
|
842
|
+
...props.size,
|
|
843
|
+
apply
|
|
844
|
+
})
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
if (props.offset) {
|
|
849
|
+
toReturn.push(offset(Number(props.offset)));
|
|
850
|
+
if (["string", "number"].includes(typeof props.offset)) {
|
|
851
|
+
toReturn.push(offset(Number(props.offset)));
|
|
852
|
+
} else {
|
|
853
|
+
toReturn.push(offset(props.offset));
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if (props.arrow) {
|
|
857
|
+
toReturn.push(
|
|
858
|
+
arrow({
|
|
859
|
+
element: arrowEl
|
|
860
|
+
})
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
return toReturn;
|
|
864
|
+
});
|
|
865
|
+
const { x, y, middlewareData, placement, strategy } = useFloating(
|
|
866
|
+
referenceEl,
|
|
867
|
+
floatingEl,
|
|
868
|
+
{
|
|
869
|
+
whileElementsMounted: (...args) => {
|
|
870
|
+
return autoUpdate(...args, {
|
|
871
|
+
animationFrame: props.strategy === Strategy.fixed
|
|
872
|
+
});
|
|
873
|
+
},
|
|
874
|
+
placement: computed(() => props.placement),
|
|
875
|
+
strategy: computed(() => props.strategy),
|
|
876
|
+
middleware
|
|
877
|
+
}
|
|
878
|
+
);
|
|
879
|
+
const dropdownPlacement = computed(() => {
|
|
880
|
+
var _a;
|
|
881
|
+
if (hasCustomPosition.value) {
|
|
882
|
+
return void 0;
|
|
883
|
+
}
|
|
884
|
+
const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
|
|
885
|
+
return {
|
|
886
|
+
position: strategy.value,
|
|
887
|
+
top: `${y.value ?? 0}px`,
|
|
888
|
+
left: `${x.value ?? 0}px`,
|
|
889
|
+
maxWidth: width ? void 0 : maxWidth.value,
|
|
890
|
+
maxHeight: maxHeight.value,
|
|
891
|
+
width
|
|
892
|
+
};
|
|
893
|
+
});
|
|
894
|
+
const side = computed(
|
|
895
|
+
() => placement.value.split("-")[0]
|
|
896
|
+
);
|
|
897
|
+
const arrowPlacement = computed(() => {
|
|
898
|
+
var _a, _b, _c, _d, _e;
|
|
899
|
+
if (hasCustomPosition.value) {
|
|
900
|
+
return void 0;
|
|
901
|
+
}
|
|
902
|
+
const staticSide = {
|
|
903
|
+
[Side.top]: Side.bottom,
|
|
904
|
+
[Side.right]: Side.left,
|
|
905
|
+
[Side.bottom]: Side.top,
|
|
906
|
+
[Side.left]: Side.right
|
|
907
|
+
}[side.value];
|
|
908
|
+
return {
|
|
909
|
+
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
910
|
+
top: ((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) !== void 0 ? `${(_d = middlewareData.value.arrow) == null ? void 0 : _d.y}px` : void 0,
|
|
911
|
+
[staticSide]: `${-(((_e = arrowEl.value) == null ? void 0 : _e.offsetWidth) ?? 0) / 2}px`
|
|
912
|
+
};
|
|
913
|
+
});
|
|
914
|
+
const modelValue = useVModel(props, "modelValue", emit);
|
|
915
|
+
const localModelValue = ref(false);
|
|
916
|
+
const expanded = computed({
|
|
917
|
+
get: () => modelValue.value ?? localModelValue.value,
|
|
918
|
+
set: (newValue) => {
|
|
919
|
+
if (modelValue.value === void 0) {
|
|
920
|
+
localModelValue.value = newValue;
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
modelValue.value = newValue;
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
function show() {
|
|
927
|
+
expanded.value = true;
|
|
928
|
+
}
|
|
929
|
+
function hide() {
|
|
930
|
+
expanded.value = false;
|
|
931
|
+
}
|
|
932
|
+
function toggle() {
|
|
933
|
+
expanded.value = !expanded.value;
|
|
934
|
+
}
|
|
935
|
+
function init(el) {
|
|
936
|
+
referenceEl.value = el;
|
|
937
|
+
}
|
|
938
|
+
__expose({
|
|
939
|
+
toggle,
|
|
940
|
+
show,
|
|
941
|
+
hide,
|
|
942
|
+
init,
|
|
943
|
+
customPosition: hasCustomPosition
|
|
944
|
+
});
|
|
945
|
+
watch(expanded, (newValue) => {
|
|
946
|
+
if (newValue && props.autofocusFirst) {
|
|
947
|
+
nextTick(() => {
|
|
948
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
949
|
+
floatingEl.value
|
|
950
|
+
);
|
|
951
|
+
if (focusableElements.length > 0) {
|
|
952
|
+
focusableElements[0].focus({
|
|
953
|
+
preventScroll: true
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
onClickOutside(
|
|
960
|
+
floatingEl,
|
|
961
|
+
() => {
|
|
962
|
+
if (!props.keepOpen && expanded.value) {
|
|
963
|
+
expanded.value = false;
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
{ ignore: [referenceEl] }
|
|
967
|
+
);
|
|
968
|
+
const hasAriaLabelledby = computed(() => {
|
|
969
|
+
var _a, _b;
|
|
970
|
+
return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
|
|
971
|
+
});
|
|
972
|
+
const referenceAria = computed(() => ({
|
|
973
|
+
"aria-controls": hasId.value,
|
|
974
|
+
"aria-haspopup": true,
|
|
975
|
+
"aria-expanded": expanded.value
|
|
976
|
+
}));
|
|
977
|
+
const { component: VvDropdownTriggerProvider, bus } = useDropdownProvideTrigger({
|
|
978
|
+
reference: referenceEl,
|
|
979
|
+
id: hasId,
|
|
980
|
+
expanded,
|
|
981
|
+
aria: referenceAria
|
|
982
|
+
});
|
|
983
|
+
bus.on("click", toggle);
|
|
984
|
+
const { role, modifiers } = toRefs(props);
|
|
985
|
+
const bemCssClasses = useModifiers(
|
|
986
|
+
"vv-dropdown",
|
|
987
|
+
modifiers,
|
|
988
|
+
computed(() => ({
|
|
989
|
+
arrow: props.arrow
|
|
990
|
+
}))
|
|
991
|
+
);
|
|
992
|
+
const { focused } = useFocusWithin(floatingEl);
|
|
993
|
+
function getKeyboardFocusableElements(element) {
|
|
994
|
+
if (!element) {
|
|
995
|
+
return [];
|
|
996
|
+
}
|
|
997
|
+
return [
|
|
998
|
+
...element.querySelectorAll(
|
|
999
|
+
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
1000
|
+
)
|
|
1001
|
+
].filter(
|
|
1002
|
+
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
function focusNext() {
|
|
1006
|
+
nextTick(() => {
|
|
1007
|
+
if (focused.value) {
|
|
1008
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
1009
|
+
floatingEl.value
|
|
1010
|
+
);
|
|
1011
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
1015
|
+
document.activeElement
|
|
1016
|
+
);
|
|
1017
|
+
if (activeElementIndex < focusableElements.length - 1) {
|
|
1018
|
+
focusableElements[activeElementIndex + 1].focus({
|
|
1019
|
+
preventScroll: true
|
|
1020
|
+
});
|
|
1021
|
+
} else {
|
|
1022
|
+
focusableElements[0].focus({
|
|
1023
|
+
preventScroll: true
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
function focusPrev() {
|
|
1030
|
+
nextTick(() => {
|
|
1031
|
+
if (focused.value) {
|
|
1032
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
1033
|
+
floatingEl.value
|
|
1034
|
+
);
|
|
1035
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
1039
|
+
document.activeElement
|
|
1040
|
+
);
|
|
1041
|
+
if (activeElementIndex > 0) {
|
|
1042
|
+
focusableElements[activeElementIndex - 1].focus({
|
|
1043
|
+
preventScroll: true
|
|
1044
|
+
});
|
|
1045
|
+
} else {
|
|
1046
|
+
focusableElements[focusableElements.length - 1].focus({
|
|
1047
|
+
preventScroll: true
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
const hovered = useElementHover(floatingEl);
|
|
1054
|
+
const { itemRole } = useDropdownProvideItem({
|
|
1055
|
+
role,
|
|
1056
|
+
expanded,
|
|
1057
|
+
focused,
|
|
1058
|
+
hovered
|
|
1059
|
+
});
|
|
1060
|
+
onKeyStroke("Escape", (e) => {
|
|
1061
|
+
if (expanded.value) {
|
|
1062
|
+
e.preventDefault();
|
|
1063
|
+
hide();
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
onKeyStroke("ArrowDown", (e) => {
|
|
1067
|
+
if (expanded.value && focused.value) {
|
|
1068
|
+
e.preventDefault();
|
|
1069
|
+
focusNext();
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
onKeyStroke("ArrowUp", (e) => {
|
|
1073
|
+
if (expanded.value && focused.value) {
|
|
1074
|
+
e.preventDefault();
|
|
1075
|
+
focusPrev();
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
onKeyStroke([" ", "Enter"], (e) => {
|
|
1079
|
+
const htmlEl = e.target;
|
|
1080
|
+
if (expanded.value && focused.value && htmlEl) {
|
|
1081
|
+
htmlEl == null ? void 0 : htmlEl.click();
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
const dropdownTransitionHandlers = {
|
|
1085
|
+
"before-enter": () => {
|
|
1086
|
+
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
1087
|
+
emit("beforeEnter");
|
|
1088
|
+
},
|
|
1089
|
+
"after-leave": () => {
|
|
1090
|
+
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
1091
|
+
emit("afterLeave");
|
|
1092
|
+
},
|
|
1093
|
+
"enter": () => {
|
|
1094
|
+
emit("enter");
|
|
1095
|
+
},
|
|
1096
|
+
"after-enter": () => {
|
|
1097
|
+
emit("afterEnter");
|
|
1098
|
+
},
|
|
1099
|
+
"enter-cancelled": () => {
|
|
1100
|
+
emit("enterCancelled");
|
|
1101
|
+
},
|
|
1102
|
+
"before-leave": () => {
|
|
1103
|
+
emit("beforeLeave");
|
|
1104
|
+
},
|
|
1105
|
+
"leave": () => {
|
|
1106
|
+
emit("leave");
|
|
1107
|
+
},
|
|
1108
|
+
"leave-cancelled": () => {
|
|
1109
|
+
emit("leaveCancelled");
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
return (_ctx, _cache) => {
|
|
1113
|
+
return openBlock(), createElementBlock(
|
|
1114
|
+
Fragment,
|
|
1115
|
+
null,
|
|
1116
|
+
[
|
|
1117
|
+
createVNode(unref(VvDropdownTriggerProvider), null, {
|
|
1118
|
+
default: withCtx(() => [
|
|
1119
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
|
|
1120
|
+
]),
|
|
1121
|
+
_: 3
|
|
1122
|
+
/* FORWARDED */
|
|
1123
|
+
}),
|
|
1124
|
+
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers), { persisted: "" }), {
|
|
1125
|
+
default: withCtx(() => [
|
|
1126
|
+
withDirectives(createElementVNode(
|
|
1127
|
+
"div",
|
|
1128
|
+
{
|
|
1129
|
+
ref_key: "floatingEl",
|
|
1130
|
+
ref: floatingEl,
|
|
1131
|
+
style: normalizeStyle(unref(dropdownPlacement)),
|
|
1132
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
1133
|
+
},
|
|
1134
|
+
[
|
|
1135
|
+
props.arrow ? (openBlock(), createElementBlock(
|
|
1136
|
+
"div",
|
|
1137
|
+
{
|
|
1138
|
+
key: 0,
|
|
1139
|
+
ref_key: "arrowEl",
|
|
1140
|
+
ref: arrowEl,
|
|
1141
|
+
style: normalizeStyle(unref(arrowPlacement)),
|
|
1142
|
+
class: "vv-dropdown__arrow"
|
|
1143
|
+
},
|
|
1144
|
+
null,
|
|
1145
|
+
4
|
|
1146
|
+
/* STYLE */
|
|
1147
|
+
)) : createCommentVNode("v-if", true),
|
|
1148
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
|
|
1149
|
+
createElementVNode("div", mergeProps(unref(attrs), {
|
|
1150
|
+
id: unref(hasId),
|
|
1151
|
+
ref_key: "listEl",
|
|
1152
|
+
ref: listEl,
|
|
1153
|
+
tabindex: !unref(expanded) ? -1 : void 0,
|
|
1154
|
+
role: unref(role),
|
|
1155
|
+
"aria-labelledby": unref(hasAriaLabelledby),
|
|
1156
|
+
class: "vv-dropdown__list"
|
|
1157
|
+
}), [
|
|
1158
|
+
renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
|
|
1159
|
+
role: unref(itemRole)
|
|
1160
|
+
})))
|
|
1161
|
+
], 16, _hoisted_1$2),
|
|
1162
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
|
|
1163
|
+
],
|
|
1164
|
+
6
|
|
1165
|
+
/* CLASS, STYLE */
|
|
1166
|
+
), [
|
|
1167
|
+
[vShow, unref(expanded)]
|
|
1168
|
+
])
|
|
1169
|
+
]),
|
|
1170
|
+
_: 3
|
|
1171
|
+
/* FORWARDED */
|
|
1172
|
+
}, 16, ["name"])
|
|
1173
|
+
],
|
|
1174
|
+
64
|
|
1175
|
+
/* STABLE_FRAGMENT */
|
|
1176
|
+
);
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
function useInjectedDropdownItem() {
|
|
1181
|
+
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
1182
|
+
}
|
|
1183
|
+
const __default__$3 = {
|
|
1184
|
+
name: "VvDropdownItem"
|
|
1185
|
+
};
|
|
1186
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1187
|
+
...__default__$3,
|
|
1188
|
+
props: VvDropdownItemProps,
|
|
1189
|
+
setup(__props) {
|
|
1190
|
+
const props = __props;
|
|
1191
|
+
const { role, expanded } = useInjectedDropdownItem();
|
|
1192
|
+
const element = ref(null);
|
|
1193
|
+
useDropdownProvideAction({ expanded });
|
|
1194
|
+
const hovered = useElementHover(element);
|
|
1195
|
+
const { focused } = useFocus(element);
|
|
1196
|
+
const { focused: focusedWithin } = useFocusWithin(element);
|
|
1197
|
+
watch(hovered, (newValue) => {
|
|
1198
|
+
if (newValue && props.focusOnHover) {
|
|
1199
|
+
focused.value = true;
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
return (_ctx, _cache) => {
|
|
1203
|
+
return openBlock(), createElementBlock(
|
|
1204
|
+
"div",
|
|
1205
|
+
mergeProps({ role: unref(role) }, {
|
|
1206
|
+
ref_key: "element",
|
|
1207
|
+
ref: element,
|
|
1208
|
+
class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
|
|
1209
|
+
}),
|
|
1210
|
+
[
|
|
1211
|
+
renderSlot(_ctx.$slots, "default")
|
|
1212
|
+
],
|
|
1213
|
+
16
|
|
1214
|
+
/* FULL_PROPS */
|
|
1215
|
+
);
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
const _hoisted_1$1 = ["title"];
|
|
1220
|
+
const __default__$2 = {
|
|
1221
|
+
name: "VvDropdownOption"
|
|
1222
|
+
};
|
|
1223
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1224
|
+
...__default__$2,
|
|
1225
|
+
props: VvDropdownOptionProps,
|
|
1226
|
+
setup(__props) {
|
|
1227
|
+
const props = __props;
|
|
1228
|
+
const { modifiers } = toRefs(props);
|
|
1229
|
+
const bemCssClasses = useModifiers(
|
|
1230
|
+
"vv-dropdown-option",
|
|
1231
|
+
modifiers,
|
|
1232
|
+
computed(() => ({
|
|
1233
|
+
disabled: props.disabled,
|
|
1234
|
+
selected: props.selected,
|
|
1235
|
+
unselectable: props.unselectable && props.selected
|
|
1236
|
+
}))
|
|
1237
|
+
);
|
|
1238
|
+
const hintLabel = computed(() => {
|
|
1239
|
+
if (props.selected) {
|
|
1240
|
+
return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
|
|
1241
|
+
}
|
|
1242
|
+
if (!props.disabled) {
|
|
1243
|
+
return props.selectHintLabel;
|
|
1244
|
+
}
|
|
1245
|
+
return "";
|
|
1246
|
+
});
|
|
1247
|
+
return (_ctx, _cache) => {
|
|
1248
|
+
return openBlock(), createBlock(_sfc_main$3, {
|
|
1249
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
1250
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
1251
|
+
"aria-selected": _ctx.selected,
|
|
1252
|
+
"aria-disabled": _ctx.disabled,
|
|
1253
|
+
"focus-on-hover": _ctx.focusOnHover
|
|
1254
|
+
}, {
|
|
1255
|
+
default: withCtx(() => [
|
|
1256
|
+
renderSlot(_ctx.$slots, "default"),
|
|
1257
|
+
createElementVNode("span", {
|
|
1258
|
+
class: "vv-dropdown-option__hint",
|
|
1259
|
+
title: unref(hintLabel)
|
|
1260
|
+
}, [
|
|
1261
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
|
|
1262
|
+
createTextVNode(
|
|
1263
|
+
toDisplayString(unref(hintLabel)),
|
|
1264
|
+
1
|
|
1265
|
+
/* TEXT */
|
|
1266
|
+
)
|
|
1267
|
+
])
|
|
1268
|
+
], 8, _hoisted_1$1)
|
|
1269
|
+
]),
|
|
1270
|
+
_: 3
|
|
1271
|
+
/* FORWARDED */
|
|
1272
|
+
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
const ACTION_ICONS = {
|
|
1277
|
+
showPassword: "eye-on",
|
|
1278
|
+
hidePassword: "eye-off",
|
|
1279
|
+
showDatePicker: "calendar",
|
|
1280
|
+
showTimePicker: "time",
|
|
1281
|
+
showColorPicker: "color",
|
|
1282
|
+
clear: "close",
|
|
1283
|
+
add: "add",
|
|
1284
|
+
remove: "trash",
|
|
1285
|
+
edit: "edit",
|
|
1286
|
+
download: "download"
|
|
1287
|
+
};
|
|
1288
|
+
const VvIconPropsDefaults = {
|
|
1289
|
+
prefix: "normal"
|
|
1290
|
+
/* normal */
|
|
1291
|
+
};
|
|
1292
|
+
function useVolver() {
|
|
1293
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
1294
|
+
}
|
|
1295
|
+
const __default__$1 = {
|
|
1296
|
+
name: "VvIcon"
|
|
1297
|
+
};
|
|
1298
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1299
|
+
...__default__$1,
|
|
1300
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
1301
|
+
name: {},
|
|
1302
|
+
color: {},
|
|
1303
|
+
width: {},
|
|
1304
|
+
height: {},
|
|
1305
|
+
provider: {},
|
|
1306
|
+
prefix: {},
|
|
1307
|
+
src: {},
|
|
1308
|
+
horizontalFlip: { type: Boolean },
|
|
1309
|
+
verticalFlip: { type: Boolean },
|
|
1310
|
+
flip: {},
|
|
1311
|
+
mode: {},
|
|
1312
|
+
inline: { type: Boolean },
|
|
1313
|
+
rotate: {},
|
|
1314
|
+
onLoad: { type: Function },
|
|
1315
|
+
svg: {},
|
|
1316
|
+
modifiers: {}
|
|
1317
|
+
}, VvIconPropsDefaults),
|
|
1318
|
+
setup(__props) {
|
|
1319
|
+
const props = __props;
|
|
1320
|
+
const hasRotate = computed(() => {
|
|
1321
|
+
if (typeof props.rotate === "string") {
|
|
1322
|
+
return Number.parseFloat(props.rotate);
|
|
1323
|
+
}
|
|
1324
|
+
return props.rotate;
|
|
1325
|
+
});
|
|
1326
|
+
const show = ref(true);
|
|
1327
|
+
const volver = useVolver();
|
|
1328
|
+
const { modifiers } = toRefs(props);
|
|
1329
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
1330
|
+
const provider = computed(() => {
|
|
1331
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
1332
|
+
});
|
|
1333
|
+
const icon = computed(() => {
|
|
1334
|
+
const name = props.name ?? "";
|
|
1335
|
+
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
1336
|
+
if (iconExists(iconName)) {
|
|
1337
|
+
return iconName;
|
|
1338
|
+
}
|
|
1339
|
+
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
1340
|
+
(iconsCollection2) => {
|
|
1341
|
+
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
1342
|
+
return iconExists(icon2);
|
|
1343
|
+
}
|
|
1344
|
+
);
|
|
1345
|
+
if (iconsCollection) {
|
|
1346
|
+
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
1347
|
+
}
|
|
1348
|
+
return name;
|
|
1349
|
+
});
|
|
1350
|
+
function getSvgContent(svg) {
|
|
1351
|
+
let dom;
|
|
1352
|
+
if (typeof window === "undefined") {
|
|
1353
|
+
const { JSDOM } = require("jsdom");
|
|
1354
|
+
dom = new JSDOM().window;
|
|
1355
|
+
}
|
|
1356
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
1357
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
1358
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
1359
|
+
return svgEl;
|
|
1360
|
+
}
|
|
1361
|
+
function addIconFromSvg(svg) {
|
|
1362
|
+
const svgContentEl = getSvgContent(svg);
|
|
1363
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
1364
|
+
if (svgContentEl && svgContent) {
|
|
1365
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
1366
|
+
body: svgContent,
|
|
1367
|
+
// Set height and width from svg content
|
|
1368
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
1369
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
if (volver) {
|
|
1374
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
1375
|
+
show.value = false;
|
|
1376
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
1377
|
+
if (svg) {
|
|
1378
|
+
addIconFromSvg(svg);
|
|
1379
|
+
show.value = true;
|
|
1380
|
+
}
|
|
1381
|
+
}).catch((e) => {
|
|
1382
|
+
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
if (props.svg) {
|
|
1387
|
+
addIconFromSvg(props.svg);
|
|
1388
|
+
}
|
|
1389
|
+
return (_ctx, _cache) => {
|
|
1390
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
1391
|
+
key: 0,
|
|
1392
|
+
class: unref(bemCssClasses)
|
|
1393
|
+
}, {
|
|
1394
|
+
inline: _ctx.inline,
|
|
1395
|
+
width: _ctx.width,
|
|
1396
|
+
height: _ctx.height,
|
|
1397
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
1398
|
+
verticalFlip: _ctx.verticalFlip,
|
|
1399
|
+
flip: _ctx.flip,
|
|
1400
|
+
rotate: unref(hasRotate),
|
|
1401
|
+
color: _ctx.color,
|
|
1402
|
+
onLoad: _ctx.onLoad,
|
|
1403
|
+
icon: unref(icon)
|
|
1404
|
+
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
const INPUT_TYPES = {
|
|
1409
|
+
TEXT: "text",
|
|
1410
|
+
PASSWORD: "password",
|
|
1411
|
+
NUMBER: "number",
|
|
1412
|
+
EMAIL: "email",
|
|
1413
|
+
TEL: "tel",
|
|
1414
|
+
URL: "url",
|
|
1415
|
+
COLOR: "color",
|
|
1416
|
+
SEARCH: "search",
|
|
1417
|
+
DATE: "date",
|
|
1418
|
+
TIME: "time",
|
|
1419
|
+
DATETIME_LOCAL: "datetime-local",
|
|
1420
|
+
MONTH: "month",
|
|
1421
|
+
WEEK: "week"
|
|
1422
|
+
};
|
|
1423
|
+
const VvInputTextEvents = [
|
|
1424
|
+
"update:modelValue",
|
|
1425
|
+
"update:masked",
|
|
1426
|
+
"accept",
|
|
1427
|
+
"accept:typed",
|
|
1428
|
+
"accept:masked",
|
|
1429
|
+
"accept:unmasked",
|
|
1430
|
+
"complete",
|
|
1431
|
+
"complete:typed",
|
|
1432
|
+
"complete:masked",
|
|
761
1433
|
"complete:unmasked",
|
|
762
1434
|
"focus",
|
|
763
1435
|
"blur",
|
|
@@ -767,6 +1439,7 @@ const VvInputTextEvents = [
|
|
|
767
1439
|
];
|
|
768
1440
|
const VvInputTextProps = {
|
|
769
1441
|
...InputTextareaProps,
|
|
1442
|
+
...StorageProps,
|
|
770
1443
|
/**
|
|
771
1444
|
* Input value
|
|
772
1445
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
@@ -816,24 +1489,32 @@ const VvInputTextProps = {
|
|
|
816
1489
|
* @see VVIcon
|
|
817
1490
|
*/
|
|
818
1491
|
iconShowPassword: {
|
|
819
|
-
type: String,
|
|
820
|
-
default:
|
|
1492
|
+
type: [String, Object],
|
|
1493
|
+
default: ACTION_ICONS.showPassword
|
|
821
1494
|
},
|
|
822
1495
|
/**
|
|
823
1496
|
* VvIcon name for hide password button
|
|
824
1497
|
* @see VVIcon
|
|
825
1498
|
*/
|
|
826
1499
|
iconHidePassword: {
|
|
827
|
-
type: String,
|
|
828
|
-
default:
|
|
1500
|
+
type: [String, Object],
|
|
1501
|
+
default: ACTION_ICONS.hidePassword
|
|
829
1502
|
},
|
|
830
1503
|
/**
|
|
831
1504
|
* VvIcon name for clear button
|
|
832
1505
|
* @see VVIcon
|
|
833
1506
|
*/
|
|
834
1507
|
iconClear: {
|
|
835
|
-
type: String,
|
|
836
|
-
default:
|
|
1508
|
+
type: [String, Object],
|
|
1509
|
+
default: ACTION_ICONS.clear
|
|
1510
|
+
},
|
|
1511
|
+
/**
|
|
1512
|
+
* VvIcon name for remove suggestion button
|
|
1513
|
+
* @see VVIcon
|
|
1514
|
+
*/
|
|
1515
|
+
iconRemoveSuggestion: {
|
|
1516
|
+
type: [String, Object],
|
|
1517
|
+
default: ACTION_ICONS.remove
|
|
837
1518
|
},
|
|
838
1519
|
/**
|
|
839
1520
|
* Label for step up button
|
|
@@ -870,6 +1551,13 @@ const VvInputTextProps = {
|
|
|
870
1551
|
type: String,
|
|
871
1552
|
default: "Clear"
|
|
872
1553
|
},
|
|
1554
|
+
/**
|
|
1555
|
+
* Label for remove suggestion button
|
|
1556
|
+
*/
|
|
1557
|
+
labelRemoveSuggestion: {
|
|
1558
|
+
type: String,
|
|
1559
|
+
default: "Remove suggestion"
|
|
1560
|
+
},
|
|
873
1561
|
/**
|
|
874
1562
|
* iMask options
|
|
875
1563
|
* @see https://imask.js.org/guide.html
|
|
@@ -911,8 +1599,100 @@ const VvInputTextProps = {
|
|
|
911
1599
|
selectOnFocus: {
|
|
912
1600
|
type: Boolean,
|
|
913
1601
|
default: false
|
|
1602
|
+
},
|
|
1603
|
+
/**
|
|
1604
|
+
* Maximum number of suggestions
|
|
1605
|
+
*/
|
|
1606
|
+
maxSuggestions: {
|
|
1607
|
+
type: Number,
|
|
1608
|
+
default: 5
|
|
914
1609
|
}
|
|
915
1610
|
};
|
|
1611
|
+
function useComponentIcon(icon, iconPosition) {
|
|
1612
|
+
const hasIcon = computed(() => {
|
|
1613
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
1614
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
1615
|
+
}
|
|
1616
|
+
return icon == null ? void 0 : icon.value;
|
|
1617
|
+
});
|
|
1618
|
+
const hasIconBefore = computed(
|
|
1619
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
1620
|
+
);
|
|
1621
|
+
const hasIconAfter = computed(
|
|
1622
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
1623
|
+
);
|
|
1624
|
+
const hasIconLeft = computed(
|
|
1625
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
1626
|
+
);
|
|
1627
|
+
const hasIconRight = computed(
|
|
1628
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
1629
|
+
);
|
|
1630
|
+
const hasIconTop = computed(
|
|
1631
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
1632
|
+
);
|
|
1633
|
+
const hasIconBottom = computed(
|
|
1634
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
1635
|
+
);
|
|
1636
|
+
return {
|
|
1637
|
+
hasIcon,
|
|
1638
|
+
hasIconLeft,
|
|
1639
|
+
hasIconRight,
|
|
1640
|
+
hasIconTop,
|
|
1641
|
+
hasIconBottom,
|
|
1642
|
+
hasIconBefore,
|
|
1643
|
+
hasIconAfter
|
|
1644
|
+
};
|
|
1645
|
+
}
|
|
1646
|
+
const VvInputClearAction = defineComponent({
|
|
1647
|
+
components: {
|
|
1648
|
+
VvIcon: _sfc_main$1
|
|
1649
|
+
},
|
|
1650
|
+
props: {
|
|
1651
|
+
disabled: {
|
|
1652
|
+
type: Boolean,
|
|
1653
|
+
default: false
|
|
1654
|
+
},
|
|
1655
|
+
label: {
|
|
1656
|
+
type: String,
|
|
1657
|
+
default: "Clear"
|
|
1658
|
+
},
|
|
1659
|
+
icon: {
|
|
1660
|
+
type: [String, Object],
|
|
1661
|
+
default: "close"
|
|
1662
|
+
}
|
|
1663
|
+
},
|
|
1664
|
+
emits: ["clear"],
|
|
1665
|
+
setup(props, { emit }) {
|
|
1666
|
+
const { hasIcon } = useComponentIcon(computed(() => props.icon));
|
|
1667
|
+
function onClick(e) {
|
|
1668
|
+
e == null ? void 0 : e.stopPropagation();
|
|
1669
|
+
if (!props.disabled) {
|
|
1670
|
+
emit("clear");
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
return {
|
|
1674
|
+
hasIcon,
|
|
1675
|
+
onClick
|
|
1676
|
+
};
|
|
1677
|
+
},
|
|
1678
|
+
render() {
|
|
1679
|
+
const icon = this.hasIcon ? h(_sfc_main$1, {
|
|
1680
|
+
...this.hasIcon,
|
|
1681
|
+
class: "vv-input-text__icon"
|
|
1682
|
+
}) : void 0;
|
|
1683
|
+
return h(
|
|
1684
|
+
"button",
|
|
1685
|
+
{
|
|
1686
|
+
disabled: this.disabled,
|
|
1687
|
+
class: "vv-input-text__action",
|
|
1688
|
+
ariaLabel: this.label,
|
|
1689
|
+
type: "button",
|
|
1690
|
+
onClick: this.onClick
|
|
1691
|
+
},
|
|
1692
|
+
icon
|
|
1693
|
+
);
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
916
1696
|
const VvInputPasswordAction = defineComponent({
|
|
917
1697
|
components: {
|
|
918
1698
|
VvIcon: _sfc_main$1
|
|
@@ -931,12 +1711,12 @@ const VvInputPasswordAction = defineComponent({
|
|
|
931
1711
|
default: "Hide password"
|
|
932
1712
|
},
|
|
933
1713
|
iconShow: {
|
|
934
|
-
type: String,
|
|
935
|
-
default:
|
|
1714
|
+
type: [String, Object],
|
|
1715
|
+
default: ACTION_ICONS.showPassword
|
|
936
1716
|
},
|
|
937
1717
|
iconHide: {
|
|
938
|
-
type: String,
|
|
939
|
-
default:
|
|
1718
|
+
type: [String, Object],
|
|
1719
|
+
default: ACTION_ICONS.hidePassword
|
|
940
1720
|
}
|
|
941
1721
|
},
|
|
942
1722
|
emits: ["toggle-password"],
|
|
@@ -945,6 +1725,7 @@ const VvInputPasswordAction = defineComponent({
|
|
|
945
1725
|
const activeIcon = computed(
|
|
946
1726
|
() => active.value ? props.iconHide : props.iconShow
|
|
947
1727
|
);
|
|
1728
|
+
const { hasIcon } = useComponentIcon(activeIcon);
|
|
948
1729
|
function onClick(e) {
|
|
949
1730
|
e == null ? void 0 : e.stopPropagation();
|
|
950
1731
|
if (!props.disabled) {
|
|
@@ -955,14 +1736,15 @@ const VvInputPasswordAction = defineComponent({
|
|
|
955
1736
|
return {
|
|
956
1737
|
active,
|
|
957
1738
|
activeIcon,
|
|
1739
|
+
hasIcon,
|
|
958
1740
|
onClick
|
|
959
1741
|
};
|
|
960
1742
|
},
|
|
961
1743
|
render() {
|
|
962
|
-
const icon = h(_sfc_main$1, {
|
|
963
|
-
|
|
1744
|
+
const icon = this.hasIcon ? h(_sfc_main$1, {
|
|
1745
|
+
...this.hasIcon,
|
|
964
1746
|
class: "vv-input-text__icon"
|
|
965
|
-
});
|
|
1747
|
+
}) : void 0;
|
|
966
1748
|
return h(
|
|
967
1749
|
"button",
|
|
968
1750
|
{
|
|
@@ -1021,54 +1803,6 @@ const VvInputStepAction = defineComponent({
|
|
|
1021
1803
|
});
|
|
1022
1804
|
}
|
|
1023
1805
|
});
|
|
1024
|
-
const VvInputClearAction = defineComponent({
|
|
1025
|
-
components: {
|
|
1026
|
-
VvIcon: _sfc_main$1
|
|
1027
|
-
},
|
|
1028
|
-
props: {
|
|
1029
|
-
disabled: {
|
|
1030
|
-
type: Boolean,
|
|
1031
|
-
default: false
|
|
1032
|
-
},
|
|
1033
|
-
label: {
|
|
1034
|
-
type: String,
|
|
1035
|
-
default: "Clear"
|
|
1036
|
-
},
|
|
1037
|
-
icon: {
|
|
1038
|
-
type: String,
|
|
1039
|
-
default: "close"
|
|
1040
|
-
}
|
|
1041
|
-
},
|
|
1042
|
-
emits: ["clear"],
|
|
1043
|
-
setup(props, { emit }) {
|
|
1044
|
-
function onClick(e) {
|
|
1045
|
-
e == null ? void 0 : e.stopPropagation();
|
|
1046
|
-
if (!props.disabled) {
|
|
1047
|
-
emit("clear");
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
return {
|
|
1051
|
-
onClick
|
|
1052
|
-
};
|
|
1053
|
-
},
|
|
1054
|
-
render() {
|
|
1055
|
-
const icon = h(_sfc_main$1, {
|
|
1056
|
-
name: this.icon,
|
|
1057
|
-
class: "vv-input-text__icon"
|
|
1058
|
-
});
|
|
1059
|
-
return h(
|
|
1060
|
-
"button",
|
|
1061
|
-
{
|
|
1062
|
-
disabled: this.disabled,
|
|
1063
|
-
class: "vv-input-text__action",
|
|
1064
|
-
ariaLabel: this.label,
|
|
1065
|
-
type: "button",
|
|
1066
|
-
onClick: this.onClick
|
|
1067
|
-
},
|
|
1068
|
-
icon
|
|
1069
|
-
);
|
|
1070
|
-
}
|
|
1071
|
-
});
|
|
1072
1806
|
function VvInputTextActionsFactory(type, parentProps) {
|
|
1073
1807
|
return {
|
|
1074
1808
|
name: "VvInputTextActions",
|
|
@@ -1199,14 +1933,13 @@ function useDefaults(componentName, propsDefinition, props) {
|
|
|
1199
1933
|
}, {});
|
|
1200
1934
|
});
|
|
1201
1935
|
}
|
|
1202
|
-
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
|
|
1203
1936
|
function useDebouncedInput(modelValue, emit, ms = 0, {
|
|
1204
1937
|
getter = (value) => value,
|
|
1205
1938
|
setter = (value) => value
|
|
1206
1939
|
} = {}) {
|
|
1207
1940
|
let timeout;
|
|
1208
1941
|
if (typeof ms === "string") {
|
|
1209
|
-
ms = parseInt(ms);
|
|
1942
|
+
ms = Number.parseInt(ms);
|
|
1210
1943
|
}
|
|
1211
1944
|
return computed({
|
|
1212
1945
|
get: () => getter(modelValue == null ? void 0 : modelValue.value),
|
|
@@ -1229,41 +1962,6 @@ function useComponentFocus(inputTemplateRef, emit) {
|
|
|
1229
1962
|
focused
|
|
1230
1963
|
};
|
|
1231
1964
|
}
|
|
1232
|
-
function useComponentIcon(icon, iconPosition) {
|
|
1233
|
-
const hasIconBefore = computed(
|
|
1234
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
|
|
1235
|
-
);
|
|
1236
|
-
const hasIconAfter = computed(
|
|
1237
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
|
|
1238
|
-
);
|
|
1239
|
-
const hasIconLeft = computed(
|
|
1240
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
|
|
1241
|
-
);
|
|
1242
|
-
const hasIconRight = computed(
|
|
1243
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
|
|
1244
|
-
);
|
|
1245
|
-
const hasIconTop = computed(
|
|
1246
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
|
|
1247
|
-
);
|
|
1248
|
-
const hasIconBottom = computed(
|
|
1249
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
|
|
1250
|
-
);
|
|
1251
|
-
const hasIcon = computed(() => {
|
|
1252
|
-
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
1253
|
-
return { name: icon == null ? void 0 : icon.value };
|
|
1254
|
-
}
|
|
1255
|
-
return icon == null ? void 0 : icon.value;
|
|
1256
|
-
});
|
|
1257
|
-
return {
|
|
1258
|
-
hasIcon,
|
|
1259
|
-
hasIconLeft,
|
|
1260
|
-
hasIconRight,
|
|
1261
|
-
hasIconTop,
|
|
1262
|
-
hasIconBottom,
|
|
1263
|
-
hasIconBefore,
|
|
1264
|
-
hasIconAfter
|
|
1265
|
-
};
|
|
1266
|
-
}
|
|
1267
1965
|
function useTextCount(text, options) {
|
|
1268
1966
|
const length = computed(() => {
|
|
1269
1967
|
return (unref(text) ?? "").length;
|
|
@@ -1298,26 +1996,86 @@ function useTextCount(text, options) {
|
|
|
1298
1996
|
formatted
|
|
1299
1997
|
};
|
|
1300
1998
|
}
|
|
1999
|
+
function usePersistence(storageKey, storageType = StorageType.local, defaultValue) {
|
|
2000
|
+
const localValue = ref();
|
|
2001
|
+
if (defaultValue) {
|
|
2002
|
+
localValue.value = defaultValue;
|
|
2003
|
+
}
|
|
2004
|
+
let storageValue;
|
|
2005
|
+
if (storageKey) {
|
|
2006
|
+
watch(
|
|
2007
|
+
storageKey,
|
|
2008
|
+
(newKey, oldKey) => {
|
|
2009
|
+
const storage = unref(storageType) === StorageType.session ? sessionStorage : localStorage;
|
|
2010
|
+
if (oldKey && oldKey !== newKey) {
|
|
2011
|
+
storage.removeItem(oldKey);
|
|
2012
|
+
}
|
|
2013
|
+
if (newKey) {
|
|
2014
|
+
storageValue = useStorage(
|
|
2015
|
+
newKey,
|
|
2016
|
+
(storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
|
|
2017
|
+
storage
|
|
2018
|
+
);
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
storageValue = void 0;
|
|
2022
|
+
},
|
|
2023
|
+
{
|
|
2024
|
+
immediate: true
|
|
2025
|
+
}
|
|
2026
|
+
);
|
|
2027
|
+
}
|
|
2028
|
+
if (isRef(storageType)) {
|
|
2029
|
+
watch(storageType, (newType, oldType) => {
|
|
2030
|
+
if (storageKey == null ? void 0 : storageKey.value) {
|
|
2031
|
+
if (newType) {
|
|
2032
|
+
const storage = newType === StorageType.session ? sessionStorage : localStorage;
|
|
2033
|
+
storageValue = useStorage(
|
|
2034
|
+
storageKey.value,
|
|
2035
|
+
(storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
|
|
2036
|
+
storage
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
if (oldType && oldType !== newType) {
|
|
2040
|
+
const oldStorage = oldType === StorageType.session ? sessionStorage : localStorage;
|
|
2041
|
+
oldStorage.removeItem(storageKey.value);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
return computed({
|
|
2047
|
+
get: () => {
|
|
2048
|
+
return (storageValue == null ? void 0 : storageValue.value) ?? localValue.value;
|
|
2049
|
+
},
|
|
2050
|
+
set: (value) => {
|
|
2051
|
+
if (storageValue) {
|
|
2052
|
+
storageValue.value = value;
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
localValue.value = value;
|
|
2056
|
+
}
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
1301
2059
|
const _hoisted_1 = ["for"];
|
|
1302
|
-
const _hoisted_2 = {
|
|
1303
|
-
const _hoisted_3 = {
|
|
2060
|
+
const _hoisted_2 = {
|
|
1304
2061
|
key: 0,
|
|
1305
2062
|
class: "vv-input-text__input-before"
|
|
1306
2063
|
};
|
|
1307
|
-
const
|
|
1308
|
-
const
|
|
1309
|
-
const _hoisted_6 = {
|
|
2064
|
+
const _hoisted_3 = ["id"];
|
|
2065
|
+
const _hoisted_4 = {
|
|
1310
2066
|
key: 1,
|
|
1311
2067
|
class: "vv-input-text__unit"
|
|
1312
2068
|
};
|
|
1313
|
-
const
|
|
2069
|
+
const _hoisted_5 = {
|
|
1314
2070
|
key: 5,
|
|
1315
2071
|
class: "vv-input-text__input-after"
|
|
1316
2072
|
};
|
|
1317
|
-
const
|
|
2073
|
+
const _hoisted_6 = {
|
|
1318
2074
|
key: 6,
|
|
1319
2075
|
class: "vv-input-text__limit"
|
|
1320
2076
|
};
|
|
2077
|
+
const _hoisted_7 = { class: "flex-1" };
|
|
2078
|
+
const _hoisted_8 = ["title", "onClick"];
|
|
1321
2079
|
const __default__ = {
|
|
1322
2080
|
name: "VvInputText"
|
|
1323
2081
|
};
|
|
@@ -1325,8 +2083,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1325
2083
|
...__default__,
|
|
1326
2084
|
props: VvInputTextProps,
|
|
1327
2085
|
emits: VvInputTextEvents,
|
|
1328
|
-
setup(__props, { expose: __expose, emit }) {
|
|
2086
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1329
2087
|
const props = __props;
|
|
2088
|
+
const emit = __emit;
|
|
1330
2089
|
const slots = useSlots();
|
|
1331
2090
|
const propsDefaults = useDefaults(
|
|
1332
2091
|
"VvInputText",
|
|
@@ -1334,32 +2093,55 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1334
2093
|
props
|
|
1335
2094
|
);
|
|
1336
2095
|
const {
|
|
1337
|
-
|
|
2096
|
+
count,
|
|
2097
|
+
debounce,
|
|
1338
2098
|
icon,
|
|
1339
2099
|
iconPosition,
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
count,
|
|
1343
|
-
valid,
|
|
2100
|
+
iconRemoveSuggestion,
|
|
2101
|
+
id,
|
|
1344
2102
|
invalid,
|
|
2103
|
+
label,
|
|
1345
2104
|
loading,
|
|
1346
|
-
debounce,
|
|
1347
2105
|
maxlength,
|
|
1348
2106
|
minlength,
|
|
2107
|
+
modelValue,
|
|
2108
|
+
step,
|
|
2109
|
+
storageKey,
|
|
2110
|
+
storageType,
|
|
1349
2111
|
type,
|
|
1350
|
-
|
|
1351
|
-
step
|
|
2112
|
+
valid
|
|
1352
2113
|
} = toRefs(props);
|
|
1353
2114
|
const hasId = useUniqueId(id);
|
|
1354
2115
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
1355
2116
|
const inputTextPlaceholder = computed(
|
|
1356
2117
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
1357
2118
|
);
|
|
2119
|
+
const localModelValue = useDebouncedInput(
|
|
2120
|
+
modelValue,
|
|
2121
|
+
emit,
|
|
2122
|
+
(debounce == null ? void 0 : debounce.value) ?? 0
|
|
2123
|
+
);
|
|
2124
|
+
const NEGATIVE_ZERO_REGEX = /^-0?[.,]?[0*]?$/;
|
|
1358
2125
|
const maskReady = ref(false);
|
|
1359
2126
|
const { el, mask, typed, masked, unmasked } = useIMask(
|
|
1360
2127
|
computed(
|
|
1361
|
-
() =>
|
|
1362
|
-
|
|
2128
|
+
() => {
|
|
2129
|
+
if (!props.iMask) {
|
|
2130
|
+
return {
|
|
2131
|
+
mask: /./
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
if (props.iMask.mask === Number) {
|
|
2135
|
+
const toReturn = { ...props.iMask };
|
|
2136
|
+
if (props.min) {
|
|
2137
|
+
toReturn.min = Number(props.min);
|
|
2138
|
+
}
|
|
2139
|
+
if (props.max) {
|
|
2140
|
+
toReturn.max = Number(props.max);
|
|
2141
|
+
}
|
|
2142
|
+
return toReturn;
|
|
2143
|
+
}
|
|
2144
|
+
return props.iMask;
|
|
1363
2145
|
}
|
|
1364
2146
|
),
|
|
1365
2147
|
{
|
|
@@ -1370,13 +2152,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1370
2152
|
}
|
|
1371
2153
|
emit("update:masked", masked.value);
|
|
1372
2154
|
if (type.value === INPUT_TYPES.NUMBER) {
|
|
1373
|
-
if (
|
|
2155
|
+
if (/^-$|^$/.test(unmasked.value)) {
|
|
1374
2156
|
if (localModelValue.value === null || localModelValue.value === void 0) {
|
|
1375
2157
|
return;
|
|
1376
2158
|
}
|
|
1377
2159
|
localModelValue.value = void 0;
|
|
1378
2160
|
return;
|
|
1379
2161
|
}
|
|
2162
|
+
if (NEGATIVE_ZERO_REGEX.test(unmasked.value)) {
|
|
2163
|
+
localModelValue.value = 0;
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
1380
2166
|
if (typeof typed.value !== "number") {
|
|
1381
2167
|
localModelValue.value = Number(typed.value);
|
|
1382
2168
|
return;
|
|
@@ -1400,7 +2186,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1400
2186
|
if (!(date instanceof Date)) {
|
|
1401
2187
|
date = new Date(date);
|
|
1402
2188
|
}
|
|
1403
|
-
localModelValue.value = `${date.getFullYear()}-${
|
|
2189
|
+
localModelValue.value = `${date.getFullYear()}-${`0${date.getMonth() + 1}`.slice(-2)}-${`0${date.getDate()}`.slice(-2)}`;
|
|
1404
2190
|
return;
|
|
1405
2191
|
}
|
|
1406
2192
|
if (type.value === INPUT_TYPES.DATETIME_LOCAL) {
|
|
@@ -1419,7 +2205,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1419
2205
|
if (!(typed.value instanceof Date)) {
|
|
1420
2206
|
date = new Date(date);
|
|
1421
2207
|
}
|
|
1422
|
-
localModelValue.value = `${date.getFullYear()}-${
|
|
2208
|
+
localModelValue.value = `${date.getFullYear()}-${`0${date.getMonth() + 1}`.slice(-2)}-${`0${date.getDate()}`.slice(-2)}T${`0${date.getHours()}`.slice(-2)}:${`0${date.getMinutes()}`.slice(-2)}`;
|
|
1423
2209
|
return;
|
|
1424
2210
|
}
|
|
1425
2211
|
if (!localModelValue.value && !unmasked.value) {
|
|
@@ -1429,18 +2215,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1429
2215
|
}
|
|
1430
2216
|
}
|
|
1431
2217
|
);
|
|
2218
|
+
function updateMaskValue(newValue) {
|
|
2219
|
+
var _a;
|
|
2220
|
+
if (newValue === void 0) {
|
|
2221
|
+
typed.value = "";
|
|
2222
|
+
unmasked.value = "";
|
|
2223
|
+
return;
|
|
2224
|
+
}
|
|
2225
|
+
if (((_a = props.iMask) == null ? void 0 : _a.mask) === Date) {
|
|
2226
|
+
typed.value = new Date(newValue);
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
if (type.value === INPUT_TYPES.NUMBER && NEGATIVE_ZERO_REGEX.test(unmasked.value) && newValue === 0) {
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
typed.value = newValue;
|
|
2233
|
+
unmasked.value = `${typed.value}`;
|
|
2234
|
+
}
|
|
1432
2235
|
onMounted(() => {
|
|
1433
2236
|
if (mask.value) {
|
|
1434
2237
|
maskReady.value = true;
|
|
1435
|
-
|
|
2238
|
+
updateMaskValue(props.modelValue);
|
|
1436
2239
|
}
|
|
1437
2240
|
});
|
|
1438
2241
|
watch(
|
|
1439
2242
|
() => props.modelValue,
|
|
1440
2243
|
(newValue) => {
|
|
1441
|
-
var _a;
|
|
1442
2244
|
if (mask.value) {
|
|
1443
|
-
|
|
2245
|
+
updateMaskValue(newValue);
|
|
1444
2246
|
}
|
|
1445
2247
|
}
|
|
1446
2248
|
);
|
|
@@ -1452,20 +2254,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1452
2254
|
);
|
|
1453
2255
|
const inputEl = el;
|
|
1454
2256
|
const innerEl = ref();
|
|
2257
|
+
const wrapperEl = ref();
|
|
2258
|
+
const dropdownEl = ref();
|
|
1455
2259
|
__expose({ $inner: innerEl });
|
|
1456
|
-
const localModelValue = useDebouncedInput(
|
|
1457
|
-
modelValue,
|
|
1458
|
-
emit,
|
|
1459
|
-
(debounce == null ? void 0 : debounce.value) ?? 0
|
|
1460
|
-
);
|
|
1461
2260
|
const { focused } = useComponentFocus(inputEl, emit);
|
|
1462
2261
|
const isFocused = computed(
|
|
1463
2262
|
() => focused.value && !props.disabled && !props.readonly
|
|
1464
2263
|
);
|
|
1465
2264
|
watch(isFocused, (newValue) => {
|
|
2265
|
+
var _a;
|
|
1466
2266
|
if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
|
|
1467
2267
|
inputEl.value.select();
|
|
1468
2268
|
}
|
|
2269
|
+
if (newValue) {
|
|
2270
|
+
(_a = dropdownEl.value) == null ? void 0 : _a.show();
|
|
2271
|
+
return;
|
|
2272
|
+
}
|
|
2273
|
+
setTimeout(() => {
|
|
2274
|
+
if (isDirty.value && suggestions.value) {
|
|
2275
|
+
const suggestionsLimit = props.maxSuggestions - 1;
|
|
2276
|
+
if (suggestions.value.size > suggestionsLimit && !suggestions.value.has(localModelValue.value)) {
|
|
2277
|
+
suggestions.value = new Set(
|
|
2278
|
+
[...suggestions.value].slice(
|
|
2279
|
+
suggestions.value.size - suggestionsLimit
|
|
2280
|
+
)
|
|
2281
|
+
);
|
|
2282
|
+
}
|
|
2283
|
+
suggestions.value.add(localModelValue.value);
|
|
2284
|
+
}
|
|
2285
|
+
}, 300);
|
|
1469
2286
|
});
|
|
1470
2287
|
const isVisible = useElementVisibility(inputEl);
|
|
1471
2288
|
watch(isVisible, (newValue) => {
|
|
@@ -1475,56 +2292,56 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1475
2292
|
});
|
|
1476
2293
|
const showPassword = ref(false);
|
|
1477
2294
|
const isPassword = computed(() => props.type === INPUT_TYPES.PASSWORD);
|
|
1478
|
-
|
|
2295
|
+
function onTogglePassword() {
|
|
1479
2296
|
showPassword.value = !showPassword.value;
|
|
1480
|
-
}
|
|
2297
|
+
}
|
|
1481
2298
|
const isDateTime = computed(
|
|
1482
2299
|
() => props.type === INPUT_TYPES.TIME || props.type === INPUT_TYPES.DATETIME_LOCAL || props.type === INPUT_TYPES.DATE || props.type === INPUT_TYPES.WEEK || props.type === INPUT_TYPES.MONTH
|
|
1483
2300
|
);
|
|
1484
2301
|
const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
|
|
1485
|
-
|
|
2302
|
+
function onStepUp() {
|
|
1486
2303
|
if (isClickable.value) {
|
|
1487
|
-
if (iMask
|
|
1488
|
-
typed.value = typed.value + Number((step == null ? void 0 : step.value) ?? 1);
|
|
2304
|
+
if (props.iMask) {
|
|
2305
|
+
typed.value = Number(typed.value) + Number((step == null ? void 0 : step.value) ?? 1);
|
|
1489
2306
|
return;
|
|
1490
2307
|
}
|
|
1491
2308
|
inputEl.value.stepUp();
|
|
1492
|
-
localModelValue.value = unref(inputEl).value;
|
|
2309
|
+
localModelValue.value = Number(unref(inputEl).value);
|
|
1493
2310
|
}
|
|
1494
|
-
}
|
|
1495
|
-
|
|
2311
|
+
}
|
|
2312
|
+
function onStepDown() {
|
|
1496
2313
|
if (isClickable.value) {
|
|
1497
|
-
if (iMask
|
|
1498
|
-
typed.value = typed.value - Number((step == null ? void 0 : step.value) ?? 1);
|
|
2314
|
+
if (props.iMask) {
|
|
2315
|
+
typed.value = Number(typed.value) - Number((step == null ? void 0 : step.value) ?? 1);
|
|
1499
2316
|
return;
|
|
1500
2317
|
}
|
|
1501
2318
|
inputEl.value.stepDown();
|
|
1502
|
-
localModelValue.value = unref(inputEl).value;
|
|
2319
|
+
localModelValue.value = Number(unref(inputEl).value);
|
|
1503
2320
|
}
|
|
1504
|
-
}
|
|
2321
|
+
}
|
|
1505
2322
|
const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
|
|
1506
|
-
|
|
2323
|
+
function onClear() {
|
|
1507
2324
|
localModelValue.value = "";
|
|
1508
|
-
}
|
|
1509
|
-
const {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
2325
|
+
}
|
|
2326
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
|
|
2327
|
+
const iconAfter = computed(() => {
|
|
2328
|
+
if (hasIconAfter.value !== void 0) {
|
|
2329
|
+
return hasIconAfter.value;
|
|
2330
|
+
}
|
|
1514
2331
|
switch (props.type) {
|
|
1515
2332
|
case INPUT_TYPES.COLOR:
|
|
1516
|
-
return { name:
|
|
2333
|
+
return { name: ACTION_ICONS.showColorPicker };
|
|
1517
2334
|
case INPUT_TYPES.DATE:
|
|
1518
2335
|
case INPUT_TYPES.DATETIME_LOCAL:
|
|
1519
2336
|
case INPUT_TYPES.WEEK:
|
|
1520
2337
|
case INPUT_TYPES.MONTH:
|
|
1521
|
-
return { name:
|
|
2338
|
+
return { name: ACTION_ICONS.showDatePicker };
|
|
1522
2339
|
case INPUT_TYPES.TIME:
|
|
1523
|
-
return { name:
|
|
1524
|
-
default:
|
|
1525
|
-
return "";
|
|
2340
|
+
return { name: ACTION_ICONS.showTimePicker };
|
|
1526
2341
|
}
|
|
2342
|
+
return void 0;
|
|
1527
2343
|
});
|
|
2344
|
+
const { hasIcon: hasIconRemoveSuggestion } = useComponentIcon(iconRemoveSuggestion);
|
|
1528
2345
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
1529
2346
|
mode: count.value,
|
|
1530
2347
|
upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
|
|
@@ -1544,21 +2361,46 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1544
2361
|
}
|
|
1545
2362
|
return void 0;
|
|
1546
2363
|
});
|
|
2364
|
+
const suggestions = usePersistence(
|
|
2365
|
+
storageKey,
|
|
2366
|
+
storageType,
|
|
2367
|
+
/* @__PURE__ */ new Set()
|
|
2368
|
+
);
|
|
2369
|
+
const filteredSuggestions = computed(() => {
|
|
2370
|
+
if (!suggestions.value) {
|
|
2371
|
+
return [];
|
|
2372
|
+
}
|
|
2373
|
+
return [...suggestions.value].filter(
|
|
2374
|
+
(suggestion) => isEmpty(localModelValue.value) || `${suggestion}`.toLowerCase().includes(`${localModelValue.value}`.toLowerCase()) && suggestion !== localModelValue.value
|
|
2375
|
+
).reverse();
|
|
2376
|
+
});
|
|
2377
|
+
const hasSuggestions = computed(
|
|
2378
|
+
() => (storageKey == null ? void 0 : storageKey.value) && suggestions.value && suggestions.value.size > 0
|
|
2379
|
+
);
|
|
2380
|
+
function onSuggestionSelect(suggestion) {
|
|
2381
|
+
var _a;
|
|
2382
|
+
localModelValue.value = suggestion;
|
|
2383
|
+
(_a = dropdownEl.value) == null ? void 0 : _a.hide();
|
|
2384
|
+
}
|
|
2385
|
+
function onSuggestionRemove(suggestion) {
|
|
2386
|
+
var _a;
|
|
2387
|
+
(_a = suggestions.value) == null ? void 0 : _a.delete(suggestion);
|
|
2388
|
+
}
|
|
1547
2389
|
const { modifiers } = toRefs(props);
|
|
1548
2390
|
const bemCssClasses = useModifiers(
|
|
1549
2391
|
"vv-input-text",
|
|
1550
2392
|
modifiers,
|
|
1551
2393
|
computed(() => ({
|
|
1552
|
-
valid: valid.value,
|
|
1553
|
-
invalid: invalid.value,
|
|
1554
|
-
loading: loading.value,
|
|
1555
|
-
disabled: props.disabled,
|
|
1556
|
-
readonly: props.readonly,
|
|
1557
|
-
"icon-before": hasIconBefore.value,
|
|
1558
|
-
"icon-after":
|
|
1559
|
-
floating: props.floating && !isEmpty(props.label),
|
|
1560
|
-
dirty: isDirty.value,
|
|
1561
|
-
focus: isFocused.value,
|
|
2394
|
+
"valid": valid.value,
|
|
2395
|
+
"invalid": invalid.value,
|
|
2396
|
+
"loading": loading.value,
|
|
2397
|
+
"disabled": props.disabled,
|
|
2398
|
+
"readonly": props.readonly,
|
|
2399
|
+
"icon-before": !!hasIconBefore.value,
|
|
2400
|
+
"icon-after": !!iconAfter.value,
|
|
2401
|
+
"floating": props.floating && !isEmpty(props.label),
|
|
2402
|
+
"dirty": isDirty.value,
|
|
2403
|
+
"focus": isFocused.value,
|
|
1562
2404
|
"auto-width": props.autoWidth
|
|
1563
2405
|
}))
|
|
1564
2406
|
);
|
|
@@ -1570,26 +2412,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1570
2412
|
if (isDateTime.value && !isDirty.value && !focused.value) {
|
|
1571
2413
|
return INPUT_TYPES.TEXT;
|
|
1572
2414
|
}
|
|
1573
|
-
if (iMask
|
|
2415
|
+
if (props.iMask) {
|
|
1574
2416
|
return INPUT_TYPES.TEXT;
|
|
1575
2417
|
}
|
|
1576
2418
|
return props.type;
|
|
1577
2419
|
})();
|
|
1578
2420
|
const toReturn = {
|
|
1579
2421
|
type: type2,
|
|
1580
|
-
name: props.name,
|
|
1581
|
-
tabindex: hasTabindex.value,
|
|
1582
|
-
disabled: props.disabled,
|
|
1583
|
-
readonly: props.readonly,
|
|
1584
|
-
required: props.required,
|
|
1585
|
-
autocomplete: props.autocomplete,
|
|
2422
|
+
"name": props.name,
|
|
2423
|
+
"tabindex": hasTabindex.value,
|
|
2424
|
+
"disabled": props.disabled,
|
|
2425
|
+
"readonly": props.readonly,
|
|
2426
|
+
"required": props.required,
|
|
2427
|
+
"autocomplete": props.autocomplete,
|
|
1586
2428
|
"aria-invalid": isInvalid.value,
|
|
1587
2429
|
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
1588
2430
|
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
1589
2431
|
};
|
|
1590
2432
|
if (type2 === INPUT_TYPES.DATE || type2 === INPUT_TYPES.MONTH || type2 === INPUT_TYPES.WEEK || type2 === INPUT_TYPES.TIME || type2 === INPUT_TYPES.DATETIME_LOCAL || type2 === INPUT_TYPES.NUMBER) {
|
|
2433
|
+
let max = props.max;
|
|
2434
|
+
if (type2 === INPUT_TYPES.DATE && !max) {
|
|
2435
|
+
max = "9999-12-31";
|
|
2436
|
+
}
|
|
1591
2437
|
toReturn.step = props.step;
|
|
1592
|
-
toReturn.max =
|
|
2438
|
+
toReturn.max = max !== void 0 ? String(max) : void 0;
|
|
1593
2439
|
toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
|
|
1594
2440
|
}
|
|
1595
2441
|
if (type2 === INPUT_TYPES.TEXT || type2 === INPUT_TYPES.SEARCH || type2 === INPUT_TYPES.URL || type2 === INPUT_TYPES.TEL || type2 === INPUT_TYPES.EMAIL || type2 === INPUT_TYPES.PASSWORD || type2 === INPUT_TYPES.NUMBER) {
|
|
@@ -1632,11 +2478,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1632
2478
|
INPUT_TYPES.SEARCH,
|
|
1633
2479
|
props
|
|
1634
2480
|
);
|
|
1635
|
-
|
|
2481
|
+
function onClickInner() {
|
|
1636
2482
|
if (isClickable.value) {
|
|
1637
2483
|
focused.value = true;
|
|
1638
2484
|
}
|
|
1639
|
-
}
|
|
2485
|
+
}
|
|
1640
2486
|
const hasStyle = computed(() => {
|
|
1641
2487
|
if (!props.autoWidth) {
|
|
1642
2488
|
return void 0;
|
|
@@ -1645,7 +2491,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1645
2491
|
width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
|
|
1646
2492
|
};
|
|
1647
2493
|
});
|
|
1648
|
-
|
|
2494
|
+
function onKeyDown(event) {
|
|
1649
2495
|
switch (event.code) {
|
|
1650
2496
|
case "ArrowUp":
|
|
1651
2497
|
if (isNumber.value) {
|
|
@@ -1661,103 +2507,197 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1661
2507
|
break;
|
|
1662
2508
|
}
|
|
1663
2509
|
emit("keydown", event);
|
|
1664
|
-
}
|
|
2510
|
+
}
|
|
1665
2511
|
return (_ctx, _cache) => {
|
|
1666
|
-
return openBlock(), createElementBlock(
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
2512
|
+
return openBlock(), createElementBlock(
|
|
2513
|
+
"div",
|
|
2514
|
+
{
|
|
2515
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
2516
|
+
},
|
|
2517
|
+
[
|
|
2518
|
+
unref(label) ? (openBlock(), createElementBlock("label", {
|
|
2519
|
+
key: 0,
|
|
2520
|
+
for: unref(hasId),
|
|
2521
|
+
class: "vv-input-text__label"
|
|
2522
|
+
}, toDisplayString(unref(label)), 9, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
2523
|
+
createElementVNode(
|
|
2524
|
+
"div",
|
|
2525
|
+
{
|
|
2526
|
+
ref_key: "wrapperEl",
|
|
2527
|
+
ref: wrapperEl,
|
|
2528
|
+
class: "vv-input-text__wrapper"
|
|
2529
|
+
},
|
|
2530
|
+
[
|
|
2531
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
2532
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2533
|
+
])) : createCommentVNode("v-if", true),
|
|
2534
|
+
createElementVNode(
|
|
2535
|
+
"div",
|
|
2536
|
+
{
|
|
2537
|
+
ref_key: "innerEl",
|
|
2538
|
+
ref: innerEl,
|
|
2539
|
+
class: "vv-input-text__inner",
|
|
2540
|
+
onClick: withModifiers(onClickInner, ["stop"])
|
|
2541
|
+
},
|
|
2542
|
+
[
|
|
2543
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2544
|
+
_sfc_main$1,
|
|
2545
|
+
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
|
|
2546
|
+
null,
|
|
2547
|
+
16
|
|
2548
|
+
/* FULL_PROPS */
|
|
2549
|
+
)) : createCommentVNode("v-if", true),
|
|
2550
|
+
createElementVNode("input", mergeProps({
|
|
2551
|
+
id: unref(hasId),
|
|
2552
|
+
ref_key: "inputEl",
|
|
2553
|
+
ref: inputEl
|
|
2554
|
+
}, unref(hasAttrs), {
|
|
2555
|
+
style: unref(hasStyle),
|
|
2556
|
+
onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
|
|
2557
|
+
onKeydown: onKeyDown,
|
|
2558
|
+
onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
|
|
2559
|
+
}), null, 16, _hoisted_3),
|
|
2560
|
+
(_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
2561
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
2562
|
+
createTextVNode(
|
|
2563
|
+
toDisplayString(_ctx.unit),
|
|
2564
|
+
1
|
|
2565
|
+
/* TEXT */
|
|
2566
|
+
)
|
|
2567
|
+
])
|
|
2568
|
+
])) : createCommentVNode("v-if", true)
|
|
2569
|
+
],
|
|
2570
|
+
512
|
|
2571
|
+
/* NEED_PATCH */
|
|
2572
|
+
),
|
|
2573
|
+
unref(iconAfter) ? (openBlock(), createBlock(
|
|
2574
|
+
_sfc_main$1,
|
|
2575
|
+
mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
|
|
2576
|
+
null,
|
|
2577
|
+
16
|
|
2578
|
+
/* FULL_PROPS */
|
|
2579
|
+
)) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
|
|
2580
|
+
key: 2,
|
|
2581
|
+
onTogglePassword
|
|
2582
|
+
})) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
|
|
2583
|
+
key: 3,
|
|
2584
|
+
onStepUp,
|
|
2585
|
+
onStepDown
|
|
2586
|
+
})) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
|
|
2587
|
+
key: 4,
|
|
2588
|
+
onClear
|
|
2589
|
+
})) : createCommentVNode("v-if", true),
|
|
2590
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
2591
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2592
|
+
])) : createCommentVNode("v-if", true),
|
|
2593
|
+
unref(count) ? (openBlock(), createElementBlock("span", _hoisted_6, [
|
|
2594
|
+
renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
2595
|
+
createTextVNode(
|
|
2596
|
+
toDisplayString(unref(countFormatted)),
|
|
2597
|
+
1
|
|
2598
|
+
/* TEXT */
|
|
2599
|
+
)
|
|
2600
|
+
])
|
|
2601
|
+
])) : createCommentVNode("v-if", true)
|
|
2602
|
+
],
|
|
2603
|
+
512
|
|
2604
|
+
/* NEED_PATCH */
|
|
2605
|
+
),
|
|
2606
|
+
createVNode(unref(HintSlot), {
|
|
2607
|
+
id: unref(hasHintId),
|
|
2608
|
+
class: "vv-input-text__hint"
|
|
2609
|
+
}, createSlots({
|
|
2610
|
+
_: 2
|
|
2611
|
+
/* DYNAMIC */
|
|
1683
2612
|
}, [
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
2613
|
+
_ctx.$slots.hint ? {
|
|
2614
|
+
name: "hint",
|
|
2615
|
+
fn: withCtx(() => [
|
|
2616
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2617
|
+
]),
|
|
2618
|
+
key: "0"
|
|
2619
|
+
} : void 0,
|
|
2620
|
+
_ctx.$slots.loading ? {
|
|
2621
|
+
name: "loading",
|
|
2622
|
+
fn: withCtx(() => [
|
|
2623
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2624
|
+
]),
|
|
2625
|
+
key: "1"
|
|
2626
|
+
} : void 0,
|
|
2627
|
+
_ctx.$slots.valid ? {
|
|
2628
|
+
name: "valid",
|
|
2629
|
+
fn: withCtx(() => [
|
|
2630
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2631
|
+
]),
|
|
2632
|
+
key: "2"
|
|
2633
|
+
} : void 0,
|
|
2634
|
+
_ctx.$slots.invalid ? {
|
|
2635
|
+
name: "invalid",
|
|
2636
|
+
fn: withCtx(() => [
|
|
2637
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2638
|
+
]),
|
|
2639
|
+
key: "3"
|
|
2640
|
+
} : void 0
|
|
2641
|
+
]), 1032, ["id"]),
|
|
2642
|
+
unref(hasSuggestions) ? (openBlock(), createBlock(_sfc_main$4, {
|
|
1705
2643
|
key: 1,
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
2644
|
+
ref_key: "dropdownEl",
|
|
2645
|
+
ref: dropdownEl,
|
|
2646
|
+
reference: unref(wrapperEl),
|
|
2647
|
+
"autofocus-first": false,
|
|
2648
|
+
"trigger-width": true
|
|
2649
|
+
}, {
|
|
2650
|
+
items: withCtx(() => [
|
|
2651
|
+
(openBlock(true), createElementBlock(
|
|
2652
|
+
Fragment,
|
|
2653
|
+
null,
|
|
2654
|
+
renderList(unref(filteredSuggestions), (value) => {
|
|
2655
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
2656
|
+
key: value,
|
|
2657
|
+
onClick: withModifiers(($event) => onSuggestionSelect(value), ["stop"])
|
|
2658
|
+
}, {
|
|
2659
|
+
default: withCtx(() => [
|
|
2660
|
+
createElementVNode("div", _hoisted_7, [
|
|
2661
|
+
renderSlot(_ctx.$slots, "suggestion", mergeProps({ ref_for: true }, { value }), () => [
|
|
2662
|
+
createTextVNode(
|
|
2663
|
+
toDisplayString(value),
|
|
2664
|
+
1
|
|
2665
|
+
/* TEXT */
|
|
2666
|
+
)
|
|
2667
|
+
])
|
|
2668
|
+
]),
|
|
2669
|
+
unref(suggestions) && unref(hasIconRemoveSuggestion) ? (openBlock(), createElementBlock("button", {
|
|
2670
|
+
key: 0,
|
|
2671
|
+
type: "button",
|
|
2672
|
+
tabindex: "-1",
|
|
2673
|
+
class: "cursor-pointer",
|
|
2674
|
+
title: _ctx.labelRemoveSuggestion,
|
|
2675
|
+
onClick: withModifiers(($event) => onSuggestionRemove(value), ["stop"])
|
|
2676
|
+
}, [
|
|
2677
|
+
createVNode(
|
|
2678
|
+
_sfc_main$1,
|
|
2679
|
+
mergeProps({ ref_for: true }, unref(hasIconRemoveSuggestion)),
|
|
2680
|
+
null,
|
|
2681
|
+
16
|
|
2682
|
+
/* FULL_PROPS */
|
|
2683
|
+
)
|
|
2684
|
+
], 8, _hoisted_8)) : createCommentVNode("v-if", true)
|
|
2685
|
+
]),
|
|
2686
|
+
_: 2
|
|
2687
|
+
/* DYNAMIC */
|
|
2688
|
+
}, 1032, ["onClick"]);
|
|
2689
|
+
}),
|
|
2690
|
+
128
|
|
2691
|
+
/* KEYED_FRAGMENT */
|
|
2692
|
+
))
|
|
1735
2693
|
]),
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
key: "1"
|
|
1744
|
-
} : void 0,
|
|
1745
|
-
_ctx.$slots.valid ? {
|
|
1746
|
-
name: "valid",
|
|
1747
|
-
fn: withCtx(() => [
|
|
1748
|
-
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1749
|
-
]),
|
|
1750
|
-
key: "2"
|
|
1751
|
-
} : void 0,
|
|
1752
|
-
_ctx.$slots.invalid ? {
|
|
1753
|
-
name: "invalid",
|
|
1754
|
-
fn: withCtx(() => [
|
|
1755
|
-
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1756
|
-
]),
|
|
1757
|
-
key: "3"
|
|
1758
|
-
} : void 0
|
|
1759
|
-
]), 1032, ["id"])
|
|
1760
|
-
], 2);
|
|
2694
|
+
_: 3
|
|
2695
|
+
/* FORWARDED */
|
|
2696
|
+
}, 8, ["reference"])) : createCommentVNode("v-if", true)
|
|
2697
|
+
],
|
|
2698
|
+
2
|
|
2699
|
+
/* CLASS */
|
|
2700
|
+
);
|
|
1761
2701
|
};
|
|
1762
2702
|
}
|
|
1763
2703
|
});
|