@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
16 lines (15 loc) • 864 B
JavaScript
import { ruleBuilder as e } from "../utils/ruleBuilder.js";
import { zodErrorParams as m, requiredMessage as n } from "./consts.js";
import * as a from "zod/mini";
import { toRuleValidator as i, arrayScheme as o } from "./zodRuleBuilders.js";
const d = {
required: e().withValidatorFactory(() => i(o, a.minLength(1, { error: n }))),
nonEmpty: e().withValidatorFactory(() => i(o, a.minLength(1))),
length: e().withParameter("length", "number", !0).withValidatorFactory(({ length: r, message: t }) => i(o, a.length(r, m(t)))),
min: e().withParameter("limit", "number", !0).withValidatorFactory(({ limit: r, message: t }) => i(o, a.minLength(r, m(t)))),
max: e().withParameter("limit", "number", !0).withValidatorFactory(({ limit: r, message: t }) => i(o, a.maxLength(r, m(t))))
};
export {
d as ZodArrayRules
};
//# sourceMappingURL=ZodArrayRules.js.map