@rjsf/mantine 6.6.1 → 6.7.0

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 (144) hide show
  1. package/LICENSE.md +201 -0
  2. package/dist/index.cjs +356 -302
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/mantine.esm.js +218 -226
  5. package/dist/mantine.esm.js.map +4 -4
  6. package/dist/mantine.umd.js +175 -127
  7. package/lib/Form/index.d.ts +3 -3
  8. package/lib/Form/index.js.map +1 -1
  9. package/lib/Theme/index.d.ts +2 -2
  10. package/lib/templates/ArrayFieldItemTemplate.d.ts +2 -2
  11. package/lib/templates/ArrayFieldItemTemplate.js +1 -1
  12. package/lib/templates/ArrayFieldItemTemplate.js.map +1 -1
  13. package/lib/templates/ArrayFieldTemplate.d.ts +2 -2
  14. package/lib/templates/ArrayFieldTemplate.js +1 -1
  15. package/lib/templates/ArrayFieldTemplate.js.map +1 -1
  16. package/lib/templates/ArrayFieldTitleTemplate.d.ts +2 -2
  17. package/lib/templates/ArrayFieldTitleTemplate.js +1 -1
  18. package/lib/templates/ArrayFieldTitleTemplate.js.map +1 -1
  19. package/lib/templates/BaseInputTemplate.d.ts +2 -2
  20. package/lib/templates/BaseInputTemplate.js +9 -7
  21. package/lib/templates/BaseInputTemplate.js.map +1 -1
  22. package/lib/templates/ButtonTemplates/AddButton.d.ts +2 -2
  23. package/lib/templates/ButtonTemplates/AddButton.js.map +1 -1
  24. package/lib/templates/ButtonTemplates/IconButton.d.ts +15 -8
  25. package/lib/templates/ButtonTemplates/IconButton.js +14 -6
  26. package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
  27. package/lib/templates/ButtonTemplates/SubmitButton.d.ts +2 -2
  28. package/lib/templates/ButtonTemplates/SubmitButton.js.map +1 -1
  29. package/lib/templates/ButtonTemplates/index.d.ts +1 -1
  30. package/lib/templates/CyclicSchemaExpandTemplate.d.ts +6 -0
  31. package/lib/templates/CyclicSchemaExpandTemplate.js +15 -0
  32. package/lib/templates/CyclicSchemaExpandTemplate.js.map +1 -0
  33. package/lib/templates/DescriptionField.d.ts +2 -2
  34. package/lib/templates/ErrorList.d.ts +2 -2
  35. package/lib/templates/ErrorList.js.map +1 -1
  36. package/lib/templates/FieldErrorTemplate.d.ts +2 -2
  37. package/lib/templates/FieldErrorTemplate.js +1 -1
  38. package/lib/templates/FieldErrorTemplate.js.map +1 -1
  39. package/lib/templates/FieldHelpTemplate.d.ts +2 -2
  40. package/lib/templates/FieldHelpTemplate.js.map +1 -1
  41. package/lib/templates/FieldTemplate.d.ts +2 -2
  42. package/lib/templates/FieldTemplate.js +1 -1
  43. package/lib/templates/FieldTemplate.js.map +1 -1
  44. package/lib/templates/GridTemplate.d.ts +2 -2
  45. package/lib/templates/MultiSchemaFieldTemplate.d.ts +2 -2
  46. package/lib/templates/ObjectFieldTemplate.d.ts +2 -2
  47. package/lib/templates/ObjectFieldTemplate.js +1 -1
  48. package/lib/templates/ObjectFieldTemplate.js.map +1 -1
  49. package/lib/templates/OptionalDataControlsTemplate.d.ts +2 -2
  50. package/lib/templates/OptionalDataControlsTemplate.js +1 -1
  51. package/lib/templates/OptionalDataControlsTemplate.js.map +1 -1
  52. package/lib/templates/TitleField.d.ts +2 -2
  53. package/lib/templates/WrapIfAdditionalTemplate.d.ts +2 -2
  54. package/lib/templates/WrapIfAdditionalTemplate.js +1 -1
  55. package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -1
  56. package/lib/templates/icons.d.ts +7 -7
  57. package/lib/templates/index.d.ts +1 -1
  58. package/lib/templates/index.js +2 -0
  59. package/lib/templates/index.js.map +1 -1
  60. package/lib/tsconfig.tsbuildinfo +1 -1
  61. package/lib/utils.d.ts +1 -1
  62. package/lib/utils.js.map +1 -1
  63. package/lib/widgets/CheckboxWidget.d.ts +2 -2
  64. package/lib/widgets/CheckboxWidget.js +1 -1
  65. package/lib/widgets/CheckboxWidget.js.map +1 -1
  66. package/lib/widgets/CheckboxesWidget.d.ts +2 -2
  67. package/lib/widgets/CheckboxesWidget.js +1 -1
  68. package/lib/widgets/CheckboxesWidget.js.map +1 -1
  69. package/lib/widgets/ColorWidget.d.ts +2 -2
  70. package/lib/widgets/ColorWidget.js +3 -3
  71. package/lib/widgets/ColorWidget.js.map +1 -1
  72. package/lib/widgets/DateTime/AltDateTimeWidget.d.ts +2 -2
  73. package/lib/widgets/DateTime/AltDateWidget.d.ts +2 -2
  74. package/lib/widgets/DateTime/AltDateWidget.js +1 -1
  75. package/lib/widgets/DateTime/AltDateWidget.js.map +1 -1
  76. package/lib/widgets/DateTime/DateTimeInput.d.ts +2 -2
  77. package/lib/widgets/DateTime/DateTimeInput.js +1 -1
  78. package/lib/widgets/DateTime/DateTimeInput.js.map +1 -1
  79. package/lib/widgets/DateTime/DateTimeWidget.d.ts +2 -2
  80. package/lib/widgets/DateTime/DateWidget.d.ts +2 -2
  81. package/lib/widgets/DateTime/TimeWidget.d.ts +2 -2
  82. package/lib/widgets/DateTime/TimeWidget.js +3 -3
  83. package/lib/widgets/DateTime/TimeWidget.js.map +1 -1
  84. package/lib/widgets/FileWidget.d.ts +2 -2
  85. package/lib/widgets/FileWidget.js +2 -1
  86. package/lib/widgets/FileWidget.js.map +1 -1
  87. package/lib/widgets/PasswordWidget.d.ts +2 -2
  88. package/lib/widgets/PasswordWidget.js +4 -4
  89. package/lib/widgets/PasswordWidget.js.map +1 -1
  90. package/lib/widgets/RadioWidget.d.ts +2 -2
  91. package/lib/widgets/RadioWidget.js +3 -3
  92. package/lib/widgets/RadioWidget.js.map +1 -1
  93. package/lib/widgets/RangeWidget.d.ts +2 -2
  94. package/lib/widgets/RangeWidget.js +1 -1
  95. package/lib/widgets/RangeWidget.js.map +1 -1
  96. package/lib/widgets/SelectWidget.d.ts +2 -2
  97. package/lib/widgets/SelectWidget.js +8 -7
  98. package/lib/widgets/SelectWidget.js.map +1 -1
  99. package/lib/widgets/TextareaWidget.d.ts +2 -2
  100. package/lib/widgets/TextareaWidget.js +3 -3
  101. package/lib/widgets/TextareaWidget.js.map +1 -1
  102. package/lib/widgets/index.d.ts +1 -1
  103. package/package.json +27 -24
  104. package/src/Form/index.ts +4 -3
  105. package/src/Theme/index.ts +2 -2
  106. package/src/templates/ArrayFieldItemTemplate.tsx +2 -8
  107. package/src/templates/ArrayFieldTemplate.tsx +2 -9
  108. package/src/templates/ArrayFieldTitleTemplate.tsx +2 -8
  109. package/src/templates/BaseInputTemplate.tsx +10 -17
  110. package/src/templates/ButtonTemplates/AddButton.tsx +2 -1
  111. package/src/templates/ButtonTemplates/IconButton.tsx +19 -10
  112. package/src/templates/ButtonTemplates/SubmitButton.tsx +2 -1
  113. package/src/templates/ButtonTemplates/index.ts +1 -1
  114. package/src/templates/CyclicSchemaExpandTemplate.tsx +34 -0
  115. package/src/templates/DescriptionField.tsx +1 -1
  116. package/src/templates/ErrorList.tsx +3 -1
  117. package/src/templates/FieldErrorTemplate.tsx +4 -2
  118. package/src/templates/FieldHelpTemplate.tsx +2 -1
  119. package/src/templates/FieldTemplate.tsx +2 -8
  120. package/src/templates/GridTemplate.tsx +1 -1
  121. package/src/templates/MultiSchemaFieldTemplate.tsx +1 -1
  122. package/src/templates/ObjectFieldTemplate.tsx +4 -8
  123. package/src/templates/OptionalDataControlsTemplate.tsx +3 -2
  124. package/src/templates/TitleField.tsx +1 -1
  125. package/src/templates/WrapIfAdditionalTemplate.tsx +2 -10
  126. package/src/templates/icons.tsx +1 -1
  127. package/src/templates/index.ts +3 -1
  128. package/src/utils.ts +2 -2
  129. package/src/widgets/CheckboxWidget.tsx +4 -11
  130. package/src/widgets/CheckboxesWidget.tsx +5 -7
  131. package/src/widgets/ColorWidget.tsx +6 -11
  132. package/src/widgets/DateTime/AltDateTimeWidget.tsx +1 -1
  133. package/src/widgets/DateTime/AltDateWidget.tsx +4 -12
  134. package/src/widgets/DateTime/DateTimeInput.tsx +2 -8
  135. package/src/widgets/DateTime/DateTimeWidget.tsx +1 -1
  136. package/src/widgets/DateTime/DateWidget.tsx +1 -1
  137. package/src/widgets/DateTime/TimeWidget.tsx +6 -11
  138. package/src/widgets/FileWidget.tsx +4 -9
  139. package/src/widgets/PasswordWidget.tsx +7 -12
  140. package/src/widgets/RadioWidget.tsx +7 -9
  141. package/src/widgets/RangeWidget.tsx +3 -9
  142. package/src/widgets/SelectWidget.tsx +25 -18
  143. package/src/widgets/TextareaWidget.tsx +6 -11
  144. package/src/widgets/index.ts +1 -1
@@ -1,5 +1,7 @@
1
- import { FocusEvent, useCallback } from 'react';
1
+ import type { FocusEvent } from 'react';
2
+ import { useCallback } from 'react';
2
3
  import { Checkbox, Flex, Input } from '@mantine/core';
4
+ import type { FormContextType, WidgetProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
5
  import {
4
6
  ariaDescribedByIds,
5
7
  enumOptionValueDecoder,
@@ -8,10 +10,6 @@ import {
8
10
  getOptionValueFormat,
9
11
  optionId,
10
12
  titleId,
11
- FormContextType,
12
- WidgetProps,
13
- RJSFSchema,
14
- StrictRJSFSchema,
15
13
  } from '@rjsf/utils';
16
14
 
17
15
  import { cleanupOptions } from '../utils';
@@ -97,12 +95,12 @@ export default function CheckboxesWidget<
97
95
  <Flex mt='xs' direction={inline ? 'row' : 'column'} gap='xs' wrap='wrap'>
98
96
  {enumOptions.map((option, i) => (
99
97
  <Checkbox
100
- key={i}
98
+ key={String(option.value)}
101
99
  id={optionId(id, i)}
102
100
  name={htmlName || id}
103
101
  value={enumOptionValueEncoder(option.value, i, optionValueFormat)}
104
102
  label={option.label}
105
- disabled={Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1}
103
+ disabled={Array.isArray(enumDisabled) && enumDisabled.includes(option.value)}
106
104
  autoFocus={i === 0 && autofocus}
107
105
  onBlur={handleBlur}
108
106
  onFocus={handleFocus}
@@ -1,13 +1,8 @@
1
- import { FocusEvent, useCallback } from 'react';
1
+ import type { FocusEvent } from 'react';
2
+ import { useCallback } from 'react';
2
3
  import { ColorInput } from '@mantine/core';
3
- import {
4
- FormContextType,
5
- RJSFSchema,
6
- StrictRJSFSchema,
7
- WidgetProps,
8
- labelValue,
9
- ariaDescribedByIds,
10
- } from '@rjsf/utils';
4
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
5
+ import { labelValue, ariaDescribedByIds } from '@rjsf/utils';
11
6
 
12
7
  import { cleanupOptions } from '../utils';
13
8
 
@@ -48,7 +43,7 @@ export default function ColorWidget<T = any, S extends StrictRJSFSchema = RJSFSc
48
43
  const handleBlur = useCallback(
49
44
  ({ target }: FocusEvent<HTMLInputElement>) => {
50
45
  if (onBlur) {
51
- onBlur(id, target && target.value);
46
+ onBlur(id, target?.value);
52
47
  }
53
48
  },
54
49
  [onBlur, id],
@@ -57,7 +52,7 @@ export default function ColorWidget<T = any, S extends StrictRJSFSchema = RJSFSc
57
52
  const handleFocus = useCallback(
58
53
  ({ target }: FocusEvent<HTMLInputElement>) => {
59
54
  if (onFocus) {
60
- onFocus(id, target && target.value);
55
+ onFocus(id, target?.value);
61
56
  }
62
57
  },
63
58
  [onFocus, id],
@@ -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,16 +1,6 @@
1
1
  import { Flex, Box, Group, Button, Select, Input } from '@mantine/core';
2
- import {
3
- ariaDescribedByIds,
4
- dateRangeOptions,
5
- titleId,
6
- DateObject,
7
- FormContextType,
8
- RJSFSchema,
9
- StrictRJSFSchema,
10
- TranslatableString,
11
- useAltDateWidgetProps,
12
- WidgetProps,
13
- } from '@rjsf/utils';
2
+ import type { DateObject, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ import { ariaDescribedByIds, dateRangeOptions, titleId, TranslatableString, useAltDateWidgetProps } from '@rjsf/utils';
14
4
 
15
5
  /** The `AltDateWidget` is an alternative widget for rendering date properties.
16
6
  * @param props - The `WidgetProps` for this component
@@ -34,6 +24,7 @@ export default function AltDateWidget<
34
24
  {elements.map((elemProps, i) => {
35
25
  const elemId = `${id}_${elemProps.type}`;
36
26
  return (
27
+ // oxlint-disable-next-line react/no-array-index-key
37
28
  <Box key={i}>
38
29
  <Select
39
30
  id={elemId}
@@ -67,6 +58,7 @@ export default function AltDateWidget<
67
58
  {rawErrors &&
68
59
  rawErrors?.length > 0 &&
69
60
  rawErrors.map((error: string, index: number) => (
61
+ // oxlint-disable-next-line react/no-array-index-key
70
62
  <Input.Error key={`alt-date-widget-input-errors-${index}`}>{error}</Input.Error>
71
63
  ))}
72
64
  </>
@@ -1,13 +1,7 @@
1
1
  import { useCallback } from 'react';
2
2
  import { DateInput } from '@mantine/dates';
3
- import {
4
- ariaDescribedByIds,
5
- FormContextType,
6
- labelValue,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- WidgetProps,
10
- } from '@rjsf/utils';
3
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
4
+ import { ariaDescribedByIds, labelValue } from '@rjsf/utils';
11
5
  import dayjs from 'dayjs';
12
6
 
13
7
  const dateParser = (input: string, format: string) => {
@@ -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
  import DateTimeInput from './DateTimeInput';
4
4
 
@@ -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
  import DateTimeInput from './DateTimeInput';
4
4
 
@@ -1,13 +1,8 @@
1
- import { ChangeEvent, FocusEvent, useCallback } from 'react';
1
+ import type { ChangeEvent, FocusEvent } from 'react';
2
+ import { useCallback } from 'react';
2
3
  import { TimeInput } from '@mantine/dates';
3
- import {
4
- FormContextType,
5
- RJSFSchema,
6
- StrictRJSFSchema,
7
- WidgetProps,
8
- labelValue,
9
- ariaDescribedByIds,
10
- } from '@rjsf/utils';
4
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
5
+ import { labelValue, ariaDescribedByIds } from '@rjsf/utils';
11
6
 
12
7
  /** The `TimeWidget` component uses the `TimeInput` component from `@mantine/dates` for rendering.
13
8
  *
@@ -46,7 +41,7 @@ export default function TimeWidget<T = any, S extends StrictRJSFSchema = RJSFSch
46
41
  const handleBlur = useCallback(
47
42
  ({ target }: FocusEvent<HTMLInputElement>) => {
48
43
  if (onBlur) {
49
- onBlur(id, target && target.value);
44
+ onBlur(id, target?.value);
50
45
  }
51
46
  },
52
47
  [onBlur, id],
@@ -55,7 +50,7 @@ export default function TimeWidget<T = any, S extends StrictRJSFSchema = RJSFSch
55
50
  const handleFocus = useCallback(
56
51
  ({ target }: FocusEvent<HTMLInputElement>) => {
57
52
  if (onFocus) {
58
- onFocus(id, target && target.value);
53
+ onFocus(id, target?.value);
59
54
  }
60
55
  },
61
56
  [onFocus, id],
@@ -1,14 +1,7 @@
1
1
  import { useCallback } from 'react';
2
2
  import { FileInput, Pill } from '@mantine/core';
3
- import {
4
- ariaDescribedByIds,
5
- FormContextType,
6
- labelValue,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- useFileWidgetProps,
10
- WidgetProps,
11
- } from '@rjsf/utils';
3
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
4
+ import { ariaDescribedByIds, labelValue, useFileWidgetProps } from '@rjsf/utils';
12
5
 
13
6
  import { cleanupOptions } from '../utils';
14
7
 
@@ -43,6 +36,7 @@ export default function FileWidget<T = any, S extends StrictRJSFSchema = RJSFSch
43
36
  (files: any) => {
44
37
  if (typeof files === 'object') {
45
38
  // handleChange is async; DOM event handlers are void-returning, so we intentionally don't await
39
+ // oxlint-disable-next-line no-floating-promises, no-void
46
40
  void handleChange(files);
47
41
  }
48
42
  },
@@ -54,6 +48,7 @@ export default function FileWidget<T = any, S extends StrictRJSFSchema = RJSFSch
54
48
  return (
55
49
  <Pill.Group>
56
50
  {filesInfo.map((file, index) => (
51
+ // oxlint-disable-next-line react/no-array-index-key
57
52
  <Pill key={index} withRemoveButton onRemove={() => handleRemove(index)}>
58
53
  {file.name}
59
54
  </Pill>
@@ -1,13 +1,8 @@
1
- import { ChangeEvent, FocusEvent, useCallback } from 'react';
1
+ import type { ChangeEvent, FocusEvent } from 'react';
2
+ import { useCallback } from 'react';
2
3
  import { PasswordInput } from '@mantine/core';
3
- import {
4
- ariaDescribedByIds,
5
- FormContextType,
6
- labelValue,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- WidgetProps,
10
- } from '@rjsf/utils';
4
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
5
+ import { ariaDescribedByIds, labelValue } from '@rjsf/utils';
11
6
 
12
7
  import { cleanupOptions } from '../utils';
13
8
 
@@ -39,7 +34,7 @@ export default function PasswordWidget<
39
34
  onFocus,
40
35
  } = props;
41
36
 
42
- const emptyValue = options.emptyValue;
37
+ const { emptyValue } = options;
43
38
  const themeProps = cleanupOptions(options);
44
39
 
45
40
  const handleChange = useCallback(
@@ -52,7 +47,7 @@ export default function PasswordWidget<
52
47
  const handleBlur = useCallback(
53
48
  ({ target }: FocusEvent<HTMLInputElement>) => {
54
49
  if (onBlur) {
55
- onBlur(id, target && target.value);
50
+ onBlur(id, target?.value);
56
51
  }
57
52
  },
58
53
  [onBlur, id],
@@ -61,7 +56,7 @@ export default function PasswordWidget<
61
56
  const handleFocus = useCallback(
62
57
  ({ target }: FocusEvent<HTMLInputElement>) => {
63
58
  if (onFocus) {
64
- onFocus(id, target && target.value);
59
+ onFocus(id, target?.value);
65
60
  }
66
61
  },
67
62
  [onFocus, id],
@@ -1,5 +1,7 @@
1
- import { FocusEvent, useCallback } from 'react';
1
+ import type { FocusEvent } from 'react';
2
+ import { useCallback } from 'react';
2
3
  import { Radio, Flex } from '@mantine/core';
4
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
5
  import {
4
6
  ariaDescribedByIds,
5
7
  enumOptionValueDecoder,
@@ -7,10 +9,6 @@ import {
7
9
  enumOptionsIndexForValue,
8
10
  getOptionValueFormat,
9
11
  optionId,
10
- FormContextType,
11
- RJSFSchema,
12
- StrictRJSFSchema,
13
- WidgetProps,
14
12
  } from '@rjsf/utils';
15
13
 
16
14
  import { cleanupOptions } from '../utils';
@@ -56,7 +54,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
56
54
  const handleBlur = useCallback(
57
55
  ({ target }: FocusEvent<HTMLInputElement>) => {
58
56
  if (onBlur) {
59
- onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
57
+ onBlur(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, emptyValue));
60
58
  }
61
59
  },
62
60
  [onBlur, id, enumOptions, emptyValue, optionValueFormat],
@@ -65,7 +63,7 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
65
63
  const handleFocus = useCallback(
66
64
  ({ target }: FocusEvent<HTMLInputElement>) => {
67
65
  if (onFocus) {
68
- onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
66
+ onFocus(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, emptyValue));
69
67
  }
70
68
  },
71
69
  [onFocus, id, enumOptions, emptyValue, optionValueFormat],
@@ -90,11 +88,11 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
90
88
  <Flex mt='xs' direction={inline ? 'row' : 'column'} gap='xs' wrap='wrap'>
91
89
  {enumOptions.map((option, i) => (
92
90
  <Radio
93
- key={i}
91
+ key={String(option.value)}
94
92
  id={optionId(id, i)}
95
93
  value={enumOptionValueEncoder(option.value, i, optionValueFormat)}
96
94
  label={option.label}
97
- disabled={Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1}
95
+ disabled={Array.isArray(enumDisabled) && enumDisabled.includes(option.value)}
98
96
  autoFocus={i === 0 && autofocus}
99
97
  onBlur={handleBlur}
100
98
  onFocus={handleFocus}
@@ -1,14 +1,7 @@
1
1
  import { useCallback } from 'react';
2
2
  import { Slider, Input } from '@mantine/core';
3
- import {
4
- ariaDescribedByIds,
5
- rangeSpec,
6
- FormContextType,
7
- RJSFSchema,
8
- StrictRJSFSchema,
9
- WidgetProps,
10
- titleId,
11
- } from '@rjsf/utils';
3
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
4
+ import { ariaDescribedByIds, rangeSpec, titleId } from '@rjsf/utils';
12
5
 
13
6
  import { cleanupOptions } from '../utils';
14
7
 
@@ -88,6 +81,7 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
88
81
  {rawErrors &&
89
82
  rawErrors?.length > 0 &&
90
83
  rawErrors.map((error: string, index: number) => (
84
+ // oxlint-disable-next-line react/no-array-index-key
91
85
  <Input.Error key={`range-widget-input-errors-${index}`}>{error}</Input.Error>
92
86
  ))}
93
87
  </>
@@ -1,5 +1,7 @@
1
- import { FocusEvent, useCallback, useMemo } from 'react';
1
+ import type { FocusEvent } from 'react';
2
+ import { useCallback, useMemo } from 'react';
2
3
  import { Select, MultiSelect } from '@mantine/core';
4
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
5
  import {
4
6
  ariaDescribedByIds,
5
7
  enumOptionSelectedValue,
@@ -7,10 +9,8 @@ import {
7
9
  enumOptionValueEncoder,
8
10
  getOptionValueFormat,
9
11
  labelValue,
10
- FormContextType,
11
- RJSFSchema,
12
- StrictRJSFSchema,
13
- WidgetProps,
12
+ logUnsupportedDefaultForEnum,
13
+ SelectedOptionDescription,
14
14
  } from '@rjsf/utils';
15
15
 
16
16
  import { cleanupOptions } from '../utils';
@@ -36,6 +36,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
36
36
  hideLabel,
37
37
  multiple,
38
38
  rawErrors,
39
+ schema,
39
40
  options,
40
41
  onChange,
41
42
  onBlur,
@@ -45,6 +46,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
45
46
  const { enumOptions, enumDisabled, emptyValue } = options;
46
47
  const optionValueFormat = getOptionValueFormat(options);
47
48
  const themeProps = cleanupOptions(options);
49
+ logUnsupportedDefaultForEnum<S>(id, schema, enumOptions, multiple);
48
50
 
49
51
  const handleChange = useCallback(
50
52
  (nextValue: any) => {
@@ -58,7 +60,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
58
60
  const handleBlur = useCallback(
59
61
  ({ target }: FocusEvent<HTMLInputElement>) => {
60
62
  if (onBlur) {
61
- onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
63
+ onBlur(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, emptyValue));
62
64
  }
63
65
  },
64
66
  [onBlur, id, enumOptions, emptyValue, optionValueFormat],
@@ -67,7 +69,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
67
69
  const handleFocus = useCallback(
68
70
  ({ target }: FocusEvent<HTMLInputElement>) => {
69
71
  if (onFocus) {
70
- onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, emptyValue));
72
+ onFocus(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, emptyValue));
71
73
  }
72
74
  },
73
75
  [onFocus, id, enumOptions, emptyValue, optionValueFormat],
@@ -79,7 +81,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
79
81
  key: String(index),
80
82
  value: enumOptionValueEncoder(option.value, index, optionValueFormat),
81
83
  label: option.label,
82
- disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
84
+ disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
83
85
  }));
84
86
  }
85
87
  return [];
@@ -104,15 +106,20 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
104
106
  ...themeProps,
105
107
  };
106
108
 
107
- return multiple ? (
108
- <MultiSelect
109
- {...sharedProps}
110
- value={enumOptionSelectedValue<S>(value, enumOptions, true, optionValueFormat, []) as string[]}
111
- />
112
- ) : (
113
- <Select
114
- {...sharedProps}
115
- value={enumOptionSelectedValue<S>(value, enumOptions, false, optionValueFormat, null) as string | null}
116
- />
109
+ return (
110
+ <>
111
+ <SelectedOptionDescription {...props} />
112
+ {multiple ? (
113
+ <MultiSelect
114
+ {...sharedProps}
115
+ value={enumOptionSelectedValue<S>(value, enumOptions, true, optionValueFormat, []) as string[]}
116
+ />
117
+ ) : (
118
+ <Select
119
+ {...sharedProps}
120
+ value={enumOptionSelectedValue<S>(value, enumOptions, false, optionValueFormat, null) as string | null}
121
+ />
122
+ )}
123
+ </>
117
124
  );
118
125
  }
@@ -1,13 +1,8 @@
1
- import { ReactElement, ChangeEvent, FocusEvent, useCallback } from 'react';
1
+ import type { ReactElement, ChangeEvent, FocusEvent } from 'react';
2
+ import { useCallback } from 'react';
2
3
  import { Textarea } from '@mantine/core';
3
- import {
4
- StrictRJSFSchema,
5
- RJSFSchema,
6
- FormContextType,
7
- WidgetProps,
8
- labelValue,
9
- ariaDescribedByIds,
10
- } from '@rjsf/utils';
4
+ import type { StrictRJSFSchema, RJSFSchema, FormContextType, WidgetProps } from '@rjsf/utils';
5
+ import { labelValue, ariaDescribedByIds } from '@rjsf/utils';
11
6
 
12
7
  import { cleanupOptions } from '../utils';
13
8
 
@@ -52,7 +47,7 @@ export default function TextareaWidget<
52
47
  const handleBlur = useCallback(
53
48
  ({ target }: FocusEvent<HTMLTextAreaElement>) => {
54
49
  if (onBlur) {
55
- onBlur(id, target && target.value);
50
+ onBlur(id, target?.value);
56
51
  }
57
52
  },
58
53
  [onBlur, id],
@@ -61,7 +56,7 @@ export default function TextareaWidget<
61
56
  const handleFocus = useCallback(
62
57
  ({ target }: FocusEvent<HTMLTextAreaElement>) => {
63
58
  if (onFocus) {
64
- onFocus(id, target && target.value);
59
+ onFocus(id, target?.value);
65
60
  }
66
61
  },
67
62
  [onFocus, id],
@@ -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
  import dayjs from 'dayjs';
3
3
  import customParseFormat from 'dayjs/plugin/customParseFormat';
4
4