From a9fccbde0f124853d58ba59d35f411130a2bbd2a Mon Sep 17 00:00:00 2001 From: Robert Snow Date: Fri, 27 Feb 2026 19:24:52 -0600 Subject: [PATCH] feat(S2): S2 ListView (#8878) * feat: s2 ListView * Explore highlight selection * fix docs type check * Add highlight selection option b to table * Add highlight selection option b to ListView * change selection behaviour of table for highlight mode * add option D as highlightMode * change font weight to bold for highlight selection * update background color * Start new highlight selection prototypes, ListView and part of TreeView * fix lint * update styles for listview and treeview * tableview * design updates * fix colors and add disabled items * fix lint * initialize docs * fix edgeToText import * update ListView (loadingMore, actionmenu, empty state, checkbox) * match selection styles to treeview/tableview * docs improvements * add jsdoc * support hasChildItems chevron * add stories * add hasChildItems example to docs * fix overflow in empty state * use objectFit: 'cover' for images * vertically align icons * add overflowMode * audit props * codemods * add chromatic stories * lint * add ListView testing docs * fix types * docs types * add description for search menu * docs types * fix selection checkbox visibility (always hide if disabled) * remove highlightMode prop * remove Tree/Table selection changes * remove unrelated Picker change * remove press scaling * keep bottom border width static to avoid 1px shift when highlight selection occurs. * add remaining states to chromatic * remove ListViewLoadMoreItem * fix prop types * update migration guide * remove bottom border radius for last item * prop types * remove style props from list item * remove seam mask element in favor of extending row background * make docs example wide * update docs content * add ActionBar support * fix gap for checkbox selection * docs update * style updates * remove renderer context * merge selection for checkbox selection * update docs * add LinkOut icon for links that open in new tab * fix storybook stories * add example to ActionBar docs * reserve space for trailing icon if at least one row has one * add padding to loading spinner * separate the icon and thumbnail slots examples in docs * docs types * move check image into chromatic folder * export ListViewContext from index.ts * cleanup story * use icons in all items in navigation docs * remove unused shorthands from macro theme * refactor to move isPrevSelected, isNextSelected, etc. logic out of GridList. * fix last item bottom border styles * pass id instead of item through render props (matches Table) * fix border styles * add explicit bottom border width --------- Co-authored-by: Reid Barber --- .storybook-s2/docs/Migrating.jsx | 7 + .../s2/chromatic/ListView.stories.tsx | 255 ++++++ .../@react-spectrum/s2/chromatic/check.tsx | 2 + packages/@react-spectrum/s2/src/ListView.tsx | 791 ++++++++++++++++++ packages/@react-spectrum/s2/src/index.ts | 2 + .../s2/stories/ListView.stories.tsx | 583 +++++++++++++ packages/dev/codemods/src/s1-to-s2/UPGRADE.md | 6 + .../__snapshots__/imports.test.ts.snap | 6 +- .../__snapshots__/listview.test.ts.snap | 21 + .../multi-collection.test.ts.snap | 7 +- .../src/s1-to-s2/__tests__/imports.test.ts | 6 +- .../src/s1-to-s2/__tests__/listview.test.ts | 25 + .../__tests__/multi-collection.test.ts | 7 +- .../src/codemods/components/Item/transform.ts | 2 + .../codemods/components/ListView/transform.ts | 13 + .../src/codemods/shared/transforms.ts | 6 +- packages/dev/s2-docs/pages/s2/ActionBar.mdx | 56 ++ packages/dev/s2-docs/pages/s2/ListView.mdx | 396 +++++++++ .../dev/s2-docs/pages/s2/ListView/testing.mdx | 81 ++ packages/dev/s2-docs/pages/s2/migrating.mdx | 6 + packages/dev/s2-docs/pages/s2/testing.mdx | 1 + .../react-aria-components/src/GridList.tsx | 13 +- 22 files changed, 2269 insertions(+), 23 deletions(-) create mode 100644 packages/@react-spectrum/s2/chromatic/ListView.stories.tsx create mode 100644 packages/@react-spectrum/s2/chromatic/check.tsx create mode 100644 packages/@react-spectrum/s2/src/ListView.tsx create mode 100644 packages/@react-spectrum/s2/stories/ListView.stories.tsx create mode 100644 packages/dev/codemods/src/s1-to-s2/__tests__/__snapshots__/listview.test.ts.snap create mode 100644 packages/dev/codemods/src/s1-to-s2/__tests__/listview.test.ts create mode 100644 packages/dev/codemods/src/s1-to-s2/src/codemods/components/ListView/transform.ts create mode 100644 packages/dev/s2-docs/pages/s2/ListView.mdx create mode 100644 packages/dev/s2-docs/pages/s2/ListView/testing.mdx diff --git a/.storybook-s2/docs/Migrating.jsx b/.storybook-s2/docs/Migrating.jsx index 253e46f6080..76c44aa0fd7 100644 --- a/.storybook-s2/docs/Migrating.jsx +++ b/.storybook-s2/docs/Migrating.jsx @@ -259,6 +259,7 @@ export function Migrating() {
  • If within Picker: Update Item to be a PickerItem
  • If within ComboBox: Update Item to be a ComboBoxItem
  • If within ListBox: Update Item to be a ListBoxItem
  • +
  • If within ListView: Update Item to be a ListViewItem
  • If within TabList: Update Item to be a Tab
  • If within TabPanels: Update Item to be a TabPanel and remove surrounding TabPanels
  • Update key to be id (and keep key if rendered inside array.map)
  • @@ -275,6 +276,12 @@ export function Migrating() {
  • Update Item to be a ListBoxItem
  • +

    ListView

    + +

    Menu