@volverjs/ui-vue 0.0.4 → 0.0.5-beta.1

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