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

feat: make input field clearable and add prefix icon #1619

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

d-rita
Copy link
Contributor

@d-rita d-rita commented Oct 14, 2024

Implements LIBS-699

@d-rita d-rita requested a review from a team as a code owner October 14, 2024 14:11
@dhis2-bot
Copy link
Contributor

dhis2-bot commented Oct 14, 2024

🚀 Deployed on https://pr-1619--dhis2-ui.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify October 14, 2024 14:15 Inactive
}

.input-clearable input {
padding-right: 30px;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
padding-right: 30px;
padding-inline-end: 30px;

@d-rita d-rita requested a review from Birkbjo October 15, 2024 16:41
@dhis2-bot dhis2-bot temporarily deployed to netlify October 15, 2024 16:44 Inactive
@@ -90,6 +97,10 @@ const InputFieldProps = {
/** The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) */
autoComplete: PropTypes.string,
className: PropTypes.string,
/** function to clear the input value */
clearText: PropTypes.func,
Copy link
Member

Choose a reason for hiding this comment

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

@d-rita do we need a separate callback function for this? I think it might be possible to just call setValue('')? Maybe there are cases when you want to reset it to the default value... but that could be handled by the setValue callback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the Input component, I could use the onChange handler that we pass in to update value to an empty string. Then within the parent component where this InputField is being used, the onChange handler (which uses the setValue) can update the value accordingly. If there is a defaultValue, that can also be set within there.

@dhis2-bot dhis2-bot temporarily deployed to netlify October 16, 2024 11:04 Inactive
@d-rita d-rita requested a review from a team October 17, 2024 08:57
@d-rita d-rita removed the request for review from Birkbjo November 13, 2024 14:28
@d-rita d-rita enabled auto-merge (squash) November 13, 2024 15:12
@d-rita d-rita merged commit 7f87fb4 into master Nov 18, 2024
16 checks passed
@d-rita d-rita deleted the LIBS-699/clearable-input-and-prefix-icon branch November 18, 2024 12:15
dhis2-bot added a commit that referenced this pull request Nov 18, 2024
# [9.15.0](v9.14.1...v9.15.0) (2024-11-18)

### Features

* make input field clearable and add prefix icon ([#1619](#1619)) ([7f87fb4](7f87fb4))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 9.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

dhis2-bot added a commit that referenced this pull request Nov 21, 2024
# [10.0.0-alpha.8](v10.0.0-alpha.7...v10.0.0-alpha.8) (2024-11-21)

### Bug Fixes

* peer dependency issue with npm publish ([#1628](#1628)) ([1319654](1319654))
* update calendar tests for react 18 ([98831a7](98831a7))
* update testing-library for selector-bar ([893024d](893024d))
* **translations:** sync translations from transifex (master) ([d89ce94](d89ce94))
* **translations:** sync translations from transifex (master) ([7f22330](7f22330))

### Features

* add data sharing to sharing dialog [LIBS-677] ([#1629](#1629)) ([7e15c7f](7e15c7f))
* make input field clearable and add prefix icon ([#1619](#1619)) ([7f87fb4](7f87fb4))
* update react peer dependency to react@18 ([#1624](#1624)) ([5d3c2a4](5d3c2a4))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 10.0.0-alpha.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants