{"version":3,"file":"FormProgressBar.o7NbncgO.mjs","names":["useRef","useState","useRef","useState","p"],"sources":["https:/framerusercontent.com/modules/CAiPOh5jW8sjhKQGY1KE/c49HDh8hzE6LoUy4Q8Ea/FormPageLabel.js","https:/framerusercontent.com/modules/v1b335RPU7KtR6IJZaOk/KsHqejMn0YuzkmdNJsNz/FormProgressBar.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef,useState}from\"react\";import{useMultiStepFormStore,useCanvasState,getFormInfo}from\"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/p64C0n6xNEFY9NovSiJw/FramerFormsShared.js\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */export default function FormPageLabel(props){var _props_style;const Tag=props.htmlTag||\"p\";const isCanvas=RenderTarget.current()===RenderTarget.canvas;const ref=useRef(null);const[multiStepFormState,setMultiStepFormState]=useMultiStepFormStore();const canvasState=useCanvasState(ref);const[formId,setFormId]=useState(null);const state=isCanvas?canvasState:multiStepFormState[formId];useEffect(()=>{const newFormId=getFormInfo(ref.current).formId;setFormId(newFormId);if(!multiStepFormState[newFormId]){setMultiStepFormState({});}},[]);var _state_totalPages;return /*#__PURE__*/_jsx(Tag,{\"data-framerforms\":true,ref:ref,style:{color:props.color,userSelect:props.textSelect?\"auto\":\"none\",whiteSpace:((_props_style=props.style)===null||_props_style===void 0?void 0:_props_style.width)?\"pre\":\"nowrap\",margin:0,...props.font,...props.style},children:props.text.replace(/\\[page\\]/g,(state===null||state===void 0?void 0:state.pageHistory)?state.pageHistory.length:1).replace(/\\[totalPages\\]/g,(_state_totalPages=state===null||state===void 0?void 0:state.totalPages)!==null&&_state_totalPages!==void 0?_state_totalPages:1)});}FormPageLabel.displayName=\"Form Page Label\";addPropertyControls(FormPageLabel,{text:{type:ControlType.String,defaultValue:\"Page [page] / [totalPages]\",description:\"*[page]*: current page\\n*[totalPages]*: total number of pages\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4}},color:{type:ControlType.Color,defaultValue:\"#888\"},textSelect:{type:ControlType.Boolean,defaultValue:true},htmlTag:{type:ControlType.Enum,options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],title:\"HTML Tag\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FormPageLabel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useState,useRef}from\"react\";import{motion}from\"framer-motion\";import{useMultiStepFormStore,useCanvasState,getFormInfo}from\"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/p64C0n6xNEFY9NovSiJw/FramerFormsShared.js\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 10\n * @framerDisableUnlink\n */export default function FormProgressBar(props){const{fill,align}=props;const isVertical=props.direction==\"vertical\";const isCanvas=RenderTarget.current()===RenderTarget.canvas;const ref=useRef(null);const[multiStepFormState,setMultiStepFormState]=useMultiStepFormStore();const canvasState=useCanvasState(ref);const[formId,setFormId]=useState(null);const state=isCanvas?canvasState:multiStepFormState[formId];const[percent,setPercent]=useState(0);const prevPercentRef=useRef(0);useEffect(()=>{const newFormId=getFormInfo(ref.current).formId;setFormId(newFormId);if(!multiStepFormState[newFormId]){setMultiStepFormState({});}},[]);useEffect(()=>{if(state){setPercent(Math.max(state.pageHistory?.length,0)/state.totalPages);}},[state]);useEffect(()=>{prevPercentRef.current=percent;},[percent]);const p=isCanvas?props.previewPercent/100:percent;return /*#__PURE__*/_jsx(\"div\",{\"data-framerforms\":true,ref:ref,style:{display:\"flex\",flexDirection:props.direction==\"horizontal\"?\"row\":\"column\",justifyContent:align,borderRadius:props.radius,backgroundColor:props.background,boxShadow:props.shadows,backdropFilter:props.bgBlur?`blur(${props.bgBlur}px)`:undefined,overflow:\"hidden\",...props.style},children:/*#__PURE__*/_jsx(motion.div,{initial:false,transition:prevPercentRef.current===0?{type:false,duration:0}:props.transition,animate:{width:isVertical?\"100%\":`${p*100}%`,height:isVertical?`${p*100}%`:\"100%\",background:fill.type==\"color\"?fill.color:`linear-gradient(to ${isVertical?\"bottom\":\"right\"}, ${fill.colorA} ${props.fill.gradientScaled?0:align==\"center\"?50+-50/p:align==\"flex-end\"?-100/p+100:0}%, ${fill.colorB} ${props.fill.gradientScaled?100:align==\"center\"?50+50/p:align==\"flex-start\"?100/p:100}%)`},style:{borderRadius:props.innerRadius?props.radius:0}})});}FormProgressBar.displayName=\"Form Progress Bar\";addPropertyControls(FormProgressBar,{fill:{type:ControlType.Object,icon:\"color\",defaultValue:{type:\"color\",color:\"#0099FF\",colorA:\"#91C5FF\",colorB:\"#0099FF\"},controls:{type:{type:ControlType.Enum,options:[\"color\",\"linearGradient\"],optionTitles:[\"Color\",\"Gradient\"],displaySegmentedControl:true},color:{type:ControlType.Color,defaultValue:\"#0099FF\",hidden:props=>props.type!==\"color\"},colorA:{type:ControlType.Color,defaultValue:\"#91C5FF\",title:\"Colors\",hidden:props=>props.type!==\"linearGradient\"},colorB:{type:ControlType.Color,defaultValue:\"#0099FF\",title:\" \",hidden:props=>props.type!==\"linearGradient\"},gradientScaled:{type:ControlType.Boolean,defaultValue:false,title:\"Scaled\",hidden:props=>props.type!==\"linearGradient\"}}},background:{type:ControlType.Color,defaultValue:\"rgba(187, 187, 187, 0.15)\",optional:true},previewPercent:{type:ControlType.Number,defaultValue:75,min:0,max:100,step:1,unit:\"%\",title:\"Preview\"},direction:{type:ControlType.Enum,defaultValue:\"horizontal\",options:[\"horizontal\",\"vertical\"],displaySegmentedControl:true},align:{type:ControlType.Enum,defaultValue:\"flex-start\",options:[\"flex-start\",\"center\",\"flex-end\"],// @ts-ignore\noptionIcons:{direction:{horizontal:[\"align-left\",\"align-center\",\"align-right\"],vertical:[\"align-top\",\"align-middle\",\"align-bottom\"]}},displaySegmentedControl:true},radius:{type:ControlType.BorderRadius,defaultValue:\"5px\"},innerRadius:{type:ControlType.Boolean,defaultValue:true},shadows:{type:ControlType.BoxShadow},bgBlur:{type:ControlType.Number,min:0,max:100,step:1,displayStepper:true,title:\"BG Blur\"},transition:{type:ControlType.Transition,defaultValue:{type:\"spring\",damping:60,delay:0,duration:.3,mass:1,stiffness:800}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FormProgressBar\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicHeight\":\"10\",\"framerIntrinsicWidth\":\"400\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormProgressBar.map"],"mappings":"8fAIG,SAAwB,EAAc,EAAM,CAAkB,IAAM,EAAI,EAAM,SAAS,IAAU,EAAS,EAAa,SAAS,GAAG,EAAa,OAAa,EAAIE,EAAO,KAAK,CAAM,CAAC,EAAmB,GAAuB,GAAuB,CAAO,EAAY,EAAe,EAAI,CAAM,CAAC,EAAO,GAAWC,EAAS,KAAK,CAAO,EAAM,EAAS,EAAY,EAAmB,GAAsL,OAA9K,MAAc,CAAC,IAAM,EAAU,EAAY,EAAI,QAAQ,CAAC,OAAO,EAAU,EAAU,CAAK,EAAmB,IAAY,EAAsB,EAAE,CAAC,EAAI,EAAE,CAAC,CAA2C,EAAK,EAAI,CAAC,mBAAmB,GAAS,MAAI,MAAM,CAAC,MAAM,EAAM,M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