@olwiba/ui 0.2.13 → 0.2.15

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.13",
3
+ "version": "0.2.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -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,
@@ -25,7 +25,27 @@ const defaultRenderLink: AppShellRenderLink = ({ href, children, className }) =>
25
25
 
26
26
  // ─── Centered layout ──────────────────────────────────────────────────────────
27
27
 
28
- function CenteredAuth({ children, brand, className }: { children: React.ReactNode; brand?: React.ReactNode; className?: string }) {
28
+ function CenteredAuth({ children, brand, framed, className }: { children: React.ReactNode; brand?: React.ReactNode; framed?: boolean; className?: string }) {
29
+ if (framed) {
30
+ return (
31
+ // Framed: a page frame is already supplying the background, the page
32
+ // padding, and — with a navbar and footer around it — the height. All
33
+ // three have to come off here or they are applied twice: padding inside
34
+ // padding, and a full-viewport section that pushes the footer below the
35
+ // fold on every auth screen.
36
+ //
37
+ // The card fills the content column on a phone, matching the contact
38
+ // form, and only takes its reading width once there is room for the
39
+ // page to centre it.
40
+ <section className={cn('flex flex-col py-6 sm:py-10', className)}>
41
+ <div className="mx-auto w-full max-w-none sm:my-auto sm:max-w-md">
42
+ {brand && <div className="mb-8 text-center">{brand}</div>}
43
+ {children}
44
+ </div>
45
+ </section>
46
+ );
47
+ }
48
+
29
49
  return (
30
50
  // `min-h-dvh`, not `min-h-screen`: on mobile `100vh` is the viewport with
31
51
  // the browser chrome *retracted*, so a screen-height box is always taller
@@ -325,6 +345,18 @@ export interface AuthSectionProps extends AuthFormProps {
325
345
  children?: React.ReactNode;
326
346
  /** (split layout only) Custom content for the left decorative panel */
327
347
  panel?: React.ReactNode;
348
+ /**
349
+ * Render inside an existing page frame — one already providing the
350
+ * background, the horizontal padding, and a navbar and footer.
351
+ *
352
+ * Standalone (the default) the section owns the whole viewport, which is
353
+ * right for an auth screen that is the only thing on the page. It is wrong
354
+ * the moment there is chrome around it: the padding lands on top of the
355
+ * frame's own, and `min-h-dvh` guarantees the footer starts below the fold.
356
+ *
357
+ * (centered layout only)
358
+ */
359
+ framed?: boolean;
328
360
  className?: string;
329
361
  }
330
362
 
@@ -332,6 +364,7 @@ export function AuthSection({
332
364
  layout = 'centered',
333
365
  children,
334
366
  panel,
367
+ framed,
335
368
  className,
336
369
  ...formProps
337
370
  }: AuthSectionProps) {
@@ -348,7 +381,7 @@ export function AuthSection({
348
381
  const { brand, ...restFormProps } = formProps;
349
382
  const form = children ?? <DefaultForm {...restFormProps} />;
350
383
  return (
351
- <CenteredAuth brand={brand} className={className}>
384
+ <CenteredAuth brand={brand} framed={framed} className={className}>
352
385
  {form}
353
386
  </CenteredAuth>
354
387
  );
@@ -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) => (