@jengaui/layout
Version:
Jenga UI Layout component in React
9 lines (6 loc) • 865 B
JavaScript
import { forwardRef } from 'react';
import { tasty, extractStyles, CONTAINER_STYLES, filterBaseProps, parseStyle } from 'tastycss';
import { useCombinedRefs, useLayoutEffect } from '@jengaui/utils';
import { jsx } from 'react/jsx-runtime';
var m=tasty({element:"Prefix",styles:{position:"absolute",display:"grid",placeContent:"stretch",placeItems:"center",flow:"column",gap:0,left:"@prefix-gap",top:"@prefix-gap",bottom:"@prefix-gap",color:"#dark.75",height:"(100% - (2 * @prefix-gap))"}}),B=forwardRef(function(p,s){let{onWidthChange:t,outerGap:i="1bw",children:r,...o}=p,n=extractStyles(o,CONTAINER_STYLES),e=useCombinedRefs(s);return useLayoutEffect(()=>{(e==null?void 0:e.current)&&t&&t(e.current.offsetWidth);},[r,e,t]),jsx(m,{...filterBaseProps(o,{eventProps:!0}),ref:e,styles:n,style:{"--prefix-gap":parseStyle(i).value},children:r})});
export { B as a };