{"version":3,"file":"PaginationButton.C_rcZwHT.mjs","names":["superfieldsId","useSuperfieldsStore"],"sources":["https:/framerusercontent.com/modules/B4rQNu4aph7XFGZiAMGO/CTbwSZKnMr32CuAu3pnw/PaginationButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{ControlType,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";import{Border,fillProp,createBackground,superfieldsId,useInstanceId,calculateTotalPages}from\"https://framerusercontent.com/modules/FZjYlw33eNo8pxLbSFLX/9cz7ek89fMdNfYUyPOlg/SuperfieldsShared.js\";import useSuperfieldsStore from\"https://framerusercontent.com/modules/OoGHZMzWDzm2mNN7bmeR/SrfgZxoYwWZOduOAI06A/Store.js\";import{addPropertyControlsV2,buttonPropertyControlsV2}from\"https://framerusercontent.com/modules/wzF1aUkHoslINE1PWbP0/pud8aXQ40ffzFv6s5hLJ/Shared.js\";import{useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */export default function PaginationButtons(props){const{styling}=props;const isAdvanced=props.mode===\"advanced\";const isNext=props.direction===\"next\";const superfieldsId=isAdvanced?props.settings.superfieldsId:0;const id=useInstanceId();const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[totalItems,page,itemsPerPage,setPage,paginationActive,deinitializePaginationButton]=useSuperfieldsStore(superfieldsId,state=>[state.totalItems,state.page,state.itemsPerPage,state.setPage,state.paginationActive,state.deinitializePaginationButton],state=>{state.paginationButtonsCount+=1;});useEffect(()=>{return()=>{deinitializePaginationButton();};},[]);const totalPages=calculateTotalPages(totalItems,itemsPerPage);const baseAnimate={...createBackground(styling.fill),color:styling.fontColor,opacity:1};const disabledStyle={cursor:\"default\"};let disabledAnimate=baseAnimate;if(styling.disabled){if(styling.disabled.mode==\"show\"){disabledAnimate={opacity:styling.disabled.opacity,...createBackground(styling.disabled.fill),color:styling.disabled.fontColor??baseAnimate.color};}else{if(styling.disabled.preserveSpace){disabledStyle.visibility=\"hidden\";}else{disabledStyle.display=\"none\";}}}function onButtonClick(){if(paginationActive){const newPage=isNext?page+1:page-1;if(newPage>=0&&newPage<totalPages){setPage(newPage);}}}const show=isCanvas||!paginationActive||(isNext?page<totalPages-1:page>0);return /*#__PURE__*/_jsxs(motion.div,{\"data-superfields\":true,id:id,whileHover:show?styling.hover?{...createBackground(styling.hover.fill),scale:styling.hover.scale,opacity:styling.hover.opacity,rotate:styling.hover.rotate,color:styling.hover.fontColor}:{}:disabledAnimate,animate:show?baseAnimate:{...baseAnimate,...disabledAnimate},style:{position:\"relative\",display:\"flex\",justifyContent:styling.font?.textAlign||\"center\",alignItems:\"center\",padding:styling.padding,borderRadius:styling.radius,userSelect:\"none\",boxShadow:styling.shadows,cursor:\"pointer\",backdropFilter:styling.bgBlur?`blur(${styling.bgBlur}px)`:undefined,gap:styling.arrowIcon?.gap||0,...styling.font,...!show&&disabledStyle,...props.style},onClick:()=>onButtonClick(),initial:false,transition:styling.transition,children:[styling.arrowIcon?.location===\"left\"?arrowIcon(styling.arrowIcon,isNext):null,styling.text||null,styling.arrowIcon?.location===\"right\"?arrowIcon(styling.arrowIcon,isNext):null,styling.border&&/*#__PURE__*/_jsx(Border,{...styling.border,borderRadius:styling.radius})]});}PaginationButtons.displayName=\"Pagination Buttons\";addPropertyControlsV2(PaginationButtons,{direction:{type:ControlType.Enum,defaultValue:\"next\",options:[\"previous\",\"next\"],optionTitles:[\"Previous\",\"Next\"],optionIcons:[\"direction-left\",\"direction-right\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},...buttonPropertyControlsV2({text:\"Next\",showAppearance:false,stylingPropsStart:{arrowIcon:{type:ControlType.Object,optional:true,controls:{location:{type:ControlType.Enum,defaultValue:\"right\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],displaySegmentedControl:true},color:{type:ControlType.Color,optional:true},size:{type:ControlType.Number,defaultValue:24,min:1,step:1},stroke:{type:ControlType.Number,defaultValue:2,min:.01,step:.01},gap:{type:ControlType.Number,defaultValue:10,min:0,step:1,displayStepper:true}}}},stylingPropsEnd:{disabled:{type:ControlType.Object,controls:{mode:{type:ControlType.Enum,defaultValue:\"hide\",options:[\"hide\",\"show\"],optionTitles:[\"Hide\",\"Show\"],displaySegmentedControl:true},preserveSpace:{type:ControlType.Boolean,defaultValue:false,description:\"Preserve the space where a disabled button would be while hidden.\",hidden:props=>props.mode!==\"hide\"},fill:fillProp({noDefault:true,hidden:props=>props.mode!==\"show\"}),fontColor:{type:ControlType.Color,optional:true,hidden:props=>props.mode!==\"show\"},opacity:{type:ControlType.Number,defaultValue:.5,min:0,max:1,step:.01,hidden:props=>props.mode!==\"show\"}}},transition:{type:ControlType.Transition,defaultValue:{type:\"spring\",duration:.2,bounce:0}}}}),settings:{type:ControlType.Object,title:\"Settings\",buttonTitle:\"Options\",description:\"Advanced setup.\",controls:{...superfieldsId()}}});function arrowIcon(props,right){return /*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:props.size,height:props.size,viewBox:\"0 0 24 24\",\"stroke-width\":props.stroke,stroke:props.color||\"currentColor\",fill:\"none\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\",style:{display:\"block\",rotate:right?\"180deg\":undefined},children:/*#__PURE__*/_jsx(\"path\",{d:\"M15 6l-6 6l6 6\"})});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PaginationButtons\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"yVAIG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,WAAS,EAAY,EAAW,EAAM,OAAO,WAAiB,EAAO,EAAM,YAAY,OAAaA,EAAc,EAAW,EAAM,SAAS,cAAc,EAAQ,EAAG,GA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