UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 3.18 kB
{"version":3,"file":"TableBody.cjs","sources":["../../../src/components/Table/TableBody.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ComponentPropsWithRef } from \"react\";\nimport { get } from \"../../helpers/get\";\nimport { resolveProps } from \"../../helpers/resolve-props\";\nimport { useResolveTheme } from \"../../helpers/resolve-theme\";\nimport { twMerge } from \"../../helpers/tailwind-merge\";\nimport { useThemeProvider } from \"../../theme/provider\";\nimport type { ThemingProps } from \"../../types\";\nimport { TableBodyContext } from \"./TableBodyContext\";\nimport type { TableCellTheme } from \"./TableCell\";\nimport { useTableContext } from \"./TableContext\";\nimport { tableTheme } from \"./theme\";\n\nexport interface TableBodyTheme {\n base: string;\n cell: TableCellTheme;\n}\n\nexport interface TableBodyProps extends ComponentPropsWithRef<\"tbody\">, ThemingProps<TableBodyTheme> {}\n\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>((props, ref) => {\n const { theme: rootTheme, clearTheme: rootClearTheme, applyTheme: rootApplyTheme } = useTableContext();\n\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [tableTheme.body, provider.theme?.table?.body, rootTheme?.body, props.theme],\n [get(provider.clearTheme, \"table.body\"), get(rootClearTheme, \"body\"), props.clearTheme],\n [get(provider.applyTheme, \"table.body\"), get(rootApplyTheme, \"body\"), props.applyTheme],\n );\n\n const { className, ...restProps } = resolveProps(props, provider.props?.tableBody);\n\n return (\n <TableBodyContext.Provider\n value={{ theme: props.theme, clearTheme: props.clearTheme, applyTheme: props.applyTheme }}\n >\n <tbody ref={ref} className={twMerge(theme.base, className)} {...restProps} />\n </TableBodyContext.Provider>\n );\n});\n\nTableBody.displayName = \"TableBody\";\n"],"names":["forwardRef","useTableContext","provider","useThemeProvider","theme","useResolveTheme","tableTheme","get","resolveProps","jsx","TableBodyContext","twMerge"],"mappings":";;;;;;;;;;;;;AAYY,MAAC,SAAS,GAAGA,gBA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