-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Replace flatpickr with custom spectrum date picker #13457
Conversation
… improve experience
…when being responsive to screen width
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 general, LGTM! Really solid upgrades for the popover positioning! Queries and some minor issues below.
Bug
- Context action menu in portal app list and app sidebar is squashing even after repositioning.
Nice - in general all action menus were prone to this. I've updated the core action menu component so that they'll never resize to fit (just reposition). |
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.
LGTM! 🚀
…wser API rather than navigator language
…validation error shape
Description
This PR removes our existing date picker (flatpickr) and replaces it with one built from scratch, adhering to the spectrum design system to match our other components.
The main motivation for this was to attempt to fix issues with dates and timezones that have been around far too long, but we'll need lots of testing to confirm whether we've fixed those issues or not.
The new date picker has pretty much an identical API to the old one, with 2 small differences:
range
prop has been removed. The places we used range pickers were backups and audit logs, so I've added a new date range picker dedicated component for these use cases.Parsing updates
I think I've resolved some issues where date only fields were being displayed as the day before, when used in combination with a timezone field in an external database. More testing will be needed to confirm, but I believe it's fixed.
I've also pulled out this parsing into an external util so other components can benefit from it (e.g. when being displayed inside grids).
Screenshots
Date + time
Date only
Repositioning as required
Theme support
Date range picker
A simple component which just combines 2 date pickers. It intelligently will set the first date to the start of the day, and the last date to the end of the day. Setting either will automatically set both, and clearing either will clear both. Setting the start date to after the end date, or the end date before the start date, will update the dates according to maintain proper order. As mentioned before, this is only used for audit log and backup filtering.
Grid updates
I've refactored significant portions of the grid so that it now supports overflow. There was a major restriction before that content could not overflow outside of the grid bounds, and this caused a few issues (e.g. the new row buttons are rendered on top of popovers) and other things users have complained about (e.g. large padding required at the bottom of the grid internally) and just other limitations (a very large minimum height was required).
My changes here allow popovers within the grid to overflow, solving those issues completely.
Full list of changes:
.
The min height is now just enough to allow the new row component to be properly displayed:
A few repositioning examples:
Rendering below when space allows:
Rendering centered beside the cell when there isn't room below:
Locked to screen bottom edge and positioned to the side, when no room to center align beside:
Locale awareness
The new date picker will display dates according to the user's locale.
en-GB
locale (UK) usingDD/MM/YYYY
:en-US
locale (USA) usingM/D/YYYY
:de-DE
locale (Germany) usingD.M.YYYY
:ko-KR
locale (Korea) usingyyyy. M. d
:Addresses
Launchcontrol
Replaced date picker with a new and improved spectrum-themed date picker.
Feature branch env
Feature Branch Link