"use client"; import { useUiText } from "@suphark/ui/components/shared/ui-text"; import { cn } from "@suphark/ui/lib/utils"; import * as React from "react"; /** แก้มือ (0.95.0, A8): ตารางกว้างเกินกรอบ = กรอบเลื่อนเป็น tab stop + region มีชื่อ คีย์บอร์ดเลื่อนซ้าย–ขวาได้ * ตารางที่ไม่ล้นไม่เพิ่มจุด Tab */ function useHorizontalOverflow(ref: React.RefObject) { const [overflowing, setOverflowing] = React.useState(false); React.useEffect(() => { const el = ref.current; if (!el || typeof ResizeObserver === "undefined") return; const check = () => setOverflowing(el.scrollWidth > el.clientWidth + 1); check(); // เทสต์ของแอปมัก mock ResizeObserver ด้วย vi.fn(() => ({…})) ที่ new ไม่ได้ — ไม่ให้ตารางพังเพราะ mock let observer: ResizeObserver; try { observer = new ResizeObserver(check); } catch { return; } observer.observe(el); if (el.firstElementChild) observer.observe(el.firstElementChild); return () => observer.disconnect(); }, [ref]); return overflowing; } function Table({ className, containerClassName, ...props }: React.ComponentProps<"table"> & { containerClassName?: string }) { const containerRef = React.useRef(null); const overflowing = useHorizontalOverflow(containerRef); const text = useUiText(); return (
); } function TableHeader({ className, ...props }: React.ComponentProps<"thead">) { return ; } function TableBody({ className, ...props }: React.ComponentProps<"tbody">) { return ( ); } function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) { return ( tr]:last:border-b-0", className)} {...props} /> ); } function TableRow({ className, ...props }: React.ComponentProps<"tr">) { return ( ); } function TableHead({ className, ...props }: React.ComponentProps<"th">) { return (
); } function TableCell({ className, ...props }: React.ComponentProps<"td">) { return ( ); } function TableCaption({ className, ...props }: React.ComponentProps<"caption">) { return (
); } export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };