@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.
Files changed (82) hide show
  1. package/README.md +61 -2
  2. package/dist/components/VvButton/vv-button.es.js +56 -58
  3. package/dist/components/VvButton/vv-button.umd.js +1 -1
  4. package/dist/components/VvCheckGroup/vv-check-group.es.js +221 -203
  5. package/dist/components/VvCheckGroup/vv-check-group.umd.js +2 -2
  6. package/dist/components/VvInputText/VvInputText.d.ts +14 -0
  7. package/dist/components/VvInputText/VvInputText.vue.d.ts +36 -1
  8. package/dist/components/VvInputText/VvInputTextActions.d.ts +3 -0
  9. package/dist/components/VvInputText/vv-input-text.es.js +509 -380
  10. package/dist/components/VvInputText/vv-input-text.umd.js +2 -2
  11. package/dist/components/VvNativeSelect/vv-native-select.es.js +180 -161
  12. package/dist/components/VvNativeSelect/vv-native-select.umd.js +2 -2
  13. package/dist/components/VvRadioGroup/vv-radio-group.es.js +211 -193
  14. package/dist/components/VvRadioGroup/vv-radio-group.umd.js +2 -2
  15. package/dist/components/VvSelect/vv-select.es.js +189 -171
  16. package/dist/components/VvSelect/vv-select.umd.js +2 -2
  17. package/dist/components/VvTextarea/VvTextarea.d.ts +43 -22
  18. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +140 -85
  19. package/dist/components/VvTextarea/vv-textarea.es.js +364 -288
  20. package/dist/components/VvTextarea/vv-textarea.umd.js +2 -2
  21. package/dist/composables/debouncedInput/useDebouncedInput.d.ts +2 -0
  22. package/dist/composables/icons/useComponentIcons.d.ts +6 -0
  23. package/dist/composables/textLimit/useTextLimit.d.ts +14 -0
  24. package/dist/composables/useModifiers.d.ts +3 -2
  25. package/dist/icons.es.js +3 -3
  26. package/dist/icons.umd.js +1 -1
  27. package/dist/props/index.d.ts +42 -0
  28. package/dist/stories/utils.d.ts +5 -0
  29. package/dist/ui-vue.es.js +417 -401
  30. package/dist/ui-vue.umd.js +2 -2
  31. package/package.json +3 -1
  32. package/src/assets/icons/detailed.json +1 -1
  33. package/src/assets/icons/normal.json +1 -1
  34. package/src/assets/icons/simple.json +1 -1
  35. package/src/components/VvButton/VvButton.vue +1 -2
  36. package/src/components/VvInputText/VvInputText.ts +19 -2
  37. package/src/components/VvInputText/VvInputText.vue +123 -149
  38. package/src/components/VvInputText/VvInputTextActions.ts +151 -0
  39. package/src/components/VvTextarea/VvTextarea.ts +25 -16
  40. package/src/components/VvTextarea/VvTextarea.vue +89 -93
  41. package/src/components/common/HintSlot.ts +31 -13
  42. package/src/composables/debouncedInput/useDebouncedInput.ts +19 -0
  43. package/src/composables/icons/useComponentIcons.ts +35 -0
  44. package/src/composables/textLimit/useTextLimit.ts +44 -0
  45. package/src/composables/useModifiers.ts +47 -1
  46. package/src/props/index.ts +39 -0
  47. package/src/stories/InputText/InputTextMaxLength.stories.mdx +21 -0
  48. package/src/stories/Textarea/Textarea.stories.mdx +33 -51
  49. package/src/stories/Textarea/TextareaAutoclear.stories.mdx +23 -0
  50. package/src/stories/Textarea/TextareaAutocomplete.stories.mdx +10 -2
  51. package/src/stories/Textarea/TextareaAutofocus.stories.mdx +5 -1
  52. package/src/stories/Textarea/TextareaDebounce.stories.mdx +23 -0
  53. package/src/stories/Textarea/TextareaDisabled.stories.mdx +5 -1
  54. package/src/stories/Textarea/TextareaError.stories.mdx +6 -3
  55. package/src/stories/Textarea/TextareaErrorLabel.stories.mdx +37 -0
  56. package/src/stories/Textarea/TextareaFloating.stories.mdx +7 -2
  57. package/src/stories/Textarea/TextareaHintLabel.stories.mdx +5 -1
  58. package/src/stories/Textarea/TextareaIcon.stories.mdx +5 -1
  59. package/src/stories/Textarea/TextareaIconPosition.stories.mdx +9 -1
  60. package/src/stories/Textarea/TextareaId.stories.mdx +19 -0
  61. package/src/stories/Textarea/TextareaLabel.stories.mdx +5 -1
  62. package/src/stories/Textarea/TextareaLimit.stories.mdx +50 -0
  63. package/src/stories/Textarea/TextareaLoading.stories.mdx +6 -3
  64. package/src/stories/Textarea/TextareaLoadingLabel.stories.mdx +23 -0
  65. package/src/stories/Textarea/TextareaMaxLength.stories.mdx +6 -2
  66. package/src/stories/Textarea/TextareaMinLength.stories.mdx +5 -1
  67. package/src/stories/Textarea/TextareaModifiers.stories.mdx +24 -0
  68. package/src/stories/Textarea/TextareaName.stories.mdx +23 -0
  69. package/src/stories/Textarea/TextareaPlaceholder.stories.mdx +5 -1
  70. package/src/stories/Textarea/TextareaReadonly.stories.mdx +5 -1
  71. package/src/stories/Textarea/TextareaRequired.stories.mdx +22 -0
  72. package/src/stories/Textarea/TextareaResizable.stories.mdx +22 -0
  73. package/src/stories/Textarea/TextareaRowsCols.stories.mdx +9 -1
  74. package/src/stories/Textarea/TextareaValid.stories.mdx +7 -4
  75. package/src/stories/Textarea/TextareaValidLabel.stories.mdx +35 -0
  76. package/src/stories/stories.scss +11 -0
  77. package/src/stories/utils.ts +12 -0
  78. package/src/stories/volver-ui-vue.stories.mdx +7 -1
  79. package/dist/components/VvInputText/useInputNumber.d.ts +0 -16
  80. package/dist/components/VvInputText/useInputPassword.d.ts +0 -16
  81. package/src/components/VvInputText/useInputNumber.ts +0 -40
  82. package/src/components/VvInputText/useInputPassword.ts +0 -38
@@ -1,60 +1,60 @@
1
- import { computed as d, unref as f, defineComponent as W, ref as D, toRefs as $, inject as ae, openBlock as O, createBlock as le, mergeProps as P, createCommentVNode as _, h as ue, watch as G, useSlots as ce, useAttrs as fe, onMounted as de, createElementBlock as q, toDisplayString as pe, createElementVNode as R, renderSlot as H, normalizeProps as M, createVNode as B, withDirectives as me, vModelText as ge } from "vue";
2
- import { iconExists as b, Icon as ve, addIcon as ye } from "@iconify/vue";
3
- import { useFocus as he, refDebounced as Se } from "@vueuse/core";
4
- const A = {
5
- equals(e, t, n) {
6
- return n ? this.resolveFieldData(e, n) === this.resolveFieldData(t, n) : this.deepEquals(e, t);
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, t) {
9
- if (e === t)
8
+ deepEquals(e, r) {
9
+ if (e === r)
10
10
  return !0;
11
- if (e && t && typeof e == "object" && typeof t == "object") {
12
- const n = Array.isArray(e), o = Array.isArray(t);
13
- let r, i, a;
14
- if (n && o) {
15
- if (i = e.length, i != t.length)
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 (r = i; r-- !== 0; )
18
- if (!this.deepEquals(e[r], t[r]))
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 (n != o)
22
+ if (t != o)
23
23
  return !1;
24
- const s = e instanceof Date, h = t instanceof Date;
25
- if (s != h)
24
+ const d = e instanceof Date, a = r instanceof Date;
25
+ if (d != a)
26
26
  return !1;
27
- if (s && h)
28
- return e.getTime() == t.getTime();
29
- const g = e instanceof RegExp, l = t instanceof RegExp;
30
- if (g != l)
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 (g && l)
33
- return e.toString() == t.toString();
34
- const u = Object.keys(e);
35
- if (i = u.length, i !== Object.keys(t).length)
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 (r = i; r-- !== 0; )
38
- if (!Object.prototype.hasOwnProperty.call(t, u[r]))
37
+ for (n = s; n-- !== 0; )
38
+ if (!Object.prototype.hasOwnProperty.call(r, c[n]))
39
39
  return !1;
40
- for (r = i; r-- !== 0; )
41
- if (a = u[r], !this.deepEquals(e[a], t[a]))
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 && t !== t;
45
+ return e !== e && r !== r;
46
46
  },
47
- resolveFieldData(e, t) {
48
- if (e && Object.keys(e).length && t) {
49
- if (t.indexOf(".") === -1)
50
- return e[t];
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 n = t.split(".");
52
+ const t = r.split(".");
53
53
  let o = e;
54
- for (let r = 0, i = n.length; r < i; ++r) {
54
+ for (let n = 0, s = t.length; n < s; ++n) {
55
55
  if (e == null)
56
56
  return null;
57
- o = o[n[r]];
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, t) {
68
- let n = -1;
69
- if (t) {
70
- for (let o = 0; o < t.length; o++)
71
- if (this.equals(t[o], e)) {
72
- n = o;
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 n;
76
+ return t;
77
77
  },
78
- contains(e, t) {
79
- if (e != null && t && t.length) {
80
- for (const n of t)
81
- if (this.equals(e, n))
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, t) {
92
+ pickBy(e, r) {
93
93
  return Object.fromEntries(
94
- Object.entries(e).filter(([n]) => t(n))
94
+ Object.entries(e).filter(([t]) => r(t))
95
95
  );
96
96
  },
97
- removeFromList(e, t) {
98
- const n = this.findIndexInList(e, t);
99
- return n > -1 ? t.filter((o, r) => r !== n) : t;
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((t, n) => {
106
- var o, r, i, a, s;
107
- return this.isFunction(e[n]) ? t[n] = e[n]() : Array.isArray(e[n]) ? t[n] = e[n][0]() : (o = e[n]) != null && o.type && (Array.isArray(e[n].type) ? t[n] = ((r = e[n]) == null ? void 0 : r.default) || ((i = e[n]) == null ? void 0 : i.type[0]()) : t[n] = ((a = e[n]) == null ? void 0 : a.default) || ((s = e[n]) == null ? void 0 : s.type())), t;
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, t, n) {
111
- return e.filter((o) => t.some((r) => typeof r == "string" ? o[n] == r : this.equals(
112
- o[n],
113
- r[n]
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 t, n;
117
+ var r, t;
118
118
  if (e)
119
- return (n = (t = e.match(
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 : t.join("-")) == null ? void 0 : n.toLowerCase();
121
+ )) == null ? void 0 : r.join("-")) == null ? void 0 : t.toLowerCase();
122
122
  }
123
- }, Ae = {
123
+ }, ge = {
124
124
  valid: Boolean,
125
125
  validLabel: [String, Array]
126
- }, xe = {
126
+ }, he = {
127
127
  error: Boolean,
128
128
  errorLabel: [String, Array]
129
- }, Ce = {
129
+ }, ye = {
130
130
  loading: Boolean,
131
131
  loadingLabel: String
132
- }, Ie = {
133
- disabled: Boolean
134
- }, Pe = {
135
- readonly: Boolean
136
- }, _e = {
132
+ }, ve = {
133
+ modifiers: [String, Array]
134
+ }, be = {
137
135
  hintLabel: { type: String, default: "" }
138
- }, z = {
139
- LEFT: "left",
140
- RIGHT: "right"
141
- }, we = {
142
- hard: "hard",
143
- soft: "soft"
144
- }, Ee = ["update:modelValue", "focus", "blur"], Be = {
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(z).includes(e),
164
- default: z.RIGHT
177
+ validation: (e) => Object.values(H).includes(e),
178
+ default: H.RIGHT
165
179
  },
166
180
  floating: Boolean,
167
- debounce: Number,
168
- cols: { type: Number, default: 50 },
169
- rows: { type: Number, default: 5 },
170
- wrap: { type: String, default: we.soft }
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 U(e, t) {
204
- const n = { [`${e}`]: !0 };
216
+ function Ce(e, r) {
217
+ const t = { [`${e}`]: !0 };
205
218
  return {
206
- bemCssClasses: d(() => Object.keys(t).reduce((r, i) => {
207
- const a = f(t[i]) || !1;
208
- if (!a)
209
- return r;
210
- if (i === "modifiers") {
211
- const s = Array.isArray(a) ? a : [a];
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
- ...r,
214
- ...s.reduce(
215
- (h, g) => ({
216
- ...h,
217
- [`${e}--${A.kebabCase(
218
- g
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
- ...r,
227
- [`${e}--${A.kebabCase(i)}`]: a
239
+ ...n,
240
+ [`${e}--${y.kebabCase(s)}`]: i
228
241
  };
229
- }, n) || {})
242
+ }, t) || {})
230
243
  };
231
244
  }
232
- const Z = /* @__PURE__ */ W({
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: be,
274
+ props: we,
235
275
  setup(e) {
236
- const t = e, n = D(!0), { modifiers: o } = $(t), r = ae("ds"), { bemCssClasses: i } = U("vv-icon", {
276
+ const r = e, t = F(!0), { modifiers: o } = L(r), n = ee("ds"), { bemCssClasses: s } = Ce("vv-icon", {
237
277
  modifiers: o
238
- }), a = d(() => t.provider || (r == null ? void 0 : r.provider)), s = d(() => {
239
- const l = t.name || "", u = `@${a.value}:${t.prefix}:${t.name}`;
240
- return b(l) ? l : b(u) ? u : (r == null ? void 0 : r.iconsCollections.find((c) => {
241
- const p = `@${a.value}:${c.prefix}:${l}`;
242
- if (b(p))
243
- return p;
244
- })) || l;
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 h(l) {
247
- let u = null;
286
+ function a(u) {
287
+ let c = null;
248
288
  if (typeof window > "u") {
249
- const { JSDOM: C } = require("jsdom");
250
- u = new C().window;
289
+ const { JSDOM: v } = require("jsdom");
290
+ c = new v().window;
251
291
  }
252
- return (u ? new u.DOMParser() : new window.DOMParser()).parseFromString(l, "text/html").querySelector("svg");
292
+ return (c ? new c.DOMParser() : new window.DOMParser()).parseFromString(u, "text/html").querySelector("svg");
253
293
  }
254
- function g(l) {
255
- const u = h(l), c = (u == null ? void 0 : u.innerHTML.trim()) || "";
256
- u && c && ye(`@${a.value}:${t.prefix}:${t.name}`, {
257
- body: c,
258
- height: u.viewBox.baseVal.height,
259
- width: u.viewBox.baseVal.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 r && (t.src ? (n.value = !1, r.fetchIcon(t.src).then((l) => {
263
- l && (g(l), n.value = !0);
264
- }).catch((l) => {
265
- throw new Error(`During fetch icon: ${l == null ? void 0 : l.message}`);
266
- })) : t.svg && g(t.svg)), (l, u) => n.value ? (O(), le(f(ve), P({
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: f(i)
308
+ class: l(s)
269
309
  }, {
270
- ...l.$props,
271
- provider: f(a),
272
- icon: f(s)
310
+ ...u.$props,
311
+ provider: l(i),
312
+ icon: l(d)
273
313
  }), null, 16, ["class"])) : _("", !0);
274
314
  }
275
315
  });
276
- function De(e) {
277
- return Array.isArray(e) ? e.filter((t) => A.isString(t)).reduce((t, n) => t.length > 0 ? t + `
278
- ` + n : n, "") : e;
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 Oe(e, t) {
320
+ function Ee(e, r) {
281
321
  return {
282
322
  name: "HintSlot",
283
- setup() {
284
- const n = $(e), {
285
- error: o,
286
- valid: r,
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: a
289
- } = t, {
290
- hintLabel: s,
332
+ loading: d
333
+ } = r, {
334
+ hintLabel: a,
291
335
  modelValue: h,
292
- valid: g,
293
- validLabel: l,
294
- error: u,
295
- errorLabel: c
296
- } = n, p = A.resolveFieldData(n, "loading"), v = A.resolveFieldData(
297
- n,
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
- ), C = d(() => u.value ? !!(u.value && o || (c == null ? void 0 : c.value) && Array.isArray(c.value) && c.value.length > 0 || (c == null ? void 0 : c.value) && A.isNotEmpty(c.value)) : !1), w = d(() => !!(s && s.value || i || r || l && l.value || C.value || (p == null ? void 0 : p.value) && a || (p == null ? void 0 : p.value) && (v == null ? void 0 : v.value))), I = d(() => Array.isArray(c == null ? void 0 : c.value) ? De((c == null ? void 0 : c.value) || "") : c == null ? void 0 : c.value), E = d(() => {
300
- const x = { modelValue: h, error: u, valid: g };
301
- return u != null && u.value ? (o == null ? void 0 : o(x)) || (I == null ? void 0 : I.value) || (s == null ? void 0 : s.value) : g != null && g.value ? (r == null ? void 0 : r(x)) || (l == null ? void 0 : l.value) || (s == null ? void 0 : s.value) : p != null && p.value ? (a == null ? void 0 : a(x)) || (v == null ? void 0 : v.value) || (s == null ? void 0 : s.value) : (i == null ? void 0 : i(x)) || (s == null ? void 0 : s.value) || (s == null ? void 0 : s.value);
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: w,
305
- hintContent: E
358
+ hasHint: C,
359
+ hintContent: I
306
360
  };
307
361
  },
308
362
  render() {
309
363
  if (this.hasHint)
310
- return ue("span", null, this.hintContent);
364
+ return re(
365
+ "pre",
366
+ { style: { "white-space": "pre" } },
367
+ this.hintContent
368
+ );
311
369
  }
312
370
  };
313
371
  }
314
- function $e(e, t) {
315
- const { icon: n, iconPosition: o } = e, r = d(
316
- () => !!(n.value && o.value === "left" || t.iconLeft)
317
- ), i = d(
318
- () => !!(n.value && o.value === "right" || t.iconRight)
319
- ), a = d(
320
- () => !!(n.value && o.value === "top" || t.iconTop)
321
- ), s = d(
322
- () => !!(n.value && o.value === "bottom" || t.iconBottom)
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
- icon: n,
326
- iconPosition: o,
327
- hasIconLeft: r,
328
- hasIconRight: i,
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, t) {
334
- const { focused: n } = he(e);
335
- return G(n, (o) => {
336
- t(o ? "focus" : "blur", e.value);
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: n
394
+ focused: t
339
395
  };
340
396
  }
341
- const Fe = ["for"], Ne = { class: "vv-textarea__wrapper" }, Te = {
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__ */ W({
344
- ...Te,
423
+ }, Re = /* @__PURE__ */ z({
424
+ ...je,
345
425
  __name: "VvTextarea",
346
- props: Be,
347
- emits: Ee,
348
- setup(e, { emit: t }) {
349
- const n = e, o = ce(), r = fe(), i = D(), a = D(n.modelValue), {
350
- readonly: s,
351
- icon: h,
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
- }, { hasIconLeft: x, hasIconRight: k } = $e(I, E), { focused: F } = ke(i, t), { bemCssClasses: J } = U("vv-textarea", {
365
- readonly: s,
366
- valid: l,
367
- invalid: u,
368
- loading: c,
369
- iconLeft: x,
370
- iconRight: k,
371
- floating: d(
372
- () => p.value && A.isNotEmpty(v == null ? void 0 : v.value)
373
- ),
374
- dirty: d(() => A.isNotEmpty(C))
375
- }), K = d(() => {
376
- const { class: m } = r;
377
- return {
378
- class: m,
379
- ...J.value
380
- };
381
- }), Q = d(() => {
382
- const { style: m } = r, y = A.pickBy(
383
- r,
384
- (S) => S.startsWith("data-")
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: m,
388
- ...y
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
- }), T = d(() => {
418
- const { name: m } = r, y = A.pickBy(
419
- r,
420
- (S) => S.startsWith("aria-")
460
+ }), J = m(() => {
461
+ const x = y.pickBy(
462
+ n,
463
+ (b) => b.startsWith("aria-")
421
464
  );
422
465
  return {
423
- "aria-label": m,
424
- "aria-describedby": `${m}-hint`,
425
- "aria-invalid": n.error,
426
- ...y
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
- }), V = d(() => {
429
- const { modelValue: m, valid: y, error: S } = n;
485
+ }), T = m(() => {
486
+ const { modelValue: x, valid: b, error: B, maxlength: X, hintLabel: Y } = t;
430
487
  return {
431
- valid: y,
432
- error: S,
433
- modelValue: m
488
+ valid: b,
489
+ error: B,
490
+ modelValue: x,
491
+ hintLabel: Y,
492
+ maxlength: X,
493
+ textLength: j
434
494
  };
435
- }), X = Oe(n, o);
436
- return de(() => {
437
- n.autofocus && (F.value = !0), console.log("Focused", F.value);
438
- }), (m, y) => (O(), q("div", P(f(Q), { class: f(K) }), [
439
- f(v) ? (O(), q("label", {
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
- for: f(N).id
442
- }, pe(f(v)), 9, Fe)) : _("", !0),
443
- R("div", Ne, [
444
- f(x) ? H(m.$slots, "icon-left", M(P({ key: 0 }, f(V))), () => [
445
- B(Z, {
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: f(h)
511
+ name: l(i)
448
512
  }, null, 8, ["name"])
449
513
  ]) : _("", !0),
450
- me(R("textarea", P({
514
+ ie(V("textarea", w({
451
515
  ref_key: "input",
452
- ref: i
453
- }, f(N), {
454
- "onUpdate:modelValue": y[0] || (y[0] = (S) => a.value = S),
455
- onInput: y[1] || (y[1] = (S) => t("input", S))
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
- [ge, a.value]
521
+ [le, l(S)]
458
522
  ]),
459
- f(k) ? H(m.$slots, "icon-right", M(P({ key: 1 }, f(V))), () => [
460
- B(Z, { name: f(h) }, null, 8, ["name"])
461
- ]) : _("", !0)
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
- B(f(X), {
464
- id: f(T)["aria-describedby"],
539
+ P(l(K), {
540
+ id: g,
465
541
  class: "vv-textarea__hint"
466
- }, null, 8, ["id"])
542
+ })
467
543
  ], 16));
468
544
  }
469
545
  });