@impulse-ui-native/flyout 1.0.10 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js DELETED
@@ -1,321 +0,0 @@
1
- // src/components/flyout.tsx
2
- import { useEventCallback } from "@impulse-ui-native/core";
3
- import { SafeAreaView } from "@impulse-ui-native/safe-area-view";
4
- import { useColors, useTheme as useTheme3 } from "@impulse-ui-native/theme";
5
- import { View as View3 } from "@impulse-ui-native/view";
6
- import {
7
- Fragment,
8
- memo as memo3,
9
- useEffect,
10
- useMemo as useMemo3,
11
- useRef,
12
- useState
13
- } from "react";
14
- import {
15
- Dimensions,
16
- Platform,
17
- Pressable,
18
- StyleSheet as StyleSheet3
19
- } from "react-native";
20
- import {
21
- Gesture,
22
- GestureDetector
23
- } from "react-native-gesture-handler";
24
- import Animated2, {
25
- Easing,
26
- useAnimatedScrollHandler,
27
- useAnimatedStyle,
28
- useSharedValue,
29
- withSpring,
30
- withTiming
31
- } from "react-native-reanimated";
32
- import { scheduleOnRN } from "react-native-worklets";
33
-
34
- // src/components/flyout-handle.tsx
35
- import { useTheme } from "@impulse-ui-native/theme";
36
- import { View } from "@impulse-ui-native/view";
37
- import { memo, useMemo } from "react";
38
- import { StyleSheet } from "react-native";
39
- import Animated from "react-native-reanimated";
40
- var FlyoutHandleHeight = 32;
41
- var FlyoutHandle = memo(function FlyoutHandle2(props) {
42
- const theme = useTheme();
43
- const styles = useMemo(
44
- () => themedStyles(theme, props.placement),
45
- [theme, props.placement]
46
- );
47
- return /* @__PURE__ */ React.createElement(Animated.View, { style: styles.flyoutHandleContainer }, /* @__PURE__ */ React.createElement(View, { style: styles.flyoutHandle }));
48
- });
49
- var themedStyles = function(theme, placement) {
50
- return StyleSheet.create({
51
- flyoutHandle: {
52
- alignSelf: "center",
53
- backgroundColor: theme.colors.background.primary,
54
- width: "25%",
55
- height: 6,
56
- borderRadius: theme.radii.round
57
- },
58
- flyoutHandleContainer: {
59
- position: "absolute",
60
- top: placement === "bottom" ? -FlyoutHandleHeight : void 0,
61
- bottom: placement === "top" ? -FlyoutHandleHeight : void 0,
62
- width: "100%",
63
- justifyContent: "center",
64
- alignItems: "center",
65
- height: FlyoutHandleHeight
66
- }
67
- });
68
- };
69
-
70
- // src/components/flyout-title.tsx
71
- import { useTheme as useTheme2 } from "@impulse-ui-native/theme";
72
- import { Typography } from "@impulse-ui-native/typography";
73
- import { View as View2 } from "@impulse-ui-native/view";
74
- import { memo as memo2, useMemo as useMemo2 } from "react";
75
- import { StyleSheet as StyleSheet2 } from "react-native";
76
- var FlyoutTitle = memo2(function FlyoutTitle2(props) {
77
- const theme = useTheme2();
78
- const styles = useMemo2(
79
- () => themedStyles2(theme, props.placement),
80
- [theme, props.placement]
81
- );
82
- const title = useMemo2(() => {
83
- if (typeof props.title === "string") {
84
- return /* @__PURE__ */ React.createElement(Typography.Title3, null, props.title);
85
- }
86
- return props.title;
87
- }, [props.title]);
88
- if (!props.title) {
89
- return null;
90
- }
91
- return /* @__PURE__ */ React.createElement(View2, { style: styles.container }, title);
92
- });
93
- var themedStyles2 = function(theme, placement) {
94
- return StyleSheet2.create({
95
- container: {
96
- borderTopLeftRadius: placement === "bottom" ? theme.radii.xl : void 0,
97
- borderTopRightRadius: placement === "bottom" ? theme.radii.xl : void 0,
98
- backgroundColor: theme.colors.background.secondary,
99
- padding: theme.spacing.mxs,
100
- alignItems: "center"
101
- }
102
- });
103
- };
104
-
105
- // src/components/flyout.tsx
106
- var EnterAnimationConfig = {
107
- damping: 50,
108
- stiffness: 300,
109
- mass: 1,
110
- overshootClamping: true
111
- };
112
- var ExitAnimationConfig = {
113
- duration: 150,
114
- easing: Easing.in(Easing.quad)
115
- };
116
- var StickyHeaderIndices = [0];
117
- var ScreenHeight = Dimensions.get("screen").height;
118
- var MaxHeight = ScreenHeight * 0.9;
119
- var AndroidOverScroll = Platform.OS === "android" ? { overScrollMode: "always" } : {};
120
- var Flyout = memo3(function Flyout2({
121
- children,
122
- placement = "bottom",
123
- ...props
124
- }) {
125
- const colors = useColors();
126
- const theme = useTheme3();
127
- const [measuredHeight, setMeasuredHeight] = useState(null);
128
- const [bounceEnabled, setBounceEnabled] = useState(placement !== "bottom");
129
- const [viewportHeight, setViewportHeight] = useState(0);
130
- const [contentHeight, setContentHeight] = useState(0);
131
- const didOpen = useRef(false);
132
- const canDismiss = useSharedValue(placement === "bottom");
133
- const scrollY = useSharedValue(0);
134
- const maxScrollY = useSharedValue(0);
135
- const translateY = useSharedValue(
136
- placement === "top" ? -ScreenHeight : ScreenHeight
137
- );
138
- const opacity = useSharedValue(0);
139
- const isScrollable = useMemo3(
140
- () => contentHeight > viewportHeight,
141
- [contentHeight, viewportHeight]
142
- );
143
- const onScroll = useAnimatedScrollHandler({
144
- onScroll(event) {
145
- scrollY.value = event.contentOffset.y;
146
- maxScrollY.value = Math.max(
147
- 0,
148
- event.contentSize.height - event.layoutMeasurement.height
149
- );
150
- },
151
- onMomentumEnd(event) {
152
- if (placement === "bottom" && event.contentOffset.y <= 0) {
153
- scheduleOnRN(setBounceEnabled, false);
154
- canDismiss.value = true;
155
- }
156
- if (placement === "top" && scrollY.value >= maxScrollY.value - 1) {
157
- scheduleOnRN(setBounceEnabled, false);
158
- canDismiss.value = true;
159
- }
160
- }
161
- });
162
- const onLayout = useEventCallback((event) => {
163
- if (!didOpen.current && measuredHeight === null) {
164
- const rawHeight = event.nativeEvent.layout.height;
165
- const clampedHeight = Math.min(rawHeight, MaxHeight);
166
- setMeasuredHeight(clampedHeight);
167
- translateY.value = placement === "top" ? -clampedHeight : clampedHeight;
168
- }
169
- });
170
- const onLayoutScrollview = useEventCallback((event) => {
171
- setViewportHeight(event.nativeEvent.layout.height);
172
- });
173
- const onContentSizeChange = useEventCallback(
174
- (_contentWidth, contentHeight2) => {
175
- setContentHeight(contentHeight2);
176
- }
177
- );
178
- const animateOut = useEventCallback(() => {
179
- if (measuredHeight) {
180
- const target = placement === "top" ? -measuredHeight : measuredHeight;
181
- translateY.value = withTiming(target, ExitAnimationConfig, (finished) => {
182
- if (finished && props.onCloseFinished) {
183
- scheduleOnRN(props.onCloseFinished, props.id);
184
- }
185
- });
186
- opacity.value = withTiming(0, ExitAnimationConfig);
187
- didOpen.current = false;
188
- }
189
- });
190
- const onPanGestureEnd = useEventCallback(
191
- (event) => {
192
- if (!measuredHeight) return;
193
- let shouldClose = false;
194
- if (placement === "bottom") {
195
- shouldClose = event.translationY > measuredHeight * 0.5 || event.velocityY > 1500;
196
- }
197
- if (placement === "top") {
198
- shouldClose = event.translationY < -measuredHeight * 0.5 || event.velocityY < -1500;
199
- }
200
- if (shouldClose && (canDismiss.value || !isScrollable)) {
201
- animateOut();
202
- } else {
203
- translateY.value = withSpring(0, EnterAnimationConfig);
204
- opacity.value = withSpring(0.4, EnterAnimationConfig);
205
- }
206
- }
207
- );
208
- const onPanGestureHandleEnd = useEventCallback(
209
- (event) => {
210
- onPanGestureEnd(event);
211
- if (placement === "bottom" && scrollY.value > 0) {
212
- canDismiss.value = false;
213
- }
214
- if (placement === "top" && scrollY.value < maxScrollY.value - 1) {
215
- canDismiss.value = false;
216
- }
217
- }
218
- );
219
- const onPanGestureUpdate = (event) => {
220
- if (placement === "bottom" && event.translationY < 0) {
221
- scheduleOnRN(setBounceEnabled, true);
222
- canDismiss.value = false;
223
- }
224
- if (placement === "top" && event.translationY > 0) {
225
- scheduleOnRN(setBounceEnabled, true);
226
- canDismiss.value = false;
227
- }
228
- if (placement === "bottom" && event.translationY < 0 || placement === "top" && event.translationY > 0) {
229
- return;
230
- }
231
- if (canDismiss.value || !isScrollable) {
232
- translateY.value = event.translationY;
233
- }
234
- };
235
- const onPanGestureHandleUpdate = (event) => {
236
- canDismiss.value = true;
237
- if (placement === "bottom" && event.translationY < 0 || placement === "top" && event.translationY > 0) {
238
- return;
239
- }
240
- translateY.value = event.translationY;
241
- };
242
- const panGesture = Gesture.Pan().onUpdate(onPanGestureUpdate).onEnd((event) => scheduleOnRN(onPanGestureEnd, event));
243
- const gesture = Gesture.Simultaneous(Gesture.Native(), panGesture);
244
- const handleGesture = Gesture.Pan().onUpdate(onPanGestureHandleUpdate).onEnd((event) => scheduleOnRN(onPanGestureHandleEnd, event));
245
- const animatedStyle = useAnimatedStyle(() => ({
246
- transform: [{ translateY: translateY.value }],
247
- zIndex: 100 + props.layer
248
- }));
249
- const overlayStyle = useAnimatedStyle(() => ({
250
- opacity: opacity.value,
251
- zIndex: 100 + props.layer,
252
- backgroundColor: colors.black
253
- }));
254
- const edges = useMemo3(() => {
255
- return [placement, "left", "right"];
256
- }, [placement]);
257
- const styles = useMemo3(
258
- () => themedStyles3(theme, placement),
259
- [theme, placement]
260
- );
261
- useEffect(() => {
262
- if (measuredHeight === null || didOpen.current || !props.open) return;
263
- translateY.value = withSpring(0, EnterAnimationConfig);
264
- opacity.value = withSpring(0.4, EnterAnimationConfig);
265
- didOpen.current = true;
266
- }, [measuredHeight, props.open]);
267
- return /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement(Animated2.View, { style: [StyleSheet3.absoluteFill, overlayStyle] }, /* @__PURE__ */ React.createElement(Pressable, { onPress: animateOut, style: StyleSheet3.absoluteFillObject })), /* @__PURE__ */ React.createElement(GestureDetector, { gesture }, /* @__PURE__ */ React.createElement(Animated2.View, { style: [styles.container, animatedStyle] }, /* @__PURE__ */ React.createElement(
268
- SafeAreaView,
269
- {
270
- edges,
271
- style: styles.safeAreaView,
272
- onLayout
273
- },
274
- placement === "bottom" ? /* @__PURE__ */ React.createElement(GestureDetector, { gesture: handleGesture }, /* @__PURE__ */ React.createElement(FlyoutHandle, { placement })) : null,
275
- /* @__PURE__ */ React.createElement(
276
- Animated2.ScrollView,
277
- {
278
- onLayout: onLayoutScrollview,
279
- onContentSizeChange,
280
- onScroll,
281
- scrollEventThrottle: 16,
282
- scrollEnabled: isScrollable,
283
- bounces: isScrollable && bounceEnabled,
284
- style: styles.scrollview,
285
- stickyHeaderIndices: props.title ? StickyHeaderIndices : void 0,
286
- showsHorizontalScrollIndicator: false,
287
- showsVerticalScrollIndicator: false,
288
- ...AndroidOverScroll
289
- },
290
- props.title && /* @__PURE__ */ React.createElement(FlyoutTitle, { title: props.title }),
291
- /* @__PURE__ */ React.createElement(View3, { padding: theme.spacing.sm }, children)
292
- ),
293
- placement === "top" ? /* @__PURE__ */ React.createElement(GestureDetector, { gesture: handleGesture }, /* @__PURE__ */ React.createElement(FlyoutHandle, { placement })) : null
294
- ))));
295
- });
296
- var themedStyles3 = function(theme, placement) {
297
- return StyleSheet3.create({
298
- container: {
299
- position: "absolute",
300
- [placement]: 0,
301
- left: 0,
302
- right: 0,
303
- backgroundColor: theme.colors.background.secondary,
304
- borderTopLeftRadius: placement === "bottom" ? theme.radii.xl : 0,
305
- borderTopRightRadius: placement === "bottom" ? theme.radii.xl : 0,
306
- borderBottomLeftRadius: placement === "top" ? theme.radii.xl : 0,
307
- borderBottomRightRadius: placement === "top" ? theme.radii.xl : 0
308
- },
309
- scrollview: {
310
- borderTopLeftRadius: placement === "bottom" ? theme.radii.xl : 0,
311
- borderTopRightRadius: placement === "bottom" ? theme.radii.xl : 0,
312
- borderBottomLeftRadius: placement === "top" ? theme.radii.xl : 0,
313
- borderBottomRightRadius: placement === "top" ? theme.radii.xl : 0
314
- },
315
- safeAreaView: { maxHeight: MaxHeight }
316
- });
317
- };
318
- export {
319
- Flyout
320
- };
321
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/flyout.tsx","../src/components/flyout-handle.tsx","../src/components/flyout-title.tsx"],"sourcesContent":["import { useEventCallback } from \"@impulse-ui-native/core\";\r\nimport { SafeAreaView } from \"@impulse-ui-native/safe-area-view\";\r\nimport { AppTheme, useColors, useTheme } from \"@impulse-ui-native/theme\";\r\nimport { View } from \"@impulse-ui-native/view\";\r\nimport {\r\n Fragment,\r\n memo,\r\n PropsWithChildren,\r\n useEffect,\r\n useMemo,\r\n useRef,\r\n useState,\r\n} from \"react\";\r\nimport {\r\n Dimensions,\r\n LayoutChangeEvent,\r\n Platform,\r\n Pressable,\r\n StyleSheet,\r\n} from \"react-native\";\r\nimport {\r\n Gesture,\r\n GestureDetector,\r\n GestureStateChangeEvent,\r\n GestureUpdateEvent,\r\n PanGestureHandlerEventPayload,\r\n} from \"react-native-gesture-handler\";\r\nimport Animated, {\r\n Easing,\r\n useAnimatedScrollHandler,\r\n useAnimatedStyle,\r\n useSharedValue,\r\n withSpring,\r\n withTiming,\r\n} from \"react-native-reanimated\";\r\nimport { Edge } from \"react-native-safe-area-context\";\r\nimport { scheduleOnRN } from \"react-native-worklets\";\n\r\nimport { FlyoutProps } from \"../types\";\n\r\nimport { FlyoutHandle } from \"./flyout-handle\";\r\nimport { FlyoutTitle } from \"./flyout-title\";\r\n\r\nconst EnterAnimationConfig = {\r\n damping: 50,\r\n stiffness: 300,\r\n mass: 1,\r\n overshootClamping: true,\r\n};\r\n\r\nconst ExitAnimationConfig = {\r\n duration: 150,\r\n easing: Easing.in(Easing.quad),\r\n};\r\n\r\nconst StickyHeaderIndices = [0];\r\nconst ScreenHeight = Dimensions.get(\"screen\").height;\r\nconst MaxHeight = ScreenHeight * 0.9;\r\n\r\nconst AndroidOverScroll =\r\n Platform.OS === \"android\" ? { overScrollMode: \"always\" as const } : {};\r\n\r\nexport const Flyout = memo(function Flyout({\r\n children,\r\n placement = \"bottom\",\r\n ...props\r\n}: PropsWithChildren<FlyoutProps>) {\r\n const colors = useColors();\r\n const theme = useTheme();\r\n\r\n const [measuredHeight, setMeasuredHeight] = useState<number | null>(null);\r\n const [bounceEnabled, setBounceEnabled] = useState(placement !== \"bottom\");\r\n const [viewportHeight, setViewportHeight] = useState(0);\r\n const [contentHeight, setContentHeight] = useState(0);\r\n\r\n const didOpen = useRef(false);\r\n const canDismiss = useSharedValue(placement === \"bottom\");\r\n const scrollY = useSharedValue(0);\r\n const maxScrollY = useSharedValue(0);\r\n\r\n const translateY = useSharedValue(\r\n placement === \"top\" ? -ScreenHeight : ScreenHeight\r\n );\r\n const opacity = useSharedValue(0);\r\n\r\n const isScrollable = useMemo(\r\n () => contentHeight > viewportHeight,\r\n [contentHeight, viewportHeight]\r\n );\r\n\r\n const onScroll = useAnimatedScrollHandler({\r\n onScroll(event) {\r\n scrollY.value = event.contentOffset.y;\r\n maxScrollY.value = Math.max(\r\n 0,\r\n event.contentSize.height - event.layoutMeasurement.height\r\n );\r\n },\r\n onMomentumEnd(event) {\r\n if (placement === \"bottom\" && event.contentOffset.y <= 0) {\r\n scheduleOnRN(setBounceEnabled, false);\r\n canDismiss.value = true;\r\n }\r\n\r\n if (placement === \"top\" && scrollY.value >= maxScrollY.value - 1) {\r\n scheduleOnRN(setBounceEnabled, false);\r\n canDismiss.value = true;\r\n }\r\n },\r\n });\r\n\r\n const onLayout = useEventCallback((event: LayoutChangeEvent) => {\r\n if (!didOpen.current && measuredHeight === null) {\r\n const rawHeight = event.nativeEvent.layout.height;\r\n const clampedHeight = Math.min(rawHeight, MaxHeight);\r\n setMeasuredHeight(clampedHeight);\r\n translateY.value = placement === \"top\" ? -clampedHeight : clampedHeight;\r\n }\r\n });\r\n\r\n const onLayoutScrollview = useEventCallback((event: LayoutChangeEvent) => {\r\n setViewportHeight(event.nativeEvent.layout.height);\r\n });\r\n\r\n const onContentSizeChange = useEventCallback(\r\n (_contentWidth: number, contentHeight: number) => {\r\n setContentHeight(contentHeight);\r\n }\r\n );\r\n\r\n const animateOut = useEventCallback(() => {\r\n if (measuredHeight) {\r\n const target = placement === \"top\" ? -measuredHeight : measuredHeight;\r\n\r\n translateY.value = withTiming(target, ExitAnimationConfig, (finished) => {\r\n if (finished && props.onCloseFinished) {\r\n scheduleOnRN(props.onCloseFinished, props.id);\r\n }\r\n });\r\n\r\n opacity.value = withTiming(0, ExitAnimationConfig);\r\n didOpen.current = false;\r\n }\r\n });\r\n\r\n const onPanGestureEnd = useEventCallback(\r\n (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {\r\n if (!measuredHeight) return;\r\n\r\n let shouldClose = false;\r\n\r\n if (placement === \"bottom\") {\r\n shouldClose =\r\n event.translationY > measuredHeight * 0.5 || event.velocityY > 1500;\r\n }\r\n\r\n if (placement === \"top\") {\r\n shouldClose =\r\n event.translationY < -measuredHeight * 0.5 || event.velocityY < -1500;\r\n }\r\n\r\n if (shouldClose && (canDismiss.value || !isScrollable)) {\r\n animateOut();\r\n } else {\r\n translateY.value = withSpring(0, EnterAnimationConfig);\r\n opacity.value = withSpring(0.4, EnterAnimationConfig);\r\n }\r\n }\r\n );\r\n\r\n const onPanGestureHandleEnd = useEventCallback(\r\n (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {\r\n onPanGestureEnd(event);\r\n\r\n if (placement === \"bottom\" && scrollY.value > 0) {\r\n canDismiss.value = false;\r\n }\r\n\r\n if (placement === \"top\" && scrollY.value < maxScrollY.value - 1) {\r\n canDismiss.value = false;\r\n }\r\n }\r\n );\r\n\r\n const onPanGestureUpdate = (\r\n event: GestureUpdateEvent<PanGestureHandlerEventPayload>\r\n ) => {\r\n if (placement === \"bottom\" && event.translationY < 0) {\r\n scheduleOnRN(setBounceEnabled, true);\r\n canDismiss.value = false;\r\n }\r\n\r\n if (placement === \"top\" && event.translationY > 0) {\r\n scheduleOnRN(setBounceEnabled, true);\r\n canDismiss.value = false;\r\n }\r\n\r\n if (\r\n (placement === \"bottom\" && event.translationY < 0) ||\r\n (placement === \"top\" && event.translationY > 0)\r\n ) {\r\n return;\r\n }\r\n\r\n if (canDismiss.value || !isScrollable) {\r\n translateY.value = event.translationY;\r\n }\r\n };\r\n\r\n const onPanGestureHandleUpdate = (\r\n event: GestureUpdateEvent<PanGestureHandlerEventPayload>\r\n ) => {\r\n canDismiss.value = true;\r\n\r\n if (\r\n (placement === \"bottom\" && event.translationY < 0) ||\r\n (placement === \"top\" && event.translationY > 0)\r\n ) {\r\n return;\r\n }\r\n\r\n translateY.value = event.translationY;\r\n };\r\n\r\n const panGesture = Gesture.Pan()\r\n .onUpdate(onPanGestureUpdate)\r\n .onEnd((event) => scheduleOnRN(onPanGestureEnd, event));\r\n\r\n const gesture = Gesture.Simultaneous(Gesture.Native(), panGesture);\r\n\r\n const handleGesture = Gesture.Pan()\r\n .onUpdate(onPanGestureHandleUpdate)\r\n .onEnd((event) => scheduleOnRN(onPanGestureHandleEnd, event));\r\n\r\n const animatedStyle = useAnimatedStyle(() => ({\r\n transform: [{ translateY: translateY.value }],\r\n zIndex: 100 + props.layer,\r\n }));\r\n\r\n const overlayStyle = useAnimatedStyle(() => ({\r\n opacity: opacity.value,\r\n zIndex: 100 + props.layer,\r\n backgroundColor: colors.black,\r\n }));\r\n\r\n const edges = useMemo<Edge[]>(() => {\r\n return [placement, \"left\", \"right\"];\r\n }, [placement]);\r\n\r\n const styles = useMemo(\r\n () => themedStyles(theme, placement),\r\n [theme, placement]\r\n );\r\n\r\n useEffect(() => {\r\n if (measuredHeight === null || didOpen.current || !props.open) return;\r\n\r\n translateY.value = withSpring(0, EnterAnimationConfig);\r\n opacity.value = withSpring(0.4, EnterAnimationConfig);\r\n didOpen.current = true;\r\n }, [measuredHeight, props.open]);\r\n\r\n return (\r\n <Fragment>\r\n <Animated.View style={[StyleSheet.absoluteFill, overlayStyle]}>\r\n <Pressable onPress={animateOut} style={StyleSheet.absoluteFillObject} />\r\n </Animated.View>\r\n <GestureDetector gesture={gesture}>\r\n <Animated.View style={[styles.container, animatedStyle]}>\r\n <SafeAreaView\r\n edges={edges}\r\n style={styles.safeAreaView}\r\n onLayout={onLayout}\r\n >\r\n {placement === \"bottom\" ? (\r\n <GestureDetector gesture={handleGesture}>\r\n <FlyoutHandle placement={placement} />\r\n </GestureDetector>\r\n ) : null}\r\n\r\n <Animated.ScrollView\r\n onLayout={onLayoutScrollview}\r\n onContentSizeChange={onContentSizeChange}\r\n onScroll={onScroll}\r\n scrollEventThrottle={16}\r\n scrollEnabled={isScrollable}\r\n bounces={isScrollable && bounceEnabled}\r\n style={styles.scrollview}\r\n stickyHeaderIndices={\r\n props.title ? StickyHeaderIndices : undefined\r\n }\r\n showsHorizontalScrollIndicator={false}\r\n showsVerticalScrollIndicator={false}\r\n {...AndroidOverScroll}\r\n >\r\n {props.title && <FlyoutTitle title={props.title} />}\r\n <View padding={theme.spacing.sm}>{children}</View>\r\n </Animated.ScrollView>\r\n\r\n {placement === \"top\" ? (\r\n <GestureDetector gesture={handleGesture}>\r\n <FlyoutHandle placement={placement} />\r\n </GestureDetector>\r\n ) : null}\r\n </SafeAreaView>\r\n </Animated.View>\r\n </GestureDetector>\r\n </Fragment>\r\n );\r\n});\r\n\r\nconst themedStyles = function (theme: AppTheme, placement: \"top\" | \"bottom\") {\r\n return StyleSheet.create({\r\n container: {\r\n position: \"absolute\",\r\n [placement]: 0,\r\n left: 0,\r\n right: 0,\r\n backgroundColor: theme.colors.background.secondary,\r\n borderTopLeftRadius: placement === \"bottom\" ? theme.radii.xl : 0,\r\n borderTopRightRadius: placement === \"bottom\" ? theme.radii.xl : 0,\r\n borderBottomLeftRadius: placement === \"top\" ? theme.radii.xl : 0,\r\n borderBottomRightRadius: placement === \"top\" ? theme.radii.xl : 0,\r\n },\r\n scrollview: {\r\n borderTopLeftRadius: placement === \"bottom\" ? theme.radii.xl : 0,\r\n borderTopRightRadius: placement === \"bottom\" ? theme.radii.xl : 0,\r\n borderBottomLeftRadius: placement === \"top\" ? theme.radii.xl : 0,\r\n borderBottomRightRadius: placement === \"top\" ? theme.radii.xl : 0,\r\n },\r\n safeAreaView: { maxHeight: MaxHeight },\r\n });\r\n};\r\n","import { AppTheme, useTheme } from \"@impulse-ui-native/theme\";\r\nimport { View } from \"@impulse-ui-native/view\";\r\nimport { memo, useMemo } from \"react\";\r\nimport { StyleSheet } from \"react-native\";\r\nimport Animated from \"react-native-reanimated\";\r\n\r\nconst FlyoutHandleHeight = 32;\r\n\r\ninterface FlyoutHandleProps {\r\n placement: \"top\" | \"bottom\";\r\n}\r\n\r\nexport const FlyoutHandle = memo(function FlyoutHandle(\r\n props: FlyoutHandleProps\r\n) {\r\n const theme = useTheme();\r\n\r\n const styles = useMemo(\r\n () => themedStyles(theme, props.placement),\r\n [theme, props.placement]\r\n );\r\n\r\n return (\r\n <Animated.View style={styles.flyoutHandleContainer}>\r\n <View style={styles.flyoutHandle} />\r\n </Animated.View>\r\n );\r\n});\r\n\r\nconst themedStyles = function (theme: AppTheme, placement: \"top\" | \"bottom\") {\r\n return StyleSheet.create({\r\n flyoutHandle: {\r\n alignSelf: \"center\",\r\n backgroundColor: theme.colors.background.primary,\r\n width: \"25%\",\r\n height: 6,\r\n borderRadius: theme.radii.round,\r\n },\r\n flyoutHandleContainer: {\r\n position: \"absolute\",\r\n top: placement === \"bottom\" ? -FlyoutHandleHeight : undefined,\r\n bottom: placement === \"top\" ? -FlyoutHandleHeight : undefined,\r\n width: \"100%\",\r\n justifyContent: \"center\",\r\n alignItems: \"center\",\r\n height: FlyoutHandleHeight,\r\n },\r\n });\r\n};\r\n","import { AppTheme, useTheme } from \"@impulse-ui-native/theme\";\r\nimport { Typography } from \"@impulse-ui-native/typography\";\r\nimport { View } from \"@impulse-ui-native/view\";\r\nimport { memo, ReactNode, useMemo } from \"react\";\r\nimport { StyleSheet } from \"react-native\";\r\n\r\ninterface FlyoutTitleProps {\r\n title?: ReactNode | string;\r\n placement?: \"top\" | \"bottom\";\r\n}\r\n\r\nexport const FlyoutTitle = memo(function FlyoutTitle(props: FlyoutTitleProps) {\r\n const theme = useTheme();\r\n\r\n const styles = useMemo(\r\n () => themedStyles(theme, props.placement),\r\n [theme, props.placement]\r\n );\r\n\r\n const title = useMemo(() => {\r\n if (typeof props.title === \"string\") {\r\n return <Typography.Title3>{props.title}</Typography.Title3>;\r\n }\r\n\r\n return props.title;\r\n }, [props.title]);\r\n\r\n if (!props.title) {\r\n return null;\r\n }\r\n\r\n return <View style={styles.container}>{title}</View>;\r\n});\r\n\r\nconst themedStyles = function (theme: AppTheme, placement?: \"top\" | \"bottom\") {\r\n return StyleSheet.create({\r\n container: {\r\n borderTopLeftRadius: placement === \"bottom\" ? theme.radii.xl : undefined,\r\n borderTopRightRadius: placement === \"bottom\" ? theme.radii.xl : undefined,\r\n backgroundColor: theme.colors.background.secondary,\r\n padding: theme.spacing.mxs,\r\n alignItems: \"center\",\r\n },\r\n });\r\n};\r\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAmB,WAAW,YAAAA,iBAAgB;AAC9C,SAAS,QAAAC,aAAY;AACrB;AAAA,EACE;AAAA,EACA,QAAAC;AAAA,EAEA;AAAA,EACA,WAAAC;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA,cAAAC;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP,OAAOC;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;;;ACpC7B,SAAmB,gBAAgB;AACnC,SAAS,YAAY;AACrB,SAAS,MAAM,eAAe;AAC9B,SAAS,kBAAkB;AAC3B,OAAO,cAAc;AAErB,IAAM,qBAAqB;AAMpB,IAAM,eAAe,KAAK,SAASC,cACxC,OACA;AACA,QAAM,QAAQ,SAAS;AAEvB,QAAM,SAAS;AAAA,IACb,MAAM,aAAa,OAAO,MAAM,SAAS;AAAA,IACzC,CAAC,OAAO,MAAM,SAAS;AAAA,EACzB;AAEA,SACE,oCAAC,SAAS,MAAT,EAAc,OAAO,OAAO,yBAC3B,oCAAC,QAAK,OAAO,OAAO,cAAc,CACpC;AAEJ,CAAC;AAED,IAAM,eAAe,SAAU,OAAiB,WAA6B;AAC3E,SAAO,WAAW,OAAO;AAAA,IACvB,cAAc;AAAA,MACZ,WAAW;AAAA,MACX,iBAAiB,MAAM,OAAO,WAAW;AAAA,MACzC,OAAO;AAAA,MACP,QAAQ;AAAA,MAC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EAAE,WAAW,UAAU;AAAA,EACvC,CAAC;AACH;","names":["useTheme","View","memo","useMemo","StyleSheet","Animated","FlyoutHandle","useTheme","View","memo","useMemo","StyleSheet","FlyoutTitle","themedStyles","memo","Flyout","useTheme","useMemo","contentHeight","themedStyles","Animated","StyleSheet","View"]}
@@ -1,49 +0,0 @@
1
- import { AppTheme, useTheme } from "@impulse-ui-native/theme";
2
- import { View } from "@impulse-ui-native/view";
3
- import { memo, useMemo } from "react";
4
- import { StyleSheet } from "react-native";
5
- import Animated from "react-native-reanimated";
6
-
7
- const FlyoutHandleHeight = 32;
8
-
9
- interface FlyoutHandleProps {
10
- placement: "top" | "bottom";
11
- }
12
-
13
- export const FlyoutHandle = memo(function FlyoutHandle(
14
- props: FlyoutHandleProps
15
- ) {
16
- const theme = useTheme();
17
-
18
- const styles = useMemo(
19
- () => themedStyles(theme, props.placement),
20
- [theme, props.placement]
21
- );
22
-
23
- return (
24
- <Animated.View style={styles.flyoutHandleContainer}>
25
- <View style={styles.flyoutHandle} />
26
- </Animated.View>
27
- );
28
- });
29
-
30
- const themedStyles = function (theme: AppTheme, placement: "top" | "bottom") {
31
- return StyleSheet.create({
32
- flyoutHandle: {
33
- alignSelf: "center",
34
- backgroundColor: theme.colors.background.primary,
35
- width: "25%",
36
- height: 6,
37
- borderRadius: theme.radii.round,
38
- },
39
- flyoutHandleContainer: {
40
- position: "absolute",
41
- top: placement === "bottom" ? -FlyoutHandleHeight : undefined,
42
- bottom: placement === "top" ? -FlyoutHandleHeight : undefined,
43
- width: "100%",
44
- justifyContent: "center",
45
- alignItems: "center",
46
- height: FlyoutHandleHeight,
47
- },
48
- });
49
- };
@@ -1,45 +0,0 @@
1
- import { AppTheme, useTheme } from "@impulse-ui-native/theme";
2
- import { Typography } from "@impulse-ui-native/typography";
3
- import { View } from "@impulse-ui-native/view";
4
- import { memo, ReactNode, useMemo } from "react";
5
- import { StyleSheet } from "react-native";
6
-
7
- interface FlyoutTitleProps {
8
- title?: ReactNode | string;
9
- placement?: "top" | "bottom";
10
- }
11
-
12
- export const FlyoutTitle = memo(function FlyoutTitle(props: FlyoutTitleProps) {
13
- const theme = useTheme();
14
-
15
- const styles = useMemo(
16
- () => themedStyles(theme, props.placement),
17
- [theme, props.placement]
18
- );
19
-
20
- const title = useMemo(() => {
21
- if (typeof props.title === "string") {
22
- return <Typography.Title3>{props.title}</Typography.Title3>;
23
- }
24
-
25
- return props.title;
26
- }, [props.title]);
27
-
28
- if (!props.title) {
29
- return null;
30
- }
31
-
32
- return <View style={styles.container}>{title}</View>;
33
- });
34
-
35
- const themedStyles = function (theme: AppTheme, placement?: "top" | "bottom") {
36
- return StyleSheet.create({
37
- container: {
38
- borderTopLeftRadius: placement === "bottom" ? theme.radii.xl : undefined,
39
- borderTopRightRadius: placement === "bottom" ? theme.radii.xl : undefined,
40
- backgroundColor: theme.colors.background.secondary,
41
- padding: theme.spacing.mxs,
42
- alignItems: "center",
43
- },
44
- });
45
- };