@rjsf/core 6.5.2 → 6.6.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.
Files changed (51) hide show
  1. package/dist/core.umd.js +267 -282
  2. package/dist/index.cjs +357 -372
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/index.esm.js +335 -348
  5. package/dist/index.esm.js.map +4 -4
  6. package/lib/components/Form.d.ts +3 -4
  7. package/lib/components/Form.d.ts.map +1 -1
  8. package/lib/components/Form.js +33 -26
  9. package/lib/components/RichDescription.js +1 -1
  10. package/lib/components/RichHelp.js +1 -1
  11. package/lib/components/fields/FallbackField.d.ts.map +1 -1
  12. package/lib/components/fields/FallbackField.js +1 -1
  13. package/lib/components/fields/LayoutGridField.js +1 -1
  14. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
  15. package/lib/components/fields/MultiSchemaField.js +1 -1
  16. package/lib/components/fields/ObjectField.js +1 -1
  17. package/lib/components/fields/SchemaField.d.ts.map +1 -1
  18. package/lib/components/fields/SchemaField.js +8 -3
  19. package/lib/components/fields/index.js +1 -1
  20. package/lib/components/templates/ButtonTemplates/index.js +1 -1
  21. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
  22. package/lib/components/templates/UnsupportedField.js +1 -1
  23. package/lib/components/templates/index.js +2 -2
  24. package/lib/components/widgets/FileWidget.d.ts.map +1 -1
  25. package/lib/components/widgets/FileWidget.js +3 -2
  26. package/lib/components/widgets/index.js +4 -4
  27. package/lib/index.d.ts +1 -1
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/index.js +1 -1
  30. package/lib/tsconfig.tsbuildinfo +1 -1
  31. package/lib/withTheme.d.ts +1 -1
  32. package/lib/withTheme.d.ts.map +1 -1
  33. package/package.json +17 -17
  34. package/src/components/Form.tsx +37 -53
  35. package/src/components/RichDescription.tsx +1 -1
  36. package/src/components/RichHelp.tsx +1 -1
  37. package/src/components/fields/FallbackField.tsx +1 -1
  38. package/src/components/fields/LayoutGridField.tsx +1 -1
  39. package/src/components/fields/MultiSchemaField.tsx +3 -3
  40. package/src/components/fields/ObjectField.tsx +1 -1
  41. package/src/components/fields/SchemaField.tsx +11 -2
  42. package/src/components/fields/index.ts +1 -1
  43. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  44. package/src/components/templates/FieldHelpTemplate.tsx +1 -0
  45. package/src/components/templates/UnsupportedField.tsx +1 -1
  46. package/src/components/templates/index.ts +2 -2
  47. package/src/components/widgets/FileWidget.tsx +3 -2
  48. package/src/components/widgets/index.ts +4 -4
  49. package/src/index.ts +1 -1
  50. package/src/tsconfig.json +0 -1
  51. package/src/withTheme.tsx +2 -1
@@ -1,6 +1,6 @@
1
1
  import { ComponentType } from 'react';
2
- import { FormProps } from './components/Form.js';
3
2
  import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ import { FormProps } from './components/Form.js';
4
4
  /** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be
5
5
  * overridden while creating a theme
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"withTheme.d.ts","sourceRoot":"","sources":["../src/withTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AAChE,OAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,IAAI,IAAI,CAC9G,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,sBAAsB,CAC5D,CAAC;AAEF,mHAAmH;AACnH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACjH,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC9B,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CA2BnC"}
1
+ {"version":3,"file":"withTheme.d.ts","sourceRoot":"","sources":["../src/withTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,IAAI,IAAI,CAC9G,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,sBAAsB,CAC5D,CAAC;AAEF,mHAAmH;AACnH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACjH,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC9B,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CA2BnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjsf/core",
3
- "version": "6.5.2",
3
+ "version": "6.6.0",
4
4
  "description": "A simple React component capable of building HTML forms out of a JSON schema.",
5
5
  "scripts": {
6
6
  "compileReplacer": "tsc -p tsconfig.replacer.json && move-file lodashReplacer.js lodashReplacer.cjs",
@@ -9,20 +9,21 @@
9
9
  "build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/index.esm.js --sourcemap --packages=external --format=esm",
10
10
  "build:umd": "rollup dist/index.esm.js --format=umd --file=dist/core.umd.js --name=JSONSchemaForm",
11
11
  "build": "npm run build:ts && npm run build:cjs && npm run build:esm && npm run build:umd",
12
- "cs-check": "prettier -l \"{src,test}/**/*.[jt]s?(x)\"",
13
- "cs-format": "prettier \"{src,test}/**/*.[jt]s?(x)\" --write",
14
- "lint": "eslint src test",
12
+ "cs-check": "oxfmt --check \"{src,test}/**/*.{ts,tsx,js,jsx}\"",
13
+ "cs-format": "oxfmt \"{src,test}/**/*.{ts,tsx,js,jsx}\"",
14
+ "lint": "oxlint src test",
15
15
  "precommit": "lint-staged",
16
16
  "publish-to-npm": "npm run build && npm publish",
17
- "test": "jest",
17
+ "test": "vitest run",
18
18
  "test:debug": "node --inspect-brk ../../node_modules/.bin/jest",
19
- "test:update": "jest --u",
20
- "test:watch": "jest --watch",
21
- "test-coverage": "jest --coverage"
19
+ "test:update": "vitest run --update-snapshots",
20
+ "test:watch": "vitest",
21
+ "test-coverage": "vitest run --coverage"
22
22
  },
23
23
  "lint-staged": {
24
- "{src,test}/**/*.[jt]s?(x)": [
25
- "eslint --fix"
24
+ "{src,test}/**/*.{ts,tsx,js,jsx}": [
25
+ "oxlint --fix",
26
+ "oxfmt"
26
27
  ]
27
28
  },
28
29
  "main": "dist/index.js",
@@ -72,21 +73,20 @@
72
73
  "dependencies": {
73
74
  "lodash": "^4.18.1",
74
75
  "lodash-es": "^4.18.1",
75
- "markdown-to-jsx": "^8.0.0",
76
+ "markdown-to-jsx": "^9.8.1",
76
77
  "prop-types": "^15.8.1"
77
78
  },
78
79
  "devDependencies": {
79
- "@rjsf/snapshot-tests": "6.5.2",
80
- "@rjsf/utils": "6.5.2",
81
- "@rjsf/validator-ajv8": "6.5.2",
80
+ "@rjsf/snapshot-tests": "6.6.0",
81
+ "@rjsf/utils": "6.6.0",
82
+ "@rjsf/validator-ajv8": "6.6.0",
82
83
  "@testing-library/jest-dom": "^6.9.1",
83
84
  "@testing-library/react": "^16.3.2",
84
85
  "@testing-library/user-event": "^14.6.1",
85
86
  "@types/react-portal": "^4.0.7",
86
- "ajv": "^8.18.0",
87
+ "ajv": "^8.20.0",
87
88
  "atob": "^2.1.2",
88
- "eslint": "^8.57.1",
89
- "jsdom": "^27.0.1",
89
+ "jsdom": "^29.1.1",
90
90
  "react-portal": "^4.3.0"
91
91
  },
92
92
  "directories": {
@@ -21,7 +21,6 @@ import {
21
21
  RegistryWidgetsType,
22
22
  RJSFSchema,
23
23
  RJSFValidationError,
24
- removeOptionalEmptyObjects,
25
24
  SchemaUtilsType,
26
25
  shouldRender,
27
26
  SUBMIT_BTN_OPTIONS_KEY,
@@ -45,6 +44,8 @@ import {
45
44
  NameGeneratorFunction,
46
45
  getUsedFormData,
47
46
  getFieldNames,
47
+ ANY_OF_KEY,
48
+ ONE_OF_KEY,
48
49
  } from '@rjsf/utils';
49
50
  import _cloneDeep from 'lodash/cloneDeep';
50
51
  import _get from 'lodash/get';
@@ -208,10 +209,9 @@ export interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
208
209
  * called. Set to `false` by default.
209
210
  */
210
211
  omitExtraData?: boolean;
211
- /** If set to true, optional object properties whose fields are all empty (undefined, null, or empty string)
212
- * will be automatically removed from formData. This prevents the scenario where interacting with fields inside
213
- * an optional object "activates" it permanently, making the form unsubmittable when the optional object has
214
- * required inner fields. This works independently of `omitExtraData`. Set to `false` by default.
212
+ /** This option no longer does anything as it has been co-opted into `omitExtraData`
213
+ *
214
+ * @deprecated - Will be removed in a future release use `omitExtraData` instead
215
215
  */
216
216
  removeEmptyOptionalObjects?: boolean;
217
217
  /** When this prop is set to `top` or 'bottom', a list of errors (or the custom error list defined in the `ErrorList`) will also
@@ -893,8 +893,7 @@ export default class Form<
893
893
  this._isProcessingUserChange = true;
894
894
  const { newValue, path, id } = this.pendingChanges[0];
895
895
  const { newErrorSchema } = this.pendingChanges[0];
896
- const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange, removeEmptyOptionalObjects } =
897
- this.props;
896
+ const { extraErrors, omitExtraData, liveOmit, noValidate, liveValidate, onChange } = this.props;
898
897
  const { formData: oldFormData, schemaUtils, schema, fieldPathId, schemaValidationErrorSchema, errors } = this.state;
899
898
  let { customErrors } = this.state;
900
899
  // Use the un-merged AJV-only schema as the base for re-merging extraErrors. Mirrors the
@@ -924,7 +923,33 @@ export default class Form<
924
923
  _unset(formData, path);
925
924
  } else if (!isRootPath) {
926
925
  // If the newValue is not on the root path, then set it into the form data
927
- _set(formData, path, newValue);
926
+ let unsetPath = false;
927
+ let valueForPath: T | null | undefined = newValue;
928
+
929
+ if (newValue === undefined) {
930
+ const lastSegment = path[path.length - 1];
931
+ if (typeof lastSegment === 'number') {
932
+ // Array items: match ArrayField `handleChange` — AJV needs `null`, not undefined.
933
+ valueForPath = null as unknown as T;
934
+ } else {
935
+ const { field } = schemaUtils.findFieldInSchema(schema, path, oldFormData);
936
+ const leaf = field as RJSFSchema | undefined;
937
+ const isOneOfOrAnyOfLeaf = leaf && (ONE_OF_KEY in leaf || ANY_OF_KEY in leaf);
938
+ // Plain leaves: omit the key instead of `{ key: undefined }`, which breaks `type: "string"` validation in
939
+ // AJV after clearing a text input (https://github.com/rjsf-team/react-jsonschema-form/issues/4518).
940
+ // oneOf/anyOf leaves and unresolved leaves: keep `valueForPath === newValue` (already `undefined`) so
941
+ // mergeDefaults does not immediately re-apply a branch default when clearing those widgets.
942
+ if (!isOneOfOrAnyOfLeaf && leaf !== undefined) {
943
+ unsetPath = true;
944
+ }
945
+ }
946
+ }
947
+
948
+ if (unsetPath) {
949
+ _unset(formData, path);
950
+ } else {
951
+ _set(formData, path, valueForPath);
952
+ }
928
953
  }
929
954
  // Pass true to skip live validation in `getStateFromProps()` since we will do it a bit later
930
955
  const newState = this.getStateFromProps(this.props, inputForDefaults, undefined, undefined, undefined, true);
@@ -943,19 +968,6 @@ export default class Form<
943
968
  };
944
969
  }
945
970
 
946
- if (removeEmptyOptionalObjects) {
947
- newFormData = removeOptionalEmptyObjects(
948
- schemaUtils.getValidator(),
949
- schema,
950
- schemaUtils.getRootSchema(),
951
- newFormData,
952
- ) as T;
953
- state = {
954
- ...state,
955
- formData: newFormData,
956
- };
957
- }
958
-
959
971
  if (newErrorSchema) {
960
972
  // First check to see if there is an existing validation error on this path...
961
973
  // @ts-expect-error TS2590, because getting from the error schema is confusing TS
@@ -1072,28 +1084,19 @@ export default class Form<
1072
1084
  * @param data - The data associated with the field that was blurred
1073
1085
  */
1074
1086
  onBlur = (id: string, data: any) => {
1075
- const { onBlur, omitExtraData, liveOmit, liveValidate, removeEmptyOptionalObjects } = this.props;
1087
+ const { onBlur, omitExtraData, liveOmit, liveValidate } = this.props;
1076
1088
  if (onBlur) {
1077
1089
  onBlur(id, data);
1078
1090
  }
1079
1091
  if ((omitExtraData === true && liveOmit === 'onBlur') || liveValidate === 'onBlur') {
1080
1092
  const { onChange, extraErrors } = this.props;
1081
- const { formData, schemaUtils, schema } = this.state;
1093
+ const { formData } = this.state;
1082
1094
  let newFormData: T | undefined = formData;
1083
1095
  let state: Partial<FormState<T, S, F>> = { formData: newFormData };
1084
1096
  if (omitExtraData === true && liveOmit === 'onBlur') {
1085
1097
  newFormData = this.omitExtraData(formData);
1086
1098
  state = { formData: newFormData };
1087
1099
  }
1088
- if (removeEmptyOptionalObjects) {
1089
- newFormData = removeOptionalEmptyObjects(
1090
- schemaUtils.getValidator(),
1091
- schema,
1092
- schemaUtils.getRootSchema(),
1093
- newFormData,
1094
- ) as T;
1095
- state = { ...state, formData: newFormData };
1096
- }
1097
1100
  if (liveValidate === 'onBlur') {
1098
1101
  const { schema, schemaUtils, errorSchema, customErrors, retrievedSchema } = this.state;
1099
1102
  const liveValidation = this.liveValidate(
@@ -1151,23 +1154,13 @@ export default class Form<
1151
1154
  }
1152
1155
 
1153
1156
  event.persist();
1154
- const { omitExtraData, extraErrors, noValidate, onSubmit, removeEmptyOptionalObjects } = this.props;
1157
+ const { omitExtraData, extraErrors, noValidate, onSubmit } = this.props;
1155
1158
  let { formData: newFormData } = this.state;
1156
1159
 
1157
1160
  if (omitExtraData === true) {
1158
1161
  newFormData = this.omitExtraData(newFormData);
1159
1162
  }
1160
1163
 
1161
- if (removeEmptyOptionalObjects) {
1162
- const { schemaUtils, schema } = this.state;
1163
- newFormData = removeOptionalEmptyObjects(
1164
- schemaUtils.getValidator(),
1165
- schema,
1166
- schemaUtils.getRootSchema(),
1167
- newFormData,
1168
- ) as T;
1169
- }
1170
-
1171
1164
  if (noValidate || this.validateFormWithFormData(newFormData)) {
1172
1165
  // There are no errors generated through schema validation.
1173
1166
  // Check for user provided errors and update state accordingly.
@@ -1351,20 +1344,11 @@ export default class Form<
1351
1344
  * @returns - True if the form is valid, false otherwise.
1352
1345
  */
1353
1346
  validateForm() {
1354
- const { omitExtraData, removeEmptyOptionalObjects } = this.props;
1347
+ const { omitExtraData } = this.props;
1355
1348
  let { formData: newFormData } = this.state;
1356
1349
  if (omitExtraData === true) {
1357
1350
  newFormData = this.omitExtraData(newFormData);
1358
1351
  }
1359
- if (removeEmptyOptionalObjects) {
1360
- const { schemaUtils, schema } = this.state;
1361
- newFormData = removeOptionalEmptyObjects(
1362
- schemaUtils.getValidator(),
1363
- schema,
1364
- schemaUtils.getRootSchema(),
1365
- newFormData,
1366
- ) as T;
1367
- }
1368
1352
  return this.validateFormWithFormData(newFormData);
1369
1353
  }
1370
1354
 
@@ -8,7 +8,7 @@ import {
8
8
  getTestIds,
9
9
  getUiOptions,
10
10
  } from '@rjsf/utils';
11
- import Markdown from 'markdown-to-jsx';
11
+ import { Markdown } from 'markdown-to-jsx/react';
12
12
 
13
13
  const TEST_IDS = getTestIds();
14
14
 
@@ -8,7 +8,7 @@ import {
8
8
  getTestIds,
9
9
  getUiOptions,
10
10
  } from '@rjsf/utils';
11
- import Markdown from 'markdown-to-jsx';
11
+ import { Markdown } from 'markdown-to-jsx/react';
12
12
 
13
13
  const TEST_IDS = getTestIds();
14
14
 
@@ -1,3 +1,4 @@
1
+ import { useMemo, useState } from 'react';
1
2
  import {
2
3
  FallbackFieldProps,
3
4
  FieldPathId,
@@ -11,7 +12,6 @@ import {
11
12
  TranslatableString,
12
13
  useDeepCompareMemo,
13
14
  } from '@rjsf/utils';
14
- import { useMemo, useState } from 'react';
15
15
  import { JSONSchema7TypeName } from 'json-schema';
16
16
 
17
17
  /**
@@ -32,8 +32,8 @@ import has from 'lodash/has';
32
32
  import includes from 'lodash/includes';
33
33
  import intersection from 'lodash/intersection';
34
34
  import isEmpty from 'lodash/isEmpty';
35
- import isFunction from 'lodash/isFunction';
36
35
  import isEqual from 'lodash/isEqual';
36
+ import isFunction from 'lodash/isFunction';
37
37
  import isObject from 'lodash/isObject';
38
38
  import isPlainObject from 'lodash/isPlainObject';
39
39
  import isString from 'lodash/isString';
@@ -1,7 +1,4 @@
1
1
  import { Component } from 'react';
2
- import get from 'lodash/get';
3
- import isEmpty from 'lodash/isEmpty';
4
- import omit from 'lodash/omit';
5
2
  import {
6
3
  ANY_OF_KEY,
7
4
  deepEquals,
@@ -21,6 +18,9 @@ import {
21
18
  TranslatableString,
22
19
  UiSchema,
23
20
  } from '@rjsf/utils';
21
+ import get from 'lodash/get';
22
+ import isEmpty from 'lodash/isEmpty';
23
+ import omit from 'lodash/omit';
24
24
 
25
25
  /** Type used for the state of the `AnyOfField` component */
26
26
  type AnyOfFieldState<S extends StrictRJSFSchema = RJSFSchema> = {
@@ -23,11 +23,11 @@ import {
23
23
  StrictRJSFSchema,
24
24
  TranslatableString,
25
25
  } from '@rjsf/utils';
26
- import Markdown from 'markdown-to-jsx';
27
26
  import get from 'lodash/get';
28
27
  import has from 'lodash/has';
29
28
  import isObject from 'lodash/isObject';
30
29
  import set from 'lodash/set';
30
+ import { Markdown } from 'markdown-to-jsx';
31
31
 
32
32
  import { ADDITIONAL_PROPERTY_KEY_REMOVE } from '../constants';
33
33
 
@@ -23,6 +23,7 @@ import {
23
23
  shouldRenderOptionalField,
24
24
  StrictRJSFSchema,
25
25
  toFieldPathId,
26
+ TranslatableString,
26
27
  UI_OPTIONS_KEY,
27
28
  UIOptionsType,
28
29
  } from '@rjsf/utils';
@@ -133,7 +134,11 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
133
134
  );
134
135
 
135
136
  const FieldComponent = getFieldComponent<T, S, F>(schema, uiOptions, registry);
136
- const disabled = Boolean(uiOptions.disabled ?? props.disabled);
137
+
138
+ const isDeprecated = Boolean(schema.deprecated);
139
+ const deprecatedHandling = isDeprecated ? (uiOptions.deprecatedHandling ?? 'label') : undefined;
140
+
141
+ const disabled = Boolean(uiOptions.disabled ?? props.disabled) || deprecatedHandling === 'disable';
137
142
  const readonly = Boolean(uiOptions.readonly ?? (props.readonly || props.schema.readOnly || schema.readOnly));
138
143
  const uiSchemaHideError = uiOptions.hideError;
139
144
  // Set hideError to the value provided in the uiSchema, otherwise stick with the prop to propagate to children
@@ -214,9 +219,13 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
214
219
  : uiOptions.title || props.schema.title || schema.title || props.title || name;
215
220
  }
216
221
 
222
+ if (deprecatedHandling === 'label') {
223
+ label = registry.translateString(TranslatableString.DeprecatedLabel, [label]);
224
+ }
225
+
217
226
  const description = uiOptions.description || props.schema.description || schema.description || '';
218
227
  const help = uiOptions.help;
219
- const hidden = uiOptions.widget === 'hidden';
228
+ const hidden = uiOptions.widget === 'hidden' || deprecatedHandling === 'hide';
220
229
 
221
230
  const classNames = ['rjsf-field', `rjsf-field-${getSchemaType(schema)}`];
222
231
  if (!hideError && __errors && __errors.length > 0) {
@@ -7,12 +7,12 @@ import LayoutGridField from './LayoutGridField';
7
7
  import LayoutHeaderField from './LayoutHeaderField';
8
8
  import LayoutMultiSchemaField from './LayoutMultiSchemaField';
9
9
  import MultiSchemaField from './MultiSchemaField';
10
+ import NullField from './NullField';
10
11
  import NumberField from './NumberField';
11
12
  import ObjectField from './ObjectField';
12
13
  import OptionalDataControlsField from './OptionalDataControlsField';
13
14
  import SchemaField from './SchemaField';
14
15
  import StringField from './StringField';
15
- import NullField from './NullField';
16
16
 
17
17
  function fields<
18
18
  T = any,
@@ -1,8 +1,8 @@
1
1
  import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
2
 
3
- import SubmitButton from './SubmitButton';
4
3
  import AddButton from './AddButton';
5
4
  import { CopyButton, MoveDownButton, MoveUpButton, RemoveButton, ClearButton } from './IconButton';
5
+ import SubmitButton from './SubmitButton';
6
6
 
7
7
  function buttonTemplates<
8
8
  T = any,
@@ -1,4 +1,5 @@
1
1
  import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+
2
3
  import RichHelp from '../RichHelp';
3
4
 
4
5
  /** The `FieldHelpTemplate` component renders any help desired for a field
@@ -1,5 +1,5 @@
1
1
  import { FormContextType, RJSFSchema, StrictRJSFSchema, TranslatableString, UnsupportedFieldProps } from '@rjsf/utils';
2
- import Markdown from 'markdown-to-jsx';
2
+ import { Markdown } from 'markdown-to-jsx';
3
3
 
4
4
  /** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by
5
5
  * react-jsonschema-form.
@@ -1,8 +1,8 @@
1
1
  import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
2
 
3
3
  import ArrayFieldDescriptionTemplate from './ArrayFieldDescriptionTemplate';
4
- import ArrayFieldItemTemplate from './ArrayFieldItemTemplate';
5
4
  import ArrayFieldItemButtonsTemplate from './ArrayFieldItemButtonsTemplate';
5
+ import ArrayFieldItemTemplate from './ArrayFieldItemTemplate';
6
6
  import ArrayFieldTemplate from './ArrayFieldTemplate';
7
7
  import ArrayFieldTitleTemplate from './ArrayFieldTitleTemplate';
8
8
  import BaseInputTemplate from './BaseInputTemplate';
@@ -10,9 +10,9 @@ import ButtonTemplates from './ButtonTemplates';
10
10
  import DescriptionField from './DescriptionField';
11
11
  import ErrorList from './ErrorList';
12
12
  import FallbackFieldTemplate from './FallbackFieldTemplate';
13
- import FieldTemplate from './FieldTemplate';
14
13
  import FieldErrorTemplate from './FieldErrorTemplate';
15
14
  import FieldHelpTemplate from './FieldHelpTemplate';
15
+ import FieldTemplate from './FieldTemplate';
16
16
  import GridTemplate from './GridTemplate';
17
17
  import MultiSchemaFieldTemplate from './MultiSchemaFieldTemplate';
18
18
  import ObjectFieldTemplate from './ObjectFieldTemplate';
@@ -11,7 +11,7 @@ import {
11
11
  useFileWidgetProps,
12
12
  WidgetProps,
13
13
  } from '@rjsf/utils';
14
- import Markdown from 'markdown-to-jsx';
14
+ import { Markdown } from 'markdown-to-jsx';
15
15
 
16
16
  function FileInfoPreview<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({
17
17
  fileInfo,
@@ -95,7 +95,8 @@ function FileWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
95
95
 
96
96
  const handleOnChangeEvent = (event: ChangeEvent<HTMLInputElement>) => {
97
97
  if (event.target.files) {
98
- handleChange(event.target.files);
98
+ // handleChange is async; DOM event handlers are void-returning, so we intentionally don't await
99
+ void handleChange(event.target.files);
99
100
  }
100
101
  };
101
102
 
@@ -1,12 +1,12 @@
1
1
  import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
- import AltDateWidget from './AltDateWidget';
4
3
  import AltDateTimeWidget from './AltDateTimeWidget';
5
- import CheckboxWidget from './CheckboxWidget';
4
+ import AltDateWidget from './AltDateWidget';
6
5
  import CheckboxesWidget from './CheckboxesWidget';
6
+ import CheckboxWidget from './CheckboxWidget';
7
7
  import ColorWidget from './ColorWidget';
8
- import DateWidget from './DateWidget';
9
8
  import DateTimeWidget from './DateTimeWidget';
9
+ import DateWidget from './DateWidget';
10
10
  import EmailWidget from './EmailWidget';
11
11
  import FileWidget from './FileWidget';
12
12
  import HiddenWidget from './HiddenWidget';
@@ -18,8 +18,8 @@ import SelectWidget from './SelectWidget';
18
18
  import TextareaWidget from './TextareaWidget';
19
19
  import TextWidget from './TextWidget';
20
20
  import TimeWidget from './TimeWidget';
21
- import URLWidget from './URLWidget';
22
21
  import UpDownWidget from './UpDownWidget';
22
+ import URLWidget from './URLWidget';
23
23
 
24
24
  function widgets<
25
25
  T = any,
package/src/index.ts CHANGED
@@ -2,9 +2,9 @@ import Form, { FormProps, FormState, IChangeEvent } from './components/Form';
2
2
  import RichDescription, { RichDescriptionProps } from './components/RichDescription';
3
3
  import RichHelp, { RichHelpProps } from './components/RichHelp';
4
4
  import SchemaExamples, { SchemaExamplesProps } from './components/SchemaExamples';
5
- import withTheme, { ThemeProps } from './withTheme';
6
5
  import getDefaultRegistry from './getDefaultRegistry';
7
6
  import getTestRegistry from './getTestRegistry';
7
+ import withTheme, { ThemeProps } from './withTheme';
8
8
 
9
9
  export type {
10
10
  FormProps,
package/src/tsconfig.json CHANGED
@@ -6,7 +6,6 @@
6
6
  "compilerOptions": {
7
7
  "rootDir": "./",
8
8
  "outDir": "../lib",
9
- "baseUrl": "../",
10
9
  "jsx": "react-jsx",
11
10
  "composite": true
12
11
  },
package/src/withTheme.tsx CHANGED
@@ -1,7 +1,8 @@
1
1
  import { ComponentType, ForwardedRef, forwardRef } from 'react';
2
- import Form, { FormProps } from './components/Form';
3
2
  import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
4
3
 
4
+ import Form, { FormProps } from './components/Form';
5
+
5
6
  /** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be
6
7
  * overridden while creating a theme
7
8
  */