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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +3 -3
  2. package/auto-imports.d.ts +2 -0
  3. package/dist/components/VvAccordion/VvAccordion.es.js +15 -7
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +15 -7
  5. package/dist/components/VvAction/VvAction.es.js +17 -8
  6. package/dist/components/VvAction/VvAction.umd.js +1 -1
  7. package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
  8. package/dist/components/VvAction/index.d.ts +4 -0
  9. package/dist/components/VvAlert/VvAlert.es.js +22 -13
  10. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  11. package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
  12. package/dist/components/VvAlert/index.d.ts +3 -3
  13. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +22 -13
  14. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  15. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +6 -6
  16. package/dist/components/VvAlertGroup/index.d.ts +2 -2
  17. package/dist/components/VvAvatar/VvAvatar.es.js +15 -7
  18. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +15 -7
  19. package/dist/components/VvBadge/VvBadge.es.js +15 -7
  20. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +15 -7
  21. package/dist/components/VvButton/VvButton.es.js +19 -9
  22. package/dist/components/VvButton/VvButton.umd.js +1 -1
  23. package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
  24. package/dist/components/VvButton/index.d.ts +4 -0
  25. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +15 -7
  26. package/dist/components/VvCard/VvCard.es.js +15 -7
  27. package/dist/components/VvCheckbox/VvCheckbox.es.js +99 -21
  28. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  29. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +105 -22
  31. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  32. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
  33. package/dist/components/VvCombobox/VvCombobox.es.js +256 -191
  34. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  35. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +329 -101
  36. package/dist/components/VvCombobox/index.d.ts +123 -37
  37. package/dist/components/VvDialog/VvDialog.es.js +50 -37
  38. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  39. package/dist/components/VvDropdown/VvDropdown.es.js +32 -18
  40. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  41. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +300 -92
  42. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
  43. package/dist/components/VvDropdown/index.d.ts +99 -30
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +17 -8
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  46. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +15 -7
  47. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +15 -7
  48. package/dist/components/VvInputText/VvInputText.es.js +279 -116
  49. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  50. package/dist/components/VvInputText/VvInputText.vue.d.ts +23 -41
  51. package/dist/components/VvInputText/index.d.ts +15 -33
  52. package/dist/components/VvNav/VvNav.es.js +18 -9
  53. package/dist/components/VvNav/VvNav.umd.js +1 -1
  54. package/dist/components/VvNav/index.d.ts +1 -1
  55. package/dist/components/VvProgress/VvProgress.es.js +15 -7
  56. package/dist/components/VvRadio/VvRadio.es.js +99 -21
  57. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  59. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +105 -22
  60. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  61. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
  62. package/dist/components/VvSelect/VvSelect.es.js +95 -21
  63. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  64. package/dist/components/VvSelect/VvSelect.vue.d.ts +5 -5
  65. package/dist/components/VvTab/VvTab.es.js +18 -9
  66. package/dist/components/VvTab/VvTab.umd.js +1 -1
  67. package/dist/components/VvTextarea/VvTextarea.es.js +103 -26
  68. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  69. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
  70. package/dist/components/VvTooltip/VvTooltip.es.js +15 -7
  71. package/dist/components/common/HintSlot.d.ts +4 -3
  72. package/dist/components/index.d.ts +5 -0
  73. package/dist/components/index.es.js +1212 -626
  74. package/dist/components/index.umd.js +1 -1
  75. package/dist/composables/alert/useAlert.d.ts +27 -0
  76. package/dist/composables/index.d.ts +1 -0
  77. package/dist/composables/index.es.js +81 -0
  78. package/dist/composables/index.umd.js +1 -0
  79. package/dist/constants.d.ts +14 -0
  80. package/dist/directives/index.es.js +15 -7
  81. package/dist/directives/v-tooltip.es.js +15 -7
  82. package/dist/icons.es.js +3 -3
  83. package/dist/icons.umd.js +1 -1
  84. package/dist/props/index.d.ts +107 -31
  85. package/dist/resolvers/unplugin.es.js +3 -0
  86. package/dist/resolvers/unplugin.umd.js +1 -1
  87. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
  88. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +54 -269
  89. package/dist/stories/Alert/Alert.settings.d.ts +3 -7
  90. package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
  91. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
  92. package/dist/stories/Button/Button.settings.d.ts +3 -13
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
  94. package/dist/stories/InputText/InputText.settings.d.ts +31 -9
  95. package/dist/stories/InputText/InputText.stories.d.ts +0 -1
  96. package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
  97. package/dist/stories/Nav/Nav.settings.d.ts +3 -21
  98. package/package.json +75 -66
  99. package/src/assets/icons/detailed.json +1 -1
  100. package/src/assets/icons/normal.json +1 -1
  101. package/src/assets/icons/simple.json +1 -1
  102. package/src/components/VvAction/VvAction.vue +2 -1
  103. package/src/components/VvAlert/VvAlert.vue +5 -1
  104. package/src/components/VvAlert/index.ts +3 -3
  105. package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
  106. package/src/components/VvButton/VvButton.vue +1 -0
  107. package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
  108. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
  109. package/src/components/VvCombobox/VvCombobox.vue +43 -23
  110. package/src/components/VvCombobox/index.ts +24 -0
  111. package/src/components/VvDialog/VvDialog.vue +22 -19
  112. package/src/components/VvDropdown/VvDropdown.vue +24 -18
  113. package/src/components/VvInputText/VvInputText.vue +177 -55
  114. package/src/components/VvInputText/index.ts +32 -34
  115. package/src/components/VvNav/VvNav.vue +1 -1
  116. package/src/components/VvNav/index.ts +1 -1
  117. package/src/components/VvRadio/VvRadio.vue +8 -1
  118. package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
  119. package/src/components/VvSelect/VvSelect.vue +8 -1
  120. package/src/components/VvTextarea/VvTextarea.vue +16 -6
  121. package/src/components/common/HintSlot.ts +26 -13
  122. package/src/components/index.ts +5 -0
  123. package/src/composables/alert/useAlert.ts +103 -0
  124. package/src/composables/index.ts +1 -0
  125. package/src/constants.ts +26 -0
  126. package/src/props/index.ts +14 -11
  127. package/src/resolvers/unplugin.ts +3 -0
  128. package/src/stories/Alert/Alert.settings.ts +3 -1
  129. package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
  130. package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
  131. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
  132. package/src/stories/Button/Button.settings.ts +5 -3
  133. package/src/stories/Combobox/Combobox.settings.ts +119 -2
  134. package/src/stories/Combobox/Combobox.test.ts +1 -1
  135. package/src/stories/InputText/InputText.settings.ts +36 -15
  136. package/src/stories/InputText/InputText.stories.ts +4 -12
  137. package/src/stories/InputText/InputText.test.ts +31 -15
  138. package/src/stories/InputText/InputTextMask.stories.ts +122 -0
  139. package/src/stories/Nav/Nav.settings.ts +3 -1
  140. package/src/stories/Tab/Tab.stories.ts +3 -3
  141. package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
  142. package/src/types/alert.d.ts +20 -0
  143. /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
  144. /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
  145. /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
  146. /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
@@ -1,10 +1,15 @@
1
- import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, provide, h, Fragment, useAttrs, onMounted, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, useSlots, isRef, renderList, vModelSelect, createSlots, resolveDynamicComponent, toRef, withModifiers, vModelText } from "vue";
1
+ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, provide, h, Fragment, useAttrs, onMounted, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, isRef, useSlots, renderList, vModelSelect, createSlots, resolveDynamicComponent, toRef, withModifiers, vModelText } from "vue";
2
2
  import { iconExists, Icon, addIcon } from "@iconify/vue";
3
3
  import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
4
4
  import { nanoid } from "nanoid";
5
- import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
5
+ import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
6
6
  import mitt from "mitt";
7
7
  import { get } from "ts-dot-prop";
8
+ var Strategy = /* @__PURE__ */ ((Strategy2) => {
9
+ Strategy2["absolute"] = "absolute";
10
+ Strategy2["fixed"] = "fixed";
11
+ return Strategy2;
12
+ })(Strategy || {});
8
13
  var Side = /* @__PURE__ */ ((Side2) => {
9
14
  Side2["left"] = "left";
10
15
  Side2["right"] = "right";
@@ -249,19 +254,15 @@ const DropdownProps = {
249
254
  placement: {
250
255
  type: String,
251
256
  default: Side.bottom,
252
- validator: (value) => {
253
- return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
254
- }
257
+ validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
255
258
  },
256
259
  /**
257
260
  * Dropdown strategy
258
261
  */
259
262
  strategy: {
260
263
  type: String,
261
- default: "absolute",
262
- validator: (value) => {
263
- return ["fixed", "absolute"].includes(value);
264
- }
264
+ default: void 0,
265
+ validator: (value) => Object.values(Strategy).includes(value)
265
266
  },
266
267
  /**
267
268
  * Dropdown show / hide transition name
@@ -374,6 +375,13 @@ const ActionProps = {
374
375
  type: String,
375
376
  default: ButtonType.button,
376
377
  validator: (value) => Object.values(ButtonType).includes(value)
378
+ },
379
+ /**
380
+ * Button aria-label
381
+ */
382
+ ariaLabel: {
383
+ type: String,
384
+ default: void 0
377
385
  }
378
386
  };
379
387
  const VvComboboxEvents = [
@@ -398,6 +406,13 @@ const VvComboboxProps = {
398
406
  ...UnselectableProps,
399
407
  ...DropdownProps,
400
408
  ...LabelProps,
409
+ /**
410
+ * Dropdown show / hide transition name
411
+ */
412
+ transitionName: {
413
+ type: String,
414
+ default: "vv-dropdown--mobile-fade-block"
415
+ },
401
416
  /**
402
417
  * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
403
418
  */
@@ -429,6 +444,10 @@ const VvComboboxProps = {
429
444
  * Label for deselected option hint
430
445
  */
431
446
  deselectHintLabel: { type: String, default: "Press enter to remove" },
447
+ /**
448
+ * Label close button
449
+ */
450
+ closeLabel: { type: String, default: "Close" },
432
451
  /**
433
452
  * Select input placeholder
434
453
  */
@@ -437,6 +456,13 @@ const VvComboboxProps = {
437
456
  * Use input text to search on options
438
457
  */
439
458
  searchable: Boolean,
459
+ /**
460
+ * Search function to filter options
461
+ */
462
+ searchFunction: {
463
+ type: Function,
464
+ default: void 0
465
+ },
440
466
  /**
441
467
  * On searchable select is the input search placeholder
442
468
  */
@@ -866,7 +892,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
866
892
  }
867
893
  } else if (props.flip) {
868
894
  if (typeof props.flip === "boolean") {
869
- toReturn.push(flip());
895
+ toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
870
896
  } else {
871
897
  toReturn.push(flip(props.flip));
872
898
  }
@@ -918,27 +944,33 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
918
944
  }
919
945
  return toReturn;
920
946
  });
921
- const { x, y, strategy, middlewareData, placement } = useFloating(
947
+ const { x, y, middlewareData, placement, strategy } = useFloating(
922
948
  referenceEl,
923
949
  floatingEl,
924
950
  {
925
- whileElementsMounted: autoUpdate,
951
+ whileElementsMounted: (...args) => {
952
+ return autoUpdate(...args, {
953
+ animationFrame: props.strategy === Strategy.fixed
954
+ });
955
+ },
926
956
  placement: computed(() => props.placement),
927
957
  strategy: computed(() => props.strategy),
928
958
  middleware
929
959
  }
930
960
  );
931
961
  const dropdownPlacement = computed(() => {
962
+ var _a;
932
963
  if (hasCustomPosition.value) {
933
964
  return void 0;
934
965
  }
966
+ const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
935
967
  return {
936
968
  position: strategy.value,
937
969
  top: `${y.value ?? 0}px`,
938
970
  left: `${x.value ?? 0}px`,
939
- maxWidth: maxWidth.value,
971
+ maxWidth: width ? void 0 : maxWidth.value,
940
972
  maxHeight: maxHeight.value,
941
- width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
973
+ width
942
974
  };
943
975
  });
944
976
  const side = computed(
@@ -950,10 +982,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
950
982
  return void 0;
951
983
  }
952
984
  const staticSide = {
953
- top: "bottom",
954
- right: "left",
955
- bottom: "top",
956
- left: "right"
985
+ [Side.top]: Side.bottom,
986
+ [Side.right]: Side.left,
987
+ [Side.bottom]: Side.top,
988
+ [Side.left]: Side.right
957
989
  }[side.value];
958
990
  return {
959
991
  left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
@@ -1009,7 +1041,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1009
1041
  onClickOutside(
1010
1042
  floatingEl,
1011
1043
  () => {
1012
- if (!props.keepOpen) {
1044
+ if (!props.keepOpen && expanded.value) {
1013
1045
  expanded.value = false;
1014
1046
  }
1015
1047
  },
@@ -1047,7 +1079,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1047
1079
  }
1048
1080
  return [
1049
1081
  ...element.querySelectorAll(
1050
- 'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
1082
+ 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
1051
1083
  )
1052
1084
  ].filter(
1053
1085
  (el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
@@ -1433,19 +1465,27 @@ function joinLines(items) {
1433
1465
  }
1434
1466
  return items;
1435
1467
  }
1436
- function HintSlotFactory(props, slots) {
1437
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
1438
- const validLabel = computed(() => joinLines(props.validLabel));
1439
- const loadingLabel = computed(() => props.loadingLabel);
1440
- const hintLabel = computed(() => props.hintLabel);
1468
+ function HintSlotFactory(propsOrRef, slots) {
1469
+ const props = computed(() => {
1470
+ if (isRef(propsOrRef)) {
1471
+ return propsOrRef.value;
1472
+ }
1473
+ return propsOrRef;
1474
+ });
1475
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
1476
+ const validLabel = computed(() => joinLines(props.value.validLabel));
1477
+ const loadingLabel = computed(() => props.value.loadingLabel);
1478
+ const hintLabel = computed(() => props.value.hintLabel);
1441
1479
  const hasLoadingLabelOrSlot = computed(
1442
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
1480
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
1443
1481
  );
1444
1482
  const hasInvalidLabelOrSlot = computed(
1445
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
1483
+ () => !hasLoadingLabelOrSlot.value && Boolean(
1484
+ props.value.invalid && (slots.invalid || invalidLabel.value)
1485
+ )
1446
1486
  );
1447
1487
  const hasValidLabelOrSlot = computed(
1448
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
1488
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
1449
1489
  );
1450
1490
  const hasHintLabelOrSlot = computed(
1451
1491
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -1454,10 +1494,10 @@ function HintSlotFactory(props, slots) {
1454
1494
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
1455
1495
  );
1456
1496
  const hintSlotScope = computed(() => ({
1457
- modelValue: props.modelValue,
1458
- valid: props.valid,
1459
- invalid: props.invalid,
1460
- loading: props.loading
1497
+ modelValue: props.value.modelValue,
1498
+ valid: props.value.valid,
1499
+ invalid: props.value.invalid,
1500
+ loading: props.value.loading
1461
1501
  }));
1462
1502
  const HintSlot = defineComponent({
1463
1503
  name: "HintSlot",
@@ -1586,6 +1626,59 @@ const VvSelectProps = {
1586
1626
  placeholder: String
1587
1627
  };
1588
1628
  const VvSelectEmits = ["update:modelValue", "focus", "blur"];
1629
+ function useDefaults(componentName, propsDefinition, props) {
1630
+ const volver = useVolver();
1631
+ const volverComponentDefaults = computed(() => {
1632
+ var _a;
1633
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
1634
+ return void 0;
1635
+ }
1636
+ return volver.defaults.value[componentName];
1637
+ });
1638
+ return computed(() => {
1639
+ if (volverComponentDefaults.value === void 0) {
1640
+ return props;
1641
+ }
1642
+ const componentDefaults = volverComponentDefaults.value;
1643
+ const simplifiedPropsDefinition = propsDefinition;
1644
+ const simplifiedProps = props;
1645
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
1646
+ const propValue = simplifiedProps[key];
1647
+ acc[key] = propValue;
1648
+ if (key in componentDefaults) {
1649
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
1650
+ const typeArray = simplifiedPropsDefinition[key];
1651
+ if (typeArray.length) {
1652
+ const typeFunction = typeArray[0];
1653
+ if (typeFunction === propValue) {
1654
+ acc[key] = componentDefaults[key];
1655
+ }
1656
+ }
1657
+ }
1658
+ if (typeof simplifiedPropsDefinition[key] === "function") {
1659
+ const typeFunction = simplifiedPropsDefinition[key];
1660
+ if (typeFunction() === propValue) {
1661
+ acc[key] = componentDefaults[key];
1662
+ }
1663
+ }
1664
+ if (typeof simplifiedPropsDefinition[key] === "object") {
1665
+ let defaultValue = simplifiedPropsDefinition[key].default;
1666
+ if (typeof defaultValue === "function") {
1667
+ defaultValue = defaultValue();
1668
+ }
1669
+ if (typeof defaultValue === "object") {
1670
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
1671
+ acc[key] = componentDefaults[key];
1672
+ }
1673
+ } else if (defaultValue === propValue) {
1674
+ acc[key] = componentDefaults[key];
1675
+ }
1676
+ }
1677
+ }
1678
+ return acc;
1679
+ }, {});
1680
+ });
1681
+ }
1589
1682
  function useComponentFocus(inputTemplateRef, emit) {
1590
1683
  const { focused } = useFocus(inputTemplateRef);
1591
1684
  watch(focused, (newValue) => {
@@ -1688,13 +1781,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1688
1781
  setup(__props, { emit }) {
1689
1782
  const props = __props;
1690
1783
  const slots = useSlots();
1784
+ const propsDefaults = useDefaults(
1785
+ "VvSelect",
1786
+ VvSelectProps,
1787
+ props
1788
+ );
1691
1789
  const select = ref();
1692
1790
  const {
1693
1791
  HintSlot,
1694
1792
  hasHintLabelOrSlot,
1695
1793
  hasInvalidLabelOrSlot,
1696
1794
  hintSlotScope
1697
- } = HintSlotFactory(props, slots);
1795
+ } = HintSlotFactory(propsDefaults, slots);
1698
1796
  const {
1699
1797
  id,
1700
1798
  modifiers,
@@ -1965,7 +2063,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1965
2063
  const hasProps = computed(() => {
1966
2064
  const toReturn = {
1967
2065
  ...dropdownAria == null ? void 0 : dropdownAria.value,
1968
- "aria-pressed": pressed.value ? true : void 0,
2066
+ ariaPressed: pressed.value ? true : void 0,
2067
+ ariaLabel: props.ariaLabel,
1969
2068
  role: role == null ? void 0 : role.value
1970
2069
  };
1971
2070
  switch (hasTag.value) {
@@ -2264,7 +2363,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2264
2363
  to: _ctx.to,
2265
2364
  href: _ctx.href,
2266
2365
  target: _ctx.target,
2267
- rel: _ctx.rel
2366
+ rel: _ctx.rel,
2367
+ ariaLabel: _ctx.ariaLabel
2268
2368
  }, {
2269
2369
  id: unref(hasId),
2270
2370
  ref_key: "element",
@@ -2301,59 +2401,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2301
2401
  };
2302
2402
  }
2303
2403
  });
2304
- function useDefaults(componentName, propsDefinition, props) {
2305
- const volver = useVolver();
2306
- const volverComponentDefaults = computed(() => {
2307
- var _a;
2308
- if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
2309
- return void 0;
2310
- }
2311
- return volver.defaults.value[componentName];
2312
- });
2313
- return computed(() => {
2314
- if (volverComponentDefaults.value === void 0) {
2315
- return props;
2316
- }
2317
- const componentDefaults = volverComponentDefaults.value;
2318
- const simplifiedPropsDefinition = propsDefinition;
2319
- const simplifiedProps = props;
2320
- return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
2321
- const propValue = simplifiedProps[key];
2322
- acc[key] = propValue;
2323
- if (key in componentDefaults) {
2324
- if (Array.isArray(simplifiedPropsDefinition[key])) {
2325
- const typeArray = simplifiedPropsDefinition[key];
2326
- if (typeArray.length) {
2327
- const typeFunction = typeArray[0];
2328
- if (typeFunction === propValue) {
2329
- acc[key] = componentDefaults[key];
2330
- }
2331
- }
2332
- }
2333
- if (typeof simplifiedPropsDefinition[key] === "function") {
2334
- const typeFunction = simplifiedPropsDefinition[key];
2335
- if (typeFunction() === propValue) {
2336
- acc[key] = componentDefaults[key];
2337
- }
2338
- }
2339
- if (typeof simplifiedPropsDefinition[key] === "object") {
2340
- let defaultValue = simplifiedPropsDefinition[key].default;
2341
- if (typeof defaultValue === "function") {
2342
- defaultValue = defaultValue();
2343
- }
2344
- if (typeof defaultValue === "object") {
2345
- if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
2346
- acc[key] = componentDefaults[key];
2347
- }
2348
- } else if (defaultValue === propValue) {
2349
- acc[key] = componentDefaults[key];
2350
- }
2351
- }
2352
- }
2353
- return acc;
2354
- }, {});
2355
- });
2356
- }
2357
2404
  const _hoisted_1 = ["id"];
2358
2405
  const _hoisted_2 = ["id", "for"];
2359
2406
  const _hoisted_3 = ["id", "aria-controls", "placeholder"];
@@ -2404,7 +2451,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2404
2451
  hasHintLabelOrSlot,
2405
2452
  hasInvalidLabelOrSlot,
2406
2453
  hintSlotScope
2407
- } = HintSlotFactory(props, slots);
2454
+ } = HintSlotFactory(propsDefaults, slots);
2408
2455
  const inputEl = ref(null);
2409
2456
  const inputSearchEl = ref(null);
2410
2457
  const wrapperEl = ref(null);
@@ -2430,7 +2477,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2430
2477
  const searchText = ref("");
2431
2478
  const debouncedSearchText = refDebounced(
2432
2479
  searchText,
2433
- Number(props.debounceSearch)
2480
+ computed(() => Number(props.debounceSearch))
2434
2481
  );
2435
2482
  watch(
2436
2483
  debouncedSearchText,
@@ -2453,7 +2500,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2453
2500
  expanded.value = false;
2454
2501
  };
2455
2502
  const onAfterExpand = () => {
2456
- if (searchable.value) {
2503
+ if (propsDefaults.value.searchable) {
2457
2504
  if (inputSearchEl.value) {
2458
2505
  inputSearchEl.value.focus({
2459
2506
  preventScroll: true
@@ -2462,7 +2509,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2462
2509
  }
2463
2510
  };
2464
2511
  const onAfterCollapse = () => {
2465
- if (searchable.value) {
2512
+ if (propsDefaults.value.searchable) {
2466
2513
  searchText.value = "";
2467
2514
  }
2468
2515
  };
@@ -2476,14 +2523,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2476
2523
  loading,
2477
2524
  valid,
2478
2525
  invalid,
2479
- floating,
2480
- searchable
2526
+ floating
2481
2527
  } = toRefs(props);
2482
2528
  const hasId = useUniqueId(id);
2483
2529
  const hasHintId = computed(() => `${hasId.value}-hint`);
2484
2530
  const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
2485
2531
  const hasSearchId = computed(() => `${hasId.value}-search`);
2486
2532
  const hasLabelId = computed(() => `${hasId.value}-label`);
2533
+ const localLoading = ref(false);
2534
+ const isLoading = computed(() => localLoading.value || loading.value);
2487
2535
  const dropdownEl = ref();
2488
2536
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
2489
2537
  icon,
@@ -2498,7 +2546,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2498
2546
  modifiers,
2499
2547
  computed(() => ({
2500
2548
  disabled: disabled.value,
2501
- loading: loading.value,
2549
+ loading: isLoading.value,
2502
2550
  readonly: readonly.value,
2503
2551
  "icon-before": Boolean(hasIconBefore.value),
2504
2552
  "icon-after": Boolean(hasIconAfter.value),
@@ -2516,8 +2564,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2516
2564
  getOptionDisabled,
2517
2565
  getOptionGrouped
2518
2566
  } = useOptions(props);
2519
- const filteredOptions = computed(() => {
2567
+ const filteredOptions = computedAsync(async () => {
2520
2568
  var _a;
2569
+ if (propsDefaults.value.searchFunction) {
2570
+ localLoading.value = true;
2571
+ const toReturn = await Promise.resolve(
2572
+ propsDefaults.value.searchFunction(
2573
+ debouncedSearchText.value,
2574
+ props.options
2575
+ )
2576
+ );
2577
+ localLoading.value = false;
2578
+ return toReturn;
2579
+ }
2521
2580
  return (_a = props.options) == null ? void 0 : _a.filter((option) => {
2522
2581
  return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
2523
2582
  });
@@ -2535,12 +2594,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2535
2594
  } else if (props.modelValue) {
2536
2595
  selectedValues = [props.modelValue];
2537
2596
  }
2538
- const options = props.options.reduce((acc, value) => {
2539
- if (isGroup(value)) {
2540
- return [...acc, ...getOptionGrouped(value)];
2541
- }
2542
- return [...acc, value];
2543
- }, []);
2597
+ const options = props.options.reduce(
2598
+ (acc, value) => {
2599
+ if (isGroup(value)) {
2600
+ return [...acc, ...getOptionGrouped(value)];
2601
+ }
2602
+ return [...acc, value];
2603
+ },
2604
+ []
2605
+ );
2544
2606
  return options.filter((option) => {
2545
2607
  if (isGroup(option)) {
2546
2608
  return getOptionGrouped(option).some(
@@ -2594,7 +2656,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2594
2656
  invalid: invalid.value,
2595
2657
  invalidLabel: propsDefaults.value.invalidLabel,
2596
2658
  hintLabel: propsDefaults.value.hintLabel,
2597
- loading: loading.value,
2659
+ loading: isLoading.value,
2598
2660
  loadingLabel: propsDefaults.value.loadingLabel,
2599
2661
  disabled: disabled.value,
2600
2662
  readonly: readonly.value,
@@ -2622,7 +2684,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2622
2684
  flip: propsDefaults.value.flip,
2623
2685
  autoPlacement: propsDefaults.value.autoPlacement,
2624
2686
  arrow: propsDefaults.value.arrow,
2625
- autofocusFirst: searchable.value ? false : propsDefaults.value.autofocusFirst,
2687
+ autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
2626
2688
  triggerWidth: propsDefaults.value.triggerWidth,
2627
2689
  modifiers: propsDefaults.value.dropdownModifiers
2628
2690
  }));
@@ -2654,7 +2716,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2654
2716
  _ctx.label ? (openBlock(), createElementBlock("label", {
2655
2717
  key: 0,
2656
2718
  id: unref(hasLabelId),
2657
- for: unref(searchable) ? unref(hasSearchId) : void 0
2719
+ for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
2658
2720
  }, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("", true),
2659
2721
  createElementVNode("div", {
2660
2722
  ref_key: "wrapperEl",
@@ -2706,6 +2768,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2706
2768
  _ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
2707
2769
  key: 0,
2708
2770
  "aria-label": unref(propsDefaults).deselectActionLabel,
2771
+ type: "button",
2709
2772
  onClick: withModifiers(($event) => onInput(option), ["stop"])
2710
2773
  }, [
2711
2774
  createVNode(_sfc_main$9, { name: "close" })
@@ -2728,107 +2791,110 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2728
2791
  renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
2729
2792
  ])) : createCommentVNode("", true)
2730
2793
  ]),
2731
- items: withCtx(() => [
2732
- unref(filteredOptions).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
2733
- return openBlock(), createElementBlock(Fragment, { key: index }, [
2734
- isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2735
- createVNode(_sfc_main$5, {
2736
- label: unref(getOptionLabel)(option)
2737
- }, null, 8, ["label"]),
2738
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
2739
- option
2740
- ), (item, i) => {
2741
- return openBlock(), createBlock(_sfc_main$6, mergeProps({
2742
- disabled: unref(getOptionDisabled)(item),
2743
- selected: getOptionSelected(item),
2744
- unselectable: _ctx.unselectable,
2745
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2746
- selectHintLabel: unref(propsDefaults).selectHintLabel,
2747
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
2748
- }, {
2749
- key: i,
2750
- class: "vv-dropdown-option",
2751
- onClickPassive: ($event) => onInput(item)
2752
- }), {
2753
- default: withCtx(() => [
2754
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2755
- option,
2756
- selectedOptions: unref(selectedOptions),
2757
- selected: getOptionSelected(item),
2758
- disabled: unref(getOptionDisabled)(item)
2759
- })), () => [
2760
- createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
2761
- ])
2762
- ]),
2763
- _: 2
2764
- }, 1040, ["onClickPassive"]);
2765
- }), 128))
2766
- ], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
2767
- disabled: unref(getOptionDisabled)(option),
2768
- selected: getOptionSelected(option),
2769
- unselectable: _ctx.unselectable,
2770
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2771
- selectHintLabel: unref(propsDefaults).selectHintLabel,
2772
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
2773
- }, {
2774
- class: "vv-dropdown-option",
2775
- onClickPassive: ($event) => onInput(option)
2776
- }), {
2777
- default: withCtx(() => [
2778
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2779
- option,
2780
- selectedOptions: unref(selectedOptions),
2781
- selected: getOptionSelected(option),
2782
- disabled: unref(getOptionDisabled)(option)
2783
- })), () => [
2784
- createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2785
- ])
2786
- ]),
2787
- _: 2
2788
- }, 1040, ["onClickPassive"]))
2789
- ], 64);
2790
- }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
2791
- key: 1,
2792
- modifiers: "inert"
2793
- }, {
2794
- default: withCtx(() => [
2795
- renderSlot(_ctx.$slots, "no-options", {}, () => [
2796
- createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
2797
- ])
2798
- ]),
2799
- _: 3
2800
- })) : (openBlock(), createBlock(_sfc_main$6, {
2801
- key: 2,
2802
- modifiers: "inert"
2803
- }, {
2804
- default: withCtx(() => [
2805
- renderSlot(_ctx.$slots, "no-results", {}, () => [
2806
- createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
2807
- ])
2808
- ]),
2809
- _: 3
2810
- }))
2811
- ]),
2794
+ items: withCtx(() => {
2795
+ var _a;
2796
+ return [
2797
+ !unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
2798
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
2799
+ isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2800
+ createVNode(_sfc_main$5, {
2801
+ label: unref(getOptionLabel)(option)
2802
+ }, null, 8, ["label"]),
2803
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
2804
+ option
2805
+ ), (item, i) => {
2806
+ return openBlock(), createBlock(_sfc_main$6, mergeProps({
2807
+ disabled: unref(getOptionDisabled)(item),
2808
+ selected: getOptionSelected(item),
2809
+ unselectable: _ctx.unselectable,
2810
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2811
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
2812
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
2813
+ }, {
2814
+ key: i,
2815
+ class: "vv-dropdown-option",
2816
+ onClickPassive: ($event) => onInput(item)
2817
+ }), {
2818
+ default: withCtx(() => [
2819
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2820
+ option,
2821
+ selectedOptions: unref(selectedOptions),
2822
+ selected: getOptionSelected(item),
2823
+ disabled: unref(getOptionDisabled)(item)
2824
+ })), () => [
2825
+ createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
2826
+ ])
2827
+ ]),
2828
+ _: 2
2829
+ }, 1040, ["onClickPassive"]);
2830
+ }), 128))
2831
+ ], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
2832
+ disabled: unref(getOptionDisabled)(option),
2833
+ selected: getOptionSelected(option),
2834
+ unselectable: _ctx.unselectable,
2835
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2836
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
2837
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
2838
+ }, {
2839
+ class: "vv-dropdown-option",
2840
+ onClickPassive: ($event) => onInput(option)
2841
+ }), {
2842
+ default: withCtx(() => [
2843
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2844
+ option,
2845
+ selectedOptions: unref(selectedOptions),
2846
+ selected: getOptionSelected(option),
2847
+ disabled: unref(getOptionDisabled)(option)
2848
+ })), () => [
2849
+ createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2850
+ ])
2851
+ ]),
2852
+ _: 2
2853
+ }, 1040, ["onClickPassive"]))
2854
+ ], 64);
2855
+ }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
2856
+ key: 1,
2857
+ modifiers: "inert"
2858
+ }, {
2859
+ default: withCtx(() => [
2860
+ renderSlot(_ctx.$slots, "no-options", {}, () => [
2861
+ createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
2862
+ ])
2863
+ ]),
2864
+ _: 3
2865
+ })) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$6, {
2866
+ key: 2,
2867
+ modifiers: "inert"
2868
+ }, {
2869
+ default: withCtx(() => [
2870
+ renderSlot(_ctx.$slots, "no-results", {}, () => [
2871
+ createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
2872
+ ])
2873
+ ]),
2874
+ _: 3
2875
+ })) : createCommentVNode("", true)
2876
+ ];
2877
+ }),
2812
2878
  after: withCtx(() => [
2813
2879
  renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
2814
2880
  var _a;
2815
2881
  return [
2816
2882
  ((_a = unref(dropdownEl)) == null ? void 0 : _a.customPosition) ? (openBlock(), createBlock(_sfc_main$1, {
2817
2883
  key: 0,
2818
- label: "Close",
2884
+ label: unref(propsDefaults).closeLabel,
2819
2885
  modifiers: "secondary",
2820
2886
  onClick: _cache[1] || (_cache[1] = ($event) => unref(dropdownEl).hide())
2821
- })) : createCommentVNode("", true)
2887
+ }, null, 8, ["label"])) : createCommentVNode("", true)
2822
2888
  ];
2823
2889
  })
2824
2890
  ]),
2825
2891
  _: 2
2826
2892
  }, [
2827
- unref(searchable) || _ctx.$slots["dropdown::before"] ? {
2893
+ unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
2828
2894
  name: "before",
2829
2895
  fn: withCtx(() => [
2830
2896
  renderSlot(_ctx.$slots, "dropdown::before"),
2831
- unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
2897
+ unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
2832
2898
  key: 0,
2833
2899
  id: unref(hasSearchId),
2834
2900
  ref_key: "inputSearchEl",
@@ -2842,7 +2908,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2842
2908
  class: "vv-dropdown__search",
2843
2909
  placeholder: unref(propsDefaults).searchPlaceholder
2844
2910
  }, null, 8, _hoisted_3)), [
2845
- [vShow, unref(expanded)],
2846
2911
  [vModelText, unref(searchText)]
2847
2912
  ]) : createCommentVNode("", true)
2848
2913
  ]),