@coinbase/cds-mobile 8.25.0 → 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.
- package/CHANGELOG.md +19 -0
- package/dts/alpha/select/DefaultSelectControl.d.ts +2 -8
- package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectDropdown.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectOptionGroup.d.ts +8 -0
- package/dts/alpha/select/DefaultSelectOptionGroup.d.ts.map +1 -0
- package/dts/alpha/select/Select.d.ts +23 -366
- package/dts/alpha/select/Select.d.ts.map +1 -1
- package/dts/alpha/select/index.d.ts +2 -0
- package/dts/alpha/select/index.d.ts.map +1 -1
- package/dts/alpha/select/types.d.ts +486 -0
- package/dts/alpha/select/types.d.ts.map +1 -0
- package/dts/alpha/select-chip/SelectChip.d.ts +26 -0
- package/dts/alpha/select-chip/SelectChip.d.ts.map +1 -0
- package/dts/alpha/select-chip/SelectChipControl.d.ts +14 -0
- package/dts/alpha/select-chip/SelectChipControl.d.ts.map +1 -0
- package/dts/alpha/select-chip/index.d.ts +3 -0
- package/dts/alpha/select-chip/index.d.ts.map +1 -0
- package/dts/chips/Chip.d.ts.map +1 -1
- package/dts/chips/SelectChip.d.ts +8 -0
- package/dts/chips/SelectChip.d.ts.map +1 -1
- package/dts/examples/ExampleScreen.d.ts +26 -1
- package/dts/examples/ExampleScreen.d.ts.map +1 -1
- package/esm/alpha/select/DefaultSelectControl.js +46 -8
- package/esm/alpha/select/DefaultSelectDropdown.js +100 -31
- package/esm/alpha/select/DefaultSelectOption.js +1 -1
- package/esm/alpha/select/DefaultSelectOptionGroup.js +90 -0
- package/esm/alpha/select/Select.js +10 -26
- package/esm/alpha/select/index.js +3 -1
- package/esm/alpha/select/types.js +50 -0
- package/esm/alpha/select-chip/SelectChip.js +31 -0
- package/esm/alpha/select-chip/SelectChipControl.js +111 -0
- package/esm/alpha/select-chip/__stories__/SelectChip.stories.js +538 -0
- package/esm/alpha/select-chip/index.js +2 -0
- package/esm/banner/__stories__/Banner.stories.js +133 -294
- package/esm/banner/__stories__/BannerActions.stories.js +276 -0
- package/esm/banner/__stories__/BannerLayout.stories.js +329 -0
- package/esm/cells/__stories__/ListCell.stories.js +1 -17
- package/esm/cells/__stories__/ListCellFallback.stories.js +1 -0
- package/esm/chips/Chip.js +4 -1
- package/esm/chips/SelectChip.js +9 -0
- package/esm/examples/ExampleScreen.js +79 -58
- package/esm/icons/__stories__/IconSheet.js +35 -13
- package/esm/illustrations/__stories__/HeroSquare.stories.js +70 -2
- package/esm/illustrations/__stories__/Pictogram.stories.js +70 -2
- package/esm/illustrations/__stories__/SpotIcon.stories.js +70 -2
- package/esm/illustrations/__stories__/SpotRectangle.stories.js +68 -2
- package/esm/illustrations/__stories__/SpotSquare.stories.js +68 -2
- package/esm/media/__stories__/CarouselMedia.stories.js +2 -5
- package/esm/numpad/__stories__/Numpad.stories.js +8 -5
- package/esm/page/__stories__/PageFooter.stories.js +5 -4
- package/esm/page/__stories__/PageFooterInPage.stories.js +20 -19
- package/esm/page/__stories__/PageHeader.stories.js +4 -4
- package/esm/page/__stories__/PageHeaderInErrorEmptyState.stories.js +6 -4
- package/esm/page/__stories__/PageHeaderInPage.stories.js +20 -18
- package/esm/section-header/__stories__/SectionHeader.stories.js +4 -4
- package/esm/sticky-footer/__stories__/StickyFooter.stories.js +6 -8
- package/esm/tour/__stories__/Tour.stories.js +13 -166
- package/esm/typography/__stories__/TextBody.stories.js +2 -0
- package/esm/typography/__stories__/TextCaption.stories.js +2 -0
- package/esm/typography/__stories__/TextCore.stories.js +2 -0
- package/esm/typography/__stories__/TextDisplay1.stories.js +2 -0
- package/esm/typography/__stories__/TextDisplay2.stories.js +2 -0
- package/esm/typography/__stories__/TextDisplay3.stories.js +2 -0
- package/esm/typography/__stories__/TextHeadline.stories.js +2 -0
- package/esm/typography/__stories__/TextLabel1.stories.js +2 -0
- package/esm/typography/__stories__/TextLabel2.stories.js +2 -0
- package/esm/typography/__stories__/TextLegal.stories.js +2 -0
- package/esm/typography/__stories__/TextTitle1.stories.js +2 -0
- package/esm/typography/__stories__/TextTitle2.stories.js +2 -0
- package/esm/typography/__stories__/TextTitle3.stories.js +2 -0
- package/esm/typography/__stories__/TextTitle4.stories.js +2 -0
- package/package.json +2 -2
- package/esm/icons/__stories__/Icon.stories.js +0 -98
- package/esm/illustrations/__stories__/getIllustrationSheet.js +0 -164
- /package/esm/alpha/select/__stories__/{Select.stories.js → AlphaSelect.stories.js} +0 -0
- /package/esm/alpha/tabbed-chips/__stories__/{TabbedChips.stories.js → AlphaTabbedChips.stories.js} +0 -0
|
@@ -1291,105 +1291,89 @@ const UseCaseShowcase = () => {
|
|
|
1291
1291
|
};
|
|
1292
1292
|
const ListCellScreen = () => {
|
|
1293
1293
|
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
1294
|
+
paddingX: 0,
|
|
1294
1295
|
children: [/*#__PURE__*/_jsx(Example, {
|
|
1295
1296
|
inline: true,
|
|
1296
|
-
paddingX: 0,
|
|
1297
1297
|
title: "Content",
|
|
1298
1298
|
titlePadding: titlePadding,
|
|
1299
1299
|
children: /*#__PURE__*/_jsx(Content, {})
|
|
1300
1300
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1301
1301
|
inline: true,
|
|
1302
|
-
paddingX: 0,
|
|
1303
1302
|
title: "CustomNodes",
|
|
1304
1303
|
titlePadding: titlePadding,
|
|
1305
1304
|
children: /*#__PURE__*/_jsx(CustomNodes, {})
|
|
1306
1305
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1307
1306
|
inline: true,
|
|
1308
|
-
paddingX: 0,
|
|
1309
1307
|
title: "CompactContent(deprecated)",
|
|
1310
1308
|
titlePadding: titlePadding,
|
|
1311
1309
|
children: /*#__PURE__*/_jsx(CompactContent, {})
|
|
1312
1310
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1313
1311
|
inline: true,
|
|
1314
|
-
paddingX: 0,
|
|
1315
1312
|
title: "PressableContent",
|
|
1316
1313
|
titlePadding: titlePadding,
|
|
1317
1314
|
children: /*#__PURE__*/_jsx(PressableContent, {})
|
|
1318
1315
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1319
1316
|
inline: true,
|
|
1320
|
-
paddingX: 0,
|
|
1321
1317
|
title: "CompactPressableContent(deprecated)",
|
|
1322
1318
|
titlePadding: titlePadding,
|
|
1323
1319
|
children: /*#__PURE__*/_jsx(CompactPressableContent, {})
|
|
1324
1320
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1325
1321
|
inline: true,
|
|
1326
|
-
paddingX: 0,
|
|
1327
1322
|
title: "LongContent",
|
|
1328
1323
|
titlePadding: titlePadding,
|
|
1329
1324
|
children: /*#__PURE__*/_jsx(LongContent, {})
|
|
1330
1325
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1331
1326
|
inline: true,
|
|
1332
|
-
paddingX: 0,
|
|
1333
1327
|
title: "PriorityContent",
|
|
1334
1328
|
titlePadding: titlePadding,
|
|
1335
1329
|
children: /*#__PURE__*/_jsx(PriorityContent, {})
|
|
1336
1330
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1337
1331
|
inline: true,
|
|
1338
|
-
paddingX: 0,
|
|
1339
1332
|
title: "WithAccessory",
|
|
1340
1333
|
titlePadding: titlePadding,
|
|
1341
1334
|
children: /*#__PURE__*/_jsx(WithAccessory, {})
|
|
1342
1335
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1343
1336
|
inline: true,
|
|
1344
|
-
paddingX: 0,
|
|
1345
1337
|
title: "WithMedia",
|
|
1346
1338
|
titlePadding: titlePadding,
|
|
1347
1339
|
children: /*#__PURE__*/_jsx(WithMedia, {})
|
|
1348
1340
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1349
1341
|
inline: true,
|
|
1350
|
-
paddingX: 0,
|
|
1351
1342
|
title: "WithActions",
|
|
1352
1343
|
titlePadding: titlePadding,
|
|
1353
1344
|
children: /*#__PURE__*/_jsx(WithActions, {})
|
|
1354
1345
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1355
1346
|
inline: true,
|
|
1356
|
-
paddingX: 0,
|
|
1357
1347
|
title: "Fallback",
|
|
1358
1348
|
titlePadding: titlePadding,
|
|
1359
1349
|
children: /*#__PURE__*/_jsx(Fallback, {})
|
|
1360
1350
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1361
1351
|
inline: true,
|
|
1362
|
-
paddingX: 0,
|
|
1363
1352
|
title: "WithIntermediary",
|
|
1364
1353
|
titlePadding: titlePadding,
|
|
1365
1354
|
children: /*#__PURE__*/_jsx(WithIntermediary, {})
|
|
1366
1355
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1367
1356
|
inline: true,
|
|
1368
|
-
paddingX: 0,
|
|
1369
1357
|
title: "WithHelperText",
|
|
1370
1358
|
titlePadding: titlePadding,
|
|
1371
1359
|
children: /*#__PURE__*/_jsx(WithHelperText, {})
|
|
1372
1360
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1373
1361
|
inline: true,
|
|
1374
|
-
paddingX: 0,
|
|
1375
1362
|
title: "CustomSpacing",
|
|
1376
1363
|
titlePadding: titlePadding,
|
|
1377
1364
|
children: /*#__PURE__*/_jsx(CustomSpacing, {})
|
|
1378
1365
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1379
1366
|
inline: true,
|
|
1380
|
-
paddingX: 0,
|
|
1381
1367
|
title: "CondensedListCell",
|
|
1382
1368
|
titlePadding: titlePadding,
|
|
1383
1369
|
children: /*#__PURE__*/_jsx(CondensedListCell, {})
|
|
1384
1370
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1385
1371
|
inline: true,
|
|
1386
|
-
paddingX: 0,
|
|
1387
1372
|
title: "SpacingVariant",
|
|
1388
1373
|
titlePadding: titlePadding,
|
|
1389
1374
|
children: /*#__PURE__*/_jsx(SpacingVariant, {})
|
|
1390
1375
|
}), /*#__PURE__*/_jsx(Example, {
|
|
1391
1376
|
inline: true,
|
|
1392
|
-
paddingX: 0,
|
|
1393
1377
|
title: "UseCaseShowcase",
|
|
1394
1378
|
titlePadding: titlePadding,
|
|
1395
1379
|
children: /*#__PURE__*/_jsx(UseCaseShowcase, {})
|
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]
|
package/esm/chips/SelectChip.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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 =
|
|
53
|
+
export const ExampleScreen = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
67
54
|
let {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 {
|
|
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(
|
|
11
|
-
children:
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
},
|
|
46
|
+
}, "icons-" + i);
|
|
25
47
|
})
|
|
26
48
|
});
|
|
27
49
|
}
|
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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;
|
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { illustrationDimensions, illustrationSizes } from '@coinbase/cds-common/tokens/illustrations';
|
|
3
|
+
import pictogramVersionMap from '@coinbase/cds-illustrations/__generated__/pictogram/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 { Pictogram } 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 = 12;
|
|
13
|
+
const PICTOGRAM_SCALE = 1;
|
|
14
|
+
const pictogramDimensionKey = illustrationDimensions.pictogram[0];
|
|
15
|
+
const [pictogramWidth, pictogramHeight] = illustrationSizes[pictogramDimensionKey];
|
|
16
|
+
const PICTOGRAM_DIMENSION = pictogramWidth + "x" + pictogramHeight;
|
|
17
|
+
const PREVIEW_WIDTH = pictogramWidth * PICTOGRAM_SCALE;
|
|
18
|
+
const pictogramNames = Object.keys(pictogramVersionMap);
|
|
19
|
+
const pictogramGroups = [];
|
|
20
|
+
for (let i = 0; i < pictogramNames.length; i += ITEMS_PER_EXAMPLE) {
|
|
21
|
+
pictogramGroups.push(pictogramNames.slice(i, i + ITEMS_PER_EXAMPLE));
|
|
22
|
+
}
|
|
23
|
+
const PictogramPreview = _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(Pictogram, {
|
|
47
|
+
dimension: PICTOGRAM_DIMENSION,
|
|
48
|
+
name: name,
|
|
49
|
+
scaleMultiplier: PICTOGRAM_SCALE
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
}, name + "-" + scheme))
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const PictogramStory = () => {
|
|
57
|
+
return /*#__PURE__*/_jsx(ExampleScreen, {
|
|
58
|
+
children: pictogramGroups.map((group, index, arr) => /*#__PURE__*/_jsx(Example, {
|
|
59
|
+
title: "Pictograms " + (index + 1) + " of " + arr.length,
|
|
60
|
+
children: /*#__PURE__*/_jsx(HStack, {
|
|
61
|
+
flexWrap: "wrap",
|
|
62
|
+
gap: 1,
|
|
63
|
+
children: group.map(name => /*#__PURE__*/_jsx(PictogramPreview, {
|
|
64
|
+
name: name
|
|
65
|
+
}, name))
|
|
66
|
+
})
|
|
67
|
+
}, "pictogram-" + index))
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export default PictogramStory;
|
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { illustrationDimensions, illustrationSizes } from '@coinbase/cds-common/tokens/illustrations';
|
|
3
|
+
import spotIconVersionMap from '@coinbase/cds-illustrations/__generated__/spotIcon/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 { SpotIcon } 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 = 20;
|
|
13
|
+
const SPOT_ICON_SCALE = 1;
|
|
14
|
+
const spotIconDimensionKey = illustrationDimensions.spotIcon[0];
|
|
15
|
+
const [spotIconWidth, spotIconHeight] = illustrationSizes[spotIconDimensionKey];
|
|
16
|
+
const SPOT_ICON_DIMENSION = spotIconWidth + "x" + spotIconHeight;
|
|
17
|
+
const PREVIEW_WIDTH = spotIconWidth * SPOT_ICON_SCALE;
|
|
18
|
+
const spotIconNames = Object.keys(spotIconVersionMap);
|
|
19
|
+
const spotIconGroups = [];
|
|
20
|
+
for (let i = 0; i < spotIconNames.length; i += ITEMS_PER_EXAMPLE) {
|
|
21
|
+
spotIconGroups.push(spotIconNames.slice(i, i + ITEMS_PER_EXAMPLE));
|
|
22
|
+
}
|
|
23
|
+
const SpotIconPreview = _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(SpotIcon, {
|
|
47
|
+
dimension: SPOT_ICON_DIMENSION,
|
|
48
|
+
name: name,
|
|
49
|
+
scaleMultiplier: SPOT_ICON_SCALE
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
}, name + "-" + scheme))
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const SpotIconStory = () => {
|
|
57
|
+
return /*#__PURE__*/_jsx(ExampleScreen, {
|
|
58
|
+
children: spotIconGroups.map((group, index, arr) => /*#__PURE__*/_jsx(Example, {
|
|
59
|
+
title: "Spot Icons " + (index + 1) + " of " + arr.length,
|
|
60
|
+
children: /*#__PURE__*/_jsx(HStack, {
|
|
61
|
+
flexWrap: "wrap",
|
|
62
|
+
gap: 1,
|
|
63
|
+
children: group.map(name => /*#__PURE__*/_jsx(SpotIconPreview, {
|
|
64
|
+
name: name
|
|
65
|
+
}, name))
|
|
66
|
+
})
|
|
67
|
+
}, "spot-icon-" + index))
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export default SpotIconStory;
|