@volverjs/ui-vue 0.0.4 → 0.0.5-beta.2
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/README.md +2 -2
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +19 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +264 -164
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +276 -98
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
- package/dist/components/VvAction/index.d.ts +2 -2
- package/dist/components/VvBadge/VvBadge.es.js +213 -44
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +247 -75
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +646 -360
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
- package/dist/components/VvButton/index.d.ts +13 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +261 -79
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +57 -38
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +562 -274
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +5 -5
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +661 -340
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +1546 -983
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
- package/dist/components/VvCombobox/index.d.ts +41 -10
- package/dist/components/VvDialog/VvDialog.es.js +387 -141
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +452 -244
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
- package/dist/components/VvDropdown/index.d.ts +40 -11
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -160
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +285 -90
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +113 -65
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +986 -462
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +66 -13
- package/dist/components/VvProgress/VvProgress.es.js +216 -45
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +499 -238
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +5 -5
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +598 -304
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +3 -3
- package/dist/components/VvSelect/VvSelect.es.js +631 -324
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +3 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +676 -355
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
- package/dist/components/VvTextarea/index.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +215 -47
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3522 -2231
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/index.es.js +264 -55
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.d.ts +3 -0
- package/dist/directives/v-contextmenu.es.js +42 -0
- package/dist/directives/v-contextmenu.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +222 -53
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.d.ts +3 -1
- package/dist/icons.es.js +40 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +112 -3607
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +50 -18
- package/dist/resolvers/unplugin.d.ts +7 -1
- package/dist/resolvers/unplugin.es.js +77 -37
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +13 -1
- package/package.json +126 -40
- package/src/Volver.ts +49 -22
- 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 +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +7 -7
- package/src/components/VvAction/index.ts +1 -1
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +11 -11
- package/src/components/VvButton/index.ts +10 -9
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +44 -26
- package/src/components/VvCombobox/index.ts +1 -1
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +7 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
- package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
- package/src/components/VvDropdown/index.ts +3 -3
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +130 -37
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +1 -1
- package/src/components/VvTextarea/VvTextarea.vue +6 -6
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +2 -2
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +4 -2
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/directives/index.ts +3 -1
- package/src/directives/v-contextmenu.ts +40 -0
- package/src/directives/v-tooltip.ts +2 -2
- package/src/icons.ts +1 -1
- package/src/index.ts +0 -2
- package/src/props/index.ts +20 -10
- package/src/resolvers/unplugin.ts +15 -1
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +40 -0
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
- package/src/stories/argTypes.ts +12 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1,61 +1,88 @@
|
|
|
1
|
-
import { unref
|
|
2
|
-
import { toReactive
|
|
3
|
-
import { iconExists
|
|
4
|
-
import { nanoid
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
if (
|
|
8
|
-
return
|
|
9
|
-
{
|
|
10
|
-
const
|
|
11
|
-
let
|
|
12
|
-
for (let i = 0,
|
|
13
|
-
if (
|
|
1
|
+
import { unref, toRefs, computed, h, inject, defineComponent, ref, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withDirectives, isRef, vModelText, createTextVNode, createVNode } from "vue";
|
|
2
|
+
import { toReactive, useFocus, useElementVisibility } from "@vueuse/core";
|
|
3
|
+
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
4
|
+
import { nanoid } from "nanoid";
|
|
5
|
+
function resolveFieldData(data, field) {
|
|
6
|
+
if (data && Object.keys(data).length && field) {
|
|
7
|
+
if (field.indexOf(".") === -1) {
|
|
8
|
+
return data[field];
|
|
9
|
+
} else {
|
|
10
|
+
const fields = field.split(".");
|
|
11
|
+
let value = data;
|
|
12
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
13
|
+
if (data == null) {
|
|
14
14
|
return null;
|
|
15
|
-
|
|
15
|
+
}
|
|
16
|
+
value = value[fields[i]];
|
|
16
17
|
}
|
|
17
|
-
return
|
|
18
|
+
return value;
|
|
18
19
|
}
|
|
19
|
-
} else
|
|
20
|
+
} else {
|
|
20
21
|
return null;
|
|
22
|
+
}
|
|
21
23
|
}
|
|
22
|
-
function
|
|
23
|
-
return ((
|
|
24
|
+
function isEmpty(value) {
|
|
25
|
+
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));
|
|
24
26
|
}
|
|
25
|
-
function
|
|
26
|
-
return typeof
|
|
27
|
+
function isString(value) {
|
|
28
|
+
return typeof value === "string" || value instanceof String;
|
|
27
29
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
+
function joinLines(errors) {
|
|
31
|
+
if (Array.isArray(errors)) {
|
|
32
|
+
return errors.filter((e) => isString(e)).join(" ");
|
|
33
|
+
}
|
|
34
|
+
return errors;
|
|
30
35
|
}
|
|
31
|
-
function
|
|
36
|
+
function HintSlotFactory(parentProps, parentSlots) {
|
|
32
37
|
const {
|
|
33
|
-
invalid:
|
|
34
|
-
valid:
|
|
35
|
-
hint:
|
|
36
|
-
loading:
|
|
37
|
-
} =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
invalid: invalidSlot,
|
|
39
|
+
valid: validSlot,
|
|
40
|
+
hint: hintSlot,
|
|
41
|
+
loading: loadingSlot
|
|
42
|
+
} = parentSlots;
|
|
43
|
+
const {
|
|
44
|
+
hintLabel,
|
|
45
|
+
modelValue,
|
|
46
|
+
valid,
|
|
47
|
+
validLabel,
|
|
48
|
+
invalid,
|
|
49
|
+
invalidLabel,
|
|
50
|
+
...otherProps
|
|
51
|
+
} = toRefs(parentProps);
|
|
52
|
+
const loading = resolveFieldData(otherProps, "loading");
|
|
53
|
+
const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
|
|
54
|
+
const hasInvalid = computed(() => {
|
|
55
|
+
if (!invalid.value) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (invalid.value && invalidSlot) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
});
|
|
69
|
+
const hasHint = computed(
|
|
70
|
+
() => !!(hintLabel && hintLabel.value || hintSlot)
|
|
71
|
+
);
|
|
72
|
+
const hasValid = computed(
|
|
73
|
+
() => !!(validLabel && validLabel.value || validSlot)
|
|
74
|
+
);
|
|
75
|
+
const hasLoading = computed(
|
|
76
|
+
() => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
|
|
77
|
+
);
|
|
78
|
+
const isVisible = computed(
|
|
79
|
+
() => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
|
|
53
80
|
);
|
|
54
81
|
return {
|
|
55
|
-
hasInvalid
|
|
56
|
-
hasHint
|
|
57
|
-
hasValid
|
|
58
|
-
hasLoading
|
|
82
|
+
hasInvalid,
|
|
83
|
+
hasHint,
|
|
84
|
+
hasValid,
|
|
85
|
+
hasLoading,
|
|
59
86
|
HintSlot: {
|
|
60
87
|
name: "HintSlot",
|
|
61
88
|
props: {
|
|
@@ -64,42 +91,50 @@ function Oe(e, t) {
|
|
|
64
91
|
default: () => ({})
|
|
65
92
|
}
|
|
66
93
|
},
|
|
67
|
-
setup(
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
hintLabel
|
|
71
|
-
modelValue
|
|
72
|
-
valid
|
|
73
|
-
validLabel
|
|
74
|
-
invalid
|
|
75
|
-
invalidLabel
|
|
76
|
-
loading
|
|
77
|
-
loadingLabel
|
|
78
|
-
...
|
|
94
|
+
setup(props) {
|
|
95
|
+
const hintContent = computed(() => {
|
|
96
|
+
const slotProps = toReactive({
|
|
97
|
+
hintLabel,
|
|
98
|
+
modelValue,
|
|
99
|
+
valid,
|
|
100
|
+
validLabel,
|
|
101
|
+
invalid,
|
|
102
|
+
invalidLabel,
|
|
103
|
+
loading,
|
|
104
|
+
loadingLabel,
|
|
105
|
+
...props.params
|
|
79
106
|
});
|
|
80
|
-
|
|
107
|
+
if (invalid == null ? void 0 : invalid.value) {
|
|
108
|
+
return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
109
|
+
}
|
|
110
|
+
if (valid == null ? void 0 : valid.value)
|
|
111
|
+
return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
112
|
+
if (loading == null ? void 0 : loading.value)
|
|
113
|
+
return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
114
|
+
return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
81
115
|
});
|
|
82
116
|
return {
|
|
83
|
-
isVisible
|
|
84
|
-
hasInvalid
|
|
85
|
-
hasValid
|
|
86
|
-
hintContent
|
|
117
|
+
isVisible,
|
|
118
|
+
hasInvalid,
|
|
119
|
+
hasValid,
|
|
120
|
+
hintContent
|
|
87
121
|
};
|
|
88
122
|
},
|
|
89
123
|
render() {
|
|
90
|
-
if (this.isVisible)
|
|
91
|
-
return
|
|
124
|
+
if (this.isVisible) {
|
|
125
|
+
return h(
|
|
92
126
|
"small",
|
|
93
127
|
{
|
|
94
128
|
role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
|
|
95
129
|
},
|
|
96
130
|
this.hintContent
|
|
97
131
|
);
|
|
132
|
+
}
|
|
98
133
|
}
|
|
99
134
|
}
|
|
100
135
|
};
|
|
101
136
|
}
|
|
102
|
-
const
|
|
137
|
+
const VvIconProps = {
|
|
103
138
|
/**
|
|
104
139
|
* Color
|
|
105
140
|
*/
|
|
@@ -123,7 +158,7 @@ const Ce = {
|
|
|
123
158
|
*/
|
|
124
159
|
name: {
|
|
125
160
|
type: String,
|
|
126
|
-
required:
|
|
161
|
+
required: true
|
|
127
162
|
},
|
|
128
163
|
/**
|
|
129
164
|
* By default 'vv'
|
|
@@ -193,77 +228,160 @@ const Ce = {
|
|
|
193
228
|
type: [String, Array]
|
|
194
229
|
}
|
|
195
230
|
};
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
231
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
232
|
+
Side2["left"] = "left";
|
|
233
|
+
Side2["right"] = "right";
|
|
234
|
+
Side2["top"] = "top";
|
|
235
|
+
Side2["bottom"] = "bottom";
|
|
236
|
+
return Side2;
|
|
237
|
+
})(Side || {});
|
|
238
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
239
|
+
Placement2["topStart"] = "top-start";
|
|
240
|
+
Placement2["topEnd"] = "top-end";
|
|
241
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
242
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
243
|
+
Placement2["leftStart"] = "left-start";
|
|
244
|
+
Placement2["leftEnd"] = "left-end";
|
|
245
|
+
Placement2["rightStart"] = "right-start";
|
|
246
|
+
Placement2["rightEnd"] = "right-end";
|
|
247
|
+
return Placement2;
|
|
248
|
+
})(Placement || {});
|
|
249
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
250
|
+
Position2["before"] = "before";
|
|
251
|
+
Position2["after"] = "after";
|
|
252
|
+
return Position2;
|
|
253
|
+
})(Position || {});
|
|
254
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
255
|
+
ButtonType2["button"] = "button";
|
|
256
|
+
ButtonType2["submit"] = "submit";
|
|
257
|
+
ButtonType2["reset"] = "reset";
|
|
258
|
+
return ButtonType2;
|
|
259
|
+
})(ButtonType || {});
|
|
260
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
261
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
262
|
+
AnchorTarget2["_self"] = "_self";
|
|
263
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
264
|
+
AnchorTarget2["_top"] = "_top";
|
|
265
|
+
return AnchorTarget2;
|
|
266
|
+
})(AnchorTarget || {});
|
|
267
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
268
|
+
function useVolver() {
|
|
269
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
200
270
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
203
|
-
const
|
|
204
|
-
[
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
271
|
+
function useModifiers(prefix, modifiers, others) {
|
|
272
|
+
return computed(() => {
|
|
273
|
+
const toReturn = {
|
|
274
|
+
[prefix]: true
|
|
275
|
+
};
|
|
276
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
277
|
+
if (modifiersArray) {
|
|
278
|
+
if (Array.isArray(modifiersArray)) {
|
|
279
|
+
modifiersArray.forEach((modifier) => {
|
|
280
|
+
if (modifier) {
|
|
281
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (others) {
|
|
287
|
+
Object.keys(others.value).forEach((key) => {
|
|
288
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
return toReturn;
|
|
211
292
|
});
|
|
212
293
|
}
|
|
213
|
-
const
|
|
294
|
+
const __default__$1 = {
|
|
214
295
|
name: "VvIcon"
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
)) || n;
|
|
296
|
+
};
|
|
297
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
298
|
+
...__default__$1,
|
|
299
|
+
props: VvIconProps,
|
|
300
|
+
setup(__props) {
|
|
301
|
+
const props = __props;
|
|
302
|
+
const show = ref(true);
|
|
303
|
+
const volver = useVolver();
|
|
304
|
+
const { modifiers } = toRefs(props);
|
|
305
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
306
|
+
const provider = computed(() => {
|
|
307
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
228
308
|
});
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
309
|
+
const icon = computed(() => {
|
|
310
|
+
const _name = props.name ?? "";
|
|
311
|
+
const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
|
|
312
|
+
if (iconExists(_name)) {
|
|
313
|
+
return _name;
|
|
314
|
+
} else if (iconExists(iconName)) {
|
|
315
|
+
return iconName;
|
|
316
|
+
} else {
|
|
317
|
+
return (volver == null ? void 0 : volver.iconsCollections.find(
|
|
318
|
+
(iconsCollection) => {
|
|
319
|
+
const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
|
|
320
|
+
if (iconExists(icon2)) {
|
|
321
|
+
return icon2;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
)) || _name;
|
|
234
325
|
}
|
|
235
|
-
|
|
326
|
+
});
|
|
327
|
+
function getSvgContent(svg) {
|
|
328
|
+
let dom = null;
|
|
329
|
+
if (typeof window === "undefined") {
|
|
330
|
+
const { JSDOM } = require("jsdom");
|
|
331
|
+
dom = new JSDOM().window;
|
|
332
|
+
}
|
|
333
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
334
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
335
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
336
|
+
return svgEl;
|
|
236
337
|
}
|
|
237
|
-
function
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
338
|
+
function addIconFromSvg(svg) {
|
|
339
|
+
const svgContentEl = getSvgContent(svg);
|
|
340
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
341
|
+
if (svgContentEl && svgContent) {
|
|
342
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
343
|
+
body: svgContent,
|
|
344
|
+
// Set height and width from svg content
|
|
345
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
346
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (volver) {
|
|
351
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
352
|
+
show.value = false;
|
|
353
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
354
|
+
if (svg) {
|
|
355
|
+
addIconFromSvg(svg);
|
|
356
|
+
show.value = true;
|
|
357
|
+
}
|
|
358
|
+
}).catch((e) => {
|
|
359
|
+
throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
|
|
360
|
+
});
|
|
361
|
+
} else if (props.svg) {
|
|
362
|
+
addIconFromSvg(props.svg);
|
|
363
|
+
}
|
|
245
364
|
}
|
|
246
|
-
return
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
icon: u(y)
|
|
264
|
-
}), null, 16, ["class"])) : B("", !0);
|
|
365
|
+
return (_ctx, _cache) => {
|
|
366
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
367
|
+
key: 0,
|
|
368
|
+
class: unref(bemCssClasses)
|
|
369
|
+
}, {
|
|
370
|
+
inline: _ctx.inline,
|
|
371
|
+
width: _ctx.width,
|
|
372
|
+
height: _ctx.height,
|
|
373
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
374
|
+
verticalFlip: _ctx.verticalFlip,
|
|
375
|
+
flip: _ctx.flip,
|
|
376
|
+
rotate: _ctx.rotate,
|
|
377
|
+
color: _ctx.color,
|
|
378
|
+
onLoad: _ctx.onLoad,
|
|
379
|
+
icon: unref(icon)
|
|
380
|
+
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
381
|
+
};
|
|
265
382
|
}
|
|
266
|
-
})
|
|
383
|
+
});
|
|
384
|
+
const LinkProps = {
|
|
267
385
|
/**
|
|
268
386
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
269
387
|
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
@@ -280,7 +398,7 @@ const Ee = {
|
|
|
280
398
|
*/
|
|
281
399
|
target: {
|
|
282
400
|
type: String,
|
|
283
|
-
validator: (
|
|
401
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
284
402
|
},
|
|
285
403
|
/**
|
|
286
404
|
* Anchor rel
|
|
@@ -289,7 +407,8 @@ const Ee = {
|
|
|
289
407
|
type: String,
|
|
290
408
|
default: "noopener noreferrer"
|
|
291
409
|
}
|
|
292
|
-
}
|
|
410
|
+
};
|
|
411
|
+
const ValidProps = {
|
|
293
412
|
/**
|
|
294
413
|
* Valid status
|
|
295
414
|
*/
|
|
@@ -298,7 +417,8 @@ const Ee = {
|
|
|
298
417
|
* Valid label
|
|
299
418
|
*/
|
|
300
419
|
validLabel: [String, Array]
|
|
301
|
-
}
|
|
420
|
+
};
|
|
421
|
+
const InvalidProps = {
|
|
302
422
|
/**
|
|
303
423
|
* Invalid status
|
|
304
424
|
*/
|
|
@@ -307,7 +427,8 @@ const Ee = {
|
|
|
307
427
|
* Invalid label
|
|
308
428
|
*/
|
|
309
429
|
invalidLabel: [String, Array]
|
|
310
|
-
}
|
|
430
|
+
};
|
|
431
|
+
const LoadingProps = {
|
|
311
432
|
/**
|
|
312
433
|
* Loading status
|
|
313
434
|
*/
|
|
@@ -319,53 +440,63 @@ const Ee = {
|
|
|
319
440
|
type: String,
|
|
320
441
|
default: "Loading..."
|
|
321
442
|
}
|
|
322
|
-
}
|
|
443
|
+
};
|
|
444
|
+
const DisabledProps = {
|
|
323
445
|
/**
|
|
324
446
|
* Whether the form control is disabled
|
|
325
447
|
*/
|
|
326
448
|
disabled: Boolean
|
|
327
|
-
}
|
|
449
|
+
};
|
|
450
|
+
const ActiveProps = {
|
|
328
451
|
/**
|
|
329
452
|
* Whether the item is active
|
|
330
453
|
*/
|
|
331
454
|
active: Boolean
|
|
332
|
-
}
|
|
455
|
+
};
|
|
456
|
+
const PressedProps = {
|
|
333
457
|
/**
|
|
334
458
|
* Whether the item is pressed
|
|
335
459
|
*/
|
|
336
460
|
pressed: Boolean
|
|
337
|
-
}
|
|
461
|
+
};
|
|
462
|
+
const LabelProps = {
|
|
338
463
|
/**
|
|
339
464
|
* The item label
|
|
340
465
|
*/
|
|
341
466
|
label: [String, Number]
|
|
342
|
-
}
|
|
467
|
+
};
|
|
468
|
+
const ReadonlyProps = {
|
|
343
469
|
/**
|
|
344
470
|
* The value is not editable
|
|
345
471
|
*/
|
|
346
472
|
readonly: Boolean
|
|
347
|
-
}
|
|
473
|
+
};
|
|
474
|
+
const ModifiersProps = {
|
|
348
475
|
/**
|
|
349
476
|
* Component BEM modifiers
|
|
350
477
|
*/
|
|
351
478
|
modifiers: [String, Array]
|
|
352
|
-
}
|
|
479
|
+
};
|
|
480
|
+
const HintProps = {
|
|
353
481
|
hintLabel: { type: String, default: "" }
|
|
354
|
-
}
|
|
482
|
+
};
|
|
483
|
+
const CountProps = {
|
|
355
484
|
/**
|
|
356
485
|
* Show character limit
|
|
357
486
|
*/
|
|
358
487
|
count: {
|
|
359
488
|
type: [Boolean, String],
|
|
360
|
-
default:
|
|
361
|
-
validator: (
|
|
489
|
+
default: false,
|
|
490
|
+
validator: (value) => [true, false, "limit", "countdown"].includes(value)
|
|
362
491
|
}
|
|
363
|
-
}
|
|
492
|
+
};
|
|
493
|
+
const DebounceProps = {
|
|
364
494
|
/**
|
|
365
495
|
* Milliseconds to wait before emitting the input event
|
|
366
496
|
*/
|
|
367
497
|
debounce: [Number, String]
|
|
368
|
-
}
|
|
498
|
+
};
|
|
499
|
+
const IconProps = {
|
|
369
500
|
/**
|
|
370
501
|
* VvIcon name or props
|
|
371
502
|
* @see VVIcon
|
|
@@ -376,79 +507,180 @@ const Ee = {
|
|
|
376
507
|
*/
|
|
377
508
|
iconPosition: {
|
|
378
509
|
type: String,
|
|
379
|
-
default:
|
|
380
|
-
validation: (
|
|
510
|
+
default: Position.before,
|
|
511
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
381
512
|
}
|
|
382
|
-
}
|
|
513
|
+
};
|
|
514
|
+
const TabindexProps = {
|
|
383
515
|
/**
|
|
384
516
|
* Global attribute tabindex
|
|
385
517
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
|
386
518
|
*/
|
|
387
519
|
tabindex: { type: [String, Number], default: 0 }
|
|
388
|
-
}
|
|
520
|
+
};
|
|
521
|
+
const FloatingLabelProps = {
|
|
389
522
|
/**
|
|
390
523
|
* If true the label will be floating
|
|
391
524
|
*/
|
|
392
525
|
floating: Boolean
|
|
393
|
-
}
|
|
526
|
+
};
|
|
527
|
+
const IdProps = {
|
|
394
528
|
/**
|
|
395
529
|
* Global attribute id
|
|
396
530
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
397
531
|
*/
|
|
398
532
|
id: [String, Number]
|
|
399
533
|
};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
534
|
+
({
|
|
535
|
+
/**
|
|
536
|
+
* Dropdown placement
|
|
537
|
+
*/
|
|
538
|
+
placement: {
|
|
539
|
+
type: String,
|
|
540
|
+
default: Side.bottom,
|
|
541
|
+
validator: (value) => {
|
|
542
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
/**
|
|
546
|
+
* Dropdown strategy
|
|
547
|
+
*/
|
|
548
|
+
strategy: {
|
|
549
|
+
type: String,
|
|
550
|
+
default: "absolute",
|
|
551
|
+
validator: (value) => {
|
|
552
|
+
return ["fixed", "absolute"].includes(value);
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
/**
|
|
556
|
+
* Dropdown show / hide transition name
|
|
557
|
+
*/
|
|
558
|
+
transitionName: {
|
|
559
|
+
type: String
|
|
560
|
+
},
|
|
561
|
+
/**
|
|
562
|
+
* Offset of the dropdown from the trigger
|
|
563
|
+
* @see https://floating-ui.com/docs/offset
|
|
564
|
+
*/
|
|
565
|
+
offset: {
|
|
566
|
+
type: [Number, String, Object],
|
|
567
|
+
default: 0
|
|
568
|
+
},
|
|
569
|
+
/**
|
|
570
|
+
* Move dropdown to the side if there is no space in the default position
|
|
571
|
+
* @see https://floating-ui.com/docs/shift
|
|
572
|
+
*/
|
|
573
|
+
shift: {
|
|
574
|
+
type: [Boolean, Object],
|
|
575
|
+
default: false
|
|
576
|
+
},
|
|
577
|
+
/**
|
|
578
|
+
* Flip dropdown position if there is no space in the default position
|
|
579
|
+
* @see https://floating-ui.com/docs/flip
|
|
580
|
+
*/
|
|
581
|
+
flip: {
|
|
582
|
+
type: [Boolean, Object],
|
|
583
|
+
default: true
|
|
584
|
+
},
|
|
585
|
+
/**
|
|
586
|
+
* Size of the dropdown
|
|
587
|
+
* @see https://floating-ui.com/docs/size
|
|
588
|
+
*/
|
|
589
|
+
size: {
|
|
590
|
+
type: [Boolean, Object],
|
|
591
|
+
default: () => ({ padding: 10 })
|
|
592
|
+
},
|
|
593
|
+
/**
|
|
594
|
+
* Automatically change the position of the dropdown
|
|
595
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
596
|
+
*/
|
|
597
|
+
autoPlacement: {
|
|
598
|
+
type: [Boolean, Object],
|
|
599
|
+
default: false
|
|
600
|
+
},
|
|
601
|
+
/**
|
|
602
|
+
* Add arrow to the dropdown
|
|
603
|
+
* @see https://floating-ui.com/docs/arrow
|
|
604
|
+
*/
|
|
605
|
+
arrow: {
|
|
606
|
+
type: Boolean,
|
|
607
|
+
default: false
|
|
608
|
+
},
|
|
609
|
+
/**
|
|
610
|
+
* Close dropdown on click outside
|
|
611
|
+
*/
|
|
612
|
+
autoClose: {
|
|
613
|
+
type: Boolean,
|
|
614
|
+
default: true
|
|
615
|
+
},
|
|
616
|
+
/**
|
|
617
|
+
* Autofocus first item on dropdown open
|
|
618
|
+
*/
|
|
619
|
+
autofocusFirst: {
|
|
620
|
+
type: Boolean,
|
|
621
|
+
default: true
|
|
622
|
+
},
|
|
623
|
+
/**
|
|
624
|
+
* Set dropdown width to the same as the trigger
|
|
625
|
+
*/
|
|
626
|
+
triggerWidth: {
|
|
627
|
+
type: Boolean
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
const IdNameProps = {
|
|
631
|
+
...IdProps,
|
|
403
632
|
/**
|
|
404
633
|
* Input / Textarea name
|
|
405
634
|
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
406
635
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
407
636
|
*/
|
|
408
|
-
name: { type: String, required:
|
|
409
|
-
}
|
|
637
|
+
name: { type: String, required: true }
|
|
638
|
+
};
|
|
639
|
+
const AutofocusProps = {
|
|
410
640
|
/**
|
|
411
641
|
* Global attribute autofocus
|
|
412
642
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
413
643
|
*/
|
|
414
644
|
autofocus: Boolean
|
|
415
|
-
}
|
|
645
|
+
};
|
|
646
|
+
const AutocompleteProps = {
|
|
416
647
|
/**
|
|
417
648
|
* Global attribute autocomplete
|
|
418
649
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
|
|
419
650
|
*/
|
|
420
651
|
autocomplete: { type: String, default: "off" }
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
...
|
|
424
|
-
...
|
|
425
|
-
...
|
|
426
|
-
...
|
|
427
|
-
...
|
|
428
|
-
...
|
|
429
|
-
...
|
|
430
|
-
...
|
|
431
|
-
...
|
|
432
|
-
...
|
|
433
|
-
...
|
|
434
|
-
...
|
|
435
|
-
...
|
|
436
|
-
...
|
|
437
|
-
...
|
|
652
|
+
};
|
|
653
|
+
const InputTextareaProps = {
|
|
654
|
+
...IdNameProps,
|
|
655
|
+
...AutofocusProps,
|
|
656
|
+
...AutocompleteProps,
|
|
657
|
+
...TabindexProps,
|
|
658
|
+
...DisabledProps,
|
|
659
|
+
...ReadonlyProps,
|
|
660
|
+
...ValidProps,
|
|
661
|
+
...InvalidProps,
|
|
662
|
+
...HintProps,
|
|
663
|
+
...LoadingProps,
|
|
664
|
+
...ModifiersProps,
|
|
665
|
+
...CountProps,
|
|
666
|
+
...DebounceProps,
|
|
667
|
+
...IconProps,
|
|
668
|
+
...FloatingLabelProps,
|
|
669
|
+
...LabelProps,
|
|
438
670
|
/**
|
|
439
671
|
* Input / Textarea minlength
|
|
440
672
|
* Minimum length (number of characters) of value
|
|
441
673
|
* Available for input types: text, search, url, tel, email, password
|
|
442
674
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
443
675
|
*/
|
|
444
|
-
minlength: Number,
|
|
676
|
+
minlength: [String, Number],
|
|
445
677
|
/**
|
|
446
678
|
* Input / Textarea maxlength
|
|
447
679
|
* Maximum length (number of characters) of value
|
|
448
680
|
* Available for input types: text, search, url, tel, email, password
|
|
449
681
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
450
682
|
*/
|
|
451
|
-
maxlength: Number,
|
|
683
|
+
maxlength: [String, Number],
|
|
452
684
|
/**
|
|
453
685
|
* Input / Textarea placeholder
|
|
454
686
|
* Text that appears in the form control when it has no value set
|
|
@@ -465,25 +697,32 @@ const Ge = {
|
|
|
465
697
|
required: Boolean
|
|
466
698
|
};
|
|
467
699
|
({
|
|
468
|
-
...
|
|
469
|
-
...
|
|
470
|
-
...
|
|
471
|
-
...
|
|
472
|
-
...
|
|
700
|
+
...DisabledProps,
|
|
701
|
+
...LabelProps,
|
|
702
|
+
...PressedProps,
|
|
703
|
+
...ActiveProps,
|
|
704
|
+
...LinkProps,
|
|
473
705
|
/**
|
|
474
706
|
* Button type
|
|
475
707
|
*/
|
|
476
|
-
type:
|
|
708
|
+
type: {
|
|
709
|
+
type: String,
|
|
710
|
+
default: ButtonType.button,
|
|
711
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
712
|
+
}
|
|
477
713
|
});
|
|
478
|
-
const
|
|
714
|
+
const WRAP = {
|
|
479
715
|
hard: "hard",
|
|
480
716
|
soft: "soft"
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
717
|
+
};
|
|
718
|
+
const SPELLCHECK = {
|
|
719
|
+
true: true,
|
|
720
|
+
false: false,
|
|
484
721
|
default: "default"
|
|
485
|
-
}
|
|
486
|
-
|
|
722
|
+
};
|
|
723
|
+
const VvTextareaEvents = ["update:modelValue", "focus", "blur", "keyup"];
|
|
724
|
+
const VvTextareaProps = {
|
|
725
|
+
...InputTextareaProps,
|
|
487
726
|
/**
|
|
488
727
|
* Textarea value
|
|
489
728
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#value
|
|
@@ -503,209 +742,291 @@ const et = {
|
|
|
503
742
|
* Indicates how the control should wrap the value for form submission.
|
|
504
743
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
|
|
505
744
|
*/
|
|
506
|
-
wrap: { type: String, default:
|
|
745
|
+
wrap: { type: String, default: WRAP.soft },
|
|
507
746
|
/**
|
|
508
747
|
* Specifies whether the <textarea> is subject to spell checking by the underlying browser/OS.
|
|
509
748
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
|
|
510
749
|
*/
|
|
511
|
-
spellcheck: { type: [Boolean, String], default:
|
|
750
|
+
spellcheck: { type: [Boolean, String], default: SPELLCHECK.default },
|
|
512
751
|
/**
|
|
513
752
|
* If true, the textarea will be resizable
|
|
514
753
|
*/
|
|
515
754
|
resizable: Boolean
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
755
|
+
};
|
|
756
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
757
|
+
function useDebouncedInput(modelValue, emit, ms = 0, {
|
|
758
|
+
getter = (value) => value,
|
|
759
|
+
setter = (value) => value
|
|
760
|
+
} = {}) {
|
|
761
|
+
let timeout;
|
|
762
|
+
if (typeof ms === "string") {
|
|
763
|
+
ms = parseInt(ms);
|
|
764
|
+
}
|
|
765
|
+
return computed({
|
|
766
|
+
get: () => getter(modelValue == null ? void 0 : modelValue.value),
|
|
767
|
+
set: (value) => {
|
|
768
|
+
if (timeout) {
|
|
769
|
+
clearTimeout(timeout);
|
|
770
|
+
}
|
|
771
|
+
timeout = setTimeout(() => {
|
|
772
|
+
emit("update:modelValue", setter(value));
|
|
773
|
+
}, ms);
|
|
525
774
|
}
|
|
526
775
|
});
|
|
527
776
|
}
|
|
528
|
-
function
|
|
529
|
-
const
|
|
530
|
-
() => Boolean((
|
|
531
|
-
)
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
() => Boolean((
|
|
537
|
-
)
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
777
|
+
function useComponentIcon(icon, iconPosition) {
|
|
778
|
+
const hasIconBefore = computed(
|
|
779
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
|
|
780
|
+
);
|
|
781
|
+
const hasIconAfter = computed(
|
|
782
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
|
|
783
|
+
);
|
|
784
|
+
const hasIconLeft = computed(
|
|
785
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
|
|
786
|
+
);
|
|
787
|
+
const hasIconRight = computed(
|
|
788
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
|
|
789
|
+
);
|
|
790
|
+
const hasIconTop = computed(
|
|
791
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
|
|
792
|
+
);
|
|
793
|
+
const hasIconBottom = computed(
|
|
794
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
|
|
541
795
|
);
|
|
796
|
+
const hasIcon = computed(() => {
|
|
797
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
798
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
799
|
+
}
|
|
800
|
+
return icon == null ? void 0 : icon.value;
|
|
801
|
+
});
|
|
542
802
|
return {
|
|
543
|
-
hasIcon
|
|
544
|
-
hasIconLeft
|
|
545
|
-
hasIconRight
|
|
546
|
-
hasIconTop
|
|
547
|
-
hasIconBottom
|
|
548
|
-
hasIconBefore
|
|
549
|
-
hasIconAfter
|
|
803
|
+
hasIcon,
|
|
804
|
+
hasIconLeft,
|
|
805
|
+
hasIconRight,
|
|
806
|
+
hasIconTop,
|
|
807
|
+
hasIconBottom,
|
|
808
|
+
hasIconBefore,
|
|
809
|
+
hasIconAfter
|
|
550
810
|
};
|
|
551
811
|
}
|
|
552
|
-
function
|
|
553
|
-
const { focused
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
})
|
|
557
|
-
|
|
812
|
+
function useComponentFocus(inputTemplateRef, emit) {
|
|
813
|
+
const { focused } = useFocus(inputTemplateRef);
|
|
814
|
+
watch(focused, (newValue) => {
|
|
815
|
+
emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
|
|
816
|
+
});
|
|
817
|
+
return {
|
|
818
|
+
focused
|
|
558
819
|
};
|
|
559
820
|
}
|
|
560
|
-
function
|
|
561
|
-
const
|
|
821
|
+
function useTextCount(text, options) {
|
|
822
|
+
const length = computed(() => {
|
|
823
|
+
return (unref(text) ?? "").length;
|
|
824
|
+
});
|
|
825
|
+
const gap = computed(() => {
|
|
826
|
+
if ((options == null ? void 0 : options.lowerLimit) !== void 0 && length.value < (options == null ? void 0 : options.lowerLimit)) {
|
|
827
|
+
return length.value - options.lowerLimit;
|
|
828
|
+
}
|
|
829
|
+
if ((options == null ? void 0 : options.upperLimit) !== void 0 && length.value < (options == null ? void 0 : options.upperLimit)) {
|
|
830
|
+
return options.upperLimit - length.value;
|
|
831
|
+
}
|
|
832
|
+
return 0;
|
|
833
|
+
});
|
|
834
|
+
const formatted = computed(() => {
|
|
835
|
+
if ((options == null ? void 0 : options.mode) === false) {
|
|
836
|
+
return "";
|
|
837
|
+
}
|
|
838
|
+
if ((options == null ? void 0 : options.mode) === "limit" && (options == null ? void 0 : options.upperLimit)) {
|
|
839
|
+
return `${length.value} / ${options.lowerLimit ? `${options.lowerLimit}-` : ""}${options.upperLimit}`;
|
|
840
|
+
}
|
|
841
|
+
if ((options == null ? void 0 : options.mode) === "countdown") {
|
|
842
|
+
if (gap.value === 0) {
|
|
843
|
+
return void 0;
|
|
844
|
+
}
|
|
845
|
+
return gap;
|
|
846
|
+
}
|
|
847
|
+
return length.value;
|
|
848
|
+
});
|
|
562
849
|
return {
|
|
563
|
-
length
|
|
564
|
-
gap
|
|
565
|
-
formatted
|
|
850
|
+
length,
|
|
851
|
+
gap,
|
|
852
|
+
formatted
|
|
566
853
|
};
|
|
567
854
|
}
|
|
568
|
-
const
|
|
855
|
+
const _hoisted_1 = ["for"];
|
|
856
|
+
const _hoisted_2 = { class: "vv-textarea__wrapper" };
|
|
857
|
+
const _hoisted_3 = {
|
|
569
858
|
key: 0,
|
|
570
859
|
class: "vv-textarea__input-before"
|
|
571
|
-
}
|
|
860
|
+
};
|
|
861
|
+
const _hoisted_4 = { class: "vv-textarea__inner" };
|
|
862
|
+
const _hoisted_5 = ["id"];
|
|
863
|
+
const _hoisted_6 = {
|
|
572
864
|
key: 1,
|
|
573
865
|
class: "vv-textarea__input-after"
|
|
574
|
-
}
|
|
866
|
+
};
|
|
867
|
+
const _hoisted_7 = {
|
|
575
868
|
key: 2,
|
|
576
869
|
class: "vv-textarea__limit"
|
|
577
|
-
}
|
|
870
|
+
};
|
|
871
|
+
const __default__ = {
|
|
578
872
|
name: "VvTextarea"
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
873
|
+
};
|
|
874
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
875
|
+
...__default__,
|
|
876
|
+
props: VvTextareaProps,
|
|
877
|
+
emits: VvTextareaEvents,
|
|
878
|
+
setup(__props, { emit }) {
|
|
879
|
+
const props = __props;
|
|
880
|
+
const slots = useSlots();
|
|
881
|
+
const textarea = ref();
|
|
882
|
+
const {
|
|
883
|
+
id,
|
|
884
|
+
icon,
|
|
885
|
+
iconPosition,
|
|
886
|
+
label,
|
|
887
|
+
modelValue,
|
|
888
|
+
count,
|
|
889
|
+
valid,
|
|
890
|
+
invalid,
|
|
891
|
+
loading,
|
|
892
|
+
modifiers
|
|
893
|
+
} = toRefs(props);
|
|
894
|
+
const hasId = useUniqueId(id);
|
|
895
|
+
const hasDescribedBy = computed(() => `${hasId.value}-hint`);
|
|
896
|
+
const hasPlaceholder = computed(
|
|
897
|
+
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
898
|
+
);
|
|
899
|
+
const localModelValue = useDebouncedInput(modelValue, emit, props.debounce);
|
|
900
|
+
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
901
|
+
icon,
|
|
902
|
+
iconPosition
|
|
903
|
+
);
|
|
904
|
+
const { focused } = useComponentFocus(textarea, emit);
|
|
905
|
+
const isVisible = useElementVisibility(textarea);
|
|
906
|
+
watch(isVisible, (newValue) => {
|
|
907
|
+
if (newValue && props.autofocus) {
|
|
908
|
+
focused.value = true;
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
912
|
+
mode: props.count,
|
|
913
|
+
upperLimit: Number(props.maxlength),
|
|
914
|
+
lowerLimit: Number(props.minlength)
|
|
915
|
+
});
|
|
916
|
+
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
917
|
+
const hasTabindex = computed(
|
|
918
|
+
() => isClickable.value ? props.tabindex : -1
|
|
919
|
+
);
|
|
920
|
+
const isDirty = computed(() => !isEmpty(modelValue));
|
|
921
|
+
const isInvalid = computed(() => {
|
|
922
|
+
if (props.invalid === true) {
|
|
923
|
+
return true;
|
|
924
|
+
}
|
|
925
|
+
if (props.valid === true) {
|
|
926
|
+
return false;
|
|
927
|
+
}
|
|
928
|
+
return void 0;
|
|
603
929
|
});
|
|
604
|
-
const {
|
|
605
|
-
|
|
606
|
-
upperLimit: r.maxlength,
|
|
607
|
-
lowerLimit: r.minlength
|
|
608
|
-
}), le = o(() => !r.disabled && !r.readonly), oe = o(
|
|
609
|
-
() => le.value ? r.tabindex : -1
|
|
610
|
-
), se = o(() => !A(f)), ue = o(() => {
|
|
611
|
-
if (r.invalid === !0)
|
|
612
|
-
return !0;
|
|
613
|
-
if (r.valid === !0)
|
|
614
|
-
return !1;
|
|
615
|
-
}), { HintSlot: ie, hasHint: ce, hasInvalid: K } = Oe(r, a), de = ee(
|
|
930
|
+
const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots);
|
|
931
|
+
const bemCssClasses = useModifiers(
|
|
616
932
|
"vv-textarea",
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
valid:
|
|
620
|
-
invalid:
|
|
621
|
-
loading:
|
|
622
|
-
disabled:
|
|
623
|
-
readonly:
|
|
624
|
-
"icon-before":
|
|
625
|
-
"icon-after":
|
|
626
|
-
floating:
|
|
627
|
-
dirty:
|
|
628
|
-
focused:
|
|
629
|
-
resizable:
|
|
933
|
+
modifiers,
|
|
934
|
+
computed(() => ({
|
|
935
|
+
valid: valid.value,
|
|
936
|
+
invalid: invalid.value,
|
|
937
|
+
loading: loading.value,
|
|
938
|
+
disabled: props.disabled,
|
|
939
|
+
readonly: props.readonly,
|
|
940
|
+
"icon-before": hasIconBefore.value,
|
|
941
|
+
"icon-after": hasIconAfter.value,
|
|
942
|
+
floating: props.floating && !isEmpty(props.label),
|
|
943
|
+
dirty: isDirty.value,
|
|
944
|
+
focused: focused.value,
|
|
945
|
+
resizable: props.resizable
|
|
630
946
|
}))
|
|
631
|
-
)
|
|
947
|
+
);
|
|
948
|
+
const hasAttrs = computed(
|
|
632
949
|
() => ({
|
|
633
|
-
name:
|
|
634
|
-
placeholder:
|
|
635
|
-
tabindex:
|
|
636
|
-
disabled:
|
|
637
|
-
readonly:
|
|
638
|
-
required:
|
|
639
|
-
autocomplete:
|
|
640
|
-
minlength:
|
|
641
|
-
maxlength:
|
|
642
|
-
cols:
|
|
643
|
-
rows:
|
|
644
|
-
wrap:
|
|
645
|
-
spellcheck:
|
|
646
|
-
"aria-invalid":
|
|
647
|
-
"aria-describedby": !
|
|
648
|
-
"aria-errormessage":
|
|
950
|
+
name: props.name,
|
|
951
|
+
placeholder: hasPlaceholder.value,
|
|
952
|
+
tabindex: hasTabindex.value,
|
|
953
|
+
disabled: props.disabled,
|
|
954
|
+
readonly: props.readonly,
|
|
955
|
+
required: props.required,
|
|
956
|
+
autocomplete: props.autocomplete,
|
|
957
|
+
minlength: props.minlength,
|
|
958
|
+
maxlength: props.maxlength,
|
|
959
|
+
cols: props.cols,
|
|
960
|
+
rows: props.rows,
|
|
961
|
+
wrap: props.wrap,
|
|
962
|
+
spellcheck: props.spellcheck,
|
|
963
|
+
"aria-invalid": isInvalid.value,
|
|
964
|
+
"aria-describedby": !hasInvalid.value && hasHint.value ? hasDescribedBy.value : void 0,
|
|
965
|
+
"aria-errormessage": hasInvalid.value ? hasDescribedBy.value : void 0
|
|
649
966
|
})
|
|
650
|
-
)
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
967
|
+
);
|
|
968
|
+
const slotProps = computed(() => ({
|
|
969
|
+
valid: props.valid,
|
|
970
|
+
invalid: props.invalid,
|
|
971
|
+
modelValue: props.modelValue,
|
|
972
|
+
hintLabel: props.hintLabel,
|
|
973
|
+
maxlength: props.maxlength,
|
|
974
|
+
minlength: props.minlength,
|
|
975
|
+
clear: onClear
|
|
976
|
+
}));
|
|
977
|
+
const onClear = () => {
|
|
978
|
+
localModelValue.value = void 0;
|
|
660
979
|
};
|
|
661
|
-
return (
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
980
|
+
return (_ctx, _cache) => {
|
|
981
|
+
return openBlock(), createElementBlock("div", {
|
|
982
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
983
|
+
}, [
|
|
984
|
+
unref(label) ? (openBlock(), createElementBlock("label", {
|
|
985
|
+
key: 0,
|
|
986
|
+
for: unref(hasId),
|
|
987
|
+
class: "vv-textarea__label"
|
|
988
|
+
}, toDisplayString(unref(label)), 9, _hoisted_1)) : createCommentVNode("", true),
|
|
989
|
+
createElementVNode("div", _hoisted_2, [
|
|
990
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
991
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
992
|
+
])) : createCommentVNode("", true),
|
|
993
|
+
createElementVNode("div", _hoisted_4, [
|
|
994
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
995
|
+
key: 0,
|
|
996
|
+
class: "vv-textarea__icon"
|
|
997
|
+
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
998
|
+
withDirectives(createElementVNode("textarea", mergeProps({
|
|
999
|
+
id: unref(hasId),
|
|
1000
|
+
ref_key: "textarea",
|
|
1001
|
+
ref: textarea,
|
|
1002
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
1003
|
+
}, unref(hasAttrs), {
|
|
1004
|
+
onKeyup: _cache[1] || (_cache[1] = ($event) => emit("keyup", $event))
|
|
1005
|
+
}), null, 16, _hoisted_5), [
|
|
1006
|
+
[vModelText, unref(localModelValue)]
|
|
1007
|
+
]),
|
|
1008
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
1009
|
+
key: 1,
|
|
1010
|
+
class: "vv-textarea__icon vv-textarea__icon-after"
|
|
1011
|
+
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
|
|
687
1012
|
]),
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
1013
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
1014
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1015
|
+
])) : createCommentVNode("", true),
|
|
1016
|
+
unref(count) ? (openBlock(), createElementBlock("span", _hoisted_7, [
|
|
1017
|
+
renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
1018
|
+
createTextVNode(toDisplayString(unref(countFormatted)), 1)
|
|
1019
|
+
])
|
|
1020
|
+
])) : createCommentVNode("", true)
|
|
692
1021
|
]),
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
])
|
|
700
|
-
])) : B("", !0)
|
|
701
|
-
]),
|
|
702
|
-
Be(u(ie), {
|
|
703
|
-
id: u(I),
|
|
704
|
-
class: "vv-textarea__hint"
|
|
705
|
-
}, null, 8, ["id"])
|
|
706
|
-
], 2));
|
|
1022
|
+
createVNode(unref(HintSlot), {
|
|
1023
|
+
id: unref(hasDescribedBy),
|
|
1024
|
+
class: "vv-textarea__hint"
|
|
1025
|
+
}, null, 8, ["id"])
|
|
1026
|
+
], 2);
|
|
1027
|
+
};
|
|
707
1028
|
}
|
|
708
1029
|
});
|
|
709
1030
|
export {
|
|
710
|
-
|
|
1031
|
+
_sfc_main as default
|
|
711
1032
|
};
|