Skip to content

Commit 7b8a044

Browse files
committed
Remove unused refs.
Fix maxLength and minLength proptypes.
1 parent 6b1d9c8 commit 7b8a044

File tree

12 files changed

+7
-50
lines changed

12 files changed

+7
-50
lines changed

frontend/packages/volto-form-block/src/components/Wrappers/CheckboxGroupWrapper.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -32,7 +31,6 @@ const CheckboxGroupWrapper = (props) => {
3231
intl,
3332
} = props;
3433

35-
const ref = useRef();
3634
const CheckboxGroup =
3735
config.blocks.blocksConfig.schemaForm.innerWidgets.checkboxGroup;
3836
const Checkbox =
@@ -67,7 +65,6 @@ const CheckboxGroupWrapper = (props) => {
6765
disabled={isDisabled}
6866
onChange={(value) => onChange(id, value)}
6967
errorMessage={error ? error[0] : ''}
70-
ref={ref}
7168
onClick={() => onClick()}
7269
isInvalid={error !== undefined}
7370
>
@@ -109,7 +106,6 @@ const CheckboxGroupWrapper = (props) => {
109106
map(value, (item) => item.value),
110107
);
111108
}}
112-
ref={ref}
113109
onClick={() => onClick()}
114110
options={options.map((option) => ({
115111
value: option[0],

frontend/packages/volto-form-block/src/components/Wrappers/CheckboxWrapper.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -26,7 +25,6 @@ const CheckboxWrapper = (props) => {
2625
intl,
2726
} = props;
2827

29-
const ref = useRef();
3028
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.checkbox;
3129

3230
return (
@@ -42,7 +40,6 @@ const CheckboxWrapper = (props) => {
4240
labelRequired={intl.formatMessage(messages.required)}
4341
disabled={isDisabled}
4442
onChange={(value) => onChange(id, value === '' ? undefined : value)}
45-
ref={ref}
4643
onClick={() => onClick()}
4744
errorMessage={error ? error[0] : ''}
4845
isInvalid={error !== undefined}

frontend/packages/volto-form-block/src/components/Wrappers/DatetimeWrapper.jsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
5-
import {
6-
parseAbsolute,
7-
parseAbsoluteToLocal,
8-
parseDate,
9-
parseDateTime,
10-
} from '@internationalized/date';
4+
import { parseDate, parseDateTime } from '@internationalized/date';
115
import moment from 'moment';
126

137
import FormFieldWrapper from './FormFieldWrapper';
@@ -34,7 +28,6 @@ const DatetimeWrapper = (props) => {
3428
intl,
3529
} = props;
3630

37-
const ref = useRef();
3831
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.datetime;
3932
const onDateChange = (date) => {
4033
if (date) {
@@ -80,7 +73,6 @@ const DatetimeWrapper = (props) => {
8073
isDateOnly={widget === 'date'}
8174
onChange={onDateChange}
8275
onChangeTime={onDateChange}
83-
ref={ref}
8476
onClick={() => onClick()}
8577
errorMessage={error ? error[0] : ''}
8678
isInvalid={error}

frontend/packages/volto-form-block/src/components/Wrappers/EmailWrapper.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -28,7 +27,6 @@ const EmailWrapper = (props) => {
2827
intl,
2928
} = props;
3029

31-
const ref = useRef();
3230
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.email;
3331

3432
return (
@@ -44,7 +42,6 @@ const EmailWrapper = (props) => {
4442
disabled={isDisabled}
4543
type="email"
4644
onChange={(value) => onChange(id, value === '' ? undefined : value)}
47-
ref={ref}
4845
onClick={() => onClick()}
4946
minLength={minLength || null}
5047
maxLength={maxLength || null}
@@ -69,6 +66,6 @@ EmailWrapper.propTypes = {
6966
onClick: PropTypes.func,
7067
onEdit: PropTypes.func,
7168
onDelete: PropTypes.func,
72-
minLength: null,
73-
maxLength: null,
69+
minLength: PropTypes.string,
70+
maxLength: PropTypes.string,
7471
};

frontend/packages/volto-form-block/src/components/Wrappers/FileWrapper.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { readAsDataURL } from 'promise-file-reader';
@@ -36,7 +35,6 @@ const FileWrapper = (props) => {
3635
intl,
3736
} = props;
3837

39-
const ref = useRef();
4038
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.file;
4139

4240
return (
@@ -69,7 +67,6 @@ const FileWrapper = (props) => {
6967
deleteFilesCallback={() => {
7068
onChange(id, null);
7169
}}
72-
ref={ref}
7370
errorMessage={error ? error[0] : ''}
7471
hasError={error}
7572
isInvalid={error}

frontend/packages/volto-form-block/src/components/Wrappers/HiddenWrapper.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -28,7 +27,6 @@ const HiddenWrapper = (props) => {
2827
intl,
2928
} = props;
3029

31-
const ref = useRef();
3230
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.hidden;
3331

3432
return onEdit ? (
@@ -44,7 +42,6 @@ const HiddenWrapper = (props) => {
4442
disabled={isDisabled}
4543
placeholder={placeholder}
4644
onChange={(value) => onChange(id, value === '' ? undefined : value)}
47-
ref={ref}
4845
onClick={() => onClick()}
4946
errorMessage={error ? error[0] : ''}
5047
isInvalid={error}
@@ -56,7 +53,6 @@ const HiddenWrapper = (props) => {
5653
name={id}
5754
value={value || ''}
5855
placeholder={placeholder}
59-
ref={ref}
6056
type="hidden"
6157
/>
6258
);

frontend/packages/volto-form-block/src/components/Wrappers/NumberWrapper.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -27,7 +26,6 @@ const NumberWrapper = (props) => {
2726
intl,
2827
} = props;
2928

30-
const ref = useRef();
3129
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.number;
3230

3331
return (
@@ -44,7 +42,6 @@ const NumberWrapper = (props) => {
4442
disabled={isDisabled}
4543
placeholder={placeholder}
4644
onChange={(value) => onChange(id, value === '' ? undefined : value)}
47-
ref={ref}
4845
errorMessage={error ? error[0] : ''}
4946
isInvalid={error}
5047
onClick={() => onClick()}

frontend/packages/volto-form-block/src/components/Wrappers/RadioGroupWrapper.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -27,7 +26,6 @@ const RadioGroupWrapper = (props) => {
2726
intl,
2827
} = props;
2928

30-
const ref = useRef();
3129
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.radioGroup;
3230
const OptionWidget =
3331
config.blocks.blocksConfig.schemaForm.innerWidgets.radioGroupOption;
@@ -46,7 +44,6 @@ const RadioGroupWrapper = (props) => {
4644
labelRequired={intl.formatMessage(messages.required)}
4745
disabled={isDisabled}
4846
onChange={(value) => onChange(id, value === '' ? undefined : value)}
49-
ref={ref}
5047
onClick={() => onClick()}
5148
errorMessage={error ? error[0] : ''}
5249
isInvalid={error}

frontend/packages/volto-form-block/src/components/Wrappers/SelectWrapper.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -31,7 +30,6 @@ const SelectWrapper = (props) => {
3130
intl,
3231
} = props;
3332

34-
const ref = useRef();
3533
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.select;
3634

3735
const options = choices || [];
@@ -53,7 +51,6 @@ const SelectWrapper = (props) => {
5351
disabled={isDisabled}
5452
placeholder={intl.formatMessage(messages.select)}
5553
onChange={(value) => onChange(id, value.value)}
56-
ref={ref}
5754
errorMessage={error ? error[0] : ''}
5855
isInvalid={error}
5956
onClick={() => onClick()}

frontend/packages/volto-form-block/src/components/Wrappers/TextWrapper.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useRef } from 'react';
21
import PropTypes from 'prop-types';
32
import config from '@plone/volto/registry';
43
import { defineMessages, injectIntl } from 'react-intl';
@@ -29,7 +28,6 @@ const TextWrapper = (props) => {
2928
intl,
3029
} = props;
3130

32-
const ref = useRef();
3331
const Widget = config.blocks.blocksConfig.schemaForm.innerWidgets.text;
3432

3533
return (
@@ -45,7 +43,6 @@ const TextWrapper = (props) => {
4543
disabled={isDisabled}
4644
placeholder={placeholder}
4745
onChange={(value) => onChange(id, value === '' ? undefined : value)}
48-
ref={ref}
4946
onClick={() => onClick()}
5047
minLength={minLength || null}
5148
maxLength={maxLength || null}
@@ -70,6 +67,6 @@ TextWrapper.propTypes = {
7067
onClick: PropTypes.func,
7168
onEdit: PropTypes.func,
7269
onDelete: PropTypes.func,
73-
minLength: null,
74-
maxLength: null,
70+
minLength: PropTypes.string,
71+
maxLength: PropTypes.string,
7572
};

0 commit comments

Comments
 (0)