@ttoss/forms 0.9.1 → 0.11.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/dist/esm/index.js +10 -2
- package/dist/index.d.ts +10 -4
- package/dist/index.js +10 -2
- package/package.json +4 -4
- package/src/FormFieldCheckbox.tsx +8 -1
- package/src/FormFieldInput.tsx +11 -1
package/dist/esm/index.js
CHANGED
|
@@ -61,7 +61,8 @@ import { useController } from "react-hook-form";
|
|
|
61
61
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
62
62
|
var FormFieldCheckbox = ({
|
|
63
63
|
label,
|
|
64
|
-
name
|
|
64
|
+
name,
|
|
65
|
+
disabled
|
|
65
66
|
}) => {
|
|
66
67
|
const {
|
|
67
68
|
field: { onChange, onBlur, value, ref }
|
|
@@ -78,11 +79,13 @@ var FormFieldCheckbox = ({
|
|
|
78
79
|
/* @__PURE__ */ jsx3(Checkbox, {
|
|
79
80
|
id,
|
|
80
81
|
ref,
|
|
82
|
+
disabled,
|
|
81
83
|
checked: value,
|
|
82
84
|
onChange,
|
|
83
85
|
onBlur
|
|
84
86
|
}),
|
|
85
87
|
label && /* @__PURE__ */ jsx3(Label, {
|
|
88
|
+
"aria-disabled": disabled,
|
|
86
89
|
htmlFor: id,
|
|
87
90
|
children: label
|
|
88
91
|
})
|
|
@@ -101,7 +104,9 @@ import { useController as useController2 } from "react-hook-form";
|
|
|
101
104
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
102
105
|
var FormFieldInput = ({
|
|
103
106
|
label,
|
|
104
|
-
name
|
|
107
|
+
name,
|
|
108
|
+
disabled,
|
|
109
|
+
placeholder
|
|
105
110
|
}) => {
|
|
106
111
|
const {
|
|
107
112
|
field: { onChange, onBlur, value, ref }
|
|
@@ -113,6 +118,7 @@ var FormFieldInput = ({
|
|
|
113
118
|
return /* @__PURE__ */ jsxs2(Box3, {
|
|
114
119
|
children: [
|
|
115
120
|
label && /* @__PURE__ */ jsx4(Label2, {
|
|
121
|
+
"aria-disabled": disabled,
|
|
116
122
|
htmlFor: id,
|
|
117
123
|
children: label
|
|
118
124
|
}),
|
|
@@ -122,6 +128,8 @@ var FormFieldInput = ({
|
|
|
122
128
|
onBlur,
|
|
123
129
|
value,
|
|
124
130
|
name,
|
|
131
|
+
disabled,
|
|
132
|
+
placeholder,
|
|
125
133
|
id
|
|
126
134
|
}),
|
|
127
135
|
/* @__PURE__ */ jsx4(ErrorMessage, {
|
package/dist/index.d.ts
CHANGED
|
@@ -20,9 +20,11 @@ declare const Form: <TFieldValues extends FieldValues = FieldValues>({ children,
|
|
|
20
20
|
*/
|
|
21
21
|
declare const FormField: {
|
|
22
22
|
(): null;
|
|
23
|
-
Input: <TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues>({ label, name, }: {
|
|
23
|
+
Input: <TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues>({ label, name, disabled, placeholder, }: {
|
|
24
24
|
label?: string | undefined;
|
|
25
25
|
name: react_hook_form.Path<TFieldValues>;
|
|
26
|
+
disabled?: boolean | undefined;
|
|
27
|
+
placeholder?: string | undefined;
|
|
26
28
|
}) => JSX.Element;
|
|
27
29
|
Radio: <TFieldValues_1 extends react_hook_form.FieldValues = react_hook_form.FieldValues>({ label, name, options, }: {
|
|
28
30
|
label?: string | undefined;
|
|
@@ -43,20 +45,24 @@ declare const FormField: {
|
|
|
43
45
|
}[];
|
|
44
46
|
arrow?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
45
47
|
}) => JSX.Element;
|
|
46
|
-
Checkbox: <TFieldValues_3 extends react_hook_form.FieldValues = react_hook_form.FieldValues>({ label, name, }: {
|
|
48
|
+
Checkbox: <TFieldValues_3 extends react_hook_form.FieldValues = react_hook_form.FieldValues>({ label, name, disabled, }: {
|
|
47
49
|
label?: string | undefined;
|
|
48
50
|
name: react_hook_form.Path<TFieldValues_3>;
|
|
51
|
+
disabled?: boolean | undefined;
|
|
49
52
|
}) => JSX.Element;
|
|
50
53
|
};
|
|
51
54
|
|
|
52
|
-
declare const FormFieldCheckbox: <TFieldValues extends FieldValues = FieldValues>({ label, name, }: {
|
|
55
|
+
declare const FormFieldCheckbox: <TFieldValues extends FieldValues = FieldValues>({ label, name, disabled, }: {
|
|
53
56
|
label?: string | undefined;
|
|
54
57
|
name: Path<TFieldValues>;
|
|
58
|
+
disabled?: boolean | undefined;
|
|
55
59
|
}) => JSX.Element;
|
|
56
60
|
|
|
57
|
-
declare const FormFieldInput: <TFieldValues extends FieldValues = FieldValues>({ label, name, }: {
|
|
61
|
+
declare const FormFieldInput: <TFieldValues extends FieldValues = FieldValues>({ label, name, disabled, placeholder, }: {
|
|
58
62
|
label?: string | undefined;
|
|
59
63
|
name: Path<TFieldValues>;
|
|
64
|
+
disabled?: boolean | undefined;
|
|
65
|
+
placeholder?: string | undefined;
|
|
60
66
|
}) => JSX.Element;
|
|
61
67
|
|
|
62
68
|
declare type FormRadioOption$1 = {
|
package/dist/index.js
CHANGED
|
@@ -100,7 +100,8 @@ var import_react_hook_form3 = require("react-hook-form");
|
|
|
100
100
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
101
101
|
var FormFieldCheckbox = ({
|
|
102
102
|
label,
|
|
103
|
-
name
|
|
103
|
+
name,
|
|
104
|
+
disabled
|
|
104
105
|
}) => {
|
|
105
106
|
const {
|
|
106
107
|
field: { onChange, onBlur, value, ref }
|
|
@@ -117,11 +118,13 @@ var FormFieldCheckbox = ({
|
|
|
117
118
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Checkbox, {
|
|
118
119
|
id,
|
|
119
120
|
ref,
|
|
121
|
+
disabled,
|
|
120
122
|
checked: value,
|
|
121
123
|
onChange,
|
|
122
124
|
onBlur
|
|
123
125
|
}),
|
|
124
126
|
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Label, {
|
|
127
|
+
"aria-disabled": disabled,
|
|
125
128
|
htmlFor: id,
|
|
126
129
|
children: label
|
|
127
130
|
})
|
|
@@ -140,7 +143,9 @@ var import_react_hook_form4 = require("react-hook-form");
|
|
|
140
143
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
141
144
|
var FormFieldInput = ({
|
|
142
145
|
label,
|
|
143
|
-
name
|
|
146
|
+
name,
|
|
147
|
+
disabled,
|
|
148
|
+
placeholder
|
|
144
149
|
}) => {
|
|
145
150
|
const {
|
|
146
151
|
field: { onChange, onBlur, value, ref }
|
|
@@ -152,6 +157,7 @@ var FormFieldInput = ({
|
|
|
152
157
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_ui4.Box, {
|
|
153
158
|
children: [
|
|
154
159
|
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui4.Label, {
|
|
160
|
+
"aria-disabled": disabled,
|
|
155
161
|
htmlFor: id,
|
|
156
162
|
children: label
|
|
157
163
|
}),
|
|
@@ -161,6 +167,8 @@ var FormFieldInput = ({
|
|
|
161
167
|
onBlur,
|
|
162
168
|
value,
|
|
163
169
|
name,
|
|
170
|
+
disabled,
|
|
171
|
+
placeholder,
|
|
164
172
|
id
|
|
165
173
|
}),
|
|
166
174
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorMessage, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@ttoss/config": "^1.21.0",
|
|
32
32
|
"@ttoss/test-utils": "^1.18.1",
|
|
33
|
-
"@ttoss/ui": "^1.
|
|
34
|
-
"@types/jest": "^29.2.
|
|
33
|
+
"@ttoss/ui": "^1.26.0",
|
|
34
|
+
"@types/jest": "^29.2.4",
|
|
35
35
|
"jest": "^29.3.1",
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"react-hook-form": "^7.39.7",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "770c9a378b57b46158e533b505d53747f1b27a07"
|
|
44
44
|
}
|
|
@@ -7,9 +7,11 @@ export const FormFieldCheckbox = <
|
|
|
7
7
|
>({
|
|
8
8
|
label,
|
|
9
9
|
name,
|
|
10
|
+
disabled,
|
|
10
11
|
}: {
|
|
11
12
|
label?: string;
|
|
12
13
|
name: Path<TFieldValues>;
|
|
14
|
+
disabled?: boolean;
|
|
13
15
|
}) => {
|
|
14
16
|
const {
|
|
15
17
|
field: { onChange, onBlur, value, ref },
|
|
@@ -26,11 +28,16 @@ export const FormFieldCheckbox = <
|
|
|
26
28
|
<Checkbox
|
|
27
29
|
id={id}
|
|
28
30
|
ref={ref}
|
|
31
|
+
disabled={disabled}
|
|
29
32
|
checked={value}
|
|
30
33
|
onChange={onChange}
|
|
31
34
|
onBlur={onBlur}
|
|
32
35
|
/>
|
|
33
|
-
{label &&
|
|
36
|
+
{label && (
|
|
37
|
+
<Label aria-disabled={disabled} htmlFor={id}>
|
|
38
|
+
{label}
|
|
39
|
+
</Label>
|
|
40
|
+
)}
|
|
34
41
|
</Flex>
|
|
35
42
|
<ErrorMessage name={name} />
|
|
36
43
|
</Box>
|
package/src/FormFieldInput.tsx
CHANGED
|
@@ -5,9 +5,13 @@ import { FieldValues, Path, useController } from 'react-hook-form';
|
|
|
5
5
|
export const FormFieldInput = <TFieldValues extends FieldValues = FieldValues>({
|
|
6
6
|
label,
|
|
7
7
|
name,
|
|
8
|
+
disabled,
|
|
9
|
+
placeholder,
|
|
8
10
|
}: {
|
|
9
11
|
label?: string;
|
|
10
12
|
name: Path<TFieldValues>;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
11
15
|
}) => {
|
|
12
16
|
const {
|
|
13
17
|
field: { onChange, onBlur, value, ref },
|
|
@@ -20,13 +24,19 @@ export const FormFieldInput = <TFieldValues extends FieldValues = FieldValues>({
|
|
|
20
24
|
|
|
21
25
|
return (
|
|
22
26
|
<Box>
|
|
23
|
-
{label &&
|
|
27
|
+
{label && (
|
|
28
|
+
<Label aria-disabled={disabled} htmlFor={id}>
|
|
29
|
+
{label}
|
|
30
|
+
</Label>
|
|
31
|
+
)}
|
|
24
32
|
<Input
|
|
25
33
|
ref={ref}
|
|
26
34
|
onChange={onChange}
|
|
27
35
|
onBlur={onBlur}
|
|
28
36
|
value={value}
|
|
29
37
|
name={name}
|
|
38
|
+
disabled={disabled}
|
|
39
|
+
placeholder={placeholder}
|
|
30
40
|
id={id}
|
|
31
41
|
/>
|
|
32
42
|
<ErrorMessage name={name} />
|