@cedarjs/forms 9.0.0-canary.1784 → 9.0.0-canary.3124
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/CheckboxField.d.ts +1 -1
- package/dist/CheckboxField.d.ts.map +1 -1
- package/dist/CheckboxField.js +9 -43
- package/dist/FieldError.js +7 -41
- package/dist/FieldProps.d.ts +1 -1
- package/dist/FieldProps.d.ts.map +1 -1
- package/dist/FieldProps.js +0 -16
- package/dist/Form.d.ts.map +1 -1
- package/dist/Form.js +17 -46
- package/dist/FormError.d.ts +10 -2
- package/dist/FormError.d.ts.map +1 -1
- package/dist/FormError.js +21 -44
- package/dist/InputComponents.d.ts +1 -1
- package/dist/InputComponents.d.ts.map +1 -1
- package/dist/InputComponents.js +11 -66
- package/dist/Label.d.ts +1 -1
- package/dist/Label.d.ts.map +1 -1
- package/dist/Label.js +6 -40
- package/dist/SelectField.d.ts +1 -1
- package/dist/SelectField.d.ts.map +1 -1
- package/dist/SelectField.js +9 -43
- package/dist/ServerErrorsContext.d.ts.map +1 -1
- package/dist/ServerErrorsContext.js +4 -40
- package/dist/Submit.d.ts +1 -3
- package/dist/Submit.d.ts.map +1 -1
- package/dist/Submit.js +4 -38
- package/dist/TextAreaField.d.ts +1 -1
- package/dist/TextAreaField.d.ts.map +1 -1
- package/dist/TextAreaField.js +9 -43
- package/dist/coercion.d.ts.map +1 -1
- package/dist/coercion.js +2 -26
- package/dist/index.d.ts +16 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -87
- package/dist/useErrorStyles.d.ts +1 -1
- package/dist/useErrorStyles.d.ts.map +1 -1
- package/dist/useErrorStyles.js +9 -43
- package/dist/useRegister.d.ts +3 -3
- package/dist/useRegister.d.ts.map +1 -1
- package/dist/useRegister.js +6 -30
- package/package.json +25 -25
- package/LICENSE +0 -21
package/dist/SelectField.js
CHANGED
|
@@ -1,40 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var SelectField_exports = {};
|
|
30
|
-
__export(SelectField_exports, {
|
|
31
|
-
SelectField: () => SelectField
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(SelectField_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_useErrorStyles = require("./useErrorStyles");
|
|
36
|
-
var import_useRegister = require("./useRegister");
|
|
37
|
-
const SelectField = (0, import_react.forwardRef)(
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { useErrorStyles } from "./useErrorStyles.js";
|
|
3
|
+
import { useRegister } from "./useRegister.js";
|
|
4
|
+
const SelectField = forwardRef(
|
|
38
5
|
({
|
|
39
6
|
name,
|
|
40
7
|
id,
|
|
@@ -50,14 +17,14 @@ const SelectField = (0, import_react.forwardRef)(
|
|
|
50
17
|
onChange,
|
|
51
18
|
...rest
|
|
52
19
|
}, ref) => {
|
|
53
|
-
const styles =
|
|
20
|
+
const styles = useErrorStyles({
|
|
54
21
|
name,
|
|
55
22
|
errorClassName,
|
|
56
23
|
errorStyle,
|
|
57
24
|
className,
|
|
58
25
|
style
|
|
59
26
|
});
|
|
60
|
-
const useRegisterReturn =
|
|
27
|
+
const useRegisterReturn = useRegister(
|
|
61
28
|
{
|
|
62
29
|
name,
|
|
63
30
|
validation,
|
|
@@ -67,10 +34,9 @@ const SelectField = (0, import_react.forwardRef)(
|
|
|
67
34
|
ref,
|
|
68
35
|
emptyAs
|
|
69
36
|
);
|
|
70
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ React.createElement("select", { id: id || name, ...rest, ...styles, ...useRegisterReturn });
|
|
71
38
|
}
|
|
72
39
|
);
|
|
73
|
-
|
|
74
|
-
0 && (module.exports = {
|
|
40
|
+
export {
|
|
75
41
|
SelectField
|
|
76
|
-
}
|
|
42
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerErrorsContext.d.ts","sourceRoot":"","sources":["../src/ServerErrorsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,0DAA0D;AAC1D,UAAU,wBAAwB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ServerErrorsContext.d.ts","sourceRoot":"","sources":["../src/ServerErrorsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,0DAA0D;AAC1D,UAAU,wBAAwB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,mBAAmB,yCACmB,CAAA"}
|
|
@@ -1,41 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var ServerErrorsContext_exports = {};
|
|
30
|
-
__export(ServerErrorsContext_exports, {
|
|
31
|
-
ServerErrorsContext: () => ServerErrorsContext
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(ServerErrorsContext_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
const ServerErrorsContext = import_react.default.createContext(
|
|
36
|
-
{}
|
|
37
|
-
);
|
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
-
0 && (module.exports = {
|
|
1
|
+
import React from "react";
|
|
2
|
+
const ServerErrorsContext = React.createContext({});
|
|
3
|
+
export {
|
|
40
4
|
ServerErrorsContext
|
|
41
|
-
}
|
|
5
|
+
};
|
package/dist/Submit.d.ts
CHANGED
|
@@ -10,7 +10,5 @@ import React from 'react';
|
|
|
10
10
|
* </Form>
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
|
-
export declare const Submit: React.ForwardRefExoticComponent<Omit<Omit<
|
|
14
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
15
|
-
}, "type">, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export declare const Submit: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type">, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
16
14
|
//# sourceMappingURL=Submit.d.ts.map
|
package/dist/Submit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Submit.d.ts","sourceRoot":"","sources":["../src/Submit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"Submit.d.ts","sourceRoot":"","sources":["../src/Submit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,gMAG6C,CAAA"}
|
package/dist/Submit.js
CHANGED
|
@@ -1,39 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var Submit_exports = {};
|
|
30
|
-
__export(Submit_exports, {
|
|
31
|
-
Submit: () => Submit
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(Submit_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
const Submit = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ import_react.default.createElement("button", { ref, type: "submit", ...props }));
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
const Submit = forwardRef((props, ref) => /* @__PURE__ */ React.createElement("button", { ref, type: "submit", ...props }));
|
|
3
|
+
export {
|
|
38
4
|
Submit
|
|
39
|
-
}
|
|
5
|
+
};
|
package/dist/TextAreaField.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { FieldProps } from './FieldProps';
|
|
2
|
+
import type { FieldProps } from './FieldProps.js';
|
|
3
3
|
export interface TextAreaFieldProps extends Omit<FieldProps<HTMLTextAreaElement>, 'type'>, Omit<React.ComponentPropsWithRef<'textarea'>, 'name'> {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaField.d.ts","sourceRoot":"","sources":["../src/TextAreaField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TextAreaField.d.ts","sourceRoot":"","sources":["../src/TextAreaField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD,MAAM,WAAW,kBACf,SACE,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,EAC7C,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAAG;AAE5D;;GAEG;AACH,eAAO,MAAM,aAAa,6GA4CzB,CAAA"}
|
package/dist/TextAreaField.js
CHANGED
|
@@ -1,40 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var TextAreaField_exports = {};
|
|
30
|
-
__export(TextAreaField_exports, {
|
|
31
|
-
TextAreaField: () => TextAreaField
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(TextAreaField_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_useErrorStyles = require("./useErrorStyles");
|
|
36
|
-
var import_useRegister = require("./useRegister");
|
|
37
|
-
const TextAreaField = (0, import_react.forwardRef)(
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { useErrorStyles } from "./useErrorStyles.js";
|
|
3
|
+
import { useRegister } from "./useRegister.js";
|
|
4
|
+
const TextAreaField = forwardRef(
|
|
38
5
|
({
|
|
39
6
|
name,
|
|
40
7
|
id,
|
|
@@ -50,14 +17,14 @@ const TextAreaField = (0, import_react.forwardRef)(
|
|
|
50
17
|
onChange,
|
|
51
18
|
...rest
|
|
52
19
|
}, ref) => {
|
|
53
|
-
const styles =
|
|
20
|
+
const styles = useErrorStyles({
|
|
54
21
|
name,
|
|
55
22
|
errorClassName,
|
|
56
23
|
errorStyle,
|
|
57
24
|
className,
|
|
58
25
|
style
|
|
59
26
|
});
|
|
60
|
-
const useRegisterReturn =
|
|
27
|
+
const useRegisterReturn = useRegister(
|
|
61
28
|
{
|
|
62
29
|
name,
|
|
63
30
|
validation,
|
|
@@ -67,10 +34,9 @@ const TextAreaField = (0, import_react.forwardRef)(
|
|
|
67
34
|
ref,
|
|
68
35
|
emptyAs
|
|
69
36
|
);
|
|
70
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ React.createElement("textarea", { id: id || name, ...rest, ...styles, ...useRegisterReturn });
|
|
71
38
|
}
|
|
72
39
|
);
|
|
73
|
-
|
|
74
|
-
0 && (module.exports = {
|
|
40
|
+
export {
|
|
75
41
|
TextAreaField
|
|
76
|
-
}
|
|
42
|
+
};
|
package/dist/coercion.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coercion.d.ts","sourceRoot":"","sources":["../src/coercion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IACrD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAKD;;;;;;GAMG;AAEH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,GAAG,CAAC,GAAG,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"coercion.d.ts","sourceRoot":"","sources":["../src/coercion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IACrD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAKD;;;;;;GAMG;AAEH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,WAAW,GAAG,CAAC,GAAG,EAAE,CAAA;AA2JtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AAED,eAAO,MAAM,WAAW,GACtB,YAAY,sBAAsB,EAClC,yBAAyB,gBAAgB,SAyC1C,CAAA"}
|
package/dist/coercion.js
CHANGED
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var coercion_exports = {};
|
|
20
|
-
__export(coercion_exports, {
|
|
21
|
-
setCoercion: () => setCoercion
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(coercion_exports);
|
|
24
1
|
const isValueEmpty = (val) => val === "";
|
|
25
2
|
const SET_VALUE_AS_FUNCTIONS = {
|
|
26
3
|
// valueAsBoolean is commented out as r-h-f does not currently support
|
|
@@ -172,7 +149,6 @@ const setCoercion = (validation, { type, name, emptyAs }) => {
|
|
|
172
149
|
// isId
|
|
173
150
|
);
|
|
174
151
|
};
|
|
175
|
-
|
|
176
|
-
0 && (module.exports = {
|
|
152
|
+
export {
|
|
177
153
|
setCoercion
|
|
178
|
-
}
|
|
154
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -46,19 +46,20 @@
|
|
|
46
46
|
* @see {@link https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces}
|
|
47
47
|
*/
|
|
48
48
|
export * from 'react-hook-form';
|
|
49
|
-
export { CheckboxField } from './CheckboxField';
|
|
50
|
-
export type { EmptyAsValue, RedwoodRegisterOptions } from './coercion';
|
|
51
|
-
export { FieldError } from './FieldError';
|
|
52
|
-
export { Form
|
|
53
|
-
export {
|
|
54
|
-
export
|
|
55
|
-
export {
|
|
56
|
-
export
|
|
57
|
-
export {
|
|
58
|
-
export {
|
|
59
|
-
export {
|
|
60
|
-
export {
|
|
61
|
-
export {
|
|
62
|
-
export {
|
|
63
|
-
export {
|
|
49
|
+
export { CheckboxField } from './CheckboxField.js';
|
|
50
|
+
export type { EmptyAsValue, RedwoodRegisterOptions } from './coercion.js';
|
|
51
|
+
export { FieldError } from './FieldError.js';
|
|
52
|
+
export { Form } from './Form.js';
|
|
53
|
+
export type { FormProps } from './Form.js';
|
|
54
|
+
export { default as FormError } from './FormError.js';
|
|
55
|
+
export type { ServerError, RWGqlError, ServerParseError } from './FormError.js';
|
|
56
|
+
export { InputField, ButtonField, ColorField, DateField, DatetimeLocalField, EmailField, FileField, HiddenField, ImageField, MonthField, NumberField, PasswordField, RadioField, RangeField, ResetField, SearchField, SubmitField, TelField, TextField, TimeField, UrlField, WeekField, } from './InputComponents.js';
|
|
57
|
+
export type { InputFieldProps } from './InputComponents.js';
|
|
58
|
+
export { Label } from './Label.js';
|
|
59
|
+
export { SelectField } from './SelectField.js';
|
|
60
|
+
export { ServerErrorsContext } from './ServerErrorsContext.js';
|
|
61
|
+
export { Submit } from './Submit.js';
|
|
62
|
+
export { TextAreaField } from './TextAreaField.js';
|
|
63
|
+
export { useErrorStyles } from './useErrorStyles.js';
|
|
64
|
+
export { useRegister } from './useRegister.js';
|
|
64
65
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,iBAAiB,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,iBAAiB,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC/E,OAAO,EACL,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,85 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
FieldError: () => import_FieldError.FieldError,
|
|
39
|
-
FileField: () => import_InputComponents.FileField,
|
|
40
|
-
Form: () => import_Form.Form,
|
|
41
|
-
FormError: () => import_FormError.default,
|
|
42
|
-
FormProps: () => import_Form.FormProps,
|
|
43
|
-
HiddenField: () => import_InputComponents.HiddenField,
|
|
44
|
-
ImageField: () => import_InputComponents.ImageField,
|
|
45
|
-
InputField: () => import_InputComponents.InputField,
|
|
46
|
-
Label: () => import_Label.Label,
|
|
47
|
-
MonthField: () => import_InputComponents.MonthField,
|
|
48
|
-
NumberField: () => import_InputComponents.NumberField,
|
|
49
|
-
PasswordField: () => import_InputComponents.PasswordField,
|
|
50
|
-
RadioField: () => import_InputComponents.RadioField,
|
|
51
|
-
RangeField: () => import_InputComponents.RangeField,
|
|
52
|
-
ResetField: () => import_InputComponents.ResetField,
|
|
53
|
-
SearchField: () => import_InputComponents.SearchField,
|
|
54
|
-
SelectField: () => import_SelectField.SelectField,
|
|
55
|
-
ServerErrorsContext: () => import_ServerErrorsContext.ServerErrorsContext,
|
|
56
|
-
Submit: () => import_Submit.Submit,
|
|
57
|
-
SubmitField: () => import_InputComponents.SubmitField,
|
|
58
|
-
TelField: () => import_InputComponents.TelField,
|
|
59
|
-
TextAreaField: () => import_TextAreaField.TextAreaField,
|
|
60
|
-
TextField: () => import_InputComponents.TextField,
|
|
61
|
-
TimeField: () => import_InputComponents.TimeField,
|
|
62
|
-
UrlField: () => import_InputComponents.UrlField,
|
|
63
|
-
WeekField: () => import_InputComponents.WeekField,
|
|
64
|
-
useErrorStyles: () => import_useErrorStyles.useErrorStyles,
|
|
65
|
-
useRegister: () => import_useRegister.useRegister
|
|
66
|
-
});
|
|
67
|
-
module.exports = __toCommonJS(src_exports);
|
|
68
|
-
__reExport(src_exports, require("react-hook-form"), module.exports);
|
|
69
|
-
var import_CheckboxField = require("./CheckboxField");
|
|
70
|
-
var import_FieldError = require("./FieldError");
|
|
71
|
-
var import_Form = require("./Form");
|
|
72
|
-
var import_FormError = __toESM(require("./FormError"));
|
|
73
|
-
var import_InputComponents = require("./InputComponents");
|
|
74
|
-
var import_Label = require("./Label");
|
|
75
|
-
var import_SelectField = require("./SelectField");
|
|
76
|
-
var import_ServerErrorsContext = require("./ServerErrorsContext");
|
|
77
|
-
var import_Submit = require("./Submit");
|
|
78
|
-
var import_TextAreaField = require("./TextAreaField");
|
|
79
|
-
var import_useErrorStyles = require("./useErrorStyles");
|
|
80
|
-
var import_useRegister = require("./useRegister");
|
|
81
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
-
0 && (module.exports = {
|
|
1
|
+
export * from "react-hook-form";
|
|
2
|
+
import { CheckboxField } from "./CheckboxField.js";
|
|
3
|
+
import { FieldError } from "./FieldError.js";
|
|
4
|
+
import { Form } from "./Form.js";
|
|
5
|
+
import { default as default2 } from "./FormError.js";
|
|
6
|
+
import {
|
|
7
|
+
InputField,
|
|
8
|
+
ButtonField,
|
|
9
|
+
ColorField,
|
|
10
|
+
DateField,
|
|
11
|
+
DatetimeLocalField,
|
|
12
|
+
EmailField,
|
|
13
|
+
FileField,
|
|
14
|
+
HiddenField,
|
|
15
|
+
ImageField,
|
|
16
|
+
MonthField,
|
|
17
|
+
NumberField,
|
|
18
|
+
PasswordField,
|
|
19
|
+
RadioField,
|
|
20
|
+
RangeField,
|
|
21
|
+
ResetField,
|
|
22
|
+
SearchField,
|
|
23
|
+
SubmitField,
|
|
24
|
+
TelField,
|
|
25
|
+
TextField,
|
|
26
|
+
TimeField,
|
|
27
|
+
UrlField,
|
|
28
|
+
WeekField
|
|
29
|
+
} from "./InputComponents.js";
|
|
30
|
+
import { Label } from "./Label.js";
|
|
31
|
+
import { SelectField } from "./SelectField.js";
|
|
32
|
+
import { ServerErrorsContext } from "./ServerErrorsContext.js";
|
|
33
|
+
import { Submit } from "./Submit.js";
|
|
34
|
+
import { TextAreaField } from "./TextAreaField.js";
|
|
35
|
+
import { useErrorStyles } from "./useErrorStyles.js";
|
|
36
|
+
import { useRegister } from "./useRegister.js";
|
|
37
|
+
export {
|
|
83
38
|
ButtonField,
|
|
84
39
|
CheckboxField,
|
|
85
40
|
ColorField,
|
|
@@ -89,8 +44,7 @@ var import_useRegister = require("./useRegister");
|
|
|
89
44
|
FieldError,
|
|
90
45
|
FileField,
|
|
91
46
|
Form,
|
|
92
|
-
FormError,
|
|
93
|
-
FormProps,
|
|
47
|
+
default2 as FormError,
|
|
94
48
|
HiddenField,
|
|
95
49
|
ImageField,
|
|
96
50
|
InputField,
|
|
@@ -113,6 +67,5 @@ var import_useRegister = require("./useRegister");
|
|
|
113
67
|
UrlField,
|
|
114
68
|
WeekField,
|
|
115
69
|
useErrorStyles,
|
|
116
|
-
useRegister
|
|
117
|
-
|
|
118
|
-
});
|
|
70
|
+
useRegister
|
|
71
|
+
};
|
package/dist/useErrorStyles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { FieldProps } from './FieldProps';
|
|
2
|
+
import type { FieldProps } from './FieldProps.js';
|
|
3
3
|
export type UseErrorStylesProps = Pick<FieldProps, 'name' | 'errorClassName' | 'errorStyle' | 'className' | 'style'>;
|
|
4
4
|
/**
|
|
5
5
|
* Adds styling to a field when an error is present.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useErrorStyles.d.ts","sourceRoot":"","sources":["../src/useErrorStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useErrorStyles.d.ts","sourceRoot":"","sources":["../src/useErrorStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGjD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,UAAU,EACV,MAAM,GAAG,gBAAgB,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CACjE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,yDAM5B,mBAAmB;;;CA2BrB,CAAA"}
|
package/dist/useErrorStyles.js
CHANGED
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var useErrorStyles_exports = {};
|
|
30
|
-
__export(useErrorStyles_exports, {
|
|
31
|
-
useErrorStyles: () => useErrorStyles
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(useErrorStyles_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_react_hook_form = require("react-hook-form");
|
|
36
|
-
var import_ServerErrorsContext = require("./ServerErrorsContext");
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { get, useFormContext } from "react-hook-form";
|
|
3
|
+
import { ServerErrorsContext } from "./ServerErrorsContext.js";
|
|
37
4
|
const useErrorStyles = ({
|
|
38
5
|
name,
|
|
39
6
|
errorClassName,
|
|
@@ -44,14 +11,14 @@ const useErrorStyles = ({
|
|
|
44
11
|
const {
|
|
45
12
|
formState: { errors },
|
|
46
13
|
setError
|
|
47
|
-
} =
|
|
48
|
-
const serverError =
|
|
49
|
-
|
|
14
|
+
} = useFormContext();
|
|
15
|
+
const serverError = useContext(ServerErrorsContext)[name];
|
|
16
|
+
React.useEffect(() => {
|
|
50
17
|
if (serverError) {
|
|
51
18
|
setError(name, { type: "server", message: serverError });
|
|
52
19
|
}
|
|
53
20
|
}, [serverError, name, setError]);
|
|
54
|
-
const validationError = name ?
|
|
21
|
+
const validationError = name ? get(errors, name) : void 0;
|
|
55
22
|
if (validationError) {
|
|
56
23
|
if (errorClassName) {
|
|
57
24
|
className = errorClassName;
|
|
@@ -62,7 +29,6 @@ const useErrorStyles = ({
|
|
|
62
29
|
}
|
|
63
30
|
return { className, style };
|
|
64
31
|
};
|
|
65
|
-
|
|
66
|
-
0 && (module.exports = {
|
|
32
|
+
export {
|
|
67
33
|
useErrorStyles
|
|
68
|
-
}
|
|
34
|
+
};
|
package/dist/useRegister.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { EmptyAsValue } from './coercion';
|
|
3
|
-
import type { FieldProps } from './FieldProps';
|
|
2
|
+
import type { EmptyAsValue } from './coercion.js';
|
|
3
|
+
import type { FieldProps } from './FieldProps.js';
|
|
4
4
|
export type UseRegisterProps<Element extends HTMLTextAreaElement | HTMLSelectElement | HTMLInputElement = HTMLInputElement> = Pick<FieldProps<Element>, 'name' | 'validation' | 'type' | 'onBlur' | 'onChange'>;
|
|
5
5
|
/**
|
|
6
6
|
* useRegister
|
|
@@ -19,7 +19,7 @@ export declare const useRegister: <T, Element extends HTMLTextAreaElement | HTML
|
|
|
19
19
|
}, ref?: React.ForwardedRef<T>, emptyAs?: EmptyAsValue) => {
|
|
20
20
|
ref: (element: T) => void;
|
|
21
21
|
onBlur: React.FocusEventHandler<Element>;
|
|
22
|
-
onChange: React.ChangeEventHandler<Element>;
|
|
22
|
+
onChange: React.ChangeEventHandler<Element, globalThis.Element>;
|
|
23
23
|
name: string;
|
|
24
24
|
min?: string | number;
|
|
25
25
|
max?: string | number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRegister.d.ts","sourceRoot":"","sources":["../src/useRegister.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useRegister.d.ts","sourceRoot":"","sources":["../src/useRegister.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,MAAM,gBAAgB,CAC1B,OAAO,SAAS,mBAAmB,GAAG,iBAAiB,GAAG,gBAAgB,GACxE,gBAAgB,IAChB,IAAI,CACN,UAAU,CAAC,OAAO,CAAC,EACnB,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CACvD,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GACtB,CAAC,EACD,OAAO,SAAS,mBAAmB,GAAG,iBAAiB,GAAG,gBAAgB,GACxE,gBAAgB,EAElB,OAAO,gBAAgB,CAAC,OAAO,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACvD,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAC3B,UAAU,YAAY;mBAmCL,CAAC;;;;;;;;;;;CAYnB,CAAA"}
|