diff --git a/CHANGELOG.md b/CHANGELOG.md index dfa7df10a..4e3b4f004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Make branding optional. Refs STCOR-847. * Idle-session timeout and "Keep working?" modal. Refs STCOR-776. * Implement password validation for Login Page. Refs STCOR-741. +* Avoid deprecated `defaultProps` for functional components. Refs STCOR-844.. ## [10.1.0](https://github.com/folio-org/stripes-core/tree/v10.1.0) (2024-03-12) [Full Changelog](https://github.com/folio-org/stripes-core/compare/v10.0.0...v10.1.0) diff --git a/src/components/AppIcon/AppIcon.js b/src/components/AppIcon/AppIcon.js index f861a9936..e646dd63a 100644 --- a/src/components/AppIcon/AppIcon.js +++ b/src/components/AppIcon/AppIcon.js @@ -12,18 +12,18 @@ import { withStripes } from '../../StripesContext'; import css from './AppIcon.css'; const AppIcon = ({ - iconAlignment, - iconAriaHidden, - size, + iconAlignment = 'center', + iconAriaHidden = true, + size = 'medium', icon, alt, src, style, children, className, - tag, + tag = 'span', app, - iconKey, + iconKey = 'app', iconClassName, stripes, }) => { @@ -137,12 +137,4 @@ AppIcon.propTypes = { tag: PropTypes.string, }; -AppIcon.defaultProps = { - iconAlignment: 'center', - iconAriaHidden: true, - iconKey: 'app', - size: 'medium', - tag: 'span', -}; - export default withStripes(AppIcon); diff --git a/src/components/MainNav/NavButton/NavButton.js b/src/components/MainNav/NavButton/NavButton.js index 2c80dd262..df3fbc05e 100644 --- a/src/components/MainNav/NavButton/NavButton.js +++ b/src/components/MainNav/NavButton/NavButton.js @@ -34,10 +34,6 @@ const propTypes = { to: PropTypes.string, }; -const defaultProps = { - noSelectedBar: false, -}; - const NavButton = React.forwardRef(({ ariaLabel, badge, @@ -50,7 +46,7 @@ const NavButton = React.forwardRef(({ innerClassName, label, labelClassName, - noSelectedBar, + noSelectedBar = false, onClick, open, selected, @@ -137,6 +133,5 @@ const NavButton = React.forwardRef(({ }); NavButton.propTypes = propTypes; -NavButton.defaultProps = defaultProps; export default NavButton; diff --git a/src/components/RouteErrorBoundary/RouteErrorBoundary.js b/src/components/RouteErrorBoundary/RouteErrorBoundary.js index f339f848f..8fa59f047 100644 --- a/src/components/RouteErrorBoundary/RouteErrorBoundary.js +++ b/src/components/RouteErrorBoundary/RouteErrorBoundary.js @@ -11,7 +11,7 @@ import { getEventHandlers } from '../../handlerService'; import { ModulesContext } from '../../ModulesContext'; import { StripesContext } from '../../StripesContext'; -const RouteErrorBoundary = ({ children, escapeRoute, moduleName, isSettings }) => { +const RouteErrorBoundary = ({ children, escapeRoute = '/', moduleName, isSettings }) => { const intl = useIntl(); let buttonLabelId; @@ -64,8 +64,4 @@ RouteErrorBoundary.propTypes = { isSettings: PropTypes.bool, }; -RouteErrorBoundary.defaultProps = { - escapeRoute: '/' -}; - export default RouteErrorBoundary;