/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * A Chooser of the paged resource kind's resources (#1424): the shared key * search over the kind's own resources, in their key order, through its own * paged read — its key search places a typed key, and its windows label the * matches the box lists — never every resource listed. The box names the * resource chosen; a pick sets it. Every resource Chooser of the Calendar's * that offers the paged kind draws it in a field's place (`FieldForm`'s * `renderControl`): the placement's resource, an event's reference field to * the kind, and the bulk edit's resource. The frame gives it the paged kind * through {@link CalendarChooserContext}, with the name of a resource a window * the frame holds has. The box names the resource the field holds by it, else * by the resource's own row, read by its key through the kind's own read * (`byKey`) — a narrowing of the kind's windows, which leaves out the * resources its choices hide, an event's own among them, never turns its name * into its key (retest C6) — and by its key only while that read is in flight. * * It leaves out what the kind's source of the slice hides, as the Calendar's * other Choosers leave out what the rail hides (ruled 27 Oct 2026): which of * each page it lists the source's choices hold is asked of e3 — one request a * page, the membership read the hidden pick reads (`recordSliceWithinAt`) — * and the rest are dropped, but the resource the field holds, an event's own, * which stays offered whatever the choices hide. A step onto a resource they * hide picks nothing. It searches the kind whole by key, as it always has, so * its count is the kind's. * * @packageDocumentation */ import { type ReactNode } from "react"; import { type ValueTypeOf } from "@elaraai/east"; import type { FieldSpecValue } from "@elaraai/east-ui"; import type { RecordSliceBindType } from "@elaraai/east-ui/internal"; import type { CalendarPagedValue } from "./pages.js"; /** The paged resource kind, as the Calendar's Choosers search it. */ export interface CalendarChooser { /** The paged kind, as the payload carries it: its own key search and windows. */ readonly paged: CalendarPagedValue; /** What the Calendar calls no resource (#1516). */ readonly unassigned: string; /** Its name, as running text writes it: `presses`. */ readonly noun: string; /** A resource's name by its key: its row's label once a window the frame holds has it; `undefined` while none does. */ readonly nameOf: (key: string) => string | undefined; /** * The kind's source of the slice, named after its slot: its Choosers leave out what its choices hide; `undefined` * with none, every resource offered. */ readonly part?: ValueTypeOf | undefined; } /** The paged kind the Calendar's Choosers search; `undefined` with none paged. */ export declare const CalendarChooserContext: import("react").Context; /** * The Chooser of the paged kind's resources (see the module docs). * * @param props - The paged kind; the resource chosen, by its key — `undefined` for none; what a pick sets; and whether it takes none * @returns The key search, or the chosen resource's name, read only */ export declare function PagedChooser({ chooser, chosen, onPick, readOnly }: { chooser: CalendarChooser; chosen: string | undefined; onPick: (key: string) => void; readOnly?: boolean; }): ReactNode; /** * The control a Calendar form draws for a field that chooses one of the paged * kind's resources: the Chooser over the kind's own resources. * * @param chooser - The paged kind, when one pages * @param spec - The field * @param chooses - Whether the field chooses one of the paged kind's resources * @param chosen - The resource it holds, by its key; `undefined` for none * @param onPick - What a pick sets, by the resource's key * @param readOnly - Whether the form takes no edit * @returns The Chooser; `undefined` for a field the form draws itself */ export declare function pagedControl(chooser: CalendarChooser | undefined, spec: FieldSpecValue, chooses: (spec: FieldSpecValue) => boolean, chosen: string | undefined, onPick: (key: string) => void, readOnly: boolean): ReactNode | undefined; /** * The Calendar's paged kind, for its Choosers. * * @returns The paged kind, when one pages */ export declare function useCalendarChooser(): CalendarChooser | undefined; //# sourceMappingURL=chooser.d.ts.map