@ttoss/forms 0.14.19 → 0.14.20

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 CHANGED
@@ -103,12 +103,16 @@ var FormFieldCheckbox = ({
103
103
  onBlur,
104
104
  value,
105
105
  ref
106
+ },
107
+ formState: {
108
+ errors
106
109
  }
107
110
  } = useController2({
108
111
  name,
109
112
  defaultValue: false
110
113
  });
111
114
  const id = `form-field-checkbox-${name}`;
115
+ const error = !!errors[name]?.message;
112
116
  return /* @__PURE__ */jsxs2(Box3, {
113
117
  children: [/* @__PURE__ */jsx4(Flex, {
114
118
  sx: {
@@ -124,6 +128,7 @@ var FormFieldCheckbox = ({
124
128
  onChange,
125
129
  onBlur,
126
130
  name,
131
+ "aria-invalid": error ? "true" : "false",
127
132
  ...checkboxProps
128
133
  }), label]
129
134
  })
package/dist/index.js CHANGED
@@ -152,12 +152,16 @@ var FormFieldCheckbox = ({
152
152
  onBlur,
153
153
  value,
154
154
  ref
155
+ },
156
+ formState: {
157
+ errors
155
158
  }
156
159
  } = (0, import_react_hook_form4.useController)({
157
160
  name,
158
161
  defaultValue: false
159
162
  });
160
163
  const id = `form-field-checkbox-${name}`;
164
+ const error = !!errors[name]?.message;
161
165
  return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_ui4.Box, {
162
166
  children: [/* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui4.Flex, {
163
167
  sx: {
@@ -173,6 +177,7 @@ var FormFieldCheckbox = ({
173
177
  onChange,
174
178
  onBlur,
175
179
  name,
180
+ "aria-invalid": error ? "true" : "false",
176
181
  ...checkboxProps
177
182
  }), label]
178
183
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/forms",
3
- "version": "0.14.19",
3
+ "version": "0.14.20",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -31,7 +31,7 @@
31
31
  "devDependencies": {
32
32
  "@ttoss/config": "^1.29.2",
33
33
  "@ttoss/test-utils": "^1.20.9",
34
- "@ttoss/ui": "^1.31.6",
34
+ "@ttoss/ui": "^1.31.7",
35
35
  "@types/jest": "^29.5.0",
36
36
  "jest": "^29.5.0",
37
37
  "react": "^18.2.0",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "ce34db105b7f475a90660d77b194d6ea33b71960"
44
+ "gitHead": "3d2d6ecf2c24eb734b162bfe8d73a7a2886c49f6"
45
45
  }
@@ -14,6 +14,7 @@ export const FormFieldCheckbox = <
14
14
  } & CheckboxProps) => {
15
15
  const {
16
16
  field: { onChange, onBlur, value, ref },
17
+ formState: { errors },
17
18
  } = useController<any>({
18
19
  name,
19
20
  defaultValue: false,
@@ -21,6 +22,8 @@ export const FormFieldCheckbox = <
21
22
 
22
23
  const id = `form-field-checkbox-${name}`;
23
24
 
25
+ const error = !!errors[name]?.message;
26
+
24
27
  return (
25
28
  <Box>
26
29
  <Flex sx={{ alignItems: 'center' }}>
@@ -32,6 +35,7 @@ export const FormFieldCheckbox = <
32
35
  onChange={onChange}
33
36
  onBlur={onBlur}
34
37
  name={name}
38
+ aria-invalid={error ? 'true' : 'false'}
35
39
  {...checkboxProps}
36
40
  />
37
41
  {label}