{"version":3,"file":"ThentyErrorMessage.wlFS54TP.mjs","names":["textOptions"],"sources":["https:/framerusercontent.com/modules/e61m4Fbk5eP9eHvcc7Z8/D5tfieJj4z9ekFuijREx/SubmitButton.js","https:/framerusercontent.com/modules/qERhjgPA4cB5k1EvYnU6/Syq7IALRk21e0lIk5GD9/ThentyErrorMessage.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/WO0BY8LwVoqggEJBPHWk/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\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,withCSS}from\"framer\";import{useRef}from\"react\";import{textOptions,textOptionsToStyles,useThentyForm}from\"https://framerusercontent.com/modules/diyk5889JEo4mM5y5sJr/WO0BY8LwVoqggEJBPHWk/ThentyShared.js\";const CANVAS_HIDDEN_CLASS_NAME=\"thenty-error-canvas-hidden\";const HIDDEN_CLASS_NAME=\"thenty-error-hidden\";function ThentyFormErrorMessageComponent(props){const{font,color,prefix,suffix,style,textOptions}=props;const Tag=props.tag||\"p\";const isCanvas=RenderTarget.current()===RenderTarget.canvas;const ref=useRef(null);const{formError}=useThentyForm(ref);let className=\"\";if(isCanvas){className=CANVAS_HIDDEN_CLASS_NAME;}else if(!formError){className=HIDDEN_CLASS_NAME;}return /*#__PURE__*/_jsxs(Tag,{ref:ref,className:className,style:{color,margin:0,whiteSpace:style?.width?undefined:\"nowrap\",fontWeight:400,textAlign:\"center\",...textOptionsToStyles(textOptions),...font,...style},children:[prefix,isCanvas?\"Error message\":formError,suffix]});}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 300\n * @framerDisableUnlink\n */const ThentyFormErrorMessage=withCSS(ThentyFormErrorMessageComponent,[`[data-framer-component-container=\"true\"] div:has(> .${CANVAS_HIDDEN_CLASS_NAME}) { display: none !important; }`,`div:has(> .${HIDDEN_CLASS_NAME}) { display: none !important; }`,`.${HIDDEN_CLASS_NAME} { display: none !important; }`],\"\");export default ThentyFormErrorMessage;ThentyFormErrorMessage.displayName=\"Thenty Error Message\";addPropertyControls(ThentyFormErrorMessage,{font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:12,lineHeight:1.4,textAlign:\"center\"}},color:{type:ControlType.Color,defaultValue:\"#FF5A6F\"},prefix:{type:ControlType.String,defaultValue:\"\"},suffix:{type:ControlType.String,defaultValue:\"\"},textOptions:textOptions()});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ThentyFormErrorMessage\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"300\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"wgBAKG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,cAAY,cAAY,YAAU,eAAa,aAAW,eAAa,CAAC,EAAY,EAAI,EAAO,KAAK,CAAM,CAAC,EAAQ,EAAW,CAAC,GAAS,EAAM,CAAM,CAAC,YAAU,eAAa,gBAAc,CAAC,EAAc,EAAI,CAAC,EAAU,IAAI,CAAC,OAAO,EAAP,CAAkB,KAAK,EAAU,QAAyB,AAAjB,KAAgB,CAAC,GAAW,EAAM,CAAC,MAAM,KAAK,EAAU,MAAqB,AAAf,KAAc,CAAC,GAAW,EAAM,CAAC,MAAM,KAAK,EAAU,QAAyB,AAAjB,KAAgB,CAAC,GAAW,EAAK,CAAC,KAAO,CAAC,EAAC,CAAC,CAAU,EAAC,CAAC,IAAM,EAAQ,IAAI,CAAC,EAAc,EAAO,kBAAkB,AAAE,EAAC,MAAoB,GAAK,EAAe,CAAK,MAAI,GAAG,EAA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