@coinbase/cds-mobile 8.43.2 → 8.44.1
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 +14 -0
- package/dts/alpha/__figma__/Select.figma.d.ts +2 -0
- package/dts/alpha/__figma__/Select.figma.d.ts.map +1 -0
- package/dts/alpha/combobox/Combobox.d.ts.map +1 -1
- package/dts/alpha/data-card/DataCard.d.ts +2 -0
- package/dts/alpha/data-card/DataCard.d.ts.map +1 -1
- package/dts/alpha/data-card/DataCardLayout.d.ts +4 -0
- package/dts/alpha/data-card/DataCardLayout.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
- package/dts/alpha/select/types.d.ts +57 -57
- package/dts/alpha/select/types.d.ts.map +1 -1
- package/dts/alpha/tabbed-chips/TabbedChips.d.ts +2 -6
- package/dts/alpha/tabbed-chips/TabbedChips.d.ts.map +1 -1
- package/dts/buttons/SlideButton.d.ts +8 -24
- package/dts/buttons/SlideButton.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardBody.d.ts +8 -24
- package/dts/cards/ContentCard/ContentCardBody.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardHeader.d.ts +6 -18
- package/dts/cards/ContentCard/ContentCardHeader.d.ts.map +1 -1
- package/dts/cards/MediaCard/MediaCardLayout.d.ts +5 -0
- package/dts/cards/MediaCard/MediaCardLayout.d.ts.map +1 -1
- package/dts/cards/MediaCard/index.d.ts +2 -0
- package/dts/cards/MediaCard/index.d.ts.map +1 -1
- package/dts/cards/MessagingCard/MessagingCardLayout.d.ts +5 -0
- package/dts/cards/MessagingCard/MessagingCardLayout.d.ts.map +1 -1
- package/dts/cards/MessagingCard/index.d.ts +2 -0
- package/dts/cards/MessagingCard/index.d.ts.map +1 -1
- package/dts/cells/Cell.d.ts +11 -3
- package/dts/cells/Cell.d.ts.map +1 -1
- package/dts/cells/ContentCell.d.ts +12 -3
- package/dts/cells/ContentCell.d.ts.map +1 -1
- package/dts/cells/ListCell.d.ts +15 -5
- package/dts/cells/ListCell.d.ts.map +1 -1
- package/dts/chips/Chip.d.ts.map +1 -1
- package/dts/chips/ChipProps.d.ts +3 -1
- package/dts/chips/ChipProps.d.ts.map +1 -1
- package/dts/chips/InputChip.d.ts.map +1 -1
- package/dts/chips/MediaChip.d.ts.map +1 -1
- package/dts/controls/CheckboxCell.d.ts +5 -0
- package/dts/controls/CheckboxCell.d.ts.map +1 -1
- package/dts/controls/RadioCell.d.ts +5 -0
- package/dts/controls/RadioCell.d.ts.map +1 -1
- package/dts/dots/DotCount.d.ts +4 -15
- package/dts/dots/DotCount.d.ts.map +1 -1
- package/dts/icons/Icon.d.ts +3 -0
- package/dts/icons/Icon.d.ts.map +1 -1
- package/dts/numbers/RollingNumber/RollingNumber.d.ts +30 -90
- package/dts/numbers/RollingNumber/RollingNumber.d.ts.map +1 -1
- package/dts/overlays/drawer/Drawer.d.ts +56 -13
- package/dts/overlays/drawer/Drawer.d.ts.map +1 -1
- package/dts/overlays/handlebar/HandleBar.d.ts +26 -2
- package/dts/overlays/handlebar/HandleBar.d.ts.map +1 -1
- package/dts/overlays/tray/Tray.d.ts +48 -13
- package/dts/overlays/tray/Tray.d.ts.map +1 -1
- package/dts/page/PageHeader.d.ts +10 -30
- package/dts/page/PageHeader.d.ts.map +1 -1
- package/dts/stepper/Stepper.d.ts +9 -9
- package/dts/stepper/Stepper.d.ts.map +1 -1
- package/dts/visualizations/ProgressBar.d.ts +6 -24
- package/dts/visualizations/ProgressBar.d.ts.map +1 -1
- package/dts/visualizations/ProgressBarWithFixedLabels.d.ts +5 -18
- package/dts/visualizations/ProgressBarWithFixedLabels.d.ts.map +1 -1
- package/dts/visualizations/ProgressBarWithFloatLabel.d.ts +4 -15
- package/dts/visualizations/ProgressBarWithFloatLabel.d.ts.map +1 -1
- package/dts/visualizations/ProgressCircle.d.ts +14 -48
- package/dts/visualizations/ProgressCircle.d.ts.map +1 -1
- package/esm/alpha/__figma__/Select.figma.js +63 -0
- package/esm/alpha/combobox/Combobox.js +29 -24
- package/esm/carousel/__stories__/Carousel.stories.js +7 -7
- package/esm/overlays/__stories__/TrayRedesign.stories.js +1070 -0
- package/esm/overlays/drawer/Drawer.js +64 -37
- package/esm/overlays/handlebar/HandleBar.js +48 -25
- package/esm/overlays/tray/Tray.js +61 -26
- package/package.json +2 -2
|
@@ -0,0 +1,1070 @@
|
|
|
1
|
+
const _excluded = ["offset", "borderRadiusValue", "children", "styles"],
|
|
2
|
+
_excluded2 = ["screens", "initialScreen"],
|
|
3
|
+
_excluded3 = ["pictogramName", "title", "children"],
|
|
4
|
+
_excluded4 = ["footer", "footerLabel", "children"];
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { Image, ScrollView } from 'react-native';
|
|
9
|
+
import { Button } from '../../buttons/Button';
|
|
10
|
+
import { IconButton } from '../../buttons/IconButton';
|
|
11
|
+
import { ListCell } from '../../cells/ListCell';
|
|
12
|
+
import { Menu, SelectOption } from '../../controls';
|
|
13
|
+
import { Example, ExampleScreen } from '../../examples/ExampleScreen';
|
|
14
|
+
import { useSafeBottomPadding } from '../../hooks/useSafeBottomPadding';
|
|
15
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
16
|
+
import { Pictogram } from '../../illustrations';
|
|
17
|
+
import { Box, VStack } from '../../layout';
|
|
18
|
+
import { StickyFooter } from '../../sticky-footer/StickyFooter';
|
|
19
|
+
import { Text } from '../../typography/Text';
|
|
20
|
+
import { Tray } from '../tray/Tray';
|
|
21
|
+
import { options } from './Trays';
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
|
+
export const TrayRedesignScreen = () => {
|
|
24
|
+
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
25
|
+
children: [/*#__PURE__*/_jsx(Example, {
|
|
26
|
+
title: "Basic Tray",
|
|
27
|
+
children: /*#__PURE__*/_jsx(BasicTray, {})
|
|
28
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
29
|
+
title: "With Sticky Footer",
|
|
30
|
+
children: /*#__PURE__*/_jsx(TrayWithStickyFooter, {})
|
|
31
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
32
|
+
title: "With ListCells",
|
|
33
|
+
children: /*#__PURE__*/_jsx(TrayWithListCells, {})
|
|
34
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
35
|
+
title: "With ListCells Sticky Footer",
|
|
36
|
+
children: /*#__PURE__*/_jsx(TrayWithListCellsStickyFooter, {})
|
|
37
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
38
|
+
title: "Illustration Tray",
|
|
39
|
+
children: /*#__PURE__*/_jsx(IllustrationTray, {})
|
|
40
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
41
|
+
title: "Illustration with ListCells",
|
|
42
|
+
children: /*#__PURE__*/_jsx(IllustrationTrayWithListCells, {})
|
|
43
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
44
|
+
title: "Illustration with Sticky Footer",
|
|
45
|
+
children: /*#__PURE__*/_jsx(IllustrationTrayWithStickyFooter, {})
|
|
46
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
47
|
+
title: "Illustration with ListCells Sticky Footer",
|
|
48
|
+
children: /*#__PURE__*/_jsx(IllustrationTrayWithListCellsStickyFooter, {})
|
|
49
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
50
|
+
title: "Full Bleed Image Tray",
|
|
51
|
+
children: /*#__PURE__*/_jsx(FullBleedImageTray, {})
|
|
52
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
53
|
+
title: "Full Bleed Image with ListCells",
|
|
54
|
+
children: /*#__PURE__*/_jsx(FullBleedImageTrayWithListCells, {})
|
|
55
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
56
|
+
title: "Full Bleed Image with Sticky Footer",
|
|
57
|
+
children: /*#__PURE__*/_jsx(FullBleedImageTrayWithStickyFooter, {})
|
|
58
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
59
|
+
title: "Full Bleed Image with ListCells Sticky Footer",
|
|
60
|
+
children: /*#__PURE__*/_jsx(FullBleedImageTrayWithListCellsStickyFooter, {})
|
|
61
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
62
|
+
title: "Floating Tray",
|
|
63
|
+
children: /*#__PURE__*/_jsx(FloatingTrayExample, {})
|
|
64
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
65
|
+
title: "Multi-Screen Tray",
|
|
66
|
+
children: /*#__PURE__*/_jsx(MultiScreenTrayExample, {})
|
|
67
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
68
|
+
title: "Composed Illustration Tray",
|
|
69
|
+
children: /*#__PURE__*/_jsx(ComposedIllustrationTrayExample, {})
|
|
70
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
71
|
+
title: "Responsive Tray",
|
|
72
|
+
children: /*#__PURE__*/_jsx(ResponsiveTrayExample, {})
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Standard Tray Examples
|
|
79
|
+
// ============================================================================
|
|
80
|
+
|
|
81
|
+
const BasicTray = () => {
|
|
82
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
83
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
84
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
85
|
+
const trayRef = useRef(null);
|
|
86
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
87
|
+
console.log('Tray visibility changed:', e);
|
|
88
|
+
}, []);
|
|
89
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
90
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
91
|
+
onPress: setIsTrayVisibleOn,
|
|
92
|
+
children: "Open"
|
|
93
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
94
|
+
ref: trayRef,
|
|
95
|
+
handleBarVariant: "inside",
|
|
96
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
97
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
98
|
+
title: "Header",
|
|
99
|
+
children: /*#__PURE__*/_jsx(VStack, {
|
|
100
|
+
paddingX: 3,
|
|
101
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
102
|
+
font: "body",
|
|
103
|
+
children: "Curabitur commodo nulla vel dolor vulputate vestibulum. Nulla et nisl molestie, interdum lorem id, viverra."
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const TrayWithStickyFooter = () => {
|
|
110
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
111
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
112
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
113
|
+
const trayRef = useRef(null);
|
|
114
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
115
|
+
console.log('Tray visibility changed:', e);
|
|
116
|
+
}, []);
|
|
117
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
118
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
119
|
+
onPress: setIsTrayVisibleOn,
|
|
120
|
+
children: "Open"
|
|
121
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
122
|
+
ref: trayRef,
|
|
123
|
+
footer: _ref => {
|
|
124
|
+
let {
|
|
125
|
+
handleClose
|
|
126
|
+
} = _ref;
|
|
127
|
+
return /*#__PURE__*/_jsx(StickyFooter, {
|
|
128
|
+
background: "bgElevation2",
|
|
129
|
+
paddingX: 3,
|
|
130
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
131
|
+
block: true,
|
|
132
|
+
onPress: handleClose,
|
|
133
|
+
children: "Close"
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
handleBarVariant: "inside",
|
|
138
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
139
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
140
|
+
title: "Header",
|
|
141
|
+
children: /*#__PURE__*/_jsx(VStack, {
|
|
142
|
+
paddingBottom: 1,
|
|
143
|
+
paddingX: 3,
|
|
144
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
145
|
+
font: "body",
|
|
146
|
+
children: "Curabitur commodo nulla vel dolor vulputate vestibulum. Nulla et nisl molestie, interdum lorem id, viverra."
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
})]
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
const TrayWithListCells = () => {
|
|
153
|
+
const safeBottomPadding = useSafeBottomPadding();
|
|
154
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
155
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
156
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
157
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
158
|
+
const trayRef = useRef(null);
|
|
159
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
160
|
+
console.log('Tray visibility changed:', e);
|
|
161
|
+
}, []);
|
|
162
|
+
const handleScroll = useCallback(e => {
|
|
163
|
+
const scrollY = e.nativeEvent.contentOffset.y;
|
|
164
|
+
setIsScrolled(scrollY > 0);
|
|
165
|
+
}, []);
|
|
166
|
+
const scrollContentStyle = useMemo(() => ({
|
|
167
|
+
paddingBottom: safeBottomPadding
|
|
168
|
+
}), [safeBottomPadding]);
|
|
169
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
170
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
171
|
+
onPress: setIsTrayVisibleOn,
|
|
172
|
+
children: "Open"
|
|
173
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
174
|
+
ref: trayRef,
|
|
175
|
+
handleBarVariant: "inside",
|
|
176
|
+
headerElevation: isScrolled ? 2 : 0,
|
|
177
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
178
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
179
|
+
title: "Header",
|
|
180
|
+
verticalDrawerPercentageOfView: 0.9,
|
|
181
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
182
|
+
contentContainerStyle: scrollContentStyle,
|
|
183
|
+
onScroll: handleScroll,
|
|
184
|
+
scrollEventThrottle: 16,
|
|
185
|
+
children: Array.from({
|
|
186
|
+
length: 20
|
|
187
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
188
|
+
accessory: "arrow",
|
|
189
|
+
description: "Description",
|
|
190
|
+
onPress: () => alert('Cell clicked!'),
|
|
191
|
+
spacingVariant: "condensed",
|
|
192
|
+
title: "Title"
|
|
193
|
+
}, i))
|
|
194
|
+
})
|
|
195
|
+
})]
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
const TrayWithListCellsStickyFooter = () => {
|
|
199
|
+
const safeBottomPadding = useSafeBottomPadding();
|
|
200
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
201
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
202
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
203
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
204
|
+
const trayRef = useRef(null);
|
|
205
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
206
|
+
console.log('Tray visibility changed:', e);
|
|
207
|
+
}, []);
|
|
208
|
+
const handleScroll = useCallback(e => {
|
|
209
|
+
const scrollY = e.nativeEvent.contentOffset.y;
|
|
210
|
+
setIsScrolled(scrollY > 0);
|
|
211
|
+
}, []);
|
|
212
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
213
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
214
|
+
onPress: setIsTrayVisibleOn,
|
|
215
|
+
children: "Open"
|
|
216
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
217
|
+
ref: trayRef,
|
|
218
|
+
footer: _ref2 => {
|
|
219
|
+
let {
|
|
220
|
+
handleClose
|
|
221
|
+
} = _ref2;
|
|
222
|
+
return /*#__PURE__*/_jsx(StickyFooter, {
|
|
223
|
+
background: "bgElevation2",
|
|
224
|
+
elevation: isScrolled ? 2 : 0,
|
|
225
|
+
paddingX: 3,
|
|
226
|
+
style: {
|
|
227
|
+
paddingBottom: safeBottomPadding
|
|
228
|
+
},
|
|
229
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
230
|
+
block: true,
|
|
231
|
+
onPress: handleClose,
|
|
232
|
+
children: "Close"
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
handleBarVariant: "inside",
|
|
237
|
+
headerElevation: isScrolled ? 2 : 0,
|
|
238
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
239
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
240
|
+
title: "Header",
|
|
241
|
+
verticalDrawerPercentageOfView: 0.9,
|
|
242
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
243
|
+
onScroll: handleScroll,
|
|
244
|
+
scrollEventThrottle: 16,
|
|
245
|
+
children: Array.from({
|
|
246
|
+
length: 20
|
|
247
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
248
|
+
accessory: "arrow",
|
|
249
|
+
description: "Description",
|
|
250
|
+
onPress: () => alert('Cell clicked!'),
|
|
251
|
+
spacingVariant: "condensed",
|
|
252
|
+
title: "Title"
|
|
253
|
+
}, i))
|
|
254
|
+
})
|
|
255
|
+
})]
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// ============================================================================
|
|
260
|
+
// Illustration Tray Examples
|
|
261
|
+
// ============================================================================
|
|
262
|
+
|
|
263
|
+
const IllustrationTray = () => {
|
|
264
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
265
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
266
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
267
|
+
const [value, setValue] = useState();
|
|
268
|
+
const trayRef = useRef(null);
|
|
269
|
+
const handleOptionPress = () => {
|
|
270
|
+
var _trayRef$current;
|
|
271
|
+
(_trayRef$current = trayRef.current) == null || _trayRef$current.handleClose();
|
|
272
|
+
};
|
|
273
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
274
|
+
console.log('Tray visibility changed:', e);
|
|
275
|
+
}, []);
|
|
276
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
277
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
278
|
+
onPress: setIsTrayVisibleOn,
|
|
279
|
+
children: "Open"
|
|
280
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
281
|
+
ref: trayRef,
|
|
282
|
+
handleBarVariant: "inside",
|
|
283
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
284
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
285
|
+
title: /*#__PURE__*/_jsxs(VStack, {
|
|
286
|
+
gap: 1.5,
|
|
287
|
+
children: [/*#__PURE__*/_jsx(Pictogram, {
|
|
288
|
+
name: "addWallet"
|
|
289
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
290
|
+
font: "title3",
|
|
291
|
+
children: "Header"
|
|
292
|
+
})]
|
|
293
|
+
}),
|
|
294
|
+
children: /*#__PURE__*/_jsx(Menu, {
|
|
295
|
+
onChange: setValue,
|
|
296
|
+
value: value,
|
|
297
|
+
children: options.map(option => /*#__PURE__*/_jsx(SelectOption, {
|
|
298
|
+
description: "BTC",
|
|
299
|
+
onPress: handleOptionPress,
|
|
300
|
+
title: option,
|
|
301
|
+
value: option
|
|
302
|
+
}, option))
|
|
303
|
+
})
|
|
304
|
+
})]
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
const IllustrationTrayWithListCells = () => {
|
|
308
|
+
const safeBottomPadding = useSafeBottomPadding();
|
|
309
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
310
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
311
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
312
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
313
|
+
const trayRef = useRef(null);
|
|
314
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
315
|
+
console.log('Tray visibility changed:', e);
|
|
316
|
+
}, []);
|
|
317
|
+
const handleScroll = useCallback(e => {
|
|
318
|
+
const scrollY = e.nativeEvent.contentOffset.y;
|
|
319
|
+
setIsScrolled(scrollY > 0);
|
|
320
|
+
}, []);
|
|
321
|
+
const scrollContentStyle = useMemo(() => ({
|
|
322
|
+
paddingBottom: safeBottomPadding
|
|
323
|
+
}), [safeBottomPadding]);
|
|
324
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
325
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
326
|
+
onPress: setIsTrayVisibleOn,
|
|
327
|
+
children: "Open"
|
|
328
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
329
|
+
ref: trayRef,
|
|
330
|
+
handleBarVariant: "inside",
|
|
331
|
+
headerElevation: isScrolled ? 2 : 0,
|
|
332
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
333
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
334
|
+
title: /*#__PURE__*/_jsxs(VStack, {
|
|
335
|
+
gap: 1.5,
|
|
336
|
+
children: [/*#__PURE__*/_jsx(Pictogram, {
|
|
337
|
+
name: "addWallet"
|
|
338
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
339
|
+
font: "title3",
|
|
340
|
+
children: "Header"
|
|
341
|
+
})]
|
|
342
|
+
}),
|
|
343
|
+
verticalDrawerPercentageOfView: 0.9,
|
|
344
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
345
|
+
contentContainerStyle: scrollContentStyle,
|
|
346
|
+
onScroll: handleScroll,
|
|
347
|
+
scrollEventThrottle: 16,
|
|
348
|
+
children: Array.from({
|
|
349
|
+
length: 20
|
|
350
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
351
|
+
accessory: "arrow",
|
|
352
|
+
description: "Description",
|
|
353
|
+
onPress: () => alert('Cell clicked!'),
|
|
354
|
+
spacingVariant: "condensed",
|
|
355
|
+
title: "Title"
|
|
356
|
+
}, i))
|
|
357
|
+
})
|
|
358
|
+
})]
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
const IllustrationTrayWithStickyFooter = () => {
|
|
362
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
363
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
364
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
365
|
+
const trayRef = useRef(null);
|
|
366
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
367
|
+
console.log('Tray visibility changed:', e);
|
|
368
|
+
}, []);
|
|
369
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
370
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
371
|
+
onPress: setIsTrayVisibleOn,
|
|
372
|
+
children: "Open"
|
|
373
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
374
|
+
ref: trayRef,
|
|
375
|
+
footer: _ref3 => {
|
|
376
|
+
let {
|
|
377
|
+
handleClose
|
|
378
|
+
} = _ref3;
|
|
379
|
+
return /*#__PURE__*/_jsx(StickyFooter, {
|
|
380
|
+
background: "bgElevation2",
|
|
381
|
+
paddingX: 3,
|
|
382
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
383
|
+
block: true,
|
|
384
|
+
onPress: handleClose,
|
|
385
|
+
children: "Close"
|
|
386
|
+
})
|
|
387
|
+
});
|
|
388
|
+
},
|
|
389
|
+
handleBarVariant: "inside",
|
|
390
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
391
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
392
|
+
title: /*#__PURE__*/_jsxs(VStack, {
|
|
393
|
+
gap: 1.5,
|
|
394
|
+
children: [/*#__PURE__*/_jsx(Pictogram, {
|
|
395
|
+
name: "addWallet"
|
|
396
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
397
|
+
font: "title3",
|
|
398
|
+
children: "Header"
|
|
399
|
+
})]
|
|
400
|
+
}),
|
|
401
|
+
children: /*#__PURE__*/_jsx(VStack, {
|
|
402
|
+
paddingBottom: 1,
|
|
403
|
+
paddingX: 3,
|
|
404
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
405
|
+
font: "body",
|
|
406
|
+
children: "Curabitur commodo nulla vel dolor vulputate vestibulum. Nulla et nisl molestie, interdum lorem id, viverra."
|
|
407
|
+
})
|
|
408
|
+
})
|
|
409
|
+
})]
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
const IllustrationTrayWithListCellsStickyFooter = () => {
|
|
413
|
+
const safeBottomPadding = useSafeBottomPadding();
|
|
414
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
415
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
416
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
417
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
418
|
+
const trayRef = useRef(null);
|
|
419
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
420
|
+
console.log('Tray visibility changed:', e);
|
|
421
|
+
}, []);
|
|
422
|
+
const handleScroll = useCallback(e => {
|
|
423
|
+
const scrollY = e.nativeEvent.contentOffset.y;
|
|
424
|
+
setIsScrolled(scrollY > 0);
|
|
425
|
+
}, []);
|
|
426
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
427
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
428
|
+
onPress: setIsTrayVisibleOn,
|
|
429
|
+
children: "Open"
|
|
430
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
431
|
+
ref: trayRef,
|
|
432
|
+
footer: _ref4 => {
|
|
433
|
+
let {
|
|
434
|
+
handleClose
|
|
435
|
+
} = _ref4;
|
|
436
|
+
return /*#__PURE__*/_jsx(StickyFooter, {
|
|
437
|
+
background: "bgElevation2",
|
|
438
|
+
elevation: isScrolled ? 2 : 0,
|
|
439
|
+
paddingX: 3,
|
|
440
|
+
style: {
|
|
441
|
+
paddingBottom: safeBottomPadding
|
|
442
|
+
},
|
|
443
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
444
|
+
block: true,
|
|
445
|
+
onPress: handleClose,
|
|
446
|
+
children: "Close"
|
|
447
|
+
})
|
|
448
|
+
});
|
|
449
|
+
},
|
|
450
|
+
handleBarVariant: "inside",
|
|
451
|
+
headerElevation: isScrolled ? 2 : 0,
|
|
452
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
453
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
454
|
+
title: /*#__PURE__*/_jsxs(VStack, {
|
|
455
|
+
gap: 1.5,
|
|
456
|
+
children: [/*#__PURE__*/_jsx(Pictogram, {
|
|
457
|
+
name: "addWallet"
|
|
458
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
459
|
+
font: "title3",
|
|
460
|
+
children: "Header"
|
|
461
|
+
})]
|
|
462
|
+
}),
|
|
463
|
+
verticalDrawerPercentageOfView: 0.9,
|
|
464
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
465
|
+
onScroll: handleScroll,
|
|
466
|
+
scrollEventThrottle: 16,
|
|
467
|
+
children: Array.from({
|
|
468
|
+
length: 20
|
|
469
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
470
|
+
accessory: "arrow",
|
|
471
|
+
description: "Description",
|
|
472
|
+
onPress: () => alert('Cell clicked!'),
|
|
473
|
+
spacingVariant: "condensed",
|
|
474
|
+
title: "Title"
|
|
475
|
+
}, i))
|
|
476
|
+
})
|
|
477
|
+
})]
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// ============================================================================
|
|
482
|
+
// Full Bleed Image Tray Examples
|
|
483
|
+
// ============================================================================
|
|
484
|
+
|
|
485
|
+
const FULL_BLEED_IMAGE_URI = 'https://static-assets.coinbase.com/design-system/placeholder/coinbaseHeader.jpg';
|
|
486
|
+
const FullBleedImageTray = () => {
|
|
487
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
488
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
489
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
490
|
+
const [value, setValue] = useState();
|
|
491
|
+
const trayRef = useRef(null);
|
|
492
|
+
const handleOptionPress = () => {
|
|
493
|
+
var _trayRef$current2;
|
|
494
|
+
(_trayRef$current2 = trayRef.current) == null || _trayRef$current2.handleClose();
|
|
495
|
+
};
|
|
496
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
497
|
+
console.log('Tray visibility changed:', e);
|
|
498
|
+
}, []);
|
|
499
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
500
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
501
|
+
onPress: setIsTrayVisibleOn,
|
|
502
|
+
children: "Open"
|
|
503
|
+
}), isTrayVisible && /*#__PURE__*/_jsxs(Tray, {
|
|
504
|
+
ref: trayRef,
|
|
505
|
+
handleBarVariant: "inside",
|
|
506
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
507
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
508
|
+
styles: {
|
|
509
|
+
handleBar: {
|
|
510
|
+
position: 'absolute',
|
|
511
|
+
top: 0,
|
|
512
|
+
left: 0,
|
|
513
|
+
right: 0,
|
|
514
|
+
zIndex: 1
|
|
515
|
+
},
|
|
516
|
+
header: {
|
|
517
|
+
paddingHorizontal: 0,
|
|
518
|
+
paddingBottom: 0
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
title: /*#__PURE__*/_jsx(Box, {
|
|
522
|
+
background: "bgAlternate",
|
|
523
|
+
height: 180,
|
|
524
|
+
marginX: -3,
|
|
525
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
526
|
+
resizeMode: "cover",
|
|
527
|
+
source: {
|
|
528
|
+
uri: FULL_BLEED_IMAGE_URI
|
|
529
|
+
},
|
|
530
|
+
style: {
|
|
531
|
+
width: '100%',
|
|
532
|
+
height: '100%'
|
|
533
|
+
}
|
|
534
|
+
})
|
|
535
|
+
}),
|
|
536
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
537
|
+
font: "title3",
|
|
538
|
+
paddingBottom: 0.75,
|
|
539
|
+
paddingTop: 2,
|
|
540
|
+
paddingX: 3,
|
|
541
|
+
children: "Header"
|
|
542
|
+
}), /*#__PURE__*/_jsx(Menu, {
|
|
543
|
+
onChange: setValue,
|
|
544
|
+
value: value,
|
|
545
|
+
children: options.map(option => /*#__PURE__*/_jsx(SelectOption, {
|
|
546
|
+
description: "BTC",
|
|
547
|
+
onPress: handleOptionPress,
|
|
548
|
+
title: option,
|
|
549
|
+
value: option
|
|
550
|
+
}, option))
|
|
551
|
+
})]
|
|
552
|
+
})]
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
const FullBleedImageTrayWithListCells = () => {
|
|
556
|
+
const safeBottomPadding = useSafeBottomPadding();
|
|
557
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
558
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
559
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
560
|
+
const trayRef = useRef(null);
|
|
561
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
562
|
+
console.log('Tray visibility changed:', e);
|
|
563
|
+
}, []);
|
|
564
|
+
const scrollContentStyle = useMemo(() => ({
|
|
565
|
+
paddingBottom: safeBottomPadding
|
|
566
|
+
}), [safeBottomPadding]);
|
|
567
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
568
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
569
|
+
onPress: setIsTrayVisibleOn,
|
|
570
|
+
children: "Open"
|
|
571
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
572
|
+
ref: trayRef,
|
|
573
|
+
handleBarVariant: "inside",
|
|
574
|
+
header: /*#__PURE__*/_jsx(Text, {
|
|
575
|
+
font: "title3",
|
|
576
|
+
paddingBottom: 0.75,
|
|
577
|
+
paddingTop: 2,
|
|
578
|
+
paddingX: 3,
|
|
579
|
+
children: "Header"
|
|
580
|
+
}),
|
|
581
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
582
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
583
|
+
styles: {
|
|
584
|
+
handleBar: {
|
|
585
|
+
position: 'absolute',
|
|
586
|
+
top: 0,
|
|
587
|
+
left: 0,
|
|
588
|
+
right: 0,
|
|
589
|
+
zIndex: 1
|
|
590
|
+
},
|
|
591
|
+
header: {
|
|
592
|
+
paddingHorizontal: 0,
|
|
593
|
+
paddingBottom: 0
|
|
594
|
+
},
|
|
595
|
+
drawer: scrollContentStyle
|
|
596
|
+
},
|
|
597
|
+
title: /*#__PURE__*/_jsx(Box, {
|
|
598
|
+
background: "bgAlternate",
|
|
599
|
+
height: 180,
|
|
600
|
+
marginX: -3,
|
|
601
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
602
|
+
resizeMode: "cover",
|
|
603
|
+
source: {
|
|
604
|
+
uri: FULL_BLEED_IMAGE_URI
|
|
605
|
+
},
|
|
606
|
+
style: {
|
|
607
|
+
width: '100%',
|
|
608
|
+
height: '100%'
|
|
609
|
+
}
|
|
610
|
+
})
|
|
611
|
+
}),
|
|
612
|
+
verticalDrawerPercentageOfView: 0.9,
|
|
613
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
614
|
+
contentContainerStyle: scrollContentStyle,
|
|
615
|
+
children: Array.from({
|
|
616
|
+
length: 20
|
|
617
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
618
|
+
accessory: "arrow",
|
|
619
|
+
description: "Description",
|
|
620
|
+
onPress: () => alert('Cell clicked!'),
|
|
621
|
+
spacingVariant: "condensed",
|
|
622
|
+
title: "Title"
|
|
623
|
+
}, i))
|
|
624
|
+
})
|
|
625
|
+
})]
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
const FullBleedImageTrayWithStickyFooter = () => {
|
|
629
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
630
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
631
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
632
|
+
const trayRef = useRef(null);
|
|
633
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
634
|
+
console.log('Tray visibility changed:', e);
|
|
635
|
+
}, []);
|
|
636
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
637
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
638
|
+
onPress: setIsTrayVisibleOn,
|
|
639
|
+
children: "Open"
|
|
640
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
641
|
+
ref: trayRef,
|
|
642
|
+
footer: _ref5 => {
|
|
643
|
+
let {
|
|
644
|
+
handleClose
|
|
645
|
+
} = _ref5;
|
|
646
|
+
return /*#__PURE__*/_jsx(StickyFooter, {
|
|
647
|
+
background: "bgElevation2",
|
|
648
|
+
paddingX: 3,
|
|
649
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
650
|
+
block: true,
|
|
651
|
+
onPress: handleClose,
|
|
652
|
+
children: "Close"
|
|
653
|
+
})
|
|
654
|
+
});
|
|
655
|
+
},
|
|
656
|
+
handleBarVariant: "inside",
|
|
657
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
658
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
659
|
+
styles: {
|
|
660
|
+
handleBar: {
|
|
661
|
+
position: 'absolute',
|
|
662
|
+
top: 0,
|
|
663
|
+
left: 0,
|
|
664
|
+
right: 0,
|
|
665
|
+
zIndex: 1
|
|
666
|
+
},
|
|
667
|
+
header: {
|
|
668
|
+
paddingHorizontal: 0,
|
|
669
|
+
paddingBottom: 0
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
title: /*#__PURE__*/_jsx(Box, {
|
|
673
|
+
background: "bgAlternate",
|
|
674
|
+
height: 180,
|
|
675
|
+
marginX: -3,
|
|
676
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
677
|
+
resizeMode: "cover",
|
|
678
|
+
source: {
|
|
679
|
+
uri: FULL_BLEED_IMAGE_URI
|
|
680
|
+
},
|
|
681
|
+
style: {
|
|
682
|
+
width: '100%',
|
|
683
|
+
height: '100%'
|
|
684
|
+
}
|
|
685
|
+
})
|
|
686
|
+
}),
|
|
687
|
+
children: /*#__PURE__*/_jsxs(VStack, {
|
|
688
|
+
paddingBottom: 1,
|
|
689
|
+
paddingX: 3,
|
|
690
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
691
|
+
font: "title3",
|
|
692
|
+
paddingBottom: 0.75,
|
|
693
|
+
paddingTop: 2,
|
|
694
|
+
children: "Header"
|
|
695
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
696
|
+
font: "body",
|
|
697
|
+
children: "Curabitur commodo nulla vel dolor vulputate vestibulum. Nulla et nisl molestie, interdum lorem id, viverra."
|
|
698
|
+
})]
|
|
699
|
+
})
|
|
700
|
+
})]
|
|
701
|
+
});
|
|
702
|
+
};
|
|
703
|
+
const FullBleedImageTrayWithListCellsStickyFooter = () => {
|
|
704
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
705
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
706
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), [setIsTrayVisible]);
|
|
707
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), [setIsTrayVisible]);
|
|
708
|
+
const trayRef = useRef(null);
|
|
709
|
+
const handleTrayVisibilityChange = useCallback(e => {
|
|
710
|
+
console.log('Tray visibility changed:', e);
|
|
711
|
+
}, []);
|
|
712
|
+
const handleScroll = useCallback(e => {
|
|
713
|
+
const scrollY = e.nativeEvent.contentOffset.y;
|
|
714
|
+
setIsScrolled(scrollY > 0);
|
|
715
|
+
}, []);
|
|
716
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
717
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
718
|
+
onPress: setIsTrayVisibleOn,
|
|
719
|
+
children: "Open"
|
|
720
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(Tray, {
|
|
721
|
+
ref: trayRef,
|
|
722
|
+
footer: _ref6 => {
|
|
723
|
+
let {
|
|
724
|
+
handleClose
|
|
725
|
+
} = _ref6;
|
|
726
|
+
return /*#__PURE__*/_jsx(StickyFooter, {
|
|
727
|
+
background: "bgElevation2",
|
|
728
|
+
elevation: isScrolled ? 2 : 0,
|
|
729
|
+
paddingX: 3,
|
|
730
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
731
|
+
block: true,
|
|
732
|
+
onPress: handleClose,
|
|
733
|
+
children: "Close"
|
|
734
|
+
})
|
|
735
|
+
});
|
|
736
|
+
},
|
|
737
|
+
handleBarVariant: "inside",
|
|
738
|
+
header: /*#__PURE__*/_jsx(Text, {
|
|
739
|
+
font: "title3",
|
|
740
|
+
paddingBottom: 0.75,
|
|
741
|
+
paddingTop: 2,
|
|
742
|
+
paddingX: 3,
|
|
743
|
+
children: "Header"
|
|
744
|
+
}),
|
|
745
|
+
headerElevation: isScrolled ? 2 : 0,
|
|
746
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
747
|
+
onVisibilityChange: handleTrayVisibilityChange,
|
|
748
|
+
styles: {
|
|
749
|
+
handleBar: {
|
|
750
|
+
position: 'absolute',
|
|
751
|
+
top: 0,
|
|
752
|
+
left: 0,
|
|
753
|
+
right: 0,
|
|
754
|
+
zIndex: 1
|
|
755
|
+
},
|
|
756
|
+
header: {
|
|
757
|
+
paddingHorizontal: 0,
|
|
758
|
+
paddingBottom: 0
|
|
759
|
+
}
|
|
760
|
+
},
|
|
761
|
+
title: /*#__PURE__*/_jsx(Box, {
|
|
762
|
+
background: "bgAlternate",
|
|
763
|
+
height: 180,
|
|
764
|
+
marginX: -3,
|
|
765
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
766
|
+
resizeMode: "cover",
|
|
767
|
+
source: {
|
|
768
|
+
uri: FULL_BLEED_IMAGE_URI
|
|
769
|
+
},
|
|
770
|
+
style: {
|
|
771
|
+
width: '100%',
|
|
772
|
+
height: '100%'
|
|
773
|
+
}
|
|
774
|
+
})
|
|
775
|
+
}),
|
|
776
|
+
verticalDrawerPercentageOfView: 0.9,
|
|
777
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
778
|
+
onScroll: handleScroll,
|
|
779
|
+
scrollEventThrottle: 16,
|
|
780
|
+
children: Array.from({
|
|
781
|
+
length: 20
|
|
782
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
783
|
+
accessory: "arrow",
|
|
784
|
+
description: "Description",
|
|
785
|
+
onPress: () => alert('Cell clicked!'),
|
|
786
|
+
spacingVariant: "condensed",
|
|
787
|
+
title: "Title"
|
|
788
|
+
}, i))
|
|
789
|
+
})
|
|
790
|
+
})]
|
|
791
|
+
});
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
// ============================================================================
|
|
795
|
+
// Composed Tray Examples
|
|
796
|
+
// ============================================================================
|
|
797
|
+
|
|
798
|
+
function FloatingTray(_ref7) {
|
|
799
|
+
let {
|
|
800
|
+
offset = 2,
|
|
801
|
+
borderRadiusValue = 600,
|
|
802
|
+
children,
|
|
803
|
+
styles
|
|
804
|
+
} = _ref7,
|
|
805
|
+
props = _objectWithoutPropertiesLoose(_ref7, _excluded);
|
|
806
|
+
const safeBottomPadding = useSafeBottomPadding();
|
|
807
|
+
const theme = useTheme();
|
|
808
|
+
const offsetPx = theme.space[offset];
|
|
809
|
+
const borderRadius = theme.borderRadius[borderRadiusValue];
|
|
810
|
+
const floatingStyles = useMemo(() => ({
|
|
811
|
+
bottom: offsetPx + safeBottomPadding,
|
|
812
|
+
left: offsetPx,
|
|
813
|
+
right: offsetPx,
|
|
814
|
+
borderRadius,
|
|
815
|
+
width: 'auto'
|
|
816
|
+
}), [offsetPx, safeBottomPadding, borderRadius]);
|
|
817
|
+
const containerStyles = useMemo(() => [floatingStyles, styles == null ? void 0 : styles.container], [floatingStyles, styles == null ? void 0 : styles.container]);
|
|
818
|
+
const drawerStyles = useMemo(() => [{
|
|
819
|
+
paddingBottom: 0
|
|
820
|
+
}, styles == null ? void 0 : styles.drawer], [styles == null ? void 0 : styles.drawer]);
|
|
821
|
+
return /*#__PURE__*/_jsx(Tray, _extends({}, props, {
|
|
822
|
+
handleBarVariant: "inside",
|
|
823
|
+
styles: _extends({}, styles, {
|
|
824
|
+
container: containerStyles,
|
|
825
|
+
drawer: drawerStyles
|
|
826
|
+
}),
|
|
827
|
+
children: children
|
|
828
|
+
}));
|
|
829
|
+
}
|
|
830
|
+
const FloatingTrayExample = () => {
|
|
831
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
832
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
833
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), []);
|
|
834
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), []);
|
|
835
|
+
const handleScroll = useCallback(e => {
|
|
836
|
+
const scrollY = e.nativeEvent.contentOffset.y;
|
|
837
|
+
setIsScrolled(scrollY > 0);
|
|
838
|
+
}, []);
|
|
839
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
840
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
841
|
+
onPress: setIsTrayVisibleOn,
|
|
842
|
+
children: "Open Floating Tray"
|
|
843
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(FloatingTray, {
|
|
844
|
+
headerElevation: isScrolled ? 2 : 0,
|
|
845
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
846
|
+
title: "Example title",
|
|
847
|
+
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
848
|
+
contentContainerStyle: {
|
|
849
|
+
paddingBottom: 0
|
|
850
|
+
},
|
|
851
|
+
onScroll: handleScroll,
|
|
852
|
+
scrollEventThrottle: 16,
|
|
853
|
+
children: /*#__PURE__*/_jsx(VStack, {
|
|
854
|
+
paddingBottom: 2,
|
|
855
|
+
children: Array.from({
|
|
856
|
+
length: 20
|
|
857
|
+
}, (_, i) => /*#__PURE__*/_jsx(ListCell, {
|
|
858
|
+
accessory: "arrow",
|
|
859
|
+
description: "Description",
|
|
860
|
+
onPress: () => alert('Cell clicked!'),
|
|
861
|
+
spacingVariant: "condensed",
|
|
862
|
+
title: "Title"
|
|
863
|
+
}, i))
|
|
864
|
+
})
|
|
865
|
+
})
|
|
866
|
+
})]
|
|
867
|
+
});
|
|
868
|
+
};
|
|
869
|
+
function MultiScreenTray(_ref8) {
|
|
870
|
+
let {
|
|
871
|
+
screens,
|
|
872
|
+
initialScreen = 0
|
|
873
|
+
} = _ref8,
|
|
874
|
+
props = _objectWithoutPropertiesLoose(_ref8, _excluded2);
|
|
875
|
+
const [currentScreen, setCurrentScreen] = useState(initialScreen);
|
|
876
|
+
const screen = screens[currentScreen];
|
|
877
|
+
const handleBack = useCallback(() => setCurrentScreen(0), []);
|
|
878
|
+
const handleNavigate = useCallback(index => setCurrentScreen(index), []);
|
|
879
|
+
return /*#__PURE__*/_jsx(Tray, _extends({}, props, {
|
|
880
|
+
accessibilityLabel: screen.title,
|
|
881
|
+
handleBarVariant: "inside",
|
|
882
|
+
title: /*#__PURE__*/_jsxs(VStack, {
|
|
883
|
+
alignItems: "flex-start",
|
|
884
|
+
children: [currentScreen > 0 && /*#__PURE__*/_jsx(IconButton, {
|
|
885
|
+
transparent: true,
|
|
886
|
+
accessibilityLabel: "Go back",
|
|
887
|
+
flush: "start",
|
|
888
|
+
name: "backArrow",
|
|
889
|
+
onPress: handleBack
|
|
890
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
891
|
+
font: "title3",
|
|
892
|
+
children: screen.title
|
|
893
|
+
})]
|
|
894
|
+
}),
|
|
895
|
+
children: screen.render({
|
|
896
|
+
onNavigate: handleNavigate
|
|
897
|
+
})
|
|
898
|
+
}));
|
|
899
|
+
}
|
|
900
|
+
const MultiScreenTrayExample = () => {
|
|
901
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
902
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), []);
|
|
903
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), []);
|
|
904
|
+
const screens = useMemo(() => [{
|
|
905
|
+
title: 'Settings',
|
|
906
|
+
render: _ref9 => {
|
|
907
|
+
let {
|
|
908
|
+
onNavigate
|
|
909
|
+
} = _ref9;
|
|
910
|
+
return /*#__PURE__*/_jsxs(ScrollView, {
|
|
911
|
+
scrollEventThrottle: 16,
|
|
912
|
+
children: [/*#__PURE__*/_jsx(ListCell, {
|
|
913
|
+
accessory: "arrow",
|
|
914
|
+
description: "Manage your account settings",
|
|
915
|
+
onPress: () => onNavigate(1),
|
|
916
|
+
spacingVariant: "condensed",
|
|
917
|
+
title: "Account"
|
|
918
|
+
}), /*#__PURE__*/_jsx(ListCell, {
|
|
919
|
+
accessory: "arrow",
|
|
920
|
+
description: "Configure notification preferences",
|
|
921
|
+
onPress: () => onNavigate(2),
|
|
922
|
+
spacingVariant: "condensed",
|
|
923
|
+
title: "Notifications"
|
|
924
|
+
}), /*#__PURE__*/_jsx(ListCell, {
|
|
925
|
+
accessory: "arrow",
|
|
926
|
+
description: "Review privacy settings",
|
|
927
|
+
onPress: () => onNavigate(3),
|
|
928
|
+
spacingVariant: "condensed",
|
|
929
|
+
title: "Privacy"
|
|
930
|
+
})]
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
}, {
|
|
934
|
+
title: 'Account',
|
|
935
|
+
render: () => /*#__PURE__*/_jsx(VStack, {
|
|
936
|
+
paddingX: 3,
|
|
937
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
938
|
+
color: "fgMuted",
|
|
939
|
+
paddingBottom: 2,
|
|
940
|
+
children: "Account settings content goes here."
|
|
941
|
+
})
|
|
942
|
+
})
|
|
943
|
+
}, {
|
|
944
|
+
title: 'Notifications',
|
|
945
|
+
render: () => /*#__PURE__*/_jsx(VStack, {
|
|
946
|
+
paddingX: 3,
|
|
947
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
948
|
+
color: "fgMuted",
|
|
949
|
+
paddingBottom: 2,
|
|
950
|
+
children: "Notification preferences content goes here."
|
|
951
|
+
})
|
|
952
|
+
})
|
|
953
|
+
}, {
|
|
954
|
+
title: 'Privacy',
|
|
955
|
+
render: () => /*#__PURE__*/_jsx(VStack, {
|
|
956
|
+
paddingX: 3,
|
|
957
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
958
|
+
color: "fgMuted",
|
|
959
|
+
paddingBottom: 2,
|
|
960
|
+
children: "Privacy settings content goes here."
|
|
961
|
+
})
|
|
962
|
+
})
|
|
963
|
+
}], []);
|
|
964
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
965
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
966
|
+
onPress: setIsTrayVisibleOn,
|
|
967
|
+
children: "Open Multi-Screen Tray"
|
|
968
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(MultiScreenTray, {
|
|
969
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
970
|
+
screens: screens
|
|
971
|
+
})]
|
|
972
|
+
});
|
|
973
|
+
};
|
|
974
|
+
function ComposedIllustrationTray(_ref0) {
|
|
975
|
+
let {
|
|
976
|
+
pictogramName,
|
|
977
|
+
title,
|
|
978
|
+
children
|
|
979
|
+
} = _ref0,
|
|
980
|
+
props = _objectWithoutPropertiesLoose(_ref0, _excluded3);
|
|
981
|
+
return /*#__PURE__*/_jsx(Tray, _extends({}, props, {
|
|
982
|
+
accessibilityLabel: title,
|
|
983
|
+
handleBarVariant: "inside",
|
|
984
|
+
title: /*#__PURE__*/_jsxs(VStack, {
|
|
985
|
+
gap: 1.5,
|
|
986
|
+
children: [/*#__PURE__*/_jsx(Pictogram, {
|
|
987
|
+
name: pictogramName
|
|
988
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
989
|
+
font: "title3",
|
|
990
|
+
children: title
|
|
991
|
+
})]
|
|
992
|
+
}),
|
|
993
|
+
children: children
|
|
994
|
+
}));
|
|
995
|
+
}
|
|
996
|
+
const ComposedIllustrationTrayExample = () => {
|
|
997
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
998
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), []);
|
|
999
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), []);
|
|
1000
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
1001
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
1002
|
+
onPress: setIsTrayVisibleOn,
|
|
1003
|
+
children: "Open Illustration Tray"
|
|
1004
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(ComposedIllustrationTray, {
|
|
1005
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
1006
|
+
pictogramName: "addWallet",
|
|
1007
|
+
title: "Section header",
|
|
1008
|
+
children: /*#__PURE__*/_jsx(VStack, {
|
|
1009
|
+
paddingX: 3,
|
|
1010
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
1011
|
+
color: "fgMuted",
|
|
1012
|
+
font: "body",
|
|
1013
|
+
paddingBottom: 2,
|
|
1014
|
+
children: "Curabitur commodo nulla vel dolor vulputate vestibulum. Nulla et nisl molestie, interdum lorem id, viverra."
|
|
1015
|
+
})
|
|
1016
|
+
})
|
|
1017
|
+
})]
|
|
1018
|
+
});
|
|
1019
|
+
};
|
|
1020
|
+
function ResponsiveTray(_ref1) {
|
|
1021
|
+
let {
|
|
1022
|
+
footer,
|
|
1023
|
+
footerLabel,
|
|
1024
|
+
children
|
|
1025
|
+
} = _ref1,
|
|
1026
|
+
props = _objectWithoutPropertiesLoose(_ref1, _excluded4);
|
|
1027
|
+
const resolvedFooter = footer != null ? footer : footerLabel ? _ref10 => {
|
|
1028
|
+
let {
|
|
1029
|
+
handleClose
|
|
1030
|
+
} = _ref10;
|
|
1031
|
+
return /*#__PURE__*/_jsx(StickyFooter, {
|
|
1032
|
+
background: "bgElevation2",
|
|
1033
|
+
paddingX: 3,
|
|
1034
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
1035
|
+
block: true,
|
|
1036
|
+
onPress: handleClose,
|
|
1037
|
+
children: footerLabel
|
|
1038
|
+
})
|
|
1039
|
+
});
|
|
1040
|
+
} : undefined;
|
|
1041
|
+
return /*#__PURE__*/_jsx(Tray, _extends({}, props, {
|
|
1042
|
+
footer: resolvedFooter,
|
|
1043
|
+
handleBarVariant: "inside",
|
|
1044
|
+
children: children
|
|
1045
|
+
}));
|
|
1046
|
+
}
|
|
1047
|
+
const ResponsiveTrayExample = () => {
|
|
1048
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
1049
|
+
const setIsTrayVisibleOff = useCallback(() => setIsTrayVisible(false), []);
|
|
1050
|
+
const setIsTrayVisibleOn = useCallback(() => setIsTrayVisible(true), []);
|
|
1051
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
1052
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
1053
|
+
onPress: setIsTrayVisibleOn,
|
|
1054
|
+
children: "Open Responsive Tray"
|
|
1055
|
+
}), isTrayVisible && /*#__PURE__*/_jsx(ResponsiveTray, {
|
|
1056
|
+
footerLabel: "Close",
|
|
1057
|
+
onCloseComplete: setIsTrayVisibleOff,
|
|
1058
|
+
title: "Example title",
|
|
1059
|
+
children: /*#__PURE__*/_jsx(VStack, {
|
|
1060
|
+
paddingX: 3,
|
|
1061
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
1062
|
+
color: "fgMuted",
|
|
1063
|
+
paddingBottom: 2,
|
|
1064
|
+
children: "Curabitur commodo nulla vel dolor vulputate vestibulum. Nulla et nisl molestie, interdum lorem id, viverra."
|
|
1065
|
+
})
|
|
1066
|
+
})
|
|
1067
|
+
})]
|
|
1068
|
+
});
|
|
1069
|
+
};
|
|
1070
|
+
export default TrayRedesignScreen;
|