@volverjs/ui-vue 0.0.10-beta.6 → 0.0.10-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/bin/icons.cjs +1 -1
- package/bin/icons.js +22 -15
- package/dist/Volver.d.ts +0 -1
- package/dist/components/VvAccordion/VvAccordion.es.js +10 -2
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -4
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +52 -25
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +4 -4
- package/dist/components/VvAction/VvAction.es.js +6 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +4 -4
- package/dist/components/VvAlert/VvAlert.es.js +73 -43
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +4 -4
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +113 -64
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +4 -4
- package/dist/components/VvAvatar/VvAvatar.es.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +56 -26
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +18 -8
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +61 -38
- package/dist/components/VvButton/VvButton.es.js +45 -17
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +15 -9
- package/dist/components/VvButton/index.d.ts +2 -2
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +12 -6
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +4 -4
- package/dist/components/VvCard/VvCard.es.js +26 -16
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +9 -2
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +78 -44
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +595 -372
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +7 -7
- package/dist/components/VvCombobox/index.d.ts +11 -6
- package/dist/components/VvDialog/VvDialog.es.js +44 -27
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
- package/dist/components/VvDropdown/VvDropdown.es.js +64 -44
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +18 -4
- package/dist/components/VvDropdown/index.d.ts +1 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +26 -9
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +13 -7
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +7 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +19 -8
- package/dist/components/VvIcon/VvIcon.es.js +1 -1
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +126 -97
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvNav/VvNav.es.js +50 -26
- package/dist/components/VvNav/VvNav.vue.d.ts +7 -7
- package/dist/components/VvNav/index.d.ts +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +19 -7
- package/dist/components/VvProgress/VvProgress.es.js +12 -6
- package/dist/components/VvRadio/VvRadio.es.js +9 -2
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +78 -44
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
- package/dist/components/VvRadioGroup/index.d.ts +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +133 -94
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +4 -4
- package/dist/components/VvSelect/index.d.ts +1 -1
- package/dist/components/VvTab/VvTab.es.js +98 -44
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +4 -4
- package/dist/components/VvTextarea/VvTextarea.es.js +99 -74
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +19 -9
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
- package/dist/components/VvTooltip/index.d.ts +1 -1
- package/dist/components/index.es.js +1363 -840
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +39 -23
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +37 -18
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/props/index.d.ts +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +46 -11
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +308 -59
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/Tab/Tab.settings.d.ts +2 -15
- package/dist/types/generic.d.ts +1 -1
- package/package.json +35 -35
- package/src/Volver.ts +0 -1
- 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/VvCombobox/VvCombobox.vue +7 -3
- package/src/components/VvCombobox/index.ts +4 -0
- package/src/components/VvInputText/VvInputText.vue +2 -2
- package/src/directives/index.ts +1 -4
- package/src/directives/v-tooltip.ts +19 -10
- package/src/index.ts +3 -1
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Tab/Tab.settings.ts +2 -2
- package/src/types/generic.ts +2 -1
|
@@ -269,7 +269,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
269
269
|
color: _ctx.color,
|
|
270
270
|
onLoad: _ctx.onLoad,
|
|
271
271
|
icon: unref(icon)
|
|
272
|
-
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
272
|
+
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
275
|
});
|
|
@@ -604,10 +604,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
604
604
|
}), {
|
|
605
605
|
default: withCtx(() => [
|
|
606
606
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
607
|
-
createTextVNode(
|
|
607
|
+
createTextVNode(
|
|
608
|
+
toDisplayString(_ctx.label),
|
|
609
|
+
1
|
|
610
|
+
/* TEXT */
|
|
611
|
+
)
|
|
608
612
|
])
|
|
609
613
|
]),
|
|
610
614
|
_: 3
|
|
615
|
+
/* FORWARDED */
|
|
611
616
|
}, 16, ["class"]);
|
|
612
617
|
};
|
|
613
618
|
}
|
|
@@ -945,24 +950,47 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
945
950
|
key: 0,
|
|
946
951
|
class: "vv-button__loading-icon",
|
|
947
952
|
name: _ctx.loadingIcon
|
|
948
|
-
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
949
|
-
_ctx.loadingLabel ? (openBlock(), createElementBlock(
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
953
|
+
}, null, 8, ["name"])) : createCommentVNode("v-if", true),
|
|
954
|
+
_ctx.loadingLabel ? (openBlock(), createElementBlock(
|
|
955
|
+
"span",
|
|
956
|
+
_hoisted_1,
|
|
957
|
+
toDisplayString(_ctx.loadingLabel),
|
|
958
|
+
1
|
|
959
|
+
/* TEXT */
|
|
960
|
+
)) : createCommentVNode("v-if", true)
|
|
961
|
+
]) : (openBlock(), createElementBlock(
|
|
962
|
+
Fragment,
|
|
963
|
+
{ key: 1 },
|
|
964
|
+
[
|
|
965
|
+
renderSlot(_ctx.$slots, "before"),
|
|
966
|
+
unref(icon) ? (openBlock(), createBlock(
|
|
967
|
+
_sfc_main$2,
|
|
968
|
+
mergeProps({
|
|
969
|
+
key: 0,
|
|
970
|
+
class: "vv-button__icon"
|
|
971
|
+
}, unref(hasIconProps)),
|
|
972
|
+
null,
|
|
973
|
+
16
|
|
974
|
+
/* FULL_PROPS */
|
|
975
|
+
)) : createCommentVNode("v-if", true),
|
|
976
|
+
unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
|
977
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
978
|
+
createTextVNode(
|
|
979
|
+
toDisplayString(unref(label)),
|
|
980
|
+
1
|
|
981
|
+
/* TEXT */
|
|
982
|
+
)
|
|
983
|
+
])
|
|
984
|
+
])) : createCommentVNode("v-if", true),
|
|
985
|
+
renderSlot(_ctx.$slots, "after")
|
|
986
|
+
],
|
|
987
|
+
64
|
|
988
|
+
/* STABLE_FRAGMENT */
|
|
989
|
+
))
|
|
963
990
|
])
|
|
964
991
|
]),
|
|
965
992
|
_: 3
|
|
993
|
+
/* FORWARDED */
|
|
966
994
|
}, 16, ["id", "class"]);
|
|
967
995
|
};
|
|
968
996
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButton=t(e.vue,e.vue$1,e.uid)}(this,(function(e,t,o){"use strict";const n={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||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),a=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(a||{}),u=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(u||{});const s=Symbol.for("volver"),c=Symbol.for("buttonGroup"),d=Symbol.for("dropdownTrigger"),f=Symbol.for("dropdownAction");function v(){return e.inject(s)}function p(t,o,n){return e.computed((()=>{const r={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{r[`${t}--${o}`]=e.unref(n.value[o])})),r}))}const m=e.defineComponent({name:"VvIcon",props:n,setup(o){const n=o,r=e.computed((()=>"string"==typeof n.rotate?parseFloat(n.rotate):n.rotate)),l=e.ref(!0),i=v(),{modifiers:a}=e.toRefs(n),u=p("vv-icon",a),s=e.computed((()=>n.provider||(null==i?void 0:i.iconsProvider))),c=e.computed((()=>{const e=n.name??"",o=`@${s.value}:${n.prefix}:${e}`;if(t.iconExists(o))return o;const r=null==i?void 0:i.iconsCollections.find((o=>{const n=`@${s.value}:${o.prefix}:${e}`;return t.iconExists(n)}));return r?`@${s.value}:${r.prefix}:${e}`:e}));function d(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),r=(null==o?void 0:o.innerHTML.trim())||"";o&&r&&t.addIcon(`@${s.value}:${n.prefix}:${n.name}`,{body:r,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&n.src&&!t.iconExists(`@${s.value}:${n.prefix}:${n.name}`)&&(l.value=!1,i.fetchIcon(n.src).then((e=>{e&&(d(e),l.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),n.svg&&d(n.svg),(o,n)=>e.unref(l)?(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(r),color:o.color,onLoad:o.onLoad,icon:e.unref(c)}),null,16,["class"])):e.createCommentVNode("",!0)}}),g={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(u).includes(e)},rel:{type:String,default:"noopener noreferrer"}},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},y={disabled:Boolean},h={active:Boolean},S={current:Boolean},k={pressed:Boolean},B={label:[String,Number]},$={modifiers:[String,Array]};l.before;const x={unselectable:{type:Boolean,default:!0}},w={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const A={...y,...B,...k,...h,...S,...g,type:{type:String,default:i.button,validator:e=>Object.values(i).includes(e)},ariaLabel:{type:String,default:void 0}},L=A;const j=e.defineComponent({name:"VvAction",props:L,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const r=t,l=v(),i=e.ref(null);o({$el:i});const{reference:u,bus:s,aria:c,expanded:p}=e.inject(d,{});e.watch((()=>i.value),(e=>{u&&(u.value=e)}));const m=e.computed((()=>r.pressed||(null==p?void 0:p.value))),{role:g}=e.inject(f,{}),b=e.computed((()=>{switch(!0){case r.disabled:return a.button;case void 0!==r.to:return(null==l?void 0:l.nuxt)?a.nuxtLink:a.routerLink;case void 0!==r.href:return a.a;default:return a.button}})),y=e.computed((()=>{const e={...null==c?void 0:c.value,ariaPressed:!!m.value||void 0,ariaLabel:r.ariaLabel,role:null==g?void 0:g.value};switch(b.value){case a.a:return{...e,href:r.href,target:r.target,rel:r.rel};case a.routerLink:case a.nuxtLink:return{...e,to:r.to,target:r.target};default:return{...e,type:r.type,disabled:r.disabled}}})),h=e=>{r.disabled?e.preventDefault():(null==s||s.emit("click",e),n("click",e))},S=e=>{null==s||s.emit("mouseover",e),n("mouseover",e)},k=e=>{null==s||s.emit("mouseleave",e),n("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(y),{ref_key:"element",ref:i,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled,current:t.current},onClickPassive:h,onMouseoverPassive:S,onMouseleavePassive:k}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function V(e,t,o){return o?O(e,o)===O(t,o):_(e,t)}function _(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const o=Array.isArray(e),n=Array.isArray(t);let r,l,i;if(o&&n){if(l=e.length,l!=t.length)return!1;for(r=l;0!=r--;)if(!_(e[r],t[r]))return!1;return!0}if(o!=n)return!1;const a=e instanceof Date,u=t instanceof Date;if(a!=u)return!1;if(a&&u)return e.getTime()==t.getTime();const s=e instanceof RegExp,c=t instanceof RegExp;if(s!=c)return!1;if(s&&c)return e.toString()==t.toString();const d=Object.keys(e);if(l=d.length,l!==Object.keys(t).length)return!1;for(r=l;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,d[r]))return!1;for(r=l;0!=r--;)if(i=d[r],!_(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function O(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const o=t.split(".");let n=e;for(let t=0,r=o.length;t<r;++t){if(null==e)return null;n=n[o[t]]}return n}}return null}function P(e,t){if(null!=e&&t&&t.length)for(const o of t)if(V(e,o))return!0;return!1}function N(t){const o=e.inject(t,void 0),n=e.computed((()=>{return t=o,!(null==(n=e.unref(t))||""===n||Array.isArray(n)&&0===n.length||!(n instanceof Date)&&"object"==typeof n&&0===Object.keys(n).length);var t,n}));return{group:o,isInGroup:n,getGroupOrLocalRef:function(t,n,r){if(null==o?void 0:o.value){const n=e.unref(o.value)[t];return e.computed({get:()=>null==n?void 0:n.value,set(e){n.value=e}})}const l=e.toRef(n,t);return e.computed({get:()=>l.value,set(e){r&&r(`update:${t}`,e)}})}}}const C={...A,...w,...$,...x,...b,icon:[String,Object],iconPosition:{type:String,default:r.left,validator:e=>Object.values(r).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};const E={key:1,class:"vv-button__label"},D={key:1,class:"vv-button__label"};return e.defineComponent({name:"VvButton",props:C,emits:["update:modelValue"],setup(t,{expose:n,emit:l}){const i=t,a=e.useAttrs(),u=e.useSlots(),{id:s,modifiers:d,iconPosition:f,icon:v,label:g,modelValue:b,disabled:y,toggle:h,unselectable:S}=function(t,o){const{group:n,isInGroup:r,getGroupOrLocalRef:l}=N(c),{id:i,iconPosition:a,icon:u,label:s,pressed:d}=e.toRefs(t),f=l("modelValue",t,o),v=l("toggle",t),p=l("unselectable",t),m=e.computed((()=>(null==n?void 0:n.value.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,o=null==n?void 0:n.value.modifiers.value;const r=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>r.add(e)))),o&&(Array.isArray(o)||(o=o.split(" ")),o.forEach((e=>r.add(e)))),Array.from(r)})),b=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==n?void 0:n.value)?void 0:e.disabled.value))}));return{group:n,isInGroup:r,modelValue:f,toggle:v,unselectable:p,multiple:m,modifiers:g,disabled:b,id:i,pressed:d,iconPosition:a,icon:u,label:s}}(i,l),k=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))))(s),B=e.computed((()=>(null==a?void 0:a.name)||k.value)),$=e.ref(null);n({$el:e.computed((()=>{var e;return null==(e=$.value)?void 0:e.$el}))});const x=e.computed((()=>h.value?Array.isArray(b.value)?P(B.value,b.value):V(B.value,b.value):i.pressed)),w=p("vv-button",d,e.computed((()=>({reverse:[r.right,r.bottom].includes(f.value),column:[r.top,r.bottom].includes(f.value),"icon-only":Boolean((null==v?void 0:v.value)&&!(null==g?void 0:g.value)&&!u.default)})))),A=e.computed((()=>"string"==typeof(null==v?void 0:v.value)?{name:null==v?void 0:v.value}:null==v?void 0:v.value)),L=e.computed((()=>void 0!==i.value?i.value:B.value)),_=()=>{if(h.value){if(Array.isArray(b.value))return P(L.value,b.value)?void(S.value&&(b.value=b.value.filter((e=>e!==L.value)))):void b.value.push(L.value);if(L.value===b.value&&S.value)return void(b.value=i.uncheckedValue);b.value=L.value}};return(t,o)=>(e.openBlock(),e.createBlock(j,e.mergeProps({disabled:e.unref(y),pressed:e.unref(x),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(k),ref_key:"element",ref:$,class:e.unref(w),onClick:_}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(m,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",E,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(v)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-button__icon"},e.unref(A)),null,16)):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("span",D,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(g)),1)]))])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButton=t(e.vue,e.vue$1,e.uid)}(this,(function(e,t,o){"use strict";const n={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||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),a=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(a||{}),u=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(u||{});const s=Symbol.for("volver"),c=Symbol.for("buttonGroup"),d=Symbol.for("dropdownTrigger"),f=Symbol.for("dropdownAction");function v(){return e.inject(s)}function p(t,o,n){return e.computed((()=>{const r={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{r[`${t}--${o}`]=e.unref(n.value[o])})),r}))}const m=e.defineComponent({name:"VvIcon",props:n,setup(o){const n=o,r=e.computed((()=>"string"==typeof n.rotate?parseFloat(n.rotate):n.rotate)),l=e.ref(!0),i=v(),{modifiers:a}=e.toRefs(n),u=p("vv-icon",a),s=e.computed((()=>n.provider||(null==i?void 0:i.iconsProvider))),c=e.computed((()=>{const e=n.name??"",o=`@${s.value}:${n.prefix}:${e}`;if(t.iconExists(o))return o;const r=null==i?void 0:i.iconsCollections.find((o=>{const n=`@${s.value}:${o.prefix}:${e}`;return t.iconExists(n)}));return r?`@${s.value}:${r.prefix}:${e}`:e}));function d(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),r=(null==o?void 0:o.innerHTML.trim())||"";o&&r&&t.addIcon(`@${s.value}:${n.prefix}:${n.name}`,{body:r,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&n.src&&!t.iconExists(`@${s.value}:${n.prefix}:${n.name}`)&&(l.value=!1,i.fetchIcon(n.src).then((e=>{e&&(d(e),l.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),n.svg&&d(n.svg),(o,n)=>e.unref(l)?(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(r),color:o.color,onLoad:o.onLoad,icon:e.unref(c)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),g={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(u).includes(e)},rel:{type:String,default:"noopener noreferrer"}},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},y={disabled:Boolean},h={active:Boolean},S={current:Boolean},k={pressed:Boolean},B={label:[String,Number]},$={modifiers:[String,Array]};l.before;const x={unselectable:{type:Boolean,default:!0}},w={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const A={...y,...B,...k,...h,...S,...g,type:{type:String,default:i.button,validator:e=>Object.values(i).includes(e)},ariaLabel:{type:String,default:void 0}},L=A;const j=e.defineComponent({name:"VvAction",props:L,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const r=t,l=v(),i=e.ref(null);o({$el:i});const{reference:u,bus:s,aria:c,expanded:p}=e.inject(d,{});e.watch((()=>i.value),(e=>{u&&(u.value=e)}));const m=e.computed((()=>r.pressed||(null==p?void 0:p.value))),{role:g}=e.inject(f,{}),b=e.computed((()=>{switch(!0){case r.disabled:return a.button;case void 0!==r.to:return(null==l?void 0:l.nuxt)?a.nuxtLink:a.routerLink;case void 0!==r.href:return a.a;default:return a.button}})),y=e.computed((()=>{const e={...null==c?void 0:c.value,ariaPressed:!!m.value||void 0,ariaLabel:r.ariaLabel,role:null==g?void 0:g.value};switch(b.value){case a.a:return{...e,href:r.href,target:r.target,rel:r.rel};case a.routerLink:case a.nuxtLink:return{...e,to:r.to,target:r.target};default:return{...e,type:r.type,disabled:r.disabled}}})),h=e=>{r.disabled?e.preventDefault():(null==s||s.emit("click",e),n("click",e))},S=e=>{null==s||s.emit("mouseover",e),n("mouseover",e)},k=e=>{null==s||s.emit("mouseleave",e),n("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(y),{ref_key:"element",ref:i,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled,current:t.current},onClickPassive:h,onMouseoverPassive:S,onMouseleavePassive:k}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function V(e,t,o){return o?O(e,o)===O(t,o):_(e,t)}function _(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const o=Array.isArray(e),n=Array.isArray(t);let r,l,i;if(o&&n){if(l=e.length,l!=t.length)return!1;for(r=l;0!=r--;)if(!_(e[r],t[r]))return!1;return!0}if(o!=n)return!1;const a=e instanceof Date,u=t instanceof Date;if(a!=u)return!1;if(a&&u)return e.getTime()==t.getTime();const s=e instanceof RegExp,c=t instanceof RegExp;if(s!=c)return!1;if(s&&c)return e.toString()==t.toString();const d=Object.keys(e);if(l=d.length,l!==Object.keys(t).length)return!1;for(r=l;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,d[r]))return!1;for(r=l;0!=r--;)if(i=d[r],!_(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function O(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const o=t.split(".");let n=e;for(let t=0,r=o.length;t<r;++t){if(null==e)return null;n=n[o[t]]}return n}}return null}function P(e,t){if(null!=e&&t&&t.length)for(const o of t)if(V(e,o))return!0;return!1}function N(t){const o=e.inject(t,void 0),n=e.computed((()=>{return t=o,!(null==(n=e.unref(t))||""===n||Array.isArray(n)&&0===n.length||!(n instanceof Date)&&"object"==typeof n&&0===Object.keys(n).length);var t,n}));return{group:o,isInGroup:n,getGroupOrLocalRef:function(t,n,r){if(null==o?void 0:o.value){const n=e.unref(o.value)[t];return e.computed({get:()=>null==n?void 0:n.value,set(e){n.value=e}})}const l=e.toRef(n,t);return e.computed({get:()=>l.value,set(e){r&&r(`update:${t}`,e)}})}}}const C={...A,...w,...$,...x,...b,icon:[String,Object],iconPosition:{type:String,default:r.left,validator:e=>Object.values(r).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};const E={key:1,class:"vv-button__label"},D={key:1,class:"vv-button__label"};return e.defineComponent({name:"VvButton",props:C,emits:["update:modelValue"],setup(t,{expose:n,emit:l}){const i=t,a=e.useAttrs(),u=e.useSlots(),{id:s,modifiers:d,iconPosition:f,icon:v,label:g,modelValue:b,disabled:y,toggle:h,unselectable:S}=function(t,o){const{group:n,isInGroup:r,getGroupOrLocalRef:l}=N(c),{id:i,iconPosition:a,icon:u,label:s,pressed:d}=e.toRefs(t),f=l("modelValue",t,o),v=l("toggle",t),p=l("unselectable",t),m=e.computed((()=>(null==n?void 0:n.value.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,o=null==n?void 0:n.value.modifiers.value;const r=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>r.add(e)))),o&&(Array.isArray(o)||(o=o.split(" ")),o.forEach((e=>r.add(e)))),Array.from(r)})),b=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==n?void 0:n.value)?void 0:e.disabled.value))}));return{group:n,isInGroup:r,modelValue:f,toggle:v,unselectable:p,multiple:m,modifiers:g,disabled:b,id:i,pressed:d,iconPosition:a,icon:u,label:s}}(i,l),k=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))))(s),B=e.computed((()=>(null==a?void 0:a.name)||k.value)),$=e.ref(null);n({$el:e.computed((()=>{var e;return null==(e=$.value)?void 0:e.$el}))});const x=e.computed((()=>h.value?Array.isArray(b.value)?P(B.value,b.value):V(B.value,b.value):i.pressed)),w=p("vv-button",d,e.computed((()=>({reverse:[r.right,r.bottom].includes(f.value),column:[r.top,r.bottom].includes(f.value),"icon-only":Boolean((null==v?void 0:v.value)&&!(null==g?void 0:g.value)&&!u.default)})))),A=e.computed((()=>"string"==typeof(null==v?void 0:v.value)?{name:null==v?void 0:v.value}:null==v?void 0:v.value)),L=e.computed((()=>void 0!==i.value?i.value:B.value)),_=()=>{if(h.value){if(Array.isArray(b.value))return P(L.value,b.value)?void(S.value&&(b.value=b.value.filter((e=>e!==L.value)))):void b.value.push(L.value);if(L.value===b.value&&S.value)return void(b.value=i.uncheckedValue);b.value=L.value}};return(t,o)=>(e.openBlock(),e.createBlock(j,e.mergeProps({disabled:e.unref(y),pressed:e.unref(x),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(k),ref_key:"element",ref:$,class:e.unref(w),onClick:_}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(m,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",E,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(v)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-button__icon"},e.unref(A)),null,16)):e.createCommentVNode("v-if",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("span",D,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(g)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}})}));
|
|
@@ -2,7 +2,7 @@ import { Side } from '../../constants';
|
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
3
|
icon: (ObjectConstructor | StringConstructor)[];
|
|
4
4
|
iconPosition: {
|
|
5
|
-
type: globalThis.PropType<"
|
|
5
|
+
type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
|
|
6
6
|
default: Side;
|
|
7
7
|
validator: (value: Side) => boolean;
|
|
8
8
|
};
|
|
@@ -26,7 +26,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
26
26
|
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
27
27
|
default: undefined;
|
|
28
28
|
};
|
|
29
|
-
loading: BooleanConstructor;
|
|
29
|
+
loading: BooleanConstructor; /**
|
|
30
|
+
* @description Define component classes with BEM style.
|
|
31
|
+
* @returns {Array} The component classes.
|
|
32
|
+
*/
|
|
30
33
|
loadingLabel: {
|
|
31
34
|
type: StringConstructor;
|
|
32
35
|
default: string;
|
|
@@ -65,10 +68,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
65
68
|
disabled: BooleanConstructor;
|
|
66
69
|
}, {
|
|
67
70
|
$el: globalThis.ComputedRef<HTMLElement | undefined>;
|
|
68
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
71
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
72
|
+
[x: string]: (...args: any[]) => void;
|
|
73
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
69
74
|
icon: (ObjectConstructor | StringConstructor)[];
|
|
70
75
|
iconPosition: {
|
|
71
|
-
type: globalThis.PropType<"
|
|
76
|
+
type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
|
|
72
77
|
default: Side;
|
|
73
78
|
validator: (value: Side) => boolean;
|
|
74
79
|
};
|
|
@@ -92,7 +97,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
92
97
|
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
93
98
|
default: undefined;
|
|
94
99
|
};
|
|
95
|
-
loading: BooleanConstructor;
|
|
100
|
+
loading: BooleanConstructor; /**
|
|
101
|
+
* @description Define component classes with BEM style.
|
|
102
|
+
* @returns {Array} The component classes.
|
|
103
|
+
*/
|
|
96
104
|
loadingLabel: {
|
|
97
105
|
type: StringConstructor;
|
|
98
106
|
default: string;
|
|
@@ -129,9 +137,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
129
137
|
pressed: BooleanConstructor;
|
|
130
138
|
label: (StringConstructor | NumberConstructor)[];
|
|
131
139
|
disabled: BooleanConstructor;
|
|
132
|
-
}
|
|
133
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
134
|
-
}, {
|
|
140
|
+
}>>, {
|
|
135
141
|
disabled: boolean;
|
|
136
142
|
modelValue: string | number | boolean;
|
|
137
143
|
toggle: boolean;
|
|
@@ -143,7 +149,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
143
149
|
current: boolean;
|
|
144
150
|
active: boolean;
|
|
145
151
|
pressed: boolean;
|
|
146
|
-
iconPosition: "
|
|
152
|
+
iconPosition: "left" | "right" | "top" | "bottom";
|
|
147
153
|
loadingIcon: string;
|
|
148
154
|
uncheckedValue: string | number | boolean;
|
|
149
155
|
loading: boolean;
|
|
@@ -11,7 +11,7 @@ export declare const VvButtonProps: {
|
|
|
11
11
|
* Button icon position
|
|
12
12
|
*/
|
|
13
13
|
iconPosition: {
|
|
14
|
-
type: PropType<"
|
|
14
|
+
type: PropType<"left" | "right" | "top" | "bottom">;
|
|
15
15
|
default: Side;
|
|
16
16
|
validator: (value: Side) => boolean;
|
|
17
17
|
};
|
|
@@ -103,7 +103,7 @@ export declare function useGroupProps(props: VvButtonPropsTypes, emit: (event: (
|
|
|
103
103
|
disabled: globalThis.ComputedRef<boolean>;
|
|
104
104
|
id: Ref<string | number | undefined> | undefined;
|
|
105
105
|
pressed: Ref<boolean>;
|
|
106
|
-
iconPosition: Ref<"
|
|
106
|
+
iconPosition: Ref<"left" | "right" | "top" | "bottom">;
|
|
107
107
|
icon: Ref<string | Record<string, any> | undefined> | undefined;
|
|
108
108
|
label: Ref<string | number | undefined> | undefined;
|
|
109
109
|
};
|
|
@@ -341,12 +341,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
341
341
|
});
|
|
342
342
|
const bemCssClasses = useModifiers("vv-button-group", modifiers);
|
|
343
343
|
return (_ctx, _cache) => {
|
|
344
|
-
return openBlock(), createElementBlock(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
344
|
+
return openBlock(), createElementBlock(
|
|
345
|
+
"div",
|
|
346
|
+
{
|
|
347
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
348
|
+
role: "group"
|
|
349
|
+
},
|
|
350
|
+
[
|
|
351
|
+
renderSlot(_ctx.$slots, "default")
|
|
352
|
+
],
|
|
353
|
+
2
|
|
354
|
+
/* CLASS */
|
|
355
|
+
);
|
|
350
356
|
};
|
|
351
357
|
}
|
|
352
358
|
});
|
|
@@ -21,7 +21,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
21
21
|
};
|
|
22
22
|
disabled: BooleanConstructor;
|
|
23
23
|
modifiers: globalThis.PropType<string | string[]>;
|
|
24
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
24
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
[x: string]: (...args: any[]) => void;
|
|
26
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
27
|
itemModifiers: {
|
|
26
28
|
type: globalThis.PropType<string | string[]>;
|
|
27
29
|
default: string;
|
|
@@ -44,9 +46,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
44
46
|
};
|
|
45
47
|
disabled: BooleanConstructor;
|
|
46
48
|
modifiers: globalThis.PropType<string | string[]>;
|
|
47
|
-
}
|
|
48
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
49
|
-
}, {
|
|
49
|
+
}>>, {
|
|
50
50
|
disabled: boolean;
|
|
51
51
|
modelValue: string | number | boolean | (string | number | boolean)[] | undefined;
|
|
52
52
|
toggle: boolean;
|
|
@@ -283,22 +283,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
283
283
|
const { modifiers } = toRefs(props);
|
|
284
284
|
const bemCssClasses = useModifiers("vv-card", modifiers);
|
|
285
285
|
return (_ctx, _cache) => {
|
|
286
|
-
return openBlock(), createElementBlock(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
286
|
+
return openBlock(), createElementBlock(
|
|
287
|
+
"article",
|
|
288
|
+
{
|
|
289
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
290
|
+
},
|
|
291
|
+
[
|
|
292
|
+
_ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header", _hoisted_1, [
|
|
293
|
+
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
294
|
+
createTextVNode(
|
|
295
|
+
toDisplayString(_ctx.title),
|
|
296
|
+
1
|
|
297
|
+
/* TEXT */
|
|
298
|
+
)
|
|
299
|
+
])
|
|
300
|
+
])) : createCommentVNode("v-if", true),
|
|
301
|
+
renderSlot(_ctx.$slots, "default"),
|
|
302
|
+
_ctx.$slots.content ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
303
|
+
renderSlot(_ctx.$slots, "content")
|
|
304
|
+
])) : createCommentVNode("v-if", true),
|
|
305
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_3, [
|
|
306
|
+
renderSlot(_ctx.$slots, "footer")
|
|
307
|
+
])) : createCommentVNode("v-if", true)
|
|
308
|
+
],
|
|
309
|
+
2
|
|
310
|
+
/* CLASS */
|
|
311
|
+
);
|
|
302
312
|
};
|
|
303
313
|
}
|
|
304
314
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCard=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});Boolean,Boolean,Boolean,Boolean;const r={modifiers:[String,Array]};t.before,o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,n.button;const l={...r,title:String};const a={key:0,class:"vv-card__header"},s={key:1,class:"vv-card__content"},c={key:2,class:"vv-card__footer"};return e.defineComponent({name:"VvCard",props:l,setup(o){const t=o,{modifiers:n}=e.toRefs(t),r=function(o,t,n){return e.computed((()=>{const r={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-card",n);return(o,t)=>(e.openBlock(),e.createElementBlock("article",{class:e.normalizeClass(e.unref(r))},[o.$slots.header||o.title?(e.openBlock(),e.createElementBlock("header",a,[e.renderSlot(o.$slots,"header",{},(()=>[e.createTextVNode(e.toDisplayString(o.title),1)]))])):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default"),o.$slots.content?(e.openBlock(),e.createElementBlock("div",s,[e.renderSlot(o.$slots,"content")])):e.createCommentVNode("",!0),o.$slots.footer?(e.openBlock(),e.createElementBlock("footer",c,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("",!0)],2))}})}));
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCard=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});Boolean,Boolean,Boolean,Boolean;const r={modifiers:[String,Array]};t.before,o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,n.button;const l={...r,title:String};const a={key:0,class:"vv-card__header"},s={key:1,class:"vv-card__content"},c={key:2,class:"vv-card__footer"};return e.defineComponent({name:"VvCard",props:l,setup(o){const t=o,{modifiers:n}=e.toRefs(t),r=function(o,t,n){return e.computed((()=>{const r={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-card",n);return(o,t)=>(e.openBlock(),e.createElementBlock("article",{class:e.normalizeClass(e.unref(r))},[o.$slots.header||o.title?(e.openBlock(),e.createElementBlock("header",a,[e.renderSlot(o.$slots,"header",{},(()=>[e.createTextVNode(e.toDisplayString(o.title),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(o.$slots,"default"),o.$slots.content?(e.openBlock(),e.createElementBlock("div",s,[e.renderSlot(o.$slots,"content")])):e.createCommentVNode("v-if",!0),o.$slots.footer?(e.openBlock(),e.createElementBlock("footer",c,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("v-if",!0)],2))}})}));
|
|
@@ -840,12 +840,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
840
840
|
[vModelCheckbox, unref(localModelValue)]
|
|
841
841
|
]),
|
|
842
842
|
renderSlot(_ctx.$slots, "default", { value: unref(modelValue) }, () => [
|
|
843
|
-
createTextVNode(
|
|
843
|
+
createTextVNode(
|
|
844
|
+
toDisplayString(_ctx.label),
|
|
845
|
+
1
|
|
846
|
+
/* TEXT */
|
|
847
|
+
)
|
|
844
848
|
]),
|
|
845
849
|
createVNode(unref(HintSlot), {
|
|
846
850
|
id: unref(hasHintId),
|
|
847
851
|
class: "vv-checkbox__hint"
|
|
848
|
-
}, createSlots({
|
|
852
|
+
}, createSlots({
|
|
853
|
+
_: 2
|
|
854
|
+
/* DYNAMIC */
|
|
855
|
+
}, [
|
|
849
856
|
_ctx.$slots.hint ? {
|
|
850
857
|
name: "hint",
|
|
851
858
|
fn: withCtx(() => [
|
|
@@ -30,7 +30,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
30
30
|
required: boolean;
|
|
31
31
|
};
|
|
32
32
|
id: (StringConstructor | NumberConstructor)[];
|
|
33
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
33
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
[x: string]: (...args: any[]) => void;
|
|
35
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
36
|
indeterminate: BooleanConstructor;
|
|
35
37
|
uncheckedValue: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
36
38
|
switch: BooleanConstructor;
|
|
@@ -62,9 +64,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
62
64
|
required: boolean;
|
|
63
65
|
};
|
|
64
66
|
id: (StringConstructor | NumberConstructor)[];
|
|
65
|
-
}
|
|
66
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
67
|
-
}, {
|
|
67
|
+
}>>, {
|
|
68
68
|
readonly: boolean;
|
|
69
69
|
disabled: boolean;
|
|
70
70
|
valid: boolean;
|
|
@@ -886,12 +886,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
886
886
|
[vModelCheckbox, unref(localModelValue)]
|
|
887
887
|
]),
|
|
888
888
|
renderSlot(_ctx.$slots, "default", { value: unref(modelValue) }, () => [
|
|
889
|
-
createTextVNode(
|
|
889
|
+
createTextVNode(
|
|
890
|
+
toDisplayString(_ctx.label),
|
|
891
|
+
1
|
|
892
|
+
/* TEXT */
|
|
893
|
+
)
|
|
890
894
|
]),
|
|
891
895
|
createVNode(unref(HintSlot), {
|
|
892
896
|
id: unref(hasHintId),
|
|
893
897
|
class: "vv-checkbox__hint"
|
|
894
|
-
}, createSlots({
|
|
898
|
+
}, createSlots({
|
|
899
|
+
_: 2
|
|
900
|
+
/* DYNAMIC */
|
|
901
|
+
}, [
|
|
895
902
|
_ctx.$slots.hint ? {
|
|
896
903
|
name: "hint",
|
|
897
904
|
fn: withCtx(() => [
|
|
@@ -1018,49 +1025,76 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1018
1025
|
};
|
|
1019
1026
|
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
1020
1027
|
return (_ctx, _cache) => {
|
|
1021
|
-
return openBlock(), createElementBlock(
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
key:
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1028
|
+
return openBlock(), createElementBlock(
|
|
1029
|
+
"fieldset",
|
|
1030
|
+
{
|
|
1031
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
1032
|
+
},
|
|
1033
|
+
[
|
|
1034
|
+
_ctx.label ? (openBlock(), createElementBlock("legend", {
|
|
1035
|
+
key: 0,
|
|
1036
|
+
textContent: toDisplayString(_ctx.label)
|
|
1037
|
+
}, null, 8, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
1038
|
+
createElementVNode("div", _hoisted_2, [
|
|
1039
|
+
_ctx.options.length > 0 ? (openBlock(true), createElementBlock(
|
|
1040
|
+
Fragment,
|
|
1041
|
+
{ key: 0 },
|
|
1042
|
+
renderList(_ctx.options, (option, index) => {
|
|
1043
|
+
return openBlock(), createBlock(
|
|
1044
|
+
_sfc_main$1,
|
|
1045
|
+
mergeProps({ key: index }, getOptionProps(option, index)),
|
|
1046
|
+
null,
|
|
1047
|
+
16
|
|
1048
|
+
/* FULL_PROPS */
|
|
1049
|
+
);
|
|
1050
|
+
}),
|
|
1051
|
+
128
|
|
1052
|
+
/* KEYED_FRAGMENT */
|
|
1053
|
+
)) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
|
1054
|
+
]),
|
|
1055
|
+
createVNode(
|
|
1056
|
+
unref(HintSlot),
|
|
1057
|
+
{ class: "vv-checkbox-group__hint" },
|
|
1058
|
+
createSlots({
|
|
1059
|
+
_: 2
|
|
1060
|
+
/* DYNAMIC */
|
|
1061
|
+
}, [
|
|
1062
|
+
_ctx.$slots.hint ? {
|
|
1063
|
+
name: "hint",
|
|
1064
|
+
fn: withCtx(() => [
|
|
1065
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1066
|
+
]),
|
|
1067
|
+
key: "0"
|
|
1068
|
+
} : void 0,
|
|
1069
|
+
_ctx.$slots.loading ? {
|
|
1070
|
+
name: "loading",
|
|
1071
|
+
fn: withCtx(() => [
|
|
1072
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1073
|
+
]),
|
|
1074
|
+
key: "1"
|
|
1075
|
+
} : void 0,
|
|
1076
|
+
_ctx.$slots.valid ? {
|
|
1077
|
+
name: "valid",
|
|
1078
|
+
fn: withCtx(() => [
|
|
1079
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1080
|
+
]),
|
|
1081
|
+
key: "2"
|
|
1082
|
+
} : void 0,
|
|
1083
|
+
_ctx.$slots.invalid ? {
|
|
1084
|
+
name: "invalid",
|
|
1085
|
+
fn: withCtx(() => [
|
|
1086
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1087
|
+
]),
|
|
1088
|
+
key: "3"
|
|
1089
|
+
} : void 0
|
|
1059
1090
|
]),
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1091
|
+
1024
|
|
1092
|
+
/* DYNAMIC_SLOTS */
|
|
1093
|
+
)
|
|
1094
|
+
],
|
|
1095
|
+
2
|
|
1096
|
+
/* CLASS */
|
|
1097
|
+
);
|
|
1064
1098
|
};
|
|
1065
1099
|
}
|
|
1066
1100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("uid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core","ts-dot-prop"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=l(e.vue,e.uid,e.core,e.tsDotProp)}(this,(function(e,l,t,o){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),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,l,t){return t?v(e,t)===v(l,t):s(e,l)}function s(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),o=Array.isArray(l);let a,n,i;if(t&&o){if(n=e.length,n!=l.length)return!1;for(a=n;0!=a--;)if(!s(e[a],l[a]))return!1;return!0}if(t!=o)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 d=e instanceof RegExp,v=l instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==l.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(l).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(l,c[a]))return!1;for(a=n;0!=a--;)if(i=c[a],!s(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function v(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let o=e;for(let l=0,a=t.length;l<a;++l){if(null==e)return null;o=o[t[l]]}return o}}return null}function c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function f(l,t){const o=e.computed((()=>e.isRef(l)?l.value:l)),a=e.computed((()=>c(o.value.invalidLabel))),n=e.computed((()=>c(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(t.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(t.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(t.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var l,t,o,a,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot: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,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]};a.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 $(l){const t=e.inject(l,void 0),o=e.computed((()=>{return l=t,!(null==(o=e.unref(l))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var l,o}));return{group:t,isInGroup:o,getGroupOrLocalRef:function(l,o,a){if(null==t?void 0:t.value){const o=e.unref(t.value)[l];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,l);return e.computed({get:()=>n.value,set(e){a&&a(`update:${l}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(l,t,o){const a=e.inject(r),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[l]))return a.defaults.value[l]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,l=t,a=o;return Object.keys(l).reduce(((t,o)=>{const n=a[o];if(t[o]=n,o in e){if(Array.isArray(l[o])){const a=l[o];if(a.length){a[0]===n&&(t[o]=e[o])}}if("function"==typeof l[o]){(0,l[o])()===n&&(t[o]=e[o])}if("object"==typeof l[o]){let a=l[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(t[o]=e[o]):a===n&&(t[o]=e[o])}}return t}),{})}))}function j(l,t,o){return e.computed((()=>{const a={[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&&(a[`${l}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((t=>{a[`${l}--${t}`]=e.unref(o.value[t])})),a}))}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(t,{emit:o}){const a=t,n=e.useSlots(),i=C("VvCheckbox",A,a),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(l,t){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,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==o?void 0:o.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:o,isInGroup:a,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(a,o),y=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.uid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:a.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==a.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===a.value:Array.isArray(b.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(d(e,t))return!0;return!1}(a.value,b.value):d(a.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||a.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?a.value:a.uncheckedValue;else if(Array.isArray(b.value)||g.value){const l=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?l.add(a.value):l.delete(a.value),b.value=[...l]}else b.value=e?a.value:void 0;o("change",e)}}),{modifiers:_}=e.toRefs(a),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(l,t)=>(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":t[0]||(t[0]=l=>e.isRef(E)?E.value=l:null),type:"checkbox",class:"vv-checkbox__input",name:l.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(l.$slots,"default",{value:e.unref(b)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),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(H))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$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(l,{emit:a}){const n=l,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=t.useVModel(n,"modelValue",a),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=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:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=function(l){const{options:t,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(l);return{options:t,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof a.value?a.value(e):o.get(e,a.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):o.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):o.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(l,t)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[l.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(l.label)},null,8,E)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[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:h(e),value:g(e)}))(l,t)),null,16)))),128)):e.renderSlot(l.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{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(k))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("uid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core","ts-dot-prop"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=l(e.vue,e.uid,e.core,e.tsDotProp)}(this,(function(e,l,t,o){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),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,l,t){return t?v(e,t)===v(l,t):s(e,l)}function s(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),o=Array.isArray(l);let a,n,i;if(t&&o){if(n=e.length,n!=l.length)return!1;for(a=n;0!=a--;)if(!s(e[a],l[a]))return!1;return!0}if(t!=o)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 d=e instanceof RegExp,v=l instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==l.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(l).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(l,c[a]))return!1;for(a=n;0!=a--;)if(i=c[a],!s(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function v(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let o=e;for(let l=0,a=t.length;l<a;++l){if(null==e)return null;o=o[t[l]]}return o}}return null}function c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function f(l,t){const o=e.computed((()=>e.isRef(l)?l.value:l)),a=e.computed((()=>c(o.value.invalidLabel))),n=e.computed((()=>c(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(t.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(t.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(t.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var l,t,o,a,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(t=(l=this.$slots).loading)?void 0:t.call(l))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot: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,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]};a.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 $(l){const t=e.inject(l,void 0),o=e.computed((()=>{return l=t,!(null==(o=e.unref(l))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var l,o}));return{group:t,isInGroup:o,getGroupOrLocalRef:function(l,o,a){if(null==t?void 0:t.value){const o=e.unref(t.value)[l];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,l);return e.computed({get:()=>n.value,set(e){a&&a(`update:${l}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(l,t,o){const a=e.inject(r),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[l]))return a.defaults.value[l]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,l=t,a=o;return Object.keys(l).reduce(((t,o)=>{const n=a[o];if(t[o]=n,o in e){if(Array.isArray(l[o])){const a=l[o];if(a.length){a[0]===n&&(t[o]=e[o])}}if("function"==typeof l[o]){(0,l[o])()===n&&(t[o]=e[o])}if("object"==typeof l[o]){let a=l[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(t[o]=e[o]):a===n&&(t[o]=e[o])}}return t}),{})}))}function j(l,t,o){return e.computed((()=>{const a={[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&&(a[`${l}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((t=>{a[`${l}--${t}`]=e.unref(o.value[t])})),a}))}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(t,{emit:o}){const a=t,n=e.useSlots(),i=C("VvCheckbox",A,a),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(l,t){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,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==o?void 0:o.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:o,isInGroup:a,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(a,o),y=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.uid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:a.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==a.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===a.value:Array.isArray(b.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(d(e,t))return!0;return!1}(a.value,b.value):d(a.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||a.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?a.value:a.uncheckedValue;else if(Array.isArray(b.value)||g.value){const l=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?l.add(a.value):l.delete(a.value),b.value=[...l]}else b.value=e?a.value:void 0;o("change",e)}}),{modifiers:_}=e.toRefs(a),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(l,t)=>(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":t[0]||(t[0]=l=>e.isRef(E)?E.value=l:null),type:"checkbox",class:"vv-checkbox__input",name:l.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(l.$slots,"default",{value:e.unref(b)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),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(H))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$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(l,{emit:a}){const n=l,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=t.useVModel(n,"modelValue",a),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=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:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=function(l){const{options:t,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(l);return{options:t,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof a.value?a.value(e):o.get(e,a.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):o.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):o.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(l,t)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[l.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(l.label)},null,8,E)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",_,[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:h(e),value:g(e)}))(l,t)),null,16)))),128)):e.renderSlot(l.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{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(k))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
@@ -39,7 +39,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
39
39
|
invalidLabel: (ArrayConstructor | StringConstructor)[];
|
|
40
40
|
valid: BooleanConstructor;
|
|
41
41
|
validLabel: (ArrayConstructor | StringConstructor)[];
|
|
42
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
42
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
[x: string]: (...args: any[]) => void;
|
|
44
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
45
|
modelValue: (SymbolConstructor | ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
44
46
|
name: {
|
|
45
47
|
type: StringConstructor;
|
|
@@ -79,9 +81,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
79
81
|
invalidLabel: (ArrayConstructor | StringConstructor)[];
|
|
80
82
|
valid: BooleanConstructor;
|
|
81
83
|
validLabel: (ArrayConstructor | StringConstructor)[];
|
|
82
|
-
}
|
|
83
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
84
|
-
}, {
|
|
84
|
+
}>>, {
|
|
85
85
|
readonly: boolean;
|
|
86
86
|
disabled: boolean;
|
|
87
87
|
valid: boolean;
|
|
@@ -19,7 +19,7 @@ export declare const VvCheckboxGroupProps: {
|
|
|
19
19
|
default: string;
|
|
20
20
|
};
|
|
21
21
|
options: {
|
|
22
|
-
type: globalThis.PropType<(string | import("
|
|
22
|
+
type: globalThis.PropType<(string | import("../..").Option)[]>;
|
|
23
23
|
default: () => never[];
|
|
24
24
|
};
|
|
25
25
|
labelKey: {
|