Skip to content

Commit 490aed7

Browse files
committed
chore(docs): build registries
1 parent 3768510 commit 490aed7

30 files changed

+654
-14
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
3+
"name": "forgot-password-form-clerk",
4+
"type": "registry:component",
5+
"title": "Forgot Password Form (Clerk)",
6+
"author": "@mrzachnugent",
7+
"description": "A form that sends a password reset OTP to the user's email address with Clerk integration.",
8+
"dependencies": [
9+
"@clerk/clerk-expo"
10+
],
11+
"registryDependencies": [
12+
"https://reactnativereusables.com/r/default/button.json",
13+
"https://reactnativereusables.com/r/default/card.json",
14+
"https://reactnativereusables.com/r/default/input.json",
15+
"https://reactnativereusables.com/r/default/label.json",
16+
"https://reactnativereusables.com/r/default/text.json"
17+
],
18+
"files": [
19+
{
20+
"path": "./node_modules/@rnr/registry/src/blocks/clerk/forgot-password-form.tsx",
21+
"content": "import { Button } from '@/registry/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/registry/ui/card';\nimport { Input } from '@/registry/ui/input';\nimport { Label } from '@/registry/ui/label';\nimport { Text } from '@/registry/ui/text';\nimport { useSignIn } from '@clerk/clerk-expo';\nimport * as React from 'react';\nimport { View } from 'react-native';\n\nexport function ForgotPasswordForm() {\n const [email, setEmail] = React.useState('');\n const { signIn, isLoaded } = useSignIn();\n const [error, setError] = React.useState<{ email?: string; password?: string }>({});\n\n const onSubmit = async () => {\n if (!email) {\n setError({ email: 'Email is required' });\n return;\n }\n if (!isLoaded) {\n return;\n }\n\n try {\n await signIn.create({\n strategy: 'reset_password_email_code',\n identifier: email,\n });\n\n // TODO: Navigate to reset password screen\n } catch (err) {\n // See https://go.clerk.com/mRUDrIe for more info on error handling\n if (err instanceof Error) {\n setError({ email: err.message });\n return;\n }\n console.error(JSON.stringify(err, null, 2));\n }\n };\n\n return (\n <View className=\"gap-6\">\n <Card className=\"border-border/0 sm:border-border shadow-none sm:shadow-sm sm:shadow-black/5\">\n <CardHeader>\n <CardTitle className=\"text-center text-xl sm:text-left\">Forgot password?</CardTitle>\n <CardDescription className=\"text-center sm:text-left\">\n Enter your email to reset your password\n </CardDescription>\n </CardHeader>\n <CardContent className=\"gap-6\">\n <View className=\"gap-6\">\n <View className=\"gap-1.5\">\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n defaultValue={email}\n placeholder=\"[email protected]\"\n keyboardType=\"email-address\"\n autoComplete=\"email\"\n autoCapitalize=\"none\"\n onChangeText={setEmail}\n onSubmitEditing={onSubmit}\n returnKeyType=\"send\"\n />\n {error.email ? (\n <Text className=\"text-destructive text-sm font-medium\">{error.email}</Text>\n ) : null}\n </View>\n <Button className=\"w-full\" onPress={onSubmit}>\n <Text>Reset your password</Text>\n </Button>\n </View>\n </CardContent>\n </Card>\n </View>\n );\n}\n",
22+
"type": "registry:component"
23+
}
24+
]
25+
}

apps/docs/public/r/default/forgot-password-form.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"files": [
1616
{
1717
"path": "./node_modules/@rnr/registry/src/blocks/forgot-password-form.tsx",
18-
"content": "import { Button } from '@/registry/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/registry/ui/card';\nimport { Input } from '@/registry/ui/input';\nimport { Label } from '@/registry/ui/label';\nimport { Text } from '@/registry/ui/text';\nimport { View } from 'react-native';\n\nexport function ForgotPasswordForm() {\n return (\n <View className=\"gap-6\">\n <Card className=\"border-border/0 sm:border-border shadow-none sm:shadow-sm sm:shadow-black/5\">\n <CardHeader>\n <CardTitle className=\"text-center text-xl sm:text-left\">Forgot password?</CardTitle>\n <CardDescription className=\"text-center sm:text-left\">\n Enter your email to reset your password\n </CardDescription>\n </CardHeader>\n <CardContent className=\"gap-6\">\n <View className=\"gap-6\">\n <View className=\"gap-1.5\">\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n placeholder=\"[email protected]\"\n keyboardType=\"email-address\"\n autoComplete=\"email\"\n autoCapitalize=\"none\"\n returnKeyType=\"send\"\n />\n </View>\n <View className=\"gap-3\">\n <Button className=\"w-full\">\n <Text>Reset your password</Text>\n </Button>\n </View>\n </View>\n </CardContent>\n </Card>\n </View>\n );\n}\n",
18+
"content": "import { Button } from '@/registry/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/registry/ui/card';\nimport { Input } from '@/registry/ui/input';\nimport { Label } from '@/registry/ui/label';\nimport { Text } from '@/registry/ui/text';\nimport { View } from 'react-native';\n\nexport function ForgotPasswordForm() {\n function onSubmit() {\n // TODO: Submit form and navigate to reset password screen if successful\n }\n\n return (\n <View className=\"gap-6\">\n <Card className=\"border-border/0 sm:border-border shadow-none sm:shadow-sm sm:shadow-black/5\">\n <CardHeader>\n <CardTitle className=\"text-center text-xl sm:text-left\">Forgot password?</CardTitle>\n <CardDescription className=\"text-center sm:text-left\">\n Enter your email to reset your password\n </CardDescription>\n </CardHeader>\n <CardContent className=\"gap-6\">\n <View className=\"gap-6\">\n <View className=\"gap-1.5\">\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n placeholder=\"[email protected]\"\n keyboardType=\"email-address\"\n autoComplete=\"email\"\n autoCapitalize=\"none\"\n returnKeyType=\"send\"\n onSubmitEditing={onSubmit}\n />\n </View>\n <Button className=\"w-full\" onPress={onSubmit}>\n <Text>Reset your password</Text>\n </Button>\n </View>\n </CardContent>\n </Card>\n </View>\n );\n}\n",
1919
"type": "registry:component"
2020
}
2121
]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
3+
"name": "reset-password-form-clerk",
4+
"type": "registry:component",
5+
"title": "Reset Password Form (Clerk)",
6+
"author": "@mrzachnugent",
7+
"description": "A form for resetting a password with an OTP sent via email with Clerk integration.",
8+
"dependencies": [
9+
"@clerk/clerk-expo"
10+
],
11+
"registryDependencies": [
12+
"https://reactnativereusables.com/r/default/button.json",
13+
"https://reactnativereusables.com/r/default/card.json",
14+
"https://reactnativereusables.com/r/default/input.json",
15+
"https://reactnativereusables.com/r/default/label.json",
16+
"https://reactnativereusables.com/r/default/text.json"
17+
],
18+
"files": [
19+
{
20+
"path": "./node_modules/@rnr/registry/src/blocks/clerk/reset-password-form.tsx",
21+
"content": "import { Button } from '@/registry/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/registry/ui/card';\nimport { Input } from '@/registry/ui/input';\nimport { Label } from '@/registry/ui/label';\nimport { Text } from '@/registry/ui/text';\nimport { useSignIn } from '@clerk/clerk-expo';\nimport * as React from 'react';\nimport { TextInput, View } from 'react-native';\n\nexport function ResetPasswordForm() {\n const { signIn, setActive, isLoaded } = useSignIn();\n const [password, setPassword] = React.useState('');\n const [code, setCode] = React.useState('');\n const codeInputRef = React.useRef<TextInput>(null);\n const [error, setError] = React.useState({ code: '', password: '' });\n\n async function onSubmit() {\n if (!isLoaded) {\n return;\n }\n try {\n const result = await signIn?.attemptFirstFactor({\n strategy: 'reset_password_email_code',\n code,\n password,\n });\n\n if (result.status === 'complete') {\n // Set the active session to\n // the newly created session (user is now signed in)\n setActive({ session: result.createdSessionId });\n // TODO: If your app does not use `Stack.Protected`, navigate to your protected screen\n return;\n }\n // TODO: Handle other statuses\n } catch (err) {\n // See https://go.clerk.com/mRUDrIe for more info on error handling\n if (err instanceof Error) {\n const isPasswordMessage = err.message.toLowerCase().includes('password');\n setError({ code: '', password: isPasswordMessage ? err.message : '' });\n return;\n }\n console.error(JSON.stringify(err, null, 2));\n }\n }\n\n function onPasswordSubmitEditing() {\n codeInputRef.current?.focus();\n }\n\n return (\n <View className=\"gap-6\">\n <Card className=\"border-border/0 sm:border-border shadow-none sm:shadow-sm sm:shadow-black/5\">\n <CardHeader>\n <CardTitle className=\"text-center text-xl sm:text-left\">Reset password</CardTitle>\n <CardDescription className=\"text-center sm:text-left\">\n Enter the code sent to your email and set a new password\n </CardDescription>\n </CardHeader>\n <CardContent className=\"gap-6\">\n <View className=\"gap-6\">\n <View className=\"gap-1.5\">\n <View className=\"flex-row items-center\">\n <Label htmlFor=\"password\">New password</Label>\n </View>\n <Input\n id=\"password\"\n secureTextEntry\n onChangeText={setPassword}\n returnKeyType=\"next\"\n submitBehavior=\"submit\"\n onSubmitEditing={onPasswordSubmitEditing}\n />\n {error.password ? (\n <Text className=\"text-destructive text-sm font-medium\">{error.password}</Text>\n ) : null}\n </View>\n <View className=\"gap-1.5\">\n <Label htmlFor=\"code\">Verification code</Label>\n <Input\n id=\"code\"\n autoCapitalize=\"none\"\n onChangeText={setCode}\n returnKeyType=\"send\"\n keyboardType=\"numeric\"\n autoComplete=\"sms-otp\"\n textContentType=\"oneTimeCode\"\n onSubmitEditing={onSubmit}\n />\n {error.code ? (\n <Text className=\"text-destructive text-sm font-medium\">{error.code}</Text>\n ) : null}\n </View>\n <Button className=\"w-full\" onPress={onSubmit}>\n <Text>Reset Password</Text>\n </Button>\n </View>\n </CardContent>\n </Card>\n </View>\n );\n}\n",
22+
"type": "registry:component"
23+
}
24+
]
25+
}

apps/docs/public/r/default/reset-password-form.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"files": [
1616
{
1717
"path": "./node_modules/@rnr/registry/src/blocks/reset-password-form.tsx",
18-
"content": "import { Button } from '@/registry/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/registry/ui/card';\nimport { Input } from '@/registry/ui/input';\nimport { Label } from '@/registry/ui/label';\nimport { Text } from '@/registry/ui/text';\nimport * as React from 'react';\nimport { TextInput, View } from 'react-native';\n\nexport function ResetPasswordForm() {\n const codeInputRef = React.useRef<TextInput>(null);\n\n function onPasswordSubmitEditing() {\n codeInputRef.current?.focus();\n }\n\n return (\n <View className=\"gap-6\">\n <Card className=\"border-border/0 sm:border-border shadow-none sm:shadow-sm sm:shadow-black/5\">\n <CardHeader>\n <CardTitle className=\"text-center text-xl sm:text-left\">Reset password</CardTitle>\n <CardDescription className=\"text-center sm:text-left\">\n Enter the code sent to your email and set a new password\n </CardDescription>\n </CardHeader>\n <CardContent className=\"gap-6\">\n <View className=\"gap-6\">\n <View className=\"gap-1.5\">\n <View className=\"flex-row items-center\">\n <Label htmlFor=\"password\">New password</Label>\n </View>\n <Input\n id=\"password\"\n secureTextEntry\n returnKeyType=\"next\"\n submitBehavior=\"submit\"\n onSubmitEditing={onPasswordSubmitEditing}\n />\n </View>\n <View className=\"gap-1.5\">\n <Label htmlFor=\"code\">Verification code</Label>\n <Input\n id=\"code\"\n autoCapitalize=\"none\"\n returnKeyType=\"send\"\n keyboardType=\"numeric\"\n autoComplete=\"sms-otp\"\n textContentType=\"oneTimeCode\"\n />\n </View>\n <View className=\"gap-3\">\n <Button className=\"w-full\">\n <Text>Reset Password</Text>\n </Button>\n </View>\n </View>\n </CardContent>\n </Card>\n </View>\n );\n}\n",
18+
"content": "import { Button } from '@/registry/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/registry/ui/card';\nimport { Input } from '@/registry/ui/input';\nimport { Label } from '@/registry/ui/label';\nimport { Text } from '@/registry/ui/text';\nimport * as React from 'react';\nimport { TextInput, View } from 'react-native';\n\nexport function ResetPasswordForm() {\n const codeInputRef = React.useRef<TextInput>(null);\n\n function onPasswordSubmitEditing() {\n codeInputRef.current?.focus();\n }\n\n function onSubmit() {\n // TODO: Submit form and navigate to protected screen if successful\n }\n\n return (\n <View className=\"gap-6\">\n <Card className=\"border-border/0 sm:border-border shadow-none sm:shadow-sm sm:shadow-black/5\">\n <CardHeader>\n <CardTitle className=\"text-center text-xl sm:text-left\">Reset password</CardTitle>\n <CardDescription className=\"text-center sm:text-left\">\n Enter the code sent to your email and set a new password\n </CardDescription>\n </CardHeader>\n <CardContent className=\"gap-6\">\n <View className=\"gap-6\">\n <View className=\"gap-1.5\">\n <View className=\"flex-row items-center\">\n <Label htmlFor=\"password\">New password</Label>\n </View>\n <Input\n id=\"password\"\n secureTextEntry\n returnKeyType=\"next\"\n submitBehavior=\"submit\"\n onSubmitEditing={onPasswordSubmitEditing}\n />\n </View>\n <View className=\"gap-1.5\">\n <Label htmlFor=\"code\">Verification code</Label>\n <Input\n id=\"code\"\n autoCapitalize=\"none\"\n returnKeyType=\"send\"\n keyboardType=\"numeric\"\n autoComplete=\"sms-otp\"\n textContentType=\"oneTimeCode\"\n onSubmitEditing={onSubmit}\n />\n </View>\n <Button className=\"w-full\" onPress={onSubmit}>\n <Text>Reset Password</Text>\n </Button>\n </View>\n </CardContent>\n </Card>\n </View>\n );\n}\n",
1919
"type": "registry:component"
2020
}
2121
]

0 commit comments

Comments
 (0)