@rjsf/primereact 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 (118) hide show
  1. package/dist/index.cjs +133 -118
  2. package/dist/index.cjs.map +3 -3
  3. package/dist/primereact.esm.js +147 -179
  4. package/dist/primereact.esm.js.map +3 -3
  5. package/dist/primereact.umd.js +130 -116
  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/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.d.ts +1 -1
  15. package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js +1 -1
  16. package/lib/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js.map +1 -1
  17. package/lib/AutoCompleteWidget/AutoCompleteWidget.d.ts +1 -1
  18. package/lib/AutoCompleteWidget/AutoCompleteWidget.js +6 -6
  19. package/lib/AutoCompleteWidget/AutoCompleteWidget.js.map +1 -1
  20. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
  21. package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
  22. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  23. package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
  24. package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
  25. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  26. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
  27. package/lib/CheckboxesWidget/CheckboxesWidget.js +5 -5
  28. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  29. package/lib/ColorWidget/ColorWidget.d.ts +1 -1
  30. package/lib/ColorWidget/ColorWidget.js +5 -5
  31. package/lib/ColorWidget/ColorWidget.js.map +1 -1
  32. package/lib/DescriptionField/DescriptionField.d.ts +1 -1
  33. package/lib/ErrorList/ErrorList.d.ts +1 -1
  34. package/lib/ErrorList/ErrorList.js +1 -1
  35. package/lib/ErrorList/ErrorList.js.map +1 -1
  36. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
  37. package/lib/FieldErrorTemplate/FieldErrorTemplate.js +2 -3
  38. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  39. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
  40. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  41. package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
  42. package/lib/FieldTemplate/FieldTemplate.js +1 -1
  43. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  44. package/lib/GridTemplate/GridTemplate.d.ts +1 -1
  45. package/lib/GridTemplate/GridTemplate.js +1 -1
  46. package/lib/GridTemplate/GridTemplate.js.map +1 -1
  47. package/lib/IconButton/IconButton.d.ts +15 -8
  48. package/lib/IconButton/IconButton.js +14 -6
  49. package/lib/IconButton/IconButton.js.map +1 -1
  50. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
  51. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
  52. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +1 -1
  53. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  54. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
  55. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
  56. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
  57. package/lib/PasswordWidget/PasswordWidget.d.ts +1 -1
  58. package/lib/PasswordWidget/PasswordWidget.js +5 -5
  59. package/lib/PasswordWidget/PasswordWidget.js.map +1 -1
  60. package/lib/PrimeForm/PrimeForm.d.ts +3 -3
  61. package/lib/PrimeForm/PrimeForm.js.map +1 -1
  62. package/lib/RadioWidget/RadioWidget.d.ts +1 -1
  63. package/lib/RadioWidget/RadioWidget.js +5 -5
  64. package/lib/RadioWidget/RadioWidget.js.map +1 -1
  65. package/lib/RangeWidget/RangeWidget.d.ts +1 -1
  66. package/lib/RangeWidget/RangeWidget.js +5 -5
  67. package/lib/RangeWidget/RangeWidget.js.map +1 -1
  68. package/lib/SelectWidget/SelectWidget.d.ts +1 -1
  69. package/lib/SelectWidget/SelectWidget.js +18 -18
  70. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  71. package/lib/SubmitButton/SubmitButton.d.ts +1 -1
  72. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  73. package/lib/Templates/Templates.d.ts +1 -1
  74. package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
  75. package/lib/Theme/Theme.d.ts +2 -2
  76. package/lib/TitleField/TitleField.d.ts +1 -1
  77. package/lib/TitleField/TitleField.js.map +1 -1
  78. package/lib/UpDownWidget/UpDownWidget.d.ts +1 -1
  79. package/lib/UpDownWidget/UpDownWidget.js +5 -6
  80. package/lib/UpDownWidget/UpDownWidget.js.map +1 -1
  81. package/lib/Widgets/Widgets.d.ts +1 -1
  82. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
  83. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
  84. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  85. package/lib/tsconfig.tsbuildinfo +1 -1
  86. package/package.json +8 -8
  87. package/src/AddButton/AddButton.tsx +2 -1
  88. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
  89. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -10
  90. package/src/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx +2 -8
  91. package/src/AutoCompleteWidget/AutoCompleteWidget.tsx +14 -18
  92. package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -19
  93. package/src/CheckboxWidget/CheckboxWidget.tsx +10 -18
  94. package/src/CheckboxesWidget/CheckboxesWidget.tsx +14 -13
  95. package/src/ColorWidget/ColorWidget.tsx +10 -16
  96. package/src/DescriptionField/DescriptionField.tsx +1 -1
  97. package/src/ErrorList/ErrorList.tsx +4 -3
  98. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +4 -4
  99. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
  100. package/src/FieldTemplate/FieldTemplate.tsx +2 -8
  101. package/src/GridTemplate/GridTemplate.tsx +2 -2
  102. package/src/IconButton/IconButton.tsx +18 -8
  103. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
  104. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -12
  105. package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
  106. package/src/PasswordWidget/PasswordWidget.tsx +10 -16
  107. package/src/PrimeForm/PrimeForm.ts +4 -3
  108. package/src/RadioWidget/RadioWidget.tsx +11 -13
  109. package/src/RangeWidget/RangeWidget.tsx +18 -18
  110. package/src/SelectWidget/SelectWidget.tsx +25 -28
  111. package/src/SubmitButton/SubmitButton.tsx +2 -1
  112. package/src/Templates/Templates.ts +1 -1
  113. package/src/TextareaWidget/TextareaWidget.tsx +2 -2
  114. package/src/Theme/Theme.ts +2 -2
  115. package/src/TitleField/TitleField.tsx +2 -1
  116. package/src/UpDownWidget/UpDownWidget.tsx +13 -18
  117. package/src/Widgets/Widgets.tsx +1 -1
  118. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +2 -9
@@ -1,12 +1,6 @@
1
- import { ChangeEvent } from 'react';
2
- import {
3
- ariaDescribedByIds,
4
- FormContextType,
5
- getInputProps,
6
- RJSFSchema,
7
- StrictRJSFSchema,
8
- WidgetProps,
9
- } from '@rjsf/utils';
1
+ import type { ChangeEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ import { ariaDescribedByIds, getInputProps } from '@rjsf/utils';
10
4
  import { ColorPicker } from 'primereact/colorpicker';
11
5
 
12
6
  /** The `ColorWidget` component renders a color picker.
@@ -36,10 +30,10 @@ export default function ColorWidget<T = any, S extends StrictRJSFSchema = RJSFSc
36
30
  const { inline } = options;
37
31
  const primeProps = (options.prime || {}) as object;
38
32
 
39
- const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>
40
- onChange(value === '' ? options.emptyValue : value);
41
- const _onBlur = () => onBlur && onBlur(id, value);
42
- const _onFocus = () => onFocus && onFocus(id, value);
33
+ const handleChange = ({ target: { value: newValue } }: ChangeEvent<HTMLInputElement>) =>
34
+ onChange(newValue === '' ? options.emptyValue : newValue);
35
+ const handleBlur = () => onBlur && onBlur(id, value);
36
+ const handleFocus = () => onFocus && onFocus(id, value);
43
37
 
44
38
  return (
45
39
  <ColorPicker
@@ -53,9 +47,9 @@ export default function ColorWidget<T = any, S extends StrictRJSFSchema = RJSFSc
53
47
  autoFocus={autofocus}
54
48
  disabled={disabled || readonly}
55
49
  value={value || ''}
56
- onChange={onChangeOverride || _onChange}
57
- onBlur={_onBlur}
58
- onFocus={_onFocus}
50
+ onChange={onChangeOverride || handleChange}
51
+ onBlur={handleBlur}
52
+ onFocus={handleFocus}
59
53
  aria-describedby={ariaDescribedByIds(id, !!schema.examples)}
60
54
  />
61
55
  );
@@ -1,5 +1,5 @@
1
1
  import { RichDescription } from '@rjsf/core';
2
- import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import type { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
3
 
4
4
  /** The `DescriptionField` is the template to use to render the description of a field
5
5
  *
@@ -1,4 +1,5 @@
1
- import { ErrorListProps, FormContextType, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';
1
+ import type { ErrorListProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { TranslatableString } from '@rjsf/utils';
2
3
  import { TimesCircleIcon } from 'primereact/icons/timescircle';
3
4
  import { Message } from 'primereact/message';
4
5
 
@@ -19,8 +20,8 @@ export default function ErrorList<T = any, S extends StrictRJSFSchema = RJSFSche
19
20
  <div className='p-message-summary'>{translateString(TranslatableString.ErrorsLabel)}</div>
20
21
  </div>
21
22
  <ul className='p-message-list'>
22
- {errors.map((error, index) => (
23
- <li key={`error-${index}`}>{error.stack}</li>
23
+ {errors.map((error) => (
24
+ <li key={error.stack}>{error.stack}</li>
24
25
  ))}
25
26
  </ul>
26
27
  </div>
@@ -1,4 +1,5 @@
1
- import { errorId, FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { errorId } from '@rjsf/utils';
2
3
  import { Message } from 'primereact/message';
3
4
 
4
5
  /** The `FieldErrorTemplate` component renders the errors local to the particular field
@@ -12,9 +13,8 @@ export default function FieldErrorTemplate<
12
13
  >({ errors, fieldPathId }: FieldErrorProps<T, S, F>) {
13
14
  if (errors && errors.length > 0) {
14
15
  const id = errorId(fieldPathId);
15
- const content = errors.map((error, i: number) => {
16
- return <div key={i}>{error}</div>;
17
- });
16
+ // oxlint-disable-next-line react/no-array-index-key
17
+ const content = errors.map((error, i: number) => <div key={i}>{error}</div>);
18
18
 
19
19
  return (
20
20
  <Message
@@ -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
 
4
5
  /** The `FieldHelpTemplate` component renders any help desired for a field
5
6
  *
@@ -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
 
10
4
  import { Label } from '../util';
11
5
 
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from 'react';
2
- import { GridTemplateProps } from '@rjsf/utils';
2
+ import type { GridTemplateProps } from '@rjsf/utils';
3
3
 
4
4
  const breakpoints = {
5
5
  xs: 0,
@@ -75,7 +75,7 @@ function GridTemplateColumn(props: GridTemplateProps) {
75
75
 
76
76
  useEffect(() => {
77
77
  if (typeof window === 'undefined') {
78
- return;
78
+ return () => {};
79
79
  }
80
80
 
81
81
  const handleResize = () => setBreakpoint(getBreakpoint(window.innerWidth));
@@ -1,5 +1,8 @@
1
- import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';
2
- import { Button, ButtonProps } from 'primereact/button';
1
+ import { memo } from 'react';
2
+ import type { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ import { TranslatableString } from '@rjsf/utils';
4
+ import type { ButtonProps } from 'primereact/button';
5
+ import { Button } from 'primereact/button';
3
6
 
4
7
  export type PrimeIconButtonProps<
5
8
  T = any,
@@ -7,14 +10,16 @@ export type PrimeIconButtonProps<
7
10
  F extends FormContextType = any,
8
11
  > = IconButtonProps<T, S, F> & Omit<ButtonProps, 'onClick'>;
9
12
 
10
- export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
13
+ function IconButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
11
14
  props: PrimeIconButtonProps<T, S, F>,
12
15
  ) {
13
16
  const { icon, iconType, uiSchema, registry, ...otherProps } = props;
14
17
  return <Button icon={`pi pi-${icon}`} rounded text severity='secondary' {...otherProps} />;
15
18
  }
19
+ const IconButton = memo(IconButtonFn) as typeof IconButtonFn;
20
+ export default IconButton;
16
21
 
17
- export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
22
+ function CopyButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
18
23
  props: PrimeIconButtonProps<T, S, F>,
19
24
  ) {
20
25
  const {
@@ -22,8 +27,9 @@ export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
22
27
  } = props;
23
28
  return <IconButton title={translateString(TranslatableString.CopyButton)} {...props} icon='copy' />;
24
29
  }
30
+ export const CopyButton = memo(CopyButtonFn) as typeof CopyButtonFn;
25
31
 
26
- export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
32
+ function MoveDownButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
27
33
  props: PrimeIconButtonProps<T, S, F>,
28
34
  ) {
29
35
  const {
@@ -31,8 +37,9 @@ export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema,
31
37
  } = props;
32
38
  return <IconButton title={translateString(TranslatableString.MoveDownButton)} {...props} icon='angle-down' />;
33
39
  }
40
+ export const MoveDownButton = memo(MoveDownButtonFn) as typeof MoveDownButtonFn;
34
41
 
35
- export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
42
+ function MoveUpButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
36
43
  props: PrimeIconButtonProps<T, S, F>,
37
44
  ) {
38
45
  const {
@@ -40,8 +47,9 @@ export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
40
47
  } = props;
41
48
  return <IconButton title={translateString(TranslatableString.MoveUpButton)} {...props} icon='angle-up' />;
42
49
  }
50
+ export const MoveUpButton = memo(MoveUpButtonFn) as typeof MoveUpButtonFn;
43
51
 
44
- export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
52
+ function RemoveButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
45
53
  props: PrimeIconButtonProps<T, S, F>,
46
54
  ) {
47
55
  const {
@@ -49,8 +57,9 @@ export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
49
57
  } = props;
50
58
  return <IconButton title={translateString(TranslatableString.RemoveButton)} {...props} icon='trash' />;
51
59
  }
60
+ export const RemoveButton = memo(RemoveButtonFn) as typeof RemoveButtonFn;
52
61
 
53
- export function ClearButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
62
+ function ClearButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
54
63
  props: PrimeIconButtonProps<T, S, F>,
55
64
  ) {
56
65
  const {
@@ -58,3 +67,4 @@ export function ClearButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
58
67
  } = props;
59
68
  return <IconButton title={translateString(TranslatableString.ClearButton)} {...props} icon='times' />;
60
69
  }
70
+ 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 { Fieldset } from 'primereact/fieldset';
3
3
 
4
4
  export default function MultiSchemaFieldTemplate<
@@ -1,15 +1,5 @@
1
- import {
2
- FormContextType,
3
- ObjectFieldTemplateProps,
4
- RJSFSchema,
5
- StrictRJSFSchema,
6
- canExpand,
7
- descriptionId,
8
- getTemplate,
9
- getUiOptions,
10
- titleId,
11
- buttonId,
12
- } from '@rjsf/utils';
1
+ import type { FormContextType, ObjectFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, buttonId } from '@rjsf/utils';
13
3
 
14
4
  /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
15
5
  * title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
@@ -1,4 +1,4 @@
1
- import { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
3
  import IconButton, { RemoveButton } from '../IconButton';
4
4
 
@@ -28,7 +28,8 @@ export default function OptionalDataControlsTemplate<
28
28
  style={{ height: '1.5rem', width: '1.5rem' }} // Shrink the button
29
29
  />
30
30
  );
31
- } else if (onRemoveClick) {
31
+ }
32
+ if (onRemoveClick) {
32
33
  return (
33
34
  <RemoveButton
34
35
  id={id}
@@ -1,12 +1,6 @@
1
- import { ChangeEvent } from 'react';
2
- import {
3
- ariaDescribedByIds,
4
- FormContextType,
5
- getInputProps,
6
- RJSFSchema,
7
- StrictRJSFSchema,
8
- WidgetProps,
9
- } from '@rjsf/utils';
1
+ import type { ChangeEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ import { ariaDescribedByIds, getInputProps } from '@rjsf/utils';
10
4
  import { Password } from 'primereact/password';
11
5
 
12
6
  /** The `PasswordWidget` renders a `Password` component
@@ -38,10 +32,10 @@ export default function PasswordWidget<
38
32
  const inputProps = getInputProps<T, S, F>(schema, type, options);
39
33
  const primeProps = (options.prime || {}) as object;
40
34
 
41
- const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>
42
- onChange(value === '' ? options.emptyValue : value);
43
- const _onBlur = () => onBlur && onBlur(id, value);
44
- const _onFocus = () => onFocus && onFocus(id, value);
35
+ const handleChange = ({ target: { value: newValue } }: ChangeEvent<HTMLInputElement>) =>
36
+ onChange(newValue === '' ? options.emptyValue : newValue);
37
+ const handleBlur = () => onBlur && onBlur(id, value);
38
+ const handleFocus = () => onFocus && onFocus(id, value);
45
39
 
46
40
  return (
47
41
  <Password
@@ -55,9 +49,9 @@ export default function PasswordWidget<
55
49
  disabled={disabled || readonly}
56
50
  value={value || ''}
57
51
  invalid={rawErrors.length > 0}
58
- onChange={onChangeOverride || _onChange}
59
- onBlur={_onBlur}
60
- onFocus={_onFocus}
52
+ onChange={onChangeOverride || handleChange}
53
+ onBlur={handleBlur}
54
+ onFocus={handleFocus}
61
55
  aria-describedby={ariaDescribedByIds(id, !!schema.examples)}
62
56
  pt={{ root: { style: { display: 'flex', flexDirection: 'column' } } }}
63
57
  />
@@ -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,3 +1,4 @@
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
1
2
  import {
2
3
  ariaDescribedByIds,
3
4
  enumOptionValueDecoder,
@@ -5,12 +6,9 @@ import {
5
6
  enumOptionsIsSelected,
6
7
  getOptionValueFormat,
7
8
  optionId,
8
- FormContextType,
9
- RJSFSchema,
10
- StrictRJSFSchema,
11
- WidgetProps,
12
9
  } from '@rjsf/utils';
13
- import { RadioButton, RadioButtonChangeEvent } from 'primereact/radiobutton';
10
+ import type { RadioButtonChangeEvent } from 'primereact/radiobutton';
11
+ import { RadioButton } from 'primereact/radiobutton';
14
12
 
15
13
  /** The `RadioWidget` is a widget for rendering a radio group.
16
14
  * It is typically used with a string property constrained with enum options.
@@ -25,28 +23,28 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
25
23
  const { enumOptions, enumDisabled, emptyValue } = options;
26
24
  const optionValueFormat = getOptionValueFormat(options);
27
25
 
28
- const _onChange = (e: RadioButtonChangeEvent) => {
26
+ const handleChange = (e: RadioButtonChangeEvent) => {
29
27
  onChange(enumOptionValueDecoder<S>(e.value, enumOptions, optionValueFormat, emptyValue));
30
28
  };
31
29
 
32
- const _onBlur = () => onBlur(id, value);
33
- const _onFocus = () => onFocus(id, value);
30
+ const handleBlur = () => onBlur(id, value);
31
+ const handleFocus = () => onFocus(id, value);
34
32
 
35
33
  return (
36
34
  <div style={{ display: 'flex', flexDirection: 'row', gap: '1rem' }}>
37
35
  {Array.isArray(enumOptions) &&
38
36
  enumOptions.map((option, index) => {
39
37
  const checked = enumOptionsIsSelected<S>(option.value, value);
40
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
38
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
41
39
  return (
42
- <div key={index} style={{ display: 'flex', alignItems: 'center' }}>
40
+ <div key={String(option.value)} style={{ display: 'flex', alignItems: 'center' }}>
43
41
  <RadioButton
44
42
  inputId={optionId(id, index)}
45
43
  name={htmlName || id}
46
44
  {...primeProps}
47
- onFocus={_onFocus}
48
- onBlur={_onBlur}
49
- onChange={_onChange}
45
+ onFocus={handleFocus}
46
+ onBlur={handleBlur}
47
+ onChange={handleChange}
50
48
  value={enumOptionValueEncoder(option.value, index, optionValueFormat)}
51
49
  checked={checked}
52
50
  disabled={disabled || itemDisabled || readonly}
@@ -1,6 +1,8 @@
1
- import { FocusEvent } from 'react';
2
- import { ariaDescribedByIds, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps, rangeSpec } from '@rjsf/utils';
3
- import { Slider, SliderChangeEvent } from 'primereact/slider';
1
+ import type { FocusEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ import { ariaDescribedByIds, rangeSpec } from '@rjsf/utils';
4
+ import type { SliderChangeEvent } from 'primereact/slider';
5
+ import { Slider } from 'primereact/slider';
4
6
 
5
7
  /** The `RangeWidget` component uses the `Slider` from PrimeReact, wrapping the result
6
8
  * in a div, with the value alongside it.
@@ -14,24 +16,22 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
14
16
  const primeProps = (options.prime || {}) as object;
15
17
  const sliderProps = { value, id, ...rangeSpec<S>(schema) };
16
18
 
17
- const _onChange = (e: SliderChangeEvent) => {
19
+ const handleChange = (e: SliderChangeEvent) => {
18
20
  onChange(e.value ?? options.emptyValue);
19
21
  };
20
- const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value);
21
- const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value);
22
+ const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value);
23
+ const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value);
22
24
 
23
25
  return (
24
- <>
25
- <Slider
26
- {...primeProps}
27
- disabled={disabled || readonly}
28
- onMouseDown={(e) => e.stopPropagation()}
29
- onChange={_onChange}
30
- onBlur={_onBlur}
31
- onFocus={_onFocus}
32
- {...sliderProps}
33
- aria-describedby={ariaDescribedByIds(id)}
34
- />
35
- </>
26
+ <Slider
27
+ {...primeProps}
28
+ disabled={disabled || readonly}
29
+ onMouseDown={(e) => e.stopPropagation()}
30
+ onChange={handleChange}
31
+ onBlur={handleBlur}
32
+ onFocus={handleFocus}
33
+ {...sliderProps}
34
+ aria-describedby={ariaDescribedByIds(id)}
35
+ />
36
36
  );
37
37
  }
@@ -1,14 +1,11 @@
1
- import { FocusEvent } from 'react';
1
+ import type { 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 { Dropdown } from 'primereact/dropdown';
14
11
  import { MultiSelect } from 'primereact/multiselect';
@@ -55,15 +52,15 @@ function SingleSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F
55
52
  const optionValueFormat = getOptionValueFormat(options);
56
53
  const primeProps = (options.prime || {}) as object;
57
54
 
58
- multiple = typeof multiple === 'undefined' ? false : multiple;
55
+ const isMultiple = typeof multiple === 'undefined' ? false : multiple;
59
56
 
60
- const emptyValue = multiple ? [] : '';
57
+ const emptyValue = isMultiple ? [] : '';
61
58
 
62
- const _onChange = (e: { value: any }) =>
59
+ const handleChange = (e: { value: any }) =>
63
60
  onChange(enumOptionValueDecoder<S>(e.value, enumOptions, optionValueFormat, optEmptyVal));
64
- const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
61
+ const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
65
62
  onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
66
- const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
63
+ const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
67
64
  onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
68
65
  const { ...dropdownRemainingProps } = dropdownProps;
69
66
 
@@ -72,15 +69,15 @@ function SingleSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F
72
69
  id={id}
73
70
  name={htmlName || id}
74
71
  {...primeProps}
75
- value={enumOptionSelectedValue<S>(value, enumOptions, !!multiple, optionValueFormat, emptyValue)}
76
- options={(enumOptions ?? []).map(({ value, label }, i: number) => ({
77
- label,
78
- value: enumOptionValueEncoder(value, i, optionValueFormat),
79
- disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
72
+ value={enumOptionSelectedValue<S>(value, enumOptions, isMultiple, optionValueFormat, emptyValue)}
73
+ options={(enumOptions ?? []).map(({ value: enumValue, label: enumLabel }, i: number) => ({
74
+ label: enumLabel,
75
+ value: enumOptionValueEncoder(enumValue, i, optionValueFormat),
76
+ disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue),
80
77
  }))}
81
- onChange={_onChange}
82
- onBlur={_onBlur}
83
- onFocus={_onFocus}
78
+ onChange={handleChange}
79
+ onBlur={handleBlur}
80
+ onFocus={handleFocus}
84
81
  placeholder={placeholder}
85
82
  disabled={disabled || readonly}
86
83
  autoFocus={autofocus}
@@ -110,11 +107,11 @@ function MultiSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
110
107
 
111
108
  const emptyValue = multiple ? [] : '';
112
109
 
113
- const _onChange = (e: { value: any }) =>
110
+ const handleChange = (e: { value: any }) =>
114
111
  onChange(enumOptionValueDecoder<S>(e.value, enumOptions, optionValueFormat, optEmptyVal));
115
- const _onBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
112
+ const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) =>
116
113
  onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
117
- const _onFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
114
+ const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) =>
118
115
  onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
119
116
 
120
117
  return (
@@ -123,14 +120,14 @@ function MultiSelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
123
120
  name={htmlName || id}
124
121
  {...primeProps}
125
122
  value={enumOptionSelectedValue<S>(value, enumOptions, multiple, optionValueFormat, emptyValue)}
126
- options={(enumOptions ?? []).map(({ value, label }, i: number) => ({
127
- label,
128
- value: enumOptionValueEncoder(value, i, optionValueFormat),
129
- disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value) !== -1,
123
+ options={(enumOptions ?? []).map(({ value: enumValue, label: enumLabel }, i: number) => ({
124
+ label: enumLabel,
125
+ value: enumOptionValueEncoder(enumValue, i, optionValueFormat),
126
+ disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue),
130
127
  }))}
131
- onChange={_onChange}
132
- onBlur={_onBlur}
133
- onFocus={_onFocus}
128
+ onChange={handleChange}
129
+ onBlur={handleBlur}
130
+ onFocus={handleFocus}
134
131
  placeholder={placeholder}
135
132
  disabled={disabled || readonly}
136
133
  autoFocus={autofocus}
@@ -1,4 +1,5 @@
1
- import { getSubmitButtonOptions, FormContextType, 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 'primereact/button';
3
4
 
4
5
  /** The `SubmitButton` renders a button that represents the `Submit` action on a form
@@ -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,5 @@
1
- import { ChangeEvent } from 'react';
2
- import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
1
+ import type { ChangeEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
3
  import { InputTextarea } from 'primereact/inputtextarea';
4
4
 
5
5
  /** The `TextareaWidget` is a widget for rendering input fields as textarea using PrimeReact.
@@ -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, titleId } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, TitleFieldProps } from '@rjsf/utils';
2
+ import { getUiOptions, titleId } from '@rjsf/utils';
2
3
  import { Divider } from 'primereact/divider';
3
4
 
4
5
  /** The `TitleField` is the template to use to render the title of a field
@@ -1,12 +1,7 @@
1
- import {
2
- ariaDescribedByIds,
3
- FormContextType,
4
- getInputProps,
5
- RJSFSchema,
6
- StrictRJSFSchema,
7
- WidgetProps,
8
- } from '@rjsf/utils';
9
- import { InputNumber, InputNumberChangeEvent } from 'primereact/inputnumber';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
2
+ import { ariaDescribedByIds, getInputProps } from '@rjsf/utils';
3
+ import type { InputNumberChangeEvent } from 'primereact/inputnumber';
4
+ import { InputNumber } from 'primereact/inputnumber';
10
5
 
11
6
  /** The `UpDownWidget` renders an input component for a number.
12
7
  *
@@ -36,9 +31,9 @@ export default function UpDownWidget<T = any, S extends StrictRJSFSchema = RJSFS
36
31
  const { showButtons, buttonLayout, useGrouping, minFractionDigits, maxFractionDigits, locale, currency } = options;
37
32
  const primeProps = (options.prime || {}) as object;
38
33
 
39
- const _onChange = (event: InputNumberChangeEvent) => onChange(event.value === null ? options.emptyValue : value);
40
- const _onBlur = () => onBlur && onBlur(id, value);
41
- const _onFocus = () => onFocus && onFocus(id, value);
34
+ const handleChange = (event: InputNumberChangeEvent) => onChange(event.value === null ? options.emptyValue : value);
35
+ const handleBlur = () => onBlur && onBlur(id, value);
36
+ const handleFocus = () => onFocus && onFocus(id, value);
42
37
 
43
38
  return (
44
39
  <InputNumber
@@ -46,24 +41,24 @@ export default function UpDownWidget<T = any, S extends StrictRJSFSchema = RJSFS
46
41
  name={id}
47
42
  {...primeProps}
48
43
  placeholder={placeholder}
49
- step={isNaN(Number(inputProps.step)) ? 1 : Number(inputProps.step)}
44
+ step={Number.isNaN(Number(inputProps.step)) ? 1 : Number(inputProps.step)}
50
45
  required={required}
51
46
  autoFocus={autofocus}
52
47
  disabled={disabled || readonly}
53
48
  style={buttonLayout === 'vertical' ? { width: '4em' } : {}}
54
49
  showButtons={typeof showButtons === 'undefined' ? true : !!showButtons}
55
- buttonLayout={(buttonLayout as any) ?? 'stacked'}
50
+ buttonLayout={buttonLayout ?? 'stacked'}
56
51
  useGrouping={!!useGrouping}
57
52
  minFractionDigits={minFractionDigits as number}
58
53
  maxFractionDigits={maxFractionDigits as number}
59
54
  locale={locale as string}
60
55
  mode={currency ? 'currency' : 'decimal'}
61
56
  currency={currency as string}
62
- value={isNaN(Number(value)) ? null : Number(value)}
57
+ value={Number.isNaN(Number(value)) ? null : Number(value)}
63
58
  invalid={rawErrors.length > 0}
64
- onChange={(onChangeOverride as any) || _onChange}
65
- onBlur={_onBlur}
66
- onFocus={_onFocus}
59
+ onChange={onChangeOverride || handleChange}
60
+ onBlur={handleBlur}
61
+ onFocus={handleFocus}
67
62
  aria-describedby={ariaDescribedByIds(id, !!schema.examples)}
68
63
  />
69
64
  );
@@ -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 AutoCompleteWidget from '../AutoCompleteWidget/AutoCompleteWidget';
4
4
  import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget';
@@ -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 { InputText } from 'primereact/inputtext';
11
4
 
12
5
  /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are