{"version":3,"file":"TextWrap.ceLFUTTR.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/hXrWDJxAkzCSFz0AuNpj/LCk6DtqlDAp52BwNLXxb/TextWrap.js"],"sourcesContent":["// Text wrap component that allows dynamic elements to be integrated into text layers\n// Inspired by Daniel's work - mark text with slot placeholders and attach layers for responsive integration\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function TextWrap(props){const{text=\"This is some text with a {slot} placeholder and another {slot} here.\",textColor=\"#000000\",font,gap=4,lineHeight=1.3,children}=props;const containerRef=useRef(null);const[elements,setElements]=useState([]);useEffect(()=>{if(!children){startTransition(()=>setElements([]));return;}const childArray=Array.isArray(children)?children:[children];startTransition(()=>setElements(childArray));},[children]);const renderContent=()=>{const parts=text.split(/(\\{slot\\})/g);let slotIndex=0;return parts.map((part,index)=>{if(part===\"{slot}\"){const element=elements[slotIndex];slotIndex++;if(element){return /*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",verticalAlign:\"middle\",marginLeft:gap/2,marginRight:gap/2},children:element},`slot-${index}`);}return /*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",padding:\"2px 8px\",backgroundColor:\"#f0f0f0\",borderRadius:4,fontSize:\"0.85em\",color:\"#999\",verticalAlign:\"middle\",marginLeft:gap/2,marginRight:gap/2},children:\"slot\"},`placeholder-${index}`);}return part?/*#__PURE__*/_jsx(\"span\",{children:part},`text-${index}`):null;});};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",color:textColor,lineHeight,...font,display:\"flex\",flexWrap:\"wrap\",alignItems:\"center\",justifyContent:font.textAlign===\"center\"?\"center\":font.textAlign===\"right\"?\"flex-end\":\"flex-start\"},children:renderContent()});}addPropertyControls(TextWrap,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"This is some text with a {slot} placeholder and another {slot} here.\",displayTextArea:true},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:4,min:0,max:20,step:1,unit:\"px\"},lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.3,min:1,max:2,step:.1},children:{type:ControlType.Array,title:\"Slots\",control:{type:ControlType.ComponentInstance},maxCount:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextWrap\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextWrap.map"],"mappings":"+LAKG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,OAAK,uEAAuE,YAAU,UAAU,OAAK,MAAI,EAAE,aAAW,IAAI,YAAU,EAAY,EAAaA,EAAO,IAAI,EAAO,CAAC,EAAS,GAAaC,EAAS,CAAC,CAAC,EAAE,MAAc,CAAC,GAAG,CAAC,EAAS,CAAC,MAAoB,EAAY,CAAC,CAAC,CAAC,EAAE,MAAO,CAAC,IAAM,EAAW,MAAM,QAAQ,CAAQ,EAAE,EAAS,CAAC,CAAQ,EAAE,MAAoB,EAAY,CAAU,CAAC,CAAE,EAAE,CAAC,CAAQ,CAAC,EAAE,IAAM,MAAkB,CAAC,IAAM,EAAM,EAAK,MAAM,aAAa,EAAM,EAAU,EAAE,OAAO,EAAM,KAAK,EAAK,IAAQ,CAAC,GAAG,IAAO,SAAS,CAAC,IAAM,EAAQ,EAAS,GAAiM,MAAtL,KAAe,EAA6B,EAAK,OAAO,CAAC,MAAM,C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