@jobber/components-native 0.98.5 → 0.100.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/dist/package.json +3 -6
- package/dist/src/AtlantisOverlayProvider/AtlantisOverlayProvider.js +5 -0
- package/dist/src/AtlantisOverlayProvider/index.js +1 -0
- package/dist/src/BottomSheet/BottomSheet.js +9 -11
- package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +2 -2
- package/dist/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.js +9 -11
- package/dist/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.js +19 -0
- package/dist/src/ContentOverlay/ContentOverlay.js +143 -107
- package/dist/src/ContentOverlay/ContentOverlay.style.js +8 -12
- package/dist/src/ContentOverlay/computeContentOverlayBehavior.js +76 -0
- package/dist/src/ContentOverlay/constants.js +1 -0
- package/dist/src/ContentOverlay/hooks/useBottomSheetModalBackHandler.js +25 -0
- package/dist/src/ContentOverlay/index.js +1 -1
- package/dist/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.js +7 -9
- package/dist/src/InputText/InputText.js +44 -1
- package/dist/src/index.js +1 -0
- package/dist/src/utils/meta/meta.json +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/AtlantisOverlayProvider/AtlantisOverlayProvider.d.ts +6 -0
- package/dist/types/src/AtlantisOverlayProvider/index.d.ts +1 -0
- package/dist/types/src/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +3 -3
- package/dist/types/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.d.ts +11 -0
- package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +2 -5
- package/dist/types/src/ContentOverlay/ContentOverlay.style.d.ts +11 -10
- package/dist/types/src/ContentOverlay/computeContentOverlayBehavior.d.ts +32 -0
- package/dist/types/src/ContentOverlay/constants.d.ts +1 -0
- package/dist/types/src/ContentOverlay/hooks/useBottomSheetModalBackHandler.d.ts +7 -0
- package/dist/types/src/ContentOverlay/index.d.ts +1 -1
- package/dist/types/src/ContentOverlay/types.d.ts +5 -12
- package/dist/types/src/index.d.ts +1 -0
- package/jestSetup.js +2 -0
- package/package.json +3 -6
- package/src/AtlantisOverlayProvider/AtlantisOverlayProvider.tsx +12 -0
- package/src/AtlantisOverlayProvider/index.ts +1 -0
- package/src/BottomSheet/BottomSheet.tsx +13 -13
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.test.ts +10 -10
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.ts +4 -4
- package/src/ButtonGroup/ButtonGroup.stories.tsx +10 -8
- package/src/ButtonGroup/ButtonGroup.test.tsx +7 -10
- package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +26 -29
- package/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.tsx +36 -0
- package/src/ContentOverlay/ContentOverlay.stories.tsx +32 -36
- package/src/ContentOverlay/ContentOverlay.style.ts +12 -12
- package/src/ContentOverlay/ContentOverlay.test.tsx +157 -79
- package/src/ContentOverlay/ContentOverlay.tsx +247 -205
- package/src/ContentOverlay/computeContentOverlayBehavior.test.ts +276 -0
- package/src/ContentOverlay/computeContentOverlayBehavior.ts +119 -0
- package/src/ContentOverlay/constants.ts +1 -0
- package/src/ContentOverlay/hooks/useBottomSheetModalBackHandler.test.ts +81 -0
- package/src/ContentOverlay/hooks/useBottomSheetModalBackHandler.ts +36 -0
- package/src/ContentOverlay/index.ts +4 -1
- package/src/ContentOverlay/types.ts +5 -13
- package/src/Form/Form.stories.tsx +8 -4
- package/src/Form/Form.test.tsx +51 -54
- package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +7 -10
- package/src/FormatFile/FormatFile.stories.tsx +3 -4
- package/src/FormatFile/FormatFile.test.tsx +11 -14
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +6 -9
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +21 -24
- package/src/InputDate/InputDate.test.tsx +5 -8
- package/src/InputText/InputText.test.tsx +122 -0
- package/src/InputText/InputText.tsx +62 -2
- package/src/InputTime/InputTime.stories.tsx +8 -4
- package/src/InputTime/InputTime.test.tsx +5 -8
- package/src/ThumbnailList/ThumbnailList.stories.tsx +6 -4
- package/src/ThumbnailList/ThumbnailList.test.tsx +5 -8
- package/src/ThumbnailList/__snapshots__/ThumbnailList.test.tsx.snap +101 -150
- package/src/index.ts +1 -0
- package/src/utils/meta/meta.json +2 -1
- package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +0 -23
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +0 -3
- package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +0 -41
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { fireEvent, render, screen } from "@testing-library/react-native";
|
|
3
|
-
import { Host } from "react-native-portalize";
|
|
4
3
|
import { ThumbnailList } from "./ThumbnailList";
|
|
5
4
|
import type { File } from "../FormatFile/types";
|
|
6
5
|
|
|
@@ -46,13 +45,11 @@ const mockCreateThumbnail = jest.fn(async () => ({
|
|
|
46
45
|
|
|
47
46
|
function setup(snapshot?: boolean) {
|
|
48
47
|
return render(
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/>
|
|
55
|
-
</Host>,
|
|
48
|
+
<ThumbnailList
|
|
49
|
+
files={snapshot ? snapshotFile : files}
|
|
50
|
+
handleOpenFile={onOpenFile}
|
|
51
|
+
createThumbnail={mockCreateThumbnail}
|
|
52
|
+
/>,
|
|
56
53
|
);
|
|
57
54
|
}
|
|
58
55
|
|
|
@@ -1,185 +1,136 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`renders a thumbnail component with attachments 1`] = `
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
[
|
|
7
|
+
{
|
|
8
|
+
"display": "flex",
|
|
9
|
+
"flexDirection": "row",
|
|
10
|
+
"flexWrap": "wrap",
|
|
11
|
+
"marginTop": 4,
|
|
12
|
+
"maxHeight": 136,
|
|
13
|
+
"overflow": "hidden",
|
|
14
|
+
},
|
|
15
|
+
false,
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
>
|
|
19
|
+
<View>
|
|
17
20
|
<View
|
|
21
|
+
accessibilityHint="Select for more options"
|
|
22
|
+
accessibilityRole="imagebutton"
|
|
23
|
+
accessibilityState={
|
|
24
|
+
{
|
|
25
|
+
"busy": undefined,
|
|
26
|
+
"checked": undefined,
|
|
27
|
+
"disabled": undefined,
|
|
28
|
+
"expanded": undefined,
|
|
29
|
+
"selected": undefined,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
accessibilityValue={
|
|
33
|
+
{
|
|
34
|
+
"max": undefined,
|
|
35
|
+
"min": undefined,
|
|
36
|
+
"now": undefined,
|
|
37
|
+
"text": undefined,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
accessible={true}
|
|
41
|
+
collapsable={false}
|
|
42
|
+
focusable={true}
|
|
43
|
+
onClick={[Function]}
|
|
44
|
+
onResponderGrant={[Function]}
|
|
45
|
+
onResponderMove={[Function]}
|
|
46
|
+
onResponderRelease={[Function]}
|
|
47
|
+
onResponderTerminate={[Function]}
|
|
48
|
+
onResponderTerminationRequest={[Function]}
|
|
49
|
+
onStartShouldSetResponder={[Function]}
|
|
18
50
|
style={
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"flexDirection": "row",
|
|
23
|
-
"flexWrap": "wrap",
|
|
24
|
-
"marginTop": 4,
|
|
25
|
-
"maxHeight": 136,
|
|
26
|
-
"overflow": "hidden",
|
|
27
|
-
},
|
|
28
|
-
false,
|
|
29
|
-
]
|
|
51
|
+
{
|
|
52
|
+
"opacity": 1,
|
|
53
|
+
}
|
|
30
54
|
}
|
|
31
55
|
>
|
|
32
|
-
<View
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
accessibilityRole="imagebutton"
|
|
36
|
-
accessibilityState={
|
|
56
|
+
<View
|
|
57
|
+
style={
|
|
58
|
+
[
|
|
37
59
|
{
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
accessibilityValue={
|
|
60
|
+
"backgroundColor": "hsl(43, 18%, 92%)",
|
|
61
|
+
"borderColor": "hsl(200, 13%, 87%)",
|
|
62
|
+
"borderRadius": 8,
|
|
63
|
+
"borderWidth": 1,
|
|
64
|
+
"marginBottom": 8,
|
|
65
|
+
"overflow": "hidden",
|
|
66
|
+
},
|
|
46
67
|
{
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
"height": 64,
|
|
69
|
+
"marginRight": 8,
|
|
70
|
+
"width": 64,
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
>
|
|
75
|
+
<View
|
|
76
|
+
accessibilityLabel="image.jpeg"
|
|
53
77
|
accessible={true}
|
|
54
|
-
collapsable={false}
|
|
55
|
-
focusable={true}
|
|
56
|
-
onClick={[Function]}
|
|
57
|
-
onResponderGrant={[Function]}
|
|
58
|
-
onResponderMove={[Function]}
|
|
59
|
-
onResponderRelease={[Function]}
|
|
60
|
-
onResponderTerminate={[Function]}
|
|
61
|
-
onResponderTerminationRequest={[Function]}
|
|
62
|
-
onStartShouldSetResponder={[Function]}
|
|
63
|
-
style={
|
|
64
|
-
{
|
|
65
|
-
"opacity": 1,
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
78
|
>
|
|
69
79
|
<View
|
|
80
|
+
accessibilityIgnoresInvertColors={true}
|
|
70
81
|
style={
|
|
71
82
|
[
|
|
72
83
|
{
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"borderWidth": 1,
|
|
77
|
-
"marginBottom": 8,
|
|
78
|
-
"overflow": "hidden",
|
|
84
|
+
"alignItems": "center",
|
|
85
|
+
"justifyContent": "center",
|
|
86
|
+
"width": "100%",
|
|
79
87
|
},
|
|
80
88
|
{
|
|
81
|
-
"height":
|
|
82
|
-
"marginRight": 8,
|
|
83
|
-
"width": 64,
|
|
89
|
+
"height": "100%",
|
|
84
90
|
},
|
|
85
91
|
]
|
|
86
92
|
}
|
|
87
93
|
>
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
[
|
|
96
|
-
{
|
|
97
|
-
"alignItems": "center",
|
|
98
|
-
"justifyContent": "center",
|
|
99
|
-
"width": "100%",
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"height": "100%",
|
|
103
|
-
},
|
|
104
|
-
]
|
|
94
|
+
<Image
|
|
95
|
+
onLoadEnd={[Function]}
|
|
96
|
+
onLoadStart={[Function]}
|
|
97
|
+
resizeMode="cover"
|
|
98
|
+
source={
|
|
99
|
+
{
|
|
100
|
+
"uri": "https://imageurl.com/ababathumb.jpg",
|
|
105
101
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
{
|
|
126
|
-
"height": "100%",
|
|
127
|
-
"width": "100%",
|
|
128
|
-
},
|
|
129
|
-
undefined,
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
testID="test-image"
|
|
133
|
-
/>
|
|
134
|
-
</View>
|
|
135
|
-
</View>
|
|
102
|
+
}
|
|
103
|
+
style={
|
|
104
|
+
[
|
|
105
|
+
{
|
|
106
|
+
"bottom": 0,
|
|
107
|
+
"left": 0,
|
|
108
|
+
"position": "absolute",
|
|
109
|
+
"right": 0,
|
|
110
|
+
"top": 0,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"height": "100%",
|
|
114
|
+
"width": "100%",
|
|
115
|
+
},
|
|
116
|
+
undefined,
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
testID="test-image"
|
|
120
|
+
/>
|
|
136
121
|
</View>
|
|
137
122
|
</View>
|
|
138
123
|
</View>
|
|
139
124
|
</View>
|
|
140
|
-
</View>,
|
|
141
|
-
<View
|
|
142
|
-
collapsable={false}
|
|
143
|
-
pointerEvents="box-none"
|
|
144
|
-
style={
|
|
145
|
-
{
|
|
146
|
-
"bottom": 0,
|
|
147
|
-
"left": 0,
|
|
148
|
-
"position": "absolute",
|
|
149
|
-
"right": 0,
|
|
150
|
-
"top": 0,
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
>
|
|
154
125
|
<View
|
|
155
|
-
backdropComponent={[Function]}
|
|
156
|
-
backgroundStyle={
|
|
157
|
-
{
|
|
158
|
-
"borderTopLeftRadius": 24,
|
|
159
|
-
"borderTopRightRadius": 24,
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
enablePanDownToClose={true}
|
|
163
|
-
handleStyle={
|
|
164
|
-
{
|
|
165
|
-
"display": "none",
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
keyboardBlurBehavior="restore"
|
|
169
126
|
style={
|
|
170
127
|
{
|
|
171
128
|
"display": "none",
|
|
172
129
|
}
|
|
173
130
|
}
|
|
174
|
-
testID="bottom-sheet-mock"
|
|
131
|
+
testID="bottom-sheet-modal-mock"
|
|
175
132
|
>
|
|
176
133
|
<View
|
|
177
|
-
style={
|
|
178
|
-
{
|
|
179
|
-
"paddingBottom": 8,
|
|
180
|
-
"paddingTop": 8,
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
134
|
testID="bottom-sheet-view"
|
|
184
135
|
>
|
|
185
136
|
<View
|
|
@@ -348,6 +299,6 @@ exports[`renders a thumbnail component with attachments 1`] = `
|
|
|
348
299
|
</View>
|
|
349
300
|
</View>
|
|
350
301
|
</View>
|
|
351
|
-
</View
|
|
352
|
-
|
|
302
|
+
</View>
|
|
303
|
+
</View>
|
|
353
304
|
`;
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./ActionItem";
|
|
|
2
2
|
export * from "./ActionLabel";
|
|
3
3
|
export * from "./ActivityIndicator";
|
|
4
4
|
export * from "./AtlantisContext";
|
|
5
|
+
export * from "./AtlantisOverlayProvider";
|
|
5
6
|
export * from "./AtlantisThemeContext";
|
|
6
7
|
export * from "./AutoLink";
|
|
7
8
|
export * from "./Banner";
|
package/src/utils/meta/meta.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"AtlantisContext.Provider",
|
|
10
10
|
"AtlantisFormContext.Consumer",
|
|
11
11
|
"AtlantisFormContext.Provider",
|
|
12
|
+
"AtlantisOverlayProvider",
|
|
12
13
|
"AtlantisThemeContextProvider",
|
|
13
14
|
"AutoLink",
|
|
14
15
|
"Banner",
|
|
@@ -69,4 +70,4 @@
|
|
|
69
70
|
"Typography",
|
|
70
71
|
"TypographyGestureDetector"
|
|
71
72
|
]
|
|
72
|
-
}
|
|
73
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle, useRef, useState, } from "react";
|
|
2
|
-
import { Modalize } from "react-native-modalize";
|
|
3
|
-
export const UNSAFE_WrappedModalize = forwardRef((props, ref) => {
|
|
4
|
-
const innerRef = useRef(null);
|
|
5
|
-
const [openRenderId, setOpenRenderId] = useState(0);
|
|
6
|
-
useImperativeHandle(ref, () => ({
|
|
7
|
-
open(dest) {
|
|
8
|
-
setOpenRenderId(id => id + 1);
|
|
9
|
-
// Open on a fresh tick for additional safety
|
|
10
|
-
requestAnimationFrame(() => {
|
|
11
|
-
var _a;
|
|
12
|
-
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.open(dest);
|
|
13
|
-
});
|
|
14
|
-
},
|
|
15
|
-
close(dest) {
|
|
16
|
-
var _a;
|
|
17
|
-
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.close(dest);
|
|
18
|
-
},
|
|
19
|
-
}), []);
|
|
20
|
-
// Use a unique key to force a remount, ensuring we get fresh gesture handler nodes within modalize
|
|
21
|
-
return (React.createElement(Modalize, Object.assign({ key: `modalize-${openRenderId}`, ref: innerRef }, props)));
|
|
22
|
-
});
|
|
23
|
-
UNSAFE_WrappedModalize.displayName = "UNSAFE_WrappedModalize";
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { IHandles } from "react-native-modalize/lib/options";
|
|
3
|
-
export declare const UNSAFE_WrappedModalize: React.ForwardRefExoticComponent<Omit<import("react-native-modalize/lib/options").IProps<any> & React.RefAttributes<any>, "ref"> & React.RefAttributes<IHandles | undefined>>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useImperativeHandle,
|
|
4
|
-
useRef,
|
|
5
|
-
useState,
|
|
6
|
-
} from "react";
|
|
7
|
-
import { Modalize } from "react-native-modalize";
|
|
8
|
-
import type { IHandles } from "react-native-modalize/lib/options";
|
|
9
|
-
|
|
10
|
-
type Props = React.ComponentProps<typeof Modalize>;
|
|
11
|
-
|
|
12
|
-
export const UNSAFE_WrappedModalize = forwardRef<IHandles | undefined, Props>(
|
|
13
|
-
(props, ref) => {
|
|
14
|
-
const innerRef = useRef<IHandles | null>(null);
|
|
15
|
-
const [openRenderId, setOpenRenderId] = useState(0);
|
|
16
|
-
|
|
17
|
-
useImperativeHandle(
|
|
18
|
-
ref,
|
|
19
|
-
() => ({
|
|
20
|
-
open(dest) {
|
|
21
|
-
setOpenRenderId(id => id + 1);
|
|
22
|
-
// Open on a fresh tick for additional safety
|
|
23
|
-
requestAnimationFrame(() => {
|
|
24
|
-
innerRef.current?.open(dest);
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
close(dest) {
|
|
28
|
-
innerRef.current?.close(dest);
|
|
29
|
-
},
|
|
30
|
-
}),
|
|
31
|
-
[],
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// Use a unique key to force a remount, ensuring we get fresh gesture handler nodes within modalize
|
|
35
|
-
return (
|
|
36
|
-
<Modalize key={`modalize-${openRenderId}`} ref={innerRef} {...props} />
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
UNSAFE_WrappedModalize.displayName = "UNSAFE_WrappedModalize";
|