Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create ActionList Component #1717

Open
Tracked by #1705
scurker opened this issue Oct 11, 2024 · 0 comments
Open
Tracked by #1705

Create ActionList Component #1717

scurker opened this issue Oct 11, 2024 · 0 comments
Labels
info needed rfc An issue proposing a new significant change
Milestone

Comments

@scurker
Copy link
Member

scurker commented Oct 11, 2024

ActionList is a primitive component that provides a list of options. It is intended to be a replacement for the existing OptionsMenuList component as a standalone component.

Related:

Implementation

Context

The action list state should be passed down to descendants via an ActionListContext that includes the current selection type:

type ActionListContext = {
  selectionType?: 'single' | 'multiple'
  onAction: (key: string, event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
}

This context can be provided to descendent components via a useActionList hook.

ActionList

The action list is a container element with no direct associated styles to primarily contain ActionListItem, ActionListLinkItem, ActionListSeparator or ActionListGroup components.

interface ActionList extends React.HTMLAttributes<HTMLUListElement> {

  children: Array<ActionListItem | ActionListLinkItem | ActionListGroup>

  /** Limits the amount of selections that can be made within an action list */
  selectionType?: 'single' | 'multiple'

  /** A callback function that is called when an action list item is selected. */
  onAction?: (key: string, event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;

}

Keyboard Behaviors

Important

TODO: Spec out keyboard behaviors, focus behaviors, etc. Are there existing utilities/patterns we can utilize from other Cauldron components?

@scurker scurker added the rfc An issue proposing a new significant change label Oct 11, 2024
@scurker scurker added this to the Q4 2024 milestone Oct 11, 2024
@scurker scurker changed the title Create ActionMenuList Component Create ActionList Component Oct 21, 2024
@scurker scurker added the rocket label Oct 25, 2024
@scurker scurker modified the milestones: Q4 2024, Future Nov 21, 2024
@scurker scurker removed the rocket label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info needed rfc An issue proposing a new significant change
Projects
None yet
Development

No branches or pull requests

1 participant