-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(date-range-picker): fixed input overflow #3076
base: canary
Are you sure you want to change the base?
Changes from all commits
8dbb37a
868d60a
cbd4c38
8303698
d191b82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@nextui-org/date-picker": patch | ||
--- | ||
|
||
Fix input overflow in date-range-picker |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,6 +294,7 @@ export function useDateRangePicker<T extends DateValue>({ | |
style: { | ||
...props.style, | ||
maxWidth: "fit-content", | ||
flexShrink: 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider a more comprehensive solution for the overflow issue While adding Instead, consider implementing a more robust solution that addresses the root cause of the overflow:
Here's a potential implementation: -style: {
- ...props.style,
- maxWidth: "fit-content",
- flexShrink: 0,
-},
+style: {
+ ...props.style,
+ maxWidth: "100%",
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+},
+wrapperStyle: {
+ display: "flex",
+ overflow: "auto",
+ maxWidth: "100%",
+}, Then, in the component that uses these props, wrap the inputs in a div with the This approach would allow the date text to truncate when necessary, while still providing a scrollable interface for users to see the full date if needed. Would you like assistance in implementing this solution across the component?
|
||
}, | ||
className: dateInputSlots.input({ | ||
class: clsx(classNames?.input, props?.className), | ||
|
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.
do we have to set it here instead of
packages/core/theme/src/components/date-input.ts
?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.
I have set it here as there was no slot just for
start-input
.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.
Regarding the scrolling, could we wrap the
start-input
andend-input
inside adiv
? So that we could achieve something like thisThere 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.
just a few lines below
I think it's fine. We should only scroll the input. The scrollbar can look better tho.
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.
I guess we might not need
flexShrink: 0
as we are adding a scrollbar.If we dont add a
div
wrapper then the completeinput-wrapper
will be scrolled and by default the calendar button is not visible, we need to scroll to press the calendar button.I have used the default scrollbar like the components
Table
orScrollShadow
.Is their a custom scrollbar already present or do you want to me implement one?
Apart from the default scrollbar, the only scrollbar i found being used in the project is the below one? Do you want to me make use of this?
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.
use the default scrollbar first. we may refactor later.
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.
I guess we might need to increase the height of the component or customize the height of the scrollbar as just applying scrollbar hides the input as shown below:-
Do you want me to increase the height? If yes could you tell me the values to which i need to increase?
Currently the
innerWrapper
height is seth-6
and the size of theinputWrapper
ish-8
h-10
h-12
for sizesm
md
&lg
respectively.Or should we create a custom scrollbar so that it could be used in other places and consistency is maintained?
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.
i think not. the height shouldn't be changed.
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.
If the height is not changed then the text will not be visible.
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.
the scrollbar shouldn't look like this. may double check with other pages. I rmb it was quite thin.