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

[RFC] Proposal for the future DX of the Date and Time Pickers #15613

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b303694
[RFC] WIP - Proposal for the future DX of the Date and Time Pickers
flaviendelangle Nov 26, 2024
014bcfb
Work
flaviendelangle Nov 26, 2024
e0a5abd
Work on Calendar doc page
flaviendelangle Nov 27, 2024
57abe01
Work on Calendar doc page
flaviendelangle Nov 27, 2024
496f03d
Work on Calendar doc page
flaviendelangle Nov 27, 2024
b283640
Work on Calendar doc page
flaviendelangle Nov 27, 2024
87542d7
Work on Calendar doc page
flaviendelangle Nov 27, 2024
053cba2
Work on Calendar doc page
flaviendelangle Nov 27, 2024
d1558b3
Work on picker page
flaviendelangle Nov 27, 2024
c905484
Work on picker page
flaviendelangle Nov 27, 2024
d43d5a7
Merge branch 'master' into rfc-base-ui
flaviendelangle Nov 28, 2024
9eeb952
Work on picker page
flaviendelangle Nov 28, 2024
84b532e
Work on picker page
flaviendelangle Nov 28, 2024
2d57352
Work on picker page
flaviendelangle Nov 28, 2024
ee6d5aa
Reorder sections
flaviendelangle Nov 28, 2024
fc9117c
Change imports to match Base UI nomenclature
flaviendelangle Nov 28, 2024
c848b58
Work on the picker page
flaviendelangle Nov 28, 2024
f5438ed
Work on the calendar page
flaviendelangle Nov 28, 2024
171b401
Merge branch 'master' into rfc-base-ui
flaviendelangle Nov 28, 2024
6fa0edf
Merge branch 'master' into rfc-base-ui
flaviendelangle Dec 3, 2024
b705092
Work
flaviendelangle Dec 3, 2024
137cdb8
Work
flaviendelangle Dec 3, 2024
7ba4bbd
Work
flaviendelangle Dec 3, 2024
3cfb572
Work
flaviendelangle Dec 3, 2024
a1c885d
Work
flaviendelangle Dec 3, 2024
71af8e1
Work
flaviendelangle Dec 3, 2024
353e309
Work
flaviendelangle Dec 3, 2024
4e4b0b4
Work
flaviendelangle Dec 3, 2024
290728b
Work
flaviendelangle Dec 3, 2024
58c2b6c
Work
flaviendelangle Dec 3, 2024
c3ff6e5
Work
flaviendelangle Dec 3, 2024
4d841da
Work
flaviendelangle Dec 3, 2024
d827538
Work
flaviendelangle Dec 3, 2024
ca07e38
Merge branch 'master' into rfc-base-ui
flaviendelangle Dec 4, 2024
1264c06
Work
flaviendelangle Dec 4, 2024
cc776ef
Merge branch 'master' into rfc-base-ui
flaviendelangle Dec 10, 2024
7a1f932
Work on the calendar
flaviendelangle Dec 10, 2024
b130e53
Work
flaviendelangle Dec 10, 2024
078a33a
Work
flaviendelangle Dec 10, 2024
6789e39
Work
flaviendelangle Dec 10, 2024
e6bf130
Merge branch 'master' into rfc-base-ui
flaviendelangle Dec 12, 2024
9229ec6
Fix
flaviendelangle Dec 12, 2024
0c0dd3b
Merge branch 'master' into rfc-base-ui
flaviendelangle Dec 13, 2024
1ffc905
Add examples of usage for utility components
flaviendelangle Dec 13, 2024
b0324d8
Merge branch 'master' into rfc-base-ui
flaviendelangle Dec 18, 2024
6d8b0e5
Merge branch 'master' into rfc-base-ui
flaviendelangle Dec 19, 2024
124c45f
Merge branch 'master' into rfc-base-ui
flaviendelangle Jan 2, 2025
899728e
Remove FormattedValue
flaviendelangle Jan 2, 2025
197f978
Fix
flaviendelangle Jan 2, 2025
7dcd1de
Merge branch 'master' into rfc-base-ui
flaviendelangle Jan 7, 2025
da1f4c2
Merge branch 'master' into rfc-base-ui
flaviendelangle Jan 7, 2025
ede2530
Apply changes from POC
flaviendelangle Jan 7, 2025
c60d96f
Work
flaviendelangle Jan 7, 2025
1ce91c8
Merge branch 'master' into rfc-base-ui
flaviendelangle Jan 17, 2025
cf949c7
Work
flaviendelangle Jan 17, 2025
50cf1cf
Fix
flaviendelangle Jan 20, 2025
861b0e9
Merge branch 'master' into rfc-base-ui
flaviendelangle Jan 21, 2025
787c31f
Sync with POC
flaviendelangle Jan 21, 2025
92249f8
Rename Calendar.DaysWeekRow => Calendar.DaysGridRow
flaviendelangle Jan 23, 2025
f2a6e7c
Merge remote-tracking branch 'origin/rfc-base-ui' into rfc-base-ui
flaviendelangle Jan 23, 2025
686953c
--amend
flaviendelangle Jan 23, 2025
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
1,004 changes: 1,004 additions & 0 deletions docs/data/date-pickers/rfc-calendar.md

Large diffs are not rendered by default.

470 changes: 470 additions & 0 deletions docs/data/date-pickers/rfc-digital-clock.md

Large diffs are not rendered by default.

426 changes: 426 additions & 0 deletions docs/data/date-pickers/rfc-field.md

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions docs/data/date-pickers/rfc-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
productId: x-date-pickers
title: DX - Overview
---

# Overview

<p class="description">This page describes the main principles of the new DX.</p>

## General principles

### Composition

All the components displayed in the pages below are following the Base UI DX which means:

Check failure on line 14 in docs/data/date-pickers/rfc-overview.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [MUI.MuiBrandName] Use a non-breaking space (option+space on Mac, Alt+0160 on Windows or AltGr+Space on Linux, instead of space) for brand name ('Base UI' instead of 'Base UI') Raw Output: {"message": "[MUI.MuiBrandName] Use a non-breaking space (option+space on Mac, Alt+0160 on Windows or AltGr+Space on Linux, instead of space) for brand name ('Base UI' instead of 'Base UI')", "location": {"path": "docs/data/date-pickers/rfc-overview.md", "range": {"start": {"line": 14, "column": 67}}}, "severity": "ERROR"}

- One component = one HTML element (except for elements like hidden `<input />`)

- Every component can receive a `render` prop to override the rendered element:

```tsx
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import { Calendar } from '@base-ui-components/react-x-date-pickers/calendar';

<Calendar.MonthsList render={<List />}>
{({ months }) =>
months.map((month) => (
<Calendar.MonthsCell
value={month}
key={month.toString()}
render={<ListItem />}
/>
))
}
</Calendar.MonthsList>;
```

This `render` prop can also accept a function that receives the `props` and the `state` of the component (equivalent of our `ownerState`):

Check warning on line 38 in docs/data/date-pickers/rfc-overview.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'our'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'our'.", "location": {"path": "docs/data/date-pickers/rfc-overview.md", "range": {"start": {"line": 38, "column": 123}}}, "severity": "WARNING"}

```tsx
import List from '@mui/material/List';
import { Calendar } from '@base-ui-components/react-x-date-pickers/calendar';

<Calendar.MonthsList
render={(props, state) => (
<List {...props} data-orientation={state.pickerOrientation} />
)}
>
{/** See demo above */}
</Calendar.MonthsList>;
```

- Every component can receive a `className` prop, they don't have any `className` by default:

```tsx
// Will always have the class "day"
<Calendar.DaysCell value={day} className="day" />

// Will always have the class "day"
// Will only have the class "day-selected" when the day is selected
<Calendar.DaysCell
value={day}
className={(state) => clsx("day", state.isDaySelected && "day-selected")}
/>
```

:::success
For most use-cases, people should use the `data-attr` instead of creating custom classes.
The state of the Date and Time Pickers is quite big so we won't add one `data-attr` for each property in it on each component.

Check warning on line 69 in docs/data/date-pickers/rfc-overview.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'we'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'we'.", "location": {"path": "docs/data/date-pickers/rfc-overview.md", "range": {"start": {"line": 69, "column": 58}}}, "severity": "WARNING"}
We will probably add the most useful one (`data-selected` on the `<Calendar.DaysCell />` component for example) and people can use the `className` prop for more advanced use cases.

Check warning on line 70 in docs/data/date-pickers/rfc-overview.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.We] Try to avoid using first-person plural like 'We'. Raw Output: {"message": "[Google.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "docs/data/date-pickers/rfc-overview.md", "range": {"start": {"line": 70, "column": 3}}}, "severity": "WARNING"}

Check warning on line 70 in docs/data/date-pickers/rfc-overview.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [Google.Will] Avoid using 'will'. Raw Output: {"message": "[Google.Will] Avoid using 'will'.", "location": {"path": "docs/data/date-pickers/rfc-overview.md", "range": {"start": {"line": 70, "column": 6}}}, "severity": "WARNING"}
:::

- Components can have `data-attr` to allow conditional styling

```tsx
<Calendar.DaysCell value={day} className="day">
```

```css
.day {
background-color: red;
}

.day[data-selected] {
background-color: green;
}
```
Loading
Loading