related-ui-components 4.0.5 → 4.0.6

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.
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import { useTheme } from "../../theme/ThemeContext.js";
4
- import React from "react";
4
+ import React, { useEffect } from "react";
5
5
  import { View, Text, StyleSheet } from "react-native";
6
+ import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing } from "react-native-reanimated";
6
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
8
  const ProgressBar = ({
8
9
  progress = 0.5,
@@ -21,7 +22,8 @@ const ProgressBar = ({
21
22
  textPosition = "inside",
22
23
  textAlign = "left",
23
24
  showText = true,
24
- isRTL = false
25
+ isRTL = false,
26
+ animationDuration = 500
25
27
  }) => {
26
28
  const {
27
29
  theme,
@@ -32,6 +34,18 @@ const ProgressBar = ({
32
34
  const remainingColor = remainingColorProp ?? theme.border;
33
35
  const textColor = textColorProp ?? theme.onPrimary;
34
36
  const clampedProgress = Math.min(Math.max(progress, 0), 1);
37
+ const progressWidth = useSharedValue(clampedProgress);
38
+ useEffect(() => {
39
+ progressWidth.value = withTiming(clampedProgress, {
40
+ duration: animationDuration,
41
+ easing: Easing.bezier(0.25, 0.1, 0.25, 1)
42
+ });
43
+ }, [clampedProgress, animationDuration, progressWidth]);
44
+ const animatedProgressStyle = useAnimatedStyle(() => {
45
+ return {
46
+ width: `${progressWidth.value * 100}%`
47
+ };
48
+ });
35
49
  return /*#__PURE__*/_jsxs(View, {
36
50
  style: [styles.container, containerStyle, {
37
51
  width
@@ -40,9 +54,7 @@ const ProgressBar = ({
40
54
  style: [styles.textAbove, {
41
55
  color: theme.text,
42
56
  textAlign
43
- },
44
- // Use theme.text for outside text
45
- textStyle],
57
+ }, textStyle],
46
58
  children: text
47
59
  }), /*#__PURE__*/_jsxs(View, {
48
60
  style: [styles.barContainer, {
@@ -50,24 +62,21 @@ const ProgressBar = ({
50
62
  borderRadius,
51
63
  backgroundColor: remainingColor
52
64
  }, barContainerStyle],
53
- children: [/*#__PURE__*/_jsx(View, {
65
+ children: [/*#__PURE__*/_jsx(Animated.View, {
54
66
  style: [styles.progressBar, isRTL ? {
55
67
  right: 0
56
68
  } : {
57
69
  left: 0
58
70
  }, {
59
- width: `${clampedProgress * 100}%`,
60
71
  height: "100%",
61
72
  borderRadius,
62
73
  backgroundColor: progressColor
63
- }, progressStyle]
74
+ }, progressStyle, animatedProgressStyle]
64
75
  }), textPosition === "inside" && showText && /*#__PURE__*/_jsx(Text, {
65
76
  style: [styles.textInside, {
66
77
  color: textColor,
67
78
  textAlign
68
- },
69
- // Use determined textColor for inside
70
- textStyle],
79
+ }, textStyle],
71
80
  children: text
72
81
  })]
73
82
  }), textPosition === "below" && showText && /*#__PURE__*/_jsx(Text, {
@@ -75,9 +84,7 @@ const ProgressBar = ({
75
84
  style: [styles.textBelow, {
76
85
  color: theme.text,
77
86
  textAlign
78
- },
79
- // Use theme.text for outside text
80
- textStyle],
87
+ }, textStyle],
81
88
  children: text
82
89
  })]
83
90
  });
@@ -1 +1 @@
1
- {"version":3,"names":["useTheme","React","View","Text","StyleSheet","jsx","_jsx","jsxs","_jsxs","ProgressBar","progress","text","containerStyle","barContainerStyle","progressStyle","remainingStyle","textStyle","progressColor","progressColorProp","remainingColor","remainingColorProp","textColor","textColorProp","height","width","borderRadius","textPosition","textAlign","showText","isRTL","theme","rtl","primary","border","onPrimary","clampedProgress","Math","min","max","style","styles","container","children","textAbove","color","barContainer","backgroundColor","progressBar","right","left","textInside","numberOfLines","textBelow","create","justifyContent","overflow","position","top","bottom","textAlignVertical","paddingHorizontal","fontWeight","marginBottom","marginTop"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/ProgressBar/ProgressBar.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,6BAA0B;AACnD,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EA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AE;IACTjB,KAAK,EAAE,MAAM;IACb8B,cAAc,EAAE;EAClB,CAAC;EACDT,YAAY,EAAE;IACZrB,KAAK,EAAE,MAAM;IACb+B,QAAQ,EAAE,QAAQ;IAClBC,QAAQ,EAAE;EACZ,CAAC;EACDT,WAAW,EAAE;IACXS,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE;EACP,CAAC;EACDP,UAAU,EAAE;IACVM,QAAQ,EAAE,UAAU;IACpBP,IAAI,EAAE,CAAC;IACPD,KAAK,EAAE,CAAC;IACRS,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACT/B,SAAS,EAAE,QAAQ;IACnBgC,iBAAiB,EAAE,QAAQ;IAC3BC,iBAAiB,EAAE,EAAE;IACrBC,UAAU,EAAE;EACd,CAAC;EACDlB,SAAS,EAAE;IACTmB,YAAY,EAAE,CAAC;IACfD,UAAU,EAAE;EACd,CAAC;EACDT,SAAS,EAAE;IACTW,SAAS,EAAE,CAAC;IACZF,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAepD,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["useTheme","React","useEffect","View","Text","StyleSheet","Animated","useSharedValue","useAnimatedStyle","withTiming","Easing","jsx","_jsx","jsxs","_jsxs","ProgressBar","progress","text","containerStyle","barContainerStyle","progressStyle","remainingStyle","textStyle","progressColor","progressColorProp","remainingColor","remainingColorProp","textColor","textColorProp","height","width","borderRadius","textPosition","textAlign","showText","isRTL","animationDuration","theme","rtl","primary","border","onPrimary","clampedProgress","Math","min","max","progressWidth","value","duration","easing","bezier","animatedProgressStyle","style","styles","container","children","textAbove","color","barContainer","backgroundColor","progressBar","right","left","textInside","numberOfLines","textBelow","create","justifyContent","overflow","position","top","bottom","textAlignVertical","paddingHorizontal","fontWeight","marginBottom","marginTop"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/ProgressBar/ProgressBar.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,6BAA0B;AACnD,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DT,SAAS,EAAE;IACTW,SAAS,EAAE,CAAC;IACZF,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAe3D,WAAW","ignoreList":[]}
@@ -20,6 +20,7 @@ interface ProgressBarProps {
20
20
  textAlign?: "center" | "left" | "right";
21
21
  showText?: boolean;
22
22
  isRTL?: boolean;
23
+ animationDuration?: number;
23
24
  }
24
25
  declare const ProgressBar: React.FC<ProgressBarProps>;
25
26
  export default ProgressBar;
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AACnE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/D,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;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AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6G3C,CAAC;AAqCF,eAAe,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "related-ui-components",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "main": "./src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -18,24 +18,24 @@
18
18
  "@shopify/react-native-skia": ">=v2.0.0-next.4",
19
19
  "country-telephone-data": ">=0.6.3",
20
20
  "date-fns": ">=4.1.0",
21
+ "expo": ">=52.0.0",
21
22
  "expo-checkbox": ">=4.1.4",
22
23
  "expo-clipboard": ">=7.1.4",
23
24
  "expo-image": ">=2.4.0",
24
25
  "expo-linear-gradient": ">=14.1.5",
25
26
  "expo-status-bar": ">=2.2.3",
26
- "expo": ">=52.0.0",
27
27
  "react": ">=18.0.0",
28
28
  "react-native": ">=0.79.0",
29
29
  "react-native-calendars": ">=1.1312.0",
30
30
  "react-native-color-matrix-image-filters": ">=7.0.2",
31
31
  "react-native-gesture-handler": ">=2.24.0",
32
+ "react-native-keyboard-controller": "^1.18.0",
32
33
  "react-native-picker-select": ">=9.3.1",
33
34
  "react-native-qrcode-svg": ">=6.3.15",
34
35
  "react-native-reanimated": ">=3.0.0",
35
36
  "react-native-safe-area-context": ">=5.4.0",
36
37
  "react-native-svg": ">=15.11.2",
37
- "react-native-toast-message": ">=2.3.3",
38
- "react-native-keyboard-controller": "^1.18.0"
38
+ "react-native-toast-message": ">=2.3.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@babel/core": "^7.25.2",
@@ -77,5 +77,8 @@
77
77
  "eslintIgnore": [
78
78
  "node_modules/",
79
79
  "lib/"
80
- ]
80
+ ],
81
+ "dependencies": {
82
+ "related-ui-components": "^4.0.5"
83
+ }
81
84
  }
@@ -1,6 +1,12 @@
1
1
  import { useTheme } from "../../theme/ThemeContext";
2
- import React from "react";
2
+ import React, { useEffect } from "react";
3
3
  import { View, Text, StyleSheet, ViewStyle, TextStyle } from "react-native";
4
+ import Animated, {
5
+ useSharedValue,
6
+ useAnimatedStyle,
7
+ withTiming,
8
+ Easing,
9
+ } from "react-native-reanimated";
4
10
 
5
11
  export type ProgressBarTextPosition = "inside" | "above" | "below";
6
12
  export type ProgressBarTextAlign = "center" | "left" | "right";
@@ -23,6 +29,7 @@ interface ProgressBarProps {
23
29
  textAlign?: "center" | "left" | "right";
24
30
  showText?: boolean;
25
31
  isRTL?: boolean;
32
+ animationDuration?: number;
26
33
  }
27
34
 
28
35
  const ProgressBar: React.FC<ProgressBarProps> = ({
@@ -43,8 +50,9 @@ const ProgressBar: React.FC<ProgressBarProps> = ({
43
50
  textAlign = "left",
44
51
  showText = true,
45
52
  isRTL = false,
53
+ animationDuration = 500,
46
54
  }) => {
47
- const {theme, isRTL : rtl} = useTheme();
55
+ const { theme, isRTL: rtl } = useTheme();
48
56
  isRTL = rtl;
49
57
  const progressColor = progressColorProp ?? theme.primary;
50
58
  const remainingColor = remainingColorProp ?? theme.border;
@@ -52,13 +60,28 @@ const ProgressBar: React.FC<ProgressBarProps> = ({
52
60
 
53
61
  const clampedProgress: number = Math.min(Math.max(progress, 0), 1);
54
62
 
63
+ const progressWidth = useSharedValue(clampedProgress);
64
+
65
+ useEffect(() => {
66
+ progressWidth.value = withTiming(clampedProgress, {
67
+ duration: animationDuration,
68
+ easing: Easing.bezier(0.25, 0.1, 0.25, 1),
69
+ });
70
+ }, [clampedProgress, animationDuration, progressWidth]);
71
+
72
+ const animatedProgressStyle = useAnimatedStyle(() => {
73
+ return {
74
+ width: `${progressWidth.value * 100}%`,
75
+ };
76
+ });
77
+
55
78
  return (
56
79
  <View style={[styles.container, containerStyle, { width }]}>
57
80
  {textPosition === "above" && showText && (
58
81
  <Text
59
82
  style={[
60
83
  styles.textAbove,
61
- { color: theme.text, textAlign }, // Use theme.text for outside text
84
+ { color: theme.text, textAlign },
62
85
  textStyle,
63
86
  ]}
64
87
  >
@@ -77,17 +100,17 @@ const ProgressBar: React.FC<ProgressBarProps> = ({
77
100
  barContainerStyle,
78
101
  ]}
79
102
  >
80
- <View
103
+ <Animated.View
81
104
  style={[
82
105
  styles.progressBar,
83
106
  isRTL ? { right: 0 } : { left: 0 },
84
107
  {
85
- width: `${clampedProgress * 100}%`,
86
108
  height: "100%",
87
109
  borderRadius,
88
110
  backgroundColor: progressColor,
89
111
  },
90
112
  progressStyle,
113
+ animatedProgressStyle,
91
114
  ]}
92
115
  />
93
116
 
@@ -95,7 +118,7 @@ const ProgressBar: React.FC<ProgressBarProps> = ({
95
118
  <Text
96
119
  style={[
97
120
  styles.textInside,
98
- { color: textColor, textAlign }, // Use determined textColor for inside
121
+ { color: textColor, textAlign },
99
122
  textStyle,
100
123
  ]}
101
124
  >
@@ -109,7 +132,7 @@ const ProgressBar: React.FC<ProgressBarProps> = ({
109
132
  numberOfLines={1}
110
133
  style={[
111
134
  styles.textBelow,
112
- { color: theme.text, textAlign }, // Use theme.text for outside text
135
+ { color: theme.text, textAlign },
113
136
  textStyle,
114
137
  ]}
115
138
  >
@@ -155,4 +178,4 @@ const styles = StyleSheet.create({
155
178
  },
156
179
  });
157
180
 
158
- export default ProgressBar;
181
+ export default ProgressBar;