Skip to content

v0.14.0

Choose a tag to compare

@github-actions github-actions released this 27 Oct 16:22
· 403 commits to main since this release

The ninth Fluent UI v9 parity release: Phase 9 of the roadmap, collections, data grids and guided tours. Overflow hides by priority and in groups, Breadcrumb collapses into a menu (by count or by the room it has), DataGrid renders and sorts its own rows from typed columns and selects on a row click, the static Table gets sortable headers, a selection cell, a cell layout and cell actions, List can be navigated without selecting and gets an action of its own, and TeachingPopover gets footer actions and Fluent's composable parts. Every addition is opt-in, and nothing public was removed; the type widenings and the few markup changes are under "Upgrading from 0.13".

Upgrading from 0.13

  1. DataGridColumn and DataGrid are generic over the type of the grid's items (DataGridColumn<T = unknown>, DataGridProps<T>, DataGridBaseProps<T>, DataGridBodyProps<T>); without a type argument they keep the 0.13 shape with T = unknown. A column's label widens from string to ReactNode (code that reads it as a string narrows it first), and its id is optional and deprecated, so column.id reads as string | undefined (write columnId). DataGrid has two call signatures; React.ComponentProps<typeof DataGrid> is the last one, DataGridProps<unknown>.
  2. children of DataGrid and DataGrid.Body is optional, and DataGridBodyProps['children'] may be a render function (item, index) => ReactNode (DataGridBodyProps omits the native children): code that reads it as a ReactNode handles the function.
  3. onSortChange(sort) and onSelectedItemsChange(items) get a second argument, details ({ event }, the click or key press behind the change). Exact assertions such as toHaveBeenCalledWith(sort) or a mock.calls entry compared to a one-element array need it ({ event: expect.any(Event) }). The 0.4 positional onSortChange(columnId, direction) and the deprecated onSelectionChange(keys) are unchanged.
  4. A grid with items uses the object form of onSortChange, with or without sort and defaultSort. Next to items, the positional callback and the deprecated sortColumn, sortDirection, defaultSortColumn and defaultSortDirection are type errors. At run time a positional onSortChange is called in the object form (onSortChange(sort, details)), and only the deprecated sort props are ignored, with a development warning (DataGrid:items-deprecated-sort). Pass items={data ?? []} while the data loads.
  5. A sorted DataGrid header shows an arrow (up for ascending, down for descending: <svg data-wave-icon="sort-arrow-up"> or "sort-arrow-down", 12px, with data-direction, still wave-data-grid-header-cell__sort-icon) instead of 0.13's filled triangle. A test or style that reads the triangle's path or its h-3 w-3 classes changes.
  6. OverflowItemProps is a type alias of a union (OverflowItemBaseProps & OverflowItemPriorityProps: priority and pinned exclude each other). interface X extends OverflowItemProps no longer compiles: extend OverflowItemBaseProps (and intersect OverflowItemPriorityProps for the two props).
  7. TeachingPopover's Done calls onFinish, then onDismiss. Done still calls onDismiss through 0.x, so that 0.13 code keeps working; 1.0 drops it. A handler pair that does the same work in both runs it twice on Done.
  8. Children of TeachingPopover render. 0.13 dropped them silently; they now render in place, before the popover's own surface (the new parts are written there).
  9. TeachingPopover's steps form renders the default parts. The Close button sits in a <div class="wave-teaching-popover-header"> (it keeps its class and its place at the top end), the heading, the body and the footer carry wave-teaching-popover-title, wave-teaching-popover-body and wave-teaching-popover-footer before their 0.13 part classes, and the surface and the footer carry data-layout (horizontal). The look and every other attribute are unchanged. A selector that relies on the Close button being a child of the surface (.wave-teaching-popover > .wave-teaching-popover__close-button), on :first-child, or a test that walks dialog.firstElementChild, changes. It is the one change to an element structure of 0.13 that needs no opt-in (the others add attributes and classes), made so that a part's stable class sits on the element that takes its className (C-CLASS) and the steps form and the parts form render the same markup.
  10. Table and DataGrid cells are positioned (relative: the box of Table.CellActions), and their rows are the Tailwind group group/table-row. An absolutely positioned element of yours inside a cell is placed against the cell, and body cells paint over a sticky header of yours that sets no z-index (give it one).
  11. New attributes on 0.13 markup, always rendered with their resolved value: Overflow's data-orientation, data-overflow-direction and data-button-position; Breadcrumb's data-size, data-focus-mode and data-overflow (on the <nav>); DataGrid's data-selection-appearance (on the table); List's data-navigation-mode; the TeachingPopover surface's data-layout. A test that compares an element's full HTML or attribute list changes.

Added

  • Overflow: Overflow.Item priority (items hide in ascending priority; equal priorities by direction) or pinned (never hides); overflowDirection (end, start), orientation (vertical stacks the items and measures heights; Fluent's overflowAxis), minimumVisible, hasHiddenItems (the button is rendered before the first measurement, also in the server HTML), buttonPosition (end, the default, or before-hidden: the button stands just before the first hidden item, as a breadcrumb's "…" does) and onOverflowChange(hiddenItems, details) with { visibleItems, groupVisibility }. Groups: Overflow.Item groupId, Overflow.Divider (OverflowDivider, hidden while its group is; it stretches across the row, so a Toolbar.Divider in it is drawn at the row's height), useIsOverflowGroupVisible(groupId) ('visible', 'hidden' or 'overflow') and useHasHiddenItems(). Overflow.Item asChild puts the item's props on its single element child (an <li>, a Toolbar button), and a row with role="list" makes the button's wrapper a list item. When every item fits again while the overflow button has focus, focus moves to the first item it stood for (also in Breadcrumb's overflow="auto" trail), not to the page. While no item sets priority or pinned, the first item (with start, the last) never hides, as in 0.13. Types OverflowDirection, OverflowGroupVisibility, OverflowChangeDetails, OverflowItemBaseProps, OverflowItemPriorityProps, OverflowDividerProps.
  • Breadcrumb: maxDisplayedItems and overflowIndex (default 1) collapse the middle items into a "…" button (overflowLabel, "More items") that opens a Menu of them: a Menu.ItemLink for a link item (an asChild link too, the element's own href winning; an asChild element of a component, a router link with or without a string href, is rendered by that component with its own props, its as included, so it navigates the way the trail's link does; a link item or an asChild <a> keeps its target, rel and download on the trail), a Menu.Item for a button item, disabled when the item is. The first item and the last current item never collapse. overflow="auto" collapses by the room instead: the trail is an Overflow of its <li>s, the first and the current item pinned, and the "…" (with its own separator) stands where the hidden items were. size (small, medium, large), focusMode (tab, or arrow: one Tab stop, the arrow keys, Home and End, mirrored in RTL) and divider (a slot; false hides the separators).
  • Breadcrumb helpers, server-safe and importing nothing: partitionBreadcrumbItems({ items, maxDisplayedItems, overflowIndex }) (Fluent's rules; PartitionBreadcrumbItemsOptions, PartitionBreadcrumbItemsResult), truncateBreadcrumbLongName(content, maxLength = 30), truncateBreadcrumbLongTooltip(content, maxLength = 80) (Fluent spells it truncateBreadcrumLongTooltip; there is no alias) and isTruncatableBreadcrumbContent(content, maxLength).
  • DataGrid typed columns and items: DataGridColumn gains columnId, compare, renderCell, renderHeaderCell and sortable (default: it has compare), and its label takes any content; createTableColumn<T>(options) (CreateTableColumnOptions; server-safe) builds one with sortable resolved. items, getRowId (default: the item's index in items) and columns render the header, the rows and their cells; DataGrid.Body also takes a render function (item, index) => <DataGrid.Row>, whose rows get their rowId from getRowId. Item rows are memoised by row id, so a sort moves them without rendering them again. Types DataGridItemsProps, DataGridItemsSortProps.
  • DataGrid built-in sorting: with items, the grid orders its rows by the sorted column's compare, also while sort is controlled: a stable sort of a copy, and descending negates compare, so items that compare equal keep their order in both directions. A column without compare never reorders the rows (server-sorted data). DataGrid.HeaderCell sortIcon replaces the arrow (an optional indicator: false hides it; the glyph shows only while the column is sorted). onSortChange and onSelectedItemsChange receive details (DataGridSortChangeDetails, DataGridSelectedItemsChangeDetails).
  • DataGrid selection: selectOnRowClick (a click on a row toggles it; the row's onClick runs first, and its preventDefault() keeps the selection; a click on a link, a button, an input or another interactive element, from a popup portaled from the row, on a header row, or one that ends a text selection never toggles), selectionAppearance (brand, the default, neutral, none; DataGridSelectionAppearance), subtleSelection (unchecked controls are drawn while their row, and the select-all while the grid, is hovered or holds focus; always in forced colors and on touch screens; data-subtle-selection), DataGrid.Row selectionCellProps (disabled, invisible, className, aria-label; DataGridRowSelectionCellProps) and DataGrid.SelectionCell (DataGridSelectionCell, DataGridSelectionCellProps): the select-all in a header row and the row's toggle in a body row, where you write it, in place of the automatic cell. A disabled row is skipped by row clicks, Space and select-all, which counts and selects the enabled rows only.
  • Table parts: Table.HeaderCell sortable, sortDirection (ascending or descending; unset is unsorted), onSortClick(event), sortIcon and aside: a sort <button> in a <th aria-sort> ("none" while unsorted), with no grid semantics, and the table stays stateless. Table.SelectionCell (TableSelectionCell): a checkbox or radio cell with checked (true, false, 'mixed'), defaultChecked, onCheckedChange(checked, details) (TableSelectionCellCheckedChangeDetails), name, value, form, required, subtle, invisible and controlRef; the control's attributes and handlers go to the input, and uncontrolled radios that share a name behave as one group. Table.CellLayout (TableCellLayout): media (an Avatar there gets a 32px box), the main text, description, truncate and appearance="primary". Table.CellActions (TableCellActions): actions over the end of a cell, drawn while the row is hovered or holds focus (always in forced colors and on touch screens; visible keeps them), over a background that follows the library's row fills (a row fill of your own, or a table on a Card, needs the same background class on the actions). Types TableSelectionCellProps, TableCellLayoutProps, TableCellActionsProps.
  • List: navigationMode (none, items, composite; ListNavigationMode): items gives a list without selection one Tab stop, the arrow keys, Home, End and, in a list of more than 7 items, typeahead, and composite is the grid from the first render, so the items never remount when actions appear. List.Item onAction(event) (ListItemActionEvent: a click and Enter, and Space on an item that cannot be selected; it runs before the selection toggles, and its preventDefault() keeps the selection), List.Item disabledSelection (the selection cannot change, the item stays in the arrow order; data-disabled-selection), and check marks: checkmark on the List (opt-in, data-checkmark) and a checkmark slot on List.Item.
  • TeachingPopover actions: primaryAction and secondaryAction, on the popover and on a step (the step's wins), replace Next (or Done) and Back: a label, a Button-like element or a slot object ({ as: 'a', href, children } stays a Wave Button). The consumer's onClick runs first, then the step's own action unless it called preventDefault() (TeachingPopoverAction). footerLayout (horizontal, vertical: the dots above full-width buttons), and onFinish(), called by Done.
  • TeachingPopover parts (Fluent's composition), also under flat names: TeachingPopover.Trigger (opens and closes the popover with aria-haspopup="dialog", aria-expanded and aria-controls; the popover points at it while target is unset, and focus returns to it; written directly inside, it makes defaultOpen false), .Surface, .Header (the Close button, a caption, icon and a dismissButton slot), .Title (as; it names the surface), .Body (media), .Footer, .Carousel, .CarouselNav (interactive step buttons, each a Tab stop: labels.nav, "Choose step", and labels.navButton(index, count), "Step 2 of 3"), .CarouselPageCount (a visible "2 of 3", worded by a render function) and .CarouselFooter (layout offset or centered, initialStepText, finalStepText; the footer wraps rather than let the indicator and the buttons overlap: offset moves the buttons to a row of their own, and centered keeps the indicator in the middle of the footer, with or without a secondary button, or, when that row does not fit, puts it on a row of its own above the buttons, with data-stacked), with their *Props types. A part without children shows its share of the current step; steps stays the only source of the pages. Where WaveUI differs from Fluent: initialStepText makes the first step's secondary button dismiss the popover (onOpenChange(false), then onDismiss; Fluent calls onFinish), CarouselFooter's default layout is offset (WaveUI's own footer; Fluent's is centered), and CarouselNav is a named group of buttons with aria-current="step" (Fluent's is a tablist).
  • Stable class names: overflowDividerClassNames, dataGridSelectionCellClassNames, tableSelectionCellClassNames (root, control), tableCellLayoutClassNames (root, media, content, main, description), tableCellActionsClassNames, teachingPopoverSurfaceClassNames, teachingPopoverHeaderClassNames (root, icon), teachingPopoverTitleClassNames, teachingPopoverBodyClassNames (root, media), teachingPopoverFooterClassNames, teachingPopoverCarouselClassNames, teachingPopoverCarouselNavClassNames (root, button, indicator), teachingPopoverCarouselPageCountClassNames, teachingPopoverCarouselFooterClassNames; new keys on breadcrumbClassNames (overflowButton), tableHeaderCellClassNames (button, sortIcon, aside), listItemClassNames (checkmark) and teachingPopoverClassNames (primaryButton, secondaryButton). The Surface carries wave-teaching-popover wave-teaching-popover-surface, and the CarouselFooter carries TeachingPopover's footer part class.
  • Development warnings (keys): Overflow:button-position, Overflow.Item:as-child-children, Breadcrumb:overflow-item, DataGrid:column-without-columnId, DataGrid:items-deprecated-sort, DataGrid.Body:render-without-items, DataGrid.SelectionCell:not-selectable, DataGrid.SelectionCell:unseen, DataGrid.Header:several-selection-cells, DataGrid.HeaderCell:sortIcon-button, Table.HeaderCell:sortIcon-button, Table.SelectionCell:name, List:items-with-actions, List:none-selectable, List.Item:action-not-navigable, TeachingPopover:surface-props, TeachingPopover.Surface:placement, TeachingPopover.Header:dismissButton-button-element.
  • Stories for Overflow priorities, groups and a Toolbar, the Breadcrumb collapse, sizes, arrow keys, divider and truncated names, typed DataGrid columns with sorting, row-click selection and the selection looks, the Table parts, the List modes and onAction, and TeachingPopover actions and a tour built from parts.

Changed

Behaviour

  • List: when a list stops navigating its items while one of them has focus (navigationMode items to none, or a list without item actions whose selectable is turned off), focus moves to that item's first focusable content; an item with none keeps focus, though it is no longer a Tab stop. Enter on a selectable item is preventDefault()ed after onAction and the toggle ran, not before, so onAction can cancel the toggle.
  • TeachingPopover renders its children (see "Upgrading from 0.13", 8).

DOM structure

  • The attributes of "Upgrading from 0.13", 11, the TeachingPopover header element and part classes (9), and relative on Table.Cell and DataGrid.Cell with group/table-row on Table.Row and DataGrid.Row (10). The DataGrid's sort glyph is the arrow icon (5).
  • The selection controls of a DataGrid carry disabled:cursor-not-allowed.
  • An Overflow with role="list" gives its button's wrapper role="listitem".

Types

  • See "Upgrading from 0.13", 1 to 4 and 6. DataGridLegacySortProps gains items?: undefined; TeachingPopoverLabels gains nav and navButton; typeof Overflow, typeof DataGrid, typeof Table and typeof TeachingPopover gain members.
  • Dev gates: verify-dist probes that an import of only createTableColumn holds no table component, and an import of only one breadcrumb helper no Breadcrumb, Menu or Overflow module, and neither any React module; its module-only list gains the seams the tables share, the Overflow store and TeachingPopover's root, context and surface. The steps form's markup is pinned in the TeachingPopover suite.

Deprecated

  • DataGridColumn.id: use columnId. It is read only when columnId is missing, with a development warning once.
  • Notice: Done stops calling onDismiss in 1.0 (use onFinish), and the optional details arguments added in 0.14 (onOverflowChange, onSortChange, onSelectedItemsChange, Table.SelectionCell onCheckedChange) become required, unchanged; WaveUI always passes them.

Size

Not re-measured for 0.14: the additions are new props and parts of six components and five helpers, all tree-shakeable (the verify-dist helper probes show that an import of only createTableColumn, or of only one breadcrumb helper, holds no component and no React module).