{"version":3,"file":"TextRotation.fBXOLMeB.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/HabBqLGVvnHvZUUHKBz0/ee2QoOEydvvkaF0j3f9p/TextRotation.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{motion,AnimatePresence}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export default function TextRotation(props){const{staticText,phrases,interval,animationMode,animationStyle,loop,pauseOnHover,font,staticColor,color}=props;const safePhrases=phrases.length>0?phrases:[\"Text\"];const[index,setIndex]=React.useState(0);const[paused,setPaused]=React.useState(false);React.useEffect(()=>{if(paused)return;if(!loop&&index===safePhrases.length-1)return;const id=setTimeout(()=>{setIndex(i=>(i+1)%safePhrases.length);},interval);return()=>clearTimeout(id);},[index,interval,loop,paused,safePhrases.length]);const text=safePhrases[index];const units=animationMode===\"character\"?Array.from(text):animationMode===\"word\"?text.split(\" \").map((w,i,arr)=>i<arr.length-1?w+\" \":w):[text];const motionVariants={slideUp:{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16}},slideDown:{initial:{opacity:0,y:-16},animate:{opacity:1,y:0},exit:{opacity:0,y:16}},fade:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}};return /*#__PURE__*/_jsxs(\"div\",{\"aria-live\":\"polite\",onMouseEnter:()=>pauseOnHover&&setPaused(true),onMouseLeave:()=>pauseOnHover&&setPaused(false),style:{...font,display:\"inline-flex\",alignItems:\"center\"},children:[staticText&&/*#__PURE__*/_jsx(\"span\",{style:{marginRight:6,color:staticColor,whiteSpace:\"pre\"},children:staticText}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"relative\",display:\"inline-block\",overflow:\"hidden\",lineHeight:1.25},children:/*#__PURE__*/_jsx(AnimatePresence,{mode:\"wait\",children:/*#__PURE__*/_jsx(motion.span,{...motionVariants[animationStyle],transition:{duration:.4,ease:\"easeOut\"},style:{display:\"inline-block\",whiteSpace:\"nowrap\",color},children:units.map((unit,i)=>/*#__PURE__*/_jsx(motion.span,{initial:animationMode===\"phrase\"?false:{opacity:0,y:8},animate:animationMode===\"phrase\"?{}:{opacity:1,y:0},transition:{delay:animationMode===\"phrase\"?0:i*.04},style:{display:\"inline-block\",whiteSpace:\"pre\"},children:unit},i))},text+index)})})]});}TextRotation.defaultProps={staticText:\"I like\",phrases:[\"apples\",\"mangoes\",\"oranges\"],interval:2e3,animationMode:\"phrase\",animationStyle:\"slideUp\",loop:true,pauseOnHover:false,staticColor:\"#666\",color:\"#000\"};addPropertyControls(TextRotation,{staticText:{type:ControlType.String,title:\"Static Text\"},phrases:{type:ControlType.Array,title:\"Rotating Text\",control:{type:ControlType.String}},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\"},interval:{type:ControlType.Number,title:\"Interval\",min:500,max:8e3,unit:\"ms\"},animationMode:{type:ControlType.Enum,title:\"Animate By\",options:[\"phrase\",\"word\",\"character\"]},animationStyle:{type:ControlType.Enum,title:\"Style\",options:[\"slideUp\",\"slideDown\",\"fade\"]},loop:{type:ControlType.Boolean,title:\"Loop\"},pauseOnHover:{type:ControlType.Boolean,title:\"Pause on Hover\"},staticColor:{type:ControlType.Color,title:\"Static Color\"},color:{type:ControlType.Color,title:\"Rotate Color\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextRotation\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextRotation.map"],"mappings":"iPAA2L,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAW,UAAQ,WAAS,gBAAc,iBAAe,OAAK,eAAa,OAAK,cAAY,SAAO,EAAY,EAAY,EAAQ,OAAO,EAAE,EAAQ,CAAC,MAAM,EAAO,CAAC,EAAM,GAAUA,EAAe,CAAC,EAAO,CAAC,EAAO,GAAWA,EAAe,EAAK,EAAE,MAAoB,CAAk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