@coinbase/cds-mobile 9.0.0-rc.2 → 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.
Files changed (69) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/dts/buttons/IconButton.d.ts +19 -1
  3. package/dts/buttons/IconButton.d.ts.map +1 -1
  4. package/dts/cells/Cell.d.ts +2 -1
  5. package/dts/cells/Cell.d.ts.map +1 -1
  6. package/dts/controls/InputIconButton.d.ts +5 -0
  7. package/dts/controls/InputIconButton.d.ts.map +1 -1
  8. package/dts/controls/InputLabel.d.ts.map +1 -1
  9. package/dts/controls/SearchInput.d.ts +4 -0
  10. package/dts/controls/SearchInput.d.ts.map +1 -1
  11. package/dts/controls/TextInput.d.ts.map +1 -1
  12. package/dts/core/theme.d.ts +12 -0
  13. package/dts/core/theme.d.ts.map +1 -1
  14. package/dts/illustrations/createIllustration.d.ts +3 -0
  15. package/dts/illustrations/createIllustration.d.ts.map +1 -1
  16. package/dts/page/PageFooter.d.ts +8 -0
  17. package/dts/page/PageFooter.d.ts.map +1 -1
  18. package/dts/system/ThemeProvider.d.ts.map +1 -1
  19. package/dts/tabs/DefaultTab.d.ts +4 -2
  20. package/dts/tabs/DefaultTab.d.ts.map +1 -1
  21. package/dts/tabs/DefaultTabsActiveIndicator.d.ts.map +1 -1
  22. package/dts/tabs/SegmentedTab.d.ts +4 -4
  23. package/dts/tabs/Tabs.d.ts +10 -1
  24. package/dts/tabs/Tabs.d.ts.map +1 -1
  25. package/dts/tag/Tag.d.ts +5 -3
  26. package/dts/tag/Tag.d.ts.map +1 -1
  27. package/dts/themes/coinbaseDenseTheme.d.ts +34 -2
  28. package/dts/themes/coinbaseDenseTheme.d.ts.map +1 -1
  29. package/dts/themes/coinbaseHighContrastTheme.d.ts +32 -0
  30. package/dts/themes/coinbaseHighContrastTheme.d.ts.map +1 -1
  31. package/dts/themes/coinbaseTheme.d.ts +34 -2
  32. package/dts/themes/coinbaseTheme.d.ts.map +1 -1
  33. package/dts/themes/defaultHighContrastTheme.d.ts +32 -0
  34. package/dts/themes/defaultHighContrastTheme.d.ts.map +1 -1
  35. package/dts/themes/defaultTheme.d.ts +34 -2
  36. package/dts/themes/defaultTheme.d.ts.map +1 -1
  37. package/dts/utils/convertThemedSvgToHex.d.ts +6 -0
  38. package/dts/utils/convertThemedSvgToHex.d.ts.map +1 -0
  39. package/dts/utils/testHelpers.d.ts +34 -2
  40. package/dts/utils/testHelpers.d.ts.map +1 -1
  41. package/dts/visualizations/chart/PeriodSelector.d.ts.map +1 -1
  42. package/esm/buttons/IconButton.js +8 -2
  43. package/esm/buttons/__stories__/IconButton.stories.js +65 -0
  44. package/esm/controls/InputLabel.js +4 -3
  45. package/esm/controls/TextInput.js +7 -1
  46. package/esm/illustrations/__stories__/ThemedIllustrations.stories.js +214 -0
  47. package/esm/illustrations/__stories__/illustrationThemes.js +122 -0
  48. package/esm/illustrations/createIllustration.js +31 -5
  49. package/esm/page/PageFooter.js +16 -5
  50. package/esm/page/__figma__/PageFooter.figma.js +49 -6
  51. package/esm/system/ThemeProvider.js +3 -1
  52. package/esm/system/__stories__/componentConfigStickerSheet/StickerSheet.js +4 -0
  53. package/esm/system/__stories__/componentConfigStickerSheet/customComponentConfig.js +24 -12
  54. package/esm/system/__stories__/componentConfigStickerSheet/examples/ListCell.js +2 -0
  55. package/esm/system/__stories__/componentConfigStickerSheet/examples/Tabs.js +24 -0
  56. package/esm/system/__stories__/componentConfigStickerSheet/examples/TextInput.js +12 -0
  57. package/esm/tabs/DefaultTab.js +7 -9
  58. package/esm/tabs/DefaultTabsActiveIndicator.js +1 -2
  59. package/esm/tabs/Tabs.js +18 -12
  60. package/esm/tabs/__stories__/SegmentedTabs.stories.js +8 -1
  61. package/esm/tabs/__stories__/Tabs.stories.js +0 -1
  62. package/esm/tag/Tag.js +14 -4
  63. package/esm/themes/coinbaseHighContrastTheme.js +32 -0
  64. package/esm/themes/coinbaseTheme.js +34 -2
  65. package/esm/themes/defaultHighContrastTheme.js +32 -0
  66. package/esm/themes/defaultTheme.js +34 -2
  67. package/esm/utils/convertThemedSvgToHex.js +9 -0
  68. package/esm/visualizations/chart/PeriodSelector.js +3 -4
  69. package/package.json +3 -3
@@ -0,0 +1,122 @@
1
+ export const ILLUSTRATION_THEME_TABS = [{
2
+ id: 'default',
3
+ label: 'Default'
4
+ }, {
5
+ id: 'warm',
6
+ label: 'Warm'
7
+ }, {
8
+ id: 'monochrome',
9
+ label: 'Mono'
10
+ }, {
11
+ id: 'garish',
12
+ label: 'Garish'
13
+ }];
14
+ export const WARM_ILLUSTRATION_THEME = {
15
+ lightIllustrationColor: {
16
+ primary: 'rgb(234, 88, 12)',
17
+ black: 'rgb(28, 25, 23)',
18
+ white: 'rgb(255, 247, 237)',
19
+ gray: 'rgb(254, 243, 199)',
20
+ gray2: 'rgb(254, 243, 199)',
21
+ gray3: 'rgb(253, 230, 138)',
22
+ positive: 'rgb(34, 197, 94)',
23
+ negative: 'rgb(239, 68, 68)',
24
+ accent1: 'rgb(250, 204, 21)',
25
+ accent2: 'rgb(249, 115, 22)',
26
+ accent3: 'rgb(239, 68, 68)',
27
+ accent4: 'rgb(254, 215, 170)',
28
+ invert: 'rgb(120, 53, 15)',
29
+ invert2: 'rgb(255, 247, 237)'
30
+ },
31
+ darkIllustrationColor: {
32
+ primary: 'rgb(251, 146, 60)',
33
+ black: 'rgb(255, 247, 237)',
34
+ white: 'rgb(28, 25, 23)',
35
+ gray: 'rgb(120, 53, 15)',
36
+ gray2: 'rgb(120, 53, 15)',
37
+ gray3: 'rgb(154, 52, 18)',
38
+ positive: 'rgb(74, 222, 128)',
39
+ negative: 'rgb(248, 113, 113)',
40
+ accent1: 'rgb(253, 224, 71)',
41
+ accent2: 'rgb(253, 186, 116)',
42
+ accent3: 'rgb(248, 113, 113)',
43
+ accent4: 'rgb(154, 52, 18)',
44
+ invert: 'rgb(255, 237, 213)',
45
+ invert2: 'rgb(120, 53, 15)'
46
+ }
47
+ };
48
+ export const MONOCHROME_ILLUSTRATION_THEME = {
49
+ lightIllustrationColor: {
50
+ primary: 'rgb(113, 113, 122)',
51
+ black: 'rgb(9, 9, 11)',
52
+ white: 'rgb(250, 250, 250)',
53
+ gray: 'rgb(228, 228, 231)',
54
+ gray2: 'rgb(212, 212, 216)',
55
+ gray3: 'rgb(196, 196, 202)',
56
+ positive: 'rgb(161, 161, 170)',
57
+ negative: 'rgb(82, 82, 91)',
58
+ accent1: 'rgb(161, 161, 170)',
59
+ accent2: 'rgb(113, 113, 122)',
60
+ accent3: 'rgb(82, 82, 91)',
61
+ accent4: 'rgb(212, 212, 216)',
62
+ invert: 'rgb(9, 9, 11)',
63
+ invert2: 'rgb(244, 244, 245)'
64
+ },
65
+ darkIllustrationColor: {
66
+ primary: 'rgb(161, 161, 170)',
67
+ black: 'rgb(244, 244, 245)',
68
+ white: 'rgb(24, 24, 27)',
69
+ gray: 'rgb(63, 63, 70)',
70
+ gray2: 'rgb(63, 63, 70)',
71
+ gray3: 'rgb(82, 82, 91)',
72
+ positive: 'rgb(113, 113, 122)',
73
+ negative: 'rgb(212, 212, 216)',
74
+ accent1: 'rgb(113, 113, 122)',
75
+ accent2: 'rgb(161, 161, 170)',
76
+ accent3: 'rgb(212, 212, 216)',
77
+ accent4: 'rgb(63, 63, 70)',
78
+ invert: 'rgb(244, 244, 245)',
79
+ invert2: 'rgb(39, 39, 42)'
80
+ }
81
+ };
82
+
83
+ // Maximally distinct colors — ideal for verifying every token is wired correctly
84
+ export const GARISH_ILLUSTRATION_THEME = {
85
+ lightIllustrationColor: {
86
+ primary: 'rgb(220, 38, 38)',
87
+ black: 'rgb(20, 83, 45)',
88
+ white: 'rgb(254, 249, 195)',
89
+ gray: 'rgb(243, 232, 255)',
90
+ gray2: 'rgb(243, 232, 255)',
91
+ gray3: 'rgb(219, 234, 254)',
92
+ positive: 'rgb(34, 197, 94)',
93
+ negative: 'rgb(185, 28, 28)',
94
+ accent1: 'rgb(249, 115, 22)',
95
+ accent2: 'rgb(20, 184, 166)',
96
+ accent3: 'rgb(34, 197, 94)',
97
+ accent4: 'rgb(147, 197, 253)',
98
+ invert: 'rgb(127, 29, 29)',
99
+ invert2: 'rgb(219, 234, 254)'
100
+ },
101
+ darkIllustrationColor: {
102
+ primary: 'rgb(248, 113, 113)',
103
+ black: 'rgb(187, 247, 208)',
104
+ white: 'rgb(30, 27, 75)',
105
+ gray: 'rgb(88, 28, 135)',
106
+ gray2: 'rgb(88, 28, 135)',
107
+ gray3: 'rgb(30, 58, 138)',
108
+ positive: 'rgb(74, 222, 128)',
109
+ negative: 'rgb(252, 165, 165)',
110
+ accent1: 'rgb(253, 186, 116)',
111
+ accent2: 'rgb(94, 234, 212)',
112
+ accent3: 'rgb(74, 222, 128)',
113
+ accent4: 'rgb(147, 197, 253)',
114
+ invert: 'rgb(254, 202, 202)',
115
+ invert2: 'rgb(30, 58, 138)'
116
+ }
117
+ };
118
+ export const ILLUSTRATION_THEMES = {
119
+ warm: WARM_ILLUSTRATION_THEME,
120
+ monochrome: MONOCHROME_ILLUSTRATION_THEME,
121
+ garish: GARISH_ILLUSTRATION_THEME
122
+ };
@@ -5,11 +5,12 @@ import { convertSizeWithMultiplier } from '@coinbase/cds-common/utils/convertSiz
5
5
  import { getDefaultSizeObjectForIllustration } from '@coinbase/cds-common/utils/getDefaultSizeObjectForIllustration';
6
6
  import { isDevelopment } from '@coinbase/cds-utils';
7
7
  import { useTheme } from '../hooks/useTheme';
8
+ import { convertThemedSvgToHex } from '../utils/convertThemedSvgToHex';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  export function createIllustration(variant, config) {
10
11
  const defaultSize = getDefaultSizeObjectForIllustration(variant);
11
12
  const Illustration = /*#__PURE__*/memo(function Illustration(_ref) {
12
- var _config$name;
13
+ var _config$name2, _config$name3;
13
14
  let {
14
15
  fallback = null,
15
16
  name,
@@ -17,13 +18,13 @@ export function createIllustration(variant, config) {
17
18
  scaleMultiplier,
18
19
  testID,
19
20
  accessibilityHint,
20
- accessibilityLabel
21
+ accessibilityLabel,
22
+ applyTheme
21
23
  } = _ref;
22
24
  const {
23
- activeColorScheme
25
+ activeColorScheme,
26
+ illustrationColor
24
27
  } = useTheme();
25
- const requireFn = (_config$name = config[name]) == null ? void 0 : _config$name[activeColorScheme];
26
- const xml = useMemo(() => requireFn == null ? void 0 : requireFn(), [requireFn]);
27
28
  const style = useMemo(() => {
28
29
  let size = defaultSize;
29
30
  if (dimension) {
@@ -34,6 +35,31 @@ export function createIllustration(variant, config) {
34
35
  }
35
36
  return size;
36
37
  }, [dimension, scaleMultiplier]);
38
+ const themedXml = useMemo(() => {
39
+ var _config$name, _config$name$themeabl;
40
+ if (!applyTheme || illustrationColor === undefined) return null;
41
+ const raw = (_config$name = config[name]) == null || (_config$name$themeabl = _config$name['themeable']) == null ? void 0 : _config$name$themeabl.call(_config$name);
42
+ return raw ? convertThemedSvgToHex(raw, illustrationColor) : null;
43
+ }, [name, applyTheme, illustrationColor]);
44
+ if (applyTheme) {
45
+ if (themedXml) {
46
+ return /*#__PURE__*/_jsx(SvgXml, {
47
+ accessibilityHint: accessibilityHint,
48
+ accessibilityLabel: accessibilityLabel,
49
+ accessibilityRole: "image",
50
+ accessible: !!accessibilityLabel,
51
+ style: style,
52
+ testID: testID,
53
+ xml: themedXml
54
+ });
55
+ }
56
+
57
+ // No themed variant available or no palette — return fallback.
58
+ return fallback;
59
+ }
60
+
61
+ // Default light/dark path.
62
+ const xml = (_config$name2 = config[name]) == null || (_config$name3 = _config$name2[activeColorScheme === 'dark' ? 'dark' : 'light']) == null ? void 0 : _config$name3.call(_config$name2);
37
63
  if (!xml) {
38
64
  if (isDevelopment()) {
39
65
  console.error("Unable to find illustration with name: " + name);
@@ -1,25 +1,36 @@
1
- const _excluded = ["action"];
1
+ const _excluded = ["action", "legalText"];
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';
5
5
  import { pageFooterHeight } from '@coinbase/cds-common/tokens/page';
6
6
  import { useComponentConfig } from '../hooks/useComponentConfig';
7
7
  import { Box } from '../layout/Box';
8
- import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { VStack } from '../layout/VStack';
9
+ import { Text } from '../typography/Text';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
11
  export const PageFooter = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) => {
10
12
  const mergedProps = useComponentConfig('PageFooter', _props);
11
13
  const {
12
- action
14
+ action,
15
+ legalText
13
16
  } = mergedProps,
14
17
  props = _objectWithoutPropertiesLoose(mergedProps, _excluded);
15
18
  return /*#__PURE__*/_jsx(Box, _extends({
16
19
  ref: ref,
17
20
  accessibilityRole: "toolbar",
18
21
  alignItems: "center",
19
- height: pageFooterHeight,
22
+ height: legalText ? undefined : pageFooterHeight,
20
23
  paddingX: 3,
21
24
  paddingY: 1.5
22
25
  }, props, {
23
- children: action
26
+ children: legalText ? /*#__PURE__*/_jsxs(VStack, {
27
+ alignItems: "center",
28
+ gap: 2,
29
+ children: [action, /*#__PURE__*/_jsx(Text, {
30
+ color: "fgMuted",
31
+ font: "legal",
32
+ children: legalText
33
+ })]
34
+ }) : action
24
35
  }));
25
36
  }));
@@ -1,18 +1,61 @@
1
1
  import React from 'react';
2
2
  import { figma } from '@figma/code-connect';
3
+ import { Button } from '../../buttons/Button';
4
+ import { ButtonGroup } from '../../buttons/ButtonGroup';
3
5
  import { PageFooter } from '../PageFooter';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- figma.connect(PageFooter, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/✨-CDS-Components?node-id=17685%3A3266', {
6
- imports: ["import { PageFooter } from '@coinbase/cds-mobile/page/PageFooter'"],
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const url = 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/✨-CDS-Components?node-id=17685%3A3266';
8
+ figma.connect(PageFooter, url, {
9
+ imports: ["import { PageFooter } from '@coinbase/cds-mobile/page/PageFooter'", "import { Button } from '@coinbase/cds-mobile/buttons/Button'"],
10
+ variant: {
11
+ '# of actions': '1'
12
+ },
7
13
  props: {
8
- action: figma.children('ButtonGroup')
14
+ legalText: figma.boolean('show legal text', {
15
+ true: 'Your legal text here.',
16
+ false: undefined
17
+ })
9
18
  },
10
19
  example: _ref => {
11
20
  let {
12
- action
21
+ legalText
13
22
  } = _ref;
14
23
  return /*#__PURE__*/_jsx(PageFooter, {
15
- action: action
24
+ action: /*#__PURE__*/_jsx(Button, {
25
+ variant: "primary",
26
+ children: "Next"
27
+ }),
28
+ legalText: legalText
29
+ });
30
+ }
31
+ });
32
+ figma.connect(PageFooter, url, {
33
+ imports: ["import { PageFooter } from '@coinbase/cds-mobile/page/PageFooter'", "import { Button } from '@coinbase/cds-mobile/buttons/Button'", "import { ButtonGroup } from '@coinbase/cds-mobile/buttons/ButtonGroup'"],
34
+ variant: {
35
+ '# of actions': '2'
36
+ },
37
+ props: {
38
+ legalText: figma.boolean('show legal text', {
39
+ true: 'Your legal text here.',
40
+ false: undefined
41
+ })
42
+ },
43
+ example: _ref2 => {
44
+ let {
45
+ legalText
46
+ } = _ref2;
47
+ return /*#__PURE__*/_jsx(PageFooter, {
48
+ action: /*#__PURE__*/_jsxs(ButtonGroup, {
49
+ block: true,
50
+ children: [/*#__PURE__*/_jsx(Button, {
51
+ variant: "secondary",
52
+ children: "Back"
53
+ }), /*#__PURE__*/_jsx(Button, {
54
+ variant: "primary",
55
+ children: "Next"
56
+ })]
57
+ }),
58
+ legalText: legalText
16
59
  });
17
60
  }
18
61
  });
@@ -35,6 +35,7 @@ export const ThemeProvider = /*#__PURE__*/memo(_ref => {
35
35
  const themeApi = useMemo(() => {
36
36
  const activeSpectrumKey = activeColorScheme === 'dark' ? 'darkSpectrum' : 'lightSpectrum';
37
37
  const activeColorKey = activeColorScheme === 'dark' ? 'darkColor' : 'lightColor';
38
+ const activeIllustrationKey = activeColorScheme === 'dark' ? 'darkIllustrationColor' : 'lightIllustrationColor';
38
39
  const inverseSpectrumKey = activeColorScheme === 'dark' ? 'lightSpectrum' : 'darkSpectrum';
39
40
  const inverseColorKey = activeColorScheme === 'dark' ? 'lightColor' : 'darkColor';
40
41
  if (!theme[activeColorKey]) throw Error("ThemeProvider activeColorScheme is " + activeColorScheme + " but no " + activeColorScheme + " colors are defined for the theme. See the docs https://cds.coinbase.com/getting-started/theming");
@@ -44,7 +45,8 @@ export const ThemeProvider = /*#__PURE__*/memo(_ref => {
44
45
  return _extends({}, theme, {
45
46
  activeColorScheme: activeColorScheme,
46
47
  spectrum: theme[activeSpectrumKey],
47
- color: theme[activeColorKey]
48
+ color: theme[activeColorKey],
49
+ illustrationColor: theme[activeIllustrationKey]
48
50
  });
49
51
  }, [theme, activeColorScheme]);
50
52
  return /*#__PURE__*/_jsx(ThemeContext.Provider, {
@@ -16,6 +16,7 @@ import { SearchExample } from './examples/Search';
16
16
  import { SegmentedTabsExample } from './examples/SegmentedTabs';
17
17
  import { SelectExample } from './examples/Select';
18
18
  import { SelectChipExample } from './examples/SelectChip';
19
+ import { TabsExample } from './examples/Tabs';
19
20
  import { TagExample } from './examples/Tag';
20
21
  import { TextInputExample } from './examples/TextInput';
21
22
  import { Container } from './Container';
@@ -38,6 +39,9 @@ export const StickerSheet = /*#__PURE__*/memo(() => {
38
39
  }), /*#__PURE__*/_jsx(Container, {
39
40
  title: "Segmented Tabs",
40
41
  children: /*#__PURE__*/_jsx(SegmentedTabsExample, {})
42
+ }), /*#__PURE__*/_jsx(Container, {
43
+ title: "Tabs",
44
+ children: /*#__PURE__*/_jsx(TabsExample, {})
41
45
  }), /*#__PURE__*/_jsx(Container, {
42
46
  title: "Select Input (SelectOption)",
43
47
  children: /*#__PURE__*/_jsx(SelectExample, {})
@@ -1,8 +1,6 @@
1
- const _excluded = ["label", "labelNode"];
1
+ const _excluded = ["label", "labelNode", "readOnly"];
2
2
  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
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
- import { Text } from '../../../typography/Text';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
4
  export const customComponentConfig = {
7
5
  Banner: {
8
6
  borderRadius: 0
@@ -29,18 +27,14 @@ export const customComponentConfig = {
29
27
  },
30
28
  TextInput: _ref => {
31
29
  let {
32
- label,
33
- labelNode
30
+ readOnly
34
31
  } = _ref,
35
32
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
36
33
  return {
37
- labelNode: (labelNode != null ? labelNode : label) ? /*#__PURE__*/_jsx(Text, {
38
- color: "fgMuted",
39
- font: "label2",
40
- children: label
41
- }) : undefined,
34
+ labelColor: 'fgMuted',
35
+ labelFont: 'label2',
42
36
  bordered: false,
43
- inputBackground: 'bgAlternate',
37
+ inputBackground: readOnly ? 'bgSecondary' : 'bgAlternate',
44
38
  font: props.compact ? 'label2' : 'body',
45
39
  variant: 'foregroundMuted',
46
40
  focusedBorderWidth: 100
@@ -112,5 +106,23 @@ export const customComponentConfig = {
112
106
  font: props.compact ? 'label2' : 'body',
113
107
  labelColor: 'fgMuted',
114
108
  labelFont: props.compact ? props.align === 'end' ? 'label1' : 'label2' : 'body'
115
- })
109
+ }),
110
+ ListCell: props => {
111
+ var _props$spacingVariant;
112
+ const spacingVariant = (_props$spacingVariant = props.spacingVariant) != null ? _props$spacingVariant : props.compact ? 'compact' : 'normal';
113
+ return _extends({}, spacingVariant === 'normal' ? {
114
+ minHeight: 36
115
+ } : {});
116
+ },
117
+ Tabs: {
118
+ activeColor: 'fg',
119
+ color: 'fgMuted',
120
+ activeBackground: 'fg'
121
+ },
122
+ Tag: {
123
+ paddingY: 0.5,
124
+ paddingX: 1,
125
+ font: 'caption',
126
+ emphasis: 'low'
127
+ }
116
128
  };
@@ -43,6 +43,8 @@ export const ListCellExample = /*#__PURE__*/memo(() => {
43
43
  onPress: () => undefined,
44
44
  subtitle: "XRP",
45
45
  title: "XRP"
46
+ }), /*#__PURE__*/_jsx(ListCell, {
47
+ title: "Short"
46
48
  })]
47
49
  });
48
50
  });
@@ -0,0 +1,24 @@
1
+ import React, { memo, useState } from 'react';
2
+ import { Tabs } from '../../../../tabs/Tabs';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const tabs = [{
5
+ id: 'orderBook',
6
+ label: 'Order book'
7
+ }, {
8
+ id: 'tradeHistory',
9
+ label: 'Trade history'
10
+ }, {
11
+ id: 'orders',
12
+ label: 'Orders'
13
+ }];
14
+ export const TabsExample = /*#__PURE__*/memo(() => {
15
+ const [activeTab, setActiveTab] = useState(tabs[0]);
16
+ return /*#__PURE__*/_jsx(Tabs, {
17
+ accessibilityLabel: "Market views",
18
+ activeTab: activeTab,
19
+ background: "bg",
20
+ gap: 4,
21
+ onChange: setActiveTab,
22
+ tabs: tabs
23
+ });
24
+ });
@@ -40,6 +40,18 @@ export const TextInputExample = /*#__PURE__*/memo(() => {
40
40
  labelVariant: "inside",
41
41
  onChangeText: setValue,
42
42
  placeholder: "Input with icon button",
43
+ style: {
44
+ flexGrow: 1
45
+ },
46
+ value: value
47
+ }), /*#__PURE__*/_jsx(TextInput, {
48
+ readOnly: true,
49
+ label: "Label",
50
+ onChangeText: setValue,
51
+ placeholder: "Read only input",
52
+ style: {
53
+ flexGrow: 1
54
+ },
43
55
  value: value
44
56
  })]
45
57
  });
@@ -1,7 +1,7 @@
1
- const _excluded = ["id", "label", "disabled", "onPress", "count", "max", "accessibilityLabel", "style", "testID"];
1
+ const _excluded = ["id", "label", "disabled", "onPress", "count", "max", "accessibilityLabel", "style", "testID", "color", "activeColor"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { forwardRef, memo, useCallback, useMemo } from 'react';
4
+ import React, { forwardRef, memo, useCallback } from 'react';
5
5
  import { Pressable } from 'react-native';
6
6
  import { useTabsContext } from '@coinbase/cds-common/tabs/TabsContext';
7
7
  import { accessibleOpacityDisabled } from '@coinbase/cds-common/tokens/interactable';
@@ -22,7 +22,9 @@ const DefaultTabComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref
22
22
  max,
23
23
  accessibilityLabel,
24
24
  style,
25
- testID
25
+ testID,
26
+ color = 'fg',
27
+ activeColor = 'fgPrimary'
26
28
  } = _ref,
27
29
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
28
30
  const theme = useTheme();
@@ -37,10 +39,6 @@ const DefaultTabComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref
37
39
  updateActiveTab(id);
38
40
  onPress == null || onPress(id, event);
39
41
  }, [id, onPress, updateActiveTab]);
40
- const labelPaddingStyle = useMemo(() => ({
41
- paddingTop: theme.space[2],
42
- paddingBottom: theme.space[2] - 2
43
- }), [theme.space]);
44
42
  return /*#__PURE__*/_jsx(Pressable, _extends({
45
43
  ref: ref,
46
44
  accessibilityLabel: accessibilityLabel,
@@ -60,9 +58,9 @@ const DefaultTabComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref
60
58
  alignItems: "center",
61
59
  gap: 0.5,
62
60
  children: [/*#__PURE__*/_jsx(Text, {
63
- color: isActive ? 'fgPrimary' : 'fg',
61
+ color: isActive ? activeColor : color,
64
62
  font: "headline",
65
- style: labelPaddingStyle,
63
+ paddingY: 2,
66
64
  children: label
67
65
  }), !!count && /*#__PURE__*/_jsx(DotCount, {
68
66
  count: count,
@@ -7,8 +7,7 @@ import { Box } from '../layout';
7
7
  import { tabsSpringConfig } from './Tabs';
8
8
 
9
9
  /**
10
- * Default underline-style indicator for mobile `Tabs`. Pass as
11
- * `TabsActiveIndicatorComponent={DefaultTabsActiveIndicator}` with `TabComponent={DefaultTab}`.
10
+ * Default underline-style indicator for mobile `Tabs`.
12
11
  */
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  const AnimatedBox = Animated.createAnimatedComponent(Box);
package/esm/tabs/Tabs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const _excluded = ["id", "registerRef"],
2
- _excluded2 = ["tabs", "TabComponent", "TabsActiveIndicatorComponent", "activeBackground", "activeTab", "disabled", "onChange", "styles", "style", "role", "position", "alignSelf", "opacity", "onActiveTabElementChange", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "testID"],
2
+ _excluded2 = ["tabs", "TabComponent", "TabsActiveIndicatorComponent", "activeBackground", "color", "activeColor", "activeTab", "disabled", "onChange", "styles", "style", "role", "position", "alignSelf", "opacity", "onActiveTabElementChange", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "testID"],
3
3
  _excluded3 = ["id", "Component"],
4
4
  _excluded4 = ["activeTabRect", "position", "style", "testID"];
5
5
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
@@ -44,6 +44,8 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
44
44
  TabComponent = DefaultTab,
45
45
  TabsActiveIndicatorComponent = DefaultTabsActiveIndicator,
46
46
  activeBackground,
47
+ color,
48
+ activeColor,
47
49
  activeTab,
48
50
  disabled,
49
51
  onChange,
@@ -102,6 +104,7 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
102
104
  borderRadius: borderRadius,
103
105
  borderTopLeftRadius: borderTopLeftRadius,
104
106
  borderTopRightRadius: borderTopRightRadius,
107
+ color: color,
105
108
  onLayout: updateActiveTabRect,
106
109
  opacity: opacity != null ? opacity : disabled ? accessibleOpacityDisabled : 1,
107
110
  position: position,
@@ -121,20 +124,23 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
121
124
  borderTopRightRadius: borderTopRightRadius,
122
125
  style: styles == null ? void 0 : styles.activeIndicator,
123
126
  testID: testID ? testID + "-active-indicator" : undefined
124
- }), tabs.map(_ref2 => {
125
- let {
127
+ }), tabs.map(tabProps => {
128
+ const {
126
129
  id,
127
130
  Component: CustomTabComponent
128
- } = _ref2,
129
- props = _objectWithoutPropertiesLoose(_ref2, _excluded3);
131
+ } = tabProps,
132
+ tabRest = _objectWithoutPropertiesLoose(tabProps, _excluded3);
130
133
  const RenderedTab = CustomTabComponent != null ? CustomTabComponent : TabComponent;
134
+ const renderedTabProps = _extends({
135
+ activeColor,
136
+ color,
137
+ id,
138
+ style: styles == null ? void 0 : styles.tab
139
+ }, tabRest);
131
140
  return /*#__PURE__*/_jsx(TabContainer, {
132
141
  id: id,
133
142
  registerRef: registerRef,
134
- children: /*#__PURE__*/_jsx(RenderedTab, _extends({
135
- id: id,
136
- style: styles == null ? void 0 : styles.tab
137
- }, props))
143
+ children: /*#__PURE__*/_jsx(RenderedTab, _extends({}, renderedTabProps))
138
144
  }, id);
139
145
  })]
140
146
  })
@@ -142,14 +148,14 @@ const TabsComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, ref) =>
142
148
  }));
143
149
  TabsComponent.displayName = 'Tabs';
144
150
  export const Tabs = TabsComponent;
145
- export const TabsActiveIndicator = _ref3 => {
151
+ export const TabsActiveIndicator = _ref2 => {
146
152
  let {
147
153
  activeTabRect,
148
154
  position = 'absolute',
149
155
  style,
150
156
  testID = 'tabs-active-indicator'
151
- } = _ref3,
152
- props = _objectWithoutPropertiesLoose(_ref3, _excluded4);
157
+ } = _ref2,
158
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded4);
153
159
  const previousActiveTabRect = useRef(activeTabRect);
154
160
  const newActiveTabRect = {
155
161
  x: activeTabRect.x,
@@ -291,7 +291,14 @@ const SegmentedTabsScreen = () => /*#__PURE__*/_jsxs(ExampleScreen, {
291
291
  defaultActiveTab: basicSegments[0],
292
292
  tabs: basicSegments,
293
293
  title: "Border Radius"
294
- }), /*#__PURE__*/_jsx(CustomStylesExample, {}), /*#__PURE__*/_jsx(IconLabelsExample, {})]
294
+ }), /*#__PURE__*/_jsx(CustomStylesExample, {}), /*#__PURE__*/_jsx(IconLabelsExample, {}), /*#__PURE__*/_jsx(SegmentedTabsExample, {
295
+ activeBackground: "bgPositiveWash",
296
+ activeColor: "bgPositive",
297
+ color: "fgMuted",
298
+ defaultActiveTab: basicSegments[0],
299
+ tabs: basicSegments,
300
+ title: "Label Colors"
301
+ })]
295
302
  });
296
303
  const CustomStylesExample = () => {
297
304
  const theme = useTheme();
@@ -97,7 +97,6 @@ const TabsWithPanelsExample = () => {
97
97
  children: "Pair tab buttons with content regions that follow the active tab (see panel below)."
98
98
  }), /*#__PURE__*/_jsx(Tabs, {
99
99
  TabComponent: DefaultTab,
100
- TabsActiveIndicatorComponent: DefaultTabsActiveIndicator,
101
100
  accessibilityLabel: "Content sections",
102
101
  activeBackground: "bg",
103
102
  activeTab: activeTab,
package/esm/tag/Tag.js CHANGED
@@ -1,4 +1,4 @@
1
- const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "alignItems", "flexDirection", "gap", "justifyContent", "paddingY", "testID"];
1
+ const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "alignItems", "flexDirection", "gap", "justifyContent", "paddingX", "paddingY", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight", "testID"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
4
  import React, { forwardRef, memo } from 'react';
@@ -6,7 +6,7 @@ import { tagBorderRadiusMap, tagEmphasisColorMap, tagFontMap, tagHorizontalSpaci
6
6
  import { useComponentConfig } from '../hooks/useComponentConfig';
7
7
  import { useTheme } from '../hooks/useTheme';
8
8
  import { Icon } from '../icons/Icon';
9
- import { Box } from '../layout';
9
+ import { Box } from '../layout/Box';
10
10
  import { Text } from '../typography/Text';
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedRef) => {
@@ -28,7 +28,13 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedR
28
28
  flexDirection = 'row',
29
29
  gap = 0.5,
30
30
  justifyContent = 'center',
31
+ paddingX,
31
32
  paddingY = 0.25,
33
+ font,
34
+ fontFamily,
35
+ fontSize,
36
+ fontWeight,
37
+ lineHeight,
32
38
  testID = 'cds-tag'
33
39
  } = mergedProps,
34
40
  props = _objectWithoutPropertiesLoose(mergedProps, _excluded);
@@ -47,7 +53,7 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedR
47
53
  flexDirection: flexDirection,
48
54
  gap: gap,
49
55
  justifyContent: justifyContent,
50
- paddingX: tagHorizontalSpacing[intent],
56
+ paddingX: paddingX != null ? paddingX : tagHorizontalSpacing[intent],
51
57
  paddingY: paddingY,
52
58
  style: {
53
59
  backgroundColor
@@ -60,7 +66,11 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_props, forwardedR
60
66
  name: startIcon,
61
67
  size: "xs"
62
68
  }) : null, /*#__PURE__*/_jsx(Text, {
63
- font: tagFontMap[intent],
69
+ font: font != null ? font : tagFontMap[intent],
70
+ fontFamily: fontFamily,
71
+ fontSize: fontSize,
72
+ fontWeight: fontWeight,
73
+ lineHeight: lineHeight,
64
74
  numberOfLines: 1,
65
75
  style: {
66
76
  color