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 CHANGED
@@ -118,21 +118,21 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
118
118
  const [paused, setPaused] = (0, React.useState)(false);
119
119
  const [isSliding, setIsSliding] = (0, React.useState)(false);
120
120
  const [renderedActiveIndex, setRenderedActiveIndex] = (0, React.useState)(activeIndex || 0);
121
+ (0, React.useEffect)(() => {
122
+ if (!isSliding && activeIndex !== renderedActiveIndex) {
123
+ if (nextDirectionRef.current) {
124
+ setDirection(nextDirectionRef.current);
125
+ } else {
126
+ setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
127
+ }
121
128
 
122
- if (!isSliding && activeIndex !== renderedActiveIndex) {
123
- if (nextDirectionRef.current) {
124
- setDirection(nextDirectionRef.current);
125
- } else {
126
- setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
127
- }
129
+ if (slide) {
130
+ setIsSliding(true);
131
+ }
128
132
 
129
- if (slide) {
130
- setIsSliding(true);
133
+ setRenderedActiveIndex(activeIndex || 0);
131
134
  }
132
-
133
- setRenderedActiveIndex(activeIndex || 0);
134
- }
135
-
135
+ }, [activeIndex, isSliding, renderedActiveIndex, slide]);
136
136
  (0, React.useEffect)(() => {
137
137
  if (nextDirectionRef.current) {
138
138
  nextDirectionRef.current = null;
@@ -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, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
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/cjs/Modal.js CHANGED
@@ -90,6 +90,8 @@ const Modal = /*#__PURE__*/React.forwardRef(({
90
90
  children,
91
91
  dialogAs: Dialog,
92
92
  'aria-labelledby': ariaLabelledby,
93
+ 'aria-describedby': ariaDescribedby,
94
+ 'aria-label': ariaLabel,
93
95
 
94
96
  /* BaseModal props */
95
97
  show,
@@ -211,7 +213,6 @@ const Modal = /*#__PURE__*/React.forwardRef(({
211
213
 
212
214
  const handleEnter = (node, isAppearing) => {
213
215
  if (node) {
214
- node.style.display = 'block';
215
216
  updateDialogStyle(node);
216
217
  }
217
218
 
@@ -242,11 +243,10 @@ const Modal = /*#__PURE__*/React.forwardRef(({
242
243
  }), [animation, backdropClassName, bsPrefix]);
243
244
  const baseModalStyle = { ...style,
244
245
  ...modalStyle
245
- }; // Sets `display` always block when `animation` is false
246
+ }; // If `display` is not set to block, autoFocus inside the modal fails
247
+ // https://github.com/react-bootstrap/react-bootstrap/issues/5102
246
248
 
247
- if (!animation) {
248
- baseModalStyle.display = 'block';
249
- }
249
+ baseModalStyle.display = 'block';
250
250
 
251
251
  const renderDialog = dialogProps => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
252
252
  role: "dialog",
@@ -255,7 +255,9 @@ const Modal = /*#__PURE__*/React.forwardRef(({
255
255
  className: (0, _classnames.default)(className, bsPrefix, animateStaticModal && `${bsPrefix}-static`),
256
256
  onClick: backdrop ? handleClick : undefined,
257
257
  onMouseUp: handleMouseUp,
258
+ "aria-label": ariaLabel,
258
259
  "aria-labelledby": ariaLabelledby,
260
+ "aria-describedby": ariaDescribedby,
259
261
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Dialog, { ...props,
260
262
  onMouseDown: handleDialogMouseDown,
261
263
  className: dialogClassName,
package/cjs/Overlay.js CHANGED
@@ -52,7 +52,7 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
52
52
  ...outerProps
53
53
  }, outerRef) => {
54
54
  const popperRef = (0, React.useRef)({});
55
- const [ref, modifiers] = (0, _useOverlayOffset.default)();
55
+ const [ref, modifiers] = (0, _useOverlayOffset.default)(outerProps.offset);
56
56
  const mergedRef = (0, _useMergedRefs.default)(outerRef, ref);
57
57
  const actualTransition = transition === true ? _Fade.default : transition || undefined;
58
58
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Overlay.default, { ...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']];
@@ -15,7 +15,7 @@ var _Popover = _interopRequireDefault(require("./Popover"));
15
15
 
16
16
  // This is meant for internal use.
17
17
  // This applies a custom offset to the overlay if it's a popover.
18
- function useOverlayOffset() {
18
+ function useOverlayOffset(customOffset) {
19
19
  const overlayRef = (0, _react.useRef)(null);
20
20
  const popoverClass = (0, _ThemeProvider.useBootstrapPrefix)(undefined, 'popover');
21
21
  const offset = (0, _react.useMemo)(() => ({
@@ -23,13 +23,13 @@ function useOverlayOffset() {
23
23
  options: {
24
24
  offset: () => {
25
25
  if (overlayRef.current && (0, _hasClass.default)(overlayRef.current, popoverClass)) {
26
- return _Popover.default.POPPER_OFFSET;
26
+ return customOffset || _Popover.default.POPPER_OFFSET;
27
27
  }
28
28
 
29
- return [0, 0];
29
+ return customOffset || [0, 0];
30
30
  }
31
31
  }
32
- }), [popoverClass]);
32
+ }), [customOffset, popoverClass]);
33
33
  return [overlayRef, [offset]];
34
34
  }
35
35