1 line
4.5 KiB
JavaScript
1 line
4.5 KiB
JavaScript
import{n as e}from"./rolldown-runtime-Dl_DZoUm.js";import{$n as t,Wt as n,Xn as r,cn as i,gt as a,ht as o,lt as s,tn as c,tr as l,un as u}from"./index-CPt4N9y-.js";var d=e(l()),f=e(t());function p(e){return[`small`,`middle`,`large`].includes(e)}function m(e){return e?typeof e==`number`&&!Number.isNaN(e):!1}var h=e=>{let{componentCls:t,borderRadius:n,paddingSM:r,colorBorder:i,paddingXS:a,fontSizeLG:o,fontSizeSM:c,borderRadiusLG:l,borderRadiusSM:u,colorBgContainerDisabled:d,lineWidth:f}=e;return{[t]:[{display:`inline-flex`,alignItems:`center`,gap:0,paddingInline:r,margin:0,background:d,borderWidth:f,borderStyle:`solid`,borderColor:i,borderRadius:n,"&-large":{fontSize:o,borderRadius:l},"&-small":{paddingInline:a,borderRadius:u,fontSize:c},"&-compact-last-item":{borderEndStartRadius:0,borderStartStartRadius:0},"&-compact-first-item":{borderEndEndRadius:0,borderStartEndRadius:0},"&-compact-item:not(:first-child):not(:last-child)":{borderRadius:0},"&-compact-item:not(:last-child)":{borderInlineEndWidth:0}},s(e,{focus:!1})]}},g=n([`Space`,`Addon`],e=>[h(e)]),_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},v=d.forwardRef((e,t)=>{let{className:n,children:r,style:o,prefixCls:s}=e,c=_(e,[`className`,`children`,`style`,`prefixCls`]),{getPrefixCls:l,direction:u}=d.useContext(i),p=l(`space-addon`,s),[m,h,v]=g(p),{compactItemClassnames:y,compactSize:b}=a(p,u),x=(0,f.default)(p,h,y,v,{[`${p}-${b}`]:b},n);return m(d.createElement(`div`,Object.assign({ref:t,className:x,style:o},c),r))}),y=d.createContext({latestIndex:0}),b=y.Provider,x=({className:e,index:t,children:n,split:r,style:i})=>{let{latestIndex:a}=d.useContext(y);return n==null?null:d.createElement(d.Fragment,null,d.createElement(`div`,{className:e,style:i},n),t<a&&r&&d.createElement(`span`,{className:`${e}-split`},r))},S=e=>{let{componentCls:t,antCls:n}=e;return{[t]:{display:`inline-flex`,"&-rtl":{direction:`rtl`},"&-vertical":{flexDirection:`column`},"&-align":{flexDirection:`column`,"&-center":{alignItems:`center`},"&-start":{alignItems:`flex-start`},"&-end":{alignItems:`flex-end`},"&-baseline":{alignItems:`baseline`}},[`${t}-item:empty`]:{display:`none`},[`${t}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:`block`}}}},C=e=>{let{componentCls:t}=e;return{[t]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}},w=n(`Space`,e=>{let t=c(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[S(t),C(t)]},()=>({}),{resetStyle:!1}),T=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},E=d.forwardRef((e,t)=>{let{getPrefixCls:n,direction:i,size:a,className:o,style:s,classNames:c,styles:l}=u(`space`),{size:h=a??`small`,align:g,className:_,rootClassName:v,children:y,direction:S=`horizontal`,prefixCls:C,split:E,style:D,wrap:O=!1,classNames:k,styles:A}=e,j=T(e,[`size`,`align`,`className`,`rootClassName`,`children`,`direction`,`prefixCls`,`split`,`style`,`wrap`,`classNames`,`styles`]),[M,N]=Array.isArray(h)?h:[h,h],P=p(N),F=p(M),I=m(N),L=m(M),R=r(y,{keepEmpty:!0}),z=g===void 0&&S===`horizontal`?`center`:g,B=n(`space`,C),[V,H,U]=w(B),W=(0,f.default)(B,o,H,`${B}-${S}`,{[`${B}-rtl`]:i===`rtl`,[`${B}-align-${z}`]:z,[`${B}-gap-row-${N}`]:P,[`${B}-gap-col-${M}`]:F},_,v,U),G=(0,f.default)(`${B}-item`,k?.item??c.item),K=Object.assign(Object.assign({},l.item),A?.item),q=R.map((e,t)=>{let n=e?.key||`${G}-${t}`;return d.createElement(x,{className:G,key:n,index:t,split:E,style:K},e)}),J=d.useMemo(()=>({latestIndex:R.reduce((e,t,n)=>t==null?e:n,0)}),[R]);if(R.length===0)return null;let Y={};return O&&(Y.flexWrap=`wrap`),!F&&L&&(Y.columnGap=M),!P&&I&&(Y.rowGap=N),V(d.createElement(`div`,Object.assign({ref:t,className:W,style:Object.assign(Object.assign(Object.assign({},Y),s),D)},j),d.createElement(b,{value:J},q)))});E.Compact=o,E.Addon=v;export{E as t}; |