flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 3.1 kB
Source Map (JSON)
{"version":3,"file":"Table.mjs","sources":["../../../../src/components/Table/Table.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ComponentPropsWithRef } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { mergeDeep } from \"../../helpers/merge-deep\";\nimport { getTheme } from \"../../theme-store\";\nimport type { DeepPartial } from \"../../types\";\nimport { TableBody, type FlowbiteTableBodyTheme } from \"./TableBody\";\nimport { TableCell } from \"./TableCell\";\nimport { TableContext } from \"./TableContext\";\nimport { TableHead, type FlowbiteTableHeadTheme } from \"./TableHead\";\nimport { TableHeadCell } from \"./TableHeadCell\";\nimport { TableRow, type FlowbiteTableRowTheme } from \"./TableRow\";\n\nexport interface FlowbiteTableTheme {\n root: FlowbiteTableRootTheme;\n head: FlowbiteTableHeadTheme;\n row: FlowbiteTableRowTheme;\n body: FlowbiteTableBodyTheme;\n}\n\nexport interface FlowbiteTableRootTheme {\n base: string;\n shadow: string;\n wrapper: string;\n}\n\nexport interface TableProps extends ComponentPropsWithRef<\"table\"> {\n striped?: boolean;\n hoverable?: boolean;\n theme?: DeepPartial<FlowbiteTableTheme>;\n}\n\nconst TableComponent = forwardRef<HTMLTableElement, TableProps>(\n ({ children, className, striped, hoverable, theme: customTheme = {}, ...props }, ref) => {\n const theme = mergeDeep(getTheme().table, customTheme);\n\n return (\n <div data-testid=\"table-element\" className={twMerge(theme.root.wrapper)}>\n <TableContext.Provider value={{ theme, striped, hoverable }}>\n <div className={twMerge(theme.root.shadow, className)}></div>\n <table className={twMerge(theme.root.base, className)} {...props} ref={ref}>\n {children}\n </table>\n </TableContext.Provider>\n </div>\n );\n },\n);\n\nTableComponent.displayName = \"Table\";\n\nexport const Table = Object.assign(TableComponent, {\n Head: TableHead,\n Body: TableBody,\n Row: TableRow,\n Cell: TableCell,\n HeadCell: TableHeadCell,\n});\n"],"names":[],"mappings":";;;;;;;;;;;;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