@volverjs/ui-vue 0.0.10-beta.24 → 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 (121) 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 +169 -89
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +31 -5
  7. package/dist/components/VvAccordionGroup/index.d.ts +7 -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 +435 -195
  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 +51 -9
  98. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +327 -64
  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 +86 -69
  106. package/src/components/VvAccordionGroup/index.ts +3 -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/AccordionGroup/AccordionGroup.settings.ts +2 -2
  119. package/src/stories/AccordionGroup/AccordionGroup.test.ts +5 -5
  120. package/src/stories/Button/Button.settings.ts +1 -4
  121. package/src/types/nav.ts +1 -3
@@ -1,8 +1,10 @@
1
- import { unref, computed, isRef, defineComponent, h, inject, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, onMounted, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withModifiers, createTextVNode, createVNode, createSlots, withCtx } from "vue";
1
+ import { unref, computed, isRef, defineComponent, h, inject, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, provide, Fragment, useAttrs, onMounted, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, useSlots, withModifiers, createSlots, renderList } from "vue";
2
2
  import { useIMask } from "vue-imask";
3
3
  import { iconExists, Icon, addIcon } from "@iconify/vue";
4
+ import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
4
5
  import { uid } from "uid";
5
- import { useFocus, useElementVisibility } from "@vueuse/core";
6
+ import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useStorage, useElementVisibility } from "@vueuse/core";
7
+ import mitt from "mitt";
6
8
  function isEmpty(value) {
7
9
  return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
8
10
  }
@@ -143,6 +145,11 @@ const VvIconPropsDefaults = {
143
145
  prefix: "normal"
144
146
  /* normal */
145
147
  };
148
+ var StorageType = /* @__PURE__ */ ((StorageType2) => {
149
+ StorageType2["local"] = "local";
150
+ StorageType2["session"] = "session";
151
+ return StorageType2;
152
+ })(StorageType || {});
146
153
  var Strategy = /* @__PURE__ */ ((Strategy2) => {
147
154
  Strategy2["absolute"] = "absolute";
148
155
  Strategy2["fixed"] = "fixed";
@@ -184,14 +191,32 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
184
191
  ActionTag2["button"] = "button";
185
192
  return ActionTag2;
186
193
  })(ActionTag || {});
187
- var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
188
- AnchorTarget2["_blank"] = "_blank";
189
- AnchorTarget2["_self"] = "_self";
190
- AnchorTarget2["_parent"] = "_parent";
191
- AnchorTarget2["_top"] = "_top";
192
- return AnchorTarget2;
193
- })(AnchorTarget || {});
194
+ var ActionRoles = /* @__PURE__ */ ((ActionRoles2) => {
195
+ ActionRoles2["button"] = "button";
196
+ ActionRoles2["link"] = "link";
197
+ ActionRoles2["menuitem"] = "menuitem";
198
+ return ActionRoles2;
199
+ })(ActionRoles || {});
200
+ var DropdownRole = /* @__PURE__ */ ((DropdownRole2) => {
201
+ DropdownRole2["listbox"] = "listbox";
202
+ DropdownRole2["menu"] = "menu";
203
+ return DropdownRole2;
204
+ })(DropdownRole || {});
205
+ var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
206
+ DropdownItemRole2["option"] = "option";
207
+ DropdownItemRole2["presentation"] = "presentation";
208
+ return DropdownItemRole2;
209
+ })(DropdownItemRole || {});
194
210
  const INJECTION_KEY_VOLVER = Symbol.for("volver");
211
+ const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
212
+ "dropdownTrigger"
213
+ );
214
+ const INJECTION_KEY_DROPDOWN_ITEM = Symbol.for(
215
+ "dropdownItem"
216
+ );
217
+ const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
218
+ "dropdownAction"
219
+ );
195
220
  function useVolver() {
196
221
  return inject(INJECTION_KEY_VOLVER);
197
222
  }
@@ -218,11 +243,11 @@ function useModifiers(prefix, modifiers, others) {
218
243
  return toReturn;
219
244
  });
220
245
  }
221
- const __default__$1 = {
246
+ const __default__$4 = {
222
247
  name: "VvIcon"
223
248
  };
224
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
225
- ...__default__$1,
249
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
250
+ ...__default__$4,
226
251
  props: /* @__PURE__ */ mergeDefaults({
227
252
  name: {},
228
253
  color: {},
@@ -346,11 +371,7 @@ const LinkProps = {
346
371
  /**
347
372
  * Anchor target
348
373
  */
349
- target: {
350
- type: String,
351
- default: void 0,
352
- validator: (value) => Object.values(AnchorTarget).includes(value)
353
- },
374
+ target: String,
354
375
  /**
355
376
  * Anchor rel
356
377
  */
@@ -407,6 +428,15 @@ const DisabledProps = {
407
428
  default: false
408
429
  }
409
430
  };
431
+ const SelectedProps = {
432
+ /**
433
+ * Whether the item is selected
434
+ */
435
+ selected: {
436
+ type: Boolean,
437
+ default: false
438
+ }
439
+ };
410
440
  const ActiveProps = {
411
441
  /**
412
442
  * Whether the item is active
@@ -517,6 +547,12 @@ const FloatingLabelProps = {
517
547
  default: false
518
548
  }
519
549
  };
550
+ const UnselectableProps = {
551
+ /**
552
+ * If true the input will be unselectable
553
+ */
554
+ unselectable: { type: Boolean, default: true }
555
+ };
520
556
  const IdProps = {
521
557
  /**
522
558
  * Global attribute id
@@ -524,7 +560,7 @@ const IdProps = {
524
560
  */
525
561
  id: [String, Number]
526
562
  };
527
- ({
563
+ const DropdownProps = {
528
564
  /**
529
565
  * Dropdown placement
530
566
  */
@@ -617,7 +653,7 @@ const IdProps = {
617
653
  type: Boolean,
618
654
  default: false
619
655
  }
620
- });
656
+ };
621
657
  const IdNameProps = {
622
658
  ...IdProps,
623
659
  /**
@@ -726,6 +762,14 @@ const InputTextareaProps = {
726
762
  default: ActionTag.button
727
763
  }
728
764
  });
765
+ const StorageProps = {
766
+ storageType: {
767
+ type: String,
768
+ default: StorageType.local,
769
+ validator: (value) => Object.values(StorageType).includes(value)
770
+ },
771
+ storageKey: String
772
+ };
729
773
  const INPUT_TYPES = {
730
774
  TEXT: "text",
731
775
  PASSWORD: "password",
@@ -760,6 +804,7 @@ const VvInputTextEvents = [
760
804
  ];
761
805
  const VvInputTextProps = {
762
806
  ...InputTextareaProps,
807
+ ...StorageProps,
763
808
  /**
764
809
  * Input value
765
810
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
@@ -828,6 +873,14 @@ const VvInputTextProps = {
828
873
  type: [String, Object],
829
874
  default: ACTION_ICONS.clear
830
875
  },
876
+ /**
877
+ * VvIcon name for remove suggestion button
878
+ * @see VVIcon
879
+ */
880
+ iconRemoveSuggestion: {
881
+ type: [String, Object],
882
+ default: ACTION_ICONS.remove
883
+ },
831
884
  /**
832
885
  * Label for step up button
833
886
  */
@@ -863,6 +916,13 @@ const VvInputTextProps = {
863
916
  type: String,
864
917
  default: "Clear"
865
918
  },
919
+ /**
920
+ * Label for remove suggestion button
921
+ */
922
+ labelRemoveSuggestion: {
923
+ type: String,
924
+ default: "Remove suggestion"
925
+ },
866
926
  /**
867
927
  * iMask options
868
928
  * @see https://imask.js.org/guide.html
@@ -904,6 +964,13 @@ const VvInputTextProps = {
904
964
  selectOnFocus: {
905
965
  type: Boolean,
906
966
  default: false
967
+ },
968
+ /**
969
+ * Maximum number of suggestions
970
+ */
971
+ maxSuggestions: {
972
+ type: Number,
973
+ default: 5
907
974
  }
908
975
  };
909
976
  function useComponentIcon(icon, iconPosition) {
@@ -943,7 +1010,7 @@ function useComponentIcon(icon, iconPosition) {
943
1010
  }
944
1011
  const VvInputPasswordAction = defineComponent({
945
1012
  components: {
946
- VvIcon: _sfc_main$1
1013
+ VvIcon: _sfc_main$4
947
1014
  },
948
1015
  props: {
949
1016
  disabled: {
@@ -989,7 +1056,7 @@ const VvInputPasswordAction = defineComponent({
989
1056
  };
990
1057
  },
991
1058
  render() {
992
- const icon = this.hasIcon ? h(_sfc_main$1, {
1059
+ const icon = this.hasIcon ? h(_sfc_main$4, {
993
1060
  ...this.hasIcon,
994
1061
  class: "vv-input-text__icon"
995
1062
  }) : void 0;
@@ -1008,7 +1075,7 @@ const VvInputPasswordAction = defineComponent({
1008
1075
  });
1009
1076
  const VvInputStepAction = defineComponent({
1010
1077
  components: {
1011
- VvIcon: _sfc_main$1
1078
+ VvIcon: _sfc_main$4
1012
1079
  },
1013
1080
  props: {
1014
1081
  disabled: {
@@ -1053,7 +1120,7 @@ const VvInputStepAction = defineComponent({
1053
1120
  });
1054
1121
  const VvInputClearAction = defineComponent({
1055
1122
  components: {
1056
- VvIcon: _sfc_main$1
1123
+ VvIcon: _sfc_main$4
1057
1124
  },
1058
1125
  props: {
1059
1126
  disabled: {
@@ -1084,7 +1151,7 @@ const VvInputClearAction = defineComponent({
1084
1151
  };
1085
1152
  },
1086
1153
  render() {
1087
- const icon = this.hasIcon ? h(_sfc_main$1, {
1154
+ const icon = this.hasIcon ? h(_sfc_main$4, {
1088
1155
  ...this.hasIcon,
1089
1156
  class: "vv-input-text__icon"
1090
1157
  }) : void 0;
@@ -1105,7 +1172,7 @@ function VvInputTextActionsFactory(type, parentProps) {
1105
1172
  return {
1106
1173
  name: "VvInputTextActions",
1107
1174
  components: {
1108
- VvIcon: _sfc_main$1,
1175
+ VvIcon: _sfc_main$4,
1109
1176
  VvInputPasswordAction,
1110
1177
  VvInputStepAction,
1111
1178
  VvInputClearAction
@@ -1178,6 +1245,637 @@ function VvInputTextActionsFactory(type, parentProps) {
1178
1245
  }
1179
1246
  };
1180
1247
  }
1248
+ const VvDropdownProps = {
1249
+ ...IdProps,
1250
+ ...DropdownProps,
1251
+ ...ModifiersProps,
1252
+ /**
1253
+ * Show / hide dropdown programmatically
1254
+ */
1255
+ modelValue: {
1256
+ type: Boolean,
1257
+ default: void 0
1258
+ },
1259
+ /**
1260
+ * Dropdown trigger element
1261
+ */
1262
+ reference: {
1263
+ type: Object,
1264
+ default: null
1265
+ },
1266
+ /**
1267
+ * Dropdown role
1268
+ */
1269
+ role: {
1270
+ type: String,
1271
+ default: DropdownRole.menu,
1272
+ validator: (value) => Object.values(DropdownRole).includes(value)
1273
+ }
1274
+ };
1275
+ const VvDropdownItemProps = {
1276
+ focusOnHover: {
1277
+ type: Boolean,
1278
+ default: false
1279
+ }
1280
+ };
1281
+ const VvDropdownOptionProps = {
1282
+ ...DisabledProps,
1283
+ ...SelectedProps,
1284
+ ...UnselectableProps,
1285
+ ...ModifiersProps,
1286
+ deselectHintLabel: {
1287
+ type: String
1288
+ },
1289
+ selectHintLabel: {
1290
+ type: String
1291
+ },
1292
+ selectedHintLabel: {
1293
+ type: String
1294
+ },
1295
+ focusOnHover: {
1296
+ type: Boolean,
1297
+ default: false
1298
+ }
1299
+ };
1300
+ const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
1301
+ function useProvideDropdownTrigger({
1302
+ reference,
1303
+ id,
1304
+ expanded,
1305
+ aria
1306
+ }) {
1307
+ const bus = mitt();
1308
+ const component = defineComponent({
1309
+ name: "VvDropdownTriggerProvider",
1310
+ setup() {
1311
+ provide(INJECTION_KEY_DROPDOWN_TRIGGER, {
1312
+ reference,
1313
+ id,
1314
+ expanded,
1315
+ aria,
1316
+ bus
1317
+ });
1318
+ },
1319
+ render() {
1320
+ var _a, _b;
1321
+ return h(Fragment, {}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
1322
+ }
1323
+ });
1324
+ return {
1325
+ bus,
1326
+ component
1327
+ };
1328
+ }
1329
+ function useProvideDropdownItem({
1330
+ role,
1331
+ ...others
1332
+ }) {
1333
+ const itemRole = computed(
1334
+ () => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
1335
+ );
1336
+ provide(INJECTION_KEY_DROPDOWN_ITEM, {
1337
+ role: itemRole,
1338
+ ...others
1339
+ });
1340
+ return { itemRole };
1341
+ }
1342
+ function useProvideDropdownAction({
1343
+ expanded
1344
+ }) {
1345
+ provide(INJECTION_KEY_DROPDOWN_ACTION, {
1346
+ role: ref(ActionRoles.menuitem),
1347
+ expanded
1348
+ });
1349
+ }
1350
+ const _hoisted_1$2 = ["id", "tabindex", "role", "aria-labelledby"];
1351
+ const __default__$3 = {
1352
+ name: "VvDropdown",
1353
+ inheritAttrs: false
1354
+ };
1355
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1356
+ ...__default__$3,
1357
+ props: VvDropdownProps,
1358
+ emits: [
1359
+ "update:modelValue",
1360
+ "beforeExpand",
1361
+ "beforeCollapse",
1362
+ "afterExpand",
1363
+ "afterCollapse",
1364
+ "before-enter",
1365
+ "after-leave",
1366
+ "enter",
1367
+ "after-enter",
1368
+ "enter-cancelled",
1369
+ "before-leave",
1370
+ "leave",
1371
+ "leave-cancelled"
1372
+ ],
1373
+ setup(__props, { expose: __expose, emit: __emit }) {
1374
+ const props = __props;
1375
+ const emit = __emit;
1376
+ const { id } = toRefs(props);
1377
+ const hasId = useUniqueId(id);
1378
+ const attrs = useAttrs();
1379
+ const maxWidth = ref("auto");
1380
+ const maxHeight = ref("auto");
1381
+ const localReferenceEl = ref(null);
1382
+ const floatingEl = ref();
1383
+ const arrowEl = ref(null);
1384
+ const listEl = ref(null);
1385
+ const referenceEl = computed({
1386
+ get: () => props.reference ?? localReferenceEl.value,
1387
+ set: (newValue) => {
1388
+ localReferenceEl.value = newValue;
1389
+ }
1390
+ });
1391
+ const hasCustomPosition = ref(false);
1392
+ onMounted(() => {
1393
+ useMutationObserver(
1394
+ floatingEl.value,
1395
+ () => {
1396
+ var _a;
1397
+ hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
1398
+ },
1399
+ {
1400
+ attributeFilter: ["style"],
1401
+ window
1402
+ }
1403
+ );
1404
+ });
1405
+ const middleware = computed(() => {
1406
+ const toReturn = [];
1407
+ if (props.autoPlacement) {
1408
+ if (typeof props.autoPlacement === "boolean") {
1409
+ toReturn.push(autoPlacement());
1410
+ } else {
1411
+ toReturn.push(
1412
+ autoPlacement(props.autoPlacement)
1413
+ );
1414
+ }
1415
+ } else if (props.flip) {
1416
+ if (typeof props.flip === "boolean") {
1417
+ toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
1418
+ } else {
1419
+ toReturn.push(flip(props.flip));
1420
+ }
1421
+ }
1422
+ if (props.shift) {
1423
+ if (typeof props.shift === "boolean") {
1424
+ toReturn.push(shift());
1425
+ } else {
1426
+ toReturn.push(shift(props.shift));
1427
+ }
1428
+ }
1429
+ if (props.size) {
1430
+ const apply = ({
1431
+ availableWidth,
1432
+ availableHeight
1433
+ }) => {
1434
+ maxWidth.value = `${availableWidth}px`;
1435
+ maxHeight.value = `${availableHeight}px`;
1436
+ };
1437
+ if (typeof props.size === "boolean") {
1438
+ toReturn.push(
1439
+ size({
1440
+ apply
1441
+ })
1442
+ );
1443
+ } else {
1444
+ toReturn.push(
1445
+ size({
1446
+ ...props.size,
1447
+ apply
1448
+ })
1449
+ );
1450
+ }
1451
+ }
1452
+ if (props.offset) {
1453
+ toReturn.push(offset(Number(props.offset)));
1454
+ if (["string", "number"].includes(typeof props.offset)) {
1455
+ toReturn.push(offset(Number(props.offset)));
1456
+ } else {
1457
+ toReturn.push(offset(props.offset));
1458
+ }
1459
+ }
1460
+ if (props.arrow) {
1461
+ toReturn.push(
1462
+ arrow({
1463
+ element: arrowEl
1464
+ })
1465
+ );
1466
+ }
1467
+ return toReturn;
1468
+ });
1469
+ const { x, y, middlewareData, placement, strategy } = useFloating(
1470
+ referenceEl,
1471
+ floatingEl,
1472
+ {
1473
+ whileElementsMounted: (...args) => {
1474
+ return autoUpdate(...args, {
1475
+ animationFrame: props.strategy === Strategy.fixed
1476
+ });
1477
+ },
1478
+ placement: computed(() => props.placement),
1479
+ strategy: computed(() => props.strategy),
1480
+ middleware
1481
+ }
1482
+ );
1483
+ const dropdownPlacement = computed(() => {
1484
+ var _a;
1485
+ if (hasCustomPosition.value) {
1486
+ return void 0;
1487
+ }
1488
+ const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
1489
+ return {
1490
+ position: strategy.value,
1491
+ top: `${y.value ?? 0}px`,
1492
+ left: `${x.value ?? 0}px`,
1493
+ maxWidth: width ? void 0 : maxWidth.value,
1494
+ maxHeight: maxHeight.value,
1495
+ width
1496
+ };
1497
+ });
1498
+ const side = computed(
1499
+ () => placement.value.split("-")[0]
1500
+ );
1501
+ const arrowPlacement = computed(() => {
1502
+ var _a, _b, _c, _d, _e;
1503
+ if (hasCustomPosition.value) {
1504
+ return void 0;
1505
+ }
1506
+ const staticSide = {
1507
+ [Side.top]: Side.bottom,
1508
+ [Side.right]: Side.left,
1509
+ [Side.bottom]: Side.top,
1510
+ [Side.left]: Side.right
1511
+ }[side.value];
1512
+ return {
1513
+ left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
1514
+ top: ((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) !== void 0 ? `${(_d = middlewareData.value.arrow) == null ? void 0 : _d.y}px` : void 0,
1515
+ [staticSide]: `${-(((_e = arrowEl.value) == null ? void 0 : _e.offsetWidth) ?? 0) / 2}px`
1516
+ };
1517
+ });
1518
+ const modelValue = useVModel(props, "modelValue", emit);
1519
+ const localModelValue = ref(false);
1520
+ const expanded = computed({
1521
+ get: () => modelValue.value ?? localModelValue.value,
1522
+ set: (newValue) => {
1523
+ if (modelValue.value === void 0) {
1524
+ localModelValue.value = newValue;
1525
+ return;
1526
+ }
1527
+ modelValue.value = newValue;
1528
+ }
1529
+ });
1530
+ const show = () => {
1531
+ expanded.value = true;
1532
+ };
1533
+ const hide = () => {
1534
+ expanded.value = false;
1535
+ };
1536
+ const toggle = () => {
1537
+ expanded.value = !expanded.value;
1538
+ };
1539
+ const init = (el) => {
1540
+ referenceEl.value = el;
1541
+ };
1542
+ __expose({
1543
+ toggle,
1544
+ show,
1545
+ hide,
1546
+ init,
1547
+ customPosition: hasCustomPosition
1548
+ });
1549
+ watch(expanded, (newValue) => {
1550
+ if (newValue && props.autofocusFirst) {
1551
+ nextTick(() => {
1552
+ const focusableElements = getKeyboardFocusableElements(
1553
+ floatingEl.value
1554
+ );
1555
+ if (focusableElements.length > 0) {
1556
+ focusableElements[0].focus({
1557
+ preventScroll: true
1558
+ });
1559
+ }
1560
+ });
1561
+ }
1562
+ });
1563
+ onClickOutside(
1564
+ floatingEl,
1565
+ () => {
1566
+ if (!props.keepOpen && expanded.value) {
1567
+ expanded.value = false;
1568
+ }
1569
+ },
1570
+ { ignore: [referenceEl] }
1571
+ );
1572
+ const hasAriaLabelledby = computed(() => {
1573
+ var _a, _b;
1574
+ return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
1575
+ });
1576
+ const referenceAria = computed(() => ({
1577
+ "aria-controls": hasId.value,
1578
+ "aria-haspopup": true,
1579
+ "aria-expanded": expanded.value
1580
+ }));
1581
+ const { component: VvDropdownTriggerProvider, bus } = useProvideDropdownTrigger({
1582
+ reference: referenceEl,
1583
+ id: hasId,
1584
+ expanded,
1585
+ aria: referenceAria
1586
+ });
1587
+ bus.on("click", toggle);
1588
+ const { role, modifiers } = toRefs(props);
1589
+ const bemCssClasses = useModifiers(
1590
+ "vv-dropdown",
1591
+ modifiers,
1592
+ computed(() => ({
1593
+ arrow: props.arrow
1594
+ }))
1595
+ );
1596
+ const { focused } = useFocusWithin(floatingEl);
1597
+ function getKeyboardFocusableElements(element) {
1598
+ if (!element) {
1599
+ return [];
1600
+ }
1601
+ return [
1602
+ ...element.querySelectorAll(
1603
+ 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
1604
+ )
1605
+ ].filter(
1606
+ (el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
1607
+ );
1608
+ }
1609
+ const focusNext = () => {
1610
+ nextTick(() => {
1611
+ if (focused.value) {
1612
+ const focusableElements = getKeyboardFocusableElements(
1613
+ floatingEl.value
1614
+ );
1615
+ if (focusableElements.length === 0 || !document.activeElement) {
1616
+ return;
1617
+ }
1618
+ const activeElementIndex = focusableElements.indexOf(
1619
+ document.activeElement
1620
+ );
1621
+ if (activeElementIndex < focusableElements.length - 1) {
1622
+ focusableElements[activeElementIndex + 1].focus({
1623
+ preventScroll: true
1624
+ });
1625
+ } else {
1626
+ focusableElements[0].focus({
1627
+ preventScroll: true
1628
+ });
1629
+ }
1630
+ }
1631
+ });
1632
+ };
1633
+ const focusPrev = () => {
1634
+ nextTick(() => {
1635
+ if (focused.value) {
1636
+ const focusableElements = getKeyboardFocusableElements(
1637
+ floatingEl.value
1638
+ );
1639
+ if (focusableElements.length === 0 || !document.activeElement) {
1640
+ return;
1641
+ }
1642
+ const activeElementIndex = focusableElements.indexOf(
1643
+ document.activeElement
1644
+ );
1645
+ if (activeElementIndex > 0) {
1646
+ focusableElements[activeElementIndex - 1].focus({
1647
+ preventScroll: true
1648
+ });
1649
+ } else {
1650
+ focusableElements[focusableElements.length - 1].focus({
1651
+ preventScroll: true
1652
+ });
1653
+ }
1654
+ }
1655
+ });
1656
+ };
1657
+ const hovered = useElementHover(floatingEl);
1658
+ const { itemRole } = useProvideDropdownItem({
1659
+ role,
1660
+ expanded,
1661
+ focused,
1662
+ hovered
1663
+ });
1664
+ onKeyStroke("Escape", (e) => {
1665
+ if (expanded.value) {
1666
+ e.preventDefault();
1667
+ hide();
1668
+ }
1669
+ });
1670
+ onKeyStroke("ArrowDown", (e) => {
1671
+ if (expanded.value && focused.value) {
1672
+ e.preventDefault();
1673
+ focusNext();
1674
+ }
1675
+ });
1676
+ onKeyStroke("ArrowUp", (e) => {
1677
+ if (expanded.value && focused.value) {
1678
+ e.preventDefault();
1679
+ focusPrev();
1680
+ }
1681
+ });
1682
+ onKeyStroke([" ", "Enter"], (e) => {
1683
+ const htmlEl = e.target;
1684
+ if (expanded.value && focused.value && htmlEl) {
1685
+ htmlEl == null ? void 0 : htmlEl.click();
1686
+ }
1687
+ });
1688
+ const dropdownTransitionHandlers = {
1689
+ "before-enter": () => {
1690
+ emit(expanded.value ? "beforeExpand" : "beforeCollapse");
1691
+ emit("before-enter");
1692
+ },
1693
+ "after-leave": () => {
1694
+ emit(expanded.value ? "afterExpand" : "afterCollapse");
1695
+ emit("after-leave");
1696
+ },
1697
+ enter: () => {
1698
+ emit("enter");
1699
+ },
1700
+ "after-enter": () => {
1701
+ emit("after-enter");
1702
+ },
1703
+ "enter-cancelled": () => {
1704
+ emit("enter-cancelled");
1705
+ },
1706
+ "before-leave": () => {
1707
+ emit("before-leave");
1708
+ },
1709
+ leave: () => {
1710
+ emit("leave");
1711
+ },
1712
+ "leave-cancelled": () => {
1713
+ emit("leave-cancelled");
1714
+ }
1715
+ };
1716
+ return (_ctx, _cache) => {
1717
+ return openBlock(), createElementBlock(
1718
+ Fragment,
1719
+ null,
1720
+ [
1721
+ createVNode(unref(VvDropdownTriggerProvider), null, {
1722
+ default: withCtx(() => [
1723
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
1724
+ ]),
1725
+ _: 3
1726
+ /* FORWARDED */
1727
+ }),
1728
+ createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers), { persisted: "" }), {
1729
+ default: withCtx(() => [
1730
+ withDirectives(createElementVNode(
1731
+ "div",
1732
+ {
1733
+ ref_key: "floatingEl",
1734
+ ref: floatingEl,
1735
+ style: normalizeStyle(unref(dropdownPlacement)),
1736
+ class: normalizeClass(unref(bemCssClasses))
1737
+ },
1738
+ [
1739
+ props.arrow ? (openBlock(), createElementBlock(
1740
+ "div",
1741
+ {
1742
+ key: 0,
1743
+ ref_key: "arrowEl",
1744
+ ref: arrowEl,
1745
+ style: normalizeStyle(unref(arrowPlacement)),
1746
+ class: "vv-dropdown__arrow"
1747
+ },
1748
+ null,
1749
+ 4
1750
+ /* STYLE */
1751
+ )) : createCommentVNode("v-if", true),
1752
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
1753
+ createElementVNode("div", mergeProps(unref(attrs), {
1754
+ id: unref(hasId),
1755
+ ref_key: "listEl",
1756
+ ref: listEl,
1757
+ tabindex: !unref(expanded) ? -1 : void 0,
1758
+ role: unref(role),
1759
+ "aria-labelledby": unref(hasAriaLabelledby),
1760
+ class: "vv-dropdown__list"
1761
+ }), [
1762
+ renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
1763
+ role: unref(itemRole)
1764
+ })))
1765
+ ], 16, _hoisted_1$2),
1766
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
1767
+ ],
1768
+ 6
1769
+ /* CLASS, STYLE */
1770
+ ), [
1771
+ [vShow, unref(expanded)]
1772
+ ])
1773
+ ]),
1774
+ _: 3
1775
+ /* FORWARDED */
1776
+ }, 16, ["name"])
1777
+ ],
1778
+ 64
1779
+ /* STABLE_FRAGMENT */
1780
+ );
1781
+ };
1782
+ }
1783
+ });
1784
+ function useInjectedDropdownItem() {
1785
+ return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
1786
+ }
1787
+ const __default__$2 = {
1788
+ name: "VvDropdownItem"
1789
+ };
1790
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1791
+ ...__default__$2,
1792
+ props: VvDropdownItemProps,
1793
+ setup(__props) {
1794
+ const props = __props;
1795
+ const { role, expanded } = useInjectedDropdownItem();
1796
+ const element = ref(null);
1797
+ useProvideDropdownAction({ expanded });
1798
+ const hovered = useElementHover(element);
1799
+ const { focused } = useFocus(element);
1800
+ const { focused: focusedWithin } = useFocusWithin(element);
1801
+ watch(hovered, (newValue) => {
1802
+ if (newValue && props.focusOnHover) {
1803
+ focused.value = true;
1804
+ }
1805
+ });
1806
+ return (_ctx, _cache) => {
1807
+ return openBlock(), createElementBlock(
1808
+ "div",
1809
+ mergeProps({ role: unref(role) }, {
1810
+ ref_key: "element",
1811
+ ref: element,
1812
+ class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
1813
+ }),
1814
+ [
1815
+ renderSlot(_ctx.$slots, "default")
1816
+ ],
1817
+ 16
1818
+ /* FULL_PROPS */
1819
+ );
1820
+ };
1821
+ }
1822
+ });
1823
+ const _hoisted_1$1 = ["title"];
1824
+ const __default__$1 = {
1825
+ name: "VvDropdownOption"
1826
+ };
1827
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1828
+ ...__default__$1,
1829
+ props: VvDropdownOptionProps,
1830
+ setup(__props) {
1831
+ const props = __props;
1832
+ const { modifiers } = toRefs(props);
1833
+ const bemCssClasses = useModifiers(
1834
+ "vv-dropdown-option",
1835
+ modifiers,
1836
+ computed(() => ({
1837
+ disabled: props.disabled,
1838
+ selected: props.selected,
1839
+ unselectable: props.unselectable && props.selected
1840
+ }))
1841
+ );
1842
+ const hintLabel = computed(() => {
1843
+ if (props.selected) {
1844
+ return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
1845
+ }
1846
+ if (!props.disabled) {
1847
+ return props.selectHintLabel;
1848
+ }
1849
+ });
1850
+ return (_ctx, _cache) => {
1851
+ return openBlock(), createBlock(_sfc_main$2, {
1852
+ class: normalizeClass(unref(bemCssClasses)),
1853
+ tabindex: _ctx.disabled ? -1 : 0,
1854
+ "aria-selected": _ctx.selected,
1855
+ "aria-disabled": _ctx.disabled,
1856
+ "focus-on-hover": _ctx.focusOnHover
1857
+ }, {
1858
+ default: withCtx(() => [
1859
+ renderSlot(_ctx.$slots, "default"),
1860
+ createElementVNode("span", {
1861
+ class: "vv-dropdown-option__hint",
1862
+ title: unref(hintLabel)
1863
+ }, [
1864
+ renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
1865
+ createTextVNode(
1866
+ toDisplayString(unref(hintLabel)),
1867
+ 1
1868
+ /* TEXT */
1869
+ )
1870
+ ])
1871
+ ], 8, _hoisted_1$1)
1872
+ ]),
1873
+ _: 3
1874
+ /* FORWARDED */
1875
+ }, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
1876
+ };
1877
+ }
1878
+ });
1181
1879
  function useDefaults(componentName, propsDefinition, props) {
1182
1880
  const volver = useVolver();
1183
1881
  const volverComponentDefaults = computed(() => {
@@ -1231,7 +1929,6 @@ function useDefaults(componentName, propsDefinition, props) {
1231
1929
  }, {});
1232
1930
  });
1233
1931
  }
1234
- const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
1235
1932
  function useDebouncedInput(modelValue, emit, ms = 0, {
1236
1933
  getter = (value) => value,
1237
1934
  setter = (value) => value
@@ -1295,25 +1992,86 @@ function useTextCount(text, options) {
1295
1992
  formatted
1296
1993
  };
1297
1994
  }
1995
+ const usePersistence = (storageKey, storageType = StorageType.local, defaultValue) => {
1996
+ const localValue = ref();
1997
+ if (defaultValue) {
1998
+ localValue.value = defaultValue;
1999
+ }
2000
+ let storageValue;
2001
+ if (storageKey) {
2002
+ watch(
2003
+ storageKey,
2004
+ (newKey, oldKey) => {
2005
+ const storage = unref(storageType) === StorageType.session ? sessionStorage : localStorage;
2006
+ if (oldKey && oldKey !== newKey) {
2007
+ storage.removeItem(oldKey);
2008
+ }
2009
+ if (newKey) {
2010
+ storageValue = useStorage(
2011
+ newKey,
2012
+ (storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
2013
+ storage
2014
+ );
2015
+ return;
2016
+ }
2017
+ storageValue = void 0;
2018
+ },
2019
+ {
2020
+ immediate: true
2021
+ }
2022
+ );
2023
+ }
2024
+ if (isRef(storageType)) {
2025
+ watch(storageType, (newType, oldType) => {
2026
+ if (storageKey == null ? void 0 : storageKey.value) {
2027
+ if (newType) {
2028
+ const storage = newType === StorageType.session ? sessionStorage : localStorage;
2029
+ storageValue = useStorage(
2030
+ storageKey.value,
2031
+ (storageValue == null ? void 0 : storageValue.value) ?? localValue.value,
2032
+ storage
2033
+ );
2034
+ }
2035
+ if (oldType && oldType !== newType) {
2036
+ const oldStorage = oldType === StorageType.session ? sessionStorage : localStorage;
2037
+ oldStorage.removeItem(storageKey.value);
2038
+ }
2039
+ }
2040
+ });
2041
+ }
2042
+ return computed({
2043
+ get: () => {
2044
+ return (storageValue == null ? void 0 : storageValue.value) ?? localValue.value;
2045
+ },
2046
+ set: (value) => {
2047
+ if (storageValue) {
2048
+ storageValue.value = value;
2049
+ return;
2050
+ }
2051
+ localValue.value = value;
2052
+ }
2053
+ });
2054
+ };
1298
2055
  const _hoisted_1 = ["for"];
1299
- const _hoisted_2 = { class: "vv-input-text__wrapper" };
1300
- const _hoisted_3 = {
2056
+ const _hoisted_2 = {
1301
2057
  key: 0,
1302
2058
  class: "vv-input-text__input-before"
1303
2059
  };
1304
- const _hoisted_4 = ["id"];
1305
- const _hoisted_5 = {
2060
+ const _hoisted_3 = ["id"];
2061
+ const _hoisted_4 = {
1306
2062
  key: 1,
1307
2063
  class: "vv-input-text__unit"
1308
2064
  };
1309
- const _hoisted_6 = {
2065
+ const _hoisted_5 = {
1310
2066
  key: 5,
1311
2067
  class: "vv-input-text__input-after"
1312
2068
  };
1313
- const _hoisted_7 = {
2069
+ const _hoisted_6 = {
1314
2070
  key: 6,
1315
2071
  class: "vv-input-text__limit"
1316
2072
  };
2073
+ const _hoisted_7 = { class: "flex-1" };
2074
+ const _hoisted_8 = ["title", "onClick"];
1317
2075
  const __default__ = {
1318
2076
  name: "VvInputText"
1319
2077
  };
@@ -1334,6 +2092,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1334
2092
  id,
1335
2093
  icon,
1336
2094
  iconPosition,
2095
+ iconRemoveSuggestion,
1337
2096
  label,
1338
2097
  modelValue,
1339
2098
  count,
@@ -1345,7 +2104,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1345
2104
  minlength,
1346
2105
  type,
1347
2106
  iMask,
1348
- step
2107
+ step,
2108
+ storageKey,
2109
+ storageType
1349
2110
  } = toRefs(props);
1350
2111
  const hasId = useUniqueId(id);
1351
2112
  const hasHintId = computed(() => `${hasId.value}-hint`);
@@ -1449,6 +2210,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1449
2210
  );
1450
2211
  const inputEl = el;
1451
2212
  const innerEl = ref();
2213
+ const wrapperEl = ref();
2214
+ const dropdownEl = ref();
1452
2215
  __expose({ $inner: innerEl });
1453
2216
  const localModelValue = useDebouncedInput(
1454
2217
  modelValue,
@@ -1460,9 +2223,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1460
2223
  () => focused.value && !props.disabled && !props.readonly
1461
2224
  );
1462
2225
  watch(isFocused, (newValue) => {
2226
+ var _a;
1463
2227
  if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
1464
2228
  inputEl.value.select();
1465
2229
  }
2230
+ if (newValue) {
2231
+ (_a = dropdownEl.value) == null ? void 0 : _a.show();
2232
+ return;
2233
+ }
2234
+ setTimeout(() => {
2235
+ if (isDirty.value && suggestions.value) {
2236
+ const suggestionsLimit = props.maxSuggestions - 1;
2237
+ if (suggestions.value.size > suggestionsLimit && !suggestions.value.has(localModelValue.value)) {
2238
+ suggestions.value = new Set(
2239
+ [...suggestions.value].slice(
2240
+ suggestions.value.size - suggestionsLimit
2241
+ )
2242
+ );
2243
+ }
2244
+ suggestions.value.add(localModelValue.value);
2245
+ }
2246
+ }, 300);
1466
2247
  });
1467
2248
  const isVisible = useElementVisibility(inputEl);
1468
2249
  watch(isVisible, (newValue) => {
@@ -1521,6 +2302,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1521
2302
  }
1522
2303
  return void 0;
1523
2304
  });
2305
+ const { hasIcon: hasIconRemoveSuggestion } = useComponentIcon(iconRemoveSuggestion);
1524
2306
  const { formatted: countFormatted } = useTextCount(localModelValue, {
1525
2307
  mode: count.value,
1526
2308
  upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
@@ -1540,6 +2322,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1540
2322
  }
1541
2323
  return void 0;
1542
2324
  });
2325
+ const suggestions = usePersistence(
2326
+ storageKey,
2327
+ storageType,
2328
+ /* @__PURE__ */ new Set()
2329
+ );
2330
+ const filteredSuggestions = computed(() => {
2331
+ if (!suggestions.value) {
2332
+ return [];
2333
+ }
2334
+ return [...suggestions.value].filter(
2335
+ (suggestion) => isEmpty(localModelValue.value) || `${suggestion}`.toLowerCase().includes(`${localModelValue.value}`.toLowerCase()) && suggestion !== localModelValue.value
2336
+ );
2337
+ });
2338
+ const hasSuggestions = computed(
2339
+ () => (storageKey == null ? void 0 : storageKey.value) && suggestions.value && suggestions.value.size > 0
2340
+ );
2341
+ const onSuggestionSelect = (suggestion) => {
2342
+ var _a;
2343
+ localModelValue.value = suggestion;
2344
+ (_a = dropdownEl.value) == null ? void 0 : _a.hide();
2345
+ };
2346
+ const onSuggestionRemove = (suggestion) => {
2347
+ var _a;
2348
+ (_a = suggestions.value) == null ? void 0 : _a.delete(suggestion);
2349
+ };
1543
2350
  const { modifiers } = toRefs(props);
1544
2351
  const bemCssClasses = useModifiers(
1545
2352
  "vv-input-text",
@@ -1670,79 +2477,89 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1670
2477
  for: unref(hasId),
1671
2478
  class: "vv-input-text__label"
1672
2479
  }, toDisplayString(unref(label)), 9, _hoisted_1)) : createCommentVNode("v-if", true),
1673
- createElementVNode("div", _hoisted_2, [
1674
- _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3, [
1675
- renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
1676
- ])) : createCommentVNode("v-if", true),
1677
- createElementVNode(
1678
- "div",
1679
- {
1680
- ref_key: "innerEl",
1681
- ref: innerEl,
1682
- class: "vv-input-text__inner",
1683
- onClick: withModifiers(onClickInner, ["stop"])
1684
- },
1685
- [
1686
- unref(hasIconBefore) ? (openBlock(), createBlock(
1687
- _sfc_main$1,
1688
- mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
1689
- null,
1690
- 16
1691
- /* FULL_PROPS */
1692
- )) : createCommentVNode("v-if", true),
1693
- createElementVNode("input", mergeProps({
1694
- id: unref(hasId),
1695
- ref_key: "inputEl",
1696
- ref: inputEl
1697
- }, unref(hasAttrs), {
1698
- style: unref(hasStyle),
1699
- onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
1700
- onKeydown: onKeyDown,
1701
- onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
1702
- }), null, 16, _hoisted_4),
1703
- (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_5, [
1704
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
1705
- createTextVNode(
1706
- toDisplayString(_ctx.unit),
1707
- 1
1708
- /* TEXT */
1709
- )
1710
- ])
1711
- ])) : createCommentVNode("v-if", true)
1712
- ],
1713
- 512
1714
- /* NEED_PATCH */
1715
- ),
1716
- unref(iconAfter) ? (openBlock(), createBlock(
1717
- _sfc_main$1,
1718
- mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
1719
- null,
1720
- 16
1721
- /* FULL_PROPS */
1722
- )) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
1723
- key: 2,
1724
- onTogglePassword
1725
- })) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
1726
- key: 3,
1727
- onStepUp,
1728
- onStepDown
1729
- })) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
1730
- key: 4,
1731
- onClear
1732
- })) : createCommentVNode("v-if", true),
1733
- _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_6, [
1734
- renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
1735
- ])) : createCommentVNode("v-if", true),
1736
- unref(count) ? (openBlock(), createElementBlock("span", _hoisted_7, [
1737
- renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
1738
- createTextVNode(
1739
- toDisplayString(unref(countFormatted)),
1740
- 1
1741
- /* TEXT */
1742
- )
1743
- ])
1744
- ])) : createCommentVNode("v-if", true)
1745
- ]),
2480
+ createElementVNode(
2481
+ "div",
2482
+ {
2483
+ ref_key: "wrapperEl",
2484
+ ref: wrapperEl,
2485
+ class: "vv-input-text__wrapper"
2486
+ },
2487
+ [
2488
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_2, [
2489
+ renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
2490
+ ])) : createCommentVNode("v-if", true),
2491
+ createElementVNode(
2492
+ "div",
2493
+ {
2494
+ ref_key: "innerEl",
2495
+ ref: innerEl,
2496
+ class: "vv-input-text__inner",
2497
+ onClick: withModifiers(onClickInner, ["stop"])
2498
+ },
2499
+ [
2500
+ unref(hasIconBefore) ? (openBlock(), createBlock(
2501
+ _sfc_main$4,
2502
+ mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-input-text__icon" }),
2503
+ null,
2504
+ 16
2505
+ /* FULL_PROPS */
2506
+ )) : createCommentVNode("v-if", true),
2507
+ createElementVNode("input", mergeProps({
2508
+ id: unref(hasId),
2509
+ ref_key: "inputEl",
2510
+ ref: inputEl
2511
+ }, unref(hasAttrs), {
2512
+ style: unref(hasStyle),
2513
+ onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
2514
+ onKeydown: onKeyDown,
2515
+ onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
2516
+ }), null, 16, _hoisted_3),
2517
+ (_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_4, [
2518
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
2519
+ createTextVNode(
2520
+ toDisplayString(_ctx.unit),
2521
+ 1
2522
+ /* TEXT */
2523
+ )
2524
+ ])
2525
+ ])) : createCommentVNode("v-if", true)
2526
+ ],
2527
+ 512
2528
+ /* NEED_PATCH */
2529
+ ),
2530
+ unref(iconAfter) ? (openBlock(), createBlock(
2531
+ _sfc_main$4,
2532
+ mergeProps({ key: 1 }, unref(iconAfter), { class: "vv-input-text__icon vv-input-text__icon-after" }),
2533
+ null,
2534
+ 16
2535
+ /* FULL_PROPS */
2536
+ )) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
2537
+ key: 2,
2538
+ onTogglePassword
2539
+ })) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
2540
+ key: 3,
2541
+ onStepUp,
2542
+ onStepDown
2543
+ })) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
2544
+ key: 4,
2545
+ onClear
2546
+ })) : createCommentVNode("v-if", true),
2547
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_5, [
2548
+ renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
2549
+ ])) : createCommentVNode("v-if", true),
2550
+ unref(count) ? (openBlock(), createElementBlock("span", _hoisted_6, [
2551
+ renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
2552
+ createTextVNode(
2553
+ toDisplayString(unref(countFormatted)),
2554
+ 1
2555
+ /* TEXT */
2556
+ )
2557
+ ])
2558
+ ])) : createCommentVNode("v-if", true)
2559
+ ],
2560
+ 512
2561
+ /* NEED_PATCH */
2562
+ ),
1746
2563
  createVNode(unref(HintSlot), {
1747
2564
  id: unref(hasHintId),
1748
2565
  class: "vv-input-text__hint"
@@ -1778,7 +2595,62 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1778
2595
  ]),
1779
2596
  key: "3"
1780
2597
  } : void 0
1781
- ]), 1032, ["id"])
2598
+ ]), 1032, ["id"]),
2599
+ unref(hasSuggestions) ? (openBlock(), createBlock(_sfc_main$3, {
2600
+ key: 1,
2601
+ ref_key: "dropdownEl",
2602
+ ref: dropdownEl,
2603
+ reference: unref(wrapperEl),
2604
+ "autofocus-first": false,
2605
+ "trigger-width": true
2606
+ }, {
2607
+ items: withCtx(() => [
2608
+ (openBlock(true), createElementBlock(
2609
+ Fragment,
2610
+ null,
2611
+ renderList(unref(filteredSuggestions), (value) => {
2612
+ return openBlock(), createBlock(_sfc_main$1, {
2613
+ key: value,
2614
+ onClick: withModifiers(($event) => onSuggestionSelect(value), ["stop"])
2615
+ }, {
2616
+ default: withCtx(() => [
2617
+ createElementVNode("div", _hoisted_7, [
2618
+ renderSlot(_ctx.$slots, "suggestion", normalizeProps(guardReactiveProps({ value })), () => [
2619
+ createTextVNode(
2620
+ toDisplayString(value),
2621
+ 1
2622
+ /* TEXT */
2623
+ )
2624
+ ])
2625
+ ]),
2626
+ unref(suggestions) && unref(hasIconRemoveSuggestion) ? (openBlock(), createElementBlock("button", {
2627
+ key: 0,
2628
+ type: "button",
2629
+ tabindex: "-1",
2630
+ class: "cursor-pointer",
2631
+ title: _ctx.labelRemoveSuggestion,
2632
+ onClick: withModifiers(($event) => onSuggestionRemove(value), ["stop"])
2633
+ }, [
2634
+ createVNode(
2635
+ _sfc_main$4,
2636
+ normalizeProps(guardReactiveProps(unref(hasIconRemoveSuggestion))),
2637
+ null,
2638
+ 16
2639
+ /* FULL_PROPS */
2640
+ )
2641
+ ], 8, _hoisted_8)) : createCommentVNode("v-if", true)
2642
+ ]),
2643
+ _: 2
2644
+ /* DYNAMIC */
2645
+ }, 1032, ["onClick"]);
2646
+ }),
2647
+ 128
2648
+ /* KEYED_FRAGMENT */
2649
+ ))
2650
+ ]),
2651
+ _: 3
2652
+ /* FORWARDED */
2653
+ }, 8, ["reference"])) : createCommentVNode("v-if", true)
1782
2654
  ],
1783
2655
  2
1784
2656
  /* CLASS */