@mortenbrudvik/waveui 0.10.0 → 0.12.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 +454 -74
- 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/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +25 -30
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.navigation.cjs +2 -0
- package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
- package/dist/components/button/Toolbar.navigation.mjs +17 -0
- package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
- 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.context.cjs +2 -0
- package/dist/components/data-display/Avatar.context.cjs.map +1 -0
- package/dist/components/data-display/Avatar.context.mjs +9 -0
- package/dist/components/data-display/Avatar.context.mjs.map +1 -0
- package/dist/components/data-display/Avatar.mjs +66 -61
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- 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.mjs +10 -10
- 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 +2 -0
- package/dist/components/data-display/InteractionTag.cjs.map +1 -0
- package/dist/components/data-display/InteractionTag.mjs +234 -0
- package/dist/components/data-display/InteractionTag.mjs.map +1 -0
- 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 +222 -90
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/data-display/TagGroup.cjs +2 -0
- package/dist/components/data-display/TagGroup.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.cjs +2 -0
- package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.mjs +113 -0
- package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
- package/dist/components/data-display/TagGroup.mjs +149 -0
- package/dist/components/data-display/TagGroup.mjs.map +1 -0
- package/dist/components/data-display/tagStyles.cjs +2 -0
- package/dist/components/data-display/tagStyles.cjs.map +1 -0
- package/dist/components/data-display/tagStyles.mjs +108 -0
- package/dist/components/data-display/tagStyles.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +287 -255
- 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.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +7 -7
- package/dist/components/input/Combobox.expand.mjs.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 +101 -94
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.context.cjs +2 -0
- package/dist/components/input/TagPicker.context.cjs.map +1 -0
- package/dist/components/input/TagPicker.context.mjs +20 -0
- package/dist/components/input/TagPicker.context.mjs.map +1 -0
- package/dist/components/input/TagPicker.create.cjs +2 -0
- package/dist/components/input/TagPicker.create.cjs.map +1 -0
- package/dist/components/input/TagPicker.create.mjs +24 -0
- package/dist/components/input/TagPicker.create.mjs.map +1 -0
- package/dist/components/input/TagPicker.mjs +13 -279
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.option.cjs +2 -0
- package/dist/components/input/TagPicker.option.cjs.map +1 -0
- package/dist/components/input/TagPicker.option.mjs +45 -0
- package/dist/components/input/TagPicker.option.mjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.cjs +2 -0
- package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.mjs +153 -0
- package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
- package/dist/components/input/TagPicker.parts.cjs +2 -0
- package/dist/components/input/TagPicker.parts.cjs.map +1 -0
- package/dist/components/input/TagPicker.parts.mjs +425 -0
- package/dist/components/input/TagPicker.parts.mjs.map +1 -0
- package/dist/components/input/TagPicker.root.cjs +2 -0
- package/dist/components/input/TagPicker.root.cjs.map +1 -0
- package/dist/components/input/TagPicker.root.mjs +417 -0
- package/dist/components/input/TagPicker.root.mjs.map +1 -0
- 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/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/navigation/Hamburger.cjs +2 -0
- package/dist/components/navigation/Hamburger.cjs.map +1 -0
- package/dist/components/navigation/Hamburger.mjs +54 -0
- package/dist/components/navigation/Hamburger.mjs.map +1 -0
- 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/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.context.cjs +2 -0
- package/dist/components/navigation/Nav.context.cjs.map +1 -0
- package/dist/components/navigation/Nav.context.mjs +137 -0
- package/dist/components/navigation/Nav.context.mjs.map +1 -0
- package/dist/components/navigation/Nav.mjs +151 -258
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Nav.parts.cjs +2 -0
- package/dist/components/navigation/Nav.parts.cjs.map +1 -0
- package/dist/components/navigation/Nav.parts.mjs +77 -0
- package/dist/components/navigation/Nav.parts.mjs.map +1 -0
- package/dist/components/navigation/Nav.root.cjs +2 -0
- package/dist/components/navigation/Nav.root.cjs.map +1 -0
- package/dist/components/navigation/Nav.root.mjs +78 -0
- package/dist/components/navigation/Nav.root.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.cjs +2 -0
- package/dist/components/navigation/NavDrawer.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.cjs +2 -0
- package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.mjs +11 -0
- package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.mjs +179 -0
- package/dist/components/navigation/NavDrawer.mjs.map +1 -0
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +188 -123
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.cjs +1 -1
- package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.mjs +157 -81
- package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +2 -0
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
- package/dist/components/overlays/Dialog.slots.mjs +129 -0
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.context.cjs +2 -0
- package/dist/components/overlays/Drawer.context.cjs.map +1 -0
- package/dist/components/overlays/Drawer.context.mjs +29 -0
- package/dist/components/overlays/Drawer.context.mjs.map +1 -0
- package/dist/components/overlays/Drawer.mjs +12 -187
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +2 -0
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
- package/dist/components/overlays/Drawer.panel.mjs +159 -0
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.cjs +2 -0
- package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.mjs +152 -0
- package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
- package/dist/components/overlays/Drawer.root.cjs +2 -0
- package/dist/components/overlays/Drawer.root.cjs.map +1 -0
- package/dist/components/overlays/Drawer.root.mjs +207 -0
- package/dist/components/overlays/Drawer.root.mjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.cjs +2 -0
- package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.mjs +42 -0
- package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
- 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 +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs +115 -98
- 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 +34 -21
- package/dist/hooks/useModalLayer.mjs.map +1 -1
- 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/useRestoreFocus.cjs +1 -1
- package/dist/hooks/useRestoreFocus.cjs.map +1 -1
- package/dist/hooks/useRestoreFocus.mjs +91 -78
- package/dist/hooks/useRestoreFocus.mjs.map +1 -1
- 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 +180 -121
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3070 -269
- package/dist/index.d.ts +3070 -269
- package/dist/index.mjs +127 -107
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +137 -77
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/icons.cjs +1 -1
- package/dist/lib/icons.cjs.map +1 -1
- package/dist/lib/icons.mjs +13 -6
- package/dist/lib/icons.mjs.map +1 -1
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +120 -111
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +25 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
|
+
import { FC } from 'react';
|
|
2
3
|
import { JSX } from 'react';
|
|
3
4
|
import { JSXElementConstructor } from 'react';
|
|
5
|
+
import { NamedExoticComponent } from 'react';
|
|
4
6
|
import * as React_2 from 'react';
|
|
5
7
|
import { ReactElement } from 'react';
|
|
6
8
|
import { ReactNode } from 'react';
|
|
@@ -54,8 +56,8 @@ export declare const accordionClassNames: {
|
|
|
54
56
|
readonly root: "wave-accordion";
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
/** Heading level of the element that wraps each Accordion trigger. */
|
|
58
|
-
export declare type AccordionHeadingLevel =
|
|
59
|
+
/** Heading level of the element that wraps each Accordion trigger: the shared {@link HeadingLevel}. */
|
|
60
|
+
export declare type AccordionHeadingLevel = HeadingLevel;
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
63
|
* One section of an Accordion. Place an `Accordion.Trigger` and an `Accordion.Panel` inside it:
|
|
@@ -304,7 +306,7 @@ export declare type Appearance = 'primary' | 'outline' | 'subtle' | 'transparent
|
|
|
304
306
|
* <Avatar name="Jane Doe" src="/jane.jpg" badge={<PresenceBadge status="available" />} />
|
|
305
307
|
*/
|
|
306
308
|
export declare const Avatar: {
|
|
307
|
-
({ src, name, size, 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, 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;
|
|
308
310
|
displayName: string;
|
|
309
311
|
};
|
|
310
312
|
|
|
@@ -406,7 +408,9 @@ export declare interface AvatarProps extends React_2.HTMLAttributes<HTMLSpanElem
|
|
|
406
408
|
* `role="img"` unless `role` is given) and generates the initials shown when there is no image.
|
|
407
409
|
*/
|
|
408
410
|
name?: string;
|
|
409
|
-
/**
|
|
411
|
+
/**
|
|
412
|
+
* Size of the avatar. Without it, an Avatar in the `media` of a tag (Tag, InteractionTag) takes
|
|
413
|
+
* the tag's media box instead: 24, 20 or 16px by the tag's size.
|
|
410
414
|
* @default 'medium'
|
|
411
415
|
*/
|
|
412
416
|
size?: Size;
|
|
@@ -451,6 +455,9 @@ export declare interface AvatarProps extends React_2.HTMLAttributes<HTMLSpanElem
|
|
|
451
455
|
ref?: React_2.Ref<HTMLSpanElement>;
|
|
452
456
|
}
|
|
453
457
|
|
|
458
|
+
/** How a modal surface's backdrop paints the page: `dimmed`, or `transparent` (a modal over another). */
|
|
459
|
+
export declare type BackdropAppearance = 'dimmed' | 'transparent';
|
|
460
|
+
|
|
454
461
|
/**
|
|
455
462
|
* A short, non-interactive label that highlights a status or category ("New", "Beta", "3").
|
|
456
463
|
* `appearance` picks a solid fill, a light tint or an outline; `color` the semantic color. Colors
|
|
@@ -2338,6 +2345,13 @@ export declare interface ComboboxProps<M extends boolean = false> extends Omit<R
|
|
|
2338
2345
|
* listbox keeps its size.
|
|
2339
2346
|
*/
|
|
2340
2347
|
size?: CoreSize;
|
|
2348
|
+
/**
|
|
2349
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
2350
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
2351
|
+
* room). The popup opens below the field.
|
|
2352
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
2353
|
+
*/
|
|
2354
|
+
positioning?: PopupPositioningOptions;
|
|
2341
2355
|
/**
|
|
2342
2356
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
2343
2357
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -3232,6 +3246,13 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
3232
3246
|
* calendar keeps its size.
|
|
3233
3247
|
*/
|
|
3234
3248
|
size?: CoreSize;
|
|
3249
|
+
/**
|
|
3250
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
3251
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
3252
|
+
* room). The popup opens below the field.
|
|
3253
|
+
* @default `{}`: the calendar opens 4px below the field
|
|
3254
|
+
*/
|
|
3255
|
+
positioning?: PopupPositioningOptions;
|
|
3235
3256
|
/**
|
|
3236
3257
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
3237
3258
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -3367,8 +3388,9 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
3367
3388
|
export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3368
3389
|
|
|
3369
3390
|
/**
|
|
3370
|
-
* A
|
|
3371
|
-
* `Dialog.Content` renders the surface in a portal while open
|
|
3391
|
+
* A dialog (Fluent UI v2 style), modal by default: `Dialog` holds the open state; `Dialog.Trigger`
|
|
3392
|
+
* opens and closes it and `Dialog.Content` renders the surface in a portal while open (and, with
|
|
3393
|
+
* `unmountOnClose={false}`, keeps it there while closed, `hidden` and `inert`).
|
|
3372
3394
|
*
|
|
3373
3395
|
* - **Modal**: focus moves into the dialog and Tab stays inside it (toasts included), the rest of
|
|
3374
3396
|
* the page is `inert` (instead of `aria-modal`, so toasts and live regions stay announced), and
|
|
@@ -3383,8 +3405,29 @@ export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
3383
3405
|
* that had focus when the dialog opened, the trigger, an element next to where that opener was.
|
|
3384
3406
|
* - **Alert dialogs**: `modalType="alert"` renders `role="alertdialog"` for a confirmation that
|
|
3385
3407
|
* needs an answer; a backdrop press does not close it.
|
|
3408
|
+
* - **Non-modal dialogs**: `modalType="non-modal"` leaves the page usable (no backdrop, no focus
|
|
3409
|
+
* trap, nothing inert, the page scrolls). Focus moves in on open; Tab and Shift+Tab leave the
|
|
3410
|
+
* dialog in the page's order right after the element that opened it; Escape closes it only while
|
|
3411
|
+
* focus is inside it; presses on the page never close it; focus returns to the opener only from
|
|
3412
|
+
* inside. Keep the page's controls clear of the dialog, which covers the page under it.
|
|
3413
|
+
* - **Size**: `Dialog.Content` `size` caps the width at 400px (`small`), 600px (`medium`, the
|
|
3414
|
+
* default) or 940px (`large`); `full` covers the viewport and pads its safe-area insets.
|
|
3415
|
+
* - **Backdrop**: the backdrop is the surface's sibling and a slot (`backdrop`: `null` removes it,
|
|
3416
|
+
* `appearance` picks `dimmed` or `transparent`). A modal opened over another modal dims the page
|
|
3417
|
+
* once: its backdrop is transparent while the lower one is open.
|
|
3418
|
+
* - **Close button and title actions**: `closeButton` sets the built-in Close button's content, or
|
|
3419
|
+
* hides it (`null`); a button passed there is merged into it. `titleAction` and `Dialog.Title`'s
|
|
3420
|
+
* `action` place header buttons before the Close button in the top end corner, in DOM and Tab
|
|
3421
|
+
* order, and the titles' end padding makes room for them. Initial focus goes to the first
|
|
3422
|
+
* focusable element: a title action, else the Close button.
|
|
3386
3423
|
* - **Footer**: `Dialog.Footer` sticks to the bottom of the scrolling body, and the body keeps a
|
|
3387
3424
|
* focused field above it.
|
|
3425
|
+
* - **Kept mounted**: `unmountOnClose={false}` keeps the content mounted while the dialog is
|
|
3426
|
+
* closed, so a form keeps what was typed and the components inside keep their state; each open
|
|
3427
|
+
* focuses the first focusable element again (an `autoFocus` inside never applies), and a kept
|
|
3428
|
+
* dialog opened while another overlay is open stacks above it.
|
|
3429
|
+
* - **Presence**: the surface mounts through the presence core and renders `data-presence`; no
|
|
3430
|
+
* motion ships, and `data-[presence=…]:` classes on `Dialog.Content` animate it.
|
|
3388
3431
|
* - **Naming**: give `Dialog.Content` a `title`, a `Dialog.Title`, or `aria-label`.
|
|
3389
3432
|
*
|
|
3390
3433
|
* The sub-components are also exported under flat names (`DialogTrigger`, `DialogContent`,
|
|
@@ -3404,7 +3447,7 @@ export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
3404
3447
|
* </Dialog>
|
|
3405
3448
|
*/
|
|
3406
3449
|
export declare const Dialog: {
|
|
3407
|
-
({ open, defaultOpen, onOpenChange, modalType, finalFocusRef, children, }: DialogProps): React_2.JSX.Element;
|
|
3450
|
+
({ open, defaultOpen, onOpenChange, modalType, finalFocusRef, unmountOnClose, children, }: DialogProps): React_2.JSX.Element;
|
|
3408
3451
|
displayName: string;
|
|
3409
3452
|
} & {
|
|
3410
3453
|
Trigger: {
|
|
@@ -3412,7 +3455,7 @@ export declare const Dialog: {
|
|
|
3412
3455
|
displayName: string;
|
|
3413
3456
|
};
|
|
3414
3457
|
Content: {
|
|
3415
|
-
({ title, size, closeLabel, children, className, id, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3458
|
+
({ title, size, backdrop, closeButton, titleAction, closeLabel, children, className, style, id, onKeyDown, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3416
3459
|
displayName: string;
|
|
3417
3460
|
};
|
|
3418
3461
|
Footer: {
|
|
@@ -3420,7 +3463,7 @@ export declare const Dialog: {
|
|
|
3420
3463
|
displayName: string;
|
|
3421
3464
|
};
|
|
3422
3465
|
Title: {
|
|
3423
|
-
({ id, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3466
|
+
({ id, action, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3424
3467
|
displayName: string;
|
|
3425
3468
|
};
|
|
3426
3469
|
Close: {
|
|
@@ -3464,28 +3507,47 @@ export declare interface DialogCloseRenderProps extends React_2.HTMLAttributes<H
|
|
|
3464
3507
|
|
|
3465
3508
|
/**
|
|
3466
3509
|
* The dialog surface, rendered in a portal (inheriting the WaveProvider theme) while the dialog is
|
|
3467
|
-
* open
|
|
3468
|
-
* `
|
|
3469
|
-
*
|
|
3470
|
-
*
|
|
3471
|
-
* viewport
|
|
3472
|
-
*
|
|
3473
|
-
*
|
|
3510
|
+
* open, and kept there while it is closed, `hidden` and `inert`, when the Dialog has
|
|
3511
|
+
* `unmountOnClose={false}`: the backdrop, and the surface centred in the positioner (the
|
|
3512
|
+
* backdrop's sibling) with the title, the title-actions area (title actions, then the Close
|
|
3513
|
+
* button) and a scrolling body. It takes the full width up to its `size` and never exceeds the
|
|
3514
|
+
* viewport (the body scrolls, also sideways for content wider than the dialog); `size="full"`
|
|
3515
|
+
* fills the viewport. Its 1rem gap to the viewport edges is its own margin, so a margin in
|
|
3516
|
+
* `className` replaces the gap: with the width and height caps lifted as well and its height set
|
|
3517
|
+
* to the viewport's, it fills the viewport. It is `role="dialog"`, or `role="alertdialog"` when the
|
|
3518
|
+
* Dialog has `modalType="alert"` (a `role` you pass wins), and carries `data-modal-type` and
|
|
3519
|
+
* `data-size` with the resolved values. A non-modal dialog has no backdrop: the positioner only
|
|
3520
|
+
* centres the surface and lets presses through to the page. The titles' end padding follows the
|
|
3521
|
+
* width of the title-actions area (`--wave-dialog-title-end-padding`, 2rem until it is measured).
|
|
3522
|
+
*
|
|
3523
|
+
* It mounts through the presence core: the backdrop, the positioner and the surface render
|
|
3524
|
+
* `data-presence` (`entered` while open, `exited` while kept closed; `entering` and `exiting`
|
|
3525
|
+
* only while a motion of yours runs on the surface), and the backdrop and the positioner are
|
|
3526
|
+
* `inert` while exiting and `hidden` and `inert` while kept closed. No motion ships: animate the
|
|
3527
|
+
* surface with `data-[presence=…]:` classes in `className` (an enter's start as
|
|
3528
|
+
* `data-[presence=entering]:starting:`, each with a `motion-reduce:` counterpart); a closed
|
|
3529
|
+
* surface waits for that motion before it unmounts or hides, while focus, the trap and the
|
|
3530
|
+
* isolation follow the open state at once.
|
|
3474
3531
|
*/
|
|
3475
3532
|
export declare const DialogContent: {
|
|
3476
|
-
({ title, size, closeLabel, children, className, id, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3533
|
+
({ title, size, backdrop, closeButton, titleAction, closeLabel, children, className, style, id, onKeyDown, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3477
3534
|
displayName: string;
|
|
3478
3535
|
};
|
|
3479
3536
|
|
|
3480
3537
|
/**
|
|
3481
|
-
* Dialog.Content: `root` on the surface (`role="dialog"` or `"alertdialog"
|
|
3482
|
-
* backdrop
|
|
3483
|
-
*
|
|
3484
|
-
*
|
|
3538
|
+
* Dialog.Content: `root` on the surface (`role="dialog"` or `"alertdialog"`, also while kept
|
|
3539
|
+
* mounted); `backdrop` on the backdrop behind it; `positioner` on the element that centres the
|
|
3540
|
+
* surface (the backdrop's sibling); `titleActions` on the area of header buttons in the top end
|
|
3541
|
+
* corner; `titleAction` on the element of the `titleAction` slot; `closeButton` on the built-in
|
|
3542
|
+
* Close button (which also carries Button's root); `body` on the scrolling body. The heading of
|
|
3543
|
+
* its `title` prop carries Dialog.Title's class.
|
|
3485
3544
|
*/
|
|
3486
3545
|
export declare const dialogContentClassNames: {
|
|
3487
3546
|
readonly root: "wave-dialog-content";
|
|
3488
3547
|
readonly backdrop: "wave-dialog-content__backdrop";
|
|
3548
|
+
readonly positioner: "wave-dialog-content__positioner";
|
|
3549
|
+
readonly titleActions: "wave-dialog-content__title-actions";
|
|
3550
|
+
readonly titleAction: "wave-dialog-content__title-action";
|
|
3489
3551
|
readonly closeButton: "wave-dialog-content__close-button";
|
|
3490
3552
|
readonly body: "wave-dialog-content__body";
|
|
3491
3553
|
};
|
|
@@ -3498,13 +3560,52 @@ export declare interface DialogContentProps extends Omit<React_2.HTMLAttributes<
|
|
|
3498
3560
|
* (`''`, `[]`, `true`) counts as none.
|
|
3499
3561
|
*/
|
|
3500
3562
|
title?: React_2.ReactNode;
|
|
3501
|
-
/**
|
|
3563
|
+
/**
|
|
3564
|
+
* Width cap: 400px (`small`), 600px (`medium`) or 940px (`large`), never wider than the viewport
|
|
3565
|
+
* (a 1rem margin). `full` covers the viewport: no margin, radius or border, the viewport's
|
|
3566
|
+
* dynamic height, and the safe-area insets as padding (with `viewport-fit=cover`); the body
|
|
3567
|
+
* scrolls under the sticky `Dialog.Footer`. Rendered as `data-size`. Fluent has no size. For
|
|
3568
|
+
* another width, put a width cap in `className` (it replaces the size's).
|
|
3502
3569
|
* @default 'medium'
|
|
3503
3570
|
*/
|
|
3504
|
-
size?:
|
|
3571
|
+
size?: DialogSize;
|
|
3572
|
+
/**
|
|
3573
|
+
* The backdrop of a modal or alert dialog: a `div` behind the dialog, `aria-hidden`. Shorthand
|
|
3574
|
+
* content renders inside it; a slot object's `className` (merged last), `style`, data
|
|
3575
|
+
* attributes, `ref` and handlers go to it, and its `appearance` (`'dimmed'` or `'transparent'`)
|
|
3576
|
+
* overrides the automatic one: while another modal Dialog or Drawer is open below this one the
|
|
3577
|
+
* backdrop is transparent, so the page is dimmed once. `null` renders no backdrop (the page stays
|
|
3578
|
+
* inert, and a press outside still closes a modal dialog); a boolean is no slot. Ignored with
|
|
3579
|
+
* `modalType="non-modal"` (a development warning says so). Fluent's `backdrop`.
|
|
3580
|
+
*/
|
|
3581
|
+
backdrop?: Slot<'div'> | (SlotObject<'div'> & {
|
|
3582
|
+
appearance?: BackdropAppearance;
|
|
3583
|
+
});
|
|
3584
|
+
/**
|
|
3585
|
+
* Content of the built-in Close button (the dismiss glyph by default). It renders inside the
|
|
3586
|
+
* button, decorative (`aria-hidden`), so the button keeps the name `closeLabel`; a slot object's
|
|
3587
|
+
* `aria-label`, `aria-labelledby` or `title` names it instead, and its handlers run before the
|
|
3588
|
+
* close (`preventDefault()` keeps the dialog open). `null` hides the button (Escape and
|
|
3589
|
+
* `Dialog.Close` still close); a boolean is no slot, so `closeButton={cond && <MyIcon />}` keeps
|
|
3590
|
+
* the default; content that renders nothing keeps the default glyph. A `<button>` or Wave
|
|
3591
|
+
* `Button` passed here is merged into the built-in button, never nested (a development warning
|
|
3592
|
+
* says so): its props apply, its text label (`<button>Done</button>`) names the button instead
|
|
3593
|
+
* of `closeLabel`, and a Button's `icon`, `iconPosition` and `disabledFocusable` apply while
|
|
3594
|
+
* `appearance` and `size` are ignored. Fluent's `DialogTitle` `action` holds Fluent's close
|
|
3595
|
+
* button; WaveUI renders its own.
|
|
3596
|
+
*/
|
|
3597
|
+
closeButton?: Slot<'span'>;
|
|
3598
|
+
/**
|
|
3599
|
+
* Header buttons for the `title` prop form, placed before the built-in Close button in the
|
|
3600
|
+
* dialog's top end corner, in DOM and Tab order (an expand toggle, a menu). The title's end
|
|
3601
|
+
* padding makes room for them. Interactive: name icon-only buttons. Renders nothing when empty.
|
|
3602
|
+
* See also `Dialog.Title`'s `action`. Fluent's `DialogTitle` `action`, for the `title` prop
|
|
3603
|
+
* form.
|
|
3604
|
+
*/
|
|
3605
|
+
titleAction?: Slot<'span'>;
|
|
3505
3606
|
/**
|
|
3506
3607
|
* Accessible name of the built-in Close button (an icon-only button). Localize it with the
|
|
3507
|
-
* page's language.
|
|
3608
|
+
* page's language. A text label of a button merged into `closeButton` names it instead.
|
|
3508
3609
|
* @default 'Close'
|
|
3509
3610
|
*/
|
|
3510
3611
|
closeLabel?: string;
|
|
@@ -3544,8 +3645,8 @@ export declare interface DialogFooterProps extends React_2.HTMLAttributes<HTMLDi
|
|
|
3544
3645
|
}
|
|
3545
3646
|
|
|
3546
3647
|
/**
|
|
3547
|
-
* How a {@link Dialog}
|
|
3548
|
-
* `
|
|
3648
|
+
* How a {@link Dialog} relates to the page: `modal`, `alert` or `non-modal` (the shared
|
|
3649
|
+
* `ModalType`; `DrawerModalType` is the same type).
|
|
3549
3650
|
*/
|
|
3550
3651
|
export declare type DialogModalType = ModalType;
|
|
3551
3652
|
|
|
@@ -3585,11 +3686,18 @@ export declare interface DialogProps {
|
|
|
3585
3686
|
*/
|
|
3586
3687
|
onOpenChange?: (open: boolean, details?: DialogOpenChangeDetails) => void;
|
|
3587
3688
|
/**
|
|
3588
|
-
* `modal`: a backdrop press, Escape, the Close
|
|
3589
|
-
*
|
|
3590
|
-
*
|
|
3591
|
-
*
|
|
3592
|
-
*
|
|
3689
|
+
* `modal`: the page behind is `inert` and does not scroll; a backdrop press, Escape, the Close
|
|
3690
|
+
* button and `Dialog.Close` close it. `alert`: a confirmation that needs an answer —
|
|
3691
|
+
* `role="alertdialog"`, and a backdrop press does not close it (Escape still does). `non-modal`:
|
|
3692
|
+
* the page stays usable — no backdrop, no focus trap, nothing inert, the page scrolls; Tab and
|
|
3693
|
+
* Shift+Tab leave the dialog in the page's order right after the element that opened it, Escape
|
|
3694
|
+
* closes it while focus is inside it, presses on the page never close it, and focus returns to
|
|
3695
|
+
* the opener only when it was inside the dialog. A non-modal dialog covers the page under it
|
|
3696
|
+
* while Tab still reaches that page: keep the controls the user works with outside it, or use
|
|
3697
|
+
* `modal` (with `size="full"` it covers everything, and a development warning says so). Every
|
|
3698
|
+
* type moves focus to the first focusable element on open (a title action, else the built-in
|
|
3699
|
+
* Close button); give another element `autoFocus` to start there (an alert dialog's least
|
|
3700
|
+
* destructive action). `Dialog.Trigger` toggles the dialog. Fluent's `modalType`.
|
|
3593
3701
|
* @default 'modal'
|
|
3594
3702
|
*/
|
|
3595
3703
|
modalType?: DialogModalType;
|
|
@@ -3600,43 +3708,75 @@ export declare interface DialogProps {
|
|
|
3600
3708
|
* send focus somewhere else.
|
|
3601
3709
|
*/
|
|
3602
3710
|
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
3711
|
+
/**
|
|
3712
|
+
* Removes `Dialog.Content` (the surface and everything in it) when the dialog closes. `false`
|
|
3713
|
+
* keeps it mounted while closed, `hidden` and `inert`, so a form inside keeps what was typed and
|
|
3714
|
+
* the components inside keep their state; the surface then mounts with the Dialog, closed (in
|
|
3715
|
+
* the browser only, as an open one), and an `autoFocus` inside it never applies (each open
|
|
3716
|
+
* focuses the first focusable element). A popup opened inside that is still open when the
|
|
3717
|
+
* dialog closes stays open over the page (a development warning says so): close it first.
|
|
3718
|
+
* Fluent's `unmountOnClose`.
|
|
3719
|
+
* @default true
|
|
3720
|
+
*/
|
|
3721
|
+
unmountOnClose?: boolean;
|
|
3603
3722
|
/** `Dialog.Trigger` and `Dialog.Content`. */
|
|
3604
3723
|
children: React_2.ReactNode;
|
|
3605
3724
|
}
|
|
3606
3725
|
|
|
3726
|
+
/**
|
|
3727
|
+
* The width cap of a {@link Dialog}'s surface: `small` 400px, `medium` 600px, `large` 940px, or
|
|
3728
|
+
* `full`, the whole viewport (the shared `SurfaceSize`; `DrawerSize` is the same type).
|
|
3729
|
+
*/
|
|
3730
|
+
export declare type DialogSize = SurfaceSize;
|
|
3731
|
+
|
|
3607
3732
|
/**
|
|
3608
3733
|
* A heading that names the dialog (`aria-labelledby`), for rich titles or custom layouts. Render it
|
|
3609
|
-
* inside `Dialog.Content` (instead of the `title` prop). Like the `title` heading
|
|
3610
|
-
*
|
|
3734
|
+
* inside `Dialog.Content` (instead of the `title` prop). Like the `title` heading, its end padding
|
|
3735
|
+
* follows the width of the dialog's title-actions area (2rem until it is measured), so a long first
|
|
3736
|
+
* line stays clear of the title actions and the Close button; a `className` padding wins. Its
|
|
3737
|
+
* `action` renders in that area, before the Close button, and never inside the heading.
|
|
3611
3738
|
*/
|
|
3612
3739
|
export declare const DialogTitle: {
|
|
3613
|
-
({ id, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3740
|
+
({ id, action, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3614
3741
|
displayName: string;
|
|
3615
3742
|
};
|
|
3616
3743
|
|
|
3617
|
-
/** Dialog.Title: `root` on the `<h2
|
|
3744
|
+
/** Dialog.Title: `root` on the `<h2>`; `action` on the element of its `action` slot. */
|
|
3618
3745
|
export declare const dialogTitleClassNames: {
|
|
3619
3746
|
readonly root: "wave-dialog-title";
|
|
3747
|
+
readonly action: "wave-dialog-title__action";
|
|
3620
3748
|
};
|
|
3621
3749
|
|
|
3622
3750
|
/** Properties for the DialogTitle sub-component. */
|
|
3623
3751
|
export declare interface DialogTitleProps extends React_2.HTMLAttributes<HTMLHeadingElement> {
|
|
3624
3752
|
/** The title; any content. */
|
|
3625
3753
|
children: React_2.ReactNode;
|
|
3754
|
+
/**
|
|
3755
|
+
* Header buttons for this title, placed before the built-in Close button in the dialog's top end
|
|
3756
|
+
* corner (after `Dialog.Content`'s `titleAction`), not inside the heading, so they never become
|
|
3757
|
+
* part of the dialog's name. Outside `Dialog.Content` (in a Drawer) they render right after the
|
|
3758
|
+
* heading. Interactive: name icon-only buttons. Renders nothing when empty. Fluent's
|
|
3759
|
+
* `DialogTitle` `action`; unlike Fluent's, it is never filled by default (the Close button is
|
|
3760
|
+
* the Content's).
|
|
3761
|
+
*/
|
|
3762
|
+
action?: Slot<'span'>;
|
|
3626
3763
|
/** Ref to the heading element. */
|
|
3627
3764
|
ref?: React_2.Ref<HTMLHeadingElement>;
|
|
3628
3765
|
}
|
|
3629
3766
|
|
|
3630
3767
|
/**
|
|
3631
|
-
* Opens the dialog
|
|
3632
|
-
*
|
|
3633
|
-
*
|
|
3634
|
-
*
|
|
3635
|
-
* `
|
|
3636
|
-
*
|
|
3637
|
-
*
|
|
3638
|
-
*
|
|
3639
|
-
*
|
|
3768
|
+
* Opens and closes the dialog: a click while it is open asks it to close (reason `trigger`). Only a
|
|
3769
|
+
* non-modal dialog's trigger, or a trigger rendered inside the dialog's own content, can receive
|
|
3770
|
+
* one (a modal dialog makes the page inert). Fluent's `DialogTrigger` never toggles (outside the
|
|
3771
|
+
* surface it only opens, inside it only closes); this trigger always does. Puts
|
|
3772
|
+
* `aria-haspopup="dialog"`, `aria-expanded`, `aria-controls` (while open), a click handler and a
|
|
3773
|
+
* ref on its single child (no wrapper element), or passes them to a render-prop child. A custom
|
|
3774
|
+
* child component must forward `ref` and spread its props; one that does not is wrapped in a
|
|
3775
|
+
* `<span>` automatically (with a development warning), the span that `asChild={false}` renders.
|
|
3776
|
+
* Focus returns to the trigger when the dialog closes (with several triggers, to the one that
|
|
3777
|
+
* opened it). On the span, the state ARIA goes to the first element in the tab order inside it,
|
|
3778
|
+
* and focus returns to that element (to the span when you made it the trigger with a `role` such
|
|
3779
|
+
* as `button` and `tabIndex={0}`, or when nothing inside it can take focus).
|
|
3640
3780
|
*/
|
|
3641
3781
|
export declare const DialogTrigger: {
|
|
3642
3782
|
(props: DialogTriggerProps): React_2.ReactNode;
|
|
@@ -3646,8 +3786,9 @@ export declare const DialogTrigger: {
|
|
|
3646
3786
|
/** Properties for the DialogTrigger sub-component. */
|
|
3647
3787
|
export declare interface DialogTriggerProps extends Omit<React_2.HTMLAttributes<HTMLElement>, 'children'> {
|
|
3648
3788
|
/**
|
|
3649
|
-
* The element that opens the dialog. A single element receives the trigger props
|
|
3650
|
-
* its own: handlers composed, classes joined, its own `id` kept); a function
|
|
3789
|
+
* The element that opens and closes the dialog. A single element receives the trigger props
|
|
3790
|
+
* (merged with its own: handlers composed, classes joined, its own `id` kept); a function
|
|
3791
|
+
* receives them.
|
|
3651
3792
|
*/
|
|
3652
3793
|
children: React_2.ReactNode | ((props: DialogTriggerRenderProps) => React_2.ReactNode);
|
|
3653
3794
|
/**
|
|
@@ -3672,6 +3813,23 @@ export declare interface DialogTriggerRenderProps extends React_2.HTMLAttributes
|
|
|
3672
3813
|
ref: React_2.RefCallback<HTMLElement>;
|
|
3673
3814
|
}
|
|
3674
3815
|
|
|
3816
|
+
/** Returned by {@link useDismiss}. */
|
|
3817
|
+
export declare interface DismissLayer {
|
|
3818
|
+
/** The layer's id: pass it to `Portal layerId` or `DismissLayerProvider` around the surface. */
|
|
3819
|
+
layerId: string;
|
|
3820
|
+
/** Whether the layer is currently the topmost open layer (read at call time). */
|
|
3821
|
+
isTopmost(): boolean;
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
/**
|
|
3825
|
+
* Makes `layerId` the parent layer of everything rendered inside (`Portal layerId` does this for
|
|
3826
|
+
* its children automatically).
|
|
3827
|
+
*/
|
|
3828
|
+
export declare function DismissLayerProvider(props: {
|
|
3829
|
+
layerId: string;
|
|
3830
|
+
children: React_2.ReactNode;
|
|
3831
|
+
}): React_2.ReactElement;
|
|
3832
|
+
|
|
3675
3833
|
/** Why a popup layer is dismissed: Escape, a press outside it, or focus moving outside it. */
|
|
3676
3834
|
export declare type DismissReason = 'escape' | 'outside-press' | 'focus-outside';
|
|
3677
3835
|
|
|
@@ -3728,62 +3886,175 @@ export declare interface DividerOwnProps {
|
|
|
3728
3886
|
export declare type DividerProps<C extends React_2.ElementType = 'hr'> = PolymorphicProps<C, DividerOwnProps>;
|
|
3729
3887
|
|
|
3730
3888
|
/**
|
|
3731
|
-
* A
|
|
3732
|
-
* (inheriting the WaveProvider theme) while open
|
|
3889
|
+
* A side or bottom panel (Fluent UI v2 style): by default an overlay, modal unless it is
|
|
3890
|
+
* non-modal, rendered in a portal (inheriting the WaveProvider theme) while open; with
|
|
3891
|
+
* `type="inline"` a panel in the page layout, rendered in place. With `unmountOnClose={false}`
|
|
3892
|
+
* either kind stays mounted while closed, `hidden` and `inert`.
|
|
3733
3893
|
*
|
|
3734
3894
|
* - **Opening**: controlled (`open`), or uncontrolled with a `Drawer.Trigger` placed directly inside
|
|
3735
|
-
* the Drawer or in a Fragment there (it renders in place, outside the panel)
|
|
3895
|
+
* the Drawer or in a Fragment there (it renders in place, outside the panel); the trigger opens
|
|
3896
|
+
* and closes it.
|
|
3736
3897
|
* - **Modal**: focus moves into the panel and Tab stays inside it (toasts included), the rest of the
|
|
3737
|
-
* page is `inert` (instead of `aria-modal`), and the page does not scroll.
|
|
3898
|
+
* page is `inert` (instead of `aria-modal`), and the page does not scroll. `modalType="alert"`
|
|
3899
|
+
* renders `role="alertdialog"`, and a backdrop press does not close it.
|
|
3900
|
+
* - **Non-modal**: `modalType="non-modal"` leaves the page usable (no backdrop, no focus trap,
|
|
3901
|
+
* nothing inert, the page scrolls). Focus moves in on open; Tab and Shift+Tab leave the panel in
|
|
3902
|
+
* the page's order right after the element that opened it; Escape closes it only while focus is
|
|
3903
|
+
* inside it; presses on the page never close it; focus returns to the opener only from inside.
|
|
3904
|
+
* Reserve the panel's room in the page layout while it is open, so it hides no page control.
|
|
3905
|
+
* - **Inline**: `type="inline"` renders the panel where the Drawer is, after its direct triggers,
|
|
3906
|
+
* as an `<aside>` (a complementary landmark named by its title), also in the server HTML. It is
|
|
3907
|
+
* page content: no portal, backdrop, focus trap, inert page or scroll lock, and toasts keep
|
|
3908
|
+
* their corner next to it. Its trigger toggles it (with `aria-expanded` and `aria-controls`, no
|
|
3909
|
+
* `aria-haspopup`); opening it moves no focus; Escape and presses outside never close it;
|
|
3910
|
+
* closing it returns focus only when focus was inside. `position` picks its inner edge and
|
|
3911
|
+
* `size` its width (its height at the bottom); `separator` draws the inner edge. Place it in
|
|
3912
|
+
* your layout, for example a flex row of the panel and the page content. Changing `type`
|
|
3913
|
+
* remounts the panel and its content.
|
|
3738
3914
|
* - **Closing**: Escape (only the topmost layer: a popup opened inside closes first), a click on the
|
|
3739
|
-
* backdrop (a drag that starts inside does not close it), the Close button and `Drawer.Close
|
|
3915
|
+
* backdrop (a drag that starts inside does not close it), the Close button and `Drawer.Close`
|
|
3916
|
+
* (an inline drawer: the trigger, the Close button and `Drawer.Close`).
|
|
3740
3917
|
* `onOpenChange` gets the reason as its second argument (`details.reason`), so a controlled
|
|
3741
3918
|
* drawer can refuse some of them. A backdrop press blurs the focused field before the drawer
|
|
3742
3919
|
* closes, so a typed value is committed as with the Close button; when a controlled drawer
|
|
3743
3920
|
* refuses the press, the field gets focus back. Focus returns to the first of these that can
|
|
3744
3921
|
* take focus: `finalFocusRef`, the element that had focus when the drawer opened, the trigger,
|
|
3745
3922
|
* an element next to where that opener was.
|
|
3746
|
-
* - **
|
|
3923
|
+
* - **Size and position**: `position` is `end` (default) or `start`, which follow the text
|
|
3924
|
+
* direction, `left` or `right`, or `bottom` (along the bottom edge, the window wide). `size` sets
|
|
3925
|
+
* the width at a side and the height at the bottom: `small` (default, 320px), `medium` (592px),
|
|
3926
|
+
* `large` (940px) or `full`; the panel never grows past the window (an inline one past its
|
|
3927
|
+
* container). A width class in `className` (a height class for `bottom`) replaces the size. An
|
|
3928
|
+
* overlay panel pads the safe-area insets of the screen edges it touches (the iOS home
|
|
3929
|
+
* indicator, once the page sets `viewport-fit=cover`). Both render as `data-position` and
|
|
3930
|
+
* `data-size`, next to `data-type`.
|
|
3931
|
+
* - **Layout**: the `title` prop and the built-in Close button make the header row; a
|
|
3932
|
+
* `Drawer.Header` replaces it, with a `Drawer.HeaderNavigation` row (a Back button, commands)
|
|
3933
|
+
* and a `Drawer.HeaderTitle` (the heading, an `action` area and the Close button). The rest of
|
|
3934
|
+
* the content scrolls in the body (`Drawer.Body` gives it your props); a `Drawer.Footer` is an
|
|
3935
|
+
* action row below the body that never scrolls. Make the parts direct children of the Drawer (a
|
|
3936
|
+
* Fragment there is fine). The header draws a line under itself once the body is scrolled, the
|
|
3937
|
+
* footer one above itself while content continues below: the body, the header and the footer
|
|
3938
|
+
* render the body's scroll state as `data-scroll-state` (`none`, `top`, `middle`, `bottom`).
|
|
3939
|
+
* - **Backdrop, Close button and title actions**: the backdrop is the panel's sibling and a slot
|
|
3940
|
+
* (`backdrop`: `null` removes it, `appearance` picks `dimmed` or `transparent`); a modal opened
|
|
3941
|
+
* over another modal dims the page once. `closeButton` sets the content of every built-in Close
|
|
3942
|
+
* button, or hides them (`null`); a button passed there is merged into it. `titleAction` places
|
|
3943
|
+
* header buttons between the `title` heading and the Close button.
|
|
3944
|
+
* - **Kept mounted**: `unmountOnClose={false}` keeps the panel and its content mounted while the
|
|
3945
|
+
* drawer is closed, so a form keeps what was typed and the components inside keep their state;
|
|
3946
|
+
* each open of an overlay focuses the first focusable element again (an `autoFocus` inside never
|
|
3947
|
+
* applies), and a kept overlay opened while another overlay is open stacks above it. A kept
|
|
3948
|
+
* inline drawer is in the server HTML, hidden.
|
|
3949
|
+
* - **Presence**: the panel and the backdrop mount through the presence core and render
|
|
3950
|
+
* `data-presence` (`entered` while open, `exited` while kept closed); the backdrop and the
|
|
3951
|
+
* panel (an inline drawer's `<aside>`) are `inert` while exiting and `hidden` and `inert` while
|
|
3952
|
+
* kept closed. No motion ships:
|
|
3953
|
+
* `data-[presence=…]:` classes in `className` animate the panel, whose motion a closed drawer
|
|
3954
|
+
* waits for before it unmounts or hides (focus, the trap and the isolation follow the open
|
|
3955
|
+
* state at once).
|
|
3747
3956
|
*
|
|
3748
3957
|
* The sub-components are also exported under flat names (`DrawerTrigger`, `DrawerClose`,
|
|
3749
|
-
* `DrawerTitle`
|
|
3958
|
+
* `DrawerTitle`, `DrawerHeader`, `DrawerHeaderTitle`, `DrawerHeaderNavigation`, `DrawerBody`,
|
|
3959
|
+
* `DrawerFooter`) for React Server Components, which cannot use the dotted form; dotted access
|
|
3750
3960
|
* (`Drawer.Trigger`) needs a client file.
|
|
3751
3961
|
*
|
|
3752
3962
|
* @example
|
|
3753
|
-
* <Drawer
|
|
3963
|
+
* <Drawer>
|
|
3754
3964
|
* <Drawer.Trigger><Button>Filters</Button></Drawer.Trigger>
|
|
3755
|
-
* <
|
|
3756
|
-
*
|
|
3965
|
+
* <Drawer.Header>
|
|
3966
|
+
* <Drawer.HeaderTitle>Filters</Drawer.HeaderTitle>
|
|
3967
|
+
* </Drawer.Header>
|
|
3968
|
+
* <FilterForm id="filters" />
|
|
3969
|
+
* <Drawer.Footer>
|
|
3970
|
+
* <Button appearance="primary" type="submit" form="filters">Apply</Button>
|
|
3971
|
+
* <Drawer.Close><Button>Cancel</Button></Drawer.Close>
|
|
3972
|
+
* </Drawer.Footer>
|
|
3757
3973
|
* </Drawer>
|
|
3758
3974
|
*/
|
|
3759
3975
|
export declare const Drawer: {
|
|
3760
|
-
({ open: openProp, defaultOpen, onOpenChange, position, title, closeLabel, finalFocusRef,
|
|
3976
|
+
({ open: openProp, defaultOpen, onOpenChange, type, separator, position, size, modalType, backdrop, closeButton, titleAction, title, closeLabel, finalFocusRef, unmountOnClose, children, id, ref, ...rest }: DrawerProps): JSX.Element;
|
|
3761
3977
|
displayName: string;
|
|
3762
3978
|
} & {
|
|
3763
3979
|
Trigger: {
|
|
3764
|
-
(props: DrawerTriggerProps):
|
|
3980
|
+
(props: DrawerTriggerProps): ReactNode;
|
|
3765
3981
|
displayName: string;
|
|
3766
3982
|
};
|
|
3767
3983
|
Close: {
|
|
3768
|
-
(props: DrawerCloseProps):
|
|
3984
|
+
(props: DrawerCloseProps): ReactNode;
|
|
3769
3985
|
displayName: string;
|
|
3770
3986
|
};
|
|
3771
3987
|
Title: {
|
|
3772
|
-
({ id, className, children, ref, ...rest }: DrawerTitleProps):
|
|
3988
|
+
({ id, headingLevel, className, children, ref, ...rest }: DrawerTitleProps): JSX.Element;
|
|
3989
|
+
displayName: string;
|
|
3990
|
+
};
|
|
3991
|
+
Header: {
|
|
3992
|
+
({ className, children, ref, ...rest }: DrawerHeaderProps): JSX.Element | null;
|
|
3773
3993
|
displayName: string;
|
|
3774
3994
|
};
|
|
3995
|
+
HeaderTitle: {
|
|
3996
|
+
({ id, headingLevel, action, className, children, ref, ...rest }: DrawerHeaderTitleProps): JSX.Element;
|
|
3997
|
+
displayName: string;
|
|
3998
|
+
};
|
|
3999
|
+
HeaderNavigation: {
|
|
4000
|
+
({ className, children, ref, ...rest }: DrawerHeaderNavigationProps): JSX.Element;
|
|
4001
|
+
displayName: string;
|
|
4002
|
+
};
|
|
4003
|
+
Body: {
|
|
4004
|
+
({ className, children, ref, ...rest }: DrawerBodyProps): JSX.Element;
|
|
4005
|
+
displayName: string;
|
|
4006
|
+
};
|
|
4007
|
+
Footer: {
|
|
4008
|
+
({ className, children, ref, ...rest }: DrawerFooterProps): JSX.Element | null;
|
|
4009
|
+
displayName: string;
|
|
4010
|
+
};
|
|
4011
|
+
};
|
|
4012
|
+
|
|
4013
|
+
/**
|
|
4014
|
+
* Optional: gives the drawer's scrolling body your props (`className`, `style`, `ref`, `id`,
|
|
4015
|
+
* `role`, `tabIndex`, `aria-*`, `data-*`, handlers), for example `tabIndex={0} role="region"
|
|
4016
|
+
* aria-label="…"` to let the keyboard scroll a body without focusable content (the body then
|
|
4017
|
+
* shows the focus ring inside its edge). Its children render in its place among the drawer's
|
|
4018
|
+
* other content. Make it a direct child of `Drawer` (a Fragment there is fine) and render one;
|
|
4019
|
+
* nested in an element or rendered by a component of yours it renders as an element inside the
|
|
4020
|
+
* body, with a development warning. Fluent's `DrawerBody`.
|
|
4021
|
+
*/
|
|
4022
|
+
export declare const DrawerBody: {
|
|
4023
|
+
({ className, children, ref, ...rest }: DrawerBodyProps): React_2.JSX.Element;
|
|
4024
|
+
displayName: string;
|
|
4025
|
+
};
|
|
4026
|
+
|
|
4027
|
+
/**
|
|
4028
|
+
* Drawer.Body: `root` on the scrolling body while a Drawer.Body gives it its props (the body also
|
|
4029
|
+
* carries Drawer's `body`), or on the element of a Drawer.Body rendered inside the body.
|
|
4030
|
+
*/
|
|
4031
|
+
export declare const drawerBodyClassNames: {
|
|
4032
|
+
readonly root: "wave-drawer-body";
|
|
3775
4033
|
};
|
|
3776
4034
|
|
|
4035
|
+
/** Properties for the DrawerBody sub-component. */
|
|
4036
|
+
export declare interface DrawerBodyProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4037
|
+
/** Content of the scrolling body, rendered in the Body's place among the other content. */
|
|
4038
|
+
children?: React_2.ReactNode;
|
|
4039
|
+
/** Ref to the scrolling body element. */
|
|
4040
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4041
|
+
}
|
|
4042
|
+
|
|
3777
4043
|
/**
|
|
3778
|
-
* Drawer: `root` on the
|
|
3779
|
-
*
|
|
3780
|
-
*
|
|
3781
|
-
*
|
|
4044
|
+
* Drawer: `root` on the panel (the portaled `role="dialog"` element of an overlay drawer, while it
|
|
4045
|
+
* is open or kept mounted, or the `<aside>` of an inline one); `backdrop` on the backdrop of a
|
|
4046
|
+
* modal or alert overlay drawer; `header` on the built-in header row (absent with a
|
|
4047
|
+
* Drawer.Header); `titleAction` on the element of the `titleAction` slot in that row;
|
|
4048
|
+
* `closeButton` on every built-in Close button (which also carries Button's root), in the built-in
|
|
4049
|
+
* header and in each Drawer.HeaderTitle; `body` on the scrolling body. The heading of its `title`
|
|
4050
|
+
* prop carries Drawer.Title's class. The panel carries `data-type`, `data-position` and
|
|
4051
|
+
* `data-size`; the body, the header and the footer carry `data-scroll-state`.
|
|
3782
4052
|
*/
|
|
3783
4053
|
export declare const drawerClassNames: {
|
|
3784
4054
|
readonly root: "wave-drawer";
|
|
3785
4055
|
readonly backdrop: "wave-drawer__backdrop";
|
|
3786
4056
|
readonly header: "wave-drawer__header";
|
|
4057
|
+
readonly titleAction: "wave-drawer__title-action";
|
|
3787
4058
|
readonly closeButton: "wave-drawer__close-button";
|
|
3788
4059
|
readonly body: "wave-drawer__body";
|
|
3789
4060
|
};
|
|
@@ -3818,11 +4089,144 @@ export declare interface DrawerCloseRenderProps extends React_2.HTMLAttributes<H
|
|
|
3818
4089
|
ref: React_2.RefCallback<HTMLElement>;
|
|
3819
4090
|
}
|
|
3820
4091
|
|
|
3821
|
-
/**
|
|
4092
|
+
/**
|
|
4093
|
+
* The drawer's action row, below the scrolling body: it never scrolls and never covers a focused
|
|
4094
|
+
* field. Its actions start at the inline start and wrap. Make it a direct child of `Drawer` (a
|
|
4095
|
+
* Fragment there is fine): it renders after the body wherever it is written; nested in an element
|
|
4096
|
+
* (a `<form>`) or rendered by a component of yours it renders where it is, in the body, with a
|
|
4097
|
+
* development warning. For a form in the body, give the footer's submit button `form={formId}`.
|
|
4098
|
+
* It draws a line above itself while content continues below (`data-scroll-state`). A footer
|
|
4099
|
+
* whose children render nothing renders no element. Fluent's `DrawerFooter`.
|
|
4100
|
+
*/
|
|
4101
|
+
export declare const DrawerFooter: {
|
|
4102
|
+
({ className, children, ref, ...rest }: DrawerFooterProps): React_2.JSX.Element | null;
|
|
4103
|
+
displayName: string;
|
|
4104
|
+
};
|
|
4105
|
+
|
|
4106
|
+
/** Drawer.Footer: `root` on the footer element. */
|
|
4107
|
+
export declare const drawerFooterClassNames: {
|
|
4108
|
+
readonly root: "wave-drawer-footer";
|
|
4109
|
+
};
|
|
4110
|
+
|
|
4111
|
+
/** Properties for the DrawerFooter sub-component. */
|
|
4112
|
+
export declare interface DrawerFooterProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4113
|
+
/** The drawer's actions, typically buttons (wrap closing ones in `Drawer.Close`). */
|
|
4114
|
+
children?: React_2.ReactNode;
|
|
4115
|
+
/** Ref to the footer element. */
|
|
4116
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
/**
|
|
4120
|
+
* The drawer's header, replacing the built-in one (the `title` and Close button row): a
|
|
4121
|
+
* `Drawer.HeaderNavigation` row and a `Drawer.HeaderTitle`, or your own content. The built-in
|
|
4122
|
+
* Close button ends each `Drawer.HeaderTitle`; a header without one has no Close button (wrap your
|
|
4123
|
+
* own in `Drawer.Close`). Make it a direct child of `Drawer` (a Fragment there is fine); nested in
|
|
4124
|
+
* an element or rendered by a component of yours it renders in the body, with a development
|
|
4125
|
+
* warning. It draws a line under itself while the body is scrolled away from its top
|
|
4126
|
+
* (`data-scroll-state`). When an overlay drawer opens, focus goes to the header's first focusable
|
|
4127
|
+
* element (a Back button, a title action): give the control that should start `autoFocus`. A
|
|
4128
|
+
* header whose children render nothing renders no element (the drawer then has no header; Escape
|
|
4129
|
+
* and the backdrop of an overlay, and `Drawer.Close`, still close it). Fluent's `DrawerHeader`.
|
|
4130
|
+
*/
|
|
4131
|
+
export declare const DrawerHeader: {
|
|
4132
|
+
({ className, children, ref, ...rest }: DrawerHeaderProps): React_2.JSX.Element | null;
|
|
4133
|
+
displayName: string;
|
|
4134
|
+
};
|
|
4135
|
+
|
|
4136
|
+
/** Drawer.Header: `root` on the header element (it replaces the built-in header row). */
|
|
4137
|
+
export declare const drawerHeaderClassNames: {
|
|
4138
|
+
readonly root: "wave-drawer-header";
|
|
4139
|
+
};
|
|
4140
|
+
|
|
4141
|
+
/**
|
|
4142
|
+
* A `<nav>` row at the top of `Drawer.Header`, for a multi-level drawer's Back button and the
|
|
4143
|
+
* drawer's commands. Give it an `aria-label` when the page has other navigation landmarks.
|
|
4144
|
+
* Fluent's `DrawerHeaderNavigation`.
|
|
4145
|
+
*/
|
|
4146
|
+
export declare const DrawerHeaderNavigation: {
|
|
4147
|
+
({ className, children, ref, ...rest }: DrawerHeaderNavigationProps): React_2.JSX.Element;
|
|
4148
|
+
displayName: string;
|
|
4149
|
+
};
|
|
4150
|
+
|
|
4151
|
+
/** Drawer.HeaderNavigation: `root` on the navigation element. */
|
|
4152
|
+
export declare const drawerHeaderNavigationClassNames: {
|
|
4153
|
+
readonly root: "wave-drawer-header-navigation";
|
|
4154
|
+
};
|
|
4155
|
+
|
|
4156
|
+
/** Properties for the DrawerHeaderNavigation sub-component. */
|
|
4157
|
+
export declare interface DrawerHeaderNavigationProps extends React_2.HTMLAttributes<HTMLElement> {
|
|
4158
|
+
/** The navigation controls: a Back button, a Toolbar of commands. */
|
|
4159
|
+
children?: React_2.ReactNode;
|
|
4160
|
+
/** Ref to the `<nav>` element. */
|
|
4161
|
+
ref?: React_2.Ref<HTMLElement>;
|
|
4162
|
+
}
|
|
4163
|
+
|
|
4164
|
+
/** Properties for the DrawerHeader sub-component. */
|
|
4165
|
+
export declare interface DrawerHeaderProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4166
|
+
/** `Drawer.HeaderNavigation`, `Drawer.HeaderTitle`, or any content, in the order written. */
|
|
4167
|
+
children?: React_2.ReactNode;
|
|
4168
|
+
/** Ref to the header element. */
|
|
4169
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4170
|
+
}
|
|
4171
|
+
|
|
4172
|
+
/**
|
|
4173
|
+
* A title row for `Drawer.Header`: the heading that names the drawer, your `action` content and
|
|
4174
|
+
* the built-in Close button (named by the Drawer's `closeLabel`; the Drawer's `closeButton` sets
|
|
4175
|
+
* its content, or hides it with `null`), in that DOM and Tab order.
|
|
4176
|
+
* Render one per header; `headingLevel` picks the heading element (`h2` by default). Outside a
|
|
4177
|
+
* `Drawer.Header` it renders without the Close button and warns: use `Drawer.Title` for a heading
|
|
4178
|
+
* in the body. Unlike Fluent's `DrawerHeaderTitle`, whose `action` is where you put a close
|
|
4179
|
+
* button, it renders the Close button itself.
|
|
4180
|
+
*/
|
|
4181
|
+
export declare const DrawerHeaderTitle: {
|
|
4182
|
+
({ id, headingLevel, action, className, children, ref, ...rest }: DrawerHeaderTitleProps): React_2.JSX.Element;
|
|
4183
|
+
displayName: string;
|
|
4184
|
+
};
|
|
4185
|
+
|
|
4186
|
+
/**
|
|
4187
|
+
* Drawer.HeaderTitle: `root` on the title row; `heading` on the heading that names the drawer;
|
|
4188
|
+
* `action` on the element of the `action` slot. Its Close button carries Drawer's `closeButton`.
|
|
4189
|
+
*/
|
|
4190
|
+
export declare const drawerHeaderTitleClassNames: {
|
|
4191
|
+
readonly root: "wave-drawer-header-title";
|
|
4192
|
+
readonly heading: "wave-drawer-header-title__heading";
|
|
4193
|
+
readonly action: "wave-drawer-header-title__action";
|
|
4194
|
+
};
|
|
4195
|
+
|
|
4196
|
+
/** Properties for the DrawerHeaderTitle sub-component. */
|
|
4197
|
+
export declare interface DrawerHeaderTitleProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4198
|
+
/** The title; any content. The heading names the drawer (`aria-labelledby`). */
|
|
4199
|
+
children: React_2.ReactNode;
|
|
4200
|
+
/**
|
|
4201
|
+
* Content between the heading and the built-in Close button, such as icon buttons for the
|
|
4202
|
+
* drawer's own commands (Fluent's `action`). It comes before the Close button in DOM and Tab
|
|
4203
|
+
* order and is interactive (not `aria-hidden`): name icon-only buttons. Renders nothing when it
|
|
4204
|
+
* renders no content.
|
|
4205
|
+
*/
|
|
4206
|
+
action?: Slot<'span'>;
|
|
4207
|
+
/** Id of the heading element, the element that names the drawer. @default a generated id */
|
|
4208
|
+
id?: string;
|
|
4209
|
+
/**
|
|
4210
|
+
* Level of the heading element (`h1` … `h6`). Fluent's `heading` slot, which also takes another
|
|
4211
|
+
* element.
|
|
4212
|
+
* @default 2
|
|
4213
|
+
*/
|
|
4214
|
+
headingLevel?: HeadingLevel;
|
|
4215
|
+
/** Ref to the title row (the heading's parent). */
|
|
4216
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4217
|
+
}
|
|
4218
|
+
|
|
4219
|
+
/**
|
|
4220
|
+
* How a `Drawer` relates to the page: `modal`, `alert` or `non-modal` (the shared `ModalType`;
|
|
4221
|
+
* `DialogModalType` is the same type).
|
|
4222
|
+
*/
|
|
4223
|
+
export declare type DrawerModalType = ModalType;
|
|
4224
|
+
|
|
4225
|
+
/** The second argument of a `Drawer`'s `onOpenChange`: the reason and the DOM event. */
|
|
3822
4226
|
export declare type DrawerOpenChangeDetails = OpenChangeDetails<DrawerOpenChangeReason>;
|
|
3823
4227
|
|
|
3824
4228
|
/**
|
|
3825
|
-
* Why a
|
|
4229
|
+
* Why a `Drawer` asks to open or close: `trigger` (`Drawer.Trigger`), `close`
|
|
3826
4230
|
* (`Drawer.Close`), `close-button` (the built-in Close button), `escape`, `outside-press` (the
|
|
3827
4231
|
* backdrop). The shared `ModalOpenChangeReason`, as for Dialog.
|
|
3828
4232
|
*/
|
|
@@ -3830,20 +4234,23 @@ export declare type DrawerOpenChangeReason = ModalOpenChangeReason;
|
|
|
3830
4234
|
|
|
3831
4235
|
/**
|
|
3832
4236
|
* Side of the screen the drawer is attached to. `start`/`end` follow the text direction (in a
|
|
3833
|
-
* right-to-left layout `end` is the left edge); `left`/`right` are physical sides
|
|
4237
|
+
* right-to-left layout `end` is the left edge); `left`/`right` are physical sides; `bottom` runs
|
|
4238
|
+
* along the bottom edge, as wide as the viewport. An inline drawer sits where the page layout puts
|
|
4239
|
+
* it: the position picks its inner edge (the one facing the page content) and its size's axis.
|
|
3834
4240
|
*/
|
|
3835
|
-
export declare type DrawerPosition = 'start' | 'end' | 'left' | 'right';
|
|
4241
|
+
export declare type DrawerPosition = 'start' | 'end' | 'left' | 'right' | 'bottom';
|
|
3836
4242
|
|
|
3837
4243
|
/** Properties for the Drawer component. */
|
|
3838
|
-
export declare interface DrawerProps extends Omit<React_2.HTMLAttributes<
|
|
4244
|
+
export declare interface DrawerProps extends Omit<React_2.HTMLAttributes<HTMLElement>, 'title'> {
|
|
3839
4245
|
/**
|
|
3840
|
-
* Controlled open state of the drawer.
|
|
3841
|
-
* is closed in the server HTML and opens once it has hydrated.
|
|
4246
|
+
* Controlled open state of the drawer. An overlay drawer's panel renders only in the browser:
|
|
4247
|
+
* open, it is closed in the server HTML and opens once it has hydrated. An inline drawer renders
|
|
4248
|
+
* in the server HTML: open, or hidden when kept mounted (`unmountOnClose={false}`).
|
|
3842
4249
|
*/
|
|
3843
4250
|
open?: boolean;
|
|
3844
4251
|
/**
|
|
3845
|
-
* Default open state for uncontrolled usage.
|
|
3846
|
-
*
|
|
4252
|
+
* Default open state for uncontrolled usage. An overlay drawer open by default is closed in the
|
|
4253
|
+
* server HTML and opens once it has hydrated; an inline one is open in the server HTML.
|
|
3847
4254
|
* @default false
|
|
3848
4255
|
*/
|
|
3849
4256
|
defaultOpen?: boolean;
|
|
@@ -3853,61 +4260,193 @@ export declare interface DrawerProps extends Omit<React_2.HTMLAttributes<HTMLDiv
|
|
|
3853
4260
|
* `outside-press` (the backdrop) — so a controlled drawer can refuse only some ways of closing
|
|
3854
4261
|
* (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the
|
|
3855
4262
|
* DOM event behind the request. WaveUI always passes `details`; it is typed optional until 1.0
|
|
3856
|
-
* so that code which calls this prop itself keeps compiling.
|
|
4263
|
+
* so that code which calls this prop itself keeps compiling. An inline drawer asks only with
|
|
4264
|
+
* `trigger` (its `Drawer.Trigger` toggles it), `close` and `close-button`: Escape and presses
|
|
4265
|
+
* outside it never close it.
|
|
3857
4266
|
*
|
|
3858
4267
|
* Fires only when the value changes; a controlled drawer stays as it is until the parent updates
|
|
3859
4268
|
* `open`.
|
|
3860
4269
|
*/
|
|
3861
4270
|
onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;
|
|
4271
|
+
/**
|
|
4272
|
+
* How the drawer sits on the page (Fluent's `type`).
|
|
4273
|
+
* - `overlay`: a panel over the page, rendered in a portal while open: modal by default (focus
|
|
4274
|
+
* moves in and stays there, toasts included; the rest of the page is `inert` and does not
|
|
4275
|
+
* scroll; Escape and a backdrop press close it), or `modalType="non-modal"`.
|
|
4276
|
+
* - `inline`: a panel in the page layout, rendered where the Drawer is (after its direct
|
|
4277
|
+
* `Drawer.Trigger`s) as an `<aside>`, a complementary landmark named by its title. The page
|
|
4278
|
+
* stays usable around it: no backdrop, no focus trap, no portal, no scroll lock; Escape and
|
|
4279
|
+
* presses outside do not close it. Opening it leaves focus where it is; closing it while focus
|
|
4280
|
+
* is inside returns focus to `finalFocusRef`, else the element that opened it, else the
|
|
4281
|
+
* trigger. `position` and `size` pick its inner edge and its width (its height at the bottom);
|
|
4282
|
+
* where it sits is up to your layout (a flex row of panel and content, for example).
|
|
4283
|
+
* `modalType` and `backdrop` do not apply to it, and toasts do not move out of its way: it is
|
|
4284
|
+
* page content.
|
|
4285
|
+
*
|
|
4286
|
+
* Changing `type` remounts the panel and its content (what was typed in it is lost); focus
|
|
4287
|
+
* inside an overlay that becomes inline returns to the trigger, and focus inside an inline panel
|
|
4288
|
+
* that becomes an overlay moves into the overlay. Rendered as `data-type`.
|
|
4289
|
+
* @default 'overlay'
|
|
4290
|
+
*/
|
|
4291
|
+
type?: DrawerType;
|
|
4292
|
+
/**
|
|
4293
|
+
* Inline drawers: draws a line on the panel's inner edge, the edge facing the page content
|
|
4294
|
+
* (`data-separator`). An overlay drawer always draws that edge and ignores this prop. In forced
|
|
4295
|
+
* colours an inline drawer's inner edge is always drawn. Fluent's `separator`.
|
|
4296
|
+
* @default false
|
|
4297
|
+
*/
|
|
4298
|
+
separator?: boolean;
|
|
3862
4299
|
/**
|
|
3863
4300
|
* Side of the screen the drawer is attached to. `start`/`end` follow the text direction;
|
|
3864
|
-
* `left`/`right` are physical sides
|
|
4301
|
+
* `left`/`right` are physical sides; `bottom` runs along the bottom edge (`size` sets its
|
|
4302
|
+
* height). An inline drawer takes its place from your layout: `position` picks its inner edge
|
|
4303
|
+
* (the one facing the page content: the end edge of a `start` panel, the top edge of a `bottom`
|
|
4304
|
+
* one) and the axis `size` sets. Rendered as `data-position`.
|
|
3865
4305
|
* @default 'end'
|
|
3866
4306
|
*/
|
|
3867
4307
|
position?: DrawerPosition;
|
|
3868
4308
|
/**
|
|
3869
|
-
*
|
|
3870
|
-
*
|
|
3871
|
-
*
|
|
4309
|
+
* The panel's width at a side — `small` 320px, `medium` 592px, `large` 940px, `full` the
|
|
4310
|
+
* viewport's width — or its height at the bottom (the same values; `full` the viewport's height).
|
|
4311
|
+
* It never exceeds the viewport. An inline panel takes the same sizes, where `full` is its
|
|
4312
|
+
* container's width (height), and never grows past its container. A width class in `className`
|
|
4313
|
+
* (a height class for `bottom`) replaces it. Rendered as `data-size`. Fluent's `size`.
|
|
4314
|
+
* @default 'small'
|
|
4315
|
+
*/
|
|
4316
|
+
size?: DrawerSize;
|
|
4317
|
+
/**
|
|
4318
|
+
* `modal`, `alert` or `non-modal`, as Dialog's `modalType`. `modal`: the page behind is `inert`
|
|
4319
|
+
* and does not scroll; a backdrop press, Escape, the Close button and `Drawer.Close` close it.
|
|
4320
|
+
* `alert`: `role="alertdialog"` (a `role` you pass wins), and a backdrop press does not close it
|
|
4321
|
+
* (Escape still does). `non-modal`: no backdrop, and the page stays usable — no focus trap,
|
|
4322
|
+
* nothing inert, the page scrolls; Tab and Shift+Tab leave the drawer in the page's order right
|
|
4323
|
+
* after the element that opened it, Escape closes it while focus is inside it, presses on the
|
|
4324
|
+
* page never close it, and focus returns to the opener only when it was inside the drawer. A
|
|
4325
|
+
* non-modal drawer covers the page under it while Tab still reaches that page: reserve its width
|
|
4326
|
+
* (its height at the bottom) in your layout while it is open, or use `modal`, or, for a panel
|
|
4327
|
+
* beside the content, an inline drawer (`type="inline"`) (with `size="full"` it covers
|
|
4328
|
+
* everything, and a development warning says so). Every type moves focus to the first focusable
|
|
4329
|
+
* element on open. Rendered as `data-modal-type`. Ignored by an inline drawer, which is never
|
|
4330
|
+
* modal and renders no `data-modal-type`. Fluent's `modalType`.
|
|
4331
|
+
* @default 'modal'
|
|
4332
|
+
*/
|
|
4333
|
+
modalType?: DrawerModalType;
|
|
4334
|
+
/**
|
|
4335
|
+
* The backdrop of a modal or alert drawer, as `Dialog.Content`'s `backdrop`: a `div` behind the
|
|
4336
|
+
* panel, `aria-hidden`. Shorthand content renders inside it; a slot object's `className` (merged
|
|
4337
|
+
* last), `style`, data attributes, `ref` and handlers go to it, and its `appearance`
|
|
4338
|
+
* (`'dimmed'` or `'transparent'`) overrides the automatic one: while another modal Dialog or
|
|
4339
|
+
* Drawer is open below this one the backdrop is transparent, so the page is dimmed once. `null`
|
|
4340
|
+
* renders no backdrop (the page stays inert, and a press outside still closes a modal drawer); a
|
|
4341
|
+
* boolean is no slot. Ignored with `modalType="non-modal"` and by an inline drawer (a
|
|
4342
|
+
* development warning says so). Fluent's `backdrop`.
|
|
4343
|
+
*/
|
|
4344
|
+
backdrop?: Slot<'div'> | (SlotObject<'div'> & {
|
|
4345
|
+
appearance?: BackdropAppearance;
|
|
4346
|
+
});
|
|
4347
|
+
/**
|
|
4348
|
+
* Content of the built-in Close button, in the built-in header and in every
|
|
4349
|
+
* `Drawer.HeaderTitle`, as `Dialog.Content`'s `closeButton`: decorative content inside the button
|
|
4350
|
+
* (the dismiss glyph by default), so the button keeps the name `closeLabel`; a slot object's
|
|
4351
|
+
* `aria-label`, `aria-labelledby` or `title` names it instead, and its handlers run before the
|
|
4352
|
+
* close (`preventDefault()` keeps the drawer open). `null` hides them all (`Drawer.Close`, and
|
|
4353
|
+
* Escape on an overlay, still close); a boolean is no slot; content that renders nothing keeps the
|
|
4354
|
+
* default glyph. A `<button>` or Wave `Button` passed here is merged into the built-in button,
|
|
4355
|
+
* never nested (a development warning says so), and its text label names the button. Fluent's
|
|
4356
|
+
* `DrawerHeaderTitle` `action` holds Fluent's close button; WaveUI renders its own.
|
|
4357
|
+
*/
|
|
4358
|
+
closeButton?: Slot<'span'>;
|
|
4359
|
+
/**
|
|
4360
|
+
* Header buttons for the `title` prop form, between the heading and the built-in Close button in
|
|
4361
|
+
* DOM and Tab order. Ignored, with a development warning, next to a `Drawer.Header` (use the
|
|
4362
|
+
* `action` of `Drawer.HeaderTitle`). Interactive: name icon-only buttons. Renders nothing when
|
|
4363
|
+
* empty. Fluent's `DrawerHeaderTitle` `action`, for the `title` prop form.
|
|
4364
|
+
*/
|
|
4365
|
+
titleAction?: Slot<'span'>;
|
|
4366
|
+
/**
|
|
4367
|
+
* Title displayed in the built-in header; it names the drawer (`aria-labelledby`). Without it,
|
|
4368
|
+
* render a `Drawer.HeaderTitle` (in a `Drawer.Header`) or a `Drawer.Title`, or pass
|
|
4369
|
+
* `aria-label`/`aria-labelledby`. A title that renders nothing (`''`, `[]`, `true`) counts as
|
|
4370
|
+
* none. Ignored, with a development warning, when the children hold a `Drawer.Header`, which
|
|
4371
|
+
* replaces the built-in header. The heading is an `<h2>`; for another level use
|
|
4372
|
+
* `Drawer.HeaderTitle` with `headingLevel`. In the server HTML of an inline drawer only `title`
|
|
4373
|
+
* (or `aria-label`/`aria-labelledby`) names the panel: a `Drawer.HeaderTitle` or `Drawer.Title`
|
|
4374
|
+
* names it once the page has hydrated.
|
|
3872
4375
|
*/
|
|
3873
4376
|
title?: React_2.ReactNode;
|
|
3874
4377
|
/**
|
|
3875
|
-
* Accessible name of the built-in Close button (an icon-only button)
|
|
3876
|
-
* page's language.
|
|
4378
|
+
* Accessible name of the built-in Close button (an icon-only button), in the built-in header and
|
|
4379
|
+
* in every `Drawer.HeaderTitle`. Localize it with the page's language. A text label of a button
|
|
4380
|
+
* merged into `closeButton` names it instead.
|
|
3877
4381
|
* @default 'Close'
|
|
3878
4382
|
*/
|
|
3879
4383
|
closeLabel?: string;
|
|
3880
4384
|
/**
|
|
3881
4385
|
* Where focus goes when the drawer closes, if it can take focus. Otherwise focus returns to the
|
|
3882
4386
|
* element that had focus when the drawer opened, then to the trigger, then to an element next to
|
|
3883
|
-
* where that opener was.
|
|
4387
|
+
* where that opener was. An inline or non-modal drawer moves focus on close only when focus was
|
|
4388
|
+
* inside it.
|
|
3884
4389
|
*/
|
|
3885
4390
|
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
3886
4391
|
/**
|
|
3887
|
-
*
|
|
3888
|
-
*
|
|
3889
|
-
*
|
|
3890
|
-
*
|
|
3891
|
-
*
|
|
3892
|
-
*
|
|
3893
|
-
*
|
|
4392
|
+
* Removes the panel and its content when the drawer closes. `false` keeps them mounted while
|
|
4393
|
+
* closed, `hidden` and `inert` (out of the layout, the Tab order and the accessibility tree), so
|
|
4394
|
+
* what was typed and the state of the components inside survive closing and opening again; the
|
|
4395
|
+
* content then mounts with the Drawer, closed, and an `autoFocus` inside it never applies (an
|
|
4396
|
+
* overlay focuses its first focusable element on each open). An overlay panel still renders only
|
|
4397
|
+
* in the browser; a kept inline panel is in the server HTML, hidden. Kept content still belongs
|
|
4398
|
+
* to its form: a `required` empty field in a closed inline drawer inside a page `<form>` blocks
|
|
4399
|
+
* its submission without a visible message. A popup opened inside that is still open when the
|
|
4400
|
+
* drawer closes stays open over the page (a development warning says so): close it first. A
|
|
4401
|
+
* `key` on the Drawer resets the kept content. Fluent's `unmountOnClose`.
|
|
4402
|
+
* @default true
|
|
4403
|
+
*/
|
|
4404
|
+
unmountOnClose?: boolean;
|
|
4405
|
+
/**
|
|
4406
|
+
* The drawer's content, placed by the Drawer, also from a Fragment (`{isMobile && <>…</>}`) and
|
|
4407
|
+
* when written in a Server Component: `Drawer.Trigger` children render in place (outside the
|
|
4408
|
+
* panel); a `Drawer.Header` replaces the built-in header (the `title` and Close button row); a
|
|
4409
|
+
* `Drawer.Body` gives the scrolling body its props; `Drawer.Footer` renders below the scrolling
|
|
4410
|
+
* body, outside it, wherever it is written among the children; everything else renders in the
|
|
4411
|
+
* scrolling body. A part nested in another element (a `<form>`) or rendered by a component of
|
|
4412
|
+
* yours renders where it is, in the body (a development warning says so). A `Drawer.Trigger`
|
|
4413
|
+
* nested in another element, or rendered by a component, is panel content, so it is not rendered
|
|
4414
|
+
* (or, kept mounted, is hidden) while the drawer is closed (development warnings say so, also
|
|
4415
|
+
* when an uncontrolled drawer still has no direct trigger a second after it mounts and therefore
|
|
4416
|
+
* cannot open; a controlled drawer whose trigger a component such as a Tooltip wraps warns only
|
|
4417
|
+
* once it renders in the panel).
|
|
3894
4418
|
* Put wrappers inside the trigger instead: see `Drawer.Trigger`.
|
|
3895
4419
|
*/
|
|
3896
4420
|
children: React_2.ReactNode;
|
|
3897
|
-
/**
|
|
3898
|
-
|
|
4421
|
+
/**
|
|
4422
|
+
* Ref to the panel: the `role="dialog"` element of an overlay drawer (`alertdialog` with
|
|
4423
|
+
* `modalType="alert"`), the `<aside>` of an inline one. A ref to a `div` still type-checks.
|
|
4424
|
+
*/
|
|
4425
|
+
ref?: React_2.Ref<HTMLElement>;
|
|
3899
4426
|
}
|
|
3900
4427
|
|
|
4428
|
+
/**
|
|
4429
|
+
* How much room a Drawer takes: its width at a side, its height at the bottom. `small` 320px,
|
|
4430
|
+
* `medium` 592px, `large` 940px; `full` the viewport (an inline drawer: its container). The shared
|
|
4431
|
+
* `SurfaceSize`.
|
|
4432
|
+
*/
|
|
4433
|
+
export declare type DrawerSize = SurfaceSize;
|
|
4434
|
+
|
|
3901
4435
|
/**
|
|
3902
4436
|
* A heading that names the drawer (`aria-labelledby`), for rich titles or custom layouts. Render it
|
|
3903
|
-
* inside the Drawer's content (instead of the `title` prop)
|
|
4437
|
+
* inside the Drawer's content (instead of the `title` prop); for the title of a composed header,
|
|
4438
|
+
* use `Drawer.HeaderTitle` in a `Drawer.Header`. `headingLevel` picks the heading element (`h2`
|
|
4439
|
+
* by default).
|
|
3904
4440
|
*/
|
|
3905
4441
|
export declare const DrawerTitle: {
|
|
3906
|
-
({ id, className, children, ref, ...rest }: DrawerTitleProps): React_2.JSX.Element;
|
|
4442
|
+
({ id, headingLevel, className, children, ref, ...rest }: DrawerTitleProps): React_2.JSX.Element;
|
|
3907
4443
|
displayName: string;
|
|
3908
4444
|
};
|
|
3909
4445
|
|
|
3910
|
-
/**
|
|
4446
|
+
/**
|
|
4447
|
+
* Drawer.Title: `root` on its heading (an `<h2>`, or the level `headingLevel` picks); also on the
|
|
4448
|
+
* heading of Drawer's `title` prop.
|
|
4449
|
+
*/
|
|
3911
4450
|
export declare const drawerTitleClassNames: {
|
|
3912
4451
|
readonly root: "wave-drawer-title";
|
|
3913
4452
|
};
|
|
@@ -3916,21 +4455,34 @@ export declare const drawerTitleClassNames: {
|
|
|
3916
4455
|
export declare interface DrawerTitleProps extends React_2.HTMLAttributes<HTMLHeadingElement> {
|
|
3917
4456
|
/** The title; any content. */
|
|
3918
4457
|
children: React_2.ReactNode;
|
|
4458
|
+
/**
|
|
4459
|
+
* Level of the heading element (`h1` … `h6`). Fluent's `heading` slot, which also takes another
|
|
4460
|
+
* element.
|
|
4461
|
+
* @default 2
|
|
4462
|
+
*/
|
|
4463
|
+
headingLevel?: HeadingLevel;
|
|
3919
4464
|
/** Ref to the heading element. */
|
|
3920
4465
|
ref?: React_2.Ref<HTMLHeadingElement>;
|
|
3921
4466
|
}
|
|
3922
4467
|
|
|
3923
4468
|
/**
|
|
3924
|
-
* Opens the drawer
|
|
3925
|
-
*
|
|
3926
|
-
*
|
|
3927
|
-
*
|
|
3928
|
-
*
|
|
3929
|
-
*
|
|
3930
|
-
*
|
|
3931
|
-
*
|
|
3932
|
-
*
|
|
3933
|
-
*
|
|
4469
|
+
* Opens and closes the drawer: a click while it is open asks it to close (reason `trigger`), which
|
|
4470
|
+
* the trigger of a non-modal or inline drawer can receive (a modal one makes the page inert).
|
|
4471
|
+
* Fluent's `DialogTrigger` never toggles (outside the surface it only opens, inside it only
|
|
4472
|
+
* closes); this trigger always does.
|
|
4473
|
+
* Place it directly inside `Drawer`, or in a Fragment there (not inside a wrapper element or a
|
|
4474
|
+
* component of your own): it renders in place, not in the panel (an inline drawer's triggers
|
|
4475
|
+
* render right before its panel, so the panel follows its button in the reading order); a
|
|
4476
|
+
* misplaced one warns in development. A Drawer may have several triggers: focus returns to the one
|
|
4477
|
+
* that opened it. Puts `aria-haspopup="dialog"` (none on an inline drawer's trigger: an inline
|
|
4478
|
+
* panel is page content, not a popup), `aria-expanded`, `aria-controls` (while open), a click
|
|
4479
|
+
* handler and a ref on its single child, or passes them to a render-prop child. A custom child
|
|
4480
|
+
* component must forward `ref` and spread its props; one that does not is wrapped in a `<span>`
|
|
4481
|
+
* automatically (with a development warning), the span that `asChild={false}` renders. Focus
|
|
4482
|
+
* returns to the trigger when the drawer closes (for a non-modal or inline drawer, only when focus
|
|
4483
|
+
* was inside it). On the span, the state ARIA goes to the first element in the tab order inside
|
|
4484
|
+
* it, and focus returns to that element (to the span when you made it the trigger with a `role`
|
|
4485
|
+
* such as `button` and `tabIndex={0}`, or when nothing inside it can take focus).
|
|
3934
4486
|
*
|
|
3935
4487
|
* A Tooltip (or any other wrapper) goes inside the trigger, not around it. Use a render-prop child
|
|
3936
4488
|
* so the trigger props land on the button and the Tooltip describes that same button:
|
|
@@ -3955,8 +4507,8 @@ export declare const DrawerTrigger: {
|
|
|
3955
4507
|
/** Properties for the DrawerTrigger sub-component. */
|
|
3956
4508
|
export declare interface DrawerTriggerProps extends Omit<React_2.HTMLAttributes<HTMLElement>, 'children'> {
|
|
3957
4509
|
/**
|
|
3958
|
-
* The element that opens the drawer. A single element receives the trigger props
|
|
3959
|
-
* own); a function receives them.
|
|
4510
|
+
* The element that opens and closes the drawer. A single element receives the trigger props
|
|
4511
|
+
* (merged with its own); a function receives them.
|
|
3960
4512
|
*/
|
|
3961
4513
|
children: React_2.ReactNode | ((props: DrawerTriggerRenderProps) => React_2.ReactNode);
|
|
3962
4514
|
/**
|
|
@@ -3972,7 +4524,10 @@ export declare interface DrawerTriggerProps extends Omit<React_2.HTMLAttributes<
|
|
|
3972
4524
|
|
|
3973
4525
|
/** Props a `Drawer.Trigger` puts on its element (and passes to a render-prop child). */
|
|
3974
4526
|
export declare interface DrawerTriggerRenderProps extends React_2.HTMLAttributes<HTMLElement> {
|
|
3975
|
-
|
|
4527
|
+
/**
|
|
4528
|
+
* `'dialog'` for an overlay drawer; absent (no key) for an inline drawer, which is not a popup.
|
|
4529
|
+
*/
|
|
4530
|
+
'aria-haspopup'?: 'dialog';
|
|
3976
4531
|
'aria-expanded': boolean;
|
|
3977
4532
|
/** The panel's id, while the drawer is open. */
|
|
3978
4533
|
'aria-controls'?: string;
|
|
@@ -3981,6 +4536,12 @@ export declare interface DrawerTriggerRenderProps extends React_2.HTMLAttributes
|
|
|
3981
4536
|
ref: React_2.RefCallback<HTMLElement>;
|
|
3982
4537
|
}
|
|
3983
4538
|
|
|
4539
|
+
/**
|
|
4540
|
+
* How a Drawer sits on the page: `overlay`, a panel over the page (in a portal), or `inline`, a
|
|
4541
|
+
* panel in the page layout, rendered where the Drawer is. Fluent's `type`.
|
|
4542
|
+
*/
|
|
4543
|
+
export declare type DrawerType = 'overlay' | 'inline';
|
|
4544
|
+
|
|
3984
4545
|
/**
|
|
3985
4546
|
* A select-only combobox (APG): a button that opens a listbox of `Option`s. Enter, Space,
|
|
3986
4547
|
* ArrowDown/ArrowUp, Home/End and typing a character open it and move the highlight
|
|
@@ -4167,6 +4728,13 @@ export declare interface DropdownProps<M extends boolean = false> extends Omit<R
|
|
|
4167
4728
|
* listbox keeps its size; the multi-select value text and clear button follow it.
|
|
4168
4729
|
*/
|
|
4169
4730
|
size?: CoreSize;
|
|
4731
|
+
/**
|
|
4732
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
4733
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
4734
|
+
* room). The popup opens below the field.
|
|
4735
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
4736
|
+
*/
|
|
4737
|
+
positioning?: PopupPositioningOptions;
|
|
4170
4738
|
/**
|
|
4171
4739
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
4172
4740
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -4660,6 +5228,54 @@ export declare interface FlexOwnProps {
|
|
|
4660
5228
|
*/
|
|
4661
5229
|
export declare type FlexProps<C extends React_2.ElementType = 'div'> = PolymorphicProps<C, FlexOwnProps>;
|
|
4662
5230
|
|
|
5231
|
+
/** Props to spread onto the group element (compose its handlers with your own). */
|
|
5232
|
+
export declare interface FocusableGroupProps {
|
|
5233
|
+
/** The group is itself focusable. */
|
|
5234
|
+
tabIndex: 0;
|
|
5235
|
+
onKeyDown: React_2.KeyboardEventHandler<HTMLElement>;
|
|
5236
|
+
onFocusCapture: React_2.FocusEventHandler<HTMLElement>;
|
|
5237
|
+
/** Marks the element as a group: nested groups own their own contents. */
|
|
5238
|
+
'data-focusable-group': '';
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5241
|
+
/** How Tab and Enter treat the elements inside a focusable group. */
|
|
5242
|
+
export declare type FocusableGroupTabBehavior = 'unlimited' | 'limited' | 'limited-trap-focus';
|
|
5243
|
+
|
|
5244
|
+
/**
|
|
5245
|
+
* How the keyboard reaches the items of a set: `'tab'`, every item is a Tab stop and the arrow
|
|
5246
|
+
* keys do nothing; `'arrow'`, the set is one Tab stop and the arrow keys move between its items.
|
|
5247
|
+
*/
|
|
5248
|
+
export declare type FocusMode = 'tab' | 'arrow';
|
|
5249
|
+
|
|
5250
|
+
/** Focus-visible ring for focusable controls (C-FOCUS). */
|
|
5251
|
+
export declare const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring";
|
|
5252
|
+
|
|
5253
|
+
/** Focus-visible ring drawn inside the element: cells, rows, list and menu items. */
|
|
5254
|
+
export declare const focusRingInset = "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
5255
|
+
|
|
5256
|
+
/** The first tabbable element inside `container`, or `null`. */
|
|
5257
|
+
export declare function getFirstTabbable(container: Element, options?: {
|
|
5258
|
+
includeContainer?: boolean;
|
|
5259
|
+
}): HTMLElement | null;
|
|
5260
|
+
|
|
5261
|
+
/** The last tabbable element inside `container`, or `null`. */
|
|
5262
|
+
export declare function getLastTabbable(container: Element, options?: {
|
|
5263
|
+
includeContainer?: boolean;
|
|
5264
|
+
}): HTMLElement | null;
|
|
5265
|
+
|
|
5266
|
+
/**
|
|
5267
|
+
* The tabbable elements inside `container` in sequential focus order: positive `tabindex` first
|
|
5268
|
+
* (ascending), then `tabindex=0` / natively tabbable elements in document order. Named radio
|
|
5269
|
+
* groups follow {@link isTabbable}, so the result depends on where focus currently is: when focus
|
|
5270
|
+
* is on a radio, the rest of its group is left out, which makes the focused radio the last entry
|
|
5271
|
+
* when its group ends the container (the element a focus trap wraps from).
|
|
5272
|
+
*
|
|
5273
|
+
* @param options.includeContainer Also consider `container` itself.
|
|
5274
|
+
*/
|
|
5275
|
+
export declare function getTabbableElements(container: Element, options?: {
|
|
5276
|
+
includeContainer?: boolean;
|
|
5277
|
+
}): HTMLElement[];
|
|
5278
|
+
|
|
4663
5279
|
/**
|
|
4664
5280
|
* The classes that select a theme's tokens: `'wave-light'`, `'wave-dark dark'` or
|
|
4665
5281
|
* `'wave-high-contrast high-contrast'`. Unknown values fall back to the light classes. Safe to call
|
|
@@ -4710,6 +5326,13 @@ export declare const gridClassNames: {
|
|
|
4710
5326
|
readonly root: "wave-grid";
|
|
4711
5327
|
};
|
|
4712
5328
|
|
|
5329
|
+
/** Handlers {@link useGridNavigation} needs on the grid element (compose them with the consumer's). */
|
|
5330
|
+
export declare interface GridNavigationHandlers {
|
|
5331
|
+
onKeyDown: React_2.KeyboardEventHandler<HTMLTableElement>;
|
|
5332
|
+
onFocus: React_2.FocusEventHandler<HTMLTableElement>;
|
|
5333
|
+
onBlur: React_2.FocusEventHandler<HTMLTableElement>;
|
|
5334
|
+
}
|
|
5335
|
+
|
|
4713
5336
|
/**
|
|
4714
5337
|
* The Grid's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).
|
|
4715
5338
|
* Every other prop comes from the rendered element (`as`).
|
|
@@ -4737,6 +5360,82 @@ export declare interface GridOwnProps {
|
|
|
4737
5360
|
*/
|
|
4738
5361
|
export declare type GridProps<C extends React_2.ElementType = 'div'> = PolymorphicProps<C, GridOwnProps>;
|
|
4739
5362
|
|
|
5363
|
+
/**
|
|
5364
|
+
* A button that opens and closes a navigation drawer: a `Button` (`subtle`, icon-only) with the
|
|
5365
|
+
* navigation glyph, named "Navigation" by default. Inside a `NavDrawer` (in its header) it toggles
|
|
5366
|
+
* that drawer and reports it with `aria-expanded` and `aria-controls`. Elsewhere (your page
|
|
5367
|
+
* header) it is a plain button: pass `aria-expanded={open}`, `aria-controls` (while the drawer's
|
|
5368
|
+
* panel is rendered) and, for an overlay drawer, `aria-haspopup="dialog"`, and toggle your state
|
|
5369
|
+
* in `onClick`. Fluent's `Hamburger`.
|
|
5370
|
+
*
|
|
5371
|
+
* @example
|
|
5372
|
+
* <Hamburger
|
|
5373
|
+
* aria-expanded={open}
|
|
5374
|
+
* aria-controls={open ? 'main-nav' : undefined}
|
|
5375
|
+
* aria-haspopup="dialog"
|
|
5376
|
+
* onClick={() => setOpen(!open)}
|
|
5377
|
+
* />
|
|
5378
|
+
*/
|
|
5379
|
+
export declare const Hamburger: {
|
|
5380
|
+
({ appearance, size, icon, onClick, className, children, ref, ...rest }: HamburgerProps): React_2.JSX.Element;
|
|
5381
|
+
displayName: string;
|
|
5382
|
+
};
|
|
5383
|
+
|
|
5384
|
+
/**
|
|
5385
|
+
* Hamburger (a Button variant: it also carries Button's root and icon classes): `root` on the
|
|
5386
|
+
* `<button>`; `icon` on the icon span.
|
|
5387
|
+
*/
|
|
5388
|
+
export declare const hamburgerClassNames: {
|
|
5389
|
+
readonly root: "wave-hamburger";
|
|
5390
|
+
readonly icon: "wave-hamburger__icon";
|
|
5391
|
+
};
|
|
5392
|
+
|
|
5393
|
+
/** Properties for the Hamburger component. */
|
|
5394
|
+
export declare interface HamburgerProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5395
|
+
/**
|
|
5396
|
+
* Visual style. Fluent's `transparent` look is WaveUI's `subtle` (WaveUI's `transparent` is
|
|
5397
|
+
* link-coloured).
|
|
5398
|
+
* @default 'subtle'
|
|
5399
|
+
*/
|
|
5400
|
+
appearance?: Appearance;
|
|
5401
|
+
/**
|
|
5402
|
+
* Size: the button's height and the glyph (12, 16, 20, 24 or 28px).
|
|
5403
|
+
* @default 'medium'
|
|
5404
|
+
*/
|
|
5405
|
+
size?: Size;
|
|
5406
|
+
/**
|
|
5407
|
+
* Replaces the navigation glyph (three bars). Decorative (`aria-hidden`). Unlike Button's `icon`,
|
|
5408
|
+
* a Hamburger always shows a glyph: `null`, `undefined` and a value that renders nothing keep
|
|
5409
|
+
* the default (the last warns in development). A `<button>` or `Button` passed here is not
|
|
5410
|
+
* nested: its children become the glyph and its props are dropped, with a warning.
|
|
5411
|
+
*/
|
|
5412
|
+
icon?: Slot<'span'>;
|
|
5413
|
+
/**
|
|
5414
|
+
* The button's name. Without `aria-label`, `aria-labelledby`, `title` or a visible label
|
|
5415
|
+
* (children), the Hamburger is named "Navigation"; localize it here. The name stays the same
|
|
5416
|
+
* while the drawer opens and closes (the state is `aria-expanded`).
|
|
5417
|
+
* @default 'Navigation'
|
|
5418
|
+
*/
|
|
5419
|
+
'aria-label'?: string;
|
|
5420
|
+
/**
|
|
5421
|
+
* Unavailable but focusable (see `Button.disabledFocusable`): no toggle, no `onClick`.
|
|
5422
|
+
* @default false
|
|
5423
|
+
*/
|
|
5424
|
+
disabledFocusable?: boolean;
|
|
5425
|
+
/** Ref to the `<button>`. */
|
|
5426
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
5427
|
+
}
|
|
5428
|
+
|
|
5429
|
+
/**
|
|
5430
|
+
* Whether a modal surface is open now: a layer of kind `'modal'` (a Dialog, an overlay Drawer, an
|
|
5431
|
+
* alert, the DatePicker's calendar, or your own `useDismiss({ kind: 'modal' })`). A non-modal
|
|
5432
|
+
* surface is no modal. Server-safe: `false` when no layer is registered, as on the server.
|
|
5433
|
+
*/
|
|
5434
|
+
export declare function hasOpenModal(): boolean;
|
|
5435
|
+
|
|
5436
|
+
/** Level of a heading element, `<h1>` … `<h6>`. */
|
|
5437
|
+
export declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5438
|
+
|
|
4740
5439
|
/**
|
|
4741
5440
|
* The HSV color of a hex string: `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa` (surrounding whitespace
|
|
4742
5441
|
* ignored, any case). `a` is set only when the input has alpha digits. Returns `null` for anything
|
|
@@ -5127,6 +5826,20 @@ export declare interface InputErrorMessageProps extends React_2.HTMLAttributes<H
|
|
|
5127
5826
|
[dataAttribute: `data-${string}`]: unknown;
|
|
5128
5827
|
}
|
|
5129
5828
|
|
|
5829
|
+
/**
|
|
5830
|
+
* Focus indicator of text-entry controls: a 2px primary bottom border. `focus:outline-hidden`
|
|
5831
|
+
* removes the outline while focused but — unlike `outline-none` — keeps a visible outline in
|
|
5832
|
+
* forced-colors mode, where the border colour change is not perceivable. (Scoped to `:focus` so
|
|
5833
|
+
* unfocused inputs do not show that outline in forced colors.)
|
|
5834
|
+
*/
|
|
5835
|
+
export declare const inputFocus = "focus:outline-hidden focus:border-b-2 focus:border-b-primary";
|
|
5836
|
+
|
|
5837
|
+
/**
|
|
5838
|
+
* Wrapper form of {@link inputFocus} for inputs rendered inside a styled wrapper (slots,
|
|
5839
|
+
* SearchBox, TagPicker). Put `focus:outline-hidden` on the inner control.
|
|
5840
|
+
*/
|
|
5841
|
+
export declare const inputFocusWithin = "focus-within:border-b-2 focus-within:border-b-primary";
|
|
5842
|
+
|
|
5130
5843
|
/** Properties for the Input component. */
|
|
5131
5844
|
export declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
5132
5845
|
/**
|
|
@@ -5182,50 +5895,244 @@ export declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTM
|
|
|
5182
5895
|
ref?: React_2.Ref<HTMLInputElement>;
|
|
5183
5896
|
}
|
|
5184
5897
|
|
|
5185
|
-
/** Whether both dates are on the same calendar day (time of day ignored); `false` when either is missing. */
|
|
5186
|
-
export declare function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
|
|
5187
|
-
|
|
5188
5898
|
/**
|
|
5189
|
-
* A
|
|
5190
|
-
*
|
|
5191
|
-
*
|
|
5899
|
+
* A tag with a main action and a separate Dismiss button: an element that holds two sibling
|
|
5900
|
+
* buttons, `InteractionTag.Primary` (the action) and `InteractionTag.Secondary` (Dismiss), never
|
|
5901
|
+
* one inside the other. Use it for a chip the user acts on (opens, toggles) and can also remove;
|
|
5902
|
+
* a `Tag` is a chip that only displays, or only dismisses.
|
|
5903
|
+
*
|
|
5904
|
+
* - **Two Tab stops**, the Primary then the Secondary. In a TagGroup toolbar both join its arrow
|
|
5905
|
+
* order (Primary, Secondary, next tag).
|
|
5906
|
+
* - **The Secondary is named after the Primary's text**: its `dismissLabel` plus the primary
|
|
5907
|
+
* text, "Dismiss Cherry" (never the secondary text). A text label in its children replaces
|
|
5908
|
+
* `dismissLabel` ("Remove Cherry"); an `aria-label` replaces the whole name.
|
|
5909
|
+
* - **Delete and Backspace** on either button dismiss the tag through the Secondary's click (a
|
|
5910
|
+
* held key dismisses once); without a Secondary they do nothing. Enter, Space and a click on the
|
|
5911
|
+
* Secondary dismiss too: remove the tag in its `onClick`, or in a TagGroup's `onDismiss(value)`,
|
|
5912
|
+
* which is called after it.
|
|
5913
|
+
* - **In a selecting TagGroup** (`value`, `defaultValue` or `onValueChange` on the group) the
|
|
5914
|
+
* Primary toggles the tag's `value` in the group's selection (`aria-pressed`, the selected
|
|
5915
|
+
* look), and dismissing a selected tag also removes its value from the selection.
|
|
5916
|
+
* - **`selected`**, outside a selecting TagGroup, draws the selected look and makes the Primary a
|
|
5917
|
+
* toggle (`aria-pressed`); leave it `undefined` for an action that is not a toggle.
|
|
5918
|
+
* - **Look**: `size`, `appearance` and `shape`, Tag's sizes and colours (a TagGroup gives its
|
|
5919
|
+
* defaults); `disabled` disables both buttons natively. The Primary takes `media` (an Avatar,
|
|
5920
|
+
* sized for the tag), `icon` and `secondaryText`.
|
|
5921
|
+
* - Fluent's `hasSecondaryAction` is not needed: the Primary squares its end corners next to a
|
|
5922
|
+
* Secondary by itself, also when the Secondary is rendered conditionally or wrapped.
|
|
5923
|
+
* - React Server Components cannot dot into a client module: import the flat names
|
|
5924
|
+
* `InteractionTagPrimary` and `InteractionTagSecondary` there.
|
|
5925
|
+
* - Renders `data-appearance`, `data-size` and `data-shape`, and while set `data-selected` and
|
|
5926
|
+
* `data-disabled`, on the root; `data-selected` on both buttons.
|
|
5192
5927
|
*
|
|
5193
5928
|
* @example
|
|
5194
|
-
* <
|
|
5195
|
-
*
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5929
|
+
* <InteractionTag value="cherry">
|
|
5930
|
+
* <InteractionTag.Primary icon={<FruitIcon />} onClick={openDetails}>
|
|
5931
|
+
* Cherry
|
|
5932
|
+
* </InteractionTag.Primary>
|
|
5933
|
+
* <InteractionTag.Secondary onClick={() => remove('cherry')} />
|
|
5934
|
+
* </InteractionTag>
|
|
5935
|
+
*/
|
|
5936
|
+
export declare const InteractionTag: {
|
|
5937
|
+
({ value, appearance: appearanceProp, size: sizeProp, shape: shapeProp, disabled: disabledProp, selected: selectedProp, role, hidden, className, children, ref, ...rest }: InteractionTagProps): React_2.JSX.Element;
|
|
5199
5938
|
displayName: string;
|
|
5939
|
+
} & {
|
|
5940
|
+
Primary: {
|
|
5941
|
+
({ media, icon, secondaryText, disabled: disabledProp, "aria-pressed": ariaPressed, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagPrimaryProps): React_2.JSX.Element;
|
|
5942
|
+
displayName: string;
|
|
5943
|
+
};
|
|
5944
|
+
Secondary: {
|
|
5945
|
+
({ dismissLabel, disabled: disabledProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagSecondaryProps): React_2.JSX.Element;
|
|
5946
|
+
displayName: string;
|
|
5947
|
+
};
|
|
5200
5948
|
};
|
|
5201
5949
|
|
|
5202
|
-
/**
|
|
5203
|
-
export declare const
|
|
5204
|
-
readonly root: "wave-
|
|
5205
|
-
readonly required: "wave-label__required";
|
|
5950
|
+
/** InteractionTag: `root` on the element that holds its two buttons. */
|
|
5951
|
+
export declare const interactionTagClassNames: {
|
|
5952
|
+
readonly root: "wave-interaction-tag";
|
|
5206
5953
|
};
|
|
5207
5954
|
|
|
5208
5955
|
/**
|
|
5209
|
-
*
|
|
5210
|
-
*
|
|
5211
|
-
*
|
|
5956
|
+
* The main action of an {@link InteractionTag}: a `<button type="button">` named by its text and
|
|
5957
|
+
* `secondaryText` (`media` and `icon` are decorative), with the InteractionTag's look. In a
|
|
5958
|
+
* selecting TagGroup it is a toggle (`aria-pressed`): a click, Enter or Space adds the tag's
|
|
5959
|
+
* `value` to the group's selection or removes it, after its `onClick` (whose `preventDefault()`
|
|
5960
|
+
* cancels the toggle). Elsewhere the InteractionTag's `selected` makes it a toggle. Either state
|
|
5961
|
+
* renders its `aria-pressed` over one passed here, which applies only when neither is set. Delete
|
|
5962
|
+
* and Backspace on it click the tag's Secondary when there is one. Its props, `ref` and
|
|
5963
|
+
* `className` go to the button. Flat name of `InteractionTag.Primary`, for React Server
|
|
5964
|
+
* Components.
|
|
5212
5965
|
*/
|
|
5213
|
-
export declare
|
|
5966
|
+
export declare const InteractionTagPrimary: {
|
|
5967
|
+
({ media, icon, secondaryText, disabled: disabledProp, "aria-pressed": ariaPressed, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagPrimaryProps): React_2.JSX.Element;
|
|
5968
|
+
displayName: string;
|
|
5969
|
+
};
|
|
5214
5970
|
|
|
5215
|
-
/**
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5971
|
+
/**
|
|
5972
|
+
* InteractionTag.Primary: `root` on its button; `media`, `icon`, `primaryText` and
|
|
5973
|
+
* `secondaryText` on the slot elements.
|
|
5974
|
+
*/
|
|
5975
|
+
export declare const interactionTagPrimaryClassNames: {
|
|
5976
|
+
readonly root: "wave-interaction-tag-primary";
|
|
5977
|
+
readonly media: "wave-interaction-tag-primary__media";
|
|
5978
|
+
readonly icon: "wave-interaction-tag-primary__icon";
|
|
5979
|
+
readonly primaryText: "wave-interaction-tag-primary__primary-text";
|
|
5980
|
+
readonly secondaryText: "wave-interaction-tag-primary__secondary-text";
|
|
5981
|
+
};
|
|
5982
|
+
|
|
5983
|
+
/** Props of InteractionTag.Primary: the tag's main action (or its toggle in a selecting TagGroup). */
|
|
5984
|
+
export declare interface InteractionTagPrimaryProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5985
|
+
/**
|
|
5986
|
+
* A visual before the text (an Avatar, sized for the tag: 24, 20 or 16px, unless it sets its
|
|
5987
|
+
* own `size`). Decorative (`aria-hidden`): the button is named by its text.
|
|
5221
5988
|
*/
|
|
5222
|
-
|
|
5223
|
-
/**
|
|
5989
|
+
media?: Slot<'span'>;
|
|
5990
|
+
/** A decorative icon before the text (`aria-hidden`), in a 20, 16 or 12px box. */
|
|
5991
|
+
icon?: Slot<'span'>;
|
|
5992
|
+
/**
|
|
5993
|
+
* A second, smaller line under the text. Part of the Primary's name, not of the Secondary's. A
|
|
5994
|
+
* small or extra-small tag grows to 28px to fit it.
|
|
5995
|
+
*/
|
|
5996
|
+
secondaryText?: React_2.ReactNode;
|
|
5997
|
+
/**
|
|
5998
|
+
* Disables the Primary natively; or-ed with the InteractionTag's `disabled` (it cannot
|
|
5999
|
+
* re-enable a disabled tag).
|
|
5224
6000
|
* @default false
|
|
5225
6001
|
*/
|
|
5226
6002
|
disabled?: boolean;
|
|
5227
|
-
|
|
5228
|
-
|
|
6003
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
6004
|
+
}
|
|
6005
|
+
|
|
6006
|
+
/** Props of InteractionTag: the element that holds the Primary and Secondary buttons. */
|
|
6007
|
+
export declare interface InteractionTagProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
6008
|
+
/**
|
|
6009
|
+
* Identifies the tag in a TagGroup: the value `onDismiss` receives and the selection holds. Give
|
|
6010
|
+
* every tag of a group its own value.
|
|
6011
|
+
* @default a generated id (a development warning in a group that reports values)
|
|
6012
|
+
*/
|
|
6013
|
+
value?: string;
|
|
6014
|
+
/**
|
|
6015
|
+
* Colour scheme of both buttons: `filled` (a neutral fill), `outline` (a border on the surface
|
|
6016
|
+
* behind it) or `brand` (a light brand tint that follows the brand ramp).
|
|
6017
|
+
* @default the TagGroup's `appearance`, else 'filled'
|
|
6018
|
+
*/
|
|
6019
|
+
appearance?: TagAppearance;
|
|
6020
|
+
/**
|
|
6021
|
+
* `medium` (28px tall), `small` (24px) or `extra-small` (20px); an Avatar in the Primary's
|
|
6022
|
+
* `media` is 24, 20 or 16px. Fluent's medium tag is 32px.
|
|
6023
|
+
* @default the TagGroup's `size`, else 'medium'
|
|
6024
|
+
*/
|
|
6025
|
+
size?: TagSize;
|
|
6026
|
+
/**
|
|
6027
|
+
* `circular` (a pill) or `rounded` (4px corners). Fluent's default is `rounded`.
|
|
6028
|
+
* @default the TagGroup's `shape`, else 'circular'
|
|
6029
|
+
*/
|
|
6030
|
+
shape?: TagShape;
|
|
6031
|
+
/**
|
|
6032
|
+
* Disables both buttons natively (a disabled TagGroup does too; a part's own `disabled` cannot
|
|
6033
|
+
* re-enable it). A button that has focus when it is disabled keeps it, unavailable, until focus
|
|
6034
|
+
* leaves it. Rendered as `data-disabled` on the root.
|
|
6035
|
+
* @default false
|
|
6036
|
+
*/
|
|
6037
|
+
disabled?: boolean;
|
|
6038
|
+
/**
|
|
6039
|
+
* Outside a selecting TagGroup: draws the selected look and makes the Primary a toggle:
|
|
6040
|
+
* `aria-pressed="true"`, or `"false"` for `selected={false}`. Leave it `undefined` for an
|
|
6041
|
+
* action that is not a toggle (no `aria-pressed`). Inside a selecting TagGroup (`value`,
|
|
6042
|
+
* `defaultValue` or `onValueChange`) the group's `value` decides, and a defined `selected` is
|
|
6043
|
+
* ignored (a development warning). Rendered as `data-selected` on the root and both buttons.
|
|
6044
|
+
* Disabled wins over the selected look (`aria-pressed` and `data-selected` still render).
|
|
6045
|
+
* Fluent's `selected` is a look only.
|
|
6046
|
+
*/
|
|
6047
|
+
selected?: boolean;
|
|
6048
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
6049
|
+
}
|
|
6050
|
+
|
|
6051
|
+
/**
|
|
6052
|
+
* The separate Dismiss button of an {@link InteractionTag}: a `<button type="button">` after the
|
|
6053
|
+
* Primary, named `dismissLabel` plus the Primary's text ("Dismiss Cherry"). Its children replace
|
|
6054
|
+
* the default dismiss glyph; a text label among them replaces `dismissLabel` in the name ("Remove
|
|
6055
|
+
* Cherry"), an `aria-label` the whole name. A button passed as its child is unwrapped (its children
|
|
6056
|
+
* become the content). Enter, Space, a click, Delete and Backspace call its `onClick`, then, in a
|
|
6057
|
+
* TagGroup, the group's `onDismiss(value)`. Its props, `ref` and `className` go to the button.
|
|
6058
|
+
* Flat name of `InteractionTag.Secondary`, for React Server Components.
|
|
6059
|
+
*/
|
|
6060
|
+
export declare const InteractionTagSecondary: {
|
|
6061
|
+
({ dismissLabel, disabled: disabledProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagSecondaryProps): React_2.JSX.Element;
|
|
6062
|
+
displayName: string;
|
|
6063
|
+
};
|
|
6064
|
+
|
|
6065
|
+
/**
|
|
6066
|
+
* InteractionTag.Secondary: `root` on its button; `dismissIcon` on the glyph inside it (the
|
|
6067
|
+
* default glyph, or the element that wraps the children).
|
|
6068
|
+
*/
|
|
6069
|
+
export declare const interactionTagSecondaryClassNames: {
|
|
6070
|
+
readonly root: "wave-interaction-tag-secondary";
|
|
6071
|
+
readonly dismissIcon: "wave-interaction-tag-secondary__dismiss-icon";
|
|
6072
|
+
};
|
|
6073
|
+
|
|
6074
|
+
/** Props of InteractionTag.Secondary: the tag's separate Dismiss button. */
|
|
6075
|
+
export declare interface InteractionTagSecondaryProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6076
|
+
/**
|
|
6077
|
+
* Visually hidden text that names the button with the Primary's text ("Dismiss Cherry"). A text
|
|
6078
|
+
* label in the children replaces it ("Remove Cherry"); an `aria-label` replaces the whole name.
|
|
6079
|
+
* Localise it here. Fluent's order is the primary text, then the label ("Cherry remove").
|
|
6080
|
+
* @default 'Dismiss'
|
|
6081
|
+
*/
|
|
6082
|
+
dismissLabel?: string;
|
|
6083
|
+
/**
|
|
6084
|
+
* Disables the Secondary natively; or-ed with the InteractionTag's `disabled` (it cannot
|
|
6085
|
+
* re-enable a disabled tag).
|
|
6086
|
+
* @default false
|
|
6087
|
+
*/
|
|
6088
|
+
disabled?: boolean;
|
|
6089
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
6090
|
+
}
|
|
6091
|
+
|
|
6092
|
+
/** Whether both dates are on the same calendar day (time of day ignored); `false` when either is missing. */
|
|
6093
|
+
export declare function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
|
|
6094
|
+
|
|
6095
|
+
/**
|
|
6096
|
+
* A text label for a form control (`htmlFor`), on the Fluent type ramp. The optional required
|
|
6097
|
+
* indicator is decorative (`aria-hidden`). `Field` renders its own label; use `Label` for custom
|
|
6098
|
+
* layouts.
|
|
6099
|
+
*
|
|
6100
|
+
* @example
|
|
6101
|
+
* <Label htmlFor="email" required>Email</Label>
|
|
6102
|
+
* <Input id="email" required />
|
|
6103
|
+
*/
|
|
6104
|
+
export declare const Label: {
|
|
6105
|
+
({ required, disabled, size, weight, className, children, ref, ...rest }: LabelProps): React_2.JSX.Element;
|
|
6106
|
+
displayName: string;
|
|
6107
|
+
};
|
|
6108
|
+
|
|
6109
|
+
/** Label: `root` on the `<label>`; `required` on the asterisk. */
|
|
6110
|
+
export declare const labelClassNames: {
|
|
6111
|
+
readonly root: "wave-label";
|
|
6112
|
+
readonly required: "wave-label__required";
|
|
6113
|
+
};
|
|
6114
|
+
|
|
6115
|
+
/**
|
|
6116
|
+
* Where a label renders relative to its control or indicator. Components accept a subset,
|
|
6117
|
+
* derived with `Extract<LabelPosition, …>` (never `Exclude<>`, so a later value does not widen
|
|
6118
|
+
* them silently): Checkbox `'before' | 'after'`, Switch `'before' | 'after' | 'above'`.
|
|
6119
|
+
*/
|
|
6120
|
+
export declare type LabelPosition = 'before' | 'after' | 'above' | 'below';
|
|
6121
|
+
|
|
6122
|
+
/** Properties for the Label component. */
|
|
6123
|
+
export declare interface LabelProps extends React_2.LabelHTMLAttributes<HTMLLabelElement> {
|
|
6124
|
+
/** Whether to show a required indicator. `true` shows a decorative asterisk; other content
|
|
6125
|
+
* replaces it (for example a `(required)` text). Decorative (`aria-hidden`), so it must not be
|
|
6126
|
+
* focusable; mark the control itself `required`.
|
|
6127
|
+
* @default false
|
|
6128
|
+
*/
|
|
6129
|
+
required?: boolean | React_2.ReactNode;
|
|
6130
|
+
/** Whether the label is visually dimmed.
|
|
6131
|
+
* @default false
|
|
6132
|
+
*/
|
|
6133
|
+
disabled?: boolean;
|
|
6134
|
+
/** Text size of the label: `small` = caption-1, `medium` = body-1, `large` = body-2.
|
|
6135
|
+
* @default 'medium'
|
|
5229
6136
|
*/
|
|
5230
6137
|
size?: CoreSize;
|
|
5231
6138
|
/** Font weight of the label (the shared `TextWeight` vocabulary).
|
|
@@ -5236,6 +6143,16 @@ export declare interface LabelProps extends React_2.LabelHTMLAttributes<HTMLLabe
|
|
|
5236
6143
|
ref?: React_2.Ref<HTMLLabelElement>;
|
|
5237
6144
|
}
|
|
5238
6145
|
|
|
6146
|
+
/**
|
|
6147
|
+
* What kind of surface a layer is. `modal` marks dialog-like surfaces (focus-restore validation and
|
|
6148
|
+
* modal isolation look for them); a modal blocks presses and Escape for the layers below it only
|
|
6149
|
+
* while its page isolation is active ({@link registerLayerIsolation}). `dialog` marks a non-modal
|
|
6150
|
+
* Dialog or Drawer: it shields nothing (no isolation), takes Escape only from inside its tree
|
|
6151
|
+
* (`escape: 'inside'`), and the Toaster moves out of its way; focus-restore validation and modal
|
|
6152
|
+
* isolation do not count it.
|
|
6153
|
+
*/
|
|
6154
|
+
export declare type LayerKind = 'modal' | 'dialog' | 'popover' | 'menu' | 'listbox' | 'tooltip' | 'toast';
|
|
6155
|
+
|
|
5239
6156
|
/**
|
|
5240
6157
|
* A hyperlink with Fluent link styling. Renders an `<a>` by default; `as` renders a router link
|
|
5241
6158
|
* (`<Link as={RouterLink} to="/">`) or a `<button>` styled as a link (`type="button"` by default).
|
|
@@ -5775,6 +6692,15 @@ export declare const listboxSurfaceClassNames: {
|
|
|
5775
6692
|
readonly list: "wave-listbox-surface__list";
|
|
5776
6693
|
};
|
|
5777
6694
|
|
|
6695
|
+
/**
|
|
6696
|
+
* Attributes of the list element that ListboxSurface renders (see `listProps`). Its content is the
|
|
6697
|
+
* surface's `children`.
|
|
6698
|
+
*/
|
|
6699
|
+
export declare type ListboxSurfaceListProps = Omit<React_2.HTMLAttributes<HTMLUListElement>, 'role' | 'id' | 'hidden' | 'tabIndex' | 'className' | 'aria-label' | 'aria-labelledby' | 'aria-multiselectable' | 'aria-activedescendant' | 'children' | 'dangerouslySetInnerHTML'> & {
|
|
6700
|
+
/** Ref to the `role="listbox"` element (it moves between the picker and the popup). */
|
|
6701
|
+
ref?: React_2.Ref<HTMLUListElement>;
|
|
6702
|
+
};
|
|
6703
|
+
|
|
5778
6704
|
/**
|
|
5779
6705
|
* Props of {@link ListboxSurface}. The options of one listbox live in one list at a time, and this
|
|
5780
6706
|
* surface renders that list: render every option of the listbox inside it, never in a second list
|
|
@@ -5825,6 +6751,14 @@ export declare interface ListboxSurfaceProps {
|
|
|
5825
6751
|
* classes they conflict with.
|
|
5826
6752
|
*/
|
|
5827
6753
|
surfaceClassName?: string;
|
|
6754
|
+
/**
|
|
6755
|
+
* Attributes spread onto the list element before the listbox's own (`role`, `id`, `tabIndex`,
|
|
6756
|
+
* `aria-multiselectable`, `aria-activedescendant` and `hidden` win, also where the listbox
|
|
6757
|
+
* renders none of the last two): `data-*` and other `aria-*` attributes, `style`, and handlers,
|
|
6758
|
+
* composed before the listbox's own `onMouseDown`. `ref` is merged with the list's. Name the list
|
|
6759
|
+
* with `aria-label`/`aria-labelledby` (the props above), not here.
|
|
6760
|
+
*/
|
|
6761
|
+
listProps?: ListboxSurfaceListProps;
|
|
5828
6762
|
/** The options (`Option`, `OptionGroup` or options of your own on `useListboxOption`). */
|
|
5829
6763
|
children?: React_2.ReactNode;
|
|
5830
6764
|
}
|
|
@@ -6018,7 +6952,7 @@ export declare const Menu: {
|
|
|
6018
6952
|
displayName: string;
|
|
6019
6953
|
};
|
|
6020
6954
|
Popover: {
|
|
6021
|
-
({ side, align, offset, target, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): JSX.Element | null;
|
|
6955
|
+
({ side, align, offset, target: targetProp, positioning, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): JSX.Element | null;
|
|
6022
6956
|
displayName: string;
|
|
6023
6957
|
};
|
|
6024
6958
|
ItemCheckbox: {
|
|
@@ -6489,7 +7423,7 @@ export declare interface MenuItemSwitchProps extends MenuItemProps, MenuItemSele
|
|
|
6489
7423
|
* Also exported as `MenuPopover` (import the flat name from React Server Components).
|
|
6490
7424
|
*/
|
|
6491
7425
|
export declare const MenuPopover: {
|
|
6492
|
-
({ side, align, offset, target, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): React_2.JSX.Element | null;
|
|
7426
|
+
({ side, align, offset, target: targetProp, positioning, children, className, style, onKeyDown, onKeyDownCapture, onFocus, onPointerEnter, onPointerLeave, onPointerMove, onContextMenu, ref, ...rest }: MenuPopoverProps): React_2.JSX.Element | null;
|
|
6493
7427
|
displayName: string;
|
|
6494
7428
|
};
|
|
6495
7429
|
|
|
@@ -6515,11 +7449,18 @@ export declare interface MenuPopoverProps extends Omit<React_2.HTMLAttributes<HT
|
|
|
6515
7449
|
* with a `target` needs no trigger; name it with `aria-label`, and give a toggle button you use
|
|
6516
7450
|
* as the target `aria-haspopup="menu"` and `aria-expanded` yourself (the menu's `id` is
|
|
6517
7451
|
* generated, so the toggle cannot point `aria-controls` at it). A press on a target element
|
|
6518
|
-
* does not close the menu. Hold the element in state
|
|
6519
|
-
*
|
|
7452
|
+
* does not close the menu. Hold the element in state, or pass a ref object (read after
|
|
7453
|
+
* each render of the menu). A menu opened by `openOnContext` is placed at
|
|
6520
7454
|
* the gesture instead.
|
|
6521
7455
|
*/
|
|
6522
|
-
target?:
|
|
7456
|
+
target?: PopupTargetInput;
|
|
7457
|
+
/**
|
|
7458
|
+
* Advanced positioning (Fluent's `positioning`): `offset`, `fitViewport`, `matchReferenceWidth`,
|
|
7459
|
+
* `fallbackPlacements` and `target` (used when the `target` prop is not set). `side` and `align`
|
|
7460
|
+
* stay separate props, and the `offset` prop wins over `positioning.offset`.
|
|
7461
|
+
* @default `{ fitViewport: true }`
|
|
7462
|
+
*/
|
|
7463
|
+
positioning?: PopupPositioning;
|
|
6523
7464
|
/** Menu items and dividers. */
|
|
6524
7465
|
children: React_2.ReactNode;
|
|
6525
7466
|
/**
|
|
@@ -6982,6 +7923,22 @@ export declare interface MessageBarTitleProps extends React_2.HTMLAttributes<HTM
|
|
|
6982
7923
|
ref?: React_2.Ref<HTMLSpanElement>;
|
|
6983
7924
|
}
|
|
6984
7925
|
|
|
7926
|
+
/**
|
|
7927
|
+
* Props that mark an app-owned region (a notification area, a live status bar) so that WaveUI's
|
|
7928
|
+
* modal surfaces leave it usable. Spread them on the region's element: `<div {...modalAllowProps}>`.
|
|
7929
|
+
* Over an open Dialog or Drawer the region
|
|
7930
|
+
*
|
|
7931
|
+
* - counts as inside every dismiss layer, so a press in it closes nothing;
|
|
7932
|
+
* - has its tabbable elements in the Tab cycle of every focus trap;
|
|
7933
|
+
* - is never made `inert` by the modal's page isolation.
|
|
7934
|
+
*
|
|
7935
|
+
* The attribute it sets, `data-wave-focus-trap-allow`, is the one the Toaster's own region
|
|
7936
|
+
* carries, and it is a stable contract.
|
|
7937
|
+
*/
|
|
7938
|
+
export declare const modalAllowProps: {
|
|
7939
|
+
readonly 'data-wave-focus-trap-allow': "";
|
|
7940
|
+
};
|
|
7941
|
+
|
|
6985
7942
|
/**
|
|
6986
7943
|
* Why a Dialog or Drawer asks to open or close: `trigger` (its Trigger part), `close` (a
|
|
6987
7944
|
* `.Close` part), `close-button` (the built-in Close button), `escape`, `outside-press` (the
|
|
@@ -6989,8 +7946,14 @@ export declare interface MessageBarTitleProps extends React_2.HTMLAttributes<HTM
|
|
|
6989
7946
|
*/
|
|
6990
7947
|
export declare type ModalOpenChangeReason = 'trigger' | 'close' | 'close-button' | 'escape' | 'outside-press';
|
|
6991
7948
|
|
|
6992
|
-
/**
|
|
6993
|
-
|
|
7949
|
+
/**
|
|
7950
|
+
* How a Dialog or Drawer relates to the page (Fluent's `modalType`). `modal`: a backdrop dims the
|
|
7951
|
+
* page, focus stays in the surface, the rest of the page is `inert` and does not scroll. `alert`:
|
|
7952
|
+
* modal, for a confirmation that needs an answer (`role="alertdialog"`; a backdrop press does not
|
|
7953
|
+
* close it). `non-modal`: the page stays usable (no backdrop, no focus trap, nothing inert, the
|
|
7954
|
+
* page scrolls).
|
|
7955
|
+
*/
|
|
7956
|
+
export declare type ModalType = 'modal' | 'alert' | 'non-modal';
|
|
6994
7957
|
|
|
6995
7958
|
/**
|
|
6996
7959
|
* A vertical side navigation (`<nav>` landmark, default name "Navigation") with items, links and
|
|
@@ -7008,12 +7971,25 @@ export declare type ModalType = 'modal' | 'alert';
|
|
|
7008
7971
|
* for sub-items your own component renders inside a closed category.
|
|
7009
7972
|
* - **Values** are unique: among the items and sub-items, and among the categories (a duplicate
|
|
7010
7973
|
* warns in development).
|
|
7011
|
-
*
|
|
7012
|
-
*
|
|
7013
|
-
*
|
|
7974
|
+
* - **Structure**: every child of the Nav, and of a category, is a part or your own `<li>`; a
|
|
7975
|
+
* development warning names anything else (a `<div>`, text, the wrapper of a Tooltip around an
|
|
7976
|
+
* item). `Nav.SectionHeader` is a heading between groups of items (`<h3>` unless
|
|
7977
|
+
* `headingLevel`, which stands for the `as` of Fluent's NavSectionHeader), and `Nav.Divider` a
|
|
7978
|
+
* line between groups, hidden from assistive technology (Fluent's NavDivider is a separator).
|
|
7979
|
+
* - **App identity**: `Nav.AppItem` shows the app's name and logo at the top, as a link with
|
|
7980
|
+
* `href` or a button; it is never selected. `Nav.AppItemStatic` shows them as plain text.
|
|
7981
|
+
* - **Item actions**: `actions` on `Nav.Item` and `Nav.SubItem` (Fluent's SplitNavItem) puts your
|
|
7982
|
+
* own controls beside the item, in a group named by it; each is a Tab stop after the item, and
|
|
7983
|
+
* none selects it. They are drawn while the row is hovered or has focus, while one is pressed or
|
|
7984
|
+
* has its menu open, and always on touch screens and in forced colours. With actions, a selected
|
|
7985
|
+
* item's background and indicator are drawn on its row (`.wave-nav-item__list-item`).
|
|
7986
|
+
*
|
|
7987
|
+
* Sub-components are also exported under flat names (`NavCategory`, `NavItem`, `NavSubItem`,
|
|
7988
|
+
* `NavSectionHeader`, `NavDivider`, `NavAppItem`, `NavAppItemStatic`): React Server Components
|
|
7989
|
+
* import those, because dotted access (`Nav.Item`) needs a client file.
|
|
7014
7990
|
*/
|
|
7015
7991
|
export declare const Nav: {
|
|
7016
|
-
({ value: valueProp, defaultValue: defaultValueProp, onValueChange, selectedValue, defaultSelectedValue, onNavItemSelect, openCategories
|
|
7992
|
+
({ value: valueProp, defaultValue: defaultValueProp, onValueChange, selectedValue, defaultSelectedValue, onNavItemSelect, openCategories, defaultOpenCategories, onOpenCategoriesChange, currentCategory, className, children, ref, ...rest }: NavProps): React_2.JSX.Element;
|
|
7017
7993
|
displayName: string;
|
|
7018
7994
|
} & {
|
|
7019
7995
|
Category: {
|
|
@@ -7022,8 +7998,139 @@ export declare const Nav: {
|
|
|
7022
7998
|
};
|
|
7023
7999
|
Item: typeof NavItem;
|
|
7024
8000
|
SubItem: typeof NavSubItem;
|
|
8001
|
+
SectionHeader: {
|
|
8002
|
+
({ headingLevel, className, children, ref, ...rest }: NavSectionHeaderProps): React_2.JSX.Element | null;
|
|
8003
|
+
displayName: string;
|
|
8004
|
+
};
|
|
8005
|
+
Divider: {
|
|
8006
|
+
({ className, ref, ...rest }: NavDividerProps): React_2.JSX.Element;
|
|
8007
|
+
displayName: string;
|
|
8008
|
+
};
|
|
8009
|
+
AppItem: typeof NavAppItem;
|
|
8010
|
+
AppItemStatic: {
|
|
8011
|
+
({ icon, className, children, ref, ...rest }: NavAppItemStaticProps): React_2.JSX.Element;
|
|
8012
|
+
displayName: string;
|
|
8013
|
+
};
|
|
8014
|
+
};
|
|
8015
|
+
|
|
8016
|
+
/**
|
|
8017
|
+
* The app's name and logo at the top of the navigation: a link with `href` (the app's start page),
|
|
8018
|
+
* a button otherwise. It is never selected and never marked as the current page (a consumer's
|
|
8019
|
+
* `aria-current` passes through), has no `value` and is not registered with the Nav; a click runs
|
|
8020
|
+
* only your `onClick` and the browser's default. A `disabled` button or an `aria-disabled` link
|
|
8021
|
+
* looks unavailable; the item adds no disabled logic of its own. Fluent's AppItem picks its element
|
|
8022
|
+
* through `as`; here `href` does.
|
|
8023
|
+
*
|
|
8024
|
+
* Typed by overloads like `Nav.Item`, resolved in order: without `href` (button props), with a
|
|
8025
|
+
* string `href` (anchor props), then an `href` that may be `undefined` at run time
|
|
8026
|
+
* ({@link NavAppItemDynamicProps}).
|
|
8027
|
+
*
|
|
8028
|
+
* Also exported as `NavAppItem` (import the flat name from React Server Components).
|
|
8029
|
+
*/
|
|
8030
|
+
export declare function NavAppItem(props: NavAppItemButtonProps): React_2.ReactElement;
|
|
8031
|
+
|
|
8032
|
+
export declare function NavAppItem(props: NavAppItemAnchorProps): React_2.ReactElement;
|
|
8033
|
+
|
|
8034
|
+
export declare function NavAppItem(props: NavAppItemDynamicProps): React_2.ReactElement;
|
|
8035
|
+
|
|
8036
|
+
export declare namespace NavAppItem {
|
|
8037
|
+
var displayName: string;
|
|
8038
|
+
}
|
|
8039
|
+
|
|
8040
|
+
/**
|
|
8041
|
+
* Nav.AppItem rendered as a link (`href` given): anchor attributes, handlers typed on
|
|
8042
|
+
* `HTMLAnchorElement`.
|
|
8043
|
+
*/
|
|
8044
|
+
export declare interface NavAppItemAnchorProps extends NavAppItemOwnProps, Omit<React_2.AnchorHTMLAttributes<HTMLAnchorElement>, keyof NavAppItemOwnProps> {
|
|
8045
|
+
/**
|
|
8046
|
+
* URL of the app's start page; renders an `<a>`. Required in this branch, so `href`
|
|
8047
|
+
* discriminates the union.
|
|
8048
|
+
*/
|
|
8049
|
+
href: string;
|
|
8050
|
+
/** Ref to the `<a>` element. */
|
|
8051
|
+
ref?: React_2.Ref<HTMLAnchorElement>;
|
|
8052
|
+
}
|
|
8053
|
+
|
|
8054
|
+
/**
|
|
8055
|
+
* Nav.AppItem rendered as a button (no `href`): button attributes without `value` (an app item is
|
|
8056
|
+
* never selected).
|
|
8057
|
+
*/
|
|
8058
|
+
export declare interface NavAppItemButtonProps extends NavAppItemOwnProps, NoAnchorOnlyAttributes_2, Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, keyof NavAppItemOwnProps | 'value'> {
|
|
8059
|
+
/** Button app items have no `href`. */
|
|
8060
|
+
href?: undefined;
|
|
8061
|
+
/** Ref to the `<button>` element. */
|
|
8062
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
8063
|
+
}
|
|
8064
|
+
|
|
8065
|
+
/**
|
|
8066
|
+
* Nav.AppItem: `root` on the `<a>` (with `href`) or `<button>`; `listItem` on the list item around
|
|
8067
|
+
* it; `icon` on the icon span; `content` on the label span.
|
|
8068
|
+
*/
|
|
8069
|
+
export declare const navAppItemClassNames: {
|
|
8070
|
+
readonly root: "wave-nav-app-item";
|
|
8071
|
+
readonly listItem: "wave-nav-app-item__list-item";
|
|
8072
|
+
readonly icon: "wave-nav-app-item__icon";
|
|
8073
|
+
readonly content: "wave-nav-app-item__content";
|
|
8074
|
+
};
|
|
8075
|
+
|
|
8076
|
+
/**
|
|
8077
|
+
* Nav.AppItem with an `href` known only at run time (`string | undefined`): a link when it is a
|
|
8078
|
+
* string, a button otherwise; only the attributes both elements share, handlers of either element.
|
|
8079
|
+
*/
|
|
8080
|
+
export declare interface NavAppItemDynamicProps extends NavAppItemOwnProps, Omit<React_2.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, keyof NavAppItemOwnProps> {
|
|
8081
|
+
/** URL of the app's start page; renders an `<a>` when defined, a `<button>` otherwise. */
|
|
8082
|
+
href?: string;
|
|
8083
|
+
/** Ref to the rendered `<a>` or `<button>` element. */
|
|
8084
|
+
ref?: React_2.Ref<HTMLAnchorElement | HTMLButtonElement>;
|
|
8085
|
+
}
|
|
8086
|
+
|
|
8087
|
+
/** The props of Nav.AppItem that every branch shares. */
|
|
8088
|
+
export declare interface NavAppItemOwnProps {
|
|
8089
|
+
/**
|
|
8090
|
+
* The app's logo or an Avatar, before its name. Rendered with `aria-hidden="true"` in a box at
|
|
8091
|
+
* least 20px square that grows with its content. A falsy icon (`''`, `0`) or a list of nothing
|
|
8092
|
+
* renders no icon box.
|
|
8093
|
+
*/
|
|
8094
|
+
icon?: Slot<'span'>;
|
|
8095
|
+
/** The app's name. */
|
|
8096
|
+
children?: React_2.ReactNode;
|
|
8097
|
+
}
|
|
8098
|
+
|
|
8099
|
+
/** Properties for the NavAppItem sub-component: link props with `href`, button props without. */
|
|
8100
|
+
export declare type NavAppItemProps = NavAppItemAnchorProps | NavAppItemButtonProps;
|
|
8101
|
+
|
|
8102
|
+
/**
|
|
8103
|
+
* The app's name and logo as plain text (not a link or button): the layout of `Nav.AppItem` in a
|
|
8104
|
+
* `<div>`, not focusable, with no role and no hover. It does not carry Nav.AppItem's class.
|
|
8105
|
+
*
|
|
8106
|
+
* Also exported as `NavAppItemStatic` (import the flat name from React Server Components).
|
|
8107
|
+
*/
|
|
8108
|
+
export declare const NavAppItemStatic: {
|
|
8109
|
+
({ icon, className, children, ref, ...rest }: NavAppItemStaticProps): React_2.JSX.Element;
|
|
8110
|
+
displayName: string;
|
|
8111
|
+
};
|
|
8112
|
+
|
|
8113
|
+
/**
|
|
8114
|
+
* Nav.AppItemStatic: `root` on the `<div>`; `listItem` on the list item around it; `icon` on the
|
|
8115
|
+
* icon span; `content` on the label span.
|
|
8116
|
+
*/
|
|
8117
|
+
export declare const navAppItemStaticClassNames: {
|
|
8118
|
+
readonly root: "wave-nav-app-item-static";
|
|
8119
|
+
readonly listItem: "wave-nav-app-item-static__list-item";
|
|
8120
|
+
readonly icon: "wave-nav-app-item-static__icon";
|
|
8121
|
+
readonly content: "wave-nav-app-item-static__content";
|
|
7025
8122
|
};
|
|
7026
8123
|
|
|
8124
|
+
/** Properties for the NavAppItemStatic sub-component. */
|
|
8125
|
+
export declare interface NavAppItemStaticProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8126
|
+
/** The app's logo or an Avatar (as Nav.AppItem's `icon`). */
|
|
8127
|
+
icon?: Slot<'span'>;
|
|
8128
|
+
/** The app's name. */
|
|
8129
|
+
children?: React_2.ReactNode;
|
|
8130
|
+
/** Ref to the `<div>`. */
|
|
8131
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8132
|
+
}
|
|
8133
|
+
|
|
7027
8134
|
/**
|
|
7028
8135
|
* A collapsible group of sub-items. Its toggle button shows `label` and reports `aria-expanded`
|
|
7029
8136
|
* (and `aria-controls` while open); the sub-items render in a nested list while it is open.
|
|
@@ -7075,7 +8182,10 @@ export declare interface NavCategoryProps extends React_2.HTMLAttributes<HTMLLIE
|
|
|
7075
8182
|
* (`''`, `0`) or a list of nothing renders no icon box.
|
|
7076
8183
|
*/
|
|
7077
8184
|
icon?: Slot<'span'>;
|
|
7078
|
-
/**
|
|
8185
|
+
/**
|
|
8186
|
+
* The category's sub-items (`Nav.SubItem`), and `Nav.SectionHeader` and `Nav.Divider`, rendered
|
|
8187
|
+
* in its list while it is open.
|
|
8188
|
+
*/
|
|
7079
8189
|
children?: React_2.ReactNode;
|
|
7080
8190
|
/** Ref to the category's `<li>` element. */
|
|
7081
8191
|
ref?: React_2.Ref<HTMLLIElement>;
|
|
@@ -7087,6 +8197,310 @@ export declare const navClassNames: {
|
|
|
7087
8197
|
readonly list: "wave-nav__list";
|
|
7088
8198
|
};
|
|
7089
8199
|
|
|
8200
|
+
/**
|
|
8201
|
+
* A line between groups of items, in its own list item, hidden from assistive technology (a list
|
|
8202
|
+
* holds only list items; use `Nav.SectionHeader` to name a group). Fluent's NavDivider is a
|
|
8203
|
+
* `separator`, which a list cannot hold, so this one is decorative.
|
|
8204
|
+
*
|
|
8205
|
+
* Also exported as `NavDivider` (import the flat name from React Server Components).
|
|
8206
|
+
*/
|
|
8207
|
+
export declare const NavDivider: {
|
|
8208
|
+
({ className, ref, ...rest }: NavDividerProps): React_2.JSX.Element;
|
|
8209
|
+
displayName: string;
|
|
8210
|
+
};
|
|
8211
|
+
|
|
8212
|
+
/** Nav.Divider: `root` on its list item (hidden from assistive technology). */
|
|
8213
|
+
export declare const navDividerClassNames: {
|
|
8214
|
+
readonly root: "wave-nav-divider";
|
|
8215
|
+
};
|
|
8216
|
+
|
|
8217
|
+
/** Properties for the NavDivider sub-component. */
|
|
8218
|
+
export declare interface NavDividerProps extends Omit<React_2.HTMLAttributes<HTMLLIElement>, 'children' | 'role' | 'aria-hidden'> {
|
|
8219
|
+
/** Ref to the divider's list item. */
|
|
8220
|
+
ref?: React_2.Ref<HTMLLIElement>;
|
|
8221
|
+
}
|
|
8222
|
+
|
|
8223
|
+
/**
|
|
8224
|
+
* A navigation pane in a drawer: Nav's items, categories and selection in a `<nav>` landmark that
|
|
8225
|
+
* sits over the page (`type="overlay"`) or in the page layout (`type="inline"`). Fluent's
|
|
8226
|
+
* `NavDrawer`.
|
|
8227
|
+
*
|
|
8228
|
+
* - **Composition:** `NavDrawer.Header` (a row: a `Hamburger`, the app's name), `NavDrawer.Body`
|
|
8229
|
+
* (the scrolling list) and `NavDrawer.Footer` (a list pinned below it), rendered in the order
|
|
8230
|
+
* written. Nav parts (`Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, `Nav.Divider`,
|
|
8231
|
+
* `Nav.AppItem`, …) go in the Body and the Footer, which render the lists; wrap anything else
|
|
8232
|
+
* there in an `<li>`.
|
|
8233
|
+
* - **Types:** `overlay` (default) is a panel over the page, in a portal, opened in the browser
|
|
8234
|
+
* only; `inline` is a panel in the page layout, also in the server HTML. Changing `type`
|
|
8235
|
+
* remounts the panel; the selection and the open categories are kept.
|
|
8236
|
+
* - **Opening and closing:** keep it controlled (`open`, `onOpenChange`): an uncontrolled drawer
|
|
8237
|
+
* that is closed cannot open again. A `Hamburger` inside it toggles it (reason `trigger`);
|
|
8238
|
+
* Escape and a backdrop press close an overlay (`escape`, `outside-press`). Closing an overlay
|
|
8239
|
+
* when an item is chosen is yours, in `onItemSelect`, which also fires when the current page is
|
|
8240
|
+
* activated again. A non-modal overlay (`modalType="non-modal"`) covers the page, which keeps
|
|
8241
|
+
* its Tab order: keep the page's controls clear of it, or use `type="inline"`.
|
|
8242
|
+
* - **Focus:** pass your page's Hamburger as `finalFocusRef`, so focus returns to it when a
|
|
8243
|
+
* Hamburger inside the drawer closes it. An overlay moves focus in when it opens; an inline
|
|
8244
|
+
* drawer does not.
|
|
8245
|
+
* - **Keyboard:** every item is a Tab stop; `NavDrawer.Body focusMode="arrow"` makes the body one
|
|
8246
|
+
* Tab stop with arrow keys, Home and End.
|
|
8247
|
+
* - **Landmark:** one `<nav>`, named "Navigation" by default (`aria-label`, `aria-labelledby`);
|
|
8248
|
+
* an overlay is also a dialog with that name. Rename it when the page has another navigation
|
|
8249
|
+
* landmark.
|
|
8250
|
+
* - **Selection:** Nav's `value`/`onValueChange` (only on a change), `openCategories` and
|
|
8251
|
+
* `currentCategory`, and `onItemSelect` on every activation (Fluent's `selectedValue` and
|
|
8252
|
+
* `onNavItemSelect`).
|
|
8253
|
+
* - **Server Components:** the parts are also exported as `NavDrawerHeader`, `NavDrawerBody` and
|
|
8254
|
+
* `NavDrawerFooter`.
|
|
8255
|
+
*
|
|
8256
|
+
* @example
|
|
8257
|
+
* const [open, setOpen] = useState(false);
|
|
8258
|
+
* const hamburgerRef = useRef<HTMLButtonElement>(null);
|
|
8259
|
+
* <Hamburger
|
|
8260
|
+
* ref={hamburgerRef}
|
|
8261
|
+
* aria-expanded={open}
|
|
8262
|
+
* aria-controls={open ? 'main-nav' : undefined}
|
|
8263
|
+
* aria-haspopup="dialog"
|
|
8264
|
+
* onClick={() => setOpen(!open)}
|
|
8265
|
+
* />
|
|
8266
|
+
* <NavDrawer
|
|
8267
|
+
* id="main-nav"
|
|
8268
|
+
* open={open}
|
|
8269
|
+
* onOpenChange={setOpen}
|
|
8270
|
+
* onItemSelect={() => setOpen(false)}
|
|
8271
|
+
* finalFocusRef={hamburgerRef}
|
|
8272
|
+
* defaultValue="home"
|
|
8273
|
+
* >
|
|
8274
|
+
* <NavDrawer.Header>
|
|
8275
|
+
* <Hamburger />
|
|
8276
|
+
* Contoso HR
|
|
8277
|
+
* </NavDrawer.Header>
|
|
8278
|
+
* <NavDrawer.Body>
|
|
8279
|
+
* <Nav.Item value="home" href="/">Home</Nav.Item>
|
|
8280
|
+
* </NavDrawer.Body>
|
|
8281
|
+
* </NavDrawer>
|
|
8282
|
+
*/
|
|
8283
|
+
export declare const NavDrawer: {
|
|
8284
|
+
({ type, open: openProp, defaultOpen, onOpenChange, onItemSelect, position, size, separator, modalType: modalTypeProp, unmountOnClose, finalFocusRef, backdrop, value, defaultValue, onValueChange, openCategories, defaultOpenCategories, onOpenCategoriesChange, currentCategory, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, id, children, ref, ...rest }: NavDrawerProps): React_2.JSX.Element;
|
|
8285
|
+
displayName: string;
|
|
8286
|
+
} & {
|
|
8287
|
+
Header: {
|
|
8288
|
+
({ className, children, ref, ...rest }: NavDrawerHeaderProps): React_2.JSX.Element;
|
|
8289
|
+
displayName: string;
|
|
8290
|
+
};
|
|
8291
|
+
Body: {
|
|
8292
|
+
({ focusMode, className, onKeyDown, onFocus, children, ref, ...rest }: NavDrawerBodyProps): React_2.JSX.Element;
|
|
8293
|
+
displayName: string;
|
|
8294
|
+
};
|
|
8295
|
+
Footer: {
|
|
8296
|
+
({ className, children, ref, ...rest }: NavDrawerFooterProps): React_2.JSX.Element;
|
|
8297
|
+
displayName: string;
|
|
8298
|
+
};
|
|
8299
|
+
};
|
|
8300
|
+
|
|
8301
|
+
/**
|
|
8302
|
+
* The scrolling list of a NavDrawer: the Nav parts (`Nav.Item`, `Nav.Category`, …) as the items of
|
|
8303
|
+
* its list. With `focusMode="arrow"` it is one Tab stop and the arrow keys move through it.
|
|
8304
|
+
*/
|
|
8305
|
+
export declare const NavDrawerBody: {
|
|
8306
|
+
({ focusMode, className, onKeyDown, onFocus, children, ref, ...rest }: NavDrawerBodyProps): React_2.JSX.Element;
|
|
8307
|
+
displayName: string;
|
|
8308
|
+
};
|
|
8309
|
+
|
|
8310
|
+
/** NavDrawer.Body: `root` on the scrolling body; `list` on its list. */
|
|
8311
|
+
export declare const navDrawerBodyClassNames: {
|
|
8312
|
+
readonly root: "wave-nav-drawer-body";
|
|
8313
|
+
readonly list: "wave-nav-drawer-body__list";
|
|
8314
|
+
};
|
|
8315
|
+
|
|
8316
|
+
/** Properties for the NavDrawerBody sub-component. */
|
|
8317
|
+
export declare interface NavDrawerBodyProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8318
|
+
/**
|
|
8319
|
+
* How the keyboard reaches the items. `'tab'`: every item is a Tab stop and the arrow keys do
|
|
8320
|
+
* nothing (Nav's model). `'arrow'`: the body is one Tab stop, the last focused element (at first
|
|
8321
|
+
* the current page, or the closed category that holds it, else the first item); Down and Right
|
|
8322
|
+
* move to the next element and Up and Left to the previous one (Left and Right swap in a
|
|
8323
|
+
* right-to-left layout), wrapping, and Home and End go to the ends. Every focusable element in
|
|
8324
|
+
* the body joins the order, item actions included. Screen readers do not announce arrow keys in
|
|
8325
|
+
* a navigation landmark: prefer `'tab'` unless your users expect an app pane. Rendered as
|
|
8326
|
+
* `data-focus-mode`. Fluent's NavDrawer uses arrow keys by default (its `tabbable` adds Tab
|
|
8327
|
+
* stops).
|
|
8328
|
+
* @default 'tab'
|
|
8329
|
+
*/
|
|
8330
|
+
focusMode?: FocusMode;
|
|
8331
|
+
/** Nav parts: `Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, … (each renders its own list item). */
|
|
8332
|
+
children?: React_2.ReactNode;
|
|
8333
|
+
/** Ref to the scrolling body element. */
|
|
8334
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8335
|
+
}
|
|
8336
|
+
|
|
8337
|
+
/**
|
|
8338
|
+
* NavDrawer (a Drawer variant: it also carries Drawer's root, and its backdrop Drawer's backdrop
|
|
8339
|
+
* class): `root` on the panel (the portaled `role="dialog"` element of an overlay drawer, the
|
|
8340
|
+
* panel element of an inline one); `backdrop` on the backdrop of a modal overlay; `nav` on the
|
|
8341
|
+
* navigation landmark that fills the panel.
|
|
8342
|
+
*/
|
|
8343
|
+
export declare const navDrawerClassNames: {
|
|
8344
|
+
readonly root: "wave-nav-drawer";
|
|
8345
|
+
readonly backdrop: "wave-nav-drawer__backdrop";
|
|
8346
|
+
readonly nav: "wave-nav-drawer__nav";
|
|
8347
|
+
};
|
|
8348
|
+
|
|
8349
|
+
/**
|
|
8350
|
+
* The list pinned below a NavDrawer's body (Settings, Help): Nav parts as the items of its list,
|
|
8351
|
+
* each a Tab stop. Its line above shows while more of the body is below.
|
|
8352
|
+
*/
|
|
8353
|
+
export declare const NavDrawerFooter: {
|
|
8354
|
+
({ className, children, ref, ...rest }: NavDrawerFooterProps): React_2.JSX.Element;
|
|
8355
|
+
displayName: string;
|
|
8356
|
+
};
|
|
8357
|
+
|
|
8358
|
+
/** NavDrawer.Footer: `root` on the footer; `list` on its list. */
|
|
8359
|
+
export declare const navDrawerFooterClassNames: {
|
|
8360
|
+
readonly root: "wave-nav-drawer-footer";
|
|
8361
|
+
readonly list: "wave-nav-drawer-footer__list";
|
|
8362
|
+
};
|
|
8363
|
+
|
|
8364
|
+
/** Properties for the NavDrawerFooter sub-component. */
|
|
8365
|
+
export declare interface NavDrawerFooterProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8366
|
+
/** Nav parts pinned below the body (Settings, Help); wrap other content in an `<li>`. */
|
|
8367
|
+
children?: React_2.ReactNode;
|
|
8368
|
+
/** Ref to the footer element. */
|
|
8369
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8370
|
+
}
|
|
8371
|
+
|
|
8372
|
+
/**
|
|
8373
|
+
* The header row of a NavDrawer: a Hamburger, the app's name, … (no list: Nav items go in the
|
|
8374
|
+
* body or the footer). Its line underneath shows while the body is scrolled away from its top.
|
|
8375
|
+
*/
|
|
8376
|
+
export declare const NavDrawerHeader: {
|
|
8377
|
+
({ className, children, ref, ...rest }: NavDrawerHeaderProps): React_2.JSX.Element;
|
|
8378
|
+
displayName: string;
|
|
8379
|
+
};
|
|
8380
|
+
|
|
8381
|
+
/** NavDrawer.Header: `root` on the header row. */
|
|
8382
|
+
export declare const navDrawerHeaderClassNames: {
|
|
8383
|
+
readonly root: "wave-nav-drawer-header";
|
|
8384
|
+
};
|
|
8385
|
+
|
|
8386
|
+
/** Properties for the NavDrawerHeader sub-component. */
|
|
8387
|
+
export declare interface NavDrawerHeaderProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8388
|
+
/** A Hamburger, the app's name, …: any content (Nav items go in the body or the footer). */
|
|
8389
|
+
children?: React_2.ReactNode;
|
|
8390
|
+
/** Ref to the header element. */
|
|
8391
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8392
|
+
}
|
|
8393
|
+
|
|
8394
|
+
/** Properties for the NavDrawer component. */
|
|
8395
|
+
export declare interface NavDrawerProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'defaultValue'>, Pick<NavProps, 'value' | 'defaultValue' | 'onValueChange' | 'openCategories' | 'defaultOpenCategories' | 'onOpenCategoriesChange' | 'currentCategory'> {
|
|
8396
|
+
/**
|
|
8397
|
+
* How the drawer sits on the page (Fluent's `type`).
|
|
8398
|
+
* - `overlay`: a panel over the page, rendered in a portal while open (in the browser only: an
|
|
8399
|
+
* open overlay is closed in the server HTML and opens once hydrated). Modal by default: focus
|
|
8400
|
+
* moves in and stays there, the rest of the page is `inert` and does not scroll, and Escape
|
|
8401
|
+
* and a backdrop press close it. It is a dialog with the navigation's name.
|
|
8402
|
+
* - `inline`: a panel in the page layout, rendered where the NavDrawer is (also in the server
|
|
8403
|
+
* HTML). The page stays usable around it; Escape and presses outside do nothing; opening it
|
|
8404
|
+
* moves no focus, and closing it while focus is inside returns focus to `finalFocusRef`, else
|
|
8405
|
+
* to the element that opened it.
|
|
8406
|
+
*
|
|
8407
|
+
* Changing `type` remounts the panel; the selection and the open categories are kept. Rendered
|
|
8408
|
+
* as `data-type`.
|
|
8409
|
+
* @default 'overlay'
|
|
8410
|
+
*/
|
|
8411
|
+
type?: DrawerType;
|
|
8412
|
+
/** Controlled open state. */
|
|
8413
|
+
open?: boolean;
|
|
8414
|
+
/**
|
|
8415
|
+
* Open state for uncontrolled usage. Keep the drawer controlled instead: a closed uncontrolled
|
|
8416
|
+
* NavDrawer cannot be opened again (a Hamburger inside it is not shown while it is closed).
|
|
8417
|
+
* @default false
|
|
8418
|
+
*/
|
|
8419
|
+
defaultOpen?: boolean;
|
|
8420
|
+
/**
|
|
8421
|
+
* Called with the new open state when it changes, with `details.reason`: `trigger` (a Hamburger
|
|
8422
|
+
* inside the drawer), `escape` and `outside-press` (the backdrop; overlay only). `details` is
|
|
8423
|
+
* typed optional until 1.0. A controlled drawer stays as it is until you update `open`.
|
|
8424
|
+
*/
|
|
8425
|
+
onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;
|
|
8426
|
+
/**
|
|
8427
|
+
* Called with an item's value every time an item is activated, also when the current page is
|
|
8428
|
+
* activated again (a disabled item, a link opened in another tab or window, and a button item
|
|
8429
|
+
* whose `onClick` calls `preventDefault()` are not activations). Close an overlay drawer here:
|
|
8430
|
+
* `onValueChange` fires only when the value changes. Fluent's `onNavItemSelect`.
|
|
8431
|
+
*/
|
|
8432
|
+
onItemSelect?: (value: string) => void;
|
|
8433
|
+
/**
|
|
8434
|
+
* The edge the panel is attached to: an overlay's screen edge; an inline panel's inner edge is
|
|
8435
|
+
* the opposite one. `start`/`end` follow the text direction; `left`/`right` are physical sides;
|
|
8436
|
+
* `bottom` runs along the bottom edge. Unlike Drawer's (`'end'`), the default is the start edge,
|
|
8437
|
+
* where navigation sits (Fluent's). Rendered as `data-position`.
|
|
8438
|
+
* @default 'start'
|
|
8439
|
+
*/
|
|
8440
|
+
position?: DrawerPosition;
|
|
8441
|
+
/**
|
|
8442
|
+
* The panel's width at a side (its height at the bottom), on Drawer's scale: `small` 320px,
|
|
8443
|
+
* `medium` 592px, `large` 940px, `full` the viewport (inline: the container). A width class in
|
|
8444
|
+
* `className` replaces it (Fluent's navigation pane is 260px wide: the width class of 65
|
|
8445
|
+
* spacing steps). Rendered as `data-size`. Drawer's default too.
|
|
8446
|
+
* @default 'small'
|
|
8447
|
+
*/
|
|
8448
|
+
size?: DrawerSize;
|
|
8449
|
+
/**
|
|
8450
|
+
* Inline drawers: draws a line on the panel's inner edge (`data-separator`), as Nav does
|
|
8451
|
+
* (Drawer's `separator` defaults to `false`). An overlay always draws that edge; forced colours
|
|
8452
|
+
* always draw it.
|
|
8453
|
+
* @default true
|
|
8454
|
+
*/
|
|
8455
|
+
separator?: boolean;
|
|
8456
|
+
/**
|
|
8457
|
+
* Overlay drawers: `modal` (backdrop, focus trapped, page inert and not scrolling) or
|
|
8458
|
+
* `non-modal` (no backdrop, no trap, nothing inert; Escape closes it while focus is inside, and
|
|
8459
|
+
* its Tab place follows the element that opened it). A non-modal overlay covers the page under
|
|
8460
|
+
* it while the page keeps its Tab order: keep the page's controls clear of it (reserve its width,
|
|
8461
|
+
* or its height at the bottom, in your layout while it is open) or use `type="inline"`; with
|
|
8462
|
+
* `size="full"` it hides the whole page and warns. Ignored by inline drawers. Rendered as
|
|
8463
|
+
* `data-modal-type` on an overlay's panel. Fluent's `modalType` (without `alert`: a navigation
|
|
8464
|
+
* pane is never an alert, so an `'alert'` is treated as `'modal'`). Drawer's default too.
|
|
8465
|
+
* @default 'modal'
|
|
8466
|
+
*/
|
|
8467
|
+
modalType?: Extract<ModalType, 'modal' | 'non-modal'>;
|
|
8468
|
+
/**
|
|
8469
|
+
* Removes the panel when the drawer closes. `false` keeps it mounted while closed, out of view
|
|
8470
|
+
* and `inert`, so the state of what is inside survives, and a Hamburger outside can point
|
|
8471
|
+
* `aria-controls` at it at all times: always for an inline drawer, and once the page has
|
|
8472
|
+
* hydrated for an overlay (whose panel is not in the server HTML). Fluent's `unmountOnClose`.
|
|
8473
|
+
* Drawer's default too.
|
|
8474
|
+
* @default true
|
|
8475
|
+
*/
|
|
8476
|
+
unmountOnClose?: boolean;
|
|
8477
|
+
/**
|
|
8478
|
+
* Where focus goes when the drawer closes with focus inside it (a modal overlay: whenever it
|
|
8479
|
+
* closes). Pass your page's Hamburger, so a Hamburger inside the drawer that closes it hands
|
|
8480
|
+
* focus to the one that opens it again.
|
|
8481
|
+
*/
|
|
8482
|
+
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
8483
|
+
/**
|
|
8484
|
+
* The backdrop of a modal overlay (Drawer's `backdrop` slot: `null` renders none, a slot
|
|
8485
|
+
* object's `appearance` picks the fill). Ignored, with a development warning, by a non-modal or
|
|
8486
|
+
* inline drawer.
|
|
8487
|
+
*/
|
|
8488
|
+
backdrop?: Slot<'div'> | (SlotObject<'div'> & {
|
|
8489
|
+
appearance?: BackdropAppearance;
|
|
8490
|
+
});
|
|
8491
|
+
/**
|
|
8492
|
+
* Name of the navigation landmark (and of an overlay's dialog). Localize it; rename it when the
|
|
8493
|
+
* page has another navigation landmark (two with one name are ambiguous). An `aria-labelledby`
|
|
8494
|
+
* replaces the default.
|
|
8495
|
+
* @default 'Navigation'
|
|
8496
|
+
*/
|
|
8497
|
+
'aria-label'?: string;
|
|
8498
|
+
/** `NavDrawer.Header`, `NavDrawer.Body` and `NavDrawer.Footer`, rendered in the order written. */
|
|
8499
|
+
children?: React_2.ReactNode;
|
|
8500
|
+
/** Ref to the panel: the `role="dialog"` element of an overlay drawer, the panel element of an inline one. */
|
|
8501
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8502
|
+
}
|
|
8503
|
+
|
|
7090
8504
|
/**
|
|
7091
8505
|
* A top-level navigation entry: a link when `href` is given (anchor props), a button otherwise
|
|
7092
8506
|
* (button props). Clicking selects it (`aria-current="page"`); activating a disabled entry never
|
|
@@ -7098,6 +8512,9 @@ export declare const navClassNames: {
|
|
|
7098
8512
|
* `onClick` calls `preventDefault()` (client-side routing), the browser opens nothing, so the item
|
|
7099
8513
|
* is selected whatever the keys, button or `target`.
|
|
7100
8514
|
*
|
|
8515
|
+
* `actions` puts your own controls (a pin toggle, a menu button) beside the item in its row, in a
|
|
8516
|
+
* group named by the item; they never select it.
|
|
8517
|
+
*
|
|
7101
8518
|
* Typed by overloads, resolved in order: without `href` (button props, button events), with a
|
|
7102
8519
|
* string `href` (anchor props, anchor events), then an `href` that may be `undefined` at run time
|
|
7103
8520
|
* ({@link NavItemDynamicProps}: events of either element).
|
|
@@ -7141,13 +8558,14 @@ export declare interface NavItemButtonProps extends NavItemOwnProps, NoAnchorOnl
|
|
|
7141
8558
|
|
|
7142
8559
|
/**
|
|
7143
8560
|
* Nav.Item: `root` on the `<a>` (with `href`) or `<button>`; `listItem` on the `<li>` around it;
|
|
7144
|
-
* `icon` on the icon span; `content` on the label span
|
|
8561
|
+
* `icon` on the icon span; `content` on the label span; `actions` on the group of its `actions`.
|
|
7145
8562
|
*/
|
|
7146
8563
|
export declare const navItemClassNames: {
|
|
7147
8564
|
readonly root: "wave-nav-item";
|
|
7148
8565
|
readonly listItem: "wave-nav-item__list-item";
|
|
7149
8566
|
readonly icon: "wave-nav-item__icon";
|
|
7150
8567
|
readonly content: "wave-nav-item__content";
|
|
8568
|
+
readonly actions: "wave-nav-item__actions";
|
|
7151
8569
|
};
|
|
7152
8570
|
|
|
7153
8571
|
/**
|
|
@@ -7192,6 +8610,20 @@ export declare interface NavItemOwnProps {
|
|
|
7192
8610
|
disabled?: boolean;
|
|
7193
8611
|
/** Label content. */
|
|
7194
8612
|
children?: React_2.ReactNode;
|
|
8613
|
+
/**
|
|
8614
|
+
* Controls beside the item in its row (Fluent's SplitNavItem): a ToggleButton that pins the
|
|
8615
|
+
* page, a MenuButton with more commands, each with its own name (a Tooltip with
|
|
8616
|
+
* `relationship="label"` names an icon-only one). They render after the item's link or button,
|
|
8617
|
+
* never inside it, in a group named by the item; each is a Tab stop after the item, and a click
|
|
8618
|
+
* or key on one never selects the item. They are drawn while the row is hovered or has focus,
|
|
8619
|
+
* while one of them is pressed or has its popup open, and always in forced colours and on touch
|
|
8620
|
+
* screens; otherwise they are transparent and still focusable. They stay enabled when the item
|
|
8621
|
+
* is `disabled`. With actions, the selected background and indicator are drawn on the row (the
|
|
8622
|
+
* item's list item, `.wave-nav-item__list-item`), so a `className` on the item no longer covers
|
|
8623
|
+
* them. Content that renders nothing renders no group. Fluent's `actionButton`, `toggleButton`
|
|
8624
|
+
* and `menuButton` slots and their tooltips are your own controls here.
|
|
8625
|
+
*/
|
|
8626
|
+
actions?: React_2.ReactNode;
|
|
7195
8627
|
}
|
|
7196
8628
|
|
|
7197
8629
|
/**
|
|
@@ -7246,11 +8678,43 @@ export declare interface NavProps extends Omit<React_2.HTMLAttributes<HTMLElemen
|
|
|
7246
8678
|
ref?: React_2.Ref<HTMLElement>;
|
|
7247
8679
|
}
|
|
7248
8680
|
|
|
8681
|
+
/**
|
|
8682
|
+
* A heading between groups of items (`<h3>` by default, `headingLevel`), in its own list item. It
|
|
8683
|
+
* names nothing by itself: place it before the items it introduces. A header whose children render
|
|
8684
|
+
* nothing renders nothing. It may also sit in a `Nav.Category`, between its sub-items.
|
|
8685
|
+
*
|
|
8686
|
+
* Also exported as `NavSectionHeader` (import the flat name from React Server Components).
|
|
8687
|
+
*/
|
|
8688
|
+
export declare const NavSectionHeader: {
|
|
8689
|
+
({ headingLevel, className, children, ref, ...rest }: NavSectionHeaderProps): React_2.JSX.Element | null;
|
|
8690
|
+
displayName: string;
|
|
8691
|
+
};
|
|
8692
|
+
|
|
8693
|
+
/** Nav.SectionHeader: `root` on the heading element; `listItem` on the list item around it. */
|
|
8694
|
+
export declare const navSectionHeaderClassNames: {
|
|
8695
|
+
readonly root: "wave-nav-section-header";
|
|
8696
|
+
readonly listItem: "wave-nav-section-header__list-item";
|
|
8697
|
+
};
|
|
8698
|
+
|
|
8699
|
+
/** Properties for the NavSectionHeader sub-component. */
|
|
8700
|
+
export declare interface NavSectionHeaderProps extends React_2.HTMLAttributes<HTMLHeadingElement> {
|
|
8701
|
+
/**
|
|
8702
|
+
* Level of the heading element (`<h1>` … `<h6>`). Pick the level that fits the page's outline.
|
|
8703
|
+
* Fluent's NavSectionHeader changes its element through `as`.
|
|
8704
|
+
* @default 3
|
|
8705
|
+
*/
|
|
8706
|
+
headingLevel?: HeadingLevel;
|
|
8707
|
+
/** The header text. A header whose children render nothing renders nothing at all. */
|
|
8708
|
+
children?: React_2.ReactNode;
|
|
8709
|
+
/** Ref to the heading element. */
|
|
8710
|
+
ref?: React_2.Ref<HTMLHeadingElement>;
|
|
8711
|
+
}
|
|
8712
|
+
|
|
7249
8713
|
/**
|
|
7250
8714
|
* An indented entry inside a `Nav.Category`: a link when `href` is given, a button otherwise.
|
|
7251
8715
|
* Selected like `Nav.Item` (a click that the browser opens somewhere else selects nothing; one
|
|
7252
8716
|
* whose default your `onClick` prevents is selected), and typed by overloads like `Nav.Item`
|
|
7253
|
-
* (button, link, then {@link NavSubItemDynamicProps}).
|
|
8717
|
+
* (button, link, then {@link NavSubItemDynamicProps}). Takes `actions` like `Nav.Item`.
|
|
7254
8718
|
*
|
|
7255
8719
|
* Also exported as `NavSubItem` (import the flat name from React Server Components).
|
|
7256
8720
|
*/
|
|
@@ -7286,10 +8750,14 @@ export declare interface NavSubItemButtonProps extends NavSubItemOwnProps, NoAnc
|
|
|
7286
8750
|
ref?: React_2.Ref<HTMLButtonElement>;
|
|
7287
8751
|
}
|
|
7288
8752
|
|
|
7289
|
-
/**
|
|
8753
|
+
/**
|
|
8754
|
+
* Nav.SubItem: `root` on the `<a>` or `<button>`; `listItem` on the `<li>` around it; `actions` on
|
|
8755
|
+
* the group of its `actions`.
|
|
8756
|
+
*/
|
|
7290
8757
|
export declare const navSubItemClassNames: {
|
|
7291
8758
|
readonly root: "wave-nav-sub-item";
|
|
7292
8759
|
readonly listItem: "wave-nav-sub-item__list-item";
|
|
8760
|
+
readonly actions: "wave-nav-sub-item__actions";
|
|
7293
8761
|
};
|
|
7294
8762
|
|
|
7295
8763
|
/**
|
|
@@ -7832,7 +9300,7 @@ export declare type PolymorphicProps<C extends React_2.ElementType, OwnProps> =
|
|
|
7832
9300
|
* </Popover>
|
|
7833
9301
|
*/
|
|
7834
9302
|
export declare const Popover: {
|
|
7835
|
-
({ open: openProp, defaultOpen, onOpenChange, side, align, ignoreOutsideRefs, openOnHover, openDelay, closeDelay, openOnContext, target, children, }: PopoverProps): React_2.JSX.Element;
|
|
9303
|
+
({ open: openProp, defaultOpen, onOpenChange, side, align, ignoreOutsideRefs, openOnHover, openDelay, closeDelay, openOnContext, target: targetProp, positioning, children, }: PopoverProps): React_2.JSX.Element;
|
|
7836
9304
|
displayName: string;
|
|
7837
9305
|
} & {
|
|
7838
9306
|
Trigger: {
|
|
@@ -7989,10 +9457,18 @@ export declare interface PopoverProps {
|
|
|
7989
9457
|
* `aria-labelledby`, and give a toggle button you use as the target `aria-haspopup="dialog"`,
|
|
7990
9458
|
* `aria-expanded` and `aria-controls` yourself. A press on a target element does not close the
|
|
7991
9459
|
* popover, and Tab from it enters the content when there is no trigger. Hold the element in
|
|
7992
|
-
* state
|
|
9460
|
+
* 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
|
|
7993
9461
|
* opened by `openOnContext` is placed at the gesture instead.
|
|
7994
9462
|
*/
|
|
7995
|
-
target?:
|
|
9463
|
+
target?: PopupTargetInput;
|
|
9464
|
+
/**
|
|
9465
|
+
* Advanced positioning (Fluent's `positioning`): `offset` (px from the anchor), `fitViewport`
|
|
9466
|
+
* (limit the content to the space the viewport leaves; Fluent's `autoSize`), `matchReferenceWidth`,
|
|
9467
|
+
* `fallbackPlacements` (tried in order when the requested side has no room) and `target` (used
|
|
9468
|
+
* when the `target` prop is not set). `side` and `align` stay separate props.
|
|
9469
|
+
* @default `{ offset: 8 }`
|
|
9470
|
+
*/
|
|
9471
|
+
positioning?: PopupPositioning;
|
|
7996
9472
|
/** `Popover.Trigger` and `Popover.Content`. */
|
|
7997
9473
|
children: React_2.ReactNode;
|
|
7998
9474
|
}
|
|
@@ -8077,6 +9553,39 @@ export declare interface PopoverTriggerProps extends Omit<React_2.HTMLAttributes
|
|
|
8077
9553
|
/** Alignment of a popup along the anchor's edge. */
|
|
8078
9554
|
export declare type PopupAlign = 'start' | 'center' | 'end';
|
|
8079
9555
|
|
|
9556
|
+
/** A placement for `PopupPositioning.fallbackPlacements`: a side, and optionally an alignment on it. */
|
|
9557
|
+
export declare interface PopupPlacement {
|
|
9558
|
+
/** Side of the anchor. `start` and `end` follow the writing direction. */
|
|
9559
|
+
side: PopupSide;
|
|
9560
|
+
/** Alignment along that side. @default the surface's own `align` */
|
|
9561
|
+
align?: PopupAlign;
|
|
9562
|
+
}
|
|
9563
|
+
|
|
9564
|
+
/**
|
|
9565
|
+
* The advanced positioning options of a popup (the `positioning` prop; Fluent's `positioning`).
|
|
9566
|
+
* `side` and `align` stay separate props of each component, so every option has one source.
|
|
9567
|
+
*/
|
|
9568
|
+
export declare interface PopupPositioning {
|
|
9569
|
+
/** Distance from the anchor in px. @default the component's own (Popover 8, Tooltip 8, TeachingPopover 12, listboxes 4) */
|
|
9570
|
+
offset?: number;
|
|
9571
|
+
/**
|
|
9572
|
+
* Limit the surface to the space the viewport leaves (Fluent's `autoSize`). Popover also scrolls
|
|
9573
|
+
* its content inside its border; the other surfaces only limit their size (their own lists and
|
|
9574
|
+
* grids scroll as they always did).
|
|
9575
|
+
* @default the component's own
|
|
9576
|
+
*/
|
|
9577
|
+
fitViewport?: boolean;
|
|
9578
|
+
/** Make the surface as wide as its anchor. @default the component's own */
|
|
9579
|
+
matchReferenceWidth?: boolean;
|
|
9580
|
+
/** Placements to try, in order, when the requested side has no room; replaces the opposite side. */
|
|
9581
|
+
fallbackPlacements?: readonly PopupPlacement[];
|
|
9582
|
+
/** Position against this instead of the trigger. */
|
|
9583
|
+
target?: PopupTargetInput;
|
|
9584
|
+
}
|
|
9585
|
+
|
|
9586
|
+
/** {@link PopupPositioning} without `target`: the options of a popup that has no `target` prop. */
|
|
9587
|
+
export declare type PopupPositioningOptions = Omit<PopupPositioning, 'target'>;
|
|
9588
|
+
|
|
8080
9589
|
/** A rectangle in viewport coordinates, as `getBoundingClientRect()` returns it (a `DOMRect` is one). */
|
|
8081
9590
|
export declare interface PopupRect {
|
|
8082
9591
|
x: number;
|
|
@@ -8096,12 +9605,20 @@ export declare interface PopupRect {
|
|
|
8096
9605
|
export declare type PopupSide = 'top' | 'bottom' | 'start' | 'end' | 'left' | 'right';
|
|
8097
9606
|
|
|
8098
9607
|
/**
|
|
8099
|
-
* Where a popup is placed instead of next to its trigger (`Menu.Popover
|
|
8100
|
-
* an element held in state, or a `VirtualElement`.
|
|
8101
|
-
*
|
|
9608
|
+
* Where a popup is placed instead of next to its trigger (`Menu.Popover`, `Popover` and
|
|
9609
|
+
* `TeachingPopover` `target`): an element held in state, or a `VirtualElement`. Those components
|
|
9610
|
+
* also take a ref object (`PopupPositioning['target']`).
|
|
8102
9611
|
*/
|
|
8103
9612
|
export declare type PopupTarget = HTMLElement | VirtualElement | null;
|
|
8104
9613
|
|
|
9614
|
+
/**
|
|
9615
|
+
* What a popup's `target` prop accepts: a {@link PopupTarget}, or a ref object (an element that
|
|
9616
|
+
* attaches without the popup rendering is read after each render of the popup).
|
|
9617
|
+
*/
|
|
9618
|
+
export declare type PopupTargetInput = PopupTarget | {
|
|
9619
|
+
readonly current: HTMLElement | null;
|
|
9620
|
+
};
|
|
9621
|
+
|
|
8105
9622
|
/**
|
|
8106
9623
|
* Renders its children into `document.body` (or the WaveProvider `portalContainer`), wrapped in a
|
|
8107
9624
|
* `<div class="wave-portal …">` that carries the provider's theme classes, direction and font, so
|
|
@@ -8158,6 +9675,16 @@ export declare interface PortalProps {
|
|
|
8158
9675
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
8159
9676
|
}
|
|
8160
9677
|
|
|
9678
|
+
/** What {@link UsePopupPositionOptions.onPositioned} receives. */
|
|
9679
|
+
export declare interface PositionedInfo {
|
|
9680
|
+
/** Final placement after flipping, e.g. `'top-start'`. */
|
|
9681
|
+
placement: string;
|
|
9682
|
+
/** Final physical side after flipping. */
|
|
9683
|
+
side: 'top' | 'bottom' | 'left' | 'right';
|
|
9684
|
+
/** Always `true`: the callback runs once a position exists. */
|
|
9685
|
+
isPositioned: boolean;
|
|
9686
|
+
}
|
|
9687
|
+
|
|
8161
9688
|
/**
|
|
8162
9689
|
* Shows and hides its child with CSS enter and exit motion: the child stays mounted while its exit
|
|
8163
9690
|
* motion runs, `inert` and marked `data-presence="exiting"`, and unmounts when it ends (at once
|
|
@@ -9939,6 +11466,12 @@ export declare interface StrictImageProps extends Omit<ImageProps, 'alt'> {
|
|
|
9939
11466
|
alt: string;
|
|
9940
11467
|
}
|
|
9941
11468
|
|
|
11469
|
+
/**
|
|
11470
|
+
* Size of an overlay surface: Dialog.Content's width cap, a Drawer's width (its height at the
|
|
11471
|
+
* bottom). `small`, `medium`, `large`, or `full`, the whole viewport.
|
|
11472
|
+
*/
|
|
11473
|
+
export declare type SurfaceSize = CoreSize | 'full';
|
|
11474
|
+
|
|
9942
11475
|
/** Represents a single color swatch option. */
|
|
9943
11476
|
export declare interface SwatchItem {
|
|
9944
11477
|
/** Unique identifier for the swatch (the value `onValueChange` reports and a form submits). */
|
|
@@ -10074,7 +11607,7 @@ export declare interface SwatchPickerProps extends Omit<React_2.HTMLAttributes<H
|
|
|
10074
11607
|
* applies, as the group cannot carry `aria-required`.
|
|
10075
11608
|
* @default 'arrow'
|
|
10076
11609
|
*/
|
|
10077
|
-
focusMode?:
|
|
11610
|
+
focusMode?: FocusMode;
|
|
10078
11611
|
/** Built-in strings, for localization. */
|
|
10079
11612
|
labels?: SwatchPickerLabels;
|
|
10080
11613
|
/** Size of each swatch button (20, 24, 32 or 40px). A 20px swatch passes the target-size bar
|
|
@@ -10631,55 +12164,304 @@ export declare interface TabProps extends React_2.ButtonHTMLAttributes<HTMLButto
|
|
|
10631
12164
|
* A compact label (a "chip") for a keyword, category or filter, optionally dismissible.
|
|
10632
12165
|
*
|
|
10633
12166
|
* - The dismiss button is a real `<button type="button">` wired to `onDismiss`. Its accessible
|
|
10634
|
-
* name is `dismissLabel` plus the tag
|
|
10635
|
-
* distinguishable dismiss buttons.
|
|
12167
|
+
* name is `dismissLabel` plus the tag's text (its children; not `media`, `icon` or
|
|
12168
|
+
* `secondaryText`): "Dismiss Cherry", so a row of tags has distinguishable dismiss buttons.
|
|
12169
|
+
* Enter, Space, Delete and Backspace on it dismiss the tag (a held key dismisses once), and so do
|
|
12170
|
+
* Delete and Backspace on a link in the tag's text.
|
|
10636
12171
|
* - `dismissIcon` replaces only the icon inside that button (see {@link TagOwnProps.dismissIcon}).
|
|
10637
|
-
* -
|
|
10638
|
-
*
|
|
10639
|
-
*
|
|
10640
|
-
*
|
|
10641
|
-
*
|
|
10642
|
-
*
|
|
12172
|
+
* - The look: `appearance` (`filled`, `outline` or `brand`), `size` (28, 24 or 20px tall),
|
|
12173
|
+
* `shape` (`circular` or `rounded`) and the look-only `selected`, rendered as `data-appearance`,
|
|
12174
|
+
* `data-size`, `data-shape` and `data-selected`. `disabled` dims the tag and disables its
|
|
12175
|
+
* dismiss button natively (`data-disabled`).
|
|
12176
|
+
* - Slots before and under the text: `media` (an Avatar, sized for the tag), a decorative `icon`
|
|
12177
|
+
* and a second line, `secondaryText`.
|
|
12178
|
+
* - In a TagGroup, a tag takes the group's `size`, `appearance`, `shape` and `dismissible` unless
|
|
12179
|
+
* it sets its own, is disabled with the group, reports its dismissal to the group's
|
|
12180
|
+
* `onDismiss(value)`, and is a list item in a `role="list"` group.
|
|
12181
|
+
* - Polymorphic: `as="a"` renders a link chip with anchor props type-checked. A dismissible link
|
|
12182
|
+
* chip puts the link in the content, `<Tag dismissible><a href>…</a></Tag>`: a dismiss button
|
|
12183
|
+
* cannot sit inside a link.
|
|
12184
|
+
*
|
|
12185
|
+
* **Focus after dismissal.** A tag cannot keep focus once you remove it. In a TagGroup, focus
|
|
12186
|
+
* moves to the next tag for you (else the previous one, else the group's `fallbackFocusRef`). For
|
|
12187
|
+
* a standalone tag, move focus to the next tag's dismiss button, else the previous one, else a
|
|
12188
|
+
* nearby control, then remove the tag: the neighbour stays mounted, so you can focus it in
|
|
12189
|
+
* `onDismiss` before removing the tag.
|
|
10643
12190
|
*
|
|
10644
12191
|
* @example
|
|
10645
12192
|
* <Tag>React</Tag>
|
|
12193
|
+
* <Tag appearance="brand" size="small">Beta</Tag>
|
|
10646
12194
|
* <Tag dismissible onDismiss={() => remove('cherry')}>Cherry</Tag>
|
|
12195
|
+
* <Tag media={<Avatar name="Katri Athokas" />} secondaryText="Designer">Katri</Tag>
|
|
10647
12196
|
* <Tag dismissible dismissLabel="Remove" dismissIcon={<CloseIcon />}>Cherry</Tag>
|
|
10648
12197
|
*/
|
|
10649
12198
|
export declare const Tag: PolymorphicComponent<'span', TagOwnProps>;
|
|
10650
12199
|
|
|
12200
|
+
/** Colour scheme of a tag (Fluent's `TagAppearance`): a neutral fill, a border, or a light brand tint. */
|
|
12201
|
+
export declare type TagAppearance = 'filled' | 'outline' | 'brand';
|
|
12202
|
+
|
|
10651
12203
|
/**
|
|
10652
|
-
* Tag: `root` on the rendered element (your `as`, default `<span>`); `
|
|
10653
|
-
*
|
|
10654
|
-
* `
|
|
12204
|
+
* Tag: `root` on the rendered element (your `as`, default `<span>`); `media` on the element of the
|
|
12205
|
+
* media slot; `icon` on the icon box; `primaryText` on the content span; `secondaryText` on the
|
|
12206
|
+
* second line of text; `dismissButton` on the Dismiss button; `dismissIcon` on the icon inside it
|
|
12207
|
+
* (what `dismissIcon` renders, a merged Button's icon span, else the default `<svg>`).
|
|
10655
12208
|
*/
|
|
10656
12209
|
export declare const tagClassNames: {
|
|
10657
12210
|
readonly root: "wave-tag";
|
|
12211
|
+
readonly media: "wave-tag__media";
|
|
12212
|
+
readonly icon: "wave-tag__icon";
|
|
10658
12213
|
readonly primaryText: "wave-tag__primary-text";
|
|
12214
|
+
readonly secondaryText: "wave-tag__secondary-text";
|
|
10659
12215
|
readonly dismissButton: "wave-tag__dismiss-button";
|
|
10660
12216
|
readonly dismissIcon: "wave-tag__dismiss-icon";
|
|
10661
12217
|
};
|
|
10662
12218
|
|
|
12219
|
+
/**
|
|
12220
|
+
* A set of tags with one keyboard model: by default an APG toolbar (`role="toolbar"`), or with
|
|
12221
|
+
* `role="list"` a list of tags that only display.
|
|
12222
|
+
*
|
|
12223
|
+
* - **Toolbar** (the default): one Tab stop, the last focused control (at first the first enabled
|
|
12224
|
+
* one). Left/Right move between the controls when horizontal (mirrored in RTL), Up/Down when
|
|
12225
|
+
* `orientation="vertical"`, the other axis does nothing; the arrows wrap, in DOM order across
|
|
12226
|
+
* wrapped rows, and Home/End jump to the first and last control, the same rule as Toolbar.
|
|
12227
|
+
* Natively disabled controls are skipped. Use it for tags that are actions: dismissible tags,
|
|
12228
|
+
* InteractionTags (both of their buttons join the arrow order), link chips. Renders
|
|
12229
|
+
* `aria-orientation`, and `aria-disabled` while disabled.
|
|
12230
|
+
* - **List** (`role="list"`): every tag is a list item (`role="listitem"`), every control keeps
|
|
12231
|
+
* its own Tab stop and the group handles no arrow key. A tag rendered as a link or a button
|
|
12232
|
+
* takes no list item role: put the link in the tag's content (`<Tag><a href>…</a></Tag>`), or
|
|
12233
|
+
* wrap the tag in an element with `role="listitem"`.
|
|
12234
|
+
* - **Delete and Backspace** on a tag's Dismiss button, on either button of an InteractionTag with
|
|
12235
|
+
* an `InteractionTag.Secondary`, or on a link in a dismissible tag's text, dismiss the tag (a
|
|
12236
|
+
* held key dismisses one tag). Enter, Space and a click on the Dismiss button do too.
|
|
12237
|
+
* - **Defaults for its tags**: `size`, `appearance`, `shape` and, for Tags, `dismissible` (a tag's
|
|
12238
|
+
* own value wins; an InteractionTag is dismissible when it has a Secondary), and `disabled`,
|
|
12239
|
+
* which disables every tag (a tag cannot re-enable itself).
|
|
12240
|
+
* - **`onDismiss(value)`** is called on every dismissal, after the Tag's own `onDismiss` or the
|
|
12241
|
+
* Secondary's `onClick` (whose `preventDefault()` keeps the group from being called). Remove
|
|
12242
|
+
* the tag from your state: when the tag that had focus goes, focus moves to the next tag, else
|
|
12243
|
+
* the previous one, else `fallbackFocusRef`, so it never falls to the page. Give every tag a
|
|
12244
|
+
* `value`. A dismissal you refuse (the tag stays) moves no focus.
|
|
12245
|
+
* - **Selection**: with `value`, `defaultValue` or `onValueChange` (Fluent's `selectedValues`,
|
|
12246
|
+
* `defaultSelectedValues` and `onTagSelect`) the group selects. Each `InteractionTag.Primary`
|
|
12247
|
+
* is then a toggle (`aria-pressed`): a click, Enter or Space adds its tag's `value` to the
|
|
12248
|
+
* selection or removes it, after the Primary's `onClick` (whose `preventDefault()` cancels the
|
|
12249
|
+
* toggle); the arrow keys only move. `onValueChange` receives the values in selection order,
|
|
12250
|
+
* and values without a tag are kept. Dismissing a selected InteractionTag calls `onDismiss`
|
|
12251
|
+
* and then `onValueChange` without its value. Plain Tags are never selected; selection is
|
|
12252
|
+
* multiple only (RadioGroup or `Toolbar.RadioGroup` for a single choice).
|
|
12253
|
+
* - **Forms**: a selecting group with `name` submits one entry per selected value, also from
|
|
12254
|
+
* outside its form with `form`; `required` blocks the submission of an empty selection and
|
|
12255
|
+
* moves focus to the group's Tab stop (native validation only, no `aria-required`); a form
|
|
12256
|
+
* reset restores `defaultValue`. A disabled group submits nothing, and a group that does not
|
|
12257
|
+
* select renders no form input.
|
|
12258
|
+
* - No accessible name by default: name the group with `aria-label` or `aria-labelledby`.
|
|
12259
|
+
* - Renders `data-orientation`, `data-size`, `data-appearance`, `data-shape` and, while
|
|
12260
|
+
* disabled, `data-disabled`.
|
|
12261
|
+
*
|
|
12262
|
+
* @example
|
|
12263
|
+
* const [filters, setFilters] = React.useState(['Red', 'Blue', 'Large']);
|
|
12264
|
+
* const reset = React.useRef<HTMLButtonElement>(null);
|
|
12265
|
+
* <TagGroup
|
|
12266
|
+
* aria-label="Active filters"
|
|
12267
|
+
* dismissible
|
|
12268
|
+
* fallbackFocusRef={reset}
|
|
12269
|
+
* onDismiss={(value) => setFilters((current) => current.filter((f) => f !== value))}
|
|
12270
|
+
* >
|
|
12271
|
+
* {filters.map((filter) => (
|
|
12272
|
+
* <Tag key={filter} value={filter}>
|
|
12273
|
+
* {filter}
|
|
12274
|
+
* </Tag>
|
|
12275
|
+
* ))}
|
|
12276
|
+
* </TagGroup>
|
|
12277
|
+
* <Button ref={reset} onClick={() => setFilters(['Red', 'Blue', 'Large'])}>Reset filters</Button>
|
|
12278
|
+
*
|
|
12279
|
+
* @example
|
|
12280
|
+
* // Selectable chips, submitted with a form as "fruit".
|
|
12281
|
+
* const [fruit, setFruit] = React.useState<string[]>(['plum']);
|
|
12282
|
+
* <TagGroup aria-label="Fruit" name="fruit" value={fruit} onValueChange={setFruit}>
|
|
12283
|
+
* <InteractionTag value="cherry">
|
|
12284
|
+
* <InteractionTag.Primary>Cherry</InteractionTag.Primary>
|
|
12285
|
+
* </InteractionTag>
|
|
12286
|
+
* <InteractionTag value="plum">
|
|
12287
|
+
* <InteractionTag.Primary>Plum</InteractionTag.Primary>
|
|
12288
|
+
* </InteractionTag>
|
|
12289
|
+
* </TagGroup>
|
|
12290
|
+
*/
|
|
12291
|
+
export declare const TagGroup: {
|
|
12292
|
+
({ role: roleProp, orientation, size: sizeProp, appearance: appearanceProp, shape: shapeProp, disabled, dismissible, onDismiss, fallbackFocusRef, value: valueProp, defaultValue, onValueChange, name, form, required, className, onKeyDown, onFocus, "aria-orientation": ariaOrientation, "aria-disabled": ariaDisabled, ref, children, ...rest }: TagGroupProps): React_2.JSX.Element;
|
|
12293
|
+
displayName: string;
|
|
12294
|
+
};
|
|
12295
|
+
|
|
12296
|
+
/** TagGroup: `root` on the group element (the toolbar or the list). */
|
|
12297
|
+
export declare const tagGroupClassNames: {
|
|
12298
|
+
readonly root: "wave-tag-group";
|
|
12299
|
+
};
|
|
12300
|
+
|
|
12301
|
+
/** Props of {@link TagGroup}: the element that holds the tags (a `<div>`). */
|
|
12302
|
+
export declare interface TagGroupProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'defaultValue'> {
|
|
12303
|
+
/**
|
|
12304
|
+
* `'toolbar'`: one Tab stop and arrow keys, for tags that are actions (dismissible tags,
|
|
12305
|
+
* InteractionTags, links). `'list'`: a list (every tag gets `role="listitem"`), each control
|
|
12306
|
+
* its own Tab stop and no arrow keys, for tags that only display. Another role keeps the
|
|
12307
|
+
* toolbar keyboard; `'listbox'` is not supported (an option cannot hold a Dismiss button).
|
|
12308
|
+
* Name the group with `aria-label` or `aria-labelledby`.
|
|
12309
|
+
* @default 'toolbar'
|
|
12310
|
+
*/
|
|
12311
|
+
role?: React_2.AriaRole;
|
|
12312
|
+
/**
|
|
12313
|
+
* Layout and arrow-key axis, as on Toolbar: Left/Right (mirrored in RTL) when horizontal,
|
|
12314
|
+
* Up/Down when vertical; a wrapping set moves in DOM order. `aria-orientation` (toolbar role)
|
|
12315
|
+
* and `data-orientation`.
|
|
12316
|
+
* @default 'horizontal'
|
|
12317
|
+
*/
|
|
12318
|
+
orientation?: Orientation;
|
|
12319
|
+
/** Default `size` of its tags (a tag's own wins) and the gap between them. @default 'medium' */
|
|
12320
|
+
size?: TagSize;
|
|
12321
|
+
/** Default `appearance` of its tags (a tag's own wins). @default 'filled' */
|
|
12322
|
+
appearance?: TagAppearance;
|
|
12323
|
+
/** Default `shape` of its tags (a tag's own wins). @default 'circular' */
|
|
12324
|
+
shape?: TagShape;
|
|
12325
|
+
/**
|
|
12326
|
+
* Disables every tag: a tag cannot re-enable itself. A control that has focus keeps it,
|
|
12327
|
+
* unavailable, until focus leaves it. `aria-disabled` (not with `role="list"`), `data-disabled`.
|
|
12328
|
+
* @default false
|
|
12329
|
+
*/
|
|
12330
|
+
disabled?: boolean;
|
|
12331
|
+
/**
|
|
12332
|
+
* Default `dismissible` of its Tags (a Tag's own value wins). An InteractionTag is dismissible
|
|
12333
|
+
* when it has an `InteractionTag.Secondary`.
|
|
12334
|
+
* @default false
|
|
12335
|
+
*/
|
|
12336
|
+
dismissible?: boolean;
|
|
12337
|
+
/**
|
|
12338
|
+
* Called with the tag's `value` on every dismissal: a click, Enter or Space on a Dismiss
|
|
12339
|
+
* button, or Delete or Backspace on a tag (Fluent's `onDismiss(event, { value })`). Remove the
|
|
12340
|
+
* tag from your state; when it goes, focus moves to the next tag, else the previous one, else
|
|
12341
|
+
* `fallbackFocusRef`. Fluent's TagGroup moves focus as it calls `onDismiss`, whether or not the
|
|
12342
|
+
* tag goes, and has no fallback. Dismissing a selected tag also removes its value from the
|
|
12343
|
+
* selection; Fluent's TagGroup leaves the selection alone.
|
|
12344
|
+
*/
|
|
12345
|
+
onDismiss?: (value: string) => void;
|
|
12346
|
+
/**
|
|
12347
|
+
* Where focus goes when the tag that had it is removed and no other tag can take it, for
|
|
12348
|
+
* example an "Add" or "Reset filters" button outside the group. WaveUI-only.
|
|
12349
|
+
*/
|
|
12350
|
+
fallbackFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
12351
|
+
/**
|
|
12352
|
+
* The selected values (controlled), in selection order: the `value`s of the pressed
|
|
12353
|
+
* InteractionTags. Passing `value`, `defaultValue` or `onValueChange` makes the group select
|
|
12354
|
+
* (Fluent's `selectedValues`). Plain Tags are never selected.
|
|
12355
|
+
*/
|
|
12356
|
+
value?: readonly string[];
|
|
12357
|
+
/** Initially selected values (uncontrolled; Fluent's `defaultSelectedValues`). @default [] */
|
|
12358
|
+
defaultValue?: readonly string[];
|
|
12359
|
+
/** Called with the new selected values when they change (Fluent's `onTagSelect`). */
|
|
12360
|
+
onValueChange?: (value: string[]) => void;
|
|
12361
|
+
/**
|
|
12362
|
+
* Form field name: one hidden input per selected value (a selecting group only). Fluent's
|
|
12363
|
+
* TagGroup submits nothing.
|
|
12364
|
+
*/
|
|
12365
|
+
name?: string;
|
|
12366
|
+
/** The id of the form the hidden inputs belong to, when the group is outside it. */
|
|
12367
|
+
form?: string;
|
|
12368
|
+
/**
|
|
12369
|
+
* An empty selection blocks the form's submission (native validation only: a toolbar has no
|
|
12370
|
+
* `aria-required`).
|
|
12371
|
+
* @default false
|
|
12372
|
+
*/
|
|
12373
|
+
required?: boolean;
|
|
12374
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
12375
|
+
}
|
|
12376
|
+
|
|
10663
12377
|
/**
|
|
10664
12378
|
* The Tag's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).
|
|
10665
|
-
* Every other prop comes from the rendered element (`as`, default `span`).
|
|
12379
|
+
* Every other prop comes from the rendered element (`as`, default `span`). The own props shadow
|
|
12380
|
+
* the element's attributes of the same names: `TagProps<'button'>['value']` is a `string`.
|
|
10666
12381
|
*/
|
|
10667
12382
|
export declare interface TagOwnProps {
|
|
10668
12383
|
/**
|
|
10669
|
-
*
|
|
10670
|
-
*
|
|
12384
|
+
* Colour scheme: `filled` (a neutral fill), `outline` (a border on the surface behind it) or
|
|
12385
|
+
* `brand` (a light brand tint that follows the brand ramp).
|
|
12386
|
+
* @default the TagGroup's `appearance`, else 'filled'
|
|
12387
|
+
*/
|
|
12388
|
+
appearance?: TagAppearance;
|
|
12389
|
+
/**
|
|
12390
|
+
* `medium` (28px tall, the 0.10 look), `small` (24px) or `extra-small` (20px); an Avatar in
|
|
12391
|
+
* `media` is 24, 20 or 16px. Fluent's medium tag is 32px.
|
|
12392
|
+
* @default the TagGroup's `size`, else 'medium'
|
|
12393
|
+
*/
|
|
12394
|
+
size?: TagSize;
|
|
12395
|
+
/**
|
|
12396
|
+
* `circular` (a pill, the 0.10 look) or `rounded` (4px corners). Fluent's default is `rounded`.
|
|
12397
|
+
* @default the TagGroup's `shape`, else 'circular'
|
|
12398
|
+
*/
|
|
12399
|
+
shape?: TagShape;
|
|
12400
|
+
/**
|
|
12401
|
+
* Dims the tag and disables its Dismiss button natively (no `onDismiss`, out of the Tab
|
|
12402
|
+
* order), whatever `dismissIcon` passes. A disabled TagGroup disables every tag. A Dismiss
|
|
12403
|
+
* button that has focus when the tag is disabled keeps it, unavailable, until focus leaves it.
|
|
12404
|
+
* Rendered as `data-disabled`. With `as="a"` the link is disabled too: `aria-disabled="true"`,
|
|
12405
|
+
* `role="link"`, no `href` (out of the Tab order) and no click; a link that has focus keeps it,
|
|
12406
|
+
* and its `href`, until focus leaves it. With another `as`, an element that takes a native
|
|
12407
|
+
* `disabled` (a `<button>`) or a component receives `disabled`; a `<button>` that has focus
|
|
12408
|
+
* when it is disabled keeps it, unavailable (`aria-disabled`, no click), until focus leaves it.
|
|
12409
|
+
* @default false
|
|
12410
|
+
*/
|
|
12411
|
+
disabled?: boolean;
|
|
12412
|
+
/**
|
|
12413
|
+
* Draws the selected look (the brand fill) and sets `data-selected`. A Tag is not interactive,
|
|
12414
|
+
* so the state is not announced: for a tag the user selects, use `InteractionTag` (its
|
|
12415
|
+
* `InteractionTag.Primary` is a toggle button). Disabled wins over the selected look.
|
|
12416
|
+
* @default false
|
|
12417
|
+
*/
|
|
12418
|
+
selected?: boolean;
|
|
12419
|
+
/**
|
|
12420
|
+
* Identifies the tag in a TagGroup: the value its `onDismiss` receives (without one, a generated
|
|
12421
|
+
* id). Give every tag of a group its own value. Renders nothing on the default `<span>`; with
|
|
12422
|
+
* `as`, an element that takes a native `value` (a `<button>`, an `<li>`) still receives it.
|
|
12423
|
+
*/
|
|
12424
|
+
value?: string;
|
|
12425
|
+
/**
|
|
12426
|
+
* A visual before the text, usually an `Avatar`, which takes the tag's size (24, 20 or 16px)
|
|
12427
|
+
* unless it sets its own `size`. Not interactive. It is not hidden from assistive technology:
|
|
12428
|
+
* pass `decorative` to an Avatar whose name repeats the tag's text. Use `media` or `icon`, not
|
|
12429
|
+
* both.
|
|
12430
|
+
*/
|
|
12431
|
+
media?: Slot<'span'>;
|
|
12432
|
+
/** A decorative icon before the text (`aria-hidden`), in a 20, 16 or 12px box. */
|
|
12433
|
+
icon?: Slot<'span'>;
|
|
12434
|
+
/**
|
|
12435
|
+
* A second, smaller line under the text (`secondaryText="Designer"`). It is not part of the
|
|
12436
|
+
* Dismiss button's name. A small or extra-small tag grows to 28px to fit it.
|
|
12437
|
+
*/
|
|
12438
|
+
secondaryText?: React_2.ReactNode;
|
|
12439
|
+
/**
|
|
12440
|
+
* Whether the tag renders a Dismiss button. `onDismiss` and `dismissIcon` take effect only with
|
|
12441
|
+
* it (a development warning says so when they are passed without it). `dismissible={false}`
|
|
12442
|
+
* opts a tag out of a dismissible TagGroup. A Dismiss button cannot sit inside a link or a
|
|
12443
|
+
* button: a dismissible tag rendered as one holds it inside (a development warning). For a
|
|
12444
|
+
* dismissible link chip, put the link in the content,
|
|
12445
|
+
* `<Tag dismissible><a href="/topics/react">React</a></Tag>`; for an action with a separate
|
|
12446
|
+
* Dismiss button, use `InteractionTag`. Fluent's dismissible Tag is a single button that
|
|
12447
|
+
* dismisses when it is activated.
|
|
12448
|
+
* @default the TagGroup's `dismissible`, else `false`
|
|
10671
12449
|
*/
|
|
10672
12450
|
dismissible?: boolean;
|
|
10673
12451
|
/**
|
|
10674
|
-
* Called when the
|
|
10675
|
-
* the
|
|
10676
|
-
*
|
|
12452
|
+
* Called when the Dismiss button is activated: a click, Enter, Space, Delete or Backspace (a
|
|
12453
|
+
* held key dismisses once). Passing it does not render the button: set `dismissible` too. In a
|
|
12454
|
+
* TagGroup the group's `onDismiss(value)` is called after it, and focus moves to the next tag
|
|
12455
|
+
* when the tag is removed. A standalone Tag cannot keep focus once you remove it: move focus
|
|
12456
|
+
* yourself (see "Focus after dismissal" on {@link Tag}). Fluent's Tag dismisses on Delete and
|
|
12457
|
+
* Backspace only inside a TagGroup.
|
|
10677
12458
|
*/
|
|
10678
12459
|
onDismiss?: () => void;
|
|
10679
12460
|
/**
|
|
10680
12461
|
* Content of the dismiss button (an icon). The Tag always renders its own dismiss
|
|
10681
|
-
* `<button type="button">`, wired to `onDismiss` and named by `dismissLabel` plus the tag
|
|
10682
|
-
*
|
|
12462
|
+
* `<button type="button">`, wired to `onDismiss` and named by `dismissLabel` plus the tag's text
|
|
12463
|
+
* (its children; not `media`, `icon` or `secondaryText`); this slot only replaces the icon
|
|
12464
|
+
* inside it.
|
|
10683
12465
|
*
|
|
10684
12466
|
* A `<button>` element or a Wave `Button` passed here is not nested (a button cannot contain a
|
|
10685
12467
|
* button): its props are merged into the dismiss button (its `onClick` runs first and can call
|
|
@@ -10697,7 +12479,7 @@ export declare interface TagOwnProps {
|
|
|
10697
12479
|
* The `aria-*` attributes of an icon slot object also go to the dismiss button, because the icon
|
|
10698
12480
|
* is `aria-hidden`.
|
|
10699
12481
|
*
|
|
10700
|
-
* The dismiss button's name is `dismissLabel` plus the tag
|
|
12482
|
+
* The dismiss button's name is `dismissLabel` plus the tag's text ("Dismiss Cherry"):
|
|
10701
12483
|
* `aria-label` and `aria-labelledby` on the slot are ignored (development warning). Icon
|
|
10702
12484
|
* content is decorative (`aria-hidden`). The children of a merged `<button>`/`Button` (or its
|
|
10703
12485
|
* `dangerouslySetInnerHTML` markup) are rendered as is inside the dismiss button, next to the
|
|
@@ -10717,58 +12499,162 @@ export declare interface TagOwnProps {
|
|
|
10717
12499
|
*/
|
|
10718
12500
|
dismissIcon?: Slot<'span'> | SlotObject<'button'>;
|
|
10719
12501
|
/**
|
|
10720
|
-
* Visually hidden text that names the dismiss button together with the tag
|
|
10721
|
-
*
|
|
10722
|
-
* merged `<button>` slot replaces it (see
|
|
12502
|
+
* Visually hidden text that names the dismiss button together with the tag's text (its
|
|
12503
|
+
* children; not `media`, `icon` or `secondaryText`; `aria-labelledby`), e.g. "Dismiss Cherry".
|
|
12504
|
+
* Localise it here. A text label rendered by a merged `<button>` slot replaces it (see
|
|
12505
|
+
* `dismissIcon`). TagPicker names the Dismiss buttons of the tags it renders itself with its
|
|
12506
|
+
* `labels.remove`.
|
|
10723
12507
|
* @default 'Dismiss'
|
|
10724
12508
|
*/
|
|
10725
12509
|
dismissLabel?: string;
|
|
10726
12510
|
}
|
|
10727
12511
|
|
|
10728
12512
|
/**
|
|
10729
|
-
* A multi-select combobox that shows the selected values as removable tags.
|
|
10730
|
-
*
|
|
10731
|
-
*
|
|
10732
|
-
*
|
|
10733
|
-
*
|
|
10734
|
-
*
|
|
10735
|
-
*
|
|
10736
|
-
*
|
|
10737
|
-
*
|
|
10738
|
-
* `
|
|
10739
|
-
*
|
|
12513
|
+
* A multi-select combobox that shows the selected values as removable tags.
|
|
12514
|
+
*
|
|
12515
|
+
* - **Two forms.** The array form, `<TagPicker options={…} />`, is the parts with their defaults:
|
|
12516
|
+
* `TagPicker.Control` (holding `TagPicker.Group` and `TagPicker.Input`) and `TagPicker.List`.
|
|
12517
|
+
* The parts form replaces only the part you need: your own Tags in `TagPicker.Group` (an
|
|
12518
|
+
* Avatar in each), rich `TagPicker.Option`s in `TagPicker.List`, or `TagPicker.Button`, a
|
|
12519
|
+
* select-only trigger, in place of the Input. Render `TagPicker.Control` and `TagPicker.List`
|
|
12520
|
+
* directly inside TagPicker (a Fragment is fine); without a List the default list is added.
|
|
12521
|
+
* `options` names the values in both forms (`media` and `secondaryContent` show in the default
|
|
12522
|
+
* options, `media` in the default tags too); with a List that has children, its options are
|
|
12523
|
+
* the options, and the options of selected values stay rendered (TagPicker hides them).
|
|
12524
|
+
* - **Keyboard.** Typing filters the options (`filter`, by default a case-insensitive match on
|
|
12525
|
+
* `textValue ?? label`); the option whose label equals the typed text becomes active, else the
|
|
12526
|
+
* first match. ArrowDown/ArrowUp move the highlight (`aria-activedescendant`), Enter adds the
|
|
12527
|
+
* active option and keeps the list open (with nothing active, Enter is left to the surrounding
|
|
12528
|
+
* form), Escape closes the list (and then clears the typed text). Backspace in the empty input,
|
|
12529
|
+
* and Left (Right in RTL) with the caret at its start, focus the last tag; Delete, Backspace,
|
|
12530
|
+
* Enter or Space on a remove button remove its tag and focus the next tag, else the input; a
|
|
12531
|
+
* click on one focuses the input. Additions and removals are announced ("Cherry removed, 2
|
|
12532
|
+
* selected"), and so is "No matches" for text that matches no option.
|
|
12533
|
+
* - **Free tagging.** With `allowCreate`, text that matches no option label, no selected value
|
|
12534
|
+
* (ignoring case) and no option value ends the list with a create option (`Create "infra"`);
|
|
12535
|
+
* Enter on it or a click adds the text as a tag after `onOptionCreate(text)` and clears the
|
|
12536
|
+
* text.
|
|
12537
|
+
* - **End buttons.** A chevron (`expandIcon`, `false` hides it) opens and closes the list without
|
|
12538
|
+
* taking focus; `clearable` adds a clear button, a Tab stop after the input, which removes every
|
|
12539
|
+
* tag. A press on the field's empty area toggles the list.
|
|
12540
|
+
* - **One line.** `overflow="count"` keeps the tags on one line while focus is outside the picker
|
|
12541
|
+
* and its list is closed; the tags that do not fit give way to "+N".
|
|
12542
|
+
* - **Names.** The tags form a list named "Selected"; the trigger is described by a summary of the
|
|
12543
|
+
* selected labels ("Selected: Apple, Banana"). These built-in texts are English; `labels`
|
|
12544
|
+
* localizes them.
|
|
12545
|
+
* - **Routing.** The trigger (`TagPicker.Input` or `TagPicker.Button`) receives `id`,
|
|
12546
|
+
* `aria-label`, `aria-labelledby`, `aria-describedby`, `aria-invalid`, `aria-required`,
|
|
12547
|
+
* `aria-errormessage`, `aria-details`, `tabIndex` and `autoFocus`; the Input also
|
|
12548
|
+
* `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp`, `controlRef` and the text input attributes
|
|
12549
|
+
* `autoComplete`, `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and
|
|
12550
|
+
* `enterKeyHint` (with the Button, pass handlers and `ref` on it). `ref`, `className`, `style`,
|
|
12551
|
+
* other `aria-*` attributes and the remaining props stay on the root `<div>`. Inside a `Field`
|
|
12552
|
+
* the trigger is labelled and described by it; the field shows the error look whenever the
|
|
12553
|
+
* trigger ends up `aria-invalid`. With `name`/`required` the values take part in form
|
|
12554
|
+
* submission, validation and reset. Selected values without a matching option show their raw
|
|
12555
|
+
* value.
|
|
12556
|
+
* - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
12557
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'` (a Field or provider `small`
|
|
12558
|
+
* gives `'medium'` too, since TagPicker has no `small`); `appearance` from its own prop, then
|
|
12559
|
+
* `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
12560
|
+
* `data-appearance` on the root `<div>`, and the parts take neither. The tags are one Tag size
|
|
12561
|
+
* smaller. The option list keeps its size.
|
|
12562
|
+
* - **Server rendering.** The open list renders only in the browser: an open list (`defaultOpen`,
|
|
12563
|
+
* `open`) is closed in the server HTML and opens once the picker has hydrated; the tags of
|
|
12564
|
+
* registered options show their labels in the server HTML.
|
|
12565
|
+
*
|
|
12566
|
+
* Fluent's `selectedOptions` and `onOptionSelect` are `value` and `onValueChange` (plus
|
|
12567
|
+
* `onOptionCreate`). `TagPickerOption` is both the type of an `options` entry and the flat name of
|
|
12568
|
+
* `TagPicker.Option`.
|
|
10740
12569
|
*
|
|
10741
|
-
*
|
|
10742
|
-
*
|
|
10743
|
-
* The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,
|
|
10744
|
-
* `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,
|
|
10745
|
-
* `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,
|
|
10746
|
-
* `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and `enterKeyHint`.
|
|
10747
|
-
* `ref`, `className`, `style`, other `aria-*` attributes and the remaining props stay on the root
|
|
10748
|
-
* `<div>`. Inside a `Field` the input is labelled and described by it. The tag area shows the
|
|
10749
|
-
* error look whenever the input ends up `aria-invalid` (its own `aria-invalid` or a `Field`
|
|
10750
|
-
* error). With `name`/`required` the values take part in form submission, validation and reset.
|
|
10751
|
-
* Selected values without a matching option are shown with their raw value. The open list renders
|
|
10752
|
-
* only in the browser: an open list (`defaultOpen`, `open`) is closed in the server HTML and opens
|
|
10753
|
-
* once the picker has hydrated.
|
|
12570
|
+
* @example
|
|
12571
|
+
* <TagPicker aria-label="Fruits" options={[{ value: 'apple', label: 'Apple' }]} clearable />
|
|
10754
12572
|
*
|
|
10755
|
-
*
|
|
10756
|
-
*
|
|
10757
|
-
*
|
|
10758
|
-
*
|
|
10759
|
-
*
|
|
12573
|
+
* @example
|
|
12574
|
+
* <TagPicker aria-label="People" value={people} onValueChange={setPeople}>
|
|
12575
|
+
* <TagPicker.Control>
|
|
12576
|
+
* <TagPicker.Group>
|
|
12577
|
+
* {people.map((id) => (
|
|
12578
|
+
* <Tag key={id} value={id} media={<Avatar name={nameOf(id)} />} dismissLabel="Remove">
|
|
12579
|
+
* {nameOf(id)}
|
|
12580
|
+
* </Tag>
|
|
12581
|
+
* ))}
|
|
12582
|
+
* </TagPicker.Group>
|
|
12583
|
+
* <TagPicker.Input />
|
|
12584
|
+
* </TagPicker.Control>
|
|
12585
|
+
* <TagPicker.List>
|
|
12586
|
+
* <TagPicker.Option value="katri" label="Katri Athokas" secondaryContent="Designer">
|
|
12587
|
+
* Katri Athokas
|
|
12588
|
+
* </TagPicker.Option>
|
|
12589
|
+
* </TagPicker.List>
|
|
12590
|
+
* </TagPicker>
|
|
12591
|
+
*/
|
|
12592
|
+
export declare const TagPicker: {
|
|
12593
|
+
(props: TagPickerProps): JSX.Element;
|
|
12594
|
+
displayName: string;
|
|
12595
|
+
} & {
|
|
12596
|
+
Control: {
|
|
12597
|
+
(props: TagPickerControlProps): JSX.Element | null;
|
|
12598
|
+
displayName: string;
|
|
12599
|
+
};
|
|
12600
|
+
Group: {
|
|
12601
|
+
(props: TagPickerGroupProps): JSX.Element | null;
|
|
12602
|
+
displayName: string;
|
|
12603
|
+
};
|
|
12604
|
+
Input: {
|
|
12605
|
+
(props: TagPickerInputProps): JSX.Element | null;
|
|
12606
|
+
displayName: string;
|
|
12607
|
+
};
|
|
12608
|
+
Button: {
|
|
12609
|
+
(props: TagPickerButtonProps): JSX.Element | null;
|
|
12610
|
+
displayName: string;
|
|
12611
|
+
};
|
|
12612
|
+
List: {
|
|
12613
|
+
(props: TagPickerListProps): JSX.Element | null;
|
|
12614
|
+
displayName: string;
|
|
12615
|
+
};
|
|
12616
|
+
Option: NamedExoticComponent<TagPickerOptionProps>;
|
|
12617
|
+
OptionGroup: FC<OptionGroupProps>;
|
|
12618
|
+
};
|
|
12619
|
+
|
|
12620
|
+
/**
|
|
12621
|
+
* A select-only trigger for a TagPicker (`TagPicker.Button`), in place of `TagPicker.Input`: a
|
|
12622
|
+
* `<button role="combobox">` for a short fixed list, with no text entry. Down, Up, Home, End and
|
|
12623
|
+
* typing a letter open the list and move; Enter and Space open it or add the active option and
|
|
12624
|
+
* keep it open; Escape, Alt+Up and Tab close it; a click toggles it. Backspace and Left (Right in
|
|
12625
|
+
* RTL) focus the last tag. It shows the placeholder while no tag is selected, else nothing, and
|
|
12626
|
+
* stays the click area of the rest of the row. No query, no filter and no create option
|
|
12627
|
+
* (`allowCreate` needs `TagPicker.Input`). TagPicker's `id`, name, description and Field wiring
|
|
12628
|
+
* reach it; pass handlers and `ref` on it (TagPicker's `onKeyDown` and `controlRef` are the
|
|
12629
|
+
* Input's). Read-only, it renders `aria-readonly`. Fluent's TagPickerButton is visually hidden
|
|
12630
|
+
* once a tag is selected; this one stays.
|
|
10760
12631
|
*/
|
|
10761
|
-
export declare const
|
|
10762
|
-
(props:
|
|
12632
|
+
export declare const TagPickerButton: {
|
|
12633
|
+
(props: TagPickerButtonProps): React_2.JSX.Element | null;
|
|
10763
12634
|
displayName: string;
|
|
10764
12635
|
};
|
|
10765
12636
|
|
|
12637
|
+
/** TagPicker.Button: `root` on the `role="combobox"` button. */
|
|
12638
|
+
export declare const tagPickerButtonClassNames: {
|
|
12639
|
+
readonly root: "wave-tag-picker-button";
|
|
12640
|
+
};
|
|
12641
|
+
|
|
12642
|
+
/** Props of TagPicker.Button: a trigger without text entry (select-only). */
|
|
12643
|
+
export declare interface TagPickerButtonProps extends Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'type' | 'disabled' | 'children'> {
|
|
12644
|
+
/** Shown while no tag is selected. @default TagPicker's `placeholder` */
|
|
12645
|
+
placeholder?: string;
|
|
12646
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
12647
|
+
}
|
|
12648
|
+
|
|
10766
12649
|
/**
|
|
10767
|
-
* TagPicker: `root` on the outer element; `control` on the tag area
|
|
10768
|
-
*
|
|
10769
|
-
*
|
|
10770
|
-
*
|
|
10771
|
-
*
|
|
12650
|
+
* TagPicker: `root` on the outer element; `control` on the tag area and `group` on the list of
|
|
12651
|
+
* tags (both deprecated, kept until 1.0 next to TagPicker.Control's and TagPicker.Group's own
|
|
12652
|
+
* classes); `tag` on each tag; `removeButton` on each tag's remove button; `input` on the
|
|
12653
|
+
* `role="combobox"` input; `expandButton` on the expand button and `expandIcon` on its glyph;
|
|
12654
|
+
* `clearButton` on the clear button; `listbox` on the `role="listbox"` list; `option` on each
|
|
12655
|
+
* Option it renders (which also carries Option's classes); `createOption` on the create option of
|
|
12656
|
+
* `allowCreate`; `overflowCount` on the "+N" count of the single-line layout; `surface` on the
|
|
12657
|
+
* portaled popup; `emptyMessage` on the "No matches" row.
|
|
10772
12658
|
*/
|
|
10773
12659
|
export declare const tagPickerClassNames: {
|
|
10774
12660
|
readonly root: "wave-tag-picker";
|
|
@@ -10777,12 +12663,121 @@ export declare const tagPickerClassNames: {
|
|
|
10777
12663
|
readonly tag: "wave-tag-picker__tag";
|
|
10778
12664
|
readonly removeButton: "wave-tag-picker__remove-button";
|
|
10779
12665
|
readonly input: "wave-tag-picker__input";
|
|
12666
|
+
readonly expandButton: "wave-tag-picker__expand-button";
|
|
12667
|
+
readonly expandIcon: "wave-tag-picker__expand-icon";
|
|
12668
|
+
readonly clearButton: "wave-tag-picker__clear-button";
|
|
10780
12669
|
readonly listbox: "wave-tag-picker__listbox";
|
|
10781
12670
|
readonly option: "wave-tag-picker__option";
|
|
12671
|
+
readonly createOption: "wave-tag-picker__create-option";
|
|
12672
|
+
readonly overflowCount: "wave-tag-picker__overflow-count";
|
|
10782
12673
|
readonly surface: "wave-tag-picker__surface";
|
|
10783
12674
|
readonly emptyMessage: "wave-tag-picker__empty-message";
|
|
10784
12675
|
};
|
|
10785
12676
|
|
|
12677
|
+
/**
|
|
12678
|
+
* The field of a TagPicker (`TagPicker.Control`): a `role="group"` box in the picker's look that
|
|
12679
|
+
* holds the tag list, the trigger and, at its inline end, the clear button (`clearable`) and the
|
|
12680
|
+
* expand button (`expandIcon`, a chevron by default; this part's `expandIcon` wins over
|
|
12681
|
+
* TagPicker's). Without children it renders `TagPicker.Group` and `TagPicker.Input`. A press on
|
|
12682
|
+
* its empty area (not on a tag's button or link, or a trigger) toggles the list and keeps focus in
|
|
12683
|
+
* the trigger; read-only, it only focuses the trigger. Render exactly one trigger in it,
|
|
12684
|
+
* `TagPicker.Input` or `TagPicker.Button`. It takes neither `size` nor `appearance`: TagPicker's
|
|
12685
|
+
* apply.
|
|
12686
|
+
*/
|
|
12687
|
+
export declare const TagPickerControl: {
|
|
12688
|
+
(props: TagPickerControlProps): React_2.JSX.Element | null;
|
|
12689
|
+
displayName: string;
|
|
12690
|
+
};
|
|
12691
|
+
|
|
12692
|
+
/**
|
|
12693
|
+
* TagPicker.Control: `root` on the field that holds the tags, the trigger and the end buttons (it
|
|
12694
|
+
* also carries TagPicker's `control` part).
|
|
12695
|
+
*/
|
|
12696
|
+
export declare const tagPickerControlClassNames: {
|
|
12697
|
+
readonly root: "wave-tag-picker-control";
|
|
12698
|
+
};
|
|
12699
|
+
|
|
12700
|
+
/** Props of TagPicker.Control: the field that holds the tags, the trigger and the end buttons. */
|
|
12701
|
+
export declare interface TagPickerControlProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
12702
|
+
/** As TagPicker's `expandIcon`; wins over it when it is not `undefined`. */
|
|
12703
|
+
expandIcon?: Slot<'span'>;
|
|
12704
|
+
/** @default `<TagPicker.Group /><TagPicker.Input />` */
|
|
12705
|
+
children?: React_2.ReactNode;
|
|
12706
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
12707
|
+
}
|
|
12708
|
+
|
|
12709
|
+
/**
|
|
12710
|
+
* The selected tags of a TagPicker (`TagPicker.Group`): a `TagGroup` with `role="list"` named
|
|
12711
|
+
* "Selected" (`labels.selected`, or its own `aria-label`), rendered only while a value is
|
|
12712
|
+
* selected. Without children it renders a Tag per selected value, named by the option's label,
|
|
12713
|
+
* with a remove button named "Remove <label>" (`labels.remove`). Your own Tags in it are the
|
|
12714
|
+
* selected values' tags: give each a `value`, leave `dismissible` unset (a read-only picker then
|
|
12715
|
+
* shows no remove buttons), and pass `dismissLabel="Remove"` for TagPicker's wording (a Tag's own
|
|
12716
|
+
* Dismiss button is named "Dismiss <text>"). Each remove button is a Tab stop; Delete, Backspace,
|
|
12717
|
+
* Enter and Space remove its tag, and focus moves to the next tag, else to the trigger; a click
|
|
12718
|
+
* focuses the trigger. Left and Right (mirrored in RTL) move between the controls of the list and
|
|
12719
|
+
* from the last one to the trigger; Escape returns to the trigger. Its tags take the picker's look,
|
|
12720
|
+
* one Tag size smaller (a Tag's own `size` and `appearance` win). With `overflow="count"` the
|
|
12721
|
+
* tags are measured by position: render your own Tags in `value` order. Fluent's TagPickerGroup is a
|
|
12722
|
+
* listbox of tags: an option cannot hold a Dismiss button.
|
|
12723
|
+
*/
|
|
12724
|
+
export declare const TagPickerGroup: {
|
|
12725
|
+
(props: TagPickerGroupProps): React_2.JSX.Element | null;
|
|
12726
|
+
displayName: string;
|
|
12727
|
+
};
|
|
12728
|
+
|
|
12729
|
+
/**
|
|
12730
|
+
* TagPicker.Group: `root` on the list of tags (also a TagGroup's root, and TagPicker's `group`
|
|
12731
|
+
* part).
|
|
12732
|
+
*/
|
|
12733
|
+
export declare const tagPickerGroupClassNames: {
|
|
12734
|
+
readonly root: "wave-tag-picker-group";
|
|
12735
|
+
};
|
|
12736
|
+
|
|
12737
|
+
/** Props of TagPicker.Group: the list of selected tags (a TagGroup with `role="list"`). */
|
|
12738
|
+
export declare interface TagPickerGroupProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'role' | 'defaultValue'> {
|
|
12739
|
+
/**
|
|
12740
|
+
* The tags of the selected values: `Tag`s with a `value` each (leave `dismissible` unset), in
|
|
12741
|
+
* `value` order (the single-line layout matches the tags to the values by position).
|
|
12742
|
+
* @default one Tag per selected value, named "Remove <label>" (`labels.remove`)
|
|
12743
|
+
*/
|
|
12744
|
+
children?: React_2.ReactNode;
|
|
12745
|
+
/** @default TagPicker's `labels.selected` ('Selected') */
|
|
12746
|
+
'aria-label'?: string;
|
|
12747
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
12748
|
+
}
|
|
12749
|
+
|
|
12750
|
+
/**
|
|
12751
|
+
* The text field of a TagPicker (`TagPicker.Input`): the `<input role="combobox">` that filters
|
|
12752
|
+
* the options as you type, inside `TagPicker.Control`. TagPicker's `id`, name, description, Field
|
|
12753
|
+
* wiring and text input attributes reach it (its own `id`, `aria-label` and `aria-labelledby`
|
|
12754
|
+
* replace TagPicker's, and its `aria-describedby` comes first); its handlers run before
|
|
12755
|
+
* TagPicker's `onKeyDown` and the built-in keys. Backspace in the empty field, and Left (Right in
|
|
12756
|
+
* RTL) with the caret at its start, focus the last tag. The form fields are TagPicker's.
|
|
12757
|
+
*/
|
|
12758
|
+
export declare const TagPickerInput: {
|
|
12759
|
+
(props: TagPickerInputProps): React_2.JSX.Element | null;
|
|
12760
|
+
displayName: string;
|
|
12761
|
+
};
|
|
12762
|
+
|
|
12763
|
+
/**
|
|
12764
|
+
* TagPicker.Input: `root` on the `role="combobox"` input (it also carries TagPicker's `input`
|
|
12765
|
+
* part).
|
|
12766
|
+
*/
|
|
12767
|
+
export declare const tagPickerInputClassNames: {
|
|
12768
|
+
readonly root: "wave-tag-picker-input";
|
|
12769
|
+
};
|
|
12770
|
+
|
|
12771
|
+
/**
|
|
12772
|
+
* Props of TagPicker.Input: the text field, the combobox. The form fields (`name`, `form`,
|
|
12773
|
+
* `required`) are TagPicker's: its hidden inputs submit the tags, never the typed text.
|
|
12774
|
+
*/
|
|
12775
|
+
export declare interface TagPickerInputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'type' | 'size' | 'disabled' | 'readOnly' | 'name' | 'form' | 'required'> {
|
|
12776
|
+
/** Shown while no tag is selected. @default TagPicker's `placeholder` */
|
|
12777
|
+
placeholder?: string;
|
|
12778
|
+
ref?: React_2.Ref<HTMLInputElement>;
|
|
12779
|
+
}
|
|
12780
|
+
|
|
10786
12781
|
/**
|
|
10787
12782
|
* The TagPicker's built-in names, descriptions and announcements, for localization. Each member is
|
|
10788
12783
|
* optional and falls back to its English default.
|
|
@@ -10812,21 +12807,155 @@ export declare interface TagPickerLabels {
|
|
|
10812
12807
|
* @default 'No matches'
|
|
10813
12808
|
*/
|
|
10814
12809
|
noMatches?: string;
|
|
12810
|
+
/**
|
|
12811
|
+
* Text and name of the create option (`allowCreate`), from the trimmed typed text.
|
|
12812
|
+
* @default (text) => `Create "${text}"`
|
|
12813
|
+
*/
|
|
12814
|
+
create?: (text: string) => string;
|
|
12815
|
+
/** Name of the clear button (`clearable`). @default 'Clear selection' */
|
|
12816
|
+
clear?: string;
|
|
12817
|
+
/** Name of the expand button at the end of the field. @default 'Show options' */
|
|
12818
|
+
expand?: string;
|
|
12819
|
+
/**
|
|
12820
|
+
* The "+N" text of the single-line layout (`overflow="count"`); hidden from assistive
|
|
12821
|
+
* technology, which hears the input's summary of every tag.
|
|
12822
|
+
* @default (count) => `+${count}`
|
|
12823
|
+
*/
|
|
12824
|
+
overflowCount?: (count: number) => string;
|
|
12825
|
+
}
|
|
12826
|
+
|
|
12827
|
+
/**
|
|
12828
|
+
* The option list of a TagPicker (`TagPicker.List`): a `<ul role="listbox">`, multi-selectable,
|
|
12829
|
+
* that opens in a popup below the field. Render it directly inside TagPicker (a Fragment is fine);
|
|
12830
|
+
* without one TagPicker adds the default list. Without children it renders a `TagPicker.Option`
|
|
12831
|
+
* per available entry of TagPicker's `options`. With children (`TagPicker.Option`s, `Option`s,
|
|
12832
|
+
* `TagPicker.OptionGroup`s) they are the options: keep the options of selected values rendered,
|
|
12833
|
+
* since TagPicker hides them and reads their labels. Its own `aria-label`/`aria-labelledby`
|
|
12834
|
+
* replace the list's name (TagPicker's, else the Field label); its `className` comes last on the
|
|
12835
|
+
* list, its other attributes and `ref` reach the list element.
|
|
12836
|
+
*/
|
|
12837
|
+
export declare const TagPickerList: {
|
|
12838
|
+
(props: TagPickerListProps): React_2.JSX.Element | null;
|
|
12839
|
+
displayName: string;
|
|
12840
|
+
};
|
|
12841
|
+
|
|
12842
|
+
/**
|
|
12843
|
+
* TagPicker.List: `root` on the `role="listbox"` list (it also carries ListboxSurface's `list` and
|
|
12844
|
+
* TagPicker's `listbox` parts).
|
|
12845
|
+
*/
|
|
12846
|
+
export declare const tagPickerListClassNames: {
|
|
12847
|
+
readonly root: "wave-tag-picker-list";
|
|
12848
|
+
};
|
|
12849
|
+
|
|
12850
|
+
/** Props of TagPicker.List: the option list, shown in a popup while open. */
|
|
12851
|
+
export declare interface TagPickerListProps extends Omit<React_2.HTMLAttributes<HTMLUListElement>, 'role' | 'id' | 'hidden' | 'tabIndex' | 'aria-multiselectable' | 'aria-activedescendant' | 'dangerouslySetInnerHTML'> {
|
|
12852
|
+
/**
|
|
12853
|
+
* `TagPicker.Option`s, `Option`s and `TagPicker.OptionGroup`s. Keep the options of selected
|
|
12854
|
+
* values rendered: TagPicker hides them and reads their labels.
|
|
12855
|
+
* @default one TagPicker.Option per available entry of TagPicker's `options`
|
|
12856
|
+
*/
|
|
12857
|
+
children?: React_2.ReactNode;
|
|
12858
|
+
/**
|
|
12859
|
+
* Names the listbox (with `aria-labelledby`): the List's own pair replaces TagPicker's name.
|
|
12860
|
+
* @default TagPicker's `aria-label`, else its `aria-labelledby`, else the Field label
|
|
12861
|
+
*/
|
|
12862
|
+
'aria-label'?: string;
|
|
12863
|
+
/** Ids of the elements that name the listbox (see `aria-label`). */
|
|
12864
|
+
'aria-labelledby'?: string;
|
|
12865
|
+
/** Merged last onto the `role="listbox"` element (a `max-h-*` replaces the default height). */
|
|
12866
|
+
className?: string;
|
|
12867
|
+
ref?: React_2.Ref<HTMLUListElement>;
|
|
10815
12868
|
}
|
|
10816
12869
|
|
|
10817
|
-
/**
|
|
12870
|
+
/**
|
|
12871
|
+
* One entry of `options`, the array form of TagPicker's options. The component of the same name,
|
|
12872
|
+
* `TagPickerOption`, is `TagPicker.Option`, the parts form.
|
|
12873
|
+
*/
|
|
10818
12874
|
export declare interface TagPickerOption {
|
|
10819
12875
|
/** Unique identifier for the option. */
|
|
10820
12876
|
value: string;
|
|
10821
|
-
/** Display label
|
|
12877
|
+
/** Display label: the option's text, its tag's text, and the text the filter and the announcements use. */
|
|
10822
12878
|
label: string;
|
|
12879
|
+
/**
|
|
12880
|
+
* A visual before the label, in the option and in its tag (an Avatar, an icon). Decorative in
|
|
12881
|
+
* both: the label names them. An Avatar takes the tag's size (24, 20 or 16px).
|
|
12882
|
+
*/
|
|
12883
|
+
media?: React_2.ReactNode;
|
|
12884
|
+
/** A second line under the label in the option (a role, an e-mail address); tags do not show it. */
|
|
12885
|
+
secondaryContent?: React_2.ReactNode;
|
|
12886
|
+
}
|
|
12887
|
+
|
|
12888
|
+
/**
|
|
12889
|
+
* An option of TagPicker's list (`TagPicker.Option`): an `Option` with a decorative visual before
|
|
12890
|
+
* its text (`media`, an Avatar or an icon, `aria-hidden`) and a second, smaller line under it
|
|
12891
|
+
* (`secondaryContent`, part of the option's accessible name). Its label, the text of its tag, the
|
|
12892
|
+
* filter and the announcements, is `label`, else `textValue`, else the text of its children, so
|
|
12893
|
+
* the visual and the second line never enter it; pass `label` when the children are not plain
|
|
12894
|
+
* text (a development warning otherwise, and the value is used). It works in any listbox:
|
|
12895
|
+
* TagPicker's list, a Combobox, a Listbox or a custom picker. Without `media` and
|
|
12896
|
+
* `secondaryContent` it renders `Option`'s DOM. The interface of the same name, `TagPickerOption`,
|
|
12897
|
+
* is an entry of TagPicker's `options` array.
|
|
12898
|
+
*
|
|
12899
|
+
* @example
|
|
12900
|
+
* <TagPicker.Option
|
|
12901
|
+
* value="katri"
|
|
12902
|
+
* label="Katri Athokas"
|
|
12903
|
+
* media={<Avatar name="Katri Athokas" />}
|
|
12904
|
+
* secondaryContent="Designer"
|
|
12905
|
+
* >
|
|
12906
|
+
* Katri Athokas
|
|
12907
|
+
* </TagPicker.Option>
|
|
12908
|
+
*/
|
|
12909
|
+
export declare const TagPickerOption: React_2.NamedExoticComponent<TagPickerOptionProps>;
|
|
12910
|
+
|
|
12911
|
+
/**
|
|
12912
|
+
* TagPicker.Option (an Option variant): `root` on the option; `media` on the visual before its
|
|
12913
|
+
* text; `secondaryContent` on its second line.
|
|
12914
|
+
*/
|
|
12915
|
+
export declare const tagPickerOptionClassNames: {
|
|
12916
|
+
readonly root: "wave-tag-picker-option";
|
|
12917
|
+
readonly media: "wave-tag-picker-option__media";
|
|
12918
|
+
readonly secondaryContent: "wave-tag-picker-option__secondary-content";
|
|
12919
|
+
};
|
|
12920
|
+
|
|
12921
|
+
/**
|
|
12922
|
+
* A group of options in TagPicker's list (`TagPicker.OptionGroup`): `OptionGroup` itself, with a
|
|
12923
|
+
* heading that names it. It hides itself while every option in it is hidden, so a group whose
|
|
12924
|
+
* options are all selected disappears.
|
|
12925
|
+
*/
|
|
12926
|
+
export declare const TagPickerOptionGroup: React_2.FC<OptionGroupProps>;
|
|
12927
|
+
|
|
12928
|
+
/** Props of TagPicker.Option: an Option with a visual and a second line. */
|
|
12929
|
+
export declare interface TagPickerOptionProps extends OptionProps {
|
|
12930
|
+
/** A visual before the text (an Avatar, an icon). Decorative (`aria-hidden`): the text names the option. */
|
|
12931
|
+
media?: Slot<'span'>;
|
|
12932
|
+
/** A second, smaller line under the text. Part of the option's name, not of its label. */
|
|
12933
|
+
secondaryContent?: Slot<'span'>;
|
|
12934
|
+
/**
|
|
12935
|
+
* The text of the option's tag, the filter and the announcements. Pass it when the children
|
|
12936
|
+
* are not plain text (a development warning otherwise).
|
|
12937
|
+
* @default `textValue`, else the text of the children, else `value`
|
|
12938
|
+
*/
|
|
12939
|
+
label?: string;
|
|
10823
12940
|
}
|
|
10824
12941
|
|
|
10825
12942
|
/** Properties for the TagPicker component. */
|
|
10826
12943
|
export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | RoutedHandlers> {
|
|
10827
|
-
/**
|
|
10828
|
-
|
|
10829
|
-
|
|
12944
|
+
/**
|
|
12945
|
+
* The options, the array form (`{ value, label, media?, secondaryContent? }`). With parts whose
|
|
12946
|
+
* `TagPicker.List` has children it only names values (tags, announcements). Changed in 0.11:
|
|
12947
|
+
* optional.
|
|
12948
|
+
*/
|
|
12949
|
+
options?: readonly TagPickerOption[];
|
|
12950
|
+
/**
|
|
12951
|
+
* The parts: `TagPicker.Control` and `TagPicker.List`, directly inside TagPicker (a Fragment is
|
|
12952
|
+
* fine). Without children TagPicker renders both with their defaults; without a
|
|
12953
|
+
* `TagPicker.List` it renders the default list after the children.
|
|
12954
|
+
*/
|
|
12955
|
+
children?: React_2.ReactNode;
|
|
12956
|
+
/**
|
|
12957
|
+
* Controlled array of selected option values (`[]` for none). Fluent's `selectedOptions`.
|
|
12958
|
+
*/
|
|
10830
12959
|
value?: readonly string[];
|
|
10831
12960
|
/**
|
|
10832
12961
|
* Initial selected values for uncontrolled usage; a form reset restores them.
|
|
@@ -10834,8 +12963,8 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
10834
12963
|
*/
|
|
10835
12964
|
defaultValue?: readonly string[];
|
|
10836
12965
|
/**
|
|
10837
|
-
* Called with the new selection when it changes: a tag is added
|
|
10838
|
-
* restores different tags.
|
|
12966
|
+
* Called with the new selection when it changes: a tag is added (an option, or a created tag)
|
|
12967
|
+
* or removed, or a form reset restores different tags. Fluent's `onOptionSelect`.
|
|
10839
12968
|
*/
|
|
10840
12969
|
onValueChange?: (value: string[]) => void;
|
|
10841
12970
|
/**
|
|
@@ -10859,57 +12988,69 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
10859
12988
|
/** Called when the option list opens or closes. */
|
|
10860
12989
|
onOpenChange?: (open: boolean) => void;
|
|
10861
12990
|
/**
|
|
10862
|
-
*
|
|
12991
|
+
* Shown by TagPicker.Input or TagPicker.Button while no tag is selected; the part's own
|
|
12992
|
+
* `placeholder` wins.
|
|
10863
12993
|
* @default 'Select...'
|
|
10864
12994
|
*/
|
|
10865
12995
|
placeholder?: string;
|
|
10866
12996
|
/**
|
|
10867
|
-
* Whether an option matches the typed text (the query). Called with every listed option
|
|
10868
|
-
* `
|
|
10869
|
-
*
|
|
10870
|
-
*
|
|
10871
|
-
*
|
|
10872
|
-
*
|
|
10873
|
-
* options in `options` (they are never listed): a
|
|
10874
|
-
* value as the tag label, with a development
|
|
10875
|
-
*
|
|
12997
|
+
* Whether an option matches the typed text (the query). Called with every listed option, also
|
|
12998
|
+
* the options of `TagPicker.List`'s children (its `value`, `label` and `textValue`), and the
|
|
12999
|
+
* text whenever the text is not empty, never with a selected option or the create option; an
|
|
13000
|
+
* option it returns `false` for is filtered out. It may keep options that do not contain the
|
|
13001
|
+
* text: `filter={() => true}` with `query` and `onQueryChange` leaves the matching to you (a
|
|
13002
|
+
* server-side search that replaces `options`); for a create entry, use `allowCreate`. With a
|
|
13003
|
+
* server-side search, keep the selected options in `options` (they are never listed): a
|
|
13004
|
+
* selected value without an option shows its raw value as the tag label, with a development
|
|
13005
|
+
* warning (the "Async search" story does this).
|
|
13006
|
+
* @default a case-insensitive substring match on the option's `textValue ?? label`
|
|
10876
13007
|
*/
|
|
10877
13008
|
filter?: (option: ListboxItem, query: string) => boolean;
|
|
10878
13009
|
/**
|
|
10879
13010
|
* Controlled query: the text typed since the last tag was added, which filters the options and
|
|
10880
|
-
* shows in the input (hidden while `disabled` or `readOnly`).
|
|
13011
|
+
* shows in the input (hidden while `disabled` or `readOnly`). Not used with TagPicker.Button.
|
|
10881
13012
|
*/
|
|
10882
13013
|
query?: string;
|
|
10883
13014
|
/**
|
|
10884
13015
|
* Initial query for uncontrolled usage. A TagPicker that starts disabled or read-only starts
|
|
10885
|
-
* without it (as it starts closed).
|
|
13016
|
+
* without it (as it starts closed). Not used with TagPicker.Button.
|
|
10886
13017
|
* @default ''
|
|
10887
13018
|
*/
|
|
10888
13019
|
defaultQuery?: string;
|
|
10889
13020
|
/**
|
|
10890
13021
|
* Called with the new query when it changes: as the user types, and with `''` when it resets (a
|
|
10891
|
-
* tag added, Escape on the closed list, a form reset, or `disabled`
|
|
10892
|
-
* while text is typed). A blur or a close keeps the text. A TagPicker
|
|
10893
|
-
* read-only reports nothing: it keeps a controlled query, which shows
|
|
13022
|
+
* tag added or created, Escape on the closed list, the clear button, a form reset, or `disabled`
|
|
13023
|
+
* or `readOnly` turned on while text is typed). A blur or a close keeps the text. A TagPicker
|
|
13024
|
+
* that mounts disabled or read-only reports nothing: it keeps a controlled query, which shows
|
|
13025
|
+
* once it unlocks. Not used with TagPicker.Button.
|
|
10894
13026
|
*/
|
|
10895
13027
|
onQueryChange?: (query: string) => void;
|
|
10896
13028
|
/**
|
|
10897
|
-
* Whether the tag picker is disabled: nothing can be added or removed,
|
|
10898
|
-
*
|
|
13029
|
+
* Whether the tag picker is disabled: nothing can be added or removed, the remove buttons leave
|
|
13030
|
+
* the tab order, and the expand and clear buttons are disabled. The field dims once.
|
|
10899
13031
|
* @default false
|
|
10900
13032
|
*/
|
|
10901
13033
|
disabled?: boolean;
|
|
10902
13034
|
/**
|
|
10903
13035
|
* Size of the tags and the field: `medium` (the 0.7 look), `large` or `extra-large` (Fluent's
|
|
10904
13036
|
* union; TagPicker has no `small`). Default: the surrounding Field's `size`, else `WaveProvider
|
|
10905
|
-
* inputDefaults.size`, else `'medium'`; a Field or provider `small` gives `'medium'` too.
|
|
13037
|
+
* inputDefaults.size`, else `'medium'`; a Field or provider `small` gives `'medium'` too. Its
|
|
13038
|
+
* tags are one Tag size smaller: medium → extra-small, large → small, extra-large → medium. The
|
|
10906
13039
|
* option list keeps its size.
|
|
10907
13040
|
*/
|
|
10908
13041
|
size?: TagPickerSize;
|
|
13042
|
+
/**
|
|
13043
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
13044
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
13045
|
+
* room). The popup opens below the field.
|
|
13046
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
13047
|
+
*/
|
|
13048
|
+
positioning?: PopupPositioningOptions;
|
|
10909
13049
|
/**
|
|
10910
13050
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
10911
13051
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
10912
|
-
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
13052
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`. The tags are
|
|
13053
|
+
* filled, outlined on `filled-darker`.
|
|
10913
13054
|
*/
|
|
10914
13055
|
appearance?: InputAppearance;
|
|
10915
13056
|
/** Name of the values in form submissions (one hidden input per value). */
|
|
@@ -10922,38 +13063,88 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
10922
13063
|
*/
|
|
10923
13064
|
required?: boolean;
|
|
10924
13065
|
/**
|
|
10925
|
-
* The `autocomplete` attribute of
|
|
10926
|
-
* you set it (for example `'on'`).
|
|
13066
|
+
* The `autocomplete` attribute of TagPicker.Input's `<input role="combobox">`. Browser autofill
|
|
13067
|
+
* is off unless you set it (for example `'on'`). With TagPicker.Button, not used.
|
|
10927
13068
|
* @default 'off'
|
|
10928
13069
|
*/
|
|
10929
13070
|
autoComplete?: string;
|
|
10930
|
-
/**
|
|
13071
|
+
/**
|
|
13072
|
+
* The maximum length of the typed text (`maxlength` of TagPicker.Input's `<input>`). With
|
|
13073
|
+
* TagPicker.Button, not used.
|
|
13074
|
+
*/
|
|
10931
13075
|
maxLength?: number;
|
|
10932
13076
|
/**
|
|
10933
|
-
* The selection cannot be changed: the
|
|
10934
|
-
* the
|
|
10935
|
-
*
|
|
10936
|
-
* (`onOpenChange(false)`); a focused remove
|
|
13077
|
+
* The selection cannot be changed: the trigger is read-only, the tags have no remove buttons,
|
|
13078
|
+
* the expand button is disabled and the clear button hidden, and the option list neither opens
|
|
13079
|
+
* (click, keyboard, a controlled `open`) nor adds tags; Escape is left to the page. Turning it
|
|
13080
|
+
* (or `disabled`) on while the list is open closes it (`onOpenChange(false)`); a focused remove
|
|
13081
|
+
* button hands focus to the trigger.
|
|
10937
13082
|
*/
|
|
10938
13083
|
readOnly?: boolean;
|
|
10939
13084
|
/**
|
|
10940
|
-
*
|
|
10941
|
-
*
|
|
10942
|
-
*
|
|
13085
|
+
* Lets the user add a tag of their own text: while the trimmed text matches no option label
|
|
13086
|
+
* and no selected value (ignoring case) and no option value, the list ends with a create option
|
|
13087
|
+
* (`labels.create`); Enter on it or a click adds the text as a tag, calls `onOptionCreate`, and
|
|
13088
|
+
* clears the text. Needs `TagPicker.Input` (not `TagPicker.Button`). WaveUI-only: Fluent's
|
|
13089
|
+
* TagPicker has no free tagging.
|
|
13090
|
+
* @default false
|
|
13091
|
+
*/
|
|
13092
|
+
allowCreate?: boolean;
|
|
13093
|
+
/**
|
|
13094
|
+
* Called with the trimmed text when the user creates a tag, before `onValueChange` reports the
|
|
13095
|
+
* new value. Add an option for it if you keep options: until then the tag shows the raw text.
|
|
13096
|
+
* WaveUI-only (see `allowCreate`).
|
|
13097
|
+
*/
|
|
13098
|
+
onOptionCreate?: (text: string) => void;
|
|
13099
|
+
/**
|
|
13100
|
+
* Shows a clear button at the end of the field while a tag is selected (not while `readOnly`;
|
|
13101
|
+
* disabled while `disabled`): it removes every tag (`onValueChange([])`), clears the typed
|
|
13102
|
+
* text, closes the list and focuses the trigger (the input, or `TagPicker.Button`). A Tab stop
|
|
13103
|
+
* after the trigger. The name of Fluent's Combobox and Dropdown prop.
|
|
13104
|
+
* @default false
|
|
13105
|
+
*/
|
|
13106
|
+
clearable?: boolean;
|
|
13107
|
+
/**
|
|
13108
|
+
* The glyph of the expand button at the end of the field (default: a chevron). The button
|
|
13109
|
+
* opens and closes the list, keeps focus on the trigger and is not a Tab stop. `null` or
|
|
13110
|
+
* `undefined` keep the chevron; `false`, or a value that renders nothing, hides the button.
|
|
13111
|
+
* Decorative: a `<button>` passed here is unwrapped. `TagPicker.Control`'s `expandIcon` wins.
|
|
13112
|
+
*/
|
|
13113
|
+
expandIcon?: Slot<'span'>;
|
|
13114
|
+
/**
|
|
13115
|
+
* `'wrap'`: the tags wrap onto more lines. `'count'`: while focus is outside the picker and its
|
|
13116
|
+
* list is closed, the tags stay on one line and the ones that do not fit give way to "+N"
|
|
13117
|
+
* (`labels.overflowCount`); focusing the picker shows them all. The tags are measured by
|
|
13118
|
+
* position: your own Tags in `TagPicker.Group` render in `value` order. WaveUI-only: Fluent's
|
|
13119
|
+
* single-line layout is a story, not a prop.
|
|
13120
|
+
* @default 'wrap'
|
|
13121
|
+
*/
|
|
13122
|
+
overflow?: 'wrap' | 'count';
|
|
13123
|
+
/**
|
|
13124
|
+
* Names of the remove buttons and the tag list, the summary that describes the trigger, the
|
|
13125
|
+
* announcements, the "No matches" text, the create option, the clear and expand buttons and the
|
|
13126
|
+
* "+N" count, for localization. Unset members keep their English defaults.
|
|
10943
13127
|
*/
|
|
10944
13128
|
labels?: TagPickerLabels;
|
|
10945
|
-
/**
|
|
13129
|
+
/**
|
|
13130
|
+
* Called when TagPicker.Input's `<input role="combobox">` receives focus (the root keeps other
|
|
13131
|
+
* handlers). With TagPicker.Button, pass it (and `ref`) on the Button.
|
|
13132
|
+
*/
|
|
10946
13133
|
onFocus?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
10947
|
-
/** Called when
|
|
13134
|
+
/** Called when TagPicker.Input's `<input>` loses focus. With TagPicker.Button, pass it on the Button. */
|
|
10948
13135
|
onBlur?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
10949
13136
|
/**
|
|
10950
|
-
* Called on a key press in
|
|
10951
|
-
* keys; `event.preventDefault()` skips them.
|
|
13137
|
+
* Called on a key press in TagPicker.Input's `<input>`, after the Input's own `onKeyDown` and
|
|
13138
|
+
* before the built-in listbox and tag keys; `event.preventDefault()` skips them. With
|
|
13139
|
+
* TagPicker.Button, pass it on the Button.
|
|
10952
13140
|
*/
|
|
10953
13141
|
onKeyDown?: React_2.KeyboardEventHandler<HTMLInputElement>;
|
|
10954
|
-
/** Called when a key is released in
|
|
13142
|
+
/** Called when a key is released in TagPicker.Input's `<input>`. With TagPicker.Button, pass it on the Button. */
|
|
10955
13143
|
onKeyUp?: React_2.KeyboardEventHandler<HTMLInputElement>;
|
|
10956
|
-
/**
|
|
13144
|
+
/**
|
|
13145
|
+
* Ref to TagPicker.Input's `<input role="combobox">` (the focusable element). With
|
|
13146
|
+
* TagPicker.Button, pass `ref` on the Button.
|
|
13147
|
+
*/
|
|
10957
13148
|
controlRef?: React_2.Ref<HTMLInputElement>;
|
|
10958
13149
|
/** Ref to the root `<div>`. */
|
|
10959
13150
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
@@ -10968,6 +13159,12 @@ export declare type TagPickerSize = Extract<Size, 'medium' | 'large' | 'extra-la
|
|
|
10968
13159
|
*/
|
|
10969
13160
|
export declare type TagProps<C extends React_2.ElementType = 'span'> = PolymorphicProps<C, TagOwnProps>;
|
|
10970
13161
|
|
|
13162
|
+
/** Corners of a tag (Fluent's `TagShape`): `circular` (a pill) or `rounded` (4px). */
|
|
13163
|
+
export declare type TagShape = Extract<Shape, 'rounded' | 'circular'>;
|
|
13164
|
+
|
|
13165
|
+
/** Size of a tag (Fluent's `TagSize`): `extra-small` (20px tall), `small` (24px) or `medium` (28px). */
|
|
13166
|
+
export declare type TagSize = Extract<Size, 'extra-small' | 'small' | 'medium'>;
|
|
13167
|
+
|
|
10971
13168
|
/**
|
|
10972
13169
|
* A step-by-step onboarding popover (a non-modal `role="dialog"`) with Back/Next (Done on the
|
|
10973
13170
|
* last step) and Close.
|
|
@@ -10984,7 +13181,9 @@ export declare type TagProps<C extends React_2.ElementType = 'span'> = Polymorph
|
|
|
10984
13181
|
* - With `target`, the popover is portaled and positioned next to that element with a beak (it
|
|
10985
13182
|
* inherits the surface colors); it stays hidden while the target is `null`, not positioned yet or
|
|
10986
13183
|
* no longer mounted (a ref target is read after each render of the popover; see `target`).
|
|
10987
|
-
* - With `target
|
|
13184
|
+
* - With a `VirtualElement` target there is no element to follow: the popover keeps the place of
|
|
13185
|
+
* its portal in the keyboard order.
|
|
13186
|
+
* - With an element or ref `target`, the keyboard order treats the popover as if it followed the target: Tab past
|
|
10988
13187
|
* its last button continues after the target, Shift+Tab from its first button (or from the
|
|
10989
13188
|
* popover itself) returns to the target (for a target outside the Tab order, to the last control
|
|
10990
13189
|
* inside it, else to the control before it), Tab from there enters the popover, and Shift+Tab
|
|
@@ -10996,7 +13195,7 @@ export declare type TagProps<C extends React_2.ElementType = 'span'> = Polymorph
|
|
|
10996
13195
|
* it.
|
|
10997
13196
|
*/
|
|
10998
13197
|
export declare const TeachingPopover: {
|
|
10999
|
-
({ 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;
|
|
13198
|
+
({ 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;
|
|
11000
13199
|
displayName: string;
|
|
11001
13200
|
};
|
|
11002
13201
|
|
|
@@ -11081,7 +13280,8 @@ export declare interface TeachingPopoverProps extends React_2.HTMLAttributes<HTM
|
|
|
11081
13280
|
*/
|
|
11082
13281
|
labels?: TeachingPopoverLabels;
|
|
11083
13282
|
/**
|
|
11084
|
-
* The element the popover points at (a ref
|
|
13283
|
+
* The element the popover points at (a ref, the element, or a `VirtualElement`: a rectangle such as a
|
|
13284
|
+
* point; an inline object is fine). When given, the popover is
|
|
11085
13285
|
* rendered in a portal, positioned next to it with a beak, and flips or shifts to stay in view;
|
|
11086
13286
|
* without it (`undefined`) the popover renders inline where it is placed (0.4 behaviour).
|
|
11087
13287
|
* While the target is `null` or has not been positioned against yet (an element held in state
|
|
@@ -11102,7 +13302,7 @@ export declare interface TeachingPopoverProps extends React_2.HTMLAttributes<HTM
|
|
|
11102
13302
|
* attached hides the popover right after that commit. Pass the element held in state when the
|
|
11103
13303
|
* target can mount or unmount without the popover re-rendering.
|
|
11104
13304
|
*/
|
|
11105
|
-
target?: React_2.RefObject<HTMLElement | null> | HTMLElement | null;
|
|
13305
|
+
target?: React_2.RefObject<HTMLElement | null> | HTMLElement | VirtualElement | null;
|
|
11106
13306
|
/** Side of the `target` to open on; `start`/`end` follow the writing direction.
|
|
11107
13307
|
* @default 'bottom'
|
|
11108
13308
|
*/
|
|
@@ -11111,6 +13311,13 @@ export declare interface TeachingPopoverProps extends React_2.HTMLAttributes<HTM
|
|
|
11111
13311
|
* @default 'center'
|
|
11112
13312
|
*/
|
|
11113
13313
|
align?: PopupAlign;
|
|
13314
|
+
/**
|
|
13315
|
+
* Advanced positioning (Fluent's `positioning`): `offset`, `fitViewport`, `matchReferenceWidth`,
|
|
13316
|
+
* `fallbackPlacements` and `target` (used when the `target` prop is not set). `side` and `align`
|
|
13317
|
+
* stay separate props.
|
|
13318
|
+
* @default `{ offset: 12 }`
|
|
13319
|
+
*/
|
|
13320
|
+
positioning?: PopupPositioning;
|
|
11114
13321
|
/** Ref to the popover surface (`role="dialog"`). */
|
|
11115
13322
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
11116
13323
|
}
|
|
@@ -11400,6 +13607,13 @@ export declare interface TimePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
11400
13607
|
* list keeps its size.
|
|
11401
13608
|
*/
|
|
11402
13609
|
size?: CoreSize;
|
|
13610
|
+
/**
|
|
13611
|
+
* Advanced positioning of the popup (Fluent's `positioning`): `offset`, `fitViewport`,
|
|
13612
|
+
* `matchReferenceWidth` and `fallbackPlacements` (tried in order when the requested side has no
|
|
13613
|
+
* room). The popup opens below the field.
|
|
13614
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
13615
|
+
*/
|
|
13616
|
+
positioning?: PopupPositioningOptions;
|
|
11403
13617
|
/**
|
|
11404
13618
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
11405
13619
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
@@ -11671,9 +13885,10 @@ export declare interface ToastDispatchOptions {
|
|
|
11671
13885
|
* those, the dispatch's `announcement`.
|
|
11672
13886
|
* The toasts themselves are not live regions. Each message stays in its live region for 2
|
|
11673
13887
|
* seconds (or until its toast goes), so browsing the region later meets the text only once.
|
|
11674
|
-
* - While an open
|
|
11675
|
-
* move beside it,
|
|
11676
|
-
*
|
|
13888
|
+
* - While an open panel covers the toasts' corner (a modal or non-modal Drawer on the same side,
|
|
13889
|
+
* or at the bottom), the toasts move beside it, or above a bottom one (below it for top toasts),
|
|
13890
|
+
* so they never hide its focused controls (WCAG 2.4.11). Without room there (a full-width panel
|
|
13891
|
+
* on a narrow screen) they keep their corner.
|
|
11677
13892
|
* - Timers pause while the pointer or focus is anywhere in the toast region, a menu or popover
|
|
11678
13893
|
* opened from a toast included (someone reading or operating one toast is reading the stack),
|
|
11679
13894
|
* and while the window is in the background (it has lost focus, or the page is not shown, as in
|
|
@@ -12328,7 +14543,7 @@ export declare interface ToolbarToggleButtonProps extends Omit<ToggleButtonProps
|
|
|
12328
14543
|
* </Menu>
|
|
12329
14544
|
*/
|
|
12330
14545
|
export declare const Tooltip: {
|
|
12331
|
-
({ 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;
|
|
14546
|
+
({ 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;
|
|
12332
14547
|
displayName: string;
|
|
12333
14548
|
};
|
|
12334
14549
|
|
|
@@ -12404,6 +14619,13 @@ export declare interface TooltipProps extends Omit<React_2.HTMLAttributes<HTMLSp
|
|
|
12404
14619
|
* @default 'center'
|
|
12405
14620
|
*/
|
|
12406
14621
|
align?: PopupAlign;
|
|
14622
|
+
/**
|
|
14623
|
+
* Advanced positioning (Fluent's `positioning`): `offset`, `fitViewport`, `matchReferenceWidth`
|
|
14624
|
+
* and `fallbackPlacements`. `side` and `align` stay separate props. The hover bridge across the
|
|
14625
|
+
* gap covers the default 8px, so a larger `offset` leaves a gap the pointer cannot cross.
|
|
14626
|
+
* @default `{ offset: 8 }`
|
|
14627
|
+
*/
|
|
14628
|
+
positioning?: PopupPositioningOptions;
|
|
12407
14629
|
/**
|
|
12408
14630
|
* A single element that triggers the tooltip on hover and focus: it receives the
|
|
12409
14631
|
* `aria-describedby`/`aria-labelledby`, plus any `id` and `aria-*` props given to the Tooltip
|
|
@@ -12826,6 +15048,82 @@ export declare function useAnnounce(): (message: string, politeness?: Politeness
|
|
|
12826
15048
|
*/
|
|
12827
15049
|
export declare function useControllable<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void): [value: T, setValue: SetValue<T>, isControlled: boolean];
|
|
12828
15050
|
|
|
15051
|
+
/**
|
|
15052
|
+
* Registers an open overlay surface as a **dismiss layer** in the shared layer stack and closes it
|
|
15053
|
+
* on Escape, outside presses and (optionally) focus leaving it — with correct nesting:
|
|
15054
|
+
*
|
|
15055
|
+
* - **Escape** (document `keydown`, bubble phase) is routed by focus location: the innermost layer
|
|
15056
|
+
* whose tree contains the event target or the focused element is the scope, and the topmost
|
|
15057
|
+
* escape-enabled layer of that scope's subtree handles it — so a tooltip or popover opened from
|
|
15058
|
+
* the focused dialog closes before the dialog, while an unrelated layer opened later does not
|
|
15059
|
+
* steal the key. With no escape-enabled layer there, an escape-enabled ancestor handles it; when
|
|
15060
|
+
* no layer contains the focus (or none of those takes Escape), the global topmost
|
|
15061
|
+
* escape-enabled one. Layers stacked below the topmost **isolating** modal (a Dialog/Drawer
|
|
15062
|
+
* whose `useModalIsolation` is active — its ancestors and older siblings) never take Escape, so
|
|
15063
|
+
* a modal that ignores Escape blocks it whether it is nested in a dialog or opened beside it.
|
|
15064
|
+
* A layer with `escape: 'inside'` (a non-modal Dialog or Drawer) takes Escape only while the
|
|
15065
|
+
* event target or the focused element is in its tree, so an Escape typed on the page leaves it
|
|
15066
|
+
* open and goes to the layers below it.
|
|
15067
|
+
* The handler calls `preventDefault()`. Events whose default is already prevented (an inner
|
|
15068
|
+
* widget consumed Escape) and IME composition events are ignored.
|
|
15069
|
+
* - **Outside press**: on `pointerdown` (capture) every open layer whose tree does not contain the
|
|
15070
|
+
* target is recorded; on the following `click` each recorded layer whose tree still does not
|
|
15071
|
+
* contain the click target is dismissed (children first). A drag from inside to outside never
|
|
15072
|
+
* dismisses, clicks inside nested portaled layers count as inside, a popup opened by the same
|
|
15073
|
+
* click survives, and an external toggle works. Layers stacked below the topmost isolating modal
|
|
15074
|
+
* are inert and never dismissed by presses on that modal or its backdrop; a `kind: 'modal'`
|
|
15075
|
+
* layer without isolation (the DatePicker calendar) shields nothing, so a page click closes it
|
|
15076
|
+
* and the layers around it. The pending press survives modifier keys (Shift/Ctrl+click) and
|
|
15077
|
+
* ends on Enter/Space, on `pointercancel`, or when no click follows a mouse `pointerup` in the
|
|
15078
|
+
* same task; touch and pen presses are kept until their click, which the browser dispatches
|
|
15079
|
+
* from a separate tap gesture.
|
|
15080
|
+
* - **Focus outside** (`focusOutside: true`): dismisses when focus moves outside the layer's tree.
|
|
15081
|
+
* That is decided in a microtask, once the current commit has run: an `autoFocus` field of a
|
|
15082
|
+
* popover, dialog or plain portal opened inside the layer gets focus before that surface's
|
|
15083
|
+
* portal and layer register, and keeps the layer open. Focus that is back inside the tree by
|
|
15084
|
+
* then keeps it open too.
|
|
15085
|
+
*
|
|
15086
|
+
* A layer's tree is its `refs`, the portal wrappers rendered inside it, its descendant layers and
|
|
15087
|
+
* the `[data-wave-focus-trap-allow]` regions (toasts). Parentage follows the React tree: wrap the surface in
|
|
15088
|
+
* `Portal layerId={layerId}` (or {@link DismissLayerProvider}) so layers opened inside it become
|
|
15089
|
+
* its children.
|
|
15090
|
+
*
|
|
15091
|
+
* @example
|
|
15092
|
+
* const { layerId } = useDismiss({ open, onDismiss: () => setOpen(false), refs: [surfaceRef, triggerRef], anchorRef: triggerRef });
|
|
15093
|
+
* return open && <Portal layerId={layerId}><div ref={surfaceRef}>…</div></Portal>;
|
|
15094
|
+
*/
|
|
15095
|
+
export declare function useDismiss(options: UseDismissOptions): DismissLayer;
|
|
15096
|
+
|
|
15097
|
+
/** Options of {@link useDismiss}. */
|
|
15098
|
+
export declare interface UseDismissOptions {
|
|
15099
|
+
/** Whether the layer is open; the layer is registered only while `true`. */
|
|
15100
|
+
open: boolean;
|
|
15101
|
+
/** Called when the layer should close (the component sets its `open` state to `false`). */
|
|
15102
|
+
onDismiss: (reason: DismissReason, event: Event) => void;
|
|
15103
|
+
/**
|
|
15104
|
+
* Elements that belong to the layer: the content surface, the trigger/anchor and any extra
|
|
15105
|
+
* targets that must not count as "outside" (read at event time).
|
|
15106
|
+
*/
|
|
15107
|
+
refs: ReadonlyArray<React_2.RefObject<HTMLElement | null>>;
|
|
15108
|
+
/** The trigger; focus traps leave a descendant layer through it (Tab → the element after it). */
|
|
15109
|
+
anchorRef?: React_2.RefObject<HTMLElement | null>;
|
|
15110
|
+
/** @default 'popover' */
|
|
15111
|
+
kind?: LayerKind;
|
|
15112
|
+
/**
|
|
15113
|
+
* Whether Escape dismisses the layer: always (`true`), never (`false`), or only while the key's
|
|
15114
|
+
* target or the focused element is in the layer's tree (`'inside'`).
|
|
15115
|
+
* @default true
|
|
15116
|
+
*/
|
|
15117
|
+
escape?: boolean | 'inside';
|
|
15118
|
+
/**
|
|
15119
|
+
* Whether a press outside the layer's tree dismisses it. A predicate receives the `pointerdown`
|
|
15120
|
+
* event; returning `false` ignores that press. @default true
|
|
15121
|
+
*/
|
|
15122
|
+
outsidePress?: boolean | ((event: PointerEvent | MouseEvent) => boolean);
|
|
15123
|
+
/** Whether focus moving outside the layer's tree dismisses it (listboxes). @default false */
|
|
15124
|
+
focusOutside?: boolean;
|
|
15125
|
+
}
|
|
15126
|
+
|
|
12829
15127
|
/**
|
|
12830
15128
|
* Returns a callback with a stable identity that always invokes the latest `fn` passed to the hook.
|
|
12831
15129
|
* Use it for handlers read by effects or passed to memoised children, so neither re-runs when the
|
|
@@ -12900,6 +15198,172 @@ export declare interface UseFieldControlOptions {
|
|
|
12900
15198
|
nativeRequired?: boolean;
|
|
12901
15199
|
}
|
|
12902
15200
|
|
|
15201
|
+
/**
|
|
15202
|
+
* A focusable group (Fluent's `useFocusableGroup`, tabster's groupper): one tab stop that holds
|
|
15203
|
+
* several focusable elements, so a long list of rich rows does not cost a Tab press per control.
|
|
15204
|
+
* With `tabBehavior: 'limited'` or `'limited-trap-focus'`, Tab skips the elements inside while focus
|
|
15205
|
+
* is on the group element itself, and Shift+Tab from outside lands on the group element instead of
|
|
15206
|
+
* its last element; Enter or F2 enters the group, and Escape leaves it. A group is entered while
|
|
15207
|
+
* focus is on an element inside it, however it got there (a click, a popup returning focus, a
|
|
15208
|
+
* script). No tabindex is rewritten: components with their own tab stops (Toolbar, TabList) work
|
|
15209
|
+
* inside a group. A key from a popup portaled out of the group, a key that belongs to a nested
|
|
15210
|
+
* group and a key an inner element already handled (`preventDefault()`, as an input consuming
|
|
15211
|
+
* Escape does) are left alone.
|
|
15212
|
+
*
|
|
15213
|
+
* @example
|
|
15214
|
+
* const { groupProps } = useFocusableGroup({ tabBehavior: 'limited' });
|
|
15215
|
+
* <li role="group" aria-label="Message" {...groupProps}>
|
|
15216
|
+
* <button>Reply</button> <button>Forward</button>
|
|
15217
|
+
* </li>
|
|
15218
|
+
*/
|
|
15219
|
+
export declare function useFocusableGroup(options?: UseFocusableGroupOptions): UseFocusableGroupResult;
|
|
15220
|
+
|
|
15221
|
+
/** Options of {@link useFocusableGroup}. */
|
|
15222
|
+
export declare interface UseFocusableGroupOptions {
|
|
15223
|
+
/**
|
|
15224
|
+
* How the group treats the elements inside it (Fluent's `tabBehavior`):
|
|
15225
|
+
*
|
|
15226
|
+
* - `'unlimited'`: the group is one more tab stop and the elements inside it stay reachable by
|
|
15227
|
+
* Tab; no key is intercepted.
|
|
15228
|
+
* - `'limited'`: the group is one tab stop, in both directions. Enter or F2 on it moves focus to
|
|
15229
|
+
* its first tabbable element, Tab and Shift+Tab then move between the elements inside, Tab
|
|
15230
|
+
* past the last one leaves the group, and Escape returns focus to the group.
|
|
15231
|
+
* - `'limited-trap-focus'`: as `'limited'`, but Tab past the last element wraps to the first and
|
|
15232
|
+
* Shift+Tab before the first wraps to the last, until Escape.
|
|
15233
|
+
*
|
|
15234
|
+
* @default 'unlimited'
|
|
15235
|
+
*/
|
|
15236
|
+
tabBehavior?: FocusableGroupTabBehavior;
|
|
15237
|
+
}
|
|
15238
|
+
|
|
15239
|
+
/** Result of {@link useFocusableGroup}. */
|
|
15240
|
+
export declare interface UseFocusableGroupResult {
|
|
15241
|
+
/** Spread onto the group element. */
|
|
15242
|
+
groupProps: FocusableGroupProps;
|
|
15243
|
+
}
|
|
15244
|
+
|
|
15245
|
+
/**
|
|
15246
|
+
* Keeps keyboard focus inside `container` while `enabled` (modal dialogs, drawers, the DatePicker
|
|
15247
|
+
* calendar). Element-based: pass the surface held in state via a callback ref, so the trap starts
|
|
15248
|
+
* when the element appears.
|
|
15249
|
+
*
|
|
15250
|
+
* - **Initial focus** runs synchronously in the commit in which the container appears (no
|
|
15251
|
+
* `requestAnimationFrame`), and does nothing when focus is already inside (an `autoFocus`
|
|
15252
|
+
* element wins).
|
|
15253
|
+
* - **Tab / Shift+Tab** are handled by a document bubble-phase `keydown` listener that ignores
|
|
15254
|
+
* events whose default is already prevented, so a React handler inside (a menu closing on Tab, a
|
|
15255
|
+
* grid) can take the key first. Focus wraps at the edges, and from the container itself or a
|
|
15256
|
+
* non-tabbable element it continues in document order. Tabbable elements are computed on every
|
|
15257
|
+
* keydown (content may change; radio-group stops depend on focus), never cached.
|
|
15258
|
+
* - Tabbables inside `[data-wave-focus-trap-allow]` regions (the Toaster viewport) join the cycle.
|
|
15259
|
+
* - **Descendant layers** (a popover or menu opened from inside, identified through `layerId`):
|
|
15260
|
+
* Tab moves natively inside them; leaving one moves focus to the element after its anchor
|
|
15261
|
+
* (Shift+Tab: the anchor itself). Inside a plain `<Portal>` rendered in the surface (no layer,
|
|
15262
|
+
* no anchor) Tab is native too; leaving it wraps to the first (Shift+Tab: last) element. A
|
|
15263
|
+
* layer's trigger (its anchor, or an element around it such as a tooltip's wrapper) belongs to
|
|
15264
|
+
* the region it sits in, so Tab from an open info button or a button showing its tooltip moves
|
|
15265
|
+
* on as from any other element of that portal or popover.
|
|
15266
|
+
* - Focus that lands outside (not in the container, an allowed region or a descendant layer)
|
|
15267
|
+
* returns to the last focused element inside, also when that outside element loses it again
|
|
15268
|
+
* (removed or blurred, leaving focus on `<body>`). That is decided in a microtask, once the
|
|
15269
|
+
* current commit has run: an `autoFocus` element of a surface opened above the trap (a nested or
|
|
15270
|
+
* stacked dialog, a popover opened from the surface) gets focus before that surface's layer and
|
|
15271
|
+
* trap exist, and keeps it. The layer's own `refs` (its trigger, outside the container) are
|
|
15272
|
+
* outside: opening from the focused trigger still moves focus in, and focus moving back onto
|
|
15273
|
+
* the trigger is returned. Focus pulled out again while it is being returned (another focus
|
|
15274
|
+
* trap on the page) is left there.
|
|
15275
|
+
* - Traps form a stack (shared through the global registry): only the topmost acts.
|
|
15276
|
+
*/
|
|
15277
|
+
export declare function useFocusTrap(container: HTMLElement | null, options: UseFocusTrapOptions): void;
|
|
15278
|
+
|
|
15279
|
+
/** Options of {@link useFocusTrap}. */
|
|
15280
|
+
export declare interface UseFocusTrapOptions {
|
|
15281
|
+
/** Whether the trap is active. */
|
|
15282
|
+
enabled: boolean;
|
|
15283
|
+
/**
|
|
15284
|
+
* The surface's dismiss layer; focus inside its descendant layers (portaled popovers opened from
|
|
15285
|
+
* inside) is allowed. The layer's own `refs` outside the container (its trigger) are not.
|
|
15286
|
+
*/
|
|
15287
|
+
layerId?: string;
|
|
15288
|
+
/**
|
|
15289
|
+
* What to focus when the trap starts, unless focus is already inside (an `autoFocus` element
|
|
15290
|
+
* wins). @default 'first' (the first tabbable element, else the container)
|
|
15291
|
+
*/
|
|
15292
|
+
initialFocus?: React_2.RefObject<HTMLElement | null> | 'first' | 'container' | (() => HTMLElement | null);
|
|
15293
|
+
/** Regions outside the container whose tabbables join the Tab cycle. @default '[data-wave-focus-trap-allow]' (the regions marked with `modalAllowProps`) */
|
|
15294
|
+
allowOutsideSelector?: string;
|
|
15295
|
+
}
|
|
15296
|
+
|
|
15297
|
+
/**
|
|
15298
|
+
* Whether the page is in keyboard-navigation mode: `true` after the last input was a key press
|
|
15299
|
+
* (any key but a lone modifier), `false` after a pointer or touch press and before any input. For
|
|
15300
|
+
* logic that needs the mode in script, such as showing a focus cue in a widget that draws its own;
|
|
15301
|
+
* plain focus rings should keep using the `focus-visible` variant. One set of document listeners
|
|
15302
|
+
* serves every caller and goes away with the last one. `false` on the server and during
|
|
15303
|
+
* hydration.
|
|
15304
|
+
*
|
|
15305
|
+
* @example
|
|
15306
|
+
* const keyboard = useFocusVisible();
|
|
15307
|
+
* return <div data-keyboard={keyboard ? '' : undefined}>…</div>;
|
|
15308
|
+
*/
|
|
15309
|
+
export declare function useFocusVisible(): boolean;
|
|
15310
|
+
|
|
15311
|
+
/**
|
|
15312
|
+
* Grid keyboard model of the APG Grid pattern for a `<table role="grid">` (DataGrid).
|
|
15313
|
+
*
|
|
15314
|
+
* - **One tab stop.** Exactly one cell of the grid is in the tab order (initially the first cell).
|
|
15315
|
+
* Its focus target is its only focusable widget when that widget is not a text-entry control
|
|
15316
|
+
* (a checkbox, a sort button, a link); otherwise — no widget, several widgets, a text-entry
|
|
15317
|
+
* control or a nested composite — the cell itself. An unchecked radio whose named group has a
|
|
15318
|
+
* checked radio is not a target either (browsers skip it in the Tab order), so its cell is.
|
|
15319
|
+
* Every other cell and every widget inside a cell gets `tabindex="-1"`. Rows are never focusable.
|
|
15320
|
+
* When a widget becomes the target of the focused cell (Space on the cell checks its radio), the
|
|
15321
|
+
* cell keeps focus and the tab stop (removing its `tabindex` would blur it) while its target stays
|
|
15322
|
+
* at `tabindex="-1"`; the target takes the tab stop once the cell is blurred.
|
|
15323
|
+
* - **Navigation mode** (focus on a cell or on its target widget): ArrowLeft/ArrowRight (the
|
|
15324
|
+
* previous/next cell of the row, mirrored in RTL), ArrowUp/ArrowDown, Home/End (first/last cell
|
|
15325
|
+
* of the row), Ctrl+Home/Ctrl+End (first cell of the grid / last cell of the last row) and
|
|
15326
|
+
* PageUp/PageDown ({@link UseGridNavigationOptions.pageSize} rows) move focus between cells.
|
|
15327
|
+
* ArrowUp/ArrowDown and PageUp/PageDown keep the visual column (`colSpan` and `rowSpan` counted,
|
|
15328
|
+
* so a grouped header works), clamped to a shorter row. Space and Enter on a target widget reach
|
|
15329
|
+
* the widget.
|
|
15330
|
+
* - **Interaction mode**: Enter or F2 on a cell that is its own target moves focus into its first
|
|
15331
|
+
* widget; clicking a widget that is not the cell's target (a text input) enters it too. The
|
|
15332
|
+
* grid keys are then ignored, so the arrow keys move the caret, and Tab moves between the cell's
|
|
15333
|
+
* widgets. Escape returns focus to the cell. Leaving the grid ends interaction mode.
|
|
15334
|
+
* - **Nested composites** (an element with `data-roving-container` or role toolbar, radiogroup,
|
|
15335
|
+
* listbox, grid, treegrid, tablist, menu, menubar or tree) count as one widget that uses the arrow
|
|
15336
|
+
* keys: its cell takes focus, and Enter/F2 enters the composite at its own tab stop. The grid never
|
|
15337
|
+
* writes `tabindex` on or inside a composite (the composite manages its own), so a composite
|
|
15338
|
+
* keeps its own Tab stop — the same documented limitation as `useRovingTabIndex`.
|
|
15339
|
+
*
|
|
15340
|
+
* Keys are ignored when the event's default was prevented (a widget that handled the key, a
|
|
15341
|
+
* consumer handler), or with Alt/Meta held. The tab indexes are written to the DOM (layout effect
|
|
15342
|
+
* plus a `MutationObserver`), so rows and widgets added later are covered without a re-render. Focus
|
|
15343
|
+
* moves re-sync only the cells involved, the observer only the cells that changed, and the grid's
|
|
15344
|
+
* own `tabindex` writes do not trigger a re-sync.
|
|
15345
|
+
*
|
|
15346
|
+
* Internal to the table package.
|
|
15347
|
+
*/
|
|
15348
|
+
export declare function useGridNavigation(options?: UseGridNavigationOptions): UseGridNavigationResult;
|
|
15349
|
+
|
|
15350
|
+
/** Options of {@link useGridNavigation}. */
|
|
15351
|
+
export declare interface UseGridNavigationOptions {
|
|
15352
|
+
/**
|
|
15353
|
+
* How many rows PageUp and PageDown move focus.
|
|
15354
|
+
* @default 10
|
|
15355
|
+
*/
|
|
15356
|
+
pageSize?: number;
|
|
15357
|
+
}
|
|
15358
|
+
|
|
15359
|
+
/** Result of {@link useGridNavigation}. */
|
|
15360
|
+
export declare interface UseGridNavigationResult {
|
|
15361
|
+
/** Callback ref for the `<table role="grid">` element. Stable identity. */
|
|
15362
|
+
gridRef: React_2.RefCallback<HTMLTableElement>;
|
|
15363
|
+
/** Keyboard and focus handlers for the grid element. Stable identities. */
|
|
15364
|
+
gridProps: GridNavigationHandlers;
|
|
15365
|
+
}
|
|
15366
|
+
|
|
12903
15367
|
/**
|
|
12904
15368
|
* Generates a stable, SSR-safe unique id, optionally with a prefix. Wraps React's `useId` so every
|
|
12905
15369
|
* component builds DOM ids the same way (C-IDS).
|
|
@@ -12915,6 +15379,26 @@ export declare interface UseFieldControlOptions {
|
|
|
12915
15379
|
*/
|
|
12916
15380
|
export declare function useId(prefix?: string): string;
|
|
12917
15381
|
|
|
15382
|
+
/**
|
|
15383
|
+
* The trap's initial focus without the trap (a non-modal Dialog or Drawer, which moves focus in
|
|
15384
|
+
* when it opens but does not keep it there): in the layout phase of the commit in which
|
|
15385
|
+
* `enabled && container` becomes true, does nothing when focus is already inside the container or
|
|
15386
|
+
* one of the layer's descendant layers (an `autoFocus` element wins), else focuses
|
|
15387
|
+
* `initialFocus` (default: the first tabbable element), else the container. `useFocusTrap` runs
|
|
15388
|
+
* the same code when it starts. It adds no listener.
|
|
15389
|
+
*/
|
|
15390
|
+
export declare function useInitialFocus(container: HTMLElement | null, options: UseInitialFocusOptions): void;
|
|
15391
|
+
|
|
15392
|
+
/** Options of {@link useInitialFocus}. */
|
|
15393
|
+
export declare interface UseInitialFocusOptions {
|
|
15394
|
+
/** Whether the surface is open: focus moves in when it becomes `true` with a container. */
|
|
15395
|
+
enabled: boolean;
|
|
15396
|
+
/** The surface's dismiss layer: focus already in one of its descendant layers stays there. */
|
|
15397
|
+
layerId?: string;
|
|
15398
|
+
/** What to focus first. @default 'first' (the first tabbable element, else the container) */
|
|
15399
|
+
initialFocus?: UseFocusTrapOptions['initialFocus'];
|
|
15400
|
+
}
|
|
15401
|
+
|
|
12918
15402
|
/**
|
|
12919
15403
|
* `false` on the server and during hydration, `true` in every other client render — including the
|
|
12920
15404
|
* first render of a component mounted on the client, so no second commit is needed.
|
|
@@ -13250,6 +15734,11 @@ export declare interface UseListboxPopupOptions {
|
|
|
13250
15734
|
* `setReference` too (merged into its ref), which places the surface against it.
|
|
13251
15735
|
*/
|
|
13252
15736
|
anchorRef: React_2.RefObject<HTMLElement | null>;
|
|
15737
|
+
/**
|
|
15738
|
+
* Advanced positioning: `offset`, `fitViewport`, `matchReferenceWidth` and `fallbackPlacements`.
|
|
15739
|
+
* @default `{ matchReferenceWidth: true, fitViewport: true }`
|
|
15740
|
+
*/
|
|
15741
|
+
positioning?: PopupPositioningOptions;
|
|
13253
15742
|
}
|
|
13254
15743
|
|
|
13255
15744
|
/**
|
|
@@ -13367,6 +15856,84 @@ export declare interface UseListboxResult {
|
|
|
13367
15856
|
*/
|
|
13368
15857
|
export declare function useMergedRefs<T>(...refs: Array<React_2.Ref<T> | undefined | null>): React_2.RefCallback<T>;
|
|
13369
15858
|
|
|
15859
|
+
/**
|
|
15860
|
+
* Everything a modal surface (Dialog, Drawer) needs, composed in the order that works:
|
|
15861
|
+
*
|
|
15862
|
+
* 1. `useDismiss({ kind: 'modal' })` — Escape and outside presses (the backdrop is outside the
|
|
15863
|
+
* content surface, so a click on it dismisses; a drag from the content does not).
|
|
15864
|
+
* 2. `useFocusTrap` — initial focus, Tab cycle incl. toasts and descendant layers.
|
|
15865
|
+
* 3. `useModalIsolation` — the rest of the page is `inert` (instead of `aria-modal`).
|
|
15866
|
+
* 4. `useScrollLock` — ref-counted page scroll lock.
|
|
15867
|
+
* 5. `useRestoreFocus` — the opener (or `triggerRef`/`finalFocusRef`) gets focus back.
|
|
15868
|
+
*
|
|
15869
|
+
* On close the trap is released before the isolation is lifted, and the isolation is lifted
|
|
15870
|
+
* before focus is restored (an inert opener cannot take focus). Wrap the surface in
|
|
15871
|
+
* `Portal layerId={layerId}` so layers opened inside the modal become its descendants.
|
|
15872
|
+
*
|
|
15873
|
+
* `modalType: 'alert'` composes the same with `outsidePress: false`. `modalType: 'non-modal'`
|
|
15874
|
+
* registers a `dialog` layer (Escape only from inside its tree, no outside press, no focus-outside
|
|
15875
|
+
* dismissal), keeps the trap, the isolation and the scroll lock off, moves focus in on open with
|
|
15876
|
+
* the trap's initial-focus rule (`useInitialFocus`) and restores focus only when it is inside the
|
|
15877
|
+
* surface (or in a layer opened from it) at close, or was lost to `<body>` from there. Every hook
|
|
15878
|
+
* is always called and keys on `open`: a `modalType` that changes while open applies at once (the
|
|
15879
|
+
* trap, isolation and lock follow). It leaves focus inside the surface where it is; focus outside
|
|
15880
|
+
* it moves in, as on open: a switch to `modal` or `alert` starts the trap (the page turns inert),
|
|
15881
|
+
* and a switch to `non-modal` runs the initial focus (focus in the toast region, which a trap lets
|
|
15882
|
+
* in, moves into the surface). The Tab order of a non-modal surface (its place after the opener)
|
|
15883
|
+
* is the component's.
|
|
15884
|
+
*
|
|
15885
|
+
* A surface that mounts through the presence core (Dialog, Drawer) passes its open state as
|
|
15886
|
+
* `open`, never its mount (`isMounted`), and its element as `container` also while it is mounted
|
|
15887
|
+
* closed: the layer, the trap, the isolation and the scroll lock end and focus is restored in the
|
|
15888
|
+
* commit that closes it, while the element still runs its exit motion (`inert`) or stays mounted
|
|
15889
|
+
* (`hidden`, with `unmountOnClose={false}`); the next open starts them again with the same
|
|
15890
|
+
* element.
|
|
15891
|
+
*/
|
|
15892
|
+
export declare function useModalLayer(options: UseModalLayerOptions): DismissLayer;
|
|
15893
|
+
|
|
15894
|
+
/**
|
|
15895
|
+
* Options of {@link useModalLayer}: `useDismiss` options (the kind follows `modalType`) plus focus.
|
|
15896
|
+
*/
|
|
15897
|
+
export declare interface UseModalLayerOptions extends Omit<UseDismissOptions, 'kind'> {
|
|
15898
|
+
/** The modal surface, held in state via a callback ref. */
|
|
15899
|
+
container: HTMLElement | null;
|
|
15900
|
+
/**
|
|
15901
|
+
* `modal` (default) and `alert` register a `modal` layer, trap focus, isolate the page, lock its
|
|
15902
|
+
* scroll and restore focus (an `alert` layer ignores outside presses); `non-modal` registers a
|
|
15903
|
+
* `dialog` layer (`escape: 'inside'`, no outside press, no focus-outside), traps, isolates and
|
|
15904
|
+
* locks nothing, moves focus in on open with the trap's initial-focus rule and restores focus only
|
|
15905
|
+
* from inside (`requireFocusInside`).
|
|
15906
|
+
* @default 'modal'
|
|
15907
|
+
*/
|
|
15908
|
+
modalType?: ModalType;
|
|
15909
|
+
/** What the focus trap (or a non-modal surface's initial focus) focuses first. @default 'first' */
|
|
15910
|
+
initialFocus?: UseFocusTrapOptions['initialFocus'];
|
|
15911
|
+
/** The trigger: preferred focus-restore target. */
|
|
15912
|
+
triggerRef?: React_2.RefObject<HTMLElement | null>;
|
|
15913
|
+
/** Consumer override for the focus-restore target. */
|
|
15914
|
+
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
15915
|
+
}
|
|
15916
|
+
|
|
15917
|
+
/**
|
|
15918
|
+
* Whether a modal surface is open (a Dialog, an overlay Drawer, an alert, the DatePicker's calendar, or your
|
|
15919
|
+
* own `useDismiss({ kind: 'modal' })` layer): `true` from the
|
|
15920
|
+
* commit that opens it to the commit that closes it, not until its exit motion ends. A non-modal
|
|
15921
|
+
* Dialog or Drawer, a Popover or a Menu is no modal. `false` on the server and during hydration.
|
|
15922
|
+
*
|
|
15923
|
+
* Use it to hold back app behavior the modal should own, such as global keyboard shortcuts, instead
|
|
15924
|
+
* of guessing from the page's `inert` attributes.
|
|
15925
|
+
*
|
|
15926
|
+
* @example
|
|
15927
|
+
* const modalOpen = useModalOpen();
|
|
15928
|
+
* useEffect(() => {
|
|
15929
|
+
* if (modalOpen) return;
|
|
15930
|
+
* const onKey = (event: KeyboardEvent) => { if (event.key === '/') focusSearch(); };
|
|
15931
|
+
* document.addEventListener('keydown', onKey);
|
|
15932
|
+
* return () => document.removeEventListener('keydown', onKey);
|
|
15933
|
+
* }, [modalOpen]);
|
|
15934
|
+
*/
|
|
15935
|
+
export declare function useModalOpen(): boolean;
|
|
15936
|
+
|
|
13370
15937
|
/**
|
|
13371
15938
|
* The items an {@link Overflow} currently hides: their `itemId`s in DOM order and their count. Use
|
|
13372
15939
|
* it in the component that `overflowButton` renders to list the hidden items in a menu. Must be
|
|
@@ -13382,6 +15949,117 @@ export declare interface UseOverflowMenuResult {
|
|
|
13382
15949
|
count: number;
|
|
13383
15950
|
}
|
|
13384
15951
|
|
|
15952
|
+
/**
|
|
15953
|
+
* Positions a popup surface next to its anchor with `@floating-ui/react-dom` (Tooltip, Popover,
|
|
15954
|
+
* Menu, listboxes, the DatePicker calendar, TeachingPopover): `offset`, `flip`, `shift`, optional
|
|
15955
|
+
* `size` (reference width / available space as CSS variables) and `arrow`. `flip`, `shift` and
|
|
15956
|
+
* `size` keep the same viewport padding, taken from the `shift` option (8px by default). Logical
|
|
15957
|
+
* `start`/`end` sides follow `useDirection()` (the WaveProvider `dir`, else the document
|
|
15958
|
+
* direction), and so does start/end alignment.
|
|
15959
|
+
*
|
|
15960
|
+
* Positions update only while `open` (`autoUpdate` on scroll/resize; element resizes and layout
|
|
15961
|
+
* shifts only where `ResizeObserver`/`IntersectionObserver` exist). Spread `floatingProps` onto the
|
|
15962
|
+
* surface: `data-side`/`data-align` expose the final placement for styling (C-CLASS).
|
|
15963
|
+
*
|
|
15964
|
+
* The anchor is an element or a `VirtualElement` (a rectangle such as the pointer position; a new
|
|
15965
|
+
* object on every render is fine); give it a `contextElement` so scrolling its containers updates
|
|
15966
|
+
* the position. A virtual anchor reaches floating-ui through one stable proxy that reads the latest
|
|
15967
|
+
* object: a new object only recomputes the position (which renders only when the position
|
|
15968
|
+
* changes), and a new proxy is made only when the `contextElement` changes.
|
|
15969
|
+
*
|
|
15970
|
+
* Destructure the result: `eslint-plugin-react-hooks` (`react-hooks/refs`) treats an object
|
|
15971
|
+
* whose member is passed to a `ref` prop as a ref, and then rejects reading its other members
|
|
15972
|
+
* during render.
|
|
15973
|
+
*
|
|
15974
|
+
* @example
|
|
15975
|
+
* const { setReference, setFloating, floatingProps } = usePopupPosition({ open, side: 'bottom' });
|
|
15976
|
+
* <button ref={setReference} />
|
|
15977
|
+
* {open && <Portal><div ref={setFloating} {...floatingProps} /></Portal>}
|
|
15978
|
+
*/
|
|
15979
|
+
export declare function usePopupPosition(options: UsePopupPositionOptions): UsePopupPositionResult;
|
|
15980
|
+
|
|
15981
|
+
/** Options of {@link usePopupPosition}. */
|
|
15982
|
+
export declare interface UsePopupPositionOptions {
|
|
15983
|
+
/** Whether the popup is open; positions are kept up to date only while `true`. */
|
|
15984
|
+
open: boolean;
|
|
15985
|
+
/** Side of the anchor. `start`/`end` follow the writing direction. @default 'bottom' */
|
|
15986
|
+
side?: PopupSide;
|
|
15987
|
+
/** Alignment along that side. @default 'start' */
|
|
15988
|
+
align?: PopupAlign;
|
|
15989
|
+
/** Distance from the anchor in px. @default 4 (tooltips use 8) */
|
|
15990
|
+
offset?: number;
|
|
15991
|
+
/** Flip to the opposite side when there is not enough room. @default true */
|
|
15992
|
+
flip?: boolean;
|
|
15993
|
+
/**
|
|
15994
|
+
* Shift along the side to stay inside the viewport. Its padding is also the viewport padding of
|
|
15995
|
+
* `flip` and of `size` (`fitViewport`, `matchReferenceWidth`): `true` means 8px, and `false`
|
|
15996
|
+
* lets the popup flip only once it touches the viewport edge and grow right up to it. With
|
|
15997
|
+
* `crossAxis: true` it also shifts across the side, over the anchor, when neither side has room
|
|
15998
|
+
* after `flip` (submenus), and `fitViewport` then offers the whole viewport in that direction.
|
|
15999
|
+
* @default { padding: 8 }
|
|
16000
|
+
*/
|
|
16001
|
+
shift?: boolean | {
|
|
16002
|
+
padding: number;
|
|
16003
|
+
crossAxis?: boolean;
|
|
16004
|
+
};
|
|
16005
|
+
/** Make the surface as wide as the anchor (listboxes). @default false */
|
|
16006
|
+
matchReferenceWidth?: boolean;
|
|
16007
|
+
/** Limit the surface to the available space (`max-width`/`max-height`). @default false */
|
|
16008
|
+
fitViewport?: boolean;
|
|
16009
|
+
/** An arrow (beak) element inside the surface, positioned through `arrowStyles`. */
|
|
16010
|
+
arrowRef?: React_2.RefObject<HTMLElement | null>;
|
|
16011
|
+
/** CSS positioning strategy. @default 'fixed' */
|
|
16012
|
+
strategy?: 'absolute' | 'fixed';
|
|
16013
|
+
/**
|
|
16014
|
+
* Placements to try, in order, when the requested side has no room, instead of only the opposite
|
|
16015
|
+
* side. Ignored with `flip: false`. An omitted `align` is the hook's own `align`.
|
|
16016
|
+
*/
|
|
16017
|
+
fallbackPlacements?: readonly PopupPlacement[];
|
|
16018
|
+
/**
|
|
16019
|
+
* Hide the surface (`visibility: hidden`: its layout is unaffected, but its content cannot take
|
|
16020
|
+
* focus, so a surface that holds focus loses it) while the anchor is scrolled out of view or
|
|
16021
|
+
* clipped away. @default false
|
|
16022
|
+
*/
|
|
16023
|
+
hideWhenDetached?: boolean;
|
|
16024
|
+
/**
|
|
16025
|
+
* Called after the surface is positioned, and again whenever the final placement changes (a flip,
|
|
16026
|
+
* a fallback): not on every scroll or resize recompute. It runs from an effect, never during
|
|
16027
|
+
* render, and not while closed.
|
|
16028
|
+
*/
|
|
16029
|
+
onPositioned?: (info: PositionedInfo) => void;
|
|
16030
|
+
}
|
|
16031
|
+
|
|
16032
|
+
/** Returned by {@link usePopupPosition}. */
|
|
16033
|
+
export declare interface UsePopupPositionResult {
|
|
16034
|
+
/**
|
|
16035
|
+
* Sets the anchor: a ref callback for the anchor (trigger) element, or a call from a layout
|
|
16036
|
+
* effect or an event. The anchor is an element or a `VirtualElement` (a rectangle such as the
|
|
16037
|
+
* pointer position; a new object on every render is fine); give it a `contextElement` so
|
|
16038
|
+
* scrolling its containers updates the position.
|
|
16039
|
+
*/
|
|
16040
|
+
setReference(el: HTMLElement | VirtualElement | null): void;
|
|
16041
|
+
/** Ref callback for the popup surface. */
|
|
16042
|
+
setFloating(el: HTMLElement | null): void;
|
|
16043
|
+
/** Position styles for the surface (also in `floatingProps.style`). */
|
|
16044
|
+
floatingStyles: React_2.CSSProperties;
|
|
16045
|
+
/** Position styles for the arrow element. */
|
|
16046
|
+
arrowStyles: React_2.CSSProperties;
|
|
16047
|
+
/** Final placement after flipping, e.g. `'top-start'`. */
|
|
16048
|
+
placement: string;
|
|
16049
|
+
/** Final physical side after flipping. */
|
|
16050
|
+
side: 'top' | 'bottom' | 'left' | 'right';
|
|
16051
|
+
/** Whether a position has been computed since the popup opened. */
|
|
16052
|
+
isPositioned: boolean;
|
|
16053
|
+
/** Recomputes the position now, for a change floating-ui cannot observe. A no-op while closed. */
|
|
16054
|
+
update(): void;
|
|
16055
|
+
/** Spread onto the surface: `data-side`, `data-align` and the position style. */
|
|
16056
|
+
floatingProps: {
|
|
16057
|
+
'data-side': string;
|
|
16058
|
+
'data-align': string;
|
|
16059
|
+
style: React_2.CSSProperties;
|
|
16060
|
+
};
|
|
16061
|
+
}
|
|
16062
|
+
|
|
13385
16063
|
/**
|
|
13386
16064
|
* Mounts and unmounts an element with CSS enter and exit motion. Style the phases with
|
|
13387
16065
|
* `data-presence` variants, e.g. `transition-opacity duration-wave-normal
|
|
@@ -13463,6 +16141,102 @@ export declare interface UsePresenceResult {
|
|
|
13463
16141
|
presenceProps: PresenceAttributes;
|
|
13464
16142
|
}
|
|
13465
16143
|
|
|
16144
|
+
/**
|
|
16145
|
+
* Returns focus to where it came from when a surface closes (dialogs, drawers, popovers, menus,
|
|
16146
|
+
* the DatePicker calendar, TeachingPopover).
|
|
16147
|
+
*
|
|
16148
|
+
* - **Capture**: when `enabled` flips to `true`, the opener is captured in an insertion effect —
|
|
16149
|
+
* before React applies `autoFocus` inside the new surface — preferring `triggerRef.current` and
|
|
16150
|
+
* ignoring `<body>` and elements inside `container`. When that finds nothing (a surface that
|
|
16151
|
+
* mounts open, before the refs of its commit are attached), it is captured again in the layout
|
|
16152
|
+
* phase of the same commit. Its place in the document and the triggers of the overlays it sits
|
|
16153
|
+
* in are recorded with it. When focus is already on `<body>` because
|
|
16154
|
+
* the focused element was removed earlier in the same commit (a menu item in a popover that
|
|
16155
|
+
* closes as the dialog it opens appears, the popover coming first in the tree), a document
|
|
16156
|
+
* focus tracker supplies that element with its recorded place and overlay triggers. The tracker
|
|
16157
|
+
* runs while any instance of the hook is mounted, and it forgets an element the user moved focus
|
|
16158
|
+
* away from on purpose.
|
|
16159
|
+
* - **Restore** when `enabled` flips to `false` (layout phase) and when the component unmounts
|
|
16160
|
+
* while enabled. The unmount restore runs in a microtask and is cancelled if the same instance
|
|
16161
|
+
* mounts again, so React StrictMode's simulated unmount does not pull focus out of a surface
|
|
16162
|
+
* that just opened.
|
|
16163
|
+
* - **Targets**, first valid wins:
|
|
16164
|
+
* 1. `finalFocusRef` → the captured opener → `triggerRef` → `fallback()`.
|
|
16165
|
+
* 2. When the opener was removed or cannot take focus, its replacement, nearest first: the
|
|
16166
|
+
* tabbable element next to where it was (in the innermost surviving ancestor that holds one,
|
|
16167
|
+
* the next one — the next row's action after a delete — else the previous one; then the same
|
|
16168
|
+
* one level up), else the trigger of the overlay it was in (a menu item's menu button), else
|
|
16169
|
+
* the element next to that trigger. When the surface is rendered inside another open layer
|
|
16170
|
+
* (its parent layer, from `DismissLayerContext`: a confirm Dialog in a Drawer's content),
|
|
16171
|
+
* only the replacements inside that layer's tree are tried here.
|
|
16172
|
+
* 3. The parent layer's surface, then the replacements outside the parent layer.
|
|
16173
|
+
* 4. The surface of the modal layer that stays open.
|
|
16174
|
+
*
|
|
16175
|
+
* So a confirm Dialog rendered in a Drawer's content and one rendered next to the Drawer both
|
|
16176
|
+
* return focus to the adjacent row, not to the Drawer's panel. A target is valid when it is
|
|
16177
|
+
* connected, focusable, not inside `[inert]` or `[aria-hidden="true"]`, and not cut off behind
|
|
16178
|
+
* another open modal layer — so focus never lands on the inert page behind a Drawer that stays
|
|
16179
|
+
* open, and is not dropped on `<body>` while a valid target exists. Focus uses `preventScroll`.
|
|
16180
|
+
* - `onlyIfFocusInside` (popovers): restores only when focus is inside the surface or was lost to
|
|
16181
|
+
* `<body>`.
|
|
16182
|
+
* - `requireFocusInside` (surfaces that do not trap focus: a non-modal Dialog or Drawer, an inline
|
|
16183
|
+
* Drawer): restores only when focus is inside the surface or in a layer opened from it (a
|
|
16184
|
+
* descendant layer of `layerId`, or a layer anchored inside the surface), or was lost to
|
|
16185
|
+
* `<body>` from an element in either; a close from code while focus is on `<body>` or on the
|
|
16186
|
+
* page moves nothing.
|
|
16187
|
+
* - `isHoverClose`: a close by the hover intent restores only when focus is inside the surface, so
|
|
16188
|
+
* a hover close never moves focus from `<body>` or from where the user put it. The same holds for
|
|
16189
|
+
* a surface opened from inside one that closes by hover (a submenu, a hover card in a hover
|
|
16190
|
+
* card): every mounted instance is known to the others through the focus tracker's record.
|
|
16191
|
+
*/
|
|
16192
|
+
export declare function useRestoreFocus(options: UseRestoreFocusOptions): void;
|
|
16193
|
+
|
|
16194
|
+
/** Options of {@link useRestoreFocus}. */
|
|
16195
|
+
export declare interface UseRestoreFocusOptions {
|
|
16196
|
+
/** `true` while the surface is open. */
|
|
16197
|
+
enabled: boolean;
|
|
16198
|
+
/** The layer surface: opener candidates inside it are ignored. */
|
|
16199
|
+
container?: HTMLElement | null;
|
|
16200
|
+
/** The trigger: preferred restore target. */
|
|
16201
|
+
triggerRef?: React_2.RefObject<HTMLElement | null>;
|
|
16202
|
+
/** Consumer override: focused first when valid. */
|
|
16203
|
+
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
16204
|
+
/** Used when neither the override, the opener nor the trigger can take focus. */
|
|
16205
|
+
fallback?: () => HTMLElement | null;
|
|
16206
|
+
/**
|
|
16207
|
+
* Popovers: restore only when focus was inside the surface (or lost to `<body>`) at close, so a
|
|
16208
|
+
* click that moved focus elsewhere is respected. @default false
|
|
16209
|
+
*/
|
|
16210
|
+
onlyIfFocusInside?: boolean;
|
|
16211
|
+
/**
|
|
16212
|
+
* Read when the surface closes, or unmounts while open: `true` when the hover intent closed it
|
|
16213
|
+
* (Popover and Menu `openOnHover`, a submenu closing by hover). A hover close never moves focus:
|
|
16214
|
+
* it restores only while focus is inside the surface, so focus on `<body>` (where a hover-opened
|
|
16215
|
+
* surface leaves it) or elsewhere stays where it is. A surface opened from inside one that closes
|
|
16216
|
+
* by hover (its opener, else its trigger, lies in that surface: a submenu, a hover card in a
|
|
16217
|
+
* hover card, at any depth) is taken along, and its close counts as a hover close too. Every
|
|
16218
|
+
* other close keeps the rules above.
|
|
16219
|
+
*/
|
|
16220
|
+
isHoverClose?: () => boolean;
|
|
16221
|
+
/**
|
|
16222
|
+
* Surfaces that do not trap focus (a non-modal Dialog or Drawer, an inline Drawer): restore only
|
|
16223
|
+
* when focus is inside the surface at close, or was lost to `<body>` from an element inside it
|
|
16224
|
+
* (removed, or made unable to take focus). Focus elsewhere, or on `<body>` for another reason
|
|
16225
|
+
* (nothing had focus, a press on a spot that takes no focus, a close from code), stays where it
|
|
16226
|
+
* is. Wins over `onlyIfFocusInside`. Focus in a layer opened from the surface (a Popover or a
|
|
16227
|
+
* confirm Dialog, portaled outside it) counts as inside: a descendant layer of `layerId`, or a
|
|
16228
|
+
* layer anchored to an element inside the surface; so does focus lost to `<body>` from one.
|
|
16229
|
+
* @default false
|
|
16230
|
+
*/
|
|
16231
|
+
requireFocusInside?: boolean;
|
|
16232
|
+
/**
|
|
16233
|
+
* The surface's own dismiss layer, with `requireFocusInside`: focus in one of its descendant
|
|
16234
|
+
* layers counts as inside the surface, also after the surface's layer has unregistered (in the
|
|
16235
|
+
* commit that closes it).
|
|
16236
|
+
*/
|
|
16237
|
+
layerId?: string;
|
|
16238
|
+
}
|
|
16239
|
+
|
|
13466
16240
|
/**
|
|
13467
16241
|
* Implements the WAI-ARIA roving tabindex pattern for composite widgets: one item holds the tab
|
|
13468
16242
|
* stop (`tabIndex=0`, all others `-1`), arrow keys move focus between items, Home/End jump to the
|
|
@@ -13488,6 +16262,12 @@ export declare interface UsePresenceResult {
|
|
|
13488
16262
|
* tracked with a MutationObserver, so an item that disables itself moves the tab stop without
|
|
13489
16263
|
* the owner re-rendering. With `manageTabIndex`, a control hidden by CSS counts as disabled and
|
|
13490
16264
|
* `input[type=hidden]` is no item.
|
|
16265
|
+
* - **Hand-back** (`manageTabIndex`): a container that stops being one (its ref detaches or moves
|
|
16266
|
+
* to another element) or that stops managing tabIndex gives every element it stamped its own
|
|
16267
|
+
* `tabindex` back (the one it had, or the one its author rendered since) and removes the
|
|
16268
|
+
* `data-roving-value` it added, so each control is its own Tab stop again; attached again, it
|
|
16269
|
+
* stamps again from the last focused item. An element `itemSelector` no longer matches is handed
|
|
16270
|
+
* back at once.
|
|
13491
16271
|
* - **Tab stop** (`tabStop`): `'active'` — the enabled `activeValue` item, else the first enabled
|
|
13492
16272
|
* item; `'last-focused'` — the last focused enabled item, else the `'active'` rule. A nested
|
|
13493
16273
|
* composite or a control that uses the arrow keys itself holds it only when no other item can;
|
|
@@ -13545,10 +16325,23 @@ export declare interface UseRovingTabIndexOptions {
|
|
|
13545
16325
|
items?: readonly string[];
|
|
13546
16326
|
/**
|
|
13547
16327
|
* Arrow key axis: `'horizontal'` uses Left/Right (mirrored in RTL), `'vertical'` uses Up/Down,
|
|
13548
|
-
* `'both'` uses all four.
|
|
16328
|
+
* `'both'` uses all four, in the DOM order of the items.
|
|
16329
|
+
*
|
|
16330
|
+
* `'grid'` is a two-dimensional grid: Left/Right move through the cells in reading order across
|
|
16331
|
+
* rows (mirrored in RTL); Up/Down go to the cell at the same index in the previous or next row,
|
|
16332
|
+
* else to the nearest enabled cell of that row (the earlier one on a tie), skipping rows without
|
|
16333
|
+
* an enabled cell, and stop at the first and last row; Home/End go to the first and last enabled
|
|
16334
|
+
* cell of the row, Ctrl+Home/End of the grid (whatever `homeEndKeys` says). Rows are the
|
|
16335
|
+
* `role="row"` elements inside the container, else groups of `columns` items in DOM order. Without
|
|
16336
|
+
* either, `'grid'` acts as `'both'` and a development warning says so.
|
|
13549
16337
|
* @default 'horizontal'
|
|
13550
16338
|
*/
|
|
13551
|
-
orientation?: 'horizontal' | 'vertical' | 'both';
|
|
16339
|
+
orientation?: 'horizontal' | 'vertical' | 'both' | 'grid';
|
|
16340
|
+
/**
|
|
16341
|
+
* With `orientation: 'grid'` and no `role="row"` elements: the number of cells per row. The last
|
|
16342
|
+
* row may be shorter.
|
|
16343
|
+
*/
|
|
16344
|
+
columns?: number;
|
|
13552
16345
|
/**
|
|
13553
16346
|
* Whether arrow keys wrap around at the ends.
|
|
13554
16347
|
* @default true
|
|
@@ -13597,7 +16390,15 @@ export declare interface UseRovingTabIndexOptions {
|
|
|
13597
16390
|
* Matches that cannot take focus are no items: `input[type=hidden]` is skipped, and a control
|
|
13598
16391
|
* hidden by CSS inside the container (`display: none` or `visibility: hidden` on it or on an
|
|
13599
16392
|
* ancestor inside the container) is treated as disabled (skipped, never the tab stop, stamped
|
|
13600
|
-
* -1). A container hidden as a whole from outside keeps its items and tab stop.
|
|
16393
|
+
* -1). A container hidden as a whole from outside keeps its items and tab stop.
|
|
16394
|
+
* When the container stops being one (its ref detaches, as when `containerProps` are no longer
|
|
16395
|
+
* spread, or moves to another element) or `manageTabIndex` turns false, every element the hook
|
|
16396
|
+
* stamped gets its own `tabindex` back (the attribute it had at its first stamp, or none; a
|
|
16397
|
+
* `tabIndex` its author rendered since, the commit that detaches the container included, stays)
|
|
16398
|
+
* and loses a `data-roving-value` the hook added (one React rendered stays). An element that
|
|
16399
|
+
* stops being an item (`itemSelector`, or a changed selector, no longer matches it) is handed
|
|
16400
|
+
* back the same way. The last focused item and the generated values are kept, so a container
|
|
16401
|
+
* that attaches again starts where it was. */
|
|
13601
16402
|
manageTabIndex?: boolean;
|
|
13602
16403
|
/** Called after an arrow, Home/End or typeahead key moved focus to `value`. */
|
|
13603
16404
|
onFocusMove?: (value: string, event: React_2.KeyboardEvent) => void;
|