@olwiba/ui 0.2.14 → 0.2.16

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": "@olwiba/ui",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -0,0 +1,74 @@
1
+ 'use client';
2
+
3
+ import type { ReactNode } from 'react';
4
+ import type { LucideIcon } from 'lucide-react';
5
+ import { cn } from '../lib/utils';
6
+
7
+ export interface AppPageHeroProps {
8
+ eyebrow?: ReactNode;
9
+ title: ReactNode;
10
+ description?: ReactNode;
11
+ icon?: LucideIcon;
12
+ action?: ReactNode;
13
+ children?: ReactNode;
14
+ compact?: boolean;
15
+ className?: string;
16
+ }
17
+
18
+ /**
19
+ * Rich page header for signed-in product/admin pages.
20
+ *
21
+ * Use this when a route needs more visual weight than a simple `PageHeader`,
22
+ * but still keep product-specific stats, actions, and copy in the consumer.
23
+ */
24
+ export function AppPageHero({
25
+ eyebrow,
26
+ title,
27
+ description,
28
+ icon: Icon,
29
+ action,
30
+ children,
31
+ compact = false,
32
+ className,
33
+ }: AppPageHeroProps) {
34
+ return (
35
+ <section
36
+ className={cn(
37
+ 'relative overflow-hidden rounded-3xl border bg-card/80 p-5 shadow-sm sm:p-6',
38
+ 'before:absolute before:-right-16 before:-top-16 before:size-44 before:rounded-full before:bg-primary/15 before:blur-3xl',
39
+ 'after:absolute after:-bottom-20 after:left-10 after:size-52 after:rounded-full after:bg-primary/10 after:blur-3xl',
40
+ className,
41
+ )}
42
+ >
43
+ <div className="relative flex flex-col gap-5 sm:flex-row sm:items-start sm:justify-between">
44
+ <div className="flex min-w-0 gap-4">
45
+ {Icon && (
46
+ <div className="flex size-12 shrink-0 items-center justify-center rounded-2xl border bg-background/70 text-primary shadow-sm">
47
+ <Icon className="size-5" />
48
+ </div>
49
+ )}
50
+ <div className="min-w-0 space-y-2">
51
+ {eyebrow && (
52
+ <p className="text-xs font-semibold uppercase tracking-[0.24em] text-primary/80">
53
+ {eyebrow}
54
+ </p>
55
+ )}
56
+ <h1
57
+ className={cn(
58
+ 'font-semibold tracking-tight',
59
+ compact ? 'text-2xl' : 'text-3xl sm:text-4xl',
60
+ )}
61
+ >
62
+ {title}
63
+ </h1>
64
+ {description && (
65
+ <p className="max-w-2xl text-sm leading-6 text-muted-foreground">{description}</p>
66
+ )}
67
+ </div>
68
+ </div>
69
+ {action && <div className="relative shrink-0 sm:pt-1">{action}</div>}
70
+ </div>
71
+ {children && <div className="relative mt-5">{children}</div>}
72
+ </section>
73
+ );
74
+ }
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import type { LucideIcon } from 'lucide-react';
4
- import type { ReactNode } from 'react';
4
+ import { useCallback, type ReactNode } from 'react';
5
5
  import {
6
6
  BellIcon,
7
7
  CreditCardIcon,
@@ -249,12 +249,16 @@ function ShellSidebar({
249
249
  sidebarPosition: 'viewport' | 'contained';
250
250
  }) {
251
251
  const fallbackLogo = typeof brand.name === 'string' ? brand.name.slice(0, 1).toUpperCase() : null;
252
+ const { isMobile, setOpenMobile } = useSidebar();
253
+ const closeMobileMenu = useCallback(() => {
254
+ if (isMobile) setOpenMobile(false);
255
+ }, [isMobile, setOpenMobile]);
252
256
 
253
257
  return (
254
258
  <Sidebar side={side} collapsible={collapsible} sidebarPosition={sidebarPosition}>
255
259
  <SidebarHeader className="py-3">
256
260
  <SidebarMenu>
257
- <SidebarMenuItem>
261
+ <SidebarMenuItem onClickCapture={closeMobileMenu}>
258
262
  <SidebarMenuButton
259
263
  asChild
260
264
  size="lg"
@@ -295,7 +299,7 @@ function ShellSidebar({
295
299
  <SidebarGroupContent className="flex flex-col gap-2">
296
300
  {action && (
297
301
  <SidebarMenu>
298
- <SidebarMenuItem>
302
+ <SidebarMenuItem onClickCapture={closeMobileMenu}>
299
303
  {action.href ? (
300
304
  <SidebarMenuButton
301
305
  asChild
@@ -328,7 +332,7 @@ function ShellSidebar({
328
332
 
329
333
  <SidebarMenu>
330
334
  {navItems.map((item) => (
331
- <SidebarMenuItem key={item.label}>
335
+ <SidebarMenuItem key={item.label} onClickCapture={closeMobileMenu}>
332
336
  <SidebarMenuButton asChild tooltip={item.label} isActive={item.isActive}>
333
337
  {renderLink({
334
338
  href: item.href,
package/src/index.ts CHANGED
@@ -29,6 +29,8 @@ export {
29
29
  type AppNavItem,
30
30
  } from './app/AppShell';
31
31
 
32
+ export { AppPageHero, type AppPageHeroProps } from './app/AppPageHero';
33
+
32
34
  export {
33
35
  AuthSection,
34
36
  type AuthSectionProps,
@@ -82,14 +82,19 @@ export function Navbar({
82
82
  </div>
83
83
  )}
84
84
 
85
- {/* Mobile drawer — trigger on the right, panel slides in from the left */}
85
+ {/* Mobile controls + drawer trigger keep quick toggles visible, with menu last. */}
86
86
  <Sheet open={open} onOpenChange={setOpen}>
87
- <SheetTrigger asChild>
88
- <Button variant="ghost" size="icon" className="col-start-3 justify-self-end md:hidden">
89
- <Menu className="size-5" />
90
- <span className="sr-only">Open menu</span>
91
- </Button>
92
- </SheetTrigger>
87
+ <div className="col-start-3 flex items-center justify-end gap-1 md:hidden">
88
+ {controls?.map((control, i) => (
89
+ <React.Fragment key={i}>{control}</React.Fragment>
90
+ ))}
91
+ <SheetTrigger asChild>
92
+ <Button variant="ghost" size="icon">
93
+ <Menu className="size-5" />
94
+ <span className="sr-only">Open menu</span>
95
+ </Button>
96
+ </SheetTrigger>
97
+ </div>
93
98
  <SheetContent side="left" className="w-72">
94
99
  {/* Brand row alone at the top — leaves the top-right corner to the built-in close */}
95
100
  <div className="flex items-center pb-4">
@@ -105,13 +110,6 @@ export function Navbar({
105
110
  })}
106
111
  </span>
107
112
  </div>
108
- {controls?.length ? (
109
- <div className="mb-4 flex w-full items-center justify-between gap-1">
110
- {controls.map((control, i) => (
111
- <React.Fragment key={i}>{control}</React.Fragment>
112
- ))}
113
- </div>
114
- ) : null}
115
113
  <Separator />
116
114
  <nav className="mt-4 flex flex-col gap-1">
117
115
  {navLinks.map((link) => (