@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/CheckboxField.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 CheckboxFieldProps extends Omit<FieldProps<HTMLInputElement>, 'type' | 'emptyAs'>, Omit<React.ComponentPropsWithRef<'input'>, 'name' | 'type'> {
|
|
4
4
|
}
|
|
5
5
|
/** Renders an `<input type="checkbox">` field */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxField.d.ts","sourceRoot":"","sources":["../src/CheckboxField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CheckboxField.d.ts","sourceRoot":"","sources":["../src/CheckboxField.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,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,EACtD,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAAG;AAElE,iDAAiD;AACjD,eAAO,MAAM,aAAa,0GAkDzB,CAAA"}
|
package/dist/CheckboxField.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 CheckboxField_exports = {};
|
|
30
|
-
__export(CheckboxField_exports, {
|
|
31
|
-
CheckboxField: () => CheckboxField
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(CheckboxField_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_useErrorStyles = require("./useErrorStyles");
|
|
36
|
-
var import_useRegister = require("./useRegister");
|
|
37
|
-
const CheckboxField = (0, import_react.forwardRef)(
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { useErrorStyles } from "./useErrorStyles.js";
|
|
3
|
+
import { useRegister } from "./useRegister.js";
|
|
4
|
+
const CheckboxField = forwardRef(
|
|
38
5
|
({
|
|
39
6
|
name,
|
|
40
7
|
id,
|
|
@@ -49,7 +16,7 @@ const CheckboxField = (0, import_react.forwardRef)(
|
|
|
49
16
|
onChange,
|
|
50
17
|
...rest
|
|
51
18
|
}, ref) => {
|
|
52
|
-
const styles =
|
|
19
|
+
const styles = useErrorStyles({
|
|
53
20
|
name,
|
|
54
21
|
errorClassName,
|
|
55
22
|
errorStyle,
|
|
@@ -57,7 +24,7 @@ const CheckboxField = (0, import_react.forwardRef)(
|
|
|
57
24
|
style
|
|
58
25
|
});
|
|
59
26
|
const type = "checkbox";
|
|
60
|
-
const useRegisterReturn =
|
|
27
|
+
const useRegisterReturn = useRegister(
|
|
61
28
|
{
|
|
62
29
|
name,
|
|
63
30
|
validation,
|
|
@@ -67,7 +34,7 @@ const CheckboxField = (0, import_react.forwardRef)(
|
|
|
67
34
|
},
|
|
68
35
|
ref
|
|
69
36
|
);
|
|
70
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ React.createElement(
|
|
71
38
|
"input",
|
|
72
39
|
{
|
|
73
40
|
id: id || name,
|
|
@@ -79,7 +46,6 @@ const CheckboxField = (0, import_react.forwardRef)(
|
|
|
79
46
|
);
|
|
80
47
|
}
|
|
81
48
|
);
|
|
82
|
-
|
|
83
|
-
0 && (module.exports = {
|
|
49
|
+
export {
|
|
84
50
|
CheckboxField
|
|
85
|
-
}
|
|
51
|
+
};
|
package/dist/FieldError.js
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
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 FieldError_exports = {};
|
|
30
|
-
__export(FieldError_exports, {
|
|
31
|
-
FieldError: () => FieldError
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(FieldError_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_react_hook_form = require("react-hook-form");
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { get, useFormContext } from "react-hook-form";
|
|
36
3
|
const DEFAULT_MESSAGES = {
|
|
37
4
|
required: "is required",
|
|
38
5
|
pattern: "is not formatted correctly",
|
|
@@ -45,12 +12,11 @@ const DEFAULT_MESSAGES = {
|
|
|
45
12
|
const FieldError = ({ name, ...rest }) => {
|
|
46
13
|
const {
|
|
47
14
|
formState: { errors }
|
|
48
|
-
} =
|
|
49
|
-
const validationError =
|
|
15
|
+
} = useFormContext();
|
|
16
|
+
const validationError = get(errors, name);
|
|
50
17
|
const errorMessage = validationError && (validationError.message || `${name} ${DEFAULT_MESSAGES[validationError.type]}`);
|
|
51
|
-
return validationError ? /* @__PURE__ */
|
|
18
|
+
return validationError ? /* @__PURE__ */ React.createElement("span", { ...rest }, errorMessage) : null;
|
|
52
19
|
};
|
|
53
|
-
|
|
54
|
-
0 && (module.exports = {
|
|
20
|
+
export {
|
|
55
21
|
FieldError
|
|
56
|
-
}
|
|
22
|
+
};
|
package/dist/FieldProps.d.ts
CHANGED
package/dist/FieldProps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldProps.d.ts","sourceRoot":"","sources":["../src/FieldProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FieldProps.d.ts","sourceRoot":"","sources":["../src/FieldProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEzE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU,CACzB,OAAO,SAAS,mBAAmB,GAAG,iBAAiB,GAAG,gBAAgB,GACxE,gBAAgB;IAElB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,UAAU,CAAC,EAAE,sBAAsB,CAAA;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;IACzC,QAAQ,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;CAC7C"}
|
package/dist/FieldProps.js
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var FieldProps_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(FieldProps_exports);
|
package/dist/Form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../src/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAI/E,MAAM,WAAW,SAAS,CACxB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,CACjC,SAAQ,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7D,KAAK,CAAC,EAAE,GAAG,CAAA;IACX;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACvE;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACjE,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,kBAAkB,EACzB,KAAK,CAAC,EAAE,KAAK,CAAC,kBAAkB,KAC7B,IAAI,CAAA;CACV;
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../src/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAI/E,MAAM,WAAW,SAAS,CACxB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,CACjC,SAAQ,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7D,KAAK,CAAC,EAAE,GAAG,CAAA;IACX;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACvE;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACjE,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,kBAAkB,EACzB,KAAK,CAAC,EAAE,KAAK,CAAC,kBAAkB,KAC7B,IAAI,CAAA;CACV;AA2DD,eAAO,MAAM,IAAI,EAA4B,CAC3C,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EAEjC,KAAK,EAAE,SAAS,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,GAC1D,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,KACnC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA"}
|
package/dist/Form.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 Form_exports = {};
|
|
30
|
-
__export(Form_exports, {
|
|
31
|
-
Form: () => Form
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(Form_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, { forwardRef } from "react";
|
|
2
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
3
|
+
import { ServerErrorsContext } from "./ServerErrorsContext.js";
|
|
37
4
|
function FormInner({
|
|
38
5
|
config,
|
|
39
6
|
error: errorProps,
|
|
@@ -42,11 +9,11 @@ function FormInner({
|
|
|
42
9
|
children,
|
|
43
10
|
...rest
|
|
44
11
|
}, ref) {
|
|
45
|
-
const hookFormMethods =
|
|
12
|
+
const hookFormMethods = useForm(
|
|
46
13
|
config
|
|
47
14
|
);
|
|
48
15
|
const formMethods = propFormMethods || hookFormMethods;
|
|
49
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ React.createElement(
|
|
50
17
|
"form",
|
|
51
18
|
{
|
|
52
19
|
ref,
|
|
@@ -55,17 +22,21 @@ function FormInner({
|
|
|
55
22
|
(data, event) => onSubmit?.(data, event)
|
|
56
23
|
)
|
|
57
24
|
},
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
25
|
+
/* @__PURE__ */ React.createElement(
|
|
26
|
+
ServerErrorsContext.Provider,
|
|
60
27
|
{
|
|
61
|
-
value:
|
|
28
|
+
value: (
|
|
29
|
+
// Apollo Client 4 stores GraphQL errors in `errors`
|
|
30
|
+
// (`CombinedGraphQLErrors`); `graphQLErrors` is the Apollo Client 3
|
|
31
|
+
// shape, kept for tests, Storybook mocks and other GraphQL clients
|
|
32
|
+
errorProps?.graphQLErrors?.[0]?.extensions?.properties?.messages || errorProps?.errors?.[0]?.extensions?.properties?.messages || {}
|
|
33
|
+
)
|
|
62
34
|
},
|
|
63
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ React.createElement(FormProvider, { ...formMethods }, children)
|
|
64
36
|
)
|
|
65
37
|
);
|
|
66
38
|
}
|
|
67
|
-
const Form =
|
|
68
|
-
|
|
69
|
-
0 && (module.exports = {
|
|
39
|
+
const Form = forwardRef(FormInner);
|
|
40
|
+
export {
|
|
70
41
|
Form
|
|
71
|
-
}
|
|
42
|
+
};
|
package/dist/FormError.d.ts
CHANGED
|
@@ -12,8 +12,16 @@ export interface ServerError extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
export interface RWGqlError {
|
|
14
14
|
message: string;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* GraphQL errors as exposed by Apollo Client 4's `CombinedGraphQLErrors`
|
|
17
|
+
*/
|
|
18
|
+
errors?: readonly GraphQLFormattedError[];
|
|
19
|
+
/**
|
|
20
|
+
* GraphQL errors in the Apollo Client 3 shape. Kept so tests, Storybook
|
|
21
|
+
* mocks and other GraphQL clients that use this shape keep working
|
|
22
|
+
*/
|
|
23
|
+
graphQLErrors?: readonly GraphQLFormattedError[];
|
|
24
|
+
networkError?: Error | ServerParseError | ServerError | null;
|
|
17
25
|
}
|
|
18
26
|
export type RwGqlErrorProperties = Record<string, Record<string, string[]>>;
|
|
19
27
|
interface FormErrorProps {
|
package/dist/FormError.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormError.d.ts","sourceRoot":"","sources":["../src/FormError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,SAAS,qBAAqB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"FormError.d.ts","sourceRoot":"","sources":["../src/FormError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAA;IACzC;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAA;IAChD,YAAY,CAAC,EAAE,KAAK,GAAG,gBAAgB,GAAG,WAAW,GAAG,IAAI,CAAA;CAC7D;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;AAE3E,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAClC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CACpC;AAED;;;GAGG;AACH,QAAA,MAAM,SAAS,GAAI,oIAUhB,cAAc,6BAmFhB,CAAA;AAED,eAAe,SAAS,CAAA"}
|
package/dist/FormError.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
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 FormError_exports = {};
|
|
30
|
-
__export(FormError_exports, {
|
|
31
|
-
default: () => FormError_default
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(FormError_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
1
|
+
import React from "react";
|
|
35
2
|
const FormError = ({
|
|
36
3
|
error,
|
|
37
4
|
wrapperClassName,
|
|
@@ -48,14 +15,21 @@ const FormError = ({
|
|
|
48
15
|
}
|
|
49
16
|
let rootMessage = error.message;
|
|
50
17
|
const messages = [];
|
|
51
|
-
const
|
|
52
|
-
const
|
|
18
|
+
const graphQLErrors = error.graphQLErrors?.length ? error.graphQLErrors : error.errors ?? [];
|
|
19
|
+
const hasGraphQLError = !!graphQLErrors[0];
|
|
20
|
+
const networkError = error.networkError ?? ("bodyText" in error || "result" in error ? (
|
|
21
|
+
// `RWGqlError` is a loose interface over what GraphQL clients throw;
|
|
22
|
+
// when the object has server-error fields the error itself is the
|
|
23
|
+
// network error
|
|
24
|
+
error
|
|
25
|
+
) : null);
|
|
26
|
+
const hasNetworkError = !!networkError && Object.keys(networkError).length > 0;
|
|
53
27
|
if (hasGraphQLError) {
|
|
54
|
-
rootMessage =
|
|
55
|
-
if (
|
|
28
|
+
rootMessage = graphQLErrors[0].message ?? "Something went wrong";
|
|
29
|
+
if (graphQLErrors[0]?.extensions?.code === "BAD_USER_INPUT") {
|
|
56
30
|
rootMessage = "Errors prevented this form from being saved";
|
|
57
31
|
}
|
|
58
|
-
const properties =
|
|
32
|
+
const properties = graphQLErrors[0].extensions?.["properties"];
|
|
59
33
|
const propertyMessages = properties?.["messages"];
|
|
60
34
|
if (propertyMessages) {
|
|
61
35
|
for (const e in propertyMessages) {
|
|
@@ -66,11 +40,11 @@ const FormError = ({
|
|
|
66
40
|
}
|
|
67
41
|
} else if (hasNetworkError) {
|
|
68
42
|
rootMessage = rootMessage ?? "An error has occurred";
|
|
69
|
-
if (
|
|
70
|
-
const netErr =
|
|
43
|
+
if ("bodyText" in networkError) {
|
|
44
|
+
const netErr = networkError;
|
|
71
45
|
messages.push(`${netErr.name}: ${netErr.bodyText}`);
|
|
72
|
-
} else if (
|
|
73
|
-
const netErr =
|
|
46
|
+
} else if ("result" in networkError) {
|
|
47
|
+
const netErr = networkError;
|
|
74
48
|
netErr.result.errors?.forEach((error2) => {
|
|
75
49
|
if (typeof error2.message === "string") {
|
|
76
50
|
if (error2.message.indexOf(";") >= 0) {
|
|
@@ -85,6 +59,9 @@ const FormError = ({
|
|
|
85
59
|
if (!rootMessage) {
|
|
86
60
|
return null;
|
|
87
61
|
}
|
|
88
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ React.createElement("div", { className: wrapperClassName, style: wrapperStyle }, /* @__PURE__ */ React.createElement("p", { className: titleClassName, style: titleStyle }, rootMessage), messages.length > 0 && /* @__PURE__ */ React.createElement("ul", { className: listClassName, style: listStyle }, messages.map((message, index) => /* @__PURE__ */ React.createElement("li", { key: index, className: listItemClassName, style: listItemStyle }, message))));
|
|
89
63
|
};
|
|
90
64
|
var FormError_default = FormError;
|
|
65
|
+
export {
|
|
66
|
+
FormError_default as default
|
|
67
|
+
};
|
|
@@ -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
|
/**
|
|
4
4
|
* All the types we'll be generating named `<InputFields>` for (which is basically all of them).
|
|
5
5
|
* Note that `'checkbox'` isn't here because we handle it separately above.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputComponents.d.ts","sourceRoot":"","sources":["../src/InputComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"InputComponents.d.ts","sourceRoot":"","sources":["../src/InputComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD;;;;;GAKG;AACH,QAAA,MAAM,WAAW,gNAsBP,CAAA;AAEV,KAAK,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7C,MAAM,WAAW,eACf,SACE,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EAC1C,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7D;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,uGAkDtB,CAAA;AA2BD,eAAO,MACL,WAAW,kEACX,UAAU,kEACV,SAAS,kEACT,kBAAkB,kEAClB,UAAU,kEACV,SAAS,kEACT,WAAW,kEACX,UAAU,kEACV,UAAU,kEACV,WAAW,kEACX,aAAa,kEACb,UAAU,kEACV,UAAU,kEACV,UAAU,kEACV,WAAW,kEACX,WAAW,kEACX,QAAQ,kEACR,SAAS,kEACT,SAAS,kEACT,QAAQ,kEACR,SAAS,gEACQ,CAAA"}
|
package/dist/InputComponents.js
CHANGED
|
@@ -1,61 +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 InputComponents_exports = {};
|
|
30
|
-
__export(InputComponents_exports, {
|
|
31
|
-
ButtonField: () => ButtonField,
|
|
32
|
-
ColorField: () => ColorField,
|
|
33
|
-
DateField: () => DateField,
|
|
34
|
-
DatetimeLocalField: () => DatetimeLocalField,
|
|
35
|
-
EmailField: () => EmailField,
|
|
36
|
-
FileField: () => FileField,
|
|
37
|
-
HiddenField: () => HiddenField,
|
|
38
|
-
ImageField: () => ImageField,
|
|
39
|
-
InputField: () => InputField,
|
|
40
|
-
MonthField: () => MonthField,
|
|
41
|
-
NumberField: () => NumberField,
|
|
42
|
-
PasswordField: () => PasswordField,
|
|
43
|
-
RadioField: () => RadioField,
|
|
44
|
-
RangeField: () => RangeField,
|
|
45
|
-
ResetField: () => ResetField,
|
|
46
|
-
SearchField: () => SearchField,
|
|
47
|
-
SubmitField: () => SubmitField,
|
|
48
|
-
TelField: () => TelField,
|
|
49
|
-
TextField: () => TextField,
|
|
50
|
-
TimeField: () => TimeField,
|
|
51
|
-
UrlField: () => UrlField,
|
|
52
|
-
WeekField: () => WeekField
|
|
53
|
-
});
|
|
54
|
-
module.exports = __toCommonJS(InputComponents_exports);
|
|
55
|
-
var import_react = __toESM(require("react"));
|
|
56
|
-
var import_pascalcase = __toESM(require("pascalcase"));
|
|
57
|
-
var import_useErrorStyles = require("./useErrorStyles");
|
|
58
|
-
var import_useRegister = require("./useRegister");
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import pascalcase from "pascalcase";
|
|
3
|
+
import { useErrorStyles } from "./useErrorStyles.js";
|
|
4
|
+
import { useRegister } from "./useRegister.js";
|
|
59
5
|
const INPUT_TYPES = [
|
|
60
6
|
"button",
|
|
61
7
|
"color",
|
|
@@ -79,7 +25,7 @@ const INPUT_TYPES = [
|
|
|
79
25
|
"url",
|
|
80
26
|
"week"
|
|
81
27
|
];
|
|
82
|
-
const InputField =
|
|
28
|
+
const InputField = forwardRef(
|
|
83
29
|
({
|
|
84
30
|
name,
|
|
85
31
|
id,
|
|
@@ -96,14 +42,14 @@ const InputField = (0, import_react.forwardRef)(
|
|
|
96
42
|
type,
|
|
97
43
|
...rest
|
|
98
44
|
}, ref) => {
|
|
99
|
-
const styles =
|
|
45
|
+
const styles = useErrorStyles({
|
|
100
46
|
name,
|
|
101
47
|
errorClassName,
|
|
102
48
|
errorStyle,
|
|
103
49
|
className,
|
|
104
50
|
style
|
|
105
51
|
});
|
|
106
|
-
const useRegisterReturn =
|
|
52
|
+
const useRegisterReturn = useRegister(
|
|
107
53
|
{
|
|
108
54
|
name,
|
|
109
55
|
validation,
|
|
@@ -114,7 +60,7 @@ const InputField = (0, import_react.forwardRef)(
|
|
|
114
60
|
ref,
|
|
115
61
|
emptyAs
|
|
116
62
|
);
|
|
117
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ React.createElement(
|
|
118
64
|
"input",
|
|
119
65
|
{
|
|
120
66
|
id: id || name,
|
|
@@ -128,7 +74,7 @@ const InputField = (0, import_react.forwardRef)(
|
|
|
128
74
|
);
|
|
129
75
|
const InputComponents = {};
|
|
130
76
|
INPUT_TYPES.forEach((type) => {
|
|
131
|
-
InputComponents[`${(
|
|
77
|
+
InputComponents[`${pascalcase(type)}Field`] = forwardRef((props, ref) => /* @__PURE__ */ React.createElement(InputField, { ref, type, ...props }));
|
|
132
78
|
});
|
|
133
79
|
const {
|
|
134
80
|
ButtonField,
|
|
@@ -153,8 +99,7 @@ const {
|
|
|
153
99
|
UrlField,
|
|
154
100
|
WeekField
|
|
155
101
|
} = InputComponents;
|
|
156
|
-
|
|
157
|
-
0 && (module.exports = {
|
|
102
|
+
export {
|
|
158
103
|
ButtonField,
|
|
159
104
|
ColorField,
|
|
160
105
|
DateField,
|
|
@@ -177,4 +122,4 @@ const {
|
|
|
177
122
|
TimeField,
|
|
178
123
|
UrlField,
|
|
179
124
|
WeekField
|
|
180
|
-
}
|
|
125
|
+
};
|
package/dist/Label.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 LabelProps extends Pick<FieldProps, 'errorClassName' | 'errorStyle'>, React.ComponentPropsWithoutRef<'label'> {
|
|
4
4
|
name: string;
|
|
5
5
|
}
|
package/dist/Label.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../src/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../src/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGjD,MAAM,WAAW,UACf,SACE,IAAI,CAAC,UAAU,EAAE,gBAAgB,GAAG,YAAY,CAAC,EACjD,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;IACzC,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,2EASnB,UAAU,sBAcZ,CAAA"}
|
package/dist/Label.js
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
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 Label_exports = {};
|
|
30
|
-
__export(Label_exports, {
|
|
31
|
-
Label: () => Label
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(Label_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_useErrorStyles = require("./useErrorStyles");
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useErrorStyles } from "./useErrorStyles.js";
|
|
36
3
|
const Label = ({
|
|
37
4
|
name,
|
|
38
5
|
children,
|
|
@@ -43,16 +10,15 @@ const Label = ({
|
|
|
43
10
|
style,
|
|
44
11
|
...rest
|
|
45
12
|
}) => {
|
|
46
|
-
const styles =
|
|
13
|
+
const styles = useErrorStyles({
|
|
47
14
|
name,
|
|
48
15
|
errorClassName,
|
|
49
16
|
errorStyle,
|
|
50
17
|
className,
|
|
51
18
|
style
|
|
52
19
|
});
|
|
53
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ React.createElement("label", { htmlFor: name, ...rest, ...styles }, children || name);
|
|
54
21
|
};
|
|
55
|
-
|
|
56
|
-
0 && (module.exports = {
|
|
22
|
+
export {
|
|
57
23
|
Label
|
|
58
|
-
}
|
|
24
|
+
};
|
package/dist/SelectField.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 SelectFieldProps extends Omit<FieldProps<HTMLSelectElement>, 'type'>, Omit<React.ComponentPropsWithRef<'select'>, 'name'> {
|
|
4
4
|
}
|
|
5
5
|
/** Renders a `<select>` field */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../src/SelectField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../src/SelectField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD,MAAM,WAAW,gBACf,SACE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,EAC3C,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAAG;AAE1D,iCAAiC;AACjC,eAAO,MAAM,WAAW,yGA2CvB,CAAA"}
|