feat: configurable DateRange presets
Description
closes #1855 closes #1909
Changes:
- Added
presetsFnprop inDateRangecomponent. This is callback function to generate custom presets. - Added a subsection for
presetsFnin Docs. Docs Link - Corrected PropListing's
defaultValueprop name in docs. - Added test case in example project for testing.
Checklist
- [ ] For UI or styling changes, I have added a screenshot or gif showing before & after
- [x] I have added a changeset
- [x] I have added to the docs where applicable
- [ ] I have added to the VS Code extension where applicable
🦋 Changeset detected
Latest commit: 3cd1ad3d4679fe71977f5d6ac15067a5f982e1dc
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 5 packages
| Name | Type |
|---|---|
| @evidence-dev/core-components | Minor |
| my-evidence-project | Minor |
| @evidence-dev/components | Minor |
| @evidence-dev/evidence | Major |
| evidence-test-environment | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Deploy Preview for next-docs-evidence ready!
| Name | Link |
|---|---|
| Latest commit | 3cd1ad3d4679fe71977f5d6ac15067a5f982e1dc |
| Latest deploy log | https://app.netlify.com/sites/next-docs-evidence/deploys/662450732f47fd000854bdfe |
| Deploy Preview | https://deploy-preview-1924--next-docs-evidence.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Deploy Preview for evidence-development-workspace ready!
| Name | Link |
|---|---|
| Latest commit | 3cd1ad3d4679fe71977f5d6ac15067a5f982e1dc |
| Latest deploy log | https://app.netlify.com/sites/evidence-development-workspace/deploys/66245073d955160008ef0ec3 |
| Deploy Preview | https://deploy-preview-1924--evidence-development-workspace.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Hey @AyushAgrawal-A2 thanks for this, after looking at some of the other requests coming in around the date picker, my preference is to do something string based, rather than exposing the underlying date functions themselves.
I think with a large list of presets, the option to exclude presets, the option to set a default, and potentially options for start and end dates we'll be able to cover most cases, and keep the API consistent with the mostly string based options we have in other components.
E.g. excludes={['7 Days', '14 Days']}, default='Year to Date'
I'm going to close this for now.
@mcrascal I realised without discussion, I will not achieve the best implementation which is in line with the product. I may have made similar mistakes in other PRs as well, sorry for wasting your time and thanks for reviewing my PRs.