@volverjs/ui-vue 0.0.9-beta.1 → 0.0.9-beta.11
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.
- package/README.md +3 -3
- package/auto-imports.d.ts +2 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +7 -0
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +7 -0
- package/dist/components/VvAction/VvAction.es.js +9 -1
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
- package/dist/components/VvAction/index.d.ts +4 -0
- package/dist/components/VvAlert/VvAlert.es.js +14 -6
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
- package/dist/components/VvAlert/index.d.ts +3 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +14 -6
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +7 -0
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -0
- package/dist/components/VvBadge/VvBadge.es.js +7 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +7 -0
- package/dist/components/VvButton/VvButton.es.js +11 -2
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
- package/dist/components/VvButton/index.d.ts +4 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -0
- package/dist/components/VvCard/VvCard.es.js +7 -0
- package/dist/components/VvCheckbox/VvCheckbox.es.js +91 -14
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +97 -15
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +228 -176
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +35 -14
- package/dist/components/VvCombobox/index.d.ts +27 -8
- package/dist/components/VvDialog/VvDialog.es.js +34 -26
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +21 -10
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +4 -11
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
- package/dist/components/VvDropdown/index.d.ts +1 -7
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +9 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +7 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +7 -0
- package/dist/components/VvInputText/VvInputText.es.js +87 -14
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvNav/VvNav.es.js +10 -2
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/index.d.ts +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +7 -0
- package/dist/components/VvRadio/VvRadio.es.js +91 -14
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +97 -15
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +87 -14
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +4 -4
- package/dist/components/VvTab/VvTab.es.js +10 -2
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +87 -14
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +7 -0
- package/dist/components/common/HintSlot.d.ts +4 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.es.js +984 -507
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlert.d.ts +27 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.es.js +81 -0
- package/dist/composables/index.umd.js +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/directives/index.es.js +7 -0
- package/dist/directives/v-tooltip.es.js +7 -0
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +7 -0
- package/dist/resolvers/unplugin.es.js +3 -0
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +43 -258
- package/dist/stories/Alert/Alert.settings.d.ts +3 -7
- package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
- package/dist/stories/Button/Button.settings.d.ts +3 -13
- package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
- package/dist/stories/Nav/Nav.settings.d.ts +3 -21
- package/package.json +55 -47
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAction/VvAction.vue +2 -1
- package/src/components/VvAlert/VvAlert.vue +5 -1
- package/src/components/VvAlert/index.ts +3 -3
- package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
- package/src/components/VvButton/VvButton.vue +1 -0
- package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
- package/src/components/VvCombobox/VvCombobox.vue +30 -15
- package/src/components/VvCombobox/index.ts +24 -0
- package/src/components/VvDialog/VvDialog.vue +16 -17
- package/src/components/VvDropdown/VvDropdown.vue +7 -3
- package/src/components/VvDropdown/index.ts +2 -8
- package/src/components/VvInputText/VvInputText.vue +8 -1
- package/src/components/VvNav/VvNav.vue +1 -1
- package/src/components/VvNav/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +8 -1
- package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
- package/src/components/VvSelect/VvSelect.vue +8 -1
- package/src/components/VvTextarea/VvTextarea.vue +8 -1
- package/src/components/common/HintSlot.ts +26 -13
- package/src/components/index.ts +5 -0
- package/src/composables/alert/useAlert.ts +103 -0
- package/src/composables/index.ts +1 -0
- package/src/constants.ts +21 -0
- package/src/props/index.ts +7 -0
- package/src/resolvers/unplugin.ts +3 -0
- package/src/stories/Alert/Alert.settings.ts +3 -1
- package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
- package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
- package/src/stories/Button/Button.settings.ts +5 -3
- package/src/stories/Combobox/Combobox.settings.ts +119 -2
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/Nav/Nav.settings.ts +3 -1
- package/src/stories/Tab/Tab.stories.ts +3 -3
- package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
- package/src/types/alert.d.ts +20 -0
- /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
- /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
- /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
- /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
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,
|
|
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
8
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
@@ -374,6 +374,13 @@ const ActionProps = {
|
|
|
374
374
|
type: String,
|
|
375
375
|
default: ButtonType.button,
|
|
376
376
|
validator: (value) => Object.values(ButtonType).includes(value)
|
|
377
|
+
},
|
|
378
|
+
/**
|
|
379
|
+
* Button aria-label
|
|
380
|
+
*/
|
|
381
|
+
ariaLabel: {
|
|
382
|
+
type: String,
|
|
383
|
+
default: void 0
|
|
377
384
|
}
|
|
378
385
|
};
|
|
379
386
|
const VvComboboxEvents = [
|
|
@@ -398,6 +405,13 @@ const VvComboboxProps = {
|
|
|
398
405
|
...UnselectableProps,
|
|
399
406
|
...DropdownProps,
|
|
400
407
|
...LabelProps,
|
|
408
|
+
/**
|
|
409
|
+
* Dropdown show / hide transition name
|
|
410
|
+
*/
|
|
411
|
+
transitionName: {
|
|
412
|
+
type: String,
|
|
413
|
+
default: "vv-dropdown--mobile-fade-block"
|
|
414
|
+
},
|
|
401
415
|
/**
|
|
402
416
|
* modelValue can be a string, number, boolean, object or array of string, number, boolean, object
|
|
403
417
|
*/
|
|
@@ -429,6 +443,10 @@ const VvComboboxProps = {
|
|
|
429
443
|
* Label for deselected option hint
|
|
430
444
|
*/
|
|
431
445
|
deselectHintLabel: { type: String, default: "Press enter to remove" },
|
|
446
|
+
/**
|
|
447
|
+
* Label close button
|
|
448
|
+
*/
|
|
449
|
+
closeLabel: { type: String, default: "Close" },
|
|
432
450
|
/**
|
|
433
451
|
* Select input placeholder
|
|
434
452
|
*/
|
|
@@ -437,6 +455,13 @@ const VvComboboxProps = {
|
|
|
437
455
|
* Use input text to search on options
|
|
438
456
|
*/
|
|
439
457
|
searchable: Boolean,
|
|
458
|
+
/**
|
|
459
|
+
* Search function to filter options
|
|
460
|
+
*/
|
|
461
|
+
searchFunction: {
|
|
462
|
+
type: Function,
|
|
463
|
+
default: void 0
|
|
464
|
+
},
|
|
440
465
|
/**
|
|
441
466
|
* On searchable select is the input search placeholder
|
|
442
467
|
*/
|
|
@@ -726,13 +751,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
726
751
|
const VvDropdownProps = {
|
|
727
752
|
...IdProps,
|
|
728
753
|
...DropdownProps,
|
|
729
|
-
|
|
730
|
-
* Component BEM modifiers
|
|
731
|
-
*/
|
|
732
|
-
modifiers: {
|
|
733
|
-
type: [String, Array],
|
|
734
|
-
default: "mobile"
|
|
735
|
-
},
|
|
754
|
+
...ModifiersProps,
|
|
736
755
|
/**
|
|
737
756
|
* Show / hide dropdown programmatically
|
|
738
757
|
*/
|
|
@@ -928,7 +947,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
928
947
|
referenceEl,
|
|
929
948
|
floatingEl,
|
|
930
949
|
{
|
|
931
|
-
whileElementsMounted:
|
|
950
|
+
whileElementsMounted: (...args) => {
|
|
951
|
+
return autoUpdate(...args, {
|
|
952
|
+
animationFrame: props.strategy === "fixed"
|
|
953
|
+
});
|
|
954
|
+
},
|
|
932
955
|
placement: computed(() => props.placement),
|
|
933
956
|
strategy: computed(() => props.strategy),
|
|
934
957
|
middleware
|
|
@@ -1015,7 +1038,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1015
1038
|
onClickOutside(
|
|
1016
1039
|
floatingEl,
|
|
1017
1040
|
() => {
|
|
1018
|
-
if (!props.keepOpen) {
|
|
1041
|
+
if (!props.keepOpen && expanded.value) {
|
|
1019
1042
|
expanded.value = false;
|
|
1020
1043
|
}
|
|
1021
1044
|
},
|
|
@@ -1053,7 +1076,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1053
1076
|
}
|
|
1054
1077
|
return [
|
|
1055
1078
|
...element.querySelectorAll(
|
|
1056
|
-
'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
|
|
1079
|
+
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
1057
1080
|
)
|
|
1058
1081
|
].filter(
|
|
1059
1082
|
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
@@ -1439,19 +1462,27 @@ function joinLines(items) {
|
|
|
1439
1462
|
}
|
|
1440
1463
|
return items;
|
|
1441
1464
|
}
|
|
1442
|
-
function HintSlotFactory(
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1465
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
1466
|
+
const props = computed(() => {
|
|
1467
|
+
if (isRef(propsOrRef)) {
|
|
1468
|
+
return propsOrRef.value;
|
|
1469
|
+
}
|
|
1470
|
+
return propsOrRef;
|
|
1471
|
+
});
|
|
1472
|
+
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
1473
|
+
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
1474
|
+
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
1475
|
+
const hintLabel = computed(() => props.value.hintLabel);
|
|
1447
1476
|
const hasLoadingLabelOrSlot = computed(
|
|
1448
|
-
() => Boolean(props.loading && (slots.loading || loadingLabel.value))
|
|
1477
|
+
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
1449
1478
|
);
|
|
1450
1479
|
const hasInvalidLabelOrSlot = computed(
|
|
1451
|
-
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
1480
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
1481
|
+
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
1482
|
+
)
|
|
1452
1483
|
);
|
|
1453
1484
|
const hasValidLabelOrSlot = computed(
|
|
1454
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
|
|
1485
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
1455
1486
|
);
|
|
1456
1487
|
const hasHintLabelOrSlot = computed(
|
|
1457
1488
|
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
@@ -1460,10 +1491,10 @@ function HintSlotFactory(props, slots) {
|
|
|
1460
1491
|
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
1461
1492
|
);
|
|
1462
1493
|
const hintSlotScope = computed(() => ({
|
|
1463
|
-
modelValue: props.modelValue,
|
|
1464
|
-
valid: props.valid,
|
|
1465
|
-
invalid: props.invalid,
|
|
1466
|
-
loading: props.loading
|
|
1494
|
+
modelValue: props.value.modelValue,
|
|
1495
|
+
valid: props.value.valid,
|
|
1496
|
+
invalid: props.value.invalid,
|
|
1497
|
+
loading: props.value.loading
|
|
1467
1498
|
}));
|
|
1468
1499
|
const HintSlot = defineComponent({
|
|
1469
1500
|
name: "HintSlot",
|
|
@@ -1592,6 +1623,59 @@ const VvSelectProps = {
|
|
|
1592
1623
|
placeholder: String
|
|
1593
1624
|
};
|
|
1594
1625
|
const VvSelectEmits = ["update:modelValue", "focus", "blur"];
|
|
1626
|
+
function useDefaults(componentName, propsDefinition, props) {
|
|
1627
|
+
const volver = useVolver();
|
|
1628
|
+
const volverComponentDefaults = computed(() => {
|
|
1629
|
+
var _a;
|
|
1630
|
+
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
1631
|
+
return void 0;
|
|
1632
|
+
}
|
|
1633
|
+
return volver.defaults.value[componentName];
|
|
1634
|
+
});
|
|
1635
|
+
return computed(() => {
|
|
1636
|
+
if (volverComponentDefaults.value === void 0) {
|
|
1637
|
+
return props;
|
|
1638
|
+
}
|
|
1639
|
+
const componentDefaults = volverComponentDefaults.value;
|
|
1640
|
+
const simplifiedPropsDefinition = propsDefinition;
|
|
1641
|
+
const simplifiedProps = props;
|
|
1642
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
1643
|
+
const propValue = simplifiedProps[key];
|
|
1644
|
+
acc[key] = propValue;
|
|
1645
|
+
if (key in componentDefaults) {
|
|
1646
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
1647
|
+
const typeArray = simplifiedPropsDefinition[key];
|
|
1648
|
+
if (typeArray.length) {
|
|
1649
|
+
const typeFunction = typeArray[0];
|
|
1650
|
+
if (typeFunction === propValue) {
|
|
1651
|
+
acc[key] = componentDefaults[key];
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
1656
|
+
const typeFunction = simplifiedPropsDefinition[key];
|
|
1657
|
+
if (typeFunction() === propValue) {
|
|
1658
|
+
acc[key] = componentDefaults[key];
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
1662
|
+
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
1663
|
+
if (typeof defaultValue === "function") {
|
|
1664
|
+
defaultValue = defaultValue();
|
|
1665
|
+
}
|
|
1666
|
+
if (typeof defaultValue === "object") {
|
|
1667
|
+
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
1668
|
+
acc[key] = componentDefaults[key];
|
|
1669
|
+
}
|
|
1670
|
+
} else if (defaultValue === propValue) {
|
|
1671
|
+
acc[key] = componentDefaults[key];
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
return acc;
|
|
1676
|
+
}, {});
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1595
1679
|
function useComponentFocus(inputTemplateRef, emit) {
|
|
1596
1680
|
const { focused } = useFocus(inputTemplateRef);
|
|
1597
1681
|
watch(focused, (newValue) => {
|
|
@@ -1694,13 +1778,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1694
1778
|
setup(__props, { emit }) {
|
|
1695
1779
|
const props = __props;
|
|
1696
1780
|
const slots = useSlots();
|
|
1781
|
+
const propsDefaults = useDefaults(
|
|
1782
|
+
"VvSelect",
|
|
1783
|
+
VvSelectProps,
|
|
1784
|
+
props
|
|
1785
|
+
);
|
|
1697
1786
|
const select = ref();
|
|
1698
1787
|
const {
|
|
1699
1788
|
HintSlot,
|
|
1700
1789
|
hasHintLabelOrSlot,
|
|
1701
1790
|
hasInvalidLabelOrSlot,
|
|
1702
1791
|
hintSlotScope
|
|
1703
|
-
} = HintSlotFactory(
|
|
1792
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
1704
1793
|
const {
|
|
1705
1794
|
id,
|
|
1706
1795
|
modifiers,
|
|
@@ -1971,7 +2060,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1971
2060
|
const hasProps = computed(() => {
|
|
1972
2061
|
const toReturn = {
|
|
1973
2062
|
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
1974
|
-
|
|
2063
|
+
ariaPressed: pressed.value ? true : void 0,
|
|
2064
|
+
ariaLabel: props.ariaLabel,
|
|
1975
2065
|
role: role == null ? void 0 : role.value
|
|
1976
2066
|
};
|
|
1977
2067
|
switch (hasTag.value) {
|
|
@@ -2270,7 +2360,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2270
2360
|
to: _ctx.to,
|
|
2271
2361
|
href: _ctx.href,
|
|
2272
2362
|
target: _ctx.target,
|
|
2273
|
-
rel: _ctx.rel
|
|
2363
|
+
rel: _ctx.rel,
|
|
2364
|
+
ariaLabel: _ctx.ariaLabel
|
|
2274
2365
|
}, {
|
|
2275
2366
|
id: unref(hasId),
|
|
2276
2367
|
ref_key: "element",
|
|
@@ -2307,59 +2398,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2307
2398
|
};
|
|
2308
2399
|
}
|
|
2309
2400
|
});
|
|
2310
|
-
function useDefaults(componentName, propsDefinition, props) {
|
|
2311
|
-
const volver = useVolver();
|
|
2312
|
-
const volverComponentDefaults = computed(() => {
|
|
2313
|
-
var _a;
|
|
2314
|
-
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
2315
|
-
return void 0;
|
|
2316
|
-
}
|
|
2317
|
-
return volver.defaults.value[componentName];
|
|
2318
|
-
});
|
|
2319
|
-
return computed(() => {
|
|
2320
|
-
if (volverComponentDefaults.value === void 0) {
|
|
2321
|
-
return props;
|
|
2322
|
-
}
|
|
2323
|
-
const componentDefaults = volverComponentDefaults.value;
|
|
2324
|
-
const simplifiedPropsDefinition = propsDefinition;
|
|
2325
|
-
const simplifiedProps = props;
|
|
2326
|
-
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
2327
|
-
const propValue = simplifiedProps[key];
|
|
2328
|
-
acc[key] = propValue;
|
|
2329
|
-
if (key in componentDefaults) {
|
|
2330
|
-
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
2331
|
-
const typeArray = simplifiedPropsDefinition[key];
|
|
2332
|
-
if (typeArray.length) {
|
|
2333
|
-
const typeFunction = typeArray[0];
|
|
2334
|
-
if (typeFunction === propValue) {
|
|
2335
|
-
acc[key] = componentDefaults[key];
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
2340
|
-
const typeFunction = simplifiedPropsDefinition[key];
|
|
2341
|
-
if (typeFunction() === propValue) {
|
|
2342
|
-
acc[key] = componentDefaults[key];
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
2346
|
-
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
2347
|
-
if (typeof defaultValue === "function") {
|
|
2348
|
-
defaultValue = defaultValue();
|
|
2349
|
-
}
|
|
2350
|
-
if (typeof defaultValue === "object") {
|
|
2351
|
-
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
2352
|
-
acc[key] = componentDefaults[key];
|
|
2353
|
-
}
|
|
2354
|
-
} else if (defaultValue === propValue) {
|
|
2355
|
-
acc[key] = componentDefaults[key];
|
|
2356
|
-
}
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
return acc;
|
|
2360
|
-
}, {});
|
|
2361
|
-
});
|
|
2362
|
-
}
|
|
2363
2401
|
const _hoisted_1 = ["id"];
|
|
2364
2402
|
const _hoisted_2 = ["id", "for"];
|
|
2365
2403
|
const _hoisted_3 = ["id", "aria-controls", "placeholder"];
|
|
@@ -2410,7 +2448,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2410
2448
|
hasHintLabelOrSlot,
|
|
2411
2449
|
hasInvalidLabelOrSlot,
|
|
2412
2450
|
hintSlotScope
|
|
2413
|
-
} = HintSlotFactory(
|
|
2451
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
2414
2452
|
const inputEl = ref(null);
|
|
2415
2453
|
const inputSearchEl = ref(null);
|
|
2416
2454
|
const wrapperEl = ref(null);
|
|
@@ -2459,7 +2497,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2459
2497
|
expanded.value = false;
|
|
2460
2498
|
};
|
|
2461
2499
|
const onAfterExpand = () => {
|
|
2462
|
-
if (
|
|
2500
|
+
if (propsDefaults.value.searchable) {
|
|
2463
2501
|
if (inputSearchEl.value) {
|
|
2464
2502
|
inputSearchEl.value.focus({
|
|
2465
2503
|
preventScroll: true
|
|
@@ -2468,7 +2506,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2468
2506
|
}
|
|
2469
2507
|
};
|
|
2470
2508
|
const onAfterCollapse = () => {
|
|
2471
|
-
if (
|
|
2509
|
+
if (propsDefaults.value.searchable) {
|
|
2472
2510
|
searchText.value = "";
|
|
2473
2511
|
}
|
|
2474
2512
|
};
|
|
@@ -2482,14 +2520,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2482
2520
|
loading,
|
|
2483
2521
|
valid,
|
|
2484
2522
|
invalid,
|
|
2485
|
-
floating
|
|
2486
|
-
searchable
|
|
2523
|
+
floating
|
|
2487
2524
|
} = toRefs(props);
|
|
2488
2525
|
const hasId = useUniqueId(id);
|
|
2489
2526
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
2490
2527
|
const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
|
|
2491
2528
|
const hasSearchId = computed(() => `${hasId.value}-search`);
|
|
2492
2529
|
const hasLabelId = computed(() => `${hasId.value}-label`);
|
|
2530
|
+
const localLoading = ref(false);
|
|
2531
|
+
const isLoading = computed(() => localLoading.value || loading.value);
|
|
2493
2532
|
const dropdownEl = ref();
|
|
2494
2533
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
2495
2534
|
icon,
|
|
@@ -2504,7 +2543,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2504
2543
|
modifiers,
|
|
2505
2544
|
computed(() => ({
|
|
2506
2545
|
disabled: disabled.value,
|
|
2507
|
-
loading:
|
|
2546
|
+
loading: isLoading.value,
|
|
2508
2547
|
readonly: readonly.value,
|
|
2509
2548
|
"icon-before": Boolean(hasIconBefore.value),
|
|
2510
2549
|
"icon-after": Boolean(hasIconAfter.value),
|
|
@@ -2522,8 +2561,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2522
2561
|
getOptionDisabled,
|
|
2523
2562
|
getOptionGrouped
|
|
2524
2563
|
} = useOptions(props);
|
|
2525
|
-
const filteredOptions =
|
|
2564
|
+
const filteredOptions = computedAsync(async () => {
|
|
2526
2565
|
var _a;
|
|
2566
|
+
if (propsDefaults.value.searchFunction) {
|
|
2567
|
+
localLoading.value = true;
|
|
2568
|
+
const toReturn = await Promise.resolve(
|
|
2569
|
+
propsDefaults.value.searchFunction(
|
|
2570
|
+
debouncedSearchText.value,
|
|
2571
|
+
props.options
|
|
2572
|
+
)
|
|
2573
|
+
);
|
|
2574
|
+
localLoading.value = false;
|
|
2575
|
+
return toReturn;
|
|
2576
|
+
}
|
|
2527
2577
|
return (_a = props.options) == null ? void 0 : _a.filter((option) => {
|
|
2528
2578
|
return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
|
|
2529
2579
|
});
|
|
@@ -2600,7 +2650,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2600
2650
|
invalid: invalid.value,
|
|
2601
2651
|
invalidLabel: propsDefaults.value.invalidLabel,
|
|
2602
2652
|
hintLabel: propsDefaults.value.hintLabel,
|
|
2603
|
-
loading:
|
|
2653
|
+
loading: isLoading.value,
|
|
2604
2654
|
loadingLabel: propsDefaults.value.loadingLabel,
|
|
2605
2655
|
disabled: disabled.value,
|
|
2606
2656
|
readonly: readonly.value,
|
|
@@ -2628,7 +2678,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2628
2678
|
flip: propsDefaults.value.flip,
|
|
2629
2679
|
autoPlacement: propsDefaults.value.autoPlacement,
|
|
2630
2680
|
arrow: propsDefaults.value.arrow,
|
|
2631
|
-
autofocusFirst:
|
|
2681
|
+
autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
|
|
2632
2682
|
triggerWidth: propsDefaults.value.triggerWidth,
|
|
2633
2683
|
modifiers: propsDefaults.value.dropdownModifiers
|
|
2634
2684
|
}));
|
|
@@ -2660,7 +2710,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2660
2710
|
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
2661
2711
|
key: 0,
|
|
2662
2712
|
id: unref(hasLabelId),
|
|
2663
|
-
for: unref(searchable
|
|
2713
|
+
for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
|
|
2664
2714
|
}, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("", true),
|
|
2665
2715
|
createElementVNode("div", {
|
|
2666
2716
|
ref_key: "wrapperEl",
|
|
@@ -2734,107 +2784,110 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2734
2784
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2735
2785
|
])) : createCommentVNode("", true)
|
|
2736
2786
|
]),
|
|
2737
|
-
items: withCtx(() =>
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2787
|
+
items: withCtx(() => {
|
|
2788
|
+
var _a;
|
|
2789
|
+
return [
|
|
2790
|
+
((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
|
|
2791
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
2792
|
+
isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2793
|
+
createVNode(_sfc_main$5, {
|
|
2794
|
+
label: unref(getOptionLabel)(option)
|
|
2795
|
+
}, null, 8, ["label"]),
|
|
2796
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
|
|
2797
|
+
option
|
|
2798
|
+
), (item, i) => {
|
|
2799
|
+
return openBlock(), createBlock(_sfc_main$6, mergeProps({
|
|
2800
|
+
disabled: unref(getOptionDisabled)(item),
|
|
2801
|
+
selected: getOptionSelected(item),
|
|
2802
|
+
unselectable: _ctx.unselectable,
|
|
2803
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
2804
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
2805
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
2806
|
+
}, {
|
|
2807
|
+
key: i,
|
|
2808
|
+
class: "vv-dropdown-option",
|
|
2809
|
+
onClickPassive: ($event) => onInput(item)
|
|
2810
|
+
}), {
|
|
2811
|
+
default: withCtx(() => [
|
|
2812
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
2813
|
+
option,
|
|
2814
|
+
selectedOptions: unref(selectedOptions),
|
|
2815
|
+
selected: getOptionSelected(item),
|
|
2816
|
+
disabled: unref(getOptionDisabled)(item)
|
|
2817
|
+
})), () => [
|
|
2818
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
|
|
2819
|
+
])
|
|
2820
|
+
]),
|
|
2821
|
+
_: 2
|
|
2822
|
+
}, 1040, ["onClickPassive"]);
|
|
2823
|
+
}), 128))
|
|
2824
|
+
], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
|
|
2825
|
+
disabled: unref(getOptionDisabled)(option),
|
|
2826
|
+
selected: getOptionSelected(option),
|
|
2827
|
+
unselectable: _ctx.unselectable,
|
|
2828
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
2829
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
2830
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
2831
|
+
}, {
|
|
2832
|
+
class: "vv-dropdown-option",
|
|
2833
|
+
onClickPassive: ($event) => onInput(option)
|
|
2834
|
+
}), {
|
|
2835
|
+
default: withCtx(() => [
|
|
2836
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
2837
|
+
option,
|
|
2838
|
+
selectedOptions: unref(selectedOptions),
|
|
2839
|
+
selected: getOptionSelected(option),
|
|
2840
|
+
disabled: unref(getOptionDisabled)(option)
|
|
2841
|
+
})), () => [
|
|
2842
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
|
|
2843
|
+
])
|
|
2844
|
+
]),
|
|
2845
|
+
_: 2
|
|
2846
|
+
}, 1040, ["onClickPassive"]))
|
|
2847
|
+
], 64);
|
|
2848
|
+
}), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
|
|
2849
|
+
key: 1,
|
|
2850
|
+
modifiers: "inert"
|
|
2851
|
+
}, {
|
|
2852
|
+
default: withCtx(() => [
|
|
2853
|
+
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
2854
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
|
|
2855
|
+
])
|
|
2856
|
+
]),
|
|
2857
|
+
_: 3
|
|
2858
|
+
})) : (openBlock(), createBlock(_sfc_main$6, {
|
|
2859
|
+
key: 2,
|
|
2860
|
+
modifiers: "inert"
|
|
2861
|
+
}, {
|
|
2862
|
+
default: withCtx(() => [
|
|
2863
|
+
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
2864
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
|
|
2865
|
+
])
|
|
2866
|
+
]),
|
|
2867
|
+
_: 3
|
|
2868
|
+
}))
|
|
2869
|
+
];
|
|
2870
|
+
}),
|
|
2818
2871
|
after: withCtx(() => [
|
|
2819
2872
|
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
2820
2873
|
var _a;
|
|
2821
2874
|
return [
|
|
2822
2875
|
((_a = unref(dropdownEl)) == null ? void 0 : _a.customPosition) ? (openBlock(), createBlock(_sfc_main$1, {
|
|
2823
2876
|
key: 0,
|
|
2824
|
-
label:
|
|
2877
|
+
label: unref(propsDefaults).closeLabel,
|
|
2825
2878
|
modifiers: "secondary",
|
|
2826
2879
|
onClick: _cache[1] || (_cache[1] = ($event) => unref(dropdownEl).hide())
|
|
2827
|
-
})) : createCommentVNode("", true)
|
|
2880
|
+
}, null, 8, ["label"])) : createCommentVNode("", true)
|
|
2828
2881
|
];
|
|
2829
2882
|
})
|
|
2830
2883
|
]),
|
|
2831
2884
|
_: 2
|
|
2832
2885
|
}, [
|
|
2833
|
-
unref(searchable
|
|
2886
|
+
unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
|
|
2834
2887
|
name: "before",
|
|
2835
2888
|
fn: withCtx(() => [
|
|
2836
2889
|
renderSlot(_ctx.$slots, "dropdown::before"),
|
|
2837
|
-
unref(searchable
|
|
2890
|
+
unref(propsDefaults).searchable ? withDirectives((openBlock(), createElementBlock("input", {
|
|
2838
2891
|
key: 0,
|
|
2839
2892
|
id: unref(hasSearchId),
|
|
2840
2893
|
ref_key: "inputSearchEl",
|
|
@@ -2848,7 +2901,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2848
2901
|
class: "vv-dropdown__search",
|
|
2849
2902
|
placeholder: unref(propsDefaults).searchPlaceholder
|
|
2850
2903
|
}, null, 8, _hoisted_3)), [
|
|
2851
|
-
[vShow, unref(expanded)],
|
|
2852
2904
|
[vModelText, unref(searchText)]
|
|
2853
2905
|
]) : createCommentVNode("", true)
|
|
2854
2906
|
]),
|