react-bootstrap 2.4.0 → 2.5.0-beta.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/cjs/Col.js +2 -1
- package/cjs/Form.d.ts +1 -0
- package/cjs/FormCheck.d.ts +1 -0
- package/cjs/FormCheck.js +2 -1
- package/cjs/NavbarOffcanvas.js +2 -56
- package/cjs/Offcanvas.d.ts +1 -0
- package/cjs/Offcanvas.js +32 -31
- package/cjs/Overlay.d.ts +2 -7
- package/cjs/Overlay.js +18 -1
- package/cjs/Popover.d.ts +2 -2
- package/cjs/Row.js +2 -1
- package/cjs/Stack.js +3 -1
- package/cjs/Table.d.ts +1 -1
- package/cjs/Table.js +1 -1
- package/cjs/ThemeProvider.d.ts +4 -1
- package/cjs/ThemeProvider.js +16 -3
- package/cjs/ToggleButtonGroup.js +1 -1
- package/cjs/Tooltip.d.ts +2 -2
- package/cjs/createUtilityClasses.d.ts +1 -1
- package/cjs/createUtilityClasses.js +2 -2
- package/cjs/types.d.ts +7 -0
- package/dist/react-bootstrap.js +123 -327
- package/dist/react-bootstrap.min.js +1 -1
- package/esm/Col.js +3 -2
- package/esm/Form.d.ts +1 -0
- package/esm/FormCheck.d.ts +1 -0
- package/esm/FormCheck.js +2 -1
- package/esm/NavbarOffcanvas.js +2 -53
- package/esm/Offcanvas.d.ts +1 -0
- package/esm/Offcanvas.js +34 -31
- package/esm/Overlay.d.ts +2 -7
- package/esm/Overlay.js +15 -1
- package/esm/Popover.d.ts +2 -2
- package/esm/Row.js +3 -2
- package/esm/Stack.js +4 -2
- package/esm/Table.d.ts +1 -1
- package/esm/Table.js +1 -1
- package/esm/ThemeProvider.d.ts +4 -1
- package/esm/ThemeProvider.js +12 -2
- package/esm/ToggleButtonGroup.js +1 -1
- package/esm/Tooltip.d.ts +2 -2
- package/esm/createUtilityClasses.d.ts +1 -1
- package/esm/createUtilityClasses.js +3 -3
- package/esm/types.d.ts +7 -0
- package/package.json +1 -1
package/cjs/Col.js
CHANGED
|
@@ -26,6 +26,7 @@ function useCol({
|
|
|
26
26
|
}) {
|
|
27
27
|
bsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'col');
|
|
28
28
|
const breakpoints = (0, _ThemeProvider.useBootstrapBreakpoints)();
|
|
29
|
+
const minBreakpoint = (0, _ThemeProvider.useBootstrapMinBreakpoint)();
|
|
29
30
|
const spans = [];
|
|
30
31
|
const classes = [];
|
|
31
32
|
breakpoints.forEach(brkPoint => {
|
|
@@ -45,7 +46,7 @@ function useCol({
|
|
|
45
46
|
span = propValue;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
const infix = brkPoint !==
|
|
49
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
49
50
|
if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
|
|
50
51
|
if (order != null) classes.push(`order${infix}-${order}`);
|
|
51
52
|
if (offset != null) classes.push(`offset${infix}-${offset}`);
|
package/cjs/Form.d.ts
CHANGED
|
@@ -291,6 +291,7 @@ declare const _default: BsPrefixRefForwardingComponent<"form", FormProps> & {
|
|
|
291
291
|
bsPrefix?: string | undefined;
|
|
292
292
|
height?: string | number | undefined;
|
|
293
293
|
width?: string | number | undefined;
|
|
294
|
+
reverse?: boolean | undefined;
|
|
294
295
|
size?: number | undefined;
|
|
295
296
|
multiple?: boolean | undefined;
|
|
296
297
|
as?: React.ElementType<any> | undefined;
|
package/cjs/FormCheck.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
|
4
4
|
export declare type FormCheckType = 'checkbox' | 'radio' | 'switch';
|
|
5
5
|
export interface FormCheckProps extends BsPrefixProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
6
6
|
inline?: boolean;
|
|
7
|
+
reverse?: boolean;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
label?: React.ReactNode;
|
|
9
10
|
type?: FormCheckType;
|
package/cjs/FormCheck.js
CHANGED
|
@@ -32,6 +32,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
32
32
|
bsPrefix,
|
|
33
33
|
bsSwitchPrefix,
|
|
34
34
|
inline = false,
|
|
35
|
+
reverse = false,
|
|
35
36
|
disabled = false,
|
|
36
37
|
isValid = false,
|
|
37
38
|
isInvalid = false,
|
|
@@ -69,7 +70,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
69
70
|
value: innerFormContext,
|
|
70
71
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
71
72
|
style: style,
|
|
72
|
-
className: (0, _classnames.default)(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, type === 'switch' && bsSwitchPrefix),
|
|
73
|
+
className: (0, _classnames.default)(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, reverse && `${bsPrefix}-reverse`, type === 'switch' && bsSwitchPrefix),
|
|
73
74
|
children: children || /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
74
75
|
children: [input, hasLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormCheckLabel.default, {
|
|
75
76
|
title: title,
|
package/cjs/NavbarOffcanvas.js
CHANGED
|
@@ -7,12 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var _useBreakpoint = _interopRequireDefault(require("@restart/hooks/useBreakpoint"));
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _ThemeProvider = require("./ThemeProvider");
|
|
15
|
-
|
|
16
10
|
var _Offcanvas = _interopRequireDefault(require("./Offcanvas"));
|
|
17
11
|
|
|
18
12
|
var _NavbarContext = _interopRequireDefault(require("./NavbarContext"));
|
|
@@ -23,59 +17,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
17
|
|
|
24
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
19
|
|
|
26
|
-
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef(({
|
|
27
|
-
className,
|
|
28
|
-
bsPrefix,
|
|
29
|
-
backdrop,
|
|
30
|
-
backdropClassName,
|
|
31
|
-
keyboard,
|
|
32
|
-
scroll,
|
|
33
|
-
placement,
|
|
34
|
-
autoFocus,
|
|
35
|
-
enforceFocus,
|
|
36
|
-
restoreFocus,
|
|
37
|
-
restoreFocusOptions,
|
|
38
|
-
onShow,
|
|
39
|
-
onHide,
|
|
40
|
-
onEscapeKeyDown,
|
|
41
|
-
onEnter,
|
|
42
|
-
onEntering,
|
|
43
|
-
onEntered,
|
|
44
|
-
onExit,
|
|
45
|
-
onExiting,
|
|
46
|
-
onExited,
|
|
47
|
-
...props
|
|
48
|
-
}, ref) => {
|
|
20
|
+
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
49
21
|
const context = (0, React.useContext)(_NavbarContext.default);
|
|
50
|
-
|
|
51
|
-
const hasExpandProp = typeof (context == null ? void 0 : context.expand) === 'string';
|
|
52
|
-
const shouldExpand = (0, _useBreakpoint.default)(hasExpandProp ? context.expand : 'xs', 'up');
|
|
53
|
-
return hasExpandProp && shouldExpand ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
54
|
-
ref: ref,
|
|
55
|
-
...props,
|
|
56
|
-
className: (0, _classnames.default)(className, bsPrefix, `${bsPrefix}-${placement}`)
|
|
57
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default, {
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default, {
|
|
58
23
|
ref: ref,
|
|
59
24
|
show: !!(context != null && context.expanded),
|
|
60
|
-
bsPrefix: bsPrefix,
|
|
61
|
-
backdrop: backdrop,
|
|
62
|
-
backdropClassName: backdropClassName,
|
|
63
|
-
keyboard: keyboard,
|
|
64
|
-
scroll: scroll,
|
|
65
|
-
placement: placement,
|
|
66
|
-
autoFocus: autoFocus,
|
|
67
|
-
enforceFocus: enforceFocus,
|
|
68
|
-
restoreFocus: restoreFocus,
|
|
69
|
-
restoreFocusOptions: restoreFocusOptions,
|
|
70
|
-
onShow: onShow,
|
|
71
|
-
onHide: onHide,
|
|
72
|
-
onEscapeKeyDown: onEscapeKeyDown,
|
|
73
|
-
onEnter: onEnter,
|
|
74
|
-
onEntering: onEntering,
|
|
75
|
-
onEntered: onEntered,
|
|
76
|
-
onExit: onExit,
|
|
77
|
-
onExiting: onExiting,
|
|
78
|
-
onExited: onExited,
|
|
79
25
|
...props
|
|
80
26
|
});
|
|
81
27
|
});
|
package/cjs/Offcanvas.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface OffcanvasProps extends Omit<BaseModalProps, 'role' | 'renderBac
|
|
|
7
7
|
backdropClassName?: string;
|
|
8
8
|
scroll?: boolean;
|
|
9
9
|
placement?: OffcanvasPlacement;
|
|
10
|
+
responsive?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | string;
|
|
10
11
|
}
|
|
11
12
|
declare const _default: BsPrefixRefForwardingComponent<"div", OffcanvasProps> & {
|
|
12
13
|
Body: BsPrefixRefForwardingComponent<"div", unknown>;
|
package/cjs/Offcanvas.js
CHANGED
|
@@ -64,6 +64,7 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
64
64
|
children,
|
|
65
65
|
'aria-labelledby': ariaLabelledby,
|
|
66
66
|
placement,
|
|
67
|
+
responsive,
|
|
67
68
|
|
|
68
69
|
/* BaseModal props */
|
|
69
70
|
show,
|
|
@@ -130,42 +131,42 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
130
131
|
className: (0, _classnames.default)(`${bsPrefix}-backdrop`, backdropClassName)
|
|
131
132
|
}), [backdropClassName, bsPrefix]);
|
|
132
133
|
|
|
133
|
-
const renderDialog = dialogProps => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
-
role: "dialog",
|
|
135
|
-
...dialogProps,
|
|
134
|
+
const renderDialog = dialogProps => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { ...dialogProps,
|
|
136
135
|
...props,
|
|
137
|
-
className: (0, _classnames.default)(className, bsPrefix, `${bsPrefix}-${placement}`),
|
|
136
|
+
className: (0, _classnames.default)(className, responsive ? `${bsPrefix}-${responsive}` : bsPrefix, `${bsPrefix}-${placement}`),
|
|
138
137
|
"aria-labelledby": ariaLabelledby,
|
|
139
138
|
children: children
|
|
140
139
|
});
|
|
141
140
|
|
|
142
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
141
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
142
|
+
children: [!show && renderDialog({}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalContext.default.Provider, {
|
|
143
|
+
value: modalContext,
|
|
144
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.default, {
|
|
145
|
+
show: show,
|
|
146
|
+
ref: ref,
|
|
147
|
+
backdrop: backdrop,
|
|
148
|
+
container: container,
|
|
149
|
+
keyboard: keyboard,
|
|
150
|
+
autoFocus: autoFocus,
|
|
151
|
+
enforceFocus: enforceFocus && !scroll,
|
|
152
|
+
restoreFocus: restoreFocus,
|
|
153
|
+
restoreFocusOptions: restoreFocusOptions,
|
|
154
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
155
|
+
onShow: onShow,
|
|
156
|
+
onHide: handleHide,
|
|
157
|
+
onEnter: handleEnter,
|
|
158
|
+
onEntering: onEntering,
|
|
159
|
+
onEntered: onEntered,
|
|
160
|
+
onExit: onExit,
|
|
161
|
+
onExiting: onExiting,
|
|
162
|
+
onExited: handleExited,
|
|
163
|
+
manager: getModalManager(),
|
|
164
|
+
transition: DialogTransition,
|
|
165
|
+
backdropTransition: BackdropTransition,
|
|
166
|
+
renderBackdrop: renderBackdrop,
|
|
167
|
+
renderDialog: renderDialog
|
|
168
|
+
})
|
|
169
|
+
})]
|
|
169
170
|
});
|
|
170
171
|
});
|
|
171
172
|
Offcanvas.displayName = 'Offcanvas';
|
package/cjs/Overlay.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OverlayProps as BaseOverlayProps, OverlayArrowProps } from '@restart/ui/Overlay';
|
|
3
3
|
import { TransitionType } from './helpers';
|
|
4
|
-
import { Placement, RootCloseEvent } from './types';
|
|
4
|
+
import { Placement, PopperRef, RootCloseEvent } from './types';
|
|
5
5
|
export interface OverlayInjectedProps {
|
|
6
6
|
ref: React.RefCallback<HTMLElement>;
|
|
7
7
|
style: React.CSSProperties;
|
|
@@ -9,12 +9,7 @@ export interface OverlayInjectedProps {
|
|
|
9
9
|
arrowProps: Partial<OverlayArrowProps>;
|
|
10
10
|
show: boolean;
|
|
11
11
|
placement: Placement | undefined;
|
|
12
|
-
popper:
|
|
13
|
-
state: any;
|
|
14
|
-
outOfBoundaries: boolean;
|
|
15
|
-
placement: Placement | undefined;
|
|
16
|
-
scheduleUpdate?: () => void;
|
|
17
|
-
};
|
|
12
|
+
popper: PopperRef;
|
|
18
13
|
[prop: string]: any;
|
|
19
14
|
}
|
|
20
15
|
export declare type OverlayChildren = React.ReactElement<OverlayInjectedProps> | ((injected: OverlayInjectedProps) => React.ReactNode);
|
package/cjs/Overlay.js
CHANGED
|
@@ -11,6 +11,12 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
|
|
12
12
|
var _Overlay = _interopRequireDefault(require("@restart/ui/Overlay"));
|
|
13
13
|
|
|
14
|
+
var _useCallbackRef = _interopRequireDefault(require("@restart/hooks/useCallbackRef"));
|
|
15
|
+
|
|
16
|
+
var _useEventCallback = _interopRequireDefault(require("@restart/hooks/useEventCallback"));
|
|
17
|
+
|
|
18
|
+
var _useIsomorphicEffect = _interopRequireDefault(require("@restart/hooks/useIsomorphicEffect"));
|
|
19
|
+
|
|
14
20
|
var _useMergedRefs = _interopRequireDefault(require("@restart/hooks/useMergedRefs"));
|
|
15
21
|
|
|
16
22
|
var _useOverlayOffset = _interopRequireDefault(require("./useOverlayOffset"));
|
|
@@ -52,13 +58,24 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
|
52
58
|
...outerProps
|
|
53
59
|
}, outerRef) => {
|
|
54
60
|
const popperRef = (0, React.useRef)({});
|
|
61
|
+
const [firstRenderedState, setFirstRenderedState] = (0, _useCallbackRef.default)();
|
|
55
62
|
const [ref, modifiers] = (0, _useOverlayOffset.default)(outerProps.offset);
|
|
56
63
|
const mergedRef = (0, _useMergedRefs.default)(outerRef, ref);
|
|
57
64
|
const actualTransition = transition === true ? _Fade.default : transition || undefined;
|
|
65
|
+
const handleFirstUpdate = (0, _useEventCallback.default)(state => {
|
|
66
|
+
setFirstRenderedState(state);
|
|
67
|
+
popperConfig == null ? void 0 : popperConfig.onFirstUpdate == null ? void 0 : popperConfig.onFirstUpdate(state);
|
|
68
|
+
});
|
|
69
|
+
(0, _useIsomorphicEffect.default)(() => {
|
|
70
|
+
if (firstRenderedState) {
|
|
71
|
+
popperRef.current.scheduleUpdate == null ? void 0 : popperRef.current.scheduleUpdate();
|
|
72
|
+
}
|
|
73
|
+
}, [firstRenderedState]);
|
|
58
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Overlay.default, { ...outerProps,
|
|
59
75
|
ref: mergedRef,
|
|
60
76
|
popperConfig: { ...popperConfig,
|
|
61
|
-
modifiers: modifiers.concat(popperConfig.modifiers || [])
|
|
77
|
+
modifiers: modifiers.concat(popperConfig.modifiers || []),
|
|
78
|
+
onFirstUpdate: handleFirstUpdate
|
|
62
79
|
},
|
|
63
80
|
transition: actualTransition,
|
|
64
81
|
children: (overlayProps, {
|
package/cjs/Popover.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OverlayArrowProps } from '@restart/ui/Overlay';
|
|
3
|
-
import { Placement } from './types';
|
|
3
|
+
import { Placement, PopperRef } from './types';
|
|
4
4
|
import { BsPrefixProps } from './helpers';
|
|
5
5
|
export interface PopoverProps extends React.HTMLAttributes<HTMLDivElement>, BsPrefixProps {
|
|
6
6
|
placement?: Placement;
|
|
7
7
|
title?: string;
|
|
8
8
|
arrowProps?: Partial<OverlayArrowProps>;
|
|
9
9
|
body?: boolean;
|
|
10
|
-
popper?:
|
|
10
|
+
popper?: PopperRef;
|
|
11
11
|
show?: boolean;
|
|
12
12
|
}
|
|
13
13
|
declare const _default: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<HTMLDivElement>> & {
|
package/cjs/Row.js
CHANGED
|
@@ -26,6 +26,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
26
26
|
}, ref) => {
|
|
27
27
|
const decoratedBsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'row');
|
|
28
28
|
const breakpoints = (0, _ThemeProvider.useBootstrapBreakpoints)();
|
|
29
|
+
const minBreakpoint = (0, _ThemeProvider.useBootstrapMinBreakpoint)();
|
|
29
30
|
const sizePrefix = `${decoratedBsPrefix}-cols`;
|
|
30
31
|
const classes = [];
|
|
31
32
|
breakpoints.forEach(brkPoint => {
|
|
@@ -41,7 +42,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
41
42
|
cols = propValue;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
const infix = brkPoint !==
|
|
45
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
45
46
|
if (cols != null) classes.push(`${sizePrefix}${infix}-${cols}`);
|
|
46
47
|
});
|
|
47
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
package/cjs/Stack.js
CHANGED
|
@@ -29,11 +29,13 @@ const Stack = /*#__PURE__*/React.forwardRef(({
|
|
|
29
29
|
}, ref) => {
|
|
30
30
|
bsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, direction === 'horizontal' ? 'hstack' : 'vstack');
|
|
31
31
|
const breakpoints = (0, _ThemeProvider.useBootstrapBreakpoints)();
|
|
32
|
+
const minBreakpoint = (0, _ThemeProvider.useBootstrapMinBreakpoint)();
|
|
32
33
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, { ...props,
|
|
33
34
|
ref: ref,
|
|
34
35
|
className: (0, _classnames.default)(className, bsPrefix, ...(0, _createUtilityClasses.default)({
|
|
35
36
|
gap,
|
|
36
|
-
breakpoints
|
|
37
|
+
breakpoints,
|
|
38
|
+
minBreakpoint
|
|
37
39
|
}))
|
|
38
40
|
});
|
|
39
41
|
});
|
package/cjs/Table.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BsPrefixOnlyProps } from './helpers';
|
|
3
3
|
export interface TableProps extends BsPrefixOnlyProps, React.TableHTMLAttributes<HTMLTableElement> {
|
|
4
|
-
striped?: boolean;
|
|
4
|
+
striped?: boolean | string;
|
|
5
5
|
bordered?: boolean;
|
|
6
6
|
borderless?: boolean;
|
|
7
7
|
hover?: boolean;
|
package/cjs/Table.js
CHANGED
|
@@ -30,7 +30,7 @@ const Table = /*#__PURE__*/React.forwardRef(({
|
|
|
30
30
|
...props
|
|
31
31
|
}, ref) => {
|
|
32
32
|
const decoratedBsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'table');
|
|
33
|
-
const classes = (0, _classnames.default)(className, decoratedBsPrefix, variant && `${decoratedBsPrefix}-${variant}`, size && `${decoratedBsPrefix}-${size}`, striped && `${decoratedBsPrefix}
|
|
33
|
+
const classes = (0, _classnames.default)(className, decoratedBsPrefix, variant && `${decoratedBsPrefix}-${variant}`, size && `${decoratedBsPrefix}-${size}`, striped && `${decoratedBsPrefix}-${typeof striped === 'string' ? `striped-${striped}` : 'striped'}`, bordered && `${decoratedBsPrefix}-bordered`, borderless && `${decoratedBsPrefix}-borderless`, hover && `${decoratedBsPrefix}-hover`);
|
|
34
34
|
const table = /*#__PURE__*/(0, _jsxRuntime.jsx)("table", { ...props,
|
|
35
35
|
className: classes,
|
|
36
36
|
ref: ref
|
package/cjs/ThemeProvider.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare const DEFAULT_BREAKPOINTS: string[];
|
|
3
|
+
export declare const DEFAULT_MIN_BREAKPOINT = "xs";
|
|
3
4
|
export interface ThemeContextValue {
|
|
4
5
|
prefixes: Record<string, string>;
|
|
5
6
|
breakpoints: string[];
|
|
7
|
+
minBreakpoint?: string;
|
|
6
8
|
dir?: string;
|
|
7
9
|
}
|
|
8
10
|
export interface ThemeProviderProps extends Partial<ThemeContextValue> {
|
|
9
11
|
children: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
declare const Consumer: React.Consumer<ThemeContextValue>;
|
|
12
|
-
declare function ThemeProvider({ prefixes, breakpoints, dir, children, }: ThemeProviderProps): JSX.Element;
|
|
14
|
+
declare function ThemeProvider({ prefixes, breakpoints, minBreakpoint, dir, children, }: ThemeProviderProps): JSX.Element;
|
|
13
15
|
declare namespace ThemeProvider {
|
|
14
16
|
var propTypes: any;
|
|
15
17
|
}
|
|
16
18
|
export declare function useBootstrapPrefix(prefix: string | undefined, defaultPrefix: string): string;
|
|
17
19
|
export declare function useBootstrapBreakpoints(): string[];
|
|
20
|
+
export declare function useBootstrapMinBreakpoint(): string | undefined;
|
|
18
21
|
export declare function useIsRTL(): boolean;
|
|
19
22
|
declare function createBootstrapComponent(Component: any, opts: any): React.ForwardRefExoticComponent<{
|
|
20
23
|
bsPrefix?: string | undefined;
|
package/cjs/ThemeProvider.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.ThemeConsumer = exports.DEFAULT_BREAKPOINTS = void 0;
|
|
4
|
+
exports.ThemeConsumer = exports.DEFAULT_MIN_BREAKPOINT = exports.DEFAULT_BREAKPOINTS = void 0;
|
|
5
5
|
exports.createBootstrapComponent = createBootstrapComponent;
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.useBootstrapBreakpoints = useBootstrapBreakpoints;
|
|
8
|
+
exports.useBootstrapMinBreakpoint = useBootstrapMinBreakpoint;
|
|
8
9
|
exports.useBootstrapPrefix = useBootstrapPrefix;
|
|
9
10
|
exports.useIsRTL = useIsRTL;
|
|
10
11
|
|
|
@@ -18,9 +19,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18
19
|
|
|
19
20
|
const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
20
21
|
exports.DEFAULT_BREAKPOINTS = DEFAULT_BREAKPOINTS;
|
|
22
|
+
const DEFAULT_MIN_BREAKPOINT = 'xs';
|
|
23
|
+
exports.DEFAULT_MIN_BREAKPOINT = DEFAULT_MIN_BREAKPOINT;
|
|
21
24
|
const ThemeContext = /*#__PURE__*/React.createContext({
|
|
22
25
|
prefixes: {},
|
|
23
|
-
breakpoints: DEFAULT_BREAKPOINTS
|
|
26
|
+
breakpoints: DEFAULT_BREAKPOINTS,
|
|
27
|
+
minBreakpoint: DEFAULT_MIN_BREAKPOINT
|
|
24
28
|
});
|
|
25
29
|
const {
|
|
26
30
|
Consumer,
|
|
@@ -31,6 +35,7 @@ exports.ThemeConsumer = Consumer;
|
|
|
31
35
|
function ThemeProvider({
|
|
32
36
|
prefixes = {},
|
|
33
37
|
breakpoints = DEFAULT_BREAKPOINTS,
|
|
38
|
+
minBreakpoint = DEFAULT_MIN_BREAKPOINT,
|
|
34
39
|
dir,
|
|
35
40
|
children
|
|
36
41
|
}) {
|
|
@@ -38,8 +43,9 @@ function ThemeProvider({
|
|
|
38
43
|
prefixes: { ...prefixes
|
|
39
44
|
},
|
|
40
45
|
breakpoints,
|
|
46
|
+
minBreakpoint,
|
|
41
47
|
dir
|
|
42
|
-
}), [prefixes, breakpoints, dir]);
|
|
48
|
+
}), [prefixes, breakpoints, minBreakpoint, dir]);
|
|
43
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
44
50
|
value: contextValue,
|
|
45
51
|
children: children
|
|
@@ -60,6 +66,13 @@ function useBootstrapBreakpoints() {
|
|
|
60
66
|
return breakpoints;
|
|
61
67
|
}
|
|
62
68
|
|
|
69
|
+
function useBootstrapMinBreakpoint() {
|
|
70
|
+
const {
|
|
71
|
+
minBreakpoint
|
|
72
|
+
} = (0, React.useContext)(ThemeContext);
|
|
73
|
+
return minBreakpoint;
|
|
74
|
+
}
|
|
75
|
+
|
|
63
76
|
function useIsRTL() {
|
|
64
77
|
const {
|
|
65
78
|
dir
|
package/cjs/ToggleButtonGroup.js
CHANGED
|
@@ -52,7 +52,7 @@ const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
52
52
|
const isActive = values.indexOf(inputVal) !== -1;
|
|
53
53
|
|
|
54
54
|
if (type === 'radio') {
|
|
55
|
-
if (!isActive
|
|
55
|
+
if (!isActive) onChange(inputVal, event);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
|
package/cjs/Tooltip.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OverlayArrowProps } from '@restart/ui/Overlay';
|
|
3
|
-
import { Placement } from './types';
|
|
3
|
+
import { Placement, PopperRef } from './types';
|
|
4
4
|
import { BsPrefixProps } from './helpers';
|
|
5
5
|
export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement>, BsPrefixProps {
|
|
6
6
|
placement?: Placement;
|
|
7
7
|
arrowProps?: Partial<OverlayArrowProps>;
|
|
8
8
|
show?: boolean;
|
|
9
|
-
popper?:
|
|
9
|
+
popper?: PopperRef;
|
|
10
10
|
}
|
|
11
11
|
declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
export default Tooltip;
|
|
@@ -8,4 +8,4 @@ export declare type ResponsiveUtilityValue<T> = T | {
|
|
|
8
8
|
xxl?: T;
|
|
9
9
|
};
|
|
10
10
|
export declare function responsivePropType(propType: any): PropTypes.Requireable<any>;
|
|
11
|
-
export default function createUtilityClassName(utilityValues: Record<string, ResponsiveUtilityValue<unknown>>, breakpoints?: string[]): string[];
|
|
11
|
+
export default function createUtilityClassName(utilityValues: Record<string, ResponsiveUtilityValue<unknown>>, breakpoints?: string[], minBreakpoint?: string): string[];
|
|
@@ -21,7 +21,7 @@ function responsivePropType(propType) {
|
|
|
21
21
|
})]);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function createUtilityClassName(utilityValues, breakpoints = _ThemeProvider.DEFAULT_BREAKPOINTS) {
|
|
24
|
+
function createUtilityClassName(utilityValues, breakpoints = _ThemeProvider.DEFAULT_BREAKPOINTS, minBreakpoint = _ThemeProvider.DEFAULT_MIN_BREAKPOINT) {
|
|
25
25
|
const classes = [];
|
|
26
26
|
Object.entries(utilityValues).forEach(([utilName, utilValue]) => {
|
|
27
27
|
if (utilValue != null) {
|
|
@@ -30,7 +30,7 @@ function createUtilityClassName(utilityValues, breakpoints = _ThemeProvider.DEFA
|
|
|
30
30
|
const bpValue = utilValue[brkPoint];
|
|
31
31
|
|
|
32
32
|
if (bpValue != null) {
|
|
33
|
-
const infix = brkPoint !==
|
|
33
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
34
34
|
classes.push(`${utilName}${infix}-${bpValue}`);
|
|
35
35
|
}
|
|
36
36
|
});
|
package/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { State } from '@restart/ui/usePopper';
|
|
2
3
|
export declare type Variant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string;
|
|
3
4
|
export declare type ButtonVariant = Variant | 'link' | 'outline-primary' | 'outline-secondary' | 'outline-success' | 'outline-danger' | 'outline-warning' | 'outline-info' | 'outline-dark' | 'outline-light';
|
|
4
5
|
export declare type Color = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | 'white' | 'muted';
|
|
@@ -19,3 +20,9 @@ export declare type AlignType = AlignDirection | ResponsiveAlignProp;
|
|
|
19
20
|
export declare const alignPropType: PropTypes.Requireable<object | AlignDirection>;
|
|
20
21
|
export declare type RootCloseEvent = 'click' | 'mousedown';
|
|
21
22
|
export declare type GapValue = 0 | 1 | 2 | 3 | 4 | 5;
|
|
23
|
+
export interface PopperRef {
|
|
24
|
+
state: State | undefined;
|
|
25
|
+
outOfBoundaries: boolean;
|
|
26
|
+
placement: Placement | undefined;
|
|
27
|
+
scheduleUpdate?: () => void;
|
|
28
|
+
}
|