@volverjs/ui-vue 0.0.10-beta.25 → 0.0.10-beta.27

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 (119) hide show
  1. package/auto-imports.d.ts +1 -0
  2. package/dist/components/VvAccordion/VvAccordion.es.js +14 -12
  3. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +92 -38
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +13 -2
  7. package/dist/components/VvAccordionGroup/index.d.ts +6 -4
  8. package/dist/components/VvAction/VvAction.es.js +14 -12
  9. package/dist/components/VvAction/VvAction.umd.js +1 -1
  10. package/dist/components/VvAction/VvAction.vue.d.ts +2 -11
  11. package/dist/components/VvAction/index.d.ts +1 -5
  12. package/dist/components/VvAlert/VvAlert.es.js +14 -12
  13. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  14. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +14 -12
  15. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  16. package/dist/components/VvAvatar/VvAvatar.es.js +14 -12
  17. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  18. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +14 -12
  19. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.es.js +14 -12
  21. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +14 -12
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  24. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +1 -1
  25. package/dist/components/VvButton/VvButton.es.js +14 -12
  26. package/dist/components/VvButton/VvButton.umd.js +1 -1
  27. package/dist/components/VvButton/VvButton.vue.d.ts +2 -19
  28. package/dist/components/VvButton/index.d.ts +1 -5
  29. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +14 -12
  30. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  31. package/dist/components/VvCard/VvCard.es.js +14 -12
  32. package/dist/components/VvCard/VvCard.umd.js +1 -1
  33. package/dist/components/VvCheckbox/VvCheckbox.es.js +14 -12
  34. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  35. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +14 -12
  36. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  37. package/dist/components/VvCombobox/VvCombobox.es.js +58 -34
  38. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  39. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +2 -8
  40. package/dist/components/VvCombobox/index.d.ts +9 -2
  41. package/dist/components/VvDialog/VvDialog.es.js +14 -12
  42. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  43. package/dist/components/VvDropdown/VvDropdown.es.js +24 -16
  44. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  45. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -19
  46. package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +13 -1
  47. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +9 -0
  48. package/dist/components/VvDropdown/index.d.ts +37 -0
  49. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +64 -15
  50. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  51. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +322 -1
  52. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  53. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +14 -12
  54. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  55. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +131 -76
  56. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  57. package/dist/components/VvInputFile/VvInputFile.es.js +14 -12
  58. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  59. package/dist/components/VvInputFile/index.d.ts +5 -5
  60. package/dist/components/VvInputText/VvInputText.es.js +979 -107
  61. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  62. package/dist/components/VvInputText/VvInputText.vue.d.ts +44 -1
  63. package/dist/components/VvInputText/index.d.ts +28 -0
  64. package/dist/components/VvNav/VvNav.es.js +14 -12
  65. package/dist/components/VvNav/VvNav.umd.js +1 -1
  66. package/dist/components/VvNav/VvNav.vue.d.ts +1 -1
  67. package/dist/components/VvNavItem/VvNavItem.es.js +14 -12
  68. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
  69. package/dist/components/VvProgress/VvProgress.es.js +14 -12
  70. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  71. package/dist/components/VvRadio/VvRadio.es.js +14 -12
  72. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  73. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +14 -12
  74. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  75. package/dist/components/VvSelect/VvSelect.es.js +14 -12
  76. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  77. package/dist/components/VvTab/VvTab.es.js +14 -12
  78. package/dist/components/VvTab/VvTab.umd.js +1 -1
  79. package/dist/components/VvTab/VvTab.vue.d.ts +1 -1
  80. package/dist/components/VvTextarea/VvTextarea.es.js +14 -12
  81. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  82. package/dist/components/VvTooltip/VvTooltip.es.js +14 -12
  83. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  84. package/dist/components/index.es.js +358 -144
  85. package/dist/components/index.umd.js +1 -1
  86. package/dist/composables/dropdown/useInjectDropdown.d.ts +3 -23
  87. package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -3
  88. package/dist/composables/usePersistence.d.ts +3 -0
  89. package/dist/constants.d.ts +24 -21
  90. package/dist/directives/index.es.js +14 -12
  91. package/dist/directives/index.umd.js +1 -1
  92. package/dist/directives/v-tooltip.es.js +14 -12
  93. package/dist/directives/v-tooltip.umd.js +1 -1
  94. package/dist/icons.es.js +3 -3
  95. package/dist/icons.umd.js +1 -1
  96. package/dist/props/index.d.ts +11 -11
  97. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +27 -4
  98. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +176 -29
  99. package/dist/stories/Button/Button.settings.d.ts +0 -1
  100. package/dist/types/nav.d.ts +1 -2
  101. package/package.json +8 -8
  102. package/src/assets/icons/detailed.json +1 -1
  103. package/src/assets/icons/normal.json +1 -1
  104. package/src/assets/icons/simple.json +1 -1
  105. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +14 -19
  106. package/src/components/VvAccordionGroup/index.ts +2 -5
  107. package/src/components/VvCombobox/VvCombobox.vue +2 -0
  108. package/src/components/VvDropdown/VvDropdown.vue +11 -2
  109. package/src/components/VvDropdown/VvDropdownItem.vue +4 -1
  110. package/src/components/VvDropdown/VvDropdownOption.vue +3 -21
  111. package/src/components/VvDropdown/index.ts +35 -1
  112. package/src/components/VvInputText/VvInputText.vue +100 -3
  113. package/src/components/VvInputText/index.ts +24 -1
  114. package/src/composables/dropdown/useProvideDropdown.ts +4 -4
  115. package/src/composables/usePersistence.ts +76 -0
  116. package/src/constants.ts +23 -18
  117. package/src/props/index.ts +12 -7
  118. package/src/stories/Button/Button.settings.ts +1 -4
  119. package/src/types/nav.ts +1 -3
@@ -1,12 +1,17 @@
1
- import { inject, computed, toRef, unref, defineComponent, useAttrs, toRefs, ref, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, provide, watchEffect, reactive, onMounted, nextTick, Fragment, renderList, createBlock, mergeProps, createSlots, withCtx, resolveDynamicComponent, mergeDefaults, createCommentVNode, createVNode, TransitionGroup, toHandlers, useSlots, isRef, h, withDirectives, vModelCheckbox, Transition, normalizeStyle, vShow, vModelSelect, vModelText, vModelRadio } from "vue";
1
+ import { inject, computed, toRef, unref, defineComponent, useAttrs, toRefs, ref, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, isRef, provide, watchEffect, reactive, onMounted, nextTick, Fragment, renderList, createBlock, mergeProps, createSlots, withCtx, resolveDynamicComponent, mergeDefaults, createCommentVNode, createVNode, TransitionGroup, toHandlers, useSlots, h, withDirectives, vModelCheckbox, Transition, normalizeStyle, vShow, vModelSelect, vModelText, vModelRadio } from "vue";
2
2
  import { uid } from "uid";
3
- import { useVModel, useLocalStorage, useMutationObserver, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
3
+ import { useVModel, useStorage, useMutationObserver, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
4
4
  import mitt from "mitt";
5
5
  import { iconExists, Icon, addIcon } from "@iconify/vue";
6
6
  import { get } from "ts-dot-prop";
7
7
  import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
8
8
  import { useIMask } from "vue-imask";
9
9
  import Sortable from "vuedraggable";
10
+ var StorageType = /* @__PURE__ */ ((StorageType2) => {
11
+ StorageType2["local"] = "local";
12
+ StorageType2["session"] = "session";
13
+ return StorageType2;
14
+ })(StorageType || {});
10
15
  var Strategy = /* @__PURE__ */ ((Strategy2) => {
11
16
  Strategy2["absolute"] = "absolute";
12
17
  Strategy2["fixed"] = "fixed";
@@ -64,13 +69,6 @@ var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
64
69
  DropdownItemRole2["presentation"] = "presentation";
65
70
  return DropdownItemRole2;
66
71
  })(DropdownItemRole || {});
67
- var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
68
- AnchorTarget2["_blank"] = "_blank";
69
- AnchorTarget2["_self"] = "_self";
70
- AnchorTarget2["_parent"] = "_parent";
71
- AnchorTarget2["_top"] = "_top";
72
- return AnchorTarget2;
73
- })(AnchorTarget || {});
74
72
  const INJECTION_KEY_VOLVER = Symbol.for("volver");
75
73
  const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
76
74
  "buttonGroup"
@@ -111,11 +109,7 @@ const LinkProps = {
111
109
  /**
112
110
  * Anchor target
113
111
  */
114
- target: {
115
- type: String,
116
- default: void 0,
117
- validator: (value) => Object.values(AnchorTarget).includes(value)
118
- },
112
+ target: String,
119
113
  /**
120
114
  * Anchor rel
121
115
  */
@@ -589,6 +583,14 @@ const NavProps = {
589
583
  default: () => []
590
584
  }
591
585
  };
586
+ const StorageProps = {
587
+ storageType: {
588
+ type: String,
589
+ default: StorageType.local,
590
+ validator: (value) => Object.values(StorageType).includes(value)
591
+ },
592
+ storageKey: String
593
+ };
592
594
  function useInjectedGroupState(groupKey) {
593
595
  const group = inject(groupKey, void 0);
594
596
  const isInGroup = computed(() => group !== void 0);
@@ -875,6 +877,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
875
877
  });
876
878
  const VvAccordionGroupProps = {
877
879
  ...ModifiersProps,
880
+ ...StorageProps,
878
881
  /**
879
882
  * VModel
880
883
  */
@@ -908,13 +911,69 @@ const VvAccordionGroupProps = {
908
911
  /**
909
912
  * If true, the accordion items will be opened by default
910
913
  */
911
- not: Boolean,
912
- /**
913
- * Enable local storage persistence
914
- */
915
- storeKey: String
914
+ not: Boolean
916
915
  };
917
916
  const VvAccordionGroupEvents = ["update:modelValue"];
917
+ const usePersistence = (storageKey, storageType = StorageType.local, defaultValue) => {
918
+ const localValue = ref();
919
+ if (defaultValue) {
920
+ localValue.value = defaultValue;
921
+ }
922
+ let storageValue;
923
+ if (storageKey) {
924
+ watch(
925
+ storageKey,
926
+ (newKey, oldKey) => {
927
+ const storage = unref(storageType) === StorageType.session ? sessionStorage : localStorage;
928
+ if (oldKey && oldKey !== newKey) {
929
+ storage.removeItem(oldKey);
930
+ }
931
+ if (newKey) {
932
+ storageValue = useStorage(
933
+ newKey,
934
+ (storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
935
+ storage
936
+ );
937
+ return;
938
+ }
939
+ storageValue = void 0;
940
+ },
941
+ {
942
+ immediate: true
943
+ }
944
+ );
945
+ }
946
+ if (isRef(storageType)) {
947
+ watch(storageType, (newType, oldType) => {
948
+ if (storageKey == null ? void 0 : storageKey.value) {
949
+ if (newType) {
950
+ const storage = newType === StorageType.session ? sessionStorage : localStorage;
951
+ storageValue = useStorage(
952
+ storageKey.value,
953
+ (storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
954
+ storage
955
+ );
956
+ }
957
+ if (oldType && oldType !== newType) {
958
+ const oldStorage = oldType === StorageType.session ? sessionStorage : localStorage;
959
+ oldStorage.removeItem(storageKey.value);
960
+ }
961
+ }
962
+ });
963
+ }
964
+ return computed({
965
+ get: () => {
966
+ return (storageValue == null ? void 0 : storageValue.value) ?? localValue.value;
967
+ },
968
+ set: (value) => {
969
+ if (storageValue) {
970
+ storageValue.value = value;
971
+ return;
972
+ }
973
+ localValue.value = value;
974
+ }
975
+ });
976
+ };
918
977
  function useProvideGroupState(key, groupState) {
919
978
  provide(key, groupState);
920
979
  }
@@ -928,7 +987,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
928
987
  setup(__props, { expose: __expose, emit: __emit }) {
929
988
  const props = __props;
930
989
  const emit = __emit;
931
- const { disabled, modifiers, itemModifiers, items } = toRefs(props);
990
+ const {
991
+ disabled,
992
+ modifiers,
993
+ itemModifiers,
994
+ items,
995
+ storageKey,
996
+ storageType
997
+ } = toRefs(props);
932
998
  watchEffect(() => {
933
999
  if (typeof props.modelValue === "string" && props.collapse) {
934
1000
  console.warn(
@@ -937,33 +1003,21 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
937
1003
  }
938
1004
  });
939
1005
  const accordionNames = reactive(/* @__PURE__ */ new Set());
940
- let storeModelValue = ref();
941
- watch(
942
- () => props.storeKey,
943
- (newKey, oldKey) => {
944
- if (oldKey && oldKey !== newKey) {
945
- localStorage.removeItem(oldKey);
946
- }
947
- if (newKey) {
948
- storeModelValue = useLocalStorage(newKey, storeModelValue.value);
949
- return;
950
- }
951
- storeModelValue = ref(storeModelValue.value);
952
- },
953
- {
954
- immediate: true
955
- }
1006
+ const storageModelValue = usePersistence(
1007
+ storageKey,
1008
+ storageType,
1009
+ []
956
1010
  );
957
1011
  const localModelValue = computed({
958
1012
  get: () => {
959
1013
  if (props.modelValue !== null && props.modelValue !== void 0) {
960
1014
  return props.modelValue;
961
1015
  }
962
- return storeModelValue.value;
1016
+ return storageModelValue.value;
963
1017
  },
964
1018
  set: (newValue) => {
965
1019
  emit("update:modelValue", newValue);
966
- storeModelValue.value = newValue;
1020
+ storageModelValue.value = newValue;
967
1021
  }
968
1022
  });
969
1023
  const expandedAccordions = computed({
@@ -3400,6 +3454,31 @@ const VvDropdownProps = {
3400
3454
  validator: (value) => Object.values(DropdownRole).includes(value)
3401
3455
  }
3402
3456
  };
3457
+ const VvDropdownItemProps = {
3458
+ focusOnHover: {
3459
+ type: Boolean,
3460
+ default: false
3461
+ }
3462
+ };
3463
+ const VvDropdownOptionProps = {
3464
+ ...DisabledProps,
3465
+ ...SelectedProps,
3466
+ ...UnselectableProps,
3467
+ ...ModifiersProps,
3468
+ deselectHintLabel: {
3469
+ type: String
3470
+ },
3471
+ selectHintLabel: {
3472
+ type: String
3473
+ },
3474
+ selectedHintLabel: {
3475
+ type: String
3476
+ },
3477
+ focusOnHover: {
3478
+ type: Boolean,
3479
+ default: false
3480
+ }
3481
+ };
3403
3482
  function useProvideDropdownTrigger({
3404
3483
  reference,
3405
3484
  id,
@@ -3430,14 +3509,14 @@ function useProvideDropdownTrigger({
3430
3509
  }
3431
3510
  function useProvideDropdownItem({
3432
3511
  role,
3433
- expanded
3512
+ ...others
3434
3513
  }) {
3435
3514
  const itemRole = computed(
3436
3515
  () => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
3437
3516
  );
3438
3517
  provide(INJECTION_KEY_DROPDOWN_ITEM, {
3439
3518
  role: itemRole,
3440
- expanded
3519
+ ...others
3441
3520
  });
3442
3521
  return { itemRole };
3443
3522
  }
@@ -3688,7 +3767,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3688
3767
  });
3689
3768
  bus.on("click", toggle);
3690
3769
  const { role, modifiers } = toRefs(props);
3691
- const { itemRole } = useProvideDropdownItem({ role, expanded });
3692
3770
  const bemCssClasses = useModifiers(
3693
3771
  "vv-dropdown",
3694
3772
  modifiers,
@@ -3757,6 +3835,13 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3757
3835
  }
3758
3836
  });
3759
3837
  };
3838
+ const hovered = useElementHover(floatingEl);
3839
+ const { itemRole } = useProvideDropdownItem({
3840
+ role,
3841
+ expanded,
3842
+ focused,
3843
+ hovered
3844
+ });
3760
3845
  onKeyStroke("Escape", (e) => {
3761
3846
  if (expanded.value) {
3762
3847
  e.preventDefault();
@@ -3882,7 +3967,9 @@ const __default__$d = {
3882
3967
  };
3883
3968
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
3884
3969
  ...__default__$d,
3970
+ props: VvDropdownItemProps,
3885
3971
  setup(__props) {
3972
+ const props = __props;
3886
3973
  const { role, expanded } = useInjectedDropdownItem();
3887
3974
  const element = ref(null);
3888
3975
  useProvideDropdownAction({ expanded });
@@ -3890,7 +3977,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3890
3977
  const { focused } = useFocus(element);
3891
3978
  const { focused: focusedWithin } = useFocusWithin(element);
3892
3979
  watch(hovered, (newValue) => {
3893
- if (newValue) {
3980
+ if (newValue && props.focusOnHover) {
3894
3981
  focused.value = true;
3895
3982
  }
3896
3983
  });
@@ -3917,21 +4004,7 @@ const __default__$c = {
3917
4004
  };
3918
4005
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
3919
4006
  ...__default__$c,
3920
- props: {
3921
- ...DisabledProps,
3922
- ...SelectedProps,
3923
- ...UnselectableProps,
3924
- ...ModifiersProps,
3925
- deselectHintLabel: {
3926
- type: String
3927
- },
3928
- selectHintLabel: {
3929
- type: String
3930
- },
3931
- selectedHintLabel: {
3932
- type: String
3933
- }
3934
- },
4007
+ props: VvDropdownOptionProps,
3935
4008
  setup(__props) {
3936
4009
  const props = __props;
3937
4010
  const { modifiers } = toRefs(props);
@@ -3957,7 +4030,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3957
4030
  class: normalizeClass(unref(bemCssClasses)),
3958
4031
  tabindex: _ctx.disabled ? -1 : 0,
3959
4032
  "aria-selected": _ctx.selected,
3960
- "aria-disabled": _ctx.disabled
4033
+ "aria-disabled": _ctx.disabled,
4034
+ "focus-on-hover": _ctx.focusOnHover
3961
4035
  }, {
3962
4036
  default: withCtx(() => [
3963
4037
  renderSlot(_ctx.$slots, "default"),
@@ -3976,7 +4050,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3976
4050
  ]),
3977
4051
  _: 3
3978
4052
  /* FORWARDED */
3979
- }, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
4053
+ }, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
3980
4054
  };
3981
4055
  }
3982
4056
  });
@@ -4074,7 +4148,7 @@ const _hoisted_4$4 = { class: "vv-select__inner" };
4074
4148
  const _hoisted_5$4 = ["id"];
4075
4149
  const _hoisted_6$4 = ["disabled", "hidden"];
4076
4150
  const _hoisted_7$4 = ["disabled", "value"];
4077
- const _hoisted_8$2 = ["disabled", "label"];
4151
+ const _hoisted_8$3 = ["disabled", "label"];
4078
4152
  const _hoisted_9$2 = ["disabled", "value"];
4079
4153
  const _hoisted_10$1 = {
4080
4154
  key: 1,
@@ -4263,7 +4337,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4263
4337
  128
4264
4338
  /* KEYED_FRAGMENT */
4265
4339
  ))
4266
- ], 8, _hoisted_8$2))
4340
+ ], 8, _hoisted_8$3))
4267
4341
  ],
4268
4342
  64
4269
4343
  /* STABLE_FRAGMENT */
@@ -4343,7 +4417,7 @@ const _hoisted_7$3 = {
4343
4417
  key: 0,
4344
4418
  class: "vv-select__value"
4345
4419
  };
4346
- const _hoisted_8$1 = ["aria-label", "onClick"];
4420
+ const _hoisted_8$2 = ["aria-label", "onClick"];
4347
4421
  const _hoisted_9$1 = {
4348
4422
  key: 1,
4349
4423
  class: "vv-select__input-after"
@@ -4716,7 +4790,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4716
4790
  onClick: withModifiers(($event) => onInput(option), ["stop"])
4717
4791
  }, [
4718
4792
  createVNode(_sfc_main$u, { name: "close" })
4719
- ], 8, _hoisted_8$1)) : createCommentVNode("v-if", true)
4793
+ ], 8, _hoisted_8$2)) : createCommentVNode("v-if", true)
4720
4794
  ]),
4721
4795
  _: 2
4722
4796
  /* DYNAMIC */
@@ -4789,6 +4863,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4789
4863
  }, {
4790
4864
  key: i,
4791
4865
  class: "vv-dropdown-option",
4866
+ "focus-on-hover": "",
4792
4867
  onClickPassive: ($event) => onInput(item)
4793
4868
  }), {
4794
4869
  default: withCtx(() => [
@@ -4824,6 +4899,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4824
4899
  selectedHintLabel: unref(propsDefaults).selectedHintLabel
4825
4900
  }, {
4826
4901
  class: "vv-dropdown-option",
4902
+ "focus-on-hover": "",
4827
4903
  onClickPassive: ($event) => onInput(option)
4828
4904
  }), {
4829
4905
  default: withCtx(() => [
@@ -5258,6 +5334,7 @@ const VvInputTextEvents = [
5258
5334
  ];
5259
5335
  const VvInputTextProps = {
5260
5336
  ...InputTextareaProps,
5337
+ ...StorageProps,
5261
5338
  /**
5262
5339
  * Input value
5263
5340
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
@@ -5326,6 +5403,14 @@ const VvInputTextProps = {
5326
5403
  type: [String, Object],
5327
5404
  default: ACTION_ICONS.clear
5328
5405
  },
5406
+ /**
5407
+ * VvIcon name for remove suggestion button
5408
+ * @see VVIcon
5409
+ */
5410
+ iconRemoveSuggestion: {
5411
+ type: [String, Object],
5412
+ default: ACTION_ICONS.remove
5413
+ },
5329
5414
  /**
5330
5415
  * Label for step up button
5331
5416
  */
@@ -5361,6 +5446,13 @@ const VvInputTextProps = {
5361
5446
  type: String,
5362
5447
  default: "Clear"
5363
5448
  },
5449
+ /**
5450
+ * Label for remove suggestion button
5451
+ */
5452
+ labelRemoveSuggestion: {
5453
+ type: String,
5454
+ default: "Remove suggestion"
5455
+ },
5364
5456
  /**
5365
5457
  * iMask options
5366
5458
  * @see https://imask.js.org/guide.html
@@ -5402,6 +5494,13 @@ const VvInputTextProps = {
5402
5494
  selectOnFocus: {
5403
5495
  type: Boolean,
5404
5496
  default: false
5497
+ },
5498
+ /**
5499
+ * Maximum number of suggestions
5500
+ */
5501
+ maxSuggestions: {
5502
+ type: Number,
5503
+ default: 5
5405
5504
  }
5406
5505
  };
5407
5506
  const VvInputPasswordAction = defineComponent({
@@ -5696,24 +5795,25 @@ function useTextCount(text, options) {
5696
5795
  };
5697
5796
  }
5698
5797
  const _hoisted_1$6 = ["for"];
5699
- const _hoisted_2$4 = { class: "vv-input-text__wrapper" };
5700
- const _hoisted_3$2 = {
5798
+ const _hoisted_2$4 = {
5701
5799
  key: 0,
5702
5800
  class: "vv-input-text__input-before"
5703
5801
  };
5704
- const _hoisted_4$2 = ["id"];
5705
- const _hoisted_5$2 = {
5802
+ const _hoisted_3$2 = ["id"];
5803
+ const _hoisted_4$2 = {
5706
5804
  key: 1,
5707
5805
  class: "vv-input-text__unit"
5708
5806
  };
5709
- const _hoisted_6$2 = {
5807
+ const _hoisted_5$2 = {
5710
5808
  key: 5,
5711
5809
  class: "vv-input-text__input-after"
5712
5810
  };
5713
- const _hoisted_7$2 = {
5811
+ const _hoisted_6$2 = {
5714
5812
  key: 6,
5715
5813
  class: "vv-input-text__limit"
5716
5814
  };
5815
+ const _hoisted_7$2 = { class: "flex-1" };
5816
+ const _hoisted_8$1 = ["title", "onClick"];
5717
5817
  const __default__$6 = {
5718
5818
  name: "VvInputText"
5719
5819
  };
@@ -5734,6 +5834,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5734
5834
  id,
5735
5835
  icon,
5736
5836
  iconPosition,
5837
+ iconRemoveSuggestion,
5737
5838
  label,
5738
5839
  modelValue,
5739
5840
  count,
@@ -5745,7 +5846,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5745
5846
  minlength,
5746
5847
  type,
5747
5848
  iMask,
5748
- step
5849
+ step,
5850
+ storageKey,
5851
+ storageType
5749
5852
  } = toRefs(props);
5750
5853
  const hasId = useUniqueId(id);
5751
5854
  const hasHintId = computed(() => `${hasId.value}-hint`);
@@ -5849,6 +5952,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5849
5952
  );
5850
5953
  const inputEl = el;
5851
5954
  const innerEl = ref();
5955
+ const wrapperEl = ref();
5956
+ const dropdownEl = ref();
5852
5957
  __expose({ $inner: innerEl });
5853
5958
  const localModelValue = useDebouncedInput(
5854
5959
  modelValue,
@@ -5860,9 +5965,27 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5860
5965
  () => focused.value && !props.disabled && !props.readonly
5861
5966
  );
5862
5967
  watch(isFocused, (newValue) => {
5968
+ var _a;
5863
5969
  if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
5864
5970
  inputEl.value.select();
5865
5971
  }
5972
+ if (newValue) {
5973
+ (_a = dropdownEl.value) == null ? void 0 : _a.show();
5974
+ return;
5975
+ }
5976
+ setTimeout(() => {
5977
+ if (isDirty.value && suggestions.value) {
5978
+ const suggestionsLimit = props.maxSuggestions - 1;
5979
+ if (suggestions.value.size > suggestionsLimit && !suggestions.value.has(localModelValue.value)) {
5980
+ suggestions.value = new Set(
5981
+ [...suggestions.value].slice(
5982
+ suggestions.value.size - suggestionsLimit
5983
+ )
5984
+ );
5985
+ }
5986
+ suggestions.value.add(localModelValue.value);
5987
+ }
5988
+ }, 300);
5866
5989
  });
5867
5990
  const isVisible = useElementVisibility(inputEl);
5868
5991
  watch(isVisible, (newValue) => {
@@ -5921,6 +6044,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5921
6044
  }
5922
6045
  return void 0;
5923
6046
  });
6047
+ const { hasIcon: hasIconRemoveSuggestion } = useComponentIcon(iconRemoveSuggestion);
5924
6048
  const { formatted: countFormatted } = useTextCount(localModelValue, {
5925
6049
  mode: count.value,
5926
6050
  upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
@@ -5940,6 +6064,31 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5940
6064
  }
5941
6065
  return void 0;
5942
6066
  });
6067
+ const suggestions = usePersistence(
6068
+ storageKey,
6069
+ storageType,
6070
+ /* @__PURE__ */ new Set()
6071
+ );
6072
+ const filteredSuggestions = computed(() => {
6073
+ if (!suggestions.value) {
6074
+ return [];
6075
+ }
6076
+ return [...suggestions.value].filter(
6077
+ (suggestion) => isEmpty(localModelValue.value) || `${suggestion}`.toLowerCase().includes(`${localModelValue.value}`.toLowerCase()) && suggestion !== localModelValue.value
6078
+ ).reverse();
6079
+ });
6080
+ const hasSuggestions = computed(
6081
+ () => (storageKey == null ? void 0 : storageKey.value) && suggestions.value && suggestions.value.size > 0
6082
+ );
6083
+ const onSuggestionSelect = (suggestion) => {
6084
+ var _a;
6085
+ localModelValue.value = suggestion;
6086
+ (_a = dropdownEl.value) == null ? void 0 : _a.hide();
6087
+ };
6088
+ const onSuggestionRemove = (suggestion) => {
6089
+ var _a;
6090
+ (_a = suggestions.value) == null ? void 0 : _a.delete(suggestion);
6091
+ };
5943
6092
  const { modifiers } = toRefs(props);
5944
6093
  const bemCssClasses = useModifiers(
5945
6094
  "vv-input-text",
@@ -6070,79 +6219,89 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
6070
6219
  for: unref(hasId),
6071
6220
  class: "vv-input-text__label"
6072
6221
  }, toDisplayString(unref(label)), 9, _hoisted_1$6)) : createCommentVNode("v-if", true),
6073
- createElementVNode("div", _hoisted_2$4, [
6074
- _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
6075
- renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
6076
- ])) : createCommentVNode("v-if", true),
6077
- createElementVNode(
6078
- "div",
6079
- {
6080
- ref_key: "innerEl",
6081
- ref: innerEl,
6082
- class: "vv-input-text__inner",
6083
- onClick: withModifiers(onClickInner, ["stop"])
6084
- },
6085
- [
6086
- unref(hasIconBefore) ? (openBlock(), createBlock(
6087
- _sfc_main$u,
6088
- mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
6089
- null,
6090
- 16
6091
- /* FULL_PROPS */
6092
- )) : createCommentVNode("v-if", true),
6093
- createElementVNode("input", mergeProps({
6094
- id: unref(hasId),
6095
- ref_key: "inputEl",
6096
- ref: inputEl
6097
- }, unref(hasAttrs), {
6098
- style: unref(hasStyle),
6099
- onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
6100
- onKeydown: onKeyDown,
6101
- onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
6102
- }), null, 16, _hoisted_4$2),
6103
- (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
6104
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
6105
- createTextVNode(
6106
- toDisplayString(_ctx.unit),
6107
- 1
6108
- /* TEXT */
6109
- )
6110
- ])
6111
- ])) : createCommentVNode("v-if", true)
6112
- ],
6113
- 512
6114
- /* NEED_PATCH */
6115
- ),
6116
- unref(iconAfter) ? (openBlock(), createBlock(
6117
- _sfc_main$u,
6118
- mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
6119
- null,
6120
- 16
6121
- /* FULL_PROPS */
6122
- )) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
6123
- key: 2,
6124
- onTogglePassword
6125
- })) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
6126
- key: 3,
6127
- onStepUp,
6128
- onStepDown
6129
- })) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
6130
- key: 4,
6131
- onClear
6132
- })) : createCommentVNode("v-if", true),
6133
- _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
6134
- renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
6135
- ])) : createCommentVNode("v-if", true),
6136
- unref(count) ? (openBlock(), createElementBlock("span", _hoisted_7$2, [
6137
- renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
6138
- createTextVNode(
6139
- toDisplayString(unref(countFormatted)),
6140
- 1
6141
- /* TEXT */
6142
- )
6143
- ])
6144
- ])) : createCommentVNode("v-if", true)
6145
- ]),
6222
+ createElementVNode(
6223
+ "div",
6224
+ {
6225
+ ref_key: "wrapperEl",
6226
+ ref: wrapperEl,
6227
+ class: "vv-input-text__wrapper"
6228
+ },
6229
+ [
6230
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
6231
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
6232
+ ])) : createCommentVNode("v-if", true),
6233
+ createElementVNode(
6234
+ "div",
6235
+ {
6236
+ ref_key: "innerEl",
6237
+ ref: innerEl,
6238
+ class: "vv-input-text__inner",
6239
+ onClick: withModifiers(onClickInner, ["stop"])
6240
+ },
6241
+ [
6242
+ unref(hasIconBefore) ? (openBlock(), createBlock(
6243
+ _sfc_main$u,
6244
+ mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
6245
+ null,
6246
+ 16
6247
+ /* FULL_PROPS */
6248
+ )) : createCommentVNode("v-if", true),
6249
+ createElementVNode("input", mergeProps({
6250
+ id: unref(hasId),
6251
+ ref_key: "inputEl",
6252
+ ref: inputEl
6253
+ }, unref(hasAttrs), {
6254
+ style: unref(hasStyle),
6255
+ onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
6256
+ onKeydown: onKeyDown,
6257
+ onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
6258
+ }), null, 16, _hoisted_3$2),
6259
+ (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
6260
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
6261
+ createTextVNode(
6262
+ toDisplayString(_ctx.unit),
6263
+ 1
6264
+ /* TEXT */
6265
+ )
6266
+ ])
6267
+ ])) : createCommentVNode("v-if", true)
6268
+ ],
6269
+ 512
6270
+ /* NEED_PATCH */
6271
+ ),
6272
+ unref(iconAfter) ? (openBlock(), createBlock(
6273
+ _sfc_main$u,
6274
+ mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
6275
+ null,
6276
+ 16
6277
+ /* FULL_PROPS */
6278
+ )) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
6279
+ key: 2,
6280
+ onTogglePassword
6281
+ })) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
6282
+ key: 3,
6283
+ onStepUp,
6284
+ onStepDown
6285
+ })) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
6286
+ key: 4,
6287
+ onClear
6288
+ })) : createCommentVNode("v-if", true),
6289
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
6290
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
6291
+ ])) : createCommentVNode("v-if", true),
6292
+ unref(count) ? (openBlock(), createElementBlock("span", _hoisted_6$2, [
6293
+ renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
6294
+ createTextVNode(
6295
+ toDisplayString(unref(countFormatted)),
6296
+ 1
6297
+ /* TEXT */
6298
+ )
6299
+ ])
6300
+ ])) : createCommentVNode("v-if", true)
6301
+ ],
6302
+ 512
6303
+ /* NEED_PATCH */
6304
+ ),
6146
6305
  createVNode(unref(HintSlot), {
6147
6306
  id: unref(hasHintId),
6148
6307
  class: "vv-input-text__hint"
@@ -6178,7 +6337,62 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
6178
6337
  ]),
6179
6338
  key: "3"
6180
6339
  } : void 0
6181
- ]), 1032, ["id"])
6340
+ ]), 1032, ["id"]),
6341
+ unref(hasSuggestions) ? (openBlock(), createBlock(_sfc_main$i, {
6342
+ key: 1,
6343
+ ref_key: "dropdownEl",
6344
+ ref: dropdownEl,
6345
+ reference: unref(wrapperEl),
6346
+ "autofocus-first": false,
6347
+ "trigger-width": true
6348
+ }, {
6349
+ items: withCtx(() => [
6350
+ (openBlock(true), createElementBlock(
6351
+ Fragment,
6352
+ null,
6353
+ renderList(unref(filteredSuggestions), (value) => {
6354
+ return openBlock(), createBlock(_sfc_main$g, {
6355
+ key: value,
6356
+ onClick: withModifiers(($event) => onSuggestionSelect(value), ["stop"])
6357
+ }, {
6358
+ default: withCtx(() => [
6359
+ createElementVNode("div", _hoisted_7$2, [
6360
+ renderSlot(_ctx.$slots, "suggestion", normalizeProps(guardReactiveProps({ value })), () => [
6361
+ createTextVNode(
6362
+ toDisplayString(value),
6363
+ 1
6364
+ /* TEXT */
6365
+ )
6366
+ ])
6367
+ ]),
6368
+ unref(suggestions) && unref(hasIconRemoveSuggestion) ? (openBlock(), createElementBlock("button", {
6369
+ key: 0,
6370
+ type: "button",
6371
+ tabindex: "-1",
6372
+ class: "cursor-pointer",
6373
+ title: _ctx.labelRemoveSuggestion,
6374
+ onClick: withModifiers(($event) => onSuggestionRemove(value), ["stop"])
6375
+ }, [
6376
+ createVNode(
6377
+ _sfc_main$u,
6378
+ normalizeProps(guardReactiveProps(unref(hasIconRemoveSuggestion))),
6379
+ null,
6380
+ 16
6381
+ /* FULL_PROPS */
6382
+ )
6383
+ ], 8, _hoisted_8$1)) : createCommentVNode("v-if", true)
6384
+ ]),
6385
+ _: 2
6386
+ /* DYNAMIC */
6387
+ }, 1032, ["onClick"]);
6388
+ }),
6389
+ 128
6390
+ /* KEYED_FRAGMENT */
6391
+ ))
6392
+ ]),
6393
+ _: 3
6394
+ /* FORWARDED */
6395
+ }, 8, ["reference"])) : createCommentVNode("v-if", true)
6182
6396
  ],
6183
6397
  2
6184
6398
  /* CLASS */