@jobber/components-native 0.100.1 → 0.101.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 +2 -2
- package/dist/src/ContentOverlay/ContentOverlay.js +3 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/ContentOverlay/types.d.ts +1 -1
- package/package.json +2 -2
- package/src/ActionItem/ActionItem.stories.tsx +7 -6
- package/src/ActionItem/ActionItemGroup.stories.tsx +10 -9
- package/src/Banner/Banner.stories.tsx +2 -1
- package/src/BottomSheet/BottomSheet.stories.tsx +11 -10
- package/src/ButtonGroup/ButtonGroup.stories.tsx +9 -8
- package/src/Card/Card.stories.tsx +3 -2
- package/src/Chip/Chip.stories.tsx +9 -8
- package/src/ContentOverlay/ContentOverlay.stories.tsx +12 -7
- package/src/ContentOverlay/ContentOverlay.test.tsx +40 -3
- package/src/ContentOverlay/ContentOverlay.tsx +3 -3
- package/src/ContentOverlay/types.ts +1 -1
- package/src/EmptyState/EmptyState.stories.tsx +3 -2
- package/src/Form/Form.stories.tsx +4 -3
- package/src/IconButton/IconButton.stories.tsx +2 -1
- package/src/InputPressable/InputPressable.stories.tsx +5 -4
- package/src/InputSearch/InputSearch.stories.tsx +2 -1
- package/src/InputTime/InputTime.stories.tsx +2 -1
|
@@ -7,7 +7,7 @@ export interface ContentOverlayProps {
|
|
|
7
7
|
/**
|
|
8
8
|
* Title of overlay, appears in the header next to the close button.
|
|
9
9
|
*/
|
|
10
|
-
readonly title
|
|
10
|
+
readonly title?: string;
|
|
11
11
|
/**
|
|
12
12
|
* Optional accessibilityLabel describing the overlay.
|
|
13
13
|
* This will read out when the overlay is opened.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.101.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"react-native-safe-area-context": "^5.4.0",
|
|
95
95
|
"react-native-svg": ">=12.0.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "60059897a6dcbc0277774885c6a7ade0658c335d"
|
|
98
98
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
3
4
|
import {
|
|
4
5
|
ActionItem,
|
|
5
6
|
AutoLink,
|
|
@@ -106,21 +107,21 @@ export const Basic: Story = {
|
|
|
106
107
|
render: BasicTemplate,
|
|
107
108
|
args: {
|
|
108
109
|
icon: "work",
|
|
109
|
-
onPress: () => alert("👍"),
|
|
110
|
+
onPress: () => action("alert")("👍"),
|
|
110
111
|
},
|
|
111
112
|
};
|
|
112
113
|
|
|
113
114
|
export const InACard: Story = {
|
|
114
115
|
render: InACardTemplate,
|
|
115
116
|
args: {
|
|
116
|
-
onPress: () => alert("👍"),
|
|
117
|
+
onPress: () => action("alert")("👍"),
|
|
117
118
|
},
|
|
118
119
|
};
|
|
119
120
|
|
|
120
121
|
export const MixedComponents: Story = {
|
|
121
122
|
render: MixedComponentsTemplate,
|
|
122
123
|
args: {
|
|
123
|
-
onPress: () => alert("👍"),
|
|
124
|
+
onPress: () => action("alert")("👍"),
|
|
124
125
|
icon: "person",
|
|
125
126
|
title: "Assigned to",
|
|
126
127
|
},
|
|
@@ -129,7 +130,7 @@ export const MixedComponents: Story = {
|
|
|
129
130
|
export const ActionAlignment: Story = {
|
|
130
131
|
render: ActionAlignmentTemplate,
|
|
131
132
|
args: {
|
|
132
|
-
onPress: () => alert("👍"),
|
|
133
|
+
onPress: () => action("alert")("👍"),
|
|
133
134
|
actionIconAlignment: "flex-start",
|
|
134
135
|
title: "Service Details",
|
|
135
136
|
},
|
|
@@ -140,7 +141,7 @@ export const TitleOnly: Story = {
|
|
|
140
141
|
args: {
|
|
141
142
|
title: "Add client",
|
|
142
143
|
icon: "person",
|
|
143
|
-
onPress: () => alert("👍"),
|
|
144
|
+
onPress: () => action("alert")("👍"),
|
|
144
145
|
actionIcon: "add",
|
|
145
146
|
},
|
|
146
147
|
};
|
|
@@ -148,7 +149,7 @@ export const TitleOnly: Story = {
|
|
|
148
149
|
export const InteractiveChildren: Story = {
|
|
149
150
|
render: InteractiveChildrenTemplate,
|
|
150
151
|
args: {
|
|
151
|
-
onPress: () => alert("Tapped the entire action item"),
|
|
152
|
+
onPress: () => action("alert")("Tapped the entire action item"),
|
|
152
153
|
icon: "presentation",
|
|
153
154
|
actionIcon: "link",
|
|
154
155
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
3
4
|
import {
|
|
4
5
|
ActionItem,
|
|
5
6
|
ActionItemGroup,
|
|
@@ -33,22 +34,22 @@ const BasicTemplate = () => {
|
|
|
33
34
|
<ActionItem
|
|
34
35
|
title={"Request #13"}
|
|
35
36
|
icon={"request"}
|
|
36
|
-
onPress={() => alert("request")}
|
|
37
|
+
onPress={() => action("alert")("request")}
|
|
37
38
|
/>
|
|
38
39
|
<ActionItem
|
|
39
40
|
title={"Quote #64"}
|
|
40
41
|
icon={"quote"}
|
|
41
|
-
onPress={() => alert("quote")}
|
|
42
|
+
onPress={() => action("alert")("quote")}
|
|
42
43
|
/>
|
|
43
44
|
<ActionItem
|
|
44
45
|
title={"Job #12"}
|
|
45
46
|
icon={"job"}
|
|
46
|
-
onPress={() => alert("job")}
|
|
47
|
+
onPress={() => action("alert")("job")}
|
|
47
48
|
/>
|
|
48
49
|
<ActionItem
|
|
49
50
|
title={"Invoice #72"}
|
|
50
51
|
icon={"invoice"}
|
|
51
|
-
onPress={() => alert("invoice")}
|
|
52
|
+
onPress={() => action("alert")("invoice")}
|
|
52
53
|
>
|
|
53
54
|
<Text>$250.00</Text>
|
|
54
55
|
</ActionItem>
|
|
@@ -64,7 +65,7 @@ const MixedComponentsTemplate = () => {
|
|
|
64
65
|
<ActionItem
|
|
65
66
|
title={"Stephen Campbell"}
|
|
66
67
|
icon={"person"}
|
|
67
|
-
onPress={() => alert("client")}
|
|
68
|
+
onPress={() => action("alert")("client")}
|
|
68
69
|
/>
|
|
69
70
|
<Content>
|
|
70
71
|
<Typography fontFamily="display">Client name</Typography>
|
|
@@ -75,22 +76,22 @@ const MixedComponentsTemplate = () => {
|
|
|
75
76
|
<ActionItem
|
|
76
77
|
title={"Request #13"}
|
|
77
78
|
icon={"request"}
|
|
78
|
-
onPress={() => alert("request")}
|
|
79
|
+
onPress={() => action("alert")("request")}
|
|
79
80
|
/>
|
|
80
81
|
<ActionItem
|
|
81
82
|
title={"Quote #64"}
|
|
82
83
|
icon={"quote"}
|
|
83
|
-
onPress={() => alert("quote")}
|
|
84
|
+
onPress={() => action("alert")("quote")}
|
|
84
85
|
/>
|
|
85
86
|
<ActionItem
|
|
86
87
|
title={"Job #12"}
|
|
87
88
|
icon={"job"}
|
|
88
|
-
onPress={() => alert("job")}
|
|
89
|
+
onPress={() => action("alert")("job")}
|
|
89
90
|
/>
|
|
90
91
|
<ActionItem
|
|
91
92
|
title={"Invoice #72"}
|
|
92
93
|
icon={"invoice"}
|
|
93
|
-
onPress={() => alert("invoice")}
|
|
94
|
+
onPress={() => action("alert")("invoice")}
|
|
94
95
|
>
|
|
95
96
|
<Text>$250.00</Text>
|
|
96
97
|
</ActionItem>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
3
4
|
import { Banner, Content, Text, TextList } from "@jobber/components-native";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -64,7 +65,7 @@ export const ActionsInBanners: Story = {
|
|
|
64
65
|
args: {
|
|
65
66
|
type: "notice",
|
|
66
67
|
children: "Your trial has been extended!",
|
|
67
|
-
action: { label: "View Plans", onPress: () => alert("Plans") },
|
|
68
|
+
action: { label: "View Plans", onPress: () => action("alert")("Plans") },
|
|
68
69
|
},
|
|
69
70
|
};
|
|
70
71
|
|
|
@@ -2,6 +2,7 @@ import React, { useRef } from "react";
|
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
3
|
import { View } from "react-native";
|
|
4
4
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
5
|
+
import { action } from "storybook/actions";
|
|
5
6
|
import { Button, Heading, Text } from "@jobber/components-native";
|
|
6
7
|
import { BottomSheet } from "./BottomSheet";
|
|
7
8
|
import type { BottomSheetRef } from "./BottomSheet";
|
|
@@ -39,26 +40,26 @@ const BasicTemplate = () => {
|
|
|
39
40
|
</View>
|
|
40
41
|
<BottomSheet
|
|
41
42
|
ref={bottomSheetRef}
|
|
42
|
-
onClose={() => console.log("closed bottom sheet")}
|
|
43
|
-
onOpen={() => console.log("opened bottom sheet")}
|
|
43
|
+
onClose={() => action("console.log")("closed bottom sheet")}
|
|
44
|
+
onOpen={() => action("console.log")("opened bottom sheet")}
|
|
44
45
|
>
|
|
45
46
|
<BottomSheetOption
|
|
46
47
|
icon="sendMessage"
|
|
47
48
|
iconColor="greyBlue"
|
|
48
49
|
text="Send message"
|
|
49
|
-
onPress={() => alert("send message")}
|
|
50
|
+
onPress={() => action("alert")("send message")}
|
|
50
51
|
/>
|
|
51
52
|
<BottomSheetOption
|
|
52
53
|
icon="phone"
|
|
53
54
|
iconColor="greyBlue"
|
|
54
55
|
text="Call a friend"
|
|
55
|
-
onPress={() => alert("Calling a friend")}
|
|
56
|
+
onPress={() => action("alert")("Calling a friend")}
|
|
56
57
|
/>
|
|
57
58
|
<BottomSheetOption
|
|
58
59
|
destructive={true}
|
|
59
60
|
icon="trash"
|
|
60
61
|
text="Remove"
|
|
61
|
-
onPress={() => alert("Removed")}
|
|
62
|
+
onPress={() => action("alert")("Removed")}
|
|
62
63
|
/>
|
|
63
64
|
</BottomSheet>
|
|
64
65
|
</SafeAreaProvider>
|
|
@@ -91,26 +92,26 @@ const HeaderFooterInputTextTemplate = () => {
|
|
|
91
92
|
ref={bottomSheetRef}
|
|
92
93
|
showCancel={true}
|
|
93
94
|
heading="BottomSheet Header"
|
|
94
|
-
onClose={() => console.log("closed bottom sheet")}
|
|
95
|
-
onOpen={() => console.log("opened bottom sheet")}
|
|
95
|
+
onClose={() => action("console.log")("closed bottom sheet")}
|
|
96
|
+
onOpen={() => action("console.log")("opened bottom sheet")}
|
|
96
97
|
>
|
|
97
98
|
<BottomSheetOption
|
|
98
99
|
icon="sendMessage"
|
|
99
100
|
iconColor="greyBlue"
|
|
100
101
|
text="Send message"
|
|
101
|
-
onPress={() => alert("send message")}
|
|
102
|
+
onPress={() => action("alert")("send message")}
|
|
102
103
|
/>
|
|
103
104
|
<BottomSheetOption
|
|
104
105
|
icon="phone"
|
|
105
106
|
iconColor="greyBlue"
|
|
106
107
|
text="Call a friend"
|
|
107
|
-
onPress={() => alert("Calling a friend")}
|
|
108
|
+
onPress={() => action("alert")("Calling a friend")}
|
|
108
109
|
/>
|
|
109
110
|
<BottomSheetOption
|
|
110
111
|
destructive={true}
|
|
111
112
|
icon="trash"
|
|
112
113
|
text="Remove"
|
|
113
|
-
onPress={() => alert("Removed")}
|
|
114
|
+
onPress={() => action("alert")("Removed")}
|
|
114
115
|
/>
|
|
115
116
|
</BottomSheet>
|
|
116
117
|
</SafeAreaProvider>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
3
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
|
+
import { action } from "storybook/actions";
|
|
4
5
|
import {
|
|
5
6
|
AtlantisOverlayProvider,
|
|
6
7
|
ButtonGroup,
|
|
@@ -38,17 +39,17 @@ export const Basic: ButtonGroupStory = {
|
|
|
38
39
|
<ButtonGroup.PrimaryAction
|
|
39
40
|
label={"Create"}
|
|
40
41
|
icon={"plus"}
|
|
41
|
-
onPress={() => console.log("create")}
|
|
42
|
+
onPress={() => action("console.log")("create")}
|
|
42
43
|
/>
|
|
43
44
|
<ButtonGroup.PrimaryAction
|
|
44
45
|
label={"Edit"}
|
|
45
46
|
icon={"edit"}
|
|
46
|
-
onPress={() => console.log("edit")}
|
|
47
|
+
onPress={() => action("console.log")("edit")}
|
|
47
48
|
/>
|
|
48
49
|
<ButtonGroup.SecondaryAction
|
|
49
50
|
label={"Delete"}
|
|
50
51
|
icon={"trash"}
|
|
51
|
-
onPress={() => console.log("delete")}
|
|
52
|
+
onPress={() => action("console.log")("delete")}
|
|
52
53
|
/>
|
|
53
54
|
</ButtonGroup>
|
|
54
55
|
</AtlantisOverlayProvider>
|
|
@@ -66,12 +67,12 @@ export const Primary: PrimaryActionStory = {
|
|
|
66
67
|
<ButtonGroup.SecondaryAction
|
|
67
68
|
label={"Edit"}
|
|
68
69
|
icon={"edit"}
|
|
69
|
-
onPress={() => console.log("edit")}
|
|
70
|
+
onPress={() => action("console.log")("edit")}
|
|
70
71
|
/>
|
|
71
72
|
<ButtonGroup.SecondaryAction
|
|
72
73
|
label={"Delete"}
|
|
73
74
|
icon={"trash"}
|
|
74
|
-
onPress={() => console.log("delete")}
|
|
75
|
+
onPress={() => action("console.log")("delete")}
|
|
75
76
|
/>
|
|
76
77
|
</ButtonGroup>
|
|
77
78
|
</AtlantisOverlayProvider>
|
|
@@ -80,7 +81,7 @@ export const Primary: PrimaryActionStory = {
|
|
|
80
81
|
args: {
|
|
81
82
|
label: "Create",
|
|
82
83
|
icon: "plus",
|
|
83
|
-
onPress: () => console.log("create"),
|
|
84
|
+
onPress: () => action("console.log")("create"),
|
|
84
85
|
},
|
|
85
86
|
};
|
|
86
87
|
|
|
@@ -95,7 +96,7 @@ export const Secondary: SecondaryActionStory = {
|
|
|
95
96
|
<ButtonGroup.PrimaryAction
|
|
96
97
|
label={"Click that ellipsis >>>"}
|
|
97
98
|
buttonType={"secondary"}
|
|
98
|
-
onPress={() => alert("No, not me. The ellipsis!")}
|
|
99
|
+
onPress={() => action("alert")("No, not me. The ellipsis!")}
|
|
99
100
|
/>
|
|
100
101
|
<ButtonGroup.SecondaryAction {...args} />
|
|
101
102
|
</ButtonGroup>
|
|
@@ -105,6 +106,6 @@ export const Secondary: SecondaryActionStory = {
|
|
|
105
106
|
args: {
|
|
106
107
|
label: "Create",
|
|
107
108
|
icon: "plus",
|
|
108
|
-
onPress: () => console.log("create"),
|
|
109
|
+
onPress: () => action("console.log")("create"),
|
|
109
110
|
},
|
|
110
111
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
3
4
|
import { Card, Content, Text } from "@jobber/components-native";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -73,11 +74,11 @@ export const Pressable: Story = {
|
|
|
73
74
|
header: {
|
|
74
75
|
title: "Your address",
|
|
75
76
|
actionItem: { iconName: "plus2" },
|
|
76
|
-
onPress: () => alert("🏡"),
|
|
77
|
+
onPress: () => action("alert")("🏡"),
|
|
77
78
|
},
|
|
78
79
|
footer: {
|
|
79
80
|
title: "View All",
|
|
80
|
-
onPress: () => alert("View all"),
|
|
81
|
+
onPress: () => action("alert")("View all"),
|
|
81
82
|
},
|
|
82
83
|
},
|
|
83
84
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
4
|
+
import { action } from "storybook/actions";
|
|
4
5
|
import { Chip, useAtlantisTheme } from "@jobber/components-native";
|
|
5
6
|
|
|
6
7
|
const meta = {
|
|
@@ -23,7 +24,7 @@ export const Basic: Story = {
|
|
|
23
24
|
render: BasicTemplate,
|
|
24
25
|
args: {
|
|
25
26
|
label: "Active chip",
|
|
26
|
-
onPress: () => alert("hi!"),
|
|
27
|
+
onPress: () => action("alert")("hi!"),
|
|
27
28
|
accessibilityLabel: "Active chip",
|
|
28
29
|
isActive: true,
|
|
29
30
|
},
|
|
@@ -46,7 +47,7 @@ const AccentTemplate = (args: Story["args"]) => {
|
|
|
46
47
|
label="Select requests"
|
|
47
48
|
accent="request"
|
|
48
49
|
icon="request"
|
|
49
|
-
onPress={() => alert("Requests")}
|
|
50
|
+
onPress={() => action("alert")("Requests")}
|
|
50
51
|
accessibilityLabel={"Select Requests"}
|
|
51
52
|
isActive={true}
|
|
52
53
|
/>
|
|
@@ -54,7 +55,7 @@ const AccentTemplate = (args: Story["args"]) => {
|
|
|
54
55
|
label="Select quotes"
|
|
55
56
|
accent="quote"
|
|
56
57
|
icon="quote"
|
|
57
|
-
onPress={() => alert("Quotes")}
|
|
58
|
+
onPress={() => action("alert")("Quotes")}
|
|
58
59
|
accessibilityLabel={"Select Quotes"}
|
|
59
60
|
isActive={true}
|
|
60
61
|
/>
|
|
@@ -62,7 +63,7 @@ const AccentTemplate = (args: Story["args"]) => {
|
|
|
62
63
|
label="Select jobs"
|
|
63
64
|
accent="job"
|
|
64
65
|
icon="job"
|
|
65
|
-
onPress={() => alert("Jobs")}
|
|
66
|
+
onPress={() => action("alert")("Jobs")}
|
|
66
67
|
accessibilityLabel={"Select Jobs"}
|
|
67
68
|
isActive={true}
|
|
68
69
|
/>
|
|
@@ -70,7 +71,7 @@ const AccentTemplate = (args: Story["args"]) => {
|
|
|
70
71
|
label="Select invoices"
|
|
71
72
|
accent="invoice"
|
|
72
73
|
icon="invoice"
|
|
73
|
-
onPress={() => alert("Invoices")}
|
|
74
|
+
onPress={() => action("alert")("Invoices")}
|
|
74
75
|
accessibilityLabel={"Select Invoices"}
|
|
75
76
|
isActive={true}
|
|
76
77
|
/>
|
|
@@ -84,7 +85,7 @@ export const Accent: Story = {
|
|
|
84
85
|
label: "Select clients",
|
|
85
86
|
accent: "client",
|
|
86
87
|
icon: "clients",
|
|
87
|
-
onPress: () => alert("Clients"),
|
|
88
|
+
onPress: () => action("alert")("Clients"),
|
|
88
89
|
accessibilityLabel: "Select clients",
|
|
89
90
|
isActive: true,
|
|
90
91
|
},
|
|
@@ -96,7 +97,7 @@ export const Dismissable: Story = {
|
|
|
96
97
|
label: "Test Chip",
|
|
97
98
|
accent: "client",
|
|
98
99
|
icon: "clients",
|
|
99
|
-
onPress: () => alert("Clients"),
|
|
100
|
+
onPress: () => action("alert")("Clients"),
|
|
100
101
|
accessibilityLabel: "Select clients",
|
|
101
102
|
isDismissible: true,
|
|
102
103
|
},
|
|
@@ -108,7 +109,7 @@ export const InactiveBackgroundColor: Story = {
|
|
|
108
109
|
label: "Inactive Chip",
|
|
109
110
|
accent: "client",
|
|
110
111
|
icon: "clients",
|
|
111
|
-
onPress: () => alert("Clients"),
|
|
112
|
+
onPress: () => action("alert")("Clients"),
|
|
112
113
|
accessibilityLabel: "Select clients",
|
|
113
114
|
inactiveBackgroundColor: "surface",
|
|
114
115
|
},
|
|
@@ -2,10 +2,15 @@ import React, { useRef } from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
4
4
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
5
|
+
import { action } from "storybook/actions";
|
|
5
6
|
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import type { ContentOverlayRef } from "@jobber/components-native";
|
|
8
|
+
import {
|
|
9
|
+
Button,
|
|
10
|
+
ContentOverlay,
|
|
11
|
+
Heading,
|
|
12
|
+
Text,
|
|
13
|
+
} from "@jobber/components-native";
|
|
9
14
|
|
|
10
15
|
const meta = {
|
|
11
16
|
title: "Components/Overlays/ContentOverlay",
|
|
@@ -48,8 +53,8 @@ const BasicTemplate = () => {
|
|
|
48
53
|
<ContentOverlay
|
|
49
54
|
ref={contentOverlayRef}
|
|
50
55
|
title="Content Overlay Title"
|
|
51
|
-
onClose={() => console.log("closed content overlay")}
|
|
52
|
-
onOpen={() => console.log("opened content overlay")}
|
|
56
|
+
onClose={() => action("console.log")("closed content overlay")}
|
|
57
|
+
onOpen={() => action("console.log")("opened content overlay")}
|
|
53
58
|
>
|
|
54
59
|
<View style={{ padding: 16 }}>
|
|
55
60
|
<Text>This is the content inside the overlay.</Text>
|
|
@@ -64,8 +69,8 @@ export const Basic: Story = {
|
|
|
64
69
|
render: BasicTemplate,
|
|
65
70
|
args: {
|
|
66
71
|
title: "Overlay Title",
|
|
67
|
-
onClose: () => alert("Overlay Dismissed"),
|
|
68
|
-
onOpen: () => alert("Overlay opened"),
|
|
72
|
+
onClose: () => action("alert")("Overlay Dismissed"),
|
|
73
|
+
onOpen: () => action("alert")("Overlay opened"),
|
|
69
74
|
fullScreen: false,
|
|
70
75
|
},
|
|
71
76
|
};
|
|
@@ -73,7 +73,7 @@ function renderContentOverlay(
|
|
|
73
73
|
onCloseCallback,
|
|
74
74
|
onOpenCallback,
|
|
75
75
|
onBeforeExitCallback,
|
|
76
|
-
} = getDefaultOptions(),
|
|
76
|
+
}: Partial<testRendererOptions> = getDefaultOptions(),
|
|
77
77
|
) {
|
|
78
78
|
const contentOverlayRef = createRef<ContentOverlayRef>();
|
|
79
79
|
|
|
@@ -82,7 +82,7 @@ function renderContentOverlay(
|
|
|
82
82
|
<View>
|
|
83
83
|
<Text>I am a bunch of text</Text>
|
|
84
84
|
<Button
|
|
85
|
-
label={buttonLabel}
|
|
85
|
+
label={buttonLabel || "Open Content Overlay"}
|
|
86
86
|
onPress={() => {
|
|
87
87
|
contentOverlayRef?.current?.open?.();
|
|
88
88
|
}}
|
|
@@ -125,7 +125,7 @@ async function renderAndOpenContentOverlay(
|
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
await waitFor(() => {
|
|
128
|
-
expect(screen.getByTestId("ATL-Overlay-Header")).toBeDefined();
|
|
128
|
+
// expect(screen.getByTestId("ATL-Overlay-Header")).toBeDefined();
|
|
129
129
|
expect(props.onOpenCallback).toHaveBeenCalledTimes(1);
|
|
130
130
|
});
|
|
131
131
|
}
|
|
@@ -443,3 +443,40 @@ describe("onBeforeExit callback", () => {
|
|
|
443
443
|
});
|
|
444
444
|
});
|
|
445
445
|
});
|
|
446
|
+
|
|
447
|
+
describe("title prop", () => {
|
|
448
|
+
it("should render the title", async () => {
|
|
449
|
+
const options: testRendererOptions = {
|
|
450
|
+
...getDefaultOptions(),
|
|
451
|
+
title: "Awesome Title",
|
|
452
|
+
};
|
|
453
|
+
await renderAndOpenContentOverlay(options);
|
|
454
|
+
expect(screen.getByText(options.title)).toBeDefined();
|
|
455
|
+
});
|
|
456
|
+
describe("when title is not passed but showDismiss is true", () => {
|
|
457
|
+
it("should should render dismiss button", async () => {
|
|
458
|
+
const options: testRendererOptions = {
|
|
459
|
+
...getDefaultOptions(),
|
|
460
|
+
showDismiss: true,
|
|
461
|
+
};
|
|
462
|
+
await renderAndOpenContentOverlay(options);
|
|
463
|
+
expect(screen.getByTestId("ATL-Overlay-CloseButton")).toBeDefined();
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
describe("when title is not passed but showDismiss is false", () => {
|
|
467
|
+
it("should not render the header", async () => {
|
|
468
|
+
jest
|
|
469
|
+
.spyOn(AccessibilityInfo, "isScreenReaderEnabled")
|
|
470
|
+
.mockImplementation(() => Promise.resolve(false));
|
|
471
|
+
const options: testRendererOptions = {
|
|
472
|
+
...getDefaultOptions(),
|
|
473
|
+
showDismiss: false,
|
|
474
|
+
title: "",
|
|
475
|
+
fullScreen: false,
|
|
476
|
+
};
|
|
477
|
+
await renderAndOpenContentOverlay(options);
|
|
478
|
+
console.log(options);
|
|
479
|
+
expect(screen.queryByTestId("ATL-Overlay-Header")).toBeNull();
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
});
|
|
@@ -205,7 +205,7 @@ export function ContentOverlay({
|
|
|
205
205
|
|
|
206
206
|
const renderHeader = () => {
|
|
207
207
|
const closeOverlayA11YLabel = t("ContentOverlay.close", {
|
|
208
|
-
title: title,
|
|
208
|
+
title: title || "",
|
|
209
209
|
});
|
|
210
210
|
|
|
211
211
|
const headerStyles = [
|
|
@@ -223,7 +223,7 @@ export function ContentOverlay({
|
|
|
223
223
|
},
|
|
224
224
|
];
|
|
225
225
|
|
|
226
|
-
return (
|
|
226
|
+
return title || shouldShowDismiss ? (
|
|
227
227
|
<View testID="ATL-Overlay-Header">
|
|
228
228
|
<View style={headerStyles}>
|
|
229
229
|
<View
|
|
@@ -266,7 +266,7 @@ export function ContentOverlay({
|
|
|
266
266
|
<View style={headerShadowStyles} />
|
|
267
267
|
</View>
|
|
268
268
|
</View>
|
|
269
|
-
);
|
|
269
|
+
) : null;
|
|
270
270
|
};
|
|
271
271
|
|
|
272
272
|
return (
|
|
@@ -8,7 +8,7 @@ export interface ContentOverlayProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Title of overlay, appears in the header next to the close button.
|
|
10
10
|
*/
|
|
11
|
-
readonly title
|
|
11
|
+
readonly title?: string;
|
|
12
12
|
/**
|
|
13
13
|
* Optional accessibilityLabel describing the overlay.
|
|
14
14
|
* This will read out when the overlay is opened.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
2
|
+
import { action } from "storybook/actions";
|
|
2
3
|
import { EmptyState } from "@jobber/components-native";
|
|
3
4
|
|
|
4
5
|
const meta = {
|
|
@@ -19,13 +20,13 @@ export const Basic: Story = {
|
|
|
19
20
|
primaryAction: {
|
|
20
21
|
label: "Click Me",
|
|
21
22
|
onPress: () => {
|
|
22
|
-
alert("👋");
|
|
23
|
+
action("alert")("👋");
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
secondaryAction: {
|
|
26
27
|
label: "Don't Forget About Me",
|
|
27
28
|
onPress: () => {
|
|
28
|
-
alert("👋");
|
|
29
|
+
action("alert")("👋");
|
|
29
30
|
},
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
3
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
|
+
import { action } from "storybook/actions";
|
|
4
5
|
import {
|
|
5
6
|
AtlantisOverlayProvider,
|
|
6
7
|
Content,
|
|
@@ -37,7 +38,7 @@ const BasicTemplate = (args: Story["args"]) => (
|
|
|
37
38
|
onSubmit={value =>
|
|
38
39
|
new Promise(resolve => {
|
|
39
40
|
setTimeout(
|
|
40
|
-
() => resolve(alert(JSON.stringify(value, undefined))),
|
|
41
|
+
() => resolve(action("alert")(JSON.stringify(value, undefined))),
|
|
41
42
|
1000,
|
|
42
43
|
);
|
|
43
44
|
})
|
|
@@ -92,7 +93,7 @@ export const WithSecondaryActions: Story = {
|
|
|
92
93
|
handleAction: {
|
|
93
94
|
onSubmit: () =>
|
|
94
95
|
new Promise(resolve => {
|
|
95
|
-
setTimeout(() => resolve(alert("Base Case")), 1000);
|
|
96
|
+
setTimeout(() => resolve(action("alert")("Base Case")), 1000);
|
|
96
97
|
}),
|
|
97
98
|
},
|
|
98
99
|
icon: "email",
|
|
@@ -102,7 +103,7 @@ export const WithSecondaryActions: Story = {
|
|
|
102
103
|
handleAction: {
|
|
103
104
|
onSubmit: () =>
|
|
104
105
|
new Promise(resolve => {
|
|
105
|
-
setTimeout(() => resolve(alert("Base Case")), 1000);
|
|
106
|
+
setTimeout(() => resolve(action("alert")("Base Case")), 1000);
|
|
106
107
|
}),
|
|
107
108
|
},
|
|
108
109
|
icon: "trash",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
2
|
+
import { action } from "storybook/actions";
|
|
2
3
|
import { IconButton } from "@jobber/components-native";
|
|
3
4
|
|
|
4
5
|
const meta = {
|
|
@@ -15,6 +16,6 @@ export const Basic: Story = {
|
|
|
15
16
|
args: {
|
|
16
17
|
accessibilityLabel: "New Job",
|
|
17
18
|
name: "remove",
|
|
18
|
-
onPress: () => alert("👍"),
|
|
19
|
+
onPress: () => action("alert")("👍"),
|
|
19
20
|
},
|
|
20
21
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { action } from "storybook/actions";
|
|
3
4
|
import { InputPressable } from "@jobber/components-native";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -26,7 +27,7 @@ export const Basic: Story = {
|
|
|
26
27
|
args: {
|
|
27
28
|
placeholder: "Placeholder",
|
|
28
29
|
value: "Mango",
|
|
29
|
-
onPress: () => alert("👍"),
|
|
30
|
+
onPress: () => action("alert")("👍"),
|
|
30
31
|
},
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -35,7 +36,7 @@ export const PrefixOrSuffix: Story = {
|
|
|
35
36
|
placeholder: "Selected date",
|
|
36
37
|
value: "2021-01-01",
|
|
37
38
|
prefix: { icon: "calendar" },
|
|
38
|
-
onPress: () => alert("📅"),
|
|
39
|
+
onPress: () => action("alert")("📅"),
|
|
39
40
|
},
|
|
40
41
|
};
|
|
41
42
|
|
|
@@ -44,8 +45,8 @@ export const ClickableSuffix: Story = {
|
|
|
44
45
|
<InputPressable
|
|
45
46
|
placeholder="Placeholder"
|
|
46
47
|
value="input value"
|
|
47
|
-
onPress={() => alert("👍")}
|
|
48
|
-
suffix={{ icon: "dropdown", onPress: () => alert("👍") }}
|
|
48
|
+
onPress={() => action("alert")("👍")}
|
|
49
|
+
suffix={{ icon: "dropdown", onPress: () => action("alert")("👍") }}
|
|
49
50
|
/>
|
|
50
51
|
),
|
|
51
52
|
};
|