@coinbase/cds-mobile 9.0.0-rc.2 → 9.0.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 (78) hide show
  1. package/CHANGELOG.md +99 -5
  2. package/README.md +2 -2
  3. package/dts/buttons/Button.d.ts.map +1 -1
  4. package/dts/buttons/IconButton.d.ts +19 -1
  5. package/dts/buttons/IconButton.d.ts.map +1 -1
  6. package/dts/cells/Cell.d.ts +2 -1
  7. package/dts/cells/Cell.d.ts.map +1 -1
  8. package/dts/controls/InputIconButton.d.ts +5 -0
  9. package/dts/controls/InputIconButton.d.ts.map +1 -1
  10. package/dts/controls/InputLabel.d.ts.map +1 -1
  11. package/dts/controls/NativeInput.d.ts +12 -2
  12. package/dts/controls/NativeInput.d.ts.map +1 -1
  13. package/dts/controls/SearchInput.d.ts +5 -1
  14. package/dts/controls/SearchInput.d.ts.map +1 -1
  15. package/dts/controls/TextInput.d.ts +5 -2
  16. package/dts/controls/TextInput.d.ts.map +1 -1
  17. package/dts/core/theme.d.ts +12 -0
  18. package/dts/core/theme.d.ts.map +1 -1
  19. package/dts/illustrations/createIllustration.d.ts +3 -0
  20. package/dts/illustrations/createIllustration.d.ts.map +1 -1
  21. package/dts/page/PageFooter.d.ts +8 -0
  22. package/dts/page/PageFooter.d.ts.map +1 -1
  23. package/dts/system/ThemeProvider.d.ts.map +1 -1
  24. package/dts/tabs/DefaultTab.d.ts +4 -2
  25. package/dts/tabs/DefaultTab.d.ts.map +1 -1
  26. package/dts/tabs/DefaultTabsActiveIndicator.d.ts.map +1 -1
  27. package/dts/tabs/SegmentedTab.d.ts +4 -4
  28. package/dts/tabs/Tabs.d.ts +10 -1
  29. package/dts/tabs/Tabs.d.ts.map +1 -1
  30. package/dts/tag/Tag.d.ts +5 -3
  31. package/dts/tag/Tag.d.ts.map +1 -1
  32. package/dts/themes/coinbaseDenseTheme.d.ts +34 -2
  33. package/dts/themes/coinbaseDenseTheme.d.ts.map +1 -1
  34. package/dts/themes/coinbaseHighContrastTheme.d.ts +32 -0
  35. package/dts/themes/coinbaseHighContrastTheme.d.ts.map +1 -1
  36. package/dts/themes/coinbaseTheme.d.ts +34 -2
  37. package/dts/themes/coinbaseTheme.d.ts.map +1 -1
  38. package/dts/themes/defaultHighContrastTheme.d.ts +32 -0
  39. package/dts/themes/defaultHighContrastTheme.d.ts.map +1 -1
  40. package/dts/themes/defaultTheme.d.ts +34 -2
  41. package/dts/themes/defaultTheme.d.ts.map +1 -1
  42. package/dts/utils/convertThemedSvgToHex.d.ts +6 -0
  43. package/dts/utils/convertThemedSvgToHex.d.ts.map +1 -0
  44. package/dts/utils/testHelpers.d.ts +34 -2
  45. package/dts/utils/testHelpers.d.ts.map +1 -1
  46. package/dts/visualizations/chart/PeriodSelector.d.ts.map +1 -1
  47. package/dts/visualizations/chart/gradient/Gradient.d.ts.map +1 -1
  48. package/esm/buttons/IconButton.js +11 -3
  49. package/esm/buttons/__stories__/IconButton.stories.js +65 -0
  50. package/esm/controls/InputLabel.js +4 -3
  51. package/esm/controls/NativeInput.js +3 -1
  52. package/esm/controls/TextInput.js +25 -15
  53. package/esm/illustrations/__stories__/ThemedIllustrations.stories.js +214 -0
  54. package/esm/illustrations/__stories__/illustrationThemes.js +122 -0
  55. package/esm/illustrations/createIllustration.js +31 -5
  56. package/esm/page/PageFooter.js +16 -5
  57. package/esm/page/__figma__/PageFooter.figma.js +49 -6
  58. package/esm/system/ThemeProvider.js +3 -1
  59. package/esm/system/__stories__/componentConfigStickerSheet/StickerSheet.js +4 -0
  60. package/esm/system/__stories__/componentConfigStickerSheet/customComponentConfig.js +24 -12
  61. package/esm/system/__stories__/componentConfigStickerSheet/examples/ListCell.js +2 -0
  62. package/esm/system/__stories__/componentConfigStickerSheet/examples/Tabs.js +24 -0
  63. package/esm/system/__stories__/componentConfigStickerSheet/examples/TextInput.js +12 -0
  64. package/esm/tabs/DefaultTab.js +7 -9
  65. package/esm/tabs/DefaultTabsActiveIndicator.js +1 -2
  66. package/esm/tabs/Tabs.js +18 -12
  67. package/esm/tabs/__stories__/SegmentedTabs.stories.js +8 -1
  68. package/esm/tabs/__stories__/Tabs.stories.js +0 -1
  69. package/esm/tag/Tag.js +14 -4
  70. package/esm/themes/coinbaseHighContrastTheme.js +32 -0
  71. package/esm/themes/coinbaseTheme.js +34 -2
  72. package/esm/themes/defaultHighContrastTheme.js +32 -0
  73. package/esm/themes/defaultTheme.js +34 -2
  74. package/esm/utils/convertThemedSvgToHex.js +9 -0
  75. package/esm/visualizations/chart/PeriodSelector.js +3 -4
  76. package/esm/visualizations/chart/area/__stories__/AreaChart.stories.js +44 -2
  77. package/esm/visualizations/chart/gradient/Gradient.js +11 -2
  78. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
- const _excluded = ["id", "label", "disabled", "onPress", "count", "max", "accessibilityLabel", "style", "testID"];
1
+ const _excluded = ["id", "label", "disabled", "onPress", "count", "max", "accessibilityLabel", "style", "testID", "color", "activeColor"];
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 React, { forwardRef, memo, useCallback, useMemo } from 'react';
4
+ import React, { forwardRef, memo, useCallback } from 'react';
5
5
  import { Pressable } from 'react-native';
6
6
  import { useTabsContext } from '@coinbase/cds-common/tabs/TabsContext';
7
7
  import { accessibleOpacityDisabled } from '@coinbase/cds-common/tokens/interactable';
@@ -22,7 +22,9 @@ const DefaultTabComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref
22
22
  max,
23
23
  accessibilityLabel,
24
24
  style,
25
- testID
25
+ testID,
26
+ color = 'fg',
27
+ activeColor = 'fgPrimary'
26
28
  } = _ref,
27
29
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
28
30
  const theme = useTheme();
@@ -37,10 +39,6 @@ const DefaultTabComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref
37
39
  updateActiveTab(id);
38
40
  onPress == null || onPress(id, event);
39
41
  }, [id, onPress, updateActiveTab]);
40
- const labelPaddingStyle = useMemo(() => ({
41
- paddingTop: theme.space[2],
42
- paddingBottom: theme.space[2] - 2
43
- }), [theme.space]);
44
42
  return /*#__PURE__*/_jsx(Pressable, _extends({
45
43
  ref: ref,
46
44
  accessibilityLabel: accessibilityLabel,
@@ -60,9 +58,9 @@ const DefaultTabComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref
60
58
  alignItems: "center",
61
59
  gap: 0.5,
62
60
  children: [/*#__PURE__*/_jsx(Text, {
63
- color: isActive ? 'fgPrimary' : 'fg',
61
+ color: isActive ? activeColor : color,
64
62
  font: "headline",
65
- style: labelPaddingStyle,
63
+ paddingY: 2,
66
64
  children: label
67
65
  }), !!count && /*#__PURE__*/_jsx(DotCount, {
68
66
  count: count,
@@ -7,8 +7,7 @@ import { Box } from '../layout';
7
7
  import { tabsSpringConfig } from './Tabs';
8
8
 
9
9
  /**
10
- * Default underline-style indicator for mobile `Tabs`. Pass as
11
- * `TabsActiveIndicatorComponent={DefaultTabsActiveIndicator}` with `TabComponent={DefaultTab}`.
10
+ * Default underline-style indicator for mobile `Tabs`.
12
11
  */
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  const AnimatedBox = Animated.createAnimatedComponent(Box);
package/esm/tabs/Tabs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const _excluded = ["id", "registerRef"],
2
- _excluded2 = ["tabs", "TabComponent", "TabsActiveIndicatorComponent", "activeBackground", "activeTab", "disabled", "onChange", "styles", "style", "role", "position", "alignSelf", "opacity", "onActiveTabElementChange", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "testID"],
2
+ _excluded2 = ["tabs", "TabComponent", "TabsActiveIndicatorComponent", "activeBackground", "color", "activeColor", "activeTab", "disabled", "onChange", "styles", "style", "role", "position", "alignSelf", "opacity", "onActiveTabElementChange", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "testID"],
3
3
  _excluded3 = ["id", "Component"],
4
4
  _excluded4 = ["activeTabRect", "position", "style", "testID"];
5
5
  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); }
@@ -44,6 +44,8 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
44
44
  TabComponent = DefaultTab,
45
45
  TabsActiveIndicatorComponent = DefaultTabsActiveIndicator,
46
46
  activeBackground,
47
+ color,
48
+ activeColor,
47
49
  activeTab,
48
50
  disabled,
49
51
  onChange,
@@ -102,6 +104,7 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
102
104
  borderRadius: borderRadius,
103
105
  borderTopLeftRadius: borderTopLeftRadius,
104
106
  borderTopRightRadius: borderTopRightRadius,
107
+ color: color,
105
108
  onLayout: updateActiveTabRect,
106
109
  opacity: opacity != null ? opacity : disabled ? accessibleOpacityDisabled : 1,
107
110
  position: position,
@@ -121,20 +124,23 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
121
124
  borderTopRightRadius: borderTopRightRadius,
122
125
  style: styles == null ? void 0 : styles.activeIndicator,
123
126
  testID: testID ? testID + "-active-indicator" : undefined
124
- }), tabs.map(_ref2 => {
125
- let {
127
+ }), tabs.map(tabProps => {
128
+ const {
126
129
  id,
127
130
  Component: CustomTabComponent
128
- } = _ref2,
129
- props = _objectWithoutPropertiesLoose(_ref2, _excluded3);
131
+ } = tabProps,
132
+ tabRest = _objectWithoutPropertiesLoose(tabProps, _excluded3);
130
133
  const RenderedTab = CustomTabComponent != null ? CustomTabComponent : TabComponent;
134
+ const renderedTabProps = _extends({
135
+ activeColor,
136
+ color,
137
+ id,
138
+ style: styles == null ? void 0 : styles.tab
139
+ }, tabRest);
131
140
  return /*#__PURE__*/_jsx(TabContainer, {
132
141
  id: id,
133
142
  registerRef: registerRef,
134
- children: /*#__PURE__*/_jsx(RenderedTab, _extends({
135
- id: id,
136
- style: styles == null ? void 0 : styles.tab
137
- }, props))
143
+ children: /*#__PURE__*/_jsx(RenderedTab, _extends({}, renderedTabProps))
138
144
  }, id);
139
145
  })]
140
146
  })
@@ -142,14 +148,14 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
142
148
  }));
143
149
  TabsComponent.displayName = 'Tabs';
144
150
  export const Tabs = TabsComponent;
145
- export const TabsActiveIndicator = _ref3 => {
151
+ export const TabsActiveIndicator = _ref2 => {
146
152
  let {
147
153
  activeTabRect,
148
154
  position = 'absolute',
149
155
  style,
150
156
  testID = 'tabs-active-indicator'
151
- } = _ref3,
152
- props = _objectWithoutPropertiesLoose(_ref3, _excluded4);
157
+ } = _ref2,
158
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded4);
153
159
  const previousActiveTabRect = useRef(activeTabRect);
154
160
  const newActiveTabRect = {
155
161
  x: activeTabRect.x,
@@ -291,7 +291,14 @@ const SegmentedTabsScreen = () => /*#__PURE__*/_jsxs(ExampleScreen, {
291
291
  defaultActiveTab: basicSegments[0],
292
292
  tabs: basicSegments,
293
293
  title: "Border Radius"
294
- }), /*#__PURE__*/_jsx(CustomStylesExample, {}), /*#__PURE__*/_jsx(IconLabelsExample, {})]
294
+ }), /*#__PURE__*/_jsx(CustomStylesExample, {}), /*#__PURE__*/_jsx(IconLabelsExample, {}), /*#__PURE__*/_jsx(SegmentedTabsExample, {
295
+ activeBackground: "bgPositiveWash",
296
+ activeColor: "bgPositive",
297
+ color: "fgMuted",
298
+ defaultActiveTab: basicSegments[0],
299
+ tabs: basicSegments,
300
+ title: "Label Colors"
301
+ })]
295
302
  });
296
303
  const CustomStylesExample = () => {
297
304
  const theme = useTheme();
@@ -97,7 +97,6 @@ const TabsWithPanelsExample = () => {
97
97
  children: "Pair tab buttons with content regions that follow the active tab (see panel below)."
98
98
  }), /*#__PURE__*/_jsx(Tabs, {
99
99
  TabComponent: DefaultTab,
100
- TabsActiveIndicatorComponent: DefaultTabsActiveIndicator,
101
100
  accessibilityLabel: "Content sections",
102
101
  activeBackground: "bg",
103
102
  activeTab: activeTab,
package/esm/tag/Tag.js CHANGED
@@ -1,4 +1,4 @@
1
- const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "alignItems", "flexDirection", "gap", "justifyContent", "paddingY", "testID"];
1
+ const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "alignItems", "flexDirection", "gap", "justifyContent", "paddingX", "paddingY", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight", "testID"];
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 React, { forwardRef, memo } from 'react';
@@ -6,7 +6,7 @@ import { tagBorderRadiusMap, tagEmphasisColorMap, tagFontMap, tagHorizontalSpaci
6
6
  import { useComponentConfig } from '../hooks/useComponentConfig';
7
7
  import { useTheme } from '../hooks/useTheme';
8
8
  import { Icon } from '../icons/Icon';
9
- import { Box } from '../layout';
9
+ import { Box } from '../layout/Box';
10
10
  import { Text } from '../typography/Text';
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedRef) => {
@@ -28,7 +28,13 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedR
28
28
  flexDirection = 'row',
29
29
  gap = 0.5,
30
30
  justifyContent = 'center',
31
+ paddingX,
31
32
  paddingY = 0.25,
33
+ font,
34
+ fontFamily,
35
+ fontSize,
36
+ fontWeight,
37
+ lineHeight,
32
38
  testID = 'cds-tag'
33
39
  } = mergedProps,
34
40
  props = _objectWithoutPropertiesLoose(mergedProps, _excluded);
@@ -47,7 +53,7 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedR
47
53
  flexDirection: flexDirection,
48
54
  gap: gap,
49
55
  justifyContent: justifyContent,
50
- paddingX: tagHorizontalSpacing[intent],
56
+ paddingX: paddingX != null ? paddingX : tagHorizontalSpacing[intent],
51
57
  paddingY: paddingY,
52
58
  style: {
53
59
  backgroundColor
@@ -60,7 +66,11 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedR
60
66
  name: startIcon,
61
67
  size: "xs"
62
68
  }) : null, /*#__PURE__*/_jsx(Text, {
63
- font: tagFontMap[intent],
69
+ font: font != null ? font : tagFontMap[intent],
70
+ fontFamily: fontFamily,
71
+ fontSize: fontSize,
72
+ fontWeight: fontWeight,
73
+ lineHeight: lineHeight,
64
74
  numberOfLines: 1,
65
75
  style: {
66
76
  color
@@ -564,5 +564,37 @@ export const coinbaseHighContrastTheme = {
564
564
  shadowOpacity: 0.12,
565
565
  shadowRadius: 24
566
566
  }
567
+ },
568
+ lightIllustrationColor: {
569
+ primary: "rgb(" + lightSpectrum.blue60 + ")",
570
+ black: "rgb(" + lightSpectrum.gray100 + ")",
571
+ white: "rgb(" + lightSpectrum.gray0 + ")",
572
+ gray: "rgb(" + lightSpectrum.gray20 + ")",
573
+ gray2: "rgb(10, 11, 15)",
574
+ gray3: "rgb(206, 210, 220)",
575
+ positive: "rgb(" + lightSpectrum.green30 + ")",
576
+ negative: "rgb(" + lightSpectrum.red50 + ")",
577
+ accent1: "rgb(255, 210, 0)",
578
+ accent2: "rgb(" + lightSpectrum.teal15 + ")",
579
+ accent3: "rgb(" + lightSpectrum.orange40 + ")",
580
+ accent4: "rgb(" + lightSpectrum.blue20 + ")",
581
+ invert: "rgb(10, 11, 14)",
582
+ invert2: "rgb(255, 255, 254)"
583
+ },
584
+ darkIllustrationColor: {
585
+ primary: "rgb(" + darkSpectrum.blue70 + ")",
586
+ black: "rgb(" + darkSpectrum.gray0 + ")",
587
+ white: "rgb(" + darkSpectrum.gray100 + ")",
588
+ gray: "rgb(" + darkSpectrum.gray30 + ")",
589
+ gray2: "rgb(" + darkSpectrum.gray30 + ")",
590
+ gray3: "rgb(" + darkSpectrum.gray100 + ")",
591
+ positive: "rgb(" + darkSpectrum.green70 + ")",
592
+ negative: "rgb(" + darkSpectrum.red60 + ")",
593
+ accent1: "rgb(236, 208, 105)",
594
+ accent2: "rgb(" + darkSpectrum.teal80 + ")",
595
+ accent3: "rgb(" + darkSpectrum.orange60 + ")",
596
+ accent4: "rgb(" + darkSpectrum.blue80 + ")",
597
+ invert: "rgb(" + darkSpectrum.gray100 + ")",
598
+ invert2: "rgb(" + darkSpectrum.gray50 + ")"
567
599
  }
568
600
  };
@@ -316,7 +316,7 @@ export const coinbaseTheme = {
316
316
  bgNegativeWash: "rgb(" + lightSpectrum.red0 + ")",
317
317
  bgPositive: "rgb(" + lightSpectrum.green60 + ")",
318
318
  bgPositiveWash: "rgb(" + lightSpectrum.green0 + ")",
319
- bgWarning: "rgb(" + lightSpectrum.orange40 + ")",
319
+ bgWarning: "rgb(" + lightSpectrum.orange60 + ")",
320
320
  bgWarningWash: "rgb(" + lightSpectrum.orange0 + ")",
321
321
  currentColor: 'currentColor',
322
322
  // Line
@@ -367,7 +367,7 @@ export const coinbaseTheme = {
367
367
  bgNegativeWash: "rgb(" + darkSpectrum.red0 + ")",
368
368
  bgPositive: "rgb(" + darkSpectrum.green60 + ")",
369
369
  bgPositiveWash: "rgb(" + darkSpectrum.green0 + ")",
370
- bgWarning: "rgb(" + darkSpectrum.yellow50 + ")",
370
+ bgWarning: "rgb(" + darkSpectrum.orange60 + ")",
371
371
  bgWarningWash: "rgb(" + darkSpectrum.orange0 + ")",
372
372
  currentColor: 'currentColor',
373
373
  // Line
@@ -564,5 +564,37 @@ export const coinbaseTheme = {
564
564
  shadowOpacity: 0.12,
565
565
  shadowRadius: 24
566
566
  }
567
+ },
568
+ lightIllustrationColor: {
569
+ primary: "rgb(" + lightSpectrum.blue60 + ")",
570
+ black: "rgb(" + lightSpectrum.gray100 + ")",
571
+ white: "rgb(" + lightSpectrum.gray0 + ")",
572
+ gray: "rgb(" + lightSpectrum.gray20 + ")",
573
+ gray2: "rgb(10, 11, 15)",
574
+ gray3: "rgb(206, 210, 220)",
575
+ positive: "rgb(" + lightSpectrum.green30 + ")",
576
+ negative: "rgb(" + lightSpectrum.red50 + ")",
577
+ accent1: "rgb(255, 210, 0)",
578
+ accent2: "rgb(" + lightSpectrum.teal15 + ")",
579
+ accent3: "rgb(" + lightSpectrum.orange40 + ")",
580
+ accent4: "rgb(" + lightSpectrum.blue20 + ")",
581
+ invert: "rgb(10, 11, 14)",
582
+ invert2: "rgb(255, 255, 254)"
583
+ },
584
+ darkIllustrationColor: {
585
+ primary: "rgb(" + darkSpectrum.blue70 + ")",
586
+ black: "rgb(" + darkSpectrum.gray0 + ")",
587
+ white: "rgb(" + darkSpectrum.gray100 + ")",
588
+ gray: "rgb(" + darkSpectrum.gray30 + ")",
589
+ gray2: "rgb(" + darkSpectrum.gray30 + ")",
590
+ gray3: "rgb(" + darkSpectrum.gray100 + ")",
591
+ positive: "rgb(" + darkSpectrum.green70 + ")",
592
+ negative: "rgb(" + darkSpectrum.red60 + ")",
593
+ accent1: "rgb(236, 208, 105)",
594
+ accent2: "rgb(" + darkSpectrum.teal80 + ")",
595
+ accent3: "rgb(" + darkSpectrum.orange60 + ")",
596
+ accent4: "rgb(" + darkSpectrum.blue80 + ")",
597
+ invert: "rgb(" + darkSpectrum.gray100 + ")",
598
+ invert2: "rgb(" + darkSpectrum.gray50 + ")"
567
599
  }
568
600
  };
@@ -564,5 +564,37 @@ export const defaultHighContrastTheme = {
564
564
  shadowOpacity: 0.12,
565
565
  shadowRadius: 24
566
566
  }
567
+ },
568
+ lightIllustrationColor: {
569
+ primary: "rgb(" + lightSpectrum.blue60 + ")",
570
+ black: "rgb(" + lightSpectrum.gray100 + ")",
571
+ white: "rgb(" + lightSpectrum.gray0 + ")",
572
+ gray: "rgb(" + lightSpectrum.gray20 + ")",
573
+ gray2: "rgb(10, 11, 15)",
574
+ gray3: "rgb(206, 210, 220)",
575
+ positive: "rgb(" + lightSpectrum.green30 + ")",
576
+ negative: "rgb(" + lightSpectrum.red50 + ")",
577
+ accent1: "rgb(255, 210, 0)",
578
+ accent2: "rgb(" + lightSpectrum.teal15 + ")",
579
+ accent3: "rgb(" + lightSpectrum.orange40 + ")",
580
+ accent4: "rgb(" + lightSpectrum.blue20 + ")",
581
+ invert: "rgb(10, 11, 14)",
582
+ invert2: "rgb(255, 255, 254)"
583
+ },
584
+ darkIllustrationColor: {
585
+ primary: "rgb(" + darkSpectrum.blue70 + ")",
586
+ black: "rgb(" + darkSpectrum.gray0 + ")",
587
+ white: "rgb(" + darkSpectrum.gray100 + ")",
588
+ gray: "rgb(" + darkSpectrum.gray30 + ")",
589
+ gray2: "rgb(" + darkSpectrum.gray30 + ")",
590
+ gray3: "rgb(" + darkSpectrum.gray100 + ")",
591
+ positive: "rgb(" + darkSpectrum.green70 + ")",
592
+ negative: "rgb(" + darkSpectrum.red60 + ")",
593
+ accent1: "rgb(236, 208, 105)",
594
+ accent2: "rgb(" + darkSpectrum.teal80 + ")",
595
+ accent3: "rgb(" + darkSpectrum.orange60 + ")",
596
+ accent4: "rgb(" + darkSpectrum.blue80 + ")",
597
+ invert: "rgb(" + darkSpectrum.gray100 + ")",
598
+ invert2: "rgb(" + darkSpectrum.gray50 + ")"
567
599
  }
568
600
  };
@@ -316,7 +316,7 @@ export const defaultTheme = {
316
316
  bgNegativeWash: "rgb(" + lightSpectrum.red0 + ")",
317
317
  bgPositive: "rgb(" + lightSpectrum.green60 + ")",
318
318
  bgPositiveWash: "rgb(" + lightSpectrum.green0 + ")",
319
- bgWarning: "rgb(" + lightSpectrum.orange40 + ")",
319
+ bgWarning: "rgb(" + lightSpectrum.orange60 + ")",
320
320
  bgWarningWash: "rgb(" + lightSpectrum.orange0 + ")",
321
321
  currentColor: 'currentColor',
322
322
  // Line
@@ -367,7 +367,7 @@ export const defaultTheme = {
367
367
  bgNegativeWash: "rgb(" + darkSpectrum.red0 + ")",
368
368
  bgPositive: "rgb(" + darkSpectrum.green60 + ")",
369
369
  bgPositiveWash: "rgb(" + darkSpectrum.green0 + ")",
370
- bgWarning: "rgb(" + darkSpectrum.yellow50 + ")",
370
+ bgWarning: "rgb(" + darkSpectrum.orange60 + ")",
371
371
  bgWarningWash: "rgb(" + darkSpectrum.orange0 + ")",
372
372
  currentColor: 'currentColor',
373
373
  // Line
@@ -395,6 +395,38 @@ export const defaultTheme = {
395
395
  // Transparent
396
396
  transparent: "rgba(" + darkSpectrum.gray0 + ",0)"
397
397
  },
398
+ lightIllustrationColor: {
399
+ primary: "rgb(" + lightSpectrum.blue60 + ")",
400
+ black: "rgb(" + lightSpectrum.gray100 + ")",
401
+ white: "rgb(" + lightSpectrum.gray0 + ")",
402
+ gray: "rgb(" + lightSpectrum.gray20 + ")",
403
+ gray2: "rgb(10, 11, 15)",
404
+ gray3: "rgb(206, 210, 220)",
405
+ positive: "rgb(" + lightSpectrum.green30 + ")",
406
+ negative: "rgb(" + lightSpectrum.red50 + ")",
407
+ accent1: "rgb(255, 210, 0)",
408
+ accent2: "rgb(" + lightSpectrum.teal15 + ")",
409
+ accent3: "rgb(" + lightSpectrum.orange40 + ")",
410
+ accent4: "rgb(" + lightSpectrum.blue20 + ")",
411
+ invert: "rgb(10, 11, 14)",
412
+ invert2: "rgb(255, 255, 254)"
413
+ },
414
+ darkIllustrationColor: {
415
+ primary: "rgb(" + darkSpectrum.blue70 + ")",
416
+ black: "rgb(" + darkSpectrum.gray0 + ")",
417
+ white: "rgb(" + darkSpectrum.gray100 + ")",
418
+ gray: "rgb(" + darkSpectrum.gray30 + ")",
419
+ gray2: "rgb(" + darkSpectrum.gray30 + ")",
420
+ gray3: "rgb(" + darkSpectrum.gray100 + ")",
421
+ positive: "rgb(" + darkSpectrum.green70 + ")",
422
+ negative: "rgb(" + darkSpectrum.red60 + ")",
423
+ accent1: "rgb(236, 208, 105)",
424
+ accent2: "rgb(" + darkSpectrum.teal80 + ")",
425
+ accent3: "rgb(" + darkSpectrum.orange60 + ")",
426
+ accent4: "rgb(" + darkSpectrum.blue80 + ")",
427
+ invert: "rgb(" + darkSpectrum.gray100 + ")",
428
+ invert2: "rgb(" + darkSpectrum.gray50 + ")"
429
+ },
398
430
  space: {
399
431
  '0': 0,
400
432
  '0.25': 2,
@@ -0,0 +1,9 @@
1
+ import { colorToHex } from '@coinbase/cds-common/color/colorToHex';
2
+ export const convertThemedSvgToHex = (xml, illustrationPalette) => {
3
+ const cssVarPattern = /var\(--illustration-([a-z0-9-]+)\)/gi;
4
+ const normalizeToken = token => token.replace(/-/g, '');
5
+ return xml.replace(cssVarPattern, (_, token) => {
6
+ const color = illustrationPalette[normalizeToken(token)];
7
+ return color ? colorToHex(color) : "var(--illustration-" + token + ")";
8
+ });
9
+ };
@@ -1,5 +1,5 @@
1
1
  const _excluded = ["color", "label", "font", "hideDot", "style"],
2
- _excluded2 = ["background", "activeBackground", "width", "justifyContent", "TabComponent", "TabsActiveIndicatorComponent"];
2
+ _excluded2 = ["background", "activeBackground", "activeColor", "width", "justifyContent", "TabComponent", "TabsActiveIndicatorComponent"];
3
3
  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); }
4
4
  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; }
5
5
  import React, { forwardRef, memo, useMemo } from 'react';
@@ -107,11 +107,8 @@ export const LiveTabLabel = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, re
107
107
  }))]
108
108
  });
109
109
  }));
110
-
111
- // Custom tab component with primary color for active state
112
110
  const PeriodSelectorTab = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(SegmentedTab, _extends({
113
111
  ref: ref,
114
- activeColor: "fgPrimary",
115
112
  font: "label1"
116
113
  }, props))));
117
114
  /**
@@ -122,6 +119,7 @@ export const PeriodSelector = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
122
119
  let {
123
120
  background = 'transparent',
124
121
  activeBackground = 'bgPrimaryWash',
122
+ activeColor = 'fgPrimary',
125
123
  width = '100%',
126
124
  justifyContent = 'space-between',
127
125
  TabComponent = PeriodSelectorTab,
@@ -133,6 +131,7 @@ export const PeriodSelector = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
133
131
  TabComponent: TabComponent,
134
132
  TabsActiveIndicatorComponent: TabsActiveIndicatorComponent,
135
133
  activeBackground: activeBackground,
134
+ activeColor: activeColor,
136
135
  background: background,
137
136
  justifyContent: justifyContent,
138
137
  width: width
@@ -1,9 +1,10 @@
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 { memo, useCallback } from 'react';
2
+ import { memo, useCallback, useState } from 'react';
3
3
  import { candles as btcCandles } from '@coinbase/cds-common/internal/data/candles';
4
+ import { Button } from '../../../../buttons/Button';
4
5
  import { Example, ExampleScreen } from '../../../../examples/ExampleScreen';
5
6
  import { useTheme } from '../../../../hooks/useTheme';
6
- import { VStack } from '../../../../layout';
7
+ import { Box, VStack } from '../../../../layout';
7
8
  import { DefaultReferenceLineLabel, DottedLine, ReferenceLine } from '../../line';
8
9
  import { Scrubber } from '../../scrubber/Scrubber';
9
10
  import { AreaChart } from '..';
@@ -211,6 +212,44 @@ const AxisBaselineThresholdExample = () => {
211
212
  })]
212
213
  });
213
214
  };
215
+
216
+ // Regression repro for CDS-2065. The default baseline is 0; alternating between
217
+ // an all-positive dataset (2 gradient stops) and a negative-crossing dataset
218
+ // (3 gradient stops) causes the Gradient component to swap stop counts between
219
+ // renders. Before the fix this crashed with `ReanimatedError: Positions array
220
+ // must have the same size as colors array`.
221
+ const positiveOnlyData = [10, 25, 15, 40, 30, 50, 35];
222
+ const crossesBaselineData = [-20, 25, -15, 40, -30, 50, 35];
223
+ const BaselineCrossingExample = () => {
224
+ const [crosses, setCrosses] = useState(false);
225
+ const data = crosses ? crossesBaselineData : positiveOnlyData;
226
+ return /*#__PURE__*/_jsxs(VStack, {
227
+ gap: 2,
228
+ children: [/*#__PURE__*/_jsx(AreaChart, {
229
+ showLines: true,
230
+ showYAxis: true,
231
+ accessibilityLabel: "Area chart toggling across the y-axis baseline",
232
+ height: 220,
233
+ series: [{
234
+ id: 'flow',
235
+ data
236
+ }],
237
+ type: "gradient",
238
+ yAxis: {
239
+ baseline: 0,
240
+ showGrid: true
241
+ }
242
+ }), /*#__PURE__*/_jsx(Box, {
243
+ paddingX: 2,
244
+ children: /*#__PURE__*/_jsx(Button, {
245
+ compact: true,
246
+ onPress: () => setCrosses(c => !c),
247
+ variant: "secondary",
248
+ children: "Toggle baseline crossing"
249
+ })
250
+ })]
251
+ });
252
+ };
214
253
  const AreaChartStories = () => {
215
254
  return /*#__PURE__*/_jsxs(ExampleScreen, {
216
255
  children: [/*#__PURE__*/_jsx(Example, {
@@ -238,6 +277,9 @@ const AreaChartStories = () => {
238
277
  },
239
278
  children: /*#__PURE__*/_jsx(Scrubber, {})
240
279
  })
280
+ }), /*#__PURE__*/_jsx(Example, {
281
+ title: "Baseline Crossing (CDS-2065 repro)",
282
+ children: /*#__PURE__*/_jsx(BaselineCrossingExample, {})
241
283
  }), /*#__PURE__*/_jsx(Example, {
242
284
  title: "Axis Baseline",
243
285
  children: /*#__PURE__*/_jsx(AreaChart, {
@@ -64,7 +64,7 @@ export const Gradient = /*#__PURE__*/memo(_ref => {
64
64
  };
65
65
 
66
66
  // Extract colors and positions for LinearGradient.
67
- const colors = useMemo(() => (stops != null ? stops : []).map(stop => {
67
+ const targetColors = useMemo(() => (stops != null ? stops : []).map(stop => {
68
68
  var _stop$opacity;
69
69
  return getColorWithOpacity(stop.color, (_stop$opacity = stop.opacity) != null ? _stop$opacity : 1);
70
70
  }), [stops]);
@@ -73,6 +73,11 @@ export const Gradient = /*#__PURE__*/memo(_ref => {
73
73
  const startY = useSharedValue(targetStart.y);
74
74
  const endX = useSharedValue(targetEnd.x);
75
75
  const endY = useSharedValue(targetEnd.y);
76
+
77
+ // colors lives on the worklet so it flips in lockstep with positions; updating
78
+ // it via useMemo on the JS thread races the worklet-driven positions and Skia
79
+ // can paint mismatched array sizes when the stop count changes.
80
+ const currentColors = useSharedValue(targetColors);
76
81
  const fromPositions = useSharedValue(targetPositions);
77
82
  const toPositions = useSharedValue(targetPositions);
78
83
  const positionsProgress = useSharedValue(1);
@@ -88,6 +93,7 @@ export const Gradient = /*#__PURE__*/memo(_ref => {
88
93
  startY.value = targetStart.y;
89
94
  endX.value = targetEnd.x;
90
95
  endY.value = targetEnd.y;
96
+ currentColors.value = targetColors;
91
97
  fromPositions.value = [...targetPositions];
92
98
  toPositions.value = [...targetPositions];
93
99
  positionsProgress.value = 1;
@@ -99,16 +105,18 @@ export const Gradient = /*#__PURE__*/memo(_ref => {
99
105
  endY.value = buildTransition(targetEnd.y, transition);
100
106
  const canAnimatePositions = toPositions.value.length === targetPositions.length;
101
107
  if (canAnimatePositions) {
108
+ currentColors.value = targetColors;
102
109
  fromPositions.value = [...toPositions.value];
103
110
  toPositions.value = [...targetPositions];
104
111
  positionsProgress.value = 0;
105
112
  positionsProgress.value = buildTransition(1, transition);
106
113
  } else {
114
+ currentColors.value = targetColors;
107
115
  fromPositions.value = [...targetPositions];
108
116
  toPositions.value = [...targetPositions];
109
117
  positionsProgress.value = 1;
110
118
  }
111
- }, [transition, targetStart.x, targetStart.y, targetEnd.x, targetEnd.y, targetPositions, startX, startY, endX, endY, fromPositions, toPositions, positionsProgress, shouldRender]);
119
+ }, [transition, targetStart.x, targetStart.y, targetEnd.x, targetEnd.y, targetColors, targetPositions, startX, startY, endX, endY, currentColors, fromPositions, toPositions, positionsProgress, shouldRender]);
112
120
  const start = useDerivedValue(() => {
113
121
  return {
114
122
  x: startX.value,
@@ -121,6 +129,7 @@ export const Gradient = /*#__PURE__*/memo(_ref => {
121
129
  y: endY.value
122
130
  };
123
131
  }, [endX, endY]);
132
+ const colors = useDerivedValue(() => currentColors.value, [currentColors]);
124
133
  const positions = useDerivedValue(() => {
125
134
  const from = fromPositions.value;
126
135
  const to = toPositions.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile",
3
- "version": "9.0.0-rc.2",
3
+ "version": "9.0.0",
4
4
  "description": "Coinbase Design System - Mobile",
5
5
  "repository": {
6
6
  "type": "git",
@@ -202,9 +202,9 @@
202
202
  "react-native-worklets": "0.5.2"
203
203
  },
204
204
  "dependencies": {
205
- "@coinbase/cds-common": "^9.0.0-rc.2",
205
+ "@coinbase/cds-common": "^9.0.0",
206
206
  "@coinbase/cds-icons": "^5.16.0",
207
- "@coinbase/cds-illustrations": "^4.38.0",
207
+ "@coinbase/cds-illustrations": "^4.40.1",
208
208
  "@coinbase/cds-lottie-files": "^3.3.4",
209
209
  "@coinbase/cds-utils": "^2.3.5",
210
210
  "@floating-ui/react-native": "^0.10.5",