ToolJet/frontend/src/components/ui/blocks/TableSkeleton/TableSkeleton.jsx

38 lines
1.1 KiB
React
Raw Normal View History

feat(rocket): add AlertDialog, Collapsible, Sheet, Sonner + Dialog overflow border (#15854) * feat(rocket/alert-dialog): implement AlertDialog component with variants and documentation * feat(rocket/collapsible): add Rocket Collapsible component Bordered and ghost variants with animated expand/collapse via CSS grid-rows. Includes styled trigger with auto-rotating chevron, variant context, and Storybook stories. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore(storybook): fix quote style and centered layout sizing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(rocket/toaster): implement Sonner toast notification system with documentation and stories * feat(rocket/sheet): add Rocket Sheet component Right-side slide-in panel for multi-step forms (e.g. add datasource). Three sizes (small/default/large), header/body/footer structure mirroring Dialog, conditional footer overflow border via ResizeObserver context, preventClose support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(rocket/table): add Rocket Table primitive Low-level table primitive with 8 sub-components (Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption). Density variants (default 52px / compact 36px) via TableDensityContext. Borderless rows with rounded pill hover/selected highlights via first/last cell rounded corners. Header bottom border on cells (border-separate mode). All ToolJet tokens. Brought forward from PR #14498 with improved organization and Figma-aligned defaults from the apps list design. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(rocket): add Skeleton primitive + DataTable block - Skeleton: Rocket primitive with pulsing bg-interactive-hover token - TableSkeleton: TanStack-agnostic skeleton rows for use inside <Table> - DataTable: TanStack-driven table block (header, body, loading, empty states) brought from PR #14498 with ToolJet token cleanup and proper file structure Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(rocket): add Checkbox and RadioGroup components with specifications and stories * chore: update dependencies and remove unused packages - Removed @base-ui/react and cmdk from dependencies. - Updated various @radix-ui packages to lower versions for compatibility. - Adjusted versions for @floating-ui packages. - Cleaned up package-lock.json by removing unnecessary entries. * feat(rocket): add Spinner and Textarea components with stories and update AlertDialog and Combobox for new props --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 11:13:49 +00:00
import * as React from 'react';
import PropTypes from 'prop-types';
import { TableBody, TableCell, TableRow } from '@/components/ui/Rocket/Table/Table';
import { Skeleton } from '@/components/ui/Rocket/Skeleton/Skeleton';
/**
* Generic table skeleton renders pulsing placeholder rows.
* Designed to be used inside a `<Table>` while data is loading,
* replacing the real `<TableBody>`.
*/
function TableSkeleton({ rowCount = 5, columnCount = 4 }) {
const rows = React.useMemo(
() => Array.from({ length: rowCount }, (_, i) => ({ id: `table-skeleton-${i}` })),
[rowCount]
);
return (
<TableBody>
{rows.map((row) => (
<TableRow key={row.id}>
{Array.from({ length: columnCount }, (_, colIndex) => (
<TableCell key={colIndex}>
<Skeleton className="tw-h-4 tw-w-full" />
</TableCell>
))}
</TableRow>
))}
</TableBody>
);
}
TableSkeleton.displayName = 'TableSkeleton';
TableSkeleton.propTypes = {
rowCount: PropTypes.number,
columnCount: PropTypes.number,
};
export { TableSkeleton };