@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,7 +1,7 @@
1
- import { inject as D, computed as d, unref as i, defineComponent as E, ref as S, toRefs as F, openBlock as g, createBlock as C, mergeProps as _, createCommentVNode as $, Transition as I, toHandlers as P, withCtx as z, withDirectives as L, createElementVNode as f, createElementBlock as V, renderSlot as y, createTextVNode as M, toDisplayString as A, createVNode as q, vShow as H } from "vue";
2
- import { iconExists as v, Icon as R, addIcon as W } from "@iconify/vue";
3
- import { useVModel as J, onClickOutside as K, onKeyStroke as Y } from "@vueuse/core";
4
- const G = {
1
+ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, Transition, toHandlers, withCtx, withDirectives, createElementVNode, createElementBlock, renderSlot, createTextVNode, toDisplayString, createVNode, vShow } from "vue";
2
+ import { iconExists, Icon, addIcon } from "@iconify/vue";
3
+ import { onClickOutside, onKeyStroke } from "@vueuse/core";
4
+ const VvIconProps = {
5
5
  /**
6
6
  * Color
7
7
  */
@@ -25,7 +25,7 @@ const G = {
25
25
  */
26
26
  name: {
27
27
  type: String,
28
- required: !0
28
+ required: true
29
29
  },
30
30
  /**
31
31
  * By default 'vv'
@@ -95,77 +95,160 @@ const G = {
95
95
  type: [String, Array]
96
96
  }
97
97
  };
98
- var w = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(w || {}), N = /* @__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))(N || {}), B = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))(B || {}), O = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(O || {}), j = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(j || {});
99
- const Q = Symbol.for("volver");
100
- function T() {
101
- return D(Q);
98
+ var Side = /* @__PURE__ */ ((Side2) => {
99
+ Side2["left"] = "left";
100
+ Side2["right"] = "right";
101
+ Side2["top"] = "top";
102
+ Side2["bottom"] = "bottom";
103
+ return Side2;
104
+ })(Side || {});
105
+ var Placement = /* @__PURE__ */ ((Placement2) => {
106
+ Placement2["topStart"] = "top-start";
107
+ Placement2["topEnd"] = "top-end";
108
+ Placement2["bottomStart"] = "bottom-start";
109
+ Placement2["bottomEnd"] = "bottom-end";
110
+ Placement2["leftStart"] = "left-start";
111
+ Placement2["leftEnd"] = "left-end";
112
+ Placement2["rightStart"] = "right-start";
113
+ Placement2["rightEnd"] = "right-end";
114
+ return Placement2;
115
+ })(Placement || {});
116
+ var Position = /* @__PURE__ */ ((Position2) => {
117
+ Position2["before"] = "before";
118
+ Position2["after"] = "after";
119
+ return Position2;
120
+ })(Position || {});
121
+ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
122
+ ButtonType2["button"] = "button";
123
+ ButtonType2["submit"] = "submit";
124
+ ButtonType2["reset"] = "reset";
125
+ return ButtonType2;
126
+ })(ButtonType || {});
127
+ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
128
+ AnchorTarget2["_blank"] = "_blank";
129
+ AnchorTarget2["_self"] = "_self";
130
+ AnchorTarget2["_parent"] = "_parent";
131
+ AnchorTarget2["_top"] = "_top";
132
+ return AnchorTarget2;
133
+ })(AnchorTarget || {});
134
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
135
+ function useVolver() {
136
+ return inject(INJECTION_KEY_VOLVER);
102
137
  }
103
- function U(e, r, a) {
104
- return d(() => {
105
- const n = {
106
- [e]: !0
107
- }, l = typeof (r == null ? void 0 : r.value) == "string" ? r.value.split(" ") : r == null ? void 0 : r.value;
108
- return l && Array.isArray(l) && l.forEach((s) => {
109
- n[`${e}--${s}`] = !0;
110
- }), a && Object.keys(a.value).forEach((s) => {
111
- n[`${e}--${s}`] = i(a.value[s]);
112
- }), n;
138
+ function useModifiers(prefix, modifiers, others) {
139
+ return computed(() => {
140
+ const toReturn = {
141
+ [prefix]: true
142
+ };
143
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
144
+ if (modifiersArray) {
145
+ if (Array.isArray(modifiersArray)) {
146
+ modifiersArray.forEach((modifier) => {
147
+ if (modifier) {
148
+ toReturn[`${prefix}--${modifier}`] = true;
149
+ }
150
+ });
151
+ }
152
+ }
153
+ if (others) {
154
+ Object.keys(others.value).forEach((key) => {
155
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
156
+ });
157
+ }
158
+ return toReturn;
113
159
  });
114
160
  }
115
- const X = {
161
+ const __default__$1 = {
116
162
  name: "VvIcon"
117
- }, Z = /* @__PURE__ */ E({
118
- ...X,
119
- props: G,
120
- setup(e) {
121
- const r = e, a = S(!0), n = T(), { modifiers: l } = F(r), s = U("vv-icon", l), u = d(() => r.provider || (n == null ? void 0 : n.provider)), m = d(() => {
122
- const t = r.name ?? "", o = `@${u.value}:${r.prefix}:${r.name}`;
123
- return v(t) ? t : v(o) ? o : (n == null ? void 0 : n.iconsCollections.find(
124
- (c) => {
125
- const h = `@${u.value}:${c.prefix}:${t}`;
126
- if (v(h))
127
- return h;
128
- }
129
- )) || t;
163
+ };
164
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
165
+ ...__default__$1,
166
+ props: VvIconProps,
167
+ setup(__props) {
168
+ const props = __props;
169
+ const show = ref(true);
170
+ const volver = useVolver();
171
+ const { modifiers } = toRefs(props);
172
+ const bemCssClasses = useModifiers("vv-icon", modifiers);
173
+ const provider = computed(() => {
174
+ return props.provider || (volver == null ? void 0 : volver.iconsProvider);
175
+ });
176
+ const icon = computed(() => {
177
+ const _name = props.name ?? "";
178
+ const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
179
+ if (iconExists(_name)) {
180
+ return _name;
181
+ } else if (iconExists(iconName)) {
182
+ return iconName;
183
+ } else {
184
+ return (volver == null ? void 0 : volver.iconsCollections.find(
185
+ (iconsCollection) => {
186
+ const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
187
+ if (iconExists(icon2)) {
188
+ return icon2;
189
+ }
190
+ }
191
+ )) || _name;
192
+ }
130
193
  });
131
- function b(t) {
132
- let o = null;
133
- if (typeof window > "u") {
134
- const { JSDOM: k } = require("jsdom");
135
- o = new k().window;
194
+ function getSvgContent(svg) {
195
+ let dom = null;
196
+ if (typeof window === "undefined") {
197
+ const { JSDOM } = require("jsdom");
198
+ dom = new JSDOM().window;
136
199
  }
137
- return (o ? new o.DOMParser() : new window.DOMParser()).parseFromString(t, "text/html").querySelector("svg");
200
+ const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
201
+ const svgDomString = domParser.parseFromString(svg, "text/html");
202
+ const svgEl = svgDomString.querySelector("svg");
203
+ return svgEl;
138
204
  }
139
- function p(t) {
140
- const o = b(t), c = (o == null ? void 0 : o.innerHTML.trim()) || "";
141
- o && c && W(`@${u.value}:${r.prefix}:${r.name}`, {
142
- body: c,
143
- // Set height and width from svg content
144
- height: o.viewBox.baseVal.height,
145
- width: o.viewBox.baseVal.width
146
- });
205
+ function addIconFromSvg(svg) {
206
+ const svgContentEl = getSvgContent(svg);
207
+ const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
208
+ if (svgContentEl && svgContent) {
209
+ addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
210
+ body: svgContent,
211
+ // Set height and width from svg content
212
+ height: svgContentEl.viewBox.baseVal.height,
213
+ width: svgContentEl.viewBox.baseVal.width
214
+ });
215
+ }
147
216
  }
148
- return n && (r.src && !v(`@${u.value}:${r.prefix}:${r.name}`) ? (a.value = !1, n.fetchIcon(r.src).then((t) => {
149
- t && (p(t), a.value = !0);
150
- }).catch((t) => {
151
- throw new Error(`During fetch icon: ${t == null ? void 0 : t.message}`);
152
- })) : r.svg && p(r.svg)), (t, o) => i(a) ? (g(), C(i(R), _({
153
- key: 0,
154
- class: i(s)
155
- }, {
156
- inline: t.inline,
157
- width: t.width,
158
- height: t.height,
159
- horizontalFlip: t.horizontalFlip,
160
- verticalFlip: t.verticalFlip,
161
- flip: t.flip,
162
- rotate: t.rotate,
163
- color: t.color,
164
- onLoad: t.onLoad,
165
- icon: i(m)
166
- }), null, 16, ["class"])) : $("", !0);
217
+ if (volver) {
218
+ if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
219
+ show.value = false;
220
+ volver.fetchIcon(props.src).then((svg) => {
221
+ if (svg) {
222
+ addIconFromSvg(svg);
223
+ show.value = true;
224
+ }
225
+ }).catch((e) => {
226
+ throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
227
+ });
228
+ } else if (props.svg) {
229
+ addIconFromSvg(props.svg);
230
+ }
231
+ }
232
+ return (_ctx, _cache) => {
233
+ return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
234
+ key: 0,
235
+ class: unref(bemCssClasses)
236
+ }, {
237
+ inline: _ctx.inline,
238
+ width: _ctx.width,
239
+ height: _ctx.height,
240
+ horizontalFlip: _ctx.horizontalFlip,
241
+ verticalFlip: _ctx.verticalFlip,
242
+ flip: _ctx.flip,
243
+ rotate: _ctx.rotate,
244
+ color: _ctx.color,
245
+ onLoad: _ctx.onLoad,
246
+ icon: unref(icon)
247
+ }), null, 16, ["class"])) : createCommentVNode("", true);
248
+ };
167
249
  }
168
- }), x = {
250
+ });
251
+ const LinkProps = {
169
252
  /**
170
253
  * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
171
254
  * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
@@ -182,7 +265,7 @@ const X = {
182
265
  */
183
266
  target: {
184
267
  type: String,
185
- validator: (e) => Object.values(j).includes(e)
268
+ validator: (value) => Object.values(AnchorTarget).includes(value)
186
269
  },
187
270
  /**
188
271
  * Anchor rel
@@ -191,49 +274,157 @@ const X = {
191
274
  type: String,
192
275
  default: "noopener noreferrer"
193
276
  }
194
- }, ee = {
277
+ };
278
+ const DisabledProps = {
195
279
  /**
196
280
  * Whether the form control is disabled
197
281
  */
198
282
  disabled: Boolean
199
- }, te = {
283
+ };
284
+ const ActiveProps = {
200
285
  /**
201
286
  * Whether the item is active
202
287
  */
203
288
  active: Boolean
204
- }, oe = {
289
+ };
290
+ const PressedProps = {
205
291
  /**
206
292
  * Whether the item is pressed
207
293
  */
208
294
  pressed: Boolean
209
- }, re = {
295
+ };
296
+ const LabelProps = {
210
297
  /**
211
298
  * The item label
212
299
  */
213
300
  label: [String, Number]
214
301
  };
215
- B.before;
216
- const ne = {
302
+ ({
303
+ /**
304
+ * VvIcon name or props
305
+ * @see VVIcon
306
+ */
307
+ icon: { type: [String, Object] },
308
+ /**
309
+ * VvIcon position
310
+ */
311
+ iconPosition: {
312
+ type: String,
313
+ default: Position.before,
314
+ validation: (value) => Object.values(Position).includes(value)
315
+ }
316
+ });
317
+ const IdProps = {
217
318
  /**
218
319
  * Global attribute id
219
320
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
220
321
  */
221
322
  id: [String, Number]
222
323
  };
223
- w.bottom;
224
324
  ({
225
- ...ee,
226
- ...re,
227
- ...oe,
228
- ...te,
229
- ...x,
325
+ /**
326
+ * Dropdown placement
327
+ */
328
+ placement: {
329
+ type: String,
330
+ default: Side.bottom,
331
+ validator: (value) => {
332
+ return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
333
+ }
334
+ },
335
+ /**
336
+ * Dropdown show / hide transition name
337
+ */
338
+ transitionName: {
339
+ type: String
340
+ },
341
+ /**
342
+ * Offset of the dropdown from the trigger
343
+ * @see https://floating-ui.com/docs/offset
344
+ */
345
+ offset: {
346
+ type: [Number, String, Object],
347
+ default: 0
348
+ },
349
+ /**
350
+ * Move dropdown to the side if there is no space in the default position
351
+ * @see https://floating-ui.com/docs/shift
352
+ */
353
+ shift: {
354
+ type: [Boolean, Object],
355
+ default: false
356
+ },
357
+ /**
358
+ * Flip dropdown position if there is no space in the default position
359
+ * @see https://floating-ui.com/docs/flip
360
+ */
361
+ flip: {
362
+ type: [Boolean, Object],
363
+ default: true
364
+ },
365
+ /**
366
+ * Size of the dropdown
367
+ * @see https://floating-ui.com/docs/size
368
+ */
369
+ size: {
370
+ type: [Boolean, Object],
371
+ default: () => ({ padding: 10 })
372
+ },
373
+ /**
374
+ * Automatically change the position of the dropdown
375
+ * @see https://floating-ui.com/docs/autoPlacement
376
+ */
377
+ autoPlacement: {
378
+ type: [Boolean, Object],
379
+ default: false
380
+ },
381
+ /**
382
+ * Add arrow to the dropdown
383
+ * @see https://floating-ui.com/docs/arrow
384
+ */
385
+ arrow: {
386
+ type: Boolean,
387
+ default: false
388
+ },
389
+ /**
390
+ * Close dropdown on click outside
391
+ */
392
+ autoClose: {
393
+ type: Boolean,
394
+ default: true
395
+ },
396
+ /**
397
+ * Autofocus first item on dropdown open
398
+ */
399
+ autofocusFirst: {
400
+ type: Boolean,
401
+ default: true
402
+ },
403
+ /**
404
+ * Set dropdown width to the same as the trigger
405
+ */
406
+ triggerWidth: {
407
+ type: Boolean
408
+ }
409
+ });
410
+ ({
411
+ ...DisabledProps,
412
+ ...LabelProps,
413
+ ...PressedProps,
414
+ ...ActiveProps,
415
+ ...LinkProps,
230
416
  /**
231
417
  * Button type
232
418
  */
233
- type: O.button
419
+ type: {
420
+ type: String,
421
+ default: ButtonType.button,
422
+ validator: (value) => Object.values(ButtonType).includes(value)
423
+ }
234
424
  });
235
- const ae = ["open", "close", "update:modelValue"], le = {
236
- ...ne,
425
+ const VvDialogEvents = ["open", "close", "update:modelValue"];
426
+ const VvDialogProps = {
427
+ ...IdProps,
237
428
  /**
238
429
  * Dialog title
239
430
  */
@@ -241,7 +432,10 @@ const ae = ["open", "close", "update:modelValue"], le = {
241
432
  /**
242
433
  * Show / hide dialog programmatically
243
434
  */
244
- modelValue: Boolean,
435
+ modelValue: {
436
+ type: Boolean,
437
+ default: void 0
438
+ },
245
439
  /**
246
440
  * Dialog transition
247
441
  */
@@ -253,78 +447,120 @@ const ae = ["open", "close", "update:modelValue"], le = {
253
447
  /**
254
448
  * Close dialog on click outside
255
449
  */
256
- autoClose: { type: Boolean, default: !0 }
257
- }, se = {
450
+ autoClose: { type: Boolean, default: true }
451
+ };
452
+ const _hoisted_1 = {
258
453
  key: 0,
259
454
  class: "vv-dialog__header"
260
- }, ie = { class: "vv-dialog__content" }, ue = {
455
+ };
456
+ const _hoisted_2 = { class: "vv-dialog__content" };
457
+ const _hoisted_3 = {
261
458
  key: 1,
262
459
  class: "vv-dialog__footer"
263
- }, ce = {
460
+ };
461
+ const __default__ = {
264
462
  name: "VvDialog"
265
- }, ge = /* @__PURE__ */ E({
266
- ...ce,
267
- props: le,
268
- emits: ae,
269
- setup(e, { emit: r }) {
270
- const a = e, n = J(a, "modelValue", r), l = S(!0), s = S(null), u = d(() => {
271
- const { id: o } = a;
463
+ };
464
+ const _sfc_main = /* @__PURE__ */ defineComponent({
465
+ ...__default__,
466
+ props: VvDialogProps,
467
+ emits: VvDialogEvents,
468
+ setup(__props, { expose, emit }) {
469
+ const props = __props;
470
+ const localModelValue = ref(false);
471
+ const modelValue = computed({
472
+ get() {
473
+ return props.modelValue ?? localModelValue.value;
474
+ },
475
+ set(value) {
476
+ if (props.modelValue === void 0) {
477
+ localModelValue.value = value;
478
+ }
479
+ emit("update:modelValue", value);
480
+ }
481
+ });
482
+ const htmlAttrIsOpen = ref(true);
483
+ const modalWrapper = ref(null);
484
+ const dialogAttrs = computed(() => {
485
+ const { id } = props;
272
486
  return {
273
- id: o,
274
- open: l.value
487
+ id,
488
+ open: htmlAttrIsOpen.value
275
489
  };
276
- }), m = d(() => a.size ? ["vv-dialog", `vv-dialog--${a.size}`] : "vv-dialog"), b = d(() => `vv-dialog--${a.transition}`), p = {
490
+ });
491
+ const dialogClass = computed(() => {
492
+ if (!props.size) {
493
+ return "vv-dialog";
494
+ }
495
+ return ["vv-dialog", `vv-dialog--${props.size}`];
496
+ });
497
+ const transitioName = computed(() => `vv-dialog--${props.transition}`);
498
+ const dialogTransitionHandlers = {
277
499
  "before-enter": () => {
278
- l.value = !0, r("open");
500
+ htmlAttrIsOpen.value = true;
501
+ emit("open");
279
502
  },
280
503
  "after-leave": () => {
281
- l.value = !1, r("close");
504
+ htmlAttrIsOpen.value = false;
505
+ emit("close");
282
506
  }
283
507
  };
284
- K(s, () => {
285
- a.autoClose && (n.value = !1);
508
+ onClickOutside(modalWrapper, () => {
509
+ if (props.autoClose) {
510
+ modelValue.value = false;
511
+ }
286
512
  });
287
- function t() {
288
- n.value = !1;
513
+ function close() {
514
+ modelValue.value = false;
515
+ }
516
+ function open() {
517
+ modelValue.value = true;
289
518
  }
290
- return Y("Escape", (o) => {
291
- n.value && (o.preventDefault(), t());
292
- }), (o, c) => (g(), C(I, _({ name: i(b) }, P(p)), {
293
- default: z(() => [
294
- L(f("dialog", _(i(u), { class: i(m) }), [
295
- f("article", {
296
- ref_key: "modalWrapper",
297
- ref: s,
298
- class: "vv-dialog__wrapper"
299
- }, [
300
- o.$slots.header || o.title ? (g(), V("header", se, [
301
- y(o.$slots, "header", {}, () => [
302
- M(A(o.title) + " ", 1),
303
- f("button", {
304
- type: "button",
305
- "aria-label": "Close",
306
- class: "vv-dialog__close",
307
- onClickPassive: t
308
- }, [
309
- q(Z, { name: "close" })
310
- ], 32)
311
- ])
312
- ])) : $("", !0),
313
- f("div", ie, [
314
- y(o.$slots, "default")
315
- ]),
316
- o.$slots.footer ? (g(), V("footer", ue, [
317
- y(o.$slots, "footer")
318
- ])) : $("", !0)
319
- ], 512)
320
- ], 16), [
321
- [H, i(n)]
322
- ])
323
- ]),
324
- _: 3
325
- }, 16, ["name"]));
519
+ expose({ close, open });
520
+ onKeyStroke("Escape", (e) => {
521
+ if (modelValue.value) {
522
+ e.preventDefault();
523
+ close();
524
+ }
525
+ });
526
+ return (_ctx, _cache) => {
527
+ return openBlock(), createBlock(Transition, mergeProps({ name: unref(transitioName) }, toHandlers(dialogTransitionHandlers)), {
528
+ default: withCtx(() => [
529
+ withDirectives(createElementVNode("dialog", mergeProps(unref(dialogAttrs), { class: unref(dialogClass) }), [
530
+ createElementVNode("article", {
531
+ ref_key: "modalWrapper",
532
+ ref: modalWrapper,
533
+ class: "vv-dialog__wrapper"
534
+ }, [
535
+ _ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header", _hoisted_1, [
536
+ renderSlot(_ctx.$slots, "header", {}, () => [
537
+ createTextVNode(toDisplayString(_ctx.title) + " ", 1),
538
+ createElementVNode("button", {
539
+ type: "button",
540
+ "aria-label": "Close",
541
+ class: "vv-dialog__close",
542
+ onClickPassive: close
543
+ }, [
544
+ createVNode(_sfc_main$1, { name: "close" })
545
+ ], 32)
546
+ ])
547
+ ])) : createCommentVNode("", true),
548
+ createElementVNode("div", _hoisted_2, [
549
+ renderSlot(_ctx.$slots, "default")
550
+ ]),
551
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_3, [
552
+ renderSlot(_ctx.$slots, "footer")
553
+ ])) : createCommentVNode("", true)
554
+ ], 512)
555
+ ], 16), [
556
+ [vShow, unref(modelValue)]
557
+ ])
558
+ ]),
559
+ _: 3
560
+ }, 16, ["name"]);
561
+ };
326
562
  }
327
563
  });
328
564
  export {
329
- ge as default
565
+ _sfc_main as default
330
566
  };
@@ -1 +1 @@
1
- (function(e,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("vue"),require("@iconify/vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],s):(e=typeof globalThis<"u"?globalThis:e||self,e.VvDialog=s(e.vue,e.vue$1,e.core))})(this,function(e,s,u){"use strict";const B={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var g=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(g||{}),v=(t=>(t.topStart="top-start",t.topEnd="top-end",t.bottomStart="bottom-start",t.bottomEnd="bottom-end",t.leftStart="left-start",t.leftEnd="left-end",t.rightStart="right-start",t.rightEnd="right-end",t))(v||{}),m=(t=>(t.before="before",t.after="after",t))(m||{}),b=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(b||{}),_=(t=>(t._blank="_blank",t._self="_self",t._parent="_parent",t._top="_top",t))(_||{});const V=Symbol.for("volver");function w(){return e.inject(V)}function E(t,r,a){return e.computed(()=>{const i={[t]:!0},l=typeof(r==null?void 0:r.value)=="string"?r.value.split(" "):r==null?void 0:r.value;return l&&Array.isArray(l)&&l.forEach(c=>{i[`${t}--${c}`]=!0}),a&&Object.keys(a.value).forEach(c=>{i[`${t}--${c}`]=e.unref(a.value[c])}),i})}const $={name:"VvIcon"},N=e.defineComponent({...$,props:B,setup(t){const r=t,a=e.ref(!0),i=w(),{modifiers:l}=e.toRefs(r),c=E("vv-icon",l),d=e.computed(()=>r.provider||(i==null?void 0:i.provider)),h=e.computed(()=>{const o=r.name??"",n=`@${d.value}:${r.prefix}:${r.name}`;return s.iconExists(o)?o:s.iconExists(n)?n:(i==null?void 0:i.iconsCollections.find(f=>{const S=`@${d.value}:${f.prefix}:${o}`;if(s.iconExists(S))return S}))||o});function y(o){let n=null;if(typeof window>"u"){const{JSDOM:A}=require("jsdom");n=new A().window}return(n?new n.DOMParser:new window.DOMParser).parseFromString(o,"text/html").querySelector("svg")}function p(o){const n=y(o),f=(n==null?void 0:n.innerHTML.trim())||"";n&&f&&s.addIcon(`@${d.value}:${r.prefix}:${r.name}`,{body:f,height:n.viewBox.baseVal.height,width:n.viewBox.baseVal.width})}return i&&(r.src&&!s.iconExists(`@${d.value}:${r.prefix}:${r.name}`)?(a.value=!1,i.fetchIcon(r.src).then(o=>{o&&(p(o),a.value=!0)}).catch(o=>{throw new Error(`During fetch icon: ${o==null?void 0:o.message}`)})):r.svg&&p(r.svg)),(o,n)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(s.Icon),e.mergeProps({key:0,class:e.unref(c)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:o.rotate,color:o.color,onLoad:o.onLoad,icon:e.unref(h)}),null,16,["class"])):e.createCommentVNode("",!0)}}),O={to:{type:[String,Object]},href:String,target:{type:String,validator:t=>Object.values(_).includes(t)},rel:{type:String,default:"noopener noreferrer"}},k={disabled:Boolean},C={active:Boolean},j={pressed:Boolean},D={label:[String,Number]};m.before;const P={id:[String,Number]};g.bottom,{...k,...D,...j,...C,...O,type:b.button};const F=["open","close","update:modelValue"],I={...P,title:String,modelValue:Boolean,transition:{type:String,default:"fade-block"},size:String,autoClose:{type:Boolean,default:!0}},z={key:0,class:"vv-dialog__header"},L={class:"vv-dialog__content"},q={key:1,class:"vv-dialog__footer"},M={name:"VvDialog"};return e.defineComponent({...M,props:I,emits:F,setup(t,{emit:r}){const a=t,i=u.useVModel(a,"modelValue",r),l=e.ref(!0),c=e.ref(null),d=e.computed(()=>{const{id:n}=a;return{id:n,open:l.value}}),h=e.computed(()=>a.size?["vv-dialog",`vv-dialog--${a.size}`]:"vv-dialog"),y=e.computed(()=>`vv-dialog--${a.transition}`),p={"before-enter":()=>{l.value=!0,r("open")},"after-leave":()=>{l.value=!1,r("close")}};u.onClickOutside(c,()=>{a.autoClose&&(i.value=!1)});function o(){i.value=!1}return u.onKeyStroke("Escape",n=>{i.value&&(n.preventDefault(),o())}),(n,f)=>(e.openBlock(),e.createBlock(e.Transition,e.mergeProps({name:e.unref(y)},e.toHandlers(p)),{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("dialog",e.mergeProps(e.unref(d),{class:e.unref(h)}),[e.createElementVNode("article",{ref_key:"modalWrapper",ref:c,class:"vv-dialog__wrapper"},[n.$slots.header||n.title?(e.openBlock(),e.createElementBlock("header",z,[e.renderSlot(n.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(n.title)+" ",1),e.createElementVNode("button",{type:"button","aria-label":"Close",class:"vv-dialog__close",onClickPassive:o},[e.createVNode(N,{name:"close"})],32)])])):e.createCommentVNode("",!0),e.createElementVNode("div",L,[e.renderSlot(n.$slots,"default")]),n.$slots.footer?(e.openBlock(),e.createElementBlock("footer",q,[e.renderSlot(n.$slots,"footer")])):e.createCommentVNode("",!0)],512)],16),[[e.vShow,e.unref(i)]])]),_:3},16,["name"]))}})});
1
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDialog=o(e.vue,e.vue$1,e.core)}(this,(function(e,o,t){"use strict";const n={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver");const s=e.defineComponent({name:"VvIcon",props:n,setup(t){const n=t,r=e.ref(!0),l=e.inject(a),{modifiers:i}=e.toRefs(n),s=function(o,t,n){return e.computed((()=>{const r={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-icon",i),u=e.computed((()=>n.provider||(null==l?void 0:l.iconsProvider))),c=e.computed((()=>{const e=n.name??"",t=`@${u.value}:${n.prefix}:${n.name}`;return o.iconExists(e)?e:o.iconExists(t)?t:(null==l?void 0:l.iconsCollections.find((t=>{const n=`@${u.value}:${t.prefix}:${e}`;if(o.iconExists(n))return n})))||e}));function d(e){const t=function(e){let o=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");o=(new e).window}return(o?new o.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),r=(null==t?void 0:t.innerHTML.trim())||"";t&&r&&o.addIcon(`@${u.value}:${n.prefix}:${n.name}`,{body:r,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return l&&(n.src&&!o.iconExists(`@${u.value}:${n.prefix}:${n.name}`)?(r.value=!1,l.fetchIcon(n.src).then((e=>{e&&(d(e),r.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):n.svg&&d(n.svg)),(t,n)=>e.unref(r)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(s)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:t.rotate,color:t.color,onLoad:t.onLoad,icon:e.unref(c)}),null,16,["class"])):e.createCommentVNode("",!0)}});Boolean,Boolean,Boolean;l.before;const u={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const c={...u,title:String,modelValue:{type:Boolean,default:void 0},transition:{type:String,default:"fade-block"},size:String,autoClose:{type:Boolean,default:!0}},d={key:0,class:"vv-dialog__header"},f={class:"vv-dialog__content"},v={key:1,class:"vv-dialog__footer"};return e.defineComponent({name:"VvDialog",props:c,emits:["open","close","update:modelValue"],setup(o,{expose:n,emit:r}){const l=o,i=e.ref(!1),a=e.computed({get:()=>l.modelValue??i.value,set(e){void 0===l.modelValue&&(i.value=e),r("update:modelValue",e)}}),u=e.ref(!0),c=e.ref(null),p=e.computed((()=>{const{id:e}=l;return{id:e,open:u.value}})),m=e.computed((()=>l.size?["vv-dialog",`vv-dialog--${l.size}`]:"vv-dialog")),g=e.computed((()=>`vv-dialog--${l.transition}`)),h={"before-enter":()=>{u.value=!0,r("open")},"after-leave":()=>{u.value=!1,r("close")}};function y(){a.value=!1}return t.onClickOutside(c,(()=>{l.autoClose&&(a.value=!1)})),n({close:y,open:function(){a.value=!0}}),t.onKeyStroke("Escape",(e=>{a.value&&(e.preventDefault(),y())})),(o,t)=>(e.openBlock(),e.createBlock(e.Transition,e.mergeProps({name:e.unref(g)},e.toHandlers(h)),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("dialog",e.mergeProps(e.unref(p),{class:e.unref(m)}),[e.createElementVNode("article",{ref_key:"modalWrapper",ref:c,class:"vv-dialog__wrapper"},[o.$slots.header||o.title?(e.openBlock(),e.createElementBlock("header",d,[e.renderSlot(o.$slots,"header",{},(()=>[e.createTextVNode(e.toDisplayString(o.title)+" ",1),e.createElementVNode("button",{type:"button","aria-label":"Close",class:"vv-dialog__close",onClickPassive:y},[e.createVNode(s,{name:"close"})],32)]))])):e.createCommentVNode("",!0),e.createElementVNode("div",f,[e.renderSlot(o.$slots,"default")]),o.$slots.footer?(e.openBlock(),e.createElementBlock("footer",v,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("",!0)],512)],16),[[e.vShow,e.unref(a)]])])),_:3},16,["name"]))}})}));