react-bootstrap 1.3.0 → 1.4.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.
- package/README.md +1 -1
- package/cjs/AccordionCollapse.js +9 -3
- package/cjs/Button.js +1 -1
- package/cjs/Carousel.js +22 -4
- package/cjs/CarouselItem.d.ts +7 -2
- package/cjs/CarouselItem.js +25 -2
- package/cjs/DropdownButton.d.ts +2 -0
- package/cjs/DropdownButton.js +16 -3
- package/cjs/DropdownItem.js +3 -2
- package/cjs/DropdownMenu.d.ts +22 -0
- package/cjs/DropdownMenu.js +45 -6
- package/cjs/DropdownToggle.js +2 -3
- package/cjs/Fade.d.ts +6 -3
- package/cjs/Form.d.ts +1 -1
- package/cjs/FormCheck.d.ts +1 -3
- package/cjs/FormCheck.js +1 -1
- package/cjs/FormLabel.js +1 -1
- package/cjs/ListGroupItem.js +2 -1
- package/cjs/Modal.d.ts +1 -0
- package/cjs/Modal.js +4 -2
- package/cjs/ModalDialog.d.ts +1 -0
- package/cjs/ModalDialog.js +3 -2
- package/cjs/NavDropdown.d.ts +3 -3
- package/cjs/Overlay.d.ts +1 -1
- package/cjs/OverlayTrigger.d.ts +1 -1
- package/cjs/SplitButton.d.ts +2 -0
- package/cjs/SplitButton.js +15 -2
- package/cjs/ToggleButtonGroup.d.ts +4 -3
- package/cjs/ToggleButtonGroup.js +2 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/usePopperMarginModifiers.d.ts +4 -1
- package/cjs/usePopperMarginModifiers.js +8 -4
- package/dist/react-bootstrap.js +327 -130
- package/dist/react-bootstrap.min.js +2 -2
- package/esm/AccordionCollapse.js +8 -3
- package/esm/Button.js +1 -1
- package/esm/Carousel.js +23 -5
- package/esm/CarouselItem.d.ts +7 -2
- package/esm/CarouselItem.js +22 -2
- package/esm/DropdownButton.d.ts +2 -0
- package/esm/DropdownButton.js +14 -3
- package/esm/DropdownItem.js +3 -2
- package/esm/DropdownMenu.d.ts +22 -0
- package/esm/DropdownMenu.js +38 -3
- package/esm/DropdownToggle.js +2 -3
- package/esm/Fade.d.ts +6 -3
- package/esm/Form.d.ts +1 -1
- package/esm/FormCheck.d.ts +1 -3
- package/esm/FormCheck.js +1 -1
- package/esm/FormLabel.js +1 -1
- package/esm/ListGroupItem.js +2 -1
- package/esm/Modal.d.ts +1 -0
- package/esm/Modal.js +4 -2
- package/esm/ModalDialog.d.ts +1 -0
- package/esm/ModalDialog.js +3 -2
- package/esm/NavDropdown.d.ts +3 -3
- package/esm/Overlay.d.ts +1 -1
- package/esm/OverlayTrigger.d.ts +1 -1
- package/esm/SplitButton.d.ts +2 -0
- package/esm/SplitButton.js +14 -2
- package/esm/ToggleButtonGroup.d.ts +4 -3
- package/esm/ToggleButtonGroup.js +2 -1
- package/esm/index.d.ts +1 -0
- package/esm/usePopperMarginModifiers.d.ts +4 -1
- package/esm/usePopperMarginModifiers.js +7 -4
- package/package.json +24 -24
package/esm/AccordionCollapse.js
CHANGED
|
@@ -3,16 +3,21 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
import React, { useContext } from 'react';
|
|
4
4
|
import Collapse from './Collapse';
|
|
5
5
|
import AccordionContext from './AccordionContext';
|
|
6
|
+
import SelectableContext from './SelectableContext';
|
|
6
7
|
var AccordionCollapse = React.forwardRef(function (_ref, ref) {
|
|
7
8
|
var children = _ref.children,
|
|
8
9
|
eventKey = _ref.eventKey,
|
|
9
10
|
props = _objectWithoutPropertiesLoose(_ref, ["children", "eventKey"]);
|
|
10
11
|
|
|
11
|
-
var contextEventKey = useContext(AccordionContext);
|
|
12
|
-
|
|
12
|
+
var contextEventKey = useContext(AccordionContext); // Empty SelectableContext is to prevent elements in the collapse
|
|
13
|
+
// from collapsing the accordion when clicked.
|
|
14
|
+
|
|
15
|
+
return /*#__PURE__*/React.createElement(SelectableContext.Provider, {
|
|
16
|
+
value: null
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Collapse, _extends({
|
|
13
18
|
ref: ref,
|
|
14
19
|
in: contextEventKey === eventKey
|
|
15
|
-
}, props), /*#__PURE__*/React.createElement("div", null, React.Children.only(children)));
|
|
20
|
+
}, props), /*#__PURE__*/React.createElement("div", null, React.Children.only(children))));
|
|
16
21
|
});
|
|
17
22
|
AccordionCollapse.displayName = 'AccordionCollapse';
|
|
18
23
|
export default AccordionCollapse;
|
package/esm/Button.js
CHANGED
|
@@ -21,7 +21,7 @@ var Button = React.forwardRef(function (_ref, ref) {
|
|
|
21
21
|
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "variant", "size", "active", "className", "block", "type", "as"]);
|
|
22
22
|
|
|
23
23
|
var prefix = useBootstrapPrefix(bsPrefix, 'btn');
|
|
24
|
-
var classes = classNames(className, prefix, active && 'active', prefix + "-" + variant, block && prefix + "-block", size && prefix + "-" + size);
|
|
24
|
+
var classes = classNames(className, prefix, active && 'active', variant && prefix + "-" + variant, block && prefix + "-block", size && prefix + "-" + size);
|
|
25
25
|
|
|
26
26
|
if (props.href) {
|
|
27
27
|
return /*#__PURE__*/React.createElement(SafeAnchor, _extends({}, props, {
|
package/esm/Carousel.js
CHANGED
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import useEventCallback from '@restart/hooks/useEventCallback';
|
|
4
4
|
import useUpdateEffect from '@restart/hooks/useUpdateEffect';
|
|
5
|
+
import useCommittedRef from '@restart/hooks/useCommittedRef';
|
|
5
6
|
import useTimeout from '@restart/hooks/useTimeout';
|
|
6
7
|
import classNames from 'classnames';
|
|
7
8
|
import transitionEnd from 'dom-helpers/transitionEnd';
|
|
@@ -11,7 +12,7 @@ import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, us
|
|
|
11
12
|
import { useUncontrolled } from 'uncontrollable';
|
|
12
13
|
import CarouselCaption from './CarouselCaption';
|
|
13
14
|
import CarouselItem from './CarouselItem';
|
|
14
|
-
import { map } from './ElementChildren';
|
|
15
|
+
import { map, forEach } from './ElementChildren';
|
|
15
16
|
import SafeAnchor from './SafeAnchor';
|
|
16
17
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
17
18
|
import triggerBrowserReflow from './triggerBrowserReflow';
|
|
@@ -202,7 +203,6 @@ function CarouselFunc(uncontrolledProps, ref) {
|
|
|
202
203
|
if (!isSliding && activeIndex !== renderedActiveIndex) {
|
|
203
204
|
if (nextDirectionRef.current) {
|
|
204
205
|
setDirection(nextDirectionRef.current);
|
|
205
|
-
nextDirectionRef.current = null;
|
|
206
206
|
} else {
|
|
207
207
|
setDirection((activeIndex || 0) > renderedActiveIndex ? 'next' : 'prev');
|
|
208
208
|
}
|
|
@@ -214,7 +214,23 @@ function CarouselFunc(uncontrolledProps, ref) {
|
|
|
214
214
|
setRenderedActiveIndex(activeIndex || 0);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
useEffect(function () {
|
|
218
|
+
if (nextDirectionRef.current) {
|
|
219
|
+
nextDirectionRef.current = null;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
var numChildren = 0;
|
|
223
|
+
var activeChildInterval; // Iterate to grab all of the children's interval values
|
|
224
|
+
// (and count them, too)
|
|
225
|
+
|
|
226
|
+
forEach(children, function (child, index) {
|
|
227
|
+
++numChildren;
|
|
228
|
+
|
|
229
|
+
if (index === activeIndex) {
|
|
230
|
+
activeChildInterval = child.props.interval;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
var activeChildIntervalRef = useCommittedRef(activeChildInterval);
|
|
218
234
|
var prev = useCallback(function (event) {
|
|
219
235
|
if (isSliding) {
|
|
220
236
|
return;
|
|
@@ -402,17 +418,19 @@ function CarouselFunc(uncontrolledProps, ref) {
|
|
|
402
418
|
var shouldPlay = interval != null && !pausedOnHover && !pausedOnTouch && !isSliding;
|
|
403
419
|
var intervalHandleRef = useRef();
|
|
404
420
|
useEffect(function () {
|
|
421
|
+
var _ref, _activeChildIntervalR;
|
|
422
|
+
|
|
405
423
|
if (!shouldPlay) {
|
|
406
424
|
return undefined;
|
|
407
425
|
}
|
|
408
426
|
|
|
409
|
-
intervalHandleRef.current = window.setInterval(document.visibilityState ? nextWhenVisible : next, interval
|
|
427
|
+
intervalHandleRef.current = window.setInterval(document.visibilityState ? nextWhenVisible : next, (_ref = (_activeChildIntervalR = activeChildIntervalRef.current) != null ? _activeChildIntervalR : interval) != null ? _ref : undefined);
|
|
410
428
|
return function () {
|
|
411
429
|
if (intervalHandleRef.current !== null) {
|
|
412
430
|
clearInterval(intervalHandleRef.current);
|
|
413
431
|
}
|
|
414
432
|
};
|
|
415
|
-
}, [shouldPlay, next, interval, nextWhenVisible]);
|
|
433
|
+
}, [shouldPlay, next, activeChildIntervalRef, interval, nextWhenVisible]);
|
|
416
434
|
var indicatorOnClicks = useMemo(function () {
|
|
417
435
|
return indicators && Array.from({
|
|
418
436
|
length: numChildren
|
package/esm/CarouselItem.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { BsPrefixPropsWithChildren, BsPrefixRefForwardingComponent } from './helpers';
|
|
2
|
+
export interface CarouselItemProps extends BsPrefixPropsWithChildren {
|
|
3
|
+
interval?: number;
|
|
4
|
+
}
|
|
5
|
+
declare type CarouselItem = BsPrefixRefForwardingComponent<'div', CarouselItemProps>;
|
|
6
|
+
declare const CarouselItem: CarouselItem;
|
|
7
|
+
export default CarouselItem;
|
package/esm/CarouselItem.js
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useBootstrapPrefix } from './ThemeProvider';
|
|
6
|
+
var CarouselItem = React.forwardRef(function (_ref, ref) {
|
|
7
|
+
var _ref$as = _ref.as,
|
|
8
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
9
|
+
bsPrefix = _ref.bsPrefix,
|
|
10
|
+
children = _ref.children,
|
|
11
|
+
className = _ref.className,
|
|
12
|
+
props = _objectWithoutPropertiesLoose(_ref, ["as", "bsPrefix", "children", "className"]);
|
|
13
|
+
|
|
14
|
+
var finalClassName = classNames(className, useBootstrapPrefix(bsPrefix, 'carousel-item'));
|
|
15
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
16
|
+
ref: ref
|
|
17
|
+
}, props, {
|
|
18
|
+
className: finalClassName
|
|
19
|
+
}), children);
|
|
20
|
+
});
|
|
21
|
+
CarouselItem.displayName = 'CarouselItem';
|
|
22
|
+
export default CarouselItem;
|
package/esm/DropdownButton.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownProps } from './Dropdown';
|
|
3
3
|
import { PropsFromToggle } from './DropdownToggle';
|
|
4
|
+
import { AlignType } from './DropdownMenu';
|
|
4
5
|
export interface DropdownButtonProps extends DropdownProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'title'>, React.PropsWithChildren<PropsFromToggle> {
|
|
5
6
|
title: React.ReactNode;
|
|
7
|
+
menuAlign?: AlignType;
|
|
6
8
|
menuRole?: string;
|
|
7
9
|
renderMenuOnMount?: boolean;
|
|
8
10
|
rootCloseEvent?: 'click' | 'mousedown';
|
package/esm/DropdownButton.js
CHANGED
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import Dropdown from './Dropdown';
|
|
6
6
|
import DropdownToggle from './DropdownToggle';
|
|
7
|
-
import DropdownMenu from './DropdownMenu';
|
|
7
|
+
import DropdownMenu, { alignPropType } from './DropdownMenu';
|
|
8
8
|
var propTypes = {
|
|
9
9
|
/**
|
|
10
10
|
* An html id attribute for the Toggle button, necessary for assistive technologies, such as screen readers.
|
|
@@ -25,6 +25,15 @@ var propTypes = {
|
|
|
25
25
|
/** Disables both Buttons */
|
|
26
26
|
disabled: PropTypes.bool,
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Aligns the dropdown menu responsively.
|
|
30
|
+
*
|
|
31
|
+
* _see [DropdownMenu](#dropdown-menu-props) for more details_
|
|
32
|
+
*
|
|
33
|
+
* @type {"left"|"right"|{ sm: "left"|"right" }|{ md: "left"|"right" }|{ lg: "left"|"right" }|{ xl: "left"|"right"} }
|
|
34
|
+
*/
|
|
35
|
+
menuAlign: alignPropType,
|
|
36
|
+
|
|
28
37
|
/** An ARIA accessible role applied to the Menu component. When set to 'menu', The dropdown */
|
|
29
38
|
menuRole: PropTypes.string,
|
|
30
39
|
|
|
@@ -34,7 +43,7 @@ var propTypes = {
|
|
|
34
43
|
/**
|
|
35
44
|
* Which event when fired outside the component will cause it to be closed.
|
|
36
45
|
*
|
|
37
|
-
* _see [DropdownMenu](#menu-props) for more details_
|
|
46
|
+
* _see [DropdownMenu](#dropdown-menu-props) for more details_
|
|
38
47
|
*/
|
|
39
48
|
rootCloseEvent: PropTypes.string,
|
|
40
49
|
|
|
@@ -63,12 +72,13 @@ var DropdownButton = React.forwardRef(function (_ref, ref) {
|
|
|
63
72
|
rootCloseEvent = _ref.rootCloseEvent,
|
|
64
73
|
variant = _ref.variant,
|
|
65
74
|
size = _ref.size,
|
|
75
|
+
menuAlign = _ref.menuAlign,
|
|
66
76
|
menuRole = _ref.menuRole,
|
|
67
77
|
renderMenuOnMount = _ref.renderMenuOnMount,
|
|
68
78
|
disabled = _ref.disabled,
|
|
69
79
|
href = _ref.href,
|
|
70
80
|
id = _ref.id,
|
|
71
|
-
props = _objectWithoutPropertiesLoose(_ref, ["title", "children", "bsPrefix", "rootCloseEvent", "variant", "size", "menuRole", "renderMenuOnMount", "disabled", "href", "id"]);
|
|
81
|
+
props = _objectWithoutPropertiesLoose(_ref, ["title", "children", "bsPrefix", "rootCloseEvent", "variant", "size", "menuAlign", "menuRole", "renderMenuOnMount", "disabled", "href", "id"]);
|
|
72
82
|
|
|
73
83
|
return /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
74
84
|
ref: ref
|
|
@@ -80,6 +90,7 @@ var DropdownButton = React.forwardRef(function (_ref, ref) {
|
|
|
80
90
|
disabled: disabled,
|
|
81
91
|
childBsPrefix: bsPrefix
|
|
82
92
|
}, title), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
93
|
+
align: menuAlign,
|
|
83
94
|
role: menuRole,
|
|
84
95
|
renderOnMount: renderMenuOnMount,
|
|
85
96
|
rootCloseEvent: rootCloseEvent
|
package/esm/DropdownItem.js
CHANGED
|
@@ -29,9 +29,10 @@ var DropdownItem = React.forwardRef(function (_ref, ref) {
|
|
|
29
29
|
var navContext = useContext(NavContext);
|
|
30
30
|
|
|
31
31
|
var _ref2 = navContext || {},
|
|
32
|
-
activeKey = _ref2.activeKey;
|
|
32
|
+
activeKey = _ref2.activeKey; // TODO: Restrict eventKey to string in v5?
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
var key = makeEventKey(eventKey, href);
|
|
35
36
|
var active = propActive == null && key != null ? makeEventKey(activeKey) === key : propActive;
|
|
36
37
|
var handleClick = useEventCallback(function (event) {
|
|
37
38
|
// SafeAnchor handles the disabled case, but we handle it here
|
package/esm/DropdownMenu.d.ts
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
1
2
|
import { UseDropdownMenuOptions } from 'react-overlays/DropdownMenu';
|
|
2
3
|
import { BsPrefixPropsWithChildren, BsPrefixRefForwardingComponent, SelectCallback } from './helpers';
|
|
4
|
+
export declare type AlignDirection = 'left' | 'right';
|
|
5
|
+
export declare type ResponsiveAlignProp = {
|
|
6
|
+
sm: AlignDirection;
|
|
7
|
+
} | {
|
|
8
|
+
md: AlignDirection;
|
|
9
|
+
} | {
|
|
10
|
+
lg: AlignDirection;
|
|
11
|
+
} | {
|
|
12
|
+
xl: AlignDirection;
|
|
13
|
+
};
|
|
14
|
+
export declare type AlignType = AlignDirection | ResponsiveAlignProp;
|
|
3
15
|
export interface DropdownMenuProps extends BsPrefixPropsWithChildren {
|
|
4
16
|
show?: boolean;
|
|
5
17
|
renderOnMount?: boolean;
|
|
6
18
|
flip?: boolean;
|
|
19
|
+
align?: AlignType;
|
|
7
20
|
alignRight?: boolean;
|
|
8
21
|
onSelect?: SelectCallback;
|
|
9
22
|
rootCloseEvent?: 'click' | 'mousedown';
|
|
10
23
|
popperConfig?: UseDropdownMenuOptions['popperConfig'];
|
|
11
24
|
}
|
|
12
25
|
declare type DropdownMenu = BsPrefixRefForwardingComponent<'div', DropdownMenuProps>;
|
|
26
|
+
export declare const alignPropType: PropTypes.Requireable<string | PropTypes.InferProps<{
|
|
27
|
+
sm: PropTypes.Requireable<string>;
|
|
28
|
+
}> | PropTypes.InferProps<{
|
|
29
|
+
md: PropTypes.Requireable<string>;
|
|
30
|
+
}> | PropTypes.InferProps<{
|
|
31
|
+
lg: PropTypes.Requireable<string>;
|
|
32
|
+
}> | PropTypes.InferProps<{
|
|
33
|
+
xl: PropTypes.Requireable<string>;
|
|
34
|
+
}>>;
|
|
13
35
|
declare const DropdownMenu: DropdownMenu;
|
|
14
36
|
export default DropdownMenu;
|
package/esm/DropdownMenu.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
4
5
|
import React, { useContext } from 'react';
|
|
5
6
|
import { useDropdownMenu } from 'react-overlays/DropdownMenu';
|
|
6
7
|
import useMergedRefs from '@restart/hooks/useMergedRefs';
|
|
8
|
+
import warning from 'warning';
|
|
7
9
|
import NavbarContext from './NavbarContext';
|
|
8
10
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
9
11
|
import useWrappedRefWithWarning from './useWrappedRefWithWarning';
|
|
10
12
|
import usePopperMarginModifiers from './usePopperMarginModifiers';
|
|
13
|
+
var alignDirection = PropTypes.oneOf(['left', 'right']);
|
|
14
|
+
export var alignPropType = PropTypes.oneOfType([alignDirection, PropTypes.shape({
|
|
15
|
+
sm: alignDirection
|
|
16
|
+
}), PropTypes.shape({
|
|
17
|
+
md: alignDirection
|
|
18
|
+
}), PropTypes.shape({
|
|
19
|
+
lg: alignDirection
|
|
20
|
+
}), PropTypes.shape({
|
|
21
|
+
xl: alignDirection
|
|
22
|
+
})]);
|
|
11
23
|
var defaultProps = {
|
|
24
|
+
align: 'left',
|
|
12
25
|
alignRight: false,
|
|
13
26
|
flip: true
|
|
14
27
|
}; // TODO: remove this hack
|
|
@@ -16,6 +29,7 @@ var defaultProps = {
|
|
|
16
29
|
var DropdownMenu = React.forwardRef(function (_ref, ref) {
|
|
17
30
|
var bsPrefix = _ref.bsPrefix,
|
|
18
31
|
className = _ref.className,
|
|
32
|
+
align = _ref.align,
|
|
19
33
|
alignRight = _ref.alignRight,
|
|
20
34
|
rootCloseEvent = _ref.rootCloseEvent,
|
|
21
35
|
flip = _ref.flip,
|
|
@@ -24,7 +38,7 @@ var DropdownMenu = React.forwardRef(function (_ref, ref) {
|
|
|
24
38
|
_ref$as = _ref.as,
|
|
25
39
|
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
26
40
|
popperConfig = _ref.popperConfig,
|
|
27
|
-
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "alignRight", "rootCloseEvent", "flip", "show", "renderOnMount", "as", "popperConfig"]);
|
|
41
|
+
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "align", "alignRight", "rootCloseEvent", "flip", "show", "renderOnMount", "as", "popperConfig"]);
|
|
28
42
|
|
|
29
43
|
var isNavbar = useContext(NavbarContext);
|
|
30
44
|
var prefix = useBootstrapPrefix(bsPrefix, 'dropdown-menu');
|
|
@@ -33,12 +47,33 @@ var DropdownMenu = React.forwardRef(function (_ref, ref) {
|
|
|
33
47
|
popperRef = _usePopperMarginModif[0],
|
|
34
48
|
marginModifiers = _usePopperMarginModif[1];
|
|
35
49
|
|
|
50
|
+
var alignClasses = [];
|
|
51
|
+
|
|
52
|
+
if (align) {
|
|
53
|
+
if (typeof align === 'object') {
|
|
54
|
+
var keys = Object.keys(align);
|
|
55
|
+
process.env.NODE_ENV !== "production" ? warning(keys.length === 1, 'There should only be 1 breakpoint when passing an object to `align`') : void 0;
|
|
56
|
+
|
|
57
|
+
if (keys.length) {
|
|
58
|
+
var brkPoint = keys[0];
|
|
59
|
+
var direction = align[brkPoint]; // .dropdown-menu-right is required for responsively aligning
|
|
60
|
+
// left in addition to align left classes.
|
|
61
|
+
// Reuse alignRight to toggle the class below.
|
|
62
|
+
|
|
63
|
+
alignRight = direction === 'left';
|
|
64
|
+
alignClasses.push(prefix + "-" + brkPoint + "-" + direction);
|
|
65
|
+
}
|
|
66
|
+
} else if (align === 'right') {
|
|
67
|
+
alignRight = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
36
71
|
var _ref2 = useDropdownMenu({
|
|
37
72
|
flip: flip,
|
|
38
73
|
rootCloseEvent: rootCloseEvent,
|
|
39
74
|
show: showProps,
|
|
40
75
|
alignEnd: alignRight,
|
|
41
|
-
usePopper: !isNavbar,
|
|
76
|
+
usePopper: !isNavbar && alignClasses.length === 0,
|
|
42
77
|
popperConfig: _extends({}, popperConfig, {
|
|
43
78
|
modifiers: marginModifiers.concat((popperConfig == null ? void 0 : popperConfig.modifiers) || [])
|
|
44
79
|
})
|
|
@@ -67,7 +102,7 @@ var DropdownMenu = React.forwardRef(function (_ref, ref) {
|
|
|
67
102
|
}
|
|
68
103
|
|
|
69
104
|
return /*#__PURE__*/React.createElement(Component, _extends({}, props, menuProps, {
|
|
70
|
-
className: classNames(className, prefix, show && 'show', alignEnd && prefix + "-right")
|
|
105
|
+
className: classNames.apply(void 0, [className, prefix, show && 'show', alignEnd && prefix + "-right"].concat(alignClasses))
|
|
71
106
|
}));
|
|
72
107
|
});
|
|
73
108
|
DropdownMenu.displayName = 'DropdownMenu';
|
package/esm/DropdownToggle.js
CHANGED
|
@@ -12,11 +12,10 @@ var DropdownToggle = React.forwardRef(function (_ref, ref) {
|
|
|
12
12
|
var bsPrefix = _ref.bsPrefix,
|
|
13
13
|
split = _ref.split,
|
|
14
14
|
className = _ref.className,
|
|
15
|
-
children = _ref.children,
|
|
16
15
|
childBsPrefix = _ref.childBsPrefix,
|
|
17
16
|
_ref$as = _ref.as,
|
|
18
17
|
Component = _ref$as === void 0 ? Button : _ref$as,
|
|
19
|
-
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "split", "className", "
|
|
18
|
+
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "split", "className", "childBsPrefix", "as"]);
|
|
20
19
|
|
|
21
20
|
var prefix = useBootstrapPrefix(bsPrefix, 'dropdown-toggle');
|
|
22
21
|
|
|
@@ -34,7 +33,7 @@ var DropdownToggle = React.forwardRef(function (_ref, ref) {
|
|
|
34
33
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
35
34
|
onClick: toggle,
|
|
36
35
|
className: classNames(className, prefix, split && prefix + "-split")
|
|
37
|
-
}, toggleProps, props)
|
|
36
|
+
}, toggleProps, props));
|
|
38
37
|
});
|
|
39
38
|
DropdownToggle.displayName = 'DropdownToggle';
|
|
40
39
|
export default DropdownToggle;
|
package/esm/Fade.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Transition
|
|
3
|
-
|
|
2
|
+
import Transition from 'react-transition-group/Transition';
|
|
3
|
+
import { TransitionCallbacks } from './helpers';
|
|
4
|
+
export interface FadeProps extends TransitionCallbacks {
|
|
5
|
+
className?: string;
|
|
4
6
|
in?: boolean;
|
|
5
7
|
mountOnEnter?: boolean;
|
|
6
8
|
unmountOnExit?: boolean;
|
|
7
9
|
appear?: boolean;
|
|
8
10
|
timeout?: number;
|
|
11
|
+
children: React.ReactElement;
|
|
9
12
|
}
|
|
10
|
-
declare const Fade: React.ForwardRefExoticComponent<
|
|
13
|
+
declare const Fade: React.ForwardRefExoticComponent<FadeProps & React.RefAttributes<Transition<any>>>;
|
|
11
14
|
export default Fade;
|
package/esm/Form.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import FormText from './FormText';
|
|
|
8
8
|
import Switch from './Switch';
|
|
9
9
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
10
10
|
declare const FormRow: BsPrefixRefForwardingComponent<"div", unknown>;
|
|
11
|
-
export interface FormProps extends React.HTMLAttributes<
|
|
11
|
+
export interface FormProps extends React.HTMLAttributes<HTMLFormElement>, BsPrefixProps {
|
|
12
12
|
inline?: boolean;
|
|
13
13
|
validated?: boolean;
|
|
14
14
|
}
|
package/esm/FormCheck.d.ts
CHANGED
|
@@ -3,12 +3,10 @@ import FormCheckInput from './FormCheckInput';
|
|
|
3
3
|
import FormCheckLabel from './FormCheckLabel';
|
|
4
4
|
import { BsPrefixPropsWithChildren, BsPrefixRefForwardingComponent } from './helpers';
|
|
5
5
|
export declare type FormCheckType = 'checkbox' | 'radio' | 'switch';
|
|
6
|
-
export interface FormCheckProps extends BsPrefixPropsWithChildren,
|
|
6
|
+
export interface FormCheckProps extends BsPrefixPropsWithChildren, React.HTMLAttributes<HTMLInputElement> {
|
|
7
7
|
bsCustomPrefix?: string;
|
|
8
|
-
id?: string;
|
|
9
8
|
inline?: boolean;
|
|
10
9
|
disabled?: boolean;
|
|
11
|
-
title?: string;
|
|
12
10
|
label?: React.ReactNode;
|
|
13
11
|
custom?: boolean;
|
|
14
12
|
type?: FormCheckType;
|
package/esm/FormCheck.js
CHANGED
|
@@ -53,7 +53,7 @@ var FormCheck = React.forwardRef(function (_ref, ref) {
|
|
|
53
53
|
custom: custom
|
|
54
54
|
};
|
|
55
55
|
}, [controlId, custom, id]);
|
|
56
|
-
var hasLabel = label != null && label !== false && !children;
|
|
56
|
+
var hasLabel = custom || label != null && label !== false && !children;
|
|
57
57
|
var input = /*#__PURE__*/React.createElement(FormCheckInput, _extends({}, props, {
|
|
58
58
|
type: type === 'switch' ? 'checkbox' : type,
|
|
59
59
|
ref: ref,
|
package/esm/FormLabel.js
CHANGED
|
@@ -25,7 +25,7 @@ var FormLabel = React.forwardRef(function (_ref, ref) {
|
|
|
25
25
|
|
|
26
26
|
bsPrefix = useBootstrapPrefix(bsPrefix, 'form-label');
|
|
27
27
|
var columnClass = 'col-form-label';
|
|
28
|
-
if (typeof column === 'string') columnClass = columnClass + "-" + column;
|
|
28
|
+
if (typeof column === 'string') columnClass = columnClass + " " + columnClass + "-" + column;
|
|
29
29
|
var classes = classNames(className, bsPrefix, srOnly && 'sr-only', column && columnClass);
|
|
30
30
|
process.env.NODE_ENV !== "production" ? warning(controlId == null || !htmlFor, '`controlId` is ignored on `<FormLabel>` when `htmlFor` is specified.') : void 0;
|
|
31
31
|
htmlFor = htmlFor || controlId;
|
package/esm/ListGroupItem.js
CHANGED
|
@@ -35,7 +35,8 @@ var ListGroupItem = React.forwardRef(function (_ref, ref) {
|
|
|
35
35
|
return /*#__PURE__*/React.createElement(AbstractNavItem, _extends({
|
|
36
36
|
ref: ref
|
|
37
37
|
}, props, {
|
|
38
|
-
|
|
38
|
+
// TODO: Restrict eventKey to string in v5?
|
|
39
|
+
eventKey: makeEventKey(eventKey, props.href) // eslint-disable-next-line no-nested-ternary
|
|
39
40
|
,
|
|
40
41
|
as: as || (action ? props.href ? 'a' : 'button' : 'div'),
|
|
41
42
|
onClick: handleClick,
|
package/esm/Modal.d.ts
CHANGED
package/esm/Modal.js
CHANGED
|
@@ -50,6 +50,7 @@ var Modal = React.forwardRef(function (_ref, ref) {
|
|
|
50
50
|
className = _ref.className,
|
|
51
51
|
style = _ref.style,
|
|
52
52
|
dialogClassName = _ref.dialogClassName,
|
|
53
|
+
contentClassName = _ref.contentClassName,
|
|
53
54
|
children = _ref.children,
|
|
54
55
|
Dialog = _ref.dialogAs,
|
|
55
56
|
ariaLabelledby = _ref['aria-labelledby'],
|
|
@@ -73,7 +74,7 @@ var Modal = React.forwardRef(function (_ref, ref) {
|
|
|
73
74
|
onExited = _ref.onExited,
|
|
74
75
|
backdropClassName = _ref.backdropClassName,
|
|
75
76
|
propsManager = _ref.manager,
|
|
76
|
-
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "style", "dialogClassName", "children", "dialogAs", "aria-labelledby", "show", "animation", "backdrop", "keyboard", "onEscapeKeyDown", "onShow", "onHide", "container", "autoFocus", "enforceFocus", "restoreFocus", "restoreFocusOptions", "onEntered", "onExit", "onExiting", "onEnter", "onEntering", "onExited", "backdropClassName", "manager"]);
|
|
77
|
+
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "style", "dialogClassName", "contentClassName", "children", "dialogAs", "aria-labelledby", "show", "animation", "backdrop", "keyboard", "onEscapeKeyDown", "onShow", "onHide", "container", "autoFocus", "enforceFocus", "restoreFocus", "restoreFocusOptions", "onEntered", "onExit", "onExiting", "onEnter", "onEntering", "onExited", "backdropClassName", "manager"]);
|
|
77
78
|
|
|
78
79
|
var _useState = useState({}),
|
|
79
80
|
modalStyle = _useState[0],
|
|
@@ -263,7 +264,8 @@ var Modal = React.forwardRef(function (_ref, ref) {
|
|
|
263
264
|
}), /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {
|
|
264
265
|
role: "document",
|
|
265
266
|
onMouseDown: handleDialogMouseDown,
|
|
266
|
-
className: dialogClassName
|
|
267
|
+
className: dialogClassName,
|
|
268
|
+
contentClassName: contentClassName
|
|
267
269
|
}), children));
|
|
268
270
|
};
|
|
269
271
|
|
package/esm/ModalDialog.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface ModalDialogProps extends React.HTMLAttributes<HTMLDivElement>,
|
|
|
4
4
|
size?: 'sm' | 'lg' | 'xl';
|
|
5
5
|
centered?: boolean;
|
|
6
6
|
scrollable?: boolean;
|
|
7
|
+
contentClassName?: string;
|
|
7
8
|
}
|
|
8
9
|
declare const ModalDialog: React.ForwardRefExoticComponent<ModalDialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
10
|
export default ModalDialog;
|
package/esm/ModalDialog.js
CHANGED
|
@@ -6,11 +6,12 @@ import { useBootstrapPrefix } from './ThemeProvider';
|
|
|
6
6
|
var ModalDialog = React.forwardRef(function (_ref, ref) {
|
|
7
7
|
var bsPrefix = _ref.bsPrefix,
|
|
8
8
|
className = _ref.className,
|
|
9
|
+
contentClassName = _ref.contentClassName,
|
|
9
10
|
centered = _ref.centered,
|
|
10
11
|
size = _ref.size,
|
|
11
12
|
children = _ref.children,
|
|
12
13
|
scrollable = _ref.scrollable,
|
|
13
|
-
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "centered", "size", "children", "scrollable"]);
|
|
14
|
+
props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "contentClassName", "centered", "size", "children", "scrollable"]);
|
|
14
15
|
|
|
15
16
|
bsPrefix = useBootstrapPrefix(bsPrefix, 'modal');
|
|
16
17
|
var dialogClass = bsPrefix + "-dialog";
|
|
@@ -18,7 +19,7 @@ var ModalDialog = React.forwardRef(function (_ref, ref) {
|
|
|
18
19
|
ref: ref,
|
|
19
20
|
className: classNames(dialogClass, className, size && bsPrefix + "-" + size, centered && dialogClass + "-centered", scrollable && dialogClass + "-scrollable")
|
|
20
21
|
}), /*#__PURE__*/React.createElement("div", {
|
|
21
|
-
className: bsPrefix + "-content"
|
|
22
|
+
className: classNames(bsPrefix + "-content", contentClassName)
|
|
22
23
|
}, children));
|
|
23
24
|
});
|
|
24
25
|
ModalDialog.displayName = 'ModalDialog';
|
package/esm/NavDropdown.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Dropdown from './Dropdown';
|
|
3
|
-
import {
|
|
4
|
-
export interface NavDropdownProps extends
|
|
2
|
+
import Dropdown, { DropdownProps } from './Dropdown';
|
|
3
|
+
import { BsPrefixRefForwardingComponent } from './helpers';
|
|
4
|
+
export interface NavDropdownProps extends DropdownProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'title'> {
|
|
5
5
|
id: string;
|
|
6
6
|
title: React.ReactNode;
|
|
7
7
|
disabled?: boolean;
|
package/esm/Overlay.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ declare namespace Overlay {
|
|
|
97
97
|
placement: PropTypes.Requireable<string>;
|
|
98
98
|
};
|
|
99
99
|
var defaultProps: {
|
|
100
|
-
transition: React.ForwardRefExoticComponent<
|
|
100
|
+
transition: React.ForwardRefExoticComponent<import("./Fade").FadeProps & React.RefAttributes<import("react-transition-group/Transition").default<any>>>;
|
|
101
101
|
rootClose: boolean;
|
|
102
102
|
show: boolean;
|
|
103
103
|
placement: string;
|
package/esm/OverlayTrigger.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface OverlayTriggerProps extends Omit<OverlayProps, 'children' | 'ta
|
|
|
27
27
|
declare function OverlayTrigger({ trigger, overlay, children, popperConfig, show: propsShow, defaultShow, onToggle, delay: propsDelay, placement, flip, ...props }: OverlayTriggerProps): JSX.Element;
|
|
28
28
|
declare namespace OverlayTrigger {
|
|
29
29
|
var propTypes: {
|
|
30
|
-
children: PropTypes.Validator<PropTypes.ReactElementLike>;
|
|
30
|
+
children: PropTypes.Validator<((...args: any[]) => any) | PropTypes.ReactElementLike>;
|
|
31
31
|
/**
|
|
32
32
|
* Specify which action or actions trigger Overlay visibility
|
|
33
33
|
*
|
package/esm/SplitButton.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonType } from './Button';
|
|
3
|
+
import { AlignType } from './DropdownMenu';
|
|
3
4
|
import { PropsFromToggle } from './DropdownToggle';
|
|
4
5
|
import { BsPrefixPropsWithChildren, BsPrefixRefForwardingComponent } from './helpers';
|
|
5
6
|
export interface SplitButtonProps extends PropsFromToggle, BsPrefixPropsWithChildren {
|
|
6
7
|
id: string | number;
|
|
8
|
+
menuAlign?: AlignType;
|
|
7
9
|
menuRole?: string;
|
|
8
10
|
onClick?: React.MouseEventHandler<this>;
|
|
9
11
|
renderMenuOnMount?: boolean;
|
package/esm/SplitButton.js
CHANGED
|
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import Button from './Button';
|
|
6
6
|
import ButtonGroup from './ButtonGroup';
|
|
7
7
|
import Dropdown from './Dropdown';
|
|
8
|
+
import { alignPropType } from './DropdownMenu';
|
|
8
9
|
var propTypes = {
|
|
9
10
|
/**
|
|
10
11
|
* An html id attribute for the Toggle button, necessary for assistive technologies, such as screen readers.
|
|
@@ -36,6 +37,15 @@ var propTypes = {
|
|
|
36
37
|
/** Disables both Buttons */
|
|
37
38
|
disabled: PropTypes.bool,
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Aligns the dropdown menu responsively.
|
|
42
|
+
*
|
|
43
|
+
* _see [DropdownMenu](#dropdown-menu-props) for more details_
|
|
44
|
+
*
|
|
45
|
+
* @type {"left"|"right"|{ sm: "left"|"right" }|{ md: "left"|"right" }|{ lg: "left"|"right" }|{ xl: "left"|"right"} }
|
|
46
|
+
*/
|
|
47
|
+
menuAlign: alignPropType,
|
|
48
|
+
|
|
39
49
|
/** An ARIA accessible role applied to the Menu component. When set to 'menu', The dropdown */
|
|
40
50
|
menuRole: PropTypes.string,
|
|
41
51
|
|
|
@@ -45,7 +55,7 @@ var propTypes = {
|
|
|
45
55
|
/**
|
|
46
56
|
* Which event when fired outside the component will cause it to be closed.
|
|
47
57
|
*
|
|
48
|
-
* _see [DropdownMenu](#menu-props) for more details_
|
|
58
|
+
* _see [DropdownMenu](#dropdown-menu-props) for more details_
|
|
49
59
|
*/
|
|
50
60
|
rootCloseEvent: PropTypes.string,
|
|
51
61
|
|
|
@@ -74,10 +84,11 @@ var SplitButton = React.forwardRef(function (_ref, ref) {
|
|
|
74
84
|
onClick = _ref.onClick,
|
|
75
85
|
href = _ref.href,
|
|
76
86
|
target = _ref.target,
|
|
87
|
+
menuAlign = _ref.menuAlign,
|
|
77
88
|
menuRole = _ref.menuRole,
|
|
78
89
|
renderMenuOnMount = _ref.renderMenuOnMount,
|
|
79
90
|
rootCloseEvent = _ref.rootCloseEvent,
|
|
80
|
-
props = _objectWithoutPropertiesLoose(_ref, ["id", "bsPrefix", "size", "variant", "title", "type", "toggleLabel", "children", "onClick", "href", "target", "menuRole", "renderMenuOnMount", "rootCloseEvent"]);
|
|
91
|
+
props = _objectWithoutPropertiesLoose(_ref, ["id", "bsPrefix", "size", "variant", "title", "type", "toggleLabel", "children", "onClick", "href", "target", "menuAlign", "menuRole", "renderMenuOnMount", "rootCloseEvent"]);
|
|
81
92
|
|
|
82
93
|
return /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
83
94
|
ref: ref
|
|
@@ -102,6 +113,7 @@ var SplitButton = React.forwardRef(function (_ref, ref) {
|
|
|
102
113
|
}, /*#__PURE__*/React.createElement("span", {
|
|
103
114
|
className: "sr-only"
|
|
104
115
|
}, toggleLabel)), /*#__PURE__*/React.createElement(Dropdown.Menu, {
|
|
116
|
+
align: menuAlign,
|
|
105
117
|
role: menuRole,
|
|
106
118
|
renderOnMount: renderMenuOnMount,
|
|
107
119
|
rootCloseEvent: rootCloseEvent
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { ButtonGroupProps } from './ButtonGroup';
|
|
1
2
|
import ToggleButton from './ToggleButton';
|
|
2
|
-
import {
|
|
3
|
-
export interface ToggleButtonRadioProps<T> extends
|
|
3
|
+
import { BsPrefixRefForwardingComponent } from './helpers';
|
|
4
|
+
export interface ToggleButtonRadioProps<T> extends Omit<ButtonGroupProps, 'toggle'> {
|
|
4
5
|
type?: 'radio';
|
|
5
6
|
name: string;
|
|
6
7
|
value?: T;
|
|
7
8
|
defaultValue?: T;
|
|
8
9
|
onChange?: (value: T, event: any) => void;
|
|
9
10
|
}
|
|
10
|
-
export interface ToggleButtonCheckboxProps<T> extends
|
|
11
|
+
export interface ToggleButtonCheckboxProps<T> extends Omit<ButtonGroupProps, 'toggle'> {
|
|
11
12
|
type: 'checkbox';
|
|
12
13
|
name?: string;
|
|
13
14
|
value?: T[];
|