Select value/option restricted to string (MUI sets the literal child value; string|number + onChange:string was a type lie). DataTable sortDirection uses ?? 'asc' so aria-sort is never undefined on the active column. StatusChip sx-merge drops undefined; Pagination clamps page into range; DataTable dev-warns on sortKey without onSort; Alert onClose JSDoc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
640 B
TypeScript
28 lines
640 B
TypeScript
import Chip, { type ChipProps } from "@mui/material/Chip";
|
|
|
|
type StatusChipProps = Omit<ChipProps, "color"> & {
|
|
color?: "default" | "success" | "error" | "warning" | "info";
|
|
};
|
|
|
|
/** Semantic status chip. Pass onClick to make it a clickable toggle. */
|
|
export default function StatusChip({
|
|
color = "default",
|
|
size = "small",
|
|
onClick,
|
|
sx,
|
|
...props
|
|
}: StatusChipProps) {
|
|
return (
|
|
<Chip
|
|
color={color}
|
|
size={size}
|
|
onClick={onClick}
|
|
sx={[
|
|
{ fontWeight: 600, ...(onClick ? { cursor: "pointer" } : {}) },
|
|
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
]}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|