@volverjs/ui-vue 0.0.1-beta.5 → 0.0.1-beta.8
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 +61 -2
- package/dist/components/VvButton/vv-button.es.js +56 -58
- package/dist/components/VvButton/vv-button.umd.js +1 -1
- package/dist/components/VvCheckGroup/vv-check-group.es.js +221 -203
- package/dist/components/VvCheckGroup/vv-check-group.umd.js +2 -2
- package/dist/components/VvInputText/VvInputText.d.ts +14 -0
- package/dist/components/VvInputText/VvInputText.vue.d.ts +36 -1
- package/dist/components/VvInputText/VvInputTextActions.d.ts +3 -0
- package/dist/components/VvInputText/vv-input-text.es.js +509 -380
- package/dist/components/VvInputText/vv-input-text.umd.js +2 -2
- package/dist/components/VvNativeSelect/vv-native-select.es.js +180 -161
- package/dist/components/VvNativeSelect/vv-native-select.umd.js +2 -2
- package/dist/components/VvRadioGroup/vv-radio-group.es.js +211 -193
- package/dist/components/VvRadioGroup/vv-radio-group.umd.js +2 -2
- package/dist/components/VvSelect/vv-select.es.js +189 -171
- package/dist/components/VvSelect/vv-select.umd.js +2 -2
- package/dist/components/VvTextarea/VvTextarea.d.ts +43 -22
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +140 -85
- package/dist/components/VvTextarea/vv-textarea.es.js +364 -288
- package/dist/components/VvTextarea/vv-textarea.umd.js +2 -2
- package/dist/composables/debouncedInput/useDebouncedInput.d.ts +2 -0
- package/dist/composables/icons/useComponentIcons.d.ts +6 -0
- package/dist/composables/textLimit/useTextLimit.d.ts +14 -0
- package/dist/composables/useModifiers.d.ts +3 -2
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +42 -0
- package/dist/stories/utils.d.ts +5 -0
- package/dist/ui-vue.es.js +417 -401
- package/dist/ui-vue.umd.js +2 -2
- package/package.json +3 -1
- 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/VvButton/VvButton.vue +1 -2
- package/src/components/VvInputText/VvInputText.ts +19 -2
- package/src/components/VvInputText/VvInputText.vue +123 -149
- package/src/components/VvInputText/VvInputTextActions.ts +151 -0
- package/src/components/VvTextarea/VvTextarea.ts +25 -16
- package/src/components/VvTextarea/VvTextarea.vue +89 -93
- package/src/components/common/HintSlot.ts +31 -13
- package/src/composables/debouncedInput/useDebouncedInput.ts +19 -0
- package/src/composables/icons/useComponentIcons.ts +35 -0
- package/src/composables/textLimit/useTextLimit.ts +44 -0
- package/src/composables/useModifiers.ts +47 -1
- package/src/props/index.ts +39 -0
- package/src/stories/InputText/InputTextMaxLength.stories.mdx +21 -0
- package/src/stories/Textarea/Textarea.stories.mdx +33 -51
- package/src/stories/Textarea/TextareaAutoclear.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaAutocomplete.stories.mdx +10 -2
- package/src/stories/Textarea/TextareaAutofocus.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaDebounce.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaDisabled.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaError.stories.mdx +6 -3
- package/src/stories/Textarea/TextareaErrorLabel.stories.mdx +37 -0
- package/src/stories/Textarea/TextareaFloating.stories.mdx +7 -2
- package/src/stories/Textarea/TextareaHintLabel.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaIcon.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaIconPosition.stories.mdx +9 -1
- package/src/stories/Textarea/TextareaId.stories.mdx +19 -0
- package/src/stories/Textarea/TextareaLabel.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaLimit.stories.mdx +50 -0
- package/src/stories/Textarea/TextareaLoading.stories.mdx +6 -3
- package/src/stories/Textarea/TextareaLoadingLabel.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaMaxLength.stories.mdx +6 -2
- package/src/stories/Textarea/TextareaMinLength.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaModifiers.stories.mdx +24 -0
- package/src/stories/Textarea/TextareaName.stories.mdx +23 -0
- package/src/stories/Textarea/TextareaPlaceholder.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaReadonly.stories.mdx +5 -1
- package/src/stories/Textarea/TextareaRequired.stories.mdx +22 -0
- package/src/stories/Textarea/TextareaResizable.stories.mdx +22 -0
- package/src/stories/Textarea/TextareaRowsCols.stories.mdx +9 -1
- package/src/stories/Textarea/TextareaValid.stories.mdx +7 -4
- package/src/stories/Textarea/TextareaValidLabel.stories.mdx +35 -0
- package/src/stories/stories.scss +11 -0
- package/src/stories/utils.ts +12 -0
- package/src/stories/volver-ui-vue.stories.mdx +7 -1
- package/dist/components/VvInputText/useInputNumber.d.ts +0 -16
- package/dist/components/VvInputText/useInputPassword.d.ts +0 -16
- package/src/components/VvInputText/useInputNumber.ts +0 -40
- package/src/components/VvInputText/useInputPassword.ts +0 -38
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { iconExists as
|
|
3
|
-
import { useFocus as
|
|
4
|
-
const
|
|
5
|
-
equals(e,
|
|
6
|
-
return
|
|
1
|
+
import { computed as m, unref as l, defineComponent as z, ref as F, toRefs as L, inject as ee, openBlock as $, createBlock as te, mergeProps as w, createCommentVNode as _, h as re, watch as Z, useSlots as ne, useAttrs as oe, onMounted as se, createElementBlock as E, toDisplayString as q, createElementVNode as V, renderSlot as D, normalizeProps as R, createVNode as P, withDirectives as ie, isRef as ae, vModelText as le, createTextVNode as ue } from "vue";
|
|
2
|
+
import { iconExists as O, Icon as ce, addIcon as fe } from "@iconify/vue";
|
|
3
|
+
import { toReactive as de, useFocus as me, refDebounced as pe, isString as M } from "@vueuse/core";
|
|
4
|
+
const y = {
|
|
5
|
+
equals(e, r, t) {
|
|
6
|
+
return t ? this.resolveFieldData(e, t) === this.resolveFieldData(r, t) : this.deepEquals(e, r);
|
|
7
7
|
},
|
|
8
|
-
deepEquals(e,
|
|
9
|
-
if (e ===
|
|
8
|
+
deepEquals(e, r) {
|
|
9
|
+
if (e === r)
|
|
10
10
|
return !0;
|
|
11
|
-
if (e &&
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
11
|
+
if (e && r && typeof e == "object" && typeof r == "object") {
|
|
12
|
+
const t = Array.isArray(e), o = Array.isArray(r);
|
|
13
|
+
let n, s, i;
|
|
14
|
+
if (t && o) {
|
|
15
|
+
if (s = e.length, s != r.length)
|
|
16
16
|
return !1;
|
|
17
|
-
for (
|
|
18
|
-
if (!this.deepEquals(e[
|
|
17
|
+
for (n = s; n-- !== 0; )
|
|
18
|
+
if (!this.deepEquals(e[n], r[n]))
|
|
19
19
|
return !1;
|
|
20
20
|
return !0;
|
|
21
21
|
}
|
|
22
|
-
if (
|
|
22
|
+
if (t != o)
|
|
23
23
|
return !1;
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
24
|
+
const d = e instanceof Date, a = r instanceof Date;
|
|
25
|
+
if (d != a)
|
|
26
26
|
return !1;
|
|
27
|
-
if (
|
|
28
|
-
return e.getTime() ==
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
27
|
+
if (d && a)
|
|
28
|
+
return e.getTime() == r.getTime();
|
|
29
|
+
const h = e instanceof RegExp, u = r instanceof RegExp;
|
|
30
|
+
if (h != u)
|
|
31
31
|
return !1;
|
|
32
|
-
if (
|
|
33
|
-
return e.toString() ==
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
32
|
+
if (h && u)
|
|
33
|
+
return e.toString() == r.toString();
|
|
34
|
+
const c = Object.keys(e);
|
|
35
|
+
if (s = c.length, s !== Object.keys(r).length)
|
|
36
36
|
return !1;
|
|
37
|
-
for (
|
|
38
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
37
|
+
for (n = s; n-- !== 0; )
|
|
38
|
+
if (!Object.prototype.hasOwnProperty.call(r, c[n]))
|
|
39
39
|
return !1;
|
|
40
|
-
for (
|
|
41
|
-
if (
|
|
40
|
+
for (n = s; n-- !== 0; )
|
|
41
|
+
if (i = c[n], !this.deepEquals(e[i], r[i]))
|
|
42
42
|
return !1;
|
|
43
43
|
return !0;
|
|
44
44
|
}
|
|
45
|
-
return e !== e &&
|
|
45
|
+
return e !== e && r !== r;
|
|
46
46
|
},
|
|
47
|
-
resolveFieldData(e,
|
|
48
|
-
if (e && Object.keys(e).length &&
|
|
49
|
-
if (
|
|
50
|
-
return e[
|
|
47
|
+
resolveFieldData(e, r) {
|
|
48
|
+
if (e && Object.keys(e).length && r) {
|
|
49
|
+
if (r.indexOf(".") === -1)
|
|
50
|
+
return e[r];
|
|
51
51
|
{
|
|
52
|
-
const
|
|
52
|
+
const t = r.split(".");
|
|
53
53
|
let o = e;
|
|
54
|
-
for (let
|
|
54
|
+
for (let n = 0, s = t.length; n < s; ++n) {
|
|
55
55
|
if (e == null)
|
|
56
56
|
return null;
|
|
57
|
-
o = o[n
|
|
57
|
+
o = o[t[n]];
|
|
58
58
|
}
|
|
59
59
|
return o;
|
|
60
60
|
}
|
|
@@ -64,21 +64,21 @@ const A = {
|
|
|
64
64
|
isFunction(e) {
|
|
65
65
|
return !!(e && e.constructor && e.call && e.apply);
|
|
66
66
|
},
|
|
67
|
-
findIndexInList(e,
|
|
68
|
-
let
|
|
69
|
-
if (
|
|
70
|
-
for (let o = 0; o <
|
|
71
|
-
if (this.equals(
|
|
72
|
-
|
|
67
|
+
findIndexInList(e, r) {
|
|
68
|
+
let t = -1;
|
|
69
|
+
if (r) {
|
|
70
|
+
for (let o = 0; o < r.length; o++)
|
|
71
|
+
if (this.equals(r[o], e)) {
|
|
72
|
+
t = o;
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
return
|
|
76
|
+
return t;
|
|
77
77
|
},
|
|
78
|
-
contains(e,
|
|
79
|
-
if (e != null &&
|
|
80
|
-
for (const
|
|
81
|
-
if (this.equals(e,
|
|
78
|
+
contains(e, r) {
|
|
79
|
+
if (e != null && r && r.length) {
|
|
80
|
+
for (const t of r)
|
|
81
|
+
if (this.equals(e, t))
|
|
82
82
|
return !0;
|
|
83
83
|
}
|
|
84
84
|
return !1;
|
|
@@ -89,66 +89,57 @@ const A = {
|
|
|
89
89
|
isNotEmpty(e) {
|
|
90
90
|
return !this.isEmpty(e);
|
|
91
91
|
},
|
|
92
|
-
pickBy(e,
|
|
92
|
+
pickBy(e, r) {
|
|
93
93
|
return Object.fromEntries(
|
|
94
|
-
Object.entries(e).filter(([
|
|
94
|
+
Object.entries(e).filter(([t]) => r(t))
|
|
95
95
|
);
|
|
96
96
|
},
|
|
97
|
-
removeFromList(e,
|
|
98
|
-
const
|
|
99
|
-
return
|
|
97
|
+
removeFromList(e, r) {
|
|
98
|
+
const t = this.findIndexInList(e, r);
|
|
99
|
+
return t > -1 ? r.filter((o, n) => n !== t) : r;
|
|
100
100
|
},
|
|
101
101
|
isString(e) {
|
|
102
102
|
return typeof e == "string" || e instanceof String;
|
|
103
103
|
},
|
|
104
104
|
propsToObject(e) {
|
|
105
|
-
return Object.keys(e).reduce((
|
|
106
|
-
var o,
|
|
107
|
-
return this.isFunction(e[
|
|
105
|
+
return Object.keys(e).reduce((r, t) => {
|
|
106
|
+
var o, n, s, i, d;
|
|
107
|
+
return this.isFunction(e[t]) ? r[t] = e[t]() : Array.isArray(e[t]) ? r[t] = e[t][0]() : (o = e[t]) != null && o.type && (Array.isArray(e[t].type) ? r[t] = ((n = e[t]) == null ? void 0 : n.default) || ((s = e[t]) == null ? void 0 : s.type[0]()) : r[t] = ((i = e[t]) == null ? void 0 : i.default) || ((d = e[t]) == null ? void 0 : d.type())), r;
|
|
108
108
|
}, {});
|
|
109
109
|
},
|
|
110
|
-
filterArray(e,
|
|
111
|
-
return e.filter((o) =>
|
|
112
|
-
o[
|
|
113
|
-
|
|
110
|
+
filterArray(e, r, t) {
|
|
111
|
+
return e.filter((o) => r.some((n) => typeof n == "string" ? o[t] == n : this.equals(
|
|
112
|
+
o[t],
|
|
113
|
+
n[t]
|
|
114
114
|
)));
|
|
115
115
|
},
|
|
116
116
|
kebabCase(e) {
|
|
117
|
-
var
|
|
117
|
+
var r, t;
|
|
118
118
|
if (e)
|
|
119
|
-
return (
|
|
119
|
+
return (t = (r = e.match(
|
|
120
120
|
/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
|
|
121
|
-
)) == null ? void 0 :
|
|
121
|
+
)) == null ? void 0 : r.join("-")) == null ? void 0 : t.toLowerCase();
|
|
122
122
|
}
|
|
123
|
-
},
|
|
123
|
+
}, ge = {
|
|
124
124
|
valid: Boolean,
|
|
125
125
|
validLabel: [String, Array]
|
|
126
|
-
},
|
|
126
|
+
}, he = {
|
|
127
127
|
error: Boolean,
|
|
128
128
|
errorLabel: [String, Array]
|
|
129
|
-
},
|
|
129
|
+
}, ye = {
|
|
130
130
|
loading: Boolean,
|
|
131
131
|
loadingLabel: String
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
readonly: Boolean
|
|
136
|
-
}, _e = {
|
|
132
|
+
}, ve = {
|
|
133
|
+
modifiers: [String, Array]
|
|
134
|
+
}, be = {
|
|
137
135
|
hintLabel: { type: String, default: "" }
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
},
|
|
145
|
-
...Ae,
|
|
146
|
-
...xe,
|
|
147
|
-
..._e,
|
|
148
|
-
...Ce,
|
|
149
|
-
...Ie,
|
|
150
|
-
...Pe,
|
|
151
|
-
modelValue: null,
|
|
136
|
+
}, xe = {
|
|
137
|
+
limit: {
|
|
138
|
+
type: [Boolean, String],
|
|
139
|
+
default: !1,
|
|
140
|
+
validator: (e) => [!0, !1, "countdown"].includes(e)
|
|
141
|
+
}
|
|
142
|
+
}, Se = {
|
|
152
143
|
id: String,
|
|
153
144
|
name: { type: String, required: !0 },
|
|
154
145
|
autocomplete: { type: String, default: "off" },
|
|
@@ -157,18 +148,40 @@ const A = {
|
|
|
157
148
|
maxlength: Number,
|
|
158
149
|
label: String,
|
|
159
150
|
placeholder: String,
|
|
151
|
+
required: Boolean,
|
|
152
|
+
disabled: Boolean,
|
|
153
|
+
readonly: Boolean
|
|
154
|
+
}, Ae = {
|
|
155
|
+
debounce: Number
|
|
156
|
+
}, H = {
|
|
157
|
+
LEFT: "left",
|
|
158
|
+
RIGHT: "right"
|
|
159
|
+
}, _e = {
|
|
160
|
+
hard: "hard",
|
|
161
|
+
soft: "soft"
|
|
162
|
+
}, Be = ["update:modelValue", "focus", "blur"], $e = {
|
|
163
|
+
...ge,
|
|
164
|
+
...he,
|
|
165
|
+
...be,
|
|
166
|
+
...ye,
|
|
167
|
+
...ve,
|
|
168
|
+
...xe,
|
|
169
|
+
...Se,
|
|
170
|
+
...Ae,
|
|
171
|
+
modelValue: null,
|
|
172
|
+
cols: { type: Number, default: 50 },
|
|
173
|
+
rows: { type: Number, default: 5 },
|
|
160
174
|
icon: { type: String, default: "" },
|
|
161
175
|
iconPosition: {
|
|
162
176
|
type: String,
|
|
163
|
-
validation: (e) => Object.values(
|
|
164
|
-
default:
|
|
177
|
+
validation: (e) => Object.values(H).includes(e),
|
|
178
|
+
default: H.RIGHT
|
|
165
179
|
},
|
|
166
180
|
floating: Boolean,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}, be = {
|
|
181
|
+
wrap: { type: String, default: _e.soft },
|
|
182
|
+
autoclear: Boolean,
|
|
183
|
+
resizable: Boolean
|
|
184
|
+
}, we = {
|
|
172
185
|
color: String,
|
|
173
186
|
width: {
|
|
174
187
|
type: [String, Number]
|
|
@@ -200,22 +213,22 @@ const A = {
|
|
|
200
213
|
type: [String, Array]
|
|
201
214
|
}
|
|
202
215
|
};
|
|
203
|
-
function
|
|
204
|
-
const
|
|
216
|
+
function Ce(e, r) {
|
|
217
|
+
const t = { [`${e}`]: !0 };
|
|
205
218
|
return {
|
|
206
|
-
bemCssClasses:
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
209
|
-
return
|
|
210
|
-
if (
|
|
211
|
-
const
|
|
219
|
+
bemCssClasses: m(() => Object.keys(r).reduce((n, s) => {
|
|
220
|
+
const i = l(r[s]) || !1;
|
|
221
|
+
if (!i)
|
|
222
|
+
return n;
|
|
223
|
+
if (s === "modifiers") {
|
|
224
|
+
const d = Array.isArray(i) ? i : [i];
|
|
212
225
|
return {
|
|
213
|
-
...
|
|
214
|
-
...
|
|
215
|
-
(
|
|
216
|
-
...
|
|
217
|
-
[`${e}--${
|
|
218
|
-
|
|
226
|
+
...n,
|
|
227
|
+
...d.reduce(
|
|
228
|
+
(a, h) => ({
|
|
229
|
+
...a,
|
|
230
|
+
[`${e}--${y.kebabCase(
|
|
231
|
+
h
|
|
219
232
|
)}`]: !0
|
|
220
233
|
}),
|
|
221
234
|
{}
|
|
@@ -223,247 +236,310 @@ function U(e, t) {
|
|
|
223
236
|
};
|
|
224
237
|
} else
|
|
225
238
|
return {
|
|
226
|
-
...
|
|
227
|
-
[`${e}--${
|
|
239
|
+
...n,
|
|
240
|
+
[`${e}--${y.kebabCase(s)}`]: i
|
|
228
241
|
};
|
|
229
|
-
},
|
|
242
|
+
}, t) || {})
|
|
230
243
|
};
|
|
231
244
|
}
|
|
232
|
-
|
|
245
|
+
function Ie(e, r) {
|
|
246
|
+
const t = { [`${e}`]: !0 };
|
|
247
|
+
return Object.keys(r).reduce((o, n) => {
|
|
248
|
+
const s = l(r[n]) || !1;
|
|
249
|
+
if (!s)
|
|
250
|
+
return o;
|
|
251
|
+
if (n === "modifiers") {
|
|
252
|
+
const i = Array.isArray(s) ? s : [s];
|
|
253
|
+
return {
|
|
254
|
+
...o,
|
|
255
|
+
...i.reduce(
|
|
256
|
+
(d, a) => ({
|
|
257
|
+
...d,
|
|
258
|
+
[`${e}--${y.kebabCase(
|
|
259
|
+
a
|
|
260
|
+
)}`]: !0
|
|
261
|
+
}),
|
|
262
|
+
{}
|
|
263
|
+
)
|
|
264
|
+
};
|
|
265
|
+
} else
|
|
266
|
+
return {
|
|
267
|
+
...o,
|
|
268
|
+
[`${e}--${y.kebabCase(n)}`]: s
|
|
269
|
+
};
|
|
270
|
+
}, t) || {};
|
|
271
|
+
}
|
|
272
|
+
const N = /* @__PURE__ */ z({
|
|
233
273
|
__name: "VvIcon",
|
|
234
|
-
props:
|
|
274
|
+
props: we,
|
|
235
275
|
setup(e) {
|
|
236
|
-
const
|
|
276
|
+
const r = e, t = F(!0), { modifiers: o } = L(r), n = ee("ds"), { bemCssClasses: s } = Ce("vv-icon", {
|
|
237
277
|
modifiers: o
|
|
238
|
-
}),
|
|
239
|
-
const
|
|
240
|
-
return
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
244
|
-
})) ||
|
|
278
|
+
}), i = m(() => r.provider || (n == null ? void 0 : n.provider)), d = m(() => {
|
|
279
|
+
const u = r.name || "", c = `@${i.value}:${r.prefix}:${r.name}`;
|
|
280
|
+
return O(u) ? u : O(c) ? c : (n == null ? void 0 : n.iconsCollections.find((p) => {
|
|
281
|
+
const f = `@${i.value}:${p.prefix}:${u}`;
|
|
282
|
+
if (O(f))
|
|
283
|
+
return f;
|
|
284
|
+
})) || u;
|
|
245
285
|
});
|
|
246
|
-
function
|
|
247
|
-
let
|
|
286
|
+
function a(u) {
|
|
287
|
+
let c = null;
|
|
248
288
|
if (typeof window > "u") {
|
|
249
|
-
const { JSDOM:
|
|
250
|
-
|
|
289
|
+
const { JSDOM: v } = require("jsdom");
|
|
290
|
+
c = new v().window;
|
|
251
291
|
}
|
|
252
|
-
return (
|
|
292
|
+
return (c ? new c.DOMParser() : new window.DOMParser()).parseFromString(u, "text/html").querySelector("svg");
|
|
253
293
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
body:
|
|
258
|
-
height:
|
|
259
|
-
width:
|
|
294
|
+
function h(u) {
|
|
295
|
+
const c = a(u), p = (c == null ? void 0 : c.innerHTML.trim()) || "";
|
|
296
|
+
c && p && fe(`@${i.value}:${r.prefix}:${r.name}`, {
|
|
297
|
+
body: p,
|
|
298
|
+
height: c.viewBox.baseVal.height,
|
|
299
|
+
width: c.viewBox.baseVal.width
|
|
260
300
|
});
|
|
261
301
|
}
|
|
262
|
-
return
|
|
263
|
-
|
|
264
|
-
}).catch((
|
|
265
|
-
throw new Error(`During fetch icon: ${
|
|
266
|
-
})) :
|
|
302
|
+
return n && (r.src ? (t.value = !1, n.fetchIcon(r.src).then((u) => {
|
|
303
|
+
u && (h(u), t.value = !0);
|
|
304
|
+
}).catch((u) => {
|
|
305
|
+
throw new Error(`During fetch icon: ${u == null ? void 0 : u.message}`);
|
|
306
|
+
})) : r.svg && h(r.svg)), (u, c) => t.value ? ($(), te(l(ce), w({
|
|
267
307
|
key: 0,
|
|
268
|
-
class:
|
|
308
|
+
class: l(s)
|
|
269
309
|
}, {
|
|
270
|
-
...
|
|
271
|
-
provider:
|
|
272
|
-
icon:
|
|
310
|
+
...u.$props,
|
|
311
|
+
provider: l(i),
|
|
312
|
+
icon: l(d)
|
|
273
313
|
}), null, 16, ["class"])) : _("", !0);
|
|
274
314
|
}
|
|
275
315
|
});
|
|
276
|
-
function
|
|
277
|
-
return Array.isArray(e) ? e.filter((
|
|
278
|
-
` +
|
|
316
|
+
function k(e) {
|
|
317
|
+
return Array.isArray(e) ? e.filter((r) => y.isString(r)).reduce((r, t) => r.length > 0 ? r + `
|
|
318
|
+
` + t : t, "") : e;
|
|
279
319
|
}
|
|
280
|
-
function
|
|
320
|
+
function Ee(e, r) {
|
|
281
321
|
return {
|
|
282
322
|
name: "HintSlot",
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
323
|
+
props: {
|
|
324
|
+
params: { type: Object, default: () => {
|
|
325
|
+
} }
|
|
326
|
+
},
|
|
327
|
+
setup(t) {
|
|
328
|
+
const o = L(e), {
|
|
329
|
+
error: n,
|
|
330
|
+
valid: s,
|
|
287
331
|
hint: i,
|
|
288
|
-
loading:
|
|
289
|
-
} =
|
|
290
|
-
hintLabel:
|
|
332
|
+
loading: d
|
|
333
|
+
} = r, {
|
|
334
|
+
hintLabel: a,
|
|
291
335
|
modelValue: h,
|
|
292
|
-
valid:
|
|
293
|
-
validLabel:
|
|
294
|
-
error:
|
|
295
|
-
errorLabel:
|
|
296
|
-
} =
|
|
297
|
-
|
|
336
|
+
valid: u,
|
|
337
|
+
validLabel: c,
|
|
338
|
+
error: p,
|
|
339
|
+
errorLabel: f
|
|
340
|
+
} = o, g = y.resolveFieldData(o, "loading"), v = y.resolveFieldData(
|
|
341
|
+
o,
|
|
298
342
|
"loadingLabel"
|
|
299
|
-
),
|
|
300
|
-
const
|
|
301
|
-
|
|
343
|
+
), S = m(() => p.value ? !!(p.value && n || (f == null ? void 0 : f.value) && Array.isArray(f.value) && f.value.length > 0 || (f == null ? void 0 : f.value) && y.isNotEmpty(f.value)) : !1), C = m(() => !!(a && a.value || i || s || c && c.value || S.value || (g == null ? void 0 : g.value) && d || (g == null ? void 0 : g.value) && (v == null ? void 0 : v.value))), I = m(() => {
|
|
344
|
+
const A = de({
|
|
345
|
+
hintLabel: a,
|
|
346
|
+
modelValue: h,
|
|
347
|
+
valid: u,
|
|
348
|
+
validLabel: c,
|
|
349
|
+
error: p,
|
|
350
|
+
errorLabel: f,
|
|
351
|
+
loading: g,
|
|
352
|
+
loadingLabel: v,
|
|
353
|
+
...t.params
|
|
354
|
+
});
|
|
355
|
+
return p != null && p.value ? (n == null ? void 0 : n(A)) || k(f == null ? void 0 : f.value) || (a == null ? void 0 : a.value) : u != null && u.value ? (s == null ? void 0 : s(A)) || k(c == null ? void 0 : c.value) || (a == null ? void 0 : a.value) : g != null && g.value ? (d == null ? void 0 : d(A)) || k(v == null ? void 0 : v.value) || (a == null ? void 0 : a.value) : (i == null ? void 0 : i(A)) || k(a == null ? void 0 : a.value) || (a == null ? void 0 : a.value);
|
|
302
356
|
});
|
|
303
357
|
return {
|
|
304
|
-
hasHint:
|
|
305
|
-
hintContent:
|
|
358
|
+
hasHint: C,
|
|
359
|
+
hintContent: I
|
|
306
360
|
};
|
|
307
361
|
},
|
|
308
362
|
render() {
|
|
309
363
|
if (this.hasHint)
|
|
310
|
-
return
|
|
364
|
+
return re(
|
|
365
|
+
"pre",
|
|
366
|
+
{ style: { "white-space": "pre" } },
|
|
367
|
+
this.hintContent
|
|
368
|
+
);
|
|
311
369
|
}
|
|
312
370
|
};
|
|
313
371
|
}
|
|
314
|
-
function
|
|
315
|
-
const
|
|
316
|
-
() => !!(
|
|
317
|
-
),
|
|
318
|
-
() => !!(
|
|
319
|
-
),
|
|
320
|
-
() => !!(
|
|
321
|
-
),
|
|
322
|
-
() => !!(
|
|
372
|
+
function Pe(e, r, t) {
|
|
373
|
+
const o = m(
|
|
374
|
+
() => !!(e.value && r.value === "left" || t.iconLeft)
|
|
375
|
+
), n = m(
|
|
376
|
+
() => !!(e.value && r.value === "right" || t.iconRight)
|
|
377
|
+
), s = m(
|
|
378
|
+
() => !!(e.value && r.value === "top" || t.iconTop)
|
|
379
|
+
), i = m(
|
|
380
|
+
() => !!(e.value && r.value === "bottom" || t.iconBottom)
|
|
323
381
|
);
|
|
324
382
|
return {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
hasIconTop: a,
|
|
330
|
-
hasIconBottom: s
|
|
383
|
+
hasIconLeft: o,
|
|
384
|
+
hasIconRight: n,
|
|
385
|
+
hasIconTop: s,
|
|
386
|
+
hasIconBottom: i
|
|
331
387
|
};
|
|
332
388
|
}
|
|
333
|
-
function ke(e,
|
|
334
|
-
const { focused:
|
|
335
|
-
return
|
|
336
|
-
|
|
389
|
+
function ke(e, r) {
|
|
390
|
+
const { focused: t } = me(e);
|
|
391
|
+
return Z(t, (o) => {
|
|
392
|
+
r(o ? "focus" : "blur", e.value);
|
|
337
393
|
}), {
|
|
338
|
-
focused:
|
|
394
|
+
focused: t
|
|
339
395
|
};
|
|
340
396
|
}
|
|
341
|
-
|
|
397
|
+
function De(e, r, t) {
|
|
398
|
+
const o = F(e == null ? void 0 : e.value), n = pe(
|
|
399
|
+
o,
|
|
400
|
+
r || 0
|
|
401
|
+
);
|
|
402
|
+
return Z(n, (s) => t("update:modelValue", s)), o;
|
|
403
|
+
}
|
|
404
|
+
function Oe(e, r) {
|
|
405
|
+
const t = m(() => {
|
|
406
|
+
const s = l(e);
|
|
407
|
+
return M(s) ? s.length : 0;
|
|
408
|
+
}), o = m(() => {
|
|
409
|
+
const s = l(e) || "";
|
|
410
|
+
return !M(s) || r.mode === !1 ? 0 : r.mode === !0 ? s.length : l(r.upperLimit) - s.length;
|
|
411
|
+
}), n = m(() => r.mode === !1 ? "" : r.mode === !0 && r.upperLimit && r.upperLimit > 0 ? `${o.value}/${l(r.upperLimit)}` : o.value);
|
|
412
|
+
return {
|
|
413
|
+
textLength: t,
|
|
414
|
+
textLimitLength: o,
|
|
415
|
+
formattedTextLimitLength: n
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
const Ne = ["for"], Fe = { class: "vv-textarea__wrapper" }, Le = {
|
|
419
|
+
key: 3,
|
|
420
|
+
class: "vv-textarea__limit"
|
|
421
|
+
}, je = {
|
|
342
422
|
inheritAttrs: !1
|
|
343
|
-
}, Re = /* @__PURE__ */
|
|
344
|
-
...
|
|
423
|
+
}, Re = /* @__PURE__ */ z({
|
|
424
|
+
...je,
|
|
345
425
|
__name: "VvTextarea",
|
|
346
|
-
props:
|
|
347
|
-
emits:
|
|
348
|
-
setup(e, { emit:
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
iconPosition: g,
|
|
353
|
-
valid: l,
|
|
354
|
-
error: u,
|
|
355
|
-
loading: c,
|
|
356
|
-
floating: p,
|
|
357
|
-
label: v,
|
|
358
|
-
modelValue: C
|
|
359
|
-
} = $(n), w = Se(a, n.debounce || 0);
|
|
360
|
-
G(w, (m) => t("update:modelValue", m));
|
|
361
|
-
const I = { icon: h, iconPosition: g }, E = {
|
|
426
|
+
props: $e,
|
|
427
|
+
emits: Be,
|
|
428
|
+
setup(e, { emit: r }) {
|
|
429
|
+
const t = e, o = ne(), n = oe(), s = F(), { icon: i, iconPosition: d, label: a, modelValue: h, autoclear: u, limit: c } = L(t), p = t.id || t.name, f = `${t.name}-label`, g = `${t.name}-hint`, v = m(
|
|
430
|
+
() => t.floating && y.isEmpty(t.placeholder) ? " " : t.placeholder
|
|
431
|
+
), S = De(h, t.debounce, r), { hasIconLeft: C, hasIconRight: I } = Pe(i, d, {
|
|
362
432
|
iconLeft: o["icon-left"],
|
|
363
433
|
iconRight: o["icon-right"]
|
|
364
|
-
}, {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
(
|
|
434
|
+
}), { focused: A } = ke(s, r), { textLength: j, formattedTextLimitLength: W } = Oe(S, {
|
|
435
|
+
mode: t.limit,
|
|
436
|
+
upperLimit: t.maxlength || 0
|
|
437
|
+
}), G = m(() => [
|
|
438
|
+
Ie("vv-textarea", {
|
|
439
|
+
modifiers: t.modifiers,
|
|
440
|
+
readonly: t.readonly,
|
|
441
|
+
valid: t.valid,
|
|
442
|
+
invalid: t.error,
|
|
443
|
+
loading: t.loading,
|
|
444
|
+
iconLeft: C,
|
|
445
|
+
iconRight: I,
|
|
446
|
+
floating: t.floating && y.isNotEmpty(t.label),
|
|
447
|
+
dirty: y.isNotEmpty(h == null ? void 0 : h.value),
|
|
448
|
+
resizable: t.resizable
|
|
449
|
+
}),
|
|
450
|
+
n.class
|
|
451
|
+
]), U = m(() => {
|
|
452
|
+
const x = y.pickBy(
|
|
453
|
+
n,
|
|
454
|
+
(b) => b.startsWith("data-")
|
|
385
455
|
);
|
|
386
456
|
return {
|
|
387
|
-
style:
|
|
388
|
-
...
|
|
389
|
-
};
|
|
390
|
-
}), N = d(() => {
|
|
391
|
-
const {
|
|
392
|
-
id: m,
|
|
393
|
-
name: y,
|
|
394
|
-
autocomplete: S,
|
|
395
|
-
minlength: Y,
|
|
396
|
-
maxlength: L,
|
|
397
|
-
disabled: ee,
|
|
398
|
-
readonly: te,
|
|
399
|
-
floating: ne,
|
|
400
|
-
placeholder: j,
|
|
401
|
-
cols: re,
|
|
402
|
-
rows: oe
|
|
403
|
-
} = n, se = m || y, ie = ne && A.isEmpty(j) ? " " : j;
|
|
404
|
-
return {
|
|
405
|
-
id: se,
|
|
406
|
-
placeholder: ie,
|
|
407
|
-
name: y,
|
|
408
|
-
autocomplete: S,
|
|
409
|
-
disabled: ee,
|
|
410
|
-
readonly: te,
|
|
411
|
-
minlength: Y,
|
|
412
|
-
maxlength: L,
|
|
413
|
-
cols: re,
|
|
414
|
-
rows: oe,
|
|
415
|
-
...T.value
|
|
457
|
+
style: n.style,
|
|
458
|
+
...x
|
|
416
459
|
};
|
|
417
|
-
}),
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
(
|
|
460
|
+
}), J = m(() => {
|
|
461
|
+
const x = y.pickBy(
|
|
462
|
+
n,
|
|
463
|
+
(b) => b.startsWith("aria-")
|
|
421
464
|
);
|
|
422
465
|
return {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
466
|
+
id: p,
|
|
467
|
+
placeholder: v.value,
|
|
468
|
+
name: t.name,
|
|
469
|
+
autocomplete: t.autocomplete,
|
|
470
|
+
disabled: t.disabled,
|
|
471
|
+
readonly: t.readonly,
|
|
472
|
+
minlength: t.minlength,
|
|
473
|
+
maxlength: t.maxlength,
|
|
474
|
+
cols: t.cols,
|
|
475
|
+
rows: t.rows,
|
|
476
|
+
required: t.required,
|
|
477
|
+
tabindex: n.tabindex,
|
|
478
|
+
"aria-invalid": t.error,
|
|
479
|
+
"aria-valid": !t.valid,
|
|
480
|
+
"aria-labeledby": f,
|
|
481
|
+
"aria-describedby": g,
|
|
482
|
+
"aria-errormessage": g,
|
|
483
|
+
...x
|
|
427
484
|
};
|
|
428
|
-
}),
|
|
429
|
-
const { modelValue:
|
|
485
|
+
}), T = m(() => {
|
|
486
|
+
const { modelValue: x, valid: b, error: B, maxlength: X, hintLabel: Y } = t;
|
|
430
487
|
return {
|
|
431
|
-
valid:
|
|
432
|
-
error:
|
|
433
|
-
modelValue:
|
|
488
|
+
valid: b,
|
|
489
|
+
error: B,
|
|
490
|
+
modelValue: x,
|
|
491
|
+
hintLabel: Y,
|
|
492
|
+
maxlength: X,
|
|
493
|
+
textLength: j
|
|
434
494
|
};
|
|
435
|
-
}),
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
|
|
495
|
+
}), K = Ee(t, o);
|
|
496
|
+
function Q() {
|
|
497
|
+
S.value = "";
|
|
498
|
+
}
|
|
499
|
+
return se(() => {
|
|
500
|
+
t.autofocus && (A.value = !0), console.log("Focused", A.value);
|
|
501
|
+
}), (x, b) => ($(), E("div", w(l(U), { class: l(G) }), [
|
|
502
|
+
l(a) ? ($(), E("label", {
|
|
440
503
|
key: 0,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
504
|
+
id: f,
|
|
505
|
+
for: l(p)
|
|
506
|
+
}, q(l(a)), 9, Ne)) : _("", !0),
|
|
507
|
+
V("div", Fe, [
|
|
508
|
+
l(C) ? D(x.$slots, "icon-left", R(w({ key: 0 }, l(T))), () => [
|
|
509
|
+
P(N, {
|
|
446
510
|
class: "vv-textarea__icon-left",
|
|
447
|
-
name:
|
|
511
|
+
name: l(i)
|
|
448
512
|
}, null, 8, ["name"])
|
|
449
513
|
]) : _("", !0),
|
|
450
|
-
|
|
514
|
+
ie(V("textarea", w({
|
|
451
515
|
ref_key: "input",
|
|
452
|
-
ref:
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
onInput:
|
|
516
|
+
ref: s,
|
|
517
|
+
"onUpdate:modelValue": b[0] || (b[0] = (B) => ae(S) ? S.value = B : null)
|
|
518
|
+
}, l(J), {
|
|
519
|
+
onInput: b[1] || (b[1] = (B) => r("input", B))
|
|
456
520
|
}), null, 16), [
|
|
457
|
-
[
|
|
521
|
+
[le, l(S)]
|
|
458
522
|
]),
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
523
|
+
l(u) && l(j) > 0 ? ($(), E("button", {
|
|
524
|
+
key: 1,
|
|
525
|
+
class: "vv-button vv-button--ghost",
|
|
526
|
+
onClick: Q
|
|
527
|
+
}, [
|
|
528
|
+
P(N, { name: "clear-field" })
|
|
529
|
+
])) : _("", !0),
|
|
530
|
+
l(I) ? D(x.$slots, "icon-right", R(w({ key: 2 }, l(T))), () => [
|
|
531
|
+
P(N, { name: l(i) }, null, 8, ["name"])
|
|
532
|
+
]) : _("", !0),
|
|
533
|
+
l(c) ? ($(), E("span", Le, [
|
|
534
|
+
D(x.$slots, "limit", {}, () => [
|
|
535
|
+
ue(q(l(W)), 1)
|
|
536
|
+
])
|
|
537
|
+
])) : _("", !0)
|
|
462
538
|
]),
|
|
463
|
-
|
|
464
|
-
id:
|
|
539
|
+
P(l(K), {
|
|
540
|
+
id: g,
|
|
465
541
|
class: "vv-textarea__hint"
|
|
466
|
-
}
|
|
542
|
+
})
|
|
467
543
|
], 16));
|
|
468
544
|
}
|
|
469
545
|
});
|