@mortenbrudvik/waveui 0.10.0 → 0.11.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 +357 -72
- 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/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 +213 -181
- package/dist/components/feedback/Toaster.mjs.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/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +16 -11
- 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 +416 -0
- package/dist/components/input/TagPicker.root.mjs.map +1 -0
- 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/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 +190 -125
- 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/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/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +35 -22
- package/dist/hooks/useModalLayer.mjs.map +1 -1
- 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/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +102 -78
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2226 -221
- package/dist/index.d.ts +2226 -221
- package/dist/index.mjs +115 -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 +53 -47
- 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
|
|
@@ -3367,8 +3374,9 @@ export declare interface DatePickerProps extends Omit<React_2.HTMLAttributes<HTM
|
|
|
3367
3374
|
export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3368
3375
|
|
|
3369
3376
|
/**
|
|
3370
|
-
* A
|
|
3371
|
-
* `Dialog.Content` renders the surface in a portal while open
|
|
3377
|
+
* A dialog (Fluent UI v2 style), modal by default: `Dialog` holds the open state; `Dialog.Trigger`
|
|
3378
|
+
* opens and closes it and `Dialog.Content` renders the surface in a portal while open (and, with
|
|
3379
|
+
* `unmountOnClose={false}`, keeps it there while closed, `hidden` and `inert`).
|
|
3372
3380
|
*
|
|
3373
3381
|
* - **Modal**: focus moves into the dialog and Tab stays inside it (toasts included), the rest of
|
|
3374
3382
|
* the page is `inert` (instead of `aria-modal`, so toasts and live regions stay announced), and
|
|
@@ -3383,8 +3391,29 @@ export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
3383
3391
|
* that had focus when the dialog opened, the trigger, an element next to where that opener was.
|
|
3384
3392
|
* - **Alert dialogs**: `modalType="alert"` renders `role="alertdialog"` for a confirmation that
|
|
3385
3393
|
* needs an answer; a backdrop press does not close it.
|
|
3394
|
+
* - **Non-modal dialogs**: `modalType="non-modal"` leaves the page usable (no backdrop, no focus
|
|
3395
|
+
* trap, nothing inert, the page scrolls). Focus moves in on open; Tab and Shift+Tab leave the
|
|
3396
|
+
* dialog in the page's order right after the element that opened it; Escape closes it only while
|
|
3397
|
+
* focus is inside it; presses on the page never close it; focus returns to the opener only from
|
|
3398
|
+
* inside. Keep the page's controls clear of the dialog, which covers the page under it.
|
|
3399
|
+
* - **Size**: `Dialog.Content` `size` caps the width at 400px (`small`), 600px (`medium`, the
|
|
3400
|
+
* default) or 940px (`large`); `full` covers the viewport and pads its safe-area insets.
|
|
3401
|
+
* - **Backdrop**: the backdrop is the surface's sibling and a slot (`backdrop`: `null` removes it,
|
|
3402
|
+
* `appearance` picks `dimmed` or `transparent`). A modal opened over another modal dims the page
|
|
3403
|
+
* once: its backdrop is transparent while the lower one is open.
|
|
3404
|
+
* - **Close button and title actions**: `closeButton` sets the built-in Close button's content, or
|
|
3405
|
+
* hides it (`null`); a button passed there is merged into it. `titleAction` and `Dialog.Title`'s
|
|
3406
|
+
* `action` place header buttons before the Close button in the top end corner, in DOM and Tab
|
|
3407
|
+
* order, and the titles' end padding makes room for them. Initial focus goes to the first
|
|
3408
|
+
* focusable element: a title action, else the Close button.
|
|
3386
3409
|
* - **Footer**: `Dialog.Footer` sticks to the bottom of the scrolling body, and the body keeps a
|
|
3387
3410
|
* focused field above it.
|
|
3411
|
+
* - **Kept mounted**: `unmountOnClose={false}` keeps the content mounted while the dialog is
|
|
3412
|
+
* closed, so a form keeps what was typed and the components inside keep their state; each open
|
|
3413
|
+
* focuses the first focusable element again (an `autoFocus` inside never applies), and a kept
|
|
3414
|
+
* dialog opened while another overlay is open stacks above it.
|
|
3415
|
+
* - **Presence**: the surface mounts through the presence core and renders `data-presence`; no
|
|
3416
|
+
* motion ships, and `data-[presence=…]:` classes on `Dialog.Content` animate it.
|
|
3388
3417
|
* - **Naming**: give `Dialog.Content` a `title`, a `Dialog.Title`, or `aria-label`.
|
|
3389
3418
|
*
|
|
3390
3419
|
* The sub-components are also exported under flat names (`DialogTrigger`, `DialogContent`,
|
|
@@ -3404,7 +3433,7 @@ export declare type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
3404
3433
|
* </Dialog>
|
|
3405
3434
|
*/
|
|
3406
3435
|
export declare const Dialog: {
|
|
3407
|
-
({ open, defaultOpen, onOpenChange, modalType, finalFocusRef, children, }: DialogProps): React_2.JSX.Element;
|
|
3436
|
+
({ open, defaultOpen, onOpenChange, modalType, finalFocusRef, unmountOnClose, children, }: DialogProps): React_2.JSX.Element;
|
|
3408
3437
|
displayName: string;
|
|
3409
3438
|
} & {
|
|
3410
3439
|
Trigger: {
|
|
@@ -3412,7 +3441,7 @@ export declare const Dialog: {
|
|
|
3412
3441
|
displayName: string;
|
|
3413
3442
|
};
|
|
3414
3443
|
Content: {
|
|
3415
|
-
({ title, size, closeLabel, children, className, id, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3444
|
+
({ title, size, backdrop, closeButton, titleAction, closeLabel, children, className, style, id, onKeyDown, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3416
3445
|
displayName: string;
|
|
3417
3446
|
};
|
|
3418
3447
|
Footer: {
|
|
@@ -3420,7 +3449,7 @@ export declare const Dialog: {
|
|
|
3420
3449
|
displayName: string;
|
|
3421
3450
|
};
|
|
3422
3451
|
Title: {
|
|
3423
|
-
({ id, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3452
|
+
({ id, action, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3424
3453
|
displayName: string;
|
|
3425
3454
|
};
|
|
3426
3455
|
Close: {
|
|
@@ -3464,28 +3493,47 @@ export declare interface DialogCloseRenderProps extends React_2.HTMLAttributes<H
|
|
|
3464
3493
|
|
|
3465
3494
|
/**
|
|
3466
3495
|
* The dialog surface, rendered in a portal (inheriting the WaveProvider theme) while the dialog is
|
|
3467
|
-
* open
|
|
3468
|
-
* `
|
|
3469
|
-
*
|
|
3470
|
-
*
|
|
3471
|
-
* viewport
|
|
3472
|
-
*
|
|
3473
|
-
*
|
|
3496
|
+
* open, and kept there while it is closed, `hidden` and `inert`, when the Dialog has
|
|
3497
|
+
* `unmountOnClose={false}`: the backdrop, and the surface centred in the positioner (the
|
|
3498
|
+
* backdrop's sibling) with the title, the title-actions area (title actions, then the Close
|
|
3499
|
+
* button) and a scrolling body. It takes the full width up to its `size` and never exceeds the
|
|
3500
|
+
* viewport (the body scrolls, also sideways for content wider than the dialog); `size="full"`
|
|
3501
|
+
* fills the viewport. Its 1rem gap to the viewport edges is its own margin, so a margin in
|
|
3502
|
+
* `className` replaces the gap: with the width and height caps lifted as well and its height set
|
|
3503
|
+
* to the viewport's, it fills the viewport. It is `role="dialog"`, or `role="alertdialog"` when the
|
|
3504
|
+
* Dialog has `modalType="alert"` (a `role` you pass wins), and carries `data-modal-type` and
|
|
3505
|
+
* `data-size` with the resolved values. A non-modal dialog has no backdrop: the positioner only
|
|
3506
|
+
* centres the surface and lets presses through to the page. The titles' end padding follows the
|
|
3507
|
+
* width of the title-actions area (`--wave-dialog-title-end-padding`, 2rem until it is measured).
|
|
3508
|
+
*
|
|
3509
|
+
* It mounts through the presence core: the backdrop, the positioner and the surface render
|
|
3510
|
+
* `data-presence` (`entered` while open, `exited` while kept closed; `entering` and `exiting`
|
|
3511
|
+
* only while a motion of yours runs on the surface), and the backdrop and the positioner are
|
|
3512
|
+
* `inert` while exiting and `hidden` and `inert` while kept closed. No motion ships: animate the
|
|
3513
|
+
* surface with `data-[presence=…]:` classes in `className` (an enter's start as
|
|
3514
|
+
* `data-[presence=entering]:starting:`, each with a `motion-reduce:` counterpart); a closed
|
|
3515
|
+
* surface waits for that motion before it unmounts or hides, while focus, the trap and the
|
|
3516
|
+
* isolation follow the open state at once.
|
|
3474
3517
|
*/
|
|
3475
3518
|
export declare const DialogContent: {
|
|
3476
|
-
({ title, size, closeLabel, children, className, id, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3519
|
+
({ title, size, backdrop, closeButton, titleAction, closeLabel, children, className, style, id, onKeyDown, ref, ...rest }: DialogContentProps): React_2.JSX.Element | null;
|
|
3477
3520
|
displayName: string;
|
|
3478
3521
|
};
|
|
3479
3522
|
|
|
3480
3523
|
/**
|
|
3481
|
-
* Dialog.Content: `root` on the surface (`role="dialog"` or `"alertdialog"
|
|
3482
|
-
* backdrop
|
|
3483
|
-
*
|
|
3484
|
-
*
|
|
3524
|
+
* Dialog.Content: `root` on the surface (`role="dialog"` or `"alertdialog"`, also while kept
|
|
3525
|
+
* mounted); `backdrop` on the backdrop behind it; `positioner` on the element that centres the
|
|
3526
|
+
* surface (the backdrop's sibling); `titleActions` on the area of header buttons in the top end
|
|
3527
|
+
* corner; `titleAction` on the element of the `titleAction` slot; `closeButton` on the built-in
|
|
3528
|
+
* Close button (which also carries Button's root); `body` on the scrolling body. The heading of
|
|
3529
|
+
* its `title` prop carries Dialog.Title's class.
|
|
3485
3530
|
*/
|
|
3486
3531
|
export declare const dialogContentClassNames: {
|
|
3487
3532
|
readonly root: "wave-dialog-content";
|
|
3488
3533
|
readonly backdrop: "wave-dialog-content__backdrop";
|
|
3534
|
+
readonly positioner: "wave-dialog-content__positioner";
|
|
3535
|
+
readonly titleActions: "wave-dialog-content__title-actions";
|
|
3536
|
+
readonly titleAction: "wave-dialog-content__title-action";
|
|
3489
3537
|
readonly closeButton: "wave-dialog-content__close-button";
|
|
3490
3538
|
readonly body: "wave-dialog-content__body";
|
|
3491
3539
|
};
|
|
@@ -3498,13 +3546,52 @@ export declare interface DialogContentProps extends Omit<React_2.HTMLAttributes<
|
|
|
3498
3546
|
* (`''`, `[]`, `true`) counts as none.
|
|
3499
3547
|
*/
|
|
3500
3548
|
title?: React_2.ReactNode;
|
|
3501
|
-
/**
|
|
3549
|
+
/**
|
|
3550
|
+
* Width cap: 400px (`small`), 600px (`medium`) or 940px (`large`), never wider than the viewport
|
|
3551
|
+
* (a 1rem margin). `full` covers the viewport: no margin, radius or border, the viewport's
|
|
3552
|
+
* dynamic height, and the safe-area insets as padding (with `viewport-fit=cover`); the body
|
|
3553
|
+
* scrolls under the sticky `Dialog.Footer`. Rendered as `data-size`. Fluent has no size. For
|
|
3554
|
+
* another width, put a width cap in `className` (it replaces the size's).
|
|
3502
3555
|
* @default 'medium'
|
|
3503
3556
|
*/
|
|
3504
|
-
size?:
|
|
3557
|
+
size?: DialogSize;
|
|
3558
|
+
/**
|
|
3559
|
+
* The backdrop of a modal or alert dialog: a `div` behind the dialog, `aria-hidden`. Shorthand
|
|
3560
|
+
* content renders inside it; a slot object's `className` (merged last), `style`, data
|
|
3561
|
+
* attributes, `ref` and handlers go to it, and its `appearance` (`'dimmed'` or `'transparent'`)
|
|
3562
|
+
* overrides the automatic one: while another modal Dialog or Drawer is open below this one the
|
|
3563
|
+
* backdrop is transparent, so the page is dimmed once. `null` renders no backdrop (the page stays
|
|
3564
|
+
* inert, and a press outside still closes a modal dialog); a boolean is no slot. Ignored with
|
|
3565
|
+
* `modalType="non-modal"` (a development warning says so). Fluent's `backdrop`.
|
|
3566
|
+
*/
|
|
3567
|
+
backdrop?: Slot<'div'> | (SlotObject<'div'> & {
|
|
3568
|
+
appearance?: BackdropAppearance;
|
|
3569
|
+
});
|
|
3570
|
+
/**
|
|
3571
|
+
* Content of the built-in Close button (the dismiss glyph by default). It renders inside the
|
|
3572
|
+
* button, decorative (`aria-hidden`), so the button keeps the name `closeLabel`; a slot object's
|
|
3573
|
+
* `aria-label`, `aria-labelledby` or `title` names it instead, and its handlers run before the
|
|
3574
|
+
* close (`preventDefault()` keeps the dialog open). `null` hides the button (Escape and
|
|
3575
|
+
* `Dialog.Close` still close); a boolean is no slot, so `closeButton={cond && <MyIcon />}` keeps
|
|
3576
|
+
* the default; content that renders nothing keeps the default glyph. A `<button>` or Wave
|
|
3577
|
+
* `Button` passed here is merged into the built-in button, never nested (a development warning
|
|
3578
|
+
* says so): its props apply, its text label (`<button>Done</button>`) names the button instead
|
|
3579
|
+
* of `closeLabel`, and a Button's `icon`, `iconPosition` and `disabledFocusable` apply while
|
|
3580
|
+
* `appearance` and `size` are ignored. Fluent's `DialogTitle` `action` holds Fluent's close
|
|
3581
|
+
* button; WaveUI renders its own.
|
|
3582
|
+
*/
|
|
3583
|
+
closeButton?: Slot<'span'>;
|
|
3584
|
+
/**
|
|
3585
|
+
* Header buttons for the `title` prop form, placed before the built-in Close button in the
|
|
3586
|
+
* dialog's top end corner, in DOM and Tab order (an expand toggle, a menu). The title's end
|
|
3587
|
+
* padding makes room for them. Interactive: name icon-only buttons. Renders nothing when empty.
|
|
3588
|
+
* See also `Dialog.Title`'s `action`. Fluent's `DialogTitle` `action`, for the `title` prop
|
|
3589
|
+
* form.
|
|
3590
|
+
*/
|
|
3591
|
+
titleAction?: Slot<'span'>;
|
|
3505
3592
|
/**
|
|
3506
3593
|
* Accessible name of the built-in Close button (an icon-only button). Localize it with the
|
|
3507
|
-
* page's language.
|
|
3594
|
+
* page's language. A text label of a button merged into `closeButton` names it instead.
|
|
3508
3595
|
* @default 'Close'
|
|
3509
3596
|
*/
|
|
3510
3597
|
closeLabel?: string;
|
|
@@ -3544,8 +3631,8 @@ export declare interface DialogFooterProps extends React_2.HTMLAttributes<HTMLDi
|
|
|
3544
3631
|
}
|
|
3545
3632
|
|
|
3546
3633
|
/**
|
|
3547
|
-
* How a {@link Dialog}
|
|
3548
|
-
* `
|
|
3634
|
+
* How a {@link Dialog} relates to the page: `modal`, `alert` or `non-modal` (the shared
|
|
3635
|
+
* `ModalType`; `DrawerModalType` is the same type).
|
|
3549
3636
|
*/
|
|
3550
3637
|
export declare type DialogModalType = ModalType;
|
|
3551
3638
|
|
|
@@ -3585,11 +3672,18 @@ export declare interface DialogProps {
|
|
|
3585
3672
|
*/
|
|
3586
3673
|
onOpenChange?: (open: boolean, details?: DialogOpenChangeDetails) => void;
|
|
3587
3674
|
/**
|
|
3588
|
-
* `modal`: a backdrop press, Escape, the Close
|
|
3589
|
-
*
|
|
3590
|
-
*
|
|
3591
|
-
*
|
|
3592
|
-
*
|
|
3675
|
+
* `modal`: the page behind is `inert` and does not scroll; a backdrop press, Escape, the Close
|
|
3676
|
+
* button and `Dialog.Close` close it. `alert`: a confirmation that needs an answer —
|
|
3677
|
+
* `role="alertdialog"`, and a backdrop press does not close it (Escape still does). `non-modal`:
|
|
3678
|
+
* the page stays usable — no backdrop, no focus trap, nothing inert, the page scrolls; Tab and
|
|
3679
|
+
* Shift+Tab leave the dialog in the page's order right after the element that opened it, Escape
|
|
3680
|
+
* closes it while focus is inside it, presses on the page never close it, and focus returns to
|
|
3681
|
+
* the opener only when it was inside the dialog. A non-modal dialog covers the page under it
|
|
3682
|
+
* while Tab still reaches that page: keep the controls the user works with outside it, or use
|
|
3683
|
+
* `modal` (with `size="full"` it covers everything, and a development warning says so). Every
|
|
3684
|
+
* type moves focus to the first focusable element on open (a title action, else the built-in
|
|
3685
|
+
* Close button); give another element `autoFocus` to start there (an alert dialog's least
|
|
3686
|
+
* destructive action). `Dialog.Trigger` toggles the dialog. Fluent's `modalType`.
|
|
3593
3687
|
* @default 'modal'
|
|
3594
3688
|
*/
|
|
3595
3689
|
modalType?: DialogModalType;
|
|
@@ -3600,43 +3694,75 @@ export declare interface DialogProps {
|
|
|
3600
3694
|
* send focus somewhere else.
|
|
3601
3695
|
*/
|
|
3602
3696
|
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
3697
|
+
/**
|
|
3698
|
+
* Removes `Dialog.Content` (the surface and everything in it) when the dialog closes. `false`
|
|
3699
|
+
* keeps it mounted while closed, `hidden` and `inert`, so a form inside keeps what was typed and
|
|
3700
|
+
* the components inside keep their state; the surface then mounts with the Dialog, closed (in
|
|
3701
|
+
* the browser only, as an open one), and an `autoFocus` inside it never applies (each open
|
|
3702
|
+
* focuses the first focusable element). A popup opened inside that is still open when the
|
|
3703
|
+
* dialog closes stays open over the page (a development warning says so): close it first.
|
|
3704
|
+
* Fluent's `unmountOnClose`.
|
|
3705
|
+
* @default true
|
|
3706
|
+
*/
|
|
3707
|
+
unmountOnClose?: boolean;
|
|
3603
3708
|
/** `Dialog.Trigger` and `Dialog.Content`. */
|
|
3604
3709
|
children: React_2.ReactNode;
|
|
3605
3710
|
}
|
|
3606
3711
|
|
|
3712
|
+
/**
|
|
3713
|
+
* The width cap of a {@link Dialog}'s surface: `small` 400px, `medium` 600px, `large` 940px, or
|
|
3714
|
+
* `full`, the whole viewport (the shared `SurfaceSize`; `DrawerSize` is the same type).
|
|
3715
|
+
*/
|
|
3716
|
+
export declare type DialogSize = SurfaceSize;
|
|
3717
|
+
|
|
3607
3718
|
/**
|
|
3608
3719
|
* 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
|
-
*
|
|
3720
|
+
* inside `Dialog.Content` (instead of the `title` prop). Like the `title` heading, its end padding
|
|
3721
|
+
* follows the width of the dialog's title-actions area (2rem until it is measured), so a long first
|
|
3722
|
+
* line stays clear of the title actions and the Close button; a `className` padding wins. Its
|
|
3723
|
+
* `action` renders in that area, before the Close button, and never inside the heading.
|
|
3611
3724
|
*/
|
|
3612
3725
|
export declare const DialogTitle: {
|
|
3613
|
-
({ id, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3726
|
+
({ id, action, className, children, ref, ...rest }: DialogTitleProps): React_2.JSX.Element;
|
|
3614
3727
|
displayName: string;
|
|
3615
3728
|
};
|
|
3616
3729
|
|
|
3617
|
-
/** Dialog.Title: `root` on the `<h2
|
|
3730
|
+
/** Dialog.Title: `root` on the `<h2>`; `action` on the element of its `action` slot. */
|
|
3618
3731
|
export declare const dialogTitleClassNames: {
|
|
3619
3732
|
readonly root: "wave-dialog-title";
|
|
3733
|
+
readonly action: "wave-dialog-title__action";
|
|
3620
3734
|
};
|
|
3621
3735
|
|
|
3622
3736
|
/** Properties for the DialogTitle sub-component. */
|
|
3623
3737
|
export declare interface DialogTitleProps extends React_2.HTMLAttributes<HTMLHeadingElement> {
|
|
3624
3738
|
/** The title; any content. */
|
|
3625
3739
|
children: React_2.ReactNode;
|
|
3740
|
+
/**
|
|
3741
|
+
* Header buttons for this title, placed before the built-in Close button in the dialog's top end
|
|
3742
|
+
* corner (after `Dialog.Content`'s `titleAction`), not inside the heading, so they never become
|
|
3743
|
+
* part of the dialog's name. Outside `Dialog.Content` (in a Drawer) they render right after the
|
|
3744
|
+
* heading. Interactive: name icon-only buttons. Renders nothing when empty. Fluent's
|
|
3745
|
+
* `DialogTitle` `action`; unlike Fluent's, it is never filled by default (the Close button is
|
|
3746
|
+
* the Content's).
|
|
3747
|
+
*/
|
|
3748
|
+
action?: Slot<'span'>;
|
|
3626
3749
|
/** Ref to the heading element. */
|
|
3627
3750
|
ref?: React_2.Ref<HTMLHeadingElement>;
|
|
3628
3751
|
}
|
|
3629
3752
|
|
|
3630
3753
|
/**
|
|
3631
|
-
* Opens the dialog
|
|
3632
|
-
*
|
|
3633
|
-
*
|
|
3634
|
-
*
|
|
3635
|
-
* `
|
|
3636
|
-
*
|
|
3637
|
-
*
|
|
3638
|
-
*
|
|
3639
|
-
*
|
|
3754
|
+
* Opens and closes the dialog: a click while it is open asks it to close (reason `trigger`). Only a
|
|
3755
|
+
* non-modal dialog's trigger, or a trigger rendered inside the dialog's own content, can receive
|
|
3756
|
+
* one (a modal dialog makes the page inert). Fluent's `DialogTrigger` never toggles (outside the
|
|
3757
|
+
* surface it only opens, inside it only closes); this trigger always does. Puts
|
|
3758
|
+
* `aria-haspopup="dialog"`, `aria-expanded`, `aria-controls` (while open), a click handler and a
|
|
3759
|
+
* ref on its single child (no wrapper element), or passes them to a render-prop child. A custom
|
|
3760
|
+
* child component must forward `ref` and spread its props; one that does not is wrapped in a
|
|
3761
|
+
* `<span>` automatically (with a development warning), the span that `asChild={false}` renders.
|
|
3762
|
+
* Focus returns to the trigger when the dialog closes (with several triggers, to the one that
|
|
3763
|
+
* opened it). On the span, the state ARIA goes to the first element in the tab order inside it,
|
|
3764
|
+
* and focus returns to that element (to the span when you made it the trigger with a `role` such
|
|
3765
|
+
* as `button` and `tabIndex={0}`, or when nothing inside it can take focus).
|
|
3640
3766
|
*/
|
|
3641
3767
|
export declare const DialogTrigger: {
|
|
3642
3768
|
(props: DialogTriggerProps): React_2.ReactNode;
|
|
@@ -3646,8 +3772,9 @@ export declare const DialogTrigger: {
|
|
|
3646
3772
|
/** Properties for the DialogTrigger sub-component. */
|
|
3647
3773
|
export declare interface DialogTriggerProps extends Omit<React_2.HTMLAttributes<HTMLElement>, 'children'> {
|
|
3648
3774
|
/**
|
|
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
|
|
3775
|
+
* The element that opens and closes the dialog. A single element receives the trigger props
|
|
3776
|
+
* (merged with its own: handlers composed, classes joined, its own `id` kept); a function
|
|
3777
|
+
* receives them.
|
|
3651
3778
|
*/
|
|
3652
3779
|
children: React_2.ReactNode | ((props: DialogTriggerRenderProps) => React_2.ReactNode);
|
|
3653
3780
|
/**
|
|
@@ -3728,62 +3855,175 @@ export declare interface DividerOwnProps {
|
|
|
3728
3855
|
export declare type DividerProps<C extends React_2.ElementType = 'hr'> = PolymorphicProps<C, DividerOwnProps>;
|
|
3729
3856
|
|
|
3730
3857
|
/**
|
|
3731
|
-
* A
|
|
3732
|
-
* (inheriting the WaveProvider theme) while open
|
|
3858
|
+
* A side or bottom panel (Fluent UI v2 style): by default an overlay, modal unless it is
|
|
3859
|
+
* non-modal, rendered in a portal (inheriting the WaveProvider theme) while open; with
|
|
3860
|
+
* `type="inline"` a panel in the page layout, rendered in place. With `unmountOnClose={false}`
|
|
3861
|
+
* either kind stays mounted while closed, `hidden` and `inert`.
|
|
3733
3862
|
*
|
|
3734
3863
|
* - **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)
|
|
3864
|
+
* the Drawer or in a Fragment there (it renders in place, outside the panel); the trigger opens
|
|
3865
|
+
* and closes it.
|
|
3736
3866
|
* - **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.
|
|
3867
|
+
* page is `inert` (instead of `aria-modal`), and the page does not scroll. `modalType="alert"`
|
|
3868
|
+
* renders `role="alertdialog"`, and a backdrop press does not close it.
|
|
3869
|
+
* - **Non-modal**: `modalType="non-modal"` leaves the page usable (no backdrop, no focus trap,
|
|
3870
|
+
* nothing inert, the page scrolls). Focus moves in on open; Tab and Shift+Tab leave the panel in
|
|
3871
|
+
* the page's order right after the element that opened it; Escape closes it only while focus is
|
|
3872
|
+
* inside it; presses on the page never close it; focus returns to the opener only from inside.
|
|
3873
|
+
* Reserve the panel's room in the page layout while it is open, so it hides no page control.
|
|
3874
|
+
* - **Inline**: `type="inline"` renders the panel where the Drawer is, after its direct triggers,
|
|
3875
|
+
* as an `<aside>` (a complementary landmark named by its title), also in the server HTML. It is
|
|
3876
|
+
* page content: no portal, backdrop, focus trap, inert page or scroll lock, and toasts keep
|
|
3877
|
+
* their corner next to it. Its trigger toggles it (with `aria-expanded` and `aria-controls`, no
|
|
3878
|
+
* `aria-haspopup`); opening it moves no focus; Escape and presses outside never close it;
|
|
3879
|
+
* closing it returns focus only when focus was inside. `position` picks its inner edge and
|
|
3880
|
+
* `size` its width (its height at the bottom); `separator` draws the inner edge. Place it in
|
|
3881
|
+
* your layout, for example a flex row of the panel and the page content. Changing `type`
|
|
3882
|
+
* remounts the panel and its content.
|
|
3738
3883
|
* - **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
|
|
3884
|
+
* backdrop (a drag that starts inside does not close it), the Close button and `Drawer.Close`
|
|
3885
|
+
* (an inline drawer: the trigger, the Close button and `Drawer.Close`).
|
|
3740
3886
|
* `onOpenChange` gets the reason as its second argument (`details.reason`), so a controlled
|
|
3741
3887
|
* drawer can refuse some of them. A backdrop press blurs the focused field before the drawer
|
|
3742
3888
|
* closes, so a typed value is committed as with the Close button; when a controlled drawer
|
|
3743
3889
|
* refuses the press, the field gets focus back. Focus returns to the first of these that can
|
|
3744
3890
|
* take focus: `finalFocusRef`, the element that had focus when the drawer opened, the trigger,
|
|
3745
3891
|
* an element next to where that opener was.
|
|
3746
|
-
* - **
|
|
3892
|
+
* - **Size and position**: `position` is `end` (default) or `start`, which follow the text
|
|
3893
|
+
* direction, `left` or `right`, or `bottom` (along the bottom edge, the window wide). `size` sets
|
|
3894
|
+
* the width at a side and the height at the bottom: `small` (default, 320px), `medium` (592px),
|
|
3895
|
+
* `large` (940px) or `full`; the panel never grows past the window (an inline one past its
|
|
3896
|
+
* container). A width class in `className` (a height class for `bottom`) replaces the size. An
|
|
3897
|
+
* overlay panel pads the safe-area insets of the screen edges it touches (the iOS home
|
|
3898
|
+
* indicator, once the page sets `viewport-fit=cover`). Both render as `data-position` and
|
|
3899
|
+
* `data-size`, next to `data-type`.
|
|
3900
|
+
* - **Layout**: the `title` prop and the built-in Close button make the header row; a
|
|
3901
|
+
* `Drawer.Header` replaces it, with a `Drawer.HeaderNavigation` row (a Back button, commands)
|
|
3902
|
+
* and a `Drawer.HeaderTitle` (the heading, an `action` area and the Close button). The rest of
|
|
3903
|
+
* the content scrolls in the body (`Drawer.Body` gives it your props); a `Drawer.Footer` is an
|
|
3904
|
+
* action row below the body that never scrolls. Make the parts direct children of the Drawer (a
|
|
3905
|
+
* Fragment there is fine). The header draws a line under itself once the body is scrolled, the
|
|
3906
|
+
* footer one above itself while content continues below: the body, the header and the footer
|
|
3907
|
+
* render the body's scroll state as `data-scroll-state` (`none`, `top`, `middle`, `bottom`).
|
|
3908
|
+
* - **Backdrop, Close button and title actions**: the backdrop is the panel's sibling and a slot
|
|
3909
|
+
* (`backdrop`: `null` removes it, `appearance` picks `dimmed` or `transparent`); a modal opened
|
|
3910
|
+
* over another modal dims the page once. `closeButton` sets the content of every built-in Close
|
|
3911
|
+
* button, or hides them (`null`); a button passed there is merged into it. `titleAction` places
|
|
3912
|
+
* header buttons between the `title` heading and the Close button.
|
|
3913
|
+
* - **Kept mounted**: `unmountOnClose={false}` keeps the panel and its content mounted while the
|
|
3914
|
+
* drawer is closed, so a form keeps what was typed and the components inside keep their state;
|
|
3915
|
+
* each open of an overlay focuses the first focusable element again (an `autoFocus` inside never
|
|
3916
|
+
* applies), and a kept overlay opened while another overlay is open stacks above it. A kept
|
|
3917
|
+
* inline drawer is in the server HTML, hidden.
|
|
3918
|
+
* - **Presence**: the panel and the backdrop mount through the presence core and render
|
|
3919
|
+
* `data-presence` (`entered` while open, `exited` while kept closed); the backdrop and the
|
|
3920
|
+
* panel (an inline drawer's `<aside>`) are `inert` while exiting and `hidden` and `inert` while
|
|
3921
|
+
* kept closed. No motion ships:
|
|
3922
|
+
* `data-[presence=…]:` classes in `className` animate the panel, whose motion a closed drawer
|
|
3923
|
+
* waits for before it unmounts or hides (focus, the trap and the isolation follow the open
|
|
3924
|
+
* state at once).
|
|
3747
3925
|
*
|
|
3748
3926
|
* The sub-components are also exported under flat names (`DrawerTrigger`, `DrawerClose`,
|
|
3749
|
-
* `DrawerTitle`
|
|
3927
|
+
* `DrawerTitle`, `DrawerHeader`, `DrawerHeaderTitle`, `DrawerHeaderNavigation`, `DrawerBody`,
|
|
3928
|
+
* `DrawerFooter`) for React Server Components, which cannot use the dotted form; dotted access
|
|
3750
3929
|
* (`Drawer.Trigger`) needs a client file.
|
|
3751
3930
|
*
|
|
3752
3931
|
* @example
|
|
3753
|
-
* <Drawer
|
|
3932
|
+
* <Drawer>
|
|
3754
3933
|
* <Drawer.Trigger><Button>Filters</Button></Drawer.Trigger>
|
|
3755
|
-
* <
|
|
3756
|
-
*
|
|
3934
|
+
* <Drawer.Header>
|
|
3935
|
+
* <Drawer.HeaderTitle>Filters</Drawer.HeaderTitle>
|
|
3936
|
+
* </Drawer.Header>
|
|
3937
|
+
* <FilterForm id="filters" />
|
|
3938
|
+
* <Drawer.Footer>
|
|
3939
|
+
* <Button appearance="primary" type="submit" form="filters">Apply</Button>
|
|
3940
|
+
* <Drawer.Close><Button>Cancel</Button></Drawer.Close>
|
|
3941
|
+
* </Drawer.Footer>
|
|
3757
3942
|
* </Drawer>
|
|
3758
3943
|
*/
|
|
3759
3944
|
export declare const Drawer: {
|
|
3760
|
-
({ open: openProp, defaultOpen, onOpenChange, position, title, closeLabel, finalFocusRef,
|
|
3945
|
+
({ open: openProp, defaultOpen, onOpenChange, type, separator, position, size, modalType, backdrop, closeButton, titleAction, title, closeLabel, finalFocusRef, unmountOnClose, children, id, ref, ...rest }: DrawerProps): JSX.Element;
|
|
3761
3946
|
displayName: string;
|
|
3762
3947
|
} & {
|
|
3763
3948
|
Trigger: {
|
|
3764
|
-
(props: DrawerTriggerProps):
|
|
3949
|
+
(props: DrawerTriggerProps): ReactNode;
|
|
3765
3950
|
displayName: string;
|
|
3766
3951
|
};
|
|
3767
3952
|
Close: {
|
|
3768
|
-
(props: DrawerCloseProps):
|
|
3953
|
+
(props: DrawerCloseProps): ReactNode;
|
|
3769
3954
|
displayName: string;
|
|
3770
3955
|
};
|
|
3771
3956
|
Title: {
|
|
3772
|
-
({ id, className, children, ref, ...rest }: DrawerTitleProps):
|
|
3957
|
+
({ id, headingLevel, className, children, ref, ...rest }: DrawerTitleProps): JSX.Element;
|
|
3958
|
+
displayName: string;
|
|
3959
|
+
};
|
|
3960
|
+
Header: {
|
|
3961
|
+
({ className, children, ref, ...rest }: DrawerHeaderProps): JSX.Element | null;
|
|
3962
|
+
displayName: string;
|
|
3963
|
+
};
|
|
3964
|
+
HeaderTitle: {
|
|
3965
|
+
({ id, headingLevel, action, className, children, ref, ...rest }: DrawerHeaderTitleProps): JSX.Element;
|
|
3966
|
+
displayName: string;
|
|
3967
|
+
};
|
|
3968
|
+
HeaderNavigation: {
|
|
3969
|
+
({ className, children, ref, ...rest }: DrawerHeaderNavigationProps): JSX.Element;
|
|
3773
3970
|
displayName: string;
|
|
3774
3971
|
};
|
|
3972
|
+
Body: {
|
|
3973
|
+
({ className, children, ref, ...rest }: DrawerBodyProps): JSX.Element;
|
|
3974
|
+
displayName: string;
|
|
3975
|
+
};
|
|
3976
|
+
Footer: {
|
|
3977
|
+
({ className, children, ref, ...rest }: DrawerFooterProps): JSX.Element | null;
|
|
3978
|
+
displayName: string;
|
|
3979
|
+
};
|
|
3980
|
+
};
|
|
3981
|
+
|
|
3982
|
+
/**
|
|
3983
|
+
* Optional: gives the drawer's scrolling body your props (`className`, `style`, `ref`, `id`,
|
|
3984
|
+
* `role`, `tabIndex`, `aria-*`, `data-*`, handlers), for example `tabIndex={0} role="region"
|
|
3985
|
+
* aria-label="…"` to let the keyboard scroll a body without focusable content (the body then
|
|
3986
|
+
* shows the focus ring inside its edge). Its children render in its place among the drawer's
|
|
3987
|
+
* other content. Make it a direct child of `Drawer` (a Fragment there is fine) and render one;
|
|
3988
|
+
* nested in an element or rendered by a component of yours it renders as an element inside the
|
|
3989
|
+
* body, with a development warning. Fluent's `DrawerBody`.
|
|
3990
|
+
*/
|
|
3991
|
+
export declare const DrawerBody: {
|
|
3992
|
+
({ className, children, ref, ...rest }: DrawerBodyProps): React_2.JSX.Element;
|
|
3993
|
+
displayName: string;
|
|
3994
|
+
};
|
|
3995
|
+
|
|
3996
|
+
/**
|
|
3997
|
+
* Drawer.Body: `root` on the scrolling body while a Drawer.Body gives it its props (the body also
|
|
3998
|
+
* carries Drawer's `body`), or on the element of a Drawer.Body rendered inside the body.
|
|
3999
|
+
*/
|
|
4000
|
+
export declare const drawerBodyClassNames: {
|
|
4001
|
+
readonly root: "wave-drawer-body";
|
|
3775
4002
|
};
|
|
3776
4003
|
|
|
4004
|
+
/** Properties for the DrawerBody sub-component. */
|
|
4005
|
+
export declare interface DrawerBodyProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4006
|
+
/** Content of the scrolling body, rendered in the Body's place among the other content. */
|
|
4007
|
+
children?: React_2.ReactNode;
|
|
4008
|
+
/** Ref to the scrolling body element. */
|
|
4009
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4010
|
+
}
|
|
4011
|
+
|
|
3777
4012
|
/**
|
|
3778
|
-
* Drawer: `root` on the
|
|
3779
|
-
*
|
|
3780
|
-
*
|
|
3781
|
-
*
|
|
4013
|
+
* Drawer: `root` on the panel (the portaled `role="dialog"` element of an overlay drawer, while it
|
|
4014
|
+
* is open or kept mounted, or the `<aside>` of an inline one); `backdrop` on the backdrop of a
|
|
4015
|
+
* modal or alert overlay drawer; `header` on the built-in header row (absent with a
|
|
4016
|
+
* Drawer.Header); `titleAction` on the element of the `titleAction` slot in that row;
|
|
4017
|
+
* `closeButton` on every built-in Close button (which also carries Button's root), in the built-in
|
|
4018
|
+
* header and in each Drawer.HeaderTitle; `body` on the scrolling body. The heading of its `title`
|
|
4019
|
+
* prop carries Drawer.Title's class. The panel carries `data-type`, `data-position` and
|
|
4020
|
+
* `data-size`; the body, the header and the footer carry `data-scroll-state`.
|
|
3782
4021
|
*/
|
|
3783
4022
|
export declare const drawerClassNames: {
|
|
3784
4023
|
readonly root: "wave-drawer";
|
|
3785
4024
|
readonly backdrop: "wave-drawer__backdrop";
|
|
3786
4025
|
readonly header: "wave-drawer__header";
|
|
4026
|
+
readonly titleAction: "wave-drawer__title-action";
|
|
3787
4027
|
readonly closeButton: "wave-drawer__close-button";
|
|
3788
4028
|
readonly body: "wave-drawer__body";
|
|
3789
4029
|
};
|
|
@@ -3818,11 +4058,144 @@ export declare interface DrawerCloseRenderProps extends React_2.HTMLAttributes<H
|
|
|
3818
4058
|
ref: React_2.RefCallback<HTMLElement>;
|
|
3819
4059
|
}
|
|
3820
4060
|
|
|
3821
|
-
/**
|
|
4061
|
+
/**
|
|
4062
|
+
* The drawer's action row, below the scrolling body: it never scrolls and never covers a focused
|
|
4063
|
+
* field. Its actions start at the inline start and wrap. Make it a direct child of `Drawer` (a
|
|
4064
|
+
* Fragment there is fine): it renders after the body wherever it is written; nested in an element
|
|
4065
|
+
* (a `<form>`) or rendered by a component of yours it renders where it is, in the body, with a
|
|
4066
|
+
* development warning. For a form in the body, give the footer's submit button `form={formId}`.
|
|
4067
|
+
* It draws a line above itself while content continues below (`data-scroll-state`). A footer
|
|
4068
|
+
* whose children render nothing renders no element. Fluent's `DrawerFooter`.
|
|
4069
|
+
*/
|
|
4070
|
+
export declare const DrawerFooter: {
|
|
4071
|
+
({ className, children, ref, ...rest }: DrawerFooterProps): React_2.JSX.Element | null;
|
|
4072
|
+
displayName: string;
|
|
4073
|
+
};
|
|
4074
|
+
|
|
4075
|
+
/** Drawer.Footer: `root` on the footer element. */
|
|
4076
|
+
export declare const drawerFooterClassNames: {
|
|
4077
|
+
readonly root: "wave-drawer-footer";
|
|
4078
|
+
};
|
|
4079
|
+
|
|
4080
|
+
/** Properties for the DrawerFooter sub-component. */
|
|
4081
|
+
export declare interface DrawerFooterProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4082
|
+
/** The drawer's actions, typically buttons (wrap closing ones in `Drawer.Close`). */
|
|
4083
|
+
children?: React_2.ReactNode;
|
|
4084
|
+
/** Ref to the footer element. */
|
|
4085
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
/**
|
|
4089
|
+
* The drawer's header, replacing the built-in one (the `title` and Close button row): a
|
|
4090
|
+
* `Drawer.HeaderNavigation` row and a `Drawer.HeaderTitle`, or your own content. The built-in
|
|
4091
|
+
* Close button ends each `Drawer.HeaderTitle`; a header without one has no Close button (wrap your
|
|
4092
|
+
* own in `Drawer.Close`). Make it a direct child of `Drawer` (a Fragment there is fine); nested in
|
|
4093
|
+
* an element or rendered by a component of yours it renders in the body, with a development
|
|
4094
|
+
* warning. It draws a line under itself while the body is scrolled away from its top
|
|
4095
|
+
* (`data-scroll-state`). When an overlay drawer opens, focus goes to the header's first focusable
|
|
4096
|
+
* element (a Back button, a title action): give the control that should start `autoFocus`. A
|
|
4097
|
+
* header whose children render nothing renders no element (the drawer then has no header; Escape
|
|
4098
|
+
* and the backdrop of an overlay, and `Drawer.Close`, still close it). Fluent's `DrawerHeader`.
|
|
4099
|
+
*/
|
|
4100
|
+
export declare const DrawerHeader: {
|
|
4101
|
+
({ className, children, ref, ...rest }: DrawerHeaderProps): React_2.JSX.Element | null;
|
|
4102
|
+
displayName: string;
|
|
4103
|
+
};
|
|
4104
|
+
|
|
4105
|
+
/** Drawer.Header: `root` on the header element (it replaces the built-in header row). */
|
|
4106
|
+
export declare const drawerHeaderClassNames: {
|
|
4107
|
+
readonly root: "wave-drawer-header";
|
|
4108
|
+
};
|
|
4109
|
+
|
|
4110
|
+
/**
|
|
4111
|
+
* A `<nav>` row at the top of `Drawer.Header`, for a multi-level drawer's Back button and the
|
|
4112
|
+
* drawer's commands. Give it an `aria-label` when the page has other navigation landmarks.
|
|
4113
|
+
* Fluent's `DrawerHeaderNavigation`.
|
|
4114
|
+
*/
|
|
4115
|
+
export declare const DrawerHeaderNavigation: {
|
|
4116
|
+
({ className, children, ref, ...rest }: DrawerHeaderNavigationProps): React_2.JSX.Element;
|
|
4117
|
+
displayName: string;
|
|
4118
|
+
};
|
|
4119
|
+
|
|
4120
|
+
/** Drawer.HeaderNavigation: `root` on the navigation element. */
|
|
4121
|
+
export declare const drawerHeaderNavigationClassNames: {
|
|
4122
|
+
readonly root: "wave-drawer-header-navigation";
|
|
4123
|
+
};
|
|
4124
|
+
|
|
4125
|
+
/** Properties for the DrawerHeaderNavigation sub-component. */
|
|
4126
|
+
export declare interface DrawerHeaderNavigationProps extends React_2.HTMLAttributes<HTMLElement> {
|
|
4127
|
+
/** The navigation controls: a Back button, a Toolbar of commands. */
|
|
4128
|
+
children?: React_2.ReactNode;
|
|
4129
|
+
/** Ref to the `<nav>` element. */
|
|
4130
|
+
ref?: React_2.Ref<HTMLElement>;
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
/** Properties for the DrawerHeader sub-component. */
|
|
4134
|
+
export declare interface DrawerHeaderProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4135
|
+
/** `Drawer.HeaderNavigation`, `Drawer.HeaderTitle`, or any content, in the order written. */
|
|
4136
|
+
children?: React_2.ReactNode;
|
|
4137
|
+
/** Ref to the header element. */
|
|
4138
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4139
|
+
}
|
|
4140
|
+
|
|
4141
|
+
/**
|
|
4142
|
+
* A title row for `Drawer.Header`: the heading that names the drawer, your `action` content and
|
|
4143
|
+
* the built-in Close button (named by the Drawer's `closeLabel`; the Drawer's `closeButton` sets
|
|
4144
|
+
* its content, or hides it with `null`), in that DOM and Tab order.
|
|
4145
|
+
* Render one per header; `headingLevel` picks the heading element (`h2` by default). Outside a
|
|
4146
|
+
* `Drawer.Header` it renders without the Close button and warns: use `Drawer.Title` for a heading
|
|
4147
|
+
* in the body. Unlike Fluent's `DrawerHeaderTitle`, whose `action` is where you put a close
|
|
4148
|
+
* button, it renders the Close button itself.
|
|
4149
|
+
*/
|
|
4150
|
+
export declare const DrawerHeaderTitle: {
|
|
4151
|
+
({ id, headingLevel, action, className, children, ref, ...rest }: DrawerHeaderTitleProps): React_2.JSX.Element;
|
|
4152
|
+
displayName: string;
|
|
4153
|
+
};
|
|
4154
|
+
|
|
4155
|
+
/**
|
|
4156
|
+
* Drawer.HeaderTitle: `root` on the title row; `heading` on the heading that names the drawer;
|
|
4157
|
+
* `action` on the element of the `action` slot. Its Close button carries Drawer's `closeButton`.
|
|
4158
|
+
*/
|
|
4159
|
+
export declare const drawerHeaderTitleClassNames: {
|
|
4160
|
+
readonly root: "wave-drawer-header-title";
|
|
4161
|
+
readonly heading: "wave-drawer-header-title__heading";
|
|
4162
|
+
readonly action: "wave-drawer-header-title__action";
|
|
4163
|
+
};
|
|
4164
|
+
|
|
4165
|
+
/** Properties for the DrawerHeaderTitle sub-component. */
|
|
4166
|
+
export declare interface DrawerHeaderTitleProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
4167
|
+
/** The title; any content. The heading names the drawer (`aria-labelledby`). */
|
|
4168
|
+
children: React_2.ReactNode;
|
|
4169
|
+
/**
|
|
4170
|
+
* Content between the heading and the built-in Close button, such as icon buttons for the
|
|
4171
|
+
* drawer's own commands (Fluent's `action`). It comes before the Close button in DOM and Tab
|
|
4172
|
+
* order and is interactive (not `aria-hidden`): name icon-only buttons. Renders nothing when it
|
|
4173
|
+
* renders no content.
|
|
4174
|
+
*/
|
|
4175
|
+
action?: Slot<'span'>;
|
|
4176
|
+
/** Id of the heading element, the element that names the drawer. @default a generated id */
|
|
4177
|
+
id?: string;
|
|
4178
|
+
/**
|
|
4179
|
+
* Level of the heading element (`h1` … `h6`). Fluent's `heading` slot, which also takes another
|
|
4180
|
+
* element.
|
|
4181
|
+
* @default 2
|
|
4182
|
+
*/
|
|
4183
|
+
headingLevel?: HeadingLevel;
|
|
4184
|
+
/** Ref to the title row (the heading's parent). */
|
|
4185
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
/**
|
|
4189
|
+
* How a `Drawer` relates to the page: `modal`, `alert` or `non-modal` (the shared `ModalType`;
|
|
4190
|
+
* `DialogModalType` is the same type).
|
|
4191
|
+
*/
|
|
4192
|
+
export declare type DrawerModalType = ModalType;
|
|
4193
|
+
|
|
4194
|
+
/** The second argument of a `Drawer`'s `onOpenChange`: the reason and the DOM event. */
|
|
3822
4195
|
export declare type DrawerOpenChangeDetails = OpenChangeDetails<DrawerOpenChangeReason>;
|
|
3823
4196
|
|
|
3824
4197
|
/**
|
|
3825
|
-
* Why a
|
|
4198
|
+
* Why a `Drawer` asks to open or close: `trigger` (`Drawer.Trigger`), `close`
|
|
3826
4199
|
* (`Drawer.Close`), `close-button` (the built-in Close button), `escape`, `outside-press` (the
|
|
3827
4200
|
* backdrop). The shared `ModalOpenChangeReason`, as for Dialog.
|
|
3828
4201
|
*/
|
|
@@ -3830,20 +4203,23 @@ export declare type DrawerOpenChangeReason = ModalOpenChangeReason;
|
|
|
3830
4203
|
|
|
3831
4204
|
/**
|
|
3832
4205
|
* 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
|
|
4206
|
+
* right-to-left layout `end` is the left edge); `left`/`right` are physical sides; `bottom` runs
|
|
4207
|
+
* along the bottom edge, as wide as the viewport. An inline drawer sits where the page layout puts
|
|
4208
|
+
* it: the position picks its inner edge (the one facing the page content) and its size's axis.
|
|
3834
4209
|
*/
|
|
3835
|
-
export declare type DrawerPosition = 'start' | 'end' | 'left' | 'right';
|
|
4210
|
+
export declare type DrawerPosition = 'start' | 'end' | 'left' | 'right' | 'bottom';
|
|
3836
4211
|
|
|
3837
4212
|
/** Properties for the Drawer component. */
|
|
3838
|
-
export declare interface DrawerProps extends Omit<React_2.HTMLAttributes<
|
|
4213
|
+
export declare interface DrawerProps extends Omit<React_2.HTMLAttributes<HTMLElement>, 'title'> {
|
|
3839
4214
|
/**
|
|
3840
|
-
* Controlled open state of the drawer.
|
|
3841
|
-
* is closed in the server HTML and opens once it has hydrated.
|
|
4215
|
+
* Controlled open state of the drawer. An overlay drawer's panel renders only in the browser:
|
|
4216
|
+
* open, it is closed in the server HTML and opens once it has hydrated. An inline drawer renders
|
|
4217
|
+
* in the server HTML: open, or hidden when kept mounted (`unmountOnClose={false}`).
|
|
3842
4218
|
*/
|
|
3843
4219
|
open?: boolean;
|
|
3844
4220
|
/**
|
|
3845
|
-
* Default open state for uncontrolled usage.
|
|
3846
|
-
*
|
|
4221
|
+
* Default open state for uncontrolled usage. An overlay drawer open by default is closed in the
|
|
4222
|
+
* server HTML and opens once it has hydrated; an inline one is open in the server HTML.
|
|
3847
4223
|
* @default false
|
|
3848
4224
|
*/
|
|
3849
4225
|
defaultOpen?: boolean;
|
|
@@ -3853,61 +4229,193 @@ export declare interface DrawerProps extends Omit<React_2.HTMLAttributes<HTMLDiv
|
|
|
3853
4229
|
* `outside-press` (the backdrop) — so a controlled drawer can refuse only some ways of closing
|
|
3854
4230
|
* (for example keep a form with unsaved changes open on `outside-press`); `details.event` is the
|
|
3855
4231
|
* 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.
|
|
4232
|
+
* so that code which calls this prop itself keeps compiling. An inline drawer asks only with
|
|
4233
|
+
* `trigger` (its `Drawer.Trigger` toggles it), `close` and `close-button`: Escape and presses
|
|
4234
|
+
* outside it never close it.
|
|
3857
4235
|
*
|
|
3858
4236
|
* Fires only when the value changes; a controlled drawer stays as it is until the parent updates
|
|
3859
4237
|
* `open`.
|
|
3860
4238
|
*/
|
|
3861
4239
|
onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;
|
|
4240
|
+
/**
|
|
4241
|
+
* How the drawer sits on the page (Fluent's `type`).
|
|
4242
|
+
* - `overlay`: a panel over the page, rendered in a portal while open: modal by default (focus
|
|
4243
|
+
* moves in and stays there, toasts included; the rest of the page is `inert` and does not
|
|
4244
|
+
* scroll; Escape and a backdrop press close it), or `modalType="non-modal"`.
|
|
4245
|
+
* - `inline`: a panel in the page layout, rendered where the Drawer is (after its direct
|
|
4246
|
+
* `Drawer.Trigger`s) as an `<aside>`, a complementary landmark named by its title. The page
|
|
4247
|
+
* stays usable around it: no backdrop, no focus trap, no portal, no scroll lock; Escape and
|
|
4248
|
+
* presses outside do not close it. Opening it leaves focus where it is; closing it while focus
|
|
4249
|
+
* is inside returns focus to `finalFocusRef`, else the element that opened it, else the
|
|
4250
|
+
* trigger. `position` and `size` pick its inner edge and its width (its height at the bottom);
|
|
4251
|
+
* where it sits is up to your layout (a flex row of panel and content, for example).
|
|
4252
|
+
* `modalType` and `backdrop` do not apply to it, and toasts do not move out of its way: it is
|
|
4253
|
+
* page content.
|
|
4254
|
+
*
|
|
4255
|
+
* Changing `type` remounts the panel and its content (what was typed in it is lost); focus
|
|
4256
|
+
* inside an overlay that becomes inline returns to the trigger, and focus inside an inline panel
|
|
4257
|
+
* that becomes an overlay moves into the overlay. Rendered as `data-type`.
|
|
4258
|
+
* @default 'overlay'
|
|
4259
|
+
*/
|
|
4260
|
+
type?: DrawerType;
|
|
4261
|
+
/**
|
|
4262
|
+
* Inline drawers: draws a line on the panel's inner edge, the edge facing the page content
|
|
4263
|
+
* (`data-separator`). An overlay drawer always draws that edge and ignores this prop. In forced
|
|
4264
|
+
* colours an inline drawer's inner edge is always drawn. Fluent's `separator`.
|
|
4265
|
+
* @default false
|
|
4266
|
+
*/
|
|
4267
|
+
separator?: boolean;
|
|
3862
4268
|
/**
|
|
3863
4269
|
* Side of the screen the drawer is attached to. `start`/`end` follow the text direction;
|
|
3864
|
-
* `left`/`right` are physical sides
|
|
4270
|
+
* `left`/`right` are physical sides; `bottom` runs along the bottom edge (`size` sets its
|
|
4271
|
+
* height). An inline drawer takes its place from your layout: `position` picks its inner edge
|
|
4272
|
+
* (the one facing the page content: the end edge of a `start` panel, the top edge of a `bottom`
|
|
4273
|
+
* one) and the axis `size` sets. Rendered as `data-position`.
|
|
3865
4274
|
* @default 'end'
|
|
3866
4275
|
*/
|
|
3867
4276
|
position?: DrawerPosition;
|
|
3868
4277
|
/**
|
|
3869
|
-
*
|
|
3870
|
-
*
|
|
3871
|
-
*
|
|
4278
|
+
* The panel's width at a side — `small` 320px, `medium` 592px, `large` 940px, `full` the
|
|
4279
|
+
* viewport's width — or its height at the bottom (the same values; `full` the viewport's height).
|
|
4280
|
+
* It never exceeds the viewport. An inline panel takes the same sizes, where `full` is its
|
|
4281
|
+
* container's width (height), and never grows past its container. A width class in `className`
|
|
4282
|
+
* (a height class for `bottom`) replaces it. Rendered as `data-size`. Fluent's `size`.
|
|
4283
|
+
* @default 'small'
|
|
4284
|
+
*/
|
|
4285
|
+
size?: DrawerSize;
|
|
4286
|
+
/**
|
|
4287
|
+
* `modal`, `alert` or `non-modal`, as Dialog's `modalType`. `modal`: the page behind is `inert`
|
|
4288
|
+
* and does not scroll; a backdrop press, Escape, the Close button and `Drawer.Close` close it.
|
|
4289
|
+
* `alert`: `role="alertdialog"` (a `role` you pass wins), and a backdrop press does not close it
|
|
4290
|
+
* (Escape still does). `non-modal`: no backdrop, and the page stays usable — no focus trap,
|
|
4291
|
+
* nothing inert, the page scrolls; Tab and Shift+Tab leave the drawer in the page's order right
|
|
4292
|
+
* after the element that opened it, Escape closes it while focus is inside it, presses on the
|
|
4293
|
+
* page never close it, and focus returns to the opener only when it was inside the drawer. A
|
|
4294
|
+
* non-modal drawer covers the page under it while Tab still reaches that page: reserve its width
|
|
4295
|
+
* (its height at the bottom) in your layout while it is open, or use `modal`, or, for a panel
|
|
4296
|
+
* beside the content, an inline drawer (`type="inline"`) (with `size="full"` it covers
|
|
4297
|
+
* everything, and a development warning says so). Every type moves focus to the first focusable
|
|
4298
|
+
* element on open. Rendered as `data-modal-type`. Ignored by an inline drawer, which is never
|
|
4299
|
+
* modal and renders no `data-modal-type`. Fluent's `modalType`.
|
|
4300
|
+
* @default 'modal'
|
|
4301
|
+
*/
|
|
4302
|
+
modalType?: DrawerModalType;
|
|
4303
|
+
/**
|
|
4304
|
+
* The backdrop of a modal or alert drawer, as `Dialog.Content`'s `backdrop`: a `div` behind the
|
|
4305
|
+
* panel, `aria-hidden`. Shorthand content renders inside it; a slot object's `className` (merged
|
|
4306
|
+
* last), `style`, data attributes, `ref` and handlers go to it, and its `appearance`
|
|
4307
|
+
* (`'dimmed'` or `'transparent'`) overrides the automatic one: while another modal Dialog or
|
|
4308
|
+
* Drawer is open below this one the backdrop is transparent, so the page is dimmed once. `null`
|
|
4309
|
+
* renders no backdrop (the page stays inert, and a press outside still closes a modal drawer); a
|
|
4310
|
+
* boolean is no slot. Ignored with `modalType="non-modal"` and by an inline drawer (a
|
|
4311
|
+
* development warning says so). Fluent's `backdrop`.
|
|
4312
|
+
*/
|
|
4313
|
+
backdrop?: Slot<'div'> | (SlotObject<'div'> & {
|
|
4314
|
+
appearance?: BackdropAppearance;
|
|
4315
|
+
});
|
|
4316
|
+
/**
|
|
4317
|
+
* Content of the built-in Close button, in the built-in header and in every
|
|
4318
|
+
* `Drawer.HeaderTitle`, as `Dialog.Content`'s `closeButton`: decorative content inside the button
|
|
4319
|
+
* (the dismiss glyph by default), so the button keeps the name `closeLabel`; a slot object's
|
|
4320
|
+
* `aria-label`, `aria-labelledby` or `title` names it instead, and its handlers run before the
|
|
4321
|
+
* close (`preventDefault()` keeps the drawer open). `null` hides them all (`Drawer.Close`, and
|
|
4322
|
+
* Escape on an overlay, still close); a boolean is no slot; content that renders nothing keeps the
|
|
4323
|
+
* default glyph. A `<button>` or Wave `Button` passed here is merged into the built-in button,
|
|
4324
|
+
* never nested (a development warning says so), and its text label names the button. Fluent's
|
|
4325
|
+
* `DrawerHeaderTitle` `action` holds Fluent's close button; WaveUI renders its own.
|
|
4326
|
+
*/
|
|
4327
|
+
closeButton?: Slot<'span'>;
|
|
4328
|
+
/**
|
|
4329
|
+
* Header buttons for the `title` prop form, between the heading and the built-in Close button in
|
|
4330
|
+
* DOM and Tab order. Ignored, with a development warning, next to a `Drawer.Header` (use the
|
|
4331
|
+
* `action` of `Drawer.HeaderTitle`). Interactive: name icon-only buttons. Renders nothing when
|
|
4332
|
+
* empty. Fluent's `DrawerHeaderTitle` `action`, for the `title` prop form.
|
|
4333
|
+
*/
|
|
4334
|
+
titleAction?: Slot<'span'>;
|
|
4335
|
+
/**
|
|
4336
|
+
* Title displayed in the built-in header; it names the drawer (`aria-labelledby`). Without it,
|
|
4337
|
+
* render a `Drawer.HeaderTitle` (in a `Drawer.Header`) or a `Drawer.Title`, or pass
|
|
4338
|
+
* `aria-label`/`aria-labelledby`. A title that renders nothing (`''`, `[]`, `true`) counts as
|
|
4339
|
+
* none. Ignored, with a development warning, when the children hold a `Drawer.Header`, which
|
|
4340
|
+
* replaces the built-in header. The heading is an `<h2>`; for another level use
|
|
4341
|
+
* `Drawer.HeaderTitle` with `headingLevel`. In the server HTML of an inline drawer only `title`
|
|
4342
|
+
* (or `aria-label`/`aria-labelledby`) names the panel: a `Drawer.HeaderTitle` or `Drawer.Title`
|
|
4343
|
+
* names it once the page has hydrated.
|
|
3872
4344
|
*/
|
|
3873
4345
|
title?: React_2.ReactNode;
|
|
3874
4346
|
/**
|
|
3875
|
-
* Accessible name of the built-in Close button (an icon-only button)
|
|
3876
|
-
* page's language.
|
|
4347
|
+
* Accessible name of the built-in Close button (an icon-only button), in the built-in header and
|
|
4348
|
+
* in every `Drawer.HeaderTitle`. Localize it with the page's language. A text label of a button
|
|
4349
|
+
* merged into `closeButton` names it instead.
|
|
3877
4350
|
* @default 'Close'
|
|
3878
4351
|
*/
|
|
3879
4352
|
closeLabel?: string;
|
|
3880
4353
|
/**
|
|
3881
4354
|
* Where focus goes when the drawer closes, if it can take focus. Otherwise focus returns to the
|
|
3882
4355
|
* element that had focus when the drawer opened, then to the trigger, then to an element next to
|
|
3883
|
-
* where that opener was.
|
|
4356
|
+
* where that opener was. An inline or non-modal drawer moves focus on close only when focus was
|
|
4357
|
+
* inside it.
|
|
3884
4358
|
*/
|
|
3885
4359
|
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
3886
4360
|
/**
|
|
3887
|
-
*
|
|
3888
|
-
*
|
|
3889
|
-
*
|
|
3890
|
-
*
|
|
3891
|
-
*
|
|
3892
|
-
*
|
|
3893
|
-
*
|
|
4361
|
+
* Removes the panel and its content when the drawer closes. `false` keeps them mounted while
|
|
4362
|
+
* closed, `hidden` and `inert` (out of the layout, the Tab order and the accessibility tree), so
|
|
4363
|
+
* what was typed and the state of the components inside survive closing and opening again; the
|
|
4364
|
+
* content then mounts with the Drawer, closed, and an `autoFocus` inside it never applies (an
|
|
4365
|
+
* overlay focuses its first focusable element on each open). An overlay panel still renders only
|
|
4366
|
+
* in the browser; a kept inline panel is in the server HTML, hidden. Kept content still belongs
|
|
4367
|
+
* to its form: a `required` empty field in a closed inline drawer inside a page `<form>` blocks
|
|
4368
|
+
* its submission without a visible message. A popup opened inside that is still open when the
|
|
4369
|
+
* drawer closes stays open over the page (a development warning says so): close it first. A
|
|
4370
|
+
* `key` on the Drawer resets the kept content. Fluent's `unmountOnClose`.
|
|
4371
|
+
* @default true
|
|
4372
|
+
*/
|
|
4373
|
+
unmountOnClose?: boolean;
|
|
4374
|
+
/**
|
|
4375
|
+
* The drawer's content, placed by the Drawer, also from a Fragment (`{isMobile && <>…</>}`) and
|
|
4376
|
+
* when written in a Server Component: `Drawer.Trigger` children render in place (outside the
|
|
4377
|
+
* panel); a `Drawer.Header` replaces the built-in header (the `title` and Close button row); a
|
|
4378
|
+
* `Drawer.Body` gives the scrolling body its props; `Drawer.Footer` renders below the scrolling
|
|
4379
|
+
* body, outside it, wherever it is written among the children; everything else renders in the
|
|
4380
|
+
* scrolling body. A part nested in another element (a `<form>`) or rendered by a component of
|
|
4381
|
+
* yours renders where it is, in the body (a development warning says so). A `Drawer.Trigger`
|
|
4382
|
+
* nested in another element, or rendered by a component, is panel content, so it is not rendered
|
|
4383
|
+
* (or, kept mounted, is hidden) while the drawer is closed (development warnings say so, also
|
|
4384
|
+
* when an uncontrolled drawer still has no direct trigger a second after it mounts and therefore
|
|
4385
|
+
* cannot open; a controlled drawer whose trigger a component such as a Tooltip wraps warns only
|
|
4386
|
+
* once it renders in the panel).
|
|
3894
4387
|
* Put wrappers inside the trigger instead: see `Drawer.Trigger`.
|
|
3895
4388
|
*/
|
|
3896
4389
|
children: React_2.ReactNode;
|
|
3897
|
-
/**
|
|
3898
|
-
|
|
4390
|
+
/**
|
|
4391
|
+
* Ref to the panel: the `role="dialog"` element of an overlay drawer (`alertdialog` with
|
|
4392
|
+
* `modalType="alert"`), the `<aside>` of an inline one. A ref to a `div` still type-checks.
|
|
4393
|
+
*/
|
|
4394
|
+
ref?: React_2.Ref<HTMLElement>;
|
|
3899
4395
|
}
|
|
3900
4396
|
|
|
4397
|
+
/**
|
|
4398
|
+
* How much room a Drawer takes: its width at a side, its height at the bottom. `small` 320px,
|
|
4399
|
+
* `medium` 592px, `large` 940px; `full` the viewport (an inline drawer: its container). The shared
|
|
4400
|
+
* `SurfaceSize`.
|
|
4401
|
+
*/
|
|
4402
|
+
export declare type DrawerSize = SurfaceSize;
|
|
4403
|
+
|
|
3901
4404
|
/**
|
|
3902
4405
|
* 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)
|
|
4406
|
+
* inside the Drawer's content (instead of the `title` prop); for the title of a composed header,
|
|
4407
|
+
* use `Drawer.HeaderTitle` in a `Drawer.Header`. `headingLevel` picks the heading element (`h2`
|
|
4408
|
+
* by default).
|
|
3904
4409
|
*/
|
|
3905
4410
|
export declare const DrawerTitle: {
|
|
3906
|
-
({ id, className, children, ref, ...rest }: DrawerTitleProps): React_2.JSX.Element;
|
|
4411
|
+
({ id, headingLevel, className, children, ref, ...rest }: DrawerTitleProps): React_2.JSX.Element;
|
|
3907
4412
|
displayName: string;
|
|
3908
4413
|
};
|
|
3909
4414
|
|
|
3910
|
-
/**
|
|
4415
|
+
/**
|
|
4416
|
+
* Drawer.Title: `root` on its heading (an `<h2>`, or the level `headingLevel` picks); also on the
|
|
4417
|
+
* heading of Drawer's `title` prop.
|
|
4418
|
+
*/
|
|
3911
4419
|
export declare const drawerTitleClassNames: {
|
|
3912
4420
|
readonly root: "wave-drawer-title";
|
|
3913
4421
|
};
|
|
@@ -3916,21 +4424,34 @@ export declare const drawerTitleClassNames: {
|
|
|
3916
4424
|
export declare interface DrawerTitleProps extends React_2.HTMLAttributes<HTMLHeadingElement> {
|
|
3917
4425
|
/** The title; any content. */
|
|
3918
4426
|
children: React_2.ReactNode;
|
|
4427
|
+
/**
|
|
4428
|
+
* Level of the heading element (`h1` … `h6`). Fluent's `heading` slot, which also takes another
|
|
4429
|
+
* element.
|
|
4430
|
+
* @default 2
|
|
4431
|
+
*/
|
|
4432
|
+
headingLevel?: HeadingLevel;
|
|
3919
4433
|
/** Ref to the heading element. */
|
|
3920
4434
|
ref?: React_2.Ref<HTMLHeadingElement>;
|
|
3921
4435
|
}
|
|
3922
4436
|
|
|
3923
4437
|
/**
|
|
3924
|
-
* Opens the drawer
|
|
3925
|
-
*
|
|
3926
|
-
*
|
|
3927
|
-
*
|
|
3928
|
-
*
|
|
3929
|
-
*
|
|
3930
|
-
*
|
|
3931
|
-
*
|
|
3932
|
-
*
|
|
3933
|
-
*
|
|
4438
|
+
* Opens and closes the drawer: a click while it is open asks it to close (reason `trigger`), which
|
|
4439
|
+
* the trigger of a non-modal or inline drawer can receive (a modal one makes the page inert).
|
|
4440
|
+
* Fluent's `DialogTrigger` never toggles (outside the surface it only opens, inside it only
|
|
4441
|
+
* closes); this trigger always does.
|
|
4442
|
+
* Place it directly inside `Drawer`, or in a Fragment there (not inside a wrapper element or a
|
|
4443
|
+
* component of your own): it renders in place, not in the panel (an inline drawer's triggers
|
|
4444
|
+
* render right before its panel, so the panel follows its button in the reading order); a
|
|
4445
|
+
* misplaced one warns in development. A Drawer may have several triggers: focus returns to the one
|
|
4446
|
+
* that opened it. Puts `aria-haspopup="dialog"` (none on an inline drawer's trigger: an inline
|
|
4447
|
+
* panel is page content, not a popup), `aria-expanded`, `aria-controls` (while open), a click
|
|
4448
|
+
* handler and a ref on its single child, or passes them to a render-prop child. A custom child
|
|
4449
|
+
* component must forward `ref` and spread its props; one that does not is wrapped in a `<span>`
|
|
4450
|
+
* automatically (with a development warning), the span that `asChild={false}` renders. Focus
|
|
4451
|
+
* returns to the trigger when the drawer closes (for a non-modal or inline drawer, only when focus
|
|
4452
|
+
* was inside it). On the span, the state ARIA goes to the first element in the tab order inside
|
|
4453
|
+
* it, and focus returns to that element (to the span when you made it the trigger with a `role`
|
|
4454
|
+
* such as `button` and `tabIndex={0}`, or when nothing inside it can take focus).
|
|
3934
4455
|
*
|
|
3935
4456
|
* A Tooltip (or any other wrapper) goes inside the trigger, not around it. Use a render-prop child
|
|
3936
4457
|
* so the trigger props land on the button and the Tooltip describes that same button:
|
|
@@ -3955,8 +4476,8 @@ export declare const DrawerTrigger: {
|
|
|
3955
4476
|
/** Properties for the DrawerTrigger sub-component. */
|
|
3956
4477
|
export declare interface DrawerTriggerProps extends Omit<React_2.HTMLAttributes<HTMLElement>, 'children'> {
|
|
3957
4478
|
/**
|
|
3958
|
-
* The element that opens the drawer. A single element receives the trigger props
|
|
3959
|
-
* own); a function receives them.
|
|
4479
|
+
* The element that opens and closes the drawer. A single element receives the trigger props
|
|
4480
|
+
* (merged with its own); a function receives them.
|
|
3960
4481
|
*/
|
|
3961
4482
|
children: React_2.ReactNode | ((props: DrawerTriggerRenderProps) => React_2.ReactNode);
|
|
3962
4483
|
/**
|
|
@@ -3972,7 +4493,10 @@ export declare interface DrawerTriggerProps extends Omit<React_2.HTMLAttributes<
|
|
|
3972
4493
|
|
|
3973
4494
|
/** Props a `Drawer.Trigger` puts on its element (and passes to a render-prop child). */
|
|
3974
4495
|
export declare interface DrawerTriggerRenderProps extends React_2.HTMLAttributes<HTMLElement> {
|
|
3975
|
-
|
|
4496
|
+
/**
|
|
4497
|
+
* `'dialog'` for an overlay drawer; absent (no key) for an inline drawer, which is not a popup.
|
|
4498
|
+
*/
|
|
4499
|
+
'aria-haspopup'?: 'dialog';
|
|
3976
4500
|
'aria-expanded': boolean;
|
|
3977
4501
|
/** The panel's id, while the drawer is open. */
|
|
3978
4502
|
'aria-controls'?: string;
|
|
@@ -3981,6 +4505,12 @@ export declare interface DrawerTriggerRenderProps extends React_2.HTMLAttributes
|
|
|
3981
4505
|
ref: React_2.RefCallback<HTMLElement>;
|
|
3982
4506
|
}
|
|
3983
4507
|
|
|
4508
|
+
/**
|
|
4509
|
+
* How a Drawer sits on the page: `overlay`, a panel over the page (in a portal), or `inline`, a
|
|
4510
|
+
* panel in the page layout, rendered where the Drawer is. Fluent's `type`.
|
|
4511
|
+
*/
|
|
4512
|
+
export declare type DrawerType = 'overlay' | 'inline';
|
|
4513
|
+
|
|
3984
4514
|
/**
|
|
3985
4515
|
* A select-only combobox (APG): a button that opens a listbox of `Option`s. Enter, Space,
|
|
3986
4516
|
* ArrowDown/ArrowUp, Home/End and typing a character open it and move the highlight
|
|
@@ -4660,6 +5190,12 @@ export declare interface FlexOwnProps {
|
|
|
4660
5190
|
*/
|
|
4661
5191
|
export declare type FlexProps<C extends React_2.ElementType = 'div'> = PolymorphicProps<C, FlexOwnProps>;
|
|
4662
5192
|
|
|
5193
|
+
/**
|
|
5194
|
+
* How the keyboard reaches the items of a set: `'tab'`, every item is a Tab stop and the arrow
|
|
5195
|
+
* keys do nothing; `'arrow'`, the set is one Tab stop and the arrow keys move between its items.
|
|
5196
|
+
*/
|
|
5197
|
+
export declare type FocusMode = 'tab' | 'arrow';
|
|
5198
|
+
|
|
4663
5199
|
/**
|
|
4664
5200
|
* The classes that select a theme's tokens: `'wave-light'`, `'wave-dark dark'` or
|
|
4665
5201
|
* `'wave-high-contrast high-contrast'`. Unknown values fall back to the light classes. Safe to call
|
|
@@ -4737,6 +5273,75 @@ export declare interface GridOwnProps {
|
|
|
4737
5273
|
*/
|
|
4738
5274
|
export declare type GridProps<C extends React_2.ElementType = 'div'> = PolymorphicProps<C, GridOwnProps>;
|
|
4739
5275
|
|
|
5276
|
+
/**
|
|
5277
|
+
* A button that opens and closes a navigation drawer: a `Button` (`subtle`, icon-only) with the
|
|
5278
|
+
* navigation glyph, named "Navigation" by default. Inside a `NavDrawer` (in its header) it toggles
|
|
5279
|
+
* that drawer and reports it with `aria-expanded` and `aria-controls`. Elsewhere (your page
|
|
5280
|
+
* header) it is a plain button: pass `aria-expanded={open}`, `aria-controls` (while the drawer's
|
|
5281
|
+
* panel is rendered) and, for an overlay drawer, `aria-haspopup="dialog"`, and toggle your state
|
|
5282
|
+
* in `onClick`. Fluent's `Hamburger`.
|
|
5283
|
+
*
|
|
5284
|
+
* @example
|
|
5285
|
+
* <Hamburger
|
|
5286
|
+
* aria-expanded={open}
|
|
5287
|
+
* aria-controls={open ? 'main-nav' : undefined}
|
|
5288
|
+
* aria-haspopup="dialog"
|
|
5289
|
+
* onClick={() => setOpen(!open)}
|
|
5290
|
+
* />
|
|
5291
|
+
*/
|
|
5292
|
+
export declare const Hamburger: {
|
|
5293
|
+
({ appearance, size, icon, onClick, className, children, ref, ...rest }: HamburgerProps): React_2.JSX.Element;
|
|
5294
|
+
displayName: string;
|
|
5295
|
+
};
|
|
5296
|
+
|
|
5297
|
+
/**
|
|
5298
|
+
* Hamburger (a Button variant: it also carries Button's root and icon classes): `root` on the
|
|
5299
|
+
* `<button>`; `icon` on the icon span.
|
|
5300
|
+
*/
|
|
5301
|
+
export declare const hamburgerClassNames: {
|
|
5302
|
+
readonly root: "wave-hamburger";
|
|
5303
|
+
readonly icon: "wave-hamburger__icon";
|
|
5304
|
+
};
|
|
5305
|
+
|
|
5306
|
+
/** Properties for the Hamburger component. */
|
|
5307
|
+
export declare interface HamburgerProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5308
|
+
/**
|
|
5309
|
+
* Visual style. Fluent's `transparent` look is WaveUI's `subtle` (WaveUI's `transparent` is
|
|
5310
|
+
* link-coloured).
|
|
5311
|
+
* @default 'subtle'
|
|
5312
|
+
*/
|
|
5313
|
+
appearance?: Appearance;
|
|
5314
|
+
/**
|
|
5315
|
+
* Size: the button's height and the glyph (12, 16, 20, 24 or 28px).
|
|
5316
|
+
* @default 'medium'
|
|
5317
|
+
*/
|
|
5318
|
+
size?: Size;
|
|
5319
|
+
/**
|
|
5320
|
+
* Replaces the navigation glyph (three bars). Decorative (`aria-hidden`). Unlike Button's `icon`,
|
|
5321
|
+
* a Hamburger always shows a glyph: `null`, `undefined` and a value that renders nothing keep
|
|
5322
|
+
* the default (the last warns in development). A `<button>` or `Button` passed here is not
|
|
5323
|
+
* nested: its children become the glyph and its props are dropped, with a warning.
|
|
5324
|
+
*/
|
|
5325
|
+
icon?: Slot<'span'>;
|
|
5326
|
+
/**
|
|
5327
|
+
* The button's name. Without `aria-label`, `aria-labelledby`, `title` or a visible label
|
|
5328
|
+
* (children), the Hamburger is named "Navigation"; localize it here. The name stays the same
|
|
5329
|
+
* while the drawer opens and closes (the state is `aria-expanded`).
|
|
5330
|
+
* @default 'Navigation'
|
|
5331
|
+
*/
|
|
5332
|
+
'aria-label'?: string;
|
|
5333
|
+
/**
|
|
5334
|
+
* Unavailable but focusable (see `Button.disabledFocusable`): no toggle, no `onClick`.
|
|
5335
|
+
* @default false
|
|
5336
|
+
*/
|
|
5337
|
+
disabledFocusable?: boolean;
|
|
5338
|
+
/** Ref to the `<button>`. */
|
|
5339
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
5340
|
+
}
|
|
5341
|
+
|
|
5342
|
+
/** Level of a heading element, `<h1>` … `<h6>`. */
|
|
5343
|
+
export declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5344
|
+
|
|
4740
5345
|
/**
|
|
4741
5346
|
* The HSV color of a hex string: `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa` (surrounding whitespace
|
|
4742
5347
|
* ignored, any case). `a` is set only when the input has alpha digits. Returns `null` for anything
|
|
@@ -5182,6 +5787,200 @@ export declare interface InputProps extends Omit<React_2.InputHTMLAttributes<HTM
|
|
|
5182
5787
|
ref?: React_2.Ref<HTMLInputElement>;
|
|
5183
5788
|
}
|
|
5184
5789
|
|
|
5790
|
+
/**
|
|
5791
|
+
* A tag with a main action and a separate Dismiss button: an element that holds two sibling
|
|
5792
|
+
* buttons, `InteractionTag.Primary` (the action) and `InteractionTag.Secondary` (Dismiss), never
|
|
5793
|
+
* one inside the other. Use it for a chip the user acts on (opens, toggles) and can also remove;
|
|
5794
|
+
* a `Tag` is a chip that only displays, or only dismisses.
|
|
5795
|
+
*
|
|
5796
|
+
* - **Two Tab stops**, the Primary then the Secondary. In a TagGroup toolbar both join its arrow
|
|
5797
|
+
* order (Primary, Secondary, next tag).
|
|
5798
|
+
* - **The Secondary is named after the Primary's text**: its `dismissLabel` plus the primary
|
|
5799
|
+
* text, "Dismiss Cherry" (never the secondary text). A text label in its children replaces
|
|
5800
|
+
* `dismissLabel` ("Remove Cherry"); an `aria-label` replaces the whole name.
|
|
5801
|
+
* - **Delete and Backspace** on either button dismiss the tag through the Secondary's click (a
|
|
5802
|
+
* held key dismisses once); without a Secondary they do nothing. Enter, Space and a click on the
|
|
5803
|
+
* Secondary dismiss too: remove the tag in its `onClick`, or in a TagGroup's `onDismiss(value)`,
|
|
5804
|
+
* which is called after it.
|
|
5805
|
+
* - **In a selecting TagGroup** (`value`, `defaultValue` or `onValueChange` on the group) the
|
|
5806
|
+
* Primary toggles the tag's `value` in the group's selection (`aria-pressed`, the selected
|
|
5807
|
+
* look), and dismissing a selected tag also removes its value from the selection.
|
|
5808
|
+
* - **`selected`**, outside a selecting TagGroup, draws the selected look and makes the Primary a
|
|
5809
|
+
* toggle (`aria-pressed`); leave it `undefined` for an action that is not a toggle.
|
|
5810
|
+
* - **Look**: `size`, `appearance` and `shape`, Tag's sizes and colours (a TagGroup gives its
|
|
5811
|
+
* defaults); `disabled` disables both buttons natively. The Primary takes `media` (an Avatar,
|
|
5812
|
+
* sized for the tag), `icon` and `secondaryText`.
|
|
5813
|
+
* - Fluent's `hasSecondaryAction` is not needed: the Primary squares its end corners next to a
|
|
5814
|
+
* Secondary by itself, also when the Secondary is rendered conditionally or wrapped.
|
|
5815
|
+
* - React Server Components cannot dot into a client module: import the flat names
|
|
5816
|
+
* `InteractionTagPrimary` and `InteractionTagSecondary` there.
|
|
5817
|
+
* - Renders `data-appearance`, `data-size` and `data-shape`, and while set `data-selected` and
|
|
5818
|
+
* `data-disabled`, on the root; `data-selected` on both buttons.
|
|
5819
|
+
*
|
|
5820
|
+
* @example
|
|
5821
|
+
* <InteractionTag value="cherry">
|
|
5822
|
+
* <InteractionTag.Primary icon={<FruitIcon />} onClick={openDetails}>
|
|
5823
|
+
* Cherry
|
|
5824
|
+
* </InteractionTag.Primary>
|
|
5825
|
+
* <InteractionTag.Secondary onClick={() => remove('cherry')} />
|
|
5826
|
+
* </InteractionTag>
|
|
5827
|
+
*/
|
|
5828
|
+
export declare const InteractionTag: {
|
|
5829
|
+
({ value, appearance: appearanceProp, size: sizeProp, shape: shapeProp, disabled: disabledProp, selected: selectedProp, role, hidden, className, children, ref, ...rest }: InteractionTagProps): React_2.JSX.Element;
|
|
5830
|
+
displayName: string;
|
|
5831
|
+
} & {
|
|
5832
|
+
Primary: {
|
|
5833
|
+
({ media, icon, secondaryText, disabled: disabledProp, "aria-pressed": ariaPressed, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagPrimaryProps): React_2.JSX.Element;
|
|
5834
|
+
displayName: string;
|
|
5835
|
+
};
|
|
5836
|
+
Secondary: {
|
|
5837
|
+
({ dismissLabel, disabled: disabledProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagSecondaryProps): React_2.JSX.Element;
|
|
5838
|
+
displayName: string;
|
|
5839
|
+
};
|
|
5840
|
+
};
|
|
5841
|
+
|
|
5842
|
+
/** InteractionTag: `root` on the element that holds its two buttons. */
|
|
5843
|
+
export declare const interactionTagClassNames: {
|
|
5844
|
+
readonly root: "wave-interaction-tag";
|
|
5845
|
+
};
|
|
5846
|
+
|
|
5847
|
+
/**
|
|
5848
|
+
* The main action of an {@link InteractionTag}: a `<button type="button">` named by its text and
|
|
5849
|
+
* `secondaryText` (`media` and `icon` are decorative), with the InteractionTag's look. In a
|
|
5850
|
+
* selecting TagGroup it is a toggle (`aria-pressed`): a click, Enter or Space adds the tag's
|
|
5851
|
+
* `value` to the group's selection or removes it, after its `onClick` (whose `preventDefault()`
|
|
5852
|
+
* cancels the toggle). Elsewhere the InteractionTag's `selected` makes it a toggle. Either state
|
|
5853
|
+
* renders its `aria-pressed` over one passed here, which applies only when neither is set. Delete
|
|
5854
|
+
* and Backspace on it click the tag's Secondary when there is one. Its props, `ref` and
|
|
5855
|
+
* `className` go to the button. Flat name of `InteractionTag.Primary`, for React Server
|
|
5856
|
+
* Components.
|
|
5857
|
+
*/
|
|
5858
|
+
export declare const InteractionTagPrimary: {
|
|
5859
|
+
({ media, icon, secondaryText, disabled: disabledProp, "aria-pressed": ariaPressed, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagPrimaryProps): React_2.JSX.Element;
|
|
5860
|
+
displayName: string;
|
|
5861
|
+
};
|
|
5862
|
+
|
|
5863
|
+
/**
|
|
5864
|
+
* InteractionTag.Primary: `root` on its button; `media`, `icon`, `primaryText` and
|
|
5865
|
+
* `secondaryText` on the slot elements.
|
|
5866
|
+
*/
|
|
5867
|
+
export declare const interactionTagPrimaryClassNames: {
|
|
5868
|
+
readonly root: "wave-interaction-tag-primary";
|
|
5869
|
+
readonly media: "wave-interaction-tag-primary__media";
|
|
5870
|
+
readonly icon: "wave-interaction-tag-primary__icon";
|
|
5871
|
+
readonly primaryText: "wave-interaction-tag-primary__primary-text";
|
|
5872
|
+
readonly secondaryText: "wave-interaction-tag-primary__secondary-text";
|
|
5873
|
+
};
|
|
5874
|
+
|
|
5875
|
+
/** Props of InteractionTag.Primary: the tag's main action (or its toggle in a selecting TagGroup). */
|
|
5876
|
+
export declare interface InteractionTagPrimaryProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5877
|
+
/**
|
|
5878
|
+
* A visual before the text (an Avatar, sized for the tag: 24, 20 or 16px, unless it sets its
|
|
5879
|
+
* own `size`). Decorative (`aria-hidden`): the button is named by its text.
|
|
5880
|
+
*/
|
|
5881
|
+
media?: Slot<'span'>;
|
|
5882
|
+
/** A decorative icon before the text (`aria-hidden`), in a 20, 16 or 12px box. */
|
|
5883
|
+
icon?: Slot<'span'>;
|
|
5884
|
+
/**
|
|
5885
|
+
* A second, smaller line under the text. Part of the Primary's name, not of the Secondary's. A
|
|
5886
|
+
* small or extra-small tag grows to 28px to fit it.
|
|
5887
|
+
*/
|
|
5888
|
+
secondaryText?: React_2.ReactNode;
|
|
5889
|
+
/**
|
|
5890
|
+
* Disables the Primary natively; or-ed with the InteractionTag's `disabled` (it cannot
|
|
5891
|
+
* re-enable a disabled tag).
|
|
5892
|
+
* @default false
|
|
5893
|
+
*/
|
|
5894
|
+
disabled?: boolean;
|
|
5895
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
5896
|
+
}
|
|
5897
|
+
|
|
5898
|
+
/** Props of InteractionTag: the element that holds the Primary and Secondary buttons. */
|
|
5899
|
+
export declare interface InteractionTagProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
5900
|
+
/**
|
|
5901
|
+
* Identifies the tag in a TagGroup: the value `onDismiss` receives and the selection holds. Give
|
|
5902
|
+
* every tag of a group its own value.
|
|
5903
|
+
* @default a generated id (a development warning in a group that reports values)
|
|
5904
|
+
*/
|
|
5905
|
+
value?: string;
|
|
5906
|
+
/**
|
|
5907
|
+
* Colour scheme of both buttons: `filled` (a neutral fill), `outline` (a border on the surface
|
|
5908
|
+
* behind it) or `brand` (a light brand tint that follows the brand ramp).
|
|
5909
|
+
* @default the TagGroup's `appearance`, else 'filled'
|
|
5910
|
+
*/
|
|
5911
|
+
appearance?: TagAppearance;
|
|
5912
|
+
/**
|
|
5913
|
+
* `medium` (28px tall), `small` (24px) or `extra-small` (20px); an Avatar in the Primary's
|
|
5914
|
+
* `media` is 24, 20 or 16px. Fluent's medium tag is 32px.
|
|
5915
|
+
* @default the TagGroup's `size`, else 'medium'
|
|
5916
|
+
*/
|
|
5917
|
+
size?: TagSize;
|
|
5918
|
+
/**
|
|
5919
|
+
* `circular` (a pill) or `rounded` (4px corners). Fluent's default is `rounded`.
|
|
5920
|
+
* @default the TagGroup's `shape`, else 'circular'
|
|
5921
|
+
*/
|
|
5922
|
+
shape?: TagShape;
|
|
5923
|
+
/**
|
|
5924
|
+
* Disables both buttons natively (a disabled TagGroup does too; a part's own `disabled` cannot
|
|
5925
|
+
* re-enable it). A button that has focus when it is disabled keeps it, unavailable, until focus
|
|
5926
|
+
* leaves it. Rendered as `data-disabled` on the root.
|
|
5927
|
+
* @default false
|
|
5928
|
+
*/
|
|
5929
|
+
disabled?: boolean;
|
|
5930
|
+
/**
|
|
5931
|
+
* Outside a selecting TagGroup: draws the selected look and makes the Primary a toggle:
|
|
5932
|
+
* `aria-pressed="true"`, or `"false"` for `selected={false}`. Leave it `undefined` for an
|
|
5933
|
+
* action that is not a toggle (no `aria-pressed`). Inside a selecting TagGroup (`value`,
|
|
5934
|
+
* `defaultValue` or `onValueChange`) the group's `value` decides, and a defined `selected` is
|
|
5935
|
+
* ignored (a development warning). Rendered as `data-selected` on the root and both buttons.
|
|
5936
|
+
* Disabled wins over the selected look (`aria-pressed` and `data-selected` still render).
|
|
5937
|
+
* Fluent's `selected` is a look only.
|
|
5938
|
+
*/
|
|
5939
|
+
selected?: boolean;
|
|
5940
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
5941
|
+
}
|
|
5942
|
+
|
|
5943
|
+
/**
|
|
5944
|
+
* The separate Dismiss button of an {@link InteractionTag}: a `<button type="button">` after the
|
|
5945
|
+
* Primary, named `dismissLabel` plus the Primary's text ("Dismiss Cherry"). Its children replace
|
|
5946
|
+
* the default dismiss glyph; a text label among them replaces `dismissLabel` in the name ("Remove
|
|
5947
|
+
* Cherry"), an `aria-label` the whole name. A button passed as its child is unwrapped (its children
|
|
5948
|
+
* become the content). Enter, Space, a click, Delete and Backspace call its `onClick`, then, in a
|
|
5949
|
+
* TagGroup, the group's `onDismiss(value)`. Its props, `ref` and `className` go to the button.
|
|
5950
|
+
* Flat name of `InteractionTag.Secondary`, for React Server Components.
|
|
5951
|
+
*/
|
|
5952
|
+
export declare const InteractionTagSecondary: {
|
|
5953
|
+
({ dismissLabel, disabled: disabledProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, children, onClick, onKeyDown, onFocus, onBlur, ref, ...rest }: InteractionTagSecondaryProps): React_2.JSX.Element;
|
|
5954
|
+
displayName: string;
|
|
5955
|
+
};
|
|
5956
|
+
|
|
5957
|
+
/**
|
|
5958
|
+
* InteractionTag.Secondary: `root` on its button; `dismissIcon` on the glyph inside it (the
|
|
5959
|
+
* default glyph, or the element that wraps the children).
|
|
5960
|
+
*/
|
|
5961
|
+
export declare const interactionTagSecondaryClassNames: {
|
|
5962
|
+
readonly root: "wave-interaction-tag-secondary";
|
|
5963
|
+
readonly dismissIcon: "wave-interaction-tag-secondary__dismiss-icon";
|
|
5964
|
+
};
|
|
5965
|
+
|
|
5966
|
+
/** Props of InteractionTag.Secondary: the tag's separate Dismiss button. */
|
|
5967
|
+
export declare interface InteractionTagSecondaryProps extends React_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5968
|
+
/**
|
|
5969
|
+
* Visually hidden text that names the button with the Primary's text ("Dismiss Cherry"). A text
|
|
5970
|
+
* label in the children replaces it ("Remove Cherry"); an `aria-label` replaces the whole name.
|
|
5971
|
+
* Localise it here. Fluent's order is the primary text, then the label ("Cherry remove").
|
|
5972
|
+
* @default 'Dismiss'
|
|
5973
|
+
*/
|
|
5974
|
+
dismissLabel?: string;
|
|
5975
|
+
/**
|
|
5976
|
+
* Disables the Secondary natively; or-ed with the InteractionTag's `disabled` (it cannot
|
|
5977
|
+
* re-enable a disabled tag).
|
|
5978
|
+
* @default false
|
|
5979
|
+
*/
|
|
5980
|
+
disabled?: boolean;
|
|
5981
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
5982
|
+
}
|
|
5983
|
+
|
|
5185
5984
|
/** Whether both dates are on the same calendar day (time of day ignored); `false` when either is missing. */
|
|
5186
5985
|
export declare function isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
|
|
5187
5986
|
|
|
@@ -5775,6 +6574,15 @@ export declare const listboxSurfaceClassNames: {
|
|
|
5775
6574
|
readonly list: "wave-listbox-surface__list";
|
|
5776
6575
|
};
|
|
5777
6576
|
|
|
6577
|
+
/**
|
|
6578
|
+
* Attributes of the list element that ListboxSurface renders (see `listProps`). Its content is the
|
|
6579
|
+
* surface's `children`.
|
|
6580
|
+
*/
|
|
6581
|
+
export declare type ListboxSurfaceListProps = Omit<React_2.HTMLAttributes<HTMLUListElement>, 'role' | 'id' | 'hidden' | 'tabIndex' | 'className' | 'aria-label' | 'aria-labelledby' | 'aria-multiselectable' | 'aria-activedescendant' | 'children' | 'dangerouslySetInnerHTML'> & {
|
|
6582
|
+
/** Ref to the `role="listbox"` element (it moves between the picker and the popup). */
|
|
6583
|
+
ref?: React_2.Ref<HTMLUListElement>;
|
|
6584
|
+
};
|
|
6585
|
+
|
|
5778
6586
|
/**
|
|
5779
6587
|
* Props of {@link ListboxSurface}. The options of one listbox live in one list at a time, and this
|
|
5780
6588
|
* surface renders that list: render every option of the listbox inside it, never in a second list
|
|
@@ -5825,6 +6633,14 @@ export declare interface ListboxSurfaceProps {
|
|
|
5825
6633
|
* classes they conflict with.
|
|
5826
6634
|
*/
|
|
5827
6635
|
surfaceClassName?: string;
|
|
6636
|
+
/**
|
|
6637
|
+
* Attributes spread onto the list element before the listbox's own (`role`, `id`, `tabIndex`,
|
|
6638
|
+
* `aria-multiselectable`, `aria-activedescendant` and `hidden` win, also where the listbox
|
|
6639
|
+
* renders none of the last two): `data-*` and other `aria-*` attributes, `style`, and handlers,
|
|
6640
|
+
* composed before the listbox's own `onMouseDown`. `ref` is merged with the list's. Name the list
|
|
6641
|
+
* with `aria-label`/`aria-labelledby` (the props above), not here.
|
|
6642
|
+
*/
|
|
6643
|
+
listProps?: ListboxSurfaceListProps;
|
|
5828
6644
|
/** The options (`Option`, `OptionGroup` or options of your own on `useListboxOption`). */
|
|
5829
6645
|
children?: React_2.ReactNode;
|
|
5830
6646
|
}
|
|
@@ -6989,8 +7805,14 @@ export declare interface MessageBarTitleProps extends React_2.HTMLAttributes<HTM
|
|
|
6989
7805
|
*/
|
|
6990
7806
|
export declare type ModalOpenChangeReason = 'trigger' | 'close' | 'close-button' | 'escape' | 'outside-press';
|
|
6991
7807
|
|
|
6992
|
-
/**
|
|
6993
|
-
|
|
7808
|
+
/**
|
|
7809
|
+
* How a Dialog or Drawer relates to the page (Fluent's `modalType`). `modal`: a backdrop dims the
|
|
7810
|
+
* page, focus stays in the surface, the rest of the page is `inert` and does not scroll. `alert`:
|
|
7811
|
+
* modal, for a confirmation that needs an answer (`role="alertdialog"`; a backdrop press does not
|
|
7812
|
+
* close it). `non-modal`: the page stays usable (no backdrop, no focus trap, nothing inert, the
|
|
7813
|
+
* page scrolls).
|
|
7814
|
+
*/
|
|
7815
|
+
export declare type ModalType = 'modal' | 'alert' | 'non-modal';
|
|
6994
7816
|
|
|
6995
7817
|
/**
|
|
6996
7818
|
* A vertical side navigation (`<nav>` landmark, default name "Navigation") with items, links and
|
|
@@ -7008,12 +7830,25 @@ export declare type ModalType = 'modal' | 'alert';
|
|
|
7008
7830
|
* for sub-items your own component renders inside a closed category.
|
|
7009
7831
|
* - **Values** are unique: among the items and sub-items, and among the categories (a duplicate
|
|
7010
7832
|
* warns in development).
|
|
7011
|
-
*
|
|
7012
|
-
*
|
|
7013
|
-
*
|
|
7833
|
+
* - **Structure**: every child of the Nav, and of a category, is a part or your own `<li>`; a
|
|
7834
|
+
* development warning names anything else (a `<div>`, text, the wrapper of a Tooltip around an
|
|
7835
|
+
* item). `Nav.SectionHeader` is a heading between groups of items (`<h3>` unless
|
|
7836
|
+
* `headingLevel`, which stands for the `as` of Fluent's NavSectionHeader), and `Nav.Divider` a
|
|
7837
|
+
* line between groups, hidden from assistive technology (Fluent's NavDivider is a separator).
|
|
7838
|
+
* - **App identity**: `Nav.AppItem` shows the app's name and logo at the top, as a link with
|
|
7839
|
+
* `href` or a button; it is never selected. `Nav.AppItemStatic` shows them as plain text.
|
|
7840
|
+
* - **Item actions**: `actions` on `Nav.Item` and `Nav.SubItem` (Fluent's SplitNavItem) puts your
|
|
7841
|
+
* own controls beside the item, in a group named by it; each is a Tab stop after the item, and
|
|
7842
|
+
* none selects it. They are drawn while the row is hovered or has focus, while one is pressed or
|
|
7843
|
+
* has its menu open, and always on touch screens and in forced colours. With actions, a selected
|
|
7844
|
+
* item's background and indicator are drawn on its row (`.wave-nav-item__list-item`).
|
|
7845
|
+
*
|
|
7846
|
+
* Sub-components are also exported under flat names (`NavCategory`, `NavItem`, `NavSubItem`,
|
|
7847
|
+
* `NavSectionHeader`, `NavDivider`, `NavAppItem`, `NavAppItemStatic`): React Server Components
|
|
7848
|
+
* import those, because dotted access (`Nav.Item`) needs a client file.
|
|
7014
7849
|
*/
|
|
7015
7850
|
export declare const Nav: {
|
|
7016
|
-
({ value: valueProp, defaultValue: defaultValueProp, onValueChange, selectedValue, defaultSelectedValue, onNavItemSelect, openCategories
|
|
7851
|
+
({ value: valueProp, defaultValue: defaultValueProp, onValueChange, selectedValue, defaultSelectedValue, onNavItemSelect, openCategories, defaultOpenCategories, onOpenCategoriesChange, currentCategory, className, children, ref, ...rest }: NavProps): React_2.JSX.Element;
|
|
7017
7852
|
displayName: string;
|
|
7018
7853
|
} & {
|
|
7019
7854
|
Category: {
|
|
@@ -7022,8 +7857,139 @@ export declare const Nav: {
|
|
|
7022
7857
|
};
|
|
7023
7858
|
Item: typeof NavItem;
|
|
7024
7859
|
SubItem: typeof NavSubItem;
|
|
7860
|
+
SectionHeader: {
|
|
7861
|
+
({ headingLevel, className, children, ref, ...rest }: NavSectionHeaderProps): React_2.JSX.Element | null;
|
|
7862
|
+
displayName: string;
|
|
7863
|
+
};
|
|
7864
|
+
Divider: {
|
|
7865
|
+
({ className, ref, ...rest }: NavDividerProps): React_2.JSX.Element;
|
|
7866
|
+
displayName: string;
|
|
7867
|
+
};
|
|
7868
|
+
AppItem: typeof NavAppItem;
|
|
7869
|
+
AppItemStatic: {
|
|
7870
|
+
({ icon, className, children, ref, ...rest }: NavAppItemStaticProps): React_2.JSX.Element;
|
|
7871
|
+
displayName: string;
|
|
7872
|
+
};
|
|
7873
|
+
};
|
|
7874
|
+
|
|
7875
|
+
/**
|
|
7876
|
+
* The app's name and logo at the top of the navigation: a link with `href` (the app's start page),
|
|
7877
|
+
* a button otherwise. It is never selected and never marked as the current page (a consumer's
|
|
7878
|
+
* `aria-current` passes through), has no `value` and is not registered with the Nav; a click runs
|
|
7879
|
+
* only your `onClick` and the browser's default. A `disabled` button or an `aria-disabled` link
|
|
7880
|
+
* looks unavailable; the item adds no disabled logic of its own. Fluent's AppItem picks its element
|
|
7881
|
+
* through `as`; here `href` does.
|
|
7882
|
+
*
|
|
7883
|
+
* Typed by overloads like `Nav.Item`, resolved in order: without `href` (button props), with a
|
|
7884
|
+
* string `href` (anchor props), then an `href` that may be `undefined` at run time
|
|
7885
|
+
* ({@link NavAppItemDynamicProps}).
|
|
7886
|
+
*
|
|
7887
|
+
* Also exported as `NavAppItem` (import the flat name from React Server Components).
|
|
7888
|
+
*/
|
|
7889
|
+
export declare function NavAppItem(props: NavAppItemButtonProps): React_2.ReactElement;
|
|
7890
|
+
|
|
7891
|
+
export declare function NavAppItem(props: NavAppItemAnchorProps): React_2.ReactElement;
|
|
7892
|
+
|
|
7893
|
+
export declare function NavAppItem(props: NavAppItemDynamicProps): React_2.ReactElement;
|
|
7894
|
+
|
|
7895
|
+
export declare namespace NavAppItem {
|
|
7896
|
+
var displayName: string;
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7899
|
+
/**
|
|
7900
|
+
* Nav.AppItem rendered as a link (`href` given): anchor attributes, handlers typed on
|
|
7901
|
+
* `HTMLAnchorElement`.
|
|
7902
|
+
*/
|
|
7903
|
+
export declare interface NavAppItemAnchorProps extends NavAppItemOwnProps, Omit<React_2.AnchorHTMLAttributes<HTMLAnchorElement>, keyof NavAppItemOwnProps> {
|
|
7904
|
+
/**
|
|
7905
|
+
* URL of the app's start page; renders an `<a>`. Required in this branch, so `href`
|
|
7906
|
+
* discriminates the union.
|
|
7907
|
+
*/
|
|
7908
|
+
href: string;
|
|
7909
|
+
/** Ref to the `<a>` element. */
|
|
7910
|
+
ref?: React_2.Ref<HTMLAnchorElement>;
|
|
7911
|
+
}
|
|
7912
|
+
|
|
7913
|
+
/**
|
|
7914
|
+
* Nav.AppItem rendered as a button (no `href`): button attributes without `value` (an app item is
|
|
7915
|
+
* never selected).
|
|
7916
|
+
*/
|
|
7917
|
+
export declare interface NavAppItemButtonProps extends NavAppItemOwnProps, NoAnchorOnlyAttributes_2, Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, keyof NavAppItemOwnProps | 'value'> {
|
|
7918
|
+
/** Button app items have no `href`. */
|
|
7919
|
+
href?: undefined;
|
|
7920
|
+
/** Ref to the `<button>` element. */
|
|
7921
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
7922
|
+
}
|
|
7923
|
+
|
|
7924
|
+
/**
|
|
7925
|
+
* Nav.AppItem: `root` on the `<a>` (with `href`) or `<button>`; `listItem` on the list item around
|
|
7926
|
+
* it; `icon` on the icon span; `content` on the label span.
|
|
7927
|
+
*/
|
|
7928
|
+
export declare const navAppItemClassNames: {
|
|
7929
|
+
readonly root: "wave-nav-app-item";
|
|
7930
|
+
readonly listItem: "wave-nav-app-item__list-item";
|
|
7931
|
+
readonly icon: "wave-nav-app-item__icon";
|
|
7932
|
+
readonly content: "wave-nav-app-item__content";
|
|
7025
7933
|
};
|
|
7026
7934
|
|
|
7935
|
+
/**
|
|
7936
|
+
* Nav.AppItem with an `href` known only at run time (`string | undefined`): a link when it is a
|
|
7937
|
+
* string, a button otherwise; only the attributes both elements share, handlers of either element.
|
|
7938
|
+
*/
|
|
7939
|
+
export declare interface NavAppItemDynamicProps extends NavAppItemOwnProps, Omit<React_2.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, keyof NavAppItemOwnProps> {
|
|
7940
|
+
/** URL of the app's start page; renders an `<a>` when defined, a `<button>` otherwise. */
|
|
7941
|
+
href?: string;
|
|
7942
|
+
/** Ref to the rendered `<a>` or `<button>` element. */
|
|
7943
|
+
ref?: React_2.Ref<HTMLAnchorElement | HTMLButtonElement>;
|
|
7944
|
+
}
|
|
7945
|
+
|
|
7946
|
+
/** The props of Nav.AppItem that every branch shares. */
|
|
7947
|
+
export declare interface NavAppItemOwnProps {
|
|
7948
|
+
/**
|
|
7949
|
+
* The app's logo or an Avatar, before its name. Rendered with `aria-hidden="true"` in a box at
|
|
7950
|
+
* least 20px square that grows with its content. A falsy icon (`''`, `0`) or a list of nothing
|
|
7951
|
+
* renders no icon box.
|
|
7952
|
+
*/
|
|
7953
|
+
icon?: Slot<'span'>;
|
|
7954
|
+
/** The app's name. */
|
|
7955
|
+
children?: React_2.ReactNode;
|
|
7956
|
+
}
|
|
7957
|
+
|
|
7958
|
+
/** Properties for the NavAppItem sub-component: link props with `href`, button props without. */
|
|
7959
|
+
export declare type NavAppItemProps = NavAppItemAnchorProps | NavAppItemButtonProps;
|
|
7960
|
+
|
|
7961
|
+
/**
|
|
7962
|
+
* The app's name and logo as plain text (not a link or button): the layout of `Nav.AppItem` in a
|
|
7963
|
+
* `<div>`, not focusable, with no role and no hover. It does not carry Nav.AppItem's class.
|
|
7964
|
+
*
|
|
7965
|
+
* Also exported as `NavAppItemStatic` (import the flat name from React Server Components).
|
|
7966
|
+
*/
|
|
7967
|
+
export declare const NavAppItemStatic: {
|
|
7968
|
+
({ icon, className, children, ref, ...rest }: NavAppItemStaticProps): React_2.JSX.Element;
|
|
7969
|
+
displayName: string;
|
|
7970
|
+
};
|
|
7971
|
+
|
|
7972
|
+
/**
|
|
7973
|
+
* Nav.AppItemStatic: `root` on the `<div>`; `listItem` on the list item around it; `icon` on the
|
|
7974
|
+
* icon span; `content` on the label span.
|
|
7975
|
+
*/
|
|
7976
|
+
export declare const navAppItemStaticClassNames: {
|
|
7977
|
+
readonly root: "wave-nav-app-item-static";
|
|
7978
|
+
readonly listItem: "wave-nav-app-item-static__list-item";
|
|
7979
|
+
readonly icon: "wave-nav-app-item-static__icon";
|
|
7980
|
+
readonly content: "wave-nav-app-item-static__content";
|
|
7981
|
+
};
|
|
7982
|
+
|
|
7983
|
+
/** Properties for the NavAppItemStatic sub-component. */
|
|
7984
|
+
export declare interface NavAppItemStaticProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
7985
|
+
/** The app's logo or an Avatar (as Nav.AppItem's `icon`). */
|
|
7986
|
+
icon?: Slot<'span'>;
|
|
7987
|
+
/** The app's name. */
|
|
7988
|
+
children?: React_2.ReactNode;
|
|
7989
|
+
/** Ref to the `<div>`. */
|
|
7990
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
7991
|
+
}
|
|
7992
|
+
|
|
7027
7993
|
/**
|
|
7028
7994
|
* A collapsible group of sub-items. Its toggle button shows `label` and reports `aria-expanded`
|
|
7029
7995
|
* (and `aria-controls` while open); the sub-items render in a nested list while it is open.
|
|
@@ -7075,7 +8041,10 @@ export declare interface NavCategoryProps extends React_2.HTMLAttributes<HTMLLIE
|
|
|
7075
8041
|
* (`''`, `0`) or a list of nothing renders no icon box.
|
|
7076
8042
|
*/
|
|
7077
8043
|
icon?: Slot<'span'>;
|
|
7078
|
-
/**
|
|
8044
|
+
/**
|
|
8045
|
+
* The category's sub-items (`Nav.SubItem`), and `Nav.SectionHeader` and `Nav.Divider`, rendered
|
|
8046
|
+
* in its list while it is open.
|
|
8047
|
+
*/
|
|
7079
8048
|
children?: React_2.ReactNode;
|
|
7080
8049
|
/** Ref to the category's `<li>` element. */
|
|
7081
8050
|
ref?: React_2.Ref<HTMLLIElement>;
|
|
@@ -7087,6 +8056,310 @@ export declare const navClassNames: {
|
|
|
7087
8056
|
readonly list: "wave-nav__list";
|
|
7088
8057
|
};
|
|
7089
8058
|
|
|
8059
|
+
/**
|
|
8060
|
+
* A line between groups of items, in its own list item, hidden from assistive technology (a list
|
|
8061
|
+
* holds only list items; use `Nav.SectionHeader` to name a group). Fluent's NavDivider is a
|
|
8062
|
+
* `separator`, which a list cannot hold, so this one is decorative.
|
|
8063
|
+
*
|
|
8064
|
+
* Also exported as `NavDivider` (import the flat name from React Server Components).
|
|
8065
|
+
*/
|
|
8066
|
+
export declare const NavDivider: {
|
|
8067
|
+
({ className, ref, ...rest }: NavDividerProps): React_2.JSX.Element;
|
|
8068
|
+
displayName: string;
|
|
8069
|
+
};
|
|
8070
|
+
|
|
8071
|
+
/** Nav.Divider: `root` on its list item (hidden from assistive technology). */
|
|
8072
|
+
export declare const navDividerClassNames: {
|
|
8073
|
+
readonly root: "wave-nav-divider";
|
|
8074
|
+
};
|
|
8075
|
+
|
|
8076
|
+
/** Properties for the NavDivider sub-component. */
|
|
8077
|
+
export declare interface NavDividerProps extends Omit<React_2.HTMLAttributes<HTMLLIElement>, 'children' | 'role' | 'aria-hidden'> {
|
|
8078
|
+
/** Ref to the divider's list item. */
|
|
8079
|
+
ref?: React_2.Ref<HTMLLIElement>;
|
|
8080
|
+
}
|
|
8081
|
+
|
|
8082
|
+
/**
|
|
8083
|
+
* A navigation pane in a drawer: Nav's items, categories and selection in a `<nav>` landmark that
|
|
8084
|
+
* sits over the page (`type="overlay"`) or in the page layout (`type="inline"`). Fluent's
|
|
8085
|
+
* `NavDrawer`.
|
|
8086
|
+
*
|
|
8087
|
+
* - **Composition:** `NavDrawer.Header` (a row: a `Hamburger`, the app's name), `NavDrawer.Body`
|
|
8088
|
+
* (the scrolling list) and `NavDrawer.Footer` (a list pinned below it), rendered in the order
|
|
8089
|
+
* written. Nav parts (`Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, `Nav.Divider`,
|
|
8090
|
+
* `Nav.AppItem`, …) go in the Body and the Footer, which render the lists; wrap anything else
|
|
8091
|
+
* there in an `<li>`.
|
|
8092
|
+
* - **Types:** `overlay` (default) is a panel over the page, in a portal, opened in the browser
|
|
8093
|
+
* only; `inline` is a panel in the page layout, also in the server HTML. Changing `type`
|
|
8094
|
+
* remounts the panel; the selection and the open categories are kept.
|
|
8095
|
+
* - **Opening and closing:** keep it controlled (`open`, `onOpenChange`): an uncontrolled drawer
|
|
8096
|
+
* that is closed cannot open again. A `Hamburger` inside it toggles it (reason `trigger`);
|
|
8097
|
+
* Escape and a backdrop press close an overlay (`escape`, `outside-press`). Closing an overlay
|
|
8098
|
+
* when an item is chosen is yours, in `onItemSelect`, which also fires when the current page is
|
|
8099
|
+
* activated again. A non-modal overlay (`modalType="non-modal"`) covers the page, which keeps
|
|
8100
|
+
* its Tab order: keep the page's controls clear of it, or use `type="inline"`.
|
|
8101
|
+
* - **Focus:** pass your page's Hamburger as `finalFocusRef`, so focus returns to it when a
|
|
8102
|
+
* Hamburger inside the drawer closes it. An overlay moves focus in when it opens; an inline
|
|
8103
|
+
* drawer does not.
|
|
8104
|
+
* - **Keyboard:** every item is a Tab stop; `NavDrawer.Body focusMode="arrow"` makes the body one
|
|
8105
|
+
* Tab stop with arrow keys, Home and End.
|
|
8106
|
+
* - **Landmark:** one `<nav>`, named "Navigation" by default (`aria-label`, `aria-labelledby`);
|
|
8107
|
+
* an overlay is also a dialog with that name. Rename it when the page has another navigation
|
|
8108
|
+
* landmark.
|
|
8109
|
+
* - **Selection:** Nav's `value`/`onValueChange` (only on a change), `openCategories` and
|
|
8110
|
+
* `currentCategory`, and `onItemSelect` on every activation (Fluent's `selectedValue` and
|
|
8111
|
+
* `onNavItemSelect`).
|
|
8112
|
+
* - **Server Components:** the parts are also exported as `NavDrawerHeader`, `NavDrawerBody` and
|
|
8113
|
+
* `NavDrawerFooter`.
|
|
8114
|
+
*
|
|
8115
|
+
* @example
|
|
8116
|
+
* const [open, setOpen] = useState(false);
|
|
8117
|
+
* const hamburgerRef = useRef<HTMLButtonElement>(null);
|
|
8118
|
+
* <Hamburger
|
|
8119
|
+
* ref={hamburgerRef}
|
|
8120
|
+
* aria-expanded={open}
|
|
8121
|
+
* aria-controls={open ? 'main-nav' : undefined}
|
|
8122
|
+
* aria-haspopup="dialog"
|
|
8123
|
+
* onClick={() => setOpen(!open)}
|
|
8124
|
+
* />
|
|
8125
|
+
* <NavDrawer
|
|
8126
|
+
* id="main-nav"
|
|
8127
|
+
* open={open}
|
|
8128
|
+
* onOpenChange={setOpen}
|
|
8129
|
+
* onItemSelect={() => setOpen(false)}
|
|
8130
|
+
* finalFocusRef={hamburgerRef}
|
|
8131
|
+
* defaultValue="home"
|
|
8132
|
+
* >
|
|
8133
|
+
* <NavDrawer.Header>
|
|
8134
|
+
* <Hamburger />
|
|
8135
|
+
* Contoso HR
|
|
8136
|
+
* </NavDrawer.Header>
|
|
8137
|
+
* <NavDrawer.Body>
|
|
8138
|
+
* <Nav.Item value="home" href="/">Home</Nav.Item>
|
|
8139
|
+
* </NavDrawer.Body>
|
|
8140
|
+
* </NavDrawer>
|
|
8141
|
+
*/
|
|
8142
|
+
export declare const NavDrawer: {
|
|
8143
|
+
({ 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;
|
|
8144
|
+
displayName: string;
|
|
8145
|
+
} & {
|
|
8146
|
+
Header: {
|
|
8147
|
+
({ className, children, ref, ...rest }: NavDrawerHeaderProps): React_2.JSX.Element;
|
|
8148
|
+
displayName: string;
|
|
8149
|
+
};
|
|
8150
|
+
Body: {
|
|
8151
|
+
({ focusMode, className, onKeyDown, onFocus, children, ref, ...rest }: NavDrawerBodyProps): React_2.JSX.Element;
|
|
8152
|
+
displayName: string;
|
|
8153
|
+
};
|
|
8154
|
+
Footer: {
|
|
8155
|
+
({ className, children, ref, ...rest }: NavDrawerFooterProps): React_2.JSX.Element;
|
|
8156
|
+
displayName: string;
|
|
8157
|
+
};
|
|
8158
|
+
};
|
|
8159
|
+
|
|
8160
|
+
/**
|
|
8161
|
+
* The scrolling list of a NavDrawer: the Nav parts (`Nav.Item`, `Nav.Category`, …) as the items of
|
|
8162
|
+
* its list. With `focusMode="arrow"` it is one Tab stop and the arrow keys move through it.
|
|
8163
|
+
*/
|
|
8164
|
+
export declare const NavDrawerBody: {
|
|
8165
|
+
({ focusMode, className, onKeyDown, onFocus, children, ref, ...rest }: NavDrawerBodyProps): React_2.JSX.Element;
|
|
8166
|
+
displayName: string;
|
|
8167
|
+
};
|
|
8168
|
+
|
|
8169
|
+
/** NavDrawer.Body: `root` on the scrolling body; `list` on its list. */
|
|
8170
|
+
export declare const navDrawerBodyClassNames: {
|
|
8171
|
+
readonly root: "wave-nav-drawer-body";
|
|
8172
|
+
readonly list: "wave-nav-drawer-body__list";
|
|
8173
|
+
};
|
|
8174
|
+
|
|
8175
|
+
/** Properties for the NavDrawerBody sub-component. */
|
|
8176
|
+
export declare interface NavDrawerBodyProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8177
|
+
/**
|
|
8178
|
+
* How the keyboard reaches the items. `'tab'`: every item is a Tab stop and the arrow keys do
|
|
8179
|
+
* nothing (Nav's model). `'arrow'`: the body is one Tab stop, the last focused element (at first
|
|
8180
|
+
* the current page, or the closed category that holds it, else the first item); Down and Right
|
|
8181
|
+
* move to the next element and Up and Left to the previous one (Left and Right swap in a
|
|
8182
|
+
* right-to-left layout), wrapping, and Home and End go to the ends. Every focusable element in
|
|
8183
|
+
* the body joins the order, item actions included. Screen readers do not announce arrow keys in
|
|
8184
|
+
* a navigation landmark: prefer `'tab'` unless your users expect an app pane. Rendered as
|
|
8185
|
+
* `data-focus-mode`. Fluent's NavDrawer uses arrow keys by default (its `tabbable` adds Tab
|
|
8186
|
+
* stops).
|
|
8187
|
+
* @default 'tab'
|
|
8188
|
+
*/
|
|
8189
|
+
focusMode?: FocusMode;
|
|
8190
|
+
/** Nav parts: `Nav.Item`, `Nav.Category`, `Nav.SectionHeader`, … (each renders its own list item). */
|
|
8191
|
+
children?: React_2.ReactNode;
|
|
8192
|
+
/** Ref to the scrolling body element. */
|
|
8193
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8194
|
+
}
|
|
8195
|
+
|
|
8196
|
+
/**
|
|
8197
|
+
* NavDrawer (a Drawer variant: it also carries Drawer's root, and its backdrop Drawer's backdrop
|
|
8198
|
+
* class): `root` on the panel (the portaled `role="dialog"` element of an overlay drawer, the
|
|
8199
|
+
* panel element of an inline one); `backdrop` on the backdrop of a modal overlay; `nav` on the
|
|
8200
|
+
* navigation landmark that fills the panel.
|
|
8201
|
+
*/
|
|
8202
|
+
export declare const navDrawerClassNames: {
|
|
8203
|
+
readonly root: "wave-nav-drawer";
|
|
8204
|
+
readonly backdrop: "wave-nav-drawer__backdrop";
|
|
8205
|
+
readonly nav: "wave-nav-drawer__nav";
|
|
8206
|
+
};
|
|
8207
|
+
|
|
8208
|
+
/**
|
|
8209
|
+
* The list pinned below a NavDrawer's body (Settings, Help): Nav parts as the items of its list,
|
|
8210
|
+
* each a Tab stop. Its line above shows while more of the body is below.
|
|
8211
|
+
*/
|
|
8212
|
+
export declare const NavDrawerFooter: {
|
|
8213
|
+
({ className, children, ref, ...rest }: NavDrawerFooterProps): React_2.JSX.Element;
|
|
8214
|
+
displayName: string;
|
|
8215
|
+
};
|
|
8216
|
+
|
|
8217
|
+
/** NavDrawer.Footer: `root` on the footer; `list` on its list. */
|
|
8218
|
+
export declare const navDrawerFooterClassNames: {
|
|
8219
|
+
readonly root: "wave-nav-drawer-footer";
|
|
8220
|
+
readonly list: "wave-nav-drawer-footer__list";
|
|
8221
|
+
};
|
|
8222
|
+
|
|
8223
|
+
/** Properties for the NavDrawerFooter sub-component. */
|
|
8224
|
+
export declare interface NavDrawerFooterProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8225
|
+
/** Nav parts pinned below the body (Settings, Help); wrap other content in an `<li>`. */
|
|
8226
|
+
children?: React_2.ReactNode;
|
|
8227
|
+
/** Ref to the footer element. */
|
|
8228
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8229
|
+
}
|
|
8230
|
+
|
|
8231
|
+
/**
|
|
8232
|
+
* The header row of a NavDrawer: a Hamburger, the app's name, … (no list: Nav items go in the
|
|
8233
|
+
* body or the footer). Its line underneath shows while the body is scrolled away from its top.
|
|
8234
|
+
*/
|
|
8235
|
+
export declare const NavDrawerHeader: {
|
|
8236
|
+
({ className, children, ref, ...rest }: NavDrawerHeaderProps): React_2.JSX.Element;
|
|
8237
|
+
displayName: string;
|
|
8238
|
+
};
|
|
8239
|
+
|
|
8240
|
+
/** NavDrawer.Header: `root` on the header row. */
|
|
8241
|
+
export declare const navDrawerHeaderClassNames: {
|
|
8242
|
+
readonly root: "wave-nav-drawer-header";
|
|
8243
|
+
};
|
|
8244
|
+
|
|
8245
|
+
/** Properties for the NavDrawerHeader sub-component. */
|
|
8246
|
+
export declare interface NavDrawerHeaderProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
8247
|
+
/** A Hamburger, the app's name, …: any content (Nav items go in the body or the footer). */
|
|
8248
|
+
children?: React_2.ReactNode;
|
|
8249
|
+
/** Ref to the header element. */
|
|
8250
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8251
|
+
}
|
|
8252
|
+
|
|
8253
|
+
/** Properties for the NavDrawer component. */
|
|
8254
|
+
export declare interface NavDrawerProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'defaultValue'>, Pick<NavProps, 'value' | 'defaultValue' | 'onValueChange' | 'openCategories' | 'defaultOpenCategories' | 'onOpenCategoriesChange' | 'currentCategory'> {
|
|
8255
|
+
/**
|
|
8256
|
+
* How the drawer sits on the page (Fluent's `type`).
|
|
8257
|
+
* - `overlay`: a panel over the page, rendered in a portal while open (in the browser only: an
|
|
8258
|
+
* open overlay is closed in the server HTML and opens once hydrated). Modal by default: focus
|
|
8259
|
+
* moves in and stays there, the rest of the page is `inert` and does not scroll, and Escape
|
|
8260
|
+
* and a backdrop press close it. It is a dialog with the navigation's name.
|
|
8261
|
+
* - `inline`: a panel in the page layout, rendered where the NavDrawer is (also in the server
|
|
8262
|
+
* HTML). The page stays usable around it; Escape and presses outside do nothing; opening it
|
|
8263
|
+
* moves no focus, and closing it while focus is inside returns focus to `finalFocusRef`, else
|
|
8264
|
+
* to the element that opened it.
|
|
8265
|
+
*
|
|
8266
|
+
* Changing `type` remounts the panel; the selection and the open categories are kept. Rendered
|
|
8267
|
+
* as `data-type`.
|
|
8268
|
+
* @default 'overlay'
|
|
8269
|
+
*/
|
|
8270
|
+
type?: DrawerType;
|
|
8271
|
+
/** Controlled open state. */
|
|
8272
|
+
open?: boolean;
|
|
8273
|
+
/**
|
|
8274
|
+
* Open state for uncontrolled usage. Keep the drawer controlled instead: a closed uncontrolled
|
|
8275
|
+
* NavDrawer cannot be opened again (a Hamburger inside it is not shown while it is closed).
|
|
8276
|
+
* @default false
|
|
8277
|
+
*/
|
|
8278
|
+
defaultOpen?: boolean;
|
|
8279
|
+
/**
|
|
8280
|
+
* Called with the new open state when it changes, with `details.reason`: `trigger` (a Hamburger
|
|
8281
|
+
* inside the drawer), `escape` and `outside-press` (the backdrop; overlay only). `details` is
|
|
8282
|
+
* typed optional until 1.0. A controlled drawer stays as it is until you update `open`.
|
|
8283
|
+
*/
|
|
8284
|
+
onOpenChange?: (open: boolean, details?: DrawerOpenChangeDetails) => void;
|
|
8285
|
+
/**
|
|
8286
|
+
* Called with an item's value every time an item is activated, also when the current page is
|
|
8287
|
+
* activated again (a disabled item, a link opened in another tab or window, and a button item
|
|
8288
|
+
* whose `onClick` calls `preventDefault()` are not activations). Close an overlay drawer here:
|
|
8289
|
+
* `onValueChange` fires only when the value changes. Fluent's `onNavItemSelect`.
|
|
8290
|
+
*/
|
|
8291
|
+
onItemSelect?: (value: string) => void;
|
|
8292
|
+
/**
|
|
8293
|
+
* The edge the panel is attached to: an overlay's screen edge; an inline panel's inner edge is
|
|
8294
|
+
* the opposite one. `start`/`end` follow the text direction; `left`/`right` are physical sides;
|
|
8295
|
+
* `bottom` runs along the bottom edge. Unlike Drawer's (`'end'`), the default is the start edge,
|
|
8296
|
+
* where navigation sits (Fluent's). Rendered as `data-position`.
|
|
8297
|
+
* @default 'start'
|
|
8298
|
+
*/
|
|
8299
|
+
position?: DrawerPosition;
|
|
8300
|
+
/**
|
|
8301
|
+
* The panel's width at a side (its height at the bottom), on Drawer's scale: `small` 320px,
|
|
8302
|
+
* `medium` 592px, `large` 940px, `full` the viewport (inline: the container). A width class in
|
|
8303
|
+
* `className` replaces it (Fluent's navigation pane is 260px wide: the width class of 65
|
|
8304
|
+
* spacing steps). Rendered as `data-size`. Drawer's default too.
|
|
8305
|
+
* @default 'small'
|
|
8306
|
+
*/
|
|
8307
|
+
size?: DrawerSize;
|
|
8308
|
+
/**
|
|
8309
|
+
* Inline drawers: draws a line on the panel's inner edge (`data-separator`), as Nav does
|
|
8310
|
+
* (Drawer's `separator` defaults to `false`). An overlay always draws that edge; forced colours
|
|
8311
|
+
* always draw it.
|
|
8312
|
+
* @default true
|
|
8313
|
+
*/
|
|
8314
|
+
separator?: boolean;
|
|
8315
|
+
/**
|
|
8316
|
+
* Overlay drawers: `modal` (backdrop, focus trapped, page inert and not scrolling) or
|
|
8317
|
+
* `non-modal` (no backdrop, no trap, nothing inert; Escape closes it while focus is inside, and
|
|
8318
|
+
* its Tab place follows the element that opened it). A non-modal overlay covers the page under
|
|
8319
|
+
* it while the page keeps its Tab order: keep the page's controls clear of it (reserve its width,
|
|
8320
|
+
* or its height at the bottom, in your layout while it is open) or use `type="inline"`; with
|
|
8321
|
+
* `size="full"` it hides the whole page and warns. Ignored by inline drawers. Rendered as
|
|
8322
|
+
* `data-modal-type` on an overlay's panel. Fluent's `modalType` (without `alert`: a navigation
|
|
8323
|
+
* pane is never an alert, so an `'alert'` is treated as `'modal'`). Drawer's default too.
|
|
8324
|
+
* @default 'modal'
|
|
8325
|
+
*/
|
|
8326
|
+
modalType?: Extract<ModalType, 'modal' | 'non-modal'>;
|
|
8327
|
+
/**
|
|
8328
|
+
* Removes the panel when the drawer closes. `false` keeps it mounted while closed, out of view
|
|
8329
|
+
* and `inert`, so the state of what is inside survives, and a Hamburger outside can point
|
|
8330
|
+
* `aria-controls` at it at all times: always for an inline drawer, and once the page has
|
|
8331
|
+
* hydrated for an overlay (whose panel is not in the server HTML). Fluent's `unmountOnClose`.
|
|
8332
|
+
* Drawer's default too.
|
|
8333
|
+
* @default true
|
|
8334
|
+
*/
|
|
8335
|
+
unmountOnClose?: boolean;
|
|
8336
|
+
/**
|
|
8337
|
+
* Where focus goes when the drawer closes with focus inside it (a modal overlay: whenever it
|
|
8338
|
+
* closes). Pass your page's Hamburger, so a Hamburger inside the drawer that closes it hands
|
|
8339
|
+
* focus to the one that opens it again.
|
|
8340
|
+
*/
|
|
8341
|
+
finalFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
8342
|
+
/**
|
|
8343
|
+
* The backdrop of a modal overlay (Drawer's `backdrop` slot: `null` renders none, a slot
|
|
8344
|
+
* object's `appearance` picks the fill). Ignored, with a development warning, by a non-modal or
|
|
8345
|
+
* inline drawer.
|
|
8346
|
+
*/
|
|
8347
|
+
backdrop?: Slot<'div'> | (SlotObject<'div'> & {
|
|
8348
|
+
appearance?: BackdropAppearance;
|
|
8349
|
+
});
|
|
8350
|
+
/**
|
|
8351
|
+
* Name of the navigation landmark (and of an overlay's dialog). Localize it; rename it when the
|
|
8352
|
+
* page has another navigation landmark (two with one name are ambiguous). An `aria-labelledby`
|
|
8353
|
+
* replaces the default.
|
|
8354
|
+
* @default 'Navigation'
|
|
8355
|
+
*/
|
|
8356
|
+
'aria-label'?: string;
|
|
8357
|
+
/** `NavDrawer.Header`, `NavDrawer.Body` and `NavDrawer.Footer`, rendered in the order written. */
|
|
8358
|
+
children?: React_2.ReactNode;
|
|
8359
|
+
/** Ref to the panel: the `role="dialog"` element of an overlay drawer, the panel element of an inline one. */
|
|
8360
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
8361
|
+
}
|
|
8362
|
+
|
|
7090
8363
|
/**
|
|
7091
8364
|
* A top-level navigation entry: a link when `href` is given (anchor props), a button otherwise
|
|
7092
8365
|
* (button props). Clicking selects it (`aria-current="page"`); activating a disabled entry never
|
|
@@ -7098,6 +8371,9 @@ export declare const navClassNames: {
|
|
|
7098
8371
|
* `onClick` calls `preventDefault()` (client-side routing), the browser opens nothing, so the item
|
|
7099
8372
|
* is selected whatever the keys, button or `target`.
|
|
7100
8373
|
*
|
|
8374
|
+
* `actions` puts your own controls (a pin toggle, a menu button) beside the item in its row, in a
|
|
8375
|
+
* group named by the item; they never select it.
|
|
8376
|
+
*
|
|
7101
8377
|
* Typed by overloads, resolved in order: without `href` (button props, button events), with a
|
|
7102
8378
|
* string `href` (anchor props, anchor events), then an `href` that may be `undefined` at run time
|
|
7103
8379
|
* ({@link NavItemDynamicProps}: events of either element).
|
|
@@ -7141,13 +8417,14 @@ export declare interface NavItemButtonProps extends NavItemOwnProps, NoAnchorOnl
|
|
|
7141
8417
|
|
|
7142
8418
|
/**
|
|
7143
8419
|
* 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
|
|
8420
|
+
* `icon` on the icon span; `content` on the label span; `actions` on the group of its `actions`.
|
|
7145
8421
|
*/
|
|
7146
8422
|
export declare const navItemClassNames: {
|
|
7147
8423
|
readonly root: "wave-nav-item";
|
|
7148
8424
|
readonly listItem: "wave-nav-item__list-item";
|
|
7149
8425
|
readonly icon: "wave-nav-item__icon";
|
|
7150
8426
|
readonly content: "wave-nav-item__content";
|
|
8427
|
+
readonly actions: "wave-nav-item__actions";
|
|
7151
8428
|
};
|
|
7152
8429
|
|
|
7153
8430
|
/**
|
|
@@ -7192,6 +8469,20 @@ export declare interface NavItemOwnProps {
|
|
|
7192
8469
|
disabled?: boolean;
|
|
7193
8470
|
/** Label content. */
|
|
7194
8471
|
children?: React_2.ReactNode;
|
|
8472
|
+
/**
|
|
8473
|
+
* Controls beside the item in its row (Fluent's SplitNavItem): a ToggleButton that pins the
|
|
8474
|
+
* page, a MenuButton with more commands, each with its own name (a Tooltip with
|
|
8475
|
+
* `relationship="label"` names an icon-only one). They render after the item's link or button,
|
|
8476
|
+
* never inside it, in a group named by the item; each is a Tab stop after the item, and a click
|
|
8477
|
+
* or key on one never selects the item. They are drawn while the row is hovered or has focus,
|
|
8478
|
+
* while one of them is pressed or has its popup open, and always in forced colours and on touch
|
|
8479
|
+
* screens; otherwise they are transparent and still focusable. They stay enabled when the item
|
|
8480
|
+
* is `disabled`. With actions, the selected background and indicator are drawn on the row (the
|
|
8481
|
+
* item's list item, `.wave-nav-item__list-item`), so a `className` on the item no longer covers
|
|
8482
|
+
* them. Content that renders nothing renders no group. Fluent's `actionButton`, `toggleButton`
|
|
8483
|
+
* and `menuButton` slots and their tooltips are your own controls here.
|
|
8484
|
+
*/
|
|
8485
|
+
actions?: React_2.ReactNode;
|
|
7195
8486
|
}
|
|
7196
8487
|
|
|
7197
8488
|
/**
|
|
@@ -7246,11 +8537,43 @@ export declare interface NavProps extends Omit<React_2.HTMLAttributes<HTMLElemen
|
|
|
7246
8537
|
ref?: React_2.Ref<HTMLElement>;
|
|
7247
8538
|
}
|
|
7248
8539
|
|
|
8540
|
+
/**
|
|
8541
|
+
* A heading between groups of items (`<h3>` by default, `headingLevel`), in its own list item. It
|
|
8542
|
+
* names nothing by itself: place it before the items it introduces. A header whose children render
|
|
8543
|
+
* nothing renders nothing. It may also sit in a `Nav.Category`, between its sub-items.
|
|
8544
|
+
*
|
|
8545
|
+
* Also exported as `NavSectionHeader` (import the flat name from React Server Components).
|
|
8546
|
+
*/
|
|
8547
|
+
export declare const NavSectionHeader: {
|
|
8548
|
+
({ headingLevel, className, children, ref, ...rest }: NavSectionHeaderProps): React_2.JSX.Element | null;
|
|
8549
|
+
displayName: string;
|
|
8550
|
+
};
|
|
8551
|
+
|
|
8552
|
+
/** Nav.SectionHeader: `root` on the heading element; `listItem` on the list item around it. */
|
|
8553
|
+
export declare const navSectionHeaderClassNames: {
|
|
8554
|
+
readonly root: "wave-nav-section-header";
|
|
8555
|
+
readonly listItem: "wave-nav-section-header__list-item";
|
|
8556
|
+
};
|
|
8557
|
+
|
|
8558
|
+
/** Properties for the NavSectionHeader sub-component. */
|
|
8559
|
+
export declare interface NavSectionHeaderProps extends React_2.HTMLAttributes<HTMLHeadingElement> {
|
|
8560
|
+
/**
|
|
8561
|
+
* Level of the heading element (`<h1>` … `<h6>`). Pick the level that fits the page's outline.
|
|
8562
|
+
* Fluent's NavSectionHeader changes its element through `as`.
|
|
8563
|
+
* @default 3
|
|
8564
|
+
*/
|
|
8565
|
+
headingLevel?: HeadingLevel;
|
|
8566
|
+
/** The header text. A header whose children render nothing renders nothing at all. */
|
|
8567
|
+
children?: React_2.ReactNode;
|
|
8568
|
+
/** Ref to the heading element. */
|
|
8569
|
+
ref?: React_2.Ref<HTMLHeadingElement>;
|
|
8570
|
+
}
|
|
8571
|
+
|
|
7249
8572
|
/**
|
|
7250
8573
|
* An indented entry inside a `Nav.Category`: a link when `href` is given, a button otherwise.
|
|
7251
8574
|
* Selected like `Nav.Item` (a click that the browser opens somewhere else selects nothing; one
|
|
7252
8575
|
* whose default your `onClick` prevents is selected), and typed by overloads like `Nav.Item`
|
|
7253
|
-
* (button, link, then {@link NavSubItemDynamicProps}).
|
|
8576
|
+
* (button, link, then {@link NavSubItemDynamicProps}). Takes `actions` like `Nav.Item`.
|
|
7254
8577
|
*
|
|
7255
8578
|
* Also exported as `NavSubItem` (import the flat name from React Server Components).
|
|
7256
8579
|
*/
|
|
@@ -7286,10 +8609,14 @@ export declare interface NavSubItemButtonProps extends NavSubItemOwnProps, NoAnc
|
|
|
7286
8609
|
ref?: React_2.Ref<HTMLButtonElement>;
|
|
7287
8610
|
}
|
|
7288
8611
|
|
|
7289
|
-
/**
|
|
8612
|
+
/**
|
|
8613
|
+
* Nav.SubItem: `root` on the `<a>` or `<button>`; `listItem` on the `<li>` around it; `actions` on
|
|
8614
|
+
* the group of its `actions`.
|
|
8615
|
+
*/
|
|
7290
8616
|
export declare const navSubItemClassNames: {
|
|
7291
8617
|
readonly root: "wave-nav-sub-item";
|
|
7292
8618
|
readonly listItem: "wave-nav-sub-item__list-item";
|
|
8619
|
+
readonly actions: "wave-nav-sub-item__actions";
|
|
7293
8620
|
};
|
|
7294
8621
|
|
|
7295
8622
|
/**
|
|
@@ -9939,6 +11266,12 @@ export declare interface StrictImageProps extends Omit<ImageProps, 'alt'> {
|
|
|
9939
11266
|
alt: string;
|
|
9940
11267
|
}
|
|
9941
11268
|
|
|
11269
|
+
/**
|
|
11270
|
+
* Size of an overlay surface: Dialog.Content's width cap, a Drawer's width (its height at the
|
|
11271
|
+
* bottom). `small`, `medium`, `large`, or `full`, the whole viewport.
|
|
11272
|
+
*/
|
|
11273
|
+
export declare type SurfaceSize = CoreSize | 'full';
|
|
11274
|
+
|
|
9942
11275
|
/** Represents a single color swatch option. */
|
|
9943
11276
|
export declare interface SwatchItem {
|
|
9944
11277
|
/** Unique identifier for the swatch (the value `onValueChange` reports and a form submits). */
|
|
@@ -10074,7 +11407,7 @@ export declare interface SwatchPickerProps extends Omit<React_2.HTMLAttributes<H
|
|
|
10074
11407
|
* applies, as the group cannot carry `aria-required`.
|
|
10075
11408
|
* @default 'arrow'
|
|
10076
11409
|
*/
|
|
10077
|
-
focusMode?:
|
|
11410
|
+
focusMode?: FocusMode;
|
|
10078
11411
|
/** Built-in strings, for localization. */
|
|
10079
11412
|
labels?: SwatchPickerLabels;
|
|
10080
11413
|
/** Size of each swatch button (20, 24, 32 or 40px). A 20px swatch passes the target-size bar
|
|
@@ -10631,55 +11964,304 @@ export declare interface TabProps extends React_2.ButtonHTMLAttributes<HTMLButto
|
|
|
10631
11964
|
* A compact label (a "chip") for a keyword, category or filter, optionally dismissible.
|
|
10632
11965
|
*
|
|
10633
11966
|
* - 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.
|
|
11967
|
+
* name is `dismissLabel` plus the tag's text (its children; not `media`, `icon` or
|
|
11968
|
+
* `secondaryText`): "Dismiss Cherry", so a row of tags has distinguishable dismiss buttons.
|
|
11969
|
+
* Enter, Space, Delete and Backspace on it dismiss the tag (a held key dismisses once), and so do
|
|
11970
|
+
* Delete and Backspace on a link in the tag's text.
|
|
10636
11971
|
* - `dismissIcon` replaces only the icon inside that button (see {@link TagOwnProps.dismissIcon}).
|
|
10637
|
-
* -
|
|
10638
|
-
*
|
|
10639
|
-
*
|
|
10640
|
-
*
|
|
10641
|
-
*
|
|
10642
|
-
*
|
|
11972
|
+
* - The look: `appearance` (`filled`, `outline` or `brand`), `size` (28, 24 or 20px tall),
|
|
11973
|
+
* `shape` (`circular` or `rounded`) and the look-only `selected`, rendered as `data-appearance`,
|
|
11974
|
+
* `data-size`, `data-shape` and `data-selected`. `disabled` dims the tag and disables its
|
|
11975
|
+
* dismiss button natively (`data-disabled`).
|
|
11976
|
+
* - Slots before and under the text: `media` (an Avatar, sized for the tag), a decorative `icon`
|
|
11977
|
+
* and a second line, `secondaryText`.
|
|
11978
|
+
* - In a TagGroup, a tag takes the group's `size`, `appearance`, `shape` and `dismissible` unless
|
|
11979
|
+
* it sets its own, is disabled with the group, reports its dismissal to the group's
|
|
11980
|
+
* `onDismiss(value)`, and is a list item in a `role="list"` group.
|
|
11981
|
+
* - Polymorphic: `as="a"` renders a link chip with anchor props type-checked. A dismissible link
|
|
11982
|
+
* chip puts the link in the content, `<Tag dismissible><a href>…</a></Tag>`: a dismiss button
|
|
11983
|
+
* cannot sit inside a link.
|
|
11984
|
+
*
|
|
11985
|
+
* **Focus after dismissal.** A tag cannot keep focus once you remove it. In a TagGroup, focus
|
|
11986
|
+
* moves to the next tag for you (else the previous one, else the group's `fallbackFocusRef`). For
|
|
11987
|
+
* a standalone tag, move focus to the next tag's dismiss button, else the previous one, else a
|
|
11988
|
+
* nearby control, then remove the tag: the neighbour stays mounted, so you can focus it in
|
|
11989
|
+
* `onDismiss` before removing the tag.
|
|
10643
11990
|
*
|
|
10644
11991
|
* @example
|
|
10645
11992
|
* <Tag>React</Tag>
|
|
11993
|
+
* <Tag appearance="brand" size="small">Beta</Tag>
|
|
10646
11994
|
* <Tag dismissible onDismiss={() => remove('cherry')}>Cherry</Tag>
|
|
11995
|
+
* <Tag media={<Avatar name="Katri Athokas" />} secondaryText="Designer">Katri</Tag>
|
|
10647
11996
|
* <Tag dismissible dismissLabel="Remove" dismissIcon={<CloseIcon />}>Cherry</Tag>
|
|
10648
11997
|
*/
|
|
10649
11998
|
export declare const Tag: PolymorphicComponent<'span', TagOwnProps>;
|
|
10650
11999
|
|
|
12000
|
+
/** Colour scheme of a tag (Fluent's `TagAppearance`): a neutral fill, a border, or a light brand tint. */
|
|
12001
|
+
export declare type TagAppearance = 'filled' | 'outline' | 'brand';
|
|
12002
|
+
|
|
10651
12003
|
/**
|
|
10652
|
-
* Tag: `root` on the rendered element (your `as`, default `<span>`); `
|
|
10653
|
-
*
|
|
10654
|
-
* `
|
|
12004
|
+
* Tag: `root` on the rendered element (your `as`, default `<span>`); `media` on the element of the
|
|
12005
|
+
* media slot; `icon` on the icon box; `primaryText` on the content span; `secondaryText` on the
|
|
12006
|
+
* second line of text; `dismissButton` on the Dismiss button; `dismissIcon` on the icon inside it
|
|
12007
|
+
* (what `dismissIcon` renders, a merged Button's icon span, else the default `<svg>`).
|
|
10655
12008
|
*/
|
|
10656
12009
|
export declare const tagClassNames: {
|
|
10657
12010
|
readonly root: "wave-tag";
|
|
12011
|
+
readonly media: "wave-tag__media";
|
|
12012
|
+
readonly icon: "wave-tag__icon";
|
|
10658
12013
|
readonly primaryText: "wave-tag__primary-text";
|
|
12014
|
+
readonly secondaryText: "wave-tag__secondary-text";
|
|
10659
12015
|
readonly dismissButton: "wave-tag__dismiss-button";
|
|
10660
12016
|
readonly dismissIcon: "wave-tag__dismiss-icon";
|
|
10661
12017
|
};
|
|
10662
12018
|
|
|
12019
|
+
/**
|
|
12020
|
+
* A set of tags with one keyboard model: by default an APG toolbar (`role="toolbar"`), or with
|
|
12021
|
+
* `role="list"` a list of tags that only display.
|
|
12022
|
+
*
|
|
12023
|
+
* - **Toolbar** (the default): one Tab stop, the last focused control (at first the first enabled
|
|
12024
|
+
* one). Left/Right move between the controls when horizontal (mirrored in RTL), Up/Down when
|
|
12025
|
+
* `orientation="vertical"`, the other axis does nothing; the arrows wrap, in DOM order across
|
|
12026
|
+
* wrapped rows, and Home/End jump to the first and last control, the same rule as Toolbar.
|
|
12027
|
+
* Natively disabled controls are skipped. Use it for tags that are actions: dismissible tags,
|
|
12028
|
+
* InteractionTags (both of their buttons join the arrow order), link chips. Renders
|
|
12029
|
+
* `aria-orientation`, and `aria-disabled` while disabled.
|
|
12030
|
+
* - **List** (`role="list"`): every tag is a list item (`role="listitem"`), every control keeps
|
|
12031
|
+
* its own Tab stop and the group handles no arrow key. A tag rendered as a link or a button
|
|
12032
|
+
* takes no list item role: put the link in the tag's content (`<Tag><a href>…</a></Tag>`), or
|
|
12033
|
+
* wrap the tag in an element with `role="listitem"`.
|
|
12034
|
+
* - **Delete and Backspace** on a tag's Dismiss button, on either button of an InteractionTag with
|
|
12035
|
+
* an `InteractionTag.Secondary`, or on a link in a dismissible tag's text, dismiss the tag (a
|
|
12036
|
+
* held key dismisses one tag). Enter, Space and a click on the Dismiss button do too.
|
|
12037
|
+
* - **Defaults for its tags**: `size`, `appearance`, `shape` and, for Tags, `dismissible` (a tag's
|
|
12038
|
+
* own value wins; an InteractionTag is dismissible when it has a Secondary), and `disabled`,
|
|
12039
|
+
* which disables every tag (a tag cannot re-enable itself).
|
|
12040
|
+
* - **`onDismiss(value)`** is called on every dismissal, after the Tag's own `onDismiss` or the
|
|
12041
|
+
* Secondary's `onClick` (whose `preventDefault()` keeps the group from being called). Remove
|
|
12042
|
+
* the tag from your state: when the tag that had focus goes, focus moves to the next tag, else
|
|
12043
|
+
* the previous one, else `fallbackFocusRef`, so it never falls to the page. Give every tag a
|
|
12044
|
+
* `value`. A dismissal you refuse (the tag stays) moves no focus.
|
|
12045
|
+
* - **Selection**: with `value`, `defaultValue` or `onValueChange` (Fluent's `selectedValues`,
|
|
12046
|
+
* `defaultSelectedValues` and `onTagSelect`) the group selects. Each `InteractionTag.Primary`
|
|
12047
|
+
* is then a toggle (`aria-pressed`): a click, Enter or Space adds its tag's `value` to the
|
|
12048
|
+
* selection or removes it, after the Primary's `onClick` (whose `preventDefault()` cancels the
|
|
12049
|
+
* toggle); the arrow keys only move. `onValueChange` receives the values in selection order,
|
|
12050
|
+
* and values without a tag are kept. Dismissing a selected InteractionTag calls `onDismiss`
|
|
12051
|
+
* and then `onValueChange` without its value. Plain Tags are never selected; selection is
|
|
12052
|
+
* multiple only (RadioGroup or `Toolbar.RadioGroup` for a single choice).
|
|
12053
|
+
* - **Forms**: a selecting group with `name` submits one entry per selected value, also from
|
|
12054
|
+
* outside its form with `form`; `required` blocks the submission of an empty selection and
|
|
12055
|
+
* moves focus to the group's Tab stop (native validation only, no `aria-required`); a form
|
|
12056
|
+
* reset restores `defaultValue`. A disabled group submits nothing, and a group that does not
|
|
12057
|
+
* select renders no form input.
|
|
12058
|
+
* - No accessible name by default: name the group with `aria-label` or `aria-labelledby`.
|
|
12059
|
+
* - Renders `data-orientation`, `data-size`, `data-appearance`, `data-shape` and, while
|
|
12060
|
+
* disabled, `data-disabled`.
|
|
12061
|
+
*
|
|
12062
|
+
* @example
|
|
12063
|
+
* const [filters, setFilters] = React.useState(['Red', 'Blue', 'Large']);
|
|
12064
|
+
* const reset = React.useRef<HTMLButtonElement>(null);
|
|
12065
|
+
* <TagGroup
|
|
12066
|
+
* aria-label="Active filters"
|
|
12067
|
+
* dismissible
|
|
12068
|
+
* fallbackFocusRef={reset}
|
|
12069
|
+
* onDismiss={(value) => setFilters((current) => current.filter((f) => f !== value))}
|
|
12070
|
+
* >
|
|
12071
|
+
* {filters.map((filter) => (
|
|
12072
|
+
* <Tag key={filter} value={filter}>
|
|
12073
|
+
* {filter}
|
|
12074
|
+
* </Tag>
|
|
12075
|
+
* ))}
|
|
12076
|
+
* </TagGroup>
|
|
12077
|
+
* <Button ref={reset} onClick={() => setFilters(['Red', 'Blue', 'Large'])}>Reset filters</Button>
|
|
12078
|
+
*
|
|
12079
|
+
* @example
|
|
12080
|
+
* // Selectable chips, submitted with a form as "fruit".
|
|
12081
|
+
* const [fruit, setFruit] = React.useState<string[]>(['plum']);
|
|
12082
|
+
* <TagGroup aria-label="Fruit" name="fruit" value={fruit} onValueChange={setFruit}>
|
|
12083
|
+
* <InteractionTag value="cherry">
|
|
12084
|
+
* <InteractionTag.Primary>Cherry</InteractionTag.Primary>
|
|
12085
|
+
* </InteractionTag>
|
|
12086
|
+
* <InteractionTag value="plum">
|
|
12087
|
+
* <InteractionTag.Primary>Plum</InteractionTag.Primary>
|
|
12088
|
+
* </InteractionTag>
|
|
12089
|
+
* </TagGroup>
|
|
12090
|
+
*/
|
|
12091
|
+
export declare const TagGroup: {
|
|
12092
|
+
({ 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;
|
|
12093
|
+
displayName: string;
|
|
12094
|
+
};
|
|
12095
|
+
|
|
12096
|
+
/** TagGroup: `root` on the group element (the toolbar or the list). */
|
|
12097
|
+
export declare const tagGroupClassNames: {
|
|
12098
|
+
readonly root: "wave-tag-group";
|
|
12099
|
+
};
|
|
12100
|
+
|
|
12101
|
+
/** Props of {@link TagGroup}: the element that holds the tags (a `<div>`). */
|
|
12102
|
+
export declare interface TagGroupProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'defaultValue'> {
|
|
12103
|
+
/**
|
|
12104
|
+
* `'toolbar'`: one Tab stop and arrow keys, for tags that are actions (dismissible tags,
|
|
12105
|
+
* InteractionTags, links). `'list'`: a list (every tag gets `role="listitem"`), each control
|
|
12106
|
+
* its own Tab stop and no arrow keys, for tags that only display. Another role keeps the
|
|
12107
|
+
* toolbar keyboard; `'listbox'` is not supported (an option cannot hold a Dismiss button).
|
|
12108
|
+
* Name the group with `aria-label` or `aria-labelledby`.
|
|
12109
|
+
* @default 'toolbar'
|
|
12110
|
+
*/
|
|
12111
|
+
role?: React_2.AriaRole;
|
|
12112
|
+
/**
|
|
12113
|
+
* Layout and arrow-key axis, as on Toolbar: Left/Right (mirrored in RTL) when horizontal,
|
|
12114
|
+
* Up/Down when vertical; a wrapping set moves in DOM order. `aria-orientation` (toolbar role)
|
|
12115
|
+
* and `data-orientation`.
|
|
12116
|
+
* @default 'horizontal'
|
|
12117
|
+
*/
|
|
12118
|
+
orientation?: Orientation;
|
|
12119
|
+
/** Default `size` of its tags (a tag's own wins) and the gap between them. @default 'medium' */
|
|
12120
|
+
size?: TagSize;
|
|
12121
|
+
/** Default `appearance` of its tags (a tag's own wins). @default 'filled' */
|
|
12122
|
+
appearance?: TagAppearance;
|
|
12123
|
+
/** Default `shape` of its tags (a tag's own wins). @default 'circular' */
|
|
12124
|
+
shape?: TagShape;
|
|
12125
|
+
/**
|
|
12126
|
+
* Disables every tag: a tag cannot re-enable itself. A control that has focus keeps it,
|
|
12127
|
+
* unavailable, until focus leaves it. `aria-disabled` (not with `role="list"`), `data-disabled`.
|
|
12128
|
+
* @default false
|
|
12129
|
+
*/
|
|
12130
|
+
disabled?: boolean;
|
|
12131
|
+
/**
|
|
12132
|
+
* Default `dismissible` of its Tags (a Tag's own value wins). An InteractionTag is dismissible
|
|
12133
|
+
* when it has an `InteractionTag.Secondary`.
|
|
12134
|
+
* @default false
|
|
12135
|
+
*/
|
|
12136
|
+
dismissible?: boolean;
|
|
12137
|
+
/**
|
|
12138
|
+
* Called with the tag's `value` on every dismissal: a click, Enter or Space on a Dismiss
|
|
12139
|
+
* button, or Delete or Backspace on a tag (Fluent's `onDismiss(event, { value })`). Remove the
|
|
12140
|
+
* tag from your state; when it goes, focus moves to the next tag, else the previous one, else
|
|
12141
|
+
* `fallbackFocusRef`. Fluent's TagGroup moves focus as it calls `onDismiss`, whether or not the
|
|
12142
|
+
* tag goes, and has no fallback. Dismissing a selected tag also removes its value from the
|
|
12143
|
+
* selection; Fluent's TagGroup leaves the selection alone.
|
|
12144
|
+
*/
|
|
12145
|
+
onDismiss?: (value: string) => void;
|
|
12146
|
+
/**
|
|
12147
|
+
* Where focus goes when the tag that had it is removed and no other tag can take it, for
|
|
12148
|
+
* example an "Add" or "Reset filters" button outside the group. WaveUI-only.
|
|
12149
|
+
*/
|
|
12150
|
+
fallbackFocusRef?: React_2.RefObject<HTMLElement | null>;
|
|
12151
|
+
/**
|
|
12152
|
+
* The selected values (controlled), in selection order: the `value`s of the pressed
|
|
12153
|
+
* InteractionTags. Passing `value`, `defaultValue` or `onValueChange` makes the group select
|
|
12154
|
+
* (Fluent's `selectedValues`). Plain Tags are never selected.
|
|
12155
|
+
*/
|
|
12156
|
+
value?: readonly string[];
|
|
12157
|
+
/** Initially selected values (uncontrolled; Fluent's `defaultSelectedValues`). @default [] */
|
|
12158
|
+
defaultValue?: readonly string[];
|
|
12159
|
+
/** Called with the new selected values when they change (Fluent's `onTagSelect`). */
|
|
12160
|
+
onValueChange?: (value: string[]) => void;
|
|
12161
|
+
/**
|
|
12162
|
+
* Form field name: one hidden input per selected value (a selecting group only). Fluent's
|
|
12163
|
+
* TagGroup submits nothing.
|
|
12164
|
+
*/
|
|
12165
|
+
name?: string;
|
|
12166
|
+
/** The id of the form the hidden inputs belong to, when the group is outside it. */
|
|
12167
|
+
form?: string;
|
|
12168
|
+
/**
|
|
12169
|
+
* An empty selection blocks the form's submission (native validation only: a toolbar has no
|
|
12170
|
+
* `aria-required`).
|
|
12171
|
+
* @default false
|
|
12172
|
+
*/
|
|
12173
|
+
required?: boolean;
|
|
12174
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
12175
|
+
}
|
|
12176
|
+
|
|
10663
12177
|
/**
|
|
10664
12178
|
* 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`).
|
|
12179
|
+
* Every other prop comes from the rendered element (`as`, default `span`). The own props shadow
|
|
12180
|
+
* the element's attributes of the same names: `TagProps<'button'>['value']` is a `string`.
|
|
10666
12181
|
*/
|
|
10667
12182
|
export declare interface TagOwnProps {
|
|
10668
12183
|
/**
|
|
10669
|
-
*
|
|
10670
|
-
*
|
|
12184
|
+
* Colour scheme: `filled` (a neutral fill), `outline` (a border on the surface behind it) or
|
|
12185
|
+
* `brand` (a light brand tint that follows the brand ramp).
|
|
12186
|
+
* @default the TagGroup's `appearance`, else 'filled'
|
|
12187
|
+
*/
|
|
12188
|
+
appearance?: TagAppearance;
|
|
12189
|
+
/**
|
|
12190
|
+
* `medium` (28px tall, the 0.10 look), `small` (24px) or `extra-small` (20px); an Avatar in
|
|
12191
|
+
* `media` is 24, 20 or 16px. Fluent's medium tag is 32px.
|
|
12192
|
+
* @default the TagGroup's `size`, else 'medium'
|
|
12193
|
+
*/
|
|
12194
|
+
size?: TagSize;
|
|
12195
|
+
/**
|
|
12196
|
+
* `circular` (a pill, the 0.10 look) or `rounded` (4px corners). Fluent's default is `rounded`.
|
|
12197
|
+
* @default the TagGroup's `shape`, else 'circular'
|
|
12198
|
+
*/
|
|
12199
|
+
shape?: TagShape;
|
|
12200
|
+
/**
|
|
12201
|
+
* Dims the tag and disables its Dismiss button natively (no `onDismiss`, out of the Tab
|
|
12202
|
+
* order), whatever `dismissIcon` passes. A disabled TagGroup disables every tag. A Dismiss
|
|
12203
|
+
* button that has focus when the tag is disabled keeps it, unavailable, until focus leaves it.
|
|
12204
|
+
* Rendered as `data-disabled`. With `as="a"` the link is disabled too: `aria-disabled="true"`,
|
|
12205
|
+
* `role="link"`, no `href` (out of the Tab order) and no click; a link that has focus keeps it,
|
|
12206
|
+
* and its `href`, until focus leaves it. With another `as`, an element that takes a native
|
|
12207
|
+
* `disabled` (a `<button>`) or a component receives `disabled`; a `<button>` that has focus
|
|
12208
|
+
* when it is disabled keeps it, unavailable (`aria-disabled`, no click), until focus leaves it.
|
|
12209
|
+
* @default false
|
|
12210
|
+
*/
|
|
12211
|
+
disabled?: boolean;
|
|
12212
|
+
/**
|
|
12213
|
+
* Draws the selected look (the brand fill) and sets `data-selected`. A Tag is not interactive,
|
|
12214
|
+
* so the state is not announced: for a tag the user selects, use `InteractionTag` (its
|
|
12215
|
+
* `InteractionTag.Primary` is a toggle button). Disabled wins over the selected look.
|
|
12216
|
+
* @default false
|
|
12217
|
+
*/
|
|
12218
|
+
selected?: boolean;
|
|
12219
|
+
/**
|
|
12220
|
+
* Identifies the tag in a TagGroup: the value its `onDismiss` receives (without one, a generated
|
|
12221
|
+
* id). Give every tag of a group its own value. Renders nothing on the default `<span>`; with
|
|
12222
|
+
* `as`, an element that takes a native `value` (a `<button>`, an `<li>`) still receives it.
|
|
12223
|
+
*/
|
|
12224
|
+
value?: string;
|
|
12225
|
+
/**
|
|
12226
|
+
* A visual before the text, usually an `Avatar`, which takes the tag's size (24, 20 or 16px)
|
|
12227
|
+
* unless it sets its own `size`. Not interactive. It is not hidden from assistive technology:
|
|
12228
|
+
* pass `decorative` to an Avatar whose name repeats the tag's text. Use `media` or `icon`, not
|
|
12229
|
+
* both.
|
|
12230
|
+
*/
|
|
12231
|
+
media?: Slot<'span'>;
|
|
12232
|
+
/** A decorative icon before the text (`aria-hidden`), in a 20, 16 or 12px box. */
|
|
12233
|
+
icon?: Slot<'span'>;
|
|
12234
|
+
/**
|
|
12235
|
+
* A second, smaller line under the text (`secondaryText="Designer"`). It is not part of the
|
|
12236
|
+
* Dismiss button's name. A small or extra-small tag grows to 28px to fit it.
|
|
12237
|
+
*/
|
|
12238
|
+
secondaryText?: React_2.ReactNode;
|
|
12239
|
+
/**
|
|
12240
|
+
* Whether the tag renders a Dismiss button. `onDismiss` and `dismissIcon` take effect only with
|
|
12241
|
+
* it (a development warning says so when they are passed without it). `dismissible={false}`
|
|
12242
|
+
* opts a tag out of a dismissible TagGroup. A Dismiss button cannot sit inside a link or a
|
|
12243
|
+
* button: a dismissible tag rendered as one holds it inside (a development warning). For a
|
|
12244
|
+
* dismissible link chip, put the link in the content,
|
|
12245
|
+
* `<Tag dismissible><a href="/topics/react">React</a></Tag>`; for an action with a separate
|
|
12246
|
+
* Dismiss button, use `InteractionTag`. Fluent's dismissible Tag is a single button that
|
|
12247
|
+
* dismisses when it is activated.
|
|
12248
|
+
* @default the TagGroup's `dismissible`, else `false`
|
|
10671
12249
|
*/
|
|
10672
12250
|
dismissible?: boolean;
|
|
10673
12251
|
/**
|
|
10674
|
-
* Called when the
|
|
10675
|
-
* the
|
|
10676
|
-
*
|
|
12252
|
+
* Called when the Dismiss button is activated: a click, Enter, Space, Delete or Backspace (a
|
|
12253
|
+
* held key dismisses once). Passing it does not render the button: set `dismissible` too. In a
|
|
12254
|
+
* TagGroup the group's `onDismiss(value)` is called after it, and focus moves to the next tag
|
|
12255
|
+
* when the tag is removed. A standalone Tag cannot keep focus once you remove it: move focus
|
|
12256
|
+
* yourself (see "Focus after dismissal" on {@link Tag}). Fluent's Tag dismisses on Delete and
|
|
12257
|
+
* Backspace only inside a TagGroup.
|
|
10677
12258
|
*/
|
|
10678
12259
|
onDismiss?: () => void;
|
|
10679
12260
|
/**
|
|
10680
12261
|
* 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
|
-
*
|
|
12262
|
+
* `<button type="button">`, wired to `onDismiss` and named by `dismissLabel` plus the tag's text
|
|
12263
|
+
* (its children; not `media`, `icon` or `secondaryText`); this slot only replaces the icon
|
|
12264
|
+
* inside it.
|
|
10683
12265
|
*
|
|
10684
12266
|
* A `<button>` element or a Wave `Button` passed here is not nested (a button cannot contain a
|
|
10685
12267
|
* button): its props are merged into the dismiss button (its `onClick` runs first and can call
|
|
@@ -10697,7 +12279,7 @@ export declare interface TagOwnProps {
|
|
|
10697
12279
|
* The `aria-*` attributes of an icon slot object also go to the dismiss button, because the icon
|
|
10698
12280
|
* is `aria-hidden`.
|
|
10699
12281
|
*
|
|
10700
|
-
* The dismiss button's name is `dismissLabel` plus the tag
|
|
12282
|
+
* The dismiss button's name is `dismissLabel` plus the tag's text ("Dismiss Cherry"):
|
|
10701
12283
|
* `aria-label` and `aria-labelledby` on the slot are ignored (development warning). Icon
|
|
10702
12284
|
* content is decorative (`aria-hidden`). The children of a merged `<button>`/`Button` (or its
|
|
10703
12285
|
* `dangerouslySetInnerHTML` markup) are rendered as is inside the dismiss button, next to the
|
|
@@ -10717,58 +12299,162 @@ export declare interface TagOwnProps {
|
|
|
10717
12299
|
*/
|
|
10718
12300
|
dismissIcon?: Slot<'span'> | SlotObject<'button'>;
|
|
10719
12301
|
/**
|
|
10720
|
-
* Visually hidden text that names the dismiss button together with the tag
|
|
10721
|
-
*
|
|
10722
|
-
* merged `<button>` slot replaces it (see
|
|
12302
|
+
* Visually hidden text that names the dismiss button together with the tag's text (its
|
|
12303
|
+
* children; not `media`, `icon` or `secondaryText`; `aria-labelledby`), e.g. "Dismiss Cherry".
|
|
12304
|
+
* Localise it here. A text label rendered by a merged `<button>` slot replaces it (see
|
|
12305
|
+
* `dismissIcon`). TagPicker names the Dismiss buttons of the tags it renders itself with its
|
|
12306
|
+
* `labels.remove`.
|
|
10723
12307
|
* @default 'Dismiss'
|
|
10724
12308
|
*/
|
|
10725
12309
|
dismissLabel?: string;
|
|
10726
12310
|
}
|
|
10727
12311
|
|
|
10728
12312
|
/**
|
|
10729
|
-
* A multi-select combobox that shows the selected values as removable tags.
|
|
10730
|
-
*
|
|
10731
|
-
*
|
|
10732
|
-
*
|
|
10733
|
-
*
|
|
10734
|
-
*
|
|
10735
|
-
*
|
|
10736
|
-
*
|
|
10737
|
-
*
|
|
10738
|
-
* `
|
|
10739
|
-
*
|
|
12313
|
+
* A multi-select combobox that shows the selected values as removable tags.
|
|
12314
|
+
*
|
|
12315
|
+
* - **Two forms.** The array form, `<TagPicker options={…} />`, is the parts with their defaults:
|
|
12316
|
+
* `TagPicker.Control` (holding `TagPicker.Group` and `TagPicker.Input`) and `TagPicker.List`.
|
|
12317
|
+
* The parts form replaces only the part you need: your own Tags in `TagPicker.Group` (an
|
|
12318
|
+
* Avatar in each), rich `TagPicker.Option`s in `TagPicker.List`, or `TagPicker.Button`, a
|
|
12319
|
+
* select-only trigger, in place of the Input. Render `TagPicker.Control` and `TagPicker.List`
|
|
12320
|
+
* directly inside TagPicker (a Fragment is fine); without a List the default list is added.
|
|
12321
|
+
* `options` names the values in both forms (`media` and `secondaryContent` show in the default
|
|
12322
|
+
* options, `media` in the default tags too); with a List that has children, its options are
|
|
12323
|
+
* the options, and the options of selected values stay rendered (TagPicker hides them).
|
|
12324
|
+
* - **Keyboard.** Typing filters the options (`filter`, by default a case-insensitive match on
|
|
12325
|
+
* `textValue ?? label`); the option whose label equals the typed text becomes active, else the
|
|
12326
|
+
* first match. ArrowDown/ArrowUp move the highlight (`aria-activedescendant`), Enter adds the
|
|
12327
|
+
* active option and keeps the list open (with nothing active, Enter is left to the surrounding
|
|
12328
|
+
* form), Escape closes the list (and then clears the typed text). Backspace in the empty input,
|
|
12329
|
+
* and Left (Right in RTL) with the caret at its start, focus the last tag; Delete, Backspace,
|
|
12330
|
+
* Enter or Space on a remove button remove its tag and focus the next tag, else the input; a
|
|
12331
|
+
* click on one focuses the input. Additions and removals are announced ("Cherry removed, 2
|
|
12332
|
+
* selected"), and so is "No matches" for text that matches no option.
|
|
12333
|
+
* - **Free tagging.** With `allowCreate`, text that matches no option label, no selected value
|
|
12334
|
+
* (ignoring case) and no option value ends the list with a create option (`Create "infra"`);
|
|
12335
|
+
* Enter on it or a click adds the text as a tag after `onOptionCreate(text)` and clears the
|
|
12336
|
+
* text.
|
|
12337
|
+
* - **End buttons.** A chevron (`expandIcon`, `false` hides it) opens and closes the list without
|
|
12338
|
+
* taking focus; `clearable` adds a clear button, a Tab stop after the input, which removes every
|
|
12339
|
+
* tag. A press on the field's empty area toggles the list.
|
|
12340
|
+
* - **One line.** `overflow="count"` keeps the tags on one line while focus is outside the picker
|
|
12341
|
+
* and its list is closed; the tags that do not fit give way to "+N".
|
|
12342
|
+
* - **Names.** The tags form a list named "Selected"; the trigger is described by a summary of the
|
|
12343
|
+
* selected labels ("Selected: Apple, Banana"). These built-in texts are English; `labels`
|
|
12344
|
+
* localizes them.
|
|
12345
|
+
* - **Routing.** The trigger (`TagPicker.Input` or `TagPicker.Button`) receives `id`,
|
|
12346
|
+
* `aria-label`, `aria-labelledby`, `aria-describedby`, `aria-invalid`, `aria-required`,
|
|
12347
|
+
* `aria-errormessage`, `aria-details`, `tabIndex` and `autoFocus`; the Input also
|
|
12348
|
+
* `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp`, `controlRef` and the text input attributes
|
|
12349
|
+
* `autoComplete`, `autoCapitalize`, `autoCorrect`, `maxLength`, `inputMode`, `spellCheck` and
|
|
12350
|
+
* `enterKeyHint` (with the Button, pass handlers and `ref` on it). `ref`, `className`, `style`,
|
|
12351
|
+
* other `aria-*` attributes and the remaining props stay on the root `<div>`. Inside a `Field`
|
|
12352
|
+
* the trigger is labelled and described by it; the field shows the error look whenever the
|
|
12353
|
+
* trigger ends up `aria-invalid`. With `name`/`required` the values take part in form
|
|
12354
|
+
* submission, validation and reset. Selected values without a matching option show their raw
|
|
12355
|
+
* value.
|
|
12356
|
+
* - **Size and appearance**: `size` resolves from its own prop, then the surrounding `Field`'s
|
|
12357
|
+
* `size`, then `WaveProvider inputDefaults.size`, else `'medium'` (a Field or provider `small`
|
|
12358
|
+
* gives `'medium'` too, since TagPicker has no `small`); `appearance` from its own prop, then
|
|
12359
|
+
* `WaveProvider inputDefaults.appearance`, else `'outline'`; both render as `data-size` and
|
|
12360
|
+
* `data-appearance` on the root `<div>`, and the parts take neither. The tags are one Tag size
|
|
12361
|
+
* smaller. The option list keeps its size.
|
|
12362
|
+
* - **Server rendering.** The open list renders only in the browser: an open list (`defaultOpen`,
|
|
12363
|
+
* `open`) is closed in the server HTML and opens once the picker has hydrated; the tags of
|
|
12364
|
+
* registered options show their labels in the server HTML.
|
|
12365
|
+
*
|
|
12366
|
+
* Fluent's `selectedOptions` and `onOptionSelect` are `value` and `onValueChange` (plus
|
|
12367
|
+
* `onOptionCreate`). `TagPickerOption` is both the type of an `options` entry and the flat name of
|
|
12368
|
+
* `TagPicker.Option`.
|
|
10740
12369
|
*
|
|
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.
|
|
12370
|
+
* @example
|
|
12371
|
+
* <TagPicker aria-label="Fruits" options={[{ value: 'apple', label: 'Apple' }]} clearable />
|
|
10754
12372
|
*
|
|
10755
|
-
*
|
|
10756
|
-
*
|
|
10757
|
-
*
|
|
10758
|
-
*
|
|
10759
|
-
*
|
|
12373
|
+
* @example
|
|
12374
|
+
* <TagPicker aria-label="People" value={people} onValueChange={setPeople}>
|
|
12375
|
+
* <TagPicker.Control>
|
|
12376
|
+
* <TagPicker.Group>
|
|
12377
|
+
* {people.map((id) => (
|
|
12378
|
+
* <Tag key={id} value={id} media={<Avatar name={nameOf(id)} />} dismissLabel="Remove">
|
|
12379
|
+
* {nameOf(id)}
|
|
12380
|
+
* </Tag>
|
|
12381
|
+
* ))}
|
|
12382
|
+
* </TagPicker.Group>
|
|
12383
|
+
* <TagPicker.Input />
|
|
12384
|
+
* </TagPicker.Control>
|
|
12385
|
+
* <TagPicker.List>
|
|
12386
|
+
* <TagPicker.Option value="katri" label="Katri Athokas" secondaryContent="Designer">
|
|
12387
|
+
* Katri Athokas
|
|
12388
|
+
* </TagPicker.Option>
|
|
12389
|
+
* </TagPicker.List>
|
|
12390
|
+
* </TagPicker>
|
|
10760
12391
|
*/
|
|
10761
12392
|
export declare const TagPicker: {
|
|
10762
|
-
(props: TagPickerProps):
|
|
12393
|
+
(props: TagPickerProps): JSX.Element;
|
|
10763
12394
|
displayName: string;
|
|
12395
|
+
} & {
|
|
12396
|
+
Control: {
|
|
12397
|
+
(props: TagPickerControlProps): JSX.Element | null;
|
|
12398
|
+
displayName: string;
|
|
12399
|
+
};
|
|
12400
|
+
Group: {
|
|
12401
|
+
(props: TagPickerGroupProps): JSX.Element | null;
|
|
12402
|
+
displayName: string;
|
|
12403
|
+
};
|
|
12404
|
+
Input: {
|
|
12405
|
+
(props: TagPickerInputProps): JSX.Element | null;
|
|
12406
|
+
displayName: string;
|
|
12407
|
+
};
|
|
12408
|
+
Button: {
|
|
12409
|
+
(props: TagPickerButtonProps): JSX.Element | null;
|
|
12410
|
+
displayName: string;
|
|
12411
|
+
};
|
|
12412
|
+
List: {
|
|
12413
|
+
(props: TagPickerListProps): JSX.Element | null;
|
|
12414
|
+
displayName: string;
|
|
12415
|
+
};
|
|
12416
|
+
Option: NamedExoticComponent<TagPickerOptionProps>;
|
|
12417
|
+
OptionGroup: FC<OptionGroupProps>;
|
|
10764
12418
|
};
|
|
10765
12419
|
|
|
10766
12420
|
/**
|
|
10767
|
-
*
|
|
10768
|
-
*
|
|
10769
|
-
*
|
|
10770
|
-
*
|
|
10771
|
-
*
|
|
12421
|
+
* A select-only trigger for a TagPicker (`TagPicker.Button`), in place of `TagPicker.Input`: a
|
|
12422
|
+
* `<button role="combobox">` for a short fixed list, with no text entry. Down, Up, Home, End and
|
|
12423
|
+
* typing a letter open the list and move; Enter and Space open it or add the active option and
|
|
12424
|
+
* keep it open; Escape, Alt+Up and Tab close it; a click toggles it. Backspace and Left (Right in
|
|
12425
|
+
* RTL) focus the last tag. It shows the placeholder while no tag is selected, else nothing, and
|
|
12426
|
+
* stays the click area of the rest of the row. No query, no filter and no create option
|
|
12427
|
+
* (`allowCreate` needs `TagPicker.Input`). TagPicker's `id`, name, description and Field wiring
|
|
12428
|
+
* reach it; pass handlers and `ref` on it (TagPicker's `onKeyDown` and `controlRef` are the
|
|
12429
|
+
* Input's). Read-only, it renders `aria-readonly`. Fluent's TagPickerButton is visually hidden
|
|
12430
|
+
* once a tag is selected; this one stays.
|
|
12431
|
+
*/
|
|
12432
|
+
export declare const TagPickerButton: {
|
|
12433
|
+
(props: TagPickerButtonProps): React_2.JSX.Element | null;
|
|
12434
|
+
displayName: string;
|
|
12435
|
+
};
|
|
12436
|
+
|
|
12437
|
+
/** TagPicker.Button: `root` on the `role="combobox"` button. */
|
|
12438
|
+
export declare const tagPickerButtonClassNames: {
|
|
12439
|
+
readonly root: "wave-tag-picker-button";
|
|
12440
|
+
};
|
|
12441
|
+
|
|
12442
|
+
/** Props of TagPicker.Button: a trigger without text entry (select-only). */
|
|
12443
|
+
export declare interface TagPickerButtonProps extends Omit<React_2.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'type' | 'disabled' | 'children'> {
|
|
12444
|
+
/** Shown while no tag is selected. @default TagPicker's `placeholder` */
|
|
12445
|
+
placeholder?: string;
|
|
12446
|
+
ref?: React_2.Ref<HTMLButtonElement>;
|
|
12447
|
+
}
|
|
12448
|
+
|
|
12449
|
+
/**
|
|
12450
|
+
* TagPicker: `root` on the outer element; `control` on the tag area and `group` on the list of
|
|
12451
|
+
* tags (both deprecated, kept until 1.0 next to TagPicker.Control's and TagPicker.Group's own
|
|
12452
|
+
* classes); `tag` on each tag; `removeButton` on each tag's remove button; `input` on the
|
|
12453
|
+
* `role="combobox"` input; `expandButton` on the expand button and `expandIcon` on its glyph;
|
|
12454
|
+
* `clearButton` on the clear button; `listbox` on the `role="listbox"` list; `option` on each
|
|
12455
|
+
* Option it renders (which also carries Option's classes); `createOption` on the create option of
|
|
12456
|
+
* `allowCreate`; `overflowCount` on the "+N" count of the single-line layout; `surface` on the
|
|
12457
|
+
* portaled popup; `emptyMessage` on the "No matches" row.
|
|
10772
12458
|
*/
|
|
10773
12459
|
export declare const tagPickerClassNames: {
|
|
10774
12460
|
readonly root: "wave-tag-picker";
|
|
@@ -10777,12 +12463,121 @@ export declare const tagPickerClassNames: {
|
|
|
10777
12463
|
readonly tag: "wave-tag-picker__tag";
|
|
10778
12464
|
readonly removeButton: "wave-tag-picker__remove-button";
|
|
10779
12465
|
readonly input: "wave-tag-picker__input";
|
|
12466
|
+
readonly expandButton: "wave-tag-picker__expand-button";
|
|
12467
|
+
readonly expandIcon: "wave-tag-picker__expand-icon";
|
|
12468
|
+
readonly clearButton: "wave-tag-picker__clear-button";
|
|
10780
12469
|
readonly listbox: "wave-tag-picker__listbox";
|
|
10781
12470
|
readonly option: "wave-tag-picker__option";
|
|
12471
|
+
readonly createOption: "wave-tag-picker__create-option";
|
|
12472
|
+
readonly overflowCount: "wave-tag-picker__overflow-count";
|
|
10782
12473
|
readonly surface: "wave-tag-picker__surface";
|
|
10783
12474
|
readonly emptyMessage: "wave-tag-picker__empty-message";
|
|
10784
12475
|
};
|
|
10785
12476
|
|
|
12477
|
+
/**
|
|
12478
|
+
* The field of a TagPicker (`TagPicker.Control`): a `role="group"` box in the picker's look that
|
|
12479
|
+
* holds the tag list, the trigger and, at its inline end, the clear button (`clearable`) and the
|
|
12480
|
+
* expand button (`expandIcon`, a chevron by default; this part's `expandIcon` wins over
|
|
12481
|
+
* TagPicker's). Without children it renders `TagPicker.Group` and `TagPicker.Input`. A press on
|
|
12482
|
+
* its empty area (not on a tag's button or link, or a trigger) toggles the list and keeps focus in
|
|
12483
|
+
* the trigger; read-only, it only focuses the trigger. Render exactly one trigger in it,
|
|
12484
|
+
* `TagPicker.Input` or `TagPicker.Button`. It takes neither `size` nor `appearance`: TagPicker's
|
|
12485
|
+
* apply.
|
|
12486
|
+
*/
|
|
12487
|
+
export declare const TagPickerControl: {
|
|
12488
|
+
(props: TagPickerControlProps): React_2.JSX.Element | null;
|
|
12489
|
+
displayName: string;
|
|
12490
|
+
};
|
|
12491
|
+
|
|
12492
|
+
/**
|
|
12493
|
+
* TagPicker.Control: `root` on the field that holds the tags, the trigger and the end buttons (it
|
|
12494
|
+
* also carries TagPicker's `control` part).
|
|
12495
|
+
*/
|
|
12496
|
+
export declare const tagPickerControlClassNames: {
|
|
12497
|
+
readonly root: "wave-tag-picker-control";
|
|
12498
|
+
};
|
|
12499
|
+
|
|
12500
|
+
/** Props of TagPicker.Control: the field that holds the tags, the trigger and the end buttons. */
|
|
12501
|
+
export declare interface TagPickerControlProps extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
12502
|
+
/** As TagPicker's `expandIcon`; wins over it when it is not `undefined`. */
|
|
12503
|
+
expandIcon?: Slot<'span'>;
|
|
12504
|
+
/** @default `<TagPicker.Group /><TagPicker.Input />` */
|
|
12505
|
+
children?: React_2.ReactNode;
|
|
12506
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
12507
|
+
}
|
|
12508
|
+
|
|
12509
|
+
/**
|
|
12510
|
+
* The selected tags of a TagPicker (`TagPicker.Group`): a `TagGroup` with `role="list"` named
|
|
12511
|
+
* "Selected" (`labels.selected`, or its own `aria-label`), rendered only while a value is
|
|
12512
|
+
* selected. Without children it renders a Tag per selected value, named by the option's label,
|
|
12513
|
+
* with a remove button named "Remove <label>" (`labels.remove`). Your own Tags in it are the
|
|
12514
|
+
* selected values' tags: give each a `value`, leave `dismissible` unset (a read-only picker then
|
|
12515
|
+
* shows no remove buttons), and pass `dismissLabel="Remove"` for TagPicker's wording (a Tag's own
|
|
12516
|
+
* Dismiss button is named "Dismiss <text>"). Each remove button is a Tab stop; Delete, Backspace,
|
|
12517
|
+
* Enter and Space remove its tag, and focus moves to the next tag, else to the trigger; a click
|
|
12518
|
+
* focuses the trigger. Left and Right (mirrored in RTL) move between the controls of the list and
|
|
12519
|
+
* from the last one to the trigger; Escape returns to the trigger. Its tags take the picker's look,
|
|
12520
|
+
* one Tag size smaller (a Tag's own `size` and `appearance` win). With `overflow="count"` the
|
|
12521
|
+
* tags are measured by position: render your own Tags in `value` order. Fluent's TagPickerGroup is a
|
|
12522
|
+
* listbox of tags: an option cannot hold a Dismiss button.
|
|
12523
|
+
*/
|
|
12524
|
+
export declare const TagPickerGroup: {
|
|
12525
|
+
(props: TagPickerGroupProps): React_2.JSX.Element | null;
|
|
12526
|
+
displayName: string;
|
|
12527
|
+
};
|
|
12528
|
+
|
|
12529
|
+
/**
|
|
12530
|
+
* TagPicker.Group: `root` on the list of tags (also a TagGroup's root, and TagPicker's `group`
|
|
12531
|
+
* part).
|
|
12532
|
+
*/
|
|
12533
|
+
export declare const tagPickerGroupClassNames: {
|
|
12534
|
+
readonly root: "wave-tag-picker-group";
|
|
12535
|
+
};
|
|
12536
|
+
|
|
12537
|
+
/** Props of TagPicker.Group: the list of selected tags (a TagGroup with `role="list"`). */
|
|
12538
|
+
export declare interface TagPickerGroupProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'role' | 'defaultValue'> {
|
|
12539
|
+
/**
|
|
12540
|
+
* The tags of the selected values: `Tag`s with a `value` each (leave `dismissible` unset), in
|
|
12541
|
+
* `value` order (the single-line layout matches the tags to the values by position).
|
|
12542
|
+
* @default one Tag per selected value, named "Remove <label>" (`labels.remove`)
|
|
12543
|
+
*/
|
|
12544
|
+
children?: React_2.ReactNode;
|
|
12545
|
+
/** @default TagPicker's `labels.selected` ('Selected') */
|
|
12546
|
+
'aria-label'?: string;
|
|
12547
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
12548
|
+
}
|
|
12549
|
+
|
|
12550
|
+
/**
|
|
12551
|
+
* The text field of a TagPicker (`TagPicker.Input`): the `<input role="combobox">` that filters
|
|
12552
|
+
* the options as you type, inside `TagPicker.Control`. TagPicker's `id`, name, description, Field
|
|
12553
|
+
* wiring and text input attributes reach it (its own `id`, `aria-label` and `aria-labelledby`
|
|
12554
|
+
* replace TagPicker's, and its `aria-describedby` comes first); its handlers run before
|
|
12555
|
+
* TagPicker's `onKeyDown` and the built-in keys. Backspace in the empty field, and Left (Right in
|
|
12556
|
+
* RTL) with the caret at its start, focus the last tag. The form fields are TagPicker's.
|
|
12557
|
+
*/
|
|
12558
|
+
export declare const TagPickerInput: {
|
|
12559
|
+
(props: TagPickerInputProps): React_2.JSX.Element | null;
|
|
12560
|
+
displayName: string;
|
|
12561
|
+
};
|
|
12562
|
+
|
|
12563
|
+
/**
|
|
12564
|
+
* TagPicker.Input: `root` on the `role="combobox"` input (it also carries TagPicker's `input`
|
|
12565
|
+
* part).
|
|
12566
|
+
*/
|
|
12567
|
+
export declare const tagPickerInputClassNames: {
|
|
12568
|
+
readonly root: "wave-tag-picker-input";
|
|
12569
|
+
};
|
|
12570
|
+
|
|
12571
|
+
/**
|
|
12572
|
+
* Props of TagPicker.Input: the text field, the combobox. The form fields (`name`, `form`,
|
|
12573
|
+
* `required`) are TagPicker's: its hidden inputs submit the tags, never the typed text.
|
|
12574
|
+
*/
|
|
12575
|
+
export declare interface TagPickerInputProps extends Omit<React_2.InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'type' | 'size' | 'disabled' | 'readOnly' | 'name' | 'form' | 'required'> {
|
|
12576
|
+
/** Shown while no tag is selected. @default TagPicker's `placeholder` */
|
|
12577
|
+
placeholder?: string;
|
|
12578
|
+
ref?: React_2.Ref<HTMLInputElement>;
|
|
12579
|
+
}
|
|
12580
|
+
|
|
10786
12581
|
/**
|
|
10787
12582
|
* The TagPicker's built-in names, descriptions and announcements, for localization. Each member is
|
|
10788
12583
|
* optional and falls back to its English default.
|
|
@@ -10812,21 +12607,155 @@ export declare interface TagPickerLabels {
|
|
|
10812
12607
|
* @default 'No matches'
|
|
10813
12608
|
*/
|
|
10814
12609
|
noMatches?: string;
|
|
12610
|
+
/**
|
|
12611
|
+
* Text and name of the create option (`allowCreate`), from the trimmed typed text.
|
|
12612
|
+
* @default (text) => `Create "${text}"`
|
|
12613
|
+
*/
|
|
12614
|
+
create?: (text: string) => string;
|
|
12615
|
+
/** Name of the clear button (`clearable`). @default 'Clear selection' */
|
|
12616
|
+
clear?: string;
|
|
12617
|
+
/** Name of the expand button at the end of the field. @default 'Show options' */
|
|
12618
|
+
expand?: string;
|
|
12619
|
+
/**
|
|
12620
|
+
* The "+N" text of the single-line layout (`overflow="count"`); hidden from assistive
|
|
12621
|
+
* technology, which hears the input's summary of every tag.
|
|
12622
|
+
* @default (count) => `+${count}`
|
|
12623
|
+
*/
|
|
12624
|
+
overflowCount?: (count: number) => string;
|
|
12625
|
+
}
|
|
12626
|
+
|
|
12627
|
+
/**
|
|
12628
|
+
* The option list of a TagPicker (`TagPicker.List`): a `<ul role="listbox">`, multi-selectable,
|
|
12629
|
+
* that opens in a popup below the field. Render it directly inside TagPicker (a Fragment is fine);
|
|
12630
|
+
* without one TagPicker adds the default list. Without children it renders a `TagPicker.Option`
|
|
12631
|
+
* per available entry of TagPicker's `options`. With children (`TagPicker.Option`s, `Option`s,
|
|
12632
|
+
* `TagPicker.OptionGroup`s) they are the options: keep the options of selected values rendered,
|
|
12633
|
+
* since TagPicker hides them and reads their labels. Its own `aria-label`/`aria-labelledby`
|
|
12634
|
+
* replace the list's name (TagPicker's, else the Field label); its `className` comes last on the
|
|
12635
|
+
* list, its other attributes and `ref` reach the list element.
|
|
12636
|
+
*/
|
|
12637
|
+
export declare const TagPickerList: {
|
|
12638
|
+
(props: TagPickerListProps): React_2.JSX.Element | null;
|
|
12639
|
+
displayName: string;
|
|
12640
|
+
};
|
|
12641
|
+
|
|
12642
|
+
/**
|
|
12643
|
+
* TagPicker.List: `root` on the `role="listbox"` list (it also carries ListboxSurface's `list` and
|
|
12644
|
+
* TagPicker's `listbox` parts).
|
|
12645
|
+
*/
|
|
12646
|
+
export declare const tagPickerListClassNames: {
|
|
12647
|
+
readonly root: "wave-tag-picker-list";
|
|
12648
|
+
};
|
|
12649
|
+
|
|
12650
|
+
/** Props of TagPicker.List: the option list, shown in a popup while open. */
|
|
12651
|
+
export declare interface TagPickerListProps extends Omit<React_2.HTMLAttributes<HTMLUListElement>, 'role' | 'id' | 'hidden' | 'tabIndex' | 'aria-multiselectable' | 'aria-activedescendant' | 'dangerouslySetInnerHTML'> {
|
|
12652
|
+
/**
|
|
12653
|
+
* `TagPicker.Option`s, `Option`s and `TagPicker.OptionGroup`s. Keep the options of selected
|
|
12654
|
+
* values rendered: TagPicker hides them and reads their labels.
|
|
12655
|
+
* @default one TagPicker.Option per available entry of TagPicker's `options`
|
|
12656
|
+
*/
|
|
12657
|
+
children?: React_2.ReactNode;
|
|
12658
|
+
/**
|
|
12659
|
+
* Names the listbox (with `aria-labelledby`): the List's own pair replaces TagPicker's name.
|
|
12660
|
+
* @default TagPicker's `aria-label`, else its `aria-labelledby`, else the Field label
|
|
12661
|
+
*/
|
|
12662
|
+
'aria-label'?: string;
|
|
12663
|
+
/** Ids of the elements that name the listbox (see `aria-label`). */
|
|
12664
|
+
'aria-labelledby'?: string;
|
|
12665
|
+
/** Merged last onto the `role="listbox"` element (a `max-h-*` replaces the default height). */
|
|
12666
|
+
className?: string;
|
|
12667
|
+
ref?: React_2.Ref<HTMLUListElement>;
|
|
10815
12668
|
}
|
|
10816
12669
|
|
|
10817
|
-
/**
|
|
12670
|
+
/**
|
|
12671
|
+
* One entry of `options`, the array form of TagPicker's options. The component of the same name,
|
|
12672
|
+
* `TagPickerOption`, is `TagPicker.Option`, the parts form.
|
|
12673
|
+
*/
|
|
10818
12674
|
export declare interface TagPickerOption {
|
|
10819
12675
|
/** Unique identifier for the option. */
|
|
10820
12676
|
value: string;
|
|
10821
|
-
/** Display label
|
|
12677
|
+
/** Display label: the option's text, its tag's text, and the text the filter and the announcements use. */
|
|
10822
12678
|
label: string;
|
|
12679
|
+
/**
|
|
12680
|
+
* A visual before the label, in the option and in its tag (an Avatar, an icon). Decorative in
|
|
12681
|
+
* both: the label names them. An Avatar takes the tag's size (24, 20 or 16px).
|
|
12682
|
+
*/
|
|
12683
|
+
media?: React_2.ReactNode;
|
|
12684
|
+
/** A second line under the label in the option (a role, an e-mail address); tags do not show it. */
|
|
12685
|
+
secondaryContent?: React_2.ReactNode;
|
|
12686
|
+
}
|
|
12687
|
+
|
|
12688
|
+
/**
|
|
12689
|
+
* An option of TagPicker's list (`TagPicker.Option`): an `Option` with a decorative visual before
|
|
12690
|
+
* its text (`media`, an Avatar or an icon, `aria-hidden`) and a second, smaller line under it
|
|
12691
|
+
* (`secondaryContent`, part of the option's accessible name). Its label, the text of its tag, the
|
|
12692
|
+
* filter and the announcements, is `label`, else `textValue`, else the text of its children, so
|
|
12693
|
+
* the visual and the second line never enter it; pass `label` when the children are not plain
|
|
12694
|
+
* text (a development warning otherwise, and the value is used). It works in any listbox:
|
|
12695
|
+
* TagPicker's list, a Combobox, a Listbox or a custom picker. Without `media` and
|
|
12696
|
+
* `secondaryContent` it renders `Option`'s DOM. The interface of the same name, `TagPickerOption`,
|
|
12697
|
+
* is an entry of TagPicker's `options` array.
|
|
12698
|
+
*
|
|
12699
|
+
* @example
|
|
12700
|
+
* <TagPicker.Option
|
|
12701
|
+
* value="katri"
|
|
12702
|
+
* label="Katri Athokas"
|
|
12703
|
+
* media={<Avatar name="Katri Athokas" />}
|
|
12704
|
+
* secondaryContent="Designer"
|
|
12705
|
+
* >
|
|
12706
|
+
* Katri Athokas
|
|
12707
|
+
* </TagPicker.Option>
|
|
12708
|
+
*/
|
|
12709
|
+
export declare const TagPickerOption: React_2.NamedExoticComponent<TagPickerOptionProps>;
|
|
12710
|
+
|
|
12711
|
+
/**
|
|
12712
|
+
* TagPicker.Option (an Option variant): `root` on the option; `media` on the visual before its
|
|
12713
|
+
* text; `secondaryContent` on its second line.
|
|
12714
|
+
*/
|
|
12715
|
+
export declare const tagPickerOptionClassNames: {
|
|
12716
|
+
readonly root: "wave-tag-picker-option";
|
|
12717
|
+
readonly media: "wave-tag-picker-option__media";
|
|
12718
|
+
readonly secondaryContent: "wave-tag-picker-option__secondary-content";
|
|
12719
|
+
};
|
|
12720
|
+
|
|
12721
|
+
/**
|
|
12722
|
+
* A group of options in TagPicker's list (`TagPicker.OptionGroup`): `OptionGroup` itself, with a
|
|
12723
|
+
* heading that names it. It hides itself while every option in it is hidden, so a group whose
|
|
12724
|
+
* options are all selected disappears.
|
|
12725
|
+
*/
|
|
12726
|
+
export declare const TagPickerOptionGroup: React_2.FC<OptionGroupProps>;
|
|
12727
|
+
|
|
12728
|
+
/** Props of TagPicker.Option: an Option with a visual and a second line. */
|
|
12729
|
+
export declare interface TagPickerOptionProps extends OptionProps {
|
|
12730
|
+
/** A visual before the text (an Avatar, an icon). Decorative (`aria-hidden`): the text names the option. */
|
|
12731
|
+
media?: Slot<'span'>;
|
|
12732
|
+
/** A second, smaller line under the text. Part of the option's name, not of its label. */
|
|
12733
|
+
secondaryContent?: Slot<'span'>;
|
|
12734
|
+
/**
|
|
12735
|
+
* The text of the option's tag, the filter and the announcements. Pass it when the children
|
|
12736
|
+
* are not plain text (a development warning otherwise).
|
|
12737
|
+
* @default `textValue`, else the text of the children, else `value`
|
|
12738
|
+
*/
|
|
12739
|
+
label?: string;
|
|
10823
12740
|
}
|
|
10824
12741
|
|
|
10825
12742
|
/** Properties for the TagPicker component. */
|
|
10826
12743
|
export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | RoutedHandlers> {
|
|
10827
|
-
/**
|
|
10828
|
-
|
|
10829
|
-
|
|
12744
|
+
/**
|
|
12745
|
+
* The options, the array form (`{ value, label, media?, secondaryContent? }`). With parts whose
|
|
12746
|
+
* `TagPicker.List` has children it only names values (tags, announcements). Changed in 0.11:
|
|
12747
|
+
* optional.
|
|
12748
|
+
*/
|
|
12749
|
+
options?: readonly TagPickerOption[];
|
|
12750
|
+
/**
|
|
12751
|
+
* The parts: `TagPicker.Control` and `TagPicker.List`, directly inside TagPicker (a Fragment is
|
|
12752
|
+
* fine). Without children TagPicker renders both with their defaults; without a
|
|
12753
|
+
* `TagPicker.List` it renders the default list after the children.
|
|
12754
|
+
*/
|
|
12755
|
+
children?: React_2.ReactNode;
|
|
12756
|
+
/**
|
|
12757
|
+
* Controlled array of selected option values (`[]` for none). Fluent's `selectedOptions`.
|
|
12758
|
+
*/
|
|
10830
12759
|
value?: readonly string[];
|
|
10831
12760
|
/**
|
|
10832
12761
|
* Initial selected values for uncontrolled usage; a form reset restores them.
|
|
@@ -10834,8 +12763,8 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
10834
12763
|
*/
|
|
10835
12764
|
defaultValue?: readonly string[];
|
|
10836
12765
|
/**
|
|
10837
|
-
* Called with the new selection when it changes: a tag is added
|
|
10838
|
-
* restores different tags.
|
|
12766
|
+
* Called with the new selection when it changes: a tag is added (an option, or a created tag)
|
|
12767
|
+
* or removed, or a form reset restores different tags. Fluent's `onOptionSelect`.
|
|
10839
12768
|
*/
|
|
10840
12769
|
onValueChange?: (value: string[]) => void;
|
|
10841
12770
|
/**
|
|
@@ -10859,57 +12788,62 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
10859
12788
|
/** Called when the option list opens or closes. */
|
|
10860
12789
|
onOpenChange?: (open: boolean) => void;
|
|
10861
12790
|
/**
|
|
10862
|
-
*
|
|
12791
|
+
* Shown by TagPicker.Input or TagPicker.Button while no tag is selected; the part's own
|
|
12792
|
+
* `placeholder` wins.
|
|
10863
12793
|
* @default 'Select...'
|
|
10864
12794
|
*/
|
|
10865
12795
|
placeholder?: string;
|
|
10866
12796
|
/**
|
|
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
|
-
*
|
|
12797
|
+
* Whether an option matches the typed text (the query). Called with every listed option, also
|
|
12798
|
+
* the options of `TagPicker.List`'s children (its `value`, `label` and `textValue`), and the
|
|
12799
|
+
* text whenever the text is not empty, never with a selected option or the create option; an
|
|
12800
|
+
* option it returns `false` for is filtered out. It may keep options that do not contain the
|
|
12801
|
+
* text: `filter={() => true}` with `query` and `onQueryChange` leaves the matching to you (a
|
|
12802
|
+
* server-side search that replaces `options`); for a create entry, use `allowCreate`. With a
|
|
12803
|
+
* server-side search, keep the selected options in `options` (they are never listed): a
|
|
12804
|
+
* selected value without an option shows its raw value as the tag label, with a development
|
|
12805
|
+
* warning (the "Async search" story does this).
|
|
12806
|
+
* @default a case-insensitive substring match on the option's `textValue ?? label`
|
|
10876
12807
|
*/
|
|
10877
12808
|
filter?: (option: ListboxItem, query: string) => boolean;
|
|
10878
12809
|
/**
|
|
10879
12810
|
* 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`).
|
|
12811
|
+
* shows in the input (hidden while `disabled` or `readOnly`). Not used with TagPicker.Button.
|
|
10881
12812
|
*/
|
|
10882
12813
|
query?: string;
|
|
10883
12814
|
/**
|
|
10884
12815
|
* Initial query for uncontrolled usage. A TagPicker that starts disabled or read-only starts
|
|
10885
|
-
* without it (as it starts closed).
|
|
12816
|
+
* without it (as it starts closed). Not used with TagPicker.Button.
|
|
10886
12817
|
* @default ''
|
|
10887
12818
|
*/
|
|
10888
12819
|
defaultQuery?: string;
|
|
10889
12820
|
/**
|
|
10890
12821
|
* 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
|
|
12822
|
+
* tag added or created, Escape on the closed list, the clear button, a form reset, or `disabled`
|
|
12823
|
+
* or `readOnly` turned on while text is typed). A blur or a close keeps the text. A TagPicker
|
|
12824
|
+
* that mounts disabled or read-only reports nothing: it keeps a controlled query, which shows
|
|
12825
|
+
* once it unlocks. Not used with TagPicker.Button.
|
|
10894
12826
|
*/
|
|
10895
12827
|
onQueryChange?: (query: string) => void;
|
|
10896
12828
|
/**
|
|
10897
|
-
* Whether the tag picker is disabled: nothing can be added or removed,
|
|
10898
|
-
*
|
|
12829
|
+
* Whether the tag picker is disabled: nothing can be added or removed, the remove buttons leave
|
|
12830
|
+
* the tab order, and the expand and clear buttons are disabled. The field dims once.
|
|
10899
12831
|
* @default false
|
|
10900
12832
|
*/
|
|
10901
12833
|
disabled?: boolean;
|
|
10902
12834
|
/**
|
|
10903
12835
|
* Size of the tags and the field: `medium` (the 0.7 look), `large` or `extra-large` (Fluent's
|
|
10904
12836
|
* 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.
|
|
12837
|
+
* inputDefaults.size`, else `'medium'`; a Field or provider `small` gives `'medium'` too. Its
|
|
12838
|
+
* tags are one Tag size smaller: medium → extra-small, large → small, extra-large → medium. The
|
|
10906
12839
|
* option list keeps its size.
|
|
10907
12840
|
*/
|
|
10908
12841
|
size?: TagPickerSize;
|
|
10909
12842
|
/**
|
|
10910
12843
|
* Look of the field: `outline` (a full border), `underline` (a bottom stroke only),
|
|
10911
12844
|
* `filled-darker` or `filled-lighter` (a fill without a visible stroke: give the field a visible
|
|
10912
|
-
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`.
|
|
12845
|
+
* label). Default: `WaveProvider inputDefaults.appearance`, else `'outline'`. The tags are
|
|
12846
|
+
* filled, outlined on `filled-darker`.
|
|
10913
12847
|
*/
|
|
10914
12848
|
appearance?: InputAppearance;
|
|
10915
12849
|
/** Name of the values in form submissions (one hidden input per value). */
|
|
@@ -10922,38 +12856,88 @@ export declare interface TagPickerProps extends Omit<React_2.HTMLAttributes<HTML
|
|
|
10922
12856
|
*/
|
|
10923
12857
|
required?: boolean;
|
|
10924
12858
|
/**
|
|
10925
|
-
* The `autocomplete` attribute of
|
|
10926
|
-
* you set it (for example `'on'`).
|
|
12859
|
+
* The `autocomplete` attribute of TagPicker.Input's `<input role="combobox">`. Browser autofill
|
|
12860
|
+
* is off unless you set it (for example `'on'`). With TagPicker.Button, not used.
|
|
10927
12861
|
* @default 'off'
|
|
10928
12862
|
*/
|
|
10929
12863
|
autoComplete?: string;
|
|
10930
|
-
/**
|
|
12864
|
+
/**
|
|
12865
|
+
* The maximum length of the typed text (`maxlength` of TagPicker.Input's `<input>`). With
|
|
12866
|
+
* TagPicker.Button, not used.
|
|
12867
|
+
*/
|
|
10931
12868
|
maxLength?: number;
|
|
10932
12869
|
/**
|
|
10933
|
-
* The selection cannot be changed: the
|
|
10934
|
-
* the
|
|
10935
|
-
*
|
|
10936
|
-
* (`onOpenChange(false)`); a focused remove
|
|
12870
|
+
* The selection cannot be changed: the trigger is read-only, the tags have no remove buttons,
|
|
12871
|
+
* the expand button is disabled and the clear button hidden, and the option list neither opens
|
|
12872
|
+
* (click, keyboard, a controlled `open`) nor adds tags; Escape is left to the page. Turning it
|
|
12873
|
+
* (or `disabled`) on while the list is open closes it (`onOpenChange(false)`); a focused remove
|
|
12874
|
+
* button hands focus to the trigger.
|
|
10937
12875
|
*/
|
|
10938
12876
|
readOnly?: boolean;
|
|
10939
12877
|
/**
|
|
10940
|
-
*
|
|
10941
|
-
*
|
|
10942
|
-
*
|
|
12878
|
+
* Lets the user add a tag of their own text: while the trimmed text matches no option label
|
|
12879
|
+
* and no selected value (ignoring case) and no option value, the list ends with a create option
|
|
12880
|
+
* (`labels.create`); Enter on it or a click adds the text as a tag, calls `onOptionCreate`, and
|
|
12881
|
+
* clears the text. Needs `TagPicker.Input` (not `TagPicker.Button`). WaveUI-only: Fluent's
|
|
12882
|
+
* TagPicker has no free tagging.
|
|
12883
|
+
* @default false
|
|
12884
|
+
*/
|
|
12885
|
+
allowCreate?: boolean;
|
|
12886
|
+
/**
|
|
12887
|
+
* Called with the trimmed text when the user creates a tag, before `onValueChange` reports the
|
|
12888
|
+
* new value. Add an option for it if you keep options: until then the tag shows the raw text.
|
|
12889
|
+
* WaveUI-only (see `allowCreate`).
|
|
12890
|
+
*/
|
|
12891
|
+
onOptionCreate?: (text: string) => void;
|
|
12892
|
+
/**
|
|
12893
|
+
* Shows a clear button at the end of the field while a tag is selected (not while `readOnly`;
|
|
12894
|
+
* disabled while `disabled`): it removes every tag (`onValueChange([])`), clears the typed
|
|
12895
|
+
* text, closes the list and focuses the trigger (the input, or `TagPicker.Button`). A Tab stop
|
|
12896
|
+
* after the trigger. The name of Fluent's Combobox and Dropdown prop.
|
|
12897
|
+
* @default false
|
|
12898
|
+
*/
|
|
12899
|
+
clearable?: boolean;
|
|
12900
|
+
/**
|
|
12901
|
+
* The glyph of the expand button at the end of the field (default: a chevron). The button
|
|
12902
|
+
* opens and closes the list, keeps focus on the trigger and is not a Tab stop. `null` or
|
|
12903
|
+
* `undefined` keep the chevron; `false`, or a value that renders nothing, hides the button.
|
|
12904
|
+
* Decorative: a `<button>` passed here is unwrapped. `TagPicker.Control`'s `expandIcon` wins.
|
|
12905
|
+
*/
|
|
12906
|
+
expandIcon?: Slot<'span'>;
|
|
12907
|
+
/**
|
|
12908
|
+
* `'wrap'`: the tags wrap onto more lines. `'count'`: while focus is outside the picker and its
|
|
12909
|
+
* list is closed, the tags stay on one line and the ones that do not fit give way to "+N"
|
|
12910
|
+
* (`labels.overflowCount`); focusing the picker shows them all. The tags are measured by
|
|
12911
|
+
* position: your own Tags in `TagPicker.Group` render in `value` order. WaveUI-only: Fluent's
|
|
12912
|
+
* single-line layout is a story, not a prop.
|
|
12913
|
+
* @default 'wrap'
|
|
12914
|
+
*/
|
|
12915
|
+
overflow?: 'wrap' | 'count';
|
|
12916
|
+
/**
|
|
12917
|
+
* Names of the remove buttons and the tag list, the summary that describes the trigger, the
|
|
12918
|
+
* announcements, the "No matches" text, the create option, the clear and expand buttons and the
|
|
12919
|
+
* "+N" count, for localization. Unset members keep their English defaults.
|
|
10943
12920
|
*/
|
|
10944
12921
|
labels?: TagPickerLabels;
|
|
10945
|
-
/**
|
|
12922
|
+
/**
|
|
12923
|
+
* Called when TagPicker.Input's `<input role="combobox">` receives focus (the root keeps other
|
|
12924
|
+
* handlers). With TagPicker.Button, pass it (and `ref`) on the Button.
|
|
12925
|
+
*/
|
|
10946
12926
|
onFocus?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
10947
|
-
/** Called when
|
|
12927
|
+
/** Called when TagPicker.Input's `<input>` loses focus. With TagPicker.Button, pass it on the Button. */
|
|
10948
12928
|
onBlur?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
10949
12929
|
/**
|
|
10950
|
-
* Called on a key press in
|
|
10951
|
-
* keys; `event.preventDefault()` skips them.
|
|
12930
|
+
* Called on a key press in TagPicker.Input's `<input>`, after the Input's own `onKeyDown` and
|
|
12931
|
+
* before the built-in listbox and tag keys; `event.preventDefault()` skips them. With
|
|
12932
|
+
* TagPicker.Button, pass it on the Button.
|
|
10952
12933
|
*/
|
|
10953
12934
|
onKeyDown?: React_2.KeyboardEventHandler<HTMLInputElement>;
|
|
10954
|
-
/** Called when a key is released in
|
|
12935
|
+
/** Called when a key is released in TagPicker.Input's `<input>`. With TagPicker.Button, pass it on the Button. */
|
|
10955
12936
|
onKeyUp?: React_2.KeyboardEventHandler<HTMLInputElement>;
|
|
10956
|
-
/**
|
|
12937
|
+
/**
|
|
12938
|
+
* Ref to TagPicker.Input's `<input role="combobox">` (the focusable element). With
|
|
12939
|
+
* TagPicker.Button, pass `ref` on the Button.
|
|
12940
|
+
*/
|
|
10957
12941
|
controlRef?: React_2.Ref<HTMLInputElement>;
|
|
10958
12942
|
/** Ref to the root `<div>`. */
|
|
10959
12943
|
ref?: React_2.Ref<HTMLDivElement>;
|
|
@@ -10968,6 +12952,12 @@ export declare type TagPickerSize = Extract<Size, 'medium' | 'large' | 'extra-la
|
|
|
10968
12952
|
*/
|
|
10969
12953
|
export declare type TagProps<C extends React_2.ElementType = 'span'> = PolymorphicProps<C, TagOwnProps>;
|
|
10970
12954
|
|
|
12955
|
+
/** Corners of a tag (Fluent's `TagShape`): `circular` (a pill) or `rounded` (4px). */
|
|
12956
|
+
export declare type TagShape = Extract<Shape, 'rounded' | 'circular'>;
|
|
12957
|
+
|
|
12958
|
+
/** Size of a tag (Fluent's `TagSize`): `extra-small` (20px tall), `small` (24px) or `medium` (28px). */
|
|
12959
|
+
export declare type TagSize = Extract<Size, 'extra-small' | 'small' | 'medium'>;
|
|
12960
|
+
|
|
10971
12961
|
/**
|
|
10972
12962
|
* A step-by-step onboarding popover (a non-modal `role="dialog"`) with Back/Next (Done on the
|
|
10973
12963
|
* last step) and Close.
|
|
@@ -11671,9 +13661,10 @@ export declare interface ToastDispatchOptions {
|
|
|
11671
13661
|
* those, the dispatch's `announcement`.
|
|
11672
13662
|
* The toasts themselves are not live regions. Each message stays in its live region for 2
|
|
11673
13663
|
* 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
|
-
*
|
|
13664
|
+
* - While an open panel covers the toasts' corner (a modal or non-modal Drawer on the same side,
|
|
13665
|
+
* or at the bottom), the toasts move beside it, or above a bottom one (below it for top toasts),
|
|
13666
|
+
* so they never hide its focused controls (WCAG 2.4.11). Without room there (a full-width panel
|
|
13667
|
+
* on a narrow screen) they keep their corner.
|
|
11677
13668
|
* - Timers pause while the pointer or focus is anywhere in the toast region, a menu or popover
|
|
11678
13669
|
* opened from a toast included (someone reading or operating one toast is reading the stack),
|
|
11679
13670
|
* and while the window is in the background (it has lost focus, or the page is not shown, as in
|
|
@@ -13488,6 +15479,12 @@ export declare interface UsePresenceResult {
|
|
|
13488
15479
|
* tracked with a MutationObserver, so an item that disables itself moves the tab stop without
|
|
13489
15480
|
* the owner re-rendering. With `manageTabIndex`, a control hidden by CSS counts as disabled and
|
|
13490
15481
|
* `input[type=hidden]` is no item.
|
|
15482
|
+
* - **Hand-back** (`manageTabIndex`): a container that stops being one (its ref detaches or moves
|
|
15483
|
+
* to another element) or that stops managing tabIndex gives every element it stamped its own
|
|
15484
|
+
* `tabindex` back (the one it had, or the one its author rendered since) and removes the
|
|
15485
|
+
* `data-roving-value` it added, so each control is its own Tab stop again; attached again, it
|
|
15486
|
+
* stamps again from the last focused item. An element `itemSelector` no longer matches is handed
|
|
15487
|
+
* back at once.
|
|
13491
15488
|
* - **Tab stop** (`tabStop`): `'active'` — the enabled `activeValue` item, else the first enabled
|
|
13492
15489
|
* item; `'last-focused'` — the last focused enabled item, else the `'active'` rule. A nested
|
|
13493
15490
|
* composite or a control that uses the arrow keys itself holds it only when no other item can;
|
|
@@ -13597,7 +15594,15 @@ export declare interface UseRovingTabIndexOptions {
|
|
|
13597
15594
|
* Matches that cannot take focus are no items: `input[type=hidden]` is skipped, and a control
|
|
13598
15595
|
* hidden by CSS inside the container (`display: none` or `visibility: hidden` on it or on an
|
|
13599
15596
|
* 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.
|
|
15597
|
+
* -1). A container hidden as a whole from outside keeps its items and tab stop.
|
|
15598
|
+
* When the container stops being one (its ref detaches, as when `containerProps` are no longer
|
|
15599
|
+
* spread, or moves to another element) or `manageTabIndex` turns false, every element the hook
|
|
15600
|
+
* stamped gets its own `tabindex` back (the attribute it had at its first stamp, or none; a
|
|
15601
|
+
* `tabIndex` its author rendered since, the commit that detaches the container included, stays)
|
|
15602
|
+
* and loses a `data-roving-value` the hook added (one React rendered stays). An element that
|
|
15603
|
+
* stops being an item (`itemSelector`, or a changed selector, no longer matches it) is handed
|
|
15604
|
+
* back the same way. The last focused item and the generated values are kept, so a container
|
|
15605
|
+
* that attaches again starts where it was. */
|
|
13601
15606
|
manageTabIndex?: boolean;
|
|
13602
15607
|
/** Called after an arrow, Home/End or typeahead key moved focus to `value`. */
|
|
13603
15608
|
onFocusMove?: (value: string, event: React_2.KeyboardEvent) => void;
|