import type { Color } from "@yaakapp-internal/plugins"; import type { IconProps } from "@yaakapp-internal/ui"; import { IconButton } from "@yaakapp-internal/ui"; import classNames from "classnames"; import type { ReactNode } from "react"; /** * A single control attached to a labelled separator, rendered between the label * and the rule. * * Declared rather than passed as a node so the separator keeps ownership of the * things that are easy to get wrong by hand: matching the label's colour, and * staying out of the rule's way when the label is long. */ export interface SeparatorAction { icon: IconProps["icon"]; /** Tooltip and accessible name. Required — the control is icon-only. */ title: string; onClick: () => void; } interface Props { orientation?: "horizontal" | "vertical"; dashed?: boolean; className?: string; children?: ReactNode; color?: Color; action?: SeparatorAction; } export function Separator({ color, className, dashed, orientation = "horizontal", children, action, }: Props) { return (
{children && (
{children}
)} {action && ( )}
); }