@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/dist/index.d.ts CHANGED
@@ -335,9 +335,21 @@ interface AuthSectionProps extends AuthFormProps {
335
335
  children?: React.ReactNode;
336
336
  /** (split layout only) Custom content for the left decorative panel */
337
337
  panel?: React.ReactNode;
338
+ /**
339
+ * Render inside an existing page frame — one already providing the
340
+ * background, the horizontal padding, and a navbar and footer.
341
+ *
342
+ * Standalone (the default) the section owns the whole viewport, which is
343
+ * right for an auth screen that is the only thing on the page. It is wrong
344
+ * the moment there is chrome around it: the padding lands on top of the
345
+ * frame's own, and `min-h-dvh` guarantees the footer starts below the fold.
346
+ *
347
+ * (centered layout only)
348
+ */
349
+ framed?: boolean;
338
350
  className?: string;
339
351
  }
340
- declare function AuthSection({ layout, children, panel, className, ...formProps }: AuthSectionProps): react_jsx_runtime.JSX.Element;
352
+ declare function AuthSection({ layout, children, panel, framed, className, ...formProps }: AuthSectionProps): react_jsx_runtime.JSX.Element;
341
353
 
342
354
  interface SettingsSectionProps {
343
355
  title: string;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { cn } from './chunk-AMWLSHD6.js';
2
2
  export { MdxContent, cn } from './chunk-AMWLSHD6.js';
3
3
  import * as React20 from 'react';
4
- import { useRef, useEffect, useState } from 'react';
5
- import { Button as Button$1, Card as Card$1, Input as Input$1, Textarea as Textarea$1, Checkbox as Checkbox$1, Switch as Switch$1, useIsMobile, UIVariantProvider, Badge as Badge$1, cn as cn$1, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Avatar, AvatarImage, AvatarFallback, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, Dialog, DialogTrigger, Progress, useUIVariant, Separator, Accordion, AccordionItem, AccordionTrigger, AccordionContent, Label, Sheet, SheetTrigger, SheetContent, StatusIndicator, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandSeparator, CommandGroup, CommandItem, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ContextMenu as ContextMenu$1, ContextMenuTrigger, ContextMenuContent, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, CommandShortcut, Popover, PopoverTrigger, PopoverContent, Spinner, SidebarProvider, SidebarInset, CardHeader, CardTitle, CardDescription, CardContent, InputOTP, InputOTPGroup, InputOTPSlot, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, ContextMenuSeparator, ContextMenuLabel, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent, ContextMenuItem, ContextMenuShortcut, Sidebar, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarFooter, SidebarTrigger, useSidebar, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup } from '@olwiba/cn';
4
+ import { useRef, useEffect, useState, useCallback } from 'react';
5
+ import { Button as Button$1, Card as Card$1, Input as Input$1, Textarea as Textarea$1, Checkbox as Checkbox$1, Switch as Switch$1, useIsMobile, UIVariantProvider, Badge as Badge$1, cn as cn$1, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Avatar, AvatarImage, AvatarFallback, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, Dialog, DialogTrigger, Progress, useUIVariant, Separator, Accordion, AccordionItem, AccordionTrigger, AccordionContent, Label, Sheet, SheetTrigger, SheetContent, StatusIndicator, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandSeparator, CommandGroup, CommandItem, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ContextMenu as ContextMenu$1, ContextMenuTrigger, ContextMenuContent, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, CommandShortcut, Popover, PopoverTrigger, PopoverContent, Spinner, SidebarProvider, SidebarInset, CardHeader, CardTitle, CardDescription, CardContent, InputOTP, InputOTPGroup, InputOTPSlot, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, ContextMenuSeparator, ContextMenuLabel, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent, ContextMenuItem, ContextMenuShortcut, useSidebar, Sidebar, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarFooter, SidebarTrigger, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup } from '@olwiba/cn';
6
6
  export { CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Enchanted } from '@olwiba/cn';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { Search, ArrowUp, ArrowDown, ArrowUpDown, ChevronLeft, ChevronRight, MoreHorizontal, UserPlus, Download, CreditCard, Check, Loader2, ArrowLeft, ArrowUpRight, X, Sparkles, RefreshCw, ArrowRight, Minus, Quote, Star, Twitter, Github, Linkedin, Mail, MessageSquare, ChevronDown, Send, Menu, UploadCloud, File, CheckCircle2, AlertCircle, Bell, Inbox, Activity, TrendingUp, TrendingDown, LayoutGrid, List, Sun, Moon, Palette, AlertTriangle, Rocket, Info, Layers, ShieldCheck, Building2, MoreVerticalIcon, CreditCardIcon, BellIcon, LogOutIcon } from 'lucide-react';
@@ -344,8 +344,12 @@ function ShellSidebar({
344
344
  sidebarPosition
345
345
  }) {
346
346
  const fallbackLogo = typeof brand.name === "string" ? brand.name.slice(0, 1).toUpperCase() : null;
347
+ const { isMobile, setOpenMobile } = useSidebar();
348
+ const closeMobileMenu = useCallback(() => {
349
+ if (isMobile) setOpenMobile(false);
350
+ }, [isMobile, setOpenMobile]);
347
351
  return /* @__PURE__ */ jsxs(Sidebar, { side, collapsible, sidebarPosition, children: [
348
- /* @__PURE__ */ jsx(SidebarHeader, { className: "py-3", children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
352
+ /* @__PURE__ */ jsx(SidebarHeader, { className: "py-3", children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { onClickCapture: closeMobileMenu, children: /* @__PURE__ */ jsx(
349
353
  SidebarMenuButton,
350
354
  {
351
355
  asChild: true,
@@ -365,7 +369,7 @@ function ShellSidebar({
365
369
  }
366
370
  ) }) }) }),
367
371
  /* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsxs(SidebarGroupContent, { className: "flex flex-col gap-2", children: [
368
- action && /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: action.href ? /* @__PURE__ */ jsx(
372
+ action && /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { onClickCapture: closeMobileMenu, children: action.href ? /* @__PURE__ */ jsx(
369
373
  SidebarMenuButton,
370
374
  {
371
375
  asChild: true,
@@ -391,7 +395,7 @@ function ShellSidebar({
391
395
  ]
392
396
  }
393
397
  ) }) }),
394
- /* @__PURE__ */ jsx(SidebarMenu, { children: navItems.map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, { asChild: true, tooltip: item.label, isActive: item.isActive, children: renderLink({
398
+ /* @__PURE__ */ jsx(SidebarMenu, { children: navItems.map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { onClickCapture: closeMobileMenu, children: /* @__PURE__ */ jsx(SidebarMenuButton, { asChild: true, tooltip: item.label, isActive: item.isActive, children: renderLink({
395
399
  href: item.href,
396
400
  children: /* @__PURE__ */ jsxs(Fragment, { children: [
397
401
  /* @__PURE__ */ jsx(item.icon, {}),
@@ -472,7 +476,24 @@ function AppShell({
472
476
  return inner;
473
477
  }
474
478
  var defaultRenderLink2 = ({ href, children, className }) => /* @__PURE__ */ jsx("a", { href, className, children });
475
- function CenteredAuth({ children, brand, className }) {
479
+ function CenteredAuth({ children, brand, framed, className }) {
480
+ if (framed) {
481
+ return (
482
+ // Framed: a page frame is already supplying the background, the page
483
+ // padding, and — with a navbar and footer around it — the height. All
484
+ // three have to come off here or they are applied twice: padding inside
485
+ // padding, and a full-viewport section that pushes the footer below the
486
+ // fold on every auth screen.
487
+ //
488
+ // The card fills the content column on a phone, matching the contact
489
+ // form, and only takes its reading width once there is room for the
490
+ // page to centre it.
491
+ /* @__PURE__ */ jsx("section", { className: cn$1("flex flex-col py-6 sm:py-10", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-none sm:my-auto sm:max-w-md", children: [
492
+ brand && /* @__PURE__ */ jsx("div", { className: "mb-8 text-center", children: brand }),
493
+ children
494
+ ] }) })
495
+ );
496
+ }
476
497
  return (
477
498
  // `min-h-dvh`, not `min-h-screen`: on mobile `100vh` is the viewport with
478
499
  // the browser chrome *retracted*, so a screen-height box is always taller
@@ -650,6 +671,7 @@ function AuthSection({
650
671
  layout = "centered",
651
672
  children,
652
673
  panel,
674
+ framed,
653
675
  className,
654
676
  ...formProps
655
677
  }) {
@@ -659,7 +681,7 @@ function AuthSection({
659
681
  }
660
682
  const { brand, ...restFormProps } = formProps;
661
683
  const form = children ?? /* @__PURE__ */ jsx(DefaultForm, { ...restFormProps });
662
- return /* @__PURE__ */ jsx(CenteredAuth, { brand, className, children: form });
684
+ return /* @__PURE__ */ jsx(CenteredAuth, { brand, framed, className, children: form });
663
685
  }
664
686
  function SettingsSection({ title, description, children, danger = false, className }) {
665
687
  return /* @__PURE__ */ jsxs("div", { className: cn$1("grid grid-cols-1 gap-x-8 gap-y-6 py-10 sm:grid-cols-3", className), children: [
@@ -3281,10 +3303,13 @@ function Navbar({
3281
3303
  })
3282
3304
  ] }),
3283
3305
  /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
3284
- /* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button$1, { variant: "ghost", size: "icon", className: "col-start-3 justify-self-end md:hidden", children: [
3285
- /* @__PURE__ */ jsx(Menu, { className: "size-5" }),
3286
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Open menu" })
3287
- ] }) }),
3306
+ /* @__PURE__ */ jsxs("div", { className: "col-start-3 flex items-center justify-end gap-1 md:hidden", children: [
3307
+ controls?.map((control, i) => /* @__PURE__ */ jsx(React20.Fragment, { children: control }, i)),
3308
+ /* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button$1, { variant: "ghost", size: "icon", children: [
3309
+ /* @__PURE__ */ jsx(Menu, { className: "size-5" }),
3310
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Open menu" })
3311
+ ] }) })
3312
+ ] }),
3288
3313
  /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "w-72", children: [
3289
3314
  /* @__PURE__ */ jsx("div", { className: "flex items-center pb-4", children: /* @__PURE__ */ jsx("span", { onClickCapture: closeMobileMenu, className: "cursor-pointer", children: renderLink({
3290
3315
  href: brandHref,
@@ -3293,7 +3318,6 @@ function Navbar({
3293
3318
  /* @__PURE__ */ jsx("span", { children: brand.name })
3294
3319
  ] })
3295
3320
  }) }) }),
3296
- controls?.length ? /* @__PURE__ */ jsx("div", { className: "mb-4 flex w-full items-center justify-between gap-1", children: controls.map((control, i) => /* @__PURE__ */ jsx(React20.Fragment, { children: control }, i)) }) : null,
3297
3321
  /* @__PURE__ */ jsx(Separator, {}),
3298
3322
  /* @__PURE__ */ jsx("nav", { className: "mt-4 flex flex-col gap-1", children: navLinks.map((link) => /* @__PURE__ */ jsx("span", { onClickCapture: closeMobileMenu, children: renderLink({
3299
3323
  href: link.href,