@mortenbrudvik/waveui 0.11.0 → 0.13.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/README.md +157 -13
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +4 -4
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.colors.cjs +2 -0
- package/dist/components/data-display/Avatar.colors.cjs.map +1 -0
- package/dist/components/data-display/Avatar.colors.mjs +45 -0
- package/dist/components/data-display/Avatar.colors.mjs.map +1 -0
- package/dist/components/data-display/Avatar.context.cjs +1 -1
- package/dist/components/data-display/Avatar.context.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.mjs +4 -2
- package/dist/components/data-display/Avatar.context.mjs.map +1 -1
- package/dist/components/data-display/Avatar.mjs +103 -96
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/Avatar.sizes.cjs +2 -0
- package/dist/components/data-display/Avatar.sizes.cjs.map +1 -0
- package/dist/components/data-display/Avatar.sizes.mjs +41 -0
- package/dist/components/data-display/Avatar.sizes.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.context.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.context.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.context.mjs +9 -0
- package/dist/components/data-display/AvatarGroup.context.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.mjs +65 -122
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.partition.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.partition.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs +14 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs +178 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs.map +1 -0
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +12 -12
- package/dist/components/data-display/InteractionTag.cjs +1 -1
- package/dist/components/data-display/InteractionTag.cjs.map +1 -1
- package/dist/components/data-display/InteractionTag.mjs +36 -33
- package/dist/components/data-display/InteractionTag.mjs.map +1 -1
- package/dist/components/data-display/Persona.cjs +1 -1
- package/dist/components/data-display/Persona.cjs.map +1 -1
- package/dist/components/data-display/Persona.mjs +96 -37
- package/dist/components/data-display/Persona.mjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.cjs +1 -1
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.mjs +42 -28
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +111 -108
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +235 -235
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +176 -175
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +188 -187
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +41 -40
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +89 -87
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/TagPicker.root.cjs +1 -1
- package/dist/components/input/TagPicker.root.cjs.map +1 -1
- package/dist/components/input/TagPicker.root.mjs +136 -135
- package/dist/components/input/TagPicker.root.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +156 -154
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/layout/Card.cjs +1 -1
- package/dist/components/layout/Card.cjs.map +1 -1
- package/dist/components/layout/Card.context.cjs +2 -0
- package/dist/components/layout/Card.context.cjs.map +1 -0
- package/dist/components/layout/Card.context.mjs +14 -0
- package/dist/components/layout/Card.context.mjs.map +1 -0
- package/dist/components/layout/Card.mjs +138 -92
- package/dist/components/layout/Card.mjs.map +1 -1
- package/dist/components/layout/Card.preview.cjs +2 -0
- package/dist/components/layout/Card.preview.cjs.map +1 -0
- package/dist/components/layout/Card.preview.mjs +22 -0
- package/dist/components/layout/Card.preview.mjs.map +1 -0
- package/dist/components/layout/Carousel.button.cjs +2 -0
- package/dist/components/layout/Carousel.button.cjs.map +1 -0
- package/dist/components/layout/Carousel.button.mjs +34 -0
- package/dist/components/layout/Carousel.button.mjs.map +1 -0
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.context.cjs +2 -0
- package/dist/components/layout/Carousel.context.cjs.map +1 -0
- package/dist/components/layout/Carousel.context.mjs +24 -0
- package/dist/components/layout/Carousel.context.mjs.map +1 -0
- package/dist/components/layout/Carousel.drag.cjs +2 -0
- package/dist/components/layout/Carousel.drag.cjs.map +1 -0
- package/dist/components/layout/Carousel.drag.mjs +79 -0
- package/dist/components/layout/Carousel.drag.mjs.map +1 -0
- package/dist/components/layout/Carousel.groups.cjs +2 -0
- package/dist/components/layout/Carousel.groups.cjs.map +1 -0
- package/dist/components/layout/Carousel.groups.mjs +23 -0
- package/dist/components/layout/Carousel.groups.mjs.map +1 -0
- package/dist/components/layout/Carousel.mjs +288 -150
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/Carousel.styles.cjs +2 -0
- package/dist/components/layout/Carousel.styles.cjs.map +1 -0
- package/dist/components/layout/Carousel.styles.mjs +30 -0
- package/dist/components/layout/Carousel.styles.mjs.map +1 -0
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +163 -124
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +137 -127
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +4 -4
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +123 -123
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +12 -12
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +173 -162
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +96 -91
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +47 -47
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +5 -5
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +1 -1
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useFocusVisible.cjs +2 -0
- package/dist/hooks/useFocusVisible.cjs.map +1 -0
- package/dist/hooks/useFocusVisible.mjs +49 -0
- package/dist/hooks/useFocusVisible.mjs.map +1 -0
- package/dist/hooks/useFocusableGroup.cjs +2 -0
- package/dist/hooks/useFocusableGroup.cjs.map +1 -0
- package/dist/hooks/useFocusableGroup.mjs +70 -0
- package/dist/hooks/useFocusableGroup.mjs.map +1 -0
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +4 -4
- package/dist/hooks/useModalOpen.cjs +2 -0
- package/dist/hooks/useModalOpen.cjs.map +1 -0
- package/dist/hooks/useModalOpen.mjs +14 -0
- package/dist/hooks/useModalOpen.mjs.map +1 -0
- package/dist/hooks/usePopupPosition.cjs +1 -1
- package/dist/hooks/usePopupPosition.cjs.map +1 -1
- package/dist/hooks/usePopupPosition.mjs +82 -53
- package/dist/hooks/usePopupPosition.mjs.map +1 -1
- package/dist/hooks/useResolvedTarget.cjs +2 -0
- package/dist/hooks/useResolvedTarget.cjs.map +1 -0
- package/dist/hooks/useResolvedTarget.mjs +37 -0
- package/dist/hooks/useResolvedTarget.mjs.map +1 -0
- package/dist/hooks/useRovingGrid.cjs +1 -1
- package/dist/hooks/useRovingGrid.cjs.map +1 -1
- package/dist/hooks/useRovingGrid.mjs +8 -57
- package/dist/hooks/useRovingGrid.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +142 -107
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1364 -66
- package/dist/index.d.ts +1364 -66
- package/dist/index.mjs +132 -115
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +112 -92
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/initials.cjs +2 -0
- package/dist/lib/initials.cjs.map +1 -0
- package/dist/lib/initials.mjs +21 -0
- package/dist/lib/initials.mjs.map +1 -0
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +112 -109
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +102 -0
package/dist/index.d.ts
CHANGED
|
@@ -306,7 +306,7 @@ export declare type Appearance = 'primary' | 'outline' | 'subtle' | 'transparent
|
|
|
306
306
|
* <Avatar name="Jane Doe" src="/jane.jpg" badge={<PresenceBadge status="available" />} />
|
|
307
307
|
*/
|
|
308
308
|
export declare const Avatar: {
|
|
309
|
-
({ src, name, size: sizeProp, icon, image, badge, decorative, className, ref, role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-description": ariaDescription, "aria-details": ariaDetails, ...rest }: AvatarProps): React_2.JSX.Element;
|
|
309
|
+
({ src, name, size: sizeProp, shape: shapeProp, color: colorProp, idForColor, active, activeAppearance, initials: initialsSlot, icon, image, badge, decorative, className, ref, role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-description": ariaDescription, "aria-details": ariaDetails, ...rest }: AvatarProps): React_2.JSX.Element;
|
|
310
310
|
displayName: string;
|
|
311
311
|
};
|
|
312
312
|
|
|
@@ -325,30 +325,48 @@ export declare const avatarClassNames: {
|
|
|
325
325
|
readonly badge: "wave-avatar__badge";
|
|
326
326
|
};
|
|
327
327
|
|
|
328
|
+
/** The color of an Avatar that shows initials: a look, `colorful` (hashed), or a named color. */
|
|
329
|
+
export declare type AvatarColor = 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;
|
|
330
|
+
|
|
328
331
|
/**
|
|
329
|
-
* A row of
|
|
332
|
+
* A row of avatars (`role="group"`; name it with `aria-label`), laid out as a `stack` (overlapping),
|
|
333
|
+
* `spread` or `pie` (`layout`). `size` reaches the members.
|
|
330
334
|
*
|
|
331
335
|
* With `max`, the avatars beyond the limit are replaced by an overflow `<button>` ("+3", named
|
|
332
|
-
* "3 more", see `overflowLabel`
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
336
|
+
* "3 more", see `overflowLabel`; `overflowIndicator="icon"` shows an icon, and a count above 99
|
|
337
|
+
* reads "99+"). It toggles a popup that lists the hidden members: an `AvatarGroup.Item` as a row
|
|
338
|
+
* with its avatar and name, an `Avatar` by its `aria-label` or `name` prop, text as it is. Other
|
|
339
|
+
* members, such as an `Avatar` inside a link or one labelled by `aria-labelledby`, are rendered as
|
|
340
|
+
* they are, and an `Avatar` or text with no accessible name is listed as `unnamedMemberLabel` with
|
|
341
|
+
* a development warning. Focus moves into the popup; Escape, a press outside or the button close
|
|
342
|
+
* it and focus returns to the button (`open`, `defaultOpen` and `onOpenChange(open, details)`
|
|
343
|
+
* control it). Tab and Shift+Tab move through the popup's own tab stops (links in rendered
|
|
338
344
|
* members); Tab from the last one closes the popup and moves on to the element after the button,
|
|
339
345
|
* Shift+Tab from the first one closes it and returns to the button. When the button is the last
|
|
340
346
|
* tab stop (of the page, or of the Wave layer the group is in, such as a dialog), Tab is left to
|
|
341
347
|
* the browser or the enclosing focus trap.
|
|
342
348
|
*
|
|
349
|
+
* To split the members yourself, render `AvatarGroup.Item`s and an `AvatarGroup.Popover` holding
|
|
350
|
+
* the overflow items (see `partitionAvatarGroupItems`).
|
|
351
|
+
*
|
|
343
352
|
* @example
|
|
344
353
|
* <AvatarGroup aria-label="Project team" max={3}>
|
|
345
|
-
* <
|
|
346
|
-
* <
|
|
354
|
+
* <AvatarGroup.Item name="Ada Lovelace" />
|
|
355
|
+
* <AvatarGroup.Item name="Alan Turing" />
|
|
347
356
|
* </AvatarGroup>
|
|
348
357
|
*/
|
|
349
358
|
export declare const AvatarGroup: {
|
|
350
|
-
({ max, size, overflowLabel, unnamedMemberLabel, className, children, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: AvatarGroupProps): React_2.JSX.Element;
|
|
359
|
+
({ max, size, layout, overflowIndicator, overflowLabel, unnamedMemberLabel, open, defaultOpen, onOpenChange, className, children, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: AvatarGroupProps): React_2.JSX.Element;
|
|
351
360
|
displayName: string;
|
|
361
|
+
} & {
|
|
362
|
+
Item: {
|
|
363
|
+
({ className, ...props }: AvatarGroupItemProps): React_2.JSX.Element;
|
|
364
|
+
displayName: string;
|
|
365
|
+
};
|
|
366
|
+
Popover: {
|
|
367
|
+
({ children, indicator, count, label: labelProp, unnamedMemberLabel, open: openProp, defaultOpen, onOpenChange, className, ref, }: AvatarGroupPopoverProps): React_2.JSX.Element;
|
|
368
|
+
displayName: string;
|
|
369
|
+
};
|
|
352
370
|
};
|
|
353
371
|
|
|
354
372
|
/**
|
|
@@ -360,24 +378,120 @@ export declare const avatarGroupClassNames: {
|
|
|
360
378
|
readonly root: "wave-avatar-group";
|
|
361
379
|
readonly item: "wave-avatar-group__item";
|
|
362
380
|
readonly overflowButton: "wave-avatar-group__overflow-button";
|
|
381
|
+
readonly pie: "wave-avatar-group__pie";
|
|
363
382
|
readonly surface: "wave-avatar-group__surface";
|
|
364
383
|
readonly list: "wave-avatar-group__list";
|
|
365
384
|
readonly listItem: "wave-avatar-group__list-item";
|
|
366
385
|
};
|
|
367
386
|
|
|
387
|
+
/**
|
|
388
|
+
* A member of an AvatarGroup. In the group it renders as an `Avatar`; in the overflow list of the
|
|
389
|
+
* popup it renders as a row with the avatar and the name. It takes the props of an `Avatar`.
|
|
390
|
+
*/
|
|
391
|
+
export declare const AvatarGroupItem: {
|
|
392
|
+
({ className, ...props }: AvatarGroupItemProps): React_2.JSX.Element;
|
|
393
|
+
displayName: string;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* AvatarGroup.Item: `root` on the avatar it renders in the group, and on the row (avatar and name)
|
|
398
|
+
* it renders in the overflow list; `name` on the name text of that row.
|
|
399
|
+
*/
|
|
400
|
+
export declare const avatarGroupItemClassNames: {
|
|
401
|
+
readonly root: "wave-avatar-group-item";
|
|
402
|
+
readonly name: "wave-avatar-group-item__name";
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
/** Properties for the AvatarGroup.Item sub-component: the props of an Avatar. */
|
|
406
|
+
export declare type AvatarGroupItemProps = AvatarProps;
|
|
407
|
+
|
|
408
|
+
/** The layouts of an AvatarGroup. */
|
|
409
|
+
export declare type AvatarGroupLayout = 'stack' | 'spread' | 'pie';
|
|
410
|
+
|
|
411
|
+
/** Why the popup of an AvatarGroup opens or closes: its trigger, or a dismissal. */
|
|
412
|
+
export declare type AvatarGroupOpenChangeDetails = OpenChangeDetails<DismissReason | 'trigger'>;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* The overflow of an AvatarGroup, written by hand: a "+N" button that opens a popup listing its
|
|
416
|
+
* children (`AvatarGroup.Item`s, `Avatar`s, text or other elements). Write it as a child of the
|
|
417
|
+
* group to replace the overflow that `max` makes; its `count`, `indicator`, `label`, `open` and
|
|
418
|
+
* `onOpenChange` take over what `max` would have derived. Tab leaves the popup from the button.
|
|
419
|
+
*/
|
|
420
|
+
export declare const AvatarGroupPopover: {
|
|
421
|
+
({ children, indicator, count, label: labelProp, unnamedMemberLabel, open: openProp, defaultOpen, onOpenChange, className, ref, }: AvatarGroupPopoverProps): React_2.JSX.Element;
|
|
422
|
+
displayName: string;
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
/** AvatarGroup.Popover: `root` on the overflow button (which also carries the group's button class). */
|
|
426
|
+
export declare const avatarGroupPopoverClassNames: {
|
|
427
|
+
readonly root: "wave-avatar-group-popover";
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
/** Properties for the AvatarGroup.Popover sub-component. */
|
|
431
|
+
export declare interface AvatarGroupPopoverProps {
|
|
432
|
+
/** The overflow members: `AvatarGroup.Item`s, `Avatar`s, text or other elements. */
|
|
433
|
+
children?: React_2.ReactNode;
|
|
434
|
+
/**
|
|
435
|
+
* What the overflow button shows: the number of hidden members (`+3`, capped at `99+`), or an
|
|
436
|
+
* icon.
|
|
437
|
+
* @default 'count'
|
|
438
|
+
*/
|
|
439
|
+
indicator?: 'count' | 'icon';
|
|
440
|
+
/** The number of hidden members. @default the number of `children` */
|
|
441
|
+
count?: number;
|
|
442
|
+
/**
|
|
443
|
+
* Accessible name of the overflow button and its popup. A function receives the number of hidden
|
|
444
|
+
* members.
|
|
445
|
+
* @default (count) => `${count} more`
|
|
446
|
+
*/
|
|
447
|
+
label?: string | ((count: number) => string);
|
|
448
|
+
/**
|
|
449
|
+
* Text listed in the overflow popup for a hidden member that has no accessible name.
|
|
450
|
+
* @default 'Unnamed member'
|
|
451
|
+
*/
|
|
452
|
+
unnamedMemberLabel?: string;
|
|
453
|
+
/** Whether the popup is open (controlled). */
|
|
454
|
+
open?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Whether the popup starts open (uncontrolled).
|
|
457
|
+
* @default false
|
|
458
|
+
*/
|
|
459
|
+
defaultOpen?: boolean;
|
|
460
|
+
/** Called when the popup asks to open or close, with the reason (`trigger`, `escape`, …). */
|
|
461
|
+
onOpenChange?: (open: boolean, details?: AvatarGroupOpenChangeDetails) => void;
|
|
462
|
+
/** Extra classes for the overflow button. */
|
|
463
|
+
className?: string;
|
|
464
|
+
/** Ref to the overflow `<button>`. */
|
|
465
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
466
|
+
}
|
|
467
|
+
|
|
368
468
|
/** Properties for the AvatarGroup component. */
|
|
369
469
|
export declare interface AvatarGroupProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
370
470
|
/**
|
|
371
471
|
* Maximum number of avatars to display. The others are replaced by an overflow button that
|
|
372
472
|
* lists their names. `0` or a negative value shows only the overflow button, a fraction is
|
|
373
473
|
* rounded down, and `NaN` shows every member (as without `max`). The members of a Fragment
|
|
374
|
-
* count one by one.
|
|
474
|
+
* count one by one. A `pie` shows at most three.
|
|
375
475
|
*/
|
|
376
476
|
max?: number;
|
|
377
|
-
/**
|
|
378
|
-
*
|
|
477
|
+
/**
|
|
478
|
+
* Size of the avatars. It reaches the members that set no `size` of their own, and the overflow
|
|
479
|
+
* button.
|
|
480
|
+
* @default 'medium' ('large' in a `pie`)
|
|
379
481
|
*/
|
|
380
|
-
size?:
|
|
482
|
+
size?: AvatarSize;
|
|
483
|
+
/**
|
|
484
|
+
* How the members are laid out: `stack` overlaps them, `spread` puts them side by side, `pie`
|
|
485
|
+
* draws up to three of them as the wedges of one circle (the group's name is then the only name).
|
|
486
|
+
* @default 'stack'
|
|
487
|
+
*/
|
|
488
|
+
layout?: AvatarGroupLayout;
|
|
489
|
+
/**
|
|
490
|
+
* What the overflow button shows: the number of hidden members (`+3`, capped at `99+`), or an
|
|
491
|
+
* icon.
|
|
492
|
+
* @default 'count'
|
|
493
|
+
*/
|
|
494
|
+
overflowIndicator?: 'count' | 'icon';
|
|
381
495
|
/**
|
|
382
496
|
* Accessible name of the overflow button (and its popup). A function receives the number of
|
|
383
497
|
* hidden members. Localise it here.
|
|
@@ -391,10 +505,31 @@ export declare interface AvatarGroupProps extends React_2.HTMLAttributes<HTMLDiv
|
|
|
391
505
|
* @default 'Unnamed member'
|
|
392
506
|
*/
|
|
393
507
|
unnamedMemberLabel?: string;
|
|
508
|
+
/** Whether the overflow popup is open (controlled). */
|
|
509
|
+
open?: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Whether the overflow popup starts open (uncontrolled).
|
|
512
|
+
* @default false
|
|
513
|
+
*/
|
|
514
|
+
defaultOpen?: boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Called when the overflow popup asks to open or close, with the reason: `trigger` (the button),
|
|
517
|
+
* `escape`, `outside-press` or `focus-outside`.
|
|
518
|
+
*/
|
|
519
|
+
onOpenChange?: (open: boolean, details?: AvatarGroupOpenChangeDetails) => void;
|
|
394
520
|
/** Ref to the root `<div>`. */
|
|
395
521
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
396
522
|
}
|
|
397
523
|
|
|
524
|
+
/** The named colors of an Avatar: the persona palette (`--wave-palette-<name>` tokens). */
|
|
525
|
+
export declare type AvatarNamedColor = 'red' | 'pumpkin' | 'gold' | 'forest' | 'teal' | 'blue' | 'navy' | 'lavender' | 'purple' | 'magenta' | 'brown' | 'steel';
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* The numeric sizes of an Avatar, in pixels (Fluent's 14 sizes). A literal union: Tailwind can only
|
|
529
|
+
* generate the classes of {@link avatarBoxClasses}.
|
|
530
|
+
*/
|
|
531
|
+
export declare type AvatarNumericSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;
|
|
532
|
+
|
|
398
533
|
/** Properties for the Avatar component. */
|
|
399
534
|
export declare interface AvatarProps extends React_2.HTMLAttributes<HTMLSpanElement> {
|
|
400
535
|
/**
|
|
@@ -409,11 +544,49 @@ export declare interface AvatarProps extends React_2.HTMLAttributes<HTMLSpanElem
|
|
|
409
544
|
*/
|
|
410
545
|
name?: string;
|
|
411
546
|
/**
|
|
412
|
-
* Size of the avatar
|
|
413
|
-
* the
|
|
547
|
+
* Size of the avatar: a named size (`extra-small` 24px to `extra-large` 56px) or a pixel size from
|
|
548
|
+
* 16 to 128. Without it, an Avatar in the `media` of a tag (Tag, InteractionTag) takes the tag's
|
|
549
|
+
* media box instead: 24, 20 or 16px by the tag's size.
|
|
414
550
|
* @default 'medium'
|
|
415
551
|
*/
|
|
416
|
-
size?:
|
|
552
|
+
size?: AvatarSize;
|
|
553
|
+
/**
|
|
554
|
+
* Shape of the avatar. Without it, an Avatar in the `media` of a rounded tag is square.
|
|
555
|
+
* @default 'circular'
|
|
556
|
+
*/
|
|
557
|
+
shape?: 'circular' | 'square';
|
|
558
|
+
/**
|
|
559
|
+
* Color of the avatar when it shows initials: `brand` (the primary color), `neutral` (muted),
|
|
560
|
+
* `colorful` (one of the named colors, chosen from `idForColor`, else from `name`; `brand`
|
|
561
|
+
* without either) or a named color of the persona palette. An image, or an icon, keeps its own
|
|
562
|
+
* look.
|
|
563
|
+
* @default 'brand'
|
|
564
|
+
*/
|
|
565
|
+
color?: AvatarColor;
|
|
566
|
+
/**
|
|
567
|
+
* Whether the person is active: `active` draws the `activeAppearance` around the avatar, `inactive`
|
|
568
|
+
* dims it, `unset` shows neither.
|
|
569
|
+
* @default 'unset'
|
|
570
|
+
*/
|
|
571
|
+
active?: 'active' | 'inactive' | 'unset';
|
|
572
|
+
/**
|
|
573
|
+
* How an `active` avatar is marked: a `ring`, a `shadow`, both (`ring-shadow`) or a `glow` in the
|
|
574
|
+
* primary color.
|
|
575
|
+
* @default 'ring'
|
|
576
|
+
*/
|
|
577
|
+
activeAppearance?: 'ring' | 'ring-shadow' | 'shadow' | 'glow';
|
|
578
|
+
/**
|
|
579
|
+
* A stable id (a user id, say) that picks the color of `color="colorful"`, so the same person has
|
|
580
|
+
* the same color wherever they are shown, whatever their name looks like.
|
|
581
|
+
*/
|
|
582
|
+
idForColor?: string;
|
|
583
|
+
/**
|
|
584
|
+
* The initials shown when there is no image and no icon, instead of the ones computed from
|
|
585
|
+
* `name` (see `getInitials`): a string, an element or an object of `<span>` attributes. A value
|
|
586
|
+
* that renders nothing (`''`, `[]`) keeps the computed initials. Rendered in an `aria-hidden`
|
|
587
|
+
* `<span>`.
|
|
588
|
+
*/
|
|
589
|
+
initials?: Slot<'span'>;
|
|
417
590
|
/**
|
|
418
591
|
* Icon shown instead of the initials when there is no image. Rendered in an `aria-hidden`
|
|
419
592
|
* `<span>` (a slot object can override its attributes). A falsy value (`null`, `false`, `''`,
|
|
@@ -455,6 +628,9 @@ export declare interface AvatarProps extends React_2.HTMLAttributes<HTMLSpanElem
|
|
|
455
628
|
ref?: React_2.Ref<HTMLSpanElement>;
|
|
456
629
|
}
|
|
457
630
|
|
|
631
|
+
/** The size of an Avatar: a named size (24 to 56px) or one of the {@link AvatarNumericSize}s. */
|
|
632
|
+
export declare type AvatarSize = Size | AvatarNumericSize;
|
|
633
|
+
|
|
458
634
|
/** How a modal surface's backdrop paints the page: `dimmed`, or `transparent` (a modal over another). */
|
|
459
635
|
export declare type BackdropAppearance = 'dimmed' | 'transparent';
|
|
460
636
|
|
|
@@ -1071,7 +1247,8 @@ export declare interface CalendarValueChangeDetails {
|
|
|
1071
1247
|
}
|
|
1072
1248
|
|
|
1073
1249
|
/**
|
|
1074
|
-
* A surface that groups related content, with `Card.Header`, `Card.Body` and
|
|
1250
|
+
* A surface that groups related content, with `Card.Header`, `Card.Preview`, `Card.Body` and
|
|
1251
|
+
* `Card.Footer`.
|
|
1075
1252
|
*
|
|
1076
1253
|
* **Selectable cards** (`onSelect`) come in two patterns:
|
|
1077
1254
|
* - A card without interactive content is itself the control (`selectionControl="card"`, the
|
|
@@ -1088,7 +1265,7 @@ export declare interface CalendarValueChangeDetails {
|
|
|
1088
1265
|
* the selected look only; its state is not exposed to assistive technology.
|
|
1089
1266
|
*
|
|
1090
1267
|
* React Server Components cannot dot into a client module: import the flat names `CardHeader`,
|
|
1091
|
-
* `CardBody` and `CardFooter` there; `Card.Header` etc. work in client files.
|
|
1268
|
+
* `CardPreview`, `CardBody` and `CardFooter` there; `Card.Header` etc. work in client files.
|
|
1092
1269
|
*
|
|
1093
1270
|
* @example
|
|
1094
1271
|
* <Card onSelect={toggle} selected={selected}>
|
|
@@ -1102,10 +1279,14 @@ export declare interface CalendarValueChangeDetails {
|
|
|
1102
1279
|
*/
|
|
1103
1280
|
export declare const Card: PolymorphicComponent<"div", CardOwnProps> & {
|
|
1104
1281
|
Header: PolymorphicComponent<"div", CardHeaderOwnProps>;
|
|
1282
|
+
Preview: PolymorphicComponent<"div", CardPreviewOwnProps>;
|
|
1105
1283
|
Body: PolymorphicComponent<"div", CardBodyOwnProps>;
|
|
1106
1284
|
Footer: PolymorphicComponent<"div", CardFooterOwnProps>;
|
|
1107
1285
|
};
|
|
1108
1286
|
|
|
1287
|
+
/** The look of a Card: a filled surface with a shadow, a muted fill, an outline, or no surface. */
|
|
1288
|
+
export declare type CardAppearance = 'filled' | 'filled-alternative' | 'outline' | 'subtle';
|
|
1289
|
+
|
|
1109
1290
|
/**
|
|
1110
1291
|
* The main content of a {@link Card}. Flat export for React Server Components (`Card.Body` in
|
|
1111
1292
|
* client files).
|
|
@@ -1131,6 +1312,7 @@ export declare const cardClassNames: {
|
|
|
1131
1312
|
readonly root: "wave-card";
|
|
1132
1313
|
readonly checkbox: "wave-card__checkbox";
|
|
1133
1314
|
readonly checkmark: "wave-card__checkmark";
|
|
1315
|
+
readonly floatingAction: "wave-card__floating-action";
|
|
1134
1316
|
};
|
|
1135
1317
|
|
|
1136
1318
|
/**
|
|
@@ -1160,8 +1342,11 @@ export declare const CardHeader: PolymorphicComponent<'div', CardHeaderOwnProps>
|
|
|
1160
1342
|
/** Card.Header: `root` on the rendered element; `title` on the title; `subtitle` on the subtitle. */
|
|
1161
1343
|
export declare const cardHeaderClassNames: {
|
|
1162
1344
|
readonly root: "wave-card-header";
|
|
1345
|
+
readonly image: "wave-card-header__image";
|
|
1346
|
+
readonly text: "wave-card-header__text";
|
|
1163
1347
|
readonly title: "wave-card-header__title";
|
|
1164
1348
|
readonly subtitle: "wave-card-header__subtitle";
|
|
1349
|
+
readonly action: "wave-card-header__action";
|
|
1165
1350
|
};
|
|
1166
1351
|
|
|
1167
1352
|
/** The Card.Header's own props (component-specific props only). */
|
|
@@ -1174,6 +1359,16 @@ export declare interface CardHeaderOwnProps {
|
|
|
1174
1359
|
title?: React_2.ReactNode;
|
|
1175
1360
|
/** Subtitle content displayed below the title (none when it renders nothing, as `title`). */
|
|
1176
1361
|
subtitle?: React_2.ReactNode;
|
|
1362
|
+
/**
|
|
1363
|
+
* An image beside the text, at the start: an `Avatar`, an icon, a logo. A value that renders
|
|
1364
|
+
* nothing renders no element.
|
|
1365
|
+
*/
|
|
1366
|
+
image?: Slot<'span'>;
|
|
1367
|
+
/**
|
|
1368
|
+
* An action beside the text, at the end: a menu button, say. A value that renders nothing
|
|
1369
|
+
* renders no element.
|
|
1370
|
+
*/
|
|
1371
|
+
action?: Slot<'span'>;
|
|
1177
1372
|
}
|
|
1178
1373
|
|
|
1179
1374
|
/** Props of {@link CardHeader} rendered as `C` (default `'div'`), including `ref`. */
|
|
@@ -1184,6 +1379,25 @@ export declare type CardHeaderProps<C extends React_2.ElementType = 'div'> = Pol
|
|
|
1184
1379
|
* Every other prop comes from the rendered element (`as`).
|
|
1185
1380
|
*/
|
|
1186
1381
|
export declare interface CardOwnProps {
|
|
1382
|
+
/**
|
|
1383
|
+
* Look of the card: `filled` (a surface with a border and a shadow), `filled-alternative` (a
|
|
1384
|
+
* muted fill), `outline` (a border only) or `subtle` (no surface until hovered or selected). A
|
|
1385
|
+
* selectable card gets a hover and pressed look for its appearance; the selected look is the
|
|
1386
|
+
* same in every appearance.
|
|
1387
|
+
* @default 'filled'
|
|
1388
|
+
*/
|
|
1389
|
+
appearance?: CardAppearance;
|
|
1390
|
+
/**
|
|
1391
|
+
* Padding of the card's parts: `small` 0.75rem, `medium` 1rem, `large` 1.25rem.
|
|
1392
|
+
* @default 'medium'
|
|
1393
|
+
*/
|
|
1394
|
+
size?: CoreSize;
|
|
1395
|
+
/**
|
|
1396
|
+
* Layout of the card's parts: `vertical` stacks them, `horizontal` puts them in a row (put the
|
|
1397
|
+
* text parts in one wrapper element to keep them stacked beside a `Card.Preview`).
|
|
1398
|
+
* @default 'vertical'
|
|
1399
|
+
*/
|
|
1400
|
+
orientation?: Orientation;
|
|
1187
1401
|
/**
|
|
1188
1402
|
* Whether the card is selected. Shown with the selected colors plus non-color cues: a 2px primary
|
|
1189
1403
|
* border (a 1px border plus an inset 1px ring), a Highlight outline in forced-colors mode, and a
|
|
@@ -1225,8 +1439,54 @@ export declare interface CardOwnProps {
|
|
|
1225
1439
|
* `Card.Header` title, which the checkbox references with `aria-labelledby`.
|
|
1226
1440
|
*/
|
|
1227
1441
|
selectLabel?: string;
|
|
1442
|
+
/**
|
|
1443
|
+
* The built-in checkbox of `selectionControl="checkbox"`: an object of `<input>` attributes is
|
|
1444
|
+
* merged onto it (a class, `aria-describedby`, `name`; its type, checked state and change
|
|
1445
|
+
* handling stay the card's), an element replaces it (give that control its own name and call
|
|
1446
|
+
* `onSelect` from it), and `null` or `false` removes it, for a control you render elsewhere.
|
|
1447
|
+
* Ignored with the default `selectionControl`.
|
|
1448
|
+
*/
|
|
1449
|
+
checkbox?: Slot<'input'>;
|
|
1450
|
+
/**
|
|
1451
|
+
* An action over the top end corner of the card (a menu button, say). A card with one is
|
|
1452
|
+
* positioned; with `selectionControl="checkbox"` the built-in checkbox then moves to the top
|
|
1453
|
+
* start corner. Content that renders nothing renders no element.
|
|
1454
|
+
*/
|
|
1455
|
+
floatingAction?: Slot<'span'>;
|
|
1228
1456
|
}
|
|
1229
1457
|
|
|
1458
|
+
/**
|
|
1459
|
+
* Edge-to-edge media of a {@link Card} (an image, a video, a map), with an optional `logo` over its
|
|
1460
|
+
* bottom start corner. It has no padding: in a vertical card it fills the width, in a horizontal
|
|
1461
|
+
* one it is the full-height block at the start. Flat export for React Server Components
|
|
1462
|
+
* (`Card.Preview` in client files).
|
|
1463
|
+
*
|
|
1464
|
+
* @example
|
|
1465
|
+
* <Card>
|
|
1466
|
+
* <Card.Preview logo={<img alt="Contoso" src="/logo.svg" />}><img alt="" src="/cover.jpg" /></Card.Preview>
|
|
1467
|
+
* <Card.Header title="Contoso" />
|
|
1468
|
+
* </Card>
|
|
1469
|
+
*/
|
|
1470
|
+
export declare const CardPreview: PolymorphicComponent<'div', CardPreviewOwnProps>;
|
|
1471
|
+
|
|
1472
|
+
/** Card.Preview: `root` on the rendered element; `logo` on the logo over its bottom start corner. */
|
|
1473
|
+
export declare const cardPreviewClassNames: {
|
|
1474
|
+
readonly root: "wave-card-preview";
|
|
1475
|
+
readonly logo: "wave-card-preview__logo";
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
/** The Card.Preview's own props (component-specific props only). */
|
|
1479
|
+
export declare interface CardPreviewOwnProps {
|
|
1480
|
+
/**
|
|
1481
|
+
* A logo placed over the bottom start corner of the preview: a string, an element or an object
|
|
1482
|
+
* of `<span>` attributes. A value that renders nothing renders no element.
|
|
1483
|
+
*/
|
|
1484
|
+
logo?: Slot<'span'>;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/** Props of {@link CardPreview} rendered as `C` (default `'div'`), including `ref`. */
|
|
1488
|
+
export declare type CardPreviewProps<C extends React_2.ElementType = 'div'> = PolymorphicProps<C, CardPreviewOwnProps>;
|
|
1489
|
+
|
|
1230
1490
|
/**
|
|
1231
1491
|
* Props of {@link Card} rendered as `C` (default `'div'`). `CardProps` without a type argument is
|
|
1232
1492
|
* the 0.4 name: the props of a Card rendered as a `<div>`, including `ref`.
|
|
@@ -1261,19 +1521,32 @@ export declare type CardProps<C extends React_2.ElementType = 'div'> = Polymorph
|
|
|
1261
1521
|
* - The controls are layered over the slides inside the carousel's own stacking context, so they
|
|
1262
1522
|
* never paint over page headers that stay in view while the page scrolls.
|
|
1263
1523
|
*
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
1524
|
+
* - `groupSize` shows several slides per page, `draggable` lets the pointer drag them, and a
|
|
1525
|
+
* `thumbnail` on a `Carousel.Item` turns the picker into a row of thumbnails.
|
|
1526
|
+
* - `controlsLayout` places the Previous and Next buttons over the slides (`overlay`,
|
|
1527
|
+
* `overlay-wide`) or beside them (`inline`, `inline-wide`); `Carousel.Button` replaces the
|
|
1528
|
+
* built-in button of its `direction` with one of your own glyph.
|
|
1529
|
+
*
|
|
1530
|
+
* Compound access (`Carousel.Item`, `Carousel.Button`) needs a client module; React Server
|
|
1531
|
+
* Components import the flat names `CarouselItem` and `CarouselButton` instead.
|
|
1266
1532
|
*/
|
|
1267
1533
|
export declare const Carousel: {
|
|
1268
|
-
({ value: controlledValue, defaultValue, onValueChange, autoPlay, autoPlayInterval, autoPlayLabels, labels, loop, className, children, onMouseEnter, onMouseLeave, onFocus, onBlur, ref, ...rest }: CarouselProps): React_2.JSX.Element;
|
|
1534
|
+
({ value: controlledValue, defaultValue, onValueChange, autoPlay, autoPlayInterval, autoPlayLabels, labels, loop, groupSize, align, draggable, controlsLayout, appearance, className, children, onMouseEnter, onMouseLeave, onFocus, onBlur, ref, ...rest }: CarouselProps): React_2.JSX.Element;
|
|
1269
1535
|
displayName: string;
|
|
1270
1536
|
} & {
|
|
1271
1537
|
Item: {
|
|
1272
|
-
({ className, children, ref, ...rest }: CarouselItemProps): React_2.JSX.Element;
|
|
1538
|
+
({ thumbnail: _thumbnail, className, children, ref, ...rest }: CarouselItemProps): React_2.JSX.Element;
|
|
1539
|
+
displayName: string;
|
|
1540
|
+
};
|
|
1541
|
+
Button: {
|
|
1542
|
+
({ direction, onClick, className, children, ref, ...rest }: CarouselButtonProps): React_2.JSX.Element;
|
|
1273
1543
|
displayName: string;
|
|
1274
1544
|
};
|
|
1275
1545
|
};
|
|
1276
1546
|
|
|
1547
|
+
/** How a Carousel is drawn: `flat`, or `elevated` with rounded corners and a shadow. */
|
|
1548
|
+
export declare type CarouselAppearance = 'flat' | 'elevated';
|
|
1549
|
+
|
|
1277
1550
|
/** Accessible names of the rotation control shown while `autoPlay` is on. */
|
|
1278
1551
|
export declare interface CarouselAutoPlayLabels {
|
|
1279
1552
|
/** Name of the control while slides rotate (activating it stops the rotation).
|
|
@@ -1286,15 +1559,42 @@ export declare interface CarouselAutoPlayLabels {
|
|
|
1286
1559
|
play?: string;
|
|
1287
1560
|
}
|
|
1288
1561
|
|
|
1562
|
+
/**
|
|
1563
|
+
* A Previous or Next button written in a {@link Carousel}, for a glyph or look of your own.
|
|
1564
|
+
* Write it as a direct child of the Carousel: it replaces the built-in button of its
|
|
1565
|
+
* `direction`, takes its place in the layout and is named, disabled and wired to the slides the
|
|
1566
|
+
* same way (`labels.previous`/`labels.next`, `aria-controls`, `aria-disabled` at the ends
|
|
1567
|
+
* without `loop`, which keeps it focusable). Its children replace the chevron, which mirrors in
|
|
1568
|
+
* right-to-left layouts; `aria-label` replaces the name.
|
|
1569
|
+
*/
|
|
1570
|
+
export declare const CarouselButton: {
|
|
1571
|
+
({ direction, onClick, className, children, ref, ...rest }: CarouselButtonProps): React_2.JSX.Element;
|
|
1572
|
+
displayName: string;
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1575
|
+
/** Carousel.Button: `root` on the button element. */
|
|
1576
|
+
export declare const carouselButtonClassNames: {
|
|
1577
|
+
readonly root: "wave-carousel-button";
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
/** Properties for the CarouselButton sub-component. */
|
|
1581
|
+
export declare interface CarouselButtonProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
1582
|
+
/** Which way the button moves the carousel. */
|
|
1583
|
+
direction: 'previous' | 'next';
|
|
1584
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1289
1587
|
/**
|
|
1290
1588
|
* Carousel: `root` on the `role="region"` element; `autoPlayButton` on the pause and start
|
|
1291
|
-
* button; `
|
|
1589
|
+
* button; `viewport` on the clipping element around the track; `track` on the moving element
|
|
1590
|
+
* around the slides; `slide` on each slide wrapper;
|
|
1292
1591
|
* `previousButton` and `nextButton` on the arrow buttons; `picker` on the `role="group"` of
|
|
1293
1592
|
* picker buttons; `pickerButton` on each of them; `pickerIndicator` on each button's dot.
|
|
1294
1593
|
*/
|
|
1295
1594
|
export declare const carouselClassNames: {
|
|
1296
1595
|
readonly root: "wave-carousel";
|
|
1297
1596
|
readonly autoPlayButton: "wave-carousel__auto-play-button";
|
|
1597
|
+
readonly viewport: "wave-carousel__viewport";
|
|
1298
1598
|
readonly track: "wave-carousel__track";
|
|
1299
1599
|
readonly slide: "wave-carousel__slide";
|
|
1300
1600
|
readonly previousButton: "wave-carousel__previous-button";
|
|
@@ -1304,23 +1604,35 @@ export declare const carouselClassNames: {
|
|
|
1304
1604
|
readonly pickerIndicator: "wave-carousel__picker-indicator";
|
|
1305
1605
|
};
|
|
1306
1606
|
|
|
1607
|
+
/** Where a Carousel puts its Previous and Next buttons. */
|
|
1608
|
+
export declare type CarouselControlsLayout = 'overlay' | 'inline' | 'overlay-wide' | 'inline-wide';
|
|
1609
|
+
|
|
1307
1610
|
/**
|
|
1308
1611
|
* One slide of a {@link Carousel}. Write it in the Carousel, directly or in a Fragment: a component
|
|
1309
1612
|
* that renders `Carousel.Item` itself is not recognised as a slide (put that component inside the
|
|
1310
1613
|
* `Carousel.Item` instead).
|
|
1311
1614
|
*/
|
|
1312
1615
|
export declare const CarouselItem: {
|
|
1313
|
-
({ className, children, ref, ...rest }: CarouselItemProps): React_2.JSX.Element;
|
|
1616
|
+
({ thumbnail: _thumbnail, className, children, ref, ...rest }: CarouselItemProps): React_2.JSX.Element;
|
|
1314
1617
|
displayName: string;
|
|
1315
1618
|
};
|
|
1316
1619
|
|
|
1317
|
-
/** Carousel.Item: `root` on the item element. */
|
|
1620
|
+
/** Carousel.Item: `root` on the item element; `thumbnail` on the image in its picker button. */
|
|
1318
1621
|
export declare const carouselItemClassNames: {
|
|
1319
1622
|
readonly root: "wave-carousel-item";
|
|
1623
|
+
readonly thumbnail: "wave-carousel-item__thumbnail";
|
|
1320
1624
|
};
|
|
1321
1625
|
|
|
1322
1626
|
/** Properties for the CarouselItem sub-component. */
|
|
1323
1627
|
export declare interface CarouselItemProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
1628
|
+
/**
|
|
1629
|
+
* An image for this slide's button in the picker, in place of the dot. A string is the image
|
|
1630
|
+
* `src`; an object sets the `<img>`'s attributes. The button keeps its slide-label name, so the
|
|
1631
|
+
* image is decorative (`alt=""`). When any slide has one, the picker becomes a row of
|
|
1632
|
+
* thumbnails below the slides; a slide without one keeps its dot. With `groupSize` above 1, a
|
|
1633
|
+
* page shows the thumbnail of its first slide.
|
|
1634
|
+
*/
|
|
1635
|
+
thumbnail?: Slot<'img'>;
|
|
1324
1636
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
1325
1637
|
}
|
|
1326
1638
|
|
|
@@ -1350,6 +1662,13 @@ export declare interface CarouselLabels {
|
|
|
1350
1662
|
* @default (index, total) => `Slide ${index + 1} of ${total}`
|
|
1351
1663
|
*/
|
|
1352
1664
|
slide?: (index: number, total: number) => string;
|
|
1665
|
+
/**
|
|
1666
|
+
* Name of a page of several slides, from the one-based number of its first and last slide, out
|
|
1667
|
+
* of `total` slides (`groupSize` above 1). It names the page's picker button and is announced
|
|
1668
|
+
* by the live region when the page is shown. A page of one slide uses `slide`.
|
|
1669
|
+
* @default (start, end, total) => `Slides ${start} to ${end} of ${total}`
|
|
1670
|
+
*/
|
|
1671
|
+
slides?: (start: number, end: number, total: number) => string;
|
|
1353
1672
|
/** How assistive technology announces the carousel region (`aria-roledescription`).
|
|
1354
1673
|
* @default 'carousel'
|
|
1355
1674
|
*/
|
|
@@ -1362,14 +1681,57 @@ export declare interface CarouselLabels {
|
|
|
1362
1681
|
|
|
1363
1682
|
/** Properties for the Carousel component. */
|
|
1364
1683
|
export declare interface CarouselProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
1365
|
-
/**
|
|
1684
|
+
/**
|
|
1685
|
+
* Controlled index of the active slide: with `groupSize` above 1, the first slide of the shown
|
|
1686
|
+
* page. A value in the middle of a page shows that page and out-of-range values show the
|
|
1687
|
+
* nearest one.
|
|
1688
|
+
*/
|
|
1366
1689
|
value?: number;
|
|
1367
1690
|
/** Default active slide index for uncontrolled usage.
|
|
1368
1691
|
* @default 0
|
|
1369
1692
|
*/
|
|
1370
1693
|
defaultValue?: number;
|
|
1371
|
-
/**
|
|
1694
|
+
/**
|
|
1695
|
+
* Called with the new index when the active slide changes (not when it stays the same): the
|
|
1696
|
+
* first slide of the new page when `groupSize` is above 1.
|
|
1697
|
+
*/
|
|
1372
1698
|
onValueChange?: (index: number) => void;
|
|
1699
|
+
/**
|
|
1700
|
+
* How many slides one page shows: a number, or `'auto'` to show as many as fit the width of the
|
|
1701
|
+
* carousel (the slides keep their own width, which must be equal). Previous, Next, the picker
|
|
1702
|
+
* (one button per page), looping and autoplay move by page, and the slides of the shown page
|
|
1703
|
+
* form one arrow-key focus group. With `1` each slide fills the width, as before.
|
|
1704
|
+
* @default 1
|
|
1705
|
+
*/
|
|
1706
|
+
groupSize?: number | 'auto';
|
|
1707
|
+
/**
|
|
1708
|
+
* With `groupSize="auto"`, where the shown page sits when its slides do not fill the width.
|
|
1709
|
+
* @default 'start'
|
|
1710
|
+
*/
|
|
1711
|
+
align?: 'start' | 'center' | 'end';
|
|
1712
|
+
/**
|
|
1713
|
+
* Lets the pointer drag the slides (mouse, touch and pen). The track follows the pointer and,
|
|
1714
|
+
* on release, the page changes when the drag passed a quarter of the width or left fast, else
|
|
1715
|
+
* it snaps back; the direction follows the carousel's. The click that ends a drag is not
|
|
1716
|
+
* delivered to the slide, and a vertical swipe still scrolls the page. Dragging pauses
|
|
1717
|
+
* autoplay like the pointer over the carousel does. The buttons and the keyboard stay the way
|
|
1718
|
+
* to operate the carousel without a pointer.
|
|
1719
|
+
* @default false
|
|
1720
|
+
*/
|
|
1721
|
+
draggable?: boolean;
|
|
1722
|
+
/**
|
|
1723
|
+
* Where the Previous and Next buttons go. `overlay` floats round buttons over the slides;
|
|
1724
|
+
* `overlay-wide` makes them full-height strips at the edges; `inline` puts them in a row with
|
|
1725
|
+
* the slides, outside them; `inline-wide` is `inline` with full-height buttons. The rotation
|
|
1726
|
+
* control stays the first focusable element at the start corner in every layout.
|
|
1727
|
+
* @default 'overlay'
|
|
1728
|
+
*/
|
|
1729
|
+
controlsLayout?: CarouselControlsLayout;
|
|
1730
|
+
/**
|
|
1731
|
+
* `elevated` rounds the corners and adds a shadow.
|
|
1732
|
+
* @default 'flat'
|
|
1733
|
+
*/
|
|
1734
|
+
appearance?: CarouselAppearance;
|
|
1373
1735
|
/**
|
|
1374
1736
|
* Rotates the slides automatically. A Pause/Start control is rendered as the first focusable
|
|
1375
1737
|
* element. Rotation pauses while focus is anywhere inside the carousel (the control included;
|
|
@@ -2345,6 +2707,13 @@ export declare interface ComboboxProps<M extends boolean = false> extends Omit<R
|
|
|
2345
2707
|
* listbox keeps its size.
|
|
2346
2708
|
*/
|
|
2347
2709
|
size?: CoreSize;
|
|
2710
|
+
/**
|
|
2711
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
2712
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
2713
|
+
* room). The popup opens below the field.
|
|
2714
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
2715
|
+
*/
|
|
2716
|
+
positioning?: PopupPositioningOptions;
|
|
2348
2717
|
/**
|
|
2349
2718
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
2350
2719
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -3239,6 +3608,13 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
3239
3608
|
* calendar keeps its size.
|
|
3240
3609
|
*/
|
|
3241
3610
|
size?: CoreSize;
|
|
3611
|
+
/**
|
|
3612
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
3613
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
3614
|
+
* room). The popup opens below the field.
|
|
3615
|
+
* @default `{}`: the calendar opens 4px below the field
|
|
3616
|
+
*/
|
|
3617
|
+
positioning?: PopupPositioningOptions;
|
|
3242
3618
|
/**
|
|
3243
3619
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
3244
3620
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -3373,6 +3749,12 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
3373
3749
|
/** A day of the week, as `Date.prototype.getDay()` numbers them: 0 is Sunday, 6 is Saturday. */
|
|
3374
3750
|
export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3375
3751
|
|
|
3752
|
+
/**
|
|
3753
|
+
* The 0.5 spellings of two presence statuses. They still work and warn once in development; use
|
|
3754
|
+
* `'do-not-disturb'` and `'out-of-office'` instead. Removed in 1.0.
|
|
3755
|
+
*/
|
|
3756
|
+
export declare type DeprecatedPresenceStatus = 'dnd' | 'oof';
|
|
3757
|
+
|
|
3376
3758
|
/**
|
|
3377
3759
|
* A dialog (Fluent UI v2 style), modal by default: `Dialog` holds the open state; `Dialog.Trigger`
|
|
3378
3760
|
* opens and closes it and `Dialog.Content` renders the surface in a portal while open (and, with
|
|
@@ -3799,6 +4181,23 @@ export declare interface DialogTriggerRenderProps extends React_2.HTMLAttributes
|
|
|
3799
4181
|
ref: React_2.RefCallback<HTMLElement>;
|
|
3800
4182
|
}
|
|
3801
4183
|
|
|
4184
|
+
/** Returned by {@link useDismiss}. */
|
|
4185
|
+
export declare interface DismissLayer {
|
|
4186
|
+
/** The layer's id: pass it to `Portal layerId` or `DismissLayerProvider` around the surface. */
|
|
4187
|
+
layerId: string;
|
|
4188
|
+
/** Whether the layer is currently the topmost open layer (read at call time). */
|
|
4189
|
+
isTopmost(): boolean;
|
|
4190
|
+
}
|
|
4191
|
+
|
|
4192
|
+
/**
|
|
4193
|
+
* Makes `layerId` the parent layer of everything rendered inside (`Portal layerId` does this for
|
|
4194
|
+
* its children automatically).
|
|
4195
|
+
*/
|
|
4196
|
+
export declare function DismissLayerProvider(props: {
|
|
4197
|
+
layerId: string;
|
|
4198
|
+
children: React_2.ReactNode;
|
|
4199
|
+
}): React_2.ReactElement;
|
|
4200
|
+
|
|
3802
4201
|
/** Why a popup layer is dismissed: Escape, a press outside it, or focus moving outside it. */
|
|
3803
4202
|
export declare type DismissReason = 'escape' | 'outside-press' | 'focus-outside';
|
|
3804
4203
|
|
|
@@ -4697,6 +5096,13 @@ export declare interface DropdownProps<M extends boolean = false> extends Omit<R
|
|
|
4697
5096
|
* listbox keeps its size; the multi-select value text and clear button follow it.
|
|
4698
5097
|
*/
|
|
4699
5098
|
size?: CoreSize;
|
|
5099
|
+
/**
|
|
5100
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
5101
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
5102
|
+
* room). The popup opens below the field.
|
|
5103
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
5104
|
+
*/
|
|
5105
|
+
positioning?: PopupPositioningOptions;
|
|
4700
5106
|
/**
|
|
4701
5107
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
4702
5108
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -5190,12 +5596,86 @@ export declare interface FlexOwnProps {
|
|
|
5190
5596
|
*/
|
|
5191
5597
|
export declare type FlexProps<C extends React_2.ElementType = 'div'> = PolymorphicProps<C, FlexOwnProps>;
|
|
5192
5598
|
|
|
5599
|
+
/** Props to spread onto the group element (compose its handlers with your own). */
|
|
5600
|
+
export declare interface FocusableGroupProps {
|
|
5601
|
+
/** The group is itself focusable. */
|
|
5602
|
+
tabIndex: 0;
|
|
5603
|
+
onKeyDown: React_2.KeyboardEventHandler<HTMLElement>;
|
|
5604
|
+
onFocusCapture: React_2.FocusEventHandler<HTMLElement>;
|
|
5605
|
+
/** Marks the element as a group: nested groups own their own contents. */
|
|
5606
|
+
'data-focusable-group': '';
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5609
|
+
/** How Tab and Enter treat the elements inside a focusable group. */
|
|
5610
|
+
export declare type FocusableGroupTabBehavior = 'unlimited' | 'limited' | 'limited-trap-focus';
|
|
5611
|
+
|
|
5193
5612
|
/**
|
|
5194
5613
|
* How the keyboard reaches the items of a set: `'tab'`, every item is a Tab stop and the arrow
|
|
5195
5614
|
* keys do nothing; `'arrow'`, the set is one Tab stop and the arrow keys move between its items.
|
|
5196
5615
|
*/
|
|
5197
5616
|
export declare type FocusMode = 'tab' | 'arrow';
|
|
5198
5617
|
|
|
5618
|
+
/** Focus-visible ring for focusable controls (C-FOCUS). */
|
|
5619
|
+
export declare const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring";
|
|
5620
|
+
|
|
5621
|
+
/** Focus-visible ring drawn inside the element: cells, rows, list and menu items. */
|
|
5622
|
+
export declare const focusRingInset = "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
5623
|
+
|
|
5624
|
+
/** The first tabbable element inside `container`, or `null`. */
|
|
5625
|
+
export declare function getFirstTabbable(container: Element, options?: {
|
|
5626
|
+
includeContainer?: boolean;
|
|
5627
|
+
}): HTMLElement | null;
|
|
5628
|
+
|
|
5629
|
+
/**
|
|
5630
|
+
* The initials of a person's name, for an avatar: the first letter of the first and, with two or
|
|
5631
|
+
* more words, of the last word, upper-cased.
|
|
5632
|
+
*
|
|
5633
|
+
* Text in `()`, `[]`, `{}` and `<>` and all punctuation are ignored (`'Jane Doe (Contoso)'` gives
|
|
5634
|
+
* `'JD'`). A name with no letters (a phone number, an emoji) or with letters of a script without
|
|
5635
|
+
* letter initials (Han, Hiragana, Katakana, Hangul, Thai, Lao, Khmer, Myanmar, Tibetan) gives
|
|
5636
|
+
* `''`, so an avatar falls back to its person glyph. Server-safe.
|
|
5637
|
+
*
|
|
5638
|
+
* @example
|
|
5639
|
+
* getInitials('Jane Doe (Contoso)'); // 'JD'
|
|
5640
|
+
* getInitials('Jane Doe', { dir: 'rtl' }); // 'DJ'
|
|
5641
|
+
* getInitials('+1 (555) 010-0000'); // ''
|
|
5642
|
+
*/
|
|
5643
|
+
export declare function getInitials(name: string, options?: GetInitialsOptions): string;
|
|
5644
|
+
|
|
5645
|
+
/** Options of {@link getInitials}. */
|
|
5646
|
+
export declare interface GetInitialsOptions {
|
|
5647
|
+
/**
|
|
5648
|
+
* Text direction of the place the initials are shown. In `'rtl'` the first and last initial of a
|
|
5649
|
+
* left-to-right script swap, so they read in the order of the name on screen; a Hebrew or Arabic
|
|
5650
|
+
* name keeps its order, which the text direction already mirrors.
|
|
5651
|
+
* @default 'ltr'
|
|
5652
|
+
*/
|
|
5653
|
+
dir?: 'ltr' | 'rtl';
|
|
5654
|
+
/**
|
|
5655
|
+
* Keep only the first initial, also for a name of several words.
|
|
5656
|
+
* @default false
|
|
5657
|
+
*/
|
|
5658
|
+
firstInitialOnly?: boolean;
|
|
5659
|
+
}
|
|
5660
|
+
|
|
5661
|
+
/** The last tabbable element inside `container`, or `null`. */
|
|
5662
|
+
export declare function getLastTabbable(container: Element, options?: {
|
|
5663
|
+
includeContainer?: boolean;
|
|
5664
|
+
}): HTMLElement | null;
|
|
5665
|
+
|
|
5666
|
+
/**
|
|
5667
|
+
* The tabbable elements inside `container` in sequential focus order: positive `tabindex` first
|
|
5668
|
+
* (ascending), then `tabindex=0` / natively tabbable elements in document order. Named radio
|
|
5669
|
+
* groups follow {@link isTabbable}, so the result depends on where focus currently is: when focus
|
|
5670
|
+
* is on a radio, the rest of its group is left out, which makes the focused radio the last entry
|
|
5671
|
+
* when its group ends the container (the element a focus trap wraps from).
|
|
5672
|
+
*
|
|
5673
|
+
* @param options.includeContainer Also consider `container` itself.
|
|
5674
|
+
*/
|
|
5675
|
+
export declare function getTabbableElements(container: Element, options?: {
|
|
5676
|
+
includeContainer?: boolean;
|
|
5677
|
+
}): HTMLElement[];
|
|
5678
|
+
|
|
5199
5679
|
/**
|
|
5200
5680
|
* The classes that select a theme's tokens: `'wave-light'`, `'wave-dark dark'` or
|
|
5201
5681
|
* `'wave-high-contrast high-contrast'`. Unknown values fall back to the light classes. Safe to call
|
|
@@ -5246,6 +5726,13 @@ export declare const gridClassNames: {
|
|
|
5246
5726
|
readonly root: "wave-grid";
|
|
5247
5727
|
};
|
|
5248
5728
|
|
|
5729
|
+
/** Handlers {@link useGridNavigation} needs on the grid element (compose them with the consumer's). */
|
|
5730
|
+
export declare interface GridNavigationHandlers {
|
|
5731
|
+
onKeyDown: React_2.KeyboardEventHandler<HTMLTableElement>;
|
|
5732
|
+
onFocus: React_2.FocusEventHandler<HTMLTableElement>;
|
|
5733
|
+
onBlur: React_2.FocusEventHandler<HTMLTableElement>;
|
|
5734
|
+
}
|
|
5735
|
+
|
|
5249
5736
|
/**
|
|
5250
5737
|
* The Grid's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).
|
|
5251
5738
|
* Every other prop comes from the rendered element (`as`).
|
|
@@ -5339,6 +5826,13 @@ export declare interface HamburgerProps extends React_2.ButtonHTMLAttributes<HTM
|
|
|
5339
5826
|
ref?: React_2.Ref<HTMLButtonElement>;
|
|
5340
5827
|
}
|
|
5341
5828
|
|
|
5829
|
+
/**
|
|
5830
|
+
* Whether a modal surface is open now: a layer of kind `'modal'` (a Dialog, an overlay Drawer, an
|
|
5831
|
+
* alert, the DatePicker's calendar, or your own `useDismiss({ kind: 'modal' })`). A non-modal
|
|
5832
|
+
* surface is no modal. Server-safe: `false` when no layer is registered, as on the server.
|
|
5833
|
+
*/
|
|
5834
|
+
export declare function hasOpenModal(): boolean;
|
|
5835
|
+
|
|
5342
5836
|
/** Level of a heading element, `<h1>` … `<h6>`. */
|
|
5343
5837
|
export declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5344
5838
|
|
|
@@ -5732,6 +6226,20 @@ export declare interface InputErrorMessageProps extends React_2.HTMLAttributes<H
|
|
|
5732
6226
|
[dataAttribute: `data-${string}`]: unknown;
|
|
5733
6227
|
}
|
|
5734
6228
|
|
|
6229
|
+
/**
|
|
6230
|
+
* Focus indicator of text-entry controls: a 2px primary bottom border. `focus:outline-hidden`
|
|
6231
|
+
* removes the outline while focused but — unlike `outline-none` — keeps a visible outline in
|
|
6232
|
+
* forced-colors mode, where the border colour change is not perceivable. (Scoped to `:focus` so
|
|
6233
|
+
* unfocused inputs do not show that outline in forced colors.)
|
|
6234
|
+
*/
|
|
6235
|
+
export declare const inputFocus = "focus:outline-hidden focus:border-b-2 focus:border-b-primary";
|
|
6236
|
+
|
|
6237
|
+
/**
|
|
6238
|
+
* Wrapper form of {@link inputFocus} for inputs rendered inside a styled wrapper (slots,
|
|
6239
|
+
* SearchBox, TagPicker). Put `focus:outline-hidden` on the inner control.
|
|
6240
|
+
*/
|
|
6241
|
+
export declare const inputFocusWithin = "focus-within:border-b-2 focus-within:border-b-primary";
|
|
6242
|
+
|
|
5735
6243
|
/** Properties for the Input component. */
|
|
5736
6244
|
export declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
5737
6245
|
/**
|
|
@@ -6035,6 +6543,16 @@ export declare interface LabelProps extends React_2.LabelHTMLAttributes<HTMLLabe
|
|
|
6035
6543
|
ref?: React_2.Ref<HTMLLabelElement>;
|
|
6036
6544
|
}
|
|
6037
6545
|
|
|
6546
|
+
/**
|
|
6547
|
+
* What kind of surface a layer is. `modal` marks dialog-like surfaces (focus-restore validation and
|
|
6548
|
+
* modal isolation look for them); a modal blocks presses and Escape for the layers below it only
|
|
6549
|
+
* while its page isolation is active ({@link registerLayerIsolation}). `dialog` marks a non-modal
|
|
6550
|
+
* Dialog or Drawer: it shields nothing (no isolation), takes Escape only from inside its tree
|
|
6551
|
+
* (`escape: 'inside'`), and the Toaster moves out of its way; focus-restore validation and modal
|
|
6552
|
+
* isolation do not count it.
|
|
6553
|
+
*/
|
|
6554
|
+
export declare type LayerKind = 'modal' | 'dialog' | 'popover' | 'menu' | 'listbox' | 'tooltip' | 'toast';
|
|
6555
|
+
|
|
6038
6556
|
/**
|
|
6039
6557
|
* A hyperlink with Fluent link styling. Renders an `<a>` by default; `as` renders a router link
|
|
6040
6558
|
* (`<Link as={RouterLink} to="/">`) or a `<button>` styled as a link (`type="button"` by default).
|
|
@@ -6834,7 +7352,7 @@ export declare const Menu: {
|
|
|
6834
7352
|
displayName: string;
|
|
6835
7353
|
};
|
|
6836
7354
|
Popover: {
|
|
6837
|
-
({ side, align, offset, target, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): JSX.Element | null;
|
|
7355
|
+
({ side, align, offset, target: targetProp, positioning, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): JSX.Element | null;
|
|
6838
7356
|
displayName: string;
|
|
6839
7357
|
};
|
|
6840
7358
|
ItemCheckbox: {
|
|
@@ -7305,7 +7823,7 @@ export declare interface MenuItemSwitchProps extends MenuItemProps, MenuItemSele
|
|
|
7305
7823
|
* Also exported as `MenuPopover` (import the flat name from React Server Components).
|
|
7306
7824
|
*/
|
|
7307
7825
|
export declare const MenuPopover: {
|
|
7308
|
-
({ side, align, offset, target, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): React_2.JSX.Element | null;
|
|
7826
|
+
({ side, align, offset, target: targetProp, positioning, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): React_2.JSX.Element | null;
|
|
7309
7827
|
displayName: string;
|
|
7310
7828
|
};
|
|
7311
7829
|
|
|
@@ -7331,11 +7849,18 @@ export declare interface MenuPopoverProps extends Omit<React_2.HTMLAttributes<HT
|
|
|
7331
7849
|
* with a `target` needs no trigger; name it with `aria-label`, and give a toggle button you use
|
|
7332
7850
|
* as the target `aria-haspopup="menu"` and `aria-expanded` yourself (the menu's `id` is
|
|
7333
7851
|
* generated, so the toggle cannot point `aria-controls` at it). A press on a target element
|
|
7334
|
-
* does not close the menu. Hold the element in state
|
|
7335
|
-
*
|
|
7852
|
+
* does not close the menu. Hold the element in state, or pass a ref object (read after
|
|
7853
|
+
* each render of the menu). A menu opened by `openOnContext` is placed at
|
|
7336
7854
|
* the gesture instead.
|
|
7337
7855
|
*/
|
|
7338
|
-
target?:
|
|
7856
|
+
target?: PopupTargetInput;
|
|
7857
|
+
/**
|
|
7858
|
+
* Advanced positioning (Fluent's `positioning`): `offset`, `fitViewport`, `matchReferenceWidth`,
|
|
7859
|
+
* `fallbackPlacements` and `target` (used when the `target` prop is not set). `side` and `align`
|
|
7860
|
+
* stay separate props, and the `offset` prop wins over `positioning.offset`.
|
|
7861
|
+
* @default `{ fitViewport: true }`
|
|
7862
|
+
*/
|
|
7863
|
+
positioning?: PopupPositioning;
|
|
7339
7864
|
/** Menu items and dividers. */
|
|
7340
7865
|
children: React_2.ReactNode;
|
|
7341
7866
|
/**
|
|
@@ -7798,6 +8323,22 @@ export declare interface MessageBarTitleProps extends React_2.HTMLAttributes<HTM
|
|
|
7798
8323
|
ref?: React_2.Ref<HTMLSpanElement>;
|
|
7799
8324
|
}
|
|
7800
8325
|
|
|
8326
|
+
/**
|
|
8327
|
+
* Props that mark an app-owned region (a notification area, a live status bar) so that WaveUI's
|
|
8328
|
+
* modal surfaces leave it usable. Spread them on the region's element: `<div {...modalAllowProps}>`.
|
|
8329
|
+
* Over an open Dialog or Drawer the region
|
|
8330
|
+
*
|
|
8331
|
+
* - counts as inside every dismiss layer, so a press in it closes nothing;
|
|
8332
|
+
* - has its tabbable elements in the Tab cycle of every focus trap;
|
|
8333
|
+
* - is never made `inert` by the modal's page isolation.
|
|
8334
|
+
*
|
|
8335
|
+
* The attribute it sets, `data-wave-focus-trap-allow`, is the one the Toaster's own region
|
|
8336
|
+
* carries, and it is a stable contract.
|
|
8337
|
+
*/
|
|
8338
|
+
export declare const modalAllowProps: {
|
|
8339
|
+
readonly 'data-wave-focus-trap-allow': "";
|
|
8340
|
+
};
|
|
8341
|
+
|
|
7801
8342
|
/**
|
|
7802
8343
|
* Why a Dialog or Drawer asks to open or close: `trigger` (its Trigger part), `close` (a
|
|
7803
8344
|
* `.Close` part), `close-button` (the built-in Close button), `escape`, `outside-press` (the
|
|
@@ -9016,17 +9557,53 @@ export declare interface PaginationProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
9016
9557
|
}
|
|
9017
9558
|
|
|
9018
9559
|
/**
|
|
9019
|
-
*
|
|
9020
|
-
*
|
|
9560
|
+
* Splits the items of an AvatarGroup into the ones shown inline and the ones in the overflow list.
|
|
9561
|
+
* `AvatarGroup` uses it for `max`; use it yourself to render `AvatarGroup.Item`s and
|
|
9562
|
+
* `AvatarGroup.Popover` from your own list. Server-safe: it imports nothing.
|
|
9563
|
+
*
|
|
9564
|
+
* @example
|
|
9565
|
+
* const { inlineItems, overflowItems } = partitionAvatarGroupItems({ items: people, maxInlineItems: 4 });
|
|
9566
|
+
*/
|
|
9567
|
+
export declare function partitionAvatarGroupItems<T>({ items, maxInlineItems, layout, }: PartitionAvatarGroupItemsOptions<T>): PartitionAvatarGroupItemsResult<T>;
|
|
9568
|
+
|
|
9569
|
+
/** Options of {@link partitionAvatarGroupItems}. */
|
|
9570
|
+
export declare interface PartitionAvatarGroupItemsOptions<T> {
|
|
9571
|
+
/** All the items of the group. */
|
|
9572
|
+
items: readonly T[];
|
|
9573
|
+
/**
|
|
9574
|
+
* How many items are shown inline; the rest go to the overflow. A fraction is rounded down, `0`
|
|
9575
|
+
* or a negative value shows none, and `undefined` or `NaN` shows all (up to the layout's cap).
|
|
9576
|
+
*/
|
|
9577
|
+
maxInlineItems?: number;
|
|
9578
|
+
/**
|
|
9579
|
+
* The layout of the group. A `pie` shows at most three items inline.
|
|
9580
|
+
* @default 'stack'
|
|
9581
|
+
*/
|
|
9582
|
+
layout?: AvatarGroupLayout;
|
|
9583
|
+
}
|
|
9584
|
+
|
|
9585
|
+
/** Result of {@link partitionAvatarGroupItems}. */
|
|
9586
|
+
export declare interface PartitionAvatarGroupItemsResult<T> {
|
|
9587
|
+
/** The items shown inline, in order. */
|
|
9588
|
+
inlineItems: T[];
|
|
9589
|
+
/** The items in the overflow list, in order; `undefined` when nothing overflows. */
|
|
9590
|
+
overflowItems: T[] | undefined;
|
|
9591
|
+
}
|
|
9592
|
+
|
|
9593
|
+
/**
|
|
9594
|
+
* A person's avatar next to their name and up to three more text lines (job title, location,
|
|
9595
|
+
* status), with an optional presence badge. The text can sit after, before or below the avatar
|
|
9596
|
+
* (`textPosition`), `presenceOnly` swaps the avatar for the presence badge, and the text scales with
|
|
9597
|
+
* `size` up to `huge`.
|
|
9021
9598
|
*
|
|
9022
9599
|
* The built-in avatar is decorative (`<Avatar decorative>`): the visible name is announced once,
|
|
9023
9600
|
* not a second time as the avatar's image name. The presence badge stays exposed as a named image.
|
|
9024
9601
|
*
|
|
9025
9602
|
* @example
|
|
9026
|
-
* <Persona name="Jane Doe" secondaryText="Designer" status="available" />
|
|
9603
|
+
* <Persona name="Jane Doe" secondaryText="Designer" tertiaryText="Oslo" status="available" />
|
|
9027
9604
|
*/
|
|
9028
9605
|
export declare const Persona: {
|
|
9029
|
-
({ name, secondaryText, src, size, status, avatar, badge, className, ref, ...props }: PersonaProps): React_2.JSX.Element;
|
|
9606
|
+
({ name, primaryText, secondaryText, tertiaryText, quaternaryText, textPosition, textAlignment, presenceOnly, src, size, status, avatar, badge, className, ref, ...props }: PersonaProps): React_2.JSX.Element;
|
|
9030
9607
|
displayName: string;
|
|
9031
9608
|
};
|
|
9032
9609
|
|
|
@@ -9041,20 +9618,52 @@ export declare const personaClassNames: {
|
|
|
9041
9618
|
readonly badge: "wave-persona__badge";
|
|
9042
9619
|
readonly primaryText: "wave-persona__primary-text";
|
|
9043
9620
|
readonly secondaryText: "wave-persona__secondary-text";
|
|
9621
|
+
readonly tertiaryText: "wave-persona__tertiary-text";
|
|
9622
|
+
readonly quaternaryText: "wave-persona__quaternary-text";
|
|
9044
9623
|
};
|
|
9045
9624
|
|
|
9046
9625
|
/** Properties for the Persona component. */
|
|
9047
9626
|
export declare interface PersonaProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
9048
|
-
/**
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9627
|
+
/**
|
|
9628
|
+
* Display name of the person. It gives the avatar its initials and the first text line its text
|
|
9629
|
+
* (unless `primaryText` is given). A persona with neither `name` nor `primaryText` warns in
|
|
9630
|
+
* development.
|
|
9631
|
+
*/
|
|
9632
|
+
name?: string;
|
|
9633
|
+
/**
|
|
9634
|
+
* The first text line (the name). A string, an element or an object of `<span>` attributes.
|
|
9635
|
+
* @default the `name`
|
|
9636
|
+
*/
|
|
9637
|
+
primaryText?: Slot<'span'>;
|
|
9638
|
+
/** The second text line, such as a job title or email. */
|
|
9639
|
+
secondaryText?: Slot<'span'>;
|
|
9640
|
+
/** The third text line, such as a location. */
|
|
9641
|
+
tertiaryText?: Slot<'span'>;
|
|
9642
|
+
/** The fourth text line, such as a status message. */
|
|
9643
|
+
quaternaryText?: Slot<'span'>;
|
|
9644
|
+
/**
|
|
9645
|
+
* Where the text sits relative to the avatar, in reading order: after it, before it, or below it.
|
|
9646
|
+
* @default 'after'
|
|
9647
|
+
*/
|
|
9648
|
+
textPosition?: 'after' | 'before' | 'below';
|
|
9649
|
+
/**
|
|
9650
|
+
* How the text lines align with each other.
|
|
9651
|
+
* @default 'start' ('center' when the text is below the avatar)
|
|
9652
|
+
*/
|
|
9653
|
+
textAlignment?: 'start' | 'center';
|
|
9654
|
+
/**
|
|
9655
|
+
* Shows only the presence badge (from `status` or `badge`) in place of the avatar. The text
|
|
9656
|
+
* stays.
|
|
9657
|
+
* @default false
|
|
9658
|
+
*/
|
|
9659
|
+
presenceOnly?: boolean;
|
|
9052
9660
|
/** URL of the person's avatar image. */
|
|
9053
9661
|
src?: string;
|
|
9054
|
-
/**
|
|
9662
|
+
/**
|
|
9663
|
+
* Size of the persona: its avatar and its text.
|
|
9055
9664
|
* @default 'medium'
|
|
9056
9665
|
*/
|
|
9057
|
-
size?:
|
|
9666
|
+
size?: PersonaSize;
|
|
9058
9667
|
/** Presence status shown as a badge on the avatar. Ignored when a `badge` is given. */
|
|
9059
9668
|
status?: PresenceStatus;
|
|
9060
9669
|
/**
|
|
@@ -9074,6 +9683,9 @@ export declare interface PersonaProps extends React_2.HTMLAttributes<HTMLDivElem
|
|
|
9074
9683
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
9075
9684
|
}
|
|
9076
9685
|
|
|
9686
|
+
/** The size of a Persona: the Avatar sizes, and `huge` (a 72px avatar). */
|
|
9687
|
+
export declare type PersonaSize = Size | 'huge';
|
|
9688
|
+
|
|
9077
9689
|
/** How urgently assistive technology should read a message. */
|
|
9078
9690
|
export declare type Politeness = 'polite' | 'assertive';
|
|
9079
9691
|
|
|
@@ -9159,7 +9771,7 @@ export declare type PolymorphicProps<C extends React_2.ElementType, OwnProps> =
|
|
|
9159
9771
|
* </Popover>
|
|
9160
9772
|
*/
|
|
9161
9773
|
export declare const Popover: {
|
|
9162
|
-
({ open: openProp, defaultOpen, onOpenChange, side, align, ignoreOutsideRefs, openOnHover, openDelay, closeDelay, openOnContext, target, children, }: PopoverProps): React_2.JSX.Element;
|
|
9774
|
+
({ open: openProp, defaultOpen, onOpenChange, side, align, ignoreOutsideRefs, openOnHover, openDelay, closeDelay, openOnContext, target: targetProp, positioning, children, }: PopoverProps): React_2.JSX.Element;
|
|
9163
9775
|
displayName: string;
|
|
9164
9776
|
} & {
|
|
9165
9777
|
Trigger: {
|
|
@@ -9316,10 +9928,18 @@ export declare interface PopoverProps {
|
|
|
9316
9928
|
* `aria-labelledby`, and give a toggle button you use as the target `aria-haspopup="dialog"`,
|
|
9317
9929
|
* `aria-expanded` and `aria-controls` yourself. A press on a target element does not close the
|
|
9318
9930
|
* popover, and Tab from it enters the content when there is no trigger. Hold the element in
|
|
9319
|
-
* state
|
|
9931
|
+
* state, or pass a ref object (read after each render of the popover, so an element that attaches without it rendering is noticed on its next render). A popover
|
|
9320
9932
|
* opened by `openOnContext` is placed at the gesture instead.
|
|
9321
9933
|
*/
|
|
9322
|
-
target?:
|
|
9934
|
+
target?: PopupTargetInput;
|
|
9935
|
+
/**
|
|
9936
|
+
* Advanced positioning (Fluent's `positioning`): `offset` (px from the anchor), `fitViewport`
|
|
9937
|
+
* (limit the content to the space the viewport leaves; Fluent's `autoSize`), `matchReferenceWidth`,
|
|
9938
|
+
* `fallbackPlacements` (tried in order when the requested side has no room) and `target` (used
|
|
9939
|
+
* when the `target` prop is not set). `side` and `align` stay separate props.
|
|
9940
|
+
* @default `{ offset: 8 }`
|
|
9941
|
+
*/
|
|
9942
|
+
positioning?: PopupPositioning;
|
|
9323
9943
|
/** `Popover.Trigger` and `Popover.Content`. */
|
|
9324
9944
|
children: React_2.ReactNode;
|
|
9325
9945
|
}
|
|
@@ -9404,6 +10024,39 @@ export declare interface PopoverTriggerProps extends Omit<React_2.HTMLAttributes
|
|
|
9404
10024
|
/** Alignment of a popup along the anchor's edge. */
|
|
9405
10025
|
export declare type PopupAlign = 'start' | 'center' | 'end';
|
|
9406
10026
|
|
|
10027
|
+
/** A placement for `PopupPositioning.fallbackPlacements`: a side, and optionally an alignment on it. */
|
|
10028
|
+
export declare interface PopupPlacement {
|
|
10029
|
+
/** Side of the anchor. `start` and `end` follow the writing direction. */
|
|
10030
|
+
side: PopupSide;
|
|
10031
|
+
/** Alignment along that side. @default the surface's own `align` */
|
|
10032
|
+
align?: PopupAlign;
|
|
10033
|
+
}
|
|
10034
|
+
|
|
10035
|
+
/**
|
|
10036
|
+
* The advanced positioning options of a popup (the `positioning` prop; Fluent's `positioning`).
|
|
10037
|
+
* `side` and `align` stay separate props of each component, so every option has one source.
|
|
10038
|
+
*/
|
|
10039
|
+
export declare interface PopupPositioning {
|
|
10040
|
+
/** Distance from the anchor in px. @default the component's own (Popover 8, Tooltip 8, TeachingPopover 12, listboxes 4) */
|
|
10041
|
+
offset?: number;
|
|
10042
|
+
/**
|
|
10043
|
+
* Limit the surface to the space the viewport leaves (Fluent's `autoSize`). Popover also scrolls
|
|
10044
|
+
* its content inside its border; the other surfaces only limit their size (their own lists and
|
|
10045
|
+
* grids scroll as they always did).
|
|
10046
|
+
* @default the component's own
|
|
10047
|
+
*/
|
|
10048
|
+
fitViewport?: boolean;
|
|
10049
|
+
/** Make the surface as wide as its anchor. @default the component's own */
|
|
10050
|
+
matchReferenceWidth?: boolean;
|
|
10051
|
+
/** Placements to try, in order, when the requested side has no room; replaces the opposite side. */
|
|
10052
|
+
fallbackPlacements?: readonly PopupPlacement[];
|
|
10053
|
+
/** Position against this instead of the trigger. */
|
|
10054
|
+
target?: PopupTargetInput;
|
|
10055
|
+
}
|
|
10056
|
+
|
|
10057
|
+
/** {@link PopupPositioning} without `target`: the options of a popup that has no `target` prop. */
|
|
10058
|
+
export declare type PopupPositioningOptions = Omit<PopupPositioning, 'target'>;
|
|
10059
|
+
|
|
9407
10060
|
/** A rectangle in viewport coordinates, as `getBoundingClientRect()` returns it (a `DOMRect` is one). */
|
|
9408
10061
|
export declare interface PopupRect {
|
|
9409
10062
|
x: number;
|
|
@@ -9423,12 +10076,20 @@ export declare interface PopupRect {
|
|
|
9423
10076
|
export declare type PopupSide = 'top' | 'bottom' | 'start' | 'end' | 'left' | 'right';
|
|
9424
10077
|
|
|
9425
10078
|
/**
|
|
9426
|
-
* Where a popup is placed instead of next to its trigger (`Menu.Popover
|
|
9427
|
-
* an element held in state, or a `VirtualElement`.
|
|
9428
|
-
*
|
|
10079
|
+
* Where a popup is placed instead of next to its trigger (`Menu.Popover`, `Popover` and
|
|
10080
|
+
* `TeachingPopover` `target`): an element held in state, or a `VirtualElement`. Those components
|
|
10081
|
+
* also take a ref object (`PopupPositioning['target']`).
|
|
9429
10082
|
*/
|
|
9430
10083
|
export declare type PopupTarget = HTMLElement | VirtualElement | null;
|
|
9431
10084
|
|
|
10085
|
+
/**
|
|
10086
|
+
* What a popup's `target` prop accepts: a {@link PopupTarget}, or a ref object (an element that
|
|
10087
|
+
* attaches without the popup rendering is read after each render of the popup).
|
|
10088
|
+
*/
|
|
10089
|
+
export declare type PopupTargetInput = PopupTarget | {
|
|
10090
|
+
readonly current: HTMLElement | null;
|
|
10091
|
+
};
|
|
10092
|
+
|
|
9432
10093
|
/**
|
|
9433
10094
|
* Renders its children into `document.body` (or the WaveProvider `portalContainer`), wrapped in a
|
|
9434
10095
|
* `<div class="wave-portal …">` that carries the provider's theme classes, direction and font, so
|
|
@@ -9485,6 +10146,16 @@ export declare interface PortalProps {
|
|
|
9485
10146
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
9486
10147
|
}
|
|
9487
10148
|
|
|
10149
|
+
/** What {@link UsePopupPositionOptions.onPositioned} receives. */
|
|
10150
|
+
export declare interface PositionedInfo {
|
|
10151
|
+
/** Final placement after flipping, e.g. `'top-start'`. */
|
|
10152
|
+
placement: string;
|
|
10153
|
+
/** Final physical side after flipping. */
|
|
10154
|
+
side: 'top' | 'bottom' | 'left' | 'right';
|
|
10155
|
+
/** Always `true`: the callback runs once a position exists. */
|
|
10156
|
+
isPositioned: boolean;
|
|
10157
|
+
}
|
|
10158
|
+
|
|
9488
10159
|
/**
|
|
9489
10160
|
* Shows and hides its child with CSS enter and exit motion: the child stays mounted while its exit
|
|
9490
10161
|
* motion runs, `inert` and marked `data-presence="exiting"`, and unmounts when it ends (at once
|
|
@@ -9537,9 +10208,10 @@ export declare interface PresenceAttributes {
|
|
|
9537
10208
|
*
|
|
9538
10209
|
* @example
|
|
9539
10210
|
* <PresenceBadge status="busy" />
|
|
10211
|
+
* <PresenceBadge status="do-not-disturb" />
|
|
9540
10212
|
*/
|
|
9541
10213
|
export declare const PresenceBadge: {
|
|
9542
|
-
({ status, size, className, ref, ...props }: PresenceBadgeProps): React_2.JSX.Element;
|
|
10214
|
+
({ status: statusProp, size: sizeProp, className, ref, ...props }: PresenceBadgeProps): React_2.JSX.Element;
|
|
9543
10215
|
displayName: string;
|
|
9544
10216
|
};
|
|
9545
10217
|
|
|
@@ -9551,9 +10223,14 @@ export declare const presenceBadgeClassNames: {
|
|
|
9551
10223
|
|
|
9552
10224
|
/** Properties for the PresenceBadge component. */
|
|
9553
10225
|
export declare interface PresenceBadgeProps extends React_2.HTMLAttributes<HTMLSpanElement> {
|
|
9554
|
-
/**
|
|
9555
|
-
|
|
9556
|
-
|
|
10226
|
+
/**
|
|
10227
|
+
* Presence status to display. `'dnd'` and `'oof'` are deprecated aliases of `'do-not-disturb'`
|
|
10228
|
+
* and `'out-of-office'`: they render the same and warn once in development (removed in 1.0).
|
|
10229
|
+
* @default 'available'
|
|
10230
|
+
*/
|
|
10231
|
+
status?: PresenceStatus;
|
|
10232
|
+
/**
|
|
10233
|
+
* Size of the presence indicator. In the `badge` slot of an Avatar it is sized from the avatar.
|
|
9557
10234
|
* @default 'medium'
|
|
9558
10235
|
*/
|
|
9559
10236
|
size?: Size;
|
|
@@ -9579,8 +10256,11 @@ export declare interface PresenceProps extends UsePresenceOptions {
|
|
|
9579
10256
|
children: React_2.ReactElement | ((presence: UsePresenceResult) => React_2.ReactNode);
|
|
9580
10257
|
}
|
|
9581
10258
|
|
|
9582
|
-
/**
|
|
9583
|
-
|
|
10259
|
+
/**
|
|
10260
|
+
* User presence status for Avatar and Persona components. `'dnd'` and `'oof'` are deprecated
|
|
10261
|
+
* aliases of `'do-not-disturb'` and `'out-of-office'` ({@link DeprecatedPresenceStatus}).
|
|
10262
|
+
*/
|
|
10263
|
+
export declare type PresenceStatus = 'available' | 'busy' | 'away' | 'offline' | 'do-not-disturb' | 'out-of-office' | DeprecatedPresenceStatus;
|
|
9584
10264
|
|
|
9585
10265
|
/**
|
|
9586
10266
|
* Shows the progress of a task, or that a task is running (indeterminate, `value` omitted).
|
|
@@ -11819,11 +12499,11 @@ export declare interface TableRowProps extends React_2.HTMLAttributes<HTMLTableR
|
|
|
11819
12499
|
* `TabListPanels`) for React Server Components, which cannot use the dotted form.
|
|
11820
12500
|
*/
|
|
11821
12501
|
export declare const TabList: {
|
|
11822
|
-
({ value: valueProp, defaultValue: defaultValueProp, onValueChange, orientation: orientationProp, selectTabOnFocus, selectedValue, defaultSelectedValue, onTabSelect, vertical, className, children, onKeyDown, onFocus, ref, ...rest }: TabListProps): React_2.JSX.Element;
|
|
12502
|
+
({ value: valueProp, defaultValue: defaultValueProp, onValueChange, orientation: orientationProp, appearance, size, selectTabOnFocus, selectedValue, defaultSelectedValue, onTabSelect, vertical, className, children, onKeyDown, onFocus, ref, ...rest }: TabListProps): React_2.JSX.Element;
|
|
11823
12503
|
displayName: string;
|
|
11824
12504
|
} & {
|
|
11825
12505
|
Tab: {
|
|
11826
|
-
({ value, id: idProp, className, children, onClick, ref, ...rest }: TabProps): React_2.JSX.Element;
|
|
12506
|
+
({ value, id: idProp, icon, className, children, onClick, ref, ...rest }: TabProps): React_2.JSX.Element;
|
|
11827
12507
|
displayName: string;
|
|
11828
12508
|
};
|
|
11829
12509
|
Panel: {
|
|
@@ -11836,6 +12516,9 @@ export declare const TabList: {
|
|
|
11836
12516
|
};
|
|
11837
12517
|
};
|
|
11838
12518
|
|
|
12519
|
+
/** The look of a TabList: an underline, subtle fills, or circular subtle or filled tabs. */
|
|
12520
|
+
export declare type TabListAppearance = 'transparent' | 'subtle' | 'subtle-circular' | 'filled-circular';
|
|
12521
|
+
|
|
11839
12522
|
/** TabList: `root` on the `role="tablist"` element. */
|
|
11840
12523
|
export declare const tabListClassNames: {
|
|
11841
12524
|
readonly root: "wave-tab-list";
|
|
@@ -11898,6 +12581,19 @@ export declare interface TabListProps extends Omit<React_2.HTMLAttributes<HTMLDi
|
|
|
11898
12581
|
* @default 'horizontal'
|
|
11899
12582
|
*/
|
|
11900
12583
|
orientation?: Orientation;
|
|
12584
|
+
/**
|
|
12585
|
+
* Look of the tabs: `transparent` underlines the selected tab, `subtle` and `subtle-circular`
|
|
12586
|
+
* fill it with a subtle color (square or fully rounded), `filled-circular` fills it with the
|
|
12587
|
+
* primary color. In forced colors the selected tab keeps a Highlight outline (or underline) in
|
|
12588
|
+
* every appearance.
|
|
12589
|
+
* @default 'transparent'
|
|
12590
|
+
*/
|
|
12591
|
+
appearance?: TabListAppearance;
|
|
12592
|
+
/**
|
|
12593
|
+
* Size of the tabs: their padding and type (`medium` is 14px text on 16 by 8px padding).
|
|
12594
|
+
* @default 'medium'
|
|
12595
|
+
*/
|
|
12596
|
+
size?: CoreSize;
|
|
11901
12597
|
/**
|
|
11902
12598
|
* Whether moving focus with the arrow keys, Home and End also selects the tab (automatic
|
|
11903
12599
|
* activation, as in 0.5). With `false`, the keys only move focus and Enter, Space or a click
|
|
@@ -11929,13 +12625,14 @@ export declare interface TabListProps extends Omit<React_2.HTMLAttributes<HTMLDi
|
|
|
11929
12625
|
* with its value is mounted.
|
|
11930
12626
|
*/
|
|
11931
12627
|
export declare const TabListTab: {
|
|
11932
|
-
({ value, id: idProp, className, children, onClick, ref, ...rest }: TabProps): React_2.JSX.Element;
|
|
12628
|
+
({ value, id: idProp, icon, className, children, onClick, ref, ...rest }: TabProps): React_2.JSX.Element;
|
|
11933
12629
|
displayName: string;
|
|
11934
12630
|
};
|
|
11935
12631
|
|
|
11936
12632
|
/** TabList.Tab: `root` on the `role="tab"` button. */
|
|
11937
12633
|
export declare const tabListTabClassNames: {
|
|
11938
12634
|
readonly root: "wave-tab-list-tab";
|
|
12635
|
+
readonly icon: "wave-tab-list-tab__icon";
|
|
11939
12636
|
};
|
|
11940
12637
|
|
|
11941
12638
|
/** Properties for the TabPanel sub-component. */
|
|
@@ -11956,6 +12653,11 @@ export declare interface TabPanelsProps extends React_2.HTMLAttributes<HTMLDivEl
|
|
|
11956
12653
|
export declare interface TabProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11957
12654
|
/** Unique value identifying this tab (and its panel). */
|
|
11958
12655
|
value: string;
|
|
12656
|
+
/**
|
|
12657
|
+
* An icon before the text, hidden from assistive technology. A tab with an icon and no text is
|
|
12658
|
+
* icon-only (a square hit area): name it with `aria-label`, or a development warning asks for it.
|
|
12659
|
+
*/
|
|
12660
|
+
icon?: Slot<'span'>;
|
|
11959
12661
|
/** Ref to the tab `<button>`. */
|
|
11960
12662
|
ref?: React_2.Ref<HTMLButtonElement>;
|
|
11961
12663
|
}
|
|
@@ -12839,6 +13541,13 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
12839
13541
|
* option list keeps its size.
|
|
12840
13542
|
*/
|
|
12841
13543
|
size?: TagPickerSize;
|
|
13544
|
+
/**
|
|
13545
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
13546
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
13547
|
+
* room). The popup opens below the field.
|
|
13548
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
13549
|
+
*/
|
|
13550
|
+
positioning?: PopupPositioningOptions;
|
|
12842
13551
|
/**
|
|
12843
13552
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
12844
13553
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -12974,7 +13683,9 @@ export declare type TagSize = Extract<Size, 'extra-small' | 'small' | 'medium'>;
|
|
|
12974
13683
|
* - With `target`, the popover is portaled and positioned next to that element with a beak (it
|
|
12975
13684
|
* inherits the surface colors); it stays hidden while the target is `null`, not positioned yet or
|
|
12976
13685
|
* no longer mounted (a ref target is read after each render of the popover; see `target`).
|
|
12977
|
-
* - With `target
|
|
13686
|
+
* - With a `VirtualElement` target there is no element to follow: the popover keeps the place of
|
|
13687
|
+
* its portal in the keyboard order.
|
|
13688
|
+
* - With an element or ref `target`, the keyboard order treats the popover as if it followed the target: Tab past
|
|
12978
13689
|
* its last button continues after the target, Shift+Tab from its first button (or from the
|
|
12979
13690
|
* popover itself) returns to the target (for a target outside the Tab order, to the last control
|
|
12980
13691
|
* inside it, else to the control before it), Tab from there enters the popover, and Shift+Tab
|
|
@@ -12986,7 +13697,7 @@ export declare type TagSize = Extract<Size, 'extra-small' | 'small' | 'medium'>;
|
|
|
12986
13697
|
* it.
|
|
12987
13698
|
*/
|
|
12988
13699
|
export declare const TeachingPopover: {
|
|
12989
|
-
({ steps, activeStep: activeStepProp, defaultActiveStep, currentStep, defaultCurrentStep, onStepChange, onDismiss, open: openProp, defaultOpen, onOpenChange, closeLabel, labels, target, side, align, className, style, onKeyDown, ref, ...rest }: TeachingPopoverProps): React_2.JSX.Element | null;
|
|
13700
|
+
({ steps, activeStep: activeStepProp, defaultActiveStep, currentStep, defaultCurrentStep, onStepChange, onDismiss, open: openProp, defaultOpen, onOpenChange, closeLabel, labels, target: targetProp, positioning, side, align, className, style, onKeyDown, ref, ...rest }: TeachingPopoverProps): React_2.JSX.Element | null;
|
|
12990
13701
|
displayName: string;
|
|
12991
13702
|
};
|
|
12992
13703
|
|
|
@@ -13071,7 +13782,8 @@ export declare interface TeachingPopoverProps extends React_2.HTMLAttributes<HTM
|
|
|
13071
13782
|
*/
|
|
13072
13783
|
labels?: TeachingPopoverLabels;
|
|
13073
13784
|
/**
|
|
13074
|
-
* The element the popover points at (a ref
|
|
13785
|
+
* The element the popover points at (a ref, the element, or a `VirtualElement`: a rectangle such as a
|
|
13786
|
+
* point; an inline object is fine). When given, the popover is
|
|
13075
13787
|
* rendered in a portal, positioned next to it with a beak, and flips or shifts to stay in view;
|
|
13076
13788
|
* without it (`undefined`) the popover renders inline where it is placed (0.4 behaviour).
|
|
13077
13789
|
* While the target is `null` or has not been positioned against yet (an element held in state
|
|
@@ -13092,7 +13804,7 @@ export declare interface TeachingPopoverProps extends React_2.HTMLAttributes<HTM
|
|
|
13092
13804
|
* attached hides the popover right after that commit. Pass the element held in state when the
|
|
13093
13805
|
* target can mount or unmount without the popover re-rendering.
|
|
13094
13806
|
*/
|
|
13095
|
-
target?: React_2.RefObject<HTMLElement | null> | HTMLElement | null;
|
|
13807
|
+
target?: React_2.RefObject<HTMLElement | null> | HTMLElement | VirtualElement | null;
|
|
13096
13808
|
/** Side of the `target` to open on; `start`/`end` follow the writing direction.
|
|
13097
13809
|
* @default 'bottom'
|
|
13098
13810
|
*/
|
|
@@ -13101,6 +13813,13 @@ export declare interface TeachingPopoverProps extends React_2.HTMLAttributes<HTM
|
|
|
13101
13813
|
* @default 'center'
|
|
13102
13814
|
*/
|
|
13103
13815
|
align?: PopupAlign;
|
|
13816
|
+
/**
|
|
13817
|
+
* Advanced positioning (Fluent's `positioning`): `offset`, `fitViewport`, `matchReferenceWidth`,
|
|
13818
|
+
* `fallbackPlacements` and `target` (used when the `target` prop is not set). `side` and `align`
|
|
13819
|
+
* stay separate props.
|
|
13820
|
+
* @default `{ offset: 12 }`
|
|
13821
|
+
*/
|
|
13822
|
+
positioning?: PopupPositioning;
|
|
13104
13823
|
/** Ref to the popover surface (`role="dialog"`). */
|
|
13105
13824
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
13106
13825
|
}
|
|
@@ -13390,6 +14109,13 @@ export declare interface TimePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
13390
14109
|
* list keeps its size.
|
|
13391
14110
|
*/
|
|
13392
14111
|
size?: CoreSize;
|
|
14112
|
+
/**
|
|
14113
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
14114
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
14115
|
+
* room). The popup opens below the field.
|
|
14116
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
14117
|
+
*/
|
|
14118
|
+
positioning?: PopupPositioningOptions;
|
|
13393
14119
|
/**
|
|
13394
14120
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
13395
14121
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -14319,7 +15045,7 @@ export declare interface ToolbarToggleButtonProps extends Omit<ToggleButtonProps
|
|
|
14319
15045
|
* </Menu>
|
|
14320
15046
|
*/
|
|
14321
15047
|
export declare const Tooltip: {
|
|
14322
|
-
({ content, appearance: appearanceProp, variant, openDelay: openDelayProp, closeDelay, delay, open: openProp, defaultOpen, onOpenChange, relationship, side, align, children, className, onMouseEnter, onMouseLeave, onFocus, onBlur, ref, ...rest }: TooltipProps): React_2.JSX.Element;
|
|
15048
|
+
({ content, appearance: appearanceProp, variant, openDelay: openDelayProp, closeDelay, delay, open: openProp, defaultOpen, onOpenChange, relationship, side, align, positioning, children, className, onMouseEnter, onMouseLeave, onFocus, onBlur, ref, ...rest }: TooltipProps): React_2.JSX.Element;
|
|
14323
15049
|
displayName: string;
|
|
14324
15050
|
};
|
|
14325
15051
|
|
|
@@ -14395,6 +15121,13 @@ export declare interface TooltipProps extends Omit<React_2.HTMLAttributes<HTMLSp
|
|
|
14395
15121
|
* @default 'center'
|
|
14396
15122
|
*/
|
|
14397
15123
|
align?: PopupAlign;
|
|
15124
|
+
/**
|
|
15125
|
+
* Advanced positioning (Fluent's `positioning`): `offset`, `fitViewport`, `matchReferenceWidth`
|
|
15126
|
+
* and `fallbackPlacements`. `side` and `align` stay separate props. The hover bridge across the
|
|
15127
|
+
* gap covers the default 8px, so a larger `offset` leaves a gap the pointer cannot cross.
|
|
15128
|
+
* @default `{ offset: 8 }`
|
|
15129
|
+
*/
|
|
15130
|
+
positioning?: PopupPositioningOptions;
|
|
14398
15131
|
/**
|
|
14399
15132
|
* A single element that triggers the tooltip on hover and focus: it receives the
|
|
14400
15133
|
* `aria-describedby`/`aria-labelledby`, plus any `id` and `aria-*` props given to the Tooltip
|
|
@@ -14817,6 +15550,82 @@ export declare function useAnnounce(): (message: string, politeness?: Politeness
|
|
|
14817
15550
|
*/
|
|
14818
15551
|
export declare function useControllable<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void): [value: T, setValue: SetValue<T>, isControlled: boolean];
|
|
14819
15552
|
|
|
15553
|
+
/**
|
|
15554
|
+
* Registers an open overlay surface as a **dismiss layer** in the shared layer stack and closes it
|
|
15555
|
+
* on Escape, outside presses and (optionally) focus leaving it — with correct nesting:
|
|
15556
|
+
*
|
|
15557
|
+
* - **Escape** (document `keydown`, bubble phase) is routed by focus location: the innermost layer
|
|
15558
|
+
* whose tree contains the event target or the focused element is the scope, and the topmost
|
|
15559
|
+
* escape-enabled layer of that scope's subtree handles it — so a tooltip or popover opened from
|
|
15560
|
+
* the focused dialog closes before the dialog, while an unrelated layer opened later does not
|
|
15561
|
+
* steal the key. With no escape-enabled layer there, an escape-enabled ancestor handles it; when
|
|
15562
|
+
* no layer contains the focus (or none of those takes Escape), the global topmost
|
|
15563
|
+
* escape-enabled one. Layers stacked below the topmost **isolating** modal (a Dialog/Drawer
|
|
15564
|
+
* whose `useModalIsolation` is active — its ancestors and older siblings) never take Escape, so
|
|
15565
|
+
* a modal that ignores Escape blocks it whether it is nested in a dialog or opened beside it.
|
|
15566
|
+
* A layer with `escape: 'inside'` (a non-modal Dialog or Drawer) takes Escape only while the
|
|
15567
|
+
* event target or the focused element is in its tree, so an Escape typed on the page leaves it
|
|
15568
|
+
* open and goes to the layers below it.
|
|
15569
|
+
* The handler calls `preventDefault()`. Events whose default is already prevented (an inner
|
|
15570
|
+
* widget consumed Escape) and IME composition events are ignored.
|
|
15571
|
+
* - **Outside press**: on `pointerdown` (capture) every open layer whose tree does not contain the
|
|
15572
|
+
* target is recorded; on the following `click` each recorded layer whose tree still does not
|
|
15573
|
+
* contain the click target is dismissed (children first). A drag from inside to outside never
|
|
15574
|
+
* dismisses, clicks inside nested portaled layers count as inside, a popup opened by the same
|
|
15575
|
+
* click survives, and an external toggle works. Layers stacked below the topmost isolating modal
|
|
15576
|
+
* are inert and never dismissed by presses on that modal or its backdrop; a `kind: 'modal'`
|
|
15577
|
+
* layer without isolation (the DatePicker calendar) shields nothing, so a page click closes it
|
|
15578
|
+
* and the layers around it. The pending press survives modifier keys (Shift/Ctrl+click) and
|
|
15579
|
+
* ends on Enter/Space, on `pointercancel`, or when no click follows a mouse `pointerup` in the
|
|
15580
|
+
* same task; touch and pen presses are kept until their click, which the browser dispatches
|
|
15581
|
+
* from a separate tap gesture.
|
|
15582
|
+
* - **Focus outside** (`focusOutside: true`): dismisses when focus moves outside the layer's tree.
|
|
15583
|
+
* That is decided in a microtask, once the current commit has run: an `autoFocus` field of a
|
|
15584
|
+
* popover, dialog or plain portal opened inside the layer gets focus before that surface's
|
|
15585
|
+
* portal and layer register, and keeps the layer open. Focus that is back inside the tree by
|
|
15586
|
+
* then keeps it open too.
|
|
15587
|
+
*
|
|
15588
|
+
* A layer's tree is its `refs`, the portal wrappers rendered inside it, its descendant layers and
|
|
15589
|
+
* the `[data-wave-focus-trap-allow]` regions (toasts). Parentage follows the React tree: wrap the surface in
|
|
15590
|
+
* `Portal layerId={layerId}` (or {@link DismissLayerProvider}) so layers opened inside it become
|
|
15591
|
+
* its children.
|
|
15592
|
+
*
|
|
15593
|
+
* @example
|
|
15594
|
+
* const { layerId } = useDismiss({ open, onDismiss: () => setOpen(false), refs: [surfaceRef, triggerRef], anchorRef: triggerRef });
|
|
15595
|
+
* return open && <Portal layerId={layerId}><div ref={surfaceRef}>…</div></Portal>;
|
|
15596
|
+
*/
|
|
15597
|
+
export declare function useDismiss(options: UseDismissOptions): DismissLayer;
|
|
15598
|
+
|
|
15599
|
+
/** Options of {@link useDismiss}. */
|
|
15600
|
+
export declare interface UseDismissOptions {
|
|
15601
|
+
/** Whether the layer is open; the layer is registered only while `true`. */
|
|
15602
|
+
open: boolean;
|
|
15603
|
+
/** Called when the layer should close (the component sets its `open` state to `false`). */
|
|
15604
|
+
onDismiss: (reason: DismissReason, event: Event) => void;
|
|
15605
|
+
/**
|
|
15606
|
+
* Elements that belong to the layer: the content surface, the trigger/anchor and any extra
|
|
15607
|
+
* targets that must not count as "outside" (read at event time).
|
|
15608
|
+
*/
|
|
15609
|
+
refs: ReadonlyArray<React_2.RefObject<HTMLElement | null>>;
|
|
15610
|
+
/** The trigger; focus traps leave a descendant layer through it (Tab → the element after it). */
|
|
15611
|
+
anchorRef?: React_2.RefObject<HTMLElement | null>;
|
|
15612
|
+
/** @default 'popover' */
|
|
15613
|
+
kind?: LayerKind;
|
|
15614
|
+
/**
|
|
15615
|
+
* Whether Escape dismisses the layer: always (`true`), never (`false`), or only while the key's
|
|
15616
|
+
* target or the focused element is in the layer's tree (`'inside'`).
|
|
15617
|
+
* @default true
|
|
15618
|
+
*/
|
|
15619
|
+
escape?: boolean | 'inside';
|
|
15620
|
+
/**
|
|
15621
|
+
* Whether a press outside the layer's tree dismisses it. A predicate receives the `pointerdown`
|
|
15622
|
+
* event; returning `false` ignores that press. @default true
|
|
15623
|
+
*/
|
|
15624
|
+
outsidePress?: boolean | ((event: PointerEvent | MouseEvent) => boolean);
|
|
15625
|
+
/** Whether focus moving outside the layer's tree dismisses it (listboxes). @default false */
|
|
15626
|
+
focusOutside?: boolean;
|
|
15627
|
+
}
|
|
15628
|
+
|
|
14820
15629
|
/**
|
|
14821
15630
|
* Returns a callback with a stable identity that always invokes the latest `fn` passed to the hook.
|
|
14822
15631
|
* Use it for handlers read by effects or passed to memoised children, so neither re-runs when the
|
|
@@ -14891,6 +15700,172 @@ export declare interface UseFieldControlOptions {
|
|
|
14891
15700
|
nativeRequired?: boolean;
|
|
14892
15701
|
}
|
|
14893
15702
|
|
|
15703
|
+
/**
|
|
15704
|
+
* A focusable group (Fluent's `useFocusableGroup`, tabster's groupper): one tab stop that holds
|
|
15705
|
+
* several focusable elements, so a long list of rich rows does not cost a Tab press per control.
|
|
15706
|
+
* With `tabBehavior: 'limited'` or `'limited-trap-focus'`, Tab skips the elements inside while focus
|
|
15707
|
+
* is on the group element itself, and Shift+Tab from outside lands on the group element instead of
|
|
15708
|
+
* its last element; Enter or F2 enters the group, and Escape leaves it. A group is entered while
|
|
15709
|
+
* focus is on an element inside it, however it got there (a click, a popup returning focus, a
|
|
15710
|
+
* script). No tabindex is rewritten: components with their own tab stops (Toolbar, TabList) work
|
|
15711
|
+
* inside a group. A key from a popup portaled out of the group, a key that belongs to a nested
|
|
15712
|
+
* group and a key an inner element already handled (`preventDefault()`, as an input consuming
|
|
15713
|
+
* Escape does) are left alone.
|
|
15714
|
+
*
|
|
15715
|
+
* @example
|
|
15716
|
+
* const { groupProps } = useFocusableGroup({ tabBehavior: 'limited' });
|
|
15717
|
+
* <li role="group" aria-label="Message" {...groupProps}>
|
|
15718
|
+
* <button>Reply</button> <button>Forward</button>
|
|
15719
|
+
* </li>
|
|
15720
|
+
*/
|
|
15721
|
+
export declare function useFocusableGroup(options?: UseFocusableGroupOptions): UseFocusableGroupResult;
|
|
15722
|
+
|
|
15723
|
+
/** Options of {@link useFocusableGroup}. */
|
|
15724
|
+
export declare interface UseFocusableGroupOptions {
|
|
15725
|
+
/**
|
|
15726
|
+
* How the group treats the elements inside it (Fluent's `tabBehavior`):
|
|
15727
|
+
*
|
|
15728
|
+
* - `'unlimited'`: the group is one more tab stop and the elements inside it stay reachable by
|
|
15729
|
+
* Tab; no key is intercepted.
|
|
15730
|
+
* - `'limited'`: the group is one tab stop, in both directions. Enter or F2 on it moves focus to
|
|
15731
|
+
* its first tabbable element, Tab and Shift+Tab then move between the elements inside, Tab
|
|
15732
|
+
* past the last one leaves the group, and Escape returns focus to the group.
|
|
15733
|
+
* - `'limited-trap-focus'`: as `'limited'`, but Tab past the last element wraps to the first and
|
|
15734
|
+
* Shift+Tab before the first wraps to the last, until Escape.
|
|
15735
|
+
*
|
|
15736
|
+
* @default 'unlimited'
|
|
15737
|
+
*/
|
|
15738
|
+
tabBehavior?: FocusableGroupTabBehavior;
|
|
15739
|
+
}
|
|
15740
|
+
|
|
15741
|
+
/** Result of {@link useFocusableGroup}. */
|
|
15742
|
+
export declare interface UseFocusableGroupResult {
|
|
15743
|
+
/** Spread onto the group element. */
|
|
15744
|
+
groupProps: FocusableGroupProps;
|
|
15745
|
+
}
|
|
15746
|
+
|
|
15747
|
+
/**
|
|
15748
|
+
* Keeps keyboard focus inside `container` while `enabled` (modal dialogs, drawers, the DatePicker
|
|
15749
|
+
* calendar). Element-based: pass the surface held in state via a callback ref, so the trap starts
|
|
15750
|
+
* when the element appears.
|
|
15751
|
+
*
|
|
15752
|
+
* - **Initial focus** runs synchronously in the commit in which the container appears (no
|
|
15753
|
+
* `requestAnimationFrame`), and does nothing when focus is already inside (an `autoFocus`
|
|
15754
|
+
* element wins).
|
|
15755
|
+
* - **Tab / Shift+Tab** are handled by a document bubble-phase `keydown` listener that ignores
|
|
15756
|
+
* events whose default is already prevented, so a React handler inside (a menu closing on Tab, a
|
|
15757
|
+
* grid) can take the key first. Focus wraps at the edges, and from the container itself or a
|
|
15758
|
+
* non-tabbable element it continues in document order. Tabbable elements are computed on every
|
|
15759
|
+
* keydown (content may change; radio-group stops depend on focus), never cached.
|
|
15760
|
+
* - Tabbables inside `[data-wave-focus-trap-allow]` regions (the Toaster viewport) join the cycle.
|
|
15761
|
+
* - **Descendant layers** (a popover or menu opened from inside, identified through `layerId`):
|
|
15762
|
+
* Tab moves natively inside them; leaving one moves focus to the element after its anchor
|
|
15763
|
+
* (Shift+Tab: the anchor itself). Inside a plain `<Portal>` rendered in the surface (no layer,
|
|
15764
|
+
* no anchor) Tab is native too; leaving it wraps to the first (Shift+Tab: last) element. A
|
|
15765
|
+
* layer's trigger (its anchor, or an element around it such as a tooltip's wrapper) belongs to
|
|
15766
|
+
* the region it sits in, so Tab from an open info button or a button showing its tooltip moves
|
|
15767
|
+
* on as from any other element of that portal or popover.
|
|
15768
|
+
* - Focus that lands outside (not in the container, an allowed region or a descendant layer)
|
|
15769
|
+
* returns to the last focused element inside, also when that outside element loses it again
|
|
15770
|
+
* (removed or blurred, leaving focus on `<body>`). That is decided in a microtask, once the
|
|
15771
|
+
* current commit has run: an `autoFocus` element of a surface opened above the trap (a nested or
|
|
15772
|
+
* stacked dialog, a popover opened from the surface) gets focus before that surface's layer and
|
|
15773
|
+
* trap exist, and keeps it. The layer's own `refs` (its trigger, outside the container) are
|
|
15774
|
+
* outside: opening from the focused trigger still moves focus in, and focus moving back onto
|
|
15775
|
+
* the trigger is returned. Focus pulled out again while it is being returned (another focus
|
|
15776
|
+
* trap on the page) is left there.
|
|
15777
|
+
* - Traps form a stack (shared through the global registry): only the topmost acts.
|
|
15778
|
+
*/
|
|
15779
|
+
export declare function useFocusTrap(container: HTMLElement | null, options: UseFocusTrapOptions): void;
|
|
15780
|
+
|
|
15781
|
+
/** Options of {@link useFocusTrap}. */
|
|
15782
|
+
export declare interface UseFocusTrapOptions {
|
|
15783
|
+
/** Whether the trap is active. */
|
|
15784
|
+
enabled: boolean;
|
|
15785
|
+
/**
|
|
15786
|
+
* The surface's dismiss layer; focus inside its descendant layers (portaled popovers opened from
|
|
15787
|
+
* inside) is allowed. The layer's own `refs` outside the container (its trigger) are not.
|
|
15788
|
+
*/
|
|
15789
|
+
layerId?: string;
|
|
15790
|
+
/**
|
|
15791
|
+
* What to focus when the trap starts, unless focus is already inside (an `autoFocus` element
|
|
15792
|
+
* wins). @default 'first' (the first tabbable element, else the container)
|
|
15793
|
+
*/
|
|
15794
|
+
initialFocus?: React_2.RefObject<HTMLElement | null> | 'first' | 'container' | (() => HTMLElement | null);
|
|
15795
|
+
/** Regions outside the container whose tabbables join the Tab cycle. @default '[data-wave-focus-trap-allow]' (the regions marked with `modalAllowProps`) */
|
|
15796
|
+
allowOutsideSelector?: string;
|
|
15797
|
+
}
|
|
15798
|
+
|
|
15799
|
+
/**
|
|
15800
|
+
* Whether the page is in keyboard-navigation mode: `true` after the last input was a key press
|
|
15801
|
+
* (any key but a lone modifier), `false` after a pointer or touch press and before any input. For
|
|
15802
|
+
* logic that needs the mode in script, such as showing a focus cue in a widget that draws its own;
|
|
15803
|
+
* plain focus rings should keep using the `focus-visible` variant. One set of document listeners
|
|
15804
|
+
* serves every caller and goes away with the last one. `false` on the server and during
|
|
15805
|
+
* hydration.
|
|
15806
|
+
*
|
|
15807
|
+
* @example
|
|
15808
|
+
* const keyboard = useFocusVisible();
|
|
15809
|
+
* return <div data-keyboard={keyboard ? '' : undefined}>…</div>;
|
|
15810
|
+
*/
|
|
15811
|
+
export declare function useFocusVisible(): boolean;
|
|
15812
|
+
|
|
15813
|
+
/**
|
|
15814
|
+
* Grid keyboard model of the APG Grid pattern for a `<table role="grid">` (DataGrid).
|
|
15815
|
+
*
|
|
15816
|
+
* - **One tab stop.** Exactly one cell of the grid is in the tab order (initially the first cell).
|
|
15817
|
+
* Its focus target is its only focusable widget when that widget is not a text-entry control
|
|
15818
|
+
* (a checkbox, a sort button, a link); otherwise — no widget, several widgets, a text-entry
|
|
15819
|
+
* control or a nested composite — the cell itself. An unchecked radio whose named group has a
|
|
15820
|
+
* checked radio is not a target either (browsers skip it in the Tab order), so its cell is.
|
|
15821
|
+
* Every other cell and every widget inside a cell gets `tabindex="-1"`. Rows are never focusable.
|
|
15822
|
+
* When a widget becomes the target of the focused cell (Space on the cell checks its radio), the
|
|
15823
|
+
* cell keeps focus and the tab stop (removing its `tabindex` would blur it) while its target stays
|
|
15824
|
+
* at `tabindex="-1"`; the target takes the tab stop once the cell is blurred.
|
|
15825
|
+
* - **Navigation mode** (focus on a cell or on its target widget): ArrowLeft/ArrowRight (the
|
|
15826
|
+
* previous/next cell of the row, mirrored in RTL), ArrowUp/ArrowDown, Home/End (first/last cell
|
|
15827
|
+
* of the row), Ctrl+Home/Ctrl+End (first cell of the grid / last cell of the last row) and
|
|
15828
|
+
* PageUp/PageDown ({@link UseGridNavigationOptions.pageSize} rows) move focus between cells.
|
|
15829
|
+
* ArrowUp/ArrowDown and PageUp/PageDown keep the visual column (`colSpan` and `rowSpan` counted,
|
|
15830
|
+
* so a grouped header works), clamped to a shorter row. Space and Enter on a target widget reach
|
|
15831
|
+
* the widget.
|
|
15832
|
+
* - **Interaction mode**: Enter or F2 on a cell that is its own target moves focus into its first
|
|
15833
|
+
* widget; clicking a widget that is not the cell's target (a text input) enters it too. The
|
|
15834
|
+
* grid keys are then ignored, so the arrow keys move the caret, and Tab moves between the cell's
|
|
15835
|
+
* widgets. Escape returns focus to the cell. Leaving the grid ends interaction mode.
|
|
15836
|
+
* - **Nested composites** (an element with `data-roving-container` or role toolbar, radiogroup,
|
|
15837
|
+
* listbox, grid, treegrid, tablist, menu, menubar or tree) count as one widget that uses the arrow
|
|
15838
|
+
* keys: its cell takes focus, and Enter/F2 enters the composite at its own tab stop. The grid never
|
|
15839
|
+
* writes `tabindex` on or inside a composite (the composite manages its own), so a composite
|
|
15840
|
+
* keeps its own Tab stop — the same documented limitation as `useRovingTabIndex`.
|
|
15841
|
+
*
|
|
15842
|
+
* Keys are ignored when the event's default was prevented (a widget that handled the key, a
|
|
15843
|
+
* consumer handler), or with Alt/Meta held. The tab indexes are written to the DOM (layout effect
|
|
15844
|
+
* plus a `MutationObserver`), so rows and widgets added later are covered without a re-render. Focus
|
|
15845
|
+
* moves re-sync only the cells involved, the observer only the cells that changed, and the grid's
|
|
15846
|
+
* own `tabindex` writes do not trigger a re-sync.
|
|
15847
|
+
*
|
|
15848
|
+
* Internal to the table package.
|
|
15849
|
+
*/
|
|
15850
|
+
export declare function useGridNavigation(options?: UseGridNavigationOptions): UseGridNavigationResult;
|
|
15851
|
+
|
|
15852
|
+
/** Options of {@link useGridNavigation}. */
|
|
15853
|
+
export declare interface UseGridNavigationOptions {
|
|
15854
|
+
/**
|
|
15855
|
+
* How many rows PageUp and PageDown move focus.
|
|
15856
|
+
* @default 10
|
|
15857
|
+
*/
|
|
15858
|
+
pageSize?: number;
|
|
15859
|
+
}
|
|
15860
|
+
|
|
15861
|
+
/** Result of {@link useGridNavigation}. */
|
|
15862
|
+
export declare interface UseGridNavigationResult {
|
|
15863
|
+
/** Callback ref for the `<table role="grid">` element. Stable identity. */
|
|
15864
|
+
gridRef: React_2.RefCallback<HTMLTableElement>;
|
|
15865
|
+
/** Keyboard and focus handlers for the grid element. Stable identities. */
|
|
15866
|
+
gridProps: GridNavigationHandlers;
|
|
15867
|
+
}
|
|
15868
|
+
|
|
14894
15869
|
/**
|
|
14895
15870
|
* Generates a stable, SSR-safe unique id, optionally with a prefix. Wraps React's `useId` so every
|
|
14896
15871
|
* component builds DOM ids the same way (C-IDS).
|
|
@@ -14906,6 +15881,26 @@ export declare interface UseFieldControlOptions {
|
|
|
14906
15881
|
*/
|
|
14907
15882
|
export declare function useId(prefix?: string): string;
|
|
14908
15883
|
|
|
15884
|
+
/**
|
|
15885
|
+
* The trap's initial focus without the trap (a non-modal Dialog or Drawer, which moves focus in
|
|
15886
|
+
* when it opens but does not keep it there): in the layout phase of the commit in which
|
|
15887
|
+
* `enabled && container` becomes true, does nothing when focus is already inside the container or
|
|
15888
|
+
* one of the layer's descendant layers (an `autoFocus` element wins), else focuses
|
|
15889
|
+
* `initialFocus` (default: the first tabbable element), else the container. `useFocusTrap` runs
|
|
15890
|
+
* the same code when it starts. It adds no listener.
|
|
15891
|
+
*/
|
|
15892
|
+
export declare function useInitialFocus(container: HTMLElement | null, options: UseInitialFocusOptions): void;
|
|
15893
|
+
|
|
15894
|
+
/** Options of {@link useInitialFocus}. */
|
|
15895
|
+
export declare interface UseInitialFocusOptions {
|
|
15896
|
+
/** Whether the surface is open: focus moves in when it becomes `true` with a container. */
|
|
15897
|
+
enabled: boolean;
|
|
15898
|
+
/** The surface's dismiss layer: focus already in one of its descendant layers stays there. */
|
|
15899
|
+
layerId?: string;
|
|
15900
|
+
/** What to focus first. @default 'first' (the first tabbable element, else the container) */
|
|
15901
|
+
initialFocus?: UseFocusTrapOptions['initialFocus'];
|
|
15902
|
+
}
|
|
15903
|
+
|
|
14909
15904
|
/**
|
|
14910
15905
|
* `false` on the server and during hydration, `true` in every other client render — including the
|
|
14911
15906
|
* first render of a component mounted on the client, so no second commit is needed.
|
|
@@ -15241,6 +16236,11 @@ export declare interface UseListboxPopupOptions {
|
|
|
15241
16236
|
* `setReference` too (merged into its ref), which places the surface against it.
|
|
15242
16237
|
*/
|
|
15243
16238
|
anchorRef: React_2.RefObject<HTMLElement | null>;
|
|
16239
|
+
/**
|
|
16240
|
+
* Advanced positioning: `offset`, `fitViewport`, `matchReferenceWidth` and `fallbackPlacements`.
|
|
16241
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
16242
|
+
*/
|
|
16243
|
+
positioning?: PopupPositioningOptions;
|
|
15244
16244
|
}
|
|
15245
16245
|
|
|
15246
16246
|
/**
|
|
@@ -15358,6 +16358,84 @@ export declare interface UseListboxResult {
|
|
|
15358
16358
|
*/
|
|
15359
16359
|
export declare function useMergedRefs<T>(...refs: Array<React_2.Ref<T> | undefined | null>): React_2.RefCallback<T>;
|
|
15360
16360
|
|
|
16361
|
+
/**
|
|
16362
|
+
* Everything a modal surface (Dialog, Drawer) needs, composed in the order that works:
|
|
16363
|
+
*
|
|
16364
|
+
* 1. `useDismiss({ kind: 'modal' })` — Escape and outside presses (the backdrop is outside the
|
|
16365
|
+
* content surface, so a click on it dismisses; a drag from the content does not).
|
|
16366
|
+
* 2. `useFocusTrap` — initial focus, Tab cycle incl. toasts and descendant layers.
|
|
16367
|
+
* 3. `useModalIsolation` — the rest of the page is `inert` (instead of `aria-modal`).
|
|
16368
|
+
* 4. `useScrollLock` — ref-counted page scroll lock.
|
|
16369
|
+
* 5. `useRestoreFocus` — the opener (or `triggerRef`/`finalFocusRef`) gets focus back.
|
|
16370
|
+
*
|
|
16371
|
+
* On close the trap is released before the isolation is lifted, and the isolation is lifted
|
|
16372
|
+
* before focus is restored (an inert opener cannot take focus). Wrap the surface in
|
|
16373
|
+
* `Portal layerId={layerId}` so layers opened inside the modal become its descendants.
|
|
16374
|
+
*
|
|
16375
|
+
* `modalType: 'alert'` composes the same with `outsidePress: false`. `modalType: 'non-modal'`
|
|
16376
|
+
* registers a `dialog` layer (Escape only from inside its tree, no outside press, no focus-outside
|
|
16377
|
+
* dismissal), keeps the trap, the isolation and the scroll lock off, moves focus in on open with
|
|
16378
|
+
* the trap's initial-focus rule (`useInitialFocus`) and restores focus only when it is inside the
|
|
16379
|
+
* surface (or in a layer opened from it) at close, or was lost to `<body>` from there. Every hook
|
|
16380
|
+
* is always called and keys on `open`: a `modalType` that changes while open applies at once (the
|
|
16381
|
+
* trap, isolation and lock follow). It leaves focus inside the surface where it is; focus outside
|
|
16382
|
+
* it moves in, as on open: a switch to `modal` or `alert` starts the trap (the page turns inert),
|
|
16383
|
+
* and a switch to `non-modal` runs the initial focus (focus in the toast region, which a trap lets
|
|
16384
|
+
* in, moves into the surface). The Tab order of a non-modal surface (its place after the opener)
|
|
16385
|
+
* is the component's.
|
|
16386
|
+
*
|
|
16387
|
+
* A surface that mounts through the presence core (Dialog, Drawer) passes its open state as
|
|
16388
|
+
* `open`, never its mount (`isMounted`), and its element as `container` also while it is mounted
|
|
16389
|
+
* closed: the layer, the trap, the isolation and the scroll lock end and focus is restored in the
|
|
16390
|
+
* commit that closes it, while the element still runs its exit motion (`inert`) or stays mounted
|
|
16391
|
+
* (`hidden`, with `unmountOnClose={false}`); the next open starts them again with the same
|
|
16392
|
+
* element.
|
|
16393
|
+
*/
|
|
16394
|
+
export declare function useModalLayer(options: UseModalLayerOptions): DismissLayer;
|
|
16395
|
+
|
|
16396
|
+
/**
|
|
16397
|
+
* Options of {@link useModalLayer}: `useDismiss` options (the kind follows `modalType`) plus focus.
|
|
16398
|
+
*/
|
|
16399
|
+
export declare interface UseModalLayerOptions extends Omit<UseDismissOptions, 'kind'> {
|
|
16400
|
+
/** The modal surface, held in state via a callback ref. */
|
|
16401
|
+
container: HTMLElement | null;
|
|
16402
|
+
/**
|
|
16403
|
+
* `modal` (default) and `alert` register a `modal` layer, trap focus, isolate the page, lock its
|
|
16404
|
+
* scroll and restore focus (an `alert` layer ignores outside presses); `non-modal` registers a
|
|
16405
|
+
* `dialog` layer (`escape: 'inside'`, no outside press, no focus-outside), traps, isolates and
|
|
16406
|
+
* locks nothing, moves focus in on open with the trap's initial-focus rule and restores focus only
|
|
16407
|
+
* from inside (`requireFocusInside`).
|
|
16408
|
+
* @default 'modal'
|
|
16409
|
+
*/
|
|
16410
|
+
modalType?: ModalType;
|
|
16411
|
+
/** What the focus trap (or a non-modal surface's initial focus) focuses first. @default 'first' */
|
|
16412
|
+
initialFocus?: UseFocusTrapOptions['initialFocus'];
|
|
16413
|
+
/** The trigger: preferred focus-restore target. */
|
|
16414
|
+
triggerRef?: React_2.RefObject<HTMLElement | null>;
|
|
16415
|
+
/** Consumer override for the focus-restore target. */
|
|
16416
|
+
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
16417
|
+
}
|
|
16418
|
+
|
|
16419
|
+
/**
|
|
16420
|
+
* Whether a modal surface is open (a Dialog, an overlay Drawer, an alert, the DatePicker's calendar, or your
|
|
16421
|
+
* own `useDismiss({ kind: 'modal' })` layer): `true` from the
|
|
16422
|
+
* commit that opens it to the commit that closes it, not until its exit motion ends. A non-modal
|
|
16423
|
+
* Dialog or Drawer, a Popover or a Menu is no modal. `false` on the server and during hydration.
|
|
16424
|
+
*
|
|
16425
|
+
* Use it to hold back app behavior the modal should own, such as global keyboard shortcuts, instead
|
|
16426
|
+
* of guessing from the page's `inert` attributes.
|
|
16427
|
+
*
|
|
16428
|
+
* @example
|
|
16429
|
+
* const modalOpen = useModalOpen();
|
|
16430
|
+
* useEffect(() => {
|
|
16431
|
+
* if (modalOpen) return;
|
|
16432
|
+
* const onKey = (event: KeyboardEvent) => { if (event.key === '/') focusSearch(); };
|
|
16433
|
+
* document.addEventListener('keydown', onKey);
|
|
16434
|
+
* return () => document.removeEventListener('keydown', onKey);
|
|
16435
|
+
* }, [modalOpen]);
|
|
16436
|
+
*/
|
|
16437
|
+
export declare function useModalOpen(): boolean;
|
|
16438
|
+
|
|
15361
16439
|
/**
|
|
15362
16440
|
* The items an {@link Overflow} currently hides: their `itemId`s in DOM order and their count. Use
|
|
15363
16441
|
* it in the component that `overflowButton` renders to list the hidden items in a menu. Must be
|
|
@@ -15373,6 +16451,117 @@ export declare interface UseOverflowMenuResult {
|
|
|
15373
16451
|
count: number;
|
|
15374
16452
|
}
|
|
15375
16453
|
|
|
16454
|
+
/**
|
|
16455
|
+
* Positions a popup surface next to its anchor with `@floating-ui/react-dom` (Tooltip, Popover,
|
|
16456
|
+
* Menu, listboxes, the DatePicker calendar, TeachingPopover): `offset`, `flip`, `shift`, optional
|
|
16457
|
+
* `size` (reference width / available space as CSS variables) and `arrow`. `flip`, `shift` and
|
|
16458
|
+
* `size` keep the same viewport padding, taken from the `shift` option (8px by default). Logical
|
|
16459
|
+
* `start`/`end` sides follow `useDirection()` (the WaveProvider `dir`, else the document
|
|
16460
|
+
* direction), and so does start/end alignment.
|
|
16461
|
+
*
|
|
16462
|
+
* Positions update only while `open` (`autoUpdate` on scroll/resize; element resizes and layout
|
|
16463
|
+
* shifts only where `ResizeObserver`/`IntersectionObserver` exist). Spread `floatingProps` onto the
|
|
16464
|
+
* surface: `data-side`/`data-align` expose the final placement for styling (C-CLASS).
|
|
16465
|
+
*
|
|
16466
|
+
* The anchor is an element or a `VirtualElement` (a rectangle such as the pointer position; a new
|
|
16467
|
+
* object on every render is fine); give it a `contextElement` so scrolling its containers updates
|
|
16468
|
+
* the position. A virtual anchor reaches floating-ui through one stable proxy that reads the latest
|
|
16469
|
+
* object: a new object only recomputes the position (which renders only when the position
|
|
16470
|
+
* changes), and a new proxy is made only when the `contextElement` changes.
|
|
16471
|
+
*
|
|
16472
|
+
* Destructure the result: `eslint-plugin-react-hooks` (`react-hooks/refs`) treats an object
|
|
16473
|
+
* whose member is passed to a `ref` prop as a ref, and then rejects reading its other members
|
|
16474
|
+
* during render.
|
|
16475
|
+
*
|
|
16476
|
+
* @example
|
|
16477
|
+
* const { setReference, setFloating, floatingProps } = usePopupPosition({ open, side: 'bottom' });
|
|
16478
|
+
* <button ref={setReference} />
|
|
16479
|
+
* {open && <Portal><div ref={setFloating} {...floatingProps} /></Portal>}
|
|
16480
|
+
*/
|
|
16481
|
+
export declare function usePopupPosition(options: UsePopupPositionOptions): UsePopupPositionResult;
|
|
16482
|
+
|
|
16483
|
+
/** Options of {@link usePopupPosition}. */
|
|
16484
|
+
export declare interface UsePopupPositionOptions {
|
|
16485
|
+
/** Whether the popup is open; positions are kept up to date only while `true`. */
|
|
16486
|
+
open: boolean;
|
|
16487
|
+
/** Side of the anchor. `start`/`end` follow the writing direction. @default 'bottom' */
|
|
16488
|
+
side?: PopupSide;
|
|
16489
|
+
/** Alignment along that side. @default 'start' */
|
|
16490
|
+
align?: PopupAlign;
|
|
16491
|
+
/** Distance from the anchor in px. @default 4 (tooltips use 8) */
|
|
16492
|
+
offset?: number;
|
|
16493
|
+
/** Flip to the opposite side when there is not enough room. @default true */
|
|
16494
|
+
flip?: boolean;
|
|
16495
|
+
/**
|
|
16496
|
+
* Shift along the side to stay inside the viewport. Its padding is also the viewport padding of
|
|
16497
|
+
* `flip` and of `size` (`fitViewport`, `matchReferenceWidth`): `true` means 8px, and `false`
|
|
16498
|
+
* lets the popup flip only once it touches the viewport edge and grow right up to it. With
|
|
16499
|
+
* `crossAxis: true` it also shifts across the side, over the anchor, when neither side has room
|
|
16500
|
+
* after `flip` (submenus), and `fitViewport` then offers the whole viewport in that direction.
|
|
16501
|
+
* @default { padding: 8 }
|
|
16502
|
+
*/
|
|
16503
|
+
shift?: boolean | {
|
|
16504
|
+
padding: number;
|
|
16505
|
+
crossAxis?: boolean;
|
|
16506
|
+
};
|
|
16507
|
+
/** Make the surface as wide as the anchor (listboxes). @default false */
|
|
16508
|
+
matchReferenceWidth?: boolean;
|
|
16509
|
+
/** Limit the surface to the available space (`max-width`/`max-height`). @default false */
|
|
16510
|
+
fitViewport?: boolean;
|
|
16511
|
+
/** An arrow (beak) element inside the surface, positioned through `arrowStyles`. */
|
|
16512
|
+
arrowRef?: React_2.RefObject<HTMLElement | null>;
|
|
16513
|
+
/** CSS positioning strategy. @default 'fixed' */
|
|
16514
|
+
strategy?: 'absolute' | 'fixed';
|
|
16515
|
+
/**
|
|
16516
|
+
* Placements to try, in order, when the requested side has no room, instead of only the opposite
|
|
16517
|
+
* side. Ignored with `flip: false`. An omitted `align` is the hook's own `align`.
|
|
16518
|
+
*/
|
|
16519
|
+
fallbackPlacements?: readonly PopupPlacement[];
|
|
16520
|
+
/**
|
|
16521
|
+
* Hide the surface (`visibility: hidden`: its layout is unaffected, but its content cannot take
|
|
16522
|
+
* focus, so a surface that holds focus loses it) while the anchor is scrolled out of view or
|
|
16523
|
+
* clipped away. @default false
|
|
16524
|
+
*/
|
|
16525
|
+
hideWhenDetached?: boolean;
|
|
16526
|
+
/**
|
|
16527
|
+
* Called after the surface is positioned, and again whenever the final placement changes (a flip,
|
|
16528
|
+
* a fallback): not on every scroll or resize recompute. It runs from an effect, never during
|
|
16529
|
+
* render, and not while closed.
|
|
16530
|
+
*/
|
|
16531
|
+
onPositioned?: (info: PositionedInfo) => void;
|
|
16532
|
+
}
|
|
16533
|
+
|
|
16534
|
+
/** Returned by {@link usePopupPosition}. */
|
|
16535
|
+
export declare interface UsePopupPositionResult {
|
|
16536
|
+
/**
|
|
16537
|
+
* Sets the anchor: a ref callback for the anchor (trigger) element, or a call from a layout
|
|
16538
|
+
* effect or an event. The anchor is an element or a `VirtualElement` (a rectangle such as the
|
|
16539
|
+
* pointer position; a new object on every render is fine); give it a `contextElement` so
|
|
16540
|
+
* scrolling its containers updates the position.
|
|
16541
|
+
*/
|
|
16542
|
+
setReference(el: HTMLElement | VirtualElement | null): void;
|
|
16543
|
+
/** Ref callback for the popup surface. */
|
|
16544
|
+
setFloating(el: HTMLElement | null): void;
|
|
16545
|
+
/** Position styles for the surface (also in `floatingProps.style`). */
|
|
16546
|
+
floatingStyles: React_2.CSSProperties;
|
|
16547
|
+
/** Position styles for the arrow element. */
|
|
16548
|
+
arrowStyles: React_2.CSSProperties;
|
|
16549
|
+
/** Final placement after flipping, e.g. `'top-start'`. */
|
|
16550
|
+
placement: string;
|
|
16551
|
+
/** Final physical side after flipping. */
|
|
16552
|
+
side: 'top' | 'bottom' | 'left' | 'right';
|
|
16553
|
+
/** Whether a position has been computed since the popup opened. */
|
|
16554
|
+
isPositioned: boolean;
|
|
16555
|
+
/** Recomputes the position now, for a change floating-ui cannot observe. A no-op while closed. */
|
|
16556
|
+
update(): void;
|
|
16557
|
+
/** Spread onto the surface: `data-side`, `data-align` and the position style. */
|
|
16558
|
+
floatingProps: {
|
|
16559
|
+
'data-side': string;
|
|
16560
|
+
'data-align': string;
|
|
16561
|
+
style: React_2.CSSProperties;
|
|
16562
|
+
};
|
|
16563
|
+
}
|
|
16564
|
+
|
|
15376
16565
|
/**
|
|
15377
16566
|
* Mounts and unmounts an element with CSS enter and exit motion. Style the phases with
|
|
15378
16567
|
* `data-presence` variants, e.g. `transition-opacity duration-wave-normal
|
|
@@ -15454,6 +16643,102 @@ export declare interface UsePresenceResult {
|
|
|
15454
16643
|
presenceProps: PresenceAttributes;
|
|
15455
16644
|
}
|
|
15456
16645
|
|
|
16646
|
+
/**
|
|
16647
|
+
* Returns focus to where it came from when a surface closes (dialogs, drawers, popovers, menus,
|
|
16648
|
+
* the DatePicker calendar, TeachingPopover).
|
|
16649
|
+
*
|
|
16650
|
+
* - **Capture**: when `enabled` flips to `true`, the opener is captured in an insertion effect —
|
|
16651
|
+
* before React applies `autoFocus` inside the new surface — preferring `triggerRef.current` and
|
|
16652
|
+
* ignoring `<body>` and elements inside `container`. When that finds nothing (a surface that
|
|
16653
|
+
* mounts open, before the refs of its commit are attached), it is captured again in the layout
|
|
16654
|
+
* phase of the same commit. Its place in the document and the triggers of the overlays it sits
|
|
16655
|
+
* in are recorded with it. When focus is already on `<body>` because
|
|
16656
|
+
* the focused element was removed earlier in the same commit (a menu item in a popover that
|
|
16657
|
+
* closes as the dialog it opens appears, the popover coming first in the tree), a document
|
|
16658
|
+
* focus tracker supplies that element with its recorded place and overlay triggers. The tracker
|
|
16659
|
+
* runs while any instance of the hook is mounted, and it forgets an element the user moved focus
|
|
16660
|
+
* away from on purpose.
|
|
16661
|
+
* - **Restore** when `enabled` flips to `false` (layout phase) and when the component unmounts
|
|
16662
|
+
* while enabled. The unmount restore runs in a microtask and is cancelled if the same instance
|
|
16663
|
+
* mounts again, so React StrictMode's simulated unmount does not pull focus out of a surface
|
|
16664
|
+
* that just opened.
|
|
16665
|
+
* - **Targets**, first valid wins:
|
|
16666
|
+
* 1. `finalFocusRef` → the captured opener → `triggerRef` → `fallback()`.
|
|
16667
|
+
* 2. When the opener was removed or cannot take focus, its replacement, nearest first: the
|
|
16668
|
+
* tabbable element next to where it was (in the innermost surviving ancestor that holds one,
|
|
16669
|
+
* the next one — the next row's action after a delete — else the previous one; then the same
|
|
16670
|
+
* one level up), else the trigger of the overlay it was in (a menu item's menu button), else
|
|
16671
|
+
* the element next to that trigger. When the surface is rendered inside another open layer
|
|
16672
|
+
* (its parent layer, from `DismissLayerContext`: a confirm Dialog in a Drawer's content),
|
|
16673
|
+
* only the replacements inside that layer's tree are tried here.
|
|
16674
|
+
* 3. The parent layer's surface, then the replacements outside the parent layer.
|
|
16675
|
+
* 4. The surface of the modal layer that stays open.
|
|
16676
|
+
*
|
|
16677
|
+
* So a confirm Dialog rendered in a Drawer's content and one rendered next to the Drawer both
|
|
16678
|
+
* return focus to the adjacent row, not to the Drawer's panel. A target is valid when it is
|
|
16679
|
+
* connected, focusable, not inside `[inert]` or `[aria-hidden="true"]`, and not cut off behind
|
|
16680
|
+
* another open modal layer — so focus never lands on the inert page behind a Drawer that stays
|
|
16681
|
+
* open, and is not dropped on `<body>` while a valid target exists. Focus uses `preventScroll`.
|
|
16682
|
+
* - `onlyIfFocusInside` (popovers): restores only when focus is inside the surface or was lost to
|
|
16683
|
+
* `<body>`.
|
|
16684
|
+
* - `requireFocusInside` (surfaces that do not trap focus: a non-modal Dialog or Drawer, an inline
|
|
16685
|
+
* Drawer): restores only when focus is inside the surface or in a layer opened from it (a
|
|
16686
|
+
* descendant layer of `layerId`, or a layer anchored inside the surface), or was lost to
|
|
16687
|
+
* `<body>` from an element in either; a close from code while focus is on `<body>` or on the
|
|
16688
|
+
* page moves nothing.
|
|
16689
|
+
* - `isHoverClose`: a close by the hover intent restores only when focus is inside the surface, so
|
|
16690
|
+
* a hover close never moves focus from `<body>` or from where the user put it. The same holds for
|
|
16691
|
+
* a surface opened from inside one that closes by hover (a submenu, a hover card in a hover
|
|
16692
|
+
* card): every mounted instance is known to the others through the focus tracker's record.
|
|
16693
|
+
*/
|
|
16694
|
+
export declare function useRestoreFocus(options: UseRestoreFocusOptions): void;
|
|
16695
|
+
|
|
16696
|
+
/** Options of {@link useRestoreFocus}. */
|
|
16697
|
+
export declare interface UseRestoreFocusOptions {
|
|
16698
|
+
/** `true` while the surface is open. */
|
|
16699
|
+
enabled: boolean;
|
|
16700
|
+
/** The layer surface: opener candidates inside it are ignored. */
|
|
16701
|
+
container?: HTMLElement | null;
|
|
16702
|
+
/** The trigger: preferred restore target. */
|
|
16703
|
+
triggerRef?: React_2.RefObject<HTMLElement | null>;
|
|
16704
|
+
/** Consumer override: focused first when valid. */
|
|
16705
|
+
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
16706
|
+
/** Used when neither the override, the opener nor the trigger can take focus. */
|
|
16707
|
+
fallback?: () => HTMLElement | null;
|
|
16708
|
+
/**
|
|
16709
|
+
* Popovers: restore only when focus was inside the surface (or lost to `<body>`) at close, so a
|
|
16710
|
+
* click that moved focus elsewhere is respected. @default false
|
|
16711
|
+
*/
|
|
16712
|
+
onlyIfFocusInside?: boolean;
|
|
16713
|
+
/**
|
|
16714
|
+
* Read when the surface closes, or unmounts while open: `true` when the hover intent closed it
|
|
16715
|
+
* (Popover and Menu `openOnHover`, a submenu closing by hover). A hover close never moves focus:
|
|
16716
|
+
* it restores only while focus is inside the surface, so focus on `<body>` (where a hover-opened
|
|
16717
|
+
* surface leaves it) or elsewhere stays where it is. A surface opened from inside one that closes
|
|
16718
|
+
* by hover (its opener, else its trigger, lies in that surface: a submenu, a hover card in a
|
|
16719
|
+
* hover card, at any depth) is taken along, and its close counts as a hover close too. Every
|
|
16720
|
+
* other close keeps the rules above.
|
|
16721
|
+
*/
|
|
16722
|
+
isHoverClose?: () => boolean;
|
|
16723
|
+
/**
|
|
16724
|
+
* Surfaces that do not trap focus (a non-modal Dialog or Drawer, an inline Drawer): restore only
|
|
16725
|
+
* when focus is inside the surface at close, or was lost to `<body>` from an element inside it
|
|
16726
|
+
* (removed, or made unable to take focus). Focus elsewhere, or on `<body>` for another reason
|
|
16727
|
+
* (nothing had focus, a press on a spot that takes no focus, a close from code), stays where it
|
|
16728
|
+
* is. Wins over `onlyIfFocusInside`. Focus in a layer opened from the surface (a Popover or a
|
|
16729
|
+
* confirm Dialog, portaled outside it) counts as inside: a descendant layer of `layerId`, or a
|
|
16730
|
+
* layer anchored to an element inside the surface; so does focus lost to `<body>` from one.
|
|
16731
|
+
* @default false
|
|
16732
|
+
*/
|
|
16733
|
+
requireFocusInside?: boolean;
|
|
16734
|
+
/**
|
|
16735
|
+
* The surface's own dismiss layer, with `requireFocusInside`: focus in one of its descendant
|
|
16736
|
+
* layers counts as inside the surface, also after the surface's layer has unregistered (in the
|
|
16737
|
+
* commit that closes it).
|
|
16738
|
+
*/
|
|
16739
|
+
layerId?: string;
|
|
16740
|
+
}
|
|
16741
|
+
|
|
15457
16742
|
/**
|
|
15458
16743
|
* Implements the WAI-ARIA roving tabindex pattern for composite widgets: one item holds the tab
|
|
15459
16744
|
* stop (`tabIndex=0`, all others `-1`), arrow keys move focus between items, Home/End jump to the
|
|
@@ -15542,10 +16827,23 @@ export declare interface UseRovingTabIndexOptions {
|
|
|
15542
16827
|
items?: readonly string[];
|
|
15543
16828
|
/**
|
|
15544
16829
|
* Arrow key axis: `'horizontal'` uses Left/Right (mirrored in RTL), `'vertical'` uses Up/Down,
|
|
15545
|
-
* `'both'` uses all four.
|
|
16830
|
+
* `'both'` uses all four, in the DOM order of the items.
|
|
16831
|
+
*
|
|
16832
|
+
* `'grid'` is a two-dimensional grid: Left/Right move through the cells in reading order across
|
|
16833
|
+
* rows (mirrored in RTL); Up/Down go to the cell at the same index in the previous or next row,
|
|
16834
|
+
* else to the nearest enabled cell of that row (the earlier one on a tie), skipping rows without
|
|
16835
|
+
* an enabled cell, and stop at the first and last row; Home/End go to the first and last enabled
|
|
16836
|
+
* cell of the row, Ctrl+Home/End of the grid (whatever `homeEndKeys` says). Rows are the
|
|
16837
|
+
* `role="row"` elements inside the container, else groups of `columns` items in DOM order. Without
|
|
16838
|
+
* either, `'grid'` acts as `'both'` and a development warning says so.
|
|
15546
16839
|
* @default 'horizontal'
|
|
15547
16840
|
*/
|
|
15548
|
-
orientation?: 'horizontal' | 'vertical' | 'both';
|
|
16841
|
+
orientation?: 'horizontal' | 'vertical' | 'both' | 'grid';
|
|
16842
|
+
/**
|
|
16843
|
+
* With `orientation: 'grid'` and no `role="row"` elements: the number of cells per row. The last
|
|
16844
|
+
* row may be shorter.
|
|
16845
|
+
*/
|
|
16846
|
+
columns?: number;
|
|
15549
16847
|
/**
|
|
15550
16848
|
* Whether arrow keys wrap around at the ends.
|
|
15551
16849
|
* @default true
|