{"version":3,"file":"Typewriter.CSuCHQF5.mjs","names":["useState","React"],"sources":["https:/framerusercontent.com/modules/TnNVYCAkt62aPJw5NceC/X7d8QAXjKaosuoQDAbPf/Typewriter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import React,{useState,useEffect}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function TypewriterComponent(props){const{openingText,closingText,textAlignment}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const Element=props.tag;const[responsiveStyles,setResponsiveStyles]=useState({fontSize:props.font.fontSize,lineHeight:props.font.lineHeight,textAlign:textAlignment});// Update styles based on window width\nuseEffect(()=>{const updateStyles=()=>{const width=window.innerWidth;if(width<600){setResponsiveStyles({fontSize:20,lineHeight:1.2,textAlign:textAlignment});}else if(width>=600&&width<1024){setResponsiveStyles({fontSize:28,lineHeight:1.2,textAlign:textAlignment});}else{setResponsiveStyles({fontSize:30,lineHeight:1.2,textAlign:textAlignment});}};updateStyles();window.addEventListener(\"resize\",updateStyles);return()=>window.removeEventListener(\"resize\",updateStyles);},[textAlignment]);// State to control the expansion of each span\nconst[expandedStates,setExpandedStates]=useState(Array(5).fill(false));const toggleText=index=>{const newExpandedStates=Array(5).fill(false);newExpandedStates[index]=!expandedStates[index];setExpandedStates(newExpandedStates);};return /*#__PURE__*/_jsxs(Element,{style:{color:props.fontColor,margin:0,...props.font,...responsiveStyles,...props.style},children:[openingText,\" \",Array.from({length:5}).map((_,i)=>/*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsx(motion.span,{style:{backgroundColor:props[`backgroundColor${i+1}`],padding:\"0 4px\",borderRadius:\"4px\",color:props.fontColor,cursor:\"pointer\"},onClick:()=>toggleText(i),whileHover:!expandedStates[i]?{filter:\"brightness(93%)\"}:{},children:isCanvas?props[`collapsedText${i+1}`]:expandedStates[i]?props[`expandedText${i+1}`]:props[`collapsedText${i+1}`]},`span-${i}`),\"\",/*#__PURE__*/_jsx(\"span\",{children:props[`betweenText${i+1}`]},`between-text-${i}`),\" \"]},`fragment-${i}`)),closingText]});}TypewriterComponent.displayName=\"Expanding-Text\";// Property controls\naddPropertyControls(TypewriterComponent,{openingText:{type:ControlType.String,defaultValue:\"Welcome to\",placeholder:\"Opening text...\"},closingText:{type:ControlType.String,defaultValue:\"Explore our innovative solutions.\",placeholder:\"Closing text...\"},textAlignment:{type:ControlType.Enum,defaultValue:\"left\",options:[\"left\",\"center\"],optionTitles:[\"Left Aligned\",\"Center\"],displaySegmentedControl:true},...[1,2,3,4,5].reduce((acc,i)=>({...acc,[`collapsedText${i}`]:{type:ControlType.String,defaultValue:`Click me ${i}`,placeholder:`Collapsed text ${i}...`},[`expandedText${i}`]:{type:ControlType.String,defaultValue:`This is the expanded content of span ${i}.`,placeholder:`Expanded text ${i}...`},[`backgroundColor${i}`]:{type:ControlType.Color,defaultValue:\"rgba(255, 255, 0, 0.2)\"},[`betweenText${i}`]:{type:ControlType.String,defaultValue:\"\",placeholder:`Text between spans ${i}...`}}),{}),font:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4}},fontColor:{type:ControlType.Color,defaultValue:\"#000\"},tag:{type:ControlType.Enum,defaultValue:\"p\",options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypewriterComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Typewriter.map"],"mappings":"qQAGG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,cAAY,cAAY,iBAAe,EAAY,E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