@volverjs/ui-vue 0.0.9-beta.7 → 0.0.9-beta.9

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 (63) hide show
  1. package/dist/components/VvAlert/VvAlert.es.js +7 -6
  2. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  3. package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
  4. package/dist/components/VvAlert/index.d.ts +3 -3
  5. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +7 -6
  6. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  7. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +1 -1
  8. package/dist/components/VvCheckbox/VvCheckbox.es.js +84 -14
  9. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  10. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  11. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +90 -15
  12. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  13. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
  14. package/dist/components/VvCombobox/VvCombobox.es.js +81 -68
  15. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  16. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +4 -4
  17. package/dist/components/VvDialog/VvDialog.es.js +21 -20
  18. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  19. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -2
  20. package/dist/components/VvInputText/VvInputText.es.js +80 -14
  21. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  22. package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
  23. package/dist/components/VvRadio/VvRadio.es.js +84 -14
  24. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  25. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  26. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +90 -15
  27. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  28. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
  29. package/dist/components/VvSelect/VvSelect.es.js +80 -14
  30. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  31. package/dist/components/VvSelect/VvSelect.vue.d.ts +4 -4
  32. package/dist/components/VvTextarea/VvTextarea.es.js +80 -14
  33. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  34. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
  35. package/dist/components/common/HintSlot.d.ts +4 -3
  36. package/dist/components/index.es.js +147 -102
  37. package/dist/components/index.umd.js +1 -1
  38. package/dist/composables/index.d.ts +1 -2
  39. package/dist/icons.es.js +3 -3
  40. package/dist/icons.umd.js +1 -1
  41. package/dist/resolvers/unplugin.es.js +3 -0
  42. package/dist/resolvers/unplugin.umd.js +1 -1
  43. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +1 -1
  44. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +7 -7
  45. package/package.json +34 -34
  46. package/src/assets/icons/detailed.json +1 -1
  47. package/src/assets/icons/normal.json +1 -1
  48. package/src/assets/icons/simple.json +1 -1
  49. package/src/components/VvAlert/VvAlert.vue +5 -1
  50. package/src/components/VvAlert/index.ts +3 -3
  51. package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
  52. package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
  53. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
  54. package/src/components/VvCombobox/VvCombobox.vue +1 -1
  55. package/src/components/VvDialog/VvDialog.vue +10 -11
  56. package/src/components/VvInputText/VvInputText.vue +8 -1
  57. package/src/components/VvRadio/VvRadio.vue +8 -1
  58. package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
  59. package/src/components/VvSelect/VvSelect.vue +8 -1
  60. package/src/components/VvTextarea/VvTextarea.vue +8 -1
  61. package/src/components/common/HintSlot.ts +26 -13
  62. package/src/composables/index.ts +1 -3
  63. package/src/resolvers/unplugin.ts +3 -0
@@ -1,4 +1,4 @@
1
- import { unref, computed, defineComponent, h, inject, toRef, toRefs, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, isRef, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps, provide, createCommentVNode, Fragment, renderList, createBlock, mergeProps } from "vue";
1
+ import { unref, computed, isRef, defineComponent, h, inject, toRef, toRefs, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps, provide, createCommentVNode, Fragment, renderList, createBlock, mergeProps } from "vue";
2
2
  import { nanoid } from "nanoid";
3
3
  import { useVModel } from "@vueuse/core";
4
4
  import { get } from "ts-dot-prop";
@@ -38,6 +38,7 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
38
38
  AnchorTarget2["_top"] = "_top";
39
39
  return AnchorTarget2;
40
40
  })(AnchorTarget || {});
41
+ const INJECTION_KEY_VOLVER = Symbol.for("volver");
41
42
  const INJECTION_KEY_CHECK_GROUP = Symbol.for("checkGroup");
42
43
  function equals(obj1, obj2, field) {
43
44
  if (field)
@@ -130,19 +131,27 @@ function joinLines(items) {
130
131
  }
131
132
  return items;
132
133
  }
133
- function HintSlotFactory(props, slots) {
134
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
135
- const validLabel = computed(() => joinLines(props.validLabel));
136
- const loadingLabel = computed(() => props.loadingLabel);
137
- const hintLabel = computed(() => props.hintLabel);
134
+ function HintSlotFactory(propsOrRef, slots) {
135
+ const props = computed(() => {
136
+ if (isRef(propsOrRef)) {
137
+ return propsOrRef.value;
138
+ }
139
+ return propsOrRef;
140
+ });
141
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
142
+ const validLabel = computed(() => joinLines(props.value.validLabel));
143
+ const loadingLabel = computed(() => props.value.loadingLabel);
144
+ const hintLabel = computed(() => props.value.hintLabel);
138
145
  const hasLoadingLabelOrSlot = computed(
139
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
146
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
140
147
  );
141
148
  const hasInvalidLabelOrSlot = computed(
142
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
149
+ () => !hasLoadingLabelOrSlot.value && Boolean(
150
+ props.value.invalid && (slots.invalid || invalidLabel.value)
151
+ )
143
152
  );
144
153
  const hasValidLabelOrSlot = computed(
145
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
154
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
146
155
  );
147
156
  const hasHintLabelOrSlot = computed(
148
157
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -151,10 +160,10 @@ function HintSlotFactory(props, slots) {
151
160
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
152
161
  );
153
162
  const hintSlotScope = computed(() => ({
154
- modelValue: props.modelValue,
155
- valid: props.valid,
156
- invalid: props.invalid,
157
- loading: props.loading
163
+ modelValue: props.value.modelValue,
164
+ valid: props.value.valid,
165
+ invalid: props.value.invalid,
166
+ loading: props.value.loading
158
167
  }));
159
168
  const HintSlot = defineComponent({
160
169
  name: "HintSlot",
@@ -636,6 +645,62 @@ function useGroupProps(props, emit) {
636
645
  disabled
637
646
  };
638
647
  }
648
+ function useVolver() {
649
+ return inject(INJECTION_KEY_VOLVER);
650
+ }
651
+ function useDefaults(componentName, propsDefinition, props) {
652
+ const volver = useVolver();
653
+ const volverComponentDefaults = computed(() => {
654
+ var _a;
655
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
656
+ return void 0;
657
+ }
658
+ return volver.defaults.value[componentName];
659
+ });
660
+ return computed(() => {
661
+ if (volverComponentDefaults.value === void 0) {
662
+ return props;
663
+ }
664
+ const componentDefaults = volverComponentDefaults.value;
665
+ const simplifiedPropsDefinition = propsDefinition;
666
+ const simplifiedProps = props;
667
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
668
+ const propValue = simplifiedProps[key];
669
+ acc[key] = propValue;
670
+ if (key in componentDefaults) {
671
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
672
+ const typeArray = simplifiedPropsDefinition[key];
673
+ if (typeArray.length) {
674
+ const typeFunction = typeArray[0];
675
+ if (typeFunction === propValue) {
676
+ acc[key] = componentDefaults[key];
677
+ }
678
+ }
679
+ }
680
+ if (typeof simplifiedPropsDefinition[key] === "function") {
681
+ const typeFunction = simplifiedPropsDefinition[key];
682
+ if (typeFunction() === propValue) {
683
+ acc[key] = componentDefaults[key];
684
+ }
685
+ }
686
+ if (typeof simplifiedPropsDefinition[key] === "object") {
687
+ let defaultValue = simplifiedPropsDefinition[key].default;
688
+ if (typeof defaultValue === "function") {
689
+ defaultValue = defaultValue();
690
+ }
691
+ if (typeof defaultValue === "object") {
692
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
693
+ acc[key] = componentDefaults[key];
694
+ }
695
+ } else if (defaultValue === propValue) {
696
+ acc[key] = componentDefaults[key];
697
+ }
698
+ }
699
+ }
700
+ return acc;
701
+ }, {});
702
+ });
703
+ }
639
704
  const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
640
705
  function useModifiers(prefix, modifiers, others) {
641
706
  return computed(() => {
@@ -672,6 +737,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
672
737
  setup(__props, { emit }) {
673
738
  const props = __props;
674
739
  const slots = useSlots();
740
+ const propsDefaults = useDefaults(
741
+ "VvCheckbox",
742
+ VvCheckboxProps,
743
+ props
744
+ );
675
745
  const {
676
746
  id,
677
747
  disabled,
@@ -784,7 +854,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
784
854
  hasHintLabelOrSlot,
785
855
  hasInvalidLabelOrSlot,
786
856
  hintSlotScope
787
- } = HintSlotFactory(props, slots);
857
+ } = HintSlotFactory(propsDefaults, slots);
788
858
  return (_ctx, _cache) => {
789
859
  return openBlock(), createElementBlock("label", {
790
860
  class: normalizeClass(unref(bemCssClasses)),
@@ -903,6 +973,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
903
973
  setup(__props, { emit }) {
904
974
  const props = __props;
905
975
  const slots = useSlots();
976
+ const propsDefaults = useDefaults(
977
+ "VvCheckboxGroup",
978
+ VvCheckboxGroupProps,
979
+ props
980
+ );
906
981
  const modelValue = useVModel(props, "modelValue", emit);
907
982
  const { disabled, readonly, vertical, valid, invalid, modifiers } = toRefs(props);
908
983
  useProvideGroupState({
@@ -933,7 +1008,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
933
1008
  value: getOptionValue(option)
934
1009
  };
935
1010
  };
936
- const { HintSlot, hintSlotScope } = HintSlotFactory(props, slots);
1011
+ const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
937
1012
  return (_ctx, _cache) => {
938
1013
  return openBlock(), createElementBlock("fieldset", {
939
1014
  class: normalizeClass(unref(bemCssClasses))
@@ -1 +1 @@
1
- !function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=l(e.vue,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,l,t,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const r=Symbol.for("checkGroup");function u(e,l,t){return t?s(e,t)===s(l,t):d(e,l)}function d(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),a=Array.isArray(l);let o,n,i;if(t&&a){if(n=e.length,n!=l.length)return!1;for(o=n;0!=o--;)if(!d(e[o],l[o]))return!1;return!0}if(t!=a)return!1;const r=e instanceof Date,u=l instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==l.getTime();const s=e instanceof RegExp,v=l instanceof RegExp;if(s!=v)return!1;if(s&&v)return e.toString()==l.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(l).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(l,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!d(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function s(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let a=e;for(let l=0,o=t.length;l<o;++l){if(null==e)return null;a=a[t[l]]}return a}}return null}function v(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function c(l,t){const a=e.computed((()=>v(l.invalidLabel))),o=e.computed((()=>v(l.validLabel))),n=e.computed((()=>l.loadingLabel)),i=e.computed((()=>l.hintLabel)),r=e.computed((()=>Boolean(l.loading&&(t.loading||n.value)))),u=e.computed((()=>!r.value&&Boolean(l.invalid&&(t.invalid||a.value)))),d=e.computed((()=>!r.value&&!u.value&&Boolean(l.valid&&(t.valid||o.value)))),s=e.computed((()=>!r.value&&!u.value&&!d.value&&Boolean(t.hint||i.value))),c=e.computed((()=>u.value||d.value||r.value||s.value)),f=e.computed((()=>({modelValue:l.modelValue,valid:l.valid,invalid:l.invalid,loading:l.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:o,loadingLabel:n,hintLabel:i,hasInvalidLabelOrSlot:u,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hasHintLabelOrSlot:s}),render(){var l,t,a,o,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==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??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:u,hasHintLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:r,hintSlotScope:f,HintSlot:p}}const f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},m={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},b={disabled:Boolean},h=(Boolean,Boolean,{label:[String,Number]}),g={readonly:Boolean},y={modifiers:[String,Array]},S={hintLabel:{type:String,default:""}},k={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const L={tabindex:{type:[String,Number],default:0}},B={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...B,name:{type:String,required:!0}},...L,...f,...p,...S,...b,...g,...y,...h,...m,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},O={...f,...p,...k,...S,...b,...g,...y,...h,...m,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function x(l){const t=e.inject(l,void 0),a=e.computed((()=>{return l=t,!(null==(a=e.unref(l))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var l,a}));return{group:t,isInGroup:a,getGroupOrLocalRef:function(l,a,o){if(null==t?void 0:t.value){const a=e.unref(t.value)[l];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,l);return e.computed({get:()=>n.value,set(e){o&&o(`update:${l}`,e)}})}}}i.button;const $={...V,...y,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function A(l,t,a){return e.computed((()=>{const o={[l]:!0},n="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(o[`${l}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((t=>{o[`${l}--${t}`]=e.unref(a.value[t])})),o}))}const w=["for"],C=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],P=e.defineComponent({name:"VvCheckbox",props:$,emits:["click","update:modelValue","change","blur"],setup(t,{emit:a}){const o=t,n=e.useSlots(),{id:i,disabled:d,readonly:s,valid:v,invalid:f,propsSwitch:p,modelValue:m,indeterminate:b,isInGroup:h}=function(l,t){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=x(r),{id:i,switch:u,indeterminate:d}=e.toRefs(l),s=n("modelValue",l,t),v=n("valid",l),c=n("invalid",l),f=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:u,indeterminate:d,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,a),g=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(i),y=e.computed((()=>`${g.value}-hint`)),S=e.computed((()=>B.value?-1:o.tabindex)),k=e.ref(),L=e.computed((()=>void 0!==o.uncheckedValue&&!h.value)),B=e.computed((()=>d.value||s.value)),V=e.computed((()=>!0===f.value||!0!==v.value&&void 0)),O=e.computed((()=>L.value?m.value===o.value:Array.isArray(m.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(u(e,t))return!0;return!1}(o.value,m.value):u(o.value,m.value))),$=e.computed((()=>!!b.value||!(O.value||!L.value||o.uncheckedValue===m.value))),P=e.computed((()=>{if(!L.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),R=e.computed({get:()=>O.value,set(e){if(L.value)m.value=e?o.value:o.uncheckedValue;else if(Array.isArray(m.value)||h.value){const l=new Set(Array.isArray(m.value)?m.value:void 0!==m.value?[m.value]:[]);e?l.add(o.value):l.delete(o.value),m.value=[...l]}else m.value=e?o.value:void 0;a("change",e)}}),{modifiers:j}=e.toRefs(o),N=A("vv-checkbox",j,e.computed((()=>({switch:p.value,valid:v.value,invalid:f.value,disabled:d.value,readonly:s.value,indeterminate:b.value}))));e.watchEffect((()=>{L.value&&Array.isArray(m.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>$.value),(e=>{k.value.indeterminate=!!e})),e.onMounted((()=>{$.value&&(k.value.indeterminate=!0)}));const{HintSlot:E,hasHintLabelOrSlot:_,hasInvalidLabelOrSlot:z,hintSlotScope:G}=c(o,n);return(l,t)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(N)),for:e.unref(g)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(g),ref_key:"input",ref:k,"onUpdate:modelValue":t[0]||(t[0]=l=>e.isRef(R)?R.value=l:null),type:"checkbox",class:"vv-checkbox__input",name:l.name,disabled:e.unref(B),value:e.unref(P),tabindex:e.unref(S),"aria-invalid":e.unref(V),"aria-describedby":e.unref(_)?e.unref(y):void 0,"aria-errormessage":e.unref(z)?e.unref(y):void 0},null,8,C),[[e.vModelCheckbox,e.unref(R)]]),e.renderSlot(l.$slots,"default",{value:e.unref(m)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(E),{id:e.unref(y),class:"vv-checkbox__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),key:"3"}:void 0]),1032,["id"])],10,w))}}),R=O;const j=["textContent"],N={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:R,emits:["update:modelValue","change"],setup(l,{emit:o}){const n=l,i=e.useSlots(),u=t.useVModel(n,"modelValue",o),{disabled:d,readonly:s,vertical:v,valid:f,invalid:p,modifiers:m}=e.toRefs(n);!function(l){if(Object.keys(l).some((t=>"key"!==t&&!e.isRef(l[t]))))throw Error("One or more groupState props aren't ref.");e.provide(l.key,e.computed((()=>l)))}({key:r,modelValue:u,disabled:d,readonly:s,valid:f,invalid:p});const{getOptionLabel:b,getOptionValue:h}=function(l){const{options:t,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(l);return{options:t,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),g=A("vv-checkbox-group",m,e.computed((()=>({disabled:d.value,readonly:s.value,horizontal:!v.value,valid:f.value,invalid:p.value})))),{HintSlot:y,hintSlotScope:S}=c(n,i);return(l,t)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(g))},[l.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(l.label)},null,8,j)):e.createCommentVNode("",!0),e.createElementVNode("div",N,[l.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.options,((l,t)=>(e.openBlock(),e.createBlock(P,e.mergeProps({key:t},((e,l)=>({id:`${n.name}_opt${l}`,name:n.name,label:b(e),value:h(e)}))(l,t)),null,16)))),128)):e.renderSlot(l.$slots,"default",{key:1})]),e.createVNode(e.unref(y),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(S))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(S))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(S))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(S))))])),key:"3"}:void 0]),1024)],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const r=Symbol.for("volver"),u=Symbol.for("checkGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!s(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function f(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>c(a.value.invalidLabel))),n=e.computed((()=>c(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,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==(o=(a=this.$slots).invalid)?void 0:o.call(a))??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:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},S={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const B={tabindex:{type:[String,Number],default:0}},O={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...O,name:{type:String,required:!0}},...B,...p,...m,...k,...h,...y,...S,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},x={...p,...m,...L,...k,...h,...y,...S,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function $(t){const l=e.inject(t,void 0),a=e.computed((()=>{return t=l,!(null==(a=e.unref(t))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var t,a}));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){if(null==l?void 0:l.value){const a=e.unref(l.value)[t];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l,a){const o=e.inject(r),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function j(t,l,a){return e.computed((()=>{const o={[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&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const w=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],P=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=e.useSlots(),i=C("VvCheckbox",A,o),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,indeterminate:d}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,a),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!g.value)),O=e.computed((()=>s.value||v.value)),V=e.computed((()=>!0===p.value||!0!==c.value&&void 0)),x=e.computed((()=>B.value?b.value===o.value:Array.isArray(b.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(o.value,b.value):d(o.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||o.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?o.value:o.uncheckedValue;else if(Array.isArray(b.value)||g.value){const t=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?t.add(o.value):t.delete(o.value),b.value=[...t]}else b.value=e?o.value:void 0;a("change",e)}}),{modifiers:_}=e.toRefs(o),z=j("vv-checkbox",_,e.computed((()=>({switch:m.value,valid:c.value,invalid:p.value,disabled:s.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(b.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>P.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{P.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=f(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(E)?E.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(O),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(V),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,R),[[e.vModelCheckbox,e.unref(E)]]),e.renderSlot(t.$slots,"default",{value:e.unref(b)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,w))}}),N=x;const E=["textContent"],_={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=l.useVModel(n,"modelValue",o),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),y=j("vv-checkbox-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!c.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:k}=f(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,E)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(P,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
@@ -97,25 +97,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
97
97
  }, {}>, {
98
98
  default?(_: {}): any;
99
99
  hint?(_: {
100
- modelValue: any;
100
+ modelValue: unknown;
101
101
  valid: boolean;
102
102
  invalid: boolean;
103
103
  loading: boolean;
104
104
  }): any;
105
105
  loading?(_: {
106
- modelValue: any;
106
+ modelValue: unknown;
107
107
  valid: boolean;
108
108
  invalid: boolean;
109
109
  loading: boolean;
110
110
  }): any;
111
111
  valid?(_: {
112
- modelValue: any;
112
+ modelValue: unknown;
113
113
  valid: boolean;
114
114
  invalid: boolean;
115
115
  loading: boolean;
116
116
  }): any;
117
117
  invalid?(_: {
118
- modelValue: any;
118
+ modelValue: unknown;
119
119
  valid: boolean;
120
120
  invalid: boolean;
121
121
  loading: boolean;
@@ -1,4 +1,4 @@
1
- import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, provide, h, Fragment, useAttrs, onMounted, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, useSlots, isRef, renderList, vModelSelect, createSlots, resolveDynamicComponent, toRef, withModifiers, vModelText } from "vue";
1
+ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, provide, h, Fragment, useAttrs, onMounted, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, isRef, useSlots, renderList, vModelSelect, createSlots, resolveDynamicComponent, toRef, withModifiers, vModelText } from "vue";
2
2
  import { iconExists, Icon, addIcon } from "@iconify/vue";
3
3
  import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
4
4
  import { nanoid } from "nanoid";
@@ -1455,19 +1455,27 @@ function joinLines(items) {
1455
1455
  }
1456
1456
  return items;
1457
1457
  }
1458
- function HintSlotFactory(props, slots) {
1459
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
1460
- const validLabel = computed(() => joinLines(props.validLabel));
1461
- const loadingLabel = computed(() => props.loadingLabel);
1462
- const hintLabel = computed(() => props.hintLabel);
1458
+ function HintSlotFactory(propsOrRef, slots) {
1459
+ const props = computed(() => {
1460
+ if (isRef(propsOrRef)) {
1461
+ return propsOrRef.value;
1462
+ }
1463
+ return propsOrRef;
1464
+ });
1465
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
1466
+ const validLabel = computed(() => joinLines(props.value.validLabel));
1467
+ const loadingLabel = computed(() => props.value.loadingLabel);
1468
+ const hintLabel = computed(() => props.value.hintLabel);
1463
1469
  const hasLoadingLabelOrSlot = computed(
1464
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
1470
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
1465
1471
  );
1466
1472
  const hasInvalidLabelOrSlot = computed(
1467
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
1473
+ () => !hasLoadingLabelOrSlot.value && Boolean(
1474
+ props.value.invalid && (slots.invalid || invalidLabel.value)
1475
+ )
1468
1476
  );
1469
1477
  const hasValidLabelOrSlot = computed(
1470
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
1478
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
1471
1479
  );
1472
1480
  const hasHintLabelOrSlot = computed(
1473
1481
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -1476,10 +1484,10 @@ function HintSlotFactory(props, slots) {
1476
1484
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
1477
1485
  );
1478
1486
  const hintSlotScope = computed(() => ({
1479
- modelValue: props.modelValue,
1480
- valid: props.valid,
1481
- invalid: props.invalid,
1482
- loading: props.loading
1487
+ modelValue: props.value.modelValue,
1488
+ valid: props.value.valid,
1489
+ invalid: props.value.invalid,
1490
+ loading: props.value.loading
1483
1491
  }));
1484
1492
  const HintSlot = defineComponent({
1485
1493
  name: "HintSlot",
@@ -1608,6 +1616,59 @@ const VvSelectProps = {
1608
1616
  placeholder: String
1609
1617
  };
1610
1618
  const VvSelectEmits = ["update:modelValue", "focus", "blur"];
1619
+ function useDefaults(componentName, propsDefinition, props) {
1620
+ const volver = useVolver();
1621
+ const volverComponentDefaults = computed(() => {
1622
+ var _a;
1623
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
1624
+ return void 0;
1625
+ }
1626
+ return volver.defaults.value[componentName];
1627
+ });
1628
+ return computed(() => {
1629
+ if (volverComponentDefaults.value === void 0) {
1630
+ return props;
1631
+ }
1632
+ const componentDefaults = volverComponentDefaults.value;
1633
+ const simplifiedPropsDefinition = propsDefinition;
1634
+ const simplifiedProps = props;
1635
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
1636
+ const propValue = simplifiedProps[key];
1637
+ acc[key] = propValue;
1638
+ if (key in componentDefaults) {
1639
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
1640
+ const typeArray = simplifiedPropsDefinition[key];
1641
+ if (typeArray.length) {
1642
+ const typeFunction = typeArray[0];
1643
+ if (typeFunction === propValue) {
1644
+ acc[key] = componentDefaults[key];
1645
+ }
1646
+ }
1647
+ }
1648
+ if (typeof simplifiedPropsDefinition[key] === "function") {
1649
+ const typeFunction = simplifiedPropsDefinition[key];
1650
+ if (typeFunction() === propValue) {
1651
+ acc[key] = componentDefaults[key];
1652
+ }
1653
+ }
1654
+ if (typeof simplifiedPropsDefinition[key] === "object") {
1655
+ let defaultValue = simplifiedPropsDefinition[key].default;
1656
+ if (typeof defaultValue === "function") {
1657
+ defaultValue = defaultValue();
1658
+ }
1659
+ if (typeof defaultValue === "object") {
1660
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
1661
+ acc[key] = componentDefaults[key];
1662
+ }
1663
+ } else if (defaultValue === propValue) {
1664
+ acc[key] = componentDefaults[key];
1665
+ }
1666
+ }
1667
+ }
1668
+ return acc;
1669
+ }, {});
1670
+ });
1671
+ }
1611
1672
  function useComponentFocus(inputTemplateRef, emit) {
1612
1673
  const { focused } = useFocus(inputTemplateRef);
1613
1674
  watch(focused, (newValue) => {
@@ -1710,13 +1771,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1710
1771
  setup(__props, { emit }) {
1711
1772
  const props = __props;
1712
1773
  const slots = useSlots();
1774
+ const propsDefaults = useDefaults(
1775
+ "VvSelect",
1776
+ VvSelectProps,
1777
+ props
1778
+ );
1713
1779
  const select = ref();
1714
1780
  const {
1715
1781
  HintSlot,
1716
1782
  hasHintLabelOrSlot,
1717
1783
  hasInvalidLabelOrSlot,
1718
1784
  hintSlotScope
1719
- } = HintSlotFactory(props, slots);
1785
+ } = HintSlotFactory(propsDefaults, slots);
1720
1786
  const {
1721
1787
  id,
1722
1788
  modifiers,
@@ -2325,59 +2391,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2325
2391
  };
2326
2392
  }
2327
2393
  });
2328
- function useDefaults(componentName, propsDefinition, props) {
2329
- const volver = useVolver();
2330
- const volverComponentDefaults = computed(() => {
2331
- var _a;
2332
- if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
2333
- return void 0;
2334
- }
2335
- return volver.defaults.value[componentName];
2336
- });
2337
- return computed(() => {
2338
- if (volverComponentDefaults.value === void 0) {
2339
- return props;
2340
- }
2341
- const componentDefaults = volverComponentDefaults.value;
2342
- const simplifiedPropsDefinition = propsDefinition;
2343
- const simplifiedProps = props;
2344
- return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
2345
- const propValue = simplifiedProps[key];
2346
- acc[key] = propValue;
2347
- if (key in componentDefaults) {
2348
- if (Array.isArray(simplifiedPropsDefinition[key])) {
2349
- const typeArray = simplifiedPropsDefinition[key];
2350
- if (typeArray.length) {
2351
- const typeFunction = typeArray[0];
2352
- if (typeFunction === propValue) {
2353
- acc[key] = componentDefaults[key];
2354
- }
2355
- }
2356
- }
2357
- if (typeof simplifiedPropsDefinition[key] === "function") {
2358
- const typeFunction = simplifiedPropsDefinition[key];
2359
- if (typeFunction() === propValue) {
2360
- acc[key] = componentDefaults[key];
2361
- }
2362
- }
2363
- if (typeof simplifiedPropsDefinition[key] === "object") {
2364
- let defaultValue = simplifiedPropsDefinition[key].default;
2365
- if (typeof defaultValue === "function") {
2366
- defaultValue = defaultValue();
2367
- }
2368
- if (typeof defaultValue === "object") {
2369
- if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
2370
- acc[key] = componentDefaults[key];
2371
- }
2372
- } else if (defaultValue === propValue) {
2373
- acc[key] = componentDefaults[key];
2374
- }
2375
- }
2376
- }
2377
- return acc;
2378
- }, {});
2379
- });
2380
- }
2381
2394
  const _hoisted_1 = ["id"];
2382
2395
  const _hoisted_2 = ["id", "for"];
2383
2396
  const _hoisted_3 = ["id", "aria-controls", "placeholder"];
@@ -2428,7 +2441,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2428
2441
  hasHintLabelOrSlot,
2429
2442
  hasInvalidLabelOrSlot,
2430
2443
  hintSlotScope
2431
- } = HintSlotFactory(props, slots);
2444
+ } = HintSlotFactory(propsDefaults, slots);
2432
2445
  const inputEl = ref(null);
2433
2446
  const inputSearchEl = ref(null);
2434
2447
  const wrapperEl = ref(null);