@volverjs/ui-vue 0.0.10-beta.15 → 0.0.10-beta.16
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 +96 -2
- package/auto-imports.d.ts +2 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +33 -9
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +9 -2
- package/dist/components/VvAccordion/index.d.ts +4 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +33 -9
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +9 -2
- package/dist/components/VvAccordionGroup/index.d.ts +4 -1
- package/dist/components/VvAction/VvAction.es.js +29 -8
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +44 -10
- package/dist/components/VvAction/index.d.ts +21 -5
- package/dist/components/VvAlert/VvAlert.es.js +91 -107
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +14 -4
- package/dist/components/VvAlert/index.d.ts +7 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +91 -107
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +9 -2
- package/dist/components/VvAlertGroup/index.d.ts +6 -2
- package/dist/components/VvAvatar/VvAvatar.es.js +33 -9
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +11 -3
- package/dist/components/VvAvatar/index.d.ts +4 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +33 -9
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +9 -2
- package/dist/components/VvAvatarGroup/index.d.ts +4 -1
- package/dist/components/VvBadge/VvBadge.es.js +33 -9
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +11 -3
- package/dist/components/VvBadge/index.d.ts +4 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +33 -9
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -3
- package/dist/components/VvBreadcrumb/index.d.ts +4 -1
- package/dist/components/VvButton/VvButton.es.js +100 -119
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +78 -20
- package/dist/components/VvButton/index.d.ts +34 -12
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -9
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +17 -4
- package/dist/components/VvButtonGroup/index.d.ts +8 -2
- package/dist/components/VvCard/VvCard.es.js +33 -9
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +11 -3
- package/dist/components/VvCard/index.d.ts +4 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +56 -17
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +94 -22
- package/dist/components/VvCheckbox/index.d.ts +44 -11
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +64 -19
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +93 -22
- package/dist/components/VvCheckboxGroup/index.d.ts +44 -11
- package/dist/components/VvCombobox/VvCombobox.es.js +108 -165
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +97 -24
- package/dist/components/VvCombobox/index.d.ts +42 -11
- package/dist/components/VvDialog/VvDialog.es.js +51 -103
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +33 -9
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +14 -2
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -12
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +11 -3
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +25 -6
- package/dist/components/VvDropdown/index.d.ts +6 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +33 -9
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +29 -8
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +37 -10
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +22 -95
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +81 -44
- package/dist/components/VvIcon/index.d.ts +21 -48
- package/dist/components/VvInputFile/VvInputFile.es.js +107 -123
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +52 -12
- package/dist/components/VvInputFile/index.d.ts +24 -6
- package/dist/components/VvInputText/VvInputText.es.js +115 -147
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +141 -34
- package/dist/components/VvInputText/index.d.ts +71 -26
- package/dist/components/VvNav/VvNav.es.js +33 -9
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +9 -2
- package/dist/components/VvNav/index.d.ts +4 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +29 -8
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +33 -9
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +9 -2
- package/dist/components/VvProgress/index.d.ts +4 -1
- package/dist/components/VvRadio/VvRadio.es.js +56 -17
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +94 -22
- package/dist/components/VvRadio/index.d.ts +44 -11
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +64 -19
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +93 -22
- package/dist/components/VvRadioGroup/index.d.ts +44 -11
- package/dist/components/VvSelect/VvSelect.es.js +95 -138
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +97 -24
- package/dist/components/VvSelect/index.d.ts +46 -12
- package/dist/components/VvTab/VvTab.es.js +33 -9
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +9 -2
- package/dist/components/VvTab/index.d.ts +4 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +109 -143
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +141 -34
- package/dist/components/VvTextarea/index.d.ts +66 -17
- package/dist/components/VvTooltip/VvTooltip.es.js +33 -9
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +9 -2
- package/dist/components/VvTooltip/index.d.ts +4 -1
- package/dist/components/index.es.js +178 -232
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useComponentIcon.d.ts +9 -8
- package/dist/directives/index.es.js +33 -9
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +33 -9
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +251 -61
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +15 -4
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +77 -22
- package/dist/stories/Icon/Icon.settings.d.ts +1 -0
- package/package.json +33 -33
- 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/VvAlert/index.ts +1 -3
- package/src/components/VvAlertGroup/index.ts +2 -1
- package/src/components/VvButton/VvButton.vue +6 -6
- package/src/components/VvButton/index.ts +2 -4
- package/src/components/VvCombobox/VvCombobox.vue +5 -8
- package/src/components/VvIcon/VvIcon.vue +2 -2
- package/src/components/VvIcon/index.ts +22 -48
- package/src/components/VvInputText/VvInputText.vue +11 -12
- package/src/components/VvSelect/VvSelect.vue +5 -8
- package/src/components/VvTextarea/VvTextarea.vue +5 -8
- package/src/composables/useComponentIcon.ts +15 -14
- package/src/props/index.ts +89 -25
- package/src/stories/Icon/Icon.settings.ts +3 -3
|
@@ -1,69 +1,41 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
1
|
import type { IconifyIconOnLoad, IconifyRenderMode } from '@iconify/vue';
|
|
3
2
|
export declare enum IconPrefix {
|
|
4
3
|
simple = "simple",
|
|
5
4
|
normal = "normal",
|
|
6
5
|
detailed = "detailed"
|
|
7
6
|
}
|
|
8
|
-
export
|
|
9
|
-
/**
|
|
10
|
-
* Color
|
|
11
|
-
*/
|
|
12
|
-
color: StringConstructor;
|
|
13
|
-
/**
|
|
14
|
-
* Width
|
|
15
|
-
*/
|
|
16
|
-
width: {
|
|
17
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Height
|
|
21
|
-
*/
|
|
22
|
-
height: {
|
|
23
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
24
|
-
};
|
|
7
|
+
export type VvIconProps = {
|
|
25
8
|
/**
|
|
26
9
|
* Icon name
|
|
27
10
|
* Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
|
|
28
11
|
* https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
29
12
|
*/
|
|
30
|
-
name:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
name: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
width?: string | number;
|
|
16
|
+
height?: string | number;
|
|
34
17
|
/**
|
|
35
|
-
* By default 'vv'
|
|
36
18
|
* If custom collection is not added with "addCollection" DS class method, this prop could not be used
|
|
37
19
|
* Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
38
20
|
*/
|
|
39
|
-
provider
|
|
40
|
-
type: StringConstructor;
|
|
41
|
-
};
|
|
21
|
+
provider?: string;
|
|
42
22
|
/**
|
|
23
|
+
* @default 'normal'
|
|
43
24
|
* The name of icon set.
|
|
44
25
|
* Icon default options prefix: simple | normal | detailed
|
|
45
26
|
*/
|
|
46
|
-
prefix
|
|
47
|
-
type: PropType<string>;
|
|
48
|
-
default: string;
|
|
49
|
-
};
|
|
27
|
+
prefix?: IconPrefix | string;
|
|
50
28
|
/**
|
|
51
29
|
* Url remote SVG icon
|
|
52
30
|
*/
|
|
53
|
-
src
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*/
|
|
57
|
-
horizontalFlip: BooleanConstructor;
|
|
58
|
-
/**
|
|
59
|
-
* Vertical flip
|
|
60
|
-
*/
|
|
61
|
-
verticalFlip: BooleanConstructor;
|
|
31
|
+
src?: string;
|
|
32
|
+
horizontalFlip?: boolean;
|
|
33
|
+
verticalFlip?: boolean;
|
|
62
34
|
/**
|
|
63
35
|
* String alternative to "horizontalFlip" and "verticalFlip".
|
|
64
36
|
* Example: https://docs.iconify.design/icon-components/vue/transform.html
|
|
65
37
|
*/
|
|
66
|
-
flip
|
|
38
|
+
flip?: string;
|
|
67
39
|
/**
|
|
68
40
|
* Icon render mode
|
|
69
41
|
* 'style' = 'bg' or 'mask', depending on icon content
|
|
@@ -72,30 +44,31 @@ export declare const VvIconProps: {
|
|
|
72
44
|
* 'svg' = svg
|
|
73
45
|
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
74
46
|
*/
|
|
75
|
-
mode
|
|
47
|
+
mode?: IconifyRenderMode;
|
|
76
48
|
/**
|
|
77
49
|
* Toggles inline or block mode
|
|
78
50
|
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
79
51
|
*/
|
|
80
|
-
inline
|
|
52
|
+
inline?: boolean;
|
|
81
53
|
/**
|
|
82
54
|
* rotates icon
|
|
83
55
|
* Example https://docs.iconify.design/icon-components/vue/transform.html
|
|
84
56
|
*/
|
|
85
|
-
rotate
|
|
57
|
+
rotate?: number | string;
|
|
86
58
|
/**
|
|
87
59
|
* A callback that is called when icon data has been loaded
|
|
88
60
|
*/
|
|
89
|
-
onLoad
|
|
61
|
+
onLoad?: IconifyIconOnLoad;
|
|
90
62
|
/**
|
|
91
63
|
* SVG icon string
|
|
92
64
|
*/
|
|
93
|
-
svg
|
|
65
|
+
svg?: string;
|
|
94
66
|
/**
|
|
95
67
|
* Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
|
|
96
68
|
* @values string | string[]
|
|
97
69
|
*/
|
|
98
|
-
modifiers
|
|
99
|
-
|
|
100
|
-
|
|
70
|
+
modifiers?: string | string[];
|
|
71
|
+
};
|
|
72
|
+
export declare const VvIconPropsDefaults: {
|
|
73
|
+
prefix: IconPrefix;
|
|
101
74
|
};
|
|
@@ -1,100 +1,10 @@
|
|
|
1
|
-
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment, isRef, h, onBeforeUnmount, normalizeClass, withModifiers, createVNode, createElementVNode, renderList, createSlots, normalizeProps, guardReactiveProps } from "vue";
|
|
1
|
+
import { inject, computed, unref, defineComponent, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment, isRef, h, onBeforeUnmount, normalizeClass, withModifiers, createVNode, createElementVNode, renderList, createSlots, normalizeProps, guardReactiveProps } from "vue";
|
|
2
2
|
import { useVModel } from "@vueuse/core";
|
|
3
3
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
4
4
|
import { uid } from "uid";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
color: String,
|
|
10
|
-
/**
|
|
11
|
-
* Width
|
|
12
|
-
*/
|
|
13
|
-
width: {
|
|
14
|
-
type: [String, Number]
|
|
15
|
-
},
|
|
16
|
-
/**
|
|
17
|
-
* Height
|
|
18
|
-
*/
|
|
19
|
-
height: {
|
|
20
|
-
type: [String, Number]
|
|
21
|
-
},
|
|
22
|
-
/**
|
|
23
|
-
* Icon name
|
|
24
|
-
* Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
|
|
25
|
-
* https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
26
|
-
*/
|
|
27
|
-
name: {
|
|
28
|
-
type: String,
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* By default 'vv'
|
|
33
|
-
* If custom collection is not added with "addCollection" DS class method, this prop could not be used
|
|
34
|
-
* Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
35
|
-
*/
|
|
36
|
-
provider: {
|
|
37
|
-
type: String
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* The name of icon set.
|
|
41
|
-
* Icon default options prefix: simple | normal | detailed
|
|
42
|
-
*/
|
|
43
|
-
prefix: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: "normal"
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Url remote SVG icon
|
|
49
|
-
*/
|
|
50
|
-
src: String,
|
|
51
|
-
/**
|
|
52
|
-
* Horizontal flip
|
|
53
|
-
*/
|
|
54
|
-
horizontalFlip: Boolean,
|
|
55
|
-
/**
|
|
56
|
-
* Vertical flip
|
|
57
|
-
*/
|
|
58
|
-
verticalFlip: Boolean,
|
|
59
|
-
/**
|
|
60
|
-
* String alternative to "horizontalFlip" and "verticalFlip".
|
|
61
|
-
* Example: https://docs.iconify.design/icon-components/vue/transform.html
|
|
62
|
-
*/
|
|
63
|
-
flip: String,
|
|
64
|
-
/**
|
|
65
|
-
* Icon render mode
|
|
66
|
-
* 'style' = 'bg' or 'mask', depending on icon content
|
|
67
|
-
* 'bg' = span with style using `background`
|
|
68
|
-
* 'mask' = span with style using `mask`
|
|
69
|
-
* 'svg' = svg
|
|
70
|
-
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
71
|
-
*/
|
|
72
|
-
mode: String,
|
|
73
|
-
/**
|
|
74
|
-
* Toggles inline or block mode
|
|
75
|
-
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
76
|
-
*/
|
|
77
|
-
inline: Boolean,
|
|
78
|
-
/**
|
|
79
|
-
* rotates icon
|
|
80
|
-
* Example https://docs.iconify.design/icon-components/vue/transform.html
|
|
81
|
-
*/
|
|
82
|
-
rotate: [Number, String],
|
|
83
|
-
/**
|
|
84
|
-
* A callback that is called when icon data has been loaded
|
|
85
|
-
*/
|
|
86
|
-
onLoad: Function,
|
|
87
|
-
/**
|
|
88
|
-
* SVG icon string
|
|
89
|
-
*/
|
|
90
|
-
svg: String,
|
|
91
|
-
/**
|
|
92
|
-
* Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
|
|
93
|
-
* @values string | string[]
|
|
94
|
-
*/
|
|
95
|
-
modifiers: {
|
|
96
|
-
type: [String, Array]
|
|
97
|
-
}
|
|
5
|
+
const VvIconPropsDefaults = {
|
|
6
|
+
prefix: "normal"
|
|
7
|
+
/* normal */
|
|
98
8
|
};
|
|
99
9
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
100
10
|
Strategy2["absolute"] = "absolute";
|
|
@@ -183,7 +93,24 @@ const __default__$3 = {
|
|
|
183
93
|
};
|
|
184
94
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
185
95
|
...__default__$3,
|
|
186
|
-
props:
|
|
96
|
+
props: mergeDefaults({
|
|
97
|
+
name: {},
|
|
98
|
+
color: {},
|
|
99
|
+
width: {},
|
|
100
|
+
height: {},
|
|
101
|
+
provider: {},
|
|
102
|
+
prefix: {},
|
|
103
|
+
src: {},
|
|
104
|
+
horizontalFlip: { type: Boolean },
|
|
105
|
+
verticalFlip: { type: Boolean },
|
|
106
|
+
flip: {},
|
|
107
|
+
mode: {},
|
|
108
|
+
inline: { type: Boolean },
|
|
109
|
+
rotate: {},
|
|
110
|
+
onLoad: { type: Function },
|
|
111
|
+
svg: {},
|
|
112
|
+
modifiers: {}
|
|
113
|
+
}, VvIconPropsDefaults),
|
|
187
114
|
setup(__props) {
|
|
188
115
|
const props = __props;
|
|
189
116
|
const hasRotate = computed(() => {
|
|
@@ -291,6 +218,7 @@ const LinkProps = {
|
|
|
291
218
|
*/
|
|
292
219
|
target: {
|
|
293
220
|
type: String,
|
|
221
|
+
default: void 0,
|
|
294
222
|
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
295
223
|
},
|
|
296
224
|
/**
|
|
@@ -305,27 +233,33 @@ const ValidProps = {
|
|
|
305
233
|
/**
|
|
306
234
|
* Valid status
|
|
307
235
|
*/
|
|
308
|
-
valid: Boolean,
|
|
236
|
+
valid: { type: Boolean, default: false },
|
|
309
237
|
/**
|
|
310
238
|
* Valid label
|
|
311
239
|
*/
|
|
312
|
-
validLabel: [String, Array]
|
|
240
|
+
validLabel: { type: [String, Array], default: void 0 }
|
|
313
241
|
};
|
|
314
242
|
const InvalidProps = {
|
|
315
243
|
/**
|
|
316
244
|
* Invalid status
|
|
317
245
|
*/
|
|
318
|
-
invalid:
|
|
246
|
+
invalid: {
|
|
247
|
+
type: Boolean,
|
|
248
|
+
default: false
|
|
249
|
+
},
|
|
319
250
|
/**
|
|
320
251
|
* Invalid label
|
|
321
252
|
*/
|
|
322
|
-
invalidLabel: [String, Array]
|
|
253
|
+
invalidLabel: { type: [String, Array], default: void 0 }
|
|
323
254
|
};
|
|
324
255
|
const LoadingProps = {
|
|
325
256
|
/**
|
|
326
257
|
* Loading status
|
|
327
258
|
*/
|
|
328
|
-
loading:
|
|
259
|
+
loading: {
|
|
260
|
+
type: Boolean,
|
|
261
|
+
default: false
|
|
262
|
+
},
|
|
329
263
|
/**
|
|
330
264
|
* Loading label
|
|
331
265
|
*/
|
|
@@ -338,47 +272,68 @@ const DisabledProps = {
|
|
|
338
272
|
/**
|
|
339
273
|
* Whether the form control is disabled
|
|
340
274
|
*/
|
|
341
|
-
disabled:
|
|
275
|
+
disabled: {
|
|
276
|
+
type: Boolean,
|
|
277
|
+
default: false
|
|
278
|
+
}
|
|
342
279
|
};
|
|
343
280
|
const ActiveProps = {
|
|
344
281
|
/**
|
|
345
282
|
* Whether the item is active
|
|
346
283
|
*/
|
|
347
|
-
active:
|
|
284
|
+
active: {
|
|
285
|
+
type: Boolean,
|
|
286
|
+
default: false
|
|
287
|
+
}
|
|
348
288
|
};
|
|
349
289
|
const CurrentProps = {
|
|
350
290
|
/**
|
|
351
291
|
* Whether the item is current
|
|
352
292
|
*/
|
|
353
|
-
current:
|
|
293
|
+
current: {
|
|
294
|
+
type: Boolean,
|
|
295
|
+
default: false
|
|
296
|
+
}
|
|
354
297
|
};
|
|
355
298
|
const PressedProps = {
|
|
356
299
|
/**
|
|
357
300
|
* Whether the item is pressed
|
|
358
301
|
*/
|
|
359
|
-
pressed:
|
|
302
|
+
pressed: {
|
|
303
|
+
type: Boolean,
|
|
304
|
+
default: false
|
|
305
|
+
}
|
|
360
306
|
};
|
|
361
307
|
const LabelProps = {
|
|
362
308
|
/**
|
|
363
309
|
* The item label
|
|
364
310
|
*/
|
|
365
|
-
label:
|
|
311
|
+
label: {
|
|
312
|
+
type: [String, Number],
|
|
313
|
+
default: void 0
|
|
314
|
+
}
|
|
366
315
|
};
|
|
367
316
|
const ModifiersProps = {
|
|
368
317
|
/**
|
|
369
318
|
* Component BEM modifiers
|
|
370
319
|
*/
|
|
371
|
-
modifiers:
|
|
320
|
+
modifiers: {
|
|
321
|
+
type: [String, Array],
|
|
322
|
+
default: void 0
|
|
323
|
+
}
|
|
372
324
|
};
|
|
373
325
|
const HintProps = {
|
|
374
326
|
hintLabel: { type: String, default: "" }
|
|
375
327
|
};
|
|
376
|
-
|
|
328
|
+
const IconProps = {
|
|
377
329
|
/**
|
|
378
330
|
* VvIcon name or props
|
|
379
331
|
* @see VVIcon
|
|
380
332
|
*/
|
|
381
|
-
icon: {
|
|
333
|
+
icon: {
|
|
334
|
+
type: [String, Object],
|
|
335
|
+
default: void 0
|
|
336
|
+
},
|
|
382
337
|
/**
|
|
383
338
|
* VvIcon position
|
|
384
339
|
*/
|
|
@@ -387,7 +342,7 @@ const HintProps = {
|
|
|
387
342
|
default: Position.before,
|
|
388
343
|
validation: (value) => Object.values(Position).includes(value)
|
|
389
344
|
}
|
|
390
|
-
}
|
|
345
|
+
};
|
|
391
346
|
const UnselectableProps = {
|
|
392
347
|
/**
|
|
393
348
|
* If true the input will be unselectable
|
|
@@ -422,7 +377,8 @@ const IdProps = {
|
|
|
422
377
|
* Dropdown show / hide transition name
|
|
423
378
|
*/
|
|
424
379
|
transitionName: {
|
|
425
|
-
type: String
|
|
380
|
+
type: String,
|
|
381
|
+
default: void 0
|
|
426
382
|
},
|
|
427
383
|
/**
|
|
428
384
|
* Offset of the dropdown from the trigger
|
|
@@ -490,7 +446,8 @@ const IdProps = {
|
|
|
490
446
|
* Set dropdown width to the same as the trigger
|
|
491
447
|
*/
|
|
492
448
|
triggerWidth: {
|
|
493
|
-
type: Boolean
|
|
449
|
+
type: Boolean,
|
|
450
|
+
default: false
|
|
494
451
|
}
|
|
495
452
|
});
|
|
496
453
|
const ActionProps = {
|
|
@@ -774,10 +731,7 @@ const VvButtonProps = {
|
|
|
774
731
|
...ModifiersProps,
|
|
775
732
|
...UnselectableProps,
|
|
776
733
|
...LoadingProps,
|
|
777
|
-
|
|
778
|
-
* Button icon
|
|
779
|
-
*/
|
|
780
|
-
icon: [String, Object],
|
|
734
|
+
...IconProps,
|
|
781
735
|
/**
|
|
782
736
|
* Button icon position
|
|
783
737
|
*/
|
|
@@ -872,6 +826,41 @@ function useGroupProps(props, emit) {
|
|
|
872
826
|
};
|
|
873
827
|
}
|
|
874
828
|
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
|
|
829
|
+
function useComponentIcon(icon, iconPosition) {
|
|
830
|
+
const hasIcon = computed(() => {
|
|
831
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
832
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
833
|
+
}
|
|
834
|
+
return icon == null ? void 0 : icon.value;
|
|
835
|
+
});
|
|
836
|
+
const hasIconBefore = computed(
|
|
837
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
838
|
+
);
|
|
839
|
+
const hasIconAfter = computed(
|
|
840
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
841
|
+
);
|
|
842
|
+
const hasIconLeft = computed(
|
|
843
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
844
|
+
);
|
|
845
|
+
const hasIconRight = computed(
|
|
846
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
847
|
+
);
|
|
848
|
+
const hasIconTop = computed(
|
|
849
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
850
|
+
);
|
|
851
|
+
const hasIconBottom = computed(
|
|
852
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
853
|
+
);
|
|
854
|
+
return {
|
|
855
|
+
hasIcon,
|
|
856
|
+
hasIconLeft,
|
|
857
|
+
hasIconRight,
|
|
858
|
+
hasIconTop,
|
|
859
|
+
hasIconBottom,
|
|
860
|
+
hasIconBefore,
|
|
861
|
+
hasIconAfter
|
|
862
|
+
};
|
|
863
|
+
}
|
|
875
864
|
const _hoisted_1$1 = {
|
|
876
865
|
key: 1,
|
|
877
866
|
class: "vv-button__label"
|
|
@@ -934,9 +923,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
934
923
|
)
|
|
935
924
|
}))
|
|
936
925
|
);
|
|
937
|
-
const
|
|
938
|
-
() => typeof (icon == null ? void 0 : icon.value) === "string" ? { name: icon == null ? void 0 : icon.value } : icon == null ? void 0 : icon.value
|
|
939
|
-
);
|
|
926
|
+
const { hasIcon } = useComponentIcon(icon);
|
|
940
927
|
const toggleValue = computed(() => {
|
|
941
928
|
return props.value !== void 0 ? props.value : name.value;
|
|
942
929
|
});
|
|
@@ -999,12 +986,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
999
986
|
{ key: 1 },
|
|
1000
987
|
[
|
|
1001
988
|
renderSlot(_ctx.$slots, "before"),
|
|
1002
|
-
unref(
|
|
989
|
+
unref(hasIcon) ? (openBlock(), createBlock(
|
|
1003
990
|
_sfc_main$3,
|
|
1004
|
-
mergeProps({
|
|
1005
|
-
key: 0,
|
|
1006
|
-
class: "vv-button__icon"
|
|
1007
|
-
}, unref(hasIconProps)),
|
|
991
|
+
mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-button__icon" }),
|
|
1008
992
|
null,
|
|
1009
993
|
16
|
|
1010
994
|
/* FULL_PROPS */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=t(e.vue,e.core,e.vue$1,e.uid)}(this,(function(e,t,l,o){"use strict";const n={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{}),s=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(s||{});const d=Symbol.for("volver"),c=Symbol.for("buttonGroup"),v=Symbol.for("dropdownTrigger"),f=Symbol.for("dropdownAction");function p(){return e.inject(d)}function m(t,l,o){return e.computed((()=>{const n={[t]:!0},a="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{n[`${t}--${l}`]=e.unref(o.value[l])})),n}))}const g=e.defineComponent({name:"VvIcon",props:n,setup(t){const o=t,n=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),a=e.ref(!0),i=p(),{modifiers:r}=e.toRefs(o),u=m("vv-icon",r),s=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${s.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const n=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${s.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return n?`@${s.value}:${n.prefix}:${e}`:e}));function c(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&l.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${s.value}:${o.prefix}:${o.name}`)&&(a.value=!1,i.fetchIcon(o.src).then((e=>{e&&(c(e),a.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(t,o)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(n),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),b={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(s).includes(e)},rel:{type:String,default:"noopener noreferrer"}},h={valid:Boolean,validLabel:[String,Array]},y={invalid:Boolean,invalidLabel:[String,Array]},S={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},k={disabled:Boolean},B={active:Boolean},L={current:Boolean},V={pressed:Boolean},$={label:[String,Number]},_={modifiers:[String,Array]},w={hintLabel:{type:String,default:""}};i.before;const A={unselectable:{type:Boolean,default:!0}},O={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const x={...k,...$,...V,...B,...L,...b,type:{type:String,default:r.button,validator:e=>Object.values(r).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:u.button}},C=x;const N=e.defineComponent({name:"VvAction",props:C,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:o}){const n=t,a=p(),i=e.ref(null);l({$el:i});const{reference:r,bus:s,aria:d,expanded:c}=e.inject(v,{});e.watch((()=>i.value),(e=>{r&&(r.value=e)}));const m=e.computed((()=>n.pressed||(null==c?void 0:c.value))),{role:g}=e.inject(f,{}),b=e.computed((()=>{switch(!0){case n.disabled:return u.button;case void 0!==n.to:return(null==a?void 0:a.nuxt)?u.nuxtLink:u.routerLink;case void 0!==n.href:return u.a;default:return n.defaultTag}})),h=e.computed((()=>{const e={...null==d?void 0:d.value,ariaPressed:!!m.value||void 0,ariaLabel:n.ariaLabel,role:null==g?void 0:g.value};switch(b.value){case u.a:return{...e,href:n.href,target:n.target,rel:n.rel};case u.routerLink:case u.nuxtLink:return{...e,to:n.to,target:n.target};case u.button:return{...e,type:n.type,disabled:n.disabled};default:return e}})),y=e=>{n.disabled?e.preventDefault():(null==s||s.emit("click",e),o("click",e))},S=e=>{null==s||s.emit("mouseover",e),o("mouseover",e)},k=e=>{null==s||s.emit("mouseleave",e),o("mouseleave",e)};return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(h),{ref_key:"element",ref:i,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled,current:t.current},onClickPassive:y,onMouseoverPassive:S,onMouseleavePassive:k}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function E(e,t,l){return l?P(e,l)===P(t,l):j(e,t)}function j(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let n,a,i;if(l&&o){if(a=e.length,a!=t.length)return!1;for(n=a;0!=n--;)if(!j(e[n],t[n]))return!1;return!0}if(l!=o)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const s=e instanceof RegExp,d=t instanceof RegExp;if(s!=d)return!1;if(s&&d)return e.toString()==t.toString();const c=Object.keys(e);if(a=c.length,a!==Object.keys(t).length)return!1;for(n=a;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,c[n]))return!1;for(n=a;0!=n--;)if(i=c[n],!j(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function P(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let o=e;for(let t=0,n=l.length;t<n;++t){if(null==e)return null;o=o[l[t]]}return o}}return null}function R(e,t){if(null!=e&&t&&t.length)for(const l of t)if(E(e,l))return!0;return!1}function D(t){const l=e.inject(t,void 0),o=e.computed((()=>{return t=l,!(null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var t,o}));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,n){if(null==l?void 0:l.value){const o=e.unref(l.value)[t];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const a=e.toRef(o,t);return e.computed({get:()=>a.value,set(e){n&&n(`update:${t}`,e)}})}}}const I={...x,...O,..._,...A,...S,icon:[String,Object],iconPosition:{type:String,default:a.left,validator:e=>Object.values(a).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};const F=t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))),M={key:1,class:"vv-button__label"},T={key:1,class:"vv-button__label"},z=e.defineComponent({name:"VvButton",props:I,emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const n=t,i=e.useAttrs(),r=e.useSlots(),{id:u,modifiers:s,iconPosition:d,icon:v,label:f,modelValue:p,disabled:b,toggle:h,unselectable:y}=function(t,l){const{group:o,isInGroup:n,getGroupOrLocalRef:a}=D(c),{id:i,iconPosition:r,icon:u,label:s,pressed:d}=e.toRefs(t),v=a("modelValue",t,l),f=a("toggle",t),p=a("unselectable",t),m=e.computed((()=>(null==o?void 0:o.value.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,l=null==o?void 0:o.value.modifiers.value;const n=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>n.add(e)))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach((e=>n.add(e)))),Array.from(n)})),b=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{group:o,isInGroup:n,modelValue:v,toggle:f,unselectable:p,multiple:m,modifiers:g,disabled:b,id:i,pressed:d,iconPosition:r,icon:u,label:s}}(n,o),S=F(u),k=e.computed((()=>(null==i?void 0:i.name)||S.value)),B=e.ref(null);l({$el:e.computed((()=>{var e;return null==(e=B.value)?void 0:e.$el}))});const L=e.computed((()=>h.value?Array.isArray(p.value)?R(k.value,p.value):E(k.value,p.value):n.pressed)),V=m("vv-button",s,e.computed((()=>({reverse:[a.right,a.bottom].includes(d.value),column:[a.top,a.bottom].includes(d.value),"icon-only":Boolean((null==v?void 0:v.value)&&!(null==f?void 0:f.value)&&!r.default)})))),$=e.computed((()=>"string"==typeof(null==v?void 0:v.value)?{name:null==v?void 0:v.value}:null==v?void 0:v.value)),_=e.computed((()=>void 0!==n.value?n.value:k.value)),w=()=>{if(h.value){if(Array.isArray(p.value))return R(_.value,p.value)?void(y.value&&(p.value=p.value.filter((e=>e!==_.value)))):void p.value.push(_.value);if(_.value===p.value&&y.value)return void(p.value=n.uncheckedValue);p.value=_.value}};return(t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({disabled:e.unref(b),pressed:e.unref(L),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(S),ref_key:"element",ref:B,class:e.unref(V),onClick:w}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(g,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",M,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(v)?(e.openBlock(),e.createBlock(g,e.mergeProps({key:0,class:"vv-button__icon"},e.unref($)),null,16)):e.createCommentVNode("v-if",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("span",T,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}});function q(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const H={..._,...h,...y,...w,...$,...S,name:{type:String},id:{type:String},modelValue:{type:Object,required:!0},max:[Number,String],labelButton:{type:String,default:"Image"},loading:Boolean,accept:String,placeholder:String,multiple:Boolean,iconLeft:String,iconRight:String};const G=["for"],U=["onDragenter","onDragleave","onDrop","onClick"],J={class:"vv-input-file__preview"},K=["src","alt"],Q={class:"vv-input-file__wrapper"},W=["id","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","name"],X={class:"vv-input-file__list"},Y={class:"vv-input-file__item-name"},Z={class:"vv-input-file__item-info"},ee=["onClick"];return e.defineComponent({name:"VvInputFile",props:H,emits:["update:modelValue"],setup(l,{emit:o}){const n=l,a=e.useSlots(),i=function(t,l,o){const n=p(),a=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[t]))return n.defaults.value[t]}));return e.computed((()=>{if(void 0===a.value)return o;const e=a.value,t=l,n=o;return Object.keys(t).reduce(((l,o)=>{const a=n[o];if(l[o]=a,o in e){if(Array.isArray(t[o])){const n=t[o];n.length&&n[0]===a&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===a&&(l[o]=e[o]),"object"==typeof t[o]){let n=t[o].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(a)&&(l[o]=e[o]):n===a&&(l[o]=e[o])}}return l}),{})}))}("VvInputFile",H,n),{modifiers:r,id:u}=e.toRefs(n),s=F(u),d=e.computed((()=>`${s.value}-hint`)),c=m("vv-input-file",r,e.computed((()=>({dragging:V.value,loading:n.loading,valid:!0===n.valid,invalid:!0===n.invalid,"icon-before":!!n.iconLeft,"icon-after":!!n.iconRight})))),{HintSlot:v,hasHintLabelOrSlot:f,hasInvalidLabelOrSlot:b,hintSlotScope:h}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),n=e.computed((()=>q(o.value.invalidLabel))),a=e.computed((()=>q(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.value)))),s=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||n.value)))),d=e.computed((()=>!u.value&&!s.value&&Boolean(o.value.valid&&(l.valid||a.value)))),c=e.computed((()=>!u.value&&!s.value&&!d.value&&Boolean(l.hint||r.value))),v=e.computed((()=>s.value||d.value||u.value||c.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:n,validLabel:a,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,l,o,n,a,i,r,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(n=(o=this.$slots).invalid)?void 0:n.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(a=this.$slots).valid)?void 0:i.call(a))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(i,a),y=t.useVModel(n,"modelValue",o),S=e.computed((()=>{var e;return y.value&&(Array.isArray(y.value)||(null==(e=y.value)?void 0:e.name))?Array.isArray(y.value)?y.value:[y.value]:[]})),k=e.computed((()=>"string"==typeof n.max?parseInt(n.max):n.max)),B=e.computed((()=>{var e;return null==(e=null==r?void 0:r.value)?void 0:e.includes("drop-area")})),L=e.computed((()=>!!n.multiple&&(!k.value||k.value-S.value.length>1))),V=e.ref(!1),$=e.ref(),_=()=>{V.value=!0},w=()=>{V.value=!1},A=e=>{var t,l;(null==(t=e.dataTransfer)?void 0:t.files)&&(V.value=!1,x(null==(l=e.dataTransfer)?void 0:l.files))},O=()=>{var e;(null==(e=$.value)?void 0:e.files)&&(x($.value.files),$.value.value="")},x=e=>{if(!n.multiple)return Array.isArray(y.value)?void(y.value=[...e]):void(y.value=e[0]);let t=[];t=!Array.isArray(y.value)&&y.value?[y.value]:y.value&&Array.isArray(y.value)?[...y.value]:t;for(const l of e){if(k.value&&t.length>=k.value)break;t.push(l)}y.value=t},C=()=>{$.value&&$.value.click()},N=e.computed((()=>{if(0!==S.value.length)return S.value[0]instanceof File?URL.createObjectURL(S.value[0]):S.value[0].url}));e.onBeforeUnmount((()=>{N.value&&URL.revokeObjectURL(N.value)}));const E=e=>{if(e)return Math.floor(e/1024)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(c))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(s)},e.toDisplayString(t.label),9,G)):e.createCommentVNode("v-if",!0),B.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(_,["prevent","stop"]),onDragleave:e.withModifiers(w,["prevent","stop"]),onDrop:e.withModifiers(A,["prevent","stop"]),onDragover:l[0]||(l[0]=e.withModifiers((()=>{}),["prevent","stop"])),onClick:e.withModifiers(C,["stop"])},[e.renderSlot(t.$slots,"drop-area",{},(()=>[e.createVNode(z,{modifiers:"action","aria-label":"upload",label:N.value?void 0:t.labelButton,class:e.normalizeClass([{"absolute top-8 right-8":N.value},"z-1"]),icon:N.value?"edit":"image",onClick:e.withModifiers(C,["stop"])},null,8,["label","class","icon","onClick"]),e.createElementVNode("picture",J,[N.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:N.value,alt:S.value[0].name},null,8,K)):e.createCommentVNode("v-if",!0)])]))],40,U)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Q,[t.iconLeft?(e.openBlock(),e.createBlock(g,{key:0,name:t.iconLeft},null,8,["name"])):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{id:e.unref(s),ref_key:"inputEl",ref:$,placeholder:t.placeholder,"aria-describedby":e.unref(f)?d.value:void 0,"aria-invalid":t.invalid,"aria-errormessage":e.unref(b)?d.value:void 0,multiple:L.value,accept:t.accept,type:"file",name:t.name,onChange:O},null,40,W),t.iconRight?(e.openBlock(),e.createBlock(g,{key:1,name:t.iconRight},null,8,["name"])):e.createCommentVNode("v-if",!0)]),e.createElementVNode("ul",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,((t,l)=>(e.openBlock(),e.createElementBlock("li",{key:l,class:"vv-input-file__item"},[e.createVNode(g,{class:"vv-input-file__item-icon",name:"akar-icons:file"}),e.createElementVNode("div",Y,e.toDisplayString(t.name),1),e.createElementVNode("small",Z,e.toDisplayString(E(t.size))+" KB ",1),e.createElementVNode("button",{type:"button",class:"vv-input-file__item-remove",title:"Remove","aria-label":"remove-file",onClick:e.withModifiers((e=>(e=>{if(!Array.isArray(y.value))return void(y.value=void 0);const t=[...y.value];t.splice(e,1),y.value=t})(l)),["stop"])},null,8,ee)])))),128))]),e.createVNode(e.unref(v),{id:d.value,class:"vv-input-file__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=t(e.vue,e.core,e.vue$1,e.uid)}(this,(function(e,t,l,o){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{}),u=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(u||{});const s=Symbol.for("volver"),d=Symbol.for("buttonGroup"),v=Symbol.for("dropdownTrigger"),c=Symbol.for("dropdownAction");function f(){return e.inject(s)}function p(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const m=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},{prefix:"normal"}),setup(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=f(),{modifiers:r}=e.toRefs(o),u=p("vv-icon",r),s=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${s.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${s.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${s.value}:${a.prefix}:${e}`:e}));function v(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),g={to:{type:[String,Object]},href:String,target:{type:String,default:void 0,validator:e=>Object.values(u).includes(e)},rel:{type:String,default:"noopener noreferrer"}},b={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},y={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},S={disabled:{type:Boolean,default:!1}},k={active:{type:Boolean,default:!1}},B={current:{type:Boolean,default:!1}},L={pressed:{type:Boolean,default:!1}},V={label:{type:[String,Number],default:void 0}},$={modifiers:{type:[String,Array],default:void 0}},_={hintLabel:{type:String,default:""}},w={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:n.before,validation:e=>Object.values(n).includes(e)}},A={unselectable:{type:Boolean,default:!0}},O={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const x={...S,...V,...L,...k,...B,...g,type:{type:String,default:i.button,validator:e=>Object.values(i).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:r.button}},C=x;const N=e.defineComponent({name:"VvAction",props:C,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:o}){const a=t,n=f(),i=e.ref(null);l({$el:i});const{reference:u,bus:s,aria:d,expanded:p}=e.inject(v,{});e.watch((()=>i.value),(e=>{u&&(u.value=e)}));const m=e.computed((()=>a.pressed||(null==p?void 0:p.value))),{role:g}=e.inject(c,{}),b=e.computed((()=>{switch(!0){case a.disabled:return r.button;case void 0!==a.to:return(null==n?void 0:n.nuxt)?r.nuxtLink:r.routerLink;case void 0!==a.href:return r.a;default:return a.defaultTag}})),h=e.computed((()=>{const e={...null==d?void 0:d.value,ariaPressed:!!m.value||void 0,ariaLabel:a.ariaLabel,role:null==g?void 0:g.value};switch(b.value){case r.a:return{...e,href:a.href,target:a.target,rel:a.rel};case r.routerLink:case r.nuxtLink:return{...e,to:a.to,target:a.target};case r.button:return{...e,type:a.type,disabled:a.disabled};default:return e}})),y=e=>{a.disabled?e.preventDefault():(null==s||s.emit("click",e),o("click",e))},S=e=>{null==s||s.emit("mouseover",e),o("mouseover",e)},k=e=>{null==s||s.emit("mouseleave",e),o("mouseleave",e)};return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(h),{ref_key:"element",ref:i,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled,current:t.current},onClickPassive:y,onMouseoverPassive:S,onMouseleavePassive:k}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function j(e,t,l){return l?I(e,l)===I(t,l):E(e,t)}function E(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,i;if(l&&o){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!E(e[a],t[a]))return!1;return!0}if(l!=o)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const s=e instanceof RegExp,d=t instanceof RegExp;if(s!=d)return!1;if(s&&d)return e.toString()==t.toString();const v=Object.keys(e);if(n=v.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,v[a]))return!1;for(a=n;0!=a--;)if(i=v[a],!E(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function I(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let o=e;for(let t=0,a=l.length;t<a;++t){if(null==e)return null;o=o[l[t]]}return o}}return null}function P(e,t){if(null!=e&&t&&t.length)for(const l of t)if(j(e,l))return!0;return!1}function R(t){const l=e.inject(t,void 0),o=e.computed((()=>{return t=l,!(null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var t,o}));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){if(null==l?void 0:l.value){const o=e.unref(l.value)[t];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,t);return e.computed({get:()=>n.value,set(e){a&&a(`update:${t}`,e)}})}}}const D={...x,...O,...$,...A,...y,...w,iconPosition:{type:String,default:a.left,validator:e=>Object.values(a).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};const F=t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid())));const M={key:1,class:"vv-button__label"},T={key:1,class:"vv-button__label"},z=e.defineComponent({name:"VvButton",props:D,emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const i=t,r=e.useAttrs(),u=e.useSlots(),{id:s,modifiers:v,iconPosition:c,icon:f,label:g,modelValue:b,disabled:h,toggle:y,unselectable:S}=function(t,l){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=R(d),{id:i,iconPosition:r,icon:u,label:s,pressed:v}=e.toRefs(t),c=n("modelValue",t,l),f=n("toggle",t),p=n("unselectable",t),m=e.computed((()=>(null==o?void 0:o.value.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,l=null==o?void 0:o.value.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>a.add(e)))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach((e=>a.add(e)))),Array.from(a)})),b=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{group:o,isInGroup:a,modelValue:c,toggle:f,unselectable:p,multiple:m,modifiers:g,disabled:b,id:i,pressed:v,iconPosition:r,icon:u,label:s}}(i,o),k=F(s),B=e.computed((()=>(null==r?void 0:r.name)||k.value)),L=e.ref(null);l({$el:e.computed((()=>{var e;return null==(e=L.value)?void 0:e.$el}))});const V=e.computed((()=>y.value?Array.isArray(b.value)?P(B.value,b.value):j(B.value,b.value):i.pressed)),$=p("vv-button",v,e.computed((()=>({reverse:[a.right,a.bottom].includes(c.value),column:[a.top,a.bottom].includes(c.value),"icon-only":Boolean((null==f?void 0:f.value)&&!(null==g?void 0:g.value)&&!u.default)})))),{hasIcon:_}=function(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),i=e.computed((()=>(null==l?void 0:l.value)===n.before?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===n.after?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===a.left?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===a.right?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===a.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===a.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:s,hasIconTop:d,hasIconBottom:v,hasIconBefore:i,hasIconAfter:r}}(f),w=e.computed((()=>void 0!==i.value?i.value:B.value)),A=()=>{if(y.value){if(Array.isArray(b.value))return P(w.value,b.value)?void(S.value&&(b.value=b.value.filter((e=>e!==w.value)))):void b.value.push(w.value);if(w.value===b.value&&S.value)return void(b.value=i.uncheckedValue);b.value=w.value}};return(t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({disabled:e.unref(h),pressed:e.unref(V),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(k),ref_key:"element",ref:L,class:e.unref($),onClick:A}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(m,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",M,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(_)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0},e.unref(_),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("span",T,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(g)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}});function q(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const H={...$,...b,...h,..._,...V,...y,name:{type:String},id:{type:String},modelValue:{type:Object,required:!0},max:[Number,String],labelButton:{type:String,default:"Image"},loading:Boolean,accept:String,placeholder:String,multiple:Boolean,iconLeft:String,iconRight:String};const G=["for"],U=["onDragenter","onDragleave","onDrop","onClick"],J={class:"vv-input-file__preview"},K=["src","alt"],Q={class:"vv-input-file__wrapper"},W=["id","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","name"],X={class:"vv-input-file__list"},Y={class:"vv-input-file__item-name"},Z={class:"vv-input-file__item-info"},ee=["onClick"];return e.defineComponent({name:"VvInputFile",props:H,emits:["update:modelValue"],setup(l,{emit:o}){const a=l,n=e.useSlots(),i=function(t,l,o){const a=f(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputFile",H,a),{modifiers:r,id:u}=e.toRefs(a),s=F(u),d=e.computed((()=>`${s.value}-hint`)),v=p("vv-input-file",r,e.computed((()=>({dragging:V.value,loading:a.loading,valid:!0===a.valid,invalid:!0===a.invalid,"icon-before":!!a.iconLeft,"icon-after":!!a.iconRight})))),{HintSlot:c,hasHintLabelOrSlot:g,hasInvalidLabelOrSlot:b,hintSlotScope:h}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>q(o.value.invalidLabel))),n=e.computed((()=>q(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.value)))),s=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),d=e.computed((()=>!u.value&&!s.value&&Boolean(o.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!s.value&&!d.value&&Boolean(l.hint||r.value))),c=e.computed((()=>s.value||d.value||u.value||v.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:v,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(i,n),y=t.useVModel(a,"modelValue",o),S=e.computed((()=>{var e;return y.value&&(Array.isArray(y.value)||(null==(e=y.value)?void 0:e.name))?Array.isArray(y.value)?y.value:[y.value]:[]})),k=e.computed((()=>"string"==typeof a.max?parseInt(a.max):a.max)),B=e.computed((()=>{var e;return null==(e=null==r?void 0:r.value)?void 0:e.includes("drop-area")})),L=e.computed((()=>!!a.multiple&&(!k.value||k.value-S.value.length>1))),V=e.ref(!1),$=e.ref(),_=()=>{V.value=!0},w=()=>{V.value=!1},A=e=>{var t,l;(null==(t=e.dataTransfer)?void 0:t.files)&&(V.value=!1,x(null==(l=e.dataTransfer)?void 0:l.files))},O=()=>{var e;(null==(e=$.value)?void 0:e.files)&&(x($.value.files),$.value.value="")},x=e=>{if(!a.multiple)return Array.isArray(y.value)?void(y.value=[...e]):void(y.value=e[0]);let t=[];t=!Array.isArray(y.value)&&y.value?[y.value]:y.value&&Array.isArray(y.value)?[...y.value]:t;for(const l of e){if(k.value&&t.length>=k.value)break;t.push(l)}y.value=t},C=()=>{$.value&&$.value.click()},N=e.computed((()=>{if(0!==S.value.length)return S.value[0]instanceof File?URL.createObjectURL(S.value[0]):S.value[0].url}));e.onBeforeUnmount((()=>{N.value&&URL.revokeObjectURL(N.value)}));const j=e=>{if(e)return Math.floor(e/1024)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(v))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(s)},e.toDisplayString(t.label),9,G)):e.createCommentVNode("v-if",!0),B.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(_,["prevent","stop"]),onDragleave:e.withModifiers(w,["prevent","stop"]),onDrop:e.withModifiers(A,["prevent","stop"]),onDragover:l[0]||(l[0]=e.withModifiers((()=>{}),["prevent","stop"])),onClick:e.withModifiers(C,["stop"])},[e.renderSlot(t.$slots,"drop-area",{},(()=>[e.createVNode(z,{modifiers:"action","aria-label":"upload",label:N.value?void 0:t.labelButton,class:e.normalizeClass([{"absolute top-8 right-8":N.value},"z-1"]),icon:N.value?"edit":"image",onClick:e.withModifiers(C,["stop"])},null,8,["label","class","icon","onClick"]),e.createElementVNode("picture",J,[N.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:N.value,alt:S.value[0].name},null,8,K)):e.createCommentVNode("v-if",!0)])]))],40,U)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Q,[t.iconLeft?(e.openBlock(),e.createBlock(m,{key:0,name:t.iconLeft},null,8,["name"])):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{id:e.unref(s),ref_key:"inputEl",ref:$,placeholder:t.placeholder,"aria-describedby":e.unref(g)?d.value:void 0,"aria-invalid":t.invalid,"aria-errormessage":e.unref(b)?d.value:void 0,multiple:L.value,accept:t.accept,type:"file",name:t.name,onChange:O},null,40,W),t.iconRight?(e.openBlock(),e.createBlock(m,{key:1,name:t.iconRight},null,8,["name"])):e.createCommentVNode("v-if",!0)]),e.createElementVNode("ul",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,((t,l)=>(e.openBlock(),e.createElementBlock("li",{key:l,class:"vv-input-file__item"},[e.createVNode(m,{class:"vv-input-file__item-icon",name:"akar-icons:file"}),e.createElementVNode("div",Y,e.toDisplayString(t.name),1),e.createElementVNode("small",Z,e.toDisplayString(j(t.size))+" KB ",1),e.createElementVNode("button",{type:"button",class:"vv-input-file__item-remove",title:"Remove","aria-label":"remove-file",onClick:e.withModifiers((e=>(e=>{if(!Array.isArray(y.value))return void(y.value=void 0);const t=[...y.value];t.splice(e,1),y.value=t})(l)),["stop"])},null,8,ee)])))),128))]),e.createVNode(e.unref(c),{id:d.value,class:"vv-input-file__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(h))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
@@ -36,16 +36,34 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
36
36
|
type: StringConstructor;
|
|
37
37
|
default: string;
|
|
38
38
|
};
|
|
39
|
-
label:
|
|
39
|
+
label: {
|
|
40
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
40
43
|
hintLabel: {
|
|
41
44
|
type: StringConstructor;
|
|
42
45
|
default: string;
|
|
43
46
|
};
|
|
44
|
-
invalid:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
invalid: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: boolean;
|
|
50
|
+
};
|
|
51
|
+
invalidLabel: {
|
|
52
|
+
type: (ArrayConstructor | StringConstructor)[];
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
valid: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
default: boolean;
|
|
58
|
+
};
|
|
59
|
+
validLabel: {
|
|
60
|
+
type: (ArrayConstructor | StringConstructor)[];
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
modifiers: {
|
|
64
|
+
type: globalThis.PropType<string | string[]>;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
49
67
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
50
68
|
"update:modelValue": (args_0: File | undefined) => void;
|
|
51
69
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -86,25 +104,47 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
86
104
|
type: StringConstructor;
|
|
87
105
|
default: string;
|
|
88
106
|
};
|
|
89
|
-
label:
|
|
107
|
+
label: {
|
|
108
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
90
111
|
hintLabel: {
|
|
91
112
|
type: StringConstructor;
|
|
92
113
|
default: string;
|
|
93
114
|
};
|
|
94
|
-
invalid:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
115
|
+
invalid: {
|
|
116
|
+
type: BooleanConstructor;
|
|
117
|
+
default: boolean;
|
|
118
|
+
};
|
|
119
|
+
invalidLabel: {
|
|
120
|
+
type: (ArrayConstructor | StringConstructor)[];
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
valid: {
|
|
124
|
+
type: BooleanConstructor;
|
|
125
|
+
default: boolean;
|
|
126
|
+
};
|
|
127
|
+
validLabel: {
|
|
128
|
+
type: (ArrayConstructor | StringConstructor)[];
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
131
|
+
modifiers: {
|
|
132
|
+
type: globalThis.PropType<string | string[]>;
|
|
133
|
+
default: undefined;
|
|
134
|
+
};
|
|
99
135
|
}>> & {
|
|
100
136
|
"onUpdate:modelValue"?: ((args_0: File | undefined) => any) | undefined;
|
|
101
137
|
}, {
|
|
102
138
|
valid: boolean;
|
|
103
139
|
invalid: boolean;
|
|
104
140
|
multiple: boolean;
|
|
141
|
+
modifiers: string | string[];
|
|
142
|
+
label: string | number;
|
|
105
143
|
loading: boolean;
|
|
106
144
|
loadingLabel: string;
|
|
107
145
|
hintLabel: string;
|
|
146
|
+
invalidLabel: string | unknown[];
|
|
147
|
+
validLabel: string | unknown[];
|
|
108
148
|
labelButton: string;
|
|
109
149
|
}, {}>, {
|
|
110
150
|
"drop-area"?(_: {}): any;
|