@deftui/addons 0.0.2 → 0.0.4
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.
|
@@ -8,7 +8,7 @@ interface RHFFieldProps<Values extends FieldValues, Name extends FieldPath<Value
|
|
|
8
8
|
label?: React.ReactNode;
|
|
9
9
|
description?: React.ReactNode;
|
|
10
10
|
fieldProps?: FieldRootProps;
|
|
11
|
-
children: (state: UseControllerReturn<Values, Name>
|
|
11
|
+
children: (state: UseControllerReturn<Values, Name>) => React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
export declare function RHFField<T extends FieldValues, Name extends FieldPath<T>, Output = T>(props: RHFFieldProps<T, Name, Output>): React.JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -4,13 +4,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
// src/react-hook-form/field.tsx
|
|
5
5
|
function RHFField(props) {
|
|
6
6
|
const { label, description, fieldProps, children, ...controllerProps } = props;
|
|
7
|
-
const
|
|
7
|
+
const controller = useController(controllerProps);
|
|
8
|
+
const { fieldState } = controller;
|
|
8
9
|
return /* @__PURE__ */ jsxs(Field, {
|
|
9
10
|
...fieldProps,
|
|
10
11
|
"data-invalid": fieldState.invalid,
|
|
11
12
|
children: [
|
|
12
13
|
label != null && /* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
13
|
-
children(
|
|
14
|
+
children(controller),
|
|
14
15
|
description != null && /* @__PURE__ */ jsx(Field.Description, { children: description }),
|
|
15
16
|
fieldState.invalid && /* @__PURE__ */ jsx(Field.Error, { errors: [fieldState.error] })
|
|
16
17
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftui/addons",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/KiriRainCat/deftui.git",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"fix": "vp check --fix"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@deftui/react": "^0.0.
|
|
32
|
+
"@deftui/react": "^0.0.4",
|
|
33
33
|
"@tanstack/react-router": "^1.170.46",
|
|
34
34
|
"@types/react": "^19.3.0",
|
|
35
35
|
"react-hook-form": "^7.91.0",
|
|
36
36
|
"vite-plus": "catalog:"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@deftui/react": "^0.0.
|
|
39
|
+
"@deftui/react": "^0.0.4",
|
|
40
40
|
"@tanstack/react-router": "^1",
|
|
41
41
|
"react": "^19",
|
|
42
42
|
"react-hook-form": "^7"
|