import "./region_state.css"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type IconName } from "./icon"; import { type StyleProps } from "./style_props"; interface RegionStateBase extends StyleProps { testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } interface LoadingRegion extends RegionStateBase { state: "loading"; } interface EmptyBase extends RegionStateBase { state: "empty"; /** What is empty, in plain language ("Không có nhân viên nào khớp"). */ message: string; /** What the reader can do about it ("Thử từ khóa khác"). */ detail?: string; /** Where what fills the region lives, when it lives SOMEWHERE ELSE. A PRESS, * not an `href` — an app runs in a frame sandboxed without `allow-popups`, * where a plain anchor navigates the app away. */ link?: { label: string; onPress: () => void; }; } interface EmptyRegion extends EmptyBase { compact?: false; icon?: IconName; /** * THE ONE ACT, and only on the region-wide form. A band's add rides its heading * row, which is why {@link EmptyBand} has no slot for one; a whole REGISTER * with nothing in it has no such row, so this state carries the screen's New. * Pass that act itself, never a second verb beside it. */ action?: React.ReactNode; } /** * ONE BAND of a record, rather than the whole region: its heading, the sections * below it and the add verb beside it already say the surface rendered, so the * only open question is what this band holds. * * IT TAKES NO GLYPH, and that is the icon set rather than a preference: lucide * fills 20/24 of its box at a fixed stroke, so beside `sm` text there is no size * that is both legible and aligned with an 11px cap height. */ interface EmptyBand extends EmptyBase { compact: true; icon?: never; action?: never; } interface ErrorRegion extends RegionStateBase { state: "error"; /** What failed, in plain language ("Couldn't load customers"). */ message: string; /** The cause when the system knows it — never a stack trace or a bare code. */ detail?: string; /** Re-run the read. Omitted for a failure nobody can retry (denied, not * found); the kit words the button from the locale pack. */ onRetry?: () => void; } interface DoneRegion extends RegionStateBase { state: "done"; /** The outcome ("Wave picked"). */ message: string; /** One line under it — the result summary. */ detail?: string; /** The result glyph. Defaults to a success check. */ icon?: IconName; /** The what-next actions — `Button`s, rendered centred below. */ children?: React.ReactNode; } export type RegionStateProps = LoadingRegion | EmptyRegion | EmptyBand | ErrorRegion | DoneRegion; /** * WHAT A REGION HAS INSTEAD OF ITS CONTENT, picked by what the region can * ASSERT: `loading` while the read is in flight, `error` when it failed, * `empty` when it succeeded and found nothing, `done` when the work is finished. * Empty and failed are different assertions, and a retry on a true empty returns * the same nothing. * * A BAND's empty carries no verb: a section's add rides its heading row. The * region-wide empty takes ONE (`action`), because the surface it fills has stood * its own toolbar down. * * Reach for `Skeleton` instead of `loading` wherever the shape of what is * arriving is known, and for `Callout tone="error"` where the failure is inside * a flow beside working content. */ export declare function RegionState(props: RegionStateProps): React.ReactElement>; export {};