@rjsf/core 4.2.2 → 5.0.0-beta.2

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 (78) hide show
  1. package/README.md +2 -2
  2. package/dist/components/Form.d.ts +274 -45
  3. package/dist/components/fields/ArrayField.d.ts +6 -51
  4. package/dist/components/fields/BooleanField.d.ts +7 -44
  5. package/dist/components/fields/MultiSchemaField.d.ts +42 -38
  6. package/dist/components/fields/NullField.d.ts +7 -5
  7. package/dist/components/fields/NumberField.d.ts +3 -46
  8. package/dist/components/fields/ObjectField.d.ts +71 -20
  9. package/dist/components/fields/SchemaField.d.ts +9 -38
  10. package/dist/components/fields/StringField.d.ts +6 -44
  11. package/dist/components/fields/index.d.ts +3 -26
  12. package/dist/components/templates/ArrayFieldDescriptionTemplate.d.ts +7 -0
  13. package/dist/components/templates/ArrayFieldItemTemplate.d.ts +6 -0
  14. package/dist/components/templates/ArrayFieldTemplate.d.ts +6 -0
  15. package/dist/components/templates/ArrayFieldTitleTemplate.d.ts +7 -0
  16. package/dist/components/templates/BaseInputTemplate.d.ts +8 -0
  17. package/dist/components/templates/ButtonTemplates/AddButton.d.ts +4 -0
  18. package/dist/components/templates/ButtonTemplates/IconButton.d.ts +5 -0
  19. package/dist/components/templates/ButtonTemplates/SubmitButton.d.ts +4 -0
  20. package/dist/components/templates/ButtonTemplates/index.d.ts +3 -0
  21. package/dist/components/templates/DescriptionField.d.ts +6 -0
  22. package/dist/components/templates/ErrorList.d.ts +6 -0
  23. package/dist/components/templates/FieldTemplate/FieldTemplate.d.ts +7 -0
  24. package/dist/components/templates/FieldTemplate/Label.d.ts +13 -0
  25. package/dist/components/templates/FieldTemplate/WrapIfAdditional.d.ts +12 -0
  26. package/dist/components/templates/FieldTemplate/index.d.ts +2 -0
  27. package/dist/components/templates/ObjectFieldTemplate.d.ts +8 -0
  28. package/dist/components/templates/TitleField.d.ts +6 -0
  29. package/dist/components/templates/UnsupportedField.d.ts +8 -0
  30. package/dist/components/templates/index.d.ts +3 -0
  31. package/dist/components/widgets/AltDateTimeWidget.d.ts +7 -21
  32. package/dist/components/widgets/AltDateWidget.d.ts +5 -21
  33. package/dist/components/widgets/CheckboxWidget.d.ts +7 -17
  34. package/dist/components/widgets/CheckboxesWidget.d.ts +7 -25
  35. package/dist/components/widgets/ColorWidget.d.ts +7 -15
  36. package/dist/components/widgets/DateTimeWidget.d.ts +7 -8
  37. package/dist/components/widgets/DateWidget.d.ts +7 -8
  38. package/dist/components/widgets/EmailWidget.d.ts +6 -8
  39. package/dist/components/widgets/FileWidget.d.ts +6 -18
  40. package/dist/components/widgets/HiddenWidget.d.ts +7 -11
  41. package/dist/components/widgets/PasswordWidget.d.ts +6 -8
  42. package/dist/components/widgets/RadioWidget.d.ts +7 -21
  43. package/dist/components/widgets/RangeWidget.d.ts +7 -8
  44. package/dist/components/widgets/SelectWidget.d.ts +7 -23
  45. package/dist/components/widgets/TextWidget.d.ts +6 -9
  46. package/dist/components/widgets/TextareaWidget.d.ts +10 -22
  47. package/dist/components/widgets/URLWidget.d.ts +6 -8
  48. package/dist/components/widgets/UpDownWidget.d.ts +6 -8
  49. package/dist/components/widgets/index.d.ts +3 -43
  50. package/dist/core.cjs.development.js +2947 -4606
  51. package/dist/core.cjs.development.js.map +1 -1
  52. package/dist/core.cjs.production.min.js +1 -1
  53. package/dist/core.cjs.production.min.js.map +1 -1
  54. package/dist/core.esm.js +2897 -4566
  55. package/dist/core.esm.js.map +1 -1
  56. package/dist/core.umd.development.js +4049 -0
  57. package/dist/core.umd.development.js.map +1 -0
  58. package/dist/core.umd.production.min.js +2 -0
  59. package/dist/core.umd.production.min.js.map +1 -0
  60. package/dist/getDefaultRegistry.d.ts +6 -0
  61. package/dist/index.d.ts +5 -70
  62. package/dist/withTheme.d.ts +7 -9
  63. package/package.json +41 -68
  64. package/dist/components/AddButton.d.ts +0 -5
  65. package/dist/components/ErrorList.d.ts +0 -1
  66. package/dist/components/IconButton.d.ts +0 -1
  67. package/dist/components/fields/DescriptionField.d.ts +0 -9
  68. package/dist/components/fields/TitleField.d.ts +0 -10
  69. package/dist/components/fields/UnsupportedField.d.ts +0 -14
  70. package/dist/components/widgets/BaseInput.d.ts +0 -23
  71. package/dist/components/widgets/SubmitButton.d.ts +0 -3
  72. package/dist/defaultRegistry.d.ts +0 -41
  73. package/dist/react-jsonschema-form.js +0 -26
  74. package/dist/react-jsonschema-form.js.map +0 -1
  75. package/dist/types.d.ts +0 -50
  76. package/dist/utils.d.ts +0 -81
  77. package/dist/validate.d.ts +0 -21
  78. package/index.d.ts +0 -500
package/dist/index.d.ts CHANGED
@@ -1,71 +1,6 @@
1
+ import Form, { FormProps, FormState, IChangeEvent } from "./components/Form";
2
+ import withTheme, { WithThemeProps } from "./withTheme";
3
+ import getDefaultRegistry from "./getDefaultRegistry";
4
+ export type { FormProps, FormState, IChangeEvent, WithThemeProps };
5
+ export { withTheme, getDefaultRegistry };
1
6
  export default Form;
2
- import withTheme from "./withTheme";
3
- export const utils: {
4
- getDefaultRegistry: typeof getDefaultRegistry;
5
- canExpand(schema: any, uiSchema: any, formData: any): any;
6
- getSchemaType(schema: any): any;
7
- getWidget(schema: any, widget: any, registeredWidgets?: {}): any;
8
- hasWidget(schema: any, widget: any, registeredWidgets?: {}): boolean;
9
- getDefaultFormState(_schema: any, formData: any, rootSchema?: {}, includeUndefinedValues?: boolean): any;
10
- mergeDefaultsWithFormData(defaults: any, formData: any): any;
11
- getUiOptions(uiSchema: any): {};
12
- getSubmitButtonOptions(uiSchema: any): any;
13
- getDisplayLabel(schema: any, uiSchema: any, rootSchema: any): any;
14
- isObject(thing: any): boolean;
15
- mergeObjects(obj1: any, obj2: any, concatArrays?: boolean): any;
16
- asNumber(value: any): any;
17
- orderProperties(properties: any, order: any): any;
18
- isConstant(schema: any): any;
19
- toConstant(schema: any): any;
20
- isSelect(_schema: any, rootSchema?: {}): boolean;
21
- isMultiSelect(schema: any, rootSchema?: {}): boolean;
22
- isFilesArray(schema: any, uiSchema: any, rootSchema?: {}): boolean;
23
- isFixedItems(schema: any): any;
24
- isCustomWidget(uiSchema: any): boolean;
25
- allowAdditionalItems(schema: any): boolean;
26
- optionsList(schema: any): any;
27
- findSchemaDefinition($ref: any, rootSchema?: {}): any;
28
- stubExistingAdditionalProperties(schema: any, rootSchema?: {}, formData?: {}): any;
29
- resolveSchema(schema: any, rootSchema?: {}, formData?: {}): any;
30
- retrieveSchema(schema: any, rootSchema?: {}, formData?: {}): any;
31
- mergeSchemas(obj1: any, obj2: any): any;
32
- deepEquals(a: any, b: any, ca?: any[], cb?: any[]): any;
33
- shouldRender(comp: any, nextProps: any, nextState: any): boolean;
34
- toIdSchema(schema: any, id: any, rootSchema: any, formData?: {}, idPrefix?: string, idSeparator?: string): any;
35
- toPathSchema(schema: any, name: string | undefined, rootSchema: any, formData?: {}): any;
36
- parseDateString(dateString: any, includeTime?: boolean): {
37
- year: number;
38
- month: number;
39
- day: number;
40
- hour: number;
41
- minute: number;
42
- second: number;
43
- };
44
- toDateString({ year, month, day, hour, minute, second }: {
45
- year: any;
46
- month: any;
47
- day: any;
48
- hour?: number | undefined;
49
- minute?: number | undefined;
50
- second?: number | undefined;
51
- }, time?: boolean): string;
52
- utcToLocal(jsonDate: any): string;
53
- localToUTC(dateString: any): string | undefined;
54
- pad(num: any, size: any): string;
55
- dataURItoBlob(dataURI: any): {
56
- blob: Blob;
57
- name: any;
58
- };
59
- rangeSpec(schema: any): {
60
- step: any;
61
- min: any;
62
- max: any;
63
- };
64
- getMatchingOption(formData: any, options: any, rootSchema: any): number;
65
- schemaRequiresTrueValue(schema: any): any;
66
- ADDITIONAL_PROPERTY_FLAG: "__additional_property";
67
- guessType: (value: any) => "array" | "string" | "null" | "boolean" | "number" | "object";
68
- };
69
- import Form from "./components/Form";
70
- import { getDefaultRegistry } from "./defaultRegistry";
71
- export { withTheme };
@@ -1,10 +1,8 @@
1
- export default withTheme;
2
- declare function withTheme(themeProps: any): React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
- declare namespace withTheme {
4
- export namespace propTypes {
5
- export const widgets: PropTypes.Requireable<object>;
6
- export const fields: PropTypes.Requireable<object>;
7
- }
8
- }
9
1
  import React from "react";
10
- import PropTypes from "prop-types";
2
+ import Form, { FormProps } from "./components/Form";
3
+ /** The properties for the `withTheme` function, essentially a subset of properties from the `FormProps` that can be
4
+ * overridden while creating a theme
5
+ */
6
+ export declare type WithThemeProps<T = any, F = any> = Pick<FormProps<T, F>, "fields" | "templates" | "widgets" | "_internalFormWrapper">;
7
+ /** A Higher-Order component that creates a wrapper around a `Form` with the overrides from the `WithThemeProps` */
8
+ export default function withTheme<T = any, F = any>(themeProps: WithThemeProps<T, F>): React.ForwardRefExoticComponent<FormProps<T, F> & React.RefAttributes<Form<T, F>>>;
package/package.json CHANGED
@@ -1,104 +1,74 @@
1
1
  {
2
2
  "name": "@rjsf/core",
3
- "version": "4.2.2",
3
+ "version": "5.0.0-beta.2",
4
4
  "description": "A simple React component capable of building HTML forms out of a JSON schema.",
5
5
  "scripts": {
6
- "build": "rimraf dist && tsdx build --format cjs,es && cross-env NODE_ENV=production BABEL_ENV=umd webpack --config webpack.config.dist.js",
7
- "cs-check": "prettier -l \"{src,test}/**/*.js\"",
8
- "cs-format": "prettier \"{src,test}/**/*.js\" --write",
6
+ "build": "rimraf dist && dts build --format cjs,esm,umd",
7
+ "cs-check": "prettier -l \"{src,test}/**/*.[jt]s?(x)\"",
8
+ "cs-format": "prettier \"{src,test}/**/*.[jt]s?(x)\" --write",
9
9
  "lint": "eslint src test",
10
10
  "precommit": "lint-staged",
11
11
  "publish-to-npm": "npm run build && npm publish",
12
- "start": "tsdx watch",
13
- "test": "tsdx test",
14
- "test:watch": "tsdx test --watch",
15
- "test:update": "tsdx test --u",
16
- "test-old": "cross-env BABEL_ENV=test NODE_ENV=test mocha --require @babel/register --require ./test/setup-jsdom.js test/**/*_test.js",
17
- "test-coverage": "tsdx test --coverage"
12
+ "start": "dts watch",
13
+ "test": "dts test",
14
+ "test:watch": "dts test --watch",
15
+ "test-coverage": "dts test --coverage"
18
16
  },
19
17
  "lint-staged": {
20
- "{src,test}/**/*.js": [
18
+ "{src,test}/**/*.[jt]s?(x)": [
21
19
  "eslint --fix",
22
20
  "prettier --write"
23
21
  ]
24
22
  },
25
23
  "main": "dist/index.js",
26
24
  "module": "dist/core.esm.js",
27
- "typings": "index.d.ts",
25
+ "typings": "dist/index.d.ts",
28
26
  "files": [
29
27
  "dist",
30
- "lib",
31
- "index.d.ts"
28
+ "lib"
32
29
  ],
33
30
  "engineStrict": false,
34
31
  "engines": {
35
- "node": ">=12"
32
+ "node": ">=14"
36
33
  },
37
34
  "peerDependencies": {
38
- "react": ">=16 || >=17"
35
+ "@rjsf/utils": "^5.0.0-beta.1",
36
+ "react": "^16.14.0 || >=17"
39
37
  },
40
38
  "dependencies": {
41
- "@types/json-schema": "^7.0.7",
42
- "ajv": "^6.7.0",
43
- "core-js-pure": "^3.6.5",
44
- "json-schema-merge-allof": "^0.6.0",
45
- "jsonpointer": "^5.0.0",
46
39
  "lodash": "^4.17.15",
47
40
  "lodash-es": "^4.17.15",
48
- "nanoid": "^3.1.23",
49
- "prop-types": "^15.7.2",
50
- "react-is": "16.9.0"
41
+ "nanoid": "^3.3.4",
42
+ "prop-types": "^15.7.2"
51
43
  },
52
44
  "devDependencies": {
53
- "@babel/cli": "^7.4.4",
54
- "@babel/core": "^7.4.5",
55
- "@babel/plugin-proposal-class-properties": "^7.4.4",
56
- "@babel/plugin-proposal-optional-chaining": "^7.8.3",
57
- "@babel/plugin-transform-object-assign": "^7.8.3",
58
- "@babel/plugin-transform-react-jsx": "^7.3.0",
59
- "@babel/preset-env": "^7.4.5",
60
- "@babel/preset-react": "^7.0.0",
61
- "@babel/register": "^7.4.4",
45
+ "@babel/cli": "^7.18.10",
46
+ "@babel/core": "^7.18.13",
47
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
48
+ "@babel/plugin-proposal-optional-chaining": "^7.18.9",
49
+ "@babel/plugin-transform-object-assign": "^7.18.6",
50
+ "@babel/plugin-transform-react-jsx": "^7.18.10",
51
+ "@babel/preset-env": "^7.18.10",
52
+ "@babel/preset-react": "^7.18.6",
53
+ "@babel/register": "^7.18.9",
54
+ "@rjsf/utils": "^5.0.0-beta.2",
55
+ "@rjsf/validator-ajv6": "^5.0.0-beta.2",
56
+ "@types/lodash": "^4.14.184",
62
57
  "@types/react": "^17.0.39",
63
58
  "@types/react-dom": "^17.0.11",
64
- "@typescript-eslint/eslint-plugin": "^5.18.0",
65
- "@typescript-eslint/parser": "^5.18.0",
66
- "atob": "^2.0.3",
67
- "babel-loader": "^8.0.6",
59
+ "ajv": "^6.7.0",
60
+ "atob": "^2.1.2",
68
61
  "chai": "^3.3.0",
69
- "concurrently": "^5.1.0",
70
- "cross-env": "^7.0.2",
71
- "css-loader": "^0.23.1",
72
- "eslint": "^8.13.0",
73
- "eslint-plugin-flowtype": "^8.0.3",
74
- "eslint-plugin-import": "^2.26.0",
75
- "eslint-plugin-jsx-a11y": "^6.5.1",
76
- "eslint-plugin-react": "^7.29.4",
77
- "estraverse": "^4.2.0",
78
- "estraverse-fb": "^1.3.1",
79
- "express": "^4.14.0",
80
- "gh-pages": "^0.11.0",
62
+ "dts-cli": "^1.6.0",
63
+ "eslint": "^8.23.0",
81
64
  "html": "^1.0.0",
82
- "husky": "^0.13.2",
83
65
  "jsdom": "^16.5.3",
84
- "json-loader": "^0.5.7",
85
- "lint-staged": "^10.1.3",
86
- "loader-utils": "^1.2.3",
87
- "mini-css-extract-plugin": "^0.4.3",
88
66
  "mocha": "^5.2.0",
89
- "nyc": "^13.2.0",
90
- "prettier": "^1.15.1",
91
- "react": "^16.9.0",
92
- "react-dom": "^16.9.0",
93
- "react-portal": "^4.2.0",
94
- "react-transform-catch-errors": "^1.0.0",
95
- "react-transform-hmr": "^1.0.1",
96
- "redbox-react": "^1.3.3",
97
- "rimraf": "^2.5.4",
98
- "sinon": "^9.0.2",
99
- "style-loader": "^2.0.0",
100
- "webpack-dev-middleware": "^3.4.0",
101
- "webpack-hot-middleware": "^2.13.2"
67
+ "react": "^17.0.2",
68
+ "react-dom": "^17.0.2",
69
+ "react-portal": "^4.2.2",
70
+ "rimraf": "^3.0.2",
71
+ "sinon": "^9.0.2"
102
72
  },
103
73
  "directories": {
104
74
  "test": "test"
@@ -108,6 +78,9 @@
108
78
  "url": "git+https://github.com/rjsf-team/react-jsonschema-form.git"
109
79
  },
110
80
  "author": "Nicolas Perriault <nperriault@mozilla.com>",
81
+ "contributors": [
82
+ "Heath Chiavettone <heath.chiavettone@freenome.com"
83
+ ],
111
84
  "keywords": [
112
85
  "react",
113
86
  "form",
@@ -118,5 +91,5 @@
118
91
  "publishConfig": {
119
92
  "access": "public"
120
93
  },
121
- "gitHead": "e4f1545e7a658ad6a0de476682131680c04982f9"
94
+ "gitHead": "97bda160aeca8684770da6f3fed5b01b3828a1fa"
122
95
  }
@@ -1,5 +0,0 @@
1
- export default function AddButton({ className, onClick, disabled }: {
2
- className: any;
3
- onClick: any;
4
- disabled: any;
5
- }): JSX.Element;
@@ -1 +0,0 @@
1
- export default function ErrorList(props: any): JSX.Element;
@@ -1 +0,0 @@
1
- export default function IconButton(props: any): JSX.Element;
@@ -1,9 +0,0 @@
1
- export default DescriptionField;
2
- declare function DescriptionField(props: any): JSX.Element | null;
3
- declare namespace DescriptionField {
4
- export namespace propTypes {
5
- export const id: PropTypes.Requireable<string>;
6
- export const description: PropTypes.Requireable<string | PropTypes.ReactElementLike>;
7
- }
8
- }
9
- import PropTypes from "prop-types";
@@ -1,10 +0,0 @@
1
- export default TitleField;
2
- declare function TitleField(props: any): JSX.Element;
3
- declare namespace TitleField {
4
- export namespace propTypes {
5
- export const id: PropTypes.Requireable<string>;
6
- export const title: PropTypes.Requireable<string>;
7
- export const required: PropTypes.Requireable<boolean>;
8
- }
9
- }
10
- import PropTypes from "prop-types";
@@ -1,14 +0,0 @@
1
- export default UnsupportedField;
2
- declare function UnsupportedField({ schema, idSchema, reason }: {
3
- schema: any;
4
- idSchema: any;
5
- reason: any;
6
- }): JSX.Element;
7
- declare namespace UnsupportedField {
8
- export namespace propTypes {
9
- export const schema: PropTypes.Validator<object>;
10
- export const idSchema: PropTypes.Requireable<object>;
11
- export const reason: PropTypes.Requireable<string>;
12
- }
13
- }
14
- import PropTypes from "prop-types";
@@ -1,23 +0,0 @@
1
- export default BaseInput;
2
- declare function BaseInput(props: any): (JSX.Element | null)[];
3
- declare namespace BaseInput {
4
- export const defaultProps: {
5
- required: boolean;
6
- disabled: boolean;
7
- readonly: boolean;
8
- autofocus: boolean;
9
- };
10
- export const propTypes: {
11
- id: PropTypes.Validator<string>;
12
- placeholder: PropTypes.Requireable<string>;
13
- value: PropTypes.Requireable<any>;
14
- required: PropTypes.Requireable<boolean>;
15
- disabled: PropTypes.Requireable<boolean>;
16
- readonly: PropTypes.Requireable<boolean>;
17
- autofocus: PropTypes.Requireable<boolean>;
18
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
19
- onBlur: PropTypes.Requireable<(...args: any[]) => any>;
20
- onFocus: PropTypes.Requireable<(...args: any[]) => any>;
21
- };
22
- }
23
- import PropTypes from "prop-types";
@@ -1,3 +0,0 @@
1
- export default function SubmitButton({ uiSchema }: {
2
- uiSchema: any;
3
- }): JSX.Element;
@@ -1,41 +0,0 @@
1
- export function getDefaultRegistry(): {
2
- fields: {
3
- AnyOfField: typeof import("./components/fields/MultiSchemaField").default;
4
- ArrayField: typeof import("./components/fields/ArrayField").default;
5
- BooleanField: typeof import("./components/fields/BooleanField").default;
6
- DescriptionField: typeof import("./components/fields/DescriptionField").default;
7
- NumberField: typeof import("./components/fields/NumberField").default;
8
- ObjectField: typeof import("./components/fields/ObjectField").default;
9
- OneOfField: typeof import("./components/fields/MultiSchemaField").default;
10
- SchemaField: typeof import("./components/fields/SchemaField").default;
11
- StringField: typeof import("./components/fields/StringField").default;
12
- TitleField: typeof import("./components/fields/TitleField").default;
13
- NullField: typeof import("./components/fields/NullField").default;
14
- UnsupportedField: typeof import("./components/fields/UnsupportedField").default;
15
- };
16
- widgets: {
17
- BaseInput: typeof import("./components/widgets/BaseInput").default;
18
- PasswordWidget: typeof import("./components/widgets/PasswordWidget").default;
19
- RadioWidget: typeof import("./components/widgets/RadioWidget").default;
20
- UpDownWidget: typeof import("./components/widgets/UpDownWidget").default;
21
- RangeWidget: typeof import("./components/widgets/RangeWidget").default;
22
- SelectWidget: typeof import("./components/widgets/SelectWidget").default;
23
- TextWidget: typeof import("./components/widgets/TextWidget").default;
24
- DateWidget: typeof import("./components/widgets/DateWidget").default;
25
- DateTimeWidget: typeof import("./components/widgets/DateTimeWidget").default;
26
- AltDateWidget: typeof import("./components/widgets/AltDateWidget").default;
27
- AltDateTimeWidget: typeof import("./components/widgets/AltDateTimeWidget").default;
28
- EmailWidget: typeof import("./components/widgets/EmailWidget").default;
29
- URLWidget: typeof import("./components/widgets/URLWidget").default;
30
- TextareaWidget: typeof import("./components/widgets/TextareaWidget").default;
31
- HiddenWidget: typeof import("./components/widgets/HiddenWidget").default;
32
- ColorWidget: typeof import("./components/widgets/ColorWidget").default;
33
- FileWidget: typeof import("./components/widgets/FileWidget").default;
34
- CheckboxWidget: typeof import("./components/widgets/CheckboxWidget").default;
35
- CheckboxesWidget: typeof import("./components/widgets/CheckboxesWidget").default;
36
- SubmitButton: typeof import("./components/widgets/SubmitButton").default;
37
- };
38
- definitions: {};
39
- rootSchema: {};
40
- formContext: {};
41
- };