{"version":3,"file":"TextScroller.DuglFej0.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/zsI5yXqVaQsX7KfdEUyq/iqv2p2s0pKaBDPX67rKx/TextScroller.js"],"sourcesContent":["// Text scroller component with scrollable text content within a fixed container\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useRef,useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function TextScroller(props){const{children,backgroundColor,textColor,font,padding,borderRadius,showScrollbar,syncGroup,enableSync,style}=props;const scrollRef=useRef(null);const isScrollingRef=useRef(false);useEffect(()=>{if(!enableSync||!syncGroup||typeof window===\"undefined\")return;const scrollElement=scrollRef.current;if(!scrollElement)return;const handleScroll=()=>{if(isScrollingRef.current)return;const scrollTop=scrollElement.scrollTop;const scrollHeight=scrollElement.scrollHeight;const clientHeight=scrollElement.clientHeight;const scrollPercentage=scrollHeight>clientHeight?scrollTop/(scrollHeight-clientHeight):0;// Broadcast scroll position to other scrollers in the same group\nconst event=new CustomEvent(`textscroller-sync-${syncGroup}`,{detail:{scrollPercentage,source:scrollElement}});window.dispatchEvent(event);};const handleSyncScroll=e=>{if(e.detail.source===scrollElement)return;isScrollingRef.current=true;const{scrollPercentage}=e.detail;const scrollHeight=scrollElement.scrollHeight;const clientHeight=scrollElement.clientHeight;const maxScroll=scrollHeight-clientHeight;if(maxScroll>0){scrollElement.scrollTop=scrollPercentage*maxScroll;}// Reset flag after a short delay\nsetTimeout(()=>{isScrollingRef.current=false;},50);};scrollElement.addEventListener(\"scroll\",handleScroll);window.addEventListener(`textscroller-sync-${syncGroup}`,handleSyncScroll);return()=>{scrollElement.removeEventListener(\"scroll\",handleScroll);window.removeEventListener(`textscroller-sync-${syncGroup}`,handleSyncScroll);};},[enableSync,syncGroup]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,borderRadius,overflow:\"hidden\"},children:/*#__PURE__*/_jsxs(\"div\",{ref:scrollRef,style:{width:\"100%\",height:\"100%\",overflowY:\"auto\",overflowX:\"hidden\",padding,boxSizing:\"border-box\",scrollbarWidth:showScrollbar?\"thin\":\"none\",msOverflowStyle:showScrollbar?\"auto\":\"none\"},className:showScrollbar?\"\":\"hide-scrollbar\",children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                        .hide-scrollbar::-webkit-scrollbar {\n                            display: none;\n                        }\n                    `}),/*#__PURE__*/_jsx(\"div\",{style:{margin:0,color:textColor,whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",overflowWrap:\"break-word\",...font},children:children})]})});}addPropertyControls(TextScroller,{children:{type:ControlType.ComponentInstance,title:\"Text\"},enableSync:{type:ControlType.Boolean,title:\"Sync Scroll\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},syncGroup:{type:ControlType.String,title:\"Sync Group\",defaultValue:\"group1\",placeholder:\"Enter group name\",hidden:({enableSync})=>!enableSync},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:20,min:0,max:50,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},showScrollbar:{type:ControlType.Boolean,title:\"Scrollbar\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextScroller\",\"slots\":[\"children\"],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContract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