generated from VLADIMIR/template_frontend
48 lines
6.9 KiB
JavaScript
48 lines
6.9 KiB
JavaScript
import{E as e,M as t,k as n,rt as r,v as i}from"./vue-router-CyfP71JJ.js";import{B as a,G as o,J as s,K as c,M as l,N as u,V as d,Y as f,Z as p,o as m,r as h,t as g}from"./light-CPiNeYrP.js";import{a as _,c as v,r as y}from"./resolve-slot-tPBGpQg9.js";import{C as b,F as x,I as S,L as C,M as w,N as T,R as E,V as D,w as O}from"./index-CIGUcMwT.js";function k(e){let{lineHeight:t,borderRadius:n,fontWeightStrong:r,baseColor:i,dividerColor:o,actionColor:s,textColor1:c,textColor2:l,closeColorHover:u,closeColorPressed:f,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:h,infoColor:g,successColor:_,warningColor:v,errorColor:y,fontSize:b}=e;return Object.assign(Object.assign({},O),{fontSize:b,lineHeight:t,titleFontWeight:r,borderRadius:n,border:`1px solid ${o}`,color:s,titleTextColor:c,iconColor:l,contentTextColor:l,closeBorderRadius:n,closeColorHover:u,closeColorPressed:f,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:h,borderInfo:`1px solid ${d(i,a(g,{alpha:.25}))}`,colorInfo:d(i,a(g,{alpha:.08})),titleTextColorInfo:c,iconColorInfo:g,contentTextColorInfo:l,closeColorHoverInfo:u,closeColorPressedInfo:f,closeIconColorInfo:p,closeIconColorHoverInfo:m,closeIconColorPressedInfo:h,borderSuccess:`1px solid ${d(i,a(_,{alpha:.25}))}`,colorSuccess:d(i,a(_,{alpha:.08})),titleTextColorSuccess:c,iconColorSuccess:_,contentTextColorSuccess:l,closeColorHoverSuccess:u,closeColorPressedSuccess:f,closeIconColorSuccess:p,closeIconColorHoverSuccess:m,closeIconColorPressedSuccess:h,borderWarning:`1px solid ${d(i,a(v,{alpha:.33}))}`,colorWarning:d(i,a(v,{alpha:.08})),titleTextColorWarning:c,iconColorWarning:v,contentTextColorWarning:l,closeColorHoverWarning:u,closeColorPressedWarning:f,closeIconColorWarning:p,closeIconColorHoverWarning:m,closeIconColorPressedWarning:h,borderError:`1px solid ${d(i,a(y,{alpha:.25}))}`,colorError:d(i,a(y,{alpha:.08})),titleTextColorError:c,iconColorError:y,contentTextColorError:l,closeColorHoverError:u,closeColorPressedError:f,closeIconColorError:p,closeIconColorHoverError:m,closeIconColorPressedError:h})}var A={name:`Alert`,common:g,self:k},j=c(`alert`,`
|
|
line-height: var(--n-line-height);
|
|
border-radius: var(--n-border-radius);
|
|
position: relative;
|
|
transition: background-color .3s var(--n-bezier);
|
|
background-color: var(--n-color);
|
|
text-align: start;
|
|
word-break: break-word;
|
|
`,[s(`border`,`
|
|
border-radius: inherit;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
transition: border-color .3s var(--n-bezier);
|
|
border: var(--n-border);
|
|
pointer-events: none;
|
|
`),f(`closable`,[c(`alert-body`,[s(`title`,`
|
|
padding-right: 24px;
|
|
`)])]),s(`icon`,{color:`var(--n-icon-color)`}),c(`alert-body`,{padding:`var(--n-padding)`},[s(`title`,{color:`var(--n-title-text-color)`}),s(`content`,{color:`var(--n-content-text-color)`})]),b({originalTransition:`transform .3s var(--n-bezier)`,enterToProps:{transform:`scale(1)`},leaveToProps:{transform:`scale(0.9)`}}),s(`icon`,`
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
align-items: center;
|
|
justify-content: center;
|
|
display: flex;
|
|
width: var(--n-icon-size);
|
|
height: var(--n-icon-size);
|
|
font-size: var(--n-icon-size);
|
|
margin: var(--n-icon-margin);
|
|
`),s(`close`,`
|
|
transition:
|
|
color .3s var(--n-bezier),
|
|
background-color .3s var(--n-bezier);
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
margin: var(--n-close-margin);
|
|
`),f(`show-icon`,[c(`alert-body`,{paddingLeft:`calc(var(--n-icon-margin-left) + var(--n-icon-size) + var(--n-icon-margin-right))`})]),f(`right-adjust`,[c(`alert-body`,{paddingRight:`calc(var(--n-close-size) + var(--n-padding) + 2px)`})]),c(`alert-body`,`
|
|
border-radius: var(--n-border-radius);
|
|
transition: border-color .3s var(--n-bezier);
|
|
`,[s(`title`,`
|
|
transition: color .3s var(--n-bezier);
|
|
font-size: 16px;
|
|
line-height: 19px;
|
|
font-weight: var(--n-title-font-weight);
|
|
`,[o(`& +`,[s(`content`,{marginTop:`9px`})])]),s(`content`,{transition:`color .3s var(--n-bezier)`,fontSize:`var(--n-font-size)`})]),s(`icon`,{transition:`color .3s var(--n-bezier)`})]),M=e({name:`Alert`,inheritAttrs:!1,props:Object.assign(Object.assign({},h.props),{title:String,showIcon:{type:Boolean,default:!0},type:{type:String,default:`default`},bordered:{type:Boolean,default:!0},closable:Boolean,onClose:Function,onAfterLeave:Function,onAfterHide:Function}),slots:Object,setup(e){let{mergedClsPrefixRef:t,mergedBorderedRef:n,inlineThemeDisabled:a,mergedRtlRef:o}=u(e),s=h(`Alert`,`-alert`,j,A,e,t),c=m(`Alert`,o,t),d=i(()=>{let{common:{cubicBezierEaseInOut:t},self:n}=s.value,{fontSize:r,borderRadius:i,titleFontWeight:a,lineHeight:o,iconSize:c,iconMargin:l,iconMarginRtl:u,closeIconSize:d,closeBorderRadius:f,closeSize:m,closeMargin:h,closeMarginRtl:g,padding:_}=n,{type:y}=e,{left:b,right:x}=v(l);return{"--n-bezier":t,"--n-color":n[p(`color`,y)],"--n-close-icon-size":d,"--n-close-border-radius":f,"--n-close-color-hover":n[p(`closeColorHover`,y)],"--n-close-color-pressed":n[p(`closeColorPressed`,y)],"--n-close-icon-color":n[p(`closeIconColor`,y)],"--n-close-icon-color-hover":n[p(`closeIconColorHover`,y)],"--n-close-icon-color-pressed":n[p(`closeIconColorPressed`,y)],"--n-icon-color":n[p(`iconColor`,y)],"--n-border":n[p(`border`,y)],"--n-title-text-color":n[p(`titleTextColor`,y)],"--n-content-text-color":n[p(`contentTextColor`,y)],"--n-line-height":o,"--n-border-radius":i,"--n-font-size":r,"--n-title-font-weight":a,"--n-icon-size":c,"--n-icon-margin":l,"--n-icon-margin-rtl":u,"--n-close-size":m,"--n-close-margin":h,"--n-close-margin-rtl":g,"--n-padding":_,"--n-icon-margin-left":b,"--n-icon-margin-right":x}}),f=a?l(`alert`,i(()=>e.type[0]),d,e):void 0,g=r(!0),_=()=>{let{onAfterLeave:t,onAfterHide:n}=e;t&&t(),n&&n()};return{rtlEnabled:c,mergedClsPrefix:t,mergedBordered:n,visible:g,handleCloseClick:()=>{Promise.resolve(e.onClose?.call(e)).then(e=>{e!==!1&&(g.value=!1)})},handleAfterLeave:()=>{_()},mergedTheme:s,cssVars:a?void 0:d,themeClass:f?.themeClass,onRender:f?.onRender}},render(){var e;return(e=this.onRender)==null||e.call(this),n(w,{onAfterLeave:this.handleAfterLeave},{default:()=>{let{mergedClsPrefix:e,$slots:r}=this,i={class:[`${e}-alert`,this.themeClass,this.closable&&`${e}-alert--closable`,this.showIcon&&`${e}-alert--show-icon`,!this.title&&this.closable&&`${e}-alert--right-adjust`,this.rtlEnabled&&`${e}-alert--rtl`],style:this.cssVars,role:`alert`};return this.visible?n(`div`,Object.assign({},t(this.$attrs,i)),this.closable&&n(T,{clsPrefix:e,class:`${e}-alert__close`,onClick:this.handleCloseClick}),this.bordered&&n(`div`,{class:`${e}-alert__border`}),this.showIcon&&n(`div`,{class:`${e}-alert__icon`,"aria-hidden":`true`},y(r.icon,()=>[n(D,{clsPrefix:e},{default:()=>{switch(this.type){case`success`:return n(S,null);case`info`:return n(C,null);case`warning`:return n(x,null);case`error`:return n(E,null);default:return null}}})])),n(`div`,{class:[`${e}-alert-body`,this.mergedBordered&&`${e}-alert-body--bordered`]},_(r.header,t=>{let r=t||this.title;return r?n(`div`,{class:`${e}-alert-body__title`},r):null}),r.default&&n(`div`,{class:`${e}-alert-body__content`},r))):null}})}});export{M as t}; |