Skip to content

Commit 177922b

Browse files
authored
feat(v5): Add XXL support (#5419)
1 parent adf8eef commit 177922b

File tree

13 files changed

+62
-35
lines changed

13 files changed

+62
-35
lines changed

src/Col.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,10 @@ export interface ColProps extends BsPrefixPropsWithChildren {
3636
md?: ColSpec;
3737
lg?: ColSpec;
3838
xl?: ColSpec;
39+
xxl?: ColSpec;
3940
}
4041

41-
const DEVICE_SIZES = [
42-
'xl' as const,
43-
'lg' as const,
44-
'md' as const,
45-
'sm' as const,
46-
'xs' as const,
47-
];
42+
const DEVICE_SIZES = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'] as const;
4843
const colSize = PropTypes.oneOfType([
4944
PropTypes.bool,
5045
PropTypes.number,
@@ -108,6 +103,13 @@ const propTypes = {
108103
* @type {(boolean|"auto"|number|{ span: boolean|"auto"|number, offset: number, order: "first"|"last"|number })}
109104
*/
110105
xl: column,
106+
107+
/**
108+
* The number of columns to span on extra extra large devices (≥1400px)
109+
*
110+
* @type {(boolean|"auto"|number|{ span: boolean|"auto"|number, offset: number, order: "first"|"last"|number })}
111+
*/
112+
xxl: column,
111113
};
112114

113115
const Col: BsPrefixRefForwardingComponent<'div', ColProps> = React.forwardRef(

src/Container.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import {
99
} from './helpers';
1010

1111
export interface ContainerProps extends BsPrefixPropsWithChildren {
12-
fluid?: boolean | 'sm' | 'md' | 'lg' | 'xl';
12+
fluid?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
1313
}
1414

1515
type Container = BsPrefixRefForwardingComponent<'div', ContainerProps>;
1616

1717
const containerSizes = PropTypes.oneOfType([
1818
PropTypes.bool,
19-
PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
19+
PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
2020
]);
2121

2222
const propTypes = {
@@ -27,7 +27,7 @@ const propTypes = {
2727

2828
/**
2929
* Allow the Container to fill all of its available horizontal space.
30-
* @type {(true|"sm"|"md"|"lg"|"xl")}
30+
* @type {(true|"sm"|"md"|"lg"|"xl"|"xxl")}
3131
*/
3232
fluid: containerSizes,
3333
/**

src/ListGroup.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616

1717
export interface ListGroupProps extends BsPrefixProps {
1818
variant?: 'flush';
19-
horizontal?: boolean | 'sm' | 'md' | 'lg' | 'xl';
19+
horizontal?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
2020
activeKey?: unknown;
2121
defaultActiveKey?: unknown;
2222
onSelect?: SelectCallback;
@@ -42,11 +42,11 @@ const propTypes = {
4242
/**
4343
* Changes the flow of the list group items from vertical to horizontal.
4444
* A value of `null` (the default) sets it to vertical for all breakpoints;
45-
* Just including the prop sets it for all breakpoints, while `{sm|md|lg|xl}`
45+
* Just including the prop sets it for all breakpoints, while `{sm|md|lg|xl|xxl}`
4646
* makes the list group horizontal starting at that breakpoint’s `min-width`.
47-
* @type {(true|'sm'|'md'|'lg'|'xl')}
47+
* @type {(true|'sm'|'md'|'lg'|'xl'|'xxl')}
4848
*/
49-
horizontal: PropTypes.oneOf([true, 'sm', 'md', 'lg', 'xl', undefined]),
49+
horizontal: PropTypes.oneOf([true, 'sm', 'md', 'lg', 'xl', 'xxl', undefined]),
5050

5151
/**
5252
* You can use a custom element type for this component.

src/Modal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ export interface ModalProps
3939
| 'backdropTransition'
4040
> {
4141
size?: 'sm' | 'lg' | 'xl';
42-
fullscreen?: true | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down';
42+
fullscreen?:
43+
| true
44+
| 'sm-down'
45+
| 'md-down'
46+
| 'lg-down'
47+
| 'xl-down'
48+
| 'xxl-down';
4349
bsPrefix?: string;
4450
centered?: boolean;
4551
backdropClassName?: string;
@@ -79,7 +85,7 @@ const propTypes = {
7985
* Renders a fullscreen modal. Specifying a breakpoint will render the modal
8086
* as fullscreen __below__ the breakpoint size.
8187
*
82-
* @type (true|'sm-down'|'md-down'|'lg-down'|'xl-down')
88+
* @type (true|'sm-down'|'md-down'|'lg-down'|'xl-down'|'xxl-down')
8389
*/
8490
fullscreen: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
8591

src/ModalDialog.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ export interface ModalDialogProps
1010
extends React.HTMLAttributes<HTMLDivElement>,
1111
BsPrefixPropsWithChildren {
1212
size?: 'sm' | 'lg' | 'xl';
13-
fullscreen?: true | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down';
13+
fullscreen?:
14+
| true
15+
| 'sm-down'
16+
| 'md-down'
17+
| 'lg-down'
18+
| 'xl-down'
19+
| 'xxl-down';
1420
centered?: boolean;
1521
scrollable?: boolean;
1622
contentClassName?: string;
@@ -32,7 +38,7 @@ const propTypes = {
3238
* Renders a fullscreen modal. Specifying a breakpoint will render the modal
3339
* as fullscreen __below__ the breakpoint size.
3440
*
35-
* @type (true|'sm-down'|'md-down'|'lg-down'|'xl-down')
41+
* @type (true|'sm-down'|'md-down'|'lg-down'|'xl-down'|'xxl-down')
3642
*/
3743
fullscreen: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
3844

src/Navbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const NavbarText = createWithBsPrefix('navbar-text', {
2323

2424
export interface NavbarProps extends BsPrefixPropsWithChildren {
2525
variant?: 'light' | 'dark';
26-
expand?: boolean | 'sm' | 'md' | 'lg' | 'xl';
26+
expand?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
2727
bg?: string;
2828
fixed?: 'top' | 'bottom';
2929
sticky?: 'top' | 'bottom';
@@ -58,7 +58,7 @@ const propTypes = {
5858
* The breakpoint, below which, the Navbar will collapse.
5959
* When `true` the Navbar will always be expanded regardless of screen size.
6060
*/
61-
expand: PropTypes.oneOf([true, 'sm', 'md', 'lg', 'xl']).isRequired,
61+
expand: PropTypes.oneOf([true, 'sm', 'md', 'lg', 'xl', 'xxl']).isRequired,
6262

6363
/**
6464
* A convenience prop for adding `bg-*` utility classes since they are so commonly used here.

src/Row.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ export interface RowProps extends BsPrefixPropsWithChildren {
3333
md?: RowColumns;
3434
lg?: RowColumns;
3535
xl?: RowColumns;
36+
xxl?: RowColumns;
3637
}
3738

3839
type Row = BsPrefixRefForwardingComponent<'div', RowProps>;
3940

40-
const DEVICE_SIZES = ['xl', 'lg', 'md', 'sm', 'xs'];
41+
const DEVICE_SIZES = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'] as const;
4142
const rowColWidth = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
4243

4344
const rowColumns = PropTypes.oneOfType([
@@ -96,6 +97,14 @@ const propTypes = {
9697
* @type {(number|'auto'|{ cols: number|'auto' })}
9798
*/
9899
xl: rowColumns,
100+
101+
/**
102+
* The number of columns that will fit next to each other on extra extra large devices (≥1400px).
103+
* Use `auto` to give columns their natural widths.
104+
*
105+
* @type {(number|'auto'|{ cols: number|'auto' })}
106+
*/
107+
xxl: rowColumns,
99108
};
100109

101110
const defaultProps = {

tests/simple-types-test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,12 @@ const MegaComponent = () => (
250250
md={1}
251251
lg={1}
252252
xl={1}
253+
xxl={1}
253254
noGutters
254255
bsPrefix="row"
255256
className="justify-content-md-center"
256257
>
257-
<Col xs lg="2" bsPrefix="col">
258+
<Col xs sm md lg="2" xl xxl bsPrefix="col">
258259
1 of 3
259260
</Col>
260261
<Col md="auto">Variable width content</Col>
@@ -656,11 +657,13 @@ const MegaComponent = () => (
656657
<Modal fullscreen="md-down" />
657658
<Modal fullscreen="lg-down" />
658659
<Modal fullscreen="xl-down" />
660+
<Modal fullscreen="xxl-down" />
659661
<Modal.Dialog fullscreen />
660662
<Modal.Dialog fullscreen="sm-down" />
661663
<Modal.Dialog fullscreen="md-down" />
662664
<Modal.Dialog fullscreen="lg-down" />
663665
<Modal.Dialog fullscreen="xl-down" />
666+
<Modal.Dialog fullscreen="xxl-down" />
664667
<Modal.Dialog
665668
centered
666669
scrollable

www/src/examples/ListGroup/HorizontalResponsive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
['sm', 'md', 'lg', 'xl'].map((breakpoint, idx) => (
1+
['sm', 'md', 'lg', 'xl', 'xxl'].map((breakpoint, idx) => (
22
<ListGroup horizontal={breakpoint} className="my-2" key={idx}>
33
<ListGroup.Item>This ListGroup</ListGroup.Item>
44
<ListGroup.Item>renders horizontally</ListGroup.Item>

www/src/examples/Modal/FullScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function Example() {
2-
const values = [true, 'sm-down', 'md-down', 'lg-down', 'xl-down'];
2+
const values = [true, 'sm-down', 'md-down', 'lg-down', 'xl-down', 'xxl-down'];
33
const [fullscreen, setFullscreen] = useState(true);
44
const [show, setShow] = useState(false);
55

www/src/pages/components/list-group.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Use the `horizontal` prop to make the ListGroup render horizontally. Currently *
8989
exampleClassName={styles.listGroup}
9090
/>
9191

92-
There are responsive variants to `horizontal`: setting it to `{sm|md|lg|xl}` makes the list group horizontal starting at that breakpoint’s `min-width`.
92+
There are responsive variants to `horizontal`: setting it to `{sm|md|lg|xl|xxl}` makes the list group horizontal starting at that breakpoint’s `min-width`.
9393

9494
<ReactPlayground
9595
codeText={ListGroupHorizontalResponsive}

www/src/pages/components/navbar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ export default withLayout(function NaπvbarSection({ data }) {
102102
<p>
103103
When the container is within your navbar, its horizontal padding is
104104
removed at breakpoints lower than your specified{' '}
105-
<code>{`expand={'sm' | 'md' | 'lg' | 'xl'}`}</code> prop. This ensures
106-
we’re not doubling up on padding unnecessarily on lower viewports when
107-
your navbar is collapsed.
105+
<code>{`expand={'sm' | 'md' | 'lg' | 'xl' | 'xxl'}`}</code> prop. This
106+
ensures we’re not doubling up on padding unnecessarily on lower
107+
viewports when your navbar is collapsed.
108108
</p>
109109
<ReactPlayground codeText={ContainerInside} />
110110

www/src/pages/layout/grid.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default withLayout(function GridSection({ data }) {
6262
/>
6363
<p>
6464
You can set breakpoints for the <code>fluid</code> prop. Setting it to a
65-
breakpoint (<code>sm, md, lg, xl</code>) will set the{' '}
65+
breakpoint (<code>sm, md, lg, xl, xxl</code>) will set the{' '}
6666
<code>Container</code> as fluid until the specified breakpoint.
6767
</p>
6868
<ReactPlayground
@@ -110,9 +110,9 @@ export default withLayout(function GridSection({ data }) {
110110
Responsive grids
111111
</LinkedHeading>
112112
<p>
113-
The <code>Col</code> lets you specify column widths across 5 breakpoint
114-
sizes (xs, sm, md, lg, and xl). For every breakpoint, you can specify
115-
the amount of columns to span, or set the prop to{' '}
113+
The <code>Col</code> lets you specify column widths across 6 breakpoint
114+
sizes (xs, sm, md, lg, xl and xxl). For every breakpoint, you can
115+
specify the amount of columns to span, or set the prop to{' '}
116116
<code>{'<Col lg={true} />'}</code> for auto layout widths.
117117
</p>
118118
<ReactPlayground
@@ -158,9 +158,10 @@ export default withLayout(function GridSection({ data }) {
158158

159159
<p>
160160
The <code>Row</code> lets you specify column widths across 5 breakpoint
161-
sizes (xs, sm, md, lg, and xl). For every breakpoint, you can specify
162-
the amount of columns that will fit next to each other. You can also
163-
specify <code>auto</code> to set the columns to their natural widths.
161+
sizes (xs, sm, md, lg, xl and xxl). For every breakpoint, you can
162+
specify the amount of columns that will fit next to each other. You can
163+
also specify <code>auto</code> to set the columns to their natural
164+
widths.
164165
</p>
165166
<ReactPlayground
166167
codeText={GridRowColLayout}

0 commit comments

Comments
 (0)