{"version":3,"file":"SupabaseLoginButton.BYm997ey.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/lj5m5HzhOVWNcMpC5EP7/nSJiXrXs5c6rhmtYBtMy/SVGIcons.js","https:/framerusercontent.com/modules/u36xiaYNjrUtcw1RjOoS/hAX2V84nnz4Qixe7qMdD/SupabaseLoginButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";const icons={apple:/*#__PURE__*/_jsx(\"path\",{d:\"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z\"}),google:/*#__PURE__*/_jsx(\"path\",{d:\"M12.545,10.239v3.821h5.445c-0.712,2.315-2.647,3.972-5.445,3.972c-3.332,0-6.033-2.701-6.033-6.032s2.701-6.032,6.033-6.032c1.498,0,2.866,0.549,3.921,1.453l2.814-2.814C17.503,2.988,15.139,2,12.545,2C7.021,2,2.543,6.477,2.543,12s4.478,10,10.002,10c8.396,0,10.249-7.85,9.426-11.748L12.545,10.239z\"})};export function Icon({name,size=24,color=\"currentColor\",className,style}){const icon=icons[name];if(!icon)return null;return /*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 24 24\",focusable:\"false\",\"aria-hidden\":\"true\",width:size,height:size,fill:color,className:className,style:style,children:icon});}\nexport const __FramerMetadata__ = {\"exports\":{\"Icon\":{\"type\":\"reactComponent\",\"name\":\"Icon\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SVGIcons.map","// framer-backend-components/src/components/SupabaseLoginButton.tsx\n// Component URL: https://framer.com/m/SupabaseLoginButton-oi9I.js\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{Frame,addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useSupabaseClient}from\"https://framerusercontent.com/modules/nFXcsi7qNXwQese9BwLw/e4s4u1ZLr37fMpjuK6xu/useSupabaseClient.js\";import{Icon}from\"https://framerusercontent.com/modules/lj5m5HzhOVWNcMpC5EP7/nSJiXrXs5c6rhmtYBtMy/SVGIcons.js\";const defaultSupabaseLoginButtonProps={provider:\"google\",showLogo:true,background:\"#4285F4\",textColor:\"#FFFFFF\",cornerRadius:8,borderWidth:0,borderColor:\"rgba(0,0,0,0)\",verticalPadding:8,horizontalPadding:12};/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 44\n */export default function SupabaseLoginButton(props){const{provider=defaultSupabaseLoginButtonProps.provider,buttonText,showLogo=defaultSupabaseLoginButtonProps.showLogo,background,textColor=defaultSupabaseLoginButtonProps.textColor,cornerRadius=defaultSupabaseLoginButtonProps.cornerRadius,borderWidth=defaultSupabaseLoginButtonProps.borderWidth,borderColor=defaultSupabaseLoginButtonProps.borderColor,verticalPadding=defaultSupabaseLoginButtonProps.verticalPadding,horizontalPadding=defaultSupabaseLoginButtonProps.horizontalPadding,style}=props;// 1. Define your brand defaults\nconst defaultBackgrounds={google:\"#4285F4\",apple:\"#000000\"};// 2. Keep track of the previous provider\nconst prevProviderRef=React.useRef(provider);// 3. Local state for the actual background we’ll render\nconst[computedBackground,setComputedBackground]=React.useState(background);React.useEffect(()=>{// If the provider just changed…\nif(prevProviderRef.current!==provider){const prevDefault=defaultBackgrounds[prevProviderRef.current];// And the incoming `background` prop still matches the old default,\n// then swap to the new provider’s default.\nif(background.trim().toLowerCase()===prevDefault.toLowerCase()){setComputedBackground(defaultBackgrounds[provider]);}else{// Otherwise, the user must have overridden: keep their color.\nsetComputedBackground(background);}}else if(background!==computedBackground){setComputedBackground(background);}// Update our ref for next time\nprevProviderRef.current=provider;},[provider,background]);const{client,isReady,signInWithGoogle,signInWithApple}=useSupabaseClient();const[loading,setLoading]=React.useState(false);const[error,setError]=React.useState(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;const defaultText=`Continue with ${provider[0].toUpperCase()+provider.slice(1)}`;const effectiveText=buttonText||defaultText;const handleClick=async()=>{if(isCanvas||!client||!isReady||loading)return;setLoading(true);setError(null);try{await new Promise(r=>setTimeout(r,500));if(provider===\"google\")await signInWithGoogle();else await signInWithApple();}catch(err){setError(err.message||`Failed to sign in with ${provider}`);}finally{setLoading(false);}};// --- Sizing Determination ---\nconst hasInjectedWidth=style?.width!==undefined&&style.width!==null;const isFixedWidth=hasInjectedWidth&&style?.width!==\"auto\";const widthProp=isFixedWidth?style.width:\"auto\";const heightProp=\"100%\";// --- End Sizing ---\n// --- Styles ---\n// Outer frame: Handles layout container, bg, border, radius, CLIPPING\nconst outerFrameStyle={display:\"flex\",alignItems:\"center\",justifyContent:\"center\",position:\"relative\",overflow:\"hidden\",cursor:loading||!isReady?\"wait\":isCanvas?\"default\":\"pointer\",background:computedBackground,borderRadius:cornerRadius,border:`${borderWidth}px solid ${borderColor}`,...style,width:undefined,height:heightProp,padding:undefined,color:undefined,fontWeight:undefined,fontSize:undefined,gap:undefined,whiteSpace:undefined,textAlign:undefined};// Inner content wrapper: Handles intrinsic size WITH PADDING\nconst innerWrapperStyle={display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,// Add padding HERE\npadding:`${verticalPadding}px ${horizontalPadding}px`,width:\"auto\",height:\"auto\",color:textColor,fontWeight:500,fontSize:14,whiteSpace:\"nowrap\",textAlign:\"center\",// Max width prevents blowout if text is very long in auto mode\nmaxWidth:\"100%\"};// --- End Styles ---\nreturn /*#__PURE__*/_jsx(Frame,{name:\"SupabaseLoginButton_Outer\",width:widthProp,style:outerFrameStyle,background:null,onTap:handleClick,children:/*#__PURE__*/_jsxs(\"div\",{style:innerWrapperStyle,children:[showLogo&&/*#__PURE__*/_jsx(Icon,{name:provider,size:20,color:\"currentColor\"}),/*#__PURE__*/_jsx(\"span\",{style:{opacity:loading?.7:1},children:loading?\"Redirecting...\":effectiveText})]})});}// --- Property Controls ---\naddPropertyControls(SupabaseLoginButton,{provider:{type:ControlType.Enum,title:\"Provider\",options:[\"google\",\"apple\"],optionTitles:[\"Google\",\"Apple\"],defaultValue:defaultSupabaseLoginButtonProps.provider,displaySegmentedControl:true},buttonText:{type:ControlType.String,title:\"Text\",placeholder:\"Default\"},showLogo:{type:ControlType.Boolean,title:\"Show Logo\",defaultValue:defaultSupabaseLoginButtonProps.showLogo},background:{type:ControlType.Color,title:\"Background\",defaultValue:defaultSupabaseLoginButtonProps.background},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:defaultSupabaseLoginButtonProps.textColor},cornerRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:defaultSupabaseLoginButtonProps.cornerRadius,min:0,max:100,step:1,displayStepper:true},verticalPadding:{title:\"Padding V\",type:ControlType.Number,defaultValue:defaultSupabaseLoginButtonProps.verticalPadding,min:0,max:50,step:1,displayStepper:true},horizontalPadding:{title:\"Padding H\",type:ControlType.Number,defaultValue:defaultSupabaseLoginButtonProps.horizontalPadding,min:0,max:100,step:1,displayStepper:true},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:defaultSupabaseLoginButtonProps.borderWidth,min:0,max:10,step:1,displayStepper:true},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:defaultSupabaseLoginButtonProps.borderColor,hidden:props=>props.borderWidth===0}});\nexport const __FramerMetadata__ = {\"exports\":{\"SupabaseLoginButtonProps\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"SupabaseLoginButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\",\"framerIntrinsicHeight\":\"44\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"uZAAo2B,SAAgB,EAAK,CAAC,OAAK,OAAK,GAAG,QAAM,eAAe,YAAU,SAAO,CAAC,IAAM,EAAK,EAAM,GAA2B,OAAjB,EAAqC,EAAK,MAAM,CAAC,QAAQ,YAAY,UAAU,QAAQ,cAAc,OAAO,MAAM,EAAK,OAAO,EAAK,KAAK,EAAgB,YAAgB,QAAM,SAAS,EAAK,CAAC,CAAjL,wBAA16B,CAAM,EAAM,CAAC,MAAmB,EAAK,OAAO,CAAC,EAAE,4bAA4b,CAAC,CAAC,OAAoB,EAAK,OAAO,CAAC,EAAE,sSAAsS,CAAC,CAAC,ICSh2B,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,WAAS,EAAgC,SAAS,aAAW,WAAS,EAAgC,SAAS,aAAW,YAAU,EAAgC,UAAU,eAAa,EAAgC,aAAa,cAAY,EAAgC,YAAY,cAAY,EAAgC,YAAY,kBAAgB,EAAgC,gBAAgB,oBAAkB,EAAgC,kBAAkB,SAAO,EACzhB,EAAmB,CAAC,OAAO,UAAU,MAAM,UAAU,CACrD,EAAgBA,EAAa,EAAS,CACvC,CAAC,EAAmB,GAAuBC,EAAe,EAAW,CAAC,MAAoB,CAC/F,GAAG,EAAgB,UAAU,EAAS,CAAC,IAAM,EAAY,EAAmB,EAAgB,SAEzF,EAAW,MAAM,CAAC,aAAa,GAAG,EAAY,aAAa,CAAE,EAAsB,EAAmB,GAAU,CACnH,EAAsB,EAAW,MAAW,IAAa,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