@volverjs/ui-vue 0.0.9-beta.7 → 0.0.9-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VvAlert/VvAlert.es.js +7 -6
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
- package/dist/components/VvAlert/index.d.ts +3 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +7 -6
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +65 -2
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +71 -3
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +62 -56
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +4 -4
- package/dist/components/VvInputText/VvInputText.es.js +61 -2
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvRadio/VvRadio.es.js +65 -2
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +71 -3
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +61 -2
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +4 -4
- package/dist/components/VvTextarea/VvTextarea.es.js +61 -2
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
- package/dist/components/common/HintSlot.d.ts +4 -3
- package/dist/components/index.es.js +104 -67
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/index.d.ts +1 -2
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/package.json +21 -21
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAlert/VvAlert.vue +5 -1
- package/src/components/VvAlert/index.ts +3 -3
- package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
- package/src/components/VvCombobox/VvCombobox.vue +1 -1
- package/src/components/VvInputText/VvInputText.vue +8 -1
- package/src/components/VvRadio/VvRadio.vue +8 -1
- package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
- package/src/components/VvSelect/VvSelect.vue +8 -1
- package/src/components/VvTextarea/VvTextarea.vue +8 -1
- package/src/components/common/HintSlot.ts +7 -2
- package/src/composables/index.ts +1 -3
|
@@ -14,7 +14,8 @@ function joinLines(items) {
|
|
|
14
14
|
}
|
|
15
15
|
return items;
|
|
16
16
|
}
|
|
17
|
-
function HintSlotFactory(
|
|
17
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
18
|
+
const props = unref(propsOrRef);
|
|
18
19
|
const invalidLabel = computed(() => joinLines(props.invalidLabel));
|
|
19
20
|
const validLabel = computed(() => joinLines(props.validLabel));
|
|
20
21
|
const loadingLabel = computed(() => props.loadingLabel);
|
|
@@ -750,6 +751,59 @@ const VvTextareaProps = {
|
|
|
750
751
|
*/
|
|
751
752
|
resizable: Boolean
|
|
752
753
|
};
|
|
754
|
+
function useDefaults(componentName, propsDefinition, props) {
|
|
755
|
+
const volver = useVolver();
|
|
756
|
+
const volverComponentDefaults = computed(() => {
|
|
757
|
+
var _a;
|
|
758
|
+
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
759
|
+
return void 0;
|
|
760
|
+
}
|
|
761
|
+
return volver.defaults.value[componentName];
|
|
762
|
+
});
|
|
763
|
+
return computed(() => {
|
|
764
|
+
if (volverComponentDefaults.value === void 0) {
|
|
765
|
+
return props;
|
|
766
|
+
}
|
|
767
|
+
const componentDefaults = volverComponentDefaults.value;
|
|
768
|
+
const simplifiedPropsDefinition = propsDefinition;
|
|
769
|
+
const simplifiedProps = props;
|
|
770
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
771
|
+
const propValue = simplifiedProps[key];
|
|
772
|
+
acc[key] = propValue;
|
|
773
|
+
if (key in componentDefaults) {
|
|
774
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
775
|
+
const typeArray = simplifiedPropsDefinition[key];
|
|
776
|
+
if (typeArray.length) {
|
|
777
|
+
const typeFunction = typeArray[0];
|
|
778
|
+
if (typeFunction === propValue) {
|
|
779
|
+
acc[key] = componentDefaults[key];
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
784
|
+
const typeFunction = simplifiedPropsDefinition[key];
|
|
785
|
+
if (typeFunction() === propValue) {
|
|
786
|
+
acc[key] = componentDefaults[key];
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
790
|
+
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
791
|
+
if (typeof defaultValue === "function") {
|
|
792
|
+
defaultValue = defaultValue();
|
|
793
|
+
}
|
|
794
|
+
if (typeof defaultValue === "object") {
|
|
795
|
+
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
796
|
+
acc[key] = componentDefaults[key];
|
|
797
|
+
}
|
|
798
|
+
} else if (defaultValue === propValue) {
|
|
799
|
+
acc[key] = componentDefaults[key];
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
return acc;
|
|
804
|
+
}, {});
|
|
805
|
+
});
|
|
806
|
+
}
|
|
753
807
|
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
754
808
|
function useDebouncedInput(modelValue, emit, ms = 0, {
|
|
755
809
|
getter = (value) => value,
|
|
@@ -875,6 +929,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
875
929
|
setup(__props, { emit }) {
|
|
876
930
|
const props = __props;
|
|
877
931
|
const slots = useSlots();
|
|
932
|
+
const propsDefaults = useDefaults(
|
|
933
|
+
"VvTextarea",
|
|
934
|
+
VvTextareaProps,
|
|
935
|
+
props
|
|
936
|
+
);
|
|
878
937
|
const textarea = ref();
|
|
879
938
|
const {
|
|
880
939
|
id,
|
|
@@ -929,7 +988,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
929
988
|
hasHintLabelOrSlot,
|
|
930
989
|
hasInvalidLabelOrSlot,
|
|
931
990
|
hintSlotScope
|
|
932
|
-
} = HintSlotFactory(
|
|
991
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
933
992
|
const bemCssClasses = useModifiers(
|
|
934
993
|
"vv-textarea",
|
|
935
994
|
modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.nanoid,e.core)}(this,(function(e,t,o,l){"use strict";function a(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}function n(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const i={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),u=(e=>(e.before="before",e.after="after",e))(u||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{});const s=Symbol.for("volver");function c(t,o,l){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((o=>{a[`${t}--${o}`]=e.unref(l.value[o])})),a}))}const v=e.defineComponent({name:"VvIcon",props:i,setup(o){const l=o,a=e.computed((()=>"string"==typeof l.rotate?parseFloat(l.rotate):l.rotate)),n=e.ref(!0),i=e.inject(s),{modifiers:r}=e.toRefs(l),u=c("vv-icon",r),d=e.computed((()=>l.provider||(null==i?void 0:i.iconsProvider))),v=e.computed((()=>{const e=l.name??"",o=`@${d.value}:${l.prefix}:${e}`;if(t.iconExists(o))return o;const a=null==i?void 0:i.iconsCollections.find((o=>{const l=`@${d.value}:${o.prefix}:${e}`;return t.iconExists(l)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function m(e){const o=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==o?void 0:o.innerHTML.trim())||"";o&&a&&t.addIcon(`@${d.value}:${l.prefix}:${l.name}`,{body:a,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&l.src&&!t.iconExists(`@${d.value}:${l.prefix}:${l.name}`)&&(n.value=!1,i.fetchIcon(l.src).then((e=>{e&&(m(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&m(l.svg),(o,l)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(a),color:o.color,onLoad:o.onLoad,icon:e.unref(v)}),null,16,["class"])):e.createCommentVNode("",!0)}}),m={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},f={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),b={readonly:Boolean},S={modifiers:[String,Array]},y={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},L={debounce:[Number,String]},$={icon:{type:[String,Object]},iconPosition:{type:String,default:u.before,validation:e=>Object.values(u).includes(e)}},x={tabindex:{type:[String,Number],default:0}},w={floating:Boolean},k={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...k,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...x,...h,...b,...m,...p,...y,...f,...S,...B,...L,...$,...w,...g,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button;const N={...V,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:"soft"},spellcheck:{type:[Boolean,String],default:"default"},resizable:Boolean};const P=["for"],O={class:"vv-textarea__wrapper"},_={key:0,class:"vv-textarea__input-before"},I={class:"vv-textarea__inner"},C=["id"],E={key:1,class:"vv-textarea__input-after"},z={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:N,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:i}){const d=t,s=e.useSlots(),m=e.ref(),{id:p,icon:f,iconPosition:h,label:g,modelValue:b,count:S,valid:y,invalid:B,loading:L,modifiers:$}=e.toRefs(d),x=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(p),w=e.computed((()=>`${x.value}-hint`)),k=e.computed((()=>d.floating&&a(d.placeholder)?" ":d.placeholder)),V=function(t,o,l=0,{getter:a=(e=>e),setter:n=(e=>e)}={}){let i;return"string"==typeof l&&(l=parseInt(l)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",n(e))}),l)}})}(b,i,d.debounce),{hasIcon:N,hasIconBefore:A,hasIconAfter:q}=function(t,o){const l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.before))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.after))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.right))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.top))),s=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:n,hasIconRight:i,hasIconTop:d,hasIconBottom:s,hasIconBefore:l,hasIconAfter:a}}(f,h),{focused:R}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(m,i),F=l.useElementVisibility(m);e.watch(F,(e=>{e&&d.autofocus&&(R.value=!0)}));const{formatted:T}=function(t,o){const l=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&l.value<(null==o?void 0:o.lowerLimit)?l.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&l.value<(null==o?void 0:o.upperLimit)?o.upperLimit-l.value:0)),n=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${l.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===a.value)return;return a}return l.value}));return{length:l,gap:a,formatted:n}}(V,{mode:d.count,upperLimit:Number(d.maxlength),lowerLimit:Number(d.minlength)}),j=e.computed((()=>!d.disabled&&!d.readonly)),D=e.computed((()=>j.value?d.tabindex:-1)),H=e.computed((()=>!a(b))),M=e.computed((()=>!0===d.invalid||!0!==d.valid&&void 0)),{HintSlot:J,hasHintLabelOrSlot:K,hasInvalidLabelOrSlot:U,hintSlotScope:G}=function(t,o){const l=e.computed((()=>n(t.invalidLabel))),a=e.computed((()=>n(t.validLabel))),i=e.computed((()=>t.loadingLabel)),r=e.computed((()=>t.hintLabel)),u=e.computed((()=>Boolean(t.loading&&(o.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(t.invalid&&(o.invalid||l.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(t.valid&&(o.valid||a.value)))),c=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(o.hint||r.value))),v=e.computed((()=>d.value||s.value||u.value||c.value)),m=e.computed((()=>({modelValue:t.modelValue,valid:t.valid,invalid:t.invalid,loading:t.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:l,validLabel:a,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,o,l,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==(o=(t=this.$slots).loading)?void 0:o.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(l=this.$slots).invalid)?void 0:a.call(l))??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:m,HintSlot:p}}(d,s),Q=c("vv-textarea",$,e.computed((()=>({valid:y.value,invalid:B.value,loading:L.value,disabled:d.disabled,readonly:d.readonly,"icon-before":A.value,"icon-after":q.value,floating:d.floating&&!a(d.label),dirty:H.value,focused:R.value,resizable:d.resizable})))),W=e.computed((()=>({name:d.name,placeholder:k.value,tabindex:D.value,disabled:d.disabled,readonly:d.readonly,required:d.required,autocomplete:d.autocomplete,minlength:d.minlength,maxlength:d.maxlength,cols:d.cols,rows:d.rows,wrap:d.wrap,spellcheck:d.spellcheck,"aria-invalid":M.value,"aria-describedby":K.value?w.value:void 0,"aria-errormessage":U.value?w.value:void 0}))),X=e.computed((()=>({valid:d.valid,invalid:d.invalid,modelValue:d.modelValue,hintLabel:d.hintLabel,maxlength:d.maxlength,minlength:d.minlength,clear:Y}))),Y=()=>{V.value=void 0};return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(Q))},[e.unref(g)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(x),class:"vv-textarea__label"},e.toDisplayString(e.unref(g)),9,P)):e.createCommentVNode("",!0),e.createElementVNode("div",O,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",_,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.createElementVNode("div",I,[e.unref(A)?(e.openBlock(),e.createBlock(v,e.mergeProps({key:0,class:"vv-textarea__icon"},e.unref(N)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(x),ref_key:"textarea",ref:m,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(V)?V.value=t:null)},e.unref(W),{onKeyup:o[1]||(o[1]=e=>i("keyup",e))}),null,16,C),[[e.vModelText,e.unref(V)]]),e.unref(q)?(e.openBlock(),e.createBlock(v,e.mergeProps({key:1,class:"vv-textarea__icon vv-textarea__icon-after"},e.unref(N)),null,16)):e.createCommentVNode("",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",E,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.unref(S)?(e.openBlock(),e.createElementBlock("span",z,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(X))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(T)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(J),{id:e.unref(w),class:"vv-textarea__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(G))))])),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("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.nanoid,e.core)}(this,(function(e,t,o,l){"use strict";function n(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}function a(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const i={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),u=(e=>(e.before="before",e.after="after",e))(u||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{});const s=Symbol.for("volver");function c(){return e.inject(s)}function v(t,o,l){return e.computed((()=>{const n={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((o=>{n[`${t}--${o}`]=e.unref(l.value[o])})),n}))}const f=e.defineComponent({name:"VvIcon",props:i,setup(o){const l=o,n=e.computed((()=>"string"==typeof l.rotate?parseFloat(l.rotate):l.rotate)),a=e.ref(!0),i=c(),{modifiers:r}=e.toRefs(l),u=v("vv-icon",r),d=e.computed((()=>l.provider||(null==i?void 0:i.iconsProvider))),s=e.computed((()=>{const e=l.name??"",o=`@${d.value}:${l.prefix}:${e}`;if(t.iconExists(o))return o;const n=null==i?void 0:i.iconsCollections.find((o=>{const l=`@${d.value}:${o.prefix}:${e}`;return t.iconExists(l)}));return n?`@${d.value}:${n.prefix}:${e}`:e}));function f(e){const o=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),n=(null==o?void 0:o.innerHTML.trim())||"";o&&n&&t.addIcon(`@${d.value}:${l.prefix}:${l.name}`,{body:n,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&l.src&&!t.iconExists(`@${d.value}:${l.prefix}:${l.name}`)&&(a.value=!1,i.fetchIcon(l.src).then((e=>{e&&(f(e),a.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&f(l.svg),(o,l)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(n),color:o.color,onLoad:o.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("",!0)}}),p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},h={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},S={modifiers:[String,Array]},B={hintLabel:{type:String,default:""}},L={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},x={debounce:[Number,String]},$={icon:{type:[String,Object]},iconPosition:{type:String,default:u.before,validation:e=>Object.values(u).includes(e)}},w={tabindex:{type:[String,Number],default:0}},k={floating:Boolean},V={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const N={...{...V,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...w,...g,...y,...p,...m,...B,...h,...S,...L,...x,...$,...k,...b,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button;const O={...N,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:"soft"},spellcheck:{type:[Boolean,String],default:"default"},resizable:Boolean};const P=["for"],_={class:"vv-textarea__wrapper"},I={key:0,class:"vv-textarea__input-before"},C={class:"vv-textarea__inner"},E=["id"],z={key:1,class:"vv-textarea__input-after"},A={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:O,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:i}){const d=t,s=e.useSlots(),p=function(t,o,l){const n=c(),a=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[t]))return n.defaults.value[t]}));return e.computed((()=>{if(void 0===a.value)return l;const e=a.value,t=o,n=l;return Object.keys(t).reduce(((o,l)=>{const a=n[l];if(o[l]=a,l in e){if(Array.isArray(t[l])){const n=t[l];n.length&&n[0]===a&&(o[l]=e[l])}if("function"==typeof t[l]&&(0,t[l])()===a&&(o[l]=e[l]),"object"==typeof t[l]){let n=t[l].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(a)&&(o[l]=e[l]):n===a&&(o[l]=e[l])}}return o}),{})}))}("VvTextarea",O,d),m=e.ref(),{id:h,icon:g,iconPosition:b,label:y,modelValue:S,count:B,valid:L,invalid:x,loading:$,modifiers:w}=e.toRefs(d),k=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(h),V=e.computed((()=>`${k.value}-hint`)),N=e.computed((()=>d.floating&&n(d.placeholder)?" ":d.placeholder)),j=function(t,o,l=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof l&&(l=parseInt(l)),e.computed({get:()=>n(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),l)}})}(S,i,d.debounce),{hasIcon:q,hasIconBefore:R,hasIconAfter:T}=function(t,o){const l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.before))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.after))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.right))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.top))),s=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===r.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:a,hasIconRight:i,hasIconTop:d,hasIconBottom:s,hasIconBefore:l,hasIconAfter:n}}(g,b),{focused:F}=function(t,o){const{focused:n}=l.useFocus(t);return e.watch(n,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:n}}(m,i),D=l.useElementVisibility(m);e.watch(D,(e=>{e&&d.autofocus&&(F.value=!0)}));const{formatted:H}=function(t,o){const l=e.computed((()=>(e.unref(t)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&l.value<(null==o?void 0:o.lowerLimit)?l.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&l.value<(null==o?void 0:o.upperLimit)?o.upperLimit-l.value:0)),a=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${l.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return l.value}));return{length:l,gap:n,formatted:a}}(j,{mode:d.count,upperLimit:Number(d.maxlength),lowerLimit:Number(d.minlength)}),M=e.computed((()=>!d.disabled&&!d.readonly)),J=e.computed((()=>M.value?d.tabindex:-1)),K=e.computed((()=>!n(S))),U=e.computed((()=>!0===d.invalid||!0!==d.valid&&void 0)),{HintSlot:G,hasHintLabelOrSlot:Q,hasInvalidLabelOrSlot:W,hintSlotScope:X}=function(t,o){const l=e.unref(t),n=e.computed((()=>a(l.invalidLabel))),i=e.computed((()=>a(l.validLabel))),r=e.computed((()=>l.loadingLabel)),u=e.computed((()=>l.hintLabel)),d=e.computed((()=>Boolean(l.loading&&(o.loading||r.value)))),s=e.computed((()=>!d.value&&Boolean(l.invalid&&(o.invalid||n.value)))),c=e.computed((()=>!d.value&&!s.value&&Boolean(l.valid&&(o.valid||i.value)))),v=e.computed((()=>!d.value&&!s.value&&!c.value&&Boolean(o.hint||u.value))),f=e.computed((()=>s.value||c.value||d.value||v.value)),p=e.computed((()=>({modelValue:l.modelValue,valid:l.valid,invalid:l.invalid,loading:l.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:n,validLabel:i,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:d,hasHintLabelOrSlot:v}),render(){var t,o,l,n,a,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==(o=(t=this.$slots).loading)?void 0:o.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(l=this.$slots).invalid)?void 0:n.call(l))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(a=this.$slots).valid)?void 0:i.call(a))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:v,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:d,hintSlotScope:p,HintSlot:m}}(p,s),Y=v("vv-textarea",w,e.computed((()=>({valid:L.value,invalid:x.value,loading:$.value,disabled:d.disabled,readonly:d.readonly,"icon-before":R.value,"icon-after":T.value,floating:d.floating&&!n(d.label),dirty:K.value,focused:F.value,resizable:d.resizable})))),Z=e.computed((()=>({name:d.name,placeholder:N.value,tabindex:J.value,disabled:d.disabled,readonly:d.readonly,required:d.required,autocomplete:d.autocomplete,minlength:d.minlength,maxlength:d.maxlength,cols:d.cols,rows:d.rows,wrap:d.wrap,spellcheck:d.spellcheck,"aria-invalid":U.value,"aria-describedby":Q.value?V.value:void 0,"aria-errormessage":W.value?V.value:void 0}))),ee=e.computed((()=>({valid:d.valid,invalid:d.invalid,modelValue:d.modelValue,hintLabel:d.hintLabel,maxlength:d.maxlength,minlength:d.minlength,clear:te}))),te=()=>{j.value=void 0};return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(Y))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(k),class:"vv-textarea__label"},e.toDisplayString(e.unref(y)),9,P)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(ee))))])):e.createCommentVNode("",!0),e.createElementVNode("div",C,[e.unref(R)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:0,class:"vv-textarea__icon"},e.unref(q)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(k),ref_key:"textarea",ref:m,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(j)?j.value=t:null)},e.unref(Z),{onKeyup:o[1]||(o[1]=e=>i("keyup",e))}),null,16,E),[[e.vModelText,e.unref(j)]]),e.unref(T)?(e.openBlock(),e.createBlock(f,e.mergeProps({key:1,class:"vv-textarea__icon vv-textarea__icon-after"},e.unref(q)),null,16)):e.createCommentVNode("",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(ee))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",A,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(ee))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(H)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(G),{id:e.unref(V),class:"vv-textarea__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
@@ -187,25 +187,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
187
187
|
clear: () => void;
|
|
188
188
|
}): any;
|
|
189
189
|
hint?(_: {
|
|
190
|
-
modelValue:
|
|
190
|
+
modelValue: unknown;
|
|
191
191
|
valid: boolean;
|
|
192
192
|
invalid: boolean;
|
|
193
193
|
loading: boolean;
|
|
194
194
|
}): any;
|
|
195
195
|
loading?(_: {
|
|
196
|
-
modelValue:
|
|
196
|
+
modelValue: unknown;
|
|
197
197
|
valid: boolean;
|
|
198
198
|
invalid: boolean;
|
|
199
199
|
loading: boolean;
|
|
200
200
|
}): any;
|
|
201
201
|
valid?(_: {
|
|
202
|
-
modelValue:
|
|
202
|
+
modelValue: unknown;
|
|
203
203
|
valid: boolean;
|
|
204
204
|
invalid: boolean;
|
|
205
205
|
loading: boolean;
|
|
206
206
|
}): any;
|
|
207
207
|
invalid?(_: {
|
|
208
|
-
modelValue:
|
|
208
|
+
modelValue: unknown;
|
|
209
209
|
valid: boolean;
|
|
210
210
|
invalid: boolean;
|
|
211
211
|
loading: boolean;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, Slots } from 'vue';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
2
3
|
export type HintSlotProps = Readonly<ExtractPropTypes<{
|
|
3
4
|
hintLabel: {
|
|
4
5
|
type: StringConstructor;
|
|
5
6
|
default: '';
|
|
6
7
|
required: true;
|
|
7
8
|
};
|
|
8
|
-
modelValue:
|
|
9
|
+
modelValue: unknown;
|
|
9
10
|
valid: BooleanConstructor;
|
|
10
11
|
validLabel: (StringConstructor | ArrayConstructor)[];
|
|
11
12
|
invalid: BooleanConstructor;
|
|
@@ -19,13 +20,13 @@ export type HintSlotProps = Readonly<ExtractPropTypes<{
|
|
|
19
20
|
* @param {Slots} parentSlots vue slots
|
|
20
21
|
* @returns {Component} vue component
|
|
21
22
|
*/
|
|
22
|
-
export declare function HintSlotFactory(
|
|
23
|
+
export declare function HintSlotFactory(propsOrRef: HintSlotProps | Ref<HintSlotProps>, slots: Slots): {
|
|
23
24
|
hasInvalidLabelOrSlot: globalThis.ComputedRef<boolean>;
|
|
24
25
|
hasHintLabelOrSlot: globalThis.ComputedRef<boolean>;
|
|
25
26
|
hasValidLabelOrSlot: globalThis.ComputedRef<boolean>;
|
|
26
27
|
hasLoadingLabelOrSlot: globalThis.ComputedRef<boolean>;
|
|
27
28
|
hintSlotScope: globalThis.ComputedRef<{
|
|
28
|
-
modelValue:
|
|
29
|
+
modelValue: unknown;
|
|
29
30
|
valid: boolean;
|
|
30
31
|
invalid: boolean;
|
|
31
32
|
loading: boolean;
|
|
@@ -1333,7 +1333,7 @@ const VvAlertProps = {
|
|
|
1333
1333
|
*/
|
|
1334
1334
|
title: {
|
|
1335
1335
|
type: String,
|
|
1336
|
-
default:
|
|
1336
|
+
default: void 0
|
|
1337
1337
|
},
|
|
1338
1338
|
/**
|
|
1339
1339
|
* The alert content
|
|
@@ -1342,7 +1342,7 @@ const VvAlertProps = {
|
|
|
1342
1342
|
*/
|
|
1343
1343
|
content: {
|
|
1344
1344
|
type: String,
|
|
1345
|
-
default:
|
|
1345
|
+
default: void 0
|
|
1346
1346
|
},
|
|
1347
1347
|
/**
|
|
1348
1348
|
* The alert footer
|
|
@@ -1351,7 +1351,7 @@ const VvAlertProps = {
|
|
|
1351
1351
|
*/
|
|
1352
1352
|
footer: {
|
|
1353
1353
|
type: String,
|
|
1354
|
-
default:
|
|
1354
|
+
default: void 0
|
|
1355
1355
|
},
|
|
1356
1356
|
/**
|
|
1357
1357
|
* The alert role
|
|
@@ -1471,14 +1471,15 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1471
1471
|
unref(hasIcon) ? (openBlock(), createBlock(_sfc_main$n, mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-alert__icon" }), null, 16)) : createCommentVNode("", true),
|
|
1472
1472
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
1473
1473
|
renderSlot(_ctx.$slots, "title::before"),
|
|
1474
|
-
|
|
1474
|
+
_ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("strong", {
|
|
1475
|
+
key: 0,
|
|
1475
1476
|
id: unref(hasTitleId),
|
|
1476
1477
|
class: "vv-alert__title"
|
|
1477
1478
|
}, [
|
|
1478
1479
|
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
1479
1480
|
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
1480
1481
|
])
|
|
1481
|
-
], 8, _hoisted_2$c),
|
|
1482
|
+
], 8, _hoisted_2$c)) : createCommentVNode("", true),
|
|
1482
1483
|
renderSlot(_ctx.$slots, "title::after")
|
|
1483
1484
|
]),
|
|
1484
1485
|
renderSlot(_ctx.$slots, "close", normalizeProps(guardReactiveProps({ close: unref(close) })), () => [
|
|
@@ -2013,7 +2014,8 @@ function joinLines(items) {
|
|
|
2013
2014
|
}
|
|
2014
2015
|
return items;
|
|
2015
2016
|
}
|
|
2016
|
-
function HintSlotFactory(
|
|
2017
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
2018
|
+
const props = unref(propsOrRef);
|
|
2017
2019
|
const invalidLabel = computed(() => joinLines(props.invalidLabel));
|
|
2018
2020
|
const validLabel = computed(() => joinLines(props.validLabel));
|
|
2019
2021
|
const loadingLabel = computed(() => props.loadingLabel);
|
|
@@ -2117,6 +2119,59 @@ function HintSlotFactory(props, slots) {
|
|
|
2117
2119
|
HintSlot
|
|
2118
2120
|
};
|
|
2119
2121
|
}
|
|
2122
|
+
function useDefaults(componentName, propsDefinition, props) {
|
|
2123
|
+
const volver = useVolver();
|
|
2124
|
+
const volverComponentDefaults = computed(() => {
|
|
2125
|
+
var _a;
|
|
2126
|
+
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
2127
|
+
return void 0;
|
|
2128
|
+
}
|
|
2129
|
+
return volver.defaults.value[componentName];
|
|
2130
|
+
});
|
|
2131
|
+
return computed(() => {
|
|
2132
|
+
if (volverComponentDefaults.value === void 0) {
|
|
2133
|
+
return props;
|
|
2134
|
+
}
|
|
2135
|
+
const componentDefaults = volverComponentDefaults.value;
|
|
2136
|
+
const simplifiedPropsDefinition = propsDefinition;
|
|
2137
|
+
const simplifiedProps = props;
|
|
2138
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
2139
|
+
const propValue = simplifiedProps[key];
|
|
2140
|
+
acc[key] = propValue;
|
|
2141
|
+
if (key in componentDefaults) {
|
|
2142
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
2143
|
+
const typeArray = simplifiedPropsDefinition[key];
|
|
2144
|
+
if (typeArray.length) {
|
|
2145
|
+
const typeFunction = typeArray[0];
|
|
2146
|
+
if (typeFunction === propValue) {
|
|
2147
|
+
acc[key] = componentDefaults[key];
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
2152
|
+
const typeFunction = simplifiedPropsDefinition[key];
|
|
2153
|
+
if (typeFunction() === propValue) {
|
|
2154
|
+
acc[key] = componentDefaults[key];
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
2158
|
+
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
2159
|
+
if (typeof defaultValue === "function") {
|
|
2160
|
+
defaultValue = defaultValue();
|
|
2161
|
+
}
|
|
2162
|
+
if (typeof defaultValue === "object") {
|
|
2163
|
+
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
2164
|
+
acc[key] = componentDefaults[key];
|
|
2165
|
+
}
|
|
2166
|
+
} else if (defaultValue === propValue) {
|
|
2167
|
+
acc[key] = componentDefaults[key];
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
return acc;
|
|
2172
|
+
}, {});
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2120
2175
|
const _hoisted_1$d = ["for"];
|
|
2121
2176
|
const _hoisted_2$8 = ["id", "name", "disabled", "value", "tabindex", "aria-invalid", "aria-describedby", "aria-errormessage"];
|
|
2122
2177
|
const __default__$d = {
|
|
@@ -2129,6 +2184,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
2129
2184
|
setup(__props, { emit }) {
|
|
2130
2185
|
const props = __props;
|
|
2131
2186
|
const slots = useSlots();
|
|
2187
|
+
const propsDefaults = useDefaults(
|
|
2188
|
+
"VvCheckbox",
|
|
2189
|
+
VvCheckboxProps,
|
|
2190
|
+
props
|
|
2191
|
+
);
|
|
2132
2192
|
const {
|
|
2133
2193
|
id,
|
|
2134
2194
|
disabled,
|
|
@@ -2241,7 +2301,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
2241
2301
|
hasHintLabelOrSlot,
|
|
2242
2302
|
hasInvalidLabelOrSlot,
|
|
2243
2303
|
hintSlotScope
|
|
2244
|
-
} = HintSlotFactory(
|
|
2304
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
2245
2305
|
return (_ctx, _cache) => {
|
|
2246
2306
|
return openBlock(), createElementBlock("label", {
|
|
2247
2307
|
class: normalizeClass(unref(bemCssClasses)),
|
|
@@ -2350,6 +2410,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2350
2410
|
setup(__props, { emit }) {
|
|
2351
2411
|
const props = __props;
|
|
2352
2412
|
const slots = useSlots();
|
|
2413
|
+
const propsDefaults = useDefaults(
|
|
2414
|
+
"VvCheckboxGroup",
|
|
2415
|
+
VvCheckboxGroupProps,
|
|
2416
|
+
props
|
|
2417
|
+
);
|
|
2353
2418
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
2354
2419
|
const { disabled, readonly, vertical, valid, invalid, modifiers } = toRefs(props);
|
|
2355
2420
|
useProvideGroupState({
|
|
@@ -2380,7 +2445,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2380
2445
|
value: getOptionValue(option)
|
|
2381
2446
|
};
|
|
2382
2447
|
};
|
|
2383
|
-
const { HintSlot, hintSlotScope } = HintSlotFactory(
|
|
2448
|
+
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
2384
2449
|
return (_ctx, _cache) => {
|
|
2385
2450
|
return openBlock(), createElementBlock("fieldset", {
|
|
2386
2451
|
class: normalizeClass(unref(bemCssClasses))
|
|
@@ -3282,13 +3347,18 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3282
3347
|
setup(__props, { emit }) {
|
|
3283
3348
|
const props = __props;
|
|
3284
3349
|
const slots = useSlots();
|
|
3350
|
+
const propsDefaults = useDefaults(
|
|
3351
|
+
"VvSelect",
|
|
3352
|
+
VvSelectProps,
|
|
3353
|
+
props
|
|
3354
|
+
);
|
|
3285
3355
|
const select = ref();
|
|
3286
3356
|
const {
|
|
3287
3357
|
HintSlot,
|
|
3288
3358
|
hasHintLabelOrSlot,
|
|
3289
3359
|
hasInvalidLabelOrSlot,
|
|
3290
3360
|
hintSlotScope
|
|
3291
|
-
} = HintSlotFactory(
|
|
3361
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
3292
3362
|
const {
|
|
3293
3363
|
id,
|
|
3294
3364
|
modifiers,
|
|
@@ -3486,59 +3556,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3486
3556
|
};
|
|
3487
3557
|
}
|
|
3488
3558
|
});
|
|
3489
|
-
function useDefaults(componentName, propsDefinition, props) {
|
|
3490
|
-
const volver = useVolver();
|
|
3491
|
-
const volverComponentDefaults = computed(() => {
|
|
3492
|
-
var _a;
|
|
3493
|
-
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
3494
|
-
return void 0;
|
|
3495
|
-
}
|
|
3496
|
-
return volver.defaults.value[componentName];
|
|
3497
|
-
});
|
|
3498
|
-
return computed(() => {
|
|
3499
|
-
if (volverComponentDefaults.value === void 0) {
|
|
3500
|
-
return props;
|
|
3501
|
-
}
|
|
3502
|
-
const componentDefaults = volverComponentDefaults.value;
|
|
3503
|
-
const simplifiedPropsDefinition = propsDefinition;
|
|
3504
|
-
const simplifiedProps = props;
|
|
3505
|
-
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
3506
|
-
const propValue = simplifiedProps[key];
|
|
3507
|
-
acc[key] = propValue;
|
|
3508
|
-
if (key in componentDefaults) {
|
|
3509
|
-
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
3510
|
-
const typeArray = simplifiedPropsDefinition[key];
|
|
3511
|
-
if (typeArray.length) {
|
|
3512
|
-
const typeFunction = typeArray[0];
|
|
3513
|
-
if (typeFunction === propValue) {
|
|
3514
|
-
acc[key] = componentDefaults[key];
|
|
3515
|
-
}
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
3519
|
-
const typeFunction = simplifiedPropsDefinition[key];
|
|
3520
|
-
if (typeFunction() === propValue) {
|
|
3521
|
-
acc[key] = componentDefaults[key];
|
|
3522
|
-
}
|
|
3523
|
-
}
|
|
3524
|
-
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
3525
|
-
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
3526
|
-
if (typeof defaultValue === "function") {
|
|
3527
|
-
defaultValue = defaultValue();
|
|
3528
|
-
}
|
|
3529
|
-
if (typeof defaultValue === "object") {
|
|
3530
|
-
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
3531
|
-
acc[key] = componentDefaults[key];
|
|
3532
|
-
}
|
|
3533
|
-
} else if (defaultValue === propValue) {
|
|
3534
|
-
acc[key] = componentDefaults[key];
|
|
3535
|
-
}
|
|
3536
|
-
}
|
|
3537
|
-
}
|
|
3538
|
-
return acc;
|
|
3539
|
-
}, {});
|
|
3540
|
-
});
|
|
3541
|
-
}
|
|
3542
3559
|
const _hoisted_1$7 = ["id"];
|
|
3543
3560
|
const _hoisted_2$5 = ["id", "for"];
|
|
3544
3561
|
const _hoisted_3$3 = ["id", "aria-controls", "placeholder"];
|
|
@@ -3589,7 +3606,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3589
3606
|
hasHintLabelOrSlot,
|
|
3590
3607
|
hasInvalidLabelOrSlot,
|
|
3591
3608
|
hintSlotScope
|
|
3592
|
-
} = HintSlotFactory(
|
|
3609
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
3593
3610
|
const inputEl = ref(null);
|
|
3594
3611
|
const inputSearchEl = ref(null);
|
|
3595
3612
|
const wrapperEl = ref(null);
|
|
@@ -4756,6 +4773,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4756
4773
|
setup(__props, { expose: __expose, emit }) {
|
|
4757
4774
|
const props = __props;
|
|
4758
4775
|
const slots = useSlots();
|
|
4776
|
+
const propsDefaults = useDefaults(
|
|
4777
|
+
"VvInputText",
|
|
4778
|
+
VvInputTextProps,
|
|
4779
|
+
props
|
|
4780
|
+
);
|
|
4759
4781
|
const inputEl = ref();
|
|
4760
4782
|
const innerEl = ref();
|
|
4761
4783
|
__expose({ $inner: innerEl });
|
|
@@ -4942,7 +4964,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4942
4964
|
hasHintLabelOrSlot,
|
|
4943
4965
|
hasInvalidLabelOrSlot,
|
|
4944
4966
|
hintSlotScope
|
|
4945
|
-
} = HintSlotFactory(
|
|
4967
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
4946
4968
|
const PasswordInputActions = VvInputTextActionsFactory(
|
|
4947
4969
|
INPUT_TYPES.PASSWORD,
|
|
4948
4970
|
props
|
|
@@ -5267,6 +5289,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
5267
5289
|
setup(__props, { emit }) {
|
|
5268
5290
|
const props = __props;
|
|
5269
5291
|
const slots = useSlots();
|
|
5292
|
+
const propsDefaults = useDefaults(
|
|
5293
|
+
"VvRadio",
|
|
5294
|
+
VvRadioProps,
|
|
5295
|
+
props
|
|
5296
|
+
);
|
|
5270
5297
|
const { id, disabled, readonly, modelValue, valid, invalid } = useGroupProps(props, emit);
|
|
5271
5298
|
const hasId = useUniqueId(id);
|
|
5272
5299
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
@@ -5317,7 +5344,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
5317
5344
|
hasHintLabelOrSlot,
|
|
5318
5345
|
hasInvalidLabelOrSlot,
|
|
5319
5346
|
hintSlotScope
|
|
5320
|
-
} = HintSlotFactory(
|
|
5347
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
5321
5348
|
return (_ctx, _cache) => {
|
|
5322
5349
|
return openBlock(), createElementBlock("label", {
|
|
5323
5350
|
class: normalizeClass(unref(bemCssClasses)),
|
|
@@ -5394,6 +5421,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5394
5421
|
setup(__props, { emit }) {
|
|
5395
5422
|
const props = __props;
|
|
5396
5423
|
const slots = useSlots();
|
|
5424
|
+
const propsDefaults = useDefaults(
|
|
5425
|
+
"VvRadioGroup",
|
|
5426
|
+
VvRadioGroupProps,
|
|
5427
|
+
props
|
|
5428
|
+
);
|
|
5397
5429
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
5398
5430
|
const { disabled, readonly, vertical, valid, invalid, modifiers } = toRefs(props);
|
|
5399
5431
|
useProvideGroupState({
|
|
@@ -5424,7 +5456,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5424
5456
|
value: getOptionValue(option)
|
|
5425
5457
|
};
|
|
5426
5458
|
};
|
|
5427
|
-
const { HintSlot, hintSlotScope } = HintSlotFactory(
|
|
5459
|
+
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
5428
5460
|
return (_ctx, _cache) => {
|
|
5429
5461
|
return openBlock(), createElementBlock("fieldset", {
|
|
5430
5462
|
class: normalizeClass(unref(bemCssClasses))
|
|
@@ -5595,6 +5627,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5595
5627
|
setup(__props, { emit }) {
|
|
5596
5628
|
const props = __props;
|
|
5597
5629
|
const slots = useSlots();
|
|
5630
|
+
const propsDefaults = useDefaults(
|
|
5631
|
+
"VvTextarea",
|
|
5632
|
+
VvTextareaProps,
|
|
5633
|
+
props
|
|
5634
|
+
);
|
|
5598
5635
|
const textarea = ref();
|
|
5599
5636
|
const {
|
|
5600
5637
|
id,
|
|
@@ -5649,7 +5686,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5649
5686
|
hasHintLabelOrSlot,
|
|
5650
5687
|
hasInvalidLabelOrSlot,
|
|
5651
5688
|
hintSlotScope
|
|
5652
|
-
} = HintSlotFactory(
|
|
5689
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
5653
5690
|
const bemCssClasses = useModifiers(
|
|
5654
5691
|
"vv-textarea",
|
|
5655
5692
|
modifiers,
|