react-bootstrap 2.2.0 → 2.2.3
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/Carousel.js +12 -12
- package/cjs/DropdownMenu.d.ts +1 -3
- package/cjs/Modal.js +7 -5
- package/cjs/Overlay.js +1 -1
- package/cjs/useOverlayOffset.d.ts +2 -5
- package/cjs/useOverlayOffset.js +4 -4
- package/dist/react-bootstrap.js +316 -210
- package/dist/react-bootstrap.min.js +1 -1
- package/esm/Carousel.js +12 -12
- package/esm/DropdownMenu.d.ts +1 -3
- package/esm/Modal.js +7 -5
- package/esm/Overlay.js +1 -1
- package/esm/useOverlayOffset.d.ts +2 -5
- package/esm/useOverlayOffset.js +4 -4
- package/package.json +7 -5
package/esm/Carousel.js
CHANGED
|
@@ -94,21 +94,21 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
|
|
|
94
94
|
const [paused, setPaused] = useState(false);
|
|
95
95
|
const [isSliding, setIsSliding] = useState(false);
|
|
96
96
|
const [renderedActiveIndex, setRenderedActiveIndex] = useState(activeIndex || 0);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!isSliding && activeIndex !== renderedActiveIndex) {
|
|
99
|
+
if (nextDirectionRef.current) {
|
|
100
|
+
setDirection(nextDirectionRef.current);
|
|
101
|
+
} else {
|
|
102
|
+
setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
|
|
103
|
+
}
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
} else {
|
|
102
|
-
setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
|
|
103
|
-
}
|
|
105
|
+
if (slide) {
|
|
106
|
+
setIsSliding(true);
|
|
107
|
+
}
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
setIsSliding(true);
|
|
109
|
+
setRenderedActiveIndex(activeIndex || 0);
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
setRenderedActiveIndex(activeIndex || 0);
|
|
110
|
-
}
|
|
111
|
-
|
|
111
|
+
}, [activeIndex, isSliding, renderedActiveIndex, slide]);
|
|
112
112
|
useEffect(() => {
|
|
113
113
|
if (nextDirectionRef.current) {
|
|
114
114
|
nextDirectionRef.current = null;
|
package/esm/DropdownMenu.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { UseDropdownMenuOptions } from '@restart/ui/DropdownMenu';
|
|
3
|
-
import { SelectCallback } from '@restart/ui/types';
|
|
4
3
|
import { DropDirection } from './DropdownContext';
|
|
5
4
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
6
5
|
import { AlignType } from './types';
|
|
7
6
|
export declare type DropdownMenuVariant = 'dark' | string;
|
|
8
|
-
export interface DropdownMenuProps extends BsPrefixProps,
|
|
7
|
+
export interface DropdownMenuProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
|
|
9
8
|
show?: boolean;
|
|
10
9
|
renderOnMount?: boolean;
|
|
11
10
|
flip?: boolean;
|
|
12
11
|
align?: AlignType;
|
|
13
|
-
onSelect?: SelectCallback;
|
|
14
12
|
rootCloseEvent?: 'click' | 'mousedown';
|
|
15
13
|
popperConfig?: UseDropdownMenuOptions['popperConfig'];
|
|
16
14
|
variant?: DropdownMenuVariant;
|
package/esm/Modal.js
CHANGED
|
@@ -57,6 +57,8 @@ const Modal = /*#__PURE__*/React.forwardRef(({
|
|
|
57
57
|
children,
|
|
58
58
|
dialogAs: Dialog,
|
|
59
59
|
'aria-labelledby': ariaLabelledby,
|
|
60
|
+
'aria-describedby': ariaDescribedby,
|
|
61
|
+
'aria-label': ariaLabel,
|
|
60
62
|
|
|
61
63
|
/* BaseModal props */
|
|
62
64
|
show,
|
|
@@ -178,7 +180,6 @@ const Modal = /*#__PURE__*/React.forwardRef(({
|
|
|
178
180
|
|
|
179
181
|
const handleEnter = (node, isAppearing) => {
|
|
180
182
|
if (node) {
|
|
181
|
-
node.style.display = 'block';
|
|
182
183
|
updateDialogStyle(node);
|
|
183
184
|
}
|
|
184
185
|
|
|
@@ -209,11 +210,10 @@ const Modal = /*#__PURE__*/React.forwardRef(({
|
|
|
209
210
|
}), [animation, backdropClassName, bsPrefix]);
|
|
210
211
|
const baseModalStyle = { ...style,
|
|
211
212
|
...modalStyle
|
|
212
|
-
}; //
|
|
213
|
+
}; // If `display` is not set to block, autoFocus inside the modal fails
|
|
214
|
+
// https://github.com/react-bootstrap/react-bootstrap/issues/5102
|
|
213
215
|
|
|
214
|
-
|
|
215
|
-
baseModalStyle.display = 'block';
|
|
216
|
-
}
|
|
216
|
+
baseModalStyle.display = 'block';
|
|
217
217
|
|
|
218
218
|
const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", {
|
|
219
219
|
role: "dialog",
|
|
@@ -222,7 +222,9 @@ const Modal = /*#__PURE__*/React.forwardRef(({
|
|
|
222
222
|
className: classNames(className, bsPrefix, animateStaticModal && `${bsPrefix}-static`),
|
|
223
223
|
onClick: backdrop ? handleClick : undefined,
|
|
224
224
|
onMouseUp: handleMouseUp,
|
|
225
|
+
"aria-label": ariaLabel,
|
|
225
226
|
"aria-labelledby": ariaLabelledby,
|
|
227
|
+
"aria-describedby": ariaDescribedby,
|
|
226
228
|
children: /*#__PURE__*/_jsx(Dialog, { ...props,
|
|
227
229
|
onMouseDown: handleDialogMouseDown,
|
|
228
230
|
className: dialogClassName,
|
package/esm/Overlay.js
CHANGED
|
@@ -34,7 +34,7 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
|
34
34
|
...outerProps
|
|
35
35
|
}, outerRef) => {
|
|
36
36
|
const popperRef = useRef({});
|
|
37
|
-
const [ref, modifiers] = useOverlayOffset();
|
|
37
|
+
const [ref, modifiers] = useOverlayOffset(outerProps.offset);
|
|
38
38
|
const mergedRef = useMergedRefs(outerRef, ref);
|
|
39
39
|
const actualTransition = transition === true ? Fade : transition || undefined;
|
|
40
40
|
return /*#__PURE__*/_jsx(BaseOverlay, { ...outerProps,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Options } from '@restart/ui/usePopper';
|
|
3
|
-
export default function useOverlayOffset(): [
|
|
4
|
-
React.RefObject<HTMLElement>,
|
|
5
|
-
Options['modifiers']
|
|
6
|
-
];
|
|
2
|
+
import { Offset, Options } from '@restart/ui/usePopper';
|
|
3
|
+
export default function useOverlayOffset(customOffset?: Offset): [React.RefObject<HTMLElement>, Options['modifiers']];
|
package/esm/useOverlayOffset.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useBootstrapPrefix } from './ThemeProvider';
|
|
|
4
4
|
import Popover from './Popover'; // This is meant for internal use.
|
|
5
5
|
// This applies a custom offset to the overlay if it's a popover.
|
|
6
6
|
|
|
7
|
-
export default function useOverlayOffset() {
|
|
7
|
+
export default function useOverlayOffset(customOffset) {
|
|
8
8
|
const overlayRef = useRef(null);
|
|
9
9
|
const popoverClass = useBootstrapPrefix(undefined, 'popover');
|
|
10
10
|
const offset = useMemo(() => ({
|
|
@@ -12,12 +12,12 @@ export default function useOverlayOffset() {
|
|
|
12
12
|
options: {
|
|
13
13
|
offset: () => {
|
|
14
14
|
if (overlayRef.current && hasClass(overlayRef.current, popoverClass)) {
|
|
15
|
-
return Popover.POPPER_OFFSET;
|
|
15
|
+
return customOffset || Popover.POPPER_OFFSET;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return [0, 0];
|
|
18
|
+
return customOffset || [0, 0];
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
}), [popoverClass]);
|
|
21
|
+
}), [customOffset, popoverClass]);
|
|
22
22
|
return [overlayRef, [offset]];
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-bootstrap",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Bootstrap 5 components built with React",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"bootstrap",
|
|
6
7
|
"react",
|
|
8
|
+
"component",
|
|
9
|
+
"components",
|
|
7
10
|
"ecosystem-react",
|
|
8
|
-
"react-component"
|
|
9
|
-
"bootstrap"
|
|
11
|
+
"react-component"
|
|
10
12
|
],
|
|
11
13
|
"homepage": "https://react-bootstrap.github.io/",
|
|
12
14
|
"bugs": {
|
|
@@ -34,8 +36,8 @@
|
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@babel/runtime": "^7.17.2",
|
|
37
|
-
"@restart/hooks": "^0.4.
|
|
38
|
-
"@restart/ui": "^1.0
|
|
39
|
+
"@restart/hooks": "^0.4.6",
|
|
40
|
+
"@restart/ui": "^1.2.0",
|
|
39
41
|
"@types/invariant": "^2.2.35",
|
|
40
42
|
"@types/prop-types": "^15.7.4",
|
|
41
43
|
"@types/react": ">=16.14.8",
|