@rjsf/core 6.6.1 → 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 (251) hide show
  1. package/dist/core.umd.js +454 -373
  2. package/dist/index.cjs +416 -334
  3. package/dist/index.cjs.map +3 -3
  4. package/dist/index.esm.js +418 -415
  5. package/dist/index.esm.js.map +3 -3
  6. package/lib/components/Form.d.ts +14 -11
  7. package/lib/components/Form.d.ts.map +1 -1
  8. package/lib/components/Form.js +97 -62
  9. package/lib/components/RichDescription.d.ts +2 -2
  10. package/lib/components/RichDescription.d.ts.map +1 -1
  11. package/lib/components/RichDescription.js +1 -1
  12. package/lib/components/RichHelp.d.ts +2 -2
  13. package/lib/components/RichHelp.d.ts.map +1 -1
  14. package/lib/components/RichHelp.js +1 -1
  15. package/lib/components/SchemaExamples.d.ts +1 -1
  16. package/lib/components/SchemaExamples.d.ts.map +1 -1
  17. package/lib/components/SchemaExamples.js +1 -3
  18. package/lib/components/fields/ArrayField.d.ts +1 -1
  19. package/lib/components/fields/ArrayField.d.ts.map +1 -1
  20. package/lib/components/fields/ArrayField.js +87 -88
  21. package/lib/components/fields/BooleanField.d.ts +1 -1
  22. package/lib/components/fields/BooleanField.d.ts.map +1 -1
  23. package/lib/components/fields/BooleanField.js +2 -5
  24. package/lib/components/fields/FallbackField.d.ts +1 -1
  25. package/lib/components/fields/FallbackField.d.ts.map +1 -1
  26. package/lib/components/fields/FallbackField.js +2 -2
  27. package/lib/components/fields/LayoutGridField.d.ts +7 -9
  28. package/lib/components/fields/LayoutGridField.d.ts.map +1 -1
  29. package/lib/components/fields/LayoutGridField.js +5 -4
  30. package/lib/components/fields/LayoutHeaderField.d.ts +1 -1
  31. package/lib/components/fields/LayoutHeaderField.d.ts.map +1 -1
  32. package/lib/components/fields/LayoutHeaderField.js +1 -1
  33. package/lib/components/fields/LayoutMultiSchemaField.d.ts +1 -1
  34. package/lib/components/fields/LayoutMultiSchemaField.d.ts.map +1 -1
  35. package/lib/components/fields/LayoutMultiSchemaField.js +4 -1
  36. package/lib/components/fields/MultiSchemaField.d.ts +9 -3
  37. package/lib/components/fields/MultiSchemaField.d.ts.map +1 -1
  38. package/lib/components/fields/MultiSchemaField.js +27 -9
  39. package/lib/components/fields/NullField.d.ts +1 -1
  40. package/lib/components/fields/NullField.d.ts.map +1 -1
  41. package/lib/components/fields/NumberField.d.ts +1 -1
  42. package/lib/components/fields/NumberField.d.ts.map +1 -1
  43. package/lib/components/fields/NumberField.js +7 -9
  44. package/lib/components/fields/ObjectField.d.ts +1 -1
  45. package/lib/components/fields/ObjectField.d.ts.map +1 -1
  46. package/lib/components/fields/ObjectField.js +27 -25
  47. package/lib/components/fields/OptionalDataControlsField.d.ts +1 -1
  48. package/lib/components/fields/OptionalDataControlsField.d.ts.map +1 -1
  49. package/lib/components/fields/SchemaField.d.ts +1 -1
  50. package/lib/components/fields/SchemaField.d.ts.map +1 -1
  51. package/lib/components/fields/SchemaField.js +7 -7
  52. package/lib/components/fields/StringField.d.ts +1 -1
  53. package/lib/components/fields/StringField.d.ts.map +1 -1
  54. package/lib/components/fields/StringField.js +2 -5
  55. package/lib/components/fields/index.d.ts +1 -1
  56. package/lib/components/fields/index.d.ts.map +1 -1
  57. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts +1 -1
  58. package/lib/components/templates/ArrayFieldDescriptionTemplate.d.ts.map +1 -1
  59. package/lib/components/templates/ArrayFieldDescriptionTemplate.js +1 -1
  60. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts +1 -1
  61. package/lib/components/templates/ArrayFieldItemButtonsTemplate.d.ts.map +1 -1
  62. package/lib/components/templates/ArrayFieldItemButtonsTemplate.js +1 -1
  63. package/lib/components/templates/ArrayFieldItemTemplate.d.ts +1 -1
  64. package/lib/components/templates/ArrayFieldItemTemplate.d.ts.map +1 -1
  65. package/lib/components/templates/ArrayFieldItemTemplate.js +1 -1
  66. package/lib/components/templates/ArrayFieldTemplate.d.ts +1 -1
  67. package/lib/components/templates/ArrayFieldTemplate.d.ts.map +1 -1
  68. package/lib/components/templates/ArrayFieldTemplate.js +1 -1
  69. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts +1 -1
  70. package/lib/components/templates/ArrayFieldTitleTemplate.d.ts.map +1 -1
  71. package/lib/components/templates/ArrayFieldTitleTemplate.js +1 -1
  72. package/lib/components/templates/BaseInputTemplate.d.ts +1 -1
  73. package/lib/components/templates/BaseInputTemplate.d.ts.map +1 -1
  74. package/lib/components/templates/BaseInputTemplate.js +7 -6
  75. package/lib/components/templates/ButtonTemplates/AddButton.d.ts +1 -1
  76. package/lib/components/templates/ButtonTemplates/AddButton.d.ts.map +1 -1
  77. package/lib/components/templates/ButtonTemplates/IconButton.d.ts +14 -7
  78. package/lib/components/templates/ButtonTemplates/IconButton.d.ts.map +1 -1
  79. package/lib/components/templates/ButtonTemplates/IconButton.js +14 -6
  80. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts +1 -1
  81. package/lib/components/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -1
  82. package/lib/components/templates/ButtonTemplates/index.d.ts +1 -1
  83. package/lib/components/templates/ButtonTemplates/index.d.ts.map +1 -1
  84. package/lib/components/templates/DescriptionField.d.ts +1 -1
  85. package/lib/components/templates/DescriptionField.d.ts.map +1 -1
  86. package/lib/components/templates/ErrorList.d.ts +1 -1
  87. package/lib/components/templates/ErrorList.d.ts.map +1 -1
  88. package/lib/components/templates/ErrorList.js +2 -4
  89. package/lib/components/templates/FallbackFieldTemplate.d.ts +1 -1
  90. package/lib/components/templates/FallbackFieldTemplate.d.ts.map +1 -1
  91. package/lib/components/templates/FieldErrorTemplate.d.ts +1 -1
  92. package/lib/components/templates/FieldErrorTemplate.d.ts.map +1 -1
  93. package/lib/components/templates/FieldErrorTemplate.js +1 -3
  94. package/lib/components/templates/FieldHelpTemplate.d.ts +1 -1
  95. package/lib/components/templates/FieldHelpTemplate.d.ts.map +1 -1
  96. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts +1 -1
  97. package/lib/components/templates/FieldTemplate/FieldTemplate.d.ts.map +1 -1
  98. package/lib/components/templates/FieldTemplate/FieldTemplate.js +1 -1
  99. package/lib/components/templates/FieldTemplate/Label.d.ts +2 -2
  100. package/lib/components/templates/FieldTemplate/Label.d.ts.map +1 -1
  101. package/lib/components/templates/GridTemplate.d.ts +1 -1
  102. package/lib/components/templates/GridTemplate.d.ts.map +1 -1
  103. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts +1 -1
  104. package/lib/components/templates/MultiSchemaFieldTemplate.d.ts.map +1 -1
  105. package/lib/components/templates/ObjectFieldTemplate.d.ts +1 -1
  106. package/lib/components/templates/ObjectFieldTemplate.d.ts.map +1 -1
  107. package/lib/components/templates/ObjectFieldTemplate.js +1 -1
  108. package/lib/components/templates/OptionalDataControlsTemplate.d.ts +1 -1
  109. package/lib/components/templates/OptionalDataControlsTemplate.d.ts.map +1 -1
  110. package/lib/components/templates/OptionalDataControlsTemplate.js +1 -1
  111. package/lib/components/templates/TitleField.d.ts +1 -1
  112. package/lib/components/templates/TitleField.d.ts.map +1 -1
  113. package/lib/components/templates/UnsupportedField.d.ts +1 -1
  114. package/lib/components/templates/UnsupportedField.d.ts.map +1 -1
  115. package/lib/components/templates/UnsupportedField.js +1 -1
  116. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts +1 -1
  117. package/lib/components/templates/WrapIfAdditionalTemplate.d.ts.map +1 -1
  118. package/lib/components/templates/WrapIfAdditionalTemplate.js +1 -1
  119. package/lib/components/templates/index.d.ts +1 -1
  120. package/lib/components/templates/index.d.ts.map +1 -1
  121. package/lib/components/widgets/AltDateTimeWidget.d.ts +1 -1
  122. package/lib/components/widgets/AltDateTimeWidget.d.ts.map +1 -1
  123. package/lib/components/widgets/AltDateWidget.d.ts +1 -1
  124. package/lib/components/widgets/AltDateWidget.d.ts.map +1 -1
  125. package/lib/components/widgets/AltDateWidget.js +2 -2
  126. package/lib/components/widgets/CheckboxWidget.d.ts +1 -1
  127. package/lib/components/widgets/CheckboxWidget.d.ts.map +1 -1
  128. package/lib/components/widgets/CheckboxesWidget.d.ts +1 -1
  129. package/lib/components/widgets/CheckboxesWidget.d.ts.map +1 -1
  130. package/lib/components/widgets/CheckboxesWidget.js +2 -2
  131. package/lib/components/widgets/ColorWidget.d.ts +1 -1
  132. package/lib/components/widgets/ColorWidget.d.ts.map +1 -1
  133. package/lib/components/widgets/DateTimeWidget.d.ts +1 -1
  134. package/lib/components/widgets/DateTimeWidget.d.ts.map +1 -1
  135. package/lib/components/widgets/DateTimeWidget.js +2 -2
  136. package/lib/components/widgets/DateWidget.d.ts +1 -1
  137. package/lib/components/widgets/DateWidget.d.ts.map +1 -1
  138. package/lib/components/widgets/EmailWidget.d.ts +1 -1
  139. package/lib/components/widgets/EmailWidget.d.ts.map +1 -1
  140. package/lib/components/widgets/FileWidget.d.ts +1 -1
  141. package/lib/components/widgets/FileWidget.d.ts.map +1 -1
  142. package/lib/components/widgets/FileWidget.js +6 -4
  143. package/lib/components/widgets/HiddenWidget.d.ts +1 -1
  144. package/lib/components/widgets/HiddenWidget.d.ts.map +1 -1
  145. package/lib/components/widgets/PasswordWidget.d.ts +1 -1
  146. package/lib/components/widgets/PasswordWidget.d.ts.map +1 -1
  147. package/lib/components/widgets/RadioWidget.d.ts +1 -1
  148. package/lib/components/widgets/RadioWidget.d.ts.map +1 -1
  149. package/lib/components/widgets/RadioWidget.js +2 -2
  150. package/lib/components/widgets/RangeWidget.d.ts +1 -1
  151. package/lib/components/widgets/RangeWidget.d.ts.map +1 -1
  152. package/lib/components/widgets/RatingWidget.d.ts +1 -1
  153. package/lib/components/widgets/RatingWidget.d.ts.map +1 -1
  154. package/lib/components/widgets/RatingWidget.js +15 -15
  155. package/lib/components/widgets/SelectWidget.d.ts +1 -1
  156. package/lib/components/widgets/SelectWidget.d.ts.map +1 -1
  157. package/lib/components/widgets/SelectWidget.js +4 -4
  158. package/lib/components/widgets/TextWidget.d.ts +1 -1
  159. package/lib/components/widgets/TextWidget.d.ts.map +1 -1
  160. package/lib/components/widgets/TextareaWidget.d.ts +1 -1
  161. package/lib/components/widgets/TextareaWidget.d.ts.map +1 -1
  162. package/lib/components/widgets/TextareaWidget.js +2 -2
  163. package/lib/components/widgets/TimeWidget.d.ts +1 -1
  164. package/lib/components/widgets/TimeWidget.d.ts.map +1 -1
  165. package/lib/components/widgets/URLWidget.d.ts +1 -1
  166. package/lib/components/widgets/URLWidget.d.ts.map +1 -1
  167. package/lib/components/widgets/UpDownWidget.d.ts +1 -1
  168. package/lib/components/widgets/UpDownWidget.d.ts.map +1 -1
  169. package/lib/components/widgets/index.d.ts +1 -1
  170. package/lib/components/widgets/index.d.ts.map +1 -1
  171. package/lib/getDefaultRegistry.d.ts +1 -1
  172. package/lib/getDefaultRegistry.d.ts.map +1 -1
  173. package/lib/getDefaultRegistry.js +1 -1
  174. package/lib/getTestRegistry.d.ts +1 -1
  175. package/lib/getTestRegistry.d.ts.map +1 -1
  176. package/lib/getTestRegistry.js +1 -1
  177. package/lib/index.d.ts +10 -5
  178. package/lib/index.d.ts.map +1 -1
  179. package/lib/tsconfig.tsbuildinfo +1 -1
  180. package/lib/withTheme.d.ts +3 -3
  181. package/lib/withTheme.d.ts.map +1 -1
  182. package/lib/withTheme.js +6 -6
  183. package/package.json +5 -6
  184. package/src/components/Form.tsx +164 -97
  185. package/src/components/RichDescription.tsx +3 -10
  186. package/src/components/RichHelp.tsx +3 -10
  187. package/src/components/SchemaExamples.tsx +6 -4
  188. package/src/components/fields/ArrayField.tsx +122 -108
  189. package/src/components/fields/BooleanField.tsx +4 -9
  190. package/src/components/fields/FallbackField.tsx +4 -8
  191. package/src/components/fields/LayoutGridField.tsx +21 -19
  192. package/src/components/fields/LayoutHeaderField.tsx +2 -10
  193. package/src/components/fields/LayoutMultiSchemaField.tsx +15 -10
  194. package/src/components/fields/MultiSchemaField.tsx +29 -16
  195. package/src/components/fields/NullField.tsx +1 -1
  196. package/src/components/fields/NumberField.tsx +8 -10
  197. package/src/components/fields/ObjectField.tsx +48 -39
  198. package/src/components/fields/OptionalDataControlsField.tsx +6 -4
  199. package/src/components/fields/SchemaField.tsx +22 -19
  200. package/src/components/fields/StringField.tsx +4 -15
  201. package/src/components/fields/index.ts +1 -1
  202. package/src/components/templates/ArrayFieldDescriptionTemplate.tsx +2 -9
  203. package/src/components/templates/ArrayFieldItemButtonsTemplate.tsx +2 -7
  204. package/src/components/templates/ArrayFieldItemTemplate.tsx +3 -9
  205. package/src/components/templates/ArrayFieldTemplate.tsx +2 -9
  206. package/src/components/templates/ArrayFieldTitleTemplate.tsx +2 -10
  207. package/src/components/templates/BaseInputTemplate.tsx +15 -19
  208. package/src/components/templates/ButtonTemplates/AddButton.tsx +2 -1
  209. package/src/components/templates/ButtonTemplates/IconButton.tsx +16 -7
  210. package/src/components/templates/ButtonTemplates/SubmitButton.tsx +2 -1
  211. package/src/components/templates/ButtonTemplates/index.ts +1 -1
  212. package/src/components/templates/DescriptionField.tsx +1 -1
  213. package/src/components/templates/ErrorList.tsx +8 -15
  214. package/src/components/templates/FallbackFieldTemplate.tsx +2 -1
  215. package/src/components/templates/FieldErrorTemplate.tsx +8 -8
  216. package/src/components/templates/FieldHelpTemplate.tsx +2 -1
  217. package/src/components/templates/FieldTemplate/FieldTemplate.tsx +2 -8
  218. package/src/components/templates/FieldTemplate/Label.tsx +2 -2
  219. package/src/components/templates/GridTemplate.tsx +1 -1
  220. package/src/components/templates/MultiSchemaFieldTemplate.tsx +1 -1
  221. package/src/components/templates/ObjectFieldTemplate.tsx +2 -7
  222. package/src/components/templates/OptionalDataControlsTemplate.tsx +3 -2
  223. package/src/components/templates/TitleField.tsx +1 -1
  224. package/src/components/templates/UnsupportedField.tsx +3 -2
  225. package/src/components/templates/WrapIfAdditionalTemplate.tsx +2 -9
  226. package/src/components/templates/index.ts +1 -1
  227. package/src/components/widgets/AltDateTimeWidget.tsx +1 -1
  228. package/src/components/widgets/AltDateWidget.tsx +7 -13
  229. package/src/components/widgets/CheckboxWidget.tsx +3 -5
  230. package/src/components/widgets/CheckboxesWidget.tsx +6 -8
  231. package/src/components/widgets/ColorWidget.tsx +2 -1
  232. package/src/components/widgets/DateTimeWidget.tsx +3 -10
  233. package/src/components/widgets/DateWidget.tsx +2 -1
  234. package/src/components/widgets/EmailWidget.tsx +2 -1
  235. package/src/components/widgets/FileWidget.tsx +9 -8
  236. package/src/components/widgets/HiddenWidget.tsx +1 -1
  237. package/src/components/widgets/PasswordWidget.tsx +2 -1
  238. package/src/components/widgets/RadioWidget.tsx +6 -8
  239. package/src/components/widgets/RangeWidget.tsx +1 -1
  240. package/src/components/widgets/RatingWidget.tsx +48 -47
  241. package/src/components/widgets/SelectWidget.tsx +12 -10
  242. package/src/components/widgets/TextWidget.tsx +2 -1
  243. package/src/components/widgets/TextareaWidget.tsx +7 -4
  244. package/src/components/widgets/TimeWidget.tsx +2 -1
  245. package/src/components/widgets/URLWidget.tsx +2 -1
  246. package/src/components/widgets/UpDownWidget.tsx +2 -1
  247. package/src/components/widgets/index.ts +1 -1
  248. package/src/getDefaultRegistry.ts +2 -9
  249. package/src/getTestRegistry.tsx +2 -7
  250. package/src/index.ts +10 -5
  251. package/src/withTheme.tsx +14 -9
@@ -1,8 +1,6 @@
1
- import { useCallback, Component, ComponentType } from 'react';
2
- import {
3
- ADDITIONAL_PROPERTY_FLAG,
4
- ANY_OF_KEY,
5
- descriptionId,
1
+ import type { ComponentType } from 'react';
2
+ import { useCallback, Component } from 'react';
3
+ import type {
6
4
  ErrorSchema,
7
5
  Field,
8
6
  FieldPathId,
@@ -10,28 +8,33 @@ import {
10
8
  FieldProps,
11
9
  FieldTemplateProps,
12
10
  FormContextType,
11
+ Registry,
12
+ RJSFSchema,
13
+ StrictRJSFSchema,
14
+ UIOptionsType,
15
+ } from '@rjsf/utils';
16
+ import {
17
+ ADDITIONAL_PROPERTY_FLAG,
18
+ ANY_OF_KEY,
19
+ descriptionId,
13
20
  getSchemaType,
14
21
  getTemplate,
15
22
  getUiOptions,
16
23
  ID_KEY,
17
24
  isFormDataAvailable,
18
25
  ONE_OF_KEY,
19
- Registry,
20
26
  resolveUiSchema,
21
- RJSFSchema,
22
27
  shouldRender,
23
28
  shouldRenderOptionalField,
24
- StrictRJSFSchema,
25
29
  toFieldPathId,
26
30
  TranslatableString,
27
31
  UI_OPTIONS_KEY,
28
- UIOptionsType,
29
32
  } from '@rjsf/utils';
30
33
  import isObject from 'lodash/isObject';
31
34
  import omit from 'lodash/omit';
32
35
 
33
36
  /** The map of component type to FieldName */
34
- const COMPONENT_TYPES: { [key: string]: string } = {
37
+ const COMPONENT_TYPES: Record<string, string> = {
35
38
  array: 'ArrayField',
36
39
  boolean: 'BooleanField',
37
40
  integer: 'NumberField',
@@ -55,7 +58,7 @@ function getFieldComponent<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
55
58
  uiOptions: UIOptionsType<T, S, F>,
56
59
  registry: Registry<T, S, F>,
57
60
  ): ComponentType<FieldProps<T, S, F>> {
58
- const field = uiOptions.field;
61
+ const { field } = uiOptions;
59
62
  const { fields } = registry;
60
63
  if (typeof field === 'function') {
61
64
  return field;
@@ -80,7 +83,7 @@ function getFieldComponent<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
80
83
  return () => null;
81
84
  }
82
85
 
83
- return componentName in fields ? fields[componentName] : fields['FallbackField'];
86
+ return componentName in fields ? fields[componentName] : fields.FallbackField;
84
87
  }
85
88
 
86
89
  /** The `SchemaFieldRender` component is the work-horse of react-jsonschema-form, determining what kind of real field to
@@ -126,9 +129,9 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
126
129
  * `onChange` chain if it is not already being provided from a deeper level in the hierarchy
127
130
  */
128
131
  const handleFieldComponentChange = useCallback(
129
- (formData: T | undefined, path: FieldPathList, newErrorSchema?: ErrorSchema<T>, id?: string) => {
132
+ (newFormData: T | undefined, path: FieldPathList, newErrorSchema?: ErrorSchema<T>, id?: string) => {
130
133
  const theId = id || fieldId;
131
- return onChange(formData, path, newErrorSchema, theId);
134
+ return onChange(newFormData, path, newErrorSchema, theId);
132
135
  },
133
136
  [fieldId, onChange],
134
137
  );
@@ -162,13 +165,13 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
162
165
  if ((ANY_OF_KEY in schema || ONE_OF_KEY in schema) && !isReplacingAnyOrOneOf && !schemaUtils.isSelect(schema)) {
163
166
  if (schema[ANY_OF_KEY]) {
164
167
  XxxOfField = _AnyOfField;
165
- XxxOfOptions = schema[ANY_OF_KEY].map((_schema) =>
166
- schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData),
168
+ XxxOfOptions = schema[ANY_OF_KEY].map((xxxOfSchema) =>
169
+ schemaUtils.retrieveSchema(isObject(xxxOfSchema) ? (xxxOfSchema as S) : ({} as S), formData),
167
170
  );
168
171
  } else if (schema[ONE_OF_KEY]) {
169
172
  XxxOfField = _OneOfField;
170
- XxxOfOptions = schema[ONE_OF_KEY].map((_schema) =>
171
- schemaUtils.retrieveSchema(isObject(_schema) ? (_schema as S) : ({} as S), formData),
173
+ XxxOfOptions = schema[ONE_OF_KEY].map((xxxOfSchema) =>
174
+ schemaUtils.retrieveSchema(isObject(xxxOfSchema) ? (xxxOfSchema as S) : ({} as S), formData),
172
175
  );
173
176
  }
174
177
  // When the anyOf/oneOf is an optional data control render AND it does not have form data, hide the label
@@ -224,7 +227,7 @@ function SchemaFieldRender<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
224
227
  }
225
228
 
226
229
  const description = uiOptions.description || props.schema.description || schema.description || '';
227
- const help = uiOptions.help;
230
+ const { help } = uiOptions;
228
231
  const hidden = uiOptions.widget === 'hidden' || deprecatedHandling === 'hide';
229
232
 
230
233
  const classNames = ['rjsf-field', `rjsf-field-${getSchemaType(schema)}`];
@@ -1,15 +1,6 @@
1
1
  import { useCallback } from 'react';
2
- import {
3
- getWidget,
4
- getUiOptions,
5
- optionsList,
6
- hasWidget,
7
- FieldProps,
8
- FormContextType,
9
- RJSFSchema,
10
- StrictRJSFSchema,
11
- ErrorSchema,
12
- } from '@rjsf/utils';
2
+ import type { FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema, ErrorSchema } from '@rjsf/utils';
3
+ import { getWidget, getUiOptions, optionsList, hasWidget } from '@rjsf/utils';
13
4
 
14
5
  /** The `StringField` component is used to render a schema field that represents a string type
15
6
  *
@@ -48,10 +39,8 @@ function StringField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
48
39
  const label = uiTitle ?? title ?? schemaTitle ?? name;
49
40
  const Widget = getWidget<T, S, F>(schema, widget, widgets);
50
41
  const onWidgetChange = useCallback(
51
- (value: T | undefined, errorSchema?: ErrorSchema, id?: string) => {
52
- // String field change passes an empty path array to the parent field which adds the appropriate path
53
- return onChange(value, fieldPathId.path, errorSchema, id);
54
- },
42
+ (value: T | undefined, errorSchema?: ErrorSchema, id?: string) =>
43
+ onChange(value, fieldPathId.path, errorSchema, id),
55
44
  [onChange, fieldPathId],
56
45
  );
57
46
  return (
@@ -1,4 +1,4 @@
1
- import { Field, FormContextType, RegistryFieldsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { Field, FormContextType, RegistryFieldsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
3
  import ArrayField from './ArrayField';
4
4
  import BooleanField from './BooleanField';
@@ -1,12 +1,5 @@
1
- import {
2
- descriptionId,
3
- getTemplate,
4
- getUiOptions,
5
- ArrayFieldDescriptionProps,
6
- FormContextType,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- } from '@rjsf/utils';
1
+ import type { ArrayFieldDescriptionProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { descriptionId, getTemplate, getUiOptions } from '@rjsf/utils';
10
3
 
11
4
  /** The `ArrayFieldDescriptionTemplate` component renders a `DescriptionFieldTemplate` with an `id` derived from
12
5
  * the `fieldPathId`.
@@ -1,10 +1,5 @@
1
- import {
2
- ArrayFieldItemButtonsTemplateProps,
3
- buttonId,
4
- FormContextType,
5
- RJSFSchema,
6
- StrictRJSFSchema,
7
- } from '@rjsf/utils';
1
+ import type { ArrayFieldItemButtonsTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { buttonId } from '@rjsf/utils';
8
3
 
9
4
  /** The `ArrayFieldTemplateItemButtons` component is the template used to render the buttons associate3d with items of
10
5
  * an array.
@@ -1,12 +1,6 @@
1
- import { CSSProperties } from 'react';
2
- import {
3
- ArrayFieldItemTemplateProps,
4
- FormContextType,
5
- getTemplate,
6
- getUiOptions,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- } from '@rjsf/utils';
1
+ import type { CSSProperties } from 'react';
2
+ import type { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ import { getTemplate, getUiOptions } from '@rjsf/utils';
10
4
 
11
5
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
12
6
  *
@@ -1,12 +1,5 @@
1
- import {
2
- getTemplate,
3
- getUiOptions,
4
- ArrayFieldTemplateProps,
5
- FormContextType,
6
- RJSFSchema,
7
- StrictRJSFSchema,
8
- buttonId,
9
- } from '@rjsf/utils';
1
+ import type { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { getTemplate, getUiOptions, buttonId } from '@rjsf/utils';
10
3
 
11
4
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
12
5
  *
@@ -1,13 +1,5 @@
1
- import {
2
- getTemplate,
3
- getUiOptions,
4
- titleId,
5
- ArrayFieldTitleProps,
6
- FormContextType,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- TemplatesType,
10
- } from '@rjsf/utils';
1
+ import type { ArrayFieldTitleProps, FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
+ import { getTemplate, getUiOptions, titleId } from '@rjsf/utils';
11
3
 
12
4
  /** The `ArrayFieldTitleTemplate` component renders a `TitleFieldTemplate` with an `id` derived from
13
5
  * the `fieldPathId`.
@@ -1,13 +1,7 @@
1
- import { ChangeEvent, FocusEvent, MouseEvent, useCallback } from 'react';
2
- import {
3
- ariaDescribedByIds,
4
- BaseInputTemplateProps,
5
- examplesId,
6
- getInputProps,
7
- FormContextType,
8
- RJSFSchema,
9
- StrictRJSFSchema,
10
- } from '@rjsf/utils';
1
+ import type { ChangeEvent, FocusEvent, MouseEvent } from 'react';
2
+ import { useCallback } from 'react';
3
+ import type { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
4
+ import { ariaDescribedByIds, examplesId, getInputProps } from '@rjsf/utils';
11
5
 
12
6
  import SchemaExamples from '../SchemaExamples';
13
7
 
@@ -49,6 +43,7 @@ export default function BaseInputTemplate<
49
43
  // Note: since React 15.2.0 we can't forward unknown element attributes, so we
50
44
  // exclude the "options" and "schema" ones here.
51
45
  if (!id) {
46
+ // oxlint-disable-next-line no-console
52
47
  console.log('No id for', props);
53
48
  throw new Error(`no id for props ${JSON.stringify(props)}`);
54
49
  }
@@ -64,19 +59,20 @@ export default function BaseInputTemplate<
64
59
  inputValue = value == null ? '' : value;
65
60
  }
66
61
 
67
- const _onChange = useCallback(
68
- ({ target: { value } }: ChangeEvent<HTMLInputElement>) => onChange(value === '' ? options.emptyValue : value),
62
+ const handleChange = useCallback(
63
+ ({ target: { value: newValue } }: ChangeEvent<HTMLInputElement>) =>
64
+ onChange(newValue === '' ? options.emptyValue : newValue),
69
65
  [onChange, options],
70
66
  );
71
- const _onBlur = useCallback(
67
+ const handleBlur = useCallback(
72
68
  ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target && target.value),
73
69
  [onBlur, id],
74
70
  );
75
- const _onFocus = useCallback(
71
+ const handleFocus = useCallback(
76
72
  ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target && target.value),
77
73
  [onFocus, id],
78
74
  );
79
- const _onClear = useCallback(
75
+ const handleClear = useCallback(
80
76
  (e: MouseEvent) => {
81
77
  e.preventDefault();
82
78
  e.stopPropagation();
@@ -97,13 +93,13 @@ export default function BaseInputTemplate<
97
93
  value={inputValue}
98
94
  {...inputProps}
99
95
  list={schema.examples ? examplesId(id) : undefined}
100
- onChange={onChangeOverride || _onChange}
101
- onBlur={_onBlur}
102
- onFocus={_onFocus}
96
+ onChange={onChangeOverride || handleChange}
97
+ onBlur={handleBlur}
98
+ onFocus={handleFocus}
103
99
  aria-describedby={ariaDescribedByIds(id, !!schema.examples)}
104
100
  />
105
101
  {options.allowClearTextInputs && !readonly && !disabled && inputValue && (
106
- <ClearButton registry={registry} onClick={_onClear} />
102
+ <ClearButton registry={registry} onClick={handleClear} />
107
103
  )}
108
104
  <SchemaExamples id={id} schema={schema} />
109
105
  </>
@@ -1,4 +1,5 @@
1
- import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';
1
+ import type { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { TranslatableString } from '@rjsf/utils';
2
3
 
3
4
  import IconButton from './IconButton';
4
5
 
@@ -1,6 +1,8 @@
1
- import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema, TranslatableString } from '@rjsf/utils';
1
+ import { memo } from 'react';
2
+ import type { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ import { TranslatableString } from '@rjsf/utils';
2
4
 
3
- export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
5
+ function IconButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
4
6
  props: IconButtonProps<T, S, F>,
5
7
  ) {
6
8
  const { iconType = 'default', icon, className, uiSchema, registry, ...otherProps } = props;
@@ -10,8 +12,10 @@ export default function IconButton<T = any, S extends StrictRJSFSchema = RJSFSch
10
12
  </button>
11
13
  );
12
14
  }
15
+ const IconButton = memo(IconButtonFn) as typeof IconButtonFn;
16
+ export default IconButton;
13
17
 
14
- export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
18
+ function CopyButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
15
19
  props: IconButtonProps<T, S, F>,
16
20
  ) {
17
21
  const {
@@ -19,8 +23,9 @@ export function CopyButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
19
23
  } = props;
20
24
  return <IconButton title={translateString(TranslatableString.CopyButton)} {...props} icon='copy' />;
21
25
  }
26
+ export const CopyButton = memo(CopyButtonFn) as typeof CopyButtonFn;
22
27
 
23
- export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
28
+ function MoveDownButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
24
29
  props: IconButtonProps<T, S, F>,
25
30
  ) {
26
31
  const {
@@ -28,8 +33,9 @@ export function MoveDownButton<T = any, S extends StrictRJSFSchema = RJSFSchema,
28
33
  } = props;
29
34
  return <IconButton title={translateString(TranslatableString.MoveDownButton)} {...props} icon='arrow-down' />;
30
35
  }
36
+ export const MoveDownButton = memo(MoveDownButtonFn) as typeof MoveDownButtonFn;
31
37
 
32
- export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
38
+ function MoveUpButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
33
39
  props: IconButtonProps<T, S, F>,
34
40
  ) {
35
41
  const {
@@ -37,8 +43,9 @@ export function MoveUpButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
37
43
  } = props;
38
44
  return <IconButton title={translateString(TranslatableString.MoveUpButton)} {...props} icon='arrow-up' />;
39
45
  }
46
+ export const MoveUpButton = memo(MoveUpButtonFn) as typeof MoveUpButtonFn;
40
47
 
41
- export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
48
+ function RemoveButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
42
49
  props: IconButtonProps<T, S, F>,
43
50
  ) {
44
51
  const {
@@ -48,8 +55,9 @@ export function RemoveButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
48
55
  <IconButton title={translateString(TranslatableString.RemoveButton)} {...props} iconType='danger' icon='remove' />
49
56
  );
50
57
  }
58
+ export const RemoveButton = memo(RemoveButtonFn) as typeof RemoveButtonFn;
51
59
 
52
- export function ClearButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({
60
+ function ClearButtonFn<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({
53
61
  id,
54
62
  className,
55
63
  onClick,
@@ -72,3 +80,4 @@ export function ClearButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F
72
80
  />
73
81
  );
74
82
  }
83
+ export const ClearButton = memo(ClearButtonFn) as typeof ClearButtonFn;
@@ -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
 
3
4
  /** The `SubmitButton` renders a button that represent the `Submit` action on a form
4
5
  */
@@ -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 { CopyButton, MoveDownButton, MoveUpButton, RemoveButton, ClearButton } from './IconButton';
@@ -1,4 +1,4 @@
1
- import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
3
  import RichDescription from '../RichDescription';
4
4
 
@@ -1,11 +1,5 @@
1
- import {
2
- ErrorListProps,
3
- FormContextType,
4
- RJSFValidationError,
5
- RJSFSchema,
6
- StrictRJSFSchema,
7
- TranslatableString,
8
- } from '@rjsf/utils';
1
+ import type { ErrorListProps, FormContextType, RJSFValidationError, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { TranslatableString } from '@rjsf/utils';
9
3
 
10
4
  /** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
11
5
  *
@@ -22,13 +16,12 @@ export default function ErrorList<T = any, S extends StrictRJSFSchema = RJSFSche
22
16
  <h3 className='panel-title'>{translateString(TranslatableString.ErrorsLabel)}</h3>
23
17
  </div>
24
18
  <ul className='list-group'>
25
- {errors.map((error: RJSFValidationError, i: number) => {
26
- return (
27
- <li key={i} className='list-group-item text-danger'>
28
- {error.stack}
29
- </li>
30
- );
31
- })}
19
+ {errors.map((error: RJSFValidationError, i: number) => (
20
+ // oxlint-disable-next-line react/no-array-index-key
21
+ <li key={i} className='list-group-item text-danger'>
22
+ {error.stack}
23
+ </li>
24
+ ))}
32
25
  </ul>
33
26
  </div>
34
27
  );
@@ -1,4 +1,5 @@
1
- import { FallbackFieldTemplateProps, FormContextType, getTemplate, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FallbackFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { getTemplate } from '@rjsf/utils';
2
3
 
3
4
  /**
4
5
  * The `FallbackFieldTemplate` is used to render a field when no field matches. The field renders a type selector and
@@ -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
 
3
4
  /** The `FieldErrorTemplate` component renders the errors local to the particular field
4
5
  *
@@ -20,13 +21,12 @@ export default function FieldErrorTemplate<
20
21
  <ul id={id} className='error-detail bs-callout bs-callout-info'>
21
22
  {errors
22
23
  .filter((elem) => !!elem)
23
- .map((error, index: number) => {
24
- return (
25
- <li className='text-danger' key={index}>
26
- {error}
27
- </li>
28
- );
29
- })}
24
+ .map((error, index: number) => (
25
+ // oxlint-disable-next-line react/no-array-index-key
26
+ <li className='text-danger' key={index}>
27
+ {error}
28
+ </li>
29
+ ))}
30
30
  </ul>
31
31
  </div>
32
32
  );
@@ -1,4 +1,5 @@
1
- import { helpId, FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
+ import { helpId } from '@rjsf/utils';
2
3
 
3
4
  import RichHelp from '../RichHelp';
4
5
 
@@ -1,11 +1,5 @@
1
- import {
2
- FieldTemplateProps,
3
- FormContextType,
4
- RJSFSchema,
5
- StrictRJSFSchema,
6
- getTemplate,
7
- getUiOptions,
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 './Label';
11
5
 
@@ -1,13 +1,13 @@
1
1
  const REQUIRED_FIELD_SYMBOL = '*';
2
2
 
3
- export type LabelProps = {
3
+ export interface LabelProps {
4
4
  /** The label for the field */
5
5
  label?: string;
6
6
  /** A boolean value stating if the field is required */
7
7
  required?: boolean;
8
8
  /** The id of the input field being labeled */
9
9
  id?: string;
10
- };
10
+ }
11
11
 
12
12
  /** Renders a label for a field
13
13
  *
@@ -1,4 +1,4 @@
1
- import { GridTemplateProps } from '@rjsf/utils';
1
+ import type { GridTemplateProps } from '@rjsf/utils';
2
2
 
3
3
  /** Renders a `GridTemplate` for bootstrap 3, which is expecting the column information coming in via the `className`
4
4
  * prop. Also spreads all the other props provided by the user directly on the div.
@@ -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
 
3
3
  /** The `MultiSchemaFieldTemplate` component renders the layout for the MultiSchemaField, which supports choosing
4
4
  * a schema from a list of schemas defined using `anyOf` or `oneOf`.
@@ -1,16 +1,11 @@
1
- import {
1
+ import type {
2
2
  FormContextType,
3
3
  ObjectFieldTemplatePropertyType,
4
4
  ObjectFieldTemplateProps,
5
5
  RJSFSchema,
6
6
  StrictRJSFSchema,
7
- canExpand,
8
- descriptionId,
9
- getTemplate,
10
- getUiOptions,
11
- titleId,
12
- buttonId,
13
7
  } from '@rjsf/utils';
8
+ import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, buttonId } from '@rjsf/utils';
14
9
 
15
10
  /** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
16
11
  * 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 from './ButtonTemplates/IconButton';
4
4
 
@@ -27,7 +27,8 @@ export default function OptionalDataControlsTemplate<
27
27
  title={label}
28
28
  />
29
29
  );
30
- } else if (onRemoveClick) {
30
+ }
31
+ if (onRemoveClick) {
31
32
  return (
32
33
  <IconButton
33
34
  id={id}
@@ -1,4 +1,4 @@
1
- import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
3
  const REQUIRED_FIELD_SYMBOL = '*';
4
4
 
@@ -1,5 +1,6 @@
1
- import { FormContextType, RJSFSchema, StrictRJSFSchema, TranslatableString, UnsupportedFieldProps } from '@rjsf/utils';
2
- import { Markdown } from 'markdown-to-jsx';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, UnsupportedFieldProps } from '@rjsf/utils';
2
+ import { TranslatableString } from '@rjsf/utils';
3
+ import { Markdown } from 'markdown-to-jsx/react';
3
4
 
4
5
  /** The `UnsupportedField` component is used to render a field in the schema is one that is not supported by
5
6
  * react-jsonschema-form.
@@ -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
 
11
4
  import Label from './FieldTemplate/Label';
12
5
 
@@ -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 ArrayFieldDescriptionTemplate from './ArrayFieldDescriptionTemplate';
4
4
  import ArrayFieldItemButtonsTemplate from './ArrayFieldItemButtonsTemplate';
@@ -1,4 +1,4 @@
1
- import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
2
2
 
3
3
  /** The `AltDateTimeWidget` is an alternative widget for rendering datetime properties.
4
4
  * It uses the AltDateWidget for rendering, with the `time` prop set to true by default.
@@ -1,12 +1,5 @@
1
- import {
2
- DateElement,
3
- FormContextType,
4
- RJSFSchema,
5
- StrictRJSFSchema,
6
- TranslatableString,
7
- WidgetProps,
8
- useAltDateWidgetProps,
9
- } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
2
+ import { DateElement, TranslatableString, useAltDateWidgetProps } from '@rjsf/utils';
10
3
 
11
4
  /** The `AltDateWidget` is an alternative widget for rendering date properties.
12
5
  * @param props - The `WidgetProps` for this component
@@ -21,6 +14,7 @@ function AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
21
14
  return (
22
15
  <ul className='list-inline'>
23
16
  {elements.map((elemProps, i) => (
17
+ // oxlint-disable-next-line react/no-array-index-key
24
18
  <li className='list-inline-item' key={i}>
25
19
  <DateElement
26
20
  rootId={id}
@@ -38,16 +32,16 @@ function AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
38
32
  ))}
39
33
  {(options.hideNowButton !== 'undefined' ? !options.hideNowButton : true) && (
40
34
  <li className='list-inline-item'>
41
- <a href='#' className='btn btn-info btn-now' onClick={handleSetNow}>
35
+ <button type='button' className='btn btn-info btn-now' onClick={handleSetNow}>
42
36
  {translateString(TranslatableString.NowLabel)}
43
- </a>
37
+ </button>
44
38
  </li>
45
39
  )}
46
40
  {(options.hideClearButton !== 'undefined' ? !options.hideClearButton : true) && (
47
41
  <li className='list-inline-item'>
48
- <a href='#' className='btn btn-warning btn-clear' onClick={handleClear}>
42
+ <button type='button' className='btn btn-warning btn-clear' onClick={handleClear}>
49
43
  {translateString(TranslatableString.ClearLabel)}
50
- </a>
44
+ </button>
51
45
  </li>
52
46
  )}
53
47
  </ul>