{"version":3,"file":"StaggerText_v1.BsskRN7-.mjs","names":["useRef","useState","useMemo","__esmMin","_e","de","pe","c","init_jsx_runtime","init_npm_react_18_3_1","motion","useMotionValueEvent","useInView","useScroll","init_framer_motion_DhsWWWsN","addPropertyControls","init_framer_Bf4_tcb2","useIsStaticRenderer","ControlType","StaggerText","props","content","text","isStatic","ref","isHovered","setIsHovered","isElementInView","trigger","once","threshold","isViewportInView","setViewportInView","hasTriggeredRef","scrollYProgress","meetsThreshold","v","isInView","reference","items","type","totalItems","makeTransition","transition","child","hiddenIndex","index","reverse","stagger","visibleIndex","getAnimateState","Component","tag","style","align","font","i","item","init_StaggerText_v1"],"sources":["https:/framerusercontent.com/modules/uegNgXUEMBofcocJKAtQ/ZU69M8IRlsB1DMqx5bDn/StaggerText_v1.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView,useScroll,useMotionValueEvent}from\"framer-motion\";import{useMemo,useRef,useState}from\"react\";/**\n * Staggered Text\n * @framerDisableUnlink\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function StaggerText(props){const{text,type,stagger,reverse,y,x,transition,font,color,align,style,trigger,threshold,once,tag,padding,textTransform,reference}=props;const content=text||\"Build faster with Framer\";const isStatic=useIsStaticRenderer();const ref=useRef(null);const[isHovered,setIsHovered]=useState(false);// ✅ Element-based inView (unchanged)\nconst isElementInView=useInView(ref,{once:trigger===\"inView\"?once:false,amount:threshold});// ✅ Viewport-based scroll tracking (NEW)\nconst{scrollYProgress}=useScroll({target:ref,offset:[\"start end\",\"end start\"]});const[isViewportInView,setViewportInView]=useState(false);const hasTriggeredRef=useRef(false);useMotionValueEvent(scrollYProgress,\"change\",v=>{const meetsThreshold=v>=1-threshold;// If once = true → trigger only first time\nif(once){if(!hasTriggeredRef.current&&meetsThreshold){hasTriggeredRef.current=true;setViewportInView(true);}}else{// Normal behavior (replay allowed)\nsetViewportInView(meetsThreshold);}});// ✅ Final inView logic\nconst isInView=reference===\"viewport\"?isViewportInView:isElementInView;const items=useMemo(()=>{return type===\"word\"?content.split(\" \"):content.split(\"\");},[content,type]);const totalItems=items.length;const makeTransition=delay=>{return{...transition,delay};};const child={hidden:index=>{let hiddenIndex=index;if(trigger===\"hover\"){hiddenIndex=reverse?index:totalItems-1-index;}else if(reverse){hiddenIndex=totalItems-1-index;}return{opacity:0,y,x,transition:makeTransition(hiddenIndex*stagger)};},visible:index=>{const visibleIndex=reverse?totalItems-1-index:index;return{opacity:1,y:0,x:0,transition:makeTransition(visibleIndex*stagger)};}};const getAnimateState=()=>{if(isStatic)return\"visible\";if(trigger===\"appear\")return\"visible\";if(trigger===\"hover\")return isHovered?\"visible\":\"hidden\";if(trigger===\"inView\"||trigger===\"whileInView\"){return isInView?\"visible\":\"hidden\";}return\"visible\";};const Component=motion[tag];return /*#__PURE__*/_jsx(Component,{ref:ref,initial:isStatic?\"visible\":\"hidden\",animate:getAnimateState(),onMouseEnter:()=>trigger===\"hover\"&&setIsHovered(true),onMouseLeave:()=>trigger===\"hover\"&&setIsHovered(false),style:{...style,display:\"inline-block\",width:style?.width===\"100%\"?\"100%\":\"max-content\",textAlign:align,color,whiteSpace:\"normal\",wordBreak:\"break-word\",overflow:\"visible\",margin:0,padding,textTransform,...font},children:items.map((item,i)=>/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",overflow:\"clip\",marginRight:type===\"word\"?\"0.2em\":\"0\",paddingBottom:\"4px\",paddingRight:type===\"word\"?\"2px\":\"0\"},children:/*#__PURE__*/_jsx(motion.span,{custom:i,variants:child,style:{display:\"inline-block\",position:\"relative\",willChange:\"opacity, transform\"},children:item===\" \"?\"\\xa0\":item})},i))});}addPropertyControls(StaggerText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Build faster with Framer\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Medium\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},textTransform:{type:ControlType.Enum,title:\"Transform\",options:[\"none\",\"uppercase\",\"lowercase\",\"capitalize\"],optionTitles:[\"None\",\"Uppercase\",\"Lowercase\",\"Capitalize\"],defaultValue:\"none\",displaySegmentedControl:false},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"0\"},trigger:{type:ControlType.Enum,title:\"Trigger\",options:[\"appear\",\"hover\",\"inView\",\"whileInView\"],optionTitles:[\"On Appear\",\"On Hover\",\"Layer in View\",\"While in View\"],defaultValue:\"appear\"},reference:{type:ControlType.Enum,title:\"Reference\",options:[\"element\",\"viewport\"],optionTitles:[\"Element\",\"Viewport\"],defaultValue:\"element\",hidden:props=>props.trigger===\"appear\"||props.trigger===\"hover\"},threshold:{type:ControlType.Number,title:\"Threshold\",defaultValue:.2,min:0,max:1,step:.1,hidden:props=>props.trigger===\"appear\"||props.trigger===\"hover\",description:\"Element: Portion visible | Viewport: 0=Top, 0.5=Center, 1=Bottom\"},once:{type:ControlType.Boolean,title:\"Once\",defaultValue:true,hidden:props=>props.trigger!==\"inView\"},type:{type:ControlType.Enum,title:\"Split\",options:[\"word\",\"char\"],optionTitles:[\"Words\",\"Characters\"],defaultValue:\"word\"},stagger:{type:ControlType.Number,title:\"Stagger\",defaultValue:.08,min:0,max:.5,step:.01},reverse:{type:ControlType.Boolean,title:\"Reverse\",defaultValue:false},x:{type:ControlType.Number,title:\"Offset X\",defaultValue:0,min:-200,max:200},y:{type:ControlType.Number,title:\"Offset Y\",defaultValue:20,min:-200,max:200},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{type:\"tween\",duration:.4,ease:\"easeOut\"}},tag:{type:ControlType.Enum,title:\"Tag\",options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],defaultValue:\"p\",displaySegmentedControl:false,description:\"More components at [Framerize](https://dub.sh/frmze-cc).\"}});StaggerText.displayName=\"Stagger Text v1\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"StaggerText\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"60\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./StaggerText_v1.map"],"mappings":"A,uQASG,SAAwBmB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,UAAQ,UAAQ,IAAE,IAAE,aAAW,OAAK,QAAM,QAAM,QAAM,UAAQ,YAAU,OAAK,MAAI,UAAQ,gBAAc,aAAWC,EAAYC,EAAQC,GAAM,2BAAiCC,EAASN,EAAoB,EAAQO,EAAIxB,EAAO,IAAI,EAAO,CAACyB,EAAUC,GAAczB,EAAS,EAAK,EACvU0B,EAAgBf,EAAUY,EAAI,CAAC,KAAKI,IAAU,UAASC,EAAW,OAAOC,CAAS,CAAC,EACpF,CAAC,mBAAiBjB,EAAU,CAAC,OAAOW,EAAI,OAAO,CAAC,YAAY,WAAW,CAAC,CAAC,EAAO,CAACO,EAAiBC,GAAmB/B,EAAS,EAAK,EAAQgC,EAAgBjC,EAAO,EAAK,EAAEW,EAAoBuB,EAAgB,SAAS,GAAG,CAAC,IAAMC,EAAeC,GAAG,EAAEN,EACtPD,EAAS,CAACI,EAAgB,SAASE,IAAgB,EAAgB,QAAQ,GAAKH,EAAkB,EAAI,GACzGA,EAAkBG,CAAc,CAAG,CAAC,EACpC,IAAME,EAASC,IAAY,WAAWP,EAAiB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