@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,11 +1,16 @@
1
- import { unref, inject, computed, toRef, toRefs, defineComponent, useAttrs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, isRef, provide, watchEffect, watch, Fragment, renderList, createBlock, mergeProps, withCtx, resolveDynamicComponent, createCommentVNode, useSlots, h, onMounted, withDirectives, vModelCheckbox, createVNode, createSlots, nextTick, Transition, toHandlers, normalizeStyle, vShow, vModelSelect, vModelText, vModelDynamic, vModelRadio } from "vue";
1
+ import { unref, inject, computed, toRef, toRefs, defineComponent, useAttrs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, isRef, provide, watchEffect, watch, Fragment, renderList, createBlock, mergeProps, withCtx, resolveDynamicComponent, createCommentVNode, useSlots, h, onMounted, withDirectives, vModelCheckbox, createVNode, createSlots, nextTick, Transition, toHandlers, normalizeStyle, vShow, vModelSelect, vModelText, vModelRadio } from "vue";
2
2
  import { nanoid } from "nanoid";
3
- import { useToggle, useStorage, useVModel, useMutationObserver, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
3
+ import { useToggle, useStorage, useVModel, useMutationObserver, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
4
4
  import { iconExists, Icon, addIcon } from "@iconify/vue";
5
5
  import { get } from "ts-dot-prop";
6
6
  import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
7
7
  import mitt from "mitt";
8
- import { Mask } from "maska";
8
+ import { useIMask } from "vue-imask";
9
+ var Strategy = /* @__PURE__ */ ((Strategy2) => {
10
+ Strategy2["absolute"] = "absolute";
11
+ Strategy2["fixed"] = "fixed";
12
+ return Strategy2;
13
+ })(Strategy || {});
9
14
  var Side = /* @__PURE__ */ ((Side2) => {
10
15
  Side2["left"] = "left";
11
16
  Side2["right"] = "right";
@@ -272,19 +277,15 @@ const DropdownProps = {
272
277
  placement: {
273
278
  type: String,
274
279
  default: Side.bottom,
275
- validator: (value) => {
276
- return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
277
- }
280
+ validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
278
281
  },
279
282
  /**
280
283
  * Dropdown strategy
281
284
  */
282
285
  strategy: {
283
286
  type: String,
284
- default: "absolute",
285
- validator: (value) => {
286
- return ["fixed", "absolute"].includes(value);
287
- }
287
+ default: void 0,
288
+ validator: (value) => Object.values(Strategy).includes(value)
288
289
  },
289
290
  /**
290
291
  * Dropdown show / hide transition name
@@ -1442,9 +1443,9 @@ const _hoisted_1$h = {
1442
1443
  };
1443
1444
  const _hoisted_2$c = ["id"];
1444
1445
  const _hoisted_3$6 = ["aria-label"];
1445
- const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("div", { class: "vv-alert__close-mask" }, null, -1);
1446
+ const _hoisted_4$5 = /* @__PURE__ */ createElementVNode("div", { class: "vv-alert__close-mask" }, null, -1);
1446
1447
  const _hoisted_5$4 = [
1447
- _hoisted_4$4
1448
+ _hoisted_4$5
1448
1449
  ];
1449
1450
  const _hoisted_6$4 = {
1450
1451
  key: 1,
@@ -2015,19 +2016,26 @@ function joinLines(items) {
2015
2016
  return items;
2016
2017
  }
2017
2018
  function HintSlotFactory(propsOrRef, slots) {
2018
- const props = unref(propsOrRef);
2019
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
2020
- const validLabel = computed(() => joinLines(props.validLabel));
2021
- const loadingLabel = computed(() => props.loadingLabel);
2022
- const hintLabel = computed(() => props.hintLabel);
2019
+ const props = computed(() => {
2020
+ if (isRef(propsOrRef)) {
2021
+ return propsOrRef.value;
2022
+ }
2023
+ return propsOrRef;
2024
+ });
2025
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
2026
+ const validLabel = computed(() => joinLines(props.value.validLabel));
2027
+ const loadingLabel = computed(() => props.value.loadingLabel);
2028
+ const hintLabel = computed(() => props.value.hintLabel);
2023
2029
  const hasLoadingLabelOrSlot = computed(
2024
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
2030
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
2025
2031
  );
2026
2032
  const hasInvalidLabelOrSlot = computed(
2027
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
2033
+ () => !hasLoadingLabelOrSlot.value && Boolean(
2034
+ props.value.invalid && (slots.invalid || invalidLabel.value)
2035
+ )
2028
2036
  );
2029
2037
  const hasValidLabelOrSlot = computed(
2030
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
2038
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
2031
2039
  );
2032
2040
  const hasHintLabelOrSlot = computed(
2033
2041
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -2036,10 +2044,10 @@ function HintSlotFactory(propsOrRef, slots) {
2036
2044
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
2037
2045
  );
2038
2046
  const hintSlotScope = computed(() => ({
2039
- modelValue: props.modelValue,
2040
- valid: props.valid,
2041
- invalid: props.invalid,
2042
- loading: props.loading
2047
+ modelValue: props.value.modelValue,
2048
+ valid: props.value.valid,
2049
+ invalid: props.value.invalid,
2050
+ loading: props.value.loading
2043
2051
  }));
2044
2052
  const HintSlot = defineComponent({
2045
2053
  name: "HintSlot",
@@ -2565,6 +2573,13 @@ const VvComboboxProps = {
2565
2573
  * Use input text to search on options
2566
2574
  */
2567
2575
  searchable: Boolean,
2576
+ /**
2577
+ * Search function to filter options
2578
+ */
2579
+ searchFunction: {
2580
+ type: Function,
2581
+ default: void 0
2582
+ },
2568
2583
  /**
2569
2584
  * On searchable select is the input search placeholder
2570
2585
  */
@@ -2777,7 +2792,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2777
2792
  }
2778
2793
  } else if (props.flip) {
2779
2794
  if (typeof props.flip === "boolean") {
2780
- toReturn.push(flip());
2795
+ toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
2781
2796
  } else {
2782
2797
  toReturn.push(flip(props.flip));
2783
2798
  }
@@ -2829,13 +2844,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2829
2844
  }
2830
2845
  return toReturn;
2831
2846
  });
2832
- const { x, y, strategy, middlewareData, placement } = useFloating(
2847
+ const { x, y, middlewareData, placement, strategy } = useFloating(
2833
2848
  referenceEl,
2834
2849
  floatingEl,
2835
2850
  {
2836
2851
  whileElementsMounted: (...args) => {
2837
2852
  return autoUpdate(...args, {
2838
- animationFrame: props.strategy === "fixed"
2853
+ animationFrame: props.strategy === Strategy.fixed
2839
2854
  });
2840
2855
  },
2841
2856
  placement: computed(() => props.placement),
@@ -2844,16 +2859,18 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2844
2859
  }
2845
2860
  );
2846
2861
  const dropdownPlacement = computed(() => {
2862
+ var _a;
2847
2863
  if (hasCustomPosition.value) {
2848
2864
  return void 0;
2849
2865
  }
2866
+ const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
2850
2867
  return {
2851
2868
  position: strategy.value,
2852
2869
  top: `${y.value ?? 0}px`,
2853
2870
  left: `${x.value ?? 0}px`,
2854
- maxWidth: maxWidth.value,
2871
+ maxWidth: width ? void 0 : maxWidth.value,
2855
2872
  maxHeight: maxHeight.value,
2856
- width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
2873
+ width
2857
2874
  };
2858
2875
  });
2859
2876
  const side = computed(
@@ -2865,10 +2882,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2865
2882
  return void 0;
2866
2883
  }
2867
2884
  const staticSide = {
2868
- top: "bottom",
2869
- right: "left",
2870
- bottom: "top",
2871
- left: "right"
2885
+ [Side.top]: Side.bottom,
2886
+ [Side.right]: Side.left,
2887
+ [Side.bottom]: Side.top,
2888
+ [Side.left]: Side.right
2872
2889
  }[side.value];
2873
2890
  return {
2874
2891
  left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
@@ -3327,7 +3344,7 @@ const _hoisted_3$4 = {
3327
3344
  key: 0,
3328
3345
  class: "vv-select__input-before"
3329
3346
  };
3330
- const _hoisted_4$3 = { class: "vv-select__inner" };
3347
+ const _hoisted_4$4 = { class: "vv-select__inner" };
3331
3348
  const _hoisted_5$3 = ["id"];
3332
3349
  const _hoisted_6$3 = ["disabled", "hidden"];
3333
3350
  const _hoisted_7$3 = ["disabled", "value"];
@@ -3469,7 +3486,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3469
3486
  _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
3470
3487
  renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
3471
3488
  ])) : createCommentVNode("", true),
3472
- createElementVNode("div", _hoisted_4$3, [
3489
+ createElementVNode("div", _hoisted_4$4, [
3473
3490
  unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$n, mergeProps({
3474
3491
  key: 0,
3475
3492
  class: "vv-select__icon"
@@ -3559,7 +3576,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3559
3576
  const _hoisted_1$7 = ["id"];
3560
3577
  const _hoisted_2$5 = ["id", "for"];
3561
3578
  const _hoisted_3$3 = ["id", "aria-controls", "placeholder"];
3562
- const _hoisted_4$2 = {
3579
+ const _hoisted_4$3 = {
3563
3580
  key: 0,
3564
3581
  class: "vv-select__input-before"
3565
3582
  };
@@ -3632,7 +3649,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3632
3649
  const searchText = ref("");
3633
3650
  const debouncedSearchText = refDebounced(
3634
3651
  searchText,
3635
- Number(props.debounceSearch)
3652
+ computed(() => Number(props.debounceSearch))
3636
3653
  );
3637
3654
  watch(
3638
3655
  debouncedSearchText,
@@ -3655,7 +3672,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3655
3672
  expanded.value = false;
3656
3673
  };
3657
3674
  const onAfterExpand = () => {
3658
- if (searchable.value) {
3675
+ if (propsDefaults.value.searchable) {
3659
3676
  if (inputSearchEl.value) {
3660
3677
  inputSearchEl.value.focus({
3661
3678
  preventScroll: true
@@ -3664,7 +3681,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3664
3681
  }
3665
3682
  };
3666
3683
  const onAfterCollapse = () => {
3667
- if (searchable.value) {
3684
+ if (propsDefaults.value.searchable) {
3668
3685
  searchText.value = "";
3669
3686
  }
3670
3687
  };
@@ -3678,14 +3695,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3678
3695
  loading,
3679
3696
  valid,
3680
3697
  invalid,
3681
- floating,
3682
- searchable
3698
+ floating
3683
3699
  } = toRefs(props);
3684
3700
  const hasId = useUniqueId(id);
3685
3701
  const hasHintId = computed(() => `${hasId.value}-hint`);
3686
3702
  const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
3687
3703
  const hasSearchId = computed(() => `${hasId.value}-search`);
3688
3704
  const hasLabelId = computed(() => `${hasId.value}-label`);
3705
+ const localLoading = ref(false);
3706
+ const isLoading = computed(() => localLoading.value || loading.value);
3689
3707
  const dropdownEl = ref();
3690
3708
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
3691
3709
  icon,
@@ -3700,7 +3718,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3700
3718
  modifiers,
3701
3719
  computed(() => ({
3702
3720
  disabled: disabled.value,
3703
- loading: loading.value,
3721
+ loading: isLoading.value,
3704
3722
  readonly: readonly.value,
3705
3723
  "icon-before": Boolean(hasIconBefore.value),
3706
3724
  "icon-after": Boolean(hasIconAfter.value),
@@ -3718,8 +3736,19 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3718
3736
  getOptionDisabled,
3719
3737
  getOptionGrouped
3720
3738
  } = useOptions(props);
3721
- const filteredOptions = computed(() => {
3739
+ const filteredOptions = computedAsync(async () => {
3722
3740
  var _a;
3741
+ if (propsDefaults.value.searchFunction) {
3742
+ localLoading.value = true;
3743
+ const toReturn = await Promise.resolve(
3744
+ propsDefaults.value.searchFunction(
3745
+ debouncedSearchText.value,
3746
+ props.options
3747
+ )
3748
+ );
3749
+ localLoading.value = false;
3750
+ return toReturn;
3751
+ }
3723
3752
  return (_a = props.options) == null ? void 0 : _a.filter((option) => {
3724
3753
  return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
3725
3754
  });
@@ -3737,12 +3766,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3737
3766
  } else if (props.modelValue) {
3738
3767
  selectedValues = [props.modelValue];
3739
3768
  }
3740
- const options = props.options.reduce((acc, value) => {
3741
- if (isGroup(value)) {
3742
- return [...acc, ...getOptionGrouped(value)];
3743
- }
3744
- return [...acc, value];
3745
- }, []);
3769
+ const options = props.options.reduce(
3770
+ (acc, value) => {
3771
+ if (isGroup(value)) {
3772
+ return [...acc, ...getOptionGrouped(value)];
3773
+ }
3774
+ return [...acc, value];
3775
+ },
3776
+ []
3777
+ );
3746
3778
  return options.filter((option) => {
3747
3779
  if (isGroup(option)) {
3748
3780
  return getOptionGrouped(option).some(
@@ -3796,7 +3828,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3796
3828
  invalid: invalid.value,
3797
3829
  invalidLabel: propsDefaults.value.invalidLabel,
3798
3830
  hintLabel: propsDefaults.value.hintLabel,
3799
- loading: loading.value,
3831
+ loading: isLoading.value,
3800
3832
  loadingLabel: propsDefaults.value.loadingLabel,
3801
3833
  disabled: disabled.value,
3802
3834
  readonly: readonly.value,
@@ -3824,7 +3856,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3824
3856
  flip: propsDefaults.value.flip,
3825
3857
  autoPlacement: propsDefaults.value.autoPlacement,
3826
3858
  arrow: propsDefaults.value.arrow,
3827
- autofocusFirst: searchable.value ? true : propsDefaults.value.autofocusFirst,
3859
+ autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
3828
3860
  triggerWidth: propsDefaults.value.triggerWidth,
3829
3861
  modifiers: propsDefaults.value.dropdownModifiers
3830
3862
  }));
@@ -3856,7 +3888,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3856
3888
  _ctx.label ? (openBlock(), createElementBlock("label", {
3857
3889
  key: 0,
3858
3890
  id: unref(hasLabelId),
3859
- for: unref(searchable) ? unref(hasSearchId) : void 0
3891
+ for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
3860
3892
  }, toDisplayString(_ctx.label), 9, _hoisted_2$5)) : createCommentVNode("", true),
3861
3893
  createElementVNode("div", {
3862
3894
  ref_key: "wrapperEl",
@@ -3874,7 +3906,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3874
3906
  onAfterCollapse
3875
3907
  }), createSlots({
3876
3908
  default: withCtx(({ aria }) => [
3877
- _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
3909
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
3878
3910
  renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
3879
3911
  ])) : createCommentVNode("", true),
3880
3912
  createElementVNode("div", _hoisted_5$2, [
@@ -3908,6 +3940,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3908
3940
  _ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
3909
3941
  key: 0,
3910
3942
  "aria-label": unref(propsDefaults).deselectActionLabel,
3943
+ type: "button",
3911
3944
  onClick: withModifiers(($event) => onInput(option), ["stop"])
3912
3945
  }, [
3913
3946
  createVNode(_sfc_main$n, { name: "close" })
@@ -3930,87 +3963,90 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3930
3963
  renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
3931
3964
  ])) : createCommentVNode("", true)
3932
3965
  ]),
3933
- items: withCtx(() => [
3934
- unref(filteredOptions).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
3935
- return openBlock(), createElementBlock(Fragment, { key: index }, [
3936
- isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3937
- createVNode(_sfc_main$b, {
3938
- label: unref(getOptionLabel)(option)
3939
- }, null, 8, ["label"]),
3940
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
3941
- option
3942
- ), (item, i) => {
3943
- return openBlock(), createBlock(_sfc_main$c, mergeProps({
3944
- disabled: unref(getOptionDisabled)(item),
3945
- selected: getOptionSelected(item),
3946
- unselectable: _ctx.unselectable,
3947
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
3948
- selectHintLabel: unref(propsDefaults).selectHintLabel,
3949
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
3950
- }, {
3951
- key: i,
3952
- class: "vv-dropdown-option",
3953
- onClickPassive: ($event) => onInput(item)
3954
- }), {
3955
- default: withCtx(() => [
3956
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
3957
- option,
3958
- selectedOptions: unref(selectedOptions),
3959
- selected: getOptionSelected(item),
3960
- disabled: unref(getOptionDisabled)(item)
3961
- })), () => [
3962
- createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
3963
- ])
3964
- ]),
3965
- _: 2
3966
- }, 1040, ["onClickPassive"]);
3967
- }), 128))
3968
- ], 64)) : (openBlock(), createBlock(_sfc_main$c, mergeProps({ key: 1 }, {
3969
- disabled: unref(getOptionDisabled)(option),
3970
- selected: getOptionSelected(option),
3971
- unselectable: _ctx.unselectable,
3972
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
3973
- selectHintLabel: unref(propsDefaults).selectHintLabel,
3974
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
3975
- }, {
3976
- class: "vv-dropdown-option",
3977
- onClickPassive: ($event) => onInput(option)
3978
- }), {
3979
- default: withCtx(() => [
3980
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
3981
- option,
3982
- selectedOptions: unref(selectedOptions),
3983
- selected: getOptionSelected(option),
3984
- disabled: unref(getOptionDisabled)(option)
3985
- })), () => [
3986
- createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
3987
- ])
3988
- ]),
3989
- _: 2
3990
- }, 1040, ["onClickPassive"]))
3991
- ], 64);
3992
- }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$c, {
3993
- key: 1,
3994
- modifiers: "inert"
3995
- }, {
3996
- default: withCtx(() => [
3997
- renderSlot(_ctx.$slots, "no-options", {}, () => [
3998
- createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
3999
- ])
4000
- ]),
4001
- _: 3
4002
- })) : (openBlock(), createBlock(_sfc_main$c, {
4003
- key: 2,
4004
- modifiers: "inert"
4005
- }, {
4006
- default: withCtx(() => [
4007
- renderSlot(_ctx.$slots, "no-results", {}, () => [
4008
- createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
4009
- ])
4010
- ]),
4011
- _: 3
4012
- }))
4013
- ]),
3966
+ items: withCtx(() => {
3967
+ var _a;
3968
+ return [
3969
+ !unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
3970
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
3971
+ isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3972
+ createVNode(_sfc_main$b, {
3973
+ label: unref(getOptionLabel)(option)
3974
+ }, null, 8, ["label"]),
3975
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
3976
+ option
3977
+ ), (item, i) => {
3978
+ return openBlock(), createBlock(_sfc_main$c, mergeProps({
3979
+ disabled: unref(getOptionDisabled)(item),
3980
+ selected: getOptionSelected(item),
3981
+ unselectable: _ctx.unselectable,
3982
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
3983
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
3984
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
3985
+ }, {
3986
+ key: i,
3987
+ class: "vv-dropdown-option",
3988
+ onClickPassive: ($event) => onInput(item)
3989
+ }), {
3990
+ default: withCtx(() => [
3991
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
3992
+ option,
3993
+ selectedOptions: unref(selectedOptions),
3994
+ selected: getOptionSelected(item),
3995
+ disabled: unref(getOptionDisabled)(item)
3996
+ })), () => [
3997
+ createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
3998
+ ])
3999
+ ]),
4000
+ _: 2
4001
+ }, 1040, ["onClickPassive"]);
4002
+ }), 128))
4003
+ ], 64)) : (openBlock(), createBlock(_sfc_main$c, mergeProps({ key: 1 }, {
4004
+ disabled: unref(getOptionDisabled)(option),
4005
+ selected: getOptionSelected(option),
4006
+ unselectable: _ctx.unselectable,
4007
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
4008
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
4009
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
4010
+ }, {
4011
+ class: "vv-dropdown-option",
4012
+ onClickPassive: ($event) => onInput(option)
4013
+ }), {
4014
+ default: withCtx(() => [
4015
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
4016
+ option,
4017
+ selectedOptions: unref(selectedOptions),
4018
+ selected: getOptionSelected(option),
4019
+ disabled: unref(getOptionDisabled)(option)
4020
+ })), () => [
4021
+ createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
4022
+ ])
4023
+ ]),
4024
+ _: 2
4025
+ }, 1040, ["onClickPassive"]))
4026
+ ], 64);
4027
+ }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$c, {
4028
+ key: 1,
4029
+ modifiers: "inert"
4030
+ }, {
4031
+ default: withCtx(() => [
4032
+ renderSlot(_ctx.$slots, "no-options", {}, () => [
4033
+ createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
4034
+ ])
4035
+ ]),
4036
+ _: 3
4037
+ })) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$c, {
4038
+ key: 2,
4039
+ modifiers: "inert"
4040
+ }, {
4041
+ default: withCtx(() => [
4042
+ renderSlot(_ctx.$slots, "no-results", {}, () => [
4043
+ createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
4044
+ ])
4045
+ ]),
4046
+ _: 3
4047
+ })) : createCommentVNode("", true)
4048
+ ];
4049
+ }),
4014
4050
  after: withCtx(() => [
4015
4051
  renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
4016
4052
  var _a;
@@ -4026,11 +4062,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4026
4062
  ]),
4027
4063
  _: 2
4028
4064
  }, [
4029
- unref(searchable) || _ctx.$slots["dropdown::before"] ? {
4065
+ unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
4030
4066
  name: "before",
4031
4067
  fn: withCtx(() => [
4032
4068
  renderSlot(_ctx.$slots, "dropdown::before"),
4033
- unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
4069
+ unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
4034
4070
  key: 0,
4035
4071
  id: unref(hasSearchId),
4036
4072
  ref_key: "inputSearchEl",
@@ -4129,12 +4165,13 @@ const VvDialogProps = {
4129
4165
  */
4130
4166
  keepOpen: { type: Boolean, default: false }
4131
4167
  };
4132
- const _hoisted_1$6 = {
4168
+ const _hoisted_1$6 = ["onCancel"];
4169
+ const _hoisted_2$4 = {
4133
4170
  key: 0,
4134
4171
  class: "vv-dialog__header"
4135
4172
  };
4136
- const _hoisted_2$4 = { class: "vv-dialog__content" };
4137
- const _hoisted_3$2 = {
4173
+ const _hoisted_3$2 = { class: "vv-dialog__content" };
4174
+ const _hoisted_4$2 = {
4138
4175
  key: 1,
4139
4176
  class: "vv-dialog__footer"
4140
4177
  };
@@ -4150,7 +4187,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4150
4187
  const dialogEl = ref();
4151
4188
  const modelValue = useVModel(props, "modelValue", emit);
4152
4189
  const localModelValue = ref(false);
4153
- const opened = computed({
4190
+ const isOpened = computed({
4154
4191
  get: () => modelValue.value ?? localModelValue.value,
4155
4192
  set: (newValue) => {
4156
4193
  if (modelValue.value === void 0) {
@@ -4176,14 +4213,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4176
4213
  const transitioName = computed(() => `vv-dialog--${props.transition}`);
4177
4214
  const dialogTransitionHandlers = {
4178
4215
  "before-enter": () => {
4179
- var _a;
4180
- (_a = dialogEl.value) == null ? void 0 : _a.showModal();
4216
+ var _a, _b;
4217
+ if (!((_a = dialogEl.value) == null ? void 0 : _a.open)) {
4218
+ (_b = dialogEl.value) == null ? void 0 : _b.showModal();
4219
+ }
4181
4220
  emit("open");
4182
4221
  emit("before-enter");
4183
4222
  },
4184
4223
  "after-leave": () => {
4185
- var _a;
4186
- (_a = dialogEl.value) == null ? void 0 : _a.close();
4224
+ var _a, _b;
4225
+ if ((_a = dialogEl.value) == null ? void 0 : _a.open) {
4226
+ (_b = dialogEl.value) == null ? void 0 : _b.close();
4227
+ }
4187
4228
  emit("close");
4188
4229
  emit("after-leave");
4189
4230
  },
@@ -4207,37 +4248,37 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4207
4248
  }
4208
4249
  };
4209
4250
  onClickOutside(modalWrapper, () => {
4210
- if (!props.keepOpen && opened.value) {
4211
- opened.value = false;
4251
+ if (!props.keepOpen) {
4252
+ close();
4212
4253
  }
4213
4254
  });
4214
4255
  function close() {
4215
- opened.value = false;
4256
+ isOpened.value = false;
4216
4257
  }
4217
4258
  function open() {
4218
- opened.value = true;
4259
+ isOpened.value = true;
4219
4260
  }
4220
4261
  __expose({ close, open });
4221
- onKeyStroke("Escape", (e) => {
4222
- if (opened.value) {
4223
- e.preventDefault();
4262
+ const onCancel = () => {
4263
+ if (!props.keepOpen) {
4224
4264
  close();
4225
4265
  }
4226
- });
4266
+ };
4227
4267
  return (_ctx, _cache) => {
4228
4268
  return openBlock(), createBlock(Transition, mergeProps({ name: unref(transitioName) }, toHandlers(dialogTransitionHandlers)), {
4229
4269
  default: withCtx(() => [
4230
4270
  withDirectives(createElementVNode("dialog", mergeProps(unref(dialogAttrs), {
4231
4271
  ref_key: "dialogEl",
4232
4272
  ref: dialogEl,
4233
- class: unref(dialogClass)
4273
+ class: unref(dialogClass),
4274
+ onCancel: withModifiers(onCancel, ["stop", "prevent"])
4234
4275
  }), [
4235
4276
  createElementVNode("article", {
4236
4277
  ref_key: "modalWrapper",
4237
4278
  ref: modalWrapper,
4238
4279
  class: "vv-dialog__wrapper"
4239
4280
  }, [
4240
- _ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header", _hoisted_1$6, [
4281
+ _ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header", _hoisted_2$4, [
4241
4282
  renderSlot(_ctx.$slots, "header", {}, () => [
4242
4283
  createTextVNode(toDisplayString(_ctx.title) + " ", 1),
4243
4284
  createElementVNode("button", {
@@ -4250,15 +4291,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4250
4291
  ], 32)
4251
4292
  ])
4252
4293
  ])) : createCommentVNode("", true),
4253
- createElementVNode("div", _hoisted_2$4, [
4294
+ createElementVNode("div", _hoisted_3$2, [
4254
4295
  renderSlot(_ctx.$slots, "default")
4255
4296
  ]),
4256
- _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_3$2, [
4297
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_4$2, [
4257
4298
  renderSlot(_ctx.$slots, "footer")
4258
4299
  ])) : createCommentVNode("", true)
4259
4300
  ], 512)
4260
- ], 16), [
4261
- [vShow, unref(opened)]
4301
+ ], 16, _hoisted_1$6), [
4302
+ [vShow, unref(isOpened)]
4262
4303
  ])
4263
4304
  ]),
4264
4305
  _: 3
@@ -4289,7 +4330,23 @@ const TYPES_ICON = {
4289
4330
  COLOR: "color",
4290
4331
  SEARCH: "close"
4291
4332
  };
4292
- const VvInputTextEvents = ["update:modelValue", "focus", "blur", "keyup"];
4333
+ const VvInputTextEvents = [
4334
+ "update:modelValue",
4335
+ "update:masked",
4336
+ "accept",
4337
+ "accept:typed",
4338
+ "accept:masked",
4339
+ "accept:unmasked",
4340
+ "complete",
4341
+ "complete:typed",
4342
+ "complete:masked",
4343
+ "complete:unmasked",
4344
+ "focus",
4345
+ "blur",
4346
+ "keyup",
4347
+ "keydown",
4348
+ "keypress"
4349
+ ];
4293
4350
  const VvInputTextProps = {
4294
4351
  ...InputTextareaProps,
4295
4352
  /**
@@ -4396,44 +4453,19 @@ const VvInputTextProps = {
4396
4453
  default: "Clear"
4397
4454
  },
4398
4455
  /**
4399
- * Input mask, only for text type
4400
- * @see https://beholdr.github.io/maska/
4456
+ * iMask options
4457
+ * @see https://imask.js.org/guide.html
4401
4458
  */
4402
- mask: {
4403
- type: String,
4404
- default: void 0
4405
- },
4406
- /**
4407
- * Show mask before typing
4408
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
4409
- */
4410
- maskEager: {
4411
- type: Boolean,
4412
- default: false
4413
- },
4414
- /**
4415
- * Write values reverse (ex. for numbers)
4416
- * @see https://beholdr.github.io/maska/#/?id=maskinput-options
4417
- */
4418
- maskReversed: {
4419
- type: Boolean,
4420
- default: false
4421
- },
4422
- /**
4423
- * Add mask custom tokens
4424
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
4425
- */
4426
- maskTokens: {
4459
+ iMask: {
4427
4460
  type: Object,
4428
4461
  default: void 0
4429
4462
  },
4430
4463
  /**
4431
- * Replace default tokens
4432
- * @see https://beholdr.github.io/maska/#/?id=custom-tokens
4464
+ * Masked value
4433
4465
  */
4434
- maskTokensReplace: {
4435
- type: Boolean,
4436
- default: false
4466
+ masked: {
4467
+ type: String,
4468
+ default: void 0
4437
4469
  },
4438
4470
  /**
4439
4471
  * Adjust input width to content
@@ -4454,6 +4486,13 @@ const VvInputTextProps = {
4454
4486
  */
4455
4487
  unit: {
4456
4488
  type: String
4489
+ },
4490
+ /**
4491
+ * Select input text on focus
4492
+ */
4493
+ selectOnFocus: {
4494
+ type: Boolean,
4495
+ default: false
4457
4496
  }
4458
4497
  };
4459
4498
  const VvInputPasswordAction = defineComponent({
@@ -4778,9 +4817,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4778
4817
  VvInputTextProps,
4779
4818
  props
4780
4819
  );
4781
- const inputEl = ref();
4782
- const innerEl = ref();
4783
- __expose({ $inner: innerEl });
4784
4820
  const {
4785
4821
  id,
4786
4822
  icon,
@@ -4790,39 +4826,131 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4790
4826
  count,
4791
4827
  valid,
4792
4828
  invalid,
4793
- loading
4829
+ loading,
4830
+ debounce,
4831
+ maxlength,
4832
+ minlength,
4833
+ type,
4834
+ iMask,
4835
+ step
4794
4836
  } = toRefs(props);
4795
4837
  const hasId = useUniqueId(id);
4796
4838
  const hasHintId = computed(() => `${hasId.value}-hint`);
4797
4839
  const inputTextPlaceholder = computed(
4798
4840
  () => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
4799
4841
  );
4800
- const localModelValue = useDebouncedInput(
4801
- modelValue,
4802
- emit,
4803
- props.debounce,
4842
+ const maskReady = ref(false);
4843
+ const { el, mask, typed, masked, unmasked } = useIMask(
4844
+ computed(
4845
+ () => (iMask == null ? void 0 : iMask.value) ?? {
4846
+ mask: /./
4847
+ }
4848
+ ),
4804
4849
  {
4805
- getter: (value) => {
4806
- if (mask.value) {
4807
- return mask.value.masked(value ?? "");
4850
+ emit,
4851
+ onAccept: () => {
4852
+ if (!maskReady.value) {
4853
+ return;
4808
4854
  }
4809
- return value;
4810
- },
4811
- setter: (value) => {
4812
- if (mask.value) {
4813
- value = mask.value.unmasked(value);
4855
+ emit("update:masked", masked.value);
4856
+ if (type.value === INPUT_TYPES.NUMBER) {
4857
+ if (masked.value === "") {
4858
+ if (localModelValue.value === null || localModelValue.value === void 0) {
4859
+ return;
4860
+ }
4861
+ localModelValue.value = void 0;
4862
+ return;
4863
+ }
4864
+ if (typeof typed.value !== "number") {
4865
+ localModelValue.value = Number(typed.value);
4866
+ return;
4867
+ }
4868
+ localModelValue.value = typed.value;
4869
+ return;
4870
+ }
4871
+ if (type.value === INPUT_TYPES.DATE) {
4872
+ if (el.value instanceof HTMLInputElement && el.value.type === "date") {
4873
+ localModelValue.value = el.value.value;
4874
+ return;
4875
+ }
4876
+ let date = typed.value;
4877
+ if (date === null || date === "") {
4878
+ if (!localModelValue.value) {
4879
+ return;
4880
+ }
4881
+ localModelValue.value = "";
4882
+ return;
4883
+ }
4884
+ if (!(date instanceof Date)) {
4885
+ date = new Date(date);
4886
+ }
4887
+ localModelValue.value = `${date.getFullYear()}-${("0" + (date.getMonth() + 1)).slice(-2)}-${("0" + date.getDate()).slice(-2)}`;
4888
+ return;
4889
+ }
4890
+ if (type.value === INPUT_TYPES.DATETIME_LOCAL) {
4891
+ if (el.value instanceof HTMLInputElement && el.value.type === "datetime-local") {
4892
+ localModelValue.value = el.value.value;
4893
+ return;
4894
+ }
4895
+ let date = typed.value;
4896
+ if (date === null || date === "") {
4897
+ if (!localModelValue.value) {
4898
+ return;
4899
+ }
4900
+ localModelValue.value = "";
4901
+ return;
4902
+ }
4903
+ if (!(typed.value instanceof Date)) {
4904
+ date = new Date(date);
4905
+ }
4906
+ 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)}`;
4907
+ return;
4814
4908
  }
4815
- if (props.type === INPUT_TYPES.NUMBER) {
4816
- return Number(value);
4909
+ if (!localModelValue.value && !unmasked.value) {
4910
+ return;
4817
4911
  }
4818
- return value;
4912
+ localModelValue.value = unmasked.value;
4913
+ }
4914
+ }
4915
+ );
4916
+ onMounted(() => {
4917
+ if (mask.value) {
4918
+ maskReady.value = true;
4919
+ typed.value = localModelValue.value ?? "";
4920
+ }
4921
+ });
4922
+ watch(
4923
+ () => props.modelValue,
4924
+ (newValue) => {
4925
+ var _a;
4926
+ if (mask.value) {
4927
+ typed.value = newValue && ((_a = iMask == null ? void 0 : iMask.value) == null ? void 0 : _a.mask) === Date ? new Date(newValue) : newValue ?? "";
4819
4928
  }
4820
4929
  }
4821
4930
  );
4931
+ watch(
4932
+ () => props.masked,
4933
+ (newValue) => {
4934
+ masked.value = newValue ?? "";
4935
+ }
4936
+ );
4937
+ const inputEl = el;
4938
+ const innerEl = ref();
4939
+ __expose({ $inner: innerEl });
4940
+ const localModelValue = useDebouncedInput(
4941
+ modelValue,
4942
+ emit,
4943
+ (debounce == null ? void 0 : debounce.value) ?? 0
4944
+ );
4822
4945
  const { focused } = useComponentFocus(inputEl, emit);
4823
4946
  const isFocused = computed(
4824
4947
  () => focused.value && !props.disabled && !props.readonly
4825
4948
  );
4949
+ watch(isFocused, (newValue) => {
4950
+ if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
4951
+ inputEl.value.select();
4952
+ }
4953
+ });
4826
4954
  const isVisible = useElementVisibility(inputEl);
4827
4955
  watch(isVisible, (newValue) => {
4828
4956
  if (newValue && props.autofocus && !props.disabled && !props.readonly) {
@@ -4840,19 +4968,27 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4840
4968
  const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
4841
4969
  const onStepUp = () => {
4842
4970
  if (isClickable.value) {
4971
+ if (iMask == null ? void 0 : iMask.value) {
4972
+ typed.value = typed.value + Number((step == null ? void 0 : step.value) ?? 1);
4973
+ return;
4974
+ }
4843
4975
  inputEl.value.stepUp();
4844
4976
  localModelValue.value = unref(inputEl).value;
4845
4977
  }
4846
4978
  };
4847
4979
  const onStepDown = () => {
4848
4980
  if (isClickable.value) {
4981
+ if (iMask == null ? void 0 : iMask.value) {
4982
+ typed.value = typed.value - Number((step == null ? void 0 : step.value) ?? 1);
4983
+ return;
4984
+ }
4849
4985
  inputEl.value.stepDown();
4850
4986
  localModelValue.value = unref(inputEl).value;
4851
4987
  }
4852
4988
  };
4853
4989
  const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
4854
4990
  const onClear = () => {
4855
- localModelValue.value = void 0;
4991
+ localModelValue.value = "";
4856
4992
  };
4857
4993
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
4858
4994
  icon,
@@ -4874,9 +5010,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4874
5010
  }
4875
5011
  });
4876
5012
  const { formatted: countFormatted } = useTextCount(localModelValue, {
4877
- mode: props.count,
4878
- upperLimit: Number(props.maxlength),
4879
- lowerLimit: Number(props.minlength)
5013
+ mode: count.value,
5014
+ upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
5015
+ lowerLimit: Number(minlength == null ? void 0 : minlength.value)
4880
5016
  });
4881
5017
  const isClickable = computed(() => !props.disabled && !props.readonly);
4882
5018
  const hasTabindex = computed(
@@ -4911,17 +5047,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4911
5047
  }))
4912
5048
  );
4913
5049
  const hasAttrs = computed(() => {
4914
- const type = (() => {
5050
+ const type2 = (() => {
4915
5051
  if (isPassword.value && showPassword.value) {
4916
5052
  return INPUT_TYPES.TEXT;
4917
5053
  }
4918
5054
  if (isDateTime.value && !isDirty.value && !focused.value) {
4919
5055
  return INPUT_TYPES.TEXT;
4920
5056
  }
5057
+ if (iMask == null ? void 0 : iMask.value) {
5058
+ return INPUT_TYPES.TEXT;
5059
+ }
4921
5060
  return props.type;
4922
5061
  })();
4923
5062
  const toReturn = {
4924
- type,
5063
+ type: type2,
4925
5064
  name: props.name,
4926
5065
  tabindex: hasTabindex.value,
4927
5066
  disabled: props.disabled,
@@ -4932,20 +5071,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4932
5071
  "aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
4933
5072
  "aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
4934
5073
  };
4935
- 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) {
5074
+ 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) {
4936
5075
  toReturn.step = props.step;
4937
5076
  toReturn.max = props.max !== void 0 ? String(props.max) : void 0;
4938
5077
  toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
4939
5078
  }
4940
- 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) {
5079
+ 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) {
4941
5080
  toReturn.placeholder = inputTextPlaceholder.value;
4942
5081
  }
4943
- 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) {
5082
+ 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) {
4944
5083
  toReturn.minlength = props.minlength;
4945
5084
  toReturn.maxlength = props.maxlength;
4946
5085
  toReturn.pattern = props.pattern;
4947
5086
  }
4948
- if (type === INPUT_TYPES.EMAIL) {
5087
+ if (type2 === INPUT_TYPES.EMAIL) {
4949
5088
  toReturn.multiple = props.multiple;
4950
5089
  }
4951
5090
  return toReturn;
@@ -4977,31 +5116,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4977
5116
  INPUT_TYPES.SEARCH,
4978
5117
  props
4979
5118
  );
4980
- const mask = ref();
4981
- watch(
4982
- [
4983
- () => props.mask,
4984
- () => props.type,
4985
- () => props.maskEager,
4986
- () => props.maskReversed,
4987
- () => props.maskTokens,
4988
- () => props.maskTokensReplace
4989
- ],
4990
- ([newMask, newType, eager, reversed, tokens, tokensReplace]) => {
4991
- if (newMask && newType === INPUT_TYPES.TEXT) {
4992
- mask.value = new Mask({
4993
- mask: newMask,
4994
- eager,
4995
- reversed,
4996
- tokens,
4997
- tokensReplace
4998
- });
4999
- return;
5000
- }
5001
- mask.value = void 0;
5002
- },
5003
- { immediate: true }
5004
- );
5005
5119
  const onClickInner = () => {
5006
5120
  if (isClickable.value) {
5007
5121
  focused.value = true;
@@ -5015,6 +5129,23 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5015
5129
  width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
5016
5130
  };
5017
5131
  });
5132
+ const onKeyDown = (event) => {
5133
+ switch (event.code) {
5134
+ case "ArrowUp":
5135
+ if (isNumber.value) {
5136
+ onStepUp();
5137
+ event.preventDefault();
5138
+ }
5139
+ break;
5140
+ case "ArrowDown":
5141
+ if (isNumber.value) {
5142
+ onStepDown();
5143
+ event.preventDefault();
5144
+ }
5145
+ break;
5146
+ }
5147
+ emit("keydown", event);
5148
+ };
5018
5149
  return (_ctx, _cache) => {
5019
5150
  return openBlock(), createElementBlock("div", {
5020
5151
  class: normalizeClass(unref(bemCssClasses))
@@ -5038,17 +5169,16 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5038
5169
  key: 0,
5039
5170
  class: "vv-input-text__icon"
5040
5171
  }, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
5041
- withDirectives(createElementVNode("input", mergeProps({
5172
+ createElementVNode("input", mergeProps({
5042
5173
  id: unref(hasId),
5043
5174
  ref_key: "inputEl",
5044
- ref: inputEl,
5045
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
5175
+ ref: inputEl
5046
5176
  }, unref(hasAttrs), {
5047
5177
  style: unref(hasStyle),
5048
- onKeyup: _cache[1] || (_cache[1] = ($event) => emit("keyup", $event))
5049
- }), null, 16, _hoisted_5$1), [
5050
- [vModelDynamic, unref(localModelValue)]
5051
- ]),
5178
+ onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
5179
+ onKeydown: onKeyDown,
5180
+ onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
5181
+ }), null, 16, _hoisted_5$1),
5052
5182
  (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
5053
5183
  renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
5054
5184
  createTextVNode(toDisplayString(_ctx.unit), 1)
@@ -5643,14 +5773,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5643
5773
  valid,
5644
5774
  invalid,
5645
5775
  loading,
5646
- modifiers
5776
+ modifiers,
5777
+ debounce,
5778
+ minlength,
5779
+ maxlength
5647
5780
  } = toRefs(props);
5648
5781
  const hasId = useUniqueId(id);
5649
5782
  const hasHintId = computed(() => `${hasId.value}-hint`);
5650
5783
  const hasPlaceholder = computed(
5651
5784
  () => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
5652
5785
  );
5653
- const localModelValue = useDebouncedInput(modelValue, emit, props.debounce);
5786
+ const localModelValue = useDebouncedInput(modelValue, emit, debounce == null ? void 0 : debounce.value);
5654
5787
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
5655
5788
  icon,
5656
5789
  iconPosition
@@ -5663,9 +5796,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5663
5796
  }
5664
5797
  });
5665
5798
  const { formatted: countFormatted } = useTextCount(localModelValue, {
5666
- mode: props.count,
5667
- upperLimit: Number(props.maxlength),
5668
- lowerLimit: Number(props.minlength)
5799
+ mode: count == null ? void 0 : count.value,
5800
+ upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
5801
+ lowerLimit: Number(minlength == null ? void 0 : minlength.value)
5669
5802
  });
5670
5803
  const isClickable = computed(() => !props.disabled && !props.readonly);
5671
5804
  const hasTabindex = computed(