UNPKG

@react-form-builder/core

Version:

React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required

14 lines (13 loc) 629 B
import { isObject as m, isEmpty as n } from "../../../utils/tools.js"; import { ruleBuilder as e } from "../utils/ruleBuilder.js"; import { zodErrorParams as s, requiredMessage as a } from "./consts.js"; import * as r from "zod/mini"; import { toRuleValidator as t } from "./zodRuleBuilders.js"; const c = r.union([r.looseObject({}), r.string()]), l = { required: e().withValidatorFactory(() => t(r.unknown(), r.refine((o) => m(o) && !n(o), { error: a }))), nonEmpty: e().withValidatorFactory(({ message: o }) => t(c, r.refine((i) => i, s(o)))) }; export { l as ZodObjectRules }; //# sourceMappingURL=ZodObjectRules.js.map