@volverjs/ui-vue 0.0.10-beta.68 → 0.0.10-beta.69

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 (79) hide show
  1. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +5 -4
  2. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +4 -2
  3. package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
  4. package/dist/components/VvAlert/VvAlert.es.js +6 -7
  5. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  6. package/dist/components/VvAlert/VvAlert.vue.d.ts +14 -8
  7. package/dist/components/VvAlert/index.d.ts +1 -1
  8. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +6 -7
  9. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  10. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +5 -3
  11. package/dist/components/VvAlertGroup/index.d.ts +1 -1
  12. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +1 -1
  13. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +1 -1
  14. package/dist/components/VvBadge/VvBadge.vue.d.ts +1 -1
  15. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +2 -2
  16. package/dist/components/VvButton/VvButton.es.js +6 -7
  17. package/dist/components/VvButton/VvButton.umd.js +1 -1
  18. package/dist/components/VvButton/VvButton.vue.d.ts +9 -5
  19. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -2
  20. package/dist/components/VvCard/VvCard.vue.d.ts +7 -4
  21. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  22. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +14 -10
  23. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  24. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +13 -9
  25. package/dist/components/VvCombobox/VvCombobox.es.js +301 -182
  26. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  27. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +41 -23
  28. package/dist/components/VvCombobox/index.d.ts +36 -4
  29. package/dist/components/VvDialog/VvDialog.vue.d.ts +5 -3
  30. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +11 -8
  31. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -116
  32. package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +1 -1
  33. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +4 -3
  34. package/dist/components/VvIcon/VvIcon.es.js +5 -6
  35. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  36. package/dist/components/VvIcon/index.d.ts +2 -2
  37. package/dist/components/VvInputFile/VvInputFile.es.js +50 -13
  38. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  39. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +13 -9
  40. package/dist/components/VvInputFile/index.d.ts +4 -4
  41. package/dist/components/VvInputText/VvInputText.es.js +39 -18
  42. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  43. package/dist/components/VvInputText/VvInputText.vue.d.ts +37 -20
  44. package/dist/components/VvInputText/index.d.ts +12 -4
  45. package/dist/components/VvNav/VvNav.vue.d.ts +4 -3
  46. package/dist/components/VvNav/VvNavItem.vue.d.ts +1 -1
  47. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  48. package/dist/components/VvRadio/VvRadio.vue.d.ts +14 -10
  49. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  50. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +13 -9
  51. package/dist/components/VvSelect/VvSelect.es.js +143 -51
  52. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  53. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -14
  54. package/dist/components/VvSelect/index.d.ts +34 -2
  55. package/dist/components/VvTab/VvTab.vue.d.ts +3 -2
  56. package/dist/components/VvTextarea/VvTextarea.es.js +7 -8
  57. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  58. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +23 -16
  59. package/dist/components/VvTextarea/index.d.ts +1 -1
  60. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +1 -1
  61. package/dist/components/{VvInputText → common}/VvInputClearAction.d.ts +10 -0
  62. package/dist/components/{VvInputText → common}/VvInputPasswordAction.d.ts +9 -0
  63. package/dist/components/{VvInputText → common}/VvInputStepAction.d.ts +9 -0
  64. package/dist/components/index.es.js +201 -79
  65. package/dist/components/index.umd.js +1 -1
  66. package/dist/composables/alert/useAlert.d.ts +4 -4
  67. package/dist/composables/dropdown/useDropdownContextmenu.d.ts +1 -1
  68. package/dist/composables/dropdown/useDropdownVirtualElement.d.ts +1 -1
  69. package/dist/icons.es.js +3 -3
  70. package/dist/icons.umd.js +1 -1
  71. package/dist/props/index.d.ts +3 -3
  72. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +44 -22
  73. package/dist/stories/Alert/Alert.settings.d.ts +1 -1
  74. package/dist/stories/Button/Button.settings.d.ts +1 -1
  75. package/dist/stories/Combobox/Combobox.settings.d.ts +1 -1
  76. package/dist/stories/Nav/Nav.settings.d.ts +1 -1
  77. package/dist/stories/Tab/Tab.settings.d.ts +1 -1
  78. package/dist/utils/FileUtilities.d.ts +14 -0
  79. package/package.json +31 -31
@@ -1,5 +1,5 @@
1
1
  import { computed, isRef, defineComponent, h, inject, unref, mergeDefaults, ref, toRefs, createBlock, createCommentVNode, openBlock, mergeProps, watch, useId, useSlots, createElementBlock, normalizeClass, createElementVNode, createVNode, toDisplayString, renderSlot, normalizeProps, guardReactiveProps, withDirectives, Fragment, renderList, vModelSelect, createSlots, withCtx } from "vue";
2
- import { iconExists, Icon, addIcon } from "@iconify/vue";
2
+ import { iconLoaded, Icon, addIcon } from "@iconify/vue";
3
3
  import { useFocus, useElementVisibility } from "@vueuse/core";
4
4
  import { get } from "ts-dot-prop";
5
5
  var StorageType = /* @__PURE__ */ ((StorageType2) => {
@@ -135,7 +135,7 @@ const OptionsProps = {
135
135
  const IconProps = {
136
136
  /**
137
137
  * VvIcon name or props
138
- * @see VVIcon
138
+ * @see VvIcon
139
139
  */
140
140
  icon: {
141
141
  type: [String, Object],
@@ -232,6 +232,13 @@ const AutocompleteProps = {
232
232
  default: StorageType.local
233
233
  }
234
234
  });
235
+ const ACTION_ICONS = {
236
+ clear: "close"
237
+ };
238
+ const VvIconPropsDefaults = {
239
+ prefix: "normal"
240
+ /* normal */
241
+ };
235
242
  const VvSelectProps = {
236
243
  ...IdNameProps,
237
244
  ...AutofocusProps,
@@ -285,7 +292,22 @@ const VvSelectProps = {
285
292
  /**
286
293
  * Select placeholder
287
294
  */
288
- placeholder: String
295
+ placeholder: String,
296
+ /**
297
+ * VvIcon name for clear button
298
+ * @see VvIcon
299
+ */
300
+ iconClear: {
301
+ type: [String, Object],
302
+ default: ACTION_ICONS.clear
303
+ },
304
+ /**
305
+ * Label for clear button
306
+ */
307
+ labelClear: {
308
+ type: String,
309
+ default: "Clear"
310
+ }
289
311
  };
290
312
  function useVvSelectProps() {
291
313
  return {
@@ -418,10 +440,6 @@ function HintSlotFactory(propsOrRef, slots) {
418
440
  HintSlot
419
441
  };
420
442
  }
421
- const VvIconPropsDefaults = {
422
- prefix: "normal"
423
- /* normal */
424
- };
425
443
  function useVolver() {
426
444
  return inject(INJECTION_KEY_VOLVER, void 0);
427
445
  }
@@ -489,13 +507,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
489
507
  const icon = computed(() => {
490
508
  const name = props.name ?? "";
491
509
  const iconName = `@${provider.value}:${props.prefix}:${name}`;
492
- if (iconExists(iconName)) {
510
+ if (iconLoaded(iconName)) {
493
511
  return iconName;
494
512
  }
495
513
  const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
496
514
  (iconsCollection2) => {
497
515
  const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
498
- return iconExists(icon2);
516
+ return iconLoaded(icon2);
499
517
  }
500
518
  );
501
519
  if (iconsCollection) {
@@ -527,7 +545,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
527
545
  }
528
546
  }
529
547
  if (volver) {
530
- if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
548
+ if (props.src && !iconLoaded(`@${provider.value}:${props.prefix}:${props.name}`)) {
531
549
  show.value = false;
532
550
  volver.fetchIcon(props.src).then((svg) => {
533
551
  if (svg) {
@@ -555,12 +573,100 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
555
573
  flip: _ctx.flip,
556
574
  rotate: unref(hasRotate),
557
575
  color: _ctx.color,
558
- onLoad: _ctx.onLoad,
559
576
  icon: unref(icon)
560
- }), null, 16, ["class"])) : createCommentVNode("v-if", true);
577
+ }, { onLoad: _ctx.onLoad }), null, 16, ["class", "onLoad"])) : createCommentVNode("v-if", true);
561
578
  };
562
579
  }
563
580
  });
581
+ function useComponentIcon(icon, iconPosition) {
582
+ const hasIcon = computed(() => {
583
+ if (typeof (icon == null ? void 0 : icon.value) === "string") {
584
+ return { name: icon == null ? void 0 : icon.value };
585
+ }
586
+ return icon == null ? void 0 : icon.value;
587
+ });
588
+ const hasIconBefore = computed(
589
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
590
+ );
591
+ const hasIconAfter = computed(
592
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
593
+ );
594
+ const hasIconLeft = computed(
595
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
596
+ );
597
+ const hasIconRight = computed(
598
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
599
+ );
600
+ const hasIconTop = computed(
601
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
602
+ );
603
+ const hasIconBottom = computed(
604
+ () => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
605
+ );
606
+ return {
607
+ hasIcon,
608
+ hasIconLeft,
609
+ hasIconRight,
610
+ hasIconTop,
611
+ hasIconBottom,
612
+ hasIconBefore,
613
+ hasIconAfter
614
+ };
615
+ }
616
+ const VvInputClearAction = defineComponent({
617
+ components: {
618
+ VvIcon: _sfc_main$1
619
+ },
620
+ props: {
621
+ inputType: {
622
+ type: String,
623
+ default: "input-text"
624
+ },
625
+ disabled: {
626
+ type: Boolean,
627
+ default: false
628
+ },
629
+ label: {
630
+ type: String,
631
+ default: "Clear"
632
+ },
633
+ icon: {
634
+ type: [String, Object],
635
+ default: "close"
636
+ }
637
+ },
638
+ emits: ["clear"],
639
+ setup(props, { emit }) {
640
+ const { hasIcon } = useComponentIcon(computed(() => props.icon));
641
+ function onClick(e) {
642
+ e == null ? void 0 : e.stopPropagation();
643
+ if (!props.disabled) {
644
+ emit("clear");
645
+ }
646
+ }
647
+ return {
648
+ hasIcon,
649
+ onClick
650
+ };
651
+ },
652
+ render() {
653
+ const icon = this.hasIcon ? h(_sfc_main$1, {
654
+ ...this.hasIcon,
655
+ class: `vv-${this.inputType}__icon`
656
+ }) : void 0;
657
+ return h(
658
+ "button",
659
+ {
660
+ disabled: this.disabled,
661
+ class: `vv-${this.inputType}__action`,
662
+ ariaLabel: this.label,
663
+ type: "button",
664
+ onClick: this.onClick
665
+ },
666
+ icon
667
+ );
668
+ }
669
+ });
564
670
  function useDefaults(componentName, propsDefinition, props) {
565
671
  const volver = useVolver();
566
672
  const volverComponentDefaults = computed(() => {
@@ -626,41 +732,6 @@ function useComponentFocus(inputTemplateRef, emit) {
626
732
  function useUniqueId(id) {
627
733
  return computed(() => String((id == null ? void 0 : id.value) || useId()));
628
734
  }
629
- function useComponentIcon(icon, iconPosition) {
630
- const hasIcon = computed(() => {
631
- if (typeof (icon == null ? void 0 : icon.value) === "string") {
632
- return { name: icon == null ? void 0 : icon.value };
633
- }
634
- return icon == null ? void 0 : icon.value;
635
- });
636
- const hasIconBefore = computed(
637
- () => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
638
- );
639
- const hasIconAfter = computed(
640
- () => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
641
- );
642
- const hasIconLeft = computed(
643
- () => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
644
- );
645
- const hasIconRight = computed(
646
- () => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
647
- );
648
- const hasIconTop = computed(
649
- () => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
650
- );
651
- const hasIconBottom = computed(
652
- () => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
653
- );
654
- return {
655
- hasIcon,
656
- hasIconLeft,
657
- hasIconRight,
658
- hasIconTop,
659
- hasIconBottom,
660
- hasIconBefore,
661
- hasIconAfter
662
- };
663
- }
664
735
  function useOptions(props) {
665
736
  const { options, labelKey, valueKey, disabledKey } = toRefs(props);
666
737
  const getOptionLabel = (option) => {
@@ -731,7 +802,7 @@ const __default__ = {
731
802
  const _sfc_main = /* @__PURE__ */ defineComponent({
732
803
  ...__default__,
733
804
  props: useVvSelectProps(),
734
- emits: ["update:modelValue", "focus", "blur"],
805
+ emits: ["update:modelValue", "focus", "blur", "clear"],
735
806
  setup(__props, { emit: __emit }) {
736
807
  const props = __props;
737
808
  const emit = __emit;
@@ -797,6 +868,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
797
868
  }
798
869
  return localModelValue.value !== void 0 && localModelValue.value !== null;
799
870
  });
871
+ const isUnselectable = computed(() => {
872
+ if (isDisabledOrReadonly.value) {
873
+ return false;
874
+ }
875
+ return props.unselectable;
876
+ });
800
877
  const isVisible = useElementVisibility(selectEl);
801
878
  watch(isVisible, (newValue) => {
802
879
  if (newValue && props.autofocus) {
@@ -846,6 +923,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
846
923
  },
847
924
  { immediate: true }
848
925
  );
926
+ function onClear() {
927
+ if (Array.isArray(localModelValue.value)) {
928
+ localModelValue.value = [];
929
+ } else {
930
+ localModelValue.value = void 0;
931
+ }
932
+ emit("clear");
933
+ }
849
934
  const hasAttrs = computed(() => {
850
935
  return {
851
936
  "name": props.name,
@@ -898,8 +983,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
898
983
  _ctx.placeholder ? (openBlock(), createElementBlock("option", {
899
984
  key: 0,
900
985
  value: void 0,
901
- disabled: !_ctx.unselectable,
902
- hidden: !_ctx.unselectable
986
+ disabled: !unref(isUnselectable),
987
+ hidden: !unref(isUnselectable)
903
988
  }, toDisplayString(_ctx.placeholder), 9, _hoisted_6)) : createCommentVNode("v-if", true),
904
989
  (openBlock(true), createElementBlock(
905
990
  Fragment,
@@ -943,9 +1028,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
943
1028
  ], 16, _hoisted_5), [
944
1029
  [vModelSelect, unref(localModelValue)]
945
1030
  ]),
1031
+ unref(isUnselectable) ? (openBlock(), createBlock(unref(VvInputClearAction), {
1032
+ key: 1,
1033
+ "input-type": "select",
1034
+ label: _ctx.labelClear,
1035
+ icon: _ctx.iconClear,
1036
+ onClear
1037
+ }, null, 8, ["label", "icon"])) : createCommentVNode("v-if", true),
946
1038
  unref(hasIconAfter) ? (openBlock(), createBlock(
947
1039
  _sfc_main$1,
948
- mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
1040
+ mergeProps({ key: 2 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
949
1041
  null,
950
1042
  16
951
1043
  /* FULL_PROPS */
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvSelect=t(e.vue,e.vue$1,e.core,e.tsDotProp)}(this,(function(e,t,l,o){"use strict";var a=(e=>(e.local="local",e.session="session",e))(a||{}),i=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(i||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{});const d=Symbol.for("volver"),s={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},v={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},c={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},p={disabled:{type:Boolean,default:!1}},f={label:{type:[String,Number],default:void 0}},m={readonly:{type:Boolean,default:!1}},b={modifiers:{type:[String,Array],default:void 0}},g={hintLabel:{type:String,default:""}},h={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},y={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:n.before,validation:e=>Object.values(n).includes(e)}},S={tabindex:{type:[String,Number],default:0}},B={floating:{type:Boolean,default:!1}},k={unselectable:{type:Boolean,default:!0}},L={id:[String,Number]};i.bottom;const $={...L,name:{type:String,required:!0}},V={autofocus:{type:Boolean,default:!1}},O={autocomplete:{type:String,default:"off"}};r.button,u.button,a.local;const w={...$,...V,...O,...S,...s,...v,...g,...c,...p,...m,...b,...h,...y,...B,...k,...f,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},autoselectFirst:{type:Boolean,default:!1},placeholder:String};function x(){return{...w,options:{...w.options,type:Array,default:()=>[]}}}function E(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}const P={prefix:"normal"};function I(){return e.inject(d,void 0)}function N(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 A=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:{}},P),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),i=e.ref(!0),n=I(),{modifiers:r}=e.toRefs(o),u=N("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 F=["for"],_={class:"vv-select__wrapper"},C={key:0,class:"vv-select__input-before"},z={class:"vv-select__inner"},j=["id"],D=["disabled","hidden"],R=["disabled","value"],q=["disabled","label"],H=["disabled","value"],K={key:1,class:"vv-select__input-after"};return e.defineComponent({name:"VvSelect",props:x(),emits:["update:modelValue","focus","blur"],setup(t,{emit:a}){const r=t,u=a,d=e.useSlots(),s=function(t,l,o){const a=I(),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}),{})}))}("VvSelect",x(),r),v=e.ref(),{HintSlot:c,hasHintLabelOrSlot:p,hasInvalidLabelOrSlot:f,hintSlotScope:m}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>E(o.value.invalidLabel))),i=e.computed((()=>E(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)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible: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:p,HintSlot:f}}(s,d),{focused:b}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(v,u);function g(e){var t;return"string"!=typeof e&&(null==(t=e.options)?void 0:t.length)}const{id:h,modifiers:y,disabled:S,readonly:B,loading:k,icon:L,iconPosition:$,invalid:V,valid:O,floating:w,multiple:P}=e.toRefs(r),M=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(h),T=e.computed((()=>`${M.value}-hint`)),J=e.computed((()=>r.disabled||r.readonly)),G=e.computed((()=>J.value?-1:r.tabindex)),U=e.computed({get:()=>r.modelValue,set:e=>{Array.isArray(e)&&0===(e=e.filter((e=>void 0!==e))).length&&!r.unselectable&&v.value?v.value.value=String(r.modelValue):u("update:modelValue",e)}}),Q=e.computed((()=>Array.isArray(U.value)?U.value.length>0:void 0!==U.value&&null!==U.value)),W=l.useElementVisibility(v);e.watch(W,(e=>{e&&r.autofocus&&(b.value=!0)}));const{hasIconBefore:X,hasIconAfter:Y}=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)===n.before?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===n.after?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===i.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===i.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===i.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===i.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:v,hasIconBefore:a,hasIconAfter:r}}(L,$),Z=e.computed((()=>!0===r.invalid||!0!==r.valid&&void 0)),ee=N("vv-select",y,e.computed((()=>({valid:O.value,invalid:V.value,loading:k.value,disabled:S.value,readonly:B.value,"icon-before":void 0!==X.value,"icon-after":void 0!==Y.value,dirty:Q.value,focus:b.value&&!J.value,floating:w.value,multiple:P.value})))),{getOptionLabel:te,getOptionValue:le,isOptionDisabled:oe,getOptionGrouped:ae}=function(t){const{options:l,labelKey:a,valueKey:i,disabledKey:n}=e.toRefs(t);return{options:l,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof a.value?a.value(e):String(a.value?o.get(e,a.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof i.value?i.value(e):i.value?o.get(e,i.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof n.value?n.value(e):!!n.value&&o.get(e,n.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(r);e.watch((()=>r.options),(e=>{if((null==e?void 0:e.length)&&r.autoselectFirst&&!Q.value){const t=le(e[0]);U.value=r.multiple?[t]:t}}),{immediate:!0});const ie=e.computed((()=>({name:r.name,tabindex:G.value,disabled:J.value,required:r.required,size:r.size,autocomplete:r.autocomplete,multiple:r.multiple,"aria-invalid":Z.value,"aria-describedby":p.value?T.value:void 0,"aria-errormessage":f.value?T.value:void 0}))),ne=e.computed((()=>({valid:r.valid,invalid:r.invalid,modelValue:r.modelValue})));return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ee))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(M)},e.toDisplayString(t.label),9,F)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",_,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",C,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(ne))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[e.unref(X)?(e.openBlock(),e.createBlock(A,e.mergeProps({key:0},e.unref(X),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(M),ref_key:"selectEl",ref:v},e.unref(ie),{"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(U)?U.value=t:null)}),[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!t.unselectable,hidden:!t.unselectable},e.toDisplayString(t.placeholder),9,D)):e.createCommentVNode("v-if",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,((t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[g(t)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${l}`,disabled:e.unref(oe)(t),label:e.unref(te)(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ae)(t),((t,o)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${l}-item-${o}`,disabled:e.unref(oe)(t),value:e.unref(le)(t)},e.toDisplayString(e.unref(te)(t)),9,H)))),128))],8,q)):(e.openBlock(),e.createElementBlock("option",{key:l,disabled:e.unref(oe)(t),value:e.unref(le)(t)},e.toDisplayString(e.unref(te)(t)),9,R))],64)))),256))],16,j),[[e.vModelSelect,e.unref(U)]]),e.unref(Y)?(e.openBlock(),e.createBlock(A,e.mergeProps({key:1},e.unref(Y),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(ne))))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(c),{id:e.unref(T),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(m))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(m))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(m))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(m))))])),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"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvSelect=t(e.vue,e.vue$1,e.core,e.tsDotProp)}(this,(function(e,t,l,o){"use strict";var a=(e=>(e.local="local",e.session="session",e))(a||{}),n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{});const d=Symbol.for("volver"),s={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},c={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},v={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},p={disabled:{type:Boolean,default:!1}},f={label:{type:[String,Number],default:void 0}},m={readonly:{type:Boolean,default:!1}},b={modifiers:{type:[String,Array],default:void 0}},h={hintLabel:{type:String,default:""}},y={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},g={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:i.before,validation:e=>Object.values(i).includes(e)}},S={tabindex:{type:[String,Number],default:0}},k={floating:{type:Boolean,default:!1}},B={unselectable:{type:Boolean,default:!0}},L={id:[String,Number]};n.bottom;const $={...L,name:{type:String,required:!0}},V={autofocus:{type:Boolean,default:!1}},O={autocomplete:{type:String,default:"off"}};r.button,u.button,a.local;const C={prefix:"normal"},w={...$,...V,...O,...S,...s,...c,...h,...v,...p,...m,...b,...y,...g,...k,...B,...f,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},autoselectFirst:{type:Boolean,default:!1},placeholder:String,iconClear:{type:[String,Object],default:"close"},labelClear:{type:String,default:"Clear"}};function I(){return{...w,options:{...w.options,type:Array,default:()=>[]}}}function P(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}function x(){return e.inject(d,void 0)}function _(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 A=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:{}},C),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=x(),{modifiers:r}=e.toRefs(o),u=_("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.iconLoaded(l))return l;const a=null==i?void 0:i.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconLoaded(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function c(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.iconLoaded(`@${d.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(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,icon:e.unref(s)},{onLoad:l.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}});function E(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)===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)===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)),c=e.computed((()=>(null==l?void 0:l.value)===n.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:c,hasIconBefore:a,hasIconAfter:r}}const N=e.defineComponent({components:{VvIcon:A},props:{inputType:{type:String,default:"input-text"},disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:[String,Object],default:"close"}},emits:["clear"],setup(t,{emit:l}){const{hasIcon:o}=E(e.computed((()=>t.icon)));return{hasIcon:o,onClick:function(e){null==e||e.stopPropagation(),t.disabled||l("clear")}}},render(){const t=this.hasIcon?e.h(A,{...this.hasIcon,class:`vv-${this.inputType}__icon`}):void 0;return e.h("button",{disabled:this.disabled,class:`vv-${this.inputType}__action`,ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});const F=["for"],j={class:"vv-select__wrapper"},z={key:0,class:"vv-select__input-before"},D={class:"vv-select__inner"},R=["id"],q=["disabled","hidden"],H=["disabled","value"],T=["disabled","label"],K=["disabled","value"],M={key:1,class:"vv-select__input-after"};return e.defineComponent({name:"VvSelect",props:I(),emits:["update:modelValue","focus","blur","clear"],setup(t,{emit:a}){const n=t,i=a,r=e.useSlots(),u=function(t,l,o){const a=x(),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}),{})}))}("VvSelect",I(),n),d=e.ref(),{HintSlot:s,hasHintLabelOrSlot:c,hasInvalidLabelOrSlot:v,hintSlotScope:p}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>P(o.value.invalidLabel))),n=e.computed((()=>P(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.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||n.value)))),c=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),v=e.computed((()=>d.value||s.value||u.value||c.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,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:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:f}}(u,r),{focused:f}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(d,i);function m(e){var t;return"string"!=typeof e&&(null==(t=e.options)?void 0:t.length)}const{id:b,modifiers:h,disabled:y,readonly:g,loading:S,icon:k,iconPosition:B,invalid:L,valid:$,floating:V,multiple:O}=e.toRefs(n),C=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(b),w=e.computed((()=>`${C.value}-hint`)),J=e.computed((()=>n.disabled||n.readonly)),G=e.computed((()=>J.value?-1:n.tabindex)),U=e.computed({get:()=>n.modelValue,set:e=>{Array.isArray(e)&&0===(e=e.filter((e=>void 0!==e))).length&&!n.unselectable&&d.value?d.value.value=String(n.modelValue):i("update:modelValue",e)}}),Q=e.computed((()=>Array.isArray(U.value)?U.value.length>0:void 0!==U.value&&null!==U.value)),W=e.computed((()=>!J.value&&n.unselectable)),X=l.useElementVisibility(d);e.watch(X,(e=>{e&&n.autofocus&&(f.value=!0)}));const{hasIconBefore:Y,hasIconAfter:Z}=E(k,B),ee=e.computed((()=>!0===n.invalid||!0!==n.valid&&void 0)),te=_("vv-select",h,e.computed((()=>({valid:$.value,invalid:L.value,loading:S.value,disabled:y.value,readonly:g.value,"icon-before":void 0!==Y.value,"icon-after":void 0!==Z.value,dirty:Q.value,focus:f.value&&!J.value,floating:V.value,multiple:O.value})))),{getOptionLabel:le,getOptionValue:oe,isOptionDisabled:ae,getOptionGrouped:ne}=function(t){const{options:l,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof a.value?a.value(e):String(a.value?o.get(e,a.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof n.value?n.value(e):n.value?o.get(e,n.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof i.value?i.value(e):!!i.value&&o.get(e,i.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(n);function ie(){Array.isArray(U.value)?U.value=[]:U.value=void 0,i("clear")}e.watch((()=>n.options),(e=>{if((null==e?void 0:e.length)&&n.autoselectFirst&&!Q.value){const t=oe(e[0]);U.value=n.multiple?[t]:t}}),{immediate:!0});const re=e.computed((()=>({name:n.name,tabindex:G.value,disabled:J.value,required:n.required,size:n.size,autocomplete:n.autocomplete,multiple:n.multiple,"aria-invalid":ee.value,"aria-describedby":c.value?w.value:void 0,"aria-errormessage":v.value?w.value:void 0}))),ue=e.computed((()=>({valid:n.valid,invalid:n.invalid,modelValue:n.modelValue})));return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(te))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(C)},e.toDisplayString(t.label),9,F)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",j,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(ue))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",D,[e.unref(Y)?(e.openBlock(),e.createBlock(A,e.mergeProps({key:0},e.unref(Y),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(C),ref_key:"selectEl",ref:d},e.unref(re),{"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(U)?U.value=t:null)}),[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!e.unref(W),hidden:!e.unref(W)},e.toDisplayString(t.placeholder),9,q)):e.createCommentVNode("v-if",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,((t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[m(t)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${l}`,disabled:e.unref(ae)(t),label:e.unref(le)(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ne)(t),((t,o)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${l}-item-${o}`,disabled:e.unref(ae)(t),value:e.unref(oe)(t)},e.toDisplayString(e.unref(le)(t)),9,K)))),128))],8,T)):(e.openBlock(),e.createElementBlock("option",{key:l,disabled:e.unref(ae)(t),value:e.unref(oe)(t)},e.toDisplayString(e.unref(le)(t)),9,H))],64)))),256))],16,R),[[e.vModelSelect,e.unref(U)]]),e.unref(W)?(e.openBlock(),e.createBlock(e.unref(N),{key:1,"input-type":"select",label:t.labelClear,icon:t.iconClear,onClear:ie},null,8,["label","icon"])):e.createCommentVNode("v-if",!0),e.unref(Z)?(e.openBlock(),e.createBlock(A,e.mergeProps({key:2},e.unref(Z),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(ue))))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(s),{id:e.unref(w),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
@@ -25,6 +25,8 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
25
25
  valueKey: string | Function;
26
26
  disabledKey: string | Function;
27
27
  autoselectFirst: boolean;
28
+ iconClear: string | import("../VvIcon").VvIconProps;
29
+ labelClear: string;
28
30
  autocomplete: string;
29
31
  autofocus: boolean;
30
32
  }> & Omit<{
@@ -46,6 +48,8 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
46
48
  readonly valueKey: string | Function;
47
49
  readonly disabledKey: string | Function;
48
50
  readonly autoselectFirst: boolean;
51
+ readonly iconClear: string | import("../VvIcon").VvIconProps;
52
+ readonly labelClear: string;
49
53
  readonly autocomplete: string;
50
54
  readonly autofocus: boolean;
51
55
  readonly size?: string | number | undefined;
@@ -58,49 +62,55 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
58
62
  readonly invalidLabel?: string | unknown[] | undefined;
59
63
  readonly validLabel?: string | unknown[] | undefined;
60
64
  readonly placeholder?: string | undefined;
65
+ readonly onClear?: (() => any) | undefined;
61
66
  readonly "onUpdate:modelValue"?: ((args_0: any) => any) | undefined;
62
67
  readonly onBlur?: ((args_0: import("@vueuse/core").MaybeElement) => any) | undefined;
63
68
  readonly onFocus?: ((args_0: import("@vueuse/core").MaybeElement) => any) | undefined;
64
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "floating" | "label" | "disabled" | "modelValue" | "modifiers" | "icon" | "iconPosition" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "autoselectFirst" | "autocomplete" | "autofocus">, "size" | "name" | "id" | "onFocus" | "onBlur" | "onUpdate:modelValue" | "placeholder" | ("floating" | "label" | "disabled" | "modelValue" | "modifiers" | "icon" | "iconPosition" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "autoselectFirst" | "autocomplete" | "autofocus")> & {} & Partial<{}>> & import("vue").PublicProps;
69
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "floating" | "label" | "disabled" | "modelValue" | "modifiers" | "icon" | "iconPosition" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "autoselectFirst" | "iconClear" | "labelClear" | "autocomplete" | "autofocus">, "size" | "name" | "id" | "onFocus" | "onBlur" | "onClear" | "onUpdate:modelValue" | "placeholder" | ("floating" | "label" | "disabled" | "modelValue" | "modifiers" | "icon" | "iconPosition" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "autoselectFirst" | "iconClear" | "labelClear" | "autocomplete" | "autofocus")> & {} & Partial<{}>> & import("vue").PublicProps;
65
70
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
66
71
  attrs: any;
67
72
  slots: {
68
- before?: ((props: {
73
+ before?: (props: {
69
74
  valid: boolean;
70
75
  invalid: boolean;
71
76
  modelValue: string | number | boolean | unknown[] | Record<string, any> | undefined;
72
- }) => any) | undefined;
73
- after?: ((props: {
77
+ }) => any;
78
+ } & {
79
+ after?: (props: {
74
80
  valid: boolean;
75
81
  invalid: boolean;
76
82
  modelValue: string | number | boolean | unknown[] | Record<string, any> | undefined;
77
- }) => any) | undefined;
78
- hint?: ((props: {
83
+ }) => any;
84
+ } & {
85
+ hint?: (props: {
79
86
  modelValue: unknown;
80
87
  valid: boolean;
81
88
  invalid: boolean;
82
89
  loading: boolean;
83
- }) => any) | undefined;
84
- loading?: ((props: {
90
+ }) => any;
91
+ } & {
92
+ loading?: (props: {
85
93
  modelValue: unknown;
86
94
  valid: boolean;
87
95
  invalid: boolean;
88
96
  loading: boolean;
89
- }) => any) | undefined;
90
- valid?: ((props: {
97
+ }) => any;
98
+ } & {
99
+ valid?: (props: {
91
100
  modelValue: unknown;
92
101
  valid: boolean;
93
102
  invalid: boolean;
94
103
  loading: boolean;
95
- }) => any) | undefined;
96
- invalid?: ((props: {
104
+ }) => any;
105
+ } & {
106
+ invalid?: (props: {
97
107
  modelValue: unknown;
98
108
  valid: boolean;
99
109
  invalid: boolean;
100
110
  loading: boolean;
101
- }) => any) | undefined;
111
+ }) => any;
102
112
  };
103
- emit: ((evt: "update:modelValue", args_0: any) => void) & ((evt: "blur", args_0: import("@vueuse/core").MaybeElement) => void) & ((evt: "focus", args_0: import("@vueuse/core").MaybeElement) => void);
113
+ emit: ((evt: "clear") => void) & ((evt: "update:modelValue", args_0: any) => void) & ((evt: "blur", args_0: import("@vueuse/core").MaybeElement) => void) & ((evt: "focus", args_0: import("@vueuse/core").MaybeElement) => void);
104
114
  }>) => import("vue").VNode & {
105
115
  __ctx?: Awaited<typeof __VLS_setup>;
106
116
  };
@@ -1,9 +1,11 @@
1
1
  import type { MaybeElement } from '@vueuse/core';
2
2
  import type { Option } from '../../types/generic';
3
+ import type { VvIconProps } from '../VvIcon';
3
4
  export type VvSelectEmits = {
4
5
  'update:modelValue': [any];
5
6
  'focus': [MaybeElement];
6
7
  'blur': [MaybeElement];
8
+ 'clear': [];
7
9
  };
8
10
  export declare const VvSelectProps: {
9
11
  /**
@@ -43,6 +45,21 @@ export declare const VvSelectProps: {
43
45
  * Select placeholder
44
46
  */
45
47
  placeholder: StringConstructor;
48
+ /**
49
+ * VvIcon name for clear button
50
+ * @see VvIcon
51
+ */
52
+ iconClear: {
53
+ type: PropType<string | VvIconProps>;
54
+ default: "close";
55
+ };
56
+ /**
57
+ * Label for clear button
58
+ */
59
+ labelClear: {
60
+ type: StringConstructor;
61
+ default: string;
62
+ };
46
63
  label: {
47
64
  type: (StringConstructor | NumberConstructor)[];
48
65
  default: undefined;
@@ -56,7 +73,7 @@ export declare const VvSelectProps: {
56
73
  default: boolean;
57
74
  };
58
75
  icon: {
59
- type: PropType<string | import("../VvIcon").VvIconProps>;
76
+ type: PropType<string | VvIconProps>;
60
77
  default: undefined;
61
78
  };
62
79
  iconPosition: {
@@ -180,6 +197,21 @@ export declare function useVvSelectProps<T extends Option | string>(): {
180
197
  * Select placeholder
181
198
  */
182
199
  placeholder: StringConstructor;
200
+ /**
201
+ * VvIcon name for clear button
202
+ * @see VvIcon
203
+ */
204
+ iconClear: {
205
+ type: PropType<string | VvIconProps>;
206
+ default: "close";
207
+ };
208
+ /**
209
+ * Label for clear button
210
+ */
211
+ labelClear: {
212
+ type: StringConstructor;
213
+ default: string;
214
+ };
183
215
  label: {
184
216
  type: (StringConstructor | NumberConstructor)[];
185
217
  default: undefined;
@@ -193,7 +225,7 @@ export declare function useVvSelectProps<T extends Option | string>(): {
193
225
  default: boolean;
194
226
  };
195
227
  icon: {
196
- type: PropType<string | import("../VvIcon").VvIconProps>;
228
+ type: PropType<string | VvIconProps>;
197
229
  default: undefined;
198
230
  };
199
231
  iconPosition: {
@@ -37,7 +37,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<globalThis
37
37
  items: NavItemTab[];
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
39
39
  [x: `panel::${string}`]: ((props: {}) => any) | undefined;
40
- 'nav-item'?: ((props: {
40
+ } & {
41
+ 'nav-item'?: (props: {
41
42
  item: {
42
43
  label: string;
43
44
  ariaLabel?: string;
@@ -52,7 +53,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<globalThis
52
53
  };
53
54
  data: Record<string, unknown> | undefined;
54
55
  index: number;
55
- }) => any) | undefined;
56
+ }) => any;
56
57
  }>;
57
58
  export default _default;
58
59
  type __VLS_WithSlots<T, S> = T & {
@@ -2,7 +2,7 @@ import { unref, computed, isRef, defineComponent, h, useId, Fragment, provide, r
2
2
  import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
3
3
  import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useStorage, useElementVisibility } from "@vueuse/core";
4
4
  import mitt from "mitt";
5
- import { iconExists, Icon, addIcon } from "@iconify/vue";
5
+ import { iconLoaded, Icon, addIcon } from "@iconify/vue";
6
6
  var StorageType = /* @__PURE__ */ ((StorageType2) => {
7
7
  StorageType2["local"] = "local";
8
8
  StorageType2["session"] = "session";
@@ -193,7 +193,7 @@ const DebounceProps = {
193
193
  const IconProps = {
194
194
  /**
195
195
  * VvIcon name or props
196
- * @see VVIcon
196
+ * @see VvIcon
197
197
  */
198
198
  icon: {
199
199
  type: [String, Object],
@@ -472,7 +472,7 @@ const VvTextareaProps = {
472
472
  spellcheck: { type: [Boolean, String], default: SPELLCHECK.default },
473
473
  /**
474
474
  * VvIcon name for remove suggestion button
475
- * @see VVIcon
475
+ * @see VvIcon
476
476
  */
477
477
  iconRemoveSuggestion: {
478
478
  type: [String, Object],
@@ -1331,13 +1331,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1331
1331
  const icon = computed(() => {
1332
1332
  const name = props.name ?? "";
1333
1333
  const iconName = `@${provider.value}:${props.prefix}:${name}`;
1334
- if (iconExists(iconName)) {
1334
+ if (iconLoaded(iconName)) {
1335
1335
  return iconName;
1336
1336
  }
1337
1337
  const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
1338
1338
  (iconsCollection2) => {
1339
1339
  const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
1340
- return iconExists(icon2);
1340
+ return iconLoaded(icon2);
1341
1341
  }
1342
1342
  );
1343
1343
  if (iconsCollection) {
@@ -1369,7 +1369,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1369
1369
  }
1370
1370
  }
1371
1371
  if (volver) {
1372
- if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
1372
+ if (props.src && !iconLoaded(`@${provider.value}:${props.prefix}:${props.name}`)) {
1373
1373
  show.value = false;
1374
1374
  volver.fetchIcon(props.src).then((svg) => {
1375
1375
  if (svg) {
@@ -1397,9 +1397,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1397
1397
  flip: _ctx.flip,
1398
1398
  rotate: unref(hasRotate),
1399
1399
  color: _ctx.color,
1400
- onLoad: _ctx.onLoad,
1401
1400
  icon: unref(icon)
1402
- }), null, 16, ["class"])) : createCommentVNode("v-if", true);
1401
+ }, { onLoad: _ctx.onLoad }), null, 16, ["class", "onLoad"])) : createCommentVNode("v-if", true);
1403
1402
  };
1404
1403
  }
1405
1404
  });