@limetry/ui 1.2.49
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/README.md +36 -0
- package/dist/index.cjs +464 -0
- package/dist/index.d.cts +504 -0
- package/dist/index.d.ts +504 -0
- package/dist/index.js +421 -0
- package/package.json +75 -0
- package/src/components/badge.tsx +66 -0
- package/src/components/button.tsx +117 -0
- package/src/components/card.tsx +89 -0
- package/src/components/drawer-menu.tsx +252 -0
- package/src/components/drawer-menu.types.ts +87 -0
- package/src/components/drawer-menu.web.tsx +348 -0
- package/src/components/icons.tsx +164 -0
- package/src/components/icons.web.tsx +141 -0
- package/src/components/input.tsx +143 -0
- package/src/components/page-header.tsx +142 -0
- package/src/components/stat-card.tsx +81 -0
- package/src/global.css +82 -0
- package/src/index.ts +39 -0
- package/src/lib/cn.ts +15 -0
- package/src/navigation/types.test.ts +72 -0
- package/src/navigation/types.ts +152 -0
- package/tailwind.config.ts +97 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM drawer panel for Next.js / browser consumers.
|
|
3
|
+
*
|
|
4
|
+
* Renders below a sticky header; the header owns the open/close control.
|
|
5
|
+
* Marked `"use client"` for Next App Router. Re-exports navigation helpers
|
|
6
|
+
* used by host apps.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
"use client"
|
|
10
|
+
|
|
11
|
+
import type { JSX } from "react"
|
|
12
|
+
import { useEffect, useState } from "react"
|
|
13
|
+
|
|
14
|
+
import { cn } from "../lib/cn"
|
|
15
|
+
import {
|
|
16
|
+
findActiveNavHref,
|
|
17
|
+
isItemHighlighted,
|
|
18
|
+
isNavItemOrChildActive,
|
|
19
|
+
} from "../navigation/types"
|
|
20
|
+
import type { DrawerMenuProps, NavItem } from "./drawer-menu.types"
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
findActiveNavHref,
|
|
24
|
+
isHighlightedNavItem,
|
|
25
|
+
isItemHighlighted,
|
|
26
|
+
isNavItemActive,
|
|
27
|
+
isNavItemOrChildActive,
|
|
28
|
+
} from "../navigation/types"
|
|
29
|
+
export type { DrawerLinkProps, DrawerMenuProps, NavItem } from "./drawer-menu.types"
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Default pixel offset below a sticky site header on web.
|
|
33
|
+
*/
|
|
34
|
+
const DEFAULT_TOP_OFFSET = 64
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Page-root styles this drawer toggles while it is open.
|
|
38
|
+
*/
|
|
39
|
+
type PageScrollStyle = {
|
|
40
|
+
overflowX: string
|
|
41
|
+
overscrollBehaviorX: string
|
|
42
|
+
touchAction: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Horizontal wheel payload. Kept local so it does not use the DOM `WheelEvent`.
|
|
47
|
+
*/
|
|
48
|
+
type HorizontalWheel = {
|
|
49
|
+
deltaX: number
|
|
50
|
+
deltaY: number
|
|
51
|
+
preventDefault: () => void
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Browser host used to lock sideways scrolling. The UI typecheck has no DOM lib.
|
|
56
|
+
*/
|
|
57
|
+
type BrowserHost = {
|
|
58
|
+
document: {
|
|
59
|
+
documentElement: {
|
|
60
|
+
style: PageScrollStyle
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
scrollTo: (options: { left: number }) => void
|
|
64
|
+
addEventListener: (
|
|
65
|
+
type: "wheel",
|
|
66
|
+
listener: (event: HorizontalWheel) => void,
|
|
67
|
+
options: { passive: boolean },
|
|
68
|
+
) => void
|
|
69
|
+
removeEventListener: (
|
|
70
|
+
type: "wheel",
|
|
71
|
+
listener: (event: HorizontalWheel) => void,
|
|
72
|
+
) => void
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Reads browser globals when this file runs in a document.
|
|
77
|
+
*
|
|
78
|
+
* @returns The host, or null outside a browser.
|
|
79
|
+
*/
|
|
80
|
+
function readBrowserHost(): BrowserHost | null {
|
|
81
|
+
const host = globalThis as {
|
|
82
|
+
document?: BrowserHost["document"]
|
|
83
|
+
scrollTo?: BrowserHost["scrollTo"]
|
|
84
|
+
addEventListener?: BrowserHost["addEventListener"]
|
|
85
|
+
removeEventListener?: BrowserHost["removeEventListener"]
|
|
86
|
+
}
|
|
87
|
+
if (
|
|
88
|
+
!host.document
|
|
89
|
+
|| typeof host.scrollTo !== "function"
|
|
90
|
+
|| typeof host.addEventListener !== "function"
|
|
91
|
+
|| typeof host.removeEventListener !== "function"
|
|
92
|
+
) {
|
|
93
|
+
return null
|
|
94
|
+
}
|
|
95
|
+
return host as BrowserHost
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Props for a single recursive drawer row.
|
|
100
|
+
*/
|
|
101
|
+
type DrawerItemProps = {
|
|
102
|
+
/**
|
|
103
|
+
* Nav item (leaf or branch) to render.
|
|
104
|
+
*/
|
|
105
|
+
item: NavItem
|
|
106
|
+
/**
|
|
107
|
+
* Current location pathname.
|
|
108
|
+
*/
|
|
109
|
+
pathname: string
|
|
110
|
+
/**
|
|
111
|
+
* Winning active href from {@link findActiveNavHref}.
|
|
112
|
+
*/
|
|
113
|
+
activeHref: string | null
|
|
114
|
+
/**
|
|
115
|
+
* Nesting depth; used for indent / rail styling.
|
|
116
|
+
*/
|
|
117
|
+
depth: number
|
|
118
|
+
/**
|
|
119
|
+
* Injected host link component.
|
|
120
|
+
*/
|
|
121
|
+
LinkComponent: DrawerMenuProps["LinkComponent"]
|
|
122
|
+
/**
|
|
123
|
+
* Optional icon renderer from {@link DrawerMenuProps}.
|
|
124
|
+
*/
|
|
125
|
+
renderIcon?: DrawerMenuProps["renderIcon"]
|
|
126
|
+
/**
|
|
127
|
+
* Invoked after a leaf navigation so the drawer can close.
|
|
128
|
+
*/
|
|
129
|
+
onNavigate: () => void
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Renders one nav row, expanding nested children when the branch is active.
|
|
134
|
+
*
|
|
135
|
+
* @param props - Item, pathname, active href, depth, and host callbacks.
|
|
136
|
+
* @returns A link row or an expand/collapse branch.
|
|
137
|
+
*/
|
|
138
|
+
function DrawerNavItem({
|
|
139
|
+
item,
|
|
140
|
+
pathname,
|
|
141
|
+
activeHref,
|
|
142
|
+
depth,
|
|
143
|
+
LinkComponent,
|
|
144
|
+
renderIcon,
|
|
145
|
+
onNavigate,
|
|
146
|
+
}: DrawerItemProps): JSX.Element {
|
|
147
|
+
const hasChildren = Boolean(item.children && item.children.length > 0)
|
|
148
|
+
const branchActive = isNavItemOrChildActive(pathname, item)
|
|
149
|
+
const highlighted = isItemHighlighted(pathname, item, activeHref)
|
|
150
|
+
const ancestorActive = branchActive && !highlighted
|
|
151
|
+
const [expanded, setExpanded] = useState(branchActive)
|
|
152
|
+
|
|
153
|
+
if (hasChildren && item.children) {
|
|
154
|
+
const open = expanded || branchActive
|
|
155
|
+
return (
|
|
156
|
+
<div className="flex flex-col gap-0.5">
|
|
157
|
+
<div className="flex items-stretch gap-1">
|
|
158
|
+
<LinkComponent
|
|
159
|
+
href={item.href}
|
|
160
|
+
onClick={onNavigate}
|
|
161
|
+
className={cn(
|
|
162
|
+
"relative flex min-w-0 flex-1 items-center justify-start gap-3 rounded-xl px-3 py-2.5 text-sm font-medium transition-colors",
|
|
163
|
+
depth > 0 && "pl-3",
|
|
164
|
+
highlighted && depth > 0 && "border-l-2 border-emerald-500",
|
|
165
|
+
highlighted
|
|
166
|
+
? "bg-emerald-500/15 text-emerald-500"
|
|
167
|
+
: ancestorActive
|
|
168
|
+
? "font-semibold text-slate-900 dark:text-slate-100"
|
|
169
|
+
: "text-slate-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800",
|
|
170
|
+
)}
|
|
171
|
+
>
|
|
172
|
+
{item.icon && renderIcon ? (
|
|
173
|
+
<span className="flex shrink-0 items-center justify-center">
|
|
174
|
+
{renderIcon(item.icon, highlighted)}
|
|
175
|
+
</span>
|
|
176
|
+
) : null}
|
|
177
|
+
<span className="text-left">{item.label}</span>
|
|
178
|
+
</LinkComponent>
|
|
179
|
+
<button
|
|
180
|
+
type="button"
|
|
181
|
+
aria-expanded={open}
|
|
182
|
+
aria-label={open ? `Collapse ${item.label}` : `Expand ${item.label}`}
|
|
183
|
+
className={cn(
|
|
184
|
+
"rounded-xl px-2.5 text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
185
|
+
(ancestorActive || highlighted) && "text-emerald-500",
|
|
186
|
+
)}
|
|
187
|
+
onClick={() => {
|
|
188
|
+
setExpanded((value) => !value)
|
|
189
|
+
}}
|
|
190
|
+
>
|
|
191
|
+
<ChevronIcon open={open} />
|
|
192
|
+
</button>
|
|
193
|
+
</div>
|
|
194
|
+
{open ? (
|
|
195
|
+
<div className="ml-3 flex flex-col gap-0.5 border-l border-slate-200 pl-2 dark:border-slate-700">
|
|
196
|
+
{item.children.map((child) => (
|
|
197
|
+
<DrawerNavItem
|
|
198
|
+
key={`${child.href}-${child.label}`}
|
|
199
|
+
item={child}
|
|
200
|
+
pathname={pathname}
|
|
201
|
+
activeHref={activeHref}
|
|
202
|
+
depth={depth + 1}
|
|
203
|
+
LinkComponent={LinkComponent}
|
|
204
|
+
renderIcon={renderIcon}
|
|
205
|
+
onNavigate={onNavigate}
|
|
206
|
+
/>
|
|
207
|
+
))}
|
|
208
|
+
</div>
|
|
209
|
+
) : null}
|
|
210
|
+
</div>
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<LinkComponent
|
|
216
|
+
href={item.href}
|
|
217
|
+
onClick={onNavigate}
|
|
218
|
+
className={cn(
|
|
219
|
+
"relative flex items-center justify-start gap-3 rounded-xl px-3 py-2.5 text-sm font-medium transition-colors",
|
|
220
|
+
depth > 0 && "py-2 text-[13px]",
|
|
221
|
+
highlighted && depth > 0 && "border-l-2 border-emerald-500",
|
|
222
|
+
highlighted
|
|
223
|
+
? "bg-emerald-500/15 text-emerald-500"
|
|
224
|
+
: "text-slate-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800",
|
|
225
|
+
)}
|
|
226
|
+
>
|
|
227
|
+
{item.icon && renderIcon ? (
|
|
228
|
+
<span className="flex shrink-0 items-center justify-center">
|
|
229
|
+
{renderIcon(item.icon, highlighted)}
|
|
230
|
+
</span>
|
|
231
|
+
) : null}
|
|
232
|
+
<span className="text-left">{item.label}</span>
|
|
233
|
+
</LinkComponent>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Chevron affordance for expand/collapse controls.
|
|
239
|
+
*
|
|
240
|
+
* @param props - Whether the branch is currently open.
|
|
241
|
+
* @returns An inline SVG chevron that rotates when open.
|
|
242
|
+
*/
|
|
243
|
+
function ChevronIcon({ open }: { open: boolean }): JSX.Element {
|
|
244
|
+
return (
|
|
245
|
+
<svg
|
|
246
|
+
className={cn("size-4 transition-transform", open && "rotate-180")}
|
|
247
|
+
viewBox="0 0 24 24"
|
|
248
|
+
fill="none"
|
|
249
|
+
stroke="currentColor"
|
|
250
|
+
strokeWidth={2}
|
|
251
|
+
aria-hidden="true"
|
|
252
|
+
>
|
|
253
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
|
|
254
|
+
</svg>
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* DOM drawer panel for Next.js / browser consumers.
|
|
260
|
+
* Renders below a sticky header; the header owns the open/close control.
|
|
261
|
+
*
|
|
262
|
+
* @param props - Open state, nav items, pathname, and injected link/icon renderers.
|
|
263
|
+
* @returns A fixed mobile drawer that slides in from the trailing edge.
|
|
264
|
+
*/
|
|
265
|
+
export function DrawerMenu({
|
|
266
|
+
open,
|
|
267
|
+
onOpenChange,
|
|
268
|
+
items,
|
|
269
|
+
pathname,
|
|
270
|
+
LinkComponent,
|
|
271
|
+
renderIcon,
|
|
272
|
+
footer,
|
|
273
|
+
topOffset = DEFAULT_TOP_OFFSET,
|
|
274
|
+
className,
|
|
275
|
+
}: DrawerMenuProps): JSX.Element {
|
|
276
|
+
const activeHref = findActiveNavHref(pathname, items)
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Keeps a sideways swipe from moving the page while the drawer is open.
|
|
280
|
+
*/
|
|
281
|
+
useEffect(() => {
|
|
282
|
+
if (!open) {
|
|
283
|
+
return
|
|
284
|
+
}
|
|
285
|
+
const host = readBrowserHost()
|
|
286
|
+
if (!host) {
|
|
287
|
+
return
|
|
288
|
+
}
|
|
289
|
+
const html = host.document.documentElement
|
|
290
|
+
const previousOverflow = html.style.overflowX
|
|
291
|
+
const previousOverscroll = html.style.overscrollBehaviorX
|
|
292
|
+
const previousTouchAction = html.style.touchAction
|
|
293
|
+
html.style.overflowX = "clip"
|
|
294
|
+
html.style.overscrollBehaviorX = "none"
|
|
295
|
+
html.style.touchAction = "pan-y"
|
|
296
|
+
const blockHorizontalScroll = (event: HorizontalWheel): void => {
|
|
297
|
+
if (Math.abs(event.deltaX) <= Math.abs(event.deltaY)) {
|
|
298
|
+
return
|
|
299
|
+
}
|
|
300
|
+
event.preventDefault()
|
|
301
|
+
host.scrollTo({ left: 0 })
|
|
302
|
+
}
|
|
303
|
+
host.scrollTo({ left: 0 })
|
|
304
|
+
host.addEventListener("wheel", blockHorizontalScroll, { passive: false })
|
|
305
|
+
return () => {
|
|
306
|
+
host.removeEventListener("wheel", blockHorizontalScroll)
|
|
307
|
+
html.style.overflowX = previousOverflow
|
|
308
|
+
html.style.overscrollBehaviorX = previousOverscroll
|
|
309
|
+
html.style.touchAction = previousTouchAction
|
|
310
|
+
host.scrollTo({ left: 0 })
|
|
311
|
+
}
|
|
312
|
+
}, [open])
|
|
313
|
+
|
|
314
|
+
return (
|
|
315
|
+
<div
|
|
316
|
+
className="limetry-mobile-drawer pointer-events-none fixed inset-x-0 bottom-0 z-40 flex justify-end overflow-hidden"
|
|
317
|
+
style={{ top: topOffset }}
|
|
318
|
+
aria-hidden={!open}
|
|
319
|
+
>
|
|
320
|
+
<nav
|
|
321
|
+
inert={!open}
|
|
322
|
+
className={cn(
|
|
323
|
+
"pointer-events-auto flex h-full w-72 max-w-[85vw] shrink-0 flex-col items-stretch gap-1 overflow-y-auto overscroll-y-contain border-l border-slate-200 bg-white p-4 shadow-xl transition-transform duration-300 ease-in-out dark:border-slate-800 dark:bg-slate-900",
|
|
324
|
+
open ? "translate-x-0" : "translate-x-full",
|
|
325
|
+
className,
|
|
326
|
+
)}
|
|
327
|
+
>
|
|
328
|
+
<div className="flex flex-col items-stretch gap-1">
|
|
329
|
+
{items.map((item) => (
|
|
330
|
+
<DrawerNavItem
|
|
331
|
+
key={`${item.href}-${item.label}`}
|
|
332
|
+
item={item}
|
|
333
|
+
pathname={pathname}
|
|
334
|
+
activeHref={activeHref}
|
|
335
|
+
depth={0}
|
|
336
|
+
LinkComponent={LinkComponent}
|
|
337
|
+
renderIcon={renderIcon}
|
|
338
|
+
onNavigate={() => {
|
|
339
|
+
onOpenChange(false)
|
|
340
|
+
}}
|
|
341
|
+
/>
|
|
342
|
+
))}
|
|
343
|
+
</div>
|
|
344
|
+
{footer ? <div className="mt-auto flex flex-col items-stretch gap-2 pt-4">{footer}</div> : null}
|
|
345
|
+
</nav>
|
|
346
|
+
</div>
|
|
347
|
+
)
|
|
348
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lucide icon wrappers for React Native / NativeWind consumers.
|
|
3
|
+
*
|
|
4
|
+
* Resolves stroke color from Tailwind text classes via the active color scheme
|
|
5
|
+
* because `lucide-react-native` expects a `color` prop rather than CSS classes.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
BarChart,
|
|
10
|
+
Home,
|
|
11
|
+
Key,
|
|
12
|
+
Menu,
|
|
13
|
+
Shield,
|
|
14
|
+
Terminal,
|
|
15
|
+
User,
|
|
16
|
+
X,
|
|
17
|
+
Zap,
|
|
18
|
+
} from "lucide-react-native"
|
|
19
|
+
import { useColorScheme } from "nativewind"
|
|
20
|
+
import React from "react"
|
|
21
|
+
import { View } from "react-native"
|
|
22
|
+
|
|
23
|
+
import { cn } from "../lib/cn"
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Shared props for exported icon components.
|
|
27
|
+
*/
|
|
28
|
+
type IconProps = {
|
|
29
|
+
/**
|
|
30
|
+
* Tailwind / NativeWind classes that may encode text color for stroke resolution.
|
|
31
|
+
*/
|
|
32
|
+
className?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Maps known text utility classes to hex stroke colors for Lucide native icons.
|
|
37
|
+
*
|
|
38
|
+
* @param className - Optional class string that may include color utilities.
|
|
39
|
+
* @param isDark - Whether the active NativeWind scheme is dark.
|
|
40
|
+
* @returns Hex color string for the Lucide `color` prop.
|
|
41
|
+
*/
|
|
42
|
+
function getColorFromClass(className: string | undefined, isDark: boolean): string {
|
|
43
|
+
if (!className) return isDark ? "#ffffff" : "#0f172a"
|
|
44
|
+
if (className.includes("text-emerald-500")) return "#10B981"
|
|
45
|
+
if (className.includes("text-slate-400")) return "#94A3B8"
|
|
46
|
+
if (className.includes("text-slate-900")) return "#0f172a"
|
|
47
|
+
if (className.includes("text-slate-100")) return "#ffffff"
|
|
48
|
+
if (className.includes("dark:text-slate-100")) return isDark ? "#ffffff" : "#0f172a"
|
|
49
|
+
if (className.includes("dark:text-slate-500")) return isDark ? "#6B7280" : "#94A3B8"
|
|
50
|
+
return isDark ? "#ffffff" : "#0f172a"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Renders a Lucide native icon inside a fixed-size view with scheme-aware color.
|
|
55
|
+
*
|
|
56
|
+
* @param props - Lucide component and optional className.
|
|
57
|
+
* @returns Icon wrapped in a sizing `View`.
|
|
58
|
+
*/
|
|
59
|
+
function NativeIcon({
|
|
60
|
+
Icon,
|
|
61
|
+
className,
|
|
62
|
+
}: IconProps & {
|
|
63
|
+
Icon: typeof Shield
|
|
64
|
+
}): React.JSX.Element {
|
|
65
|
+
const { colorScheme } = useColorScheme()
|
|
66
|
+
const isDark = colorScheme === "dark"
|
|
67
|
+
const color = getColorFromClass(className, isDark)
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<View className={cn("h-6 w-6 items-center justify-center", className)}>
|
|
71
|
+
<Icon color={color} size={20} />
|
|
72
|
+
</View>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Shield / security icon for native surfaces.
|
|
78
|
+
*
|
|
79
|
+
* @param props - Optional className for layout and color hints.
|
|
80
|
+
* @returns Native shield icon.
|
|
81
|
+
*/
|
|
82
|
+
export function ShieldIcon({ className }: IconProps): React.JSX.Element {
|
|
83
|
+
return <NativeIcon Icon={Shield} className={className} />
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Key / credentials icon for native surfaces.
|
|
88
|
+
*
|
|
89
|
+
* @param props - Optional className for layout and color hints.
|
|
90
|
+
* @returns Native key icon.
|
|
91
|
+
*/
|
|
92
|
+
export function KeyIcon({ className }: IconProps): React.JSX.Element {
|
|
93
|
+
return <NativeIcon Icon={Key} className={className} />
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Rules / policy icon (Zap) for native surfaces.
|
|
98
|
+
*
|
|
99
|
+
* @param props - Optional className for layout and color hints.
|
|
100
|
+
* @returns Native rules icon.
|
|
101
|
+
*/
|
|
102
|
+
export function RulesIcon({ className }: IconProps): React.JSX.Element {
|
|
103
|
+
return <NativeIcon Icon={Zap} className={className} />
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Chart / analytics icon for native surfaces.
|
|
108
|
+
*
|
|
109
|
+
* @param props - Optional className for layout and color hints.
|
|
110
|
+
* @returns Native chart icon.
|
|
111
|
+
*/
|
|
112
|
+
export function ChartIcon({ className }: IconProps): React.JSX.Element {
|
|
113
|
+
return <NativeIcon Icon={BarChart} className={className} />
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* User / account icon for native surfaces.
|
|
118
|
+
*
|
|
119
|
+
* @param props - Optional className for layout and color hints.
|
|
120
|
+
* @returns Native user icon.
|
|
121
|
+
*/
|
|
122
|
+
export function UserIcon({ className }: IconProps): React.JSX.Element {
|
|
123
|
+
return <NativeIcon Icon={User} className={className} />
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Home / dashboard icon for native surfaces.
|
|
128
|
+
*
|
|
129
|
+
* @param props - Optional className for layout and color hints.
|
|
130
|
+
* @returns Native home icon.
|
|
131
|
+
*/
|
|
132
|
+
export function HomeIcon({ className }: IconProps): React.JSX.Element {
|
|
133
|
+
return <NativeIcon Icon={Home} className={className} />
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Terminal / CLI icon for native surfaces.
|
|
138
|
+
*
|
|
139
|
+
* @param props - Optional className for layout and color hints.
|
|
140
|
+
* @returns Native terminal icon.
|
|
141
|
+
*/
|
|
142
|
+
export function TerminalIcon({ className }: IconProps): React.JSX.Element {
|
|
143
|
+
return <NativeIcon Icon={Terminal} className={className} />
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Hamburger menu icon for native surfaces.
|
|
148
|
+
*
|
|
149
|
+
* @param props - Optional className for layout and color hints.
|
|
150
|
+
* @returns Native menu icon.
|
|
151
|
+
*/
|
|
152
|
+
export function MenuIcon({ className }: IconProps): React.JSX.Element {
|
|
153
|
+
return <NativeIcon Icon={Menu} className={className} />
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Close / dismiss icon for native surfaces.
|
|
158
|
+
*
|
|
159
|
+
* @param props - Optional className for layout and color hints.
|
|
160
|
+
* @returns Native close icon.
|
|
161
|
+
*/
|
|
162
|
+
export function XIcon({ className }: IconProps): React.JSX.Element {
|
|
163
|
+
return <NativeIcon Icon={X} className={className} />
|
|
164
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lucide icon wrappers for web / CSS class consumers.
|
|
3
|
+
*
|
|
4
|
+
* Uses `lucide-react` so stroke color follows Tailwind `className` utilities
|
|
5
|
+
* without manual hex mapping.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
BarChart,
|
|
10
|
+
Home,
|
|
11
|
+
Key,
|
|
12
|
+
Menu,
|
|
13
|
+
Shield,
|
|
14
|
+
Terminal,
|
|
15
|
+
User,
|
|
16
|
+
X,
|
|
17
|
+
Zap,
|
|
18
|
+
} from "lucide-react"
|
|
19
|
+
import React from "react"
|
|
20
|
+
import { View } from "react-native"
|
|
21
|
+
|
|
22
|
+
import { cn } from "../lib/cn"
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Shared props for exported icon components.
|
|
26
|
+
*/
|
|
27
|
+
type IconProps = {
|
|
28
|
+
/**
|
|
29
|
+
* Tailwind classes applied to the wrapper and inherited by the SVG.
|
|
30
|
+
*/
|
|
31
|
+
className?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Renders a Lucide web icon inside a fixed-size React Native `View` wrapper.
|
|
36
|
+
*
|
|
37
|
+
* @param props - Lucide component and optional className.
|
|
38
|
+
* @returns Icon wrapped for layout consistency with the native icon set.
|
|
39
|
+
*/
|
|
40
|
+
function WebIcon({
|
|
41
|
+
Icon,
|
|
42
|
+
className,
|
|
43
|
+
}: IconProps & {
|
|
44
|
+
Icon: typeof Shield
|
|
45
|
+
}): React.JSX.Element {
|
|
46
|
+
return (
|
|
47
|
+
<View className={cn("h-5 w-5 items-center justify-center", className)}>
|
|
48
|
+
<Icon className="h-5 w-5" />
|
|
49
|
+
</View>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Shield / security icon for web surfaces.
|
|
55
|
+
*
|
|
56
|
+
* @param props - Optional className for layout and color.
|
|
57
|
+
* @returns Web shield icon.
|
|
58
|
+
*/
|
|
59
|
+
export function ShieldIcon({ className }: IconProps): React.JSX.Element {
|
|
60
|
+
return <WebIcon Icon={Shield} className={className} />
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Key / credentials icon for web surfaces.
|
|
65
|
+
*
|
|
66
|
+
* @param props - Optional className for layout and color.
|
|
67
|
+
* @returns Web key icon.
|
|
68
|
+
*/
|
|
69
|
+
export function KeyIcon({ className }: IconProps): React.JSX.Element {
|
|
70
|
+
return <WebIcon Icon={Key} className={className} />
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Rules / policy icon (Zap) for web surfaces.
|
|
75
|
+
*
|
|
76
|
+
* @param props - Optional className for layout and color.
|
|
77
|
+
* @returns Web rules icon.
|
|
78
|
+
*/
|
|
79
|
+
export function RulesIcon({ className }: IconProps): React.JSX.Element {
|
|
80
|
+
return <WebIcon Icon={Zap} className={className} />
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Chart / analytics icon for web surfaces.
|
|
85
|
+
*
|
|
86
|
+
* @param props - Optional className for layout and color.
|
|
87
|
+
* @returns Web chart icon.
|
|
88
|
+
*/
|
|
89
|
+
export function ChartIcon({ className }: IconProps): React.JSX.Element {
|
|
90
|
+
return <WebIcon Icon={BarChart} className={className} />
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* User / account icon for web surfaces.
|
|
95
|
+
*
|
|
96
|
+
* @param props - Optional className for layout and color.
|
|
97
|
+
* @returns Web user icon.
|
|
98
|
+
*/
|
|
99
|
+
export function UserIcon({ className }: IconProps): React.JSX.Element {
|
|
100
|
+
return <WebIcon Icon={User} className={className} />
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Home / dashboard icon for web surfaces.
|
|
105
|
+
*
|
|
106
|
+
* @param props - Optional className for layout and color.
|
|
107
|
+
* @returns Web home icon.
|
|
108
|
+
*/
|
|
109
|
+
export function HomeIcon({ className }: IconProps): React.JSX.Element {
|
|
110
|
+
return <WebIcon Icon={Home} className={className} />
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Terminal / CLI icon for web surfaces.
|
|
115
|
+
*
|
|
116
|
+
* @param props - Optional className for layout and color.
|
|
117
|
+
* @returns Web terminal icon.
|
|
118
|
+
*/
|
|
119
|
+
export function TerminalIcon({ className }: IconProps): React.JSX.Element {
|
|
120
|
+
return <WebIcon Icon={Terminal} className={className} />
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Hamburger menu icon for web surfaces.
|
|
125
|
+
*
|
|
126
|
+
* @param props - Optional className for layout and color.
|
|
127
|
+
* @returns Web menu icon.
|
|
128
|
+
*/
|
|
129
|
+
export function MenuIcon({ className }: IconProps): React.JSX.Element {
|
|
130
|
+
return <WebIcon Icon={Menu} className={className} />
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Close / dismiss icon for web surfaces.
|
|
135
|
+
*
|
|
136
|
+
* @param props - Optional className for layout and color.
|
|
137
|
+
* @returns Web close icon.
|
|
138
|
+
*/
|
|
139
|
+
export function XIcon({ className }: IconProps): React.JSX.Element {
|
|
140
|
+
return <WebIcon Icon={X} className={className} />
|
|
141
|
+
}
|