react-bootstrap 2.1.2 → 2.2.2

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.
Files changed (59) hide show
  1. package/cjs/Carousel.js +12 -12
  2. package/cjs/Col.d.ts +1 -0
  3. package/cjs/Col.js +2 -3
  4. package/cjs/Container.d.ts +1 -1
  5. package/cjs/DropdownMenu.d.ts +1 -3
  6. package/cjs/ListGroup.d.ts +1 -1
  7. package/cjs/Modal.d.ts +1 -1
  8. package/cjs/Modal.js +7 -5
  9. package/cjs/ModalDialog.d.ts +1 -1
  10. package/cjs/Navbar.d.ts +1 -1
  11. package/cjs/Overlay.js +1 -1
  12. package/cjs/Row.d.ts +1 -0
  13. package/cjs/Row.js +2 -2
  14. package/cjs/Stack.js +3 -1
  15. package/cjs/Tab.d.ts +1 -0
  16. package/cjs/Tab.js +6 -1
  17. package/cjs/TabPane.js +3 -3
  18. package/cjs/Tabs.js +3 -0
  19. package/cjs/ThemeProvider.d.ts +4 -1
  20. package/cjs/ThemeProvider.js +16 -3
  21. package/cjs/createUtilityClasses.d.ts +1 -2
  22. package/cjs/createUtilityClasses.js +4 -6
  23. package/cjs/index.d.ts +2 -0
  24. package/cjs/index.js +5 -1
  25. package/cjs/types.d.ts +2 -12
  26. package/cjs/types.js +1 -1
  27. package/cjs/useOverlayOffset.d.ts +2 -5
  28. package/cjs/useOverlayOffset.js +4 -4
  29. package/dist/react-bootstrap.js +221 -303
  30. package/dist/react-bootstrap.min.js +1 -1
  31. package/esm/Carousel.js +12 -12
  32. package/esm/Col.d.ts +1 -0
  33. package/esm/Col.js +3 -3
  34. package/esm/Container.d.ts +1 -1
  35. package/esm/DropdownMenu.d.ts +1 -3
  36. package/esm/ListGroup.d.ts +1 -1
  37. package/esm/Modal.d.ts +1 -1
  38. package/esm/Modal.js +7 -5
  39. package/esm/ModalDialog.d.ts +1 -1
  40. package/esm/Navbar.d.ts +1 -1
  41. package/esm/Overlay.js +1 -1
  42. package/esm/Row.d.ts +1 -0
  43. package/esm/Row.js +3 -3
  44. package/esm/Stack.js +4 -2
  45. package/esm/Tab.d.ts +1 -0
  46. package/esm/Tab.js +6 -1
  47. package/esm/TabPane.js +2 -2
  48. package/esm/Tabs.js +3 -0
  49. package/esm/ThemeProvider.d.ts +4 -1
  50. package/esm/ThemeProvider.js +12 -2
  51. package/esm/createUtilityClasses.d.ts +1 -2
  52. package/esm/createUtilityClasses.js +3 -3
  53. package/esm/index.d.ts +2 -0
  54. package/esm/index.js +1 -0
  55. package/esm/types.d.ts +2 -12
  56. package/esm/types.js +1 -1
  57. package/esm/useOverlayOffset.d.ts +2 -5
  58. package/esm/useOverlayOffset.js +4 -4
  59. package/package.json +12 -10
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
- if (!isSliding && activeIndex !== renderedActiveIndex) {
99
- if (nextDirectionRef.current) {
100
- setDirection(nextDirectionRef.current);
101
- } else {
102
- setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
103
- }
105
+ if (slide) {
106
+ setIsSliding(true);
107
+ }
104
108
 
105
- if (slide) {
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/Col.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface ColProps extends BsPrefixProps, React.HTMLAttributes<HTMLElemen
16
16
  lg?: ColSpec;
17
17
  xl?: ColSpec;
18
18
  xxl?: ColSpec;
19
+ [key: string]: any;
19
20
  }
20
21
  export interface UseColMetadata {
21
22
  as?: React.ElementType;
package/esm/Col.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import * as React from 'react';
3
- import { useBootstrapPrefix } from './ThemeProvider';
3
+ import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const DEVICE_SIZES = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
6
5
  export function useCol({
7
6
  as,
8
7
  bsPrefix,
@@ -10,9 +9,10 @@ export function useCol({
10
9
  ...props
11
10
  }) {
12
11
  bsPrefix = useBootstrapPrefix(bsPrefix, 'col');
12
+ const breakpoints = useBootstrapBreakpoints();
13
13
  const spans = [];
14
14
  const classes = [];
15
- DEVICE_SIZES.forEach(brkPoint => {
15
+ breakpoints.forEach(brkPoint => {
16
16
  const propValue = props[brkPoint];
17
17
  delete props[brkPoint];
18
18
  let span;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
3
3
  export interface ContainerProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
4
- fluid?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
4
+ fluid?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
5
5
  }
6
6
  declare const Container: BsPrefixRefForwardingComponent<'div', ContainerProps>;
7
7
  export default Container;
@@ -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;
@@ -3,7 +3,7 @@ import { EventKey } from '@restart/ui/types';
3
3
  import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
4
4
  export interface ListGroupProps extends BsPrefixProps, BaseNavProps {
5
5
  variant?: 'flush';
6
- horizontal?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
6
+ horizontal?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
7
7
  defaultActiveKey?: EventKey;
8
8
  numbered?: boolean;
9
9
  }
package/esm/Modal.d.ts CHANGED
@@ -3,7 +3,7 @@ import { BaseModalProps } from '@restart/ui/Modal';
3
3
  import { BsPrefixRefForwardingComponent } from './helpers';
4
4
  export interface ModalProps extends Omit<BaseModalProps, 'role' | 'renderBackdrop' | 'renderDialog' | 'transition' | 'backdropTransition' | 'children'> {
5
5
  size?: 'sm' | 'lg' | 'xl';
6
- fullscreen?: true | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down';
6
+ fullscreen?: true | string | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down';
7
7
  bsPrefix?: string;
8
8
  centered?: boolean;
9
9
  backdropClassName?: string;
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
- }; // Sets `display` always block when `animation` is false
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
- if (!animation) {
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,
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { BsPrefixProps } from './helpers';
3
3
  export interface ModalDialogProps extends React.HTMLAttributes<HTMLDivElement>, BsPrefixProps {
4
4
  size?: 'sm' | 'lg' | 'xl';
5
- fullscreen?: true | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down';
5
+ fullscreen?: true | string | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down';
6
6
  centered?: boolean;
7
7
  scrollable?: boolean;
8
8
  contentClassName?: string;
package/esm/Navbar.d.ts CHANGED
@@ -3,7 +3,7 @@ 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
5
  variant?: 'light' | 'dark';
6
- expand?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
6
+ expand?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
7
7
  bg?: string;
8
8
  fixed?: 'top' | 'bottom';
9
9
  sticky?: 'top';
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,
package/esm/Row.d.ts CHANGED
@@ -11,6 +11,7 @@ export interface RowProps extends BsPrefixProps, React.HTMLAttributes<HTMLElemen
11
11
  lg?: RowColumns;
12
12
  xl?: RowColumns;
13
13
  xxl?: RowColumns;
14
+ [key: string]: any;
14
15
  }
15
16
  declare const Row: BsPrefixRefForwardingComponent<'div', RowProps>;
16
17
  export default Row;
package/esm/Row.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import * as React from 'react';
3
- import { useBootstrapPrefix } from './ThemeProvider';
3
+ import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const DEVICE_SIZES = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
6
5
  const Row = /*#__PURE__*/React.forwardRef(({
7
6
  bsPrefix,
8
7
  className,
@@ -11,9 +10,10 @@ const Row = /*#__PURE__*/React.forwardRef(({
11
10
  ...props
12
11
  }, ref) => {
13
12
  const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'row');
13
+ const breakpoints = useBootstrapBreakpoints();
14
14
  const sizePrefix = `${decoratedBsPrefix}-cols`;
15
15
  const classes = [];
16
- DEVICE_SIZES.forEach(brkPoint => {
16
+ breakpoints.forEach(brkPoint => {
17
17
  const propValue = props[brkPoint];
18
18
  delete props[brkPoint];
19
19
  let cols;
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 } from './ThemeProvider';
3
+ import { useBootstrapPrefix, useBootstrapBreakpoints } 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(({
@@ -12,10 +12,12 @@ const Stack = /*#__PURE__*/React.forwardRef(({
12
12
  ...props
13
13
  }, ref) => {
14
14
  bsPrefix = useBootstrapPrefix(bsPrefix, direction === 'horizontal' ? 'hstack' : 'vstack');
15
+ const breakpoints = useBootstrapBreakpoints();
15
16
  return /*#__PURE__*/_jsx(Component, { ...props,
16
17
  ref: ref,
17
18
  className: classNames(className, bsPrefix, ...createUtilityClassName({
18
- gap
19
+ gap,
20
+ breakpoints
19
21
  }))
20
22
  });
21
23
  });
package/esm/Tab.d.ts CHANGED
@@ -5,6 +5,7 @@ export interface TabProps extends Omit<TabPaneProps, 'title'> {
5
5
  title: React.ReactNode;
6
6
  disabled?: boolean;
7
7
  tabClassName?: string;
8
+ tabAttrs?: Record<string, any>;
8
9
  }
9
10
  declare const _default: React.FC<TabProps> & {
10
11
  Container: {
package/esm/Tab.js CHANGED
@@ -23,7 +23,12 @@ const propTypes = {
23
23
  /**
24
24
  * Class to pass to the underlying nav link.
25
25
  */
26
- tabClassName: PropTypes.string
26
+ tabClassName: PropTypes.string,
27
+
28
+ /**
29
+ * Object containing attributes to pass to underlying nav link.
30
+ */
31
+ tabAttrs: PropTypes.object
27
32
  };
28
33
 
29
34
  const Tab = () => {
package/esm/TabPane.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import classNames from 'classnames';
2
2
  import * as React from 'react';
3
- import NoopTransition from '@restart/ui/NoopTransition';
4
3
  import SelectableContext from '@restart/ui/SelectableContext';
5
4
  import TabContext from '@restart/ui/TabContext';
6
5
  import { useTabPanel } from '@restart/ui/TabPanel';
7
6
  import { useBootstrapPrefix } from './ThemeProvider';
7
+ import Fade from './Fade';
8
8
  import getTabTransitionComponent from './getTabTransitionComponent';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  const TabPane = /*#__PURE__*/React.forwardRef(({
@@ -27,7 +27,7 @@ const TabPane = /*#__PURE__*/React.forwardRef(({
27
27
  onExited,
28
28
  mountOnEnter,
29
29
  unmountOnExit,
30
- transition: Transition = NoopTransition
30
+ transition: Transition = Fade
31
31
  }] = useTabPanel({ ...props,
32
32
  transition: getTabTransitionComponent(transition)
33
33
  });
package/esm/Tabs.js CHANGED
@@ -32,6 +32,7 @@ function renderTab(child) {
32
32
  eventKey,
33
33
  disabled,
34
34
  tabClassName,
35
+ tabAttrs,
35
36
  id
36
37
  } = child.props;
37
38
 
@@ -49,6 +50,7 @@ function renderTab(child) {
49
50
  disabled: disabled,
50
51
  id: id,
51
52
  className: tabClassName,
53
+ ...tabAttrs,
52
54
  children: title
53
55
  })
54
56
  });
@@ -85,6 +87,7 @@ const Tabs = props => {
85
87
  delete childProps.title;
86
88
  delete childProps.disabled;
87
89
  delete childProps.tabClassName;
90
+ delete childProps.tabAttrs;
88
91
  return /*#__PURE__*/_jsx(TabPane, { ...childProps
89
92
  });
90
93
  })
@@ -1,17 +1,20 @@
1
1
  import * as React from 'react';
2
+ export declare const DEFAULT_BREAKPOINTS: string[];
2
3
  export interface ThemeContextValue {
3
4
  prefixes: Record<string, string>;
5
+ breakpoints: string[];
4
6
  dir?: string;
5
7
  }
6
8
  export interface ThemeProviderProps extends Partial<ThemeContextValue> {
7
9
  children: React.ReactNode;
8
10
  }
9
11
  declare const Consumer: React.Consumer<ThemeContextValue>;
10
- declare function ThemeProvider({ prefixes, dir, children }: ThemeProviderProps): JSX.Element;
12
+ declare function ThemeProvider({ prefixes, breakpoints, dir, children, }: ThemeProviderProps): JSX.Element;
11
13
  declare namespace ThemeProvider {
12
14
  var propTypes: any;
13
15
  }
14
16
  export declare function useBootstrapPrefix(prefix: string | undefined, defaultPrefix: string): string;
17
+ export declare function useBootstrapBreakpoints(): string[];
15
18
  export declare function useIsRTL(): boolean;
16
19
  declare function createBootstrapComponent(Component: any, opts: any): React.ForwardRefExoticComponent<{
17
20
  bsPrefix?: string | undefined;
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { useContext, useMemo } from 'react';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
+ export const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
4
5
  const ThemeContext = /*#__PURE__*/React.createContext({
5
- prefixes: {}
6
+ prefixes: {},
7
+ breakpoints: DEFAULT_BREAKPOINTS
6
8
  });
7
9
  const {
8
10
  Consumer,
@@ -11,14 +13,16 @@ const {
11
13
 
12
14
  function ThemeProvider({
13
15
  prefixes = {},
16
+ breakpoints = DEFAULT_BREAKPOINTS,
14
17
  dir,
15
18
  children
16
19
  }) {
17
20
  const contextValue = useMemo(() => ({
18
21
  prefixes: { ...prefixes
19
22
  },
23
+ breakpoints,
20
24
  dir
21
- }), [prefixes, dir]);
25
+ }), [prefixes, breakpoints, dir]);
22
26
  return /*#__PURE__*/_jsx(Provider, {
23
27
  value: contextValue,
24
28
  children: children
@@ -31,6 +35,12 @@ export function useBootstrapPrefix(prefix, defaultPrefix) {
31
35
  } = useContext(ThemeContext);
32
36
  return prefix || prefixes[defaultPrefix] || defaultPrefix;
33
37
  }
38
+ export function useBootstrapBreakpoints() {
39
+ const {
40
+ breakpoints
41
+ } = useContext(ThemeContext);
42
+ return breakpoints;
43
+ }
34
44
  export function useIsRTL() {
35
45
  const {
36
46
  dir
@@ -8,5 +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 declare const DEVICE_SIZES: readonly ["xxl", "xl", "lg", "md", "sm", "xs"];
12
- export default function createUtilityClassName(utilityValues: Record<string, ResponsiveUtilityValue<unknown>>): string[];
11
+ export default function createUtilityClassName(utilityValues: Record<string, ResponsiveUtilityValue<unknown>>, breakpoints?: string[]): string[];
@@ -1,4 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
+ import { DEFAULT_BREAKPOINTS } from './ThemeProvider';
2
3
  export function responsivePropType(propType) {
3
4
  return PropTypes.oneOfType([propType, PropTypes.shape({
4
5
  xs: propType,
@@ -9,13 +10,12 @@ export function responsivePropType(propType) {
9
10
  xxl: propType
10
11
  })]);
11
12
  }
12
- export const DEVICE_SIZES = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
13
- export default function createUtilityClassName(utilityValues) {
13
+ export default function createUtilityClassName(utilityValues, breakpoints = DEFAULT_BREAKPOINTS) {
14
14
  const classes = [];
15
15
  Object.entries(utilityValues).forEach(([utilName, utilValue]) => {
16
16
  if (utilValue != null) {
17
17
  if (typeof utilValue === 'object') {
18
- DEVICE_SIZES.forEach(brkPoint => {
18
+ breakpoints.forEach(brkPoint => {
19
19
  const bpValue = utilValue[brkPoint];
20
20
 
21
21
  if (bpValue != null) {
package/esm/index.d.ts CHANGED
@@ -75,6 +75,8 @@ export type { ModalProps } from './Modal';
75
75
  export { default as ModalBody } from './ModalBody';
76
76
  export { default as ModalDialog } from './ModalDialog';
77
77
  export type { ModalDialogProps } from './ModalDialog';
78
+ export { default as ModalHeader } from './ModalHeader';
79
+ export type { ModalHeaderProps } from './ModalHeader';
78
80
  export { default as ModalFooter } from './ModalFooter';
79
81
  export { default as ModalTitle } from './ModalTitle';
80
82
  export { default as Nav } from './Nav';
package/esm/index.js CHANGED
@@ -39,6 +39,7 @@ export { default as ListGroupItem } from './ListGroupItem';
39
39
  export { default as Modal } from './Modal';
40
40
  export { default as ModalBody } from './ModalBody';
41
41
  export { default as ModalDialog } from './ModalDialog';
42
+ export { default as ModalHeader } from './ModalHeader';
42
43
  export { default as ModalFooter } from './ModalFooter';
43
44
  export { default as ModalTitle } from './ModalTitle';
44
45
  export { default as Nav } from './Nav';
package/esm/types.d.ts CHANGED
@@ -14,18 +14,8 @@ export declare type ResponsiveAlignProp = {
14
14
  xl: AlignDirection;
15
15
  } | {
16
16
  xxl: AlignDirection;
17
- };
17
+ } | Record<string, AlignDirection>;
18
18
  export declare type AlignType = AlignDirection | ResponsiveAlignProp;
19
- export declare const alignPropType: PropTypes.Requireable<AlignDirection | PropTypes.InferProps<{
20
- sm: PropTypes.Requireable<AlignDirection>;
21
- }> | PropTypes.InferProps<{
22
- md: PropTypes.Requireable<AlignDirection>;
23
- }> | PropTypes.InferProps<{
24
- lg: PropTypes.Requireable<AlignDirection>;
25
- }> | PropTypes.InferProps<{
26
- xl: PropTypes.Requireable<AlignDirection>;
27
- }> | PropTypes.InferProps<{
28
- xxl: PropTypes.Requireable<AlignDirection>;
29
- }>>;
19
+ export declare const alignPropType: PropTypes.Requireable<object | AlignDirection>;
30
20
  export declare type RootCloseEvent = 'click' | 'mousedown';
31
21
  export declare type GapValue = 0 | 1 | 2 | 3 | 4 | 5;
package/esm/types.js CHANGED
@@ -10,4 +10,4 @@ export const alignPropType = PropTypes.oneOfType([alignDirection, PropTypes.shap
10
10
  xl: alignDirection
11
11
  }), PropTypes.shape({
12
12
  xxl: alignDirection
13
- })]);
13
+ }), PropTypes.object]);
@@ -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']];
@@ -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.1.2",
3
+ "version": "2.2.2",
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": {
@@ -33,20 +35,20 @@
33
35
  "trailingComma": "all"
34
36
  },
35
37
  "dependencies": {
36
- "@babel/runtime": "^7.14.0",
38
+ "@babel/runtime": "^7.17.2",
37
39
  "@restart/hooks": "^0.4.5",
38
- "@restart/ui": "^1.0.1",
39
- "@types/invariant": "^2.2.33",
40
- "@types/prop-types": "^15.7.3",
40
+ "@restart/ui": "^1.2.0",
41
+ "@types/invariant": "^2.2.35",
42
+ "@types/prop-types": "^15.7.4",
41
43
  "@types/react": ">=16.14.8",
42
- "@types/react-transition-group": "^4.4.1",
44
+ "@types/react-transition-group": "^4.4.4",
43
45
  "@types/warning": "^3.0.0",
44
46
  "classnames": "^2.3.1",
45
47
  "dom-helpers": "^5.2.1",
46
48
  "invariant": "^2.2.4",
47
- "prop-types": "^15.7.2",
49
+ "prop-types": "^15.8.1",
48
50
  "prop-types-extra": "^1.1.0",
49
- "react-transition-group": "^4.4.1",
51
+ "react-transition-group": "^4.4.2",
50
52
  "uncontrollable": "^7.2.1",
51
53
  "warning": "^4.0.3"
52
54
  },