From df562cff85e67a75e098eff82b61e71c461108f1 Mon Sep 17 00:00:00 2001 From: Lukas Briza Date: Thu, 16 Oct 2025 10:53:26 +0200 Subject: [PATCH] Change default properties from `null` to `undefined` (#662) --- src/components/Alert/Alert.jsx | 4 ++-- src/components/Button/Button.jsx | 10 +++++----- src/components/ButtonGroup/ButtonGroup.jsx | 2 +- src/components/Card/CardFooter.jsx | 2 +- src/components/CheckboxField/CheckboxField.jsx | 6 +++--- src/components/FileInputField/FileInputField.jsx | 6 +++--- src/components/FormLayout/FormLayout.jsx | 2 +- src/components/FormLayout/FormLayoutCustomField.jsx | 8 ++++---- src/components/Grid/Grid.jsx | 2 +- src/components/Grid/GridSpan.jsx | 2 +- src/components/InputGroup/InputGroup.jsx | 4 ++-- src/components/Modal/Modal.jsx | 12 ++++++------ src/components/Modal/ModalBody.jsx | 2 +- src/components/Modal/ModalContent.jsx | 2 +- src/components/Popover/Popover.jsx | 10 +++++----- src/components/Radio/Radio.jsx | 6 +++--- src/components/ScrollView/ScrollView.jsx | 6 +++--- src/components/SelectField/SelectField.jsx | 6 +++--- src/components/Table/Table.jsx | 2 +- .../_components/TableBodyCell/TableBodyCell.jsx | 2 +- .../_components/TableHeaderCell/TableHeaderCell.jsx | 2 +- src/components/Tabs/TabsItem.jsx | 6 +++--- src/components/Text/Text.jsx | 2 +- src/components/TextArea/TextArea.jsx | 6 +++--- src/components/TextField/TextField.jsx | 10 +++++----- src/components/Toggle/Toggle.jsx | 6 +++--- src/components/Toolbar/Toolbar.jsx | 2 +- src/components/Toolbar/ToolbarGroup.jsx | 2 +- src/components/Toolbar/ToolbarItem.jsx | 2 +- src/providers/globalProps/GlobalPropsProvider.jsx | 2 +- src/providers/translations/TranslationsProvider.jsx | 2 +- 31 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/components/Alert/Alert.jsx b/src/components/Alert/Alert.jsx index fa25e4853..3fc18f8d0 100644 --- a/src/components/Alert/Alert.jsx +++ b/src/components/Alert/Alert.jsx @@ -57,9 +57,9 @@ export const Alert = ({ Alert.defaultProps = { color: 'note', - icon: null, + icon: undefined, id: undefined, - onClose: null, + onClose: undefined, }; Alert.propTypes = { diff --git a/src/components/Button/Button.jsx b/src/components/Button/Button.jsx index 9b4499f6b..aab4628b2 100644 --- a/src/components/Button/Button.jsx +++ b/src/components/Button/Button.jsx @@ -101,18 +101,18 @@ export const Button = React.forwardRef((props, ref) => { }); Button.defaultProps = { - afterLabel: null, - beforeLabel: null, + afterLabel: undefined, + beforeLabel: undefined, block: false, color: 'primary', disabled: false, - endCorner: null, - feedbackIcon: null, + endCorner: undefined, + feedbackIcon: undefined, id: undefined, labelVisibility: 'xs', priority: 'filled', size: 'medium', - startCorner: null, + startCorner: undefined, type: 'button', }; diff --git a/src/components/ButtonGroup/ButtonGroup.jsx b/src/components/ButtonGroup/ButtonGroup.jsx index 694b1aace..b7e8f295f 100644 --- a/src/components/ButtonGroup/ButtonGroup.jsx +++ b/src/components/ButtonGroup/ButtonGroup.jsx @@ -48,7 +48,7 @@ export const ButtonGroup = ({ ButtonGroup.defaultProps = { block: false, - children: null, + children: undefined, disabled: false, priority: 'filled', size: 'medium', diff --git a/src/components/Card/CardFooter.jsx b/src/components/Card/CardFooter.jsx index 877a9f07f..5df858665 100644 --- a/src/components/Card/CardFooter.jsx +++ b/src/components/Card/CardFooter.jsx @@ -24,7 +24,7 @@ export const CardFooter = ({ }; CardFooter.defaultProps = { - children: null, + children: undefined, }; CardFooter.propTypes = { diff --git a/src/components/CheckboxField/CheckboxField.jsx b/src/components/CheckboxField/CheckboxField.jsx index d393ce5a5..a3f938e10 100644 --- a/src/components/CheckboxField/CheckboxField.jsx +++ b/src/components/CheckboxField/CheckboxField.jsx @@ -79,14 +79,14 @@ export const CheckboxField = React.forwardRef((props, ref) => { CheckboxField.defaultProps = { disabled: false, - helpText: null, + helpText: undefined, id: undefined, isLabelVisible: true, labelPosition: 'after', renderAsRequired: false, required: false, - validationState: null, - validationText: null, + validationState: undefined, + validationText: undefined, }; CheckboxField.propTypes = { diff --git a/src/components/FileInputField/FileInputField.jsx b/src/components/FileInputField/FileInputField.jsx index 7384ed22f..3d718308b 100644 --- a/src/components/FileInputField/FileInputField.jsx +++ b/src/components/FileInputField/FileInputField.jsx @@ -247,14 +247,14 @@ export const FileInputField = React.forwardRef((props, ref) => { FileInputField.defaultProps = { disabled: false, fullWidth: false, - helpText: null, + helpText: undefined, isLabelVisible: true, layout: 'vertical', multiple: false, required: false, size: 'medium', - validationState: null, - validationText: null, + validationState: undefined, + validationText: undefined, }; FileInputField.propTypes = { diff --git a/src/components/FormLayout/FormLayout.jsx b/src/components/FormLayout/FormLayout.jsx index 729ff8491..ea3eea3dc 100644 --- a/src/components/FormLayout/FormLayout.jsx +++ b/src/components/FormLayout/FormLayout.jsx @@ -68,7 +68,7 @@ export const FormLayout = ({ FormLayout.defaultProps = { autoWidth: false, - children: null, + children: undefined, fieldLayout: 'vertical', labelWidth: 'default', }; diff --git a/src/components/FormLayout/FormLayoutCustomField.jsx b/src/components/FormLayout/FormLayoutCustomField.jsx index 744549a2d..841d4eb16 100644 --- a/src/components/FormLayout/FormLayoutCustomField.jsx +++ b/src/components/FormLayout/FormLayoutCustomField.jsx @@ -80,15 +80,15 @@ export const FormLayoutCustomField = ({ }; FormLayoutCustomField.defaultProps = { - children: null, + children: undefined, disabled: false, fullWidth: false, id: undefined, - innerFieldSize: null, - label: null, + innerFieldSize: undefined, + label: undefined, labelForId: undefined, required: false, - validationState: null, + validationState: undefined, }; FormLayoutCustomField.propTypes = { diff --git a/src/components/Grid/Grid.jsx b/src/components/Grid/Grid.jsx index e8fe5ec06..12ea4f65f 100644 --- a/src/components/Grid/Grid.jsx +++ b/src/components/Grid/Grid.jsx @@ -54,7 +54,7 @@ Grid.defaultProps = { alignContent: undefined, alignItems: undefined, autoFlow: undefined, - children: null, + children: undefined, columnGap: 4, columns: '1fr', justifyContent: undefined, diff --git a/src/components/Grid/GridSpan.jsx b/src/components/Grid/GridSpan.jsx index 7f16449b7..81ee73859 100644 --- a/src/components/Grid/GridSpan.jsx +++ b/src/components/Grid/GridSpan.jsx @@ -35,7 +35,7 @@ export const GridSpan = ({ /* eslint-disable sort-keys */ GridSpan.defaultProps = { - children: null, + children: undefined, columns: 1, rows: 1, tag: 'div', diff --git a/src/components/InputGroup/InputGroup.jsx b/src/components/InputGroup/InputGroup.jsx index 5819ce3d4..cb9c93126 100644 --- a/src/components/InputGroup/InputGroup.jsx +++ b/src/components/InputGroup/InputGroup.jsx @@ -109,14 +109,14 @@ export const InputGroup = ({ }; InputGroup.defaultProps = { - children: null, + children: undefined, disabled: false, id: undefined, isLabelVisible: true, layout: 'vertical', required: false, size: 'medium', - validationTexts: null, + validationTexts: undefined, }; InputGroup.propTypes = { diff --git a/src/components/Modal/Modal.jsx b/src/components/Modal/Modal.jsx index 5948d533c..6212f22ac 100644 --- a/src/components/Modal/Modal.jsx +++ b/src/components/Modal/Modal.jsx @@ -121,7 +121,7 @@ export const Modal = ({ onMouseDown, }; - if (portalId === null) { + if (portalId === undefined) { return preRender( children, color, @@ -152,14 +152,14 @@ Modal.defaultProps = { allowCloseOnEscapeKey: true, allowPrimaryActionOnEnterKey: true, autoFocus: true, - children: null, - closeButtonRef: null, + children: undefined, + closeButtonRef: undefined, color: undefined, - dialogRef: null, - portalId: null, + dialogRef: undefined, + portalId: undefined, position: 'center', preventScrollUnderneath: window.document.body, - primaryButtonRef: null, + primaryButtonRef: undefined, size: 'medium', }; diff --git a/src/components/Modal/ModalBody.jsx b/src/components/Modal/ModalBody.jsx index 9da771369..9a7993498 100644 --- a/src/components/Modal/ModalBody.jsx +++ b/src/components/Modal/ModalBody.jsx @@ -30,7 +30,7 @@ export const ModalBody = ({ }; ModalBody.defaultProps = { - children: null, + children: undefined, scrolling: 'auto', }; diff --git a/src/components/Modal/ModalContent.jsx b/src/components/Modal/ModalContent.jsx index 0f64749e9..09347e0e5 100644 --- a/src/components/Modal/ModalContent.jsx +++ b/src/components/Modal/ModalContent.jsx @@ -24,7 +24,7 @@ export const ModalContent = ({ }; ModalContent.defaultProps = { - children: null, + children: undefined, }; ModalContent.propTypes = { diff --git a/src/components/Popover/Popover.jsx b/src/components/Popover/Popover.jsx index 74be059ee..5a5940413 100644 --- a/src/components/Popover/Popover.jsx +++ b/src/components/Popover/Popover.jsx @@ -43,7 +43,7 @@ export const Popover = React.forwardRef((props, ref) => { getRootAlignmentClassName(placement, styles), )} ref={ref} - style={placementStyle ? cleanPlacementStyle(placementStyle) : null} + style={placementStyle ? cleanPlacementStyle(placementStyle) : undefined} > {children} @@ -51,7 +51,7 @@ export const Popover = React.forwardRef((props, ref) => { ); - if (portalId === null) { + if (portalId === undefined) { return PopoverEl; } @@ -60,9 +60,9 @@ export const Popover = React.forwardRef((props, ref) => { Popover.defaultProps = { placement: 'bottom', - placementStyle: null, - popoverTargetId: null, - portalId: null, + placementStyle: undefined, + popoverTargetId: undefined, + portalId: undefined, }; Popover.propTypes = { diff --git a/src/components/Radio/Radio.jsx b/src/components/Radio/Radio.jsx index 64b0a85e8..7adc1d887 100644 --- a/src/components/Radio/Radio.jsx +++ b/src/components/Radio/Radio.jsx @@ -113,14 +113,14 @@ export const Radio = ({ Radio.defaultProps = { disabled: false, - helpText: null, + helpText: undefined, id: undefined, isLabelVisible: true, layout: 'vertical', renderAsRequired: false, required: false, - validationState: null, - validationText: null, + validationState: undefined, + validationText: undefined, value: undefined, }; diff --git a/src/components/ScrollView/ScrollView.jsx b/src/components/ScrollView/ScrollView.jsx index 02d78fc73..62a7a8111 100644 --- a/src/components/ScrollView/ScrollView.jsx +++ b/src/components/ScrollView/ScrollView.jsx @@ -297,7 +297,7 @@ ScrollView.defaultProps = { arrows: false, arrowsScrollStep: 200, autoScroll: 'off', - children: null, + children: undefined, debounce: 50, direction: 'vertical', endShadowBackground: 'linear-gradient(var(--rui-local-end-shadow-direction), rgba(255 255 255 / 1), rgba(255 255 255 / 0))', @@ -305,10 +305,10 @@ ScrollView.defaultProps = { endShadowSize: '2em', id: undefined, nextArrowColor: undefined, - nextArrowElement: null, + nextArrowElement: undefined, nextArrowInitialOffset: '-0.5rem', prevArrowColor: undefined, - prevArrowElement: null, + prevArrowElement: undefined, prevArrowInitialOffset: '-0.5rem', scrollbar: true, shadows: true, diff --git a/src/components/SelectField/SelectField.jsx b/src/components/SelectField/SelectField.jsx index 587c7635a..79e2d4ab5 100644 --- a/src/components/SelectField/SelectField.jsx +++ b/src/components/SelectField/SelectField.jsx @@ -133,15 +133,15 @@ export const SelectField = React.forwardRef((props, ref) => { SelectField.defaultProps = { disabled: false, fullWidth: false, - helpText: null, + helpText: undefined, id: undefined, isLabelVisible: true, layout: 'vertical', renderAsRequired: false, required: false, size: 'medium', - validationState: null, - validationText: null, + validationState: undefined, + validationText: undefined, variant: 'outline', }; diff --git a/src/components/Table/Table.jsx b/src/components/Table/Table.jsx index 090a8e388..6f4a02c06 100644 --- a/src/components/Table/Table.jsx +++ b/src/components/Table/Table.jsx @@ -53,7 +53,7 @@ export const Table = ({ Table.defaultProps = { id: undefined, - sort: null, + sort: undefined, }; Table.propTypes = { diff --git a/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx b/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx index 1ee1109e0..4d905175a 100644 --- a/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +++ b/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx @@ -20,7 +20,7 @@ TableBodyCell.defaultProps = { format: undefined, id: undefined, isSortingActive: false, - value: null, + value: undefined, }; TableBodyCell.propTypes = { diff --git a/src/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx b/src/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx index f182468f5..2d1045d43 100644 --- a/src/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +++ b/src/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx @@ -42,7 +42,7 @@ export const TableHeaderCell = ({ TableHeaderCell.defaultProps = { id: undefined, - sort: null, + sort: undefined, }; TableHeaderCell.propTypes = { diff --git a/src/components/Tabs/TabsItem.jsx b/src/components/Tabs/TabsItem.jsx index 12502fc66..feeae467c 100644 --- a/src/components/Tabs/TabsItem.jsx +++ b/src/components/Tabs/TabsItem.jsx @@ -45,11 +45,11 @@ export const TabsItem = ({ ); TabsItem.defaultProps = { - afterLabel: null, - beforeLabel: null, + afterLabel: undefined, + beforeLabel: undefined, id: undefined, isActive: false, - onClick: null, + onClick: undefined, }; TabsItem.propTypes = { diff --git a/src/components/Text/Text.jsx b/src/components/Text/Text.jsx index 2bcadd115..34470c987 100644 --- a/src/components/Text/Text.jsx +++ b/src/components/Text/Text.jsx @@ -42,7 +42,7 @@ export const Text = ({ Text.defaultProps = { blockLevel: false, - children: null, + children: undefined, hyphens: 'none', lines: undefined, wordWrapping: 'normal', diff --git a/src/components/TextArea/TextArea.jsx b/src/components/TextArea/TextArea.jsx index b3c7de74d..9eb17e8e2 100644 --- a/src/components/TextArea/TextArea.jsx +++ b/src/components/TextArea/TextArea.jsx @@ -93,14 +93,14 @@ export const TextArea = React.forwardRef((props, ref) => { TextArea.defaultProps = { disabled: false, fullWidth: false, - helpText: null, + helpText: undefined, id: undefined, isLabelVisible: true, layout: 'vertical', required: false, size: 'medium', - validationState: null, - validationText: null, + validationState: undefined, + validationText: undefined, variant: 'outline', }; diff --git a/src/components/TextField/TextField.jsx b/src/components/TextField/TextField.jsx index cfc40b7a5..04cb375a3 100644 --- a/src/components/TextField/TextField.jsx +++ b/src/components/TextField/TextField.jsx @@ -32,7 +32,7 @@ export const TextField = React.forwardRef((props, ref) => { } = props; const formLayoutContext = useContext(FormLayoutContext); const inputGroupContext = useContext(InputGroupContext); - const hasSmallInput = (inputSize !== null) && (inputSize <= SMALL_INPUT_SIZE); + const hasSmallInput = (inputSize !== undefined) && (inputSize <= SMALL_INPUT_SIZE); return (