{"version":3,"file":"ScrollFillText.Db-bdgjs.mjs","names":["useRef","c","__esmMin","de","c","init_jsx_runtime","init_npm_react_18_3_1","useTransform","useScroll","useSpring","init_framer_motion_DhsWWWsN","motion","init_framer_DKtAEkcX","addPropertyControls","ControlType","ScrollFillText","props","ref","start","end","progress","scrollYProgress","words","text","accent","accentText","w","align","font","key","Word","i","dimColor","accentColor","color","a","index","total","b","c$1","dim","full","word","init_ScrollFillText"],"sources":["https:/framerusercontent.com/modules/MCBPnYkH0UyKrYuKhpEB/R8zzV7hUkA8It7qAT0zR/ScrollFillText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useTransform,useSpring}from\"framer-motion\";import{useRef}from\"react\";/**\n * Scroll Fill Text — words fill from a dim colour to the full colour as the block scrolls through the viewport.\n *\n * @framerIntrinsicWidth 900\n * @framerIntrinsicHeight 200\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight auto\n */export default function ScrollFillText(props){const{text,font,color,dimColor,accentText,accentColor,start,end,align}=props;const ref=useRef(null);const{scrollYProgress}=useScroll({target:ref,offset:[`start ${start}`,`end ${end}`]});const progress=useSpring(scrollYProgress,{stiffness:120,damping:30,mass:.4});const words=text.split(/\\s+/).filter(Boolean);const accent=new Set(accentText.split(/\\s+/).filter(Boolean).map(w=>w.toLowerCase().replace(/[^a-z0-9%]/g,\"\")));return /*#__PURE__*/_jsx(\"p\",{ref:ref,style:{...props.style,margin:0,textAlign:align,...font,display:\"flex\",flexWrap:\"wrap\",justifyContent:align===\"center\"?\"center\":\"flex-start\",columnGap:\"0.25em\"},children:words.map((w,i)=>{const key=w.toLowerCase().replace(/[^a-z0-9%]/g,\"\");return /*#__PURE__*/_jsx(Word,{word:w,index:i,total:words.length,progress:progress,dim:dimColor,full:accent.has(key)?accentColor:color},i);})});}function Word(props){const{word,index,total,progress,dim,full}=props;const a=index/total;const b=Math.min(1,a+1.5/total);const c=useTransform(progress,[a,b],[dim,full]);return /*#__PURE__*/_jsx(motion.span,{style:{color:c,display:\"inline-block\"},children:word});}addPropertyControls(ScrollFillText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"We take the complexity out of fluid systems so your crews can stay on the work that pays.\",displayTextArea:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"56px\",variant:\"Light\",letterSpacing:\"-0.025em\",lineHeight:\"1.08em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#061B31\"},dimColor:{type:ControlType.Color,title:\"Dim Color\",defaultValue:\"#D4DEE9\"},accentText:{type:ControlType.String,title:\"Accent Words\",defaultValue:\"\"},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#533AFD\"},start:{type:ControlType.Number,title:\"Start\",defaultValue:.85,min:0,max:1,step:.05},end:{type:ControlType.Number,title:\"End\",defaultValue:.45,min:0,max:1,step:.05},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\"],defaultValue:\"left\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollFillText\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"900\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollFillText.map"],"mappings":"A,gPAOG,SAAwBe,EAAe,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,QAAM,WAAS,aAAW,cAAY,QAAM,MAAI,SAAOC,EAAYC,EAAIjB,EAAO,IAAI,EAAO,CAAC,mBAAiBQ,EAAU,CAAC,OAAOS,EAAI,OAAO,CAAC,SAASC,IAAQ,OAAOC,GAAK,CAAC,CAAC,EAAQC,EAASX,EAAUY,EAAgB,CAAC,UAAU,IAAI,QAAQ,GAAG,KA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