diff --git a/src/DonorDashboards/resources/js/app/components/select-control/index.js b/src/DonorDashboards/resources/js/app/components/select-control/index.js index 4974d178be..f641589889 100644 --- a/src/DonorDashboards/resources/js/app/components/select-control/index.js +++ b/src/DonorDashboards/resources/js/app/components/select-control/index.js @@ -11,7 +11,7 @@ import './style.scss'; import {__} from '@wordpress/i18n'; -const SelectControl = ({label, value, isLoading, onChange, options, placeholder, width, isClearable}) => { +const SelectControl = ({value, options, isLoading, label = null, onChange = null, placeholder = __('Select...', 'give'), width = null, isClearable = false}) => { if (options && options.length < 2) { return null; } @@ -107,14 +107,4 @@ SelectControl.propTypes = { isClearable: PropTypes.bool, }; -SelectControl.defaultProps = { - label: null, - value: null, - onChange: null, - options: null, - placeholder: __('Select...', 'give'), - width: null, - isClearable: false, -}; - export default SelectControl; diff --git a/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/authorize-control/index.js b/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/authorize-control/index.js index 63be2238bb..7e02984a75 100644 --- a/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/authorize-control/index.js +++ b/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/authorize-control/index.js @@ -7,7 +7,7 @@ import {useAcceptJs} from 'react-acceptjs'; import './style.scss'; -const AuthorizeControl = ({label, value, forwardedRef, gateway}) => { +const AuthorizeControl = ({label = null, value = null, forwardedRef, gateway}) => { const [cardNumber, setCardNumber] = useState(value ? value.card_number : ''); const [cardExpiryDate, setCardExpiryDate] = useState( value ? `${value.card_exp_month} \ ${value.card_exp_year}` : '', @@ -156,10 +156,4 @@ AuthorizeControl.propTypes = { onChange: PropTypes.func, }; -AuthorizeControl.defaultProps = { - label: null, - value: null, - onChange: null, -}; - export default AuthorizeControl; diff --git a/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/card-control/index.js b/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/card-control/index.js index ec3c060e32..196adc1dca 100644 --- a/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/card-control/index.js +++ b/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/card-control/index.js @@ -6,7 +6,7 @@ import {useAccentColor} from '../../../../hooks'; import './style.scss'; -const CardControl = ({label, value, forwardedRef}) => { +const CardControl = ({label = null, value = null, forwardedRef}) => { const [cardNumber, setCardNumber] = useState(value ? value.card_number : ''); const [cardExpiryDate, setCardExpiryDate] = useState( value ? `${value.card_exp_month} \ ${value.card_exp_year}` : '' @@ -124,10 +124,4 @@ CardControl.propTypes = { onChange: PropTypes.func, }; -CardControl.defaultProps = { - label: null, - value: null, - onChange: null, -}; - export default CardControl; diff --git a/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/square-control/index.js b/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/square-control/index.js index 4f757c17c2..af402787b3 100644 --- a/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/square-control/index.js +++ b/src/DonorDashboards/resources/js/app/components/subscription-manager/payment-method-control/square-control/index.js @@ -7,7 +7,7 @@ import './style.scss'; const cardTokenizeResponse = {}; let cardBrand = 'unknown'; -const SquareControl = ({label, value, forwardedRef, gateway}) => { +const SquareControl = ({label = null, value, forwardedRef, gateway}) => { const {applicationID, locationID} = gateway; @@ -78,10 +78,4 @@ SquareControl.propTypes = { onChange: PropTypes.func, }; -SquareControl.defaultProps = { - label: null, - value: null, - onChange: null, -}; - export default SquareControl; diff --git a/src/DonorDashboards/resources/js/app/components/text-control/index.js b/src/DonorDashboards/resources/js/app/components/text-control/index.js index c98aa61459..41198f465a 100644 --- a/src/DonorDashboards/resources/js/app/components/text-control/index.js +++ b/src/DonorDashboards/resources/js/app/components/text-control/index.js @@ -3,7 +3,7 @@ import {toUniqueId} from '../../utils'; import './style.scss'; -const TextControl = ({label, value, onChange, icon, type}) => { +const TextControl = ({label = null, value = '', onChange = null, icon = null, type = 'text'}) => { const id = toUniqueId(label); return ( @@ -21,12 +21,4 @@ const TextControl = ({label, value, onChange, icon, type}) => { ); }; -TextControl.defaultProps = { - label: null, - value: '', - onChange: null, - icon: null, - type: 'text', -}; - export default TextControl; diff --git a/src/DonorDashboards/resources/js/block/color-control/index.js b/src/DonorDashboards/resources/js/block/color-control/index.js index 05540e3a4a..d6d6123936 100644 --- a/src/DonorDashboards/resources/js/block/color-control/index.js +++ b/src/DonorDashboards/resources/js/block/color-control/index.js @@ -9,7 +9,7 @@ import PropTypes from 'prop-types'; const {useInstanceId} = wp.compose; const {BaseControl, ColorPalette} = wp.components; -const ColorControl = ({name, label, help, className, value, hideLabelFromVision, onChange, colors}) => { +const ColorControl = ({name, label, help, className, value, hideLabelFromVision, onChange = null, colors}) => { const instanceId = useInstanceId(ColorControl); const id = `give-color-control-${name}-${instanceId}`; return ( @@ -29,9 +29,4 @@ ColorControl.propTypes = { hideLabelFromVision: PropTypes.bool, }; -ColorControl.defaultProps = { - onChange: null, - options: null, -}; - export default ColorControl; diff --git a/src/MultiFormGoals/resources/js/components/color-control/index.js b/src/MultiFormGoals/resources/js/components/color-control/index.js index 05540e3a4a..d6d6123936 100644 --- a/src/MultiFormGoals/resources/js/components/color-control/index.js +++ b/src/MultiFormGoals/resources/js/components/color-control/index.js @@ -9,7 +9,7 @@ import PropTypes from 'prop-types'; const {useInstanceId} = wp.compose; const {BaseControl, ColorPalette} = wp.components; -const ColorControl = ({name, label, help, className, value, hideLabelFromVision, onChange, colors}) => { +const ColorControl = ({name, label, help, className, value, hideLabelFromVision, onChange = null, colors}) => { const instanceId = useInstanceId(ColorControl); const id = `give-color-control-${name}-${instanceId}`; return ( @@ -29,9 +29,4 @@ ColorControl.propTypes = { hideLabelFromVision: PropTypes.bool, }; -ColorControl.defaultProps = { - onChange: null, - options: null, -}; - export default ColorControl; diff --git a/src/MultiFormGoals/resources/js/components/date-time-control/index.js b/src/MultiFormGoals/resources/js/components/date-time-control/index.js index 4baf604e1d..1cc82b62c9 100644 --- a/src/MultiFormGoals/resources/js/components/date-time-control/index.js +++ b/src/MultiFormGoals/resources/js/components/date-time-control/index.js @@ -11,7 +11,7 @@ const {DateTimePicker, BaseControl, Button, Dropdown} = wp.components; const {__experimentalGetSettings, date} = wp.date; import { __ } from '@wordpress/i18n' -const DateTimeControl = ({name, label, help, className, value, onChange}) => { +const DateTimeControl = ({name, label, help, className, value, onChange = null}) => { const instanceId = useInstanceId(DateTimeControl); const id = `give-date-time-control-${name}-${instanceId}`; const settings = __experimentalGetSettings(); // eslint-disable-line no-restricted-syntax @@ -59,8 +59,4 @@ DateTimeControl.propTypes = { className: PropTypes.string, }; -DateTimeControl.defaultProps = { - onChange: null, -}; - export default DateTimeControl; diff --git a/src/MultiFormGoals/resources/js/components/image-control/index.js b/src/MultiFormGoals/resources/js/components/image-control/index.js index f09e7b9104..0aba95ce7c 100644 --- a/src/MultiFormGoals/resources/js/components/image-control/index.js +++ b/src/MultiFormGoals/resources/js/components/image-control/index.js @@ -11,7 +11,7 @@ const {BaseControl, Button} = wp.components; const {MediaUpload} = wp.blockEditor; import { __ } from '@wordpress/i18n' -const ImageControl = ({name, label, help, className, value, hideLabelFromVision, onChange}) => { +const ImageControl = ({name, label, help, className, value, hideLabelFromVision, onChange = null}) => { const instanceId = useInstanceId(ImageControl); const id = `give-image-control-${name}-${instanceId}`; return ( @@ -53,9 +53,4 @@ ImageControl.propTypes = { hideLabelFromVision: PropTypes.bool, }; -ImageControl.defaultProps = { - onChange: null, - options: null, -}; - export default ImageControl; diff --git a/src/MultiFormGoals/resources/js/components/multi-select-control/index.js b/src/MultiFormGoals/resources/js/components/multi-select-control/index.js index d7b58395f7..ca8f535e95 100644 --- a/src/MultiFormGoals/resources/js/components/multi-select-control/index.js +++ b/src/MultiFormGoals/resources/js/components/multi-select-control/index.js @@ -18,16 +18,16 @@ import './style.scss'; const MultiSelectControl = ({ name, - label, + label = null, help, className, - value, - placeholder, + value = null, + placeholder = `${__('Select', 'give')}...`, hideLabelFromVision, isLoading, isDisabled, - onChange, - options, + onChange = null, + options = null, }) => { const instanceId = useInstanceId(MultiSelectControl); const id = `give-multi-select-control-${name}-${instanceId}`; @@ -76,12 +76,4 @@ MultiSelectControl.propTypes = { placeholder: PropTypes.string, }; -MultiSelectControl.defaultProps = { - label: null, - value: null, - onChange: null, - placeholder: `${__('Select', 'give')}...`, - options: null, -}; - export default MultiSelectControl; diff --git a/src/MultiFormGoals/resources/js/components/server-side-render-x/index.js b/src/MultiFormGoals/resources/js/components/server-side-render-x/index.js index ac4f0f0e81..899c36f736 100644 --- a/src/MultiFormGoals/resources/js/components/server-side-render-x/index.js +++ b/src/MultiFormGoals/resources/js/components/server-side-render-x/index.js @@ -98,7 +98,20 @@ export class ServerSideRenderX extends Component { prevResponseHTML = `