+{"code":"import React from 'react';\r\nimport { useIdentityContext } from 'react-netlify-identity';\r\nimport useLoading from '../useLoading';\r\nimport VisuallyHidden from '@reach/visually-hidden';\r\nexport function Signup({ onSignup }) {\r\n const { signupUser } = useIdentityContext();\r\n const formRef = React.useRef(null);\r\n const [msg, setMsg] = React.useState('');\r\n const [isLoading, load] = useLoading();\r\n const signup = () => {\r\n if (!formRef.current)\r\n return;\r\n const full_name = formRef.current.username.value;\r\n const email = formRef.current.email.value;\r\n const password = formRef.current.password.value;\r\n const data = { signupSource: 'react-netlify-identity-widget', full_name };\r\n load(signupUser(email, password, data))\r\n .then((user) => {\r\n if (process.env.NODE_ENV !== 'production')\r\n console.log('Success! Signed up', user);\r\n if (onSignup)\r\n onSignup(user);\r\n })\r\n .catch((err) => void console.error(err) || setMsg('Error: ' + err.message));\r\n };\r\n return (React.createElement(\"form\", { ref: formRef, className: \"form\", onSubmit: (e) => {\r\n e.preventDefault();\r\n signup();\r\n } },\r\n React.createElement(\"div\", { className: \"formGroup\", key: \"username\" },\r\n React.createElement(\"label\", null,\r\n React.createElement(VisuallyHidden, null, \"Enter your name\"),\r\n React.createElement(\"input\", { id: \"username\", className: \"formControl\", type: \"name\", name: \"username\", placeholder: \"Name\", autoCapitalize: \"off\", required: true }),\r\n React.createElement(\"div\", { className: \"inputFieldIcon inputFieldName\" }))),\r\n React.createElement(\"div\", { className: \"formGroup\", key: \"email\" },\r\n React.createElement(\"label\", null,\r\n React.createElement(VisuallyHidden, null, \"Enter your email\"),\r\n React.createElement(\"input\", { className: \"formControl\", type: \"email\", name: \"email\", placeholder: \"Email\", autoCapitalize: \"off\", required: true }),\r\n React.createElement(\"div\", { className: \"inputFieldIcon inputFieldEmail\" }))),\r\n React.createElement(\"div\", { className: \"formGroup\", key: \"password\" },\r\n React.createElement(\"label\", null,\r\n React.createElement(VisuallyHidden, null, \"Enter your password\"),\r\n React.createElement(\"input\", { className: \"formControl\", type: \"password\", name: \"password\", placeholder: \"Password\", required: true }),\r\n React.createElement(\"div\", { className: \"inputFieldIcon inputFieldPassword\" }))),\r\n React.createElement(\"div\", null,\r\n React.createElement(\"button\", { type: \"submit\", className: isLoading ? 'btn saving' : 'btn' }, \"Sign Up\"),\r\n msg && React.createElement(\"pre\", { style: { background: 'salmon', padding: 10 } }, msg))));\r\n}\r\n//# sourceMappingURL=signup.js.map","references":["/Users/swyx/Netlify/react-netlify-identity-widget/node_modules/@types/react/index.d.ts","/Users/swyx/Netlify/react-netlify-identity-widget/node_modules/react-netlify-identity/dist/index.d.ts","/Users/swyx/Netlify/react-netlify-identity-widget/src/useLoading.tsx"],"map":"{\"version\":3,\"file\":\"signup.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/components/signup.tsx\"],\"names\":[],\"mappings\":\"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAQ,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,cAAc,MAAM,wBAAwB,CAAA;AAKnD,MAAM,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAe;IAC9C,MAAM,EAAE,UAAU,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAA;IACnD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACxC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,UAAU,EAAE,CAAA;IACtC,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,CAAC,OAAO,CAAC,OAAO;YAAE,OAAM;QAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;QAChD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAA;QACzC,MAAM,QAAQ,GAAG,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,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,OAAO,EACZ,WAAW,EAAC,OAAO,EACnB,cAAc,EAAC,KAAK,EACpB,QAAQ,EAAE,IAAI,GACd;gBACF,6BAAK,SAAS,EAAC,gCAAgC,GAAG,CAC5C,CACJ;QACN,6BAAK,SAAS,EAAC,WAAW,EAAC,GAAG,EAAC,UAAU;YACvC;gBACE,oBAAC,cAAc,8BAAqC;gBACpD,+BAAO,SAAS,EAAC,aAAa,EAAC,IAAI,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,WAAW,EAAC,UAAU,EAAC,QAAQ,EAAE,IAAI,GAAI;gBACxG,6BAAK,SAAS,EAAC,mCAAmC,GAAG,CAC/C,CACJ;QACN;YACE,gCAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,cAExD;YACR,GAAG,IAAI,6BAAK,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,IAAG,GAAG,CAAO,CAClE,CACD,CACR,CAAA;AACH,CAAC\"}","dts":{"name":"/Users/swyx/Netlify/react-netlify-identity-widget/src/components/signup.d.ts","writeByteOrderMark":false,"text":"/// <reference types=\"react\" />\r\nimport { User } from 'react-netlify-identity';\r\ndeclare type SignupProps = {\r\n onSignup?: (user?: User) => void;\r\n};\r\nexport declare function Signup({ onSignup }: SignupProps): JSX.Element;\r\nexport {};\r\n"}}
0 commit comments