@jobber/components-native 0.94.0 → 0.95.1-CLEANUPfi-c27afbd.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/ProgressBar/ProgressBar.js +10 -6
- package/dist/src/ProgressBar/ProgressBarInner.js +3 -12
- package/dist/src/ProgressBar/ProgressBarStepped.js +7 -2
- package/dist/src/hooks/useFormController.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +4 -1
- package/dist/types/src/ProgressBar/ProgressBarStepped.d.ts +3 -1
- package/dist/types/src/ProgressBar/types.d.ts +20 -0
- package/package.json +2 -2
- package/src/Checkbox/Checkbox.test.tsx +118 -1
- package/src/ProgressBar/ProgressBar.test.tsx +109 -0
- package/src/ProgressBar/ProgressBar.tsx +17 -1
- package/src/ProgressBar/ProgressBarInner.tsx +7 -10
- package/src/ProgressBar/ProgressBarStepped.tsx +12 -1
- package/src/ProgressBar/__snapshots__/ProgressBar.test.tsx.snap +14 -0
- package/src/ProgressBar/types.ts +22 -0
- package/src/hooks/useFormController.ts +1 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.1-CLEANUPfi-c27afbd.0+c27afbdf1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"react-native-safe-area-context": "^5.4.0",
|
|
97
97
|
"react-native-svg": ">=12.0.0"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "c27afbdf1236cd8a23a64ef0be784c7b0f793ddb"
|
|
100
100
|
}
|
|
@@ -6,17 +6,21 @@ import { ProgressBarStepped } from "./ProgressBarStepped";
|
|
|
6
6
|
import { sizeStyles } from "./ProgressBar.size.style";
|
|
7
7
|
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
8
8
|
import { useAtlantisTheme } from "../AtlantisThemeContext";
|
|
9
|
-
export function ProgressBar({ loading, total, current, inProgress = 0, reverseTheme = false, header, variation = "progress", size = "base", }) {
|
|
9
|
+
export function ProgressBar({ loading, total, current, inProgress = 0, reverseTheme = false, header, variation = "progress", size = "base", UNSAFE_style, }) {
|
|
10
10
|
const { t } = useAtlantisI18n();
|
|
11
11
|
const styles = useStyles();
|
|
12
12
|
const { tokens } = useAtlantisTheme();
|
|
13
|
-
return (React.createElement(View, { accessible: true, accessibilityRole: "progressbar", accessibilityLabel: getA11yLabel() },
|
|
13
|
+
return (React.createElement(View, { accessible: true, accessibilityRole: "progressbar", accessibilityLabel: getA11yLabel(), style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.container },
|
|
14
14
|
header,
|
|
15
|
-
variation === "stepped" ? (React.createElement(ProgressBarStepped, { total: total, current: current, color: reverseTheme ? undefined : tokens["color-interactive--background"], loading: loading, inProgress: inProgress })) : (React.createElement(View, {
|
|
16
|
-
|
|
15
|
+
variation === "stepped" ? (React.createElement(ProgressBarStepped, { total: total, current: current, color: reverseTheme ? undefined : tokens["color-interactive--background"], loading: loading, inProgress: inProgress, UNSAFE_style: UNSAFE_style })) : (React.createElement(View, { testID: "progressbar-container", style: [
|
|
16
|
+
styles.progressBarContainer,
|
|
17
|
+
sizeStyles[size],
|
|
18
|
+
UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.progressBarContainer,
|
|
19
|
+
] },
|
|
20
|
+
React.createElement(ProgressBarInner, { testID: "progressbar-track", width: 100, animationDuration: 0, color: reverseTheme ? undefined : tokens["color-interactive--background"], style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.track }),
|
|
17
21
|
!loading && (React.createElement(React.Fragment, null,
|
|
18
|
-
inProgress && inProgress > 0 ? (React.createElement(ProgressBarInner, { width: calculateWidth(total, current + inProgress), color: tokens["color-informative"], animationDuration: 800 })) : (React.createElement(React.Fragment, null)),
|
|
19
|
-
React.createElement(ProgressBarInner, { width: calculateWidth(total, current), color: tokens["color-interactive"], animationDuration: 600 })))))));
|
|
22
|
+
inProgress && inProgress > 0 ? (React.createElement(ProgressBarInner, { testID: "progressbar-inprogress", width: calculateWidth(total, current + inProgress), color: tokens["color-informative"], animationDuration: 800, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.inProgressFill })) : (React.createElement(React.Fragment, null)),
|
|
23
|
+
React.createElement(ProgressBarInner, { testID: "progressbar-fill", width: calculateWidth(total, current), color: tokens["color-interactive"], animationDuration: 600, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.fill })))))));
|
|
20
24
|
function getA11yLabel() {
|
|
21
25
|
const a11yLabelValues = {
|
|
22
26
|
current: String(current),
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
// import Reanimated from "react-native-reanimated";
|
|
4
|
-
// import { useTiming } from "utils/reanimated";
|
|
5
3
|
import { useStyles } from "./ProgressBar.style";
|
|
6
|
-
export function ProgressBarInner({ width,
|
|
7
|
-
// animationDuration = 0,
|
|
8
|
-
color, }) {
|
|
9
|
-
// Animation breaking on Android
|
|
10
|
-
// const [animatedOpacity] = useTiming({
|
|
11
|
-
// duration: animationDuration,
|
|
12
|
-
// fromValue: 0,
|
|
13
|
-
// toValue: 1,
|
|
14
|
-
// });
|
|
4
|
+
export function ProgressBarInner({ width, color, style, testID, }) {
|
|
15
5
|
const styles = useStyles();
|
|
16
|
-
return (React.createElement(View, { style: [
|
|
6
|
+
return (React.createElement(View, { testID: testID, style: [
|
|
17
7
|
styles.progressBarInner,
|
|
18
8
|
Object.assign({ width: `${width}%` }, (color && { backgroundColor: color })),
|
|
9
|
+
style,
|
|
19
10
|
] }));
|
|
20
11
|
}
|
|
21
12
|
export function calculateWidth(total, current) {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { useStyles } from "./ProgressBar.style";
|
|
4
|
-
export function ProgressBarStepped({ total, current, color, loading, inProgress, }) {
|
|
4
|
+
export function ProgressBarStepped({ total, current, color, loading, inProgress, UNSAFE_style, }) {
|
|
5
5
|
const styles = useStyles();
|
|
6
|
-
return (React.createElement(View, {
|
|
6
|
+
return (React.createElement(View, { testID: "progressbar-container", style: [
|
|
7
|
+
styles.progressBarContainer,
|
|
8
|
+
{ height: 10 },
|
|
9
|
+
UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.progressBarContainer,
|
|
10
|
+
] }, Array.from({ length: total }).map((_, index) => {
|
|
7
11
|
const step = index + 1;
|
|
8
12
|
const isCompleted = step <= current;
|
|
9
13
|
const lastStep = step === total;
|
|
@@ -17,6 +21,7 @@ export function ProgressBarStepped({ total, current, color, loading, inProgress,
|
|
|
17
21
|
step <= inProgressSteps &&
|
|
18
22
|
styles.inProgressStep,
|
|
19
23
|
lastStep && { marginRight: 0 },
|
|
24
|
+
UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.step,
|
|
20
25
|
], testID: isCompleted
|
|
21
26
|
? "progress-step-completed"
|
|
22
27
|
: step <= inProgressSteps
|
|
@@ -13,7 +13,7 @@ export function useFormController({ name, value, validations, }) {
|
|
|
13
13
|
name: fieldName,
|
|
14
14
|
control,
|
|
15
15
|
rules: validations,
|
|
16
|
-
defaultValue: value
|
|
16
|
+
defaultValue: value !== null && value !== void 0 ? value : undefined,
|
|
17
17
|
});
|
|
18
18
|
// The naming convention established by react-hook-form for arrays of fields is, for example, "emails.0.description".
|
|
19
19
|
// Preserve original behavior: only treat three-part names as nested paths.
|