react-bootstrap 2.5.0 → 2.7.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 (330) hide show
  1. package/cjs/AbstractModalHeader.js +0 -9
  2. package/cjs/AbstractNav.d.ts +15 -0
  3. package/cjs/AbstractNavItem.d.ts +19 -0
  4. package/cjs/Accordion.js +0 -17
  5. package/cjs/AccordionBody.d.ts +2 -1
  6. package/cjs/AccordionBody.js +12 -10
  7. package/cjs/AccordionButton.d.ts +1 -1
  8. package/cjs/AccordionButton.js +0 -15
  9. package/cjs/AccordionCollapse.js +0 -10
  10. package/cjs/AccordionContext.d.ts +1 -1
  11. package/cjs/AccordionContext.js +0 -5
  12. package/cjs/AccordionHeader.js +0 -9
  13. package/cjs/AccordionItem.js +0 -9
  14. package/cjs/AccordionItemContext.js +0 -4
  15. package/cjs/AccordionToggle.d.ts +11 -0
  16. package/cjs/Alert.js +0 -17
  17. package/cjs/Anchor.js +0 -3
  18. package/cjs/Badge.js +0 -8
  19. package/cjs/BootstrapModalManager.js +2 -18
  20. package/cjs/Breadcrumb.js +2 -12
  21. package/cjs/BreadcrumbItem.js +2 -10
  22. package/cjs/Button.d.ts +1 -1
  23. package/cjs/Button.js +2 -10
  24. package/cjs/ButtonGroup.js +2 -9
  25. package/cjs/ButtonToolbar.js +2 -9
  26. package/cjs/Card.js +0 -14
  27. package/cjs/CardColumns.d.ts +2 -0
  28. package/cjs/CardContext.d.ts +6 -0
  29. package/cjs/CardDeck.d.ts +2 -0
  30. package/cjs/CardGroup.js +0 -4
  31. package/cjs/CardHeader.js +0 -9
  32. package/cjs/CardHeaderContext.js +0 -4
  33. package/cjs/CardImg.js +2 -9
  34. package/cjs/Carousel.d.ts +1 -1
  35. package/cjs/Carousel.js +9 -58
  36. package/cjs/CarouselCaption.js +0 -4
  37. package/cjs/CarouselItem.js +0 -8
  38. package/cjs/CloseButton.d.ts +1 -1
  39. package/cjs/CloseButton.js +2 -9
  40. package/cjs/Col.d.ts +5 -5
  41. package/cjs/Col.js +6 -14
  42. package/cjs/Collapse.d.ts +1 -1
  43. package/cjs/Collapse.js +10 -22
  44. package/cjs/Container.js +0 -8
  45. package/cjs/Dropdown.js +17 -27
  46. package/cjs/DropdownButton.js +1 -25
  47. package/cjs/DropdownContext.d.ts +2 -2
  48. package/cjs/DropdownContext.js +0 -4
  49. package/cjs/DropdownItem.js +2 -11
  50. package/cjs/DropdownMenu.d.ts +2 -2
  51. package/cjs/DropdownMenu.js +12 -34
  52. package/cjs/DropdownToggle.d.ts +2 -2
  53. package/cjs/DropdownToggle.js +7 -24
  54. package/cjs/ElementChildren.js +2 -8
  55. package/cjs/Fade.js +2 -12
  56. package/cjs/Feedback.d.ts +1 -1
  57. package/cjs/Feedback.js +4 -11
  58. package/cjs/Figure.js +0 -7
  59. package/cjs/FigureCaption.js +0 -3
  60. package/cjs/FigureImage.js +0 -8
  61. package/cjs/FloatingLabel.js +0 -9
  62. package/cjs/Form.d.ts +5 -5
  63. package/cjs/Form.js +2 -22
  64. package/cjs/FormCheck.d.ts +1 -1
  65. package/cjs/FormCheck.js +2 -16
  66. package/cjs/FormCheckInput.d.ts +1 -1
  67. package/cjs/FormCheckInput.js +2 -10
  68. package/cjs/FormCheckLabel.js +2 -10
  69. package/cjs/FormContext.js +0 -4
  70. package/cjs/FormControl.d.ts +1 -1
  71. package/cjs/FormControl.js +2 -16
  72. package/cjs/FormFile.d.ts +23 -0
  73. package/cjs/FormFileInput.d.ts +10 -0
  74. package/cjs/FormFileLabel.d.ts +7 -0
  75. package/cjs/FormFloating.js +0 -4
  76. package/cjs/FormGroup.js +2 -8
  77. package/cjs/FormLabel.d.ts +1 -1
  78. package/cjs/FormLabel.js +0 -11
  79. package/cjs/FormRange.js +2 -10
  80. package/cjs/FormSelect.js +2 -10
  81. package/cjs/FormText.js +4 -10
  82. package/cjs/Image.js +0 -13
  83. package/cjs/InputGroup.js +3 -18
  84. package/cjs/InputGroupContext.js +0 -4
  85. package/cjs/Jumbotron.d.ts +7 -0
  86. package/cjs/ListGroup.js +0 -16
  87. package/cjs/ListGroupItem.js +4 -15
  88. package/cjs/Media.d.ts +8 -0
  89. package/cjs/Modal.js +32 -73
  90. package/cjs/ModalBody.js +0 -4
  91. package/cjs/ModalContext.js +0 -5
  92. package/cjs/ModalDialog.js +2 -9
  93. package/cjs/ModalFooter.js +0 -4
  94. package/cjs/ModalHeader.js +0 -9
  95. package/cjs/ModalTitle.js +0 -6
  96. package/cjs/Nav.js +0 -19
  97. package/cjs/NavContext.js +0 -4
  98. package/cjs/NavDropdown.js +0 -12
  99. package/cjs/NavItem.js +0 -4
  100. package/cjs/NavLink.js +2 -12
  101. package/cjs/Navbar.js +3 -22
  102. package/cjs/NavbarBrand.js +2 -9
  103. package/cjs/NavbarCollapse.js +0 -9
  104. package/cjs/NavbarContext.js +0 -4
  105. package/cjs/NavbarOffcanvas.d.ts +1 -1
  106. package/cjs/NavbarOffcanvas.js +0 -8
  107. package/cjs/NavbarToggle.js +2 -13
  108. package/cjs/Offcanvas.d.ts +1 -1
  109. package/cjs/Offcanvas.js +9 -37
  110. package/cjs/OffcanvasBody.js +0 -4
  111. package/cjs/OffcanvasHeader.js +0 -9
  112. package/cjs/OffcanvasTitle.js +0 -6
  113. package/cjs/OffcanvasToggling.js +2 -12
  114. package/cjs/Overlay.d.ts +1 -1
  115. package/cjs/Overlay.js +12 -27
  116. package/cjs/OverlayTrigger.d.ts +9 -9
  117. package/cjs/OverlayTrigger.js +7 -32
  118. package/cjs/PageItem.js +3 -12
  119. package/cjs/Pagination.js +0 -11
  120. package/cjs/Placeholder.js +2 -11
  121. package/cjs/PlaceholderButton.js +2 -9
  122. package/cjs/Popover.js +0 -13
  123. package/cjs/PopoverBody.js +0 -4
  124. package/cjs/PopoverContent.d.ts +5 -0
  125. package/cjs/PopoverHeader.js +0 -4
  126. package/cjs/PopoverTitle.d.ts +5 -0
  127. package/cjs/ProgressBar.js +2 -20
  128. package/cjs/Ratio.d.ts +1 -1
  129. package/cjs/Ratio.js +3 -12
  130. package/cjs/ResponsiveEmbed.d.ts +9 -0
  131. package/cjs/Row.d.ts +2 -2
  132. package/cjs/Row.js +0 -10
  133. package/cjs/SSRProvider.js +0 -2
  134. package/cjs/SafeAnchor.d.ts +17 -0
  135. package/cjs/SelectableContext.d.ts +5 -0
  136. package/cjs/Spinner.d.ts +1 -1
  137. package/cjs/Spinner.js +1 -9
  138. package/cjs/SplitButton.js +1 -27
  139. package/cjs/Stack.d.ts +1 -1
  140. package/cjs/Stack.js +2 -10
  141. package/cjs/Switch.d.ts +1 -1
  142. package/cjs/Switch.js +2 -10
  143. package/cjs/Tab.d.ts +2 -2
  144. package/cjs/Tab.js +2 -20
  145. package/cjs/TabContainer.d.ts +2 -2
  146. package/cjs/TabContainer.js +2 -10
  147. package/cjs/TabContent.js +0 -4
  148. package/cjs/TabContext.d.ts +12 -0
  149. package/cjs/TabPane.js +7 -17
  150. package/cjs/Table.js +2 -13
  151. package/cjs/Tabs.d.ts +3 -3
  152. package/cjs/Tabs.js +6 -24
  153. package/cjs/ThemeProvider.js +8 -17
  154. package/cjs/Toast.js +5 -18
  155. package/cjs/ToastBody.js +0 -4
  156. package/cjs/ToastContainer.d.ts +1 -1
  157. package/cjs/ToastContainer.js +0 -8
  158. package/cjs/ToastContext.js +0 -5
  159. package/cjs/ToastFade.js +2 -9
  160. package/cjs/ToastHeader.js +0 -11
  161. package/cjs/ToggleButton.d.ts +1 -1
  162. package/cjs/ToggleButton.js +2 -11
  163. package/cjs/ToggleButtonGroup.d.ts +2 -2
  164. package/cjs/ToggleButtonGroup.js +2 -23
  165. package/cjs/Tooltip.js +0 -9
  166. package/cjs/TransitionWrapper.d.ts +1 -1
  167. package/cjs/TransitionWrapper.js +3 -15
  168. package/cjs/createChainedFunction.js +2 -5
  169. package/cjs/createUtilityClasses.d.ts +1 -1
  170. package/cjs/createUtilityClasses.js +0 -6
  171. package/cjs/createWithBsPrefix.js +0 -11
  172. package/cjs/divWithClassName.js +2 -9
  173. package/cjs/getTabTransitionComponent.js +0 -6
  174. package/cjs/helpers.d.ts +4 -4
  175. package/cjs/helpers.js +2 -9
  176. package/cjs/index.js +0 -171
  177. package/cjs/safeFindDOMNode.d.ts +1 -1
  178. package/cjs/safeFindDOMNode.js +0 -5
  179. package/cjs/transitionEndListener.js +0 -6
  180. package/cjs/triggerBrowserReflow.js +0 -2
  181. package/cjs/types.d.ts +10 -10
  182. package/cjs/types.js +0 -5
  183. package/cjs/useOverlayOffset.js +0 -8
  184. package/cjs/usePlaceholder.d.ts +2 -2
  185. package/cjs/usePlaceholder.js +2 -7
  186. package/cjs/usePopperMarginModifiers.d.ts +4 -0
  187. package/cjs/useWrappedRefWithWarning.js +4 -9
  188. package/dist/react-bootstrap.js +750 -2195
  189. package/dist/react-bootstrap.min.js +1 -1
  190. package/esm/AbstractNav.d.ts +15 -0
  191. package/esm/AbstractNavItem.d.ts +19 -0
  192. package/esm/AccordionBody.d.ts +2 -1
  193. package/esm/AccordionBody.js +12 -0
  194. package/esm/AccordionButton.d.ts +1 -1
  195. package/esm/AccordionButton.js +0 -4
  196. package/esm/AccordionCollapse.js +0 -1
  197. package/esm/AccordionContext.d.ts +1 -1
  198. package/esm/AccordionToggle.d.ts +11 -0
  199. package/esm/Alert.js +0 -2
  200. package/esm/BootstrapModalManager.js +2 -9
  201. package/esm/Breadcrumb.js +2 -1
  202. package/esm/BreadcrumbItem.js +2 -1
  203. package/esm/Button.d.ts +1 -1
  204. package/esm/Button.js +2 -1
  205. package/esm/ButtonGroup.js +2 -1
  206. package/esm/ButtonToolbar.js +2 -1
  207. package/esm/CardColumns.d.ts +2 -0
  208. package/esm/CardContext.d.ts +6 -0
  209. package/esm/CardDeck.d.ts +2 -0
  210. package/esm/CardImg.js +2 -1
  211. package/esm/Carousel.d.ts +1 -1
  212. package/esm/Carousel.js +9 -36
  213. package/esm/CloseButton.d.ts +1 -1
  214. package/esm/CloseButton.js +2 -1
  215. package/esm/Col.d.ts +5 -5
  216. package/esm/Col.js +6 -5
  217. package/esm/Collapse.d.ts +1 -1
  218. package/esm/Collapse.js +11 -8
  219. package/esm/Dropdown.js +17 -7
  220. package/esm/DropdownButton.js +1 -14
  221. package/esm/DropdownContext.d.ts +2 -2
  222. package/esm/DropdownItem.js +2 -1
  223. package/esm/DropdownMenu.d.ts +2 -2
  224. package/esm/DropdownMenu.js +12 -15
  225. package/esm/DropdownToggle.d.ts +2 -2
  226. package/esm/DropdownToggle.js +7 -10
  227. package/esm/ElementChildren.js +3 -6
  228. package/esm/Fade.js +2 -1
  229. package/esm/Feedback.d.ts +1 -1
  230. package/esm/Feedback.js +4 -3
  231. package/esm/Form.d.ts +5 -5
  232. package/esm/Form.js +2 -2
  233. package/esm/FormCheck.d.ts +1 -1
  234. package/esm/FormCheck.js +2 -3
  235. package/esm/FormCheckInput.d.ts +1 -1
  236. package/esm/FormCheckInput.js +2 -1
  237. package/esm/FormCheckLabel.js +2 -1
  238. package/esm/FormContext.js +3 -1
  239. package/esm/FormControl.d.ts +1 -1
  240. package/esm/FormControl.js +2 -3
  241. package/esm/FormFile.d.ts +23 -0
  242. package/esm/FormFileInput.d.ts +10 -0
  243. package/esm/FormFileLabel.d.ts +7 -0
  244. package/esm/FormGroup.js +2 -1
  245. package/esm/FormLabel.d.ts +1 -1
  246. package/esm/FormRange.js +2 -1
  247. package/esm/FormSelect.js +2 -1
  248. package/esm/FormText.js +4 -2
  249. package/esm/Image.js +0 -4
  250. package/esm/InputGroup.js +3 -5
  251. package/esm/Jumbotron.d.ts +7 -0
  252. package/esm/ListGroup.js +0 -2
  253. package/esm/ListGroupItem.js +4 -4
  254. package/esm/Media.d.ts +8 -0
  255. package/esm/Modal.js +32 -44
  256. package/esm/ModalContext.js +0 -1
  257. package/esm/ModalDialog.js +2 -1
  258. package/esm/Nav.js +0 -2
  259. package/esm/NavLink.js +2 -1
  260. package/esm/Navbar.js +3 -4
  261. package/esm/NavbarBrand.js +2 -1
  262. package/esm/NavbarContext.js +3 -1
  263. package/esm/NavbarOffcanvas.d.ts +1 -1
  264. package/esm/NavbarToggle.js +2 -3
  265. package/esm/Offcanvas.d.ts +1 -1
  266. package/esm/Offcanvas.js +9 -16
  267. package/esm/OffcanvasToggling.js +2 -1
  268. package/esm/Overlay.d.ts +1 -1
  269. package/esm/Overlay.js +12 -12
  270. package/esm/OverlayTrigger.d.ts +9 -9
  271. package/esm/OverlayTrigger.js +7 -20
  272. package/esm/PageItem.js +2 -4
  273. package/esm/Pagination.js +0 -1
  274. package/esm/Placeholder.js +2 -1
  275. package/esm/PlaceholderButton.js +2 -1
  276. package/esm/PopoverContent.d.ts +5 -0
  277. package/esm/PopoverTitle.d.ts +5 -0
  278. package/esm/ProgressBar.js +2 -12
  279. package/esm/Ratio.d.ts +1 -1
  280. package/esm/Ratio.js +3 -4
  281. package/esm/ResponsiveEmbed.d.ts +9 -0
  282. package/esm/Row.d.ts +2 -2
  283. package/esm/Row.js +0 -2
  284. package/esm/SafeAnchor.d.ts +17 -0
  285. package/esm/SelectableContext.d.ts +5 -0
  286. package/esm/Spinner.d.ts +1 -1
  287. package/esm/Spinner.js +1 -1
  288. package/esm/SplitButton.js +1 -16
  289. package/esm/Stack.d.ts +1 -1
  290. package/esm/Stack.js +2 -1
  291. package/esm/Switch.d.ts +1 -1
  292. package/esm/Switch.js +2 -1
  293. package/esm/Tab.d.ts +2 -2
  294. package/esm/Tab.js +2 -9
  295. package/esm/TabContainer.d.ts +2 -2
  296. package/esm/TabContainer.js +2 -3
  297. package/esm/TabContext.d.ts +12 -0
  298. package/esm/TabPane.js +7 -4
  299. package/esm/Table.js +2 -6
  300. package/esm/Tabs.d.ts +3 -3
  301. package/esm/Tabs.js +6 -9
  302. package/esm/ThemeProvider.js +8 -9
  303. package/esm/Toast.js +5 -5
  304. package/esm/ToastContainer.d.ts +1 -1
  305. package/esm/ToastContext.js +0 -1
  306. package/esm/ToastFade.js +2 -1
  307. package/esm/ToggleButton.d.ts +1 -1
  308. package/esm/ToggleButton.js +2 -3
  309. package/esm/ToggleButtonGroup.d.ts +2 -2
  310. package/esm/ToggleButtonGroup.js +2 -9
  311. package/esm/TransitionWrapper.d.ts +1 -1
  312. package/esm/TransitionWrapper.js +3 -5
  313. package/esm/createChainedFunction.js +2 -4
  314. package/esm/createUtilityClasses.d.ts +1 -1
  315. package/esm/createUtilityClasses.js +0 -1
  316. package/esm/createWithBsPrefix.js +0 -2
  317. package/esm/divWithClassName.js +2 -1
  318. package/esm/getTabTransitionComponent.js +0 -1
  319. package/esm/helpers.d.ts +4 -4
  320. package/esm/helpers.js +3 -3
  321. package/esm/safeFindDOMNode.d.ts +1 -1
  322. package/esm/safeFindDOMNode.js +0 -1
  323. package/esm/transitionEndListener.js +0 -2
  324. package/esm/types.d.ts +10 -10
  325. package/esm/useOverlayOffset.js +3 -3
  326. package/esm/usePlaceholder.d.ts +2 -2
  327. package/esm/usePlaceholder.js +2 -1
  328. package/esm/usePopperMarginModifiers.d.ts +4 -0
  329. package/esm/useWrappedRefWithWarning.js +4 -3
  330. package/package.json +2 -2
package/esm/FormText.js CHANGED
@@ -2,7 +2,8 @@ import classNames from 'classnames';
2
2
  import * as React from 'react';
3
3
  import { useBootstrapPrefix } from './ThemeProvider';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
- const FormText = /*#__PURE__*/React.forwardRef( // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
5
+ const FormText = /*#__PURE__*/React.forwardRef(
6
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
6
7
  ({
7
8
  bsPrefix,
8
9
  className,
@@ -11,7 +12,8 @@ const FormText = /*#__PURE__*/React.forwardRef( // Need to define the default "a
11
12
  ...props
12
13
  }, ref) => {
13
14
  bsPrefix = useBootstrapPrefix(bsPrefix, 'form-text');
14
- return /*#__PURE__*/_jsx(Component, { ...props,
15
+ return /*#__PURE__*/_jsx(Component, {
16
+ ...props,
15
17
  ref: ref,
16
18
  className: classNames(className, bsPrefix, muted && 'text-muted')
17
19
  });
package/esm/Image.js CHANGED
@@ -8,22 +8,18 @@ export const propTypes = {
8
8
  * @default 'img'
9
9
  */
10
10
  bsPrefix: PropTypes.string,
11
-
12
11
  /**
13
12
  * Sets image as fluid image.
14
13
  */
15
14
  fluid: PropTypes.bool,
16
-
17
15
  /**
18
16
  * Sets image shape as rounded.
19
17
  */
20
18
  rounded: PropTypes.bool,
21
-
22
19
  /**
23
20
  * Sets image shape as circle.
24
21
  */
25
22
  roundedCircle: PropTypes.bool,
26
-
27
23
  /**
28
24
  * Sets image shape as thumbnail.
29
25
  */
package/esm/InputGroup.js CHANGED
@@ -9,21 +9,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
9
9
  const InputGroupText = createWithBsPrefix('input-group-text', {
10
10
  Component: 'span'
11
11
  });
12
-
13
12
  const InputGroupCheckbox = props => /*#__PURE__*/_jsx(InputGroupText, {
14
13
  children: /*#__PURE__*/_jsx(FormCheckInput, {
15
14
  type: "checkbox",
16
15
  ...props
17
16
  })
18
17
  });
19
-
20
18
  const InputGroupRadio = props => /*#__PURE__*/_jsx(InputGroupText, {
21
19
  children: /*#__PURE__*/_jsx(FormCheckInput, {
22
20
  type: "radio",
23
21
  ...props
24
22
  })
25
23
  });
26
-
27
24
  /**
28
25
  *
29
26
  * @property {InputGroupText} Text
@@ -39,9 +36,10 @@ const InputGroup = /*#__PURE__*/React.forwardRef(({
39
36
  as: Component = 'div',
40
37
  ...props
41
38
  }, ref) => {
42
- bsPrefix = useBootstrapPrefix(bsPrefix, 'input-group'); // Intentionally an empty object. Used in detecting if a dropdown
43
- // exists under an input group.
39
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'input-group');
44
40
 
41
+ // Intentionally an empty object. Used in detecting if a dropdown
42
+ // exists under an input group.
45
43
  const contextValue = useMemo(() => ({}), []);
46
44
  return /*#__PURE__*/_jsx(InputGroupContext.Provider, {
47
45
  value: contextValue,
@@ -0,0 +1,7 @@
1
+ import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
2
+ export interface JumbotronProps extends BsPrefixProps {
3
+ fluid?: boolean;
4
+ }
5
+ declare type Jumbotron = BsPrefixRefForwardingComponent<'div', JumbotronProps>;
6
+ declare const Jumbotron: Jumbotron;
7
+ export default Jumbotron;
package/esm/ListGroup.js CHANGED
@@ -21,11 +21,9 @@ const ListGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
21
21
  });
22
22
  const bsPrefix = useBootstrapPrefix(initialBsPrefix, 'list-group');
23
23
  let horizontalVariant;
24
-
25
24
  if (horizontal) {
26
25
  horizontalVariant = horizontal === true ? 'horizontal' : `horizontal-${horizontal}`;
27
26
  }
28
-
29
27
  process.env.NODE_ENV !== "production" ? warning(!(horizontal && variant === 'flush'), '`variant="flush"` and `horizontal` should not be used together.') : void 0;
30
28
  return /*#__PURE__*/_jsx(BaseNav, {
31
29
  ref: ref,
@@ -1,5 +1,6 @@
1
1
  import classNames from 'classnames';
2
2
  import * as React from 'react';
3
+ import warning from 'warning';
3
4
  import useEventCallback from '@restart/hooks/useEventCallback';
4
5
  import { useNavItem } from '@restart/ui/NavItem';
5
6
  import { makeEventKey } from '@restart/ui/SelectableContext';
@@ -28,17 +29,16 @@ const ListGroupItem = /*#__PURE__*/React.forwardRef(({
28
29
  event.stopPropagation();
29
30
  return;
30
31
  }
31
-
32
32
  navItemProps.onClick(event);
33
33
  });
34
-
35
34
  if (disabled && props.tabIndex === undefined) {
36
35
  props.tabIndex = -1;
37
36
  props['aria-disabled'] = true;
38
- } // eslint-disable-next-line no-nested-ternary
39
-
37
+ }
40
38
 
39
+ // eslint-disable-next-line no-nested-ternary
41
40
  const Component = as || (action ? props.href ? 'a' : 'button' : 'div');
41
+ process.env.NODE_ENV !== "production" ? warning(as || !(!action && props.href), '`action=false` and `href` should not be used together.') : void 0;
42
42
  return /*#__PURE__*/_jsx(Component, {
43
43
  ref: ref,
44
44
  ...props,
package/esm/Media.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
2
+ declare const MediaBody: BsPrefixRefForwardingComponent<"div", unknown>;
3
+ declare type MediaProps = BsPrefixProps;
4
+ declare type Media = BsPrefixRefForwardingComponent<'div', MediaProps> & {
5
+ Body: typeof MediaBody;
6
+ };
7
+ declare const Media: Media;
8
+ export default Media;
package/esm/Modal.js CHANGED
@@ -32,22 +32,22 @@ const defaultProps = {
32
32
  animation: true,
33
33
  dialogAs: ModalDialog
34
34
  };
35
- /* eslint-disable no-use-before-define, react/no-multi-comp */
36
35
 
36
+ /* eslint-disable no-use-before-define, react/no-multi-comp */
37
37
  function DialogTransition(props) {
38
- return /*#__PURE__*/_jsx(Fade, { ...props,
38
+ return /*#__PURE__*/_jsx(Fade, {
39
+ ...props,
39
40
  timeout: null
40
41
  });
41
42
  }
42
-
43
43
  function BackdropTransition(props) {
44
- return /*#__PURE__*/_jsx(Fade, { ...props,
44
+ return /*#__PURE__*/_jsx(Fade, {
45
+ ...props,
45
46
  timeout: null
46
47
  });
47
48
  }
48
- /* eslint-enable no-use-before-define */
49
-
50
49
 
50
+ /* eslint-enable no-use-before-define */
51
51
  const Modal = /*#__PURE__*/React.forwardRef(({
52
52
  bsPrefix,
53
53
  className,
@@ -59,8 +59,8 @@ const Modal = /*#__PURE__*/React.forwardRef(({
59
59
  'aria-labelledby': ariaLabelledby,
60
60
  'aria-describedby': ariaDescribedby,
61
61
  'aria-label': ariaLabel,
62
-
63
62
  /* BaseModal props */
63
+
64
64
  show,
65
65
  animation,
66
66
  backdrop,
@@ -96,14 +96,12 @@ const Modal = /*#__PURE__*/React.forwardRef(({
96
96
  const modalContext = useMemo(() => ({
97
97
  onHide: handleHide
98
98
  }), [handleHide]);
99
-
100
99
  function getModalManager() {
101
100
  if (propsManager) return propsManager;
102
101
  return getSharedManager({
103
102
  isRTL
104
103
  });
105
104
  }
106
-
107
105
  function updateDialogStyle(node) {
108
106
  if (!canUseDOM) return;
109
107
  const containerIsOverflowing = getModalManager().getScrollbarWidth() > 0;
@@ -113,7 +111,6 @@ const Modal = /*#__PURE__*/React.forwardRef(({
113
111
  paddingLeft: !containerIsOverflowing && modalIsOverflowing ? getScrollbarSize() : undefined
114
112
  });
115
113
  }
116
-
117
114
  const handleWindowResize = useEventCallback(() => {
118
115
  if (modal) {
119
116
  updateDialogStyle(modal.dialog);
@@ -122,117 +119,108 @@ const Modal = /*#__PURE__*/React.forwardRef(({
122
119
  useWillUnmount(() => {
123
120
  removeEventListener(window, 'resize', handleWindowResize);
124
121
  removeStaticModalAnimationRef.current == null ? void 0 : removeStaticModalAnimationRef.current();
125
- }); // We prevent the modal from closing during a drag by detecting where the
122
+ });
123
+
124
+ // We prevent the modal from closing during a drag by detecting where the
126
125
  // the click originates from. If it starts in the modal and then ends outside
127
126
  // don't close.
128
-
129
127
  const handleDialogMouseDown = () => {
130
128
  waitingForMouseUpRef.current = true;
131
129
  };
132
-
133
130
  const handleMouseUp = e => {
134
131
  if (waitingForMouseUpRef.current && modal && e.target === modal.dialog) {
135
132
  ignoreBackdropClickRef.current = true;
136
133
  }
137
-
138
134
  waitingForMouseUpRef.current = false;
139
135
  };
140
-
141
136
  const handleStaticModalAnimation = () => {
142
137
  setAnimateStaticModal(true);
143
138
  removeStaticModalAnimationRef.current = transitionEnd(modal.dialog, () => {
144
139
  setAnimateStaticModal(false);
145
140
  });
146
141
  };
147
-
148
142
  const handleStaticBackdropClick = e => {
149
143
  if (e.target !== e.currentTarget) {
150
144
  return;
151
145
  }
152
-
153
146
  handleStaticModalAnimation();
154
147
  };
155
-
156
148
  const handleClick = e => {
157
149
  if (backdrop === 'static') {
158
150
  handleStaticBackdropClick(e);
159
151
  return;
160
152
  }
161
-
162
153
  if (ignoreBackdropClickRef.current || e.target !== e.currentTarget) {
163
154
  ignoreBackdropClickRef.current = false;
164
155
  return;
165
156
  }
166
-
167
157
  onHide == null ? void 0 : onHide();
168
158
  };
169
-
170
159
  const handleEscapeKeyDown = e => {
171
- if (!keyboard && backdrop === 'static') {
172
- // Call preventDefault to stop modal from closing in restart ui,
173
- // then play our animation.
160
+ if (keyboard) {
161
+ onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(e);
162
+ } else {
163
+ // Call preventDefault to stop modal from closing in @restart/ui.
174
164
  e.preventDefault();
175
- handleStaticModalAnimation();
176
- } else if (keyboard && onEscapeKeyDown) {
177
- onEscapeKeyDown(e);
165
+ if (backdrop === 'static') {
166
+ // Play static modal animation.
167
+ handleStaticModalAnimation();
168
+ }
178
169
  }
179
170
  };
180
-
181
171
  const handleEnter = (node, isAppearing) => {
182
172
  if (node) {
183
173
  updateDialogStyle(node);
184
174
  }
185
-
186
175
  onEnter == null ? void 0 : onEnter(node, isAppearing);
187
176
  };
188
-
189
177
  const handleExit = node => {
190
178
  removeStaticModalAnimationRef.current == null ? void 0 : removeStaticModalAnimationRef.current();
191
179
  onExit == null ? void 0 : onExit(node);
192
180
  };
193
-
194
181
  const handleEntering = (node, isAppearing) => {
195
- onEntering == null ? void 0 : onEntering(node, isAppearing); // FIXME: This should work even when animation is disabled.
182
+ onEntering == null ? void 0 : onEntering(node, isAppearing);
196
183
 
184
+ // FIXME: This should work even when animation is disabled.
197
185
  addEventListener(window, 'resize', handleWindowResize);
198
186
  };
199
-
200
187
  const handleExited = node => {
201
188
  if (node) node.style.display = ''; // RHL removes it sometimes
189
+ onExited == null ? void 0 : onExited(node);
202
190
 
203
- onExited == null ? void 0 : onExited(node); // FIXME: This should work even when animation is disabled.
204
-
191
+ // FIXME: This should work even when animation is disabled.
205
192
  removeEventListener(window, 'resize', handleWindowResize);
206
193
  };
207
-
208
- const renderBackdrop = useCallback(backdropProps => /*#__PURE__*/_jsx("div", { ...backdropProps,
194
+ const renderBackdrop = useCallback(backdropProps => /*#__PURE__*/_jsx("div", {
195
+ ...backdropProps,
209
196
  className: classNames(`${bsPrefix}-backdrop`, backdropClassName, !animation && 'show')
210
197
  }), [animation, backdropClassName, bsPrefix]);
211
- const baseModalStyle = { ...style,
198
+ const baseModalStyle = {
199
+ ...style,
212
200
  ...modalStyle
213
- }; // If `display` is not set to block, autoFocus inside the modal fails
214
- // https://github.com/react-bootstrap/react-bootstrap/issues/5102
201
+ };
215
202
 
203
+ // If `display` is not set to block, autoFocus inside the modal fails
204
+ // https://github.com/react-bootstrap/react-bootstrap/issues/5102
216
205
  baseModalStyle.display = 'block';
217
-
218
206
  const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", {
219
207
  role: "dialog",
220
208
  ...dialogProps,
221
209
  style: baseModalStyle,
222
- className: classNames(className, bsPrefix, animateStaticModal && `${bsPrefix}-static`),
210
+ className: classNames(className, bsPrefix, animateStaticModal && `${bsPrefix}-static`, !animation && 'show'),
223
211
  onClick: backdrop ? handleClick : undefined,
224
212
  onMouseUp: handleMouseUp,
225
213
  "aria-label": ariaLabel,
226
214
  "aria-labelledby": ariaLabelledby,
227
215
  "aria-describedby": ariaDescribedby,
228
- children: /*#__PURE__*/_jsx(Dialog, { ...props,
216
+ children: /*#__PURE__*/_jsx(Dialog, {
217
+ ...props,
229
218
  onMouseDown: handleDialogMouseDown,
230
219
  className: dialogClassName,
231
220
  contentClassName: contentClassName,
232
221
  children: children
233
222
  })
234
223
  });
235
-
236
224
  return /*#__PURE__*/_jsx(ModalContext.Provider, {
237
225
  value: modalContext,
238
226
  children: /*#__PURE__*/_jsx(BaseModal, {
@@ -2,6 +2,5 @@ import * as React from 'react';
2
2
  const ModalContext = /*#__PURE__*/React.createContext({
3
3
  // eslint-disable-next-line @typescript-eslint/no-empty-function
4
4
  onHide() {}
5
-
6
5
  });
7
6
  export default ModalContext;
@@ -16,7 +16,8 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(({
16
16
  bsPrefix = useBootstrapPrefix(bsPrefix, 'modal');
17
17
  const dialogClass = `${bsPrefix}-dialog`;
18
18
  const fullScreenClass = typeof fullscreen === 'string' ? `${bsPrefix}-fullscreen-${fullscreen}` : `${bsPrefix}-fullscreen`;
19
- return /*#__PURE__*/_jsx("div", { ...props,
19
+ return /*#__PURE__*/_jsx("div", {
20
+ ...props,
20
21
  ref: ref,
21
22
  className: classNames(dialogClass, className, size && `${bsPrefix}-${size}`, centered && `${dialogClass}-centered`, scrollable && `${dialogClass}-scrollable`, fullscreen && fullScreenClass),
22
23
  children: /*#__PURE__*/_jsx("div", {
package/esm/Nav.js CHANGED
@@ -35,7 +35,6 @@ const Nav = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
35
35
  let isNavbar = false;
36
36
  const navbarContext = useContext(NavbarContext);
37
37
  const cardHeaderContext = useContext(CardHeaderContext);
38
-
39
38
  if (navbarContext) {
40
39
  navbarBsPrefix = navbarContext.bsPrefix;
41
40
  isNavbar = navbar == null ? true : navbar;
@@ -44,7 +43,6 @@ const Nav = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
44
43
  cardHeaderBsPrefix
45
44
  } = cardHeaderContext);
46
45
  }
47
-
48
46
  return /*#__PURE__*/_jsx(BaseNav, {
49
47
  as: as,
50
48
  ref: ref,
package/esm/NavLink.js CHANGED
@@ -22,7 +22,8 @@ const NavLink = /*#__PURE__*/React.forwardRef(({
22
22
  active,
23
23
  ...props
24
24
  });
25
- return /*#__PURE__*/_jsx(Component, { ...props,
25
+ return /*#__PURE__*/_jsx(Component, {
26
+ ...props,
26
27
  ...navItemProps,
27
28
  ref: ref,
28
29
  className: classNames(className, bsPrefix, props.disabled && 'disabled', meta.isActive && 'active')
package/esm/Navbar.js CHANGED
@@ -41,18 +41,17 @@ const Navbar = /*#__PURE__*/React.forwardRef((props, ref) => {
41
41
  const bsPrefix = useBootstrapPrefix(initialBsPrefix, 'navbar');
42
42
  const handleCollapse = useCallback((...args) => {
43
43
  onSelect == null ? void 0 : onSelect(...args);
44
-
45
44
  if (collapseOnSelect && expanded) {
46
45
  onToggle == null ? void 0 : onToggle(false);
47
46
  }
48
- }, [onSelect, collapseOnSelect, expanded, onToggle]); // will result in some false positives but that seems better
47
+ }, [onSelect, collapseOnSelect, expanded, onToggle]);
48
+
49
+ // will result in some false positives but that seems better
49
50
  // than false negatives. strict `undefined` check allows explicit
50
51
  // "nulling" of the role if the user really doesn't want one
51
-
52
52
  if (controlledProps.role === undefined && Component !== 'nav') {
53
53
  controlledProps.role = 'navigation';
54
54
  }
55
-
56
55
  let expandClass = `${bsPrefix}-expand`;
57
56
  if (typeof expand === 'string') expandClass = `${expandClass}-${expand}`;
58
57
  const navbarContext = useMemo(() => ({
@@ -10,7 +10,8 @@ const NavbarBrand = /*#__PURE__*/React.forwardRef(({
10
10
  }, ref) => {
11
11
  bsPrefix = useBootstrapPrefix(bsPrefix, 'navbar-brand');
12
12
  const Component = as || (props.href ? 'a' : 'span');
13
- return /*#__PURE__*/_jsx(Component, { ...props,
13
+ return /*#__PURE__*/_jsx(Component, {
14
+ ...props,
14
15
  ref: ref,
15
16
  className: classNames(className, bsPrefix)
16
17
  });
@@ -1,4 +1,6 @@
1
- import * as React from 'react'; // TODO: check
1
+ import * as React from 'react';
2
+
3
+ // TODO: check
2
4
 
3
5
  const context = /*#__PURE__*/React.createContext(null);
4
6
  context.displayName = 'NavbarContext';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { OffcanvasProps } from './Offcanvas';
3
- export declare type NavbarOffcanvasProps = Omit<OffcanvasProps, 'show'>;
3
+ export type NavbarOffcanvasProps = Omit<OffcanvasProps, 'show'>;
4
4
  declare const NavbarOffcanvas: React.ForwardRefExoticComponent<Pick<NavbarOffcanvasProps, keyof OffcanvasProps> & React.RefAttributes<HTMLDivElement>>;
5
5
  export default NavbarOffcanvas;
@@ -27,12 +27,11 @@ const NavbarToggle = /*#__PURE__*/React.forwardRef(({
27
27
  if (onClick) onClick(e);
28
28
  if (onToggle) onToggle();
29
29
  });
30
-
31
30
  if (Component === 'button') {
32
31
  props.type = 'button';
33
32
  }
34
-
35
- return /*#__PURE__*/_jsx(Component, { ...props,
33
+ return /*#__PURE__*/_jsx(Component, {
34
+ ...props,
36
35
  ref: ref,
37
36
  onClick: handleClick,
38
37
  "aria-label": label,
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ModalProps as BaseModalProps } from '@restart/ui/Modal';
3
3
  import { BsPrefixRefForwardingComponent } from './helpers';
4
- export declare type OffcanvasPlacement = 'start' | 'end' | 'top' | 'bottom';
4
+ export type OffcanvasPlacement = 'start' | 'end' | 'top' | 'bottom';
5
5
  export interface OffcanvasProps extends Omit<BaseModalProps, 'role' | 'renderBackdrop' | 'renderDialog' | 'transition' | 'backdrop' | 'backdropTransition'> {
6
6
  bsPrefix?: string;
7
7
  backdropClassName?: string;
package/esm/Offcanvas.js CHANGED
@@ -27,17 +27,16 @@ const defaultProps = {
27
27
  placement: 'start',
28
28
  renderStaticNode: false
29
29
  };
30
-
31
30
  function DialogTransition(props) {
32
- return /*#__PURE__*/_jsx(OffcanvasToggling, { ...props
31
+ return /*#__PURE__*/_jsx(OffcanvasToggling, {
32
+ ...props
33
33
  });
34
34
  }
35
-
36
35
  function BackdropTransition(props) {
37
- return /*#__PURE__*/_jsx(Fade, { ...props
36
+ return /*#__PURE__*/_jsx(Fade, {
37
+ ...props
38
38
  });
39
39
  }
40
-
41
40
  const Offcanvas = /*#__PURE__*/React.forwardRef(({
42
41
  bsPrefix,
43
42
  className,
@@ -45,8 +44,8 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
45
44
  'aria-labelledby': ariaLabelledby,
46
45
  placement,
47
46
  responsive,
48
-
49
47
  /* BaseModal props */
48
+
50
49
  show,
51
50
  backdrop,
52
51
  keyboard,
@@ -89,10 +88,8 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
89
88
  const modalContext = useMemo(() => ({
90
89
  onHide: handleHide
91
90
  }), [handleHide]);
92
-
93
91
  function getModalManager() {
94
92
  if (propsManager) return propsManager;
95
-
96
93
  if (scroll) {
97
94
  // Have to use a different modal manager since the shared
98
95
  // one handles overflow.
@@ -101,31 +98,27 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
101
98
  });
102
99
  return modalManager.current;
103
100
  }
104
-
105
101
  return getSharedManager();
106
102
  }
107
-
108
103
  const handleEnter = (node, ...args) => {
109
104
  if (node) node.style.visibility = 'visible';
110
105
  onEnter == null ? void 0 : onEnter(node, ...args);
111
106
  };
112
-
113
107
  const handleExited = (node, ...args) => {
114
108
  if (node) node.style.visibility = '';
115
109
  onExited == null ? void 0 : onExited(...args);
116
110
  };
117
-
118
- const renderBackdrop = useCallback(backdropProps => /*#__PURE__*/_jsx("div", { ...backdropProps,
111
+ const renderBackdrop = useCallback(backdropProps => /*#__PURE__*/_jsx("div", {
112
+ ...backdropProps,
119
113
  className: classNames(`${bsPrefix}-backdrop`, backdropClassName)
120
114
  }), [backdropClassName, bsPrefix]);
121
-
122
- const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", { ...dialogProps,
115
+ const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", {
116
+ ...dialogProps,
123
117
  ...props,
124
118
  className: classNames(className, responsive ? `${bsPrefix}-${responsive}` : bsPrefix, `${bsPrefix}-${placement}`),
125
119
  "aria-labelledby": ariaLabelledby,
126
120
  children: children
127
121
  });
128
-
129
122
  return /*#__PURE__*/_jsxs(_Fragment, {
130
123
  children: [!showOffcanvas && (responsive || renderStaticNode) && renderDialog({}), /*#__PURE__*/_jsx(ModalContext.Provider, {
131
124
  value: modalContext,
@@ -27,7 +27,8 @@ const OffcanvasToggling = /*#__PURE__*/React.forwardRef(({
27
27
  addEndListener: transitionEndListener,
28
28
  ...props,
29
29
  childRef: children.ref,
30
- children: (status, innerProps) => /*#__PURE__*/React.cloneElement(children, { ...innerProps,
30
+ children: (status, innerProps) => /*#__PURE__*/React.cloneElement(children, {
31
+ ...innerProps,
31
32
  className: classNames(className, children.props.className, (status === ENTERING || status === EXITING) && `${bsPrefix}-toggling`, transitionStyles[status])
32
33
  })
33
34
  });
package/esm/Overlay.d.ts CHANGED
@@ -12,7 +12,7 @@ export interface OverlayInjectedProps {
12
12
  popper: PopperRef;
13
13
  [prop: string]: any;
14
14
  }
15
- export declare type OverlayChildren = React.ReactElement<OverlayInjectedProps> | ((injected: OverlayInjectedProps) => React.ReactNode);
15
+ export type OverlayChildren = React.ReactElement<OverlayInjectedProps> | ((injected: OverlayInjectedProps) => React.ReactNode);
16
16
  export interface OverlayProps extends Omit<BaseOverlayProps, 'children' | 'transition' | 'rootCloseEvent'> {
17
17
  children: OverlayChildren;
18
18
  transition?: TransitionType;
package/esm/Overlay.js CHANGED
@@ -16,7 +16,6 @@ const defaultProps = {
16
16
  show: false,
17
17
  placement: 'top'
18
18
  };
19
-
20
19
  function wrapRefs(props, arrowProps) {
21
20
  const {
22
21
  ref
@@ -24,12 +23,9 @@ function wrapRefs(props, arrowProps) {
24
23
  const {
25
24
  ref: aRef
26
25
  } = arrowProps;
27
-
28
26
  props.ref = ref.__wrapped || (ref.__wrapped = r => ref(safeFindDOMNode(r)));
29
-
30
27
  arrowProps.ref = aRef.__wrapped || (aRef.__wrapped = r => aRef(safeFindDOMNode(r)));
31
28
  }
32
-
33
29
  const Overlay = /*#__PURE__*/React.forwardRef(({
34
30
  children: overlay,
35
31
  transition,
@@ -50,9 +46,11 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
50
46
  popperRef.current.scheduleUpdate == null ? void 0 : popperRef.current.scheduleUpdate();
51
47
  }
52
48
  }, [firstRenderedState]);
53
- return /*#__PURE__*/_jsx(BaseOverlay, { ...outerProps,
49
+ return /*#__PURE__*/_jsx(BaseOverlay, {
50
+ ...outerProps,
54
51
  ref: mergedRef,
55
- popperConfig: { ...popperConfig,
52
+ popperConfig: {
53
+ ...popperConfig,
56
54
  modifiers: modifiers.concat(popperConfig.modifiers || []),
57
55
  onFirstUpdate: handleFirstUpdate
58
56
  },
@@ -63,9 +61,8 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
63
61
  show
64
62
  }) => {
65
63
  var _popperObj$state, _popperObj$state$modi;
66
-
67
- wrapRefs(overlayProps, arrowProps); // Need to get placement from popper object, handling case when overlay is flipped using 'flip' prop
68
-
64
+ wrapRefs(overlayProps, arrowProps);
65
+ // Need to get placement from popper object, handling case when overlay is flipped using 'flip' prop
69
66
  const updatedPlacement = popperObj == null ? void 0 : popperObj.placement;
70
67
  const popper = Object.assign(popperRef.current, {
71
68
  state: popperObj == null ? void 0 : popperObj.state,
@@ -73,7 +70,8 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
73
70
  placement: updatedPlacement,
74
71
  outOfBoundaries: (popperObj == null ? void 0 : (_popperObj$state = popperObj.state) == null ? void 0 : (_popperObj$state$modi = _popperObj$state.modifiersData.hide) == null ? void 0 : _popperObj$state$modi.isReferenceHidden) || false
75
72
  });
76
- if (typeof overlay === 'function') return overlay({ ...overlayProps,
73
+ if (typeof overlay === 'function') return overlay({
74
+ ...overlayProps,
77
75
  placement: updatedPlacement,
78
76
  show,
79
77
  ...(!transition && show && {
@@ -82,12 +80,14 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
82
80
  popper,
83
81
  arrowProps
84
82
  });
85
- return /*#__PURE__*/React.cloneElement(overlay, { ...overlayProps,
83
+ return /*#__PURE__*/React.cloneElement(overlay, {
84
+ ...overlayProps,
86
85
  placement: updatedPlacement,
87
86
  arrowProps,
88
87
  popper,
89
88
  className: classNames(overlay.props.className, !transition && show && 'show'),
90
- style: { ...overlay.props.style,
89
+ style: {
90
+ ...overlay.props.style,
91
91
  ...overlayProps.style
92
92
  }
93
93
  });