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

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 (215) 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 +276 -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 +213 -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 +247 -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 +646 -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 +261 -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 +562 -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 +661 -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 +1546 -983
  44. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  45. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
  46. package/dist/components/VvCombobox/index.d.ts +41 -10
  47. package/dist/components/VvDialog/VvDialog.es.js +387 -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 +452 -244
  52. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  53. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
  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 +40 -11
  57. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -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 +285 -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 +986 -462
  70. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  71. package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
  72. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  73. package/dist/components/VvInputText/index.d.ts +66 -13
  74. package/dist/components/VvProgress/VvProgress.es.js +216 -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 +499 -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 +598 -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 +631 -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 +676 -355
  91. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  92. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
  93. package/dist/components/VvTextarea/index.d.ts +4 -4
  94. package/dist/components/VvTooltip/VvTooltip.es.js +215 -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 +3522 -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.d.ts +1 -0
  114. package/dist/directives/index.es.js +264 -55
  115. package/dist/directives/index.umd.js +1 -1
  116. package/dist/directives/v-contextmenu.d.ts +3 -0
  117. package/dist/directives/v-contextmenu.es.js +42 -0
  118. package/dist/directives/v-contextmenu.umd.js +1 -0
  119. package/dist/directives/v-tooltip.es.js +222 -53
  120. package/dist/directives/v-tooltip.umd.js +1 -1
  121. package/dist/icons.d.ts +3 -1
  122. package/dist/icons.es.js +40 -23
  123. package/dist/icons.umd.js +1 -1
  124. package/dist/index.d.ts +0 -1
  125. package/dist/index.es.js +112 -3607
  126. package/dist/index.umd.js +1 -1
  127. package/dist/props/index.d.ts +50 -18
  128. package/dist/resolvers/unplugin.d.ts +7 -1
  129. package/dist/resolvers/unplugin.es.js +77 -37
  130. package/dist/resolvers/unplugin.umd.js +1 -1
  131. package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
  132. package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
  133. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  134. package/dist/stories/argTypes.d.ts +13 -1
  135. package/package.json +126 -40
  136. package/src/Volver.ts +49 -22
  137. package/src/assets/icons/detailed.json +1 -1
  138. package/src/assets/icons/normal.json +1 -1
  139. package/src/assets/icons/simple.json +1 -1
  140. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  141. package/src/components/VvAccordion/index.ts +12 -4
  142. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  143. package/src/components/VvAccordionGroup/index.ts +8 -0
  144. package/src/components/VvAction/VvAction.vue +7 -7
  145. package/src/components/VvAction/index.ts +1 -1
  146. package/src/components/VvBadge/VvBadge.vue +2 -2
  147. package/src/components/VvBadge/index.ts +1 -1
  148. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  149. package/src/components/VvButton/VvButton.vue +11 -11
  150. package/src/components/VvButton/index.ts +10 -9
  151. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  152. package/src/components/VvButtonGroup/index.ts +1 -1
  153. package/src/components/VvCard/VvCard.vue +2 -2
  154. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  155. package/src/components/VvCheckbox/index.ts +11 -7
  156. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  157. package/src/components/VvCheckboxGroup/index.ts +1 -1
  158. package/src/components/VvCombobox/VvCombobox.vue +44 -26
  159. package/src/components/VvCombobox/index.ts +1 -1
  160. package/src/components/VvDialog/VvDialog.vue +28 -11
  161. package/src/components/VvDialog/index.ts +5 -2
  162. package/src/components/VvDropdown/VvDropdown.vue +7 -5
  163. package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
  164. package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
  165. package/src/components/VvDropdown/index.ts +3 -3
  166. package/src/components/VvIcon/VvIcon.vue +3 -3
  167. package/src/components/VvIcon/index.ts +3 -3
  168. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  169. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  170. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  171. package/src/components/VvInputText/VvInputText.vue +130 -37
  172. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  173. package/src/components/VvInputText/index.ts +62 -1
  174. package/src/components/VvProgress/VvProgress.vue +2 -2
  175. package/src/components/VvProgress/index.ts +1 -1
  176. package/src/components/VvRadio/VvRadio.vue +3 -7
  177. package/src/components/VvRadio/index.ts +11 -7
  178. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  179. package/src/components/VvRadioGroup/index.ts +1 -1
  180. package/src/components/VvSelect/VvSelect.vue +4 -4
  181. package/src/components/VvSelect/index.ts +1 -1
  182. package/src/components/VvTextarea/VvTextarea.vue +6 -6
  183. package/src/components/VvTextarea/index.ts +1 -1
  184. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  185. package/src/components/VvTooltip/index.ts +3 -3
  186. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  187. package/src/composables/dropdown/useProvideDropdown.ts +2 -2
  188. package/src/composables/group/useInjectedGroupState.ts +1 -1
  189. package/src/composables/group/useProvideGroupState.ts +1 -1
  190. package/src/composables/useComponentIcon.ts +1 -1
  191. package/src/composables/useDebouncedInput.ts +10 -3
  192. package/src/composables/useDefaults.ts +89 -0
  193. package/src/composables/useModifiers.ts +4 -2
  194. package/src/composables/useOptions.ts +1 -1
  195. package/src/composables/useVolver.ts +2 -2
  196. package/src/directives/index.ts +3 -1
  197. package/src/directives/v-contextmenu.ts +40 -0
  198. package/src/directives/v-tooltip.ts +2 -2
  199. package/src/icons.ts +1 -1
  200. package/src/index.ts +0 -2
  201. package/src/props/index.ts +20 -10
  202. package/src/resolvers/unplugin.ts +15 -1
  203. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  204. package/src/stories/Accordion/Accordion.test.ts +21 -15
  205. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  206. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  207. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  208. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  209. package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
  210. package/src/stories/InputText/InputText.settings.ts +53 -0
  211. package/src/stories/InputText/InputText.stories.mdx +40 -0
  212. package/src/stories/InputText/InputText.test.ts +5 -2
  213. package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
  214. package/src/stories/argTypes.ts +12 -2
  215. package/src/types/group.d.ts +5 -0
@@ -1,112 +1,184 @@
1
- import { unref as d, toRefs as A, computed as c, h as se, inject as ie, toRef as ce, defineComponent as H, useSlots as K, ref as ve, watchEffect as fe, watch as de, onMounted as pe, openBlock as j, createElementBlock as x, normalizeClass as F, withDirectives as ye, createElementVNode as M, isRef as q, vModelCheckbox as be, renderSlot as z, createTextVNode as ge, toDisplayString as U, createVNode as J, provide as he, createCommentVNode as me, Fragment as ke, renderList as Se, createBlock as Oe, mergeProps as _e } from "vue";
2
- import { toReactive as Ve, useVModel as je } from "@vueuse/core";
3
- import { nanoid as Ae } from "nanoid";
4
- var I = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(I || {}), T = /* @__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))(T || {}), R = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(R || {}), G = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(G || {}), W = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(W || {});
5
- const Y = Symbol.for("checkGroup");
6
- function Q(e, t, n) {
7
- return n ? P(e, n) === P(t, n) : N(e, t);
1
+ import { unref, toRefs, computed, h, inject, toRef, defineComponent, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, isRef, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, provide, createCommentVNode, Fragment, renderList, createBlock, mergeProps } from "vue";
2
+ import { toReactive, useVModel } from "@vueuse/core";
3
+ import { nanoid } from "nanoid";
4
+ var Side = /* @__PURE__ */ ((Side2) => {
5
+ Side2["left"] = "left";
6
+ Side2["right"] = "right";
7
+ Side2["top"] = "top";
8
+ Side2["bottom"] = "bottom";
9
+ return Side2;
10
+ })(Side || {});
11
+ var Placement = /* @__PURE__ */ ((Placement2) => {
12
+ Placement2["topStart"] = "top-start";
13
+ Placement2["topEnd"] = "top-end";
14
+ Placement2["bottomStart"] = "bottom-start";
15
+ Placement2["bottomEnd"] = "bottom-end";
16
+ Placement2["leftStart"] = "left-start";
17
+ Placement2["leftEnd"] = "left-end";
18
+ Placement2["rightStart"] = "right-start";
19
+ Placement2["rightEnd"] = "right-end";
20
+ return Placement2;
21
+ })(Placement || {});
22
+ var Position = /* @__PURE__ */ ((Position2) => {
23
+ Position2["before"] = "before";
24
+ Position2["after"] = "after";
25
+ return Position2;
26
+ })(Position || {});
27
+ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
28
+ ButtonType2["button"] = "button";
29
+ ButtonType2["submit"] = "submit";
30
+ ButtonType2["reset"] = "reset";
31
+ return ButtonType2;
32
+ })(ButtonType || {});
33
+ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
34
+ AnchorTarget2["_blank"] = "_blank";
35
+ AnchorTarget2["_self"] = "_self";
36
+ AnchorTarget2["_parent"] = "_parent";
37
+ AnchorTarget2["_top"] = "_top";
38
+ return AnchorTarget2;
39
+ })(AnchorTarget || {});
40
+ const INJECTION_KEY_CHECK_GROUP = Symbol.for("checkGroup");
41
+ function equals(obj1, obj2, field) {
42
+ if (field)
43
+ return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
44
+ else
45
+ return deepEquals(obj1, obj2);
8
46
  }
9
- function N(e, t) {
10
- if (e === t)
11
- return !0;
12
- if (e && t && typeof e == "object" && typeof t == "object") {
13
- const n = Array.isArray(e), s = Array.isArray(t);
14
- let r, l, o;
15
- if (n && s) {
16
- if (l = e.length, l != t.length)
17
- return !1;
18
- for (r = l; r-- !== 0; )
19
- if (!N(e[r], t[r]))
20
- return !1;
21
- return !0;
47
+ function deepEquals(a, b) {
48
+ if (a === b)
49
+ return true;
50
+ if (a && b && typeof a == "object" && typeof b == "object") {
51
+ const arrA = Array.isArray(a);
52
+ const arrB = Array.isArray(b);
53
+ let i, length, key;
54
+ if (arrA && arrB) {
55
+ length = a.length;
56
+ if (length != b.length)
57
+ return false;
58
+ for (i = length; i-- !== 0; )
59
+ if (!deepEquals(a[i], b[i]))
60
+ return false;
61
+ return true;
22
62
  }
23
- if (n != s)
24
- return !1;
25
- const y = e instanceof Date, a = t instanceof Date;
26
- if (y != a)
27
- return !1;
28
- if (y && a)
29
- return e.getTime() == t.getTime();
30
- const v = e instanceof RegExp, u = t instanceof RegExp;
31
- if (v != u)
32
- return !1;
33
- if (v && u)
34
- return e.toString() == t.toString();
35
- const i = Object.keys(e);
36
- if (l = i.length, l !== Object.keys(t).length)
37
- return !1;
38
- for (r = l; r-- !== 0; )
39
- if (!Object.prototype.hasOwnProperty.call(t, i[r]))
40
- return !1;
41
- for (r = l; r-- !== 0; )
42
- if (o = i[r], !N(e[o], t[o]))
43
- return !1;
44
- return !0;
63
+ if (arrA != arrB)
64
+ return false;
65
+ const dateA = a instanceof Date, dateB = b instanceof Date;
66
+ if (dateA != dateB)
67
+ return false;
68
+ if (dateA && dateB)
69
+ return a.getTime() == b.getTime();
70
+ const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
71
+ if (regexpA != regexpB)
72
+ return false;
73
+ if (regexpA && regexpB)
74
+ return a.toString() == b.toString();
75
+ const keys = Object.keys(a);
76
+ length = keys.length;
77
+ if (length !== Object.keys(b).length)
78
+ return false;
79
+ for (i = length; i-- !== 0; )
80
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
81
+ return false;
82
+ for (i = length; i-- !== 0; ) {
83
+ key = keys[i];
84
+ if (!deepEquals(a[key], b[key]))
85
+ return false;
86
+ }
87
+ return true;
45
88
  }
46
- return e !== e && t !== t;
89
+ return a !== a && b !== b;
47
90
  }
48
- function P(e, t) {
49
- if (e && Object.keys(e).length && t) {
50
- if (t.indexOf(".") === -1)
51
- return e[t];
52
- {
53
- const n = t.split(".");
54
- let s = e;
55
- for (let r = 0, l = n.length; r < l; ++r) {
56
- if (e == null)
91
+ function resolveFieldData(data, field) {
92
+ if (data && Object.keys(data).length && field) {
93
+ if (field.indexOf(".") === -1) {
94
+ return data[field];
95
+ } else {
96
+ const fields = field.split(".");
97
+ let value = data;
98
+ for (let i = 0, len = fields.length; i < len; ++i) {
99
+ if (data == null) {
57
100
  return null;
58
- s = s[n[r]];
101
+ }
102
+ value = value[fields[i]];
59
103
  }
60
- return s;
104
+ return value;
61
105
  }
62
- } else
106
+ } else {
63
107
  return null;
108
+ }
64
109
  }
65
- function Be(e, t) {
66
- if (e != null && t && t.length) {
67
- for (const n of t)
68
- if (Q(e, n))
69
- return !0;
110
+ function contains(value, list) {
111
+ if (value != null && list && list.length) {
112
+ for (const val of list) {
113
+ if (equals(value, val)) {
114
+ return true;
115
+ }
116
+ }
70
117
  }
71
- return !1;
118
+ return false;
72
119
  }
73
- function X(e) {
74
- return ((t) => t == null || t === "" || Array.isArray(t) && t.length === 0 || !(t instanceof Date) && typeof t == "object" && Object.keys(t).length === 0)(d(e));
120
+ function isEmpty(value) {
121
+ 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));
75
122
  }
76
- function Ce(e) {
77
- return typeof e == "string" || e instanceof String;
123
+ function isString(value) {
124
+ return typeof value === "string" || value instanceof String;
78
125
  }
79
- function C(e) {
80
- return Array.isArray(e) ? e.filter((t) => Ce(t)).join(" ") : e;
126
+ function joinLines(errors) {
127
+ if (Array.isArray(errors)) {
128
+ return errors.filter((e) => isString(e)).join(" ");
129
+ }
130
+ return errors;
81
131
  }
82
- function Z(e, t) {
132
+ function HintSlotFactory(parentProps, parentSlots) {
83
133
  const {
84
- invalid: n,
85
- valid: s,
86
- hint: r,
87
- loading: l
88
- } = t, {
89
- hintLabel: o,
90
- modelValue: y,
91
- valid: a,
92
- validLabel: v,
93
- invalid: u,
94
- invalidLabel: i,
95
- ...m
96
- } = A(e), p = P(m, "loading"), b = P(m, "loadingLabel"), g = c(() => u.value ? !!(u.value && n || i != null && i.value && Array.isArray(i.value) && i.value.length > 0 || i != null && i.value && !X(i)) : !1), f = c(
97
- () => !!(o && o.value || r)
98
- ), k = c(
99
- () => !!(v && v.value || s)
100
- ), _ = c(
101
- () => !!(p != null && p.value && l || p != null && p.value && (b != null && b.value))
102
- ), O = c(
103
- () => f.value || k.value || g.value || _.value
134
+ invalid: invalidSlot,
135
+ valid: validSlot,
136
+ hint: hintSlot,
137
+ loading: loadingSlot
138
+ } = parentSlots;
139
+ const {
140
+ hintLabel,
141
+ modelValue,
142
+ valid,
143
+ validLabel,
144
+ invalid,
145
+ invalidLabel,
146
+ ...otherProps
147
+ } = toRefs(parentProps);
148
+ const loading = resolveFieldData(otherProps, "loading");
149
+ const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
150
+ const hasInvalid = computed(() => {
151
+ if (!invalid.value) {
152
+ return false;
153
+ }
154
+ if (invalid.value && invalidSlot) {
155
+ return true;
156
+ }
157
+ if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
158
+ return true;
159
+ }
160
+ if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
161
+ return true;
162
+ }
163
+ return false;
164
+ });
165
+ const hasHint = computed(
166
+ () => !!(hintLabel && hintLabel.value || hintSlot)
167
+ );
168
+ const hasValid = computed(
169
+ () => !!(validLabel && validLabel.value || validSlot)
170
+ );
171
+ const hasLoading = computed(
172
+ () => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
173
+ );
174
+ const isVisible = computed(
175
+ () => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
104
176
  );
105
177
  return {
106
- hasInvalid: g,
107
- hasHint: f,
108
- hasValid: k,
109
- hasLoading: _,
178
+ hasInvalid,
179
+ hasHint,
180
+ hasValid,
181
+ hasLoading,
110
182
  HintSlot: {
111
183
  name: "HintSlot",
112
184
  props: {
@@ -115,42 +187,50 @@ function Z(e, t) {
115
187
  default: () => ({})
116
188
  }
117
189
  },
118
- setup(B) {
119
- const E = c(() => {
120
- const S = Ve({
121
- hintLabel: o,
122
- modelValue: y,
123
- valid: a,
124
- validLabel: v,
125
- invalid: u,
126
- invalidLabel: i,
127
- loading: p,
128
- loadingLabel: b,
129
- ...B.params
190
+ setup(props) {
191
+ const hintContent = computed(() => {
192
+ const slotProps = toReactive({
193
+ hintLabel,
194
+ modelValue,
195
+ valid,
196
+ validLabel,
197
+ invalid,
198
+ invalidLabel,
199
+ loading,
200
+ loadingLabel,
201
+ ...props.params
130
202
  });
131
- return u != null && u.value ? (n == null ? void 0 : n(S)) || C(i == null ? void 0 : i.value) || (o == null ? void 0 : o.value) : a != null && a.value ? (s == null ? void 0 : s(S)) || C(v == null ? void 0 : v.value) || (o == null ? void 0 : o.value) : p != null && p.value ? (l == null ? void 0 : l(S)) || C(b == null ? void 0 : b.value) || (o == null ? void 0 : o.value) : (r == null ? void 0 : r(S)) || C(o == null ? void 0 : o.value) || (o == null ? void 0 : o.value);
203
+ if (invalid == null ? void 0 : invalid.value) {
204
+ return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
205
+ }
206
+ if (valid == null ? void 0 : valid.value)
207
+ return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
208
+ if (loading == null ? void 0 : loading.value)
209
+ return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
210
+ return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
132
211
  });
133
212
  return {
134
- isVisible: O,
135
- hasInvalid: g,
136
- hasValid: k,
137
- hintContent: E
213
+ isVisible,
214
+ hasInvalid,
215
+ hasValid,
216
+ hintContent
138
217
  };
139
218
  },
140
219
  render() {
141
- if (this.isVisible)
142
- return se(
220
+ if (this.isVisible) {
221
+ return h(
143
222
  "small",
144
223
  {
145
224
  role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
146
225
  },
147
226
  this.hintContent
148
227
  );
228
+ }
149
229
  }
150
230
  }
151
231
  };
152
232
  }
153
- const xe = {
233
+ const LinkProps = {
154
234
  /**
155
235
  * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
156
236
  * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
@@ -167,7 +247,7 @@ const xe = {
167
247
  */
168
248
  target: {
169
249
  type: String,
170
- validator: (e) => Object.values(W).includes(e)
250
+ validator: (value) => Object.values(AnchorTarget).includes(value)
171
251
  },
172
252
  /**
173
253
  * Anchor rel
@@ -176,7 +256,8 @@ const xe = {
176
256
  type: String,
177
257
  default: "noopener noreferrer"
178
258
  }
179
- }, L = {
259
+ };
260
+ const ValidProps = {
180
261
  /**
181
262
  * Valid status
182
263
  */
@@ -185,7 +266,8 @@ const xe = {
185
266
  * Valid label
186
267
  */
187
268
  validLabel: [String, Array]
188
- }, ee = {
269
+ };
270
+ const InvalidProps = {
189
271
  /**
190
272
  * Invalid status
191
273
  */
@@ -194,39 +276,47 @@ const xe = {
194
276
  * Invalid label
195
277
  */
196
278
  invalidLabel: [String, Array]
197
- }, $ = {
279
+ };
280
+ const DisabledProps = {
198
281
  /**
199
282
  * Whether the form control is disabled
200
283
  */
201
284
  disabled: Boolean
202
- }, Pe = {
285
+ };
286
+ const ActiveProps = {
203
287
  /**
204
288
  * Whether the item is active
205
289
  */
206
290
  active: Boolean
207
- }, Ee = {
291
+ };
292
+ const PressedProps = {
208
293
  /**
209
294
  * Whether the item is pressed
210
295
  */
211
296
  pressed: Boolean
212
- }, w = {
297
+ };
298
+ const LabelProps = {
213
299
  /**
214
300
  * The item label
215
301
  */
216
302
  label: [String, Number]
217
- }, te = {
303
+ };
304
+ const ReadonlyProps = {
218
305
  /**
219
306
  * The value is not editable
220
307
  */
221
308
  readonly: Boolean
222
- }, D = {
309
+ };
310
+ const ModifiersProps = {
223
311
  /**
224
312
  * Component BEM modifiers
225
313
  */
226
314
  modifiers: [String, Array]
227
- }, ne = {
315
+ };
316
+ const HintProps = {
228
317
  hintLabel: { type: String, default: "" }
229
- }, Ie = {
318
+ };
319
+ const OptionsProps = {
230
320
  /**
231
321
  * List of options, can be string[] or object[]
232
322
  */
@@ -247,39 +337,150 @@ const xe = {
247
337
  */
248
338
  disabledKey: { type: [String, Function], default: "disabled" }
249
339
  };
250
- R.before;
251
- const Re = {
340
+ ({
341
+ /**
342
+ * VvIcon name or props
343
+ * @see VVIcon
344
+ */
345
+ icon: { type: [String, Object] },
346
+ /**
347
+ * VvIcon position
348
+ */
349
+ iconPosition: {
350
+ type: String,
351
+ default: Position.before,
352
+ validation: (value) => Object.values(Position).includes(value)
353
+ }
354
+ });
355
+ const TabindexProps = {
252
356
  /**
253
357
  * Global attribute tabindex
254
358
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
255
359
  */
256
360
  tabindex: { type: [String, Number], default: 0 }
257
- }, Ge = {
361
+ };
362
+ const IdProps = {
258
363
  /**
259
364
  * Global attribute id
260
365
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
261
366
  */
262
367
  id: [String, Number]
263
368
  };
264
- I.bottom;
265
- const Ne = {
266
- ...Ge,
369
+ ({
370
+ /**
371
+ * Dropdown placement
372
+ */
373
+ placement: {
374
+ type: String,
375
+ default: Side.bottom,
376
+ validator: (value) => {
377
+ return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
378
+ }
379
+ },
380
+ /**
381
+ * Dropdown strategy
382
+ */
383
+ strategy: {
384
+ type: String,
385
+ default: "absolute",
386
+ validator: (value) => {
387
+ return ["fixed", "absolute"].includes(value);
388
+ }
389
+ },
390
+ /**
391
+ * Dropdown show / hide transition name
392
+ */
393
+ transitionName: {
394
+ type: String
395
+ },
396
+ /**
397
+ * Offset of the dropdown from the trigger
398
+ * @see https://floating-ui.com/docs/offset
399
+ */
400
+ offset: {
401
+ type: [Number, String, Object],
402
+ default: 0
403
+ },
404
+ /**
405
+ * Move dropdown to the side if there is no space in the default position
406
+ * @see https://floating-ui.com/docs/shift
407
+ */
408
+ shift: {
409
+ type: [Boolean, Object],
410
+ default: false
411
+ },
412
+ /**
413
+ * Flip dropdown position if there is no space in the default position
414
+ * @see https://floating-ui.com/docs/flip
415
+ */
416
+ flip: {
417
+ type: [Boolean, Object],
418
+ default: true
419
+ },
420
+ /**
421
+ * Size of the dropdown
422
+ * @see https://floating-ui.com/docs/size
423
+ */
424
+ size: {
425
+ type: [Boolean, Object],
426
+ default: () => ({ padding: 10 })
427
+ },
428
+ /**
429
+ * Automatically change the position of the dropdown
430
+ * @see https://floating-ui.com/docs/autoPlacement
431
+ */
432
+ autoPlacement: {
433
+ type: [Boolean, Object],
434
+ default: false
435
+ },
436
+ /**
437
+ * Add arrow to the dropdown
438
+ * @see https://floating-ui.com/docs/arrow
439
+ */
440
+ arrow: {
441
+ type: Boolean,
442
+ default: false
443
+ },
444
+ /**
445
+ * Close dropdown on click outside
446
+ */
447
+ autoClose: {
448
+ type: Boolean,
449
+ default: true
450
+ },
451
+ /**
452
+ * Autofocus first item on dropdown open
453
+ */
454
+ autofocusFirst: {
455
+ type: Boolean,
456
+ default: true
457
+ },
458
+ /**
459
+ * Set dropdown width to the same as the trigger
460
+ */
461
+ triggerWidth: {
462
+ type: Boolean
463
+ }
464
+ });
465
+ const IdNameProps = {
466
+ ...IdProps,
267
467
  /**
268
468
  * Input / Textarea name
269
469
  * Name of the form control. Submitted with the form as part of a name/value pair
270
470
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
271
471
  */
272
- name: { type: String, required: !0 }
273
- }, $e = {
274
- ...Ne,
275
- ...Re,
276
- ...L,
277
- ...ee,
278
- ...ne,
279
- ...$,
280
- ...te,
281
- ...D,
282
- ...w,
472
+ name: { type: String, required: true }
473
+ };
474
+ const CheckboxRadioProps = {
475
+ ...IdNameProps,
476
+ ...TabindexProps,
477
+ ...ValidProps,
478
+ ...InvalidProps,
479
+ ...HintProps,
480
+ ...DisabledProps,
481
+ ...ReadonlyProps,
482
+ ...ModifiersProps,
483
+ ...LabelProps,
283
484
  /**
284
485
  * Input value
285
486
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
@@ -289,72 +490,79 @@ const Ne = {
289
490
  * Input value
290
491
  */
291
492
  modelValue: [Object, Number, Boolean, String]
292
- }, we = {
293
- ...L,
294
- ...ee,
295
- ...Ie,
296
- ...ne,
297
- ...$,
298
- ...te,
299
- ...D,
300
- ...w,
493
+ };
494
+ const CheckboxRadioGroupProps = {
495
+ ...ValidProps,
496
+ ...InvalidProps,
497
+ ...OptionsProps,
498
+ ...HintProps,
499
+ ...DisabledProps,
500
+ ...ReadonlyProps,
501
+ ...ModifiersProps,
502
+ ...LabelProps,
301
503
  /**
302
504
  * Input value
303
505
  */
304
- modelValue: [String, Array],
506
+ modelValue: [String, Array, Boolean, Number, Symbol],
305
507
  /**
306
508
  * Input name
307
509
  */
308
- name: { type: String, required: !0 },
510
+ name: { type: String, required: true },
309
511
  /**
310
512
  * If true, the group will be displayed in a vertical column
311
513
  */
312
514
  vertical: Boolean
313
515
  };
314
516
  ({
315
- ...$,
316
- ...w,
317
- ...Ee,
318
- ...Pe,
319
- ...xe,
517
+ ...DisabledProps,
518
+ ...LabelProps,
519
+ ...PressedProps,
520
+ ...ActiveProps,
521
+ ...LinkProps,
320
522
  /**
321
523
  * Button type
322
524
  */
323
- type: G.button
525
+ type: {
526
+ type: String,
527
+ default: ButtonType.button,
528
+ validator: (value) => Object.values(ButtonType).includes(value)
529
+ }
324
530
  });
325
- function De(e) {
326
- const t = ie(e, void 0), n = c(() => !X(t));
327
- function s(r, l, o) {
328
- if (t != null && t.value) {
329
- const a = d(t.value)[r];
330
- return c({
531
+ function useInjectedGroupState(groupKey) {
532
+ const group = inject(groupKey, void 0);
533
+ const isInGroup = computed(() => !isEmpty(group));
534
+ function getGroupOrLocalRef(propName, props, emit) {
535
+ if (group == null ? void 0 : group.value) {
536
+ const groupPropValue = unref(group.value)[propName];
537
+ return computed({
331
538
  get() {
332
- return a == null ? void 0 : a.value;
539
+ return groupPropValue == null ? void 0 : groupPropValue.value;
333
540
  },
334
- set(v) {
335
- a.value = v;
541
+ set(value) {
542
+ groupPropValue.value = value;
336
543
  }
337
544
  });
338
545
  }
339
- const y = ce(l, r);
340
- return c({
546
+ const propRef = toRef(props, propName);
547
+ return computed({
341
548
  get() {
342
- return y.value;
549
+ return propRef.value;
343
550
  },
344
- set(a) {
345
- o && o(`update:${r}`, a);
551
+ set(value) {
552
+ if (emit)
553
+ emit(`update:${propName}`, value);
346
554
  }
347
555
  });
348
556
  }
349
557
  return {
350
- group: t,
351
- isInGroup: n,
352
- getGroupOrLocalRef: s
558
+ group,
559
+ isInGroup,
560
+ getGroupOrLocalRef
353
561
  };
354
562
  }
355
- const He = {
356
- ...$e,
357
- ...D,
563
+ const VvCheckboxProps = {
564
+ ...CheckboxRadioProps,
565
+ ...ModifiersProps,
358
566
  /**
359
567
  * If true, the input will be indeterminated
360
568
  */
@@ -367,199 +575,312 @@ const He = {
367
575
  * If true, the input will be displayed as a switch
368
576
  */
369
577
  switch: Boolean
370
- }, Ke = ["click", "update:modelValue", "change", "blur"];
371
- function Fe(e, t) {
372
- const { group: n, isInGroup: s, getGroupOrLocalRef: r } = De(Y), { id: l, switch: o, indeterminate: y } = A(e), a = r("modelValue", e, t), v = r("readonly", e), u = r("disabled", e), i = r("valid", e), m = r("invalid", e);
578
+ };
579
+ const VvCheckboxEvents = ["click", "update:modelValue", "change", "blur"];
580
+ function useGroupProps(props, emit) {
581
+ const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_CHECK_GROUP);
582
+ const { id, switch: propsSwitch, indeterminate } = toRefs(props);
583
+ const modelValue = getGroupOrLocalRef("modelValue", props, emit);
584
+ const valid = getGroupOrLocalRef("valid", props);
585
+ const invalid = getGroupOrLocalRef("invalid", props);
586
+ const readonly = computed(
587
+ () => {
588
+ var _a;
589
+ return Boolean(props.readonly || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
590
+ }
591
+ );
592
+ const disabled = computed(
593
+ () => {
594
+ var _a;
595
+ return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
596
+ }
597
+ );
373
598
  return {
374
599
  // local props
375
- id: l,
376
- propsSwitch: o,
377
- indeterminate: y,
600
+ id,
601
+ propsSwitch,
602
+ indeterminate,
378
603
  // global props
379
- group: n,
380
- isInGroup: s,
381
- modelValue: a,
382
- readonly: v,
383
- disabled: u,
384
- valid: i,
385
- invalid: m
604
+ group,
605
+ isInGroup,
606
+ modelValue,
607
+ valid,
608
+ invalid,
609
+ readonly,
610
+ disabled
386
611
  };
387
612
  }
388
- const Me = (e) => c(() => String((e == null ? void 0 : e.value) || Ae()));
389
- function re(e, t, n) {
390
- return c(() => {
391
- const s = {
392
- [e]: !0
393
- }, r = typeof (t == null ? void 0 : t.value) == "string" ? t.value.split(" ") : t == null ? void 0 : t.value;
394
- return r && Array.isArray(r) && r.forEach((l) => {
395
- s[`${e}--${l}`] = !0;
396
- }), n && Object.keys(n.value).forEach((l) => {
397
- s[`${e}--${l}`] = d(n.value[l]);
398
- }), s;
613
+ const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
614
+ function useModifiers(prefix, modifiers, others) {
615
+ return computed(() => {
616
+ const toReturn = {
617
+ [prefix]: true
618
+ };
619
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
620
+ if (modifiersArray) {
621
+ if (Array.isArray(modifiersArray)) {
622
+ modifiersArray.forEach((modifier) => {
623
+ if (modifier) {
624
+ toReturn[`${prefix}--${modifier}`] = true;
625
+ }
626
+ });
627
+ }
628
+ }
629
+ if (others) {
630
+ Object.keys(others.value).forEach((key) => {
631
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
632
+ });
633
+ }
634
+ return toReturn;
399
635
  });
400
636
  }
401
- const qe = ["for"], ze = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"], Ue = {
637
+ const _hoisted_1$1 = ["for"];
638
+ const _hoisted_2$1 = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"];
639
+ const __default__$1 = {
402
640
  name: "VvCheckbox"
403
- }, Je = /* @__PURE__ */ H({
404
- ...Ue,
405
- props: He,
406
- emits: Ke,
407
- setup(e, { emit: t }) {
408
- const n = e, s = K(), {
409
- id: r,
410
- disabled: l,
411
- readonly: o,
412
- valid: y,
413
- invalid: a,
414
- propsSwitch: v,
415
- modelValue: u,
416
- indeterminate: i,
417
- isInGroup: m
418
- } = Fe(n, t), p = Me(r), b = c(() => k.value ? -1 : n.tabindex), g = ve(), f = c(
419
- () => n.uncheckedValue !== void 0 && !m.value
420
- ), k = c(() => l.value || o.value), _ = c(() => {
421
- if (a.value === !0)
422
- return !0;
423
- if (y.value === !0)
424
- return !1;
425
- }), O = c(() => f.value ? u.value === n.value : Array.isArray(u.value) ? Be(n.value, u.value) : Q(n.value, u.value)), B = c(() => !!(i.value || !O.value && f.value && n.uncheckedValue !== u.value)), E = c(() => {
426
- if (!f.value)
427
- return ["string", "number", "boolean"].includes(typeof n.value) ? n.value : !0;
428
- }), S = c({
641
+ };
642
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
643
+ ...__default__$1,
644
+ props: VvCheckboxProps,
645
+ emits: VvCheckboxEvents,
646
+ setup(__props, { emit }) {
647
+ const props = __props;
648
+ const slots = useSlots();
649
+ const {
650
+ id,
651
+ disabled,
652
+ readonly,
653
+ valid,
654
+ invalid,
655
+ propsSwitch,
656
+ modelValue,
657
+ indeterminate,
658
+ isInGroup
659
+ } = useGroupProps(props, emit);
660
+ const hasId = useUniqueId(id);
661
+ const tabindex = computed(() => isDisabled.value ? -1 : props.tabindex);
662
+ const input = ref();
663
+ const isBinary = computed(
664
+ () => props.uncheckedValue !== void 0 && !isInGroup.value
665
+ );
666
+ const isDisabled = computed(() => disabled.value || readonly.value);
667
+ const isInvalid = computed(() => {
668
+ if (invalid.value === true) {
669
+ return true;
670
+ }
671
+ if (valid.value === true) {
672
+ return false;
673
+ }
674
+ return void 0;
675
+ });
676
+ const isChecked = computed(() => {
677
+ if (isBinary.value) {
678
+ return modelValue.value === props.value;
679
+ }
680
+ return Array.isArray(modelValue.value) ? contains(props.value, modelValue.value) : equals(props.value, modelValue.value);
681
+ });
682
+ const isIndeterminated = computed(() => {
683
+ if (indeterminate.value) {
684
+ return true;
685
+ }
686
+ if (!isChecked.value && isBinary.value && props.uncheckedValue !== modelValue.value) {
687
+ return true;
688
+ }
689
+ return false;
690
+ });
691
+ const hasValue = computed(() => {
692
+ if (isBinary.value) {
693
+ return void 0;
694
+ }
695
+ return ["string", "number", "boolean"].includes(typeof props.value) ? props.value : true;
696
+ });
697
+ const localModelValue = computed({
429
698
  get() {
430
- return O.value;
699
+ return isChecked.value;
431
700
  },
432
- set(h) {
433
- if (f.value)
434
- u.value = h ? n.value : n.uncheckedValue;
435
- else if (Array.isArray(u.value) || m.value) {
436
- const V = new Set(
437
- Array.isArray(u.value) ? u.value : u.value !== void 0 ? [u.value] : []
701
+ set(newValue) {
702
+ if (isBinary.value) {
703
+ modelValue.value = newValue ? props.value : props.uncheckedValue;
704
+ } else if (Array.isArray(modelValue.value) || isInGroup.value) {
705
+ const toReturn = new Set(
706
+ Array.isArray(modelValue.value) ? modelValue.value : modelValue.value !== void 0 ? [modelValue.value] : []
438
707
  );
439
- h ? V.add(n.value) : V.delete(n.value), u.value = [...V];
440
- } else
441
- u.value = h ? n.value : void 0;
442
- t("change", h);
708
+ if (newValue) {
709
+ toReturn.add(props.value);
710
+ } else {
711
+ toReturn.delete(props.value);
712
+ }
713
+ modelValue.value = [...toReturn];
714
+ } else {
715
+ modelValue.value = newValue ? props.value : void 0;
716
+ }
717
+ emit("change", newValue);
443
718
  }
444
- }), { modifiers: ae } = A(n), oe = re(
719
+ });
720
+ const { modifiers } = toRefs(props);
721
+ const bemCssClasses = useModifiers(
445
722
  "vv-checkbox",
446
- ae,
447
- c(() => ({
448
- switch: v.value,
449
- valid: y.value,
450
- invalid: a.value,
451
- disabled: l.value,
452
- readonly: o.value,
453
- indeterminate: i.value
723
+ modifiers,
724
+ computed(() => ({
725
+ switch: propsSwitch.value,
726
+ valid: valid.value,
727
+ invalid: invalid.value,
728
+ disabled: disabled.value,
729
+ readonly: readonly.value,
730
+ indeterminate: indeterminate.value
454
731
  }))
455
732
  );
456
- fe(() => {
457
- f.value && Array.isArray(u.value) && console.warn(
458
- "[VvCheckbox] The model value is an array but the component is in binary mode."
459
- );
460
- }), de(
461
- () => B.value,
462
- (h) => {
463
- h ? g.value.indeterminate = !0 : g.value.indeterminate = !1;
733
+ watchEffect(() => {
734
+ if (isBinary.value && Array.isArray(modelValue.value)) {
735
+ console.warn(
736
+ `[VvCheckbox] The model value is an array but the component is in binary mode.`
737
+ );
738
+ }
739
+ });
740
+ watch(
741
+ () => isIndeterminated.value,
742
+ (newValue) => {
743
+ if (newValue) {
744
+ input.value.indeterminate = true;
745
+ } else {
746
+ input.value.indeterminate = false;
747
+ }
748
+ }
749
+ );
750
+ onMounted(() => {
751
+ if (isIndeterminated.value) {
752
+ input.value.indeterminate = true;
464
753
  }
465
- ), pe(() => {
466
- B.value && (g.value.indeterminate = !0);
467
754
  });
468
- const { HintSlot: le } = Z(n, s);
469
- return (h, V) => (j(), x("label", {
470
- class: F(d(oe)),
471
- for: d(p)
472
- }, [
473
- ye(M("input", {
474
- id: d(p),
475
- ref_key: "input",
476
- ref: g,
477
- "onUpdate:modelValue": V[0] || (V[0] = (ue) => q(S) ? S.value = ue : null),
478
- type: "checkbox",
479
- class: "vv-checkbox__input",
480
- name: h.name,
481
- disabled: d(k),
482
- value: d(E),
483
- tabindex: d(b),
484
- "aria-invalid": d(_)
485
- }, null, 8, ze), [
486
- [be, d(S)]
487
- ]),
488
- z(h.$slots, "default", { value: d(u) }, () => [
489
- ge(U(h.label), 1)
490
- ]),
491
- J(d(le), {
492
- class: "vv-checkbox__hint",
493
- params: { value: d(u) }
494
- }, null, 8, ["params"])
495
- ], 10, qe));
755
+ const { HintSlot } = HintSlotFactory(props, slots);
756
+ return (_ctx, _cache) => {
757
+ return openBlock(), createElementBlock("label", {
758
+ class: normalizeClass(unref(bemCssClasses)),
759
+ for: unref(hasId)
760
+ }, [
761
+ withDirectives(createElementVNode("input", {
762
+ id: unref(hasId),
763
+ ref_key: "input",
764
+ ref: input,
765
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null),
766
+ type: "checkbox",
767
+ class: "vv-checkbox__input",
768
+ name: _ctx.name,
769
+ disabled: unref(isDisabled),
770
+ value: unref(hasValue),
771
+ tabindex: unref(tabindex),
772
+ "aria-invalid": unref(isInvalid)
773
+ }, null, 8, _hoisted_2$1), [
774
+ [vModelCheckbox, unref(localModelValue)]
775
+ ]),
776
+ renderSlot(_ctx.$slots, "default", { value: unref(modelValue) }, () => [
777
+ createTextVNode(toDisplayString(_ctx.label), 1)
778
+ ]),
779
+ createVNode(unref(HintSlot), {
780
+ class: "vv-checkbox__hint",
781
+ params: { value: unref(modelValue) }
782
+ }, null, 8, ["params"])
783
+ ], 10, _hoisted_1$1);
784
+ };
496
785
  }
497
- }), Te = we, We = ["update:modelValue", "change"];
498
- function Ye(e) {
499
- if (Object.keys(e).some(
500
- (t) => t !== "key" && !q(e[t])
786
+ });
787
+ const VvCheckboxGroupProps = CheckboxRadioGroupProps;
788
+ const VvCheckboxGroupEvents = ["update:modelValue", "change"];
789
+ function useProvideGroupState(groupState) {
790
+ if (Object.keys(groupState).some(
791
+ (k) => k !== "key" && !isRef(groupState[k])
501
792
  ))
502
793
  throw Error("One or more groupState props aren't ref.");
503
- he(
504
- e.key,
505
- c(() => e)
794
+ provide(
795
+ groupState.key,
796
+ computed(() => groupState)
506
797
  );
507
798
  }
508
- function Qe(e) {
509
- const { options: t, labelKey: n, valueKey: s, disabledKey: r } = A(e);
799
+ function useOptions(props) {
800
+ const { options, labelKey, valueKey, disabledKey } = toRefs(props);
801
+ const getOptionLabel = (option) => {
802
+ if (typeof option !== "object" && option !== null)
803
+ return option;
804
+ return typeof labelKey.value === "function" ? labelKey.value(option) : option[labelKey.value];
805
+ };
806
+ const getOptionValue = (option) => {
807
+ if (typeof option !== "object" && option !== null)
808
+ return option;
809
+ return typeof valueKey.value === "function" ? valueKey.value(option) : option[valueKey.value];
810
+ };
811
+ const getOptionDisabled = (option) => {
812
+ if (typeof option !== "object" && option !== null)
813
+ return false;
814
+ return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
815
+ };
510
816
  return {
511
- options: t,
512
- getOptionLabel: (a) => typeof a != "object" && a !== null ? a : typeof n.value == "function" ? n.value(a) : a[n.value],
513
- getOptionValue: (a) => typeof a != "object" && a !== null ? a : typeof s.value == "function" ? s.value(a) : a[s.value],
514
- getOptionDisabled: (a) => typeof a != "object" && a !== null ? !1 : typeof r.value == "function" ? r.value(a) : a[r.value]
817
+ options,
818
+ getOptionLabel,
819
+ getOptionValue,
820
+ getOptionDisabled
515
821
  };
516
822
  }
517
- const Xe = ["textContent"], Ze = { class: "vv-checkbox-group__wrapper" }, Le = {
823
+ const _hoisted_1 = ["textContent"];
824
+ const _hoisted_2 = { class: "vv-checkbox-group__wrapper" };
825
+ const __default__ = {
518
826
  name: "VvCheckboxGroup"
519
- }, rt = /* @__PURE__ */ H({
520
- ...Le,
521
- props: Te,
522
- emits: We,
523
- setup(e, { emit: t }) {
524
- const n = e, s = K(), r = je(n, "modelValue", t), { disabled: l, readonly: o, vertical: y, valid: a, invalid: v, modifiers: u } = A(n);
525
- Ye({
526
- key: Y,
527
- modelValue: r,
528
- disabled: l,
529
- readonly: o,
530
- valid: a,
531
- invalid: v
827
+ };
828
+ const _sfc_main = /* @__PURE__ */ defineComponent({
829
+ ...__default__,
830
+ props: VvCheckboxGroupProps,
831
+ emits: VvCheckboxGroupEvents,
832
+ setup(__props, { emit }) {
833
+ const props = __props;
834
+ const slots = useSlots();
835
+ const modelValue = useVModel(props, "modelValue", emit);
836
+ const { disabled, readonly, vertical, valid, invalid, modifiers } = toRefs(props);
837
+ useProvideGroupState({
838
+ key: INJECTION_KEY_CHECK_GROUP,
839
+ modelValue,
840
+ disabled,
841
+ readonly,
842
+ valid,
843
+ invalid
532
844
  });
533
- const { getOptionLabel: i, getOptionValue: m } = Qe(n), p = re(
845
+ const { getOptionLabel, getOptionValue } = useOptions(props);
846
+ const bemCssClasses = useModifiers(
534
847
  "vv-checkbox-group",
535
- u,
536
- c(() => ({
537
- disabled: l.value,
538
- readonly: o.value,
539
- horizontal: !y.value,
540
- valid: a.value,
541
- invalid: v.value
848
+ modifiers,
849
+ computed(() => ({
850
+ disabled: disabled.value,
851
+ readonly: readonly.value,
852
+ horizontal: !vertical.value,
853
+ valid: valid.value,
854
+ invalid: invalid.value
542
855
  }))
543
- ), b = (f, k) => ({
544
- id: `${n.name}_opt${k}`,
545
- name: n.name,
546
- label: i(f),
547
- value: m(f)
548
- }), { HintSlot: g } = Z(n, s);
549
- return (f, k) => (j(), x("fieldset", {
550
- class: F(d(p))
551
- }, [
552
- f.label ? (j(), x("legend", {
553
- key: 0,
554
- textContent: U(f.label)
555
- }, null, 8, Xe)) : me("", !0),
556
- M("div", Ze, [
557
- f.options.length > 0 ? (j(!0), x(ke, { key: 0 }, Se(f.options, (_, O) => (j(), Oe(Je, _e({ key: O }, b(_, O)), null, 16))), 128)) : z(f.$slots, "default", { key: 1 })
558
- ]),
559
- J(d(g), { class: "vv-checkbox-group__hint" })
560
- ], 2));
856
+ );
857
+ const getOptionProps = (option, index) => {
858
+ return {
859
+ id: `${props.name}_opt${index}`,
860
+ name: props.name,
861
+ label: getOptionLabel(option),
862
+ value: getOptionValue(option)
863
+ };
864
+ };
865
+ const { HintSlot } = HintSlotFactory(props, slots);
866
+ return (_ctx, _cache) => {
867
+ return openBlock(), createElementBlock("fieldset", {
868
+ class: normalizeClass(unref(bemCssClasses))
869
+ }, [
870
+ _ctx.label ? (openBlock(), createElementBlock("legend", {
871
+ key: 0,
872
+ textContent: toDisplayString(_ctx.label)
873
+ }, null, 8, _hoisted_1)) : createCommentVNode("", true),
874
+ createElementVNode("div", _hoisted_2, [
875
+ _ctx.options.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.options, (option, index) => {
876
+ return openBlock(), createBlock(_sfc_main$1, mergeProps({ key: index }, getOptionProps(option, index)), null, 16);
877
+ }), 128)) : renderSlot(_ctx.$slots, "default", { key: 1 })
878
+ ]),
879
+ createVNode(unref(HintSlot), { class: "vv-checkbox-group__hint" })
880
+ ], 2);
881
+ };
561
882
  }
562
883
  });
563
884
  export {
564
- rt as default
885
+ _sfc_main as default
565
886
  };