@jobber/components-native 0.98.5 → 0.99.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.
Files changed (38) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/AtlantisOverlayProvider/AtlantisOverlayProvider.js +5 -0
  3. package/dist/src/AtlantisOverlayProvider/index.js +1 -0
  4. package/dist/src/BottomSheet/BottomSheet.js +9 -11
  5. package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +2 -2
  6. package/dist/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.js +9 -11
  7. package/dist/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.js +7 -9
  8. package/dist/src/index.js +1 -0
  9. package/dist/src/utils/meta/meta.json +1 -0
  10. package/dist/tsconfig.build.tsbuildinfo +1 -1
  11. package/dist/types/src/AtlantisOverlayProvider/AtlantisOverlayProvider.d.ts +6 -0
  12. package/dist/types/src/AtlantisOverlayProvider/index.d.ts +1 -0
  13. package/dist/types/src/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +3 -3
  14. package/dist/types/src/index.d.ts +1 -0
  15. package/package.json +2 -2
  16. package/src/AtlantisOverlayProvider/AtlantisOverlayProvider.tsx +12 -0
  17. package/src/AtlantisOverlayProvider/index.ts +1 -0
  18. package/src/BottomSheet/BottomSheet.tsx +13 -13
  19. package/src/BottomSheet/hooks/useBottomSheetBackHandler.test.ts +10 -10
  20. package/src/BottomSheet/hooks/useBottomSheetBackHandler.ts +4 -4
  21. package/src/ButtonGroup/ButtonGroup.stories.tsx +10 -8
  22. package/src/ButtonGroup/ButtonGroup.test.tsx +7 -10
  23. package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +26 -29
  24. package/src/Form/Form.stories.tsx +8 -4
  25. package/src/Form/Form.test.tsx +51 -54
  26. package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +7 -10
  27. package/src/FormatFile/FormatFile.stories.tsx +3 -4
  28. package/src/FormatFile/FormatFile.test.tsx +11 -14
  29. package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +6 -9
  30. package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +21 -24
  31. package/src/InputDate/InputDate.test.tsx +5 -8
  32. package/src/InputTime/InputTime.stories.tsx +8 -4
  33. package/src/InputTime/InputTime.test.tsx +5 -8
  34. package/src/ThumbnailList/ThumbnailList.stories.tsx +6 -4
  35. package/src/ThumbnailList/ThumbnailList.test.tsx +5 -8
  36. package/src/ThumbnailList/__snapshots__/ThumbnailList.test.tsx.snap +101 -150
  37. package/src/index.ts +1 -0
  38. package/src/utils/meta/meta.json +2 -1
@@ -1,7 +1,6 @@
1
1
  import React, { createRef } from "react";
2
2
  import type { RenderAPI } from "@testing-library/react-native";
3
3
  import { fireEvent, render } from "@testing-library/react-native";
4
- import { Host } from "react-native-portalize";
5
4
  import { act } from "react-test-renderer";
6
5
  import type { BottomSheetOptionsSuffix } from "./FormatFileBottomSheet";
7
6
  import { FormatFileBottomSheet } from "./FormatFileBottomSheet";
@@ -20,14 +19,12 @@ const renderBottomSheet = (
20
19
  bottomSheetOptionsSuffix: BottomSheetOptionsSuffix,
21
20
  ) => {
22
21
  return render(
23
- <Host>
24
- <FormatFileBottomSheet
25
- onPreviewPress={onPreview}
26
- onRemovePress={onRemove}
27
- bottomSheetRef={bottomSheetRef}
28
- bottomSheetOptionsSuffix={bottomSheetOptionsSuffix}
29
- />
30
- </Host>,
22
+ <FormatFileBottomSheet
23
+ onPreviewPress={onPreview}
24
+ onRemovePress={onRemove}
25
+ bottomSheetRef={bottomSheetRef}
26
+ bottomSheetOptionsSuffix={bottomSheetOptionsSuffix}
27
+ />,
31
28
  );
32
29
  };
33
30
 
@@ -1,6 +1,5 @@
1
1
  import type { RefObject } from "react";
2
2
  import React from "react";
3
- import { Portal } from "react-native-portalize";
4
3
  import type { BottomSheetRef } from "../../../BottomSheet/BottomSheet";
5
4
  import { BottomSheet } from "../../../BottomSheet/BottomSheet";
6
5
  import { BottomSheetOption } from "../../../BottomSheet/components/BottomSheetOption";
@@ -30,28 +29,26 @@ export const FormatFileBottomSheet = ({
30
29
  };
31
30
 
32
31
  return (
33
- <Portal>
34
- <BottomSheet ref={bottomSheetRef}>
35
- {onPreviewPress ? (
36
- <BottomSheetOption
37
- icon={"eye"}
38
- text={t("FormatFile.preview", {
39
- item: bottomSheetOptionsSuffix || "",
40
- })}
41
- onPress={() => handlePress(onPreviewPress)}
42
- />
43
- ) : undefined}
44
- {onRemovePress ? (
45
- <BottomSheetOption
46
- icon={"trash"}
47
- destructive={true}
48
- text={t("FormatFile.remove", {
49
- item: bottomSheetOptionsSuffix || "",
50
- })}
51
- onPress={() => handlePress(onRemovePress)}
52
- />
53
- ) : undefined}
54
- </BottomSheet>
55
- </Portal>
32
+ <BottomSheet ref={bottomSheetRef}>
33
+ {onPreviewPress ? (
34
+ <BottomSheetOption
35
+ icon={"eye"}
36
+ text={t("FormatFile.preview", {
37
+ item: bottomSheetOptionsSuffix || "",
38
+ })}
39
+ onPress={() => handlePress(onPreviewPress)}
40
+ />
41
+ ) : undefined}
42
+ {onRemovePress ? (
43
+ <BottomSheetOption
44
+ icon={"trash"}
45
+ destructive={true}
46
+ text={t("FormatFile.remove", {
47
+ item: bottomSheetOptionsSuffix || "",
48
+ })}
49
+ onPress={() => handlePress(onRemovePress)}
50
+ />
51
+ ) : undefined}
52
+ </BottomSheet>
56
53
  );
57
54
  };
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import { fireEvent, render, waitFor } from "@testing-library/react-native";
3
- import { Host } from "react-native-portalize";
4
3
  import { FormProvider, useForm } from "react-hook-form";
5
4
  import { Keyboard } from "react-native";
6
5
  import { InputDate } from "./InputDate";
@@ -175,13 +174,11 @@ describe("InputDate", () => {
175
174
  const setup = () =>
176
175
  render(
177
176
  <SimpleFormWithProvider defaultValues={{ [pickerName]: value }}>
178
- <Host>
179
- <InputDate
180
- name={pickerName}
181
- onChange={handleChange}
182
- validations={{ required: requiredError }}
183
- />
184
- </Host>
177
+ <InputDate
178
+ name={pickerName}
179
+ onChange={handleChange}
180
+ validations={{ required: requiredError }}
181
+ />
185
182
  </SimpleFormWithProvider>,
186
183
  );
187
184
 
@@ -1,8 +1,12 @@
1
1
  import React, { useState } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
- import { Host } from "react-native-portalize";
4
3
  import { SafeAreaProvider } from "react-native-safe-area-context";
5
- import { Content, Form, InputTime } from "@jobber/components-native";
4
+ import {
5
+ AtlantisOverlayProvider,
6
+ Content,
7
+ Form,
8
+ InputTime,
9
+ } from "@jobber/components-native";
6
10
 
7
11
  const meta = {
8
12
  title: "Components/Forms and Inputs/InputTime",
@@ -63,7 +67,7 @@ const EmptyValueTemplate = (args: ControlledStory["args"]) => {
63
67
 
64
68
  const FormControlledTemplate = (args: FormStory["args"]) => (
65
69
  <SafeAreaProvider>
66
- <Host>
70
+ <AtlantisOverlayProvider>
67
71
  <Form
68
72
  initialValues={{ startTime: new Date("2023-07-21T16:36:34.873Z") }}
69
73
  onSubmit={value =>
@@ -84,7 +88,7 @@ const FormControlledTemplate = (args: FormStory["args"]) => (
84
88
  />
85
89
  </Content>
86
90
  </Form>
87
- </Host>
91
+ </AtlantisOverlayProvider>
88
92
  </SafeAreaProvider>
89
93
  );
90
94
 
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import { fireEvent, render, waitFor } from "@testing-library/react-native";
3
- import { Host } from "react-native-portalize";
4
3
  import { FormProvider, useForm } from "react-hook-form";
5
4
  import { Keyboard } from "react-native";
6
5
  import { InputTime } from "./InputTime";
@@ -223,13 +222,11 @@ describe("Form controlled", () => {
223
222
  const setup = () =>
224
223
  render(
225
224
  <SimpleFormWithProvider defaultValues={{ [pickerName]: value }}>
226
- <Host>
227
- <InputTime
228
- name={pickerName}
229
- onChange={handleChange}
230
- validations={{ required: requiredError }}
231
- />
232
- </Host>
225
+ <InputTime
226
+ name={pickerName}
227
+ onChange={handleChange}
228
+ validations={{ required: requiredError }}
229
+ />
233
230
  </SimpleFormWithProvider>,
234
231
  );
235
232
 
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
- import { Host } from "react-native-portalize";
4
3
  import { SafeAreaProvider } from "react-native-safe-area-context";
5
- import { ThumbnailList } from "@jobber/components-native";
4
+ import {
5
+ AtlantisOverlayProvider,
6
+ ThumbnailList,
7
+ } from "@jobber/components-native";
6
8
 
7
9
  const meta = {
8
10
  title: "Components/Images and Icons/ThumbnailList",
@@ -17,9 +19,9 @@ type Story = StoryObj<typeof meta>;
17
19
 
18
20
  const BasicTemplate = (args: Story["args"]) => (
19
21
  <SafeAreaProvider>
20
- <Host>
22
+ <AtlantisOverlayProvider>
21
23
  <ThumbnailList {...args} />
22
- </Host>
24
+ </AtlantisOverlayProvider>
23
25
  </SafeAreaProvider>
24
26
  );
25
27
 
@@ -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
- <Host>
50
- <ThumbnailList
51
- files={snapshot ? snapshotFile : files}
52
- handleOpenFile={onOpenFile}
53
- createThumbnail={mockCreateThumbnail}
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
- <View
6
- collapsable={false}
7
- pointerEvents="box-none"
8
- style={
9
- [
10
- {
11
- "flex": 1,
12
- },
13
- undefined,
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
- "display": "flex",
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
- <View
34
- accessibilityHint="Select for more options"
35
- accessibilityRole="imagebutton"
36
- accessibilityState={
56
+ <View
57
+ style={
58
+ [
37
59
  {
38
- "busy": undefined,
39
- "checked": undefined,
40
- "disabled": undefined,
41
- "expanded": undefined,
42
- "selected": undefined,
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
- "max": undefined,
48
- "min": undefined,
49
- "now": undefined,
50
- "text": undefined,
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
- "backgroundColor": "hsl(43, 18%, 92%)",
74
- "borderColor": "hsl(200, 13%, 87%)",
75
- "borderRadius": 8,
76
- "borderWidth": 1,
77
- "marginBottom": 8,
78
- "overflow": "hidden",
84
+ "alignItems": "center",
85
+ "justifyContent": "center",
86
+ "width": "100%",
79
87
  },
80
88
  {
81
- "height": 64,
82
- "marginRight": 8,
83
- "width": 64,
89
+ "height": "100%",
84
90
  },
85
91
  ]
86
92
  }
87
93
  >
88
- <View
89
- accessibilityLabel="image.jpeg"
90
- accessible={true}
91
- >
92
- <View
93
- accessibilityIgnoresInvertColors={true}
94
- style={
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
- <Image
108
- onLoadEnd={[Function]}
109
- onLoadStart={[Function]}
110
- resizeMode="cover"
111
- source={
112
- {
113
- "uri": "https://imageurl.com/ababathumb.jpg",
114
- }
115
- }
116
- style={
117
- [
118
- {
119
- "bottom": 0,
120
- "left": 0,
121
- "position": "absolute",
122
- "right": 0,
123
- "top": 0,
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";
@@ -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
+ }