react-bootstrap 2.4.0 → 2.5.0

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 (75) hide show
  1. package/cjs/AccordionCollapse.d.ts +3 -0
  2. package/cjs/AccordionCollapse.js +3 -0
  3. package/cjs/CardImg.d.ts +1 -1
  4. package/cjs/Carousel.d.ts +1 -1
  5. package/cjs/CloseButton.d.ts +1 -1
  6. package/cjs/Col.js +2 -1
  7. package/cjs/Dropdown.d.ts +0 -1
  8. package/cjs/DropdownButton.d.ts +1 -0
  9. package/cjs/DropdownButton.js +9 -0
  10. package/cjs/Form.d.ts +1 -0
  11. package/cjs/FormCheck.d.ts +1 -0
  12. package/cjs/FormCheck.js +2 -1
  13. package/cjs/ListGroup.d.ts +1 -1
  14. package/cjs/Nav.d.ts +1 -1
  15. package/cjs/Navbar.d.ts +1 -1
  16. package/cjs/NavbarOffcanvas.js +4 -57
  17. package/cjs/Offcanvas.d.ts +2 -0
  18. package/cjs/Offcanvas.js +44 -32
  19. package/cjs/Overlay.d.ts +2 -7
  20. package/cjs/Overlay.js +18 -1
  21. package/cjs/OverlayTrigger.d.ts +2 -0
  22. package/cjs/Popover.d.ts +2 -2
  23. package/cjs/Row.js +2 -1
  24. package/cjs/SplitButton.d.ts +1 -0
  25. package/cjs/SplitButton.js +9 -0
  26. package/cjs/Stack.js +3 -1
  27. package/cjs/Table.d.ts +1 -1
  28. package/cjs/Table.js +1 -1
  29. package/cjs/Tabs.d.ts +10 -2
  30. package/cjs/ThemeProvider.d.ts +4 -1
  31. package/cjs/ThemeProvider.js +16 -3
  32. package/cjs/ToggleButtonGroup.js +1 -1
  33. package/cjs/Tooltip.d.ts +2 -2
  34. package/cjs/createUtilityClasses.d.ts +1 -1
  35. package/cjs/createUtilityClasses.js +2 -2
  36. package/cjs/types.d.ts +7 -0
  37. package/dist/react-bootstrap.js +594 -305
  38. package/dist/react-bootstrap.min.js +1 -1
  39. package/esm/AccordionCollapse.d.ts +3 -0
  40. package/esm/AccordionCollapse.js +4 -0
  41. package/esm/CardImg.d.ts +1 -1
  42. package/esm/Carousel.d.ts +1 -1
  43. package/esm/CloseButton.d.ts +1 -1
  44. package/esm/Col.js +3 -2
  45. package/esm/Dropdown.d.ts +0 -1
  46. package/esm/DropdownButton.d.ts +1 -0
  47. package/esm/DropdownButton.js +9 -0
  48. package/esm/Form.d.ts +1 -0
  49. package/esm/FormCheck.d.ts +1 -0
  50. package/esm/FormCheck.js +2 -1
  51. package/esm/ListGroup.d.ts +1 -1
  52. package/esm/Nav.d.ts +1 -1
  53. package/esm/Navbar.d.ts +1 -1
  54. package/esm/NavbarOffcanvas.js +4 -54
  55. package/esm/Offcanvas.d.ts +2 -0
  56. package/esm/Offcanvas.js +46 -33
  57. package/esm/Overlay.d.ts +2 -7
  58. package/esm/Overlay.js +15 -1
  59. package/esm/OverlayTrigger.d.ts +2 -0
  60. package/esm/Popover.d.ts +2 -2
  61. package/esm/Row.js +3 -2
  62. package/esm/SplitButton.d.ts +1 -0
  63. package/esm/SplitButton.js +9 -0
  64. package/esm/Stack.js +4 -2
  65. package/esm/Table.d.ts +1 -1
  66. package/esm/Table.js +1 -1
  67. package/esm/Tabs.d.ts +10 -2
  68. package/esm/ThemeProvider.d.ts +4 -1
  69. package/esm/ThemeProvider.js +12 -2
  70. package/esm/ToggleButtonGroup.js +1 -1
  71. package/esm/Tooltip.d.ts +2 -2
  72. package/esm/createUtilityClasses.d.ts +1 -1
  73. package/esm/createUtilityClasses.js +3 -3
  74. package/esm/types.d.ts +7 -0
  75. package/package.json +2 -2
@@ -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
@@ -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 && onChange) onChange(inputVal, event);
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?: any;
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[];
@@ -1,5 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
- import { DEFAULT_BREAKPOINTS } from './ThemeProvider';
2
+ import { DEFAULT_BREAKPOINTS, DEFAULT_MIN_BREAKPOINT } from './ThemeProvider';
3
3
  export function responsivePropType(propType) {
4
4
  return PropTypes.oneOfType([propType, PropTypes.shape({
5
5
  xs: propType,
@@ -10,7 +10,7 @@ export function responsivePropType(propType) {
10
10
  xxl: propType
11
11
  })]);
12
12
  }
13
- export default function createUtilityClassName(utilityValues, breakpoints = DEFAULT_BREAKPOINTS) {
13
+ export default function createUtilityClassName(utilityValues, breakpoints = DEFAULT_BREAKPOINTS, minBreakpoint = DEFAULT_MIN_BREAKPOINT) {
14
14
  const classes = [];
15
15
  Object.entries(utilityValues).forEach(([utilName, utilValue]) => {
16
16
  if (utilValue != null) {
@@ -19,7 +19,7 @@ export default function createUtilityClassName(utilityValues, breakpoints = DEFA
19
19
  const bpValue = utilValue[brkPoint];
20
20
 
21
21
  if (bpValue != null) {
22
- const infix = brkPoint !== 'xs' ? `-${brkPoint}` : '';
22
+ const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
23
23
  classes.push(`${utilName}${infix}-${bpValue}`);
24
24
  }
25
25
  });
package/esm/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
+ import { State } from '@restart/ui/usePopper';
2
3
  export declare type Variant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string;
3
4
  export declare type ButtonVariant = Variant | 'link' | 'outline-primary' | 'outline-secondary' | 'outline-success' | 'outline-danger' | 'outline-warning' | 'outline-info' | 'outline-dark' | 'outline-light';
4
5
  export declare type Color = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | 'white' | 'muted';
@@ -19,3 +20,9 @@ export declare type AlignType = AlignDirection | ResponsiveAlignProp;
19
20
  export declare const alignPropType: PropTypes.Requireable<object | AlignDirection>;
20
21
  export declare type RootCloseEvent = 'click' | 'mousedown';
21
22
  export declare type GapValue = 0 | 1 | 2 | 3 | 4 | 5;
23
+ export interface PopperRef {
24
+ state: State | undefined;
25
+ outOfBoundaries: boolean;
26
+ placement: Placement | undefined;
27
+ scheduleUpdate?: () => void;
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-bootstrap",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Bootstrap 5 components built with React",
5
5
  "keywords": [
6
6
  "bootstrap",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@babel/runtime": "^7.17.2",
39
39
  "@restart/hooks": "^0.4.6",
40
- "@restart/ui": "^1.2.0",
40
+ "@restart/ui": "^1.3.1",
41
41
  "@types/react-transition-group": "^4.4.4",
42
42
  "classnames": "^2.3.1",
43
43
  "dom-helpers": "^5.2.1",