Files
co-lite/solvway-admin-portal/app/components/ui/sheet.tsx
T
ngqileandClaude Opus 5.5 5ee51d1913 chore: copy kept Tastefully modules and portals into Co-Lite
Backend modules from tastefully 8bd93d15: core-libs, core-session,
api-gateway, mobile-api, services-auth, services-system,
services-counter, services-member, services-log, services-email.
solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal
from tastefully 8bd93d15. Copied as tracked files only.

Literal secrets replaced with environment placeholders:
- services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY,
  MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default)
- services-system: JUMIO_TOKEN, JUMIO_SECRET (optional)
- services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed
- core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default
  removed, ipgeolocation key read from IPGEOLOCATION_API_KEY
- services-system EkycAppConfig: commented Jumio credentials removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2026-11-26 15:55:45 +08:00

78 lines
2.8 KiB
TypeScript

"use client"
import * as React from "react"
import { XIcon } from "lucide-react"
import { Dialog as SheetPrimitive } from "radix-ui"
import { cn } from "@/app/lib/utils"
import { PopoverContainerContext } from "@/app/components/ui/popover"
import { useT } from "@/app/lib/i18n/MessagesProvider"
// Right-side slide-over panel (add-refund-requests). Same radix Dialog primitive as dialog.tsx —
// focus trap, Escape, and scroll lock come from radix — laid out as a full-height drawer so a
// list page can inspect one row without leaving the page.
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
return <SheetPrimitive.Root data-slot="sheet" {...props} />
}
function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
}
function SheetContent({
className,
children,
side = "right",
ref,
...props
}: React.ComponentProps<typeof SheetPrimitive.Content> & { side?: "left" | "right" }) {
const t = useT()
const [container, setContainer] = React.useState<HTMLElement | null>(null)
const setRefs = React.useCallback(
(node: HTMLDivElement | null) => {
setContainer(node)
if (typeof ref === "function") ref(node)
else if (ref) ref.current = node
},
[ref]
)
return (
<SheetPrimitive.Portal>
<SheetPrimitive.Overlay
data-slot="sheet-overlay"
className="fixed inset-0 z-50 bg-black/40"
/>
<SheetPrimitive.Content
ref={setRefs}
data-slot="sheet-content"
aria-describedby={undefined}
className={cn(
"fixed inset-y-0 z-50 flex h-full w-full flex-col gap-4 overflow-y-auto bg-background p-6 shadow-lg sm:max-w-xl",
side === "left" ? "left-0 border-r" : "right-0 border-l",
className
)}
{...props}
>
<PopoverContainerContext.Provider value={container}>{children}</PopoverContainerContext.Provider>
<SheetPrimitive.Close className="absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:outline-none">
<XIcon className="size-4" aria-hidden="true" />
<span className="sr-only">{t("Close")}</span>
</SheetPrimitive.Close>
</SheetPrimitive.Content>
</SheetPrimitive.Portal>
)
}
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
return <div data-slot="sheet-header" className={cn("flex flex-col gap-1 pr-8", className)} {...props} />
}
function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
return (
<SheetPrimitive.Title data-slot="sheet-title" className={cn("text-lg font-semibold", className)} {...props} />
)
}
export { Sheet, SheetClose, SheetContent, SheetHeader, SheetTitle }