react-bootstrap 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/AccordionCollapse.d.ts +3 -0
- package/cjs/AccordionCollapse.js +3 -0
- package/cjs/CardImg.d.ts +1 -1
- package/cjs/Carousel.d.ts +1 -1
- package/cjs/CloseButton.d.ts +1 -1
- package/cjs/Col.js +2 -1
- package/cjs/Dropdown.d.ts +0 -1
- package/cjs/DropdownButton.d.ts +1 -0
- package/cjs/DropdownButton.js +9 -0
- package/cjs/Form.d.ts +1 -0
- package/cjs/FormCheck.d.ts +1 -0
- package/cjs/FormCheck.js +2 -1
- package/cjs/ListGroup.d.ts +1 -1
- package/cjs/Nav.d.ts +1 -1
- package/cjs/Navbar.d.ts +1 -1
- package/cjs/NavbarOffcanvas.js +4 -57
- package/cjs/Offcanvas.d.ts +2 -0
- package/cjs/Offcanvas.js +44 -32
- package/cjs/Overlay.d.ts +2 -7
- package/cjs/Overlay.js +18 -1
- package/cjs/OverlayTrigger.d.ts +2 -0
- package/cjs/Popover.d.ts +2 -2
- package/cjs/Row.js +2 -1
- package/cjs/SplitButton.d.ts +1 -0
- package/cjs/SplitButton.js +9 -0
- package/cjs/Stack.js +3 -1
- package/cjs/Table.d.ts +1 -1
- package/cjs/Table.js +1 -1
- package/cjs/Tabs.d.ts +10 -2
- package/cjs/ThemeProvider.d.ts +4 -1
- package/cjs/ThemeProvider.js +16 -3
- package/cjs/ToggleButtonGroup.js +1 -1
- package/cjs/Tooltip.d.ts +2 -2
- package/cjs/createUtilityClasses.d.ts +1 -1
- package/cjs/createUtilityClasses.js +2 -2
- package/cjs/types.d.ts +7 -0
- package/dist/react-bootstrap.js +594 -305
- package/dist/react-bootstrap.min.js +1 -1
- package/esm/AccordionCollapse.d.ts +3 -0
- package/esm/AccordionCollapse.js +4 -0
- package/esm/CardImg.d.ts +1 -1
- package/esm/Carousel.d.ts +1 -1
- package/esm/CloseButton.d.ts +1 -1
- package/esm/Col.js +3 -2
- package/esm/Dropdown.d.ts +0 -1
- package/esm/DropdownButton.d.ts +1 -0
- package/esm/DropdownButton.js +9 -0
- package/esm/Form.d.ts +1 -0
- package/esm/FormCheck.d.ts +1 -0
- package/esm/FormCheck.js +2 -1
- package/esm/ListGroup.d.ts +1 -1
- package/esm/Nav.d.ts +1 -1
- package/esm/Navbar.d.ts +1 -1
- package/esm/NavbarOffcanvas.js +4 -54
- package/esm/Offcanvas.d.ts +2 -0
- package/esm/Offcanvas.js +46 -33
- package/esm/Overlay.d.ts +2 -7
- package/esm/Overlay.js +15 -1
- package/esm/OverlayTrigger.d.ts +2 -0
- package/esm/Popover.d.ts +2 -2
- package/esm/Row.js +3 -2
- package/esm/SplitButton.d.ts +1 -0
- package/esm/SplitButton.js +9 -0
- package/esm/Stack.js +4 -2
- package/esm/Table.d.ts +1 -1
- package/esm/Table.js +1 -1
- package/esm/Tabs.d.ts +10 -2
- package/esm/ThemeProvider.d.ts +4 -1
- package/esm/ThemeProvider.js +12 -2
- package/esm/ToggleButtonGroup.js +1 -1
- package/esm/Tooltip.d.ts +2 -2
- package/esm/createUtilityClasses.d.ts +1 -1
- package/esm/createUtilityClasses.js +3 -3
- package/esm/types.d.ts +7 -0
- package/package.json +2 -2
|
@@ -3,5 +3,8 @@ import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
|
|
|
3
3
|
export interface AccordionCollapseProps extends BsPrefixProps, CollapseProps {
|
|
4
4
|
eventKey: string;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* This component accepts all of [`Collapse`'s props](/utilities/transitions/#collapse-props).
|
|
8
|
+
*/
|
|
6
9
|
declare const AccordionCollapse: BsPrefixRefForwardingComponent<'div', AccordionCollapseProps>;
|
|
7
10
|
export default AccordionCollapse;
|
package/esm/AccordionCollapse.js
CHANGED
|
@@ -5,6 +5,10 @@ import { useBootstrapPrefix } from './ThemeProvider';
|
|
|
5
5
|
import Collapse from './Collapse';
|
|
6
6
|
import AccordionContext, { isAccordionItemSelected } from './AccordionContext';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This component accepts all of [`Collapse`'s props](/utilities/transitions/#collapse-props).
|
|
11
|
+
*/
|
|
8
12
|
const AccordionCollapse = /*#__PURE__*/React.forwardRef(({
|
|
9
13
|
as: Component = 'div',
|
|
10
14
|
bsPrefix,
|
package/esm/CardImg.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
3
|
export interface CardImgProps extends BsPrefixProps, React.ImgHTMLAttributes<HTMLImageElement> {
|
|
4
|
-
variant?: 'top' | 'bottom';
|
|
4
|
+
variant?: 'top' | 'bottom' | string;
|
|
5
5
|
}
|
|
6
6
|
declare const CardImg: BsPrefixRefForwardingComponent<'img', CardImgProps>;
|
|
7
7
|
export default CardImg;
|
package/esm/Carousel.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
|
-
export declare type CarouselVariant = 'dark';
|
|
3
|
+
export declare type CarouselVariant = 'dark' | string;
|
|
4
4
|
export interface CarouselRef {
|
|
5
5
|
element?: HTMLElement;
|
|
6
6
|
prev: (e?: React.SyntheticEvent) => void;
|
package/esm/CloseButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare type CloseButtonVariant = 'white';
|
|
2
|
+
export declare type CloseButtonVariant = 'white' | string;
|
|
3
3
|
export interface CloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
4
|
variant?: CloseButtonVariant;
|
|
5
5
|
}
|
package/esm/Col.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
|
|
3
|
+
import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
export function useCol({
|
|
6
6
|
as,
|
|
@@ -10,6 +10,7 @@ export function useCol({
|
|
|
10
10
|
}) {
|
|
11
11
|
bsPrefix = useBootstrapPrefix(bsPrefix, 'col');
|
|
12
12
|
const breakpoints = useBootstrapBreakpoints();
|
|
13
|
+
const minBreakpoint = useBootstrapMinBreakpoint();
|
|
13
14
|
const spans = [];
|
|
14
15
|
const classes = [];
|
|
15
16
|
breakpoints.forEach(brkPoint => {
|
|
@@ -29,7 +30,7 @@ export function useCol({
|
|
|
29
30
|
span = propValue;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
const infix = brkPoint !==
|
|
33
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
33
34
|
if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
|
|
34
35
|
if (order != null) classes.push(`order${infix}-${order}`);
|
|
35
36
|
if (offset != null) classes.push(`offset${infix}-${offset}`);
|
package/esm/Dropdown.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { AlignType } from './types';
|
|
|
6
6
|
export interface DropdownProps extends BaseDropdownProps, BsPrefixProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'children'> {
|
|
7
7
|
drop?: DropDirection;
|
|
8
8
|
align?: AlignType;
|
|
9
|
-
flip?: boolean;
|
|
10
9
|
focusFirstItemOnShow?: boolean | 'keyboard';
|
|
11
10
|
navbar?: boolean;
|
|
12
11
|
autoClose?: boolean | 'outside' | 'inside';
|
package/esm/DropdownButton.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface DropdownButtonProps extends Omit<DropdownProps, 'title'>, Props
|
|
|
9
9
|
renderMenuOnMount?: boolean;
|
|
10
10
|
rootCloseEvent?: 'click' | 'mousedown';
|
|
11
11
|
menuVariant?: DropdownMenuVariant;
|
|
12
|
+
flip?: boolean;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* A convenience component for simple or general use dropdowns. Renders a `Button` toggle and all `children`
|
package/esm/DropdownButton.js
CHANGED
|
@@ -54,6 +54,13 @@ const propTypes = {
|
|
|
54
54
|
*/
|
|
55
55
|
menuVariant: PropTypes.oneOf(['dark']),
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to
|
|
59
|
+
* Popper.js's flip [docs](https://popper.js.org/docs/v2/modifiers/flip/).
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
flip: PropTypes.bool,
|
|
63
|
+
|
|
57
64
|
/** @ignore */
|
|
58
65
|
bsPrefix: PropTypes.string,
|
|
59
66
|
|
|
@@ -86,6 +93,7 @@ const DropdownButton = /*#__PURE__*/React.forwardRef(({
|
|
|
86
93
|
href,
|
|
87
94
|
id,
|
|
88
95
|
menuVariant,
|
|
96
|
+
flip,
|
|
89
97
|
...props
|
|
90
98
|
}, ref) => /*#__PURE__*/_jsxs(Dropdown, {
|
|
91
99
|
ref: ref,
|
|
@@ -103,6 +111,7 @@ const DropdownButton = /*#__PURE__*/React.forwardRef(({
|
|
|
103
111
|
renderOnMount: renderMenuOnMount,
|
|
104
112
|
rootCloseEvent: rootCloseEvent,
|
|
105
113
|
variant: menuVariant,
|
|
114
|
+
flip: flip,
|
|
106
115
|
children: children
|
|
107
116
|
})]
|
|
108
117
|
}));
|
package/esm/Form.d.ts
CHANGED
|
@@ -291,6 +291,7 @@ declare const _default: BsPrefixRefForwardingComponent<"form", FormProps> & {
|
|
|
291
291
|
bsPrefix?: string | undefined;
|
|
292
292
|
height?: string | number | undefined;
|
|
293
293
|
width?: string | number | undefined;
|
|
294
|
+
reverse?: boolean | undefined;
|
|
294
295
|
size?: number | undefined;
|
|
295
296
|
multiple?: boolean | undefined;
|
|
296
297
|
as?: React.ElementType<any> | undefined;
|
package/esm/FormCheck.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
|
4
4
|
export declare type FormCheckType = 'checkbox' | 'radio' | 'switch';
|
|
5
5
|
export interface FormCheckProps extends BsPrefixProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
6
6
|
inline?: boolean;
|
|
7
|
+
reverse?: boolean;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
label?: React.ReactNode;
|
|
9
10
|
type?: FormCheckType;
|
package/esm/FormCheck.js
CHANGED
|
@@ -15,6 +15,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
15
15
|
bsPrefix,
|
|
16
16
|
bsSwitchPrefix,
|
|
17
17
|
inline = false,
|
|
18
|
+
reverse = false,
|
|
18
19
|
disabled = false,
|
|
19
20
|
isValid = false,
|
|
20
21
|
isInvalid = false,
|
|
@@ -54,7 +55,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
54
55
|
value: innerFormContext,
|
|
55
56
|
children: /*#__PURE__*/_jsx("div", {
|
|
56
57
|
style: style,
|
|
57
|
-
className: classNames(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, type === 'switch' && bsSwitchPrefix),
|
|
58
|
+
className: classNames(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, reverse && `${bsPrefix}-reverse`, type === 'switch' && bsSwitchPrefix),
|
|
58
59
|
children: children || /*#__PURE__*/_jsxs(_Fragment, {
|
|
59
60
|
children: [input, hasLabel && /*#__PURE__*/_jsx(FormCheckLabel, {
|
|
60
61
|
title: title,
|
package/esm/ListGroup.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { NavProps as BaseNavProps } from '@restart/ui/Nav';
|
|
|
2
2
|
import { EventKey } from '@restart/ui/types';
|
|
3
3
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
4
4
|
export interface ListGroupProps extends BsPrefixProps, BaseNavProps {
|
|
5
|
-
variant?: 'flush';
|
|
5
|
+
variant?: 'flush' | string;
|
|
6
6
|
horizontal?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
7
7
|
defaultActiveKey?: EventKey;
|
|
8
8
|
numbered?: boolean;
|
package/esm/Nav.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
|
4
4
|
export interface NavProps extends BsPrefixProps, BaseNavProps {
|
|
5
5
|
navbarBsPrefix?: string;
|
|
6
6
|
cardHeaderBsPrefix?: string;
|
|
7
|
-
variant?: 'tabs' | 'pills';
|
|
7
|
+
variant?: 'tabs' | 'pills' | string;
|
|
8
8
|
defaultActiveKey?: EventKey;
|
|
9
9
|
fill?: boolean;
|
|
10
10
|
justify?: boolean;
|
package/esm/Navbar.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { SelectCallback } from '@restart/ui/types';
|
|
3
3
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
4
4
|
export interface NavbarProps extends BsPrefixProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
5
|
-
variant?: 'light' | 'dark';
|
|
5
|
+
variant?: 'light' | 'dark' | string;
|
|
6
6
|
expand?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
7
7
|
bg?: string;
|
|
8
8
|
fixed?: 'top' | 'bottom';
|
package/esm/NavbarOffcanvas.js
CHANGED
|
@@ -1,65 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
|
-
import useBreakpoint from '@restart/hooks/useBreakpoint';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { useBootstrapPrefix } from './ThemeProvider';
|
|
6
3
|
import Offcanvas from './Offcanvas';
|
|
7
4
|
import NavbarContext from './NavbarContext';
|
|
8
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef(({
|
|
10
|
-
className,
|
|
11
|
-
bsPrefix,
|
|
12
|
-
backdrop,
|
|
13
|
-
backdropClassName,
|
|
14
|
-
keyboard,
|
|
15
|
-
scroll,
|
|
16
|
-
placement,
|
|
17
|
-
autoFocus,
|
|
18
|
-
enforceFocus,
|
|
19
|
-
restoreFocus,
|
|
20
|
-
restoreFocusOptions,
|
|
21
|
-
onShow,
|
|
22
|
-
onHide,
|
|
23
|
-
onEscapeKeyDown,
|
|
24
|
-
onEnter,
|
|
25
|
-
onEntering,
|
|
26
|
-
onEntered,
|
|
27
|
-
onExit,
|
|
28
|
-
onExiting,
|
|
29
|
-
onExited,
|
|
30
|
-
...props
|
|
31
|
-
}, ref) => {
|
|
6
|
+
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
32
7
|
const context = useContext(NavbarContext);
|
|
33
|
-
|
|
34
|
-
const hasExpandProp = typeof (context == null ? void 0 : context.expand) === 'string';
|
|
35
|
-
const shouldExpand = useBreakpoint(hasExpandProp ? context.expand : 'xs', 'up');
|
|
36
|
-
return hasExpandProp && shouldExpand ? /*#__PURE__*/_jsx("div", {
|
|
37
|
-
ref: ref,
|
|
38
|
-
...props,
|
|
39
|
-
className: classNames(className, bsPrefix, `${bsPrefix}-${placement}`)
|
|
40
|
-
}) : /*#__PURE__*/_jsx(Offcanvas, {
|
|
8
|
+
return /*#__PURE__*/_jsx(Offcanvas, {
|
|
41
9
|
ref: ref,
|
|
42
10
|
show: !!(context != null && context.expanded),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
backdropClassName: backdropClassName,
|
|
46
|
-
keyboard: keyboard,
|
|
47
|
-
scroll: scroll,
|
|
48
|
-
placement: placement,
|
|
49
|
-
autoFocus: autoFocus,
|
|
50
|
-
enforceFocus: enforceFocus,
|
|
51
|
-
restoreFocus: restoreFocus,
|
|
52
|
-
restoreFocusOptions: restoreFocusOptions,
|
|
53
|
-
onShow: onShow,
|
|
54
|
-
onHide: onHide,
|
|
55
|
-
onEscapeKeyDown: onEscapeKeyDown,
|
|
56
|
-
onEnter: onEnter,
|
|
57
|
-
onEntering: onEntering,
|
|
58
|
-
onEntered: onEntered,
|
|
59
|
-
onExit: onExit,
|
|
60
|
-
onExiting: onExiting,
|
|
61
|
-
onExited: onExited,
|
|
62
|
-
...props
|
|
11
|
+
...props,
|
|
12
|
+
renderStaticNode: true
|
|
63
13
|
});
|
|
64
14
|
});
|
|
65
15
|
NavbarOffcanvas.displayName = 'NavbarOffcanvas';
|
package/esm/Offcanvas.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface OffcanvasProps extends Omit<BaseModalProps, 'role' | 'renderBac
|
|
|
7
7
|
backdropClassName?: string;
|
|
8
8
|
scroll?: boolean;
|
|
9
9
|
placement?: OffcanvasPlacement;
|
|
10
|
+
responsive?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | string;
|
|
11
|
+
renderStaticNode?: boolean;
|
|
10
12
|
}
|
|
11
13
|
declare const _default: BsPrefixRefForwardingComponent<"div", OffcanvasProps> & {
|
|
12
14
|
Body: BsPrefixRefForwardingComponent<"div", unknown>;
|
package/esm/Offcanvas.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
+
import useBreakpoint from '@restart/hooks/useBreakpoint';
|
|
2
3
|
import useEventCallback from '@restart/hooks/useEventCallback';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
import { useCallback, useContext, useMemo, useRef } from 'react';
|
|
5
|
+
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
6
|
import BaseModal from '@restart/ui/Modal';
|
|
6
7
|
import Fade from './Fade';
|
|
7
8
|
import OffcanvasBody from './OffcanvasBody';
|
|
@@ -13,6 +14,8 @@ import OffcanvasTitle from './OffcanvasTitle';
|
|
|
13
14
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
14
15
|
import BootstrapModalManager, { getSharedManager } from './BootstrapModalManager';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
19
|
const defaultProps = {
|
|
17
20
|
show: false,
|
|
18
21
|
backdrop: true,
|
|
@@ -21,7 +24,8 @@ const defaultProps = {
|
|
|
21
24
|
autoFocus: true,
|
|
22
25
|
enforceFocus: true,
|
|
23
26
|
restoreFocus: true,
|
|
24
|
-
placement: 'start'
|
|
27
|
+
placement: 'start',
|
|
28
|
+
renderStaticNode: false
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
function DialogTransition(props) {
|
|
@@ -40,6 +44,7 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
40
44
|
children,
|
|
41
45
|
'aria-labelledby': ariaLabelledby,
|
|
42
46
|
placement,
|
|
47
|
+
responsive,
|
|
43
48
|
|
|
44
49
|
/* BaseModal props */
|
|
45
50
|
show,
|
|
@@ -62,6 +67,7 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
62
67
|
onExited,
|
|
63
68
|
backdropClassName,
|
|
64
69
|
manager: propsManager,
|
|
70
|
+
renderStaticNode,
|
|
65
71
|
...props
|
|
66
72
|
}, ref) => {
|
|
67
73
|
const modalManager = useRef();
|
|
@@ -69,6 +75,13 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
69
75
|
const {
|
|
70
76
|
onToggle
|
|
71
77
|
} = useContext(NavbarContext) || {};
|
|
78
|
+
const [showOffcanvas, setShowOffcanvas] = useState(false);
|
|
79
|
+
const hideResponsiveOffcanvas = useBreakpoint(responsive || 'xs', 'up');
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
// Handles the case where screen is resized while the responsive
|
|
82
|
+
// offcanvas is shown. If `responsive` not provided, just use `show`.
|
|
83
|
+
setShowOffcanvas(responsive ? show && !hideResponsiveOffcanvas : show);
|
|
84
|
+
}, [show, responsive, hideResponsiveOffcanvas]);
|
|
72
85
|
const handleHide = useEventCallback(() => {
|
|
73
86
|
onToggle == null ? void 0 : onToggle();
|
|
74
87
|
onHide == null ? void 0 : onHide();
|
|
@@ -106,42 +119,42 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
106
119
|
className: classNames(`${bsPrefix}-backdrop`, backdropClassName)
|
|
107
120
|
}), [backdropClassName, bsPrefix]);
|
|
108
121
|
|
|
109
|
-
const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", {
|
|
110
|
-
role: "dialog",
|
|
111
|
-
...dialogProps,
|
|
122
|
+
const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", { ...dialogProps,
|
|
112
123
|
...props,
|
|
113
|
-
className: classNames(className, bsPrefix, `${bsPrefix}-${placement}`),
|
|
124
|
+
className: classNames(className, responsive ? `${bsPrefix}-${responsive}` : bsPrefix, `${bsPrefix}-${placement}`),
|
|
114
125
|
"aria-labelledby": ariaLabelledby,
|
|
115
126
|
children: children
|
|
116
127
|
});
|
|
117
128
|
|
|
118
|
-
return /*#__PURE__*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
129
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
130
|
+
children: [!showOffcanvas && (responsive || renderStaticNode) && renderDialog({}), /*#__PURE__*/_jsx(ModalContext.Provider, {
|
|
131
|
+
value: modalContext,
|
|
132
|
+
children: /*#__PURE__*/_jsx(BaseModal, {
|
|
133
|
+
show: showOffcanvas,
|
|
134
|
+
ref: ref,
|
|
135
|
+
backdrop: backdrop,
|
|
136
|
+
container: container,
|
|
137
|
+
keyboard: keyboard,
|
|
138
|
+
autoFocus: autoFocus,
|
|
139
|
+
enforceFocus: enforceFocus && !scroll,
|
|
140
|
+
restoreFocus: restoreFocus,
|
|
141
|
+
restoreFocusOptions: restoreFocusOptions,
|
|
142
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
143
|
+
onShow: onShow,
|
|
144
|
+
onHide: handleHide,
|
|
145
|
+
onEnter: handleEnter,
|
|
146
|
+
onEntering: onEntering,
|
|
147
|
+
onEntered: onEntered,
|
|
148
|
+
onExit: onExit,
|
|
149
|
+
onExiting: onExiting,
|
|
150
|
+
onExited: handleExited,
|
|
151
|
+
manager: getModalManager(),
|
|
152
|
+
transition: DialogTransition,
|
|
153
|
+
backdropTransition: BackdropTransition,
|
|
154
|
+
renderBackdrop: renderBackdrop,
|
|
155
|
+
renderDialog: renderDialog
|
|
156
|
+
})
|
|
157
|
+
})]
|
|
145
158
|
});
|
|
146
159
|
});
|
|
147
160
|
Offcanvas.displayName = 'Offcanvas';
|
package/esm/Overlay.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OverlayProps as BaseOverlayProps, OverlayArrowProps } from '@restart/ui/Overlay';
|
|
3
3
|
import { TransitionType } from './helpers';
|
|
4
|
-
import { Placement, RootCloseEvent } from './types';
|
|
4
|
+
import { Placement, PopperRef, RootCloseEvent } from './types';
|
|
5
5
|
export interface OverlayInjectedProps {
|
|
6
6
|
ref: React.RefCallback<HTMLElement>;
|
|
7
7
|
style: React.CSSProperties;
|
|
@@ -9,12 +9,7 @@ export interface OverlayInjectedProps {
|
|
|
9
9
|
arrowProps: Partial<OverlayArrowProps>;
|
|
10
10
|
show: boolean;
|
|
11
11
|
placement: Placement | undefined;
|
|
12
|
-
popper:
|
|
13
|
-
state: any;
|
|
14
|
-
outOfBoundaries: boolean;
|
|
15
|
-
placement: Placement | undefined;
|
|
16
|
-
scheduleUpdate?: () => void;
|
|
17
|
-
};
|
|
12
|
+
popper: PopperRef;
|
|
18
13
|
[prop: string]: any;
|
|
19
14
|
}
|
|
20
15
|
export declare type OverlayChildren = React.ReactElement<OverlayInjectedProps> | ((injected: OverlayInjectedProps) => React.ReactNode);
|
package/esm/Overlay.js
CHANGED
|
@@ -2,6 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import BaseOverlay from '@restart/ui/Overlay';
|
|
5
|
+
import useCallbackRef from '@restart/hooks/useCallbackRef';
|
|
6
|
+
import useEventCallback from '@restart/hooks/useEventCallback';
|
|
7
|
+
import useIsomorphicEffect from '@restart/hooks/useIsomorphicEffect';
|
|
5
8
|
import useMergedRefs from '@restart/hooks/useMergedRefs';
|
|
6
9
|
import useOverlayOffset from './useOverlayOffset';
|
|
7
10
|
import Fade from './Fade';
|
|
@@ -34,13 +37,24 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
|
34
37
|
...outerProps
|
|
35
38
|
}, outerRef) => {
|
|
36
39
|
const popperRef = useRef({});
|
|
40
|
+
const [firstRenderedState, setFirstRenderedState] = useCallbackRef();
|
|
37
41
|
const [ref, modifiers] = useOverlayOffset(outerProps.offset);
|
|
38
42
|
const mergedRef = useMergedRefs(outerRef, ref);
|
|
39
43
|
const actualTransition = transition === true ? Fade : transition || undefined;
|
|
44
|
+
const handleFirstUpdate = useEventCallback(state => {
|
|
45
|
+
setFirstRenderedState(state);
|
|
46
|
+
popperConfig == null ? void 0 : popperConfig.onFirstUpdate == null ? void 0 : popperConfig.onFirstUpdate(state);
|
|
47
|
+
});
|
|
48
|
+
useIsomorphicEffect(() => {
|
|
49
|
+
if (firstRenderedState) {
|
|
50
|
+
popperRef.current.scheduleUpdate == null ? void 0 : popperRef.current.scheduleUpdate();
|
|
51
|
+
}
|
|
52
|
+
}, [firstRenderedState]);
|
|
40
53
|
return /*#__PURE__*/_jsx(BaseOverlay, { ...outerProps,
|
|
41
54
|
ref: mergedRef,
|
|
42
55
|
popperConfig: { ...popperConfig,
|
|
43
|
-
modifiers: modifiers.concat(popperConfig.modifiers || [])
|
|
56
|
+
modifiers: modifiers.concat(popperConfig.modifiers || []),
|
|
57
|
+
onFirstUpdate: handleFirstUpdate
|
|
44
58
|
},
|
|
45
59
|
transition: actualTransition,
|
|
46
60
|
children: (overlayProps, {
|
package/esm/OverlayTrigger.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ declare namespace OverlayTrigger {
|
|
|
31
31
|
/**
|
|
32
32
|
* Specify which action or actions trigger Overlay visibility
|
|
33
33
|
*
|
|
34
|
+
* The `click` trigger ignores the configured `delay`.
|
|
35
|
+
*
|
|
34
36
|
* @type {'hover' | 'click' |'focus' | Array<'hover' | 'click' |'focus'>}
|
|
35
37
|
*/
|
|
36
38
|
trigger: PropTypes.Requireable<string | (string | null | undefined)[]>;
|
package/esm/Popover.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OverlayArrowProps } from '@restart/ui/Overlay';
|
|
3
|
-
import { Placement } from './types';
|
|
3
|
+
import { Placement, PopperRef } from './types';
|
|
4
4
|
import { BsPrefixProps } from './helpers';
|
|
5
5
|
export interface PopoverProps extends React.HTMLAttributes<HTMLDivElement>, BsPrefixProps {
|
|
6
6
|
placement?: Placement;
|
|
7
7
|
title?: string;
|
|
8
8
|
arrowProps?: Partial<OverlayArrowProps>;
|
|
9
9
|
body?: boolean;
|
|
10
|
-
popper?:
|
|
10
|
+
popper?: PopperRef;
|
|
11
11
|
show?: boolean;
|
|
12
12
|
}
|
|
13
13
|
declare const _default: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLDivElement>> & {
|
package/esm/Row.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
|
|
3
|
+
import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const Row = /*#__PURE__*/React.forwardRef(({
|
|
6
6
|
bsPrefix,
|
|
@@ -11,6 +11,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
11
11
|
}, ref) => {
|
|
12
12
|
const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'row');
|
|
13
13
|
const breakpoints = useBootstrapBreakpoints();
|
|
14
|
+
const minBreakpoint = useBootstrapMinBreakpoint();
|
|
14
15
|
const sizePrefix = `${decoratedBsPrefix}-cols`;
|
|
15
16
|
const classes = [];
|
|
16
17
|
breakpoints.forEach(brkPoint => {
|
|
@@ -26,7 +27,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
26
27
|
cols = propValue;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
const infix = brkPoint !==
|
|
30
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
30
31
|
if (cols != null) classes.push(`${sizePrefix}${infix}-${cols}`);
|
|
31
32
|
});
|
|
32
33
|
return /*#__PURE__*/_jsx(Component, {
|
package/esm/SplitButton.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface SplitButtonProps extends Omit<DropdownProps, 'title'>, PropsFro
|
|
|
11
11
|
title: React.ReactNode;
|
|
12
12
|
toggleLabel?: string;
|
|
13
13
|
type?: ButtonType;
|
|
14
|
+
flip?: boolean;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* A convenience component for simple or general use split button dropdowns. Renders a
|
package/esm/SplitButton.js
CHANGED
|
@@ -59,6 +59,13 @@ const propTypes = {
|
|
|
59
59
|
*/
|
|
60
60
|
rootCloseEvent: PropTypes.string,
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to
|
|
64
|
+
* Popper.js's flip [docs](https://popper.js.org/docs/v2/modifiers/flip/).
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
flip: PropTypes.bool,
|
|
68
|
+
|
|
62
69
|
/** @ignore */
|
|
63
70
|
bsPrefix: PropTypes.string,
|
|
64
71
|
|
|
@@ -98,6 +105,7 @@ const SplitButton = /*#__PURE__*/React.forwardRef(({
|
|
|
98
105
|
menuRole,
|
|
99
106
|
renderMenuOnMount,
|
|
100
107
|
rootCloseEvent,
|
|
108
|
+
flip,
|
|
101
109
|
...props
|
|
102
110
|
}, ref) => /*#__PURE__*/_jsxs(Dropdown, {
|
|
103
111
|
ref: ref,
|
|
@@ -128,6 +136,7 @@ const SplitButton = /*#__PURE__*/React.forwardRef(({
|
|
|
128
136
|
role: menuRole,
|
|
129
137
|
renderOnMount: renderMenuOnMount,
|
|
130
138
|
rootCloseEvent: rootCloseEvent,
|
|
139
|
+
flip: flip,
|
|
131
140
|
children: children
|
|
132
141
|
})]
|
|
133
142
|
}));
|
package/esm/Stack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
|
|
3
|
+
import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
|
|
4
4
|
import createUtilityClassName, { responsivePropType } from './createUtilityClasses';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const Stack = /*#__PURE__*/React.forwardRef(({
|
|
@@ -13,11 +13,13 @@ const Stack = /*#__PURE__*/React.forwardRef(({
|
|
|
13
13
|
}, ref) => {
|
|
14
14
|
bsPrefix = useBootstrapPrefix(bsPrefix, direction === 'horizontal' ? 'hstack' : 'vstack');
|
|
15
15
|
const breakpoints = useBootstrapBreakpoints();
|
|
16
|
+
const minBreakpoint = useBootstrapMinBreakpoint();
|
|
16
17
|
return /*#__PURE__*/_jsx(Component, { ...props,
|
|
17
18
|
ref: ref,
|
|
18
19
|
className: classNames(className, bsPrefix, ...createUtilityClassName({
|
|
19
20
|
gap,
|
|
20
|
-
breakpoints
|
|
21
|
+
breakpoints,
|
|
22
|
+
minBreakpoint
|
|
21
23
|
}))
|
|
22
24
|
});
|
|
23
25
|
});
|
package/esm/Table.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BsPrefixOnlyProps } from './helpers';
|
|
3
3
|
export interface TableProps extends BsPrefixOnlyProps, React.TableHTMLAttributes<HTMLTableElement> {
|
|
4
|
-
striped?: boolean;
|
|
4
|
+
striped?: boolean | string;
|
|
5
5
|
bordered?: boolean;
|
|
6
6
|
borderless?: boolean;
|
|
7
7
|
hover?: boolean;
|
package/esm/Table.js
CHANGED
|
@@ -15,7 +15,7 @@ const Table = /*#__PURE__*/React.forwardRef(({
|
|
|
15
15
|
...props
|
|
16
16
|
}, ref) => {
|
|
17
17
|
const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'table');
|
|
18
|
-
const classes = classNames(className, decoratedBsPrefix, variant && `${decoratedBsPrefix}-${variant}`, size && `${decoratedBsPrefix}-${size}`, striped && `${decoratedBsPrefix}
|
|
18
|
+
const classes = classNames(className, decoratedBsPrefix, variant && `${decoratedBsPrefix}-${variant}`, size && `${decoratedBsPrefix}-${size}`, striped && `${decoratedBsPrefix}-${typeof striped === 'string' ? `striped-${striped}` : 'striped'}`, bordered && `${decoratedBsPrefix}-bordered`, borderless && `${decoratedBsPrefix}-borderless`, hover && `${decoratedBsPrefix}-hover`);
|
|
19
19
|
|
|
20
20
|
const table = /*#__PURE__*/_jsx("table", { ...props,
|
|
21
21
|
className: classes,
|
package/esm/Tabs.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { TabsProps as BaseTabsProps } from '@restart/ui/Tabs';
|
|
4
|
+
import { NavProps } from './Nav';
|
|
4
5
|
import { TransitionType } from './helpers';
|
|
5
|
-
export interface TabsProps extends Omit<BaseTabsProps, 'transition'>, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'
|
|
6
|
-
variant?: 'tabs' | 'pills';
|
|
6
|
+
export interface TabsProps extends Omit<BaseTabsProps, 'transition'>, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'>, NavProps {
|
|
7
7
|
transition?: TransitionType;
|
|
8
8
|
}
|
|
9
9
|
declare const Tabs: {
|
|
@@ -61,6 +61,14 @@ declare const Tabs: {
|
|
|
61
61
|
* Unmount tabs (remove it from the DOM) when it is no longer visible
|
|
62
62
|
*/
|
|
63
63
|
unmountOnExit: PropTypes.Requireable<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Have all `Tabs`s proportionately fill all available width.
|
|
66
|
+
*/
|
|
67
|
+
fill: PropTypes.Requireable<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* Have all `Tab`s evenly fill all available width.
|
|
70
|
+
*/
|
|
71
|
+
justify: PropTypes.Requireable<boolean>;
|
|
64
72
|
};
|
|
65
73
|
defaultProps: {
|
|
66
74
|
variant: string;
|
package/esm/ThemeProvider.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare const DEFAULT_BREAKPOINTS: string[];
|
|
3
|
+
export declare const DEFAULT_MIN_BREAKPOINT = "xs";
|
|
3
4
|
export interface ThemeContextValue {
|
|
4
5
|
prefixes: Record<string, string>;
|
|
5
6
|
breakpoints: string[];
|
|
7
|
+
minBreakpoint?: string;
|
|
6
8
|
dir?: string;
|
|
7
9
|
}
|
|
8
10
|
export interface ThemeProviderProps extends Partial<ThemeContextValue> {
|
|
9
11
|
children: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
declare const Consumer: React.Consumer<ThemeContextValue>;
|
|
12
|
-
declare function ThemeProvider({ prefixes, breakpoints, dir, children, }: ThemeProviderProps): JSX.Element;
|
|
14
|
+
declare function ThemeProvider({ prefixes, breakpoints, minBreakpoint, dir, children, }: ThemeProviderProps): JSX.Element;
|
|
13
15
|
declare namespace ThemeProvider {
|
|
14
16
|
var propTypes: any;
|
|
15
17
|
}
|
|
16
18
|
export declare function useBootstrapPrefix(prefix: string | undefined, defaultPrefix: string): string;
|
|
17
19
|
export declare function useBootstrapBreakpoints(): string[];
|
|
20
|
+
export declare function useBootstrapMinBreakpoint(): string | undefined;
|
|
18
21
|
export declare function useIsRTL(): boolean;
|
|
19
22
|
declare function createBootstrapComponent(Component: any, opts: any): React.ForwardRefExoticComponent<{
|
|
20
23
|
bsPrefix?: string | undefined;
|