@rjsf/react-bootstrap 6.6.0 → 6.6.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 (98) hide show
  1. package/dist/index.cjs +83 -64
  2. package/dist/index.cjs.map +3 -3
  3. package/dist/react-bootstrap.esm.js +90 -102
  4. package/dist/react-bootstrap.esm.js.map +3 -3
  5. package/dist/react-bootstrap.umd.js +82 -64
  6. package/lib/AddButton/AddButton.d.ts +1 -1
  7. package/lib/AddButton/AddButton.js.map +1 -1
  8. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
  9. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
  10. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  11. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
  12. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
  13. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  14. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
  15. package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
  16. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  17. package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
  18. package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
  19. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  20. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
  21. package/lib/CheckboxesWidget/CheckboxesWidget.js +5 -5
  22. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  23. package/lib/DescriptionField/DescriptionField.d.ts +1 -1
  24. package/lib/ErrorList/ErrorList.d.ts +1 -1
  25. package/lib/ErrorList/ErrorList.js +1 -3
  26. package/lib/ErrorList/ErrorList.js.map +1 -1
  27. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
  28. package/lib/FieldErrorTemplate/FieldErrorTemplate.js +1 -3
  29. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  30. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
  31. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  32. package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
  33. package/lib/FieldTemplate/FieldTemplate.js +1 -1
  34. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  35. package/lib/Form/Form.d.ts +3 -3
  36. package/lib/Form/Form.js.map +1 -1
  37. package/lib/GridTemplate/GridTemplate.d.ts +1 -1
  38. package/lib/IconButton/IconButton.d.ts +15 -8
  39. package/lib/IconButton/IconButton.js +14 -6
  40. package/lib/IconButton/IconButton.js.map +1 -1
  41. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
  42. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
  43. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
  44. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  45. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
  46. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
  47. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
  48. package/lib/RadioWidget/RadioWidget.d.ts +1 -1
  49. package/lib/RadioWidget/RadioWidget.js +5 -5
  50. package/lib/RadioWidget/RadioWidget.js.map +1 -1
  51. package/lib/RangeWidget/RangeWidget.d.ts +1 -1
  52. package/lib/RangeWidget/RangeWidget.js +6 -6
  53. package/lib/RangeWidget/RangeWidget.js.map +1 -1
  54. package/lib/SelectWidget/SelectWidget.d.ts +1 -1
  55. package/lib/SelectWidget/SelectWidget.js +6 -8
  56. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  57. package/lib/SubmitButton/SubmitButton.d.ts +1 -1
  58. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  59. package/lib/Templates/Templates.d.ts +1 -1
  60. package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
  61. package/lib/TextareaWidget/TextareaWidget.js +4 -4
  62. package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
  63. package/lib/Theme/Theme.d.ts +2 -2
  64. package/lib/TitleField/TitleField.d.ts +1 -1
  65. package/lib/TitleField/TitleField.js.map +1 -1
  66. package/lib/Widgets/Widgets.d.ts +1 -1
  67. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
  68. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
  69. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  70. package/lib/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +8 -8
  72. package/src/AddButton/AddButton.tsx +2 -1
  73. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -9
  74. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +3 -10
  75. package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -19
  76. package/src/CheckboxWidget/CheckboxWidget.tsx +9 -18
  77. package/src/CheckboxesWidget/CheckboxesWidget.tsx +10 -13
  78. package/src/DescriptionField/DescriptionField.tsx +1 -1
  79. package/src/ErrorList/ErrorList.tsx +8 -8
  80. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +8 -8
  81. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
  82. package/src/FieldTemplate/FieldTemplate.tsx +2 -8
  83. package/src/Form/Form.tsx +4 -3
  84. package/src/GridTemplate/GridTemplate.tsx +1 -1
  85. package/src/IconButton/IconButton.tsx +18 -8
  86. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
  87. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +4 -14
  88. package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
  89. package/src/RadioWidget/RadioWidget.tsx +11 -14
  90. package/src/RangeWidget/RangeWidget.tsx +9 -8
  91. package/src/SelectWidget/SelectWidget.tsx +15 -14
  92. package/src/SubmitButton/SubmitButton.tsx +2 -1
  93. package/src/Templates/Templates.ts +1 -1
  94. package/src/TextareaWidget/TextareaWidget.tsx +10 -9
  95. package/src/Theme/Theme.tsx +2 -2
  96. package/src/TitleField/TitleField.tsx +2 -1
  97. package/src/Widgets/Widgets.ts +1 -1
  98. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +2 -9
@@ -1,4 +1,5 @@
1
- import { FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema, errorId } from '@rjsf/utils';
1
+ import type { FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { errorId } from '@rjsf/utils';
2
3
  import ListGroup from 'react-bootstrap/ListGroup';
3
4
 
4
5
  /** The `FieldErrorTemplate` component renders the errors local to the particular field
@@ -18,13 +19,12 @@ export default function FieldErrorTemplate<
18
19
 
19
20
  return (
20
21
  <ListGroup as='ul' id={id}>
21
- {errors.map((error, i) => {
22
- return (
23
- <ListGroup.Item as='li' key={i} className='border-0 m-0 p-0'>
24
- <small className='m-0 text-danger'>{error}</small>
25
- </ListGroup.Item>
26
- );
27
- })}
22
+ {errors.map((error, i) => (
23
+ // oxlint-disable-next-line react/no-array-index-key
24
+ <ListGroup.Item as='li' key={i} className='border-0 m-0 p-0'>
25
+ <small className='m-0 text-danger'>{error}</small>
26
+ </ListGroup.Item>
27
+ ))}
28
28
  </ListGroup>
29
29
  );
30
30
  }
@@ -1,5 +1,6 @@
1
1
  import { RichHelp } from '@rjsf/core';
2
- import { FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema, helpId } from '@rjsf/utils';
2
+ import type { FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ import { helpId } from '@rjsf/utils';
3
4
  import Form from 'react-bootstrap/Form';
4
5
 
5
6
  /** The `FieldHelpTemplate` component renders any help desired for a field
@@ -1,11 +1,5 @@
1
- import {
2
- FieldTemplateProps,
3
- FormContextType,
4
- getTemplate,
5
- getUiOptions,
6
- RJSFSchema,
7
- StrictRJSFSchema,
8
- } from '@rjsf/utils';
1
+ import type { FieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { getTemplate, getUiOptions } from '@rjsf/utils';
9
3
  import Form from 'react-bootstrap/Form';
10
4
 
11
5
  export default function FieldTemplate<
package/src/Form/Form.tsx CHANGED
@@ -1,6 +1,7 @@
1
- import { ComponentType } from 'react';
2
- import { withTheme, FormProps } from '@rjsf/core';
3
- import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { ComponentType } from 'react';
2
+ import type { FormProps } from '@rjsf/core';
3
+ import { withTheme } from '@rjsf/core';
4
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
4
5
 
5
6
  import { generateTheme } from '../Theme';
6
7
 
@@ -1,4 +1,4 @@
1
- import { GridTemplateProps } from '@rjsf/utils';
1
+ import type { GridTemplateProps } from '@rjsf/utils';
2
2
  import Col from 'react-bootstrap/Col';
3
3
  import Row from 'react-bootstrap/Row';
4
4
 
@@ -1,10 +1,13 @@
1
+ import { memo } from 'react';
1
2
  import { AiOutlineArrowDown } from '@react-icons/all-files/ai/AiOutlineArrowDown';
2
3
  import { AiOutlineArrowUp } from '@react-icons/all-files/ai/AiOutlineArrowUp';
3
4
  import { IoIosCopy } from '@react-icons/all-files/io/IoIosCopy';
4
5
  import { IoIosRemove } from '@react-icons/all-files/io/IoIosRemove';
5
6
  import { IoMdClose } from '@react-icons/all-files/io/IoMdClose';
6
- import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';
7
- import Button, { ButtonProps } from 'react-bootstrap/Button';
7
+ import type { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
8
+ import { TranslatableString } from '@rjsf/utils';
9
+ import type { ButtonProps } from 'react-bootstrap/Button';
10
+ import Button from 'react-bootstrap/Button';
8
11
 
9
12
  export type BootstrapIconButtonProps<
10
13
  T = any,
@@ -12,7 +15,7 @@ export type BootstrapIconButtonProps<
12
15
  F extends FormContextType = any,
13
16
  > = IconButtonProps<T, S, F> & ButtonProps;
14
17
 
15
- export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
18
+ function IconButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
16
19
  props: BootstrapIconButtonProps<T, S, F>,
17
20
  ) {
18
21
  const { icon, iconType, className, uiSchema, registry, ...otherProps } = props;
@@ -22,8 +25,10 @@ export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSch
22
25
  </Button>
23
26
  );
24
27
  }
28
+ const IconButton = memo(IconButtonFn) as typeof IconButtonFn;
29
+ export default IconButton;
25
30
 
26
- export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
31
+ function CopyButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
27
32
  props: BootstrapIconButtonProps<T, S, F>,
28
33
  ) {
29
34
  const {
@@ -31,8 +36,9 @@ export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
31
36
  } = props;
32
37
  return <IconButton title={translateString(TranslatableString.CopyButton)} {...props} icon={<IoIosCopy />} />;
33
38
  }
39
+ export const CopyButton = memo(CopyButtonFn) as typeof CopyButtonFn;
34
40
 
35
- export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
41
+ function MoveDownButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
36
42
  props: BootstrapIconButtonProps<T, S, F>,
37
43
  ) {
38
44
  const {
@@ -42,8 +48,9 @@ export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema,
42
48
  <IconButton title={translateString(TranslatableString.MoveDownButton)} {...props} icon={<AiOutlineArrowDown />} />
43
49
  );
44
50
  }
51
+ export const MoveDownButton = memo(MoveDownButtonFn) as typeof MoveDownButtonFn;
45
52
 
46
- export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
53
+ function MoveUpButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
47
54
  props: BootstrapIconButtonProps<T, S, F>,
48
55
  ) {
49
56
  const {
@@ -51,8 +58,9 @@ export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
51
58
  } = props;
52
59
  return <IconButton title={translateString(TranslatableString.MoveUpButton)} {...props} icon={<AiOutlineArrowUp />} />;
53
60
  }
61
+ export const MoveUpButton = memo(MoveUpButtonFn) as typeof MoveUpButtonFn;
54
62
 
55
- export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
63
+ function RemoveButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
56
64
  props: BootstrapIconButtonProps<T, S, F>,
57
65
  ) {
58
66
  const {
@@ -67,8 +75,9 @@ export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
67
75
  />
68
76
  );
69
77
  }
78
+ export const RemoveButton = memo(RemoveButtonFn) as typeof RemoveButtonFn;
70
79
 
71
- export function ClearButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
80
+ function ClearButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
72
81
  props: BootstrapIconButtonProps<T, S, F>,
73
82
  ) {
74
83
  const {
@@ -76,3 +85,4 @@ export function ClearButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
76
85
  } = props;
77
86
  return <IconButton title={translateString(TranslatableString.ClearButton)} {...props} icon={<IoMdClose />} />;
78
87
  }
88
+ export const ClearButton = memo(ClearButtonFn) as typeof ClearButtonFn;
@@ -1,4 +1,4 @@
1
- import { FormContextType, MultiSchemaFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FormContextType, MultiSchemaFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
  import Card from 'react-bootstrap/Card';
3
3
 
4
4
  export default function MultiSchemaFieldTemplate<
@@ -1,15 +1,5 @@
1
- import {
2
- buttonId,
3
- canExpand,
4
- descriptionId,
5
- FormContextType,
6
- getTemplate,
7
- getUiOptions,
8
- ObjectFieldTemplateProps,
9
- RJSFSchema,
10
- StrictRJSFSchema,
11
- titleId,
12
- } from '@rjsf/utils';
1
+ import type { FormContextType, ObjectFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { buttonId, canExpand, descriptionId, getTemplate, getUiOptions, titleId } from '@rjsf/utils';
13
3
  import Col from 'react-bootstrap/Col';
14
4
  import Container from 'react-bootstrap/Container';
15
5
  import Row from 'react-bootstrap/Row';
@@ -69,8 +59,8 @@ export default function ObjectFieldTemplate<
69
59
  )}
70
60
  <Container fluid className='p-0'>
71
61
  {!showOptionalDataControlInTitle ? optionalDataControl : undefined}
72
- {properties.map((element: any, index: number) => (
73
- <Row key={index} style={{ marginBottom: '10px' }} className={element.hidden ? 'd-none' : undefined}>
62
+ {properties.map((element: any) => (
63
+ <Row key={element.name} style={{ marginBottom: '10px' }} className={element.hidden ? 'd-none' : undefined}>
74
64
  <Col xs={12}> {element.content}</Col>
75
65
  </Row>
76
66
  ))}
@@ -1,5 +1,5 @@
1
1
  import { BsPlus } from '@react-icons/all-files/bs/BsPlus';
2
- import { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import type { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
3
 
4
4
  import IconButton, { RemoveButton } from '../IconButton';
5
5
 
@@ -30,7 +30,8 @@ export default function OptionalDataControlsTemplate<
30
30
  variant='secondary'
31
31
  />
32
32
  );
33
- } else if (onRemoveClick) {
33
+ }
34
+ if (onRemoveClick) {
34
35
  return (
35
36
  <RemoveButton
36
37
  id={id}
@@ -1,4 +1,5 @@
1
- import { ChangeEvent, FocusEvent } from 'react';
1
+ import type { ChangeEvent, FocusEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
2
3
  import {
3
4
  ariaDescribedByIds,
4
5
  enumOptionValueDecoder,
@@ -6,10 +7,6 @@ import {
6
7
  enumOptionsIsSelected,
7
8
  getOptionValueFormat,
8
9
  optionId,
9
- FormContextType,
10
- RJSFSchema,
11
- StrictRJSFSchema,
12
- WidgetProps,
13
10
  } from '@rjsf/utils';
14
11
  import Form from 'react-bootstrap/Form';
15
12
 
@@ -28,11 +25,11 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
28
25
  const { enumOptions, enumDisabled, emptyValue } = options;
29
26
  const optionValueFormat = getOptionValueFormat(options);
30
27
 
31
- const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>
32
- onChange(enumOptionValueDecoder<S>(value, enumOptions, optionValueFormat, emptyValue));
33
- const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
28
+ const handleChange = ({ target: { value: enumValue } }: ChangeEvent<HTMLInputElement>) =>
29
+ onChange(enumOptionValueDecoder<S>(enumValue, enumOptions, optionValueFormat, emptyValue));
30
+ const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
34
31
  onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
35
- const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
32
+ const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
36
33
  onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
37
34
 
38
35
  const inline = Boolean(options && options.inline);
@@ -41,7 +38,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
41
38
  <Form.Group className='mb-0'>
42
39
  {Array.isArray(enumOptions) &&
43
40
  enumOptions.map((option, index) => {
44
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
41
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
45
42
  const checked = enumOptionsIsSelected<S>(option.value, value);
46
43
 
47
44
  const radio = (
@@ -49,16 +46,16 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
49
46
  inline={inline}
50
47
  label={option.label}
51
48
  id={optionId(id, index)}
52
- key={index}
49
+ key={String(option.value)}
53
50
  name={htmlName || id}
54
51
  type='radio'
55
52
  disabled={disabled || itemDisabled || readonly}
56
53
  checked={checked}
57
54
  required={required}
58
55
  value={enumOptionValueEncoder(option.value, index, optionValueFormat)}
59
- onChange={_onChange}
60
- onBlur={_onBlur}
61
- onFocus={_onFocus}
56
+ onChange={handleChange}
57
+ onBlur={handleBlur}
58
+ onFocus={handleFocus}
62
59
  aria-describedby={ariaDescribedByIds(id)}
63
60
  />
64
61
  );
@@ -1,5 +1,6 @@
1
- import { ChangeEvent, FocusEvent } from 'react';
2
- import { FormContextType, rangeSpec, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
1
+ import type { ChangeEvent, FocusEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ import { rangeSpec } from '@rjsf/utils';
3
4
  import FormRange from 'react-bootstrap/FormRange';
4
5
 
5
6
  export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
@@ -7,18 +8,18 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
7
8
  ) {
8
9
  const { id, value, disabled, onChange, onBlur, onFocus, schema } = props;
9
10
 
10
- const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) => onChange(value);
11
- const _onBlur = ({ target: { value } }: FocusEvent<HTMLInputElement>) => onBlur(id, value);
12
- const _onFocus = ({ target: { value } }: FocusEvent<HTMLInputElement>) => onFocus(id, value);
11
+ const handleChange = ({ target: { value: newValue } }: ChangeEvent<HTMLInputElement>) => onChange(newValue);
12
+ const handleBlur = ({ target: { value: newValue } }: FocusEvent<HTMLInputElement>) => onBlur(id, newValue);
13
+ const handleFocus = ({ target: { value: newValue } }: FocusEvent<HTMLInputElement>) => onFocus(id, newValue);
13
14
 
14
15
  const rangeProps = {
15
16
  value,
16
17
  id,
17
18
  name: id,
18
19
  disabled,
19
- onChange: _onChange,
20
- onBlur: _onBlur,
21
- onFocus: _onFocus,
20
+ onChange: handleChange,
21
+ onBlur: handleBlur,
22
+ onFocus: handleFocus,
22
23
  ...rangeSpec<S>(schema),
23
24
  };
24
25
 
@@ -1,14 +1,11 @@
1
- import { ChangeEvent, FocusEvent } from 'react';
1
+ import type { ChangeEvent, FocusEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
2
3
  import {
3
4
  ariaDescribedByIds,
4
5
  enumOptionSelectedValue,
5
6
  enumOptionValueDecoder,
6
7
  enumOptionValueEncoder,
7
8
  getOptionValueFormat,
8
- FormContextType,
9
- RJSFSchema,
10
- StrictRJSFSchema,
11
- WidgetProps,
12
9
  } from '@rjsf/utils';
13
10
  import FormSelect from 'react-bootstrap/FormSelect';
14
11
 
@@ -38,15 +35,14 @@ export default function SelectWidget<
38
35
  const emptyValue = multiple ? [] : '';
39
36
  const optionValueFormat = getOptionValueFormat(options);
40
37
 
41
- function getValue(event: FocusEvent | ChangeEvent | any, multiple?: boolean) {
42
- if (multiple) {
38
+ function getValue(event: FocusEvent | ChangeEvent | any, isMultiple?: boolean) {
39
+ if (isMultiple) {
43
40
  return [].slice
44
- .call(event.target.options as any)
41
+ .call(event.target.options)
45
42
  .filter((o: any) => o.selected)
46
43
  .map((o: any) => o.value);
47
- } else {
48
- return event.target.value;
49
44
  }
45
+ return event.target.value;
50
46
  }
51
47
  const selectValue = enumOptionSelectedValue<S>(value, enumOptions, !!multiple, optionValueFormat, emptyValue);
52
48
  const showPlaceholderOption = !multiple && schema.default === undefined;
@@ -82,11 +78,16 @@ export default function SelectWidget<
82
78
  aria-describedby={ariaDescribedByIds(id)}
83
79
  >
84
80
  {showPlaceholderOption && <option value=''>{placeholder}</option>}
85
- {(enumOptions as any).map(({ value, label }: any, i: number) => {
86
- const disabled: any = Array.isArray(enumDisabled) && (enumDisabled as any).indexOf(value) != -1;
81
+ {enumOptions?.map(({ value: enumValue, label: enumLabel }: any, i: number) => {
82
+ const isDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(enumValue);
87
83
  return (
88
- <option key={i} id={label} value={enumOptionValueEncoder(value, i, optionValueFormat)} disabled={disabled}>
89
- {label}
84
+ <option
85
+ key={String(enumValue)}
86
+ id={enumLabel}
87
+ value={enumOptionValueEncoder(enumValue, i, optionValueFormat)}
88
+ disabled={isDisabled}
89
+ >
90
+ {enumLabel}
90
91
  </option>
91
92
  );
92
93
  })}
@@ -1,4 +1,5 @@
1
- import { FormContextType, getSubmitButtonOptions, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
2
+ import { getSubmitButtonOptions } from '@rjsf/utils';
2
3
  import Button from 'react-bootstrap/Button';
3
4
 
4
5
  export default function SubmitButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
@@ -1,4 +1,4 @@
1
- import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
2
 
3
3
  import AddButton from '../AddButton';
4
4
  import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate';
@@ -1,5 +1,6 @@
1
- import { ChangeEvent, FocusEvent } from 'react';
2
- import { ariaDescribedByIds, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
1
+ import type { ChangeEvent, FocusEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ import { ariaDescribedByIds } from '@rjsf/utils';
3
4
  import FormControl from 'react-bootstrap/FormControl';
4
5
  import InputGroup from 'react-bootstrap/InputGroup';
5
6
 
@@ -29,10 +30,10 @@ export default function TextareaWidget<
29
30
  onChange,
30
31
  options,
31
32
  }: CustomWidgetProps<T, S, F>) {
32
- const _onChange = ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) =>
33
- onChange(value === '' ? options.emptyValue : value);
34
- const _onBlur = ({ target }: FocusEvent<HTMLTextAreaElement>) => onBlur(id, target && target.value);
35
- const _onFocus = ({ target }: FocusEvent<HTMLTextAreaElement>) => onFocus(id, target && target.value);
33
+ const handleChange = ({ target: { value: newValue } }: ChangeEvent<HTMLTextAreaElement>) =>
34
+ onChange(newValue === '' ? options.emptyValue : newValue);
35
+ const handleBlur = ({ target }: FocusEvent<HTMLTextAreaElement>) => onBlur(id, target && target.value);
36
+ const handleFocus = ({ target }: FocusEvent<HTMLTextAreaElement>) => onFocus(id, target && target.value);
36
37
 
37
38
  return (
38
39
  <InputGroup>
@@ -47,9 +48,9 @@ export default function TextareaWidget<
47
48
  required={required}
48
49
  autoFocus={autofocus}
49
50
  rows={options.rows || 5}
50
- onChange={_onChange}
51
- onBlur={_onBlur}
52
- onFocus={_onFocus}
51
+ onChange={handleChange}
52
+ onBlur={handleBlur}
53
+ onFocus={handleFocus}
53
54
  aria-describedby={ariaDescribedByIds(id)}
54
55
  />
55
56
  </InputGroup>
@@ -1,5 +1,5 @@
1
- import { ThemeProps } from '@rjsf/core';
2
- import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { ThemeProps } from '@rjsf/core';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
3
 
4
4
  import { generateTemplates } from '../Templates';
5
5
  import { generateWidgets } from '../Widgets';
@@ -1,4 +1,5 @@
1
- import { FormContextType, getUiOptions, RJSFSchema, StrictRJSFSchema, TitleFieldProps } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, TitleFieldProps } from '@rjsf/utils';
2
+ import { getUiOptions } from '@rjsf/utils';
2
3
  import Col from 'react-bootstrap/Col';
3
4
  import Container from 'react-bootstrap/Container';
4
5
  import Row from 'react-bootstrap/Row';
@@ -1,4 +1,4 @@
1
- import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
3
  import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget';
4
4
  import CheckboxWidget from '../CheckboxWidget/CheckboxWidget';
@@ -1,12 +1,5 @@
1
- import {
2
- ADDITIONAL_PROPERTY_FLAG,
3
- buttonId,
4
- FormContextType,
5
- RJSFSchema,
6
- StrictRJSFSchema,
7
- TranslatableString,
8
- WrapIfAdditionalTemplateProps,
9
- } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WrapIfAdditionalTemplateProps } from '@rjsf/utils';
2
+ import { ADDITIONAL_PROPERTY_FLAG, buttonId, TranslatableString } from '@rjsf/utils';
10
3
  import Col from 'react-bootstrap/Col';
11
4
  import Form from 'react-bootstrap/Form';
12
5
  import Row from 'react-bootstrap/Row';