@coinbase/cds-mobile 8.32.3 → 8.33.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/CHANGELOG.md +6 -0
- package/dts/motion/types.d.ts +21 -0
- package/dts/motion/types.d.ts.map +1 -1
- package/dts/numbers/RollingNumber/DefaultRollingNumberDigit.d.ts +13 -4
- package/dts/numbers/RollingNumber/DefaultRollingNumberDigit.d.ts.map +1 -1
- package/dts/numbers/RollingNumber/DefaultRollingNumberValueSection.d.ts.map +1 -1
- package/dts/numbers/RollingNumber/RollingNumber.d.ts +71 -47
- package/dts/numbers/RollingNumber/RollingNumber.d.ts.map +1 -1
- package/esm/numbers/RollingNumber/DefaultRollingNumberDigit.js +110 -23
- package/esm/numbers/RollingNumber/DefaultRollingNumberValueSection.js +10 -4
- package/esm/numbers/RollingNumber/RollingNumber.js +29 -4
- package/esm/numbers/__stories__/RollingNumber.stories.js +92 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 8.33.0 (12/18/2025 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- New digitTransitionVariant for RollingNumber. [[#237](https://github.com/coinbase/cds/pull/237)]
|
|
16
|
+
|
|
11
17
|
## 8.32.3 (12/18/2025 PST)
|
|
12
18
|
|
|
13
19
|
#### 🐞 Fixes
|
package/dts/motion/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithSpringConfig, WithTimingConfig } from 'react-native-reanimated';
|
|
1
2
|
export type HintMotionBaseProps = {
|
|
2
3
|
/**
|
|
3
4
|
* Disable animation on component mount
|
|
@@ -5,4 +6,24 @@ export type HintMotionBaseProps = {
|
|
|
5
6
|
*/
|
|
6
7
|
disableAnimateOnMount?: boolean;
|
|
7
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Transition configuration for Reanimated animations.
|
|
11
|
+
* Supports timing and spring animation types.
|
|
12
|
+
* Used for translations, opacity, color, and any other animated properties.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Spring animation
|
|
16
|
+
* { type: 'spring', damping: 18, stiffness: 280, mass: 0.3 }
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Timing animation with easing
|
|
20
|
+
* { type: 'timing', duration: 300, easing: Easing.bezier(0.2, 0, 0, 1) }
|
|
21
|
+
*/
|
|
22
|
+
export type Transition =
|
|
23
|
+
| ({
|
|
24
|
+
type: 'timing';
|
|
25
|
+
} & WithTimingConfig)
|
|
26
|
+
| ({
|
|
27
|
+
type: 'spring';
|
|
28
|
+
} & WithSpringConfig);
|
|
8
29
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/motion/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/motion/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAElF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,UAAU,GAClB,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,gBAAgB,CAAC,GACvC,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { type RollingNumberDigitComponent } from './RollingNumber';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Default digit component for RollingNumber on mobile.
|
|
4
|
+
*
|
|
5
|
+
* The mobile implementation differs from web due to platform-specific animation libraries:
|
|
6
|
+
* - Mobile uses react-native-reanimated with shared values and worklets
|
|
7
|
+
* - Web uses framer-motion with imperative `animate` calls
|
|
8
|
+
*
|
|
9
|
+
* For the "every" variant, mobile renders all 10 digits (0-9) stacked with absolute
|
|
10
|
+
* positioning and animates the container's translateY. Web renders only the necessary
|
|
11
|
+
* digits above/below the current value.
|
|
12
|
+
*
|
|
13
|
+
* For the "single" variant, mobile uses reanimated's `entering`/`exiting` props with
|
|
14
|
+
* custom animation worklets. Web uses imperative opacity crossfades on DOM sections.
|
|
15
|
+
*/
|
|
7
16
|
export declare const DefaultRollingNumberDigit: RollingNumberDigitComponent;
|
|
8
17
|
//# sourceMappingURL=DefaultRollingNumberDigit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRollingNumberDigit.d.ts","sourceRoot":"","sources":["../../../src/numbers/RollingNumber/DefaultRollingNumberDigit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultRollingNumberDigit.d.ts","sourceRoot":"","sources":["../../../src/numbers/RollingNumber/DefaultRollingNumberDigit.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,2BAA2B,EAGjC,MAAM,iBAAiB,CAAC;AA6DzB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,EAAE,2BAoHvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRollingNumberValueSection.d.ts","sourceRoot":"","sources":["../../../src/numbers/RollingNumber/DefaultRollingNumberValueSection.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,kCAAkC,EAEnC,MAAM,iBAAiB,CAAC;AAOzB,eAAO,MAAM,gCAAgC,EAAE,
|
|
1
|
+
{"version":3,"file":"DefaultRollingNumberValueSection.d.ts","sourceRoot":"","sources":["../../../src/numbers/RollingNumber/DefaultRollingNumberValueSection.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,kCAAkC,EAEnC,MAAM,iBAAiB,CAAC;AAOzB,eAAO,MAAM,gCAAgC,EAAE,kCAuJ9C,CAAC"}
|
|
@@ -5,15 +5,13 @@ import {
|
|
|
5
5
|
type ViewProps,
|
|
6
6
|
type ViewStyle,
|
|
7
7
|
} from 'react-native';
|
|
8
|
-
import {
|
|
9
|
-
type AnimatedStyle,
|
|
10
|
-
type WithSpringConfig,
|
|
11
|
-
type WithTimingConfig,
|
|
12
|
-
} from 'react-native-reanimated';
|
|
8
|
+
import { type AnimatedStyle } from 'react-native-reanimated';
|
|
13
9
|
import type { ThemeVars } from '@coinbase/cds-common/core/theme';
|
|
14
10
|
import type { KeyedNumberPart } from '@coinbase/cds-common/numbers/IntlNumberFormat';
|
|
11
|
+
import { type SingleDirection } from '@coinbase/cds-common/numbers/useValueChangeDirection';
|
|
15
12
|
import type { SharedProps } from '@coinbase/cds-common/types/SharedProps';
|
|
16
13
|
import { type HStackProps } from '../../layout/HStack';
|
|
14
|
+
import type { Transition } from '../../motion/types';
|
|
17
15
|
import { Text, type TextBaseProps, type TextProps } from '../../typography/Text';
|
|
18
16
|
export declare const digits: number[];
|
|
19
17
|
/**
|
|
@@ -21,42 +19,26 @@ export declare const digits: number[];
|
|
|
21
19
|
*/
|
|
22
20
|
export type RollingNumberTransitionConfig = {
|
|
23
21
|
/**
|
|
24
|
-
* Transition override for the vertical translation animation.
|
|
22
|
+
* Transition override for the vertical translation animation (digit roll).
|
|
25
23
|
*/
|
|
26
|
-
y?:
|
|
27
|
-
| ({
|
|
28
|
-
type: 'timing';
|
|
29
|
-
} & WithTimingConfig)
|
|
30
|
-
| ({
|
|
31
|
-
type: 'spring';
|
|
32
|
-
} & WithSpringConfig);
|
|
24
|
+
y?: Transition;
|
|
33
25
|
/**
|
|
34
|
-
* Transition override for the
|
|
26
|
+
* Transition override for the opacity animation during digit transitions.
|
|
27
|
+
* Controls how digits fade in/out during the single variant animation.
|
|
35
28
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
type: 'spring';
|
|
42
|
-
} & WithSpringConfig);
|
|
43
|
-
};
|
|
44
|
-
export declare const defaultTransitionConfig: {
|
|
45
|
-
readonly y: {
|
|
46
|
-
readonly type: 'timing';
|
|
47
|
-
readonly duration: 300;
|
|
48
|
-
readonly easing: {
|
|
49
|
-
factory: () => (x: number) => number;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
readonly color: {
|
|
53
|
-
readonly type: 'timing';
|
|
54
|
-
readonly duration: 1000;
|
|
55
|
-
readonly easing: {
|
|
56
|
-
factory: () => (x: number) => number;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
29
|
+
opacity?: Transition;
|
|
30
|
+
/**
|
|
31
|
+
* Transition override for the color interpolation animation (color pulse).
|
|
32
|
+
*/
|
|
33
|
+
color?: Transition;
|
|
59
34
|
};
|
|
35
|
+
export declare const defaultTransitionConfig: RollingNumberTransitionConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Defines the style of digit transition animation.
|
|
38
|
+
* - `'every'`: Rolls through every intermediate digit (e.g., 1→2→3→...→9). Default behavior.
|
|
39
|
+
* - `'single'`: Rolls directly to the new digit without showing intermediates (e.g., 1→9).
|
|
40
|
+
*/
|
|
41
|
+
export type DigitTransitionVariant = 'every' | 'single';
|
|
60
42
|
export type RollingNumberMaskProps = HStackProps & {
|
|
61
43
|
/**
|
|
62
44
|
* Content rendered inside the mask container.
|
|
@@ -123,6 +105,15 @@ export type RollingNumberValueSectionProps = HStackProps & {
|
|
|
123
105
|
* Transition overrides applied to digit and symbol animations.
|
|
124
106
|
*/
|
|
125
107
|
transitionConfig?: RollingNumberTransitionConfig;
|
|
108
|
+
/**
|
|
109
|
+
* Style of digit transition animation.
|
|
110
|
+
* @default 'every'
|
|
111
|
+
*/
|
|
112
|
+
digitTransitionVariant?: DigitTransitionVariant;
|
|
113
|
+
/**
|
|
114
|
+
* Direction of the roll animation. Only used when {@link digitTransitionVariant} is `'single'`.
|
|
115
|
+
*/
|
|
116
|
+
direction?: SingleDirection;
|
|
126
117
|
/**
|
|
127
118
|
* Text props forwarded to Text children within the section.
|
|
128
119
|
*/
|
|
@@ -162,6 +153,15 @@ export type RollingNumberDigitProps = ViewProps & {
|
|
|
162
153
|
* Component used to mask the digit column.
|
|
163
154
|
*/
|
|
164
155
|
RollingNumberMaskComponent?: RollingNumberMaskComponent;
|
|
156
|
+
/**
|
|
157
|
+
* Style of digit transition animation.
|
|
158
|
+
* @default 'every'
|
|
159
|
+
*/
|
|
160
|
+
digitTransitionVariant?: DigitTransitionVariant;
|
|
161
|
+
/**
|
|
162
|
+
* Direction of the roll animation. Only used when {@link digitTransitionVariant} is `'single'`.
|
|
163
|
+
*/
|
|
164
|
+
direction?: SingleDirection;
|
|
165
165
|
/**
|
|
166
166
|
* Height of the digit column used to compute translations.
|
|
167
167
|
*/
|
|
@@ -269,7 +269,8 @@ export type RollingNumberBaseProps = SharedProps &
|
|
|
269
269
|
*/
|
|
270
270
|
locale?: Intl.LocalesArgument;
|
|
271
271
|
/**
|
|
272
|
-
* Base text color token. When {@link colorPulseOnUpdate} is true, the color briefly pulses to a positive or negative mid color before returning to this base color.
|
|
272
|
+
* Base text color token. When {@link colorPulseOnUpdate} is true, the color briefly pulses to a positive or negative mid color before returning to this base color.
|
|
273
|
+
* @default 'fg'
|
|
273
274
|
*/
|
|
274
275
|
color?: ThemeVars.Color;
|
|
275
276
|
/**
|
|
@@ -277,11 +278,13 @@ export type RollingNumberBaseProps = SharedProps &
|
|
|
277
278
|
*/
|
|
278
279
|
colorPulseOnUpdate?: boolean;
|
|
279
280
|
/**
|
|
280
|
-
* Color token used for positive numeric changes.
|
|
281
|
+
* Color token used for positive numeric changes.
|
|
282
|
+
* @default 'fgPositive'
|
|
281
283
|
*/
|
|
282
284
|
positivePulseColor?: ThemeVars.Color;
|
|
283
285
|
/**
|
|
284
|
-
* Color token used for negative numeric changes.
|
|
286
|
+
* Color token used for negative numeric changes.
|
|
287
|
+
* @default 'fgNegative'
|
|
285
288
|
*/
|
|
286
289
|
negativePulseColor?: ThemeVars.Color;
|
|
287
290
|
/**
|
|
@@ -292,6 +295,13 @@ export type RollingNumberBaseProps = SharedProps &
|
|
|
292
295
|
* Reanimated transition overrides. Supports per-property overrides for {@code y} and {@code color} only.
|
|
293
296
|
*/
|
|
294
297
|
transition?: RollingNumberTransitionConfig;
|
|
298
|
+
/**
|
|
299
|
+
* Style of digit transition animation.
|
|
300
|
+
* - `'every'`: Rolls through every intermediate digit (e.g., 1→2→3→...→9).
|
|
301
|
+
* - `'single'`: Rolls directly to the new digit without showing intermediates (e.g., 1→9).
|
|
302
|
+
* @default 'every'
|
|
303
|
+
*/
|
|
304
|
+
digitTransitionVariant?: DigitTransitionVariant;
|
|
295
305
|
/**
|
|
296
306
|
* Accessibility label prefix announced before the value.
|
|
297
307
|
*/
|
|
@@ -301,11 +311,13 @@ export type RollingNumberBaseProps = SharedProps &
|
|
|
301
311
|
*/
|
|
302
312
|
accessibilityLabelSuffix?: string;
|
|
303
313
|
/**
|
|
304
|
-
* accessibilityLiveRegion value used for screen readers on Android.
|
|
314
|
+
* accessibilityLiveRegion value used for screen readers on Android.
|
|
315
|
+
* @default 'polite'
|
|
305
316
|
*/
|
|
306
317
|
accessibilityLiveRegion?: React.ComponentProps<typeof Text>['accessibilityLiveRegion'];
|
|
307
318
|
/**
|
|
308
|
-
* Enables tabular figures on the underlying {@link Text}. All digits render with equal width.
|
|
319
|
+
* Enables tabular figures on the underlying {@link Text}. All digits render with equal width.
|
|
320
|
+
* @default true
|
|
309
321
|
*/
|
|
310
322
|
tabularNumbers?: boolean;
|
|
311
323
|
};
|
|
@@ -425,7 +437,8 @@ export declare const RollingNumber: import('react').MemoExoticComponent<
|
|
|
425
437
|
*/
|
|
426
438
|
locale?: Intl.LocalesArgument;
|
|
427
439
|
/**
|
|
428
|
-
* Base text color token. When {@link colorPulseOnUpdate} is true, the color briefly pulses to a positive or negative mid color before returning to this base color.
|
|
440
|
+
* Base text color token. When {@link colorPulseOnUpdate} is true, the color briefly pulses to a positive or negative mid color before returning to this base color.
|
|
441
|
+
* @default 'fg'
|
|
429
442
|
*/
|
|
430
443
|
color?: ThemeVars.Color;
|
|
431
444
|
/**
|
|
@@ -433,11 +446,13 @@ export declare const RollingNumber: import('react').MemoExoticComponent<
|
|
|
433
446
|
*/
|
|
434
447
|
colorPulseOnUpdate?: boolean;
|
|
435
448
|
/**
|
|
436
|
-
* Color token used for positive numeric changes.
|
|
449
|
+
* Color token used for positive numeric changes.
|
|
450
|
+
* @default 'fgPositive'
|
|
437
451
|
*/
|
|
438
452
|
positivePulseColor?: ThemeVars.Color;
|
|
439
453
|
/**
|
|
440
|
-
* Color token used for negative numeric changes.
|
|
454
|
+
* Color token used for negative numeric changes.
|
|
455
|
+
* @default 'fgNegative'
|
|
441
456
|
*/
|
|
442
457
|
negativePulseColor?: ThemeVars.Color;
|
|
443
458
|
/**
|
|
@@ -448,6 +463,13 @@ export declare const RollingNumber: import('react').MemoExoticComponent<
|
|
|
448
463
|
* Reanimated transition overrides. Supports per-property overrides for {@code y} and {@code color} only.
|
|
449
464
|
*/
|
|
450
465
|
transition?: RollingNumberTransitionConfig;
|
|
466
|
+
/**
|
|
467
|
+
* Style of digit transition animation.
|
|
468
|
+
* - `'every'`: Rolls through every intermediate digit (e.g., 1→2→3→...→9).
|
|
469
|
+
* - `'single'`: Rolls directly to the new digit without showing intermediates (e.g., 1→9).
|
|
470
|
+
* @default 'every'
|
|
471
|
+
*/
|
|
472
|
+
digitTransitionVariant?: DigitTransitionVariant;
|
|
451
473
|
/**
|
|
452
474
|
* Accessibility label prefix announced before the value.
|
|
453
475
|
*/
|
|
@@ -457,11 +479,13 @@ export declare const RollingNumber: import('react').MemoExoticComponent<
|
|
|
457
479
|
*/
|
|
458
480
|
accessibilityLabelSuffix?: string;
|
|
459
481
|
/**
|
|
460
|
-
* accessibilityLiveRegion value used for screen readers on Android.
|
|
482
|
+
* accessibilityLiveRegion value used for screen readers on Android.
|
|
483
|
+
* @default 'polite'
|
|
461
484
|
*/
|
|
462
485
|
accessibilityLiveRegion?: React.ComponentProps<typeof Text>['accessibilityLiveRegion'];
|
|
463
486
|
/**
|
|
464
|
-
* Enables tabular figures on the underlying {@link Text}. All digits render with equal width.
|
|
487
|
+
* Enables tabular figures on the underlying {@link Text}. All digits render with equal width.
|
|
488
|
+
* @default true
|
|
465
489
|
*/
|
|
466
490
|
tabularNumbers?: boolean;
|
|
467
491
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RollingNumber.d.ts","sourceRoot":"","sources":["../../../src/numbers/RollingNumber/RollingNumber.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,SAAS,EAEd,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"RollingNumber.d.ts","sourceRoot":"","sources":["../../../src/numbers/RollingNumber/RollingNumber.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,SAAS,EAEd,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,aAAa,EAAU,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAErF,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,sDAAsD,CAAC;AAE9D,OAAO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M,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC9B;;WAEG;QACH,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC9B;;WAEG;QACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC;;WAEG;QACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC;;WAEG;QACH,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC/B;;WAEG;QACH,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAChC;;WAEG;QACH,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAC7B;yCAoVJ,CAAC"}
|
|
@@ -1,13 +1,61 @@
|
|
|
1
|
-
const _excluded = ["value", "digitHeight", "initialValue", "textProps", "style", "styles", "transitionConfig", "RollingNumberMaskComponent"];
|
|
1
|
+
const _excluded = ["value", "digitHeight", "initialValue", "textProps", "style", "styles", "transitionConfig", "digitTransitionVariant", "direction", "RollingNumberMaskComponent"];
|
|
2
2
|
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); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { forwardRef, memo, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { StyleSheet } from 'react-native';
|
|
6
|
-
import Animated, { useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
6
|
+
import Animated, { LayoutAnimationConfig, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
|
|
7
7
|
import { Text } from '../../typography/Text';
|
|
8
8
|
import { DefaultRollingNumberMask } from './DefaultRollingNumberMask';
|
|
9
9
|
import { defaultTransitionConfig, digits } from './RollingNumber';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Apply timing or spring animation based on a config.
|
|
13
|
+
*/
|
|
10
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
const applyTransition = (value, config) => {
|
|
16
|
+
'worklet';
|
|
17
|
+
|
|
18
|
+
if ((config == null ? void 0 : config.type) === 'timing') return withTiming(value, config);
|
|
19
|
+
return withSpring(value, config);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates a custom transition animation worklet for single variant.
|
|
24
|
+
* Combines y translation with opacity fade.
|
|
25
|
+
* @param isEntering - true for entering animation, false for exiting
|
|
26
|
+
* @param isGoingUp - direction of the number change
|
|
27
|
+
* @param transitionConfig - animation timing/spring configuration
|
|
28
|
+
*/
|
|
29
|
+
const createTransitionAnimation = (isEntering, isGoingUp, transitionConfig) => values => {
|
|
30
|
+
'worklet';
|
|
31
|
+
|
|
32
|
+
var _transitionConfig$y, _transitionConfig$opa;
|
|
33
|
+
const yConfig = (_transitionConfig$y = transitionConfig == null ? void 0 : transitionConfig.y) != null ? _transitionConfig$y : defaultTransitionConfig.y;
|
|
34
|
+
const opacityConfig = (_transitionConfig$opa = transitionConfig == null ? void 0 : transitionConfig.opacity) != null ? _transitionConfig$opa : defaultTransitionConfig.opacity;
|
|
35
|
+
const height = isEntering ? values.targetHeight : values.currentHeight;
|
|
36
|
+
|
|
37
|
+
// Entering: come from opposite direction (going up = enter from bottom = positive Y)
|
|
38
|
+
// Exiting: go in direction of change (going up = exit upward = negative Y)
|
|
39
|
+
const yOffset = isGoingUp ? isEntering ? height : -height : isEntering ? -height : height;
|
|
40
|
+
const initialY = isEntering ? yOffset : 0;
|
|
41
|
+
const targetY = isEntering ? 0 : yOffset;
|
|
42
|
+
const initialOpacity = isEntering ? 0 : 1;
|
|
43
|
+
const targetOpacity = isEntering ? 1 : 0;
|
|
44
|
+
return {
|
|
45
|
+
initialValues: {
|
|
46
|
+
opacity: initialOpacity,
|
|
47
|
+
transform: [{
|
|
48
|
+
translateY: initialY
|
|
49
|
+
}]
|
|
50
|
+
},
|
|
51
|
+
animations: {
|
|
52
|
+
opacity: applyTransition(targetOpacity, opacityConfig),
|
|
53
|
+
transform: [{
|
|
54
|
+
translateY: applyTransition(targetY, yConfig)
|
|
55
|
+
}]
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
11
59
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
12
60
|
const baseStylesheet = StyleSheet.create({
|
|
13
61
|
digitContainer: {
|
|
@@ -19,10 +67,19 @@ const baseStylesheet = StyleSheet.create({
|
|
|
19
67
|
});
|
|
20
68
|
|
|
21
69
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
70
|
+
* Default digit component for RollingNumber on mobile.
|
|
71
|
+
*
|
|
72
|
+
* The mobile implementation differs from web due to platform-specific animation libraries:
|
|
73
|
+
* - Mobile uses react-native-reanimated with shared values and worklets
|
|
74
|
+
* - Web uses framer-motion with imperative `animate` calls
|
|
75
|
+
*
|
|
76
|
+
* For the "every" variant, mobile renders all 10 digits (0-9) stacked with absolute
|
|
77
|
+
* positioning and animates the container's translateY. Web renders only the necessary
|
|
78
|
+
* digits above/below the current value.
|
|
79
|
+
*
|
|
80
|
+
* For the "single" variant, mobile uses reanimated's `entering`/`exiting` props with
|
|
81
|
+
* custom animation worklets. Web uses imperative opacity crossfades on DOM sections.
|
|
82
|
+
*/
|
|
26
83
|
export const DefaultRollingNumberDigit = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
27
84
|
let {
|
|
28
85
|
value,
|
|
@@ -32,20 +89,34 @@ export const DefaultRollingNumberDigit = /*#__PURE__*/memo(/*#__PURE__*/forwardR
|
|
|
32
89
|
style,
|
|
33
90
|
styles,
|
|
34
91
|
transitionConfig,
|
|
92
|
+
digitTransitionVariant = 'every',
|
|
93
|
+
direction,
|
|
35
94
|
RollingNumberMaskComponent = DefaultRollingNumberMask
|
|
36
95
|
} = _ref,
|
|
37
96
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
97
|
+
const [singleVariantCurrentValue, setCurrentValue] = useState(initialValue);
|
|
38
98
|
const position = useSharedValue(initialValue * digitHeight * -1);
|
|
39
99
|
const prevValue = useRef(initialValue);
|
|
100
|
+
const isSingleVariant = useMemo(() => digitTransitionVariant === 'single', [digitTransitionVariant]);
|
|
101
|
+
const isGoingUp = useMemo(() => direction === 'up', [direction]);
|
|
102
|
+
|
|
103
|
+
// Single variant needs to re-render to give time for exit animation direction to be updated
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (value !== singleVariantCurrentValue) {
|
|
106
|
+
setCurrentValue(value);
|
|
107
|
+
}
|
|
108
|
+
}, [value, singleVariantCurrentValue]);
|
|
109
|
+
|
|
110
|
+
// Every variant needs to update the position of the digit immediately
|
|
40
111
|
useEffect(() => {
|
|
41
|
-
var _transitionConfig$
|
|
112
|
+
var _transitionConfig$y2;
|
|
42
113
|
if (prevValue.current === value) return;
|
|
43
114
|
const newPosition = value * digitHeight * -1;
|
|
44
|
-
|
|
45
|
-
|
|
115
|
+
const yConfig = (_transitionConfig$y2 = transitionConfig == null ? void 0 : transitionConfig.y) != null ? _transitionConfig$y2 : defaultTransitionConfig.y;
|
|
116
|
+
if ((yConfig == null ? void 0 : yConfig.type) === 'timing') {
|
|
117
|
+
position.value = withTiming(newPosition, yConfig);
|
|
46
118
|
} else {
|
|
47
|
-
|
|
48
|
-
position.value = withTiming(newPosition, (_transitionConfig$y2 = transitionConfig == null ? void 0 : transitionConfig.y) != null ? _transitionConfig$y2 : defaultTransitionConfig.y);
|
|
119
|
+
position.value = withSpring(newPosition, yConfig);
|
|
49
120
|
}
|
|
50
121
|
prevValue.current = value;
|
|
51
122
|
}, [digitHeight, position, transitionConfig == null ? void 0 : transitionConfig.y, value]);
|
|
@@ -54,20 +125,36 @@ export const DefaultRollingNumberDigit = /*#__PURE__*/memo(/*#__PURE__*/forwardR
|
|
|
54
125
|
translateY: position.value
|
|
55
126
|
}]
|
|
56
127
|
}));
|
|
57
|
-
const containerStyle = useMemo(() => [baseStylesheet.digitContainer, animatedStyle, style, styles == null ? void 0 : styles.root], [animatedStyle, style, styles == null ? void 0 : styles.root]);
|
|
128
|
+
const containerStyle = useMemo(() => [baseStylesheet.digitContainer, !isSingleVariant && animatedStyle, style, styles == null ? void 0 : styles.root], [animatedStyle, isSingleVariant, style, styles == null ? void 0 : styles.root]);
|
|
129
|
+
const singleVariantEnterTransition = useMemo(() => createTransitionAnimation(true, isGoingUp, transitionConfig), [isGoingUp, transitionConfig]);
|
|
130
|
+
const singleVariantExitTransition = useMemo(() => createTransitionAnimation(false, isGoingUp, transitionConfig), [isGoingUp, transitionConfig]);
|
|
131
|
+
|
|
132
|
+
// LayoutAnimationConfig disables mount/unmount animations on the digit container itself
|
|
133
|
+
// (e.g. when digits are added/removed going from $1,000 to $10,000 or vice versa).
|
|
134
|
+
// AnimatedText entering/exiting props handle value change animations separately.
|
|
58
135
|
return /*#__PURE__*/_jsx(RollingNumberMaskComponent, _extends({
|
|
59
136
|
ref: ref
|
|
60
137
|
}, props, {
|
|
61
|
-
children: /*#__PURE__*/_jsx(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
138
|
+
children: /*#__PURE__*/_jsx(LayoutAnimationConfig, {
|
|
139
|
+
skipEntering: true,
|
|
140
|
+
skipExiting: true,
|
|
141
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
142
|
+
style: containerStyle,
|
|
143
|
+
children: isSingleVariant ? /*#__PURE__*/_jsx(AnimatedText, _extends({
|
|
144
|
+
entering: singleVariantEnterTransition,
|
|
145
|
+
exiting: singleVariantExitTransition,
|
|
146
|
+
style: [styles == null ? void 0 : styles.text]
|
|
147
|
+
}, textProps, {
|
|
148
|
+
children: singleVariantCurrentValue
|
|
149
|
+
}), singleVariantCurrentValue) : digits.map(digit => /*#__PURE__*/_jsx(AnimatedText, _extends({
|
|
150
|
+
style: [{
|
|
151
|
+
position: digit === 0 ? 'relative' : 'absolute',
|
|
152
|
+
top: digit * digitHeight
|
|
153
|
+
}, styles == null ? void 0 : styles.text]
|
|
154
|
+
}, textProps, {
|
|
155
|
+
children: digit
|
|
156
|
+
}), digit))
|
|
157
|
+
})
|
|
71
158
|
})
|
|
72
159
|
}));
|
|
73
160
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["intlNumberParts", "textProps", "digitHeight", "formattedValue", "RollingNumberDigitComponent", "RollingNumberSymbolComponent", "RollingNumberMaskComponent", "style", "styles", "justifyContent", "transitionConfig"];
|
|
1
|
+
const _excluded = ["intlNumberParts", "textProps", "digitHeight", "formattedValue", "RollingNumberDigitComponent", "RollingNumberSymbolComponent", "RollingNumberMaskComponent", "style", "styles", "justifyContent", "transitionConfig", "digitTransitionVariant", "direction"];
|
|
2
2
|
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); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import { forwardRef, memo, useCallback, useMemo, useState } from 'react';
|
|
@@ -24,7 +24,9 @@ export const DefaultRollingNumberValueSection = /*#__PURE__*/memo(/*#__PURE__*/f
|
|
|
24
24
|
style,
|
|
25
25
|
styles,
|
|
26
26
|
justifyContent = 'flex-start',
|
|
27
|
-
transitionConfig
|
|
27
|
+
transitionConfig,
|
|
28
|
+
digitTransitionVariant,
|
|
29
|
+
direction
|
|
28
30
|
} = _ref,
|
|
29
31
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
30
32
|
const [numberSectionHasRendered, setValueSectionHasRendered] = useState(false);
|
|
@@ -51,6 +53,8 @@ export const DefaultRollingNumberValueSection = /*#__PURE__*/memo(/*#__PURE__*/f
|
|
|
51
53
|
return /*#__PURE__*/_jsx(RollingNumberDigitComponent, {
|
|
52
54
|
RollingNumberMaskComponent: RollingNumberMaskComponent,
|
|
53
55
|
digitHeight: digitHeight,
|
|
56
|
+
digitTransitionVariant: digitTransitionVariant,
|
|
57
|
+
direction: direction,
|
|
54
58
|
initialValue: numberSectionHasRendered ? 0 : undefined,
|
|
55
59
|
onLayout: () => setValueSectionHasRendered(true),
|
|
56
60
|
styles: {
|
|
@@ -60,7 +64,7 @@ export const DefaultRollingNumberValueSection = /*#__PURE__*/memo(/*#__PURE__*/f
|
|
|
60
64
|
transitionConfig: transitionConfig,
|
|
61
65
|
value: part.value
|
|
62
66
|
}, part.key);
|
|
63
|
-
}), [numberSectionHasRendered, setValueSectionHasRendered, intlNumberParts, digitHeight, RollingNumberDigitComponent, RollingNumberSymbolComponent, styles == null ? void 0 : styles.text, textProps, fallbackDigit, justifyContent, transitionConfig, RollingNumberMaskComponent]);
|
|
67
|
+
}), [numberSectionHasRendered, setValueSectionHasRendered, intlNumberParts, digitHeight, digitTransitionVariant, direction, RollingNumberDigitComponent, RollingNumberSymbolComponent, styles == null ? void 0 : styles.text, textProps, fallbackDigit, justifyContent, transitionConfig, RollingNumberMaskComponent]);
|
|
64
68
|
const formattedValueDigits = useMemo(() => formattedValue == null ? void 0 : formattedValue.split('').map((char, index) => {
|
|
65
69
|
if (!isDigit(char)) {
|
|
66
70
|
return /*#__PURE__*/_jsx(RollingNumberSymbolComponent, {
|
|
@@ -76,6 +80,8 @@ export const DefaultRollingNumberValueSection = /*#__PURE__*/memo(/*#__PURE__*/f
|
|
|
76
80
|
return /*#__PURE__*/_jsx(RollingNumberDigitComponent, {
|
|
77
81
|
RollingNumberMaskComponent: RollingNumberMaskComponent,
|
|
78
82
|
digitHeight: digitHeight,
|
|
83
|
+
digitTransitionVariant: digitTransitionVariant,
|
|
84
|
+
direction: direction,
|
|
79
85
|
initialValue: numberSectionHasRendered ? 0 : undefined,
|
|
80
86
|
onLayout: () => setValueSectionHasRendered(true),
|
|
81
87
|
styles: {
|
|
@@ -85,7 +91,7 @@ export const DefaultRollingNumberValueSection = /*#__PURE__*/memo(/*#__PURE__*/f
|
|
|
85
91
|
transitionConfig: transitionConfig,
|
|
86
92
|
value: parseInt(char)
|
|
87
93
|
}, index);
|
|
88
|
-
}), [numberSectionHasRendered, setValueSectionHasRendered, formattedValue, RollingNumberDigitComponent, RollingNumberSymbolComponent, styles == null ? void 0 : styles.text, digitHeight, textProps, fallbackDigit, justifyContent, transitionConfig, RollingNumberMaskComponent]);
|
|
94
|
+
}), [numberSectionHasRendered, setValueSectionHasRendered, formattedValue, RollingNumberDigitComponent, RollingNumberSymbolComponent, styles == null ? void 0 : styles.text, digitHeight, digitTransitionVariant, direction, textProps, fallbackDigit, justifyContent, transitionConfig, RollingNumberMaskComponent]);
|
|
89
95
|
return /*#__PURE__*/_jsx(HStack, _extends({
|
|
90
96
|
ref: ref,
|
|
91
97
|
alignItems: "center",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["value", "color", "colorPulseOnUpdate", "positivePulseColor", "negativePulseColor", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight", "tabularNumbers", "testID", "accessibilityLiveRegion", "locale", "format", "style", "prefix", "suffix", "styles", "enableSubscriptNotation", "transition", "formattedValue", "accessibilityLabel", "accessibilityLabelPrefix", "accessibilityLabelSuffix", "RollingNumberMaskComponent", "RollingNumberAffixSectionComponent", "RollingNumberValueSectionComponent", "RollingNumberDigitComponent", "RollingNumberSymbolComponent"];
|
|
1
|
+
const _excluded = ["value", "color", "colorPulseOnUpdate", "positivePulseColor", "negativePulseColor", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight", "tabularNumbers", "testID", "accessibilityLiveRegion", "locale", "format", "style", "prefix", "suffix", "styles", "enableSubscriptNotation", "transition", "digitTransitionVariant", "formattedValue", "accessibilityLabel", "accessibilityLabelPrefix", "accessibilityLabelSuffix", "RollingNumberMaskComponent", "RollingNumberAffixSectionComponent", "RollingNumberValueSectionComponent", "RollingNumberDigitComponent", "RollingNumberSymbolComponent"];
|
|
2
2
|
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); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import { forwardRef, memo, useMemo, useState } from 'react';
|
|
@@ -6,6 +6,7 @@ import { StyleSheet } from 'react-native';
|
|
|
6
6
|
import { Easing } from 'react-native-reanimated';
|
|
7
7
|
import { curves, durations } from '@coinbase/cds-common/motion/tokens';
|
|
8
8
|
import { IntlNumberFormat } from '@coinbase/cds-common/numbers/IntlNumberFormat';
|
|
9
|
+
import { useValueChangeDirection } from '@coinbase/cds-common/numbers/useValueChangeDirection';
|
|
9
10
|
import { useLocale } from '@coinbase/cds-common/system/LocaleProvider';
|
|
10
11
|
import { HStack } from '../../layout/HStack';
|
|
11
12
|
import { Text } from '../../typography/Text';
|
|
@@ -42,8 +43,14 @@ const baseStylesheet = StyleSheet.create({
|
|
|
42
43
|
|
|
43
44
|
export const defaultTransitionConfig = {
|
|
44
45
|
y: {
|
|
46
|
+
type: 'spring',
|
|
47
|
+
stiffness: 280,
|
|
48
|
+
damping: 18,
|
|
49
|
+
mass: 0.3
|
|
50
|
+
},
|
|
51
|
+
opacity: {
|
|
45
52
|
type: 'timing',
|
|
46
|
-
duration: durations.
|
|
53
|
+
duration: durations.fast2,
|
|
47
54
|
easing: Easing.bezier(...curves.global)
|
|
48
55
|
},
|
|
49
56
|
color: {
|
|
@@ -53,6 +60,12 @@ export const defaultTransitionConfig = {
|
|
|
53
60
|
}
|
|
54
61
|
};
|
|
55
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Defines the style of digit transition animation.
|
|
65
|
+
* - `'every'`: Rolls through every intermediate digit (e.g., 1→2→3→...→9). Default behavior.
|
|
66
|
+
* - `'single'`: Rolls directly to the new digit without showing intermediates (e.g., 1→9).
|
|
67
|
+
*/
|
|
68
|
+
|
|
56
69
|
// Subcomponent prop and component type declarations
|
|
57
70
|
|
|
58
71
|
export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
@@ -79,6 +92,7 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
79
92
|
styles,
|
|
80
93
|
enableSubscriptNotation,
|
|
81
94
|
transition = defaultTransitionConfig,
|
|
95
|
+
digitTransitionVariant = 'every',
|
|
82
96
|
formattedValue,
|
|
83
97
|
accessibilityLabel,
|
|
84
98
|
accessibilityLabelPrefix,
|
|
@@ -95,6 +109,7 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
95
109
|
} = useLocale();
|
|
96
110
|
const locale = localeProp != null ? localeProp : defaultLocale;
|
|
97
111
|
const [digitHeight, setDigitHeight] = useState();
|
|
112
|
+
const direction = useValueChangeDirection(value);
|
|
98
113
|
const handleMeasureDigits = e => {
|
|
99
114
|
const {
|
|
100
115
|
layout
|
|
@@ -176,6 +191,8 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
176
191
|
RollingNumberMaskComponent: RollingNumberMaskComponent,
|
|
177
192
|
RollingNumberSymbolComponent: RollingNumberSymbolComponent,
|
|
178
193
|
digitHeight: digitHeight,
|
|
194
|
+
digitTransitionVariant: digitTransitionVariant,
|
|
195
|
+
direction: direction,
|
|
179
196
|
intlNumberParts: pre,
|
|
180
197
|
justifyContent: "flex-end",
|
|
181
198
|
style: styles == null ? void 0 : styles.i18nPrefix,
|
|
@@ -189,6 +206,8 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
189
206
|
RollingNumberMaskComponent: RollingNumberMaskComponent,
|
|
190
207
|
RollingNumberSymbolComponent: RollingNumberSymbolComponent,
|
|
191
208
|
digitHeight: digitHeight,
|
|
209
|
+
digitTransitionVariant: digitTransitionVariant,
|
|
210
|
+
direction: direction,
|
|
192
211
|
intlNumberParts: integer,
|
|
193
212
|
justifyContent: "flex-end",
|
|
194
213
|
style: styles == null ? void 0 : styles.integer,
|
|
@@ -202,6 +221,8 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
202
221
|
RollingNumberMaskComponent: RollingNumberMaskComponent,
|
|
203
222
|
RollingNumberSymbolComponent: RollingNumberSymbolComponent,
|
|
204
223
|
digitHeight: digitHeight,
|
|
224
|
+
digitTransitionVariant: digitTransitionVariant,
|
|
225
|
+
direction: direction,
|
|
205
226
|
intlNumberParts: fraction,
|
|
206
227
|
justifyContent: "flex-start",
|
|
207
228
|
style: styles == null ? void 0 : styles.fraction,
|
|
@@ -215,6 +236,8 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
215
236
|
RollingNumberMaskComponent: RollingNumberMaskComponent,
|
|
216
237
|
RollingNumberSymbolComponent: RollingNumberSymbolComponent,
|
|
217
238
|
digitHeight: digitHeight,
|
|
239
|
+
digitTransitionVariant: digitTransitionVariant,
|
|
240
|
+
direction: direction,
|
|
218
241
|
intlNumberParts: post,
|
|
219
242
|
justifyContent: "flex-start",
|
|
220
243
|
style: styles == null ? void 0 : styles.i18nSuffix,
|
|
@@ -225,12 +248,14 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
225
248
|
transitionConfig: transitionConfig
|
|
226
249
|
})]
|
|
227
250
|
});
|
|
228
|
-
}, [intlNumberFormatter, enableSubscriptNotation, styles == null ? void 0 : styles.formattedValueSection, styles == null ? void 0 : styles.i18nPrefix, styles == null ? void 0 : styles.text, styles == null ? void 0 : styles.integer, styles == null ? void 0 : styles.fraction, styles == null ? void 0 : styles.i18nSuffix, RollingNumberValueSectionComponent, RollingNumberDigitComponent, RollingNumberMaskComponent, RollingNumberSymbolComponent, digitHeight, animatedColorStyle, textProps, transitionConfig]);
|
|
251
|
+
}, [intlNumberFormatter, enableSubscriptNotation, styles == null ? void 0 : styles.formattedValueSection, styles == null ? void 0 : styles.i18nPrefix, styles == null ? void 0 : styles.text, styles == null ? void 0 : styles.integer, styles == null ? void 0 : styles.fraction, styles == null ? void 0 : styles.i18nSuffix, RollingNumberValueSectionComponent, RollingNumberDigitComponent, RollingNumberMaskComponent, RollingNumberSymbolComponent, digitHeight, digitTransitionVariant, direction, animatedColorStyle, textProps, transitionConfig]);
|
|
229
252
|
const formattedValueValueSection = useMemo(() => /*#__PURE__*/_jsx(RollingNumberValueSectionComponent, {
|
|
230
253
|
RollingNumberDigitComponent: RollingNumberDigitComponent,
|
|
231
254
|
RollingNumberMaskComponent: RollingNumberMaskComponent,
|
|
232
255
|
RollingNumberSymbolComponent: RollingNumberSymbolComponent,
|
|
233
256
|
digitHeight: digitHeight,
|
|
257
|
+
digitTransitionVariant: digitTransitionVariant,
|
|
258
|
+
direction: direction,
|
|
234
259
|
formattedValue: formattedValue,
|
|
235
260
|
intlNumberParts: [],
|
|
236
261
|
justifyContent: "flex-start",
|
|
@@ -240,7 +265,7 @@ export const RollingNumber = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, re
|
|
|
240
265
|
},
|
|
241
266
|
textProps: textProps,
|
|
242
267
|
transitionConfig: transitionConfig
|
|
243
|
-
}), [RollingNumberMaskComponent, styles == null ? void 0 : styles.formattedValueSection, styles == null ? void 0 : styles.text, RollingNumberValueSectionComponent, RollingNumberDigitComponent, RollingNumberSymbolComponent, formattedValue, digitHeight, animatedColorStyle, textProps, transitionConfig]);
|
|
268
|
+
}), [RollingNumberMaskComponent, styles == null ? void 0 : styles.formattedValueSection, styles == null ? void 0 : styles.text, RollingNumberValueSectionComponent, RollingNumberDigitComponent, RollingNumberSymbolComponent, formattedValue, digitHeight, digitTransitionVariant, direction, animatedColorStyle, textProps, transitionConfig]);
|
|
244
269
|
const screenReaderOnlySection = useMemo(() => {
|
|
245
270
|
const prefixString = typeof prefix === 'string' ? prefix : '';
|
|
246
271
|
const suffixString = typeof suffix === 'string' ? suffix : '';
|
|
@@ -327,6 +327,11 @@ export const ColorAndTransition = () => {
|
|
|
327
327
|
duration: durations.moderate3,
|
|
328
328
|
easing: Easing.inOut(Easing.quad)
|
|
329
329
|
},
|
|
330
|
+
opacity: {
|
|
331
|
+
type: 'timing',
|
|
332
|
+
duration: durations.moderate3,
|
|
333
|
+
easing: Easing.inOut(Easing.quad)
|
|
334
|
+
},
|
|
330
335
|
y: {
|
|
331
336
|
type: 'timing',
|
|
332
337
|
duration: durations.moderate3,
|
|
@@ -348,6 +353,11 @@ export const ColorAndTransition = () => {
|
|
|
348
353
|
duration: durations.slow4,
|
|
349
354
|
easing: Easing.inOut(Easing.quad)
|
|
350
355
|
},
|
|
356
|
+
opacity: {
|
|
357
|
+
type: 'timing',
|
|
358
|
+
duration: durations.slow4,
|
|
359
|
+
easing: Easing.inOut(Easing.quad)
|
|
360
|
+
},
|
|
351
361
|
y: {
|
|
352
362
|
type: 'timing',
|
|
353
363
|
duration: durations.slow4,
|
|
@@ -379,15 +389,20 @@ export const ColorAndTransition = () => {
|
|
|
379
389
|
currency: 'EUR'
|
|
380
390
|
},
|
|
381
391
|
transition: {
|
|
382
|
-
|
|
392
|
+
color: {
|
|
393
|
+
type: 'timing',
|
|
394
|
+
duration: 5000,
|
|
395
|
+
easing: Easing.bezier(...curves.global)
|
|
396
|
+
},
|
|
397
|
+
opacity: {
|
|
383
398
|
type: 'timing',
|
|
384
399
|
duration: durations.fast1,
|
|
385
400
|
easing: Easing.bezier(...curves.enterFunctional)
|
|
386
401
|
},
|
|
387
|
-
|
|
402
|
+
y: {
|
|
388
403
|
type: 'timing',
|
|
389
|
-
duration:
|
|
390
|
-
easing: Easing.bezier(...curves.
|
|
404
|
+
duration: durations.fast1,
|
|
405
|
+
easing: Easing.bezier(...curves.enterFunctional)
|
|
391
406
|
}
|
|
392
407
|
},
|
|
393
408
|
value: price
|
|
@@ -422,15 +437,20 @@ export const ColorAndTransition = () => {
|
|
|
422
437
|
currency: 'USD'
|
|
423
438
|
},
|
|
424
439
|
transition: {
|
|
425
|
-
|
|
440
|
+
color: {
|
|
441
|
+
type: 'timing',
|
|
442
|
+
duration: durations.slow1,
|
|
443
|
+
easing: Easing.bezier(...curves.exitFunctional)
|
|
444
|
+
},
|
|
445
|
+
opacity: {
|
|
426
446
|
type: 'timing',
|
|
427
447
|
duration: durations.moderate2,
|
|
428
448
|
easing: Easing.bezier(...curves.enterExpressive)
|
|
429
449
|
},
|
|
430
|
-
|
|
450
|
+
y: {
|
|
431
451
|
type: 'timing',
|
|
432
|
-
duration: durations.
|
|
433
|
-
easing: Easing.bezier(...curves.
|
|
452
|
+
duration: durations.moderate2,
|
|
453
|
+
easing: Easing.bezier(...curves.enterExpressive)
|
|
434
454
|
}
|
|
435
455
|
},
|
|
436
456
|
value: price
|
|
@@ -940,6 +960,67 @@ const FunExamples = () => {
|
|
|
940
960
|
children: [/*#__PURE__*/_jsx(CounterExample, {}), /*#__PURE__*/_jsx(CountDownExample, {}), /*#__PURE__*/_jsx(SubscriptionPriceExample, {}), /*#__PURE__*/_jsx(StatisticsExample, {}), /*#__PURE__*/_jsx(LiveBiddingExample, {})]
|
|
941
961
|
});
|
|
942
962
|
};
|
|
963
|
+
const SingleTransition = () => {
|
|
964
|
+
const [price, setPrice] = React.useState(12345.67);
|
|
965
|
+
const onUp = () => setPrice(p => Math.round((p + Math.random() * 100) * 100) / 100);
|
|
966
|
+
const onDown = () => setPrice(p => Math.max(0, Math.round((p - Math.random() * 100) * 100) / 100));
|
|
967
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
968
|
+
gap: 2,
|
|
969
|
+
children: [/*#__PURE__*/_jsx(RollingNumber, {
|
|
970
|
+
digitTransitionVariant: "single",
|
|
971
|
+
font: "title1",
|
|
972
|
+
format: {
|
|
973
|
+
style: 'currency',
|
|
974
|
+
currency: 'USD'
|
|
975
|
+
},
|
|
976
|
+
value: price
|
|
977
|
+
}), /*#__PURE__*/_jsxs(HStack, {
|
|
978
|
+
gap: 2,
|
|
979
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
980
|
+
onPress: onUp,
|
|
981
|
+
children: "Increase"
|
|
982
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
983
|
+
onPress: onDown,
|
|
984
|
+
children: "Decrease"
|
|
985
|
+
})]
|
|
986
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
987
|
+
font: "label1",
|
|
988
|
+
children: "Comparison: Every vs Single"
|
|
989
|
+
}), /*#__PURE__*/_jsxs(HStack, {
|
|
990
|
+
gap: 2,
|
|
991
|
+
children: [/*#__PURE__*/_jsxs(VStack, {
|
|
992
|
+
gap: 0.5,
|
|
993
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
994
|
+
color: "fgMuted",
|
|
995
|
+
font: "caption",
|
|
996
|
+
children: "Every (default)"
|
|
997
|
+
}), /*#__PURE__*/_jsx(RollingNumber, {
|
|
998
|
+
font: "title1",
|
|
999
|
+
format: {
|
|
1000
|
+
style: 'currency',
|
|
1001
|
+
currency: 'USD'
|
|
1002
|
+
},
|
|
1003
|
+
value: price
|
|
1004
|
+
})]
|
|
1005
|
+
}), /*#__PURE__*/_jsxs(VStack, {
|
|
1006
|
+
gap: 0.5,
|
|
1007
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
1008
|
+
color: "fgMuted",
|
|
1009
|
+
font: "caption",
|
|
1010
|
+
children: "Single"
|
|
1011
|
+
}), /*#__PURE__*/_jsx(RollingNumber, {
|
|
1012
|
+
digitTransitionVariant: "single",
|
|
1013
|
+
font: "title1",
|
|
1014
|
+
format: {
|
|
1015
|
+
style: 'currency',
|
|
1016
|
+
currency: 'USD'
|
|
1017
|
+
},
|
|
1018
|
+
value: price
|
|
1019
|
+
})]
|
|
1020
|
+
})]
|
|
1021
|
+
})]
|
|
1022
|
+
});
|
|
1023
|
+
};
|
|
943
1024
|
const Accessibility = () => {
|
|
944
1025
|
return /*#__PURE__*/_jsxs(VStack, {
|
|
945
1026
|
gap: 2,
|
|
@@ -982,6 +1063,9 @@ const RollingNumberScreen = () => {
|
|
|
982
1063
|
}), /*#__PURE__*/_jsx(Example, {
|
|
983
1064
|
title: "Color and Transition",
|
|
984
1065
|
children: /*#__PURE__*/_jsx(ColorAndTransition, {})
|
|
1066
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
1067
|
+
title: "Single Transition",
|
|
1068
|
+
children: /*#__PURE__*/_jsx(SingleTransition, {})
|
|
985
1069
|
}), /*#__PURE__*/_jsx(Example, {
|
|
986
1070
|
title: "Format",
|
|
987
1071
|
children: /*#__PURE__*/_jsx(Format, {})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.33.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"react-native-svg": "^14.1.0"
|
|
199
199
|
},
|
|
200
200
|
"dependencies": {
|
|
201
|
-
"@coinbase/cds-common": "^8.
|
|
201
|
+
"@coinbase/cds-common": "^8.33.0",
|
|
202
202
|
"@coinbase/cds-icons": "^5.8.0",
|
|
203
203
|
"@coinbase/cds-illustrations": "^4.29.0",
|
|
204
204
|
"@coinbase/cds-lottie-files": "^3.3.4",
|