-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add Support for customTarget in MultiSelect Component #6915
Conversation
Generate changelog in
|
finish featureBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
clean up PRBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
focus on openingBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
// offset the padding added by the multiselect component so menu can remain full width with padding on either side | ||
// this is important so menu dividers can be full width, and so that menu items can have padding to the left and right | ||
// for menu items | ||
margin-left: -$select-padding; | ||
margin-right: -$select-padding; |
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 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.
we may need to test with enabling the scrollbar to always be visible in your device settings - we had an issue recently related to this which I fixed here: #6804
though it looks like you're doing the same thing as Select so I expect this to be good
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.
Add generated changelog entriesBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
…print into dkim/custom-target-popover
Merge branch 'dkim/custom-target-popover' of github.com:palantir/blueprint into dkim/custom-target-popoverBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
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 good! leaving some initial comments for now
// offset the padding added by the multiselect component so menu can remain full width with padding on either side | ||
// this is important so menu dividers can be full width, and so that menu items can have padding to the left and right | ||
// for menu items | ||
margin-left: -$select-padding; | ||
margin-right: -$select-padding; |
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.
we may need to test with enabling the scrollbar to always be visible in your device settings - we had an issue recently related to this which I fixed here: #6804
though it looks like you're doing the same thing as Select so I expect this to be good
{/* If customTarget is provided, TagInput is not rendered. This loses the search input. | ||
To account for this, render the search input within the popover similar to Select. | ||
|
||
Clearing all items is still possible since this component is controlled. It just not cannot | ||
be through the default button in this component, rather done through a custom button that can be | ||
rendered from within the popover through the itemListRenderer or from externally. */} | ||
{this.props.customTarget != null && input} |
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.
highlighting this as a TODO - let's catch up on this once everything else is looking good
update testsBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
address PR commentsBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
lint and update testBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
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.
main focus here on key event handlers/keyboard nav support and updating docs - a few of these comments are just notes not to action now so keep an eye out for that
packages/docs-app/src/examples/select-examples/multiSelectExample.tsx
Outdated
Show resolved
Hide resolved
// offset the padding added by the multiselect component so menu can remain full width with padding on either side | ||
// this is important so menu dividers can be full width, and so that menu items can have padding to the left and right | ||
// for menu items | ||
margin-left: -$select-padding; | ||
margin-right: -$select-padding; |
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.
…print into dkim/custom-target-popover
typoBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
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.
almost there 😄
// Cannot rely on input to determine popover state as the input will be inside the Popover | ||
// if customTarget is provided |
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.
// Cannot rely on input to determine popover state as the input will be inside the Popover | |
// if customTarget is provided |
I think this comment only makes sense right now if you assume relying on the input is the "correct" way - I don't think we need to explain handling this separately. If anything the input focus handling could be explained, but I'd rather not just slap a comment on there now since we may miss some nuance about why it was done that way.
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.
sounds good!
remove commented codeBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
disable open on keydown for customTargetBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Small visual nitpick: The box shadow on the shadow.cutoff.mov |
packages/docs-app/src/examples/select-examples/multiSelectExample.tsx
Outdated
Show resolved
Hide resolved
add margin bottom for box shadowBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
@@ -303,7 +304,7 @@ export class MultiSelect<T> extends AbstractPureComponent<MultiSelectProps<T>, M | |||
ref, | |||
role: "combobox", | |||
}, | |||
this.props.customTarget != null ? this.props.customTarget : this.getTagInput(listProps), | |||
this.props.renderTarget != null ? this.props.renderTarget(targetProps) : this.getTagInput(listProps), |
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 don't think we want to pass targetProps
since we're already wrapping the custom target in an element that is handling spreading those.
I think the idea is to have a renderTarget
callback that is passed selectedItems
to ensure we always are rendering an up to date target. We could also use that callback to pass anything else that could be helpful, such as passing isOpen
if the user would want to style differently based on that without separately keeping track of the loading state.
update testsBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
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 it may be better to revert before the last change and keep the customTarget
naming, while still updating the API style per last comment. The comment was to create a renderTarget
style API, but I'm not sure we actually want to reuse that name since we won't be threading through the props that are on Popover
s renderTarget
which may be unexpected given the name.
packages/docs-app/src/examples/select-examples/multiSelectCustomTarget.tsx
Outdated
Show resolved
Hide resolved
ff3bc18
to
6af45db
Compare
add margin bottom for box shadowBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
revert to name customTargetBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
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.
thanks for the great contribution and working through a few changes in direction and getting some tests added!
Checklist
Changes proposed in this pull request:
Reviewers should focus on:
customTarget
. Recognize we will lose the clear all button if customTarget is enabled. Can possibly look into this as a followup, but will need some design brainstorming to come up with a suitable location for this button within the PopoverScreenshot