react-bootstrap 2.6.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 (283) hide show
  1. package/cjs/AbstractModalHeader.js +0 -9
  2. package/cjs/Accordion.js +0 -17
  3. package/cjs/AccordionBody.d.ts +2 -1
  4. package/cjs/AccordionBody.js +12 -10
  5. package/cjs/AccordionButton.d.ts +1 -1
  6. package/cjs/AccordionButton.js +0 -15
  7. package/cjs/AccordionCollapse.js +0 -10
  8. package/cjs/AccordionContext.d.ts +1 -1
  9. package/cjs/AccordionContext.js +0 -5
  10. package/cjs/AccordionHeader.js +0 -9
  11. package/cjs/AccordionItem.js +0 -9
  12. package/cjs/AccordionItemContext.js +0 -4
  13. package/cjs/Alert.js +0 -17
  14. package/cjs/Anchor.js +0 -3
  15. package/cjs/Badge.js +0 -8
  16. package/cjs/BootstrapModalManager.js +2 -18
  17. package/cjs/Breadcrumb.js +2 -12
  18. package/cjs/BreadcrumbItem.js +2 -10
  19. package/cjs/Button.d.ts +1 -1
  20. package/cjs/Button.js +2 -10
  21. package/cjs/ButtonGroup.js +2 -9
  22. package/cjs/ButtonToolbar.js +2 -9
  23. package/cjs/Card.js +0 -14
  24. package/cjs/CardGroup.js +0 -4
  25. package/cjs/CardHeader.js +0 -9
  26. package/cjs/CardHeaderContext.js +0 -4
  27. package/cjs/CardImg.js +2 -9
  28. package/cjs/Carousel.d.ts +1 -1
  29. package/cjs/Carousel.js +9 -58
  30. package/cjs/CarouselCaption.js +0 -4
  31. package/cjs/CarouselItem.js +0 -8
  32. package/cjs/CloseButton.d.ts +1 -1
  33. package/cjs/CloseButton.js +0 -10
  34. package/cjs/Col.d.ts +5 -5
  35. package/cjs/Col.js +6 -14
  36. package/cjs/Collapse.d.ts +1 -1
  37. package/cjs/Collapse.js +10 -22
  38. package/cjs/Container.js +0 -8
  39. package/cjs/Dropdown.js +17 -27
  40. package/cjs/DropdownButton.js +1 -25
  41. package/cjs/DropdownContext.d.ts +2 -2
  42. package/cjs/DropdownContext.js +0 -4
  43. package/cjs/DropdownItem.js +2 -11
  44. package/cjs/DropdownMenu.d.ts +2 -2
  45. package/cjs/DropdownMenu.js +12 -34
  46. package/cjs/DropdownToggle.d.ts +2 -2
  47. package/cjs/DropdownToggle.js +7 -24
  48. package/cjs/ElementChildren.js +2 -8
  49. package/cjs/Fade.js +2 -12
  50. package/cjs/Feedback.d.ts +1 -1
  51. package/cjs/Feedback.js +4 -11
  52. package/cjs/Figure.js +0 -7
  53. package/cjs/FigureCaption.js +0 -3
  54. package/cjs/FigureImage.js +0 -8
  55. package/cjs/FloatingLabel.js +0 -9
  56. package/cjs/Form.d.ts +1 -1
  57. package/cjs/Form.js +2 -22
  58. package/cjs/FormCheck.d.ts +1 -1
  59. package/cjs/FormCheck.js +2 -16
  60. package/cjs/FormCheckInput.d.ts +1 -1
  61. package/cjs/FormCheckInput.js +2 -10
  62. package/cjs/FormCheckLabel.js +2 -10
  63. package/cjs/FormContext.js +0 -4
  64. package/cjs/FormControl.d.ts +1 -1
  65. package/cjs/FormControl.js +2 -16
  66. package/cjs/FormFloating.js +0 -4
  67. package/cjs/FormGroup.js +2 -8
  68. package/cjs/FormLabel.d.ts +1 -1
  69. package/cjs/FormLabel.js +0 -11
  70. package/cjs/FormRange.js +2 -10
  71. package/cjs/FormSelect.js +2 -10
  72. package/cjs/FormText.js +4 -10
  73. package/cjs/Image.js +0 -13
  74. package/cjs/InputGroup.js +3 -18
  75. package/cjs/InputGroupContext.js +0 -4
  76. package/cjs/ListGroup.js +0 -16
  77. package/cjs/ListGroupItem.js +2 -16
  78. package/cjs/Modal.js +31 -72
  79. package/cjs/ModalBody.js +0 -4
  80. package/cjs/ModalContext.js +0 -5
  81. package/cjs/ModalDialog.js +2 -9
  82. package/cjs/ModalFooter.js +0 -4
  83. package/cjs/ModalHeader.js +0 -9
  84. package/cjs/ModalTitle.js +0 -6
  85. package/cjs/Nav.js +0 -19
  86. package/cjs/NavContext.js +0 -4
  87. package/cjs/NavDropdown.js +0 -12
  88. package/cjs/NavItem.js +0 -4
  89. package/cjs/NavLink.js +2 -12
  90. package/cjs/Navbar.js +3 -22
  91. package/cjs/NavbarBrand.js +2 -9
  92. package/cjs/NavbarCollapse.js +0 -9
  93. package/cjs/NavbarContext.js +0 -4
  94. package/cjs/NavbarOffcanvas.d.ts +1 -1
  95. package/cjs/NavbarOffcanvas.js +0 -8
  96. package/cjs/NavbarToggle.js +2 -13
  97. package/cjs/Offcanvas.d.ts +1 -1
  98. package/cjs/Offcanvas.js +9 -37
  99. package/cjs/OffcanvasBody.js +0 -4
  100. package/cjs/OffcanvasHeader.js +0 -9
  101. package/cjs/OffcanvasTitle.js +0 -6
  102. package/cjs/OffcanvasToggling.js +2 -12
  103. package/cjs/Overlay.d.ts +1 -1
  104. package/cjs/Overlay.js +12 -27
  105. package/cjs/OverlayTrigger.d.ts +4 -4
  106. package/cjs/OverlayTrigger.js +7 -32
  107. package/cjs/PageItem.js +3 -11
  108. package/cjs/Pagination.js +0 -11
  109. package/cjs/Placeholder.js +2 -11
  110. package/cjs/PlaceholderButton.js +2 -9
  111. package/cjs/Popover.js +0 -13
  112. package/cjs/PopoverBody.js +0 -4
  113. package/cjs/PopoverHeader.js +0 -4
  114. package/cjs/ProgressBar.js +2 -20
  115. package/cjs/Ratio.d.ts +1 -1
  116. package/cjs/Ratio.js +3 -12
  117. package/cjs/Row.d.ts +2 -2
  118. package/cjs/Row.js +0 -10
  119. package/cjs/SSRProvider.js +0 -2
  120. package/cjs/Spinner.js +0 -8
  121. package/cjs/SplitButton.js +1 -27
  122. package/cjs/Stack.d.ts +1 -1
  123. package/cjs/Stack.js +2 -10
  124. package/cjs/Switch.d.ts +1 -1
  125. package/cjs/Switch.js +2 -10
  126. package/cjs/Tab.js +2 -20
  127. package/cjs/TabContainer.js +2 -10
  128. package/cjs/TabContent.js +0 -4
  129. package/cjs/TabPane.js +7 -17
  130. package/cjs/Table.js +2 -13
  131. package/cjs/Tabs.js +6 -24
  132. package/cjs/ThemeProvider.js +8 -17
  133. package/cjs/Toast.js +5 -18
  134. package/cjs/ToastBody.js +0 -4
  135. package/cjs/ToastContainer.d.ts +1 -1
  136. package/cjs/ToastContainer.js +0 -8
  137. package/cjs/ToastContext.js +0 -5
  138. package/cjs/ToastFade.js +2 -9
  139. package/cjs/ToastHeader.js +0 -11
  140. package/cjs/ToggleButton.d.ts +1 -1
  141. package/cjs/ToggleButton.js +2 -11
  142. package/cjs/ToggleButtonGroup.d.ts +2 -2
  143. package/cjs/ToggleButtonGroup.js +2 -23
  144. package/cjs/Tooltip.js +0 -9
  145. package/cjs/TransitionWrapper.d.ts +1 -1
  146. package/cjs/TransitionWrapper.js +3 -15
  147. package/cjs/createChainedFunction.js +2 -5
  148. package/cjs/createUtilityClasses.d.ts +1 -1
  149. package/cjs/createUtilityClasses.js +0 -6
  150. package/cjs/createWithBsPrefix.js +0 -11
  151. package/cjs/divWithClassName.js +2 -9
  152. package/cjs/getTabTransitionComponent.js +0 -6
  153. package/cjs/helpers.d.ts +4 -4
  154. package/cjs/helpers.js +2 -9
  155. package/cjs/index.js +0 -171
  156. package/cjs/safeFindDOMNode.js +0 -5
  157. package/cjs/transitionEndListener.js +0 -6
  158. package/cjs/triggerBrowserReflow.js +0 -2
  159. package/cjs/types.d.ts +9 -9
  160. package/cjs/types.js +0 -5
  161. package/cjs/useOverlayOffset.js +0 -8
  162. package/cjs/usePlaceholder.d.ts +2 -2
  163. package/cjs/usePlaceholder.js +2 -7
  164. package/cjs/useWrappedRefWithWarning.js +4 -9
  165. package/dist/react-bootstrap.js +676 -1945
  166. package/dist/react-bootstrap.min.js +1 -1
  167. package/esm/AccordionBody.d.ts +2 -1
  168. package/esm/AccordionBody.js +12 -0
  169. package/esm/AccordionButton.d.ts +1 -1
  170. package/esm/AccordionButton.js +0 -4
  171. package/esm/AccordionCollapse.js +0 -1
  172. package/esm/AccordionContext.d.ts +1 -1
  173. package/esm/Alert.js +0 -2
  174. package/esm/BootstrapModalManager.js +2 -9
  175. package/esm/Breadcrumb.js +2 -1
  176. package/esm/BreadcrumbItem.js +2 -1
  177. package/esm/Button.d.ts +1 -1
  178. package/esm/Button.js +2 -1
  179. package/esm/ButtonGroup.js +2 -1
  180. package/esm/ButtonToolbar.js +2 -1
  181. package/esm/CardImg.js +2 -1
  182. package/esm/Carousel.d.ts +1 -1
  183. package/esm/Carousel.js +9 -36
  184. package/esm/CloseButton.d.ts +1 -1
  185. package/esm/CloseButton.js +0 -2
  186. package/esm/Col.d.ts +5 -5
  187. package/esm/Col.js +6 -5
  188. package/esm/Collapse.d.ts +1 -1
  189. package/esm/Collapse.js +11 -8
  190. package/esm/Dropdown.js +17 -7
  191. package/esm/DropdownButton.js +1 -14
  192. package/esm/DropdownContext.d.ts +2 -2
  193. package/esm/DropdownItem.js +2 -1
  194. package/esm/DropdownMenu.d.ts +2 -2
  195. package/esm/DropdownMenu.js +12 -15
  196. package/esm/DropdownToggle.d.ts +2 -2
  197. package/esm/DropdownToggle.js +7 -10
  198. package/esm/ElementChildren.js +3 -6
  199. package/esm/Fade.js +2 -1
  200. package/esm/Feedback.d.ts +1 -1
  201. package/esm/Feedback.js +4 -3
  202. package/esm/Form.d.ts +1 -1
  203. package/esm/Form.js +2 -2
  204. package/esm/FormCheck.d.ts +1 -1
  205. package/esm/FormCheck.js +2 -3
  206. package/esm/FormCheckInput.d.ts +1 -1
  207. package/esm/FormCheckInput.js +2 -1
  208. package/esm/FormCheckLabel.js +2 -1
  209. package/esm/FormContext.js +3 -1
  210. package/esm/FormControl.d.ts +1 -1
  211. package/esm/FormControl.js +2 -3
  212. package/esm/FormGroup.js +2 -1
  213. package/esm/FormLabel.d.ts +1 -1
  214. package/esm/FormRange.js +2 -1
  215. package/esm/FormSelect.js +2 -1
  216. package/esm/FormText.js +4 -2
  217. package/esm/Image.js +0 -4
  218. package/esm/InputGroup.js +3 -5
  219. package/esm/ListGroup.js +0 -2
  220. package/esm/ListGroupItem.js +2 -4
  221. package/esm/Modal.js +31 -43
  222. package/esm/ModalContext.js +0 -1
  223. package/esm/ModalDialog.js +2 -1
  224. package/esm/Nav.js +0 -2
  225. package/esm/NavLink.js +2 -1
  226. package/esm/Navbar.js +3 -4
  227. package/esm/NavbarBrand.js +2 -1
  228. package/esm/NavbarContext.js +3 -1
  229. package/esm/NavbarOffcanvas.d.ts +1 -1
  230. package/esm/NavbarToggle.js +2 -3
  231. package/esm/Offcanvas.d.ts +1 -1
  232. package/esm/Offcanvas.js +9 -16
  233. package/esm/OffcanvasToggling.js +2 -1
  234. package/esm/Overlay.d.ts +1 -1
  235. package/esm/Overlay.js +12 -12
  236. package/esm/OverlayTrigger.d.ts +4 -4
  237. package/esm/OverlayTrigger.js +7 -20
  238. package/esm/PageItem.js +2 -3
  239. package/esm/Pagination.js +0 -1
  240. package/esm/Placeholder.js +2 -1
  241. package/esm/PlaceholderButton.js +2 -1
  242. package/esm/ProgressBar.js +2 -12
  243. package/esm/Ratio.d.ts +1 -1
  244. package/esm/Ratio.js +3 -4
  245. package/esm/Row.d.ts +2 -2
  246. package/esm/Row.js +0 -2
  247. package/esm/SplitButton.js +1 -16
  248. package/esm/Stack.d.ts +1 -1
  249. package/esm/Stack.js +2 -1
  250. package/esm/Switch.d.ts +1 -1
  251. package/esm/Switch.js +2 -1
  252. package/esm/Tab.js +2 -9
  253. package/esm/TabContainer.js +2 -3
  254. package/esm/TabPane.js +7 -4
  255. package/esm/Table.js +2 -6
  256. package/esm/Tabs.js +6 -9
  257. package/esm/ThemeProvider.js +8 -9
  258. package/esm/Toast.js +5 -5
  259. package/esm/ToastContainer.d.ts +1 -1
  260. package/esm/ToastContext.js +0 -1
  261. package/esm/ToastFade.js +2 -1
  262. package/esm/ToggleButton.d.ts +1 -1
  263. package/esm/ToggleButton.js +2 -3
  264. package/esm/ToggleButtonGroup.d.ts +2 -2
  265. package/esm/ToggleButtonGroup.js +2 -9
  266. package/esm/TransitionWrapper.d.ts +1 -1
  267. package/esm/TransitionWrapper.js +3 -5
  268. package/esm/createChainedFunction.js +2 -4
  269. package/esm/createUtilityClasses.d.ts +1 -1
  270. package/esm/createUtilityClasses.js +0 -1
  271. package/esm/createWithBsPrefix.js +0 -2
  272. package/esm/divWithClassName.js +2 -1
  273. package/esm/getTabTransitionComponent.js +0 -1
  274. package/esm/helpers.d.ts +4 -4
  275. package/esm/helpers.js +3 -3
  276. package/esm/safeFindDOMNode.js +0 -1
  277. package/esm/transitionEndListener.js +0 -2
  278. package/esm/types.d.ts +9 -9
  279. package/esm/useOverlayOffset.js +3 -3
  280. package/esm/usePlaceholder.d.ts +2 -2
  281. package/esm/usePlaceholder.js +2 -1
  282. package/esm/useWrappedRefWithWarning.js +4 -3
  283. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { TransitionCallbacks } from '@restart/ui/types';
2
3
  import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
3
- export interface AccordionBodyProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
4
+ export interface AccordionBodyProps extends BsPrefixProps, TransitionCallbacks, React.HTMLAttributes<HTMLElement> {
4
5
  }
5
6
  declare const AccordionBody: BsPrefixRefForwardingComponent<'div', AccordionBodyProps>;
6
7
  export default AccordionBody;
@@ -10,6 +10,12 @@ const AccordionBody = /*#__PURE__*/React.forwardRef(({
10
10
  as: Component = 'div',
11
11
  bsPrefix,
12
12
  className,
13
+ onEnter,
14
+ onEntering,
15
+ onEntered,
16
+ onExit,
17
+ onExiting,
18
+ onExited,
13
19
  ...props
14
20
  }, ref) => {
15
21
  bsPrefix = useBootstrapPrefix(bsPrefix, 'accordion-body');
@@ -18,6 +24,12 @@ const AccordionBody = /*#__PURE__*/React.forwardRef(({
18
24
  } = useContext(AccordionItemContext);
19
25
  return /*#__PURE__*/_jsx(AccordionCollapse, {
20
26
  eventKey: eventKey,
27
+ onEnter: onEnter,
28
+ onEntering: onEntering,
29
+ onEntered: onEntered,
30
+ onExit: onExit,
31
+ onExiting: onExiting,
32
+ onExited: onExited,
21
33
  children: /*#__PURE__*/_jsx(Component, {
22
34
  ref: ref,
23
35
  ...props,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
3
- declare type EventHandler = React.EventHandler<React.SyntheticEvent>;
3
+ type EventHandler = React.EventHandler<React.SyntheticEvent>;
4
4
  export interface AccordionButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, BsPrefixProps {
5
5
  }
6
6
  export declare function useAccordionButton(eventKey: string, onClick?: EventHandler): EventHandler;
@@ -17,7 +17,6 @@ export function useAccordionButton(eventKey, onClick) {
17
17
  If they are the same, then collapse the component.
18
18
  */
19
19
  let eventKeyPassed = eventKey === activeEventKey ? null : eventKey;
20
-
21
20
  if (alwaysOpen) {
22
21
  if (Array.isArray(activeEventKey)) {
23
22
  if (activeEventKey.includes(eventKey)) {
@@ -30,7 +29,6 @@ export function useAccordionButton(eventKey, onClick) {
30
29
  eventKeyPassed = [eventKey];
31
30
  }
32
31
  }
33
-
34
32
  onSelect == null ? void 0 : onSelect(eventKeyPassed, e);
35
33
  onClick == null ? void 0 : onClick(e);
36
34
  };
@@ -51,11 +49,9 @@ const AccordionButton = /*#__PURE__*/React.forwardRef(({
51
49
  const {
52
50
  activeEventKey
53
51
  } = useContext(AccordionContext);
54
-
55
52
  if (Component === 'button') {
56
53
  props.type = 'button';
57
54
  }
58
-
59
55
  return /*#__PURE__*/_jsx(Component, {
60
56
  ref: ref,
61
57
  onClick: accordionOnClick,
@@ -5,7 +5,6 @@ import { useBootstrapPrefix } from './ThemeProvider';
5
5
  import Collapse from './Collapse';
6
6
  import AccordionContext, { isAccordionItemSelected } from './AccordionContext';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
-
9
8
  /**
10
9
  * This component accepts all of [`Collapse`'s props](/utilities/transitions/#collapse-props).
11
10
  */
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export declare type AccordionEventKey = string | string[] | null | undefined;
2
+ export type AccordionEventKey = string | string[] | null | undefined;
3
3
  export declare type AccordionSelectCallback = (eventKey: AccordionEventKey, e: React.SyntheticEvent<unknown>) => void;
4
4
  export interface AccordionContextValue {
5
5
  activeEventKey?: AccordionEventKey;
package/esm/Alert.js CHANGED
@@ -47,7 +47,6 @@ const Alert = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
47
47
  }
48
48
  });
49
49
  const Transition = transition === true ? Fade : transition;
50
-
51
50
  const alert = /*#__PURE__*/_jsxs("div", {
52
51
  role: "alert",
53
52
  ...(!Transition ? props : undefined),
@@ -59,7 +58,6 @@ const Alert = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
59
58
  variant: closeVariant
60
59
  }), children]
61
60
  });
62
-
63
61
  if (!Transition) return show ? alert : null;
64
62
  return /*#__PURE__*/_jsx(Transition, {
65
63
  unmountOnExit: true,
@@ -8,21 +8,18 @@ const Selector = {
8
8
  STICKY_CONTENT: '.sticky-top',
9
9
  NAVBAR_TOGGLER: '.navbar-toggler'
10
10
  };
11
-
12
11
  class BootstrapModalManager extends ModalManager {
13
12
  adjustAndStore(prop, element, adjust) {
14
- const actual = element.style[prop]; // TODO: DOMStringMap and CSSStyleDeclaration aren't strictly compatible
13
+ const actual = element.style[prop];
14
+ // TODO: DOMStringMap and CSSStyleDeclaration aren't strictly compatible
15
15
  // @ts-ignore
16
-
17
16
  element.dataset[prop] = actual;
18
17
  css(element, {
19
18
  [prop]: `${parseFloat(css(element, prop)) + adjust}px`
20
19
  });
21
20
  }
22
-
23
21
  restore(prop, element) {
24
22
  const value = element.dataset[prop];
25
-
26
23
  if (value !== undefined) {
27
24
  delete element.dataset[prop];
28
25
  css(element, {
@@ -30,7 +27,6 @@ class BootstrapModalManager extends ModalManager {
30
27
  });
31
28
  }
32
29
  }
33
-
34
30
  setContainerStyle(containerState) {
35
31
  super.setContainerStyle(containerState);
36
32
  const container = this.getElement();
@@ -42,7 +38,6 @@ class BootstrapModalManager extends ModalManager {
42
38
  qsa(container, Selector.STICKY_CONTENT).forEach(el => this.adjustAndStore(marginProp, el, -containerState.scrollBarWidth));
43
39
  qsa(container, Selector.NAVBAR_TOGGLER).forEach(el => this.adjustAndStore(marginProp, el, containerState.scrollBarWidth));
44
40
  }
45
-
46
41
  removeContainerStyle(containerState) {
47
42
  super.removeContainerStyle(containerState);
48
43
  const container = this.getElement();
@@ -53,9 +48,7 @@ class BootstrapModalManager extends ModalManager {
53
48
  qsa(container, Selector.STICKY_CONTENT).forEach(el => this.restore(marginProp, el));
54
49
  qsa(container, Selector.NAVBAR_TOGGLER).forEach(el => this.restore(marginProp, el));
55
50
  }
56
-
57
51
  }
58
-
59
52
  let sharedManager;
60
53
  export function getSharedManager(options) {
61
54
  if (!sharedManager) sharedManager = new BootstrapModalManager(options);
package/esm/Breadcrumb.js CHANGED
@@ -23,7 +23,8 @@ const Breadcrumb = /*#__PURE__*/React.forwardRef(({
23
23
  className: className,
24
24
  ref: ref,
25
25
  ...props,
26
- children: /*#__PURE__*/_jsx("ol", { ...listProps,
26
+ children: /*#__PURE__*/_jsx("ol", {
27
+ ...listProps,
27
28
  className: classNames(prefix, listProps == null ? void 0 : listProps.className),
28
29
  children: children
29
30
  })
@@ -29,7 +29,8 @@ const BreadcrumbItem = /*#__PURE__*/React.forwardRef(({
29
29
  active
30
30
  }),
31
31
  "aria-current": active ? 'page' : undefined,
32
- children: active ? children : /*#__PURE__*/_jsx(LinkComponent, { ...linkProps,
32
+ children: active ? children : /*#__PURE__*/_jsx(LinkComponent, {
33
+ ...linkProps,
33
34
  href: href,
34
35
  title: title,
35
36
  target: target,
package/esm/Button.d.ts CHANGED
@@ -6,6 +6,6 @@ export interface ButtonProps extends BaseButtonProps, Omit<BsPrefixProps, 'as'>
6
6
  variant?: ButtonVariant;
7
7
  size?: 'sm' | 'lg';
8
8
  }
9
- export declare type CommonButtonProps = 'href' | 'size' | 'variant' | 'disabled';
9
+ export type CommonButtonProps = 'href' | 'size' | 'variant' | 'disabled';
10
10
  declare const Button: BsPrefixRefForwardingComponent<'button', ButtonProps>;
11
11
  export default Button;
package/esm/Button.js CHANGED
@@ -25,7 +25,8 @@ const Button = /*#__PURE__*/React.forwardRef(({
25
25
  ...props
26
26
  });
27
27
  const Component = tagName;
28
- return /*#__PURE__*/_jsx(Component, { ...buttonProps,
28
+ return /*#__PURE__*/_jsx(Component, {
29
+ ...buttonProps,
29
30
  ...props,
30
31
  ref: ref,
31
32
  className: classNames(className, prefix, active && 'active', variant && `${prefix}-${variant}`, size && `${prefix}-${size}`, props.href && props.disabled && 'disabled')
@@ -18,7 +18,8 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(({
18
18
  const prefix = useBootstrapPrefix(bsPrefix, 'btn-group');
19
19
  let baseClass = prefix;
20
20
  if (vertical) baseClass = `${prefix}-vertical`;
21
- return /*#__PURE__*/_jsx(Component, { ...rest,
21
+ return /*#__PURE__*/_jsx(Component, {
22
+ ...rest,
22
23
  ref: ref,
23
24
  className: classNames(className, baseClass, size && `${prefix}-${size}`)
24
25
  });
@@ -11,7 +11,8 @@ const ButtonToolbar = /*#__PURE__*/React.forwardRef(({
11
11
  ...props
12
12
  }, ref) => {
13
13
  const prefix = useBootstrapPrefix(bsPrefix, 'btn-toolbar');
14
- return /*#__PURE__*/_jsx("div", { ...props,
14
+ return /*#__PURE__*/_jsx("div", {
15
+ ...props,
15
16
  ref: ref,
16
17
  className: classNames(className, prefix)
17
18
  });
package/esm/CardImg.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 CardImg = /*#__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 CardImg = /*#__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,
package/esm/Carousel.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
3
- export declare type CarouselVariant = 'dark' | string;
3
+ export type CarouselVariant = 'dark' | string;
4
4
  export interface CarouselRef {
5
5
  element?: HTMLElement;
6
6
  prev: (e?: React.SyntheticEvent) => void;
package/esm/Carousel.js CHANGED
@@ -41,16 +41,13 @@ const defaultProps = {
41
41
  }),
42
42
  nextLabel: 'Next'
43
43
  };
44
-
45
44
  function isVisible(element) {
46
45
  if (!element || !element.style || !element.parentNode || !element.parentNode.style) {
47
46
  return false;
48
47
  }
49
-
50
48
  const elementStyle = getComputedStyle(element);
51
49
  return elementStyle.display !== 'none' && elementStyle.visibility !== 'hidden' && getComputedStyle(element.parentNode).display !== 'none';
52
50
  }
53
-
54
51
  const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
55
52
  const {
56
53
  // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
@@ -101,11 +98,9 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
101
98
  } else {
102
99
  setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
103
100
  }
104
-
105
101
  if (slide) {
106
102
  setIsSliding(true);
107
103
  }
108
-
109
104
  setRenderedActiveIndex(activeIndex || 0);
110
105
  }
111
106
  }, [activeIndex, isSliding, renderedActiveIndex, slide]);
@@ -115,12 +110,12 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
115
110
  }
116
111
  });
117
112
  let numChildren = 0;
118
- let activeChildInterval; // Iterate to grab all of the children's interval values
119
- // (and count them, too)
113
+ let activeChildInterval;
120
114
 
115
+ // Iterate to grab all of the children's interval values
116
+ // (and count them, too)
121
117
  forEach(children, (child, index) => {
122
118
  ++numChildren;
123
-
124
119
  if (index === activeIndex) {
125
120
  activeChildInterval = child.props.interval;
126
121
  }
@@ -130,36 +125,29 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
130
125
  if (isSliding) {
131
126
  return;
132
127
  }
133
-
134
128
  let nextActiveIndex = renderedActiveIndex - 1;
135
-
136
129
  if (nextActiveIndex < 0) {
137
130
  if (!wrap) {
138
131
  return;
139
132
  }
140
-
141
133
  nextActiveIndex = numChildren - 1;
142
134
  }
143
-
144
135
  nextDirectionRef.current = 'prev';
145
136
  onSelect == null ? void 0 : onSelect(nextActiveIndex, event);
146
- }, [isSliding, renderedActiveIndex, onSelect, wrap, numChildren]); // This is used in the setInterval, so it should not invalidate.
137
+ }, [isSliding, renderedActiveIndex, onSelect, wrap, numChildren]);
147
138
 
139
+ // This is used in the setInterval, so it should not invalidate.
148
140
  const next = useEventCallback(event => {
149
141
  if (isSliding) {
150
142
  return;
151
143
  }
152
-
153
144
  let nextActiveIndex = renderedActiveIndex + 1;
154
-
155
145
  if (nextActiveIndex >= numChildren) {
156
146
  if (!wrap) {
157
147
  return;
158
148
  }
159
-
160
149
  nextActiveIndex = 0;
161
150
  }
162
-
163
151
  nextDirectionRef.current = 'next';
164
152
  onSelect == null ? void 0 : onSelect(nextActiveIndex, event);
165
153
  });
@@ -168,8 +156,9 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
168
156
  element: elementRef.current,
169
157
  prev,
170
158
  next
171
- })); // This is used in the setInterval, so it should not invalidate.
159
+ }));
172
160
 
161
+ // This is used in the setInterval, so it should not invalidate.
173
162
  const nextWhenVisible = useEventCallback(() => {
174
163
  if (!document.hidden && isVisible(elementRef.current)) {
175
164
  if (isRTL) {
@@ -185,7 +174,6 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
185
174
  // These callbacks will be handled by the <Transition> callbacks.
186
175
  return;
187
176
  }
188
-
189
177
  onSlide == null ? void 0 : onSlide(renderedActiveIndex, slideDirection);
190
178
  onSlid == null ? void 0 : onSlid(renderedActiveIndex, slideDirection);
191
179
  }, [renderedActiveIndex]);
@@ -204,37 +192,29 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
204
192
  switch (event.key) {
205
193
  case 'ArrowLeft':
206
194
  event.preventDefault();
207
-
208
195
  if (isRTL) {
209
196
  next(event);
210
197
  } else {
211
198
  prev(event);
212
199
  }
213
-
214
200
  return;
215
-
216
201
  case 'ArrowRight':
217
202
  event.preventDefault();
218
-
219
203
  if (isRTL) {
220
204
  prev(event);
221
205
  } else {
222
206
  next(event);
223
207
  }
224
-
225
208
  return;
226
-
227
209
  default:
228
210
  }
229
211
  }
230
-
231
212
  onKeyDown == null ? void 0 : onKeyDown(event);
232
213
  }, [keyboard, onKeyDown, prev, next, isRTL]);
233
214
  const handleMouseOver = useCallback(event => {
234
215
  if (pause === 'hover') {
235
216
  setPaused(true);
236
217
  }
237
-
238
218
  onMouseOver == null ? void 0 : onMouseOver(event);
239
219
  }, [pause, onMouseOver]);
240
220
  const handleMouseOut = useCallback(event => {
@@ -247,11 +227,9 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
247
227
  const handleTouchStart = useCallback(event => {
248
228
  touchStartXRef.current = event.touches[0].clientX;
249
229
  touchDeltaXRef.current = 0;
250
-
251
230
  if (pause === 'hover') {
252
231
  setPaused(true);
253
232
  }
254
-
255
233
  onTouchStart == null ? void 0 : onTouchStart(event);
256
234
  }, [pause, onTouchStart]);
257
235
  const handleTouchMove = useCallback(event => {
@@ -260,13 +238,11 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
260
238
  } else {
261
239
  touchDeltaXRef.current = event.touches[0].clientX - touchStartXRef.current;
262
240
  }
263
-
264
241
  onTouchMove == null ? void 0 : onTouchMove(event);
265
242
  }, [onTouchMove]);
266
243
  const handleTouchEnd = useCallback(event => {
267
244
  if (touch) {
268
245
  const touchDeltaX = touchDeltaXRef.current;
269
-
270
246
  if (Math.abs(touchDeltaX) > SWIPE_THRESHOLD) {
271
247
  if (touchDeltaX > 0) {
272
248
  prev(event);
@@ -275,24 +251,20 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
275
251
  }
276
252
  }
277
253
  }
278
-
279
254
  if (pause === 'hover') {
280
255
  touchUnpauseTimeout.set(() => {
281
256
  setPaused(false);
282
257
  }, interval || undefined);
283
258
  }
284
-
285
259
  onTouchEnd == null ? void 0 : onTouchEnd(event);
286
260
  }, [touch, pause, prev, next, touchUnpauseTimeout, interval, onTouchEnd]);
287
261
  const shouldPlay = interval != null && !paused && !isSliding;
288
262
  const intervalHandleRef = useRef();
289
263
  useEffect(() => {
290
264
  var _ref, _activeChildIntervalR;
291
-
292
265
  if (!shouldPlay) {
293
266
  return undefined;
294
267
  }
295
-
296
268
  const nextFunc = isRTL ? prev : next;
297
269
  intervalHandleRef.current = window.setInterval(document.visibilityState ? nextWhenVisible : nextFunc, (_ref = (_activeChildIntervalR = activeChildIntervalRef.current) != null ? _activeChildIntervalR : interval) != null ? _ref : undefined);
298
270
  return () => {
@@ -336,7 +308,8 @@ const Carousel = /*#__PURE__*/React.forwardRef((uncontrolledProps, ref) => {
336
308
  onEnter: isActive ? handleEnter : undefined,
337
309
  onEntered: isActive ? handleEntered : undefined,
338
310
  addEndListener: transitionEndListener,
339
- children: (status, innerProps) => /*#__PURE__*/React.cloneElement(child, { ...innerProps,
311
+ children: (status, innerProps) => /*#__PURE__*/React.cloneElement(child, {
312
+ ...innerProps,
340
313
  className: classNames(child.props.className, isActive && status !== 'entered' && orderClassName, (status === 'entered' || status === 'exiting') && 'active', (status === 'entering' || status === 'exiting') && directionalClassName)
341
314
  })
342
315
  }) : /*#__PURE__*/React.cloneElement(child, {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export declare type CloseButtonVariant = 'white' | string;
2
+ export type CloseButtonVariant = 'white' | string;
3
3
  export interface CloseButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
4
  variant?: CloseButtonVariant;
5
5
  }
@@ -5,10 +5,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const propTypes = {
6
6
  /** An accessible label indicating the relevant information about the Close Button. */
7
7
  'aria-label': PropTypes.string,
8
-
9
8
  /** A callback fired after the Close Button is clicked. */
10
9
  onClick: PropTypes.func,
11
-
12
10
  /**
13
11
  * Render different color variant for the button.
14
12
  *
package/esm/Col.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
3
- declare type NumberAttr = number | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';
4
- declare type ColOrderNumber = number | '1' | '2' | '3' | '4' | '5';
5
- declare type ColOrder = ColOrderNumber | 'first' | 'last';
6
- declare type ColSize = boolean | 'auto' | NumberAttr;
7
- declare type ColSpec = ColSize | {
3
+ type NumberAttr = number | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';
4
+ type ColOrderNumber = number | '1' | '2' | '3' | '4' | '5';
5
+ type ColOrder = ColOrderNumber | 'first' | 'last';
6
+ type ColSize = boolean | 'auto' | NumberAttr;
7
+ type ColSpec = ColSize | {
8
8
  span?: ColSize;
9
9
  offset?: NumberAttr;
10
10
  order?: ColOrder;
package/esm/Col.js CHANGED
@@ -19,7 +19,6 @@ export function useCol({
19
19
  let span;
20
20
  let offset;
21
21
  let order;
22
-
23
22
  if (typeof propValue === 'object' && propValue != null) {
24
23
  ({
25
24
  span,
@@ -29,13 +28,13 @@ export function useCol({
29
28
  } else {
30
29
  span = propValue;
31
30
  }
32
-
33
31
  const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
34
32
  if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
35
33
  if (order != null) classes.push(`order${infix}-${order}`);
36
34
  if (offset != null) classes.push(`offset${infix}-${offset}`);
37
35
  });
38
- return [{ ...props,
36
+ return [{
37
+ ...props,
39
38
  className: classNames(className, ...spans, ...classes)
40
39
  }, {
41
40
  as,
@@ -43,7 +42,8 @@ export function useCol({
43
42
  spans
44
43
  }];
45
44
  }
46
- const Col = /*#__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
45
+ const Col = /*#__PURE__*/React.forwardRef(
46
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
47
47
  (props, ref) => {
48
48
  const [{
49
49
  className,
@@ -53,7 +53,8 @@ const Col = /*#__PURE__*/React.forwardRef( // Need to define the default "as" du
53
53
  bsPrefix,
54
54
  spans
55
55
  }] = useCol(props);
56
- return /*#__PURE__*/_jsx(Component, { ...colProps,
56
+ return /*#__PURE__*/_jsx(Component, {
57
+ ...colProps,
57
58
  ref: ref,
58
59
  className: classNames(className, !spans.length && bsPrefix)
59
60
  });
package/esm/Collapse.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import Transition from 'react-transition-group/Transition';
3
3
  import { TransitionCallbacks } from '@restart/ui/types';
4
- declare type Dimension = 'height' | 'width';
4
+ type Dimension = 'height' | 'width';
5
5
  export interface CollapseProps extends TransitionCallbacks, Pick<React.HTMLAttributes<HTMLElement>, 'role'> {
6
6
  className?: string;
7
7
  in?: boolean;
package/esm/Collapse.js CHANGED
@@ -11,16 +11,16 @@ const MARGINS = {
11
11
  height: ['marginTop', 'marginBottom'],
12
12
  width: ['marginLeft', 'marginRight']
13
13
  };
14
-
15
14
  function getDefaultDimensionValue(dimension, elem) {
16
15
  const offset = `offset${dimension[0].toUpperCase()}${dimension.slice(1)}`;
17
16
  const value = elem[offset];
18
17
  const margins = MARGINS[dimension];
19
- return value + // @ts-ignore
20
- parseInt(css(elem, margins[0]), 10) + // @ts-ignore
18
+ return value +
19
+ // @ts-ignore
20
+ parseInt(css(elem, margins[0]), 10) +
21
+ // @ts-ignore
21
22
  parseInt(css(elem, margins[1]), 10);
22
23
  }
23
-
24
24
  const collapseStyles = {
25
25
  [EXITED]: 'collapse',
26
26
  [EXITING]: 'collapsing',
@@ -49,8 +49,8 @@ const Collapse = /*#__PURE__*/React.forwardRef(({
49
49
  }, ref) => {
50
50
  /* Compute dimension */
51
51
  const computedDimension = typeof dimension === 'function' ? dimension() : dimension;
52
- /* -- Expanding -- */
53
52
 
53
+ /* -- Expanding -- */
54
54
  const handleEnter = useMemo(() => createChainedFunction(elem => {
55
55
  elem.style[computedDimension] = '0';
56
56
  }, onEnter), [computedDimension, onEnter]);
@@ -61,8 +61,8 @@ const Collapse = /*#__PURE__*/React.forwardRef(({
61
61
  const handleEntered = useMemo(() => createChainedFunction(elem => {
62
62
  elem.style[computedDimension] = null;
63
63
  }, onEntered), [computedDimension, onEntered]);
64
- /* -- Collapsing -- */
65
64
 
65
+ /* -- Collapsing -- */
66
66
  const handleExit = useMemo(() => createChainedFunction(elem => {
67
67
  elem.style[computedDimension] = `${getDimensionValue(computedDimension, elem)}px`;
68
68
  triggerBrowserReflow(elem);
@@ -81,11 +81,14 @@ const Collapse = /*#__PURE__*/React.forwardRef(({
81
81
  onExit: handleExit,
82
82
  onExiting: handleExiting,
83
83
  childRef: children.ref,
84
- children: (state, innerProps) => /*#__PURE__*/React.cloneElement(children, { ...innerProps,
84
+ children: (state, innerProps) => /*#__PURE__*/React.cloneElement(children, {
85
+ ...innerProps,
85
86
  className: classNames(className, children.props.className, collapseStyles[state], computedDimension === 'width' && 'collapse-horizontal')
86
87
  })
87
88
  });
88
- }); // @ts-ignore
89
+ });
90
+
91
+ // @ts-ignore
89
92
 
90
93
  // @ts-ignore
91
94
  Collapse.defaultProps = defaultProps;
package/esm/Dropdown.js CHANGED
@@ -30,7 +30,8 @@ const DropdownItemText = createWithBsPrefix('dropdown-item-text', {
30
30
  const defaultProps = {
31
31
  navbar: false,
32
32
  align: 'start',
33
- autoClose: true
33
+ autoClose: true,
34
+ drop: 'down'
34
35
  };
35
36
  const Dropdown = /*#__PURE__*/React.forwardRef((pProps, ref) => {
36
37
  const {
@@ -53,17 +54,17 @@ const Dropdown = /*#__PURE__*/React.forwardRef((pProps, ref) => {
53
54
  const isInputGroup = useContext(InputGroupContext);
54
55
  const prefix = useBootstrapPrefix(bsPrefix, 'dropdown');
55
56
  const isRTL = useIsRTL();
56
-
57
57
  const isClosingPermitted = source => {
58
58
  // autoClose=false only permits close on button click
59
- if (autoClose === false) return source === 'click'; // autoClose=inside doesn't permit close on rootClose
59
+ if (autoClose === false) return source === 'click';
60
60
 
61
- if (autoClose === 'inside') return source !== 'rootClose'; // autoClose=outside doesn't permit close on select
61
+ // autoClose=inside doesn't permit close on rootClose
62
+ if (autoClose === 'inside') return source !== 'rootClose';
62
63
 
64
+ // autoClose=outside doesn't permit close on select
63
65
  if (autoClose === 'outside') return source !== 'select';
64
66
  return true;
65
67
  };
66
-
67
68
  const handleToggle = useEventCallback((nextShow, meta) => {
68
69
  if (meta.originalEvent.currentTarget === document && (meta.source !== 'keydown' || meta.originalEvent.key === 'Escape')) meta.source = 'rootClose';
69
70
  if (isClosingPermitted(meta.source)) onToggle == null ? void 0 : onToggle(nextShow, meta);
@@ -75,6 +76,14 @@ const Dropdown = /*#__PURE__*/React.forwardRef((pProps, ref) => {
75
76
  drop,
76
77
  isRTL
77
78
  }), [align, drop, isRTL]);
79
+ const directionClasses = {
80
+ down: prefix,
81
+ 'down-centered': `${prefix}-center`,
82
+ up: 'dropup',
83
+ 'up-centered': 'dropup-center dropup',
84
+ end: 'dropend',
85
+ start: 'dropstart'
86
+ };
78
87
  return /*#__PURE__*/_jsx(DropdownContext.Provider, {
79
88
  value: contextValue,
80
89
  children: /*#__PURE__*/_jsx(BaseDropdown, {
@@ -84,9 +93,10 @@ const Dropdown = /*#__PURE__*/React.forwardRef((pProps, ref) => {
84
93
  onToggle: handleToggle,
85
94
  focusFirstItemOnShow: focusFirstItemOnShow,
86
95
  itemSelector: `.${prefix}-item:not(.disabled):not(:disabled)`,
87
- children: isInputGroup ? props.children : /*#__PURE__*/_jsx(Component, { ...props,
96
+ children: isInputGroup ? props.children : /*#__PURE__*/_jsx(Component, {
97
+ ...props,
88
98
  ref: ref,
89
- className: classNames(className, show && 'show', (!drop || drop === 'down') && prefix, drop === 'up' && 'dropup', drop === 'end' && 'dropend', drop === 'start' && 'dropstart')
99
+ className: classNames(className, show && 'show', directionClasses[drop])
90
100
  })
91
101
  })
92
102
  });