@coinbase/cds-mobile 8.59.0 → 8.61.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 (64) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dts/buttons/Button.d.ts +8 -0
  3. package/dts/buttons/Button.d.ts.map +1 -1
  4. package/dts/buttons/DefaultSlideButtonHandle.d.ts.map +1 -1
  5. package/dts/buttons/IconButton.d.ts +12 -7
  6. package/dts/buttons/IconButton.d.ts.map +1 -1
  7. package/dts/cards/Card.d.ts +4 -0
  8. package/dts/cards/Card.d.ts.map +1 -1
  9. package/dts/cards/CardBody.d.ts +4 -0
  10. package/dts/cards/CardBody.d.ts.map +1 -1
  11. package/dts/cards/CardFooter.d.ts +4 -0
  12. package/dts/cards/CardFooter.d.ts.map +1 -1
  13. package/dts/cards/CardGroup.d.ts +12 -0
  14. package/dts/cards/CardGroup.d.ts.map +1 -1
  15. package/dts/cards/CardHeader.d.ts +8 -0
  16. package/dts/cards/CardHeader.d.ts.map +1 -1
  17. package/dts/cards/CardMedia.d.ts +8 -0
  18. package/dts/cards/CardMedia.d.ts.map +1 -1
  19. package/dts/controls/InputIconButton.d.ts +1 -1
  20. package/dts/loaders/Spinner.d.ts +4 -0
  21. package/dts/loaders/Spinner.d.ts.map +1 -1
  22. package/dts/visualizations/ProgressBar.d.ts +2 -2
  23. package/dts/visualizations/ProgressBar.d.ts.map +1 -1
  24. package/dts/visualizations/ProgressBarWithFloatLabel.d.ts.map +1 -1
  25. package/dts/visualizations/ProgressCircle.d.ts +9 -1
  26. package/dts/visualizations/ProgressCircle.d.ts.map +1 -1
  27. package/esm/alpha/select/__stories__/AlphaSelect.stories.js +13 -9
  28. package/esm/buttons/Button.js +28 -10
  29. package/esm/buttons/DefaultSlideButtonHandle.js +7 -6
  30. package/esm/buttons/IconButton.js +23 -12
  31. package/esm/buttons/__stories__/Button.stories.js +60 -0
  32. package/esm/buttons/__stories__/IconButton.stories.js +148 -1
  33. package/esm/cards/Card.js +5 -0
  34. package/esm/cards/CardBody.js +5 -0
  35. package/esm/cards/CardFooter.js +4 -0
  36. package/esm/cards/CardGroup.js +14 -0
  37. package/esm/cards/CardHeader.js +9 -0
  38. package/esm/cards/CardMedia.js +10 -0
  39. package/esm/loaders/Spinner.js +5 -0
  40. package/esm/overlays/__stories__/AlertBasic.stories.js +2 -2
  41. package/esm/overlays/__stories__/AlertLongTitle.stories.js +2 -2
  42. package/esm/overlays/__stories__/AlertOverModal.stories.js +2 -10
  43. package/esm/overlays/__stories__/AlertPortal.stories.js +2 -6
  44. package/esm/overlays/__stories__/AlertSingleAction.stories.js +2 -2
  45. package/esm/overlays/__stories__/AlertVerticalActions.stories.js +2 -2
  46. package/esm/overlays/__stories__/DrawerFallback.stories.js +20 -13
  47. package/esm/overlays/__stories__/DrawerScrollable.stories.js +8 -1
  48. package/esm/overlays/__stories__/Drawers.js +4 -4
  49. package/esm/overlays/__stories__/ModalBackButton.stories.js +2 -2
  50. package/esm/overlays/__stories__/ModalBasic.stories.js +2 -2
  51. package/esm/overlays/__stories__/ModalCustomPadding.stories.js +2 -2
  52. package/esm/overlays/__stories__/ModalLong.stories.js +2 -2
  53. package/esm/overlays/__stories__/ModalPortal.stories.js +2 -6
  54. package/esm/overlays/__stories__/Overlay.stories.js +2 -6
  55. package/esm/overlays/__stories__/TrayNavigation.stories.js +6 -2
  56. package/esm/overlays/__stories__/Trays.js +20 -11
  57. package/esm/sticky-footer/__stories__/StickyFooter.stories.js +2 -2
  58. package/esm/sticky-footer/__stories__/StickyFooterWithTray.stories.js +3 -3
  59. package/esm/visualizations/DefaultProgressCircleContent.js +1 -1
  60. package/esm/visualizations/ProgressBar.js +3 -3
  61. package/esm/visualizations/ProgressBarWithFloatLabel.js +19 -28
  62. package/esm/visualizations/ProgressCircle.js +80 -60
  63. package/esm/visualizations/__stories__/ProgressCircle.stories.js +63 -11
  64. package/package.json +2 -2
@@ -1,14 +1,15 @@
1
- const _excluded = ["name", "active", "variant", "transparent", "compact", "background", "color", "borderColor", "iconSize", "borderWidth", "borderRadius", "feedback", "flush", "loading", "style", "accessibilityHint", "accessibilityLabel"];
1
+ const _excluded = ["name", "active", "variant", "transparent", "compact", "background", "color", "borderColor", "iconSize", "borderWidth", "borderRadius", "height", "width", "feedback", "flush", "loading", "progressCircleSize", "style", "accessibilityHint", "accessibilityLabel"];
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';
5
- import { ActivityIndicator } from 'react-native';
4
+ import { forwardRef, memo, useCallback, useMemo } from 'react';
6
5
  import { transparentVariants, variants } from '@coinbase/cds-common/tokens/button';
7
6
  import { interactableHeight } from '@coinbase/cds-common/tokens/interactableHeight';
8
7
  import { getButtonSpacingProps } from '@coinbase/cds-common/utils/getButtonSpacingProps';
9
8
  import { useTheme } from '../hooks/useTheme';
10
9
  import { Icon } from '../icons/Icon';
10
+ import { Box } from '../layout/Box';
11
11
  import { Pressable } from '../system/Pressable';
12
+ import { ProgressCircle } from '../visualizations/ProgressCircle';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function IconButton(_ref, ref) {
14
15
  let {
@@ -23,21 +24,24 @@ export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Ico
23
24
  iconSize = compact ? 's' : 'm',
24
25
  borderWidth = 100,
25
26
  borderRadius = 1000,
27
+ height = interactableHeight[compact ? 'compact' : 'regular'],
28
+ width = interactableHeight[compact ? 'compact' : 'regular'],
26
29
  feedback = compact ? 'light' : 'normal',
27
30
  flush,
28
31
  loading,
32
+ progressCircleSize,
29
33
  style,
30
34
  accessibilityHint,
31
35
  accessibilityLabel
32
36
  } = _ref,
33
37
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
34
38
  const theme = useTheme();
39
+ const iconSizeValue = theme.iconSize[iconSize];
35
40
  const variantMap = transparent ? transparentVariants : variants;
36
41
  const variantStyle = variantMap[variant];
37
42
  const colorValue = color != null ? color : variantStyle.color;
38
43
  const backgroundValue = background != null ? background : variantStyle.background;
39
44
  const borderColorValue = borderColor != null ? borderColor : variantStyle.borderColor;
40
- const minHeight = interactableHeight[compact ? 'compact' : 'regular'];
41
45
  const {
42
46
  marginStart,
43
47
  marginEnd
@@ -46,12 +50,12 @@ export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Ico
46
50
  flush
47
51
  });
48
52
  const sizingStyle = useMemo(() => ({
49
- height: minHeight,
50
- width: minHeight,
53
+ height: height,
54
+ width: width,
51
55
  alignItems: 'center',
52
56
  flexDirection: 'column',
53
57
  justifyContent: 'center'
54
- }), [minHeight]);
58
+ }), [height, width]);
55
59
  const pressableStyle = useCallback(state => [sizingStyle, typeof style === 'function' ? style(state) : style], [sizingStyle, style]);
56
60
  return /*#__PURE__*/_jsx(Pressable, _extends({
57
61
  ref: ref,
@@ -68,11 +72,18 @@ export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Ico
68
72
  style: pressableStyle,
69
73
  transparentWhileInactive: transparent
70
74
  }, props, {
71
- children: loading ? /*#__PURE__*/_jsx(ActivityIndicator, {
72
- color: theme.color[colorValue],
73
- size: "small",
74
- style: sizingStyle,
75
- testID: props.testID ? props.testID + "-activity-indicator" : undefined
75
+ children: loading ? /*#__PURE__*/_jsx(Box, {
76
+ alignItems: "center",
77
+ height: height,
78
+ justifyContent: "center",
79
+ width: width,
80
+ children: /*#__PURE__*/_jsx(ProgressCircle, {
81
+ indeterminate: true,
82
+ color: colorValue,
83
+ size: progressCircleSize != null ? progressCircleSize : iconSizeValue,
84
+ testID: props.testID ? props.testID + "-progress-circle" : undefined,
85
+ weight: "thin"
86
+ })
76
87
  }) :
77
88
  /*#__PURE__*/
78
89
  /* TO DO: test using currentColor like web does on Icon here */
@@ -44,6 +44,34 @@ const buttonStories = [{
44
44
  }, {
45
45
  loading: true,
46
46
  compact: true
47
+ }, {
48
+ loading: true,
49
+ transparent: true
50
+ }, {
51
+ loading: true,
52
+ transparent: true,
53
+ compact: true
54
+ }, {
55
+ loading: true,
56
+ variant: 'secondary'
57
+ }, {
58
+ loading: true,
59
+ variant: 'secondary',
60
+ compact: true
61
+ }, {
62
+ loading: true,
63
+ variant: 'positive'
64
+ }, {
65
+ loading: true,
66
+ variant: 'positive',
67
+ compact: true
68
+ }, {
69
+ loading: true,
70
+ variant: 'negative'
71
+ }, {
72
+ loading: true,
73
+ variant: 'negative',
74
+ compact: true
47
75
  }, {
48
76
  startIcon: 'backArrow'
49
77
  }, {
@@ -194,6 +222,38 @@ const ButtonScreen = () => {
194
222
  },
195
223
  children: "Hello world"
196
224
  })
225
+ }), /*#__PURE__*/_jsxs(Example, {
226
+ inline: true,
227
+ title: "Small",
228
+ children: [/*#__PURE__*/_jsxs(HStack, {
229
+ gap: 2,
230
+ children: [/*#__PURE__*/_jsx(Button, {
231
+ height: 32,
232
+ paddingY: 0,
233
+ children: "I am a button"
234
+ }), /*#__PURE__*/_jsx(Button, {
235
+ loading: true,
236
+ height: 32,
237
+ paddingY: 0,
238
+ children: "I am a button"
239
+ })]
240
+ }), /*#__PURE__*/_jsxs(HStack, {
241
+ gap: 2,
242
+ children: [/*#__PURE__*/_jsx(Button, {
243
+ compact: true,
244
+ height: 24,
245
+ paddingY: 0,
246
+ progressCircleSize: 16,
247
+ children: "I am a button"
248
+ }), /*#__PURE__*/_jsx(Button, {
249
+ compact: true,
250
+ loading: true,
251
+ height: 24,
252
+ paddingY: 0,
253
+ progressCircleSize: 16,
254
+ children: "I am a button"
255
+ })]
256
+ })]
197
257
  })]
198
258
  });
199
259
  };
@@ -2,7 +2,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React from 'react';
3
3
  import { names } from '@coinbase/cds-icons/names';
4
4
  import { Example, ExampleScreen } from '../../examples/ExampleScreen';
5
- import { HStack } from '../../layout';
5
+ import { HStack, VStack } from '../../layout';
6
6
  import { Box } from '../../layout/Box';
7
7
  import { Text } from '../../typography/Text';
8
8
  import { IconButton } from '../IconButton';
@@ -123,6 +123,20 @@ const IconButtonScreen = () => {
123
123
  font: "body",
124
124
  children: "Disabled secondary"
125
125
  })]
126
+ }), /*#__PURE__*/_jsxs(Box, {
127
+ alignItems: "center",
128
+ flexDirection: "row",
129
+ justifyContent: "space-between",
130
+ width: 350,
131
+ children: [/*#__PURE__*/_jsx(IconButton, {
132
+ loading: true,
133
+ accessibilityLabel: accessibilityLabel,
134
+ name: iconName,
135
+ variant: "primary"
136
+ }), /*#__PURE__*/_jsx(Text, {
137
+ font: "body",
138
+ children: "Loading primary"
139
+ })]
126
140
  })]
127
141
  }), /*#__PURE__*/_jsx(Example, {
128
142
  inline: true,
@@ -168,6 +182,107 @@ const IconButtonScreen = () => {
168
182
  })]
169
183
  })
170
184
  })
185
+ }), /*#__PURE__*/_jsx(Example, {
186
+ inline: true,
187
+ title: "Loading",
188
+ children: /*#__PURE__*/_jsxs(VStack, {
189
+ gap: 3,
190
+ children: [/*#__PURE__*/_jsxs(Box, {
191
+ children: [/*#__PURE__*/_jsx(Text, {
192
+ font: "label2",
193
+ style: {
194
+ marginBottom: 8
195
+ },
196
+ children: "Loading by variant"
197
+ }), /*#__PURE__*/_jsxs(HStack, {
198
+ flexWrap: "wrap",
199
+ gap: 2,
200
+ children: [/*#__PURE__*/_jsx(IconButton, {
201
+ loading: true,
202
+ accessibilityLabel: "Loading",
203
+ name: iconName,
204
+ variant: "primary"
205
+ }), /*#__PURE__*/_jsx(IconButton, {
206
+ loading: true,
207
+ accessibilityLabel: "Loading",
208
+ name: iconName,
209
+ variant: "secondary"
210
+ }), /*#__PURE__*/_jsx(IconButton, {
211
+ loading: true,
212
+ accessibilityLabel: "Loading",
213
+ name: iconName,
214
+ variant: "foregroundMuted"
215
+ }), /*#__PURE__*/_jsx(IconButton, {
216
+ loading: true,
217
+ transparent: true,
218
+ accessibilityLabel: "Loading",
219
+ name: iconName,
220
+ variant: "primary"
221
+ }), /*#__PURE__*/_jsx(IconButton, {
222
+ loading: true,
223
+ transparent: true,
224
+ accessibilityLabel: "Loading",
225
+ name: iconName,
226
+ variant: "secondary"
227
+ })]
228
+ })]
229
+ }), /*#__PURE__*/_jsxs(Box, {
230
+ children: [/*#__PURE__*/_jsx(Text, {
231
+ font: "label2",
232
+ style: {
233
+ marginBottom: 8
234
+ },
235
+ children: "Loading by icon size"
236
+ }), /*#__PURE__*/_jsxs(HStack, {
237
+ alignItems: "center",
238
+ gap: 2,
239
+ children: [/*#__PURE__*/_jsx(IconButton, {
240
+ loading: true,
241
+ accessibilityLabel: "Loading",
242
+ iconSize: "xs",
243
+ name: iconName
244
+ }), /*#__PURE__*/_jsx(IconButton, {
245
+ loading: true,
246
+ accessibilityLabel: "Loading",
247
+ iconSize: "s",
248
+ name: iconName
249
+ }), /*#__PURE__*/_jsx(IconButton, {
250
+ loading: true,
251
+ accessibilityLabel: "Loading",
252
+ iconSize: "m",
253
+ name: iconName
254
+ }), /*#__PURE__*/_jsx(IconButton, {
255
+ loading: true,
256
+ accessibilityLabel: "Loading",
257
+ compact: false,
258
+ iconSize: "l",
259
+ name: iconName
260
+ })]
261
+ })]
262
+ }), /*#__PURE__*/_jsxs(Box, {
263
+ children: [/*#__PURE__*/_jsx(Text, {
264
+ font: "label2",
265
+ style: {
266
+ marginBottom: 8
267
+ },
268
+ children: "Loading compact vs regular"
269
+ }), /*#__PURE__*/_jsxs(HStack, {
270
+ alignItems: "center",
271
+ gap: 2,
272
+ children: [/*#__PURE__*/_jsx(IconButton, {
273
+ compact: true,
274
+ loading: true,
275
+ accessibilityLabel: "Loading",
276
+ name: iconName
277
+ }), /*#__PURE__*/_jsx(IconButton, {
278
+ loading: true,
279
+ accessibilityLabel: "Loading",
280
+ compact: false,
281
+ name: iconName
282
+ })]
283
+ })]
284
+ })]
285
+ })
171
286
  }), /*#__PURE__*/_jsx(Example, {
172
287
  title: "All",
173
288
  children: names.map(name => {
@@ -207,6 +322,38 @@ const IconButtonScreen = () => {
207
322
  }), variant.title]
208
323
  }, index);
209
324
  })
325
+ }), /*#__PURE__*/_jsxs(Example, {
326
+ inline: true,
327
+ title: "Small",
328
+ children: [/*#__PURE__*/_jsx(IconButton, {
329
+ accessibilityLabel: accessibilityLabel,
330
+ height: 32,
331
+ name: iconName,
332
+ onPress: onPress,
333
+ width: 32
334
+ }), /*#__PURE__*/_jsx(IconButton, {
335
+ loading: true,
336
+ accessibilityLabel: accessibilityLabel,
337
+ height: 32,
338
+ name: iconName,
339
+ onPress: onPress,
340
+ width: 32
341
+ }), /*#__PURE__*/_jsx(IconButton, {
342
+ compact: true,
343
+ accessibilityLabel: accessibilityLabel,
344
+ height: 24,
345
+ name: iconName,
346
+ onPress: onPress,
347
+ width: 24
348
+ }), /*#__PURE__*/_jsx(IconButton, {
349
+ compact: true,
350
+ loading: true,
351
+ accessibilityLabel: accessibilityLabel,
352
+ height: 24,
353
+ name: iconName,
354
+ onPress: onPress,
355
+ width: 24
356
+ })]
210
357
  })]
211
358
  });
212
359
  };
package/esm/cards/Card.js CHANGED
@@ -39,6 +39,11 @@ const getBorderRadiusPinStyle = borderRadius => ({
39
39
  },
40
40
  all: {}
41
41
  });
42
+
43
+ /**
44
+ * @deprecated Use ContentCard instead. This will be removed in a future major release.
45
+ * @deprecationExpectedRemoval v10
46
+ */
42
47
  export const Card = /*#__PURE__*/memo(function OldCard(_ref) {
43
48
  let {
44
49
  children,
@@ -31,6 +31,11 @@ const CardBodyAction = /*#__PURE__*/memo(function CardBodyAction(_ref) {
31
31
  children: children
32
32
  }));
33
33
  });
34
+
35
+ /**
36
+ * @deprecated Use ContentCardBody instead. This will be removed in a future major release.
37
+ * @deprecationExpectedRemoval v10
38
+ */
34
39
  export const CardBody = /*#__PURE__*/memo(function CardBody(_ref2) {
35
40
  var _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _props$maxWidth, _props$minHeight;
36
41
  let {
@@ -5,6 +5,10 @@ import React, { memo } from 'react';
5
5
  import { gutter } from '@coinbase/cds-common/tokens/sizing';
6
6
  import { HStack } from '../layout/HStack';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ /**
9
+ * @deprecated Use ContentCardFooter instead. This will be removed in a future major release.
10
+ * @deprecationExpectedRemoval v10
11
+ */
8
12
  export const CardFooter = /*#__PURE__*/memo(function CardFooter(_ref) {
9
13
  let {
10
14
  children,
@@ -5,7 +5,21 @@ import React, { forwardRef, memo } from 'react';
5
5
  import { gutter } from '@coinbase/cds-common/tokens/sizing';
6
6
  import { Divider } from '../layout/Divider';
7
7
  import { Group } from '../layout/Group';
8
+
9
+ /**
10
+ * @deprecated Use `Box`, `HStack` or `VStack` instead. This will be removed in a future major release.
11
+ * @deprecationExpectedRemoval v10
12
+ */
13
+
14
+ /**
15
+ * @deprecated Use `Box`, `HStack` or `VStack` instead. This will be removed in a future major release.
16
+ * @deprecationExpectedRemoval v10
17
+ */
8
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
+ /**
20
+ * @deprecated Use `Box`, `HStack` or `VStack` instead. This will be removed in a future major release.
21
+ * @deprecationExpectedRemoval v10
22
+ */
9
23
  export const CardGroup = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function CardGroup(_ref, ref) {
10
24
  let {
11
25
  accessibilityLabel,
@@ -2,7 +2,16 @@ import React, { memo } from 'react';
2
2
  import { HStack } from '../layout/HStack';
3
3
  import { RemoteImage } from '../media/RemoteImage';
4
4
  import { Text } from '../typography/Text';
5
+
6
+ /**
7
+ * @deprecated Use ContentCardHeaderProps instead. This will be removed in a future major release.
8
+ * @deprecationExpectedRemoval v10
9
+ */
5
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ /**
12
+ * @deprecated Use ContentCardHeader instead. This will be removed in a future major release.
13
+ * @deprecationExpectedRemoval v10
14
+ */
6
15
  export const CardHeader = /*#__PURE__*/memo(_ref => {
7
16
  let {
8
17
  avatar,
@@ -5,6 +5,11 @@ import { memo } from 'react';
5
5
  import { defaultMediaDimension, defaultMediaSize, defaultPictogramMediaDimension } from '@coinbase/cds-common/tokens/card';
6
6
  import { Pictogram, SpotSquare } from '../illustrations';
7
7
  import { getSource, RemoteImage } from '../media/RemoteImage';
8
+
9
+ /**
10
+ * @deprecated Use SpotSquare when `type` is "spotSquare", Pictogram when `type` is "pictogram", or RemoteImage when `type` is "image". This will be removed in a future major release.
11
+ * @deprecationExpectedRemoval v10
12
+ */
8
13
  import { jsx as _jsx } from "react/jsx-runtime";
9
14
  const imageProps = {
10
15
  start: {
@@ -17,6 +22,11 @@ const imageProps = {
17
22
  },
18
23
  end: defaultMediaSize
19
24
  };
25
+
26
+ /**
27
+ * @deprecated Use SpotSquare when `type` is "spotSquare", Pictogram when `type` is "pictogram", or RemoteImage when `type` is "image". This will be removed in a future major release.
28
+ * @deprecationExpectedRemoval v10
29
+ */
20
30
  export const CardMedia = /*#__PURE__*/memo(function CardMedia(_ref) {
21
31
  var _props$alt;
22
32
  let {
@@ -4,6 +4,11 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
4
4
  import React, { memo } from 'react';
5
5
  import { ActivityIndicator } from 'react-native';
6
6
  import { useTheme } from '../hooks/useTheme';
7
+
8
+ /**
9
+ * @deprecated Use indeterminate ProgressCircle or ActivityIndicator component instead. This will be removed in a future major release.
10
+ * @deprecationExpectedRemoval v10
11
+ */
7
12
  import { jsx as _jsx } from "react/jsx-runtime";
8
13
  export const Spinner = /*#__PURE__*/memo(function Spinner(_ref) {
9
14
  let {
@@ -4,14 +4,14 @@ import { Example, ExampleScreen } from '../../examples/ExampleScreen';
4
4
  import { Alert } from '../Alert';
5
5
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const BasicAlert = () => {
7
- const [visible, setVisible] = useState(true);
7
+ const [visible, setVisible] = useState(false);
8
8
  const handleShow = useCallback(() => setVisible(true), []);
9
9
  const handleClose = useCallback(() => setVisible(false), []);
10
10
  const handleAction = useCallback(() => console.log('pressed'), []);
11
11
  return /*#__PURE__*/_jsxs(_Fragment, {
12
12
  children: [/*#__PURE__*/_jsx(Button, {
13
13
  onPress: handleShow,
14
- children: "Show Alert"
14
+ children: "Open"
15
15
  }), /*#__PURE__*/_jsx(Alert, {
16
16
  body: "Alert body type that can run over multiple lines, but should be kept short.",
17
17
  dismissActionLabel: "Cancel",
@@ -4,14 +4,14 @@ import { Example, ExampleScreen } from '../../examples/ExampleScreen';
4
4
  import { Alert } from '../Alert';
5
5
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const LongTitleAlert = () => {
7
- const [visible, setVisible] = useState(true);
7
+ const [visible, setVisible] = useState(false);
8
8
  const handleShow = useCallback(() => setVisible(true), []);
9
9
  const handleClose = useCallback(() => setVisible(false), []);
10
10
  const handleAction = useCallback(() => console.log('pressed'), []);
11
11
  return /*#__PURE__*/_jsxs(_Fragment, {
12
12
  children: [/*#__PURE__*/_jsx(Button, {
13
13
  onPress: handleShow,
14
- children: "Show Alert"
14
+ children: "Open"
15
15
  }), /*#__PURE__*/_jsx(Alert, {
16
16
  body: "Alert body type that can run over multiple lines, but should be kept short.",
17
17
  dismissActionLabel: "Cancel",
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { useAlert } from '@coinbase/cds-common/overlays/useAlert';
3
3
  import { useModal } from '@coinbase/cds-common/overlays/useModal';
4
4
  import { Button } from '../../buttons/Button';
@@ -48,17 +48,9 @@ const AlertOnModal = () => {
48
48
  })]
49
49
  }));
50
50
  }, [closeModal, openModal, showAlert]);
51
- useEffect(() => {
52
- handlePress();
53
- showAlert();
54
- return () => {
55
- close();
56
- closeModal();
57
- };
58
- }, [close, closeModal, handlePress, showAlert]);
59
51
  return /*#__PURE__*/_jsx(Button, {
60
52
  onPress: handlePress,
61
- children: "Open Modal"
53
+ children: "Open"
62
54
  });
63
55
  };
64
56
  const AlertOverModalScreen = () => {
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { useAlert } from '@coinbase/cds-common/overlays/useAlert';
3
3
  import { Button } from '../../buttons/Button';
4
4
  import { Example, ExampleScreen } from '../../examples/ExampleScreen';
@@ -27,13 +27,9 @@ const AlertExample = () => {
27
27
  preferredActionVariant: "negative",
28
28
  title: "Alert title"
29
29
  })), [open, close, handleAction]);
30
- useEffect(() => {
31
- showAlert();
32
- return () => close();
33
- }, [close, showAlert]);
34
30
  return /*#__PURE__*/_jsx(Button, {
35
31
  onPress: showAlert,
36
- children: "Show Alert"
32
+ children: "Open"
37
33
  });
38
34
  };
39
35
  const AlertPortalScreen = () => {
@@ -4,14 +4,14 @@ import { Example, ExampleScreen } from '../../examples/ExampleScreen';
4
4
  import { Alert } from '../Alert';
5
5
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const SingleActionAlert = () => {
7
- const [visible, setVisible] = useState(true);
7
+ const [visible, setVisible] = useState(false);
8
8
  const handleShow = useCallback(() => setVisible(true), []);
9
9
  const handleClose = useCallback(() => setVisible(false), []);
10
10
  const handleAction = useCallback(() => console.log('pressed'), []);
11
11
  return /*#__PURE__*/_jsxs(_Fragment, {
12
12
  children: [/*#__PURE__*/_jsx(Button, {
13
13
  onPress: handleShow,
14
- children: "Show Alert"
14
+ children: "Open"
15
15
  }), /*#__PURE__*/_jsx(Alert, {
16
16
  body: "Alert body type that can run over multiple lines, but should be kept short.",
17
17
  onPreferredActionPress: handleAction,
@@ -4,14 +4,14 @@ import { Example, ExampleScreen } from '../../examples/ExampleScreen';
4
4
  import { Alert } from '../Alert';
5
5
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const BasicAlert = () => {
7
- const [visible, setVisible] = useState(true);
7
+ const [visible, setVisible] = useState(false);
8
8
  const handleShow = useCallback(() => setVisible(true), []);
9
9
  const handleClose = useCallback(() => setVisible(false), []);
10
10
  const handleAction = useCallback(() => console.log('pressed'), []);
11
11
  return /*#__PURE__*/_jsxs(_Fragment, {
12
12
  children: [/*#__PURE__*/_jsx(Button, {
13
13
  onPress: handleShow,
14
- children: "Show Alert"
14
+ children: "Open"
15
15
  }), /*#__PURE__*/_jsx(Alert, {
16
16
  actionLayout: "vertical",
17
17
  body: "Alert body type that can run over multiple lines, but should be kept short.",
@@ -5,7 +5,10 @@ import { Fallback, Spacer, VStack } from '../../layout';
5
5
  import { Drawer } from '../drawer/Drawer';
6
6
  import { navOptions, SideDrawerContent } from './Drawers';
7
7
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
8
- const SidebarDrawerContentFallback = () => {
8
+ const SidebarDrawerContentFallback = _ref => {
9
+ let {
10
+ handleClose
11
+ } = _ref;
9
12
  return /*#__PURE__*/_jsxs(VStack, {
10
13
  height: "100%",
11
14
  justifyContent: "space-between",
@@ -30,28 +33,30 @@ const SidebarDrawerContentFallback = () => {
30
33
  height: 50,
31
34
  shape: "squircle",
32
35
  width: "100%"
33
- }), /*#__PURE__*/_jsx(Spacer, {}), navOptions.map(_ref => {
36
+ }), /*#__PURE__*/_jsx(Spacer, {}), navOptions.map(_ref2 => {
34
37
  let {
35
38
  label
36
- } = _ref;
39
+ } = _ref2;
37
40
  return /*#__PURE__*/_jsx(Fallback, {
38
41
  height: 30,
39
42
  shape: "square",
40
43
  width: "100%"
41
44
  }, label);
42
45
  })]
43
- }), /*#__PURE__*/_jsx(Fallback, {
44
- height: 50,
45
- shape: "squircle",
46
- width: "100%"
46
+ }), /*#__PURE__*/_jsx(Button, {
47
+ block: true,
48
+ compact: true,
49
+ onPress: handleClose,
50
+ variant: "secondary",
51
+ children: "Cancel"
47
52
  })]
48
53
  });
49
54
  };
50
- const SideDrawerWithFallback = _ref2 => {
55
+ const SideDrawerWithFallback = _ref3 => {
51
56
  let {
52
57
  pin = 'left'
53
- } = _ref2;
54
- const [isVisible, setIsVisible] = useState(true);
58
+ } = _ref3;
59
+ const [isVisible, setIsVisible] = useState(false);
55
60
  const setIsVisibleToOn = useCallback(() => setIsVisible(true), []);
56
61
  const setIsVisibleToOff = useCallback(() => setIsVisible(false), []);
57
62
  const [isLoading, setIsLoading] = useState(true);
@@ -68,11 +73,13 @@ const SideDrawerWithFallback = _ref2 => {
68
73
  }), isVisible && /*#__PURE__*/_jsx(Drawer, {
69
74
  onCloseComplete: setIsVisibleToOff,
70
75
  pin: pin,
71
- children: _ref3 => {
76
+ children: _ref4 => {
72
77
  let {
73
78
  handleClose
74
- } = _ref3;
75
- return isLoading ? /*#__PURE__*/_jsx(SidebarDrawerContentFallback, {}) : /*#__PURE__*/_jsx(SideDrawerContent, {
79
+ } = _ref4;
80
+ return isLoading ? /*#__PURE__*/_jsx(SidebarDrawerContentFallback, {
81
+ handleClose: handleClose
82
+ }) : /*#__PURE__*/_jsx(SideDrawerContent, {
76
83
  handleClose: handleClose
77
84
  });
78
85
  }
@@ -14,7 +14,7 @@ const SideDrawerScrollableContent = _ref => {
14
14
  let {
15
15
  pin = 'left'
16
16
  } = _ref;
17
- const [isVisible, setIsVisible] = useState(true);
17
+ const [isVisible, setIsVisible] = useState(false);
18
18
  const setIsVisibleToOn = useCallback(() => setIsVisible(true), []);
19
19
  const setIsVisibleToOff = useCallback(() => setIsVisible(false), []);
20
20
  const drawerRef = useRef(null);
@@ -65,6 +65,13 @@ const SideDrawerScrollableContent = _ref => {
65
65
  data: lotsOfOptions,
66
66
  renderItem: renderItem
67
67
  })
68
+ }), /*#__PURE__*/_jsx(VStack, {
69
+ padding: 2,
70
+ children: /*#__PURE__*/_jsx(Button, {
71
+ onPress: handleOptionPress,
72
+ variant: "secondary",
73
+ children: "Cancel"
74
+ })
68
75
  })]
69
76
  })]
70
77
  });