react-bootstrap 3.0.0-beta.6 → 3.0.0-beta.7

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 (223) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +5 -6
  3. package/cjs/AbstractModalHeader.js +2 -1
  4. package/cjs/Accordion.d.ts +1 -1
  5. package/cjs/Accordion.js +2 -1
  6. package/cjs/AccordionBody.js +2 -1
  7. package/cjs/AccordionButton.d.ts +1 -1
  8. package/cjs/AccordionButton.js +2 -1
  9. package/cjs/AccordionCollapse.js +2 -1
  10. package/cjs/AccordionContext.d.ts +3 -3
  11. package/cjs/AccordionContext.js +2 -1
  12. package/cjs/AccordionHeader.js +2 -1
  13. package/cjs/AccordionItem.js +2 -1
  14. package/cjs/AccordionItemContext.js +2 -1
  15. package/cjs/Alert.js +2 -1
  16. package/cjs/AlertHeading.js +2 -1
  17. package/cjs/AlertLink.js +2 -1
  18. package/cjs/Badge.d.ts +1 -7
  19. package/cjs/Badge.js +3 -3
  20. package/cjs/Breadcrumb.js +2 -1
  21. package/cjs/BreadcrumbItem.js +2 -1
  22. package/cjs/Button.js +2 -1
  23. package/cjs/ButtonGroup.js +2 -1
  24. package/cjs/ButtonToolbar.js +2 -1
  25. package/cjs/Card.d.ts +1 -7
  26. package/cjs/Card.js +3 -3
  27. package/cjs/CardBody.js +2 -1
  28. package/cjs/CardFooter.js +2 -1
  29. package/cjs/CardGroup.js +2 -1
  30. package/cjs/CardHeader.js +2 -1
  31. package/cjs/CardHeaderContext.js +2 -1
  32. package/cjs/CardImg.d.ts +2 -1
  33. package/cjs/CardImg.js +2 -1
  34. package/cjs/CardImgOverlay.js +2 -1
  35. package/cjs/CardLink.js +2 -1
  36. package/cjs/CardSubtitle.js +2 -1
  37. package/cjs/CardText.js +2 -1
  38. package/cjs/CardTitle.js +2 -1
  39. package/cjs/Carousel.d.ts +2 -1
  40. package/cjs/Carousel.js +2 -1
  41. package/cjs/CarouselCaption.js +2 -1
  42. package/cjs/CarouselItem.js +2 -1
  43. package/cjs/CloseButton.d.ts +2 -1
  44. package/cjs/CloseButton.js +2 -1
  45. package/cjs/Col.js +2 -1
  46. package/cjs/Collapse.js +2 -1
  47. package/cjs/Container.d.ts +2 -1
  48. package/cjs/Container.js +2 -1
  49. package/cjs/Dropdown.js +2 -1
  50. package/cjs/DropdownButton.js +2 -1
  51. package/cjs/DropdownContext.js +2 -1
  52. package/cjs/DropdownDivider.js +2 -1
  53. package/cjs/DropdownHeader.js +2 -1
  54. package/cjs/DropdownItem.js +2 -1
  55. package/cjs/DropdownItemText.js +2 -1
  56. package/cjs/DropdownMenu.d.ts +2 -1
  57. package/cjs/DropdownMenu.js +4 -3
  58. package/cjs/DropdownToggle.d.ts +1 -6
  59. package/cjs/DropdownToggle.js +2 -1
  60. package/cjs/ElementChildren.js +2 -1
  61. package/cjs/Fade.js +2 -1
  62. package/cjs/Feedback.js +2 -1
  63. package/cjs/Figure.js +2 -1
  64. package/cjs/FigureCaption.js +2 -1
  65. package/cjs/FigureImage.js +2 -1
  66. package/cjs/FloatingLabel.js +2 -1
  67. package/cjs/Form.d.ts +15 -15
  68. package/cjs/Form.js +2 -1
  69. package/cjs/FormCheck.js +2 -1
  70. package/cjs/FormCheckInput.js +2 -1
  71. package/cjs/FormCheckLabel.js +2 -1
  72. package/cjs/FormContext.js +2 -1
  73. package/cjs/FormControl.js +4 -3
  74. package/cjs/FormFloating.js +2 -1
  75. package/cjs/FormGroup.js +2 -1
  76. package/cjs/FormLabel.js +4 -3
  77. package/cjs/FormRange.js +2 -1
  78. package/cjs/FormSelect.js +2 -1
  79. package/cjs/FormText.js +2 -1
  80. package/cjs/Image.js +2 -1
  81. package/cjs/InputGroup.d.ts +2 -2
  82. package/cjs/InputGroup.js +2 -1
  83. package/cjs/InputGroupContext.js +2 -1
  84. package/cjs/InputGroupText.js +2 -1
  85. package/cjs/ListGroup.d.ts +3 -3
  86. package/cjs/ListGroup.js +4 -3
  87. package/cjs/ListGroupItem.js +4 -3
  88. package/cjs/Modal.d.ts +2 -2
  89. package/cjs/Modal.js +24 -9
  90. package/cjs/ModalBody.js +2 -1
  91. package/cjs/ModalContext.js +2 -1
  92. package/cjs/ModalDialog.d.ts +2 -1
  93. package/cjs/ModalDialog.js +2 -1
  94. package/cjs/ModalFooter.js +2 -1
  95. package/cjs/ModalHeader.js +2 -1
  96. package/cjs/ModalTitle.js +2 -1
  97. package/cjs/Nav.d.ts +2 -2
  98. package/cjs/Nav.js +2 -1
  99. package/cjs/NavContext.js +2 -1
  100. package/cjs/NavDropdown.d.ts +4 -0
  101. package/cjs/NavDropdown.js +4 -1
  102. package/cjs/NavItem.js +2 -1
  103. package/cjs/NavLink.js +2 -1
  104. package/cjs/Navbar.d.ts +4 -3
  105. package/cjs/Navbar.js +3 -2
  106. package/cjs/NavbarBrand.js +2 -1
  107. package/cjs/NavbarCollapse.js +2 -1
  108. package/cjs/NavbarContext.d.ts +2 -1
  109. package/cjs/NavbarContext.js +2 -1
  110. package/cjs/NavbarOffcanvas.js +2 -1
  111. package/cjs/NavbarText.js +2 -1
  112. package/cjs/NavbarToggle.js +2 -1
  113. package/cjs/Offcanvas.d.ts +2 -2
  114. package/cjs/Offcanvas.js +2 -1
  115. package/cjs/OffcanvasBody.js +2 -1
  116. package/cjs/OffcanvasHeader.js +2 -1
  117. package/cjs/OffcanvasTitle.js +2 -1
  118. package/cjs/OffcanvasToggling.js +2 -1
  119. package/cjs/Overlay.js +2 -1
  120. package/cjs/OverlayTrigger.js +4 -3
  121. package/cjs/PageItem.js +2 -1
  122. package/cjs/Pagination.js +2 -1
  123. package/cjs/Placeholder.js +2 -1
  124. package/cjs/PlaceholderButton.js +2 -1
  125. package/cjs/Popover.d.ts +1 -15
  126. package/cjs/Popover.js +2 -1
  127. package/cjs/PopoverBody.js +2 -1
  128. package/cjs/PopoverHeader.js +2 -1
  129. package/cjs/ProgressBar.d.ts +2 -5
  130. package/cjs/ProgressBar.js +45 -70
  131. package/cjs/Ratio.d.ts +2 -1
  132. package/cjs/Ratio.js +2 -1
  133. package/cjs/Row.js +2 -1
  134. package/cjs/Spinner.js +2 -1
  135. package/cjs/SplitButton.js +2 -1
  136. package/cjs/Stack.js +2 -1
  137. package/cjs/Switch.js +2 -1
  138. package/cjs/Tab.d.ts +1 -1
  139. package/cjs/TabContainer.d.ts +1 -1
  140. package/cjs/TabContent.js +2 -1
  141. package/cjs/TabPane.js +2 -1
  142. package/cjs/Table.js +2 -1
  143. package/cjs/Tabs.js +2 -1
  144. package/cjs/ThemeProvider.d.ts +1 -1
  145. package/cjs/ThemeProvider.js +2 -1
  146. package/cjs/Toast.js +2 -1
  147. package/cjs/ToastBody.js +2 -1
  148. package/cjs/ToastContainer.js +2 -1
  149. package/cjs/ToastContext.d.ts +1 -1
  150. package/cjs/ToastContext.js +2 -1
  151. package/cjs/ToastFade.js +2 -1
  152. package/cjs/ToastHeader.js +2 -1
  153. package/cjs/ToggleButton.js +3 -1
  154. package/cjs/ToggleButtonGroup.js +2 -1
  155. package/cjs/Tooltip.d.ts +1 -15
  156. package/cjs/Tooltip.js +2 -1
  157. package/cjs/TransitionWrapper.js +2 -1
  158. package/cjs/createWithBsPrefix.js +2 -1
  159. package/cjs/divWithClassName.js +2 -1
  160. package/cjs/index.d.ts +2 -0
  161. package/cjs/index.js +4 -2
  162. package/cjs/internal/transitionEnd.d.ts +2 -0
  163. package/cjs/internal/transitionEnd.js +38 -0
  164. package/cjs/internal/warning.d.ts +2 -0
  165. package/cjs/internal/warning.js +37 -0
  166. package/cjs/transitionEndListener.js +1 -1
  167. package/cjs/types.d.ts +6 -9
  168. package/cjs/useCol.d.ts +1 -1
  169. package/dist/react-bootstrap.js +11028 -0
  170. package/dist/react-bootstrap.min.js +2 -0
  171. package/dist/react-bootstrap.min.js.LICENSE.txt +9 -0
  172. package/lib/Accordion.d.ts +1 -1
  173. package/lib/AccordionButton.d.ts +1 -1
  174. package/lib/AccordionContext.d.ts +3 -3
  175. package/lib/Badge.d.ts +1 -7
  176. package/lib/Badge.js +1 -2
  177. package/lib/Card.d.ts +1 -7
  178. package/lib/Card.js +1 -2
  179. package/lib/CardImg.d.ts +2 -1
  180. package/lib/Carousel.d.ts +2 -1
  181. package/lib/CloseButton.d.ts +2 -1
  182. package/lib/Container.d.ts +2 -1
  183. package/lib/DropdownMenu.d.ts +2 -1
  184. package/lib/DropdownMenu.js +2 -2
  185. package/lib/DropdownToggle.d.ts +1 -6
  186. package/lib/Form.d.ts +15 -15
  187. package/lib/FormControl.js +2 -2
  188. package/lib/FormLabel.js +2 -2
  189. package/lib/InputGroup.d.ts +2 -2
  190. package/lib/ListGroup.d.ts +3 -3
  191. package/lib/ListGroup.js +2 -2
  192. package/lib/ListGroupItem.js +2 -2
  193. package/lib/Modal.d.ts +2 -2
  194. package/lib/Modal.js +22 -8
  195. package/lib/ModalDialog.d.ts +2 -1
  196. package/lib/Nav.d.ts +2 -2
  197. package/lib/NavDropdown.d.ts +4 -0
  198. package/lib/NavDropdown.js +2 -0
  199. package/lib/Navbar.d.ts +4 -3
  200. package/lib/Navbar.js +1 -1
  201. package/lib/NavbarContext.d.ts +2 -1
  202. package/lib/Offcanvas.d.ts +2 -2
  203. package/lib/OverlayTrigger.js +2 -2
  204. package/lib/Popover.d.ts +1 -15
  205. package/lib/ProgressBar.d.ts +2 -5
  206. package/lib/ProgressBar.js +43 -69
  207. package/lib/Ratio.d.ts +2 -1
  208. package/lib/Tab.d.ts +1 -1
  209. package/lib/TabContainer.d.ts +1 -1
  210. package/lib/ThemeProvider.d.ts +1 -1
  211. package/lib/ToastContext.d.ts +1 -1
  212. package/lib/ToggleButton.js +1 -0
  213. package/lib/Tooltip.d.ts +1 -15
  214. package/lib/index.d.ts +2 -0
  215. package/lib/index.js +1 -0
  216. package/lib/internal/transitionEnd.d.ts +2 -0
  217. package/lib/internal/transitionEnd.js +32 -0
  218. package/lib/internal/warning.d.ts +2 -0
  219. package/lib/internal/warning.js +32 -0
  220. package/lib/transitionEndListener.js +1 -1
  221. package/lib/types.d.ts +6 -9
  222. package/lib/useCol.d.ts +1 -1
  223. package/package.json +39 -36
@@ -3,7 +3,7 @@
3
3
  import clsx from 'clsx';
4
4
  import * as React from 'react';
5
5
  import { useContext } from 'react';
6
- import warning from 'warning';
6
+ import { warn } from './internal/warning.js';
7
7
  import Feedback from './Feedback.js';
8
8
  import FormContext from './FormContext.js';
9
9
  import { useBootstrapPrefix } from './ThemeProvider.js';
@@ -27,7 +27,7 @@ const FormControl = /*#__PURE__*/React.forwardRef(({
27
27
  controlId
28
28
  } = useContext(FormContext);
29
29
  bsPrefix = useBootstrapPrefix(bsPrefix, 'form-control');
30
- process.env.NODE_ENV !== "production" ? warning(controlId == null || !id, '`controlId` is ignored on `<FormControl>` when `id` is specified.') : void 0;
30
+ warn(controlId == null || !id, '`controlId` is ignored on `<FormControl>` when `id` is specified.');
31
31
  return /*#__PURE__*/_jsx(Component, {
32
32
  ...props,
33
33
  type: type,
package/lib/FormLabel.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import clsx from 'clsx';
4
4
  import * as React from 'react';
5
5
  import { useContext } from 'react';
6
- import warning from 'warning';
6
+ import { warn } from './internal/warning.js';
7
7
  import Col from './Col.js';
8
8
  import FormContext from './FormContext.js';
9
9
  import { useBootstrapPrefix } from './ThemeProvider.js';
@@ -25,7 +25,7 @@ const FormLabel = /*#__PURE__*/React.forwardRef(({
25
25
  let columnClass = 'col-form-label';
26
26
  if (typeof column === 'string') columnClass = `${columnClass} ${columnClass}-${column}`;
27
27
  const classes = clsx(className, bsPrefix, visuallyHidden && 'visually-hidden', column && columnClass);
28
- process.env.NODE_ENV !== "production" ? warning(controlId == null || !htmlFor, '`controlId` is ignored on `<FormLabel>` when `htmlFor` is specified.') : void 0;
28
+ warn(controlId == null || !htmlFor, '`controlId` is ignored on `<FormLabel>` when `htmlFor` is specified.');
29
29
  htmlFor = htmlFor || controlId;
30
30
  if (column) return /*#__PURE__*/_jsx(Col, {
31
31
  ref: ref,
@@ -23,7 +23,7 @@ export interface InputGroupProps extends React.HTMLAttributes<HTMLElement> {
23
23
  }
24
24
  declare const _default: DynamicRefForwardingComponent<"div", InputGroupProps> & {
25
25
  Text: DynamicRefForwardingComponent<"span", import("./InputGroupText.js").InputGroupTextProps>;
26
- Radio: (props: FormCheckInputProps) => import("react/jsx-runtime").JSX.Element;
27
- Checkbox: (props: FormCheckInputProps) => import("react/jsx-runtime").JSX.Element;
26
+ Radio: (props: FormCheckInputProps) => React.JSX.Element;
27
+ Checkbox: (props: FormCheckInputProps) => React.JSX.Element;
28
28
  };
29
29
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { DynamicRefForwardingComponent, EventKey } from '@restart/ui/types';
3
- import type { BaseNavProps } from './types.js';
3
+ import type { BaseNavProps, LiteralUnion } from './types.js';
4
4
  export interface ListGroupProps extends BaseNavProps {
5
5
  /**
6
6
  * Element used to render the component.
@@ -15,14 +15,14 @@ export interface ListGroupProps extends BaseNavProps {
15
15
  /**
16
16
  * Adds a variant to the list-group
17
17
  */
18
- variant?: 'flush' | string | undefined;
18
+ variant?: LiteralUnion<'flush', string> | undefined;
19
19
  /**
20
20
  * Changes the flow of the list group items from vertical to horizontal.
21
21
  * A value of `null` (the default) sets it to vertical for all breakpoints;
22
22
  * Just including the prop sets it for all breakpoints, while `{sm|md|lg|xl|xxl}`
23
23
  * makes the list group horizontal starting at that breakpoint’s `min-width`.
24
24
  */
25
- horizontal?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | undefined;
25
+ horizontal?: boolean | LiteralUnion<'sm' | 'md' | 'lg' | 'xl' | 'xxl', string> | undefined;
26
26
  /**
27
27
  * The default active key of the list group.
28
28
  */
package/lib/ListGroup.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import clsx from 'clsx';
4
4
  import * as React from 'react';
5
- import warning from 'warning';
5
+ import { warn } from './internal/warning.js';
6
6
  import { useUncontrolled } from 'uncontrollable';
7
7
  import BaseNav from '@restart/ui/Nav';
8
8
  import { useBootstrapPrefix } from './ThemeProvider.js';
@@ -26,7 +26,7 @@ const ListGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
26
26
  if (horizontal) {
27
27
  horizontalVariant = horizontal === true ? 'horizontal' : `horizontal-${horizontal}`;
28
28
  }
29
- process.env.NODE_ENV !== "production" ? warning(!(horizontal && variant === 'flush'), '`variant="flush"` and `horizontal` should not be used together.') : void 0;
29
+ warn(!(horizontal && variant === 'flush'), '`variant="flush"` and `horizontal` should not be used together.');
30
30
  return /*#__PURE__*/_jsx(BaseNav, {
31
31
  ref: ref,
32
32
  ...controlledProps,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import clsx from 'clsx';
4
4
  import * as React from 'react';
5
- import warning from 'warning';
5
+ import { warn } from './internal/warning.js';
6
6
  import useEventCallback from '@restart/hooks/useEventCallback';
7
7
  import { useNavItem } from '@restart/ui/NavItem';
8
8
  import { makeEventKey } from '@restart/ui/SelectableContext';
@@ -38,7 +38,7 @@ const ListGroupItem = /*#__PURE__*/React.forwardRef(({
38
38
  props['aria-disabled'] = true;
39
39
  }
40
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;
41
+ warn(!!as || !(!action && props.href), '`action=false` and `href` should not be used together.');
42
42
  return /*#__PURE__*/_jsx(Component, {
43
43
  ref: ref,
44
44
  ...props,
package/lib/Modal.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { type ModalHandle } from '@restart/ui/Modal';
3
- import type { BaseModalProps } from './types.js';
3
+ import type { BaseModalProps, LiteralUnion } from './types.js';
4
4
  export interface ModalProps extends BaseModalProps {
5
5
  /**
6
6
  * @default 'modal'
@@ -15,7 +15,7 @@ export interface ModalProps extends BaseModalProps {
15
15
  * Renders a fullscreen modal. Specifying a breakpoint will render the modal
16
16
  * as fullscreen __below__ the breakpoint size.
17
17
  */
18
- fullscreen?: true | string | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down' | undefined;
18
+ fullscreen?: true | LiteralUnion<'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down', string> | undefined;
19
19
  /**
20
20
  * vertically center the Dialog in the window
21
21
  */
package/lib/Modal.js CHANGED
@@ -8,7 +8,6 @@ import useCallbackRef from '@restart/hooks/useCallbackRef';
8
8
  import useEventCallback from '@restart/hooks/useEventCallback';
9
9
  import useMergedRefs from '@restart/hooks/useMergedRefs';
10
10
  import useWillUnmount from '@restart/hooks/useWillUnmount';
11
- import transitionEnd from 'dom-helpers/transitionEnd';
12
11
  import * as React from 'react';
13
12
  import { useCallback, useMemo, useRef, useState } from 'react';
14
13
  import BaseModal from '@restart/ui/Modal';
@@ -21,6 +20,7 @@ import ModalFooter from './ModalFooter.js';
21
20
  import ModalHeader from './ModalHeader.js';
22
21
  import ModalTitle from './ModalTitle.js';
23
22
  import { useBootstrapPrefix, useIsRTL } from './ThemeProvider.js';
23
+ import transitionEnd from './internal/transitionEnd.js';
24
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
25
  function DialogTransition(props) {
26
26
  return /*#__PURE__*/_jsx(Fade, {
@@ -89,8 +89,13 @@ const Modal = /*#__PURE__*/React.forwardRef(({
89
89
  isRTL
90
90
  });
91
91
  }
92
+
93
+ /**
94
+ * Updates the modal padding style to account for scrollbar width differences
95
+ * between the container and modal dialog when viewport or content resizes.
96
+ */
92
97
  function updateDialogStyle(node) {
93
- if (!canUseDOM) return;
98
+ if (!canUseDOM || !node) return;
94
99
  const containerIsOverflowing = getModalManager().getScrollbarWidth() > 0;
95
100
  const modalIsOverflowing = node.scrollHeight > ownerDocument(node).documentElement.clientHeight;
96
101
  setStyle({
@@ -99,13 +104,17 @@ const Modal = /*#__PURE__*/React.forwardRef(({
99
104
  });
100
105
  }
101
106
  const handleWindowResize = useEventCallback(() => {
102
- if (modal) {
107
+ if (modal != null && modal.dialog) {
103
108
  updateDialogStyle(modal.dialog);
104
109
  }
105
110
  });
111
+ const cleanupStaticModalAnimation = () => {
112
+ removeStaticModalAnimationRef.current == null || removeStaticModalAnimationRef.current();
113
+ removeStaticModalAnimationRef.current = null;
114
+ };
106
115
  useWillUnmount(() => {
107
116
  window.removeEventListener('resize', handleWindowResize);
108
- removeStaticModalAnimationRef.current == null || removeStaticModalAnimationRef.current();
117
+ cleanupStaticModalAnimation();
109
118
  });
110
119
 
111
120
  // We prevent the modal from closing during a drag by detecting where the
@@ -122,9 +131,13 @@ const Modal = /*#__PURE__*/React.forwardRef(({
122
131
  };
123
132
  const handleStaticModalAnimation = () => {
124
133
  setAnimateStaticModal(true);
125
- removeStaticModalAnimationRef.current = transitionEnd(modal.dialog, () => {
126
- setAnimateStaticModal(false);
127
- });
134
+ if (modal != null && modal.dialog) {
135
+ cleanupStaticModalAnimation();
136
+ removeStaticModalAnimationRef.current = transitionEnd(modal.dialog, () => {
137
+ setAnimateStaticModal(false);
138
+ cleanupStaticModalAnimation();
139
+ });
140
+ }
128
141
  };
129
142
  const handleStaticBackdropClick = e => {
130
143
  if (e.target !== e.currentTarget) {
@@ -162,7 +175,8 @@ const Modal = /*#__PURE__*/React.forwardRef(({
162
175
  onEnter == null || onEnter(node, isAppearing);
163
176
  };
164
177
  const handleExit = node => {
165
- removeStaticModalAnimationRef.current == null || removeStaticModalAnimationRef.current();
178
+ cleanupStaticModalAnimation();
179
+ setAnimateStaticModal(false);
166
180
  onExit == null || onExit(node);
167
181
  };
168
182
  const handleEntering = (node, isAppearing) => {
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { LiteralUnion } from './types.js';
2
3
  export interface ModalDialogProps extends React.HTMLAttributes<HTMLDivElement> {
3
4
  /**
4
5
  * Element used to render the component.
@@ -16,7 +17,7 @@ export interface ModalDialogProps extends React.HTMLAttributes<HTMLDivElement> {
16
17
  * Renders a fullscreen modal. Specifying a breakpoint will render the modal
17
18
  * as fullscreen __below__ the breakpoint size.
18
19
  */
19
- fullscreen?: true | string | 'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down' | undefined;
20
+ fullscreen?: true | LiteralUnion<'sm-down' | 'md-down' | 'lg-down' | 'xl-down' | 'xxl-down', string> | undefined;
20
21
  /**
21
22
  * Specify whether the Component should be vertically centered
22
23
  */
package/lib/Nav.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { DynamicRefForwardingComponent, EventKey } from '@restart/ui/types';
3
- import type { BaseNavProps } from './types.js';
3
+ import type { BaseNavProps, LiteralUnion } from './types.js';
4
4
  export interface NavProps extends BaseNavProps {
5
5
  /**
6
6
  * Element used to render the component.
@@ -13,7 +13,7 @@ export interface NavProps extends BaseNavProps {
13
13
  /**
14
14
  * The visual variant of the nav items.
15
15
  */
16
- variant?: 'tabs' | 'pills' | 'underline' | string | undefined;
16
+ variant?: LiteralUnion<'tabs' | 'pills' | 'underline', string> | undefined;
17
17
  /**
18
18
  * The default active key that is selected on start.
19
19
  */
@@ -39,6 +39,10 @@ export interface NavDropdownProps extends BsDropdownProps, Omit<React.HTMLAttrib
39
39
  * Omitting this will use the default light color.
40
40
  */
41
41
  menuVariant?: DropdownMenuVariant | undefined;
42
+ /**
43
+ * An optional tabIndex for the toggle element.
44
+ */
45
+ tabIndex?: number | undefined;
42
46
  }
43
47
  declare const _default: DynamicRefForwardingComponent<"div", NavDropdownProps> & {
44
48
  Item: DynamicRefForwardingComponent<"a", import("./DropdownItem.js").DropdownItemProps>;
@@ -18,6 +18,7 @@ const NavDropdown = /*#__PURE__*/React.forwardRef(({
18
18
  active,
19
19
  renderMenuOnMount,
20
20
  menuVariant,
21
+ tabIndex,
21
22
  ...props
22
23
  }, ref) => {
23
24
  /* NavItem has no additional logic, it's purely presentational. Can set nav item class here to support "as" */
@@ -33,6 +34,7 @@ const NavDropdown = /*#__PURE__*/React.forwardRef(({
33
34
  disabled: disabled,
34
35
  childBsPrefix: bsPrefix,
35
36
  as: NavLink,
37
+ tabIndex: tabIndex,
36
38
  children: title
37
39
  }), /*#__PURE__*/_jsx(Dropdown.Menu, {
38
40
  role: menuRole,
package/lib/Navbar.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { DynamicRefForwardingComponent, SelectCallback } from '@restart/ui/types';
3
+ import type { LiteralUnion } from './types.js';
3
4
  export interface NavbarProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'onToggle'> {
4
5
  /**
5
6
  * Element used to render the component.
@@ -14,16 +15,16 @@ export interface NavbarProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
14
15
  * Use in combination with the `bg` prop, `background-color` utilities,
15
16
  * or your own background styles.
16
17
  */
17
- variant?: 'light' | 'dark' | string | undefined;
18
+ variant?: LiteralUnion<'light' | 'dark', string> | undefined;
18
19
  /**
19
20
  * The breakpoint, below which, the Navbar will collapse.
20
21
  * When `true` the Navbar will always be expanded regardless of screen size.
21
22
  */
22
- expand?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | undefined;
23
+ expand?: boolean | LiteralUnion<'sm' | 'md' | 'lg' | 'xl' | 'xxl', string> | undefined;
23
24
  /**
24
25
  * Default expanded state of the Navbar.
25
26
  */
26
- defaultExpand?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | undefined;
27
+ defaultExpand?: boolean | LiteralUnion<'sm' | 'md' | 'lg' | 'xl' | 'xxl', string> | undefined;
27
28
  /**
28
29
  * A convenience prop for adding `bg-*` utility classes since they are so commonly used here.
29
30
  * `light` and `dark` are common choices but any `bg-*` class is supported, including any custom ones you might define.
package/lib/Navbar.js CHANGED
@@ -17,7 +17,7 @@ const Navbar = /*#__PURE__*/React.forwardRef((props, ref) => {
17
17
  const {
18
18
  bsPrefix: initialBsPrefix,
19
19
  expand = true,
20
- variant = 'light',
20
+ variant,
21
21
  bg,
22
22
  fixed,
23
23
  sticky,
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
+ import type { LiteralUnion } from './types.js';
2
3
  export interface NavbarContextType {
3
4
  onToggle: () => void;
4
5
  bsPrefix?: string;
5
6
  expanded: boolean;
6
- expand?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
7
+ expand?: boolean | LiteralUnion<'sm' | 'md' | 'lg' | 'xl' | 'xxl', string>;
7
8
  }
8
9
  declare const context: React.Context<NavbarContextType | null>;
9
10
  export default context;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { type ModalHandle } from '@restart/ui/Modal';
3
- import type { BaseModalProps } from './types.js';
3
+ import type { BaseModalProps, LiteralUnion } from './types.js';
4
4
  export type OffcanvasPlacement = 'start' | 'end' | 'top' | 'bottom';
5
5
  export interface OffcanvasProps extends BaseModalProps {
6
6
  /**
@@ -22,7 +22,7 @@ export interface OffcanvasProps extends BaseModalProps {
22
22
  /**
23
23
  * Hide content outside the viewport from a specified breakpoint and down.
24
24
  */
25
- responsive?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | string | undefined;
25
+ responsive?: LiteralUnion<'sm' | 'md' | 'lg' | 'xl' | 'xxl', string> | undefined;
26
26
  [other: string]: any;
27
27
  }
28
28
  declare const _default: React.ForwardRefExoticComponent<Omit<OffcanvasProps, "ref"> & React.RefAttributes<ModalHandle>> & {
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import { cloneElement, useCallback, useRef } from 'react';
5
5
  import useTimeout from '@restart/hooks/useTimeout';
6
- import warning from 'warning';
6
+ import { warnOnce } from './internal/warning.js';
7
7
  import { useUncontrolledProp } from 'uncontrollable';
8
8
  import useMergedRefs from '@restart/hooks/useMergedRefs';
9
9
  import { getChildRef } from '@restart/ui/utils';
@@ -104,7 +104,7 @@ const OverlayTrigger = ({
104
104
  triggerProps.onBlur = handleBlur;
105
105
  }
106
106
  if (triggers.indexOf('hover') !== -1) {
107
- process.env.NODE_ENV !== "production" ? warning(triggers.length > 1, '[react-bootstrap] Specifying only the `"hover"` trigger limits the visibility of the overlay to just mouse users. Consider also including the `"focus"` trigger so that touch and keyboard only users can see the overlay as well.') : void 0;
107
+ warnOnce(triggers.length > 1, '[react-bootstrap] Specifying only the `"hover"` trigger limits the visibility of the overlay to just mouse users. Consider also including the `"focus"` trigger so that touch and keyboard only users can see the overlay as well.');
108
108
  triggerProps.onMouseOver = handleMouseOver;
109
109
  triggerProps.onMouseOut = handleMouseOut;
110
110
  }
package/lib/Popover.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { OverlayArrowProps } from '@restart/ui/Overlay';
3
- import type { Placement, PopperRef } from './types.js';
3
+ import type { Placement } from './types.js';
4
4
  export interface PopoverProps extends React.HTMLAttributes<HTMLDivElement> {
5
5
  /**
6
6
  * @default 'popover'
@@ -25,20 +25,6 @@ export interface PopoverProps extends React.HTMLAttributes<HTMLDivElement> {
25
25
  * passing the children directly to it
26
26
  */
27
27
  body?: boolean | undefined;
28
- /**
29
- * @private
30
- */
31
- popper?: PopperRef | undefined;
32
- /**
33
- * @private
34
- */
35
- show?: boolean | undefined;
36
- /**
37
- * Whether or not Popper has done its initial measurement and positioning.
38
- *
39
- * @private
40
- */
41
- hasDoneInitialMeasure?: boolean | undefined;
42
28
  }
43
29
  declare const _default: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLDivElement>> & {
44
30
  Header: import("@restart/ui/types").DynamicRefForwardingComponent<"div", import("./PopoverHeader.js").PopoverHeaderProps>;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { LiteralUnion } from './types.js';
2
3
  export interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {
3
4
  /**
4
5
  * @default 'progress'
@@ -38,11 +39,7 @@ export interface ProgressBarProps extends React.HTMLAttributes<HTMLDivElement> {
38
39
  *
39
40
  * @type {'success' | 'danger' | 'warning' | 'info' | string | undefined}
40
41
  */
41
- variant?: 'success' | 'danger' | 'warning' | 'info' | string | undefined;
42
- /**
43
- * @private
44
- */
45
- isChild?: boolean | undefined;
42
+ variant?: LiteralUnion<'success' | 'danger' | 'warning' | 'info', string> | undefined;
46
43
  }
47
44
  declare const ProgressBar: React.ForwardRefExoticComponent<ProgressBarProps & React.RefAttributes<HTMLDivElement>>;
48
45
  export default ProgressBar;
@@ -11,89 +11,63 @@ function getPercentage(now, min, max) {
11
11
  const percentage = (now - min) / (max - min) * 100;
12
12
  return Math.round(percentage * ROUND_PRECISION) / ROUND_PRECISION;
13
13
  }
14
- function renderProgressBar({
15
- min,
16
- now,
17
- max,
14
+ const ProgressBar = /*#__PURE__*/React.forwardRef(({
15
+ bsPrefix,
16
+ isChild = false,
17
+ children,
18
+ min = 0,
19
+ now = 0,
20
+ max = 100,
18
21
  label,
19
- visuallyHidden,
20
- striped,
21
- animated,
22
+ animated = false,
23
+ visuallyHidden = false,
24
+ striped = false,
25
+ variant,
22
26
  className,
23
27
  style,
24
- variant,
25
- bsPrefix,
26
28
  ...props
27
- }, ref) {
29
+ }, ref) => {
30
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'progress');
31
+ if (children) {
32
+ return /*#__PURE__*/_jsx("div", {
33
+ ref: ref,
34
+ ...props,
35
+ style: style,
36
+ className: clsx(className, `${bsPrefix}-stacked`),
37
+ children: map(children, child => /*#__PURE__*/cloneElement(child, {
38
+ isChild: true
39
+ }))
40
+ });
41
+ }
42
+ const width = `${getPercentage(now, min, max)}%`;
28
43
  return /*#__PURE__*/_jsx("div", {
29
44
  ref: ref,
30
45
  ...props,
31
46
  role: "progressbar",
32
- className: clsx(className, `${bsPrefix}-bar`, {
33
- [`bg-${variant}`]: variant,
34
- [`${bsPrefix}-bar-animated`]: animated,
35
- [`${bsPrefix}-bar-striped`]: animated || striped
36
- }),
47
+ className: clsx(className, bsPrefix),
37
48
  style: {
38
- width: `${getPercentage(now, min, max)}%`,
49
+ width: isChild ? width : undefined,
39
50
  ...style
40
51
  },
41
52
  "aria-valuenow": now,
42
53
  "aria-valuemin": min,
43
54
  "aria-valuemax": max,
44
- children: visuallyHidden ? /*#__PURE__*/_jsx("span", {
45
- className: "visually-hidden",
46
- children: label
47
- }) : label
48
- });
49
- }
50
- const ProgressBar = /*#__PURE__*/React.forwardRef(({
51
- isChild = false,
52
- ...rest
53
- }, ref) => {
54
- const props = {
55
- min: 0,
56
- max: 100,
57
- animated: false,
58
- visuallyHidden: false,
59
- striped: false,
60
- ...rest
61
- };
62
- props.bsPrefix = useBootstrapPrefix(props.bsPrefix, 'progress');
63
- if (isChild) {
64
- return renderProgressBar(props, ref);
65
- }
66
- const {
67
- min,
68
- now,
69
- max,
70
- label,
71
- visuallyHidden,
72
- striped,
73
- animated,
74
- bsPrefix,
75
- variant,
76
- className,
77
- children,
78
- ...wrapperProps
79
- } = props;
80
- return /*#__PURE__*/_jsx("div", {
81
- ref: ref,
82
- ...wrapperProps,
83
- className: clsx(className, bsPrefix),
84
- children: children ? map(children, child => /*#__PURE__*/cloneElement(child, {
85
- isChild: true
86
- })) : renderProgressBar({
87
- min,
88
- now,
89
- max,
90
- label,
91
- visuallyHidden,
92
- striped,
93
- animated,
94
- bsPrefix,
95
- variant
96
- }, ref)
55
+ children: /*#__PURE__*/_jsx("div", {
56
+ className: clsx(className, `${bsPrefix}-bar`, {
57
+ [`bg-${variant}`]: variant,
58
+ [`${bsPrefix}-bar-animated`]: animated,
59
+ [`${bsPrefix}-bar-striped`]: animated || striped
60
+ }),
61
+ style:
62
+ // Stacked progress bar width style is on the parent.
63
+ isChild ? undefined : {
64
+ width
65
+ },
66
+ children: visuallyHidden ? /*#__PURE__*/_jsx("span", {
67
+ className: "visually-hidden",
68
+ children: label
69
+ }) : label
70
+ })
97
71
  });
98
72
  });
99
73
  ProgressBar.displayName = 'ProgressBar';
package/lib/Ratio.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- export type AspectRatio = '1x1' | '4x3' | '16x9' | '21x9' | string;
2
+ import type { LiteralUnion } from './types.js';
3
+ export type AspectRatio = LiteralUnion<'1x1' | '4x3' | '16x9' | '21x9', string>;
3
4
  export interface RatioProps extends React.HTMLAttributes<HTMLDivElement> {
4
5
  /**
5
6
  * @default 'ratio'
package/lib/Tab.d.ts CHANGED
@@ -20,7 +20,7 @@ export interface TabProps extends Omit<TabPaneProps, 'title'> {
20
20
  }
21
21
  declare const _default: React.FC<TabProps> & {
22
22
  Container: {
23
- ({ transition, ...props }: import("./TabContainer.js").TabContainerProps): import("react/jsx-runtime").JSX.Element;
23
+ ({ transition, ...props }: import("./TabContainer.js").TabContainerProps): React.JSX.Element;
24
24
  displayName: string;
25
25
  };
26
26
  Content: import("@restart/ui/types").DynamicRefForwardingComponent<"div", import("./TabContent.js").TabContentProps>;
@@ -50,7 +50,7 @@ export interface TabContainerProps extends React.PropsWithChildren {
50
50
  defaultActiveKey?: EventKey | undefined;
51
51
  }
52
52
  declare const TabContainer: {
53
- ({ transition, ...props }: TabContainerProps): import("react/jsx-runtime").JSX.Element;
53
+ ({ transition, ...props }: TabContainerProps): import("react").JSX.Element;
54
54
  displayName: string;
55
55
  };
56
56
  export default TabContainer;
@@ -33,7 +33,7 @@ export interface ThemeProviderProps extends Partial<ThemeContextValue> {
33
33
  children: React.ReactNode;
34
34
  }
35
35
  declare const Consumer: React.Consumer<ThemeContextValue>;
36
- declare function ThemeProvider({ prefixes, breakpoints, minBreakpoint, dir, children, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
36
+ declare function ThemeProvider({ prefixes, breakpoints, minBreakpoint, dir, children, }: ThemeProviderProps): React.JSX.Element;
37
37
  export declare function useBootstrapPrefix(prefix: string | undefined, defaultPrefix: string): string;
38
38
  export declare function useBootstrapBreakpoints(): string[];
39
39
  export declare function useBootstrapMinBreakpoint(): string | undefined;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export interface ToastContextType {
3
- onClose?: (e?: React.MouseEvent | React.KeyboardEvent) => void;
3
+ onClose?: ((e?: React.MouseEvent | React.KeyboardEvent) => void) | undefined;
4
4
  }
5
5
  declare const ToastContext: React.Context<ToastContextType>;
6
6
  export default ToastContext;
@@ -38,6 +38,7 @@ const ToggleButton = /*#__PURE__*/React.forwardRef(({
38
38
  className: clsx(className, disabled && 'disabled'),
39
39
  type: undefined,
40
40
  role: undefined,
41
+ tabIndex: undefined,
41
42
  as: "label",
42
43
  htmlFor: id
43
44
  })]
package/lib/Tooltip.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { OverlayArrowProps } from '@restart/ui/Overlay';
3
- import type { Placement, PopperRef } from './types.js';
3
+ import type { Placement } from './types.js';
4
4
  export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
5
5
  /**
6
6
  * @default 'tooltip'
@@ -22,20 +22,6 @@ export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
22
22
  * @type {{ ref: ReactRef, style: Object }}
23
23
  */
24
24
  arrowProps?: Partial<OverlayArrowProps> | undefined;
25
- /**
26
- * @private
27
- */
28
- show?: boolean;
29
- /**
30
- * @private
31
- */
32
- popper?: PopperRef | undefined;
33
- /**
34
- * Whether or not Popper has done its initial measurement and positioning.
35
- *
36
- * @private
37
- */
38
- hasDoneInitialMeasure?: boolean | undefined;
39
25
  }
40
26
  declare const _default: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLDivElement>> & {
41
27
  TOOLTIP_OFFSET: number[];
package/lib/index.d.ts CHANGED
@@ -111,6 +111,8 @@ export { default as Image } from './Image.js';
111
111
  export type { ImageProps } from './Image.js';
112
112
  export { default as InputGroup } from './InputGroup.js';
113
113
  export type { InputGroupProps } from './InputGroup.js';
114
+ export { default as InputGroupText } from './InputGroupText.js';
115
+ export type { InputGroupTextProps } from './InputGroupText.js';
114
116
  export { default as ListGroup } from './ListGroup.js';
115
117
  export type { ListGroupProps } from './ListGroup.js';
116
118
  export { default as ListGroupItem } from './ListGroupItem.js';
package/lib/index.js CHANGED
@@ -56,6 +56,7 @@ export { default as FormText } from './FormText.js';
56
56
  export { default as FormSelect } from './FormSelect.js';
57
57
  export { default as Image } from './Image.js';
58
58
  export { default as InputGroup } from './InputGroup.js';
59
+ export { default as InputGroupText } from './InputGroupText.js';
59
60
  export { default as ListGroup } from './ListGroup.js';
60
61
  export { default as ListGroupItem } from './ListGroupItem.js';
61
62
  export { default as Modal } from './Modal.js';