feat: Action Bar#797
Open
tanugarg04 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds ChartActionBar as a new child component for Line charts in the S2 package. When a user clicks a data point, a floating contextual toolbar appears near that point with user-defined action buttons. The bar supports overflow truncation (actions beyond available space collapse into a ··· panel), drag-to-reposition, and an emphasized visual style via isEmphasized.
New public API:
— render-null stub accepted as a child of
children: (datum, close) => ReactElement[] — render function receiving the clicked datum and a close callback
isEmphasized?: boolean — accent background with white icon treatment, matching the RS ActionBar emphasized style
maxActions?: number — hard cap on inline actions before overflow (default 4; space is the primary driver)
onClearSelection?: () => void — called when the bar is dismissed
Behavior:
Interactive behavior (selection ring, hover signals, clear-on-close) mirrors ChartPopover
If both ChartActionBar and ChartPopover are children of the same Line, a runtime warning is emitted and the ChartActionBar takes precedence for left-click. A right-click ChartPopover can coexist
Bar is draggable so users can reposition it if it overlaps content
Related Issue
N/A — new feature scoped to the S2 package (@spectrum-charts/react-spectrum-charts-s2)
Motivation and Context
Charts often need contextual actions tied to a selected data point (annotate, comment, export). The existing ChartPopover handles arbitrary content but requires the user to build their own action layout. ChartActionBar provides a purpose-built, accessible toolbar pattern that matches the Spectrum 2 design — floating near the point, space-aware, and dismissible.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: