import { Element, type ElementStyle, type UIElementBase } from "./UINode"

export type UISpacerStyle = ElementStyle

/** A flexible gap — `flexGrow: 1` by default, pushes its siblings apart. */
export interface UISpacer extends UIElementBase<UISpacerStyle> {
  readonly type: "spacer",
}
/** Create a flexible gap (`flexGrow: 1`) — e.g. between a header's title and its actions. */
export function UISpacer(): UISpacer
export function UISpacer(style: UISpacerStyle): UISpacer
export function UISpacer(style?: UISpacerStyle): UISpacer {
  return new Element("spacer", { flexGrow: 1, ...style })
}