-
Notifications
You must be signed in to change notification settings - Fork 564
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
ActionList Composable API #1517
Conversation
🦋 Changeset detectedLatest commit: 3cfc4f7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
This reverts commit 4d1cc22.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love where this is going ❤️ Amazing work, @siddharthkp!
Happy to move forward with what you have here. Left a few minor comments.
@@ -1,5 +1,6 @@ | |||
// @preval | |||
// This file needs to be a JavaScript file using CommonJS to be compatiable with preval | |||
// Cache bust: 2021-11-04 12:00:00 GMT (This file is cached by our deployment tooling, update this timestamp to rebuild this file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There has to be a better way of doing this, but I did not spend more than 5 minutes researching vercel's caching mechanism. So, this date will probably live here until we find a different way 😇
src/experiments.ts
Outdated
@@ -0,0 +1,2 @@ | |||
// Components | |||
export * from './ActionList2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of keeping experiments out of the main bundle. A couple of questions:
- If we want to build experimental components in primer, should we update the definition of "experimental" in this document? https://primer.style/contribute/component-lifecycle#experimental (defines "experimental" as built outside of Primer)
- Should we rename this file
experimental
to align with that document? ☝️ - When we release breaking changes to experimental components, which semver number should we bump?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, there's a name conflict here for sure.
In our component lifecycle maturity, components with experimental maturity can still be in the main bundle.
What I want to signal here is - this is a "unreleased" component that is not part of the public api yet (not in main bundle). We don't recommend using it in production yet. You can still import it with explicitly for experimentation/feedback.
alternate names: unreleased, next, future, private, internal
When we release breaking changes to experimental components, which semver number should we bump?
As these are outside the public API, they don't get a major/minor version bump with the assumption that only prototypes/experiments are using them and not continuously maintained applications. (mostly safe because prototypes/sandboxes have a locked version in time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: changed to unreleased
.
(next
was a close second, but that might get confused with npm tag primer/components@next
. future
is romantic, but i'd like to put long running things in this scope that might not make it to main bundle at all)
@pksjce thoughts for new Button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Useful to add, also added to PR description)
Why is ActionList2 in unreleased
instead of replacing the current ActionList with a breaking change?
While I'm confident about the API in this PR (by testing it A LOT 😇), I'd like to "release" these changes along with their composable counterparts ActionMenu and SelectPanel, so that the memex team can catch up with breaking API for Menus together.
This also gives us a change to tweak and polish the underlying ActionList to be accessible. The change is not code aesthetics, it's a more mature group of components ✨
Co-authored-by: Cole Bemis <colebemis@github.com>
/** | ||
* Primary content for an Item | ||
*/ | ||
children?: React.ReactNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to specifically define React.ReactNode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so 🤔 Added this here because that's what we say in the docs
New ActionList component, bundled in @primer/components/unreleased Co-authored-by: Jonathan Fuchs <jfuchs@github.com> Co-authored-by: Cole Bemis <colebemis@github.com>
Ready for review :)
Closes https://github.com/github/primer/issues/307 | Interface guidelines | Figma
Next: https://github.com/github/primer/issues/447 + https://github.com/github/primer/issues/448
See Docs for API surface area for ActionList
See Storybook for use cases as standalone and as List inside Menu/Select
API opinions worth noting:
Watch video instead
Prefer composition over config: See https://github.com/github/primer/issues/307 for long version
selectionVariant
forActionList
is null by default. Item makes no assumptions about what kind of selection to render if it is not set on the List root or GroupshowDividers
is onActionList
root, not eachActionList.Item
. Loosely held opinion, will test with memex. The Dividers are meant to add a separator between Items of the list and should be consistent in a given List and not customisable at the Item level.showDividers
cause confusion/conflict withActionList.Divider
?Added
ActionList.LinkItem
which uses an internal API withItem
to make sure we can give the semantics for free.Progressive improvements:
Questions:
Design
Bundling
ActionList2
in@primer/components/unreleased
While I'm confident about the API in this PR, I'd like to "release" these changes along with their composable counterparts ActionMenu and SelectPanel, so that the memex team can catch up with breaking API for Menus together. This also gives us a change to tweak and polish the underlying ActionList to be accessible. The change is not code aesthetics, it's a more mature group of components ✨
Accessibility questions moved to ActionList beta audit
Merge checklist