@railway-ts/use-form 0.1.33 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @railway-ts/use-form
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@railway-ts/use-form.svg)](https://www.npmjs.com/package/@railway-ts/use-form) [![Build Status](https://github.com/sakobu/railway-ts-use-form/workflows/CI/badge.svg)](https://github.com/sakobu/railway-ts-use-form/actions) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue)](https://www.typescriptlang.org/) [![Coverage](https://img.shields.io/codecov/c/github/sakobu/railway-ts-use-form)](https://codecov.io/gh/sakobu/railway-ts-use-form)
3
+ [![npm version](https://img.shields.io/npm/v/@railway-ts/use-form.svg)](https://www.npmjs.com/package/@railway-ts/use-form) [![CI](https://github.com/sakobu/railway-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/sakobu/railway-ts/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/sakobu/railway-ts/branch/main/graph/badge.svg?flag=use-form)](https://codecov.io/gh/sakobu/railway-ts) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue)](https://www.typescriptlang.org/)
4
4
 
5
5
  Schema-first React forms with full TypeScript safety, composable validation, and native HTML bindings.
6
6
 
7
- **~3.6 kB** minified + brotli (~8.4 kB with [@railway-ts/pipelines](https://github.com/sakobu/railway-ts-pipelines) -- [smallest schema bundle on the benchmark](https://schemabenchmarks.dev))
7
+ **~3.6 kB** minified + brotli (~8.4 kB with [@railway-ts/pipelines](https://github.com/sakobu/railway-ts/tree/main/packages/pipelines) -- [smallest schema bundle on the benchmark](https://schemabenchmarks.dev))
8
8
 
9
9
  ## Why?
10
10
 
@@ -17,7 +17,7 @@ This library treats the **schema as the single source of truth**. One declaratio
17
17
  - Field bindings (spread onto native HTML elements)
18
18
  - Error handling (three layers with deterministic priority)
19
19
 
20
- Bring your own Zod, Valibot, or ArkType via [Standard Schema](https://github.com/standard-schema/standard-schema), or use [@railway-ts/pipelines](https://github.com/sakobu/railway-ts-pipelines) natively for cross-field validation, targeted error placement, and `Result` types.
20
+ Bring your own Zod, Valibot, or ArkType via [Standard Schema](https://github.com/standard-schema/standard-schema), or use [@railway-ts/pipelines](https://github.com/sakobu/railway-ts/tree/main/packages/pipelines) natively for cross-field validation, targeted error placement, and `Result` types.
21
21
 
22
22
  ## Design
23
23
 
@@ -37,8 +37,8 @@ Requires React 18+ and @railway-ts/pipelines ^0.1.29.
37
37
  ## Quick Start
38
38
 
39
39
  ```tsx
40
- import { useForm } from '@railway-ts/use-form';
41
40
  import { object, string, required, chain, nonEmpty, email, type InferSchemaType } from '@railway-ts/pipelines/schema';
41
+ import { useForm } from '@railway-ts/use-form';
42
42
 
43
43
  const loginSchema = object({
44
44
  email: required(chain(string(), nonEmpty('Email is required'), email())),
@@ -76,9 +76,6 @@ export function LoginForm() {
76
76
  Registration form with cross-field validation (`refineAt` for password confirmation), per-field async validation (`fieldValidators` for username availability), and server errors -- all in one component:
77
77
 
78
78
  ```tsx
79
- import { useNavigate } from 'react-router-dom';
80
- import { useMutation, useQueryClient } from '@tanstack/react-query';
81
- import { useForm } from '@railway-ts/use-form';
82
79
  import {
83
80
  object,
84
81
  string,
@@ -91,6 +88,9 @@ import {
91
88
  ROOT_ERROR_KEY,
92
89
  type InferSchemaType,
93
90
  } from '@railway-ts/pipelines/schema';
91
+ import { useForm } from '@railway-ts/use-form';
92
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
93
+ import { useNavigate } from 'react-router-dom';
94
94
 
95
95
  // --- Schema ---
96
96
 
@@ -225,7 +225,7 @@ See [Recipes: Standard Schema](./docs/RECIPES.md#standard-schema-bring-your-own-
225
225
 
226
226
  ## Ecosystem
227
227
 
228
- `@railway-ts/use-form` is built on [@railway-ts/pipelines](https://github.com/sakobu/railway-ts-pipelines) -- composable, type-safe validation with Railway-oriented Result types. Use pipelines standalone for backend validation, or pair it with this hook for full-stack type safety.
228
+ `@railway-ts/use-form` is built on [@railway-ts/pipelines](https://github.com/sakobu/railway-ts/tree/main/packages/pipelines) -- composable, type-safe validation with Railway-oriented Result types. Use pipelines standalone for backend validation, or pair it with this hook for full-stack type safety.
229
229
 
230
230
  ## Documentation
231
231
 
@@ -235,12 +235,14 @@ See [Recipes: Standard Schema](./docs/RECIPES.md#standard-schema-bring-your-own-
235
235
 
236
236
  ## Examples
237
237
 
238
- Clone and run:
238
+ Clone the monorepo, build both packages (the examples use the built pipelines), and run:
239
239
 
240
240
  ```bash
241
- git clone https://github.com/sakobu/railway-ts-use-form.git
242
- cd railway-ts-use-form
241
+ git clone https://github.com/sakobu/railway-ts.git
242
+ cd railway-ts
243
243
  bun install
244
+ bun run build
245
+ cd packages/use-form
244
246
  bun run example
245
247
  ```
246
248