@volverjs/ui-vue 0.0.9-beta.2 → 0.0.9-beta.20

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 (146) hide show
  1. package/README.md +3 -3
  2. package/auto-imports.d.ts +2 -0
  3. package/dist/components/VvAccordion/VvAccordion.es.js +7 -0
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +7 -0
  5. package/dist/components/VvAction/VvAction.es.js +9 -1
  6. package/dist/components/VvAction/VvAction.umd.js +1 -1
  7. package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
  8. package/dist/components/VvAction/index.d.ts +4 -0
  9. package/dist/components/VvAlert/VvAlert.es.js +14 -6
  10. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  11. package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
  12. package/dist/components/VvAlert/index.d.ts +3 -3
  13. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +14 -6
  14. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  15. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +3 -3
  16. package/dist/components/VvAlertGroup/index.d.ts +1 -1
  17. package/dist/components/VvAvatar/VvAvatar.es.js +7 -0
  18. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -0
  19. package/dist/components/VvBadge/VvBadge.es.js +7 -0
  20. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +7 -0
  21. package/dist/components/VvButton/VvButton.es.js +11 -2
  22. package/dist/components/VvButton/VvButton.umd.js +1 -1
  23. package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
  24. package/dist/components/VvButton/index.d.ts +4 -0
  25. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -0
  26. package/dist/components/VvCard/VvCard.es.js +7 -0
  27. package/dist/components/VvCheckbox/VvCheckbox.es.js +91 -14
  28. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  29. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +97 -15
  31. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  32. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
  33. package/dist/components/VvCombobox/VvCombobox.es.js +243 -179
  34. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  35. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +323 -95
  36. package/dist/components/VvCombobox/index.d.ts +123 -35
  37. package/dist/components/VvDialog/VvDialog.es.js +42 -30
  38. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  39. package/dist/components/VvDropdown/VvDropdown.es.js +19 -6
  40. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  41. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +291 -84
  42. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
  43. package/dist/components/VvDropdown/index.d.ts +96 -27
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +9 -1
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  46. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +7 -0
  47. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +7 -0
  48. package/dist/components/VvInputText/VvInputText.es.js +271 -109
  49. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  50. package/dist/components/VvInputText/VvInputText.vue.d.ts +23 -41
  51. package/dist/components/VvInputText/index.d.ts +25 -35
  52. package/dist/components/VvNav/VvNav.es.js +10 -2
  53. package/dist/components/VvNav/VvNav.umd.js +1 -1
  54. package/dist/components/VvNav/index.d.ts +1 -1
  55. package/dist/components/VvProgress/VvProgress.es.js +7 -0
  56. package/dist/components/VvRadio/VvRadio.es.js +91 -14
  57. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  59. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +97 -15
  60. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  61. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
  62. package/dist/components/VvSelect/VvSelect.es.js +87 -14
  63. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  64. package/dist/components/VvSelect/VvSelect.vue.d.ts +5 -5
  65. package/dist/components/VvTab/VvTab.es.js +10 -2
  66. package/dist/components/VvTab/VvTab.umd.js +1 -1
  67. package/dist/components/VvTextarea/VvTextarea.es.js +95 -19
  68. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  69. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
  70. package/dist/components/VvTooltip/VvTooltip.es.js +7 -0
  71. package/dist/components/common/HintSlot.d.ts +4 -3
  72. package/dist/components/index.d.ts +5 -0
  73. package/dist/components/index.es.js +1199 -614
  74. package/dist/components/index.umd.js +1 -1
  75. package/dist/composables/alert/useAlert.d.ts +27 -0
  76. package/dist/composables/index.d.ts +1 -0
  77. package/dist/composables/index.es.js +81 -0
  78. package/dist/composables/index.umd.js +1 -0
  79. package/dist/constants.d.ts +10 -0
  80. package/dist/directives/index.es.js +7 -0
  81. package/dist/directives/v-tooltip.es.js +7 -0
  82. package/dist/icons.es.js +3 -3
  83. package/dist/icons.umd.js +1 -1
  84. package/dist/props/index.d.ts +103 -27
  85. package/dist/resolvers/unplugin.es.js +3 -0
  86. package/dist/resolvers/unplugin.umd.js +1 -1
  87. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
  88. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +54 -269
  89. package/dist/stories/Alert/Alert.settings.d.ts +3 -7
  90. package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
  91. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
  92. package/dist/stories/Button/Button.settings.d.ts +3 -13
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
  94. package/dist/stories/InputText/InputText.settings.d.ts +31 -9
  95. package/dist/stories/InputText/InputText.stories.d.ts +0 -1
  96. package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
  97. package/dist/stories/Nav/Nav.settings.d.ts +3 -21
  98. package/package.json +75 -66
  99. package/src/assets/icons/detailed.json +1 -1
  100. package/src/assets/icons/normal.json +1 -1
  101. package/src/assets/icons/simple.json +1 -1
  102. package/src/components/VvAction/VvAction.vue +2 -1
  103. package/src/components/VvAlert/VvAlert.vue +5 -1
  104. package/src/components/VvAlert/index.ts +3 -3
  105. package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
  106. package/src/components/VvButton/VvButton.vue +1 -0
  107. package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
  108. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
  109. package/src/components/VvCombobox/VvCombobox.vue +43 -23
  110. package/src/components/VvCombobox/index.ts +24 -0
  111. package/src/components/VvDialog/VvDialog.vue +22 -19
  112. package/src/components/VvDropdown/VvDropdown.vue +14 -9
  113. package/src/components/VvInputText/VvInputText.vue +177 -55
  114. package/src/components/VvInputText/index.ts +32 -34
  115. package/src/components/VvNav/VvNav.vue +1 -1
  116. package/src/components/VvNav/index.ts +1 -1
  117. package/src/components/VvRadio/VvRadio.vue +8 -1
  118. package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
  119. package/src/components/VvSelect/VvSelect.vue +8 -1
  120. package/src/components/VvTextarea/VvTextarea.vue +16 -6
  121. package/src/components/common/HintSlot.ts +26 -13
  122. package/src/components/index.ts +5 -0
  123. package/src/composables/alert/useAlert.ts +103 -0
  124. package/src/composables/index.ts +1 -0
  125. package/src/constants.ts +21 -0
  126. package/src/props/index.ts +7 -0
  127. package/src/resolvers/unplugin.ts +3 -0
  128. package/src/stories/Alert/Alert.settings.ts +3 -1
  129. package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
  130. package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
  131. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
  132. package/src/stories/Button/Button.settings.ts +5 -3
  133. package/src/stories/Combobox/Combobox.settings.ts +119 -2
  134. package/src/stories/Combobox/Combobox.test.ts +1 -1
  135. package/src/stories/InputText/InputText.settings.ts +36 -15
  136. package/src/stories/InputText/InputText.stories.ts +4 -12
  137. package/src/stories/InputText/InputText.test.ts +31 -15
  138. package/src/stories/InputText/InputTextMask.stories.ts +122 -0
  139. package/src/stories/Nav/Nav.settings.ts +3 -1
  140. package/src/stories/Tab/Tab.stories.ts +3 -3
  141. package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
  142. package/src/types/alert.d.ts +20 -0
  143. /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
  144. /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
  145. /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
  146. /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
@@ -45,26 +45,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
45
45
  type: StringConstructor;
46
46
  default: string;
47
47
  };
48
- mask: {
49
- type: StringConstructor;
48
+ iMask: {
49
+ type: globalThis.PropType<import("imask/esm/index").FactoryOpts>;
50
50
  default: undefined;
51
51
  };
52
- maskEager: {
53
- type: BooleanConstructor;
54
- default: boolean;
55
- };
56
- maskReversed: {
57
- type: BooleanConstructor;
58
- default: boolean;
59
- };
60
- maskTokens: {
61
- type: globalThis.PropType<import("maska").MaskTokens>;
52
+ masked: {
53
+ type: StringConstructor;
62
54
  default: undefined;
63
55
  };
64
- maskTokensReplace: {
65
- type: BooleanConstructor;
66
- default: boolean;
67
- };
68
56
  autoWidth: {
69
57
  type: BooleanConstructor;
70
58
  default: boolean;
@@ -76,6 +64,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
76
64
  unit: {
77
65
  type: StringConstructor;
78
66
  };
67
+ selectOnFocus: {
68
+ type: BooleanConstructor;
69
+ default: boolean;
70
+ };
79
71
  minlength: (StringConstructor | NumberConstructor)[];
80
72
  maxlength: (StringConstructor | NumberConstructor)[];
81
73
  placeholder: StringConstructor;
@@ -175,26 +167,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
175
167
  type: StringConstructor;
176
168
  default: string;
177
169
  };
178
- mask: {
179
- type: StringConstructor;
170
+ iMask: {
171
+ type: globalThis.PropType<import("imask/esm/index").FactoryOpts>;
180
172
  default: undefined;
181
173
  };
182
- maskEager: {
183
- type: BooleanConstructor;
184
- default: boolean;
185
- };
186
- maskReversed: {
187
- type: BooleanConstructor;
188
- default: boolean;
189
- };
190
- maskTokens: {
191
- type: globalThis.PropType<import("maska").MaskTokens>;
174
+ masked: {
175
+ type: StringConstructor;
192
176
  default: undefined;
193
177
  };
194
- maskTokensReplace: {
195
- type: BooleanConstructor;
196
- default: boolean;
197
- };
198
178
  autoWidth: {
199
179
  type: BooleanConstructor;
200
180
  default: boolean;
@@ -206,6 +186,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
206
186
  unit: {
207
187
  type: StringConstructor;
208
188
  };
189
+ selectOnFocus: {
190
+ type: BooleanConstructor;
191
+ default: boolean;
192
+ };
209
193
  minlength: (StringConstructor | NumberConstructor)[];
210
194
  maxlength: (StringConstructor | NumberConstructor)[];
211
195
  placeholder: StringConstructor;
@@ -262,7 +246,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
262
246
  disabled: boolean;
263
247
  floating: boolean;
264
248
  type: import("../VvInputText").InputType;
265
- mask: string;
266
249
  tabindex: string | number;
267
250
  required: boolean;
268
251
  iconPosition: "before" | "after";
@@ -284,12 +267,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
284
267
  labelShowPassword: string;
285
268
  labelHidePassword: string;
286
269
  labelClear: string;
287
- maskEager: boolean;
288
- maskReversed: boolean;
289
- maskTokens: import("maska").MaskTokens;
290
- maskTokensReplace: boolean;
270
+ iMask: import("imask/esm/index").FactoryOpts;
271
+ masked: string;
291
272
  autoWidth: boolean;
292
273
  hideActions: boolean;
274
+ selectOnFocus: boolean;
293
275
  count: string | boolean;
294
276
  }, {}>, {
295
277
  before?(_: {
@@ -329,25 +311,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
329
311
  clear: () => void;
330
312
  }): any;
331
313
  hint?(_: {
332
- modelValue: any;
314
+ modelValue: unknown;
333
315
  valid: boolean;
334
316
  invalid: boolean;
335
317
  loading: boolean;
336
318
  }): any;
337
319
  loading?(_: {
338
- modelValue: any;
320
+ modelValue: unknown;
339
321
  valid: boolean;
340
322
  invalid: boolean;
341
323
  loading: boolean;
342
324
  }): any;
343
325
  valid?(_: {
344
- modelValue: any;
326
+ modelValue: unknown;
345
327
  valid: boolean;
346
328
  invalid: boolean;
347
329
  loading: boolean;
348
330
  }): any;
349
331
  invalid?(_: {
350
- modelValue: any;
332
+ modelValue: unknown;
351
333
  valid: boolean;
352
334
  invalid: boolean;
353
335
  loading: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
- import type { MaskTokens } from 'maska';
2
+ import type { FactoryOpts } from 'imask';
3
3
  export declare const INPUT_TYPES: {
4
4
  readonly TEXT: "text";
5
5
  readonly PASSWORD: "password";
@@ -133,45 +133,20 @@ export declare const VvInputTextProps: {
133
133
  default: string;
134
134
  };
135
135
  /**
136
- * Input mask, only for text type
137
- * @see https://beholdr.github.io/maska/
136
+ * iMask options
137
+ * @see https://imask.js.org/guide.html
138
138
  */
139
- mask: {
140
- type: StringConstructor;
139
+ iMask: {
140
+ type: PropType<FactoryOpts>;
141
141
  default: undefined;
142
142
  };
143
143
  /**
144
- * Show mask before typing
145
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
146
- */
147
- maskEager: {
148
- type: BooleanConstructor;
149
- default: boolean;
150
- };
151
- /**
152
- * Write values reverse (ex. for numbers)
153
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
154
- */
155
- maskReversed: {
156
- type: BooleanConstructor;
157
- default: boolean;
158
- };
159
- /**
160
- * Add mask custom tokens
161
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
144
+ * Masked value
162
145
  */
163
- maskTokens: {
164
- type: PropType<MaskTokens>;
146
+ masked: {
147
+ type: StringConstructor;
165
148
  default: undefined;
166
149
  };
167
- /**
168
- * Replace default tokens
169
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
170
- */
171
- maskTokensReplace: {
172
- type: BooleanConstructor;
173
- default: boolean;
174
- };
175
150
  /**
176
151
  * Adjust input width to content
177
152
  */
@@ -192,6 +167,13 @@ export declare const VvInputTextProps: {
192
167
  unit: {
193
168
  type: StringConstructor;
194
169
  };
170
+ /**
171
+ * Select input text on focus
172
+ */
173
+ selectOnFocus: {
174
+ type: BooleanConstructor;
175
+ default: boolean;
176
+ };
195
177
  minlength: (StringConstructor | NumberConstructor)[];
196
178
  maxlength: (StringConstructor | NumberConstructor)[];
197
179
  placeholder: StringConstructor;
@@ -212,12 +194,20 @@ export declare const VvInputTextProps: {
212
194
  default: boolean;
213
195
  validator: (value: string) => boolean;
214
196
  };
215
- modifiers: PropType<string | string[]>;
197
+ modifiers: PropType<string | string[]>; /**
198
+ * Pattern the value must match to be valid
199
+ * Available for input types: text, search, url, tel, email and password
200
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern
201
+ */
216
202
  loading: BooleanConstructor;
217
203
  loadingLabel: {
218
204
  type: StringConstructor;
219
205
  default: string;
220
- };
206
+ }; /**
207
+ * Minimum value
208
+ * Available for input types: date, month, week, time, datetime-local, number, range.
209
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min
210
+ */
221
211
  hintLabel: {
222
212
  type: StringConstructor;
223
213
  default: string;
@@ -230,6 +230,13 @@ const ActionProps = {
230
230
  type: String,
231
231
  default: ButtonType.button,
232
232
  validator: (value) => Object.values(ButtonType).includes(value)
233
+ },
234
+ /**
235
+ * Button aria-label
236
+ */
237
+ ariaLabel: {
238
+ type: String,
239
+ default: void 0
233
240
  }
234
241
  };
235
242
  const VvNavProps = {
@@ -297,7 +304,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
297
304
  const hasProps = computed(() => {
298
305
  const toReturn = {
299
306
  ...dropdownAria == null ? void 0 : dropdownAria.value,
300
- "aria-pressed": pressed.value ? true : void 0,
307
+ ariaPressed: pressed.value ? true : void 0,
308
+ ariaLabel: props.ariaLabel,
301
309
  role: role == null ? void 0 : role.value
302
310
  };
303
311
  switch (hasTag.value) {
@@ -434,7 +442,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
434
442
  current: unref(activeItem) == navItem.id,
435
443
  disabled: navItem.disabled
436
444
  }, "vv-nav__item-label"]
437
- }, toHandlers(navItem.on || {}), {
445
+ }, toHandlers(navItem.on), {
438
446
  onClick: ($event) => onClick(navItem)
439
447
  }), {
440
448
  default: withCtx(() => [
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvNav=t(e.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{}),l=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(l||{});const a=Symbol.for("volver"),i=Symbol.for("dropdownTrigger"),s=Symbol.for("dropdownAction"),u={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(l).includes(e)},rel:{type:String,default:"noopener noreferrer"}},d={disabled:Boolean},c={active:Boolean},v={pressed:Boolean},f={label:[String,Number]},p={modifiers:[String,Array]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const m={...d,...f,...v,...c,...u,type:{type:String,default:n.button,validator:e=>Object.values(n).includes(e)}},b={...p,items:{type:Array,required:!0,default:()=>[]}},k=m;const y=e.defineComponent({name:"VvAction",props:k,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const l=t,u=e.inject(a),d=e.ref(null);o({$el:d});const{reference:c,bus:v,aria:f,expanded:p}=e.inject(i,{});e.watch((()=>d.value),(e=>{c&&(c.value=e)}));const m=e.computed((()=>l.pressed||(null==p?void 0:p.value))),{role:b}=e.inject(s,{}),k=e.computed((()=>{switch(!0){case l.disabled:return r.button;case void 0!==l.to:return(null==u?void 0:u.nuxt)?r.nuxtLink:r.routerLink;case void 0!==l.href:return r.a;default:return r.button}})),y=e.computed((()=>{const e={...null==f?void 0:f.value,"aria-pressed":!!m.value||void 0,role:null==b?void 0:b.value};switch(k.value){case r.a:return{...e,href:l.href,target:l.target,rel:l.rel};case r.routerLink:case r.nuxtLink:return{...e,to:l.to,target:l.target};default:return{...e,type:l.type,disabled:l.disabled}}})),g=e=>{l.disabled?e.preventDefault():(null==v||v.emit("click",e),n("click",e))},_=e=>{null==v||v.emit("mouseover",e),n("mouseover",e)},B=e=>{null==v||v.emit("mouseleave",e),n("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(y),{ref_key:"element",ref:d,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled},onClickPassive:g,onMouseoverPassive:_,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});const g={class:"vv-nav__menu",role:"menu","aria-busy":"true"};return e.defineComponent({__name:"VvNav",props:b,emits:["click"],setup(t,{emit:o}){const n=t,{modifiers:r,items:l}=e.toRefs(n),a=e.ref(null),i=function(t,o,n){return e.computed((()=>{const r={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{r[`${t}--${o}`]=e.unref(n.value[o])})),r}))}("vv-nav",r),s=e.computed((()=>l.value.map(((e,t)=>({...e,id:e.id||`nav-item_${t}`})))));return(t,n)=>(e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(e.unref(i))},[e.createElementVNode("ul",g,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),(t=>(e.openBlock(),e.createElementBlock("li",{key:t.id,class:"vv-nav__item",role:"presentation"},[e.createVNode(y,e.mergeProps({disabled:t.disabled,to:t.to,href:t.href,tabindex:0},{class:[{current:e.unref(a)==t.id,disabled:t.disabled},"vv-nav__item-label"]},e.toHandlers(t.on||{}),{onClick:e=>{var n;(n=t).disabled||(o("click",n),a.value=n.id)}}),{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(t.title),1)])),_:2},1040,["class","onClick"])])))),128))])],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvNav=t(e.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),n=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(n||{}),l=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(l||{});const a=Symbol.for("volver"),i=Symbol.for("dropdownTrigger"),s=Symbol.for("dropdownAction"),u={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(l).includes(e)},rel:{type:String,default:"noopener noreferrer"}},d={disabled:Boolean},c={active:Boolean},v={pressed:Boolean},f={label:[String,Number]},p={modifiers:[String,Array]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const m={...d,...f,...v,...c,...u,type:{type:String,default:r.button,validator:e=>Object.values(r).includes(e)},ariaLabel:{type:String,default:void 0}},b={...p,items:{type:Array,required:!0,default:()=>[]}},k=m;const y=e.defineComponent({name:"VvAction",props:k,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:r}){const l=t,u=e.inject(a),d=e.ref(null);o({$el:d});const{reference:c,bus:v,aria:f,expanded:p}=e.inject(i,{});e.watch((()=>d.value),(e=>{c&&(c.value=e)}));const m=e.computed((()=>l.pressed||(null==p?void 0:p.value))),{role:b}=e.inject(s,{}),k=e.computed((()=>{switch(!0){case l.disabled:return n.button;case void 0!==l.to:return(null==u?void 0:u.nuxt)?n.nuxtLink:n.routerLink;case void 0!==l.href:return n.a;default:return n.button}})),y=e.computed((()=>{const e={...null==f?void 0:f.value,ariaPressed:!!m.value||void 0,ariaLabel:l.ariaLabel,role:null==b?void 0:b.value};switch(k.value){case n.a:return{...e,href:l.href,target:l.target,rel:l.rel};case n.routerLink:case n.nuxtLink:return{...e,to:l.to,target:l.target};default:return{...e,type:l.type,disabled:l.disabled}}})),g=e=>{l.disabled?e.preventDefault():(null==v||v.emit("click",e),r("click",e))},_=e=>{null==v||v.emit("mouseover",e),r("mouseover",e)},B=e=>{null==v||v.emit("mouseleave",e),r("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(y),{ref_key:"element",ref:d,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled},onClickPassive:g,onMouseoverPassive:_,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});const g={class:"vv-nav__menu",role:"menu","aria-busy":"true"};return e.defineComponent({__name:"VvNav",props:b,emits:["click"],setup(t,{emit:o}){const r=t,{modifiers:n,items:l}=e.toRefs(r),a=e.ref(null),i=function(t,o,r){return e.computed((()=>{const n={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{n[`${t}--${o}`]=e.unref(r.value[o])})),n}))}("vv-nav",n),s=e.computed((()=>l.value.map(((e,t)=>({...e,id:e.id||`nav-item_${t}`})))));return(t,r)=>(e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(e.unref(i))},[e.createElementVNode("ul",g,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),(t=>(e.openBlock(),e.createElementBlock("li",{key:t.id,class:"vv-nav__item",role:"presentation"},[e.createVNode(y,e.mergeProps({disabled:t.disabled,to:t.to,href:t.href,tabindex:0},{class:[{current:e.unref(a)==t.id,disabled:t.disabled},"vv-nav__item-label"]},e.toHandlers(t.on),{onClick:e=>{var r;(r=t).disabled||(o("click",r),a.value=r.id)}}),{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(t.title),1)])),_:2},1040,["class","onClick"])])))),128))])],2))}})}));
@@ -6,7 +6,7 @@ export type NavItem = {
6
6
  };
7
7
  href?: string;
8
8
  disabled?: boolean;
9
- on: () => void;
9
+ on?: Record<string, () => void>;
10
10
  };
11
11
  export declare const VvNavProps: {
12
12
  items: {
@@ -216,6 +216,13 @@ const ModifiersProps = {
216
216
  type: String,
217
217
  default: ButtonType.button,
218
218
  validator: (value) => Object.values(ButtonType).includes(value)
219
+ },
220
+ /**
221
+ * Button aria-label
222
+ */
223
+ ariaLabel: {
224
+ type: String,
225
+ default: void 0
219
226
  }
220
227
  });
221
228
  const VvProgressProps = {
@@ -1,4 +1,4 @@
1
- import { unref, inject, computed, toRef, toRefs, defineComponent, h, useSlots, ref, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, isRef, vModelRadio, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
1
+ import { unref, inject, computed, toRef, toRefs, isRef, defineComponent, h, useSlots, ref, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelRadio, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
2
2
  import { nanoid } from "nanoid";
3
3
  var Side = /* @__PURE__ */ ((Side2) => {
4
4
  Side2["left"] = "left";
@@ -36,6 +36,7 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
36
36
  AnchorTarget2["_top"] = "_top";
37
37
  return AnchorTarget2;
38
38
  })(AnchorTarget || {});
39
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
39
40
  const INJECTION_KEY_RADIO_GROUP = Symbol.for("radioGroup");
40
41
  const LinkProps = {
41
42
  /**
@@ -304,6 +305,13 @@ const CheckboxRadioProps = {
304
305
  type: String,
305
306
  default: ButtonType.button,
306
307
  validator: (value) => Object.values(ButtonType).includes(value)
308
+ },
309
+ /**
310
+ * Button aria-label
311
+ */
312
+ ariaLabel: {
313
+ type: String,
314
+ default: void 0
307
315
  }
308
316
  });
309
317
  function equals(obj1, obj2, field) {
@@ -462,19 +470,27 @@ function joinLines(items) {
462
470
  }
463
471
  return items;
464
472
  }
465
- function HintSlotFactory(props, slots) {
466
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
467
- const validLabel = computed(() => joinLines(props.validLabel));
468
- const loadingLabel = computed(() => props.loadingLabel);
469
- const hintLabel = computed(() => props.hintLabel);
473
+ function HintSlotFactory(propsOrRef, slots) {
474
+ const props = computed(() => {
475
+ if (isRef(propsOrRef)) {
476
+ return propsOrRef.value;
477
+ }
478
+ return propsOrRef;
479
+ });
480
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
481
+ const validLabel = computed(() => joinLines(props.value.validLabel));
482
+ const loadingLabel = computed(() => props.value.loadingLabel);
483
+ const hintLabel = computed(() => props.value.hintLabel);
470
484
  const hasLoadingLabelOrSlot = computed(
471
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
485
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
472
486
  );
473
487
  const hasInvalidLabelOrSlot = computed(
474
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
488
+ () => !hasLoadingLabelOrSlot.value && Boolean(
489
+ props.value.invalid && (slots.invalid || invalidLabel.value)
490
+ )
475
491
  );
476
492
  const hasValidLabelOrSlot = computed(
477
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
493
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
478
494
  );
479
495
  const hasHintLabelOrSlot = computed(
480
496
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -483,10 +499,10 @@ function HintSlotFactory(props, slots) {
483
499
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
484
500
  );
485
501
  const hintSlotScope = computed(() => ({
486
- modelValue: props.modelValue,
487
- valid: props.valid,
488
- invalid: props.invalid,
489
- loading: props.loading
502
+ modelValue: props.value.modelValue,
503
+ valid: props.value.valid,
504
+ invalid: props.value.invalid,
505
+ loading: props.value.loading
490
506
  }));
491
507
  const HintSlot = defineComponent({
492
508
  name: "HintSlot",
@@ -566,6 +582,62 @@ function HintSlotFactory(props, slots) {
566
582
  HintSlot
567
583
  };
568
584
  }
585
+ function useVolver() {
586
+ return inject(INJECTION_KEY_VOLVER);
587
+ }
588
+ function useDefaults(componentName, propsDefinition, props) {
589
+ const volver = useVolver();
590
+ const volverComponentDefaults = computed(() => {
591
+ var _a;
592
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
593
+ return void 0;
594
+ }
595
+ return volver.defaults.value[componentName];
596
+ });
597
+ return computed(() => {
598
+ if (volverComponentDefaults.value === void 0) {
599
+ return props;
600
+ }
601
+ const componentDefaults = volverComponentDefaults.value;
602
+ const simplifiedPropsDefinition = propsDefinition;
603
+ const simplifiedProps = props;
604
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
605
+ const propValue = simplifiedProps[key];
606
+ acc[key] = propValue;
607
+ if (key in componentDefaults) {
608
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
609
+ const typeArray = simplifiedPropsDefinition[key];
610
+ if (typeArray.length) {
611
+ const typeFunction = typeArray[0];
612
+ if (typeFunction === propValue) {
613
+ acc[key] = componentDefaults[key];
614
+ }
615
+ }
616
+ }
617
+ if (typeof simplifiedPropsDefinition[key] === "function") {
618
+ const typeFunction = simplifiedPropsDefinition[key];
619
+ if (typeFunction() === propValue) {
620
+ acc[key] = componentDefaults[key];
621
+ }
622
+ }
623
+ if (typeof simplifiedPropsDefinition[key] === "object") {
624
+ let defaultValue = simplifiedPropsDefinition[key].default;
625
+ if (typeof defaultValue === "function") {
626
+ defaultValue = defaultValue();
627
+ }
628
+ if (typeof defaultValue === "object") {
629
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
630
+ acc[key] = componentDefaults[key];
631
+ }
632
+ } else if (defaultValue === propValue) {
633
+ acc[key] = componentDefaults[key];
634
+ }
635
+ }
636
+ }
637
+ return acc;
638
+ }, {});
639
+ });
640
+ }
569
641
  const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
570
642
  function useModifiers(prefix, modifiers, others) {
571
643
  return computed(() => {
@@ -602,6 +674,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
602
674
  setup(__props, { emit }) {
603
675
  const props = __props;
604
676
  const slots = useSlots();
677
+ const propsDefaults = useDefaults(
678
+ "VvRadio",
679
+ VvRadioProps,
680
+ props
681
+ );
605
682
  const { id, disabled, readonly, modelValue, valid, invalid } = useGroupProps(props, emit);
606
683
  const hasId = useUniqueId(id);
607
684
  const hasHintId = computed(() => `${hasId.value}-hint`);
@@ -652,7 +729,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
652
729
  hasHintLabelOrSlot,
653
730
  hasInvalidLabelOrSlot,
654
731
  hintSlotScope
655
- } = HintSlotFactory(props, slots);
732
+ } = HintSlotFactory(propsDefaults, slots);
656
733
  return (_ctx, _cache) => {
657
734
  return openBlock(), createElementBlock("label", {
658
735
  class: normalizeClass(unref(bemCssClasses)),
@@ -1 +1 @@
1
- !function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadio=l(e.vue,e.nanoid)}(this,(function(e,l){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});const o=Symbol.for("radioGroup"),i={valid:Boolean,validLabel:[String,Array]},r={invalid:Boolean,invalidLabel:[String,Array]},u={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},d={disabled:Boolean},s=(Boolean,Boolean,{label:[String,Number]}),v={readonly:Boolean},f={modifiers:[String,Array]},c={hintLabel:{type:String,default:""}};a.before;const p={tabindex:{type:[String,Number],default:0}},b={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const h={...{...b,name:{type:String,required:!0}},...p,...i,...r,...c,...d,...v,...f,...s,...u,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]};function m(e,l,t){return t?y(e,t)===y(l,t):g(e,l)}function g(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),a=Array.isArray(l);let n,o,i;if(t&&a){if(o=e.length,o!=l.length)return!1;for(n=o;0!=n--;)if(!g(e[n],l[n]))return!1;return!0}if(t!=a)return!1;const r=e instanceof Date,u=l instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==l.getTime();const d=e instanceof RegExp,s=l instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==l.toString();const v=Object.keys(e);if(o=v.length,o!==Object.keys(l).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(l,v[n]))return!1;for(n=o;0!=n--;)if(i=v[n],!g(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function y(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let a=e;for(let l=0,n=t.length;l<n;++l){if(null==e)return null;a=a[t[l]]}return a}}return null}function S(l){const t=e.inject(l,void 0),a=e.computed((()=>{return l=t,!(null==(a=e.unref(l))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var l,a}));return{group:t,isInGroup:a,getGroupOrLocalRef:function(l,a,n){if(null==t?void 0:t.value){const a=e.unref(t.value)[l];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const o=e.toRef(a,l);return e.computed({get:()=>o.value,set(e){n&&n(`update:${l}`,e)}})}}}n.button;const L=h;function O(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}const B=["for"],$=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"];return e.defineComponent({name:"VvRadio",props:L,emits:["click","update:modelValue","change","blur"],setup(t,{emit:a}){const n=t,i=e.useSlots(),{id:r,disabled:u,readonly:d,modelValue:s,valid:v,invalid:f}=function(l,t){const{id:a}=e.toRefs(l),{group:n,isInGroup:i,getGroupOrLocalRef:r}=S(o),u=r("modelValue",l,t),d=r("valid",l),s=r("invalid",l),v=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==n?void 0:n.value)?void 0:e.readonly.value))})),f=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==n?void 0:n.value)?void 0:e.disabled.value))}));return{id:a,group:n,isInGroup:i,modelValue:u,valid:d,invalid:s,readonly:v,disabled:f}}(n,a),c=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(r),p=e.computed((()=>`${c.value}-hint`)),b=e.computed((()=>g.value?-1:n.tabindex)),h=e.ref(),g=e.computed((()=>u.value||d.value)),y=e.computed((()=>!0===f.value||!0!==v.value&&void 0)),L=e.computed((()=>Array.isArray(s.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(m(e,t))return!0;return!1}(n.value,s.value):m(n.value,s.value))),V=e.computed((()=>!["string","number","boolean"].includes(typeof n.value)||n.value)),A=e.computed({get:()=>L.value?V.value:null,set(e){Array.isArray(s.value)?s.value=[n.value]:s.value=n.value,a("change",e)}}),{modifiers:R}=e.toRefs(n),x=function(l,t,a){return e.computed((()=>{const n={[l]:!0},o="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(n[`${l}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((t=>{n[`${l}--${t}`]=e.unref(a.value[t])})),n}))}("vv-radio",R,e.computed((()=>({valid:v.value,invalid:f.value,disabled:u.value,readonly:d.value})))),{HintSlot:j,hasHintLabelOrSlot:k,hasInvalidLabelOrSlot:P,hintSlotScope:I}=function(l,t){const a=e.computed((()=>O(l.invalidLabel))),n=e.computed((()=>O(l.validLabel))),o=e.computed((()=>l.loadingLabel)),i=e.computed((()=>l.hintLabel)),r=e.computed((()=>Boolean(l.loading&&(t.loading||o.value)))),u=e.computed((()=>!r.value&&Boolean(l.invalid&&(t.invalid||a.value)))),d=e.computed((()=>!r.value&&!u.value&&Boolean(l.valid&&(t.valid||n.value)))),s=e.computed((()=>!r.value&&!u.value&&!d.value&&Boolean(t.hint||i.value))),v=e.computed((()=>u.value||d.value||r.value||s.value)),f=e.computed((()=>({modelValue:l.modelValue,valid:l.valid,invalid:l.invalid,loading:l.loading}))),c=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:o,hintLabel:i,hasInvalidLabelOrSlot:u,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hasHintLabelOrSlot:s}),render(){var l,t,a,n,o,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(a=this.$slots).invalid)?void 0:n.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(o=this.$slots).valid)?void 0:i.call(o))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:u,hasHintLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hintSlotScope:f,HintSlot:c}}(n,i);return(l,t)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(x)),for:e.unref(c)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(c),ref_key:"input",ref:h,"onUpdate:modelValue":t[0]||(t[0]=l=>e.isRef(A)?A.value=l:null),type:"radio",class:"vv-radio__input",name:l.name,disabled:e.unref(g),value:e.unref(V),tabindex:e.unref(b),"aria-invalid":e.unref(y),"aria-describedby":e.unref(k)?e.unref(p):void 0,"aria-errormessage":e.unref(P)?e.unref(p):void 0},null,8,$),[[e.vModelRadio,e.unref(A)]]),e.renderSlot(l.$slots,"default",{value:e.unref(s)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(j),{id:e.unref(p),class:"vv-radio__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"3"}:void 0]),1032,["id"])],10,B))}})}));
1
+ !function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadio=l(e.vue,e.nanoid)}(this,(function(e,l){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});const o=Symbol.for("volver"),i=Symbol.for("radioGroup"),r={valid:Boolean,validLabel:[String,Array]},u={invalid:Boolean,invalidLabel:[String,Array]},d={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},s={disabled:Boolean},v=(Boolean,Boolean,{label:[String,Number]}),f={readonly:Boolean},c={modifiers:[String,Array]},p={hintLabel:{type:String,default:""}};a.before;const b={tabindex:{type:[String,Number],default:0}},m={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const g={...{...m,name:{type:String,required:!0}},...b,...r,...u,...p,...s,...f,...c,...v,...d,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]};function h(e,l,t){return t?S(e,t)===S(l,t):y(e,l)}function y(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),a=Array.isArray(l);let n,o,i;if(t&&a){if(o=e.length,o!=l.length)return!1;for(n=o;0!=n--;)if(!y(e[n],l[n]))return!1;return!0}if(t!=a)return!1;const r=e instanceof Date,u=l instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==l.getTime();const d=e instanceof RegExp,s=l instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==l.toString();const v=Object.keys(e);if(o=v.length,o!==Object.keys(l).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(l,v[n]))return!1;for(n=o;0!=n--;)if(i=v[n],!y(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function S(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let a=e;for(let l=0,n=t.length;l<n;++l){if(null==e)return null;a=a[t[l]]}return a}}return null}function L(l){const t=e.inject(l,void 0),a=e.computed((()=>{return l=t,!(null==(a=e.unref(l))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var l,a}));return{group:t,isInGroup:a,getGroupOrLocalRef:function(l,a,n){if(null==t?void 0:t.value){const a=e.unref(t.value)[l];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const o=e.toRef(a,l);return e.computed({get:()=>o.value,set(e){n&&n(`update:${l}`,e)}})}}}n.button;const O=g;function B(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function $(l,t,a){const n=e.inject(o),i=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[l]))return n.defaults.value[l]}));return e.computed((()=>{if(void 0===i.value)return a;const e=i.value,l=t,n=a;return Object.keys(l).reduce(((t,a)=>{const o=n[a];if(t[a]=o,a in e){if(Array.isArray(l[a])){const n=l[a];if(n.length){n[0]===o&&(t[a]=e[a])}}if("function"==typeof l[a]){(0,l[a])()===o&&(t[a]=e[a])}if("object"==typeof l[a]){let n=l[a].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(o)&&(t[a]=e[a]):n===o&&(t[a]=e[a])}}return t}),{})}))}const V=["for"],A=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"];return e.defineComponent({name:"VvRadio",props:O,emits:["click","update:modelValue","change","blur"],setup(t,{emit:a}){const n=t,o=e.useSlots(),r=$("VvRadio",O,n),{id:u,disabled:d,readonly:s,modelValue:v,valid:f,invalid:c}=function(l,t){const{id:a}=e.toRefs(l),{group:n,isInGroup:o,getGroupOrLocalRef:r}=L(i),u=r("modelValue",l,t),d=r("valid",l),s=r("invalid",l),v=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==n?void 0:n.value)?void 0:e.readonly.value))})),f=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==n?void 0:n.value)?void 0:e.disabled.value))}));return{id:a,group:n,isInGroup:o,modelValue:u,valid:d,invalid:s,readonly:v,disabled:f}}(n,a),p=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(u),b=e.computed((()=>`${p.value}-hint`)),m=e.computed((()=>y.value?-1:n.tabindex)),g=e.ref(),y=e.computed((()=>d.value||s.value)),S=e.computed((()=>!0===c.value||!0!==f.value&&void 0)),j=e.computed((()=>Array.isArray(v.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(h(e,t))return!0;return!1}(n.value,v.value):h(n.value,v.value))),R=e.computed((()=>!["string","number","boolean"].includes(typeof n.value)||n.value)),k=e.computed({get:()=>j.value?R.value:null,set(e){Array.isArray(v.value)?v.value=[n.value]:v.value=n.value,a("change",e)}}),{modifiers:x}=e.toRefs(n),N=function(l,t,a){return e.computed((()=>{const n={[l]:!0},o="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(n[`${l}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((t=>{n[`${l}--${t}`]=e.unref(a.value[t])})),n}))}("vv-radio",x,e.computed((()=>({valid:f.value,invalid:c.value,disabled:d.value,readonly:s.value})))),{HintSlot:P,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:C,hintSlotScope:w}=function(l,t){const a=e.computed((()=>e.isRef(l)?l.value:l)),n=e.computed((()=>B(a.value.invalidLabel))),o=e.computed((()=>B(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(t.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(t.invalid||n.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(t.valid||o.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),c=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:n,validLabel:o,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var l,t,a,n,o,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(a=this.$slots).invalid)?void 0:n.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(o=this.$slots).valid)?void 0:i.call(o))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:c,HintSlot:p}}(r,o);return(l,t)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(N)),for:e.unref(p)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(p),ref_key:"input",ref:g,"onUpdate:modelValue":t[0]||(t[0]=l=>e.isRef(k)?k.value=l:null),type:"radio",class:"vv-radio__input",name:l.name,disabled:e.unref(y),value:e.unref(R),tabindex:e.unref(m),"aria-invalid":e.unref(S),"aria-describedby":e.unref(I)?e.unref(b):void 0,"aria-errormessage":e.unref(C)?e.unref(b):void 0},null,8,A),[[e.vModelRadio,e.unref(k)]]),e.renderSlot(l.$slots,"default",{value:e.unref(v)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(P),{id:e.unref(b),class:"vv-radio__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"3"}:void 0]),1032,["id"])],10,V))}})}));
@@ -72,25 +72,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
72
72
  value: any;
73
73
  }): any;
74
74
  hint?(_: {
75
- modelValue: any;
75
+ modelValue: unknown;
76
76
  valid: boolean;
77
77
  invalid: boolean;
78
78
  loading: boolean;
79
79
  }): any;
80
80
  loading?(_: {
81
- modelValue: any;
81
+ modelValue: unknown;
82
82
  valid: boolean;
83
83
  invalid: boolean;
84
84
  loading: boolean;
85
85
  }): any;
86
86
  valid?(_: {
87
- modelValue: any;
87
+ modelValue: unknown;
88
88
  valid: boolean;
89
89
  invalid: boolean;
90
90
  loading: boolean;
91
91
  }): any;
92
92
  invalid?(_: {
93
- modelValue: any;
93
+ modelValue: unknown;
94
94
  valid: boolean;
95
95
  invalid: boolean;
96
96
  loading: boolean;