deps: react-bootstrap 0.31 -> 2 (Bootstrap 5 CSS deferred as debt)

Removes the largest batch of React-19-blocking warnings: the 0.31
components (Grid, FormGroup, ControlLabel, Navbar.Header/Brand, Checkbox,
SafeAnchor) all leaned on legacy context / defaultProps.

29 files converted: Grid->Container, FormGroup/ControlLabel/FormControl/
HelpBlock -> Form.Group/Label/Control/Text, Checkbox -> Form.Check (label
as prop), bsStyle->variant (default->secondary), bsSize->size,
pull-right->float-end. Custom Col.js now re-exports v2's Col; custom
NavItem.js rewritten self-contained (no SafeAnchor/createChainedFunction);
Navigation.js drops react-bootstrap Navbar (raw markup anyway).

CSS stays on Bootstrap 4 (alexwine:bootstrap-4) for now: the BS4->5 jump
is entangled with the jQuery carousel/swipe + navbar-collapse and is
tracked as separate debt in UPGRADE.md. Only .form-label needed a shim
(forms.scss). Browser-verified home carousel+navbar, signup form + terms
checkbox, login form; REST smoke byte-identical.
This commit is contained in:
vjrj 2026-07-21 12:44:46 +02:00
parent 12bdbe8fed
commit a1a1b9a801
30 changed files with 539 additions and 333 deletions

View file

@ -1,111 +1,6 @@
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import elementType from 'prop-types-extra/lib/elementType';
import { bsClass, prefix, splitBsProps } from 'react-bootstrap/lib/utils/bootstrapUtils';
import { DEVICE_SIZES } from 'react-bootstrap/lib/utils/StyleConfig';
const column = PropTypes.oneOfType([
PropTypes.oneOf(['auto']),
PropTypes.number,
]);
const propTypes = {
componentClass: elementType,
/**
* The number of columns you wish to span
*
* for Extra small devices Phones (<576px)
*
* class-prefix `col-`
*/
xs: column,
/**
* The number of columns you wish to span
*
* for Small devices Tablets (576px)
*
* class-prefix `col-sm-`
*/
sm: column,
/**
* The number of columns you wish to span
*
* for Medium devices Desktops (768px)
*
* class-prefix `col-md-`
*/
md: column,
/**
* The number of columns you wish to span
*
* for Large devices Desktops (992px)
*
* class-prefix `col-lg-`
*/
lg: column,
/**
* The number of columns you wish to span
*
* for Large devices Desktops (1200px)
*
* class-prefix `col-xl-`
*/
xl: column,
};
const defaultProps = {
componentClass: 'div',
};
class Col extends React.Component {
render() {
const { componentClass: Component, className, ...props } = this.props;
const [bsProps, elementProps] = splitBsProps(props);
const classes = [];
DEVICE_SIZES.forEach((size) => {
const propValue = elementProps[size];
if (propValue == null) return;
if (size === 'xs') {
// col and col-4
classes.push(propValue === true ?
bsProps.bsClass :
prefix(bsProps, `${propValue}`),
);
} else {
// col-md-3
classes.push(
prefix(bsProps, `${size}-${propValue}`),
);
}
delete elementProps[size];
});
if (!classes.length) {
classes.push(bsProps.bsClass); // plain 'col'
}
return (
<Component
{...elementProps}
className={classNames(className, classes)}
/>
);
}
}
Col.propTypes = propTypes;
Col.defaultProps = defaultProps;
export default bsClass('col', Col);
// The old custom Col hand-rolled Bootstrap-4/5 grid classes on top of
// react-bootstrap 0.31 internals (`bootstrapUtils`, `StyleConfig`), which no
// longer exist in react-bootstrap v2. v2's own Col produces the exact same
// `col`/`col-{size}-{n}` output for the xs/sm/md/lg/xl props we use, so we
// simply re-export it and keep every importer unchanged.
export { Col as default } from 'react-bootstrap';