Skip to content

Consolidate menu components - #8462

Merged
jonathanawesome merged 76 commits into
mainfrom
consolidate-components-2
Sep 10, 2026
Merged

Consolidate menu components#8462
jonathanawesome merged 76 commits into
mainfrom
consolidate-components-2

Conversation

@jonathanawesome

@jonathanawesome jonathanawesome commented Sep 10, 2026

Copy link
Copy Markdown
Member

This PR replaces @/components/ui/dropdown-menu with base/floating/menu, reworking that component to a data-driven API in the process, and adds a base/floating/tooltip built on Base UI. It removes the last menu implementation from the app along with the @radix-ui/react-dropdown-menu dependency: 36 files, +1745/-1293.

Stacked on #8345 (card consolidation).

Menus are now described, not composed

ui/dropdown-menu was a Radix wrapper used by 12 files (12 menus, 95 elements). base/menu already existed and wrapped @base-ui/react, but composed its rows from JSX in a sections array. Both are gone in favour of one component whose sections prop takes data:

<Menu
  trigger={<Button variant="ghost"><EllipsisIcon /></Button>}
  align="end"
  width="sm"
  sections={[
    { label: 'Options', items: [{ label: 'View details', onClick: view }] },
    [{ label: 'Delete', icon: Trash2, variant: 'destructiveAction', onClick: remove }],
  ]}
/>

There is no MenuItem to assemble by hand and no key to thread through. Each array in sections is a group and the component rules between them, so DropdownMenuSeparator becomes structure rather than an element. Falsy entries are dropped and an emptied section takes its separator with it, so a conditional row is just cond && { label: … }.

Seven entry kinds, each with its own preview so they are discoverable: action (the default, no kind), link, submenu, checkbox, toggle, radio and header.

New: base/tooltip

Built on Base UI, taking trigger and content with delay, disabled, arrow and the usual side/align props. Deliberately smaller than the other floating panels at text-xs and max-w-64, since a tooltip explains the surface it sits over and previously rendered larger than the menu it was attached to. Adopted in base/menu and base/stat-card; the 105 ui/tooltip call sites elsewhere are untouched and will be migrated in their own PR.

Fixes found along the way

  • Submenus grew horizontal scrollbars. Once overflow-y is not visible, the spec computes overflow-x to auto, so the vertical scrollbar's own width was enough to bring one on. Now explicitly overflow-x-hidden.
  • Long menus ran off screen rather than scrolling. Capped to the positioner's --available-height.
  • The date range picker's quick-ranges list had an unstyled scrollbar; now uses thin-scrollbar.

Smaller changes worth knowing

  • addOperation in the laboratory collections plugin takes a collectionId: string instead of reading e.currentTarget.dataset.collectionId off the event. Both call sites already had the id in scope; the DOM round-trip existed only because the old API had nowhere else to put it.
  • FloatingProps.trigger also accepts a render function, for the one case where another wrapper needs to own the same element. GraphiQLTooltip destructures only { children, align, side, sideOffset, label } and forwards nothing, so passing it as the trigger would swallow the menu's props.

@theguild-bot

theguild-bot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
hive 11.14.0-alpha-20260910231222-405352dcd34853fbae6c0efacbab321d60a08819 npm ↗︎ unpkg ↗︎

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tags: 11.14.0-alpha-405352d, 405352d, 405352dcd34853fbae6c0efacbab321d60a08819

@jonathanawesome
jonathanawesome marked this pull request as ready for review September 10, 2026 02:51
commit 4417211
Merge: b6fca46 fa60ae9
Author: Jonathan Brennan <jonathanawesome@users.noreply.github.com>
Date:   Thu Sep 10 07:46:01 2026 -0500

    Merge branch 'main' into card-component-consolidation

commit b6fca46
Author: Jonathan Brennan <jonathanawesome@users.noreply.github.com>
Date:   Thu Sep 10 06:40:55 2026 -0500

    strip unnecessary size prop

commit 9be9423
Author: Jonathan Brennan <jonathanawesome@users.noreply.github.com>
Date:   Thu Sep 10 06:39:05 2026 -0500

    remove stray console.log

commit 158aa44
Author: Jonathan Brennan <jonathanawesome@users.noreply.github.com>
Date:   Thu Sep 10 06:29:49 2026 -0500

    update type color for DocsNote, SubPageLayoutHeader; strip unnecessary props from layout components

commit fa60ae9
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Sep 10 12:54:26 2026 +0200

    chore(deps-dev): bump nodemailer from 9.1.0 to 9.1.1 (#8458)

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit 117b767
Author: Jonathan Brennan <jonathanawesome@users.noreply.github.com>
Date:   Wed Sep 9 17:02:47 2026 -0500

    revert env.template change
@jonathanawesome
jonathanawesome changed the base branch from main to card-component-consolidation September 10, 2026 13:56
Base automatically changed from card-component-consolidation to main September 10, 2026 19:26
Comment thread packages/web/app/src/components/base/floating/menu/menu.tsx
Comment thread packages/web/app/src/pages/target-laboratory.tsx Outdated
Co-authored-by: jdolle <1841898+jdolle@users.noreply.github.com>
@jonathanawesome
jonathanawesome merged commit 6489fc6 into main Sep 10, 2026
29 checks passed
@jonathanawesome
jonathanawesome deleted the consolidate-components-2 branch September 10, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants