bootstrap-rn 0.3.1 → 0.3.3
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/lib/commonjs/Provider.js +3 -0
- package/lib/commonjs/Provider.js.map +1 -1
- package/lib/commonjs/components/Caret.js +1 -1
- package/lib/commonjs/components/badge/Badge.js +1 -1
- package/lib/commonjs/components/buttons/Button.js +3 -3
- package/lib/commonjs/components/close/CloseButton.js +2 -2
- package/lib/commonjs/components/dropdown/DropdownItem.js +1 -1
- package/lib/commonjs/components/dropdown/useToggleDropdown.js +1 -0
- package/lib/commonjs/components/dropdown/useToggleDropdown.js.map +1 -1
- package/lib/commonjs/components/forms/FormCheckInput.js +1 -1
- package/lib/commonjs/components/list-group/ListGroupItem.js +1 -1
- package/lib/commonjs/components/modal/Modal.js +3 -8
- package/lib/commonjs/components/modal/Modal.js.map +1 -1
- package/lib/commonjs/components/modal/useModal.js +13 -1
- package/lib/commonjs/components/modal/useModal.js.map +1 -1
- package/lib/commonjs/components/navbar/NavbarToggler.js +1 -1
- package/lib/commonjs/components/offcanvas/Offcanvas.js +1 -6
- package/lib/commonjs/components/offcanvas/Offcanvas.js.map +1 -1
- package/lib/commonjs/components/offcanvas/useOffcanvas.js +13 -1
- package/lib/commonjs/components/offcanvas/useOffcanvas.js.map +1 -1
- package/lib/commonjs/components/toasts/Toast.js +1 -1
- package/lib/commonjs/components/toasts/ToastContainer.js +1 -1
- package/lib/commonjs/hooks/useScrollbarEffects.js +48 -41
- package/lib/commonjs/hooks/useScrollbarEffects.js.map +1 -1
- package/lib/commonjs/theme/utilities.js +8 -8
- package/lib/commonjs/theme/utilities.js.map +1 -1
- package/lib/module/Provider.js +3 -0
- package/lib/module/Provider.js.map +1 -1
- package/lib/module/components/Caret.js +1 -1
- package/lib/module/components/badge/Badge.js +1 -1
- package/lib/module/components/buttons/Button.js +3 -3
- package/lib/module/components/close/CloseButton.js +2 -2
- package/lib/module/components/dropdown/DropdownItem.js +1 -1
- package/lib/module/components/dropdown/useToggleDropdown.js +1 -0
- package/lib/module/components/dropdown/useToggleDropdown.js.map +1 -1
- package/lib/module/components/forms/FormCheckInput.js +1 -1
- package/lib/module/components/list-group/ListGroupItem.js +1 -1
- package/lib/module/components/modal/Modal.js +3 -8
- package/lib/module/components/modal/Modal.js.map +1 -1
- package/lib/module/components/modal/useModal.js +13 -2
- package/lib/module/components/modal/useModal.js.map +1 -1
- package/lib/module/components/navbar/NavbarToggler.js +1 -1
- package/lib/module/components/offcanvas/Offcanvas.js +1 -6
- package/lib/module/components/offcanvas/Offcanvas.js.map +1 -1
- package/lib/module/components/offcanvas/useOffcanvas.js +13 -2
- package/lib/module/components/offcanvas/useOffcanvas.js.map +1 -1
- package/lib/module/components/toasts/Toast.js +1 -1
- package/lib/module/components/toasts/ToastContainer.js +1 -1
- package/lib/module/hooks/useScrollbarEffects.js +49 -41
- package/lib/module/hooks/useScrollbarEffects.js.map +1 -1
- package/lib/module/theme/utilities.js +8 -8
- package/lib/module/theme/utilities.js.map +1 -1
- package/package.json +69 -69
- package/src/Provider.js +63 -59
- package/src/components/Caret.js +127 -127
- package/src/components/badge/Badge.js +52 -52
- package/src/components/buttons/Button.js +381 -381
- package/src/components/close/CloseButton.js +146 -146
- package/src/components/dropdown/DropdownItem.js +151 -151
- package/src/components/dropdown/useToggleDropdown.js +1 -0
- package/src/components/forms/FormCheckInput.js +247 -247
- package/src/components/list-group/ListGroupItem.js +1 -1
- package/src/components/modal/Modal.js +235 -241
- package/src/components/modal/useModal.js +25 -10
- package/src/components/navbar/NavbarToggler.js +132 -132
- package/src/components/offcanvas/Offcanvas.js +252 -258
- package/src/components/offcanvas/useOffcanvas.js +20 -5
- package/src/components/toasts/Toast.js +1 -1
- package/src/components/toasts/ToastContainer.js +43 -43
- package/src/hooks/useScrollbarEffects.js +61 -41
- package/src/theme/utilities.js +4 -4
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import StyleSheet from '../../style/StyleSheet';
|
|
4
|
-
import css from '../../style/css';
|
|
5
|
-
import Pressable from '../Pressable';
|
|
6
|
-
import View from '../View';
|
|
7
|
-
import useForcedContext from '../../hooks/useForcedContext';
|
|
8
|
-
import { GRID_BREAKPOINTS } from '../../theme/proxies';
|
|
9
|
-
import { infix, next } from '../../theme/breakpoints';
|
|
10
|
-
import { getStyles, each } from '../../utils';
|
|
11
|
-
import NavbarContext from './NavbarContext';
|
|
12
|
-
import useMedia from '../../hooks/useMedia';
|
|
13
|
-
import useToggleNavbar from './useToggleNavbar';
|
|
14
|
-
import useStyle from '../../hooks/useStyle';
|
|
15
|
-
import useBackground from '../../hooks/useBackground';
|
|
16
|
-
import { escapeSvg } from '../../theme/functions';
|
|
17
|
-
|
|
18
|
-
const propTypes = {
|
|
19
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
20
|
-
style: PropTypes.any,
|
|
21
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
22
|
-
textStyle: PropTypes.any,
|
|
23
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
24
|
-
iconStyle: PropTypes.any,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const styles = StyleSheet.create({
|
|
28
|
-
'.navbar-toggler': css`
|
|
29
|
-
padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
|
|
30
|
-
background-color: transparent; // remove default button style
|
|
31
|
-
border: $border-width solid transparent; // remove default button style
|
|
32
|
-
border-radius: $navbar-toggler-border-radius;
|
|
33
|
-
// @include transition($navbar-toggler-transition);
|
|
34
|
-
|
|
35
|
-
&:focus {
|
|
36
|
-
@include platform(web) {
|
|
37
|
-
outline-width: 0; // outline: 0;
|
|
38
|
-
}
|
|
39
|
-
// box-shadow: 0 0 0 $navbar-toggler-focus-width;
|
|
40
|
-
}
|
|
41
|
-
`,
|
|
42
|
-
'.navbar-toggler --text': css`
|
|
43
|
-
font-size: $navbar-toggler-font-size;
|
|
44
|
-
line-height: $navbar-toggler-font-size * $line-height-base;
|
|
45
|
-
|
|
46
|
-
&:hover {
|
|
47
|
-
text-decoration: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&:focus {
|
|
51
|
-
text-decoration: none;
|
|
52
|
-
}
|
|
53
|
-
`,
|
|
54
|
-
'.navbar-toggler-icon': css`
|
|
55
|
-
// display: inline-block;
|
|
56
|
-
width: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
57
|
-
height: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
58
|
-
|
|
59
|
-
background-repeat: no-repeat;
|
|
60
|
-
background-position: center;
|
|
61
|
-
background-size: 100%;
|
|
62
|
-
`,
|
|
63
|
-
...each(GRID_BREAKPOINTS, (breakpoint) => ({
|
|
64
|
-
[`.navbar-expand${infix(next(breakpoint))} .navbar-toggler`]: css`
|
|
65
|
-
@include media-breakpoint-up(${next(breakpoint)}) {
|
|
66
|
-
display: none;
|
|
67
|
-
}
|
|
68
|
-
`,
|
|
69
|
-
})),
|
|
70
|
-
'.navbar-light .navbar-toggler': css`
|
|
71
|
-
border-color: $navbar-light-toggler-border-color;
|
|
72
|
-
`,
|
|
73
|
-
'.navbar-light .navbar-toggler --text': css`
|
|
74
|
-
color: $navbar-light-color;
|
|
75
|
-
`,
|
|
76
|
-
'.navbar-light .navbar-toggler-icon': css`
|
|
77
|
-
background-image: ${(t) => escapeSvg(t['navbar-light-toggler-icon-bg'])};
|
|
78
|
-
`,
|
|
79
|
-
'.navbar-dark .navbar-toggler': css`
|
|
80
|
-
border-color: $navbar-dark-toggler-border-color;
|
|
81
|
-
`,
|
|
82
|
-
'.navbar-dark .navbar-toggler --text': css`
|
|
83
|
-
color: $navbar-dark-color;
|
|
84
|
-
`,
|
|
85
|
-
'.navbar-dark .navbar-toggler-icon': css`
|
|
86
|
-
background-image: ${(t) => escapeSvg(t['navbar-dark-toggler-icon-bg'])};
|
|
87
|
-
`,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const NavbarToggler = React.forwardRef((props, ref) => {
|
|
91
|
-
const { style, textStyle, iconStyle, ...elementProps } = props;
|
|
92
|
-
|
|
93
|
-
const media = useMedia();
|
|
94
|
-
const { variant, expand } = useForcedContext(NavbarContext);
|
|
95
|
-
|
|
96
|
-
const classes = getStyles(styles, [
|
|
97
|
-
'.navbar-toggler',
|
|
98
|
-
`.navbar-${variant} .navbar-toggler`,
|
|
99
|
-
expand &&
|
|
100
|
-
`.navbar-expand${expand === true ? '' : `-${expand}`} .navbar-toggler`,
|
|
101
|
-
]);
|
|
102
|
-
|
|
103
|
-
const textClasses = getStyles(styles, [
|
|
104
|
-
'.navbar-toggler --text',
|
|
105
|
-
`.navbar-${variant} .navbar-toggler --text`,
|
|
106
|
-
]);
|
|
107
|
-
|
|
108
|
-
const iconClasses = getStyles(styles, [
|
|
109
|
-
'.navbar-toggler-icon',
|
|
110
|
-
`.navbar-${variant} .navbar-toggler-icon`,
|
|
111
|
-
]);
|
|
112
|
-
|
|
113
|
-
const resolveIconStyle = useStyle([iconClasses, iconStyle]);
|
|
114
|
-
const background = useBackground(resolveIconStyle({ media }));
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<Pressable
|
|
118
|
-
{...elementProps}
|
|
119
|
-
ref={ref}
|
|
120
|
-
toggle={useToggleNavbar}
|
|
121
|
-
style={[classes, style]}
|
|
122
|
-
textStyle={[textClasses, textStyle]}
|
|
123
|
-
>
|
|
124
|
-
<View style={background.style}>{background.element}</View>
|
|
125
|
-
</Pressable>
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
NavbarToggler.displayName = 'NavbarToggler';
|
|
130
|
-
NavbarToggler.propTypes = propTypes;
|
|
131
|
-
|
|
132
|
-
export default NavbarToggler;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import StyleSheet from '../../style/StyleSheet';
|
|
4
|
+
import css from '../../style/css';
|
|
5
|
+
import Pressable from '../Pressable';
|
|
6
|
+
import View from '../View';
|
|
7
|
+
import useForcedContext from '../../hooks/useForcedContext';
|
|
8
|
+
import { GRID_BREAKPOINTS } from '../../theme/proxies';
|
|
9
|
+
import { infix, next } from '../../theme/breakpoints';
|
|
10
|
+
import { getStyles, each } from '../../utils';
|
|
11
|
+
import NavbarContext from './NavbarContext';
|
|
12
|
+
import useMedia from '../../hooks/useMedia';
|
|
13
|
+
import useToggleNavbar from './useToggleNavbar';
|
|
14
|
+
import useStyle from '../../hooks/useStyle';
|
|
15
|
+
import useBackground from '../../hooks/useBackground';
|
|
16
|
+
import { escapeSvg } from '../../theme/functions';
|
|
17
|
+
|
|
18
|
+
const propTypes = {
|
|
19
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
20
|
+
style: PropTypes.any,
|
|
21
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
22
|
+
textStyle: PropTypes.any,
|
|
23
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
24
|
+
iconStyle: PropTypes.any,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
'.navbar-toggler': css`
|
|
29
|
+
padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
|
|
30
|
+
background-color: transparent; // remove default button style
|
|
31
|
+
border: $border-width solid transparent; // remove default button style
|
|
32
|
+
border-radius: $navbar-toggler-border-radius;
|
|
33
|
+
// @include transition($navbar-toggler-transition);
|
|
34
|
+
|
|
35
|
+
&:focus {
|
|
36
|
+
@include platform(web) {
|
|
37
|
+
outline-width: 0; // outline: 0;
|
|
38
|
+
}
|
|
39
|
+
// box-shadow: 0 0 0 $navbar-toggler-focus-width;
|
|
40
|
+
}
|
|
41
|
+
`,
|
|
42
|
+
'.navbar-toggler --text': css`
|
|
43
|
+
font-size: $navbar-toggler-font-size;
|
|
44
|
+
line-height: $navbar-toggler-font-size * $line-height-base;
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:focus {
|
|
51
|
+
text-decoration: none;
|
|
52
|
+
}
|
|
53
|
+
`,
|
|
54
|
+
'.navbar-toggler-icon': css`
|
|
55
|
+
// display: inline-block;
|
|
56
|
+
width: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
57
|
+
height: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
58
|
+
vertical-align: middle;
|
|
59
|
+
background-repeat: no-repeat;
|
|
60
|
+
background-position: center;
|
|
61
|
+
background-size: 100%;
|
|
62
|
+
`,
|
|
63
|
+
...each(GRID_BREAKPOINTS, (breakpoint) => ({
|
|
64
|
+
[`.navbar-expand${infix(next(breakpoint))} .navbar-toggler`]: css`
|
|
65
|
+
@include media-breakpoint-up(${next(breakpoint)}) {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
`,
|
|
69
|
+
})),
|
|
70
|
+
'.navbar-light .navbar-toggler': css`
|
|
71
|
+
border-color: $navbar-light-toggler-border-color;
|
|
72
|
+
`,
|
|
73
|
+
'.navbar-light .navbar-toggler --text': css`
|
|
74
|
+
color: $navbar-light-color;
|
|
75
|
+
`,
|
|
76
|
+
'.navbar-light .navbar-toggler-icon': css`
|
|
77
|
+
background-image: ${(t) => escapeSvg(t['navbar-light-toggler-icon-bg'])};
|
|
78
|
+
`,
|
|
79
|
+
'.navbar-dark .navbar-toggler': css`
|
|
80
|
+
border-color: $navbar-dark-toggler-border-color;
|
|
81
|
+
`,
|
|
82
|
+
'.navbar-dark .navbar-toggler --text': css`
|
|
83
|
+
color: $navbar-dark-color;
|
|
84
|
+
`,
|
|
85
|
+
'.navbar-dark .navbar-toggler-icon': css`
|
|
86
|
+
background-image: ${(t) => escapeSvg(t['navbar-dark-toggler-icon-bg'])};
|
|
87
|
+
`,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const NavbarToggler = React.forwardRef((props, ref) => {
|
|
91
|
+
const { style, textStyle, iconStyle, ...elementProps } = props;
|
|
92
|
+
|
|
93
|
+
const media = useMedia();
|
|
94
|
+
const { variant, expand } = useForcedContext(NavbarContext);
|
|
95
|
+
|
|
96
|
+
const classes = getStyles(styles, [
|
|
97
|
+
'.navbar-toggler',
|
|
98
|
+
`.navbar-${variant} .navbar-toggler`,
|
|
99
|
+
expand &&
|
|
100
|
+
`.navbar-expand${expand === true ? '' : `-${expand}`} .navbar-toggler`,
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
const textClasses = getStyles(styles, [
|
|
104
|
+
'.navbar-toggler --text',
|
|
105
|
+
`.navbar-${variant} .navbar-toggler --text`,
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
const iconClasses = getStyles(styles, [
|
|
109
|
+
'.navbar-toggler-icon',
|
|
110
|
+
`.navbar-${variant} .navbar-toggler-icon`,
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
const resolveIconStyle = useStyle([iconClasses, iconStyle]);
|
|
114
|
+
const background = useBackground(resolveIconStyle({ media }));
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Pressable
|
|
118
|
+
{...elementProps}
|
|
119
|
+
ref={ref}
|
|
120
|
+
toggle={useToggleNavbar}
|
|
121
|
+
style={[classes, style]}
|
|
122
|
+
textStyle={[textClasses, textStyle]}
|
|
123
|
+
>
|
|
124
|
+
<View style={background.style}>{background.element}</View>
|
|
125
|
+
</Pressable>
|
|
126
|
+
);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
NavbarToggler.displayName = 'NavbarToggler';
|
|
130
|
+
NavbarToggler.propTypes = propTypes;
|
|
131
|
+
|
|
132
|
+
export default NavbarToggler;
|