@volverjs/ui-vue 0.0.5-beta.1 → 0.0.5-beta.2

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 (62) hide show
  1. package/dist/components/VvAction/VvAction.es.js +10 -0
  2. package/dist/components/VvBadge/VvBadge.es.js +10 -0
  3. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +10 -0
  4. package/dist/components/VvButton/VvButton.es.js +10 -0
  5. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +10 -0
  6. package/dist/components/VvCheckbox/VvCheckbox.es.js +10 -0
  7. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +10 -0
  8. package/dist/components/VvCombobox/VvCombobox.es.js +17 -3
  9. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  10. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +24 -11
  11. package/dist/components/VvCombobox/index.d.ts +6 -1
  12. package/dist/components/VvDialog/VvDialog.es.js +10 -0
  13. package/dist/components/VvDropdown/VvDropdown.es.js +14 -2
  14. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  15. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +27 -11
  16. package/dist/components/VvDropdown/index.d.ts +6 -1
  17. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +10 -0
  18. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +10 -0
  19. package/dist/components/VvInputText/VvInputText.es.js +14 -4
  20. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  21. package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
  22. package/dist/components/VvInputText/index.d.ts +2 -2
  23. package/dist/components/VvProgress/VvProgress.es.js +10 -0
  24. package/dist/components/VvRadio/VvRadio.es.js +10 -0
  25. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +10 -0
  26. package/dist/components/VvSelect/VvSelect.es.js +10 -0
  27. package/dist/components/VvTextarea/VvTextarea.es.js +14 -4
  28. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  29. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
  30. package/dist/components/VvTextarea/index.d.ts +2 -2
  31. package/dist/components/VvTooltip/VvTooltip.es.js +10 -0
  32. package/dist/components/index.es.js +23 -9
  33. package/dist/components/index.umd.js +1 -1
  34. package/dist/directives/index.d.ts +1 -0
  35. package/dist/directives/index.es.js +51 -2
  36. package/dist/directives/index.umd.js +1 -1
  37. package/dist/directives/v-contextmenu.d.ts +3 -0
  38. package/dist/directives/v-contextmenu.es.js +42 -0
  39. package/dist/directives/v-contextmenu.umd.js +1 -0
  40. package/dist/directives/v-tooltip.es.js +10 -0
  41. package/dist/icons.d.ts +3 -1
  42. package/dist/icons.es.js +6 -4
  43. package/dist/icons.umd.js +1 -1
  44. package/dist/props/index.d.ts +11 -3
  45. package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
  46. package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
  47. package/dist/stories/argTypes.d.ts +12 -0
  48. package/package.json +50 -42
  49. package/src/assets/icons/detailed.json +1 -1
  50. package/src/assets/icons/normal.json +1 -1
  51. package/src/assets/icons/simple.json +1 -1
  52. package/src/components/VvCombobox/VvCombobox.vue +5 -3
  53. package/src/components/VvDropdown/VvDropdown.vue +3 -2
  54. package/src/components/VvInputText/VvInputText.vue +2 -2
  55. package/src/components/VvTextarea/VvTextarea.vue +2 -2
  56. package/src/directives/index.ts +2 -0
  57. package/src/directives/v-contextmenu.ts +40 -0
  58. package/src/icons.ts +1 -1
  59. package/src/props/index.ts +12 -2
  60. package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
  61. package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
  62. package/src/stories/argTypes.ts +10 -0
@@ -9,14 +9,19 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
9
9
  };
10
10
  role: {
11
11
  type: globalThis.PropType<"menu" | "listbox">;
12
- default: import("@/constants").DropdownRole;
13
- validator: (value: import("@/constants").DropdownRole) => boolean;
12
+ default: import("../../constants").DropdownRole;
13
+ validator: (value: import("../../constants").DropdownRole) => boolean;
14
14
  };
15
15
  placement: {
16
16
  type: globalThis.PropType<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
17
- default: import("@/constants").Side;
17
+ default: import("../../constants").Side;
18
18
  validator: (value: never) => boolean;
19
19
  };
20
+ strategy: {
21
+ type: globalThis.PropType<"fixed" | "absolute">;
22
+ default: string;
23
+ validator: (value: "fixed" | "absolute") => boolean;
24
+ };
20
25
  transitionName: {
21
26
  type: StringConstructor;
22
27
  };
@@ -50,8 +55,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
50
55
  x: number;
51
56
  y: number;
52
57
  placement: import("@floating-ui/vue").Placement;
53
- initialPlacement: import("@floating-ui/vue").Placement;
54
58
  strategy: import("@floating-ui/vue").Strategy;
59
+ initialPlacement: import("@floating-ui/vue").Placement;
55
60
  middlewareData: import("@floating-ui/vue").MiddlewareData;
56
61
  rects: import("@floating-ui/vue").ElementRects;
57
62
  platform: import("@floating-ui/core").Platform;
@@ -98,7 +103,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
98
103
  };
99
104
  modifiers: globalThis.PropType<string | string[]>;
100
105
  id: (StringConstructor | NumberConstructor)[];
101
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
106
+ }, {
107
+ toggle: () => void;
108
+ show: () => void;
109
+ hide: () => void;
110
+ init: (el: HTMLElement) => void;
111
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
102
112
  modelValue: {
103
113
  type: BooleanConstructor;
104
114
  default: undefined;
@@ -109,14 +119,19 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
109
119
  };
110
120
  role: {
111
121
  type: globalThis.PropType<"menu" | "listbox">;
112
- default: import("@/constants").DropdownRole;
113
- validator: (value: import("@/constants").DropdownRole) => boolean;
122
+ default: import("../../constants").DropdownRole;
123
+ validator: (value: import("../../constants").DropdownRole) => boolean;
114
124
  };
115
125
  placement: {
116
126
  type: globalThis.PropType<"left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end">;
117
- default: import("@/constants").Side;
127
+ default: import("../../constants").Side;
118
128
  validator: (value: never) => boolean;
119
129
  };
130
+ strategy: {
131
+ type: globalThis.PropType<"fixed" | "absolute">;
132
+ default: string;
133
+ validator: (value: "fixed" | "absolute") => boolean;
134
+ };
120
135
  transitionName: {
121
136
  type: StringConstructor;
122
137
  };
@@ -150,8 +165,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
150
165
  x: number;
151
166
  y: number;
152
167
  placement: import("@floating-ui/vue").Placement;
153
- initialPlacement: import("@floating-ui/vue").Placement;
154
168
  strategy: import("@floating-ui/vue").Strategy;
169
+ initialPlacement: import("@floating-ui/vue").Placement;
155
170
  middlewareData: import("@floating-ui/vue").MiddlewareData;
156
171
  rects: import("@floating-ui/vue").ElementRects;
157
172
  platform: import("@floating-ui/core").Platform;
@@ -219,14 +234,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
219
234
  boundary: import("@floating-ui/vue").Boundary;
220
235
  }> | undefined;
221
236
  placement: "left" | "right" | "top" | "bottom" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end";
237
+ strategy: "fixed" | "absolute";
222
238
  offset: string | import("@floating-ui/vue").OffsetOptions | undefined;
223
239
  size: boolean | Partial<{
224
240
  apply: (args: {
225
241
  x: number;
226
242
  y: number;
227
243
  placement: import("@floating-ui/vue").Placement;
228
- initialPlacement: import("@floating-ui/vue").Placement;
229
244
  strategy: import("@floating-ui/vue").Strategy;
245
+ initialPlacement: import("@floating-ui/vue").Placement;
230
246
  middlewareData: import("@floating-ui/vue").MiddlewareData;
231
247
  rects: import("@floating-ui/vue").ElementRects;
232
248
  platform: import("@floating-ui/core").Platform;
@@ -270,7 +286,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
270
286
  expanded: boolean;
271
287
  }) => any;
272
288
  items: (_: {
273
- role: import("@/constants").DropdownItemRole;
289
+ role: import("../../constants").DropdownItemRole;
274
290
  }) => any;
275
291
  after: (_: {
276
292
  expanded: boolean;
@@ -28,6 +28,11 @@ export declare const VvDropdownProps: {
28
28
  default: import("../../constants").Side;
29
29
  validator: (value: never) => boolean;
30
30
  };
31
+ strategy: {
32
+ type: PropType<"fixed" | "absolute">;
33
+ default: string;
34
+ validator: (value: "fixed" | "absolute") => boolean;
35
+ };
31
36
  transitionName: {
32
37
  type: StringConstructor;
33
38
  };
@@ -61,8 +66,8 @@ export declare const VvDropdownProps: {
61
66
  x: number;
62
67
  y: number;
63
68
  placement: import("@floating-ui/core").Placement;
64
- initialPlacement: import("@floating-ui/core").Placement;
65
69
  strategy: import("@floating-ui/core").Strategy;
70
+ initialPlacement: import("@floating-ui/core").Placement;
66
71
  middlewareData: import("@floating-ui/core").MiddlewareData;
67
72
  rects: import("@floating-ui/core").ElementRects;
68
73
  platform: import("@floating-ui/core").Platform;
@@ -137,6 +137,16 @@ const ModifiersProps = {
137
137
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
138
138
  }
139
139
  },
140
+ /**
141
+ * Dropdown strategy
142
+ */
143
+ strategy: {
144
+ type: String,
145
+ default: "absolute",
146
+ validator: (value) => {
147
+ return ["fixed", "absolute"].includes(value);
148
+ }
149
+ },
140
150
  /**
141
151
  * Dropdown show / hide transition name
142
152
  */
@@ -179,6 +179,16 @@ const UnselectableProps = {
179
179
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
180
180
  }
181
181
  },
182
+ /**
183
+ * Dropdown strategy
184
+ */
185
+ strategy: {
186
+ type: String,
187
+ default: "absolute",
188
+ validator: (value) => {
189
+ return ["fixed", "absolute"].includes(value);
190
+ }
191
+ },
182
192
  /**
183
193
  * Dropdown show / hide transition name
184
194
  */
@@ -543,6 +543,16 @@ const IdProps = {
543
543
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
544
544
  }
545
545
  },
546
+ /**
547
+ * Dropdown strategy
548
+ */
549
+ strategy: {
550
+ type: String,
551
+ default: "absolute",
552
+ validator: (value) => {
553
+ return ["fixed", "absolute"].includes(value);
554
+ }
555
+ },
546
556
  /**
547
557
  * Dropdown show / hide transition name
548
558
  */
@@ -664,14 +674,14 @@ const InputTextareaProps = {
664
674
  * Available for input types: text, search, url, tel, email, password
665
675
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
666
676
  */
667
- minlength: Number,
677
+ minlength: [String, Number],
668
678
  /**
669
679
  * Input / Textarea maxlength
670
680
  * Maximum length (number of characters) of value
671
681
  * Available for input types: text, search, url, tel, email, password
672
682
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
673
683
  */
674
- maxlength: Number,
684
+ maxlength: [String, Number],
675
685
  /**
676
686
  * Input / Textarea placeholder
677
687
  * Text that appears in the form control when it has no value set
@@ -1351,8 +1361,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1351
1361
  });
1352
1362
  const { formatted: countFormatted } = useTextCount(localModelValue, {
1353
1363
  mode: props.count,
1354
- upperLimit: props.maxlength,
1355
- lowerLimit: props.minlength
1364
+ upperLimit: Number(props.maxlength),
1365
+ lowerLimit: Number(props.minlength)
1356
1366
  });
1357
1367
  const isClickable = computed(() => !props.disabled && !props.readonly);
1358
1368
  const hasTabindex = computed(
@@ -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,l,n){"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 l=e;for(let t=0,n=o.length;t<n;++t){if(null==e)return null;l=l[o[t]]}return l}}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,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 m=e.defineComponent({name:"VvIcon",props:u,setup(t){const o=t,n=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 l.iconExists(e)?e:l.iconExists(t)?t:(null==a?void 0:a.iconsCollections.find((t=>{const o=`@${u.value}:${t.prefix}:${e}`;if(l.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),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&l.addIcon(`@${u.value}:${o.prefix}:${o.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return a&&(o.src&&!l.iconExists(`@${u.value}:${o.prefix}:${o.name}`)?(n.value=!1,a.fetchIcon(o.src).then((e=>{e&&(s(e),n.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(n)?(e.openBlock(),e.createBlock(e.unref(l.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:Number,maxlength: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",R="color",N="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:N},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 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(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 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})}}),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 l=null;switch(t){case P.SEARCH:{const{onClear:t}=this.$attrs;l=[e.h(O,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;l=[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:n}=this.$attrs;l=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:n}),e.h(M,{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 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(l,{expose:u,emit:c}){const p=l,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)||n.nanoid()))))(g),A=e.computed((()=>`${L.value}-hint`)),C=e.computed((()=>p.floating&&i(p.placeholder)?" ":p.placeholder)),I=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)}})}(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,l){const{focused:n}=o.useFocus(t);return e.watch(n,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:n}}(h,c),N=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:le,hasIconAfter:ne}=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===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:l,hasIconAfter:n}}(y,S),ae=e.computed((()=>{switch(p.type){case P.COLOR:return{name:R};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 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}}(I,{mode:p.count,upperLimit:p.maxlength,lowerLimit: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":le.value,"icon-after":ne.value||!i(ae),floating:p.floating&&!i(p.label),dirty:de.value,focus:N.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,l){const{invalid:n,valid:u,hint:d,loading:s}=l,{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||!n)&&!((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 l=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==n?void 0:n(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:l}},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,l,n,a,i])=>{e&&o===P.TEXT?we.value=new t.Mask({mask:e,eager:l,reversed:n,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(le)?(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(ne)||e.unref(ae)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ne)?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("@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))}})}));
@@ -76,8 +76,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
76
76
  unit: {
77
77
  type: StringConstructor;
78
78
  };
79
- minlength: NumberConstructor;
80
- maxlength: NumberConstructor;
79
+ minlength: (StringConstructor | NumberConstructor)[];
80
+ maxlength: (StringConstructor | NumberConstructor)[];
81
81
  placeholder: StringConstructor;
82
82
  required: BooleanConstructor;
83
83
  label: (StringConstructor | NumberConstructor)[];
@@ -206,8 +206,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
206
206
  unit: {
207
207
  type: StringConstructor;
208
208
  };
209
- minlength: NumberConstructor;
210
- maxlength: NumberConstructor;
209
+ minlength: (StringConstructor | NumberConstructor)[];
210
+ maxlength: (StringConstructor | NumberConstructor)[];
211
211
  placeholder: StringConstructor;
212
212
  required: BooleanConstructor;
213
213
  label: (StringConstructor | NumberConstructor)[];
@@ -192,8 +192,8 @@ export declare const VvInputTextProps: {
192
192
  unit: {
193
193
  type: StringConstructor;
194
194
  };
195
- minlength: NumberConstructor;
196
- maxlength: NumberConstructor;
195
+ minlength: (StringConstructor | NumberConstructor)[];
196
+ maxlength: (StringConstructor | NumberConstructor)[];
197
197
  placeholder: StringConstructor;
198
198
  required: BooleanConstructor;
199
199
  label: (StringConstructor | NumberConstructor)[];
@@ -118,6 +118,16 @@ const ModifiersProps = {
118
118
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
119
119
  }
120
120
  },
121
+ /**
122
+ * Dropdown strategy
123
+ */
124
+ strategy: {
125
+ type: String,
126
+ default: "absolute",
127
+ validator: (value) => {
128
+ return ["fixed", "absolute"].includes(value);
129
+ }
130
+ },
121
131
  /**
122
132
  * Dropdown show / hide transition name
123
133
  */
@@ -164,6 +164,16 @@ const IdProps = {
164
164
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
165
165
  }
166
166
  },
167
+ /**
168
+ * Dropdown strategy
169
+ */
170
+ strategy: {
171
+ type: String,
172
+ default: "absolute",
173
+ validator: (value) => {
174
+ return ["fixed", "absolute"].includes(value);
175
+ }
176
+ },
167
177
  /**
168
178
  * Dropdown show / hide transition name
169
179
  */
@@ -377,6 +377,16 @@ const IdProps = {
377
377
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
378
378
  }
379
379
  },
380
+ /**
381
+ * Dropdown strategy
382
+ */
383
+ strategy: {
384
+ type: String,
385
+ default: "absolute",
386
+ validator: (value) => {
387
+ return ["fixed", "absolute"].includes(value);
388
+ }
389
+ },
380
390
  /**
381
391
  * Dropdown show / hide transition name
382
392
  */
@@ -553,6 +553,16 @@ const IdProps = {
553
553
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
554
554
  }
555
555
  },
556
+ /**
557
+ * Dropdown strategy
558
+ */
559
+ strategy: {
560
+ type: String,
561
+ default: "absolute",
562
+ validator: (value) => {
563
+ return ["fixed", "absolute"].includes(value);
564
+ }
565
+ },
556
566
  /**
557
567
  * Dropdown show / hide transition name
558
568
  */
@@ -542,6 +542,16 @@ const IdProps = {
542
542
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
543
543
  }
544
544
  },
545
+ /**
546
+ * Dropdown strategy
547
+ */
548
+ strategy: {
549
+ type: String,
550
+ default: "absolute",
551
+ validator: (value) => {
552
+ return ["fixed", "absolute"].includes(value);
553
+ }
554
+ },
545
555
  /**
546
556
  * Dropdown show / hide transition name
547
557
  */
@@ -663,14 +673,14 @@ const InputTextareaProps = {
663
673
  * Available for input types: text, search, url, tel, email, password
664
674
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
665
675
  */
666
- minlength: Number,
676
+ minlength: [String, Number],
667
677
  /**
668
678
  * Input / Textarea maxlength
669
679
  * Maximum length (number of characters) of value
670
680
  * Available for input types: text, search, url, tel, email, password
671
681
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
672
682
  */
673
- maxlength: Number,
683
+ maxlength: [String, Number],
674
684
  /**
675
685
  * Input / Textarea placeholder
676
686
  * Text that appears in the form control when it has no value set
@@ -900,8 +910,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
900
910
  });
901
911
  const { formatted: countFormatted } = useTextCount(localModelValue, {
902
912
  mode: props.count,
903
- upperLimit: props.maxlength,
904
- lowerLimit: props.minlength
913
+ upperLimit: Number(props.maxlength),
914
+ lowerLimit: Number(props.minlength)
905
915
  });
906
916
  const isClickable = computed(() => !props.disabled && !props.readonly);
907
917
  const hasTabindex = computed(
@@ -1 +1 @@
1
- !function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=l(e.vue,e.core,e.vue$1,e.nanoid)}(this,(function(e,l,o,t){"use strict";function n(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const o=l.split(".");let t=e;for(let l=0,n=o.length;l<n;++l){if(null==e)return null;t=t[o[l]]}return t}}return null}function a(l){return null==(o=e.unref(l))||""===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(l=e)||l instanceof String;var l})).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||{}),d=(e=>(e.before="before",e.after="after",e))(d||{}),v=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(v||{});const c=Symbol.for("volver");function s(l,o,t){return e.computed((()=>{const n={[l]:!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[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((o=>{n[`${l}--${o}`]=e.unref(t.value[o])})),n}))}const m=e.defineComponent({name:"VvIcon",props:r,setup(l){const t=l,n=e.ref(!0),a=e.inject(c),{modifiers:i}=e.toRefs(t),r=s("vv-icon",i),u=e.computed((()=>t.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=t.name??"",l=`@${u.value}:${t.prefix}:${t.name}`;return o.iconExists(e)?e:o.iconExists(l)?l:(null==a?void 0:a.iconsCollections.find((l=>{const t=`@${u.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t})))||e}));function v(e){const l=function(e){let l=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==l?void 0:l.innerHTML.trim())||"";l&&n&&o.addIcon(`@${u.value}:${t.prefix}:${t.name}`,{body:n,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return a&&(t.src&&!o.iconExists(`@${u.value}:${t.prefix}:${t.name}`)?(n.value=!1,a.fetchIcon(t.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):t.svg&&v(t.svg)),(l,t)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:l.rotate,color:l.color,onLoad:l.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},g={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},B={modifiers:[String,Array]},S={hintLabel:{type:String,default:""}},x={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},w={debounce:[Number,String]},L={icon:{type:[String,Object]},iconPosition:{type:String,default:d.before,validation:e=>Object.values(d).includes(e)}},k={tabindex:{type:[String,Number],default:0}},V={floating:Boolean},$={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const N={...{...$,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...k,...h,...y,...f,...p,...S,...g,...B,...x,...w,...L,...V,...b,minlength:Number,maxlength:Number,placeholder:String,required:Boolean};v.button;const _={...N,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:"soft"},spellcheck:{type:[Boolean,String],default:"default"},resizable:Boolean};const I=["for"],E={class:"vv-textarea__wrapper"},P={key:0,class:"vv-textarea__input-before"},A={class:"vv-textarea__inner"},C=["id"],j={key:1,class:"vv-textarea__input-after"},q={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:_,emits:["update:modelValue","focus","blur","keyup"],setup(o,{emit:r}){const v=o,c=e.useSlots(),f=e.ref(),{id:p,icon:g,iconPosition:h,label:b,modelValue:y,count:B,valid:S,invalid:x,loading:w,modifiers:L}=e.toRefs(v),k=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(p),V=e.computed((()=>`${k.value}-hint`)),$=e.computed((()=>v.floating&&a(v.placeholder)?" ":v.placeholder)),N=function(l,o,t=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof t&&(t=parseInt(t)),e.computed({get:()=>n(null==l?void 0:l.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),t)}})}(y,r,v.debounce),{hasIcon:_,hasIconBefore:z,hasIconAfter:O}=function(l,o){const t=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===d.before))),n=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===d.after))),a=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.left))),i=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.right))),r=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.top))),v=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),hasIconLeft:a,hasIconRight:i,hasIconTop:r,hasIconBottom:v,hasIconBefore:t,hasIconAfter:n}}(g,h),{focused:T}=function(o,t){const{focused:n}=l.useFocus(o);return e.watch(n,(l=>{t(l?"focus":"blur",e.unref(o))})),{focused:n}}(f,r),F=l.useElementVisibility(f);e.watch(F,(e=>{e&&v.autofocus&&(T.value=!0)}));const{formatted:R}=function(l,o){const t=e.computed((()=>(e.unref(l)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&t.value<(null==o?void 0:o.lowerLimit)?t.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&t.value<(null==o?void 0:o.upperLimit)?o.upperLimit-t.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`${t.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return t.value}));return{length:t,gap:n,formatted:a}}(N,{mode:v.count,upperLimit:v.maxlength,lowerLimit:v.minlength}),D=e.computed((()=>!v.disabled&&!v.readonly)),H=e.computed((()=>D.value?v.tabindex:-1)),M=e.computed((()=>!a(y))),J=e.computed((()=>!0===v.invalid||!0!==v.valid&&void 0)),{HintSlot:K,hasHint:U,hasInvalid:G}=function(o,t){const{invalid:r,valid:u,hint:d,loading:v}=t,{hintLabel:c,modelValue:s,valid:m,validLabel:f,invalid:p,invalidLabel:g,...h}=e.toRefs(o),b=n(h,"loading"),y=n(h,"loadingLabel"),B=e.computed((()=>!(!p.value||(!p.value||!r)&&!((null==g?void 0:g.value)&&Array.isArray(g.value)&&g.value.length>0)&&(!(null==g?void 0:g.value)||a(g))))),S=e.computed((()=>!!(c&&c.value||d))),x=e.computed((()=>!!(f&&f.value||u))),w=e.computed((()=>!!((null==b?void 0:b.value)&&v||(null==b?void 0:b.value)&&(null==y?void 0:y.value)))),L=e.computed((()=>S.value||x.value||B.value||w.value));return{hasInvalid:B,hasHint:S,hasValid:x,hasLoading:w,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(o){const t=e.computed((()=>{const e=l.toReactive({hintLabel:c,modelValue:s,valid:m,validLabel:f,invalid:p,invalidLabel:g,loading:b,loadingLabel:y,...o.params});return(null==p?void 0:p.value)?(null==r?void 0:r(e))||i(null==g?void 0:g.value)||(null==c?void 0:c.value):(null==m?void 0:m.value)?(null==u?void 0:u(e))||i(null==f?void 0:f.value)||(null==c?void 0:c.value):(null==b?void 0:b.value)?(null==v?void 0:v(e))||i(null==y?void 0:y.value)||(null==c?void 0:c.value):(null==d?void 0:d(e))||i(null==c?void 0:c.value)||(null==c?void 0:c.value)}));return{isVisible:L,hasInvalid:B,hasValid:x,hintContent:t}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(v,c),Q=s("vv-textarea",L,e.computed((()=>({valid:S.value,invalid:x.value,loading:w.value,disabled:v.disabled,readonly:v.readonly,"icon-before":z.value,"icon-after":O.value,floating:v.floating&&!a(v.label),dirty:M.value,focused:T.value,resizable:v.resizable})))),W=e.computed((()=>({name:v.name,placeholder:$.value,tabindex:H.value,disabled:v.disabled,readonly:v.readonly,required:v.required,autocomplete:v.autocomplete,minlength:v.minlength,maxlength:v.maxlength,cols:v.cols,rows:v.rows,wrap:v.wrap,spellcheck:v.spellcheck,"aria-invalid":J.value,"aria-describedby":!G.value&&U.value?V.value:void 0,"aria-errormessage":G.value?V.value:void 0}))),X=e.computed((()=>({valid:v.valid,invalid:v.invalid,modelValue:v.modelValue,hintLabel:v.hintLabel,maxlength:v.maxlength,minlength:v.minlength,clear:Y}))),Y=()=>{N.value=void 0};return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(Q))},[e.unref(b)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(k),class:"vv-textarea__label"},e.toDisplayString(e.unref(b)),9,I)):e.createCommentVNode("",!0),e.createElementVNode("div",E,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",P,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.unref(z)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-textarea__icon"},e.unref(_)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(k),ref_key:"textarea",ref:f,"onUpdate:modelValue":o[0]||(o[0]=l=>e.isRef(N)?N.value=l:null)},e.unref(W),{onKeyup:o[1]||(o[1]=e=>r("keyup",e))}),null,16,C),[[e.vModelText,e.unref(N)]]),e.unref(O)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-textarea__icon vv-textarea__icon-after"},e.unref(_)),null,16)):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",q,[e.renderSlot(l.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(X))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(R)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(K),{id:e.unref(V),class:"vv-textarea__hint"},null,8,["id"])],2))}})}));
1
+ !function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=l(e.vue,e.core,e.vue$1,e.nanoid)}(this,(function(e,l,o,t){"use strict";function n(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const o=l.split(".");let t=e;for(let l=0,n=o.length;l<n;++l){if(null==e)return null;t=t[o[l]]}return t}}return null}function a(l){return null==(o=e.unref(l))||""===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(l=e)||l instanceof String;var l})).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||{}),d=(e=>(e.before="before",e.after="after",e))(d||{}),v=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(v||{});const c=Symbol.for("volver");function s(l,o,t){return e.computed((()=>{const n={[l]:!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[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((o=>{n[`${l}--${o}`]=e.unref(t.value[o])})),n}))}const m=e.defineComponent({name:"VvIcon",props:r,setup(l){const t=l,n=e.ref(!0),a=e.inject(c),{modifiers:i}=e.toRefs(t),r=s("vv-icon",i),u=e.computed((()=>t.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=t.name??"",l=`@${u.value}:${t.prefix}:${t.name}`;return o.iconExists(e)?e:o.iconExists(l)?l:(null==a?void 0:a.iconsCollections.find((l=>{const t=`@${u.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t})))||e}));function v(e){const l=function(e){let l=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==l?void 0:l.innerHTML.trim())||"";l&&n&&o.addIcon(`@${u.value}:${t.prefix}:${t.name}`,{body:n,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return a&&(t.src&&!o.iconExists(`@${u.value}:${t.prefix}:${t.name}`)?(n.value=!1,a.fetchIcon(t.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):t.svg&&v(t.svg)),(l,t)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:l.rotate,color:l.color,onLoad:l.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},g={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},B={modifiers:[String,Array]},S={hintLabel:{type:String,default:""}},x={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},w={debounce:[Number,String]},L={icon:{type:[String,Object]},iconPosition:{type:String,default:d.before,validation:e=>Object.values(d).includes(e)}},k={tabindex:{type:[String,Number],default:0}},V={floating:Boolean},$={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const N={...{...$,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...k,...h,...y,...f,...p,...S,...g,...B,...x,...w,...L,...V,...b,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};v.button;const _={...N,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:"soft"},spellcheck:{type:[Boolean,String],default:"default"},resizable:Boolean};const I=["for"],E={class:"vv-textarea__wrapper"},P={key:0,class:"vv-textarea__input-before"},A={class:"vv-textarea__inner"},C=["id"],j={key:1,class:"vv-textarea__input-after"},q={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:_,emits:["update:modelValue","focus","blur","keyup"],setup(o,{emit:r}){const v=o,c=e.useSlots(),f=e.ref(),{id:p,icon:g,iconPosition:h,label:b,modelValue:y,count:B,valid:S,invalid:x,loading:w,modifiers:L}=e.toRefs(v),k=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(p),V=e.computed((()=>`${k.value}-hint`)),$=e.computed((()=>v.floating&&a(v.placeholder)?" ":v.placeholder)),N=function(l,o,t=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof t&&(t=parseInt(t)),e.computed({get:()=>n(null==l?void 0:l.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),t)}})}(y,r,v.debounce),{hasIcon:_,hasIconBefore:z,hasIconAfter:O}=function(l,o){const t=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===d.before))),n=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===d.after))),a=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.left))),i=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.right))),r=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.top))),v=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),hasIconLeft:a,hasIconRight:i,hasIconTop:r,hasIconBottom:v,hasIconBefore:t,hasIconAfter:n}}(g,h),{focused:T}=function(o,t){const{focused:n}=l.useFocus(o);return e.watch(n,(l=>{t(l?"focus":"blur",e.unref(o))})),{focused:n}}(f,r),F=l.useElementVisibility(f);e.watch(F,(e=>{e&&v.autofocus&&(T.value=!0)}));const{formatted:R}=function(l,o){const t=e.computed((()=>(e.unref(l)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&t.value<(null==o?void 0:o.lowerLimit)?t.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&t.value<(null==o?void 0:o.upperLimit)?o.upperLimit-t.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`${t.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return t.value}));return{length:t,gap:n,formatted:a}}(N,{mode:v.count,upperLimit:Number(v.maxlength),lowerLimit:Number(v.minlength)}),D=e.computed((()=>!v.disabled&&!v.readonly)),H=e.computed((()=>D.value?v.tabindex:-1)),M=e.computed((()=>!a(y))),J=e.computed((()=>!0===v.invalid||!0!==v.valid&&void 0)),{HintSlot:K,hasHint:U,hasInvalid:G}=function(o,t){const{invalid:r,valid:u,hint:d,loading:v}=t,{hintLabel:c,modelValue:s,valid:m,validLabel:f,invalid:p,invalidLabel:g,...h}=e.toRefs(o),b=n(h,"loading"),y=n(h,"loadingLabel"),B=e.computed((()=>!(!p.value||(!p.value||!r)&&!((null==g?void 0:g.value)&&Array.isArray(g.value)&&g.value.length>0)&&(!(null==g?void 0:g.value)||a(g))))),S=e.computed((()=>!!(c&&c.value||d))),x=e.computed((()=>!!(f&&f.value||u))),w=e.computed((()=>!!((null==b?void 0:b.value)&&v||(null==b?void 0:b.value)&&(null==y?void 0:y.value)))),L=e.computed((()=>S.value||x.value||B.value||w.value));return{hasInvalid:B,hasHint:S,hasValid:x,hasLoading:w,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(o){const t=e.computed((()=>{const e=l.toReactive({hintLabel:c,modelValue:s,valid:m,validLabel:f,invalid:p,invalidLabel:g,loading:b,loadingLabel:y,...o.params});return(null==p?void 0:p.value)?(null==r?void 0:r(e))||i(null==g?void 0:g.value)||(null==c?void 0:c.value):(null==m?void 0:m.value)?(null==u?void 0:u(e))||i(null==f?void 0:f.value)||(null==c?void 0:c.value):(null==b?void 0:b.value)?(null==v?void 0:v(e))||i(null==y?void 0:y.value)||(null==c?void 0:c.value):(null==d?void 0:d(e))||i(null==c?void 0:c.value)||(null==c?void 0:c.value)}));return{isVisible:L,hasInvalid:B,hasValid:x,hintContent:t}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(v,c),Q=s("vv-textarea",L,e.computed((()=>({valid:S.value,invalid:x.value,loading:w.value,disabled:v.disabled,readonly:v.readonly,"icon-before":z.value,"icon-after":O.value,floating:v.floating&&!a(v.label),dirty:M.value,focused:T.value,resizable:v.resizable})))),W=e.computed((()=>({name:v.name,placeholder:$.value,tabindex:H.value,disabled:v.disabled,readonly:v.readonly,required:v.required,autocomplete:v.autocomplete,minlength:v.minlength,maxlength:v.maxlength,cols:v.cols,rows:v.rows,wrap:v.wrap,spellcheck:v.spellcheck,"aria-invalid":J.value,"aria-describedby":!G.value&&U.value?V.value:void 0,"aria-errormessage":G.value?V.value:void 0}))),X=e.computed((()=>({valid:v.valid,invalid:v.invalid,modelValue:v.modelValue,hintLabel:v.hintLabel,maxlength:v.maxlength,minlength:v.minlength,clear:Y}))),Y=()=>{N.value=void 0};return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(Q))},[e.unref(b)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(k),class:"vv-textarea__label"},e.toDisplayString(e.unref(b)),9,I)):e.createCommentVNode("",!0),e.createElementVNode("div",E,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",P,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.unref(z)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-textarea__icon"},e.unref(_)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(k),ref_key:"textarea",ref:f,"onUpdate:modelValue":o[0]||(o[0]=l=>e.isRef(N)?N.value=l:null)},e.unref(W),{onKeyup:o[1]||(o[1]=e=>r("keyup",e))}),null,16,C),[[e.vModelText,e.unref(N)]]),e.unref(O)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-textarea__icon vv-textarea__icon-after"},e.unref(_)),null,16)):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",q,[e.renderSlot(l.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(X))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(R)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(K),{id:e.unref(V),class:"vv-textarea__hint"},null,8,["id"])],2))}})}));
@@ -17,8 +17,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
17
17
  default: string;
18
18
  };
19
19
  resizable: BooleanConstructor;
20
- minlength: NumberConstructor;
21
- maxlength: NumberConstructor;
20
+ minlength: (StringConstructor | NumberConstructor)[];
21
+ maxlength: (StringConstructor | NumberConstructor)[];
22
22
  placeholder: StringConstructor;
23
23
  required: BooleanConstructor;
24
24
  label: (StringConstructor | NumberConstructor)[];
@@ -86,8 +86,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
86
86
  default: string;
87
87
  };
88
88
  resizable: BooleanConstructor;
89
- minlength: NumberConstructor;
90
- maxlength: NumberConstructor;
89
+ minlength: (StringConstructor | NumberConstructor)[];
90
+ maxlength: (StringConstructor | NumberConstructor)[];
91
91
  placeholder: StringConstructor;
92
92
  required: BooleanConstructor;
93
93
  label: (StringConstructor | NumberConstructor)[];
@@ -164,8 +164,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
164
164
  invalid: boolean;
165
165
  modelValue: string | undefined;
166
166
  hintLabel: string;
167
- maxlength: number | undefined;
168
- minlength: number | undefined;
167
+ maxlength: string | number | undefined;
168
+ minlength: string | number | undefined;
169
169
  clear: () => void;
170
170
  }) => any;
171
171
  after: (_: {
@@ -173,8 +173,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
173
173
  invalid: boolean;
174
174
  modelValue: string | undefined;
175
175
  hintLabel: string;
176
- maxlength: number | undefined;
177
- minlength: number | undefined;
176
+ maxlength: string | number | undefined;
177
+ minlength: string | number | undefined;
178
178
  clear: () => void;
179
179
  }) => any;
180
180
  count: (_: {
@@ -182,8 +182,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
182
182
  invalid: boolean;
183
183
  modelValue: string | undefined;
184
184
  hintLabel: string;
185
- maxlength: number | undefined;
186
- minlength: number | undefined;
185
+ maxlength: string | number | undefined;
186
+ minlength: string | number | undefined;
187
187
  clear: () => void;
188
188
  }) => any;
189
189
  }>;
@@ -51,8 +51,8 @@ export declare const VvTextareaProps: {
51
51
  * If true, the textarea will be resizable
52
52
  */
53
53
  resizable: BooleanConstructor;
54
- minlength: NumberConstructor;
55
- maxlength: NumberConstructor;
54
+ minlength: (StringConstructor | NumberConstructor)[];
55
+ maxlength: (StringConstructor | NumberConstructor)[];
56
56
  placeholder: StringConstructor;
57
57
  required: BooleanConstructor;
58
58
  label: (StringConstructor | NumberConstructor)[];
@@ -118,6 +118,16 @@ const ModifiersProps = {
118
118
  return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
119
119
  }
120
120
  },
121
+ /**
122
+ * Dropdown strategy
123
+ */
124
+ strategy: {
125
+ type: String,
126
+ default: "absolute",
127
+ validator: (value) => {
128
+ return ["fixed", "absolute"].includes(value);
129
+ }
130
+ },
121
131
  /**
122
132
  * Dropdown show / hide transition name
123
133
  */