/* eslint-disable react/refs -- The React Compiler rule misidentifies ordinary component props as ref reads in this controlled input. */
import { assertEmpty, mergeCSSClasses } from "@blocknote/core";
import { type ComponentProps } from "@blocknote/react";
import { Box, Card, Group, Input, Stack, Text, Title } from "@mantine/core";
import { forwardRef } from "react";
export const Sidebar = forwardRef<
HTMLDivElement,
ComponentProps["Versioning"]["Sidebar"]
>((props, ref) => {
const { className, children, "aria-label": ariaLabel, ...rest } = props;
assertEmpty(rest, false);
return (
{children}
);
});
export function Header(props: ComponentProps["Versioning"]["Header"]) {
const { className, title, actions, closeAction, ...rest } = props;
assertEmpty(rest, false);
return (
{title}
{actions}
{closeAction}
);
}
export function Name(props: ComponentProps["Versioning"]["Name"]) {
if (props.mode === "display") {
return (
{props.value}
);
}
return (
);
}
export const Snapshot = forwardRef<
HTMLDivElement,
ComponentProps["Versioning"]["Snapshot"]
>((props, ref) => {
const {
className,
id,
"aria-label": ariaLabel,
state,
tabIndex,
"aria-busy": ariaBusy,
onClick,
onKeyDown,
onFocus,
actions,
name,
date,
restoredFrom,
secondaryLabel,
comparingLabel,
comparingIcon,
...rest
} = props;
assertEmpty(rest, false);
const snapshotStateClass = (
{
default: "",
selected: "selected",
"comparison-source": "selected bn-snapshot-comparison-source",
"comparison-baseline": "comparing",
} satisfies Record
)[state];
return (
{comparingLabel && (
{comparingIcon}
{comparingLabel}
)}
{name}
{date && {date}}
{restoredFrom && (
{restoredFrom}
)}
{secondaryLabel && (
{secondaryLabel}
)}
{actions && (
event.stopPropagation()}
onKeyDown={(event) => event.stopPropagation()}
>
{actions}
)}
);
});