@coinbase/cds-mobile 8.53.1 → 8.55.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 (41) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +5 -2
  3. package/dts/buttons/IconButton.d.ts +23 -1
  4. package/dts/buttons/IconButton.d.ts.map +1 -1
  5. package/dts/controls/InputIconButton.d.ts +22 -1
  6. package/dts/controls/InputIconButton.d.ts.map +1 -1
  7. package/dts/dates/Calendar.d.ts +170 -0
  8. package/dts/dates/Calendar.d.ts.map +1 -0
  9. package/dts/dates/DateInput.d.ts +2 -2
  10. package/dts/dates/DateInput.d.ts.map +1 -1
  11. package/dts/dates/DatePicker.d.ts +136 -67
  12. package/dts/dates/DatePicker.d.ts.map +1 -1
  13. package/dts/overlays/drawer/Drawer.d.ts +12 -0
  14. package/dts/overlays/drawer/Drawer.d.ts.map +1 -1
  15. package/dts/overlays/drawer/useDrawerSpacing.d.ts +4 -1
  16. package/dts/overlays/drawer/useDrawerSpacing.d.ts.map +1 -1
  17. package/dts/overlays/tooltip/Tooltip.d.ts +9 -1
  18. package/dts/overlays/tooltip/Tooltip.d.ts.map +1 -1
  19. package/dts/overlays/tray/Tray.d.ts +3 -0
  20. package/dts/overlays/tray/Tray.d.ts.map +1 -1
  21. package/dts/sticky-footer/StickyFooter.d.ts.map +1 -1
  22. package/esm/buttons/IconButton.js +4 -3
  23. package/esm/controls/InputIconButton.js +4 -3
  24. package/esm/dates/Calendar.js +346 -0
  25. package/esm/dates/DateInput.js +3 -1
  26. package/esm/dates/DatePicker.js +116 -39
  27. package/esm/dates/__stories__/Calendar.stories.js +360 -0
  28. package/esm/dates/__stories__/DatePicker.stories.js +51 -25
  29. package/esm/overlays/__stories__/TrayAction.stories.js +20 -21
  30. package/esm/overlays/__stories__/TrayInformational.stories.js +40 -43
  31. package/esm/overlays/__stories__/TrayMessaging.stories.js +36 -37
  32. package/esm/overlays/__stories__/TrayPromotional.stories.js +51 -74
  33. package/esm/overlays/__stories__/TrayRedesign.stories.js +5 -12
  34. package/esm/overlays/__stories__/Trays.js +1 -0
  35. package/esm/overlays/drawer/Drawer.js +9 -13
  36. package/esm/overlays/drawer/useDrawerSpacing.js +11 -8
  37. package/esm/overlays/tooltip/Tooltip.js +7 -2
  38. package/esm/overlays/tray/Tray.js +5 -0
  39. package/esm/sticky-footer/StickyFooter.js +4 -2
  40. package/esm/sticky-footer/__stories__/StickyFooterWithTray.stories.js +37 -42
  41. package/package.json +2 -4
@@ -1,4 +1,6 @@
1
+ const _excluded = ["date"];
1
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
+ 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; }
2
4
  import { useState } from 'react';
3
5
  import { InputLabel } from '../../controls/InputLabel';
4
6
  import { TextInput } from '../../controls/TextInput';
@@ -10,23 +12,25 @@ import { Tooltip } from '../../overlays/tooltip/Tooltip';
10
12
  import { Text } from '../../typography/Text';
11
13
  import { DatePicker } from '../DatePicker';
12
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- const today = new Date(new Date(2024, 7, 18).setHours(0, 0, 0, 0));
15
+ const today = new Date(new Date().setHours(0, 0, 0, 0));
14
16
  const nextMonth15th = new Date(today.getFullYear(), today.getMonth() + 1, 15);
15
- const lastMonth15th = new Date(today.getFullYear(), today.getMonth() - 1, 15);
17
+ const tomorrow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
16
18
  const exampleProps = {
17
- maxDate: nextMonth15th,
18
- minDate: lastMonth15th,
19
19
  invalidDateError: 'Please enter a valid date',
20
20
  disabledDateError: 'Date unavailable',
21
21
  requiredError: 'This field is required'
22
22
  };
23
- const ExampleDatePicker = props => {
24
- const [date, setDate] = useState(null);
23
+ const ExampleDatePicker = _ref => {
24
+ let {
25
+ date
26
+ } = _ref,
27
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
28
+ const [dateValue, setDateValue] = useState(date != null ? date : null);
25
29
  const [error, setError] = useState(null);
26
30
  return /*#__PURE__*/_jsx(DatePicker, _extends({}, exampleProps, props, {
27
- date: date,
31
+ date: dateValue,
28
32
  error: error,
29
- onChangeDate: setDate,
33
+ onChangeDate: setDateValue,
30
34
  onErrorDate: setError
31
35
  }));
32
36
  };
@@ -36,20 +40,20 @@ export const FullExample = () => {
36
40
  title: "Default",
37
41
  children: /*#__PURE__*/_jsx(ExampleDatePicker, {
38
42
  required: true,
39
- calendarIconButtonAccessibilityLabel: "Birthdate calendar",
40
- label: "Birthdate"
43
+ label: "Birthdate",
44
+ openCalendarAccessibilityLabel: "Birthdate calendar"
41
45
  })
42
46
  }), /*#__PURE__*/_jsx(Example, {
43
47
  title: "Multiple pickers",
44
48
  children: /*#__PURE__*/_jsxs(HStack, {
45
49
  gap: 2,
46
50
  children: [/*#__PURE__*/_jsx(ExampleDatePicker, {
47
- calendarIconButtonAccessibilityLabel: "Example 1 calendar",
48
51
  label: "Example 1",
52
+ openCalendarAccessibilityLabel: "Example 1 calendar",
49
53
  width: "auto"
50
54
  }), /*#__PURE__*/_jsx(ExampleDatePicker, {
51
- calendarIconButtonAccessibilityLabel: "Example 2 calendar",
52
55
  label: "Example 2",
56
+ openCalendarAccessibilityLabel: "Example 2 calendar",
53
57
  width: "auto"
54
58
  })]
55
59
  })
@@ -62,8 +66,8 @@ export const FullExample = () => {
62
66
  placeholder: "1",
63
67
  width: "auto"
64
68
  }), /*#__PURE__*/_jsx(ExampleDatePicker, {
65
- calendarIconButtonAccessibilityLabel: "Example calendar",
66
69
  label: "Example Date",
70
+ openCalendarAccessibilityLabel: "Example calendar",
67
71
  width: "auto"
68
72
  })]
69
73
  })
@@ -76,8 +80,8 @@ export const FullExample = () => {
76
80
  placeholder: "1",
77
81
  width: "50%"
78
82
  }), /*#__PURE__*/_jsx(ExampleDatePicker, {
79
- calendarIconButtonAccessibilityLabel: "Example calendar",
80
83
  label: "Example Date",
84
+ openCalendarAccessibilityLabel: "Example calendar",
81
85
  width: "auto"
82
86
  })]
83
87
  })
@@ -85,7 +89,6 @@ export const FullExample = () => {
85
89
  title: "DatePicker with labelNode",
86
90
  children: /*#__PURE__*/_jsx(ExampleDatePicker, {
87
91
  accessibilityLabel: "Birthdate",
88
- calendarIconButtonAccessibilityLabel: "Birthdate calendar",
89
92
  labelNode: /*#__PURE__*/_jsxs(HStack, {
90
93
  alignItems: "center",
91
94
  children: [/*#__PURE__*/_jsx(InputLabel, {
@@ -100,7 +103,8 @@ export const FullExample = () => {
100
103
  size: "xs"
101
104
  })
102
105
  })]
103
- })
106
+ }),
107
+ openCalendarAccessibilityLabel: "Birthdate calendar"
104
108
  })
105
109
  }), /*#__PURE__*/_jsx(Example, {
106
110
  title: "DatePicker fit-content width",
@@ -108,19 +112,41 @@ export const FullExample = () => {
108
112
  flexWrap: "wrap",
109
113
  gap: 2,
110
114
  children: [/*#__PURE__*/_jsx(ExampleDatePicker, {
111
- calendarIconButtonAccessibilityLabel: "Example calendar",
112
115
  label: "Example Date",
116
+ openCalendarAccessibilityLabel: "Example calendar",
113
117
  width: "fit-content"
114
118
  }), /*#__PURE__*/_jsx(ExampleDatePicker, {
115
- calendarIconButtonAccessibilityLabel: "Example calendar 2",
116
119
  label: "Example Date 2",
120
+ openCalendarAccessibilityLabel: "Example calendar 2",
117
121
  width: "fit-content"
118
122
  }), /*#__PURE__*/_jsx(ExampleDatePicker, {
119
- calendarIconButtonAccessibilityLabel: "Example calendar 3",
120
123
  label: "Example Date 3",
124
+ openCalendarAccessibilityLabel: "Example calendar 3",
121
125
  width: "fit-content"
122
126
  })]
123
127
  })
128
+ }), /*#__PURE__*/_jsx(Example, {
129
+ title: "DatePicker with seed date (next month)",
130
+ children: /*#__PURE__*/_jsx(ExampleDatePicker, {
131
+ label: "Event date",
132
+ openCalendarAccessibilityLabel: "Seed date calendar",
133
+ seedDate: nextMonth15th
134
+ })
135
+ }), /*#__PURE__*/_jsx(Example, {
136
+ title: "DatePicker with pre-selected date (next month)",
137
+ children: /*#__PURE__*/_jsx(ExampleDatePicker, {
138
+ date: nextMonth15th,
139
+ label: "Event date",
140
+ openCalendarAccessibilityLabel: "Seed date calendar"
141
+ })
142
+ }), /*#__PURE__*/_jsx(Example, {
143
+ title: "DatePicker with minimum date of tomorrow",
144
+ children: /*#__PURE__*/_jsx(ExampleDatePicker, {
145
+ disabledDateError: "Future dates only",
146
+ invalidDateError: "Future dates only",
147
+ label: "Future date",
148
+ minDate: tomorrow
149
+ })
124
150
  })]
125
151
  });
126
152
  };
@@ -132,7 +158,6 @@ export const CustomLabel = () => {
132
158
  gap: 2,
133
159
  children: [/*#__PURE__*/_jsx(ExampleDatePicker, {
134
160
  accessibilityLabel: "Date of birth",
135
- calendarIconButtonAccessibilityLabel: "Date of birth calendar",
136
161
  labelNode: /*#__PURE__*/_jsxs(HStack, {
137
162
  alignItems: "center",
138
163
  children: [/*#__PURE__*/_jsx(InputLabel, {
@@ -147,11 +172,11 @@ export const CustomLabel = () => {
147
172
  size: "xs"
148
173
  })
149
174
  })]
150
- })
175
+ }),
176
+ openCalendarAccessibilityLabel: "Date of birth calendar"
151
177
  }), /*#__PURE__*/_jsx(ExampleDatePicker, {
152
178
  compact: true,
153
179
  accessibilityLabel: "Start date",
154
- calendarIconButtonAccessibilityLabel: "Start date calendar",
155
180
  labelNode: /*#__PURE__*/_jsxs(HStack, {
156
181
  alignItems: "center",
157
182
  gap: 0.5,
@@ -162,10 +187,10 @@ export const CustomLabel = () => {
162
187
  font: "label1",
163
188
  children: "*"
164
189
  })]
165
- })
190
+ }),
191
+ openCalendarAccessibilityLabel: "Start date calendar"
166
192
  }), /*#__PURE__*/_jsx(ExampleDatePicker, {
167
193
  accessibilityLabel: "End date",
168
- calendarIconButtonAccessibilityLabel: "End date calendar",
169
194
  labelNode: /*#__PURE__*/_jsxs(HStack, {
170
195
  alignItems: "center",
171
196
  gap: 1,
@@ -178,7 +203,8 @@ export const CustomLabel = () => {
178
203
  children: "(optional)"
179
204
  })]
180
205
  }),
181
- labelVariant: "inside"
206
+ labelVariant: "inside",
207
+ openCalendarAccessibilityLabel: "End date calendar"
182
208
  })]
183
209
  })
184
210
  })
@@ -1,7 +1,7 @@
1
1
  const _excluded = ["media"];
2
2
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
- import React, { useCallback, useRef, useState } from 'react';
4
+ import { useCallback, useRef, useState } from 'react';
5
5
  import { FlatList } from 'react-native';
6
6
  import { assets } from '@coinbase/cds-common/internal/data/assets';
7
7
  import { Button } from '../../buttons/Button';
@@ -12,7 +12,7 @@ import { SectionHeader } from '../../section-header/SectionHeader';
12
12
  import { StickyFooter } from '../../sticky-footer/StickyFooter';
13
13
  import { Link } from '../../typography/Link';
14
14
  import { Text } from '../../typography/Text';
15
- import { Tray, TrayStickyFooter } from '../tray/Tray';
15
+ import { Tray } from '../tray/Tray';
16
16
  import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
17
17
  const defaultOptions = [{
18
18
  title: 'Ethereum',
@@ -142,6 +142,19 @@ export const WithStickyFooter = () => {
142
142
  }), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
143
143
  ref: trayRef,
144
144
  disableCapturePanGestureToDismiss: true,
145
+ footer: _ref3 => {
146
+ let {
147
+ handleClose
148
+ } = _ref3;
149
+ return /*#__PURE__*/_jsx(StickyFooter, {
150
+ paddingX: 3,
151
+ children: /*#__PURE__*/_jsx(Button, {
152
+ block: true,
153
+ onPress: handleClose,
154
+ children: "Button"
155
+ })
156
+ });
157
+ },
145
158
  handleBarAccessibilityLabel: "Dismiss",
146
159
  onCloseComplete: setIsTrayVisibleToFalse,
147
160
  onVisibilityChange: handleTrayVisibilityChange,
@@ -149,25 +162,11 @@ export const WithStickyFooter = () => {
149
162
  paddingX: 3,
150
163
  title: "Section header"
151
164
  }),
152
- children: _ref3 => {
153
- let {
154
- handleClose
155
- } = _ref3;
156
- return /*#__PURE__*/_jsxs(TrayStickyFooter, {
157
- children: [/*#__PURE__*/_jsx(FlatList, {
158
- data: items,
159
- keyExtractor: handleKeyExtractor,
160
- renderItem: renderItem
161
- }), /*#__PURE__*/_jsx(StickyFooter, {
162
- paddingX: 3,
163
- children: /*#__PURE__*/_jsx(Button, {
164
- block: true,
165
- onPress: handleClose,
166
- children: "Button"
167
- })
168
- })]
169
- });
170
- }
165
+ children: /*#__PURE__*/_jsx(FlatList, {
166
+ data: items,
167
+ keyExtractor: handleKeyExtractor,
168
+ renderItem: renderItem
169
+ })
171
170
  })]
172
171
  });
173
172
  };
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useRef, useState } from 'react';
1
+ import { useCallback, useRef, useState } from 'react';
2
2
  import { Button } from '../../buttons/Button';
3
3
  import { Example, ExampleScreen } from '../../examples/ExampleScreen';
4
4
  import { HStack, VStack } from '../../layout';
@@ -6,7 +6,7 @@ import { SectionHeader } from '../../section-header/SectionHeader';
6
6
  import { StickyFooter } from '../../sticky-footer/StickyFooter';
7
7
  import { Text } from '../../typography/Text';
8
8
  import { ProgressBar } from '../../visualizations/ProgressBar';
9
- import { Tray, TrayStickyFooter } from '../tray/Tray';
9
+ import { Tray } from '../tray/Tray';
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  export const Default = () => {
12
12
  const [isTrayVisible, setIsTrayVisible] = useState(false);
@@ -22,50 +22,47 @@ export const Default = () => {
22
22
  children: "Open"
23
23
  }), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
24
24
  ref: trayRef,
25
- handleBarAccessibilityLabel: "Dismiss",
26
- onCloseComplete: setIsTrayVisibleToFalse,
27
- onVisibilityChange: handleTrayVisibilityChange,
28
- title: /*#__PURE__*/_jsx(SectionHeader, {
29
- paddingX: 3,
30
- title: "Trading activity"
31
- }),
32
- children: _ref => {
25
+ footer: _ref => {
33
26
  let {
34
27
  handleClose
35
28
  } = _ref;
36
- return /*#__PURE__*/_jsxs(TrayStickyFooter, {
37
- children: [/*#__PURE__*/_jsxs(VStack, {
38
- paddingBottom: 1,
39
- paddingX: 3,
40
- children: [/*#__PURE__*/_jsx(Text, {
41
- color: "fgMuted",
42
- font: "body",
43
- paddingBottom: 3,
44
- children: "The percentage of Coinbase customers who increased or decreased their net position in 00 over the past 24 hours through trading. What this means: Increased buying activity can signal that the asset is gaining popularity. Last updated on May 2, 2023."
45
- }), /*#__PURE__*/_jsx(Text, {
46
- font: "headline",
47
- children: "What this means:"
48
- }), /*#__PURE__*/_jsx(Text, {
49
- color: "fgMuted",
50
- font: "body",
51
- paddingBottom: 3,
52
- children: "Increased buying activity can signal that the asset is gaining popularity."
53
- }), /*#__PURE__*/_jsx(Text, {
54
- color: "fgMuted",
55
- font: "legal",
56
- children: "Last updated on May 2, 2023."
57
- })]
58
- }), /*#__PURE__*/_jsx(StickyFooter, {
59
- paddingX: 3,
60
- children: /*#__PURE__*/_jsx(Button, {
61
- block: true,
62
- onPress: handleClose,
63
- variant: "secondary",
64
- children: "Got it"
65
- })
66
- })]
29
+ return /*#__PURE__*/_jsx(StickyFooter, {
30
+ paddingX: 3,
31
+ children: /*#__PURE__*/_jsx(Button, {
32
+ block: true,
33
+ onPress: handleClose,
34
+ variant: "secondary",
35
+ children: "Got it"
36
+ })
67
37
  });
68
- }
38
+ },
39
+ handleBarAccessibilityLabel: "Dismiss",
40
+ handleBarVariant: "inside",
41
+ onCloseComplete: setIsTrayVisibleToFalse,
42
+ onVisibilityChange: handleTrayVisibilityChange,
43
+ title: "Trading activity",
44
+ children: /*#__PURE__*/_jsxs(VStack, {
45
+ paddingBottom: 1,
46
+ paddingX: 3,
47
+ children: [/*#__PURE__*/_jsx(Text, {
48
+ color: "fgMuted",
49
+ font: "body",
50
+ paddingBottom: 3,
51
+ children: "The percentage of Coinbase customers who increased or decreased their net position in 00 over the past 24 hours through trading. What this means: Increased buying activity can signal that the asset is gaining popularity. Last updated on May 2, 2023."
52
+ }), /*#__PURE__*/_jsx(Text, {
53
+ font: "headline",
54
+ children: "What this means:"
55
+ }), /*#__PURE__*/_jsx(Text, {
56
+ color: "fgMuted",
57
+ font: "body",
58
+ paddingBottom: 3,
59
+ children: "Increased buying activity can signal that the asset is gaining popularity."
60
+ }), /*#__PURE__*/_jsx(Text, {
61
+ color: "fgMuted",
62
+ font: "legal",
63
+ children: "Last updated on May 2, 2023."
64
+ })]
65
+ })
69
66
  })]
70
67
  });
71
68
  };
@@ -94,7 +91,7 @@ export const WithProgressBar = () => {
94
91
  let {
95
92
  handleClose
96
93
  } = _ref2;
97
- return /*#__PURE__*/_jsxs(TrayStickyFooter, {
94
+ return /*#__PURE__*/_jsxs(_Fragment, {
98
95
  children: [/*#__PURE__*/_jsxs(VStack, {
99
96
  paddingBottom: 1,
100
97
  paddingX: 3,
@@ -1,11 +1,11 @@
1
- import React, { useCallback, useRef, useState } from 'react';
1
+ import { useCallback, useRef, useState } from 'react';
2
2
  import { Button } from '../../buttons/Button';
3
3
  import { Example, ExampleScreen } from '../../examples/ExampleScreen';
4
4
  import { SpotSquare } from '../../illustrations';
5
5
  import { Box, VStack } from '../../layout';
6
6
  import { StickyFooter } from '../../sticky-footer/StickyFooter';
7
7
  import { Text } from '../../typography/Text';
8
- import { Tray, TrayStickyFooter } from '../tray/Tray';
8
+ import { Tray } from '../tray/Tray';
9
9
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
10
10
  export const Default = () => {
11
11
  const [isTrayVisible, setIsTrayVisible] = useState(false);
@@ -21,45 +21,44 @@ export const Default = () => {
21
21
  children: "Open"
22
22
  }), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
23
23
  ref: trayRef,
24
- handleBarAccessibilityLabel: "Dismiss",
25
- onCloseComplete: setIsTrayVisibleToFalse,
26
- onVisibilityChange: handleTrayVisibilityChange,
27
- children: _ref => {
24
+ footer: _ref => {
28
25
  let {
29
26
  handleClose
30
27
  } = _ref;
31
- return /*#__PURE__*/_jsxs(TrayStickyFooter, {
32
- children: [/*#__PURE__*/_jsxs(VStack, {
33
- paddingBottom: 1,
34
- paddingTop: 1,
35
- paddingX: 3,
36
- children: [/*#__PURE__*/_jsx(Box, {
37
- alignItems: "center",
38
- paddingBottom: 4,
39
- children: /*#__PURE__*/_jsx(SpotSquare, {
40
- name: "borrowWallet"
41
- })
42
- }), /*#__PURE__*/_jsx(Text, {
43
- align: "center",
44
- font: "title1",
45
- paddingBottom: 1,
46
- children: "You\u2019re ready to explore"
47
- }), /*#__PURE__*/_jsx(Text, {
48
- align: "center",
49
- color: "fgMuted",
50
- font: "body",
51
- children: "You don\u2019t have any dapps open right now. Here\u2019s one you might like: [dapp]"
52
- })]
53
- }), /*#__PURE__*/_jsx(StickyFooter, {
54
- paddingX: 3,
55
- children: /*#__PURE__*/_jsx(Button, {
56
- block: true,
57
- onPress: handleClose,
58
- children: "Button"
59
- })
60
- })]
28
+ return /*#__PURE__*/_jsx(StickyFooter, {
29
+ paddingX: 3,
30
+ children: /*#__PURE__*/_jsx(Button, {
31
+ block: true,
32
+ onPress: handleClose,
33
+ children: "Button"
34
+ })
61
35
  });
62
- }
36
+ },
37
+ handleBarAccessibilityLabel: "Dismiss",
38
+ onCloseComplete: setIsTrayVisibleToFalse,
39
+ onVisibilityChange: handleTrayVisibilityChange,
40
+ children: /*#__PURE__*/_jsxs(VStack, {
41
+ paddingBottom: 1,
42
+ paddingTop: 1,
43
+ paddingX: 3,
44
+ children: [/*#__PURE__*/_jsx(Box, {
45
+ alignItems: "center",
46
+ paddingBottom: 4,
47
+ children: /*#__PURE__*/_jsx(SpotSquare, {
48
+ name: "borrowWallet"
49
+ })
50
+ }), /*#__PURE__*/_jsx(Text, {
51
+ align: "center",
52
+ font: "title1",
53
+ paddingBottom: 1,
54
+ children: "You\u2019re ready to explore"
55
+ }), /*#__PURE__*/_jsx(Text, {
56
+ align: "center",
57
+ color: "fgMuted",
58
+ font: "body",
59
+ children: "You don\u2019t have any dapps open right now. Here\u2019s one you might like: [dapp]"
60
+ })]
61
+ })
63
62
  })]
64
63
  });
65
64
  };
@@ -1,13 +1,11 @@
1
1
  const _excluded = ["key"];
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, { memo, useCallback, useRef, useState } from 'react';
5
- import { Platform } from 'react-native';
6
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
+ import { memo, useCallback, useRef, useState } from 'react';
7
5
  import { Button } from '../../buttons/Button';
8
6
  import { ListCell } from '../../cells/ListCell';
9
7
  import { Example, ExampleScreen } from '../../examples/ExampleScreen';
10
- import { useDimensions } from '../../hooks/useDimensions';
8
+ import { useSafeBottomPadding } from '../../hooks/useSafeBottomPadding';
11
9
  import { Icon } from '../../icons';
12
10
  import { SpotRectangle } from '../../illustrations';
13
11
  import { Box, HStack, VStack } from '../../layout';
@@ -17,7 +15,7 @@ import { defaultTheme } from '../../themes/defaultTheme';
17
15
  import { Text } from '../../typography/Text';
18
16
  import { TextBody } from '../../typography/TextBody';
19
17
  import { TextTitle1 } from '../../typography/TextTitle1';
20
- import { Tray, TrayStickyFooter } from '../tray/Tray';
18
+ import { Tray } from '../tray/Tray';
21
19
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
22
20
  export const Default = () => {
23
21
  const [isTrayVisible, setIsTrayVisible] = useState(false);
@@ -33,45 +31,44 @@ export const Default = () => {
33
31
  children: "Open"
34
32
  }), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
35
33
  ref: trayRef,
36
- handleBarAccessibilityLabel: "Dismiss",
37
- onCloseComplete: setIsTrayVisibleToFalse,
38
- onVisibilityChange: handleTrayVisibilityChange,
39
- children: _ref => {
34
+ footer: _ref => {
40
35
  let {
41
36
  handleClose
42
37
  } = _ref;
43
- return /*#__PURE__*/_jsxs(TrayStickyFooter, {
44
- children: [/*#__PURE__*/_jsxs(VStack, {
45
- paddingBottom: 1,
46
- paddingTop: 1,
47
- paddingX: 3,
48
- children: [/*#__PURE__*/_jsx(Box, {
49
- alignItems: "center",
50
- paddingBottom: 3,
51
- children: /*#__PURE__*/_jsx(SpotRectangle, {
52
- name: "exploreDecentralizedApps"
53
- })
54
- }), /*#__PURE__*/_jsx(Text, {
55
- align: "center",
56
- font: "title1",
57
- paddingBottom: 2,
58
- children: "Earn crypto by lending, staking, and more"
59
- }), /*#__PURE__*/_jsx(Text, {
60
- align: "center",
61
- color: "fgMuted",
62
- font: "body",
63
- children: "Many decentralized apps (\u201Cdapps\u201D) let you earn yield on your crypto. Check out trusted dapps like Aave and Compound without leaving Coinbaes."
64
- })]
65
- }), /*#__PURE__*/_jsx(StickyFooter, {
66
- paddingX: 3,
67
- children: /*#__PURE__*/_jsx(Button, {
68
- block: true,
69
- onPress: handleClose,
70
- children: "Explore Dapps"
71
- })
72
- })]
38
+ return /*#__PURE__*/_jsx(StickyFooter, {
39
+ paddingX: 3,
40
+ children: /*#__PURE__*/_jsx(Button, {
41
+ block: true,
42
+ onPress: handleClose,
43
+ children: "Explore Dapps"
44
+ })
73
45
  });
74
- }
46
+ },
47
+ handleBarAccessibilityLabel: "Dismiss",
48
+ onCloseComplete: setIsTrayVisibleToFalse,
49
+ onVisibilityChange: handleTrayVisibilityChange,
50
+ children: /*#__PURE__*/_jsxs(VStack, {
51
+ paddingBottom: 1,
52
+ paddingTop: 1,
53
+ paddingX: 3,
54
+ children: [/*#__PURE__*/_jsx(Box, {
55
+ alignItems: "center",
56
+ paddingBottom: 3,
57
+ children: /*#__PURE__*/_jsx(SpotRectangle, {
58
+ name: "exploreDecentralizedApps"
59
+ })
60
+ }), /*#__PURE__*/_jsx(Text, {
61
+ align: "center",
62
+ font: "title1",
63
+ paddingBottom: 2,
64
+ children: "Earn crypto by lending, staking, and more"
65
+ }), /*#__PURE__*/_jsx(Text, {
66
+ align: "center",
67
+ color: "fgMuted",
68
+ font: "body",
69
+ children: "Many decentralized apps (\u201Cdapps\u201D) let you earn yield on your crypto. Check out trusted dapps like Aave and Compound without leaving Coinbaes."
70
+ })]
71
+ })
75
72
  })]
76
73
  });
77
74
  };
@@ -120,15 +117,7 @@ const CreditCardAddAssetsTrayExample = () => {
120
117
  }), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
121
118
  handleBarAccessibilityLabel: "Information about rewards details",
122
119
  onCloseComplete: setIsTrayVisibleOff,
123
- title: trayContentType === 'addFundsInfo' ? /*#__PURE__*/_jsx(VStack, {
124
- gap: 0.5,
125
- paddingTop: 3,
126
- paddingX: 3,
127
- children: /*#__PURE__*/_jsx(Text, {
128
- font: "title3",
129
- children: "Lifetime rewards details"
130
- })
131
- }) : null,
120
+ title: trayContentType === 'addFundsInfo' ? 'Lifetime rewards details' : null,
132
121
  children: trayContentType === 'addFundsInfo' ? /*#__PURE__*/_jsxs(VStack, {
133
122
  paddingX: 3,
134
123
  children: [/*#__PURE__*/_jsx(Text, {
@@ -154,8 +143,6 @@ const CreditCardAddAssetsTrayExample = () => {
154
143
  })]
155
144
  });
156
145
  };
157
- const TOP_TRAY_OFFSET = 20;
158
- const SAFE_AREA_OVERFLOW_MULTIPLIER = 2;
159
146
  const BACKGROUND_COLOR = '#011C92';
160
147
  const UPSELL_BENEFITS = [{
161
148
  key: '1',
@@ -195,13 +182,23 @@ const ProductUpsellTrayExample = () => {
195
182
  const [isTrayVisible, setIsTrayVisible] = useState(false);
196
183
  const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), []);
197
184
  const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), []);
185
+ const safeBottomPadding = useSafeBottomPadding();
198
186
  return /*#__PURE__*/_jsxs(_Fragment, {
199
187
  children: [/*#__PURE__*/_jsx(Button, {
200
188
  onPress: setIsTrayVisibleOn,
201
189
  children: "Open"
202
190
  }), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
191
+ disableSafeAreaPaddingBottom: true,
203
192
  handleBarAccessibilityLabel: "Product upsell details",
204
193
  onCloseComplete: setIsTrayVisibleOff,
194
+ styles: {
195
+ drawer: {
196
+ backgroundColor: BACKGROUND_COLOR
197
+ },
198
+ content: {
199
+ paddingBottom: safeBottomPadding
200
+ }
201
+ },
205
202
  verticalDrawerPercentageOfView: 0.95,
206
203
  children: _ref3 => {
207
204
  let {
@@ -220,11 +217,6 @@ const ProductUpsellTrayContent = /*#__PURE__*/memo(function ProductUpsellTrayCon
220
217
  benefits,
221
218
  dismiss
222
219
  } = _ref4;
223
- const {
224
- screenWidth
225
- } = useDimensions();
226
- const insets = useSafeAreaInsets();
227
- const bottom = Platform.OS === 'android' ? Math.max(insets.bottom, 24) : insets.bottom;
228
220
  const handlePrimaryCtaPress = useCallback(() => {
229
221
  alert('Primary CTA pressed');
230
222
  dismiss();
@@ -232,24 +224,9 @@ const ProductUpsellTrayContent = /*#__PURE__*/memo(function ProductUpsellTrayCon
232
224
  return /*#__PURE__*/_jsx(ThemeProvider, {
233
225
  activeColorScheme: "dark",
234
226
  theme: defaultTheme,
235
- children: /*#__PURE__*/_jsxs(VStack, {
227
+ children: /*#__PURE__*/_jsx(VStack, {
236
228
  position: "relative",
237
- children: [/*#__PURE__*/_jsx(Box, {
238
- bottom: -bottom * SAFE_AREA_OVERFLOW_MULTIPLIER,
239
- dangerouslySetBackground: BACKGROUND_COLOR,
240
- height: bottom * SAFE_AREA_OVERFLOW_MULTIPLIER,
241
- left: 0,
242
- position: "absolute",
243
- right: 0,
244
- width: "100%"
245
- }), /*#__PURE__*/_jsx(Box, {
246
- dangerouslySetBackground: BACKGROUND_COLOR,
247
- height: TOP_TRAY_OFFSET,
248
- left: 0,
249
- position: "absolute",
250
- right: 0,
251
- top: -TOP_TRAY_OFFSET
252
- }), /*#__PURE__*/_jsxs(VStack, {
229
+ children: /*#__PURE__*/_jsxs(VStack, {
253
230
  dangerouslySetBackground: BACKGROUND_COLOR,
254
231
  gap: 4,
255
232
  paddingTop: 5,
@@ -308,7 +285,7 @@ const ProductUpsellTrayContent = /*#__PURE__*/memo(function ProductUpsellTrayCon
308
285
  })]
309
286
  })]
310
287
  })]
311
- })]
288
+ })
312
289
  })
313
290
  });
314
291
  });