@volverjs/ui-vue 0.0.10-beta.15 → 0.0.10-beta.17

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 (154) hide show
  1. package/README.md +96 -2
  2. package/auto-imports.d.ts +2 -0
  3. package/dist/components/VvAccordion/VvAccordion.es.js +33 -9
  4. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  5. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +9 -2
  6. package/dist/components/VvAccordion/index.d.ts +4 -1
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +33 -9
  8. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  9. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +9 -2
  10. package/dist/components/VvAccordionGroup/index.d.ts +4 -1
  11. package/dist/components/VvAction/VvAction.es.js +29 -8
  12. package/dist/components/VvAction/VvAction.umd.js +1 -1
  13. package/dist/components/VvAction/VvAction.vue.d.ts +44 -10
  14. package/dist/components/VvAction/index.d.ts +21 -5
  15. package/dist/components/VvAlert/VvAlert.es.js +91 -107
  16. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  17. package/dist/components/VvAlert/VvAlert.vue.d.ts +14 -4
  18. package/dist/components/VvAlert/index.d.ts +7 -3
  19. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +91 -107
  20. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  21. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +9 -2
  22. package/dist/components/VvAlertGroup/index.d.ts +6 -2
  23. package/dist/components/VvAvatar/VvAvatar.es.js +33 -9
  24. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  25. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +11 -3
  26. package/dist/components/VvAvatar/index.d.ts +4 -1
  27. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +33 -9
  28. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  29. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +9 -2
  30. package/dist/components/VvAvatarGroup/index.d.ts +4 -1
  31. package/dist/components/VvBadge/VvBadge.es.js +33 -9
  32. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  33. package/dist/components/VvBadge/VvBadge.vue.d.ts +11 -3
  34. package/dist/components/VvBadge/index.d.ts +4 -1
  35. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +33 -9
  36. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  37. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -3
  38. package/dist/components/VvBreadcrumb/index.d.ts +4 -1
  39. package/dist/components/VvButton/VvButton.es.js +100 -119
  40. package/dist/components/VvButton/VvButton.umd.js +1 -1
  41. package/dist/components/VvButton/VvButton.vue.d.ts +78 -20
  42. package/dist/components/VvButton/index.d.ts +34 -12
  43. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -9
  44. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  45. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +17 -4
  46. package/dist/components/VvButtonGroup/index.d.ts +8 -2
  47. package/dist/components/VvCard/VvCard.es.js +33 -9
  48. package/dist/components/VvCard/VvCard.umd.js +1 -1
  49. package/dist/components/VvCard/VvCard.vue.d.ts +11 -3
  50. package/dist/components/VvCard/index.d.ts +4 -1
  51. package/dist/components/VvCheckbox/VvCheckbox.es.js +56 -17
  52. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  53. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +94 -22
  54. package/dist/components/VvCheckbox/index.d.ts +44 -11
  55. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +64 -19
  56. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  57. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +93 -22
  58. package/dist/components/VvCheckboxGroup/index.d.ts +44 -11
  59. package/dist/components/VvCombobox/VvCombobox.es.js +108 -165
  60. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  61. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +97 -24
  62. package/dist/components/VvCombobox/index.d.ts +42 -11
  63. package/dist/components/VvDialog/VvDialog.es.js +51 -103
  64. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  65. package/dist/components/VvDropdown/VvDropdown.es.js +33 -9
  66. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  67. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +14 -2
  68. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -12
  69. package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +11 -3
  70. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +25 -6
  71. package/dist/components/VvDropdown/index.d.ts +6 -1
  72. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +33 -9
  73. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  74. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +29 -8
  75. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  76. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +37 -10
  77. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  78. package/dist/components/VvIcon/VvIcon.es.js +22 -95
  79. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  80. package/dist/components/VvIcon/VvIcon.vue.d.ts +81 -44
  81. package/dist/components/VvIcon/index.d.ts +21 -48
  82. package/dist/components/VvInputFile/VvInputFile.es.js +146 -140
  83. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  84. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +52 -12
  85. package/dist/components/VvInputFile/index.d.ts +24 -6
  86. package/dist/components/VvInputText/VvInputText.es.js +115 -147
  87. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  88. package/dist/components/VvInputText/VvInputText.vue.d.ts +141 -34
  89. package/dist/components/VvInputText/index.d.ts +71 -26
  90. package/dist/components/VvNav/VvNav.es.js +33 -9
  91. package/dist/components/VvNav/VvNav.umd.js +1 -1
  92. package/dist/components/VvNav/VvNav.vue.d.ts +9 -2
  93. package/dist/components/VvNav/index.d.ts +4 -1
  94. package/dist/components/VvNavItem/VvNavItem.es.js +29 -8
  95. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
  96. package/dist/components/VvProgress/VvProgress.es.js +33 -9
  97. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  98. package/dist/components/VvProgress/VvProgress.vue.d.ts +9 -2
  99. package/dist/components/VvProgress/index.d.ts +4 -1
  100. package/dist/components/VvRadio/VvRadio.es.js +56 -17
  101. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  102. package/dist/components/VvRadio/VvRadio.vue.d.ts +94 -22
  103. package/dist/components/VvRadio/index.d.ts +44 -11
  104. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +64 -19
  105. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  106. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +93 -22
  107. package/dist/components/VvRadioGroup/index.d.ts +44 -11
  108. package/dist/components/VvSelect/VvSelect.es.js +95 -138
  109. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  110. package/dist/components/VvSelect/VvSelect.vue.d.ts +97 -24
  111. package/dist/components/VvSelect/index.d.ts +46 -12
  112. package/dist/components/VvTab/VvTab.es.js +33 -9
  113. package/dist/components/VvTab/VvTab.umd.js +1 -1
  114. package/dist/components/VvTab/VvTab.vue.d.ts +9 -2
  115. package/dist/components/VvTab/index.d.ts +4 -1
  116. package/dist/components/VvTextarea/VvTextarea.es.js +109 -143
  117. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  118. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +141 -34
  119. package/dist/components/VvTextarea/index.d.ts +66 -17
  120. package/dist/components/VvTooltip/VvTooltip.es.js +33 -9
  121. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  122. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +9 -2
  123. package/dist/components/VvTooltip/index.d.ts +4 -1
  124. package/dist/components/index.es.js +217 -249
  125. package/dist/components/index.umd.js +1 -1
  126. package/dist/composables/useComponentIcon.d.ts +9 -8
  127. package/dist/directives/index.es.js +33 -9
  128. package/dist/directives/index.umd.js +1 -1
  129. package/dist/directives/v-tooltip.es.js +33 -9
  130. package/dist/directives/v-tooltip.umd.js +1 -1
  131. package/dist/icons.es.js +3 -3
  132. package/dist/icons.umd.js +1 -1
  133. package/dist/props/index.d.ts +251 -61
  134. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +15 -4
  135. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +77 -22
  136. package/dist/stories/Icon/Icon.settings.d.ts +1 -0
  137. package/package.json +33 -33
  138. package/src/assets/icons/detailed.json +1 -1
  139. package/src/assets/icons/normal.json +1 -1
  140. package/src/assets/icons/simple.json +1 -1
  141. package/src/components/VvAlert/index.ts +1 -3
  142. package/src/components/VvAlertGroup/index.ts +2 -1
  143. package/src/components/VvButton/VvButton.vue +6 -6
  144. package/src/components/VvButton/index.ts +2 -4
  145. package/src/components/VvCombobox/VvCombobox.vue +5 -8
  146. package/src/components/VvIcon/VvIcon.vue +2 -2
  147. package/src/components/VvIcon/index.ts +22 -48
  148. package/src/components/VvInputFile/VvInputFile.vue +33 -10
  149. package/src/components/VvInputText/VvInputText.vue +11 -12
  150. package/src/components/VvSelect/VvSelect.vue +5 -8
  151. package/src/components/VvTextarea/VvTextarea.vue +5 -8
  152. package/src/composables/useComponentIcon.ts +15 -14
  153. package/src/props/index.ts +89 -25
  154. package/src/stories/Icon/Icon.settings.ts +3 -3
@@ -1,4 +1,4 @@
1
- import { unref, computed, isRef, defineComponent, h, inject, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, onMounted, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withModifiers, createTextVNode, createVNode, createSlots, withCtx } from "vue";
1
+ import { unref, computed, isRef, defineComponent, h, inject, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, onMounted, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withModifiers, createTextVNode, createVNode, createSlots, withCtx } from "vue";
2
2
  import { useIMask } from "vue-imask";
3
3
  import { iconExists, Icon, addIcon } from "@iconify/vue";
4
4
  import { uid } from "uid";
@@ -127,99 +127,9 @@ function HintSlotFactory(propsOrRef, slots) {
127
127
  HintSlot
128
128
  };
129
129
  }
130
- const VvIconProps = {
131
- /**
132
- * Color
133
- */
134
- color: String,
135
- /**
136
- * Width
137
- */
138
- width: {
139
- type: [String, Number]
140
- },
141
- /**
142
- * Height
143
- */
144
- height: {
145
- type: [String, Number]
146
- },
147
- /**
148
- * Icon name
149
- * Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
150
- * https://docs.iconify.design/api/providers.html#provider-in-icon-name
151
- */
152
- name: {
153
- type: String,
154
- required: true
155
- },
156
- /**
157
- * By default 'vv'
158
- * If custom collection is not added with "addCollection" DS class method, this prop could not be used
159
- * Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
160
- */
161
- provider: {
162
- type: String
163
- },
164
- /**
165
- * The name of icon set.
166
- * Icon default options prefix: simple | normal | detailed
167
- */
168
- prefix: {
169
- type: String,
170
- default: "normal"
171
- },
172
- /**
173
- * Url remote SVG icon
174
- */
175
- src: String,
176
- /**
177
- * Horizontal flip
178
- */
179
- horizontalFlip: Boolean,
180
- /**
181
- * Vertical flip
182
- */
183
- verticalFlip: Boolean,
184
- /**
185
- * String alternative to "horizontalFlip" and "verticalFlip".
186
- * Example: https://docs.iconify.design/icon-components/vue/transform.html
187
- */
188
- flip: String,
189
- /**
190
- * Icon render mode
191
- * 'style' = 'bg' or 'mask', depending on icon content
192
- * 'bg' = span with style using `background`
193
- * 'mask' = span with style using `mask`
194
- * 'svg' = svg
195
- * Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
196
- */
197
- mode: String,
198
- /**
199
- * Toggles inline or block mode
200
- * Example https://docs.iconify.design/icon-components/vue/inline.html
201
- */
202
- inline: Boolean,
203
- /**
204
- * rotates icon
205
- * Example https://docs.iconify.design/icon-components/vue/transform.html
206
- */
207
- rotate: [Number, String],
208
- /**
209
- * A callback that is called when icon data has been loaded
210
- */
211
- onLoad: Function,
212
- /**
213
- * SVG icon string
214
- */
215
- svg: String,
216
- /**
217
- * Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
218
- * @values string | string[]
219
- */
220
- modifiers: {
221
- type: [String, Array]
222
- }
130
+ const VvIconPropsDefaults = {
131
+ prefix: "normal"
132
+ /* normal */
223
133
  };
224
134
  var Strategy = /* @__PURE__ */ ((Strategy2) => {
225
135
  Strategy2["absolute"] = "absolute";
@@ -301,7 +211,24 @@ const __default__$1 = {
301
211
  };
302
212
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
303
213
  ...__default__$1,
304
- props: VvIconProps,
214
+ props: mergeDefaults({
215
+ name: {},
216
+ color: {},
217
+ width: {},
218
+ height: {},
219
+ provider: {},
220
+ prefix: {},
221
+ src: {},
222
+ horizontalFlip: { type: Boolean },
223
+ verticalFlip: { type: Boolean },
224
+ flip: {},
225
+ mode: {},
226
+ inline: { type: Boolean },
227
+ rotate: {},
228
+ onLoad: { type: Function },
229
+ svg: {},
230
+ modifiers: {}
231
+ }, VvIconPropsDefaults),
305
232
  setup(__props) {
306
233
  const props = __props;
307
234
  const hasRotate = computed(() => {
@@ -409,6 +336,7 @@ const LinkProps = {
409
336
  */
410
337
  target: {
411
338
  type: String,
339
+ default: void 0,
412
340
  validator: (value) => Object.values(AnchorTarget).includes(value)
413
341
  },
414
342
  /**
@@ -423,27 +351,33 @@ const ValidProps = {
423
351
  /**
424
352
  * Valid status
425
353
  */
426
- valid: Boolean,
354
+ valid: { type: Boolean, default: false },
427
355
  /**
428
356
  * Valid label
429
357
  */
430
- validLabel: [String, Array]
358
+ validLabel: { type: [String, Array], default: void 0 }
431
359
  };
432
360
  const InvalidProps = {
433
361
  /**
434
362
  * Invalid status
435
363
  */
436
- invalid: Boolean,
364
+ invalid: {
365
+ type: Boolean,
366
+ default: false
367
+ },
437
368
  /**
438
369
  * Invalid label
439
370
  */
440
- invalidLabel: [String, Array]
371
+ invalidLabel: { type: [String, Array], default: void 0 }
441
372
  };
442
373
  const LoadingProps = {
443
374
  /**
444
375
  * Loading status
445
376
  */
446
- loading: Boolean,
377
+ loading: {
378
+ type: Boolean,
379
+ default: false
380
+ },
447
381
  /**
448
382
  * Loading label
449
383
  */
@@ -456,43 +390,64 @@ const DisabledProps = {
456
390
  /**
457
391
  * Whether the form control is disabled
458
392
  */
459
- disabled: Boolean
393
+ disabled: {
394
+ type: Boolean,
395
+ default: false
396
+ }
460
397
  };
461
398
  const ActiveProps = {
462
399
  /**
463
400
  * Whether the item is active
464
401
  */
465
- active: Boolean
402
+ active: {
403
+ type: Boolean,
404
+ default: false
405
+ }
466
406
  };
467
407
  const CurrentProps = {
468
408
  /**
469
409
  * Whether the item is current
470
410
  */
471
- current: Boolean
411
+ current: {
412
+ type: Boolean,
413
+ default: false
414
+ }
472
415
  };
473
416
  const PressedProps = {
474
417
  /**
475
418
  * Whether the item is pressed
476
419
  */
477
- pressed: Boolean
420
+ pressed: {
421
+ type: Boolean,
422
+ default: false
423
+ }
478
424
  };
479
425
  const LabelProps = {
480
426
  /**
481
427
  * The item label
482
428
  */
483
- label: [String, Number]
429
+ label: {
430
+ type: [String, Number],
431
+ default: void 0
432
+ }
484
433
  };
485
434
  const ReadonlyProps = {
486
435
  /**
487
436
  * The value is not editable
488
437
  */
489
- readonly: Boolean
438
+ readonly: {
439
+ type: Boolean,
440
+ default: false
441
+ }
490
442
  };
491
443
  const ModifiersProps = {
492
444
  /**
493
445
  * Component BEM modifiers
494
446
  */
495
- modifiers: [String, Array]
447
+ modifiers: {
448
+ type: [String, Array],
449
+ default: void 0
450
+ }
496
451
  };
497
452
  const HintProps = {
498
453
  hintLabel: { type: String, default: "" }
@@ -511,14 +466,20 @@ const DebounceProps = {
511
466
  /**
512
467
  * Milliseconds to wait before emitting the input event
513
468
  */
514
- debounce: [Number, String]
469
+ debounce: {
470
+ type: [Number, String],
471
+ default: void 0
472
+ }
515
473
  };
516
474
  const IconProps = {
517
475
  /**
518
476
  * VvIcon name or props
519
477
  * @see VVIcon
520
478
  */
521
- icon: { type: [String, Object] },
479
+ icon: {
480
+ type: [String, Object],
481
+ default: void 0
482
+ },
522
483
  /**
523
484
  * VvIcon position
524
485
  */
@@ -539,7 +500,10 @@ const FloatingLabelProps = {
539
500
  /**
540
501
  * If true the label will be floating
541
502
  */
542
- floating: Boolean
503
+ floating: {
504
+ type: Boolean,
505
+ default: false
506
+ }
543
507
  };
544
508
  const IdProps = {
545
509
  /**
@@ -569,7 +533,8 @@ const IdProps = {
569
533
  * Dropdown show / hide transition name
570
534
  */
571
535
  transitionName: {
572
- type: String
536
+ type: String,
537
+ default: void 0
573
538
  },
574
539
  /**
575
540
  * Offset of the dropdown from the trigger
@@ -637,7 +602,8 @@ const IdProps = {
637
602
  * Set dropdown width to the same as the trigger
638
603
  */
639
604
  triggerWidth: {
640
- type: Boolean
605
+ type: Boolean,
606
+ default: false
641
607
  }
642
608
  });
643
609
  const IdNameProps = {
@@ -654,7 +620,10 @@ const AutofocusProps = {
654
620
  * Global attribute autofocus
655
621
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
656
622
  */
657
- autofocus: Boolean
623
+ autofocus: {
624
+ type: Boolean,
625
+ default: false
626
+ }
658
627
  };
659
628
  const AutocompleteProps = {
660
629
  /**
@@ -686,28 +655,34 @@ const InputTextareaProps = {
686
655
  * Available for input types: text, search, url, tel, email, password
687
656
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
688
657
  */
689
- minlength: [String, Number],
658
+ minlength: { type: [String, Number], default: void 0 },
690
659
  /**
691
660
  * Input / Textarea maxlength
692
661
  * Maximum length (number of characters) of value
693
662
  * Available for input types: text, search, url, tel, email, password
694
663
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
695
664
  */
696
- maxlength: [String, Number],
665
+ maxlength: { type: [String, Number], default: void 0 },
697
666
  /**
698
667
  * Input / Textarea placeholder
699
668
  * Text that appears in the form control when it has no value set
700
669
  * Available for input types: text, search, url, tel, email, password, number
701
670
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
702
671
  */
703
- placeholder: String,
672
+ placeholder: {
673
+ type: String,
674
+ default: void 0
675
+ },
704
676
  /**
705
677
  * Input / Textarea required
706
678
  * A value is required or must be check for the form to be submittable
707
679
  * Available for all input types except color
708
680
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
709
681
  */
710
- required: Boolean
682
+ required: {
683
+ type: Boolean,
684
+ default: false
685
+ }
711
686
  };
712
687
  ({
713
688
  ...DisabledProps,
@@ -1244,30 +1219,30 @@ function useComponentFocus(inputTemplateRef, emit) {
1244
1219
  };
1245
1220
  }
1246
1221
  function useComponentIcon(icon, iconPosition) {
1222
+ const hasIcon = computed(() => {
1223
+ if (typeof (icon == null ? void 0 : icon.value) === "string") {
1224
+ return { name: icon == null ? void 0 : icon.value };
1225
+ }
1226
+ return icon == null ? void 0 : icon.value;
1227
+ });
1247
1228
  const hasIconBefore = computed(
1248
- () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
1229
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
1249
1230
  );
1250
1231
  const hasIconAfter = computed(
1251
- () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
1232
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
1252
1233
  );
1253
1234
  const hasIconLeft = computed(
1254
- () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
1235
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
1255
1236
  );
1256
1237
  const hasIconRight = computed(
1257
- () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
1238
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
1258
1239
  );
1259
1240
  const hasIconTop = computed(
1260
- () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
1241
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
1261
1242
  );
1262
1243
  const hasIconBottom = computed(
1263
- () => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
1244
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
1264
1245
  );
1265
- const hasIcon = computed(() => {
1266
- if (typeof (icon == null ? void 0 : icon.value) === "string") {
1267
- return { name: icon == null ? void 0 : icon.value };
1268
- }
1269
- return icon == null ? void 0 : icon.value;
1270
- });
1271
1246
  return {
1272
1247
  hasIcon,
1273
1248
  hasIconLeft,
@@ -1520,11 +1495,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1520
1495
  const onClear = () => {
1521
1496
  localModelValue.value = "";
1522
1497
  };
1523
- const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
1524
- icon,
1525
- iconPosition
1526
- );
1527
- const defaultAfterIcon = computed(() => {
1498
+ const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
1499
+ const iconAfter = computed(() => {
1500
+ if (hasIconAfter.value !== void 0) {
1501
+ return hasIconAfter.value;
1502
+ }
1528
1503
  switch (props.type) {
1529
1504
  case INPUT_TYPES.COLOR:
1530
1505
  return { name: TYPES_ICON.COLOR };
@@ -1535,9 +1510,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1535
1510
  return { name: TYPES_ICON.DATE };
1536
1511
  case INPUT_TYPES.TIME:
1537
1512
  return { name: TYPES_ICON.TIME };
1538
- default:
1539
- return "";
1540
1513
  }
1514
+ return void 0;
1541
1515
  });
1542
1516
  const { formatted: countFormatted } = useTextCount(localModelValue, {
1543
1517
  mode: count.value,
@@ -1568,8 +1542,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1568
1542
  loading: loading.value,
1569
1543
  disabled: props.disabled,
1570
1544
  readonly: props.readonly,
1571
- "icon-before": hasIconBefore.value,
1572
- "icon-after": hasIconAfter.value || !isEmpty(defaultAfterIcon),
1545
+ "icon-before": hasIconBefore.value !== void 0,
1546
+ "icon-after": iconAfter.value !== void 0,
1573
1547
  floating: props.floating && !isEmpty(props.label),
1574
1548
  dirty: isDirty.value,
1575
1549
  focus: isFocused.value,
@@ -1700,10 +1674,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1700
1674
  }, [
1701
1675
  unref(hasIconBefore) ? (openBlock(), createBlock(
1702
1676
  _sfc_main$1,
1703
- mergeProps({
1704
- key: 0,
1705
- class: "vv-input-text__icon"
1706
- }, unref(hasIcon)),
1677
+ mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
1707
1678
  null,
1708
1679
  16
1709
1680
  /* FULL_PROPS */
@@ -1728,12 +1699,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1728
1699
  ])
1729
1700
  ])) : createCommentVNode("v-if", true)
1730
1701
  ], 8, _hoisted_4),
1731
- unref(hasIconAfter) || unref(defaultAfterIcon) ? (openBlock(), createBlock(
1702
+ unref(iconAfter) ? (openBlock(), createBlock(
1732
1703
  _sfc_main$1,
1733
- mergeProps({
1734
- key: 1,
1735
- class: "vv-input-text__icon vv-input-text__icon-after"
1736
- }, unref(hasIconAfter) ? unref(hasIcon) : unref(defaultAfterIcon)),
1704
+ mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
1737
1705
  null,
1738
1706
  16
1739
1707
  /* FULL_PROPS */
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("vue-imask"),require("@iconify/vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","vue-imask","@iconify/vue","uid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.vueImask,e.vue$1,e.uid,e.core)}(this,(function(e,t,l,o,a){"use strict";function n(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function i(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const r={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 u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{}),v=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(v||{});const c=Symbol.for("volver");function p(){return e.inject(c)}function m(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const f=e.defineComponent({name:"VvIcon",props:r,setup(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=p(),{modifiers:r}=e.toRefs(o),u=m("vv-icon",r),s=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${s.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${s.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${s.value}:${a.prefix}:${e}`:e}));function v(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),h={valid:Boolean,validLabel:[String,Array]},b={invalid:Boolean,invalidLabel:[String,Array]},g={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},S={disabled:Boolean},y=(Boolean,Boolean,Boolean,{label:[String,Number]}),w={readonly:Boolean},k={modifiers:[String,Array]},L={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},E={debounce:[Number,String]},x={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},$={tabindex:{type:[String,Number],default:0}},A={floating:Boolean},T={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const P={...{...T,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...$,...S,...w,...h,...b,...L,...g,...k,...B,...E,...x,...A,...y,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button,v.button;const C={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},D="eye-on",I="eye-off",O="calendar",N="time",V="color",_={...P,modelValue:[String,Number],type:{type:String,default:C.TEXT,validator:e=>Object.values(C).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:D},iconHidePassword:{type:String,default:I},iconClear:{type:String,default:"close"},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},iMask:{type:Object,default:void 0},masked:{type:String,default:void 0},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String},selectOnFocus:{type:Boolean,default:!1}},M=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:D},iconHide:{type:String,default:I}},emits:["toggle-password"],setup(t,{emit:l}){const o=e.ref(!1),a=e.computed((()=>o.value?t.iconHide:t.iconShow));return{active:o,activeIcon:a,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(o.value=!o.value,l("toggle-password",o.value))}}},render(){const t=e.h(f,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),R=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:l}){const o=e.computed((()=>"up"===t.mode));return{isUp:o,onClick:e=>{null==e||e.stopPropagation(),t.disabled||l(o.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),H=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(l){null==l||l.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(f,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function U(t,l){return{name:"VvInputTextActions",components:{VvIcon:f,VvInputPasswordAction:M,VvInputStepAction:R,VvInputClearAction:H},setup:()=>({isDisabled:e.computed((()=>l.disabled||l.readonly)),labelStepUp:l.labelStepUp,labelStepDown:l.labelStepDown,labelShowPassword:l.labelShowPassword,labelHidePassword:l.labelHidePassword,labelClear:l.labelClear,iconShowPassword:l.iconShowPassword,iconHidePassword:l.iconHidePassword}),render(){let o=null;switch(t){case C.SEARCH:{const{onClear:t}=this.$attrs;o=[e.h(H,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case C.PASSWORD:{const{onTogglePassword:t}=this.$attrs;o=[e.h(M,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case C.NUMBER:{const{onStepUp:t,onStepDown:a}=this.$attrs;o=[e.h(R,{mode:"up",disabled:this.isDisabled||void 0!==l.max&&l.modelValue===l.max,label:this.labelStepUp,onStepUp:t,onStepDown:a}),e.h(R,{mode:"down",disabled:this.isDisabled||void 0!==l.min&&l.modelValue===l.min,label:this.labelStepDown,onStepUp:t,onStepDown:a})];break}}return Array.isArray(o)?e.h("div",{class:"vv-input-text__actions-group"},o):o}}}const j=["for"],F={class:"vv-input-text__wrapper"},W={key:0,class:"vv-input-text__input-before"},q=["onClick"],z=["id"],K={key:1,class:"vv-input-text__unit"},X={key:5,class:"vv-input-text__input-after"},J={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:_,emits:["update:modelValue","update:masked","accept","accept:typed","accept:masked","accept:unmasked","complete","complete:typed","complete:masked","complete:unmasked","focus","blur","keyup","keydown","keypress"],setup(l,{expose:r,emit:d}){const v=l,c=e.useSlots(),h=function(t,l,o){const a=p(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputText",_,v),{id:b,icon:g,iconPosition:S,label:y,modelValue:w,count:k,valid:L,invalid:B,loading:E,debounce:x,maxlength:$,minlength:A,type:T,iMask:P,step:D}=e.toRefs(v),I=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))))(b),M=e.computed((()=>`${I.value}-hint`)),R=e.computed((()=>v.floating&&n(v.placeholder)?" ":v.placeholder)),H=e.ref(!1),{el:Y,mask:G,typed:Q,masked:Z,unmasked:ee}=t.useIMask(e.computed((()=>(null==P?void 0:P.value)??{mask:/./})),{emit:d,onAccept:()=>{if(H.value){if(d("update:masked",Z.value),T.value===C.NUMBER){if(""===Z.value){if(null===oe.value||void 0===oe.value)return;return void(oe.value=void 0)}return"number"!=typeof Q.value?void(oe.value=Number(Q.value)):void(oe.value=Q.value)}if(T.value===C.DATE){if(Y.value instanceof HTMLInputElement&&"date"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return e instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}`)}if(T.value===C.DATETIME_LOCAL){if(Y.value instanceof HTMLInputElement&&"datetime-local"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return Q.value instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}T${("0"+e.getHours()).slice(-2)}:${("0"+e.getMinutes()).slice(-2)}`)}(oe.value||ee.value)&&(oe.value=ee.value)}}});e.onMounted((()=>{G.value&&(H.value=!0,Q.value=oe.value??"")})),e.watch((()=>v.modelValue),(e=>{var t;G.value&&(Q.value=e&&(null==(t=null==P?void 0:P.value)?void 0:t.mask)===Date?new Date(e):e??"")})),e.watch((()=>v.masked),(e=>{Z.value=e??""}));const te=Y,le=e.ref();r({$inner:le});const oe=function(t,l,o=0,{getter:a=(e=>e),setter:n=(e=>e)}={}){let i;return"string"==typeof o&&(o=parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{l("update:modelValue",n(e))}),o)}})}(w,d,(null==x?void 0:x.value)??0),{focused:ae}=function(t,l){const{focused:o}=a.useFocus(t);return e.watch(o,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:o}}(te,d),ne=e.computed((()=>ae.value&&!v.disabled&&!v.readonly));e.watch(ne,(e=>{e&&h.value.selectOnFocus&&te.value&&te.value.select()}));const ie=a.useElementVisibility(te);e.watch(ie,(e=>{e&&v.autofocus&&!v.disabled&&!v.readonly&&(ae.value=!0)}));const re=e.ref(!1),ue=e.computed((()=>v.type===C.PASSWORD)),se=()=>{re.value=!re.value},de=e.computed((()=>v.type===C.TIME||v.type===C.DATETIME_LOCAL||v.type===C.DATE||v.type===C.WEEK||v.type===C.MONTH)),ve=e.computed((()=>v.type===C.NUMBER)),ce=()=>{if(we.value){if(null==P?void 0:P.value)return void(Q.value=Q.value+Number((null==D?void 0:D.value)??1));te.value.stepUp(),oe.value=Number(e.unref(te).value)}},pe=()=>{if(we.value){if(null==P?void 0:P.value)return void(Q.value=Q.value-Number((null==D?void 0:D.value)??1));te.value.stepDown(),oe.value=Number(e.unref(te).value)}},me=e.computed((()=>v.type===C.SEARCH)),fe=()=>{oe.value=""},{hasIcon:he,hasIconBefore:be,hasIconAfter:ge}=function(t,l){const o=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.before))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.after))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.top))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:n,hasIconRight:i,hasIconTop:r,hasIconBottom:d,hasIconBefore:o,hasIconAfter:a}}(g,S),Se=e.computed((()=>{switch(v.type){case C.COLOR:return{name:V};case C.DATE:case C.DATETIME_LOCAL:case C.WEEK:case C.MONTH:return{name:O};case C.TIME:return{name:N};default:return""}})),{formatted:ye}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),n=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:n}}(oe,{mode:k.value,upperLimit:Number(null==$?void 0:$.value),lowerLimit:Number(null==A?void 0:A.value)}),we=e.computed((()=>!v.disabled&&!v.readonly)),ke=e.computed((()=>we.value?v.tabindex:-1)),Le=e.computed((()=>!n(w))),Be=e.computed((()=>!0===B.value||!0!==L.value&&void 0)),{modifiers:Ee}=e.toRefs(v),xe=m("vv-input-text",Ee,e.computed((()=>({valid:L.value,invalid:B.value,loading:E.value,disabled:v.disabled,readonly:v.readonly,"icon-before":be.value,"icon-after":ge.value||!n(Se),floating:v.floating&&!n(v.label),dirty:Le.value,focus:ne.value,"auto-width":v.autoWidth})))),$e=e.computed((()=>{const e=ue.value&&re.value?C.TEXT:!de.value||Le.value||ae.value?(null==P?void 0:P.value)?C.TEXT:v.type:C.TEXT,t={type:e,name:v.name,tabindex:ke.value,disabled:v.disabled,readonly:v.readonly,required:v.required,autocomplete:v.autocomplete,"aria-invalid":Be.value,"aria-describedby":Pe.value?M.value:void 0,"aria-errormessage":Ce.value?M.value:void 0};return e!==C.DATE&&e!==C.MONTH&&e!==C.WEEK&&e!==C.TIME&&e!==C.DATETIME_LOCAL&&e!==C.NUMBER||(t.step=v.step,t.max=void 0!==v.max?String(v.max):void 0,t.min=void 0!==v.min?String(v.min):void 0),e!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD&&e!==C.NUMBER||(t.placeholder=R.value),e!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD||(t.minlength=v.minlength,t.maxlength=v.maxlength,t.pattern=v.pattern),e===C.EMAIL&&(t.multiple=v.multiple),t})),Ae=e.computed((()=>({valid:v.valid,invalid:v.invalid,modelValue:v.modelValue,togglePassword:se,stepUp:ce,stepDown:pe,clear:fe}))),{HintSlot:Te,hasHintLabelOrSlot:Pe,hasInvalidLabelOrSlot:Ce,hintSlotScope:De}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>i(o.value.invalidLabel))),n=e.computed((()=>i(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),u=e.computed((()=>o.value.hintLabel)),s=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),d=e.computed((()=>!s.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),v=e.computed((()=>!s.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!s.value&&!d.value&&!v.value&&Boolean(l.hint||u.value))),p=e.computed((()=>d.value||v.value||s.value||c.value)),m=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:p,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:s,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:s,hintSlotScope:m,HintSlot:f}}(h,c),Ie=U(C.PASSWORD,v),Oe=U(C.NUMBER,v),Ne=U(C.SEARCH,v),Ve=()=>{we.value&&(ae.value=!0)},_e=e.computed((()=>{if(v.autoWidth)return{width:void 0!==oe.value?`${String(oe.value).length+1}ch`:void 0}})),Me=e=>{switch(e.code){case"ArrowUp":ve.value&&(ce(),e.preventDefault());break;case"ArrowDown":ve.value&&(pe(),e.preventDefault())}d("keydown",e)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(xe))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(I),class:"vv-input-text__label"},e.toDisplayString(e.unref(y)),9,j)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",F,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",W,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:le,class:"vv-input-text__inner",onClick:e.withModifiers(Ve,["stop"])},[e.unref(be)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(he)),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(I),ref_key:"inputEl",ref:te},e.unref($e),{style:e.unref(_e),onKeyup:l[0]||(l[0]=e=>d("keyup",e)),onKeydown:Me,onKeypress:l[1]||(l[1]=e=>d("keypress",e))}),null,16,z),(t.unit||t.$slots.unit)&&e.unref(Le)?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("v-if",!0)],8,q),e.unref(ge)||e.unref(Se)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ge)?e.unref(he):e.unref(Se)),null,16)):e.unref(ue)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ie),{key:2,onTogglePassword:se})):e.unref(ve)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Oe),{key:3,onStepUp:ce,onStepDown:pe})):e.unref(me)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ne),{key:4,onClear:fe})):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",J,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ye)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(Te),{id:e.unref(M),class:"vv-input-text__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("vue-imask"),require("@iconify/vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","vue-imask","@iconify/vue","uid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.vueImask,e.vue$1,e.uid,e.core)}(this,(function(e,t,l,o,a){"use strict";function n(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function i(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}var u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{}),s=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(s||{});const v=Symbol.for("volver");function c(){return e.inject(v)}function p(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const f=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},{prefix:"normal"}),setup(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=c(),{modifiers:u}=e.toRefs(o),r=p("vv-icon",u),d=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),s=e.computed((()=>{const e=o.name??"",t=`@${d.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${d.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function v(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),m={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},b={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},y={disabled:{type:Boolean,default:!1}},g=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),S={readonly:{type:Boolean,default:!1}},w={modifiers:{type:[String,Array],default:void 0}},k={hintLabel:{type:String,default:""}},L={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},E={debounce:{type:[Number,String],default:void 0}},B={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},x={tabindex:{type:[String,Number],default:0}},$={floating:{type:Boolean,default:!1}},T={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const A={...{...T,name:{type:String,required:!0}},...{autofocus:{type:Boolean,default:!1}},...{autocomplete:{type:String,default:"off"}},...x,...y,...S,...m,...h,...k,...b,...w,...L,...E,...B,...$,...g,minlength:{type:[String,Number],default:void 0},maxlength:{type:[String,Number],default:void 0},placeholder:{type:String,default:void 0},required:{type:Boolean,default:!1}};d.button,s.button;const P={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},C="eye-on",D="eye-off",I="calendar",O="time",V="color",_={...A,modelValue:[String,Number],type:{type:String,default:P.TEXT,validator:e=>Object.values(P).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:C},iconHidePassword:{type:String,default:D},iconClear:{type:String,default:"close"},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},iMask:{type:Object,default:void 0},masked:{type:String,default:void 0},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String},selectOnFocus:{type:Boolean,default:!1}},N=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:C},iconHide:{type:String,default:D}},emits:["toggle-password"],setup(t,{emit:l}){const o=e.ref(!1),a=e.computed((()=>o.value?t.iconHide:t.iconShow));return{active:o,activeIcon:a,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(o.value=!o.value,l("toggle-password",o.value))}}},render(){const t=e.h(f,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),M=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:l}){const o=e.computed((()=>"up"===t.mode));return{isUp:o,onClick:e=>{null==e||e.stopPropagation(),t.disabled||l(o.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),R=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(l){null==l||l.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(f,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function H(t,l){return{name:"VvInputTextActions",components:{VvIcon:f,VvInputPasswordAction:N,VvInputStepAction:M,VvInputClearAction:R},setup:()=>({isDisabled:e.computed((()=>l.disabled||l.readonly)),labelStepUp:l.labelStepUp,labelStepDown:l.labelStepDown,labelShowPassword:l.labelShowPassword,labelHidePassword:l.labelHidePassword,labelClear:l.labelClear,iconShowPassword:l.iconShowPassword,iconHidePassword:l.iconHidePassword}),render(){let o=null;switch(t){case P.SEARCH:{const{onClear:t}=this.$attrs;o=[e.h(R,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;o=[e.h(N,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case P.NUMBER:{const{onStepUp:t,onStepDown:a}=this.$attrs;o=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==l.max&&l.modelValue===l.max,label:this.labelStepUp,onStepUp:t,onStepDown:a}),e.h(M,{mode:"down",disabled:this.isDisabled||void 0!==l.min&&l.modelValue===l.min,label:this.labelStepDown,onStepUp:t,onStepDown:a})];break}}return Array.isArray(o)?e.h("div",{class:"vv-input-text__actions-group"},o):o}}}const U=["for"],j={class:"vv-input-text__wrapper"},F={key:0,class:"vv-input-text__input-before"},W=["onClick"],z=["id"],q={key:1,class:"vv-input-text__unit"},K={key:5,class:"vv-input-text__input-after"},X={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:_,emits:["update:modelValue","update:masked","accept","accept:typed","accept:masked","accept:unmasked","complete","complete:typed","complete:masked","complete:unmasked","focus","blur","keyup","keydown","keypress"],setup(l,{expose:d,emit:s}){const v=l,m=e.useSlots(),h=function(t,l,o){const a=c(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputText",_,v),{id:b,icon:y,iconPosition:g,label:S,modelValue:w,count:k,valid:L,invalid:E,loading:B,debounce:x,maxlength:$,minlength:T,type:A,iMask:C,step:D}=e.toRefs(v),N=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))))(b),M=e.computed((()=>`${N.value}-hint`)),R=e.computed((()=>v.floating&&n(v.placeholder)?" ":v.placeholder)),J=e.ref(!1),{el:Y,mask:G,typed:Q,masked:Z,unmasked:ee}=t.useIMask(e.computed((()=>(null==C?void 0:C.value)??{mask:/./})),{emit:s,onAccept:()=>{if(J.value){if(s("update:masked",Z.value),A.value===P.NUMBER){if(""===Z.value){if(null===oe.value||void 0===oe.value)return;return void(oe.value=void 0)}return"number"!=typeof Q.value?void(oe.value=Number(Q.value)):void(oe.value=Q.value)}if(A.value===P.DATE){if(Y.value instanceof HTMLInputElement&&"date"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return e instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}`)}if(A.value===P.DATETIME_LOCAL){if(Y.value instanceof HTMLInputElement&&"datetime-local"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return Q.value instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}T${("0"+e.getHours()).slice(-2)}:${("0"+e.getMinutes()).slice(-2)}`)}(oe.value||ee.value)&&(oe.value=ee.value)}}});e.onMounted((()=>{G.value&&(J.value=!0,Q.value=oe.value??"")})),e.watch((()=>v.modelValue),(e=>{var t;G.value&&(Q.value=e&&(null==(t=null==C?void 0:C.value)?void 0:t.mask)===Date?new Date(e):e??"")})),e.watch((()=>v.masked),(e=>{Z.value=e??""}));const te=Y,le=e.ref();d({$inner:le});const oe=function(t,l,o=0,{getter:a=(e=>e),setter:n=(e=>e)}={}){let i;return"string"==typeof o&&(o=parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{l("update:modelValue",n(e))}),o)}})}(w,s,(null==x?void 0:x.value)??0),{focused:ae}=function(t,l){const{focused:o}=a.useFocus(t);return e.watch(o,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:o}}(te,s),ne=e.computed((()=>ae.value&&!v.disabled&&!v.readonly));e.watch(ne,(e=>{e&&h.value.selectOnFocus&&te.value&&te.value.select()}));const ie=a.useElementVisibility(te);e.watch(ie,(e=>{e&&v.autofocus&&!v.disabled&&!v.readonly&&(ae.value=!0)}));const ue=e.ref(!1),re=e.computed((()=>v.type===P.PASSWORD)),de=()=>{ue.value=!ue.value},se=e.computed((()=>v.type===P.TIME||v.type===P.DATETIME_LOCAL||v.type===P.DATE||v.type===P.WEEK||v.type===P.MONTH)),ve=e.computed((()=>v.type===P.NUMBER)),ce=()=>{if(Se.value){if(null==C?void 0:C.value)return void(Q.value=Q.value+Number((null==D?void 0:D.value)??1));te.value.stepUp(),oe.value=Number(e.unref(te).value)}},pe=()=>{if(Se.value){if(null==C?void 0:C.value)return void(Q.value=Q.value-Number((null==D?void 0:D.value)??1));te.value.stepDown(),oe.value=Number(e.unref(te).value)}},fe=e.computed((()=>v.type===P.SEARCH)),me=()=>{oe.value=""},{hasIconBefore:he,hasIconAfter:be}=function(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===r.before?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===r.after?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===u.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===u.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===u.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===u.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:i,hasIconRight:d,hasIconTop:s,hasIconBottom:v,hasIconBefore:a,hasIconAfter:n}}(y,g),ye=e.computed((()=>{if(void 0!==be.value)return be.value;switch(v.type){case P.COLOR:return{name:V};case P.DATE:case P.DATETIME_LOCAL:case P.WEEK:case P.MONTH:return{name:I};case P.TIME:return{name:O}}})),{formatted:ge}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),n=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:n}}(oe,{mode:k.value,upperLimit:Number(null==$?void 0:$.value),lowerLimit:Number(null==T?void 0:T.value)}),Se=e.computed((()=>!v.disabled&&!v.readonly)),we=e.computed((()=>Se.value?v.tabindex:-1)),ke=e.computed((()=>!n(w))),Le=e.computed((()=>!0===E.value||!0!==L.value&&void 0)),{modifiers:Ee}=e.toRefs(v),Be=p("vv-input-text",Ee,e.computed((()=>({valid:L.value,invalid:E.value,loading:B.value,disabled:v.disabled,readonly:v.readonly,"icon-before":void 0!==he.value,"icon-after":void 0!==ye.value,floating:v.floating&&!n(v.label),dirty:ke.value,focus:ne.value,"auto-width":v.autoWidth})))),xe=e.computed((()=>{const e=re.value&&ue.value?P.TEXT:!se.value||ke.value||ae.value?(null==C?void 0:C.value)?P.TEXT:v.type:P.TEXT,t={type:e,name:v.name,tabindex:we.value,disabled:v.disabled,readonly:v.readonly,required:v.required,autocomplete:v.autocomplete,"aria-invalid":Le.value,"aria-describedby":Ae.value?M.value:void 0,"aria-errormessage":Pe.value?M.value:void 0};return e!==P.DATE&&e!==P.MONTH&&e!==P.WEEK&&e!==P.TIME&&e!==P.DATETIME_LOCAL&&e!==P.NUMBER||(t.step=v.step,t.max=void 0!==v.max?String(v.max):void 0,t.min=void 0!==v.min?String(v.min):void 0),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD&&e!==P.NUMBER||(t.placeholder=R.value),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD||(t.minlength=v.minlength,t.maxlength=v.maxlength,t.pattern=v.pattern),e===P.EMAIL&&(t.multiple=v.multiple),t})),$e=e.computed((()=>({valid:v.valid,invalid:v.invalid,modelValue:v.modelValue,togglePassword:de,stepUp:ce,stepDown:pe,clear:me}))),{HintSlot:Te,hasHintLabelOrSlot:Ae,hasInvalidLabelOrSlot:Pe,hintSlotScope:Ce}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>i(o.value.invalidLabel))),n=e.computed((()=>i(o.value.validLabel))),u=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),d=e.computed((()=>Boolean(o.value.loading&&(l.loading||u.value)))),s=e.computed((()=>!d.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),v=e.computed((()=>!d.value&&!s.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!d.value&&!s.value&&!v.value&&Boolean(l.hint||r.value))),p=e.computed((()=>s.value||v.value||d.value||c.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:p,invalidLabel:a,validLabel:n,loadingLabel:u,hintLabel:r,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:d,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,i,u,r;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(r=(u=this.$slots).hint)?void 0:r.call(u))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:d,hintSlotScope:f,HintSlot:m}}(h,m),De=H(P.PASSWORD,v),Ie=H(P.NUMBER,v),Oe=H(P.SEARCH,v),Ve=()=>{Se.value&&(ae.value=!0)},_e=e.computed((()=>{if(v.autoWidth)return{width:void 0!==oe.value?`${String(oe.value).length+1}ch`:void 0}})),Ne=e=>{switch(e.code){case"ArrowUp":ve.value&&(ce(),e.preventDefault());break;case"ArrowDown":ve.value&&(pe(),e.preventDefault())}s("keydown",e)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(Be))},[e.unref(S)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(N),class:"vv-input-text__label"},e.toDisplayString(e.unref(S)),9,U)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",j,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref($e))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:le,class:"vv-input-text__inner",onClick:e.withModifiers(Ve,["stop"])},[e.unref(he)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:0},e.unref(he),{class:"vv-input-text__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(N),ref_key:"inputEl",ref:te},e.unref(xe),{style:e.unref(_e),onKeyup:l[0]||(l[0]=e=>s("keyup",e)),onKeydown:Ne,onKeypress:l[1]||(l[1]=e=>s("keypress",e))}),null,16,z),(t.unit||t.$slots.unit)&&e.unref(ke)?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref($e))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("v-if",!0)],8,W),e.unref(ye)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:1},e.unref(ye),{class:"vv-input-text__icon vv-input-text__icon-after"}),null,16)):e.unref(re)&&!t.hideActions&&e.unref(Se)?(e.openBlock(),e.createBlock(e.unref(De),{key:2,onTogglePassword:de})):e.unref(ve)&&!t.hideActions&&e.unref(Se)?(e.openBlock(),e.createBlock(e.unref(Ie),{key:3,onStepUp:ce,onStepDown:pe})):e.unref(fe)&&!t.hideActions&&e.unref(Se)?(e.openBlock(),e.createBlock(e.unref(Oe),{key:4,onClear:me})):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref($e))))])):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",X,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref($e))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ge)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(Te),{id:e.unref(M),class:"vv-input-text__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(Ce))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(Ce))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(Ce))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(Ce))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));