@volverjs/ui-vue 0.0.9-beta.8 → 0.0.9

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 (87) hide show
  1. package/auto-imports.d.ts +2 -2
  2. package/dist/components/VvAccordion/VvAccordion.es.js +8 -7
  3. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +8 -7
  4. package/dist/components/VvAction/VvAction.es.js +8 -7
  5. package/dist/components/VvAlert/VvAlert.es.js +8 -7
  6. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +8 -7
  7. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +7 -7
  8. package/dist/components/VvAlertGroup/index.d.ts +2 -2
  9. package/dist/components/VvAvatar/VvAvatar.es.js +8 -7
  10. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +8 -7
  11. package/dist/components/VvBadge/VvBadge.es.js +8 -7
  12. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +8 -7
  13. package/dist/components/VvButton/VvButton.es.js +8 -7
  14. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +8 -7
  15. package/dist/components/VvCard/VvCard.es.js +8 -7
  16. package/dist/components/VvCheckbox/VvCheckbox.es.js +28 -20
  17. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  18. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +28 -20
  19. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  20. package/dist/components/VvCombobox/VvCombobox.es.js +165 -129
  21. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  22. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +306 -90
  23. package/dist/components/VvCombobox/index.d.ts +108 -31
  24. package/dist/components/VvDialog/VvDialog.es.js +37 -31
  25. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  26. package/dist/components/VvDropdown/VvDropdown.es.js +19 -16
  27. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  28. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +301 -93
  29. package/dist/components/VvDropdown/index.d.ts +99 -30
  30. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +8 -7
  31. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +8 -7
  32. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +8 -7
  33. package/dist/components/VvInputText/VvInputText.es.js +212 -115
  34. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  35. package/dist/components/VvInputText/VvInputText.vue.d.ts +19 -37
  36. package/dist/components/VvInputText/index.d.ts +15 -33
  37. package/dist/components/VvNav/VvNav.es.js +8 -7
  38. package/dist/components/VvProgress/VvProgress.es.js +8 -7
  39. package/dist/components/VvRadio/VvRadio.es.js +28 -20
  40. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  41. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +28 -20
  42. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  43. package/dist/components/VvSelect/VvSelect.es.js +28 -20
  44. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  45. package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
  46. package/dist/components/VvTab/VvTab.es.js +8 -7
  47. package/dist/components/VvTextarea/VvTextarea.es.js +36 -25
  48. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  49. package/dist/components/VvTooltip/VvTooltip.es.js +8 -7
  50. package/dist/components/index.es.js +390 -257
  51. package/dist/components/index.umd.js +1 -1
  52. package/dist/constants.d.ts +4 -0
  53. package/dist/directives/index.es.js +8 -7
  54. package/dist/directives/v-tooltip.es.js +8 -7
  55. package/dist/icons.es.js +3 -3
  56. package/dist/icons.umd.js +1 -1
  57. package/dist/props/index.d.ts +100 -31
  58. package/dist/resolvers/unplugin.es.js +3 -0
  59. package/dist/resolvers/unplugin.umd.js +1 -1
  60. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +1 -1
  61. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +11 -11
  62. package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
  63. package/dist/stories/InputText/InputText.settings.d.ts +31 -9
  64. package/dist/stories/InputText/InputText.stories.d.ts +0 -1
  65. package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
  66. package/package.json +63 -62
  67. package/src/assets/icons/detailed.json +1 -1
  68. package/src/assets/icons/normal.json +1 -1
  69. package/src/assets/icons/simple.json +1 -1
  70. package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
  71. package/src/components/VvCombobox/VvCombobox.vue +40 -19
  72. package/src/components/VvCombobox/index.ts +13 -0
  73. package/src/components/VvDialog/VvDialog.vue +16 -13
  74. package/src/components/VvDropdown/VvDropdown.vue +18 -16
  75. package/src/components/VvInputText/VvInputText.vue +170 -55
  76. package/src/components/VvInputText/index.ts +32 -34
  77. package/src/components/VvTextarea/VvTextarea.vue +8 -5
  78. package/src/components/common/HintSlot.ts +20 -12
  79. package/src/constants.ts +5 -0
  80. package/src/props/index.ts +7 -11
  81. package/src/resolvers/unplugin.ts +3 -0
  82. package/src/stories/Combobox/Combobox.settings.ts +8 -0
  83. package/src/stories/Combobox/Combobox.test.ts +1 -1
  84. package/src/stories/InputText/InputText.settings.ts +36 -15
  85. package/src/stories/InputText/InputText.stories.ts +4 -12
  86. package/src/stories/InputText/InputText.test.ts +31 -15
  87. package/src/stories/InputText/InputTextMask.stories.ts +122 -0
@@ -1,5 +1,5 @@
1
- import { unref, computed, defineComponent, h, inject, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withModifiers, withDirectives, isRef, vModelDynamic, createTextVNode, createVNode, createSlots, withCtx } from "vue";
2
- import { Mask } from "maska";
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";
2
+ import { useIMask } from "vue-imask";
3
3
  import { iconExists, Icon, addIcon } from "@iconify/vue";
4
4
  import { nanoid } from "nanoid";
5
5
  import { useFocus, useElementVisibility } from "@vueuse/core";
@@ -16,19 +16,26 @@ function joinLines(items) {
16
16
  return items;
17
17
  }
18
18
  function HintSlotFactory(propsOrRef, slots) {
19
- const props = unref(propsOrRef);
20
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
21
- const validLabel = computed(() => joinLines(props.validLabel));
22
- const loadingLabel = computed(() => props.loadingLabel);
23
- const hintLabel = computed(() => props.hintLabel);
19
+ const props = computed(() => {
20
+ if (isRef(propsOrRef)) {
21
+ return propsOrRef.value;
22
+ }
23
+ return propsOrRef;
24
+ });
25
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
26
+ const validLabel = computed(() => joinLines(props.value.validLabel));
27
+ const loadingLabel = computed(() => props.value.loadingLabel);
28
+ const hintLabel = computed(() => props.value.hintLabel);
24
29
  const hasLoadingLabelOrSlot = computed(
25
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
30
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
26
31
  );
27
32
  const hasInvalidLabelOrSlot = computed(
28
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
33
+ () => !hasLoadingLabelOrSlot.value && Boolean(
34
+ props.value.invalid && (slots.invalid || invalidLabel.value)
35
+ )
29
36
  );
30
37
  const hasValidLabelOrSlot = computed(
31
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
38
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
32
39
  );
33
40
  const hasHintLabelOrSlot = computed(
34
41
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -37,10 +44,10 @@ function HintSlotFactory(propsOrRef, slots) {
37
44
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
38
45
  );
39
46
  const hintSlotScope = computed(() => ({
40
- modelValue: props.modelValue,
41
- valid: props.valid,
42
- invalid: props.invalid,
43
- loading: props.loading
47
+ modelValue: props.value.modelValue,
48
+ valid: props.value.valid,
49
+ invalid: props.value.invalid,
50
+ loading: props.value.loading
44
51
  }));
45
52
  const HintSlot = defineComponent({
46
53
  name: "HintSlot",
@@ -214,6 +221,11 @@ const VvIconProps = {
214
221
  type: [String, Array]
215
222
  }
216
223
  };
224
+ var Strategy = /* @__PURE__ */ ((Strategy2) => {
225
+ Strategy2["absolute"] = "absolute";
226
+ Strategy2["fixed"] = "fixed";
227
+ return Strategy2;
228
+ })(Strategy || {});
217
229
  var Side = /* @__PURE__ */ ((Side2) => {
218
230
  Side2["left"] = "left";
219
231
  Side2["right"] = "right";
@@ -530,19 +542,15 @@ const IdProps = {
530
542
  placement: {
531
543
  type: String,
532
544
  default: Side.bottom,
533
- validator: (value) => {
534
- return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
535
- }
545
+ validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
536
546
  },
537
547
  /**
538
548
  * Dropdown strategy
539
549
  */
540
550
  strategy: {
541
551
  type: String,
542
- default: "absolute",
543
- validator: (value) => {
544
- return ["fixed", "absolute"].includes(value);
545
- }
552
+ default: void 0,
553
+ validator: (value) => Object.values(Strategy).includes(value)
546
554
  },
547
555
  /**
548
556
  * Dropdown show / hide transition name
@@ -733,7 +741,23 @@ const TYPES_ICON = {
733
741
  COLOR: "color",
734
742
  SEARCH: "close"
735
743
  };
736
- const VvInputTextEvents = ["update:modelValue", "focus", "blur", "keyup"];
744
+ const VvInputTextEvents = [
745
+ "update:modelValue",
746
+ "update:masked",
747
+ "accept",
748
+ "accept:typed",
749
+ "accept:masked",
750
+ "accept:unmasked",
751
+ "complete",
752
+ "complete:typed",
753
+ "complete:masked",
754
+ "complete:unmasked",
755
+ "focus",
756
+ "blur",
757
+ "keyup",
758
+ "keydown",
759
+ "keypress"
760
+ ];
737
761
  const VvInputTextProps = {
738
762
  ...InputTextareaProps,
739
763
  /**
@@ -840,44 +864,19 @@ const VvInputTextProps = {
840
864
  default: "Clear"
841
865
  },
842
866
  /**
843
- * Input mask, only for text type
844
- * @see https://beholdr.github.io/maska/
845
- */
846
- mask: {
847
- type: String,
848
- default: void 0
849
- },
850
- /**
851
- * Show mask before typing
852
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
853
- */
854
- maskEager: {
855
- type: Boolean,
856
- default: false
857
- },
858
- /**
859
- * Write values reverse (ex. for numbers)
860
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
861
- */
862
- maskReversed: {
863
- type: Boolean,
864
- default: false
865
- },
866
- /**
867
- * Add mask custom tokens
868
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
867
+ * iMask options
868
+ * @see https://imask.js.org/guide.html
869
869
  */
870
- maskTokens: {
870
+ iMask: {
871
871
  type: Object,
872
872
  default: void 0
873
873
  },
874
874
  /**
875
- * Replace default tokens
876
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
875
+ * Masked value
877
876
  */
878
- maskTokensReplace: {
879
- type: Boolean,
880
- default: false
877
+ masked: {
878
+ type: String,
879
+ default: void 0
881
880
  },
882
881
  /**
883
882
  * Adjust input width to content
@@ -898,6 +897,13 @@ const VvInputTextProps = {
898
897
  */
899
898
  unit: {
900
899
  type: String
900
+ },
901
+ /**
902
+ * Select input text on focus
903
+ */
904
+ selectOnFocus: {
905
+ type: Boolean,
906
+ default: false
901
907
  }
902
908
  };
903
909
  const VvInputPasswordAction = defineComponent({
@@ -1320,9 +1326,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1320
1326
  VvInputTextProps,
1321
1327
  props
1322
1328
  );
1323
- const inputEl = ref();
1324
- const innerEl = ref();
1325
- __expose({ $inner: innerEl });
1326
1329
  const {
1327
1330
  id,
1328
1331
  icon,
@@ -1332,39 +1335,131 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1332
1335
  count,
1333
1336
  valid,
1334
1337
  invalid,
1335
- loading
1338
+ loading,
1339
+ debounce,
1340
+ maxlength,
1341
+ minlength,
1342
+ type,
1343
+ iMask,
1344
+ step
1336
1345
  } = toRefs(props);
1337
1346
  const hasId = useUniqueId(id);
1338
1347
  const hasHintId = computed(() => `${hasId.value}-hint`);
1339
1348
  const inputTextPlaceholder = computed(
1340
1349
  () => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
1341
1350
  );
1342
- const localModelValue = useDebouncedInput(
1343
- modelValue,
1344
- emit,
1345
- props.debounce,
1351
+ const maskReady = ref(false);
1352
+ const { el, mask, typed, masked, unmasked } = useIMask(
1353
+ computed(
1354
+ () => (iMask == null ? void 0 : iMask.value) ?? {
1355
+ mask: /./
1356
+ }
1357
+ ),
1346
1358
  {
1347
- getter: (value) => {
1348
- if (mask.value) {
1349
- return mask.value.masked(value ?? "");
1359
+ emit,
1360
+ onAccept: () => {
1361
+ if (!maskReady.value) {
1362
+ return;
1363
+ }
1364
+ emit("update:masked", masked.value);
1365
+ if (type.value === INPUT_TYPES.NUMBER) {
1366
+ if (masked.value === "") {
1367
+ if (localModelValue.value === null || localModelValue.value === void 0) {
1368
+ return;
1369
+ }
1370
+ localModelValue.value = void 0;
1371
+ return;
1372
+ }
1373
+ if (typeof typed.value !== "number") {
1374
+ localModelValue.value = Number(typed.value);
1375
+ return;
1376
+ }
1377
+ localModelValue.value = typed.value;
1378
+ return;
1379
+ }
1380
+ if (type.value === INPUT_TYPES.DATE) {
1381
+ if (el.value instanceof HTMLInputElement && el.value.type === "date") {
1382
+ localModelValue.value = el.value.value;
1383
+ return;
1384
+ }
1385
+ let date = typed.value;
1386
+ if (date === null || date === "") {
1387
+ if (!localModelValue.value) {
1388
+ return;
1389
+ }
1390
+ localModelValue.value = "";
1391
+ return;
1392
+ }
1393
+ if (!(date instanceof Date)) {
1394
+ date = new Date(date);
1395
+ }
1396
+ localModelValue.value = `${date.getFullYear()}-${("0" + (date.getMonth() + 1)).slice(-2)}-${("0" + date.getDate()).slice(-2)}`;
1397
+ return;
1350
1398
  }
1351
- return value;
1352
- },
1353
- setter: (value) => {
1354
- if (mask.value) {
1355
- value = mask.value.unmasked(value);
1399
+ if (type.value === INPUT_TYPES.DATETIME_LOCAL) {
1400
+ if (el.value instanceof HTMLInputElement && el.value.type === "datetime-local") {
1401
+ localModelValue.value = el.value.value;
1402
+ return;
1403
+ }
1404
+ let date = typed.value;
1405
+ if (date === null || date === "") {
1406
+ if (!localModelValue.value) {
1407
+ return;
1408
+ }
1409
+ localModelValue.value = "";
1410
+ return;
1411
+ }
1412
+ if (!(typed.value instanceof Date)) {
1413
+ date = new Date(date);
1414
+ }
1415
+ localModelValue.value = `${date.getFullYear()}-${("0" + (date.getMonth() + 1)).slice(-2)}-${("0" + date.getDate()).slice(-2)}T${("0" + date.getHours()).slice(-2)}:${("0" + date.getMinutes()).slice(-2)}`;
1416
+ return;
1356
1417
  }
1357
- if (props.type === INPUT_TYPES.NUMBER) {
1358
- return Number(value);
1418
+ if (!localModelValue.value && !unmasked.value) {
1419
+ return;
1359
1420
  }
1360
- return value;
1421
+ localModelValue.value = unmasked.value;
1422
+ }
1423
+ }
1424
+ );
1425
+ onMounted(() => {
1426
+ if (mask.value) {
1427
+ maskReady.value = true;
1428
+ typed.value = localModelValue.value ?? "";
1429
+ }
1430
+ });
1431
+ watch(
1432
+ () => props.modelValue,
1433
+ (newValue) => {
1434
+ var _a;
1435
+ if (mask.value) {
1436
+ typed.value = newValue && ((_a = iMask == null ? void 0 : iMask.value) == null ? void 0 : _a.mask) === Date ? new Date(newValue) : newValue ?? "";
1361
1437
  }
1362
1438
  }
1363
1439
  );
1440
+ watch(
1441
+ () => props.masked,
1442
+ (newValue) => {
1443
+ masked.value = newValue ?? "";
1444
+ }
1445
+ );
1446
+ const inputEl = el;
1447
+ const innerEl = ref();
1448
+ __expose({ $inner: innerEl });
1449
+ const localModelValue = useDebouncedInput(
1450
+ modelValue,
1451
+ emit,
1452
+ (debounce == null ? void 0 : debounce.value) ?? 0
1453
+ );
1364
1454
  const { focused } = useComponentFocus(inputEl, emit);
1365
1455
  const isFocused = computed(
1366
1456
  () => focused.value && !props.disabled && !props.readonly
1367
1457
  );
1458
+ watch(isFocused, (newValue) => {
1459
+ if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
1460
+ inputEl.value.select();
1461
+ }
1462
+ });
1368
1463
  const isVisible = useElementVisibility(inputEl);
1369
1464
  watch(isVisible, (newValue) => {
1370
1465
  if (newValue && props.autofocus && !props.disabled && !props.readonly) {
@@ -1382,19 +1477,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1382
1477
  const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
1383
1478
  const onStepUp = () => {
1384
1479
  if (isClickable.value) {
1480
+ if (iMask == null ? void 0 : iMask.value) {
1481
+ typed.value = typed.value + Number((step == null ? void 0 : step.value) ?? 1);
1482
+ return;
1483
+ }
1385
1484
  inputEl.value.stepUp();
1386
1485
  localModelValue.value = unref(inputEl).value;
1387
1486
  }
1388
1487
  };
1389
1488
  const onStepDown = () => {
1390
1489
  if (isClickable.value) {
1490
+ if (iMask == null ? void 0 : iMask.value) {
1491
+ typed.value = typed.value - Number((step == null ? void 0 : step.value) ?? 1);
1492
+ return;
1493
+ }
1391
1494
  inputEl.value.stepDown();
1392
1495
  localModelValue.value = unref(inputEl).value;
1393
1496
  }
1394
1497
  };
1395
1498
  const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
1396
1499
  const onClear = () => {
1397
- localModelValue.value = void 0;
1500
+ localModelValue.value = "";
1398
1501
  };
1399
1502
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
1400
1503
  icon,
@@ -1416,9 +1519,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1416
1519
  }
1417
1520
  });
1418
1521
  const { formatted: countFormatted } = useTextCount(localModelValue, {
1419
- mode: props.count,
1420
- upperLimit: Number(props.maxlength),
1421
- lowerLimit: Number(props.minlength)
1522
+ mode: count.value,
1523
+ upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
1524
+ lowerLimit: Number(minlength == null ? void 0 : minlength.value)
1422
1525
  });
1423
1526
  const isClickable = computed(() => !props.disabled && !props.readonly);
1424
1527
  const hasTabindex = computed(
@@ -1453,17 +1556,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1453
1556
  }))
1454
1557
  );
1455
1558
  const hasAttrs = computed(() => {
1456
- const type = (() => {
1559
+ const type2 = (() => {
1457
1560
  if (isPassword.value && showPassword.value) {
1458
1561
  return INPUT_TYPES.TEXT;
1459
1562
  }
1460
1563
  if (isDateTime.value && !isDirty.value && !focused.value) {
1461
1564
  return INPUT_TYPES.TEXT;
1462
1565
  }
1566
+ if (iMask == null ? void 0 : iMask.value) {
1567
+ return INPUT_TYPES.TEXT;
1568
+ }
1463
1569
  return props.type;
1464
1570
  })();
1465
1571
  const toReturn = {
1466
- type,
1572
+ type: type2,
1467
1573
  name: props.name,
1468
1574
  tabindex: hasTabindex.value,
1469
1575
  disabled: props.disabled,
@@ -1474,20 +1580,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1474
1580
  "aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
1475
1581
  "aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
1476
1582
  };
1477
- if (type === INPUT_TYPES.DATE || type === INPUT_TYPES.MONTH || type === INPUT_TYPES.WEEK || type === INPUT_TYPES.TIME || type === INPUT_TYPES.DATETIME_LOCAL || type === INPUT_TYPES.NUMBER) {
1583
+ if (type2 === INPUT_TYPES.DATE || type2 === INPUT_TYPES.MONTH || type2 === INPUT_TYPES.WEEK || type2 === INPUT_TYPES.TIME || type2 === INPUT_TYPES.DATETIME_LOCAL || type2 === INPUT_TYPES.NUMBER) {
1478
1584
  toReturn.step = props.step;
1479
1585
  toReturn.max = props.max !== void 0 ? String(props.max) : void 0;
1480
1586
  toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
1481
1587
  }
1482
- if (type === INPUT_TYPES.TEXT || type === INPUT_TYPES.SEARCH || type === INPUT_TYPES.URL || type === INPUT_TYPES.TEL || type === INPUT_TYPES.EMAIL || type === INPUT_TYPES.PASSWORD || type === INPUT_TYPES.NUMBER) {
1588
+ if (type2 === INPUT_TYPES.TEXT || type2 === INPUT_TYPES.SEARCH || type2 === INPUT_TYPES.URL || type2 === INPUT_TYPES.TEL || type2 === INPUT_TYPES.EMAIL || type2 === INPUT_TYPES.PASSWORD || type2 === INPUT_TYPES.NUMBER) {
1483
1589
  toReturn.placeholder = inputTextPlaceholder.value;
1484
1590
  }
1485
- if (type === INPUT_TYPES.TEXT || type === INPUT_TYPES.SEARCH || type === INPUT_TYPES.URL || type === INPUT_TYPES.TEL || type === INPUT_TYPES.EMAIL || type === INPUT_TYPES.PASSWORD) {
1591
+ if (type2 === INPUT_TYPES.TEXT || type2 === INPUT_TYPES.SEARCH || type2 === INPUT_TYPES.URL || type2 === INPUT_TYPES.TEL || type2 === INPUT_TYPES.EMAIL || type2 === INPUT_TYPES.PASSWORD) {
1486
1592
  toReturn.minlength = props.minlength;
1487
1593
  toReturn.maxlength = props.maxlength;
1488
1594
  toReturn.pattern = props.pattern;
1489
1595
  }
1490
- if (type === INPUT_TYPES.EMAIL) {
1596
+ if (type2 === INPUT_TYPES.EMAIL) {
1491
1597
  toReturn.multiple = props.multiple;
1492
1598
  }
1493
1599
  return toReturn;
@@ -1519,31 +1625,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1519
1625
  INPUT_TYPES.SEARCH,
1520
1626
  props
1521
1627
  );
1522
- const mask = ref();
1523
- watch(
1524
- [
1525
- () => props.mask,
1526
- () => props.type,
1527
- () => props.maskEager,
1528
- () => props.maskReversed,
1529
- () => props.maskTokens,
1530
- () => props.maskTokensReplace
1531
- ],
1532
- ([newMask, newType, eager, reversed, tokens, tokensReplace]) => {
1533
- if (newMask && newType === INPUT_TYPES.TEXT) {
1534
- mask.value = new Mask({
1535
- mask: newMask,
1536
- eager,
1537
- reversed,
1538
- tokens,
1539
- tokensReplace
1540
- });
1541
- return;
1542
- }
1543
- mask.value = void 0;
1544
- },
1545
- { immediate: true }
1546
- );
1547
1628
  const onClickInner = () => {
1548
1629
  if (isClickable.value) {
1549
1630
  focused.value = true;
@@ -1557,6 +1638,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1557
1638
  width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
1558
1639
  };
1559
1640
  });
1641
+ const onKeyDown = (event) => {
1642
+ switch (event.code) {
1643
+ case "ArrowUp":
1644
+ if (isNumber.value) {
1645
+ onStepUp();
1646
+ event.preventDefault();
1647
+ }
1648
+ break;
1649
+ case "ArrowDown":
1650
+ if (isNumber.value) {
1651
+ onStepDown();
1652
+ event.preventDefault();
1653
+ }
1654
+ break;
1655
+ }
1656
+ emit("keydown", event);
1657
+ };
1560
1658
  return (_ctx, _cache) => {
1561
1659
  return openBlock(), createElementBlock("div", {
1562
1660
  class: normalizeClass(unref(bemCssClasses))
@@ -1580,17 +1678,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1580
1678
  key: 0,
1581
1679
  class: "vv-input-text__icon"
1582
1680
  }, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
1583
- withDirectives(createElementVNode("input", mergeProps({
1681
+ createElementVNode("input", mergeProps({
1584
1682
  id: unref(hasId),
1585
1683
  ref_key: "inputEl",
1586
- ref: inputEl,
1587
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
1684
+ ref: inputEl
1588
1685
  }, unref(hasAttrs), {
1589
1686
  style: unref(hasStyle),
1590
- onKeyup: _cache[1] || (_cache[1] = ($event) => emit("keyup", $event))
1591
- }), null, 16, _hoisted_5), [
1592
- [vModelDynamic, unref(localModelValue)]
1593
- ]),
1687
+ onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
1688
+ onKeydown: onKeyDown,
1689
+ onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
1690
+ }), null, 16, _hoisted_5),
1594
1691
  (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_6, [
1595
1692
  renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
1596
1693
  createTextVNode(toDisplayString(_ctx.unit), 1)
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("maska"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","maska","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.maska,e.vue$1,e.nanoid,e.core)}(this,(function(e,t,o,l,n){"use strict";function a(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}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||{});const c=Symbol.for("volver");function p(){return e.inject(c)}function v(t,o,l){return e.computed((()=>{const n={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((o=>{n[`${t}--${o}`]=e.unref(l.value[o])})),n}))}const m=e.defineComponent({name:"VvIcon",props:r,setup(t){const l=t,n=e.computed((()=>"string"==typeof l.rotate?parseFloat(l.rotate):l.rotate)),a=e.ref(!0),i=p(),{modifiers:r}=e.toRefs(l),u=v("vv-icon",r),s=e.computed((()=>l.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=l.name??"",t=`@${s.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t;const n=null==i?void 0:i.iconsCollections.find((t=>{const l=`@${s.value}:${t.prefix}:${e}`;return o.iconExists(l)}));return n?`@${s.value}:${n.prefix}:${e}`:e}));function c(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),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&o.addIcon(`@${s.value}:${l.prefix}:${l.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&l.src&&!o.iconExists(`@${s.value}:${l.prefix}:${l.name}`)&&(a.value=!1,i.fetchIcon(l.src).then((e=>{e&&(c(e),a.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&c(l.svg),(t,l)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(o.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(n),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},h={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},S=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},w={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},L={debounce:[Number,String]},E={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},x={tabindex:{type:[String,Number],default:0}},P={floating:Boolean},T={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const C={...{...T,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...x,...g,...y,...f,...h,...k,...b,...w,...B,...L,...E,...P,...S,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button;const A={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"},$="eye-on",I="eye-off",V="calendar",O="time",_="color",N={...C,modelValue:[String,Number],type:{type:String,default:A.TEXT,validator:e=>Object.values(A).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:$},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"},mask:{type:String,default:void 0},maskEager:{type:Boolean,default:!1},maskReversed:{type:Boolean,default:!1},maskTokens:{type:Object,default:void 0},maskTokensReplace:{type:Boolean,default:!1},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String}},R=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:$},iconHide:{type:String,default:I}},emits:["toggle-password"],setup(t,{emit:o}){const l=e.ref(!1),n=e.computed((()=>l.value?t.iconHide:t.iconShow));return{active:l,activeIcon:n,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(l.value=!l.value,o("toggle-password",l.value))}}},render(){const t=e.h(m,{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)}}),D=e.defineComponent({components:{VvIcon:m},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:o}){const l=e.computed((()=>"up"===t.mode));return{isUp:l,onClick:e=>{null==e||e.stopPropagation(),t.disabled||o(l.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:m},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(o){null==o||o.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(m,{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 M(t,o){return{name:"VvInputTextActions",components:{VvIcon:m,VvInputPasswordAction:R,VvInputStepAction:D,VvInputClearAction:H},setup:()=>({isDisabled:e.computed((()=>o.disabled||o.readonly)),labelStepUp:o.labelStepUp,labelStepDown:o.labelStepDown,labelShowPassword:o.labelShowPassword,labelHidePassword:o.labelHidePassword,labelClear:o.labelClear,iconShowPassword:o.iconShowPassword,iconHidePassword:o.iconHidePassword}),render(){let l=null;switch(t){case A.SEARCH:{const{onClear:t}=this.$attrs;l=[e.h(H,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case A.PASSWORD:{const{onTogglePassword:t}=this.$attrs;l=[e.h(R,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case A.NUMBER:{const{onStepUp:t,onStepDown:n}=this.$attrs;l=[e.h(D,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:n}),e.h(D,{mode:"down",disabled:this.isDisabled||void 0!==o.min&&o.modelValue===o.min,label:this.labelStepDown,onStepUp:t,onStepDown:n})];break}}return Array.isArray(l)?e.h("div",{class:"vv-input-text__actions-group"},l):l}}}const U=["for"],j={class:"vv-input-text__wrapper"},W={key:0,class:"vv-input-text__input-before"},q=["onClick"],z=["id"],F={key:1,class:"vv-input-text__unit"},X={key:5,class:"vv-input-text__input-after"},K={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:N,emits:["update:modelValue","focus","blur","keyup"],setup(o,{expose:r,emit:d}){const c=o,f=e.useSlots(),h=function(t,o,l){const n=p(),a=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[t]))return n.defaults.value[t]}));return e.computed((()=>{if(void 0===a.value)return l;const e=a.value,t=o,n=l;return Object.keys(t).reduce(((o,l)=>{const a=n[l];if(o[l]=a,l in e){if(Array.isArray(t[l])){const n=t[l];n.length&&n[0]===a&&(o[l]=e[l])}if("function"==typeof t[l]&&(0,t[l])()===a&&(o[l]=e[l]),"object"==typeof t[l]){let n=t[l].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(a)&&(o[l]=e[l]):n===a&&(o[l]=e[l])}}return o}),{})}))}("VvInputText",N,c),b=e.ref(),g=e.ref();r({$inner:g});const{id:S,icon:y,iconPosition:w,label:k,modelValue:B,count:L,valid:E,invalid:x,loading:P}=e.toRefs(c),T=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(S),C=e.computed((()=>`${T.value}-hint`)),$=e.computed((()=>c.floating&&a(c.placeholder)?" ":c.placeholder)),I=function(t,o,l=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof l&&(l=parseInt(l)),e.computed({get:()=>n(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),l)}})}(B,d,c.debounce,{getter:e=>Le.value?Le.value.masked(e??""):e,setter:e=>(Le.value&&(e=Le.value.unmasked(e)),c.type===A.NUMBER?Number(e):e)}),{focused:R}=function(t,o){const{focused:l}=n.useFocus(t);return e.watch(l,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:l}}(b,d),D=e.computed((()=>R.value&&!c.disabled&&!c.readonly)),H=n.useElementVisibility(b);e.watch(H,(e=>{e&&c.autofocus&&!c.disabled&&!c.readonly&&(R.value=!0)}));const J=e.ref(!1),G=e.computed((()=>c.type===A.PASSWORD)),Q=()=>{J.value=!J.value},Y=e.computed((()=>c.type===A.TIME||c.type===A.DATETIME_LOCAL||c.type===A.DATE||c.type===A.WEEK||c.type===A.MONTH)),Z=e.computed((()=>c.type===A.NUMBER)),ee=()=>{se.value&&(b.value.stepUp(),I.value=e.unref(b).value)},te=()=>{se.value&&(b.value.stepDown(),I.value=e.unref(b).value)},oe=e.computed((()=>c.type===A.SEARCH)),le=()=>{I.value=void 0},{hasIcon:ne,hasIconBefore:ae,hasIconAfter:ie}=function(t,o){const l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.before))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.after))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.top))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.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:a,hasIconRight:i,hasIconTop:r,hasIconBottom:d,hasIconBefore:l,hasIconAfter:n}}(y,w),re=e.computed((()=>{switch(c.type){case A.COLOR:return{name:_};case A.DATE:case A.DATETIME_LOCAL:case A.WEEK:case A.MONTH:return{name:V};case A.TIME:return{name:O};default:return""}})),{formatted:ue}=function(t,o){const l=e.computed((()=>(e.unref(t)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&l.value<(null==o?void 0:o.lowerLimit)?l.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&l.value<(null==o?void 0:o.upperLimit)?o.upperLimit-l.value:0)),a=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${l.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return l.value}));return{length:l,gap:n,formatted:a}}(I,{mode:c.count,upperLimit:Number(c.maxlength),lowerLimit:Number(c.minlength)}),se=e.computed((()=>!c.disabled&&!c.readonly)),de=e.computed((()=>se.value?c.tabindex:-1)),ce=e.computed((()=>!a(B))),pe=e.computed((()=>!0===x.value||!0!==E.value&&void 0)),{modifiers:ve}=e.toRefs(c),me=v("vv-input-text",ve,e.computed((()=>({valid:E.value,invalid:x.value,loading:P.value,disabled:c.disabled,readonly:c.readonly,"icon-before":ae.value,"icon-after":ie.value||!a(re),floating:c.floating&&!a(c.label),dirty:ce.value,focus:D.value,"auto-width":c.autoWidth})))),fe=e.computed((()=>{const e=G.value&&J.value?A.TEXT:!Y.value||ce.value||R.value?c.type:A.TEXT,t={type:e,name:c.name,tabindex:de.value,disabled:c.disabled,readonly:c.readonly,required:c.required,autocomplete:c.autocomplete,"aria-invalid":pe.value,"aria-describedby":ge.value?C.value:void 0,"aria-errormessage":Se.value?C.value:void 0};return e!==A.DATE&&e!==A.MONTH&&e!==A.WEEK&&e!==A.TIME&&e!==A.DATETIME_LOCAL&&e!==A.NUMBER||(t.step=c.step,t.max=void 0!==c.max?String(c.max):void 0,t.min=void 0!==c.min?String(c.min):void 0),e!==A.TEXT&&e!==A.SEARCH&&e!==A.URL&&e!==A.TEL&&e!==A.EMAIL&&e!==A.PASSWORD&&e!==A.NUMBER||(t.placeholder=$.value),e!==A.TEXT&&e!==A.SEARCH&&e!==A.URL&&e!==A.TEL&&e!==A.EMAIL&&e!==A.PASSWORD||(t.minlength=c.minlength,t.maxlength=c.maxlength,t.pattern=c.pattern),e===A.EMAIL&&(t.multiple=c.multiple),t})),he=e.computed((()=>({valid:c.valid,invalid:c.invalid,modelValue:c.modelValue,togglePassword:Q,stepUp:ee,stepDown:te,clear:le}))),{HintSlot:be,hasHintLabelOrSlot:ge,hasInvalidLabelOrSlot:Se,hintSlotScope:ye}=function(t,o){const l=e.unref(t),n=e.computed((()=>i(l.invalidLabel))),a=e.computed((()=>i(l.validLabel))),r=e.computed((()=>l.loadingLabel)),u=e.computed((()=>l.hintLabel)),s=e.computed((()=>Boolean(l.loading&&(o.loading||r.value)))),d=e.computed((()=>!s.value&&Boolean(l.invalid&&(o.invalid||n.value)))),c=e.computed((()=>!s.value&&!d.value&&Boolean(l.valid&&(o.valid||a.value)))),p=e.computed((()=>!s.value&&!d.value&&!c.value&&Boolean(o.hint||u.value))),v=e.computed((()=>d.value||c.value||s.value||p.value)),m=e.computed((()=>({modelValue:l.modelValue,valid:l.valid,invalid:l.invalid,loading:l.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:n,validLabel:a,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:s,hasHintLabelOrSlot:p}),render(){var t,o,l,n,a,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==(o=(t=this.$slots).loading)?void 0:o.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(n=(l=this.$slots).invalid)?void 0:n.call(l))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(a=this.$slots).valid)?void 0:i.call(a))??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:p,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:s,hintSlotScope:m,HintSlot:f}}(h,f),we=M(A.PASSWORD,c),ke=M(A.NUMBER,c),Be=M(A.SEARCH,c),Le=e.ref();e.watch([()=>c.mask,()=>c.type,()=>c.maskEager,()=>c.maskReversed,()=>c.maskTokens,()=>c.maskTokensReplace],(([e,o,l,n,a,i])=>{Le.value=e&&o===A.TEXT?new t.Mask({mask:e,eager:l,reversed:n,tokens:a,tokensReplace:i}):void 0}),{immediate:!0});const Ee=()=>{se.value&&(R.value=!0)},xe=e.computed((()=>{if(c.autoWidth)return{width:void 0!==I.value?`${String(I.value).length+1}ch`:void 0}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(me))},[e.unref(k)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(T),class:"vv-input-text__label"},e.toDisplayString(e.unref(k)),9,U)):e.createCommentVNode("",!0),e.createElementVNode("div",j,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",W,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(he))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:g,class:"vv-input-text__inner",onClick:e.withModifiers(Ee,["stop"])},[e.unref(ae)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(ne)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(T),ref_key:"inputEl",ref:b,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(I)?I.value=t:null)},e.unref(fe),{style:e.unref(xe),onKeyup:o[1]||(o[1]=e=>d("keyup",e))}),null,16,z),[[e.vModelDynamic,e.unref(I)]]),(t.unit||t.$slots.unit)&&e.unref(ce)?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(he))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,q),e.unref(ie)||e.unref(re)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ie)?e.unref(ne):e.unref(re)),null,16)):e.unref(G)&&!t.hideActions&&e.unref(se)?(e.openBlock(),e.createBlock(e.unref(we),{key:2,onTogglePassword:Q})):e.unref(Z)&&!t.hideActions&&e.unref(se)?(e.openBlock(),e.createBlock(e.unref(ke),{key:3,onStepUp:ee,onStepDown:te})):e.unref(oe)&&!t.hideActions&&e.unref(se)?(e.openBlock(),e.createBlock(e.unref(Be),{key:4,onClear:le})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(he))))])):e.createCommentVNode("",!0),e.unref(L)?(e.openBlock(),e.createElementBlock("span",K,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(he))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ue)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(be),{id:e.unref(C),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(ye))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(ye))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(ye))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(ye))))])),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("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","vue-imask","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.vueImask,e.vue$1,e.nanoid,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||{});const c=Symbol.for("volver");function v(){return e.inject(c)}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 m=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=v(),{modifiers:r}=e.toRefs(o),u=p("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 c(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&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(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("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},h={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},S=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},w={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},B={debounce:[Number,String]},E={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},$={tabindex:{type:[String,Number],default:0}},x={floating:Boolean},A={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const T={...{...A,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...$,...g,...y,...f,...h,...k,...b,...w,...L,...B,...E,...x,...S,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.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",_={...T,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:m},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(m,{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:m},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:m},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(m,{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:m,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"],q=["id"],z={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:r,emit:d}){const c=l,f=e.useSlots(),h=function(t,l,o){const a=v(),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",_,c),{id:b,icon:g,iconPosition:S,label:y,modelValue:w,count:k,valid:L,invalid:B,loading:E,debounce:$,maxlength:x,minlength:A,type:T,iMask:C,step:D}=e.toRefs(c),N=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(b),M=e.computed((()=>`${N.value}-hint`)),R=e.computed((()=>c.floating&&n(c.placeholder)?" ":c.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:d,onAccept:()=>{if(J.value){if(d("update:masked",Z.value),T.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(T.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(T.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((()=>c.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((()=>c.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==$?void 0:$.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&&!c.disabled&&!c.readonly));e.watch(ne,(e=>{e&&h.value.selectOnFocus&&te.value&&te.value.select()}));const ie=a.useElementVisibility(te);e.watch(ie,(e=>{e&&c.autofocus&&!c.disabled&&!c.readonly&&(ae.value=!0)}));const re=e.ref(!1),ue=e.computed((()=>c.type===P.PASSWORD)),se=()=>{re.value=!re.value},de=e.computed((()=>c.type===P.TIME||c.type===P.DATETIME_LOCAL||c.type===P.DATE||c.type===P.WEEK||c.type===P.MONTH)),ce=e.computed((()=>c.type===P.NUMBER)),ve=()=>{if(we.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=e.unref(te).value}},pe=()=>{if(we.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=e.unref(te).value}},me=e.computed((()=>c.type===P.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(c.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};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==x?void 0:x.value),lowerLimit:Number(null==A?void 0:A.value)}),we=e.computed((()=>!c.disabled&&!c.readonly)),ke=e.computed((()=>we.value?c.tabindex:-1)),Le=e.computed((()=>!n(w))),Be=e.computed((()=>!0===B.value||!0!==L.value&&void 0)),{modifiers:Ee}=e.toRefs(c),$e=p("vv-input-text",Ee,e.computed((()=>({valid:L.value,invalid:B.value,loading:E.value,disabled:c.disabled,readonly:c.readonly,"icon-before":be.value,"icon-after":ge.value||!n(Se),floating:c.floating&&!n(c.label),dirty:Le.value,focus:ne.value,"auto-width":c.autoWidth})))),xe=e.computed((()=>{const e=ue.value&&re.value?P.TEXT:!de.value||Le.value||ae.value?(null==C?void 0:C.value)?P.TEXT:c.type:P.TEXT,t={type:e,name:c.name,tabindex:ke.value,disabled:c.disabled,readonly:c.readonly,required:c.required,autocomplete:c.autocomplete,"aria-invalid":Be.value,"aria-describedby":Pe.value?M.value:void 0,"aria-errormessage":Ce.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=c.step,t.max=void 0!==c.max?String(c.max):void 0,t.min=void 0!==c.min?String(c.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=c.minlength,t.maxlength=c.maxlength,t.pattern=c.pattern),e===P.EMAIL&&(t.multiple=c.multiple),t})),Ae=e.computed((()=>({valid:c.valid,invalid:c.invalid,modelValue:c.modelValue,togglePassword:se,stepUp:ve,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)))),c=e.computed((()=>!s.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!s.value&&!d.value&&!c.value&&Boolean(l.hint||u.value))),p=e.computed((()=>d.value||c.value||s.value||v.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:c,hasLoadingLabelOrSlot:s,hasHintLabelOrSlot:v}),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:v,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:s,hintSlotScope:m,HintSlot:f}}(h,f),Ie=H(P.PASSWORD,c),Oe=H(P.NUMBER,c),Ve=H(P.SEARCH,c),_e=()=>{we.value&&(ae.value=!0)},Ne=e.computed((()=>{if(c.autoWidth)return{width:void 0!==oe.value?`${String(oe.value).length+1}ch`:void 0}})),Me=e=>{switch(e.code){case"ArrowUp":ce.value&&(ve(),e.preventDefault());break;case"ArrowDown":ce.value&&(pe(),e.preventDefault())}d("keydown",e)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref($e))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(N),class:"vv-input-text__label"},e.toDisplayString(e.unref(y)),9,U)):e.createCommentVNode("",!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(Ae))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:le,class:"vv-input-text__inner",onClick:e.withModifiers(_e,["stop"])},[e.unref(be)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(he)),null,16)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(N),ref_key:"inputEl",ref:te},e.unref(xe),{style:e.unref(Ne),onKeyup:l[0]||(l[0]=e=>d("keyup",e)),onKeydown:Me,onKeypress:l[1]||(l[1]=e=>d("keypress",e))}),null,16,q),(t.unit||t.$slots.unit)&&e.unref(Le)?(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,W),e.unref(ge)||e.unref(Se)?(e.openBlock(),e.createBlock(m,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(ce)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Oe),{key:3,onStepUp:ve,onStepDown:pe})):e.unref(me)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ve),{key:4,onClear:fe})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",X,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ye)),1)]))])):e.createCommentVNode("",!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))}})}));