Files
xin-school/public/assets/tag-Bn-IyYw0.js
T
2026-06-17 13:08:53 +08:00

1 line
7.7 KiB
JavaScript

import{$r as e,Bi as t,Br as n,Ca as r,Ci as i,Ea as a,Ei as o,Fi as s,Ji as c,Jr as l,Li as u,Nr as d,On as f,Pr as p,Ri as m,Tr as h,Vr as g,Xr as _,Yi as v,Yr as y,_i as b,ci as x,di as S,fi as C,kn as w,pa as T,pr as E,ur as D,zi as O,zr as k}from"./index-DThTpSPU.js";var A=a(r()),j=e=>{let{paddingXXS:t,lineWidth:n,tagPaddingHorizontal:r,componentCls:i,calc:a}=e,o=a(r).sub(n).equal(),c=a(t).sub(n).equal();return{[i]:{...b(e),display:`inline-block`,height:`auto`,paddingInline:o,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:`nowrap`,backgroundColor:e.defaultBg,border:`${s(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:`start`,position:`relative`,[`&${i}-rtl`]:{direction:`rtl`},"&, a, a:hover":{color:e.defaultColor},[`${i}-close-icon`]:{marginInlineStart:c,fontSize:e.tagIconSize,color:e.colorIcon,cursor:`pointer`,transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},"&-checkable":{backgroundColor:`transparent`,borderColor:`transparent`,cursor:`pointer`,[`&:not(${i}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive},"&-disabled":{cursor:`not-allowed`,[`&:not(${i}-checkable-checked)`]:{color:e.colorTextDisabled,"&:hover":{backgroundColor:`transparent`}},[`&${i}-checkable-checked`]:{color:e.colorTextDisabled,backgroundColor:e.colorBgContainerDisabled},"&:hover, &:active":{backgroundColor:e.colorBgContainerDisabled,color:e.colorTextDisabled},[`&:not(${i}-checkable-checked):hover`]:{color:e.colorTextDisabled}},"&-group":{display:`flex`,flexWrap:`wrap`,gap:e.paddingXS}},"&-hidden":{display:`none`},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:o}},[`&${e.componentCls}-solid`]:{borderColor:`transparent`,color:e.colorTextLightSolid,backgroundColor:e.colorBgSolid,[`&${i}-default`]:{color:e.solidTextColor}},[`${i}-filled`]:{borderColor:`transparent`,backgroundColor:e.tagBorderlessBg},[`&${i}-disabled`]:{color:e.colorTextDisabled,cursor:`not-allowed`,backgroundColor:e.colorBgContainerDisabled,a:{cursor:`not-allowed`,pointerEvents:`none`,color:e.colorTextDisabled,"&:hover":{color:e.colorTextDisabled}},"a&":{"&:hover, &:active":{color:e.colorTextDisabled}},[`&${i}-outlined`]:{borderColor:e.colorBorderDisabled},[`&${i}-solid, &${i}-filled`]:{color:e.colorTextDisabled,[`${i}-close-icon`]:{color:e.colorTextDisabled}},[`${i}-close-icon`]:{cursor:`not-allowed`,color:e.colorTextDisabled,"&:hover":{color:e.colorTextDisabled}}}}},M=e=>{let{lineWidth:t,fontSizeIcon:n,calc:r}=e,i=e.fontSizeSM;return o(e,{tagFontSize:i,tagLineHeight:s(r(e.lineHeightSM).mul(i).equal()),tagIconSize:r(n).sub(r(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},N=e=>{let t=D(new E(e.colorBgSolid),`#fff`)?`#000`:`#fff`;return{defaultBg:new i(e.colorFillTertiary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText,solidTextColor:t}},P=S(`Tag`,e=>j(M(e)),N),F=A.forwardRef((e,n)=>{let{prefixCls:r,style:i,className:a,checked:o,children:s,icon:c,onChange:l,onClick:d,disabled:f,...p}=e,{getPrefixCls:m,tag:h}=A.useContext(u),g=A.useContext(k),_=f??g,v=e=>{_||(l?.(!o),d?.(e))},y=m(`tag`,r),[b,x]=P(y),S=t(y,`${y}-checkable`,{[`${y}-checkable-checked`]:o,[`${y}-checkable-disabled`]:_},h?.className,a,b,x);return A.createElement(`span`,{...p,ref:n,style:{...i,...h?.style},className:S,onClick:v},c,A.createElement(`span`,null,s))}),I=A.forwardRef((n,r)=>{let{id:i,prefixCls:a,rootClassName:o,className:s,style:u,classNames:d,styles:f,disabled:p,options:h,value:g,defaultValue:_,onChange:v,multiple:b,...x}=n,{getPrefixCls:S,direction:C,className:w,style:E,classNames:D,styles:k}=m(`tag`),j=S(`tag`,a),M=`${j}-checkable-group`,[N,I]=P(j,l(j)),[L,R]=y([D,d],[k,f],{props:n}),z=(0,A.useMemo)(()=>Array.isArray(h)?h.map(t=>e(t)?t:{value:t,label:t}):[],[h]),[B,V]=T(_,g),H=(e,t)=>{let n=null;if(b){let r=B||[];n=e?[].concat(O(r),[t.value]):r.filter(e=>e!==t.value)}else n=e?t.value:null;V(n),v?.(n)},U=A.useRef(null);(0,A.useImperativeHandle)(r,()=>({nativeElement:U.current}));let W=c(x,{aria:!0,data:!0});return A.createElement(`div`,{...W,className:t(M,w,o,{[`${M}-disabled`]:p,[`${M}-rtl`]:C===`rtl`},N,I,s,L.root),style:{...E,...R.root,...u},id:i,ref:U},z.map(e=>A.createElement(F,{key:e.value,className:t(`${M}-item`,L.item,e.className),style:{...R.item,...e.style},checked:b?(B||[]).includes(e.value):B===e.value,onChange:t=>H(t,e),disabled:p},e.label)))});function L(e,t){let{color:n,variant:r,bordered:a}=e;return A.useMemo(()=>{let e=n?.endsWith(`-inverse`),o;o=r||(e?`solid`:a===!1?`filled`:t||`filled`);let s=e?n?.replace(`-inverse`,``):n;s===void 0&&o===`solid`&&(s=`default`);let c=f(s),l=w(s),u={};if(!c&&!l&&s)if(o===`solid`)u.backgroundColor=n;else{let e=new i(s).toHsl();e.l=.95,u.backgroundColor=new i(e).toHexString(),u.color=n,o===`outlined`&&(u.borderColor=n)}return[o,s,c,l,u]},[n,r,a,t])}var R=e=>x(e,(t,{textColor:n,lightBorderColor:r,lightColor:i,darkColor:a})=>({[`${e.componentCls}${e.componentCls}-${t}:not(${e.componentCls}-disabled)`]:{[`&${e.componentCls}-outlined`]:{backgroundColor:i,borderColor:r,color:n},[`&${e.componentCls}-solid`]:{backgroundColor:a,borderColor:a,color:e.colorTextLightSolid},[`&${e.componentCls}-filled`]:{backgroundColor:i,color:n}}})),z=C([`Tag`,`preset`],e=>R(M(e)),N);function B(e){return typeof e==`string`?e.charAt(0).toUpperCase()+e.slice(1):e}var V=(e,t,n)=>{let r=B(n);return{[`${e.componentCls}${e.componentCls}-${t}:not(${e.componentCls}-disabled)`]:{[`&${e.componentCls}-outlined`]:{backgroundColor:e[`color${r}Bg`],borderColor:e[`color${r}Border`],color:e[`color${n}`]},[`&${e.componentCls}-solid`]:{backgroundColor:e[`color${n}`],borderColor:e[`color${n}`]},[`&${e.componentCls}-filled`]:{backgroundColor:e[`color${r}Bg`],color:e[`color${n}`]}}}},H=C([`Tag`,`status`],e=>{let t=M(e);return[V(t,`success`,`Success`),V(t,`processing`,`Info`),V(t,`error`,`Error`),V(t,`warning`,`Warning`)]},N),U=A.forwardRef((e,r)=>{let{prefixCls:i,className:a,rootClassName:o,style:s,children:c,icon:l,color:f,variant:b,onClose:x,bordered:S,disabled:C,href:w,target:T,styles:E,classNames:D,...O}=e,{getPrefixCls:j,direction:M,className:N,variant:F,style:I,classNames:R,styles:B}=m(`tag`),[V,U,W,G,K]=L(e,F),ee=W||G,te=A.useContext(k),q=C??te,{tag:ne}=A.useContext(u),[re,ie]=A.useState(!0),J=v(O,[`closeIcon`,`closable`]),ae={...e,color:U,variant:V,disabled:q},[Y,X]=y([R,D],[B,E],{props:ae}),oe=A.useMemo(()=>{let e={...X.root,...I,...s};return q||(e={...K,...e}),e},[X.root,I,s,K,q]),Z=j(`tag`,i),[se,ce]=P(Z),le=t(Z,N,Y.root,`${Z}-${V}`,{[`${Z}-${U}`]:ee,[`${Z}-hidden`]:!re,[`${Z}-rtl`]:M===`rtl`,[`${Z}-disabled`]:q},a,o,se,ce),Q=e=>{q||(e.stopPropagation(),x?.(e),!e.defaultPrevented&&ie(!1))},[,ue]=p(d(e),d(ne),{closable:!1,closeIconRender:e=>g(e,A.createElement(`span`,{className:t(`${Z}-close-icon`,Y.close),onClick:Q,style:X.close},e),e=>({onClick:t=>{e?.onClick?.(t),Q(t)},className:t(e?.className,`${Z}-close-icon`,Y.close),style:{...X.close,...e?.style}}))}),de=_(O.onClick)||c&&c.type===`a`,$=n(l,{className:t(A.isValidElement(l)?l.props?.className:void 0,Y.icon),style:X.icon}),fe=$?A.createElement(A.Fragment,null,$,c&&A.createElement(`span`,{className:Y.content,style:X.content},c)):c,pe=w?`a`:`span`,me=A.createElement(pe,{...J,ref:r,className:le,style:oe,href:q?void 0:w,target:T,onClick:q?void 0:J.onClick,...w&&q?{"aria-disabled":!0}:{}},fe,ue,W&&A.createElement(z,{key:`preset`,prefixCls:Z}),G&&A.createElement(H,{key:`status`,prefixCls:Z}));return de?A.createElement(h,{component:`Tag`},me):me});U.CheckableTag=F,U.CheckableTagGroup=I;export{U as t};