@volverjs/ui-vue 0.0.10-beta.15 → 0.0.10-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -2
- package/auto-imports.d.ts +2 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +33 -9
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +9 -2
- package/dist/components/VvAccordion/index.d.ts +4 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +33 -9
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +9 -2
- package/dist/components/VvAccordionGroup/index.d.ts +4 -1
- package/dist/components/VvAction/VvAction.es.js +29 -8
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +44 -10
- package/dist/components/VvAction/index.d.ts +21 -5
- package/dist/components/VvAlert/VvAlert.es.js +91 -107
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +14 -4
- package/dist/components/VvAlert/index.d.ts +7 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +91 -107
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +9 -2
- package/dist/components/VvAlertGroup/index.d.ts +6 -2
- package/dist/components/VvAvatar/VvAvatar.es.js +33 -9
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +11 -3
- package/dist/components/VvAvatar/index.d.ts +4 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +33 -9
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +9 -2
- package/dist/components/VvAvatarGroup/index.d.ts +4 -1
- package/dist/components/VvBadge/VvBadge.es.js +33 -9
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +11 -3
- package/dist/components/VvBadge/index.d.ts +4 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +33 -9
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -3
- package/dist/components/VvBreadcrumb/index.d.ts +4 -1
- package/dist/components/VvButton/VvButton.es.js +100 -119
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +78 -20
- package/dist/components/VvButton/index.d.ts +34 -12
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -9
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +17 -4
- package/dist/components/VvButtonGroup/index.d.ts +8 -2
- package/dist/components/VvCard/VvCard.es.js +33 -9
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +11 -3
- package/dist/components/VvCard/index.d.ts +4 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +56 -17
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +94 -22
- package/dist/components/VvCheckbox/index.d.ts +44 -11
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +64 -19
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +93 -22
- package/dist/components/VvCheckboxGroup/index.d.ts +44 -11
- package/dist/components/VvCombobox/VvCombobox.es.js +108 -165
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +97 -24
- package/dist/components/VvCombobox/index.d.ts +42 -11
- package/dist/components/VvDialog/VvDialog.es.js +51 -103
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +33 -9
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +14 -2
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -12
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +11 -3
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +25 -6
- package/dist/components/VvDropdown/index.d.ts +6 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +33 -9
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +29 -8
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +37 -10
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +22 -95
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +81 -44
- package/dist/components/VvIcon/index.d.ts +21 -48
- package/dist/components/VvInputFile/VvInputFile.es.js +107 -123
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +52 -12
- package/dist/components/VvInputFile/index.d.ts +24 -6
- package/dist/components/VvInputText/VvInputText.es.js +115 -147
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +141 -34
- package/dist/components/VvInputText/index.d.ts +71 -26
- package/dist/components/VvNav/VvNav.es.js +33 -9
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +9 -2
- package/dist/components/VvNav/index.d.ts +4 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +29 -8
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +33 -9
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +9 -2
- package/dist/components/VvProgress/index.d.ts +4 -1
- package/dist/components/VvRadio/VvRadio.es.js +56 -17
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +94 -22
- package/dist/components/VvRadio/index.d.ts +44 -11
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +64 -19
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +93 -22
- package/dist/components/VvRadioGroup/index.d.ts +44 -11
- package/dist/components/VvSelect/VvSelect.es.js +95 -138
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +97 -24
- package/dist/components/VvSelect/index.d.ts +46 -12
- package/dist/components/VvTab/VvTab.es.js +33 -9
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +9 -2
- package/dist/components/VvTab/index.d.ts +4 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +109 -143
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +141 -34
- package/dist/components/VvTextarea/index.d.ts +66 -17
- package/dist/components/VvTooltip/VvTooltip.es.js +33 -9
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +9 -2
- package/dist/components/VvTooltip/index.d.ts +4 -1
- package/dist/components/index.es.js +178 -232
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useComponentIcon.d.ts +9 -8
- package/dist/directives/index.es.js +33 -9
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +33 -9
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +251 -61
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +15 -4
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +77 -22
- package/dist/stories/Icon/Icon.settings.d.ts +1 -0
- package/package.json +33 -33
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAlert/index.ts +1 -3
- package/src/components/VvAlertGroup/index.ts +2 -1
- package/src/components/VvButton/VvButton.vue +6 -6
- package/src/components/VvButton/index.ts +2 -4
- package/src/components/VvCombobox/VvCombobox.vue +5 -8
- package/src/components/VvIcon/VvIcon.vue +2 -2
- package/src/components/VvIcon/index.ts +22 -48
- package/src/components/VvInputText/VvInputText.vue +11 -12
- package/src/components/VvSelect/VvSelect.vue +5 -8
- package/src/components/VvTextarea/VvTextarea.vue +5 -8
- package/src/composables/useComponentIcon.ts +15 -14
- package/src/props/index.ts +89 -25
- package/src/stories/Icon/Icon.settings.ts +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref, computed, isRef, defineComponent, h, inject, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withDirectives, vModelText, createTextVNode, createVNode, createSlots, withCtx } from "vue";
|
|
1
|
+
import { unref, computed, isRef, defineComponent, h, inject, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, 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 { uid } from "uid";
|
|
4
4
|
import { useFocus, useElementVisibility } from "@vueuse/core";
|
|
@@ -126,99 +126,9 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
126
126
|
HintSlot
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*/
|
|
133
|
-
color: String,
|
|
134
|
-
/**
|
|
135
|
-
* Width
|
|
136
|
-
*/
|
|
137
|
-
width: {
|
|
138
|
-
type: [String, Number]
|
|
139
|
-
},
|
|
140
|
-
/**
|
|
141
|
-
* Height
|
|
142
|
-
*/
|
|
143
|
-
height: {
|
|
144
|
-
type: [String, Number]
|
|
145
|
-
},
|
|
146
|
-
/**
|
|
147
|
-
* Icon name
|
|
148
|
-
* Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
|
|
149
|
-
* https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
150
|
-
*/
|
|
151
|
-
name: {
|
|
152
|
-
type: String,
|
|
153
|
-
required: true
|
|
154
|
-
},
|
|
155
|
-
/**
|
|
156
|
-
* By default 'vv'
|
|
157
|
-
* If custom collection is not added with "addCollection" DS class method, this prop could not be used
|
|
158
|
-
* Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
159
|
-
*/
|
|
160
|
-
provider: {
|
|
161
|
-
type: String
|
|
162
|
-
},
|
|
163
|
-
/**
|
|
164
|
-
* The name of icon set.
|
|
165
|
-
* Icon default options prefix: simple | normal | detailed
|
|
166
|
-
*/
|
|
167
|
-
prefix: {
|
|
168
|
-
type: String,
|
|
169
|
-
default: "normal"
|
|
170
|
-
},
|
|
171
|
-
/**
|
|
172
|
-
* Url remote SVG icon
|
|
173
|
-
*/
|
|
174
|
-
src: String,
|
|
175
|
-
/**
|
|
176
|
-
* Horizontal flip
|
|
177
|
-
*/
|
|
178
|
-
horizontalFlip: Boolean,
|
|
179
|
-
/**
|
|
180
|
-
* Vertical flip
|
|
181
|
-
*/
|
|
182
|
-
verticalFlip: Boolean,
|
|
183
|
-
/**
|
|
184
|
-
* String alternative to "horizontalFlip" and "verticalFlip".
|
|
185
|
-
* Example: https://docs.iconify.design/icon-components/vue/transform.html
|
|
186
|
-
*/
|
|
187
|
-
flip: String,
|
|
188
|
-
/**
|
|
189
|
-
* Icon render mode
|
|
190
|
-
* 'style' = 'bg' or 'mask', depending on icon content
|
|
191
|
-
* 'bg' = span with style using `background`
|
|
192
|
-
* 'mask' = span with style using `mask`
|
|
193
|
-
* 'svg' = svg
|
|
194
|
-
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
195
|
-
*/
|
|
196
|
-
mode: String,
|
|
197
|
-
/**
|
|
198
|
-
* Toggles inline or block mode
|
|
199
|
-
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
200
|
-
*/
|
|
201
|
-
inline: Boolean,
|
|
202
|
-
/**
|
|
203
|
-
* rotates icon
|
|
204
|
-
* Example https://docs.iconify.design/icon-components/vue/transform.html
|
|
205
|
-
*/
|
|
206
|
-
rotate: [Number, String],
|
|
207
|
-
/**
|
|
208
|
-
* A callback that is called when icon data has been loaded
|
|
209
|
-
*/
|
|
210
|
-
onLoad: Function,
|
|
211
|
-
/**
|
|
212
|
-
* SVG icon string
|
|
213
|
-
*/
|
|
214
|
-
svg: String,
|
|
215
|
-
/**
|
|
216
|
-
* Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
|
|
217
|
-
* @values string | string[]
|
|
218
|
-
*/
|
|
219
|
-
modifiers: {
|
|
220
|
-
type: [String, Array]
|
|
221
|
-
}
|
|
129
|
+
const VvIconPropsDefaults = {
|
|
130
|
+
prefix: "normal"
|
|
131
|
+
/* normal */
|
|
222
132
|
};
|
|
223
133
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
224
134
|
Strategy2["absolute"] = "absolute";
|
|
@@ -300,7 +210,24 @@ const __default__$1 = {
|
|
|
300
210
|
};
|
|
301
211
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
302
212
|
...__default__$1,
|
|
303
|
-
props:
|
|
213
|
+
props: mergeDefaults({
|
|
214
|
+
name: {},
|
|
215
|
+
color: {},
|
|
216
|
+
width: {},
|
|
217
|
+
height: {},
|
|
218
|
+
provider: {},
|
|
219
|
+
prefix: {},
|
|
220
|
+
src: {},
|
|
221
|
+
horizontalFlip: { type: Boolean },
|
|
222
|
+
verticalFlip: { type: Boolean },
|
|
223
|
+
flip: {},
|
|
224
|
+
mode: {},
|
|
225
|
+
inline: { type: Boolean },
|
|
226
|
+
rotate: {},
|
|
227
|
+
onLoad: { type: Function },
|
|
228
|
+
svg: {},
|
|
229
|
+
modifiers: {}
|
|
230
|
+
}, VvIconPropsDefaults),
|
|
304
231
|
setup(__props) {
|
|
305
232
|
const props = __props;
|
|
306
233
|
const hasRotate = computed(() => {
|
|
@@ -408,6 +335,7 @@ const LinkProps = {
|
|
|
408
335
|
*/
|
|
409
336
|
target: {
|
|
410
337
|
type: String,
|
|
338
|
+
default: void 0,
|
|
411
339
|
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
412
340
|
},
|
|
413
341
|
/**
|
|
@@ -422,27 +350,33 @@ const ValidProps = {
|
|
|
422
350
|
/**
|
|
423
351
|
* Valid status
|
|
424
352
|
*/
|
|
425
|
-
valid: Boolean,
|
|
353
|
+
valid: { type: Boolean, default: false },
|
|
426
354
|
/**
|
|
427
355
|
* Valid label
|
|
428
356
|
*/
|
|
429
|
-
validLabel: [String, Array]
|
|
357
|
+
validLabel: { type: [String, Array], default: void 0 }
|
|
430
358
|
};
|
|
431
359
|
const InvalidProps = {
|
|
432
360
|
/**
|
|
433
361
|
* Invalid status
|
|
434
362
|
*/
|
|
435
|
-
invalid:
|
|
363
|
+
invalid: {
|
|
364
|
+
type: Boolean,
|
|
365
|
+
default: false
|
|
366
|
+
},
|
|
436
367
|
/**
|
|
437
368
|
* Invalid label
|
|
438
369
|
*/
|
|
439
|
-
invalidLabel: [String, Array]
|
|
370
|
+
invalidLabel: { type: [String, Array], default: void 0 }
|
|
440
371
|
};
|
|
441
372
|
const LoadingProps = {
|
|
442
373
|
/**
|
|
443
374
|
* Loading status
|
|
444
375
|
*/
|
|
445
|
-
loading:
|
|
376
|
+
loading: {
|
|
377
|
+
type: Boolean,
|
|
378
|
+
default: false
|
|
379
|
+
},
|
|
446
380
|
/**
|
|
447
381
|
* Loading label
|
|
448
382
|
*/
|
|
@@ -455,43 +389,64 @@ const DisabledProps = {
|
|
|
455
389
|
/**
|
|
456
390
|
* Whether the form control is disabled
|
|
457
391
|
*/
|
|
458
|
-
disabled:
|
|
392
|
+
disabled: {
|
|
393
|
+
type: Boolean,
|
|
394
|
+
default: false
|
|
395
|
+
}
|
|
459
396
|
};
|
|
460
397
|
const ActiveProps = {
|
|
461
398
|
/**
|
|
462
399
|
* Whether the item is active
|
|
463
400
|
*/
|
|
464
|
-
active:
|
|
401
|
+
active: {
|
|
402
|
+
type: Boolean,
|
|
403
|
+
default: false
|
|
404
|
+
}
|
|
465
405
|
};
|
|
466
406
|
const CurrentProps = {
|
|
467
407
|
/**
|
|
468
408
|
* Whether the item is current
|
|
469
409
|
*/
|
|
470
|
-
current:
|
|
410
|
+
current: {
|
|
411
|
+
type: Boolean,
|
|
412
|
+
default: false
|
|
413
|
+
}
|
|
471
414
|
};
|
|
472
415
|
const PressedProps = {
|
|
473
416
|
/**
|
|
474
417
|
* Whether the item is pressed
|
|
475
418
|
*/
|
|
476
|
-
pressed:
|
|
419
|
+
pressed: {
|
|
420
|
+
type: Boolean,
|
|
421
|
+
default: false
|
|
422
|
+
}
|
|
477
423
|
};
|
|
478
424
|
const LabelProps = {
|
|
479
425
|
/**
|
|
480
426
|
* The item label
|
|
481
427
|
*/
|
|
482
|
-
label:
|
|
428
|
+
label: {
|
|
429
|
+
type: [String, Number],
|
|
430
|
+
default: void 0
|
|
431
|
+
}
|
|
483
432
|
};
|
|
484
433
|
const ReadonlyProps = {
|
|
485
434
|
/**
|
|
486
435
|
* The value is not editable
|
|
487
436
|
*/
|
|
488
|
-
readonly:
|
|
437
|
+
readonly: {
|
|
438
|
+
type: Boolean,
|
|
439
|
+
default: false
|
|
440
|
+
}
|
|
489
441
|
};
|
|
490
442
|
const ModifiersProps = {
|
|
491
443
|
/**
|
|
492
444
|
* Component BEM modifiers
|
|
493
445
|
*/
|
|
494
|
-
modifiers:
|
|
446
|
+
modifiers: {
|
|
447
|
+
type: [String, Array],
|
|
448
|
+
default: void 0
|
|
449
|
+
}
|
|
495
450
|
};
|
|
496
451
|
const HintProps = {
|
|
497
452
|
hintLabel: { type: String, default: "" }
|
|
@@ -510,14 +465,20 @@ const DebounceProps = {
|
|
|
510
465
|
/**
|
|
511
466
|
* Milliseconds to wait before emitting the input event
|
|
512
467
|
*/
|
|
513
|
-
debounce:
|
|
468
|
+
debounce: {
|
|
469
|
+
type: [Number, String],
|
|
470
|
+
default: void 0
|
|
471
|
+
}
|
|
514
472
|
};
|
|
515
473
|
const IconProps = {
|
|
516
474
|
/**
|
|
517
475
|
* VvIcon name or props
|
|
518
476
|
* @see VVIcon
|
|
519
477
|
*/
|
|
520
|
-
icon: {
|
|
478
|
+
icon: {
|
|
479
|
+
type: [String, Object],
|
|
480
|
+
default: void 0
|
|
481
|
+
},
|
|
521
482
|
/**
|
|
522
483
|
* VvIcon position
|
|
523
484
|
*/
|
|
@@ -538,7 +499,10 @@ const FloatingLabelProps = {
|
|
|
538
499
|
/**
|
|
539
500
|
* If true the label will be floating
|
|
540
501
|
*/
|
|
541
|
-
floating:
|
|
502
|
+
floating: {
|
|
503
|
+
type: Boolean,
|
|
504
|
+
default: false
|
|
505
|
+
}
|
|
542
506
|
};
|
|
543
507
|
const IdProps = {
|
|
544
508
|
/**
|
|
@@ -568,7 +532,8 @@ const IdProps = {
|
|
|
568
532
|
* Dropdown show / hide transition name
|
|
569
533
|
*/
|
|
570
534
|
transitionName: {
|
|
571
|
-
type: String
|
|
535
|
+
type: String,
|
|
536
|
+
default: void 0
|
|
572
537
|
},
|
|
573
538
|
/**
|
|
574
539
|
* Offset of the dropdown from the trigger
|
|
@@ -636,7 +601,8 @@ const IdProps = {
|
|
|
636
601
|
* Set dropdown width to the same as the trigger
|
|
637
602
|
*/
|
|
638
603
|
triggerWidth: {
|
|
639
|
-
type: Boolean
|
|
604
|
+
type: Boolean,
|
|
605
|
+
default: false
|
|
640
606
|
}
|
|
641
607
|
});
|
|
642
608
|
const IdNameProps = {
|
|
@@ -653,7 +619,10 @@ const AutofocusProps = {
|
|
|
653
619
|
* Global attribute autofocus
|
|
654
620
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
655
621
|
*/
|
|
656
|
-
autofocus:
|
|
622
|
+
autofocus: {
|
|
623
|
+
type: Boolean,
|
|
624
|
+
default: false
|
|
625
|
+
}
|
|
657
626
|
};
|
|
658
627
|
const AutocompleteProps = {
|
|
659
628
|
/**
|
|
@@ -685,28 +654,34 @@ const InputTextareaProps = {
|
|
|
685
654
|
* Available for input types: text, search, url, tel, email, password
|
|
686
655
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
687
656
|
*/
|
|
688
|
-
minlength: [String, Number],
|
|
657
|
+
minlength: { type: [String, Number], default: void 0 },
|
|
689
658
|
/**
|
|
690
659
|
* Input / Textarea maxlength
|
|
691
660
|
* Maximum length (number of characters) of value
|
|
692
661
|
* Available for input types: text, search, url, tel, email, password
|
|
693
662
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
694
663
|
*/
|
|
695
|
-
maxlength: [String, Number],
|
|
664
|
+
maxlength: { type: [String, Number], default: void 0 },
|
|
696
665
|
/**
|
|
697
666
|
* Input / Textarea placeholder
|
|
698
667
|
* Text that appears in the form control when it has no value set
|
|
699
668
|
* Available for input types: text, search, url, tel, email, password, number
|
|
700
669
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
|
|
701
670
|
*/
|
|
702
|
-
placeholder:
|
|
671
|
+
placeholder: {
|
|
672
|
+
type: String,
|
|
673
|
+
default: void 0
|
|
674
|
+
},
|
|
703
675
|
/**
|
|
704
676
|
* Input / Textarea required
|
|
705
677
|
* A value is required or must be check for the form to be submittable
|
|
706
678
|
* Available for all input types except color
|
|
707
679
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
|
|
708
680
|
*/
|
|
709
|
-
required:
|
|
681
|
+
required: {
|
|
682
|
+
type: Boolean,
|
|
683
|
+
default: false
|
|
684
|
+
}
|
|
710
685
|
};
|
|
711
686
|
({
|
|
712
687
|
...DisabledProps,
|
|
@@ -855,30 +830,30 @@ function useDebouncedInput(modelValue, emit, ms = 0, {
|
|
|
855
830
|
});
|
|
856
831
|
}
|
|
857
832
|
function useComponentIcon(icon, iconPosition) {
|
|
833
|
+
const hasIcon = computed(() => {
|
|
834
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
835
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
836
|
+
}
|
|
837
|
+
return icon == null ? void 0 : icon.value;
|
|
838
|
+
});
|
|
858
839
|
const hasIconBefore = computed(
|
|
859
|
-
() =>
|
|
840
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
860
841
|
);
|
|
861
842
|
const hasIconAfter = computed(
|
|
862
|
-
() =>
|
|
843
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
863
844
|
);
|
|
864
845
|
const hasIconLeft = computed(
|
|
865
|
-
() =>
|
|
846
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
866
847
|
);
|
|
867
848
|
const hasIconRight = computed(
|
|
868
|
-
() =>
|
|
849
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
869
850
|
);
|
|
870
851
|
const hasIconTop = computed(
|
|
871
|
-
() =>
|
|
852
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
872
853
|
);
|
|
873
854
|
const hasIconBottom = computed(
|
|
874
|
-
() =>
|
|
855
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
875
856
|
);
|
|
876
|
-
const hasIcon = computed(() => {
|
|
877
|
-
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
878
|
-
return { name: icon == null ? void 0 : icon.value };
|
|
879
|
-
}
|
|
880
|
-
return icon == null ? void 0 : icon.value;
|
|
881
|
-
});
|
|
882
857
|
return {
|
|
883
858
|
hasIcon,
|
|
884
859
|
hasIconLeft,
|
|
@@ -985,10 +960,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
985
960
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
986
961
|
);
|
|
987
962
|
const localModelValue = useDebouncedInput(modelValue, emit, debounce == null ? void 0 : debounce.value);
|
|
988
|
-
const {
|
|
989
|
-
icon,
|
|
990
|
-
iconPosition
|
|
991
|
-
);
|
|
963
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
|
|
992
964
|
const { focused } = useComponentFocus(textarea, emit);
|
|
993
965
|
const isVisible = useElementVisibility(textarea);
|
|
994
966
|
watch(isVisible, (newValue) => {
|
|
@@ -1030,8 +1002,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1030
1002
|
loading: loading.value,
|
|
1031
1003
|
disabled: props.disabled,
|
|
1032
1004
|
readonly: props.readonly,
|
|
1033
|
-
"icon-before": hasIconBefore.value,
|
|
1034
|
-
"icon-after": hasIconAfter.value,
|
|
1005
|
+
"icon-before": hasIconBefore.value !== void 0,
|
|
1006
|
+
"icon-after": hasIconAfter.value !== void 0,
|
|
1035
1007
|
floating: props.floating && !isEmpty(props.label),
|
|
1036
1008
|
dirty: isDirty.value,
|
|
1037
1009
|
focus: focused.value,
|
|
@@ -1089,10 +1061,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1089
1061
|
createElementVNode("div", _hoisted_4, [
|
|
1090
1062
|
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
1091
1063
|
_sfc_main$1,
|
|
1092
|
-
mergeProps({
|
|
1093
|
-
key: 0,
|
|
1094
|
-
class: "vv-textarea__icon"
|
|
1095
|
-
}, unref(hasIcon)),
|
|
1064
|
+
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-textarea__icon" }),
|
|
1096
1065
|
null,
|
|
1097
1066
|
16
|
|
1098
1067
|
/* FULL_PROPS */
|
|
@@ -1109,10 +1078,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1109
1078
|
]),
|
|
1110
1079
|
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
1111
1080
|
_sfc_main$1,
|
|
1112
|
-
mergeProps({
|
|
1113
|
-
key: 1,
|
|
1114
|
-
class: "vv-textarea__icon vv-textarea__icon-after"
|
|
1115
|
-
}, unref(hasIcon)),
|
|
1081
|
+
mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-textarea__icon vv-textarea__icon-after" }),
|
|
1116
1082
|
null,
|
|
1117
1083
|
16
|
|
1118
1084
|
/* FULL_PROPS */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.uid,e.core)}(this,(function(e,t,l,o){"use strict";function a(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 n(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const i={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 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},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const p=e.defineComponent({name:"VvIcon",props:i,setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=c(),{modifiers:r}=e.toRefs(o),u=f("vv-icon",r),d=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconExists(l))return l;const a=null==i?void 0:i.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 i&&o.src&&!t.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(l,o)=>e.unref(n)?(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:Boolean,validLabel:[String,Array]},h={invalid:Boolean,invalidLabel:[String,Array]},g={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},b={disabled:Boolean},y=(Boolean,Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},B={modifiers:[String,Array]},L={hintLabel:{type:String,default:""}},x={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},$={debounce:[Number,String]},k={icon:{type:[String,Object]},iconPosition:{type:String,default:u.before,validation:e=>Object.values(u).includes(e)}},w={tabindex:{type:[String,Number],default:0}},V={floating:Boolean},N={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const O={...{...N,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...w,...b,...S,...m,...h,...L,...g,...B,...x,...$,...k,...V,...y,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button,s.button;const P={...O,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 _=["for"],I={class:"vv-textarea__wrapper"},C={key:0,class:"vv-textarea__input-before"},E={class:"vv-textarea__inner"},z=["id"],A={key:1,class:"vv-textarea__input-after"},j={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:P,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:i}){const d=t,s=e.useSlots(),v=function(t,l,o){const a=c(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvTextarea",P,d),m=e.ref(),{id:h,icon:g,iconPosition:b,label:y,modelValue:S,count:B,valid:L,invalid:x,loading:$,modifiers:k,debounce:w,minlength:V,maxlength:N}=e.toRefs(d),O=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.uid()))))(h),R=e.computed((()=>`${O.value}-hint`)),q=e.computed((()=>d.floating&&a(d.placeholder)?" ":d.placeholder)),T=function(t,l,o=0,{getter:a=(e=>e),setter:n=(e=>e)}={}){let i;return"string"==typeof o&&(o=parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{l("update:modelValue",n(e))}),o)}})}(S,i,null==w?void 0:w.value),{hasIcon:F,hasIconBefore:D,hasIconAfter:H}=function(t,l){const o=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.before))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.after))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===r.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===r.right))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===r.top))),s=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===r.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:n,hasIconRight:i,hasIconTop:d,hasIconBottom:s,hasIconBefore:o,hasIconAfter:a}}(g,b),{focused:M}=function(t,l){const{focused:a}=o.useFocus(t);return e.watch(a,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:a}}(m,i),J=o.useElementVisibility(m);e.watch(J,(e=>{e&&d.autofocus&&(M.value=!0)}));const{formatted:K}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),n=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:n}}(T,{mode:null==B?void 0:B.value,upperLimit:Number(null==N?void 0:N.value),lowerLimit:Number(null==V?void 0:V.value)}),U=e.computed((()=>!d.disabled&&!d.readonly)),G=e.computed((()=>U.value?d.tabindex:-1)),Q=e.computed((()=>!a(S))),W=e.computed((()=>!0===d.invalid||!0!==d.valid&&void 0)),{HintSlot:X,hasHintLabelOrSlot:Y,hasInvalidLabelOrSlot:Z,hintSlotScope:ee}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>n(o.value.invalidLabel))),i=e.computed((()=>n(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||a.value)))),v=e.computed((()=>!d.value&&!s.value&&Boolean(o.value.valid&&(l.valid||i.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:a,validLabel:i,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:d,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,i,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==(i=(n=this.$slots).valid)?void 0:i.call(n))??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),te=f("vv-textarea",k,e.computed((()=>({valid:L.value,invalid:x.value,loading:$.value,disabled:d.disabled,readonly:d.readonly,"icon-before":D.value,"icon-after":H.value,floating:d.floating&&!a(d.label),dirty:Q.value,focus:M.value,resizable:d.resizable})))),le=e.computed((()=>({name:d.name,placeholder:q.value,tabindex:G.value,disabled:d.disabled,readonly:d.readonly,required:d.required,autocomplete:d.autocomplete,minlength:d.minlength,maxlength:d.maxlength,cols:d.cols,rows:d.rows,wrap:d.wrap,spellcheck:d.spellcheck,"aria-invalid":W.value,"aria-describedby":Y.value?R.value:void 0,"aria-errormessage":Z.value?R.value:void 0}))),oe=e.computed((()=>({valid:d.valid,invalid:d.invalid,modelValue:d.modelValue,hintLabel:d.hintLabel,maxlength:d.maxlength,minlength:d.minlength,clear:ae}))),ae=()=>{T.value=void 0};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(te))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(O),class:"vv-textarea__label"},e.toDisplayString(e.unref(y)),9,_)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",I,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",C,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(oe))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,[e.unref(D)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0,class:"vv-textarea__icon"},e.unref(F)),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(le),{onKeyup:l[1]||(l[1]=e=>i("keyup",e))}),null,16,z),[[e.vModelText,e.unref(T)]]),e.unref(H)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:1,class:"vv-textarea__icon vv-textarea__icon-after"},e.unref(F)),null,16)):e.createCommentVNode("v-if",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(oe))))])):e.createCommentVNode("v-if",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",j,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(oe))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(K)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(X),{id:e.unref(R),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(ee))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(ee))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(ee))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(ee))))])),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("uid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.uid,e.core)}(this,(function(e,t,l,o){"use strict";function a(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function i(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}var n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),d=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(d||{});const s=Symbol.for("volver");function v(){return e.inject(s)}function c(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 f=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:{}},{prefix:"normal"}),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),i=e.ref(!0),n=v(),{modifiers:r}=e.toRefs(o),u=c("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 f(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&&(f(e),i.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&f(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)}}),p={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},m={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},h={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},g={disabled:{type:Boolean,default:!1}},b=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),y={readonly:{type:Boolean,default:!1}},S={modifiers:{type:[String,Array],default:void 0}},L={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},x={debounce:{type:[Number,String],default:void 0}},$={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},k={tabindex:{type:[String,Number],default:0}},w={floating:{type:Boolean,default:!1}},V={id:[String,Number]};n.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const O={...{...V,name:{type:String,required:!0}},...{autofocus:{type:Boolean,default:!1}},...{autocomplete:{type:String,default:"off"}},...k,...g,...y,...p,...m,...L,...h,...S,...B,...x,...$,...w,...b,minlength:{type:[String,Number],default:void 0},maxlength:{type:[String,Number],default:void 0},placeholder:{type:String,default:void 0},required:{type:Boolean,default:!1}};u.button,d.button;const N={...O,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 P=["for"],_={class:"vv-textarea__wrapper"},I={key:0,class:"vv-textarea__input-before"},C={class:"vv-textarea__inner"},E=["id"],z={key:1,class:"vv-textarea__input-after"},A={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:N,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:u}){const d=t,s=e.useSlots(),p=function(t,l,o){const a=v(),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,d),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:O}=e.toRefs(d),j=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.uid()))))(h),R=e.computed((()=>`${j.value}-hint`)),T=e.computed((()=>d.floating&&a(d.placeholder)?" ":d.placeholder)),q=function(t,l,o=0,{getter:a=(e=>e),setter:i=(e=>e)}={}){let n;return"string"==typeof o&&(o=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,u,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)===r.before?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===r.after?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===n.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===n.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===n.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===n.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:v,hasIconBefore:a,hasIconAfter:i}}(g,b),{focused:H}=function(t,l){const{focused:a}=o.useFocus(t);return e.watch(a,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:a}}(m,u),M=o.useElementVisibility(m);e.watch(M,(e=>{e&&d.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}}(q,{mode:null==L?void 0:L.value,upperLimit:Number(null==O?void 0:O.value),lowerLimit:Number(null==V?void 0:V.value)}),K=e.computed((()=>!d.disabled&&!d.readonly)),U=e.computed((()=>K.value?d.tabindex:-1)),G=e.computed((()=>!a(S))),Q=e.computed((()=>!0===d.invalid||!0!==d.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((()=>i(o.value.invalidLabel))),n=e.computed((()=>i(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||a.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:a,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}}(p,s),ee=c("vv-textarea",k,e.computed((()=>({valid:B.value,invalid:x.value,loading:$.value,disabled:d.disabled,readonly:d.readonly,"icon-before":void 0!==F.value,"icon-after":void 0!==D.value,floating:d.floating&&!a(d.label),dirty:G.value,focus:H.value,resizable:d.resizable})))),te=e.computed((()=>({name:d.name,placeholder:T.value,tabindex:U.value,disabled:d.disabled,readonly:d.readonly,required:d.required,autocomplete:d.autocomplete,minlength:d.minlength,maxlength:d.maxlength,cols:d.cols,rows:d.rows,wrap:d.wrap,spellcheck:d.spellcheck,"aria-invalid":Q.value,"aria-describedby":X.value?R.value:void 0,"aria-errormessage":Y.value?R.value:void 0}))),le=e.computed((()=>({valid:d.valid,invalid:d.invalid,modelValue:d.modelValue,hintLabel:d.hintLabel,maxlength:d.maxlength,minlength:d.minlength,clear:oe}))),oe=()=>{q.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(j),class:"vv-textarea__label"},e.toDisplayString(e.unref(y)),9,P)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",_,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",C,[e.unref(F)?(e.openBlock(),e.createBlock(f,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(j),ref_key:"textarea",ref:m,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(q)?q.value=t:null)},e.unref(te),{onKeyup:l[1]||(l[1]=e=>u("keyup",e))}),null,16,E),[[e.vModelText,e.unref(q)]]),e.unref(D)?(e.openBlock(),e.createBlock(f,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",z,[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",A,[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(R),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))}})}));
|