@jobber/components-native 0.79.1-scotttth-41260d5.56 → 0.80.1-upgrade-to-628d7fc.9
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/Content/Content.js +7 -5
- package/dist/src/Form/Form.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/AtlantisThemeContext/AtlantisThemeContext.d.ts +2 -1
- package/dist/types/src/Content/Content.d.ts +12 -1
- package/dist/types/src/Glimmer/Glimmer.d.ts +2 -1
- package/dist/types/src/ProgressBar/ProgressBarStepped.d.ts +2 -1
- package/dist/types/src/ThumbnailList/types.d.ts +1 -1
- package/jestSetup.js +1 -0
- package/package.json +2 -2
- package/src/Content/Content.test.tsx +79 -1
- package/src/Content/Content.tsx +25 -5
- package/src/Form/Form.test.tsx +1 -1
- package/src/Form/Form.tsx +1 -0
- package/src/Switch/components/BaseSwitch/__snapshots__/BaseSwitch.test.tsx.snap +6 -6
- package/src/TextList/__snapshots__/TextList.test.tsx.snap +3 -0
- package/src/ThumbnailList/types.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { AtlantisThemeContextProviderProps, AtlantisThemeContextValue } from "./types";
|
|
2
|
-
export declare function AtlantisThemeContextProvider({ children, dangerouslyOverrideTheme, }: AtlantisThemeContextProviderProps): JSX.Element;
|
|
3
|
+
export declare function AtlantisThemeContextProvider({ children, dangerouslyOverrideTheme, }: AtlantisThemeContextProviderProps): React.JSX.Element;
|
|
3
4
|
export declare function useAtlantisTheme(): AtlantisThemeContextValue;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
export type Spacing = "none" | "base" | "small" | "smaller" | "smallest" | "large";
|
|
4
|
+
export interface ContentUnsafeStyle {
|
|
5
|
+
container?: StyleProp<ViewStyle>;
|
|
6
|
+
childWrapper?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
3
8
|
export interface ContentProps {
|
|
4
9
|
/**
|
|
5
10
|
* The child or children that will be given spacing.
|
|
@@ -14,5 +19,11 @@ export interface ContentProps {
|
|
|
14
19
|
*/
|
|
15
20
|
readonly childSpacing?: Spacing;
|
|
16
21
|
readonly direction?: "horizontal" | "vertical";
|
|
22
|
+
/**
|
|
23
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
24
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
25
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
26
|
+
*/
|
|
27
|
+
readonly UNSAFE_style?: ContentUnsafeStyle;
|
|
17
28
|
}
|
|
18
|
-
export declare function Content({ children, spacing, childSpacing, direction, }: ContentProps): JSX.Element;
|
|
29
|
+
export declare function Content({ children, spacing, childSpacing, direction, UNSAFE_style, }: ContentProps): JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { useSizeStyles } from "./Glimmer.size.style";
|
|
2
3
|
import { useShapeStyles } from "./Glimmer.shape.style";
|
|
3
4
|
export type GlimmerShapes = keyof ReturnType<typeof useShapeStyles>;
|
|
@@ -26,5 +27,5 @@ interface GlimmerProps {
|
|
|
26
27
|
}
|
|
27
28
|
export declare const GLIMMER_TEST_ID = "ATL-Glimmer";
|
|
28
29
|
export declare const GLIMMER_SHINE_TEST_ID = "ATL-Glimmer-Shine";
|
|
29
|
-
export declare function Glimmer({ width, shape, size, timing, }: GlimmerProps): JSX.Element;
|
|
30
|
+
export declare function Glimmer({ width, shape, size, timing, }: GlimmerProps): React.JSX.Element;
|
|
30
31
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
interface ProgressBarSteppedProps {
|
|
2
3
|
readonly total: number;
|
|
3
4
|
readonly current: number;
|
|
@@ -5,5 +6,5 @@ interface ProgressBarSteppedProps {
|
|
|
5
6
|
readonly loading?: boolean;
|
|
6
7
|
readonly inProgress?: number;
|
|
7
8
|
}
|
|
8
|
-
export declare function ProgressBarStepped({ total, current, color, loading, inProgress, }: ProgressBarSteppedProps): JSX.Element;
|
|
9
|
+
export declare function ProgressBarStepped({ total, current, color, loading, inProgress, }: ProgressBarSteppedProps): React.JSX.Element;
|
|
9
10
|
export {};
|
package/jestSetup.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.1-upgrade-to-628d7fc.9+628d7fce",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"react-native-safe-area-context": "^4.5.2",
|
|
81
81
|
"react-native-svg": ">=12.0.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "628d7fce6ac350b6413ea59704847aef6f1cf062"
|
|
84
84
|
}
|
|
@@ -21,7 +21,10 @@ function getContentChildren(contentView: ReactTestInstance) {
|
|
|
21
21
|
const text = "🌚 I am the text 🌞";
|
|
22
22
|
|
|
23
23
|
function setupContent(
|
|
24
|
-
props?: Pick<
|
|
24
|
+
props?: Pick<
|
|
25
|
+
ContentProps,
|
|
26
|
+
"spacing" | "childSpacing" | "direction" | "UNSAFE_style"
|
|
27
|
+
>,
|
|
25
28
|
) {
|
|
26
29
|
const container = render(
|
|
27
30
|
<View accessibilityLabel="contentView">
|
|
@@ -29,6 +32,7 @@ function setupContent(
|
|
|
29
32
|
spacing={props?.spacing}
|
|
30
33
|
childSpacing={props?.childSpacing}
|
|
31
34
|
direction={props?.direction}
|
|
35
|
+
UNSAFE_style={props?.UNSAFE_style}
|
|
32
36
|
>
|
|
33
37
|
<Text>{text}</Text>
|
|
34
38
|
<Text>{text}</Text>
|
|
@@ -269,3 +273,77 @@ describe("Horizontal", () => {
|
|
|
269
273
|
});
|
|
270
274
|
});
|
|
271
275
|
});
|
|
276
|
+
|
|
277
|
+
describe("UNSAFE_style", () => {
|
|
278
|
+
it("applies custom styles to container", () => {
|
|
279
|
+
const customStyle = {
|
|
280
|
+
backgroundColor: "red",
|
|
281
|
+
padding: 16,
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const { parentView } = setupContent({
|
|
285
|
+
UNSAFE_style: {
|
|
286
|
+
container: customStyle,
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
const contentView = getContentComponent(parentView);
|
|
291
|
+
expect(contentView.props.style).toEqual(
|
|
292
|
+
expect.arrayContaining([expect.objectContaining(customStyle)]),
|
|
293
|
+
);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it("applies custom styles to child wrapper", () => {
|
|
297
|
+
const customStyle = {
|
|
298
|
+
backgroundColor: "blue",
|
|
299
|
+
marginLeft: 8,
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const { parentView } = setupContent({
|
|
303
|
+
UNSAFE_style: {
|
|
304
|
+
childWrapper: customStyle,
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
const contentView = getContentComponent(parentView);
|
|
309
|
+
const contentChildren = getContentChildren(contentView);
|
|
310
|
+
|
|
311
|
+
contentChildren.forEach(child => {
|
|
312
|
+
expect(child.props.style).toEqual(
|
|
313
|
+
expect.arrayContaining([expect.objectContaining(customStyle)]),
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
it("applies custom styles to both container and child wrapper", () => {
|
|
319
|
+
const containerStyle = {
|
|
320
|
+
backgroundColor: "red",
|
|
321
|
+
padding: 16,
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const childWrapperStyle = {
|
|
325
|
+
backgroundColor: "blue",
|
|
326
|
+
marginLeft: 8,
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const { parentView } = setupContent({
|
|
330
|
+
UNSAFE_style: {
|
|
331
|
+
container: containerStyle,
|
|
332
|
+
childWrapper: childWrapperStyle,
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
const contentView = getContentComponent(parentView);
|
|
337
|
+
const contentChildren = getContentChildren(contentView);
|
|
338
|
+
|
|
339
|
+
expect(contentView.props.style).toEqual(
|
|
340
|
+
expect.arrayContaining([expect.objectContaining(containerStyle)]),
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
contentChildren.forEach(child => {
|
|
344
|
+
expect(child.props.style).toEqual(
|
|
345
|
+
expect.arrayContaining([expect.objectContaining(childWrapperStyle)]),
|
|
346
|
+
);
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
});
|
package/src/Content/Content.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
2
|
+
import { StyleProp, View, ViewStyle } from "react-native";
|
|
3
3
|
import { useHorizontalStyles } from "./ContentHorizontal.style";
|
|
4
4
|
import { useVerticalStyles } from "./ContentVertical.style";
|
|
5
5
|
import { useSpaceAroundStyles } from "./ContentSpaceAround.style";
|
|
@@ -12,6 +12,11 @@ export type Spacing =
|
|
|
12
12
|
| "smallest"
|
|
13
13
|
| "large";
|
|
14
14
|
|
|
15
|
+
export interface ContentUnsafeStyle {
|
|
16
|
+
container?: StyleProp<ViewStyle>;
|
|
17
|
+
childWrapper?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
export interface ContentProps {
|
|
16
21
|
/**
|
|
17
22
|
* The child or children that will be given spacing.
|
|
@@ -29,6 +34,13 @@ export interface ContentProps {
|
|
|
29
34
|
readonly childSpacing?: Spacing;
|
|
30
35
|
|
|
31
36
|
readonly direction?: "horizontal" | "vertical";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
40
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
41
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
42
|
+
*/
|
|
43
|
+
readonly UNSAFE_style?: ContentUnsafeStyle;
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
export function Content({
|
|
@@ -36,6 +48,7 @@ export function Content({
|
|
|
36
48
|
spacing = "base",
|
|
37
49
|
childSpacing = "base",
|
|
38
50
|
direction = "vertical",
|
|
51
|
+
UNSAFE_style,
|
|
39
52
|
}: ContentProps): JSX.Element {
|
|
40
53
|
const horizontalStyles = useHorizontalStyles();
|
|
41
54
|
const verticalStyles = useVerticalStyles();
|
|
@@ -46,7 +59,9 @@ export function Content({
|
|
|
46
59
|
const containerStyle = spaceAroundStyles[styleName];
|
|
47
60
|
|
|
48
61
|
return (
|
|
49
|
-
<View style={[styles.wrapper, containerStyle]}>
|
|
62
|
+
<View style={[styles.wrapper, containerStyle, UNSAFE_style?.container]}>
|
|
63
|
+
{renderChildren()}
|
|
64
|
+
</View>
|
|
50
65
|
);
|
|
51
66
|
|
|
52
67
|
function renderChildren() {
|
|
@@ -57,12 +72,17 @@ export function Content({
|
|
|
57
72
|
const childContainerStyle = styles[spaceName];
|
|
58
73
|
|
|
59
74
|
return childArray.map((child, index) => {
|
|
60
|
-
// In order to get spacing between the children, we apply the child spacing on each of
|
|
61
|
-
// the children except for the first (top) child
|
|
62
75
|
const childStyle = index !== 0 ? [childContainerStyle] : [];
|
|
63
76
|
|
|
64
77
|
return (
|
|
65
|
-
<View
|
|
78
|
+
<View
|
|
79
|
+
key={index}
|
|
80
|
+
style={[
|
|
81
|
+
styles.childWrapper,
|
|
82
|
+
...childStyle,
|
|
83
|
+
UNSAFE_style?.childWrapper,
|
|
84
|
+
]}
|
|
85
|
+
>
|
|
66
86
|
{child}
|
|
67
87
|
</View>
|
|
68
88
|
);
|
package/src/Form/Form.test.tsx
CHANGED
|
@@ -545,7 +545,7 @@ describe("Form", () => {
|
|
|
545
545
|
});
|
|
546
546
|
|
|
547
547
|
describe("Safe Area", () => {
|
|
548
|
-
it("does render a safe area when there's
|
|
548
|
+
it("does render a safe area when there's NO saveButtonOffset provided", () => {
|
|
549
549
|
const { getByTestId } = render(<FormTest onSubmit={onSubmitMock} />);
|
|
550
550
|
|
|
551
551
|
expect(getByTestId("ATL-FormSafeArea")).toBeDefined();
|
package/src/Form/Form.tsx
CHANGED
|
@@ -11,7 +11,7 @@ exports[`renders a Switch with defaultValue false 1`] = `
|
|
|
11
11
|
}
|
|
12
12
|
collapsable={false}
|
|
13
13
|
disabled={false}
|
|
14
|
-
handlerTag={
|
|
14
|
+
handlerTag={-1}
|
|
15
15
|
handlerType="NativeViewGestureHandler"
|
|
16
16
|
onChange={[Function]}
|
|
17
17
|
onGestureHandlerEvent={[Function]}
|
|
@@ -47,7 +47,7 @@ exports[`renders a Switch with defaultValue true 1`] = `
|
|
|
47
47
|
}
|
|
48
48
|
collapsable={false}
|
|
49
49
|
disabled={false}
|
|
50
|
-
handlerTag={
|
|
50
|
+
handlerTag={-1}
|
|
51
51
|
handlerType="NativeViewGestureHandler"
|
|
52
52
|
onChange={[Function]}
|
|
53
53
|
onGestureHandlerEvent={[Function]}
|
|
@@ -83,7 +83,7 @@ exports[`renders a Switch with value false 1`] = `
|
|
|
83
83
|
}
|
|
84
84
|
collapsable={false}
|
|
85
85
|
disabled={false}
|
|
86
|
-
handlerTag={
|
|
86
|
+
handlerTag={-1}
|
|
87
87
|
handlerType="NativeViewGestureHandler"
|
|
88
88
|
onChange={[Function]}
|
|
89
89
|
onGestureHandlerEvent={[Function]}
|
|
@@ -119,7 +119,7 @@ exports[`renders a Switch with value true 1`] = `
|
|
|
119
119
|
}
|
|
120
120
|
collapsable={false}
|
|
121
121
|
disabled={false}
|
|
122
|
-
handlerTag={1}
|
|
122
|
+
handlerTag={-1}
|
|
123
123
|
handlerType="NativeViewGestureHandler"
|
|
124
124
|
onChange={[Function]}
|
|
125
125
|
onGestureHandlerEvent={[Function]}
|
|
@@ -155,7 +155,7 @@ exports[`renders a disabled Switch with value false 1`] = `
|
|
|
155
155
|
}
|
|
156
156
|
collapsable={false}
|
|
157
157
|
disabled={true}
|
|
158
|
-
handlerTag={
|
|
158
|
+
handlerTag={-1}
|
|
159
159
|
handlerType="NativeViewGestureHandler"
|
|
160
160
|
onChange={[Function]}
|
|
161
161
|
onGestureHandlerEvent={[Function]}
|
|
@@ -191,7 +191,7 @@ exports[`renders a disabled Switch with value true 1`] = `
|
|
|
191
191
|
}
|
|
192
192
|
collapsable={false}
|
|
193
193
|
disabled={true}
|
|
194
|
-
handlerTag={
|
|
194
|
+
handlerTag={-1}
|
|
195
195
|
handlerType="NativeViewGestureHandler"
|
|
196
196
|
onChange={[Function]}
|
|
197
197
|
onGestureHandlerEvent={[Function]}
|
|
@@ -16,6 +16,7 @@ exports[`TextList when the bulletItems is provided displays the text list 1`] =
|
|
|
16
16
|
{
|
|
17
17
|
"padding": 0,
|
|
18
18
|
},
|
|
19
|
+
undefined,
|
|
19
20
|
]
|
|
20
21
|
}
|
|
21
22
|
>
|
|
@@ -23,6 +24,7 @@ exports[`TextList when the bulletItems is provided displays the text list 1`] =
|
|
|
23
24
|
style={
|
|
24
25
|
[
|
|
25
26
|
{},
|
|
27
|
+
undefined,
|
|
26
28
|
]
|
|
27
29
|
}
|
|
28
30
|
>
|
|
@@ -114,6 +116,7 @@ exports[`TextList when the bulletItems is provided displays the text list 1`] =
|
|
|
114
116
|
{
|
|
115
117
|
"padding": 0,
|
|
116
118
|
},
|
|
119
|
+
undefined,
|
|
117
120
|
]
|
|
118
121
|
}
|
|
119
122
|
>
|