react-bootstrap 2.0.0-beta.6 → 2.0.1
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/NavbarOffcanvas/package.json +7 -0
- package/README.md +1 -1
- package/SSRProvider/package.json +7 -0
- package/Stack/package.json +7 -0
- package/ToastFade/package.json +7 -0
- package/cjs/AbstractNav.d.ts +12 -8
- package/cjs/AbstractNavItem.d.ts +8 -3
- package/cjs/AccordionButton.js +1 -1
- package/cjs/BootstrapModalManager.js +1 -1
- package/cjs/Col.js +3 -3
- package/cjs/Collapse.js +1 -1
- package/cjs/DropdownMenu.js +1 -1
- package/cjs/ElementChildren.js +1 -1
- package/cjs/Fade.d.ts +1 -0
- package/cjs/Fade.js +2 -1
- package/cjs/Feedback.d.ts +2 -1
- package/cjs/Form.d.ts +9 -8
- package/cjs/FormCheck.d.ts +2 -0
- package/cjs/FormCheck.js +3 -2
- package/cjs/FormSelect.d.ts +1 -1
- package/cjs/Image.js +1 -1
- package/cjs/ListGroup.d.ts +1 -0
- package/cjs/ListGroup.js +2 -1
- package/cjs/ListGroupItem.js +20 -16
- package/cjs/Navbar.d.ts +2 -1
- package/cjs/Navbar.js +5 -2
- package/cjs/NavbarOffcanvas.d.ts +4 -0
- package/cjs/NavbarOffcanvas.js +31 -0
- package/cjs/Offcanvas.js +10 -2
- package/cjs/PageItem.js +1 -1
- package/cjs/SSRProvider.d.ts +4 -0
- package/cjs/SSRProvider.js +10 -0
- package/cjs/SafeAnchor.d.ts +3 -2
- package/cjs/SelectableContext.d.ts +3 -3
- package/cjs/Stack.d.ts +11 -0
- package/cjs/Stack.js +41 -0
- package/cjs/TabContext.d.ts +1 -1
- package/cjs/ThemeProvider.js +3 -2
- package/cjs/Toast.d.ts +1 -1
- package/cjs/Toast.js +2 -2
- package/cjs/ToastContext.d.ts +1 -1
- package/cjs/ToastFade.d.ts +5 -0
- package/cjs/ToastFade.js +31 -0
- package/cjs/createUtilityClasses.d.ts +12 -0
- package/cjs/createUtilityClasses.js +45 -0
- package/cjs/helpers.js +1 -1
- package/cjs/index.d.ts +4 -1
- package/cjs/index.js +9 -5
- package/cjs/types.d.ts +1 -0
- package/createUtilityClasses/package.json +7 -0
- package/dist/react-bootstrap.js +805 -622
- package/dist/react-bootstrap.min.js +1 -1
- package/esm/AbstractNav.d.ts +12 -8
- package/esm/AbstractNavItem.d.ts +8 -3
- package/esm/Col.js +2 -2
- package/esm/Collapse.js +1 -1
- package/esm/Fade.d.ts +1 -0
- package/esm/Fade.js +2 -1
- package/esm/Feedback.d.ts +2 -1
- package/esm/Form.d.ts +9 -8
- package/esm/FormCheck.d.ts +2 -0
- package/esm/FormCheck.js +3 -2
- package/esm/FormSelect.d.ts +1 -1
- package/esm/ListGroup.d.ts +1 -0
- package/esm/ListGroup.js +2 -1
- package/esm/ListGroupItem.js +18 -17
- package/esm/Navbar.d.ts +2 -1
- package/esm/Navbar.js +4 -2
- package/esm/NavbarOffcanvas.d.ts +4 -0
- package/esm/NavbarOffcanvas.js +15 -0
- package/esm/Offcanvas.js +10 -3
- package/esm/SSRProvider.d.ts +4 -0
- package/esm/SSRProvider.js +2 -0
- package/esm/SafeAnchor.d.ts +3 -2
- package/esm/SelectableContext.d.ts +3 -3
- package/esm/Stack.d.ts +11 -0
- package/esm/Stack.js +23 -0
- package/esm/TabContext.d.ts +1 -1
- package/esm/Toast.d.ts +1 -1
- package/esm/Toast.js +2 -2
- package/esm/ToastContext.d.ts +1 -1
- package/esm/ToastContext.js +1 -2
- package/esm/ToastFade.d.ts +5 -0
- package/esm/ToastFade.js +14 -0
- package/esm/createUtilityClasses.d.ts +12 -0
- package/esm/createUtilityClasses.js +32 -0
- package/esm/index.d.ts +4 -1
- package/esm/index.js +2 -1
- package/esm/types.d.ts +1 -0
- package/package.json +3 -3
- package/CardColumns/package.json +0 -7
- package/cjs/CardColumns.js +0 -13
- package/esm/CardColumns.js +0 -2
package/esm/AbstractNav.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BsPrefixRefForwardingComponent
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
activeKey?: EventKey;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BsPrefixRefForwardingComponent } from './helpers';
|
|
3
|
+
interface AbstractNavProps {
|
|
4
|
+
activeKey?: any;
|
|
6
5
|
as?: React.ElementType;
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
getControlledId?: any;
|
|
7
|
+
getControllerId?: any;
|
|
8
|
+
onKeyDown?: any;
|
|
9
|
+
onSelect?: any;
|
|
10
|
+
parentOnSelect?: any;
|
|
11
|
+
role?: string;
|
|
9
12
|
}
|
|
10
|
-
declare
|
|
13
|
+
declare type AbstractNav = BsPrefixRefForwardingComponent<'ul', AbstractNavProps>;
|
|
14
|
+
declare const AbstractNav: AbstractNav;
|
|
11
15
|
export default AbstractNav;
|
package/esm/AbstractNavItem.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { BsPrefixRefForwardingComponent } from './helpers';
|
|
3
3
|
import { EventKey } from './types';
|
|
4
|
-
|
|
4
|
+
interface AbstractNavItemProps {
|
|
5
5
|
active?: boolean;
|
|
6
6
|
as: React.ElementType;
|
|
7
|
+
className?: string;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
eventKey?: EventKey;
|
|
9
10
|
href?: string;
|
|
11
|
+
role?: string;
|
|
12
|
+
id?: string;
|
|
10
13
|
tabIndex?: number;
|
|
14
|
+
onClick?: (e: any) => void;
|
|
11
15
|
onSelect?: (navKey: string, e: any) => void;
|
|
12
16
|
}
|
|
13
|
-
declare
|
|
17
|
+
declare type AbstractNavItem = BsPrefixRefForwardingComponent<'div', AbstractNavItemProps>;
|
|
18
|
+
declare const AbstractNavItem: AbstractNavItem;
|
|
14
19
|
export default AbstractNavItem;
|
package/esm/Col.js
CHANGED
|
@@ -21,7 +21,7 @@ export function useCol({
|
|
|
21
21
|
|
|
22
22
|
if (typeof propValue === 'object' && propValue != null) {
|
|
23
23
|
({
|
|
24
|
-
span
|
|
24
|
+
span,
|
|
25
25
|
offset,
|
|
26
26
|
order
|
|
27
27
|
} = propValue);
|
|
@@ -35,7 +35,7 @@ export function useCol({
|
|
|
35
35
|
if (offset != null) classes.push(`offset${infix}-${offset}`);
|
|
36
36
|
});
|
|
37
37
|
return [{ ...props,
|
|
38
|
-
className: classNames(className, ...
|
|
38
|
+
className: classNames(className, ...spans, ...classes)
|
|
39
39
|
}, {
|
|
40
40
|
as,
|
|
41
41
|
bsPrefix,
|
package/esm/Collapse.js
CHANGED
|
@@ -82,7 +82,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(({
|
|
|
82
82
|
onExiting: handleExiting,
|
|
83
83
|
childRef: children.ref,
|
|
84
84
|
children: (state, innerProps) => /*#__PURE__*/React.cloneElement(children, { ...innerProps,
|
|
85
|
-
className: classNames(className, children.props.className, collapseStyles[state], computedDimension === 'width' && '
|
|
85
|
+
className: classNames(className, children.props.className, collapseStyles[state], computedDimension === 'width' && 'collapse-horizontal')
|
|
86
86
|
})
|
|
87
87
|
});
|
|
88
88
|
}); // @ts-ignore
|
package/esm/Fade.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface FadeProps extends TransitionCallbacks {
|
|
|
9
9
|
appear?: boolean;
|
|
10
10
|
timeout?: number;
|
|
11
11
|
children: React.ReactElement;
|
|
12
|
+
transitionClasses?: Record<string, string>;
|
|
12
13
|
}
|
|
13
14
|
declare const Fade: React.ForwardRefExoticComponent<FadeProps & React.RefAttributes<Transition<any>>>;
|
|
14
15
|
export default Fade;
|
package/esm/Fade.js
CHANGED
|
@@ -20,6 +20,7 @@ const fadeStyles = {
|
|
|
20
20
|
const Fade = /*#__PURE__*/React.forwardRef(({
|
|
21
21
|
className,
|
|
22
22
|
children,
|
|
23
|
+
transitionClasses = {},
|
|
23
24
|
...props
|
|
24
25
|
}, ref) => {
|
|
25
26
|
const handleEnter = useCallback((node, isAppearing) => {
|
|
@@ -33,7 +34,7 @@ const Fade = /*#__PURE__*/React.forwardRef(({
|
|
|
33
34
|
onEnter: handleEnter,
|
|
34
35
|
childRef: children.ref,
|
|
35
36
|
children: (status, innerProps) => /*#__PURE__*/React.cloneElement(children, { ...innerProps,
|
|
36
|
-
className: classNames('fade', className, children.props.className, fadeStyles[status])
|
|
37
|
+
className: classNames('fade', className, children.props.className, fadeStyles[status], transitionClasses[status])
|
|
37
38
|
})
|
|
38
39
|
});
|
|
39
40
|
});
|
package/esm/Feedback.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AsProp, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
|
+
export declare type FeedbackType = 'valid' | 'invalid';
|
|
3
4
|
export interface FeedbackProps extends AsProp, React.HTMLAttributes<HTMLElement> {
|
|
4
5
|
bsPrefix?: never;
|
|
5
|
-
type?:
|
|
6
|
+
type?: FeedbackType;
|
|
6
7
|
tooltip?: boolean;
|
|
7
8
|
}
|
|
8
9
|
declare const Feedback: BsPrefixRefForwardingComponent<'div', FeedbackProps>;
|
package/esm/Form.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ declare const _default: BsPrefixRefForwardingComponent<"form", FormProps> & {
|
|
|
69
69
|
results?: number | undefined;
|
|
70
70
|
security?: string | undefined;
|
|
71
71
|
unselectable?: "on" | "off" | undefined;
|
|
72
|
-
inputMode?: "
|
|
72
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
73
73
|
is?: string | undefined;
|
|
74
74
|
'aria-activedescendant'?: string | undefined;
|
|
75
75
|
'aria-atomic'?: boolean | "true" | "false" | undefined;
|
|
@@ -288,31 +288,32 @@ declare const _default: BsPrefixRefForwardingComponent<"form", FormProps> & {
|
|
|
288
288
|
list?: string | undefined;
|
|
289
289
|
inline?: boolean | undefined;
|
|
290
290
|
step?: string | number | undefined;
|
|
291
|
+
bsPrefix?: string | undefined;
|
|
291
292
|
height?: string | number | undefined;
|
|
292
293
|
width?: string | number | undefined;
|
|
293
294
|
size?: number | undefined;
|
|
294
295
|
multiple?: boolean | undefined;
|
|
295
|
-
bsPrefix?: string | undefined;
|
|
296
296
|
as?: React.ElementType<any> | undefined;
|
|
297
|
-
max?: string | number | undefined;
|
|
298
|
-
min?: string | number | undefined;
|
|
299
|
-
crossOrigin?: string | undefined;
|
|
300
297
|
autoComplete?: string | undefined;
|
|
301
298
|
alt?: string | undefined;
|
|
302
|
-
src?: string | undefined;
|
|
303
299
|
accept?: string | undefined;
|
|
304
300
|
capture?: string | boolean | undefined;
|
|
305
301
|
checked?: boolean | undefined;
|
|
306
|
-
enterKeyHint?: "search" | "next" | "enter" | "done" | "go" | "previous" | "send" | undefined;
|
|
307
302
|
maxLength?: number | undefined;
|
|
308
303
|
minLength?: number | undefined;
|
|
304
|
+
src?: string | undefined;
|
|
305
|
+
max?: string | number | undefined;
|
|
306
|
+
min?: string | number | undefined;
|
|
307
|
+
crossOrigin?: string | undefined;
|
|
308
|
+
enterKeyHint?: "search" | "next" | "enter" | "done" | "go" | "previous" | "send" | undefined;
|
|
309
309
|
readOnly?: boolean | undefined;
|
|
310
310
|
required?: boolean | undefined;
|
|
311
311
|
feedback?: React.ReactNode;
|
|
312
312
|
isValid?: boolean | undefined;
|
|
313
313
|
isInvalid?: boolean | undefined;
|
|
314
|
-
bsSwitchPrefix?: string | undefined;
|
|
315
314
|
feedbackTooltip?: boolean | undefined;
|
|
315
|
+
feedbackType?: import("./Feedback").FeedbackType | undefined;
|
|
316
|
+
bsSwitchPrefix?: string | undefined;
|
|
316
317
|
}> & {
|
|
317
318
|
Input: BsPrefixRefForwardingComponent<"input", import("./FormCheckInput").FormCheckInputProps>;
|
|
318
319
|
Label: React.ForwardRefExoticComponent<import("./FormCheckLabel").FormCheckLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
package/esm/FormCheck.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { FeedbackType } from './Feedback';
|
|
2
3
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
4
|
export declare type FormCheckType = 'checkbox' | 'radio' | 'switch';
|
|
4
5
|
export interface FormCheckProps extends BsPrefixProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
@@ -10,6 +11,7 @@ export interface FormCheckProps extends BsPrefixProps, React.InputHTMLAttributes
|
|
|
10
11
|
isInvalid?: boolean;
|
|
11
12
|
feedbackTooltip?: boolean;
|
|
12
13
|
feedback?: React.ReactNode;
|
|
14
|
+
feedbackType?: FeedbackType;
|
|
13
15
|
bsSwitchPrefix?: string;
|
|
14
16
|
}
|
|
15
17
|
declare const _default: BsPrefixRefForwardingComponent<"input", FormCheckProps> & {
|
package/esm/FormCheck.js
CHANGED
|
@@ -19,6 +19,7 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
19
19
|
isInvalid = false,
|
|
20
20
|
feedbackTooltip = false,
|
|
21
21
|
feedback,
|
|
22
|
+
feedbackType,
|
|
22
23
|
className,
|
|
23
24
|
style,
|
|
24
25
|
title = '',
|
|
@@ -57,8 +58,8 @@ const FormCheck = /*#__PURE__*/React.forwardRef(({
|
|
|
57
58
|
children: [input, hasLabel && /*#__PURE__*/_jsx(FormCheckLabel, {
|
|
58
59
|
title: title,
|
|
59
60
|
children: label
|
|
60
|
-
}),
|
|
61
|
-
type:
|
|
61
|
+
}), feedback && /*#__PURE__*/_jsx(Feedback, {
|
|
62
|
+
type: feedbackType,
|
|
62
63
|
tooltip: feedbackTooltip,
|
|
63
64
|
children: feedback
|
|
64
65
|
})]
|
package/esm/FormSelect.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BsPrefixOnlyProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
|
-
export interface FormSelectProps extends BsPrefixOnlyProps, React.
|
|
3
|
+
export interface FormSelectProps extends BsPrefixOnlyProps, Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
4
4
|
htmlSize?: number;
|
|
5
5
|
size?: 'sm' | 'lg';
|
|
6
6
|
isValid?: boolean;
|
package/esm/ListGroup.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface ListGroupProps extends BsPrefixProps, BaseNavProps {
|
|
|
5
5
|
variant?: 'flush';
|
|
6
6
|
horizontal?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
7
7
|
defaultActiveKey?: EventKey;
|
|
8
|
+
numbered?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: BsPrefixRefForwardingComponent<"div", ListGroupProps> & {
|
|
10
11
|
Item: BsPrefixRefForwardingComponent<"a", import("./ListGroupItem").ListGroupItemProps>;
|
package/esm/ListGroup.js
CHANGED
|
@@ -12,6 +12,7 @@ const ListGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
12
12
|
bsPrefix: initialBsPrefix,
|
|
13
13
|
variant,
|
|
14
14
|
horizontal,
|
|
15
|
+
numbered,
|
|
15
16
|
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
16
17
|
as = 'div',
|
|
17
18
|
...controlledProps
|
|
@@ -30,7 +31,7 @@ const ListGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
30
31
|
ref: ref,
|
|
31
32
|
...controlledProps,
|
|
32
33
|
as: as,
|
|
33
|
-
className: classNames(className, bsPrefix, variant && `${bsPrefix}-${variant}`, horizontalVariant && `${bsPrefix}-${horizontalVariant}`)
|
|
34
|
+
className: classNames(className, bsPrefix, variant && `${bsPrefix}-${variant}`, horizontalVariant && `${bsPrefix}-${horizontalVariant}`, numbered && `${bsPrefix}-numbered`)
|
|
34
35
|
});
|
|
35
36
|
});
|
|
36
37
|
ListGroup.displayName = 'ListGroup';
|
package/esm/ListGroupItem.js
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import useEventCallback from '@restart/hooks/useEventCallback';
|
|
4
|
+
import { useNavItem } from '@restart/ui/NavItem';
|
|
5
|
+
import { makeEventKey } from '@restart/ui/SelectableContext';
|
|
5
6
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
variant: undefined,
|
|
9
|
-
active: false,
|
|
10
|
-
disabled: false
|
|
11
|
-
};
|
|
12
8
|
const ListGroupItem = /*#__PURE__*/React.forwardRef(({
|
|
13
9
|
bsPrefix,
|
|
14
10
|
active,
|
|
15
11
|
disabled,
|
|
12
|
+
eventKey,
|
|
16
13
|
className,
|
|
17
14
|
variant,
|
|
18
15
|
action,
|
|
19
16
|
as,
|
|
20
|
-
onClick,
|
|
21
17
|
...props
|
|
22
18
|
}, ref) => {
|
|
23
19
|
bsPrefix = useBootstrapPrefix(bsPrefix, 'list-group-item');
|
|
24
|
-
const
|
|
20
|
+
const [navItemProps, meta] = useNavItem({
|
|
21
|
+
key: makeEventKey(eventKey, props.href),
|
|
22
|
+
active,
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
const handleClick = useEventCallback(event => {
|
|
25
26
|
if (disabled) {
|
|
26
27
|
event.preventDefault();
|
|
27
28
|
event.stopPropagation();
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
onClick
|
|
32
|
-
}
|
|
32
|
+
navItemProps.onClick(event);
|
|
33
|
+
});
|
|
33
34
|
|
|
34
35
|
if (disabled && props.tabIndex === undefined) {
|
|
35
36
|
props.tabIndex = -1;
|
|
36
37
|
props['aria-disabled'] = true;
|
|
37
|
-
}
|
|
38
|
+
} // eslint-disable-next-line no-nested-ternary
|
|
39
|
+
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
const Component = as || (action ? props.href ? 'a' : 'button' : 'div');
|
|
42
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
40
43
|
ref: ref,
|
|
41
44
|
...props,
|
|
42
|
-
|
|
43
|
-
as: as || (action ? props.href ? 'a' : 'button' : 'div'),
|
|
45
|
+
...navItemProps,
|
|
44
46
|
onClick: handleClick,
|
|
45
|
-
className: classNames(className, bsPrefix,
|
|
47
|
+
className: classNames(className, bsPrefix, meta.isActive && 'active', disabled && 'disabled', variant && `${bsPrefix}-${variant}`, action && `${bsPrefix}-action`)
|
|
46
48
|
});
|
|
47
49
|
});
|
|
48
|
-
ListGroupItem.defaultProps = defaultProps;
|
|
49
50
|
ListGroupItem.displayName = 'ListGroupItem';
|
|
50
51
|
export default ListGroupItem;
|
package/esm/Navbar.d.ts
CHANGED
|
@@ -14,8 +14,9 @@ export interface NavbarProps extends BsPrefixProps, Omit<React.HTMLAttributes<HT
|
|
|
14
14
|
}
|
|
15
15
|
declare const _default: BsPrefixRefForwardingComponent<"nav", NavbarProps> & {
|
|
16
16
|
Brand: BsPrefixRefForwardingComponent<"a", import("./NavbarBrand").NavbarBrandProps>;
|
|
17
|
-
Toggle: BsPrefixRefForwardingComponent<"button", import("./NavbarToggle").NavbarToggleProps>;
|
|
18
17
|
Collapse: React.ForwardRefExoticComponent<import("./NavbarCollapse").NavbarCollapseProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
Offcanvas: React.ForwardRefExoticComponent<Pick<import("./Offcanvas").OffcanvasProps, keyof import("./Offcanvas").OffcanvasProps> & React.RefAttributes<HTMLDivElement>>;
|
|
19
19
|
Text: BsPrefixRefForwardingComponent<"span", unknown>;
|
|
20
|
+
Toggle: BsPrefixRefForwardingComponent<"button", import("./NavbarToggle").NavbarToggleProps>;
|
|
20
21
|
};
|
|
21
22
|
export default _default;
|
package/esm/Navbar.js
CHANGED
|
@@ -7,6 +7,7 @@ import createWithBsPrefix from './createWithBsPrefix';
|
|
|
7
7
|
import NavbarBrand from './NavbarBrand';
|
|
8
8
|
import NavbarCollapse from './NavbarCollapse';
|
|
9
9
|
import NavbarToggle from './NavbarToggle';
|
|
10
|
+
import NavbarOffcanvas from './NavbarOffcanvas';
|
|
10
11
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
11
12
|
import NavbarContext from './NavbarContext';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -75,7 +76,8 @@ Navbar.defaultProps = defaultProps;
|
|
|
75
76
|
Navbar.displayName = 'Navbar';
|
|
76
77
|
export default Object.assign(Navbar, {
|
|
77
78
|
Brand: NavbarBrand,
|
|
78
|
-
Toggle: NavbarToggle,
|
|
79
79
|
Collapse: NavbarCollapse,
|
|
80
|
-
|
|
80
|
+
Offcanvas: NavbarOffcanvas,
|
|
81
|
+
Text: NavbarText,
|
|
82
|
+
Toggle: NavbarToggle
|
|
81
83
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import Offcanvas from './Offcanvas';
|
|
4
|
+
import NavbarContext from './NavbarContext';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const NavbarOffcanvas = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
7
|
+
const context = useContext(NavbarContext);
|
|
8
|
+
return /*#__PURE__*/_jsx(Offcanvas, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
show: !!(context != null && context.expanded),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
NavbarOffcanvas.displayName = 'NavbarOffcanvas';
|
|
15
|
+
export default NavbarOffcanvas;
|
package/esm/Offcanvas.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import useEventCallback from '@restart/hooks/useEventCallback';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useCallback, useMemo, useRef } from 'react';
|
|
4
|
+
import { useCallback, useContext, useMemo, useRef } from 'react';
|
|
5
5
|
import BaseModal from '@restart/ui/Modal';
|
|
6
6
|
import Fade from './Fade';
|
|
7
7
|
import OffcanvasBody from './OffcanvasBody';
|
|
8
8
|
import OffcanvasToggling from './OffcanvasToggling';
|
|
9
9
|
import ModalContext from './ModalContext';
|
|
10
|
+
import NavbarContext from './NavbarContext';
|
|
10
11
|
import OffcanvasHeader from './OffcanvasHeader';
|
|
11
12
|
import OffcanvasTitle from './OffcanvasTitle';
|
|
12
13
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
@@ -64,8 +65,14 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
64
65
|
...props
|
|
65
66
|
}, ref) => {
|
|
66
67
|
const modalManager = useRef();
|
|
67
|
-
const handleHide = useEventCallback(onHide);
|
|
68
68
|
bsPrefix = useBootstrapPrefix(bsPrefix, 'offcanvas');
|
|
69
|
+
const {
|
|
70
|
+
onToggle
|
|
71
|
+
} = useContext(NavbarContext) || {};
|
|
72
|
+
const handleHide = useEventCallback(() => {
|
|
73
|
+
onToggle == null ? void 0 : onToggle();
|
|
74
|
+
onHide == null ? void 0 : onHide();
|
|
75
|
+
});
|
|
69
76
|
const modalContext = useMemo(() => ({
|
|
70
77
|
onHide: handleHide
|
|
71
78
|
}), [handleHide]);
|
|
@@ -122,7 +129,7 @@ const Offcanvas = /*#__PURE__*/React.forwardRef(({
|
|
|
122
129
|
restoreFocusOptions: restoreFocusOptions,
|
|
123
130
|
onEscapeKeyDown: onEscapeKeyDown,
|
|
124
131
|
onShow: onShow,
|
|
125
|
-
onHide:
|
|
132
|
+
onHide: handleHide,
|
|
126
133
|
onEnter: handleEnter,
|
|
127
134
|
onEntering: onEntering,
|
|
128
135
|
onEntered: onEntered,
|
package/esm/SafeAnchor.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
3
|
export interface SafeAnchorProps extends React.HTMLAttributes<HTMLElement>, BsPrefixProps {
|
|
4
4
|
href?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
tabIndex?: number;
|
|
7
7
|
}
|
|
8
|
+
declare type SafeAnchor = BsPrefixRefForwardingComponent<'a', SafeAnchorProps>;
|
|
8
9
|
/**
|
|
9
10
|
* There are situations due to browser quirks or Bootstrap CSS where
|
|
10
11
|
* an anchor tag is needed, when semantically a button tag is the
|
|
@@ -12,5 +13,5 @@ export interface SafeAnchorProps extends React.HTMLAttributes<HTMLElement>, BsPr
|
|
|
12
13
|
* button its accessible. It also emulates input `disabled` behavior for
|
|
13
14
|
* links, which is usually desirable for Buttons, NavItems, DropdownItems, etc.
|
|
14
15
|
*/
|
|
15
|
-
declare const SafeAnchor:
|
|
16
|
+
declare const SafeAnchor: SafeAnchor;
|
|
16
17
|
export default SafeAnchor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
declare const SelectableContext: React.Context<
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type SelectableContextType = (key: string | null, event: any) => void;
|
|
3
|
+
declare const SelectableContext: React.Context<SelectableContextType | null>;
|
|
4
4
|
export declare const makeEventKey: (eventKey?: string | number | null | undefined, href?: string | null) => string | null;
|
|
5
5
|
export default SelectableContext;
|
package/esm/Stack.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
|
|
3
|
+
import { GapValue } from './types';
|
|
4
|
+
import { ResponsiveUtilityValue } from './createUtilityClasses';
|
|
5
|
+
export declare type StackDirection = 'horizontal' | 'vertical';
|
|
6
|
+
export interface StackProps extends BsPrefixProps, React.HTMLAttributes<HTMLElement> {
|
|
7
|
+
direction?: StackDirection;
|
|
8
|
+
gap?: ResponsiveUtilityValue<GapValue>;
|
|
9
|
+
}
|
|
10
|
+
declare const Stack: BsPrefixRefForwardingComponent<'span', StackProps>;
|
|
11
|
+
export default Stack;
|
package/esm/Stack.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useBootstrapPrefix } from './ThemeProvider';
|
|
4
|
+
import createUtilityClassName, { responsivePropType } from './createUtilityClasses';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const Stack = /*#__PURE__*/React.forwardRef(({
|
|
7
|
+
as: Component = 'div',
|
|
8
|
+
bsPrefix,
|
|
9
|
+
className,
|
|
10
|
+
direction,
|
|
11
|
+
gap,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) => {
|
|
14
|
+
bsPrefix = useBootstrapPrefix(bsPrefix, direction === 'horizontal' ? 'hstack' : 'vstack');
|
|
15
|
+
return /*#__PURE__*/_jsx(Component, { ...props,
|
|
16
|
+
ref: ref,
|
|
17
|
+
className: classNames(className, bsPrefix, ...createUtilityClassName({
|
|
18
|
+
gap
|
|
19
|
+
}))
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
Stack.displayName = 'Stack';
|
|
23
|
+
export default Stack;
|
package/esm/TabContext.d.ts
CHANGED
package/esm/Toast.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface ToastProps extends BsPrefixProps, React.HTMLAttributes<HTMLElem
|
|
|
6
6
|
animation?: boolean;
|
|
7
7
|
autohide?: boolean;
|
|
8
8
|
delay?: number;
|
|
9
|
-
onClose?: () => void;
|
|
9
|
+
onClose?: (e?: React.MouseEvent | React.KeyboardEvent) => void;
|
|
10
10
|
show?: boolean;
|
|
11
11
|
transition?: TransitionComponent;
|
|
12
12
|
bg?: Variant;
|
package/esm/Toast.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useEffect, useMemo, useRef, useCallback } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import useTimeout from '@restart/hooks/useTimeout';
|
|
5
|
-
import
|
|
5
|
+
import ToastFade from './ToastFade';
|
|
6
6
|
import ToastHeader from './ToastHeader';
|
|
7
7
|
import ToastBody from './ToastBody';
|
|
8
8
|
import { useBootstrapPrefix } from './ThemeProvider';
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
const Toast = /*#__PURE__*/React.forwardRef(({
|
|
12
12
|
bsPrefix,
|
|
13
13
|
className,
|
|
14
|
-
transition: Transition =
|
|
14
|
+
transition: Transition = ToastFade,
|
|
15
15
|
show = true,
|
|
16
16
|
animation = true,
|
|
17
17
|
delay = 5000,
|
package/esm/ToastContext.d.ts
CHANGED
package/esm/ToastContext.js
CHANGED
package/esm/ToastFade.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ENTERING, EXITING } from 'react-transition-group/Transition';
|
|
3
|
+
import Fade from './Fade';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const fadeStyles = {
|
|
6
|
+
[ENTERING]: 'showing',
|
|
7
|
+
[EXITING]: 'showing show'
|
|
8
|
+
};
|
|
9
|
+
const ToastFade = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/_jsx(Fade, { ...props,
|
|
10
|
+
ref: ref,
|
|
11
|
+
transitionClasses: fadeStyles
|
|
12
|
+
}));
|
|
13
|
+
ToastFade.displayName = 'ToastFade';
|
|
14
|
+
export default ToastFade;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export declare type ResponsiveUtilityValue<T> = T | {
|
|
3
|
+
xs?: T;
|
|
4
|
+
sm?: T;
|
|
5
|
+
md?: T;
|
|
6
|
+
lg?: T;
|
|
7
|
+
xl?: T;
|
|
8
|
+
xxl?: T;
|
|
9
|
+
};
|
|
10
|
+
export declare function responsivePropType(propType: any): PropTypes.Requireable<any>;
|
|
11
|
+
export declare const DEVICE_SIZES: readonly ["xxl", "xl", "lg", "md", "sm", "xs"];
|
|
12
|
+
export default function createUtilityClassName(utilityValues: Record<string, ResponsiveUtilityValue<unknown>>): string[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export function responsivePropType(propType) {
|
|
3
|
+
return PropTypes.oneOfType([propType, PropTypes.shape({
|
|
4
|
+
xs: propType,
|
|
5
|
+
sm: propType,
|
|
6
|
+
md: propType,
|
|
7
|
+
lg: propType,
|
|
8
|
+
xl: propType,
|
|
9
|
+
xxl: propType
|
|
10
|
+
})]);
|
|
11
|
+
}
|
|
12
|
+
export const DEVICE_SIZES = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
13
|
+
export default function createUtilityClassName(utilityValues) {
|
|
14
|
+
const classes = [];
|
|
15
|
+
Object.entries(utilityValues).forEach(([utilName, utilValue]) => {
|
|
16
|
+
if (utilValue != null) {
|
|
17
|
+
if (typeof utilValue === 'object') {
|
|
18
|
+
DEVICE_SIZES.forEach(brkPoint => {
|
|
19
|
+
const bpValue = utilValue[brkPoint];
|
|
20
|
+
|
|
21
|
+
if (bpValue != null) {
|
|
22
|
+
const infix = brkPoint !== 'xs' ? `-${brkPoint}` : '';
|
|
23
|
+
classes.push(`${utilName}${infix}-${bpValue}`);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
classes.push(`${utilName}-${utilValue}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return classes;
|
|
32
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export { default as ButtonToolbar } from './ButtonToolbar';
|
|
|
23
23
|
export type { ButtonToolbarProps } from './ButtonToolbar';
|
|
24
24
|
export { default as Card } from './Card';
|
|
25
25
|
export type { CardProps } from './Card';
|
|
26
|
-
export { default as CardColumns } from './CardColumns';
|
|
27
26
|
export { default as CardImg } from './CardImg';
|
|
28
27
|
export type { CardImgProps } from './CardImg';
|
|
29
28
|
export { default as CardGroup } from './CardGroup';
|
|
@@ -121,6 +120,10 @@ export { default as Spinner } from './Spinner';
|
|
|
121
120
|
export type { SpinnerProps } from './Spinner';
|
|
122
121
|
export { default as SplitButton } from './SplitButton';
|
|
123
122
|
export type { SplitButtonProps } from './SplitButton';
|
|
123
|
+
export { default as SSRProvider } from './SSRProvider';
|
|
124
|
+
export type { SSRProviderProps } from './SSRProvider';
|
|
125
|
+
export { default as Stack } from './Stack';
|
|
126
|
+
export type { StackProps } from './Stack';
|
|
124
127
|
export { default as Tab } from './Tab';
|
|
125
128
|
export type { TabProps } from './Tab';
|
|
126
129
|
export { default as TabContainer } from './TabContainer';
|
package/esm/index.js
CHANGED
|
@@ -11,7 +11,6 @@ export { default as Button } from './Button';
|
|
|
11
11
|
export { default as ButtonGroup } from './ButtonGroup';
|
|
12
12
|
export { default as ButtonToolbar } from './ButtonToolbar';
|
|
13
13
|
export { default as Card } from './Card';
|
|
14
|
-
export { default as CardColumns } from './CardColumns';
|
|
15
14
|
export { default as CardImg } from './CardImg';
|
|
16
15
|
export { default as CardGroup } from './CardGroup';
|
|
17
16
|
export { default as Carousel } from './Carousel';
|
|
@@ -66,6 +65,8 @@ export { default as Ratio } from './Ratio';
|
|
|
66
65
|
export { default as Row } from './Row';
|
|
67
66
|
export { default as Spinner } from './Spinner';
|
|
68
67
|
export { default as SplitButton } from './SplitButton';
|
|
68
|
+
export { default as SSRProvider } from './SSRProvider';
|
|
69
|
+
export { default as Stack } from './Stack';
|
|
69
70
|
export { default as Tab } from './Tab';
|
|
70
71
|
export { default as TabContainer } from './TabContainer';
|
|
71
72
|
export { default as TabContent } from './TabContent';
|