UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 3 kB
{"version":3,"file":"TableRow.cjs","sources":["../../../src/components/Table/TableRow.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 { useTableContext } from \"./TableContext\";\nimport { tableTheme } from \"./theme\";\n\nexport interface TableRowTheme {\n base: string;\n hovered: string;\n striped: string;\n}\n\nexport interface TableRowProps extends ComponentPropsWithRef<\"tr\">, ThemingProps<TableRowTheme> {}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>((props, ref) => {\n const {\n theme: rootTheme,\n clearTheme: rootClearTheme,\n applyTheme: rootApplyTheme,\n hoverable,\n striped,\n } = useTableContext();\n\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [tableTheme.row, provider.theme?.table?.row, rootTheme?.row, props.theme],\n [get(provider.clearTheme, \"table.row\"), get(rootClearTheme, \"row\"), props.clearTheme],\n [get(provider.applyTheme, \"table.row\"), get(rootApplyTheme, \"row\"), props.applyTheme],\n );\n\n const { className, ...restProps } = resolveProps(props, provider.props?.tableRow);\n\n return (\n <tr\n ref={ref}\n data-testid=\"table-row-element\"\n className={twMerge(theme.base, striped && theme.striped, hoverable && theme.hovered, className)}\n {...restProps}\n />\n );\n});\n\nTableRow.displayName = \"TableRow\";\n"],"names":["forwardRef","useTableContext","provider","useThemeProvider","theme","useResolveTheme","tableTheme","get","resolveProps","jsx","twMerge"],"mappings":";;;;;;;;;;;;AAWY,MAAC,QAAQ,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACnD,EAAE,MAAM;AACR,IAAI,KAAK,EAAE,SAAS;AAC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