@mond-design-system/react 5.0.0 → 6.0.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.cjs +354 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +204 -103
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +156 -10
- package/dist/index.d.ts +156 -10
- package/dist/index.js +348 -66
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
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, HTMLInputTypeAttribute, 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.
|
|
@@ -959,8 +960,7 @@ declare function ListItem({ title, description, leading, trailing, actions, onCl
|
|
|
959
960
|
|
|
960
961
|
interface DataColumn<Row> {
|
|
961
962
|
key: string;
|
|
962
|
-
/** Read in the header row
|
|
963
|
-
folded into cards. */
|
|
963
|
+
/** Read in the header row. */
|
|
964
964
|
header: ReactNode;
|
|
965
965
|
/** CSS width for the column, applied through the colgroup. */
|
|
966
966
|
width?: string;
|
|
@@ -1011,11 +1011,13 @@ type DataTableProps<Row> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
|
1011
1011
|
ref?: Ref<HTMLDivElement>;
|
|
1012
1012
|
} & DataTableSelection;
|
|
1013
1013
|
/**
|
|
1014
|
-
* Rows and columns,
|
|
1014
|
+
* Rows and columns, at every width.
|
|
1015
1015
|
*
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1016
|
+
* A table is for reading across a row and comparing down a column, and it stays
|
|
1017
|
+
* one on a narrow screen rather than turning into something else: where the
|
|
1018
|
+
* columns need more room than there is, the table pans sideways inside a box
|
|
1019
|
+
* that takes focus. An app wanting cards on a phone builds cards — that is a
|
|
1020
|
+
* different component, not this one wearing a second layout.
|
|
1019
1021
|
*
|
|
1020
1022
|
* ```tsx
|
|
1021
1023
|
* <DataTable
|
|
@@ -1355,6 +1357,141 @@ declare function SheetFooter({ children }: {
|
|
|
1355
1357
|
children: ReactNode;
|
|
1356
1358
|
}): react.JSX.Element;
|
|
1357
1359
|
|
|
1360
|
+
type PopoverPlacement = Placement;
|
|
1361
|
+
interface PopoverProps {
|
|
1362
|
+
open: boolean;
|
|
1363
|
+
onClose: () => void;
|
|
1364
|
+
/** The trigger the panel hangs off. It stays interactive while open. */
|
|
1365
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
1366
|
+
/** Accessible name of the panel. */
|
|
1367
|
+
label: string;
|
|
1368
|
+
/** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
|
|
1369
|
+
placement?: PopoverPlacement;
|
|
1370
|
+
className?: string;
|
|
1371
|
+
children: ReactNode;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Anchored, non-modal surface. The page behind it stays live and scrollable
|
|
1375
|
+
* and the panel travels with the anchor; a press outside, Escape, or the
|
|
1376
|
+
* trigger itself dismisses it.
|
|
1377
|
+
*
|
|
1378
|
+
* Modal by contrast: reach for Modal when the answer must come before anything
|
|
1379
|
+
* else, and for Sheet when the content is a task rather than a detail — a
|
|
1380
|
+
* form with its own header and footer belongs in one of those, not here.
|
|
1381
|
+
*
|
|
1382
|
+
* ```tsx
|
|
1383
|
+
* const anchor = useRef<HTMLButtonElement>(null);
|
|
1384
|
+
* const [open, setOpen] = useState(false);
|
|
1385
|
+
* <Button ref={anchor} aria-expanded={open} onClick={() => setOpen((v) => !v)}>
|
|
1386
|
+
* Equipment
|
|
1387
|
+
* </Button>
|
|
1388
|
+
* <Popover open={open} onClose={() => setOpen(false)} anchorRef={anchor} label="Equipment">
|
|
1389
|
+
* <PopoverBody>…</PopoverBody>
|
|
1390
|
+
* </Popover>
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
declare function Popover({ open, onClose, anchorRef, label, placement, className, children, }: PopoverProps): react.ReactPortal | null;
|
|
1394
|
+
type PopoverHeaderProps = {
|
|
1395
|
+
children: ReactNode;
|
|
1396
|
+
} & ({
|
|
1397
|
+
/** Renders a close button after the title. Wire it to the popover's own onClose. */
|
|
1398
|
+
onClose: () => void;
|
|
1399
|
+
/** Accessible name of the close button (localise). */
|
|
1400
|
+
closeLabel: string;
|
|
1401
|
+
} | {
|
|
1402
|
+
onClose?: undefined;
|
|
1403
|
+
closeLabel?: undefined;
|
|
1404
|
+
});
|
|
1405
|
+
declare function PopoverHeader({ children, onClose, closeLabel }: PopoverHeaderProps): react.JSX.Element;
|
|
1406
|
+
declare function PopoverBody({ children }: {
|
|
1407
|
+
children: ReactNode;
|
|
1408
|
+
}): react.JSX.Element;
|
|
1409
|
+
declare function PopoverFooter({ children }: {
|
|
1410
|
+
children: ReactNode;
|
|
1411
|
+
}): react.JSX.Element;
|
|
1412
|
+
|
|
1413
|
+
type MenuPlacement = Placement;
|
|
1414
|
+
/** What Menu needs to be able to put on its trigger. */
|
|
1415
|
+
type MenuTriggerProps = {
|
|
1416
|
+
ref?: Ref<HTMLElement> | undefined;
|
|
1417
|
+
"aria-haspopup"?: "menu" | undefined;
|
|
1418
|
+
"aria-expanded"?: boolean | undefined;
|
|
1419
|
+
onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
|
|
1420
|
+
onKeyDown?: ((event: KeyboardEvent<HTMLElement>) => void) | undefined;
|
|
1421
|
+
};
|
|
1422
|
+
interface MenuProps {
|
|
1423
|
+
/** Accessible name of the menu — what the list of actions is *for*. */
|
|
1424
|
+
label: string;
|
|
1425
|
+
/** The control that opens it. Gets the ref, the ARIA and the key handling. */
|
|
1426
|
+
trigger: ReactElement<MenuTriggerProps>;
|
|
1427
|
+
/** Side it prefers. It flips and slides to stay on screen. Default "bottom-end". */
|
|
1428
|
+
placement?: MenuPlacement;
|
|
1429
|
+
className?: string;
|
|
1430
|
+
children: ReactNode;
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* A button that opens a short list of actions (APG's menu button).
|
|
1434
|
+
*
|
|
1435
|
+
* Open state is the menu's own: a list of actions has no meaning outside the
|
|
1436
|
+
* button that opened it, so unlike Modal, Sheet and Popover there is nothing
|
|
1437
|
+
* for a caller to hold. Reach for Popover instead the moment the panel holds
|
|
1438
|
+
* anything but actions — a form, a filter, a list of things to read.
|
|
1439
|
+
*
|
|
1440
|
+
* ```tsx
|
|
1441
|
+
* <Menu label="Heat actions" trigger={<Button variant="ghost">Actions</Button>}>
|
|
1442
|
+
* <MenuItem onSelect={edit}>Edit</MenuItem>
|
|
1443
|
+
* <MenuItem onSelect={remove} tone="danger">Delete</MenuItem>
|
|
1444
|
+
* </Menu>
|
|
1445
|
+
* ```
|
|
1446
|
+
*/
|
|
1447
|
+
declare function Menu({ label, trigger, placement, className, children }: MenuProps): react.JSX.Element;
|
|
1448
|
+
interface MenuItemProps {
|
|
1449
|
+
/** What the action does. The menu closes itself around it. */
|
|
1450
|
+
onSelect: () => void;
|
|
1451
|
+
disabled?: boolean;
|
|
1452
|
+
/** "danger" for an action that destroys something. Default "default". */
|
|
1453
|
+
tone?: "default" | "danger";
|
|
1454
|
+
children: ReactNode;
|
|
1455
|
+
}
|
|
1456
|
+
declare function MenuItem({ onSelect, disabled, tone, children }: MenuItemProps): react.JSX.Element;
|
|
1457
|
+
|
|
1458
|
+
type TooltipPlacement = Placement;
|
|
1459
|
+
/** What Tooltip needs to be able to put on its trigger. */
|
|
1460
|
+
type TriggerProps = {
|
|
1461
|
+
ref?: Ref<HTMLElement> | undefined;
|
|
1462
|
+
"aria-describedby"?: string | undefined;
|
|
1463
|
+
onPointerEnter?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
|
|
1464
|
+
onPointerLeave?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
|
|
1465
|
+
onFocus?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
|
|
1466
|
+
onBlur?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
|
|
1467
|
+
};
|
|
1468
|
+
interface TooltipProps {
|
|
1469
|
+
/** The label. Plain text — nothing here is reachable by pointer or key. */
|
|
1470
|
+
content: ReactNode;
|
|
1471
|
+
/** Side it prefers. It flips and slides to stay on screen. Default "top". */
|
|
1472
|
+
placement?: TooltipPlacement;
|
|
1473
|
+
/** Pointer dwell in ms. Keyboard focus ignores it. Default 400. */
|
|
1474
|
+
delayMs?: number;
|
|
1475
|
+
/** The control being labelled. Gets the ref and the handlers. */
|
|
1476
|
+
children: ReactElement<TriggerProps>;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* A name for a control that shows only its glyph, on hover and on focus.
|
|
1480
|
+
*
|
|
1481
|
+
* It describes; it does not hold anything. There is nothing to click inside
|
|
1482
|
+
* it and focus never moves into it, so anything the reader has to act on —
|
|
1483
|
+
* a link, a button, a form — belongs in a Popover instead. A control whose
|
|
1484
|
+
* label is *only* here still needs an aria-label of its own: this is the
|
|
1485
|
+
* accessible description, not the accessible name.
|
|
1486
|
+
*
|
|
1487
|
+
* ```tsx
|
|
1488
|
+
* <Tooltip content="Remove from heat">
|
|
1489
|
+
* <Button variant="ghost" aria-label="Remove from heat"><Icon name="x" /></Button>
|
|
1490
|
+
* </Tooltip>
|
|
1491
|
+
* ```
|
|
1492
|
+
*/
|
|
1493
|
+
declare function Tooltip({ content, placement, delayMs, children, }: TooltipProps): react.JSX.Element;
|
|
1494
|
+
|
|
1358
1495
|
type ConfirmDialogTone = "default" | "danger" | "warning";
|
|
1359
1496
|
interface ConfirmDialogProps<T = void> {
|
|
1360
1497
|
/** The row in question, or null when nothing is being asked. Held by the
|
|
@@ -1902,14 +2039,23 @@ declare function Breadcrumb({ items, label, linkAs, className, ...rest }: Breadc
|
|
|
1902
2039
|
interface UseOverlayOptions {
|
|
1903
2040
|
open: boolean;
|
|
1904
2041
|
onClose: () => void;
|
|
2042
|
+
/**
|
|
2043
|
+
* Freeze the page behind the surface. Default true.
|
|
2044
|
+
*
|
|
2045
|
+
* False for anchored surfaces: a popover is pinned to a trigger that scrolls
|
|
2046
|
+
* with the page, so locking the page would strand it over content the reader
|
|
2047
|
+
* can no longer reach, and locking it *and* letting the popover follow the
|
|
2048
|
+
* anchor are the same gesture answered two ways.
|
|
2049
|
+
*/
|
|
2050
|
+
lockScroll?: boolean;
|
|
1905
2051
|
}
|
|
1906
2052
|
/**
|
|
1907
2053
|
* Shared modal-surface behaviour: focus capture and restore, Escape to
|
|
1908
2054
|
* close, Tab cycling inside the panel, body scroll lock. Attach the
|
|
1909
2055
|
* returned ref to the dialog element (it needs tabIndex={-1}).
|
|
1910
2056
|
*
|
|
1911
|
-
*
|
|
1912
|
-
* a
|
|
2057
|
+
* Popover uses it too, with `lockScroll: false`; where it sits on the screen
|
|
2058
|
+
* is a separate question, answered by useAnchoredPosition.
|
|
1913
2059
|
*/
|
|
1914
2060
|
declare function useOverlay<T extends HTMLElement>(options: UseOverlayOptions): RefObject<T | null>;
|
|
1915
2061
|
|
|
@@ -1979,4 +2125,4 @@ interface RovingGroupOptions {
|
|
|
1979
2125
|
*/
|
|
1980
2126
|
declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
|
|
1981
2127
|
|
|
1982
|
-
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, 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 };
|
|
2128
|
+
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, HTMLInputTypeAttribute, 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.
|
|
@@ -959,8 +960,7 @@ declare function ListItem({ title, description, leading, trailing, actions, onCl
|
|
|
959
960
|
|
|
960
961
|
interface DataColumn<Row> {
|
|
961
962
|
key: string;
|
|
962
|
-
/** Read in the header row
|
|
963
|
-
folded into cards. */
|
|
963
|
+
/** Read in the header row. */
|
|
964
964
|
header: ReactNode;
|
|
965
965
|
/** CSS width for the column, applied through the colgroup. */
|
|
966
966
|
width?: string;
|
|
@@ -1011,11 +1011,13 @@ type DataTableProps<Row> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
|
1011
1011
|
ref?: Ref<HTMLDivElement>;
|
|
1012
1012
|
} & DataTableSelection;
|
|
1013
1013
|
/**
|
|
1014
|
-
* Rows and columns,
|
|
1014
|
+
* Rows and columns, at every width.
|
|
1015
1015
|
*
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1016
|
+
* A table is for reading across a row and comparing down a column, and it stays
|
|
1017
|
+
* one on a narrow screen rather than turning into something else: where the
|
|
1018
|
+
* columns need more room than there is, the table pans sideways inside a box
|
|
1019
|
+
* that takes focus. An app wanting cards on a phone builds cards — that is a
|
|
1020
|
+
* different component, not this one wearing a second layout.
|
|
1019
1021
|
*
|
|
1020
1022
|
* ```tsx
|
|
1021
1023
|
* <DataTable
|
|
@@ -1355,6 +1357,141 @@ declare function SheetFooter({ children }: {
|
|
|
1355
1357
|
children: ReactNode;
|
|
1356
1358
|
}): react.JSX.Element;
|
|
1357
1359
|
|
|
1360
|
+
type PopoverPlacement = Placement;
|
|
1361
|
+
interface PopoverProps {
|
|
1362
|
+
open: boolean;
|
|
1363
|
+
onClose: () => void;
|
|
1364
|
+
/** The trigger the panel hangs off. It stays interactive while open. */
|
|
1365
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
1366
|
+
/** Accessible name of the panel. */
|
|
1367
|
+
label: string;
|
|
1368
|
+
/** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
|
|
1369
|
+
placement?: PopoverPlacement;
|
|
1370
|
+
className?: string;
|
|
1371
|
+
children: ReactNode;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Anchored, non-modal surface. The page behind it stays live and scrollable
|
|
1375
|
+
* and the panel travels with the anchor; a press outside, Escape, or the
|
|
1376
|
+
* trigger itself dismisses it.
|
|
1377
|
+
*
|
|
1378
|
+
* Modal by contrast: reach for Modal when the answer must come before anything
|
|
1379
|
+
* else, and for Sheet when the content is a task rather than a detail — a
|
|
1380
|
+
* form with its own header and footer belongs in one of those, not here.
|
|
1381
|
+
*
|
|
1382
|
+
* ```tsx
|
|
1383
|
+
* const anchor = useRef<HTMLButtonElement>(null);
|
|
1384
|
+
* const [open, setOpen] = useState(false);
|
|
1385
|
+
* <Button ref={anchor} aria-expanded={open} onClick={() => setOpen((v) => !v)}>
|
|
1386
|
+
* Equipment
|
|
1387
|
+
* </Button>
|
|
1388
|
+
* <Popover open={open} onClose={() => setOpen(false)} anchorRef={anchor} label="Equipment">
|
|
1389
|
+
* <PopoverBody>…</PopoverBody>
|
|
1390
|
+
* </Popover>
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
declare function Popover({ open, onClose, anchorRef, label, placement, className, children, }: PopoverProps): react.ReactPortal | null;
|
|
1394
|
+
type PopoverHeaderProps = {
|
|
1395
|
+
children: ReactNode;
|
|
1396
|
+
} & ({
|
|
1397
|
+
/** Renders a close button after the title. Wire it to the popover's own onClose. */
|
|
1398
|
+
onClose: () => void;
|
|
1399
|
+
/** Accessible name of the close button (localise). */
|
|
1400
|
+
closeLabel: string;
|
|
1401
|
+
} | {
|
|
1402
|
+
onClose?: undefined;
|
|
1403
|
+
closeLabel?: undefined;
|
|
1404
|
+
});
|
|
1405
|
+
declare function PopoverHeader({ children, onClose, closeLabel }: PopoverHeaderProps): react.JSX.Element;
|
|
1406
|
+
declare function PopoverBody({ children }: {
|
|
1407
|
+
children: ReactNode;
|
|
1408
|
+
}): react.JSX.Element;
|
|
1409
|
+
declare function PopoverFooter({ children }: {
|
|
1410
|
+
children: ReactNode;
|
|
1411
|
+
}): react.JSX.Element;
|
|
1412
|
+
|
|
1413
|
+
type MenuPlacement = Placement;
|
|
1414
|
+
/** What Menu needs to be able to put on its trigger. */
|
|
1415
|
+
type MenuTriggerProps = {
|
|
1416
|
+
ref?: Ref<HTMLElement> | undefined;
|
|
1417
|
+
"aria-haspopup"?: "menu" | undefined;
|
|
1418
|
+
"aria-expanded"?: boolean | undefined;
|
|
1419
|
+
onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
|
|
1420
|
+
onKeyDown?: ((event: KeyboardEvent<HTMLElement>) => void) | undefined;
|
|
1421
|
+
};
|
|
1422
|
+
interface MenuProps {
|
|
1423
|
+
/** Accessible name of the menu — what the list of actions is *for*. */
|
|
1424
|
+
label: string;
|
|
1425
|
+
/** The control that opens it. Gets the ref, the ARIA and the key handling. */
|
|
1426
|
+
trigger: ReactElement<MenuTriggerProps>;
|
|
1427
|
+
/** Side it prefers. It flips and slides to stay on screen. Default "bottom-end". */
|
|
1428
|
+
placement?: MenuPlacement;
|
|
1429
|
+
className?: string;
|
|
1430
|
+
children: ReactNode;
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* A button that opens a short list of actions (APG's menu button).
|
|
1434
|
+
*
|
|
1435
|
+
* Open state is the menu's own: a list of actions has no meaning outside the
|
|
1436
|
+
* button that opened it, so unlike Modal, Sheet and Popover there is nothing
|
|
1437
|
+
* for a caller to hold. Reach for Popover instead the moment the panel holds
|
|
1438
|
+
* anything but actions — a form, a filter, a list of things to read.
|
|
1439
|
+
*
|
|
1440
|
+
* ```tsx
|
|
1441
|
+
* <Menu label="Heat actions" trigger={<Button variant="ghost">Actions</Button>}>
|
|
1442
|
+
* <MenuItem onSelect={edit}>Edit</MenuItem>
|
|
1443
|
+
* <MenuItem onSelect={remove} tone="danger">Delete</MenuItem>
|
|
1444
|
+
* </Menu>
|
|
1445
|
+
* ```
|
|
1446
|
+
*/
|
|
1447
|
+
declare function Menu({ label, trigger, placement, className, children }: MenuProps): react.JSX.Element;
|
|
1448
|
+
interface MenuItemProps {
|
|
1449
|
+
/** What the action does. The menu closes itself around it. */
|
|
1450
|
+
onSelect: () => void;
|
|
1451
|
+
disabled?: boolean;
|
|
1452
|
+
/** "danger" for an action that destroys something. Default "default". */
|
|
1453
|
+
tone?: "default" | "danger";
|
|
1454
|
+
children: ReactNode;
|
|
1455
|
+
}
|
|
1456
|
+
declare function MenuItem({ onSelect, disabled, tone, children }: MenuItemProps): react.JSX.Element;
|
|
1457
|
+
|
|
1458
|
+
type TooltipPlacement = Placement;
|
|
1459
|
+
/** What Tooltip needs to be able to put on its trigger. */
|
|
1460
|
+
type TriggerProps = {
|
|
1461
|
+
ref?: Ref<HTMLElement> | undefined;
|
|
1462
|
+
"aria-describedby"?: string | undefined;
|
|
1463
|
+
onPointerEnter?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
|
|
1464
|
+
onPointerLeave?: ((event: PointerEvent<HTMLElement>) => void) | undefined;
|
|
1465
|
+
onFocus?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
|
|
1466
|
+
onBlur?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
|
|
1467
|
+
};
|
|
1468
|
+
interface TooltipProps {
|
|
1469
|
+
/** The label. Plain text — nothing here is reachable by pointer or key. */
|
|
1470
|
+
content: ReactNode;
|
|
1471
|
+
/** Side it prefers. It flips and slides to stay on screen. Default "top". */
|
|
1472
|
+
placement?: TooltipPlacement;
|
|
1473
|
+
/** Pointer dwell in ms. Keyboard focus ignores it. Default 400. */
|
|
1474
|
+
delayMs?: number;
|
|
1475
|
+
/** The control being labelled. Gets the ref and the handlers. */
|
|
1476
|
+
children: ReactElement<TriggerProps>;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* A name for a control that shows only its glyph, on hover and on focus.
|
|
1480
|
+
*
|
|
1481
|
+
* It describes; it does not hold anything. There is nothing to click inside
|
|
1482
|
+
* it and focus never moves into it, so anything the reader has to act on —
|
|
1483
|
+
* a link, a button, a form — belongs in a Popover instead. A control whose
|
|
1484
|
+
* label is *only* here still needs an aria-label of its own: this is the
|
|
1485
|
+
* accessible description, not the accessible name.
|
|
1486
|
+
*
|
|
1487
|
+
* ```tsx
|
|
1488
|
+
* <Tooltip content="Remove from heat">
|
|
1489
|
+
* <Button variant="ghost" aria-label="Remove from heat"><Icon name="x" /></Button>
|
|
1490
|
+
* </Tooltip>
|
|
1491
|
+
* ```
|
|
1492
|
+
*/
|
|
1493
|
+
declare function Tooltip({ content, placement, delayMs, children, }: TooltipProps): react.JSX.Element;
|
|
1494
|
+
|
|
1358
1495
|
type ConfirmDialogTone = "default" | "danger" | "warning";
|
|
1359
1496
|
interface ConfirmDialogProps<T = void> {
|
|
1360
1497
|
/** The row in question, or null when nothing is being asked. Held by the
|
|
@@ -1902,14 +2039,23 @@ declare function Breadcrumb({ items, label, linkAs, className, ...rest }: Breadc
|
|
|
1902
2039
|
interface UseOverlayOptions {
|
|
1903
2040
|
open: boolean;
|
|
1904
2041
|
onClose: () => void;
|
|
2042
|
+
/**
|
|
2043
|
+
* Freeze the page behind the surface. Default true.
|
|
2044
|
+
*
|
|
2045
|
+
* False for anchored surfaces: a popover is pinned to a trigger that scrolls
|
|
2046
|
+
* with the page, so locking the page would strand it over content the reader
|
|
2047
|
+
* can no longer reach, and locking it *and* letting the popover follow the
|
|
2048
|
+
* anchor are the same gesture answered two ways.
|
|
2049
|
+
*/
|
|
2050
|
+
lockScroll?: boolean;
|
|
1905
2051
|
}
|
|
1906
2052
|
/**
|
|
1907
2053
|
* Shared modal-surface behaviour: focus capture and restore, Escape to
|
|
1908
2054
|
* close, Tab cycling inside the panel, body scroll lock. Attach the
|
|
1909
2055
|
* returned ref to the dialog element (it needs tabIndex={-1}).
|
|
1910
2056
|
*
|
|
1911
|
-
*
|
|
1912
|
-
* a
|
|
2057
|
+
* Popover uses it too, with `lockScroll: false`; where it sits on the screen
|
|
2058
|
+
* is a separate question, answered by useAnchoredPosition.
|
|
1913
2059
|
*/
|
|
1914
2060
|
declare function useOverlay<T extends HTMLElement>(options: UseOverlayOptions): RefObject<T | null>;
|
|
1915
2061
|
|
|
@@ -1979,4 +2125,4 @@ interface RovingGroupOptions {
|
|
|
1979
2125
|
*/
|
|
1980
2126
|
declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
|
|
1981
2127
|
|
|
1982
|
-
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, 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 };
|
|
2128
|
+
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 };
|