-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding ListView chromatic stories #3106
Conversation
Build successful! 🎉 |
/** | ||
* A slot to place the ActionGroup in. | ||
* @default 'actionGroup' | ||
*/ | ||
slot?: string |
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.
Not entirely sure if this slot
prop should be exposed, it all depends on our slot naming consistency and whether or not a ActionGroup could be placed in a slot other than actionGroup
. I fine with removing this for now and adding it back in when we have a need
Same applies for ActionMenu below
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.
makes sense, it should be here
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.
Where is this slot being used by ListView?
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.
This slot is used here:
react-spectrum/packages/@react-spectrum/list/src/ListViewItem.tsx
Lines 219 to 223 in 8445498
actionGroup: { | |
UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'], | |
isQuiet: true, | |
density: 'compact' | |
}, |
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.
hmmmmm.... we don't havre this on any other component (other than ones designed for this, e.g. Text)? Are we sure this is needed? When would you set the slot to something other than the default? Also doesn't appear to be used by this PR?
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.
Yeah, currently the default slot provided to ActionMenu/ActionGroup suffices for now, definitely isn't needed but was prompted by the ListView stories:
react-spectrum/packages/@react-spectrum/list/stories/ListView.stories.tsx
Lines 255 to 261 in 418e59b
<ActionGroup buttonLabelBehavior="hide" {...props} slot="actionGroup"> | |
<Item key="info"> | |
<Info /> | |
<Text>Info</Text> | |
</Item> | |
</ActionGroup> | |
<ActionMenu {...props} slot="actionMenu"> |
@@ -24,7 +24,7 @@ import {useMessageFormatter} from '@react-aria/i18n'; | |||
import {useSlotProps} from '@react-spectrum/utils'; | |||
|
|||
function ActionMenu<T extends object>(props: SpectrumActionMenuProps<T>, ref: FocusableRef<HTMLButtonElement>) { | |||
props = useSlotProps(props, 'actionmenu'); | |||
props = useSlotProps(props, 'actionMenu'); |
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.
Brings it in line with the slot naming convention set up by ActionGroup, ButtonGroup etc. None of our other components used this slot except for ListView so we should be fine changing it here
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.
fyi, this was the only reference i found in quarry for the 'actionmenu' slot https://git.corp.adobe.com/frontend/quarry/blob/9aa61397fad5f2b919d90bc67bad3c0fa5f3efbd/packages/%40quarry/inventory/src/views/list/ListViewItem.tsx#L103
you may want to double check me on that and make sure this is still safe
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.
Hm, I don't believe this change will affect them, if anything that should already be broken if they are relying on getting our ListViewItem class from the actionMenu slot: https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L224
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.
Oh never mind, that is a actionmenu
grid area not a slot so the above change doesn't affect it at all. The actionmenu
matches up with the ListView css grid area:
react-spectrum/packages/@react-spectrum/list/src/styles.css
Lines 230 to 231 in 8445498
"draghandle checkbox icon image content actions actionmenu chevron" | |
"draghandle checkbox icon image description actions actionmenu chevron" |
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.
LGTM
Do we have a chromatic build of these stories to look at? |
Chromatic: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=257 |
|
||
const meta: Meta = { | ||
title: 'ListView', | ||
component: ListView, | ||
parameters: { | ||
chromaticProvider: {colorSchemes: ['light', 'dark'], locales: ['en-US'], scales: ['medium', 'large'], disableAnimations: true}, |
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.
did it just extend too far to do lightest and darkest?
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.
yeah, would mean more story splitting for performance. I'm beginning to think that perhaps we should have a separate story per combo, might be a lot though
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.
Looking at storybookjs/storybook#9828, doesn't seem to be a great way to do this w/o going back to the storiesOf api. I'm leaning towards keeping this PR as is since we are looking to upgrade our storybook version and waiting for overflowMode to go in so we can get a relatively stable set of combinations per story (otherwise any changes to the power set will result in a difficult to comprehend diff).
|
||
export default meta; | ||
|
||
export { |
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.
nice, love this
/** | ||
* A slot to place the ActionGroup in. | ||
* @default 'actionGroup' | ||
*/ | ||
slot?: string |
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.
makes sense, it should be here
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.
LGTM
{name: 'row 1'}, | ||
{name: 'row 2'}, | ||
{name: 'row 3'} | ||
// TODO: add overflow mode and thumbnails when those PRs are merged |
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.
should this be documented in github as an issue or project task instead of a todo?
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.
sure, will add if this goes in before those PRs
// TODO: add overflow mode and thumbnails when those PRs are merged | ||
let states = [ | ||
{isQuiet: true}, | ||
// No visual difference between single and multiple |
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.
Shouldn't we have a story with selectedKeys
and then we'd need multiple selection to see how that looks?
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.
The story already has selectedKeys with multiple selected, though this should probably be {selectionMode: 'multiple'},
rather than 'single. Unlike TableView where
singleand
multiple` will either hide/display the select all checkbox, ListView doesn't have this distinction and thus we don't need to have both selection modes in the power set
/** | ||
* A slot to place the ActionGroup in. | ||
* @default 'actionGroup' | ||
*/ | ||
slot?: string |
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.
Where is this slot being used by ListView?
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
latest Chromatic build: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=261
but that was problematic w/ RTL support. Will need to refactor with changes to https://github.com/adobe/react-spectrum/blob/main/.chromatic/custom-addons/chromatic/index.js to properly support RTL + certain theme and size combos which may change a bunch of stories so will be followup |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
Look at the chromatic tests for ListView and confirm behavior
🧢 Your Project:
RSP