@betterinternship/components 3.1.3 → 3.2.0
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/components/app-header.js +5 -5
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/autocomplete.js +5 -5
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/banner.d.ts +2 -1
- package/dist/components/banner.js.map +1 -1
- package/dist/components/context-menu.js +8 -8
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/dropdown-menu.js +8 -8
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/dropdown.js +3 -3
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/option-list.d.ts +40 -0
- package/dist/components/option-list.js +39 -0
- package/dist/components/option-list.js.map +1 -0
- package/dist/components/select.js +3 -3
- package/dist/components/select.js.map +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
- package/theme.css +6 -0
|
@@ -60,13 +60,13 @@ function AppHeader({ siteName, homeHref, nav, links = [], userPrimary, userSecon
|
|
|
60
60
|
: ''), children: [jsx("div", { className: "flex h-6 w-6 items-center justify-center overflow-hidden rounded-full bg-gray-100", children: userAvatarUrl ? (jsx("img", { src: userAvatarUrl, alt: "", className: "h-full w-full object-contain" })) : (jsx(UserRound, { className: "h-5 w-5 text-gray-500" })) }), jsxs("div", { className: "flex items-center gap-0.5", children: [jsx("span", { className: "text-xs", children: "Account" }), jsx(ChevronDown, { className: "h-3! w-3! transition-transform group-data-[state=open]:rotate-180" })] })] }) }), jsxs(DropdownMenuContent, { align: "end", className: "w-max min-w-44", children: [userPrimary && (jsxs("div", { className: "px-2 py-1.5", children: [jsx("div", { className: "text-center text-sm font-medium", children: userPrimary }), userSecondary && (jsx("div", { className: "text-muted-foreground text-center text-xs", children: userSecondary }))] })), jsx(DropdownMenuSeparator, {}), profileHref && (jsx(DropdownMenuItem, { asChild: true, children: jsxs(Link, { href: profileHref, children: [jsx(UserRound, { className: "h-4 w-4" }), "Profile"] }) })), accountNav.map((item) => {
|
|
61
61
|
const Icon = item.icon ?? labelIcon(item.label);
|
|
62
62
|
return (jsx(DropdownMenuItem, { asChild: true, children: jsxs(Link, { href: item.href, children: [jsx(Icon, { className: "h-4 w-4" }), item.label] }) }, item.href));
|
|
63
|
-
}), (profileHref || accountNav.length > 0) && (jsx(DropdownMenuSeparator, {})), jsxs(DropdownMenuItem, { variant: "destructive", disabled: logout.isPending, onClick: () => logout.mutate(), children: [jsx(LogOut, { className: "h-4 w-4" }), logout.isPending ? 'Logging out...' : 'Sign Out'] })] })] })] }), jsxs("div", { className: "flex items-center gap-1 md:hidden", children: [onSearchClick && (jsx("button", { type: "button", "aria-label": "Search", className: "inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50", onClick: onSearchClick, children: jsx(Search, { className: "h-5 w-5" }) })), showMobileMenu && (jsx("button", { type: "button", "aria-label": isDrawerOpen ? 'Close menu' : 'Open menu', className: "inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50", onClick: () => setIsDrawerOpen(!isDrawerOpen), children: isDrawerOpen ? (jsx(X, { className: "h-5 w-5" })) : (jsx(Menu, { className: "h-5 w-5" })) }))] })] }), showMobileMenu && isDrawerOpen && (jsx("div", { className: "fixed inset-0 z-[30] duration-200 md:hidden", onClick: () => setIsDrawerOpen(false) })), showMobileMenu && (jsx("div", { className: cn('fixed top-0 right-0 z-[31] h-[100svh] w-full max-w-[92%] border-l border-border bg-white shadow-xl sm:max-w-[420px] md:hidden', 'transition-transform duration-250 ease-out', isDrawerOpen ? 'translate-x-0' : 'translate-x-full'), role: "dialog", "aria-modal": "true", "aria-label": "Mobile menu", children: jsxs("div", { className: "flex h-full flex-col", children: [jsxs("div", { className: "mt-1 flex items-center justify-between border-b px-4 py-3", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Image, { src: logoPath, alt: "", width: 25, height: 25, className: "h-6 w-6 rounded object-contain" }), jsx("span", { className: "text-sm font-semibold", children: brand }), jsx("span", { className: "rounded border border-border bg-gray-50 px-1 py-0 text-xs font-medium text-gray-400 leading-none", children: siteName })] }), jsx("button", { type: "button", "aria-label": "Close menu", className: "inline-flex h-9 w-9 items-center justify-center rounded-md transition-colors hover:bg-gray-100", onClick: () => setIsDrawerOpen(false), children: jsx(X, { className: "h-5 w-5" }) })] }), jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [userPrimary && (jsxs("div", { className: "flex items-center gap-2 pb-2", children: [jsx(UserRound, { className: "h-5 w-5 text-gray-500" }), jsx("span", { className: "text-sm font-semibold text-gray-900", children: userPrimary })] })), jsx(Divider, { className: "my-4" }), actions && jsx("div", { className: "mb-2", children: actions }), jsx("nav", { className: "
|
|
63
|
+
}), (profileHref || accountNav.length > 0) && (jsx(DropdownMenuSeparator, {})), jsxs(DropdownMenuItem, { variant: "destructive", disabled: logout.isPending, onClick: () => logout.mutate(), children: [jsx(LogOut, { className: "h-4 w-4" }), logout.isPending ? 'Logging out...' : 'Sign Out'] })] })] })] }), jsxs("div", { className: "flex items-center gap-1 md:hidden", children: [onSearchClick && (jsx("button", { type: "button", "aria-label": "Search", className: "inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50", onClick: onSearchClick, children: jsx(Search, { className: "h-5 w-5" }) })), showMobileMenu && (jsx("button", { type: "button", "aria-label": isDrawerOpen ? 'Close menu' : 'Open menu', className: "inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50", onClick: () => setIsDrawerOpen(!isDrawerOpen), children: isDrawerOpen ? (jsx(X, { className: "h-5 w-5" })) : (jsx(Menu, { className: "h-5 w-5" })) }))] })] }), showMobileMenu && isDrawerOpen && (jsx("div", { className: "fixed inset-0 z-[30] duration-200 md:hidden", onClick: () => setIsDrawerOpen(false) })), showMobileMenu && (jsx("div", { className: cn('fixed top-0 right-0 z-[31] h-[100svh] w-full max-w-[92%] border-l border-border bg-white shadow-xl sm:max-w-[420px] md:hidden', 'transition-transform duration-250 ease-out', isDrawerOpen ? 'translate-x-0' : 'translate-x-full'), role: "dialog", "aria-modal": "true", "aria-label": "Mobile menu", children: jsxs("div", { className: "flex h-full flex-col", children: [jsxs("div", { className: "mt-1 flex items-center justify-between border-b px-4 py-3", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Image, { src: logoPath, alt: "", width: 25, height: 25, className: "h-6 w-6 rounded object-contain" }), jsx("span", { className: "text-sm font-semibold", children: brand }), jsx("span", { className: "rounded border border-border bg-gray-50 px-1 py-0 text-xs font-medium text-gray-400 leading-none", children: siteName })] }), jsx("button", { type: "button", "aria-label": "Close menu", className: "inline-flex h-9 w-9 items-center justify-center rounded-md transition-colors hover:bg-gray-100", onClick: () => setIsDrawerOpen(false), children: jsx(X, { className: "h-5 w-5" }) })] }), jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [userPrimary && (jsxs("div", { className: "flex items-center gap-2 pb-2", children: [jsx(UserRound, { className: "h-5 w-5 text-gray-500" }), jsx("span", { className: "text-sm font-semibold text-gray-900", children: userPrimary })] })), jsx(Divider, { className: "my-4" }), actions && jsx("div", { className: "mb-2", children: actions }), jsx("nav", { className: "flex flex-col gap-option-gap", children: nav.map((item) => {
|
|
64
64
|
const Icon = item.icon ?? labelIcon(item.label);
|
|
65
|
-
return (jsx(Link, { href: item.href, className: "block w-full", children: jsxs("button", { className: "flex w-full items-center justify-between rounded-
|
|
66
|
-
}) })] }), jsxs("div", { className: "mt-auto border-t px-4 py-3
|
|
65
|
+
return (jsx(Link, { href: item.href, className: "block w-full", children: jsxs("button", { className: "flex min-h-option-row w-full items-center justify-between rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx(Icon, { className: "h-4 w-4 text-muted-foreground" }), jsx("span", { children: item.label }), !!item.badge && (jsx("span", { className: "inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900", children: "!" }))] }), jsx(ChevronRight, { className: "h-4 w-4 text-muted-foreground/60" })] }) }, item.href));
|
|
66
|
+
}) })] }), jsxs("div", { className: "mt-auto flex flex-col gap-option-gap border-t border-border px-4 py-3", children: [profileHref && (jsx(Link, { href: profileHref, className: "block w-full", children: jsxs("button", { className: "flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted", children: [jsx(UserRound, { className: "h-4 w-4" }), "Profile"] }) })), accountNav.map((item) => {
|
|
67
67
|
const Icon = item.icon ?? labelIcon(item.label);
|
|
68
|
-
return (jsx(Link, { href: item.href, className: "block w-full", children: jsxs("button", { className: "flex w-full items-center gap-2 rounded-
|
|
69
|
-
}), jsxs("button", { onClick: () => logout.mutate(), disabled: logout.isPending, className: "flex w-full items-center justify-center gap-2 rounded-
|
|
68
|
+
return (jsx(Link, { href: item.href, className: "block w-full", children: jsxs("button", { className: "flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted", children: [jsx(Icon, { className: "h-4 w-4" }), item.label] }) }, item.href));
|
|
69
|
+
}), jsxs("button", { onClick: () => logout.mutate(), disabled: logout.isPending, className: "flex min-h-option-row w-full items-center justify-center gap-2 rounded-control-sm px-option-x py-2 font-medium text-destructive transition-colors hover:bg-destructive/10", children: [jsx(LogOut, { className: "h-4 w-4" }), logout.isPending ? 'Logging out...' : 'Sign Out'] })] })] }) }))] }));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export { AppHeader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-header.js","sources":["../../src/components/app-header.tsx"],"sourcesContent":["'use client';\n\nimport Link from 'next/link';\nimport Image from 'next/image';\nimport { usePathname, useRouter } from 'next/navigation';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n} from '@/components/dropdown-menu';\nimport { Button } from '@/components/button';\nimport { Divider } from '@/components/divider';\nimport { cn } from '@/utils';\nimport {\n LogOut,\n Menu,\n Search,\n X,\n UserRound,\n ChevronDown,\n ChevronRight,\n Handshake,\n Mail,\n History,\n FileText,\n Users,\n LayoutDashboard,\n FileSignature,\n GraduationCap,\n Building2,\n SearchCheck,\n} from 'lucide-react';\nimport { useState, useEffect } from 'react';\nimport type { ReactNode } from 'react';\nimport type { LucideIcon } from 'lucide-react';\n\nexport interface NavItem {\n href: string;\n label: string;\n badge?: number;\n icon?: LucideIcon;\n}\n\ninterface AppHeaderProps {\n /** Optional site name. */\n siteName?: string;\n homeHref: string;\n nav: NavItem[];\n /** Optional desktop links displayed next to the brand. */\n links?: NavItem[];\n userPrimary?: string;\n userSecondary?: string;\n logout: () => Promise<unknown>;\n postLogoutPath: string;\n profileHref?: string;\n userAvatarUrl?: string | null;\n accountNav?: NavItem[];\n /** Overrides the hardcoded \"Partners\" brand text. */\n brand?: string;\n /** Overrides the hardcoded \"/betterinternship-logo.png\" logo path. */\n logoPath?: string;\n /** Extra controls rendered next to the nav (desktop) and inside the drawer (mobile). */\n actions?: ReactNode;\n /**\n * Inline search control rendered in the header's center region on desktop\n * (`md` and up only). Purely a layout slot — the consumer owns all search\n * state and behavior. For mobile, pair with `onSearchClick`.\n */\n search?: ReactNode;\n /**\n * When set, renders a search icon button on mobile immediately left of the\n * hamburger. Typically opens a full-screen search overlay owned by the\n * consumer.\n */\n onSearchClick?: () => void;\n /**\n * Set to false to hide the mobile hamburger button and its side drawer\n * entirely — for consumers that provide their own mobile navigation (e.g.\n * a bottom tab bar) and don't want the nav/profile/logout items duplicated.\n * Defaults to true.\n */\n showMobileMenu?: boolean;\n}\n\nfunction labelIcon(label: string): LucideIcon {\n const map: Record<string, LucideIcon> = {\n Partners: Handshake,\n Invites: Mail,\n Invitations: Mail,\n Accounts: Users,\n 'Activity Log': History,\n 'MOA Templates': FileText,\n Universities: GraduationCap,\n Companies: Building2,\n 'Company Reviews': SearchCheck,\n 'Request MOA': FileSignature,\n Dashboard: LayoutDashboard,\n };\n return map[label] ?? Handshake;\n}\n\nexport function AppHeader({\n siteName,\n homeHref,\n nav,\n links = [],\n userPrimary,\n userSecondary,\n logout: logoutFn,\n postLogoutPath,\n profileHref,\n userAvatarUrl,\n accountNav = [],\n brand = 'Partners',\n logoPath = '/betterinternship-logo.png',\n actions,\n search,\n onSearchClick,\n showMobileMenu = true,\n}: AppHeaderProps) {\n const pathname = usePathname() ?? '';\n const router = useRouter();\n const queryClient = useQueryClient();\n const [isDrawerOpen, setIsDrawerOpen] = useState(false);\n\n useEffect(() => {\n setIsDrawerOpen(false);\n }, [pathname]);\n\n useEffect(() => {\n document.body.style.overflow = isDrawerOpen ? 'hidden' : '';\n return () => {\n document.body.style.overflow = '';\n };\n }, [isDrawerOpen]);\n\n const logout = useMutation({\n mutationFn: logoutFn,\n onSettled: () => {\n queryClient.clear();\n router.replace(postLogoutPath);\n },\n });\n\n const isActive = (href: string) =>\n pathname === href || pathname.startsWith(`${href}/`);\n\n return (\n <header className=\"sticky top-0 z-40 w-full bg-white\">\n <div className=\"flex min-h-[76px] w-full items-center gap-7 px-4 md:px-6 max-md:min-h-[72px] max-md:gap-3 max-md:py-3\">\n {/* Brand */}\n <Link\n href={homeHref}\n aria-label={brand}\n className=\"inline-flex shrink-0 items-center gap-3 text-lg font-[750] leading-[1.5] tracking-[-.0375rem] text-landing-navy focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue max-md:gap-1.5 max-md:text-base\"\n >\n <div className=\"flex items-center gap-3 max-md:gap-1.5\">\n <Image\n src={logoPath}\n alt=\"\"\n width={24}\n height={24}\n className=\"flex-none\"\n />\n {/* Wordmark hides below md — the logo carries the link, which keeps\n its name via the aria-label above. */}\n <div className=\"hidden items-center md:flex\">\n <span>\n {brand}\n </span>\n {siteName && (\n <>\n <span className=\"mx-2.5 text-gray-300\" aria-hidden=\"true\">\n |\n </span>\n <span className=\"font-display text-gray-500\">{siteName}</span>\n </>\n )}\n </div>\n </div>\n </Link>\n\n {links.length > 0 && (\n <nav aria-label=\"Resources\" className=\"hidden shrink-0 items-center gap-4 text-sm font-[550] text-landing-nav md:flex xl:gap-7\">\n {links.map((item) => (\n <Link\n key={item.href}\n href={item.href}\n aria-current={isActive(item.href) ? 'page' : undefined}\n className=\"flex min-h-11 items-center rounded-sm text-landing-nav transition-colors duration-[180ms] hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue aria-[current=page]:text-landing-blue\"\n >\n {item.label}\n </Link>\n ))}\n </nav>\n )}\n\n {/* Desktop center: inline search slot. The empty div doubles as the\n spacer that keeps the right cluster right-aligned when no search\n is passed. */}\n <div className=\"hidden min-w-0 flex-1 md:flex md:items-center\">\n {search}\n </div>\n\n {/* Desktop right side: nav buttons + user */}\n <div className=\"ml-auto hidden shrink-0 items-center gap-1 md:flex\">\n {nav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Button\n key={item.href}\n variant=\"ghost\"\n className={cn(\n 'relative min-h-12 min-w-0 flex-col items-center justify-center gap-1 rounded-[.33em] px-3 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\n isActive(item.href)\n ? 'text-landing-blue'\n : '',\n )}\n onClick={() => router.push(item.href)}\n >\n <Icon className=\"h-6! w-6!\" strokeWidth={1.7} />\n <span className=\"text-xs\">{item.label}</span>\n {!!item.badge && (\n <span className=\"absolute -top-0.5 right-5.5 inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\n {item.badge}\n </span>\n )}\n </Button>\n );\n })}\n\n {actions}\n\n {/* User dropdown */}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n className={cn(\n 'group min-h-12 w-20 flex-col items-center justify-center gap-1 rounded-[.33em] px-2 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\n (profileHref && isActive(profileHref)) ||\n accountNav.some((item) => isActive(item.href))\n ? 'text-landing-blue'\n : '',\n )}\n >\n <div className=\"flex h-6 w-6 items-center justify-center overflow-hidden rounded-full bg-gray-100\">\n {userAvatarUrl ? (\n <img\n src={userAvatarUrl}\n alt=\"\"\n className=\"h-full w-full object-contain\"\n />\n ) : (\n <UserRound className=\"h-5 w-5 text-gray-500\" />\n )}\n </div>\n <div className=\"flex items-center gap-0.5\">\n <span className=\"text-xs\">Account</span>\n <ChevronDown className=\"h-3! w-3! transition-transform group-data-[state=open]:rotate-180\" />\n </div>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-max min-w-44\">\n {userPrimary && (\n <div className=\"px-2 py-1.5\">\n <div className=\"text-center text-sm font-medium\">\n {userPrimary}\n </div>\n {userSecondary && (\n <div className=\"text-muted-foreground text-center text-xs\">\n {userSecondary}\n </div>\n )}\n </div>\n )}\n <DropdownMenuSeparator />\n {profileHref && (\n <DropdownMenuItem asChild>\n <Link href={profileHref}>\n <UserRound className=\"h-4 w-4\" />\n Profile\n </Link>\n </DropdownMenuItem>\n )}\n {accountNav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <DropdownMenuItem key={item.href} asChild>\n <Link href={item.href}>\n <Icon className=\"h-4 w-4\" />\n {item.label}\n </Link>\n </DropdownMenuItem>\n );\n })}\n {(profileHref || accountNav.length > 0) && (\n <DropdownMenuSeparator />\n )}\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={logout.isPending}\n onClick={() => logout.mutate()}\n >\n <LogOut className=\"h-4 w-4\" />\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n\n {/* Mobile: search trigger + hamburger */}\n <div className=\"flex items-center gap-1 md:hidden\">\n {onSearchClick && (\n <button\n type=\"button\"\n aria-label=\"Search\"\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\n onClick={onSearchClick}\n >\n <Search className=\"h-5 w-5\" />\n </button>\n )}\n {showMobileMenu && (\n <button\n type=\"button\"\n aria-label={isDrawerOpen ? 'Close menu' : 'Open menu'}\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\n onClick={() => setIsDrawerOpen(!isDrawerOpen)}\n >\n {isDrawerOpen ? (\n <X className=\"h-5 w-5\" />\n ) : (\n <Menu className=\"h-5 w-5\" />\n )}\n </button>\n )}\n </div>\n </div>\n\n {/* Mobile right drawer */}\n {showMobileMenu && isDrawerOpen && (\n <div\n className=\"fixed inset-0 z-[30] duration-200 md:hidden\"\n onClick={() => setIsDrawerOpen(false)}\n />\n )}\n\n {showMobileMenu && (\n <div\n className={cn(\n 'fixed top-0 right-0 z-[31] h-[100svh] w-full max-w-[92%] border-l border-border bg-white shadow-xl sm:max-w-[420px] md:hidden',\n 'transition-transform duration-250 ease-out',\n isDrawerOpen ? 'translate-x-0' : 'translate-x-full',\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Mobile menu\"\n >\n <div className=\"flex h-full flex-col\">\n <div className=\"mt-1 flex items-center justify-between border-b px-4 py-3\">\n <div className=\"flex items-center gap-2\">\n <Image\n src={logoPath}\n alt=\"\"\n width={25}\n height={25}\n className=\"h-6 w-6 rounded object-contain\"\n />\n <span className=\"text-sm font-semibold\">{brand}</span>\n <span className=\"rounded border border-border bg-gray-50 px-1 py-0 text-xs font-medium text-gray-400 leading-none\">\n {siteName}\n </span>\n </div>\n <button\n type=\"button\"\n aria-label=\"Close menu\"\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-md transition-colors hover:bg-gray-100\"\n onClick={() => setIsDrawerOpen(false)}\n >\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n\n <div className=\"flex-1 overflow-y-auto p-4\">\n {userPrimary && (\n <div className=\"flex items-center gap-2 pb-2\">\n <UserRound className=\"h-5 w-5 text-gray-500\" />\n <span className=\"text-sm font-semibold text-gray-900\">\n {userPrimary}\n </span>\n </div>\n )}\n\n <Divider className=\"my-4\" />\n\n {actions && <div className=\"mb-2\">{actions}</div>}\n\n <nav className=\"space-y-1\">\n {nav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Link\n key={item.href}\n href={item.href}\n className=\"block w-full\"\n >\n <button className=\"flex w-full items-center justify-between rounded-md border border-transparent px-3 py-2 text-sm transition-colors hover:border-border-hover hover:bg-gray-50\">\n <div className=\"flex items-center gap-2\">\n <Icon className=\"h-4 w-4 text-gray-500\" />\n <span>{item.label}</span>\n {!!item.badge && (\n <span className=\"inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\n !\n </span>\n )}\n </div>\n <ChevronRight className=\"h-4 w-4 text-gray-300\" />\n </button>\n </Link>\n );\n })}\n </nav>\n </div>\n\n <div className=\"mt-auto border-t px-4 py-3 space-y-1\">\n {profileHref && (\n <Link href={profileHref} className=\"block w-full\">\n <button className=\"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm transition-colors hover:bg-gray-50\">\n <UserRound className=\"h-4 w-4\" />\n Profile\n </button>\n </Link>\n )}\n {accountNav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Link\n key={item.href}\n href={item.href}\n className=\"block w-full\"\n >\n <button className=\"flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm transition-colors hover:bg-gray-50\">\n <Icon className=\"h-4 w-4\" />\n {item.label}\n </button>\n </Link>\n );\n })}\n <button\n onClick={() => logout.mutate()}\n disabled={logout.isPending}\n className=\"flex w-full items-center justify-center gap-2 rounded-md py-2 font-medium text-red-600 transition-colors hover:bg-red-50\"\n >\n <LogOut className=\"h-4 w-4\" />\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\n </button>\n </div>\n </div>\n </div>\n )}\n </header>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuFA;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEF;AACF;AAEM;AAmBJ;AACA;AACA;;;;AAKA;;AAGE;AACA;;AAEA;AACF;;AAGE;;;AAGE;;AAEH;AAED;AAGA;AA4DU;AACA;AAOQ;AACA;AAaV;AAYU;AACA;AACA;AA2CJ;AACA;AAQF;AAyGI;AACA;;AAkCF;AACA;;AA2BhB;;"}
|
|
1
|
+
{"version":3,"file":"app-header.js","sources":["../../src/components/app-header.tsx"],"sourcesContent":["'use client';\n\nimport Link from 'next/link';\nimport Image from 'next/image';\nimport { usePathname, useRouter } from 'next/navigation';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n} from '@/components/dropdown-menu';\nimport { Button } from '@/components/button';\nimport { Divider } from '@/components/divider';\nimport { cn } from '@/utils';\nimport {\n LogOut,\n Menu,\n Search,\n X,\n UserRound,\n ChevronDown,\n ChevronRight,\n Handshake,\n Mail,\n History,\n FileText,\n Users,\n LayoutDashboard,\n FileSignature,\n GraduationCap,\n Building2,\n SearchCheck,\n} from 'lucide-react';\nimport { useState, useEffect } from 'react';\nimport type { ReactNode } from 'react';\nimport type { LucideIcon } from 'lucide-react';\n\nexport interface NavItem {\n href: string;\n label: string;\n badge?: number;\n icon?: LucideIcon;\n}\n\ninterface AppHeaderProps {\n /** Optional site name. */\n siteName?: string;\n homeHref: string;\n nav: NavItem[];\n /** Optional desktop links displayed next to the brand. */\n links?: NavItem[];\n userPrimary?: string;\n userSecondary?: string;\n logout: () => Promise<unknown>;\n postLogoutPath: string;\n profileHref?: string;\n userAvatarUrl?: string | null;\n accountNav?: NavItem[];\n /** Overrides the hardcoded \"Partners\" brand text. */\n brand?: string;\n /** Overrides the hardcoded \"/betterinternship-logo.png\" logo path. */\n logoPath?: string;\n /** Extra controls rendered next to the nav (desktop) and inside the drawer (mobile). */\n actions?: ReactNode;\n /**\n * Inline search control rendered in the header's center region on desktop\n * (`md` and up only). Purely a layout slot — the consumer owns all search\n * state and behavior. For mobile, pair with `onSearchClick`.\n */\n search?: ReactNode;\n /**\n * When set, renders a search icon button on mobile immediately left of the\n * hamburger. Typically opens a full-screen search overlay owned by the\n * consumer.\n */\n onSearchClick?: () => void;\n /**\n * Set to false to hide the mobile hamburger button and its side drawer\n * entirely — for consumers that provide their own mobile navigation (e.g.\n * a bottom tab bar) and don't want the nav/profile/logout items duplicated.\n * Defaults to true.\n */\n showMobileMenu?: boolean;\n}\n\nfunction labelIcon(label: string): LucideIcon {\n const map: Record<string, LucideIcon> = {\n Partners: Handshake,\n Invites: Mail,\n Invitations: Mail,\n Accounts: Users,\n 'Activity Log': History,\n 'MOA Templates': FileText,\n Universities: GraduationCap,\n Companies: Building2,\n 'Company Reviews': SearchCheck,\n 'Request MOA': FileSignature,\n Dashboard: LayoutDashboard,\n };\n return map[label] ?? Handshake;\n}\n\nexport function AppHeader({\n siteName,\n homeHref,\n nav,\n links = [],\n userPrimary,\n userSecondary,\n logout: logoutFn,\n postLogoutPath,\n profileHref,\n userAvatarUrl,\n accountNav = [],\n brand = 'Partners',\n logoPath = '/betterinternship-logo.png',\n actions,\n search,\n onSearchClick,\n showMobileMenu = true,\n}: AppHeaderProps) {\n const pathname = usePathname() ?? '';\n const router = useRouter();\n const queryClient = useQueryClient();\n const [isDrawerOpen, setIsDrawerOpen] = useState(false);\n\n useEffect(() => {\n setIsDrawerOpen(false);\n }, [pathname]);\n\n useEffect(() => {\n document.body.style.overflow = isDrawerOpen ? 'hidden' : '';\n return () => {\n document.body.style.overflow = '';\n };\n }, [isDrawerOpen]);\n\n const logout = useMutation({\n mutationFn: logoutFn,\n onSettled: () => {\n queryClient.clear();\n router.replace(postLogoutPath);\n },\n });\n\n const isActive = (href: string) =>\n pathname === href || pathname.startsWith(`${href}/`);\n\n return (\n <header className=\"sticky top-0 z-40 w-full bg-white\">\n <div className=\"flex min-h-[76px] w-full items-center gap-7 px-4 md:px-6 max-md:min-h-[72px] max-md:gap-3 max-md:py-3\">\n {/* Brand */}\n <Link\n href={homeHref}\n aria-label={brand}\n className=\"inline-flex shrink-0 items-center gap-3 text-lg font-[750] leading-[1.5] tracking-[-.0375rem] text-landing-navy focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue max-md:gap-1.5 max-md:text-base\"\n >\n <div className=\"flex items-center gap-3 max-md:gap-1.5\">\n <Image\n src={logoPath}\n alt=\"\"\n width={24}\n height={24}\n className=\"flex-none\"\n />\n {/* Wordmark hides below md — the logo carries the link, which keeps\n its name via the aria-label above. */}\n <div className=\"hidden items-center md:flex\">\n <span>\n {brand}\n </span>\n {siteName && (\n <>\n <span className=\"mx-2.5 text-gray-300\" aria-hidden=\"true\">\n |\n </span>\n <span className=\"font-display text-gray-500\">{siteName}</span>\n </>\n )}\n </div>\n </div>\n </Link>\n\n {links.length > 0 && (\n <nav aria-label=\"Resources\" className=\"hidden shrink-0 items-center gap-4 text-sm font-[550] text-landing-nav md:flex xl:gap-7\">\n {links.map((item) => (\n <Link\n key={item.href}\n href={item.href}\n aria-current={isActive(item.href) ? 'page' : undefined}\n className=\"flex min-h-11 items-center rounded-sm text-landing-nav transition-colors duration-[180ms] hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-landing-blue aria-[current=page]:text-landing-blue\"\n >\n {item.label}\n </Link>\n ))}\n </nav>\n )}\n\n {/* Desktop center: inline search slot. The empty div doubles as the\n spacer that keeps the right cluster right-aligned when no search\n is passed. */}\n <div className=\"hidden min-w-0 flex-1 md:flex md:items-center\">\n {search}\n </div>\n\n {/* Desktop right side: nav buttons + user */}\n <div className=\"ml-auto hidden shrink-0 items-center gap-1 md:flex\">\n {nav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Button\n key={item.href}\n variant=\"ghost\"\n className={cn(\n 'relative min-h-12 min-w-0 flex-col items-center justify-center gap-1 rounded-[.33em] px-3 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\n isActive(item.href)\n ? 'text-landing-blue'\n : '',\n )}\n onClick={() => router.push(item.href)}\n >\n <Icon className=\"h-6! w-6!\" strokeWidth={1.7} />\n <span className=\"text-xs\">{item.label}</span>\n {!!item.badge && (\n <span className=\"absolute -top-0.5 right-5.5 inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\n {item.badge}\n </span>\n )}\n </Button>\n );\n })}\n\n {actions}\n\n {/* User dropdown */}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n className={cn(\n 'group min-h-12 w-20 flex-col items-center justify-center gap-1 rounded-[.33em] px-2 py-1 text-xs font-normal text-gray-600 hover:bg-gray-100 hover:text-landing-blue focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-landing-blue',\n (profileHref && isActive(profileHref)) ||\n accountNav.some((item) => isActive(item.href))\n ? 'text-landing-blue'\n : '',\n )}\n >\n <div className=\"flex h-6 w-6 items-center justify-center overflow-hidden rounded-full bg-gray-100\">\n {userAvatarUrl ? (\n <img\n src={userAvatarUrl}\n alt=\"\"\n className=\"h-full w-full object-contain\"\n />\n ) : (\n <UserRound className=\"h-5 w-5 text-gray-500\" />\n )}\n </div>\n <div className=\"flex items-center gap-0.5\">\n <span className=\"text-xs\">Account</span>\n <ChevronDown className=\"h-3! w-3! transition-transform group-data-[state=open]:rotate-180\" />\n </div>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-max min-w-44\">\n {userPrimary && (\n <div className=\"px-2 py-1.5\">\n <div className=\"text-center text-sm font-medium\">\n {userPrimary}\n </div>\n {userSecondary && (\n <div className=\"text-muted-foreground text-center text-xs\">\n {userSecondary}\n </div>\n )}\n </div>\n )}\n <DropdownMenuSeparator />\n {profileHref && (\n <DropdownMenuItem asChild>\n <Link href={profileHref}>\n <UserRound className=\"h-4 w-4\" />\n Profile\n </Link>\n </DropdownMenuItem>\n )}\n {accountNav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <DropdownMenuItem key={item.href} asChild>\n <Link href={item.href}>\n <Icon className=\"h-4 w-4\" />\n {item.label}\n </Link>\n </DropdownMenuItem>\n );\n })}\n {(profileHref || accountNav.length > 0) && (\n <DropdownMenuSeparator />\n )}\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={logout.isPending}\n onClick={() => logout.mutate()}\n >\n <LogOut className=\"h-4 w-4\" />\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n\n {/* Mobile: search trigger + hamburger */}\n <div className=\"flex items-center gap-1 md:hidden\">\n {onSearchClick && (\n <button\n type=\"button\"\n aria-label=\"Search\"\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\n onClick={onSearchClick}\n >\n <Search className=\"h-5 w-5\" />\n </button>\n )}\n {showMobileMenu && (\n <button\n type=\"button\"\n aria-label={isDrawerOpen ? 'Close menu' : 'Open menu'}\n className=\"inline-flex h-10 w-10 items-center justify-center rounded-md border border-border hover:bg-gray-50\"\n onClick={() => setIsDrawerOpen(!isDrawerOpen)}\n >\n {isDrawerOpen ? (\n <X className=\"h-5 w-5\" />\n ) : (\n <Menu className=\"h-5 w-5\" />\n )}\n </button>\n )}\n </div>\n </div>\n\n {/* Mobile right drawer */}\n {showMobileMenu && isDrawerOpen && (\n <div\n className=\"fixed inset-0 z-[30] duration-200 md:hidden\"\n onClick={() => setIsDrawerOpen(false)}\n />\n )}\n\n {showMobileMenu && (\n <div\n className={cn(\n 'fixed top-0 right-0 z-[31] h-[100svh] w-full max-w-[92%] border-l border-border bg-white shadow-xl sm:max-w-[420px] md:hidden',\n 'transition-transform duration-250 ease-out',\n isDrawerOpen ? 'translate-x-0' : 'translate-x-full',\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Mobile menu\"\n >\n <div className=\"flex h-full flex-col\">\n <div className=\"mt-1 flex items-center justify-between border-b px-4 py-3\">\n <div className=\"flex items-center gap-2\">\n <Image\n src={logoPath}\n alt=\"\"\n width={25}\n height={25}\n className=\"h-6 w-6 rounded object-contain\"\n />\n <span className=\"text-sm font-semibold\">{brand}</span>\n <span className=\"rounded border border-border bg-gray-50 px-1 py-0 text-xs font-medium text-gray-400 leading-none\">\n {siteName}\n </span>\n </div>\n <button\n type=\"button\"\n aria-label=\"Close menu\"\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-md transition-colors hover:bg-gray-100\"\n onClick={() => setIsDrawerOpen(false)}\n >\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n\n <div className=\"flex-1 overflow-y-auto p-4\">\n {userPrimary && (\n <div className=\"flex items-center gap-2 pb-2\">\n <UserRound className=\"h-5 w-5 text-gray-500\" />\n <span className=\"text-sm font-semibold text-gray-900\">\n {userPrimary}\n </span>\n </div>\n )}\n\n <Divider className=\"my-4\" />\n\n {actions && <div className=\"mb-2\">{actions}</div>}\n\n <nav className=\"flex flex-col gap-option-gap\">\n {nav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Link\n key={item.href}\n href={item.href}\n className=\"block w-full\"\n >\n <button className=\"flex min-h-option-row w-full items-center justify-between rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\n <div className=\"flex items-center gap-2\">\n <Icon className=\"h-4 w-4 text-muted-foreground\" />\n <span>{item.label}</span>\n {!!item.badge && (\n <span className=\"inline-flex h-4 w-4 items-center justify-center rounded-full bg-amber-400 text-xs font-bold leading-none text-amber-900\">\n !\n </span>\n )}\n </div>\n <ChevronRight className=\"h-4 w-4 text-muted-foreground/60\" />\n </button>\n </Link>\n );\n })}\n </nav>\n </div>\n\n <div className=\"mt-auto flex flex-col gap-option-gap border-t border-border px-4 py-3\">\n {profileHref && (\n <Link href={profileHref} className=\"block w-full\">\n <button className=\"flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\n <UserRound className=\"h-4 w-4\" />\n Profile\n </button>\n </Link>\n )}\n {accountNav.map((item) => {\n const Icon = item.icon ?? labelIcon(item.label);\n return (\n <Link\n key={item.href}\n href={item.href}\n className=\"block w-full\"\n >\n <button className=\"flex min-h-option-row w-full items-center gap-2 rounded-control-sm px-option-x py-2 text-sm text-foreground transition-colors hover:bg-muted\">\n <Icon className=\"h-4 w-4\" />\n {item.label}\n </button>\n </Link>\n );\n })}\n <button\n onClick={() => logout.mutate()}\n disabled={logout.isPending}\n className=\"flex min-h-option-row w-full items-center justify-center gap-2 rounded-control-sm px-option-x py-2 font-medium text-destructive transition-colors hover:bg-destructive/10\"\n >\n <LogOut className=\"h-4 w-4\" />\n {logout.isPending ? 'Logging out...' : 'Sign Out'}\n </button>\n </div>\n </div>\n </div>\n )}\n </header>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuFA;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEF;AACF;AAEM;AAmBJ;AACA;AACA;;;;AAKA;;AAGE;AACA;;AAEA;AACF;;AAGE;;;AAGE;;AAEH;AAED;AAGA;AA4DU;AACA;AAOQ;AACA;AAaV;AAYU;AACA;AACA;AA2CJ;AACA;AAQF;AAyGI;AACA;;AAkCF;AACA;;AA2BhB;;"}
|
|
@@ -282,17 +282,17 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
|
|
|
282
282
|
if (e.key === "Escape") {
|
|
283
283
|
setIsOpen(false);
|
|
284
284
|
}
|
|
285
|
-
} })] })), jsxs("ul", { className: cn(useMobileSheet && "min-h-0 flex-1 overflow-y-auto overscroll-contain"), children: [allowCustomValue && (jsx("li", { className: "
|
|
285
|
+
} })] })), jsxs("ul", { className: cn("flex flex-col gap-option-gap p-option-inset", useMobileSheet && "min-h-0 flex-1 overflow-y-auto overscroll-contain"), children: [allowCustomValue && (jsx("li", { className: "pointer-events-none px-option-x pb-1 pt-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Suggestions" })), filtered.length ? (filtered.map((option, index) => {
|
|
286
286
|
const active = selectedSet.has(option.id);
|
|
287
287
|
const group = options.find((item) => item.children?.some((child) => child.id === option.id));
|
|
288
288
|
const firstInGroup = group && !filtered.slice(0, index).some((item) => group.children?.some((child) => child.id === item.id));
|
|
289
|
-
return (jsxs(Fragment, { children: [firstInGroup && group && (jsx("li", { children: multiple ? (jsxs("button", { type: "button", "aria-pressed": group.children.every((child) => selectedSet.has(child.id)), className: "flex min-h-
|
|
289
|
+
return (jsxs(Fragment, { children: [firstInGroup && group && (jsx("li", { children: multiple ? (jsxs("button", { type: "button", "aria-pressed": group.children.every((child) => selectedSet.has(child.id)), className: "flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm font-medium text-foreground transition-colors hover:bg-muted max-md:min-h-11", onClick: () => {
|
|
290
290
|
const ids = group.children.map((child) => child.id);
|
|
291
291
|
const next = new Set(value ?? []);
|
|
292
292
|
const allSelected = ids.every((id) => next.has(id));
|
|
293
293
|
ids.forEach((id) => allSelected ? next.delete(id) : next.add(id));
|
|
294
294
|
setter(Array.from(next));
|
|
295
|
-
}, children: [jsx(CheckboxVisual, { checked: group.children.every((child) => selectedSet.has(child.id)) ? true : group.children.some((child) => selectedSet.has(child.id)) ? 'indeterminate' : false }), group.name] })) : jsx("div", { className: "px-
|
|
295
|
+
}, children: [jsx(CheckboxVisual, { checked: group.children.every((child) => selectedSet.has(child.id)) ? true : group.children.some((child) => selectedSet.has(child.id)) ? 'indeterminate' : false }), group.name] })) : jsx("div", { className: "px-option-x py-2 text-sm font-medium text-foreground", children: group.name }) })), jsx("li", { children: jsxs("button", { type: "button", "aria-pressed": multiple ? active : undefined, onClick: () => {
|
|
296
296
|
toggle(option.id);
|
|
297
297
|
if (multiple) {
|
|
298
298
|
// keep open for rapid multi-pick
|
|
@@ -305,8 +305,8 @@ function AutocompleteBase({ required, options, value = [], setter, placeholder,
|
|
|
305
305
|
setQuery("");
|
|
306
306
|
setIsOpen(false);
|
|
307
307
|
}
|
|
308
|
-
}, className: cn("w-full
|
|
309
|
-
})) : (!allowCustomValue || !query.trim() ? (jsx("li", { className: "
|
|
308
|
+
}, className: cn("flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-muted", useMobileSheet && "min-h-12", group && "pl-8", active && "bg-primary-tint"), children: [multiple ? (jsx(CheckboxVisual, { checked: active })) : null, option.name] }) })] }, String(option.id)));
|
|
309
|
+
})) : (!allowCustomValue || !query.trim() ? (jsx("li", { className: "px-option-x py-2 text-sm text-muted-foreground", children: emptyText })) : null), allowCustomValue && query.trim() && !findExactOption(query) && (jsx("li", { children: jsxs("button", { type: "button", className: "flex min-h-11 w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 text-left text-sm text-primary transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary", onMouseDown: (event) => event.preventDefault(), onClick: () => {
|
|
310
310
|
const text = query.trim();
|
|
311
311
|
if (multiple) {
|
|
312
312
|
setter(Array.from(new Set([...(value ?? []), text])));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","sources":["../../src/components/autocomplete.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fragment, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Input } from \"./input\";\nimport { useDetectClickOutside } from '@/hooks/use-detect-click-outside';\nimport { cn } from \"@/utils\";\nimport { ChevronDown, PlusCircleIcon, Search, X } from \"lucide-react\";\nimport { Label } from \"./label\";\nimport { Button } from \"./button\";\nimport { CheckboxVisual } from \"./checkbox\";\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { useMobileSheetViewport } from \"@/hooks/use-mobile-sheet-viewport\";\nimport {\n FieldChromeContext,\n fieldFocusOutlineClassName,\n fieldInteractionClassName,\n useFieldFocus,\n} from \"@/hooks/use-field-focus\";\n\nexport interface IAutocompleteOption<ID extends number | string> {\n id: ID;\n name: string;\n keywords?: string[];\n /** Child options; in multiple mode the group can select all its children. */\n children?: IAutocompleteOption<ID>[];\n}\n\ntype MobileDropdownMode = \"sheet\" | \"inline\";\ntype InputIcons = boolean | \"search\" | \"dropdown\";\n\n/* -------------------------------------------------------\n * Base component (array-based). Single uses length 0..1.\n * -----------------------------------------------------*/\nfunction AutocompleteBase<ID extends number | string>({\n required,\n options,\n value = [],\n setter,\n placeholder,\n className,\n multiple = true,\n label,\n labelAddon,\n allowCustomValue = false,\n preserveOptionOrder = false,\n emptyText = \"No matching options\",\n mobileDropdownMode = \"sheet\",\n inputIcons = false,\n ...props\n}: {\n required?: boolean;\n options: IAutocompleteOption<ID>[];\n value?: ID[]; // single => 0..1 items, multi => any length\n setter: (next: ID[]) => void; // set the whole selection\n placeholder?: string;\n className?: string;\n multiple?: boolean;\n label?: React.ReactNode;\n labelAddon?: React.ReactNode;\n allowCustomValue?: boolean;\n preserveOptionOrder?: boolean;\n emptyText?: string;\n mobileDropdownMode?: MobileDropdownMode;\n inputIcons?: InputIcons;\n}) {\n const [query, setQuery] = useState(\"\");\n const [isOpen, setIsOpen] = useState(false);\n const [dropdownMaxHeight, setDropdownMaxHeight] = useState<number>();\n const isMobile = useMobile();\n const clickOutsideRef = useDetectClickOutside({\n onTriggered: () => {\n // Radix owns outside dismissal for the portalled modal sheet.\n if (isMobile && mobileDropdownMode === 'sheet') return;\n setIsOpen(false);\n },\n });\n const rootRef = useRef<HTMLDivElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const sheetInputRef = useRef<HTMLInputElement | null>(null);\n const sheetRef = useRef<HTMLDivElement | null>(null);\n const sheetCloseRef = useRef<HTMLButtonElement | null>(null);\n const lastSelectionRef = useRef(0);\n // Show the Button focus outline only for keyboard focus, not clicks.\n const { keyboardFocus, focusProps: fieldFocusProps } = useFieldFocus();\n\n const inputId = useId();\n const flatOptions = useMemo(\n () => options.flatMap((option) => option.children?.length ? option.children : [option]),\n [options],\n );\n\n const findExactOption = (value: string) => {\n const normalizedValue = value.trim().toLowerCase();\n return flatOptions.find(\n (o) =>\n o.name?.trim().toLowerCase() === normalizedValue ||\n o.keywords?.some((k) => k === normalizedValue),\n );\n };\n\n const resolveQuerySelection = (nextQuery: string, matchKeywords = true) => {\n const text = nextQuery.trim();\n if (!text) return false;\n\n const exact = matchKeywords\n ? findExactOption(text)\n : flatOptions.find(\n (o) => o.name?.trim().toLowerCase() === text.toLowerCase(),\n );\n if (exact) {\n setter([exact.id]);\n setQuery(\"\");\n return true;\n }\n\n if (allowCustomValue) {\n setter([text as unknown as ID]);\n setQuery(\"\");\n return true;\n }\n\n return false;\n };\n\n const selectedSet = useMemo(() => new Set(value ?? []), [value]);\n\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n const base = q\n ? flatOptions.filter(\n (o) =>\n o.name?.toLowerCase().includes(q) ||\n options.some((group) => group.children?.some((child) => child.id === o.id) && group.name.toLowerCase().includes(q)) ||\n o.keywords?.some((k) => k.includes(q)),\n )\n : flatOptions;\n return preserveOptionOrder || options.some((option) => option.children?.length)\n ? base\n : base.slice().sort((a, b) => a.name.localeCompare(b.name));\n }, [query, flatOptions, options, preserveOptionOrder]);\n\n const toggle = (id: ID) => {\n lastSelectionRef.current = Date.now();\n if (!multiple) {\n setter([id]); // single-select\n setIsOpen(false);\n setQuery(\"\");\n return;\n }\n const set = new Set(value ?? []);\n if (set.has(id)) set.delete(id);\n else set.add(id);\n setter(Array.from(set));\n };\n\n const removeAt = (id: ID) => {\n const set = new Set(value ?? []);\n set.delete(id);\n setter(Array.from(set));\n };\n\n const selectedLabels = useMemo(\n () =>\n (value ?? [])\n .map((id) => {\n const label = flatOptions.find((o) => o.id === id)?.name;\n return label ?? (allowCustomValue ? String(id) : undefined);\n })\n .filter(Boolean) as string[],\n [value, flatOptions, allowCustomValue],\n );\n\n const singleDisplay = !multiple && (selectedLabels[0] ?? \"\");\n const useMobileSheet = isMobile && mobileDropdownMode === \"sheet\";\n const sheetViewport = useMobileSheetViewport(isOpen && useMobileSheet);\n const useInlineMobileDropdown = isMobile && mobileDropdownMode === \"inline\";\n\n\n useEffect(() => {\n if (!isOpen || !useInlineMobileDropdown) {\n setDropdownMaxHeight(undefined);\n return;\n }\n\n const updateDropdownMaxHeight = () => {\n const rootRect = rootRef.current?.getBoundingClientRect();\n if (!rootRect) return;\n\n const viewportHeight =\n window.visualViewport?.height ?? window.innerHeight;\n const gap = 8;\n const availableHeight = viewportHeight - rootRect.bottom - gap;\n setDropdownMaxHeight(Math.max(0, Math.min(400, availableHeight)));\n };\n\n updateDropdownMaxHeight();\n window.addEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.addEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.addEventListener(\"scroll\", updateDropdownMaxHeight);\n\n return () => {\n window.removeEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.removeEventListener(\n \"resize\",\n updateDropdownMaxHeight,\n );\n window.visualViewport?.removeEventListener(\n \"scroll\",\n updateDropdownMaxHeight,\n );\n };\n }, [isOpen, useInlineMobileDropdown]);\n\n const suppressMobileKeyboard =\n isMobile && (useMobileSheet || (mobileDropdownMode === \"inline\" && !allowCustomValue));\n\n // --- keyboard helpers for multi\n const onMultiKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!multiple) return;\n if (allowCustomValue && e.key === \"Enter\" && query.trim().length > 0 && !findExactOption(query)) {\n const text = query.trim();\n const exact = findExactOption(text);\n const nextId = exact ? exact.id : (text as unknown as ID);\n const set = new Set(value ?? []);\n set.add(nextId);\n setter(Array.from(set));\n setQuery(\"\");\n setIsOpen(true);\n e.preventDefault();\n return;\n }\n if (\n e.key === \"Backspace\" &&\n query.length === 0 &&\n (value?.length ?? 0) > 0\n ) {\n const last = value[value.length - 1];\n removeAt(last);\n e.preventDefault();\n }\n if (e.key === \"Enter\") {\n const first = filtered[0];\n if (first) {\n toggle(first.id);\n setQuery(\"\");\n setIsOpen(true);\n e.preventDefault();\n }\n }\n if (e.key === \"ArrowDown\") setIsOpen(true);\n if (e.key === \"Escape\") setIsOpen(false);\n };\n\n // Same hover lift and press feedback as the Dropdown trigger.\n const fieldClassName = cn(\n fieldInteractionClassName,\n keyboardFocus && fieldFocusOutlineClassName,\n );\n\n const decorateSingleInput = (input: React.ReactNode) =>\n inputIcons ? (\n <div className={cn(\"relative min-w-0 flex-1\", fieldClassName)} {...fieldFocusProps}>\n {inputIcons !== \"search\" && inputIcons !== \"dropdown\" && (\n <Search\n className=\"pointer-events-none absolute left-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n )}\n <FieldChromeContext value={true}>{input}</FieldChromeContext>\n {inputIcons === \"search\" ? (\n <Search\n className=\"pointer-events-none absolute right-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n ) : (\n <ChevronDown\n className={cn(\n \"pointer-events-none absolute right-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen && \"rotate-180\",\n )}\n aria-hidden=\"true\"\n />\n )}\n </div>\n ) : (\n <div className={cn(\"relative min-w-0 flex-1\", fieldClassName)} {...fieldFocusProps}>\n <FieldChromeContext value={true}>{input}</FieldChromeContext>\n </div>\n );\n\n const OptionsSurface = useMobileSheet ? SheetContent : 'div';\n const sheetProps = useMobileSheet ? {\n side: 'bottom' as const,\n showCloseButton: false,\n overlayClassName: 'z-[1090] bg-black/25 backdrop-blur-[1px]',\n 'aria-describedby': undefined,\n onOpenAutoFocus: (event: Event) => { event.preventDefault(); sheetCloseRef.current?.focus(); },\n onCloseAutoFocus: (event: Event) => { event.preventDefault(); inputRef.current?.focus(); },\n } : {};\n return (\n <div\n className={cn(\"relative w-full overflow-visible\", className)}\n ref={(node) => {\n rootRef.current = node;\n (\n clickOutsideRef as React.MutableRefObject<HTMLDivElement | null>\n ).current = node;\n }}\n >\n {label ? (\n <Label\n label={label}\n required={required}\n labelAddon={labelAddon}\n />\n ) : null}\n\n {multiple ? (\n // ---------- MULTI: chips inline inside the box ----------\n <div\n className={cn(\n \"relative flex min-h-form-control w-full flex-wrap items-center gap-1 rounded-control-lg border border-input bg-background px-[0.75em] pr-10 hover:border-input-hover\",\n fieldClassName,\n )}\n {...fieldFocusProps}\n onClick={() => {\n setIsOpen(true);\n if (!suppressMobileKeyboard) {\n inputRef.current?.focus();\n }\n }}\n >\n {(value ?? []).map((id) => {\n const label = flatOptions.find((o) => o.id === id)?.name ?? String(id);\n return (\n <span\n key={String(id)}\n className=\"my-0.5 flex items-center gap-1 rounded-control-sm border border-input bg-muted px-2 text-xs\"\n >\n {label}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"xs\"\n className=\"ml-1 h-5 min-h-0 w-5 p-0 hover:bg-muted\"\n onClick={(event) => { event.stopPropagation(); removeAt(id); }}\n aria-label={`Remove ${label}`}\n >\n <X className=\"h-3.5 w-3.5\" />\n </Button>\n </span>\n );\n })}\n <input\n id={inputId}\n ref={inputRef}\n value={query}\n onChange={(e) => {\n setQuery(e.target.value);\n setIsOpen(true);\n }}\n onBlur={() => {\n if (useMobileSheet) return;\n // Delay slightly to let dropdown option clicks register first\n setTimeout(() => {\n if (Date.now() - lastSelectionRef.current < 250) {\n return;\n }\n if (allowCustomValue && query.trim().length > 0) {\n const text = query.trim();\n const exact = findExactOption(text);\n const nextId = exact ? exact.id : (text as unknown as ID);\n setter(Array.from(new Set([...(value ?? []), nextId])));\n setQuery(\"\");\n }\n }, 150);\n }}\n onKeyDown={onMultiKeyDown}\n onFocus={() => { if (!useMobileSheet) setIsOpen(true); }}\n readOnly={suppressMobileKeyboard}\n placeholder={(value?.length ?? 0) === 0 ? placeholder : \"\"}\n className={cn(\n \"h-[calc(var(--spacing-form-control)-2px)] min-w-[8ch] flex-1 border-none bg-transparent p-0 text-base outline-none focus:ring-0\",\n \"placeholder:text-muted-foreground/40\",\n )}\n {...props}\n />\n <ChevronDown\n className={cn(\n \"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen && \"rotate-180\",\n )}\n aria-hidden=\"true\"\n />\n </div>\n ) : (\n // ---------- SINGLE: regular input ----------\n decorateSingleInput(\n <Input\n id={inputId}\n value={singleDisplay || query}\n className={cn(\n \"border-input\",\n inputIcons === \"search\" || inputIcons === \"dropdown\" ? \"pr-10\" : inputIcons && \"px-10\",\n )}\n placeholder={placeholder}\n readOnly={suppressMobileKeyboard}\n onChange={(e) => {\n const nextQuery = e.target.value;\n\n if ((value?.length ?? 0) > 0) {\n setter([]);\n }\n\n const exact = findExactOption(nextQuery);\n // Only auto-fill on an exact NAME match; keyword/acronym matches\n // (e.g. \"dlsu\") require an explicit Enter, blur, or click.\n if (\n exact &&\n exact.name.trim().toLowerCase() ===\n nextQuery.trim().toLowerCase()\n ) {\n setter([exact.id]);\n setQuery(\"\");\n } else {\n setQuery(nextQuery);\n }\n\n setIsOpen(true);\n }}\n onFocus={() => { if (!useMobileSheet) setIsOpen(true); }}\n onClick={(e) => {\n setIsOpen(true);\n if (suppressMobileKeyboard) {\n e.currentTarget.blur();\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && resolveQuerySelection(query, true)) {\n setIsOpen(false);\n e.preventDefault();\n }\n }}\n onBlur={() => {\n if (useMobileSheet) return;\n // slight delay to let dropdown option clicks register first\n setTimeout(() => {\n if (Date.now() - lastSelectionRef.current < 250) {\n return;\n }\n if (!resolveQuerySelection(query, false)) setQuery(\"\");\n }, 150);\n }}\n />,\n )\n )}\n\n {isOpen && (\n <Sheet open={useMobileSheet && isOpen} onOpenChange={next => { if (!next) { setQuery(''); setIsOpen(false); } }}>\n <OptionsSurface\n {...sheetProps}\n ref={useMobileSheet ? sheetRef : undefined}\n role={useMobileSheet ? \"dialog\" : undefined}\n aria-modal={useMobileSheet ? true : undefined}\n aria-label={useMobileSheet ? (typeof label === \"string\" ? label : \"Choose options\") : undefined}\n className={cn(\n \"bg-background text-sm shadow-card border border-border\",\n useMobileSheet\n ? \"fixed left-0 right-0 z-[1100] flex flex-col gap-0 overflow-hidden rounded-t-control-lg border-b-0 p-0\"\n : \"absolute left-0 right-0 z-50 mt-1 max-h-[400px] overflow-y-auto overscroll-contain rounded-control-lg\",\n )}\n style={\n useMobileSheet\n ? {\n bottom: sheetViewport?.bottom ?? 0,\n maxHeight: sheetViewport ? Math.min(sheetViewport.height, 640) : \"80dvh\",\n }\n : undefined\n }\n >\n {useMobileSheet && (\n <div className=\"shrink-0 px-4 pb-3 pt-4\">\n <div className=\"mb-3 flex items-center justify-between gap-4\">\n <SheetTitle className=\"text-base font-semibold text-foreground\">{label || \"Choose options\"}</SheetTitle>\n <button ref={sheetCloseRef} type=\"button\" aria-label=\"Close options\" className=\"-mr-3 flex h-11 w-11 shrink-0 items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\" onClick={() => { setQuery(\"\"); setIsOpen(false); }}>\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n <Input\n ref={sheetInputRef}\n aria-label={typeof label === \"string\" ? `Search ${label}` : \"Search options\"}\n value={query}\n placeholder={placeholder ?? \"Search\"}\n className=\"h-10 min-h-10 max-h-none text-base\"\n onChange={(e) => {\n setQuery(e.target.value);\n setIsOpen(true);\n if ((value?.length ?? 0) > 0 && !multiple) {\n setter([]);\n }\n }}\n onKeyDown={(e) => {\n if (multiple) {\n onMultiKeyDown(e);\n return;\n }\n\n if (e.key === \"Enter\" && resolveQuerySelection(query)) {\n setIsOpen(false);\n e.preventDefault();\n }\n\n if (e.key === \"Escape\") {\n setIsOpen(false);\n }\n }}\n />\n </div>\n )}\n <ul className={cn(useMobileSheet && \"min-h-0 flex-1 overflow-y-auto overscroll-contain\")}>\n {allowCustomValue && (\n <li className=\"w-full text-left px-4 py-2 text-sm text-muted-foreground bg-muted pointer-events-none\">\n Suggestions\n </li>\n )}\n {filtered.length ? (\n filtered.map((option, index) => {\n const active = selectedSet.has(option.id);\n const group = options.find((item) => item.children?.some((child) => child.id === option.id));\n const firstInGroup = group && !filtered.slice(0, index).some((item) => group.children?.some((child) => child.id === item.id));\n return (\n <Fragment key={String(option.id)}>\n {firstInGroup && group && (\n <li>\n {multiple ? (\n <button type=\"button\" aria-pressed={group.children!.every((child) => selectedSet.has(child.id))} className=\"flex min-h-11 w-full items-center gap-2 px-4 py-2 text-left text-sm font-medium text-foreground hover:bg-muted\" onClick={() => {\n const ids = group.children!.map((child) => child.id);\n const next = new Set(value ?? []);\n const allSelected = ids.every((id) => next.has(id));\n ids.forEach((id) => allSelected ? next.delete(id) : next.add(id));\n setter(Array.from(next));\n }}>\n <CheckboxVisual checked={group.children!.every((child) => selectedSet.has(child.id)) ? true : group.children!.some((child) => selectedSet.has(child.id)) ? 'indeterminate' : false} />\n {group.name}\n </button>\n ) : <div className=\"px-4 py-2 text-sm font-medium text-foreground\">{group.name}</div>}\n </li>\n )}\n <li>\n <button\n type=\"button\"\n aria-pressed={multiple ? active : undefined}\n onClick={() => {\n toggle(option.id);\n if (multiple) {\n // keep open for rapid multi-pick\n setQuery(\"\");\n if (!useMobileSheet) {\n inputRef.current?.focus();\n }\n } else {\n setQuery(\"\");\n setIsOpen(false);\n }\n }}\n className={cn(\n \"w-full text-left px-4 py-2 text-sm text-muted-foreground transition-colors flex items-center gap-2 cursor-pointer hover:bg-muted\",\n useMobileSheet && \"min-h-12\",\n group && \"pl-8\",\n active && \"bg-primary-tint\",\n )}\n >\n {multiple ? (\n <CheckboxVisual checked={active} />\n ) : null}\n {option.name}\n </button>\n </li>\n </Fragment>\n );\n })\n ) : (\n !allowCustomValue || !query.trim() ? (\n <li className=\"w-full text-left px-4 py-2 text-sm text-muted-foreground\">\n {emptyText}\n </li>\n ) : null\n )}\n {allowCustomValue && query.trim() && !findExactOption(query) && (\n <li>\n <button\n type=\"button\"\n className=\"flex min-h-11 w-full items-center gap-2 px-4 py-2 text-left text-sm text-primary hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n const text = query.trim();\n if (multiple) {\n setter(Array.from(new Set([...(value ?? []), text as unknown as ID])));\n setQuery(\"\");\n } else {\n resolveQuerySelection(text);\n setIsOpen(false);\n }\n }}\n >\n <PlusCircleIcon className=\"h-4 w-4\" aria-hidden=\"true\" />\n Add “{query.trim()}”\n </button>\n </li>\n )}\n </ul>\n {useMobileSheet && multiple && (\n <div className=\"shrink-0 border-t border-border bg-background px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"min-h-11 w-full\"\n onClick={() => {\n setQuery(\"\");\n setIsOpen(false);\n }}\n >\n Done\n </Button>\n </div>\n )}\n </OptionsSurface>\n </Sheet>\n )}\n </div>\n );\n}\n\ntype AutocompleteCommonProps<ID extends number | string> = {\n required?: boolean;\n options: IAutocompleteOption<ID>[];\n placeholder?: string;\n className?: string;\n label?: React.ReactNode;\n props?: any[];\n /** Allow a user to add their own text. Custom values are strings. */\n allowCustomValue?: boolean;\n preserveOptionOrder?: boolean;\n emptyText?: string;\n mobileDropdownMode?: MobileDropdownMode;\n inputIcons?: InputIcons;\n};\n\nexport type AutocompleteProps<ID extends number | string> = AutocompleteCommonProps<ID> & (\n | { multiple?: false; value?: ID | null; setter: (value?: ID | null) => void }\n | { multiple: true; value?: ID[]; setter: (value: ID[]) => void }\n);\n\nexport const Autocomplete = <ID extends number | string>(config: AutocompleteProps<ID>) => {\n const { required, options, placeholder, className, label, props, allowCustomValue = false,\n preserveOptionOrder = false, emptyText, mobileDropdownMode, inputIcons } = config;\n return (\n <AutocompleteBase<ID>\n required={required}\n options={options}\n multiple={config.multiple === true}\n value={config.multiple === true ? config.value ?? [] : config.value != null ? [config.value] : []}\n setter={(arr) => {\n if (config.multiple === true) config.setter(arr);\n else config.setter(arr[0] ?? null);\n }}\n placeholder={placeholder}\n className={className}\n label={label}\n allowCustomValue={allowCustomValue}\n preserveOptionOrder={preserveOptionOrder}\n emptyText={emptyText}\n mobileDropdownMode={mobileDropdownMode}\n inputIcons={inputIcons}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA+BA;;AAE0D;AAC1D;;;;AAmCE;;;;AAII;;;;AAGH;AACD;AACA;AACA;AACA;AACA;AACA;;;AAIA;AACA;AAKA;;AAEE;AAGI;AAEN;;AAGE;AACA;AAAW;;AAGT;;;AAKA;;AAEA;;;AAIA;;AAEA;;AAGF;AACF;AAEA;AAEA;;;;AAMY;AACA;;AAGV;AACE;;;AAIJ;AACE;;AAEE;;;;;;AAMF;AAAiB;;AACZ;;AAEP;AAEA;;AAEE;;AAEF;;AAKO;AACC;AACA;AACF;AACC;AAIP;AACA;;AAEA;;AAIE;;;;;;AAOE;;;;;AAMA;AACF;AAEA;AACA;;;AAIA;AACE;;;AASF;AACF;AAEA;;AAIA;AACE;;;AAEE;AACA;AACA;;AAEA;;;;;;;AAOF;;;;;;;AASA;AACE;;AAEE;;;;;;AAMJ;;AACA;;AACF;;;;;AAwCA;AACE;AACA;AACA;AACA;;;;AAIF;AAIM;AAEE;AAEJ;;AAYE;;;AASM;;AAEJ;;AAIE;;AAwBE;;AAEF;AAEE;;;;;;;;AAOI;AACA;AACA;;;;;AAKN;AAEsC;;;AA8BpC;;;;AAMA;;;AAGA;AAEE;AACE;AAEF;;;;;;;;AAQkC;;;AAIlC;;AAEJ;AAEE;;;;AAIF;AAEE;;;;;;;AAME;;;;;;AAQoG;AAUnG;AACA;AAID;AACI;AACA;AACD;;AAmBC;;AAEA;;;AAGF;;;;;;;;;AAYE;;;AAGF;;AAaF;AACA;;AAOU;;AAEA;AACA;;;AAcJ;;;;;AAKI;;;;;;;;AAsBZ;AAeM;;;;;;;;;;;;;AAoCpB;AAsBO;AACL;AAEA;AAOM;AAA8B;;;AAEhC;AAYN;;"}
|
|
1
|
+
{"version":3,"file":"autocomplete.js","sources":["../../src/components/autocomplete.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fragment, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Input } from \"./input\";\nimport { useDetectClickOutside } from '@/hooks/use-detect-click-outside';\nimport { cn } from \"@/utils\";\nimport { ChevronDown, PlusCircleIcon, Search, X } from \"lucide-react\";\nimport { Label } from \"./label\";\nimport { Button } from \"./button\";\nimport { CheckboxVisual } from \"./checkbox\";\nimport { Sheet, SheetContent, SheetTitle } from \"./sheet\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { useMobileSheetViewport } from \"@/hooks/use-mobile-sheet-viewport\";\nimport {\n FieldChromeContext,\n fieldFocusOutlineClassName,\n fieldInteractionClassName,\n useFieldFocus,\n} from \"@/hooks/use-field-focus\";\n\nexport interface IAutocompleteOption<ID extends number | string> {\n id: ID;\n name: string;\n keywords?: string[];\n /** Child options; in multiple mode the group can select all its children. */\n children?: IAutocompleteOption<ID>[];\n}\n\ntype MobileDropdownMode = \"sheet\" | \"inline\";\ntype InputIcons = boolean | \"search\" | \"dropdown\";\n\n/* -------------------------------------------------------\n * Base component (array-based). Single uses length 0..1.\n * -----------------------------------------------------*/\nfunction AutocompleteBase<ID extends number | string>({\n required,\n options,\n value = [],\n setter,\n placeholder,\n className,\n multiple = true,\n label,\n labelAddon,\n allowCustomValue = false,\n preserveOptionOrder = false,\n emptyText = \"No matching options\",\n mobileDropdownMode = \"sheet\",\n inputIcons = false,\n ...props\n}: {\n required?: boolean;\n options: IAutocompleteOption<ID>[];\n value?: ID[]; // single => 0..1 items, multi => any length\n setter: (next: ID[]) => void; // set the whole selection\n placeholder?: string;\n className?: string;\n multiple?: boolean;\n label?: React.ReactNode;\n labelAddon?: React.ReactNode;\n allowCustomValue?: boolean;\n preserveOptionOrder?: boolean;\n emptyText?: string;\n mobileDropdownMode?: MobileDropdownMode;\n inputIcons?: InputIcons;\n}) {\n const [query, setQuery] = useState(\"\");\n const [isOpen, setIsOpen] = useState(false);\n const [dropdownMaxHeight, setDropdownMaxHeight] = useState<number>();\n const isMobile = useMobile();\n const clickOutsideRef = useDetectClickOutside({\n onTriggered: () => {\n // Radix owns outside dismissal for the portalled modal sheet.\n if (isMobile && mobileDropdownMode === 'sheet') return;\n setIsOpen(false);\n },\n });\n const rootRef = useRef<HTMLDivElement | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const sheetInputRef = useRef<HTMLInputElement | null>(null);\n const sheetRef = useRef<HTMLDivElement | null>(null);\n const sheetCloseRef = useRef<HTMLButtonElement | null>(null);\n const lastSelectionRef = useRef(0);\n // Show the Button focus outline only for keyboard focus, not clicks.\n const { keyboardFocus, focusProps: fieldFocusProps } = useFieldFocus();\n\n const inputId = useId();\n const flatOptions = useMemo(\n () => options.flatMap((option) => option.children?.length ? option.children : [option]),\n [options],\n );\n\n const findExactOption = (value: string) => {\n const normalizedValue = value.trim().toLowerCase();\n return flatOptions.find(\n (o) =>\n o.name?.trim().toLowerCase() === normalizedValue ||\n o.keywords?.some((k) => k === normalizedValue),\n );\n };\n\n const resolveQuerySelection = (nextQuery: string, matchKeywords = true) => {\n const text = nextQuery.trim();\n if (!text) return false;\n\n const exact = matchKeywords\n ? findExactOption(text)\n : flatOptions.find(\n (o) => o.name?.trim().toLowerCase() === text.toLowerCase(),\n );\n if (exact) {\n setter([exact.id]);\n setQuery(\"\");\n return true;\n }\n\n if (allowCustomValue) {\n setter([text as unknown as ID]);\n setQuery(\"\");\n return true;\n }\n\n return false;\n };\n\n const selectedSet = useMemo(() => new Set(value ?? []), [value]);\n\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n const base = q\n ? flatOptions.filter(\n (o) =>\n o.name?.toLowerCase().includes(q) ||\n options.some((group) => group.children?.some((child) => child.id === o.id) && group.name.toLowerCase().includes(q)) ||\n o.keywords?.some((k) => k.includes(q)),\n )\n : flatOptions;\n return preserveOptionOrder || options.some((option) => option.children?.length)\n ? base\n : base.slice().sort((a, b) => a.name.localeCompare(b.name));\n }, [query, flatOptions, options, preserveOptionOrder]);\n\n const toggle = (id: ID) => {\n lastSelectionRef.current = Date.now();\n if (!multiple) {\n setter([id]); // single-select\n setIsOpen(false);\n setQuery(\"\");\n return;\n }\n const set = new Set(value ?? []);\n if (set.has(id)) set.delete(id);\n else set.add(id);\n setter(Array.from(set));\n };\n\n const removeAt = (id: ID) => {\n const set = new Set(value ?? []);\n set.delete(id);\n setter(Array.from(set));\n };\n\n const selectedLabels = useMemo(\n () =>\n (value ?? [])\n .map((id) => {\n const label = flatOptions.find((o) => o.id === id)?.name;\n return label ?? (allowCustomValue ? String(id) : undefined);\n })\n .filter(Boolean) as string[],\n [value, flatOptions, allowCustomValue],\n );\n\n const singleDisplay = !multiple && (selectedLabels[0] ?? \"\");\n const useMobileSheet = isMobile && mobileDropdownMode === \"sheet\";\n const sheetViewport = useMobileSheetViewport(isOpen && useMobileSheet);\n const useInlineMobileDropdown = isMobile && mobileDropdownMode === \"inline\";\n\n\n useEffect(() => {\n if (!isOpen || !useInlineMobileDropdown) {\n setDropdownMaxHeight(undefined);\n return;\n }\n\n const updateDropdownMaxHeight = () => {\n const rootRect = rootRef.current?.getBoundingClientRect();\n if (!rootRect) return;\n\n const viewportHeight =\n window.visualViewport?.height ?? window.innerHeight;\n const gap = 8;\n const availableHeight = viewportHeight - rootRect.bottom - gap;\n setDropdownMaxHeight(Math.max(0, Math.min(400, availableHeight)));\n };\n\n updateDropdownMaxHeight();\n window.addEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.addEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.addEventListener(\"scroll\", updateDropdownMaxHeight);\n\n return () => {\n window.removeEventListener(\"resize\", updateDropdownMaxHeight);\n window.visualViewport?.removeEventListener(\n \"resize\",\n updateDropdownMaxHeight,\n );\n window.visualViewport?.removeEventListener(\n \"scroll\",\n updateDropdownMaxHeight,\n );\n };\n }, [isOpen, useInlineMobileDropdown]);\n\n const suppressMobileKeyboard =\n isMobile && (useMobileSheet || (mobileDropdownMode === \"inline\" && !allowCustomValue));\n\n // --- keyboard helpers for multi\n const onMultiKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (!multiple) return;\n if (allowCustomValue && e.key === \"Enter\" && query.trim().length > 0 && !findExactOption(query)) {\n const text = query.trim();\n const exact = findExactOption(text);\n const nextId = exact ? exact.id : (text as unknown as ID);\n const set = new Set(value ?? []);\n set.add(nextId);\n setter(Array.from(set));\n setQuery(\"\");\n setIsOpen(true);\n e.preventDefault();\n return;\n }\n if (\n e.key === \"Backspace\" &&\n query.length === 0 &&\n (value?.length ?? 0) > 0\n ) {\n const last = value[value.length - 1];\n removeAt(last);\n e.preventDefault();\n }\n if (e.key === \"Enter\") {\n const first = filtered[0];\n if (first) {\n toggle(first.id);\n setQuery(\"\");\n setIsOpen(true);\n e.preventDefault();\n }\n }\n if (e.key === \"ArrowDown\") setIsOpen(true);\n if (e.key === \"Escape\") setIsOpen(false);\n };\n\n // Same hover lift and press feedback as the Dropdown trigger.\n const fieldClassName = cn(\n fieldInteractionClassName,\n keyboardFocus && fieldFocusOutlineClassName,\n );\n\n const decorateSingleInput = (input: React.ReactNode) =>\n inputIcons ? (\n <div className={cn(\"relative min-w-0 flex-1\", fieldClassName)} {...fieldFocusProps}>\n {inputIcons !== \"search\" && inputIcons !== \"dropdown\" && (\n <Search\n className=\"pointer-events-none absolute left-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n )}\n <FieldChromeContext value={true}>{input}</FieldChromeContext>\n {inputIcons === \"search\" ? (\n <Search\n className=\"pointer-events-none absolute right-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n ) : (\n <ChevronDown\n className={cn(\n \"pointer-events-none absolute right-3 top-1/2 z-20 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen && \"rotate-180\",\n )}\n aria-hidden=\"true\"\n />\n )}\n </div>\n ) : (\n <div className={cn(\"relative min-w-0 flex-1\", fieldClassName)} {...fieldFocusProps}>\n <FieldChromeContext value={true}>{input}</FieldChromeContext>\n </div>\n );\n\n const OptionsSurface = useMobileSheet ? SheetContent : 'div';\n const sheetProps = useMobileSheet ? {\n side: 'bottom' as const,\n showCloseButton: false,\n overlayClassName: 'z-[1090] bg-black/25 backdrop-blur-[1px]',\n 'aria-describedby': undefined,\n onOpenAutoFocus: (event: Event) => { event.preventDefault(); sheetCloseRef.current?.focus(); },\n onCloseAutoFocus: (event: Event) => { event.preventDefault(); inputRef.current?.focus(); },\n } : {};\n return (\n <div\n className={cn(\"relative w-full overflow-visible\", className)}\n ref={(node) => {\n rootRef.current = node;\n (\n clickOutsideRef as React.MutableRefObject<HTMLDivElement | null>\n ).current = node;\n }}\n >\n {label ? (\n <Label\n label={label}\n required={required}\n labelAddon={labelAddon}\n />\n ) : null}\n\n {multiple ? (\n // ---------- MULTI: chips inline inside the box ----------\n <div\n className={cn(\n \"relative flex min-h-form-control w-full flex-wrap items-center gap-1 rounded-control-lg border border-input bg-background px-[0.75em] pr-10 hover:border-input-hover\",\n fieldClassName,\n )}\n {...fieldFocusProps}\n onClick={() => {\n setIsOpen(true);\n if (!suppressMobileKeyboard) {\n inputRef.current?.focus();\n }\n }}\n >\n {(value ?? []).map((id) => {\n const label = flatOptions.find((o) => o.id === id)?.name ?? String(id);\n return (\n <span\n key={String(id)}\n className=\"my-0.5 flex items-center gap-1 rounded-control-sm border border-input bg-muted px-2 text-xs\"\n >\n {label}\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"xs\"\n className=\"ml-1 h-5 min-h-0 w-5 p-0 hover:bg-muted\"\n onClick={(event) => { event.stopPropagation(); removeAt(id); }}\n aria-label={`Remove ${label}`}\n >\n <X className=\"h-3.5 w-3.5\" />\n </Button>\n </span>\n );\n })}\n <input\n id={inputId}\n ref={inputRef}\n value={query}\n onChange={(e) => {\n setQuery(e.target.value);\n setIsOpen(true);\n }}\n onBlur={() => {\n if (useMobileSheet) return;\n // Delay slightly to let dropdown option clicks register first\n setTimeout(() => {\n if (Date.now() - lastSelectionRef.current < 250) {\n return;\n }\n if (allowCustomValue && query.trim().length > 0) {\n const text = query.trim();\n const exact = findExactOption(text);\n const nextId = exact ? exact.id : (text as unknown as ID);\n setter(Array.from(new Set([...(value ?? []), nextId])));\n setQuery(\"\");\n }\n }, 150);\n }}\n onKeyDown={onMultiKeyDown}\n onFocus={() => { if (!useMobileSheet) setIsOpen(true); }}\n readOnly={suppressMobileKeyboard}\n placeholder={(value?.length ?? 0) === 0 ? placeholder : \"\"}\n className={cn(\n \"h-[calc(var(--spacing-form-control)-2px)] min-w-[8ch] flex-1 border-none bg-transparent p-0 text-base outline-none focus:ring-0\",\n \"placeholder:text-muted-foreground/40\",\n )}\n {...props}\n />\n <ChevronDown\n className={cn(\n \"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen && \"rotate-180\",\n )}\n aria-hidden=\"true\"\n />\n </div>\n ) : (\n // ---------- SINGLE: regular input ----------\n decorateSingleInput(\n <Input\n id={inputId}\n value={singleDisplay || query}\n className={cn(\n \"border-input\",\n inputIcons === \"search\" || inputIcons === \"dropdown\" ? \"pr-10\" : inputIcons && \"px-10\",\n )}\n placeholder={placeholder}\n readOnly={suppressMobileKeyboard}\n onChange={(e) => {\n const nextQuery = e.target.value;\n\n if ((value?.length ?? 0) > 0) {\n setter([]);\n }\n\n const exact = findExactOption(nextQuery);\n // Only auto-fill on an exact NAME match; keyword/acronym matches\n // (e.g. \"dlsu\") require an explicit Enter, blur, or click.\n if (\n exact &&\n exact.name.trim().toLowerCase() ===\n nextQuery.trim().toLowerCase()\n ) {\n setter([exact.id]);\n setQuery(\"\");\n } else {\n setQuery(nextQuery);\n }\n\n setIsOpen(true);\n }}\n onFocus={() => { if (!useMobileSheet) setIsOpen(true); }}\n onClick={(e) => {\n setIsOpen(true);\n if (suppressMobileKeyboard) {\n e.currentTarget.blur();\n }\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && resolveQuerySelection(query, true)) {\n setIsOpen(false);\n e.preventDefault();\n }\n }}\n onBlur={() => {\n if (useMobileSheet) return;\n // slight delay to let dropdown option clicks register first\n setTimeout(() => {\n if (Date.now() - lastSelectionRef.current < 250) {\n return;\n }\n if (!resolveQuerySelection(query, false)) setQuery(\"\");\n }, 150);\n }}\n />,\n )\n )}\n\n {isOpen && (\n <Sheet open={useMobileSheet && isOpen} onOpenChange={next => { if (!next) { setQuery(''); setIsOpen(false); } }}>\n <OptionsSurface\n {...sheetProps}\n ref={useMobileSheet ? sheetRef : undefined}\n role={useMobileSheet ? \"dialog\" : undefined}\n aria-modal={useMobileSheet ? true : undefined}\n aria-label={useMobileSheet ? (typeof label === \"string\" ? label : \"Choose options\") : undefined}\n className={cn(\n \"bg-background text-sm shadow-card border border-border\",\n useMobileSheet\n ? \"fixed left-0 right-0 z-[1100] flex flex-col gap-0 overflow-hidden rounded-t-control-lg border-b-0 p-0\"\n : \"absolute left-0 right-0 z-50 mt-1 max-h-[400px] overflow-y-auto overscroll-contain rounded-control-lg\",\n )}\n style={\n useMobileSheet\n ? {\n bottom: sheetViewport?.bottom ?? 0,\n maxHeight: sheetViewport ? Math.min(sheetViewport.height, 640) : \"80dvh\",\n }\n : undefined\n }\n >\n {useMobileSheet && (\n <div className=\"shrink-0 px-4 pb-3 pt-4\">\n <div className=\"mb-3 flex items-center justify-between gap-4\">\n <SheetTitle className=\"text-base font-semibold text-foreground\">{label || \"Choose options\"}</SheetTitle>\n <button ref={sheetCloseRef} type=\"button\" aria-label=\"Close options\" className=\"-mr-3 flex h-11 w-11 shrink-0 items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\" onClick={() => { setQuery(\"\"); setIsOpen(false); }}>\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n <Input\n ref={sheetInputRef}\n aria-label={typeof label === \"string\" ? `Search ${label}` : \"Search options\"}\n value={query}\n placeholder={placeholder ?? \"Search\"}\n className=\"h-10 min-h-10 max-h-none text-base\"\n onChange={(e) => {\n setQuery(e.target.value);\n setIsOpen(true);\n if ((value?.length ?? 0) > 0 && !multiple) {\n setter([]);\n }\n }}\n onKeyDown={(e) => {\n if (multiple) {\n onMultiKeyDown(e);\n return;\n }\n\n if (e.key === \"Enter\" && resolveQuerySelection(query)) {\n setIsOpen(false);\n e.preventDefault();\n }\n\n if (e.key === \"Escape\") {\n setIsOpen(false);\n }\n }}\n />\n </div>\n )}\n <ul className={cn(\"flex flex-col gap-option-gap p-option-inset\", useMobileSheet && \"min-h-0 flex-1 overflow-y-auto overscroll-contain\")}>\n {allowCustomValue && (\n <li className=\"pointer-events-none px-option-x pb-1 pt-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n Suggestions\n </li>\n )}\n {filtered.length ? (\n filtered.map((option, index) => {\n const active = selectedSet.has(option.id);\n const group = options.find((item) => item.children?.some((child) => child.id === option.id));\n const firstInGroup = group && !filtered.slice(0, index).some((item) => group.children?.some((child) => child.id === item.id));\n return (\n <Fragment key={String(option.id)}>\n {firstInGroup && group && (\n <li>\n {multiple ? (\n <button type=\"button\" aria-pressed={group.children!.every((child) => selectedSet.has(child.id))} className=\"flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm font-medium text-foreground transition-colors hover:bg-muted max-md:min-h-11\" onClick={() => {\n const ids = group.children!.map((child) => child.id);\n const next = new Set(value ?? []);\n const allSelected = ids.every((id) => next.has(id));\n ids.forEach((id) => allSelected ? next.delete(id) : next.add(id));\n setter(Array.from(next));\n }}>\n <CheckboxVisual checked={group.children!.every((child) => selectedSet.has(child.id)) ? true : group.children!.some((child) => selectedSet.has(child.id)) ? 'indeterminate' : false} />\n {group.name}\n </button>\n ) : <div className=\"px-option-x py-2 text-sm font-medium text-foreground\">{group.name}</div>}\n </li>\n )}\n <li>\n <button\n type=\"button\"\n aria-pressed={multiple ? active : undefined}\n onClick={() => {\n toggle(option.id);\n if (multiple) {\n // keep open for rapid multi-pick\n setQuery(\"\");\n if (!useMobileSheet) {\n inputRef.current?.focus();\n }\n } else {\n setQuery(\"\");\n setIsOpen(false);\n }\n }}\n className={cn(\n \"flex min-h-option-row w-full cursor-pointer items-center gap-3 rounded-control-sm px-option-x py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-muted\",\n useMobileSheet && \"min-h-12\",\n group && \"pl-8\",\n active && \"bg-primary-tint\",\n )}\n >\n {multiple ? (\n <CheckboxVisual checked={active} />\n ) : null}\n {option.name}\n </button>\n </li>\n </Fragment>\n );\n })\n ) : (\n !allowCustomValue || !query.trim() ? (\n <li className=\"px-option-x py-2 text-sm text-muted-foreground\">\n {emptyText}\n </li>\n ) : null\n )}\n {allowCustomValue && query.trim() && !findExactOption(query) && (\n <li>\n <button\n type=\"button\"\n className=\"flex min-h-11 w-full cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 text-left text-sm text-primary transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-primary\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n const text = query.trim();\n if (multiple) {\n setter(Array.from(new Set([...(value ?? []), text as unknown as ID])));\n setQuery(\"\");\n } else {\n resolveQuerySelection(text);\n setIsOpen(false);\n }\n }}\n >\n <PlusCircleIcon className=\"h-4 w-4\" aria-hidden=\"true\" />\n Add “{query.trim()}”\n </button>\n </li>\n )}\n </ul>\n {useMobileSheet && multiple && (\n <div className=\"shrink-0 border-t border-border bg-background px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"min-h-11 w-full\"\n onClick={() => {\n setQuery(\"\");\n setIsOpen(false);\n }}\n >\n Done\n </Button>\n </div>\n )}\n </OptionsSurface>\n </Sheet>\n )}\n </div>\n );\n}\n\ntype AutocompleteCommonProps<ID extends number | string> = {\n required?: boolean;\n options: IAutocompleteOption<ID>[];\n placeholder?: string;\n className?: string;\n label?: React.ReactNode;\n props?: any[];\n /** Allow a user to add their own text. Custom values are strings. */\n allowCustomValue?: boolean;\n preserveOptionOrder?: boolean;\n emptyText?: string;\n mobileDropdownMode?: MobileDropdownMode;\n inputIcons?: InputIcons;\n};\n\nexport type AutocompleteProps<ID extends number | string> = AutocompleteCommonProps<ID> & (\n | { multiple?: false; value?: ID | null; setter: (value?: ID | null) => void }\n | { multiple: true; value?: ID[]; setter: (value: ID[]) => void }\n);\n\nexport const Autocomplete = <ID extends number | string>(config: AutocompleteProps<ID>) => {\n const { required, options, placeholder, className, label, props, allowCustomValue = false,\n preserveOptionOrder = false, emptyText, mobileDropdownMode, inputIcons } = config;\n return (\n <AutocompleteBase<ID>\n required={required}\n options={options}\n multiple={config.multiple === true}\n value={config.multiple === true ? config.value ?? [] : config.value != null ? [config.value] : []}\n setter={(arr) => {\n if (config.multiple === true) config.setter(arr);\n else config.setter(arr[0] ?? null);\n }}\n placeholder={placeholder}\n className={className}\n label={label}\n allowCustomValue={allowCustomValue}\n preserveOptionOrder={preserveOptionOrder}\n emptyText={emptyText}\n mobileDropdownMode={mobileDropdownMode}\n inputIcons={inputIcons}\n {...props}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA+BA;;AAE0D;AAC1D;;;;AAmCE;;;;AAII;;;;AAGH;AACD;AACA;AACA;AACA;AACA;AACA;;;AAIA;AACA;AAKA;;AAEE;AAGI;AAEN;;AAGE;AACA;AAAW;;AAGT;;;AAKA;;AAEA;;;AAIA;;AAEA;;AAGF;AACF;AAEA;AAEA;;;;AAMY;AACA;;AAGV;AACE;;;AAIJ;AACE;;AAEE;;;;;;AAMF;AAAiB;;AACZ;;AAEP;AAEA;;AAEE;;AAEF;;AAKO;AACC;AACA;AACF;AACC;AAIP;AACA;;AAEA;;AAIE;;;;;;AAOE;;;;;AAMA;AACF;AAEA;AACA;;;AAIA;AACE;;;AASF;AACF;AAEA;;AAIA;AACE;;;AAEE;AACA;AACA;;AAEA;;;;;;;AAOF;;;;;;;AASA;AACE;;AAEE;;;;;;AAMJ;;AACA;;AACF;;;;;AAwCA;AACE;AACA;AACA;AACA;;;;AAIF;AAIM;AAEE;AAEJ;;AAYE;;;AASM;;AAEJ;;AAIE;;AAwBE;;AAEF;AAEE;;;;;;;;AAOI;AACA;AACA;;;;;AAKN;AAEsC;;;AA8BpC;;;;AAMA;;;AAGA;AAEE;AACE;AAEF;;;;;;;;AAQkC;;;AAIlC;;AAEJ;AAEE;;;;AAIF;AAEE;;;;;;;AAME;;;;;;AAQoG;AAUnG;AACA;AAID;AACI;AACA;AACD;;AAmBC;;AAEA;;;AAGF;;;;;;;;;AAYE;;;AAGF;;AAaF;AACA;;AAOU;;AAEA;AACA;;;AAcJ;;;;;AAKI;;;;;;;;AAsBZ;AAeM;;;;;;;;;;;;;AAoCpB;AAsBO;AACL;AAEA;AAOM;AAA8B;;;AAEhC;AAYN;;"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactNode } from "react";
|
|
2
2
|
import type { LucideIcon } from "lucide-react";
|
|
3
3
|
type BannerVariant = "neutral" | "primary" | "warning" | "destructive" | "banner";
|
|
4
|
-
declare function Banner({ icon: Icon, media, visual, visualClassName, title, description, action, actionClassName, variant, compact, className, ...props }: ComponentProps<"div"> & {
|
|
4
|
+
declare function Banner({ icon: Icon, media, visual, visualClassName, title, description, action, actionClassName, variant, compact, className, ...props }: Omit<ComponentProps<"div">, "title"> & {
|
|
5
5
|
/** Accepts a Lucide icon component or any custom React node. */
|
|
6
6
|
icon?: LucideIcon | ReactNode;
|
|
7
7
|
media?: ReactNode;
|
|
8
8
|
visual?: ReactNode;
|
|
9
9
|
visualClassName?: string;
|
|
10
|
+
/** Any node, e.g. an icon inline with the text (not the HTML title attribute). */
|
|
10
11
|
title: ReactNode;
|
|
11
12
|
description?: ReactNode;
|
|
12
13
|
action?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.js","sources":["../../src/components/banner.tsx"],"sourcesContent":["import { isValidElement, type ComponentProps, type ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype BannerVariant = \"neutral\" | \"primary\" | \"warning\" | \"destructive\" | \"banner\";\n\nconst variantClasses: Record<\n BannerVariant,\n { container: string; icon: string }\n> = {\n banner: {\n container: 'border-secondary-border bg-secondary text-secondary-foreground',\n icon: 'bg-secondary text-secondary-foreground',\n },\n neutral: {\n container: 'border-landing-control bg-background text-landing-nav',\n icon: 'bg-v2-surface-subtle text-landing-nav',\n },\n primary: {\n container:\n \"border-primary/25 bg-primary/[0.035] transition-colors duration-state ease-out-strong hover:bg-primary/[0.06] motion-reduce:transition-none\",\n icon: \"bg-primary/5 text-primary\",\n },\n warning: {\n container:\n \"border-warning/30 bg-warning/10 transition-colors duration-state ease-out-strong hover:bg-warning/15 motion-reduce:transition-none\",\n icon: \"bg-warning/10 text-warning\",\n },\n destructive: {\n container:\n \"border-destructive/30 bg-destructive/5 transition-colors duration-state ease-out-strong hover:bg-destructive/10 motion-reduce:transition-none\",\n icon: \"bg-destructive/10 text-destructive\",\n },\n};\n\nfunction Banner({\n icon: Icon,\n media,\n visual,\n visualClassName,\n title,\n description,\n action,\n actionClassName,\n variant = \"primary\",\n compact = false,\n className,\n ...props\n}: ComponentProps<\"div\"> & {\n /** Accepts a Lucide icon component or any custom React node. */\n icon?: LucideIcon | ReactNode;\n media?: ReactNode;\n visual?: ReactNode;\n visualClassName?: string;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n actionClassName?: string;\n variant?: BannerVariant;\n compact?: boolean;\n}) {\n const styles = variantClasses[variant];\n // The icon is optional: without one (or a custom media node) the slot is\n // dropped entirely rather than leaving an empty tinted square.\n const IconComponent = typeof Icon === 'function' || (Icon && typeof Icon === 'object' && !isValidElement(Icon)) ? Icon as LucideIcon : undefined;\n const leadingVisual = visual ?? media;\n const hasIconSlot = Boolean(leadingVisual || Icon);\n\n return (\n <div\n data-slot=\"banner\"\n className={cn(\n \"group/banner flex flex-col rounded-control-lg border\",\n compact\n ? \"items-start gap-3 p-3 sm:flex-row sm:items-start sm:gap-2\"\n : \"gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5\",\n styles.container,\n className,\n )}\n {...props}\n >\n <div\n className={cn(\n \"flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3\",\n compact && \"gap-2 sm:items-start sm:gap-2\",\n )}\n >\n {hasIconSlot && (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-control-lg\",\n compact ? \"size-8\" : \"size-10 sm:self-center\",\n styles.icon,\n visualClassName,\n )}\n >\n {leadingVisual ??\n (IconComponent ? (\n <IconComponent\n className={compact ? \"size-4\" : \"size-5\"}\n aria-hidden=\"true\"\n />\n ) : isValidElement(Icon) ? Icon : (Icon as ReactNode))}\n </span>\n )}\n <div\n className={cn(\n \"min-w-0 flex-1\",\n description ? \"space-y-0.5\" : \"flex flex-col justify-center\",\n )}\n >\n <p className={cn(\"text-sm font-medium\", variant === 'banner' ? 'text-secondary-foreground' : 'text-foreground')}>{title}</p>\n {description && (\n <div className={cn(\"text-sm\", variant === 'banner' ? 'text-secondary-foreground' : 'text-muted-foreground')}>{description}</div>\n )}\n </div>\n </div>\n {action && (\n <div\n className={cn(\n \"w-full shrink-0 sm:w-auto sm:self-center\",\n actionClassName,\n )}\n >\n {action}\n </div>\n )}\n </div>\n );\n}\n\nexport { Banner, type BannerVariant };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAMA,MAAM,cAAc,GAGhB;AACF,IAAA,MAAM,EAAE;AACN,QAAA,SAAS,EAAE,gEAAgE;AAC3E,QAAA,IAAI,EAAE,wCAAwC;AAC/C,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EAAE,uDAAuD;AAClE,QAAA,IAAI,EAAE,uCAAuC;AAC9C,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACL,6IAA6I;AACjJ,QAAA,IAAI,EAAE,2BAA2B;AAClC,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACL,oIAAoI;AACxI,QAAA,IAAI,EAAE,4BAA4B;AACnC,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,SAAS,EACL,+IAA+I;AACnJ,QAAA,IAAI,EAAE,oCAAoC;AAC3C,KAAA;CACF;AAED,SAAS,MAAM,CAAC,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,WAAW,EACX,MAAM,EACN,eAAe,EACf,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,KAAK,EACf,SAAS,EACT,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"banner.js","sources":["../../src/components/banner.tsx"],"sourcesContent":["import { isValidElement, type ComponentProps, type ReactNode } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype BannerVariant = \"neutral\" | \"primary\" | \"warning\" | \"destructive\" | \"banner\";\n\nconst variantClasses: Record<\n BannerVariant,\n { container: string; icon: string }\n> = {\n banner: {\n container: 'border-secondary-border bg-secondary text-secondary-foreground',\n icon: 'bg-secondary text-secondary-foreground',\n },\n neutral: {\n container: 'border-landing-control bg-background text-landing-nav',\n icon: 'bg-v2-surface-subtle text-landing-nav',\n },\n primary: {\n container:\n \"border-primary/25 bg-primary/[0.035] transition-colors duration-state ease-out-strong hover:bg-primary/[0.06] motion-reduce:transition-none\",\n icon: \"bg-primary/5 text-primary\",\n },\n warning: {\n container:\n \"border-warning/30 bg-warning/10 transition-colors duration-state ease-out-strong hover:bg-warning/15 motion-reduce:transition-none\",\n icon: \"bg-warning/10 text-warning\",\n },\n destructive: {\n container:\n \"border-destructive/30 bg-destructive/5 transition-colors duration-state ease-out-strong hover:bg-destructive/10 motion-reduce:transition-none\",\n icon: \"bg-destructive/10 text-destructive\",\n },\n};\n\nfunction Banner({\n icon: Icon,\n media,\n visual,\n visualClassName,\n title,\n description,\n action,\n actionClassName,\n variant = \"primary\",\n compact = false,\n className,\n ...props\n}: Omit<ComponentProps<\"div\">, \"title\"> & {\n /** Accepts a Lucide icon component or any custom React node. */\n icon?: LucideIcon | ReactNode;\n media?: ReactNode;\n visual?: ReactNode;\n visualClassName?: string;\n /** Any node, e.g. an icon inline with the text (not the HTML title attribute). */\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n actionClassName?: string;\n variant?: BannerVariant;\n compact?: boolean;\n}) {\n const styles = variantClasses[variant];\n // The icon is optional: without one (or a custom media node) the slot is\n // dropped entirely rather than leaving an empty tinted square.\n const IconComponent = typeof Icon === 'function' || (Icon && typeof Icon === 'object' && !isValidElement(Icon)) ? Icon as LucideIcon : undefined;\n const leadingVisual = visual ?? media;\n const hasIconSlot = Boolean(leadingVisual || Icon);\n\n return (\n <div\n data-slot=\"banner\"\n className={cn(\n \"group/banner flex flex-col rounded-control-lg border\",\n compact\n ? \"items-start gap-3 p-3 sm:flex-row sm:items-start sm:gap-2\"\n : \"gap-4 px-4 py-4 sm:flex-row sm:items-stretch sm:gap-3 sm:px-5\",\n styles.container,\n className,\n )}\n {...props}\n >\n <div\n className={cn(\n \"flex min-w-0 flex-1 items-start gap-3 sm:items-stretch sm:gap-3\",\n compact && \"gap-2 sm:items-start sm:gap-2\",\n )}\n >\n {hasIconSlot && (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-control-lg\",\n compact ? \"size-8\" : \"size-10 sm:self-center\",\n styles.icon,\n visualClassName,\n )}\n >\n {leadingVisual ??\n (IconComponent ? (\n <IconComponent\n className={compact ? \"size-4\" : \"size-5\"}\n aria-hidden=\"true\"\n />\n ) : isValidElement(Icon) ? Icon : (Icon as ReactNode))}\n </span>\n )}\n <div\n className={cn(\n \"min-w-0 flex-1\",\n description ? \"space-y-0.5\" : \"flex flex-col justify-center\",\n )}\n >\n <p className={cn(\"text-sm font-medium\", variant === 'banner' ? 'text-secondary-foreground' : 'text-foreground')}>{title}</p>\n {description && (\n <div className={cn(\"text-sm\", variant === 'banner' ? 'text-secondary-foreground' : 'text-muted-foreground')}>{description}</div>\n )}\n </div>\n </div>\n {action && (\n <div\n className={cn(\n \"w-full shrink-0 sm:w-auto sm:self-center\",\n actionClassName,\n )}\n >\n {action}\n </div>\n )}\n </div>\n );\n}\n\nexport { Banner, type BannerVariant };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAMA,MAAM,cAAc,GAGhB;AACF,IAAA,MAAM,EAAE;AACN,QAAA,SAAS,EAAE,gEAAgE;AAC3E,QAAA,IAAI,EAAE,wCAAwC;AAC/C,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EAAE,uDAAuD;AAClE,QAAA,IAAI,EAAE,uCAAuC;AAC9C,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACL,6IAA6I;AACjJ,QAAA,IAAI,EAAE,2BAA2B;AAClC,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,SAAS,EACL,oIAAoI;AACxI,QAAA,IAAI,EAAE,4BAA4B;AACnC,KAAA;AACD,IAAA,WAAW,EAAE;AACX,QAAA,SAAS,EACL,+IAA+I;AACnJ,QAAA,IAAI,EAAE,oCAAoC;AAC3C,KAAA;CACF;AAED,SAAS,MAAM,CAAC,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,WAAW,EACX,MAAM,EACN,eAAe,EACf,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,KAAK,EACf,SAAS,EACT,GAAG,KAAK,EAcT,EAAA;AACC,IAAA,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC;;;AAGtC,IAAA,MAAM,aAAa,GAAG,OAAO,IAAI,KAAK,UAAU,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,IAAkB,GAAG,SAAS;AAChJ,IAAA,MAAM,aAAa,GAAG,MAAM,IAAI,KAAK;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC;IAElD,QACEA,IAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACa,QAAQ,EACnB,SAAS,EAAE,EAAE,CACX,sDAAsD,EACpD;AACA,cAAE;cACA,+DAA+D,EACnE,MAAM,CAAC,SAAS,EAChB,SAAS,CACV,EAAA,GACG,KAAK,aAETA,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,iEAAiE,EACjE,OAAO,IAAI,+BAA+B,CAC3C,EAAA,QAAA,EAAA,CAEA,WAAW,KACVC,GAAA,CAAA,MAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,8DAA8D,EAC9D,OAAO,GAAG,QAAQ,GAAG,wBAAwB,EAC7C,MAAM,CAAC,IAAI,EACX,eAAe,CAChB,EAAA,QAAA,EAEA,aAAa;AACZ,6BAAC,aAAa,IACZA,GAAA,CAAC,aAAa,EAAA,EACZ,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAA,aAAA,EAC5B,MAAM,EAAA,CAClB,IACA,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,GAAI,IAAkB,CAAC,EAAA,CACnD,CACR,EACDD,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,gBAAgB,EAChB,WAAW,GAAG,aAAa,GAAG,8BAA8B,CAC7D,EAAA,QAAA,EAAA,CAEDC,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,OAAO,KAAK,QAAQ,GAAG,2BAA2B,GAAG,iBAAiB,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAK,EAC3H,WAAW,KACVA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,QAAQ,GAAG,2BAA2B,GAAG,uBAAuB,CAAC,EAAA,QAAA,EAAG,WAAW,EAAA,CAAO,CACjI,CAAA,EAAA,CACG,CAAA,EAAA,CACF,EACL,MAAM,KACLA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,0CAA0C,EAC1C,eAAe,CAChB,EAAA,QAAA,EAEA,MAAM,EAAA,CACH,CACP,CAAA,EAAA,CACG;AAEV;;;;"}
|
|
@@ -11,22 +11,22 @@ const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
|
11
11
|
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
12
12
|
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
13
13
|
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
14
|
-
const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (jsxs(ContextMenuPrimitive.SubTrigger, { ref: ref, className: cn("flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm px-
|
|
14
|
+
const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (jsxs(ContextMenuPrimitive.SubTrigger, { ref: ref, className: cn("flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground", inset && "pl-9", className), ...props, children: [children, jsx(ChevronRight, { className: "ml-auto h-4 w-4" })] })));
|
|
15
15
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
16
|
-
const ContextMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.SubContent, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-
|
|
16
|
+
const ContextMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.SubContent, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props })));
|
|
17
17
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
18
|
-
const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.Portal, { children: jsx(ContextMenuPrimitive.Content, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-
|
|
18
|
+
const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.Portal, { children: jsx(ContextMenuPrimitive.Content, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card animate-in motion-reduce:animate-none fade-in-80 data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props }) })));
|
|
19
19
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
20
|
-
const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(ContextMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm px-
|
|
20
|
+
const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(ContextMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-9", className), ...props })));
|
|
21
21
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
22
|
-
const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (jsxs(ContextMenuPrimitive.CheckboxItem, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm py-
|
|
22
|
+
const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (jsxs(ContextMenuPrimitive.CheckboxItem, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), checked: checked, ...props, children: [jsx("span", { className: "absolute left-option-x flex h-3.5 w-3.5 items-center justify-center", children: jsx(ContextMenuPrimitive.ItemIndicator, { children: jsx(Check, { className: "h-4 w-4" }) }) }), children] })));
|
|
23
23
|
ContextMenuCheckboxItem.displayName =
|
|
24
24
|
ContextMenuPrimitive.CheckboxItem.displayName;
|
|
25
|
-
const ContextMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(ContextMenuPrimitive.RadioItem, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm py-
|
|
25
|
+
const ContextMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(ContextMenuPrimitive.RadioItem, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [jsx("span", { className: "absolute left-option-x flex h-3.5 w-3.5 items-center justify-center", children: jsx(ContextMenuPrimitive.ItemIndicator, { children: jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
|
|
26
26
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
27
|
-
const ContextMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(ContextMenuPrimitive.Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold text-foreground", inset && "pl-
|
|
27
|
+
const ContextMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(ContextMenuPrimitive.Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold text-foreground", inset && "pl-9", className), ...props })));
|
|
28
28
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
29
|
-
const ContextMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.Separator, { ref: ref, className: cn("-mx-
|
|
29
|
+
const ContextMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.Separator, { ref: ref, className: cn("-mx-option-inset my-1 h-px bg-border", className), ...props })));
|
|
30
30
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
31
31
|
const ContextMenuShortcut = ({ className, ...props }) => {
|
|
32
32
|
return (jsx("span", { className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className), ...props }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","sources":["../../src/components/context-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm px-
|
|
1
|
+
{"version":3,"file":"context-menu.js","sources":["../../src/components/context-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground\",\n inset && \"pl-9\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-option-inset text-popover-foreground shadow-card animate-in motion-reduce:animate-none fade-in-80 data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n));\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm px-option-x py-2 text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-9\",\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-option-x flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName =\n ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center min-h-option-row pointer-coarse:min-h-11 rounded-control-sm py-2 pl-9 pr-option-x text-sm outline-none focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-option-x flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold text-foreground\",\n inset && \"pl-9\",\n className,\n )}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-option-inset my-1 h-px bg-border\", className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nContextMenuShortcut.displayName = \"ContextMenuShortcut\";\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"names":[],"mappings":";;;;;;;AAQA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAmBA;AAEA;AAaA;AAEA;AAeA;AAEA;AAgBA;AAEA;AAqBA;AACE;AAEF;AAoBA;AAEA;AAgBA;AAEA;AAUA;AAEA;AAIE;AASF;AACA;;"}
|
|
@@ -19,28 +19,28 @@ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
|
19
19
|
// this portals to document.body as a sibling of it, so it needs
|
|
20
20
|
// to clear that to render above a modal. Matches the same fix
|
|
21
21
|
// already applied to SelectContent (components/select.tsx).
|
|
22
|
-
'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[1100] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-control-lg border border-border shadow-card', className), ...props }) }));
|
|
22
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[1100] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-control-lg border border-border p-option-inset shadow-card', className), ...props }) }));
|
|
23
23
|
}
|
|
24
24
|
function DropdownMenuGroup({ ...props }) {
|
|
25
25
|
return (jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props }));
|
|
26
26
|
}
|
|
27
27
|
function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
|
|
28
|
-
return (jsx(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-muted focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-pointer select-none items-center gap-2 px-
|
|
28
|
+
return (jsx(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-muted focus:text-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex min-h-option-row w-full cursor-pointer select-none items-center gap-2 rounded-control-sm px-option-x py-2 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-9 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
29
29
|
}
|
|
30
30
|
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
31
|
-
return (jsxs(DropdownMenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", className: cn("focus:bg-muted focus:text-foreground relative flex w-full cursor-pointer items-center gap-2 py-2 pr-
|
|
31
|
+
return (jsxs(DropdownMenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", className: cn("focus:bg-muted focus:text-foreground relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm py-2 pr-option-x pl-9 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), checked: checked, ...props, children: [jsx("span", { className: "pointer-events-none absolute left-option-x flex size-4 items-center justify-center", children: jsx(DropdownMenuPrimitive.ItemIndicator, { children: jsx(CheckIcon, { className: "size-4" }) }) }), children] }));
|
|
32
32
|
}
|
|
33
33
|
function DropdownMenuRadioGroup({ ...props }) {
|
|
34
34
|
return (jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props }));
|
|
35
35
|
}
|
|
36
36
|
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
37
|
-
return (jsxs(DropdownMenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", className: cn("focus:bg-muted focus:text-foreground relative flex w-full cursor-pointer items-center gap-2 py-2 pr-
|
|
37
|
+
return (jsxs(DropdownMenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", className: cn("focus:bg-muted focus:text-foreground relative flex min-h-option-row w-full cursor-pointer items-center gap-2 rounded-control-sm py-2 pr-option-x pl-9 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [jsx("span", { className: "pointer-events-none absolute left-option-x flex size-4 items-center justify-center", children: jsx(DropdownMenuPrimitive.ItemIndicator, { children: jsx(CircleIcon, { className: "size-2 fill-current" }) }) }), children] }));
|
|
38
38
|
}
|
|
39
39
|
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
40
|
-
return (jsx(DropdownMenuPrimitive.Label, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn('px-
|
|
40
|
+
return (jsx(DropdownMenuPrimitive.Label, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn('px-option-x py-2 text-sm font-semibold text-foreground data-[inset]:pl-9', className), ...props }));
|
|
41
41
|
}
|
|
42
42
|
function DropdownMenuSeparator({ className, ...props }) {
|
|
43
|
-
return (jsx(DropdownMenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn('bg-border h-px', className), ...props }));
|
|
43
|
+
return (jsx(DropdownMenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn('bg-border -mx-option-inset my-1 h-px', className), ...props }));
|
|
44
44
|
}
|
|
45
45
|
function DropdownMenuShortcut({ className, ...props }) {
|
|
46
46
|
return (jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn('text-muted-foreground ml-auto text-xs tracking-widest', className), ...props }));
|
|
@@ -49,12 +49,12 @@ function DropdownMenuSub({ ...props }) {
|
|
|
49
49
|
return jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
50
50
|
}
|
|
51
51
|
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
52
|
-
return (jsxs(DropdownMenuPrimitive.SubTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn('focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground flex cursor-pointer items-center gap-2 px-
|
|
52
|
+
return (jsxs(DropdownMenuPrimitive.SubTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn('focus:bg-muted focus:text-foreground data-[state=open]:bg-muted data-[state=open]:text-foreground flex min-h-option-row cursor-pointer items-center gap-2 rounded-control-sm px-option-x py-2 pointer-coarse:min-h-11 text-sm text-muted-foreground transition-colors duration-state hover:bg-muted motion-reduce:transition-none outline-hidden select-none data-[inset]:pl-9', className), ...props, children: [children, jsx(ChevronRightIcon, { className: "ml-auto size-4 text-muted-foreground" })] }));
|
|
53
53
|
}
|
|
54
54
|
function DropdownMenuSubContent({ className, ...props }) {
|
|
55
55
|
return (jsx(DropdownMenuPrimitive.SubContent, { "data-slot": "dropdown-menu-sub-content", className: cn(
|
|
56
56
|
// z-[1100] — see the matching note on DropdownMenuContent above.
|
|
57
|
-
'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[1100] min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-control-lg border border-border shadow-card', className), ...props }));
|
|
57
|
+
'bg-popover text-popover-foreground data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[1100] min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-control-lg border border-border p-option-inset shadow-card', className), ...props }));
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|