@coinbase/cds-mobile 8.25.1 → 8.26.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 (77) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dts/alpha/select/DefaultSelectControl.d.ts +2 -8
  3. package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
  4. package/dts/alpha/select/DefaultSelectDropdown.d.ts.map +1 -1
  5. package/dts/alpha/select/DefaultSelectOptionGroup.d.ts +8 -0
  6. package/dts/alpha/select/DefaultSelectOptionGroup.d.ts.map +1 -0
  7. package/dts/alpha/select/Select.d.ts +23 -366
  8. package/dts/alpha/select/Select.d.ts.map +1 -1
  9. package/dts/alpha/select/index.d.ts +2 -0
  10. package/dts/alpha/select/index.d.ts.map +1 -1
  11. package/dts/alpha/select/types.d.ts +486 -0
  12. package/dts/alpha/select/types.d.ts.map +1 -0
  13. package/dts/alpha/select-chip/SelectChip.d.ts +26 -0
  14. package/dts/alpha/select-chip/SelectChip.d.ts.map +1 -0
  15. package/dts/alpha/select-chip/SelectChipControl.d.ts +14 -0
  16. package/dts/alpha/select-chip/SelectChipControl.d.ts.map +1 -0
  17. package/dts/alpha/select-chip/index.d.ts +3 -0
  18. package/dts/alpha/select-chip/index.d.ts.map +1 -0
  19. package/dts/chips/Chip.d.ts.map +1 -1
  20. package/dts/chips/SelectChip.d.ts +8 -0
  21. package/dts/chips/SelectChip.d.ts.map +1 -1
  22. package/dts/examples/ExampleScreen.d.ts +26 -1
  23. package/dts/examples/ExampleScreen.d.ts.map +1 -1
  24. package/esm/alpha/select/DefaultSelectControl.js +46 -8
  25. package/esm/alpha/select/DefaultSelectDropdown.js +100 -31
  26. package/esm/alpha/select/DefaultSelectOption.js +1 -1
  27. package/esm/alpha/select/DefaultSelectOptionGroup.js +90 -0
  28. package/esm/alpha/select/Select.js +10 -26
  29. package/esm/alpha/select/index.js +3 -1
  30. package/esm/alpha/select/types.js +50 -0
  31. package/esm/alpha/select-chip/SelectChip.js +31 -0
  32. package/esm/alpha/select-chip/SelectChipControl.js +111 -0
  33. package/esm/alpha/select-chip/__stories__/SelectChip.stories.js +538 -0
  34. package/esm/alpha/select-chip/index.js +2 -0
  35. package/esm/banner/__stories__/Banner.stories.js +133 -294
  36. package/esm/banner/__stories__/BannerActions.stories.js +276 -0
  37. package/esm/banner/__stories__/BannerLayout.stories.js +329 -0
  38. package/esm/cells/__stories__/ListCell.stories.js +1 -17
  39. package/esm/cells/__stories__/ListCellFallback.stories.js +1 -0
  40. package/esm/chips/Chip.js +4 -1
  41. package/esm/chips/SelectChip.js +9 -0
  42. package/esm/examples/ExampleScreen.js +79 -58
  43. package/esm/icons/__stories__/IconSheet.js +35 -13
  44. package/esm/illustrations/__stories__/HeroSquare.stories.js +70 -2
  45. package/esm/illustrations/__stories__/Pictogram.stories.js +70 -2
  46. package/esm/illustrations/__stories__/SpotIcon.stories.js +70 -2
  47. package/esm/illustrations/__stories__/SpotRectangle.stories.js +68 -2
  48. package/esm/illustrations/__stories__/SpotSquare.stories.js +68 -2
  49. package/esm/media/__stories__/CarouselMedia.stories.js +2 -5
  50. package/esm/numpad/__stories__/Numpad.stories.js +8 -5
  51. package/esm/page/__stories__/PageFooter.stories.js +5 -4
  52. package/esm/page/__stories__/PageFooterInPage.stories.js +20 -19
  53. package/esm/page/__stories__/PageHeader.stories.js +4 -4
  54. package/esm/page/__stories__/PageHeaderInErrorEmptyState.stories.js +6 -4
  55. package/esm/page/__stories__/PageHeaderInPage.stories.js +20 -18
  56. package/esm/section-header/__stories__/SectionHeader.stories.js +4 -4
  57. package/esm/sticky-footer/__stories__/StickyFooter.stories.js +6 -8
  58. package/esm/tour/__stories__/Tour.stories.js +13 -166
  59. package/esm/typography/__stories__/TextBody.stories.js +2 -0
  60. package/esm/typography/__stories__/TextCaption.stories.js +2 -0
  61. package/esm/typography/__stories__/TextCore.stories.js +2 -0
  62. package/esm/typography/__stories__/TextDisplay1.stories.js +2 -0
  63. package/esm/typography/__stories__/TextDisplay2.stories.js +2 -0
  64. package/esm/typography/__stories__/TextDisplay3.stories.js +2 -0
  65. package/esm/typography/__stories__/TextHeadline.stories.js +2 -0
  66. package/esm/typography/__stories__/TextLabel1.stories.js +2 -0
  67. package/esm/typography/__stories__/TextLabel2.stories.js +2 -0
  68. package/esm/typography/__stories__/TextLegal.stories.js +2 -0
  69. package/esm/typography/__stories__/TextTitle1.stories.js +2 -0
  70. package/esm/typography/__stories__/TextTitle2.stories.js +2 -0
  71. package/esm/typography/__stories__/TextTitle3.stories.js +2 -0
  72. package/esm/typography/__stories__/TextTitle4.stories.js +2 -0
  73. package/package.json +2 -2
  74. package/esm/icons/__stories__/Icon.stories.js +0 -98
  75. package/esm/illustrations/__stories__/getIllustrationSheet.js +0 -164
  76. /package/esm/alpha/select/__stories__/{Select.stories.js → AlphaSelect.stories.js} +0 -0
  77. /package/esm/alpha/tabbed-chips/__stories__/{TabbedChips.stories.js → AlphaTabbedChips.stories.js} +0 -0
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextDisplay1 } from '../TextDisplay1';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextDisplay1
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextDisplay2 } from '../TextDisplay2';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextDisplay2
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextDisplay3 } from '../TextDisplay3';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextDisplay3
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextHeadline } from '../TextHeadline';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextHeadline
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextLabel1 } from '../TextLabel1';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextLabel1
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextLabel2 } from '../TextLabel2';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextLabel2
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextLegal } from '../TextLegal';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextLegal
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextTitle1 } from '../TextTitle1';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextTitle1
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextTitle2 } from '../TextTitle2';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextTitle2
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextTitle3 } from '../TextTitle3';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextTitle3
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { TextTitle4 } from '../TextTitle4';
3
3
  import TextExamplesScreen from './TextExamples';
4
+
5
+ // eslint-disable-next-line internal/example-screen-default
4
6
  import { jsx as _jsx } from "react/jsx-runtime";
5
7
  export default () => /*#__PURE__*/_jsx(TextExamplesScreen, {
6
8
  component: TextTitle4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile",
3
- "version": "8.25.1",
3
+ "version": "8.26.0",
4
4
  "description": "Coinbase Design System - Mobile",
5
5
  "repository": {
6
6
  "type": "git",
@@ -154,7 +154,7 @@
154
154
  "react-native-svg": "^14.1.0"
155
155
  },
156
156
  "dependencies": {
157
- "@coinbase/cds-common": "^8.25.1",
157
+ "@coinbase/cds-common": "^8.26.0",
158
158
  "@coinbase/cds-icons": "^5.7.0",
159
159
  "@coinbase/cds-illustrations": "^4.28.0",
160
160
  "@coinbase/cds-lottie-files": "^3.3.3",
@@ -1,98 +0,0 @@
1
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import { Animated } from 'react-native';
3
- import { convertMotionConfig } from '../../animation/convertMotionConfig';
4
- import { Example, ExampleScreen } from '../../examples/ExampleScreen';
5
- import { useTheme } from '../../hooks/useTheme';
6
- import { HStack } from '../../layout/HStack';
7
- import { VStack } from '../../layout/VStack';
8
- import { Pressable } from '../../system/Pressable';
9
- import { Text } from '../../typography/Text';
10
- import { Icon } from '../Icon';
11
- import { TextIcon } from '../TextIcon';
12
- import { IconSheet } from './IconSheet';
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- const animateInConfig = convertMotionConfig({
15
- easing: 'enterFunctional',
16
- duration: 'moderate1',
17
- toValue: 1,
18
- useNativeDriver: false
19
- });
20
- const animateOutConfig = convertMotionConfig({
21
- easing: 'exitFunctional',
22
- duration: 'moderate1',
23
- toValue: 1,
24
- useNativeDriver: false
25
- });
26
- export const useAnimation = () => {
27
- const animationRef = useRef(new Animated.Value(0));
28
- return useMemo(() => {
29
- const animateIn = Animated.timing(animationRef.current, animateInConfig);
30
- const animateOut = Animated.timing(animationRef.current, animateOutConfig);
31
- return [animationRef.current, animateIn, animateOut];
32
- }, []);
33
- };
34
- const IconScreen = () => {
35
- const theme = useTheme();
36
- const [isToggled, setIsToggled] = useState(false);
37
- const animationRef = useRef(new Animated.Value(0)).current;
38
- useEffect(() => {
39
- Animated.timing(animationRef, isToggled ? animateInConfig : animateOutConfig).start();
40
- }, [isToggled, animationRef]);
41
- const toggle = useCallback(() => setIsToggled(prevIsToggled => !prevIsToggled), []);
42
- const animatedIcon = /*#__PURE__*/_jsx(Icon, {
43
- active: true,
44
- animated: true,
45
- dangerouslySetColor: animationRef.interpolate({
46
- inputRange: [0, 1],
47
- outputRange: [theme.color.bgLine, theme.color.fgPrimary]
48
- }),
49
- name: "star",
50
- size: "l"
51
- });
52
- return /*#__PURE__*/_jsxs(ExampleScreen, {
53
- children: [/*#__PURE__*/_jsx(Example, {
54
- title: "Nesting TextIcons",
55
- children: /*#__PURE__*/_jsxs(VStack, {
56
- gap: 1,
57
- children: [/*#__PURE__*/_jsxs(Text, {
58
- font: "body",
59
- children: [/*#__PURE__*/_jsx(TextIcon, {
60
- active: true,
61
- name: "dot",
62
- size: "xs"
63
- }), /*#__PURE__*/_jsx(Text, {
64
- font: "body",
65
- children: "This is some text"
66
- })]
67
- }), /*#__PURE__*/_jsxs(Text, {
68
- font: "body",
69
- children: [/*#__PURE__*/_jsx(TextIcon, {
70
- active: true,
71
- name: "dot",
72
- size: "xs"
73
- }), /*#__PURE__*/_jsx(Text, {
74
- font: "body",
75
- children: "This is soooooooooooooome reallllllllllllllllly loooooooonnngggggg text"
76
- })]
77
- })]
78
- })
79
- }), /*#__PURE__*/_jsx(Example, {
80
- title: "Animated Icon",
81
- children: /*#__PURE__*/_jsx(Pressable, {
82
- noScaleOnPress: true,
83
- accessibilityHint: "hit star to rate the product",
84
- accessibilityLabel: "rating a product",
85
- background: "transparent",
86
- onPress: toggle,
87
- children: /*#__PURE__*/_jsxs(HStack, {
88
- gap: 1,
89
- children: [animatedIcon, animatedIcon, animatedIcon, animatedIcon]
90
- })
91
- })
92
- }), /*#__PURE__*/_jsx(Example, {
93
- title: "Icon Sheet",
94
- children: /*#__PURE__*/_jsx(IconSheet, {})
95
- })]
96
- });
97
- };
98
- export default IconScreen;
@@ -1,164 +0,0 @@
1
- import React, { memo, useCallback } from 'react';
2
- import { Dimensions, FlatList } from 'react-native';
3
- import { illustrationDimensions, illustrationSizes } from '@coinbase/cds-common/tokens/illustrations';
4
- import heroSquareVersionMap from '@coinbase/cds-illustrations/__generated__/heroSquare/data/versionMap';
5
- import pictogramVersionMap from '@coinbase/cds-illustrations/__generated__/pictogram/data/versionMap';
6
- import spotIconVersionMap from '@coinbase/cds-illustrations/__generated__/spotIcon/data/versionMap';
7
- import spotRectangleVersionMap from '@coinbase/cds-illustrations/__generated__/spotRectangle/data/versionMap';
8
- import spotSquareVersionMap from '@coinbase/cds-illustrations/__generated__/spotSquare/data/versionMap';
9
- import { Divider, VStack } from '../../layout';
10
- import { ThemeProvider } from '../../system/ThemeProvider';
11
- import { defaultTheme } from '../../themes/defaultTheme';
12
- import { Text } from '../../typography/Text';
13
- import { HeroSquare, Pictogram, SpotIcon, SpotRectangle, SpotSquare } from '../index';
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- function keys(obj) {
16
- return Object.keys(obj);
17
- }
18
- const images = {
19
- heroSquare: keys(heroSquareVersionMap),
20
- pictogram: keys(pictogramVersionMap),
21
- spotRectangle: keys(spotRectangleVersionMap),
22
- spotSquare: keys(spotSquareVersionMap),
23
- spotIcon: keys(spotIconVersionMap)
24
- };
25
- export function getIllustrationSheet(type) {
26
- /** Constants */
27
- const FLAT_LIST_STYLE = {
28
- width: '100%'
29
- };
30
- const FLAT_LIST_CONTAINER_STYLE = {
31
- marginLeft: 24,
32
- paddingBottom: 24,
33
- alignContent: 'flex-start'
34
- };
35
- const SCREEN_WIDTH = Dimensions.get('window').width - FLAT_LIST_CONTAINER_STYLE.marginLeft * 2;
36
- const SIZES = {
37
- pictogram: {
38
- height: illustrationSizes[illustrationDimensions.pictogram[0]][1],
39
- width: illustrationSizes[illustrationDimensions.pictogram[0]][0],
40
- scaleMultiplier: 1
41
- },
42
- spotSquare: {
43
- height: illustrationSizes[illustrationDimensions.spotSquare[0]][1],
44
- width: illustrationSizes[illustrationDimensions.spotSquare[0]][0],
45
- scaleMultiplier: 0.4
46
- },
47
- spotRectangle: {
48
- height: illustrationSizes[illustrationDimensions.spotRectangle[0]][1],
49
- width: illustrationSizes[illustrationDimensions.spotRectangle[0]][0],
50
- scaleMultiplier: 0.3
51
- },
52
- heroSquare: {
53
- height: illustrationSizes[illustrationDimensions.heroSquare[0]][1],
54
- width: illustrationSizes[illustrationDimensions.heroSquare[0]][0],
55
- scaleMultiplier: 0.24
56
- },
57
- spotIcon: {
58
- height: illustrationSizes[illustrationDimensions.spotIcon[0]][1],
59
- width: illustrationSizes[illustrationDimensions.spotIcon[0]][0],
60
- scaleMultiplier: 1
61
- }
62
- };
63
- const ITEM_COLUMNS = Math.floor(SCREEN_WIDTH / (SIZES[type].width * SIZES[type].scaleMultiplier));
64
- const names = images[type];
65
- const data = [];
66
- names.forEach(name => {
67
- data.push({
68
- name,
69
- colorScheme: 'light'
70
- });
71
- data.push({
72
- name,
73
- colorScheme: 'dark'
74
- });
75
- });
76
- const ListFooterComponent = /*#__PURE__*/memo(function ListFooterComponent() {
77
- // TODO: pull from ui-mobile-playground/helpers/constants via scrollViewEnd constant
78
- return /*#__PURE__*/_jsx(Divider, {
79
- testID: "mobile-playground-scrollview-end"
80
- });
81
- });
82
- const renderItem = _ref => {
83
- let {
84
- item
85
- } = _ref;
86
- const dim = SIZES[type].width + "x" + SIZES[type].height;
87
- return /*#__PURE__*/_jsx(ThemeProvider, {
88
- activeColorScheme: item.colorScheme,
89
- theme: defaultTheme,
90
- children: /*#__PURE__*/_jsxs(VStack, {
91
- background: "bg",
92
- overflow: "hidden",
93
- width: SIZES[type].width * SIZES[type].scaleMultiplier,
94
- children: [type === 'heroSquare' &&
95
- /*#__PURE__*/
96
- // render a 48x48 thumbnail
97
- _jsx(HeroSquare, {
98
- dimension: dim,
99
- name: item.name,
100
- scaleMultiplier: SIZES.heroSquare.scaleMultiplier
101
- }), type === 'spotSquare' &&
102
- /*#__PURE__*/
103
- // render a 48x48 thumbnail
104
- _jsx(SpotSquare, {
105
- name: item.name,
106
- scaleMultiplier: SIZES.spotSquare.scaleMultiplier
107
- }), type === 'spotRectangle' &&
108
- /*#__PURE__*/
109
- // render a 72x36 thumbnail
110
- _jsx(SpotRectangle, {
111
- name: item.name,
112
- scaleMultiplier: SIZES.spotRectangle.scaleMultiplier
113
- }), type === 'pictogram' && /*#__PURE__*/_jsx(Pictogram, {
114
- dimension: dim,
115
- name: item.name,
116
- scaleMultiplier: SIZES.pictogram.scaleMultiplier
117
- }), type === 'spotIcon' && /*#__PURE__*/_jsx(SpotIcon, {
118
- dimension: dim,
119
- name: item.name,
120
- scaleMultiplier: SIZES.spotIcon.scaleMultiplier
121
- }), /*#__PURE__*/_jsx(Text, {
122
- ellipsize: "tail",
123
- font: "legal",
124
- children: item.name
125
- })]
126
- })
127
- });
128
- };
129
- const IllustrationSheet = /*#__PURE__*/memo(function IllustrationSheet() {
130
- const getItemLayout = useCallback(function getItemLayout(_data, index) {
131
- return {
132
- length: SIZES[type].height * SIZES[type].scaleMultiplier,
133
- offset: SIZES[type].height * SIZES[type].scaleMultiplier * index,
134
- index
135
- };
136
- }, []);
137
- const keyExtractor = useCallback(function keyExtractor(item) {
138
- return type + "-" + item.name + "-" + item.colorScheme;
139
- }, []);
140
- return /*#__PURE__*/_jsx(VStack
141
- // TODO: pull from ui-mobile-playground/helpers/constants via screen constant
142
- , {
143
- alignItems: "center",
144
- background: "bg",
145
- flexGrow: 1,
146
- justifyContent: "center",
147
- testID: "mobile-playground-screen",
148
- children: /*#__PURE__*/_jsx(FlatList, {
149
- ListFooterComponent: ListFooterComponent,
150
- contentContainerStyle: FLAT_LIST_CONTAINER_STYLE,
151
- data: data,
152
- getItemLayout: getItemLayout,
153
- keyExtractor: keyExtractor,
154
- numColumns: ITEM_COLUMNS,
155
- renderItem: renderItem,
156
- style: FLAT_LIST_STYLE
157
- // TODO: pull from ui-mobile-playground/helpers/constants via scrollView constant
158
- ,
159
- testID: "mobile-playground-scrollview"
160
- })
161
- });
162
- });
163
- return IllustrationSheet;
164
- }