@cedarjs/forms 8.0.0-canary.3627 → 8.0.0-canary.3629
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.js +2 -1
- package/dist/FieldError.js +2 -1
- package/dist/Form.js +15 -14
- package/dist/FormError.js +5 -1
- package/dist/InputComponents.js +3 -2
- package/dist/Label.js +2 -1
- package/dist/SelectField.js +2 -1
- package/dist/Submit.js +2 -1
- package/dist/TextAreaField.js +2 -1
- package/package.json +3 -3
package/dist/CheckboxField.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { forwardRef } from "react";
|
|
2
3
|
import { useErrorStyles } from "./useErrorStyles.js";
|
|
3
4
|
import { useRegister } from "./useRegister.js";
|
|
@@ -34,7 +35,7 @@ const CheckboxField = forwardRef(
|
|
|
34
35
|
},
|
|
35
36
|
ref
|
|
36
37
|
);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
38
39
|
"input",
|
|
39
40
|
{
|
|
40
41
|
id: id || name,
|
package/dist/FieldError.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { get, useFormContext } from "react-hook-form";
|
|
3
4
|
const DEFAULT_MESSAGES = {
|
|
@@ -43,7 +44,7 @@ const FieldError = ({ name, render, ...rest }) => {
|
|
|
43
44
|
);
|
|
44
45
|
return render({ message, messages, type: validationError.type });
|
|
45
46
|
}
|
|
46
|
-
return message ? /* @__PURE__ */
|
|
47
|
+
return message ? /* @__PURE__ */ jsx("span", { ...rest, children: message }) : null;
|
|
47
48
|
};
|
|
48
49
|
export {
|
|
49
50
|
FieldError
|
package/dist/Form.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { forwardRef } from "react";
|
|
2
3
|
import { useForm, FormProvider } from "react-hook-form";
|
|
3
4
|
import { ServerErrorsContext } from "./ServerErrorsContext.js";
|
|
@@ -13,27 +14,27 @@ function FormInner({
|
|
|
13
14
|
config
|
|
14
15
|
);
|
|
15
16
|
const formMethods = propFormMethods || hookFormMethods;
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
17
18
|
"form",
|
|
18
19
|
{
|
|
19
20
|
ref,
|
|
20
21
|
...rest,
|
|
21
22
|
onSubmit: formMethods.handleSubmit(
|
|
22
23
|
(data, event) => onSubmit?.(data, event)
|
|
24
|
+
),
|
|
25
|
+
children: /* @__PURE__ */ jsx(
|
|
26
|
+
ServerErrorsContext.Provider,
|
|
27
|
+
{
|
|
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
|
+
),
|
|
34
|
+
children: /* @__PURE__ */ jsx(FormProvider, { ...formMethods, children })
|
|
35
|
+
}
|
|
23
36
|
)
|
|
24
|
-
}
|
|
25
|
-
/* @__PURE__ */ React.createElement(
|
|
26
|
-
ServerErrorsContext.Provider,
|
|
27
|
-
{
|
|
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
|
-
)
|
|
34
|
-
},
|
|
35
|
-
/* @__PURE__ */ React.createElement(FormProvider, { ...formMethods }, children)
|
|
36
|
-
)
|
|
37
|
+
}
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
const Form = forwardRef(FormInner);
|
package/dist/FormError.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
const FormError = ({
|
|
3
4
|
error,
|
|
@@ -59,7 +60,10 @@ const FormError = ({
|
|
|
59
60
|
if (!rootMessage) {
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ jsxs("div", { className: wrapperClassName, style: wrapperStyle, children: [
|
|
64
|
+
/* @__PURE__ */ jsx("p", { className: titleClassName, style: titleStyle, children: rootMessage }),
|
|
65
|
+
messages.length > 0 && /* @__PURE__ */ jsx("ul", { className: listClassName, style: listStyle, children: messages.map((message, index) => /* @__PURE__ */ jsx("li", { className: listItemClassName, style: listItemStyle, children: message }, index)) })
|
|
66
|
+
] });
|
|
63
67
|
};
|
|
64
68
|
var FormError_default = FormError;
|
|
65
69
|
export {
|
package/dist/InputComponents.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { forwardRef } from "react";
|
|
2
3
|
import pascalcase from "pascalcase";
|
|
3
4
|
import { useErrorStyles } from "./useErrorStyles.js";
|
|
@@ -60,7 +61,7 @@ const InputField = forwardRef(
|
|
|
60
61
|
ref,
|
|
61
62
|
emptyAs
|
|
62
63
|
);
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
64
65
|
"input",
|
|
65
66
|
{
|
|
66
67
|
id: id || name,
|
|
@@ -74,7 +75,7 @@ const InputField = forwardRef(
|
|
|
74
75
|
);
|
|
75
76
|
const InputComponents = {};
|
|
76
77
|
INPUT_TYPES.forEach((type) => {
|
|
77
|
-
InputComponents[`${pascalcase(type)}Field`] = forwardRef((props, ref) => /* @__PURE__ */
|
|
78
|
+
InputComponents[`${pascalcase(type)}Field`] = forwardRef((props, ref) => /* @__PURE__ */ jsx(InputField, { ref, type, ...props }));
|
|
78
79
|
});
|
|
79
80
|
const {
|
|
80
81
|
ButtonField,
|
package/dist/Label.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { useErrorStyles } from "./useErrorStyles.js";
|
|
3
4
|
const Label = ({
|
|
@@ -17,7 +18,7 @@ const Label = ({
|
|
|
17
18
|
className,
|
|
18
19
|
style
|
|
19
20
|
});
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsx("label", { htmlFor: name, ...rest, ...styles, children: children || name });
|
|
21
22
|
};
|
|
22
23
|
export {
|
|
23
24
|
Label
|
package/dist/SelectField.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { forwardRef } from "react";
|
|
2
3
|
import { useErrorStyles } from "./useErrorStyles.js";
|
|
3
4
|
import { useRegister } from "./useRegister.js";
|
|
@@ -34,7 +35,7 @@ const SelectField = forwardRef(
|
|
|
34
35
|
ref,
|
|
35
36
|
emptyAs
|
|
36
37
|
);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx("select", { id: id || name, ...rest, ...styles, ...useRegisterReturn });
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
41
|
export {
|
package/dist/Submit.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { forwardRef } from "react";
|
|
2
|
-
const Submit = forwardRef((props, ref) => /* @__PURE__ */
|
|
3
|
+
const Submit = forwardRef((props, ref) => /* @__PURE__ */ jsx("button", { ref, type: "submit", ...props }));
|
|
3
4
|
export {
|
|
4
5
|
Submit
|
|
5
6
|
};
|
package/dist/TextAreaField.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React, { forwardRef } from "react";
|
|
2
3
|
import { useErrorStyles } from "./useErrorStyles.js";
|
|
3
4
|
import { useRegister } from "./useRegister.js";
|
|
@@ -34,7 +35,7 @@ const TextAreaField = forwardRef(
|
|
|
34
35
|
ref,
|
|
35
36
|
emptyAs
|
|
36
37
|
);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx("textarea", { id: id || name, ...rest, ...styles, ...useRegisterReturn });
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
41
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/forms",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3629",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react-hook-form": "7.91.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
38
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3629",
|
|
39
39
|
"@testing-library/dom": "10.4.2",
|
|
40
40
|
"@testing-library/jest-dom": "6.9.1",
|
|
41
41
|
"@testing-library/react": "16.3.3",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react-dom": "19.3.1",
|
|
51
51
|
"typescript": "5.9.3",
|
|
52
52
|
"vite": "7.3.7",
|
|
53
|
-
"vitest": "5.0
|
|
53
|
+
"vitest": "5.1.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "19.3.1"
|