@rjsf/antd 5.17.0 → 5.18.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 (68) hide show
  1. package/dist/antd.esm.js +121 -138
  2. package/dist/antd.esm.js.map +3 -3
  3. package/dist/antd.umd.js +133 -139
  4. package/dist/index.js +155 -172
  5. package/dist/index.js.map +3 -3
  6. package/lib/templates/ArrayFieldItemTemplate/index.js +1 -3
  7. package/lib/templates/ArrayFieldItemTemplate/index.js.map +1 -1
  8. package/lib/templates/ArrayFieldTemplate/index.js +10 -13
  9. package/lib/templates/ArrayFieldTemplate/index.js.map +1 -1
  10. package/lib/templates/BaseInputTemplate/index.js +1 -2
  11. package/lib/templates/BaseInputTemplate/index.js.map +1 -1
  12. package/lib/templates/ErrorList/index.js +1 -3
  13. package/lib/templates/ErrorList/index.js.map +1 -1
  14. package/lib/templates/FieldTemplate/index.js +1 -1
  15. package/lib/templates/FieldTemplate/index.js.map +1 -1
  16. package/lib/templates/IconButton/index.d.ts +1 -1
  17. package/lib/templates/IconButton/index.js +1 -1
  18. package/lib/templates/IconButton/index.js.map +1 -1
  19. package/lib/templates/ObjectFieldTemplate/index.js +11 -14
  20. package/lib/templates/ObjectFieldTemplate/index.js.map +1 -1
  21. package/lib/templates/SubmitButton/index.js +1 -1
  22. package/lib/templates/SubmitButton/index.js.map +1 -1
  23. package/lib/templates/TitleField/index.js +9 -10
  24. package/lib/templates/TitleField/index.js.map +1 -1
  25. package/lib/templates/WrapIfAdditionalTemplate/index.js +1 -4
  26. package/lib/templates/WrapIfAdditionalTemplate/index.js.map +1 -1
  27. package/lib/tsconfig.tsbuildinfo +1 -1
  28. package/lib/widgets/AltDateWidget/index.js +1 -3
  29. package/lib/widgets/AltDateWidget/index.js.map +1 -1
  30. package/lib/widgets/CheckboxWidget/index.js +1 -1
  31. package/lib/widgets/CheckboxWidget/index.js.map +1 -1
  32. package/lib/widgets/CheckboxesWidget/index.js +1 -1
  33. package/lib/widgets/CheckboxesWidget/index.js.map +1 -1
  34. package/lib/widgets/DateTimeWidget/index.js +1 -1
  35. package/lib/widgets/DateTimeWidget/index.js.map +1 -1
  36. package/lib/widgets/DateWidget/index.js +1 -1
  37. package/lib/widgets/DateWidget/index.js.map +1 -1
  38. package/lib/widgets/PasswordWidget/index.js +1 -1
  39. package/lib/widgets/PasswordWidget/index.js.map +1 -1
  40. package/lib/widgets/RadioWidget/index.js +1 -1
  41. package/lib/widgets/RadioWidget/index.js.map +1 -1
  42. package/lib/widgets/RangeWidget/index.js +1 -1
  43. package/lib/widgets/RangeWidget/index.js.map +1 -1
  44. package/lib/widgets/SelectWidget/index.js +1 -1
  45. package/lib/widgets/SelectWidget/index.js.map +1 -1
  46. package/lib/widgets/TextareaWidget/index.js +1 -1
  47. package/lib/widgets/TextareaWidget/index.js.map +1 -1
  48. package/package.json +6 -6
  49. package/src/templates/ArrayFieldItemTemplate/index.tsx +1 -3
  50. package/src/templates/ArrayFieldTemplate/index.tsx +57 -64
  51. package/src/templates/BaseInputTemplate/index.tsx +1 -2
  52. package/src/templates/ErrorList/index.tsx +1 -3
  53. package/src/templates/FieldTemplate/index.tsx +1 -1
  54. package/src/templates/IconButton/index.tsx +2 -2
  55. package/src/templates/ObjectFieldTemplate/index.tsx +60 -67
  56. package/src/templates/SubmitButton/index.tsx +3 -1
  57. package/src/templates/TitleField/index.tsx +17 -22
  58. package/src/templates/WrapIfAdditionalTemplate/index.tsx +1 -4
  59. package/src/widgets/AltDateWidget/index.tsx +1 -3
  60. package/src/widgets/CheckboxWidget/index.tsx +2 -2
  61. package/src/widgets/CheckboxesWidget/index.tsx +1 -1
  62. package/src/widgets/DateTimeWidget/index.tsx +1 -1
  63. package/src/widgets/DateWidget/index.tsx +1 -1
  64. package/src/widgets/PasswordWidget/index.tsx +1 -1
  65. package/src/widgets/RadioWidget/index.tsx +1 -1
  66. package/src/widgets/RangeWidget/index.tsx +1 -1
  67. package/src/widgets/SelectWidget/index.tsx +2 -2
  68. package/src/widgets/TextareaWidget/index.tsx +1 -1
@@ -1,6 +1,7 @@
1
1
  import classNames from 'classnames';
2
- import { ConfigConsumer, ConfigConsumerProps } from 'antd/lib/config-provider/context';
3
2
  import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ import { ConfigProvider } from 'antd';
4
+ import { useContext } from 'react';
4
5
 
5
6
  /** The `TitleField` is the template to use to render the title of a field
6
7
  *
@@ -31,27 +32,21 @@ export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSch
31
32
  }
32
33
  };
33
34
 
34
- return title ? (
35
- <ConfigConsumer>
36
- {(configProps: ConfigConsumerProps) => {
37
- const { getPrefixCls } = configProps;
38
- const prefixCls = getPrefixCls('form');
39
- const labelClassName = classNames({
40
- [`${prefixCls}-item-required`]: required,
41
- [`${prefixCls}-item-no-colon`]: !colon,
42
- });
35
+ const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
36
+ const prefixCls = getPrefixCls('form');
37
+ const labelClassName = classNames({
38
+ [`${prefixCls}-item-required`]: required,
39
+ [`${prefixCls}-item-no-colon`]: !colon,
40
+ });
43
41
 
44
- return (
45
- <label
46
- className={labelClassName}
47
- htmlFor={id}
48
- onClick={handleLabelClick}
49
- title={typeof title === 'string' ? title : ''}
50
- >
51
- {labelChildren}
52
- </label>
53
- );
54
- }}
55
- </ConfigConsumer>
42
+ return title ? (
43
+ <label
44
+ className={labelClassName}
45
+ htmlFor={id}
46
+ onClick={handleLabelClick}
47
+ title={typeof title === 'string' ? title : ''}
48
+ >
49
+ {labelChildren}
50
+ </label>
56
51
  ) : null;
57
52
  }
@@ -1,8 +1,5 @@
1
1
  import { FocusEvent } from 'react';
2
- import Col from 'antd/lib/col';
3
- import Form from 'antd/lib/form';
4
- import Input from 'antd/lib/input';
5
- import Row from 'antd/lib/row';
2
+ import { Col, Row, Form, Input } from 'antd';
6
3
  import {
7
4
  ADDITIONAL_PROPERTY_FLAG,
8
5
  UI_OPTIONS_KEY,
@@ -1,7 +1,5 @@
1
1
  import { MouseEvent, useEffect, useState } from 'react';
2
- import Button from 'antd/lib/button';
3
- import Col from 'antd/lib/col';
4
- import Row from 'antd/lib/row';
2
+ import { Row, Col, Button } from 'antd';
5
3
  import {
6
4
  ariaDescribedByIds,
7
5
  getDateElementProps,
@@ -1,5 +1,5 @@
1
1
  import { FocusEvent } from 'react';
2
- import Checkbox, { CheckboxChangeEvent } from 'antd/lib/checkbox';
2
+ import { Checkbox, CheckboxProps } from 'antd';
3
3
  import {
4
4
  ariaDescribedByIds,
5
5
  labelValue,
@@ -23,7 +23,7 @@ export default function CheckboxWidget<
23
23
  const { autofocus, disabled, formContext, id, label, hideLabel, onBlur, onChange, onFocus, readonly, value } = props;
24
24
  const { readonlyAsDisabled = true } = formContext as GenericObjectType;
25
25
 
26
- const handleChange = ({ target }: CheckboxChangeEvent) => onChange(target.checked);
26
+ const handleChange: NonNullable<CheckboxProps['onChange']> = ({ target }) => onChange(target.checked);
27
27
 
28
28
  const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target.checked);
29
29
 
@@ -1,5 +1,5 @@
1
1
  import { FocusEvent } from 'react';
2
- import Checkbox from 'antd/lib/checkbox';
2
+ import { Checkbox } from 'antd';
3
3
  import {
4
4
  ariaDescribedByIds,
5
5
  enumOptionsIndexForValue,
@@ -8,7 +8,7 @@ import {
8
8
  WidgetProps,
9
9
  } from '@rjsf/utils';
10
10
 
11
- import DatePicker from 'antd/lib/date-picker';
11
+ import { DatePicker } from 'antd';
12
12
 
13
13
  const DATE_PICKER_STYLE = {
14
14
  width: '100%',
@@ -8,7 +8,7 @@ import {
8
8
  GenericObjectType,
9
9
  } from '@rjsf/utils';
10
10
 
11
- import DatePicker from 'antd/lib/date-picker';
11
+ import { DatePicker } from 'antd';
12
12
 
13
13
  const DATE_PICKER_STYLE = {
14
14
  width: '100%',
@@ -1,5 +1,5 @@
1
1
  import { ChangeEvent, FocusEvent } from 'react';
2
- import Input from 'antd/lib/input';
2
+ import { Input } from 'antd';
3
3
  import {
4
4
  ariaDescribedByIds,
5
5
  FormContextType,
@@ -1,5 +1,5 @@
1
1
  import { FocusEvent } from 'react';
2
- import Radio, { RadioChangeEvent } from 'antd/lib/radio';
2
+ import { Radio, RadioChangeEvent } from 'antd';
3
3
  import {
4
4
  ariaDescribedByIds,
5
5
  enumOptionsIndexForValue,
@@ -1,4 +1,4 @@
1
- import Slider from 'antd/lib/slider';
1
+ import { Slider } from 'antd';
2
2
  import {
3
3
  ariaDescribedByIds,
4
4
  rangeSpec,
@@ -1,4 +1,4 @@
1
- import Select, { DefaultOptionType } from 'antd/lib/select';
1
+ import { Select, SelectProps } from 'antd';
2
2
  import {
3
3
  ariaDescribedByIds,
4
4
  enumOptionsIndexForValue,
@@ -48,7 +48,7 @@ export default function SelectWidget<
48
48
 
49
49
  const handleFocus = () => onFocus(id, enumOptionsValueForIndex<S>(value, enumOptions, emptyValue));
50
50
 
51
- const filterOption = (input: string, option?: DefaultOptionType) => {
51
+ const filterOption: SelectProps['filterOption'] = (input, option) => {
52
52
  if (option && isString(option.label)) {
53
53
  // labels are strings in this context
54
54
  return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
@@ -1,5 +1,5 @@
1
1
  import { ChangeEvent, FocusEvent } from 'react';
2
- import Input from 'antd/lib/input';
2
+ import { Input } from 'antd';
3
3
  import {
4
4
  ariaDescribedByIds,
5
5
  FormContextType,