@jobber/components-native 0.49.2 → 0.51.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 -3
- package/dist/src/InputFieldWrapper/index.js +0 -1
- package/dist/src/InputPressable/InputPressable.js +2 -1
- package/dist/src/InputText/InputText.js +2 -1
- package/dist/src/ProgressBar/ProgressBar.js +4 -3
- package/dist/src/ProgressBar/ProgressBar.style.js +13 -0
- package/dist/src/ProgressBar/ProgressBarStepped.js +21 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/InputDate/InputDate.d.ts +2 -1
- package/dist/types/src/InputFieldWrapper/index.d.ts +1 -2
- package/dist/types/src/InputPressable/InputPressable.d.ts +1 -1
- package/dist/types/src/InputText/InputText.d.ts +1 -1
- package/dist/types/src/InputTime/InputTime.d.ts +2 -1
- package/dist/types/src/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/types/src/ProgressBar/ProgressBar.style.d.ts +13 -0
- package/dist/types/src/ProgressBar/ProgressBarStepped.d.ts +10 -0
- package/dist/types/src/ProgressBar/types.d.ts +7 -1
- package/package.json +3 -3
- package/src/InputDate/InputDate.tsx +3 -1
- package/src/InputFieldWrapper/InputFieldWrapper.tsx +5 -4
- package/src/InputFieldWrapper/index.ts +1 -2
- package/src/InputPressable/InputPressable.tsx +2 -6
- package/src/InputText/InputText.tsx +2 -5
- package/src/InputTime/InputTime.tsx +4 -1
- package/src/ProgressBar/ProgressBar.style.ts +13 -0
- package/src/ProgressBar/ProgressBar.test.tsx +40 -1
- package/src/ProgressBar/ProgressBar.tsx +35 -21
- package/src/ProgressBar/ProgressBarStepped.tsx +47 -0
- package/src/ProgressBar/types.ts +8 -1
- package/dist/src/InputFieldWrapper/hooks/useShowClear.js +0 -15
- package/dist/types/src/InputFieldWrapper/hooks/useShowClear.d.ts +0 -10
- package/src/InputFieldWrapper/hooks/useShowClear.test.ts +0 -158
- package/src/InputFieldWrapper/hooks/useShowClear.ts +0 -31
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@jobber/design": "^0.51.0",
|
|
40
|
-
"@jobber/hooks": "^2.
|
|
40
|
+
"@jobber/hooks": "^2.8.0",
|
|
41
41
|
"@react-native-clipboard/clipboard": "^1.11.2",
|
|
42
42
|
"@react-native-picker/picker": "^2.4.10",
|
|
43
43
|
"autolinker": "^4.0.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"react-native-reanimated": "^2.17.0",
|
|
85
85
|
"react-native-safe-area-context": "^4.5.2"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "7096004da05ede6fff2bfaaed572b3e91a9ee1d9"
|
|
88
88
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef, useEffect, useState } from "react";
|
|
2
2
|
import { Text as NativeText, Pressable } from "react-native";
|
|
3
|
+
import { useShowClear } from "@jobber/hooks";
|
|
3
4
|
import { styles } from "./InputPressable.style";
|
|
4
|
-
import { InputFieldWrapper, commonInputStyles
|
|
5
|
+
import { InputFieldWrapper, commonInputStyles } from "../InputFieldWrapper";
|
|
5
6
|
export const InputPressable = forwardRef(InputPressableInternal);
|
|
6
7
|
export function InputPressableInternal({ value, placeholder, disabled, invalid, error, onPress, accessibilityLabel, accessibilityHint, prefix, suffix, clearable = "never", onClear, }, ref) {
|
|
7
8
|
const hasValue = !!value;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
|
|
2
2
|
import { Platform, TextInput, } from "react-native";
|
|
3
3
|
import identity from "lodash/identity";
|
|
4
|
+
import { useShowClear } from "@jobber/hooks";
|
|
4
5
|
import { styles } from "./InputText.style";
|
|
5
6
|
import { useInputAccessoriesContext } from "./context";
|
|
6
7
|
import { useFormController } from "../hooks";
|
|
7
|
-
import { InputFieldWrapper
|
|
8
|
+
import { InputFieldWrapper } from "../InputFieldWrapper";
|
|
8
9
|
import { commonInputStyles } from "../InputFieldWrapper/CommonInputStyles.style";
|
|
9
10
|
export const InputText = forwardRef(InputTextInternal);
|
|
10
11
|
// eslint-disable-next-line max-statements
|
|
@@ -2,17 +2,18 @@ import React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { styles } from "./ProgressBar.style";
|
|
4
4
|
import { ProgressBarInner, calculateWidth } from "./ProgressBarInner";
|
|
5
|
+
import { ProgressBarStepped } from "./ProgressBarStepped";
|
|
5
6
|
import { tokens } from "../utils/design";
|
|
6
7
|
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
7
|
-
export function ProgressBar({ loading, total, current, inProgress = 0, reverseTheme = false, header, }) {
|
|
8
|
+
export function ProgressBar({ loading, total, current, inProgress = 0, reverseTheme = false, header, variation = "progress", }) {
|
|
8
9
|
const { t } = useAtlantisI18n();
|
|
9
10
|
return (React.createElement(View, { accessible: true, accessibilityRole: "progressbar", accessibilityLabel: getA11yLabel() },
|
|
10
11
|
header,
|
|
11
|
-
React.createElement(View, { style: styles.progressBarContainer },
|
|
12
|
+
variation === "stepped" ? (React.createElement(ProgressBarStepped, { total: total, current: current, color: reverseTheme ? undefined : tokens["color-surface--background"], loading: loading, inProgress: inProgress })) : (React.createElement(View, { style: styles.progressBarContainer },
|
|
12
13
|
React.createElement(ProgressBarInner, { width: 100, animationDuration: 0, color: reverseTheme ? undefined : tokens["color-surface--background"] }),
|
|
13
14
|
!loading && (React.createElement(React.Fragment, null,
|
|
14
15
|
inProgress && inProgress > 0 ? (React.createElement(ProgressBarInner, { width: calculateWidth(total, current + inProgress), color: tokens["color-informative"], animationDuration: 800 })) : (React.createElement(React.Fragment, null)),
|
|
15
|
-
React.createElement(ProgressBarInner, { width: calculateWidth(total, current), color: tokens["color-interactive"], animationDuration: 600 }))))));
|
|
16
|
+
React.createElement(ProgressBarInner, { width: calculateWidth(total, current), color: tokens["color-interactive"], animationDuration: 600 })))))));
|
|
16
17
|
function getA11yLabel() {
|
|
17
18
|
const a11yLabelValues = {
|
|
18
19
|
current: String(current),
|
|
@@ -21,4 +21,17 @@ export const styles = StyleSheet.create({
|
|
|
21
21
|
height: "100%",
|
|
22
22
|
borderRadius: 100,
|
|
23
23
|
},
|
|
24
|
+
step: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
marginRight: tokens["space-small"],
|
|
27
|
+
height: "100%",
|
|
28
|
+
borderRadius: 100,
|
|
29
|
+
borderColor: "rgba(255,255,255,0.3)",
|
|
30
|
+
},
|
|
31
|
+
completedStep: {
|
|
32
|
+
backgroundColor: tokens["color-interactive"],
|
|
33
|
+
},
|
|
34
|
+
inProgressStep: {
|
|
35
|
+
backgroundColor: tokens["color-informative"],
|
|
36
|
+
},
|
|
24
37
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { styles } from "./ProgressBar.style";
|
|
4
|
+
export function ProgressBarStepped({ total, current, color, loading, inProgress, }) {
|
|
5
|
+
return (React.createElement(View, { style: [styles.progressBarContainer, { height: 10 }] }, Array.from({ length: total }).map((_, index) => {
|
|
6
|
+
const step = index + 1;
|
|
7
|
+
const isCompleted = step <= current;
|
|
8
|
+
const lastStep = step === total;
|
|
9
|
+
const inProgressSteps = current + (inProgress || 0);
|
|
10
|
+
return (React.createElement(View, { key: step, style: [
|
|
11
|
+
styles.step,
|
|
12
|
+
Object.assign({}, (color && { backgroundColor: color })),
|
|
13
|
+
!loading && isCompleted && styles.completedStep,
|
|
14
|
+
!loading &&
|
|
15
|
+
!isCompleted &&
|
|
16
|
+
step <= inProgressSteps &&
|
|
17
|
+
styles.inProgressStep,
|
|
18
|
+
lastStep && { marginRight: 0 },
|
|
19
|
+
], testID: "progress-step" }));
|
|
20
|
+
})));
|
|
21
|
+
}
|