@coinbase/cds-mobile 8.25.1 → 8.27.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 (81) hide show
  1. package/CHANGELOG.md +21 -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/cells/CellAccessory.d.ts +1 -1
  20. package/dts/cells/CellAccessory.d.ts.map +1 -1
  21. package/dts/chips/Chip.d.ts.map +1 -1
  22. package/dts/chips/SelectChip.d.ts +8 -0
  23. package/dts/chips/SelectChip.d.ts.map +1 -1
  24. package/dts/examples/ExampleScreen.d.ts +26 -1
  25. package/dts/examples/ExampleScreen.d.ts.map +1 -1
  26. package/esm/alpha/select/DefaultSelectControl.js +46 -8
  27. package/esm/alpha/select/DefaultSelectDropdown.js +100 -31
  28. package/esm/alpha/select/DefaultSelectOption.js +1 -1
  29. package/esm/alpha/select/DefaultSelectOptionGroup.js +90 -0
  30. package/esm/alpha/select/Select.js +10 -26
  31. package/esm/alpha/select/index.js +3 -1
  32. package/esm/alpha/select/types.js +50 -0
  33. package/esm/alpha/select-chip/SelectChip.js +31 -0
  34. package/esm/alpha/select-chip/SelectChipControl.js +111 -0
  35. package/esm/alpha/select-chip/__stories__/SelectChip.stories.js +538 -0
  36. package/esm/alpha/select-chip/index.js +2 -0
  37. package/esm/banner/__stories__/Banner.stories.js +133 -294
  38. package/esm/banner/__stories__/BannerActions.stories.js +276 -0
  39. package/esm/banner/__stories__/BannerLayout.stories.js +329 -0
  40. package/esm/cells/Cell.js +1 -1
  41. package/esm/cells/CellAccessory.js +9 -0
  42. package/esm/cells/__stories__/ListCell.stories.js +81 -87
  43. package/esm/cells/__stories__/ListCellFallback.stories.js +1 -0
  44. package/esm/chips/Chip.js +4 -1
  45. package/esm/chips/SelectChip.js +9 -0
  46. package/esm/examples/ExampleScreen.js +79 -58
  47. package/esm/icons/__stories__/IconSheet.js +35 -13
  48. package/esm/illustrations/__stories__/HeroSquare.stories.js +70 -2
  49. package/esm/illustrations/__stories__/Pictogram.stories.js +70 -2
  50. package/esm/illustrations/__stories__/SpotIcon.stories.js +70 -2
  51. package/esm/illustrations/__stories__/SpotRectangle.stories.js +68 -2
  52. package/esm/illustrations/__stories__/SpotSquare.stories.js +68 -2
  53. package/esm/media/__stories__/CarouselMedia.stories.js +2 -5
  54. package/esm/numpad/__stories__/Numpad.stories.js +8 -5
  55. package/esm/page/__stories__/PageFooter.stories.js +5 -4
  56. package/esm/page/__stories__/PageFooterInPage.stories.js +20 -19
  57. package/esm/page/__stories__/PageHeader.stories.js +4 -4
  58. package/esm/page/__stories__/PageHeaderInErrorEmptyState.stories.js +6 -4
  59. package/esm/page/__stories__/PageHeaderInPage.stories.js +20 -18
  60. package/esm/section-header/__stories__/SectionHeader.stories.js +4 -4
  61. package/esm/sticky-footer/__stories__/StickyFooter.stories.js +6 -8
  62. package/esm/tour/__stories__/Tour.stories.js +13 -166
  63. package/esm/typography/__stories__/TextBody.stories.js +2 -0
  64. package/esm/typography/__stories__/TextCaption.stories.js +2 -0
  65. package/esm/typography/__stories__/TextCore.stories.js +2 -0
  66. package/esm/typography/__stories__/TextDisplay1.stories.js +2 -0
  67. package/esm/typography/__stories__/TextDisplay2.stories.js +2 -0
  68. package/esm/typography/__stories__/TextDisplay3.stories.js +2 -0
  69. package/esm/typography/__stories__/TextHeadline.stories.js +2 -0
  70. package/esm/typography/__stories__/TextLabel1.stories.js +2 -0
  71. package/esm/typography/__stories__/TextLabel2.stories.js +2 -0
  72. package/esm/typography/__stories__/TextLegal.stories.js +2 -0
  73. package/esm/typography/__stories__/TextTitle1.stories.js +2 -0
  74. package/esm/typography/__stories__/TextTitle2.stories.js +2 -0
  75. package/esm/typography/__stories__/TextTitle3.stories.js +2 -0
  76. package/esm/typography/__stories__/TextTitle4.stories.js +2 -0
  77. package/package.json +2 -2
  78. package/esm/icons/__stories__/Icon.stories.js +0 -98
  79. package/esm/illustrations/__stories__/getIllustrationSheet.js +0 -164
  80. /package/esm/alpha/select/__stories__/{Select.stories.js → AlphaSelect.stories.js} +0 -0
  81. /package/esm/alpha/tabbed-chips/__stories__/{TabbedChips.stories.js → AlphaTabbedChips.stories.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  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); }
2
- import React from 'react';
2
+ import React, { useState } from 'react';
3
3
  import { assets, squareAssets } from '@coinbase/cds-common/internal/data/assets';
4
4
  import { selectCellSpacingConfig } from '@coinbase/cds-common/tokens/select';
5
5
  import { gutter } from '@coinbase/cds-common/tokens/sizing';
@@ -490,75 +490,85 @@ const PriorityContent = () => /*#__PURE__*/_jsxs(_Fragment, {
490
490
  variant: "warning"
491
491
  })]
492
492
  });
493
- const WithAccessory = () => /*#__PURE__*/_jsxs(_Fragment, {
494
- children: [/*#__PURE__*/_jsx(ListCell, {
495
- accessory: "arrow",
496
- spacingVariant: "condensed",
497
- title: "Title"
498
- }), /*#__PURE__*/_jsx(ListCell, {
499
- accessory: "more",
500
- detail: "Detail",
501
- spacingVariant: "condensed",
502
- title: "Title"
503
- }), /*#__PURE__*/_jsx(ListCell, {
504
- accessory: "selected",
505
- description: "Description",
506
- spacingVariant: "condensed",
507
- title: "Title"
508
- }), /*#__PURE__*/_jsx(ListCell, {
509
- accessory: "arrow",
510
- description: "Description",
511
- detail: "Detail",
512
- spacingVariant: "condensed",
513
- title: "Title"
514
- }), /*#__PURE__*/_jsx(ListCell, {
515
- selected: true,
516
- accessory: "arrow",
517
- description: "Description",
518
- detail: "Detail",
519
- spacingVariant: "condensed",
520
- title: "Title"
521
- }), /*#__PURE__*/_jsx(ListCell, {
522
- disableSelectionAccessory: true,
523
- selected: true,
524
- accessory: "arrow",
525
- description: "Description",
526
- detail: "Detail",
527
- spacingVariant: "condensed",
528
- title: "Title"
529
- }), /*#__PURE__*/_jsx(ListCell, {
530
- accessory: "more",
531
- description: "Description",
532
- detail: "Detail",
533
- spacingVariant: "condensed",
534
- subdetail: "Neutral",
535
- title: "Title"
536
- }), /*#__PURE__*/_jsx(ListCell, {
537
- accessory: "selected",
538
- description: "Description",
539
- detail: "Detail",
540
- spacingVariant: "condensed",
541
- subdetail: "+Positive",
542
- title: "Title",
543
- variant: "positive"
544
- }), /*#__PURE__*/_jsx(ListCell, {
545
- accessory: "arrow",
546
- description: "Description",
547
- detail: "Detail",
548
- spacingVariant: "condensed",
549
- subdetail: "-Negative",
550
- title: "Title",
551
- variant: "negative"
552
- }), /*#__PURE__*/_jsx(ListCell, {
553
- accessory: "arrow",
554
- description: "Description",
555
- detail: "Detail",
556
- spacingVariant: "condensed",
557
- subdetail: "Warning",
558
- title: "Title",
559
- variant: "warning"
560
- })]
561
- });
493
+ const WithAccessory = () => {
494
+ const [isSelected, setIsSelected] = useState(false);
495
+ return /*#__PURE__*/_jsxs(_Fragment, {
496
+ children: [/*#__PURE__*/_jsx(ListCell, {
497
+ accessory: "arrow",
498
+ spacingVariant: "condensed",
499
+ title: "Title"
500
+ }), /*#__PURE__*/_jsx(ListCell, {
501
+ accessory: isSelected ? 'selected' : 'unselected',
502
+ description: "Selected state uses the same space, no layout shift when selected",
503
+ onPress: () => setIsSelected(prev => !prev),
504
+ selected: isSelected,
505
+ spacingVariant: "condensed",
506
+ title: "Leverage unselected state"
507
+ }), /*#__PURE__*/_jsx(ListCell, {
508
+ accessory: "more",
509
+ detail: "Detail",
510
+ spacingVariant: "condensed",
511
+ title: "Title"
512
+ }), /*#__PURE__*/_jsx(ListCell, {
513
+ accessory: "selected",
514
+ description: "Description",
515
+ spacingVariant: "condensed",
516
+ title: "Title"
517
+ }), /*#__PURE__*/_jsx(ListCell, {
518
+ accessory: "arrow",
519
+ description: "Description",
520
+ detail: "Detail",
521
+ spacingVariant: "condensed",
522
+ title: "Title"
523
+ }), /*#__PURE__*/_jsx(ListCell, {
524
+ selected: true,
525
+ accessory: "arrow",
526
+ description: "Description",
527
+ detail: "Detail",
528
+ spacingVariant: "condensed",
529
+ title: "Title"
530
+ }), /*#__PURE__*/_jsx(ListCell, {
531
+ disableSelectionAccessory: true,
532
+ selected: true,
533
+ accessory: "arrow",
534
+ description: "Description",
535
+ detail: "Detail",
536
+ spacingVariant: "condensed",
537
+ title: "Title"
538
+ }), /*#__PURE__*/_jsx(ListCell, {
539
+ accessory: "more",
540
+ description: "Description",
541
+ detail: "Detail",
542
+ spacingVariant: "condensed",
543
+ subdetail: "Neutral",
544
+ title: "Title"
545
+ }), /*#__PURE__*/_jsx(ListCell, {
546
+ accessory: "selected",
547
+ description: "Description",
548
+ detail: "Detail",
549
+ spacingVariant: "condensed",
550
+ subdetail: "+Positive",
551
+ title: "Title",
552
+ variant: "positive"
553
+ }), /*#__PURE__*/_jsx(ListCell, {
554
+ accessory: "arrow",
555
+ description: "Description",
556
+ detail: "Detail",
557
+ spacingVariant: "condensed",
558
+ subdetail: "-Negative",
559
+ title: "Title",
560
+ variant: "negative"
561
+ }), /*#__PURE__*/_jsx(ListCell, {
562
+ accessory: "arrow",
563
+ description: "Description",
564
+ detail: "Detail",
565
+ spacingVariant: "condensed",
566
+ subdetail: "Warning",
567
+ title: "Title",
568
+ variant: "warning"
569
+ })]
570
+ });
571
+ };
562
572
  const WithMedia = () => /*#__PURE__*/_jsxs(_Fragment, {
563
573
  children: [/*#__PURE__*/_jsx(ListCell, {
564
574
  media: /*#__PURE__*/_jsx(Icon, {
@@ -1291,105 +1301,89 @@ const UseCaseShowcase = () => {
1291
1301
  };
1292
1302
  const ListCellScreen = () => {
1293
1303
  return /*#__PURE__*/_jsxs(ExampleScreen, {
1304
+ paddingX: 0,
1294
1305
  children: [/*#__PURE__*/_jsx(Example, {
1295
1306
  inline: true,
1296
- paddingX: 0,
1297
1307
  title: "Content",
1298
1308
  titlePadding: titlePadding,
1299
1309
  children: /*#__PURE__*/_jsx(Content, {})
1300
1310
  }), /*#__PURE__*/_jsx(Example, {
1301
1311
  inline: true,
1302
- paddingX: 0,
1303
1312
  title: "CustomNodes",
1304
1313
  titlePadding: titlePadding,
1305
1314
  children: /*#__PURE__*/_jsx(CustomNodes, {})
1306
1315
  }), /*#__PURE__*/_jsx(Example, {
1307
1316
  inline: true,
1308
- paddingX: 0,
1309
1317
  title: "CompactContent(deprecated)",
1310
1318
  titlePadding: titlePadding,
1311
1319
  children: /*#__PURE__*/_jsx(CompactContent, {})
1312
1320
  }), /*#__PURE__*/_jsx(Example, {
1313
1321
  inline: true,
1314
- paddingX: 0,
1315
1322
  title: "PressableContent",
1316
1323
  titlePadding: titlePadding,
1317
1324
  children: /*#__PURE__*/_jsx(PressableContent, {})
1318
1325
  }), /*#__PURE__*/_jsx(Example, {
1319
1326
  inline: true,
1320
- paddingX: 0,
1321
1327
  title: "CompactPressableContent(deprecated)",
1322
1328
  titlePadding: titlePadding,
1323
1329
  children: /*#__PURE__*/_jsx(CompactPressableContent, {})
1324
1330
  }), /*#__PURE__*/_jsx(Example, {
1325
1331
  inline: true,
1326
- paddingX: 0,
1327
1332
  title: "LongContent",
1328
1333
  titlePadding: titlePadding,
1329
1334
  children: /*#__PURE__*/_jsx(LongContent, {})
1330
1335
  }), /*#__PURE__*/_jsx(Example, {
1331
1336
  inline: true,
1332
- paddingX: 0,
1333
1337
  title: "PriorityContent",
1334
1338
  titlePadding: titlePadding,
1335
1339
  children: /*#__PURE__*/_jsx(PriorityContent, {})
1336
1340
  }), /*#__PURE__*/_jsx(Example, {
1337
1341
  inline: true,
1338
- paddingX: 0,
1339
1342
  title: "WithAccessory",
1340
1343
  titlePadding: titlePadding,
1341
1344
  children: /*#__PURE__*/_jsx(WithAccessory, {})
1342
1345
  }), /*#__PURE__*/_jsx(Example, {
1343
1346
  inline: true,
1344
- paddingX: 0,
1345
1347
  title: "WithMedia",
1346
1348
  titlePadding: titlePadding,
1347
1349
  children: /*#__PURE__*/_jsx(WithMedia, {})
1348
1350
  }), /*#__PURE__*/_jsx(Example, {
1349
1351
  inline: true,
1350
- paddingX: 0,
1351
1352
  title: "WithActions",
1352
1353
  titlePadding: titlePadding,
1353
1354
  children: /*#__PURE__*/_jsx(WithActions, {})
1354
1355
  }), /*#__PURE__*/_jsx(Example, {
1355
1356
  inline: true,
1356
- paddingX: 0,
1357
1357
  title: "Fallback",
1358
1358
  titlePadding: titlePadding,
1359
1359
  children: /*#__PURE__*/_jsx(Fallback, {})
1360
1360
  }), /*#__PURE__*/_jsx(Example, {
1361
1361
  inline: true,
1362
- paddingX: 0,
1363
1362
  title: "WithIntermediary",
1364
1363
  titlePadding: titlePadding,
1365
1364
  children: /*#__PURE__*/_jsx(WithIntermediary, {})
1366
1365
  }), /*#__PURE__*/_jsx(Example, {
1367
1366
  inline: true,
1368
- paddingX: 0,
1369
1367
  title: "WithHelperText",
1370
1368
  titlePadding: titlePadding,
1371
1369
  children: /*#__PURE__*/_jsx(WithHelperText, {})
1372
1370
  }), /*#__PURE__*/_jsx(Example, {
1373
1371
  inline: true,
1374
- paddingX: 0,
1375
1372
  title: "CustomSpacing",
1376
1373
  titlePadding: titlePadding,
1377
1374
  children: /*#__PURE__*/_jsx(CustomSpacing, {})
1378
1375
  }), /*#__PURE__*/_jsx(Example, {
1379
1376
  inline: true,
1380
- paddingX: 0,
1381
1377
  title: "CondensedListCell",
1382
1378
  titlePadding: titlePadding,
1383
1379
  children: /*#__PURE__*/_jsx(CondensedListCell, {})
1384
1380
  }), /*#__PURE__*/_jsx(Example, {
1385
1381
  inline: true,
1386
- paddingX: 0,
1387
1382
  title: "SpacingVariant",
1388
1383
  titlePadding: titlePadding,
1389
1384
  children: /*#__PURE__*/_jsx(SpacingVariant, {})
1390
1385
  }), /*#__PURE__*/_jsx(Example, {
1391
1386
  inline: true,
1392
- paddingX: 0,
1393
1387
  title: "UseCaseShowcase",
1394
1388
  titlePadding: titlePadding,
1395
1389
  children: /*#__PURE__*/_jsx(UseCaseShowcase, {})
@@ -255,6 +255,7 @@ const Fallbacks = () => {
255
255
  };
256
256
  const ListCellFallbackScreen = () => {
257
257
  return /*#__PURE__*/_jsx(ExampleScreen, {
258
+ paddingX: 0,
258
259
  children: /*#__PURE__*/_jsx(Example, {
259
260
  children: /*#__PURE__*/_jsx(Fallbacks, {})
260
261
  })
package/esm/chips/Chip.js CHANGED
@@ -1,4 +1,4 @@
1
- const _excluded = ["alignSelf", "children", "start", "end", "invertColorScheme", "inverted", "maxWidth", "compact", "gap", "paddingX", "paddingY", "alignItems", "justifyContent", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "styles", "onPress", "font"];
1
+ const _excluded = ["alignSelf", "children", "start", "end", "invertColorScheme", "inverted", "maxWidth", "compact", "gap", "paddingX", "paddingY", "alignItems", "justifyContent", "padding", "paddingTop", "paddingBottom", "paddingStart", "paddingEnd", "numberOfLines", "testID", "contentStyle", "borderRadius", "background", "style", "styles", "onPress", "color", "font"];
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, Fragment, memo } from 'react';
@@ -38,6 +38,7 @@ export const Chip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Chip(_ref
38
38
  style,
39
39
  styles,
40
40
  onPress,
41
+ color = 'fg',
41
42
  font = compact ? 'label1' : 'headline'
42
43
  } = _ref,
43
44
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
@@ -64,11 +65,13 @@ export const Chip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Chip(_ref
64
65
  paddingY: paddingY,
65
66
  style: [contentStyle, styles == null ? void 0 : styles.content],
66
67
  children: [start, typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
68
+ color: color,
67
69
  flexShrink: 1,
68
70
  font: font,
69
71
  numberOfLines: numberOfLines,
70
72
  children: children
71
73
  }) : children ? /*#__PURE__*/_jsx(Box, {
74
+ color: color,
72
75
  flexShrink: 1,
73
76
  children: children
74
77
  }) : null, end]
@@ -11,7 +11,16 @@ import { useA11y } from '../hooks/useA11y';
11
11
  import { Icon } from '../icons';
12
12
  import { Tray } from '../overlays';
13
13
  import { MediaChip } from './MediaChip';
14
+
15
+ /**
16
+ * @deprecated This component is deprecated. Please use the new SelectChip alpha component instead.
17
+ * @see {@link @coinbase/cds-mobile/alpha/select-chip/SelectChip}
18
+ */
14
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ /**
21
+ * @deprecated This component is deprecated. Please use the new SelectChip alpha component instead.
22
+ * @see {@link @coinbase/cds-mobile/alpha/select-chip/SelectChip}
23
+ */
15
24
  export const SelectChip = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
16
25
  var _ref2;
17
26
  let {
@@ -1,76 +1,97 @@
1
- const _excluded = ["children", "inline", "title", "titlePadding"];
1
+ const _excluded = ["children", "inline", "title", "titlePadding", "hideDivider"],
2
+ _excluded2 = ["children"];
2
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); }
3
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { useMemo } from 'react';
5
- import { ScrollView, View } from 'react-native';
5
+ import React, { createContext, useCallback, useContext, useMemo, useRef } from 'react';
6
+ import { ScrollView } from 'react-native';
7
+ import { gutter } from '@coinbase/cds-common/tokens/sizing';
6
8
  import { useTheme } from '../hooks/useTheme';
7
9
  import { Box } from '../layout/Box';
8
10
  import { Divider } from '../layout/Divider';
9
11
  import { VStack } from '../layout/VStack';
10
12
  import { Text } from '../typography/Text';
11
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const ExampleContext = /*#__PURE__*/createContext({
15
+ registerExample: () => 0
16
+ });
12
17
  export const Example = _ref => {
13
18
  let {
14
19
  children,
15
20
  inline,
16
21
  title,
17
- titlePadding
22
+ titlePadding,
23
+ hideDivider
18
24
  } = _ref,
19
25
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
20
- const childStyles = useMemo(() => {
21
- const style = {
22
- paddingTop: 12
23
- };
24
- if (inline) {
25
- style.alignItems = 'flex-start';
26
- }
27
- return style;
28
- }, [inline]);
29
- const content = /*#__PURE__*/_jsxs(_Fragment, {
30
- children: [/*#__PURE__*/_jsxs(Box, _extends({
31
- background: "bg",
32
- padding: 2,
33
- paddingBottom: 3
34
- }, props, {
35
- children: [!!title && /*#__PURE__*/_jsx(Text, _extends({
36
- font: "title3"
37
- }, titlePadding, {
38
- children: title
39
- })), typeof children === 'function' ? children() : React.Children.map(children, (item, index) => /*#__PURE__*/_jsx(View, {
40
- style: childStyles,
41
- children: item
42
- }, index))]
43
- })), /*#__PURE__*/_jsx(Divider, {})]
44
- });
45
- return content;
46
- };
47
- const Screen = _ref2 => {
48
- let {
49
- children
50
- } = _ref2;
51
- const theme = useTheme();
52
- return /*#__PURE__*/_jsxs(ScrollView, {
53
- keyboardShouldPersistTaps: "always",
54
- persistentScrollbar: false,
55
- showsVerticalScrollIndicator: false,
56
- style: {
57
- backgroundColor: theme.color.bg,
58
- height: '100%'
59
- },
60
- testID: "mobile-playground-scrollview",
61
- children: [children, /*#__PURE__*/_jsx(Divider, {
62
- testID: "mobile-playground-scrollview-end"
26
+ const {
27
+ registerExample
28
+ } = useContext(ExampleContext);
29
+
30
+ // Register exactly once during first render
31
+ const exampleNumberRef = useRef();
32
+ if (exampleNumberRef.current === undefined) {
33
+ exampleNumberRef.current = registerExample();
34
+ }
35
+ const exampleLabel = "Example " + exampleNumberRef.current;
36
+ return /*#__PURE__*/_jsxs(VStack, _extends({
37
+ accessibilityLabel: exampleLabel,
38
+ alignItems: inline ? 'flex-start' : undefined,
39
+ background: "bg",
40
+ gap: 2,
41
+ paddingBottom: 3
42
+ }, props, {
43
+ children: [!!title && /*#__PURE__*/_jsx(Text, _extends({
44
+ color: "fgPrimary",
45
+ font: "title3"
46
+ }, titlePadding, {
47
+ children: title
48
+ })), typeof children === 'function' ? children() : children, !hideDivider && /*#__PURE__*/_jsx(Divider, {
49
+ background: "bgLine"
63
50
  })]
64
- });
51
+ }));
65
52
  };
66
- export const ExampleScreen = _ref3 => {
53
+ export const ExampleScreen = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
67
54
  let {
68
- children
69
- } = _ref3;
70
- return /*#__PURE__*/_jsxs(VStack, {
71
- testID: "mobile-playground-screen",
72
- children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(Screen, {
73
- children: children
74
- })]
55
+ children
56
+ } = _ref2,
57
+ boxProps = _objectWithoutPropertiesLoose(_ref2, _excluded2);
58
+ const theme = useTheme();
59
+
60
+ // Use ref to track count - this avoids stale closure issues when multiple
61
+ // Example components mount simultaneously
62
+ const exampleCountRef = useRef(0);
63
+ const registerExample = useCallback(() => {
64
+ exampleCountRef.current += 1;
65
+ return exampleCountRef.current;
66
+ }, []);
67
+ const context = useMemo(() => ({
68
+ registerExample
69
+ }), [registerExample]);
70
+ return /*#__PURE__*/_jsx(ExampleContext.Provider, {
71
+ value: context,
72
+ children: /*#__PURE__*/_jsx(Box, _extends({
73
+ borderedTop: true,
74
+ background: "bg",
75
+ borderColor: "bgLineHeavy",
76
+ paddingTop: 2,
77
+ paddingX: gutter,
78
+ testID: "mobile-playground-screen"
79
+ }, boxProps, {
80
+ children: /*#__PURE__*/_jsx(ScrollView, {
81
+ ref: ref,
82
+ contentContainerStyle: {
83
+ flexGrow: 1
84
+ },
85
+ keyboardShouldPersistTaps: "always",
86
+ persistentScrollbar: false,
87
+ showsVerticalScrollIndicator: false,
88
+ style: {
89
+ backgroundColor: theme.color.bg,
90
+ height: '100%'
91
+ },
92
+ children: children
93
+ })
94
+ }))
75
95
  });
76
- };
96
+ });
97
+ ExampleScreen.displayName = 'ExampleScreen';
@@ -1,27 +1,49 @@
1
1
  import React from 'react';
2
2
  import { names } from '@coinbase/cds-icons/names';
3
- import { HStack, VStack } from '../../layout';
3
+ import { Example, ExampleScreen } from '../../examples/ExampleScreen';
4
+ import { HStack } from '../../layout';
4
5
  import { Icon } from '../Icon';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
+ const iconVariants = names.map(name => ({
8
+ name,
9
+ sizes: ['xs', 's', 'm', 'l']
10
+ }));
11
+ const ICONS_PER_EXAMPLE_GROUP = 12;
12
+
13
+ // limit number of icon sets per mobile app "Example" to help with scroll stability in UI tests
14
+ const examples = [];
15
+ for (let i = 0; i < iconVariants.length; i += ICONS_PER_EXAMPLE_GROUP) {
16
+ examples.push(iconVariants.slice(i, i + ICONS_PER_EXAMPLE_GROUP));
17
+ }
6
18
  export function IconSheet(_ref) {
7
19
  let {
8
20
  renderIcon
9
21
  } = _ref;
10
- return /*#__PURE__*/_jsx(VStack, {
11
- children: /*#__PURE__*/_jsx(HStack, {
12
- flexWrap: "wrap",
13
- gap: 2,
14
- children: names.map(item => /*#__PURE__*/_jsx(VStack, {
22
+ return /*#__PURE__*/_jsx(ExampleScreen, {
23
+ children: examples.map((icons, i, arr) => {
24
+ return /*#__PURE__*/_jsx(Example, {
25
+ title: "Icons " + (i + 1) + " of " + arr.length,
15
26
  children: /*#__PURE__*/_jsx(HStack, {
27
+ flexWrap: "wrap",
16
28
  gap: 2,
17
- paddingBottom: 2,
18
- children: ['xs', 's', 'm', 'l'].map(size => renderIcon ? renderIcon(item, size) : /*#__PURE__*/_jsx(Icon, {
19
- color: "fg",
20
- name: item,
21
- size: size
22
- }, size))
29
+ children: icons.map(_ref2 => {
30
+ let {
31
+ name,
32
+ sizes
33
+ } = _ref2;
34
+ return /*#__PURE__*/_jsx(HStack, {
35
+ gap: 2,
36
+ children: sizes.map(size => {
37
+ return renderIcon ? renderIcon(name, size) : /*#__PURE__*/_jsx(Icon, {
38
+ color: "fg",
39
+ name: name,
40
+ size: size
41
+ }, size);
42
+ })
43
+ });
44
+ })
23
45
  })
24
- }, item))
46
+ }, "icons-" + i);
25
47
  })
26
48
  });
27
49
  }
@@ -1,2 +1,70 @@
1
- import { getIllustrationSheet } from './getIllustrationSheet';
2
- export default getIllustrationSheet('heroSquare');
1
+ import React from 'react';
2
+ import { illustrationDimensions, illustrationSizes } from '@coinbase/cds-common/tokens/illustrations';
3
+ import heroSquareVersionMap from '@coinbase/cds-illustrations/__generated__/heroSquare/data/versionMap';
4
+ import { Example, ExampleScreen } from '../../examples/ExampleScreen';
5
+ import { HStack, VStack } from '../../layout';
6
+ import { ThemeProvider } from '../../system/ThemeProvider';
7
+ import { defaultTheme } from '../../themes/defaultTheme';
8
+ import { Text } from '../../typography/Text';
9
+ import { HeroSquare } from '../index';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const COLOR_SCHEMES = ['light', 'dark'];
12
+ const ITEMS_PER_EXAMPLE = 8;
13
+ const HERO_SQUARE_SCALE = 0.24;
14
+ const heroSquareDimensionKey = illustrationDimensions.heroSquare[0];
15
+ const [heroSquareWidth, heroSquareHeight] = illustrationSizes[heroSquareDimensionKey];
16
+ const HERO_SQUARE_DIMENSION = heroSquareWidth + "x" + heroSquareHeight;
17
+ const PREVIEW_WIDTH = heroSquareWidth * HERO_SQUARE_SCALE;
18
+ const heroSquareNames = Object.keys(heroSquareVersionMap);
19
+ const heroSquareGroups = [];
20
+ for (let i = 0; i < heroSquareNames.length; i += ITEMS_PER_EXAMPLE) {
21
+ heroSquareGroups.push(heroSquareNames.slice(i, i + ITEMS_PER_EXAMPLE));
22
+ }
23
+ const HeroSquarePreview = _ref => {
24
+ let {
25
+ name
26
+ } = _ref;
27
+ return /*#__PURE__*/_jsxs(VStack, {
28
+ gap: 0,
29
+ style: {
30
+ width: PREVIEW_WIDTH * COLOR_SCHEMES.length
31
+ },
32
+ children: [/*#__PURE__*/_jsx(Text, {
33
+ ellipsize: "tail",
34
+ font: "legal",
35
+ numberOfLines: 1,
36
+ children: name
37
+ }), /*#__PURE__*/_jsx(HStack, {
38
+ gap: 0,
39
+ children: COLOR_SCHEMES.map(scheme => /*#__PURE__*/_jsx(ThemeProvider, {
40
+ activeColorScheme: scheme,
41
+ theme: defaultTheme,
42
+ children: /*#__PURE__*/_jsx(VStack, {
43
+ background: "bg",
44
+ overflow: "hidden",
45
+ width: PREVIEW_WIDTH,
46
+ children: /*#__PURE__*/_jsx(HeroSquare, {
47
+ dimension: HERO_SQUARE_DIMENSION,
48
+ name: name,
49
+ scaleMultiplier: HERO_SQUARE_SCALE
50
+ })
51
+ })
52
+ }, name + "-" + scheme))
53
+ })]
54
+ });
55
+ };
56
+ const HeroSquareStory = () => {
57
+ return /*#__PURE__*/_jsx(ExampleScreen, {
58
+ children: heroSquareGroups.map((group, index, arr) => /*#__PURE__*/_jsx(Example, {
59
+ title: "Hero Squares " + (index + 1) + " of " + arr.length,
60
+ children: /*#__PURE__*/_jsx(HStack, {
61
+ flexWrap: "wrap",
62
+ gap: 1,
63
+ children: group.map(name => /*#__PURE__*/_jsx(HeroSquarePreview, {
64
+ name: name
65
+ }, name))
66
+ })
67
+ }, "hero-square-" + index))
68
+ });
69
+ };
70
+ export default HeroSquareStory;