@volverjs/ui-vue 0.0.6-beta.5 → 0.0.6-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/auto-imports.d.ts +9 -0
  2. package/dist/Volver.d.ts +1 -1
  3. package/dist/components/VvAccordion/index.d.ts +1 -1
  4. package/dist/components/VvButton/VvButton.es.js +25 -19
  5. package/dist/components/VvButton/VvButton.umd.js +1 -1
  6. package/dist/components/VvCheckbox/VvCheckbox.es.js +151 -98
  7. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  8. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +37 -1
  9. package/dist/components/VvCheckbox/index.d.ts +6 -1
  10. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +187 -101
  11. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  12. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +36 -0
  13. package/dist/components/VvCheckboxGroup/index.d.ts +5 -0
  14. package/dist/components/VvCombobox/VvCombobox.es.js +236 -140
  15. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  16. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +25 -1
  17. package/dist/components/VvDialog/VvDialog.es.js +25 -19
  18. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  19. package/dist/components/VvDropdown/VvDropdown.es.js +19 -4
  20. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  21. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +8 -4
  22. package/dist/components/VvDropdown/index.d.ts +1 -1
  23. package/dist/components/VvIcon/VvIcon.es.js +25 -19
  24. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  25. package/dist/components/VvIcon/VvIcon.vue.d.ts +2 -2
  26. package/dist/components/VvIcon/index.d.ts +2 -2
  27. package/dist/components/VvInputText/VvInputText.es.js +160 -136
  28. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  29. package/dist/components/VvInputText/VvInputText.vue.d.ts +24 -0
  30. package/dist/components/VvRadio/VvRadio.es.js +151 -98
  31. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  32. package/dist/components/VvRadio/VvRadio.vue.d.ts +37 -1
  33. package/dist/components/VvRadio/index.d.ts +6 -1
  34. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +187 -101
  35. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  36. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +36 -0
  37. package/dist/components/VvRadioGroup/index.d.ts +5 -0
  38. package/dist/components/VvSelect/VvSelect.es.js +163 -137
  39. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  40. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -0
  41. package/dist/components/VvTextarea/VvTextarea.es.js +160 -136
  42. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  43. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +24 -0
  44. package/dist/components/common/HintSlot.d.ts +38 -12
  45. package/dist/components/index.es.js +466 -168
  46. package/dist/components/index.umd.js +1 -1
  47. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  48. package/dist/composables/useOptions.d.ts +2 -2
  49. package/dist/directives/index.d.ts +2 -2
  50. package/dist/icons.es.js +3 -3
  51. package/dist/icons.umd.js +1 -1
  52. package/dist/props/index.d.ts +22 -0
  53. package/package.json +33 -33
  54. package/src/assets/icons/detailed.json +1 -1
  55. package/src/assets/icons/normal.json +1 -1
  56. package/src/assets/icons/simple.json +1 -1
  57. package/src/components/VvCheckbox/VvCheckbox.vue +23 -2
  58. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +15 -2
  59. package/src/components/VvCombobox/VvCombobox.vue +40 -16
  60. package/src/components/VvDropdown/VvDropdown.vue +20 -2
  61. package/src/components/VvIcon/VvIcon.vue +37 -34
  62. package/src/components/VvIcon/index.ts +2 -2
  63. package/src/components/VvInputText/VvInputText.vue +26 -9
  64. package/src/components/VvRadio/VvRadio.vue +23 -2
  65. package/src/components/VvRadioGroup/VvRadioGroup.vue +15 -2
  66. package/src/components/VvSelect/VvSelect.vue +26 -9
  67. package/src/components/VvTextarea/VvTextarea.vue +26 -9
  68. package/src/components/common/HintSlot.ts +129 -170
  69. package/src/composables/useOptions.ts +9 -7
  70. package/src/props/index.ts +2 -0
@@ -1,138 +1,122 @@
1
- import { unref, toRefs, computed, h, inject, defineComponent, ref, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withModifiers, withDirectives, isRef, vModelDynamic, createTextVNode, createVNode } from "vue";
1
+ import { unref, computed, defineComponent, h, inject, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withModifiers, withDirectives, isRef, vModelDynamic, createTextVNode, createVNode, createSlots, withCtx } from "vue";
2
2
  import { Mask } from "maska";
3
- import { toReactive, useFocus, useElementVisibility } from "@vueuse/core";
4
3
  import { iconExists, Icon, addIcon } from "@iconify/vue";
5
4
  import { nanoid } from "nanoid";
6
- function resolveFieldData(data, field) {
7
- if (data && Object.keys(data).length && field) {
8
- if (field.indexOf(".") === -1) {
9
- return data[field];
10
- } else {
11
- const fields = field.split(".");
12
- let value = data;
13
- for (let i = 0, len = fields.length; i < len; ++i) {
14
- if (data == null) {
15
- return null;
16
- }
17
- value = value[fields[i]];
18
- }
19
- return value;
20
- }
21
- } else {
22
- return null;
23
- }
24
- }
5
+ import { useFocus, useElementVisibility } from "@vueuse/core";
25
6
  function isEmpty(value) {
26
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));
27
8
  }
28
9
  function isString(value) {
29
10
  return typeof value === "string" || value instanceof String;
30
11
  }
31
- function joinLines(errors) {
32
- if (Array.isArray(errors)) {
33
- return errors.filter((e) => isString(e)).join(" ");
12
+ function joinLines(items) {
13
+ if (Array.isArray(items)) {
14
+ return items.filter((item) => isString(item)).join(" ");
34
15
  }
35
- return errors;
16
+ return items;
36
17
  }
37
- function HintSlotFactory(parentProps, parentSlots) {
38
- const {
39
- invalid: invalidSlot,
40
- valid: validSlot,
41
- hint: hintSlot,
42
- loading: loadingSlot
43
- } = parentSlots;
44
- const {
45
- hintLabel,
46
- modelValue,
47
- valid,
48
- validLabel,
49
- invalid,
50
- invalidLabel,
51
- ...otherProps
52
- } = toRefs(parentProps);
53
- const loading = resolveFieldData(otherProps, "loading");
54
- const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
55
- const hasInvalid = computed(() => {
56
- if (!invalid.value) {
57
- return false;
58
- }
59
- if (invalid.value && invalidSlot) {
60
- return true;
61
- }
62
- if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
63
- return true;
64
- }
65
- if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
66
- return true;
67
- }
68
- return false;
69
- });
70
- const hasHint = computed(
71
- () => !!(hintLabel && hintLabel.value || hintSlot)
18
+ function HintSlotFactory(props, slots) {
19
+ const invalidLabel = computed(() => joinLines(props.invalidLabel));
20
+ const validLabel = computed(() => joinLines(props.validLabel));
21
+ const loadingLabel = computed(() => props.loadingLabel);
22
+ const hintLabel = computed(() => props.hintLabel);
23
+ const hasLoadingLabelOrSlot = computed(
24
+ () => Boolean(props.loading && (slots.loading || loadingLabel.value))
25
+ );
26
+ const hasInvalidLabelOrSlot = computed(
27
+ () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
72
28
  );
73
- const hasValid = computed(
74
- () => !!(validLabel && validLabel.value || validSlot)
29
+ const hasValidLabelOrSlot = computed(
30
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
75
31
  );
76
- const hasLoading = computed(
77
- () => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
32
+ const hasHintLabelOrSlot = computed(
33
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
78
34
  );
79
35
  const isVisible = computed(
80
- () => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
36
+ () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
81
37
  );
82
- return {
83
- hasInvalid,
84
- hasHint,
85
- hasValid,
86
- hasLoading,
87
- HintSlot: {
88
- name: "HintSlot",
89
- props: {
90
- params: {
91
- type: Object,
92
- default: () => ({})
38
+ const hintSlotScope = computed(() => ({
39
+ modelValue: props.modelValue,
40
+ valid: props.valid,
41
+ invalid: props.invalid,
42
+ loading: props.loading
43
+ }));
44
+ const HintSlot = defineComponent({
45
+ name: "HintSlot",
46
+ props: {
47
+ tag: {
48
+ type: String,
49
+ default: "small"
50
+ }
51
+ },
52
+ setup() {
53
+ return {
54
+ isVisible,
55
+ invalidLabel,
56
+ validLabel,
57
+ loadingLabel,
58
+ hintLabel,
59
+ hasInvalidLabelOrSlot,
60
+ hasValidLabelOrSlot,
61
+ hasLoadingLabelOrSlot,
62
+ hasHintLabelOrSlot
63
+ };
64
+ },
65
+ render() {
66
+ var _a, _b, _c, _d, _e, _f, _g, _h;
67
+ if (this.isVisible) {
68
+ let role;
69
+ if (this.hasInvalidLabelOrSlot) {
70
+ role = "alert";
93
71
  }
94
- },
95
- setup(props) {
96
- const hintContent = computed(() => {
97
- const slotProps = toReactive({
98
- hintLabel,
99
- modelValue,
100
- valid,
101
- validLabel,
102
- invalid,
103
- invalidLabel,
104
- loading,
105
- loadingLabel,
106
- ...props.params
107
- });
108
- if (invalid == null ? void 0 : invalid.value) {
109
- return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
110
- }
111
- if (valid == null ? void 0 : valid.value)
112
- return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
113
- if (loading == null ? void 0 : loading.value)
114
- return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
115
- return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
116
- });
117
- return {
118
- isVisible,
119
- hasInvalid,
120
- hasValid,
121
- hintContent
122
- };
123
- },
124
- render() {
125
- if (this.isVisible) {
72
+ if (this.hasValidLabelOrSlot) {
73
+ role = "status";
74
+ }
75
+ if (this.hasLoadingLabelOrSlot) {
76
+ return h(
77
+ this.tag,
78
+ {
79
+ role
80
+ },
81
+ ((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
82
+ );
83
+ }
84
+ if (this.hasInvalidLabelOrSlot) {
126
85
  return h(
127
- "small",
86
+ this.tag,
128
87
  {
129
- role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
88
+ role
130
89
  },
131
- this.hintContent
90
+ ((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
132
91
  );
133
92
  }
93
+ if (this.hasValidLabelOrSlot) {
94
+ return h(
95
+ this.tag,
96
+ {
97
+ role
98
+ },
99
+ ((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
100
+ );
101
+ }
102
+ return h(
103
+ this.tag,
104
+ {
105
+ role
106
+ },
107
+ ((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
108
+ );
134
109
  }
110
+ return null;
135
111
  }
112
+ });
113
+ return {
114
+ hasInvalidLabelOrSlot,
115
+ hasHintLabelOrSlot,
116
+ hasValidLabelOrSlot,
117
+ hasLoadingLabelOrSlot,
118
+ hintSlotScope,
119
+ HintSlot
136
120
  };
137
121
  }
138
122
  const VvIconProps = {
@@ -300,6 +284,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
300
284
  props: VvIconProps,
301
285
  setup(__props) {
302
286
  const props = __props;
287
+ const hasRotate = computed(() => {
288
+ if (typeof props.rotate === "string") {
289
+ return parseFloat(props.rotate);
290
+ }
291
+ return props.rotate;
292
+ });
303
293
  const show = ref(true);
304
294
  const volver = useVolver();
305
295
  const { modifiers } = toRefs(props);
@@ -308,25 +298,24 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
308
298
  return props.provider || (volver == null ? void 0 : volver.iconsProvider);
309
299
  });
310
300
  const icon = computed(() => {
311
- const _name = props.name ?? "";
312
- const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
313
- if (iconExists(_name)) {
314
- return _name;
315
- } else if (iconExists(iconName)) {
301
+ const name = props.name ?? "";
302
+ const iconName = `@${provider.value}:${props.prefix}:${name}`;
303
+ if (iconExists(iconName)) {
316
304
  return iconName;
317
- } else {
318
- return (volver == null ? void 0 : volver.iconsCollections.find(
319
- (iconsCollection) => {
320
- const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
321
- if (iconExists(icon2)) {
322
- return icon2;
323
- }
324
- }
325
- )) || _name;
326
305
  }
306
+ const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
307
+ (iconsCollection2) => {
308
+ const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
309
+ return iconExists(icon2);
310
+ }
311
+ );
312
+ if (iconsCollection) {
313
+ return `@${provider.value}:${iconsCollection.prefix}:${name}`;
314
+ }
315
+ return name;
327
316
  });
328
317
  function getSvgContent(svg) {
329
- let dom = null;
318
+ let dom;
330
319
  if (typeof window === "undefined") {
331
320
  const { JSDOM } = require("jsdom");
332
321
  dom = new JSDOM().window;
@@ -357,12 +346,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
357
346
  show.value = true;
358
347
  }
359
348
  }).catch((e) => {
360
- throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
349
+ throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
361
350
  });
362
- } else if (props.svg) {
363
- addIconFromSvg(props.svg);
364
351
  }
365
352
  }
353
+ if (props.svg) {
354
+ addIconFromSvg(props.svg);
355
+ }
366
356
  return (_ctx, _cache) => {
367
357
  return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
368
358
  key: 0,
@@ -374,7 +364,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
374
364
  horizontalFlip: _ctx.horizontalFlip,
375
365
  verticalFlip: _ctx.verticalFlip,
376
366
  flip: _ctx.flip,
377
- rotate: _ctx.rotate,
367
+ rotate: unref(hasRotate),
378
368
  color: _ctx.color,
379
369
  onLoad: _ctx.onLoad,
380
370
  icon: unref(icon)
@@ -1279,7 +1269,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1279
1269
  loading
1280
1270
  } = toRefs(props);
1281
1271
  const hasId = useUniqueId(id);
1282
- const hasDescribedBy = computed(() => `${hasId.value}-hint`);
1272
+ const hasHintId = computed(() => `${hasId.value}-hint`);
1283
1273
  const inputTextPlaceholder = computed(
1284
1274
  () => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
1285
1275
  );
@@ -1415,8 +1405,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1415
1405
  required: props.required,
1416
1406
  autocomplete: props.autocomplete,
1417
1407
  "aria-invalid": isInvalid.value,
1418
- "aria-describedby": !hasInvalid.value && hasHint.value ? hasDescribedBy.value : void 0,
1419
- "aria-errormessage": hasInvalid.value ? hasDescribedBy.value : void 0
1408
+ "aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
1409
+ "aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
1420
1410
  };
1421
1411
  if (type === INPUT_TYPES.DATE || type === INPUT_TYPES.MONTH || type === INPUT_TYPES.WEEK || type === INPUT_TYPES.TIME || type === INPUT_TYPES.DATETIME_LOCAL || type === INPUT_TYPES.NUMBER) {
1422
1412
  toReturn.step = props.step;
@@ -1445,7 +1435,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1445
1435
  stepDown: onStepDown,
1446
1436
  clear: onClear
1447
1437
  }));
1448
- const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots);
1438
+ const {
1439
+ HintSlot,
1440
+ hasHintLabelOrSlot,
1441
+ hasInvalidLabelOrSlot,
1442
+ hintSlotScope
1443
+ } = HintSlotFactory(props, slots);
1449
1444
  const PasswordInputActions = VvInputTextActionsFactory(
1450
1445
  INPUT_TYPES.PASSWORD,
1451
1446
  props
@@ -1560,9 +1555,38 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1560
1555
  ])) : createCommentVNode("", true)
1561
1556
  ]),
1562
1557
  createVNode(unref(HintSlot), {
1563
- id: unref(hasDescribedBy),
1558
+ id: unref(hasHintId),
1564
1559
  class: "vv-input-text__hint"
1565
- }, null, 8, ["id"])
1560
+ }, createSlots({ _: 2 }, [
1561
+ _ctx.$slots.hint ? {
1562
+ name: "hint",
1563
+ fn: withCtx(() => [
1564
+ renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1565
+ ]),
1566
+ key: "0"
1567
+ } : void 0,
1568
+ _ctx.$slots.loading ? {
1569
+ name: "loading",
1570
+ fn: withCtx(() => [
1571
+ renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1572
+ ]),
1573
+ key: "1"
1574
+ } : void 0,
1575
+ _ctx.$slots.valid ? {
1576
+ name: "valid",
1577
+ fn: withCtx(() => [
1578
+ renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1579
+ ]),
1580
+ key: "2"
1581
+ } : void 0,
1582
+ _ctx.$slots.invalid ? {
1583
+ name: "invalid",
1584
+ fn: withCtx(() => [
1585
+ renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
1586
+ ]),
1587
+ key: "3"
1588
+ } : void 0
1589
+ ]), 1032, ["id"])
1566
1590
  ], 2);
1567
1591
  };
1568
1592
  }
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("maska"),require("@vueuse/core"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","maska","@vueuse/core","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.maska,e.core,e.vue$1,e.nanoid)}(this,(function(e,t,o,n,l){"use strict";function a(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const o=t.split(".");let n=e;for(let t=0,l=o.length;t<l;++t){if(null==e)return null;n=n[o[t]]}return n}}return null}function i(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}function r(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const u={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 d=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(d||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),c=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(c||{});const p=Symbol.for("volver");function v(t,o,n){return e.computed((()=>{const l={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{l[`${t}--${o}`]=e.unref(n.value[o])})),l}))}const m=e.defineComponent({name:"VvIcon",props:u,setup(t){const o=t,l=e.ref(!0),a=e.inject(p),{modifiers:i}=e.toRefs(o),r=v("vv-icon",i),u=e.computed((()=>o.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${u.value}:${o.prefix}:${o.name}`;return n.iconExists(e)?e:n.iconExists(t)?t:(null==a?void 0:a.iconsCollections.find((t=>{const o=`@${u.value}:${t.prefix}:${e}`;if(n.iconExists(o))return o})))||e}));function s(e){const t=function(e){let t=null;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),l=(null==t?void 0:t.innerHTML.trim())||"";t&&l&&n.addIcon(`@${u.value}:${o.prefix}:${o.name}`,{body:l,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return a&&(o.src&&!n.iconExists(`@${u.value}:${o.prefix}:${o.name}`)?(l.value=!1,a.fetchIcon(o.src).then((e=>{e&&(s(e),l.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):o.svg&&s(o.svg)),(t,o)=>e.unref(l)?(e.openBlock(),e.createBlock(e.unref(n.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:t.rotate,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},y=(Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},w={modifiers:[String,Array]},k={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)}},T={tabindex:{type:[String,Number],default:0}},L={floating:Boolean},A={id:[String,Number]};d.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const C={...{...A,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...T,...g,...S,...f,...h,...k,...b,...w,...B,...E,...x,...L,...y,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};c.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"},I="eye-on",V="eye-off",_="calendar",D="time",N="color",R="close",$={...C,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:I},iconHidePassword:{type:String,default:V},iconClear:{type:String,default:R},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"},mask:{type:String,default:void 0},maskEager:{type:Boolean,default:!1},maskReversed:{type:Boolean,default:!1},maskTokens:{type:Object,default:void 0},maskTokensReplace:{type:Boolean,default:!1},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String}},H=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:I},iconHide:{type:String,default:V}},emits:["toggle-password"],setup(t,{emit:o}){const n=e.ref(!1),l=e.computed((()=>n.value?t.iconHide:t.iconShow));return{active:n,activeIcon:l,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(n.value=!n.value,o("toggle-password",n.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:o}){const n=e.computed((()=>"up"===t.mode));return{isUp:n,onClick:e=>{null==e||e.stopPropagation(),t.disabled||o(n.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})}}),O=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(o){null==o||o.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 U(t,o){return{name:"VvInputTextActions",components:{VvIcon:m,VvInputPasswordAction:H,VvInputStepAction:M,VvInputClearAction:O},setup:()=>({isDisabled:e.computed((()=>o.disabled||o.readonly)),labelStepUp:o.labelStepUp,labelStepDown:o.labelStepDown,labelShowPassword:o.labelShowPassword,labelHidePassword:o.labelHidePassword,labelClear:o.labelClear,iconShowPassword:o.iconShowPassword,iconHidePassword:o.iconHidePassword}),render(){let n=null;switch(t){case P.SEARCH:{const{onClear:t}=this.$attrs;n=[e.h(O,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;n=[e.h(H,{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:l}=this.$attrs;n=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:l}),e.h(M,{mode:"down",disabled:this.isDisabled||void 0!==o.min&&o.modelValue===o.min,label:this.labelStepDown,onStepUp:t,onStepDown:l})];break}}return Array.isArray(n)?e.h("div",{class:"vv-input-text__actions-group"},n):n}}}const j=["for"],W={class:"vv-input-text__wrapper"},q={key:0,class:"vv-input-text__input-before"},F=["onClick"],z=["id"],X={key:1,class:"vv-input-text__unit"},K={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","focus","blur","keyup"],setup(n,{expose:u,emit:c}){const p=n,f=e.useSlots(),h=e.ref(),b=e.ref();u({$inner:b});const{id:g,icon:y,iconPosition:S,label:w,modelValue:k,count:B,valid:E,invalid:x,loading:T}=e.toRefs(p),L=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(g),A=e.computed((()=>`${L.value}-hint`)),C=e.computed((()=>p.floating&&i(p.placeholder)?" ":p.placeholder)),I=function(t,o,n=0,{getter:l=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof n&&(n=parseInt(n)),e.computed({get:()=>l(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),n)}})}(k,c,p.debounce,{getter:e=>we.value?we.value.masked(e??""):e,setter:e=>(we.value&&(e=we.value.unmasked(e)),p.type===P.NUMBER?Number(e):e)}),{focused:V}=function(t,n){const{focused:l}=o.useFocus(t);return e.watch(l,(o=>{n(o?"focus":"blur",e.unref(t))})),{focused:l}}(h,c),R=e.computed((()=>V.value&&!p.disabled&&!p.readonly)),$=o.useElementVisibility(h);e.watch($,(e=>{e&&p.autofocus&&!p.disabled&&!p.readonly&&(V.value=!0)}));const H=e.ref(!1),M=e.computed((()=>p.type===P.PASSWORD)),O=()=>{H.value=!H.value},G=e.computed((()=>p.type===P.TIME||p.type===P.DATETIME_LOCAL||p.type===P.DATE||p.type===P.WEEK||p.type===P.MONTH)),Q=e.computed((()=>p.type===P.NUMBER)),Y=()=>{re.value&&(h.value.stepUp(),I.value=e.unref(h).value)},Z=()=>{re.value&&(h.value.stepDown(),I.value=e.unref(h).value)},ee=e.computed((()=>p.type===P.SEARCH)),te=()=>{I.value=void 0},{hasIcon:oe,hasIconBefore:ne,hasIconAfter:le}=function(t,o){const n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.before))),l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.after))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.top))),u=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.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:a,hasIconRight:i,hasIconTop:r,hasIconBottom:u,hasIconBefore:n,hasIconAfter:l}}(y,S),ae=e.computed((()=>{switch(p.type){case P.COLOR:return{name:N};case P.DATE:case P.DATETIME_LOCAL:case P.WEEK:case P.MONTH:return{name:_};case P.TIME:return{name:D};default:return""}})),{formatted:ie}=function(t,o){const n=e.computed((()=>(e.unref(t)??"").length)),l=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&n.value<(null==o?void 0:o.lowerLimit)?n.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&n.value<(null==o?void 0:o.upperLimit)?o.upperLimit-n.value:0)),a=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${n.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===l.value)return;return l}return n.value}));return{length:n,gap:l,formatted:a}}(I,{mode:p.count,upperLimit:Number(p.maxlength),lowerLimit:Number(p.minlength)}),re=e.computed((()=>!p.disabled&&!p.readonly)),ue=e.computed((()=>re.value?p.tabindex:-1)),de=e.computed((()=>!i(k))),se=e.computed((()=>!0===x.value||!0!==E.value&&void 0)),{modifiers:ce}=e.toRefs(p),pe=v("vv-input-text",ce,e.computed((()=>({valid:E.value,invalid:x.value,loading:T.value,disabled:p.disabled,readonly:p.readonly,"icon-before":ne.value,"icon-after":le.value||!i(ae),floating:p.floating&&!i(p.label),dirty:de.value,focus:R.value,"auto-width":p.autoWidth})))),ve=e.computed((()=>{const e=M.value&&H.value?P.TEXT:!G.value||de.value||V.value?p.type:P.TEXT,t={type:e,name:p.name,tabindex:ue.value,disabled:p.disabled,readonly:p.readonly,required:p.required,autocomplete:p.autocomplete,"aria-invalid":se.value,"aria-describedby":!be.value&&he.value?A.value:void 0,"aria-errormessage":be.value?A.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=p.step,t.max=void 0!==p.max?String(p.max):void 0,t.min=void 0!==p.min?String(p.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=C.value),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD||(t.minlength=p.minlength,t.maxlength=p.maxlength,t.pattern=p.pattern),e===P.EMAIL&&(t.multiple=p.multiple),t})),me=e.computed((()=>({valid:p.valid,invalid:p.invalid,modelValue:p.modelValue,togglePassword:O,stepUp:Y,stepDown:Z,clear:te}))),{HintSlot:fe,hasHint:he,hasInvalid:be}=function(t,n){const{invalid:l,valid:u,hint:d,loading:s}=n,{hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,...b}=e.toRefs(t),g=a(b,"loading"),y=a(b,"loadingLabel"),S=e.computed((()=>!(!f.value||(!f.value||!l)&&!((null==h?void 0:h.value)&&Array.isArray(h.value)&&h.value.length>0)&&(!(null==h?void 0:h.value)||i(h))))),w=e.computed((()=>!!(c&&c.value||d))),k=e.computed((()=>!!(m&&m.value||u))),B=e.computed((()=>!!((null==g?void 0:g.value)&&s||(null==g?void 0:g.value)&&(null==y?void 0:y.value)))),E=e.computed((()=>w.value||k.value||S.value||B.value));return{hasInvalid:S,hasHint:w,hasValid:k,hasLoading:B,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(t){const n=e.computed((()=>{const e=o.toReactive({hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,loading:g,loadingLabel:y,...t.params});return(null==f?void 0:f.value)?(null==l?void 0:l(e))||r(null==h?void 0:h.value)||(null==c?void 0:c.value):(null==v?void 0:v.value)?(null==u?void 0:u(e))||r(null==m?void 0:m.value)||(null==c?void 0:c.value):(null==g?void 0:g.value)?(null==s?void 0:s(e))||r(null==y?void 0:y.value)||(null==c?void 0:c.value):(null==d?void 0:d(e))||r(null==c?void 0:c.value)||(null==c?void 0:c.value)}));return{isVisible:E,hasInvalid:S,hasValid:k,hintContent:n}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(p,f),ge=U(P.PASSWORD,p),ye=U(P.NUMBER,p),Se=U(P.SEARCH,p),we=e.ref();e.watch([()=>p.mask,()=>p.type,()=>p.maskEager,()=>p.maskReversed,()=>p.maskTokens,()=>p.maskTokensReplace],(([e,o,n,l,a,i])=>{e&&o===P.TEXT?we.value=new t.Mask({mask:e,eager:n,reversed:l,tokens:a,tokensReplace:i}):we.value=void 0}),{immediate:!0});const ke=()=>{re.value&&(V.value=!0)},Be=e.computed((()=>{if(p.autoWidth)return{width:void 0!==I.value?`${String(I.value).length+1}ch`:void 0}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(pe))},[e.unref(w)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(L),class:"vv-input-text__label"},e.toDisplayString(e.unref(w)),9,j)):e.createCommentVNode("",!0),e.createElementVNode("div",W,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:b,class:"vv-input-text__inner",onClick:e.withModifiers(ke,["stop"])},[e.unref(ne)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(oe)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(L),ref_key:"inputEl",ref:h,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(I)?I.value=t:null)},e.unref(ve),{style:e.unref(Be),onKeyup:o[1]||(o[1]=e=>c("keyup",e))}),null,16,z),[[e.vModelDynamic,e.unref(I)]]),(t.unit||t.$slots.unit)&&e.unref(de)?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,F),e.unref(le)||e.unref(ae)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(le)?e.unref(oe):e.unref(ae)),null,16)):e.unref(M)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ge),{key:2,onTogglePassword:O})):e.unref(Q)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ye),{key:3,onStepUp:Y,onStepDown:Z})):e.unref(ee)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(Se),{key:4,onClear:te})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",J,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ie)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(fe),{id:e.unref(A),class:"vv-input-text__hint"},null,8,["id"])],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("maska"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","maska","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.maska,e.vue$1,e.nanoid,e.core)}(this,(function(e,t,o,l,n){"use strict";function a(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}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 p(t,o,l){return e.computed((()=>{const n={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((o=>{n[`${t}--${o}`]=e.unref(l.value[o])})),n}))}const v=e.defineComponent({name:"VvIcon",props:r,setup(t){const l=t,n=e.computed((()=>"string"==typeof l.rotate?parseFloat(l.rotate):l.rotate)),a=e.ref(!0),i=e.inject(c),{modifiers:r}=e.toRefs(l),u=p("vv-icon",r),s=e.computed((()=>l.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=l.name??"",t=`@${s.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t;const n=null==i?void 0:i.iconsCollections.find((t=>{const l=`@${s.value}:${t.prefix}:${e}`;return o.iconExists(l)}));return n?`@${s.value}:${n.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),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&o.addIcon(`@${s.value}:${l.prefix}:${l.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&l.src&&!o.iconExists(`@${s.value}:${l.prefix}:${l.name}`)&&(a.value=!1,i.fetchIcon(l.src).then((e=>{e&&(v(e),a.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&v(l.svg),(t,l)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(o.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(n),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),m={valid:Boolean,validLabel:[String,Array]},f={invalid:Boolean,invalidLabel:[String,Array]},h={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},b={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},y={modifiers:[String,Array]},w={hintLabel:{type:String,default:""}},k={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},B={debounce:[Number,String]},L={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},E={tabindex:{type:[String,Number],default:0}},x={floating:Boolean},P={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const T={...{...P,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...E,...b,...S,...m,...f,...w,...h,...y,...k,...B,...L,...x,...g,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.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"},$="eye-on",A="eye-off",I="calendar",V="time",_="color",O="close",R={...T,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:$},iconHidePassword:{type:String,default:A},iconClear:{type:String,default:O},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"},mask:{type:String,default:void 0},maskEager:{type:Boolean,default:!1},maskReversed:{type:Boolean,default:!1},maskTokens:{type:Object,default:void 0},maskTokensReplace:{type:Boolean,default:!1},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String}},D=e.defineComponent({components:{VvIcon:v},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:$},iconHide:{type:String,default:A}},emits:["toggle-password"],setup(t,{emit:o}){const l=e.ref(!1),n=e.computed((()=>l.value?t.iconHide:t.iconShow));return{active:l,activeIcon:n,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(l.value=!l.value,o("toggle-password",l.value))}}},render(){const t=e.h(v,{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)}}),N=e.defineComponent({components:{VvIcon:v},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:o}){const l=e.computed((()=>"up"===t.mode));return{isUp:l,onClick:e=>{null==e||e.stopPropagation(),t.disabled||o(l.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:v},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(o){null==o||o.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(v,{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 M(t,o){return{name:"VvInputTextActions",components:{VvIcon:v,VvInputPasswordAction:D,VvInputStepAction:N,VvInputClearAction:H},setup:()=>({isDisabled:e.computed((()=>o.disabled||o.readonly)),labelStepUp:o.labelStepUp,labelStepDown:o.labelStepDown,labelShowPassword:o.labelShowPassword,labelHidePassword:o.labelHidePassword,labelClear:o.labelClear,iconShowPassword:o.iconShowPassword,iconHidePassword:o.iconHidePassword}),render(){let l=null;switch(t){case C.SEARCH:{const{onClear:t}=this.$attrs;l=[e.h(H,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case C.PASSWORD:{const{onTogglePassword:t}=this.$attrs;l=[e.h(D,{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:n}=this.$attrs;l=[e.h(N,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:n}),e.h(N,{mode:"down",disabled:this.isDisabled||void 0!==o.min&&o.modelValue===o.min,label:this.labelStepDown,onStepUp:t,onStepDown:n})];break}}return Array.isArray(l)?e.h("div",{class:"vv-input-text__actions-group"},l):l}}}const U=["for"],W={class:"vv-input-text__wrapper"},q={key:0,class:"vv-input-text__input-before"},z=["onClick"],j=["id"],F={key:1,class:"vv-input-text__unit"},X={key:5,class:"vv-input-text__input-after"},K={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:R,emits:["update:modelValue","focus","blur","keyup"],setup(o,{expose:r,emit:d}){const c=o,m=e.useSlots(),f=e.ref(),h=e.ref();r({$inner:h});const{id:b,icon:g,iconPosition:S,label:y,modelValue:w,count:k,valid:B,invalid:L,loading:E}=e.toRefs(c),x=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(b),P=e.computed((()=>`${x.value}-hint`)),T=e.computed((()=>c.floating&&a(c.placeholder)?" ":c.placeholder)),$=function(t,o,l=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof l&&(l=parseInt(l)),e.computed({get:()=>n(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),l)}})}(w,d,c.debounce,{getter:e=>we.value?we.value.masked(e??""):e,setter:e=>(we.value&&(e=we.value.unmasked(e)),c.type===C.NUMBER?Number(e):e)}),{focused:A}=function(t,o){const{focused:l}=n.useFocus(t);return e.watch(l,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:l}}(f,d),O=e.computed((()=>A.value&&!c.disabled&&!c.readonly)),R=n.useElementVisibility(f);e.watch(R,(e=>{e&&c.autofocus&&!c.disabled&&!c.readonly&&(A.value=!0)}));const D=e.ref(!1),N=e.computed((()=>c.type===C.PASSWORD)),H=()=>{D.value=!D.value},J=e.computed((()=>c.type===C.TIME||c.type===C.DATETIME_LOCAL||c.type===C.DATE||c.type===C.WEEK||c.type===C.MONTH)),G=e.computed((()=>c.type===C.NUMBER)),Q=()=>{ie.value&&(f.value.stepUp(),$.value=e.unref(f).value)},Y=()=>{ie.value&&(f.value.stepDown(),$.value=e.unref(f).value)},Z=e.computed((()=>c.type===C.SEARCH)),ee=()=>{$.value=void 0},{hasIcon:te,hasIconBefore:oe,hasIconAfter:le}=function(t,o){const l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.before))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.after))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.top))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.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:a,hasIconRight:i,hasIconTop:r,hasIconBottom:d,hasIconBefore:l,hasIconAfter:n}}(g,S),ne=e.computed((()=>{switch(c.type){case C.COLOR:return{name:_};case C.DATE:case C.DATETIME_LOCAL:case C.WEEK:case C.MONTH:return{name:I};case C.TIME:return{name:V};default:return""}})),{formatted:ae}=function(t,o){const l=e.computed((()=>(e.unref(t)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&l.value<(null==o?void 0:o.lowerLimit)?l.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&l.value<(null==o?void 0:o.upperLimit)?o.upperLimit-l.value:0)),a=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${l.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return l.value}));return{length:l,gap:n,formatted:a}}($,{mode:c.count,upperLimit:Number(c.maxlength),lowerLimit:Number(c.minlength)}),ie=e.computed((()=>!c.disabled&&!c.readonly)),re=e.computed((()=>ie.value?c.tabindex:-1)),ue=e.computed((()=>!a(w))),se=e.computed((()=>!0===L.value||!0!==B.value&&void 0)),{modifiers:de}=e.toRefs(c),ce=p("vv-input-text",de,e.computed((()=>({valid:B.value,invalid:L.value,loading:E.value,disabled:c.disabled,readonly:c.readonly,"icon-before":oe.value,"icon-after":le.value||!a(ne),floating:c.floating&&!a(c.label),dirty:ue.value,focus:O.value,"auto-width":c.autoWidth})))),pe=e.computed((()=>{const e=N.value&&D.value?C.TEXT:!J.value||ue.value||A.value?c.type:C.TEXT,t={type:e,name:c.name,tabindex:re.value,disabled:c.disabled,readonly:c.readonly,required:c.required,autocomplete:c.autocomplete,"aria-invalid":se.value,"aria-describedby":fe.value?P.value:void 0,"aria-errormessage":he.value?P.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=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!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD&&e!==C.NUMBER||(t.placeholder=T.value),e!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD||(t.minlength=c.minlength,t.maxlength=c.maxlength,t.pattern=c.pattern),e===C.EMAIL&&(t.multiple=c.multiple),t})),ve=e.computed((()=>({valid:c.valid,invalid:c.invalid,modelValue:c.modelValue,togglePassword:H,stepUp:Q,stepDown:Y,clear:ee}))),{HintSlot:me,hasHintLabelOrSlot:fe,hasInvalidLabelOrSlot:he,hintSlotScope:be}=function(t,o){const l=e.computed((()=>i(t.invalidLabel))),n=e.computed((()=>i(t.validLabel))),a=e.computed((()=>t.loadingLabel)),r=e.computed((()=>t.hintLabel)),u=e.computed((()=>Boolean(t.loading&&(o.loading||a.value)))),s=e.computed((()=>!u.value&&Boolean(t.invalid&&(o.invalid||l.value)))),d=e.computed((()=>!u.value&&!s.value&&Boolean(t.valid&&(o.valid||n.value)))),c=e.computed((()=>!u.value&&!s.value&&!d.value&&Boolean(o.hint||r.value))),p=e.computed((()=>s.value||d.value||u.value||c.value)),v=e.computed((()=>({modelValue:t.modelValue,valid:t.valid,invalid:t.invalid,loading:t.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:p,invalidLabel:l,validLabel:n,loadingLabel:a,hintLabel:r,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,o,l,n,a,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==(o=(t=this.$slots).loading)?void 0:o.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(n=(l=this.$slots).invalid)?void 0:n.call(l))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(a=this.$slots).valid)?void 0:i.call(a))??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:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hintSlotScope:v,HintSlot:m}}(c,m),ge=M(C.PASSWORD,c),Se=M(C.NUMBER,c),ye=M(C.SEARCH,c),we=e.ref();e.watch([()=>c.mask,()=>c.type,()=>c.maskEager,()=>c.maskReversed,()=>c.maskTokens,()=>c.maskTokensReplace],(([e,o,l,n,a,i])=>{e&&o===C.TEXT?we.value=new t.Mask({mask:e,eager:l,reversed:n,tokens:a,tokensReplace:i}):we.value=void 0}),{immediate:!0});const ke=()=>{ie.value&&(A.value=!0)},Be=e.computed((()=>{if(c.autoWidth)return{width:void 0!==$.value?`${String($.value).length+1}ch`:void 0}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ce))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(x),class:"vv-input-text__label"},e.toDisplayString(e.unref(y)),9,U)):e.createCommentVNode("",!0),e.createElementVNode("div",W,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(ve))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:h,class:"vv-input-text__inner",onClick:e.withModifiers(ke,["stop"])},[e.unref(oe)?(e.openBlock(),e.createBlock(v,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(te)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(x),ref_key:"inputEl",ref:f,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef($)?$.value=t:null)},e.unref(pe),{style:e.unref(Be),onKeyup:o[1]||(o[1]=e=>d("keyup",e))}),null,16,j),[[e.vModelDynamic,e.unref($)]]),(t.unit||t.$slots.unit)&&e.unref(ue)?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(ve))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,z),e.unref(le)||e.unref(ne)?(e.openBlock(),e.createBlock(v,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(le)?e.unref(te):e.unref(ne)),null,16)):e.unref(N)&&!t.hideActions&&e.unref(ie)?(e.openBlock(),e.createBlock(e.unref(ge),{key:2,onTogglePassword:H})):e.unref(G)&&!t.hideActions&&e.unref(ie)?(e.openBlock(),e.createBlock(e.unref(Se),{key:3,onStepUp:Q,onStepDown:Y})):e.unref(Z)&&!t.hideActions&&e.unref(ie)?(e.openBlock(),e.createBlock(e.unref(ye),{key:4,onClear:ee})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(ve))))])):e.createCommentVNode("",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",K,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(ve))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ae)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(me),{id:e.unref(P),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(be))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(be))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(be))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(be))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
@@ -328,6 +328,30 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
328
328
  stepDown: () => void;
329
329
  clear: () => void;
330
330
  }) => any;
331
+ hint: (_: {
332
+ modelValue: any;
333
+ valid: boolean;
334
+ invalid: boolean;
335
+ loading: boolean;
336
+ }) => any;
337
+ loading: (_: {
338
+ modelValue: any;
339
+ valid: boolean;
340
+ invalid: boolean;
341
+ loading: boolean;
342
+ }) => any;
343
+ valid: (_: {
344
+ modelValue: any;
345
+ valid: boolean;
346
+ invalid: boolean;
347
+ loading: boolean;
348
+ }) => any;
349
+ invalid: (_: {
350
+ modelValue: any;
351
+ valid: boolean;
352
+ invalid: boolean;
353
+ loading: boolean;
354
+ }) => any;
331
355
  }>;
332
356
  export default _default;
333
357
  type __VLS_WithTemplateSlots<T, S> = T & {