@volverjs/ui-vue 0.0.3 → 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 (236) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +54 -15
  3. package/auto-imports.d.ts +12 -3
  4. package/bin/icons.cjs +1 -73
  5. package/dist/Volver.d.ts +23 -11
  6. package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
  7. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  8. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  9. package/dist/components/VvAccordion/index.d.ts +8 -3
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  13. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  14. package/dist/components/VvAction/VvAction.es.js +338 -0
  15. package/dist/components/VvAction/VvAction.umd.js +1 -0
  16. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  17. package/dist/components/VvAction/index.d.ts +24 -0
  18. package/dist/components/VvBadge/VvBadge.es.js +251 -22
  19. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  21. package/dist/components/VvBadge/index.d.ts +1 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  24. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  25. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  26. package/dist/components/VvButton/VvButton.es.js +720 -261
  27. package/dist/components/VvButton/VvButton.umd.js +1 -1
  28. package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
  29. package/dist/components/VvButton/index.d.ts +30 -75
  30. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
  31. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  32. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  33. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  34. package/dist/components/VvCard/VvCard.es.js +60 -28
  35. package/dist/components/VvCard/VvCard.umd.js +1 -1
  36. package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
  37. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  38. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  39. package/dist/components/VvCheckbox/index.d.ts +6 -6
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  42. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
  43. package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
  44. package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
  45. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  46. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
  47. package/dist/components/VvCombobox/index.d.ts +54 -23
  48. package/dist/components/VvDialog/VvDialog.es.js +426 -115
  49. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  50. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  51. package/dist/components/VvDialog/index.d.ts +4 -1
  52. package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
  53. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  54. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
  55. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  56. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  57. package/dist/components/VvDropdown/index.d.ts +35 -14
  58. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
  59. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  60. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
  61. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  62. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
  63. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  64. package/dist/components/VvIcon/VvIcon.es.js +116 -52
  65. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  66. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  67. package/dist/components/VvIcon/index.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  69. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  70. package/dist/components/VvInputText/VvInputText.es.js +1054 -376
  71. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  72. package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
  73. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  74. package/dist/components/VvInputText/index.d.ts +67 -3
  75. package/dist/components/VvProgress/VvProgress.es.js +254 -23
  76. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  77. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  78. package/dist/components/VvProgress/index.d.ts +1 -1
  79. package/dist/components/VvRadio/VvRadio.es.js +568 -137
  80. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  81. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  82. package/dist/components/VvRadio/index.d.ts +6 -6
  83. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
  84. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  85. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
  86. package/dist/components/VvRadioGroup/index.d.ts +4 -4
  87. package/dist/components/VvSelect/VvSelect.es.js +703 -251
  88. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  89. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
  90. package/dist/components/VvSelect/index.d.ts +8 -8
  91. package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
  92. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  93. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
  94. package/dist/components/VvTextarea/index.d.ts +7 -7
  95. package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
  96. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  97. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  98. package/dist/components/VvTooltip/index.d.ts +2 -2
  99. package/dist/components/index.es.js +3676 -2007
  100. package/dist/components/index.umd.js +1 -1
  101. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  102. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  103. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  104. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  105. package/dist/composables/useComponentFocus.d.ts +1 -1
  106. package/dist/composables/useComponentIcon.d.ts +7 -7
  107. package/dist/composables/useDebouncedInput.d.ts +4 -1
  108. package/dist/composables/useDefaults.d.ts +2 -0
  109. package/dist/composables/useModifiers.d.ts +1 -1
  110. package/dist/composables/useOptions.d.ts +2 -2
  111. package/dist/composables/useTextCount.d.ts +3 -3
  112. package/dist/composables/useUniqueId.d.ts +1 -1
  113. package/dist/composables/useVolver.d.ts +1 -1
  114. package/dist/constants.d.ts +30 -0
  115. package/dist/directives/index.es.js +288 -0
  116. package/dist/directives/index.umd.js +1 -0
  117. package/dist/directives/v-tooltip.es.js +285 -0
  118. package/dist/directives/v-tooltip.umd.js +1 -0
  119. package/dist/icons.es.js +38 -23
  120. package/dist/icons.umd.js +1 -1
  121. package/dist/index.d.ts +0 -1
  122. package/dist/index.es.js +115 -3269
  123. package/dist/index.umd.js +1 -1
  124. package/dist/props/index.d.ts +215 -23
  125. package/dist/resolvers/unplugin.d.ts +14 -8
  126. package/dist/resolvers/unplugin.es.js +94 -33
  127. package/dist/resolvers/unplugin.umd.js +1 -1
  128. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  129. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  130. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  131. package/dist/stories/argTypes.d.ts +1 -1
  132. package/package.json +167 -63
  133. package/src/Volver.ts +60 -26
  134. package/src/assets/icons/detailed.json +1 -1
  135. package/src/assets/icons/normal.json +1 -1
  136. package/src/assets/icons/simple.json +1 -1
  137. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  138. package/src/components/VvAccordion/index.ts +12 -4
  139. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  140. package/src/components/VvAccordionGroup/index.ts +8 -0
  141. package/src/components/VvAction/VvAction.vue +144 -0
  142. package/src/components/VvAction/index.ts +5 -0
  143. package/src/components/VvBadge/VvBadge.vue +2 -2
  144. package/src/components/VvBadge/index.ts +1 -1
  145. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  146. package/src/components/VvButton/VvButton.vue +41 -124
  147. package/src/components/VvButton/index.ts +16 -88
  148. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  149. package/src/components/VvButtonGroup/index.ts +1 -1
  150. package/src/components/VvCard/VvCard.vue +2 -2
  151. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  152. package/src/components/VvCheckbox/index.ts +11 -7
  153. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  154. package/src/components/VvCheckboxGroup/index.ts +1 -1
  155. package/src/components/VvCombobox/VvCombobox.vue +85 -57
  156. package/src/components/VvCombobox/index.ts +12 -10
  157. package/src/components/VvDialog/VvDialog.vue +28 -11
  158. package/src/components/VvDialog/index.ts +5 -2
  159. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  160. package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
  161. package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
  162. package/src/components/VvDropdown/index.ts +6 -11
  163. package/src/components/VvIcon/VvIcon.vue +3 -3
  164. package/src/components/VvIcon/index.ts +3 -3
  165. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  166. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  167. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  168. package/src/components/VvInputText/VvInputText.vue +128 -35
  169. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  170. package/src/components/VvInputText/index.ts +62 -1
  171. package/src/components/VvProgress/VvProgress.vue +2 -2
  172. package/src/components/VvProgress/index.ts +1 -1
  173. package/src/components/VvRadio/VvRadio.vue +3 -7
  174. package/src/components/VvRadio/index.ts +11 -7
  175. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  176. package/src/components/VvRadioGroup/index.ts +1 -1
  177. package/src/components/VvSelect/VvSelect.vue +4 -4
  178. package/src/components/VvSelect/index.ts +3 -5
  179. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  180. package/src/components/VvTextarea/index.ts +1 -1
  181. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  182. package/src/components/VvTooltip/index.ts +3 -3
  183. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  184. package/src/composables/dropdown/useProvideDropdown.ts +9 -11
  185. package/src/composables/group/useInjectedGroupState.ts +1 -1
  186. package/src/composables/group/useProvideGroupState.ts +1 -1
  187. package/src/composables/useComponentIcon.ts +1 -1
  188. package/src/composables/useDebouncedInput.ts +10 -3
  189. package/src/composables/useDefaults.ts +89 -0
  190. package/src/composables/useModifiers.ts +8 -9
  191. package/src/composables/useOptions.ts +1 -1
  192. package/src/composables/useVolver.ts +2 -2
  193. package/src/constants.ts +36 -0
  194. package/src/directives/index.ts +1 -1
  195. package/src/directives/v-tooltip.ts +2 -2
  196. package/src/index.ts +0 -2
  197. package/src/props/index.ts +111 -19
  198. package/src/resolvers/unplugin.ts +96 -49
  199. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  200. package/src/stories/Accordion/Accordion.test.ts +21 -15
  201. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  202. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  203. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  204. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
  205. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  206. package/src/stories/Button/Button.stories.mdx +4 -2
  207. package/src/stories/Button/Button.test.ts +3 -1
  208. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  209. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  210. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  211. package/src/stories/Card/Card.stories.mdx +2 -1
  212. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  213. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  214. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  215. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  216. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  217. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  218. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  219. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  220. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  221. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  222. package/src/stories/Icon/Icon.stories.mdx +2 -1
  223. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  224. package/src/stories/InputText/InputText.settings.ts +53 -0
  225. package/src/stories/InputText/InputText.stories.mdx +42 -1
  226. package/src/stories/InputText/InputText.test.ts +5 -2
  227. package/src/stories/Progress/Progress.stories.mdx +2 -1
  228. package/src/stories/Radio/Radio.stories.mdx +2 -1
  229. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  230. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  231. package/src/stories/Select/Select.stories.mdx +2 -1
  232. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  233. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  234. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
  235. package/src/stories/argTypes.ts +2 -2
  236. package/src/types/group.d.ts +5 -0
@@ -1,6 +1,7 @@
1
- import { defineComponent as _, unref as a, openBlock as g, createBlock as V, mergeProps as S, createCommentVNode as y, Transition as D, toHandlers as N, withCtx as k, withDirectives as E, createElementVNode as f, createElementBlock as B, renderSlot as b, createTextVNode as F, toDisplayString as j, createVNode as I, vShow as z } from "vue";
2
- import { iconExists as p, Icon as M, addIcon as L } from "@iconify/vue";
3
- const T = {
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 = {
4
5
  /**
5
6
  * Color
6
7
  */
@@ -24,7 +25,7 @@ const T = {
24
25
  */
25
26
  name: {
26
27
  type: String,
27
- required: !0
28
+ required: true
28
29
  },
29
30
  /**
30
31
  * By default 'vv'
@@ -93,72 +94,337 @@ const T = {
93
94
  modifiers: {
94
95
  type: [String, Array]
95
96
  }
96
- }, q = {
97
+ };
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);
137
+ }
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;
159
+ });
160
+ }
161
+ const __default__$1 = {
97
162
  name: "VvIcon"
98
- }, A = /* @__PURE__ */ _({
99
- ...q,
100
- props: T,
101
- setup(e) {
102
- const r = e, i = ref(!0), n = useVolver(), { modifiers: d } = toRefs(r), u = useBemModifiers("vv-icon", d), s = computed(() => r.provider || (n == null ? void 0 : n.provider)), v = computed(() => {
103
- const t = r.name ?? "", o = `@${s.value}:${r.prefix}:${r.name}`;
104
- return p(t) ? t : p(o) ? o : (n == null ? void 0 : n.iconsCollections.find(
105
- (l) => {
106
- const h = `@${s.value}:${l.prefix}:${t}`;
107
- if (p(h))
108
- return h;
109
- }
110
- )) || 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
+ }
111
193
  });
112
- function m(t) {
113
- let o = null;
114
- if (typeof window > "u") {
115
- const { JSDOM: O } = require("jsdom");
116
- o = new O().window;
194
+ function getSvgContent(svg) {
195
+ let dom = null;
196
+ if (typeof window === "undefined") {
197
+ const { JSDOM } = require("jsdom");
198
+ dom = new JSDOM().window;
117
199
  }
118
- 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;
119
204
  }
120
- function c(t) {
121
- const o = m(t), l = (o == null ? void 0 : o.innerHTML.trim()) || "";
122
- o && l && L(`@${s.value}:${r.prefix}:${r.name}`, {
123
- body: l,
124
- // Set height and width from svg content
125
- height: o.viewBox.baseVal.height,
126
- width: o.viewBox.baseVal.width
127
- });
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
+ }
216
+ }
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
+ }
128
231
  }
129
- return n && (r.src && !p(`@${s.value}:${r.prefix}:${r.name}`) ? (i.value = !1, n.fetchIcon(r.src).then((t) => {
130
- t && (c(t), i.value = !0);
131
- }).catch((t) => {
132
- throw new Error(`During fetch icon: ${t == null ? void 0 : t.message}`);
133
- })) : r.svg && c(r.svg)), (t, o) => a(i) ? (g(), V(a(M), S({
134
- key: 0,
135
- class: a(u)
136
- }, {
137
- inline: t.inline,
138
- width: t.width,
139
- height: t.height,
140
- horizontalFlip: t.horizontalFlip,
141
- verticalFlip: t.verticalFlip,
142
- flip: t.flip,
143
- rotate: t.rotate,
144
- color: t.color,
145
- onLoad: t.onLoad,
146
- icon: a(v)
147
- }), null, 16, ["class"])) : y("", !0);
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
+ };
249
+ }
250
+ });
251
+ const LinkProps = {
252
+ /**
253
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
254
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
255
+ */
256
+ to: {
257
+ type: [String, Object]
258
+ },
259
+ /**
260
+ * Anchor href
261
+ */
262
+ href: String,
263
+ /**
264
+ * Anchor target
265
+ */
266
+ target: {
267
+ type: String,
268
+ validator: (value) => Object.values(AnchorTarget).includes(value)
269
+ },
270
+ /**
271
+ * Anchor rel
272
+ */
273
+ rel: {
274
+ type: String,
275
+ default: "noopener noreferrer"
276
+ }
277
+ };
278
+ const DisabledProps = {
279
+ /**
280
+ * Whether the form control is disabled
281
+ */
282
+ disabled: Boolean
283
+ };
284
+ const ActiveProps = {
285
+ /**
286
+ * Whether the item is active
287
+ */
288
+ active: Boolean
289
+ };
290
+ const PressedProps = {
291
+ /**
292
+ * Whether the item is pressed
293
+ */
294
+ pressed: Boolean
295
+ };
296
+ const LabelProps = {
297
+ /**
298
+ * The item label
299
+ */
300
+ label: [String, Number]
301
+ };
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)
148
315
  }
149
316
  });
150
- var w = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(w || {}), C = /* @__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))(C || {}), $ = /* @__PURE__ */ ((e) => (e.before = "before", e.after = "after", e))($ || {});
151
- $.before;
152
- const H = {
317
+ const IdProps = {
153
318
  /**
154
319
  * Global attribute id
155
320
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
156
321
  */
157
322
  id: [String, Number]
158
323
  };
159
- w.bottom;
160
- const P = ["open", "close", "update:modelValue"], W = {
161
- ...H,
324
+ ({
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,
416
+ /**
417
+ * Button type
418
+ */
419
+ type: {
420
+ type: String,
421
+ default: ButtonType.button,
422
+ validator: (value) => Object.values(ButtonType).includes(value)
423
+ }
424
+ });
425
+ const VvDialogEvents = ["open", "close", "update:modelValue"];
426
+ const VvDialogProps = {
427
+ ...IdProps,
162
428
  /**
163
429
  * Dialog title
164
430
  */
@@ -166,7 +432,10 @@ const P = ["open", "close", "update:modelValue"], W = {
166
432
  /**
167
433
  * Show / hide dialog programmatically
168
434
  */
169
- modelValue: Boolean,
435
+ modelValue: {
436
+ type: Boolean,
437
+ default: void 0
438
+ },
170
439
  /**
171
440
  * Dialog transition
172
441
  */
@@ -178,78 +447,120 @@ const P = ["open", "close", "update:modelValue"], W = {
178
447
  /**
179
448
  * Close dialog on click outside
180
449
  */
181
- autoClose: { type: Boolean, default: !0 }
182
- }, J = {
450
+ autoClose: { type: Boolean, default: true }
451
+ };
452
+ const _hoisted_1 = {
183
453
  key: 0,
184
454
  class: "vv-dialog__header"
185
- }, K = { class: "vv-dialog__content" }, R = {
455
+ };
456
+ const _hoisted_2 = { class: "vv-dialog__content" };
457
+ const _hoisted_3 = {
186
458
  key: 1,
187
459
  class: "vv-dialog__footer"
188
- }, G = {
460
+ };
461
+ const __default__ = {
189
462
  name: "VvDialog"
190
- }, Y = /* @__PURE__ */ _({
191
- ...G,
192
- props: W,
193
- emits: P,
194
- setup(e, { emit: r }) {
195
- const i = e, n = useVModel(i, "modelValue", r), d = ref(!0), u = ref(null), s = computed(() => {
196
- const { id: o } = i;
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;
197
486
  return {
198
- id: o,
199
- open: d.value
487
+ id,
488
+ open: htmlAttrIsOpen.value
200
489
  };
201
- }), v = computed(() => i.size ? ["vv-dialog", `vv-dialog--${i.size}`] : "vv-dialog"), m = computed(() => `vv-dialog--${i.transition}`), c = {
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 = {
202
499
  "before-enter": () => {
203
- d.value = !0, r("open");
500
+ htmlAttrIsOpen.value = true;
501
+ emit("open");
204
502
  },
205
503
  "after-leave": () => {
206
- d.value = !1, r("close");
504
+ htmlAttrIsOpen.value = false;
505
+ emit("close");
207
506
  }
208
507
  };
209
- onClickOutside(u, () => {
210
- i.autoClose && (n.value = !1);
508
+ onClickOutside(modalWrapper, () => {
509
+ if (props.autoClose) {
510
+ modelValue.value = false;
511
+ }
211
512
  });
212
- function t() {
213
- n.value = !1;
513
+ function close() {
514
+ modelValue.value = false;
515
+ }
516
+ function open() {
517
+ modelValue.value = true;
214
518
  }
215
- return onKeyStroke("Escape", (o) => {
216
- n.value && (o.preventDefault(), t());
217
- }), (o, l) => (g(), V(D, S({ name: a(m) }, N(c)), {
218
- default: k(() => [
219
- E(f("dialog", S(a(s), { class: a(v) }), [
220
- f("article", {
221
- ref_key: "modalWrapper",
222
- ref: u,
223
- class: "vv-dialog__wrapper"
224
- }, [
225
- o.$slots.header || o.title ? (g(), B("header", J, [
226
- b(o.$slots, "header", {}, () => [
227
- F(j(o.title) + " ", 1),
228
- f("button", {
229
- type: "button",
230
- "aria-label": "Close",
231
- class: "vv-dialog__close",
232
- onClickPassive: t
233
- }, [
234
- I(A, { name: "close" })
235
- ], 32)
236
- ])
237
- ])) : y("", !0),
238
- f("div", K, [
239
- b(o.$slots, "default")
240
- ]),
241
- o.$slots.footer ? (g(), B("footer", R, [
242
- b(o.$slots, "footer")
243
- ])) : y("", !0)
244
- ], 512)
245
- ], 16), [
246
- [z, a(n)]
247
- ])
248
- ]),
249
- _: 3
250
- }, 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
+ };
251
562
  }
252
563
  });
253
564
  export {
254
- Y as default
565
+ _sfc_main as default
255
566
  };
@@ -1 +1 @@
1
- (function(e,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("vue"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue"],s):(e=typeof globalThis<"u"?globalThis:e||self,e.VvDialog=s(e.vue,e.vue$1))})(this,function(e,s){"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]}},v={name:"VvIcon"},w=e.defineComponent({...v,props:b,setup(t){const r=t,a=ref(!0),i=useVolver(),{modifiers:d}=toRefs(r),f=useBemModifiers("vv-icon",d),l=computed(()=>r.provider||(i==null?void 0:i.provider)),g=computed(()=>{const o=r.name??"",n=`@${l.value}:${r.prefix}:${r.name}`;return s.iconExists(o)?o:s.iconExists(n)?n:(i==null?void 0:i.iconsCollections.find(c=>{const y=`@${l.value}:${c.prefix}:${o}`;if(s.iconExists(y))return y}))||o});function h(o){let n=null;if(typeof window>"u"){const{JSDOM:k}=require("jsdom");n=new k().window}return(n?new n.DOMParser:new window.DOMParser).parseFromString(o,"text/html").querySelector("svg")}function p(o){const n=h(o),c=(n==null?void 0:n.innerHTML.trim())||"";n&&c&&s.addIcon(`@${l.value}:${r.prefix}:${r.name}`,{body:c,height:n.viewBox.baseVal.height,width:n.viewBox.baseVal.width})}return i&&(r.src&&!s.iconExists(`@${l.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(f)},{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(g)}),null,16,["class"])):e.createCommentVNode("",!0)}});var u=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(u||{}),S=(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))(S||{}),m=(t=>(t.before="before",t.after="after",t))(m||{});m.before;const B={id:[String,Number]};u.bottom;const V=["open","close","update:modelValue"],_={...B,title:String,modelValue:Boolean,transition:{type:String,default:"fade-block"},size:String,autoClose:{type:Boolean,default:!0}},E={key:0,class:"vv-dialog__header"},$={class:"vv-dialog__content"},C={key:1,class:"vv-dialog__footer"},N={name:"VvDialog"};return e.defineComponent({...N,props:_,emits:V,setup(t,{emit:r}){const a=t,i=useVModel(a,"modelValue",r),d=ref(!0),f=ref(null),l=computed(()=>{const{id:n}=a;return{id:n,open:d.value}}),g=computed(()=>a.size?["vv-dialog",`vv-dialog--${a.size}`]:"vv-dialog"),h=computed(()=>`vv-dialog--${a.transition}`),p={"before-enter":()=>{d.value=!0,r("open")},"after-leave":()=>{d.value=!1,r("close")}};onClickOutside(f,()=>{a.autoClose&&(i.value=!1)});function o(){i.value=!1}return onKeyStroke("Escape",n=>{i.value&&(n.preventDefault(),o())}),(n,c)=>(e.openBlock(),e.createBlock(e.Transition,e.mergeProps({name:e.unref(h)},e.toHandlers(p)),{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("dialog",e.mergeProps(e.unref(l),{class:e.unref(g)}),[e.createElementVNode("article",{ref_key:"modalWrapper",ref:f,class:"vv-dialog__wrapper"},[n.$slots.header||n.title?(e.openBlock(),e.createElementBlock("header",E,[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(w,{name:"close"})],32)])])):e.createCommentVNode("",!0),e.createElementVNode("div",$,[e.renderSlot(n.$slots,"default")]),n.$slots.footer?(e.openBlock(),e.createElementBlock("footer",C,[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"]))}})}));
@@ -1,6 +1,9 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
2
  title: StringConstructor;
3
- modelValue: BooleanConstructor;
3
+ modelValue: {
4
+ type: BooleanConstructor;
5
+ default: undefined;
6
+ };
4
7
  transition: {
5
8
  type: StringConstructor;
6
9
  default: string;
@@ -11,9 +14,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
11
14
  default: boolean;
12
15
  };
13
16
  id: (StringConstructor | NumberConstructor)[];
14
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
17
+ }, {
18
+ close: () => void;
19
+ open: () => void;
20
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
21
  title: StringConstructor;
16
- modelValue: BooleanConstructor;
22
+ modelValue: {
23
+ type: BooleanConstructor;
24
+ default: undefined;
25
+ };
17
26
  transition: {
18
27
  type: StringConstructor;
19
28
  default: string;