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

🪟 New <TagInput /> #17760

Merged
merged 19 commits into from
Oct 14, 2022
Merged

🪟 New <TagInput /> #17760

merged 19 commits into from
Oct 14, 2022

Conversation

teallarson
Copy link
Contributor

@teallarson teallarson commented Oct 7, 2022

What

closes #10985

  • Implements a react-select <CreatableSelect/>
  • Adds custom functionality so users can type a comma or semicolon separated list, use tab or enter, or copy/past a comma or semicolon separated list

NOTE: For this iteration, we will not be implementing using a newline character as a delimiter due to HTML input elements stripping newline characters.

How

The Control component houses the field and field value themselves, passing in an onChange function that updates the fieldValue when called. The TagInput uses the fieldValue to generate a list of Tags (each having an id, label, and value that are important for the internals of the component). When a user action triggers the creation of a New Tag (a comma, semicolon, tab, or enter), we call the onChange which updates the field value, which triggers the creation of a new Tag as well.

Recommended reading order

  1. TagInput.tsx
  2. Control.tsx
  3. TagInput.test.tsx

@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Oct 7, 2022
@teallarson teallarson marked this pull request as ready for review October 12, 2022 00:58
@teallarson teallarson requested a review from a team as a code owner October 12, 2022 00:58
@teallarson teallarson changed the title 🪟 Tag Input Improvements 🪟 New <TagInput /> Oct 12, 2022
@teallarson
Copy link
Contributor Author

Working on cleaning up failing tests, but ready for a look over!

@teallarson teallarson marked this pull request as draft October 12, 2022 16:23
name={name}
render={(arrayHelpers) => (
<Field name={name} defaultValue={property.default || []}>
{() => (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Formik says it's deprecating the render prop on Field

@teallarson teallarson marked this pull request as ready for review October 12, 2022 19:48
...provided,
maxWidth: "100%",
display: "flex",
background: `${styles.backgroundColor}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice trick to use not hard-coded values 👍

Copy link
Contributor

@dizel852 dizel852 left a comment

Choose a reason for hiding this comment

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

Overall - LGTM 👍
Also tested locally on create source page(Chrome and Firefox).
Found just one issue, but I guess it's not a real world case -
If user tries to paste the copied text with different delimiters:
One, two; three, four;
will be parsed as
image

Approved, but let's wait for another review

@teallarson teallarson merged commit d2d8989 into master Oct 14, 2022
@teallarson teallarson deleted the teal/tag-input-improvements branch October 14, 2022 16:24
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* WIP add creatable

* appease the compiler

* working on it

* more work

* adding and removing tags works

* handle delimiters

* component works, testing WIP

* mostly working, add tests

* cleanup tests

* styling of tag items

* note to self

* cleanup

* cleanup some more, delete old components

* update style exports and render method

* taginput into a describe block

* find the tag input in service form tests

* cleanup

* use simplified queryselector

* Update airbyte-webapp/src/components/ui/TagInput/TagInput.module.scss

Co-authored-by: Vladimir <[email protected]>

Co-authored-by: Vladimir <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve TagInput component
2 participants