@rjsf/semantic-ui 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 (110) hide show
  1. package/LICENSE.md +201 -0
  2. package/dist/index.cjs +268 -241
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/semantic-ui.esm.js +209 -218
  5. package/dist/semantic-ui.esm.js.map +4 -4
  6. package/dist/semantic-ui.umd.js +117 -96
  7. package/lib/AddButton/AddButton.d.ts +3 -3
  8. package/lib/AddButton/AddButton.js.map +1 -1
  9. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +2 -2
  10. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
  11. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  12. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +2 -2
  13. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
  14. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  15. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +2 -2
  16. package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
  17. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  18. package/lib/CheckboxWidget/CheckboxWidget.d.ts +2 -2
  19. package/lib/CheckboxWidget/CheckboxWidget.js +7 -7
  20. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  21. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +2 -2
  22. package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
  23. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  24. package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.d.ts +6 -0
  25. package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js +14 -0
  26. package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js.map +1 -0
  27. package/lib/CyclicSchemaExpandTemplate/index.d.ts +2 -0
  28. package/lib/CyclicSchemaExpandTemplate/index.js +3 -0
  29. package/lib/CyclicSchemaExpandTemplate/index.js.map +1 -0
  30. package/lib/DescriptionField/DescriptionField.d.ts +2 -2
  31. package/lib/ErrorList/ErrorList.d.ts +2 -2
  32. package/lib/ErrorList/ErrorList.js.map +1 -1
  33. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +2 -2
  34. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  35. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +2 -2
  36. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  37. package/lib/FieldTemplate/FieldTemplate.d.ts +2 -2
  38. package/lib/FieldTemplate/FieldTemplate.js +1 -1
  39. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  40. package/lib/GridTemplate/GridTemplate.d.ts +2 -2
  41. package/lib/IconButton/IconButton.d.ts +15 -8
  42. package/lib/IconButton/IconButton.js +14 -6
  43. package/lib/IconButton/IconButton.js.map +1 -1
  44. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -2
  45. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +2 -2
  46. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +1 -1
  47. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  48. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +2 -2
  49. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
  50. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
  51. package/lib/RadioWidget/RadioWidget.d.ts +2 -2
  52. package/lib/RadioWidget/RadioWidget.js +5 -7
  53. package/lib/RadioWidget/RadioWidget.js.map +1 -1
  54. package/lib/RangeWidget/RangeWidget.d.ts +2 -2
  55. package/lib/RangeWidget/RangeWidget.js +5 -5
  56. package/lib/RangeWidget/RangeWidget.js.map +1 -1
  57. package/lib/SelectWidget/SelectWidget.d.ts +2 -2
  58. package/lib/SelectWidget/SelectWidget.js +8 -8
  59. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  60. package/lib/SemanticUIForm/SemanticUIForm.d.ts +3 -3
  61. package/lib/SemanticUIForm/SemanticUIForm.js.map +1 -1
  62. package/lib/SubmitButton/SubmitButton.d.ts +2 -2
  63. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  64. package/lib/Templates/Templates.d.ts +1 -1
  65. package/lib/Templates/Templates.js +2 -0
  66. package/lib/Templates/Templates.js.map +1 -1
  67. package/lib/TextareaWidget/TextareaWidget.d.ts +2 -2
  68. package/lib/TextareaWidget/TextareaWidget.js +6 -6
  69. package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
  70. package/lib/Theme/Theme.d.ts +2 -2
  71. package/lib/TitleField/TitleField.d.ts +2 -2
  72. package/lib/Widgets/Widgets.d.ts +1 -1
  73. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +2 -2
  74. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -2
  75. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  76. package/lib/tsconfig.tsbuildinfo +1 -1
  77. package/lib/util.d.ts +7 -7
  78. package/lib/util.js +13 -6
  79. package/lib/util.js.map +1 -1
  80. package/package.json +25 -23
  81. package/src/AddButton/AddButton.tsx +5 -3
  82. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
  83. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -10
  84. package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -20
  85. package/src/CheckboxWidget/CheckboxWidget.tsx +13 -21
  86. package/src/CheckboxesWidget/CheckboxesWidget.tsx +11 -14
  87. package/src/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.tsx +25 -0
  88. package/src/CyclicSchemaExpandTemplate/index.ts +2 -0
  89. package/src/DescriptionField/DescriptionField.tsx +1 -1
  90. package/src/ErrorList/ErrorList.tsx +3 -1
  91. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -1
  92. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
  93. package/src/FieldTemplate/FieldTemplate.tsx +2 -8
  94. package/src/GridTemplate/GridTemplate.tsx +1 -1
  95. package/src/IconButton/IconButton.tsx +18 -8
  96. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
  97. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -12
  98. package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
  99. package/src/RadioWidget/RadioWidget.tsx +13 -16
  100. package/src/RangeWidget/RangeWidget.tsx +11 -10
  101. package/src/SelectWidget/SelectWidget.tsx +45 -37
  102. package/src/SemanticUIForm/SemanticUIForm.ts +4 -3
  103. package/src/SubmitButton/SubmitButton.tsx +2 -1
  104. package/src/Templates/Templates.ts +3 -1
  105. package/src/TextareaWidget/TextareaWidget.tsx +11 -17
  106. package/src/Theme/Theme.ts +2 -2
  107. package/src/TitleField/TitleField.tsx +1 -1
  108. package/src/Widgets/Widgets.tsx +1 -1
  109. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -13
  110. package/src/util.tsx +20 -21
@@ -1,4 +1,5 @@
1
- import { FormEvent } from 'react';
1
+ import type { FormEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
2
3
  import {
3
4
  ariaDescribedByIds,
4
5
  enumOptionValueDecoder,
@@ -6,12 +7,9 @@ import {
6
7
  enumOptionsIsSelected,
7
8
  getOptionValueFormat,
8
9
  optionId,
9
- FormContextType,
10
- RJSFSchema,
11
- StrictRJSFSchema,
12
- WidgetProps,
13
10
  } from '@rjsf/utils';
14
- import { CheckboxProps, Form, Radio } from 'semantic-ui-react';
11
+ import type { CheckboxProps } from 'semantic-ui-react';
12
+ import { Form, Radio } from 'semantic-ui-react';
15
13
 
16
14
  import { getSemanticProps } from '../util';
17
15
 
@@ -45,19 +43,18 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
45
43
  options,
46
44
  uiSchema,
47
45
  });
48
- const _onChange = (_: FormEvent<HTMLInputElement>, { value: eventValue }: CheckboxProps) => {
49
- return onChange(enumOptionValueDecoder<S>(String(eventValue!), enumOptions, optionValueFormat, emptyValue));
50
- };
46
+ const handleChange = (_: FormEvent<HTMLInputElement>, { value: eventValue }: CheckboxProps) =>
47
+ onChange(enumOptionValueDecoder<S>(String(eventValue!), enumOptions, optionValueFormat, emptyValue));
51
48
 
52
- const _onBlur = () => onBlur(id, value);
53
- const _onFocus = () => onFocus(id, value);
49
+ const handleBlur = () => onBlur(id, value);
50
+ const handleFocus = () => onFocus(id, value);
54
51
  const inlineOption = options.inline ? { inline: true } : { grouped: true };
55
52
  return (
56
53
  <Form.Group {...inlineOption}>
57
54
  {Array.isArray(enumOptions) &&
58
55
  enumOptions.map((option, index) => {
59
56
  const checked = enumOptionsIsSelected<S>(option.value, value);
60
- const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
57
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
61
58
  return (
62
59
  <Form.Field
63
60
  required={required}
@@ -65,13 +62,13 @@ export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSc
65
62
  id={optionId(id, index)}
66
63
  name={htmlName || id}
67
64
  {...semanticProps}
68
- onFocus={_onFocus}
69
- onBlur={_onBlur}
70
- onChange={_onChange}
65
+ onFocus={handleFocus}
66
+ onBlur={handleBlur}
67
+ onChange={handleChange}
71
68
  label={option.label}
72
69
  value={enumOptionValueEncoder(option.value, index, optionValueFormat)}
73
70
  error={rawErrors.length > 0}
74
- key={index}
71
+ key={String(option.value)}
75
72
  checked={checked}
76
73
  disabled={disabled || itemDisabled || readonly}
77
74
  aria-describedby={ariaDescribedByIds(id)}
@@ -1,5 +1,6 @@
1
- import { ChangeEvent } from 'react';
2
- import { ariaDescribedByIds, FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps, rangeSpec } from '@rjsf/utils';
1
+ import type { ChangeEvent } from 'react';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
3
+ import { ariaDescribedByIds, rangeSpec } from '@rjsf/utils';
3
4
  import { Input } from 'semantic-ui-react';
4
5
 
5
6
  import { getSemanticProps } from '../util';
@@ -36,11 +37,11 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
36
37
  },
37
38
  });
38
39
 
39
- // eslint-disable-next-line no-shadow
40
- const _onChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>
41
- onChange && onChange(value === '' ? options.emptyValue : value);
42
- const _onBlur = () => onBlur && onBlur(id, value);
43
- const _onFocus = () => onFocus && onFocus(id, value);
40
+ // oxlint-disable-next-line no-shadow
41
+ const handleChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>
42
+ onChange?.(value === '' ? options.emptyValue : value);
43
+ const handleBlur = () => onBlur?.(id, value);
44
+ const handleFocus = () => onFocus?.(id, value);
44
45
 
45
46
  return (
46
47
  <>
@@ -55,9 +56,9 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
55
56
  {...semanticProps}
56
57
  value={value || ''}
57
58
  error={rawErrors.length > 0}
58
- onChange={_onChange}
59
- onBlur={_onBlur}
60
- onFocus={_onFocus}
59
+ onChange={handleChange}
60
+ onBlur={handleBlur}
61
+ onFocus={handleFocus}
61
62
  aria-describedby={ariaDescribedByIds(id)}
62
63
  />
63
64
  <span>{value}</span>
@@ -1,11 +1,5 @@
1
- import { FocusEvent, SyntheticEvent } from 'react';
2
- import {
3
- ariaDescribedByIds,
4
- enumOptionSelectedValue,
5
- enumOptionValueDecoder,
6
- enumOptionValueEncoder,
7
- getOptionValueFormat,
8
- labelValue,
1
+ import type { FocusEvent, SyntheticEvent } from 'react';
2
+ import type {
9
3
  EnumOptionsType,
10
4
  FormContextType,
11
5
  OptionValueFormat,
@@ -14,8 +8,19 @@ import {
14
8
  WidgetProps,
15
9
  UIOptionsType,
16
10
  } from '@rjsf/utils';
11
+ import {
12
+ ariaDescribedByIds,
13
+ enumOptionSelectedValue,
14
+ enumOptionValueDecoder,
15
+ enumOptionValueEncoder,
16
+ getOptionValueFormat,
17
+ labelValue,
18
+ logUnsupportedDefaultForEnum,
19
+ SelectedOptionDescription,
20
+ } from '@rjsf/utils';
17
21
  import map from 'lodash/map';
18
- import { Form, DropdownProps, DropdownItemProps } from 'semantic-ui-react';
22
+ import type { DropdownProps, DropdownItemProps } from 'semantic-ui-react';
23
+ import { Form } from 'semantic-ui-react';
19
24
 
20
25
  import { getSemanticProps } from '../util';
21
26
 
@@ -36,7 +41,7 @@ function createDefaultValueOptionsForDropDown<S extends StrictRJSFSchema = RJSFS
36
41
  ) {
37
42
  const disabledOptions = enumDisabled || [];
38
43
  const options: DropdownItemProps[] = map(enumOptions, ({ label, value }, index) => ({
39
- disabled: disabledOptions.indexOf(value) !== -1,
44
+ disabled: disabledOptions.includes(value),
40
45
  key: label,
41
46
  text: label,
42
47
  value: enumOptionValueEncoder(value, index, format),
@@ -92,6 +97,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
92
97
  const emptyValue = multiple ? [] : '';
93
98
  const optionValueFormat = getOptionValueFormat(options);
94
99
  const showPlaceholderOption = !multiple && schema.default === undefined;
100
+ logUnsupportedDefaultForEnum<S>(id, schema, enumOptions, multiple);
95
101
  const dropdownOptions = createDefaultValueOptionsForDropDown<S>(
96
102
  enumOptions,
97
103
  enumDisabled,
@@ -99,33 +105,35 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
99
105
  placeholder,
100
106
  optionValueFormat,
101
107
  );
102
- const _onChange = (_: SyntheticEvent<HTMLElement>, { value }: DropdownProps) =>
103
- onChange(enumOptionValueDecoder<S>(value as string[], enumOptions, optionValueFormat, optEmptyVal));
104
- // eslint-disable-next-line no-shadow
105
- const _onBlur = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
106
- onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
107
- const _onFocus = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
108
- onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
108
+ const handleChange = (_: SyntheticEvent<HTMLElement>, { value: enumValue }: DropdownProps) =>
109
+ onChange(enumOptionValueDecoder<S>(enumValue as string[], enumOptions, optionValueFormat, optEmptyVal));
110
+ const handleBlur = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
111
+ onBlur(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, optEmptyVal));
112
+ const handleFocus = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
113
+ onFocus(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, optEmptyVal));
109
114
  return (
110
- <Form.Dropdown
111
- key={id}
112
- id={id}
113
- name={htmlName || id}
114
- label={labelValue(label || undefined, hideLabel, false)}
115
- multiple={typeof multiple === 'undefined' ? false : multiple}
116
- value={enumOptionSelectedValue<S>(value, enumOptions, !!multiple, optionValueFormat, emptyValue)}
117
- error={rawErrors.length > 0}
118
- disabled={disabled}
119
- placeholder={placeholder}
120
- {...semanticProps}
121
- required={required}
122
- autoFocus={autofocus}
123
- readOnly={readonly}
124
- options={dropdownOptions}
125
- onChange={_onChange}
126
- onBlur={_onBlur}
127
- onFocus={_onFocus}
128
- aria-describedby={ariaDescribedByIds(id)}
129
- />
115
+ <>
116
+ <Form.Dropdown
117
+ key={id}
118
+ id={id}
119
+ name={htmlName || id}
120
+ label={labelValue(label || undefined, hideLabel, false)}
121
+ multiple={typeof multiple === 'undefined' ? false : multiple}
122
+ value={enumOptionSelectedValue<S>(value, enumOptions, !!multiple, optionValueFormat, emptyValue)}
123
+ error={rawErrors.length > 0}
124
+ disabled={disabled}
125
+ placeholder={placeholder}
126
+ {...semanticProps}
127
+ required={required}
128
+ autoFocus={autofocus}
129
+ readOnly={readonly}
130
+ options={dropdownOptions}
131
+ onChange={handleChange}
132
+ onBlur={handleBlur}
133
+ onFocus={handleFocus}
134
+ aria-describedby={ariaDescribedByIds(id)}
135
+ />
136
+ <SelectedOptionDescription {...props} />
137
+ </>
130
138
  );
131
139
  }
@@ -1,6 +1,7 @@
1
- import { ComponentType } from 'react';
2
- import { withTheme, FormProps } from '@rjsf/core';
3
- import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { ComponentType } from 'react';
2
+ import type { FormProps } from '@rjsf/core';
3
+ import { withTheme } from '@rjsf/core';
4
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
4
5
 
5
6
  import { generateTheme } from '../Theme';
6
7
 
@@ -1,4 +1,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 'semantic-ui-react';
3
4
 
4
5
  /** The `SubmitButton` renders a button that represent the `Submit` action on a form
@@ -1,9 +1,10 @@
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';
5
5
  import ArrayFieldTemplate from '../ArrayFieldTemplate';
6
6
  import BaseInputTemplate from '../BaseInputTemplate';
7
+ import CyclicSchemaExpandTemplate from '../CyclicSchemaExpandTemplate';
7
8
  import DescriptionField from '../DescriptionField';
8
9
  import ErrorList from '../ErrorList';
9
10
  import FieldErrorTemplate from '../FieldErrorTemplate';
@@ -27,6 +28,7 @@ export function generateTemplates<
27
28
  ArrayFieldItemTemplate,
28
29
  ArrayFieldTemplate,
29
30
  BaseInputTemplate,
31
+ CyclicSchemaExpandTemplate,
30
32
  ButtonTemplates: {
31
33
  AddButton,
32
34
  CopyButton,
@@ -1,12 +1,6 @@
1
- import { ChangeEvent } from 'react';
2
- import {
3
- ariaDescribedByIds,
4
- labelValue,
5
- FormContextType,
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, labelValue } from '@rjsf/utils';
10
4
  import { Form } from 'semantic-ui-react';
11
5
 
12
6
  import { getSemanticProps } from '../util';
@@ -43,11 +37,11 @@ export default function TextareaWidget<
43
37
  options,
44
38
  defaultSchemaProps: { inverted: 'false' },
45
39
  });
46
- // eslint-disable-next-line no-shadow
47
- const _onChange = ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) =>
48
- onChange && onChange(value === '' ? options.emptyValue : value);
49
- const _onBlur = () => onBlur && onBlur(id, value);
50
- const _onFocus = () => onFocus && onFocus(id, value);
40
+ // oxlint-disable-next-line no-shadow
41
+ const handleChange = ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) =>
42
+ onChange?.(value === '' ? options.emptyValue : value);
43
+ const handleBlur = () => onBlur?.(id, value);
44
+ const handleFocus = () => onFocus?.(id, value);
51
45
  return (
52
46
  <Form.TextArea
53
47
  id={id}
@@ -62,9 +56,9 @@ export default function TextareaWidget<
62
56
  value={value || ''}
63
57
  error={rawErrors.length > 0}
64
58
  rows={options.rows || 5}
65
- onChange={_onChange}
66
- onBlur={_onBlur}
67
- onFocus={_onFocus}
59
+ onChange={handleChange}
60
+ onBlur={handleBlur}
61
+ onFocus={handleFocus}
68
62
  aria-describedby={ariaDescribedByIds(id)}
69
63
  />
70
64
  );
@@ -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
  import { Form as SuiForm } from 'semantic-ui-react';
4
4
 
5
5
  import { generateTemplates } from '../Templates';
@@ -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
  import { Grid, Header } from 'semantic-ui-react';
3
3
 
4
4
  import { getSemanticProps } from '../util';
@@ -1,4 +1,4 @@
1
- import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2
2
 
3
3
  import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget';
4
4
  import CheckboxWidget from '../CheckboxWidget/CheckboxWidget';
@@ -1,12 +1,5 @@
1
- import {
2
- ADDITIONAL_PROPERTY_FLAG,
3
- buttonId,
4
- FormContextType,
5
- RJSFSchema,
6
- StrictRJSFSchema,
7
- TranslatableString,
8
- WrapIfAdditionalTemplateProps,
9
- } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WrapIfAdditionalTemplateProps } from '@rjsf/utils';
2
+ import { ADDITIONAL_PROPERTY_FLAG, buttonId, TranslatableString } from '@rjsf/utils';
10
3
  import { Form, Grid } from 'semantic-ui-react';
11
4
 
12
5
  /** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
@@ -64,17 +57,17 @@ export default function WrapIfAdditionalTemplate<
64
57
  className='form-group'
65
58
  hasFeedback
66
59
  fluid
67
- htmlFor={`${id}`}
60
+ htmlFor={id}
68
61
  label={displayLabel ? keyLabel : undefined}
69
62
  required={required}
70
63
  defaultValue={label}
71
64
  disabled={disabled || (readonlyAsDisabled && readonly)}
72
- id={`${id}`}
73
- name={`${id}`}
65
+ id={id}
66
+ name={id}
74
67
  onBlur={!readonly ? onKeyRenameBlur : undefined}
75
68
  style={wrapperStyle}
76
69
  type='text'
77
- ></Form.Input>
70
+ />
78
71
  </Form.Group>
79
72
  </Grid.Column>
80
73
  <Grid.Column width={7} className='form-additional' verticalAlign='middle'>
package/src/util.tsx CHANGED
@@ -1,32 +1,32 @@
1
- import { ElementType } from 'react';
2
- import {
1
+ import type { ElementType } from 'react';
2
+ import type {
3
3
  UiSchema,
4
4
  GenericObjectType,
5
- getUiOptions,
6
5
  FormContextType,
7
6
  RJSFSchema,
8
7
  StrictRJSFSchema,
9
8
  UIOptionsType,
10
9
  } from '@rjsf/utils';
10
+ import { getUiOptions } from '@rjsf/utils';
11
11
 
12
- export type SemanticPropsTypes<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = {
12
+ export interface SemanticPropsTypes<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
13
13
  formContext?: F;
14
14
  uiSchema?: UiSchema<T, S, F>;
15
15
  options?: UIOptionsType<T, S, F>;
16
16
  defaultSchemaProps?: GenericObjectType;
17
17
  defaultContextProps?: GenericObjectType;
18
- };
18
+ }
19
19
 
20
- export type SemanticErrorPropsType<
20
+ export interface SemanticErrorPropsType<
21
21
  T = any,
22
22
  S extends StrictRJSFSchema = RJSFSchema,
23
23
  F extends FormContextType = any,
24
- > = {
24
+ > {
25
25
  formContext?: F;
26
26
  uiSchema?: UiSchema<T, S, F>;
27
27
  options?: UIOptionsType<T, S, F>;
28
28
  defaultProps?: GenericObjectType;
29
- };
29
+ }
30
30
 
31
31
  export type WrapProps = GenericObjectType & {
32
32
  wrap: boolean;
@@ -55,14 +55,13 @@ export function getSemanticProps<T = any, S extends StrictRJSFSchema = RJSFSchem
55
55
  const schemaProps = getUiOptions<T, S, F>(uiSchema).semantic;
56
56
  const optionProps = options.semantic;
57
57
  // formContext props should overide other props
58
- return Object.assign(
59
- {},
60
- { ...defaultSchemaProps },
61
- { ...defaultContextProps },
62
- schemaProps,
63
- optionProps,
64
- formContextProps,
65
- );
58
+ return {
59
+ ...defaultSchemaProps,
60
+ ...defaultContextProps,
61
+ ...schemaProps,
62
+ ...optionProps,
63
+ ...formContextProps,
64
+ };
66
65
  }
67
66
 
68
67
  /**
@@ -84,12 +83,12 @@ export function getSemanticErrorProps<
84
83
  options = {},
85
84
  defaultProps = { size: 'small', pointing: 'above' },
86
85
  }: SemanticErrorPropsType<T, S, F>) {
87
- const formContextProps = formContext.semantic && formContext.semantic.errorOptions;
86
+ const formContextProps = formContext.semantic?.errorOptions;
88
87
  const semanticOptions: GenericObjectType = getUiOptions<T, S, F>(uiSchema).semantic as GenericObjectType;
89
- const schemaProps = semanticOptions && semanticOptions.errorOptions;
90
- const optionProps = options.semantic && (options.semantic as GenericObjectType).errorOptions;
88
+ const schemaProps = semanticOptions?.errorOptions;
89
+ const optionProps = (options.semantic as GenericObjectType)?.errorOptions;
91
90
 
92
- return Object.assign({}, { ...defaultProps }, schemaProps, optionProps, formContextProps);
91
+ return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
93
92
  }
94
93
 
95
94
  /**
@@ -101,7 +100,7 @@ export function getSemanticErrorProps<
101
100
  * @param {Array} omit
102
101
  * @returns {string}
103
102
  */
104
- export function cleanClassNames(classNameArr: Array<string | undefined>, omit: string[] = []) {
103
+ export function cleanClassNames(classNameArr: (string | undefined)[], omit: string[] = []) {
105
104
  // Split each arg on whitespace, and add it to an array. Skip false-y args
106
105
  // like "" and undefined.
107
106
  const classList = classNameArr