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/cjs/Col.js
CHANGED
|
@@ -26,6 +26,7 @@ function useCol({
|
|
|
26
26
|
}) {
|
|
27
27
|
bsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'col');
|
|
28
28
|
const breakpoints = (0, _ThemeProvider.useBootstrapBreakpoints)();
|
|
29
|
+
const minBreakpoint = (0, _ThemeProvider.useBootstrapMinBreakpoint)();
|
|
29
30
|
const spans = [];
|
|
30
31
|
const classes = [];
|
|
31
32
|
breakpoints.forEach(brkPoint => {
|
|
@@ -45,7 +46,7 @@ function useCol({
|
|
|
45
46
|
span = propValue;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
const infix = brkPoint !==
|
|
49
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
49
50
|
if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
|
|
50
51
|
if (order != null) classes.push(`order${infix}-${order}`);
|
|
51
52
|
if (offset != null) classes.push(`offset${infix}-${offset}`);
|
package/cjs/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/cjs/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/cjs/DropdownButton.js
CHANGED
|
@@ -71,6 +71,13 @@ const propTypes = {
|
|
|
71
71
|
*/
|
|
72
72
|
menuVariant: _propTypes.default.oneOf(['dark']),
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to
|
|
76
|
+
* Popper.js's flip [docs](https://popper.js.org/docs/v2/modifiers/flip/).
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
flip: _propTypes.default.bool,
|
|
80
|
+
|
|
74
81
|
/** @ignore */
|
|
75
82
|
bsPrefix: _propTypes.default.string,
|
|
76
83
|
|
|
@@ -103,6 +110,7 @@ const DropdownButton = /*#__PURE__*/React.forwardRef(({
|
|
|
103
110
|
href,
|
|
104
111
|
id,
|
|
105
112
|
menuVariant,
|
|
113
|
+
flip,
|
|
106
114
|
...props
|
|
107
115
|
}, ref) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dropdown.default, {
|
|
108
116
|
ref: ref,
|
|
@@ -120,6 +128,7 @@ const DropdownButton = /*#__PURE__*/React.forwardRef(({
|
|
|
120
128
|
renderOnMount: renderMenuOnMount,
|
|
121
129
|
rootCloseEvent: rootCloseEvent,
|
|
122
130
|
variant: menuVariant,
|
|
131
|
+
flip: flip,
|
|
123
132
|
children: children
|
|
124
133
|
})]
|
|
125
134
|
}));
|
package/cjs/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/cjs/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/cjs/FormCheck.js
CHANGED
|
@@ -32,6 +32,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
32
32
|
bsPrefix,
|
|
33
33
|
bsSwitchPrefix,
|
|
34
34
|
inline = false,
|
|
35
|
+
reverse = false,
|
|
35
36
|
disabled = false,
|
|
36
37
|
isValid = false,
|
|
37
38
|
isInvalid = false,
|
|
@@ -69,7 +70,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
69
70
|
value: innerFormContext,
|
|
70
71
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
71
72
|
style: style,
|
|
72
|
-
className: (0, _classnames.default)(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, type === 'switch' && bsSwitchPrefix),
|
|
73
|
+
className: (0, _classnames.default)(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, reverse && `${bsPrefix}-reverse`, type === 'switch' && bsSwitchPrefix),
|
|
73
74
|
children: children || /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
74
75
|
children: [input, hasLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormCheckLabel.default, {
|
|
75
76
|
title: title,
|
package/cjs/NavbarOffcanvas.js
CHANGED
|
@@ -7,12 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var _useBreakpoint = _interopRequireDefault(require("@restart/hooks/useBreakpoint"));
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _ThemeProvider = require("./ThemeProvider");
|
|
15
|
-
|
|
16
10
|
var _Offcanvas = _interopRequireDefault(require("./Offcanvas"));
|
|
17
11
|
|
|
18
12
|
var _NavbarContext = _interopRequireDefault(require("./NavbarContext"));
|
|
@@ -23,59 +17,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
17
|
|
|
24
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
19
|
|
|
26
|
-
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef(({
|
|
27
|
-
className,
|
|
28
|
-
bsPrefix,
|
|
29
|
-
backdrop,
|
|
30
|
-
backdropClassName,
|
|
31
|
-
keyboard,
|
|
32
|
-
scroll,
|
|
33
|
-
placement,
|
|
34
|
-
autoFocus,
|
|
35
|
-
enforceFocus,
|
|
36
|
-
restoreFocus,
|
|
37
|
-
restoreFocusOptions,
|
|
38
|
-
onShow,
|
|
39
|
-
onHide,
|
|
40
|
-
onEscapeKeyDown,
|
|
41
|
-
onEnter,
|
|
42
|
-
onEntering,
|
|
43
|
-
onEntered,
|
|
44
|
-
onExit,
|
|
45
|
-
onExiting,
|
|
46
|
-
onExited,
|
|
47
|
-
...props
|
|
48
|
-
}, ref) => {
|
|
20
|
+
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
49
21
|
const context = (0, React.useContext)(_NavbarContext.default);
|
|
50
|
-
|
|
51
|
-
const hasExpandProp = typeof (context == null ? void 0 : context.expand) === 'string';
|
|
52
|
-
const shouldExpand = (0, _useBreakpoint.default)(hasExpandProp ? context.expand : 'xs', 'up');
|
|
53
|
-
return hasExpandProp && shouldExpand ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
54
|
-
ref: ref,
|
|
55
|
-
...props,
|
|
56
|
-
className: (0, _classnames.default)(className, bsPrefix, `${bsPrefix}-${placement}`)
|
|
57
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default, {
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default, {
|
|
58
23
|
ref: ref,
|
|
59
24
|
show: !!(context != null && context.expanded),
|
|
60
|
-
bsPrefix: bsPrefix,
|
|
61
|
-
backdrop: backdrop,
|
|
62
|
-
backdropClassName: backdropClassName,
|
|
63
|
-
keyboard: keyboard,
|
|
64
|
-
scroll: scroll,
|
|
65
|
-
placement: placement,
|
|
66
|
-
autoFocus: autoFocus,
|
|
67
|
-
enforceFocus: enforceFocus,
|
|
68
|
-
restoreFocus: restoreFocus,
|
|
69
|
-
restoreFocusOptions: restoreFocusOptions,
|
|
70
|
-
onShow: onShow,
|
|
71
|
-
onHide: onHide,
|
|
72
|
-
onEscapeKeyDown: onEscapeKeyDown,
|
|
73
|
-
onEnter: onEnter,
|
|
74
|
-
onEntering: onEntering,
|
|
75
|
-
onEntered: onEntered,
|
|
76
|
-
onExit: onExit,
|
|
77
|
-
onExiting: onExiting,
|
|
78
|
-
onExited: onExited,
|
|
79
25
|
...props
|
|
80
26
|
});
|
|
81
27
|
});
|
package/cjs/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/cjs/Offcanvas.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
|
|
10
|
+
var _useBreakpoint = _interopRequireDefault(require("@restart/hooks/useBreakpoint"));
|
|
11
|
+
|
|
10
12
|
var _useEventCallback = _interopRequireDefault(require("@restart/hooks/useEventCallback"));
|
|
11
13
|
|
|
12
14
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -64,6 +66,7 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
64
66
|
children,
|
|
65
67
|
'aria-labelledby': ariaLabelledby,
|
|
66
68
|
placement,
|
|
69
|
+
responsive,
|
|
67
70
|
|
|
68
71
|
/* BaseModal props */
|
|
69
72
|
show,
|
|
@@ -93,6 +96,13 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
93
96
|
const {
|
|
94
97
|
onToggle
|
|
95
98
|
} = (0, React.useContext)(_NavbarContext.default) || {};
|
|
99
|
+
const [showOffcanvas, setShowOffcanvas] = (0, React.useState)(false);
|
|
100
|
+
const hideResponsiveOffcanvas = (0, _useBreakpoint.default)(responsive || 'xs', 'up');
|
|
101
|
+
(0, React.useEffect)(() => {
|
|
102
|
+
// Handles the case where screen is resized while the responsive
|
|
103
|
+
// offcanvas is shown. If `responsive` not provided, just use `show`.
|
|
104
|
+
setShowOffcanvas(responsive ? show && !hideResponsiveOffcanvas : show);
|
|
105
|
+
}, [show, responsive, hideResponsiveOffcanvas]);
|
|
96
106
|
const handleHide = (0, _useEventCallback.default)(() => {
|
|
97
107
|
onToggle == null ? void 0 : onToggle();
|
|
98
108
|
onHide == null ? void 0 : onHide();
|
|
@@ -130,42 +140,42 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
130
140
|
className: (0, _classnames.default)(`${bsPrefix}-backdrop`, backdropClassName)
|
|
131
141
|
}), [backdropClassName, bsPrefix]);
|
|
132
142
|
|
|
133
|
-
const renderDialog = dialogProps => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
-
role: "dialog",
|
|
135
|
-
...dialogProps,
|
|
143
|
+
const renderDialog = dialogProps => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { ...dialogProps,
|
|
136
144
|
...props,
|
|
137
|
-
className: (0, _classnames.default)(className, bsPrefix, `${bsPrefix}-${placement}`),
|
|
145
|
+
className: (0, _classnames.default)(className, responsive ? `${bsPrefix}-${responsive}` : bsPrefix, `${bsPrefix}-${placement}`),
|
|
138
146
|
"aria-labelledby": ariaLabelledby,
|
|
139
147
|
children: children
|
|
140
148
|
});
|
|
141
149
|
|
|
142
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
150
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
151
|
+
children: [!showOffcanvas && renderDialog({}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalContext.default.Provider, {
|
|
152
|
+
value: modalContext,
|
|
153
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.default, {
|
|
154
|
+
show: showOffcanvas,
|
|
155
|
+
ref: ref,
|
|
156
|
+
backdrop: backdrop,
|
|
157
|
+
container: container,
|
|
158
|
+
keyboard: keyboard,
|
|
159
|
+
autoFocus: autoFocus,
|
|
160
|
+
enforceFocus: enforceFocus && !scroll,
|
|
161
|
+
restoreFocus: restoreFocus,
|
|
162
|
+
restoreFocusOptions: restoreFocusOptions,
|
|
163
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
164
|
+
onShow: onShow,
|
|
165
|
+
onHide: handleHide,
|
|
166
|
+
onEnter: handleEnter,
|
|
167
|
+
onEntering: onEntering,
|
|
168
|
+
onEntered: onEntered,
|
|
169
|
+
onExit: onExit,
|
|
170
|
+
onExiting: onExiting,
|
|
171
|
+
onExited: handleExited,
|
|
172
|
+
manager: getModalManager(),
|
|
173
|
+
transition: DialogTransition,
|
|
174
|
+
backdropTransition: BackdropTransition,
|
|
175
|
+
renderBackdrop: renderBackdrop,
|
|
176
|
+
renderDialog: renderDialog
|
|
177
|
+
})
|
|
178
|
+
})]
|
|
169
179
|
});
|
|
170
180
|
});
|
|
171
181
|
Offcanvas.displayName = 'Offcanvas';
|
package/cjs/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/cjs/Overlay.js
CHANGED
|
@@ -11,6 +11,12 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
|
|
12
12
|
var _Overlay = _interopRequireDefault(require("@restart/ui/Overlay"));
|
|
13
13
|
|
|
14
|
+
var _useCallbackRef = _interopRequireDefault(require("@restart/hooks/useCallbackRef"));
|
|
15
|
+
|
|
16
|
+
var _useEventCallback = _interopRequireDefault(require("@restart/hooks/useEventCallback"));
|
|
17
|
+
|
|
18
|
+
var _useIsomorphicEffect = _interopRequireDefault(require("@restart/hooks/useIsomorphicEffect"));
|
|
19
|
+
|
|
14
20
|
var _useMergedRefs = _interopRequireDefault(require("@restart/hooks/useMergedRefs"));
|
|
15
21
|
|
|
16
22
|
var _useOverlayOffset = _interopRequireDefault(require("./useOverlayOffset"));
|
|
@@ -52,13 +58,24 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
|
52
58
|
...outerProps
|
|
53
59
|
}, outerRef) => {
|
|
54
60
|
const popperRef = (0, React.useRef)({});
|
|
61
|
+
const [firstRenderedState, setFirstRenderedState] = (0, _useCallbackRef.default)();
|
|
55
62
|
const [ref, modifiers] = (0, _useOverlayOffset.default)(outerProps.offset);
|
|
56
63
|
const mergedRef = (0, _useMergedRefs.default)(outerRef, ref);
|
|
57
64
|
const actualTransition = transition === true ? _Fade.default : transition || undefined;
|
|
65
|
+
const handleFirstUpdate = (0, _useEventCallback.default)(state => {
|
|
66
|
+
setFirstRenderedState(state);
|
|
67
|
+
popperConfig == null ? void 0 : popperConfig.onFirstUpdate == null ? void 0 : popperConfig.onFirstUpdate(state);
|
|
68
|
+
});
|
|
69
|
+
(0, _useIsomorphicEffect.default)(() => {
|
|
70
|
+
if (firstRenderedState) {
|
|
71
|
+
popperRef.current.scheduleUpdate == null ? void 0 : popperRef.current.scheduleUpdate();
|
|
72
|
+
}
|
|
73
|
+
}, [firstRenderedState]);
|
|
58
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Overlay.default, { ...outerProps,
|
|
59
75
|
ref: mergedRef,
|
|
60
76
|
popperConfig: { ...popperConfig,
|
|
61
|
-
modifiers: modifiers.concat(popperConfig.modifiers || [])
|
|
77
|
+
modifiers: modifiers.concat(popperConfig.modifiers || []),
|
|
78
|
+
onFirstUpdate: handleFirstUpdate
|
|
62
79
|
},
|
|
63
80
|
transition: actualTransition,
|
|
64
81
|
children: (overlayProps, {
|
package/cjs/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/cjs/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/cjs/Row.js
CHANGED
|
@@ -26,6 +26,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
26
26
|
}, ref) => {
|
|
27
27
|
const decoratedBsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'row');
|
|
28
28
|
const breakpoints = (0, _ThemeProvider.useBootstrapBreakpoints)();
|
|
29
|
+
const minBreakpoint = (0, _ThemeProvider.useBootstrapMinBreakpoint)();
|
|
29
30
|
const sizePrefix = `${decoratedBsPrefix}-cols`;
|
|
30
31
|
const classes = [];
|
|
31
32
|
breakpoints.forEach(brkPoint => {
|
|
@@ -41,7 +42,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
41
42
|
cols = propValue;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
const infix = brkPoint !==
|
|
45
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
45
46
|
if (cols != null) classes.push(`${sizePrefix}${infix}-${cols}`);
|
|
46
47
|
});
|
|
47
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
package/cjs/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/cjs/SplitButton.js
CHANGED
|
@@ -76,6 +76,13 @@ const propTypes = {
|
|
|
76
76
|
*/
|
|
77
77
|
rootCloseEvent: _propTypes.default.string,
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to
|
|
81
|
+
* Popper.js's flip [docs](https://popper.js.org/docs/v2/modifiers/flip/).
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
flip: _propTypes.default.bool,
|
|
85
|
+
|
|
79
86
|
/** @ignore */
|
|
80
87
|
bsPrefix: _propTypes.default.string,
|
|
81
88
|
|
|
@@ -115,6 +122,7 @@ const SplitButton = /*#__PURE__*/React.forwardRef(({
|
|
|
115
122
|
menuRole,
|
|
116
123
|
renderMenuOnMount,
|
|
117
124
|
rootCloseEvent,
|
|
125
|
+
flip,
|
|
118
126
|
...props
|
|
119
127
|
}, ref) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dropdown.default, {
|
|
120
128
|
ref: ref,
|
|
@@ -145,6 +153,7 @@ const SplitButton = /*#__PURE__*/React.forwardRef(({
|
|
|
145
153
|
role: menuRole,
|
|
146
154
|
renderOnMount: renderMenuOnMount,
|
|
147
155
|
rootCloseEvent: rootCloseEvent,
|
|
156
|
+
flip: flip,
|
|
148
157
|
children: children
|
|
149
158
|
})]
|
|
150
159
|
}));
|
package/cjs/Stack.js
CHANGED
|
@@ -29,11 +29,13 @@ const Stack = /*#__PURE__*/React.forwardRef(({
|
|
|
29
29
|
}, ref) => {
|
|
30
30
|
bsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, direction === 'horizontal' ? 'hstack' : 'vstack');
|
|
31
31
|
const breakpoints = (0, _ThemeProvider.useBootstrapBreakpoints)();
|
|
32
|
+
const minBreakpoint = (0, _ThemeProvider.useBootstrapMinBreakpoint)();
|
|
32
33
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, { ...props,
|
|
33
34
|
ref: ref,
|
|
34
35
|
className: (0, _classnames.default)(className, bsPrefix, ...(0, _createUtilityClasses.default)({
|
|
35
36
|
gap,
|
|
36
|
-
breakpoints
|
|
37
|
+
breakpoints,
|
|
38
|
+
minBreakpoint
|
|
37
39
|
}))
|
|
38
40
|
});
|
|
39
41
|
});
|
package/cjs/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/cjs/Table.js
CHANGED
|
@@ -30,7 +30,7 @@ const Table = /*#__PURE__*/React.forwardRef(({
|
|
|
30
30
|
...props
|
|
31
31
|
}, ref) => {
|
|
32
32
|
const decoratedBsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'table');
|
|
33
|
-
const classes = (0, _classnames.default)(className, decoratedBsPrefix, variant && `${decoratedBsPrefix}-${variant}`, size && `${decoratedBsPrefix}-${size}`, striped && `${decoratedBsPrefix}
|
|
33
|
+
const classes = (0, _classnames.default)(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`);
|
|
34
34
|
const table = /*#__PURE__*/(0, _jsxRuntime.jsx)("table", { ...props,
|
|
35
35
|
className: classes,
|
|
36
36
|
ref: ref
|
package/cjs/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/cjs/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/cjs/ThemeProvider.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.ThemeConsumer = exports.DEFAULT_BREAKPOINTS = void 0;
|
|
4
|
+
exports.ThemeConsumer = exports.DEFAULT_MIN_BREAKPOINT = exports.DEFAULT_BREAKPOINTS = void 0;
|
|
5
5
|
exports.createBootstrapComponent = createBootstrapComponent;
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.useBootstrapBreakpoints = useBootstrapBreakpoints;
|
|
8
|
+
exports.useBootstrapMinBreakpoint = useBootstrapMinBreakpoint;
|
|
8
9
|
exports.useBootstrapPrefix = useBootstrapPrefix;
|
|
9
10
|
exports.useIsRTL = useIsRTL;
|
|
10
11
|
|
|
@@ -18,9 +19,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18
19
|
|
|
19
20
|
const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
20
21
|
exports.DEFAULT_BREAKPOINTS = DEFAULT_BREAKPOINTS;
|
|
22
|
+
const DEFAULT_MIN_BREAKPOINT = 'xs';
|
|
23
|
+
exports.DEFAULT_MIN_BREAKPOINT = DEFAULT_MIN_BREAKPOINT;
|
|
21
24
|
const ThemeContext = /*#__PURE__*/React.createContext({
|
|
22
25
|
prefixes: {},
|
|
23
|
-
breakpoints: DEFAULT_BREAKPOINTS
|
|
26
|
+
breakpoints: DEFAULT_BREAKPOINTS,
|
|
27
|
+
minBreakpoint: DEFAULT_MIN_BREAKPOINT
|
|
24
28
|
});
|
|
25
29
|
const {
|
|
26
30
|
Consumer,
|
|
@@ -31,6 +35,7 @@ exports.ThemeConsumer = Consumer;
|
|
|
31
35
|
function ThemeProvider({
|
|
32
36
|
prefixes = {},
|
|
33
37
|
breakpoints = DEFAULT_BREAKPOINTS,
|
|
38
|
+
minBreakpoint = DEFAULT_MIN_BREAKPOINT,
|
|
34
39
|
dir,
|
|
35
40
|
children
|
|
36
41
|
}) {
|
|
@@ -38,8 +43,9 @@ function ThemeProvider({
|
|
|
38
43
|
prefixes: { ...prefixes
|
|
39
44
|
},
|
|
40
45
|
breakpoints,
|
|
46
|
+
minBreakpoint,
|
|
41
47
|
dir
|
|
42
|
-
}), [prefixes, breakpoints, dir]);
|
|
48
|
+
}), [prefixes, breakpoints, minBreakpoint, dir]);
|
|
43
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
44
50
|
value: contextValue,
|
|
45
51
|
children: children
|
|
@@ -60,6 +66,13 @@ function useBootstrapBreakpoints() {
|
|
|
60
66
|
return breakpoints;
|
|
61
67
|
}
|
|
62
68
|
|
|
69
|
+
function useBootstrapMinBreakpoint() {
|
|
70
|
+
const {
|
|
71
|
+
minBreakpoint
|
|
72
|
+
} = (0, React.useContext)(ThemeContext);
|
|
73
|
+
return minBreakpoint;
|
|
74
|
+
}
|
|
75
|
+
|
|
63
76
|
function useIsRTL() {
|
|
64
77
|
const {
|
|
65
78
|
dir
|
package/cjs/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/cjs/ToastContainer.js
CHANGED
|
@@ -31,6 +31,7 @@ const positionClasses = {
|
|
|
31
31
|
const ToastContainer = /*#__PURE__*/React.forwardRef(({
|
|
32
32
|
bsPrefix,
|
|
33
33
|
position,
|
|
34
|
+
containerPosition = 'absolute',
|
|
34
35
|
className,
|
|
35
36
|
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
36
37
|
as: Component = 'div',
|
|
@@ -40,7 +41,7 @@ const ToastContainer = /*#__PURE__*/React.forwardRef(({
|
|
|
40
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
41
42
|
ref: ref,
|
|
42
43
|
...props,
|
|
43
|
-
className: (0, _classnames.default)(bsPrefix, position && `position
|
|
44
|
+
className: (0, _classnames.default)(bsPrefix, position && [containerPosition ? `position-${containerPosition}` : null, positionClasses[position]], className)
|
|
44
45
|
});
|
|
45
46
|
});
|
|
46
47
|
ToastContainer.displayName = 'ToastContainer';
|
package/cjs/ToggleButtonGroup.js
CHANGED
|
@@ -52,7 +52,7 @@ const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
52
52
|
const isActive = values.indexOf(inputVal) !== -1;
|
|
53
53
|
|
|
54
54
|
if (type === 'radio') {
|
|
55
|
-
if (!isActive
|
|
55
|
+
if (!isActive) onChange(inputVal, event);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
|
package/cjs/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[];
|