{"version":3,"file":"SubmitButton.CJaRrrTv.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/e61m4Fbk5eP9eHvcc7Z8/TafempwalYXWTvBUIwnX/SubmitButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef}from\"react\";import{FormState,Events,StandardButton,standardButtonPropertyControls,useThentyForm}from\"https://framerusercontent.com/modules/diyk5889JEo4mM5y5sJr/fojdC4wfG6J7NmzQMXnM/ThentyShared.js\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 300\n * @framerDisableUnlink\n */export default function SubmitButton(props){const{defaultText,successText,errorText,successEvent,errorEvent,loadingEvent}=props;const ref=useRef(null);const[loading,setLoading]=useState(false);const{formState,setFormState,fireFormEvent}=useThentyForm(ref);useEffect(()=>{switch(formState){case FormState.Success:successEvent?.();setLoading(false);break;case FormState.Error:errorEvent?.();setLoading(false);break;case FormState.Loading:loadingEvent?.();setLoading(true);break;}},[formState]);const onClick=()=>{fireFormEvent(Events.SubmitButtonClick);};return /*#__PURE__*/_jsx(StandardButton,{ref:ref,...props,loading:loading,\"data-thenty-submit-button\":true,onClick:onClick,\"data-no-enter-focus\":true,children:formState===FormState.Success?successText||defaultText:formState===FormState.Error?errorText||defaultText:defaultText});}SubmitButton.displayName=\"Thenty Submit Button\";addPropertyControls(SubmitButton,{defaultText:{type:ControlType.String,placeholder:\"Button Text\",defaultValue:\"Submit\",title:\"Default\"},successText:{type:ControlType.String,placeholder:\"Success Text\",defaultValue:\"Success!\",title:\"Success\"},errorText:{type:ControlType.String,placeholder:\"Error Text\",defaultValue:\"Error\",title:\"Error\"},...standardButtonPropertyControls({defaultColor:\"#FFFFFF\",defaultFill:\"#0075FF\",defaultHoverFill:\"#1A81FF\",hasDefaultBorder:false,loadingSpinner:true}),successEvent:{type:ControlType.EventHandler,title:\"Success\"},errorEvent:{type:ControlType.EventHandler,title:\"Error\"},loadingEvent:{type:ControlType.EventHandler,title:\"Loading\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SubmitButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"300\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"2QAKG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,cAAY,cAAY,YAAU,eAAa,aAAW,gBAAc,EAAY,EAAIA,EAAO,KAAK,CAAM,CAAC,EAAQ,GAAYC,EAAS,GAAM,CAAM,CAAC,YAAU,eAAa,iBAAe,EAAc,EAAI,CAAC,MAAc,CAAC,OAAO,EAAP,CAAkB,KAAK,EAAU,QAAQ,KAAgB,CAAC,EAAW,GAAM,CAAC,MAAM,KAAK,EAAU,MAAM,KAAc,CAAC,EAAW,GAAM,CAAC,MAAM,KAAK,EAAU,QAAQ,KAAgB,CAAC,EAAW,GAAK,CAAC,QAAS,CAAC,EAAU,CAAC,CAAC,IAAM,MAAY,CAAC,EAAc,EAAO,kBAAkB,EAAG,OAAoB,EAAK,EAAe,CAAK,MAAI,GAAG,EAAc,UAAQ,4BAA4B,GAAa,UAAQ,sBAAsB,GAAK,SAAS,IAAY,EAAU,QAAQ,GAAa,EAAY,IAAY,EAAU,OAAM,GAAuB,EAAY,CAAC,kBALvxB,IAAoD,IAA6C,IAA0L,CAK8f,EAAa,YAAY,uBAAuB,EAAoB,EAAa,CAAC,YAAY,CAAC,KAAK,EAAY,OAAO,YAAY,cAAc,aAAa,SAAS,MAAM,UAAU,CAAC,YAAY,CAAC,KAAK,EAAY,OAAO,YAAY,eAAe,aAAa,WAAW,MAAM,UAAU,CAAC,UAAU,CAAC,KAAK,EAAY,OAAO,YAAY,aAAa,aAAa,QAAQ,MAAM,QAAQ,CAAC,GAAG,EAA+B,CAAC,aAAa,UAAU,YAAY,UAAU,iBAAiB,UAAU,iBAAiB,GAAM,eAAe,GAAK,CAAC,CAAC,aAAa,CAAC,KAAK,EAAY,aAAa,MAAM,UAAU,CAAC,WAAW,CAAC,KAAK,EAAY,aAAa,MAAM,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAY,aAAa,MAAM,UAAU,CAAC,CAAC"}