{"_id":"@allem-sdk/forms","_rev":"3-a9d1641ea5d05d6bbd0e53f45d245859","name":"@allem-sdk/forms","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@allem-sdk/forms","version":"0.1.0","keywords":["allem-sdk","react","hooks","forms","validation","useForm"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/forms@0.1.0","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"a88a9cc26824d71166cafe471690e13f4131e2c3","tarball":"https://registry.npmjs.org/@allem-sdk/forms/-/forms-0.1.0.tgz","fileCount":8,"integrity":"sha512-Bmy9NmhdutpPWxP4wjk+y7XteURXZ/G5M0d+L8mrcu47bXA5almVgFFGCQbMghaZFiX3IDIfa08V9dcOf7p3YQ==","signatures":[{"sig":"MEYCIQDAEFbyo6hNDd2VTJfN/DIevTAPg9hD6e00aB4C0SrgmgIhAOrGh18wY8yZ7+Z6ZTBs9xNDZXlE/QsrXcFqncDSuqPV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37501},"main":"./dist/index.js","_from":"file:allem-sdk-forms-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/015d8be59d892d7f9a9a34d235719fd9/allem-sdk-forms-0.1.0.tgz","_integrity":"sha512-Bmy9NmhdutpPWxP4wjk+y7XteURXZ/G5M0d+L8mrcu47bXA5almVgFFGCQbMghaZFiX3IDIfa08V9dcOf7p3YQ==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/forms"},"_npmVersion":"11.12.1","description":"Lightweight form management and validation for React","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/forms_0.1.0_1779452656012_0.4569498004118513","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@allem-sdk/forms","version":"0.1.1","keywords":["allem-sdk","react","hooks","forms","validation","useForm"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/forms@0.1.1","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"3f46a830f9d04a67f75f722003d9d101748a1d4b","tarball":"https://registry.npmjs.org/@allem-sdk/forms/-/forms-0.1.1.tgz","fileCount":8,"integrity":"sha512-FQOzgsMm9Y2o1FjEeWRNIi4A2uAoymeniW17a8C5dx8f0gmpTDWSiKqOXgeoz6mj5nyCcHHHgjn+8PcRyh1xNg==","signatures":[{"sig":"MEUCIQDkM6QPAhzF8bYcbWfw4666elCrhNHG1geIy2WRgFrYVAIgY96Wx5Ajdnlr5w8h3bNYJ6FWnCDb2Ck4PFDgFJAatuY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37499},"main":"./dist/index.js","_from":"file:allem-sdk-forms-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/38553a9c0b1bd1d2aa4888cdbb2f2025/allem-sdk-forms-0.1.1.tgz","_integrity":"sha512-FQOzgsMm9Y2o1FjEeWRNIi4A2uAoymeniW17a8C5dx8f0gmpTDWSiKqOXgeoz6mj5nyCcHHHgjn+8PcRyh1xNg==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/forms"},"_npmVersion":"11.12.1","description":"Lightweight form management and validation for React","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/forms_0.1.1_1779454892891_0.43455802674272426","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@allem-sdk/forms","version":"0.1.2","description":"Lightweight React form hooks with 9 built-in validators. useForm, useField, required, email, minLength, and more. Zero dependencies.","license":"MIT","author":{"name":"Ahmed Allem"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"sideEffects":false,"devDependencies":{"@testing-library/react":"^16.0.0","@types/react":"^19.0.0","jsdom":"^25.0.0","react":"^19.0.0","react-dom":"^19.0.0","tsup":"^8.4.0","typescript":"^5.8.0","vitest":"^3.0.0"},"peerDependencies":{"react":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/forms"},"keywords":["allem-sdk","react","react-hooks","forms","form-validation","useForm","useField","validation","typescript","nextjs","lightweight"],"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","clean":"rm -rf dist","test":"vitest run"},"_id":"@allem-sdk/forms@0.1.2","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"homepage":"https://github.com/kingofmit/allem-sdk#readme","_integrity":"sha512-FjstfGMiOsCmUoHG4ZCaUWoY0eXTY2litt3lgInjp48kbDr3X2yhw1L05hQ6sDAcI+tmaEdWgL/L06Ipp/kavw==","_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/c634738cbfb154d6c079b84a49bb8b29/allem-sdk-forms-0.1.2.tgz","_from":"file:allem-sdk-forms-0.1.2.tgz","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-FjstfGMiOsCmUoHG4ZCaUWoY0eXTY2litt3lgInjp48kbDr3X2yhw1L05hQ6sDAcI+tmaEdWgL/L06Ipp/kavw==","shasum":"91200ca840643029bf826375989447aa0ae07e8b","tarball":"https://registry.npmjs.org/@allem-sdk/forms/-/forms-0.1.2.tgz","fileCount":8,"unpackedSize":37817,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIE+tzJ63WF1XvqDNXUruTy7pxV4LtA/dOQJIX6PQK83fAiEAk663msXGl63qtAPs1bO4w6oj8mOHBPllMN9Yzedahxw="}]},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"directories":{},"maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/forms_0.1.2_1779499471767_0.6752435046636016"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T12:24:15.923Z","modified":"2026-05-23T01:24:32.077Z","0.1.0":"2026-05-22T12:24:16.225Z","0.1.1":"2026-05-22T13:01:33.051Z","0.1.2":"2026-05-23T01:24:31.941Z"},"bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"author":{"name":"Ahmed Allem"},"license":"MIT","homepage":"https://github.com/kingofmit/allem-sdk#readme","keywords":["allem-sdk","react","react-hooks","forms","form-validation","useForm","useField","validation","typescript","nextjs","lightweight"],"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/forms"},"description":"Lightweight React form hooks with 9 built-in validators. useForm, useField, required, email, minLength, and more. Zero dependencies.","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"readme":"<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/kingofmit/allem-sdk/main/.github/AllemSDK.png\" alt=\"Allem SDK\" />\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@allem-sdk/forms\"><img src=\"https://img.shields.io/npm/v/@allem-sdk/forms.svg\" alt=\"npm version\" /></a>\n  <a href=\"https://github.com/kingofmit/allem-sdk/blob/main/LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\" /></a>\n  <img src=\"https://img.shields.io/badge/react-19-61dafb\" alt=\"React 19\" />\n  <img src=\"https://img.shields.io/badge/typescript-strict-blue\" alt=\"TypeScript\" />\n</p>\n\n# @allem-sdk/forms\n\nLightweight form management and validation for React. No heavy dependencies, just hooks.\n\n## Installation\n\n```bash\nnpm install @allem-sdk/forms\n```\n\n## Usage\n\n```tsx\nimport { useForm, required, email, minLength } from \"@allem-sdk/forms\";\n\nfunction ContactForm() {\n  const form = useForm({\n    name: { initialValue: \"\", rules: [required(\"Name is required\")] },\n    email: { initialValue: \"\", rules: [required(), email()] },\n    message: { initialValue: \"\", rules: [required(), minLength(10)] },\n  });\n\n  const onSubmit = async (values: typeof form.values) => {\n    await fetch(\"/api/contact\", {\n      method: \"POST\",\n      body: JSON.stringify(values),\n    });\n  };\n\n  return (\n    <form onSubmit={form.handleSubmit(onSubmit)}>\n      <input {...form.getFieldProps(\"name\")} />\n      {form.touched.name && form.errors.name && <span>{form.errors.name}</span>}\n\n      <input {...form.getFieldProps(\"email\")} />\n      <textarea {...form.getFieldProps(\"message\")} />\n      <button type=\"submit\">Send</button>\n    </form>\n  );\n}\n```\n\n## Validators\n\n| Validator | Description |\n|-----------|-------------|\n| `required(msg?)` | Field must not be empty |\n| `minLength(n, msg?)` | Minimum string length |\n| `maxLength(n, msg?)` | Maximum string length |\n| `min(n, msg?)` | Minimum numeric value |\n| `max(n, msg?)` | Maximum numeric value |\n| `pattern(regex, msg?)` | Match a regular expression |\n| `email(msg?)` | Valid email format |\n| `url(msg?)` | Valid URL format |\n| `custom(fn, msg?)` | Custom validation function |\n\n## Exports\n\n| Export | Type | Description |\n|--------|------|-------------|\n| `useForm` | Hook | Full form management: values, errors, touched, submit, reset |\n| `useField` | Hook | Standalone single-field hook with validation |\n| Validators | Functions | 9 built-in validators (see table above) |\n\n## Part of [Allem SDK](https://github.com/kingofmit/allem-sdk)\n\nThis package can be used standalone or as part of the full SDK. Install `allem-sdk` to get all packages in one install.\n\n## Support\n\nIf you find Allem SDK useful, consider supporting its development:\n\n<a href=\"https://buymeacoffee.com/kingofmit\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"50\" /></a>\n\n## License\n\n[MIT](https://github.com/kingofmit/allem-sdk/blob/main/LICENSE) - [Ahmed Allem](https://kingallem.com)\n","readmeFilename":"README.md"}