@mrmeg/expo-ui 0.1.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 (112) hide show
  1. package/README.md +96 -0
  2. package/dist/components/Accordion.d.ts +54 -0
  3. package/dist/components/Accordion.js +149 -0
  4. package/dist/components/Alert.d.ts +30 -0
  5. package/dist/components/Alert.js +25 -0
  6. package/dist/components/AnimatedView.d.ts +55 -0
  7. package/dist/components/AnimatedView.js +39 -0
  8. package/dist/components/Badge.d.ts +23 -0
  9. package/dist/components/Badge.js +74 -0
  10. package/dist/components/BottomSheet.d.ts +74 -0
  11. package/dist/components/BottomSheet.js +513 -0
  12. package/dist/components/Button.d.ts +129 -0
  13. package/dist/components/Button.js +216 -0
  14. package/dist/components/Card.d.ts +42 -0
  15. package/dist/components/Card.js +126 -0
  16. package/dist/components/Checkbox.d.ts +39 -0
  17. package/dist/components/Checkbox.js +96 -0
  18. package/dist/components/Collapsible.d.ts +67 -0
  19. package/dist/components/Collapsible.js +38 -0
  20. package/dist/components/Dialog.d.ts +140 -0
  21. package/dist/components/Dialog.js +167 -0
  22. package/dist/components/DismissKeyboard.d.ts +15 -0
  23. package/dist/components/DismissKeyboard.js +13 -0
  24. package/dist/components/Drawer.d.ts +74 -0
  25. package/dist/components/Drawer.js +423 -0
  26. package/dist/components/DropdownMenu.d.ts +120 -0
  27. package/dist/components/DropdownMenu.js +211 -0
  28. package/dist/components/EmptyState.d.ts +42 -0
  29. package/dist/components/EmptyState.js +58 -0
  30. package/dist/components/ErrorBoundary.d.ts +53 -0
  31. package/dist/components/ErrorBoundary.js +75 -0
  32. package/dist/components/Icon.d.ts +46 -0
  33. package/dist/components/Icon.js +40 -0
  34. package/dist/components/InputOTP.d.ts +72 -0
  35. package/dist/components/InputOTP.js +155 -0
  36. package/dist/components/Label.d.ts +61 -0
  37. package/dist/components/Label.js +72 -0
  38. package/dist/components/MaxWidthContainer.d.ts +58 -0
  39. package/dist/components/MaxWidthContainer.js +64 -0
  40. package/dist/components/Notification.d.ts +26 -0
  41. package/dist/components/Notification.js +230 -0
  42. package/dist/components/Popover.d.ts +79 -0
  43. package/dist/components/Popover.js +91 -0
  44. package/dist/components/Progress.d.ts +28 -0
  45. package/dist/components/Progress.js +107 -0
  46. package/dist/components/RadioGroup.d.ts +65 -0
  47. package/dist/components/RadioGroup.js +142 -0
  48. package/dist/components/Select.d.ts +88 -0
  49. package/dist/components/Select.js +172 -0
  50. package/dist/components/Separator.d.ts +83 -0
  51. package/dist/components/Separator.js +85 -0
  52. package/dist/components/Skeleton.d.ts +68 -0
  53. package/dist/components/Skeleton.js +99 -0
  54. package/dist/components/Slider.d.ts +24 -0
  55. package/dist/components/Slider.js +162 -0
  56. package/dist/components/StatusBar.d.ts +1 -0
  57. package/dist/components/StatusBar.js +19 -0
  58. package/dist/components/StyledText.d.ts +161 -0
  59. package/dist/components/StyledText.js +193 -0
  60. package/dist/components/Switch.d.ts +44 -0
  61. package/dist/components/Switch.js +129 -0
  62. package/dist/components/Tabs.d.ts +31 -0
  63. package/dist/components/Tabs.js +127 -0
  64. package/dist/components/TextInput.d.ts +120 -0
  65. package/dist/components/TextInput.js +263 -0
  66. package/dist/components/Toggle.d.ts +106 -0
  67. package/dist/components/Toggle.js +150 -0
  68. package/dist/components/ToggleGroup.d.ts +80 -0
  69. package/dist/components/ToggleGroup.js +189 -0
  70. package/dist/components/Tooltip.d.ts +121 -0
  71. package/dist/components/Tooltip.js +132 -0
  72. package/dist/components/index.d.ts +35 -0
  73. package/dist/components/index.js +35 -0
  74. package/dist/constants/colors.d.ts +82 -0
  75. package/dist/constants/colors.js +116 -0
  76. package/dist/constants/fonts.d.ts +32 -0
  77. package/dist/constants/fonts.js +91 -0
  78. package/dist/constants/index.d.ts +3 -0
  79. package/dist/constants/index.js +3 -0
  80. package/dist/constants/spacing.d.ts +40 -0
  81. package/dist/constants/spacing.js +48 -0
  82. package/dist/hooks/index.d.ts +6 -0
  83. package/dist/hooks/index.js +6 -0
  84. package/dist/hooks/useDimensions.d.ts +19 -0
  85. package/dist/hooks/useDimensions.js +55 -0
  86. package/dist/hooks/useReduceMotion.d.ts +5 -0
  87. package/dist/hooks/useReduceMotion.js +64 -0
  88. package/dist/hooks/useResources.d.ts +12 -0
  89. package/dist/hooks/useResources.js +56 -0
  90. package/dist/hooks/useScalePress.d.ts +57 -0
  91. package/dist/hooks/useScalePress.js +55 -0
  92. package/dist/hooks/useStaggeredEntrance.d.ts +67 -0
  93. package/dist/hooks/useStaggeredEntrance.js +74 -0
  94. package/dist/hooks/useTheme.d.ts +88 -0
  95. package/dist/hooks/useTheme.js +328 -0
  96. package/dist/index.d.ts +5 -0
  97. package/dist/index.js +5 -0
  98. package/dist/lib/animations.d.ts +1 -0
  99. package/dist/lib/animations.js +3 -0
  100. package/dist/lib/haptics.d.ts +3 -0
  101. package/dist/lib/haptics.js +29 -0
  102. package/dist/lib/index.d.ts +3 -0
  103. package/dist/lib/index.js +3 -0
  104. package/dist/lib/sentry.d.ts +16 -0
  105. package/dist/lib/sentry.js +55 -0
  106. package/dist/state/globalUIStore.d.ts +30 -0
  107. package/dist/state/globalUIStore.js +8 -0
  108. package/dist/state/index.d.ts +2 -0
  109. package/dist/state/index.js +2 -0
  110. package/dist/state/themeStore.d.ts +6 -0
  111. package/dist/state/themeStore.js +38 -0
  112. package/package.json +92 -0
@@ -0,0 +1,140 @@
1
+ import * as React from "react";
2
+ import { View, ViewProps } from "react-native";
3
+ import * as DialogPrimitive from "@rn-primitives/dialog";
4
+ import * as AlertDialogPrimitive from "@rn-primitives/alert-dialog";
5
+ declare const DialogTrigger: {
6
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
7
+ asChild?: boolean;
8
+ } & {
9
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
10
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
11
+ } & React.RefAttributes<View>): React.JSX.Element;
12
+ displayName: string;
13
+ };
14
+ declare const DialogClose: {
15
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
16
+ asChild?: boolean;
17
+ } & {
18
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
19
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
20
+ } & React.RefAttributes<View>): React.JSX.Element;
21
+ displayName: string;
22
+ };
23
+ interface DialogProps extends DialogPrimitive.RootProps {
24
+ children: React.ReactNode;
25
+ }
26
+ declare function DialogRoot({ children, ...props }: DialogProps): import("react/jsx-runtime").JSX.Element;
27
+ interface DialogContentProps extends DialogPrimitive.ContentProps {
28
+ portalHost?: string;
29
+ }
30
+ declare function DialogContent({ portalHost, style, children, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element;
31
+ declare function DialogHeader({ children, style, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
32
+ declare function DialogFooter({ children, style, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
33
+ declare function DialogTitle({ children, style, ...props }: DialogPrimitive.TitleProps & {
34
+ children: React.ReactNode;
35
+ }): import("react/jsx-runtime").JSX.Element;
36
+ declare function DialogDescription({ children, style, ...props }: DialogPrimitive.DescriptionProps & {
37
+ children: React.ReactNode;
38
+ }): import("react/jsx-runtime").JSX.Element;
39
+ declare const Dialog: typeof DialogRoot & {
40
+ Trigger: {
41
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
42
+ asChild?: boolean;
43
+ } & {
44
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
45
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
46
+ } & React.RefAttributes<View>): React.JSX.Element;
47
+ displayName: string;
48
+ };
49
+ Content: typeof DialogContent;
50
+ Header: typeof DialogHeader;
51
+ Footer: typeof DialogFooter;
52
+ Title: typeof DialogTitle;
53
+ Description: typeof DialogDescription;
54
+ Close: {
55
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
56
+ asChild?: boolean;
57
+ } & {
58
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
59
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
60
+ } & React.RefAttributes<View>): React.JSX.Element;
61
+ displayName: string;
62
+ };
63
+ };
64
+ declare const AlertDialogTrigger: {
65
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
66
+ asChild?: boolean;
67
+ } & {
68
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
69
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
70
+ } & React.RefAttributes<View>): React.JSX.Element;
71
+ displayName: string;
72
+ };
73
+ declare const AlertDialogAction: {
74
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
75
+ asChild?: boolean;
76
+ } & {
77
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
78
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
79
+ } & React.RefAttributes<View>): React.JSX.Element;
80
+ displayName: string;
81
+ };
82
+ declare const AlertDialogCancel: {
83
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
84
+ asChild?: boolean;
85
+ } & {
86
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
87
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
88
+ } & React.RefAttributes<View>): React.JSX.Element;
89
+ displayName: string;
90
+ };
91
+ interface AlertDialogProps extends AlertDialogPrimitive.RootProps {
92
+ children: React.ReactNode;
93
+ }
94
+ declare function AlertDialogRoot({ children, ...props }: AlertDialogProps): import("react/jsx-runtime").JSX.Element;
95
+ interface AlertDialogContentProps extends AlertDialogPrimitive.ContentProps {
96
+ portalHost?: string;
97
+ }
98
+ declare function AlertDialogContent({ portalHost, style, children, ...props }: AlertDialogContentProps): import("react/jsx-runtime").JSX.Element;
99
+ declare function AlertDialogTitle({ children, style, ...props }: AlertDialogPrimitive.TitleProps & {
100
+ children: React.ReactNode;
101
+ }): import("react/jsx-runtime").JSX.Element;
102
+ declare function AlertDialogDescription({ children, style, ...props }: AlertDialogPrimitive.DescriptionProps & {
103
+ children: React.ReactNode;
104
+ }): import("react/jsx-runtime").JSX.Element;
105
+ declare const AlertDialog: typeof AlertDialogRoot & {
106
+ Trigger: {
107
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
108
+ asChild?: boolean;
109
+ } & {
110
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
111
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
112
+ } & React.RefAttributes<View>): React.JSX.Element;
113
+ displayName: string;
114
+ };
115
+ Content: typeof AlertDialogContent;
116
+ Header: typeof DialogHeader;
117
+ Footer: typeof DialogFooter;
118
+ Title: typeof AlertDialogTitle;
119
+ Description: typeof AlertDialogDescription;
120
+ Action: {
121
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
122
+ asChild?: boolean;
123
+ } & {
124
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
125
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
126
+ } & React.RefAttributes<View>): React.JSX.Element;
127
+ displayName: string;
128
+ };
129
+ Cancel: {
130
+ ({ asChild, onPress: onPressProp, disabled, ref, ...props }: Omit<import("react-native").PressableProps & React.RefAttributes<View>, "ref"> & {
131
+ asChild?: boolean;
132
+ } & {
133
+ onKeyDown?: (ev: React.KeyboardEvent) => void;
134
+ onKeyUp?: (ev: React.KeyboardEvent) => void;
135
+ } & React.RefAttributes<View>): React.JSX.Element;
136
+ displayName: string;
137
+ };
138
+ };
139
+ export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, DialogClose, AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
140
+ export type { DialogProps, DialogContentProps, AlertDialogProps, AlertDialogContentProps, };
@@ -0,0 +1,167 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Platform, StyleSheet, View } from "react-native";
4
+ import { FullWindowOverlay as RNFullWindowOverlay } from "react-native-screens";
5
+ import * as DialogPrimitive from "@rn-primitives/dialog";
6
+ import * as AlertDialogPrimitive from "@rn-primitives/alert-dialog";
7
+ import { AnimatedView } from "./AnimatedView";
8
+ import { TextClassContext, TextColorContext } from "./StyledText";
9
+ import { StyledText } from "./StyledText";
10
+ import { useTheme } from "../hooks/useTheme";
11
+ import { spacing } from "../constants/spacing";
12
+ import { palette } from "../constants/colors";
13
+ const FullWindowOverlay = Platform.OS === "ios" ? RNFullWindowOverlay : React.Fragment;
14
+ // ============================================================================
15
+ // Dialog
16
+ // ============================================================================
17
+ const DialogTrigger = DialogPrimitive.Trigger;
18
+ const DialogClose = DialogPrimitive.Close;
19
+ function DialogRoot({ children, ...props }) {
20
+ return _jsx(DialogPrimitive.Root, { ...props, children: children });
21
+ }
22
+ function DialogContent({ portalHost, style, children, ...props }) {
23
+ const { theme, getShadowStyle, getContrastingColor } = useTheme();
24
+ const textColor = getContrastingColor(theme.colors.background, palette.white, palette.black);
25
+ return (_jsx(DialogPrimitive.Portal, { hostName: portalHost, children: _jsx(FullWindowOverlay, { children: _jsx(DialogPrimitive.Overlay, { style: StyleSheet.flatten([
26
+ StyleSheet.absoluteFill,
27
+ { backgroundColor: theme.colors.overlay },
28
+ Platform.OS === "web" && { zIndex: 50 },
29
+ ]), children: _jsx(AnimatedView, { type: "fade", enterDuration: 200, children: _jsx(View, { style: overlayStyles.centeredContainer, children: _jsx(AnimatedView, { type: "scale", enterDuration: 250, children: _jsx(TextColorContext.Provider, { value: textColor, children: _jsx(TextClassContext.Provider, { value: "", children: _jsx(DialogPrimitive.Content, { style: StyleSheet.flatten([
30
+ {
31
+ backgroundColor: theme.colors.background,
32
+ borderColor: theme.colors.border,
33
+ borderWidth: 1,
34
+ borderRadius: spacing.radiusLg,
35
+ padding: spacing.lg,
36
+ width: "90%",
37
+ maxWidth: 450,
38
+ maxHeight: "85%",
39
+ ...getShadowStyle("soft"),
40
+ },
41
+ style,
42
+ ]), ...props, children: children }) }) }) }) }) }) }) }) }));
43
+ }
44
+ function DialogHeader({ children, style, ...props }) {
45
+ return (_jsx(View, { style: StyleSheet.flatten([{ gap: spacing.xs, marginBottom: spacing.md }, style]), ...props, children: children }));
46
+ }
47
+ function DialogFooter({ children, style, ...props }) {
48
+ return (_jsx(View, { style: StyleSheet.flatten([
49
+ {
50
+ flexDirection: "row",
51
+ justifyContent: "flex-end",
52
+ gap: spacing.sm,
53
+ marginTop: spacing.lg,
54
+ },
55
+ style,
56
+ ]), ...props, children: children }));
57
+ }
58
+ function DialogTitle({ children, style, ...props }) {
59
+ const { theme } = useTheme();
60
+ return (_jsx(DialogPrimitive.Title, { asChild: true, children: _jsx(StyledText, { fontWeight: "semibold", style: StyleSheet.flatten([
61
+ {
62
+ fontSize: 18,
63
+ lineHeight: 24,
64
+ letterSpacing: -0.3,
65
+ color: theme.colors.text,
66
+ },
67
+ style,
68
+ ]), ...props, children: children }) }));
69
+ }
70
+ function DialogDescription({ children, style, ...props }) {
71
+ const { theme } = useTheme();
72
+ return (_jsx(DialogPrimitive.Description, { asChild: true, children: _jsx(StyledText, { style: StyleSheet.flatten([
73
+ {
74
+ fontSize: 14,
75
+ lineHeight: 20,
76
+ color: theme.colors.textDim,
77
+ },
78
+ style,
79
+ ]), ...props, children: children }) }));
80
+ }
81
+ const Dialog = Object.assign(DialogRoot, {
82
+ Trigger: DialogTrigger,
83
+ Content: DialogContent,
84
+ Header: DialogHeader,
85
+ Footer: DialogFooter,
86
+ Title: DialogTitle,
87
+ Description: DialogDescription,
88
+ Close: DialogClose,
89
+ });
90
+ // ============================================================================
91
+ // AlertDialog
92
+ // ============================================================================
93
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
94
+ const AlertDialogAction = AlertDialogPrimitive.Action;
95
+ const AlertDialogCancel = AlertDialogPrimitive.Cancel;
96
+ function AlertDialogRoot({ children, ...props }) {
97
+ return _jsx(AlertDialogPrimitive.Root, { ...props, children: children });
98
+ }
99
+ function AlertDialogContent({ portalHost, style, children, ...props }) {
100
+ const { theme, getShadowStyle, getContrastingColor } = useTheme();
101
+ const textColor = getContrastingColor(theme.colors.background, palette.white, palette.black);
102
+ return (_jsx(AlertDialogPrimitive.Portal, { hostName: portalHost, children: _jsx(FullWindowOverlay, { children: _jsx(AlertDialogPrimitive.Overlay, { style: StyleSheet.flatten([
103
+ StyleSheet.absoluteFill,
104
+ { backgroundColor: theme.colors.overlay },
105
+ Platform.OS === "web" && { zIndex: 52 },
106
+ ]), children: _jsx(AnimatedView, { type: "fade", enterDuration: 200, children: _jsx(View, { style: overlayStyles.centeredContainer, children: _jsx(AnimatedView, { type: "scale", enterDuration: 250, children: _jsx(TextColorContext.Provider, { value: textColor, children: _jsx(TextClassContext.Provider, { value: "", children: _jsx(AlertDialogPrimitive.Content, { style: StyleSheet.flatten([
107
+ {
108
+ backgroundColor: theme.colors.background,
109
+ borderColor: theme.colors.border,
110
+ borderWidth: 1,
111
+ borderRadius: spacing.radiusLg,
112
+ padding: spacing.lg,
113
+ width: "90%",
114
+ maxWidth: 450,
115
+ maxHeight: "85%",
116
+ ...getShadowStyle("soft"),
117
+ },
118
+ style,
119
+ ]), ...props, children: children }) }) }) }) }) }) }) }) }));
120
+ }
121
+ function AlertDialogTitle({ children, style, ...props }) {
122
+ const { theme } = useTheme();
123
+ return (_jsx(AlertDialogPrimitive.Title, { asChild: true, children: _jsx(StyledText, { fontWeight: "semibold", style: StyleSheet.flatten([
124
+ {
125
+ fontSize: 18,
126
+ lineHeight: 24,
127
+ letterSpacing: -0.3,
128
+ color: theme.colors.text,
129
+ },
130
+ style,
131
+ ]), ...props, children: children }) }));
132
+ }
133
+ function AlertDialogDescription({ children, style, ...props }) {
134
+ const { theme } = useTheme();
135
+ return (_jsx(AlertDialogPrimitive.Description, { asChild: true, children: _jsx(StyledText, { style: StyleSheet.flatten([
136
+ {
137
+ fontSize: 14,
138
+ lineHeight: 20,
139
+ color: theme.colors.textDim,
140
+ },
141
+ style,
142
+ ]), ...props, children: children }) }));
143
+ }
144
+ const AlertDialog = Object.assign(AlertDialogRoot, {
145
+ Trigger: AlertDialogTrigger,
146
+ Content: AlertDialogContent,
147
+ Header: DialogHeader,
148
+ Footer: DialogFooter,
149
+ Title: AlertDialogTitle,
150
+ Description: AlertDialogDescription,
151
+ Action: AlertDialogAction,
152
+ Cancel: AlertDialogCancel,
153
+ });
154
+ // ============================================================================
155
+ // Shared styles
156
+ // ============================================================================
157
+ const overlayStyles = StyleSheet.create({
158
+ centeredContainer: {
159
+ flex: 1,
160
+ justifyContent: "center",
161
+ alignItems: "center",
162
+ },
163
+ });
164
+ // ============================================================================
165
+ // Exports
166
+ // ============================================================================
167
+ export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, DialogClose, AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ type Props = {
4
+ children: React.ReactNode;
5
+ style?: StyleProp<ViewStyle>;
6
+ /** Enable keyboard avoiding behavior */
7
+ avoidKeyboard?: boolean;
8
+ /** Enable scrolling */
9
+ scrollable?: boolean;
10
+ };
11
+ /**
12
+ * @returns Wrapper for a view that dismisses the keyboard when tapped outside of a text input
13
+ */
14
+ export declare const DismissKeyboard: ({ children, style, avoidKeyboard, scrollable }: Props) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Pressable, Keyboard, Platform, KeyboardAvoidingView, ScrollView } from "react-native";
3
+ /**
4
+ * @returns Wrapper for a view that dismisses the keyboard when tapped outside of a text input
5
+ */
6
+ export const DismissKeyboard = ({ children, style, avoidKeyboard = true, scrollable = true }) => {
7
+ const handlePress = () => Platform.OS !== "web" && Keyboard.dismiss();
8
+ const content = scrollable ? (_jsx(ScrollView, { style: { flex: 1 }, contentContainerStyle: { flexGrow: 1, justifyContent: "center" }, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, children: children })) : (children);
9
+ if (!avoidKeyboard) {
10
+ return (_jsx(Pressable, { onPress: handlePress, accessible: false, style: { flex: 1 }, children: content }));
11
+ }
12
+ return (_jsx(KeyboardAvoidingView, { style: [{ flex: 1, width: "100%" }, style], behavior: Platform.OS === "ios" ? "padding" : "height", keyboardVerticalOffset: Platform.OS === "ios" ? 0 : 0, children: _jsx(Pressable, { onPress: handlePress, accessible: false, style: { flex: 1 }, children: content }) }));
13
+ };
@@ -0,0 +1,74 @@
1
+ import React from "react";
2
+ import { ViewProps, StyleProp, ViewStyle } from "react-native";
3
+ type DrawerSide = "left" | "right";
4
+ interface DrawerProps {
5
+ /** Controlled open state */
6
+ open?: boolean;
7
+ /** Callback when open state changes */
8
+ onOpenChange?: (open: boolean) => void;
9
+ /** Default open state for uncontrolled mode */
10
+ defaultOpen?: boolean;
11
+ /** Which side the drawer appears from */
12
+ side?: DrawerSide;
13
+ /** Drawer width in pixels or percentage string */
14
+ width?: number | `${number}%`;
15
+ /** Whether to close when backdrop is pressed */
16
+ closeOnBackdropPress?: boolean;
17
+ /** Children components */
18
+ children: React.ReactNode;
19
+ }
20
+ interface DrawerTriggerProps {
21
+ /** Use child component as trigger */
22
+ asChild?: boolean;
23
+ /** Children components */
24
+ children: React.ReactNode;
25
+ /** Optional style override */
26
+ style?: StyleProp<ViewStyle>;
27
+ }
28
+ interface DrawerContentProps extends ViewProps {
29
+ /** Whether to enable swipe gestures (native only) */
30
+ swipeEnabled?: boolean;
31
+ /** Swipe threshold to trigger close (0-1, percentage of width) */
32
+ swipeThreshold?: number;
33
+ /** Velocity threshold for quick swipe */
34
+ velocityThreshold?: number;
35
+ /** Optional style override */
36
+ style?: StyleProp<ViewStyle>;
37
+ /** Children components */
38
+ children: React.ReactNode;
39
+ }
40
+ interface DrawerHeaderProps extends ViewProps {
41
+ children: React.ReactNode;
42
+ }
43
+ interface DrawerBodyProps extends ViewProps {
44
+ children: React.ReactNode;
45
+ }
46
+ interface DrawerFooterProps extends ViewProps {
47
+ children: React.ReactNode;
48
+ }
49
+ declare function DrawerRoot({ open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, side, width, closeOnBackdropPress, children, }: DrawerProps): import("react/jsx-runtime").JSX.Element;
50
+ declare function DrawerTrigger({ asChild, children, style: styleOverride }: DrawerTriggerProps): import("react/jsx-runtime").JSX.Element;
51
+ declare function DrawerContent({ swipeEnabled, swipeThreshold, velocityThreshold, style: styleOverride, children, ...props }: DrawerContentProps): import("react/jsx-runtime").JSX.Element | null;
52
+ declare function DrawerHeader({ children, style, ...props }: DrawerHeaderProps): import("react/jsx-runtime").JSX.Element;
53
+ declare function DrawerBody({ children, style, ...props }: DrawerBodyProps): import("react/jsx-runtime").JSX.Element;
54
+ declare function DrawerFooter({ children, style, ...props }: DrawerFooterProps): import("react/jsx-runtime").JSX.Element;
55
+ declare function useDrawerClose(): () => void;
56
+ interface DrawerCloseProps {
57
+ /** Use child component as close button */
58
+ asChild?: boolean;
59
+ /** Children components */
60
+ children: React.ReactNode;
61
+ /** Optional style override */
62
+ style?: StyleProp<ViewStyle>;
63
+ }
64
+ declare function DrawerClose({ asChild, children, style: styleOverride }: DrawerCloseProps): import("react/jsx-runtime").JSX.Element;
65
+ declare const Drawer: typeof DrawerRoot & {
66
+ Trigger: typeof DrawerTrigger;
67
+ Content: typeof DrawerContent;
68
+ Header: typeof DrawerHeader;
69
+ Body: typeof DrawerBody;
70
+ Footer: typeof DrawerFooter;
71
+ Close: typeof DrawerClose;
72
+ };
73
+ export { Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerBody, DrawerFooter, DrawerClose, useDrawerClose, };
74
+ export type { DrawerProps, DrawerTriggerProps, DrawerContentProps, DrawerHeaderProps, DrawerBodyProps, DrawerFooterProps, DrawerCloseProps, };