{"version":3,"file":"FlipText.HoT92JsU.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/tyAz4u49nIZ1vy220L2L/X44YhYzhH0E2gT0XfY7V/FlipText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function FlipText(props){const{items,duration,fonts,boxShadow,borderRadius,padding,minWidth,transition,direction}=props;const[currentIndex,setCurrentIndex]=useState(0);const offsetY=direction===\"bottom\"?40:-40;const isFirstRender=useRef(true);useEffect(()=>{const interval=setInterval(()=>{isFirstRender.current=false;setCurrentIndex(prevIndex=>(prevIndex+1)%items.length);},duration);return()=>clearInterval(interval);},[]);return /*#__PURE__*/_jsx(motion.div,{className:\"my-box\",style:{...containerStyle,...fonts,backgroundColor:items[currentIndex].backgroundColor,color:items[currentIndex].color,boxShadow,...items[currentIndex].border,borderRadius,padding,minWidth},children:/*#__PURE__*/_jsx(AnimatePresence,{mode:\"popLayout\",initial:false,children:/*#__PURE__*/_jsx(motion.span,{initial:isFirstRender.current?false:{y:offsetY,filter:\"blur(10px)\",opacity:0},animate:{y:0,filter:\"blur(0px)\",opacity:1},exit:{y:-offsetY,filter:\"blur(10px)\",opacity:0},transition:transition,style:{display:\"inline-block\",whiteSpace:\"nowrap\"},children:items[currentIndex].title},currentIndex)})});}const containerStyle={position:\"relative\",overflow:\"hidden\",width:\"fit-content\"};addPropertyControls(FlipText,{items:{type:ControlType.Array,defaultValue:[{title:\"Flip Text 1\"},{title:\"Flip Text 2\"},{title:\"Flip Text 3\"}],control:{type:ControlType.Object,controls:{title:{type:ControlType.String},color:{type:ControlType.Color,defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Fill\",defaultValue:\"transparent\"},border:{type:ControlType.Border,defaultValue:{borderWidth:1,borderStyle:\"solid\",borderColor:\"transparent\"}}}}},duration:{type:ControlType.Number,title:\"Interval (ms)\",defaultValue:3e3,min:1e3,max:1e4,step:100,displayStepper:true},fonts:{type:ControlType.Font,defaultValue:{textAlign:\"center\",fontSize:16,letterSpacing:0,lineHeight:1,variant:\"Semibold\"},defaultFontType:\"sans-serif\",displayTextAlignment:true,displayFontSize:true,controls:\"extended\"},boxShadow:{type:ControlType.BoxShadow,title:\"Shadow\",defaultValue:\"0 1px 4px 0 rgba(0, 0, 0, 0.16)\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"6px\"},padding:{type:ControlType.Padding,defaultValue:\"8px 16px 8px 16px\"},minWidth:{type:ControlType.Number,defaultValue:0,step:10,displayStepper:true},transition:{type:ControlType.Transition,defaultValue:{type:\"spring\",stiffness:800,damping:60}},direction:{title:\"Animation Direction\",type:ControlType.Enum,options:[\"top\",\"bottom\"],optionTitles:[\"From Top\",\"From Bottom\"],defaultValue:\"top\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FlipText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FlipText.map"],"mappings":"iPAGG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,QAAM,WAAS,QAAM,YAAU,eAAa,UAAQ,WAAS,aAAW,aAAW,EAAW,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAO,EAAQ,IAAY,SAAS,GAAG,IAAU,EAAcC,EAAO,GAAK,CAAuL,OAAtL,MAAc,CAAC,IAAM,EAAS,gBAAgB,CAAC,EAAc,QAAQ,GAAM,EAAgB,IAAY,EAAU,GAAG,EAAM,OAAO,EAAG,EAAS,CAAC,UAAU,cAAc,EAAS,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAO,IAAI,CAAC,UAAU,S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