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/esm/Col.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
|
|
3
|
+
import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
export function useCol({
|
|
6
6
|
as,
|
|
@@ -10,6 +10,7 @@ export function useCol({
|
|
|
10
10
|
}) {
|
|
11
11
|
bsPrefix = useBootstrapPrefix(bsPrefix, 'col');
|
|
12
12
|
const breakpoints = useBootstrapBreakpoints();
|
|
13
|
+
const minBreakpoint = useBootstrapMinBreakpoint();
|
|
13
14
|
const spans = [];
|
|
14
15
|
const classes = [];
|
|
15
16
|
breakpoints.forEach(brkPoint => {
|
|
@@ -29,7 +30,7 @@ export function useCol({
|
|
|
29
30
|
span = propValue;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
const infix = brkPoint !==
|
|
33
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
33
34
|
if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
|
|
34
35
|
if (order != null) classes.push(`order${infix}-${order}`);
|
|
35
36
|
if (offset != null) classes.push(`offset${infix}-${offset}`);
|
package/esm/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/esm/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/esm/FormCheck.js
CHANGED
|
@@ -15,6 +15,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
15
15
|
bsPrefix,
|
|
16
16
|
bsSwitchPrefix,
|
|
17
17
|
inline = false,
|
|
18
|
+
reverse = false,
|
|
18
19
|
disabled = false,
|
|
19
20
|
isValid = false,
|
|
20
21
|
isInvalid = false,
|
|
@@ -54,7 +55,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
54
55
|
value: innerFormContext,
|
|
55
56
|
children: /*#__PURE__*/_jsx("div", {
|
|
56
57
|
style: style,
|
|
57
|
-
className: classNames(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, type === 'switch' && bsSwitchPrefix),
|
|
58
|
+
className: classNames(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, reverse && `${bsPrefix}-reverse`, type === 'switch' && bsSwitchPrefix),
|
|
58
59
|
children: children || /*#__PURE__*/_jsxs(_Fragment, {
|
|
59
60
|
children: [input, hasLabel && /*#__PURE__*/_jsx(FormCheckLabel, {
|
|
60
61
|
title: title,
|
package/esm/NavbarOffcanvas.js
CHANGED
|
@@ -1,64 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
|
-
import useBreakpoint from '@restart/hooks/useBreakpoint';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { useBootstrapPrefix } from './ThemeProvider';
|
|
6
3
|
import Offcanvas from './Offcanvas';
|
|
7
4
|
import NavbarContext from './NavbarContext';
|
|
8
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef(({
|
|
10
|
-
className,
|
|
11
|
-
bsPrefix,
|
|
12
|
-
backdrop,
|
|
13
|
-
backdropClassName,
|
|
14
|
-
keyboard,
|
|
15
|
-
scroll,
|
|
16
|
-
placement,
|
|
17
|
-
autoFocus,
|
|
18
|
-
enforceFocus,
|
|
19
|
-
restoreFocus,
|
|
20
|
-
restoreFocusOptions,
|
|
21
|
-
onShow,
|
|
22
|
-
onHide,
|
|
23
|
-
onEscapeKeyDown,
|
|
24
|
-
onEnter,
|
|
25
|
-
onEntering,
|
|
26
|
-
onEntered,
|
|
27
|
-
onExit,
|
|
28
|
-
onExiting,
|
|
29
|
-
onExited,
|
|
30
|
-
...props
|
|
31
|
-
}, ref) => {
|
|
6
|
+
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
32
7
|
const context = useContext(NavbarContext);
|
|
33
|
-
|
|
34
|
-
const hasExpandProp = typeof (context == null ? void 0 : context.expand) === 'string';
|
|
35
|
-
const shouldExpand = useBreakpoint(hasExpandProp ? context.expand : 'xs', 'up');
|
|
36
|
-
return hasExpandProp && shouldExpand ? /*#__PURE__*/_jsx("div", {
|
|
37
|
-
ref: ref,
|
|
38
|
-
...props,
|
|
39
|
-
className: classNames(className, bsPrefix, `${bsPrefix}-${placement}`)
|
|
40
|
-
}) : /*#__PURE__*/_jsx(Offcanvas, {
|
|
8
|
+
return /*#__PURE__*/_jsx(Offcanvas, {
|
|
41
9
|
ref: ref,
|
|
42
10
|
show: !!(context != null && context.expanded),
|
|
43
|
-
bsPrefix: bsPrefix,
|
|
44
|
-
backdrop: backdrop,
|
|
45
|
-
backdropClassName: backdropClassName,
|
|
46
|
-
keyboard: keyboard,
|
|
47
|
-
scroll: scroll,
|
|
48
|
-
placement: placement,
|
|
49
|
-
autoFocus: autoFocus,
|
|
50
|
-
enforceFocus: enforceFocus,
|
|
51
|
-
restoreFocus: restoreFocus,
|
|
52
|
-
restoreFocusOptions: restoreFocusOptions,
|
|
53
|
-
onShow: onShow,
|
|
54
|
-
onHide: onHide,
|
|
55
|
-
onEscapeKeyDown: onEscapeKeyDown,
|
|
56
|
-
onEnter: onEnter,
|
|
57
|
-
onEntering: onEntering,
|
|
58
|
-
onEntered: onEntered,
|
|
59
|
-
onExit: onExit,
|
|
60
|
-
onExiting: onExiting,
|
|
61
|
-
onExited: onExited,
|
|
62
11
|
...props
|
|
63
12
|
});
|
|
64
13
|
});
|
package/esm/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/esm/Offcanvas.js
CHANGED
|
@@ -13,6 +13,8 @@ import OffcanvasTitle from './OffcanvasTitle';
|
|
|
13
13
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
14
14
|
import BootstrapModalManager, { getSharedManager } from './BootstrapModalManager';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
18
|
const defaultProps = {
|
|
17
19
|
show: false,
|
|
18
20
|
backdrop: true,
|
|
@@ -40,6 +42,7 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
40
42
|
children,
|
|
41
43
|
'aria-labelledby': ariaLabelledby,
|
|
42
44
|
placement,
|
|
45
|
+
responsive,
|
|
43
46
|
|
|
44
47
|
/* BaseModal props */
|
|
45
48
|
show,
|
|
@@ -106,42 +109,42 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
106
109
|
className: classNames(`${bsPrefix}-backdrop`, backdropClassName)
|
|
107
110
|
}), [backdropClassName, bsPrefix]);
|
|
108
111
|
|
|
109
|
-
const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", {
|
|
110
|
-
role: "dialog",
|
|
111
|
-
...dialogProps,
|
|
112
|
+
const renderDialog = dialogProps => /*#__PURE__*/_jsx("div", { ...dialogProps,
|
|
112
113
|
...props,
|
|
113
|
-
className: classNames(className, bsPrefix, `${bsPrefix}-${placement}`),
|
|
114
|
+
className: classNames(className, responsive ? `${bsPrefix}-${responsive}` : bsPrefix, `${bsPrefix}-${placement}`),
|
|
114
115
|
"aria-labelledby": ariaLabelledby,
|
|
115
116
|
children: children
|
|
116
117
|
});
|
|
117
118
|
|
|
118
|
-
return /*#__PURE__*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
119
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
120
|
+
children: [!show && renderDialog({}), /*#__PURE__*/_jsx(ModalContext.Provider, {
|
|
121
|
+
value: modalContext,
|
|
122
|
+
children: /*#__PURE__*/_jsx(BaseModal, {
|
|
123
|
+
show: show,
|
|
124
|
+
ref: ref,
|
|
125
|
+
backdrop: backdrop,
|
|
126
|
+
container: container,
|
|
127
|
+
keyboard: keyboard,
|
|
128
|
+
autoFocus: autoFocus,
|
|
129
|
+
enforceFocus: enforceFocus && !scroll,
|
|
130
|
+
restoreFocus: restoreFocus,
|
|
131
|
+
restoreFocusOptions: restoreFocusOptions,
|
|
132
|
+
onEscapeKeyDown: onEscapeKeyDown,
|
|
133
|
+
onShow: onShow,
|
|
134
|
+
onHide: handleHide,
|
|
135
|
+
onEnter: handleEnter,
|
|
136
|
+
onEntering: onEntering,
|
|
137
|
+
onEntered: onEntered,
|
|
138
|
+
onExit: onExit,
|
|
139
|
+
onExiting: onExiting,
|
|
140
|
+
onExited: handleExited,
|
|
141
|
+
manager: getModalManager(),
|
|
142
|
+
transition: DialogTransition,
|
|
143
|
+
backdropTransition: BackdropTransition,
|
|
144
|
+
renderBackdrop: renderBackdrop,
|
|
145
|
+
renderDialog: renderDialog
|
|
146
|
+
})
|
|
147
|
+
})]
|
|
145
148
|
});
|
|
146
149
|
});
|
|
147
150
|
Offcanvas.displayName = 'Offcanvas';
|
package/esm/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/esm/Overlay.js
CHANGED
|
@@ -2,6 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import BaseOverlay from '@restart/ui/Overlay';
|
|
5
|
+
import useCallbackRef from '@restart/hooks/useCallbackRef';
|
|
6
|
+
import useEventCallback from '@restart/hooks/useEventCallback';
|
|
7
|
+
import useIsomorphicEffect from '@restart/hooks/useIsomorphicEffect';
|
|
5
8
|
import useMergedRefs from '@restart/hooks/useMergedRefs';
|
|
6
9
|
import useOverlayOffset from './useOverlayOffset';
|
|
7
10
|
import Fade from './Fade';
|
|
@@ -34,13 +37,24 @@ const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
|
34
37
|
...outerProps
|
|
35
38
|
}, outerRef) => {
|
|
36
39
|
const popperRef = useRef({});
|
|
40
|
+
const [firstRenderedState, setFirstRenderedState] = useCallbackRef();
|
|
37
41
|
const [ref, modifiers] = useOverlayOffset(outerProps.offset);
|
|
38
42
|
const mergedRef = useMergedRefs(outerRef, ref);
|
|
39
43
|
const actualTransition = transition === true ? Fade : transition || undefined;
|
|
44
|
+
const handleFirstUpdate = useEventCallback(state => {
|
|
45
|
+
setFirstRenderedState(state);
|
|
46
|
+
popperConfig == null ? void 0 : popperConfig.onFirstUpdate == null ? void 0 : popperConfig.onFirstUpdate(state);
|
|
47
|
+
});
|
|
48
|
+
useIsomorphicEffect(() => {
|
|
49
|
+
if (firstRenderedState) {
|
|
50
|
+
popperRef.current.scheduleUpdate == null ? void 0 : popperRef.current.scheduleUpdate();
|
|
51
|
+
}
|
|
52
|
+
}, [firstRenderedState]);
|
|
40
53
|
return /*#__PURE__*/_jsx(BaseOverlay, { ...outerProps,
|
|
41
54
|
ref: mergedRef,
|
|
42
55
|
popperConfig: { ...popperConfig,
|
|
43
|
-
modifiers: modifiers.concat(popperConfig.modifiers || [])
|
|
56
|
+
modifiers: modifiers.concat(popperConfig.modifiers || []),
|
|
57
|
+
onFirstUpdate: handleFirstUpdate
|
|
44
58
|
},
|
|
45
59
|
transition: actualTransition,
|
|
46
60
|
children: (overlayProps, {
|
package/esm/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/esm/Row.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
|
|
3
|
+
import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const Row = /*#__PURE__*/React.forwardRef(({
|
|
6
6
|
bsPrefix,
|
|
@@ -11,6 +11,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
11
11
|
}, ref) => {
|
|
12
12
|
const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'row');
|
|
13
13
|
const breakpoints = useBootstrapBreakpoints();
|
|
14
|
+
const minBreakpoint = useBootstrapMinBreakpoint();
|
|
14
15
|
const sizePrefix = `${decoratedBsPrefix}-cols`;
|
|
15
16
|
const classes = [];
|
|
16
17
|
breakpoints.forEach(brkPoint => {
|
|
@@ -26,7 +27,7 @@ const Row = /*#__PURE__*/React.forwardRef(({
|
|
|
26
27
|
cols = propValue;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
const infix = brkPoint !==
|
|
30
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
30
31
|
if (cols != null) classes.push(`${sizePrefix}${infix}-${cols}`);
|
|
31
32
|
});
|
|
32
33
|
return /*#__PURE__*/_jsx(Component, {
|
package/esm/Stack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useBootstrapPrefix, useBootstrapBreakpoints } from './ThemeProvider';
|
|
3
|
+
import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
|
|
4
4
|
import createUtilityClassName, { responsivePropType } from './createUtilityClasses';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const Stack = /*#__PURE__*/React.forwardRef(({
|
|
@@ -13,11 +13,13 @@ const Stack = /*#__PURE__*/React.forwardRef(({
|
|
|
13
13
|
}, ref) => {
|
|
14
14
|
bsPrefix = useBootstrapPrefix(bsPrefix, direction === 'horizontal' ? 'hstack' : 'vstack');
|
|
15
15
|
const breakpoints = useBootstrapBreakpoints();
|
|
16
|
+
const minBreakpoint = useBootstrapMinBreakpoint();
|
|
16
17
|
return /*#__PURE__*/_jsx(Component, { ...props,
|
|
17
18
|
ref: ref,
|
|
18
19
|
className: classNames(className, bsPrefix, ...createUtilityClassName({
|
|
19
20
|
gap,
|
|
20
|
-
breakpoints
|
|
21
|
+
breakpoints,
|
|
22
|
+
minBreakpoint
|
|
21
23
|
}))
|
|
22
24
|
});
|
|
23
25
|
});
|
package/esm/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/esm/Table.js
CHANGED
|
@@ -15,7 +15,7 @@ const Table = /*#__PURE__*/React.forwardRef(({
|
|
|
15
15
|
...props
|
|
16
16
|
}, ref) => {
|
|
17
17
|
const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'table');
|
|
18
|
-
const classes = classNames(className, decoratedBsPrefix, variant && `${decoratedBsPrefix}-${variant}`, size && `${decoratedBsPrefix}-${size}`, striped && `${decoratedBsPrefix}
|
|
18
|
+
const classes = classNames(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`);
|
|
19
19
|
|
|
20
20
|
const table = /*#__PURE__*/_jsx("table", { ...props,
|
|
21
21
|
className: classes,
|
package/esm/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/esm/ThemeProvider.js
CHANGED
|
@@ -2,9 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import { useContext, useMemo } from 'react';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
5
|
+
export const DEFAULT_MIN_BREAKPOINT = 'xs';
|
|
5
6
|
const ThemeContext = /*#__PURE__*/React.createContext({
|
|
6
7
|
prefixes: {},
|
|
7
|
-
breakpoints: DEFAULT_BREAKPOINTS
|
|
8
|
+
breakpoints: DEFAULT_BREAKPOINTS,
|
|
9
|
+
minBreakpoint: DEFAULT_MIN_BREAKPOINT
|
|
8
10
|
});
|
|
9
11
|
const {
|
|
10
12
|
Consumer,
|
|
@@ -14,6 +16,7 @@ const {
|
|
|
14
16
|
function ThemeProvider({
|
|
15
17
|
prefixes = {},
|
|
16
18
|
breakpoints = DEFAULT_BREAKPOINTS,
|
|
19
|
+
minBreakpoint = DEFAULT_MIN_BREAKPOINT,
|
|
17
20
|
dir,
|
|
18
21
|
children
|
|
19
22
|
}) {
|
|
@@ -21,8 +24,9 @@ function ThemeProvider({
|
|
|
21
24
|
prefixes: { ...prefixes
|
|
22
25
|
},
|
|
23
26
|
breakpoints,
|
|
27
|
+
minBreakpoint,
|
|
24
28
|
dir
|
|
25
|
-
}), [prefixes, breakpoints, dir]);
|
|
29
|
+
}), [prefixes, breakpoints, minBreakpoint, dir]);
|
|
26
30
|
return /*#__PURE__*/_jsx(Provider, {
|
|
27
31
|
value: contextValue,
|
|
28
32
|
children: children
|
|
@@ -41,6 +45,12 @@ export function useBootstrapBreakpoints() {
|
|
|
41
45
|
} = useContext(ThemeContext);
|
|
42
46
|
return breakpoints;
|
|
43
47
|
}
|
|
48
|
+
export function useBootstrapMinBreakpoint() {
|
|
49
|
+
const {
|
|
50
|
+
minBreakpoint
|
|
51
|
+
} = useContext(ThemeContext);
|
|
52
|
+
return minBreakpoint;
|
|
53
|
+
}
|
|
44
54
|
export function useIsRTL() {
|
|
45
55
|
const {
|
|
46
56
|
dir
|
package/esm/ToggleButtonGroup.js
CHANGED
|
@@ -33,7 +33,7 @@ const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
33
33
|
const isActive = values.indexOf(inputVal) !== -1;
|
|
34
34
|
|
|
35
35
|
if (type === 'radio') {
|
|
36
|
-
if (!isActive
|
|
36
|
+
if (!isActive) onChange(inputVal, event);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
package/esm/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[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import { DEFAULT_BREAKPOINTS } from './ThemeProvider';
|
|
2
|
+
import { DEFAULT_BREAKPOINTS, DEFAULT_MIN_BREAKPOINT } from './ThemeProvider';
|
|
3
3
|
export function responsivePropType(propType) {
|
|
4
4
|
return PropTypes.oneOfType([propType, PropTypes.shape({
|
|
5
5
|
xs: propType,
|
|
@@ -10,7 +10,7 @@ export function responsivePropType(propType) {
|
|
|
10
10
|
xxl: propType
|
|
11
11
|
})]);
|
|
12
12
|
}
|
|
13
|
-
export default function createUtilityClassName(utilityValues, breakpoints = DEFAULT_BREAKPOINTS) {
|
|
13
|
+
export default function createUtilityClassName(utilityValues, breakpoints = DEFAULT_BREAKPOINTS, minBreakpoint = DEFAULT_MIN_BREAKPOINT) {
|
|
14
14
|
const classes = [];
|
|
15
15
|
Object.entries(utilityValues).forEach(([utilName, utilValue]) => {
|
|
16
16
|
if (utilValue != null) {
|
|
@@ -19,7 +19,7 @@ export default function createUtilityClassName(utilityValues, breakpoints = DEFA
|
|
|
19
19
|
const bpValue = utilValue[brkPoint];
|
|
20
20
|
|
|
21
21
|
if (bpValue != null) {
|
|
22
|
-
const infix = brkPoint !==
|
|
22
|
+
const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
|
23
23
|
classes.push(`${utilName}${infix}-${bpValue}`);
|
|
24
24
|
}
|
|
25
25
|
});
|
package/esm/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
|
+
}
|