diff --git a/webapp/components/ImageProgressive/index.js b/webapp/components/ImageProgressive/index.js
index 9bc84caf65..0fe3663a27 100644
--- a/webapp/components/ImageProgressive/index.js
+++ b/webapp/components/ImageProgressive/index.js
@@ -46,10 +46,4 @@ ImageProgressive.propTypes = {
src: PropTypes.string.isRequired,
}
-ImageProgressive.defaultProps = {
- alt: undefined,
- altSrc: undefined,
- className: undefined,
-}
-
export default ImageProgressive
diff --git a/webapp/components/Map/Map.js b/webapp/components/Map/Map.js
index 2088572e73..d7a720e0b7 100644
--- a/webapp/components/Map/Map.js
+++ b/webapp/components/Map/Map.js
@@ -32,7 +32,7 @@ L.Marker.prototype.options.icon = L.icon({
const INITIAL_ZOOM_LEVEL = 3
export const Map = (props) => {
- const { editable, layers, markerPoint, markerTitle, showOptions } = props
+ const { editable = false, layers = [], markerPoint, markerTitle, showOptions = true } = props
const { centerPositionLatLon, markerPointUpdated, markerPointUpdatedToString, onMarkerPointUpdated, onSaveClick } =
useMap(props)
@@ -91,13 +91,3 @@ Map.propTypes = {
onMarkerPointChange: PropTypes.func,
showOptions: PropTypes.bool,
}
-
-Map.defaultProps = {
- centerPoint: null,
- editable: false,
- layers: [],
- markerPoint: null,
- markerTitle: null,
- onMarkerPointChange: null,
- showOptions: true,
-}
diff --git a/webapp/components/Map/MapLayersControl.js b/webapp/components/Map/MapLayersControl.js
index 5b551625c3..527dd27553 100644
--- a/webapp/components/Map/MapLayersControl.js
+++ b/webapp/components/Map/MapLayersControl.js
@@ -11,7 +11,7 @@ import { useMapContext } from './MapContext'
import { WmtsComponent } from './WmtsComponent'
export const MapLayersControl = (props) => {
- const { layers } = props
+ const { layers = [] } = props
const user = useUser()
const surveyId = useSurveyId()
@@ -66,7 +66,3 @@ export const MapLayersControl = (props) => {
MapLayersControl.propTypes = {
layers: PropTypes.array,
}
-
-MapLayersControl.defaultProps = {
- layers: [],
-}
diff --git a/webapp/components/PanelRight/PanelRight.js b/webapp/components/PanelRight/PanelRight.js
index cab82a71fe..98d061584a 100644
--- a/webapp/components/PanelRight/PanelRight.js
+++ b/webapp/components/PanelRight/PanelRight.js
@@ -10,7 +10,7 @@ import { TestId } from '@webapp/utils/testId'
import { Button, ButtonIconClose } from '../buttons'
const PanelRight = (props) => {
- const { children, className, header, onClose, showFooter, width } = props
+ const { children, className, header = '', onClose, showFooter = false, width = '500px' } = props
return ReactDOM.createPortal(
{
children,
className,
header: headerProp,
- initHeight,
- initWidth,
- isOpen,
+ initHeight = 400,
+ initWidth = 600,
+ isOpen = true,
left,
onClose,
onDetach,
@@ -57,8 +58,16 @@ export const ResizableModal = (props) => {
)
}
-ResizableModal.defaultProps = {
- initHeight: 400,
- initWidth: 600,
- isOpen: true,
+ResizableModal.propTypes = {
+ children: PropTypes.node,
+ className: PropTypes.string,
+ header: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
+ initHeight: PropTypes.number,
+ initWidth: PropTypes.number,
+ isOpen: PropTypes.bool,
+ left: PropTypes.number,
+ onClose: PropTypes.func,
+ onDetach: PropTypes.func,
+ onRequestClose: PropTypes.func,
+ top: PropTypes.number,
}
diff --git a/webapp/components/ScriptEditor/ScriptEditor.js b/webapp/components/ScriptEditor/ScriptEditor.js
index 0aec982433..4502fd972a 100644
--- a/webapp/components/ScriptEditor/ScriptEditor.js
+++ b/webapp/components/ScriptEditor/ScriptEditor.js
@@ -17,7 +17,16 @@ const { snippetCompleter, textCompleter, keyWordCompleter } = aceLangTools
const defaultCompleters = [snippetCompleter, textCompleter, keyWordCompleter]
export const ScriptEditor = (props) => {
- const { name, mode, script, completer, height, width, onChange, readOnly } = props
+ const {
+ completer = null,
+ height = '200px',
+ mode,
+ name,
+ onChange,
+ readOnly = false,
+ script,
+ width = 'inherit',
+ } = props
const editorRef = useRef()
@@ -72,10 +81,3 @@ ScriptEditor.propTypes = {
onChange: PropTypes.func.isRequired,
readOnly: PropTypes.bool,
}
-
-ScriptEditor.defaultProps = {
- completer: null,
- height: '200px',
- width: 'inherit',
- readOnly: false,
-}
diff --git a/webapp/components/Slider/Slider.js b/webapp/components/Slider/Slider.js
index 6dcd07e676..3fd6daed76 100644
--- a/webapp/components/Slider/Slider.js
+++ b/webapp/components/Slider/Slider.js
@@ -39,6 +39,7 @@ Slider.propTypes = {
id: PropTypes.string.isRequired,
max: PropTypes.number,
min: PropTypes.number,
+ name: PropTypes.string,
onChange: PropTypes.func,
onMouseDown: PropTypes.func,
onMouseUp: PropTypes.func,
@@ -51,10 +52,3 @@ Slider.propTypes = {
step: PropTypes.number,
value: PropTypes.number,
}
-
-Slider.defaultProps = {
- onChange: null,
- onMouseDown: null,
- onMouseUp: null,
- options: null,
-}
diff --git a/webapp/components/form/InputChips/InputChips.js b/webapp/components/form/InputChips/InputChips.js
index b5c7630d3b..33e3ef3409 100644
--- a/webapp/components/form/InputChips/InputChips.js
+++ b/webapp/components/form/InputChips/InputChips.js
@@ -11,21 +11,21 @@ import Chip from '../chip'
const InputChips = (props) => {
const {
- className,
- idInput,
+ className = undefined,
+ disabled = false,
+ idInput = null,
+ itemLabel = 'label',
+ itemKey = 'value',
items,
- itemKey,
- itemLabel,
- selection,
- requiredItems,
- minCharactersToAutocomplete,
- readOnly,
- disabled,
+ minCharactersToAutocomplete = 0,
+ onChange = null, // Callback to receive all selection change
+ onItemAdd = null, // Callback to receive added item
+ onItemRemove = null, // Callback to receive removed item
+ placeholder = undefined,
+ readOnly = false,
+ requiredItems = 0,
+ selection = [],
validation,
- placeholder,
- onChange,
- onItemAdd,
- onItemRemove,
} = props
const { state, Actions } = useLocalState({
@@ -87,23 +87,4 @@ InputChips.propTypes = {
onItemRemove: PropTypes.func,
}
-InputChips.defaultProps = {
- className: undefined,
- idInput: null,
-
- itemLabel: 'label',
- itemKey: 'value',
- selection: [],
- requiredItems: 0,
- minCharactersToAutocomplete: 0,
- readOnly: false,
- disabled: false,
- validation: {},
- placeholder: undefined,
-
- onChange: null, // Callback to receive all selection change
- onItemAdd: null, // Callback to receive added item
- onItemRemove: null, // Callback to receive removed item
-}
-
export default InputChips
diff --git a/webapp/components/form/InputChips/InputChipsText.js b/webapp/components/form/InputChips/InputChipsText.js
index 11a76ebff5..af01bcbfdf 100644
--- a/webapp/components/form/InputChips/InputChipsText.js
+++ b/webapp/components/form/InputChips/InputChipsText.js
@@ -15,19 +15,19 @@ import Chip from '../chip'
const InputChipsText = (props) => {
const {
className,
+ disabled = false,
idInput,
- selection,
- requiredItems,
- minCharactersToAutocomplete,
- readOnly,
- disabled,
- validation,
+ isInputFieldValueValid = () => true,
+ minCharactersToAutocomplete = 0,
+ onChange = null, // Callback to receive all selection change
+ onItemAdd = null, // Callback to receive added item
+ onItemRemove = null, // Callback to receive removed item
placeholder,
+ readOnly = false,
+ requiredItems = 0,
+ selection = [],
textTransformFunction,
- isInputFieldValueValid,
- onChange,
- onItemAdd,
- onItemRemove,
+ validation = {},
} = props
const { state, Actions } = useLocalState({
@@ -95,22 +95,4 @@ InputChipsText.propTypes = {
onItemRemove: PropTypes.func,
}
-InputChipsText.defaultProps = {
- className: undefined,
- idInput: null,
-
- selection: [],
- requiredItems: 0,
- minCharactersToAutocomplete: 0,
- readOnly: false,
- disabled: false,
- validation: {},
- placeholder: undefined,
- isInputFieldValueValid: () => true,
-
- onChange: null, // Callback to receive all selection change
- onItemAdd: null, // Callback to receive added item
- onItemRemove: null, // Callback to receive removed item
-}
-
export default InputChipsText
diff --git a/webapp/components/form/InputSwitch/InputSwitch.js b/webapp/components/form/InputSwitch/InputSwitch.js
index d968b5a0d8..fe2d1da391 100644
--- a/webapp/components/form/InputSwitch/InputSwitch.js
+++ b/webapp/components/form/InputSwitch/InputSwitch.js
@@ -4,7 +4,7 @@ import ReactSwitch from 'react-switch'
import PropTypes from 'prop-types'
const InputSwitch = (props) => {
- const { checked, disabled, onChange } = props
+ const { checked, disabled = false, onChange } = props
return (
{
- const { className, label, style, testId, children } = props
+ const { className, label = '', style, testId, children } = props
const labelRef = useRef(null)
@@ -44,10 +44,3 @@ LabelWithTooltip.propTypes = {
style: PropTypes.object,
testId: PropTypes.string,
}
-
-LabelWithTooltip.defaultProps = {
- className: undefined,
- label: '',
- style: {},
- children: null,
-}
diff --git a/webapp/components/form/PasswordInput/PasswordInput.js b/webapp/components/form/PasswordInput/PasswordInput.js
index d34fadf57a..8547eda536 100644
--- a/webapp/components/form/PasswordInput/PasswordInput.js
+++ b/webapp/components/form/PasswordInput/PasswordInput.js
@@ -37,8 +37,4 @@ PasswordInput.propTypes = {
...SimpleTextInput.propTypes,
}
-PasswordInput.defaultProps = {
- ...SimpleTextInput.defaultProps,
-}
-
export default PasswordInput
diff --git a/webapp/components/survey/ButtonMetaItemAdd/ButtonMetaItemAdd.js b/webapp/components/survey/ButtonMetaItemAdd/ButtonMetaItemAdd.js
index 32e4e770b4..365eb279c5 100644
--- a/webapp/components/survey/ButtonMetaItemAdd/ButtonMetaItemAdd.js
+++ b/webapp/components/survey/ButtonMetaItemAdd/ButtonMetaItemAdd.js
@@ -47,8 +47,4 @@ ButtonMetaItemAdd.propTypes = {
metaItemType: PropTypes.string.isRequired,
}
-ButtonMetaItemAdd.defaultProps = {
- id: null,
-}
-
export default ButtonMetaItemAdd
diff --git a/webapp/components/survey/CategoryDetails/CategoryDetails.js b/webapp/components/survey/CategoryDetails/CategoryDetails.js
index dbdae86a00..18b9b86b53 100644
--- a/webapp/components/survey/CategoryDetails/CategoryDetails.js
+++ b/webapp/components/survey/CategoryDetails/CategoryDetails.js
@@ -28,7 +28,7 @@ import { State, useActions, useLocalState } from './store'
const MAX_LEVELS = 5
const CategoryDetails = (props) => {
- const { showClose, onCategoryUpdate, categoryUuid: categoryUuidProp } = props
+ const { categoryUuid: categoryUuidProp, onCategoryUpdate, showClose = true } = props
const { categoryUuid: categoryUuidParam } = useParams()
const i18n = useI18n()
@@ -229,10 +229,4 @@ CategoryDetails.propTypes = {
showClose: PropTypes.bool,
}
-CategoryDetails.defaultProps = {
- categoryUuid: null,
- onCategoryUpdate: null,
- showClose: true,
-}
-
export default CategoryDetails
diff --git a/webapp/components/survey/CategoryDetails/LevelDetails/LevelDetails.js b/webapp/components/survey/CategoryDetails/LevelDetails/LevelDetails.js
index a978064c80..be83d5f12c 100644
--- a/webapp/components/survey/CategoryDetails/LevelDetails/LevelDetails.js
+++ b/webapp/components/survey/CategoryDetails/LevelDetails/LevelDetails.js
@@ -20,7 +20,7 @@ import { State, useActions } from '../store'
import { ItemsList } from './ItemsList'
const LevelDetails = (props) => {
- const { level, single, state, setState } = props
+ const { level, single = false, state, setState } = props
const readOnly = !useAuthCanEditSurvey()
const i18n = useI18n()
@@ -110,8 +110,4 @@ LevelDetails.propTypes = {
setState: PropTypes.func.isRequired,
}
-LevelDetails.defaultProps = {
- single: false,
-}
-
export default LevelDetails
diff --git a/webapp/components/survey/CategoryList/CategoryList.js b/webapp/components/survey/CategoryList/CategoryList.js
index 927a29129d..aff55f6b4a 100644
--- a/webapp/components/survey/CategoryList/CategoryList.js
+++ b/webapp/components/survey/CategoryList/CategoryList.js
@@ -28,7 +28,7 @@ const getType = ({ category }) => {
return 'flat'
}
const CategoryList = (props) => {
- const { canSelect, onCategoryCreated, onCategoryOpen, onSelect, selectedItemUuid } = props
+ const { canSelect = false, onCategoryCreated, onCategoryOpen, onSelect, selectedItemUuid } = props
const i18n = useI18n()
@@ -174,12 +174,4 @@ CategoryList.propTypes = {
selectedItemUuid: PropTypes.string,
}
-CategoryList.defaultProps = {
- canSelect: false,
- onCategoryCreated: null,
- onCategoryOpen: null,
- onSelect: null,
- selectedItemUuid: null,
-}
-
export default CategoryList
diff --git a/webapp/components/survey/CategoryList/TableHeaderLeft/TableHeaderLeft.js b/webapp/components/survey/CategoryList/TableHeaderLeft/TableHeaderLeft.js
index e7bc803aba..87608bfb88 100644
--- a/webapp/components/survey/CategoryList/TableHeaderLeft/TableHeaderLeft.js
+++ b/webapp/components/survey/CategoryList/TableHeaderLeft/TableHeaderLeft.js
@@ -15,7 +15,7 @@ import { useAuthCanEditSurvey } from '@webapp/store/user'
import { useActions, State } from '../store'
const TableHeaderLeft = (props) => {
- const { headerProps } = props
+ const { headerProps = {} } = props
const { state, setState } = headerProps
const navigate = useNavigate()
@@ -60,8 +60,4 @@ TableHeaderLeft.propTypes = {
headerProps: PropTypes.object,
}
-TableHeaderLeft.defaultProps = {
- headerProps: {},
-}
-
export default TableHeaderLeft
diff --git a/webapp/components/survey/CategorySelector/CategorySelector.js b/webapp/components/survey/CategorySelector/CategorySelector.js
index 9c496e1ad6..b4109e6ac0 100644
--- a/webapp/components/survey/CategorySelector/CategorySelector.js
+++ b/webapp/components/survey/CategorySelector/CategorySelector.js
@@ -22,16 +22,16 @@ import ButtonMetaItemAdd, { metaItemTypes } from '@webapp/components/survey/Butt
export const CategorySelector = (props) => {
const {
- disabled,
- categoryUuid,
- validation,
- onChange,
- onCategoryLoad,
- filterFunction,
- emptySelection,
- showAdd,
- showEdit,
- showManage,
+ categoryUuid = null, // Selected categoryUuid
+ disabled = false,
+ emptySelection = false,
+ filterFunction = null,
+ onCategoryLoad = () => ({}),
+ onChange = () => ({}),
+ showAdd = true,
+ showEdit = true,
+ showManage = true,
+ validation = null,
} = props
const i18n = useI18n()
@@ -167,16 +167,3 @@ CategorySelector.propTypes = {
showEdit: PropTypes.bool,
showManage: PropTypes.bool,
}
-
-CategorySelector.defaultProps = {
- categoryUuid: null, // Selected categoryUuid
- validation: null,
- disabled: false,
- onChange: () => ({}),
- onCategoryLoad: () => ({}),
- filterFunction: null,
- emptySelection: false,
- showAdd: true,
- showEdit: true,
- showManage: true,
-}
diff --git a/webapp/components/survey/CycleSelector/CycleSelector.js b/webapp/components/survey/CycleSelector/CycleSelector.js
index 7dcc75b93a..be4897a214 100644
--- a/webapp/components/survey/CycleSelector/CycleSelector.js
+++ b/webapp/components/survey/CycleSelector/CycleSelector.js
@@ -9,7 +9,7 @@ import { useSurveyCycleKeys } from '@webapp/store/survey'
import Dropdown from '@webapp/components/form/Dropdown'
const CycleSelector = (props) => {
- const { cycleKeys: cycleKeysProp, selectedCycle, filterFunction, onChange } = props
+ const { cycleKeys: cycleKeysProp, filterFunction = A.identity, onChange = () => ({}), selectedCycle = null } = props
const i18n = useI18n()
const cycleKeysInState = useSurveyCycleKeys()
@@ -44,10 +44,4 @@ CycleSelector.propTypes = {
onChange: PropTypes.func,
}
-CycleSelector.defaultProps = {
- selectedCycle: null,
- onChange: () => ({}),
- filterFunction: A.identity,
-}
-
export default CycleSelector
diff --git a/webapp/components/survey/ExtraPropDefsEditor/ExtraPropDefsEditor.js b/webapp/components/survey/ExtraPropDefsEditor/ExtraPropDefsEditor.js
index ba1eb63d06..115d64018f 100644
--- a/webapp/components/survey/ExtraPropDefsEditor/ExtraPropDefsEditor.js
+++ b/webapp/components/survey/ExtraPropDefsEditor/ExtraPropDefsEditor.js
@@ -10,12 +10,12 @@ import { useExtraPropDefsEditor } from './useExtraPropDefsEditor'
export const ExtraPropDefsEditor = (props) => {
const {
+ canAdd = true,
extraPropDefs: extraPropDefsProp,
isExtraPropDefReadOnly,
onExtraPropDefDelete,
onExtraPropDefUpdate,
toggleEditExtraPropsPanel,
- canAdd = true,
} = props
const { i18n, extraPropDefs, readOnly, onItemAdd, onItemDelete, onItemUpdate } = useExtraPropDefsEditor({
@@ -63,7 +63,3 @@ ExtraPropDefsEditor.propTypes = {
onExtraPropDefUpdate: PropTypes.func.isRequired,
toggleEditExtraPropsPanel: PropTypes.func.isRequired,
}
-
-ExtraPropDefsEditor.defaultProps = {
- canAdd: true,
-}
diff --git a/webapp/components/survey/LabelsEditor/Label/Badge/Badge.js b/webapp/components/survey/LabelsEditor/Label/Badge/Badge.js
index fbe999b016..01d54872ce 100644
--- a/webapp/components/survey/LabelsEditor/Label/Badge/Badge.js
+++ b/webapp/components/survey/LabelsEditor/Label/Badge/Badge.js
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import { getLanguageLabel } from '@core/app/languages'
-const Badge = ({ lang, compact }) => (
+const Badge = ({ lang = '', compact = false }) => (
{compact ? lang : getLanguageLabel(lang)}
@@ -14,9 +14,4 @@ Badge.propTypes = {
compact: PropTypes.bool,
}
-Badge.defaultProps = {
- lang: '',
- compact: false,
-}
-
export default Badge
diff --git a/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionProp.js b/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionProp.js
index e78d0bdd34..ca0e6a958f 100644
--- a/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionProp.js
+++ b/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionProp.js
@@ -17,24 +17,27 @@ import ValidationTooltip from '@webapp/components/validationTooltip'
const ExpressionProp = (props) => {
const {
- qualifier,
index,
- nodeDefUuidContext,
- nodeDefUuidCurrent,
- excludeCurrentNodeDef,
- validation,
+ nodeDefUuidContext = null,
+ nodeDefUuidCurrent = null,
expression,
- applyIf,
- severity,
- showLabels,
- readOnly,
- isContextParent,
- canBeConstant,
- isBoolean,
- hideAdvanced,
- mode,
- onUpdate,
- onDelete,
+ excludeCurrentNodeDef = true,
+ qualifier,
+ validation = null,
+
+ applyIf = true, // Show apply if expression editor
+ severity = false, // Show severity (error/warning) button group
+ showLabels = false, // Show error message labels editor
+ readOnly = false,
+
+ isContextParent = false,
+ canBeConstant = false,
+ isBoolean = true,
+ hideAdvanced = false,
+ mode = Expression.modes.json,
+
+ onUpdate = () => {},
+ onDelete = () => {},
} = props
const i18n = useI18n()
@@ -149,25 +152,4 @@ ExpressionProp.propTypes = {
onDelete: PropTypes.func,
}
-ExpressionProp.defaultProps = {
- nodeDefUuidContext: null,
- nodeDefUuidCurrent: null,
- excludeCurrentNodeDef: true,
- validation: null,
-
- applyIf: true, // Show apply if expression editor
- severity: false, // Show severity (error/warning) button group
- showLabels: false, // Show error message labels editor
- readOnly: false,
-
- isContextParent: false,
- canBeConstant: false,
- isBoolean: true,
- hideAdvanced: false,
- mode: Expression.modes.json,
-
- onUpdate: () => {},
- onDelete: () => {},
-}
-
export default ExpressionProp
diff --git a/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionsProp.js b/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionsProp.js
index 7ef9560157..d5d5bf1c9c 100644
--- a/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionsProp.js
+++ b/webapp/components/survey/NodeDefDetails/ExpressionsProp/ExpressionsProp.js
@@ -16,7 +16,26 @@ import { FormItem } from '@webapp/components/form/Input'
import ExpressionProp from './ExpressionProp'
const ExpressionsProp = (props) => {
- const { excludeCurrentNodeDef, label, multiple, onChange, qualifier, validation, values } = props
+ const {
+ applyIf = true,
+ canBeConstant = false,
+ excludeCurrentNodeDef = true,
+ isBoolean = true,
+ isContextParent = false,
+ label = '',
+ mode = Expression.modes.json,
+ multiple = true,
+ nodeDefUuidContext = null,
+ nodeDefUuidCurrent = null,
+ onChange,
+ qualifier,
+ readOnly = false,
+ severity = false,
+ showLabels = false,
+ validation = null,
+ values = [],
+ ...otherProps
+ } = props
const dispatch = useDispatch()
@@ -53,27 +72,47 @@ const ExpressionsProp = (props) => {
{values.map((value, i) => (
))}
{(multiple || R.isEmpty(values)) && (
)}
@@ -82,33 +121,25 @@ const ExpressionsProp = (props) => {
}
ExpressionsProp.propTypes = {
- qualifier: PropTypes.string.isRequired, // used to generate test ids
- values: PropTypes.array, // Array of expressions
+ applyIf: PropTypes.bool,
+ canBeConstant: PropTypes.bool,
+ excludeCurrentNodeDef: PropTypes.bool,
+ expression: PropTypes.object.isRequired,
+ hideAdvanced: PropTypes.bool,
+ isBoolean: PropTypes.bool,
+ isContextParent: PropTypes.bool,
label: PropTypes.string,
- validation: PropTypes.object,
+ mode: PropTypes.oneOf([Expression.modes.json, Expression.modes.sql]),
multiple: PropTypes.bool,
- excludeCurrentNodeDef: PropTypes.bool,
+ nodeDefUuidContext: PropTypes.string,
+ nodeDefUuidCurrent: PropTypes.string,
onChange: PropTypes.func.isRequired,
-}
-
-ExpressionsProp.defaultProps = {
- label: '',
- applyIf: true,
- showLabels: false,
- severity: false,
- multiple: true,
- readOnly: false,
- mode: Expression.modes.json,
- nodeDefUuidContext: null,
- nodeDefUuidCurrent: null,
- excludeCurrentNodeDef: true,
- values: [],
-
- validation: null,
-
- isContextParent: false,
- canBeConstant: false,
- isBoolean: true,
+ qualifier: PropTypes.string.isRequired, // used to generate test ids
+ readOnly: PropTypes.bool,
+ severity: PropTypes.bool,
+ showLabels: PropTypes.bool,
+ validation: PropTypes.object,
+ values: PropTypes.array, // Array of expressions
}
export default ExpressionsProp
diff --git a/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js b/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js
index a3bd8e497b..fbb0055542 100644
--- a/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js
+++ b/webapp/views/App/views/Home/SurveyInfo/CyclesEditor/CycleEditor/DateContainer/DateContainer.js
@@ -38,8 +38,4 @@ DateContainer.propTypes = {
onChange: PropTypes.func.isRequired,
}
-DateContainer.defaultProps = {
- date: null,
-}
-
export default DateContainer
diff --git a/webapp/views/App/views/Home/SurveyInfo/LanguagesEditor/LanguagesEditor.js b/webapp/views/App/views/Home/SurveyInfo/LanguagesEditor/LanguagesEditor.js
index 0e85bb1f85..de462a2f70 100644
--- a/webapp/views/App/views/Home/SurveyInfo/LanguagesEditor/LanguagesEditor.js
+++ b/webapp/views/App/views/Home/SurveyInfo/LanguagesEditor/LanguagesEditor.js
@@ -46,8 +46,4 @@ LanguagesEditor.propTypes = {
readOnly: PropTypes.bool.isRequired,
}
-LanguagesEditor.defaultProps = {
- idInput: null,
-}
-
export default LanguagesEditor
diff --git a/webapp/views/App/views/Home/SurveyInfo/SrsEditor/SrsEditor.js b/webapp/views/App/views/Home/SurveyInfo/SrsEditor/SrsEditor.js
index 54ac27de29..5e59d7d1e9 100644
--- a/webapp/views/App/views/Home/SurveyInfo/SrsEditor/SrsEditor.js
+++ b/webapp/views/App/views/Home/SurveyInfo/SrsEditor/SrsEditor.js
@@ -51,8 +51,4 @@ SrsEditor.propTypes = {
setSrs: PropTypes.func.isRequired,
}
-SrsEditor.defaultProps = {
- validation: {},
-}
-
export default SrsEditor
diff --git a/webapp/views/App/views/Users/DropdownUserGroup/DropdownUserGroup.js b/webapp/views/App/views/Users/DropdownUserGroup/DropdownUserGroup.js
index bde9a8f915..472c2f2b29 100644
--- a/webapp/views/App/views/Users/DropdownUserGroup/DropdownUserGroup.js
+++ b/webapp/views/App/views/Users/DropdownUserGroup/DropdownUserGroup.js
@@ -12,7 +12,14 @@ import { useUser } from '@webapp/store/user'
import Dropdown from '@webapp/components/form/Dropdown'
const DropdownUserGroup = (props) => {
- const { editingLoggedUser, groupUuid, disabled, validation, onChange, showOnlySurveyGroups } = props
+ const {
+ disabled = false,
+ editingLoggedUser = false, // True if user being edited is the logged one
+ groupUuid = null,
+ onChange,
+ showOnlySurveyGroups = false,
+ validation,
+ } = props
const user = useUser()
const surveyInfo = useSurveyInfo()
@@ -45,13 +52,4 @@ DropdownUserGroup.propTypes = {
showOnlySurveyGroups: PropTypes.bool,
}
-DropdownUserGroup.defaultProps = {
- editingLoggedUser: false, // True if user being edited is the logged one
- groupUuid: null,
- disabled: false,
- validation: null,
- onChange: null,
- showOnlySurveyGroups: false,
-}
-
export default DropdownUserGroup
diff --git a/webapp/views/App/views/Users/UsersListSurvey/Row/Row.js b/webapp/views/App/views/Users/UsersListSurvey/Row/Row.js
index bf69efcbb3..485d89abdb 100644
--- a/webapp/views/App/views/Users/UsersListSurvey/Row/Row.js
+++ b/webapp/views/App/views/Users/UsersListSurvey/Row/Row.js
@@ -17,7 +17,7 @@ import ProfilePicture from '@webapp/components/profilePicture'
import { CopyInvitationLinkButton } from './CopyInvitationLinkButton'
const Row = (props) => {
- const { row: userListItem, emailVisible } = props
+ const { row: userListItem, emailVisible = false } = props
const surveyInfo = useSurveyInfo()
const surveyUuid = Survey.getUuid(surveyInfo)
const i18n = useI18n()
@@ -94,8 +94,4 @@ Row.propTypes = {
emailVisible: PropTypes.bool,
}
-Row.defaultProps = {
- emailVisible: false,
-}
-
export default Row
diff --git a/webapp/views/App/views/Users/UsersListSurvey/RowHeader/RowHeader.js b/webapp/views/App/views/Users/UsersListSurvey/RowHeader/RowHeader.js
index 5a0ede3a15..4cfb3a5e11 100644
--- a/webapp/views/App/views/Users/UsersListSurvey/RowHeader/RowHeader.js
+++ b/webapp/views/App/views/Users/UsersListSurvey/RowHeader/RowHeader.js
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import { useI18n } from '@webapp/store/system'
const RowHeader = (props) => {
- const { emailVisible } = props
+ const { emailVisible = false } = props
const i18n = useI18n()
return (
@@ -25,8 +25,4 @@ RowHeader.propTypes = {
emailVisible: PropTypes.bool,
}
-RowHeader.defaultProps = {
- emailVisible: false,
-}
-
export default RowHeader
diff --git a/webapp/views/Guest/Error/Error.js b/webapp/views/Guest/Error/Error.js
index f851791af9..0d0d2e385d 100644
--- a/webapp/views/Guest/Error/Error.js
+++ b/webapp/views/Guest/Error/Error.js
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types'
import { useI18n } from '@webapp/store/system'
const Error = (props) => {
- const { error } = props
+ const { error = null } = props
const i18n = useI18n()
if (!error) return null
@@ -16,8 +16,4 @@ Error.propTypes = {
error: PropTypes.string,
}
-Error.defaultProps = {
- error: null,
-}
-
export default Error
diff --git a/webapp/views/Guest/views/AccessRequest/AccessRequestField.js b/webapp/views/Guest/views/AccessRequest/AccessRequestField.js
index bf8eb3cc4b..cfce3de3bf 100644
--- a/webapp/views/Guest/views/AccessRequest/AccessRequestField.js
+++ b/webapp/views/Guest/views/AccessRequest/AccessRequestField.js
@@ -14,6 +14,12 @@ import { SurveyTemplateSelect } from './SurveyTemplateSelect'
import { Dropdown, EmailInput, TextInput } from '@webapp/components/form'
import ValidationTooltip from '@webapp/components/validationTooltip'
+const AccessRequestInputFieldPropTypes = {
+ field: PropTypes.object.isRequired,
+ onChange: PropTypes.func.isRequired,
+ value: PropTypes.any.isRequired,
+}
+
const CountryField = (props) => {
const { field, onChange, value } = props
@@ -32,6 +38,8 @@ const CountryField = (props) => {
)
}
+CountryField.propTypes = AccessRequestInputFieldPropTypes
+
const TemplateField = (props) => {
const { field, onChange, value } = props
@@ -42,6 +50,8 @@ const TemplateField = (props) => {
return