@coinbase/cds-mobile 9.0.0-rc.1 → 9.0.0-rc.3
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 +82 -0
- package/dts/buttons/IconButton.d.ts +19 -1
- package/dts/buttons/IconButton.d.ts.map +1 -1
- package/dts/cells/Cell.d.ts +2 -1
- package/dts/cells/Cell.d.ts.map +1 -1
- package/dts/controls/InputIconButton.d.ts +5 -0
- package/dts/controls/InputIconButton.d.ts.map +1 -1
- package/dts/controls/InputLabel.d.ts.map +1 -1
- package/dts/controls/SearchInput.d.ts +4 -0
- package/dts/controls/SearchInput.d.ts.map +1 -1
- package/dts/controls/TextInput.d.ts.map +1 -1
- package/dts/core/theme.d.ts +12 -0
- package/dts/core/theme.d.ts.map +1 -1
- package/dts/illustrations/createIllustration.d.ts +3 -0
- package/dts/illustrations/createIllustration.d.ts.map +1 -1
- package/dts/page/PageFooter.d.ts +8 -0
- package/dts/page/PageFooter.d.ts.map +1 -1
- package/dts/system/ThemeProvider.d.ts.map +1 -1
- package/dts/tabs/DefaultTab.d.ts +4 -2
- package/dts/tabs/DefaultTab.d.ts.map +1 -1
- package/dts/tabs/DefaultTabsActiveIndicator.d.ts.map +1 -1
- package/dts/tabs/SegmentedTab.d.ts +4 -4
- package/dts/tabs/Tabs.d.ts +10 -1
- package/dts/tabs/Tabs.d.ts.map +1 -1
- package/dts/tag/Tag.d.ts +5 -3
- package/dts/tag/Tag.d.ts.map +1 -1
- package/dts/themes/coinbaseDenseTheme.d.ts +34 -2
- package/dts/themes/coinbaseDenseTheme.d.ts.map +1 -1
- package/dts/themes/coinbaseHighContrastTheme.d.ts +32 -0
- package/dts/themes/coinbaseHighContrastTheme.d.ts.map +1 -1
- package/dts/themes/coinbaseTheme.d.ts +34 -2
- package/dts/themes/coinbaseTheme.d.ts.map +1 -1
- package/dts/themes/defaultHighContrastTheme.d.ts +32 -0
- package/dts/themes/defaultHighContrastTheme.d.ts.map +1 -1
- package/dts/themes/defaultTheme.d.ts +34 -2
- package/dts/themes/defaultTheme.d.ts.map +1 -1
- package/dts/utils/convertThemedSvgToHex.d.ts +6 -0
- package/dts/utils/convertThemedSvgToHex.d.ts.map +1 -0
- package/dts/utils/testHelpers.d.ts +34 -2
- package/dts/utils/testHelpers.d.ts.map +1 -1
- package/dts/visualizations/chart/Path.d.ts.map +1 -1
- package/dts/visualizations/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/visualizations/chart/utils/bar.d.ts.map +1 -1
- package/dts/visualizations/chart/utils/transition.d.ts.map +1 -1
- package/esm/buttons/IconButton.js +8 -2
- package/esm/buttons/__stories__/IconButton.stories.js +65 -0
- package/esm/controls/InputLabel.js +4 -3
- package/esm/controls/TextInput.js +7 -1
- package/esm/illustrations/__stories__/ThemedIllustrations.stories.js +214 -0
- package/esm/illustrations/__stories__/illustrationThemes.js +122 -0
- package/esm/illustrations/createIllustration.js +31 -5
- package/esm/page/PageFooter.js +16 -5
- package/esm/page/__figma__/PageFooter.figma.js +49 -6
- package/esm/system/ThemeProvider.js +3 -1
- package/esm/system/__stories__/componentConfigStickerSheet/StickerSheet.js +4 -0
- package/esm/system/__stories__/componentConfigStickerSheet/customComponentConfig.js +24 -12
- package/esm/system/__stories__/componentConfigStickerSheet/examples/ListCell.js +2 -0
- package/esm/system/__stories__/componentConfigStickerSheet/examples/Tabs.js +24 -0
- package/esm/system/__stories__/componentConfigStickerSheet/examples/TextInput.js +12 -0
- package/esm/tabs/DefaultTab.js +7 -9
- package/esm/tabs/DefaultTabsActiveIndicator.js +1 -2
- package/esm/tabs/Tabs.js +18 -12
- package/esm/tabs/__stories__/SegmentedTabs.stories.js +8 -1
- package/esm/tabs/__stories__/Tabs.stories.js +0 -1
- package/esm/tag/Tag.js +14 -4
- package/esm/themes/coinbaseHighContrastTheme.js +32 -0
- package/esm/themes/coinbaseTheme.js +34 -2
- package/esm/themes/defaultHighContrastTheme.js +32 -0
- package/esm/themes/defaultTheme.js +34 -2
- package/esm/utils/convertThemedSvgToHex.js +9 -0
- package/esm/visualizations/chart/Path.js +0 -1
- package/esm/visualizations/chart/PeriodSelector.js +3 -4
- package/esm/visualizations/chart/utils/transition.js +58 -31
- package/package.json +3 -3
package/esm/tabs/DefaultTab.js
CHANGED
|
@@ -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
|
|
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 ?
|
|
61
|
+
color: isActive ? activeColor : color,
|
|
64
62
|
font: "headline",
|
|
65
|
-
|
|
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`.
|
|
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(
|
|
125
|
-
|
|
127
|
+
}), tabs.map(tabProps => {
|
|
128
|
+
const {
|
|
126
129
|
id,
|
|
127
130
|
Component: CustomTabComponent
|
|
128
|
-
} =
|
|
129
|
-
|
|
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 =
|
|
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
|
-
} =
|
|
152
|
-
props = _objectWithoutPropertiesLoose(
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
@@ -188,41 +188,68 @@ export const usePathTransition = _ref => {
|
|
|
188
188
|
const normalizedEndShared = useSharedValue(initialSkiaPath);
|
|
189
189
|
const fallbackPathShared = useSharedValue(initialSkiaPath);
|
|
190
190
|
const result = useSharedValue(initialSkiaPath);
|
|
191
|
+
const animationFrameRef = useRef(null);
|
|
191
192
|
useEffect(() => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
193
|
+
var _Skia$Path$MakeFromSV3, _Skia$Path$MakeFromSV4, _Skia$Path$MakeFromSV5;
|
|
194
|
+
if (targetPathRef.current === currentPath) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
let fromPath = targetPathRef.current;
|
|
198
|
+
if (interpolatorRef.current) {
|
|
199
|
+
const p = Math.min(Math.max(progress.value, 0), 1);
|
|
200
|
+
fromPath = interpolatorRef.current(p);
|
|
201
|
+
}
|
|
202
|
+
targetPathRef.current = currentPath;
|
|
203
|
+
const {
|
|
204
|
+
enter,
|
|
205
|
+
update
|
|
206
|
+
} = transitionRef.current;
|
|
207
|
+
const isFirstAnim = isFirstAnimation.current;
|
|
208
|
+
const activeTransition = isFirstAnim && enter !== undefined ? enter : update;
|
|
209
|
+
isFirstAnimation.current = false;
|
|
210
|
+
if (activeTransition === null) {
|
|
211
|
+
var _Skia$Path$MakeFromSV2;
|
|
212
|
+
const targetPath = (_Skia$Path$MakeFromSV2 = Skia.Path.MakeFromSVGString(currentPath)) != null ? _Skia$Path$MakeFromSV2 : Skia.Path.Make();
|
|
213
|
+
interpolatorRef.current = null;
|
|
214
|
+
normalizedStartShared.value = targetPath;
|
|
215
|
+
normalizedEndShared.value = targetPath;
|
|
216
|
+
fallbackPathShared.value = targetPath;
|
|
217
|
+
progress.value = 1;
|
|
218
|
+
result.value = targetPath;
|
|
219
|
+
notifyChange(result);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const pathInterpolator = interpolatePath(fromPath, currentPath);
|
|
223
|
+
interpolatorRef.current = pathInterpolator;
|
|
224
|
+
normalizedStartShared.value = (_Skia$Path$MakeFromSV3 = Skia.Path.MakeFromSVGString(pathInterpolator(pathInterpolationEpsilon))) != null ? _Skia$Path$MakeFromSV3 : Skia.Path.Make();
|
|
225
|
+
normalizedEndShared.value = (_Skia$Path$MakeFromSV4 = Skia.Path.MakeFromSVGString(pathInterpolator(1 - pathInterpolationEpsilon))) != null ? _Skia$Path$MakeFromSV4 : Skia.Path.Make();
|
|
226
|
+
fallbackPathShared.value = (_Skia$Path$MakeFromSV5 = Skia.Path.MakeFromSVGString(currentPath)) != null ? _Skia$Path$MakeFromSV5 : Skia.Path.Make();
|
|
227
|
+
const kickoff = () => {
|
|
223
228
|
progress.value = 0;
|
|
224
229
|
progress.value = buildTransition(1, activeTransition);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Initial enter: defer the kickoff one frame. In Reanimated v4 / worklets
|
|
233
|
+
// v0.5.2, valueSetter's rAF chain doesn't advance for animation builders
|
|
234
|
+
// assigned during the first React commit — the animation is set up but
|
|
235
|
+
// never ticks. Deferring to the next frame puts us in the "warm" state
|
|
236
|
+
// that updates already enjoy, and the rAF chain runs.
|
|
237
|
+
if (isFirstAnim) {
|
|
238
|
+
animationFrameRef.current = requestAnimationFrame(kickoff);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Cancel any deferred initial kickoff that hasn't fired yet so its stale
|
|
243
|
+
// enter transition doesn't overwrite this update animation.
|
|
244
|
+
if (animationFrameRef.current) {
|
|
245
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
246
|
+
animationFrameRef.current = null;
|
|
225
247
|
}
|
|
248
|
+
|
|
249
|
+
// Subsequent kickoff (data update or post-layout-settle re-render) — runs
|
|
250
|
+
// synchronously since the cold-state window only applies to the very first
|
|
251
|
+
// React commit.
|
|
252
|
+
kickoff();
|
|
226
253
|
}, [currentPath, progress, normalizedStartShared, normalizedEndShared, fallbackPathShared, result]);
|
|
227
254
|
useAnimatedReaction(() => ({
|
|
228
255
|
p: progress.value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "9.0.0-rc.
|
|
3
|
+
"version": "9.0.0-rc.3",
|
|
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.
|
|
205
|
+
"@coinbase/cds-common": "^9.0.0-rc.3",
|
|
206
206
|
"@coinbase/cds-icons": "^5.16.0",
|
|
207
|
-
"@coinbase/cds-illustrations": "^4.
|
|
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",
|