import { type ReactElement, type ReactNode } from "react"; import { type IUiListboxItem } from "../@ui/UiListbox/types.js"; import { type IDropdownButtonRenderProps } from "../Dropdown/Dropdown.js"; /** * Special item rendered above the divider in {@link TimezoneSelect}, ahead of the curated * timezone list. Callers use these for entries like "Default" or "Device time zone". * * @internal */ export interface ITimezoneSelectSpecialItem { /** * Value emitted by onChange when this item is selected. Undefined typically represents * "no explicit timezone" (e.g. inherit the workspace setting). */ id: string | undefined; /** * Display label of the item. */ label: string; /** * Tooltip of the item. Also read by screen readers. */ tooltip?: string; /** * Rich content rendered in the visual tooltip instead of `tooltip`, e.g. text with a link. */ tooltipContent?: ReactNode; } /** * Render props passed to a custom trigger renderer of {@link TimezoneSelect}. * * Extends the {@link IDropdownButtonRenderProps} contract of the underlying dropdown * (toggle/open/close callbacks, isOpen, buttonRef and accessibility props) with the * current selection so that custom triggers can display it. * * @internal */ export interface ITimezoneSelectButtonRenderProps extends IDropdownButtonRenderProps { /** * Human-readable label of the current selection: the matching special item label, * the friendly name of the selected timezone (e.g. "Prague"), * or the placeholder when nothing is selected. */ buttonLabel: string; /** * Currently selected timezone ID (IANA ID, a special item ID or undefined). */ value: string | undefined; /** * Whether the select is disabled. Custom triggers should reflect this state. */ isDisabled?: boolean; } /** * All label props are required so that callers pass localized strings — the component * has no built-in English defaults to leak into the UI. * * @internal */ export interface ITimezoneSelectProps { /** * Currently selected timezone ID (IANA ID, a special item ID or undefined). */ value?: string; /** * Called when the user selects a timezone. */ onChange: (id: string | undefined) => void; /** * Items rendered above the divider, ahead of the curated timezone list. */ specialItems?: ITimezoneSelectSpecialItem[]; /** * Label of the dropdown button when nothing is selected and no special item matches. */ placeholder?: string; /** * Placeholder of the search input. */ searchPlaceholder: string; /** * Accessibility label of the listbox. */ ariaLabel: string; /** * Id of the default dropdown trigger, so a visible `