{"version":3,"file":"ContinueButton.D-cVBpd2.mjs","names":["useState","useMemo","r"],"sources":["https:/framerusercontent.com/modules/xtCerBvN6iRNpIapDarB/IXm3nvL03S7V6KhAmCp0/controls.js","https:/framerusercontent.com/modules/khXT23iv7hjvyvLk9G5X/Y2oxemfziugOaOvbt23i/ContinueButton.js"],"sourcesContent":["import{ControlType}from\"framer\";import{BUTTON_STYLE_GROUP}from\"https://framerusercontent.com/modules/9i2Alm7tGoDSsKzk9kk3/9Y1RthbcC9dcPnTigB3t/buttonStyleGroup.js\";const BRANCHING_RULES={branchingRules:{type:ControlType.Array,title:\"Branching Rules\",propertyControl:{type:ControlType.Object,controls:{field:{type:ControlType.String,title:\"Field (apiName)\",placeholder:\"e.g. business_type\"},op:{type:ControlType.Enum,title:\"Operator\",options:[\"equals\",\"notEquals\",\"includes\",\"regex\"],optionTitles:[\"equals\",\"not equals\",\"includes\",\"regex\"],defaultValue:\"equals\"},value:{type:ControlType.String,title:\"Value / Regex\",placeholder:\"e.g. pro / /^pro/i\"},nextStepId:{type:ControlType.String,title:\"Next Step ID\",placeholder:\"step-id-to-go\"}}},defaultValue:[]}};export const CONTINUE_BUTTON_CONTROLS={label:{type:ControlType.String,title:\"Label\",defaultValue:\"Continue\"},nextStepId:{type:ControlType.String,title:\"Default Next Step\",defaultValue:\"\"},incompleteMessage:{type:ControlType.String,title:\"Incomplete Message\",placeholder:\"(optional)\"},// Optional branching (first rule that matches wins; else falls back to default)\n...BRANCHING_RULES,// Styles\n...BUTTON_STYLE_GROUP};\nexport const __FramerMetadata__ = {\"exports\":{\"CONTINUE_BUTTON_CONTROLS\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./controls.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useState}from\"react\";import{addPropertyControls}from\"framer\";import{resolveButtonStyles}from\"https://framerusercontent.com/modules/2nm11oCJ9YbIAtty0hAj/yWPmlHEIysfpBb7BPDqb/resolveButtonStyles.js\";import{useFields,useFieldErrors,useTouched,useVisibleRequired,useFormError}from\"https://framerusercontent.com/modules/Ax3pgpFugmVtkLyjK0aB/gjk6sN8WNzrAQFqhH8LV/formStores.js\";import{useStepHistory}from\"https://framerusercontent.com/modules/wm78KsU1IYJJVRPxnalG/7zJiE09qHzT3tvBf6zOQ/stepStores.js\";import{validateForm}from\"https://framerusercontent.com/modules/OyEfIKv9n5xUcgJ6ibLb/qWdGzh1zHLkDcT2uFdXP/validateForm.js\";import{evaluateBranchTarget,ruleMatches}from\"https://framerusercontent.com/modules/3uKicuWZs0YreChql2h7/rF76zQGkIWqYfaBwsp7Q/branching.js\";import{track}from\"https://framerusercontent.com/modules/KHQRbo1PS40kxEtlsBHj/eAgZx6F6skeVRSwyjPMA/analytics.js\";import{normalizeVisibleRequired}from\"https://framerusercontent.com/modules/jsQEdCu29ceye0UOu35m/BPGbCPBY0YM25AuGTE4v/required.js\";import{hasValue}from\"https://framerusercontent.com/modules/LDXisB7uYJA6597I5HTt/zXhixOoL5Digm6OgZVcN/values.js\";import{CONTINUE_BUTTON_CONTROLS}from\"https://framerusercontent.com/modules/xtCerBvN6iRNpIapDarB/IXm3nvL03S7V6KhAmCp0/controls.js\";export function ContinueButton({label=\"Continue\",nextStepId,styles={},incompleteMessage,branchingRules=[]}){const[isHovered,setHovered]=useState(false);const[isPressed,setPressed]=useState(false);const[isFocused,setFocused]=useState(false);const[isStepValid,setIsStepValid]=useState(false);const[fields]=useFields();const[errors,setErrors]=useFieldErrors();const[touched,setTouched]=useTouched();const[visibleRequired]=useVisibleRequired();const[,setFormError]=useFormError();const{currentStep,goToStep}=useStepHistory();// required names for the active step\nconst required=useMemo(()=>normalizeVisibleRequired(visibleRequired),[visibleRequired]);// only enable when all visible required fields have values and no errors\nuseEffect(()=>{if(required.length===0){setIsStepValid(true);return;}const f=fields;const e=errors;const ok=required.every(name=>hasValue(f?.[name])&&!e?.[name]);setIsStepValid(ok);},[fields,errors,touched,required]);const handleClick=e=>{e.preventDefault();if(!nextStepId)return;// cheap click signal\ntrack(\"continue_click\",{from_step:currentStep??null,default_next:nextStepId||null,req_count:required.length});// authoritative validate/write\nconst{isValid,errors:newErrors,touched:newTouched}=validateForm(fields,required);setErrors(newErrors);setTouched(newTouched);if(!isValid){if(incompleteMessage)setFormError(incompleteMessage);track(\"continue_blocked\",{from_step:currentStep??null,reason:\"validation\",req_count:required.length});return;}setFormError(\"\");const f=fields;const branchedTarget=evaluateBranchTarget(f,branchingRules,nextStepId);// log which rule (if any) fired\nlet matchedRule;if(Array.isArray(branchingRules)&&branchingRules.length>0){matchedRule=branchingRules.find(r=>ruleMatches(r,f));}track(\"continue_navigate\",{from_step:currentStep??null,to_step:branchedTarget,used_branch:Boolean(matchedRule),...matchedRule?{branch_field:matchedRule.field,branch_op:matchedRule.op,branch_value:matchedRule.value??null}:null});goToStep(branchedTarget);};const r=resolveButtonStyles(styles);const disabled=!nextStepId||!isStepValid;const style=r.buildStyle({disabled,hover:isHovered,press:isPressed,focus:isFocused});return /*#__PURE__*/_jsx(\"button\",{type:\"button\",disabled:disabled,style:{...style,fontFamily:\"Figtree, system-ui, sans-serif\",cursor:disabled?\"not-allowed\":\"pointer\",opacity:disabled?r.tokens.effects.disabledOpacity:1,boxShadow:r.tokens.effects.shadow,transition:style.transition,minHeight:r.tokens.spacing.height,boxSizing:\"border-box\",position:\"relative\"},onMouseEnter:()=>setHovered(true),onMouseLeave:()=>setHovered(false),onMouseDown:()=>setPressed(true),onMouseUp:()=>setPressed(false),onFocus:()=>setFocused(true),onBlur:()=>setFocused(false),onClick:handleClick,children:label});}// Framer type limitation\naddPropertyControls(ContinueButton,CONTINUE_BUTTON_CONTROLS);\nexport const __FramerMetadata__ = {\"exports\":{\"ContinueButtonProps\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ContinueButton\":{\"type\":\"reactComponent\",\"name\":\"ContinueButton\",\"slots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