@vritti/quantum-ui 0.3.24 → 0.3.25
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/dist/lib/utils/zod.d.ts +13 -0
- package/dist/lib/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +9 -1
- package/dist/utils/zod.js.map +1 -1
- package/package.json +1 -1
package/dist/lib/utils/zod.d.ts
CHANGED
|
@@ -52,4 +52,17 @@ export interface CodeFieldOptions {
|
|
|
52
52
|
message?: string;
|
|
53
53
|
}
|
|
54
54
|
export declare function zodCodeField(options?: CodeFieldOptions): z.ZodString;
|
|
55
|
+
export interface FileFieldOptions {
|
|
56
|
+
maxSizeMb?: number;
|
|
57
|
+
accept?: string[];
|
|
58
|
+
optional?: boolean;
|
|
59
|
+
required?: string;
|
|
60
|
+
message?: string;
|
|
61
|
+
}
|
|
62
|
+
export declare function zodFileField(options?: FileFieldOptions & {
|
|
63
|
+
optional?: false;
|
|
64
|
+
}): z.ZodType<File, File>;
|
|
65
|
+
export declare function zodFileField(options: FileFieldOptions & {
|
|
66
|
+
optional: true;
|
|
67
|
+
}): z.ZodType<File | undefined, File | undefined>;
|
|
55
68
|
//# sourceMappingURL=zod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../lib/utils/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,cAAc,KAAK,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,E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E,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB,eAS1D;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvG,wBAAgB,YAAY,CAC1B,OAAO,EAAE,gBAAgB,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAC7C,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC"}
|
package/dist/utils/zod.js
CHANGED
|
@@ -6917,6 +6917,14 @@ function zodCodeField(options = {}) {
|
|
|
6917
6917
|
const schema = string$1().min(1, required).regex(pattern, message ?? defaultMessage);
|
|
6918
6918
|
return max != null ? schema.max(max, `Code must be ${max} characters or less`) : schema;
|
|
6919
6919
|
}
|
|
6920
|
+
function zodFileField(options = {}) {
|
|
6921
|
+
const { maxSizeMb, accept, optional = false, required = "A file is required", message } = options;
|
|
6922
|
+
const limit = maxSizeMb == null ? null : maxSizeMb * 1024 * 1024;
|
|
6923
|
+
const allowed = accept?.length ? new Set(accept) : null;
|
|
6924
|
+
const label = accept?.map((type) => type.split("/").pop()?.toUpperCase() ?? type).join(", ");
|
|
6925
|
+
const schema = _instanceof(File, { message: required }).refine((file) => limit == null || file.size <= limit, message ?? `File must be under ${maxSizeMb}MB`).refine((file) => allowed == null || allowed.has(file.type), message ?? `File must be ${label}`);
|
|
6926
|
+
return optional ? schema.optional() : schema;
|
|
6927
|
+
}
|
|
6920
6928
|
|
|
6921
|
-
export { $brand, $input, $output, CODE_PATTERN, DOTTED_CODE_PATTERN, NEVER, TimePrecision, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodExactOptional, ZodFile, ZodFirstPartyTypeKind, ZodFunction, ZodGUID, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodIntersection, ZodIssueCode, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodString, _default$1 as _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch$1 as catch, check, cidrv4, cidrv6, clone, codec, coerce, config, index as core, cuid, cuid2, custom, date$1 as date, decode$1 as decode, decodeAsync$1 as decodeAsync, describe$1 as describe, discriminatedUnion, e164, email, emoji, encode$1 as encode, encodeAsync$1 as encodeAsync, _endsWith as endsWith, _enum$1 as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, _includes as includes, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, _iso as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index$1 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, meta$1 as meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null$1 as null, nullable, nullish, number$1 as number, object, optional, _overwrite as overwrite, parse$1 as parse, parseAsync$1 as parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _property as property, readonly, record, refine, _regex as regex, regexes, registry, safeDecode$1 as safeDecode, safeDecodeAsync$1 as safeDecodeAsync, safeEncode$1 as safeEncode, safeEncodeAsync$1 as safeEncodeAsync, safeParse$1 as safeParse, safeParseAsync$1 as safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined$1 as undefined, union, unknown, _uppercase as uppercase, url, util, uuid, uuidv4, uuidv6, uuidv7, _void$1 as void, xid, xor, z, zodCodeField, zodCurrencyField, zodNumericField, zodPhoneField };
|
|
6929
|
+
export { $brand, $input, $output, CODE_PATTERN, DOTTED_CODE_PATTERN, NEVER, TimePrecision, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodExactOptional, ZodFile, ZodFirstPartyTypeKind, ZodFunction, ZodGUID, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodIntersection, ZodIssueCode, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodString, _default$1 as _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch$1 as catch, check, cidrv4, cidrv6, clone, codec, coerce, config, index as core, cuid, cuid2, custom, date$1 as date, decode$1 as decode, decodeAsync$1 as decodeAsync, describe$1 as describe, discriminatedUnion, e164, email, emoji, encode$1 as encode, encodeAsync$1 as encodeAsync, _endsWith as endsWith, _enum$1 as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, _includes as includes, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, _iso as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index$1 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, meta$1 as meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null$1 as null, nullable, nullish, number$1 as number, object, optional, _overwrite as overwrite, parse$1 as parse, parseAsync$1 as parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _property as property, readonly, record, refine, _regex as regex, regexes, registry, safeDecode$1 as safeDecode, safeDecodeAsync$1 as safeDecodeAsync, safeEncode$1 as safeEncode, safeEncodeAsync$1 as safeEncodeAsync, safeParse$1 as safeParse, safeParseAsync$1 as safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined$1 as undefined, union, unknown, _uppercase as uppercase, url, util, uuid, uuidv4, uuidv6, uuidv7, _void$1 as void, xid, xor, z, zodCodeField, zodCurrencyField, zodFileField, zodNumericField, zodPhoneField };
|
|
6922
6930
|
//# sourceMappingURL=zod.js.map
|