{"version":3,"file":"Drag_Slider_Cursor.C0Py1ph3.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/SBSpP1vtwJZwJ0T5mPqg/yTGYTRgtUlyK8io3pH6F/Drag_Slider_Cursor.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useState,useEffect}from\"react\";import{motion,useMotionValue,animate}from\"framer-motion\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * DragSlider Component\n * A fluid, draggable horizontal slider with custom cursor and navigation arrows.\n * * Helper Instructions:\n * 1. \"Items\": Connect component instances (like cards or images) to populate the slider.\n * 2. \"Enable Hover\": Toggle this to unlock custom background and arrow color settings.\n * 3. \"Positioning\": Use \"Arrow Position\" to align the controls relative to the slider.\n * 4. \"Fluidity\": The slider uses spring physics; adjust \"Gap\" and \"Padding\" for spacing.\n */export default function DragSlider(props){const{items,gap,arrowColor,padding,arrowStroke,cursorText,zIndex,arrowPosition,enableHover,hoverBgColor,hoverArrowColor}=props;const isStatic=useIsStaticRenderer();const constraintsRef=useRef(null);const[contentWidth,setContentWidth]=useState(0);const[isHovered,setIsHovered]=useState(false);const[isDragging,setIsDragging]=useState(false);const[hoveredBtn,setHoveredBtn]=useState(null);const x=useMotionValue(0);const mouseX=useMotionValue(0);const mouseY=useMotionValue(0);useEffect(()=>{if(isStatic)return;const updateWidth=()=>{if(constraintsRef.current){const scrollWidth=constraintsRef.current.scrollWidth;const offsetWidth=constraintsRef.current.offsetWidth;setContentWidth(Math.max(0,scrollWidth-offsetWidth));}};updateWidth();window.addEventListener(\"resize\",updateWidth);return()=>window.removeEventListener(\"resize\",updateWidth);},[items,gap,isStatic]);const handleArrow=direction=>{if(isStatic)return;const currentX=x.get();const moveAmount=600;let targetX=direction===\"next\"?currentX-moveAmount:currentX+moveAmount;targetX=Math.max(Math.min(targetX,0),-contentWidth);animate(x,targetX,{type:\"spring\",bounce:.1,duration:.8});};if(!items||items.length===0)return /*#__PURE__*/_jsx(\"div\",{style:placeholderStyle,children:\"Connect cards in Items list\"});// Static fallback: Render items without motion or drag\nif(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{...containerStyle,zIndex:zIndex},children:/*#__PURE__*/_jsx(\"div\",{style:{...trackStyle,gap:`${gap}px`,paddingLeft:`${padding}px`},children:items.map((item,index)=>/*#__PURE__*/_jsx(\"div\",{style:itemWrapperStyle,children:item},index))})});}return /*#__PURE__*/_jsxs(\"div\",{style:{...containerStyle,zIndex:zIndex},ref:constraintsRef,children:[/*#__PURE__*/_jsx(motion.div,{style:{...cursorStyle,left:mouseX,top:mouseY,opacity:isHovered?1:0,scale:isHovered?isDragging?.7:1:0},children:cursorText}),/*#__PURE__*/_jsx(motion.div,{drag:\"x\",dragConstraints:{left:-contentWidth-padding,right:padding},dragElastic:.15,onDragStart:()=>setIsDragging(true),onDragEnd:()=>setIsDragging(false),onMouseMove:e=>{const rect=constraintsRef.current?.getBoundingClientRect();if(rect){mouseX.set(e.clientX-rect.left);mouseY.set(e.clientY-rect.top);}},onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),dragTransition:{power:.4,timeConstant:250,restDelta:.5},style:{x,...trackStyle,gap:`${gap}px`,paddingLeft:`${padding}px`},children:items.map((item,index)=>/*#__PURE__*/_jsx(\"div\",{style:{...itemWrapperStyle,pointerEvents:isDragging?\"none\":\"auto\"},onDragStart:e=>e.preventDefault(),children:item},index))}),/*#__PURE__*/_jsx(\"div\",{style:getArrowGroupStyle(arrowPosition),children:[\"prev\",\"next\"].map(dir=>/*#__PURE__*/_jsx(\"button\",{\"aria-label\":dir===\"prev\"?\"Previous slide\":\"Next slide\",onMouseEnter:()=>enableHover&&setHoveredBtn(dir),onMouseLeave:()=>setHoveredBtn(null),onClick:()=>handleArrow(dir),style:{width:\"56px\",height:\"56px\",borderRadius:\"50%\",border:`${arrowStroke}px solid ${arrowColor}`,background:enableHover&&hoveredBtn===dir?hoverBgColor:\"transparent\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",outline:\"none\",transition:\"background-color 0.2s ease, border-color 0.2s ease\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:enableHover&&hoveredBtn===dir?hoverArrowColor:arrowColor,strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:/*#__PURE__*/_jsx(\"path\",{d:dir===\"prev\"?\"M15 18l-6-6 6-6\":\"M9 18l6-6-6-6\"})})},dir))})]});}const getArrowGroupStyle=position=>{const base={display:\"flex\",gap:\"12px\",padding:\"20px\",zIndex:3};const posMap={\"top-left\":{justifyContent:\"flex-start\",order:-1},\"top-right\":{justifyContent:\"flex-end\",order:-1},\"bottom-right\":{justifyContent:\"flex-end\"},\"bottom-left\":{justifyContent:\"flex-start\"}};return{...base,...posMap[position]};};const containerStyle={width:\"100%\",overflow:\"hidden\",display:\"flex\",flexDirection:\"column\",position:\"relative\"};const trackStyle={display:\"flex\",width:\"max-content\",paddingTop:\"20px\",paddingBottom:\"20px\",cursor:\"none\"};const cursorStyle={position:\"absolute\",width:\"80px\",height:\"80px\",backgroundColor:\"rgba(255, 255, 255, 0.2)\",backdropFilter:\"blur(10px)\",borderRadius:\"50%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"white\",fontSize:\"11px\",fontWeight:\"800\",textTransform:\"uppercase\",zIndex:2,pointerEvents:\"none\",marginLeft:\"-40px\",marginTop:\"-40px\"};const itemWrapperStyle={flex:\"0 0 auto\",userSelect:\"none\"};const placeholderStyle={width:\"100%\",height:\"200px\",border:\"1px dashed #444\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#888\"};addPropertyControls(DragSlider,{items:{title:\"Items\",type:ControlType.Array,control:{type:ControlType.ComponentInstance},description:\"Add the components you want to display in the slider.\"},enableHover:{title:\"Enable Hover\",type:ControlType.Boolean,defaultValue:true,description:\"Turns on interactive hover states for the navigation arrows.\"},arrowColor:{title:\"Arrow Color\",type:ControlType.Color,defaultValue:\"#D4B144\",description:\"The default color of the navigation arrow icons.\"},arrowStroke:{title:\"Stroke\",type:ControlType.Number,defaultValue:2,description:\"Thickness of the arrow icon line.\"},hoverBgColor:{title:\"Hover BG Color\",type:ControlType.Color,defaultValue:\"#FFFFFF\",hidden:props=>props.enableHover===false,description:\"Background color of the arrow button when hovered.\"},hoverArrowColor:{title:\"Hover Arrow Color\",type:ControlType.Color,defaultValue:\"#000000\",hidden:props=>props.enableHover===false,description:\"Color of the arrow icon when the button is hovered.\"},arrowPosition:{title:\"Arrow Position\",type:ControlType.Enum,options:[\"bottom-left\",\"bottom-right\",\"top-left\",\"top-right\"],optionTitles:[\"Bottom Left\",\"Bottom Right\",\"Top Left\",\"Top Right\"],defaultValue:\"bottom-left\",description:\"Choose where the navigation buttons appear relative to the slider.\"},zIndex:{title:\"Z Index\",type:ControlType.Number,defaultValue:1,description:\"Controls the stacking order of the component.\"},cursorText:{title:\"Drag Text\",type:ControlType.String,defaultValue:\"Drag\",description:\"The text shown inside the custom cursor.\"},gap:{title:\"Gap\",type:ControlType.Number,defaultValue:15,description:\"Spacing between items in the slider.\"},padding:{title:\"Padding\",type:ControlType.Number,defaultValue:20,description:\"Outer padding for the track.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DragSlider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Drag_Slider_Cursor.map"],"mappings":"gRAQG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,MAAI,aAAW,UAAQ,cAAY,aAAW,SAAO,gBAAc,cAAY,eAAa,mBAAiB,EAAY,EAAS,GAAqB,CAAO,EAAeA,EAAO,KAAK,CAAM,CAAC,EAAa,GAAiBC,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAA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