tw-bootstrap-grid
Version:
A Tailwind CSS plugin that adds a responsive, Bootstrap-style grid system.
2 lines (1 loc) • 2.22 kB
JavaScript
var m=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(s,n)=>(typeof require!="undefined"?require:s)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var b="--bs-global-gutter",p={x:"1.5rem",y:"0"};function C(e,s){var l,c,u,r,t;let n=`--bs-${e}-gutter`,o=e==="container"?s.containerGutters:s.rowGutters,i=(l=s.gutters)!=null?l:{},g=(u=(c=o==null?void 0:o.x)!=null?c:i.x)!=null?u:p.x,f=(t=(r=o==null?void 0:o.y)!=null?r:i.y)!=null?t:p.y;return{x:`var(${n}-x, var(${b}-x, ${g}))`,y:`var(${n}-y, var(${b}-y, ${f}))`}}var x=C;import G from"tailwindcss";var y="plugin"in G?G.plugin:m("tailwindcss/plugin"),R=y.withOptions((e={})=>({addComponents:s,theme:n})=>{let i=x("container",e),g=x("row",e),f=()=>{let r={};for(let t=1;t<=12;t++)r[`.col-${t}`]={flex:"0 0 auto",width:`${t/12*100}%`};return r},l=()=>{let r=n("spacing"),t={};return Object.entries(r).forEach(([a,d])=>{t[`.g-${a}`]={"--bs-gutter-x":d,"--bs-gutter-y":d},t[`.gx-${a}`]={"--bs-gutter-x":d},t[`.gy-${a}`]={"--bs-gutter-y":d}}),t},c=()=>{let r={};for(let t=1;t<=12;t++){let a=`${t/12*100}%`;r[`.offset-${t}`]={marginLeft:a,'[dir="rtl"] &':{marginLeft:"0",marginRight:a}}}return r},u=()=>{let r={};for(let t=0;t<=12;t++)r[`.order-${t}`]={order:`${t}`};return r[".order-first"]={order:"-9999"},r[".order-last"]={order:"9999"},r};s({".container, .container-fluid":{"--bs-gutter-x":i.x,"--bs-gutter-y":i.y,width:"100%",paddingRight:"calc(var(--bs-gutter-x, 1.5rem) * 0.5)",paddingLeft:"calc(var(--bs-gutter-x, 1.5rem) * 0.5)",marginRight:"auto",marginLeft:"auto"},".row":{"--bs-gutter-x":g.x,"--bs-gutter-y":g.y,display:"flex",flexWrap:"wrap",marginTop:"calc(-1 * var(--bs-gutter-y, 0))",marginRight:"calc(-.5 * var(--bs-gutter-x, 1.5rem))",marginLeft:"calc(-.5 * var(--bs-gutter-x, 1.5rem))","& > *":{flexShrink:"0",width:"100%",paddingRight:"calc(var(--bs-gutter-x, 1.5rem) * .5)",paddingLeft:"calc(var(--bs-gutter-x, 1.5rem) * .5)",marginTop:"var(--bs-gutter-y, 0)"}},".col":{flex:"1 0 0%"},".col-auto":{flex:"0 0 auto",width:"auto"},...f(),...l(),...c(),...u()})},()=>({name:"tw-bootstrap-grid"})),S=R;export{S as default};