Files
prod/frontend/dist/assets/Space-CbidFwig.js
T
2026-10-27 14:53:56 +07:00

1 line
2.6 KiB
JavaScript

import{At as e,Nt as t,W as n,_ as r,ct as i,ht as a,m as o,xt as s}from"./client-DrrW410h.js";import{a as c,o as l}from"./ui-CXICC9ah.js";import{a as u}from"./Button-BZxcJJGv.js";import{t as d}from"./flatten-C6dhMlvE.js";import{t as f}from"./get-slot-6kXJmSMP.js";import{v as p}from"./index-cNEa5D1b.js";function m(){return p}var h={name:`Space`,self:m},g;function _(){if(!u)return!0;if(g===void 0){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.rowGap=`1px`,e.appendChild(document.createElement(`div`)),e.appendChild(document.createElement(`div`)),document.body.appendChild(e);let t=e.scrollHeight===1;return document.body.removeChild(e),g=t}return g}var v=e({name:`Space`,props:Object.assign(Object.assign({},o.props),{align:String,justify:{type:String,default:`start`},inline:Boolean,vertical:Boolean,reverse:Boolean,size:[String,Number,Array],wrapItem:{type:Boolean,default:!0},itemClass:String,itemStyle:[String,Object],wrap:{type:Boolean,default:!0},internalUseGap:{type:Boolean,default:void 0}}),setup(e){let{mergedClsPrefixRef:t,mergedRtlRef:a,mergedComponentPropsRef:u}=n(e),d=s(()=>e.size||u?.value?.Space?.size||`medium`),f=o(`Space`,`-space`,void 0,h,e,t),p=r(`Space`,a,t);return{useGap:_(),rtlEnabled:p,mergedClsPrefix:t,margin:s(()=>{let e=d.value;if(Array.isArray(e))return{horizontal:e[0],vertical:e[1]};if(typeof e==`number`)return{horizontal:e,vertical:e};let{self:{[i(`gap`,e)]:t}}=f.value,{row:n,col:r}=l(t);return{horizontal:c(r),vertical:c(n)}})}},render(){let{vertical:e,reverse:n,align:r,inline:i,justify:o,itemClass:s,itemStyle:c,margin:l,wrap:u,mergedClsPrefix:p,rtlEnabled:m,useGap:h,wrapItem:g,internalUseGap:_}=this,v=d(f(this),!1);if(!v.length)return null;let y=`${l.horizontal}px`,b=`${l.horizontal/2}px`,x=`${l.vertical}px`,S=`${l.vertical/2}px`,C=v.length-1,w=o.startsWith(`space-`);return t(`div`,{role:`none`,class:[`${p}-space`,m&&`${p}-space--rtl`],style:{display:i?`inline-flex`:`flex`,flexDirection:e&&!n?`column`:e&&n?`column-reverse`:!e&&n?`row-reverse`:`row`,justifyContent:[`start`,`end`].includes(o)?`flex-${o}`:o,flexWrap:!u||e?`nowrap`:`wrap`,marginTop:h||e?``:`-${S}`,marginBottom:h||e?``:`-${S}`,alignItems:r,gap:h?`${l.vertical}px ${l.horizontal}px`:``}},!g&&(h||_)?v:v.map((n,r)=>n.type===a?n:t(`div`,{role:`none`,class:s,style:[c,{maxWidth:`100%`},h?``:e?{marginBottom:r===C?``:x}:m?{marginLeft:w?o===`space-between`&&r===C?``:b:r===C?``:y,marginRight:w?o===`space-between`&&r===0?``:b:``,paddingTop:S,paddingBottom:S}:{marginRight:w?o===`space-between`&&r===C?``:b:r===C?``:y,marginLeft:w?o===`space-between`&&r===0?``:b:``,paddingTop:S,paddingBottom:S}]},n)))}});export{v as t};