@olwiba/ui 0.2.17 → 0.2.19
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 +15 -2
- package/dist/index.js +60 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/app/AppShell.tsx +97 -35
- package/src/marketing/HeroSection.tsx +35 -11
package/dist/index.d.ts
CHANGED
|
@@ -583,7 +583,8 @@ interface HeroSectionProps {
|
|
|
583
583
|
heading: string;
|
|
584
584
|
badge?: string;
|
|
585
585
|
description: string;
|
|
586
|
-
|
|
586
|
+
/** Ignored when `primarySlot` is given. */
|
|
587
|
+
primaryCta?: {
|
|
587
588
|
label: string;
|
|
588
589
|
href: string;
|
|
589
590
|
};
|
|
@@ -591,6 +592,18 @@ interface HeroSectionProps {
|
|
|
591
592
|
label: string;
|
|
592
593
|
href: string;
|
|
593
594
|
};
|
|
595
|
+
/**
|
|
596
|
+
* Replaces the primary button with your own control — a search field, a
|
|
597
|
+
* short form, an email capture.
|
|
598
|
+
*
|
|
599
|
+
* A hero whose first action *is* the product converts better than one that
|
|
600
|
+
* links to a page where the product starts. `secondaryCta` still renders
|
|
601
|
+
* beside it, so "…or see pricing" survives.
|
|
602
|
+
*
|
|
603
|
+
* Rendered full-width above the secondary CTA on small screens, since a
|
|
604
|
+
* field sharing a row with a button gets squeezed to nothing on a phone.
|
|
605
|
+
*/
|
|
606
|
+
primarySlot?: React.ReactNode;
|
|
594
607
|
heroImage?: React.ReactNode;
|
|
595
608
|
media?: 'image' | 'phone' | 'none';
|
|
596
609
|
phoneSize?: 'sm' | 'md' | 'lg';
|
|
@@ -598,7 +611,7 @@ interface HeroSectionProps {
|
|
|
598
611
|
socialProofText?: string;
|
|
599
612
|
renderLink?: AppShellRenderLink;
|
|
600
613
|
}
|
|
601
|
-
declare function HeroSection({ heading, badge, description, primaryCta, secondaryCta, heroImage, media, phoneSize, avatarUrls, socialProofText, renderLink, }: HeroSectionProps): react_jsx_runtime.JSX.Element;
|
|
614
|
+
declare function HeroSection({ heading, badge, description, primaryCta, secondaryCta, primarySlot, heroImage, media, phoneSize, avatarUrls, socialProofText, renderLink, }: HeroSectionProps): react_jsx_runtime.JSX.Element;
|
|
602
615
|
|
|
603
616
|
interface FeaturesSectionProps {
|
|
604
617
|
title?: string;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { cn } from './chunk-AMWLSHD6.js';
|
|
|
2
2
|
export { MdxContent, cn } from './chunk-AMWLSHD6.js';
|
|
3
3
|
import * as React20 from 'react';
|
|
4
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,
|
|
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, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenuButton, 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';
|
|
@@ -262,11 +262,29 @@ function PublicPageFrame({
|
|
|
262
262
|
return /* @__PURE__ */ jsx("div", { className: cn("min-h-screen", surfaceMap[surface], className), ...props, children: /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", spacingMap2[spacing], maxWidthMap2[maxWidth]), children }) });
|
|
263
263
|
}
|
|
264
264
|
var RAIL_SQUARE = "group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!min-w-8 group-data-[collapsible=icon]:!max-w-8 group-data-[collapsible=icon]:!p-0 group-data-[collapsible=icon]:transition-[width,height]";
|
|
265
|
+
function initialsOf(source) {
|
|
266
|
+
const base = source.includes("@") ? source.split("@")[0] ?? source : source;
|
|
267
|
+
const words = base.split(/[\s._-]+/).filter(Boolean);
|
|
268
|
+
if (words.length >= 2) return (words[0][0] + words[1][0]).toUpperCase();
|
|
269
|
+
return (words[0] ?? base).slice(0, 2).toUpperCase();
|
|
270
|
+
}
|
|
271
|
+
function identityGradient(seed) {
|
|
272
|
+
let hash = 0;
|
|
273
|
+
for (let i = 0; i < seed.length; i += 1) {
|
|
274
|
+
hash = hash * 31 + seed.charCodeAt(i) | 0;
|
|
275
|
+
}
|
|
276
|
+
const hue = Math.abs(hash) % 360;
|
|
277
|
+
return {
|
|
278
|
+
backgroundImage: `linear-gradient(135deg, oklch(0.62 0.15 ${hue}), oklch(0.52 0.16 ${(hue + 28) % 360}))`,
|
|
279
|
+
color: "oklch(0.98 0 0)"
|
|
280
|
+
};
|
|
281
|
+
}
|
|
265
282
|
function NavUser({ user }) {
|
|
266
283
|
const { isMobile } = useSidebar();
|
|
267
284
|
const uiMode = useUIMode();
|
|
268
285
|
const avatarMode = uiMode !== "default" ? uiMode : void 0;
|
|
269
|
-
const initials = (user.name ?? user.email)
|
|
286
|
+
const initials = initialsOf(user.name ?? user.email);
|
|
287
|
+
const identityTint = identityGradient(user.email);
|
|
270
288
|
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
271
289
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
272
290
|
SidebarMenuButton,
|
|
@@ -278,9 +296,9 @@ function NavUser({ user }) {
|
|
|
278
296
|
RAIL_SQUARE
|
|
279
297
|
),
|
|
280
298
|
children: [
|
|
281
|
-
/* @__PURE__ */ jsxs(Avatar, { mode: avatarMode, size: "sm",
|
|
299
|
+
/* @__PURE__ */ jsxs(Avatar, { mode: avatarMode, size: "sm", children: [
|
|
282
300
|
user.avatar && /* @__PURE__ */ jsx(AvatarImage, { src: user.avatar, alt: user.name }),
|
|
283
|
-
/* @__PURE__ */ jsx(AvatarFallback, { children: initials })
|
|
301
|
+
/* @__PURE__ */ jsx(AvatarFallback, { className: "font-medium", style: identityTint, children: initials })
|
|
284
302
|
] }),
|
|
285
303
|
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
286
304
|
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: user.name ?? user.email }),
|
|
@@ -301,7 +319,7 @@ function NavUser({ user }) {
|
|
|
301
319
|
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
302
320
|
/* @__PURE__ */ jsxs(Avatar, { mode: avatarMode, size: "sm", children: [
|
|
303
321
|
user.avatar && /* @__PURE__ */ jsx(AvatarImage, { src: user.avatar, alt: user.name }),
|
|
304
|
-
/* @__PURE__ */ jsx(AvatarFallback, { children: initials })
|
|
322
|
+
/* @__PURE__ */ jsx(AvatarFallback, { className: "font-medium", style: identityTint, children: initials })
|
|
305
323
|
] }),
|
|
306
324
|
/* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
307
325
|
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: user.name ?? user.email }),
|
|
@@ -349,23 +367,21 @@ function ShellSidebar({
|
|
|
349
367
|
if (isMobile) setOpenMobile(false);
|
|
350
368
|
}, [isMobile, setOpenMobile]);
|
|
351
369
|
return /* @__PURE__ */ jsxs(Sidebar, { side, collapsible, sidebarPosition, children: [
|
|
352
|
-
/* @__PURE__ */ jsx(SidebarHeader, { className: "py-3", children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { onClickCapture: closeMobileMenu, children: /* @__PURE__ */
|
|
353
|
-
|
|
370
|
+
/* @__PURE__ */ jsx(SidebarHeader, { className: "py-3", children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { onClickCapture: closeMobileMenu, children: /* @__PURE__ */ jsxs(
|
|
371
|
+
"div",
|
|
354
372
|
{
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
] })
|
|
368
|
-
})
|
|
373
|
+
className: cn$1(
|
|
374
|
+
"flex items-center gap-2 overflow-hidden rounded-md p-2 text-left",
|
|
375
|
+
RAIL_SQUARE
|
|
376
|
+
),
|
|
377
|
+
children: [
|
|
378
|
+
brand.logo ? (
|
|
379
|
+
// Neutral slot: the consumer's logo owns its own chrome
|
|
380
|
+
// (background, radius). Sized to fill the collapsed icon rail.
|
|
381
|
+
/* @__PURE__ */ jsx("span", { className: "flex size-8 shrink-0 items-center justify-center [&>svg]:size-5", children: brand.logo })
|
|
382
|
+
) : /* @__PURE__ */ jsx("span", { className: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary text-sm font-semibold text-primary-foreground", children: fallbackLogo }),
|
|
383
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-nowrap text-base font-semibold leading-none [text-box-edge:ex_alphabetic] [text-box-trim:trim-both] group-data-[collapsible=icon]:hidden", children: brand.name })
|
|
384
|
+
]
|
|
369
385
|
}
|
|
370
386
|
) }) }) }),
|
|
371
387
|
/* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsxs(SidebarGroupContent, { className: "flex flex-col gap-2", children: [
|
|
@@ -1603,6 +1619,7 @@ function HeroSection({
|
|
|
1603
1619
|
description,
|
|
1604
1620
|
primaryCta,
|
|
1605
1621
|
secondaryCta,
|
|
1622
|
+
primarySlot,
|
|
1606
1623
|
heroImage,
|
|
1607
1624
|
media = "image",
|
|
1608
1625
|
phoneSize = "lg",
|
|
@@ -1617,19 +1634,28 @@ function HeroSection({
|
|
|
1617
1634
|
badge && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: badge }) }),
|
|
1618
1635
|
/* @__PURE__ */ jsx("h1", { className: "text-balance text-4xl font-semibold tracking-tight sm:text-5xl lg:text-6xl", children: heading }),
|
|
1619
1636
|
/* @__PURE__ */ jsx("p", { className: "max-w-lg text-pretty text-lg text-muted-foreground", children: description }),
|
|
1620
|
-
/* @__PURE__ */ jsxs(
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1637
|
+
/* @__PURE__ */ jsxs(
|
|
1638
|
+
"div",
|
|
1639
|
+
{
|
|
1640
|
+
className: cn$1(
|
|
1641
|
+
"flex gap-3",
|
|
1642
|
+
primarySlot ? "flex-col items-stretch sm:flex-row sm:items-center" : "flex-wrap items-center"
|
|
1643
|
+
),
|
|
1644
|
+
children: [
|
|
1645
|
+
primarySlot ?? (primaryCta && renderLink({
|
|
1646
|
+
href: primaryCta.href,
|
|
1647
|
+
children: /* @__PURE__ */ jsxs(Button, { size: "lg", children: [
|
|
1648
|
+
primaryCta.label,
|
|
1649
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "ml-2 size-4" })
|
|
1650
|
+
] })
|
|
1651
|
+
})),
|
|
1652
|
+
secondaryCta && renderLink({
|
|
1653
|
+
href: secondaryCta.href,
|
|
1654
|
+
children: /* @__PURE__ */ jsx(Button, { size: "lg", variant: "outline", children: secondaryCta.label })
|
|
1655
|
+
})
|
|
1656
|
+
]
|
|
1657
|
+
}
|
|
1658
|
+
)
|
|
1633
1659
|
] }) }),
|
|
1634
1660
|
media !== "none" && /* @__PURE__ */ jsx(FadeIn, { direction: "right", delay: 200, children: media === "phone" ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(PhoneFrame, { size: phoneSize, children: heroImage }) }) : /* @__PURE__ */ jsx("div", { className: cn$1("overflow-hidden", mode === "smooth" ? "rounded-3xl" : "rounded-2xl"), children: heroImage }) })
|
|
1635
1661
|
] }),
|