@coinbase/cds-mobile 8.58.0 → 8.60.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dts/buttons/Button.d.ts +8 -0
  3. package/dts/buttons/Button.d.ts.map +1 -1
  4. package/dts/buttons/DefaultSlideButtonHandle.d.ts.map +1 -1
  5. package/dts/buttons/IconButton.d.ts +12 -7
  6. package/dts/buttons/IconButton.d.ts.map +1 -1
  7. package/dts/controls/Checkbox.d.ts +6 -1
  8. package/dts/controls/Checkbox.d.ts.map +1 -1
  9. package/dts/controls/CheckboxCell.d.ts +1 -1
  10. package/dts/controls/CheckboxCell.d.ts.map +1 -1
  11. package/dts/controls/Control.d.ts +11 -0
  12. package/dts/controls/Control.d.ts.map +1 -1
  13. package/dts/controls/InputIconButton.d.ts +1 -1
  14. package/dts/controls/Radio.d.ts +11 -1
  15. package/dts/controls/Radio.d.ts.map +1 -1
  16. package/dts/controls/RadioCell.d.ts +1 -1
  17. package/dts/controls/RadioCell.d.ts.map +1 -1
  18. package/dts/controls/Switch.d.ts +1 -1
  19. package/dts/controls/Switch.d.ts.map +1 -1
  20. package/dts/loaders/Spinner.d.ts +4 -0
  21. package/dts/loaders/Spinner.d.ts.map +1 -1
  22. package/dts/visualizations/ProgressBar.d.ts +2 -2
  23. package/dts/visualizations/ProgressBar.d.ts.map +1 -1
  24. package/dts/visualizations/ProgressBarWithFloatLabel.d.ts.map +1 -1
  25. package/dts/visualizations/ProgressCircle.d.ts +9 -1
  26. package/dts/visualizations/ProgressCircle.d.ts.map +1 -1
  27. package/esm/alpha/select/__stories__/AlphaSelect.stories.js +13 -9
  28. package/esm/buttons/Button.js +10 -5
  29. package/esm/buttons/DefaultSlideButtonHandle.js +7 -6
  30. package/esm/buttons/IconButton.js +18 -8
  31. package/esm/buttons/__stories__/Button.stories.js +28 -0
  32. package/esm/buttons/__stories__/IconButton.stories.js +116 -1
  33. package/esm/controls/Checkbox.js +3 -2
  34. package/esm/controls/CheckboxCell.js +3 -1
  35. package/esm/controls/Control.js +7 -3
  36. package/esm/controls/Radio.js +7 -3
  37. package/esm/loaders/Spinner.js +5 -0
  38. package/esm/overlays/__stories__/AlertBasic.stories.js +2 -2
  39. package/esm/overlays/__stories__/AlertLongTitle.stories.js +2 -2
  40. package/esm/overlays/__stories__/AlertOverModal.stories.js +2 -10
  41. package/esm/overlays/__stories__/AlertPortal.stories.js +2 -6
  42. package/esm/overlays/__stories__/AlertSingleAction.stories.js +2 -2
  43. package/esm/overlays/__stories__/AlertVerticalActions.stories.js +2 -2
  44. package/esm/overlays/__stories__/DrawerFallback.stories.js +20 -13
  45. package/esm/overlays/__stories__/DrawerScrollable.stories.js +8 -1
  46. package/esm/overlays/__stories__/Drawers.js +4 -4
  47. package/esm/overlays/__stories__/ModalBackButton.stories.js +2 -2
  48. package/esm/overlays/__stories__/ModalBasic.stories.js +2 -2
  49. package/esm/overlays/__stories__/ModalCustomPadding.stories.js +2 -2
  50. package/esm/overlays/__stories__/ModalLong.stories.js +2 -2
  51. package/esm/overlays/__stories__/ModalPortal.stories.js +2 -6
  52. package/esm/overlays/__stories__/Overlay.stories.js +2 -6
  53. package/esm/overlays/__stories__/TrayNavigation.stories.js +6 -2
  54. package/esm/overlays/__stories__/Trays.js +20 -11
  55. package/esm/sticky-footer/__stories__/StickyFooter.stories.js +2 -2
  56. package/esm/sticky-footer/__stories__/StickyFooterWithTray.stories.js +3 -3
  57. package/esm/visualizations/DefaultProgressCircleContent.js +1 -1
  58. package/esm/visualizations/ProgressBar.js +3 -3
  59. package/esm/visualizations/ProgressBarWithFloatLabel.js +19 -28
  60. package/esm/visualizations/ProgressCircle.js +80 -60
  61. package/esm/visualizations/__stories__/ProgressCircle.stories.js +63 -11
  62. package/package.json +3 -3
@@ -1,6 +1,7 @@
1
1
  import React, { useCallback, useRef, useState } from 'react';
2
2
  import { navigationOptions } from '@coinbase/cds-common/internal/data/navigation';
3
3
  import { NoopFn } from '@coinbase/cds-common/utils/mockUtils';
4
+ import { Button } from '../../buttons/Button';
4
5
  import { IconButton } from '../../buttons/IconButton';
5
6
  import { Menu } from '../../controls/Menu';
6
7
  import { SelectOption } from '../../controls/SelectOption';
@@ -10,7 +11,7 @@ import { HStack } from '../../layout';
10
11
  import { Tray } from '../tray/Tray';
11
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
13
  const NavigationTray = () => {
13
- const [isTrayVisible, setIsTrayVisible] = useState(true);
14
+ const [isTrayVisible, setIsTrayVisible] = useState(false);
14
15
  const setIsTrayVisibleToFalse = useCallback(() => setIsTrayVisible(false), []);
15
16
  const [value, setValue] = useState();
16
17
  const trayRef = useRef(null);
@@ -22,7 +23,10 @@ const NavigationTray = () => {
22
23
  setIsTrayVisible(true);
23
24
  }, []);
24
25
  return /*#__PURE__*/_jsxs(_Fragment, {
25
- children: [/*#__PURE__*/_jsxs(HStack, {
26
+ children: [/*#__PURE__*/_jsx(Button, {
27
+ onPress: handleAppSwitcherPress,
28
+ children: "Open"
29
+ }), /*#__PURE__*/_jsxs(HStack, {
26
30
  gap: 2,
27
31
  justifyContent: "flex-end",
28
32
  minHeight: 200,
@@ -6,14 +6,14 @@ import { Menu } from '../../controls/Menu';
6
6
  import { SelectOption } from '../../controls/SelectOption';
7
7
  import { Fallback, VStack } from '../../layout';
8
8
  import { Tray } from '../tray/Tray';
9
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
10
10
  export const options = prices.slice(0, 4);
11
11
  const lotsOfOptions = prices.slice(0, 30);
12
12
  export const DefaultTray = _ref => {
13
13
  let {
14
14
  title
15
15
  } = _ref;
16
- const [isTrayVisible, setIsTrayVisible] = useState(true);
16
+ const [isTrayVisible, setIsTrayVisible] = useState(false);
17
17
  const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
18
18
  const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
19
19
  const [value, setValue] = useState();
@@ -34,15 +34,24 @@ export const DefaultTray = _ref => {
34
34
  onCloseComplete: setIsTrayVisibleOff,
35
35
  onVisibilityChange: handleTrayVisibilityChange,
36
36
  title: title,
37
- children: /*#__PURE__*/_jsx(Menu, {
38
- onChange: setValue,
39
- value: value,
40
- children: options.map(option => /*#__PURE__*/_jsx(SelectOption, {
41
- description: "BTC",
37
+ children: /*#__PURE__*/_jsxs(VStack, {
38
+ gap: 2,
39
+ paddingX: 3,
40
+ children: [/*#__PURE__*/_jsx(Menu, {
41
+ onChange: setValue,
42
+ value: value,
43
+ children: options.map(option => /*#__PURE__*/_jsx(SelectOption, {
44
+ description: "BTC",
45
+ onPress: handleOptionPress,
46
+ title: option,
47
+ value: option
48
+ }, option))
49
+ }), /*#__PURE__*/_jsx(Button, {
50
+ block: true,
42
51
  onPress: handleOptionPress,
43
- title: option,
44
- value: option
45
- }, option))
52
+ variant: "secondary",
53
+ children: "Close"
54
+ })]
46
55
  })
47
56
  })]
48
57
  });
@@ -64,7 +73,7 @@ export const ScrollableTray = _ref2 => {
64
73
  fallbackEnabled,
65
74
  verticalDrawerPercentageOfView
66
75
  } = _ref2;
67
- const [isTrayVisible, setIsTrayVisible] = useState(true);
76
+ const [isTrayVisible, setIsTrayVisible] = useState(false);
68
77
  const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
69
78
  const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
70
79
  const [value, setValue] = useState();
@@ -7,7 +7,7 @@ import { VStack } from '../../layout';
7
7
  import { StickyFooter } from '../StickyFooter';
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const StickyFooterScreen = () => {
10
- const [showStickyFooter, setShowStickyFooter] = useState(true);
10
+ const [showStickyFooter, setShowStickyFooter] = useState(false);
11
11
  const handleButtonPress = useCallback(() => {
12
12
  setShowStickyFooter(!showStickyFooter);
13
13
  }, [showStickyFooter]);
@@ -17,7 +17,7 @@ const StickyFooterScreen = () => {
17
17
  title: "StickyFooter with Screen",
18
18
  children: /*#__PURE__*/_jsx(Button, {
19
19
  onPress: handleButtonPress,
20
- children: showStickyFooter ? 'Close' : 'Open'
20
+ children: showStickyFooter ? 'Cancel' : 'Open'
21
21
  })
22
22
  }), showStickyFooter && /*#__PURE__*/_jsx(View, {
23
23
  style: {
@@ -14,7 +14,7 @@ const StickyFooterWithTray = _ref => {
14
14
  let {
15
15
  title
16
16
  } = _ref;
17
- const [isTrayVisible, setIsTrayVisible] = useState(true);
17
+ const [isTrayVisible, setIsTrayVisible] = useState(false);
18
18
  const setIsTrayVisibleToFalse = useCallback(() => setIsTrayVisible(false), []);
19
19
  const setIsTrayVisibleToTrue = useCallback(() => setIsTrayVisible(true), []);
20
20
  const [value, setValue] = useState();
@@ -56,14 +56,14 @@ const StickyFooterWithTray = _ref => {
56
56
  flexGrow: 1,
57
57
  children: /*#__PURE__*/_jsx(Button, {
58
58
  block: true,
59
+ onPress: handleClose,
59
60
  variant: "secondary",
60
- children: "Secondary"
61
+ children: "Cancel"
61
62
  })
62
63
  }), /*#__PURE__*/_jsx(Box, {
63
64
  flexGrow: 1,
64
65
  children: /*#__PURE__*/_jsx(Button, {
65
66
  block: true,
66
- onPress: handleClose,
67
67
  children: "Primary"
68
68
  })
69
69
  })]
@@ -4,7 +4,7 @@ import { ProgressTextLabel } from './ProgressTextLabel';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  export const DefaultProgressCircleContent = /*#__PURE__*/memo(_ref => {
6
6
  let {
7
- progress,
7
+ progress = 0,
8
8
  disableAnimateOnMount,
9
9
  disabled,
10
10
  color = 'fgMuted'
@@ -2,7 +2,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { Animated, I18nManager } from 'react-native';
4
4
  import { animateProgressBaseSpec } from '@coinbase/cds-common/animation/progress';
5
- import { useProgressSize } from '@coinbase/cds-common/visualizations/useProgressSize';
5
+ import { getProgressSize } from '@coinbase/cds-common/visualizations/getProgressSize';
6
6
  import { convertMotionConfig } from '../animation/convertMotionConfig';
7
7
  import { useTheme } from '../hooks/useTheme';
8
8
  import { Box, HStack } from '../layout';
@@ -10,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
10
  export const ProgressBar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, forwardedRef) => {
11
11
  let {
12
12
  weight = 'normal',
13
- progress,
13
+ progress = 0,
14
14
  color = 'bgPrimary',
15
15
  disabled,
16
16
  disableAnimateOnMount,
@@ -22,7 +22,7 @@ export const ProgressBar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, forw
22
22
  onAnimationStart
23
23
  } = _ref;
24
24
  const theme = useTheme();
25
- const height = useProgressSize(weight);
25
+ const height = getProgressSize(weight);
26
26
  const animatedProgress = useRef(new Animated.Value(disableAnimateOnMount ? progress : 0));
27
27
  const [trackWidth, setTrackWidth] = useState(-1);
28
28
  useEffect(() => {
@@ -1,64 +1,55 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
2
+ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { Animated, I18nManager } from 'react-native';
4
4
  import { animateProgressBaseSpec } from '@coinbase/cds-common/animation/progress';
5
- import { usePreviousValues } from '@coinbase/cds-common/hooks/usePreviousValues';
6
5
  import { convertMotionConfig } from '../animation/convertMotionConfig';
7
6
  import { useLayout } from '../hooks/useLayout';
8
7
  import { Box, VStack } from '../layout';
9
8
  import { getProgressBarLabelParts } from './getProgressBarLabelParts';
10
9
  import { ProgressTextLabel } from './ProgressTextLabel';
11
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const getEndTranslateX = (containerWidth, textWidth, progress) => I18nManager.isRTL ? Math.min(containerWidth - textWidth, containerWidth - containerWidth * progress) : Math.max(0, containerWidth * progress - textWidth);
12
12
  const ProgressBarFloatLabel = /*#__PURE__*/memo(_ref => {
13
13
  let {
14
14
  label,
15
15
  disabled,
16
- progress,
16
+ progress = 0,
17
17
  disableAnimateOnMount,
18
18
  labelPlacement,
19
19
  styles
20
20
  } = _ref;
21
21
  const [textWidth, setTextWidth] = useState(-1);
22
- const {
23
- addPreviousValue: addPreviousPercent
24
- } = usePreviousValues([disableAnimateOnMount ? progress : 0]);
25
22
  const [size, onLayout] = useLayout();
26
23
  const containerWidth = size.width;
27
- const [hasAnimationMounted, setHasAnimationMounted] = useState(!disableAnimateOnMount);
28
- const animatedProgress = useMemo(() => new Animated.Value(0), []);
29
- addPreviousPercent(progress);
24
+ const animatedTranslateX = useRef(new Animated.Value(0));
30
25
  const {
31
26
  value: labelNum,
32
27
  render: renderLabel
33
28
  } = getProgressBarLabelParts(label);
34
29
  useEffect(() => {
35
- if (containerWidth > 0 && textWidth > -1) {
36
- if (!hasAnimationMounted && disableAnimateOnMount) {
37
- animatedProgress.setValue(progress);
38
- setHasAnimationMounted(true);
39
- } else {
40
- var _Animated$timing;
41
- (_Animated$timing = Animated.timing(animatedProgress, convertMotionConfig(_extends({
42
- toValue: progress
43
- }, animateProgressBaseSpec, {
44
- useNativeDriver: true
45
- })))) == null || _Animated$timing.start();
46
- }
30
+ if (containerWidth <= 0 || textWidth < 0) return;
31
+ const targetTranslateX = getEndTranslateX(containerWidth, textWidth, progress);
32
+ if (disableAnimateOnMount) {
33
+ animatedTranslateX.current.setValue(targetTranslateX);
34
+ } else {
35
+ Animated.timing(animatedTranslateX.current, convertMotionConfig(_extends({
36
+ toValue: targetTranslateX
37
+ }, animateProgressBaseSpec, {
38
+ useNativeDriver: true
39
+ }))).start();
47
40
  }
48
- }, [progress, containerWidth, textWidth, animatedProgress, disableAnimateOnMount, hasAnimationMounted]);
41
+ }, [progress, containerWidth, textWidth, disableAnimateOnMount]);
49
42
  const handleTextLayout = useCallback(event => {
50
43
  setTextWidth(event.nativeEvent.layout.width);
51
44
  }, []);
45
+ const hasDimensions = containerWidth > 0 && textWidth > -1;
52
46
  const containerStyle = useMemo(() => [styles == null ? void 0 : styles.labelContainer], [styles == null ? void 0 : styles.labelContainer]);
53
47
  const labelStyle = useMemo(() => [{
54
- opacity: hasAnimationMounted ? 1 : 0,
48
+ opacity: hasDimensions ? 1 : 0,
55
49
  transform: [{
56
- translateX: animatedProgress.interpolate({
57
- inputRange: [0, 1],
58
- outputRange: [I18nManager.isRTL ? containerWidth - textWidth : 0, I18nManager.isRTL ? 0 : containerWidth - textWidth]
59
- })
50
+ translateX: animatedTranslateX.current
60
51
  }]
61
- }], [containerWidth, textWidth, hasAnimationMounted, animatedProgress]);
52
+ }], [hasDimensions]);
62
53
  return /*#__PURE__*/_jsx(Box, {
63
54
  flexWrap: "nowrap",
64
55
  onLayout: onLayout,
@@ -1,11 +1,11 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  import React, { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
3
- import { Animated } from 'react-native';
3
+ import { Animated, StyleSheet } from 'react-native';
4
4
  import { Circle, G, Svg } from 'react-native-svg';
5
5
  import { animateProgressBaseSpec } from '@coinbase/cds-common/animation/progress';
6
6
  import { getCircumference, getRadius } from '@coinbase/cds-common/utils/circle';
7
7
  import { getProgressCircleParams } from '@coinbase/cds-common/visualizations/getProgressCircleParams';
8
- import { useProgressSize } from '@coinbase/cds-common/visualizations/useProgressSize';
8
+ import { getProgressSize } from '@coinbase/cds-common/visualizations/getProgressSize';
9
9
  import { isTest } from '@coinbase/cds-utils';
10
10
  import { convertMotionConfig } from '../animation/convertMotionConfig';
11
11
  import { useTheme } from '../hooks/useTheme';
@@ -14,19 +14,19 @@ import { DefaultProgressCircleContent } from './DefaultProgressCircleContent';
14
14
  import { VisualizationContainer } from './VisualizationContainer';
15
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  const AnimatedCircle = Animated.createAnimatedComponent(Circle);
17
+ const AnimatedSvg = Animated.createAnimatedComponent(Svg);
17
18
  const ProgressCircleInner = /*#__PURE__*/memo(_ref => {
18
19
  let {
19
20
  size,
20
- progress,
21
+ progress = 0,
21
22
  color,
22
- weight,
23
+ strokeWidth,
23
24
  visuallyDisabled,
24
25
  style,
25
26
  onAnimationEnd,
26
27
  onAnimationStart,
27
28
  disableAnimateOnMount
28
29
  } = _ref;
29
- const strokeWidth = useProgressSize(weight);
30
30
  const theme = useTheme();
31
31
  const circleRef = useRef(null);
32
32
  const circumference = getCircumference(getRadius(size, strokeWidth));
@@ -47,8 +47,7 @@ const ProgressCircleInner = /*#__PURE__*/memo(_ref => {
47
47
  });
48
48
  }, [circumference, progress, animatedStrokeDashOffset, onAnimationStart, onAnimationEnd]);
49
49
  return /*#__PURE__*/_jsx(AnimatedCircle, _extends({
50
- ref: !isTest() ? circleRef : undefined // This is required because Circle is mocked in the unit test to support testID. The mock does not support refs
51
- ,
50
+ ref: !isTest() ? circleRef : undefined,
52
51
  strokeDasharray: circumference,
53
52
  strokeDashoffset: animatedStrokeDashOffset.current,
54
53
  strokeLinecap: progress > 0 ? 'round' : 'butt',
@@ -61,14 +60,15 @@ const ProgressCircleInner = /*#__PURE__*/memo(_ref => {
61
60
  });
62
61
  export const ProgressCircle = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3, forwardedRef) => {
63
62
  let {
63
+ indeterminate,
64
64
  weight = 'normal',
65
- progress,
65
+ progress = indeterminate ? 0.75 : 0,
66
66
  // Default is empty string due to iOS VoiceOver repeating percentage multiple times when
67
67
  // a11y label isn't specified
68
- accessibilityLabel = '',
69
- color = 'bgPrimary',
68
+ accessibilityLabel = indeterminate ? 'Loading' : '',
69
+ color = indeterminate ? 'fgMuted' : 'bgPrimary',
70
70
  disabled,
71
- disableAnimateOnMount,
71
+ disableAnimateOnMount = indeterminate ? true : false,
72
72
  testID,
73
73
  hideContent,
74
74
  hideText,
@@ -80,12 +80,25 @@ export const ProgressCircle = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
80
80
  onAnimationStart
81
81
  } = _ref3;
82
82
  const theme = useTheme();
83
- const strokeWidth = useProgressSize(weight);
83
+ const strokeWidth = getProgressSize(weight);
84
84
  const visSize = size != null ? size : '100%';
85
85
  const rootStyle = useMemo(() => [style, styles == null ? void 0 : styles.root], [style, styles == null ? void 0 : styles.root]);
86
86
  const textContainerStyle = useMemo(() => [{
87
87
  padding: strokeWidth
88
88
  }, styles == null ? void 0 : styles.textContainer], [strokeWidth, styles == null ? void 0 : styles.textContainer]);
89
+ const animatedRotate = useRef(new Animated.Value(0));
90
+ useEffect(() => {
91
+ if (!indeterminate) return;
92
+ // if indeterminate, animate the rotation of the svg
93
+ const animation = Animated.loop(Animated.timing(animatedRotate.current, convertMotionConfig({
94
+ toValue: 1,
95
+ duration: 'slow4',
96
+ easing: 'linear',
97
+ fromValue: 0
98
+ })));
99
+ animation.start();
100
+ return () => animation.stop();
101
+ }, [indeterminate]);
89
102
  return /*#__PURE__*/_jsx(VisualizationContainer, {
90
103
  height: visSize,
91
104
  width: visSize,
@@ -95,12 +108,12 @@ export const ProgressCircle = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
95
108
  height,
96
109
  circleSize
97
110
  } = _ref4;
98
- return /*#__PURE__*/_jsx(Box, {
111
+ return /*#__PURE__*/_jsxs(Box, {
99
112
  ref: forwardedRef,
100
113
  accessible: true,
101
114
  accessibilityLabel: accessibilityLabel,
102
115
  accessibilityRole: "progressbar",
103
- accessibilityValue: {
116
+ accessibilityValue: indeterminate ? undefined : {
104
117
  min: 0,
105
118
  max: 100,
106
119
  now: Math.round(progress * 100)
@@ -111,57 +124,64 @@ export const ProgressCircle = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
111
124
  style: rootStyle,
112
125
  testID: testID,
113
126
  width: width,
114
- children: /*#__PURE__*/_jsxs(Box, {
115
- flexGrow: 0,
116
- flexShrink: 0,
127
+ children: [/*#__PURE__*/_jsx(AnimatedSvg, {
117
128
  height: circleSize,
118
- style: styles == null ? void 0 : styles.svgContainer,
129
+ style: [styles == null ? void 0 : styles.svg, styleSheet.svg, {
130
+ transform: [{
131
+ rotate: animatedRotate.current.interpolate({
132
+ inputRange: [0, 1],
133
+ outputRange: ['0deg', '360deg']
134
+ })
135
+ }]
136
+ }],
137
+ viewBox: "0 0 " + circleSize + " " + circleSize,
119
138
  width: circleSize,
120
- children: [/*#__PURE__*/_jsx(Svg, {
121
- height: circleSize,
122
- style: styles == null ? void 0 : styles.svg,
123
- viewBox: "0 0 " + circleSize + " " + circleSize,
124
- width: circleSize,
125
- children: /*#__PURE__*/_jsxs(G, {
126
- origin: circleSize / 2 + ", " + circleSize / 2,
127
- rotation: -90,
128
- children: [/*#__PURE__*/_jsx(Circle, _extends({}, getProgressCircleParams({
129
- size: circleSize,
130
- strokeWidth,
131
- stroke: theme.color.bgLine
132
- }), (styles == null ? void 0 : styles.circle) || {})), /*#__PURE__*/_jsx(ProgressCircleInner, {
133
- color: color,
134
- disableAnimateOnMount: disableAnimateOnMount,
135
- onAnimationEnd: onAnimationEnd,
136
- onAnimationStart: onAnimationStart,
137
- progress: progress,
138
- size: circleSize,
139
- style: styles == null ? void 0 : styles.progress,
140
- visuallyDisabled: disabled,
141
- weight: weight
142
- })]
143
- })
144
- }, circleSize), !hideText && !hideContent && /*#__PURE__*/_jsx(Box, {
139
+ children: /*#__PURE__*/_jsxs(G, {
140
+ origin: circleSize / 2 + ", " + circleSize / 2,
141
+ rotation: -90,
142
+ children: [/*#__PURE__*/_jsx(Circle, _extends({}, getProgressCircleParams({
143
+ size: circleSize,
144
+ strokeWidth,
145
+ stroke: theme.color.bgLine
146
+ }), (styles == null ? void 0 : styles.circle) || {})), /*#__PURE__*/_jsx(ProgressCircleInner, {
147
+ color: color,
148
+ disableAnimateOnMount: disableAnimateOnMount,
149
+ indeterminate: indeterminate,
150
+ onAnimationEnd: onAnimationEnd,
151
+ onAnimationStart: onAnimationStart,
152
+ progress: progress,
153
+ size: circleSize,
154
+ strokeWidth: strokeWidth,
155
+ style: styles == null ? void 0 : styles.progress,
156
+ visuallyDisabled: disabled
157
+ })]
158
+ })
159
+ }, circleSize), !hideText && !hideContent && /*#__PURE__*/_jsx(Box, {
160
+ height: "100%",
161
+ position: "absolute",
162
+ style: textContainerStyle,
163
+ width: "100%",
164
+ children: /*#__PURE__*/_jsx(Box, {
165
+ alignItems: "center",
166
+ borderRadius: 1000,
145
167
  height: "100%",
146
- position: "absolute",
147
- style: textContainerStyle,
168
+ justifyContent: "center",
169
+ overflow: "hidden",
148
170
  width: "100%",
149
- children: /*#__PURE__*/_jsx(Box, {
150
- alignItems: "center",
151
- borderRadius: 1000,
152
- height: "100%",
153
- justifyContent: "center",
154
- overflow: "hidden",
155
- width: "100%",
156
- children: contentNode != null ? contentNode : /*#__PURE__*/_jsx(DefaultProgressCircleContent, {
157
- disableAnimateOnMount: disableAnimateOnMount,
158
- disabled: disabled,
159
- progress: progress
160
- })
171
+ children: contentNode != null ? contentNode : !indeterminate && /*#__PURE__*/_jsx(DefaultProgressCircleContent, {
172
+ disableAnimateOnMount: disableAnimateOnMount,
173
+ disabled: disabled,
174
+ progress: progress
161
175
  })
162
- })]
163
- })
176
+ })
177
+ })]
164
178
  });
165
179
  }
166
180
  });
167
- }));
181
+ }));
182
+ const styleSheet = StyleSheet.create({
183
+ svg: {
184
+ flexGrow: 0,
185
+ flexShrink: 0
186
+ }
187
+ });
@@ -111,12 +111,64 @@ const ProgressBarScreen = () => {
111
111
  }
112
112
  })
113
113
  }), /*#__PURE__*/_jsx(Example, {
114
- title: "Heavy",
114
+ title: "Indeterminate",
115
115
  children: /*#__PURE__*/_jsx(ProgressContainerWithButtons, {
116
116
  children: _ref3 => {
117
117
  let {
118
118
  calculateProgress
119
119
  } = _ref3;
120
+ return /*#__PURE__*/_jsxs(HStack, {
121
+ flexWrap: "wrap",
122
+ gap: 2,
123
+ children: [/*#__PURE__*/_jsx(ProgressCircle, {
124
+ indeterminate: true,
125
+ accessibilityLabel: "Loading",
126
+ color: "bgPositive",
127
+ progress: calculateProgress(0.75),
128
+ size: 30
129
+ }), /*#__PURE__*/_jsx(ProgressCircle, {
130
+ indeterminate: true,
131
+ accessibilityLabel: "Loading",
132
+ color: "bgSecondary",
133
+ progress: calculateProgress(0.75),
134
+ size: 30
135
+ }), /*#__PURE__*/_jsx(ProgressCircle, {
136
+ indeterminate: true,
137
+ accessibilityLabel: "Loading",
138
+ disableAnimateOnMount: false,
139
+ progress: calculateProgress(0.75),
140
+ size: 100,
141
+ weight: "thin"
142
+ }), /*#__PURE__*/_jsx(ProgressCircle, {
143
+ indeterminate: true,
144
+ accessibilityLabel: "Loading",
145
+ disableAnimateOnMount: false,
146
+ progress: calculateProgress(0.75),
147
+ size: 100,
148
+ weight: "normal"
149
+ }), /*#__PURE__*/_jsx(ProgressCircle, {
150
+ indeterminate: true,
151
+ accessibilityLabel: "Loading",
152
+ progress: calculateProgress(0.75),
153
+ size: 100,
154
+ weight: "semiheavy"
155
+ }), /*#__PURE__*/_jsx(ProgressCircle, {
156
+ indeterminate: true,
157
+ accessibilityLabel: "Loading",
158
+ progress: calculateProgress(0.75),
159
+ size: 100,
160
+ weight: "heavy"
161
+ })]
162
+ });
163
+ }
164
+ })
165
+ }), /*#__PURE__*/_jsx(Example, {
166
+ title: "Heavy",
167
+ children: /*#__PURE__*/_jsx(ProgressContainerWithButtons, {
168
+ children: _ref4 => {
169
+ let {
170
+ calculateProgress
171
+ } = _ref4;
120
172
  return /*#__PURE__*/_jsxs(HStack, {
121
173
  gap: 2,
122
174
  children: [/*#__PURE__*/_jsx(ProgressCircle, {
@@ -134,10 +186,10 @@ const ProgressBarScreen = () => {
134
186
  }), /*#__PURE__*/_jsx(Example, {
135
187
  title: "NoText",
136
188
  children: /*#__PURE__*/_jsx(ProgressContainerWithButtons, {
137
- children: _ref4 => {
189
+ children: _ref5 => {
138
190
  let {
139
191
  calculateProgress
140
- } = _ref4;
192
+ } = _ref5;
141
193
  return /*#__PURE__*/_jsxs(HStack, {
142
194
  gap: 2,
143
195
  children: [/*#__PURE__*/_jsx(ProgressCircle, {
@@ -201,10 +253,10 @@ const ProgressBarScreen = () => {
201
253
  }), /*#__PURE__*/_jsx(Example, {
202
254
  title: "FillParent",
203
255
  children: /*#__PURE__*/_jsx(ProgressContainerWithButtons, {
204
- children: _ref5 => {
256
+ children: _ref6 => {
205
257
  let {
206
258
  calculateProgress
207
- } = _ref5;
259
+ } = _ref6;
208
260
  return /*#__PURE__*/_jsxs(HStack, {
209
261
  flexWrap: "wrap",
210
262
  gap: 2,
@@ -250,10 +302,10 @@ const ProgressBarScreen = () => {
250
302
  }), /*#__PURE__*/_jsx(Example, {
251
303
  title: "CustomTextColor",
252
304
  children: /*#__PURE__*/_jsx(ProgressContainerWithButtons, {
253
- children: _ref6 => {
305
+ children: _ref7 => {
254
306
  let {
255
307
  calculateProgress
256
- } = _ref6;
308
+ } = _ref7;
257
309
  return /*#__PURE__*/_jsxs(HStack, {
258
310
  gap: 2,
259
311
  children: [/*#__PURE__*/_jsx(ProgressCircle, {
@@ -429,10 +481,10 @@ const ProgressBarScreen = () => {
429
481
  }), /*#__PURE__*/_jsx(Example, {
430
482
  title: "Thin",
431
483
  children: /*#__PURE__*/_jsx(ProgressContainerWithButtons, {
432
- children: _ref7 => {
484
+ children: _ref8 => {
433
485
  let {
434
486
  calculateProgress
435
- } = _ref7;
487
+ } = _ref8;
436
488
  return /*#__PURE__*/_jsxs(HStack, {
437
489
  gap: 2,
438
490
  children: [/*#__PURE__*/_jsx(ProgressCircle, {
@@ -450,10 +502,10 @@ const ProgressBarScreen = () => {
450
502
  }), /*#__PURE__*/_jsx(Example, {
451
503
  title: "Disable Mount Animation",
452
504
  children: /*#__PURE__*/_jsx(ProgressContainerWithButtons, {
453
- children: _ref8 => {
505
+ children: _ref9 => {
454
506
  let {
455
507
  calculateProgress
456
- } = _ref8;
508
+ } = _ref9;
457
509
  return /*#__PURE__*/_jsx(ProgressCircle, {
458
510
  disableAnimateOnMount: true,
459
511
  progress: calculateProgress(0.8),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile",
3
- "version": "8.58.0",
3
+ "version": "8.60.0",
4
4
  "description": "Coinbase Design System - Mobile",
5
5
  "repository": {
6
6
  "type": "git",
@@ -197,9 +197,9 @@
197
197
  "react-native-svg": "^14.1.0"
198
198
  },
199
199
  "dependencies": {
200
- "@coinbase/cds-common": "^8.58.0",
200
+ "@coinbase/cds-common": "^8.60.0",
201
201
  "@coinbase/cds-icons": "^5.13.0",
202
- "@coinbase/cds-illustrations": "^4.35.0",
202
+ "@coinbase/cds-illustrations": "^4.36.0",
203
203
  "@coinbase/cds-lottie-files": "^3.3.4",
204
204
  "@coinbase/cds-utils": "^2.3.5",
205
205
  "@floating-ui/react-native": "^0.10.5",