@artsy/palette-mobile 11.0.15 → 11.0.16

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v11.0.16 (Tue Apr 18 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - feat(progress-bar): Add `animationDuration` prop [#89](https://github.com/artsy/palette-mobile/pull/89) ([@damassi](https://github.com/damassi))
6
+
7
+ #### Authors: 1
8
+
9
+ - Christopher Pappas ([@damassi](https://github.com/damassi))
10
+
11
+ ---
12
+
1
13
  # v11.0.15 (Fri Apr 14 2023)
2
14
 
3
15
  #### 🐛 Bug Fix
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { Color } from "../../types";
3
3
  export interface ProgressBarProps {
4
- progress: number;
5
- height?: number;
6
- trackColor?: Color;
4
+ animationDuration?: number;
7
5
  backgroundColor?: Color;
6
+ height?: number;
8
7
  onCompletion?: () => void;
8
+ progress: number;
9
+ trackColor?: Color;
9
10
  }
10
- export declare const ProgressBar: ({ progress: unclampedProgress, height, trackColor, backgroundColor, onCompletion, }: ProgressBarProps) => JSX.Element;
11
+ export declare const ProgressBar: ({ animationDuration, backgroundColor, height, onCompletion, progress: unclampedProgress, trackColor, }: ProgressBarProps) => JSX.Element;
@@ -30,14 +30,14 @@ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"
30
30
  const useColor_1 = require("../../utils/hooks/useColor");
31
31
  const Flex_1 = require("../Flex");
32
32
  const clamp = (num, min, max) => Math.max(min, Math.min(num, max));
33
- const ProgressBar = ({ progress: unclampedProgress, height = 2, trackColor = "blue100", backgroundColor = "black30", onCompletion, }) => {
33
+ const ProgressBar = ({ animationDuration = 200, backgroundColor = "black30", height = 2, onCompletion, progress: unclampedProgress, trackColor = "blue100", }) => {
34
34
  const color = (0, useColor_1.useColor)();
35
35
  const width = (0, react_native_reanimated_1.useSharedValue)("0%");
36
36
  const progress = clamp(unclampedProgress, 0, 100);
37
37
  const progressAnim = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({ width: width.value }));
38
38
  const [onCompletionCalled, setOnCompletionCalled] = (0, react_1.useState)(false);
39
39
  (0, react_1.useEffect)(() => {
40
- width.value = (0, react_native_reanimated_1.withTiming)(`${progress}%`, { duration: 500 });
40
+ width.value = (0, react_native_reanimated_1.withTiming)(`${progress}%`, { duration: animationDuration });
41
41
  if (progress === 100 && !onCompletionCalled) {
42
42
  onCompletion?.();
43
43
  setOnCompletionCalled(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "11.0.15",
3
+ "version": "11.0.16",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",