@volverjs/ui-vue 0.0.10-beta.5 → 0.0.10-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +148 -51
- package/auto-imports.d.ts +25 -12
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +28 -20
- package/dist/Volver.d.ts +11 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +192 -104
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +29 -10
- package/dist/components/VvAccordion/index.d.ts +8 -9
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +485 -206
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +61 -18
- package/dist/components/VvAccordionGroup/index.d.ts +16 -8
- package/dist/components/VvAction/VvAction.es.js +84 -33
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +61 -28
- package/dist/components/VvAction/index.d.ts +26 -10
- package/dist/components/VvAlert/VvAlert.es.js +350 -318
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +25 -17
- package/dist/components/VvAlert/index.d.ts +20 -11
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +388 -327
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +22 -17
- package/dist/components/VvAlertGroup/index.d.ts +10 -18
- package/dist/components/VvAvatar/VvAvatar.es.js +66 -28
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +13 -5
- package/dist/components/VvAvatar/index.d.ts +4 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +147 -74
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +17 -10
- package/dist/components/VvAvatarGroup/index.d.ts +6 -3
- package/dist/components/VvBadge/VvBadge.es.js +78 -34
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +13 -5
- package/dist/components/VvBadge/index.d.ts +4 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +294 -83
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +28 -8
- package/dist/components/VvBreadcrumb/index.d.ts +6 -10
- package/dist/components/VvButton/VvButton.es.js +510 -488
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +97 -45
- package/dist/components/VvButton/index.d.ts +52 -30
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +95 -45
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +35 -17
- package/dist/components/VvButtonGroup/index.d.ts +13 -4
- package/dist/components/VvCard/VvCard.es.js +87 -42
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +13 -5
- package/dist/components/VvCard/index.d.ts +4 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +177 -136
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +105 -35
- package/dist/components/VvCheckbox/index.d.ts +52 -19
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +408 -322
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +103 -34
- package/dist/components/VvCheckboxGroup/index.d.ts +45 -12
- package/dist/components/VvCombobox/VvCombobox.es.js +1963 -1639
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +260 -672
- package/dist/components/VvCombobox/index.d.ts +385 -135
- package/dist/components/VvDialog/VvDialog.es.js +177 -297
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +23 -7
- package/dist/components/VvDialog/index.d.ts +12 -0
- package/dist/components/VvDropdown/VvDropdown.es.js +172 -102
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +110 -315
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +77 -28
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +13 -1
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +13 -5
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +38 -10
- package/dist/components/VvDropdown/index.d.ts +52 -118
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +165 -60
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +337 -10
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +63 -20
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +188 -80
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +24 -102
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +4 -68
- package/dist/components/VvIcon/index.d.ts +33 -48
- package/dist/components/VvInputFile/VvInputFile.es.js +1777 -0
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -0
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +317 -0
- package/dist/components/VvInputFile/index.d.ts +193 -0
- package/dist/components/VvInputText/VvInputClearAction.d.ts +16 -10
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +20 -14
- package/dist/components/VvInputText/VvInputStepAction.d.ts +11 -7
- package/dist/components/VvInputText/VvInputText.es.js +1495 -548
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +216 -68
- package/dist/components/VvInputText/index.d.ts +101 -31
- package/dist/components/VvNav/VvNav.es.js +155 -75
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +32 -11
- package/dist/components/VvNav/VvNavItem.vue.d.ts +1 -1
- package/dist/components/VvNav/VvNavSeparator.vue.d.ts +1 -1
- package/dist/components/VvNav/index.d.ts +5 -2
- package/dist/components/VvNavItem/VvNavItem.es.js +100 -39
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +73 -27
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +13 -6
- package/dist/components/VvProgress/index.d.ts +4 -1
- package/dist/components/VvRadio/VvRadio.es.js +175 -135
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +103 -33
- package/dist/components/VvRadio/index.d.ts +50 -17
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +406 -321
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +103 -34
- package/dist/components/VvRadioGroup/index.d.ts +45 -12
- package/dist/components/VvSelect/VvSelect.es.js +677 -611
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +107 -199
- package/dist/components/VvSelect/index.d.ts +196 -16
- package/dist/components/VvTab/VvTab.es.js +230 -110
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +34 -12
- package/dist/components/VvTab/index.d.ts +6 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +278 -255
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +159 -54
- package/dist/components/VvTextarea/index.d.ts +69 -20
- package/dist/components/VvTooltip/VvTooltip.es.js +83 -30
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +16 -9
- package/dist/components/VvTooltip/index.d.ts +5 -2
- package/dist/components/common/HintSlot.d.ts +8 -9
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.es.js +4303 -2228
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlerInject.d.ts +4 -0
- package/dist/composables/alert/useAlert.d.ts +71 -6
- package/dist/composables/alert/{useProvideAlert.d.ts → useAlertProvide.d.ts} +1 -1
- package/dist/composables/dropdown/useDropdownContextmenu.d.ts +18 -0
- package/dist/composables/dropdown/useDropdownInject.d.ts +12 -0
- package/dist/composables/dropdown/{useProvideDropdown.d.ts → useDropdownProvide.d.ts} +6 -7
- package/dist/composables/dropdown/useDropdownVirtualElement.d.ts +17 -0
- package/dist/composables/group/useGroupStateInject.d.ts +9 -0
- package/dist/composables/group/useGroupStateProvide.d.ts +6 -0
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/index.es.js +178 -6
- package/dist/composables/index.umd.js +1 -1
- package/dist/composables/useBlurhash.d.ts +7 -0
- package/dist/composables/useComponentFocus.d.ts +2 -2
- package/dist/composables/useComponentIcon.d.ts +9 -8
- package/dist/composables/useOptions.d.ts +5 -5
- package/dist/composables/usePersistence.d.ts +3 -0
- package/dist/composables/useUniqueId.d.ts +2 -2
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +35 -33
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +247 -82
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.es.js +137 -31
- package/dist/directives/v-contextmenu.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +101 -39
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.d.ts +17 -17
- package/dist/icons.es.js +516 -516
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +74 -6
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +288 -198
- package/dist/resolvers/unplugin.d.ts +6 -1
- package/dist/resolvers/unplugin.es.js +87 -10
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Accordion/Accordion.settings.d.ts +2 -57
- package/dist/stories/AccordionGroup/AccordionGroup.settings.d.ts +2 -66
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -127
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +1304 -538
- package/dist/stories/Alert/Alert.settings.d.ts +2 -109
- package/dist/stories/AlertGroup/AlertGroup.settings.d.ts +2 -85
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
- package/dist/stories/AvatarGroup/AvatarGroup.settings.d.ts +2 -38
- package/dist/stories/Badge/Badge.settings.d.ts +2 -26
- package/dist/stories/Badge/Badge.test.d.ts +1 -1
- package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
- package/dist/stories/Breadcrumb/Breadcrumb.settings.d.ts +2 -18
- package/dist/stories/Breadcrumb/Breadcrumb.test.d.ts +1 -1
- package/dist/stories/Button/Button.settings.d.ts +2 -194
- package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +2 -40
- package/dist/stories/Card/Card.settings.d.ts +2 -63
- package/dist/stories/Checkbox/Checkbox.settings.d.ts +2 -132
- package/dist/stories/CheckboxGroup/CheckboxGroup.settings.d.ts +1 -141
- package/dist/stories/Combobox/Combobox.settings.d.ts +2 -609
- package/dist/stories/Combobox/Combobox.stories.d.ts +1 -0
- package/dist/stories/Combobox/ComboboxMultiple.stories.d.ts +1 -0
- package/dist/stories/Dialog/Dialog.settings.d.ts +2 -47
- package/dist/stories/Dialog/DialogModifiers.stories.d.ts +8 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +2 -205
- package/dist/stories/Icon/Icon.settings.d.ts +3 -68
- package/dist/stories/InputFile/InputFile.settings.d.ts +6 -0
- package/dist/stories/InputFile/InputFile.stories.d.ts +13 -0
- package/dist/stories/InputFile/InputFileDropArea.stories.d.ts +9 -0
- package/dist/stories/InputFile/InputFileIconPosition.stories.d.ts +8 -0
- package/dist/stories/InputFile/InputFileSlots.stories.d.ts +7 -0
- package/dist/stories/InputText/InputText.settings.d.ts +2 -438
- package/dist/stories/Nav/Nav.settings.d.ts +2 -10
- package/dist/stories/Progress/Progress.settings.d.ts +2 -27
- package/dist/stories/Radio/Radio.settings.d.ts +1 -110
- package/dist/stories/RadioGroup/RadioGroup.settings.d.ts +1 -141
- package/dist/stories/Select/Select.settings.d.ts +2 -246
- package/dist/stories/Select/Select.stories.d.ts +1 -0
- package/dist/stories/Tab/Tab.settings.d.ts +2 -15
- package/dist/stories/Textarea/Textarea.settings.d.ts +2 -287
- package/dist/stories/argTypes.d.ts +27 -866
- package/dist/test/expect.d.ts +1 -2
- package/dist/test/options.d.ts +1 -1
- package/dist/test/sleep.d.ts +1 -1
- package/dist/types/alert.d.ts +9 -7
- package/dist/types/blurhash.d.ts +12 -0
- package/dist/types/floating-ui.d.ts +1 -1
- package/dist/types/generic.d.ts +1 -2
- package/dist/types/group.d.ts +37 -15
- package/dist/types/index.d.ts +7 -0
- package/dist/types/input-file.d.ts +9 -0
- package/dist/types/nav.d.ts +2 -2
- package/dist/utils/DomUtilities.d.ts +1 -0
- package/dist/utils/ObjectUtilities.d.ts +8 -9
- package/dist/workers/blurhash.d.ts +1 -0
- package/package.json +238 -246
- package/src/Volver.ts +251 -246
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +163 -100
- package/src/components/VvAccordion/index.ts +65 -80
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +224 -106
- package/src/components/VvAccordionGroup/index.ts +42 -42
- package/src/components/VvAction/VvAction.vue +144 -130
- package/src/components/VvAlert/VvAlert.vue +72 -70
- package/src/components/VvAlert/index.ts +149 -147
- package/src/components/VvAlertGroup/VvAlertGroup.vue +57 -56
- package/src/components/VvAlertGroup/index.ts +102 -118
- package/src/components/VvAvatar/VvAvatar.vue +20 -14
- package/src/components/VvAvatar/index.ts +5 -5
- package/src/components/VvAvatarGroup/VvAvatarGroup.vue +58 -53
- package/src/components/VvAvatarGroup/index.ts +21 -21
- package/src/components/VvBadge/VvBadge.vue +15 -14
- package/src/components/VvBadge/index.ts +2 -2
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +50 -48
- package/src/components/VvBreadcrumb/index.ts +3 -9
- package/src/components/VvButton/VvButton.vue +163 -152
- package/src/components/VvButton/index.ts +104 -111
- package/src/components/VvButtonGroup/VvButtonGroup.vue +73 -65
- package/src/components/VvButtonGroup/index.ts +23 -22
- package/src/components/VvCard/VvCard.vue +30 -30
- package/src/components/VvCard/index.ts +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +186 -184
- package/src/components/VvCheckbox/index.ts +45 -45
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +88 -87
- package/src/components/VvCombobox/VvCombobox.vue +657 -619
- package/src/components/VvCombobox/index.ts +212 -168
- package/src/components/VvDialog/VvDialog.vue +139 -129
- package/src/components/VvDialog/index.ts +42 -36
- package/src/components/VvDropdown/VvDropdown.vue +466 -445
- package/src/components/VvDropdown/VvDropdownAction.vue +37 -39
- package/src/components/VvDropdown/VvDropdownItem.vue +30 -26
- package/src/components/VvDropdown/VvDropdownOptgroup.vue +13 -12
- package/src/components/VvDropdown/VvDropdownOption.vue +47 -64
- package/src/components/VvDropdown/index.ts +61 -27
- package/src/components/VvIcon/README.md +1 -1
- package/src/components/VvIcon/VvIcon.vue +133 -133
- package/src/components/VvIcon/index.ts +84 -97
- package/src/components/VvInputFile/VvInputFile.vue +413 -0
- package/src/components/VvInputFile/index.ts +143 -0
- package/src/components/VvInputText/VvInputClearAction.ts +51 -47
- package/src/components/VvInputText/VvInputPasswordAction.ts +66 -62
- package/src/components/VvInputText/VvInputStepAction.ts +43 -43
- package/src/components/VvInputText/VvInputText.vue +653 -516
- package/src/components/VvInputText/VvInputTextActions.ts +87 -87
- package/src/components/VvInputText/index.ts +201 -186
- package/src/components/VvNav/VvNav.vue +40 -36
- package/src/components/VvNav/VvNavItem.vue +12 -12
- package/src/components/VvNav/VvNavSeparator.vue +6 -6
- package/src/components/VvNav/index.ts +2 -2
- package/src/components/VvProgress/VvProgress.vue +27 -27
- package/src/components/VvProgress/index.ts +28 -28
- package/src/components/VvRadio/VvRadio.vue +115 -112
- package/src/components/VvRadio/index.ts +29 -29
- package/src/components/VvRadioGroup/VvRadioGroup.vue +91 -90
- package/src/components/VvSelect/VvSelect.vue +262 -241
- package/src/components/VvSelect/index.ts +88 -63
- package/src/components/VvTab/VvTab.vue +79 -69
- package/src/components/VvTab/index.ts +13 -13
- package/src/components/VvTextarea/VvTextarea.vue +218 -219
- package/src/components/VvTextarea/index.ts +35 -35
- package/src/components/VvTooltip/VvTooltip.vue +22 -16
- package/src/components/VvTooltip/index.ts +12 -12
- package/src/components/common/HintSlot.ts +151 -152
- package/src/components/index.ts +10 -0
- package/src/composables/alert/{useInjectAlert.ts → useAlerInject.ts} +1 -1
- package/src/composables/alert/useAlert.ts +76 -73
- package/src/composables/alert/{useProvideAlert.ts → useAlertProvide.ts} +12 -12
- package/src/composables/dropdown/useDropdownContextmenu.ts +22 -0
- package/src/composables/dropdown/{useInjectDropdown.ts → useDropdownInject.ts} +6 -6
- package/src/composables/dropdown/useDropdownProvide.ts +94 -0
- package/src/composables/dropdown/useDropdownVirtualElement.ts +53 -0
- package/src/composables/group/useGroupStateInject.ts +55 -0
- package/src/composables/group/useGroupStateProvide.ts +14 -0
- package/src/composables/index.ts +3 -0
- package/src/composables/useBlurhash.ts +68 -0
- package/src/composables/useComponentFocus.ts +9 -9
- package/src/composables/useComponentIcon.ts +36 -35
- package/src/composables/useDebouncedInput.ts +25 -25
- package/src/composables/useDefaults.ts +81 -80
- package/src/composables/useModifiers.ts +29 -29
- package/src/composables/useOptions.ts +51 -42
- package/src/composables/usePersistence.ts +74 -0
- package/src/composables/useTextCount.ts +46 -46
- package/src/composables/useUniqueId.ts +4 -4
- package/src/composables/useVolver.ts +1 -1
- package/src/constants.ts +98 -83
- package/src/directives/index.ts +3 -6
- package/src/directives/v-contextmenu.ts +26 -34
- package/src/directives/v-tooltip.ts +20 -11
- package/src/icons.ts +2 -2
- package/src/index.ts +6 -4
- package/src/props/index.ts +467 -383
- package/src/resolvers/unplugin.ts +154 -144
- package/src/shims.d.ts +4 -5
- package/src/stories/Accordion/Accordion.settings.ts +51 -50
- package/src/stories/Accordion/Accordion.stories.ts +21 -21
- package/src/stories/Accordion/Accordion.test.ts +56 -54
- package/src/stories/Accordion/AccordionSlots.stories.ts +13 -13
- package/src/stories/AccordionGroup/AccordionGroup.settings.ts +70 -67
- package/src/stories/AccordionGroup/AccordionGroup.stories.ts +41 -39
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +49 -45
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +36 -36
- package/src/stories/Alert/Alert.settings.ts +117 -116
- package/src/stories/Alert/Alert.stories.ts +30 -30
- package/src/stories/Alert/Alert.test.ts +78 -80
- package/src/stories/Alert/AlertModifiers.stories.ts +45 -45
- package/src/stories/Alert/AlertSlots.stories.ts +35 -35
- package/src/stories/AlertGroup/AlertGroup.settings.ts +107 -105
- package/src/stories/AlertGroup/AlertGroup.stories.ts +25 -25
- package/src/stories/AlertGroup/AlertGroup.test.ts +69 -71
- package/src/stories/AlertGroup/AlertGroupPosition.stories.ts +68 -68
- package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +23 -23
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +58 -58
- package/src/stories/Avatar/Avatar.settings.ts +29 -29
- package/src/stories/Avatar/Avatar.stories.ts +22 -22
- package/src/stories/Avatar/Avatar.test.ts +22 -24
- package/src/stories/Avatar/AvatarBadge.stories.ts +15 -15
- package/src/stories/Avatar/AvatarModifiers.stories.ts +60 -60
- package/src/stories/Avatar/AvatarSlots.stories.ts +17 -17
- package/src/stories/AvatarGroup/AvatarGroup.settings.ts +54 -53
- package/src/stories/AvatarGroup/AvatarGroup.stories.ts +17 -17
- package/src/stories/AvatarGroup/AvatarGroup.test.ts +24 -26
- package/src/stories/AvatarGroup/AvatarGroupModifiers.stories.ts +15 -15
- package/src/stories/AvatarGroup/AvatarGroupSlotDefault.stories.ts +17 -17
- package/src/stories/Badge/Badge.settings.ts +21 -20
- package/src/stories/Badge/Badge.stories.ts +24 -24
- package/src/stories/Badge/Badge.test.ts +8 -8
- package/src/stories/Badge/BadgeSlots.stories.ts +10 -10
- package/src/stories/Blurhash/BlurhashComposable.stories.ts +116 -0
- package/src/stories/Breadcrumb/Breadcrumb.settings.ts +35 -34
- package/src/stories/Breadcrumb/Breadcrumb.stories.ts +23 -23
- package/src/stories/Breadcrumb/Breadcrumb.test.ts +44 -43
- package/src/stories/Breadcrumb/BreadcrumbSlots.stories.ts +19 -19
- package/src/stories/Button/Button.settings.ts +147 -151
- package/src/stories/Button/Button.stories.ts +19 -19
- package/src/stories/Button/Button.test.ts +41 -42
- package/src/stories/Button/ButtonIcon.stories.ts +42 -42
- package/src/stories/Button/ButtonLink.stories.ts +24 -24
- package/src/stories/Button/ButtonLoading.stories.ts +22 -22
- package/src/stories/Button/ButtonModifiers.stories.ts +91 -91
- package/src/stories/Button/ButtonSlots.stories.ts +47 -47
- package/src/stories/Button/ButtonState.stories.ts +23 -23
- package/src/stories/Button/ButtonToggle.stories.ts +30 -30
- package/src/stories/ButtonGroup/ButtonGroup.settings.ts +33 -24
- package/src/stories/ButtonGroup/ButtonGroup.stories.ts +19 -19
- package/src/stories/ButtonGroup/ButtonGroup.test.ts +23 -26
- package/src/stories/ButtonGroup/ButtonGroupModifiers.stories.ts +20 -20
- package/src/stories/ButtonGroup/ButtonGroupSlots.stories.ts +17 -17
- package/src/stories/ButtonGroup/ButtonGroupToggle.stories.ts +22 -22
- package/src/stories/Card/Card.settings.ts +49 -48
- package/src/stories/Card/Card.stories.ts +22 -22
- package/src/stories/Card/Card.test.ts +14 -16
- package/src/stories/Card/CardSlots.stories.ts +42 -42
- package/src/stories/Checkbox/Checkbox.settings.ts +36 -35
- package/src/stories/Checkbox/Checkbox.stories.ts +57 -57
- package/src/stories/Checkbox/Checkbox.test.ts +63 -66
- package/src/stories/Checkbox/CheckboxBinary.stories.ts +18 -18
- package/src/stories/Checkbox/CheckboxSlots.stories.ts +15 -15
- package/src/stories/CheckboxGroup/CheckboxGroup.settings.ts +9 -9
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.ts +50 -50
- package/src/stories/CheckboxGroup/CheckboxGroup.test.ts +64 -68
- package/src/stories/CheckboxGroup/CheckboxGroupOptions.stories.ts +34 -34
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.ts +23 -23
- package/src/stories/Combobox/Combobox.settings.ts +408 -385
- package/src/stories/Combobox/Combobox.stories.ts +116 -107
- package/src/stories/Combobox/Combobox.test.ts +92 -92
- package/src/stories/Combobox/ComboboxIconPosition.stories.ts +25 -24
- package/src/stories/Combobox/ComboboxMultiple.stories.ts +32 -22
- package/src/stories/Combobox/ComboboxOptions.stories.ts +81 -84
- package/src/stories/Combobox/ComboboxSlots.stories.ts +55 -54
- package/src/stories/Dialog/Dialog.settings.ts +49 -40
- package/src/stories/Dialog/Dialog.stories.ts +28 -28
- package/src/stories/Dialog/Dialog.test.ts +49 -54
- package/src/stories/Dialog/DialogModifiers.stories.ts +42 -0
- package/src/stories/Dialog/DialogSlots.stories.ts +20 -20
- package/src/stories/Dropdown/Dropdown.settings.ts +62 -61
- package/src/stories/Dropdown/Dropdown.stories.ts +60 -60
- package/src/stories/Dropdown/Dropdown.test.ts +9 -13
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.ts +18 -19
- package/src/stories/Dropdown/DropdownMultilevel.stories.ts +19 -19
- package/src/stories/Dropdown/DropdownSlots.stories.ts +51 -51
- package/src/stories/Icon/Icon.settings.ts +66 -65
- package/src/stories/Icon/Icon.stories.ts +29 -30
- package/src/stories/Icon/IconsCollection.stories.ts +24 -24
- package/src/stories/InputFile/InputFile.settings.ts +37 -0
- package/src/stories/InputFile/InputFile.stories.ts +97 -0
- package/src/stories/InputFile/InputFileDropArea.stories.ts +56 -0
- package/src/stories/InputFile/InputFileIconPosition.stories.ts +43 -0
- package/src/stories/InputFile/InputFileSlots.stories.ts +33 -0
- package/src/stories/InputText/InputText.settings.ts +248 -246
- package/src/stories/InputText/InputText.stories.ts +68 -68
- package/src/stories/InputText/InputText.test.ts +119 -122
- package/src/stories/InputText/InputTextIconPosition.stories.ts +24 -24
- package/src/stories/InputText/InputTextLength.stories.ts +33 -33
- package/src/stories/InputText/InputTextMask.stories.ts +91 -91
- package/src/stories/InputText/InputTextMinMax.stories.ts +30 -30
- package/src/stories/InputText/InputTextSlots.stories.ts +20 -20
- package/src/stories/InputText/InputTextType.stories.ts +70 -70
- package/src/stories/Nav/Nav.settings.ts +27 -27
- package/src/stories/Nav/Nav.stories.ts +18 -18
- package/src/stories/Nav/Nav.test.ts +10 -12
- package/src/stories/Nav/NavModifiers.stories.ts +25 -25
- package/src/stories/Progress/Progress.settings.ts +24 -23
- package/src/stories/Progress/Progress.stories.ts +23 -23
- package/src/stories/Progress/Progress.test.ts +5 -5
- package/src/stories/Radio/Radio.settings.ts +9 -9
- package/src/stories/Radio/Radio.stories.ts +47 -47
- package/src/stories/Radio/Radio.test.ts +54 -57
- package/src/stories/Radio/RadioSlots.stories.ts +15 -15
- package/src/stories/RadioGroup/RadioGroup.settings.ts +9 -9
- package/src/stories/RadioGroup/RadioGroup.stories.ts +51 -52
- package/src/stories/RadioGroup/RadioGroup.test.ts +64 -68
- package/src/stories/RadioGroup/RadioGroupOptions.stories.ts +35 -35
- package/src/stories/RadioGroup/RadioGroupSlots.stories.ts +23 -23
- package/src/stories/Select/Select.settings.ts +72 -71
- package/src/stories/Select/Select.stories.ts +75 -66
- package/src/stories/Select/Select.test.ts +67 -70
- package/src/stories/Select/SelectIconPosition.stories.ts +27 -26
- package/src/stories/Select/SelectOptions.stories.ts +55 -55
- package/src/stories/Select/SelectSlots.stories.ts +21 -20
- package/src/stories/Tab/Tab.settings.ts +34 -34
- package/src/stories/Tab/Tab.stories.ts +16 -16
- package/src/stories/Tab/Tab.test.ts +17 -19
- package/src/stories/Textarea/Textarea.settings.ts +80 -78
- package/src/stories/Textarea/Textarea.stories.ts +63 -63
- package/src/stories/Textarea/Textarea.test.ts +70 -73
- package/src/stories/Textarea/TextareaLength.stories.ts +33 -33
- package/src/stories/Textarea/TextareaSlots.stories.ts +20 -20
- package/src/stories/Textarea/TextareatIconPosition.stories.ts +24 -24
- package/src/stories/Tooltip/Tooltip.settings.ts +16 -17
- package/src/stories/Tooltip/Tooltip.stories.ts +18 -18
- package/src/stories/Tooltip/Tooltip.test.ts +53 -54
- package/src/stories/Tooltip/TooltipDirective.stories.ts +37 -37
- package/src/stories/argTypes.ts +506 -505
- package/src/test/expect.ts +74 -79
- package/src/test/options.ts +17 -16
- package/src/test/sleep.ts +3 -2
- package/src/test/types.d.ts +12 -12
- package/src/types/alert.ts +21 -17
- package/src/types/blurhash.ts +21 -0
- package/src/types/floating-ui.ts +1 -1
- package/src/types/generic.ts +2 -3
- package/src/types/group.ts +35 -27
- package/src/types/index.ts +7 -0
- package/src/types/input-file.ts +10 -0
- package/src/types/nav.ts +13 -14
- package/src/utils/DomUtilities.ts +15 -0
- package/src/utils/ObjectUtilities.ts +192 -188
- package/src/workers/blurhash.ts +9 -0
- package/dist/composables/alert/useInjectAlert.d.ts +0 -9
- package/dist/composables/dropdown/useInjectDropdown.d.ts +0 -32
- package/dist/composables/group/useInjectedGroupState.d.ts +0 -10
- package/dist/composables/group/useProvideGroupState.d.ts +0 -6
- package/src/composables/dropdown/useProvideDropdown.ts +0 -94
- package/src/composables/group/useInjectedGroupState.ts +0 -51
- package/src/composables/group/useProvideGroupState.ts +0 -20
- /package/src/assets/icons/normal/{dulicate.svg → duplicate.svg} +0 -0
|
@@ -1,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,82 @@ 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 RequiredProps = {
|
|
276
|
+
/**
|
|
277
|
+
* Whether the form control is required
|
|
278
|
+
*/
|
|
279
|
+
required: {
|
|
280
|
+
type: Boolean,
|
|
281
|
+
default: false
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
const SelectedProps = {
|
|
285
|
+
/**
|
|
286
|
+
* Whether the item is selected
|
|
287
|
+
*/
|
|
288
|
+
selected: {
|
|
289
|
+
type: Boolean,
|
|
290
|
+
default: false
|
|
291
|
+
}
|
|
453
292
|
};
|
|
454
293
|
const ActiveProps = {
|
|
455
294
|
/**
|
|
456
295
|
* Whether the item is active
|
|
457
296
|
*/
|
|
458
|
-
active:
|
|
297
|
+
active: {
|
|
298
|
+
type: Boolean,
|
|
299
|
+
default: false
|
|
300
|
+
}
|
|
459
301
|
};
|
|
460
302
|
const CurrentProps = {
|
|
461
303
|
/**
|
|
462
304
|
* Whether the item is current
|
|
463
305
|
*/
|
|
464
|
-
current:
|
|
306
|
+
current: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
default: false
|
|
309
|
+
}
|
|
465
310
|
};
|
|
466
311
|
const PressedProps = {
|
|
467
312
|
/**
|
|
468
313
|
* Whether the item is pressed
|
|
469
314
|
*/
|
|
470
|
-
pressed:
|
|
315
|
+
pressed: {
|
|
316
|
+
type: Boolean,
|
|
317
|
+
default: false
|
|
318
|
+
}
|
|
471
319
|
};
|
|
472
320
|
const LabelProps = {
|
|
473
321
|
/**
|
|
474
322
|
* The item label
|
|
475
323
|
*/
|
|
476
|
-
label:
|
|
324
|
+
label: {
|
|
325
|
+
type: [String, Number],
|
|
326
|
+
default: void 0
|
|
327
|
+
}
|
|
477
328
|
};
|
|
478
329
|
const ReadonlyProps = {
|
|
479
330
|
/**
|
|
480
331
|
* The value is not editable
|
|
481
332
|
*/
|
|
482
|
-
readonly:
|
|
333
|
+
readonly: {
|
|
334
|
+
type: Boolean,
|
|
335
|
+
default: false
|
|
336
|
+
}
|
|
483
337
|
};
|
|
484
338
|
const ModifiersProps = {
|
|
485
339
|
/**
|
|
486
340
|
* Component BEM modifiers
|
|
487
341
|
*/
|
|
488
|
-
modifiers:
|
|
342
|
+
modifiers: {
|
|
343
|
+
type: [String, Array],
|
|
344
|
+
default: void 0
|
|
345
|
+
}
|
|
489
346
|
};
|
|
490
347
|
const HintProps = {
|
|
491
348
|
hintLabel: { type: String, default: "" }
|
|
@@ -504,14 +361,20 @@ const DebounceProps = {
|
|
|
504
361
|
/**
|
|
505
362
|
* Milliseconds to wait before emitting the input event
|
|
506
363
|
*/
|
|
507
|
-
debounce:
|
|
364
|
+
debounce: {
|
|
365
|
+
type: [Number, String],
|
|
366
|
+
default: void 0
|
|
367
|
+
}
|
|
508
368
|
};
|
|
509
369
|
const IconProps = {
|
|
510
370
|
/**
|
|
511
371
|
* VvIcon name or props
|
|
512
372
|
* @see VVIcon
|
|
513
373
|
*/
|
|
514
|
-
icon: {
|
|
374
|
+
icon: {
|
|
375
|
+
type: [String, Object],
|
|
376
|
+
default: void 0
|
|
377
|
+
},
|
|
515
378
|
/**
|
|
516
379
|
* VvIcon position
|
|
517
380
|
*/
|
|
@@ -532,7 +395,16 @@ const FloatingLabelProps = {
|
|
|
532
395
|
/**
|
|
533
396
|
* If true the label will be floating
|
|
534
397
|
*/
|
|
535
|
-
floating:
|
|
398
|
+
floating: {
|
|
399
|
+
type: Boolean,
|
|
400
|
+
default: false
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
const UnselectableProps = {
|
|
404
|
+
/**
|
|
405
|
+
* If true the input will be unselectable
|
|
406
|
+
*/
|
|
407
|
+
unselectable: { type: Boolean, default: true }
|
|
536
408
|
};
|
|
537
409
|
const IdProps = {
|
|
538
410
|
/**
|
|
@@ -541,7 +413,7 @@ const IdProps = {
|
|
|
541
413
|
*/
|
|
542
414
|
id: [String, Number]
|
|
543
415
|
};
|
|
544
|
-
|
|
416
|
+
const DropdownProps = {
|
|
545
417
|
/**
|
|
546
418
|
* Dropdown placement
|
|
547
419
|
*/
|
|
@@ -562,7 +434,8 @@ const IdProps = {
|
|
|
562
434
|
* Dropdown show / hide transition name
|
|
563
435
|
*/
|
|
564
436
|
transitionName: {
|
|
565
|
-
type: String
|
|
437
|
+
type: String,
|
|
438
|
+
default: void 0
|
|
566
439
|
},
|
|
567
440
|
/**
|
|
568
441
|
* Offset of the dropdown from the trigger
|
|
@@ -630,9 +503,10 @@ const IdProps = {
|
|
|
630
503
|
* Set dropdown width to the same as the trigger
|
|
631
504
|
*/
|
|
632
505
|
triggerWidth: {
|
|
633
|
-
type: Boolean
|
|
506
|
+
type: Boolean,
|
|
507
|
+
default: false
|
|
634
508
|
}
|
|
635
|
-
}
|
|
509
|
+
};
|
|
636
510
|
const IdNameProps = {
|
|
637
511
|
...IdProps,
|
|
638
512
|
/**
|
|
@@ -647,7 +521,10 @@ const AutofocusProps = {
|
|
|
647
521
|
* Global attribute autofocus
|
|
648
522
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
649
523
|
*/
|
|
650
|
-
autofocus:
|
|
524
|
+
autofocus: {
|
|
525
|
+
type: Boolean,
|
|
526
|
+
default: false
|
|
527
|
+
}
|
|
651
528
|
};
|
|
652
529
|
const AutocompleteProps = {
|
|
653
530
|
/**
|
|
@@ -679,28 +556,31 @@ const InputTextareaProps = {
|
|
|
679
556
|
* Available for input types: text, search, url, tel, email, password
|
|
680
557
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
681
558
|
*/
|
|
682
|
-
minlength: [String, Number],
|
|
559
|
+
minlength: { type: [String, Number], default: void 0 },
|
|
683
560
|
/**
|
|
684
561
|
* Input / Textarea maxlength
|
|
685
562
|
* Maximum length (number of characters) of value
|
|
686
563
|
* Available for input types: text, search, url, tel, email, password
|
|
687
564
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
688
565
|
*/
|
|
689
|
-
maxlength: [String, Number],
|
|
566
|
+
maxlength: { type: [String, Number], default: void 0 },
|
|
690
567
|
/**
|
|
691
568
|
* Input / Textarea placeholder
|
|
692
569
|
* Text that appears in the form control when it has no value set
|
|
693
570
|
* Available for input types: text, search, url, tel, email, password, number
|
|
694
571
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
|
|
695
572
|
*/
|
|
696
|
-
placeholder:
|
|
573
|
+
placeholder: {
|
|
574
|
+
type: String,
|
|
575
|
+
default: void 0
|
|
576
|
+
},
|
|
697
577
|
/**
|
|
698
578
|
* Input / Textarea required
|
|
699
579
|
* A value is required or must be check for the form to be submittable
|
|
700
580
|
* Available for all input types except color
|
|
701
581
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
|
|
702
582
|
*/
|
|
703
|
-
|
|
583
|
+
...RequiredProps
|
|
704
584
|
};
|
|
705
585
|
({
|
|
706
586
|
...DisabledProps,
|
|
@@ -723,38 +603,836 @@ const InputTextareaProps = {
|
|
|
723
603
|
ariaLabel: {
|
|
724
604
|
type: String,
|
|
725
605
|
default: void 0
|
|
606
|
+
},
|
|
607
|
+
/**
|
|
608
|
+
* Default tag for the action
|
|
609
|
+
*/
|
|
610
|
+
defaultTag: {
|
|
611
|
+
type: String,
|
|
612
|
+
default: ActionTag.button
|
|
726
613
|
}
|
|
727
614
|
});
|
|
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"
|
|
615
|
+
const StorageProps = {
|
|
616
|
+
storageType: {
|
|
617
|
+
type: String,
|
|
618
|
+
default: StorageType.local,
|
|
619
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
620
|
+
},
|
|
621
|
+
storageKey: String
|
|
750
622
|
};
|
|
751
|
-
const
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
623
|
+
const VvDropdownProps = {
|
|
624
|
+
...IdProps,
|
|
625
|
+
...DropdownProps,
|
|
626
|
+
...ModifiersProps,
|
|
627
|
+
/**
|
|
628
|
+
* Show / hide dropdown programmatically
|
|
629
|
+
*/
|
|
630
|
+
modelValue: {
|
|
631
|
+
type: Boolean,
|
|
632
|
+
default: void 0
|
|
633
|
+
},
|
|
634
|
+
/**
|
|
635
|
+
* Dropdown trigger element
|
|
636
|
+
*/
|
|
637
|
+
reference: {
|
|
638
|
+
type: Object,
|
|
639
|
+
default: null
|
|
640
|
+
},
|
|
641
|
+
/**
|
|
642
|
+
* Dropdown role
|
|
643
|
+
*/
|
|
644
|
+
role: {
|
|
645
|
+
type: String,
|
|
646
|
+
default: DropdownRole.menu,
|
|
647
|
+
validator: (value) => Object.values(DropdownRole).includes(value)
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const VvDropdownItemProps = {
|
|
651
|
+
focusOnHover: {
|
|
652
|
+
type: Boolean,
|
|
653
|
+
default: false
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
const VvDropdownOptionProps = {
|
|
657
|
+
...DisabledProps,
|
|
658
|
+
...SelectedProps,
|
|
659
|
+
...UnselectableProps,
|
|
660
|
+
...ModifiersProps,
|
|
661
|
+
deselectHintLabel: {
|
|
662
|
+
type: String
|
|
663
|
+
},
|
|
664
|
+
selectHintLabel: {
|
|
665
|
+
type: String
|
|
666
|
+
},
|
|
667
|
+
selectedHintLabel: {
|
|
668
|
+
type: String
|
|
669
|
+
},
|
|
670
|
+
focusOnHover: {
|
|
671
|
+
type: Boolean,
|
|
672
|
+
default: false
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
function useUniqueId(id) {
|
|
676
|
+
return computed(() => String((id == null ? void 0 : id.value) || useId()));
|
|
677
|
+
}
|
|
678
|
+
function useDropdownProvideTrigger({
|
|
679
|
+
reference,
|
|
680
|
+
id,
|
|
681
|
+
expanded,
|
|
682
|
+
aria
|
|
683
|
+
}) {
|
|
684
|
+
const bus = mitt();
|
|
685
|
+
const component = defineComponent({
|
|
686
|
+
name: "VvDropdownTriggerProvider",
|
|
687
|
+
setup() {
|
|
688
|
+
provide(INJECTION_KEY_DROPDOWN_TRIGGER, {
|
|
689
|
+
reference,
|
|
690
|
+
id,
|
|
691
|
+
expanded,
|
|
692
|
+
aria,
|
|
693
|
+
bus
|
|
694
|
+
});
|
|
695
|
+
},
|
|
696
|
+
render() {
|
|
697
|
+
var _a, _b;
|
|
698
|
+
return h(Fragment, {}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
return {
|
|
702
|
+
bus,
|
|
703
|
+
component
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
function useDropdownProvideItem({
|
|
707
|
+
role,
|
|
708
|
+
...others
|
|
709
|
+
}) {
|
|
710
|
+
const itemRole = computed(
|
|
711
|
+
() => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
|
|
712
|
+
);
|
|
713
|
+
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
714
|
+
role: itemRole,
|
|
715
|
+
...others
|
|
716
|
+
});
|
|
717
|
+
return { itemRole };
|
|
718
|
+
}
|
|
719
|
+
function useDropdownProvideAction({
|
|
720
|
+
expanded
|
|
721
|
+
}) {
|
|
722
|
+
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
723
|
+
role: ref(ActionRoles.menuitem),
|
|
724
|
+
expanded
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
function useModifiers(prefix, modifiers, others) {
|
|
728
|
+
return computed(() => {
|
|
729
|
+
const toReturn = {
|
|
730
|
+
[prefix]: true
|
|
731
|
+
};
|
|
732
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
733
|
+
if (modifiersArray) {
|
|
734
|
+
if (Array.isArray(modifiersArray)) {
|
|
735
|
+
modifiersArray.forEach((modifier) => {
|
|
736
|
+
if (modifier) {
|
|
737
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
if (others) {
|
|
743
|
+
Object.keys(others.value).forEach((key) => {
|
|
744
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
return toReturn;
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
const _hoisted_1$2 = ["id", "tabindex", "role", "aria-labelledby"];
|
|
751
|
+
const __default__$4 = {
|
|
752
|
+
name: "VvDropdown",
|
|
753
|
+
inheritAttrs: false
|
|
754
|
+
};
|
|
755
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
756
|
+
...__default__$4,
|
|
757
|
+
props: VvDropdownProps,
|
|
758
|
+
emits: [
|
|
759
|
+
"update:modelValue",
|
|
760
|
+
"beforeEnter",
|
|
761
|
+
"afterLeave",
|
|
762
|
+
"beforeExpand",
|
|
763
|
+
"beforeCollapse",
|
|
764
|
+
"afterExpand",
|
|
765
|
+
"afterCollapse",
|
|
766
|
+
"before-enter",
|
|
767
|
+
"after-leave",
|
|
768
|
+
"enter",
|
|
769
|
+
"afterEnter",
|
|
770
|
+
"enterCancelled",
|
|
771
|
+
"beforeLeave",
|
|
772
|
+
"leave",
|
|
773
|
+
"leaveCancelled"
|
|
774
|
+
],
|
|
775
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
776
|
+
const props = __props;
|
|
777
|
+
const emit = __emit;
|
|
778
|
+
const { id } = toRefs(props);
|
|
779
|
+
const hasId = useUniqueId(id);
|
|
780
|
+
const attrs = useAttrs();
|
|
781
|
+
const maxWidth = ref("auto");
|
|
782
|
+
const maxHeight = ref("auto");
|
|
783
|
+
const localReferenceEl = ref();
|
|
784
|
+
const floatingEl = ref();
|
|
785
|
+
const arrowEl = ref();
|
|
786
|
+
const listEl = ref();
|
|
787
|
+
const referenceEl = computed({
|
|
788
|
+
get: () => props.reference ?? localReferenceEl.value,
|
|
789
|
+
set: (newValue) => {
|
|
790
|
+
localReferenceEl.value = newValue;
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
const hasCustomPosition = ref(false);
|
|
794
|
+
onMounted(() => {
|
|
795
|
+
useMutationObserver(
|
|
796
|
+
floatingEl.value,
|
|
797
|
+
() => {
|
|
798
|
+
var _a;
|
|
799
|
+
hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
attributeFilter: ["style"],
|
|
803
|
+
window
|
|
804
|
+
}
|
|
805
|
+
);
|
|
806
|
+
});
|
|
807
|
+
const middleware = computed(() => {
|
|
808
|
+
const toReturn = [];
|
|
809
|
+
if (props.autoPlacement) {
|
|
810
|
+
if (typeof props.autoPlacement === "boolean") {
|
|
811
|
+
toReturn.push(autoPlacement());
|
|
812
|
+
} else {
|
|
813
|
+
toReturn.push(
|
|
814
|
+
autoPlacement(props.autoPlacement)
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
} else if (props.flip) {
|
|
818
|
+
if (typeof props.flip === "boolean") {
|
|
819
|
+
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
820
|
+
} else {
|
|
821
|
+
toReturn.push(flip(props.flip));
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
if (props.shift) {
|
|
825
|
+
if (typeof props.shift === "boolean") {
|
|
826
|
+
toReturn.push(shift());
|
|
827
|
+
} else {
|
|
828
|
+
toReturn.push(shift(props.shift));
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
if (props.size) {
|
|
832
|
+
const apply = ({
|
|
833
|
+
availableWidth,
|
|
834
|
+
availableHeight
|
|
835
|
+
}) => {
|
|
836
|
+
maxWidth.value = `${availableWidth}px`;
|
|
837
|
+
maxHeight.value = `${availableHeight}px`;
|
|
838
|
+
};
|
|
839
|
+
if (typeof props.size === "boolean") {
|
|
840
|
+
toReturn.push(
|
|
841
|
+
size({
|
|
842
|
+
apply
|
|
843
|
+
})
|
|
844
|
+
);
|
|
845
|
+
} else {
|
|
846
|
+
toReturn.push(
|
|
847
|
+
size({
|
|
848
|
+
...props.size,
|
|
849
|
+
apply
|
|
850
|
+
})
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
if (props.offset) {
|
|
855
|
+
toReturn.push(offset(Number(props.offset)));
|
|
856
|
+
if (["string", "number"].includes(typeof props.offset)) {
|
|
857
|
+
toReturn.push(offset(Number(props.offset)));
|
|
858
|
+
} else {
|
|
859
|
+
toReturn.push(offset(props.offset));
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
if (props.arrow) {
|
|
863
|
+
toReturn.push(
|
|
864
|
+
arrow({
|
|
865
|
+
element: arrowEl
|
|
866
|
+
})
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
return toReturn;
|
|
870
|
+
});
|
|
871
|
+
const { x, y, middlewareData, placement, strategy } = useFloating(
|
|
872
|
+
referenceEl,
|
|
873
|
+
floatingEl,
|
|
874
|
+
{
|
|
875
|
+
whileElementsMounted: (...args) => {
|
|
876
|
+
return autoUpdate(...args, {
|
|
877
|
+
animationFrame: props.strategy === Strategy.fixed
|
|
878
|
+
});
|
|
879
|
+
},
|
|
880
|
+
placement: computed(() => props.placement),
|
|
881
|
+
strategy: computed(() => props.strategy),
|
|
882
|
+
middleware
|
|
883
|
+
}
|
|
884
|
+
);
|
|
885
|
+
const dropdownPlacement = computed(() => {
|
|
886
|
+
var _a;
|
|
887
|
+
if (hasCustomPosition.value) {
|
|
888
|
+
return void 0;
|
|
889
|
+
}
|
|
890
|
+
const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
|
|
891
|
+
return {
|
|
892
|
+
position: strategy.value,
|
|
893
|
+
top: `${y.value ?? 0}px`,
|
|
894
|
+
left: `${x.value ?? 0}px`,
|
|
895
|
+
maxWidth: width ? void 0 : maxWidth.value,
|
|
896
|
+
maxHeight: maxHeight.value,
|
|
897
|
+
width
|
|
898
|
+
};
|
|
899
|
+
});
|
|
900
|
+
const side = computed(
|
|
901
|
+
() => placement.value.split("-")[0]
|
|
902
|
+
);
|
|
903
|
+
const arrowPlacement = computed(() => {
|
|
904
|
+
var _a, _b, _c, _d, _e;
|
|
905
|
+
if (hasCustomPosition.value) {
|
|
906
|
+
return void 0;
|
|
907
|
+
}
|
|
908
|
+
const staticSide = {
|
|
909
|
+
[Side.top]: Side.bottom,
|
|
910
|
+
[Side.right]: Side.left,
|
|
911
|
+
[Side.bottom]: Side.top,
|
|
912
|
+
[Side.left]: Side.right
|
|
913
|
+
}[side.value];
|
|
914
|
+
return {
|
|
915
|
+
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
916
|
+
top: ((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) !== void 0 ? `${(_d = middlewareData.value.arrow) == null ? void 0 : _d.y}px` : void 0,
|
|
917
|
+
[staticSide]: `${-(((_e = arrowEl.value) == null ? void 0 : _e.offsetWidth) ?? 0) / 2}px`
|
|
918
|
+
};
|
|
919
|
+
});
|
|
920
|
+
const modelValue = useVModel(props, "modelValue", emit);
|
|
921
|
+
const localModelValue = ref(false);
|
|
922
|
+
const expanded = computed({
|
|
923
|
+
get: () => modelValue.value ?? localModelValue.value,
|
|
924
|
+
set: (newValue) => {
|
|
925
|
+
if (modelValue.value === void 0) {
|
|
926
|
+
localModelValue.value = newValue;
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
modelValue.value = newValue;
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
function show() {
|
|
933
|
+
expanded.value = true;
|
|
934
|
+
}
|
|
935
|
+
function hide() {
|
|
936
|
+
expanded.value = false;
|
|
937
|
+
}
|
|
938
|
+
function toggle() {
|
|
939
|
+
expanded.value = !expanded.value;
|
|
940
|
+
}
|
|
941
|
+
function init(el) {
|
|
942
|
+
referenceEl.value = el;
|
|
943
|
+
}
|
|
944
|
+
__expose({
|
|
945
|
+
toggle,
|
|
946
|
+
show,
|
|
947
|
+
hide,
|
|
948
|
+
init,
|
|
949
|
+
customPosition: hasCustomPosition
|
|
950
|
+
});
|
|
951
|
+
watch(expanded, (newValue) => {
|
|
952
|
+
if (newValue && props.autofocusFirst) {
|
|
953
|
+
nextTick(() => {
|
|
954
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
955
|
+
floatingEl.value
|
|
956
|
+
);
|
|
957
|
+
if (focusableElements.length > 0) {
|
|
958
|
+
focusableElements[0].focus({
|
|
959
|
+
preventScroll: true
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
onClickOutside(
|
|
966
|
+
floatingEl,
|
|
967
|
+
() => {
|
|
968
|
+
if (!props.keepOpen && expanded.value) {
|
|
969
|
+
expanded.value = false;
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
{ ignore: [referenceEl] }
|
|
973
|
+
);
|
|
974
|
+
const hasAriaLabelledby = computed(() => {
|
|
975
|
+
var _a, _b;
|
|
976
|
+
return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
|
|
977
|
+
});
|
|
978
|
+
const referenceAria = computed(() => ({
|
|
979
|
+
"aria-controls": hasId.value,
|
|
980
|
+
"aria-haspopup": true,
|
|
981
|
+
"aria-expanded": expanded.value
|
|
982
|
+
}));
|
|
983
|
+
const { component: VvDropdownTriggerProvider, bus } = useDropdownProvideTrigger({
|
|
984
|
+
reference: referenceEl,
|
|
985
|
+
id: hasId,
|
|
986
|
+
expanded,
|
|
987
|
+
aria: referenceAria
|
|
988
|
+
});
|
|
989
|
+
bus.on("click", toggle);
|
|
990
|
+
const { role, modifiers } = toRefs(props);
|
|
991
|
+
const bemCssClasses = useModifiers(
|
|
992
|
+
"vv-dropdown",
|
|
993
|
+
modifiers,
|
|
994
|
+
computed(() => ({
|
|
995
|
+
arrow: props.arrow
|
|
996
|
+
}))
|
|
997
|
+
);
|
|
998
|
+
const { focused } = useFocusWithin(floatingEl);
|
|
999
|
+
function getKeyboardFocusableElements(element) {
|
|
1000
|
+
if (!element) {
|
|
1001
|
+
return [];
|
|
1002
|
+
}
|
|
1003
|
+
return [
|
|
1004
|
+
...element.querySelectorAll(
|
|
1005
|
+
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
1006
|
+
)
|
|
1007
|
+
].filter(
|
|
1008
|
+
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
function focusNext() {
|
|
1012
|
+
nextTick(() => {
|
|
1013
|
+
if (focused.value) {
|
|
1014
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
1015
|
+
floatingEl.value
|
|
1016
|
+
);
|
|
1017
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
1021
|
+
document.activeElement
|
|
1022
|
+
);
|
|
1023
|
+
if (activeElementIndex < focusableElements.length - 1) {
|
|
1024
|
+
focusableElements[activeElementIndex + 1].focus({
|
|
1025
|
+
preventScroll: true
|
|
1026
|
+
});
|
|
1027
|
+
} else {
|
|
1028
|
+
focusableElements[0].focus({
|
|
1029
|
+
preventScroll: true
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
function focusPrev() {
|
|
1036
|
+
nextTick(() => {
|
|
1037
|
+
if (focused.value) {
|
|
1038
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
1039
|
+
floatingEl.value
|
|
1040
|
+
);
|
|
1041
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
1045
|
+
document.activeElement
|
|
1046
|
+
);
|
|
1047
|
+
if (activeElementIndex > 0) {
|
|
1048
|
+
focusableElements[activeElementIndex - 1].focus({
|
|
1049
|
+
preventScroll: true
|
|
1050
|
+
});
|
|
1051
|
+
} else {
|
|
1052
|
+
focusableElements[focusableElements.length - 1].focus({
|
|
1053
|
+
preventScroll: true
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
const hovered = useElementHover(floatingEl);
|
|
1060
|
+
const { itemRole } = useDropdownProvideItem({
|
|
1061
|
+
role,
|
|
1062
|
+
expanded,
|
|
1063
|
+
focused,
|
|
1064
|
+
hovered
|
|
1065
|
+
});
|
|
1066
|
+
onKeyStroke("Escape", (e) => {
|
|
1067
|
+
if (expanded.value) {
|
|
1068
|
+
e.preventDefault();
|
|
1069
|
+
hide();
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
onKeyStroke("ArrowDown", (e) => {
|
|
1073
|
+
if (expanded.value && focused.value) {
|
|
1074
|
+
e.preventDefault();
|
|
1075
|
+
focusNext();
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
onKeyStroke("ArrowUp", (e) => {
|
|
1079
|
+
if (expanded.value && focused.value) {
|
|
1080
|
+
e.preventDefault();
|
|
1081
|
+
focusPrev();
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
onKeyStroke([" ", "Enter"], (e) => {
|
|
1085
|
+
const htmlEl = e.target;
|
|
1086
|
+
if (expanded.value && focused.value && htmlEl) {
|
|
1087
|
+
htmlEl == null ? void 0 : htmlEl.click();
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
const dropdownTransitionHandlers = {
|
|
1091
|
+
"before-enter": () => {
|
|
1092
|
+
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
1093
|
+
emit("beforeEnter");
|
|
1094
|
+
},
|
|
1095
|
+
"after-leave": () => {
|
|
1096
|
+
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
1097
|
+
emit("afterLeave");
|
|
1098
|
+
},
|
|
1099
|
+
"enter": () => {
|
|
1100
|
+
emit("enter");
|
|
1101
|
+
},
|
|
1102
|
+
"after-enter": () => {
|
|
1103
|
+
emit("afterEnter");
|
|
1104
|
+
},
|
|
1105
|
+
"enter-cancelled": () => {
|
|
1106
|
+
emit("enterCancelled");
|
|
1107
|
+
},
|
|
1108
|
+
"before-leave": () => {
|
|
1109
|
+
emit("beforeLeave");
|
|
1110
|
+
},
|
|
1111
|
+
"leave": () => {
|
|
1112
|
+
emit("leave");
|
|
1113
|
+
},
|
|
1114
|
+
"leave-cancelled": () => {
|
|
1115
|
+
emit("leaveCancelled");
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
return (_ctx, _cache) => {
|
|
1119
|
+
return openBlock(), createElementBlock(
|
|
1120
|
+
Fragment,
|
|
1121
|
+
null,
|
|
1122
|
+
[
|
|
1123
|
+
createVNode(unref(VvDropdownTriggerProvider), null, {
|
|
1124
|
+
default: withCtx(() => [
|
|
1125
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
|
|
1126
|
+
]),
|
|
1127
|
+
_: 3
|
|
1128
|
+
/* FORWARDED */
|
|
1129
|
+
}),
|
|
1130
|
+
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers), { persisted: "" }), {
|
|
1131
|
+
default: withCtx(() => [
|
|
1132
|
+
withDirectives(createElementVNode(
|
|
1133
|
+
"div",
|
|
1134
|
+
{
|
|
1135
|
+
ref_key: "floatingEl",
|
|
1136
|
+
ref: floatingEl,
|
|
1137
|
+
style: normalizeStyle(unref(dropdownPlacement)),
|
|
1138
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
1139
|
+
},
|
|
1140
|
+
[
|
|
1141
|
+
props.arrow ? (openBlock(), createElementBlock(
|
|
1142
|
+
"div",
|
|
1143
|
+
{
|
|
1144
|
+
key: 0,
|
|
1145
|
+
ref_key: "arrowEl",
|
|
1146
|
+
ref: arrowEl,
|
|
1147
|
+
style: normalizeStyle(unref(arrowPlacement)),
|
|
1148
|
+
class: "vv-dropdown__arrow"
|
|
1149
|
+
},
|
|
1150
|
+
null,
|
|
1151
|
+
4
|
|
1152
|
+
/* STYLE */
|
|
1153
|
+
)) : createCommentVNode("v-if", true),
|
|
1154
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
|
|
1155
|
+
createElementVNode("div", mergeProps(unref(attrs), {
|
|
1156
|
+
id: unref(hasId),
|
|
1157
|
+
ref_key: "listEl",
|
|
1158
|
+
ref: listEl,
|
|
1159
|
+
tabindex: !unref(expanded) ? -1 : void 0,
|
|
1160
|
+
role: unref(role),
|
|
1161
|
+
"aria-labelledby": unref(hasAriaLabelledby),
|
|
1162
|
+
class: "vv-dropdown__list"
|
|
1163
|
+
}), [
|
|
1164
|
+
renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
|
|
1165
|
+
role: unref(itemRole)
|
|
1166
|
+
})))
|
|
1167
|
+
], 16, _hoisted_1$2),
|
|
1168
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
|
|
1169
|
+
],
|
|
1170
|
+
6
|
|
1171
|
+
/* CLASS, STYLE */
|
|
1172
|
+
), [
|
|
1173
|
+
[vShow, unref(expanded)]
|
|
1174
|
+
])
|
|
1175
|
+
]),
|
|
1176
|
+
_: 3
|
|
1177
|
+
/* FORWARDED */
|
|
1178
|
+
}, 16, ["name"])
|
|
1179
|
+
],
|
|
1180
|
+
64
|
|
1181
|
+
/* STABLE_FRAGMENT */
|
|
1182
|
+
);
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
function useInjectedDropdownItem() {
|
|
1187
|
+
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
1188
|
+
}
|
|
1189
|
+
const __default__$3 = {
|
|
1190
|
+
name: "VvDropdownItem"
|
|
1191
|
+
};
|
|
1192
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1193
|
+
...__default__$3,
|
|
1194
|
+
props: VvDropdownItemProps,
|
|
1195
|
+
setup(__props) {
|
|
1196
|
+
const props = __props;
|
|
1197
|
+
const { role, expanded } = useInjectedDropdownItem();
|
|
1198
|
+
const element = ref(null);
|
|
1199
|
+
useDropdownProvideAction({ expanded });
|
|
1200
|
+
const hovered = useElementHover(element);
|
|
1201
|
+
const { focused } = useFocus(element);
|
|
1202
|
+
const { focused: focusedWithin } = useFocusWithin(element);
|
|
1203
|
+
watch(hovered, (newValue) => {
|
|
1204
|
+
if (newValue && props.focusOnHover) {
|
|
1205
|
+
focused.value = true;
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
return (_ctx, _cache) => {
|
|
1209
|
+
return openBlock(), createElementBlock(
|
|
1210
|
+
"div",
|
|
1211
|
+
mergeProps({ role: unref(role) }, {
|
|
1212
|
+
ref_key: "element",
|
|
1213
|
+
ref: element,
|
|
1214
|
+
class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
|
|
1215
|
+
}),
|
|
1216
|
+
[
|
|
1217
|
+
renderSlot(_ctx.$slots, "default")
|
|
1218
|
+
],
|
|
1219
|
+
16
|
|
1220
|
+
/* FULL_PROPS */
|
|
1221
|
+
);
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
const _hoisted_1$1 = ["title"];
|
|
1226
|
+
const __default__$2 = {
|
|
1227
|
+
name: "VvDropdownOption"
|
|
1228
|
+
};
|
|
1229
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1230
|
+
...__default__$2,
|
|
1231
|
+
props: VvDropdownOptionProps,
|
|
1232
|
+
setup(__props) {
|
|
1233
|
+
const props = __props;
|
|
1234
|
+
const { modifiers } = toRefs(props);
|
|
1235
|
+
const bemCssClasses = useModifiers(
|
|
1236
|
+
"vv-dropdown-option",
|
|
1237
|
+
modifiers,
|
|
1238
|
+
computed(() => ({
|
|
1239
|
+
disabled: props.disabled,
|
|
1240
|
+
selected: props.selected,
|
|
1241
|
+
unselectable: props.unselectable && props.selected
|
|
1242
|
+
}))
|
|
1243
|
+
);
|
|
1244
|
+
const hintLabel = computed(() => {
|
|
1245
|
+
if (props.selected) {
|
|
1246
|
+
return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
|
|
1247
|
+
}
|
|
1248
|
+
if (!props.disabled) {
|
|
1249
|
+
return props.selectHintLabel;
|
|
1250
|
+
}
|
|
1251
|
+
return "";
|
|
1252
|
+
});
|
|
1253
|
+
return (_ctx, _cache) => {
|
|
1254
|
+
return openBlock(), createBlock(_sfc_main$3, {
|
|
1255
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
1256
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
1257
|
+
"aria-selected": _ctx.selected,
|
|
1258
|
+
"aria-disabled": _ctx.disabled,
|
|
1259
|
+
"focus-on-hover": _ctx.focusOnHover
|
|
1260
|
+
}, {
|
|
1261
|
+
default: withCtx(() => [
|
|
1262
|
+
renderSlot(_ctx.$slots, "default"),
|
|
1263
|
+
createElementVNode("span", {
|
|
1264
|
+
class: "vv-dropdown-option__hint",
|
|
1265
|
+
title: unref(hintLabel)
|
|
1266
|
+
}, [
|
|
1267
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
|
|
1268
|
+
createTextVNode(
|
|
1269
|
+
toDisplayString(unref(hintLabel)),
|
|
1270
|
+
1
|
|
1271
|
+
/* TEXT */
|
|
1272
|
+
)
|
|
1273
|
+
])
|
|
1274
|
+
], 8, _hoisted_1$1)
|
|
1275
|
+
]),
|
|
1276
|
+
_: 3
|
|
1277
|
+
/* FORWARDED */
|
|
1278
|
+
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
const ACTION_ICONS = {
|
|
1283
|
+
showPassword: "eye-on",
|
|
1284
|
+
hidePassword: "eye-off",
|
|
1285
|
+
showDatePicker: "calendar",
|
|
1286
|
+
showTimePicker: "time",
|
|
1287
|
+
showColorPicker: "color",
|
|
1288
|
+
clear: "close",
|
|
1289
|
+
add: "add",
|
|
1290
|
+
remove: "trash",
|
|
1291
|
+
edit: "edit",
|
|
1292
|
+
download: "download"
|
|
1293
|
+
};
|
|
1294
|
+
const VvIconPropsDefaults = {
|
|
1295
|
+
prefix: "normal"
|
|
1296
|
+
/* normal */
|
|
1297
|
+
};
|
|
1298
|
+
function useVolver() {
|
|
1299
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
1300
|
+
}
|
|
1301
|
+
const __default__$1 = {
|
|
1302
|
+
name: "VvIcon"
|
|
1303
|
+
};
|
|
1304
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1305
|
+
...__default__$1,
|
|
1306
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
1307
|
+
name: {},
|
|
1308
|
+
color: {},
|
|
1309
|
+
width: {},
|
|
1310
|
+
height: {},
|
|
1311
|
+
provider: {},
|
|
1312
|
+
prefix: {},
|
|
1313
|
+
src: {},
|
|
1314
|
+
horizontalFlip: { type: Boolean },
|
|
1315
|
+
verticalFlip: { type: Boolean },
|
|
1316
|
+
flip: {},
|
|
1317
|
+
mode: {},
|
|
1318
|
+
inline: { type: Boolean },
|
|
1319
|
+
rotate: {},
|
|
1320
|
+
onLoad: { type: Function },
|
|
1321
|
+
svg: {},
|
|
1322
|
+
modifiers: {}
|
|
1323
|
+
}, VvIconPropsDefaults),
|
|
1324
|
+
setup(__props) {
|
|
1325
|
+
const props = __props;
|
|
1326
|
+
const hasRotate = computed(() => {
|
|
1327
|
+
if (typeof props.rotate === "string") {
|
|
1328
|
+
return Number.parseFloat(props.rotate);
|
|
1329
|
+
}
|
|
1330
|
+
return props.rotate;
|
|
1331
|
+
});
|
|
1332
|
+
const show = ref(true);
|
|
1333
|
+
const volver = useVolver();
|
|
1334
|
+
const { modifiers } = toRefs(props);
|
|
1335
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
1336
|
+
const provider = computed(() => {
|
|
1337
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
1338
|
+
});
|
|
1339
|
+
const icon = computed(() => {
|
|
1340
|
+
const name = props.name ?? "";
|
|
1341
|
+
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
1342
|
+
if (iconExists(iconName)) {
|
|
1343
|
+
return iconName;
|
|
1344
|
+
}
|
|
1345
|
+
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
1346
|
+
(iconsCollection2) => {
|
|
1347
|
+
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
1348
|
+
return iconExists(icon2);
|
|
1349
|
+
}
|
|
1350
|
+
);
|
|
1351
|
+
if (iconsCollection) {
|
|
1352
|
+
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
1353
|
+
}
|
|
1354
|
+
return name;
|
|
1355
|
+
});
|
|
1356
|
+
function getSvgContent(svg) {
|
|
1357
|
+
let dom;
|
|
1358
|
+
if (typeof window === "undefined") {
|
|
1359
|
+
const { JSDOM } = require("jsdom");
|
|
1360
|
+
dom = new JSDOM().window;
|
|
1361
|
+
}
|
|
1362
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
1363
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
1364
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
1365
|
+
return svgEl;
|
|
1366
|
+
}
|
|
1367
|
+
function addIconFromSvg(svg) {
|
|
1368
|
+
const svgContentEl = getSvgContent(svg);
|
|
1369
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
1370
|
+
if (svgContentEl && svgContent) {
|
|
1371
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
1372
|
+
body: svgContent,
|
|
1373
|
+
// Set height and width from svg content
|
|
1374
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
1375
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
if (volver) {
|
|
1380
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
1381
|
+
show.value = false;
|
|
1382
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
1383
|
+
if (svg) {
|
|
1384
|
+
addIconFromSvg(svg);
|
|
1385
|
+
show.value = true;
|
|
1386
|
+
}
|
|
1387
|
+
}).catch((e) => {
|
|
1388
|
+
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
if (props.svg) {
|
|
1393
|
+
addIconFromSvg(props.svg);
|
|
1394
|
+
}
|
|
1395
|
+
return (_ctx, _cache) => {
|
|
1396
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
1397
|
+
key: 0,
|
|
1398
|
+
class: unref(bemCssClasses)
|
|
1399
|
+
}, {
|
|
1400
|
+
inline: _ctx.inline,
|
|
1401
|
+
width: _ctx.width,
|
|
1402
|
+
height: _ctx.height,
|
|
1403
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
1404
|
+
verticalFlip: _ctx.verticalFlip,
|
|
1405
|
+
flip: _ctx.flip,
|
|
1406
|
+
rotate: unref(hasRotate),
|
|
1407
|
+
color: _ctx.color,
|
|
1408
|
+
onLoad: _ctx.onLoad,
|
|
1409
|
+
icon: unref(icon)
|
|
1410
|
+
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
const INPUT_TYPES = {
|
|
1415
|
+
TEXT: "text",
|
|
1416
|
+
PASSWORD: "password",
|
|
1417
|
+
NUMBER: "number",
|
|
1418
|
+
EMAIL: "email",
|
|
1419
|
+
TEL: "tel",
|
|
1420
|
+
URL: "url",
|
|
1421
|
+
COLOR: "color",
|
|
1422
|
+
SEARCH: "search",
|
|
1423
|
+
DATE: "date",
|
|
1424
|
+
TIME: "time",
|
|
1425
|
+
DATETIME_LOCAL: "datetime-local",
|
|
1426
|
+
MONTH: "month",
|
|
1427
|
+
WEEK: "week"
|
|
1428
|
+
};
|
|
1429
|
+
const VvInputTextEvents = [
|
|
1430
|
+
"update:modelValue",
|
|
1431
|
+
"update:masked",
|
|
1432
|
+
"accept",
|
|
1433
|
+
"accept:typed",
|
|
1434
|
+
"accept:masked",
|
|
1435
|
+
"accept:unmasked",
|
|
758
1436
|
"complete",
|
|
759
1437
|
"complete:typed",
|
|
760
1438
|
"complete:masked",
|
|
@@ -767,6 +1445,7 @@ const VvInputTextEvents = [
|
|
|
767
1445
|
];
|
|
768
1446
|
const VvInputTextProps = {
|
|
769
1447
|
...InputTextareaProps,
|
|
1448
|
+
...StorageProps,
|
|
770
1449
|
/**
|
|
771
1450
|
* Input value
|
|
772
1451
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
@@ -816,24 +1495,32 @@ const VvInputTextProps = {
|
|
|
816
1495
|
* @see VVIcon
|
|
817
1496
|
*/
|
|
818
1497
|
iconShowPassword: {
|
|
819
|
-
type: String,
|
|
820
|
-
default:
|
|
1498
|
+
type: [String, Object],
|
|
1499
|
+
default: ACTION_ICONS.showPassword
|
|
821
1500
|
},
|
|
822
1501
|
/**
|
|
823
1502
|
* VvIcon name for hide password button
|
|
824
1503
|
* @see VVIcon
|
|
825
1504
|
*/
|
|
826
1505
|
iconHidePassword: {
|
|
827
|
-
type: String,
|
|
828
|
-
default:
|
|
1506
|
+
type: [String, Object],
|
|
1507
|
+
default: ACTION_ICONS.hidePassword
|
|
829
1508
|
},
|
|
830
1509
|
/**
|
|
831
1510
|
* VvIcon name for clear button
|
|
832
1511
|
* @see VVIcon
|
|
833
1512
|
*/
|
|
834
1513
|
iconClear: {
|
|
835
|
-
type: String,
|
|
836
|
-
default:
|
|
1514
|
+
type: [String, Object],
|
|
1515
|
+
default: ACTION_ICONS.clear
|
|
1516
|
+
},
|
|
1517
|
+
/**
|
|
1518
|
+
* VvIcon name for remove suggestion button
|
|
1519
|
+
* @see VVIcon
|
|
1520
|
+
*/
|
|
1521
|
+
iconRemoveSuggestion: {
|
|
1522
|
+
type: [String, Object],
|
|
1523
|
+
default: ACTION_ICONS.remove
|
|
837
1524
|
},
|
|
838
1525
|
/**
|
|
839
1526
|
* Label for step up button
|
|
@@ -870,6 +1557,13 @@ const VvInputTextProps = {
|
|
|
870
1557
|
type: String,
|
|
871
1558
|
default: "Clear"
|
|
872
1559
|
},
|
|
1560
|
+
/**
|
|
1561
|
+
* Label for remove suggestion button
|
|
1562
|
+
*/
|
|
1563
|
+
labelRemoveSuggestion: {
|
|
1564
|
+
type: String,
|
|
1565
|
+
default: "Remove suggestion"
|
|
1566
|
+
},
|
|
873
1567
|
/**
|
|
874
1568
|
* iMask options
|
|
875
1569
|
* @see https://imask.js.org/guide.html
|
|
@@ -911,8 +1605,100 @@ const VvInputTextProps = {
|
|
|
911
1605
|
selectOnFocus: {
|
|
912
1606
|
type: Boolean,
|
|
913
1607
|
default: false
|
|
1608
|
+
},
|
|
1609
|
+
/**
|
|
1610
|
+
* Maximum number of suggestions
|
|
1611
|
+
*/
|
|
1612
|
+
maxSuggestions: {
|
|
1613
|
+
type: Number,
|
|
1614
|
+
default: 5
|
|
914
1615
|
}
|
|
915
1616
|
};
|
|
1617
|
+
function useComponentIcon(icon, iconPosition) {
|
|
1618
|
+
const hasIcon = computed(() => {
|
|
1619
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
1620
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
1621
|
+
}
|
|
1622
|
+
return icon == null ? void 0 : icon.value;
|
|
1623
|
+
});
|
|
1624
|
+
const hasIconBefore = computed(
|
|
1625
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
1626
|
+
);
|
|
1627
|
+
const hasIconAfter = computed(
|
|
1628
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
1629
|
+
);
|
|
1630
|
+
const hasIconLeft = computed(
|
|
1631
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
1632
|
+
);
|
|
1633
|
+
const hasIconRight = computed(
|
|
1634
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
1635
|
+
);
|
|
1636
|
+
const hasIconTop = computed(
|
|
1637
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
1638
|
+
);
|
|
1639
|
+
const hasIconBottom = computed(
|
|
1640
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
1641
|
+
);
|
|
1642
|
+
return {
|
|
1643
|
+
hasIcon,
|
|
1644
|
+
hasIconLeft,
|
|
1645
|
+
hasIconRight,
|
|
1646
|
+
hasIconTop,
|
|
1647
|
+
hasIconBottom,
|
|
1648
|
+
hasIconBefore,
|
|
1649
|
+
hasIconAfter
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
const VvInputClearAction = defineComponent({
|
|
1653
|
+
components: {
|
|
1654
|
+
VvIcon: _sfc_main$1
|
|
1655
|
+
},
|
|
1656
|
+
props: {
|
|
1657
|
+
disabled: {
|
|
1658
|
+
type: Boolean,
|
|
1659
|
+
default: false
|
|
1660
|
+
},
|
|
1661
|
+
label: {
|
|
1662
|
+
type: String,
|
|
1663
|
+
default: "Clear"
|
|
1664
|
+
},
|
|
1665
|
+
icon: {
|
|
1666
|
+
type: [String, Object],
|
|
1667
|
+
default: "close"
|
|
1668
|
+
}
|
|
1669
|
+
},
|
|
1670
|
+
emits: ["clear"],
|
|
1671
|
+
setup(props, { emit }) {
|
|
1672
|
+
const { hasIcon } = useComponentIcon(computed(() => props.icon));
|
|
1673
|
+
function onClick(e) {
|
|
1674
|
+
e == null ? void 0 : e.stopPropagation();
|
|
1675
|
+
if (!props.disabled) {
|
|
1676
|
+
emit("clear");
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
return {
|
|
1680
|
+
hasIcon,
|
|
1681
|
+
onClick
|
|
1682
|
+
};
|
|
1683
|
+
},
|
|
1684
|
+
render() {
|
|
1685
|
+
const icon = this.hasIcon ? h(_sfc_main$1, {
|
|
1686
|
+
...this.hasIcon,
|
|
1687
|
+
class: "vv-input-text__icon"
|
|
1688
|
+
}) : void 0;
|
|
1689
|
+
return h(
|
|
1690
|
+
"button",
|
|
1691
|
+
{
|
|
1692
|
+
disabled: this.disabled,
|
|
1693
|
+
class: "vv-input-text__action",
|
|
1694
|
+
ariaLabel: this.label,
|
|
1695
|
+
type: "button",
|
|
1696
|
+
onClick: this.onClick
|
|
1697
|
+
},
|
|
1698
|
+
icon
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
916
1702
|
const VvInputPasswordAction = defineComponent({
|
|
917
1703
|
components: {
|
|
918
1704
|
VvIcon: _sfc_main$1
|
|
@@ -931,12 +1717,12 @@ const VvInputPasswordAction = defineComponent({
|
|
|
931
1717
|
default: "Hide password"
|
|
932
1718
|
},
|
|
933
1719
|
iconShow: {
|
|
934
|
-
type: String,
|
|
935
|
-
default:
|
|
1720
|
+
type: [String, Object],
|
|
1721
|
+
default: ACTION_ICONS.showPassword
|
|
936
1722
|
},
|
|
937
1723
|
iconHide: {
|
|
938
|
-
type: String,
|
|
939
|
-
default:
|
|
1724
|
+
type: [String, Object],
|
|
1725
|
+
default: ACTION_ICONS.hidePassword
|
|
940
1726
|
}
|
|
941
1727
|
},
|
|
942
1728
|
emits: ["toggle-password"],
|
|
@@ -945,6 +1731,7 @@ const VvInputPasswordAction = defineComponent({
|
|
|
945
1731
|
const activeIcon = computed(
|
|
946
1732
|
() => active.value ? props.iconHide : props.iconShow
|
|
947
1733
|
);
|
|
1734
|
+
const { hasIcon } = useComponentIcon(activeIcon);
|
|
948
1735
|
function onClick(e) {
|
|
949
1736
|
e == null ? void 0 : e.stopPropagation();
|
|
950
1737
|
if (!props.disabled) {
|
|
@@ -955,14 +1742,15 @@ const VvInputPasswordAction = defineComponent({
|
|
|
955
1742
|
return {
|
|
956
1743
|
active,
|
|
957
1744
|
activeIcon,
|
|
1745
|
+
hasIcon,
|
|
958
1746
|
onClick
|
|
959
1747
|
};
|
|
960
1748
|
},
|
|
961
1749
|
render() {
|
|
962
|
-
const icon = h(_sfc_main$1, {
|
|
963
|
-
|
|
1750
|
+
const icon = this.hasIcon ? h(_sfc_main$1, {
|
|
1751
|
+
...this.hasIcon,
|
|
964
1752
|
class: "vv-input-text__icon"
|
|
965
|
-
});
|
|
1753
|
+
}) : void 0;
|
|
966
1754
|
return h(
|
|
967
1755
|
"button",
|
|
968
1756
|
{
|
|
@@ -1021,54 +1809,6 @@ const VvInputStepAction = defineComponent({
|
|
|
1021
1809
|
});
|
|
1022
1810
|
}
|
|
1023
1811
|
});
|
|
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
1812
|
function VvInputTextActionsFactory(type, parentProps) {
|
|
1073
1813
|
return {
|
|
1074
1814
|
name: "VvInputTextActions",
|
|
@@ -1199,14 +1939,13 @@ function useDefaults(componentName, propsDefinition, props) {
|
|
|
1199
1939
|
}, {});
|
|
1200
1940
|
});
|
|
1201
1941
|
}
|
|
1202
|
-
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
|
|
1203
1942
|
function useDebouncedInput(modelValue, emit, ms = 0, {
|
|
1204
1943
|
getter = (value) => value,
|
|
1205
1944
|
setter = (value) => value
|
|
1206
1945
|
} = {}) {
|
|
1207
1946
|
let timeout;
|
|
1208
1947
|
if (typeof ms === "string") {
|
|
1209
|
-
ms = parseInt(ms);
|
|
1948
|
+
ms = Number.parseInt(ms);
|
|
1210
1949
|
}
|
|
1211
1950
|
return computed({
|
|
1212
1951
|
get: () => getter(modelValue == null ? void 0 : modelValue.value),
|
|
@@ -1229,41 +1968,6 @@ function useComponentFocus(inputTemplateRef, emit) {
|
|
|
1229
1968
|
focused
|
|
1230
1969
|
};
|
|
1231
1970
|
}
|
|
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
1971
|
function useTextCount(text, options) {
|
|
1268
1972
|
const length = computed(() => {
|
|
1269
1973
|
return (unref(text) ?? "").length;
|
|
@@ -1298,26 +2002,86 @@ function useTextCount(text, options) {
|
|
|
1298
2002
|
formatted
|
|
1299
2003
|
};
|
|
1300
2004
|
}
|
|
2005
|
+
function usePersistence(storageKey, storageType = StorageType.local, defaultValue) {
|
|
2006
|
+
const localValue = ref();
|
|
2007
|
+
if (defaultValue) {
|
|
2008
|
+
localValue.value = defaultValue;
|
|
2009
|
+
}
|
|
2010
|
+
let storageValue;
|
|
2011
|
+
if (storageKey) {
|
|
2012
|
+
watch(
|
|
2013
|
+
storageKey,
|
|
2014
|
+
(newKey, oldKey) => {
|
|
2015
|
+
const storage = unref(storageType) === StorageType.session ? sessionStorage : localStorage;
|
|
2016
|
+
if (oldKey && oldKey !== newKey) {
|
|
2017
|
+
storage.removeItem(oldKey);
|
|
2018
|
+
}
|
|
2019
|
+
if (newKey) {
|
|
2020
|
+
storageValue = useStorage(
|
|
2021
|
+
newKey,
|
|
2022
|
+
(storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
|
|
2023
|
+
storage
|
|
2024
|
+
);
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
storageValue = void 0;
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
immediate: true
|
|
2031
|
+
}
|
|
2032
|
+
);
|
|
2033
|
+
}
|
|
2034
|
+
if (isRef(storageType)) {
|
|
2035
|
+
watch(storageType, (newType, oldType) => {
|
|
2036
|
+
if (storageKey == null ? void 0 : storageKey.value) {
|
|
2037
|
+
if (newType) {
|
|
2038
|
+
const storage = newType === StorageType.session ? sessionStorage : localStorage;
|
|
2039
|
+
storageValue = useStorage(
|
|
2040
|
+
storageKey.value,
|
|
2041
|
+
(storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
|
|
2042
|
+
storage
|
|
2043
|
+
);
|
|
2044
|
+
}
|
|
2045
|
+
if (oldType && oldType !== newType) {
|
|
2046
|
+
const oldStorage = oldType === StorageType.session ? sessionStorage : localStorage;
|
|
2047
|
+
oldStorage.removeItem(storageKey.value);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
return computed({
|
|
2053
|
+
get: () => {
|
|
2054
|
+
return (storageValue == null ? void 0 : storageValue.value) ?? localValue.value;
|
|
2055
|
+
},
|
|
2056
|
+
set: (value) => {
|
|
2057
|
+
if (storageValue) {
|
|
2058
|
+
storageValue.value = value;
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
localValue.value = value;
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
1301
2065
|
const _hoisted_1 = ["for"];
|
|
1302
|
-
const _hoisted_2 = {
|
|
1303
|
-
const _hoisted_3 = {
|
|
2066
|
+
const _hoisted_2 = {
|
|
1304
2067
|
key: 0,
|
|
1305
2068
|
class: "vv-input-text__input-before"
|
|
1306
2069
|
};
|
|
1307
|
-
const
|
|
1308
|
-
const
|
|
1309
|
-
const _hoisted_6 = {
|
|
2070
|
+
const _hoisted_3 = ["id"];
|
|
2071
|
+
const _hoisted_4 = {
|
|
1310
2072
|
key: 1,
|
|
1311
2073
|
class: "vv-input-text__unit"
|
|
1312
2074
|
};
|
|
1313
|
-
const
|
|
2075
|
+
const _hoisted_5 = {
|
|
1314
2076
|
key: 5,
|
|
1315
2077
|
class: "vv-input-text__input-after"
|
|
1316
2078
|
};
|
|
1317
|
-
const
|
|
2079
|
+
const _hoisted_6 = {
|
|
1318
2080
|
key: 6,
|
|
1319
2081
|
class: "vv-input-text__limit"
|
|
1320
2082
|
};
|
|
2083
|
+
const _hoisted_7 = { class: "flex-1" };
|
|
2084
|
+
const _hoisted_8 = ["title", "onClick"];
|
|
1321
2085
|
const __default__ = {
|
|
1322
2086
|
name: "VvInputText"
|
|
1323
2087
|
};
|
|
@@ -1325,8 +2089,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1325
2089
|
...__default__,
|
|
1326
2090
|
props: VvInputTextProps,
|
|
1327
2091
|
emits: VvInputTextEvents,
|
|
1328
|
-
setup(__props, { expose: __expose, emit }) {
|
|
2092
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1329
2093
|
const props = __props;
|
|
2094
|
+
const emit = __emit;
|
|
1330
2095
|
const slots = useSlots();
|
|
1331
2096
|
const propsDefaults = useDefaults(
|
|
1332
2097
|
"VvInputText",
|
|
@@ -1334,32 +2099,55 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1334
2099
|
props
|
|
1335
2100
|
);
|
|
1336
2101
|
const {
|
|
1337
|
-
|
|
2102
|
+
count,
|
|
2103
|
+
debounce,
|
|
1338
2104
|
icon,
|
|
1339
2105
|
iconPosition,
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
count,
|
|
1343
|
-
valid,
|
|
2106
|
+
iconRemoveSuggestion,
|
|
2107
|
+
id,
|
|
1344
2108
|
invalid,
|
|
2109
|
+
label,
|
|
1345
2110
|
loading,
|
|
1346
|
-
debounce,
|
|
1347
2111
|
maxlength,
|
|
1348
2112
|
minlength,
|
|
2113
|
+
modelValue,
|
|
2114
|
+
step,
|
|
2115
|
+
storageKey,
|
|
2116
|
+
storageType,
|
|
1349
2117
|
type,
|
|
1350
|
-
|
|
1351
|
-
step
|
|
2118
|
+
valid
|
|
1352
2119
|
} = toRefs(props);
|
|
1353
2120
|
const hasId = useUniqueId(id);
|
|
1354
2121
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
1355
2122
|
const inputTextPlaceholder = computed(
|
|
1356
2123
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
1357
2124
|
);
|
|
2125
|
+
const localModelValue = useDebouncedInput(
|
|
2126
|
+
modelValue,
|
|
2127
|
+
emit,
|
|
2128
|
+
(debounce == null ? void 0 : debounce.value) ?? 0
|
|
2129
|
+
);
|
|
2130
|
+
const NEGATIVE_ZERO_REGEX = /^-0?[.,]?[0*]?$/;
|
|
1358
2131
|
const maskReady = ref(false);
|
|
1359
2132
|
const { el, mask, typed, masked, unmasked } = useIMask(
|
|
1360
2133
|
computed(
|
|
1361
|
-
() =>
|
|
1362
|
-
|
|
2134
|
+
() => {
|
|
2135
|
+
if (!props.iMask) {
|
|
2136
|
+
return {
|
|
2137
|
+
mask: /./
|
|
2138
|
+
};
|
|
2139
|
+
}
|
|
2140
|
+
if (props.iMask.mask === Number) {
|
|
2141
|
+
const toReturn = { ...props.iMask };
|
|
2142
|
+
if (props.min) {
|
|
2143
|
+
toReturn.min = Number(props.min);
|
|
2144
|
+
}
|
|
2145
|
+
if (props.max) {
|
|
2146
|
+
toReturn.max = Number(props.max);
|
|
2147
|
+
}
|
|
2148
|
+
return toReturn;
|
|
2149
|
+
}
|
|
2150
|
+
return props.iMask;
|
|
1363
2151
|
}
|
|
1364
2152
|
),
|
|
1365
2153
|
{
|
|
@@ -1370,13 +2158,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1370
2158
|
}
|
|
1371
2159
|
emit("update:masked", masked.value);
|
|
1372
2160
|
if (type.value === INPUT_TYPES.NUMBER) {
|
|
1373
|
-
if (
|
|
2161
|
+
if (/^-$|^$/.test(unmasked.value)) {
|
|
1374
2162
|
if (localModelValue.value === null || localModelValue.value === void 0) {
|
|
1375
2163
|
return;
|
|
1376
2164
|
}
|
|
1377
2165
|
localModelValue.value = void 0;
|
|
1378
2166
|
return;
|
|
1379
2167
|
}
|
|
2168
|
+
if (NEGATIVE_ZERO_REGEX.test(unmasked.value)) {
|
|
2169
|
+
localModelValue.value = 0;
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
1380
2172
|
if (typeof typed.value !== "number") {
|
|
1381
2173
|
localModelValue.value = Number(typed.value);
|
|
1382
2174
|
return;
|
|
@@ -1400,7 +2192,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1400
2192
|
if (!(date instanceof Date)) {
|
|
1401
2193
|
date = new Date(date);
|
|
1402
2194
|
}
|
|
1403
|
-
localModelValue.value = `${date.getFullYear()}-${
|
|
2195
|
+
localModelValue.value = `${date.getFullYear()}-${`0${date.getMonth() + 1}`.slice(-2)}-${`0${date.getDate()}`.slice(-2)}`;
|
|
1404
2196
|
return;
|
|
1405
2197
|
}
|
|
1406
2198
|
if (type.value === INPUT_TYPES.DATETIME_LOCAL) {
|
|
@@ -1419,7 +2211,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1419
2211
|
if (!(typed.value instanceof Date)) {
|
|
1420
2212
|
date = new Date(date);
|
|
1421
2213
|
}
|
|
1422
|
-
localModelValue.value = `${date.getFullYear()}-${
|
|
2214
|
+
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
2215
|
return;
|
|
1424
2216
|
}
|
|
1425
2217
|
if (!localModelValue.value && !unmasked.value) {
|
|
@@ -1429,18 +2221,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1429
2221
|
}
|
|
1430
2222
|
}
|
|
1431
2223
|
);
|
|
2224
|
+
function updateMaskValue(newValue) {
|
|
2225
|
+
var _a;
|
|
2226
|
+
if (newValue === void 0) {
|
|
2227
|
+
typed.value = "";
|
|
2228
|
+
unmasked.value = "";
|
|
2229
|
+
return;
|
|
2230
|
+
}
|
|
2231
|
+
if (((_a = props.iMask) == null ? void 0 : _a.mask) === Date) {
|
|
2232
|
+
typed.value = new Date(newValue);
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
if (type.value === INPUT_TYPES.NUMBER && NEGATIVE_ZERO_REGEX.test(unmasked.value) && newValue === 0) {
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
typed.value = newValue;
|
|
2239
|
+
unmasked.value = `${typed.value}`;
|
|
2240
|
+
}
|
|
1432
2241
|
onMounted(() => {
|
|
1433
2242
|
if (mask.value) {
|
|
1434
2243
|
maskReady.value = true;
|
|
1435
|
-
|
|
2244
|
+
updateMaskValue(props.modelValue);
|
|
1436
2245
|
}
|
|
1437
2246
|
});
|
|
1438
2247
|
watch(
|
|
1439
2248
|
() => props.modelValue,
|
|
1440
2249
|
(newValue) => {
|
|
1441
|
-
var _a;
|
|
1442
2250
|
if (mask.value) {
|
|
1443
|
-
|
|
2251
|
+
updateMaskValue(newValue);
|
|
1444
2252
|
}
|
|
1445
2253
|
}
|
|
1446
2254
|
);
|
|
@@ -1452,20 +2260,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1452
2260
|
);
|
|
1453
2261
|
const inputEl = el;
|
|
1454
2262
|
const innerEl = ref();
|
|
2263
|
+
const wrapperEl = ref();
|
|
2264
|
+
const dropdownEl = ref();
|
|
1455
2265
|
__expose({ $inner: innerEl });
|
|
1456
|
-
const localModelValue = useDebouncedInput(
|
|
1457
|
-
modelValue,
|
|
1458
|
-
emit,
|
|
1459
|
-
(debounce == null ? void 0 : debounce.value) ?? 0
|
|
1460
|
-
);
|
|
1461
2266
|
const { focused } = useComponentFocus(inputEl, emit);
|
|
1462
2267
|
const isFocused = computed(
|
|
1463
2268
|
() => focused.value && !props.disabled && !props.readonly
|
|
1464
2269
|
);
|
|
1465
2270
|
watch(isFocused, (newValue) => {
|
|
2271
|
+
var _a;
|
|
1466
2272
|
if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
|
|
1467
2273
|
inputEl.value.select();
|
|
1468
2274
|
}
|
|
2275
|
+
if (newValue) {
|
|
2276
|
+
(_a = dropdownEl.value) == null ? void 0 : _a.show();
|
|
2277
|
+
return;
|
|
2278
|
+
}
|
|
2279
|
+
setTimeout(() => {
|
|
2280
|
+
if (isDirty.value && suggestions.value) {
|
|
2281
|
+
const suggestionsLimit = props.maxSuggestions - 1;
|
|
2282
|
+
if (suggestions.value.size > suggestionsLimit && !suggestions.value.has(localModelValue.value)) {
|
|
2283
|
+
suggestions.value = new Set(
|
|
2284
|
+
[...suggestions.value].slice(
|
|
2285
|
+
suggestions.value.size - suggestionsLimit
|
|
2286
|
+
)
|
|
2287
|
+
);
|
|
2288
|
+
}
|
|
2289
|
+
suggestions.value.add(localModelValue.value);
|
|
2290
|
+
}
|
|
2291
|
+
}, 300);
|
|
1469
2292
|
});
|
|
1470
2293
|
const isVisible = useElementVisibility(inputEl);
|
|
1471
2294
|
watch(isVisible, (newValue) => {
|
|
@@ -1475,56 +2298,56 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1475
2298
|
});
|
|
1476
2299
|
const showPassword = ref(false);
|
|
1477
2300
|
const isPassword = computed(() => props.type === INPUT_TYPES.PASSWORD);
|
|
1478
|
-
|
|
2301
|
+
function onTogglePassword() {
|
|
1479
2302
|
showPassword.value = !showPassword.value;
|
|
1480
|
-
}
|
|
2303
|
+
}
|
|
1481
2304
|
const isDateTime = computed(
|
|
1482
2305
|
() => 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
2306
|
);
|
|
1484
2307
|
const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
|
|
1485
|
-
|
|
2308
|
+
function onStepUp() {
|
|
1486
2309
|
if (isClickable.value) {
|
|
1487
|
-
if (iMask
|
|
1488
|
-
typed.value = typed.value + Number((step == null ? void 0 : step.value) ?? 1);
|
|
2310
|
+
if (props.iMask) {
|
|
2311
|
+
typed.value = Number(typed.value) + Number((step == null ? void 0 : step.value) ?? 1);
|
|
1489
2312
|
return;
|
|
1490
2313
|
}
|
|
1491
2314
|
inputEl.value.stepUp();
|
|
1492
|
-
localModelValue.value = unref(inputEl).value;
|
|
2315
|
+
localModelValue.value = Number(unref(inputEl).value);
|
|
1493
2316
|
}
|
|
1494
|
-
}
|
|
1495
|
-
|
|
2317
|
+
}
|
|
2318
|
+
function onStepDown() {
|
|
1496
2319
|
if (isClickable.value) {
|
|
1497
|
-
if (iMask
|
|
1498
|
-
typed.value = typed.value - Number((step == null ? void 0 : step.value) ?? 1);
|
|
2320
|
+
if (props.iMask) {
|
|
2321
|
+
typed.value = Number(typed.value) - Number((step == null ? void 0 : step.value) ?? 1);
|
|
1499
2322
|
return;
|
|
1500
2323
|
}
|
|
1501
2324
|
inputEl.value.stepDown();
|
|
1502
|
-
localModelValue.value = unref(inputEl).value;
|
|
2325
|
+
localModelValue.value = Number(unref(inputEl).value);
|
|
1503
2326
|
}
|
|
1504
|
-
}
|
|
2327
|
+
}
|
|
1505
2328
|
const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
|
|
1506
|
-
|
|
2329
|
+
function onClear() {
|
|
1507
2330
|
localModelValue.value = "";
|
|
1508
|
-
}
|
|
1509
|
-
const {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
2331
|
+
}
|
|
2332
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
|
|
2333
|
+
const iconAfter = computed(() => {
|
|
2334
|
+
if (hasIconAfter.value !== void 0) {
|
|
2335
|
+
return hasIconAfter.value;
|
|
2336
|
+
}
|
|
1514
2337
|
switch (props.type) {
|
|
1515
2338
|
case INPUT_TYPES.COLOR:
|
|
1516
|
-
return { name:
|
|
2339
|
+
return { name: ACTION_ICONS.showColorPicker };
|
|
1517
2340
|
case INPUT_TYPES.DATE:
|
|
1518
2341
|
case INPUT_TYPES.DATETIME_LOCAL:
|
|
1519
2342
|
case INPUT_TYPES.WEEK:
|
|
1520
2343
|
case INPUT_TYPES.MONTH:
|
|
1521
|
-
return { name:
|
|
2344
|
+
return { name: ACTION_ICONS.showDatePicker };
|
|
1522
2345
|
case INPUT_TYPES.TIME:
|
|
1523
|
-
return { name:
|
|
1524
|
-
default:
|
|
1525
|
-
return "";
|
|
2346
|
+
return { name: ACTION_ICONS.showTimePicker };
|
|
1526
2347
|
}
|
|
2348
|
+
return void 0;
|
|
1527
2349
|
});
|
|
2350
|
+
const { hasIcon: hasIconRemoveSuggestion } = useComponentIcon(iconRemoveSuggestion);
|
|
1528
2351
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
1529
2352
|
mode: count.value,
|
|
1530
2353
|
upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
|
|
@@ -1544,21 +2367,47 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1544
2367
|
}
|
|
1545
2368
|
return void 0;
|
|
1546
2369
|
});
|
|
2370
|
+
const suggestions = usePersistence(
|
|
2371
|
+
storageKey,
|
|
2372
|
+
storageType,
|
|
2373
|
+
/* @__PURE__ */ new Set()
|
|
2374
|
+
);
|
|
2375
|
+
const filteredSuggestions = computed(() => {
|
|
2376
|
+
if (!suggestions.value) {
|
|
2377
|
+
return [];
|
|
2378
|
+
}
|
|
2379
|
+
return [...suggestions.value].filter(
|
|
2380
|
+
(suggestion) => isEmpty(localModelValue.value) || `${suggestion}`.toLowerCase().includes(`${localModelValue.value}`.toLowerCase()) && suggestion !== localModelValue.value
|
|
2381
|
+
).reverse();
|
|
2382
|
+
});
|
|
2383
|
+
const hasSuggestions = computed(
|
|
2384
|
+
() => (storageKey == null ? void 0 : storageKey.value) && suggestions.value && suggestions.value.size > 0
|
|
2385
|
+
);
|
|
2386
|
+
function onSuggestionSelect(suggestion) {
|
|
2387
|
+
var _a;
|
|
2388
|
+
localModelValue.value = suggestion;
|
|
2389
|
+
(_a = dropdownEl.value) == null ? void 0 : _a.hide();
|
|
2390
|
+
}
|
|
2391
|
+
function onSuggestionRemove(suggestion) {
|
|
2392
|
+
var _a;
|
|
2393
|
+
(_a = suggestions.value) == null ? void 0 : _a.delete(suggestion);
|
|
2394
|
+
}
|
|
1547
2395
|
const { modifiers } = toRefs(props);
|
|
1548
2396
|
const bemCssClasses = useModifiers(
|
|
1549
2397
|
"vv-input-text",
|
|
1550
2398
|
modifiers,
|
|
1551
2399
|
computed(() => ({
|
|
1552
|
-
valid: valid.value,
|
|
1553
|
-
invalid: invalid.value,
|
|
1554
|
-
loading: loading.value,
|
|
1555
|
-
disabled: props.disabled,
|
|
1556
|
-
|
|
1557
|
-
"
|
|
1558
|
-
"icon-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
2400
|
+
"valid": valid.value,
|
|
2401
|
+
"invalid": invalid.value,
|
|
2402
|
+
"loading": loading.value,
|
|
2403
|
+
"disabled": props.disabled,
|
|
2404
|
+
"required": props.required,
|
|
2405
|
+
"readonly": props.readonly,
|
|
2406
|
+
"icon-before": !!hasIconBefore.value,
|
|
2407
|
+
"icon-after": !!iconAfter.value,
|
|
2408
|
+
"floating": props.floating && !isEmpty(props.label),
|
|
2409
|
+
"dirty": isDirty.value,
|
|
2410
|
+
"focus": isFocused.value,
|
|
1562
2411
|
"auto-width": props.autoWidth
|
|
1563
2412
|
}))
|
|
1564
2413
|
);
|
|
@@ -1570,26 +2419,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1570
2419
|
if (isDateTime.value && !isDirty.value && !focused.value) {
|
|
1571
2420
|
return INPUT_TYPES.TEXT;
|
|
1572
2421
|
}
|
|
1573
|
-
if (iMask
|
|
2422
|
+
if (props.iMask) {
|
|
1574
2423
|
return INPUT_TYPES.TEXT;
|
|
1575
2424
|
}
|
|
1576
2425
|
return props.type;
|
|
1577
2426
|
})();
|
|
1578
2427
|
const toReturn = {
|
|
1579
2428
|
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,
|
|
2429
|
+
"name": props.name,
|
|
2430
|
+
"tabindex": hasTabindex.value,
|
|
2431
|
+
"disabled": props.disabled,
|
|
2432
|
+
"readonly": props.readonly,
|
|
2433
|
+
"required": props.required,
|
|
2434
|
+
"autocomplete": props.autocomplete,
|
|
1586
2435
|
"aria-invalid": isInvalid.value,
|
|
1587
2436
|
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
1588
2437
|
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
1589
2438
|
};
|
|
1590
2439
|
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) {
|
|
2440
|
+
let max = props.max;
|
|
2441
|
+
if (type2 === INPUT_TYPES.DATE && !max) {
|
|
2442
|
+
max = "9999-12-31";
|
|
2443
|
+
}
|
|
1591
2444
|
toReturn.step = props.step;
|
|
1592
|
-
toReturn.max =
|
|
2445
|
+
toReturn.max = max !== void 0 ? String(max) : void 0;
|
|
1593
2446
|
toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
|
|
1594
2447
|
}
|
|
1595
2448
|
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 +2485,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1632
2485
|
INPUT_TYPES.SEARCH,
|
|
1633
2486
|
props
|
|
1634
2487
|
);
|
|
1635
|
-
|
|
2488
|
+
function onClickInner() {
|
|
1636
2489
|
if (isClickable.value) {
|
|
1637
2490
|
focused.value = true;
|
|
1638
2491
|
}
|
|
1639
|
-
}
|
|
2492
|
+
}
|
|
1640
2493
|
const hasStyle = computed(() => {
|
|
1641
2494
|
if (!props.autoWidth) {
|
|
1642
2495
|
return void 0;
|
|
@@ -1645,7 +2498,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1645
2498
|
width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
|
|
1646
2499
|
};
|
|
1647
2500
|
});
|
|
1648
|
-
|
|
2501
|
+
function onKeyDown(event) {
|
|
1649
2502
|
switch (event.code) {
|
|
1650
2503
|
case "ArrowUp":
|
|
1651
2504
|
if (isNumber.value) {
|
|
@@ -1661,103 +2514,197 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1661
2514
|
break;
|
|
1662
2515
|
}
|
|
1663
2516
|
emit("keydown", event);
|
|
1664
|
-
}
|
|
2517
|
+
}
|
|
1665
2518
|
return (_ctx, _cache) => {
|
|
1666
|
-
return openBlock(), createElementBlock(
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
2519
|
+
return openBlock(), createElementBlock(
|
|
2520
|
+
"div",
|
|
2521
|
+
{
|
|
2522
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
2523
|
+
},
|
|
2524
|
+
[
|
|
2525
|
+
unref(label) ? (openBlock(), createElementBlock("label", {
|
|
2526
|
+
key: 0,
|
|
2527
|
+
for: unref(hasId),
|
|
2528
|
+
class: "vv-input-text__label"
|
|
2529
|
+
}, toDisplayString(unref(label)), 9, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
2530
|
+
createElementVNode(
|
|
2531
|
+
"div",
|
|
2532
|
+
{
|
|
2533
|
+
ref_key: "wrapperEl",
|
|
2534
|
+
ref: wrapperEl,
|
|
2535
|
+
class: "vv-input-text__wrapper"
|
|
2536
|
+
},
|
|
2537
|
+
[
|
|
2538
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
2539
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2540
|
+
])) : createCommentVNode("v-if", true),
|
|
2541
|
+
createElementVNode(
|
|
2542
|
+
"div",
|
|
2543
|
+
{
|
|
2544
|
+
ref_key: "innerEl",
|
|
2545
|
+
ref: innerEl,
|
|
2546
|
+
class: "vv-input-text__inner",
|
|
2547
|
+
onClick: withModifiers(onClickInner, ["stop"])
|
|
2548
|
+
},
|
|
2549
|
+
[
|
|
2550
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2551
|
+
_sfc_main$1,
|
|
2552
|
+
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
|
|
2553
|
+
null,
|
|
2554
|
+
16
|
|
2555
|
+
/* FULL_PROPS */
|
|
2556
|
+
)) : createCommentVNode("v-if", true),
|
|
2557
|
+
createElementVNode("input", mergeProps({
|
|
2558
|
+
id: unref(hasId),
|
|
2559
|
+
ref_key: "inputEl",
|
|
2560
|
+
ref: inputEl
|
|
2561
|
+
}, unref(hasAttrs), {
|
|
2562
|
+
style: unref(hasStyle),
|
|
2563
|
+
onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
|
|
2564
|
+
onKeydown: onKeyDown,
|
|
2565
|
+
onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
|
|
2566
|
+
}), null, 16, _hoisted_3),
|
|
2567
|
+
(_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
2568
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
2569
|
+
createTextVNode(
|
|
2570
|
+
toDisplayString(_ctx.unit),
|
|
2571
|
+
1
|
|
2572
|
+
/* TEXT */
|
|
2573
|
+
)
|
|
2574
|
+
])
|
|
2575
|
+
])) : createCommentVNode("v-if", true)
|
|
2576
|
+
],
|
|
2577
|
+
512
|
|
2578
|
+
/* NEED_PATCH */
|
|
2579
|
+
),
|
|
2580
|
+
unref(iconAfter) ? (openBlock(), createBlock(
|
|
2581
|
+
_sfc_main$1,
|
|
2582
|
+
mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
|
|
2583
|
+
null,
|
|
2584
|
+
16
|
|
2585
|
+
/* FULL_PROPS */
|
|
2586
|
+
)) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
|
|
2587
|
+
key: 2,
|
|
2588
|
+
onTogglePassword
|
|
2589
|
+
})) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
|
|
2590
|
+
key: 3,
|
|
2591
|
+
onStepUp,
|
|
2592
|
+
onStepDown
|
|
2593
|
+
})) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
|
|
2594
|
+
key: 4,
|
|
2595
|
+
onClear
|
|
2596
|
+
})) : createCommentVNode("v-if", true),
|
|
2597
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
2598
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2599
|
+
])) : createCommentVNode("v-if", true),
|
|
2600
|
+
unref(count) ? (openBlock(), createElementBlock("span", _hoisted_6, [
|
|
2601
|
+
renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
2602
|
+
createTextVNode(
|
|
2603
|
+
toDisplayString(unref(countFormatted)),
|
|
2604
|
+
1
|
|
2605
|
+
/* TEXT */
|
|
2606
|
+
)
|
|
2607
|
+
])
|
|
2608
|
+
])) : createCommentVNode("v-if", true)
|
|
2609
|
+
],
|
|
2610
|
+
512
|
|
2611
|
+
/* NEED_PATCH */
|
|
2612
|
+
),
|
|
2613
|
+
createVNode(unref(HintSlot), {
|
|
2614
|
+
id: unref(hasHintId),
|
|
2615
|
+
class: "vv-input-text__hint"
|
|
2616
|
+
}, createSlots({
|
|
2617
|
+
_: 2
|
|
2618
|
+
/* DYNAMIC */
|
|
1683
2619
|
}, [
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
2620
|
+
_ctx.$slots.hint ? {
|
|
2621
|
+
name: "hint",
|
|
2622
|
+
fn: withCtx(() => [
|
|
2623
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2624
|
+
]),
|
|
2625
|
+
key: "0"
|
|
2626
|
+
} : void 0,
|
|
2627
|
+
_ctx.$slots.loading ? {
|
|
2628
|
+
name: "loading",
|
|
2629
|
+
fn: withCtx(() => [
|
|
2630
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2631
|
+
]),
|
|
2632
|
+
key: "1"
|
|
2633
|
+
} : void 0,
|
|
2634
|
+
_ctx.$slots.valid ? {
|
|
2635
|
+
name: "valid",
|
|
2636
|
+
fn: withCtx(() => [
|
|
2637
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2638
|
+
]),
|
|
2639
|
+
key: "2"
|
|
2640
|
+
} : void 0,
|
|
2641
|
+
_ctx.$slots.invalid ? {
|
|
2642
|
+
name: "invalid",
|
|
2643
|
+
fn: withCtx(() => [
|
|
2644
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2645
|
+
]),
|
|
2646
|
+
key: "3"
|
|
2647
|
+
} : void 0
|
|
2648
|
+
]), 1032, ["id"]),
|
|
2649
|
+
unref(hasSuggestions) ? (openBlock(), createBlock(_sfc_main$4, {
|
|
1705
2650
|
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
|
-
|
|
2651
|
+
ref_key: "dropdownEl",
|
|
2652
|
+
ref: dropdownEl,
|
|
2653
|
+
reference: unref(wrapperEl),
|
|
2654
|
+
"autofocus-first": false,
|
|
2655
|
+
"trigger-width": true
|
|
2656
|
+
}, {
|
|
2657
|
+
items: withCtx(() => [
|
|
2658
|
+
(openBlock(true), createElementBlock(
|
|
2659
|
+
Fragment,
|
|
2660
|
+
null,
|
|
2661
|
+
renderList(unref(filteredSuggestions), (value) => {
|
|
2662
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
2663
|
+
key: value,
|
|
2664
|
+
onClick: withModifiers(($event) => onSuggestionSelect(value), ["stop"])
|
|
2665
|
+
}, {
|
|
2666
|
+
default: withCtx(() => [
|
|
2667
|
+
createElementVNode("div", _hoisted_7, [
|
|
2668
|
+
renderSlot(_ctx.$slots, "suggestion", mergeProps({ ref_for: true }, { value }), () => [
|
|
2669
|
+
createTextVNode(
|
|
2670
|
+
toDisplayString(value),
|
|
2671
|
+
1
|
|
2672
|
+
/* TEXT */
|
|
2673
|
+
)
|
|
2674
|
+
])
|
|
2675
|
+
]),
|
|
2676
|
+
unref(suggestions) && unref(hasIconRemoveSuggestion) ? (openBlock(), createElementBlock("button", {
|
|
2677
|
+
key: 0,
|
|
2678
|
+
type: "button",
|
|
2679
|
+
tabindex: "-1",
|
|
2680
|
+
class: "cursor-pointer",
|
|
2681
|
+
title: _ctx.labelRemoveSuggestion,
|
|
2682
|
+
onClick: withModifiers(($event) => onSuggestionRemove(value), ["stop"])
|
|
2683
|
+
}, [
|
|
2684
|
+
createVNode(
|
|
2685
|
+
_sfc_main$1,
|
|
2686
|
+
mergeProps({ ref_for: true }, unref(hasIconRemoveSuggestion)),
|
|
2687
|
+
null,
|
|
2688
|
+
16
|
|
2689
|
+
/* FULL_PROPS */
|
|
2690
|
+
)
|
|
2691
|
+
], 8, _hoisted_8)) : createCommentVNode("v-if", true)
|
|
2692
|
+
]),
|
|
2693
|
+
_: 2
|
|
2694
|
+
/* DYNAMIC */
|
|
2695
|
+
}, 1032, ["onClick"]);
|
|
2696
|
+
}),
|
|
2697
|
+
128
|
|
2698
|
+
/* KEYED_FRAGMENT */
|
|
2699
|
+
))
|
|
1735
2700
|
]),
|
|
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);
|
|
2701
|
+
_: 3
|
|
2702
|
+
/* FORWARDED */
|
|
2703
|
+
}, 8, ["reference"])) : createCommentVNode("v-if", true)
|
|
2704
|
+
],
|
|
2705
|
+
2
|
|
2706
|
+
/* CLASS */
|
|
2707
|
+
);
|
|
1761
2708
|
};
|
|
1762
2709
|
}
|
|
1763
2710
|
});
|