@coinbase/cds-mobile 8.58.0 → 8.60.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 (62) hide show
  1. package/CHANGELOG.md +12 -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/controls/Checkbox.d.ts +6 -1
  8. package/dts/controls/Checkbox.d.ts.map +1 -1
  9. package/dts/controls/CheckboxCell.d.ts +1 -1
  10. package/dts/controls/CheckboxCell.d.ts.map +1 -1
  11. package/dts/controls/Control.d.ts +11 -0
  12. package/dts/controls/Control.d.ts.map +1 -1
  13. package/dts/controls/InputIconButton.d.ts +1 -1
  14. package/dts/controls/Radio.d.ts +11 -1
  15. package/dts/controls/Radio.d.ts.map +1 -1
  16. package/dts/controls/RadioCell.d.ts +1 -1
  17. package/dts/controls/RadioCell.d.ts.map +1 -1
  18. package/dts/controls/Switch.d.ts +1 -1
  19. package/dts/controls/Switch.d.ts.map +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 +10 -5
  29. package/esm/buttons/DefaultSlideButtonHandle.js +7 -6
  30. package/esm/buttons/IconButton.js +18 -8
  31. package/esm/buttons/__stories__/Button.stories.js +28 -0
  32. package/esm/buttons/__stories__/IconButton.stories.js +116 -1
  33. package/esm/controls/Checkbox.js +3 -2
  34. package/esm/controls/CheckboxCell.js +3 -1
  35. package/esm/controls/Control.js +7 -3
  36. package/esm/controls/Radio.js +7 -3
  37. package/esm/loaders/Spinner.js +5 -0
  38. package/esm/overlays/__stories__/AlertBasic.stories.js +2 -2
  39. package/esm/overlays/__stories__/AlertLongTitle.stories.js +2 -2
  40. package/esm/overlays/__stories__/AlertOverModal.stories.js +2 -10
  41. package/esm/overlays/__stories__/AlertPortal.stories.js +2 -6
  42. package/esm/overlays/__stories__/AlertSingleAction.stories.js +2 -2
  43. package/esm/overlays/__stories__/AlertVerticalActions.stories.js +2 -2
  44. package/esm/overlays/__stories__/DrawerFallback.stories.js +20 -13
  45. package/esm/overlays/__stories__/DrawerScrollable.stories.js +8 -1
  46. package/esm/overlays/__stories__/Drawers.js +4 -4
  47. package/esm/overlays/__stories__/ModalBackButton.stories.js +2 -2
  48. package/esm/overlays/__stories__/ModalBasic.stories.js +2 -2
  49. package/esm/overlays/__stories__/ModalCustomPadding.stories.js +2 -2
  50. package/esm/overlays/__stories__/ModalLong.stories.js +2 -2
  51. package/esm/overlays/__stories__/ModalPortal.stories.js +2 -6
  52. package/esm/overlays/__stories__/Overlay.stories.js +2 -6
  53. package/esm/overlays/__stories__/TrayNavigation.stories.js +6 -2
  54. package/esm/overlays/__stories__/Trays.js +20 -11
  55. package/esm/sticky-footer/__stories__/StickyFooter.stories.js +2 -2
  56. package/esm/sticky-footer/__stories__/StickyFooterWithTray.stories.js +3 -3
  57. package/esm/visualizations/DefaultProgressCircleContent.js +1 -1
  58. package/esm/visualizations/ProgressBar.js +3 -3
  59. package/esm/visualizations/ProgressBarWithFloatLabel.js +19 -28
  60. package/esm/visualizations/ProgressCircle.js +80 -60
  61. package/esm/visualizations/__stories__/ProgressCircle.stories.js +63 -11
  62. package/package.json +3 -3
@@ -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 => {
@@ -22,11 +22,12 @@ const CheckboxIcon = /*#__PURE__*/memo(_ref => {
22
22
  elevation,
23
23
  animatedScaleValue,
24
24
  animatedOpacityValue,
25
- testID
25
+ testID,
26
+ controlSize
26
27
  } = _ref;
27
28
  const filled = checked || indeterminate;
28
29
  const theme = useTheme();
29
- const checkboxSize = theme.controlSize.checkboxSize;
30
+ const checkboxSize = controlSize != null ? controlSize : theme.controlSize.checkboxSize;
30
31
  const iconPadding = checkboxSize / 5;
31
32
  const iconSize = checkboxSize - iconPadding;
32
33
  const animatedStyle = useMemo(() => ({
@@ -1,4 +1,4 @@
1
- const _excluded = ["title", "description", "checked", "onChange", "disabled", "columnGap", "rowGap", "padding", "borderWidth", "borderRadius", "background", "borderColor", "controlColor", "accessibilityLabel", "accessibilityHint", "testID", "value", "width", "style", "contentStyle", "wrapperStyles", "onPressIn", "onPressOut", "pressedBorderColor", "pressedBorderWidth", "indeterminate", "readOnly", "styles"];
1
+ const _excluded = ["title", "description", "checked", "onChange", "disabled", "columnGap", "rowGap", "padding", "borderWidth", "borderRadius", "background", "borderColor", "controlColor", "controlSize", "accessibilityLabel", "accessibilityHint", "testID", "value", "width", "style", "contentStyle", "wrapperStyles", "onPressIn", "onPressOut", "pressedBorderColor", "pressedBorderWidth", "indeterminate", "readOnly", "styles"];
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, useCallback, useMemo, useState } from 'react';
@@ -26,6 +26,7 @@ const CheckboxCellWithRef = /*#__PURE__*/forwardRef(function CheckboxCell(_ref,
26
26
  background = 'bg',
27
27
  borderColor = 'bgLine',
28
28
  controlColor,
29
+ controlSize,
29
30
  accessibilityLabel,
30
31
  accessibilityHint,
31
32
  testID,
@@ -157,6 +158,7 @@ const CheckboxCellWithRef = /*#__PURE__*/forwardRef(function CheckboxCell(_ref,
157
158
  accessible: false,
158
159
  checked: !!checked,
159
160
  controlColor: controlColor,
161
+ controlSize: controlSize,
160
162
  disabled: disabled,
161
163
  indeterminate: indeterminate,
162
164
  pointerEvents: "none",
@@ -1,4 +1,4 @@
1
- const _excluded = ["testID", "label", "checked", "indeterminate", "disabled", "readOnly", "onChange", "hitSlop", "value", "controlColor", "elevation", "accessibilityRole", "accessibilityLabel", "accessibilityHint", "children", "shouldUseSwitchTransition", "accessible", "style", "color", "background", "borderColor", "borderRadius", "borderWidth"];
1
+ const _excluded = ["testID", "label", "checked", "indeterminate", "disabled", "readOnly", "onChange", "hitSlop", "value", "controlColor", "elevation", "accessibilityRole", "accessibilityLabel", "accessibilityHint", "children", "shouldUseSwitchTransition", "accessible", "style", "color", "background", "borderColor", "borderRadius", "borderWidth", "controlSize", "dotSize"];
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, useCallback, useEffect, useMemo, useRef } from 'react';
@@ -34,7 +34,9 @@ const ControlWithRef = /*#__PURE__*/forwardRef(function ControlWithRef(_ref, ref
34
34
  background,
35
35
  borderColor,
36
36
  borderRadius,
37
- borderWidth
37
+ borderWidth,
38
+ controlSize,
39
+ dotSize
38
40
  } = _ref,
39
41
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
40
42
  const theme = useTheme();
@@ -115,7 +117,9 @@ const ControlWithRef = /*#__PURE__*/forwardRef(function ControlWithRef(_ref, ref
115
117
  borderWidth: borderWidth,
116
118
  checked: checked,
117
119
  controlColor: controlColor,
120
+ controlSize: controlSize,
118
121
  disabled: pressDisabled,
122
+ dotSize: dotSize,
119
123
  elevation: elevation,
120
124
  indeterminate: indeterminate,
121
125
  pressed: pressed,
@@ -137,7 +141,7 @@ const ControlWithRef = /*#__PURE__*/forwardRef(function ControlWithRef(_ref, ref
137
141
  children: label
138
142
  })]
139
143
  });
140
- }, [ControlIcon, animatedOpacityValue, animatedScaleValue, background, borderColor, borderRadius, borderWidth, checked, controlColor, disabled, elevation, getLabelStyle, iconWrapperStyles, indeterminate, label, pressDisabled, readOnly, testID]);
144
+ }, [ControlIcon, animatedOpacityValue, animatedScaleValue, background, borderColor, borderRadius, borderWidth, checked, controlColor, controlSize, disabled, dotSize, elevation, getLabelStyle, iconWrapperStyles, indeterminate, label, pressDisabled, readOnly, testID]);
141
145
  return /*#__PURE__*/_jsx(Pressable, _extends({
142
146
  ref: ref,
143
147
  accessible: accessible
@@ -18,7 +18,8 @@ const styles = StyleSheet.create({
18
18
  const DotSvg = _ref => {
19
19
  let {
20
20
  color = 'black',
21
- width = 20
21
+ width = 20,
22
+ dotSize = 2 * width / 3
22
23
  } = _ref;
23
24
  return /*#__PURE__*/_jsx(Svg, {
24
25
  fill: "none",
@@ -29,7 +30,7 @@ const DotSvg = _ref => {
29
30
  cx: "50%",
30
31
  cy: "50%",
31
32
  fill: color,
32
- r: width / 3
33
+ r: dotSize / 2
33
34
  })
34
35
  });
35
36
  };
@@ -45,11 +46,13 @@ const RadioIcon = _ref2 => {
45
46
  animatedScaleValue,
46
47
  animatedOpacityValue,
47
48
  controlColor = 'bgPrimary',
49
+ controlSize,
50
+ dotSize,
48
51
  borderColor = checked ? controlColor : 'bgLineHeavy',
49
52
  testID
50
53
  } = _ref2;
51
54
  const theme = useTheme();
52
- const radioSize = theme.controlSize.radioSize;
55
+ const radioSize = controlSize != null ? controlSize : theme.controlSize.radioSize;
53
56
  return /*#__PURE__*/_jsx(Interactable, {
54
57
  background: background,
55
58
  borderColor: borderColor,
@@ -74,6 +77,7 @@ const RadioIcon = _ref2 => {
74
77
  testID: "radio-icon",
75
78
  children: /*#__PURE__*/_jsx(DotSvg, {
76
79
  color: theme.color[controlColor],
80
+ dotSize: dotSize,
77
81
  width: radioSize
78
82
  })
79
83
  })
@@ -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
  });
@@ -13,7 +13,7 @@ export const DefaultDrawer = _ref => {
13
13
  pin = 'left',
14
14
  reduceMotion
15
15
  } = _ref;
16
- const [isVisible, setIsVisible] = useState(true);
16
+ const [isVisible, setIsVisible] = useState(false);
17
17
  const setIsVisibleOff = useCallback(() => setIsVisible(false), [setIsVisible]);
18
18
  const setIsVisibleOn = useCallback(() => setIsVisible(true), [setIsVisible]);
19
19
  return /*#__PURE__*/_jsxs(_Fragment, {
@@ -33,7 +33,7 @@ export const DefaultDrawer = _ref => {
33
33
  children: [/*#__PURE__*/_jsx(LoremIpsum, {}), /*#__PURE__*/_jsx(Button, {
34
34
  onPress: handleClose,
35
35
  variant: "secondary",
36
- children: "Close Drawer"
36
+ children: "Cancel"
37
37
  })]
38
38
  });
39
39
  }
@@ -109,7 +109,7 @@ export const SideDrawerContent = _ref3 => {
109
109
  compact: true,
110
110
  onPress: handleClose,
111
111
  variant: "secondary",
112
- children: "Sign out"
112
+ children: "Cancel"
113
113
  })]
114
114
  });
115
115
  };
@@ -117,7 +117,7 @@ export const SideDrawer = _ref5 => {
117
117
  let {
118
118
  pin = 'left'
119
119
  } = _ref5;
120
- const [isVisible, setIsVisible] = useState(true);
120
+ const [isVisible, setIsVisible] = useState(false);
121
121
  const setIsVisibleOff = useCallback(() => setIsVisible(false), [setIsVisible]);
122
122
  const setIsVisibleOn = useCallback(() => setIsVisible(true), [setIsVisible]);
123
123
  return /*#__PURE__*/_jsxs(_Fragment, {
@@ -8,7 +8,7 @@ import { ModalFooter } from '../modal/ModalFooter';
8
8
  import { ModalHeader } from '../modal/ModalHeader';
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const ModalBackButtonScreen = () => {
11
- const [visible, setVisible] = useState(true);
11
+ const [visible, setVisible] = useState(false);
12
12
  const handleClose = useCallback(() => setVisible(false), []);
13
13
  const handleOpen = useCallback(() => setVisible(true), []);
14
14
  return /*#__PURE__*/_jsx(ExampleScreen, {
@@ -16,7 +16,7 @@ const ModalBackButtonScreen = () => {
16
16
  title: "Back Button Modal",
17
17
  children: [/*#__PURE__*/_jsx(Button, {
18
18
  onPress: handleOpen,
19
- children: "Open Modal"
19
+ children: "Open"
20
20
  }), /*#__PURE__*/_jsxs(Modal, {
21
21
  onRequestClose: handleClose,
22
22
  visible: visible,
@@ -8,7 +8,7 @@ import { ModalFooter } from '../modal/ModalFooter';
8
8
  import { ModalHeader } from '../modal/ModalHeader';
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const ModalBasicScreen = () => {
11
- const [visible, setVisible] = useState(true);
11
+ const [visible, setVisible] = useState(false);
12
12
  const handleClose = useCallback(() => setVisible(false), []);
13
13
  const handleOpen = useCallback(() => setVisible(true), []);
14
14
  return /*#__PURE__*/_jsx(ExampleScreen, {
@@ -16,7 +16,7 @@ const ModalBasicScreen = () => {
16
16
  title: "Basic Modal",
17
17
  children: [/*#__PURE__*/_jsx(Button, {
18
18
  onPress: handleOpen,
19
- children: "Open Modal"
19
+ children: "Open"
20
20
  }), /*#__PURE__*/_jsxs(Modal, {
21
21
  onRequestClose: handleClose,
22
22
  visible: visible,
@@ -8,7 +8,7 @@ import { ModalFooter } from '../modal/ModalFooter';
8
8
  import { ModalHeader } from '../modal/ModalHeader';
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  export default function ModalCustomPaddingScreen() {
11
- const [visible, setVisible] = useState(true);
11
+ const [visible, setVisible] = useState(false);
12
12
  const handleClose = useCallback(() => setVisible(false), []);
13
13
  const handleOpen = useCallback(() => setVisible(true), []);
14
14
  return /*#__PURE__*/_jsx(ExampleScreen, {
@@ -16,7 +16,7 @@ export default function ModalCustomPaddingScreen() {
16
16
  title: "Modal with custom padding",
17
17
  children: [/*#__PURE__*/_jsx(Button, {
18
18
  onPress: handleOpen,
19
- children: "Open Modal"
19
+ children: "Open"
20
20
  }), /*#__PURE__*/_jsxs(Modal, {
21
21
  onRequestClose: handleClose,
22
22
  visible: visible,
@@ -9,7 +9,7 @@ import { ModalFooter } from '../modal/ModalFooter';
9
9
  import { ModalHeader } from '../modal/ModalHeader';
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const ModalLongScreen = () => {
12
- const [visible, setVisible] = useState(true);
12
+ const [visible, setVisible] = useState(false);
13
13
  const handleClose = useCallback(() => setVisible(false), []);
14
14
  const handleOpen = useCallback(() => setVisible(true), []);
15
15
  return /*#__PURE__*/_jsx(ExampleScreen, {
@@ -17,7 +17,7 @@ const ModalLongScreen = () => {
17
17
  title: "Long Modal",
18
18
  children: [/*#__PURE__*/_jsx(Button, {
19
19
  onPress: handleOpen,
20
- children: "Open Modal"
20
+ children: "Open"
21
21
  }), /*#__PURE__*/_jsxs(Modal, {
22
22
  onRequestClose: handleClose,
23
23
  visible: visible,
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect } from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { useModal } from '@coinbase/cds-common/overlays/useModal';
3
3
  import { Button } from '../../buttons/Button';
4
4
  import { Example, ExampleScreen } from '../../examples/ExampleScreen';
@@ -33,16 +33,12 @@ const ModalPortalScreen = () => {
33
33
  })
34
34
  })]
35
35
  })), [openModal, closeModal]);
36
- useEffect(() => {
37
- handlePress();
38
- return () => closeModal();
39
- }, [closeModal, handlePress]);
40
36
  return /*#__PURE__*/_jsx(ExampleScreen, {
41
37
  children: /*#__PURE__*/_jsx(Example, {
42
38
  title: "Portal Modal",
43
39
  children: /*#__PURE__*/_jsx(Button, {
44
40
  onPress: handlePress,
45
- children: "Open Modal"
41
+ children: "Open"
46
42
  })
47
43
  })
48
44
  });
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect, useState } from 'react';
1
+ import React, { useCallback, useState } from 'react';
2
2
  import { Modal } from 'react-native';
3
3
  import { Button } from '../../buttons/Button';
4
4
  import { Example, ExampleScreen } from '../../examples/ExampleScreen';
@@ -22,15 +22,11 @@ const OverlayScreen = () => {
22
22
  if (finished) setVisibleToOff();
23
23
  });
24
24
  }, [animateOverlayOut, setVisibleToOff]);
25
- useEffect(() => {
26
- openModal();
27
- return () => closeModal();
28
- }, [closeModal, openModal]);
29
25
  return /*#__PURE__*/_jsx(ExampleScreen, {
30
26
  children: /*#__PURE__*/_jsxs(Example, {
31
27
  children: [/*#__PURE__*/_jsx(Button, {
32
28
  onPress: openModal,
33
- children: "Open Overlay"
29
+ children: "Open"
34
30
  }), /*#__PURE__*/_jsx(Modal, {
35
31
  hardwareAccelerated: true,
36
32
  statusBarTranslucent: true,