-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Remove AutoSizeInput #4625
Remove AutoSizeInput #4625
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e89e86d:
|
May consider addition suggested in #4513 to remove any boxShadow |
Please note @rosskhanas that this also addresses #4435 by using the shorthand css style |
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 @ebonow!
react-autosize-input
is a mono-repo that is maintained specifically for react-select. Not only does this add extra complexity and code weight, but it is also at the root of several issues. Additionally, it adds one extra layer of DOM complexity for users to access the DOM input.✅ Solution:
This proposal is to completely remove the AutoSizeInput component and replace it with a 100% pure CSS solution. Heavily inspired by this codepen example by Shaw found via this CSS Tricks article
💪 How it works:
The wrapper component now is styled as an inline-grid component with a pseudo :after element. This pseudo element has the content of the
data-value
attribute of the wrapper and occupies the same cell as the input causing it to expand as needed without javascript needing to copy and calculate new widths as the value changes. An early codesandbox example of this can be seen here.👍🏽 Features:
prefix__input-container
) and input (prefix__input
)inputClassName
was added as a new prop to the Input component to make it easy to style components via classNames (hello Tailwind)👎🏽 Breaking Changes:
.prefix__input
now targets the input and NOT the container. Unfortunate but overdue and perhaps opens the door to completely decoupling the input from needing a container if autosizing is not important.