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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +3 -3
  2. package/auto-imports.d.ts +2 -0
  3. package/dist/components/VvAccordion/VvAccordion.es.js +15 -7
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +15 -7
  5. package/dist/components/VvAction/VvAction.es.js +17 -8
  6. package/dist/components/VvAction/VvAction.umd.js +1 -1
  7. package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
  8. package/dist/components/VvAction/index.d.ts +4 -0
  9. package/dist/components/VvAlert/VvAlert.es.js +22 -13
  10. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  11. package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
  12. package/dist/components/VvAlert/index.d.ts +3 -3
  13. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +22 -13
  14. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  15. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +6 -6
  16. package/dist/components/VvAlertGroup/index.d.ts +2 -2
  17. package/dist/components/VvAvatar/VvAvatar.es.js +15 -7
  18. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +15 -7
  19. package/dist/components/VvBadge/VvBadge.es.js +15 -7
  20. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +15 -7
  21. package/dist/components/VvButton/VvButton.es.js +19 -9
  22. package/dist/components/VvButton/VvButton.umd.js +1 -1
  23. package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
  24. package/dist/components/VvButton/index.d.ts +4 -0
  25. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +15 -7
  26. package/dist/components/VvCard/VvCard.es.js +15 -7
  27. package/dist/components/VvCheckbox/VvCheckbox.es.js +99 -21
  28. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  29. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +105 -22
  31. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  32. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
  33. package/dist/components/VvCombobox/VvCombobox.es.js +256 -191
  34. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  35. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +329 -101
  36. package/dist/components/VvCombobox/index.d.ts +123 -37
  37. package/dist/components/VvDialog/VvDialog.es.js +50 -37
  38. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  39. package/dist/components/VvDropdown/VvDropdown.es.js +32 -18
  40. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  41. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +300 -92
  42. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
  43. package/dist/components/VvDropdown/index.d.ts +99 -30
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +17 -8
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  46. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +15 -7
  47. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +15 -7
  48. package/dist/components/VvInputText/VvInputText.es.js +279 -116
  49. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  50. package/dist/components/VvInputText/VvInputText.vue.d.ts +23 -41
  51. package/dist/components/VvInputText/index.d.ts +15 -33
  52. package/dist/components/VvNav/VvNav.es.js +18 -9
  53. package/dist/components/VvNav/VvNav.umd.js +1 -1
  54. package/dist/components/VvNav/index.d.ts +1 -1
  55. package/dist/components/VvProgress/VvProgress.es.js +15 -7
  56. package/dist/components/VvRadio/VvRadio.es.js +99 -21
  57. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  59. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +105 -22
  60. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  61. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
  62. package/dist/components/VvSelect/VvSelect.es.js +95 -21
  63. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  64. package/dist/components/VvSelect/VvSelect.vue.d.ts +5 -5
  65. package/dist/components/VvTab/VvTab.es.js +18 -9
  66. package/dist/components/VvTab/VvTab.umd.js +1 -1
  67. package/dist/components/VvTextarea/VvTextarea.es.js +103 -26
  68. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  69. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
  70. package/dist/components/VvTooltip/VvTooltip.es.js +15 -7
  71. package/dist/components/common/HintSlot.d.ts +4 -3
  72. package/dist/components/index.d.ts +5 -0
  73. package/dist/components/index.es.js +1212 -626
  74. package/dist/components/index.umd.js +1 -1
  75. package/dist/composables/alert/useAlert.d.ts +27 -0
  76. package/dist/composables/index.d.ts +1 -0
  77. package/dist/composables/index.es.js +81 -0
  78. package/dist/composables/index.umd.js +1 -0
  79. package/dist/constants.d.ts +14 -0
  80. package/dist/directives/index.es.js +15 -7
  81. package/dist/directives/v-tooltip.es.js +15 -7
  82. package/dist/icons.es.js +3 -3
  83. package/dist/icons.umd.js +1 -1
  84. package/dist/props/index.d.ts +107 -31
  85. package/dist/resolvers/unplugin.es.js +3 -0
  86. package/dist/resolvers/unplugin.umd.js +1 -1
  87. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
  88. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +54 -269
  89. package/dist/stories/Alert/Alert.settings.d.ts +3 -7
  90. package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
  91. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
  92. package/dist/stories/Button/Button.settings.d.ts +3 -13
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
  94. package/dist/stories/InputText/InputText.settings.d.ts +31 -9
  95. package/dist/stories/InputText/InputText.stories.d.ts +0 -1
  96. package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
  97. package/dist/stories/Nav/Nav.settings.d.ts +3 -21
  98. package/package.json +75 -66
  99. package/src/assets/icons/detailed.json +1 -1
  100. package/src/assets/icons/normal.json +1 -1
  101. package/src/assets/icons/simple.json +1 -1
  102. package/src/components/VvAction/VvAction.vue +2 -1
  103. package/src/components/VvAlert/VvAlert.vue +5 -1
  104. package/src/components/VvAlert/index.ts +3 -3
  105. package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
  106. package/src/components/VvButton/VvButton.vue +1 -0
  107. package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
  108. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
  109. package/src/components/VvCombobox/VvCombobox.vue +43 -23
  110. package/src/components/VvCombobox/index.ts +24 -0
  111. package/src/components/VvDialog/VvDialog.vue +22 -19
  112. package/src/components/VvDropdown/VvDropdown.vue +24 -18
  113. package/src/components/VvInputText/VvInputText.vue +177 -55
  114. package/src/components/VvInputText/index.ts +32 -34
  115. package/src/components/VvNav/VvNav.vue +1 -1
  116. package/src/components/VvNav/index.ts +1 -1
  117. package/src/components/VvRadio/VvRadio.vue +8 -1
  118. package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
  119. package/src/components/VvSelect/VvSelect.vue +8 -1
  120. package/src/components/VvTextarea/VvTextarea.vue +16 -6
  121. package/src/components/common/HintSlot.ts +26 -13
  122. package/src/components/index.ts +5 -0
  123. package/src/composables/alert/useAlert.ts +103 -0
  124. package/src/composables/index.ts +1 -0
  125. package/src/constants.ts +26 -0
  126. package/src/props/index.ts +14 -11
  127. package/src/resolvers/unplugin.ts +3 -0
  128. package/src/stories/Alert/Alert.settings.ts +3 -1
  129. package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
  130. package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
  131. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
  132. package/src/stories/Button/Button.settings.ts +5 -3
  133. package/src/stories/Combobox/Combobox.settings.ts +119 -2
  134. package/src/stories/Combobox/Combobox.test.ts +1 -1
  135. package/src/stories/InputText/InputText.settings.ts +36 -15
  136. package/src/stories/InputText/InputText.stories.ts +4 -12
  137. package/src/stories/InputText/InputText.test.ts +31 -15
  138. package/src/stories/InputText/InputTextMask.stories.ts +122 -0
  139. package/src/stories/Nav/Nav.settings.ts +3 -1
  140. package/src/stories/Tab/Tab.stories.ts +3 -3
  141. package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
  142. package/src/types/alert.d.ts +20 -0
  143. /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
  144. /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
  145. /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
  146. /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
@@ -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";
@@ -15,19 +15,27 @@ function joinLines(items) {
15
15
  }
16
16
  return items;
17
17
  }
18
- function HintSlotFactory(props, slots) {
19
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
20
- const validLabel = computed(() => joinLines(props.validLabel));
21
- const loadingLabel = computed(() => props.loadingLabel);
22
- const hintLabel = computed(() => props.hintLabel);
18
+ function HintSlotFactory(propsOrRef, slots) {
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);
23
29
  const hasLoadingLabelOrSlot = computed(
24
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
30
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
25
31
  );
26
32
  const hasInvalidLabelOrSlot = computed(
27
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
33
+ () => !hasLoadingLabelOrSlot.value && Boolean(
34
+ props.value.invalid && (slots.invalid || invalidLabel.value)
35
+ )
28
36
  );
29
37
  const hasValidLabelOrSlot = computed(
30
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
38
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
31
39
  );
32
40
  const hasHintLabelOrSlot = computed(
33
41
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -36,10 +44,10 @@ function HintSlotFactory(props, slots) {
36
44
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
37
45
  );
38
46
  const hintSlotScope = computed(() => ({
39
- modelValue: props.modelValue,
40
- valid: props.valid,
41
- invalid: props.invalid,
42
- loading: props.loading
47
+ modelValue: props.value.modelValue,
48
+ valid: props.value.valid,
49
+ invalid: props.value.invalid,
50
+ loading: props.value.loading
43
51
  }));
44
52
  const HintSlot = defineComponent({
45
53
  name: "HintSlot",
@@ -213,6 +221,11 @@ const VvIconProps = {
213
221
  type: [String, Array]
214
222
  }
215
223
  };
224
+ var Strategy = /* @__PURE__ */ ((Strategy2) => {
225
+ Strategy2["absolute"] = "absolute";
226
+ Strategy2["fixed"] = "fixed";
227
+ return Strategy2;
228
+ })(Strategy || {});
216
229
  var Side = /* @__PURE__ */ ((Side2) => {
217
230
  Side2["left"] = "left";
218
231
  Side2["right"] = "right";
@@ -529,19 +542,15 @@ const IdProps = {
529
542
  placement: {
530
543
  type: String,
531
544
  default: Side.bottom,
532
- validator: (value) => {
533
- return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
534
- }
545
+ validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
535
546
  },
536
547
  /**
537
548
  * Dropdown strategy
538
549
  */
539
550
  strategy: {
540
551
  type: String,
541
- default: "absolute",
542
- validator: (value) => {
543
- return ["fixed", "absolute"].includes(value);
544
- }
552
+ default: void 0,
553
+ validator: (value) => Object.values(Strategy).includes(value)
545
554
  },
546
555
  /**
547
556
  * Dropdown show / hide transition name
@@ -700,6 +709,13 @@ const InputTextareaProps = {
700
709
  type: String,
701
710
  default: ButtonType.button,
702
711
  validator: (value) => Object.values(ButtonType).includes(value)
712
+ },
713
+ /**
714
+ * Button aria-label
715
+ */
716
+ ariaLabel: {
717
+ type: String,
718
+ default: void 0
703
719
  }
704
720
  });
705
721
  const INPUT_TYPES = {
@@ -725,7 +741,23 @@ const TYPES_ICON = {
725
741
  COLOR: "color",
726
742
  SEARCH: "close"
727
743
  };
728
- 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
+ ];
729
761
  const VvInputTextProps = {
730
762
  ...InputTextareaProps,
731
763
  /**
@@ -832,44 +864,19 @@ const VvInputTextProps = {
832
864
  default: "Clear"
833
865
  },
834
866
  /**
835
- * Input mask, only for text type
836
- * @see https://beholdr.github.io/maska/
837
- */
838
- mask: {
839
- type: String,
840
- default: void 0
841
- },
842
- /**
843
- * Show mask before typing
844
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
845
- */
846
- maskEager: {
847
- type: Boolean,
848
- default: false
849
- },
850
- /**
851
- * Write values reverse (ex. for numbers)
852
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
853
- */
854
- maskReversed: {
855
- type: Boolean,
856
- default: false
857
- },
858
- /**
859
- * Add mask custom tokens
860
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
867
+ * iMask options
868
+ * @see https://imask.js.org/guide.html
861
869
  */
862
- maskTokens: {
870
+ iMask: {
863
871
  type: Object,
864
872
  default: void 0
865
873
  },
866
874
  /**
867
- * Replace default tokens
868
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
875
+ * Masked value
869
876
  */
870
- maskTokensReplace: {
871
- type: Boolean,
872
- default: false
877
+ masked: {
878
+ type: String,
879
+ default: void 0
873
880
  },
874
881
  /**
875
882
  * Adjust input width to content
@@ -890,6 +897,13 @@ const VvInputTextProps = {
890
897
  */
891
898
  unit: {
892
899
  type: String
900
+ },
901
+ /**
902
+ * Select input text on focus
903
+ */
904
+ selectOnFocus: {
905
+ type: Boolean,
906
+ default: false
893
907
  }
894
908
  };
895
909
  const VvInputPasswordAction = defineComponent({
@@ -1125,6 +1139,59 @@ function VvInputTextActionsFactory(type, parentProps) {
1125
1139
  }
1126
1140
  };
1127
1141
  }
1142
+ function useDefaults(componentName, propsDefinition, props) {
1143
+ const volver = useVolver();
1144
+ const volverComponentDefaults = computed(() => {
1145
+ var _a;
1146
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
1147
+ return void 0;
1148
+ }
1149
+ return volver.defaults.value[componentName];
1150
+ });
1151
+ return computed(() => {
1152
+ if (volverComponentDefaults.value === void 0) {
1153
+ return props;
1154
+ }
1155
+ const componentDefaults = volverComponentDefaults.value;
1156
+ const simplifiedPropsDefinition = propsDefinition;
1157
+ const simplifiedProps = props;
1158
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
1159
+ const propValue = simplifiedProps[key];
1160
+ acc[key] = propValue;
1161
+ if (key in componentDefaults) {
1162
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
1163
+ const typeArray = simplifiedPropsDefinition[key];
1164
+ if (typeArray.length) {
1165
+ const typeFunction = typeArray[0];
1166
+ if (typeFunction === propValue) {
1167
+ acc[key] = componentDefaults[key];
1168
+ }
1169
+ }
1170
+ }
1171
+ if (typeof simplifiedPropsDefinition[key] === "function") {
1172
+ const typeFunction = simplifiedPropsDefinition[key];
1173
+ if (typeFunction() === propValue) {
1174
+ acc[key] = componentDefaults[key];
1175
+ }
1176
+ }
1177
+ if (typeof simplifiedPropsDefinition[key] === "object") {
1178
+ let defaultValue = simplifiedPropsDefinition[key].default;
1179
+ if (typeof defaultValue === "function") {
1180
+ defaultValue = defaultValue();
1181
+ }
1182
+ if (typeof defaultValue === "object") {
1183
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
1184
+ acc[key] = componentDefaults[key];
1185
+ }
1186
+ } else if (defaultValue === propValue) {
1187
+ acc[key] = componentDefaults[key];
1188
+ }
1189
+ }
1190
+ }
1191
+ return acc;
1192
+ }, {});
1193
+ });
1194
+ }
1128
1195
  const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
1129
1196
  function useDebouncedInput(modelValue, emit, ms = 0, {
1130
1197
  getter = (value) => value,
@@ -1254,9 +1321,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1254
1321
  setup(__props, { expose: __expose, emit }) {
1255
1322
  const props = __props;
1256
1323
  const slots = useSlots();
1257
- const inputEl = ref();
1258
- const innerEl = ref();
1259
- __expose({ $inner: innerEl });
1324
+ const propsDefaults = useDefaults(
1325
+ "VvInputText",
1326
+ VvInputTextProps,
1327
+ props
1328
+ );
1260
1329
  const {
1261
1330
  id,
1262
1331
  icon,
@@ -1266,39 +1335,131 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1266
1335
  count,
1267
1336
  valid,
1268
1337
  invalid,
1269
- loading
1338
+ loading,
1339
+ debounce,
1340
+ maxlength,
1341
+ minlength,
1342
+ type,
1343
+ iMask,
1344
+ step
1270
1345
  } = toRefs(props);
1271
1346
  const hasId = useUniqueId(id);
1272
1347
  const hasHintId = computed(() => `${hasId.value}-hint`);
1273
1348
  const inputTextPlaceholder = computed(
1274
1349
  () => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
1275
1350
  );
1276
- const localModelValue = useDebouncedInput(
1277
- modelValue,
1278
- emit,
1279
- 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
+ ),
1280
1358
  {
1281
- getter: (value) => {
1282
- if (mask.value) {
1283
- return mask.value.masked(value ?? "");
1359
+ emit,
1360
+ onAccept: () => {
1361
+ if (!maskReady.value) {
1362
+ return;
1284
1363
  }
1285
- return value;
1286
- },
1287
- setter: (value) => {
1288
- if (mask.value) {
1289
- value = mask.value.unmasked(value);
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;
1290
1379
  }
1291
- if (props.type === INPUT_TYPES.NUMBER) {
1292
- return Number(value);
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;
1293
1398
  }
1294
- return 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;
1417
+ }
1418
+ if (!localModelValue.value && !unmasked.value) {
1419
+ return;
1420
+ }
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 ?? "";
1295
1437
  }
1296
1438
  }
1297
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
+ );
1298
1454
  const { focused } = useComponentFocus(inputEl, emit);
1299
1455
  const isFocused = computed(
1300
1456
  () => focused.value && !props.disabled && !props.readonly
1301
1457
  );
1458
+ watch(isFocused, (newValue) => {
1459
+ if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
1460
+ inputEl.value.select();
1461
+ }
1462
+ });
1302
1463
  const isVisible = useElementVisibility(inputEl);
1303
1464
  watch(isVisible, (newValue) => {
1304
1465
  if (newValue && props.autofocus && !props.disabled && !props.readonly) {
@@ -1316,19 +1477,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1316
1477
  const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
1317
1478
  const onStepUp = () => {
1318
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
+ }
1319
1484
  inputEl.value.stepUp();
1320
1485
  localModelValue.value = unref(inputEl).value;
1321
1486
  }
1322
1487
  };
1323
1488
  const onStepDown = () => {
1324
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
+ }
1325
1494
  inputEl.value.stepDown();
1326
1495
  localModelValue.value = unref(inputEl).value;
1327
1496
  }
1328
1497
  };
1329
1498
  const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
1330
1499
  const onClear = () => {
1331
- localModelValue.value = void 0;
1500
+ localModelValue.value = "";
1332
1501
  };
1333
1502
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
1334
1503
  icon,
@@ -1350,9 +1519,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1350
1519
  }
1351
1520
  });
1352
1521
  const { formatted: countFormatted } = useTextCount(localModelValue, {
1353
- mode: props.count,
1354
- upperLimit: Number(props.maxlength),
1355
- 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)
1356
1525
  });
1357
1526
  const isClickable = computed(() => !props.disabled && !props.readonly);
1358
1527
  const hasTabindex = computed(
@@ -1387,17 +1556,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1387
1556
  }))
1388
1557
  );
1389
1558
  const hasAttrs = computed(() => {
1390
- const type = (() => {
1559
+ const type2 = (() => {
1391
1560
  if (isPassword.value && showPassword.value) {
1392
1561
  return INPUT_TYPES.TEXT;
1393
1562
  }
1394
1563
  if (isDateTime.value && !isDirty.value && !focused.value) {
1395
1564
  return INPUT_TYPES.TEXT;
1396
1565
  }
1566
+ if (iMask == null ? void 0 : iMask.value) {
1567
+ return INPUT_TYPES.TEXT;
1568
+ }
1397
1569
  return props.type;
1398
1570
  })();
1399
1571
  const toReturn = {
1400
- type,
1572
+ type: type2,
1401
1573
  name: props.name,
1402
1574
  tabindex: hasTabindex.value,
1403
1575
  disabled: props.disabled,
@@ -1408,20 +1580,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1408
1580
  "aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
1409
1581
  "aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
1410
1582
  };
1411
- 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) {
1412
1584
  toReturn.step = props.step;
1413
1585
  toReturn.max = props.max !== void 0 ? String(props.max) : void 0;
1414
1586
  toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
1415
1587
  }
1416
- 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) {
1417
1589
  toReturn.placeholder = inputTextPlaceholder.value;
1418
1590
  }
1419
- 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) {
1420
1592
  toReturn.minlength = props.minlength;
1421
1593
  toReturn.maxlength = props.maxlength;
1422
1594
  toReturn.pattern = props.pattern;
1423
1595
  }
1424
- if (type === INPUT_TYPES.EMAIL) {
1596
+ if (type2 === INPUT_TYPES.EMAIL) {
1425
1597
  toReturn.multiple = props.multiple;
1426
1598
  }
1427
1599
  return toReturn;
@@ -1440,7 +1612,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1440
1612
  hasHintLabelOrSlot,
1441
1613
  hasInvalidLabelOrSlot,
1442
1614
  hintSlotScope
1443
- } = HintSlotFactory(props, slots);
1615
+ } = HintSlotFactory(propsDefaults, slots);
1444
1616
  const PasswordInputActions = VvInputTextActionsFactory(
1445
1617
  INPUT_TYPES.PASSWORD,
1446
1618
  props
@@ -1453,31 +1625,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1453
1625
  INPUT_TYPES.SEARCH,
1454
1626
  props
1455
1627
  );
1456
- const mask = ref();
1457
- watch(
1458
- [
1459
- () => props.mask,
1460
- () => props.type,
1461
- () => props.maskEager,
1462
- () => props.maskReversed,
1463
- () => props.maskTokens,
1464
- () => props.maskTokensReplace
1465
- ],
1466
- ([newMask, newType, eager, reversed, tokens, tokensReplace]) => {
1467
- if (newMask && newType === INPUT_TYPES.TEXT) {
1468
- mask.value = new Mask({
1469
- mask: newMask,
1470
- eager,
1471
- reversed,
1472
- tokens,
1473
- tokensReplace
1474
- });
1475
- return;
1476
- }
1477
- mask.value = void 0;
1478
- },
1479
- { immediate: true }
1480
- );
1481
1628
  const onClickInner = () => {
1482
1629
  if (isClickable.value) {
1483
1630
  focused.value = true;
@@ -1491,6 +1638,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1491
1638
  width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
1492
1639
  };
1493
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
+ };
1494
1658
  return (_ctx, _cache) => {
1495
1659
  return openBlock(), createElementBlock("div", {
1496
1660
  class: normalizeClass(unref(bemCssClasses))
@@ -1514,17 +1678,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1514
1678
  key: 0,
1515
1679
  class: "vv-input-text__icon"
1516
1680
  }, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
1517
- withDirectives(createElementVNode("input", mergeProps({
1681
+ createElementVNode("input", mergeProps({
1518
1682
  id: unref(hasId),
1519
1683
  ref_key: "inputEl",
1520
- ref: inputEl,
1521
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
1684
+ ref: inputEl
1522
1685
  }, unref(hasAttrs), {
1523
1686
  style: unref(hasStyle),
1524
- onKeyup: _cache[1] || (_cache[1] = ($event) => emit("keyup", $event))
1525
- }), null, 16, _hoisted_5), [
1526
- [vModelDynamic, unref(localModelValue)]
1527
- ]),
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),
1528
1691
  (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_6, [
1529
1692
  renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
1530
1693
  createTextVNode(toDisplayString(_ctx.unit), 1)