@limetry/ui 1.2.58 → 1.2.59

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetry/ui",
3
- "version": "1.2.58",
3
+ "version": "1.2.59",
4
4
  "description": "Shared design system for Limetry — components, icons, and design tokens.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * React Native drawer panel for Expo / mobile consumers.
3
3
  *
4
- * Positioned below the sticky header so the header (and its close control) stay
5
- * active. Re-exports navigation helpers used by host apps.
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
- : ancestorActive
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" : "active:bg-slate-100 dark:active:bg-slate-800",
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
- * Positioned below the sticky header so the header (and its close control) stay active.
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 overlay when open, otherwise `null`.
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
- setTimeout(() => onOpenChange(false), 0)
214
+ onOpenChange(false)
214
215
  }
215
216
 
216
217
  return (
217
- <View
218
- className="absolute inset-x-0 bottom-0 z-40 flex-row justify-end"
219
- style={{ top: topOffset }}
220
- pointerEvents="box-none"
218
+ <Modal
219
+ animationType="fade"
220
+ onRequestClose={closeDrawer}
221
+ transparent
222
+ visible
221
223
  >
222
- <Pressable
223
- accessibilityLabel="Close navigation menu"
224
- className="absolute inset-0 bg-slate-900/50"
225
- onPress={() => onOpenChange(false)}
226
- />
227
- <View
228
- className={cn(
229
- "h-full border-l border-slate-200 bg-white p-4 shadow-xl dark:border-slate-800 dark:bg-slate-900",
230
- className,
231
- )}
232
- style={{ width: "80%", maxWidth: DOCS_SIDEBAR_WIDTH }}
233
- >
234
- <View className="flex-1 gap-1">
235
- {items.map((item) => (
236
- <DrawerNavItem
237
- key={`${item.href}-${item.label}`}
238
- item={item}
239
- pathname={pathname}
240
- activeHref={activeHref}
241
- depth={0}
242
- LinkComponent={LinkComponent}
243
- renderIcon={renderIcon}
244
- onNavigate={closeDrawer}
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
- </View>
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
  }