Files
prod/frontend/dist/assets/Alert-4b17tSP6.js
T
2026-10-14 10:26:13 +07:00

48 lines
6.9 KiB
JavaScript

import{H as e,Lt as t,Mt as n,U as r,X as i,Z as a,at as o,bt as s,d as c,g as l,hn as u,it as d,kt as f,nt as p,p as m,st as h,tt as g}from"./client-CAcbOpZH.js";import{o as _}from"./es-CkktpxoG.js";import{i as v,o as y}from"./_plugin-vue_export-helper-CktLkZ_U.js";import{A as b,B as x,G as S,H as C,J as w,U as T,W as E,j as D,z as O}from"./index-7R9tWZyL.js";function k(e){let{lineHeight:t,borderRadius:n,fontWeightStrong:r,baseColor:o,dividerColor:s,actionColor:c,textColor1:l,textColor2:u,closeColorHover:d,closeColorPressed:f,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:h,infoColor:g,successColor:_,warningColor:v,errorColor:y,fontSize:b}=e;return Object.assign(Object.assign({},D),{fontSize:b,lineHeight:t,titleFontWeight:r,borderRadius:n,border:`1px solid ${s}`,color:c,titleTextColor:l,iconColor:u,contentTextColor:u,closeBorderRadius:n,closeColorHover:d,closeColorPressed:f,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:h,borderInfo:`1px solid ${a(o,i(g,{alpha:.25}))}`,colorInfo:a(o,i(g,{alpha:.08})),titleTextColorInfo:l,iconColorInfo:g,contentTextColorInfo:u,closeColorHoverInfo:d,closeColorPressedInfo:f,closeIconColorInfo:p,closeIconColorHoverInfo:m,closeIconColorPressedInfo:h,borderSuccess:`1px solid ${a(o,i(_,{alpha:.25}))}`,colorSuccess:a(o,i(_,{alpha:.08})),titleTextColorSuccess:l,iconColorSuccess:_,contentTextColorSuccess:u,closeColorHoverSuccess:d,closeColorPressedSuccess:f,closeIconColorSuccess:p,closeIconColorHoverSuccess:m,closeIconColorPressedSuccess:h,borderWarning:`1px solid ${a(o,i(v,{alpha:.33}))}`,colorWarning:a(o,i(v,{alpha:.08})),titleTextColorWarning:l,iconColorWarning:v,contentTextColorWarning:u,closeColorHoverWarning:d,closeColorPressedWarning:f,closeIconColorWarning:p,closeIconColorHoverWarning:m,closeIconColorPressedWarning:h,borderError:`1px solid ${a(o,i(y,{alpha:.25}))}`,colorError:a(o,i(y,{alpha:.08})),titleTextColorError:l,iconColorError:y,contentTextColorError:u,closeColorHoverError:d,closeColorPressedError:f,closeIconColorError:p,closeIconColorHoverError:m,closeIconColorPressedError:h})}var A={name:`Alert`,common:c,self:k},j=p(`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;
`,[d(`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;
`),o(`closable`,[p(`alert-body`,[d(`title`,`
padding-right: 24px;
`)])]),d(`icon`,{color:`var(--n-icon-color)`}),p(`alert-body`,{padding:`var(--n-padding)`},[d(`title`,{color:`var(--n-title-text-color)`}),d(`content`,{color:`var(--n-content-text-color)`})]),b({originalTransition:`transform .3s var(--n-bezier)`,enterToProps:{transform:`scale(1)`},leaveToProps:{transform:`scale(0.9)`}}),d(`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);
`),d(`close`,`
transition:
color .3s var(--n-bezier),
background-color .3s var(--n-bezier);
position: absolute;
right: 0;
top: 0;
margin: var(--n-close-margin);
`),o(`show-icon`,[p(`alert-body`,{paddingLeft:`calc(var(--n-icon-margin-left) + var(--n-icon-size) + var(--n-icon-margin-right))`})]),o(`right-adjust`,[p(`alert-body`,{paddingRight:`calc(var(--n-close-size) + var(--n-padding) + 2px)`})]),p(`alert-body`,`
border-radius: var(--n-border-radius);
transition: border-color .3s var(--n-bezier);
`,[d(`title`,`
transition: color .3s var(--n-bezier);
font-size: 16px;
line-height: 19px;
font-weight: var(--n-title-font-weight);
`,[g(`& +`,[d(`content`,{marginTop:`9px`})])]),d(`content`,{transition:`color .3s var(--n-bezier)`,fontSize:`var(--n-font-size)`})]),d(`icon`,{transition:`color .3s var(--n-bezier)`})]),M=f({name:`Alert`,inheritAttrs:!1,props:Object.assign(Object.assign({},m.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(t){let{mergedClsPrefixRef:n,mergedBorderedRef:i,inlineThemeDisabled:a,mergedRtlRef:o}=r(t),c=m(`Alert`,`-alert`,j,A,t,n),d=l(`Alert`,o,n),f=s(()=>{let{common:{cubicBezierEaseInOut:e},self:n}=c.value,{fontSize:r,borderRadius:i,titleFontWeight:a,lineHeight:o,iconSize:s,iconMargin:l,iconMarginRtl:u,closeIconSize:d,closeBorderRadius:f,closeSize:p,closeMargin:m,closeMarginRtl:g,padding:v}=n,{type:y}=t,{left:b,right:x}=_(l);return{"--n-bezier":e,"--n-color":n[h(`color`,y)],"--n-close-icon-size":d,"--n-close-border-radius":f,"--n-close-color-hover":n[h(`closeColorHover`,y)],"--n-close-color-pressed":n[h(`closeColorPressed`,y)],"--n-close-icon-color":n[h(`closeIconColor`,y)],"--n-close-icon-color-hover":n[h(`closeIconColorHover`,y)],"--n-close-icon-color-pressed":n[h(`closeIconColorPressed`,y)],"--n-icon-color":n[h(`iconColor`,y)],"--n-border":n[h(`border`,y)],"--n-title-text-color":n[h(`titleTextColor`,y)],"--n-content-text-color":n[h(`contentTextColor`,y)],"--n-line-height":o,"--n-border-radius":i,"--n-font-size":r,"--n-title-font-weight":a,"--n-icon-size":s,"--n-icon-margin":l,"--n-icon-margin-rtl":u,"--n-close-size":p,"--n-close-margin":m,"--n-close-margin-rtl":g,"--n-padding":v,"--n-icon-margin-left":b,"--n-icon-margin-right":x}}),p=a?e(`alert`,s(()=>t.type[0]),f,t):void 0,g=u(!0),v=()=>{let{onAfterLeave:e,onAfterHide:n}=t;e&&e(),n&&n()};return{rtlEnabled:d,mergedClsPrefix:n,mergedBordered:i,visible:g,handleCloseClick:()=>{Promise.resolve(t.onClose?.call(t)).then(e=>{e!==!1&&(g.value=!1)})},handleAfterLeave:()=>{v()},mergedTheme:c,cssVars:a?void 0:f,themeClass:p?.themeClass,onRender:p?.onRender}},render(){var e;return(e=this.onRender)==null||e.call(this),n(O,{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(x,{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`},v(r.icon,()=>[n(w,{clsPrefix:e},{default:()=>{switch(this.type){case`success`:return n(T,null);case`info`:return n(E,null);case`warning`:return n(C,null);case`error`:return n(S,null);default:return null}}})])),n(`div`,{class:[`${e}-alert-body`,this.mergedBordered&&`${e}-alert-body--bordered`]},y(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};