@mond-design-system/react 4.12.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, KeyboardEvent } from 'react';
2
+ import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, HTMLInputTypeAttribute, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, MouseEvent, KeyboardEvent, PointerEvent, FocusEvent } from 'react';
3
+ import { Placement } from '@floating-ui/dom';
3
4
 
4
5
  /**
5
6
  * Join class names, dropping anything falsy.
@@ -612,7 +613,18 @@ interface FieldProps {
612
613
  declare function Field({ label, children, hint, error, required, className }: FieldProps): ReactElement;
613
614
 
614
615
  type InputSize = "sm" | "md" | "lg";
615
- interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
616
+ interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
617
+ /** The native input type, passed straight through — the system adds no types
618
+ of its own, so `email`, `tel`, `url` and `number` behave as the platform
619
+ defines them, keyboard and validation included. Default "text".
620
+
621
+ One type the component answers to: with `type="search"`, `onClear` takes
622
+ over the browser's own clear cross, so the field shows one clear
623
+ affordance rather than two. Without `onClear` the native cross is left
624
+ alone — there it is the only way to empty the field. */
625
+ type?: HTMLInputTypeAttribute;
626
+ /** Control height and type size. The icon slots, the gutter and the clear
627
+ button all step with it. Default "md". */
616
628
  size?: InputSize;
617
629
  /** Marks the value as failing validation — sets aria-invalid and the danger
618
630
  border. Inside a Field the field's error state does this already. */
@@ -624,20 +636,50 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">
624
636
  iconRight?: ReactNode;
625
637
  ref?: Ref<HTMLInputElement>;
626
638
  }
639
+ type ClearEnforcement = {
640
+ /** Raises a clear button in the trailing slot whenever the field holds
641
+ text, and runs when it is pressed. An uncontrolled field is emptied
642
+ for you; a controlled one is yours to empty here. Rules out
643
+ iconRight — they are the same slot. */
644
+ onClear: () => void;
645
+ /** Names that button, e.g. "Clear search". Required: the cross says
646
+ nothing to a screen reader, and the words are the app's — "Clear
647
+ search" and "Clear filter" are not interchangeable. */
648
+ clearLabel: string;
649
+ iconRight?: undefined;
650
+ } | {
651
+ onClear?: undefined;
652
+ clearLabel?: undefined;
653
+ };
654
+ type InputProps = InputBaseProps & ClearEnforcement;
627
655
  /**
628
656
  * Single-line text input. Inside a Field it inherits id/description/invalid.
629
657
  *
658
+ * Sizes are `sm` / `md` / `lg`; the icon slots and the clear button step with
659
+ * them. `onClear` folds in what SearchField used to be — pair it with
660
+ * `type="search"` and it replaces the browser's own clear cross.
661
+ *
630
662
  * ```tsx
631
663
  * <Field label="Name">
632
664
  * <Input value={name} onChange={(e) => setName(e.target.value)} />
633
665
  * </Field>
634
666
  *
635
667
  * <Input aria-label="Search" iconLeft={<Icon name="search" />} />
668
+ *
669
+ * <Input
670
+ * type="search"
671
+ * aria-label="Search sessions"
672
+ * iconLeft={<Icon name="search" />}
673
+ * value={query}
674
+ * onChange={(e) => setQuery(e.target.value)}
675
+ * clearLabel="Clear search"
676
+ * onClear={() => setQuery("")}
677
+ * />
636
678
  * ```
637
679
  */
638
- declare function Input({ size, invalid, iconLeft, iconRight, className, ...rest }: InputProps): ReactElement;
680
+ declare function Input({ size, invalid, iconLeft, iconRight, onClear, clearLabel, className, ref, ...rest }: InputProps): ReactElement;
639
681
 
640
- interface PasswordInputProps extends Omit<InputProps, "type"> {
682
+ interface PasswordInputProps extends Omit<InputProps, "type" | "onClear" | "clearLabel" | "iconRight"> {
641
683
  /** Names the reveal button while the password is hidden, e.g. "Show password".
642
684
  Required: the button carries no visible text, so this is the only thing a
643
685
  screen reader has, and it is the app's language rather than the system's. */
@@ -820,26 +862,6 @@ interface SegmentedControlProps<T extends string = string> {
820
862
  */
821
863
  declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, repick, className, }: SegmentedControlProps<T>): ReactElement;
822
864
 
823
- interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
824
- /** Accessible name. */
825
- label: string;
826
- /** Names the clear button, e.g. "Clear search". Required: the button is a
827
- glyph, so this is all a screen reader has, and the words are the app's. */
828
- clearLabel: string;
829
- value: string;
830
- /** Receives the new text — "" when cleared. */
831
- onChange: (value: string) => void;
832
- ref?: Ref<HTMLInputElement>;
833
- }
834
- /**
835
- * Controlled search input with a clear affordance once there is text.
836
- *
837
- * ```tsx
838
- * <SearchField label="Search sessions" clearLabel="Clear search" value={query} onChange={setQuery} />
839
- * ```
840
- */
841
- declare function SearchField({ label, clearLabel, value, onChange, className, ...rest }: SearchFieldProps): ReactElement;
842
-
843
865
  interface ScrollerLabels {
844
866
  previous: string;
845
867
  next: string;
@@ -1334,6 +1356,141 @@ declare function SheetFooter({ children }: {
1334
1356
  children: ReactNode;
1335
1357
  }): react.JSX.Element;
1336
1358
 
1359
+ type PopoverPlacement = Placement;
1360
+ interface PopoverProps {
1361
+ open: boolean;
1362
+ onClose: () => void;
1363
+ /** The trigger the panel hangs off. It stays interactive while open. */
1364
+ anchorRef: RefObject<HTMLElement | null>;
1365
+ /** Accessible name of the panel. */
1366
+ label: string;
1367
+ /** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
1368
+ placement?: PopoverPlacement;
1369
+ className?: string;
1370
+ children: ReactNode;
1371
+ }
1372
+ /**
1373
+ * Anchored, non-modal surface. The page behind it stays live and scrollable
1374
+ * and the panel travels with the anchor; a press outside, Escape, or the
1375
+ * trigger itself dismisses it.
1376
+ *
1377
+ * Modal by contrast: reach for Modal when the answer must come before anything
1378
+ * else, and for Sheet when the content is a task rather than a detail — a
1379
+ * form with its own header and footer belongs in one of those, not here.
1380
+ *
1381
+ * ```tsx
1382
+ * const anchor = useRef<HTMLButtonElement>(null);
1383
+ * const [open, setOpen] = useState(false);
1384
+ * <Button ref={anchor} aria-expanded={open} onClick={() => setOpen((v) => !v)}>
1385
+ * Equipment
1386
+ * </Button>
1387
+ * <Popover open={open} onClose={() => setOpen(false)} anchorRef={anchor} label="Equipment">
1388
+ * <PopoverBody>…</PopoverBody>
1389
+ * </Popover>
1390
+ * ```
1391
+ */
1392
+ declare function Popover({ open, onClose, anchorRef, label, placement, className, children, }: PopoverProps): react.ReactPortal | null;
1393
+ type PopoverHeaderProps = {
1394
+ children: ReactNode;
1395
+ } & ({
1396
+ /** Renders a close button after the title. Wire it to the popover's own onClose. */
1397
+ onClose: () => void;
1398
+ /** Accessible name of the close button (localise). */
1399
+ closeLabel: string;
1400
+ } | {
1401
+ onClose?: undefined;
1402
+ closeLabel?: undefined;
1403
+ });
1404
+ declare function PopoverHeader({ children, onClose, closeLabel }: PopoverHeaderProps): react.JSX.Element;
1405
+ declare function PopoverBody({ children }: {
1406
+ children: ReactNode;
1407
+ }): react.JSX.Element;
1408
+ declare function PopoverFooter({ children }: {
1409
+ children: ReactNode;
1410
+ }): react.JSX.Element;
1411
+
1412
+ type MenuPlacement = Placement;
1413
+ /** What Menu needs to be able to put on its trigger. */
1414
+ type MenuTriggerProps = {
1415
+ ref?: Ref<HTMLElement> | undefined;
1416
+ "aria-haspopup"?: "menu" | undefined;
1417
+ "aria-expanded"?: boolean | undefined;
1418
+ onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
1419
+ onKeyDown?: ((event: KeyboardEvent<HTMLElement>) => void) | undefined;
1420
+ };
1421
+ interface MenuProps {
1422
+ /** Accessible name of the menu — what the list of actions is *for*. */
1423
+ label: string;
1424
+ /** The control that opens it. Gets the ref, the ARIA and the key handling. */
1425
+ trigger: ReactElement<MenuTriggerProps>;
1426
+ /** Side it prefers. It flips and slides to stay on screen. Default "bottom-end". */
1427
+ placement?: MenuPlacement;
1428
+ className?: string;
1429
+ children: ReactNode;
1430
+ }
1431
+ /**
1432
+ * A button that opens a short list of actions (APG's menu button).
1433
+ *
1434
+ * Open state is the menu's own: a list of actions has no meaning outside the
1435
+ * button that opened it, so unlike Modal, Sheet and Popover there is nothing
1436
+ * for a caller to hold. Reach for Popover instead the moment the panel holds
1437
+ * anything but actions — a form, a filter, a list of things to read.
1438
+ *
1439
+ * ```tsx
1440
+ * <Menu label="Heat actions" trigger={<Button variant="ghost">Actions</Button>}>
1441
+ * <MenuItem onSelect={edit}>Edit</MenuItem>
1442
+ * <MenuItem onSelect={remove} tone="danger">Delete</MenuItem>
1443
+ * </Menu>
1444
+ * ```
1445
+ */
1446
+ declare function Menu({ label, trigger, placement, className, children }: MenuProps): react.JSX.Element;
1447
+ interface MenuItemProps {
1448
+ /** What the action does. The menu closes itself around it. */
1449
+ onSelect: () => void;
1450
+ disabled?: boolean;
1451
+ /** "danger" for an action that destroys something. Default "default". */
1452
+ tone?: "default" | "danger";
1453
+ children: ReactNode;
1454
+ }
1455
+ declare function MenuItem({ onSelect, disabled, tone, children }: MenuItemProps): react.JSX.Element;
1456
+
1457
+ type TooltipPlacement = Placement;
1458
+ /** What Tooltip needs to be able to put on its trigger. */
1459
+ type TriggerProps = {
1460
+ ref?: Ref<HTMLElement> | undefined;
1461
+ "aria-describedby"?: string | undefined;
1462
+ onPointerEnter?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
1463
+ onPointerLeave?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
1464
+ onFocus?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
1465
+ onBlur?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
1466
+ };
1467
+ interface TooltipProps {
1468
+ /** The label. Plain text — nothing here is reachable by pointer or key. */
1469
+ content: ReactNode;
1470
+ /** Side it prefers. It flips and slides to stay on screen. Default "top". */
1471
+ placement?: TooltipPlacement;
1472
+ /** Pointer dwell in ms. Keyboard focus ignores it. Default 400. */
1473
+ delayMs?: number;
1474
+ /** The control being labelled. Gets the ref and the handlers. */
1475
+ children: ReactElement<TriggerProps>;
1476
+ }
1477
+ /**
1478
+ * A name for a control that shows only its glyph, on hover and on focus.
1479
+ *
1480
+ * It describes; it does not hold anything. There is nothing to click inside
1481
+ * it and focus never moves into it, so anything the reader has to act on —
1482
+ * a link, a button, a form — belongs in a Popover instead. A control whose
1483
+ * label is *only* here still needs an aria-label of its own: this is the
1484
+ * accessible description, not the accessible name.
1485
+ *
1486
+ * ```tsx
1487
+ * <Tooltip content="Remove from heat">
1488
+ * <Button variant="ghost" aria-label="Remove from heat"><Icon name="x" /></Button>
1489
+ * </Tooltip>
1490
+ * ```
1491
+ */
1492
+ declare function Tooltip({ content, placement, delayMs, children, }: TooltipProps): react.JSX.Element;
1493
+
1337
1494
  type ConfirmDialogTone = "default" | "danger" | "warning";
1338
1495
  interface ConfirmDialogProps<T = void> {
1339
1496
  /** The row in question, or null when nothing is being asked. Held by the
@@ -1881,14 +2038,23 @@ declare function Breadcrumb({ items, label, linkAs, className, ...rest }: Breadc
1881
2038
  interface UseOverlayOptions {
1882
2039
  open: boolean;
1883
2040
  onClose: () => void;
2041
+ /**
2042
+ * Freeze the page behind the surface. Default true.
2043
+ *
2044
+ * False for anchored surfaces: a popover is pinned to a trigger that scrolls
2045
+ * with the page, so locking the page would strand it over content the reader
2046
+ * can no longer reach, and locking it *and* letting the popover follow the
2047
+ * anchor are the same gesture answered two ways.
2048
+ */
2049
+ lockScroll?: boolean;
1884
2050
  }
1885
2051
  /**
1886
2052
  * Shared modal-surface behaviour: focus capture and restore, Escape to
1887
2053
  * close, Tab cycling inside the panel, body scroll lock. Attach the
1888
2054
  * returned ref to the dialog element (it needs tabIndex={-1}).
1889
2055
  *
1890
- * Anchor-positioned overlays (Tooltip/Popover) will extend this hook with
1891
- * a floating-ui middleware pass; the options object leaves room for that.
2056
+ * Popover uses it too, with `lockScroll: false`; where it sits on the screen
2057
+ * is a separate question, answered by useAnchoredPosition.
1892
2058
  */
1893
2059
  declare function useOverlay<T extends HTMLElement>(options: UseOverlayOptions): RefObject<T | null>;
1894
2060
 
@@ -1958,4 +2124,4 @@ interface RovingGroupOptions {
1958
2124
  */
1959
2125
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1960
2126
 
1961
- export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, type CardBodyProps, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
2127
+ export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, type CardBodyProps, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Menu, MenuItem, type MenuItemProps, type MenuPlacement, type MenuProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, Popover, PopoverBody, PopoverFooter, PopoverHeader, type PopoverHeaderProps, type PopoverPlacement, type PopoverProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipPlacement, type TooltipProps, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, KeyboardEvent } from 'react';
2
+ import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, HTMLInputTypeAttribute, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, MouseEvent, KeyboardEvent, PointerEvent, FocusEvent } from 'react';
3
+ import { Placement } from '@floating-ui/dom';
3
4
 
4
5
  /**
5
6
  * Join class names, dropping anything falsy.
@@ -612,7 +613,18 @@ interface FieldProps {
612
613
  declare function Field({ label, children, hint, error, required, className }: FieldProps): ReactElement;
613
614
 
614
615
  type InputSize = "sm" | "md" | "lg";
615
- interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
616
+ interface InputBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
617
+ /** The native input type, passed straight through — the system adds no types
618
+ of its own, so `email`, `tel`, `url` and `number` behave as the platform
619
+ defines them, keyboard and validation included. Default "text".
620
+
621
+ One type the component answers to: with `type="search"`, `onClear` takes
622
+ over the browser's own clear cross, so the field shows one clear
623
+ affordance rather than two. Without `onClear` the native cross is left
624
+ alone — there it is the only way to empty the field. */
625
+ type?: HTMLInputTypeAttribute;
626
+ /** Control height and type size. The icon slots, the gutter and the clear
627
+ button all step with it. Default "md". */
616
628
  size?: InputSize;
617
629
  /** Marks the value as failing validation — sets aria-invalid and the danger
618
630
  border. Inside a Field the field's error state does this already. */
@@ -624,20 +636,50 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">
624
636
  iconRight?: ReactNode;
625
637
  ref?: Ref<HTMLInputElement>;
626
638
  }
639
+ type ClearEnforcement = {
640
+ /** Raises a clear button in the trailing slot whenever the field holds
641
+ text, and runs when it is pressed. An uncontrolled field is emptied
642
+ for you; a controlled one is yours to empty here. Rules out
643
+ iconRight — they are the same slot. */
644
+ onClear: () => void;
645
+ /** Names that button, e.g. "Clear search". Required: the cross says
646
+ nothing to a screen reader, and the words are the app's — "Clear
647
+ search" and "Clear filter" are not interchangeable. */
648
+ clearLabel: string;
649
+ iconRight?: undefined;
650
+ } | {
651
+ onClear?: undefined;
652
+ clearLabel?: undefined;
653
+ };
654
+ type InputProps = InputBaseProps & ClearEnforcement;
627
655
  /**
628
656
  * Single-line text input. Inside a Field it inherits id/description/invalid.
629
657
  *
658
+ * Sizes are `sm` / `md` / `lg`; the icon slots and the clear button step with
659
+ * them. `onClear` folds in what SearchField used to be — pair it with
660
+ * `type="search"` and it replaces the browser's own clear cross.
661
+ *
630
662
  * ```tsx
631
663
  * <Field label="Name">
632
664
  * <Input value={name} onChange={(e) => setName(e.target.value)} />
633
665
  * </Field>
634
666
  *
635
667
  * <Input aria-label="Search" iconLeft={<Icon name="search" />} />
668
+ *
669
+ * <Input
670
+ * type="search"
671
+ * aria-label="Search sessions"
672
+ * iconLeft={<Icon name="search" />}
673
+ * value={query}
674
+ * onChange={(e) => setQuery(e.target.value)}
675
+ * clearLabel="Clear search"
676
+ * onClear={() => setQuery("")}
677
+ * />
636
678
  * ```
637
679
  */
638
- declare function Input({ size, invalid, iconLeft, iconRight, className, ...rest }: InputProps): ReactElement;
680
+ declare function Input({ size, invalid, iconLeft, iconRight, onClear, clearLabel, className, ref, ...rest }: InputProps): ReactElement;
639
681
 
640
- interface PasswordInputProps extends Omit<InputProps, "type"> {
682
+ interface PasswordInputProps extends Omit<InputProps, "type" | "onClear" | "clearLabel" | "iconRight"> {
641
683
  /** Names the reveal button while the password is hidden, e.g. "Show password".
642
684
  Required: the button carries no visible text, so this is the only thing a
643
685
  screen reader has, and it is the app's language rather than the system's. */
@@ -820,26 +862,6 @@ interface SegmentedControlProps<T extends string = string> {
820
862
  */
821
863
  declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, repick, className, }: SegmentedControlProps<T>): ReactElement;
822
864
 
823
- interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
824
- /** Accessible name. */
825
- label: string;
826
- /** Names the clear button, e.g. "Clear search". Required: the button is a
827
- glyph, so this is all a screen reader has, and the words are the app's. */
828
- clearLabel: string;
829
- value: string;
830
- /** Receives the new text — "" when cleared. */
831
- onChange: (value: string) => void;
832
- ref?: Ref<HTMLInputElement>;
833
- }
834
- /**
835
- * Controlled search input with a clear affordance once there is text.
836
- *
837
- * ```tsx
838
- * <SearchField label="Search sessions" clearLabel="Clear search" value={query} onChange={setQuery} />
839
- * ```
840
- */
841
- declare function SearchField({ label, clearLabel, value, onChange, className, ...rest }: SearchFieldProps): ReactElement;
842
-
843
865
  interface ScrollerLabels {
844
866
  previous: string;
845
867
  next: string;
@@ -1334,6 +1356,141 @@ declare function SheetFooter({ children }: {
1334
1356
  children: ReactNode;
1335
1357
  }): react.JSX.Element;
1336
1358
 
1359
+ type PopoverPlacement = Placement;
1360
+ interface PopoverProps {
1361
+ open: boolean;
1362
+ onClose: () => void;
1363
+ /** The trigger the panel hangs off. It stays interactive while open. */
1364
+ anchorRef: RefObject<HTMLElement | null>;
1365
+ /** Accessible name of the panel. */
1366
+ label: string;
1367
+ /** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
1368
+ placement?: PopoverPlacement;
1369
+ className?: string;
1370
+ children: ReactNode;
1371
+ }
1372
+ /**
1373
+ * Anchored, non-modal surface. The page behind it stays live and scrollable
1374
+ * and the panel travels with the anchor; a press outside, Escape, or the
1375
+ * trigger itself dismisses it.
1376
+ *
1377
+ * Modal by contrast: reach for Modal when the answer must come before anything
1378
+ * else, and for Sheet when the content is a task rather than a detail — a
1379
+ * form with its own header and footer belongs in one of those, not here.
1380
+ *
1381
+ * ```tsx
1382
+ * const anchor = useRef<HTMLButtonElement>(null);
1383
+ * const [open, setOpen] = useState(false);
1384
+ * <Button ref={anchor} aria-expanded={open} onClick={() => setOpen((v) => !v)}>
1385
+ * Equipment
1386
+ * </Button>
1387
+ * <Popover open={open} onClose={() => setOpen(false)} anchorRef={anchor} label="Equipment">
1388
+ * <PopoverBody>…</PopoverBody>
1389
+ * </Popover>
1390
+ * ```
1391
+ */
1392
+ declare function Popover({ open, onClose, anchorRef, label, placement, className, children, }: PopoverProps): react.ReactPortal | null;
1393
+ type PopoverHeaderProps = {
1394
+ children: ReactNode;
1395
+ } & ({
1396
+ /** Renders a close button after the title. Wire it to the popover's own onClose. */
1397
+ onClose: () => void;
1398
+ /** Accessible name of the close button (localise). */
1399
+ closeLabel: string;
1400
+ } | {
1401
+ onClose?: undefined;
1402
+ closeLabel?: undefined;
1403
+ });
1404
+ declare function PopoverHeader({ children, onClose, closeLabel }: PopoverHeaderProps): react.JSX.Element;
1405
+ declare function PopoverBody({ children }: {
1406
+ children: ReactNode;
1407
+ }): react.JSX.Element;
1408
+ declare function PopoverFooter({ children }: {
1409
+ children: ReactNode;
1410
+ }): react.JSX.Element;
1411
+
1412
+ type MenuPlacement = Placement;
1413
+ /** What Menu needs to be able to put on its trigger. */
1414
+ type MenuTriggerProps = {
1415
+ ref?: Ref<HTMLElement> | undefined;
1416
+ "aria-haspopup"?: "menu" | undefined;
1417
+ "aria-expanded"?: boolean | undefined;
1418
+ onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
1419
+ onKeyDown?: ((event: KeyboardEvent<HTMLElement>) => void) | undefined;
1420
+ };
1421
+ interface MenuProps {
1422
+ /** Accessible name of the menu — what the list of actions is *for*. */
1423
+ label: string;
1424
+ /** The control that opens it. Gets the ref, the ARIA and the key handling. */
1425
+ trigger: ReactElement<MenuTriggerProps>;
1426
+ /** Side it prefers. It flips and slides to stay on screen. Default "bottom-end". */
1427
+ placement?: MenuPlacement;
1428
+ className?: string;
1429
+ children: ReactNode;
1430
+ }
1431
+ /**
1432
+ * A button that opens a short list of actions (APG's menu button).
1433
+ *
1434
+ * Open state is the menu's own: a list of actions has no meaning outside the
1435
+ * button that opened it, so unlike Modal, Sheet and Popover there is nothing
1436
+ * for a caller to hold. Reach for Popover instead the moment the panel holds
1437
+ * anything but actions — a form, a filter, a list of things to read.
1438
+ *
1439
+ * ```tsx
1440
+ * <Menu label="Heat actions" trigger={<Button variant="ghost">Actions</Button>}>
1441
+ * <MenuItem onSelect={edit}>Edit</MenuItem>
1442
+ * <MenuItem onSelect={remove} tone="danger">Delete</MenuItem>
1443
+ * </Menu>
1444
+ * ```
1445
+ */
1446
+ declare function Menu({ label, trigger, placement, className, children }: MenuProps): react.JSX.Element;
1447
+ interface MenuItemProps {
1448
+ /** What the action does. The menu closes itself around it. */
1449
+ onSelect: () => void;
1450
+ disabled?: boolean;
1451
+ /** "danger" for an action that destroys something. Default "default". */
1452
+ tone?: "default" | "danger";
1453
+ children: ReactNode;
1454
+ }
1455
+ declare function MenuItem({ onSelect, disabled, tone, children }: MenuItemProps): react.JSX.Element;
1456
+
1457
+ type TooltipPlacement = Placement;
1458
+ /** What Tooltip needs to be able to put on its trigger. */
1459
+ type TriggerProps = {
1460
+ ref?: Ref<HTMLElement> | undefined;
1461
+ "aria-describedby"?: string | undefined;
1462
+ onPointerEnter?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
1463
+ onPointerLeave?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
1464
+ onFocus?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
1465
+ onBlur?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
1466
+ };
1467
+ interface TooltipProps {
1468
+ /** The label. Plain text — nothing here is reachable by pointer or key. */
1469
+ content: ReactNode;
1470
+ /** Side it prefers. It flips and slides to stay on screen. Default "top". */
1471
+ placement?: TooltipPlacement;
1472
+ /** Pointer dwell in ms. Keyboard focus ignores it. Default 400. */
1473
+ delayMs?: number;
1474
+ /** The control being labelled. Gets the ref and the handlers. */
1475
+ children: ReactElement<TriggerProps>;
1476
+ }
1477
+ /**
1478
+ * A name for a control that shows only its glyph, on hover and on focus.
1479
+ *
1480
+ * It describes; it does not hold anything. There is nothing to click inside
1481
+ * it and focus never moves into it, so anything the reader has to act on —
1482
+ * a link, a button, a form — belongs in a Popover instead. A control whose
1483
+ * label is *only* here still needs an aria-label of its own: this is the
1484
+ * accessible description, not the accessible name.
1485
+ *
1486
+ * ```tsx
1487
+ * <Tooltip content="Remove from heat">
1488
+ * <Button variant="ghost" aria-label="Remove from heat"><Icon name="x" /></Button>
1489
+ * </Tooltip>
1490
+ * ```
1491
+ */
1492
+ declare function Tooltip({ content, placement, delayMs, children, }: TooltipProps): react.JSX.Element;
1493
+
1337
1494
  type ConfirmDialogTone = "default" | "danger" | "warning";
1338
1495
  interface ConfirmDialogProps<T = void> {
1339
1496
  /** The row in question, or null when nothing is being asked. Held by the
@@ -1881,14 +2038,23 @@ declare function Breadcrumb({ items, label, linkAs, className, ...rest }: Breadc
1881
2038
  interface UseOverlayOptions {
1882
2039
  open: boolean;
1883
2040
  onClose: () => void;
2041
+ /**
2042
+ * Freeze the page behind the surface. Default true.
2043
+ *
2044
+ * False for anchored surfaces: a popover is pinned to a trigger that scrolls
2045
+ * with the page, so locking the page would strand it over content the reader
2046
+ * can no longer reach, and locking it *and* letting the popover follow the
2047
+ * anchor are the same gesture answered two ways.
2048
+ */
2049
+ lockScroll?: boolean;
1884
2050
  }
1885
2051
  /**
1886
2052
  * Shared modal-surface behaviour: focus capture and restore, Escape to
1887
2053
  * close, Tab cycling inside the panel, body scroll lock. Attach the
1888
2054
  * returned ref to the dialog element (it needs tabIndex={-1}).
1889
2055
  *
1890
- * Anchor-positioned overlays (Tooltip/Popover) will extend this hook with
1891
- * a floating-ui middleware pass; the options object leaves room for that.
2056
+ * Popover uses it too, with `lockScroll: false`; where it sits on the screen
2057
+ * is a separate question, answered by useAnchoredPosition.
1892
2058
  */
1893
2059
  declare function useOverlay<T extends HTMLElement>(options: UseOverlayOptions): RefObject<T | null>;
1894
2060
 
@@ -1958,4 +2124,4 @@ interface RovingGroupOptions {
1958
2124
  */
1959
2125
  declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
1960
2126
 
1961
- export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, type CardBodyProps, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
2127
+ export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, type CardBodyProps, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, type DataColumn, DataTable, type DataTableProps, type DataTableSelectionLabels, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, FileDrop, type FileDropProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Menu, MenuItem, type MenuItemProps, type MenuPlacement, type MenuProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, Popover, PopoverBody, PopoverFooter, PopoverHeader, type PopoverHeaderProps, type PopoverPlacement, type PopoverProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, Scroller, type ScrollerLabels, type ScrollerProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavItem, type SideNavItemProps, type SideNavProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipPlacement, type TooltipProps, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };