{"version":3,"file":"RolodexText.8gsMWC_n.mjs","names":["React.useRef","React.useMemo","React.useState"],"sources":["https:/framerusercontent.com/modules/sfEVILgUf8EifVoZcG9Q/kLqEmjIT9DVTF1blbpJI/RolodexText.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{AnimatePresence,motion,useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function RolodexText(props){const{staticWord,words,finalWord,trailingText,durationSeconds,intervalMilliseconds,blurAmount,headingFont,textColor,gap,alignment,replayInEditor}=props;const isStaticRenderer=useIsStaticRenderer();const containerRef=React.useRef(null);const isInView=useInView(containerRef,{amount:.35,once:false});const parsedWords=React.useMemo(()=>{const raw=words.split(/[\\n,]/g).map(item=>item.trim()).filter(Boolean);if(raw.length===0){return[\"stories\",\"archive\",\"voice\",\"culture\",\"memory\",\"people\",\"community\"];}return raw;},[words]);const sequence=React.useMemo(()=>{const hasFinal=parsedWords.some(word=>word===finalWord);return hasFinal?parsedWords:[...parsedWords,finalWord];},[parsedWords,finalWord]);const finalIndex=React.useMemo(()=>{const index=sequence.findIndex(word=>word===finalWord);return index>=0?index:sequence.length-1;},[sequence,finalWord]);// Split the trailing static text into a punctuation \"lead\" that hugs the\n// rolling word (e.g. the \".\" right after it) and the remaining words, which\n// flow as normal gap-separated tokens so the line wraps naturally.\nconst{trailingLead,trailingWords}=React.useMemo(()=>{const text=(trailingText??\"\").trim();if(!text)return{trailingLead:\"\",trailingWords:[]};const match=text.match(/^([^\\s\\w]+)?\\s*(.*)$/);const lead=match?.[1]??\"\";const rest=(match?.[2]??\"\").trim();return{trailingLead:lead,trailingWords:rest?rest.split(/\\s+/):[]};},[trailingText]);const[currentIndex,setCurrentIndex]=React.useState(0);const[isAnimating,setIsAnimating]=React.useState(false);const[hasCompleted,setHasCompleted]=React.useState(false);const shouldAnimate=!hasCompleted&&isInView&&(!isStaticRenderer||replayInEditor);React.useEffect(()=>{if(!shouldAnimate){if(!isAnimating){React.startTransition(()=>{setCurrentIndex(finalIndex);});}return;}let step=0;React.startTransition(()=>{setIsAnimating(true);setCurrentIndex(0);});const totalDuration=Math.max(.2,durationSeconds)*1e3;const baselineInterval=Math.max(60,Math.floor(intervalMilliseconds));const suggestedSteps=Math.round(totalDuration/baselineInterval);const steps=Math.max(3,suggestedSteps,sequence.length+2);const easeInOutCubic=value=>{if(value<.5)return 4*value*value*value;return 1-Math.pow(-2*value+2,3)/2;};const timeoutIds=[];for(let i=1;i<=steps;i+=1){const progress=i/steps;const easedProgress=easeInOutCubic(progress);const timeoutAt=Math.round(easedProgress*totalDuration);const stepTimeoutId=window.setTimeout(()=>{step+=1;React.startTransition(()=>{setCurrentIndex(step%Math.max(1,sequence.length));});},timeoutAt);timeoutIds.push(stepTimeoutId);}const timeoutId=window.setTimeout(()=>{React.startTransition(()=>{setCurrentIndex(finalIndex);setIsAnimating(false);setHasCompleted(true);});},totalDuration);return()=>{for(const timeoutHandle of timeoutIds){window.clearTimeout(timeoutHandle);}window.clearTimeout(timeoutId);};},[shouldAnimate,durationSeconds,intervalMilliseconds,sequence.length,finalIndex,isAnimating]);const displayWord=sequence[currentIndex]??finalWord;const justifyContent=React.useMemo(()=>{if(alignment===\"center\")return\"center\";if(alignment===\"right\")return\"flex-end\";return\"flex-start\";},[alignment]);// Each individual word swap is quick and snappy — the ease-in-out shaping the\n// WHOLE effect (slow start, fast middle, slow settle) lives in the step\n// scheduler below, not in the per-word slide. The final settle gets a touch\n// longer so it lands softly on \"community\".\nconst wordMotionTransition=React.useMemo(()=>{return{duration:isAnimating?.18:.3,ease:isAnimating?[.33,1,.68,1]:[.16,1,.3,1]};},[isAnimating]);const resolvedFontStyle=React.useMemo(()=>{const providedFontFamily=(headingFont.fontFamily??\"\").trim();const normalizedFontFamily=providedFontFamily.toLowerCase();const appearsDefaultSans=normalizedFontFamily.length===0||/inter|arial|system-ui|sans-serif/.test(normalizedFontFamily);const safeEditorialFontFamily=appearsDefaultSans?\"Playfair Display, Georgia, serif\":providedFontFamily;return{fontFamily:safeEditorialFontFamily,fontSize:headingFont.fontSize??48,fontWeight:headingFont.fontWeight??400,fontStyle:headingFont.fontStyle??\"normal\",letterSpacing:headingFont.letterSpacing??\"0em\",lineHeight:headingFont.lineHeight??\"1.2em\"};},[headingFont]);const showStaticFallbackWord=isStaticRenderer&&!replayInEditor;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",display:\"flex\",flexWrap:\"wrap\",alignItems:\"baseline\",justifyContent,columnGap:`${gap}px`,rowGap:`${Math.max(2,gap*.25)}px`,color:textColor,textAlign:alignment,overflow:\"visible\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{minWidth:\"max-content\",...resolvedFontStyle},children:staticWord}),/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",alignItems:\"baseline\",columnGap:0},children:[/*#__PURE__*/_jsxs(\"span\",{style:{position:\"relative\",display:\"inline-flex\",alignItems:\"baseline\",overflow:showStaticFallbackWord?\"visible\":\"hidden\",lineHeight:resolvedFontStyle.lineHeight,filter:showStaticFallbackWord?\"none\":`blur(${isAnimating?blurAmount:0}px)`,transition:showStaticFallbackWord?undefined:\"filter 180ms ease\"},children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":!showStaticFallbackWord,style:{visibility:showStaticFallbackWord?\"visible\":\"hidden\",whiteSpace:\"nowrap\",...resolvedFontStyle},children:finalWord}),!showStaticFallbackWord?/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",left:0,top:0,bottom:0,right:0,whiteSpace:\"nowrap\",...resolvedFontStyle},children:/*#__PURE__*/_jsx(AnimatePresence,{mode:\"popLayout\",initial:false,children:/*#__PURE__*/_jsx(motion.span,{initial:{y:\"100%\"},animate:{y:\"0%\"},exit:{y:\"-100%\"},transition:wordMotionTransition,style:{display:\"inline-block\",whiteSpace:\"nowrap\",...resolvedFontStyle},children:displayWord},displayWord)})}):null]}),trailingLead?/*#__PURE__*/_jsx(\"span\",{style:{minWidth:\"max-content\",...resolvedFontStyle},children:trailingLead}):null]}),trailingWords.map((word,wordIndex)=>/*#__PURE__*/_jsx(\"span\",{style:{minWidth:\"max-content\",...resolvedFontStyle},children:word},`${word}-${wordIndex}`))]});}addPropertyControls(RolodexText,{staticWord:{type:ControlType.String,title:\"Static Word\",defaultValue:\"Your\"},words:{type:ControlType.String,title:\"Words\",defaultValue:\"stories, archive, voice, culture, memory, people, community\",displayTextArea:true},finalWord:{type:ControlType.String,title:\"Final Word\",defaultValue:\"community\"},trailingText:{type:ControlType.String,title:\"Trailing Text\",defaultValue:\"\",placeholder:\". Your words. Your history.\",description:\"Static text after the rolling word. Leading punctuation hugs the word; the rest flows and wraps.\"},durationSeconds:{type:ControlType.Number,title:\"Duration\",defaultValue:1.3,min:.2,max:5,step:.1,unit:\"s\"},intervalMilliseconds:{type:ControlType.Number,title:\"Interval\",defaultValue:140,min:60,max:1200,step:10,unit:\"ms\"},blurAmount:{type:ControlType.Number,title:\"Blur\",defaultValue:4,min:0,max:12,step:.1,unit:\"px\"},headingFont:{type:ControlType.Font,title:\"Font\",defaultFontType:\"sans-serif\",controls:\"extended\",defaultValue:{fontSize:48,variant:\"Regular\",letterSpacing:\"0em\",lineHeight:\"1.2em\",textAlign:\"left\"}},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:12,min:0,max:64,step:1,unit:\"px\"},alignment:{type:ControlType.Enum,title:\"Align\",defaultValue:\"left\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true},replayInEditor:{type:ControlType.Boolean,title:\"Replay Editor\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RolodexText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RolodexText.map"],"mappings":"kSAGG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,aAAW,QAAM,YAAU,eAAa,kBAAgB,uBAAqB,aAAW,cAAY,YAAU,MAAI,YAAU,kBAAgB,EAAY,EAAiB,EAAoB,EAAQ,EAAaA,EAAa,IAAI,EAAQ,EAAS,EAAU,EAAa,CAAC,OAAO,IAAI,KAAK,EAAK,CAAC,EAAQ,EAAYC,MAAkB,CAAC,IAAM,EAAI,EAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,GAAM,EAAK,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAAkG,OAA7F,EAAI,SAAS,EAAS,CAAC,UAAU,UAAU,QAAQ,UAAU,SAAS,SAAS,WAAW,EAAU,CAAI,EAAE,CAAC,CAAK,CAAC,EAAQ,EAASA,MAAkC,EAAY,KAAK,GAAM,IAAO,CAAyB,EAAE,EAAY,CAAC,GAAG,EAAY,CAAS,EAAI,CAAC,EAAY,CAAS,CAAC,EAAQ,EAAWA,MAAkB,CAAC,IAAM,EAAM,EAAS,UAAU,GAAM,IAAO,CAAS,EAAE,OAAO,GAAO,EAAE,EAAM,EAAS,OAAO,CAAE,EAAE,CAAC,EAAS,CAAS,CAAC,EAG13B,CAAC,eAAa,iBAAeA,MAAkB,CAAC,IAAM,GAAM,GAAc,GAAA,CAAI,KAAK,EAAE,GAAG,CAAC,EAAK,MAAM,CAAC,aAAa,GAAG,cAAc,CAAC,CAAC,EAAE,IAAM,EAAM,EAAK,MAAM,sBAAsB,EAAQ,EAAK,IAAQ,IAAI,GAAS,GAAM,IAAQ,IAAI,GAAA,CAAI,KAAK,EAAE,MAAM,CAAC,aAAa,EAAK,cAAc,EAAK,E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