@volverjs/ui-vue 0.0.9-beta.6 → 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/README.md +1 -1
- 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 +63 -57
- 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 +105 -68
- 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 +2 -2
- 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
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, renderSlot,
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, renderSlot, createTextVNode, toDisplayString, createElementVNode } from "vue";
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { nanoid } from "nanoid";
|
|
4
4
|
const VvIconProps = {
|
|
@@ -496,7 +496,7 @@ const VvAlertProps = {
|
|
|
496
496
|
*/
|
|
497
497
|
title: {
|
|
498
498
|
type: String,
|
|
499
|
-
default:
|
|
499
|
+
default: void 0
|
|
500
500
|
},
|
|
501
501
|
/**
|
|
502
502
|
* The alert content
|
|
@@ -505,7 +505,7 @@ const VvAlertProps = {
|
|
|
505
505
|
*/
|
|
506
506
|
content: {
|
|
507
507
|
type: String,
|
|
508
|
-
default:
|
|
508
|
+
default: void 0
|
|
509
509
|
},
|
|
510
510
|
/**
|
|
511
511
|
* The alert footer
|
|
@@ -514,7 +514,7 @@ const VvAlertProps = {
|
|
|
514
514
|
*/
|
|
515
515
|
footer: {
|
|
516
516
|
type: String,
|
|
517
|
-
default:
|
|
517
|
+
default: void 0
|
|
518
518
|
},
|
|
519
519
|
/**
|
|
520
520
|
* The alert role
|
|
@@ -634,14 +634,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
634
634
|
unref(hasIcon) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-alert__icon" }), null, 16)) : createCommentVNode("", true),
|
|
635
635
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
636
636
|
renderSlot(_ctx.$slots, "title::before"),
|
|
637
|
-
|
|
637
|
+
_ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("strong", {
|
|
638
|
+
key: 0,
|
|
638
639
|
id: unref(hasTitleId),
|
|
639
640
|
class: "vv-alert__title"
|
|
640
641
|
}, [
|
|
641
642
|
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
642
643
|
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
643
644
|
])
|
|
644
|
-
], 8, _hoisted_2),
|
|
645
|
+
], 8, _hoisted_2)) : createCommentVNode("", true),
|
|
645
646
|
renderSlot(_ctx.$slots, "title::after")
|
|
646
647
|
]),
|
|
647
648
|
renderSlot(_ctx.$slots, "close", normalizeProps(guardReactiveProps({ close: unref(close) })), () => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","nanoid"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAlert=o(e.vue,e.vue$1,e.nanoid)}(this,(function(e,o,t){"use strict";const l={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||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver"),s=Symbol.for("alertGroup");function c(o,t,l){return e.computed((()=>{const r={[o]:!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&&(r[`${o}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((t=>{r[`${o}--${t}`]=e.unref(l.value[t])})),r}))}const u=e.defineComponent({name:"VvIcon",props:l,setup(t){const l=t,r=e.computed((()=>"string"==typeof l.rotate?parseFloat(l.rotate):l.rotate)),n=e.ref(!0),i=e.inject(a),{modifiers:s}=e.toRefs(l),u=c("vv-icon",s),d=e.computed((()=>l.provider||(null==i?void 0:i.iconsProvider))),f=e.computed((()=>{const e=l.name??"",t=`@${d.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t;const r=null==i?void 0:i.iconsCollections.find((t=>{const l=`@${d.value}:${t.prefix}:${e}`;return o.iconExists(l)}));return r?`@${d.value}:${r.prefix}:${e}`:e}));function p(e){const t=function(e){let o;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");o=(new e).window}return(o?new o.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),r=(null==t?void 0:t.innerHTML.trim())||"";t&&r&&o.addIcon(`@${d.value}:${l.prefix}:${l.name}`,{body:r,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&l.src&&!o.iconExists(`@${d.value}:${l.prefix}:${l.name}`)&&(n.value=!1,i.fetchIcon(l.src).then((e=>{e&&(p(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&p(l.svg),(t,l)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(r),color:t.color,onLoad:t.onLoad,icon:e.unref(f)}),null,16,["class"])):e.createCommentVNode("",!0)}}),d=(Boolean,Boolean,Boolean,{modifiers:[String,Array]}),f={icon:{type:[String,Object]},iconPosition:{type:String,default:n.before,validation:e=>Object.values(n).includes(e)}},p={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const m={...p,...d,...f,dismissable:{type:Boolean,default:!1},autoClose:{type:Number,default:0},closeLabel:{type:String,default:"Close"},title:{type:String,default:void 0},content:{type:String,default:void 0},footer:{type:String,default:void 0},role:{type:String,default:"alert"}},v=(o,l)=>{const{bus:r}=e.inject(s,{}),n=(i=e.computed((()=>o.id)),e.computed((()=>String((null==i?void 0:i.value)||t.nanoid()))));var i;const a=e.computed((()=>`${n.value}-title`)),u=e.computed((()=>"string"==typeof o.icon?{name:o.icon}:o.icon)),d=c("vv-alert",e.computed((()=>o.modifiers)),e.computed((()=>({dismissable:o.autoClose>0||o.dismissable,"auto-close":o.autoClose>0,hover:v.value})))),f=e.computed((()=>({"--alert-duration":`${o.autoClose}ms`}))),p=()=>{m&&clearTimeout(m),l("close",n.value),null==r||r.emit("close",n.value)};let m;e.watch((()=>o.autoClose),(e=>{e>0?m=setTimeout(p,e):m&&clearTimeout(m)}),{immediate:!0});const v=e.ref(!1),g=e.withModifiers((()=>{v.value=!0,m&&clearTimeout(m)}),["passive"]),y=e.withModifiers((()=>{v.value=!1,o.autoClose>0&&(m=setTimeout(p,o.autoClose))}),["passive"]);return{close:p,hasIcon:u,hasTitleId:a,hasProps:e.computed((()=>({onMouseover:g,onMouseleave:y,class:d.value,style:f.value,role:o.role,"aria-labelledby":a.value})))}},g={key:0,class:"vv-alert__header"},y=["id"],h=["aria-label"],b=[e.createElementVNode("div",{class:"vv-alert__close-mask"},null,-1)],$={key:1,class:"vv-alert__content"},S={key:2,class:"vv-alert__footer"};return e.defineComponent({name:"VvAlert",props:m,emits:["close"],setup(o,{expose:t,emit:l}){const r=o,{hasProps:n,hasTitleId:i,hasIcon:a,close:s}=v(r,l);return t({close:s}),(o,t)=>(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.guardReactiveProps(e.unref(n))),[o.$slots.header||o.$slots.title||o.$slots.close||o.$slots["title::before"]||o.$slots["title::after"]||o.title||o.dismissable||o.autoClose?(e.openBlock(),e.createElementBlock("div",g,[e.unref(a)?(e.openBlock(),e.createBlock(u,e.mergeProps({key:0},e.unref(a),{class:"vv-alert__icon"}),null,16)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"header",{},(()=>[e.renderSlot(o.$slots,"title::before"),o.$slots.title||o.title?(e.openBlock(),e.createElementBlock("strong",{key:0,id:e.unref(i),class:"vv-alert__title"},[e.renderSlot(o.$slots,"title",{},(()=>[e.createTextVNode(e.toDisplayString(o.title),1)]))],8,y)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"title::after")])),e.renderSlot(o.$slots,"close",e.normalizeProps(e.guardReactiveProps({close:e.unref(s)})),(()=>[o.dismissable||o.autoClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:"vv-alert__close",type:"button","aria-label":o.closeLabel,onClick:t[0]||(t[0]=e.withModifiers(((...o)=>e.unref(s)&&e.unref(s)(...o)),["stop"]))},b,8,h)):e.createCommentVNode("",!0)]))])):e.createCommentVNode("",!0),o.$slots.default||o.content?(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(o.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(o.content),1)]))])):e.createCommentVNode("",!0),o.$slots.footer||o.footer?(e.openBlock(),e.createElementBlock("div",S,[e.renderSlot(o.$slots,"footer",{},(()=>[e.createTextVNode(e.toDisplayString(o.footer),1)]))])):e.createCommentVNode("",!0)],16))}})}));
|
|
@@ -13,15 +13,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
13
13
|
};
|
|
14
14
|
title: {
|
|
15
15
|
type: StringConstructor;
|
|
16
|
-
default:
|
|
16
|
+
default: undefined;
|
|
17
17
|
};
|
|
18
18
|
content: {
|
|
19
19
|
type: StringConstructor;
|
|
20
|
-
default:
|
|
20
|
+
default: undefined;
|
|
21
21
|
};
|
|
22
22
|
footer: {
|
|
23
23
|
type: StringConstructor;
|
|
24
|
-
default:
|
|
24
|
+
default: undefined;
|
|
25
25
|
};
|
|
26
26
|
role: {
|
|
27
27
|
type: globalThis.PropType<"alert" | "alertdialog">;
|
|
@@ -54,15 +54,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
54
54
|
};
|
|
55
55
|
title: {
|
|
56
56
|
type: StringConstructor;
|
|
57
|
-
default:
|
|
57
|
+
default: undefined;
|
|
58
58
|
};
|
|
59
59
|
content: {
|
|
60
60
|
type: StringConstructor;
|
|
61
|
-
default:
|
|
61
|
+
default: undefined;
|
|
62
62
|
};
|
|
63
63
|
footer: {
|
|
64
64
|
type: StringConstructor;
|
|
65
|
-
default:
|
|
65
|
+
default: undefined;
|
|
66
66
|
};
|
|
67
67
|
role: {
|
|
68
68
|
type: globalThis.PropType<"alert" | "alertdialog">;
|
|
@@ -34,7 +34,7 @@ export declare const VvAlertProps: {
|
|
|
34
34
|
*/
|
|
35
35
|
title: {
|
|
36
36
|
type: StringConstructor;
|
|
37
|
-
default:
|
|
37
|
+
default: undefined;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* The alert content
|
|
@@ -43,7 +43,7 @@ export declare const VvAlertProps: {
|
|
|
43
43
|
*/
|
|
44
44
|
content: {
|
|
45
45
|
type: StringConstructor;
|
|
46
|
-
default:
|
|
46
|
+
default: undefined;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
49
|
* The alert footer
|
|
@@ -52,7 +52,7 @@ export declare const VvAlertProps: {
|
|
|
52
52
|
*/
|
|
53
53
|
footer: {
|
|
54
54
|
type: StringConstructor;
|
|
55
|
-
default:
|
|
55
|
+
default: undefined;
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* The alert role
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { provide, computed, unref, inject, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, renderSlot,
|
|
1
|
+
import { provide, computed, unref, inject, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, renderSlot, createTextVNode, toDisplayString, createElementVNode, createVNode, TransitionGroup, toHandlers, withCtx, Fragment, renderList } from "vue";
|
|
2
2
|
import mitt from "mitt";
|
|
3
3
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
4
4
|
import { nanoid } from "nanoid";
|
|
@@ -609,7 +609,7 @@ const VvAlertProps = {
|
|
|
609
609
|
*/
|
|
610
610
|
title: {
|
|
611
611
|
type: String,
|
|
612
|
-
default:
|
|
612
|
+
default: void 0
|
|
613
613
|
},
|
|
614
614
|
/**
|
|
615
615
|
* The alert content
|
|
@@ -618,7 +618,7 @@ const VvAlertProps = {
|
|
|
618
618
|
*/
|
|
619
619
|
content: {
|
|
620
620
|
type: String,
|
|
621
|
-
default:
|
|
621
|
+
default: void 0
|
|
622
622
|
},
|
|
623
623
|
/**
|
|
624
624
|
* The alert footer
|
|
@@ -627,7 +627,7 @@ const VvAlertProps = {
|
|
|
627
627
|
*/
|
|
628
628
|
footer: {
|
|
629
629
|
type: String,
|
|
630
|
-
default:
|
|
630
|
+
default: void 0
|
|
631
631
|
},
|
|
632
632
|
/**
|
|
633
633
|
* The alert role
|
|
@@ -747,14 +747,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
747
747
|
unref(hasIcon) ? (openBlock(), createBlock(_sfc_main$2, mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-alert__icon" }), null, 16)) : createCommentVNode("", true),
|
|
748
748
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
749
749
|
renderSlot(_ctx.$slots, "title::before"),
|
|
750
|
-
|
|
750
|
+
_ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("strong", {
|
|
751
|
+
key: 0,
|
|
751
752
|
id: unref(hasTitleId),
|
|
752
753
|
class: "vv-alert__title"
|
|
753
754
|
}, [
|
|
754
755
|
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
755
756
|
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
756
757
|
])
|
|
757
|
-
], 8, _hoisted_2),
|
|
758
|
+
], 8, _hoisted_2)) : createCommentVNode("", true),
|
|
758
759
|
renderSlot(_ctx.$slots, "title::after")
|
|
759
760
|
]),
|
|
760
761
|
renderSlot(_ctx.$slots, "close", normalizeProps(guardReactiveProps({ close: unref(close) })), () => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("mitt"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","mitt","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAlertGroup=t(e.vue,e.mitt,e.vue$1,e.nanoid)}(this,(function(e,t,o,r){"use strict";var l=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(l||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver"),s=Symbol.for("alertGroup"),c=(Boolean,Boolean,Boolean,{modifiers:[String,Array]}),u={icon:{type:[String,Object]},iconPosition:{type:String,default:n.before,validation:e=>Object.values(n).includes(e)}},d={id:[String,Number]};function p(t,o,r){return e.computed((()=>{const l={[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&&(l[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{l[`${t}--${o}`]=e.unref(r.value[o])})),l}))}l.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const v={...c,name:{type:String,required:!0},items:{type:Array,default:()=>[]},stack:{type:Boolean,default:!1},reverse:{type:Boolean,default:!1},inline:{type:String,default:void 0},block:{type:String,default:void 0},position:{type:String,default:void 0},transition:{type:String,default:void 0}},f=(o,r)=>{const l=function({name:o}){const r=t();return e.provide(s,{name:o,bus:r}),r}({name:e.computed((()=>o.name))});(o.block&&!o.inline||!o.block&&o.inline)&&console.warn("[VvAlertGroup]: block and inline props must coexist at the same time.");const n=e.computed((()=>{const t=[p("vv-alert-group",e.computed((()=>o.modifiers)),e.computed((()=>({stack:o.stack,reverse:o.reverse,absolute:"absolute"===o.position,fixed:"fixed"===o.position})))).value];return o.inline&&o.block&&t.push(`vv-alert-group--${o.block}-${o.inline}`),t})),i=e.computed((()=>o.transition?o.transition:o.position?"start"===o.inline?"vv-alert--fade-inline-start":"end"===o.inline?"vv-alert--fade-inline-end":"top"===o.block?"vv-alert--fade-block-top":"bottom"===o.block?"vv-alert--fade-block-bottom":"vv-alert--fade":"vv-alert--fade"));return l.on("close",(e=>{r("close",e)})),{hasTransition:i,hasProps:e.computed((()=>({class:n.value})))}},m={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]}};const b=e.defineComponent({name:"VvIcon",props:m,setup(t){const r=t,l=e.computed((()=>"string"==typeof r.rotate?parseFloat(r.rotate):r.rotate)),n=e.ref(!0),i=e.inject(a),{modifiers:s}=e.toRefs(r),c=p("vv-icon",s),u=e.computed((()=>r.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=r.name??"",t=`@${u.value}:${r.prefix}:${e}`;if(o.iconExists(t))return t;const l=null==i?void 0:i.iconsCollections.find((t=>{const r=`@${u.value}:${t.prefix}:${e}`;return o.iconExists(r)}));return l?`@${u.value}:${l.prefix}:${e}`:e}));function v(e){const t=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),l=(null==t?void 0:t.innerHTML.trim())||"";t&&l&&o.addIcon(`@${u.value}:${r.prefix}:${r.name}`,{body:l,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&r.src&&!o.iconExists(`@${u.value}:${r.prefix}:${r.name}`)&&(n.value=!1,i.fetchIcon(r.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),r.svg&&v(r.svg),(t,r)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(c)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(l),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}});const g={...d,...c,...u,dismissable:{type:Boolean,default:!1},autoClose:{type:Number,default:0},closeLabel:{type:String,default:"Close"},title:{type:String,default:
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("mitt"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","mitt","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAlertGroup=t(e.vue,e.mitt,e.vue$1,e.nanoid)}(this,(function(e,t,o,r){"use strict";var l=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(l||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver"),s=Symbol.for("alertGroup"),c=(Boolean,Boolean,Boolean,{modifiers:[String,Array]}),u={icon:{type:[String,Object]},iconPosition:{type:String,default:n.before,validation:e=>Object.values(n).includes(e)}},d={id:[String,Number]};function p(t,o,r){return e.computed((()=>{const l={[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&&(l[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{l[`${t}--${o}`]=e.unref(r.value[o])})),l}))}l.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const v={...c,name:{type:String,required:!0},items:{type:Array,default:()=>[]},stack:{type:Boolean,default:!1},reverse:{type:Boolean,default:!1},inline:{type:String,default:void 0},block:{type:String,default:void 0},position:{type:String,default:void 0},transition:{type:String,default:void 0}},f=(o,r)=>{const l=function({name:o}){const r=t();return e.provide(s,{name:o,bus:r}),r}({name:e.computed((()=>o.name))});(o.block&&!o.inline||!o.block&&o.inline)&&console.warn("[VvAlertGroup]: block and inline props must coexist at the same time.");const n=e.computed((()=>{const t=[p("vv-alert-group",e.computed((()=>o.modifiers)),e.computed((()=>({stack:o.stack,reverse:o.reverse,absolute:"absolute"===o.position,fixed:"fixed"===o.position})))).value];return o.inline&&o.block&&t.push(`vv-alert-group--${o.block}-${o.inline}`),t})),i=e.computed((()=>o.transition?o.transition:o.position?"start"===o.inline?"vv-alert--fade-inline-start":"end"===o.inline?"vv-alert--fade-inline-end":"top"===o.block?"vv-alert--fade-block-top":"bottom"===o.block?"vv-alert--fade-block-bottom":"vv-alert--fade":"vv-alert--fade"));return l.on("close",(e=>{r("close",e)})),{hasTransition:i,hasProps:e.computed((()=>({class:n.value})))}},m={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]}};const b=e.defineComponent({name:"VvIcon",props:m,setup(t){const r=t,l=e.computed((()=>"string"==typeof r.rotate?parseFloat(r.rotate):r.rotate)),n=e.ref(!0),i=e.inject(a),{modifiers:s}=e.toRefs(r),c=p("vv-icon",s),u=e.computed((()=>r.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=r.name??"",t=`@${u.value}:${r.prefix}:${e}`;if(o.iconExists(t))return t;const l=null==i?void 0:i.iconsCollections.find((t=>{const r=`@${u.value}:${t.prefix}:${e}`;return o.iconExists(r)}));return l?`@${u.value}:${l.prefix}:${e}`:e}));function v(e){const t=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),l=(null==t?void 0:t.innerHTML.trim())||"";t&&l&&o.addIcon(`@${u.value}:${r.prefix}:${r.name}`,{body:l,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&r.src&&!o.iconExists(`@${u.value}:${r.prefix}:${r.name}`)&&(n.value=!1,i.fetchIcon(r.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),r.svg&&v(r.svg),(t,r)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(c)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(l),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}});const g={...d,...c,...u,dismissable:{type:Boolean,default:!1},autoClose:{type:Number,default:0},closeLabel:{type:String,default:"Close"},title:{type:String,default:void 0},content:{type:String,default:void 0},footer:{type:String,default:void 0},role:{type:String,default:"alert"}},y=(t,o)=>{const{bus:l}=e.inject(s,{}),n=(i=e.computed((()=>t.id)),e.computed((()=>String((null==i?void 0:i.value)||r.nanoid()))));var i;const a=e.computed((()=>`${n.value}-title`)),c=e.computed((()=>"string"==typeof t.icon?{name:t.icon}:t.icon)),u=p("vv-alert",e.computed((()=>t.modifiers)),e.computed((()=>({dismissable:t.autoClose>0||t.dismissable,"auto-close":t.autoClose>0,hover:m.value})))),d=e.computed((()=>({"--alert-duration":`${t.autoClose}ms`}))),v=()=>{f&&clearTimeout(f),o("close",n.value),null==l||l.emit("close",n.value)};let f;e.watch((()=>t.autoClose),(e=>{e>0?f=setTimeout(v,e):f&&clearTimeout(f)}),{immediate:!0});const m=e.ref(!1),b=e.withModifiers((()=>{m.value=!0,f&&clearTimeout(f)}),["passive"]),g=e.withModifiers((()=>{m.value=!1,t.autoClose>0&&(f=setTimeout(v,t.autoClose))}),["passive"]);return{close:v,hasIcon:c,hasTitleId:a,hasProps:e.computed((()=>({onMouseover:b,onMouseleave:g,class:u.value,style:d.value,role:t.role,"aria-labelledby":a.value})))}},h={key:0,class:"vv-alert__header"},k=["id"],S=["aria-label"],$=[e.createElementVNode("div",{class:"vv-alert__close-mask"},null,-1)],B={key:1,class:"vv-alert__content"},w={key:2,class:"vv-alert__footer"},C=e.defineComponent({name:"VvAlert",props:g,emits:["close"],setup(t,{expose:o,emit:r}){const l=t,{hasProps:n,hasTitleId:i,hasIcon:a,close:s}=y(l,r);return o({close:s}),(t,o)=>(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.guardReactiveProps(e.unref(n))),[t.$slots.header||t.$slots.title||t.$slots.close||t.$slots["title::before"]||t.$slots["title::after"]||t.title||t.dismissable||t.autoClose?(e.openBlock(),e.createElementBlock("div",h,[e.unref(a)?(e.openBlock(),e.createBlock(b,e.mergeProps({key:0},e.unref(a),{class:"vv-alert__icon"}),null,16)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"header",{},(()=>[e.renderSlot(t.$slots,"title::before"),t.$slots.title||t.title?(e.openBlock(),e.createElementBlock("strong",{key:0,id:e.unref(i),class:"vv-alert__title"},[e.renderSlot(t.$slots,"title",{},(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]))],8,k)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"title::after")])),e.renderSlot(t.$slots,"close",e.normalizeProps(e.guardReactiveProps({close:e.unref(s)})),(()=>[t.dismissable||t.autoClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:"vv-alert__close",type:"button","aria-label":t.closeLabel,onClick:o[0]||(o[0]=e.withModifiers(((...t)=>e.unref(s)&&e.unref(s)(...t)),["stop"]))},$,8,S)):e.createCommentVNode("",!0)]))])):e.createCommentVNode("",!0),t.$slots.default||t.content?(e.openBlock(),e.createElementBlock("div",B,[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.content),1)]))])):e.createCommentVNode("",!0),t.$slots.footer||t.footer?(e.openBlock(),e.createElementBlock("div",w,[e.renderSlot(t.$slots,"footer",{},(()=>[e.createTextVNode(e.toDisplayString(t.footer),1)]))])):e.createCommentVNode("",!0)],16))}});return e.defineComponent({name:"VvAlertGroup",props:v,emits:["close","before-enter","after-leave","enter","after-enter","enter-cancelled","before-leave","leave","leave-cancelled"],setup(t,{emit:o}){const r=t,{hasProps:l,hasTransition:n}=f(r,o),i={"before-enter":()=>{o("before-enter")},"after-leave":()=>{o("after-leave")},enter:()=>{o("enter")},"after-enter":()=>{o("after-enter")},"enter-cancelled":()=>{o("enter-cancelled")},"before-leave":()=>{o("before-leave")},leave:()=>{o("leave")},"leave-cancelled":()=>{o("leave-cancelled")}};return(t,o)=>(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.guardReactiveProps(e.unref(l))),[e.renderSlot(t.$slots,"before"),e.createVNode(e.TransitionGroup,e.mergeProps({tag:"div",role:"group",name:e.unref(n),class:"vv-alert-group__list"},e.toHandlers(i)),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(t=>(e.openBlock(),e.createBlock(C,e.mergeProps(t,{key:t.id}),null,16)))),128))]))])),_:3},16,["name"]),e.renderSlot(t.$slots,"after")],16))}})}));
|
|
@@ -36,6 +36,7 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
36
36
|
AnchorTarget2["_top"] = "_top";
|
|
37
37
|
return AnchorTarget2;
|
|
38
38
|
})(AnchorTarget || {});
|
|
39
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
39
40
|
const INJECTION_KEY_CHECK_GROUP = Symbol.for("checkGroup");
|
|
40
41
|
const LinkProps = {
|
|
41
42
|
/**
|
|
@@ -486,7 +487,8 @@ function joinLines(items) {
|
|
|
486
487
|
}
|
|
487
488
|
return items;
|
|
488
489
|
}
|
|
489
|
-
function HintSlotFactory(
|
|
490
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
491
|
+
const props = unref(propsOrRef);
|
|
490
492
|
const invalidLabel = computed(() => joinLines(props.invalidLabel));
|
|
491
493
|
const validLabel = computed(() => joinLines(props.validLabel));
|
|
492
494
|
const loadingLabel = computed(() => props.loadingLabel);
|
|
@@ -590,6 +592,62 @@ function HintSlotFactory(props, slots) {
|
|
|
590
592
|
HintSlot
|
|
591
593
|
};
|
|
592
594
|
}
|
|
595
|
+
function useVolver() {
|
|
596
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
597
|
+
}
|
|
598
|
+
function useDefaults(componentName, propsDefinition, props) {
|
|
599
|
+
const volver = useVolver();
|
|
600
|
+
const volverComponentDefaults = computed(() => {
|
|
601
|
+
var _a;
|
|
602
|
+
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
603
|
+
return void 0;
|
|
604
|
+
}
|
|
605
|
+
return volver.defaults.value[componentName];
|
|
606
|
+
});
|
|
607
|
+
return computed(() => {
|
|
608
|
+
if (volverComponentDefaults.value === void 0) {
|
|
609
|
+
return props;
|
|
610
|
+
}
|
|
611
|
+
const componentDefaults = volverComponentDefaults.value;
|
|
612
|
+
const simplifiedPropsDefinition = propsDefinition;
|
|
613
|
+
const simplifiedProps = props;
|
|
614
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
615
|
+
const propValue = simplifiedProps[key];
|
|
616
|
+
acc[key] = propValue;
|
|
617
|
+
if (key in componentDefaults) {
|
|
618
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
619
|
+
const typeArray = simplifiedPropsDefinition[key];
|
|
620
|
+
if (typeArray.length) {
|
|
621
|
+
const typeFunction = typeArray[0];
|
|
622
|
+
if (typeFunction === propValue) {
|
|
623
|
+
acc[key] = componentDefaults[key];
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
628
|
+
const typeFunction = simplifiedPropsDefinition[key];
|
|
629
|
+
if (typeFunction() === propValue) {
|
|
630
|
+
acc[key] = componentDefaults[key];
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
634
|
+
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
635
|
+
if (typeof defaultValue === "function") {
|
|
636
|
+
defaultValue = defaultValue();
|
|
637
|
+
}
|
|
638
|
+
if (typeof defaultValue === "object") {
|
|
639
|
+
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
640
|
+
acc[key] = componentDefaults[key];
|
|
641
|
+
}
|
|
642
|
+
} else if (defaultValue === propValue) {
|
|
643
|
+
acc[key] = componentDefaults[key];
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return acc;
|
|
648
|
+
}, {});
|
|
649
|
+
});
|
|
650
|
+
}
|
|
593
651
|
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
594
652
|
function useModifiers(prefix, modifiers, others) {
|
|
595
653
|
return computed(() => {
|
|
@@ -626,6 +684,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
626
684
|
setup(__props, { emit }) {
|
|
627
685
|
const props = __props;
|
|
628
686
|
const slots = useSlots();
|
|
687
|
+
const propsDefaults = useDefaults(
|
|
688
|
+
"VvCheckbox",
|
|
689
|
+
VvCheckboxProps,
|
|
690
|
+
props
|
|
691
|
+
);
|
|
629
692
|
const {
|
|
630
693
|
id,
|
|
631
694
|
disabled,
|
|
@@ -738,7 +801,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
738
801
|
hasHintLabelOrSlot,
|
|
739
802
|
hasInvalidLabelOrSlot,
|
|
740
803
|
hintSlotScope
|
|
741
|
-
} = HintSlotFactory(
|
|
804
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
742
805
|
return (_ctx, _cache) => {
|
|
743
806
|
return openBlock(), createElementBlock("label", {
|
|
744
807
|
class: normalizeClass(unref(bemCssClasses)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckbox=l(e.vue,e.nanoid)}(this,(function(e,l){"use strict";var
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckbox=l(e.vue,e.nanoid)}(this,(function(e,l){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});const o=Symbol.for("volver"),i=Symbol.for("checkGroup"),r={valid:Boolean,validLabel:[String,Array]},u={invalid:Boolean,invalidLabel:[String,Array]},d={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},s={disabled:Boolean},v=(Boolean,Boolean,{label:[String,Number]}),c={readonly:Boolean},f={modifiers:[String,Array]},b={hintLabel:{type:String,default:""}};a.before;const h={tabindex:{type:[String,Number],default:0}},p={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const m={...{...p,name:{type:String,required:!0}},...h,...r,...u,...b,...s,...c,...f,...v,...d,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]};function g(e,l,t){return t?S(e,t)===S(l,t):y(e,l)}function y(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const t=Array.isArray(e),a=Array.isArray(l);let n,o,i;if(t&&a){if(o=e.length,o!=l.length)return!1;for(n=o;0!=n--;)if(!y(e[n],l[n]))return!1;return!0}if(t!=a)return!1;const r=e instanceof Date,u=l instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==l.getTime();const d=e instanceof RegExp,s=l instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==l.toString();const v=Object.keys(e);if(o=v.length,o!==Object.keys(l).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(l,v[n]))return!1;for(n=o;0!=n--;)if(i=v[n],!y(e[i],l[i]))return!1;return!0}return e!=e&&l!=l}function S(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const t=l.split(".");let a=e;for(let l=0,n=t.length;l<n;++l){if(null==e)return null;a=a[t[l]]}return a}}return null}function L(l){const t=e.inject(l,void 0),a=e.computed((()=>{return l=t,!(null==(a=e.unref(l))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var l,a}));return{group:t,isInGroup:a,getGroupOrLocalRef:function(l,a,n){if(null==t?void 0:t.value){const a=e.unref(t.value)[l];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const o=e.toRef(a,l);return e.computed({get:()=>o.value,set(e){n&&n(`update:${l}`,e)}})}}}n.button;const O={...m,...f,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function k(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function B(l,t,a){const n=e.inject(o),i=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[l]))return n.defaults.value[l]}));return e.computed((()=>{if(void 0===i.value)return a;const e=i.value,l=t,n=a;return Object.keys(l).reduce(((t,a)=>{const o=n[a];if(t[a]=o,a in e){if(Array.isArray(l[a])){const n=l[a];if(n.length){n[0]===o&&(t[a]=e[a])}}if("function"==typeof l[a]){(0,l[a])()===o&&(t[a]=e[a])}if("object"==typeof l[a]){let n=l[a].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(o)&&(t[a]=e[a]):n===o&&(t[a]=e[a])}}return t}),{})}))}const V=["for"],x=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"];return e.defineComponent({name:"VvCheckbox",props:O,emits:["click","update:modelValue","change","blur"],setup(t,{emit:a}){const n=t,o=e.useSlots(),r=B("VvCheckbox",O,n),{id:u,disabled:d,readonly:s,valid:v,invalid:c,propsSwitch:f,modelValue:b,indeterminate:h,isInGroup:p}=function(l,t){const{group:a,isInGroup:n,getGroupOrLocalRef:o}=L(i),{id:r,switch:u,indeterminate:d}=e.toRefs(l),s=o("modelValue",l,t),v=o("valid",l),c=o("invalid",l),f=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),b=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:r,propsSwitch:u,indeterminate:d,group:a,isInGroup:n,modelValue:s,valid:v,invalid:c,readonly:f,disabled:b}}(n,a),m=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(u),y=e.computed((()=>`${m.value}-hint`)),S=e.computed((()=>j.value?-1:n.tabindex)),A=e.ref(),$=e.computed((()=>void 0!==n.uncheckedValue&&!p.value)),j=e.computed((()=>d.value||s.value)),w=e.computed((()=>!0===c.value||!0!==v.value&&void 0)),C=e.computed((()=>$.value?b.value===n.value:Array.isArray(b.value)?function(e,l){if(null!=e&&l&&l.length)for(const t of l)if(g(e,t))return!0;return!1}(n.value,b.value):g(n.value,b.value))),R=e.computed((()=>!!h.value||!(C.value||!$.value||n.uncheckedValue===b.value))),N=e.computed((()=>{if(!$.value)return!["string","number","boolean"].includes(typeof n.value)||n.value})),I=e.computed({get:()=>C.value,set(e){if($.value)b.value=e?n.value:n.uncheckedValue;else if(Array.isArray(b.value)||p.value){const l=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?l.add(n.value):l.delete(n.value),b.value=[...l]}else b.value=e?n.value:void 0;a("change",e)}}),{modifiers:P}=e.toRefs(n),E=function(l,t,a){return e.computed((()=>{const n={[l]:!0},o="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(n[`${l}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((t=>{n[`${l}--${t}`]=e.unref(a.value[t])})),n}))}("vv-checkbox",P,e.computed((()=>({switch:f.value,valid:v.value,invalid:c.value,disabled:d.value,readonly:s.value,indeterminate:h.value}))));e.watchEffect((()=>{$.value&&Array.isArray(b.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>R.value),(e=>{A.value.indeterminate=!!e})),e.onMounted((()=>{R.value&&(A.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:H,hasInvalidLabelOrSlot:T,hintSlotScope:_}=function(l,t){const a=e.unref(l),n=e.computed((()=>k(a.invalidLabel))),o=e.computed((()=>k(a.validLabel))),i=e.computed((()=>a.loadingLabel)),r=e.computed((()=>a.hintLabel)),u=e.computed((()=>Boolean(a.loading&&(t.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.invalid&&(t.invalid||n.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.valid&&(t.valid||o.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(t.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:a.modelValue,valid:a.valid,invalid:a.invalid,loading:a.loading}))),b=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:n,validLabel:o,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var l,t,a,n,o,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==(n=(a=this.$slots).invalid)?void 0:n.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(o=this.$slots).valid)?void 0:i.call(o))??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:f,HintSlot:b}}(r,o);return(l,t)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(E)),for:e.unref(m)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(m),ref_key:"input",ref:A,"onUpdate:modelValue":t[0]||(t[0]=l=>e.isRef(I)?I.value=l:null),type:"checkbox",class:"vv-checkbox__input",name:l.name,disabled:e.unref(j),value:e.unref(N),tabindex:e.unref(S),"aria-invalid":e.unref(w),"aria-describedby":e.unref(H)?e.unref(y):void 0,"aria-errormessage":e.unref(T)?e.unref(y):void 0},null,8,x),[[e.vModelCheckbox,e.unref(I)]]),e.renderSlot(l.$slots,"default",{value:e.unref(b)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(G),{id:e.unref(y),class:"vv-checkbox__hint"},e.createSlots({_:2},[l.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"0"}:void 0,l.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"1"}:void 0,l.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"2"}:void 0,l.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(l.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"3"}:void 0]),1032,["id"])],10,V))}})}));
|
|
@@ -80,25 +80,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
80
80
|
value: any;
|
|
81
81
|
}): any;
|
|
82
82
|
hint?(_: {
|
|
83
|
-
modelValue:
|
|
83
|
+
modelValue: unknown;
|
|
84
84
|
valid: boolean;
|
|
85
85
|
invalid: boolean;
|
|
86
86
|
loading: boolean;
|
|
87
87
|
}): any;
|
|
88
88
|
loading?(_: {
|
|
89
|
-
modelValue:
|
|
89
|
+
modelValue: unknown;
|
|
90
90
|
valid: boolean;
|
|
91
91
|
invalid: boolean;
|
|
92
92
|
loading: boolean;
|
|
93
93
|
}): any;
|
|
94
94
|
valid?(_: {
|
|
95
|
-
modelValue:
|
|
95
|
+
modelValue: unknown;
|
|
96
96
|
valid: boolean;
|
|
97
97
|
invalid: boolean;
|
|
98
98
|
loading: boolean;
|
|
99
99
|
}): any;
|
|
100
100
|
invalid?(_: {
|
|
101
|
-
modelValue:
|
|
101
|
+
modelValue: unknown;
|
|
102
102
|
valid: boolean;
|
|
103
103
|
invalid: boolean;
|
|
104
104
|
loading: boolean;
|
|
@@ -38,6 +38,7 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
38
38
|
AnchorTarget2["_top"] = "_top";
|
|
39
39
|
return AnchorTarget2;
|
|
40
40
|
})(AnchorTarget || {});
|
|
41
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
41
42
|
const INJECTION_KEY_CHECK_GROUP = Symbol.for("checkGroup");
|
|
42
43
|
function equals(obj1, obj2, field) {
|
|
43
44
|
if (field)
|
|
@@ -130,7 +131,8 @@ function joinLines(items) {
|
|
|
130
131
|
}
|
|
131
132
|
return items;
|
|
132
133
|
}
|
|
133
|
-
function HintSlotFactory(
|
|
134
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
135
|
+
const props = unref(propsOrRef);
|
|
134
136
|
const invalidLabel = computed(() => joinLines(props.invalidLabel));
|
|
135
137
|
const validLabel = computed(() => joinLines(props.validLabel));
|
|
136
138
|
const loadingLabel = computed(() => props.loadingLabel);
|
|
@@ -636,6 +638,62 @@ function useGroupProps(props, emit) {
|
|
|
636
638
|
disabled
|
|
637
639
|
};
|
|
638
640
|
}
|
|
641
|
+
function useVolver() {
|
|
642
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
643
|
+
}
|
|
644
|
+
function useDefaults(componentName, propsDefinition, props) {
|
|
645
|
+
const volver = useVolver();
|
|
646
|
+
const volverComponentDefaults = computed(() => {
|
|
647
|
+
var _a;
|
|
648
|
+
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
649
|
+
return void 0;
|
|
650
|
+
}
|
|
651
|
+
return volver.defaults.value[componentName];
|
|
652
|
+
});
|
|
653
|
+
return computed(() => {
|
|
654
|
+
if (volverComponentDefaults.value === void 0) {
|
|
655
|
+
return props;
|
|
656
|
+
}
|
|
657
|
+
const componentDefaults = volverComponentDefaults.value;
|
|
658
|
+
const simplifiedPropsDefinition = propsDefinition;
|
|
659
|
+
const simplifiedProps = props;
|
|
660
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
661
|
+
const propValue = simplifiedProps[key];
|
|
662
|
+
acc[key] = propValue;
|
|
663
|
+
if (key in componentDefaults) {
|
|
664
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
665
|
+
const typeArray = simplifiedPropsDefinition[key];
|
|
666
|
+
if (typeArray.length) {
|
|
667
|
+
const typeFunction = typeArray[0];
|
|
668
|
+
if (typeFunction === propValue) {
|
|
669
|
+
acc[key] = componentDefaults[key];
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
674
|
+
const typeFunction = simplifiedPropsDefinition[key];
|
|
675
|
+
if (typeFunction() === propValue) {
|
|
676
|
+
acc[key] = componentDefaults[key];
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
680
|
+
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
681
|
+
if (typeof defaultValue === "function") {
|
|
682
|
+
defaultValue = defaultValue();
|
|
683
|
+
}
|
|
684
|
+
if (typeof defaultValue === "object") {
|
|
685
|
+
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
686
|
+
acc[key] = componentDefaults[key];
|
|
687
|
+
}
|
|
688
|
+
} else if (defaultValue === propValue) {
|
|
689
|
+
acc[key] = componentDefaults[key];
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return acc;
|
|
694
|
+
}, {});
|
|
695
|
+
});
|
|
696
|
+
}
|
|
639
697
|
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
640
698
|
function useModifiers(prefix, modifiers, others) {
|
|
641
699
|
return computed(() => {
|
|
@@ -672,6 +730,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
672
730
|
setup(__props, { emit }) {
|
|
673
731
|
const props = __props;
|
|
674
732
|
const slots = useSlots();
|
|
733
|
+
const propsDefaults = useDefaults(
|
|
734
|
+
"VvCheckbox",
|
|
735
|
+
VvCheckboxProps,
|
|
736
|
+
props
|
|
737
|
+
);
|
|
675
738
|
const {
|
|
676
739
|
id,
|
|
677
740
|
disabled,
|
|
@@ -784,7 +847,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
784
847
|
hasHintLabelOrSlot,
|
|
785
848
|
hasInvalidLabelOrSlot,
|
|
786
849
|
hintSlotScope
|
|
787
|
-
} = HintSlotFactory(
|
|
850
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
788
851
|
return (_ctx, _cache) => {
|
|
789
852
|
return openBlock(), createElementBlock("label", {
|
|
790
853
|
class: normalizeClass(unref(bemCssClasses)),
|
|
@@ -903,6 +966,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
903
966
|
setup(__props, { emit }) {
|
|
904
967
|
const props = __props;
|
|
905
968
|
const slots = useSlots();
|
|
969
|
+
const propsDefaults = useDefaults(
|
|
970
|
+
"VvCheckboxGroup",
|
|
971
|
+
VvCheckboxGroupProps,
|
|
972
|
+
props
|
|
973
|
+
);
|
|
906
974
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
907
975
|
const { disabled, readonly, vertical, valid, invalid, modifiers } = toRefs(props);
|
|
908
976
|
useProvideGroupState({
|
|
@@ -933,7 +1001,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
933
1001
|
value: getOptionValue(option)
|
|
934
1002
|
};
|
|
935
1003
|
};
|
|
936
|
-
const { HintSlot, hintSlotScope } = HintSlotFactory(
|
|
1004
|
+
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
937
1005
|
return (_ctx, _cache) => {
|
|
938
1006
|
return openBlock(), createElementBlock("fieldset", {
|
|
939
1007
|
class: normalizeClass(unref(bemCssClasses))
|