{"version":3,"file":"Carousel.Bwm_040F.mjs","names":["e"],"sources":["https:/framerusercontent.com/modules/zDsEJY4U8WasdWIJM7Ba/MxB79DnzqiPdfI73iT1r/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;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;setDragOffset(clientX-dragStartX);}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\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Carousel.map"],"mappings":"gWAMG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,WAAS,CAAE,EAAC,aAAW,QAAM,CAAC,EAAY,EAAS,GAAqB,CAAM,CAAC,EAAW,EAAc,CAAC,EAAS,KAAK,CAAM,CAAC,EAAW,EAAc,CAAC,EAAS,EAAE,CAAM,CAAC,EAAa,EAAgB,CAAC,EAAS,EAAE,CAAO,EAAM,MAAM,QAAQ,EAAS,CAAC,EAAS,OAAO,EAAwG,GAAtG,EAAU,IAAI,CAAC,AAAG,GAAc,GAAM,EAAgB,IAAI,EAAgB,EAAE,CAAC,AAAE,EAAC,CAAC,EAAM,CAAa,EAAC,EAAK,EAAM,MAAoB,GAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,OAAO,OAAO,aAAW,QAAQ,OAAO,WAAW,SAAS,eAAe,QAAS,EAAC,SAAS,6BAA8B,EAAC,CAAC,SAAS,EAAkBA,EAAE,CAAI,GAAgB,EAAc,EAAE,KAAK,WAAW,QAAQ,CAACA,EAAE,QAAQ,GAAG,QAAQA,EAAE,QAAQ,AAAE,UAAS,EAAkBA,EAAE,CAAC,GAAG,IAAa,KAAK,OAAO,IAAM,EAAQ,EAAE,KAAK,WAAW,QAAQ,CAACA,EAAE,QAAQ,GAAG,QAAQA,EAAE,QAAQ,EAAc,EAAQ,EAAW,AAAE,UAAS,GAAiB,CAAC,GAAG,IAAa,KAAK,OAAO,IAAM,EAAU,GAC9uB,AAA3N,EAAW,GAAW,EAAa,EAAG,EAAgB,IAAI,EAAgB,EAAa,EAAE,CAAC,CAAU,GAAY,GAAW,EAAa,EAAM,GAAG,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