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

Add Support for customTarget in MultiSelect Component #6915

Merged
merged 32 commits into from
Jul 25, 2024

Conversation

donghee214
Copy link
Contributor

@donghee214 donghee214 commented Jul 17, 2024

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

  • Support customTarget in MultiSelect, and use that as the target

Reviewers should focus on:

  • MultiSelect functionality is mostly retained even when using 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 Popover

Screenshot

image

@changelog-app
Copy link

changelog-app bot commented Jul 17, 2024

Generate changelog in packages/docs-app/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add Support for children in MultiSelect Component


Generate changelog in packages/select/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add Support for children in MultiSelect Component


Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

finish feature

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

clean up PR

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

focus on opening

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Comment on lines +20 to +24
// 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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this doesn't break anything with existing MenuDividers

Current State (without the negative margins and without popover-content padding):

Screenshot 2024-07-17 at 4 57 16 PM

New State (with the negative margins and with popover-content padding):

Screenshot 2024-07-17 at 4 56 38 PM

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving note for followup, this appears in Select as well - would rather just keep this consistent with Select for now and not try to change both in this PR


note 5px above and below scrollbar

this PR
Screenshot 2024-07-18 at 10 15 54 AM

current:
Screenshot 2024-07-18 at 10 15 50 AM

@donghee214 donghee214 marked this pull request as ready for review July 17, 2024 21:39
@svc-palantir-github
Copy link

Add generated changelog entries

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@palantir palantir deleted a comment from donghee214 Jul 17, 2024
@svc-palantir-github
Copy link

Merge branch 'dkim/custom-target-popover' of github.com:palantir/blueprint into dkim/custom-target-popover

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Copy link
Contributor

@evansjohnson evansjohnson left a 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

packages/docs-app/src/styles/_examples.scss Outdated Show resolved Hide resolved
Comment on lines +20 to +24
// 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;
Copy link
Contributor

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

Comment on lines 242 to 248
{/* 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}
Copy link
Contributor

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

@svc-palantir-github
Copy link

update tests

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

address PR comments

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

lint and update test

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Copy link
Contributor

@evansjohnson evansjohnson left a 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/styles/_examples.scss Show resolved Hide resolved
Comment on lines +20 to +24
// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving note for followup, this appears in Select as well - would rather just keep this consistent with Select for now and not try to change both in this PR


note 5px above and below scrollbar

this PR
Screenshot 2024-07-18 at 10 15 54 AM

current:
Screenshot 2024-07-18 at 10 15 50 AM

packages/select/test/multiSelectTests.tsx Show resolved Hide resolved
@donghee214 donghee214 changed the title Add Support for children in MultiSelect Component Add Support for customTarget in MultiSelect Component Jul 18, 2024
@svc-palantir-github
Copy link

typo

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Copy link
Contributor

@evansjohnson evansjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost there 😄

Comment on lines 361 to 362
// Cannot rely on input to determine popover state as the input will be inside the Popover
// if customTarget is provided
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good!

packages/select/test/multiSelectTests.tsx Show resolved Hide resolved
@svc-palantir-github
Copy link

remove commented code

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

disable open on keydown for customTarget

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@gluxon
Copy link
Contributor

gluxon commented Jul 24, 2024

Small visual nitpick: The box shadow on the <TagInput> is cut off by the solid white background of the list below. One way to fix this would be to add some spacing.

shadow.cutoff.mov

@svc-palantir-github
Copy link

add margin bottom for box shadow

Build artifact links for this commit: documentation | landing | table | demo

This 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),
Copy link
Contributor

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.

@svc-palantir-github
Copy link

update tests

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Copy link
Contributor

@evansjohnson evansjohnson left a 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 Popovers renderTarget which may be unexpected given the name.

@svc-palantir-github
Copy link

add margin bottom for box shadow

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

revert to name customTarget

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Copy link
Contributor

@evansjohnson evansjohnson left a 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!

@donghee214 donghee214 merged commit d51c90c into develop Jul 25, 2024
13 checks passed
@donghee214 donghee214 deleted the dkim/custom-target-popover branch July 25, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants