{"version":3,"file":"TextStagger.CCHX5GbX.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/fNsrcVKRqL3vEY5qUi49/5ZE5lZUQNuUA5Bpph6HC/TextStagger.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Search Suggestion Animation\n * \n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function TextStagger(props){const{suggestions,animationDuration,textColor,backgroundColor,placeholderText,font,borderRadius,borderColor,showIcon,iconColor,shadow,style}=props;const[currentIndex,setCurrentIndex]=useState(0);const isStatic=useIsStaticRenderer();const intervalRef=useRef(null);useEffect(()=>{if(isStatic||suggestions.length<=1)return;const nextSuggestion=()=>{startTransition(()=>{setCurrentIndex(prevIndex=>(prevIndex+1)%suggestions.length);});};intervalRef.current=window.setInterval(nextSuggestion,animationDuration);return()=>{if(intervalRef.current!==null){clearInterval(intervalRef.current);}};},[suggestions.length,animationDuration,isStatic]);// Ensure we have a valid suggestion to display\nconst currentSuggestion=suggestions&&suggestions.length>0?suggestions[currentIndex%suggestions.length]:\"\";return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",backgroundColor,borderRadius,border:`1px solid ${borderColor}`,padding:\"0 16px\",boxSizing:\"border-box\",overflow:\"hidden\",boxShadow:shadow,...style},children:[showIcon&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",marginRight:10},children:/*#__PURE__*/_jsxs(\"svg\",{width:props.iconSize,height:props.iconSize,viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"11\",cy:\"11\",r:\"8\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"21\",y1:\"21\",x2:\"16.65\",y2:\"16.65\"})]})}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",flex:1,height:\"auto\",minHeight:props.font?.fontSize?`calc(${props.font.fontSize} * 1.2)`:\"32px\",display:\"flex\",alignItems:\"center\",overflow:\"hidden\",...font},children:[suggestions.length===0&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",color:textColor,opacity:.5},children:placeholderText}),suggestions.length>0&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",color:textColor,opacity:.5,visibility:\"hidden\"},children:placeholderText}),/*#__PURE__*/_jsx(AnimatePresence,{mode:\"wait\",children:/*#__PURE__*/_jsx(motion.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},exit:{y:-20,opacity:0},transition:{duration:.3,ease:\"easeInOut\"},style:{position:\"absolute\",color:textColor,whiteSpace:\"nowrap\",textOverflow:\"ellipsis\",overflow:\"hidden\",maxWidth:\"100%\"},children:currentSuggestion},currentIndex)})]})]})]});}addPropertyControls(TextStagger,{suggestions:{type:ControlType.Array,title:\"Suggestions\",control:{type:ControlType.String},defaultValue:[\"how to learn react\",\"framer motion tutorials\",\"best design tools 2023\",\"web animation examples\",\"ui design inspiration\"],maxCount:10},animationDuration:{type:ControlType.Number,title:\"Duration\",defaultValue:2e3,min:500,max:5e3,step:100,unit:\"ms\"},placeholderText:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Search for...\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:20,step:1},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"16px\",lineHeight:\"1.5em\",letterSpacing:\"-0.01em\",variant:\"Medium\"},controls:\"extended\",defaultFontType:\"sans-serif\"},showIcon:{type:ControlType.Boolean,title:\"Search Icon\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#999999\",hidden:({showIcon})=>!showIcon},iconSize:{type:ControlType.Number,title:\"Icon Size\",defaultValue:20,min:12,max:48,step:1,unit:\"px\",hidden:({showIcon})=>!showIcon},shadow:{type:ControlType.BoxShadow,title:\"Shadow\",defaultValue:\"0px 2px 5px rgba(0,0,0,0.1)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextStagger\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextStagger.map"],"mappings":"6cAKG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,cAAY,oBAAkB,YAAU,kBAAgB,kBAAgB,OAAK,eAAa,cAAY,WAAS,YAAU,SAAO,SAAO,EAAW,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAO,EAAS,GAAqB,CAAO,EAAYC,EAAO,KAAK,CAAC,MAAkB,GAAU,EAAY,QAAQ,EAAE,QAAwH,EAAY,QAAQ,EAAO,gBAAnH,CAAC,MAAoB,CAAC,EAAgB,IAAY,EAAU,GAAG,EAAY,OAAO,EAAG,EAAyD,EAAkB,KAAW,CAAI,EAAY,UAAU,MAAM,cAAc,EAAY,QAAQ,GAAM,CAAC,EAAY,OAAO,EAAkB,EAAS,CAAC,CAC1qB,IAAM,EAAkB,GAAa,EAAY,OAAO,EAAE,EAAY,EAAa,EAAY,QAAQ,GAAG,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,SAAS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