@volverjs/ui-vue 0.0.10-beta.1 → 0.0.10-beta.10
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 +64 -1
- package/auto-imports.d.ts +1 -1
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +34 -19
- package/dist/components/VvAccordion/VvAccordion.es.js +33 -4
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -4
- package/dist/components/VvAccordion/index.d.ts +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +75 -27
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +5 -5
- package/dist/components/VvAction/VvAction.es.js +26 -4
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +17 -4
- package/dist/components/VvAction/index.d.ts +5 -0
- package/dist/components/VvAlert/VvAlert.es.js +96 -45
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +4 -4
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +136 -66
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +4 -4
- package/dist/components/VvAvatar/VvAvatar.es.js +22 -1
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +79 -28
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +39 -8
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +224 -41
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +14 -3
- package/dist/components/VvBreadcrumb/index.d.ts +2 -9
- package/dist/components/VvButton/VvButton.es.js +67 -22
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +25 -9
- package/dist/components/VvButton/index.d.ts +5 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -6
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +6 -6
- package/dist/components/VvCard/VvCard.es.js +47 -16
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +32 -4
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +8 -8
- package/dist/components/VvCheckbox/index.d.ts +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +101 -46
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +625 -379
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +112 -112
- package/dist/components/VvCombobox/index.d.ts +32 -32
- package/dist/components/VvDialog/VvDialog.es.js +65 -27
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
- package/dist/components/VvDropdown/VvDropdown.es.js +87 -46
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +203 -189
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +12 -0
- package/dist/components/VvDropdown/index.d.ts +32 -32
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +46 -12
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +13 -7
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +28 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +40 -8
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +1 -1
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +149 -99
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
- package/dist/components/VvInputText/index.d.ts +8 -2
- package/dist/components/VvNav/VvNav.es.js +115 -63
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +31 -12
- package/dist/components/VvNav/VvNavItem.vue.d.ts +9 -0
- package/dist/components/VvNav/index.d.ts +1 -12
- package/dist/components/VvNavItem/VvNavItem.es.js +413 -0
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.es.js +24 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -0
- package/dist/components/VvProgress/VvProgress.es.js +33 -6
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +32 -4
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +8 -8
- package/dist/components/VvRadio/index.d.ts +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +101 -46
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +156 -96
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +1 -1
- package/dist/components/VvTab/VvTab.es.js +214 -99
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +40 -11
- package/dist/components/VvTab/index.d.ts +9 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +123 -77
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTooltip/VvTooltip.es.js +40 -9
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +1583 -991
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +60 -23
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +58 -18
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +19 -16
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +58 -34
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +50 -15
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +332 -83
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/Tab/Tab.settings.d.ts +4 -37
- package/dist/types/alert.d.ts +13 -0
- package/dist/types/floating-ui.d.ts +6 -0
- package/dist/types/generic.d.ts +4 -0
- package/dist/types/group.d.ts +37 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/nav.d.ts +17 -0
- package/package.json +60 -51
- package/src/Volver.ts +22 -16
- 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/VvAccordion/VvAccordion.vue +2 -2
- package/src/components/VvAction/VvAction.vue +5 -2
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
- package/src/components/VvBreadcrumb/index.ts +2 -8
- package/src/components/VvCombobox/VvCombobox.vue +19 -8
- package/src/components/VvCombobox/index.ts +4 -0
- package/src/components/VvInputText/VvInputText.vue +2 -2
- package/src/components/VvNav/VvNav.vue +30 -50
- package/src/components/VvNav/VvNavItem.vue +18 -0
- package/src/components/VvNav/VvNavSeparator.vue +11 -0
- package/src/components/VvNav/index.ts +2 -15
- package/src/components/VvTab/VvTab.vue +63 -35
- package/src/components/VvTab/index.ts +10 -4
- package/src/components/VvTextarea/VvTextarea.vue +1 -1
- package/src/composables/useUniqueId.ts +2 -2
- package/src/directives/index.ts +1 -4
- package/src/directives/v-tooltip.ts +19 -10
- package/src/index.ts +3 -1
- package/src/props/index.ts +27 -3
- package/src/stories/Button/ButtonModifiers.stories.ts +4 -14
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Nav/Nav.settings.ts +3 -4
- package/src/stories/Nav/Nav.test.ts +4 -15
- package/src/stories/Tab/Tab.settings.ts +9 -9
- package/src/stories/Tab/Tab.stories.ts +2 -2
- package/src/stories/Tab/Tab.test.ts +6 -14
- package/src/stories/argTypes.ts +1 -1
- package/src/types/generic.ts +6 -0
- package/src/types/index.ts +5 -0
- package/src/types/nav.ts +19 -0
- package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
- package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
- package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
- package/src/components/VvNav/VvNavItemTitle.vue +0 -11
- package/src/components/VvNav/VvNavSeparator.ts +0 -8
- package/src/types/generic.d.ts +0 -6
- /package/dist/components/VvNav/{VvNavSeparator.d.ts → VvNavSeparator.vue.d.ts} +0 -0
- /package/src/types/{alert.d.ts → alert.ts} +0 -0
- /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
- /package/src/types/{group.d.ts → group.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unref, computed, isRef, defineComponent, h, inject, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, onMounted, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withModifiers, createTextVNode, createVNode, createSlots, withCtx } from "vue";
|
|
2
2
|
import { useIMask } from "vue-imask";
|
|
3
3
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
4
|
-
import {
|
|
4
|
+
import { uid } from "uid";
|
|
5
5
|
import { useFocus, useElementVisibility } from "@vueuse/core";
|
|
6
6
|
function isEmpty(value) {
|
|
7
7
|
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));
|
|
@@ -255,6 +255,13 @@ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
|
255
255
|
ButtonType2["reset"] = "reset";
|
|
256
256
|
return ButtonType2;
|
|
257
257
|
})(ButtonType || {});
|
|
258
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
259
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
260
|
+
ActionTag2["routerLink"] = "router-link";
|
|
261
|
+
ActionTag2["a"] = "a";
|
|
262
|
+
ActionTag2["button"] = "button";
|
|
263
|
+
return ActionTag2;
|
|
264
|
+
})(ActionTag || {});
|
|
258
265
|
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
259
266
|
AnchorTarget2["_blank"] = "_blank";
|
|
260
267
|
AnchorTarget2["_self"] = "_self";
|
|
@@ -381,7 +388,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
381
388
|
color: _ctx.color,
|
|
382
389
|
onLoad: _ctx.onLoad,
|
|
383
390
|
icon: unref(icon)
|
|
384
|
-
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
391
|
+
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
385
392
|
};
|
|
386
393
|
}
|
|
387
394
|
});
|
|
@@ -457,6 +464,12 @@ const ActiveProps = {
|
|
|
457
464
|
*/
|
|
458
465
|
active: Boolean
|
|
459
466
|
};
|
|
467
|
+
const CurrentProps = {
|
|
468
|
+
/**
|
|
469
|
+
* Whether the item is current
|
|
470
|
+
*/
|
|
471
|
+
current: Boolean
|
|
472
|
+
};
|
|
460
473
|
const PressedProps = {
|
|
461
474
|
/**
|
|
462
475
|
* Whether the item is pressed
|
|
@@ -701,6 +714,7 @@ const InputTextareaProps = {
|
|
|
701
714
|
...LabelProps,
|
|
702
715
|
...PressedProps,
|
|
703
716
|
...ActiveProps,
|
|
717
|
+
...CurrentProps,
|
|
704
718
|
...LinkProps,
|
|
705
719
|
/**
|
|
706
720
|
* Button type
|
|
@@ -716,6 +730,13 @@ const InputTextareaProps = {
|
|
|
716
730
|
ariaLabel: {
|
|
717
731
|
type: String,
|
|
718
732
|
default: void 0
|
|
733
|
+
},
|
|
734
|
+
/**
|
|
735
|
+
* Default tag for the action
|
|
736
|
+
*/
|
|
737
|
+
defaultTag: {
|
|
738
|
+
type: String,
|
|
739
|
+
default: ActionTag.button
|
|
719
740
|
}
|
|
720
741
|
});
|
|
721
742
|
const INPUT_TYPES = {
|
|
@@ -1192,7 +1213,7 @@ function useDefaults(componentName, propsDefinition, props) {
|
|
|
1192
1213
|
}, {});
|
|
1193
1214
|
});
|
|
1194
1215
|
}
|
|
1195
|
-
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) ||
|
|
1216
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
|
|
1196
1217
|
function useDebouncedInput(modelValue, emit, ms = 0, {
|
|
1197
1218
|
getter = (value) => value,
|
|
1198
1219
|
setter = (value) => value
|
|
@@ -1482,7 +1503,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1482
1503
|
return;
|
|
1483
1504
|
}
|
|
1484
1505
|
inputEl.value.stepUp();
|
|
1485
|
-
localModelValue.value = unref(inputEl).value;
|
|
1506
|
+
localModelValue.value = Number(unref(inputEl).value);
|
|
1486
1507
|
}
|
|
1487
1508
|
};
|
|
1488
1509
|
const onStepDown = () => {
|
|
@@ -1492,7 +1513,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1492
1513
|
return;
|
|
1493
1514
|
}
|
|
1494
1515
|
inputEl.value.stepDown();
|
|
1495
|
-
localModelValue.value = unref(inputEl).value;
|
|
1516
|
+
localModelValue.value = Number(unref(inputEl).value);
|
|
1496
1517
|
}
|
|
1497
1518
|
};
|
|
1498
1519
|
const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
|
|
@@ -1656,101 +1677,130 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1656
1677
|
emit("keydown", event);
|
|
1657
1678
|
};
|
|
1658
1679
|
return (_ctx, _cache) => {
|
|
1659
|
-
return openBlock(), createElementBlock(
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1680
|
+
return openBlock(), createElementBlock(
|
|
1681
|
+
"div",
|
|
1682
|
+
{
|
|
1683
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
1684
|
+
},
|
|
1685
|
+
[
|
|
1686
|
+
unref(label) ? (openBlock(), createElementBlock("label", {
|
|
1687
|
+
key: 0,
|
|
1688
|
+
for: unref(hasId),
|
|
1689
|
+
class: "vv-input-text__label"
|
|
1690
|
+
}, toDisplayString(unref(label)), 9, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
1691
|
+
createElementVNode("div", _hoisted_2, [
|
|
1692
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
1693
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1694
|
+
])) : createCommentVNode("v-if", true),
|
|
1695
|
+
createElementVNode("div", {
|
|
1696
|
+
ref_key: "innerEl",
|
|
1697
|
+
ref: innerEl,
|
|
1698
|
+
class: "vv-input-text__inner",
|
|
1699
|
+
onClick: withModifiers(onClickInner, ["stop"])
|
|
1700
|
+
}, [
|
|
1701
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
1702
|
+
_sfc_main$1,
|
|
1703
|
+
mergeProps({
|
|
1704
|
+
key: 0,
|
|
1705
|
+
class: "vv-input-text__icon"
|
|
1706
|
+
}, unref(hasIcon)),
|
|
1707
|
+
null,
|
|
1708
|
+
16
|
|
1709
|
+
/* FULL_PROPS */
|
|
1710
|
+
)) : createCommentVNode("v-if", true),
|
|
1711
|
+
createElementVNode("input", mergeProps({
|
|
1712
|
+
id: unref(hasId),
|
|
1713
|
+
ref_key: "inputEl",
|
|
1714
|
+
ref: inputEl
|
|
1715
|
+
}, unref(hasAttrs), {
|
|
1716
|
+
style: unref(hasStyle),
|
|
1717
|
+
onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
|
|
1718
|
+
onKeydown: onKeyDown,
|
|
1719
|
+
onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
|
|
1720
|
+
}), null, 16, _hoisted_5),
|
|
1721
|
+
(_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
1722
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
1723
|
+
createTextVNode(
|
|
1724
|
+
toDisplayString(_ctx.unit),
|
|
1725
|
+
1
|
|
1726
|
+
/* TEXT */
|
|
1727
|
+
)
|
|
1728
|
+
])
|
|
1729
|
+
])) : createCommentVNode("v-if", true)
|
|
1730
|
+
], 8, _hoisted_4),
|
|
1731
|
+
unref(hasIconAfter) || unref(defaultAfterIcon) ? (openBlock(), createBlock(
|
|
1732
|
+
_sfc_main$1,
|
|
1733
|
+
mergeProps({
|
|
1734
|
+
key: 1,
|
|
1735
|
+
class: "vv-input-text__icon vv-input-text__icon-after"
|
|
1736
|
+
}, unref(hasIconAfter) ? unref(hasIcon) : unref(defaultAfterIcon)),
|
|
1737
|
+
null,
|
|
1738
|
+
16
|
|
1739
|
+
/* FULL_PROPS */
|
|
1740
|
+
)) : unref(isPassword) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(PasswordInputActions), {
|
|
1741
|
+
key: 2,
|
|
1742
|
+
onTogglePassword
|
|
1743
|
+
})) : unref(isNumber) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(NumberInputActions), {
|
|
1744
|
+
key: 3,
|
|
1745
|
+
onStepUp,
|
|
1746
|
+
onStepDown
|
|
1747
|
+
})) : unref(isSearch) && !_ctx.hideActions && unref(isClickable) ? (openBlock(), createBlock(unref(SearchInputActions), {
|
|
1748
|
+
key: 4,
|
|
1749
|
+
onClear
|
|
1750
|
+
})) : createCommentVNode("v-if", true),
|
|
1751
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
1752
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1753
|
+
])) : createCommentVNode("v-if", true),
|
|
1754
|
+
unref(count) ? (openBlock(), createElementBlock("span", _hoisted_8, [
|
|
1755
|
+
renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
1756
|
+
createTextVNode(
|
|
1757
|
+
toDisplayString(unref(countFormatted)),
|
|
1758
|
+
1
|
|
1759
|
+
/* TEXT */
|
|
1760
|
+
)
|
|
1694
1761
|
])
|
|
1695
|
-
])) : createCommentVNode("", true)
|
|
1696
|
-
]
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
class: "vv-input-
|
|
1700
|
-
},
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
} : void 0,
|
|
1738
|
-
_ctx.$slots.valid ? {
|
|
1739
|
-
name: "valid",
|
|
1740
|
-
fn: withCtx(() => [
|
|
1741
|
-
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1742
|
-
]),
|
|
1743
|
-
key: "2"
|
|
1744
|
-
} : void 0,
|
|
1745
|
-
_ctx.$slots.invalid ? {
|
|
1746
|
-
name: "invalid",
|
|
1747
|
-
fn: withCtx(() => [
|
|
1748
|
-
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1749
|
-
]),
|
|
1750
|
-
key: "3"
|
|
1751
|
-
} : void 0
|
|
1752
|
-
]), 1032, ["id"])
|
|
1753
|
-
], 2);
|
|
1762
|
+
])) : createCommentVNode("v-if", true)
|
|
1763
|
+
]),
|
|
1764
|
+
createVNode(unref(HintSlot), {
|
|
1765
|
+
id: unref(hasHintId),
|
|
1766
|
+
class: "vv-input-text__hint"
|
|
1767
|
+
}, createSlots({
|
|
1768
|
+
_: 2
|
|
1769
|
+
/* DYNAMIC */
|
|
1770
|
+
}, [
|
|
1771
|
+
_ctx.$slots.hint ? {
|
|
1772
|
+
name: "hint",
|
|
1773
|
+
fn: withCtx(() => [
|
|
1774
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1775
|
+
]),
|
|
1776
|
+
key: "0"
|
|
1777
|
+
} : void 0,
|
|
1778
|
+
_ctx.$slots.loading ? {
|
|
1779
|
+
name: "loading",
|
|
1780
|
+
fn: withCtx(() => [
|
|
1781
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1782
|
+
]),
|
|
1783
|
+
key: "1"
|
|
1784
|
+
} : void 0,
|
|
1785
|
+
_ctx.$slots.valid ? {
|
|
1786
|
+
name: "valid",
|
|
1787
|
+
fn: withCtx(() => [
|
|
1788
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1789
|
+
]),
|
|
1790
|
+
key: "2"
|
|
1791
|
+
} : void 0,
|
|
1792
|
+
_ctx.$slots.invalid ? {
|
|
1793
|
+
name: "invalid",
|
|
1794
|
+
fn: withCtx(() => [
|
|
1795
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1796
|
+
]),
|
|
1797
|
+
key: "3"
|
|
1798
|
+
} : void 0
|
|
1799
|
+
]), 1032, ["id"])
|
|
1800
|
+
],
|
|
1801
|
+
2
|
|
1802
|
+
/* CLASS */
|
|
1803
|
+
);
|
|
1754
1804
|
};
|
|
1755
1805
|
}
|
|
1756
1806
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("vue-imask"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","vue-imask","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.vueImask,e.vue$1,e.nanoid,e.core)}(this,(function(e,t,l,o,a){"use strict";function n(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function i(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const r={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{});const c=Symbol.for("volver");function v(){return e.inject(c)}function p(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const m=e.defineComponent({name:"VvIcon",props:r,setup(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=v(),{modifiers:r}=e.toRefs(o),u=p("vv-icon",r),s=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${s.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${s.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${s.value}:${a.prefix}:${e}`:e}));function c(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},h={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},S=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},w={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},B={debounce:[Number,String]},E={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},$={tabindex:{type:[String,Number],default:0}},x={floating:Boolean},A={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const T={...{...A,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...$,...g,...y,...f,...h,...k,...b,...w,...L,...B,...E,...x,...S,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button;const P={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},C="eye-on",D="eye-off",I="calendar",O="time",V="color",_={...T,modelValue:[String,Number],type:{type:String,default:P.TEXT,validator:e=>Object.values(P).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:C},iconHidePassword:{type:String,default:D},iconClear:{type:String,default:"close"},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},iMask:{type:Object,default:void 0},masked:{type:String,default:void 0},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String},selectOnFocus:{type:Boolean,default:!1}},N=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:C},iconHide:{type:String,default:D}},emits:["toggle-password"],setup(t,{emit:l}){const o=e.ref(!1),a=e.computed((()=>o.value?t.iconHide:t.iconShow));return{active:o,activeIcon:a,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(o.value=!o.value,l("toggle-password",o.value))}}},render(){const t=e.h(m,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),M=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:l}){const o=e.computed((()=>"up"===t.mode));return{isUp:o,onClick:e=>{null==e||e.stopPropagation(),t.disabled||l(o.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),R=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(l){null==l||l.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(m,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function H(t,l){return{name:"VvInputTextActions",components:{VvIcon:m,VvInputPasswordAction:N,VvInputStepAction:M,VvInputClearAction:R},setup:()=>({isDisabled:e.computed((()=>l.disabled||l.readonly)),labelStepUp:l.labelStepUp,labelStepDown:l.labelStepDown,labelShowPassword:l.labelShowPassword,labelHidePassword:l.labelHidePassword,labelClear:l.labelClear,iconShowPassword:l.iconShowPassword,iconHidePassword:l.iconHidePassword}),render(){let o=null;switch(t){case P.SEARCH:{const{onClear:t}=this.$attrs;o=[e.h(R,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;o=[e.h(N,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case P.NUMBER:{const{onStepUp:t,onStepDown:a}=this.$attrs;o=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==l.max&&l.modelValue===l.max,label:this.labelStepUp,onStepUp:t,onStepDown:a}),e.h(M,{mode:"down",disabled:this.isDisabled||void 0!==l.min&&l.modelValue===l.min,label:this.labelStepDown,onStepUp:t,onStepDown:a})];break}}return Array.isArray(o)?e.h("div",{class:"vv-input-text__actions-group"},o):o}}}const U=["for"],j={class:"vv-input-text__wrapper"},F={key:0,class:"vv-input-text__input-before"},W=["onClick"],q=["id"],z={key:1,class:"vv-input-text__unit"},K={key:5,class:"vv-input-text__input-after"},X={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:_,emits:["update:modelValue","update:masked","accept","accept:typed","accept:masked","accept:unmasked","complete","complete:typed","complete:masked","complete:unmasked","focus","blur","keyup","keydown","keypress"],setup(l,{expose:r,emit:d}){const c=l,f=e.useSlots(),h=function(t,l,o){const a=v(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputText",_,c),{id:b,icon:g,iconPosition:S,label:y,modelValue:w,count:k,valid:L,invalid:B,loading:E,debounce:$,maxlength:x,minlength:A,type:T,iMask:C,step:D}=e.toRefs(c),N=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(b),M=e.computed((()=>`${N.value}-hint`)),R=e.computed((()=>c.floating&&n(c.placeholder)?" ":c.placeholder)),J=e.ref(!1),{el:Y,mask:G,typed:Q,masked:Z,unmasked:ee}=t.useIMask(e.computed((()=>(null==C?void 0:C.value)??{mask:/./})),{emit:d,onAccept:()=>{if(J.value){if(d("update:masked",Z.value),T.value===P.NUMBER){if(""===Z.value){if(null===oe.value||void 0===oe.value)return;return void(oe.value=void 0)}return"number"!=typeof Q.value?void(oe.value=Number(Q.value)):void(oe.value=Q.value)}if(T.value===P.DATE){if(Y.value instanceof HTMLInputElement&&"date"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return e instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}`)}if(T.value===P.DATETIME_LOCAL){if(Y.value instanceof HTMLInputElement&&"datetime-local"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return Q.value instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}T${("0"+e.getHours()).slice(-2)}:${("0"+e.getMinutes()).slice(-2)}`)}(oe.value||ee.value)&&(oe.value=ee.value)}}});e.onMounted((()=>{G.value&&(J.value=!0,Q.value=oe.value??"")})),e.watch((()=>c.modelValue),(e=>{var t;G.value&&(Q.value=e&&(null==(t=null==C?void 0:C.value)?void 0:t.mask)===Date?new Date(e):e??"")})),e.watch((()=>c.masked),(e=>{Z.value=e??""}));const te=Y,le=e.ref();r({$inner:le});const oe=function(t,l,o=0,{getter:a=(e=>e),setter:n=(e=>e)}={}){let i;return"string"==typeof o&&(o=parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{l("update:modelValue",n(e))}),o)}})}(w,d,(null==$?void 0:$.value)??0),{focused:ae}=function(t,l){const{focused:o}=a.useFocus(t);return e.watch(o,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:o}}(te,d),ne=e.computed((()=>ae.value&&!c.disabled&&!c.readonly));e.watch(ne,(e=>{e&&h.value.selectOnFocus&&te.value&&te.value.select()}));const ie=a.useElementVisibility(te);e.watch(ie,(e=>{e&&c.autofocus&&!c.disabled&&!c.readonly&&(ae.value=!0)}));const re=e.ref(!1),ue=e.computed((()=>c.type===P.PASSWORD)),se=()=>{re.value=!re.value},de=e.computed((()=>c.type===P.TIME||c.type===P.DATETIME_LOCAL||c.type===P.DATE||c.type===P.WEEK||c.type===P.MONTH)),ce=e.computed((()=>c.type===P.NUMBER)),ve=()=>{if(we.value){if(null==C?void 0:C.value)return void(Q.value=Q.value+Number((null==D?void 0:D.value)??1));te.value.stepUp(),oe.value=e.unref(te).value}},pe=()=>{if(we.value){if(null==C?void 0:C.value)return void(Q.value=Q.value-Number((null==D?void 0:D.value)??1));te.value.stepDown(),oe.value=e.unref(te).value}},me=e.computed((()=>c.type===P.SEARCH)),fe=()=>{oe.value=""},{hasIcon:he,hasIconBefore:be,hasIconAfter:ge}=function(t,l){const o=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.before))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.after))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.top))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:n,hasIconRight:i,hasIconTop:r,hasIconBottom:d,hasIconBefore:o,hasIconAfter:a}}(g,S),Se=e.computed((()=>{switch(c.type){case P.COLOR:return{name:V};case P.DATE:case P.DATETIME_LOCAL:case P.WEEK:case P.MONTH:return{name:I};case P.TIME:return{name:O};default:return""}})),{formatted:ye}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),n=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:n}}(oe,{mode:k.value,upperLimit:Number(null==x?void 0:x.value),lowerLimit:Number(null==A?void 0:A.value)}),we=e.computed((()=>!c.disabled&&!c.readonly)),ke=e.computed((()=>we.value?c.tabindex:-1)),Le=e.computed((()=>!n(w))),Be=e.computed((()=>!0===B.value||!0!==L.value&&void 0)),{modifiers:Ee}=e.toRefs(c),$e=p("vv-input-text",Ee,e.computed((()=>({valid:L.value,invalid:B.value,loading:E.value,disabled:c.disabled,readonly:c.readonly,"icon-before":be.value,"icon-after":ge.value||!n(Se),floating:c.floating&&!n(c.label),dirty:Le.value,focus:ne.value,"auto-width":c.autoWidth})))),xe=e.computed((()=>{const e=ue.value&&re.value?P.TEXT:!de.value||Le.value||ae.value?(null==C?void 0:C.value)?P.TEXT:c.type:P.TEXT,t={type:e,name:c.name,tabindex:ke.value,disabled:c.disabled,readonly:c.readonly,required:c.required,autocomplete:c.autocomplete,"aria-invalid":Be.value,"aria-describedby":Pe.value?M.value:void 0,"aria-errormessage":Ce.value?M.value:void 0};return e!==P.DATE&&e!==P.MONTH&&e!==P.WEEK&&e!==P.TIME&&e!==P.DATETIME_LOCAL&&e!==P.NUMBER||(t.step=c.step,t.max=void 0!==c.max?String(c.max):void 0,t.min=void 0!==c.min?String(c.min):void 0),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD&&e!==P.NUMBER||(t.placeholder=R.value),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD||(t.minlength=c.minlength,t.maxlength=c.maxlength,t.pattern=c.pattern),e===P.EMAIL&&(t.multiple=c.multiple),t})),Ae=e.computed((()=>({valid:c.valid,invalid:c.invalid,modelValue:c.modelValue,togglePassword:se,stepUp:ve,stepDown:pe,clear:fe}))),{HintSlot:Te,hasHintLabelOrSlot:Pe,hasInvalidLabelOrSlot:Ce,hintSlotScope:De}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>i(o.value.invalidLabel))),n=e.computed((()=>i(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),u=e.computed((()=>o.value.hintLabel)),s=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),d=e.computed((()=>!s.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),c=e.computed((()=>!s.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!s.value&&!d.value&&!c.value&&Boolean(l.hint||u.value))),p=e.computed((()=>d.value||c.value||s.value||v.value)),m=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:p,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:s,hasHintLabelOrSlot:v}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:s,hintSlotScope:m,HintSlot:f}}(h,f),Ie=H(P.PASSWORD,c),Oe=H(P.NUMBER,c),Ve=H(P.SEARCH,c),_e=()=>{we.value&&(ae.value=!0)},Ne=e.computed((()=>{if(c.autoWidth)return{width:void 0!==oe.value?`${String(oe.value).length+1}ch`:void 0}})),Me=e=>{switch(e.code){case"ArrowUp":ce.value&&(ve(),e.preventDefault());break;case"ArrowDown":ce.value&&(pe(),e.preventDefault())}d("keydown",e)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref($e))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(N),class:"vv-input-text__label"},e.toDisplayString(e.unref(y)),9,U)):e.createCommentVNode("",!0),e.createElementVNode("div",j,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:le,class:"vv-input-text__inner",onClick:e.withModifiers(_e,["stop"])},[e.unref(be)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(he)),null,16)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(N),ref_key:"inputEl",ref:te},e.unref(xe),{style:e.unref(Ne),onKeyup:l[0]||(l[0]=e=>d("keyup",e)),onKeydown:Me,onKeypress:l[1]||(l[1]=e=>d("keypress",e))}),null,16,q),(t.unit||t.$slots.unit)&&e.unref(Le)?(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,W),e.unref(ge)||e.unref(Se)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ge)?e.unref(he):e.unref(Se)),null,16)):e.unref(ue)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ie),{key:2,onTogglePassword:se})):e.unref(ce)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Oe),{key:3,onStepUp:ve,onStepDown:pe})):e.unref(me)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ve),{key:4,onClear:fe})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",X,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ye)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(Te),{id:e.unref(M),class:"vv-input-text__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("vue-imask"),require("@iconify/vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","vue-imask","@iconify/vue","uid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.vueImask,e.vue$1,e.uid,e.core)}(this,(function(e,t,l,o,a){"use strict";function n(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function i(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const r={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{}),v=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(v||{});const c=Symbol.for("volver");function p(){return e.inject(c)}function m(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const f=e.defineComponent({name:"VvIcon",props:r,setup(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=p(),{modifiers:r}=e.toRefs(o),u=m("vv-icon",r),s=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${s.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${s.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${s.value}:${a.prefix}:${e}`:e}));function v(e){const t=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),h={valid:Boolean,validLabel:[String,Array]},b={invalid:Boolean,invalidLabel:[String,Array]},g={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},S={disabled:Boolean},y=(Boolean,Boolean,Boolean,{label:[String,Number]}),w={readonly:Boolean},k={modifiers:[String,Array]},L={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},E={debounce:[Number,String]},x={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},$={tabindex:{type:[String,Number],default:0}},A={floating:Boolean},T={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const P={...{...T,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...$,...S,...w,...h,...b,...L,...g,...k,...B,...E,...x,...A,...y,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button,v.button;const C={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},D="eye-on",I="eye-off",O="calendar",N="time",V="color",_={...P,modelValue:[String,Number],type:{type:String,default:C.TEXT,validator:e=>Object.values(C).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:D},iconHidePassword:{type:String,default:I},iconClear:{type:String,default:"close"},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},iMask:{type:Object,default:void 0},masked:{type:String,default:void 0},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String},selectOnFocus:{type:Boolean,default:!1}},M=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:D},iconHide:{type:String,default:I}},emits:["toggle-password"],setup(t,{emit:l}){const o=e.ref(!1),a=e.computed((()=>o.value?t.iconHide:t.iconShow));return{active:o,activeIcon:a,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(o.value=!o.value,l("toggle-password",o.value))}}},render(){const t=e.h(f,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),R=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:l}){const o=e.computed((()=>"up"===t.mode));return{isUp:o,onClick:e=>{null==e||e.stopPropagation(),t.disabled||l(o.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),H=e.defineComponent({components:{VvIcon:f},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(l){null==l||l.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(f,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function U(t,l){return{name:"VvInputTextActions",components:{VvIcon:f,VvInputPasswordAction:M,VvInputStepAction:R,VvInputClearAction:H},setup:()=>({isDisabled:e.computed((()=>l.disabled||l.readonly)),labelStepUp:l.labelStepUp,labelStepDown:l.labelStepDown,labelShowPassword:l.labelShowPassword,labelHidePassword:l.labelHidePassword,labelClear:l.labelClear,iconShowPassword:l.iconShowPassword,iconHidePassword:l.iconHidePassword}),render(){let o=null;switch(t){case C.SEARCH:{const{onClear:t}=this.$attrs;o=[e.h(H,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case C.PASSWORD:{const{onTogglePassword:t}=this.$attrs;o=[e.h(M,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case C.NUMBER:{const{onStepUp:t,onStepDown:a}=this.$attrs;o=[e.h(R,{mode:"up",disabled:this.isDisabled||void 0!==l.max&&l.modelValue===l.max,label:this.labelStepUp,onStepUp:t,onStepDown:a}),e.h(R,{mode:"down",disabled:this.isDisabled||void 0!==l.min&&l.modelValue===l.min,label:this.labelStepDown,onStepUp:t,onStepDown:a})];break}}return Array.isArray(o)?e.h("div",{class:"vv-input-text__actions-group"},o):o}}}const j=["for"],F={class:"vv-input-text__wrapper"},W={key:0,class:"vv-input-text__input-before"},q=["onClick"],z=["id"],K={key:1,class:"vv-input-text__unit"},X={key:5,class:"vv-input-text__input-after"},J={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:_,emits:["update:modelValue","update:masked","accept","accept:typed","accept:masked","accept:unmasked","complete","complete:typed","complete:masked","complete:unmasked","focus","blur","keyup","keydown","keypress"],setup(l,{expose:r,emit:d}){const v=l,c=e.useSlots(),h=function(t,l,o){const a=p(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputText",_,v),{id:b,icon:g,iconPosition:S,label:y,modelValue:w,count:k,valid:L,invalid:B,loading:E,debounce:x,maxlength:$,minlength:A,type:T,iMask:P,step:D}=e.toRefs(v),I=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))))(b),M=e.computed((()=>`${I.value}-hint`)),R=e.computed((()=>v.floating&&n(v.placeholder)?" ":v.placeholder)),H=e.ref(!1),{el:Y,mask:G,typed:Q,masked:Z,unmasked:ee}=t.useIMask(e.computed((()=>(null==P?void 0:P.value)??{mask:/./})),{emit:d,onAccept:()=>{if(H.value){if(d("update:masked",Z.value),T.value===C.NUMBER){if(""===Z.value){if(null===oe.value||void 0===oe.value)return;return void(oe.value=void 0)}return"number"!=typeof Q.value?void(oe.value=Number(Q.value)):void(oe.value=Q.value)}if(T.value===C.DATE){if(Y.value instanceof HTMLInputElement&&"date"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return e instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}`)}if(T.value===C.DATETIME_LOCAL){if(Y.value instanceof HTMLInputElement&&"datetime-local"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return Q.value instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}T${("0"+e.getHours()).slice(-2)}:${("0"+e.getMinutes()).slice(-2)}`)}(oe.value||ee.value)&&(oe.value=ee.value)}}});e.onMounted((()=>{G.value&&(H.value=!0,Q.value=oe.value??"")})),e.watch((()=>v.modelValue),(e=>{var t;G.value&&(Q.value=e&&(null==(t=null==P?void 0:P.value)?void 0:t.mask)===Date?new Date(e):e??"")})),e.watch((()=>v.masked),(e=>{Z.value=e??""}));const te=Y,le=e.ref();r({$inner:le});const oe=function(t,l,o=0,{getter:a=(e=>e),setter:n=(e=>e)}={}){let i;return"string"==typeof o&&(o=parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{l("update:modelValue",n(e))}),o)}})}(w,d,(null==x?void 0:x.value)??0),{focused:ae}=function(t,l){const{focused:o}=a.useFocus(t);return e.watch(o,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:o}}(te,d),ne=e.computed((()=>ae.value&&!v.disabled&&!v.readonly));e.watch(ne,(e=>{e&&h.value.selectOnFocus&&te.value&&te.value.select()}));const ie=a.useElementVisibility(te);e.watch(ie,(e=>{e&&v.autofocus&&!v.disabled&&!v.readonly&&(ae.value=!0)}));const re=e.ref(!1),ue=e.computed((()=>v.type===C.PASSWORD)),se=()=>{re.value=!re.value},de=e.computed((()=>v.type===C.TIME||v.type===C.DATETIME_LOCAL||v.type===C.DATE||v.type===C.WEEK||v.type===C.MONTH)),ve=e.computed((()=>v.type===C.NUMBER)),ce=()=>{if(we.value){if(null==P?void 0:P.value)return void(Q.value=Q.value+Number((null==D?void 0:D.value)??1));te.value.stepUp(),oe.value=Number(e.unref(te).value)}},pe=()=>{if(we.value){if(null==P?void 0:P.value)return void(Q.value=Q.value-Number((null==D?void 0:D.value)??1));te.value.stepDown(),oe.value=Number(e.unref(te).value)}},me=e.computed((()=>v.type===C.SEARCH)),fe=()=>{oe.value=""},{hasIcon:he,hasIconBefore:be,hasIconAfter:ge}=function(t,l){const o=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.before))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.after))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.top))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:n,hasIconRight:i,hasIconTop:r,hasIconBottom:d,hasIconBefore:o,hasIconAfter:a}}(g,S),Se=e.computed((()=>{switch(v.type){case C.COLOR:return{name:V};case C.DATE:case C.DATETIME_LOCAL:case C.WEEK:case C.MONTH:return{name:O};case C.TIME:return{name:N};default:return""}})),{formatted:ye}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),n=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:n}}(oe,{mode:k.value,upperLimit:Number(null==$?void 0:$.value),lowerLimit:Number(null==A?void 0:A.value)}),we=e.computed((()=>!v.disabled&&!v.readonly)),ke=e.computed((()=>we.value?v.tabindex:-1)),Le=e.computed((()=>!n(w))),Be=e.computed((()=>!0===B.value||!0!==L.value&&void 0)),{modifiers:Ee}=e.toRefs(v),xe=m("vv-input-text",Ee,e.computed((()=>({valid:L.value,invalid:B.value,loading:E.value,disabled:v.disabled,readonly:v.readonly,"icon-before":be.value,"icon-after":ge.value||!n(Se),floating:v.floating&&!n(v.label),dirty:Le.value,focus:ne.value,"auto-width":v.autoWidth})))),$e=e.computed((()=>{const e=ue.value&&re.value?C.TEXT:!de.value||Le.value||ae.value?(null==P?void 0:P.value)?C.TEXT:v.type:C.TEXT,t={type:e,name:v.name,tabindex:ke.value,disabled:v.disabled,readonly:v.readonly,required:v.required,autocomplete:v.autocomplete,"aria-invalid":Be.value,"aria-describedby":Pe.value?M.value:void 0,"aria-errormessage":Ce.value?M.value:void 0};return e!==C.DATE&&e!==C.MONTH&&e!==C.WEEK&&e!==C.TIME&&e!==C.DATETIME_LOCAL&&e!==C.NUMBER||(t.step=v.step,t.max=void 0!==v.max?String(v.max):void 0,t.min=void 0!==v.min?String(v.min):void 0),e!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD&&e!==C.NUMBER||(t.placeholder=R.value),e!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD||(t.minlength=v.minlength,t.maxlength=v.maxlength,t.pattern=v.pattern),e===C.EMAIL&&(t.multiple=v.multiple),t})),Ae=e.computed((()=>({valid:v.valid,invalid:v.invalid,modelValue:v.modelValue,togglePassword:se,stepUp:ce,stepDown:pe,clear:fe}))),{HintSlot:Te,hasHintLabelOrSlot:Pe,hasInvalidLabelOrSlot:Ce,hintSlotScope:De}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>i(o.value.invalidLabel))),n=e.computed((()=>i(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),u=e.computed((()=>o.value.hintLabel)),s=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),d=e.computed((()=>!s.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),v=e.computed((()=>!s.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!s.value&&!d.value&&!v.value&&Boolean(l.hint||u.value))),p=e.computed((()=>d.value||v.value||s.value||c.value)),m=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:p,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:s,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:s,hintSlotScope:m,HintSlot:f}}(h,c),Ie=U(C.PASSWORD,v),Oe=U(C.NUMBER,v),Ne=U(C.SEARCH,v),Ve=()=>{we.value&&(ae.value=!0)},_e=e.computed((()=>{if(v.autoWidth)return{width:void 0!==oe.value?`${String(oe.value).length+1}ch`:void 0}})),Me=e=>{switch(e.code){case"ArrowUp":ve.value&&(ce(),e.preventDefault());break;case"ArrowDown":ve.value&&(pe(),e.preventDefault())}d("keydown",e)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(xe))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(I),class:"vv-input-text__label"},e.toDisplayString(e.unref(y)),9,j)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",F,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",W,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:le,class:"vv-input-text__inner",onClick:e.withModifiers(Ve,["stop"])},[e.unref(be)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(he)),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(I),ref_key:"inputEl",ref:te},e.unref($e),{style:e.unref(_e),onKeyup:l[0]||(l[0]=e=>d("keyup",e)),onKeydown:Me,onKeypress:l[1]||(l[1]=e=>d("keypress",e))}),null,16,z),(t.unit||t.$slots.unit)&&e.unref(Le)?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("v-if",!0)],8,q),e.unref(ge)||e.unref(Se)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ge)?e.unref(he):e.unref(Se)),null,16)):e.unref(ue)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ie),{key:2,onTogglePassword:se})):e.unref(ve)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Oe),{key:3,onStepUp:ce,onStepDown:pe})):e.unref(me)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ne),{key:4,onClear:fe})):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",J,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ye)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(Te),{id:e.unref(M),class:"vv-input-text__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
@@ -120,7 +120,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
120
120
|
id: (StringConstructor | NumberConstructor)[];
|
|
121
121
|
}, {
|
|
122
122
|
$inner: globalThis.Ref<any>;
|
|
123
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
123
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
124
|
+
[x: string]: (...args: any[]) => void;
|
|
125
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
124
126
|
modelValue: (StringConstructor | NumberConstructor)[];
|
|
125
127
|
type: {
|
|
126
128
|
type: globalThis.PropType<import("../VvInputText").InputType>;
|
|
@@ -240,24 +242,22 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
240
242
|
required: boolean;
|
|
241
243
|
};
|
|
242
244
|
id: (StringConstructor | NumberConstructor)[];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
}, {
|
|
245
|
+
}>>, {
|
|
246
|
+
readonly: boolean;
|
|
246
247
|
disabled: boolean;
|
|
248
|
+
valid: boolean;
|
|
249
|
+
invalid: boolean;
|
|
250
|
+
multiple: boolean;
|
|
247
251
|
floating: boolean;
|
|
248
252
|
type: import("../VvInputText").InputType;
|
|
249
|
-
tabindex: string | number;
|
|
250
253
|
required: boolean;
|
|
251
254
|
iconPosition: "before" | "after";
|
|
252
|
-
autofocus: boolean;
|
|
253
255
|
loading: boolean;
|
|
254
256
|
loadingLabel: string;
|
|
255
|
-
multiple: boolean;
|
|
256
|
-
readonly: boolean;
|
|
257
257
|
hintLabel: string;
|
|
258
|
-
|
|
259
|
-
valid: boolean;
|
|
258
|
+
tabindex: string | number;
|
|
260
259
|
autocomplete: string;
|
|
260
|
+
autofocus: boolean;
|
|
261
261
|
step: string | number;
|
|
262
262
|
iconShowPassword: string;
|
|
263
263
|
iconHidePassword: string;
|
|
@@ -202,7 +202,11 @@ export declare const VvInputTextProps: {
|
|
|
202
202
|
};
|
|
203
203
|
hintLabel: {
|
|
204
204
|
type: StringConstructor;
|
|
205
|
-
default: string;
|
|
205
|
+
default: string; /**
|
|
206
|
+
* Whether to allow multiple values
|
|
207
|
+
* Available for input type email
|
|
208
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#multiple
|
|
209
|
+
*/
|
|
206
210
|
};
|
|
207
211
|
invalid: BooleanConstructor;
|
|
208
212
|
invalidLabel: (ArrayConstructor | StringConstructor)[];
|
|
@@ -212,7 +216,9 @@ export declare const VvInputTextProps: {
|
|
|
212
216
|
disabled: BooleanConstructor;
|
|
213
217
|
tabindex: {
|
|
214
218
|
type: (StringConstructor | NumberConstructor)[];
|
|
215
|
-
default: number;
|
|
219
|
+
default: number; /**
|
|
220
|
+
* Hide type number, password and search actions
|
|
221
|
+
*/
|
|
216
222
|
};
|
|
217
223
|
autocomplete: {
|
|
218
224
|
type: StringConstructor;
|