evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
3.44k stars 167 forks source link

Date range default value #1988

Open Franreno opened 1 week ago

Franreno commented 1 week ago

Description

This PR aims to add a defaultValue parameter to the DateRange input component. The defaultValue has the purpose to define a default range when the component is first loaded.

To use is to simply add the defaultValue as below:

<DateRange 
    data={orders_by_month} 
    dates=month 
    name=range_default 
    defaultValue="Last 90 days"
/>

Then, the DateRange will initialize with the defaultValue provided

Screenshot 2024-05-08 at 19 14 02

If the parameter is not provided or does not comply with the labels available on the preset variable, then the component's behavior should be the same as previously

Screenshot 2024-05-08 at 19 13 52

Closes #1984

Checklist

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 7c65500be554f15de0f7ba36301d310b149294ff

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 | Patch | | @evidence-dev/components | Patch | | @evidence-dev/evidence | Patch | | my-evidence-project | Patch | | 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

netlify[bot] commented 1 week ago

Deploy Preview for evidence-development-workspace ready!

Name Link
Latest commit 7c65500be554f15de0f7ba36301d310b149294ff
Latest deploy log https://app.netlify.com/sites/evidence-development-workspace/deploys/66465ac9e1e1330008d1d70b
Deploy Preview https://deploy-preview-1988--evidence-development-workspace.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 1 week ago

Deploy Preview for evidence-test-env ready!

Name Link
Latest commit 7c65500be554f15de0f7ba36301d310b149294ff
Latest deploy log https://app.netlify.com/sites/evidence-test-env/deploys/66465ac99e56d700082314da
Deploy Preview https://deploy-preview-1988--evidence-test-env.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 1 week ago

Deploy Preview for next-docs-evidence ready!

Name Link
Latest commit 7c65500be554f15de0f7ba36301d310b149294ff
Latest deploy log https://app.netlify.com/sites/next-docs-evidence/deploys/66465ac9a01ee80008675ada
Deploy Preview https://deploy-preview-1988--next-docs-evidence.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.