@coinbase/cds-mobile-visualization 3.4.0-beta.2 → 3.4.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,14 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 3.4.0-beta.4 (10/27/2025 PST)
|
|
12
|
+
|
|
13
|
+
This is an artificial version bump with no new change.
|
|
14
|
+
|
|
15
|
+
## 3.4.0-beta.3 (10/6/2025 PST)
|
|
16
|
+
|
|
17
|
+
This is an artificial version bump with no new change.
|
|
18
|
+
|
|
11
19
|
## 3.4.0-beta.2 (10/6/2025 PST)
|
|
12
20
|
|
|
13
21
|
This is an artificial version bump with no new change.
|
|
@@ -1,34 +1,20 @@
|
|
|
1
|
-
const _excluded = ["label"]
|
|
1
|
+
const _excluded = ["label"],
|
|
2
|
+
_excluded2 = ["label", "font", "hideDot", "style"];
|
|
2
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; }
|
|
3
4
|
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
5
|
import { forwardRef, memo, useMemo, useState } from 'react';
|
|
5
|
-
import { View } from 'react-native';
|
|
6
|
+
import { ScrollView, View } from 'react-native';
|
|
6
7
|
import { assets } from '@coinbase/cds-common/internal/data/assets';
|
|
7
8
|
import { useTabsContext } from '@coinbase/cds-common/tabs/TabsContext';
|
|
8
9
|
import { IconButton } from '@coinbase/cds-mobile/buttons';
|
|
10
|
+
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
9
11
|
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
10
|
-
import {
|
|
12
|
+
import { HStack } from '@coinbase/cds-mobile/layout';
|
|
11
13
|
import { SegmentedTab } from '@coinbase/cds-mobile/tabs/SegmentedTab';
|
|
12
|
-
import {
|
|
14
|
+
import { TextLabel1 } from '@coinbase/cds-mobile/typography';
|
|
15
|
+
import { Text } from '@coinbase/cds-mobile/typography/Text';
|
|
13
16
|
import { LiveTabLabel, PeriodSelector, PeriodSelectorActiveIndicator } from '../PeriodSelector';
|
|
14
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
export default {
|
|
16
|
-
component: PeriodSelector,
|
|
17
|
-
title: 'Components/Chart/PeriodSelector'
|
|
18
|
-
};
|
|
19
|
-
const Example = _ref => {
|
|
20
|
-
let {
|
|
21
|
-
children,
|
|
22
|
-
title,
|
|
23
|
-
description
|
|
24
|
-
} = _ref;
|
|
25
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
26
|
-
gap: 2,
|
|
27
|
-
children: [/*#__PURE__*/_jsx(TextHeadline, {
|
|
28
|
-
children: title
|
|
29
|
-
}), description, children]
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
18
|
const PeriodSelectorExample = () => {
|
|
33
19
|
const tabs = [{
|
|
34
20
|
id: '1H',
|
|
@@ -79,7 +65,7 @@ const MinWidthPeriodSelectorExample = () => {
|
|
|
79
65
|
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
80
66
|
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
81
67
|
activeTab: activeTab,
|
|
82
|
-
gap:
|
|
68
|
+
gap: 0.5,
|
|
83
69
|
onChange: tab => setActiveTab(tab),
|
|
84
70
|
tabs: tabs,
|
|
85
71
|
width: "fit-content"
|
|
@@ -116,7 +102,6 @@ const LivePeriodSelectorExample = () => {
|
|
|
116
102
|
});
|
|
117
103
|
};
|
|
118
104
|
const TooManyPeriodsSelectorExample = () => {
|
|
119
|
-
const theme = useTheme();
|
|
120
105
|
const tabs = useMemo(() => [{
|
|
121
106
|
id: '1H',
|
|
122
107
|
label: /*#__PURE__*/_jsx(LiveTabLabel, {})
|
|
@@ -145,55 +130,48 @@ const TooManyPeriodsSelectorExample = () => {
|
|
|
145
130
|
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
146
131
|
const isLive = useMemo(() => (activeTab == null ? void 0 : activeTab.id) === '1H', [activeTab]);
|
|
147
132
|
const activeBackground = useMemo(() => !isLive ? 'bgPrimaryWash' : 'bgNegativeWash', [isLive]);
|
|
148
|
-
const gradientOverlayStyles = useMemo(() => [{
|
|
149
|
-
position: 'absolute',
|
|
150
|
-
right: 0,
|
|
151
|
-
bottom: 0,
|
|
152
|
-
top: 0,
|
|
153
|
-
width: theme.space[4],
|
|
154
|
-
backgroundColor: theme.color.bgPrimary,
|
|
155
|
-
opacity: 0.8
|
|
156
|
-
}], [theme.space, theme.color.bgPrimary]);
|
|
157
133
|
return /*#__PURE__*/_jsxs(HStack, {
|
|
158
134
|
alignItems: "center",
|
|
159
135
|
justifyContent: "space-between",
|
|
160
136
|
maxWidth: "100%",
|
|
161
|
-
overflow: "hidden",
|
|
162
137
|
width: "100%",
|
|
163
|
-
children: [/*#__PURE__*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
180
|
-
pointerEvents: "none",
|
|
181
|
-
style: gradientOverlayStyles
|
|
182
|
-
})]
|
|
138
|
+
children: [/*#__PURE__*/_jsx(ScrollView, {
|
|
139
|
+
horizontal: true,
|
|
140
|
+
contentContainerStyle: {
|
|
141
|
+
paddingEnd: 8,
|
|
142
|
+
flexGrow: 1
|
|
143
|
+
},
|
|
144
|
+
showsHorizontalScrollIndicator: false,
|
|
145
|
+
children: /*#__PURE__*/_jsx(PeriodSelector, {
|
|
146
|
+
activeBackground: activeBackground,
|
|
147
|
+
activeTab: activeTab,
|
|
148
|
+
gap: 1,
|
|
149
|
+
justifyContent: "flex-start",
|
|
150
|
+
onChange: setActiveTab,
|
|
151
|
+
tabs: tabs,
|
|
152
|
+
width: "fit-content"
|
|
153
|
+
})
|
|
183
154
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
184
155
|
compact: true,
|
|
185
156
|
accessibilityLabel: "Configure chart",
|
|
186
157
|
flexShrink: 0,
|
|
187
|
-
height: 36,
|
|
188
158
|
name: "filter",
|
|
189
159
|
variant: "secondary"
|
|
190
160
|
})]
|
|
191
161
|
});
|
|
192
162
|
};
|
|
193
163
|
const btcColor = assets.btc.color;
|
|
194
|
-
const BTCActiveIndicator = /*#__PURE__*/memo(props =>
|
|
195
|
-
|
|
196
|
-
|
|
164
|
+
const BTCActiveIndicator = /*#__PURE__*/memo(props => {
|
|
165
|
+
const theme = useTheme();
|
|
166
|
+
const {
|
|
167
|
+
activeTab
|
|
168
|
+
} = useTabsContext();
|
|
169
|
+
const isLive = useMemo(() => (activeTab == null ? void 0 : activeTab.id) === '1H', [activeTab]);
|
|
170
|
+
const backgroundColor = useMemo(() => isLive ? theme.color.bgNegativeWash : btcColor + "1A", [isLive, theme.color.bgNegativeWash]);
|
|
171
|
+
return /*#__PURE__*/_jsx(PeriodSelectorActiveIndicator, _extends({}, props, {
|
|
172
|
+
background: backgroundColor
|
|
173
|
+
}));
|
|
174
|
+
});
|
|
197
175
|
const BTCActiveExcludingLiveIndicator = /*#__PURE__*/memo(props => {
|
|
198
176
|
const theme = useTheme();
|
|
199
177
|
const {
|
|
@@ -205,30 +183,66 @@ const BTCActiveExcludingLiveIndicator = /*#__PURE__*/memo(props => {
|
|
|
205
183
|
background: backgroundColor
|
|
206
184
|
}));
|
|
207
185
|
});
|
|
208
|
-
const BTCTab = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((
|
|
186
|
+
const BTCTab = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
209
187
|
let {
|
|
210
188
|
label
|
|
211
|
-
} =
|
|
212
|
-
props = _objectWithoutPropertiesLoose(
|
|
189
|
+
} = _ref,
|
|
190
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
213
191
|
const {
|
|
214
192
|
activeTab
|
|
215
193
|
} = useTabsContext();
|
|
216
194
|
const isActive = (activeTab == null ? void 0 : activeTab.id) === props.id;
|
|
217
|
-
const
|
|
195
|
+
const theme = useTheme();
|
|
196
|
+
|
|
197
|
+
// If label is already a React element (like LiveTabLabel), pass it through directly
|
|
198
|
+
// For string labels, wrap with custom BTC color when active
|
|
199
|
+
const wrappedLabel = typeof label === 'string' ? /*#__PURE__*/_jsx(TextLabel1, {
|
|
200
|
+
dangerouslySetColor: isActive ? btcColor : theme.color.fg,
|
|
201
|
+
children: label
|
|
202
|
+
}) : label;
|
|
218
203
|
return /*#__PURE__*/_jsx(SegmentedTab, _extends({
|
|
219
204
|
ref: ref,
|
|
220
|
-
label:
|
|
221
|
-
dangerouslySetColor: textColor,
|
|
222
|
-
children: label
|
|
223
|
-
})
|
|
205
|
+
label: wrappedLabel
|
|
224
206
|
}, props));
|
|
225
207
|
}));
|
|
208
|
+
const BTCLiveLabel = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
209
|
+
let {
|
|
210
|
+
label = 'LIVE',
|
|
211
|
+
font = 'label1',
|
|
212
|
+
hideDot,
|
|
213
|
+
style
|
|
214
|
+
} = _ref2,
|
|
215
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
216
|
+
const theme = useTheme();
|
|
217
|
+
const dotStyle = useMemo(() => ({
|
|
218
|
+
width: theme.space[1],
|
|
219
|
+
height: theme.space[1],
|
|
220
|
+
borderRadius: 1000,
|
|
221
|
+
marginRight: theme.space[0.75],
|
|
222
|
+
backgroundColor: btcColor
|
|
223
|
+
}), [theme.space]);
|
|
224
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
225
|
+
ref: ref,
|
|
226
|
+
style: [{
|
|
227
|
+
flexDirection: 'row',
|
|
228
|
+
alignItems: 'center'
|
|
229
|
+
}, style],
|
|
230
|
+
children: [!hideDot && /*#__PURE__*/_jsx(View, {
|
|
231
|
+
style: dotStyle
|
|
232
|
+
}), /*#__PURE__*/_jsx(Text, _extends({
|
|
233
|
+
font: font,
|
|
234
|
+
style: {
|
|
235
|
+
color: btcColor
|
|
236
|
+
}
|
|
237
|
+
}, props, {
|
|
238
|
+
children: label
|
|
239
|
+
}))]
|
|
240
|
+
});
|
|
241
|
+
}));
|
|
226
242
|
const ColoredPeriodSelectorExample = () => {
|
|
227
243
|
const tabs = [{
|
|
228
244
|
id: '1H',
|
|
229
|
-
label: /*#__PURE__*/_jsx(
|
|
230
|
-
dangerouslySetColor: btcColor
|
|
231
|
-
})
|
|
245
|
+
label: /*#__PURE__*/_jsx(BTCLiveLabel, {})
|
|
232
246
|
}, {
|
|
233
247
|
id: '1D',
|
|
234
248
|
label: '1D'
|
|
@@ -283,12 +297,26 @@ const ColoredExcludingLivePeriodSelectorExample = () => {
|
|
|
283
297
|
tabs: tabs
|
|
284
298
|
});
|
|
285
299
|
};
|
|
286
|
-
export
|
|
287
|
-
return /*#__PURE__*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
title: "Basic Example",
|
|
300
|
+
export default function All() {
|
|
301
|
+
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
302
|
+
children: [/*#__PURE__*/_jsx(Example, {
|
|
303
|
+
title: "Basic",
|
|
291
304
|
children: /*#__PURE__*/_jsx(PeriodSelectorExample, {})
|
|
292
|
-
})
|
|
305
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
306
|
+
title: "Min Width",
|
|
307
|
+
children: /*#__PURE__*/_jsx(MinWidthPeriodSelectorExample, {})
|
|
308
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
309
|
+
title: "Live Period",
|
|
310
|
+
children: /*#__PURE__*/_jsx(LivePeriodSelectorExample, {})
|
|
311
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
312
|
+
title: "Too Many Periods",
|
|
313
|
+
children: /*#__PURE__*/_jsx(TooManyPeriodsSelectorExample, {})
|
|
314
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
315
|
+
title: "Colored (BTC)",
|
|
316
|
+
children: /*#__PURE__*/_jsx(ColoredPeriodSelectorExample, {})
|
|
317
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
318
|
+
title: "Colored Excluding Live",
|
|
319
|
+
children: /*#__PURE__*/_jsx(ColoredExcludingLivePeriodSelectorExample, {})
|
|
320
|
+
})]
|
|
293
321
|
});
|
|
294
|
-
}
|
|
322
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile-visualization",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.4",
|
|
4
4
|
"description": "Coinbase Design System - Mobile Visualization Native",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"CHANGELOG"
|
|
33
33
|
],
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@coinbase/cds-common": "^8.
|
|
35
|
+
"@coinbase/cds-common": "^8.17.4",
|
|
36
36
|
"@coinbase/cds-lottie-files": "^3.3.2",
|
|
37
|
-
"@coinbase/cds-mobile": "^8.
|
|
37
|
+
"@coinbase/cds-mobile": "^8.17.4",
|
|
38
38
|
"@coinbase/cds-utils": "^2.3.3",
|
|
39
39
|
"react": "^18.3.1",
|
|
40
40
|
"react-native": "^0.74.5",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@babel/preset-env": "^7.28.0",
|
|
53
53
|
"@babel/preset-react": "^7.27.1",
|
|
54
54
|
"@babel/preset-typescript": "^7.27.1",
|
|
55
|
-
"@coinbase/cds-common": "^8.
|
|
55
|
+
"@coinbase/cds-common": "^8.17.4",
|
|
56
56
|
"@coinbase/cds-lottie-files": "^3.3.2",
|
|
57
|
-
"@coinbase/cds-mobile": "^8.
|
|
57
|
+
"@coinbase/cds-mobile": "^8.17.4",
|
|
58
58
|
"@coinbase/cds-utils": "^2.3.3",
|
|
59
59
|
"@figma/code-connect": "^1.3.4",
|
|
60
60
|
"@types/react": "^18.3.12",
|