UNPKG

@jengaui/layout

Version:

Jenga UI Layout component in React

9 lines (6 loc) 840 B
import { forwardRef, useEffect } from 'react'; import { tasty, extractStyles, CONTAINER_STYLES, filterBaseProps, parseStyle } from 'tastycss'; import { useCombinedRefs } from '@jengaui/utils'; import { jsx } from 'react/jsx-runtime'; var m=tasty({element:"Suffix",styles:{position:"absolute",display:"grid",placeContent:"stretch",placeItems:"center",flow:"column",gap:0,right:"@suffix-gap",top:"@suffix-gap",bottom:"@suffix-gap",color:"#dark.75",height:"(100% - (2 * @suffix-gap))"}}),B=forwardRef(function(s,f){let{onWidthChange:t,outerGap:i="1bw",children:o,...r}=s,n=extractStyles(r,CONTAINER_STYLES),e=useCombinedRefs(f);return useEffect(()=>{e&&e.current&&t&&t(e.current.offsetWidth);},[o,e,t]),jsx(m,{...filterBaseProps(r,{eventProps:!0}),ref:e,styles:n,style:{"--suffix-gap":parseStyle(i).value},children:o})}); export { B as a };