vazco / uniforms

A React library for building forms from any schema.
https://uniforms.tools
MIT License
1.93k stars 239 forks source link

Improve Zod bridge - passing props #1321

Closed piotrpospiech closed 2 months ago

piotrpospiech commented 3 months ago

Further work:

Support custom labels for error messages (https://github.com/vazco/uniforms/pull/1320)

Example:

import z from "zod";
import { DateField } from "uniforms-semantic";
import { ZodBridge } from "uniforms-bridge-zod";

const schema = z.object({
  date: z.string().uniforms(DateField),
  number: z.string().uniforms({ component: NumField, disabled: true }),
  username: z.string().min(4).uniforms({ label: "Custom label (username)" }),
  password: z.string().uniforms({ type: "password" }),
});

const bridge = new ZodBridge({ schema });
image
codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.57%. Comparing base (4b3f109) to head (da8fd1d).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1321 +/- ## ========================================== + Coverage 94.55% 94.57% +0.01% ========================================== Files 231 231 Lines 3823 3831 +8 Branches 1030 1031 +1 ========================================== + Hits 3615 3623 +8 Misses 82 82 Partials 126 126 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.