@volverjs/ui-vue 0.0.7 → 0.0.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VvAlert/VvAlert.es.js +27 -18
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +4 -0
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +27 -18
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/stories/Alert/Alert.settings.d.ts +10 -0
- package/package.json +28 -28
- 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 +29 -11
- package/src/stories/Alert/Alert.settings.ts +10 -0
- package/src/stories/Alert/Alert.test.ts +8 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, createElementVNode,
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, renderSlot, createElementVNode, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { nanoid } from "nanoid";
|
|
4
4
|
const VvIconProps = {
|
|
@@ -592,7 +592,10 @@ const useVvAlert = (props, emit) => {
|
|
|
592
592
|
}))
|
|
593
593
|
};
|
|
594
594
|
};
|
|
595
|
-
const _hoisted_1 = {
|
|
595
|
+
const _hoisted_1 = {
|
|
596
|
+
key: 0,
|
|
597
|
+
class: "vv-alert__header"
|
|
598
|
+
};
|
|
596
599
|
const _hoisted_2 = ["id"];
|
|
597
600
|
const _hoisted_3 = ["aria-label"];
|
|
598
601
|
const _hoisted_4 = /* @__PURE__ */ createElementVNode("div", { class: "vv-alert__close-mask" }, null, -1);
|
|
@@ -600,11 +603,11 @@ const _hoisted_5 = [
|
|
|
600
603
|
_hoisted_4
|
|
601
604
|
];
|
|
602
605
|
const _hoisted_6 = {
|
|
603
|
-
key:
|
|
606
|
+
key: 1,
|
|
604
607
|
class: "vv-alert__content"
|
|
605
608
|
};
|
|
606
609
|
const _hoisted_7 = {
|
|
607
|
-
key:
|
|
610
|
+
key: 2,
|
|
608
611
|
class: "vv-alert__footer"
|
|
609
612
|
};
|
|
610
613
|
const __default__ = {
|
|
@@ -620,28 +623,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
620
623
|
__expose({ close });
|
|
621
624
|
return (_ctx, _cache) => {
|
|
622
625
|
return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(hasProps))), [
|
|
623
|
-
|
|
626
|
+
_ctx.$slots.header || _ctx.$slots.title || _ctx.$slots.close || _ctx.$slots["title::before"] || _ctx.$slots["title::after"] || _ctx.title || _ctx.dismissable || _ctx.autoClose ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
624
627
|
unref(hasIcon) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-alert__icon" }), null, 16)) : createCommentVNode("", true),
|
|
625
628
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
626
629
|
renderSlot(_ctx.$slots, "title::before"),
|
|
627
630
|
createElementVNode("strong", {
|
|
628
631
|
id: unref(hasTitleId),
|
|
629
632
|
class: "vv-alert__title"
|
|
630
|
-
},
|
|
633
|
+
}, [
|
|
634
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
635
|
+
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
636
|
+
])
|
|
637
|
+
], 8, _hoisted_2),
|
|
631
638
|
renderSlot(_ctx.$slots, "title::after")
|
|
632
639
|
]),
|
|
633
|
-
_ctx
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
640
|
+
renderSlot(_ctx.$slots, "close", normalizeProps(guardReactiveProps({ close: unref(close) })), () => [
|
|
641
|
+
_ctx.dismissable || _ctx.autoClose ? (openBlock(), createElementBlock("button", {
|
|
642
|
+
key: 0,
|
|
643
|
+
class: "vv-alert__close",
|
|
644
|
+
type: "button",
|
|
645
|
+
"aria-label": _ctx.closeLabel,
|
|
646
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(
|
|
647
|
+
//@ts-ignore
|
|
648
|
+
(...args) => unref(close) && unref(close)(...args),
|
|
649
|
+
["stop"]
|
|
650
|
+
))
|
|
651
|
+
}, _hoisted_5, 8, _hoisted_3)) : createCommentVNode("", true)
|
|
652
|
+
])
|
|
653
|
+
])) : createCommentVNode("", true),
|
|
645
654
|
_ctx.$slots.default || _ctx.content ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
646
655
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
647
656
|
createTextVNode(toDisplayString(_ctx.content), 1)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvAlert=t(e.vue,e.vue$1,e.nanoid)}(this,(function(e,t,o){"use strict";const r={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 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");function c(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}))}const u=e.defineComponent({name:"VvIcon",props:r,setup(o){const r=o,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),u=c("vv-icon",s),d=e.computed((()=>r.provider||(null==i?void 0:i.iconsProvider))),f=e.computed((()=>{const e=r.name??"",o=`@${d.value}:${r.prefix}:${e}`;if(t.iconExists(o))return o;const l=null==i?void 0:i.iconsCollections.find((o=>{const r=`@${d.value}:${o.prefix}:${e}`;return t.iconExists(r)}));return l?`@${d.value}:${l.prefix}:${e}`:e}));function p(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),l=(null==o?void 0:o.innerHTML.trim())||"";o&&l&&t.addIcon(`@${d.value}:${r.prefix}:${r.name}`,{body:l,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&r.src&&!t.iconExists(`@${d.value}:${r.prefix}:${r.name}`)&&(n.value=!1,i.fetchIcon(r.src).then((e=>{e&&(p(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),r.svg&&p(r.svg),(o,r)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(l),color:o.color,onLoad:o.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]};l.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:""},content:{type:String,default:""},footer:{type:String,default:""},role:{type:String,default:"alert"}},v=(t,r)=>{const{bus:l}=e.inject(s,{}),n=(i=e.computed((()=>t.id)),e.computed((()=>String((null==i?void 0:i.value)||o.nanoid()))));var i;const a=e.computed((()=>`${n.value}-title`)),u=e.computed((()=>"string"==typeof t.icon?{name:t.icon}:t.icon)),d=c("vv-alert",e.computed((()=>t.modifiers)),e.computed((()=>({dismissable:t.autoClose>0||t.dismissable,"auto-close":t.autoClose>0,hover:v.value})))),f=e.computed((()=>({"--alert-duration":`${t.autoClose}ms`}))),p=()=>{m&&clearTimeout(m),r("close",n.value),null==l||l.emit("close",n.value)};let m;e.watch((()=>t.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,t.autoClose>0&&(m=setTimeout(p,t.autoClose))}),["passive"]);return{close:p,hasIcon:u,hasTitleId:a,hasProps:e.computed((()=>({onMouseover:g,onMouseleave:y,class:d.value,style:f.value,role:t.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)],S={key:1,class:"vv-alert__content"},$={key:2,class:"vv-alert__footer"};return e.defineComponent({name:"VvAlert",props:m,emits:["close"],setup(t,{expose:o,emit:r}){const l=t,{hasProps:n,hasTitleId:i,hasIcon:a,close:s}=v(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",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(t.$slots,"header",{},(()=>[e.renderSlot(t.$slots,"title::before"),e.createElementVNode("strong",{id:e.unref(i),class:"vv-alert__title"},[e.renderSlot(t.$slots,"title",{},(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]))],8,y),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"]))},b,8,h)):e.createCommentVNode("",!0)]))])):e.createCommentVNode("",!0),t.$slots.default||t.content?(e.openBlock(),e.createElementBlock("div",S,[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",$,[e.renderSlot(t.$slots,"footer",{},(()=>[e.createTextVNode(e.toDisplayString(t.footer),1)]))])):e.createCommentVNode("",!0)],16))}})}));
|
|
@@ -92,7 +92,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
92
92
|
}, {}>, {
|
|
93
93
|
header?(_: {}): any;
|
|
94
94
|
"title::before"?(_: {}): any;
|
|
95
|
+
title?(_: {}): any;
|
|
95
96
|
"title::after"?(_: {}): any;
|
|
97
|
+
close?(_: {
|
|
98
|
+
close: () => void;
|
|
99
|
+
}): any;
|
|
96
100
|
default?(_: {}): any;
|
|
97
101
|
footer?(_: {}): any;
|
|
98
102
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { provide, computed, unref, inject, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, createElementVNode,
|
|
1
|
+
import { provide, computed, unref, inject, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, withModifiers, createElementBlock, normalizeProps, guardReactiveProps, renderSlot, createElementVNode, createTextVNode, toDisplayString, createVNode, TransitionGroup, 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";
|
|
@@ -695,7 +695,10 @@ const useVvAlert = (props, emit) => {
|
|
|
695
695
|
}))
|
|
696
696
|
};
|
|
697
697
|
};
|
|
698
|
-
const _hoisted_1 = {
|
|
698
|
+
const _hoisted_1 = {
|
|
699
|
+
key: 0,
|
|
700
|
+
class: "vv-alert__header"
|
|
701
|
+
};
|
|
699
702
|
const _hoisted_2 = ["id"];
|
|
700
703
|
const _hoisted_3 = ["aria-label"];
|
|
701
704
|
const _hoisted_4 = /* @__PURE__ */ createElementVNode("div", { class: "vv-alert__close-mask" }, null, -1);
|
|
@@ -703,11 +706,11 @@ const _hoisted_5 = [
|
|
|
703
706
|
_hoisted_4
|
|
704
707
|
];
|
|
705
708
|
const _hoisted_6 = {
|
|
706
|
-
key:
|
|
709
|
+
key: 1,
|
|
707
710
|
class: "vv-alert__content"
|
|
708
711
|
};
|
|
709
712
|
const _hoisted_7 = {
|
|
710
|
-
key:
|
|
713
|
+
key: 2,
|
|
711
714
|
class: "vv-alert__footer"
|
|
712
715
|
};
|
|
713
716
|
const __default__$1 = {
|
|
@@ -723,28 +726,34 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
723
726
|
__expose({ close });
|
|
724
727
|
return (_ctx, _cache) => {
|
|
725
728
|
return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(hasProps))), [
|
|
726
|
-
|
|
729
|
+
_ctx.$slots.header || _ctx.$slots.title || _ctx.$slots.close || _ctx.$slots["title::before"] || _ctx.$slots["title::after"] || _ctx.title || _ctx.dismissable || _ctx.autoClose ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
727
730
|
unref(hasIcon) ? (openBlock(), createBlock(_sfc_main$2, mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-alert__icon" }), null, 16)) : createCommentVNode("", true),
|
|
728
731
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
729
732
|
renderSlot(_ctx.$slots, "title::before"),
|
|
730
733
|
createElementVNode("strong", {
|
|
731
734
|
id: unref(hasTitleId),
|
|
732
735
|
class: "vv-alert__title"
|
|
733
|
-
},
|
|
736
|
+
}, [
|
|
737
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
738
|
+
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
739
|
+
])
|
|
740
|
+
], 8, _hoisted_2),
|
|
734
741
|
renderSlot(_ctx.$slots, "title::after")
|
|
735
742
|
]),
|
|
736
|
-
_ctx
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
743
|
+
renderSlot(_ctx.$slots, "close", normalizeProps(guardReactiveProps({ close: unref(close) })), () => [
|
|
744
|
+
_ctx.dismissable || _ctx.autoClose ? (openBlock(), createElementBlock("button", {
|
|
745
|
+
key: 0,
|
|
746
|
+
class: "vv-alert__close",
|
|
747
|
+
type: "button",
|
|
748
|
+
"aria-label": _ctx.closeLabel,
|
|
749
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(
|
|
750
|
+
//@ts-ignore
|
|
751
|
+
(...args) => unref(close) && unref(close)(...args),
|
|
752
|
+
["stop"]
|
|
753
|
+
))
|
|
754
|
+
}, _hoisted_5, 8, _hoisted_3)) : createCommentVNode("", true)
|
|
755
|
+
])
|
|
756
|
+
])) : createCommentVNode("", true),
|
|
748
757
|
_ctx.$slots.default || _ctx.content ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
749
758
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
750
759
|
createTextVNode(toDisplayString(_ctx.content), 1)
|
|
@@ -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 n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),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:l.before,validation:e=>Object.values(l).includes(e)}},d={id:[String,Number]};function p(t,o,r){return e.computed((()=>{const n={[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&&(n[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{n[`${t}--${o}`]=e.unref(r.value[o])})),n}))}n.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const
|
|
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 n=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(n||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),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:l.before,validation:e=>Object.values(l).includes(e)}},d={id:[String,Number]};function p(t,o,r){return e.computed((()=>{const n={[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&&(n[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{n[`${t}--${o}`]=e.unref(r.value[o])})),n}))}n.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const m={...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}},v=(o,r)=>{const n=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 l=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 n.on("close",(e=>{r("close",e)})),{hasTransition:i,hasProps:e.computed((()=>({class:l.value})))}},f={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 g=e.defineComponent({name:"VvIcon",props:f,setup(t){const r=t,n=e.computed((()=>"string"==typeof r.rotate?parseFloat(r.rotate):r.rotate)),l=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 n=null==i?void 0:i.iconsCollections.find((t=>{const r=`@${u.value}:${t.prefix}:${e}`;return o.iconExists(r)}));return n?`@${u.value}:${n.prefix}:${e}`:e}));function m(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),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&o.addIcon(`@${u.value}:${r.prefix}:${r.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&r.src&&!o.iconExists(`@${u.value}:${r.prefix}:${r.name}`)&&(l.value=!1,i.fetchIcon(r.src).then((e=>{e&&(m(e),l.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),r.svg&&m(r.svg),(t,r)=>e.unref(l)?(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(n),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}});const b={...d,...c,...u,dismissable:{type:Boolean,default:!1},autoClose:{type:Number,default:0},closeLabel:{type:String,default:"Close"},title:{type:String,default:""},content:{type:String,default:""},footer:{type:String,default:""},role:{type:String,default:"alert"}},y=(t,o)=>{const{bus:n}=e.inject(s,{}),l=(i=e.computed((()=>t.id)),e.computed((()=>String((null==i?void 0:i.value)||r.nanoid()))));var i;const a=e.computed((()=>`${l.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:f.value})))),d=e.computed((()=>({"--alert-duration":`${t.autoClose}ms`}))),m=()=>{v&&clearTimeout(v),o("close",l.value),null==n||n.emit("close",l.value)};let v;e.watch((()=>t.autoClose),(e=>{e>0?v=setTimeout(m,e):v&&clearTimeout(v)}),{immediate:!0});const f=e.ref(!1),g=e.withModifiers((()=>{f.value=!0,v&&clearTimeout(v)}),["passive"]),b=e.withModifiers((()=>{f.value=!1,t.autoClose>0&&(v=setTimeout(m,t.autoClose))}),["passive"]);return{close:m,hasIcon:c,hasTitleId:a,hasProps:e.computed((()=>({onMouseover:g,onMouseleave:b,class:u.value,style:d.value,role:t.role,"aria-labelledby":a.value})))}},h={key:0,class:"vv-alert__header"},S=["id"],k=["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"},x=e.defineComponent({name:"VvAlert",props:b,emits:["close"],setup(t,{expose:o,emit:r}){const n=t,{hasProps:l,hasTitleId:i,hasIcon:a,close:s}=y(n,r);return o({close:s}),(t,o)=>(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.guardReactiveProps(e.unref(l))),[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(g,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"),e.createElementVNode("strong",{id:e.unref(i),class:"vv-alert__title"},[e.renderSlot(t.$slots,"title",{},(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]))],8,S),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,k)):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:m,emits:["close"],setup(t,{emit:o}){const r=t,{hasProps:n,hasTransition:l}=v(r,o);return(t,o)=>(e.openBlock(),e.createElementBlock("div",e.normalizeProps(e.guardReactiveProps(e.unref(n))),[e.renderSlot(t.$slots,"before"),e.createVNode(e.TransitionGroup,{tag:"div",role:"group",name:e.unref(l),class:"vv-alert-group__list"},{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(x,e.mergeProps(t,{key:t.id}),null,16)))),128))]))])),_:3},8,["name"]),e.renderSlot(t.$slots,"after")],16))}})}));
|
package/dist/icons.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const prefix$2 = "normal";
|
|
2
|
-
const lastModified$2 =
|
|
2
|
+
const lastModified$2 = 1684415630;
|
|
3
3
|
const icons$3 = {
|
|
4
4
|
add: {
|
|
5
5
|
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M4 12h16m-8-8v16"/>'
|
|
@@ -614,7 +614,7 @@ const normal = {
|
|
|
614
614
|
height: height$1
|
|
615
615
|
};
|
|
616
616
|
const prefix$1 = "detailed";
|
|
617
|
-
const lastModified$1 =
|
|
617
|
+
const lastModified$1 = 1684415630;
|
|
618
618
|
const icons$2 = {
|
|
619
619
|
add: {
|
|
620
620
|
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M4 15.999h24m-12-12v24"/>'
|
|
@@ -1227,7 +1227,7 @@ const detailed = {
|
|
|
1227
1227
|
height
|
|
1228
1228
|
};
|
|
1229
1229
|
const prefix = "simple";
|
|
1230
|
-
const lastModified =
|
|
1230
|
+
const lastModified = 1684415630;
|
|
1231
1231
|
const icons$1 = {
|
|
1232
1232
|
add: {
|
|
1233
1233
|
body: '<path fill="none" stroke="currentColor" stroke-linecap="round" d="M.5 8h15M8 .5v15"/>'
|