/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The popover a screen names something new in — a page in Studio's page * library and a template in its builder (#997), a query in the query builder * (#936). It asks for a name its host does not hold, takes any further fields * its host puts under it, and hands the name to its host's write: it closes * once the write is made, and says what refused it otherwise, so a name * another write took first is never lost silently. * * It is the design system's edit popover (`SliceEditPopover`), in the grammar * of its Save as cohort: the name field with its hint — help while the name * is missing, the field's error while its host holds it — and Cancel and * the named commit in the foot, both Default, the commit disabled while a * hint shows and loading while the write runs. ⏎ in the name commits — the * form's own submission, through its commit — and a field its host adds * commits by submitting the form (`requestSubmit`); Esc, ×, a click outside * and Cancel close it. It is never a modal: the design system's one modal is * a confirmation step, not a form. * * It says no words of its own: its host passes each one, from its own message * table. Its layout is the `sliceEdit` recipe's `form` and `field` slots, and * its field the `input` recipe's. * * It hangs from its trigger — the one button that opens it — or, opened from * a toolbar chip's menu (#1229), from that chip, as its anchor. * * @packageDocumentation */ import { type ReactNode } from "react"; import { type SliceEditPopoverAnchor } from "@elaraai/east-ui-components"; /** Props of {@link NamePopover}: the button it hangs from (`trigger`) or its `anchor`, and the rest. */ export type NamePopoverProps = SliceEditPopoverAnchor & { /** Whether it is open. */ open: boolean; /** Opens or closes it — its trigger, ×, Esc, a click outside, Cancel, or a write that was made. */ onOpenChange: (open: boolean) => void; /** Its head — what it makes, and where. */ label: ReactNode; /** The name field's placeholder, and its accessible name. */ placeholder: string; /** The name it offers when it opens. */ initial: string; /** The names its host holds — the new one must be none of them. */ taken: ReadonlySet; /** The hint while the name is empty. */ missing: string; /** The field's error while its host holds the name — given the name, as typed and trimmed. */ nameTaken: (name: string) => string; /** Its commit verb — the commit button's words. */ confirm: string; /** The cancel button's words. */ cancel: string; /** Further fields, under the name. */ children?: ReactNode; /** The name field's label, above it: a phone's view. */ nameLabel?: string | undefined; /** The name field's help under it, while no hint shows. */ nameHelp?: string | undefined; /** The commit as the Primary: a phone's view. */ primary?: boolean | undefined; /** Makes the thing under the name — resolves to what refused it, or `undefined` once it is made. */ onConfirm: (name: string) => Promise; }; /** * Renders the popover — see the module docs. * * @param props - What it names, in its host's words, and what it does with the name * @returns The trigger or the anchor, and the popover while open */ export declare function NamePopover(props: NamePopoverProps): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=name-popover.d.ts.map