@volverjs/ui-vue 0.0.10-beta.53 → 0.0.10-beta.54

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 (39) hide show
  1. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +13 -1
  2. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  3. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -0
  4. package/dist/components/VvCheckboxGroup/index.d.ts +4 -0
  5. package/dist/components/VvInputFile/VvInputFile.es.js +17 -3
  6. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  7. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +9 -0
  8. package/dist/components/VvInputFile/index.d.ts +4 -0
  9. package/dist/components/VvInputText/VvInputText.es.js +1 -1
  10. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  11. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +13 -1
  12. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  13. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -0
  14. package/dist/components/VvRadioGroup/index.d.ts +4 -0
  15. package/dist/components/VvTextarea/VvTextarea.es.js +290 -290
  16. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  17. package/dist/components/index.es.js +16 -6
  18. package/dist/components/index.umd.js +1 -1
  19. package/dist/icons.es.js +3 -3
  20. package/dist/icons.umd.js +1 -1
  21. package/dist/props/index.d.ts +8 -1
  22. package/dist/stories/InputText/InputText.stories.d.ts +2 -0
  23. package/dist/stories/InputText/InputText.test.d.ts +2 -0
  24. package/package.json +3 -3
  25. package/src/assets/icons/detailed.json +1 -1
  26. package/src/assets/icons/normal.json +1 -1
  27. package/src/assets/icons/simple.json +1 -1
  28. package/src/components/VvCheckbox/VvCheckbox.vue +2 -2
  29. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +2 -0
  30. package/src/components/VvInputFile/VvInputFile.vue +12 -8
  31. package/src/components/VvInputFile/index.ts +2 -0
  32. package/src/components/VvInputText/VvInputText.vue +2 -2
  33. package/src/components/VvRadio/VvRadio.vue +2 -2
  34. package/src/components/VvRadioGroup/VvRadioGroup.vue +2 -0
  35. package/src/components/VvTextarea/VvTextarea.vue +1 -1
  36. package/src/props/index.ts +2 -1
  37. package/src/stories/InputText/InputText.stories.ts +37 -1
  38. package/src/stories/InputText/InputText.test.ts +18 -0
  39. package/src/stories/Textarea/Textarea.stories.ts +1 -1
@@ -1,134 +1,6 @@
1
1
  import { unref, computed, isRef, defineComponent, h, inject, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, useId, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withDirectives, vModelText, createTextVNode, createVNode, createSlots, withCtx } from "vue";
2
2
  import { iconExists, Icon, addIcon } from "@iconify/vue";
3
3
  import { useFocus, useElementVisibility } from "@vueuse/core";
4
- function isEmpty(value) {
5
- 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));
6
- }
7
- function isString(value) {
8
- return typeof value === "string" || value instanceof String;
9
- }
10
- function joinLines(items) {
11
- if (Array.isArray(items)) {
12
- return items.filter((item) => isString(item)).join(" ");
13
- }
14
- return items;
15
- }
16
- function HintSlotFactory(propsOrRef, slots) {
17
- const props = computed(() => {
18
- if (isRef(propsOrRef)) {
19
- return propsOrRef.value;
20
- }
21
- return propsOrRef;
22
- });
23
- const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
24
- const validLabel = computed(() => joinLines(props.value.validLabel));
25
- const loadingLabel = computed(() => props.value.loadingLabel);
26
- const hintLabel = computed(() => props.value.hintLabel);
27
- const hasLoadingLabelOrSlot = computed(
28
- () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
29
- );
30
- const hasInvalidLabelOrSlot = computed(
31
- () => !hasLoadingLabelOrSlot.value && Boolean(
32
- props.value.invalid && (slots.invalid || invalidLabel.value)
33
- )
34
- );
35
- const hasValidLabelOrSlot = computed(
36
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
37
- );
38
- const hasHintLabelOrSlot = computed(
39
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
40
- );
41
- const isVisible = computed(
42
- () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
43
- );
44
- const hintSlotScope = computed(() => ({
45
- modelValue: props.value.modelValue,
46
- valid: props.value.valid,
47
- invalid: props.value.invalid,
48
- loading: props.value.loading
49
- }));
50
- const HintSlot = defineComponent({
51
- name: "HintSlot",
52
- props: {
53
- tag: {
54
- type: String,
55
- default: "small"
56
- }
57
- },
58
- setup() {
59
- return {
60
- isVisible,
61
- invalidLabel,
62
- validLabel,
63
- loadingLabel,
64
- hintLabel,
65
- hasInvalidLabelOrSlot,
66
- hasValidLabelOrSlot,
67
- hasLoadingLabelOrSlot,
68
- hasHintLabelOrSlot
69
- };
70
- },
71
- render() {
72
- var _a, _b, _c, _d, _e, _f, _g, _h;
73
- if (this.isVisible) {
74
- let role;
75
- if (this.hasInvalidLabelOrSlot) {
76
- role = "alert";
77
- }
78
- if (this.hasValidLabelOrSlot) {
79
- role = "status";
80
- }
81
- if (this.hasLoadingLabelOrSlot) {
82
- return h(
83
- this.tag,
84
- {
85
- role
86
- },
87
- ((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
88
- );
89
- }
90
- if (this.hasInvalidLabelOrSlot) {
91
- return h(
92
- this.tag,
93
- {
94
- role
95
- },
96
- ((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
97
- );
98
- }
99
- if (this.hasValidLabelOrSlot) {
100
- return h(
101
- this.tag,
102
- {
103
- role
104
- },
105
- ((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
106
- );
107
- }
108
- return h(
109
- this.tag,
110
- {
111
- role
112
- },
113
- ((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
114
- );
115
- }
116
- return null;
117
- }
118
- });
119
- return {
120
- hasInvalidLabelOrSlot,
121
- hasHintLabelOrSlot,
122
- hasValidLabelOrSlot,
123
- hasLoadingLabelOrSlot,
124
- hintSlotScope,
125
- HintSlot
126
- };
127
- }
128
- const VvIconPropsDefaults = {
129
- prefix: "normal"
130
- /* normal */
131
- };
132
4
  var StorageType = /* @__PURE__ */ ((StorageType2) => {
133
5
  StorageType2["local"] = "local";
134
6
  StorageType2["session"] = "session";
@@ -176,168 +48,29 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
176
48
  return ActionTag2;
177
49
  })(ActionTag || {});
178
50
  const INJECTION_KEY_VOLVER = Symbol.for("volver");
179
- function useVolver() {
180
- return inject(INJECTION_KEY_VOLVER);
181
- }
182
- function useModifiers(prefix, modifiers, others) {
183
- return computed(() => {
184
- const toReturn = {
185
- [prefix]: true
186
- };
187
- const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
188
- if (modifiersArray) {
189
- if (Array.isArray(modifiersArray)) {
190
- modifiersArray.forEach((modifier) => {
191
- if (modifier) {
192
- toReturn[`${prefix}--${modifier}`] = true;
193
- }
194
- });
195
- }
196
- }
197
- if (others) {
198
- Object.keys(others.value).forEach((key) => {
199
- toReturn[`${prefix}--${key}`] = unref(others.value[key]);
200
- });
201
- }
202
- return toReturn;
203
- });
204
- }
205
- const __default__$1 = {
206
- name: "VvIcon"
207
- };
208
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
209
- ...__default__$1,
210
- props: /* @__PURE__ */ mergeDefaults({
211
- name: {},
212
- color: {},
213
- width: {},
214
- height: {},
215
- provider: {},
216
- prefix: {},
217
- src: {},
218
- horizontalFlip: { type: Boolean },
219
- verticalFlip: { type: Boolean },
220
- flip: {},
221
- mode: {},
222
- inline: { type: Boolean },
223
- rotate: {},
224
- onLoad: { type: Function },
225
- svg: {},
226
- modifiers: {}
227
- }, VvIconPropsDefaults),
228
- setup(__props) {
229
- const props = __props;
230
- const hasRotate = computed(() => {
231
- if (typeof props.rotate === "string") {
232
- return Number.parseFloat(props.rotate);
233
- }
234
- return props.rotate;
235
- });
236
- const show = ref(true);
237
- const volver = useVolver();
238
- const { modifiers } = toRefs(props);
239
- const bemCssClasses = useModifiers("vv-icon", modifiers);
240
- const provider = computed(() => {
241
- return props.provider || (volver == null ? void 0 : volver.iconsProvider);
242
- });
243
- const icon = computed(() => {
244
- const name = props.name ?? "";
245
- const iconName = `@${provider.value}:${props.prefix}:${name}`;
246
- if (iconExists(iconName)) {
247
- return iconName;
248
- }
249
- const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
250
- (iconsCollection2) => {
251
- const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
252
- return iconExists(icon2);
253
- }
254
- );
255
- if (iconsCollection) {
256
- return `@${provider.value}:${iconsCollection.prefix}:${name}`;
257
- }
258
- return name;
259
- });
260
- function getSvgContent(svg) {
261
- let dom;
262
- if (typeof window === "undefined") {
263
- const { JSDOM } = require("jsdom");
264
- dom = new JSDOM().window;
265
- }
266
- const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
267
- const svgDomString = domParser.parseFromString(svg, "text/html");
268
- const svgEl = svgDomString.querySelector("svg");
269
- return svgEl;
270
- }
271
- function addIconFromSvg(svg) {
272
- const svgContentEl = getSvgContent(svg);
273
- const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
274
- if (svgContentEl && svgContent) {
275
- addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
276
- body: svgContent,
277
- // Set height and width from svg content
278
- height: svgContentEl.viewBox.baseVal.height,
279
- width: svgContentEl.viewBox.baseVal.width
280
- });
281
- }
282
- }
283
- if (volver) {
284
- if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
285
- show.value = false;
286
- volver.fetchIcon(props.src).then((svg) => {
287
- if (svg) {
288
- addIconFromSvg(svg);
289
- show.value = true;
290
- }
291
- }).catch((e) => {
292
- throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
293
- });
294
- }
295
- }
296
- if (props.svg) {
297
- addIconFromSvg(props.svg);
298
- }
299
- return (_ctx, _cache) => {
300
- return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
301
- key: 0,
302
- class: unref(bemCssClasses)
303
- }, {
304
- inline: _ctx.inline,
305
- width: _ctx.width,
306
- height: _ctx.height,
307
- horizontalFlip: _ctx.horizontalFlip,
308
- verticalFlip: _ctx.verticalFlip,
309
- flip: _ctx.flip,
310
- rotate: unref(hasRotate),
311
- color: _ctx.color,
312
- onLoad: _ctx.onLoad,
313
- icon: unref(icon)
314
- }), null, 16, ["class"])) : createCommentVNode("v-if", true);
315
- };
316
- }
317
- });
318
- const LinkProps = {
319
- /**
320
- * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
321
- * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
322
- */
323
- to: {
324
- type: [String, Object]
325
- },
326
- /**
327
- * Anchor href
328
- */
329
- href: String,
330
- /**
331
- * Anchor target
332
- */
333
- target: String,
334
- /**
335
- * Anchor rel
336
- */
337
- rel: {
338
- type: String,
339
- default: "noopener noreferrer"
340
- }
51
+ const LinkProps = {
52
+ /**
53
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
54
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
55
+ */
56
+ to: {
57
+ type: [String, Object]
58
+ },
59
+ /**
60
+ * Anchor href
61
+ */
62
+ href: String,
63
+ /**
64
+ * Anchor target
65
+ */
66
+ target: String,
67
+ /**
68
+ * Anchor rel
69
+ */
70
+ rel: {
71
+ type: String,
72
+ default: "noopener noreferrer"
73
+ }
341
74
  };
342
75
  const ValidProps = {
343
76
  /**
@@ -762,6 +495,273 @@ const VvTextareaProps = {
762
495
  */
763
496
  resizable: Boolean
764
497
  };
498
+ function isEmpty(value) {
499
+ 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));
500
+ }
501
+ function isString(value) {
502
+ return typeof value === "string" || value instanceof String;
503
+ }
504
+ function joinLines(items) {
505
+ if (Array.isArray(items)) {
506
+ return items.filter((item) => isString(item)).join(" ");
507
+ }
508
+ return items;
509
+ }
510
+ function HintSlotFactory(propsOrRef, slots) {
511
+ const props = computed(() => {
512
+ if (isRef(propsOrRef)) {
513
+ return propsOrRef.value;
514
+ }
515
+ return propsOrRef;
516
+ });
517
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
518
+ const validLabel = computed(() => joinLines(props.value.validLabel));
519
+ const loadingLabel = computed(() => props.value.loadingLabel);
520
+ const hintLabel = computed(() => props.value.hintLabel);
521
+ const hasLoadingLabelOrSlot = computed(
522
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
523
+ );
524
+ const hasInvalidLabelOrSlot = computed(
525
+ () => !hasLoadingLabelOrSlot.value && Boolean(
526
+ props.value.invalid && (slots.invalid || invalidLabel.value)
527
+ )
528
+ );
529
+ const hasValidLabelOrSlot = computed(
530
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
531
+ );
532
+ const hasHintLabelOrSlot = computed(
533
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
534
+ );
535
+ const isVisible = computed(
536
+ () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
537
+ );
538
+ const hintSlotScope = computed(() => ({
539
+ modelValue: props.value.modelValue,
540
+ valid: props.value.valid,
541
+ invalid: props.value.invalid,
542
+ loading: props.value.loading
543
+ }));
544
+ const HintSlot = defineComponent({
545
+ name: "HintSlot",
546
+ props: {
547
+ tag: {
548
+ type: String,
549
+ default: "small"
550
+ }
551
+ },
552
+ setup() {
553
+ return {
554
+ isVisible,
555
+ invalidLabel,
556
+ validLabel,
557
+ loadingLabel,
558
+ hintLabel,
559
+ hasInvalidLabelOrSlot,
560
+ hasValidLabelOrSlot,
561
+ hasLoadingLabelOrSlot,
562
+ hasHintLabelOrSlot
563
+ };
564
+ },
565
+ render() {
566
+ var _a, _b, _c, _d, _e, _f, _g, _h;
567
+ if (this.isVisible) {
568
+ let role;
569
+ if (this.hasInvalidLabelOrSlot) {
570
+ role = "alert";
571
+ }
572
+ if (this.hasValidLabelOrSlot) {
573
+ role = "status";
574
+ }
575
+ if (this.hasLoadingLabelOrSlot) {
576
+ return h(
577
+ this.tag,
578
+ {
579
+ role
580
+ },
581
+ ((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
582
+ );
583
+ }
584
+ if (this.hasInvalidLabelOrSlot) {
585
+ return h(
586
+ this.tag,
587
+ {
588
+ role
589
+ },
590
+ ((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
591
+ );
592
+ }
593
+ if (this.hasValidLabelOrSlot) {
594
+ return h(
595
+ this.tag,
596
+ {
597
+ role
598
+ },
599
+ ((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
600
+ );
601
+ }
602
+ return h(
603
+ this.tag,
604
+ {
605
+ role
606
+ },
607
+ ((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
608
+ );
609
+ }
610
+ return null;
611
+ }
612
+ });
613
+ return {
614
+ hasInvalidLabelOrSlot,
615
+ hasHintLabelOrSlot,
616
+ hasValidLabelOrSlot,
617
+ hasLoadingLabelOrSlot,
618
+ hintSlotScope,
619
+ HintSlot
620
+ };
621
+ }
622
+ const VvIconPropsDefaults = {
623
+ prefix: "normal"
624
+ /* normal */
625
+ };
626
+ function useVolver() {
627
+ return inject(INJECTION_KEY_VOLVER);
628
+ }
629
+ function useModifiers(prefix, modifiers, others) {
630
+ return computed(() => {
631
+ const toReturn = {
632
+ [prefix]: true
633
+ };
634
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
635
+ if (modifiersArray) {
636
+ if (Array.isArray(modifiersArray)) {
637
+ modifiersArray.forEach((modifier) => {
638
+ if (modifier) {
639
+ toReturn[`${prefix}--${modifier}`] = true;
640
+ }
641
+ });
642
+ }
643
+ }
644
+ if (others) {
645
+ Object.keys(others.value).forEach((key) => {
646
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
647
+ });
648
+ }
649
+ return toReturn;
650
+ });
651
+ }
652
+ const __default__$1 = {
653
+ name: "VvIcon"
654
+ };
655
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
656
+ ...__default__$1,
657
+ props: /* @__PURE__ */ mergeDefaults({
658
+ name: {},
659
+ color: {},
660
+ width: {},
661
+ height: {},
662
+ provider: {},
663
+ prefix: {},
664
+ src: {},
665
+ horizontalFlip: { type: Boolean },
666
+ verticalFlip: { type: Boolean },
667
+ flip: {},
668
+ mode: {},
669
+ inline: { type: Boolean },
670
+ rotate: {},
671
+ onLoad: { type: Function },
672
+ svg: {},
673
+ modifiers: {}
674
+ }, VvIconPropsDefaults),
675
+ setup(__props) {
676
+ const props = __props;
677
+ const hasRotate = computed(() => {
678
+ if (typeof props.rotate === "string") {
679
+ return Number.parseFloat(props.rotate);
680
+ }
681
+ return props.rotate;
682
+ });
683
+ const show = ref(true);
684
+ const volver = useVolver();
685
+ const { modifiers } = toRefs(props);
686
+ const bemCssClasses = useModifiers("vv-icon", modifiers);
687
+ const provider = computed(() => {
688
+ return props.provider || (volver == null ? void 0 : volver.iconsProvider);
689
+ });
690
+ const icon = computed(() => {
691
+ const name = props.name ?? "";
692
+ const iconName = `@${provider.value}:${props.prefix}:${name}`;
693
+ if (iconExists(iconName)) {
694
+ return iconName;
695
+ }
696
+ const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
697
+ (iconsCollection2) => {
698
+ const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
699
+ return iconExists(icon2);
700
+ }
701
+ );
702
+ if (iconsCollection) {
703
+ return `@${provider.value}:${iconsCollection.prefix}:${name}`;
704
+ }
705
+ return name;
706
+ });
707
+ function getSvgContent(svg) {
708
+ let dom;
709
+ if (typeof window === "undefined") {
710
+ const { JSDOM } = require("jsdom");
711
+ dom = new JSDOM().window;
712
+ }
713
+ const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
714
+ const svgDomString = domParser.parseFromString(svg, "text/html");
715
+ const svgEl = svgDomString.querySelector("svg");
716
+ return svgEl;
717
+ }
718
+ function addIconFromSvg(svg) {
719
+ const svgContentEl = getSvgContent(svg);
720
+ const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
721
+ if (svgContentEl && svgContent) {
722
+ addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
723
+ body: svgContent,
724
+ // Set height and width from svg content
725
+ height: svgContentEl.viewBox.baseVal.height,
726
+ width: svgContentEl.viewBox.baseVal.width
727
+ });
728
+ }
729
+ }
730
+ if (volver) {
731
+ if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
732
+ show.value = false;
733
+ volver.fetchIcon(props.src).then((svg) => {
734
+ if (svg) {
735
+ addIconFromSvg(svg);
736
+ show.value = true;
737
+ }
738
+ }).catch((e) => {
739
+ throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
740
+ });
741
+ }
742
+ }
743
+ if (props.svg) {
744
+ addIconFromSvg(props.svg);
745
+ }
746
+ return (_ctx, _cache) => {
747
+ return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
748
+ key: 0,
749
+ class: unref(bemCssClasses)
750
+ }, {
751
+ inline: _ctx.inline,
752
+ width: _ctx.width,
753
+ height: _ctx.height,
754
+ horizontalFlip: _ctx.horizontalFlip,
755
+ verticalFlip: _ctx.verticalFlip,
756
+ flip: _ctx.flip,
757
+ rotate: unref(hasRotate),
758
+ color: _ctx.color,
759
+ onLoad: _ctx.onLoad,
760
+ icon: unref(icon)
761
+ }), null, 16, ["class"])) : createCommentVNode("v-if", true);
762
+ };
763
+ }
764
+ });
765
765
  function useDefaults(componentName, propsDefinition, props) {
766
766
  const volver = useVolver();
767
767
  const volverComponentDefaults = computed(() => {
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.core)}(this,(function(e,t,l){"use strict";function o(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function a(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const i={prefix:"normal"};var n=(e=>(e.local="local",e.session="session",e))(n||{}),r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),u=(e=>(e.before="before",e.after="after",e))(u||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{}),s=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(s||{});const v=Symbol.for("volver");function c(){return e.inject(v)}function f(t,l,o){return e.computed((()=>{const a={[t]:!0},i="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return i&&Array.isArray(i)&&i.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const p=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},i),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),i=e.ref(!0),n=c(),{modifiers:r}=e.toRefs(o),u=f("vv-icon",r),d=e.computed((()=>o.provider||(null==n?void 0:n.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconExists(l))return l;const a=null==n?void 0:n.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function v(e){const l=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return n&&o.src&&!t.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(i.value=!1,n.fetchIcon(o.src).then((e=>{e&&(v(e),i.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(l,o)=>e.unref(i)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,onLoad:l.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),m={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},g={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},b={disabled:{type:Boolean,default:!1}},y={required:{type:Boolean,default:!1}},S=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),L={readonly:{type:Boolean,default:!1}},B={modifiers:{type:[String,Array],default:void 0}},x={hintLabel:{type:String,default:""}},$={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},k={debounce:{type:[Number,String],default:void 0}},w={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:u.before,validation:e=>Object.values(u).includes(e)}},V={tabindex:{type:[String,Number],default:0}},N={floating:{type:Boolean,default:!1}},O={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const P={...{...O,name:{type:String,required:!0}},...{autofocus:{type:Boolean,default:!1}},...{autocomplete:{type:String,default:"off"}},...V,...b,...L,...m,...h,...x,...g,...B,...$,...k,...w,...N,...S,minlength:{type:[String,Number],default:void 0},maxlength:{type:[String,Number],default:void 0},placeholder:{type:String,default:void 0},...y};d.button,s.button,n.local;const _={...P,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"],C={class:"vv-textarea__wrapper"},E={key:0,class:"vv-textarea__input-before"},z={class:"vv-textarea__inner"},A=["id"],j={key:1,class:"vv-textarea__input-after"},R={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:_,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:i}){const n=t,d=i,s=e.useSlots(),v=function(t,l,o){const a=c(),i=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===i.value)return o;const e=i.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const i=a[o];if(l[o]=i,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===i&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===i&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(i)&&(l[o]=e[o]):a===i&&(l[o]=e[o])}}return l}),{})}))}("VvTextarea",_,n),m=e.ref(),{id:h,icon:g,iconPosition:b,label:y,modelValue:S,count:L,valid:B,invalid:x,loading:$,modifiers:k,debounce:w,minlength:V,maxlength:N}=e.toRefs(n),O=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(h),P=e.computed((()=>`${O.value}-hint`)),q=e.computed((()=>n.floating&&o(n.placeholder)?" ":n.placeholder)),T=function(t,l,o=0,{getter:a=e=>e,setter:i=e=>e}={}){let n;return"string"==typeof o&&(o=Number.parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{n&&clearTimeout(n),n=setTimeout((()=>{l("update:modelValue",i(e))}),o)}})}(S,d,null==w?void 0:w.value),{hasIconBefore:F,hasIconAfter:D}=function(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===u.before?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===u.after?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===r.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===r.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===r.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===r.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:n,hasIconRight:d,hasIconTop:s,hasIconBottom:v,hasIconBefore:a,hasIconAfter:i}}(g,b),{focused:H}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(m,d),M=l.useElementVisibility(m);e.watch(M,(e=>{e&&n.autofocus&&(H.value=!0)}));const{formatted:J}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),i=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:i}}(T,{mode:null==L?void 0:L.value,upperLimit:Number(null==N?void 0:N.value),lowerLimit:Number(null==V?void 0:V.value)}),K=e.computed((()=>!n.disabled&&!n.readonly)),U=e.computed((()=>K.value?n.tabindex:-1)),G=e.computed((()=>!o(S))),Q=e.computed((()=>!0===n.invalid||!0!==n.valid&&void 0)),{HintSlot:W,hasHintLabelOrSlot:X,hasInvalidLabelOrSlot:Y,hintSlotScope:Z}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),i=e.computed((()=>a(o.value.invalidLabel))),n=e.computed((()=>a(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),u=e.computed((()=>o.value.hintLabel)),d=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),s=e.computed((()=>!d.value&&Boolean(o.value.invalid&&(l.invalid||i.value)))),v=e.computed((()=>!d.value&&!s.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!d.value&&!s.value&&!v.value&&Boolean(l.hint||u.value))),f=e.computed((()=>s.value||v.value||d.value||c.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:i,validLabel:n,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:d,hasHintLabelOrSlot:c}),render(){var t,l,o,a,i,n,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(i=this.$slots).valid)?void 0:n.call(i))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:d,hintSlotScope:p,HintSlot:m}}(v,s),ee=f("vv-textarea",k,e.computed((()=>({valid:B.value,invalid:x.value,loading:$.value,disabled:n.disabled,readonly:n.readonly,required:n.required,"icon-before":void 0!==F.value,"icon-after":void 0!==D.value,floating:n.floating&&!o(n.label),dirty:G.value,focus:H.value,resizable:n.resizable})))),te=e.computed((()=>({name:n.name,placeholder:q.value,tabindex:U.value,disabled:n.disabled,readonly:n.readonly,required:n.required,autocomplete:n.autocomplete,minlength:n.minlength,maxlength:n.maxlength,cols:n.cols,rows:n.rows,wrap:n.wrap,spellcheck:n.spellcheck,"aria-invalid":Q.value,"aria-describedby":X.value?P.value:void 0,"aria-errormessage":Y.value?P.value:void 0}))),le=e.computed((()=>({valid:n.valid,invalid:n.invalid,modelValue:n.modelValue,hintLabel:n.hintLabel,maxlength:n.maxlength,minlength:n.minlength,clear:oe})));function oe(){T.value=void 0}return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ee))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(O),class:"vv-textarea__label"},e.toDisplayString(e.unref(y)),9,I)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",C,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",E,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[e.unref(F)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0},e.unref(F),{class:"vv-textarea__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(O),ref_key:"textarea",ref:m,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(T)?T.value=t:null)},e.unref(te),{onKeyup:l[1]||(l[1]=e=>d("keyup",e))}),null,16,A),[[e.vModelText,e.unref(T)]]),e.unref(D)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:1},e.unref(D),{class:"vv-textarea__icon vv-textarea__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.unref(L)?(e.openBlock(),e.createElementBlock("span",R,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(le))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(J)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(W),{id:e.unref(P),class:"vv-textarea__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.core)}(this,(function(e,t,l){"use strict";var o=(e=>(e.local="local",e.session="session",e))(o||{}),a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},s={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},v={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},c={disabled:{type:Boolean,default:!1}},f={required:{type:Boolean,default:!1}},p=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),m={readonly:{type:Boolean,default:!1}},h={modifiers:{type:[String,Array],default:void 0}},g={hintLabel:{type:String,default:""}},b={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},y={debounce:{type:[Number,String],default:void 0}},S={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:i.before,validation:e=>Object.values(i).includes(e)}},L={tabindex:{type:[String,Number],default:0}},B={floating:{type:Boolean,default:!1}},x={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const $={...{...x,name:{type:String,required:!0}},...{autofocus:{type:Boolean,default:!1}},...{autocomplete:{type:String,default:"off"}},...L,...c,...m,...d,...s,...g,...v,...h,...b,...y,...S,...B,...p,minlength:{type:[String,Number],default:void 0},maxlength:{type:[String,Number],default:void 0},placeholder:{type:String,default:void 0},...f};n.button,r.button,o.local;const k={...$,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};function w(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function V(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const N={prefix:"normal"};function O(){return e.inject(u)}function P(t,l,o){return e.computed((()=>{const a={[t]:!0},i="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return i&&Array.isArray(i)&&i.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const _=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},N),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),i=e.ref(!0),n=O(),{modifiers:r}=e.toRefs(o),u=P("vv-icon",r),d=e.computed((()=>o.provider||(null==n?void 0:n.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconExists(l))return l;const a=null==n?void 0:n.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function v(e){const l=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return n&&o.src&&!t.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(i.value=!1,n.fetchIcon(o.src).then((e=>{e&&(v(e),i.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(l,o)=>e.unref(i)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,onLoad:l.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}});const I=["for"],C={class:"vv-textarea__wrapper"},E={key:0,class:"vv-textarea__input-before"},z={class:"vv-textarea__inner"},A=["id"],j={key:1,class:"vv-textarea__input-after"},R={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:k,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:o}){const n=t,r=o,u=e.useSlots(),d=function(t,l,o){const a=O(),i=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===i.value)return o;const e=i.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const i=a[o];if(l[o]=i,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===i&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===i&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(i)&&(l[o]=e[o]):a===i&&(l[o]=e[o])}}return l}),{})}))}("VvTextarea",k,n),s=e.ref(),{id:v,icon:c,iconPosition:f,label:p,modelValue:m,count:h,valid:g,invalid:b,loading:y,modifiers:S,debounce:L,minlength:B,maxlength:x}=e.toRefs(n),$=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(v),N=e.computed((()=>`${$.value}-hint`)),q=e.computed((()=>n.floating&&w(n.placeholder)?" ":n.placeholder)),T=function(t,l,o=0,{getter:a=e=>e,setter:i=e=>e}={}){let n;return"string"==typeof o&&(o=Number.parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{n&&clearTimeout(n),n=setTimeout((()=>{l("update:modelValue",i(e))}),o)}})}(m,r,null==L?void 0:L.value),{hasIconBefore:F,hasIconAfter:D}=function(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),n=e.computed((()=>(null==l?void 0:l.value)===i.before?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===i.after?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===a.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===a.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===a.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===a.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:v,hasIconBefore:n,hasIconAfter:r}}(c,f),{focused:H}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(s,r),M=l.useElementVisibility(s);e.watch(M,(e=>{e&&n.autofocus&&(H.value=!0)}));const{formatted:J}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),i=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:i}}(T,{mode:null==h?void 0:h.value,upperLimit:Number(null==x?void 0:x.value),lowerLimit:Number(null==B?void 0:B.value)}),K=e.computed((()=>!n.disabled&&!n.readonly)),U=e.computed((()=>K.value?n.tabindex:-1)),G=e.computed((()=>!w(m))),Q=e.computed((()=>!0===n.invalid||!0!==n.valid&&void 0)),{HintSlot:W,hasHintLabelOrSlot:X,hasInvalidLabelOrSlot:Y,hintSlotScope:Z}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>V(o.value.invalidLabel))),i=e.computed((()=>V(o.value.validLabel))),n=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||n.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||i.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:i,loadingLabel:n,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,o,a,i,n,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(i=this.$slots).valid)?void 0:n.call(i))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(d,u),ee=P("vv-textarea",S,e.computed((()=>({valid:g.value,invalid:b.value,loading:y.value,disabled:n.disabled,readonly:n.readonly,required:n.required,"icon-before":void 0!==F.value,"icon-after":void 0!==D.value,floating:n.floating&&!w(n.label),dirty:G.value,focus:H.value,resizable:n.resizable})))),te=e.computed((()=>({name:n.name,placeholder:q.value,tabindex:U.value,disabled:n.disabled,readonly:n.readonly,required:n.required,autocomplete:n.autocomplete,minlength:n.minlength,maxlength:n.maxlength,cols:n.cols,rows:n.rows,wrap:n.wrap,spellcheck:n.spellcheck,"aria-invalid":Q.value,"aria-describedby":X.value?N.value:void 0,"aria-errormessage":Y.value?N.value:void 0}))),le=e.computed((()=>({valid:n.valid,invalid:n.invalid,modelValue:n.modelValue,hintLabel:n.hintLabel,maxlength:n.maxlength,minlength:n.minlength,clear:oe})));function oe(){T.value=void 0}return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ee))},[e.unref(p)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref($),class:"vv-textarea__label"},e.toDisplayString(e.unref(p)),9,I)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",C,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",E,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[e.unref(F)?(e.openBlock(),e.createBlock(_,e.mergeProps({key:0},e.unref(F),{class:"vv-textarea__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref($),ref_key:"textarea",ref:s,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(T)?T.value=t:null)},e.unref(te),{onKeyup:l[1]||(l[1]=e=>r("keyup",e))}),null,16,A),[[e.vModelText,e.unref(T)]]),e.unref(D)?(e.openBlock(),e.createBlock(_,e.mergeProps({key:1},e.unref(D),{class:"vv-textarea__icon vv-textarea__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.unref(h)?(e.openBlock(),e.createElementBlock("span",R,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(le))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(J)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(W),{id:e.unref(N),class:"vv-textarea__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));