import type * as React from 'react';
import type { MaterialVariant, Thickness } from './material.js';
export type Intent = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
export type Size = 'sm' | 'md' | 'lg';
export interface MaterialBearingProps {
/** Material variant. */
variant?: MaterialVariant;
/** Material thickness (blur and opacity step). */
thickness?: Thickness;
/** Prominent (filled, higher-emphasis) appearance. */
prominent?: boolean;
/** Opt-in refraction on refraction-eligible materials; ignored where unsupported. */
refraction?: boolean;
}
export interface IntentProps {
intent?: I;
}
export interface SizeProps {
size?: S;
}
export interface ChangeDetails {
event: Event | undefined;
reason: string;
}
export type RenderProp
, S = Record> = React.ReactElement | ((props: P, state: S) => React.ReactElement);
export interface RenderProps, S = Record> {
/** Replaces the rendered element; the component props and state are merged onto it. */
render?: RenderProp;
}
export interface ValueProps {
value?: T;
defaultValue?: T;
onValueChange?: (value: T, details: ChangeDetails) => void;
}
export interface CheckedProps {
checked?: boolean;
defaultChecked?: boolean;
onCheckedChange?: (checked: boolean, details: ChangeDetails) => void;
}
export interface OpenProps {
open?: boolean;
defaultOpen?: boolean;
onOpenChange?: (open: boolean, details: ChangeDetails) => void;
}
/** Banned prop names on every 5.0 component (type test + lint auraglass/prop-grammar): */
export declare const BANNED_PROPS: readonly ["material", "elevation", "as", "tone", "asChild", "onChange"];
/** Non-material visual choice uses `appearance` (emitted as data-ag-appearance), never `variant`. */
export type PartProps = Omit, 'onChange'> & RenderProps & {
/** Ref to the rendered root element. */
ref?: React.Ref;
};
export declare const BUTTON_VARIANT_MAP: {
readonly primary: {
readonly prominent: true;
};
readonly secondary: {
readonly variant: "regular";
};
readonly ghost: {
readonly variant: "identity";
};
readonly danger: {
readonly intent: "danger";
};
};
export type AgPart = string & {
readonly __kebab?: never;
};
export declare const PART_NAME_RE: RegExp;
export declare const COMMON_PARTS: readonly ["root", "trigger", "content", "popup", "positioner", "backdrop", "item", "item-indicator", "indicator", "thumb", "track", "range", "label", "description", "error", "icon", "close", "title", "header", "footer", "body", "list", "group", "group-label", "separator", "viewport", "arrow", "value", "input", "clear", "hit-area"];
/** Compound naming: Name.Root, Name.Trigger, Name.Content, Name.Item ...; flat export for single-part components. */
export interface MigrationRow {
from: string;
props?: Record;
} | null>;
selectors?: Record;
automation: 'full' | 'mostly' | 'partial' | 'manual' | 'none';
compat: boolean;
}
export interface ComponentMeta {
name: string;
owner: 'CMP' | 'SURF' | 'MAT';
entry: string;
tier: 'T0' | 'T1' | 'T2' | 'preview';
flagship?: number;
rsc: 'server' | 'client' | 'mixed';
parts: readonly AgPart[];
states: readonly string[];
variants: Readonly>;
material?: {
layer: 'chrome' | 'overlay' | 'transient' | 'content';
refractionEligible?: boolean;
};
apg?: string;
budgetKb?: number;
migration: readonly MigrationRow[];
}
export type DefineMeta = (meta: M) => M;
export type ToChangeDetails = (eventDetails: unknown) => ChangeDetails;
export type RenderElement = (render: RenderProp
| undefined, fallback: React.ReactElement, props: P, state?: object) => React.ReactElement;
export type ButtonContract = React.FC, 'color'> & {
pressed?: boolean;
defaultPressed?: boolean;
onPressedChange?: (p: boolean, d: ChangeDetails) => void;
loading?: boolean;
ref?: React.Ref;
}>;
export type IconButtonContract = React.FC & {
label: string;
icon: React.ReactNode;
}>;
export type CompoundContract = {
[P in Parts]: React.FC<(P extends 'Root' ? RootProps : unknown) & PartProps & {
children?: React.ReactNode;
}>;
};
export declare const COMPOUND_PARTS: {
readonly Dialog: readonly ["Root", "Trigger", "Content", "Title", "Description", "Close", "Header", "Body", "Footer"];
readonly AlertDialog: readonly ["Root", "Trigger", "Content", "Title", "Description", "Cancel", "Action", "Header", "Body", "Footer"];
readonly Sheet: readonly ["Root", "Trigger", "Content", "Title", "Description", "Close", "Handle", "Header", "Body", "Footer"];
readonly Popover: readonly ["Root", "Trigger", "Content", "Title", "Description", "Close", "Arrow"];
readonly Tooltip: readonly ["Root", "Trigger", "Content", "Arrow", "Provider"];
readonly Menu: readonly ["Root", "Trigger", "Content", "Item", "CheckboxItem", "RadioGroup", "RadioItem", "Group", "GroupLabel", "Separator", "Submenu", "SubmenuTrigger"];
readonly ContextMenu: readonly ["Root", "Trigger", "Content", "Item", "Group", "GroupLabel", "Separator"];
readonly ColorPicker: readonly ["Root", "Trigger", "Content", "Area", "Hue", "Channel", "Alpha", "Input"];
readonly Toast: readonly ["Provider", "Viewport", "Root", "Title", "Description", "Action", "Close", "Progress"];
readonly Select: readonly ["Root", "Trigger", "Value", "Content", "Item", "ItemIndicator", "Group", "GroupLabel", "Separator"];
readonly Combobox: readonly ["Root", "Input", "Trigger", "Content", "Item", "Empty", "Chips", "Chip", "ChipRemove", "Clear", "Group", "GroupLabel"];
readonly Toolbar: readonly ["Root", "Button", "Group", "Separator", "Link"];
readonly ToggleGroup: readonly ["Root", "Item"];
readonly SegmentedControl: readonly ["Root", "Item", "Indicator"];
readonly Slider: readonly ["Root", "Value", "Track", "Range", "Thumb"];
readonly RadioGroup: readonly ["Root", "Item"];
readonly Field: readonly ["Root", "Label", "Control", "Description", "Error"];
readonly Collapsible: readonly ["Root", "Trigger", "Content"];
readonly Accordion: readonly ["Root", "Item", "Header", "Trigger", "Content"];
readonly ScrollArea: readonly ["Root", "Viewport", "Scrollbar", "Thumb"];
readonly Avatar: readonly ["Root", "Image", "Fallback"];
readonly Card: readonly ["Root", "Header", "Title", "Description", "Body", "Footer"];
readonly Tour: readonly ["Root", "Step"];
readonly Menubar: readonly ["Root", "Menu"];
};
/** C-3b (v1.2): parts the contract requires (REQ-CMP-06, -105, -110) that are not implemented on next yet. Each moves into
COMPOUND_PARTS (Menubar from FLAT_CMP_COMPONENTS) in the contract commit that follows its CMP implementation, so the
conformance suite never asserts a part that does not exist. Consumers must not rely on them before that.
REQ-CMP-06 promoted SegmentedControl.Indicator, Slider.Track/Range/Thumb and Menubar {Root, Menu}. */
export declare const COMPOUND_PARTS_PENDING: {
readonly Toast: readonly ["History", "HistoryItem"];
};
export interface CmpRootProps {
Dialog: OpenProps & {
modal?: boolean;
} & MaterialBearingProps;
AlertDialog: OpenProps;
Sheet: OpenProps & {
side?: 'start' | 'end' | 'top' | 'bottom';
detents?: number[];
modal?: boolean;
};
Popover: OpenProps & {
openOnHover?: boolean;
delay?: number;
} & MaterialBearingProps;
Tooltip: OpenProps & {
delay?: number;
};
Menu: OpenProps;
ContextMenu: OpenProps;
Menubar: {
orientation?: 'horizontal' | 'vertical';
};
Toast: {
limit?: number;
};
Select: ValueProps & OpenProps & SizeProps;
Combobox: ValueProps & OpenProps & {
multiple?: boolean;
};
Toolbar: {
orientation?: 'horizontal' | 'vertical';
} & MaterialBearingProps;
ToggleGroup: ValueProps & {
multiple?: boolean;
};
SegmentedControl: ValueProps & SizeProps;
Slider: ValueProps & {
min?: number;
max?: number;
step?: number;
};
RadioGroup: ValueProps;
Field: {
invalid?: boolean;
disabled?: boolean;
name?: string;
};
Collapsible: OpenProps;
Accordion: ValueProps & {
multiple?: boolean;
};
ScrollArea: Record;
Avatar: SizeProps;
Card: MaterialBearingProps & {
interactive?: boolean;
};
Tour: OpenProps & {
step?: number;
};
ColorPicker: OpenProps;
}
/** Flat CMP components other streams compose (props = PartProps of the root element + the grammar types they list in meta): */
export declare const FLAT_CMP_COMPONENTS: readonly ["Button", "IconButton", "ButtonGroup", "Switch", "Checkbox", "CheckboxGroup", "TextField", "SearchField", "NumberField", "Fieldset", "Form", "Badge", "AvatarGroup", "Alert", "Progress", "Meter", "Skeleton", "Separator", "Kbd", "Link", "Rating", "InlineEdit", "FileUpload", "DescriptionList", "ImageList", "EmptyState", "ErrorState", "LoadingState", "Text", "Heading", "Stack", "Grid", "Container", "Icon"];
/** Typed compound contracts, one per COMPOUND_PARTS key (what seeds, doubles and real components all satisfy). */
export type CmpCompounds = {
[K in keyof typeof COMPOUND_PARTS]: CompoundContract<(typeof COMPOUND_PARTS)[K][number], CmpRootProps[K]>;
};
export type CmpExportName = keyof typeof COMPOUND_PARTS | (typeof FLAT_CMP_COMPONENTS)[number] | 'useToast';
/** The one module path that exports each name (consumers import `src/components//index.ts`; never a deeper file). */
export declare const CMP_MODULES: Record;
export interface ToastOptions {
title: React.ReactNode;
description?: React.ReactNode;
intent?: Intent;
action?: {
label: string;
onClick: () => void;
};
duration?: number;
priority?: 'low' | 'high';
}
export interface ToastHistoryItem {
id: string;
title: React.ReactNode;
description?: React.ReactNode;
intent?: Intent;
createdAt: number;
read: boolean;
}
export type UseToast = () => {
toast(options: ToastOptions): string;
update(id: string, options: Partial): void;
dismiss(id?: string): void;
promise(p: Promise, o: {
loading: ToastOptions;
success: ToastOptions | ((v: T) => ToastOptions);
error: ToastOptions | ((e: unknown) => ToastOptions);
}): Promise;
toasts: readonly ({
id: string;
} & ToastOptions)[];
history: {
items: readonly ToastHistoryItem[];
unread: number;
markRead(id: string): void;
markAllRead(): void;
clear(): void;
} | null;
};
//# sourceMappingURL=components.d.ts.map