@rjsf/react-bootstrap 6.0.0-alpha.0 → 6.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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +197 -238
  3. package/dist/index.js.map +4 -4
  4. package/dist/react-bootstrap.esm.js +123 -158
  5. package/dist/react-bootstrap.esm.js.map +4 -4
  6. package/dist/react-bootstrap.umd.js +55 -103
  7. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +2 -2
  8. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +5 -3
  9. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  10. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +2 -2
  11. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  12. package/lib/CheckboxWidget/CheckboxWidget.js +1 -1
  13. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  14. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  15. package/lib/DescriptionField/DescriptionField.d.ts +5 -1
  16. package/lib/DescriptionField/DescriptionField.js +9 -4
  17. package/lib/DescriptionField/DescriptionField.js.map +1 -1
  18. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  19. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  20. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  21. package/lib/GridTemplate/GridTemplate.d.ts +7 -0
  22. package/lib/GridTemplate/GridTemplate.js +16 -0
  23. package/lib/GridTemplate/GridTemplate.js.map +1 -0
  24. package/lib/GridTemplate/index.d.ts +2 -0
  25. package/lib/GridTemplate/index.js +3 -0
  26. package/lib/GridTemplate/index.js.map +1 -0
  27. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
  28. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  29. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  30. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  31. package/lib/Templates/Templates.js +2 -0
  32. package/lib/Templates/Templates.js.map +1 -1
  33. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -2
  34. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  35. package/lib/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +41 -34
  37. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +17 -64
  38. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +9 -7
  39. package/src/BaseInputTemplate/BaseInputTemplate.tsx +1 -1
  40. package/src/CheckboxWidget/CheckboxWidget.tsx +4 -7
  41. package/src/CheckboxesWidget/CheckboxesWidget.tsx +1 -1
  42. package/src/DescriptionField/DescriptionField.tsx +16 -11
  43. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +1 -1
  44. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +1 -1
  45. package/src/FieldTemplate/FieldTemplate.tsx +2 -2
  46. package/src/Form/Form.tsx +1 -1
  47. package/src/GridTemplate/GridTemplate.tsx +16 -0
  48. package/src/GridTemplate/index.ts +2 -0
  49. package/src/IconButton/IconButton.tsx +5 -5
  50. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +5 -3
  51. package/src/RangeWidget/RangeWidget.tsx +1 -1
  52. package/src/SelectWidget/SelectWidget.tsx +1 -1
  53. package/src/SubmitButton/SubmitButton.tsx +1 -1
  54. package/src/Templates/Templates.ts +3 -1
  55. package/src/TextareaWidget/TextareaWidget.tsx +1 -1
  56. package/src/Theme/Theme.tsx +1 -1
  57. package/src/Widgets/Widgets.ts +1 -1
  58. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +4 -2
  59. package/LICENSE.md +0 -201
package/package.json CHANGED
@@ -1,10 +1,38 @@
1
1
  {
2
2
  "name": "@rjsf/react-bootstrap",
3
- "version": "6.0.0-alpha.0",
3
+ "version": "6.0.0-beta.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
+ "type": "module",
7
8
  "description": "React Bootstrap theme, fields and widgets for react-jsonschema-form, powered by react-bootstrap",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./lib/index.d.ts",
12
+ "require": "./dist/index.js",
13
+ "import": "./lib/index.js"
14
+ },
15
+ "./lib": {
16
+ "types": "./lib/index.d.ts",
17
+ "require": "./dist/index.js",
18
+ "import": "./lib/index.js"
19
+ },
20
+ "./lib/*.js": {
21
+ "types": "./lib/*.d.ts",
22
+ "require": "./dist/*.js",
23
+ "import": "./lib/*.js"
24
+ },
25
+ "./dist": {
26
+ "types": "./lib/index.d.ts",
27
+ "require": "./dist/index.js",
28
+ "import": "./lib/index.js"
29
+ },
30
+ "./dist/*.js": {
31
+ "types": "./lib/*.d.ts",
32
+ "require": "./dist/*.js",
33
+ "import": "./lib/*.js"
34
+ }
35
+ },
8
36
  "files": [
9
37
  "dist",
10
38
  "lib",
@@ -15,7 +43,7 @@
15
43
  "url": "git+https://github.com/rjsf-team/react-jsonschema-form.git"
16
44
  },
17
45
  "scripts": {
18
- "build:ts": "tsc -b",
46
+ "build:ts": "tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
19
47
  "build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --sourcemap --packages=external --format=cjs",
20
48
  "build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/react-bootstrap.esm.js --sourcemap --packages=external --format=esm",
21
49
  "build:umd": "rollup dist/react-bootstrap.esm.js --format=umd --file=dist/react-bootstrap.umd.js --name=@rjsf/react-bootstrap",
@@ -33,42 +61,22 @@
33
61
  ]
34
62
  },
35
63
  "peerDependencies": {
36
- "@rjsf/core": "^5.20.x",
37
- "@rjsf/utils": "^5.20.x",
38
- "react": "^16.14.0 || >=17",
39
- "react-bootstrap": "^2.0.0"
64
+ "@rjsf/core": "^6.0.0-beta.x",
65
+ "@rjsf/utils": "^6.0.0-beta.x",
66
+ "react": ">=18",
67
+ "react-bootstrap": "^2.x"
40
68
  },
41
69
  "engineStrict": false,
42
70
  "engines": {
43
- "node": ">=14"
71
+ "node": ">=20"
44
72
  },
45
73
  "devDependencies": {
46
- "@babel/core": "^7.23.9",
47
- "@babel/plugin-proposal-class-properties": "^7.18.6",
48
- "@babel/plugin-proposal-optional-chaining": "^7.21.0",
49
- "@babel/preset-env": "^7.23.9",
50
- "@babel/preset-react": "^7.23.3",
51
- "@babel/preset-typescript": "^7.23.3",
52
- "@rjsf/core": "^6.0.0-alpha.0",
53
- "@rjsf/snapshot-tests": "^6.0.0-alpha.0",
54
- "@rjsf/utils": "^6.0.0-alpha.0",
55
- "@rjsf/validator-ajv8": "^6.0.0-alpha.0",
56
- "@types/jest": "^29.5.12",
57
- "@types/react": "^18.2.58",
58
- "@types/react-dom": "^18.2.19",
59
- "@types/react-test-renderer": "^18.0.7",
60
- "babel-jest": "^29.7.0",
61
- "esbuild": "^0.18.20",
74
+ "@rjsf/core": "^6.0.0-beta.2",
75
+ "@rjsf/snapshot-tests": "^6.0.0-beta.2",
76
+ "@rjsf/utils": "^6.0.0-beta.2",
77
+ "@rjsf/validator-ajv8": "^6.0.0-beta.2",
62
78
  "eslint": "^8.56.0",
63
- "jest": "^29.7.0",
64
- "jest-environment-jsdom": "^29.7.0",
65
- "react": "^18.2.0",
66
- "react-bootstrap": "^2.10.2",
67
- "react-dom": "^18.2.0",
68
- "react-test-renderer": "^18.2.0",
69
- "rimraf": "^5.0.5",
70
- "rollup": "^3.29.4",
71
- "typescript": "^4.9.5"
79
+ "react-bootstrap": "^2.10.9"
72
80
  },
73
81
  "publishConfig": {
74
82
  "access": "public"
@@ -93,6 +101,5 @@
93
101
  "license": "MIT",
94
102
  "dependencies": {
95
103
  "@react-icons/all-files": "^4.1.0"
96
- },
97
- "gitHead": "f4229bf6e067d31b24de3ef9d3ca754ee52529ac"
104
+ }
98
105
  }
@@ -1,30 +1,27 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import Row from 'react-bootstrap/Row';
3
3
  import Col from 'react-bootstrap/Col';
4
- import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
4
+ import {
5
+ ArrayFieldItemTemplateType,
6
+ FormContextType,
7
+ getTemplate,
8
+ getUiOptions,
9
+ RJSFSchema,
10
+ StrictRJSFSchema,
11
+ } from '@rjsf/utils';
5
12
 
6
13
  export default function ArrayFieldItemTemplate<
7
14
  T = any,
8
15
  S extends StrictRJSFSchema = RJSFSchema,
9
- F extends FormContextType = any
10
- >(props: ArrayFieldTemplateItemType<T, S, F>) {
11
- const {
12
- children,
13
- disabled,
14
- hasToolbar,
15
- hasCopy,
16
- hasMoveDown,
17
- hasMoveUp,
18
- hasRemove,
19
- index,
20
- onCopyIndexClick,
21
- onDropIndexClick,
22
- onReorderClick,
23
- readonly,
16
+ F extends FormContextType = any,
17
+ >(props: ArrayFieldItemTemplateType<T, S, F>) {
18
+ const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
19
+ const uiOptions = getUiOptions<T, S, F>(uiSchema);
20
+ const ArrayFieldItemButtonsTemplate = getTemplate<'ArrayFieldItemButtonsTemplate', T, S, F>(
21
+ 'ArrayFieldItemButtonsTemplate',
24
22
  registry,
25
- uiSchema,
26
- } = props;
27
- const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
23
+ uiOptions,
24
+ );
28
25
  const btnStyle: CSSProperties = {
29
26
  flex: 1,
30
27
  paddingLeft: 6,
@@ -40,51 +37,7 @@ export default function ArrayFieldItemTemplate<
40
37
  <Col xs='3' lg='3' className='py-4'>
41
38
  {hasToolbar && (
42
39
  <div className='d-flex flex-row'>
43
- {(hasMoveUp || hasMoveDown) && (
44
- <div className='m-0 p-0'>
45
- <MoveUpButton
46
- className='array-item-move-up'
47
- style={btnStyle}
48
- disabled={disabled || readonly || !hasMoveUp}
49
- onClick={onReorderClick(index, index - 1)}
50
- uiSchema={uiSchema}
51
- registry={registry}
52
- />
53
- </div>
54
- )}
55
- {(hasMoveUp || hasMoveDown) && (
56
- <div className='m-0 p-0'>
57
- <MoveDownButton
58
- style={btnStyle}
59
- disabled={disabled || readonly || !hasMoveDown}
60
- onClick={onReorderClick(index, index + 1)}
61
- uiSchema={uiSchema}
62
- registry={registry}
63
- />
64
- </div>
65
- )}
66
- {hasCopy && (
67
- <div className='m-0 p-0'>
68
- <CopyButton
69
- style={btnStyle}
70
- disabled={disabled || readonly}
71
- onClick={onCopyIndexClick(index)}
72
- uiSchema={uiSchema}
73
- registry={registry}
74
- />
75
- </div>
76
- )}
77
- {hasRemove && (
78
- <div className='m-0 p-0'>
79
- <RemoveButton
80
- style={btnStyle}
81
- disabled={disabled || readonly}
82
- onClick={onDropIndexClick(index)}
83
- uiSchema={uiSchema}
84
- registry={registry}
85
- />
86
- </div>
87
- )}
40
+ <ArrayFieldItemButtonsTemplate {...buttonsProps} style={btnStyle} />
88
41
  </div>
89
42
  )}
90
43
  </Col>
@@ -2,8 +2,9 @@ import Row from 'react-bootstrap/Row';
2
2
  import Col from 'react-bootstrap/Col';
3
3
  import Container from 'react-bootstrap/Container';
4
4
  import {
5
- ArrayFieldTemplateItemType,
5
+ ArrayFieldItemTemplateType,
6
6
  ArrayFieldTemplateProps,
7
+ buttonId,
7
8
  FormContextType,
8
9
  getTemplate,
9
10
  getUiOptions,
@@ -14,7 +15,7 @@ import {
14
15
  export default function ArrayFieldTemplate<
15
16
  T = any,
16
17
  S extends StrictRJSFSchema = RJSFSchema,
17
- F extends FormContextType = any
18
+ F extends FormContextType = any,
18
19
  >(props: ArrayFieldTemplateProps<T, S, F>) {
19
20
  const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } =
20
21
  props;
@@ -22,17 +23,17 @@ export default function ArrayFieldTemplate<
22
23
  const ArrayFieldDescriptionTemplate = getTemplate<'ArrayFieldDescriptionTemplate', T, S, F>(
23
24
  'ArrayFieldDescriptionTemplate',
24
25
  registry,
25
- uiOptions
26
+ uiOptions,
26
27
  );
27
28
  const ArrayFieldItemTemplate = getTemplate<'ArrayFieldItemTemplate', T, S, F>(
28
29
  'ArrayFieldItemTemplate',
29
30
  registry,
30
- uiOptions
31
+ uiOptions,
31
32
  );
32
33
  const ArrayFieldTitleTemplate = getTemplate<'ArrayFieldTitleTemplate', T, S, F>(
33
34
  'ArrayFieldTitleTemplate',
34
35
  registry,
35
- uiOptions
36
+ uiOptions,
36
37
  );
37
38
  // Button templates are not overridden in the uiSchema
38
39
  const {
@@ -59,7 +60,7 @@ export default function ArrayFieldTemplate<
59
60
  />
60
61
  <Container fluid key={`array-item-list-${idSchema.$id}`} className='p-0 m-0'>
61
62
  {items &&
62
- items.map(({ key, ...itemProps }: ArrayFieldTemplateItemType<T, S, F>) => (
63
+ items.map(({ key, ...itemProps }: ArrayFieldItemTemplateType<T, S, F>) => (
63
64
  <ArrayFieldItemTemplate key={key} {...itemProps} />
64
65
  ))}
65
66
  {canAdd && (
@@ -68,7 +69,8 @@ export default function ArrayFieldTemplate<
68
69
  <Col xs={9}></Col>
69
70
  <Col xs={3} className='py-4 col-lg-3 col-3'>
70
71
  <AddButton
71
- className='array-item-add'
72
+ id={buttonId<T>(idSchema, 'add')}
73
+ className='rjsf-array-item-add'
72
74
  onClick={onAddClick}
73
75
  disabled={disabled || readonly}
74
76
  uiSchema={uiSchema}
@@ -13,7 +13,7 @@ import {
13
13
  export default function BaseInputTemplate<
14
14
  T = any,
15
15
  S extends StrictRJSFSchema = RJSFSchema,
16
- F extends FormContextType = any
16
+ F extends FormContextType = any,
17
17
  >({
18
18
  id,
19
19
  placeholder,
@@ -15,7 +15,7 @@ import Form from 'react-bootstrap/Form';
15
15
  export default function CheckboxWidget<
16
16
  T = any,
17
17
  S extends StrictRJSFSchema = RJSFSchema,
18
- F extends FormContextType = any
18
+ F extends FormContextType = any,
19
19
  >(props: WidgetProps<T, S, F>) {
20
20
  const {
21
21
  id,
@@ -40,7 +40,7 @@ export default function CheckboxWidget<
40
40
  const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
41
41
  'DescriptionFieldTemplate',
42
42
  registry,
43
- options
43
+ options,
44
44
  );
45
45
 
46
46
  const _onChange = ({ target: { checked } }: FocusEvent<HTMLInputElement>) => onChange(checked);
@@ -49,11 +49,8 @@ export default function CheckboxWidget<
49
49
 
50
50
  const description = options.description || schema.description;
51
51
  return (
52
- <Form.Group
53
- className={`checkbox ${disabled || readonly ? 'disabled' : ''}`}
54
- aria-describedby={ariaDescribedByIds<T>(id)}
55
- >
56
- {!hideLabel && !!description && (
52
+ <Form.Group className={disabled || readonly ? 'disabled' : ''} aria-describedby={ariaDescribedByIds<T>(id)}>
53
+ {!hideLabel && description && (
57
54
  <DescriptionFieldTemplate
58
55
  id={descriptionId<T>(id)}
59
56
  description={description}
@@ -16,7 +16,7 @@ import {
16
16
  export default function CheckboxesWidget<
17
17
  T = any,
18
18
  S extends StrictRJSFSchema = RJSFSchema,
19
- F extends FormContextType = any
19
+ F extends FormContextType = any,
20
20
  >({ id, disabled, options, value, autofocus, readonly, required, onChange, onBlur, onFocus }: WidgetProps<T, S, F>) {
21
21
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
22
22
  const checkboxesValues = Array.isArray(value) ? value : [value];
@@ -1,19 +1,24 @@
1
1
  import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { RichDescription } from '@rjsf/core';
2
3
 
4
+ /** The `DescriptionField` is the template to use to render the description of a field
5
+ *
6
+ * @param props - The `DescriptionFieldProps` for this component
7
+ */
3
8
  export default function DescriptionField<
4
9
  T = any,
5
10
  S extends StrictRJSFSchema = RJSFSchema,
6
- F extends FormContextType = any
7
- >({ id, description }: DescriptionFieldProps<T, S, F>) {
8
- if (description) {
9
- return (
10
- <div>
11
- <div id={id} className='mb-3'>
12
- {description}
13
- </div>
14
- </div>
15
- );
11
+ F extends FormContextType = any,
12
+ >({ id, description, registry, uiSchema }: DescriptionFieldProps<T, S, F>) {
13
+ if (!description) {
14
+ return null;
16
15
  }
17
16
 
18
- return null;
17
+ return (
18
+ <div>
19
+ <div id={id} className='mb-3'>
20
+ <RichDescription description={description} registry={registry} uiSchema={uiSchema} />
21
+ </div>
22
+ </div>
23
+ );
19
24
  }
@@ -8,7 +8,7 @@ import ListGroup from 'react-bootstrap/ListGroup';
8
8
  export default function FieldErrorTemplate<
9
9
  T = any,
10
10
  S extends StrictRJSFSchema = RJSFSchema,
11
- F extends FormContextType = any
11
+ F extends FormContextType = any,
12
12
  >(props: FieldErrorProps<T, S, F>) {
13
13
  const { errors = [], idSchema } = props;
14
14
  if (errors.length === 0) {
@@ -8,7 +8,7 @@ import Form from 'react-bootstrap/Form';
8
8
  export default function FieldHelpTemplate<
9
9
  T = any,
10
10
  S extends StrictRJSFSchema = RJSFSchema,
11
- F extends FormContextType = any
11
+ F extends FormContextType = any,
12
12
  >(props: FieldHelpProps<T, S, F>) {
13
13
  const { idSchema, help, hasErrors } = props;
14
14
  if (!help) {
@@ -11,7 +11,7 @@ import Form from 'react-bootstrap/Form';
11
11
  export default function FieldTemplate<
12
12
  T = any,
13
13
  S extends StrictRJSFSchema = RJSFSchema,
14
- F extends FormContextType = any
14
+ F extends FormContextType = any,
15
15
  >({
16
16
  id,
17
17
  children,
@@ -38,7 +38,7 @@ export default function FieldTemplate<
38
38
  const WrapIfAdditionalTemplate = getTemplate<'WrapIfAdditionalTemplate', T, S, F>(
39
39
  'WrapIfAdditionalTemplate',
40
40
  registry,
41
- uiOptions
41
+ uiOptions,
42
42
  );
43
43
  if (hidden) {
44
44
  return <div className='hidden'>{children}</div>;
package/src/Form/Form.tsx CHANGED
@@ -7,7 +7,7 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
7
7
  export function generateForm<
8
8
  T = any,
9
9
  S extends StrictRJSFSchema = RJSFSchema,
10
- F extends FormContextType = any
10
+ F extends FormContextType = any,
11
11
  >(): ComponentType<FormProps<T, S, F>> {
12
12
  return withTheme<T, S, F>(generateTheme<T, S, F>());
13
13
  }
@@ -0,0 +1,16 @@
1
+ import Row from 'react-bootstrap/Row';
2
+ import Col from 'react-bootstrap/Col';
3
+ import { GridTemplateProps } from '@rjsf/utils';
4
+
5
+ /** Renders a `GridTemplate` for react-bootstrap, which is expecting the column sizing information coming in via the
6
+ * extra props provided by the caller, which are spread directly on the `Row`/`Col`.
7
+ *
8
+ * @param props - The GridTemplateProps, including the extra props containing the react-bootstrap grid positioning details
9
+ */
10
+ export default function GridTemplate(props: GridTemplateProps) {
11
+ const { children, column, ...rest } = props;
12
+ if (column) {
13
+ return <Col {...rest}>{children}</Col>;
14
+ }
15
+ return <Row {...rest}>{children}</Row>;
16
+ }
@@ -0,0 +1,2 @@
1
+ export { default } from './GridTemplate';
2
+ export * from './GridTemplate';
@@ -6,7 +6,7 @@ import { AiOutlineArrowUp } from '@react-icons/all-files/ai/AiOutlineArrowUp';
6
6
  import { AiOutlineArrowDown } from '@react-icons/all-files/ai/AiOutlineArrowDown';
7
7
 
8
8
  export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
9
- props: IconButtonProps<T, S, F> & ButtonProps
9
+ props: IconButtonProps<T, S, F> & ButtonProps,
10
10
  ) {
11
11
  const { icon, iconType, className, uiSchema, registry, ...otherProps } = props;
12
12
  return (
@@ -17,7 +17,7 @@ export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSch
17
17
  }
18
18
 
19
19
  export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
20
- props: IconButtonProps<T, S, F>
20
+ props: IconButtonProps<T, S, F>,
21
21
  ) {
22
22
  const {
23
23
  registry: { translateString },
@@ -26,7 +26,7 @@ export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
26
26
  }
27
27
 
28
28
  export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
29
- props: IconButtonProps<T, S, F>
29
+ props: IconButtonProps<T, S, F>,
30
30
  ) {
31
31
  const {
32
32
  registry: { translateString },
@@ -37,7 +37,7 @@ export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema,
37
37
  }
38
38
 
39
39
  export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
40
- props: IconButtonProps<T, S, F>
40
+ props: IconButtonProps<T, S, F>,
41
41
  ) {
42
42
  const {
43
43
  registry: { translateString },
@@ -46,7 +46,7 @@ export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
46
46
  }
47
47
 
48
48
  export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
49
- props: IconButtonProps<T, S, F>
49
+ props: IconButtonProps<T, S, F>,
50
50
  ) {
51
51
  const {
52
52
  registry: { translateString },
@@ -3,6 +3,7 @@ import Col from 'react-bootstrap/Col';
3
3
  import Container from 'react-bootstrap/Container';
4
4
 
5
5
  import {
6
+ buttonId,
6
7
  canExpand,
7
8
  descriptionId,
8
9
  FormContextType,
@@ -17,7 +18,7 @@ import {
17
18
  export default function ObjectFieldTemplate<
18
19
  T = any,
19
20
  S extends StrictRJSFSchema = RJSFSchema,
20
- F extends FormContextType = any
21
+ F extends FormContextType = any,
21
22
  >({
22
23
  description,
23
24
  title,
@@ -37,7 +38,7 @@ export default function ObjectFieldTemplate<
37
38
  const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
38
39
  'DescriptionFieldTemplate',
39
40
  registry,
40
- uiOptions
41
+ uiOptions,
41
42
  );
42
43
  // Button templates are not overridden in the uiSchema
43
44
  const {
@@ -74,9 +75,10 @@ export default function ObjectFieldTemplate<
74
75
  <Row>
75
76
  <Col xs={{ offset: 9, span: 3 }} className='py-4'>
76
77
  <AddButton
78
+ id={buttonId<T>(idSchema, 'add')}
77
79
  onClick={onAddClick(schema)}
78
80
  disabled={disabled || readonly}
79
- className='object-property-expand'
81
+ className='rjsf-object-property-expand'
80
82
  uiSchema={uiSchema}
81
83
  registry={registry}
82
84
  />
@@ -3,7 +3,7 @@ import { ChangeEvent, FocusEvent } from 'react';
3
3
  import FormRange from 'react-bootstrap/FormRange';
4
4
 
5
5
  export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
6
- props: WidgetProps<T, S, F>
6
+ props: WidgetProps<T, S, F>,
7
7
  ) {
8
8
  const { id, value, disabled, onChange, onBlur, onFocus, schema } = props;
9
9
 
@@ -13,7 +13,7 @@ import {
13
13
  export default function SelectWidget<
14
14
  T = any,
15
15
  S extends StrictRJSFSchema = RJSFSchema,
16
- F extends FormContextType = any
16
+ F extends FormContextType = any,
17
17
  >({
18
18
  schema,
19
19
  id,
@@ -2,7 +2,7 @@ import Button from 'react-bootstrap/Button';
2
2
  import { FormContextType, getSubmitButtonOptions, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
3
3
 
4
4
  export default function SubmitButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
5
- props: SubmitButtonProps<T, S, F>
5
+ props: SubmitButtonProps<T, S, F>,
6
6
  ) {
7
7
  const { submitText, norender, props: submitButtonProps } = getSubmitButtonOptions<T, S, F>(props.uiSchema);
8
8
  if (norender) {
@@ -8,6 +8,7 @@ import { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from '../IconB
8
8
  import FieldErrorTemplate from '../FieldErrorTemplate';
9
9
  import FieldHelpTemplate from '../FieldHelpTemplate';
10
10
  import FieldTemplate from '../FieldTemplate';
11
+ import GridTemplate from '../GridTemplate';
11
12
  import ObjectFieldTemplate from '../ObjectFieldTemplate';
12
13
  import SubmitButton from '../SubmitButton';
13
14
  import TitleField from '../TitleField';
@@ -17,7 +18,7 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@r
17
18
  export function generateTemplates<
18
19
  T = any,
19
20
  S extends StrictRJSFSchema = RJSFSchema,
20
- F extends FormContextType = any
21
+ F extends FormContextType = any,
21
22
  >(): Partial<TemplatesType<T, S, F>> {
22
23
  return {
23
24
  ArrayFieldItemTemplate,
@@ -36,6 +37,7 @@ export function generateTemplates<
36
37
  FieldErrorTemplate,
37
38
  FieldHelpTemplate,
38
39
  FieldTemplate,
40
+ GridTemplate,
39
41
  ObjectFieldTemplate,
40
42
  TitleFieldTemplate: TitleField,
41
43
  WrapIfAdditionalTemplate,
@@ -14,7 +14,7 @@ type CustomWidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
14
14
  export default function TextareaWidget<
15
15
  T = any,
16
16
  S extends StrictRJSFSchema = RJSFSchema,
17
- F extends FormContextType = any
17
+ F extends FormContextType = any,
18
18
  >({
19
19
  id,
20
20
  placeholder,
@@ -7,7 +7,7 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
7
7
  export function generateTheme<
8
8
  T = any,
9
9
  S extends StrictRJSFSchema = RJSFSchema,
10
- F extends FormContextType = any
10
+ F extends FormContextType = any,
11
11
  >(): ThemeProps<T, S, F> {
12
12
  return {
13
13
  templates: generateTemplates<T, S, F>(),
@@ -9,7 +9,7 @@ import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } fr
9
9
  export function generateWidgets<
10
10
  T = any,
11
11
  S extends StrictRJSFSchema = RJSFSchema,
12
- F extends FormContextType = any
12
+ F extends FormContextType = any,
13
13
  >(): RegistryWidgetsType<T, S, F> {
14
14
  return {
15
15
  CheckboxWidget,
@@ -1,6 +1,7 @@
1
1
  import { FocusEvent } from 'react';
2
2
  import {
3
3
  ADDITIONAL_PROPERTY_FLAG,
4
+ buttonId,
4
5
  FormContextType,
5
6
  RJSFSchema,
6
7
  StrictRJSFSchema,
@@ -15,7 +16,7 @@ import Form from 'react-bootstrap/Form';
15
16
  export default function WrapIfAdditionalTemplate<
16
17
  T = any,
17
18
  S extends StrictRJSFSchema = RJSFSchema,
18
- F extends FormContextType = any
19
+ F extends FormContextType = any,
19
20
  >({
20
21
  classNames,
21
22
  style,
@@ -67,7 +68,8 @@ export default function WrapIfAdditionalTemplate<
67
68
  <Col xs={5}>{children}</Col>
68
69
  <Col xs={2} className='py-4 d-grid gap-2'>
69
70
  <RemoveButton
70
- className='w-100'
71
+ id={buttonId<T>(id, 'remove')}
72
+ className='rjsf-object-property-remove w-100'
71
73
  disabled={disabled || readonly}
72
74
  onClick={onDropPropertyClick(label)}
73
75
  uiSchema={uiSchema}