{"version":3,"file":"RotatingTitle._lGJnuL7.mjs","names":["React.useRef","React.useState","React.useMemo","_Fragment"],"sources":["https:/framerusercontent.com/modules/9LgjMeVPo6va96ECUFDT/TBWX0HqFhr7UX3Ak9ATM/RotatingTitle.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function RotatingTitle(props){const{name,titles,interval,nameSize,roleSize,nameColor,roleColor,serifFont,sansFont,style}=props;const rootRef=React.useRef(null);const isInView=useInView(rootRef,{amount:.5});const isStatic=useIsStaticRenderer();const[index,setIndex]=React.useState(0);const[isTransitioning,setIsTransitioning]=React.useState(false);const[prefersReducedMotion,setPrefersReducedMotion]=React.useState(false);const safeTitles=React.useMemo(()=>{if(!Array.isArray(titles)||titles.length===0)return[\"Event Planner\"];const cleaned=titles.map(item=>`${item}`.trim()).filter(Boolean);return cleaned.length>0?cleaned:[\"Event Planner\"];},[titles]);React.useEffect(()=>{if(typeof window!==\"undefined\"&&typeof window.matchMedia===\"function\"){const mediaQuery=window.matchMedia(\"(prefers-reduced-motion: reduce)\");const sync=()=>{React.startTransition(()=>setPrefersReducedMotion(mediaQuery.matches));};sync();mediaQuery.addEventListener(\"change\",sync);return()=>mediaQuery.removeEventListener(\"change\",sync);}else{React.startTransition(()=>setPrefersReducedMotion(false));}},[]);React.useEffect(()=>{React.startTransition(()=>setIndex(0));React.startTransition(()=>setIsTransitioning(false));},[safeTitles]);const shouldAnimate=!isStatic&&!prefersReducedMotion&&safeTitles.length>1&&isInView;const transitionDurationMs=420;React.useEffect(()=>{if(!shouldAnimate)return;let slideTimeout=0;const loopId=window.setInterval(()=>{React.startTransition(()=>setIsTransitioning(true));slideTimeout=window.setTimeout(()=>{React.startTransition(()=>{setIndex(prev=>(prev+1)%safeTitles.length);setIsTransitioning(false);});},transitionDurationMs);},Math.max(800,interval));return()=>{window.clearInterval(loopId);window.clearTimeout(slideTimeout);};},[interval,safeTitles.length,shouldAnimate]);const roleAriaLabel=React.useMemo(()=>{return`Ruoli professionali: ${safeTitles.join(\", \")}`;},[safeTitles]);const currentRole=safeTitles[index]??safeTitles[0];const nextRole=safeTitles[(index+1)%safeTitles.length]??safeTitles[0];const mergedStyle=React.useMemo(()=>{return{position:\"relative\",width:170,height:38,display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",gap:3,overflow:\"hidden\",...style};},[style]);const roleBaseStyle=React.useMemo(()=>{return{margin:0,color:roleColor,textTransform:\"uppercase\",whiteSpace:\"nowrap\",...sansFont,fontSize:`${roleSize}px`,fontFamily:sansFont?.fontFamily||\"'Satoshi', sans-serif\"};},[roleColor,sansFont,roleSize]);return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:mergedStyle,\"aria-label\":roleAriaLabel,children:[/*#__PURE__*/_jsx(\"p\",{style:{margin:0,color:nameColor,whiteSpace:\"nowrap\",...serifFont,fontSize:`${nameSize}px`,fontFamily:serifFont?.fontFamily||\"'Bodoni Moda', serif\"},children:name}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",height:typeof sansFont?.lineHeight===\"number\"?`${sansFont.lineHeight}px`:sansFont?.lineHeight||\"1em\",overflow:\"hidden\"},\"aria-live\":\"polite\",children:shouldAnimate?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"p\",{style:{...roleBaseStyle,position:\"absolute\",left:0,top:0,transform:isTransitioning?\"translateY(-115%)\":\"translateY(0%)\",opacity:isTransitioning?0:1,transition:`transform ${transitionDurationMs}ms ease, opacity ${transitionDurationMs}ms ease`},children:currentRole}),/*#__PURE__*/_jsx(\"p\",{style:{...roleBaseStyle,position:\"absolute\",left:0,top:0,transform:isTransitioning?\"translateY(0%)\":\"translateY(115%)\",opacity:isTransitioning?1:0,transition:`transform ${transitionDurationMs}ms ease, opacity ${transitionDurationMs}ms ease`},children:nextRole})]}):/*#__PURE__*/_jsx(\"p\",{style:roleBaseStyle,children:currentRole})})]});}addPropertyControls(RotatingTitle,{name:{type:ControlType.String,title:\"Name\",defaultValue:\"Valentina Bucci\"},titles:{type:ControlType.Array,title:\"Titles\",control:{type:ControlType.String},defaultValue:[\"Event Planner\",\"Wedding Coordinator\",\"Wedding Planner\"],maxCount:10},interval:{type:ControlType.Number,title:\"Interval\",defaultValue:3e3,min:1e3,max:1e4,step:100,unit:\"ms\"},nameSize:{type:ControlType.Number,title:\"Name Size\",defaultValue:18,min:8,max:96,step:1,unit:\"px\"},roleSize:{type:ControlType.Number,title:\"Role Size\",defaultValue:10,min:8,max:48,step:1,unit:\"px\"},nameColor:{type:ControlType.Color,title:\"Name Color\",defaultValue:\"#000000\"},roleColor:{type:ControlType.Color,title:\"Role Color\",defaultValue:\"#CCCCCC\"},serifFont:{type:ControlType.Font,title:\"Serif Font\",defaultValue:{fontSize:\"18px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},sansFont:{type:ControlType.Font,title:\"Sans Font\",defaultValue:{fontSize:\"10px\",variant:\"Medium\",letterSpacing:\"0.08em\",lineHeight:\"1.1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RotatingTitle\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RotatingTitle.map"],"mappings":"qRAGG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,OAAK,SAAO,WAAS,WAAS,WAAS,YAAU,YAAU,YAAU,WAAS,SAAO,EAAY,EAAQA,EAAa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