-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
🚀 Deployed on https://pr-1619--dhis2-ui.netlify.app |
components/input/src/input/input.js
Outdated
} | ||
|
||
.input-clearable input { | ||
padding-right: 30px; |
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.
padding-right: 30px; | |
padding-inline-end: 30px; |
@@ -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, |
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.
@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?
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.
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.
# [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))
# [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))
Implements LIBS-699