@rjsf/semantic-ui 6.6.0 → 6.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/index.cjs +82 -74
  2. package/dist/index.cjs.map +3 -3
  3. package/dist/semantic-ui.esm.js +89 -119
  4. package/dist/semantic-ui.esm.js.map +3 -3
  5. package/dist/semantic-ui.umd.js +79 -72
  6. package/lib/AddButton/AddButton.d.ts +2 -2
  7. package/lib/AddButton/AddButton.js.map +1 -1
  8. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
  9. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
  10. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  11. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
  12. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
  13. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  14. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
  15. package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
  16. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  17. package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
  18. package/lib/CheckboxWidget/CheckboxWidget.js +6 -6
  19. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  20. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
  21. package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
  22. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  23. package/lib/DescriptionField/DescriptionField.d.ts +1 -1
  24. package/lib/ErrorList/ErrorList.d.ts +1 -1
  25. package/lib/ErrorList/ErrorList.js.map +1 -1
  26. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
  27. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  28. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
  29. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  30. package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
  31. package/lib/FieldTemplate/FieldTemplate.js +1 -1
  32. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  33. package/lib/GridTemplate/GridTemplate.d.ts +1 -1
  34. package/lib/IconButton/IconButton.d.ts +15 -8
  35. package/lib/IconButton/IconButton.js +14 -6
  36. package/lib/IconButton/IconButton.js.map +1 -1
  37. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
  38. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
  39. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +1 -1
  40. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  41. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
  42. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
  43. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
  44. package/lib/RadioWidget/RadioWidget.d.ts +1 -1
  45. package/lib/RadioWidget/RadioWidget.js +5 -7
  46. package/lib/RadioWidget/RadioWidget.js.map +1 -1
  47. package/lib/RangeWidget/RangeWidget.d.ts +1 -1
  48. package/lib/RangeWidget/RangeWidget.js +5 -5
  49. package/lib/RangeWidget/RangeWidget.js.map +1 -1
  50. package/lib/SelectWidget/SelectWidget.d.ts +1 -1
  51. package/lib/SelectWidget/SelectWidget.js +5 -6
  52. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  53. package/lib/SemanticUIForm/SemanticUIForm.d.ts +3 -3
  54. package/lib/SemanticUIForm/SemanticUIForm.js.map +1 -1
  55. package/lib/SubmitButton/SubmitButton.d.ts +1 -1
  56. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  57. package/lib/Templates/Templates.d.ts +1 -1
  58. package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
  59. package/lib/TextareaWidget/TextareaWidget.js +6 -6
  60. package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
  61. package/lib/Theme/Theme.d.ts +2 -2
  62. package/lib/TitleField/TitleField.d.ts +1 -1
  63. package/lib/Widgets/Widgets.d.ts +1 -1
  64. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
  65. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -2
  66. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  67. package/lib/tsconfig.tsbuildinfo +1 -1
  68. package/lib/util.d.ts +7 -7
  69. package/lib/util.js +9 -3
  70. package/lib/util.js.map +1 -1
  71. package/package.json +8 -8
  72. package/src/AddButton/AddButton.tsx +5 -3
  73. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
  74. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -10
  75. package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -20
  76. package/src/CheckboxWidget/CheckboxWidget.tsx +12 -20
  77. package/src/CheckboxesWidget/CheckboxesWidget.tsx +11 -14
  78. package/src/DescriptionField/DescriptionField.tsx +1 -1
  79. package/src/ErrorList/ErrorList.tsx +3 -1
  80. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -1
  81. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
  82. package/src/FieldTemplate/FieldTemplate.tsx +2 -8
  83. package/src/GridTemplate/GridTemplate.tsx +1 -1
  84. package/src/IconButton/IconButton.tsx +18 -8
  85. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
  86. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -12
  87. package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
  88. package/src/RadioWidget/RadioWidget.tsx +13 -16
  89. package/src/RangeWidget/RangeWidget.tsx +10 -9
  90. package/src/SelectWidget/SelectWidget.tsx +20 -18
  91. package/src/SemanticUIForm/SemanticUIForm.ts +4 -3
  92. package/src/SubmitButton/SubmitButton.tsx +2 -1
  93. package/src/Templates/Templates.ts +1 -1
  94. package/src/TextareaWidget/TextareaWidget.tsx +10 -16
  95. package/src/Theme/Theme.ts +2 -2
  96. package/src/TitleField/TitleField.tsx +1 -1
  97. package/src/Widgets/Widgets.tsx +1 -1
  98. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -13
  99. package/src/util.tsx +17 -18
@@ -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,17 @@ 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
+ } from '@rjsf/utils';
17
19
  import map from 'lodash/map';
18
- import { Form, DropdownProps, DropdownItemProps } from 'semantic-ui-react';
20
+ import type { DropdownProps, DropdownItemProps } from 'semantic-ui-react';
21
+ import { Form } from 'semantic-ui-react';
19
22
 
20
23
  import { getSemanticProps } from '../util';
21
24
 
@@ -36,7 +39,7 @@ function createDefaultValueOptionsForDropDown<S extends StrictRJSFSchema = RJSFS
36
39
  ) {
37
40
  const disabledOptions = enumDisabled || [];
38
41
  const options: DropdownItemProps[] = map(enumOptions, ({ label, value }, index) => ({
39
- disabled: disabledOptions.indexOf(value) !== -1,
42
+ disabled: disabledOptions.includes(value),
40
43
  key: label,
41
44
  text: label,
42
45
  value: enumOptionValueEncoder(value, index, format),
@@ -99,12 +102,11 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
99
102
  placeholder,
100
103
  optionValueFormat,
101
104
  );
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) =>
105
+ const handleChange = (_: SyntheticEvent<HTMLElement>, { value: enumValue }: DropdownProps) =>
106
+ onChange(enumOptionValueDecoder<S>(enumValue as string[], enumOptions, optionValueFormat, optEmptyVal));
107
+ const handleBlur = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
106
108
  onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
107
- const _onFocus = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
109
+ const handleFocus = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
108
110
  onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
109
111
  return (
110
112
  <Form.Dropdown
@@ -122,9 +124,9 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
122
124
  autoFocus={autofocus}
123
125
  readOnly={readonly}
124
126
  options={dropdownOptions}
125
- onChange={_onChange}
126
- onBlur={_onBlur}
127
- onFocus={_onFocus}
127
+ onChange={handleChange}
128
+ onBlur={handleBlur}
129
+ onFocus={handleFocus}
128
130
  aria-describedby={ariaDescribedByIds(id)}
129
131
  />
130
132
  );
@@ -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,4 +1,4 @@
1
- import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
1
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
2
2
 
3
3
  import AddButton from '../AddButton';
4
4
  import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate';
@@ -1,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>) =>
40
+ // oxlint-disable-next-line no-shadow
41
+ const handleChange = ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) =>
48
42
  onChange && onChange(value === '' ? options.emptyValue : value);
49
- const _onBlur = () => onBlur && onBlur(id, value);
50
- const _onFocus = () => onFocus && onFocus(id, value);
43
+ const handleBlur = () => onBlur && onBlur(id, value);
44
+ const handleFocus = () => onFocus && 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
  /**
@@ -89,7 +88,7 @@ export function getSemanticErrorProps<
89
88
  const schemaProps = semanticOptions && semanticOptions.errorOptions;
90
89
  const optionProps = options.semantic && (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