Skip to content
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

Date picker renamed to date picker input #106

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/datepicker/columns.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

component = dmc.Stack(
[
dmc.DatePicker(
dmc.DatePickerInput(
value=datetime.now().date(),
label="Date not clearable",
w=200,
),
dmc.DatePicker(
dmc.DatePickerInput(
value=datetime.now().date(),
label="Date clearable",
w=200,
Expand Down
3 changes: 3 additions & 0 deletions docs/datepickerinput/columns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import dash_mantine_components as dmc

component = dmc.DatePickerInput(w=250, type="range", numberOfColumns=2)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: DatePicker
name: DatePickerInput
description: Date, multiple dates and dates range picker input. Helps you easily switch between different months, years along with locale support.
endpoint: /components/datepicker
endpoint: /components/datepickerinput
package: dash_mantine_components
category: Date Pickers
---
Expand Down Expand Up @@ -32,56 +32,56 @@ app = Dash(external_stylesheets=dmc.styles.ALL)

### Simple Example

This is a simple example of DatePicker tied to a callback. You can either use strings in a valid datetime format such
This is a simple example of `DatePickerInput` tied to a callback. You can either use strings in a valid datetime format such
as `YYYY-MM-DD` or use the date object from datetime library.

> If you would like to enable the user to type a date manually into the input field, please use the `DateInput` component

.. exec::docs.datepicker.simple
.. exec::docs.datepickerinput.simple

### Multiple dates

Set type="multiple" to allow user to pick multiple dates. Note that `value` is a list.

.. exec::docs.datepicker.multiple
.. exec::docs.datepickerinput.multiple

### Dates range

Set type="range" to allow user to pick dates range. Note that `value` is a list.

.. exec::docs.datepicker.range
.. exec::docs.datepickerinput.range

### Open picker in modal

By default, DatePicker is rendered inside Popover. You can change that to Modal by setting dropdownType="modal"
By default, `DatePickerInput` is rendered inside `Popover`. You can change that to `Modal` by setting `dropdownType="modal"`

.. exec::docs.datepicker.modal
.. exec::docs.datepickerinput.modal

### Number of columns

.. exec::docs.datepicker.columns
.. exec::docs.datepickerinput.columns

### Value format

Use `format` property to change the format of the date displayed in the date input field.

.. exec::docs.datepicker.formats
.. exec::docs.datepickerinput.formats

Use `valueFormat` prop to change [dayjs format](https://day.js.org/docs/en/display/format) of value label.

### Clearable

Set `clearable=True` prop to display clear button in the right section. Note that if you set `rightSection` prop, clear button will not be displayed.

.. exec::docs.datepicker.clearable
.. exec::docs.datepickerinput.clearable

### Error Display

You can convey errors in your date picker by setting the `error` prop. For instance, in the below example we try to
convey the user that it's a required field and the date can't be an odd date. Since it's a required field, we also
set `clearable=False`.

.. exec::docs.datepicker.errors
.. exec::docs.datepickerinput.errors

### Localization

Expand Down Expand Up @@ -124,6 +124,6 @@ For information on setting locale, have a look at the [DatesProvider](/component

### Keyword Arguments

#### DatePicker
#### DatePickerInput

.. kwargs::DatePicker
.. kwargs::DatePickerInput
6 changes: 3 additions & 3 deletions docs/datepicker/errors.py → docs/datepickerinput/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import dash_mantine_components as dmc
from dash import Output, Input, callback

component = dmc.DatePicker(
id="datepicker-error",
component = dmc.DatePickerInput(
id="datepickernput-error",
value=datetime.now().date(),
label="Date",
required=True,
Expand All @@ -13,7 +13,7 @@
)


@callback(Output("datepicker-error", "error"), Input("datepicker-error", "value"))
@callback(Output("datepickerinput-error", "error"), Input("datepickerinput-error", "value"))
def datepicker_error(date):
day = datetime.strptime(date, "%Y-%M-%d").day
return "Please select an even date." if day % 2 else ""
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
component = dmc.Group(
gap="xl",
children=[
dmc.DatePicker(
dmc.DatePickerInput(
value=datetime.now().date(),
valueFormat="ddd, MMM D YY",
label="ddd, MMM D YY",
w=200,
),
dmc.DatePicker(
dmc.DatePickerInput(
value=datetime.now().date(),
valueFormat="MMMM DD, YY",
label="MMMM DD, YY",
w=200,
),
dmc.DatePicker(
dmc.DatePickerInput(
value=datetime.now().date(),
valueFormat="DD-MM-YYYY",
label="DD-MM-YYYY",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dash_mantine_components as dmc

component = dmc.DatesProvider(
dmc.DatePicker(id="fr-date-picker-input", w=200, label="Sélectionner une date"),
dmc.DatePickerInput(id="fr-date-picker-input", w=200, label="Sélectionner une date"),
settings={"locale": "fr"},
)
2 changes: 1 addition & 1 deletion docs/datepicker/modal.py → docs/datepickerinput/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dash_mantine_components as dmc

component = dmc.DatePicker(
component = dmc.DatePickerInput(
value=datetime.now().date(),
dropdownType="modal",
w=200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

component = html.Div(
[
dmc.DatePicker(
dmc.DatePickerInput(
id="date-picker-input-multiple",
label="Pick dates",
description="Pick one or more dates",
Expand Down
2 changes: 1 addition & 1 deletion docs/datepicker/range.py → docs/datepickerinput/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

component = html.Div(
[
dmc.DatePicker(
dmc.DatePickerInput(
id="date-input-range-picker",
label="Date Range",
description="Select a date range",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

component = html.Div(
[
dmc.DatePicker(
dmc.DatePickerInput(
id="date-picker-input",
label="Start Date",
description="You can also provide a description",
Expand Down
13 changes: 12 additions & 1 deletion docs/migration/migration.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
---
name: Migration Guide 0.12 to 0.14
name: Migration Guide
endpoint: /migration
description: This page helps you migrate from an old version to a newer version of Dash Mantine Components
dmc: false
---

.. toc::

## Migrating from 0.14 to 0.15

The `DatePicker` component has been renamed to `DatePickerInput` to align with the component names of the upstream
Mantine Library. We plan to add the Mantine [`DatePicker`](https://mantine.dev/dates/date-picker/) component in a future release.

We still expect far fewer breaking changes going forward compared to what you may have experienced in the past. For more details, please see our [Roadmap](https://github.com/snehilvj/dash-mantine-components/discussions/377).


## Migrating from 0.12 to 0.14

### Backstory

There are many breaking changes going from DMC `v0.12` to DMC `v0.14`. The major reason behind this was we jumped from
Expand Down Expand Up @@ -88,6 +98,7 @@ app = Dash(__name__, external_stylesheets=dmc.styles.ALL)

- `Chip` and `ChipGroup` components are not working as expected when ported over in dash. It will be worked on as part of subsequent releases.
- `TransferList` is no longer available. You might benefit from [AIO based TransferList component](https://community.plotly.com/t/dash-mantine-components-0-14-1/83865/18?u=snehilvj) created by a community member.
**update** `Chip` and `ChipGroup` are available as of 0.14.6

### Creatable option in Select and MultiSelect

Expand Down