diff --git a/package.json b/package.json index 1479ab1..9e1a842 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@near-pagoda/ui", - "version": "2.1.1", + "version": "2.1.2", "description": "A React component library that implements the official NEAR design system.", "license": "MIT", "repository": { diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index 24d3fff..27e1a58 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -26,7 +26,7 @@ type RootProps = { const TableContext = createContext(undefined); -export const Root = forwardRef((props, ref) => { +export const Root = forwardRef(({ className = '', ...props }, ref) => { const rootRef = useRef(null); useEffect(() => { @@ -91,7 +91,7 @@ export const Root = forwardRef((props, ref) => { return ( -
+
{props.children}
@@ -105,19 +105,21 @@ type HeadProps = ComponentPropsWithRef<'thead'> & { sticky?: boolean; }; -export const Head = forwardRef(({ children, sticky = true, ...props }, ref) => { - return ( - - {children} - - ); -}); +export const Head = forwardRef( + ({ className = '', children, sticky = true, ...props }, ref) => { + return ( + + {children} + + ); + }, +); Head.displayName = 'Head'; type BodyProps = ComponentPropsWithRef<'tbody'>; -export const Body = forwardRef((props, ref) => { - return ; +export const Body = forwardRef(({ className = '', ...props }, ref) => { + return ; }); Body.displayName = 'Body'; @@ -125,14 +127,16 @@ type FootProps = ComponentPropsWithRef<'tfoot'> & { sticky?: boolean; }; -export const Foot = forwardRef(({ sticky = true, ...props }, ref) => { - return ; -}); +export const Foot = forwardRef( + ({ sticky = true, className = '', ...props }, ref) => { + return ; + }, +); Foot.displayName = 'Foot'; type RowProps = ComponentPropsWithRef<'tr'>; -export const Row = forwardRef((props, ref) => { +export const Row = forwardRef(({ className = '', ...props }, ref) => { const clickable = !!props.onClick; const role = clickable ? 'button' : undefined; const tabIndex = clickable ? 0 : undefined; @@ -148,7 +152,7 @@ export const Row = forwardRef((props, ref) => { return ( & ); export const HeadCell = forwardRef( - ({ children, column, sortable, ...props }, ref) => { + ({ children, column, sortable, className = '', ...props }, ref) => { const { sort, setSort } = useContext(TableContext)!; const clickable = !!props.onClick || !!sortable; const role = clickable ? 'button' : undefined; @@ -217,7 +221,7 @@ export const HeadCell = forwardRef( return ( & { }; export const Cell = forwardRef( - ({ children, disabled, href, spanAllColumns, target, ...props }, ref) => { + ({ children, disabled, href, spanAllColumns, target, className = '', ...props }, ref) => { const clickable = !!props.onClick || !!href; const isButton = !!props.onClick && !href; const role = isButton ? 'button' : undefined; @@ -274,7 +278,7 @@ export const Cell = forwardRef( return (