@mantine/form 5.8.3 → 5.9.0
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/cjs/index.js +4 -0
- package/cjs/index.js.map +1 -1
- package/cjs/validators/matches.js +16 -0
- package/cjs/validators/matches.js.map +1 -0
- package/cjs/validators/not-empty.js +22 -0
- package/cjs/validators/not-empty.js.map +1 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -1
- package/esm/validators/matches.js +12 -0
- package/esm/validators/matches.js.map +1 -0
- package/esm/validators/not-empty.js +18 -0
- package/esm/validators/not-empty.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/validators/index.d.ts +3 -0
- package/lib/validators/index.d.ts.map +1 -0
- package/lib/validators/matches.d.ts +3 -0
- package/lib/validators/matches.d.ts.map +1 -0
- package/lib/validators/not-empty.d.ts +3 -0
- package/lib/validators/not-empty.d.ts.map +1 -0
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -8,6 +8,8 @@ var formIndex = require('./form-index.js');
|
|
|
8
8
|
var zodResolver = require('./resolvers/zod-resolver/zod-resolver.js');
|
|
9
9
|
var yupResolver = require('./resolvers/yup-resolver/yup-resolver.js');
|
|
10
10
|
var joiResolver = require('./resolvers/joi-resolver/joi-resolver.js');
|
|
11
|
+
var notEmpty = require('./validators/not-empty.js');
|
|
12
|
+
var matches = require('./validators/matches.js');
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
|
|
@@ -17,4 +19,6 @@ exports.FORM_INDEX = formIndex.FORM_INDEX;
|
|
|
17
19
|
exports.zodResolver = zodResolver.zodResolver;
|
|
18
20
|
exports.yupResolver = yupResolver.yupResolver;
|
|
19
21
|
exports.joiResolver = joiResolver.joiResolver;
|
|
22
|
+
exports.notEmpty = notEmpty.notEmpty;
|
|
23
|
+
exports.matches = matches.matches;
|
|
20
24
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function matches(regexp, error) {
|
|
6
|
+
const _error = error || true;
|
|
7
|
+
return (value) => {
|
|
8
|
+
if (typeof value !== "string") {
|
|
9
|
+
return _error;
|
|
10
|
+
}
|
|
11
|
+
return regexp.test(value) ? null : _error;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.matches = matches;
|
|
16
|
+
//# sourceMappingURL=matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.js","sources":["../../src/validators/matches.ts"],"sourcesContent":["import React from 'react';\n\nexport function matches(regexp: RegExp, error?: React.ReactNode) {\n const _error = error || true;\n return (value: unknown) => {\n if (typeof value !== 'string') {\n return _error;\n }\n\n return regexp.test(value) ? null : _error;\n };\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE;AACvC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,CAAC;AAC/B,EAAE,OAAO,CAAC,KAAK,KAAK;AACpB,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,MAAM,OAAO,MAAM,CAAC;AACpB,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;AAC9C,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function notEmpty(error) {
|
|
6
|
+
const _error = error || true;
|
|
7
|
+
return (value) => {
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
return value.trim().length > 0 ? null : _error;
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(value)) {
|
|
12
|
+
return value.length > 0 ? null : _error;
|
|
13
|
+
}
|
|
14
|
+
if (value === null || value === void 0) {
|
|
15
|
+
return _error;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.notEmpty = notEmpty;
|
|
22
|
+
//# sourceMappingURL=not-empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-empty.js","sources":["../../src/validators/not-empty.ts"],"sourcesContent":["import React from 'react';\n\nexport function notEmpty(error?: React.ReactNode) {\n const _error = error || true;\n\n return (value: unknown) => {\n if (typeof value === 'string') {\n return value.trim().length > 0 ? null : _error;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0 ? null : _error;\n }\n\n if (value === null || value === undefined) {\n return _error;\n }\n\n return null;\n };\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,QAAQ,CAAC,KAAK,EAAE;AAChC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,CAAC;AAC/B,EAAE,OAAO,CAAC,KAAK,KAAK;AACpB,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,MAAM,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;AACrD,KAAK;AACL,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAC9B,MAAM,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;AAC9C,KAAK;AACL,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE;AAC5C,MAAM,OAAO,MAAM,CAAC;AACpB,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC;AACJ;;;;"}
|
package/esm/index.js
CHANGED
|
@@ -4,4 +4,6 @@ export { FORM_INDEX } from './form-index.js';
|
|
|
4
4
|
export { zodResolver } from './resolvers/zod-resolver/zod-resolver.js';
|
|
5
5
|
export { yupResolver } from './resolvers/yup-resolver/yup-resolver.js';
|
|
6
6
|
export { joiResolver } from './resolvers/joi-resolver/joi-resolver.js';
|
|
7
|
+
export { notEmpty } from './validators/not-empty.js';
|
|
8
|
+
export { matches } from './validators/matches.js';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function matches(regexp, error) {
|
|
2
|
+
const _error = error || true;
|
|
3
|
+
return (value) => {
|
|
4
|
+
if (typeof value !== "string") {
|
|
5
|
+
return _error;
|
|
6
|
+
}
|
|
7
|
+
return regexp.test(value) ? null : _error;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { matches };
|
|
12
|
+
//# sourceMappingURL=matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.js","sources":["../../src/validators/matches.ts"],"sourcesContent":["import React from 'react';\n\nexport function matches(regexp: RegExp, error?: React.ReactNode) {\n const _error = error || true;\n return (value: unknown) => {\n if (typeof value !== 'string') {\n return _error;\n }\n\n return regexp.test(value) ? null : _error;\n };\n}\n"],"names":[],"mappings":"AAAO,SAAS,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE;AACvC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,CAAC;AAC/B,EAAE,OAAO,CAAC,KAAK,KAAK;AACpB,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,MAAM,OAAO,MAAM,CAAC;AACpB,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;AAC9C,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function notEmpty(error) {
|
|
2
|
+
const _error = error || true;
|
|
3
|
+
return (value) => {
|
|
4
|
+
if (typeof value === "string") {
|
|
5
|
+
return value.trim().length > 0 ? null : _error;
|
|
6
|
+
}
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
return value.length > 0 ? null : _error;
|
|
9
|
+
}
|
|
10
|
+
if (value === null || value === void 0) {
|
|
11
|
+
return _error;
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { notEmpty };
|
|
18
|
+
//# sourceMappingURL=not-empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-empty.js","sources":["../../src/validators/not-empty.ts"],"sourcesContent":["import React from 'react';\n\nexport function notEmpty(error?: React.ReactNode) {\n const _error = error || true;\n\n return (value: unknown) => {\n if (typeof value === 'string') {\n return value.trim().length > 0 ? null : _error;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0 ? null : _error;\n }\n\n if (value === null || value === undefined) {\n return _error;\n }\n\n return null;\n };\n}\n"],"names":[],"mappings":"AAAO,SAAS,QAAQ,CAAC,KAAK,EAAE;AAChC,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,CAAC;AAC/B,EAAE,OAAO,CAAC,KAAK,KAAK;AACpB,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACnC,MAAM,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;AACrD,KAAK;AACL,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAC9B,MAAM,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;AAC9C,KAAK;AACL,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE;AAC5C,MAAM,OAAO,MAAM,CAAC;AACpB,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC;AACJ;;;;"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { useForm } from './use-form';
|
|
2
2
|
export { createFormContext } from './FormProvider/FormProvider';
|
|
3
3
|
export { FORM_INDEX } from './form-index';
|
|
4
|
+
export * from './validators';
|
|
4
5
|
export { zodResolver } from './resolvers/zod-resolver/zod-resolver';
|
|
5
6
|
export { yupResolver } from './resolvers/yup-resolver/yup-resolver';
|
|
6
7
|
export { joiResolver } from './resolvers/joi-resolver/joi-resolver';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function matches(regexp: RegExp, error?: React.ReactNode): (value: unknown) => string | number | true | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment;
|
|
3
|
+
//# sourceMappingURL=matches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.d.ts","sourceRoot":"","sources":["../../src/validators/matches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,WAE9C,OAAO,uHAOvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-empty.d.ts","sourceRoot":"","sources":["../../src/validators/not-empty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,WAG/B,OAAO,uHAevB"}
|