@coinbase/ui-mobile-playground 4.5.7 → 4.5.9
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 +12 -0
- package/dts/components/ExamplesListScreen.d.ts.map +1 -1
- package/dts/components/IconSheetScreen.d.ts.map +1 -1
- package/dts/components/useExampleNavigatorProps.d.ts.map +1 -1
- package/dts/routes.d.ts.map +1 -1
- package/esm/components/ExamplesListScreen.js +2 -4
- package/esm/components/IconSheetScreen.js +15 -31
- package/esm/components/useExampleNavigatorProps.js +10 -29
- package/esm/routes.js +54 -4
- package/package.json +4 -4
- package/src/components/ExamplesListScreen.tsx +2 -4
- package/src/components/IconSheetScreen.tsx +21 -33
- package/src/components/useExampleNavigatorProps.tsx +10 -23
- package/src/routes.ts +95 -5
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 4.5.9 (12/2/2025 PST)
|
|
12
|
+
|
|
13
|
+
#### 🐞 Fixes
|
|
14
|
+
|
|
15
|
+
- Regenerate routes. [[#200](https://github.com/coinbase/cds/pull/200)]
|
|
16
|
+
|
|
17
|
+
## 4.5.8 (12/1/2025 PST)
|
|
18
|
+
|
|
19
|
+
#### 🐞 Fixes
|
|
20
|
+
|
|
21
|
+
- Chore: QOL improvements for searching/navigating example component routes. [[#199](https://github.com/coinbase/cds/pull/199)]
|
|
22
|
+
|
|
11
23
|
## 4.5.7 (11/19/2025 PST)
|
|
12
24
|
|
|
13
25
|
#### 🐞 Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplesListScreen.d.ts","sourceRoot":"","sources":["../../src/components/ExamplesListScreen.tsx"],"names":[],"mappings":"AAeA,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ExamplesListScreen.d.ts","sourceRoot":"","sources":["../../src/components/ExamplesListScreen.tsx"],"names":[],"mappings":"AAeA,wBAAgB,kBAAkB,4CAgDjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconSheetScreen.d.ts","sourceRoot":"","sources":["../../src/components/IconSheetScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconSheetScreen.d.ts","sourceRoot":"","sources":["../../src/components/IconSheetScreen.tsx"],"names":[],"mappings":"AAcA,wBAAgB,eAAe,4CA2B9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExampleNavigatorProps.d.ts","sourceRoot":"","sources":["../../src/components/useExampleNavigatorProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useExampleNavigatorProps.d.ts","sourceRoot":"","sources":["../../src/components/useExampleNavigatorProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAUnE,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAKxF,KAAK,+BAA+B,GAAG;IACrC,cAAc,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;CACpE,CAAC;AAIF,wBAAgB,wBAAwB,CAAC,EAAE,cAAc,EAAE,EAAE,+BAA+B;;;EA+G3F"}
|
package/dts/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,MAAM;;;GAkzBlB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { ListCell } from '@coinbase/cds-mobile/cells/ListCell';
|
|
|
4
4
|
import { Box } from '@coinbase/cds-mobile/layout/Box';
|
|
5
5
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
6
6
|
import includes from 'lodash/includes';
|
|
7
|
-
import { SearchFilterContext
|
|
7
|
+
import { SearchFilterContext } from './ExamplesSearchProvider';
|
|
8
8
|
import { keyToRouteName } from './keyToRouteName';
|
|
9
9
|
import { initialRouteKey, searchRouteKey } from './staticRoutes';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -14,7 +14,6 @@ const innerSpacingConfig = {
|
|
|
14
14
|
export function ExamplesListScreen() {
|
|
15
15
|
var _routeKeys, _useRoute$params;
|
|
16
16
|
const searchFilter = useContext(SearchFilterContext);
|
|
17
|
-
const setFilter = useContext(SetSearchFilterContext);
|
|
18
17
|
|
|
19
18
|
// React Navigation Route Param typing is not clean because our routes are dynamic
|
|
20
19
|
const routeKeys = (_routeKeys = (_useRoute$params = useRoute().params) === null || _useRoute$params === void 0 ? void 0 : _useRoute$params.routeKeys) !== null && _routeKeys !== void 0 ? _routeKeys : [];
|
|
@@ -26,7 +25,6 @@ export function ExamplesListScreen() {
|
|
|
26
25
|
item
|
|
27
26
|
} = _ref;
|
|
28
27
|
const handlePress = () => {
|
|
29
|
-
setFilter('');
|
|
30
28
|
// typing not clean due to dynamic routes
|
|
31
29
|
navigate(keyToRouteName(item));
|
|
32
30
|
};
|
|
@@ -37,7 +35,7 @@ export function ExamplesListScreen() {
|
|
|
37
35
|
onPress: handlePress,
|
|
38
36
|
title: item
|
|
39
37
|
});
|
|
40
|
-
}, [navigate
|
|
38
|
+
}, [navigate]);
|
|
41
39
|
const data = [...routeKeys, 'IconSheet'].sort().filter(key => key !== initialRouteKey && key !== searchRouteKey).filter(key => {
|
|
42
40
|
if (searchFilter !== '') {
|
|
43
41
|
return includes(key.toLowerCase(), searchFilter.toLowerCase());
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ScrollView } from 'react-native';
|
|
2
1
|
import { SvgXml } from 'react-native-svg';
|
|
3
2
|
import { useTheme } from '@coinbase/cds-mobile';
|
|
4
3
|
import { IconSheet } from '@coinbase/cds-mobile/icons/__stories__/IconSheet';
|
|
5
|
-
import { Box } from '@coinbase/cds-mobile/layout';
|
|
6
4
|
import { svgMap } from '../__generated__/iconSvgMap';
|
|
7
5
|
|
|
8
6
|
// we only have svg assets for sizes xs, s, and m
|
|
@@ -14,34 +12,20 @@ const getIconSourceSize = iconSize => {
|
|
|
14
12
|
};
|
|
15
13
|
export function IconSheetScreen() {
|
|
16
14
|
const theme = useTheme();
|
|
17
|
-
return /*#__PURE__*/_jsx(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const sourceSize = getIconSourceSize(size);
|
|
33
|
-
const key = "".concat(iconName, "-").concat(sourceSize, "-inactive");
|
|
34
|
-
if (!(key in svgMap)) {
|
|
35
|
-
throw new Error("Icon ".concat(key, " not found in iconSvgMap. You probably need to run the generateIconSvgMap script to update it."));
|
|
36
|
-
}
|
|
37
|
-
return /*#__PURE__*/_jsx(SvgXml, {
|
|
38
|
-
accessibilityRole: "image",
|
|
39
|
-
height: size,
|
|
40
|
-
width: size,
|
|
41
|
-
xml: svgMap[key].content
|
|
42
|
-
}, "".concat(iconName, "-").concat(iconSize));
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
})
|
|
15
|
+
return /*#__PURE__*/_jsx(IconSheet, {
|
|
16
|
+
renderIcon: (iconName, iconSize) => {
|
|
17
|
+
const size = theme.iconSize[iconSize];
|
|
18
|
+
const sourceSize = getIconSourceSize(size);
|
|
19
|
+
const key = "".concat(iconName, "-").concat(sourceSize, "-inactive");
|
|
20
|
+
if (!(key in svgMap)) {
|
|
21
|
+
throw new Error("Icon ".concat(key, " not found in iconSvgMap. You probably need to run the generateIconSvgMap script to update it."));
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/_jsx(SvgXml, {
|
|
24
|
+
accessibilityRole: "image",
|
|
25
|
+
height: size,
|
|
26
|
+
width: size,
|
|
27
|
+
xml: svgMap[key].content
|
|
28
|
+
}, "".concat(iconName, "-").concat(iconSize));
|
|
29
|
+
}
|
|
46
30
|
});
|
|
47
31
|
}
|
|
@@ -9,13 +9,9 @@ import { Box } from '@coinbase/cds-mobile/layout/Box';
|
|
|
9
9
|
import { HStack } from '@coinbase/cds-mobile/layout/HStack';
|
|
10
10
|
import { Spacer } from '@coinbase/cds-mobile/layout/Spacer';
|
|
11
11
|
import { TextHeadline } from '@coinbase/cds-mobile/typography/TextHeadline';
|
|
12
|
-
import { SetSearchFilterContext } from './ExamplesSearchProvider';
|
|
12
|
+
import { SearchFilterContext, SetSearchFilterContext } from './ExamplesSearchProvider';
|
|
13
13
|
import { initialRouteName, searchRouteName } from './staticRoutes';
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
const invisiblePressableStyle = {
|
|
16
|
-
width: 40,
|
|
17
|
-
height: 40
|
|
18
|
-
};
|
|
19
15
|
const iconButtonHeight = interactableHeight.regular;
|
|
20
16
|
export function useExampleNavigatorProps(_ref) {
|
|
21
17
|
let {
|
|
@@ -26,6 +22,7 @@ export function useExampleNavigatorProps(_ref) {
|
|
|
26
22
|
top
|
|
27
23
|
} = useSafeAreaInsets();
|
|
28
24
|
const [headerSize, onLayout] = useLayout();
|
|
25
|
+
const searchFilter = useContext(SearchFilterContext);
|
|
29
26
|
const setFilter = useContext(SetSearchFilterContext);
|
|
30
27
|
const style = useMemo(() => ({
|
|
31
28
|
marginTop: top
|
|
@@ -35,35 +32,21 @@ export function useExampleNavigatorProps(_ref) {
|
|
|
35
32
|
let {
|
|
36
33
|
navigation,
|
|
37
34
|
route,
|
|
38
|
-
options
|
|
39
|
-
progress,
|
|
40
|
-
styleInterpolator
|
|
35
|
+
options
|
|
41
36
|
} = _ref2;
|
|
42
37
|
const isFocused = navigation.isFocused();
|
|
43
38
|
const canGoBack = navigation.canGoBack();
|
|
44
39
|
const goBack = () => {
|
|
45
40
|
navigation.goBack();
|
|
41
|
+
};
|
|
42
|
+
const goBackFromSearch = () => {
|
|
46
43
|
setFilter('');
|
|
44
|
+
navigation.goBack();
|
|
47
45
|
};
|
|
48
46
|
const goToSearch = () => navigation.navigate(searchRouteName);
|
|
49
47
|
const routeName = route.name;
|
|
50
48
|
const titleForScene = options.title;
|
|
51
49
|
const isSearch = routeName === searchRouteName;
|
|
52
|
-
const {
|
|
53
|
-
titleStyle
|
|
54
|
-
} = styleInterpolator({
|
|
55
|
-
current: {
|
|
56
|
-
progress: progress.current
|
|
57
|
-
},
|
|
58
|
-
next: progress.next && {
|
|
59
|
-
progress: progress.next
|
|
60
|
-
},
|
|
61
|
-
layouts: {
|
|
62
|
-
header: headerSize,
|
|
63
|
-
title: headerSize,
|
|
64
|
-
screen: headerSize
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
50
|
const showBackButton = isFocused && canGoBack && !isSearch;
|
|
68
51
|
const showSearch = routeName === initialRouteName;
|
|
69
52
|
const iconButtonPlaceholder = /*#__PURE__*/_jsx(Box, {
|
|
@@ -118,25 +101,23 @@ export function useExampleNavigatorProps(_ref) {
|
|
|
118
101
|
start: /*#__PURE__*/_jsx(IconButton, {
|
|
119
102
|
transparent: true,
|
|
120
103
|
name: "backArrow",
|
|
121
|
-
onPress:
|
|
122
|
-
})
|
|
104
|
+
onPress: goBackFromSearch
|
|
105
|
+
}),
|
|
106
|
+
value: searchFilter
|
|
123
107
|
}) : /*#__PURE__*/_jsx(TextHeadline, {
|
|
124
|
-
animated: true,
|
|
125
108
|
align: "center",
|
|
126
|
-
style: titleStyle,
|
|
127
109
|
children: titleForScene
|
|
128
110
|
})
|
|
129
111
|
}), /*#__PURE__*/_jsx(Spacer, {}), rightHeaderButton]
|
|
130
112
|
})
|
|
131
113
|
});
|
|
132
114
|
};
|
|
133
|
-
}, [
|
|
115
|
+
}, [onLayout, searchFilter, setFilter, style, theme.activeColorScheme, setColorScheme]);
|
|
134
116
|
return useMemo(() => {
|
|
135
117
|
const screenOptions = {
|
|
136
118
|
headerBackAllowFontScaling: false,
|
|
137
119
|
headerBackTitleVisible: false,
|
|
138
120
|
headerTitleAllowFontScaling: false,
|
|
139
|
-
headerMode: 'float',
|
|
140
121
|
headerStyle: {
|
|
141
122
|
backgroundColor: theme.color.bg,
|
|
142
123
|
borderWidth: 0,
|
package/esm/routes.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* DO NOT MODIFY
|
|
3
3
|
* Generated from scripts/codegen/main.ts
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
export const routes = [{
|
|
7
6
|
key: 'Accordion',
|
|
8
7
|
getComponent: () => require('@coinbase/cds-mobile/accordion/__stories__/Accordion.stories').default
|
|
@@ -21,18 +20,42 @@ export const routes = [{
|
|
|
21
20
|
}, {
|
|
22
21
|
key: 'AlertSingleAction',
|
|
23
22
|
getComponent: () => require('@coinbase/cds-mobile/overlays/__stories__/AlertSingleAction.stories').default
|
|
23
|
+
}, {
|
|
24
|
+
key: 'AlertVerticalActions',
|
|
25
|
+
getComponent: () => require('@coinbase/cds-mobile/overlays/__stories__/AlertVerticalActions.stories').default
|
|
26
|
+
}, {
|
|
27
|
+
key: 'AlphaSelect',
|
|
28
|
+
getComponent: () => require('@coinbase/cds-mobile/alpha/select/__stories__/AlphaSelect.stories').default
|
|
29
|
+
}, {
|
|
30
|
+
key: 'AlphaTabbedChips',
|
|
31
|
+
getComponent: () => require('@coinbase/cds-mobile/alpha/tabbed-chips/__stories__/AlphaTabbedChips.stories').default
|
|
24
32
|
}, {
|
|
25
33
|
key: 'AnimatedCaret',
|
|
26
34
|
getComponent: () => require('@coinbase/cds-mobile/motion/__stories__/AnimatedCaret.stories').default
|
|
35
|
+
}, {
|
|
36
|
+
key: 'AreaChart',
|
|
37
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/area/__stories__/AreaChart.stories').default
|
|
27
38
|
}, {
|
|
28
39
|
key: 'Avatar',
|
|
29
40
|
getComponent: () => require('@coinbase/cds-mobile/media/__stories__/Avatar.stories').default
|
|
30
41
|
}, {
|
|
31
42
|
key: 'AvatarButton',
|
|
32
43
|
getComponent: () => require('@coinbase/cds-mobile/buttons/__stories__/AvatarButton.stories').default
|
|
44
|
+
}, {
|
|
45
|
+
key: 'Axis',
|
|
46
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/axis/__stories__/Axis.stories').default
|
|
33
47
|
}, {
|
|
34
48
|
key: 'Banner',
|
|
35
49
|
getComponent: () => require('@coinbase/cds-mobile/banner/__stories__/Banner.stories').default
|
|
50
|
+
}, {
|
|
51
|
+
key: 'BannerActions',
|
|
52
|
+
getComponent: () => require('@coinbase/cds-mobile/banner/__stories__/BannerActions.stories').default
|
|
53
|
+
}, {
|
|
54
|
+
key: 'BannerLayout',
|
|
55
|
+
getComponent: () => require('@coinbase/cds-mobile/banner/__stories__/BannerLayout.stories').default
|
|
56
|
+
}, {
|
|
57
|
+
key: 'BarChart',
|
|
58
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/bar/__stories__/BarChart.stories').default
|
|
36
59
|
}, {
|
|
37
60
|
key: 'Box',
|
|
38
61
|
getComponent: () => require('@coinbase/cds-mobile/layout/__stories__/Box.stories').default
|
|
@@ -57,9 +80,18 @@ export const routes = [{
|
|
|
57
80
|
}, {
|
|
58
81
|
key: 'CarouselMedia',
|
|
59
82
|
getComponent: () => require('@coinbase/cds-mobile/media/__stories__/CarouselMedia.stories').default
|
|
83
|
+
}, {
|
|
84
|
+
key: 'CartesianChart',
|
|
85
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/__stories__/CartesianChart.stories').default
|
|
86
|
+
}, {
|
|
87
|
+
key: 'Chart',
|
|
88
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/__stories__/Chart.stories').default
|
|
60
89
|
}, {
|
|
61
90
|
key: 'Checkbox',
|
|
62
91
|
getComponent: () => require('@coinbase/cds-mobile/controls/__stories__/Checkbox.stories').default
|
|
92
|
+
}, {
|
|
93
|
+
key: 'CheckboxCell',
|
|
94
|
+
getComponent: () => require('@coinbase/cds-mobile/controls/__stories__/CheckboxCell.stories').default
|
|
63
95
|
}, {
|
|
64
96
|
key: 'Chip',
|
|
65
97
|
getComponent: () => require('@coinbase/cds-mobile/chips/__stories__/Chip.stories').default
|
|
@@ -81,6 +113,9 @@ export const routes = [{
|
|
|
81
113
|
}, {
|
|
82
114
|
key: 'ContentCellFallback',
|
|
83
115
|
getComponent: () => require('@coinbase/cds-mobile/cells/__stories__/ContentCellFallback.stories').default
|
|
116
|
+
}, {
|
|
117
|
+
key: 'ControlGroup',
|
|
118
|
+
getComponent: () => require('@coinbase/cds-mobile/controls/__stories__/ControlGroup.stories').default
|
|
84
119
|
}, {
|
|
85
120
|
key: 'DateInput',
|
|
86
121
|
getComponent: () => require('@coinbase/cds-mobile/dates/__stories__/DateInput.stories').default
|
|
@@ -132,9 +167,6 @@ export const routes = [{
|
|
|
132
167
|
}, {
|
|
133
168
|
key: 'HintMotion',
|
|
134
169
|
getComponent: () => require('@coinbase/cds-mobile/motion/__stories__/HintMotion.stories').default
|
|
135
|
-
}, {
|
|
136
|
-
key: 'Icon',
|
|
137
|
-
getComponent: () => require('@coinbase/cds-mobile/icons/__stories__/Icon.stories').default
|
|
138
170
|
}, {
|
|
139
171
|
key: 'IconButton',
|
|
140
172
|
getComponent: () => require('@coinbase/cds-mobile/buttons/__stories__/IconButton.stories').default
|
|
@@ -156,6 +188,9 @@ export const routes = [{
|
|
|
156
188
|
}, {
|
|
157
189
|
key: 'LinearGradient',
|
|
158
190
|
getComponent: () => require('@coinbase/cds-mobile/gradients/__stories__/LinearGradient.stories').default
|
|
191
|
+
}, {
|
|
192
|
+
key: 'LineChart',
|
|
193
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/line/__stories__/LineChart.stories').default
|
|
159
194
|
}, {
|
|
160
195
|
key: 'Link',
|
|
161
196
|
getComponent: () => require('@coinbase/cds-mobile/typography/__stories__/Link.stories').default
|
|
@@ -174,6 +209,9 @@ export const routes = [{
|
|
|
174
209
|
}, {
|
|
175
210
|
key: 'LottieStatusAnimation',
|
|
176
211
|
getComponent: () => require('@coinbase/cds-mobile/animation/__stories__/LottieStatusAnimation.stories').default
|
|
212
|
+
}, {
|
|
213
|
+
key: 'MediaChip',
|
|
214
|
+
getComponent: () => require('@coinbase/cds-mobile/chips/__stories__/MediaChip.stories').default
|
|
177
215
|
}, {
|
|
178
216
|
key: 'ModalBackButton',
|
|
179
217
|
getComponent: () => require('@coinbase/cds-mobile/overlays/__stories__/ModalBackButton.stories').default
|
|
@@ -243,6 +281,9 @@ export const routes = [{
|
|
|
243
281
|
}, {
|
|
244
282
|
key: 'PatternError',
|
|
245
283
|
getComponent: () => require('@coinbase/cds-mobile/system/__stories__/PatternError.stories').default
|
|
284
|
+
}, {
|
|
285
|
+
key: 'PeriodSelector',
|
|
286
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/__stories__/PeriodSelector.stories').default
|
|
246
287
|
}, {
|
|
247
288
|
key: 'Pictogram',
|
|
248
289
|
getComponent: () => require('@coinbase/cds-mobile/illustrations/__stories__/Pictogram.stories').default
|
|
@@ -258,15 +299,24 @@ export const routes = [{
|
|
|
258
299
|
}, {
|
|
259
300
|
key: 'ProgressCircle',
|
|
260
301
|
getComponent: () => require('@coinbase/cds-mobile/visualizations/__stories__/ProgressCircle.stories').default
|
|
302
|
+
}, {
|
|
303
|
+
key: 'RadioCell',
|
|
304
|
+
getComponent: () => require('@coinbase/cds-mobile/controls/__stories__/RadioCell.stories').default
|
|
261
305
|
}, {
|
|
262
306
|
key: 'RadioGroup',
|
|
263
307
|
getComponent: () => require('@coinbase/cds-mobile/controls/__stories__/RadioGroup.stories').default
|
|
308
|
+
}, {
|
|
309
|
+
key: 'ReferenceLine',
|
|
310
|
+
getComponent: () => require('@coinbase/cds-mobile-visualization/chart/line/__stories__/ReferenceLine.stories').default
|
|
264
311
|
}, {
|
|
265
312
|
key: 'RemoteImage',
|
|
266
313
|
getComponent: () => require('@coinbase/cds-mobile/media/__stories__/RemoteImage.stories').default
|
|
267
314
|
}, {
|
|
268
315
|
key: 'RemoteImageGroup',
|
|
269
316
|
getComponent: () => require('@coinbase/cds-mobile/media/__stories__/RemoteImageGroup.stories').default
|
|
317
|
+
}, {
|
|
318
|
+
key: 'RollingNumber',
|
|
319
|
+
getComponent: () => require('@coinbase/cds-mobile/numbers/__stories__/RollingNumber.stories').default
|
|
270
320
|
}, {
|
|
271
321
|
key: 'SearchInput',
|
|
272
322
|
getComponent: () => require('@coinbase/cds-mobile/controls/__stories__/SearchInput.stories').default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/ui-mobile-playground",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.9",
|
|
4
4
|
"description": "Mobile UI Components in a Playground",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"CHANGELOG"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@coinbase/cds-common": "^8.
|
|
38
|
-
"@coinbase/cds-mobile": "^8.
|
|
39
|
-
"@coinbase/cds-mobile-visualization": "^3.4.0-beta.
|
|
37
|
+
"@coinbase/cds-common": "^8.25.1",
|
|
38
|
+
"@coinbase/cds-mobile": "^8.25.1",
|
|
39
|
+
"@coinbase/cds-mobile-visualization": "^3.4.0-beta.7",
|
|
40
40
|
"@react-navigation/elements": "^1.3.17",
|
|
41
41
|
"@react-navigation/native": "^6.1.6",
|
|
42
42
|
"@react-navigation/stack": "^6.3.16",
|
|
@@ -7,7 +7,7 @@ import { Box } from '@coinbase/cds-mobile/layout/Box';
|
|
|
7
7
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
8
8
|
import includes from 'lodash/includes';
|
|
9
9
|
|
|
10
|
-
import { SearchFilterContext
|
|
10
|
+
import { SearchFilterContext } from './ExamplesSearchProvider';
|
|
11
11
|
import { keyToRouteName } from './keyToRouteName';
|
|
12
12
|
import { initialRouteKey, searchRouteKey } from './staticRoutes';
|
|
13
13
|
|
|
@@ -15,7 +15,6 @@ const innerSpacingConfig: CellSpacing = { paddingX: 1 };
|
|
|
15
15
|
|
|
16
16
|
export function ExamplesListScreen() {
|
|
17
17
|
const searchFilter = useContext(SearchFilterContext);
|
|
18
|
-
const setFilter = useContext(SetSearchFilterContext);
|
|
19
18
|
|
|
20
19
|
// React Navigation Route Param typing is not clean because our routes are dynamic
|
|
21
20
|
const routeKeys = (useRoute().params as { routeKeys: string[] } | undefined)?.routeKeys ?? [];
|
|
@@ -24,7 +23,6 @@ export function ExamplesListScreen() {
|
|
|
24
23
|
const renderItem: ListRenderItem<string> = useCallback(
|
|
25
24
|
({ item }) => {
|
|
26
25
|
const handlePress = () => {
|
|
27
|
-
setFilter('');
|
|
28
26
|
// typing not clean due to dynamic routes
|
|
29
27
|
navigate(keyToRouteName(item) as never);
|
|
30
28
|
};
|
|
@@ -39,7 +37,7 @@ export function ExamplesListScreen() {
|
|
|
39
37
|
/>
|
|
40
38
|
);
|
|
41
39
|
},
|
|
42
|
-
[navigate
|
|
40
|
+
[navigate],
|
|
43
41
|
);
|
|
44
42
|
|
|
45
43
|
const data = [...routeKeys, 'IconSheet']
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { ScrollView } from 'react-native';
|
|
2
1
|
import { SvgXml } from 'react-native-svg';
|
|
3
2
|
import type { IconSourcePixelSize } from '@coinbase/cds-common/types';
|
|
4
3
|
import { useTheme } from '@coinbase/cds-mobile';
|
|
5
4
|
import { IconSheet } from '@coinbase/cds-mobile/icons/__stories__/IconSheet';
|
|
6
|
-
import { Box } from '@coinbase/cds-mobile/layout';
|
|
7
5
|
|
|
8
6
|
import { svgMap } from '../__generated__/iconSvgMap';
|
|
9
7
|
|
|
@@ -17,38 +15,28 @@ const getIconSourceSize = (iconSize: number): IconSourcePixelSize => {
|
|
|
17
15
|
export function IconSheetScreen() {
|
|
18
16
|
const theme = useTheme();
|
|
19
17
|
return (
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
testID="mobile-playground-scrollview"
|
|
26
|
-
>
|
|
27
|
-
<Box background="bg" padding={2}>
|
|
28
|
-
<IconSheet
|
|
29
|
-
renderIcon={(iconName, iconSize) => {
|
|
30
|
-
const size = theme.iconSize[iconSize];
|
|
31
|
-
const sourceSize = getIconSourceSize(size);
|
|
32
|
-
const key = `${iconName}-${sourceSize}-inactive`;
|
|
18
|
+
<IconSheet
|
|
19
|
+
renderIcon={(iconName, iconSize) => {
|
|
20
|
+
const size = theme.iconSize[iconSize];
|
|
21
|
+
const sourceSize = getIconSourceSize(size);
|
|
22
|
+
const key = `${iconName}-${sourceSize}-inactive`;
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
if (!(key in svgMap)) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`Icon ${key} not found in iconSvgMap. You probably need to run the generateIconSvgMap script to update it.`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</Box>
|
|
52
|
-
</ScrollView>
|
|
30
|
+
return (
|
|
31
|
+
<SvgXml
|
|
32
|
+
key={`${iconName}-${iconSize}`}
|
|
33
|
+
accessibilityRole="image"
|
|
34
|
+
height={size}
|
|
35
|
+
width={size}
|
|
36
|
+
xml={svgMap[key as keyof typeof svgMap].content}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
53
41
|
);
|
|
54
42
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
-
import { Pressable } from 'react-native';
|
|
3
2
|
import type { NativeSyntheticEvent, TextInputChangeEventData } from 'react-native';
|
|
4
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
4
|
import type { ColorScheme } from '@coinbase/cds-common/core/theme';
|
|
@@ -14,49 +13,39 @@ import { Spacer } from '@coinbase/cds-mobile/layout/Spacer';
|
|
|
14
13
|
import { TextHeadline } from '@coinbase/cds-mobile/typography/TextHeadline';
|
|
15
14
|
import type { StackHeaderProps, StackNavigationOptions } from '@react-navigation/stack';
|
|
16
15
|
|
|
17
|
-
import { SetSearchFilterContext } from './ExamplesSearchProvider';
|
|
16
|
+
import { SearchFilterContext, SetSearchFilterContext } from './ExamplesSearchProvider';
|
|
18
17
|
import { initialRouteName, searchRouteName } from './staticRoutes';
|
|
19
18
|
|
|
20
19
|
type UseExampleNavigatorPropsOptions = {
|
|
21
20
|
setColorScheme?: React.Dispatch<React.SetStateAction<ColorScheme>>;
|
|
22
21
|
};
|
|
23
22
|
|
|
24
|
-
const invisiblePressableStyle = {
|
|
25
|
-
width: 40,
|
|
26
|
-
height: 40,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
23
|
const iconButtonHeight = interactableHeight.regular;
|
|
30
24
|
|
|
31
25
|
export function useExampleNavigatorProps({ setColorScheme }: UseExampleNavigatorPropsOptions) {
|
|
32
26
|
const theme = useTheme();
|
|
33
27
|
const { top } = useSafeAreaInsets();
|
|
34
28
|
const [headerSize, onLayout] = useLayout();
|
|
29
|
+
const searchFilter = useContext(SearchFilterContext);
|
|
35
30
|
const setFilter = useContext(SetSearchFilterContext);
|
|
36
31
|
|
|
37
32
|
const style = useMemo(() => ({ marginTop: top }), [top]);
|
|
38
33
|
|
|
39
34
|
const header = useMemo(() => {
|
|
40
|
-
return ({ navigation, route, options
|
|
35
|
+
return ({ navigation, route, options }: StackHeaderProps) => {
|
|
41
36
|
const isFocused = navigation.isFocused();
|
|
42
37
|
const canGoBack = navigation.canGoBack();
|
|
43
38
|
const goBack = () => {
|
|
44
39
|
navigation.goBack();
|
|
40
|
+
};
|
|
41
|
+
const goBackFromSearch = () => {
|
|
45
42
|
setFilter('');
|
|
43
|
+
navigation.goBack();
|
|
46
44
|
};
|
|
47
45
|
const goToSearch = () => navigation.navigate(searchRouteName);
|
|
48
46
|
const routeName = route.name;
|
|
49
47
|
const titleForScene = options.title;
|
|
50
48
|
const isSearch = routeName === searchRouteName;
|
|
51
|
-
const { titleStyle } = styleInterpolator({
|
|
52
|
-
current: { progress: progress.current },
|
|
53
|
-
next: progress.next && { progress: progress.next },
|
|
54
|
-
layouts: {
|
|
55
|
-
header: headerSize,
|
|
56
|
-
title: headerSize,
|
|
57
|
-
screen: headerSize,
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
49
|
const showBackButton = isFocused && canGoBack && !isSearch;
|
|
61
50
|
const showSearch = routeName === initialRouteName;
|
|
62
51
|
|
|
@@ -109,12 +98,11 @@ export function useExampleNavigatorProps({ setColorScheme }: UseExampleNavigator
|
|
|
109
98
|
label=""
|
|
110
99
|
onChange={handleSearch}
|
|
111
100
|
placeholder="Search"
|
|
112
|
-
start={<IconButton transparent name="backArrow" onPress={
|
|
101
|
+
start={<IconButton transparent name="backArrow" onPress={goBackFromSearch} />}
|
|
102
|
+
value={searchFilter}
|
|
113
103
|
/>
|
|
114
104
|
) : (
|
|
115
|
-
<TextHeadline
|
|
116
|
-
{titleForScene}
|
|
117
|
-
</TextHeadline>
|
|
105
|
+
<TextHeadline align="center">{titleForScene}</TextHeadline>
|
|
118
106
|
)}
|
|
119
107
|
</Box>
|
|
120
108
|
<Spacer />
|
|
@@ -123,14 +111,13 @@ export function useExampleNavigatorProps({ setColorScheme }: UseExampleNavigator
|
|
|
123
111
|
</Box>
|
|
124
112
|
);
|
|
125
113
|
};
|
|
126
|
-
}, [
|
|
114
|
+
}, [onLayout, searchFilter, setFilter, style, theme.activeColorScheme, setColorScheme]);
|
|
127
115
|
|
|
128
116
|
return useMemo(() => {
|
|
129
117
|
const screenOptions: StackNavigationOptions = {
|
|
130
118
|
headerBackAllowFontScaling: false,
|
|
131
119
|
headerBackTitleVisible: false,
|
|
132
120
|
headerTitleAllowFontScaling: false,
|
|
133
|
-
headerMode: 'float',
|
|
134
121
|
headerStyle: {
|
|
135
122
|
backgroundColor: theme.color.bg,
|
|
136
123
|
borderWidth: 0,
|
package/src/routes.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* DO NOT MODIFY
|
|
3
3
|
* Generated from scripts/codegen/main.ts
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
export const routes = [
|
|
7
6
|
{
|
|
8
7
|
key: 'Accordion',
|
|
@@ -34,11 +33,33 @@ export const routes = [
|
|
|
34
33
|
getComponent: () =>
|
|
35
34
|
require('@coinbase/cds-mobile/overlays/__stories__/AlertSingleAction.stories').default,
|
|
36
35
|
},
|
|
36
|
+
{
|
|
37
|
+
key: 'AlertVerticalActions',
|
|
38
|
+
getComponent: () =>
|
|
39
|
+
require('@coinbase/cds-mobile/overlays/__stories__/AlertVerticalActions.stories').default,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: 'AlphaSelect',
|
|
43
|
+
getComponent: () =>
|
|
44
|
+
require('@coinbase/cds-mobile/alpha/select/__stories__/AlphaSelect.stories').default,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: 'AlphaTabbedChips',
|
|
48
|
+
getComponent: () =>
|
|
49
|
+
require('@coinbase/cds-mobile/alpha/tabbed-chips/__stories__/AlphaTabbedChips.stories')
|
|
50
|
+
.default,
|
|
51
|
+
},
|
|
37
52
|
{
|
|
38
53
|
key: 'AnimatedCaret',
|
|
39
54
|
getComponent: () =>
|
|
40
55
|
require('@coinbase/cds-mobile/motion/__stories__/AnimatedCaret.stories').default,
|
|
41
56
|
},
|
|
57
|
+
{
|
|
58
|
+
key: 'AreaChart',
|
|
59
|
+
getComponent: () =>
|
|
60
|
+
require('@coinbase/cds-mobile-visualization/chart/area/__stories__/AreaChart.stories')
|
|
61
|
+
.default,
|
|
62
|
+
},
|
|
42
63
|
{
|
|
43
64
|
key: 'Avatar',
|
|
44
65
|
getComponent: () => require('@coinbase/cds-mobile/media/__stories__/Avatar.stories').default,
|
|
@@ -48,10 +69,30 @@ export const routes = [
|
|
|
48
69
|
getComponent: () =>
|
|
49
70
|
require('@coinbase/cds-mobile/buttons/__stories__/AvatarButton.stories').default,
|
|
50
71
|
},
|
|
72
|
+
{
|
|
73
|
+
key: 'Axis',
|
|
74
|
+
getComponent: () =>
|
|
75
|
+
require('@coinbase/cds-mobile-visualization/chart/axis/__stories__/Axis.stories').default,
|
|
76
|
+
},
|
|
51
77
|
{
|
|
52
78
|
key: 'Banner',
|
|
53
79
|
getComponent: () => require('@coinbase/cds-mobile/banner/__stories__/Banner.stories').default,
|
|
54
80
|
},
|
|
81
|
+
{
|
|
82
|
+
key: 'BannerActions',
|
|
83
|
+
getComponent: () =>
|
|
84
|
+
require('@coinbase/cds-mobile/banner/__stories__/BannerActions.stories').default,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: 'BannerLayout',
|
|
88
|
+
getComponent: () =>
|
|
89
|
+
require('@coinbase/cds-mobile/banner/__stories__/BannerLayout.stories').default,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: 'BarChart',
|
|
93
|
+
getComponent: () =>
|
|
94
|
+
require('@coinbase/cds-mobile-visualization/chart/bar/__stories__/BarChart.stories').default,
|
|
95
|
+
},
|
|
55
96
|
{
|
|
56
97
|
key: 'Box',
|
|
57
98
|
getComponent: () => require('@coinbase/cds-mobile/layout/__stories__/Box.stories').default,
|
|
@@ -89,11 +130,27 @@ export const routes = [
|
|
|
89
130
|
getComponent: () =>
|
|
90
131
|
require('@coinbase/cds-mobile/media/__stories__/CarouselMedia.stories').default,
|
|
91
132
|
},
|
|
133
|
+
{
|
|
134
|
+
key: 'CartesianChart',
|
|
135
|
+
getComponent: () =>
|
|
136
|
+
require('@coinbase/cds-mobile-visualization/chart/__stories__/CartesianChart.stories')
|
|
137
|
+
.default,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
key: 'Chart',
|
|
141
|
+
getComponent: () =>
|
|
142
|
+
require('@coinbase/cds-mobile-visualization/chart/__stories__/Chart.stories').default,
|
|
143
|
+
},
|
|
92
144
|
{
|
|
93
145
|
key: 'Checkbox',
|
|
94
146
|
getComponent: () =>
|
|
95
147
|
require('@coinbase/cds-mobile/controls/__stories__/Checkbox.stories').default,
|
|
96
148
|
},
|
|
149
|
+
{
|
|
150
|
+
key: 'CheckboxCell',
|
|
151
|
+
getComponent: () =>
|
|
152
|
+
require('@coinbase/cds-mobile/controls/__stories__/CheckboxCell.stories').default,
|
|
153
|
+
},
|
|
97
154
|
{
|
|
98
155
|
key: 'Chip',
|
|
99
156
|
getComponent: () => require('@coinbase/cds-mobile/chips/__stories__/Chip.stories').default,
|
|
@@ -128,6 +185,11 @@ export const routes = [
|
|
|
128
185
|
getComponent: () =>
|
|
129
186
|
require('@coinbase/cds-mobile/cells/__stories__/ContentCellFallback.stories').default,
|
|
130
187
|
},
|
|
188
|
+
{
|
|
189
|
+
key: 'ControlGroup',
|
|
190
|
+
getComponent: () =>
|
|
191
|
+
require('@coinbase/cds-mobile/controls/__stories__/ControlGroup.stories').default,
|
|
192
|
+
},
|
|
131
193
|
{
|
|
132
194
|
key: 'DateInput',
|
|
133
195
|
getComponent: () => require('@coinbase/cds-mobile/dates/__stories__/DateInput.stories').default,
|
|
@@ -207,10 +269,6 @@ export const routes = [
|
|
|
207
269
|
getComponent: () =>
|
|
208
270
|
require('@coinbase/cds-mobile/motion/__stories__/HintMotion.stories').default,
|
|
209
271
|
},
|
|
210
|
-
{
|
|
211
|
-
key: 'Icon',
|
|
212
|
-
getComponent: () => require('@coinbase/cds-mobile/icons/__stories__/Icon.stories').default,
|
|
213
|
-
},
|
|
214
272
|
{
|
|
215
273
|
key: 'IconButton',
|
|
216
274
|
getComponent: () =>
|
|
@@ -245,6 +303,12 @@ export const routes = [
|
|
|
245
303
|
getComponent: () =>
|
|
246
304
|
require('@coinbase/cds-mobile/gradients/__stories__/LinearGradient.stories').default,
|
|
247
305
|
},
|
|
306
|
+
{
|
|
307
|
+
key: 'LineChart',
|
|
308
|
+
getComponent: () =>
|
|
309
|
+
require('@coinbase/cds-mobile-visualization/chart/line/__stories__/LineChart.stories')
|
|
310
|
+
.default,
|
|
311
|
+
},
|
|
248
312
|
{
|
|
249
313
|
key: 'Link',
|
|
250
314
|
getComponent: () => require('@coinbase/cds-mobile/typography/__stories__/Link.stories').default,
|
|
@@ -272,6 +336,10 @@ export const routes = [
|
|
|
272
336
|
getComponent: () =>
|
|
273
337
|
require('@coinbase/cds-mobile/animation/__stories__/LottieStatusAnimation.stories').default,
|
|
274
338
|
},
|
|
339
|
+
{
|
|
340
|
+
key: 'MediaChip',
|
|
341
|
+
getComponent: () => require('@coinbase/cds-mobile/chips/__stories__/MediaChip.stories').default,
|
|
342
|
+
},
|
|
275
343
|
{
|
|
276
344
|
key: 'ModalBackButton',
|
|
277
345
|
getComponent: () =>
|
|
@@ -387,6 +455,12 @@ export const routes = [
|
|
|
387
455
|
getComponent: () =>
|
|
388
456
|
require('@coinbase/cds-mobile/system/__stories__/PatternError.stories').default,
|
|
389
457
|
},
|
|
458
|
+
{
|
|
459
|
+
key: 'PeriodSelector',
|
|
460
|
+
getComponent: () =>
|
|
461
|
+
require('@coinbase/cds-mobile-visualization/chart/__stories__/PeriodSelector.stories')
|
|
462
|
+
.default,
|
|
463
|
+
},
|
|
390
464
|
{
|
|
391
465
|
key: 'Pictogram',
|
|
392
466
|
getComponent: () =>
|
|
@@ -412,11 +486,22 @@ export const routes = [
|
|
|
412
486
|
getComponent: () =>
|
|
413
487
|
require('@coinbase/cds-mobile/visualizations/__stories__/ProgressCircle.stories').default,
|
|
414
488
|
},
|
|
489
|
+
{
|
|
490
|
+
key: 'RadioCell',
|
|
491
|
+
getComponent: () =>
|
|
492
|
+
require('@coinbase/cds-mobile/controls/__stories__/RadioCell.stories').default,
|
|
493
|
+
},
|
|
415
494
|
{
|
|
416
495
|
key: 'RadioGroup',
|
|
417
496
|
getComponent: () =>
|
|
418
497
|
require('@coinbase/cds-mobile/controls/__stories__/RadioGroup.stories').default,
|
|
419
498
|
},
|
|
499
|
+
{
|
|
500
|
+
key: 'ReferenceLine',
|
|
501
|
+
getComponent: () =>
|
|
502
|
+
require('@coinbase/cds-mobile-visualization/chart/line/__stories__/ReferenceLine.stories')
|
|
503
|
+
.default,
|
|
504
|
+
},
|
|
420
505
|
{
|
|
421
506
|
key: 'RemoteImage',
|
|
422
507
|
getComponent: () =>
|
|
@@ -427,6 +512,11 @@ export const routes = [
|
|
|
427
512
|
getComponent: () =>
|
|
428
513
|
require('@coinbase/cds-mobile/media/__stories__/RemoteImageGroup.stories').default,
|
|
429
514
|
},
|
|
515
|
+
{
|
|
516
|
+
key: 'RollingNumber',
|
|
517
|
+
getComponent: () =>
|
|
518
|
+
require('@coinbase/cds-mobile/numbers/__stories__/RollingNumber.stories').default,
|
|
519
|
+
},
|
|
430
520
|
{
|
|
431
521
|
key: 'SearchInput',
|
|
432
522
|
getComponent: () =>
|