-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[pickers] Remove utils
and value
params from translations
#14986
Draft
arthurbalduini
wants to merge
5
commits into
mui:master
Choose a base branch
from
arthurbalduini:remove-utils-and-value-params-from-translations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+424
−510
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a1a0be8
remove utils and value params from translations functions
arthurbalduini 156e88d
adapt locale files
arthurbalduini 11c69f3
fix typescript
arthurbalduini 6dbbabc
adds migration doc
arthurbalduini b50ada1
removes fields section from migration doc
arthurbalduini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
productId: x-date-pickers | ||
--- | ||
|
||
# Migration from v7 to v8 | ||
|
||
<p class="description">This guide describes the changes needed to migrate the Date and Time Pickers from v7 to v8.</p> | ||
|
||
## Introduction | ||
|
||
This is a reference guide for upgrading `@mui/x-date-pickers` from v7 to v8. | ||
|
||
## Start using the new release | ||
|
||
In `package.json`, change the version of the date pickers package to `^8.0.0`. | ||
|
||
```diff | ||
-"@mui/x-date-pickers": "7.x.x", | ||
+"@mui/x-date-pickers": "^8.0.0", | ||
``` | ||
|
||
Since `v8` is a major release, it contains changes that affect the public API. | ||
These changes were done for consistency, improved stability and to make room for new features. | ||
Described below are the steps needed to migrate from v7 to v8. | ||
|
||
## Run codemods | ||
|
||
The `preset-safe` codemod will automatically adjust the bulk of your code to account for breaking changes in v8. You can run `v8.0.0/pickers/preset-safe` targeting only Date and Time Pickers or `v8.0.0/preset-safe` to target the other packages as well. | ||
Check warning on line 28 in docs/data/migration/migration-pickers-v7/migration-pickers-v7.md GitHub Actions / runner / vale
|
||
|
||
You can either run it on a specific file, folder, or your entire codebase when choosing the `<path>` argument. | ||
|
||
<!-- #default-branch-switch --> | ||
|
||
```bash | ||
// Date and Time Pickers specific | ||
npx @mui/x-codemod@latest v8.0.0/pickers/preset-safe <path> | ||
|
||
// Target the other packages as well | ||
npx @mui/x-codemod@latest v8.0.0/preset-safe <path> | ||
``` | ||
|
||
:::info | ||
If you want to run the transformers one by one, check out the transformers included in the [preset-safe codemod for pickers](https://github.com/mui/mui-x/blob/HEAD/packages/x-codemod/README.md#preset-safe-for-pickers-v800) for more details. | ||
::: | ||
|
||
Breaking changes that are handled by this codemod are denoted by a ✅ emoji in the table of contents on the right side of the screen. | ||
|
||
If you have already applied the `v8.0.0/pickers/preset-safe` (or `v8.0.0/preset-safe`) codemod, then you should not need to take any further action on these items. | ||
|
||
All other changes must be handled manually. | ||
|
||
:::warning | ||
Not all use cases are covered by codemods. In some scenarios, like props spreading, cross-file dependencies, etc., the changes are not properly identified and therefore must be handled manually. | ||
|
||
For example, if a codemod tries to rename a prop, but this prop is hidden with the spread operator, it won't be transformed as expected. | ||
|
||
```tsx | ||
<DatePicker {...pickerProps} /> | ||
``` | ||
|
||
After running the codemods, make sure to test your application and that you don't have any console errors. | ||
|
||
Feel free to [open an issue](https://github.com/mui/mui-x/issues/new/choose) for support if you need help to proceed with your migration. | ||
::: | ||
|
||
## Deprecated parameters used on translation keys functions | ||
|
||
If you are using a Picker with controlled value and views and you need to compose some of the following translation keys: `openDatePickerDialogue`, `openTimePickerDialogue`, or `clockLabelText`, after upgrading to v8 you only need to pass the formatted value and the time view (only for `clockLabelText`): | ||
|
||
```js | ||
const translations = useTranslations(); | ||
|
||
const openDatePickerDialogue = translations.openDatePickerDialogue( | ||
value == null ? null : value.format('MM/DD/YYY'), | ||
); | ||
const openTimePickerDialogue = translations.openTimePickerDialogue( | ||
value == null ? null : value.format('HH:mm:ss'), | ||
); | ||
const clockLabelText = translations.clockLabelText( | ||
view, | ||
value == null ? null : value.format('HH:mm:ss'), | ||
); | ||
``` | ||
|
||
Also the following types and interfaces no longer receive a generic type parameter: | ||
|
||
- `PickersComponentAgnosticLocaleText` | ||
- `PickersInputComponentLocaleText` | ||
- `PickersInputLocaleText` | ||
- `PickersLocaleText` | ||
- `PickersTranslationKeys` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
import * as pageProps from 'docsx/data/migration/migration-pickers-v7/migration-pickers-v7.md?muiMarkdown'; | ||
|
||
export default function Page() { | ||
return <MarkdownDocs {...pageProps} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This breaking change will also be covered by #15001
We can keep it for now waiting for the more detailed section about the removal of
TDate