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,62 +1,82 @@
|
|
|
1
|
-
import { useRef,
|
|
1
|
+
import { useRef, useMemo } from 'react';
|
|
2
2
|
import { Platform, findNodeHandle } from 'react-native';
|
|
3
|
-
import Context from '../Context';
|
|
4
3
|
|
|
5
4
|
const computeScrollbarWidth = () => {
|
|
6
5
|
const documentWidth = document.documentElement.clientWidth;
|
|
7
6
|
return Math.abs(window.innerWidth - documentWidth);
|
|
8
7
|
};
|
|
9
8
|
|
|
10
|
-
export default function useScrollbarEffects(
|
|
11
|
-
if (Platform.OS !== 'web'
|
|
12
|
-
return
|
|
9
|
+
export default function useScrollbarEffects(elements) {
|
|
10
|
+
if (Platform.OS !== 'web') {
|
|
11
|
+
return useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
hide() {},
|
|
14
|
+
show() {},
|
|
15
|
+
}),
|
|
16
|
+
[],
|
|
17
|
+
);
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
const
|
|
20
|
+
const state = useRef({
|
|
21
|
+
counter: 0,
|
|
22
|
+
elements: [],
|
|
23
|
+
originalWidths: [],
|
|
24
|
+
originalBodyOverflow: '',
|
|
25
|
+
});
|
|
16
26
|
|
|
17
|
-
|
|
27
|
+
return useMemo(
|
|
28
|
+
() => ({
|
|
29
|
+
hide() {
|
|
30
|
+
state.current.counter += 1;
|
|
18
31
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
32
|
+
if (state.current.counter !== 1) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
36
|
+
const rect = document.body.getBoundingClientRect();
|
|
37
|
+
const isBodyOverflowing = rect.left + rect.right < window.innerWidth;
|
|
27
38
|
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
// Set body and fixed elements padding adjustments.
|
|
40
|
+
const fixedElements = elements
|
|
41
|
+
.filter((ref) => ref.current)
|
|
42
|
+
.map((ref) => findNodeHandle(ref.current));
|
|
43
|
+
state.current.elements = [document.body, ...fixedElements];
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.map((ref) => findNodeHandle(ref.current));
|
|
35
|
-
const elements = [document.body, ...fixedElements];
|
|
45
|
+
state.current.originalWidths = state.current.elements.map(
|
|
46
|
+
(el) => el.style.width || '',
|
|
47
|
+
);
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
state.current.originalBodyOverflow = document.body.style.overflow || '';
|
|
38
50
|
|
|
39
|
-
|
|
51
|
+
if (isBodyOverflowing) {
|
|
52
|
+
const scrollbarWidth = computeScrollbarWidth();
|
|
40
53
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
54
|
+
state.current.elements.forEach((el) => {
|
|
55
|
+
// eslint-disable-next-line no-param-reassign
|
|
56
|
+
el.style.width = `calc(100% - ${scrollbarWidth}px)`;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
47
59
|
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
// Add "overflow: hidden" to body element.
|
|
61
|
+
document.body.style.overflow = 'hidden';
|
|
62
|
+
},
|
|
63
|
+
show() {
|
|
64
|
+
state.current.counter -= 1;
|
|
50
65
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// eslint-disable-next-line no-param-reassign
|
|
55
|
-
el.style.width = originalWidths[key] || '';
|
|
56
|
-
});
|
|
66
|
+
if (state.current.counter !== 0) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
// Remove "overflow: hidden" from body element.
|
|
71
|
+
document.body.style.overflow = state.current.originalBodyOverflow;
|
|
72
|
+
|
|
73
|
+
// Reset body padding adjustments.
|
|
74
|
+
state.current.elements.forEach((el, key) => {
|
|
75
|
+
// eslint-disable-next-line no-param-reassign
|
|
76
|
+
el.style.width = state.current.originalWidths[key] || '';
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
[],
|
|
81
|
+
);
|
|
62
82
|
}
|
package/src/theme/utilities.js
CHANGED
|
@@ -635,22 +635,22 @@ const utilities = {
|
|
|
635
635
|
gradient: 'var(--#{$variable-prefix}gradient))',
|
|
636
636
|
},
|
|
637
637
|
}, */
|
|
638
|
-
|
|
638
|
+
userSelect: {
|
|
639
639
|
property: 'user-select',
|
|
640
640
|
values: {
|
|
641
641
|
all: 'all',
|
|
642
642
|
auto: 'auto',
|
|
643
643
|
none: 'none',
|
|
644
644
|
},
|
|
645
|
-
},
|
|
646
|
-
|
|
645
|
+
},
|
|
646
|
+
pointerEvents: {
|
|
647
647
|
property: 'pointer-events',
|
|
648
648
|
class: 'pe',
|
|
649
649
|
values: {
|
|
650
650
|
none: 'none',
|
|
651
651
|
auto: 'auto',
|
|
652
652
|
},
|
|
653
|
-
},
|
|
653
|
+
},
|
|
654
654
|
rounded: {
|
|
655
655
|
property: 'border-radius',
|
|
656
656
|
class: 'rounded',
|