{"id":27859849,"url":"https://github.com/shejanmahamud/recaptz","last_synced_at":"2025-05-04T17:11:09.625Z","repository":{"id":284333288,"uuid":"954594452","full_name":"ShejanMahamud/ReCAPTZ","owner":"ShejanMahamud","description":"ReCAPTZ is a powerful and customizable CAPTCHA solution for React applications, featuring built-in validation, accessibility, and dark mode support.","archived":false,"fork":false,"pushed_at":"2025-03-27T08:43:02.000Z","size":206,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-27T14:19:26.903Z","etag":null,"topics":["bot-protection","captcha","form-security","react-captcha","react-security","recaptz"],"latest_commit_sha":null,"homepage":"https://recaptz.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShejanMahamud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-25T10:19:01.000Z","updated_at":"2025-03-27T08:43:06.000Z","dependencies_parsed_at":"2025-03-25T11:38:59.618Z","dependency_job_id":null,"html_url":"https://github.com/ShejanMahamud/ReCAPTZ","commit_stats":null,"previous_names":["shejanmahamud/recaptz"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShejanMahamud%2FReCAPTZ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShejanMahamud%2FReCAPTZ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShejanMahamud%2FReCAPTZ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShejanMahamud%2FReCAPTZ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShejanMahamud","download_url":"https://codeload.github.com/ShejanMahamud/ReCAPTZ/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252369013,"owners_count":21736878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot-protection","captcha","form-security","react-captcha","react-security","recaptz"],"created_at":"2025-05-04T17:11:08.850Z","updated_at":"2025-05-04T17:11:09.619Z","avatar_url":"https://github.com/ShejanMahamud.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReCAPTZ\n\nA modern, customizable CAPTCHA component for React applications with TypeScript support. This package provides multiple CAPTCHA types, validation rules, and a beautiful UI out of the box.\n\n## Features\n\n- 🎨 **Beautiful Design**: Modern, clean UI with dark mode support and gradient effects\n- 🔒 **Multiple CAPTCHA Types**: Numbers, letters, mixed, or custom characters\n- 🎯 **Validation Rules**: Extensive validation options including custom validators\n- ♿ **Accessibility**: Screen reader support and keyboard navigation\n- 🌙 **Dark Mode**: Built-in dark mode support with automatic theme detection\n- 🎵 **Audio Support**: Text-to-speech for visually impaired users\n- 🔄 **Refreshable**: Easy CAPTCHA refresh with animation\n- ✨ **Customizable**: Extensive styling and validation options\n- 📱 **Responsive**: Works on all screen sizes\n- 🎯 **Form Integration**: Works with React Hook Form, Formik, and other form libraries\n- 🔍 **TypeScript**: Full TypeScript support with type definitions\n- 📦 **Zero Dependencies**: Minimal bundle size with no external dependencies\n- 🌐 **Browser Support**: Works in all modern browsers\n- 🔧 **Easy Integration**: Simple API with comprehensive documentation\n\n## Installation\n\n```bash\nnpm install recaptz\n```\n\n## Quick Start\n\n```tsx\nimport { Captcha } from 'recaptz';\n\nfunction App() {\n  const handleValidate = (isValid: boolean) =\u003e {\n    if (isValid) {\n      console.log('CAPTCHA validated successfully');\n    }\n  };\n\n  return (\n    \u003cCaptcha\n      type=\"mixed\"\n      length={6}\n      onValidate={handleValidate}\n    /\u003e\n  );\n}\n```\n\n## Examples\n\n### Basic Types\n\n#### Numbers Only\n```tsx\n\u003cCaptcha\n  type=\"numbers\"\n  length={4}\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true,\n    allowedCharacters: '0123456789',\n    minLength: 4,\n    maxLength: 4\n  }}\n/\u003e\n```\n\n#### Letters Only\n```tsx\n\u003cCaptcha\n  type=\"letters\"\n  length={6}\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true,\n    customValidator: (value) =\u003e /^[a-zA-Z]+$/.test(value) || 'Only letters are allowed'\n  }}\n/\u003e\n```\n\n#### Mixed Characters\n```tsx\n\u003cCaptcha\n  type=\"mixed\"\n  length={8}\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true,\n    minLength: 8,\n    maxLength: 8\n  }}\n/\u003e\n```\n\n### Advanced Features\n\n#### Timed CAPTCHA\n```tsx\n\u003cCaptcha\n  type=\"mixed\"\n  length={5}\n  refreshInterval={30} // Refreshes every 30 seconds\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true,\n    minLength: 5\n  }}\n/\u003e\n```\n\n#### Accessible CAPTCHA\n```tsx\n\u003cCaptcha\n  type=\"letters\"\n  length={4}\n  autoFocus\n  showSuccessAnimation\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true\n  }}\n/\u003e\n```\n\n#### Dark Mode\n```tsx\n\u003cCaptcha\n  type=\"mixed\"\n  length={6}\n  darkMode\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true\n  }}\n/\u003e\n```\n\n#### Audio Mode\n```tsx\n\u003cCaptcha\n  type=\"mixed\"\n  length={6}\n  enableAudio\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true\n  }}\n/\u003e\n```\n\n#### Max Attempts\n```tsx\n\u003cCaptcha\n  type=\"mixed\"\n  length={6}\n  maxAttempts={3} \n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true\n  }}\n/\u003e\n```\n\n#### Complex Validation\n```tsx\n\u003cCaptcha\n  customCharacters=\"ABCDEF123456\"\n  length={6}\n  caseSensitive={true}\n  onValidate={(isValid) =\u003e console.log('Valid:', isValid)}\n  validationRules={{\n    required: true,\n    allowedCharacters: \"ABCDEF123456\",\n    customValidator: (value) =\u003e {\n      const hasLetter = /[A-F]/.test(value);\n      const hasNumber = /[1-6]/.test(value);\n      const hasMinLength = value.length \u003e= 6;\n      if (!hasLetter) return 'Must contain at least one letter';\n      if (!hasNumber) return 'Must contain at least one number';\n      if (!hasMinLength) return 'Must be 6 characters long';\n      return true;\n    }\n  }}\n/\u003e\n```\n\n### Styling\n\n#### Custom Classes and Styles\n```tsx\n\u003cCaptcha\n  className=\"my-custom-class\"\n  customStyles={{\n    backgroundColor: '#f8f9fa',\n    borderRadius: '8px',\n    padding: '20px'\n  }}\n  darkMode={true}\n/\u003e\n```\n\n### Form Integration\n\n#### React Hook Form\n```tsx\nimport { useForm } from 'react-hook-form';\nimport { Captcha } from 'recaptz';\n\nfunction LoginForm() {\n  const { handleSubmit, setError, clearErrors } = useForm();\n  const [isCaptchaValid, setIsCaptchaValid] = useState(false);\n\n  const onSubmit = (data) =\u003e {\n    if (!isCaptchaValid) {\n      setError('captcha', {\n        type: 'manual',\n        message: 'Please complete the CAPTCHA'\n      });\n      return;\n    }\n    // Handle form submission\n  };\n\n  return (\n    \u003cform onSubmit={handleSubmit(onSubmit)}\u003e\n      {/* Form fields */}\n      \u003cCaptcha\n        type=\"mixed\"\n        length={6}\n        onValidate={(isValid) =\u003e {\n          setIsCaptchaValid(isValid);\n          if (isValid) clearErrors('captcha');\n        }}\n      /\u003e\n      \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n    \u003c/form\u003e\n  );\n}\n```\n\n#### Formik\n```tsx\nimport { Formik, Form } from 'formik';\nimport { Captcha } from 'recaptz';\n\nfunction LoginForm() {\n  return (\n    \u003cFormik\n      initialValues={{ captchaValid: false }}\n      onSubmit={(values) =\u003e {\n        if (values.captchaValid) {\n          // Handle form submission\n        }\n      }}\n    \u003e\n      {({ setFieldValue }) =\u003e (\n        \u003cForm\u003e\n          {/* Form fields */}\n          \u003cCaptcha\n            type=\"mixed\"\n            length={6}\n            onValidate={(isValid) =\u003e {\n              setFieldValue('captchaValid', isValid);\n            }}\n          /\u003e\n          \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n        \u003c/Form\u003e\n      )}\n    \u003c/Formik\u003e\n  );\n}\n```\n\n## Props\n\n| Prop | Type | Default | Description |\n|------|------|---------|-------------|\n| `type` | `'numbers' \\| 'letters' \\| 'mixed'` | `'mixed'` | Type of CAPTCHA to generate |\n| `length` | `number` | `6` | Length of CAPTCHA text |\n| `onChange` | `(value: string) =\u003e void` | - | Callback when input changes |\n| `onValidate` | `(isValid: boolean) =\u003e void` | - | Callback when validation occurs |\n| `className` | `string` | `''` | Additional CSS classes |\n| `refreshable` | `boolean` | `true` | Whether CAPTCHA can be refreshed |\n| `caseSensitive` | `boolean` | `false` | Case-sensitive validation |\n| `customCharacters` | `string` | - | Custom character set |\n| `customStyles` | `React.CSSProperties` | - | Custom inline styles |\n| `validationRules` | `ValidationRules` | - | Custom validation rules |\n| `darkMode` | `boolean` | `false` | Enable dark mode |\n| `autoFocus` | `boolean` | `false` | Auto-focus the input field |\n| `showSuccessAnimation` | `boolean` | `false` | Show success animation |\n| `refreshInterval` | `number` | - | Auto-refresh interval in seconds |\n| `maxAttempts` | `number` | - | Maximum validation attempts |\n| `inputButtonStyle` | `string` | - | Custom class for input button styles |\n| `enableAudio` | `boolean` | - | Enable or disable audio support |\n\n## Validation Rules\n\n```typescript\ninterface ValidationRules {\n  minLength?: number;\n  maxLength?: number;\n  allowedCharacters?: string;\n  required?: boolean;\n  caseSensitive?: boolean;\n  customValidator?: (value: string) =\u003e boolean | string;\n}\n```\n\n## Keyboard Shortcuts\n\n- `Space`: Hear the CAPTCHA code\n- `Enter`: Validate the input\n- `Escape`: Clear the input\n\n## Accessibility Features\n\n- Screen reader support with ARIA labels\n- Keyboard navigation\n- High contrast mode support\n- Audio feedback\n- Focus management\n- Clear error messages\n- Responsive design\n\n## Browser Support\n\n- Chrome (latest)\n- Firefox (latest)\n- Safari (latest)\n- Edge (latest)\n- Opera (latest)\n\n## Contributing\n\nWe welcome contributions! Please feel free to submit a Pull Request.\n\n## License\n\nMIT © Shejan Mahamud","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshejanmahamud%2Frecaptz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshejanmahamud%2Frecaptz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshejanmahamud%2Frecaptz/lists"}