@rjsf/core 5.0.2 → 5.1.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/index.d.ts CHANGED
@@ -128,6 +128,9 @@ interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
128
128
  * Schema validation
129
129
  */
130
130
  transformErrors?: ErrorTransformer<T, S, F>;
131
+ /** If set to true, then the first field with an error will receive the focus when the form is submitted with errors
132
+ */
133
+ focusOnFirstError?: boolean;
131
134
  /**
132
135
  * _internalFormWrapper is currently used by the semantic-ui theme to provide a custom wrapper around `<Form />`
133
136
  * that supports the proper rendering of those themes. To use this prop, one must pass a component that takes two
@@ -279,6 +282,13 @@ declare class Form<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends F
279
282
  getRegistry(): Registry<T, S, F>;
280
283
  /** Provides a function that can be used to programmatically submit the `Form` */
281
284
  submit(): void;
285
+ /** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error
286
+ * field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that
287
+ * id is attempted to be found using the `formElement` ref. If it is located, then it is focused.
288
+ *
289
+ * @param error - The error on which to focus
290
+ */
291
+ focusOnError(error: RJSFValidationError): void;
282
292
  /** Programmatically validate the form. If `onError` is provided, then it will be called with the list of errors the
283
293
  * same way as would happen on form submission.
284
294
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjsf/core",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "description": "A simple React component capable of building HTML forms out of a JSON schema.",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && dts build --rollupTypes --format cjs,esm,umd",
@@ -48,13 +48,13 @@
48
48
  "@babel/plugin-proposal-class-properties": "^7.18.6",
49
49
  "@babel/plugin-proposal-optional-chaining": "^7.20.7",
50
50
  "@babel/plugin-transform-object-assign": "^7.18.6",
51
- "@babel/plugin-transform-react-jsx": "^7.20.7",
51
+ "@babel/plugin-transform-react-jsx": "^7.20.13",
52
52
  "@babel/preset-env": "^7.20.2",
53
53
  "@babel/preset-react": "^7.18.6",
54
54
  "@babel/register": "^7.18.9",
55
- "@rjsf/utils": "^5.0.2",
56
- "@rjsf/validator-ajv6": "^5.0.2",
57
- "@rjsf/validator-ajv8": "^5.0.2",
55
+ "@rjsf/utils": "^5.1.0",
56
+ "@rjsf/validator-ajv6": "^5.1.0",
57
+ "@rjsf/validator-ajv8": "^5.1.0",
58
58
  "@types/lodash": "^4.14.191",
59
59
  "@types/react": "^17.0.39",
60
60
  "@types/react-dom": "^17.0.11",
@@ -62,14 +62,14 @@
62
62
  "atob": "^2.1.2",
63
63
  "chai": "^3.3.0",
64
64
  "dts-cli": "^1.6.3",
65
- "eslint": "^8.31.0",
65
+ "eslint": "^8.33.0",
66
66
  "html": "^1.0.0",
67
67
  "jsdom": "^20.0.1",
68
68
  "mocha": "^10.2.0",
69
69
  "react": "^17.0.2",
70
70
  "react-dom": "^17.0.2",
71
71
  "react-portal": "^4.2.2",
72
- "rimraf": "^4.0.4",
72
+ "rimraf": "^4.1.2",
73
73
  "sinon": "^9.0.2"
74
74
  },
75
75
  "directories": {
@@ -93,5 +93,5 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "gitHead": "8fa3d2a7c18bc508ca5f61328400c5508238df82"
96
+ "gitHead": "6befd6731723b59564631f0475941403ec1c6fd2"
97
97
  }