{"version":3,"file":"Carousel.C0Lz2E0F.mjs","names":["useState","e","startTransition"],"sources":["https:/framerusercontent.com/modules/zDsEJY4U8WasdWIJM7Ba/qOLfNsjUEZ97zeqQQeVl/Carousel.js"],"sourcesContent":["// Carrossel responsivo com objetos (itens) usando object-fit: fill horizontal\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import React,{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Carrossel Responsivo de Itens\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function Carousel(props){const{children=[],background,style}=props;const isStatic=useIsStaticRenderer();const[dragStartX,setDragStartX]=useState(null);const[dragOffset,setDragOffset]=useState(0);const[currentIndex,setCurrentIndex]=useState(0);const total=Array.isArray(children)?children.length:0;useEffect(()=>{if(currentIndex>=total)startTransition(()=>setCurrentIndex(0));},[total,currentIndex]);if(!total)return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:\"100%\",background,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:\"Adicione itens ao carrossel\"});function handlePointerDown(e){if(isStatic)return;// Only allow drag to left on first slide\nif(currentIndex===0){const clientX=e.type.startsWith(\"touch\")?e.touches[0].clientX:e.clientX;setDragStartX(clientX);}else{setDragStartX(e.type.startsWith(\"touch\")?e.touches[0].clientX:e.clientX);}}function handlePointerMove(e){if(dragStartX===null)return;const clientX=e.type.startsWith(\"touch\")?e.touches[0].clientX:e.clientX;let offset=clientX-dragStartX;// Prevent dragging right on first slide\nif(currentIndex===0&&offset>0){offset=offset*.2// allow a little magnet effect\n;}setDragOffset(offset);}function handlePointerUp(){if(dragStartX===null)return;const threshold=40// px\n;if(dragOffset>threshold&&currentIndex>0){startTransition(()=>setCurrentIndex(currentIndex-1));}else if(dragOffset<-threshold&&currentIndex<total-1){startTransition(()=>setCurrentIndex(currentIndex+1));}setDragStartX(null);setDragOffset(0);}useEffect(()=>{if(dragStartX===null)return;function onMove(e){handlePointerMove(e);}function onUp(){handlePointerUp();}window.addEventListener(\"mousemove\",onMove);window.addEventListener(\"mouseup\",onUp);window.addEventListener(\"touchmove\",onMove);window.addEventListener(\"touchend\",onUp);return()=>{window.removeEventListener(\"mousemove\",onMove);window.removeEventListener(\"mouseup\",onUp);window.removeEventListener(\"touchmove\",onMove);window.removeEventListener(\"touchend\",onUp);};},[dragStartX,dragOffset,currentIndex,total]);return /*#__PURE__*/_jsxs(\"div\",{style:{...style,width:\"100%\",height:\"100%\",background,overflow:\"hidden\",position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",touchAction:\"pan-y\",WebkitUserSelect:\"none\",userSelect:\"none\"},onMouseDown:handlePointerDown,onTouchStart:handlePointerDown,tabIndex:0,role:\"region\",\"aria-label\":\"Carrossel\",children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:16,right:16,background:props.counterBg,color:props.counterColor,borderRadius:props.counterRadius,padding:\"4px 12px\",fontSize:props.counterFont?.fontSize,fontWeight:props.counterFont?.variant===\"Bold\"?700:400,lineHeight:props.counterFont?.lineHeight,letterSpacing:props.counterFont?.letterSpacing,...props.counterFont,minWidth:36,minHeight:28,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:10,boxShadow:\"0 1px 4px rgba(0,0,0,0.08)\",userSelect:\"none\"},\"aria-label\":\"Contador de itens\",children:`${currentIndex+1}/${total}`}),/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"flex-start\",justifyContent:\"flex-start\",transform:`translateX(calc(${-currentIndex*100}% + ${dragOffset}px))`,transition:dragStartX===null?\"transform 0.3s cubic-bezier(.4,0,.2,1)\":\"none\",willChange:\"transform\"},children:Array.isArray(children)?children.map((child,i)=>{if(/*#__PURE__*/React.isValidElement(child)){const childProps={...child.props,style:{...child.props?.style||{},width:\"100%\",height:\"100%\",objectFit:\"fill\"}};return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",flex:\"0 0 100%\",display:\"flex\",alignItems:\"flex-start\",justifyContent:\"center\"},children:/*#__PURE__*/React.cloneElement(child,childProps)},i);}return null;}):children}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:0,right:0,bottom:props.dotsSpacing,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",gap:props.dotsHorizontalGap,pointerEvents:\"none\"},children:Array.from({length:total}).map((_,i)=>/*#__PURE__*/_jsx(\"div\",{style:{width:props.dotSize,height:props.dotSize,borderRadius:props.dotSize/2,background:i===currentIndex?props.dotFilledColor:props.dotEmptyColor,opacity:.8,transition:\"background 0.2s\",pointerEvents:\"auto\",cursor:\"pointer\"},\"aria-label\":`Ir para item ${i+1}`,tabIndex:0,onClick:()=>startTransition(()=>setCurrentIndex(i)),onKeyDown:e=>{if(e.key===\"Enter\"||e.key===\" \")startTransition(()=>setCurrentIndex(i));},role:\"button\"},i))})]});}addPropertyControls(Carousel,{children:{type:ControlType.Slot,title:\"Itens\",maxCount:10},background:{type:ControlType.Color,title:\"Fundo\",defaultValue:\"#FFFFFF\"},dotsSpacing:{type:ControlType.Number,title:\"Espa\\xe7o Dots\",defaultValue:12,min:0,max:64,step:1,unit:\"px\"},dotSize:{type:ControlType.Number,title:\"Tamanho Dot\",defaultValue:8,min:4,max:32,step:1,unit:\"px\"},dotEmptyColor:{type:ControlType.Color,title:\"Cor Vazio\",defaultValue:\"#EEE\"},dotFilledColor:{type:ControlType.Color,title:\"Cor Preenchido\",defaultValue:\"#222\"},dotsHorizontalGap:{type:ControlType.Number,title:\"Espa\\xe7o Horizontal Dots\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},counterBg:{type:ControlType.Color,title:\"Cor Fundo Contador\",defaultValue:\"#333A1A\"},counterColor:{type:ControlType.Color,title:\"Cor Texto Contador\",defaultValue:\"#fff\"},counterFont:{type:ControlType.Font,title:\"Fonte Contador\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"0em\",lineHeight:\"1em\"}},counterRadius:{type:ControlType.Number,title:\"Raio Contador\",defaultValue:16,min:0,max:32,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Carousel\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Carousel.map"],"mappings":"gWAMG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,WAAS,EAAE,CAAC,aAAW,QAAM,CAAC,EAAY,EAAS,IAA2B,CAAC,EAAW,EAAc,CAACA,EAAS,MAAW,CAAC,EAAW,EAAc,CAACA,EAAS,GAAQ,CAAC,EAAa,EAAgB,CAACA,EAAS,GAAS,EAAM,MAAM,QAAQ,GAAU,EAAS,OAAO,EAAwG,GAAtG,MAAc,CAAI,GAAc,GAAM,MAAoB,EAAgB,GAAK,EAAC,CAAC,EAAM,EAAa,EAAK,CAAC,EAAM,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,OAAO,OAAO,aAAW,QAAQ,OAAO,WAAW,SAAS,eAAe,SAAS,CAAC,SAAS,8BAA8B,EAAE,SAAS,EAAkB,EAAE,CAAI,MACvoB,GAAG,IAAe,EAAE,CAAC,IAAM,EAAQC,EAAE,KAAK,WAAW,SAASA,EAAE,QAAQ,GAAG,QAAQA,EAAE,QAAQ,EAAc,EAAU,MAAK,EAAcA,EAAE,KAAK,WAAW,SAASA,EAAE,QAAQ,GAAG,QAAQA,EAAE,QAAW,UAAS,EAAkB,EAAE,CAAC,GAAG,IAAa,KAAK,OAAO,IAAM,EAAQA,EAAE,KAAK,WAAW,SAASA,EAAE,QAAQ,GAAG,QAA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