@limetry/ui 1.2.58 → 1.2.60
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/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React Native drawer panel for Expo / mobile consumers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Presented as a modal so menu presses are not lost under the page overlay.
|
|
5
|
+
* Re-exports navigation helpers used by host apps.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { useState } from "react"
|
|
9
|
-
import { Pressable, Text, View } from "react-native"
|
|
9
|
+
import { Modal, Pressable, StyleSheet, Text, View } from "react-native"
|
|
10
10
|
|
|
11
11
|
import { cn } from "../lib/cn"
|
|
12
12
|
import {
|
|
@@ -97,9 +97,7 @@ function DrawerNavItem({
|
|
|
97
97
|
"relative mb-1 min-h-11 flex-1 flex-row items-center justify-start gap-3 rounded-xl px-3 py-2.5",
|
|
98
98
|
highlighted
|
|
99
99
|
? "bg-emerald-500/15"
|
|
100
|
-
:
|
|
101
|
-
? ""
|
|
102
|
-
: "active:bg-slate-100 dark:active:bg-slate-800",
|
|
100
|
+
: "",
|
|
103
101
|
)}
|
|
104
102
|
>
|
|
105
103
|
{highlighted && depth > 0 ? (
|
|
@@ -161,7 +159,7 @@ function DrawerNavItem({
|
|
|
161
159
|
<View
|
|
162
160
|
className={cn(
|
|
163
161
|
"relative mb-1 min-h-11 flex-row items-center justify-start gap-3 rounded-xl px-3 py-2.5",
|
|
164
|
-
highlighted ? "bg-emerald-500/15" : "
|
|
162
|
+
highlighted ? "bg-emerald-500/15" : "",
|
|
165
163
|
)}
|
|
166
164
|
>
|
|
167
165
|
{highlighted && depth > 0 ? (
|
|
@@ -187,10 +185,12 @@ function DrawerNavItem({
|
|
|
187
185
|
|
|
188
186
|
/**
|
|
189
187
|
* React Native drawer panel for Expo / mobile consumers.
|
|
190
|
-
*
|
|
188
|
+
*
|
|
189
|
+
* The panel is a modal so its rows are not covered by the page overlay, and the
|
|
190
|
+
* host header is rendered inside that modal so logo, profile, and close stay pressable.
|
|
191
191
|
*
|
|
192
192
|
* @param props - Open state, nav items, pathname, and injected link/icon renderers.
|
|
193
|
-
* @returns The drawer
|
|
193
|
+
* @returns The drawer modal when open, otherwise `null`.
|
|
194
194
|
*/
|
|
195
195
|
export function DrawerMenu({
|
|
196
196
|
open,
|
|
@@ -202,6 +202,7 @@ export function DrawerMenu({
|
|
|
202
202
|
footer,
|
|
203
203
|
topOffset = 0,
|
|
204
204
|
className,
|
|
205
|
+
header,
|
|
205
206
|
}: DrawerMenuProps): React.JSX.Element | null {
|
|
206
207
|
if (!open) {
|
|
207
208
|
return null
|
|
@@ -210,43 +211,50 @@ export function DrawerMenu({
|
|
|
210
211
|
const activeHref = findActiveNavHref(pathname, items)
|
|
211
212
|
|
|
212
213
|
const closeDrawer = (): void => {
|
|
213
|
-
|
|
214
|
+
onOpenChange(false)
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
return (
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
<Modal
|
|
219
|
+
animationType="fade"
|
|
220
|
+
onRequestClose={closeDrawer}
|
|
221
|
+
transparent
|
|
222
|
+
visible
|
|
221
223
|
>
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
className="
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
224
|
+
<View className="flex-1">
|
|
225
|
+
{header ?? <View style={{ height: topOffset }} />}
|
|
226
|
+
<View className="flex-1 flex-row justify-end">
|
|
227
|
+
<Pressable
|
|
228
|
+
accessibilityLabel="Close navigation menu"
|
|
229
|
+
accessibilityRole="button"
|
|
230
|
+
onPress={closeDrawer}
|
|
231
|
+
style={[StyleSheet.absoluteFill, { backgroundColor: "rgba(15, 23, 42, 0.5)" }]}
|
|
232
|
+
/>
|
|
233
|
+
<View
|
|
234
|
+
className={cn(
|
|
235
|
+
"h-full border-l border-slate-200 bg-white p-4 dark:border-slate-800 dark:bg-slate-900",
|
|
236
|
+
className,
|
|
237
|
+
)}
|
|
238
|
+
style={{ width: "80%", maxWidth: DOCS_SIDEBAR_WIDTH, zIndex: 1 }}
|
|
239
|
+
>
|
|
240
|
+
<View className="flex-1 gap-1">
|
|
241
|
+
{items.map((item) => (
|
|
242
|
+
<DrawerNavItem
|
|
243
|
+
key={`${item.href}-${item.label}`}
|
|
244
|
+
item={item}
|
|
245
|
+
pathname={pathname}
|
|
246
|
+
activeHref={activeHref}
|
|
247
|
+
depth={0}
|
|
248
|
+
LinkComponent={LinkComponent}
|
|
249
|
+
renderIcon={renderIcon}
|
|
250
|
+
onNavigate={closeDrawer}
|
|
251
|
+
/>
|
|
252
|
+
))}
|
|
253
|
+
</View>
|
|
254
|
+
{footer ? <View className="mt-auto items-stretch gap-2 pt-4">{footer}</View> : null}
|
|
255
|
+
</View>
|
|
247
256
|
</View>
|
|
248
|
-
{footer ? <View className="mt-auto items-stretch gap-2 pt-4">{footer}</View> : null}
|
|
249
257
|
</View>
|
|
250
|
-
</
|
|
258
|
+
</Modal>
|
|
251
259
|
)
|
|
252
260
|
}
|
|
@@ -84,4 +84,9 @@ export type DrawerMenuProps = {
|
|
|
84
84
|
* Extra class names applied to the drawer panel surface.
|
|
85
85
|
*/
|
|
86
86
|
className?: string
|
|
87
|
+
/**
|
|
88
|
+
* Native modal header rendered above the panel so header controls stay pressable.
|
|
89
|
+
* Web drawers ignore this and keep their own sticky header.
|
|
90
|
+
*/
|
|
91
|
+
header?: ReactNode
|
|
87
92
|
}
|