@mortenbrudvik/waveui 0.15.0 → 0.16.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 +274 -24
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +405 -219
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/List.registry.cjs +1 -1
- package/dist/components/data-display/List.registry.cjs.map +1 -1
- package/dist/components/data-display/List.registry.mjs +12 -6
- package/dist/components/data-display/List.registry.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +163 -148
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +132 -117
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +1 -1
- package/dist/components/input/Listbox.cjs.map +1 -1
- package/dist/components/input/Listbox.mjs +90 -78
- package/dist/components/input/Listbox.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.data.cjs +2 -0
- package/dist/components/input/Option.data.cjs.map +1 -0
- package/dist/components/input/Option.data.mjs +114 -0
- package/dist/components/input/Option.data.mjs.map +1 -0
- package/dist/components/input/Option.mjs +21 -17
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/layout/FlatTree.cjs +2 -0
- package/dist/components/layout/FlatTree.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.cjs +2 -0
- package/dist/components/layout/FlatTree.context.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.mjs +20 -0
- package/dist/components/layout/FlatTree.context.mjs.map +1 -0
- package/dist/components/layout/FlatTree.item.cjs +2 -0
- package/dist/components/layout/FlatTree.item.cjs.map +1 -0
- package/dist/components/layout/FlatTree.item.mjs +90 -0
- package/dist/components/layout/FlatTree.item.mjs.map +1 -0
- package/dist/components/layout/FlatTree.mjs +276 -0
- package/dist/components/layout/FlatTree.mjs.map +1 -0
- package/dist/components/layout/Tree.core.cjs +1 -1
- package/dist/components/layout/Tree.core.cjs.map +1 -1
- package/dist/components/layout/Tree.core.mjs +166 -165
- package/dist/components/layout/Tree.core.mjs.map +1 -1
- package/dist/components/layout/Tree.selection.cjs +1 -1
- package/dist/components/layout/Tree.selection.cjs.map +1 -1
- package/dist/components/layout/Tree.selection.mjs +11 -57
- package/dist/components/layout/Tree.selection.mjs.map +1 -1
- package/dist/components/layout/useFlatTree.cjs +2 -0
- package/dist/components/layout/useFlatTree.cjs.map +1 -0
- package/dist/components/layout/useFlatTree.mjs +83 -0
- package/dist/components/layout/useFlatTree.mjs.map +1 -0
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.context.cjs +2 -0
- package/dist/components/table/DataGrid.context.cjs.map +1 -0
- package/dist/components/table/DataGrid.context.mjs +74 -0
- package/dist/components/table/DataGrid.context.mjs.map +1 -0
- package/dist/components/table/DataGrid.header.cjs +2 -0
- package/dist/components/table/DataGrid.header.cjs.map +1 -0
- package/dist/components/table/DataGrid.header.mjs +168 -0
- package/dist/components/table/DataGrid.header.mjs.map +1 -0
- package/dist/components/table/DataGrid.mjs +488 -591
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/DataGrid.sizing.cjs +2 -0
- package/dist/components/table/DataGrid.sizing.cjs.map +1 -0
- package/dist/components/table/DataGrid.sizing.mjs +187 -0
- package/dist/components/table/DataGrid.sizing.mjs.map +1 -0
- package/dist/components/table/DataGrid.store.cjs +2 -0
- package/dist/components/table/DataGrid.store.cjs.map +1 -0
- package/dist/components/table/DataGrid.store.mjs +108 -0
- package/dist/components/table/DataGrid.store.mjs.map +1 -0
- package/dist/components/table/DataGrid.window.cjs +2 -0
- package/dist/components/table/DataGrid.window.cjs.map +1 -0
- package/dist/components/table/DataGrid.window.mjs +165 -0
- package/dist/components/table/DataGrid.window.mjs.map +1 -0
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +74 -72
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/Table.resize.cjs +2 -0
- package/dist/components/table/Table.resize.cjs.map +1 -0
- package/dist/components/table/Table.resize.mjs +98 -0
- package/dist/components/table/Table.resize.mjs.map +1 -0
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +343 -140
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/components/table/useTableColumnSizing.cjs +2 -0
- package/dist/components/table/useTableColumnSizing.cjs.map +1 -0
- package/dist/components/table/useTableColumnSizing.mjs +76 -0
- package/dist/components/table/useTableColumnSizing.mjs.map +1 -0
- package/dist/components/table/useTableFeatures.cjs +2 -0
- package/dist/components/table/useTableFeatures.cjs.map +1 -0
- package/dist/components/table/useTableFeatures.mjs +110 -0
- package/dist/components/table/useTableFeatures.mjs.map +1 -0
- package/dist/components/table/useTableSelection.cjs +2 -0
- package/dist/components/table/useTableSelection.cjs.map +1 -0
- package/dist/components/table/useTableSelection.mjs +39 -0
- package/dist/components/table/useTableSelection.mjs.map +1 -0
- package/dist/components/table/useTableSort.cjs +2 -0
- package/dist/components/table/useTableSort.cjs.map +1 -0
- package/dist/components/table/useTableSort.mjs +58 -0
- package/dist/components/table/useTableSort.mjs.map +1 -0
- package/dist/hooks/useActiveDescendant.cjs +1 -1
- package/dist/hooks/useActiveDescendant.cjs.map +1 -1
- package/dist/hooks/useActiveDescendant.mjs +33 -25
- package/dist/hooks/useActiveDescendant.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +140 -130
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +1 -1
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/hooks/useSelection.cjs +2 -0
- package/dist/hooks/useSelection.cjs.map +1 -0
- package/dist/hooks/useSelection.mjs +57 -0
- package/dist/hooks/useSelection.mjs.map +1 -0
- package/dist/hooks/useVirtualWindow.cjs +2 -0
- package/dist/hooks/useVirtualWindow.cjs.map +1 -0
- package/dist/hooks/useVirtualWindow.mjs +102 -0
- package/dist/hooks/useVirtualWindow.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1542 -53
- package/dist/index.d.ts +1542 -53
- package/dist/index.mjs +147 -136
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +68 -49
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/columnSizing.cjs +2 -0
- package/dist/lib/columnSizing.cjs.map +1 -0
- package/dist/lib/columnSizing.mjs +27 -0
- package/dist/lib/columnSizing.mjs.map +1 -0
- package/dist/lib/flatTree.cjs +2 -0
- package/dist/lib/flatTree.cjs.map +1 -0
- package/dist/lib/flatTree.mjs +118 -0
- package/dist/lib/flatTree.mjs.map +1 -0
- package/dist/lib/selection.cjs +2 -0
- package/dist/lib/selection.cjs.map +1 -0
- package/dist/lib/selection.mjs +28 -0
- package/dist/lib/selection.mjs.map +1 -0
- package/dist/lib/treeCascade.cjs +2 -0
- package/dist/lib/treeCascade.cjs.map +1 -0
- package/dist/lib/treeCascade.mjs +52 -0
- package/dist/lib/treeCascade.mjs.map +1 -0
- package/dist/lib/virtual.cjs +2 -0
- package/dist/lib/virtual.cjs.map +1 -0
- package/dist/lib/virtual.mjs +54 -0
- package/dist/lib/virtual.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
2
3
|
import { FC } from 'react';
|
|
3
4
|
import { JSX } from 'react';
|
|
4
5
|
import { JSXElementConstructor } from 'react';
|
|
@@ -2051,6 +2052,9 @@ export declare interface CheckedValuesChangeDetails {
|
|
|
2051
2052
|
*/
|
|
2052
2053
|
export declare type CheckedValuesChangeHandler = (checkedValues: Record<string, string[]>, details?: CheckedValuesChangeDetails) => void;
|
|
2053
2054
|
|
|
2055
|
+
/** The check state of an item in a `selectionMode="multiple"` tree. */
|
|
2056
|
+
export declare type CheckState = 'checked' | 'mixed' | 'unchecked';
|
|
2057
|
+
|
|
2054
2058
|
/**
|
|
2055
2059
|
* Joins class names (clsx) and resolves Tailwind conflicts so the **last** class wins — pass
|
|
2056
2060
|
* internal classes first and the consumer's `className` last.
|
|
@@ -2639,6 +2643,26 @@ export declare interface ColorSwatchProps extends Omit<React_2.ButtonHTMLAttribu
|
|
|
2639
2643
|
ref?: React_2.Ref<HTMLButtonElement>;
|
|
2640
2644
|
}
|
|
2641
2645
|
|
|
2646
|
+
/** The sizing of one column of a table with resizable columns. */
|
|
2647
|
+
export declare interface ColumnSizingOption {
|
|
2648
|
+
/**
|
|
2649
|
+
* The narrowest the column can be, in pixels: the initial width and every resize are held at or
|
|
2650
|
+
* above it.
|
|
2651
|
+
* @default 80
|
|
2652
|
+
*/
|
|
2653
|
+
minWidth?: number;
|
|
2654
|
+
/**
|
|
2655
|
+
* The width the column starts at when it has no `defaultWidth`, in pixels.
|
|
2656
|
+
* @default 150
|
|
2657
|
+
*/
|
|
2658
|
+
idealWidth?: number;
|
|
2659
|
+
/**
|
|
2660
|
+
* The width the column starts at, in pixels. It wins over `idealWidth`.
|
|
2661
|
+
* @default idealWidth, else 150
|
|
2662
|
+
*/
|
|
2663
|
+
defaultWidth?: number;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2642
2666
|
/**
|
|
2643
2667
|
* An editable combobox: a text input with a filterable listbox of `Option`s (APG combobox with
|
|
2644
2668
|
* list autocomplete). Typing filters the options; ArrowDown/ArrowUp move the highlight
|
|
@@ -2668,6 +2692,15 @@ export declare interface ColorSwatchProps extends Omit<React_2.ButtonHTMLAttribu
|
|
|
2668
2692
|
* the value. `freeform` is not available with `multiselect`, and a non-literal
|
|
2669
2693
|
* `multiselect={flag}` is a type error: render two elements, one for each mode.
|
|
2670
2694
|
*
|
|
2695
|
+
* **Data mode**: `items` passes the options as data instead of children. The open list renders an
|
|
2696
|
+
* option per matching item (`renderOption` draws it, an `Option` with the item's label by
|
|
2697
|
+
* default) and the closed list none; the keys, the filter and the input's text follow the data,
|
|
2698
|
+
* and each option carries `aria-posinset` and `aria-setsize` among the shown options. A long list
|
|
2699
|
+
* takes a `virtualWindow` (from `useVirtualWindow({ itemSize })`): the open list then renders only
|
|
2700
|
+
* the options in view, plus an overscan, with spacers for the others, every option `itemSize`
|
|
2701
|
+
* tall; the active option stays rendered, and opening scrolls it (else the first selected option)
|
|
2702
|
+
* to the middle of the list.
|
|
2703
|
+
*
|
|
2671
2704
|
* The `<input>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,
|
|
2672
2705
|
* `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`,
|
|
2673
2706
|
* `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp` and the text input attributes `autoComplete`,
|
|
@@ -2694,7 +2727,8 @@ export declare const Combobox: ComboboxComponent;
|
|
|
2694
2727
|
* Combobox: `root` on the outer element; `input` on the `role="combobox"` input; `clearButton` on
|
|
2695
2728
|
* the clear button; `expandButton` on the expand button and `expandIcon` on its glyph; `listbox`
|
|
2696
2729
|
* on the `role="listbox"` list; `surface` on its portaled popup; `emptyMessage` on the
|
|
2697
|
-
* "No matches" row
|
|
2730
|
+
* "No matches" row; `spacer` on each spacer element of the list with a `virtualWindow` (the
|
|
2731
|
+
* elements that stand in for the options that are not rendered).
|
|
2698
2732
|
*/
|
|
2699
2733
|
export declare const comboboxClassNames: {
|
|
2700
2734
|
readonly root: "wave-combobox";
|
|
@@ -2705,6 +2739,7 @@ export declare const comboboxClassNames: {
|
|
|
2705
2739
|
readonly listbox: "wave-combobox__listbox";
|
|
2706
2740
|
readonly surface: "wave-combobox__surface";
|
|
2707
2741
|
readonly emptyMessage: "wave-combobox__empty-message";
|
|
2742
|
+
readonly spacer: "wave-combobox__spacer";
|
|
2708
2743
|
};
|
|
2709
2744
|
|
|
2710
2745
|
/** The Combobox component's type: a multi-select signature, then the single-select one. */
|
|
@@ -2857,8 +2892,9 @@ export declare interface ComboboxProps<M extends boolean = false> extends Omit<R
|
|
|
2857
2892
|
* keep options that do not contain the text: `filter={() => true}` with `query` and
|
|
2858
2893
|
* `onQueryChange` leaves the matching to you (a server-side search that replaces the options),
|
|
2859
2894
|
* and a filter that always keeps an option of your own gives a "Create …" entry. With a
|
|
2860
|
-
* server-side search, keep the selected option among the children, `hidden` while
|
|
2861
|
-
* leave it out: a value without an option shows no label (the "Async search" story
|
|
2895
|
+
* server-side search, keep the selected option among the children (or `items`), `hidden` while
|
|
2896
|
+
* the results leave it out: a value without an option shows no label (the "Async search" story
|
|
2897
|
+
* does this).
|
|
2862
2898
|
* @default a case-insensitive substring match on the option's `textValue`, else its `label`
|
|
2863
2899
|
*/
|
|
2864
2900
|
filter?: (option: ListboxItem, query: string) => boolean;
|
|
@@ -2952,6 +2988,51 @@ export declare interface ComboboxProps<M extends boolean = false> extends Omit<R
|
|
|
2952
2988
|
* Unset members keep their English defaults.
|
|
2953
2989
|
*/
|
|
2954
2990
|
labels?: ComboboxLabels;
|
|
2991
|
+
/**
|
|
2992
|
+
* Data mode: the options as data, in list order (`value`, `label`, and optionally `textValue`,
|
|
2993
|
+
* `disabled` and `hidden`; values unique). The open list renders one option per item that is
|
|
2994
|
+
* not `hidden` and that the typed text matches (`filter`, on `textValue ?? label` by default; see
|
|
2995
|
+
* `renderOption`); the closed list renders none. The keys, the selection and the input's label
|
|
2996
|
+
* text follow `items`, also for a selected item whose option is not rendered. The children are
|
|
2997
|
+
* neither read nor rendered: passing both warns once in development. Each option gets
|
|
2998
|
+
* `aria-posinset` and `aria-setsize` from its place among the shown items (typing narrows
|
|
2999
|
+
* them), and keeps one id per value. Without it, the options are the `Option` children.
|
|
3000
|
+
*/
|
|
3001
|
+
items?: readonly ListboxItem[];
|
|
3002
|
+
/**
|
|
3003
|
+
* Data mode: renders the option of an item, given its state (`selected`, `active`, and `index`
|
|
3004
|
+
* among the shown options). Return an `Option`, or an option component of your own on
|
|
3005
|
+
* `useListboxOption`, with the item's `value` (and its `disabled`); its position is set for you,
|
|
3006
|
+
* and in a windowed list (`virtualWindow`) its height. It is called again only when the item, its
|
|
3007
|
+
* state, its position (`aria-posinset` and `aria-setsize`, which typing changes) or the function
|
|
3008
|
+
* itself changes, so pass a stable function in a long list. Ignored without `items`, with a
|
|
3009
|
+
* development warning.
|
|
3010
|
+
* @default an `Option` with the item's `value`, `label` (also its text), `textValue` and `disabled`
|
|
3011
|
+
*/
|
|
3012
|
+
renderOption?: (item: ListboxItem, state: ListboxOptionRenderState) => React_2.ReactNode;
|
|
3013
|
+
/**
|
|
3014
|
+
* Data mode: renders only the options in view of a long list, plus an overscan, and spacers
|
|
3015
|
+
* (`aria-hidden`, `data-virtual-spacer`) as tall as the options they stand for: pass the result
|
|
3016
|
+
* of `useVirtualWindow({ itemSize })`, or an object of your own that implements `VirtualWindow`.
|
|
3017
|
+
* It needs `items`: without them, or beside `OptionGroup` children, it is ignored with a
|
|
3018
|
+
* development warning (a window renders a flat list).
|
|
3019
|
+
*
|
|
3020
|
+
* The open popup's list is the window's scroller, so it needs no height of yours: it scrolls
|
|
3021
|
+
* within its own maximum height (15rem, 240 pixels at the default root size, less where the
|
|
3022
|
+
* viewport has no room). Every option is exactly `itemSize` tall (the list sets its height,
|
|
3023
|
+
* after the option's own `style`), so an option's content must fit in it: the default `Option`
|
|
3024
|
+
* with one line of text is 32 pixels tall.
|
|
3025
|
+
*
|
|
3026
|
+
* The window counts the shown options: typing narrows it, as it narrows `aria-setsize`. The
|
|
3027
|
+
* arrow keys move over all of them; the active option stays rendered while it is scrolled away,
|
|
3028
|
+
* so `aria-activedescendant` always names an element, and when a key (or typing) makes it
|
|
3029
|
+
* active the list and the window move to it in the same update. Opening the list scrolls the
|
|
3030
|
+
* active option, else the first selected one, to the middle of the list, and again once the
|
|
3031
|
+
* popup's positioning has given the list its height (a short viewport) unless it was scrolled
|
|
3032
|
+
* first. A closed list renders no option. The browser's scroll anchoring is off on a windowed
|
|
3033
|
+
* list (the window lays the options out).
|
|
3034
|
+
*/
|
|
3035
|
+
virtualWindow?: VirtualWindow;
|
|
2955
3036
|
/**
|
|
2956
3037
|
* Called when the `<input role="combobox">` receives focus (the root keeps other handlers).
|
|
2957
3038
|
* With `multiselect`, a focus while the input shows the selected labels then selects them;
|
|
@@ -3239,6 +3320,29 @@ export declare function createToaster(): ToasterHandle;
|
|
|
3239
3320
|
* itself, and `DataGrid.Body` also takes a render function that returns each item's row. Rows
|
|
3240
3321
|
* rendered from `items` take their `rowId` from `getRowId` (by default the item's index).
|
|
3241
3322
|
*
|
|
3323
|
+
* With `items`, selection follows the data rather than the rendered rows: select-all and its
|
|
3324
|
+
* checkbox cover every item (`isSelectionDisabled` leaves items out), and ids of rows that are
|
|
3325
|
+
* filtered out, on another page or not rendered stay selected through row clicks, select-all and
|
|
3326
|
+
* sorting, and are reported by `onSelectedItemsChange`.
|
|
3327
|
+
*
|
|
3328
|
+
* With `items` and `columns`, the columns can be sized: `resizableColumns` gives each column
|
|
3329
|
+
* header a resize handle (a separator that a pointer drags and the arrow keys move, mirrored in
|
|
3330
|
+
* right-to-left grids; F2 on a column header moves focus to it, and Enter, Space or Escape back),
|
|
3331
|
+
* `columnSizingOptions` sets each column's initial and minimum width, and `columnWidths` or
|
|
3332
|
+
* `defaultColumnWidths` with `onColumnWidthsChange(widths, details)` hold the widths, for
|
|
3333
|
+
* instance to persist them (Fluent's `resizableColumns`, `columnSizingOptions` and
|
|
3334
|
+
* `onColumnResize`, whose data is in `details`). The grid then lays its columns out from the
|
|
3335
|
+
* widths and truncates its cells' text.
|
|
3336
|
+
*
|
|
3337
|
+
* With `items` and `columns`, a `virtualWindow` (from `useVirtualWindow`) renders only the rows in
|
|
3338
|
+
* view of a long list, with spacer rows for the others: the scroll wrapper (`containerProps`)
|
|
3339
|
+
* needs a bounded height, and every row has the window's fixed row height. The header stays at
|
|
3340
|
+
* the top of the wrapper, the keyboard moves by the data (a row that is not rendered is scrolled
|
|
3341
|
+
* in before it gets focus), the focused row stays rendered, and selection, select-all, sorting
|
|
3342
|
+
* and column sizing still cover every item. The grid then carries `aria-rowcount` and its rows
|
|
3343
|
+
* `aria-rowindex`, so assistive technology reads each row's place in the whole list. Fluent's
|
|
3344
|
+
* DataGrid has no built-in counterpart.
|
|
3345
|
+
*
|
|
3242
3346
|
* Sub-components are available as `DataGrid.Header`, `DataGrid.HeaderCell`, `DataGrid.Body`,
|
|
3243
3347
|
* `DataGrid.Row`, `DataGrid.Cell` and `DataGrid.SelectionCell` in client components, and as the
|
|
3244
3348
|
* flat exports `DataGridHeader`, `DataGridHeaderCell`, `DataGridBody`, `DataGridRow`,
|
|
@@ -3250,7 +3354,7 @@ export declare const DataGrid: typeof DataGridRoot & {
|
|
|
3250
3354
|
displayName: string;
|
|
3251
3355
|
};
|
|
3252
3356
|
HeaderCell: {
|
|
3253
|
-
({ columnId, sortable, sortIcon, children, className, onClick, ref, ...rest }: DataGridHeaderCellProps): React_2.JSX.Element;
|
|
3357
|
+
({ columnId, sortable, sortIcon, children, className, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...rest }: DataGridHeaderCellProps): React_2.JSX.Element;
|
|
3254
3358
|
displayName: string;
|
|
3255
3359
|
};
|
|
3256
3360
|
Body: {
|
|
@@ -3258,7 +3362,7 @@ export declare const DataGrid: typeof DataGridRoot & {
|
|
|
3258
3362
|
displayName: string;
|
|
3259
3363
|
};
|
|
3260
3364
|
Row: {
|
|
3261
|
-
({ rowId: rowIdProp, selectionLabel, selectionCellProps, children, className, onClick, onKeyDown, ref, ...rest }: DataGridRowProps): React_2.JSX.Element;
|
|
3365
|
+
({ rowId: rowIdProp, selectionLabel, selectionCellProps, children, className, style, onClick, onKeyDown, ref, ...rest }: DataGridRowProps): React_2.JSX.Element;
|
|
3262
3366
|
displayName: string;
|
|
3263
3367
|
};
|
|
3264
3368
|
Cell: {
|
|
@@ -3275,10 +3379,28 @@ export declare const DataGrid: typeof DataGridRoot & {
|
|
|
3275
3379
|
export declare interface DataGridBaseProps<T = unknown> extends React_2.HTMLAttributes<HTMLTableElement> {
|
|
3276
3380
|
/**
|
|
3277
3381
|
* The row id of an item: the `rowId` of its row (for selection), for rows rendered from `items`.
|
|
3278
|
-
*
|
|
3382
|
+
* Select-all and its checkbox use these ids, whether the rows are rendered or not. A row's own
|
|
3383
|
+
* `rowId` wins for that row, but a row whose own id differs from its item's id is outside
|
|
3384
|
+
* select-all and its state, and select-all selects the item's id, which no row has (a
|
|
3385
|
+
* development warning says so): return the rows' ids here rather than setting `rowId`. Ids must
|
|
3386
|
+
* be unique (a duplicate warns in development). Define it outside the component, or memoise it:
|
|
3387
|
+
* a new function rebuilds the row of every item and the set of ids select-all works on (with a
|
|
3388
|
+
* `virtualWindow`, the component that holds the window renders at every row the view enters).
|
|
3279
3389
|
* @default the item's index in `items`, as a string
|
|
3280
3390
|
*/
|
|
3281
3391
|
getRowId?: (item: T) => string;
|
|
3392
|
+
/**
|
|
3393
|
+
* Whether the selection of an item of `items` is disabled (`index` is its index in `items`), so
|
|
3394
|
+
* select-all can skip items whose rows are not rendered. Select-all leaves such an item as it is,
|
|
3395
|
+
* selected or not, and its state counts only the other items. The item's row takes it as the
|
|
3396
|
+
* `disabled` of its selection cell (a disabled control; neither a row click nor Space changes
|
|
3397
|
+
* it), unless the cell sets `disabled` itself: the cell's value then applies to the control, a
|
|
3398
|
+
* value that disagrees warns in development, and select-all skips a row that either disables.
|
|
3399
|
+
* Without it, every item is selectable unless its rendered row disables its selection cell.
|
|
3400
|
+
* Ignored without `items`. Called for every item whenever `items`, `getRowId` or this function
|
|
3401
|
+
* change: define it outside the component, or memoise it.
|
|
3402
|
+
*/
|
|
3403
|
+
isSelectionDisabled?: (item: T, index: number) => boolean;
|
|
3282
3404
|
/**
|
|
3283
3405
|
* Column definitions. When given and no `DataGrid.Header` child is present, the header row
|
|
3284
3406
|
* (including the selection column) is rendered from them: `columnId` becomes the header cell's
|
|
@@ -3289,6 +3411,87 @@ export declare interface DataGridBaseProps<T = unknown> extends React_2.HTMLAttr
|
|
|
3289
3411
|
* memoised).
|
|
3290
3412
|
*/
|
|
3291
3413
|
columns?: readonly DataGridColumn<T>[];
|
|
3414
|
+
/**
|
|
3415
|
+
* Gives the header cell of each column (of `columns`, by `columnId`; the last one included, the
|
|
3416
|
+
* selection column not) a resize handle: a focusable `role="separator"` with the column's width
|
|
3417
|
+
* as `aria-valuenow`. A drag (mouse, touch or pen) moves the column's end edge, mirrored in
|
|
3418
|
+
* right-to-left grids. From the keyboard, F2 on a header cell (or on its sort button) moves focus
|
|
3419
|
+
* to its handle, which adds no Tab stop to the grid; there the arrow keys move the edge by 20
|
|
3420
|
+
* pixels (5 with Shift, mirrored in right-to-left grids), Home sets the minimum width, and Enter,
|
|
3421
|
+
* Space or Escape return focus to the header (its sort button, which Enter still activates
|
|
3422
|
+
* directly). A double click sets the column back to its initial width once a width is state.
|
|
3423
|
+
* The grid carries `data-resizing` while a handle drags. Needs `columns` and `items`, as every
|
|
3424
|
+
* column width prop does: without them they are all ignored, with a development warning.
|
|
3425
|
+
* Fluent's `resizableColumns`.
|
|
3426
|
+
* @default false
|
|
3427
|
+
*/
|
|
3428
|
+
resizableColumns?: boolean;
|
|
3429
|
+
/**
|
|
3430
|
+
* The sizing of each column, by `columnId`: `minWidth` (`@default 80`), and the width it starts
|
|
3431
|
+
* at, `defaultWidth`, else `idealWidth`, else 150 (never below `minWidth`). With it, or with
|
|
3432
|
+
* `columnWidths` or `defaultColumnWidths`, the grid lays its columns out from these widths
|
|
3433
|
+
* (a `<colgroup>` and a fixed table layout) with or without `resizableColumns`, and its cells
|
|
3434
|
+
* truncate their text with an ellipsis unless a cell's class says otherwise. Until a width is
|
|
3435
|
+
* state the grid is 100% wide and at least as wide as its columns, so a wider container spreads
|
|
3436
|
+
* them (the selection column too); the first change takes the widths the columns are drawn at,
|
|
3437
|
+
* so nothing jumps, and from then on the grid is exactly as wide as its columns (slack shows
|
|
3438
|
+
* after the last one). There is no maximum width and no fitting to the container. Ids that are
|
|
3439
|
+
* not columns are ignored; it may be written inline. Fluent's `columnSizingOptions`.
|
|
3440
|
+
*/
|
|
3441
|
+
columnSizingOptions?: Record<string, ColumnSizingOption>;
|
|
3442
|
+
/**
|
|
3443
|
+
* The column widths in pixels (controlled), by `columnId`; a column without an entry has its
|
|
3444
|
+
* initial width (see `columnSizingOptions`), and a width below the column's minimum is held at
|
|
3445
|
+
* it. The grid is exactly as wide as its columns. Pair it with `onColumnWidthsChange`; a parent
|
|
3446
|
+
* that ignores a change leaves the column where it is.
|
|
3447
|
+
*/
|
|
3448
|
+
columnWidths?: Record<string, number>;
|
|
3449
|
+
/** The column widths in pixels at first render (uncontrolled; see `columnWidths`). */
|
|
3450
|
+
defaultColumnWidths?: Record<string, number>;
|
|
3451
|
+
/**
|
|
3452
|
+
* Called with the width of every column (by `columnId`) whenever a width changes, at every step
|
|
3453
|
+
* of a drag (at most once per animation frame) or key press, then `details`: `{ columnId,
|
|
3454
|
+
* width, event }`, the resized column, its new width and the event behind it. The grid always
|
|
3455
|
+
* passes `details`; it is typed optional through 0.x, as every `details` argument. Setting the
|
|
3456
|
+
* width a column already has does not call it once a width is state. Fluent's `onColumnResize`,
|
|
3457
|
+
* whose data is in `details`.
|
|
3458
|
+
*/
|
|
3459
|
+
onColumnWidthsChange?: (widths: Record<string, number>, details?: TableColumnWidthsChangeDetails) => void;
|
|
3460
|
+
/**
|
|
3461
|
+
* Renders only the body rows in view, plus an overscan, of a grid with many `items`: pass the
|
|
3462
|
+
* result of `useVirtualWindow({ itemSize })` (or an object of your own that implements
|
|
3463
|
+
* `VirtualWindow`). The rows that are not rendered are replaced by spacer rows (`aria-hidden`,
|
|
3464
|
+
* `data-virtual-spacer`) of their height. Fluent has no counterpart in its DataGrid.
|
|
3465
|
+
*
|
|
3466
|
+
* The grid's scroll wrapper (the element of `containerProps`) becomes the window's scroller, so
|
|
3467
|
+
* give it a bounded height, a height or a maximum height in `containerProps`: without one the
|
|
3468
|
+
* window measures the whole list and renders every row (a development warning says so). Every
|
|
3469
|
+
* row has the window's `itemSize` as its height: the grid sets it on each body row, drops the
|
|
3470
|
+
* vertical padding of its cells and keeps their text on one line, so a cell's content must fit
|
|
3471
|
+
* in it. The columns are laid out from widths (as with `columnSizingOptions`), so they never
|
|
3472
|
+
* change width as rows come and go. The header stays at the top of the scroller: pass its height
|
|
3473
|
+
* as `scrollPaddingStart` to `useVirtualWindow`, so keyboard moves bring rows into the area below
|
|
3474
|
+
* it. The scroller is no tab stop of its own (`tabIndex` -1, as Firefox would stop on it; a
|
|
3475
|
+
* `tabIndex` in `containerProps` wins), and the browser's scroll anchoring is off on it (the
|
|
3476
|
+
* window lays the rows out).
|
|
3477
|
+
*
|
|
3478
|
+
* The keyboard moves by the data: ArrowUp/ArrowDown, PageUp/PageDown and Ctrl+Home/Ctrl+End
|
|
3479
|
+
* scroll a target row that is not rendered into the window, then focus it, and the focused row
|
|
3480
|
+
* stays rendered when it is scrolled away. When a data change (a sort, new `items`) makes the
|
|
3481
|
+
* browser drop focus from the moved row, focus returns to the same row, or to the row nearest
|
|
3482
|
+
* its place. Sorting, selection, select-all and column sizing work on every item, rendered or
|
|
3483
|
+
* not. The grid carries `aria-rowcount` (the items plus the header rows), every row
|
|
3484
|
+
* `aria-rowindex` (1-based, the header rows first, the body rows in the sorted order) and every
|
|
3485
|
+
* body row `data-row-index` (its 0-based position in the sorted order); a grid without a window
|
|
3486
|
+
* renders none of them.
|
|
3487
|
+
*
|
|
3488
|
+
* Needs `items` and `columns`, with the body rows rendered from them (no `DataGrid.Body` child,
|
|
3489
|
+
* or one whose child is a render function); otherwise it is ignored, with a development warning.
|
|
3490
|
+
* The component that calls `useVirtualWindow` renders again at every row the view enters: keep
|
|
3491
|
+
* `items`, `columns`, `getRowId` and `isSelectionDisabled` stable (defined outside it, or
|
|
3492
|
+
* memoised), or each of those renders rebuilds the rows of every item.
|
|
3493
|
+
*/
|
|
3494
|
+
virtualWindow?: VirtualWindow;
|
|
3292
3495
|
/**
|
|
3293
3496
|
* Row selection mode. `'multiple'` adds a checkbox column with a "Select all rows" header
|
|
3294
3497
|
* checkbox; `'single'` adds a radio column (its header reads "Selection" to assistive
|
|
@@ -3297,8 +3500,10 @@ export declare interface DataGridBaseProps<T = unknown> extends React_2.HTMLAttr
|
|
|
3297
3500
|
*/
|
|
3298
3501
|
selectionMode?: 'none' | SelectionMode_2;
|
|
3299
3502
|
/**
|
|
3300
|
-
* The
|
|
3301
|
-
*
|
|
3503
|
+
* The grid's built-in text, for localization: the name of the select-all checkbox
|
|
3504
|
+
* (`selectAll`), the header text of the selection column (`selectionHeader`), and, with
|
|
3505
|
+
* `resizableColumns`, the name of the resize handles (`resizeColumn`) and their value text
|
|
3506
|
+
* (`columnWidth`). Unset members keep their English defaults. Rows are named with their own
|
|
3302
3507
|
* `selectionLabel`.
|
|
3303
3508
|
*/
|
|
3304
3509
|
labels?: DataGridLabels;
|
|
@@ -3330,18 +3535,33 @@ export declare interface DataGridBaseProps<T = unknown> extends React_2.HTMLAttr
|
|
|
3330
3535
|
*/
|
|
3331
3536
|
subtleSelection?: boolean;
|
|
3332
3537
|
/**
|
|
3333
|
-
* Controlled selected row ids (`DataGrid.Row` `rowId
|
|
3334
|
-
*
|
|
3538
|
+
* Controlled selected row ids (`DataGrid.Row` `rowId`; with `items`, the ids from `getRowId`).
|
|
3539
|
+
* With `items`, every id counts, whether its row is rendered, filtered out or on another page
|
|
3540
|
+
* (see `onSelectedItemsChange`). In single mode pass at most one id: with several, only the
|
|
3541
|
+
* first one is selected (without `items`, the first one whose row is rendered), and a
|
|
3542
|
+
* development warning says so.
|
|
3335
3543
|
*/
|
|
3336
3544
|
selectedItems?: readonly string[];
|
|
3337
3545
|
/** Initially selected row ids (uncontrolled). In single mode, at most one (see `selectedItems`). */
|
|
3338
3546
|
defaultSelectedItems?: readonly string[];
|
|
3339
3547
|
/**
|
|
3340
3548
|
* Called with the new selected row ids when the selection changes, then `details` (`{ event }`,
|
|
3341
|
-
* the click or key press behind the change).
|
|
3342
|
-
*
|
|
3343
|
-
*
|
|
3344
|
-
*
|
|
3549
|
+
* the click or key press behind the change).
|
|
3550
|
+
*
|
|
3551
|
+
* With `items`, the selection follows the data: it reports every selected id, also ids whose
|
|
3552
|
+
* rows are not rendered or not in `items` (filtered out, on another page, restored by id), and no
|
|
3553
|
+
* change drops them. Select-all selects every item of `items` whose selection is not disabled
|
|
3554
|
+
* (`isSelectionDisabled`, or the selection cell of its rendered row) and keeps every other id;
|
|
3555
|
+
* when all of them are selected it removes only their ids. The select-all checkbox shows the
|
|
3556
|
+
* state of those items. Both use the ids from `getRowId` (by default the item's index): a row
|
|
3557
|
+
* that sets its own, different `rowId` (or a `DataGrid.Row` child whose `rowId` is no item's
|
|
3558
|
+
* id) is outside them, and select-all then selects ids that no row has, with a development
|
|
3559
|
+
* warning. Pass a `getRowId` that returns the rows' ids.
|
|
3560
|
+
*
|
|
3561
|
+
* Without `items` (rows written as `DataGrid.Row` children), ids of rows that are not rendered
|
|
3562
|
+
* are left out of the reported selection and of the select-all state, so the next change drops
|
|
3563
|
+
* them. Until that change an uncontrolled grid still holds such an id: a row re-added with the
|
|
3564
|
+
* same `rowId` before then is shown selected again.
|
|
3345
3565
|
*/
|
|
3346
3566
|
onSelectedItemsChange?: (selectedItems: string[], details?: DataGridSelectedItemsChangeDetails) => void;
|
|
3347
3567
|
/** @deprecated Use `selectedItems` (an array). A `Set` or an array is accepted. */
|
|
@@ -3352,7 +3572,8 @@ export declare interface DataGridBaseProps<T = unknown> extends React_2.HTMLAttr
|
|
|
3352
3572
|
onSelectionChange?: (keys: Set<string>) => void;
|
|
3353
3573
|
/**
|
|
3354
3574
|
* Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container
|
|
3355
|
-
* (`overflow-x-auto`). Use it for its className, style (e.g. a max height) or ref.
|
|
3575
|
+
* (`overflow-x-auto`). Use it for its className, style (e.g. a max height) or ref. With a
|
|
3576
|
+
* `virtualWindow` it is the window's scroller, which needs a bounded height. The wrapper
|
|
3356
3577
|
* is not a tab stop (the grid's own cell tab stop scrolls it) and has no role, so its
|
|
3357
3578
|
* `aria-label`/`aria-labelledby` are applied only together with a `role` (e.g. `'region'`);
|
|
3358
3579
|
* without one they are dropped with a development warning. Name the grid with `aria-label`.
|
|
@@ -3370,7 +3591,9 @@ export declare interface DataGridBaseProps<T = unknown> extends React_2.HTMLAttr
|
|
|
3370
3591
|
/**
|
|
3371
3592
|
* The grid's `<tbody>`. Its child can also be a render function, called with each item of the
|
|
3372
3593
|
* grid's `items` (and its index there) to render the item's row; without children, a grid with
|
|
3373
|
-
* `items` and `columns` renders the rows from the columns.
|
|
3594
|
+
* `items` and `columns` renders the rows from the columns. In a grid with a `virtualWindow` it
|
|
3595
|
+
* renders the rows of the window, the function being called for those rows only, and a spacer
|
|
3596
|
+
* row for each run of rows it leaves out.
|
|
3374
3597
|
*/
|
|
3375
3598
|
export declare const DataGridBody: {
|
|
3376
3599
|
<T>({ children, className, ref, ...rest }: DataGridBodyProps<T>): React_2.JSX.Element;
|
|
@@ -3401,7 +3624,10 @@ export declare interface DataGridBodyProps<T = unknown> extends Omit<React_2.HTM
|
|
|
3401
3624
|
|
|
3402
3625
|
/**
|
|
3403
3626
|
* A grid cell (`<td>`), focusable through the grid's keyboard navigation. It is the positioning
|
|
3404
|
-
* box of a `Table.CellActions` inside it.
|
|
3627
|
+
* box of a `Table.CellActions` inside it. In a grid that lays its columns out from widths (column
|
|
3628
|
+
* sizing, a `virtualWindow`), its text stays on one line and is truncated with an ellipsis, unless
|
|
3629
|
+
* its class says otherwise. In a body row of a grid with a `virtualWindow` it has no vertical
|
|
3630
|
+
* padding: the row has the window's height, which its content must fit in.
|
|
3405
3631
|
*/
|
|
3406
3632
|
export declare const DataGridCell: {
|
|
3407
3633
|
({ children, className, ref, ...rest }: DataGridCellProps): React_2.JSX.Element;
|
|
@@ -3421,10 +3647,15 @@ export declare interface DataGridCellProps extends React_2.TdHTMLAttributes<HTML
|
|
|
3421
3647
|
ref?: React_2.Ref<HTMLTableCellElement>;
|
|
3422
3648
|
}
|
|
3423
3649
|
|
|
3424
|
-
/**
|
|
3650
|
+
/**
|
|
3651
|
+
* DataGrid: `root` on the grid element (`role="grid"`); `container` on the wrapper around it;
|
|
3652
|
+
* `spacer` on each spacer row of a grid with a `virtualWindow` (the rows that stand in for the
|
|
3653
|
+
* rows that are not rendered).
|
|
3654
|
+
*/
|
|
3425
3655
|
export declare const dataGridClassNames: {
|
|
3426
3656
|
readonly root: "wave-data-grid";
|
|
3427
3657
|
readonly container: "wave-data-grid__container";
|
|
3658
|
+
readonly spacer: "wave-data-grid__spacer";
|
|
3428
3659
|
};
|
|
3429
3660
|
|
|
3430
3661
|
/**
|
|
@@ -3492,6 +3723,8 @@ export declare interface DataGridControlledSortProps extends NoDeprecatedSortPro
|
|
|
3492
3723
|
* mode) or the "Selection" header (single mode; DataGrid's `labels` localizes both), later rows of
|
|
3493
3724
|
* a grouped header an empty cell. A header row rendered by another component cannot get it (a
|
|
3494
3725
|
* development warning says so): use `DataGrid.Row` for such a row, which adds the cell itself.
|
|
3726
|
+
* In a grid with a `virtualWindow` the header stays at the top of the grid's scroll wrapper while
|
|
3727
|
+
* the rows scroll under it, and each header row carries its `aria-rowindex`.
|
|
3495
3728
|
*/
|
|
3496
3729
|
export declare const DataGridHeader: {
|
|
3497
3730
|
({ children, className, ref, ...rest }: DataGridHeaderProps): React_2.JSX.Element;
|
|
@@ -3503,21 +3736,28 @@ export declare const DataGridHeader: {
|
|
|
3503
3736
|
* `<button type="button">` that toggles the sort, followed by the direction glyph (`sortIcon`)
|
|
3504
3737
|
* while its column is sorted; the `<th>` carries `aria-sort`. A consumer `onClick` (on the `<th>`)
|
|
3505
3738
|
* runs before the sort, and calling `preventDefault()` in it cancels the sort (also for
|
|
3506
|
-
* Enter/Space on the button, which click it).
|
|
3739
|
+
* Enter/Space on the button, which click it). In a grid with `resizableColumns`, the header cell
|
|
3740
|
+
* of a column of `columns` (by `columnId`) also holds the column's resize handle, after its
|
|
3741
|
+
* content, along its end edge (the cell is positioned for it); the cell is then named by its
|
|
3742
|
+
* content alone (`aria-labelledby`, unless it has a name of its own), not by the handle's label.
|
|
3743
|
+
* The handle is no target of the grid's navigation: a sortable cell's target stays its sort
|
|
3744
|
+
* button, and F2 on the cell or the button moves focus to the handle.
|
|
3507
3745
|
*/
|
|
3508
3746
|
export declare const DataGridHeaderCell: {
|
|
3509
|
-
({ columnId, sortable, sortIcon, children, className, onClick, ref, ...rest }: DataGridHeaderCellProps): React_2.JSX.Element;
|
|
3747
|
+
({ columnId, sortable, sortIcon, children, className, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...rest }: DataGridHeaderCellProps): React_2.JSX.Element;
|
|
3510
3748
|
displayName: string;
|
|
3511
3749
|
};
|
|
3512
3750
|
|
|
3513
3751
|
/**
|
|
3514
3752
|
* DataGrid.HeaderCell: `root` on the `<th>`; `button` on the sort button; `sortIcon` on its
|
|
3515
|
-
* direction glyph (the default arrow `<svg>`, or the `<span>` of a `sortIcon` slot)
|
|
3753
|
+
* direction glyph (the default arrow `<svg>`, or the `<span>` of a `sortIcon` slot);
|
|
3754
|
+
* `resizeHandle` on the column's resize handle (a `Table.ResizeHandle`, with resizable columns).
|
|
3516
3755
|
*/
|
|
3517
3756
|
export declare const dataGridHeaderCellClassNames: {
|
|
3518
3757
|
readonly root: "wave-data-grid-header-cell";
|
|
3519
3758
|
readonly button: "wave-data-grid-header-cell__button";
|
|
3520
3759
|
readonly sortIcon: "wave-data-grid-header-cell__sort-icon";
|
|
3760
|
+
readonly resizeHandle: "wave-data-grid-header-cell__resize-handle";
|
|
3521
3761
|
};
|
|
3522
3762
|
|
|
3523
3763
|
/** Properties for the DataGridHeaderCell sub-component. */
|
|
@@ -3619,6 +3859,16 @@ export declare interface DataGridLabels {
|
|
|
3619
3859
|
* @default 'Selection'
|
|
3620
3860
|
*/
|
|
3621
3861
|
selectionHeader?: string;
|
|
3862
|
+
/**
|
|
3863
|
+
* Accessible name of each column's resize handle (`resizableColumns`).
|
|
3864
|
+
* @default 'Resize column'
|
|
3865
|
+
*/
|
|
3866
|
+
resizeColumn?: string;
|
|
3867
|
+
/**
|
|
3868
|
+
* Builds the value text of a resize handle (`aria-valuetext`) from the column's width in pixels.
|
|
3869
|
+
* @default (width) => `${width} pixels`
|
|
3870
|
+
*/
|
|
3871
|
+
columnWidth?: (width: number) => string;
|
|
3622
3872
|
}
|
|
3623
3873
|
|
|
3624
3874
|
/**
|
|
@@ -3687,9 +3937,13 @@ declare namespace DataGridRoot {
|
|
|
3687
3937
|
* ancestor, so the rows of a grid nested in a cell
|
|
3688
3938
|
* share it: hovering the outer row also draws the subtle controls of the nested grid (a limit of
|
|
3689
3939
|
* CSS groups). A Tree in a cell keeps its own rows' group.
|
|
3940
|
+
*
|
|
3941
|
+
* In a grid with a `virtualWindow`, a row rendered for an item has the window's `itemSize` as its
|
|
3942
|
+
* height (its own `style` height loses) and carries `aria-rowindex` and `data-row-index`; a header
|
|
3943
|
+
* row carries `aria-rowindex`.
|
|
3690
3944
|
*/
|
|
3691
3945
|
export declare const DataGridRow: {
|
|
3692
|
-
({ rowId: rowIdProp, selectionLabel, selectionCellProps, children, className, onClick, onKeyDown, ref, ...rest }: DataGridRowProps): React_2.JSX.Element;
|
|
3946
|
+
({ rowId: rowIdProp, selectionLabel, selectionCellProps, children, className, style, onClick, onKeyDown, ref, ...rest }: DataGridRowProps): React_2.JSX.Element;
|
|
3693
3947
|
displayName: string;
|
|
3694
3948
|
};
|
|
3695
3949
|
|
|
@@ -3710,7 +3964,9 @@ export declare interface DataGridRowProps extends React_2.HTMLAttributes<HTMLTab
|
|
|
3710
3964
|
* a duplicate warns in development). A selectable grid renders no selection control (and warns
|
|
3711
3965
|
* in development) for a row without it. A row rendered from the grid's `items` (by
|
|
3712
3966
|
* `DataGrid.Body`'s render function or from `columns`) defaults to the item's row id
|
|
3713
|
-
* (`getRowId`).
|
|
3967
|
+
* (`getRowId`). In a grid with `items`, select-all uses the ids from `getRowId`: a row whose
|
|
3968
|
+
* `rowId` differs from its item's id, or is no item's id, is outside it (a development warning
|
|
3969
|
+
* says so), so set `getRowId` rather than a different `rowId`.
|
|
3714
3970
|
*/
|
|
3715
3971
|
rowId?: string;
|
|
3716
3972
|
/**
|
|
@@ -3746,7 +4002,7 @@ export declare interface DataGridRowSelectionCellProps {
|
|
|
3746
4002
|
* (the cell takes focus), and neither a row click (`selectOnRowClick`), Space on a cell nor
|
|
3747
4003
|
* select-all changes the row's selection: select-all skips it, keeps it as it is, and tells its
|
|
3748
4004
|
* state from the other rows. In a header row it disables the select-all checkbox.
|
|
3749
|
-
* @default false
|
|
4005
|
+
* @default false (in a row rendered from `items`: the grid's `isSelectionDisabled` for its item)
|
|
3750
4006
|
*/
|
|
3751
4007
|
disabled?: boolean;
|
|
3752
4008
|
/**
|
|
@@ -3787,6 +4043,8 @@ export declare type DataGridSelectionAppearance = 'brand' | 'neutral' | 'none';
|
|
|
3787
4043
|
* selection cell props of its row (`selectionCellProps`), its own winning. `aria-label`,
|
|
3788
4044
|
* `aria-labelledby` and `aria-describedby` go to the control; the other props, `className` and
|
|
3789
4045
|
* `ref` to the cell. In a grid without selection it renders nothing (with a development warning).
|
|
4046
|
+
* In a body row of a grid with a `virtualWindow` it has no vertical padding (the row has the
|
|
4047
|
+
* window's height) and its control is centred.
|
|
3790
4048
|
*/
|
|
3791
4049
|
export declare const DataGridSelectionCell: {
|
|
3792
4050
|
({ disabled, invisible, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, controlRef, ref, ...rest }: DataGridSelectionCellProps): React_2.JSX.Element | null;
|
|
@@ -5454,6 +5712,14 @@ export declare type DrawerType = 'overlay' | 'inline';
|
|
|
5454
5712
|
* `clearable` then clears every value. A non-literal `multiselect={flag}` is a type error: render
|
|
5455
5713
|
* two elements, one for each mode.
|
|
5456
5714
|
*
|
|
5715
|
+
* **Data mode**: `items` passes the options as data instead of children. The open list renders an
|
|
5716
|
+
* option per item (`renderOption` draws it, an `Option` with the item's label by default) and the
|
|
5717
|
+
* closed list none; the keys, typeahead and the button's text follow the data, and each option
|
|
5718
|
+
* carries `aria-posinset` and `aria-setsize`. A long list takes a `virtualWindow` (from
|
|
5719
|
+
* `useVirtualWindow({ itemSize })`): the open list then renders only the options in view, plus an
|
|
5720
|
+
* overscan, with spacers for the others, every option `itemSize` tall; the active option stays
|
|
5721
|
+
* rendered, and opening scrolls it to the middle of the list.
|
|
5722
|
+
*
|
|
5457
5723
|
* The `<button>` receives `id`, `aria-label`, `aria-labelledby`, `aria-describedby`,
|
|
5458
5724
|
* `aria-invalid`, `aria-required`, `aria-errormessage`, `aria-details`, `tabIndex`, `autoFocus`
|
|
5459
5725
|
* and `onFocus`/`onBlur`/`onKeyDown`/`onKeyUp`. `ref`, `className`, `style`, other `aria-*`
|
|
@@ -5478,7 +5744,9 @@ export declare const Dropdown: DropdownComponent;
|
|
|
5478
5744
|
/**
|
|
5479
5745
|
* Dropdown: `root` on the outer element; `button` on the `role="combobox"` button; `value` on the
|
|
5480
5746
|
* value or placeholder span; `expandIcon` on the chevron `<svg>`; `clearButton` on the clear
|
|
5481
|
-
* button; `listbox` on the `role="listbox"` list; `surface` on its portaled popup
|
|
5747
|
+
* button; `listbox` on the `role="listbox"` list; `surface` on its portaled popup; `spacer` on
|
|
5748
|
+
* each spacer element of the list with a `virtualWindow` (the elements that stand in for the
|
|
5749
|
+
* options that are not rendered).
|
|
5482
5750
|
*/
|
|
5483
5751
|
export declare const dropdownClassNames: {
|
|
5484
5752
|
readonly root: "wave-dropdown";
|
|
@@ -5488,6 +5756,7 @@ export declare const dropdownClassNames: {
|
|
|
5488
5756
|
readonly clearButton: "wave-dropdown__clear-button";
|
|
5489
5757
|
readonly listbox: "wave-dropdown__listbox";
|
|
5490
5758
|
readonly surface: "wave-dropdown__surface";
|
|
5759
|
+
readonly spacer: "wave-dropdown__spacer";
|
|
5491
5760
|
};
|
|
5492
5761
|
|
|
5493
5762
|
/** The Dropdown component's type: a multi-select signature, then the single-select one. */
|
|
@@ -5665,6 +5934,50 @@ export declare interface DropdownProps<M extends boolean = false> extends Omit<R
|
|
|
5665
5934
|
* announcements, for localization. Unset members keep their English defaults.
|
|
5666
5935
|
*/
|
|
5667
5936
|
labels?: DropdownLabels;
|
|
5937
|
+
/**
|
|
5938
|
+
* Data mode: the options as data, in list order (`value`, `label`, and optionally `textValue`,
|
|
5939
|
+
* `disabled` and `hidden`; values unique). The open list renders one option per item that is
|
|
5940
|
+
* not `hidden` (see `renderOption`); the closed list renders none. The keys, typeahead, the
|
|
5941
|
+
* selection and the button's label text follow `items`, also for a selected item whose option
|
|
5942
|
+
* is not rendered. The children are neither read nor rendered: passing both warns once in
|
|
5943
|
+
* development. Each option gets `aria-posinset` and `aria-setsize` from its place among the
|
|
5944
|
+
* shown items, and keeps one id per value. Without it, the options are the `Option` children.
|
|
5945
|
+
*/
|
|
5946
|
+
items?: readonly ListboxItem[];
|
|
5947
|
+
/**
|
|
5948
|
+
* Data mode: renders the option of an item, given its state (`selected`, `active`, and `index`
|
|
5949
|
+
* among the shown options). Return an `Option`, or an option component of your own on
|
|
5950
|
+
* `useListboxOption`, with the item's `value` (and its `disabled`); its position is set for you,
|
|
5951
|
+
* and in a windowed list (`virtualWindow`) its height. It is called again only when the item, its
|
|
5952
|
+
* state, its position (`aria-posinset` and `aria-setsize`, which new `items` change) or the
|
|
5953
|
+
* function itself changes, so pass a stable function in a long list. Ignored without `items`,
|
|
5954
|
+
* with a development warning.
|
|
5955
|
+
* @default an `Option` with the item's `value`, `label` (also its text), `textValue` and `disabled`
|
|
5956
|
+
*/
|
|
5957
|
+
renderOption?: (item: ListboxItem, state: ListboxOptionRenderState) => React_2.ReactNode;
|
|
5958
|
+
/**
|
|
5959
|
+
* Data mode: renders only the options in view of a long list, plus an overscan, and spacers
|
|
5960
|
+
* (`aria-hidden`, `data-virtual-spacer`) as tall as the options they stand for: pass the result
|
|
5961
|
+
* of `useVirtualWindow({ itemSize })`, or an object of your own that implements `VirtualWindow`.
|
|
5962
|
+
* It needs `items`: without them, or beside `OptionGroup` children, it is ignored with a
|
|
5963
|
+
* development warning (a window renders a flat list).
|
|
5964
|
+
*
|
|
5965
|
+
* The open popup's list is the window's scroller, so it needs no height of yours: it scrolls
|
|
5966
|
+
* within its own maximum height (15rem, 240 pixels at the default root size, less where the
|
|
5967
|
+
* viewport has no room). Every option is exactly `itemSize` tall (the list sets its height,
|
|
5968
|
+
* after the option's own `style`), so an option's content must fit in it: the default `Option`
|
|
5969
|
+
* with one line of text is 32 pixels tall.
|
|
5970
|
+
*
|
|
5971
|
+
* The window counts the shown options (the items that are not `hidden`). The keys and typeahead
|
|
5972
|
+
* move over all of them (Home and End to the first and the last, PageUp and PageDown by ten); the
|
|
5973
|
+
* active option stays rendered while it is scrolled away, so `aria-activedescendant` always names
|
|
5974
|
+
* an element, and when a key makes it active the list and the window move to it in the same
|
|
5975
|
+
* update. Opening the list scrolls the active option (the selected one, by default) to the
|
|
5976
|
+
* middle of the list, and again once the popup's positioning has given the list its height (a
|
|
5977
|
+
* short viewport) unless it was scrolled first. A closed list renders no option. The browser's
|
|
5978
|
+
* scroll anchoring is off on a windowed list (the window lays the options out).
|
|
5979
|
+
*/
|
|
5980
|
+
virtualWindow?: VirtualWindow;
|
|
5668
5981
|
/** Called when the `<button role="combobox">` receives focus (the root keeps other handlers). */
|
|
5669
5982
|
onFocus?: React_2.FocusEventHandler<HTMLButtonElement>;
|
|
5670
5983
|
/** Called when the `<button role="combobox">` loses focus. */
|
|
@@ -6060,6 +6373,231 @@ export declare interface FieldProps extends React_2.HTMLAttributes<HTMLDivElemen
|
|
|
6060
6373
|
*/
|
|
6061
6374
|
export declare type FirstWeekOfYear = 'first-day' | 'first-full-week' | 'first-four-day-week';
|
|
6062
6375
|
|
|
6376
|
+
/**
|
|
6377
|
+
* A tree built from flat data (WAI-ARIA Tree View pattern) that can render only the items in
|
|
6378
|
+
* view, for trees of thousands of items. Its model comes from `useFlatTree(items, options)`: items
|
|
6379
|
+
* listed with a `parentValue`, in any order, the expanded and the checked state. The tree renders
|
|
6380
|
+
* the visible items (the roots and the children of every expanded branch) as sibling
|
|
6381
|
+
* `role="treeitem"` elements with `aria-level`, `aria-setsize` and `aria-posinset` from the data,
|
|
6382
|
+
* `aria-expanded` on branches, and the nested `Tree`'s chevron, checkbox and radio.
|
|
6383
|
+
*
|
|
6384
|
+
* ```tsx
|
|
6385
|
+
* const model = useFlatTree(items, { defaultExpandedItems: ['docs'] });
|
|
6386
|
+
* const virtualWindow = useVirtualWindow({ itemSize: 28 });
|
|
6387
|
+
* <FlatTree aria-label="Files" model={model} {...model.getTreeProps()} virtualWindow={virtualWindow} style={{ height: 400 }} />
|
|
6388
|
+
* ```
|
|
6389
|
+
*
|
|
6390
|
+
* Windowing: with `virtualWindow` the tree is the scrolling element (it needs a bounded height),
|
|
6391
|
+
* renders the items in view plus the window's overscan and spacers for the others, and every item
|
|
6392
|
+
* is exactly the window's `itemSize` tall. The server renders the first window. Keys move over the
|
|
6393
|
+
* whole visible list, scrolling an item that is not rendered into view before focusing it, and the
|
|
6394
|
+
* focused item stays rendered (and focused) while it is scrolled away.
|
|
6395
|
+
*
|
|
6396
|
+
* Keyboard: a single tab stop, on the focused item while focus is inside, else on the `selected`
|
|
6397
|
+
* item while it is visible, else on the first enabled item; Tab leaves the tree. Up/Down move
|
|
6398
|
+
* between the visible items, Home/End to the first and last, Right expands a collapsed branch or
|
|
6399
|
+
* moves to its first child, Left collapses an expanded branch or moves to the parent (both
|
|
6400
|
+
* mirrored in right-to-left layouts), Enter activates (and toggles a branch), and so does Space
|
|
6401
|
+
* unless the tree has checkboxes, `*` expands the sibling branches, and typing moves to the next
|
|
6402
|
+
* visible item whose label starts with the typed text (items under a collapsed branch are not
|
|
6403
|
+
* searched). The focused item stays the focused item (rendered, and the tab stop) while focus is
|
|
6404
|
+
* in a popup that its content opened, such as a menu in a portal, so the popup can return focus
|
|
6405
|
+
* to it.
|
|
6406
|
+
*
|
|
6407
|
+
* Selection, as the nested `Tree`: `selected` and `onItemSelect` (single selection and activation,
|
|
6408
|
+
* with radios in `selectionMode="single"`), `current`, and with `selectionMode="multiple"` a
|
|
6409
|
+
* checkbox on every item bound to the model's `checkedItems` (Space or a click on the checkbox
|
|
6410
|
+
* toggles it, and checks cascade). An item whose data is `disabled` is `aria-disabled`, is skipped
|
|
6411
|
+
* by the keys and typeahead, never holds the tab stop (except while a pointer press has focused
|
|
6412
|
+
* it), and is neither activated, expanded nor checked by the user (a check of its parent still
|
|
6413
|
+
* includes it).
|
|
6414
|
+
*
|
|
6415
|
+
* When a branch collapses around the focused item (from code), focus moves to that branch, so it
|
|
6416
|
+
* never falls to the page. Items expand and collapse at once, without motion: there is no child
|
|
6417
|
+
* group to animate. A selected item under a collapsed branch is not the tab stop until it is
|
|
6418
|
+
* visible again.
|
|
6419
|
+
*
|
|
6420
|
+
* `FlatTree.Item` is the row the tree renders for each visible item (it is not written by hand);
|
|
6421
|
+
* it is also exported as `FlatTreeItem` for React Server Components, which cannot use the dotted
|
|
6422
|
+
* form.
|
|
6423
|
+
*/
|
|
6424
|
+
export declare const FlatTree: {
|
|
6425
|
+
({ model, virtualWindow, renderItem, selectionMode: selectionModeProp, selected, current, onItemSelect, className, onKeyDown, onFocus, onBlur, onPointerDownCapture, ref, ...rest }: FlatTreeProps): React_2.JSX.Element;
|
|
6426
|
+
displayName: string;
|
|
6427
|
+
} & {
|
|
6428
|
+
Item: {
|
|
6429
|
+
({ item: row, children, className, style, onClick, ref, ...rest }: FlatTreeItemProps): React_2.JSX.Element;
|
|
6430
|
+
displayName: string;
|
|
6431
|
+
};
|
|
6432
|
+
};
|
|
6433
|
+
|
|
6434
|
+
/**
|
|
6435
|
+
* FlatTree: `root` on the `role="tree"` element (the scrolling element of a tree with a
|
|
6436
|
+
* `virtualWindow`); `spacer` on each spacer element of a windowed tree (the elements that stand in
|
|
6437
|
+
* for the items that are not rendered, 0.16).
|
|
6438
|
+
*/
|
|
6439
|
+
export declare const flatTreeClassNames: {
|
|
6440
|
+
readonly root: "wave-flat-tree";
|
|
6441
|
+
readonly spacer: "wave-flat-tree__spacer";
|
|
6442
|
+
};
|
|
6443
|
+
|
|
6444
|
+
/**
|
|
6445
|
+
* One row of a FlatTree, rendered by the tree for each visible item of its model (it is not
|
|
6446
|
+
* written by hand): a `role="treeitem"` element with the item's level, set size and position,
|
|
6447
|
+
* `aria-expanded` on a branch, and the expand chevron, the checkbox (multiple mode) or the radio
|
|
6448
|
+
* (single mode) of the nested `Tree`'s items, before the content. Levels are drawn by indenting
|
|
6449
|
+
* the row, since the items are siblings. In a windowed tree it is exactly the window's `itemSize`
|
|
6450
|
+
* tall.
|
|
6451
|
+
*
|
|
6452
|
+
* `ref`, `className` and the other props land on the treeitem element; its `onClick` receives the
|
|
6453
|
+
* clicks on the row, not those on the checkbox, and runs before the built-in activation (call
|
|
6454
|
+
* `event.preventDefault()` to skip it).
|
|
6455
|
+
*/
|
|
6456
|
+
export declare const FlatTreeItem: {
|
|
6457
|
+
({ item: row, children, className, style, onClick, ref, ...rest }: FlatTreeItemProps): React_2.JSX.Element;
|
|
6458
|
+
displayName: string;
|
|
6459
|
+
};
|
|
6460
|
+
|
|
6461
|
+
/**
|
|
6462
|
+
* FlatTree.Item: `root` on the `role="treeitem"` element; `row` on its row; `expandIcon` on the
|
|
6463
|
+
* chevron of a branch; `indicator` on the checkbox of a multi-select tree or the radio of a
|
|
6464
|
+
* single-select one; `label` on the span around the item's content (0.16).
|
|
6465
|
+
*/
|
|
6466
|
+
export declare const flatTreeItemClassNames: {
|
|
6467
|
+
readonly root: "wave-flat-tree-item";
|
|
6468
|
+
readonly row: "wave-flat-tree-item__row";
|
|
6469
|
+
readonly expandIcon: "wave-flat-tree-item__expand-icon";
|
|
6470
|
+
readonly indicator: "wave-flat-tree-item__indicator";
|
|
6471
|
+
readonly label: "wave-flat-tree-item__label";
|
|
6472
|
+
};
|
|
6473
|
+
|
|
6474
|
+
/** One item of a flat tree: `parentValue` places it, items are listed in any order. */
|
|
6475
|
+
export declare interface FlatTreeItemData {
|
|
6476
|
+
/** The item's identity; it must be unique among the items (a later duplicate is ignored). */
|
|
6477
|
+
value: string;
|
|
6478
|
+
/** The `value` of the item this one is nested in; absent for a root. */
|
|
6479
|
+
parentValue?: string;
|
|
6480
|
+
/**
|
|
6481
|
+
* `'branch'` marks an item that can expand even while it has no child items (children loaded
|
|
6482
|
+
* on demand). An item with child items is a branch whatever its type says.
|
|
6483
|
+
*/
|
|
6484
|
+
itemType?: 'leaf' | 'branch';
|
|
6485
|
+
/** The text the item shows. */
|
|
6486
|
+
label?: string;
|
|
6487
|
+
/**
|
|
6488
|
+
* Whether the item is disabled. `FlatTree` reads it (the keys and typeahead skip the item, it is
|
|
6489
|
+
* not the tab stop, and the user cannot activate, expand or check it); the model ignores it:
|
|
6490
|
+
* `expand`, `collapse`, `toggle` and `setChecked` change a disabled item too, and a check of its
|
|
6491
|
+
* parent includes it.
|
|
6492
|
+
*/
|
|
6493
|
+
disabled?: boolean;
|
|
6494
|
+
}
|
|
6495
|
+
|
|
6496
|
+
/** Properties for the FlatTreeItem sub-component. */
|
|
6497
|
+
export declare interface FlatTreeItemProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
6498
|
+
/** The row the item shows: a visible item of the tree's model (`model.visibleItems`). */
|
|
6499
|
+
item: VisibleFlatItem & {
|
|
6500
|
+
checked?: CheckState;
|
|
6501
|
+
};
|
|
6502
|
+
/** The item's content: what the tree's `renderItem` returns, else the item's label. */
|
|
6503
|
+
children?: React_2.ReactNode;
|
|
6504
|
+
/** Ref to the `role="treeitem"` element. */
|
|
6505
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
6506
|
+
}
|
|
6507
|
+
|
|
6508
|
+
/** The state and the visible rows of a flat tree, from {@link useFlatTree}. */
|
|
6509
|
+
export declare interface FlatTreeModel {
|
|
6510
|
+
/**
|
|
6511
|
+
* The rows to show: the roots and the children of every expanded branch, in tree order. With
|
|
6512
|
+
* `selectionMode: 'multiple'` each row has its `checked` state. The array and its rows keep
|
|
6513
|
+
* their identity until the items, the expanded set or the checked set change.
|
|
6514
|
+
*/
|
|
6515
|
+
visibleItems: readonly (VisibleFlatItem & {
|
|
6516
|
+
checked?: CheckState;
|
|
6517
|
+
})[];
|
|
6518
|
+
/** The visible row of `value`; `undefined` for an item under a collapsed branch or an unknown value. */
|
|
6519
|
+
getItem(value: string): (VisibleFlatItem & {
|
|
6520
|
+
checked?: CheckState;
|
|
6521
|
+
}) | undefined;
|
|
6522
|
+
/**
|
|
6523
|
+
* Expands `value`, or every value of a list in one change (one `onExpandedItemsChange` call, as
|
|
6524
|
+
* `*` on a tree item makes). Nothing happens, and nothing is called, if every value is already in
|
|
6525
|
+
* the expanded set.
|
|
6526
|
+
*/
|
|
6527
|
+
expand(value: string | readonly string[]): void;
|
|
6528
|
+
/** Collapses `value`. Nothing happens, and nothing is called, if it is not in the expanded set. */
|
|
6529
|
+
collapse(value: string): void;
|
|
6530
|
+
/** Expands `value` when it is collapsed and collapses it when it is expanded. */
|
|
6531
|
+
toggle(value: string): void;
|
|
6532
|
+
/** Whether `value` is a branch (an item with child items, or typed `'branch'`) in the expanded set. */
|
|
6533
|
+
isExpanded(value: string): boolean;
|
|
6534
|
+
/**
|
|
6535
|
+
* Sets the check state of `value`, with the cascade of the nested `Tree`: the item and everything
|
|
6536
|
+
* nested in it, then its ancestors from their children. Nothing is called when the item is
|
|
6537
|
+
* already in that state; a mixed item is set to `checked` as requested. A value that matches no
|
|
6538
|
+
* item is added to, or removed from, the checked list. `event` becomes `details.event` of
|
|
6539
|
+
* `onCheckedItemsChange`; without it the callback gets no `details`. It works in any
|
|
6540
|
+
* `selectionMode` (the rows carry `checked` only with `'multiple'`), and on a disabled item too.
|
|
6541
|
+
*/
|
|
6542
|
+
setChecked(value: string, checked: boolean, event?: Event): void;
|
|
6543
|
+
/** The props `FlatTree` takes from the model, for `<FlatTree model={model} {...model.getTreeProps()} />`. */
|
|
6544
|
+
getTreeProps(): {
|
|
6545
|
+
selectionMode: 'none' | SelectionMode_2;
|
|
6546
|
+
};
|
|
6547
|
+
}
|
|
6548
|
+
|
|
6549
|
+
/** Properties for the FlatTree component. */
|
|
6550
|
+
export declare interface FlatTreeProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'children' | 'onSelect'> {
|
|
6551
|
+
/** The tree's model, from `useFlatTree`: the visible rows, the expanded and the checked state. */
|
|
6552
|
+
model: FlatTreeModel;
|
|
6553
|
+
/**
|
|
6554
|
+
* Renders only the items in view (and a few beyond), from `useVirtualWindow({ itemSize })`. The
|
|
6555
|
+
* tree is then the scrolling element: give it a bounded height (a class or a style). Every item
|
|
6556
|
+
* is exactly `itemSize` pixels tall, so its content must fit in one row. Without it every visible
|
|
6557
|
+
* item is rendered.
|
|
6558
|
+
*
|
|
6559
|
+
* The tree element is then no tab stop of its own while an item is (`tabIndex` -1, as Firefox
|
|
6560
|
+
* would stop on a scroller; a `tabIndex` you pass wins), and the browser's scroll anchoring is
|
|
6561
|
+
* off on it (the window lays the items out): when rows are inserted or removed above the focused
|
|
6562
|
+
* item while it is in view (`*`, or a change of the model from code), the tree moves the view
|
|
6563
|
+
* with it, so it stays where it was.
|
|
6564
|
+
*/
|
|
6565
|
+
virtualWindow?: VirtualWindow;
|
|
6566
|
+
/**
|
|
6567
|
+
* The content of an item, from its row: the item data with its level, position, set size,
|
|
6568
|
+
* expanded state and, in multiple mode, its check state. Called for the rendered items only.
|
|
6569
|
+
* @default the item's `label`, else its `value`
|
|
6570
|
+
*/
|
|
6571
|
+
renderItem?: (item: VisibleFlatItem & {
|
|
6572
|
+
checked?: CheckState;
|
|
6573
|
+
}) => React_2.ReactNode;
|
|
6574
|
+
/**
|
|
6575
|
+
* How items are selected, as the nested `Tree`'s `selectionMode`. `'multiple'` draws a checkbox
|
|
6576
|
+
* on every item, bound to the model's checked items (create the model with
|
|
6577
|
+
* `selectionMode: 'multiple'`); `'single'` draws a radio for `selected`. Spread
|
|
6578
|
+
* `model.getTreeProps()` on the tree to pass the model's mode.
|
|
6579
|
+
* @default the model's mode (`model.getTreeProps().selectionMode`)
|
|
6580
|
+
*/
|
|
6581
|
+
selectionMode?: 'none' | SelectionMode_2;
|
|
6582
|
+
/**
|
|
6583
|
+
* Value of the selected item. When set (also to `null`), every item carries `aria-selected`, and
|
|
6584
|
+
* the selected item is where keyboard focus enters the tree while it is visible. It has no effect
|
|
6585
|
+
* with `selectionMode="multiple"` (a development warning). With `selectionMode="single"` every
|
|
6586
|
+
* item carries `aria-selected` even while it is not set (a development warning: the radios need
|
|
6587
|
+
* it).
|
|
6588
|
+
*/
|
|
6589
|
+
selected?: string | null;
|
|
6590
|
+
/** Value of the current item (for example the open page): it gets `aria-current="true"`. */
|
|
6591
|
+
current?: string | null;
|
|
6592
|
+
/**
|
|
6593
|
+
* Called with an item's value every time it is activated (a click on its row, Enter, or Space
|
|
6594
|
+
* unless the tree has checkboxes), also when the same item is activated again.
|
|
6595
|
+
*/
|
|
6596
|
+
onItemSelect?: (value: string) => void;
|
|
6597
|
+
/** Ref to the `role="tree"` element. */
|
|
6598
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
6599
|
+
}
|
|
6600
|
+
|
|
6063
6601
|
/**
|
|
6064
6602
|
* A flexbox layout container with token-based gaps.
|
|
6065
6603
|
*
|
|
@@ -6260,6 +6798,29 @@ export declare interface GridNavigationHandlers {
|
|
|
6260
6798
|
onBlur: React_2.FocusEventHandler<HTMLTableElement>;
|
|
6261
6799
|
}
|
|
6262
6800
|
|
|
6801
|
+
/**
|
|
6802
|
+
* The data behind the rows of a windowed grid, whose rows are mounted only in part (see
|
|
6803
|
+
* {@link UseGridNavigationOptions.model}). Each mounted data row carries its 0-based index in the
|
|
6804
|
+
* data as `data-row-index`.
|
|
6805
|
+
*/
|
|
6806
|
+
export declare interface GridNavigationModel {
|
|
6807
|
+
/** How many data rows there are, mounted or not. */
|
|
6808
|
+
rowCount: number;
|
|
6809
|
+
/**
|
|
6810
|
+
* How many header rows are above the data rows: the first rows of the grid without a
|
|
6811
|
+
* `data-row-index` (they stay mounted). Other rows without one, such as the spacer rows of a
|
|
6812
|
+
* window, are not navigated.
|
|
6813
|
+
*/
|
|
6814
|
+
headerRowCount: number;
|
|
6815
|
+
/**
|
|
6816
|
+
* Brings data row `index` into the mounted rows (scrolls the window to it). Called once for each
|
|
6817
|
+
* row a key moves focus to that is not mounted; focus moves to the row's cell in the commit that
|
|
6818
|
+
* mounts it. Ctrl+Home in a grid with header rows also calls it for row 0, so the first rows
|
|
6819
|
+
* show under the header.
|
|
6820
|
+
*/
|
|
6821
|
+
scrollToRow(index: number): void;
|
|
6822
|
+
}
|
|
6823
|
+
|
|
6263
6824
|
/**
|
|
6264
6825
|
* The Grid's own props (the XOwnProps rule of `PolymorphicProps`: component-specific props only).
|
|
6265
6826
|
* Every other prop comes from the rendered element (`as`).
|
|
@@ -7216,19 +7777,31 @@ export declare type LinkVariant = LinkAppearance;
|
|
|
7216
7777
|
* - **Check marks** (`checkmark`, opt-in): a decorative check at the start of every item of a
|
|
7217
7778
|
* selectable list, shown while the item is selected; `List.Item checkmark` replaces or hides it.
|
|
7218
7779
|
* - **Switching semantics remounts the items.** Listbox/list and grid use different elements
|
|
7219
|
-
* (`ul`/`li` and `div`), so when a selectable list gains its first item
|
|
7220
|
-
* one, or `selectable` or `navigationMode` changes the structure, React
|
|
7221
|
-
* their content: state inside them (an inline rename input's draft, an
|
|
7222
|
-
* reset. Focus that is on an item or inside it when the list switches
|
|
7223
|
-
* `value`, else by position; the next item when the focused one was
|
|
7224
|
-
* focusable content when the item is no Tab stop any more, so the
|
|
7225
|
-
* `<body>`. This includes focus inside the last action when that action
|
|
7226
|
-
* inline rename input that unmounts on Enter). An action that removes itself
|
|
7227
|
-
* without causing a switch drops focus, like any removed element. When the list
|
|
7228
|
-
* keep such state in the parent, or pin the grid with `navigationMode="composite"`.
|
|
7780
|
+
* (`ul`/`li` and `div`), so when a selectable list without a window gains its first item
|
|
7781
|
+
* action, loses its last one, or `selectable` or `navigationMode` changes the structure, React
|
|
7782
|
+
* remounts the items and their content: state inside them (an inline rename input's draft, an
|
|
7783
|
+
* uncontrolled checkbox) is reset. Focus that is on an item or inside it when the list switches
|
|
7784
|
+
* moves to the same item (by `value`, else by position; the next item when the focused one was
|
|
7785
|
+
* removed), or to its first focusable content when the item is no Tab stop any more, so the
|
|
7786
|
+
* switch never drops it to `<body>`. This includes focus inside the last action when that action
|
|
7787
|
+
* removes itself (an inline rename input that unmounts on Enter). An action that removes itself
|
|
7788
|
+
* while focused without causing a switch drops focus, like any removed element. When the list
|
|
7789
|
+
* may switch, keep such state in the parent, or pin the grid with `navigationMode="composite"`.
|
|
7229
7790
|
* - Selection: `selectionMode` `'single'` (default) or `'multiple'`; controlled with
|
|
7230
7791
|
* `selectedItems` (or `selectedItem` in single mode) or uncontrolled with the `default*` props.
|
|
7231
|
-
* Values of items that are no longer rendered are dropped from the reported selection
|
|
7792
|
+
* Values of items that are no longer rendered are dropped from the reported selection (a
|
|
7793
|
+
* windowed list keeps them).
|
|
7794
|
+
* - **Windowing** (`virtualWindow` and `count`, for long lists): a window from `useVirtualWindow`
|
|
7795
|
+
* and a function child that returns the item at an index render only the items in view plus an
|
|
7796
|
+
* overscan, with spacers for the others. The list element scrolls (give it a bounded height),
|
|
7797
|
+
* every item has the window's item size as its height, the focused item stays rendered and is
|
|
7798
|
+
* the Tab stop while focus is in the list, each item carries its place in the whole list, and
|
|
7799
|
+
* the values selected outside the window stay selected. The keys move by index over the whole
|
|
7800
|
+
* list (ArrowUp/ArrowDown, Home/End, and PageUp/PageDown by ten), scrolling the target into view
|
|
7801
|
+
* before focusing it, rendered or not; typeahead matches the rendered items. Its structure
|
|
7802
|
+
* never follows the rendered items: a selectable windowed list is a listbox unless
|
|
7803
|
+
* `navigationMode="composite"` pins the grid (pin it when items have actions; a development
|
|
7804
|
+
* warning says so).
|
|
7232
7805
|
* - Sub-component: `List.Item` (also exported as `ListItem` for React Server Components).
|
|
7233
7806
|
*
|
|
7234
7807
|
* @example
|
|
@@ -7242,13 +7815,25 @@ export declare type LinkVariant = LinkAppearance;
|
|
|
7242
7815
|
* <List.Item value="report" onAction={() => open('report')}>Report</List.Item>
|
|
7243
7816
|
* <List.Item value="budget" onAction={() => open('budget')}>Budget</List.Item>
|
|
7244
7817
|
* </List>
|
|
7818
|
+
*
|
|
7819
|
+
* @example
|
|
7820
|
+
* const virtualWindow = useVirtualWindow({ itemSize: 40 });
|
|
7821
|
+
* <List
|
|
7822
|
+
* selectable
|
|
7823
|
+
* aria-label="Files"
|
|
7824
|
+
* virtualWindow={virtualWindow}
|
|
7825
|
+
* count={files.length}
|
|
7826
|
+
* style={{ height: 320 }}
|
|
7827
|
+
* >
|
|
7828
|
+
* {(index) => <List.Item value={files[index].id}>{files[index].name}</List.Item>}
|
|
7829
|
+
* </List>
|
|
7245
7830
|
*/
|
|
7246
7831
|
export declare const List: {
|
|
7247
7832
|
<M extends ListSelectionMode = "single">(props: ListProps<M>): React_2.ReactNode;
|
|
7248
7833
|
displayName: string;
|
|
7249
7834
|
} & {
|
|
7250
7835
|
Item: {
|
|
7251
|
-
({ value, action, onAction, disabledSelection, checkmark, className, children, onClick, onKeyDown, ref, ...rest }: ListItemProps): React_2.JSX.Element;
|
|
7836
|
+
({ value, action, onAction, disabledSelection, checkmark, className, style, children, onClick, onKeyDown, ref, ...rest }: ListItemProps): React_2.JSX.Element;
|
|
7252
7837
|
displayName: string;
|
|
7253
7838
|
};
|
|
7254
7839
|
};
|
|
@@ -7285,6 +7870,12 @@ export declare const List: {
|
|
|
7285
7870
|
* either), dims it, takes pointer input off its options, selects nothing and submits nothing.
|
|
7286
7871
|
* Disabled options are skipped by the keys unless `disabledOptionsFocusable`, and are never
|
|
7287
7872
|
* selected.
|
|
7873
|
+
* - **Data mode.** `items` passes the options as data instead of children: the list renders an
|
|
7874
|
+
* option per item (`renderOption` draws it, an `Option` with the item's label by default), the
|
|
7875
|
+
* keys, typeahead and the selection follow the data, and each option carries `aria-posinset`
|
|
7876
|
+
* and `aria-setsize`. A long list takes a `virtualWindow` (from `useVirtualWindow({ itemSize
|
|
7877
|
+
* })`): the list then renders only the options in view, plus an overscan, with spacers for the
|
|
7878
|
+
* others, every option `itemSize` tall, and the active option stays rendered.
|
|
7288
7879
|
* - **Forms and Field.** With `name` the value is submitted with its form (one entry, or one per
|
|
7289
7880
|
* value with `multiselect`), and `required` needs a value (native validation; a missing value
|
|
7290
7881
|
* moves focus to the list). A reset of its form restores `defaultValue`, with or without a
|
|
@@ -7303,12 +7894,21 @@ export declare const List: {
|
|
|
7303
7894
|
* <Listbox.Option value="apple">Apple</Listbox.Option>
|
|
7304
7895
|
* <Listbox.Option value="banana">Banana</Listbox.Option>
|
|
7305
7896
|
* </Listbox>
|
|
7897
|
+
*
|
|
7898
|
+
* @example
|
|
7899
|
+
* // Data mode
|
|
7900
|
+
* <Listbox aria-label="City" items={cities.map((c) => ({ value: c.id, label: c.name }))} />
|
|
7306
7901
|
*/
|
|
7307
7902
|
export declare const Listbox: ListboxComponent;
|
|
7308
7903
|
|
|
7309
|
-
/**
|
|
7904
|
+
/**
|
|
7905
|
+
* Listbox: `root` on the `role="listbox"` list (its options carry Option's classes); `spacer` on
|
|
7906
|
+
* each spacer element of a list with a `virtualWindow` (the elements that stand in for the options
|
|
7907
|
+
* that are not rendered).
|
|
7908
|
+
*/
|
|
7310
7909
|
export declare const listboxClassNames: {
|
|
7311
7910
|
readonly root: "wave-listbox";
|
|
7911
|
+
readonly spacer: "wave-listbox__spacer";
|
|
7312
7912
|
};
|
|
7313
7913
|
|
|
7314
7914
|
/** Props for the combobox element (spread them; see {@link UseListboxResult.getComboboxProps}). */
|
|
@@ -7468,6 +8068,20 @@ export declare interface ListboxOptionElementProps<E extends HTMLElement = HTMLE
|
|
|
7468
8068
|
'aria-disabled'?: true;
|
|
7469
8069
|
/** While filtered out or hidden. */
|
|
7470
8070
|
hidden?: boolean;
|
|
8071
|
+
/**
|
|
8072
|
+
* The number of shown options, for an option of a data-mode list rendered by Listbox, Combobox
|
|
8073
|
+
* or Dropdown (`items`), which tell each option its position. Absent otherwise.
|
|
8074
|
+
*/
|
|
8075
|
+
'aria-setsize'?: number;
|
|
8076
|
+
/** The option's position among the shown options (from 1), with `aria-setsize`. */
|
|
8077
|
+
'aria-posinset'?: number;
|
|
8078
|
+
/**
|
|
8079
|
+
* The option's box in a windowed list (a `virtualWindow` of Listbox, Combobox or Dropdown): the
|
|
8080
|
+
* window's `itemSize` as its height, padding and border included, and no shrinking in a flex
|
|
8081
|
+
* list. Absent otherwise. Merge it after a style of your own: every option of a window must be
|
|
8082
|
+
* exactly that tall.
|
|
8083
|
+
*/
|
|
8084
|
+
style?: React_2.CSSProperties;
|
|
7471
8085
|
/** While the option is active, for styling. */
|
|
7472
8086
|
'data-active'?: '';
|
|
7473
8087
|
/** While selected, for styling. */
|
|
@@ -7487,6 +8101,25 @@ export declare interface ListboxOptionElementProps<E extends HTMLElement = HTMLE
|
|
|
7487
8101
|
/** Flat name of `Listbox.OptionGroup` for React Server Components. */
|
|
7488
8102
|
export declare const ListboxOptionGroup: React_2.FC<OptionGroupProps>;
|
|
7489
8103
|
|
|
8104
|
+
/**
|
|
8105
|
+
* The state of an item's option, which `renderOption` of Listbox, Combobox and Dropdown receives
|
|
8106
|
+
* with the item (data mode, `items`).
|
|
8107
|
+
*/
|
|
8108
|
+
export declare interface ListboxOptionRenderState {
|
|
8109
|
+
/** The item's value is selected. */
|
|
8110
|
+
selected: boolean;
|
|
8111
|
+
/**
|
|
8112
|
+
* The option is the active one, which `aria-activedescendant` points at: in a Listbox while the
|
|
8113
|
+
* list has focus, in a Combobox or Dropdown while the list is open.
|
|
8114
|
+
*/
|
|
8115
|
+
active: boolean;
|
|
8116
|
+
/**
|
|
8117
|
+
* The option's index among the shown options, from 0 (its `aria-posinset` minus one): items a
|
|
8118
|
+
* filter leaves out and hidden items are not counted.
|
|
8119
|
+
*/
|
|
8120
|
+
index: number;
|
|
8121
|
+
}
|
|
8122
|
+
|
|
7490
8123
|
/** Properties for the Listbox component. */
|
|
7491
8124
|
export declare interface ListboxProps<M extends boolean = false> extends Omit<React_2.HTMLAttributes<HTMLUListElement>, 'onChange' | 'defaultValue'> {
|
|
7492
8125
|
/**
|
|
@@ -7547,6 +8180,49 @@ export declare interface ListboxProps<M extends boolean = false> extends Omit<Re
|
|
|
7547
8180
|
disabledOptionsFocusable?: boolean;
|
|
7548
8181
|
/** The `multiselect` toggle announcements, for localization. Unset members keep their English defaults. */
|
|
7549
8182
|
labels?: ListboxLabels;
|
|
8183
|
+
/**
|
|
8184
|
+
* Data mode: the options as data, in list order (`value`, `label`, and optionally `textValue`,
|
|
8185
|
+
* `disabled` and `hidden`; values unique). The list renders one option per item that is not
|
|
8186
|
+
* `hidden` (see `renderOption`), and the keys, typeahead and the selection follow `items`. The
|
|
8187
|
+
* children are neither read nor rendered: passing both warns once in development. Each option
|
|
8188
|
+
* gets `aria-posinset` and `aria-setsize` from its place among the shown items, and keeps one id
|
|
8189
|
+
* per value. Without it, the options are the `Option` children.
|
|
8190
|
+
*/
|
|
8191
|
+
items?: readonly ListboxItem[];
|
|
8192
|
+
/**
|
|
8193
|
+
* Data mode: renders the option of an item, given its state (`selected`, `active`, and `index`
|
|
8194
|
+
* among the shown options). Return an `Option`, or an option component of your own on
|
|
8195
|
+
* `useListboxOption`, with the item's `value` (and its `disabled`); its position is set for you,
|
|
8196
|
+
* and in a windowed list (`virtualWindow`) its height. It is called again only when the item, its
|
|
8197
|
+
* state, its position (`aria-posinset` and `aria-setsize`, which new `items` change) or the
|
|
8198
|
+
* function itself changes, so pass a stable function in a long list. Ignored without `items`,
|
|
8199
|
+
* with a development warning.
|
|
8200
|
+
* @default an `Option` with the item's `value`, `label` (also its text), `textValue` and `disabled`
|
|
8201
|
+
*/
|
|
8202
|
+
renderOption?: (item: ListboxItem, state: ListboxOptionRenderState) => React_2.ReactNode;
|
|
8203
|
+
/**
|
|
8204
|
+
* Data mode: renders only the options in view of a long list, plus an overscan, and spacers
|
|
8205
|
+
* (`aria-hidden`, `data-virtual-spacer`) as tall as the options they stand for: pass the result
|
|
8206
|
+
* of `useVirtualWindow({ itemSize })`, or an object of your own that implements `VirtualWindow`.
|
|
8207
|
+
* It needs `items`: without them, or beside `OptionGroup` children, it is ignored with a
|
|
8208
|
+
* development warning (a window renders a flat list).
|
|
8209
|
+
*
|
|
8210
|
+
* The list element is the window's scroller: give it a bounded height (a height or a maximum
|
|
8211
|
+
* height, through `className` or `style`); without one the window measures the whole list and
|
|
8212
|
+
* renders every option. While windowed the list has no block padding (add none through
|
|
8213
|
+
* `className`), so the options start at its top, where the window counts them, and no scroll
|
|
8214
|
+
* anchoring of the browser (the window lays the options out). Every option is exactly
|
|
8215
|
+
* `itemSize` tall (the list sets its height, after the option's own `style`), so an option's
|
|
8216
|
+
* content must fit in it: the default `Option` with one line of text is 32 pixels tall.
|
|
8217
|
+
*
|
|
8218
|
+
* The window counts the shown options (the items that are not `hidden`). The keys and typeahead
|
|
8219
|
+
* move over all of them (Home and End to the first and the last, PageUp and PageDown by ten); the
|
|
8220
|
+
* active option stays rendered while it is scrolled away, so `aria-activedescendant` always names
|
|
8221
|
+
* an element, and when the list gains focus or a key makes it active the list and the window
|
|
8222
|
+
* move to it in the same update (a pointer press moves neither). The server renders the first
|
|
8223
|
+
* window.
|
|
8224
|
+
*/
|
|
8225
|
+
virtualWindow?: VirtualWindow;
|
|
7550
8226
|
/**
|
|
7551
8227
|
* Name of the value in form submissions (renders a hidden input inside the list; one per value
|
|
7552
8228
|
* with `multiselect`).
|
|
@@ -7739,9 +8415,14 @@ export declare interface ListboxSurfaceProps {
|
|
|
7739
8415
|
children?: React_2.ReactNode;
|
|
7740
8416
|
}
|
|
7741
8417
|
|
|
7742
|
-
/**
|
|
8418
|
+
/**
|
|
8419
|
+
* List: `root` on the `<ul>` (the `role="grid"` element of a selectable list with actions);
|
|
8420
|
+
* `spacer` on each spacer element of a list with a `virtualWindow` (the elements that stand in for
|
|
8421
|
+
* the items that are not rendered).
|
|
8422
|
+
*/
|
|
7743
8423
|
export declare const listClassNames: {
|
|
7744
8424
|
readonly root: "wave-list";
|
|
8425
|
+
readonly spacer: "wave-list__spacer";
|
|
7745
8426
|
};
|
|
7746
8427
|
|
|
7747
8428
|
/**
|
|
@@ -7751,11 +8432,15 @@ export declare const listClassNames: {
|
|
|
7751
8432
|
* selection without calling `onClick`, which receives pointer clicks; `onAction` runs on clicks
|
|
7752
8433
|
* and Enter (and Space where the item cannot be selected), before the selection toggles.
|
|
7753
8434
|
*
|
|
8435
|
+
* In a windowed list (the List's `virtualWindow`) an item has the window's item size as its
|
|
8436
|
+
* height, after its own `style` (its content must fit), and carries `data-index` and its place
|
|
8437
|
+
* in the whole list: `aria-setsize` and `aria-posinset`, or `aria-rowindex` in a grid.
|
|
8438
|
+
*
|
|
7754
8439
|
* Exported under the flat name `ListItem` so React Server Components can import it; `List.Item`
|
|
7755
8440
|
* (dotted access) needs a client module.
|
|
7756
8441
|
*/
|
|
7757
8442
|
export declare const ListItem: {
|
|
7758
|
-
({ value, action, onAction, disabledSelection, checkmark, className, children, onClick, onKeyDown, ref, ...rest }: ListItemProps): React_2.JSX.Element;
|
|
8443
|
+
({ value, action, onAction, disabledSelection, checkmark, className, style, children, onClick, onKeyDown, ref, ...rest }: ListItemProps): React_2.JSX.Element;
|
|
7759
8444
|
displayName: string;
|
|
7760
8445
|
};
|
|
7761
8446
|
|
|
@@ -7839,7 +8524,72 @@ export declare type ListNavigationMode = 'none' | 'items' | 'composite';
|
|
|
7839
8524
|
* `selectionMode="multiple"` is passed; `ListProps` without a type argument accepts every mode
|
|
7840
8525
|
* (the 0.4 shape, extendable by interfaces).
|
|
7841
8526
|
*/
|
|
7842
|
-
export declare interface ListProps<M extends ListSelectionMode = ListSelectionMode> extends React_2.HTMLAttributes<HTMLUListElement> {
|
|
8527
|
+
export declare interface ListProps<M extends ListSelectionMode = ListSelectionMode> extends Omit<React_2.HTMLAttributes<HTMLUListElement>, 'children'> {
|
|
8528
|
+
/**
|
|
8529
|
+
* The items: `List.Item` elements. In a windowed list (`virtualWindow` and `count`), a function
|
|
8530
|
+
* `(index) => <List.Item … />` that returns the item at an index: the list calls it for the
|
|
8531
|
+
* rendered indexes only and keys each item by its index. Without `virtualWindow` and `count` a
|
|
8532
|
+
* function renders nothing (a development warning says so).
|
|
8533
|
+
*/
|
|
8534
|
+
children?: React_2.ReactNode | ((index: number) => React_2.ReactNode);
|
|
8535
|
+
/**
|
|
8536
|
+
* Renders only the items in view, plus an overscan, of a long list: pass the result of
|
|
8537
|
+
* `useVirtualWindow({ itemSize })` (or an object of your own that implements `VirtualWindow`)
|
|
8538
|
+
* with `count`, and a function child that returns the `List.Item` at an index. The items that
|
|
8539
|
+
* are not rendered are replaced by spacers (`aria-hidden`, `data-virtual-spacer`) of their
|
|
8540
|
+
* height.
|
|
8541
|
+
*
|
|
8542
|
+
* The list element becomes the window's scroller (it scrolls vertically, without the browser's
|
|
8543
|
+
* scroll anchoring): give it a bounded height, a height or a maximum height (a class or a style);
|
|
8544
|
+
* without one the window measures the whole list and renders every item. Where the list
|
|
8545
|
+
* navigates its items, one item is its Tab stop and the list element is none of its own
|
|
8546
|
+
* (`tabIndex` -1, as Firefox would stop on a scroller); a plain windowed list keeps the browser's
|
|
8547
|
+
* default, under which WebKit does not let the keyboard reach and scroll it: pass `tabIndex={0}`
|
|
8548
|
+
* or navigate its items (`navigationMode="items"`). A `tabIndex` you pass wins.
|
|
8549
|
+
*
|
|
8550
|
+
* Every item has the window's `itemSize` as its height (the list sets it, after the item's own
|
|
8551
|
+
* `style`), so an item's content must fit in it. Each item carries `data-index` (its 0-based
|
|
8552
|
+
* index) and its place in the whole list: `aria-setsize` and `aria-posinset`, or in a grid
|
|
8553
|
+
* (`navigationMode="composite"`) the list's `aria-rowcount` and the row's `aria-rowindex`.
|
|
8554
|
+
*
|
|
8555
|
+
* The item that has focus stays rendered when it is scrolled away (also while focus is in a
|
|
8556
|
+
* popup it opened), so it keeps focus, and while focus is in the list it is the list's Tab stop.
|
|
8557
|
+
* Once focus leaves the list it is no longer kept, and the Tab stop follows the rule of a list
|
|
8558
|
+
* without focus among the rendered items (the first selected item, else the first item; in a
|
|
8559
|
+
* list without selection the item that last had focus while it is rendered). When `count` drops
|
|
8560
|
+
* to or below the focused item, focus moves to the last item.
|
|
8561
|
+
*
|
|
8562
|
+
* The keys move by index over the whole list, rendered or not, where the list navigates its
|
|
8563
|
+
* items (`navigationMode` `'items'` or `'composite'`, or a selectable list): ArrowUp/ArrowDown
|
|
8564
|
+
* (wrapping at the ends), Home/End, and PageUp/PageDown, which move ten items and stop at the
|
|
8565
|
+
* ends. The target is scrolled into view before it is focused, the least that shows it whole: a
|
|
8566
|
+
* rendered one by the browser (`scrollIntoView`, nearest), which the window follows, one that is
|
|
8567
|
+
* not rendered through the window's `scrollToIndex`, and focused once it renders. An item that a
|
|
8568
|
+
* pointer press focuses is not scrolled. Typeahead matches the labels of the rendered items
|
|
8569
|
+
* only.
|
|
8570
|
+
*
|
|
8571
|
+
* Selection covers every value: the values of items that are not rendered stay selected, and
|
|
8572
|
+
* `onSelectionChange` reports them (a list without a window drops the values of items it no
|
|
8573
|
+
* longer renders).
|
|
8574
|
+
*
|
|
8575
|
+
* The structure never depends on which items are rendered: a selectable windowed list stays a
|
|
8576
|
+
* listbox (its items are options) unless `navigationMode="composite"` makes it a grid from the
|
|
8577
|
+
* first render, so scrolling never replaces the list element (which would reset its scroll
|
|
8578
|
+
* position and remount every item). Its items' actions do not switch it to a grid as they do in
|
|
8579
|
+
* a list without a window: an item with an action in a selectable windowed list without that
|
|
8580
|
+
* pin is a development warning, since an option cannot hold interactive content. Pin
|
|
8581
|
+
* `navigationMode="composite"` when items have actions.
|
|
8582
|
+
*
|
|
8583
|
+
* Applies only with `count` and a function child; otherwise it is ignored, with a development
|
|
8584
|
+
* warning.
|
|
8585
|
+
*/
|
|
8586
|
+
virtualWindow?: VirtualWindow;
|
|
8587
|
+
/**
|
|
8588
|
+
* The number of items of a windowed list (with `virtualWindow`): the function child is called
|
|
8589
|
+
* for the indexes from 0 to `count - 1` that are rendered. A value that is not a whole number
|
|
8590
|
+
* counts as its whole part, and one below 0 (or not finite) as 0.
|
|
8591
|
+
*/
|
|
8592
|
+
count?: number;
|
|
7843
8593
|
/** Whether list items can be selected.
|
|
7844
8594
|
* @default false
|
|
7845
8595
|
*/
|
|
@@ -7886,7 +8636,10 @@ export declare interface ListProps<M extends ListSelectionMode = ListSelectionMo
|
|
|
7886
8636
|
* the Tab order. The rows of a list without selection carry no `aria-selected`.
|
|
7887
8637
|
*
|
|
7888
8638
|
* The resolved mode is rendered as `data-navigation-mode`. Changing it while mounted can switch
|
|
7889
|
-
* between `ul`/`li` and `div` elements, which remounts the items (see {@link List}).
|
|
8639
|
+
* between `ul`/`li` and `div` elements, which remounts the items (see {@link List}). A windowed
|
|
8640
|
+
* list (`virtualWindow`) never switches for its items' actions: unset or `'items'`, a selectable
|
|
8641
|
+
* one is a listbox; only `'composite'` makes it a grid. In a windowed list the keys move by
|
|
8642
|
+
* index over the whole list, PageUp/PageDown included (see `virtualWindow`).
|
|
7890
8643
|
*/
|
|
7891
8644
|
navigationMode?: ListNavigationMode;
|
|
7892
8645
|
/**
|
|
@@ -10102,7 +10855,9 @@ export declare interface OpenChangeDetails<R extends string = string> {
|
|
|
10102
10855
|
*
|
|
10103
10856
|
* Options register with the surrounding listbox (in DOM order, groups included), so they can be
|
|
10104
10857
|
* wrapped, grouped or rendered conditionally. The option is memoized: moving the highlight
|
|
10105
|
-
* re-renders only the previously and the newly active option.
|
|
10858
|
+
* re-renders only the previously and the newly active option. In a windowed list (the
|
|
10859
|
+
* `virtualWindow` of Listbox, Combobox or Dropdown) the option is exactly the window's `itemSize`
|
|
10860
|
+
* tall, a height set after its own `style`, so its content must fit in it.
|
|
10106
10861
|
*
|
|
10107
10862
|
* Styling: `className` comes last. A plain background class (`className="bg-primary"`) replaces
|
|
10108
10863
|
* the built-in hover, selected and active backgrounds in every state. To restyle one state only,
|
|
@@ -13425,11 +14180,12 @@ export declare type SwitchSize = Extract<Size, 'small' | 'medium'>;
|
|
|
13425
14180
|
* `Table.CellActions` shows a cell's actions while its row is hovered or holds focus.
|
|
13426
14181
|
*
|
|
13427
14182
|
* Sub-components are available as `Table.Header`, `Table.HeaderCell`, `Table.Body`, `Table.Row`,
|
|
13428
|
-
* `Table.Cell`, `Table.SelectionCell`, `Table.CellLayout
|
|
14183
|
+
* `Table.Cell`, `Table.SelectionCell`, `Table.CellLayout`, `Table.CellActions` and
|
|
14184
|
+
* `Table.ResizeHandle` (the separator that resizes a column, for a header cell's `aside`) in client
|
|
13429
14185
|
* components, and as the flat exports `TableHeader`, `TableHeaderCell`, `TableBody`, `TableRow`,
|
|
13430
|
-
* `TableCell`, `TableSelectionCell`, `TableCellLayout
|
|
13431
|
-
* Server Components can import). `Table.Head`/`Table.HeadCell`
|
|
13432
|
-
* deprecated aliases.
|
|
14186
|
+
* `TableCell`, `TableSelectionCell`, `TableCellLayout`, `TableCellActions` and
|
|
14187
|
+
* `TableResizeHandle` (the form React Server Components can import). `Table.Head`/`Table.HeadCell`
|
|
14188
|
+
* (`TableHead`/`TableHeadCell`) are deprecated aliases.
|
|
13433
14189
|
*/
|
|
13434
14190
|
export declare const Table: {
|
|
13435
14191
|
({ striped, containerProps, children, className, ref, ...props }: TableProps): React_2.JSX.Element;
|
|
@@ -13477,6 +14233,10 @@ export declare const Table: {
|
|
|
13477
14233
|
({ visible, className, ref, ...rest }: TableCellActionsProps): React_2.JSX.Element;
|
|
13478
14234
|
displayName: string;
|
|
13479
14235
|
};
|
|
14236
|
+
ResizeHandle: {
|
|
14237
|
+
({ width, minWidth, maxWidth, onResize, onReset, onLeave, label, valueText, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, onDoubleClick, onKeyDown, onKeyUp, onBlur, className, ref, ...rest }: TableResizeHandleProps): React_2.JSX.Element;
|
|
14238
|
+
displayName: string;
|
|
14239
|
+
};
|
|
13480
14240
|
};
|
|
13481
14241
|
|
|
13482
14242
|
/** The table's `<tbody>`. */
|
|
@@ -13606,6 +14366,86 @@ export declare const tableClassNames: {
|
|
|
13606
14366
|
readonly container: "wave-table__container";
|
|
13607
14367
|
};
|
|
13608
14368
|
|
|
14369
|
+
/**
|
|
14370
|
+
* The column widths of {@link useTableFeatures} (`state.columnSizing`), filled by
|
|
14371
|
+
* `useTableColumnSizing`. Without that plugin no width is set and the functions do nothing.
|
|
14372
|
+
*/
|
|
14373
|
+
export declare interface TableColumnSizingState {
|
|
14374
|
+
/**
|
|
14375
|
+
* The width of every column in pixels, by `columnId`: the width that is state, else the
|
|
14376
|
+
* column's initial width.
|
|
14377
|
+
*/
|
|
14378
|
+
columnWidths: Readonly<Record<string, number>>;
|
|
14379
|
+
/** Whether a width is state (set, controlled or given as a default). */
|
|
14380
|
+
isSized: boolean;
|
|
14381
|
+
/** The width of the column `columnId` in pixels, or `undefined` when it is no column. */
|
|
14382
|
+
getColumnWidth(columnId: string): number | undefined;
|
|
14383
|
+
/**
|
|
14384
|
+
* Sets the width of the column `columnId` in pixels. Without `event`, the change's details carry
|
|
14385
|
+
* an untrusted `resize` event with no target.
|
|
14386
|
+
*/
|
|
14387
|
+
setColumnWidth(columnId: string, width: number, event?: Event): void;
|
|
14388
|
+
/** Props for the table element: its fixed layout and width style. */
|
|
14389
|
+
getTableProps(): {
|
|
14390
|
+
style: CSSProperties;
|
|
14391
|
+
};
|
|
14392
|
+
/** Props for the column's `<col>` element: its width style. */
|
|
14393
|
+
getColumnProps(columnId: string): {
|
|
14394
|
+
style: CSSProperties;
|
|
14395
|
+
};
|
|
14396
|
+
/** Props for the resize handle of the column `columnId`. */
|
|
14397
|
+
getResizeHandleProps(columnId: string): TableResizeHandleBindings;
|
|
14398
|
+
}
|
|
14399
|
+
|
|
14400
|
+
/** What {@link UseTableColumnSizingOptions.onColumnWidthsChange} gets besides the new widths. */
|
|
14401
|
+
export declare interface TableColumnWidthsChangeDetails {
|
|
14402
|
+
/** The column that was resized. */
|
|
14403
|
+
columnId: string;
|
|
14404
|
+
/** Its new width in pixels, held at or above its `minWidth`. */
|
|
14405
|
+
width: number;
|
|
14406
|
+
/**
|
|
14407
|
+
* The event behind the change (the drag, the key press); when none was passed, an untrusted
|
|
14408
|
+
* `resize` event with no target.
|
|
14409
|
+
*/
|
|
14410
|
+
event: Event;
|
|
14411
|
+
}
|
|
14412
|
+
|
|
14413
|
+
/**
|
|
14414
|
+
* A feature of {@link useTableFeatures}, returned by `useTableSort`, `useTableSelection` and
|
|
14415
|
+
* `useTableColumnSizing`, which hold the feature's state where they are called. The object is
|
|
14416
|
+
* opaque. It keeps its identity while the feature's state and the options it reads keep theirs; a
|
|
14417
|
+
* new one costs `useTableFeatures` a recompute of its state, and of the rows only when the sort
|
|
14418
|
+
* changed. `T` is the item type the plugin reads (a selection's `isDisabled`): a plugin that reads
|
|
14419
|
+
* no item, such as the sort, fits every table.
|
|
14420
|
+
*/
|
|
14421
|
+
export declare interface TableFeaturePlugin<T> {
|
|
14422
|
+
/** The brand of a plugin: only the plugin hooks create one. */
|
|
14423
|
+
readonly [tableFeaturePluginBrand]: (item: T) => void;
|
|
14424
|
+
}
|
|
14425
|
+
|
|
14426
|
+
declare const tableFeaturePluginBrand: unique symbol;
|
|
14427
|
+
|
|
14428
|
+
/** The state that {@link useTableFeatures} returns. */
|
|
14429
|
+
export declare interface TableFeaturesState<T> {
|
|
14430
|
+
/** The items, as given. */
|
|
14431
|
+
items: readonly T[];
|
|
14432
|
+
/** The columns, as given. */
|
|
14433
|
+
columns: readonly DataGridColumn<T>[];
|
|
14434
|
+
/** The row id of an item: `getRowId` as given, else the index as a string. */
|
|
14435
|
+
getRowId: (item: T, index: number) => string;
|
|
14436
|
+
/**
|
|
14437
|
+
* The rows in display order: sorted while `useTableSort` sorts them, else in the order of
|
|
14438
|
+
* `items`. The same array is returned until `items`, `getRowId`, `columns` or the sort change.
|
|
14439
|
+
*/
|
|
14440
|
+
getRows(): readonly TableRowData<T>[];
|
|
14441
|
+
/** The sort; without `useTableSort` it is `null` and its functions do nothing. */
|
|
14442
|
+
sort: TableSortState;
|
|
14443
|
+
/** The selection; without `useTableSelection` nothing is selected and its functions do nothing. */
|
|
14444
|
+
selection: TableSelectionState;
|
|
14445
|
+
/** The column widths; without `useTableColumnSizing` no width is set. */
|
|
14446
|
+
columnSizing: TableColumnSizingState;
|
|
14447
|
+
}
|
|
14448
|
+
|
|
13609
14449
|
/** @deprecated Use `Table.Header` (`TableHeader`). */
|
|
13610
14450
|
export declare const TableHead: {
|
|
13611
14451
|
(props: TableHeadProps): React_2.JSX.Element;
|
|
@@ -13724,6 +14564,110 @@ export declare interface TableProps extends React_2.HTMLAttributes<HTMLTableElem
|
|
|
13724
14564
|
ref?: React_2.Ref<HTMLTableElement>;
|
|
13725
14565
|
}
|
|
13726
14566
|
|
|
14567
|
+
/**
|
|
14568
|
+
* The drag handle of a column's edge: a vertical `role="separator"` with `aria-valuenow`, meant
|
|
14569
|
+
* for the `aside` slot of a `Table.HeaderCell` whose cell is positioned, since the handle is drawn
|
|
14570
|
+
* along the cell's end edge. A DataGrid with `resizableColumns` renders it in the header cell of
|
|
14571
|
+
* each of its columns itself (a `DataGrid.HeaderCell` has no `aside` slot). A pointer drag (mouse,
|
|
14572
|
+
* touch or pen) resizes through `onResize`, with the movement mirrored in right-to-left tables;
|
|
14573
|
+
* the arrow keys move the edge by 20 pixels (5 with Shift), Home sets the minimum width and End
|
|
14574
|
+
* the maximum one. A double click calls `onReset`. The handle is a Tab stop (`tabIndex` 0), so the
|
|
14575
|
+
* keys work in a static table; a grid that manages its own tab stops overrides `tabIndex`. The
|
|
14576
|
+
* handle carries `data-grid-auxiliary`, so a grid's cell navigation does not take it for the
|
|
14577
|
+
* cell's own widget.
|
|
14578
|
+
*
|
|
14579
|
+
* It keeps no width: spread the result of `useTableColumnSizing`'s `getResizeHandleProps(columnId)`
|
|
14580
|
+
* onto it, or pass `width`, `minWidth` and `onResize` from your own state.
|
|
14581
|
+
*/
|
|
14582
|
+
export declare const TableResizeHandle: {
|
|
14583
|
+
({ width, minWidth, maxWidth, onResize, onReset, onLeave, label, valueText, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, onDoubleClick, onKeyDown, onKeyUp, onBlur, className, ref, ...rest }: TableResizeHandleProps): React_2.JSX.Element;
|
|
14584
|
+
displayName: string;
|
|
14585
|
+
};
|
|
14586
|
+
|
|
14587
|
+
/**
|
|
14588
|
+
* What a resize handle needs from the table state, as returned by
|
|
14589
|
+
* `columnSizing.getResizeHandleProps(columnId)`: the column's width and minimum, the callback
|
|
14590
|
+
* that sets a new width and the one that resets it. `Table.ResizeHandle` takes these props (and a few more).
|
|
14591
|
+
*/
|
|
14592
|
+
export declare interface TableResizeHandleBindings {
|
|
14593
|
+
/** The column's current width in pixels. */
|
|
14594
|
+
width: number;
|
|
14595
|
+
/** The narrowest the column can be, in pixels. */
|
|
14596
|
+
minWidth: number;
|
|
14597
|
+
/**
|
|
14598
|
+
* Sets the column's width in pixels (held at or above `minWidth`); `details.event` is the event
|
|
14599
|
+
* behind it (without `details`, an untrusted `resize` event is reported).
|
|
14600
|
+
*/
|
|
14601
|
+
onResize(width: number, details?: {
|
|
14602
|
+
event: Event;
|
|
14603
|
+
}): void;
|
|
14604
|
+
/**
|
|
14605
|
+
* Sets the column back to its initial width (a double click on the handle). It changes nothing
|
|
14606
|
+
* while no width is state, since the table is then in its initial layout.
|
|
14607
|
+
*/
|
|
14608
|
+
onReset?(details: {
|
|
14609
|
+
event: Event;
|
|
14610
|
+
}): void;
|
|
14611
|
+
}
|
|
14612
|
+
|
|
14613
|
+
/**
|
|
14614
|
+
* Table.ResizeHandle: `root` on the separator element that resizes a column (placed in the `aside`
|
|
14615
|
+
* of a header cell).
|
|
14616
|
+
*/
|
|
14617
|
+
export declare const tableResizeHandleClassNames: {
|
|
14618
|
+
readonly root: "wave-table-resize-handle";
|
|
14619
|
+
};
|
|
14620
|
+
|
|
14621
|
+
/** Properties for the TableResizeHandle sub-component. */
|
|
14622
|
+
export declare interface TableResizeHandleProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, 'onResize' | 'onReset'> {
|
|
14623
|
+
/** The column's current width in pixels. It is reported as `aria-valuenow`. */
|
|
14624
|
+
width: number;
|
|
14625
|
+
/**
|
|
14626
|
+
* The narrowest the column can be, in pixels. The handle never asks for less, and Home sets it.
|
|
14627
|
+
* It is reported as `aria-valuemin`.
|
|
14628
|
+
* @default 0
|
|
14629
|
+
*/
|
|
14630
|
+
minWidth?: number;
|
|
14631
|
+
/**
|
|
14632
|
+
* The widest the column can be, in pixels. The handle never asks for more, and End sets it.
|
|
14633
|
+
* Without a maximum there is no `aria-valuemax` and End does nothing.
|
|
14634
|
+
*/
|
|
14635
|
+
maxWidth?: number;
|
|
14636
|
+
/**
|
|
14637
|
+
* Called with the width the user asks for, in whole pixels, held between `minWidth` and
|
|
14638
|
+
* `maxWidth`: while a pointer drags (at most once per animation frame) and for every handled
|
|
14639
|
+
* key, then `details` with the event behind it. The handle always passes `details`; it is typed
|
|
14640
|
+
* optional through 0.x, as every `details` argument. The handle keeps no width of its own, so a
|
|
14641
|
+
* parent that ignores the call leaves the column where it is.
|
|
14642
|
+
*/
|
|
14643
|
+
onResize: (width: number, details?: {
|
|
14644
|
+
event: Event;
|
|
14645
|
+
}) => void;
|
|
14646
|
+
/** Called with the event when the handle is double-clicked: reset the column's width. */
|
|
14647
|
+
onReset?: (details: {
|
|
14648
|
+
event: Event;
|
|
14649
|
+
}) => void;
|
|
14650
|
+
/**
|
|
14651
|
+
* Called when Escape is pressed on the handle, or Enter or Space is released on it after being
|
|
14652
|
+
* pressed there: move focus back to the header cell. Enter and Space are consumed from their
|
|
14653
|
+
* keydown on (their repeats included), so a held key never reaches the element that focus moves
|
|
14654
|
+
* to. Without it those keys are left to the handle's ancestors.
|
|
14655
|
+
*/
|
|
14656
|
+
onLeave?: () => void;
|
|
14657
|
+
/**
|
|
14658
|
+
* The accessible name of the separator.
|
|
14659
|
+
* @default 'Resize column'
|
|
14660
|
+
*/
|
|
14661
|
+
label?: string;
|
|
14662
|
+
/**
|
|
14663
|
+
* Builds `aria-valuetext` from the width.
|
|
14664
|
+
* @default (width) => `${width} pixels`
|
|
14665
|
+
*/
|
|
14666
|
+
valueText?: (width: number) => string;
|
|
14667
|
+
/** Ref to the `<div>` element. */
|
|
14668
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
14669
|
+
}
|
|
14670
|
+
|
|
13727
14671
|
/**
|
|
13728
14672
|
* A table row. Striping comes from the table (`striped`), so rows need no context. The row is the
|
|
13729
14673
|
* `group/table-row` group whose hover or focus draws the subtle selection controls and the cell
|
|
@@ -13739,6 +14683,16 @@ export declare const tableRowClassNames: {
|
|
|
13739
14683
|
readonly root: "wave-table-row";
|
|
13740
14684
|
};
|
|
13741
14685
|
|
|
14686
|
+
/** One row of {@link useTableFeatures}: an item of `items` with its id. */
|
|
14687
|
+
export declare interface TableRowData<T> {
|
|
14688
|
+
/** The item. */
|
|
14689
|
+
item: T;
|
|
14690
|
+
/** The row's id, from `getRowId` (by default the index in `items`, as a string). */
|
|
14691
|
+
rowId: string;
|
|
14692
|
+
/** The item's index in `items`. Sorting moves the row, not this index. */
|
|
14693
|
+
index: number;
|
|
14694
|
+
}
|
|
14695
|
+
|
|
13742
14696
|
/** Properties for the TableRow sub-component. */
|
|
13743
14697
|
export declare interface TableRowProps extends React_2.HTMLAttributes<HTMLTableRowElement> {
|
|
13744
14698
|
/** Table cell elements. */
|
|
@@ -13852,6 +14806,59 @@ export declare interface TableSelectionCellProps extends Omit<React_2.TdHTMLAttr
|
|
|
13852
14806
|
ref?: React_2.Ref<HTMLTableCellElement>;
|
|
13853
14807
|
}
|
|
13854
14808
|
|
|
14809
|
+
/**
|
|
14810
|
+
* The selection of {@link useTableFeatures} (`state.selection`), filled by `useTableSelection`. The
|
|
14811
|
+
* selection is a set of row ids held apart from the rendered rows: rows that are not rendered keep
|
|
14812
|
+
* their state, and ids whose item is not in `items` (filtered out, on another page) stay selected.
|
|
14813
|
+
*/
|
|
14814
|
+
export declare interface TableSelectionState {
|
|
14815
|
+
/** `single` keeps at most one row selected; `multiple` selects rows independently. */
|
|
14816
|
+
selectionMode: SelectionMode_2;
|
|
14817
|
+
/** The selected row ids, ids whose item is not in `items` included. */
|
|
14818
|
+
selectedItems: ReadonlySet<string>;
|
|
14819
|
+
/**
|
|
14820
|
+
* Whether every selectable row of `items` is selected (and there is one): rows that
|
|
14821
|
+
* `isDisabled` marks do not count, rows that are not rendered do.
|
|
14822
|
+
*/
|
|
14823
|
+
allRowsSelected: boolean;
|
|
14824
|
+
/**
|
|
14825
|
+
* Whether a row of `items` is selected while not every selectable one is (the mixed state of a
|
|
14826
|
+
* select-all checkbox). A selected disabled row counts; ids outside `items` do not.
|
|
14827
|
+
*/
|
|
14828
|
+
someRowsSelected: boolean;
|
|
14829
|
+
/** Whether the row `id` is selected. */
|
|
14830
|
+
isRowSelected(id: string): boolean;
|
|
14831
|
+
/** Selects or deselects the row `id` (`multiple`); selects it (`single`). */
|
|
14832
|
+
toggleRow(id: string, event?: Event): void;
|
|
14833
|
+
/** Selects the row `id`; in `single` mode it replaces the selection. */
|
|
14834
|
+
selectRow(id: string, event?: Event): void;
|
|
14835
|
+
/** Deselects the row `id`. */
|
|
14836
|
+
deselectRow(id: string, event?: Event): void;
|
|
14837
|
+
/**
|
|
14838
|
+
* Selects every selectable row of `items` when not all of them are selected, else deselects
|
|
14839
|
+
* them. A disabled row keeps its state, and ids outside `items` stay selected. It does nothing in
|
|
14840
|
+
* `single` mode.
|
|
14841
|
+
*/
|
|
14842
|
+
toggleAllRows(event?: Event): void;
|
|
14843
|
+
/** Empties the selection, ids outside `items` included. */
|
|
14844
|
+
clearRows(event?: Event): void;
|
|
14845
|
+
}
|
|
14846
|
+
|
|
14847
|
+
/** The sort of {@link useTableFeatures} (`state.sort`), filled by `useTableSort`. */
|
|
14848
|
+
export declare interface TableSortState {
|
|
14849
|
+
/** The sorted column and its direction, or `null` while the rows are in the order of `items`. */
|
|
14850
|
+
value: DataGridSort | null;
|
|
14851
|
+
/** Sorts by the column `columnId` in `direction`. */
|
|
14852
|
+
setColumnSort(columnId: string, direction: SortDirection, event?: Event): void;
|
|
14853
|
+
/**
|
|
14854
|
+
* Sorts by the column `columnId`, as a sortable header of DataGrid does: ascending, or descending
|
|
14855
|
+
* when the column is already sorted ascending.
|
|
14856
|
+
*/
|
|
14857
|
+
toggleColumnSort(columnId: string, event?: Event): void;
|
|
14858
|
+
/** The direction of the column `columnId` while the rows are sorted by it, else `undefined`. */
|
|
14859
|
+
getSortDirection(columnId: string): SortDirection | undefined;
|
|
14860
|
+
}
|
|
14861
|
+
|
|
13855
14862
|
/**
|
|
13856
14863
|
* A set of tabs with their panels (WAI-ARIA Tabs pattern): the arrow keys (Left/Right, mirrored
|
|
13857
14864
|
* in RTL; Up/Down when vertical), Home and End move focus and select (automatic activation); with
|
|
@@ -17558,7 +18565,9 @@ export declare type TypographyVariant = 'caption-2' | 'caption-1' | 'body-1' | '
|
|
|
17558
18565
|
* - The moved-to item is dropped when it leaves `items` or while `enabled` is `false`, and does not
|
|
17559
18566
|
* come back without a user action; `fallback` is active while nothing was moved to.
|
|
17560
18567
|
* - Keyboard and programmatic moves are scrolled into view (`{ block: 'nearest' }`); pointer moves
|
|
17561
|
-
* (`highlight`) and `setActiveValue(value, { scroll: false })` are not.
|
|
18568
|
+
* (`highlight`) and `setActiveValue(value, { scroll: false })` are not. With `onScrollToItem` (a
|
|
18569
|
+
* windowed list) each such move is first passed to it by the item's index, also for an item
|
|
18570
|
+
* without an element.
|
|
17562
18571
|
* - `onActiveValueChange` reports every change after the commit, once (StrictMode included).
|
|
17563
18572
|
*
|
|
17564
18573
|
* `useListbox` is built on it; use it directly for composites that are not listboxes.
|
|
@@ -17599,6 +18608,17 @@ export declare interface UseActiveDescendantOptions {
|
|
|
17599
18608
|
activateFirstOnChange?: boolean;
|
|
17600
18609
|
/** The element of an item, for scrolling it into view. @default document.getElementById(getId(value)) */
|
|
17601
18610
|
getElement?: (value: string) => HTMLElement | null;
|
|
18611
|
+
/**
|
|
18612
|
+
* Called for every move that scrolls the active item into view, for a windowed list that renders
|
|
18613
|
+
* part of its items: `index` is the item's index in `items`. Scroll the list so that it shows and
|
|
18614
|
+
* renders the item (a virtual window's `scrollToIndex`, which moves the window in the same
|
|
18615
|
+
* update); an element, when there is one (`getElement`, then the id lookup), is then scrolled
|
|
18616
|
+
* into view as well. `aria-activedescendant` already names the item, and points at its element
|
|
18617
|
+
* once it mounts. Called after the same moves that scroll (not after a pointer move or a
|
|
18618
|
+
* `scroll: false` move), from a layout effect, once per change of the active item. Without it,
|
|
18619
|
+
* an item without an element is not scrolled to.
|
|
18620
|
+
*/
|
|
18621
|
+
onScrollToItem?: (index: number) => void;
|
|
17602
18622
|
/** Called after the active item changed (from an effect), `null` included. */
|
|
17603
18623
|
onActiveValueChange?: (value: string | null) => void;
|
|
17604
18624
|
}
|
|
@@ -17844,6 +18864,60 @@ export declare interface UseFieldControlOptions {
|
|
|
17844
18864
|
nativeRequired?: boolean;
|
|
17845
18865
|
}
|
|
17846
18866
|
|
|
18867
|
+
/**
|
|
18868
|
+
* The model of a flat tree: items listed with a `parentValue` link, in any order, become the rows
|
|
18869
|
+
* a windowed tree shows (`FlatTree`), without building an element tree. Returns the visible rows
|
|
18870
|
+
* (with `level`, `position`, `setSize` and `expanded` for the tree ARIA), the expanded and
|
|
18871
|
+
* checked state, and the actions on them.
|
|
18872
|
+
*
|
|
18873
|
+
* Pass `items` as a stable reference or memoise it: the index of the items is rebuilt when its
|
|
18874
|
+
* identity changes. Expanded and checked state work as in `Tree`: pass `expandedItems` or
|
|
18875
|
+
* `checkedItems` to control it (a stable array, or the rows are rebuilt on every render), or
|
|
18876
|
+
* `defaultExpandedItems` and `defaultCheckedItems` to start uncontrolled; the change callbacks
|
|
18877
|
+
* fire once per change. When `items` is replaced, the expanded and checked values stay in the
|
|
18878
|
+
* state: a value that matches no item is ignored for the rows until an item with it returns, and
|
|
18879
|
+
* it is changed only by you.
|
|
18880
|
+
*
|
|
18881
|
+
* Development warnings, once each: an unknown `parentValue` (the item is a root), a cycle of
|
|
18882
|
+
* parents (cut) and a duplicate value (the first item wins).
|
|
18883
|
+
*
|
|
18884
|
+
* @example
|
|
18885
|
+
* const model = useFlatTree(items, { defaultExpandedItems: ['docs'] });
|
|
18886
|
+
* model.visibleItems.map((row) => row.item.label);
|
|
18887
|
+
*/
|
|
18888
|
+
export declare function useFlatTree(items: readonly FlatTreeItemData[], options?: UseFlatTreeOptions): FlatTreeModel;
|
|
18889
|
+
|
|
18890
|
+
/** Options of {@link useFlatTree}: the state names and shapes of the nested `Tree`. */
|
|
18891
|
+
export declare interface UseFlatTreeOptions {
|
|
18892
|
+
/** Controlled list of expanded item values. */
|
|
18893
|
+
expandedItems?: readonly string[];
|
|
18894
|
+
/**
|
|
18895
|
+
* Item values that are expanded initially (uncontrolled).
|
|
18896
|
+
* @default []
|
|
18897
|
+
*/
|
|
18898
|
+
defaultExpandedItems?: readonly string[];
|
|
18899
|
+
/** Called with the new list of expanded item values when an item expands or collapses. */
|
|
18900
|
+
onExpandedItemsChange?: (expandedItems: string[]) => void;
|
|
18901
|
+
/** Controlled checked items (`selectionMode="multiple"`); the cascade rule is the nested `Tree`'s. */
|
|
18902
|
+
checkedItems?: readonly string[];
|
|
18903
|
+
/**
|
|
18904
|
+
* Initially checked items (uncontrolled).
|
|
18905
|
+
* @default []
|
|
18906
|
+
*/
|
|
18907
|
+
defaultCheckedItems?: readonly string[];
|
|
18908
|
+
/**
|
|
18909
|
+
* Called with every checked item (in tree order) when a check changes. `details` is passed when
|
|
18910
|
+
* `setChecked` got an `event`; it is typed optional until 1.0.
|
|
18911
|
+
*/
|
|
18912
|
+
onCheckedItemsChange?: (checkedItems: string[], details?: TreeCheckedItemsChangeDetails) => void;
|
|
18913
|
+
/**
|
|
18914
|
+
* How items are selected, as `Tree`. With `'multiple'` every visible row carries its `checked`
|
|
18915
|
+
* state; the model's `getTreeProps()` hands the mode on to `FlatTree`.
|
|
18916
|
+
* @default 'none'
|
|
18917
|
+
*/
|
|
18918
|
+
selectionMode?: 'none' | SelectionMode_2;
|
|
18919
|
+
}
|
|
18920
|
+
|
|
17847
18921
|
/**
|
|
17848
18922
|
* A focusable group (Fluent's `useFocusableGroup`, tabster's groupper): one tab stop that holds
|
|
17849
18923
|
* several focusable elements, so a long list of rich rows does not cost a Tab press per control.
|
|
@@ -17982,14 +19056,32 @@ export declare function useFocusVisible(): boolean;
|
|
|
17982
19056
|
* keys: its cell takes focus, and Enter/F2 enters the composite at its own tab stop. The grid never
|
|
17983
19057
|
* writes `tabindex` on or inside a composite (the composite manages its own), so a composite
|
|
17984
19058
|
* keeps its own Tab stop — the same documented limitation as `useRovingTabIndex`.
|
|
19059
|
+
* - **Auxiliary widgets** (a widget that carries `data-grid-auxiliary`, such as a column's resize
|
|
19060
|
+
* handle) are left out when the cell's target is chosen, so a header with a sort button and a
|
|
19061
|
+
* resize handle keeps the button as its target (Enter sorts), and a cell whose only widget is
|
|
19062
|
+
* auxiliary is its own target. Like every widget they are at `tabindex="-1"` in navigation mode
|
|
19063
|
+
* and take part in interaction mode. F2 on a cell that has one, or on its target widget, enters
|
|
19064
|
+
* interaction mode at the first auxiliary widget (Enter on a cell that is its own target still
|
|
19065
|
+
* enters its first widget); Escape returns to the cell's target, the cell or its target widget.
|
|
19066
|
+
* While the widgets of such a cell are interacted with, its target widget is in interaction mode
|
|
19067
|
+
* too, so Tab moves between all of them and Escape on the target ends the mode. A cell without
|
|
19068
|
+
* auxiliary widgets behaves as described above.
|
|
19069
|
+
* - **Rows by their data** (a `model`: a windowed grid, whose rows are mounted in part): the rows
|
|
19070
|
+
* are the header rows and the data rows, which carry their index in the data as `data-row-index`
|
|
19071
|
+
* (other rows, such as the spacer rows of a window, are skipped). ArrowUp/ArrowDown,
|
|
19072
|
+
* PageUp/PageDown and Ctrl+Home/Ctrl+End go by that index over every row of the data, header
|
|
19073
|
+
* rows first, with the rules above: a target row that is not mounted is asked for with
|
|
19074
|
+
* `scrollToRow` (once per row) and focused in the commit that mounts it, and Ctrl+Home also
|
|
19075
|
+
* brings data row 0 back under the header rows. The active cell is kept by its row and column:
|
|
19076
|
+
* `activeRowIndex` and `pendingRowIndex` name the rows the owner keeps mounted, and while the
|
|
19077
|
+
* active row is not mounted anyway, a cell of the nearest mounted row holds the tab stop until
|
|
19078
|
+
* the row is back. ArrowLeft/ArrowRight and Home/End work in the row as above.
|
|
17985
19079
|
*
|
|
17986
19080
|
* Keys are ignored when the event's default was prevented (a widget that handled the key, a
|
|
17987
19081
|
* consumer handler), or with Alt/Meta held. The tab indexes are written to the DOM (layout effect
|
|
17988
19082
|
* plus a `MutationObserver`), so rows and widgets added later are covered without a re-render. Focus
|
|
17989
19083
|
* moves re-sync only the cells involved, the observer only the cells that changed, and the grid's
|
|
17990
19084
|
* own `tabindex` writes do not trigger a re-sync.
|
|
17991
|
-
*
|
|
17992
|
-
* Internal to the table package.
|
|
17993
19085
|
*/
|
|
17994
19086
|
export declare function useGridNavigation(options?: UseGridNavigationOptions): UseGridNavigationResult;
|
|
17995
19087
|
|
|
@@ -18000,6 +19092,14 @@ export declare interface UseGridNavigationOptions {
|
|
|
18000
19092
|
* @default 10
|
|
18001
19093
|
*/
|
|
18002
19094
|
pageSize?: number;
|
|
19095
|
+
/**
|
|
19096
|
+
* The data of a windowed grid (DataGrid with a virtual window). ArrowUp/ArrowDown,
|
|
19097
|
+
* PageUp/PageDown and Ctrl+Home/Ctrl+End then move by the rows of the data: a target row that is
|
|
19098
|
+
* not mounted is asked for with `scrollToRow` and focused when it mounts. The active row is kept
|
|
19099
|
+
* by its index (see {@link UseGridNavigationResult.activeRowIndex}). Without it, the mounted
|
|
19100
|
+
* rows are the whole grid.
|
|
19101
|
+
*/
|
|
19102
|
+
model?: GridNavigationModel;
|
|
18003
19103
|
}
|
|
18004
19104
|
|
|
18005
19105
|
/** Result of {@link useGridNavigation}. */
|
|
@@ -18008,6 +19108,19 @@ export declare interface UseGridNavigationResult {
|
|
|
18008
19108
|
gridRef: React_2.RefCallback<HTMLTableElement>;
|
|
18009
19109
|
/** Keyboard and focus handlers for the grid element. Stable identities. */
|
|
18010
19110
|
gridProps: GridNavigationHandlers;
|
|
19111
|
+
/**
|
|
19112
|
+
* With a `model`: the `data-row-index` of the active cell's row, the row that holds the grid's
|
|
19113
|
+
* tab stop (or takes it back once it is mounted again), so the owner keeps that row mounted.
|
|
19114
|
+
* `null` on a header row, and always `null` without a model. A change re-renders the owner.
|
|
19115
|
+
*/
|
|
19116
|
+
activeRowIndex: number | null;
|
|
19117
|
+
/**
|
|
19118
|
+
* With a `model`: the index of the data row a key moved focus to while it is not mounted (asked
|
|
19119
|
+
* for with `scrollToRow`); focus moves there in the commit that mounts it, so the owner keeps it
|
|
19120
|
+
* mounted too. `null` when no row is awaited, and always `null` without a model. A change
|
|
19121
|
+
* re-renders the owner.
|
|
19122
|
+
*/
|
|
19123
|
+
pendingRowIndex: number | null;
|
|
18011
19124
|
}
|
|
18012
19125
|
|
|
18013
19126
|
/**
|
|
@@ -18103,7 +19216,10 @@ export declare function useIsOverflowItemVisible(itemId: string): boolean;
|
|
|
18103
19216
|
* render. Options register even when filtered out or hidden (they render `hidden` and are not
|
|
18104
19217
|
* navigable), so labels are always known — use {@link collectOptionLabels} for the display text
|
|
18105
19218
|
* before registration (SSR/first render). `filter` is the navigability predicate, which a
|
|
18106
|
-
* picker builds from its query.
|
|
19219
|
+
* picker builds from its query. In data mode the keys, typeahead, the labels and the filter
|
|
19220
|
+
* read `items` only, so a picker may render just the shown options (`items` of the result), or
|
|
19221
|
+
* part of them: `onScrollToItem` receives every active option that scrolls into view, rendered
|
|
19222
|
+
* or not.
|
|
18107
19223
|
* - **Active option** is derived during render: the highlighted value, else the `autoHighlight`
|
|
18108
19224
|
* fallback. The highlight is reset on close and after a single-select commit that closes the
|
|
18109
19225
|
* listbox, and dropped once it is not navigable any more (filtered out, hidden, removed by an
|
|
@@ -18170,8 +19286,10 @@ export declare function useListbox(options: UseListboxOptions): UseListboxResult
|
|
|
18170
19286
|
* the option (registration mode) and its element, and reads its flags from the listbox store, so
|
|
18171
19287
|
* it re-renders only when its own active/selected/hidden state changes. Spread `optionProps` onto
|
|
18172
19288
|
* the `<li>` (`id`, `role="option"`, `aria-selected`, `aria-disabled`, `hidden`, and
|
|
18173
|
-
* `data-active`/`data-selected`/`data-disabled` for styling
|
|
18174
|
-
*
|
|
19289
|
+
* `data-active`/`data-selected`/`data-disabled` for styling; `aria-posinset` and `aria-setsize`
|
|
19290
|
+
* when a `renderOption` of Listbox, Combobox or Dropdown renders it, and in a windowed list a
|
|
19291
|
+
* `style` with its height, to merge after yours) and compose its `onClick` —
|
|
19292
|
+
* and in standalone mode its `onMouseDown`, the pointer press — with your own handlers. Mark the
|
|
18175
19293
|
* component with {@link markListboxElement}, so its label is known before it registers.
|
|
18176
19294
|
*
|
|
18177
19295
|
* Throws in development when used outside a listbox; in production it logs the error once and
|
|
@@ -18330,6 +19448,16 @@ export declare interface UseListboxOptions {
|
|
|
18330
19448
|
* {@link useActiveDescendant}'s `onActiveValueChange`.
|
|
18331
19449
|
*/
|
|
18332
19450
|
onActiveValueChange?: (value: string | null) => void;
|
|
19451
|
+
/**
|
|
19452
|
+
* Called for every move that scrolls the active option into view, for a list that renders only
|
|
19453
|
+
* part of its options (a virtual window): `index` is the option's index in
|
|
19454
|
+
* {@link UseListboxResult.items}, the shown options (filtered-out and hidden items are not
|
|
19455
|
+
* counted, disabled ones are). Scroll the list so that it shows and renders the option (a
|
|
19456
|
+
* window's `scrollToIndex(index)`, which moves the window in the same update); an element, when
|
|
19457
|
+
* there is one, is then scrolled into view as well. `aria-activedescendant` names the option
|
|
19458
|
+
* meanwhile. Passed to {@link useActiveDescendant}'s `onScrollToItem`, mapped to that index.
|
|
19459
|
+
*/
|
|
19460
|
+
onScrollToItem?: (index: number) => void;
|
|
18333
19461
|
/** Prefix of the generated listbox id. @default 'listbox' */
|
|
18334
19462
|
idPrefix?: string;
|
|
18335
19463
|
/**
|
|
@@ -19089,6 +20217,224 @@ export declare interface UseRovingTabIndexResult {
|
|
|
19089
20217
|
focusLast: () => void;
|
|
19090
20218
|
}
|
|
19091
20219
|
|
|
20220
|
+
/**
|
|
20221
|
+
* Selection by id, held outside the DOM, for lists, tables and trees whose items are not all
|
|
20222
|
+
* rendered. State is controlled with `selectedItems` or uncontrolled with `defaultSelectedItems`;
|
|
20223
|
+
* `onSelectedItemsChange` fires once per change, never for a no-op.
|
|
20224
|
+
*
|
|
20225
|
+
* @example
|
|
20226
|
+
* const selection = useSelection({ selectionMode: 'multiple' });
|
|
20227
|
+
* selection.toggleAll(rows.map((row) => row.id));
|
|
20228
|
+
*/
|
|
20229
|
+
export declare function useSelection({ selectionMode, selectedItems: selectedItemsProp, defaultSelectedItems, onSelectedItemsChange, }: UseSelectionOptions): UseSelectionResult;
|
|
20230
|
+
|
|
20231
|
+
/** What {@link UseSelectionOptions.onSelectedItemsChange} receives as its second argument. */
|
|
20232
|
+
export declare interface UseSelectionChangeDetails {
|
|
20233
|
+
/** The event that caused the change, when the caller passed one. */
|
|
20234
|
+
event?: Event;
|
|
20235
|
+
/** The id that was toggled, selected or deselected. Absent for `toggleAll` and `clear`. */
|
|
20236
|
+
id?: string;
|
|
20237
|
+
}
|
|
20238
|
+
|
|
20239
|
+
/** Options of {@link useSelection}. */
|
|
20240
|
+
export declare interface UseSelectionOptions {
|
|
20241
|
+
/**
|
|
20242
|
+
* `single` keeps at most one id selected and never deselects through `toggle`; `multiple` toggles
|
|
20243
|
+
* ids independently.
|
|
20244
|
+
*/
|
|
20245
|
+
selectionMode: SelectionMode_2;
|
|
20246
|
+
/** The selected ids (controlled). Pair it with `onSelectedItemsChange`. */
|
|
20247
|
+
selectedItems?: readonly string[];
|
|
20248
|
+
/**
|
|
20249
|
+
* The ids selected at first render (uncontrolled).
|
|
20250
|
+
* @default []
|
|
20251
|
+
*/
|
|
20252
|
+
defaultSelectedItems?: readonly string[];
|
|
20253
|
+
/**
|
|
20254
|
+
* Called with a new array of the selected ids whenever the selection changes. A call that leaves
|
|
20255
|
+
* the selection as it is (selecting a selected id, toggling the selected id in `single` mode)
|
|
20256
|
+
* does not call it.
|
|
20257
|
+
*/
|
|
20258
|
+
onSelectedItemsChange?: (selectedItems: string[], details?: UseSelectionChangeDetails) => void;
|
|
20259
|
+
}
|
|
20260
|
+
|
|
20261
|
+
/** What {@link useSelection} returns. */
|
|
20262
|
+
export declare interface UseSelectionResult {
|
|
20263
|
+
/** The mode the hook was given. */
|
|
20264
|
+
selectionMode: SelectionMode_2;
|
|
20265
|
+
/**
|
|
20266
|
+
* The selected ids. The same set object is returned while the ids stay the same, so it can key a
|
|
20267
|
+
* memo. It holds ids whose items are not rendered.
|
|
20268
|
+
*/
|
|
20269
|
+
selectedItems: ReadonlySet<string>;
|
|
20270
|
+
/** Whether `id` is selected. */
|
|
20271
|
+
isSelected(id: string): boolean;
|
|
20272
|
+
/** Toggles `id`: in `multiple` mode adds or removes it, in `single` mode selects it. */
|
|
20273
|
+
toggle(id: string, event?: Event): void;
|
|
20274
|
+
/** Selects `id`; in `single` mode it replaces the selection. */
|
|
20275
|
+
select(id: string, event?: Event): void;
|
|
20276
|
+
/** Removes `id` from the selection. */
|
|
20277
|
+
deselect(id: string, event?: Event): void;
|
|
20278
|
+
/**
|
|
20279
|
+
* Selects every id of `universe` when not all of them are selected, else removes only the ids of
|
|
20280
|
+
* `universe`: ids outside it stay selected. It does nothing in `single` mode.
|
|
20281
|
+
*/
|
|
20282
|
+
toggleAll(universe: readonly string[], event?: Event): void;
|
|
20283
|
+
/** Empties the selection, ids outside any universe included. */
|
|
20284
|
+
clear(event?: Event): void;
|
|
20285
|
+
}
|
|
20286
|
+
|
|
20287
|
+
/**
|
|
20288
|
+
* The column sizing plugin of `useTableFeatures`: the width of every column, held at or above its
|
|
20289
|
+
* minimum, and the props that lay a static `Table` out with them. Fills `state.columnSizing`.
|
|
20290
|
+
* Spread `getTableProps()` on the `Table`, render a `<colgroup>` with a `<col>` per column and
|
|
20291
|
+
* spread `getColumnProps(columnId)` on it, and give each `Table.ResizeHandle` the
|
|
20292
|
+
* `getResizeHandleProps(columnId)`. The widths are controlled with `columnWidths` or uncontrolled
|
|
20293
|
+
* with `defaultColumnWidths`. Until a width is state (a resize, or `columnWidths` or
|
|
20294
|
+
* `defaultColumnWidths` is given) the table is 100% wide and at least as wide as the columns; from
|
|
20295
|
+
* then on it is exactly as wide as they are, so a dragged edge follows the pointer. There is no
|
|
20296
|
+
* maximum width, and no fitting of the columns to the container. Call it unconditionally and pass
|
|
20297
|
+
* the plugin to `useTableFeatures`.
|
|
20298
|
+
*
|
|
20299
|
+
* @example
|
|
20300
|
+
* const { columnSizing } = useTableFeatures({ items, columns }, [
|
|
20301
|
+
* useTableColumnSizing({ columnSizingOptions: { name: { minWidth: 120, defaultWidth: 240 } } }),
|
|
20302
|
+
* ]);
|
|
20303
|
+
* <Table {...columnSizing.getTableProps()}>
|
|
20304
|
+
* <colgroup>
|
|
20305
|
+
* {columns.map((c) => <col key={c.columnId} {...columnSizing.getColumnProps(c.columnId!)} />)}
|
|
20306
|
+
* </colgroup>
|
|
20307
|
+
* </Table>
|
|
20308
|
+
*/
|
|
20309
|
+
export declare function useTableColumnSizing<T>(options?: UseTableColumnSizingOptions): TableFeaturePlugin<T>;
|
|
20310
|
+
|
|
20311
|
+
/** Options of {@link useTableColumnSizing}. */
|
|
20312
|
+
export declare interface UseTableColumnSizingOptions {
|
|
20313
|
+
/**
|
|
20314
|
+
* Per column, by `columnId`: `minWidth` (`@default 80`), and the width the column starts at,
|
|
20315
|
+
* `defaultWidth` or else `idealWidth` (else 150). Ids that are not columns are ignored. May be
|
|
20316
|
+
* written inline.
|
|
20317
|
+
*/
|
|
20318
|
+
columnSizingOptions?: Record<string, ColumnSizingOption>;
|
|
20319
|
+
/**
|
|
20320
|
+
* The column widths in pixels (controlled), by `columnId`: a column without an entry has its
|
|
20321
|
+
* initial width. Pair it with `onColumnWidthsChange`.
|
|
20322
|
+
*/
|
|
20323
|
+
columnWidths?: Record<string, number>;
|
|
20324
|
+
/** The column widths at first render (uncontrolled). */
|
|
20325
|
+
defaultColumnWidths?: Record<string, number>;
|
|
20326
|
+
/**
|
|
20327
|
+
* Called with the width of every column and the details whenever a width changes (every step of
|
|
20328
|
+
* a drag or key press). The details are always passed; they are typed optional through 0.x, as
|
|
20329
|
+
* every `details` argument. Setting the width a column already has does not call it, once a
|
|
20330
|
+
* width is state.
|
|
20331
|
+
*/
|
|
20332
|
+
onColumnWidthsChange?: (widths: Record<string, number>, details?: TableColumnWidthsChangeDetails) => void;
|
|
20333
|
+
}
|
|
20334
|
+
|
|
20335
|
+
/**
|
|
20336
|
+
* Headless table state for a table built from the static `Table` parts: the rows of `items`, and
|
|
20337
|
+
* the features its plugins add (`useTableSort`, `useTableSelection`, `useTableColumnSizing`). Each
|
|
20338
|
+
* plugin fills its own part of the state (`sort`, `selection`, `columnSizing`), so the order of
|
|
20339
|
+
* the array does not matter. The state follows the data, not the rendered rows, so a table that
|
|
20340
|
+
* renders a page or a window of its rows keeps select-all and the sort over every item.
|
|
20341
|
+
*
|
|
20342
|
+
* Call each plugin hook unconditionally, in the array or before it, and pass the same plugins on
|
|
20343
|
+
* every render; to turn a feature off, change its options. Options may be written inline: a plugin
|
|
20344
|
+
* whose options change identity on every render (an inline `isDisabled`) only makes the state be
|
|
20345
|
+
* recomputed on every render, while `getRows()` keeps its array until `items`, `getRowId`,
|
|
20346
|
+
* `columns` or the sort change. A feature given twice (the last plugin of it is used), a plugin
|
|
20347
|
+
* count that changes between renders and repeated row ids are development warnings.
|
|
20348
|
+
*
|
|
20349
|
+
* @example
|
|
20350
|
+
* const { getRows, sort, selection } = useTableFeatures({ items, columns, getRowId }, [
|
|
20351
|
+
* useTableSort({ defaultSort: { columnId: 'name', direction: 'ascending' } }),
|
|
20352
|
+
* useTableSelection({ selectionMode: 'multiple' }),
|
|
20353
|
+
* ]);
|
|
20354
|
+
*/
|
|
20355
|
+
export declare function useTableFeatures<T>(options: UseTableFeaturesOptions<T>, plugins?: readonly TableFeaturePlugin<T>[]): TableFeaturesState<T>;
|
|
20356
|
+
|
|
20357
|
+
/** Options of {@link useTableFeatures}. */
|
|
20358
|
+
export declare interface UseTableFeaturesOptions<T> {
|
|
20359
|
+
/** The items, one row each. Every item counts for select-all, rendered or not. */
|
|
20360
|
+
items: readonly T[];
|
|
20361
|
+
/** The columns, from `createTableColumn`. The sort uses the `compare` of the sorted column. */
|
|
20362
|
+
columns: readonly DataGridColumn<T>[];
|
|
20363
|
+
/**
|
|
20364
|
+
* The row id of an item: unique, and the same for an item across renders (selection and the
|
|
20365
|
+
* selection callbacks use it). Pass a stable function (defined outside the component, or
|
|
20366
|
+
* memoised): the rows are rebuilt when it changes.
|
|
20367
|
+
* @default (item, index) => String(index)
|
|
20368
|
+
*/
|
|
20369
|
+
getRowId?: (item: T, index: number) => string;
|
|
20370
|
+
}
|
|
20371
|
+
|
|
20372
|
+
/**
|
|
20373
|
+
* The selection plugin of `useTableFeatures`: a set of row ids (`selectedItems`, controlled, or
|
|
20374
|
+
* `defaultSelectedItems`), and `state.selection` with select-all over every item of `items`,
|
|
20375
|
+
* rendered or not. Select-all selects every selectable row and leaves the other ids as they are;
|
|
20376
|
+
* deselecting all removes only the selectable ids of `items`, so a selected disabled row and ids
|
|
20377
|
+
* selected on another page or filtered out stay selected (`clearRows` empties the selection).
|
|
20378
|
+
* `onSelectedItemsChange` fires once per change with a new array of every selected id. Call it
|
|
20379
|
+
* unconditionally and pass the plugin to `useTableFeatures`.
|
|
20380
|
+
*
|
|
20381
|
+
* @example
|
|
20382
|
+
* const { selection } = useTableFeatures({ items, columns, getRowId }, [
|
|
20383
|
+
* useTableSelection({ selectionMode: 'multiple', onSelectedItemsChange: setSelected }),
|
|
20384
|
+
* ]);
|
|
20385
|
+
*/
|
|
20386
|
+
export declare function useTableSelection<T>(options: UseTableSelectionOptions<T>): TableFeaturePlugin<T>;
|
|
20387
|
+
|
|
20388
|
+
/** Options of {@link useTableSelection}: those of `useSelection`, plus the disabled rows. */
|
|
20389
|
+
export declare interface UseTableSelectionOptions<T> extends UseSelectionOptions {
|
|
20390
|
+
/**
|
|
20391
|
+
* Whether the selection of an item cannot change through select-all: `toggleAllRows` skips it,
|
|
20392
|
+
* and `allRowsSelected` does not wait for it. A disabled row keeps its state. The single-row
|
|
20393
|
+
* functions do not read it: disable the row's own control. Called for every item of `items`
|
|
20394
|
+
* whenever `useTableFeatures` computes its state: when the selection, `items`, `getRowId`,
|
|
20395
|
+
* `columns`, the sort or another plugin's state (the column widths) change, and when this
|
|
20396
|
+
* function changes. A function written inline is a new one on every render, so the state is
|
|
20397
|
+
* then computed, and this function called for every item, on every render (no more: no extra
|
|
20398
|
+
* render, and `getRows()` keeps its array); define it outside the component or memoise it to
|
|
20399
|
+
* call it only on those changes.
|
|
20400
|
+
*/
|
|
20401
|
+
isDisabled?: (item: T, index: number) => boolean;
|
|
20402
|
+
}
|
|
20403
|
+
|
|
20404
|
+
/**
|
|
20405
|
+
* The sort plugin of `useTableFeatures`: sorts the rows by the `compare` of a column and fills
|
|
20406
|
+
* `state.sort`. The sort is controlled with `sort` or uncontrolled with `defaultSort`;
|
|
20407
|
+
* `toggleColumnSort` goes from ascending to descending as a sortable DataGrid header does. The
|
|
20408
|
+
* sorted column is the one whose `columnId` is the sort's `columnId` (the deprecated `id` of a
|
|
20409
|
+
* column is not read). Call it unconditionally and pass the plugin to `useTableFeatures`.
|
|
20410
|
+
*
|
|
20411
|
+
* @example
|
|
20412
|
+
* const state = useTableFeatures({ items, columns }, [
|
|
20413
|
+
* useTableSort({ defaultSort: { columnId: 'name', direction: 'ascending' } }),
|
|
20414
|
+
* ]);
|
|
20415
|
+
* state.sort.toggleColumnSort('name');
|
|
20416
|
+
*/
|
|
20417
|
+
export declare function useTableSort<T>(options?: UseTableSortOptions): TableFeaturePlugin<T>;
|
|
20418
|
+
|
|
20419
|
+
/** Options of {@link useTableSort}. */
|
|
20420
|
+
export declare interface UseTableSortOptions {
|
|
20421
|
+
/**
|
|
20422
|
+
* The sort (controlled): the sorted column and its direction, or `null` for the order of
|
|
20423
|
+
* `items`. Pair it with `onSortChange`.
|
|
20424
|
+
*/
|
|
20425
|
+
sort?: DataGridSort | null;
|
|
20426
|
+
/**
|
|
20427
|
+
* The sort at first render (uncontrolled).
|
|
20428
|
+
* @default null
|
|
20429
|
+
*/
|
|
20430
|
+
defaultSort?: DataGridSort | null;
|
|
20431
|
+
/**
|
|
20432
|
+
* Called with the new sort whenever it changes, and the event behind it when the change was
|
|
20433
|
+
* given one. Setting the sort it already has does not call it.
|
|
20434
|
+
*/
|
|
20435
|
+
onSortChange?: (sort: DataGridSort, details?: DataGridSortChangeDetails) => void;
|
|
20436
|
+
}
|
|
20437
|
+
|
|
19092
20438
|
/**
|
|
19093
20439
|
* Returns the {@link ToastController} of the enclosing `<Toaster>`: `dispatchToast(content,
|
|
19094
20440
|
* options?)` shows your content (usually a `<Toast>` with parts) and `dispatchToast(options)` a
|
|
@@ -19121,6 +20467,70 @@ export declare interface UseRovingTabIndexResult {
|
|
|
19121
20467
|
*/
|
|
19122
20468
|
export declare function useToastController(): ToastController;
|
|
19123
20469
|
|
|
20470
|
+
/**
|
|
20471
|
+
* A window over a long list of fixed-height rows, for rendering only the rows in view. Give
|
|
20472
|
+
* `scrollRef` to the scrolling element and render `layout(count)`: rows for the item entries and
|
|
20473
|
+
* empty blocks of `size` pixels for the spacer entries.
|
|
20474
|
+
*
|
|
20475
|
+
* The window re-renders only when the first row in view or the viewport height changes, not on
|
|
20476
|
+
* every scroll event: scrolling is read in a passive `scroll` listener once per animation frame,
|
|
20477
|
+
* and the viewport height on attach, on scroll and from a `ResizeObserver` where one exists. The
|
|
20478
|
+
* server and the first render lay out the top of the list in `initialViewportSize`, and read no
|
|
20479
|
+
* DOM.
|
|
20480
|
+
*
|
|
20481
|
+
* Never write `ref={virtualWindow.scrollRef}` in JSX: the React Compiler's lint types a member
|
|
20482
|
+
* read in the `ref` position as a ref, then reports that read and every call on the window during
|
|
20483
|
+
* render (`virtualWindow.layout(count)` included). Merge the callback with the element's other
|
|
20484
|
+
* refs through `useMergedRefs(ownRef, virtualWindow.scrollRef)`, or destructure it first
|
|
20485
|
+
* (`const { scrollRef } = virtualWindow`); `virtualWindow.layout(count)` can then be called as is.
|
|
20486
|
+
*
|
|
20487
|
+
* @example
|
|
20488
|
+
* const virtualWindow = useVirtualWindow({ itemSize: 32 });
|
|
20489
|
+
* const { scrollRef } = virtualWindow;
|
|
20490
|
+
* return (
|
|
20491
|
+
* <div ref={scrollRef} style={{ height: 320, overflowY: 'auto' }}>
|
|
20492
|
+
* {virtualWindow.layout(rows.length).map((entry) =>
|
|
20493
|
+
* entry.kind === 'item' ? (
|
|
20494
|
+
* <Row key={rows[entry.index].id} row={rows[entry.index]} />
|
|
20495
|
+
* ) : (
|
|
20496
|
+
* <div key={entry.key} aria-hidden="true" style={{ height: entry.size }} />
|
|
20497
|
+
* ),
|
|
20498
|
+
* )}
|
|
20499
|
+
* </div>
|
|
20500
|
+
* );
|
|
20501
|
+
*/
|
|
20502
|
+
export declare function useVirtualWindow({ itemSize, overscan, initialViewportSize, scrollPaddingStart, }: UseVirtualWindowOptions): VirtualWindow;
|
|
20503
|
+
|
|
20504
|
+
/** Options of {@link useVirtualWindow}. */
|
|
20505
|
+
export declare interface UseVirtualWindowOptions {
|
|
20506
|
+
/**
|
|
20507
|
+
* The height of every row, in pixels (all rows have the same height). A value that is not a
|
|
20508
|
+
* positive finite number warns once in development and counts as 1.
|
|
20509
|
+
*/
|
|
20510
|
+
itemSize: number;
|
|
20511
|
+
/**
|
|
20512
|
+
* Rows rendered beyond each edge of the viewport, so a fast scroll shows rows instead of blank
|
|
20513
|
+
* space before the next window renders. A given number is a number of rows; the default covers
|
|
20514
|
+
* at least 240 pixels, so small rows get more of them (9 rows of 28 pixels, 8 of 32).
|
|
20515
|
+
* @default enough rows for 240 pixels, and at least 6
|
|
20516
|
+
*/
|
|
20517
|
+
overscan?: number;
|
|
20518
|
+
/**
|
|
20519
|
+
* The viewport height, in pixels, assumed until the scroller is measured: on the server, in the
|
|
20520
|
+
* first render, and while the scroller measures 0 (it has no layout, as in jsdom).
|
|
20521
|
+
* @default 480
|
|
20522
|
+
*/
|
|
20523
|
+
initialViewportSize?: number;
|
|
20524
|
+
/**
|
|
20525
|
+
* The height, in pixels, of content pinned over the top of the rows inside the scroller (a
|
|
20526
|
+
* sticky header). `scrollToIndex` places rows in the area below it, and its content bound leaves
|
|
20527
|
+
* it out; the rows' offsets and the layout do not change. A value that is not a finite number of
|
|
20528
|
+
* 0 or more counts as 0.
|
|
20529
|
+
* @default 0
|
|
20530
|
+
*/
|
|
20531
|
+
scrollPaddingStart?: number;
|
|
20532
|
+
}
|
|
20533
|
+
|
|
19124
20534
|
/**
|
|
19125
20535
|
* Reads the theme, direction, theme classes and portal container of the nearest
|
|
19126
20536
|
* {@link WaveProvider}. Outside a provider it returns light/ltr defaults with `hasProvider: false`.
|
|
@@ -19146,6 +20556,85 @@ export declare interface VirtualElement {
|
|
|
19146
20556
|
contextElement?: Element;
|
|
19147
20557
|
}
|
|
19148
20558
|
|
|
20559
|
+
/**
|
|
20560
|
+
* One entry of a windowed list: a row to render, or the empty space that stands in for the rows
|
|
20561
|
+
* that are not rendered. A spacer's `key` is stable for React: `spacer-<index of the next item>`,
|
|
20562
|
+
* or `spacer-end` for the one after the last item.
|
|
20563
|
+
*/
|
|
20564
|
+
export declare type VirtualEntry = {
|
|
20565
|
+
kind: 'item';
|
|
20566
|
+
index: number;
|
|
20567
|
+
} | {
|
|
20568
|
+
kind: 'spacer';
|
|
20569
|
+
size: number;
|
|
20570
|
+
key: string;
|
|
20571
|
+
};
|
|
20572
|
+
|
|
20573
|
+
/**
|
|
20574
|
+
* A window over a long list of fixed-height rows: which rows to render for the scroll position,
|
|
20575
|
+
* and the space that stands in for the others. {@link useVirtualWindow} returns one; a component
|
|
20576
|
+
* that takes a `virtualWindow` prop renders its rows through it, and an adapter over a
|
|
20577
|
+
* virtualization library can implement the same interface.
|
|
20578
|
+
*/
|
|
20579
|
+
export declare interface VirtualWindow {
|
|
20580
|
+
/** The row height the window lays out with, in pixels. */
|
|
20581
|
+
itemSize: number;
|
|
20582
|
+
/**
|
|
20583
|
+
* The callback ref of the scrolling element (the element with a bounded height and its own
|
|
20584
|
+
* scrollbar). It attaches once per element and detaches when called with `null`.
|
|
20585
|
+
*/
|
|
20586
|
+
scrollRef: React_2.RefCallback<HTMLElement>;
|
|
20587
|
+
/**
|
|
20588
|
+
* The entries to render, in order, for a list of `count` rows: the rows in view plus the
|
|
20589
|
+
* overscan, every `keep` index outside them as a row of its own (the focused row, a row about
|
|
20590
|
+
* to be focused), and spacers for the rows in between. The sizes add up to `count * itemSize`.
|
|
20591
|
+
* A pure function of the window's state and its arguments, called during render; it reads no
|
|
20592
|
+
* DOM.
|
|
20593
|
+
*/
|
|
20594
|
+
layout(count: number, options?: {
|
|
20595
|
+
keep?: readonly number[];
|
|
20596
|
+
}): readonly VirtualEntry[];
|
|
20597
|
+
/**
|
|
20598
|
+
* Scrolls the row at `index` into view and moves the window to it in the same update, so the
|
|
20599
|
+
* row is rendered once that update commits. `align` places it at the `start`, `center` or `end`
|
|
20600
|
+
* of the viewport; `auto` (the default) scrolls the least that shows it whole. The offset is
|
|
20601
|
+
* bounded by the rendered content. Before the scroller attaches, the last request is kept and
|
|
20602
|
+
* applied when it does, and once more when the scroller first changes height after that (a
|
|
20603
|
+
* popup that positioning shrinks once it is shown), unless it was scrolled or another request
|
|
20604
|
+
* came in between. Call it from an event handler or an effect, never during render.
|
|
20605
|
+
*/
|
|
20606
|
+
scrollToIndex(index: number, options?: {
|
|
20607
|
+
align?: 'auto' | 'start' | 'center' | 'end';
|
|
20608
|
+
}): void;
|
|
20609
|
+
}
|
|
20610
|
+
|
|
20611
|
+
/**
|
|
20612
|
+
* One row of the visible list: an item under expanded branches only, with the facts a row needs
|
|
20613
|
+
* for its tree semantics. A row is a branch when `hasChildren` is true or when
|
|
20614
|
+
* `item.itemType === 'branch'`; `expanded` is true only for a branch whose value is in the
|
|
20615
|
+
* expanded set (so a childless `'branch'` item can be expanded).
|
|
20616
|
+
*/
|
|
20617
|
+
export declare interface VisibleFlatItem {
|
|
20618
|
+
/** The item data, as passed in. */
|
|
20619
|
+
item: FlatTreeItemData;
|
|
20620
|
+
/** The depth, 1 for a root (`aria-level`). */
|
|
20621
|
+
level: number;
|
|
20622
|
+
/** The 1-based place among its siblings, in the order of `items` (`aria-posinset`). */
|
|
20623
|
+
position: number;
|
|
20624
|
+
/** The number of siblings, itself included (`aria-setsize`). */
|
|
20625
|
+
setSize: number;
|
|
20626
|
+
/** The value of the parent as indexed (`undefined` for a root, an unknown parent included). */
|
|
20627
|
+
parentValue: string | undefined;
|
|
20628
|
+
/** Whether other items are nested in it. */
|
|
20629
|
+
hasChildren: boolean;
|
|
20630
|
+
/** Whether it can expand: `hasChildren`, or `item.itemType === 'branch'` (`aria-expanded` is set for these). */
|
|
20631
|
+
isBranch: boolean;
|
|
20632
|
+
/** Whether it is a branch in the expanded set. */
|
|
20633
|
+
expanded: boolean;
|
|
20634
|
+
/** The place in the visible list, 0-based. */
|
|
20635
|
+
index: number;
|
|
20636
|
+
}
|
|
20637
|
+
|
|
19149
20638
|
/** Value provided by {@link WaveProvider} and returned by {@link useWaveTheme}. */
|
|
19150
20639
|
export declare interface WaveContextValue {
|
|
19151
20640
|
/** The active theme. */
|