react-bootstrap 2.3.1 → 2.5.0-beta.1
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/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/NavbarOffcanvas.js +2 -56
- package/cjs/Offcanvas.d.ts +1 -0
- package/cjs/Offcanvas.js +41 -31
- 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/ToastContainer.d.ts +1 -0
- package/cjs/ToastContainer.js +2 -1
- 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 +574 -306
- package/dist/react-bootstrap.min.js +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/NavbarOffcanvas.js +2 -53
- package/esm/Offcanvas.d.ts +1 -0
- package/esm/Offcanvas.js +43 -32
- 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/ToastContainer.d.ts +1 -0
- package/esm/ToastContainer.js +2 -1
- 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
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/NavbarOffcanvas.js
CHANGED
|
@@ -1,64 +1,13 @@
|
|
|
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
|
-
bsPrefix: bsPrefix,
|
|
44
|
-
backdrop: backdrop,
|
|
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
11
|
...props
|
|
63
12
|
});
|
|
64
13
|
});
|
package/esm/Offcanvas.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ 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;
|
|
10
11
|
}
|
|
11
12
|
declare const _default: BsPrefixRefForwardingComponent<"div", OffcanvasProps> & {
|
|
12
13
|
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,
|
|
@@ -40,6 +43,7 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
40
43
|
children,
|
|
41
44
|
'aria-labelledby': ariaLabelledby,
|
|
42
45
|
placement,
|
|
46
|
+
responsive,
|
|
43
47
|
|
|
44
48
|
/* BaseModal props */
|
|
45
49
|
show,
|
|
@@ -69,6 +73,13 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
69
73
|
const {
|
|
70
74
|
onToggle
|
|
71
75
|
} = useContext(NavbarContext) || {};
|
|
76
|
+
const [showOffcanvas, setShowOffcanvas] = useState(false);
|
|
77
|
+
const hideResponsiveOffcanvas = useBreakpoint(responsive || 'xs', 'up');
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
// Handles the case where screen is resized while the responsive
|
|
80
|
+
// offcanvas is shown. If `responsive` not provided, just use `show`.
|
|
81
|
+
setShowOffcanvas(responsive ? show && !hideResponsiveOffcanvas : show);
|
|
82
|
+
}, [show, responsive, hideResponsiveOffcanvas]);
|
|
72
83
|
const handleHide = useEventCallback(() => {
|
|
73
84
|
onToggle == null ? void 0 : onToggle();
|
|
74
85
|
onHide == null ? void 0 : onHide();
|
|
@@ -106,42 +117,42 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
106
117
|
className: classNames(`${bsPrefix}-backdrop`, backdropClassName)
|
|
107
118
|
}), [backdropClassName, bsPrefix]);
|
|
108
119
|
|
|
109
|
-
const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", {
|
|
110
|
-
role: "dialog",
|
|
111
|
-
...dialogProps,
|
|
120
|
+
const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", { ...dialogProps,
|
|
112
121
|
...props,
|
|
113
|
-
className: classNames(className, bsPrefix, `${bsPrefix}-${placement}`),
|
|
122
|
+
className: classNames(className, responsive ? `${bsPrefix}-${responsive}` : bsPrefix, `${bsPrefix}-${placement}`),
|
|
114
123
|
"aria-labelledby": ariaLabelledby,
|
|
115
124
|
children: children
|
|
116
125
|
});
|
|
117
126
|
|
|
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
|
-
|
|
127
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
128
|
+
children: [!showOffcanvas && renderDialog({}), /*#__PURE__*/_jsx(ModalContext.Provider, {
|
|
129
|
+
value: modalContext,
|
|
130
|
+
children: /*#__PURE__*/_jsx(BaseModal, {
|
|
131
|
+
show: showOffcanvas,
|
|
132
|
+
ref: ref,
|
|
133
|
+
backdrop: backdrop,
|
|
134
|
+
container: container,
|
|
135
|
+
keyboard: keyboard,
|
|
136
|
+
autoFocus: autoFocus,
|
|
137
|
+
enforceFocus: enforceFocus && !scroll,
|
|
138
|
+
restoreFocus: restoreFocus,
|
|
139
|
+
restoreFocusOptions: restoreFocusOptions,
|
|
140
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
141
|
+
onShow: onShow,
|
|
142
|
+
onHide: handleHide,
|
|
143
|
+
onEnter: handleEnter,
|
|
144
|
+
onEntering: onEntering,
|
|
145
|
+
onEntered: onEntered,
|
|
146
|
+
onExit: onExit,
|
|
147
|
+
onExiting: onExiting,
|
|
148
|
+
onExited: handleExited,
|
|
149
|
+
manager: getModalManager(),
|
|
150
|
+
transition: DialogTransition,
|
|
151
|
+
backdropTransition: BackdropTransition,
|
|
152
|
+
renderBackdrop: renderBackdrop,
|
|
153
|
+
renderDialog: renderDialog
|
|
154
|
+
})
|
|
155
|
+
})]
|
|
145
156
|
});
|
|
146
157
|
});
|
|
147
158
|
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;
|
package/esm/ThemeProvider.js
CHANGED
|
@@ -2,9 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import { useContext, useMemo } from 'react';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
5
|
+
export const DEFAULT_MIN_BREAKPOINT = 'xs';
|
|
5
6
|
const ThemeContext = /*#__PURE__*/React.createContext({
|
|
6
7
|
prefixes: {},
|
|
7
|
-
breakpoints: DEFAULT_BREAKPOINTS
|
|
8
|
+
breakpoints: DEFAULT_BREAKPOINTS,
|
|
9
|
+
minBreakpoint: DEFAULT_MIN_BREAKPOINT
|
|
8
10
|
});
|
|
9
11
|
const {
|
|
10
12
|
Consumer,
|
|
@@ -14,6 +16,7 @@ const {
|
|
|
14
16
|
function ThemeProvider({
|
|
15
17
|
prefixes = {},
|
|
16
18
|
breakpoints = DEFAULT_BREAKPOINTS,
|
|
19
|
+
minBreakpoint = DEFAULT_MIN_BREAKPOINT,
|
|
17
20
|
dir,
|
|
18
21
|
children
|
|
19
22
|
}) {
|
|
@@ -21,8 +24,9 @@ function ThemeProvider({
|
|
|
21
24
|
prefixes: { ...prefixes
|
|
22
25
|
},
|
|
23
26
|
breakpoints,
|
|
27
|
+
minBreakpoint,
|
|
24
28
|
dir
|
|
25
|
-
}), [prefixes, breakpoints, dir]);
|
|
29
|
+
}), [prefixes, breakpoints, minBreakpoint, dir]);
|
|
26
30
|
return /*#__PURE__*/_jsx(Provider, {
|
|
27
31
|
value: contextValue,
|
|
28
32
|
children: children
|
|
@@ -41,6 +45,12 @@ export function useBootstrapBreakpoints() {
|
|
|
41
45
|
} = useContext(ThemeContext);
|
|
42
46
|
return breakpoints;
|
|
43
47
|
}
|
|
48
|
+
export function useBootstrapMinBreakpoint() {
|
|
49
|
+
const {
|
|
50
|
+
minBreakpoint
|
|
51
|
+
} = useContext(ThemeContext);
|
|
52
|
+
return minBreakpoint;
|
|
53
|
+
}
|
|
44
54
|
export function useIsRTL() {
|
|
45
55
|
const {
|
|
46
56
|
dir
|
package/esm/ToastContainer.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
|
3
3
|
export declare type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-center' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
4
4
|
export interface ToastContainerProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
|
|
5
5
|
position?: ToastPosition;
|
|
6
|
+
containerPosition?: string;
|
|
6
7
|
}
|
|
7
8
|
declare const ToastContainer: BsPrefixRefForwardingComponent<'div', ToastContainerProps>;
|
|
8
9
|
export default ToastContainer;
|
package/esm/ToastContainer.js
CHANGED
|
@@ -16,6 +16,7 @@ const positionClasses = {
|
|
|
16
16
|
const ToastContainer = /*#__PURE__*/React.forwardRef(({
|
|
17
17
|
bsPrefix,
|
|
18
18
|
position,
|
|
19
|
+
containerPosition = 'absolute',
|
|
19
20
|
className,
|
|
20
21
|
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
21
22
|
as: Component = 'div',
|
|
@@ -25,7 +26,7 @@ const ToastContainer = /*#__PURE__*/React.forwardRef(({
|
|
|
25
26
|
return /*#__PURE__*/_jsx(Component, {
|
|
26
27
|
ref: ref,
|
|
27
28
|
...props,
|
|
28
|
-
className: classNames(bsPrefix, position && `position
|
|
29
|
+
className: classNames(bsPrefix, position && [containerPosition ? `position-${containerPosition}` : null, positionClasses[position]], className)
|
|
29
30
|
});
|
|
30
31
|
});
|
|
31
32
|
ToastContainer.displayName = 'ToastContainer';
|
package/esm/ToggleButtonGroup.js
CHANGED
|
@@ -33,7 +33,7 @@ const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
33
33
|
const isActive = values.indexOf(inputVal) !== -1;
|
|
34
34
|
|
|
35
35
|
if (type === 'radio') {
|
|
36
|
-
if (!isActive
|
|
36
|
+
if (!isActive) onChange(inputVal, event);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
package/esm/Tooltip.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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 TooltipProps extends React.HTMLAttributes<HTMLDivElement>, BsPrefixProps {
|
|
6
6
|
placement?: Placement;
|
|
7
7
|
arrowProps?: Partial<OverlayArrowProps>;
|
|
8
8
|
show?: boolean;
|
|
9
|
-
popper?:
|
|
9
|
+
popper?: PopperRef;
|
|
10
10
|
}
|
|
11
11
|
declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
export default Tooltip;
|
|
@@ -8,4 +8,4 @@ export declare type ResponsiveUtilityValue<T> = T | {
|
|
|
8
8
|
xxl?: T;
|
|
9
9
|
};
|
|
10
10
|
export declare function responsivePropType(propType: any): PropTypes.Requireable<any>;
|
|
11
|
-
export default function createUtilityClassName(utilityValues: Record<string, ResponsiveUtilityValue<unknown>>, breakpoints?: string[]): string[];
|
|
11
|
+
export default function createUtilityClassName(utilityValues: Record<string, ResponsiveUtilityValue<unknown>>, breakpoints?: string[], minBreakpoint?: string): string[];
|