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