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

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 +91 -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 +357 -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 +1 -1
  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 +13 -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 +98 -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,20 @@ 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
956
1009
  );
957
1010
  const localModelValue = computed({
958
1011
  get: () => {
959
1012
  if (props.modelValue !== null && props.modelValue !== void 0) {
960
1013
  return props.modelValue;
961
1014
  }
962
- return storeModelValue.value;
1015
+ return storageModelValue.value;
963
1016
  },
964
1017
  set: (newValue) => {
965
1018
  emit("update:modelValue", newValue);
966
- storeModelValue.value = newValue;
1019
+ storageModelValue.value = newValue;
967
1020
  }
968
1021
  });
969
1022
  const expandedAccordions = computed({
@@ -3400,6 +3453,31 @@ const VvDropdownProps = {
3400
3453
  validator: (value) => Object.values(DropdownRole).includes(value)
3401
3454
  }
3402
3455
  };
3456
+ const VvDropdownItemProps = {
3457
+ focusOnHover: {
3458
+ type: Boolean,
3459
+ default: false
3460
+ }
3461
+ };
3462
+ const VvDropdownOptionProps = {
3463
+ ...DisabledProps,
3464
+ ...SelectedProps,
3465
+ ...UnselectableProps,
3466
+ ...ModifiersProps,
3467
+ deselectHintLabel: {
3468
+ type: String
3469
+ },
3470
+ selectHintLabel: {
3471
+ type: String
3472
+ },
3473
+ selectedHintLabel: {
3474
+ type: String
3475
+ },
3476
+ focusOnHover: {
3477
+ type: Boolean,
3478
+ default: false
3479
+ }
3480
+ };
3403
3481
  function useProvideDropdownTrigger({
3404
3482
  reference,
3405
3483
  id,
@@ -3430,14 +3508,14 @@ function useProvideDropdownTrigger({
3430
3508
  }
3431
3509
  function useProvideDropdownItem({
3432
3510
  role,
3433
- expanded
3511
+ ...others
3434
3512
  }) {
3435
3513
  const itemRole = computed(
3436
3514
  () => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
3437
3515
  );
3438
3516
  provide(INJECTION_KEY_DROPDOWN_ITEM, {
3439
3517
  role: itemRole,
3440
- expanded
3518
+ ...others
3441
3519
  });
3442
3520
  return { itemRole };
3443
3521
  }
@@ -3688,7 +3766,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3688
3766
  });
3689
3767
  bus.on("click", toggle);
3690
3768
  const { role, modifiers } = toRefs(props);
3691
- const { itemRole } = useProvideDropdownItem({ role, expanded });
3692
3769
  const bemCssClasses = useModifiers(
3693
3770
  "vv-dropdown",
3694
3771
  modifiers,
@@ -3757,6 +3834,13 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3757
3834
  }
3758
3835
  });
3759
3836
  };
3837
+ const hovered = useElementHover(floatingEl);
3838
+ const { itemRole } = useProvideDropdownItem({
3839
+ role,
3840
+ expanded,
3841
+ focused,
3842
+ hovered
3843
+ });
3760
3844
  onKeyStroke("Escape", (e) => {
3761
3845
  if (expanded.value) {
3762
3846
  e.preventDefault();
@@ -3882,7 +3966,9 @@ const __default__$d = {
3882
3966
  };
3883
3967
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
3884
3968
  ...__default__$d,
3969
+ props: VvDropdownItemProps,
3885
3970
  setup(__props) {
3971
+ const props = __props;
3886
3972
  const { role, expanded } = useInjectedDropdownItem();
3887
3973
  const element = ref(null);
3888
3974
  useProvideDropdownAction({ expanded });
@@ -3890,7 +3976,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3890
3976
  const { focused } = useFocus(element);
3891
3977
  const { focused: focusedWithin } = useFocusWithin(element);
3892
3978
  watch(hovered, (newValue) => {
3893
- if (newValue) {
3979
+ if (newValue && props.focusOnHover) {
3894
3980
  focused.value = true;
3895
3981
  }
3896
3982
  });
@@ -3917,21 +4003,7 @@ const __default__$c = {
3917
4003
  };
3918
4004
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
3919
4005
  ...__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
- },
4006
+ props: VvDropdownOptionProps,
3935
4007
  setup(__props) {
3936
4008
  const props = __props;
3937
4009
  const { modifiers } = toRefs(props);
@@ -3957,7 +4029,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3957
4029
  class: normalizeClass(unref(bemCssClasses)),
3958
4030
  tabindex: _ctx.disabled ? -1 : 0,
3959
4031
  "aria-selected": _ctx.selected,
3960
- "aria-disabled": _ctx.disabled
4032
+ "aria-disabled": _ctx.disabled,
4033
+ "focus-on-hover": _ctx.focusOnHover
3961
4034
  }, {
3962
4035
  default: withCtx(() => [
3963
4036
  renderSlot(_ctx.$slots, "default"),
@@ -3976,7 +4049,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3976
4049
  ]),
3977
4050
  _: 3
3978
4051
  /* FORWARDED */
3979
- }, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
4052
+ }, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
3980
4053
  };
3981
4054
  }
3982
4055
  });
@@ -4074,7 +4147,7 @@ const _hoisted_4$4 = { class: "vv-select__inner" };
4074
4147
  const _hoisted_5$4 = ["id"];
4075
4148
  const _hoisted_6$4 = ["disabled", "hidden"];
4076
4149
  const _hoisted_7$4 = ["disabled", "value"];
4077
- const _hoisted_8$2 = ["disabled", "label"];
4150
+ const _hoisted_8$3 = ["disabled", "label"];
4078
4151
  const _hoisted_9$2 = ["disabled", "value"];
4079
4152
  const _hoisted_10$1 = {
4080
4153
  key: 1,
@@ -4263,7 +4336,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4263
4336
  128
4264
4337
  /* KEYED_FRAGMENT */
4265
4338
  ))
4266
- ], 8, _hoisted_8$2))
4339
+ ], 8, _hoisted_8$3))
4267
4340
  ],
4268
4341
  64
4269
4342
  /* STABLE_FRAGMENT */
@@ -4343,7 +4416,7 @@ const _hoisted_7$3 = {
4343
4416
  key: 0,
4344
4417
  class: "vv-select__value"
4345
4418
  };
4346
- const _hoisted_8$1 = ["aria-label", "onClick"];
4419
+ const _hoisted_8$2 = ["aria-label", "onClick"];
4347
4420
  const _hoisted_9$1 = {
4348
4421
  key: 1,
4349
4422
  class: "vv-select__input-after"
@@ -4716,7 +4789,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4716
4789
  onClick: withModifiers(($event) => onInput(option), ["stop"])
4717
4790
  }, [
4718
4791
  createVNode(_sfc_main$u, { name: "close" })
4719
- ], 8, _hoisted_8$1)) : createCommentVNode("v-if", true)
4792
+ ], 8, _hoisted_8$2)) : createCommentVNode("v-if", true)
4720
4793
  ]),
4721
4794
  _: 2
4722
4795
  /* DYNAMIC */
@@ -4789,6 +4862,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4789
4862
  }, {
4790
4863
  key: i,
4791
4864
  class: "vv-dropdown-option",
4865
+ "focus-on-hover": "",
4792
4866
  onClickPassive: ($event) => onInput(item)
4793
4867
  }), {
4794
4868
  default: withCtx(() => [
@@ -4824,6 +4898,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4824
4898
  selectedHintLabel: unref(propsDefaults).selectedHintLabel
4825
4899
  }, {
4826
4900
  class: "vv-dropdown-option",
4901
+ "focus-on-hover": "",
4827
4902
  onClickPassive: ($event) => onInput(option)
4828
4903
  }), {
4829
4904
  default: withCtx(() => [
@@ -5258,6 +5333,7 @@ const VvInputTextEvents = [
5258
5333
  ];
5259
5334
  const VvInputTextProps = {
5260
5335
  ...InputTextareaProps,
5336
+ ...StorageProps,
5261
5337
  /**
5262
5338
  * Input value
5263
5339
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
@@ -5326,6 +5402,14 @@ const VvInputTextProps = {
5326
5402
  type: [String, Object],
5327
5403
  default: ACTION_ICONS.clear
5328
5404
  },
5405
+ /**
5406
+ * VvIcon name for remove suggestion button
5407
+ * @see VVIcon
5408
+ */
5409
+ iconRemoveSuggestion: {
5410
+ type: [String, Object],
5411
+ default: ACTION_ICONS.remove
5412
+ },
5329
5413
  /**
5330
5414
  * Label for step up button
5331
5415
  */
@@ -5361,6 +5445,13 @@ const VvInputTextProps = {
5361
5445
  type: String,
5362
5446
  default: "Clear"
5363
5447
  },
5448
+ /**
5449
+ * Label for remove suggestion button
5450
+ */
5451
+ labelRemoveSuggestion: {
5452
+ type: String,
5453
+ default: "Remove suggestion"
5454
+ },
5364
5455
  /**
5365
5456
  * iMask options
5366
5457
  * @see https://imask.js.org/guide.html
@@ -5402,6 +5493,13 @@ const VvInputTextProps = {
5402
5493
  selectOnFocus: {
5403
5494
  type: Boolean,
5404
5495
  default: false
5496
+ },
5497
+ /**
5498
+ * Maximum number of suggestions
5499
+ */
5500
+ maxSuggestions: {
5501
+ type: Number,
5502
+ default: 5
5405
5503
  }
5406
5504
  };
5407
5505
  const VvInputPasswordAction = defineComponent({
@@ -5696,24 +5794,25 @@ function useTextCount(text, options) {
5696
5794
  };
5697
5795
  }
5698
5796
  const _hoisted_1$6 = ["for"];
5699
- const _hoisted_2$4 = { class: "vv-input-text__wrapper" };
5700
- const _hoisted_3$2 = {
5797
+ const _hoisted_2$4 = {
5701
5798
  key: 0,
5702
5799
  class: "vv-input-text__input-before"
5703
5800
  };
5704
- const _hoisted_4$2 = ["id"];
5705
- const _hoisted_5$2 = {
5801
+ const _hoisted_3$2 = ["id"];
5802
+ const _hoisted_4$2 = {
5706
5803
  key: 1,
5707
5804
  class: "vv-input-text__unit"
5708
5805
  };
5709
- const _hoisted_6$2 = {
5806
+ const _hoisted_5$2 = {
5710
5807
  key: 5,
5711
5808
  class: "vv-input-text__input-after"
5712
5809
  };
5713
- const _hoisted_7$2 = {
5810
+ const _hoisted_6$2 = {
5714
5811
  key: 6,
5715
5812
  class: "vv-input-text__limit"
5716
5813
  };
5814
+ const _hoisted_7$2 = { class: "flex-1" };
5815
+ const _hoisted_8$1 = ["title", "onClick"];
5717
5816
  const __default__$6 = {
5718
5817
  name: "VvInputText"
5719
5818
  };
@@ -5734,6 +5833,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5734
5833
  id,
5735
5834
  icon,
5736
5835
  iconPosition,
5836
+ iconRemoveSuggestion,
5737
5837
  label,
5738
5838
  modelValue,
5739
5839
  count,
@@ -5745,7 +5845,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5745
5845
  minlength,
5746
5846
  type,
5747
5847
  iMask,
5748
- step
5848
+ step,
5849
+ storageKey,
5850
+ storageType
5749
5851
  } = toRefs(props);
5750
5852
  const hasId = useUniqueId(id);
5751
5853
  const hasHintId = computed(() => `${hasId.value}-hint`);
@@ -5849,6 +5951,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5849
5951
  );
5850
5952
  const inputEl = el;
5851
5953
  const innerEl = ref();
5954
+ const wrapperEl = ref();
5955
+ const dropdownEl = ref();
5852
5956
  __expose({ $inner: innerEl });
5853
5957
  const localModelValue = useDebouncedInput(
5854
5958
  modelValue,
@@ -5860,9 +5964,27 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5860
5964
  () => focused.value && !props.disabled && !props.readonly
5861
5965
  );
5862
5966
  watch(isFocused, (newValue) => {
5967
+ var _a;
5863
5968
  if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
5864
5969
  inputEl.value.select();
5865
5970
  }
5971
+ if (newValue) {
5972
+ (_a = dropdownEl.value) == null ? void 0 : _a.show();
5973
+ return;
5974
+ }
5975
+ setTimeout(() => {
5976
+ if (isDirty.value && suggestions.value) {
5977
+ const suggestionsLimit = props.maxSuggestions - 1;
5978
+ if (suggestions.value.size > suggestionsLimit && !suggestions.value.has(localModelValue.value)) {
5979
+ suggestions.value = new Set(
5980
+ [...suggestions.value].slice(
5981
+ suggestions.value.size - suggestionsLimit
5982
+ )
5983
+ );
5984
+ }
5985
+ suggestions.value.add(localModelValue.value);
5986
+ }
5987
+ }, 300);
5866
5988
  });
5867
5989
  const isVisible = useElementVisibility(inputEl);
5868
5990
  watch(isVisible, (newValue) => {
@@ -5921,6 +6043,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5921
6043
  }
5922
6044
  return void 0;
5923
6045
  });
6046
+ const { hasIcon: hasIconRemoveSuggestion } = useComponentIcon(iconRemoveSuggestion);
5924
6047
  const { formatted: countFormatted } = useTextCount(localModelValue, {
5925
6048
  mode: count.value,
5926
6049
  upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
@@ -5940,6 +6063,31 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5940
6063
  }
5941
6064
  return void 0;
5942
6065
  });
6066
+ const suggestions = usePersistence(
6067
+ storageKey,
6068
+ storageType,
6069
+ /* @__PURE__ */ new Set()
6070
+ );
6071
+ const filteredSuggestions = computed(() => {
6072
+ if (!suggestions.value) {
6073
+ return [];
6074
+ }
6075
+ return [...suggestions.value].filter(
6076
+ (suggestion) => isEmpty(localModelValue.value) || `${suggestion}`.toLowerCase().includes(`${localModelValue.value}`.toLowerCase()) && suggestion !== localModelValue.value
6077
+ );
6078
+ });
6079
+ const hasSuggestions = computed(
6080
+ () => (storageKey == null ? void 0 : storageKey.value) && suggestions.value && suggestions.value.size > 0
6081
+ );
6082
+ const onSuggestionSelect = (suggestion) => {
6083
+ var _a;
6084
+ localModelValue.value = suggestion;
6085
+ (_a = dropdownEl.value) == null ? void 0 : _a.hide();
6086
+ };
6087
+ const onSuggestionRemove = (suggestion) => {
6088
+ var _a;
6089
+ (_a = suggestions.value) == null ? void 0 : _a.delete(suggestion);
6090
+ };
5943
6091
  const { modifiers } = toRefs(props);
5944
6092
  const bemCssClasses = useModifiers(
5945
6093
  "vv-input-text",
@@ -6070,79 +6218,89 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
6070
6218
  for: unref(hasId),
6071
6219
  class: "vv-input-text__label"
6072
6220
  }, 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
- ]),
6221
+ createElementVNode(
6222
+ "div",
6223
+ {
6224
+ ref_key: "wrapperEl",
6225
+ ref: wrapperEl,
6226
+ class: "vv-input-text__wrapper"
6227
+ },
6228
+ [
6229
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
6230
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
6231
+ ])) : createCommentVNode("v-if", true),
6232
+ createElementVNode(
6233
+ "div",
6234
+ {
6235
+ ref_key: "innerEl",
6236
+ ref: innerEl,
6237
+ class: "vv-input-text__inner",
6238
+ onClick: withModifiers(onClickInner, ["stop"])
6239
+ },
6240
+ [
6241
+ unref(hasIconBefore) ? (openBlock(), createBlock(
6242
+ _sfc_main$u,
6243
+ mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
6244
+ null,
6245
+ 16
6246
+ /* FULL_PROPS */
6247
+ )) : createCommentVNode("v-if", true),
6248
+ createElementVNode("input", mergeProps({
6249
+ id: unref(hasId),
6250
+ ref_key: "inputEl",
6251
+ ref: inputEl
6252
+ }, unref(hasAttrs), {
6253
+ style: unref(hasStyle),
6254
+ onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
6255
+ onKeydown: onKeyDown,
6256
+ onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
6257
+ }), null, 16, _hoisted_3$2),
6258
+ (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
6259
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
6260
+ createTextVNode(
6261
+ toDisplayString(_ctx.unit),
6262
+ 1
6263
+ /* TEXT */
6264
+ )
6265
+ ])
6266
+ ])) : createCommentVNode("v-if", true)
6267
+ ],
6268
+ 512
6269
+ /* NEED_PATCH */
6270
+ ),
6271
+ unref(iconAfter) ? (openBlock(), createBlock(
6272
+ _sfc_main$u,
6273
+ mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
6274
+ null,
6275
+ 16
6276
+ /* FULL_PROPS */
6277
+ )) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
6278
+ key: 2,
6279
+ onTogglePassword
6280
+ })) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
6281
+ key: 3,
6282
+ onStepUp,
6283
+ onStepDown
6284
+ })) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
6285
+ key: 4,
6286
+ onClear
6287
+ })) : createCommentVNode("v-if", true),
6288
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
6289
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
6290
+ ])) : createCommentVNode("v-if", true),
6291
+ unref(count) ? (openBlock(), createElementBlock("span", _hoisted_6$2, [
6292
+ renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
6293
+ createTextVNode(
6294
+ toDisplayString(unref(countFormatted)),
6295
+ 1
6296
+ /* TEXT */
6297
+ )
6298
+ ])
6299
+ ])) : createCommentVNode("v-if", true)
6300
+ ],
6301
+ 512
6302
+ /* NEED_PATCH */
6303
+ ),
6146
6304
  createVNode(unref(HintSlot), {
6147
6305
  id: unref(hasHintId),
6148
6306
  class: "vv-input-text__hint"
@@ -6178,7 +6336,62 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
6178
6336
  ]),
6179
6337
  key: "3"
6180
6338
  } : void 0
6181
- ]), 1032, ["id"])
6339
+ ]), 1032, ["id"]),
6340
+ unref(hasSuggestions) ? (openBlock(), createBlock(_sfc_main$i, {
6341
+ key: 1,
6342
+ ref_key: "dropdownEl",
6343
+ ref: dropdownEl,
6344
+ reference: unref(wrapperEl),
6345
+ "autofocus-first": false,
6346
+ "trigger-width": true
6347
+ }, {
6348
+ items: withCtx(() => [
6349
+ (openBlock(true), createElementBlock(
6350
+ Fragment,
6351
+ null,
6352
+ renderList(unref(filteredSuggestions), (value) => {
6353
+ return openBlock(), createBlock(_sfc_main$g, {
6354
+ key: value,
6355
+ onClick: withModifiers(($event) => onSuggestionSelect(value), ["stop"])
6356
+ }, {
6357
+ default: withCtx(() => [
6358
+ createElementVNode("div", _hoisted_7$2, [
6359
+ renderSlot(_ctx.$slots, "suggestion", normalizeProps(guardReactiveProps({ value })), () => [
6360
+ createTextVNode(
6361
+ toDisplayString(value),
6362
+ 1
6363
+ /* TEXT */
6364
+ )
6365
+ ])
6366
+ ]),
6367
+ unref(suggestions) && unref(hasIconRemoveSuggestion) ? (openBlock(), createElementBlock("button", {
6368
+ key: 0,
6369
+ type: "button",
6370
+ tabindex: "-1",
6371
+ class: "cursor-pointer",
6372
+ title: _ctx.labelRemoveSuggestion,
6373
+ onClick: withModifiers(($event) => onSuggestionRemove(value), ["stop"])
6374
+ }, [
6375
+ createVNode(
6376
+ _sfc_main$u,
6377
+ normalizeProps(guardReactiveProps(unref(hasIconRemoveSuggestion))),
6378
+ null,
6379
+ 16
6380
+ /* FULL_PROPS */
6381
+ )
6382
+ ], 8, _hoisted_8$1)) : createCommentVNode("v-if", true)
6383
+ ]),
6384
+ _: 2
6385
+ /* DYNAMIC */
6386
+ }, 1032, ["onClick"]);
6387
+ }),
6388
+ 128
6389
+ /* KEYED_FRAGMENT */
6390
+ ))
6391
+ ]),
6392
+ _: 3
6393
+ /* FORWARDED */
6394
+ }, 8, ["reference"])) : createCommentVNode("v-if", true)
6182
6395
  ],
6183
6396
  2
6184
6397
  /* CLASS */